fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

2
node_modules/valtio/ts3.4/esm/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { useSnapshot } from './react';
export { ref, proxy, getVersion, subscribe, snapshot, unstable_buildProxyFunction, } from './vanilla';

3
node_modules/valtio/ts3.4/esm/macro.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare function useProxy<T extends object>(proxyObject: T): void;
declare const _default: any;
export default _default;

5
node_modules/valtio/ts3.4/esm/macro/vite.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import * as plugin from 'aslemammad-vite-plugin-macro';
export declare const valtioMacro: plugin.Macro;
export declare function provideValtioMacro(): plugin.MacroProvider;
declare const macroPlugin: plugin.MacroPlugin;
export default macroPlugin;

78
node_modules/valtio/ts3.4/esm/react.d.ts generated vendored Normal file
View File

@@ -0,0 +1,78 @@
import { INTERNAL_Snapshot } from './vanilla';
declare type Options = {
sync?: boolean;
};
/**
* useSnapshot
*
* Create a local snapshot that catches changes. This hook actually returns a wrapped snapshot in a proxy for
* render optimization instead of a plain object compared to `snapshot()` method.
* Rule of thumb: read from snapshots, mutate the source.
* The component will only re-render when the parts of the state you access have changed, it is render-optimized.
*
* @example A
* function Counter() {
* const snap = useSnapshot(state)
* return (
* <div>
* {snap.count}
* <button onClick={() => ++state.count}>+1</button>
* </div>
* )
* }
*
* [Notes]
* Every object inside your proxy also becomes a proxy (if you don't use "ref"), so you can also use them to create
* the local snapshot as seen on example B.
*
* @example B
* function ProfileName() {
* const snap = useSnapshot(state.profile)
* return (
* <div>
* {snap.name}
* </div>
* )
* }
*
* Beware that you still can replace the child proxy with something else so it will break your snapshot. You can see
* above what happens with the original proxy when you replace the child proxy.
*
* > console.log(state)
* { profile: { name: "valtio" } }
* > childState = state.profile
* > console.log(childState)
* { name: "valtio" }
* > state.profile.name = "react"
* > console.log(childState)
* { name: "react" }
* > state.profile = { name: "new name" }
* > console.log(childState)
* { name: "react" }
* > console.log(state)
* { profile: { name: "new name" } }
*
* `useSnapshot()` depends on the original reference of the child proxy so if you replace it with a new one, the component
* that is subscribed to the old proxy won't receive new updates because it is still subscribed to the old one.
*
* In this case we recommend the example C or D. On both examples you don't need to worry with re-render,
* because it is render-optimized.
*
* @example C
* const snap = useSnapshot(state)
* return (
* <div>
* {snap.profile.name}
* </div>
* )
*
* @example D
* const { profile } = useSnapshot(state)
* return (
* <div>
* {profile.name}
* </div>
* )
*/
export declare function useSnapshot<T extends object>(proxyObject: T, options?: Options): INTERNAL_Snapshot<T>;
export {};

9
node_modules/valtio/ts3.4/esm/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export { subscribeKey } from './utils/subscribeKey';
export { watch } from './utils/watch';
export { devtools } from './utils/devtools';
export { derive, underive, unstable_deriveSubscriptions } from './utils/derive';
export { addComputed_DEPRECATED as addComputed } from './utils/addComputed';
export { proxyWithComputed } from './utils/proxyWithComputed';
export { proxyWithHistory } from './utils/proxyWithHistory';
export { proxySet } from './utils/proxySet';
export { proxyMap } from './utils/proxyMap';

8
node_modules/valtio/ts3.4/esm/utils/addComputed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* addComputed (DEPRECATED)
*
* @deprecated Please consider using `derive` or `proxyWithComputed` instead.
*/
export declare function addComputed_DEPRECATED<T extends object, U extends object>(proxyObject: T, computedFns_FAKE: {
[K in keyof U]: (snap_FAKE: T) => U[K];
}, targetObject?: any): any;

72
node_modules/valtio/ts3.4/esm/utils/derive.d.ts generated vendored Normal file
View File

@@ -0,0 +1,72 @@
declare type DeriveGet = <T extends object>(proxyObject: T) => T;
declare type Subscription = {
s: object;
d: object;
k: string;
c: () => void;
n: boolean;
i: string[];
p?: Promise<void>;
};
export declare const unstable_deriveSubscriptions: {
add: (subscription: Subscription) => void;
remove: (subscription: Subscription) => void;
list: (derivedObject: object) => Subscription[];
};
/**
* derive
*
* This creates derived properties and attaches them
* to a new proxy object or an existing proxy object.
*
* @example
* import { proxy } from 'valtio'
* import { derive } from 'valtio/utils'
*
* const state = proxy({
* count: 1,
* })
*
* const derivedState = derive({
* doubled: (get) => get(state).count * 2,
* })
*
* derive({
* tripled: (get) => get(state).count * 3,
* }, {
* proxy: state,
* })
*/
export declare function derive<T extends object, U extends object>(derivedFns: {
[K in keyof U]: (get: DeriveGet) => U[K];
}, options?: {
proxy?: T;
sync?: boolean;
}): T & U;
/**
* underive
*
* This stops derived properties to evaluate.
* It will stop all (or specified by `keys` option) subscriptions.
* If you specify `delete` option, it will delete the properties
* and you can attach new derived properties.
*
* @example
* import { proxy } from 'valtio'
* import { derive, underive } from 'valtio/utils'
*
* const state = proxy({
* count: 1,
* })
*
* const derivedState = derive({
* doubled: (get) => get(state).count * 2,
* })
*
* underive(derivedState)
*/
export declare function underive<T extends object, U extends object>(proxyObject: T & U, options?: {
delete?: boolean;
keys?: (keyof U)[];
}): void;
export {};

10
node_modules/valtio/ts3.4/esm/utils/devtools.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
declare type Options = {
enabled?: boolean;
name?: string;
};
export declare function devtools<T extends object>(proxyObject: T, options?: Options): (() => void) | undefined;
/**
* @deprecated Please use { name } option
*/
export declare function devtools<T extends object>(proxyObject: T, name?: string): (() => void) | undefined;
export {};

32
node_modules/valtio/ts3.4/esm/utils/proxyMap.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* proxyMap
*
* This is to create a proxy which mimic the native Map behavior.
* The API is the same as Map API
*
* @example
* import { proxyMap } from 'valtio/utils'
* const state = proxyMap([["key", "value"]])
*
* //can be used inside a proxy as well
* const state = proxy({
* count: 1,
* map: proxyMap()
* })
*
* // When using an object as a key, you can wrap it with `ref` so it's not proxied
* // this is useful if you want to preserve the key equality
* import { ref } from 'valtio'
*
* const key = ref({})
* state.set(key, "value")
* state.get(key) //value
*
* const key = {}
* state.set(key, "value")
* state.get(key) //undefined
*/
export declare function proxyMap<K, V>(entries?: Iterable<readonly [
K,
V
]> | null): Map<K, V>;

16
node_modules/valtio/ts3.4/esm/utils/proxySet.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/**
* proxySet
*
* This is to create a proxy which mimic the native Set behavior.
* The API is the same as Set API
*
* @example
* import { proxySet } from 'valtio/utils'
* const state = proxySet([1,2,3])
* //can be used inside a proxy as well
* const state = proxy({
* count: 1,
* set: proxySet()
* })
*/
export declare function proxySet<T>(initialValues?: Iterable<T> | null): Set<T>;

View File

@@ -0,0 +1,31 @@
import { INTERNAL_Snapshot } from '../vanilla';
/**
* proxyWithComputed
*
* This is to create a proxy with initial object and additional object,
* which specifies getters for computed values with dependency tracking.
* It also accepts optional setters for computed values.
*
* [Notes]
* This comes with a cost and overlaps with useSnapshot.
* Do not try to optimize too early. It can worsen the performance.
* Measurement and comparison will be very important.
*
* @example
* import { proxyWithComputed } from 'valtio/utils'
* const state = proxyWithComputed({
* count: 1,
* }, {
* doubled: snap => snap.count * 2, // getter only
* tripled: {
* get: snap => snap.count * 3,
* set: (state, newValue) => { state.count = newValue / 3 }
* }, // with optional setter
* })
*/
export declare function proxyWithComputed<T extends object, U extends object>(initialObject: T, computedFns: {
[K in keyof U]: ((snap: INTERNAL_Snapshot<T>) => U[K]) | {
get: (snap: INTERNAL_Snapshot<T>) => U[K];
set?: (state: T, newValue: U[K]) => void;
};
}): T & U;

View File

@@ -0,0 +1,40 @@
import { INTERNAL_Snapshot } from '../vanilla';
/**
* proxyWithHistory
*
* This creates a new proxy with history support.
* It includes following properties:
* - value: any value (does not have to be an object)
* - history: an array holding the history of snapshots
* - historyIndex: the history index to the current snapshot
* - canUndo: a function to return true if undo is available
* - undo: a function to go back history
* - canRedo: a function to return true if redo is available
* - redo: a function to go forward history
* - saveHistory: a function to save history
*
* [Notes]
* Suspense/promise is not supported.
*
* @example
* import { proxyWithHistory } from 'valtio/utils'
* const state = proxyWithHistory({
* count: 1,
* })
*/
export declare function proxyWithHistory<V>(initialValue: V, skipSubscribe?: boolean): {
value: V;
history: {
wip: INTERNAL_Snapshot<V> | undefined;
snapshots: INTERNAL_Snapshot<V>[];
index: number;
} & {
$$valtioRef: true;
};
canUndo: () => boolean;
undo: () => void;
canRedo: () => boolean;
redo: () => void;
saveHistory: () => void;
subscribe: () => () => void;
};

12
node_modules/valtio/ts3.4/esm/utils/subscribeKey.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/**
* subscribeKey
*
* The subscribeKey utility enables subscription to a primitive subproperty of a given state proxy.
* Subscriptions created with subscribeKey will only fire when the specified property changes.
* notifyInSync: same as the parameter to subscribe(); true disables batching of subscriptions.
*
* @example
* import { subscribeKey } from 'valtio/utils'
* subscribeKey(state, 'count', (v) => console.log('state.count has changed to', v))
*/
export declare function subscribeKey<T extends object, K extends keyof T>(proxyObject: T, key: K, callback: (value: T[K]) => void, notifyInSync?: boolean): () => void;

31
node_modules/valtio/ts3.4/esm/utils/watch.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
declare type Cleanup = () => void;
declare type WatchGet = <T extends object>(proxyObject: T) => T;
declare type WatchCallback = (get: WatchGet) => Cleanup | void | undefined;
declare type WatchOptions = {
sync?: boolean;
};
/**
* watch
*
* Creates a reactive effect that automatically tracks proxy objects and
* reevaluates everytime one of the tracked proxy objects updates. It returns
* a cleanup function to stop the reactive effect from reevaluating.
*
* Callback is invoked immediately to detect the tracked objects.
*
* Callback passed to `watch` receives a `get` function that "tracks" the
* passed proxy object.
*
* Watch callbacks may return an optional cleanup function, which is evaluated
* whenever the callback reevaluates or when the cleanup function returned by
* `watch` is evaluated.
*
* `watch` calls inside `watch` are also automatically tracked and cleaned up
* whenever the parent `watch` reevaluates.
*
* @param callback
* @returns A cleanup function that stops the callback from reevaluating and
* also performs cleanups registered into `watch`.
*/
export declare function watch(callback: WatchCallback, options?: WatchOptions): Cleanup;
export {};

62
node_modules/valtio/ts3.4/esm/vanilla.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
declare type AsRef = {
$$valtioRef: true;
};
declare type Path = (string | symbol)[];
declare type Op = [
/*op*/ 'set',
/*path*/ Path,
/*value*/ unknown,
/*prevValue*/ unknown
] | [
/*op*/ 'delete',
/*path*/ Path,
/*prevValue*/ unknown
] | [
/*op*/ 'resolve',
/*path*/ Path,
/*value*/ unknown
] | [
/*op*/ 'reject',
/*path*/ Path,
/*error*/ unknown
];
declare type AnyFunction = (...args: any[]) => any;
/**
* This is not a public API.
* It can be changed without any notice.
*/
export declare type INTERNAL_Snapshot<T> = T extends AnyFunction ? T : T extends AsRef ? T : T extends Promise<infer V> ? INTERNAL_Snapshot<V> : {
readonly [K in keyof T]: INTERNAL_Snapshot<T[K]>;
};
export declare function proxy<T extends object>(initialObject?: T): T;
export declare function getVersion(proxyObject: unknown): number | undefined;
export declare function subscribe<T extends object>(proxyObject: T, callback: (ops: Op[]) => void, notifyInSync?: boolean): () => void;
export declare function snapshot<T extends object>(proxyObject: T): INTERNAL_Snapshot<T>;
export declare function ref<T extends object>(obj: T): T & AsRef;
export declare const unstable_buildProxyFunction: (objectIs?: (value1: any, value2: any) => boolean, newProxy?: <T extends object>(target: T, handler: ProxyHandler<T>) => T, canProxy?: (x: unknown) => boolean, PROMISE_RESULT?: symbol, PROMISE_ERROR?: symbol, snapshotCache?: WeakMap<object, [
/*version*/ number,
/*snapshot*/ unknown
]>, createSnapshot?: <T_1 extends object>(version: number, target: T_1, receiver: any) => T_1, proxyCache?: WeakMap<object, object>, versionHolder?: [
number
], proxyFunction?: <T_2 extends object>(initialObject: T_2) => T_2) => readonly [
<T_2 extends object>(initialObject: T_2) => T_2,
WeakSet<object>,
symbol,
symbol,
symbol,
(value1: any, value2: any) => boolean,
<T extends object>(target: T, handler: ProxyHandler<T>) => T,
(x: unknown) => boolean,
symbol,
symbol,
WeakMap<object, [
/*version*/ number,
/*snapshot*/ unknown
]>,
<T_1 extends object>(version: number, target: T_1, receiver: any) => T_1,
WeakMap<object, object>,
[
number
]
];
export {};

2
node_modules/valtio/ts3.4/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { useSnapshot } from './react';
export { ref, proxy, getVersion, subscribe, snapshot, unstable_buildProxyFunction, } from './vanilla';

3
node_modules/valtio/ts3.4/macro.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export declare function useProxy<T extends object>(proxyObject: T): void;
declare const _default: any;
export default _default;

78
node_modules/valtio/ts3.4/react.d.ts generated vendored Normal file
View File

@@ -0,0 +1,78 @@
import { INTERNAL_Snapshot } from './vanilla';
declare type Options = {
sync?: boolean;
};
/**
* useSnapshot
*
* Create a local snapshot that catches changes. This hook actually returns a wrapped snapshot in a proxy for
* render optimization instead of a plain object compared to `snapshot()` method.
* Rule of thumb: read from snapshots, mutate the source.
* The component will only re-render when the parts of the state you access have changed, it is render-optimized.
*
* @example A
* function Counter() {
* const snap = useSnapshot(state)
* return (
* <div>
* {snap.count}
* <button onClick={() => ++state.count}>+1</button>
* </div>
* )
* }
*
* [Notes]
* Every object inside your proxy also becomes a proxy (if you don't use "ref"), so you can also use them to create
* the local snapshot as seen on example B.
*
* @example B
* function ProfileName() {
* const snap = useSnapshot(state.profile)
* return (
* <div>
* {snap.name}
* </div>
* )
* }
*
* Beware that you still can replace the child proxy with something else so it will break your snapshot. You can see
* above what happens with the original proxy when you replace the child proxy.
*
* > console.log(state)
* { profile: { name: "valtio" } }
* > childState = state.profile
* > console.log(childState)
* { name: "valtio" }
* > state.profile.name = "react"
* > console.log(childState)
* { name: "react" }
* > state.profile = { name: "new name" }
* > console.log(childState)
* { name: "react" }
* > console.log(state)
* { profile: { name: "new name" } }
*
* `useSnapshot()` depends on the original reference of the child proxy so if you replace it with a new one, the component
* that is subscribed to the old proxy won't receive new updates because it is still subscribed to the old one.
*
* In this case we recommend the example C or D. On both examples you don't need to worry with re-render,
* because it is render-optimized.
*
* @example C
* const snap = useSnapshot(state)
* return (
* <div>
* {snap.profile.name}
* </div>
* )
*
* @example D
* const { profile } = useSnapshot(state)
* return (
* <div>
* {profile.name}
* </div>
* )
*/
export declare function useSnapshot<T extends object>(proxyObject: T, options?: Options): INTERNAL_Snapshot<T>;
export {};

9
node_modules/valtio/ts3.4/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
export { subscribeKey } from './utils/subscribeKey';
export { watch } from './utils/watch';
export { devtools } from './utils/devtools';
export { derive, underive, unstable_deriveSubscriptions } from './utils/derive';
export { addComputed_DEPRECATED as addComputed } from './utils/addComputed';
export { proxyWithComputed } from './utils/proxyWithComputed';
export { proxyWithHistory } from './utils/proxyWithHistory';
export { proxySet } from './utils/proxySet';
export { proxyMap } from './utils/proxyMap';

8
node_modules/valtio/ts3.4/utils/addComputed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* addComputed (DEPRECATED)
*
* @deprecated Please consider using `derive` or `proxyWithComputed` instead.
*/
export declare function addComputed_DEPRECATED<T extends object, U extends object>(proxyObject: T, computedFns_FAKE: {
[K in keyof U]: (snap_FAKE: T) => U[K];
}, targetObject?: any): any;

72
node_modules/valtio/ts3.4/utils/derive.d.ts generated vendored Normal file
View File

@@ -0,0 +1,72 @@
declare type DeriveGet = <T extends object>(proxyObject: T) => T;
declare type Subscription = {
s: object;
d: object;
k: string;
c: () => void;
n: boolean;
i: string[];
p?: Promise<void>;
};
export declare const unstable_deriveSubscriptions: {
add: (subscription: Subscription) => void;
remove: (subscription: Subscription) => void;
list: (derivedObject: object) => Subscription[];
};
/**
* derive
*
* This creates derived properties and attaches them
* to a new proxy object or an existing proxy object.
*
* @example
* import { proxy } from 'valtio'
* import { derive } from 'valtio/utils'
*
* const state = proxy({
* count: 1,
* })
*
* const derivedState = derive({
* doubled: (get) => get(state).count * 2,
* })
*
* derive({
* tripled: (get) => get(state).count * 3,
* }, {
* proxy: state,
* })
*/
export declare function derive<T extends object, U extends object>(derivedFns: {
[K in keyof U]: (get: DeriveGet) => U[K];
}, options?: {
proxy?: T;
sync?: boolean;
}): T & U;
/**
* underive
*
* This stops derived properties to evaluate.
* It will stop all (or specified by `keys` option) subscriptions.
* If you specify `delete` option, it will delete the properties
* and you can attach new derived properties.
*
* @example
* import { proxy } from 'valtio'
* import { derive, underive } from 'valtio/utils'
*
* const state = proxy({
* count: 1,
* })
*
* const derivedState = derive({
* doubled: (get) => get(state).count * 2,
* })
*
* underive(derivedState)
*/
export declare function underive<T extends object, U extends object>(proxyObject: T & U, options?: {
delete?: boolean;
keys?: (keyof U)[];
}): void;
export {};

10
node_modules/valtio/ts3.4/utils/devtools.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
declare type Options = {
enabled?: boolean;
name?: string;
};
export declare function devtools<T extends object>(proxyObject: T, options?: Options): (() => void) | undefined;
/**
* @deprecated Please use { name } option
*/
export declare function devtools<T extends object>(proxyObject: T, name?: string): (() => void) | undefined;
export {};

32
node_modules/valtio/ts3.4/utils/proxyMap.d.ts generated vendored Normal file
View File

@@ -0,0 +1,32 @@
/**
* proxyMap
*
* This is to create a proxy which mimic the native Map behavior.
* The API is the same as Map API
*
* @example
* import { proxyMap } from 'valtio/utils'
* const state = proxyMap([["key", "value"]])
*
* //can be used inside a proxy as well
* const state = proxy({
* count: 1,
* map: proxyMap()
* })
*
* // When using an object as a key, you can wrap it with `ref` so it's not proxied
* // this is useful if you want to preserve the key equality
* import { ref } from 'valtio'
*
* const key = ref({})
* state.set(key, "value")
* state.get(key) //value
*
* const key = {}
* state.set(key, "value")
* state.get(key) //undefined
*/
export declare function proxyMap<K, V>(entries?: Iterable<readonly [
K,
V
]> | null): Map<K, V>;

16
node_modules/valtio/ts3.4/utils/proxySet.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
/**
* proxySet
*
* This is to create a proxy which mimic the native Set behavior.
* The API is the same as Set API
*
* @example
* import { proxySet } from 'valtio/utils'
* const state = proxySet([1,2,3])
* //can be used inside a proxy as well
* const state = proxy({
* count: 1,
* set: proxySet()
* })
*/
export declare function proxySet<T>(initialValues?: Iterable<T> | null): Set<T>;

31
node_modules/valtio/ts3.4/utils/proxyWithComputed.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import { INTERNAL_Snapshot } from '../vanilla';
/**
* proxyWithComputed
*
* This is to create a proxy with initial object and additional object,
* which specifies getters for computed values with dependency tracking.
* It also accepts optional setters for computed values.
*
* [Notes]
* This comes with a cost and overlaps with useSnapshot.
* Do not try to optimize too early. It can worsen the performance.
* Measurement and comparison will be very important.
*
* @example
* import { proxyWithComputed } from 'valtio/utils'
* const state = proxyWithComputed({
* count: 1,
* }, {
* doubled: snap => snap.count * 2, // getter only
* tripled: {
* get: snap => snap.count * 3,
* set: (state, newValue) => { state.count = newValue / 3 }
* }, // with optional setter
* })
*/
export declare function proxyWithComputed<T extends object, U extends object>(initialObject: T, computedFns: {
[K in keyof U]: ((snap: INTERNAL_Snapshot<T>) => U[K]) | {
get: (snap: INTERNAL_Snapshot<T>) => U[K];
set?: (state: T, newValue: U[K]) => void;
};
}): T & U;

40
node_modules/valtio/ts3.4/utils/proxyWithHistory.d.ts generated vendored Normal file
View File

@@ -0,0 +1,40 @@
import { INTERNAL_Snapshot } from '../vanilla';
/**
* proxyWithHistory
*
* This creates a new proxy with history support.
* It includes following properties:
* - value: any value (does not have to be an object)
* - history: an array holding the history of snapshots
* - historyIndex: the history index to the current snapshot
* - canUndo: a function to return true if undo is available
* - undo: a function to go back history
* - canRedo: a function to return true if redo is available
* - redo: a function to go forward history
* - saveHistory: a function to save history
*
* [Notes]
* Suspense/promise is not supported.
*
* @example
* import { proxyWithHistory } from 'valtio/utils'
* const state = proxyWithHistory({
* count: 1,
* })
*/
export declare function proxyWithHistory<V>(initialValue: V, skipSubscribe?: boolean): {
value: V;
history: {
wip: INTERNAL_Snapshot<V> | undefined;
snapshots: INTERNAL_Snapshot<V>[];
index: number;
} & {
$$valtioRef: true;
};
canUndo: () => boolean;
undo: () => void;
canRedo: () => boolean;
redo: () => void;
saveHistory: () => void;
subscribe: () => () => void;
};

12
node_modules/valtio/ts3.4/utils/subscribeKey.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
/**
* subscribeKey
*
* The subscribeKey utility enables subscription to a primitive subproperty of a given state proxy.
* Subscriptions created with subscribeKey will only fire when the specified property changes.
* notifyInSync: same as the parameter to subscribe(); true disables batching of subscriptions.
*
* @example
* import { subscribeKey } from 'valtio/utils'
* subscribeKey(state, 'count', (v) => console.log('state.count has changed to', v))
*/
export declare function subscribeKey<T extends object, K extends keyof T>(proxyObject: T, key: K, callback: (value: T[K]) => void, notifyInSync?: boolean): () => void;

31
node_modules/valtio/ts3.4/utils/watch.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
declare type Cleanup = () => void;
declare type WatchGet = <T extends object>(proxyObject: T) => T;
declare type WatchCallback = (get: WatchGet) => Cleanup | void | undefined;
declare type WatchOptions = {
sync?: boolean;
};
/**
* watch
*
* Creates a reactive effect that automatically tracks proxy objects and
* reevaluates everytime one of the tracked proxy objects updates. It returns
* a cleanup function to stop the reactive effect from reevaluating.
*
* Callback is invoked immediately to detect the tracked objects.
*
* Callback passed to `watch` receives a `get` function that "tracks" the
* passed proxy object.
*
* Watch callbacks may return an optional cleanup function, which is evaluated
* whenever the callback reevaluates or when the cleanup function returned by
* `watch` is evaluated.
*
* `watch` calls inside `watch` are also automatically tracked and cleaned up
* whenever the parent `watch` reevaluates.
*
* @param callback
* @returns A cleanup function that stops the callback from reevaluating and
* also performs cleanups registered into `watch`.
*/
export declare function watch(callback: WatchCallback, options?: WatchOptions): Cleanup;
export {};

62
node_modules/valtio/ts3.4/vanilla.d.ts generated vendored Normal file
View File

@@ -0,0 +1,62 @@
declare type AsRef = {
$$valtioRef: true;
};
declare type Path = (string | symbol)[];
declare type Op = [
/*op*/ 'set',
/*path*/ Path,
/*value*/ unknown,
/*prevValue*/ unknown
] | [
/*op*/ 'delete',
/*path*/ Path,
/*prevValue*/ unknown
] | [
/*op*/ 'resolve',
/*path*/ Path,
/*value*/ unknown
] | [
/*op*/ 'reject',
/*path*/ Path,
/*error*/ unknown
];
declare type AnyFunction = (...args: any[]) => any;
/**
* This is not a public API.
* It can be changed without any notice.
*/
export declare type INTERNAL_Snapshot<T> = T extends AnyFunction ? T : T extends AsRef ? T : T extends Promise<infer V> ? INTERNAL_Snapshot<V> : {
readonly [K in keyof T]: INTERNAL_Snapshot<T[K]>;
};
export declare function proxy<T extends object>(initialObject?: T): T;
export declare function getVersion(proxyObject: unknown): number | undefined;
export declare function subscribe<T extends object>(proxyObject: T, callback: (ops: Op[]) => void, notifyInSync?: boolean): () => void;
export declare function snapshot<T extends object>(proxyObject: T): INTERNAL_Snapshot<T>;
export declare function ref<T extends object>(obj: T): T & AsRef;
export declare const unstable_buildProxyFunction: (objectIs?: (value1: any, value2: any) => boolean, newProxy?: <T extends object>(target: T, handler: ProxyHandler<T>) => T, canProxy?: (x: unknown) => boolean, PROMISE_RESULT?: symbol, PROMISE_ERROR?: symbol, snapshotCache?: WeakMap<object, [
/*version*/ number,
/*snapshot*/ unknown
]>, createSnapshot?: <T_1 extends object>(version: number, target: T_1, receiver: any) => T_1, proxyCache?: WeakMap<object, object>, versionHolder?: [
number
], proxyFunction?: <T_2 extends object>(initialObject: T_2) => T_2) => readonly [
<T_2 extends object>(initialObject: T_2) => T_2,
WeakSet<object>,
symbol,
symbol,
symbol,
(value1: any, value2: any) => boolean,
<T extends object>(target: T, handler: ProxyHandler<T>) => T,
(x: unknown) => boolean,
symbol,
symbol,
WeakMap<object, [
/*version*/ number,
/*snapshot*/ unknown
]>,
<T_1 extends object>(version: number, target: T_1, receiver: any) => T_1,
WeakMap<object, object>,
[
number
]
];
export {};