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

80
node_modules/valtio/system/index.development.js generated vendored Normal file
View File

@@ -0,0 +1,80 @@
System.register(['react', 'proxy-compare', 'use-sync-external-store/shim', 'valtio/vanilla'], (function (exports) {
'use strict';
var useRef, useCallback, useEffect, useMemo, useDebugValue, isChanged, createProxy, affectedToPathList, useSyncExternalStoreExports, subscribe, snapshot;
return {
setters: [function (module) {
useRef = module.useRef;
useCallback = module.useCallback;
useEffect = module.useEffect;
useMemo = module.useMemo;
useDebugValue = module.useDebugValue;
}, function (module) {
isChanged = module.isChanged;
createProxy = module.createProxy;
affectedToPathList = module.affectedToPathList;
}, function (module) {
useSyncExternalStoreExports = module["default"];
}, function (module) {
subscribe = module.subscribe;
snapshot = module.snapshot;
exports({ getVersion: module.getVersion, proxy: module.proxy, ref: module.ref, snapshot: module.snapshot, subscribe: module.subscribe, unstable_buildProxyFunction: module.unstable_buildProxyFunction });
}],
execute: (function () {
exports('useSnapshot', useSnapshot);
const { useSyncExternalStore } = useSyncExternalStoreExports;
const useAffectedDebugValue = (state, affected) => {
const pathList = useRef();
useEffect(() => {
pathList.current = affectedToPathList(state, affected);
});
useDebugValue(pathList.current);
};
function useSnapshot(proxyObject, options) {
const notifyInSync = options == null ? void 0 : options.sync;
const lastSnapshot = useRef();
const lastAffected = useRef();
let inRender = true;
const currSnapshot = useSyncExternalStore(
useCallback(
(callback) => {
const unsub = subscribe(proxyObject, callback, notifyInSync);
callback();
return unsub;
},
[proxyObject, notifyInSync]
),
() => {
const nextSnapshot = snapshot(proxyObject);
try {
if (!inRender && lastSnapshot.current && lastAffected.current && !isChanged(
lastSnapshot.current,
nextSnapshot,
lastAffected.current,
/* @__PURE__ */ new WeakMap()
)) {
return lastSnapshot.current;
}
} catch (e) {
}
return nextSnapshot;
},
() => snapshot(proxyObject)
);
inRender = false;
const currAffected = /* @__PURE__ */ new WeakMap();
useEffect(() => {
lastSnapshot.current = currSnapshot;
lastAffected.current = currAffected;
});
{
useAffectedDebugValue(currSnapshot, currAffected);
}
const proxyCache = useMemo(() => /* @__PURE__ */ new WeakMap(), []);
return createProxy(currSnapshot, currAffected, proxyCache);
}
})
};
}));

1
node_modules/valtio/system/index.production.js generated vendored Normal file
View File

@@ -0,0 +1 @@
System.register(["react","proxy-compare","use-sync-external-store/shim","valtio/vanilla"],function(a){"use strict";var r,i,o,f,b,p,y,h,c;return{setters:[function(n){r=n.useRef,i=n.useCallback,o=n.useEffect,f=n.useMemo},function(n){b=n.isChanged,p=n.createProxy},function(n){y=n.default},function(n){h=n.subscribe,c=n.snapshot,a({getVersion:n.getVersion,proxy:n.proxy,ref:n.ref,snapshot:n.snapshot,subscribe:n.subscribe,unstable_buildProxyFunction:n.unstable_buildProxyFunction})}],execute:function(){a("useSnapshot",S);const{useSyncExternalStore:n}=y;function S(t,x){const l=x==null?void 0:x.sync,s=r(),u=r();let g=!0;const k=n(i(e=>{const C=h(t,e,l);return e(),C},[t,l]),()=>{const e=c(t);try{if(!g&&s.current&&u.current&&!b(s.current,e,u.current,new WeakMap))return s.current}catch{}return e},()=>c(t));g=!1;const M=new WeakMap;o(()=>{s.current=k,u.current=M});const v=f(()=>new WeakMap,[]);return p(k,M,v)}}}});

51
node_modules/valtio/system/macro.development.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
System.register(['@babel/helper-module-imports', '@babel/types', 'babel-plugin-macros'], (function (exports) {
'use strict';
var addNamed, t, createMacro, MacroError;
return {
setters: [function (module) {
addNamed = module.addNamed;
}, function (module) {
t = module;
}, function (module) {
createMacro = module.createMacro;
MacroError = module.MacroError;
}],
execute: (function () {
const macro = ({ references }) => {
var _a;
(_a = references.useProxy) == null ? void 0 : _a.forEach((path) => {
var _a2, _b, _c, _d, _e, _f;
const hook = addNamed(path, "useSnapshot", "valtio");
const proxy = (_b = (_a2 = path.parentPath) == null ? void 0 : _a2.get("arguments.0")) == null ? void 0 : _b.node;
if (!t.isIdentifier(proxy))
throw new MacroError("no proxy object");
const snap = t.identifier(`valtio_macro_snap_${proxy.name}`);
(_d = (_c = path.parentPath) == null ? void 0 : _c.parentPath) == null ? void 0 : _d.replaceWith(
t.variableDeclaration("const", [
t.variableDeclarator(snap, t.callExpression(hook, [proxy]))
])
);
let inFunction = 0;
(_f = (_e = path.parentPath) == null ? void 0 : _e.getFunctionParent()) == null ? void 0 : _f.traverse({
Identifier(p) {
if (inFunction === 0 && p.node !== proxy && p.node.name === proxy.name) {
p.node.name = snap.name;
}
},
Function: {
enter() {
++inFunction;
},
exit() {
--inFunction;
}
}
});
});
};
var macro$1 = exports('default', createMacro(macro, { configName: "valtio" }));
})
};
}));

1
node_modules/valtio/system/macro.production.js generated vendored Normal file
View File

@@ -0,0 +1 @@
System.register(["@babel/helper-module-imports","@babel/types","babel-plugin-macros"],function(h){"use strict";var i,a,l,c;return{setters:[function(e){i=e.addNamed},function(e){a=e},function(e){l=e.createMacro,c=e.MacroError}],execute:function(){var P=h("default",l(({references:g})=>{var s;(s=g.useProxy)==null||s.forEach(r=>{var u,d,v,m,p,f;const x=i(r,"useSnapshot","valtio"),n=(d=(u=r.parentPath)==null?void 0:u.get("arguments.0"))==null?void 0:d.node;if(!a.isIdentifier(n))throw new c("no proxy object");const b=a.identifier(`valtio_macro_snap_${n.name}`);(m=(v=r.parentPath)==null?void 0:v.parentPath)==null||m.replaceWith(a.variableDeclaration("const",[a.variableDeclarator(b,a.callExpression(x,[n]))]));let t=0;(f=(p=r.parentPath)==null?void 0:p.getFunctionParent())==null||f.traverse({Identifier(o){t===0&&o.node!==n&&o.node.name===n.name&&(o.node.name=b.name)},Function:{enter(){++t},exit(){--t}}})})},{configName:"valtio"}))}}});

64
node_modules/valtio/system/macro/vite.development.js generated vendored Normal file
View File

@@ -0,0 +1,64 @@
System.register(['@babel/helper-module-imports', '@babel/types', 'aslemammad-vite-plugin-macro', 'babel-plugin-macros'], (function (exports) {
'use strict';
var babelModuleImports, t, plugin, babelMacro;
return {
setters: [function (module) {
babelModuleImports = module;
}, function (module) {
t = module;
}, function (module) {
plugin = module;
}, function (module) {
babelMacro = module;
}],
execute: (function () {
exports('provideValtioMacro', provideValtioMacro);
const { defineMacro, defineMacroProvider, createMacroPlugin } = "default" in plugin ? plugin.default : plugin;
const valtioMacro = exports('valtioMacro', defineMacro(`useProxy`).withSignature(`<T extends object>(proxyObject: T): void`).withHandler((ctx) => {
var _a, _b, _c, _d;
const { path, args } = ctx;
const hook = babelModuleImports.addNamed(path, "useSnapshot", "valtio");
const proxy = (_a = args[0]) == null ? void 0 : _a.node;
if (!t.isIdentifier(proxy)) {
throw new babelMacro.MacroError("no proxy object");
}
const snap = t.identifier(`valtio_macro_snap_${proxy.name}`);
(_b = path.parentPath) == null ? void 0 : _b.replaceWith(
t.variableDeclaration("const", [
t.variableDeclarator(snap, t.callExpression(hook, [proxy]))
])
);
let inFunction = 0;
(_d = (_c = path.parentPath) == null ? void 0 : _c.getFunctionParent()) == null ? void 0 : _d.traverse({
Identifier(p) {
if (inFunction === 0 && p.node !== proxy && p.node.name === proxy.name) {
p.node.name = snap.name;
}
},
Function: {
enter() {
++inFunction;
},
exit() {
--inFunction;
}
}
});
}));
function provideValtioMacro() {
return defineMacroProvider({
id: "valtio/macro",
exports: {
"valtio/macro": {
macros: [valtioMacro]
}
}
});
}
const macroPlugin = exports('default', createMacroPlugin({}).use(provideValtioMacro()));
})
};
}));

1
node_modules/valtio/system/macro/vite.production.js generated vendored Normal file
View File

@@ -0,0 +1 @@
System.register(["@babel/helper-module-imports","@babel/types","aslemammad-vite-plugin-macro","babel-plugin-macros"],function(o){"use strict";var l,t,n,u;return{setters:[function(e){l=e},function(e){t=e},function(e){n=e},function(e){u=e}],execute:function(){o("provideValtioMacro",s);const{defineMacro:e,defineMacroProvider:b,createMacroPlugin:h}="default"in n?n.default:n,M=o("valtioMacro",e("useProxy").withSignature("<T extends object>(proxyObject: T): void").withHandler(g=>{var d,m,v,f;const{path:r,args:x}=g,P=l.addNamed(r,"useSnapshot","valtio"),a=(d=x[0])==null?void 0:d.node;if(!t.isIdentifier(a))throw new u.MacroError("no proxy object");const p=t.identifier(`valtio_macro_snap_${a.name}`);(m=r.parentPath)==null||m.replaceWith(t.variableDeclaration("const",[t.variableDeclarator(p,t.callExpression(P,[a]))]));let i=0;(f=(v=r.parentPath)==null?void 0:v.getFunctionParent())==null||f.traverse({Identifier(c){i===0&&c.node!==a&&c.node.name===a.name&&(c.node.name=p.name)},Function:{enter(){++i},exit(){--i}}})}));function s(){return b({id:"valtio/macro",exports:{"valtio/macro":{macros:[M]}}})}const y=o("default",h({}).use(s()))}}});

603
node_modules/valtio/system/utils.development.js generated vendored Normal file
View File

@@ -0,0 +1,603 @@
System.register(['valtio/vanilla'], (function (exports) {
'use strict';
var subscribe, snapshot, proxy, getVersion, ref;
return {
setters: [function (module) {
subscribe = module.subscribe;
snapshot = module.snapshot;
proxy = module.proxy;
getVersion = module.getVersion;
ref = module.ref;
}],
execute: (function () {
exports({
addComputed: addComputed_DEPRECATED,
derive: derive,
devtools: devtools,
proxyMap: proxyMap,
proxySet: proxySet,
proxyWithComputed: proxyWithComputed,
proxyWithHistory: proxyWithHistory,
subscribeKey: subscribeKey,
underive: underive,
watch: watch
});
function subscribeKey(proxyObject, key, callback, notifyInSync) {
return subscribe(
proxyObject,
(ops) => {
if (ops.some((op) => op[1][0] === key)) {
callback(proxyObject[key]);
}
},
notifyInSync
);
}
let currentCleanups;
function watch(callback, options) {
let alive = true;
const cleanups = /* @__PURE__ */ new Set();
const subscriptions = /* @__PURE__ */ new Map();
const cleanup = () => {
if (alive) {
alive = false;
cleanups.forEach((clean) => clean());
cleanups.clear();
subscriptions.forEach((unsubscribe) => unsubscribe());
subscriptions.clear();
}
};
const revalidate = () => {
if (!alive) {
return;
}
cleanups.forEach((clean) => clean());
cleanups.clear();
const proxiesToSubscribe = /* @__PURE__ */ new Set();
const parent = currentCleanups;
currentCleanups = cleanups;
try {
const cleanupReturn = callback((proxyObject) => {
proxiesToSubscribe.add(proxyObject);
return proxyObject;
});
if (cleanupReturn) {
cleanups.add(cleanupReturn);
}
} finally {
currentCleanups = parent;
}
subscriptions.forEach((unsubscribe, proxyObject) => {
if (proxiesToSubscribe.has(proxyObject)) {
proxiesToSubscribe.delete(proxyObject);
} else {
subscriptions.delete(proxyObject);
unsubscribe();
}
});
proxiesToSubscribe.forEach((proxyObject) => {
const unsubscribe = subscribe(proxyObject, revalidate, options == null ? void 0 : options.sync);
subscriptions.set(proxyObject, unsubscribe);
});
};
if (currentCleanups) {
currentCleanups.add(cleanup);
}
revalidate();
return cleanup;
}
const DEVTOOLS = Symbol();
function devtools(proxyObject, options) {
if (typeof options === "string") {
console.warn(
"string name option is deprecated, use { name }. https://github.com/pmndrs/valtio/pull/400"
);
options = { name: options };
}
const { enabled, name = "" } = options || {};
let extension;
try {
extension = (enabled != null ? enabled : true) && window.__REDUX_DEVTOOLS_EXTENSION__;
} catch {
}
if (!extension) {
if (enabled) {
console.warn("[Warning] Please install/enable Redux devtools extension");
}
return;
}
let isTimeTraveling = false;
const devtools2 = extension.connect({ name });
const unsub1 = subscribe(proxyObject, (ops) => {
const action = ops.filter(([_, path]) => path[0] !== DEVTOOLS).map(([op, path]) => `${op}:${path.map(String).join(".")}`).join(", ");
if (!action) {
return;
}
if (isTimeTraveling) {
isTimeTraveling = false;
} else {
const snapWithoutDevtools = Object.assign({}, snapshot(proxyObject));
delete snapWithoutDevtools[DEVTOOLS];
devtools2.send(
{
type: action,
updatedAt: new Date().toLocaleString()
},
snapWithoutDevtools
);
}
});
const unsub2 = devtools2.subscribe((message) => {
var _a, _b, _c, _d, _e, _f;
if (message.type === "ACTION" && message.payload) {
try {
Object.assign(proxyObject, JSON.parse(message.payload));
} catch (e) {
console.error(
"please dispatch a serializable value that JSON.parse() and proxy() support\n",
e
);
}
}
if (message.type === "DISPATCH" && message.state) {
if (((_a = message.payload) == null ? void 0 : _a.type) === "JUMP_TO_ACTION" || ((_b = message.payload) == null ? void 0 : _b.type) === "JUMP_TO_STATE") {
isTimeTraveling = true;
const state = JSON.parse(message.state);
Object.assign(proxyObject, state);
}
proxyObject[DEVTOOLS] = message;
} else if (message.type === "DISPATCH" && ((_c = message.payload) == null ? void 0 : _c.type) === "COMMIT") {
devtools2.init(snapshot(proxyObject));
} else if (message.type === "DISPATCH" && ((_d = message.payload) == null ? void 0 : _d.type) === "IMPORT_STATE") {
const actions = (_e = message.payload.nextLiftedState) == null ? void 0 : _e.actionsById;
const computedStates = ((_f = message.payload.nextLiftedState) == null ? void 0 : _f.computedStates) || [];
isTimeTraveling = true;
computedStates.forEach(({ state }, index) => {
const action = actions[index] || "No action found";
Object.assign(proxyObject, state);
if (index === 0) {
devtools2.init(snapshot(proxyObject));
} else {
devtools2.send(action, snapshot(proxyObject));
}
});
}
});
devtools2.init(snapshot(proxyObject));
return () => {
unsub1();
unsub2 == null ? void 0 : unsub2();
};
}
const sourceObjectMap = /* @__PURE__ */ new WeakMap();
const derivedObjectMap = /* @__PURE__ */ new WeakMap();
const markPending = (sourceObject, callback) => {
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry) {
sourceObjectEntry[0].forEach((subscription) => {
const { d: derivedObject } = subscription;
if (sourceObject !== derivedObject) {
markPending(derivedObject);
}
});
++sourceObjectEntry[2];
if (callback) {
sourceObjectEntry[3].add(callback);
}
}
};
const checkPending = (sourceObject, callback) => {
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry == null ? void 0 : sourceObjectEntry[2]) {
sourceObjectEntry[3].add(callback);
return true;
}
return false;
};
const unmarkPending = (sourceObject) => {
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry) {
--sourceObjectEntry[2];
if (!sourceObjectEntry[2]) {
sourceObjectEntry[3].forEach((callback) => callback());
sourceObjectEntry[3].clear();
}
sourceObjectEntry[0].forEach((subscription) => {
const { d: derivedObject } = subscription;
if (sourceObject !== derivedObject) {
unmarkPending(derivedObject);
}
});
}
};
const addSubscription = (subscription) => {
const { s: sourceObject, d: derivedObject } = subscription;
let derivedObjectEntry = derivedObjectMap.get(derivedObject);
if (!derivedObjectEntry) {
derivedObjectEntry = [/* @__PURE__ */ new Set()];
derivedObjectMap.set(subscription.d, derivedObjectEntry);
}
derivedObjectEntry[0].add(subscription);
let sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (!sourceObjectEntry) {
const subscriptions = /* @__PURE__ */ new Set();
const unsubscribe = subscribe(
sourceObject,
(ops) => {
subscriptions.forEach((subscription2) => {
const {
d: derivedObject2,
c: callback,
n: notifyInSync,
i: ignoreKeys
} = subscription2;
if (sourceObject === derivedObject2 && ops.every(
(op) => op[1].length === 1 && ignoreKeys.includes(op[1][0])
)) {
return;
}
if (subscription2.p) {
return;
}
markPending(sourceObject, callback);
if (notifyInSync) {
unmarkPending(sourceObject);
} else {
subscription2.p = Promise.resolve().then(() => {
delete subscription2.p;
unmarkPending(sourceObject);
});
}
});
},
true
);
sourceObjectEntry = [subscriptions, unsubscribe, 0, /* @__PURE__ */ new Set()];
sourceObjectMap.set(sourceObject, sourceObjectEntry);
}
sourceObjectEntry[0].add(subscription);
};
const removeSubscription = (subscription) => {
const { s: sourceObject, d: derivedObject } = subscription;
const derivedObjectEntry = derivedObjectMap.get(derivedObject);
derivedObjectEntry == null ? void 0 : derivedObjectEntry[0].delete(subscription);
if ((derivedObjectEntry == null ? void 0 : derivedObjectEntry[0].size) === 0) {
derivedObjectMap.delete(derivedObject);
}
const sourceObjectEntry = sourceObjectMap.get(sourceObject);
if (sourceObjectEntry) {
const [subscriptions, unsubscribe] = sourceObjectEntry;
subscriptions.delete(subscription);
if (!subscriptions.size) {
unsubscribe();
sourceObjectMap.delete(sourceObject);
}
}
};
const listSubscriptions = (derivedObject) => {
const derivedObjectEntry = derivedObjectMap.get(derivedObject);
if (derivedObjectEntry) {
return Array.from(derivedObjectEntry[0]);
}
return [];
};
const unstable_deriveSubscriptions = exports('unstable_deriveSubscriptions', {
add: addSubscription,
remove: removeSubscription,
list: listSubscriptions
});
function derive(derivedFns, options) {
const proxyObject = (options == null ? void 0 : options.proxy) || proxy({});
const notifyInSync = !!(options == null ? void 0 : options.sync);
const derivedKeys = Object.keys(derivedFns);
derivedKeys.forEach((key) => {
if (Object.getOwnPropertyDescriptor(proxyObject, key)) {
throw new Error("object property already defined");
}
const fn = derivedFns[key];
let lastDependencies = null;
const evaluate = () => {
if (lastDependencies) {
if (Array.from(lastDependencies).map(([p]) => checkPending(p, evaluate)).some((isPending) => isPending)) {
return;
}
if (Array.from(lastDependencies).every(
([p, entry]) => getVersion(p) === entry.v
)) {
return;
}
}
const dependencies = /* @__PURE__ */ new Map();
const get = (p) => {
dependencies.set(p, { v: getVersion(p) });
return p;
};
const value = fn(get);
const subscribeToDependencies = () => {
dependencies.forEach((entry, p) => {
var _a;
const lastSubscription = (_a = lastDependencies == null ? void 0 : lastDependencies.get(p)) == null ? void 0 : _a.s;
if (lastSubscription) {
entry.s = lastSubscription;
} else {
const subscription = {
s: p,
d: proxyObject,
k: key,
c: evaluate,
n: notifyInSync,
i: derivedKeys
};
addSubscription(subscription);
entry.s = subscription;
}
});
lastDependencies == null ? void 0 : lastDependencies.forEach((entry, p) => {
if (!dependencies.has(p) && entry.s) {
removeSubscription(entry.s);
}
});
lastDependencies = dependencies;
};
if (value instanceof Promise) {
value.finally(subscribeToDependencies);
} else {
subscribeToDependencies();
}
proxyObject[key] = value;
};
evaluate();
});
return proxyObject;
}
function underive(proxyObject, options) {
const keysToDelete = (options == null ? void 0 : options.delete) ? /* @__PURE__ */ new Set() : null;
listSubscriptions(proxyObject).forEach((subscription) => {
const { k: key } = subscription;
if (!(options == null ? void 0 : options.keys) || options.keys.includes(key)) {
removeSubscription(subscription);
if (keysToDelete) {
keysToDelete.add(key);
}
}
});
if (keysToDelete) {
keysToDelete.forEach((key) => {
delete proxyObject[key];
});
}
}
function addComputed_DEPRECATED(proxyObject, computedFns_FAKE, targetObject = proxyObject) {
console.warn(
"addComputed is deprecated. Please consider using `derive` or `proxyWithComputed` instead. Falling back to emulation with derive. https://github.com/pmndrs/valtio/pull/201"
);
const derivedFns = {};
Object.keys(computedFns_FAKE).forEach((key) => {
derivedFns[key] = (get) => computedFns_FAKE[key](get(proxyObject));
});
return derive(derivedFns, { proxy: targetObject });
}
function proxyWithComputed(initialObject, computedFns) {
Object.keys(computedFns).forEach((key) => {
if (Object.getOwnPropertyDescriptor(initialObject, key)) {
throw new Error("object property already defined");
}
const computedFn = computedFns[key];
const { get, set } = typeof computedFn === "function" ? { get: computedFn } : computedFn;
const desc = {};
desc.get = () => get(snapshot(proxyObject));
if (set) {
desc.set = (newValue) => set(proxyObject, newValue);
}
Object.defineProperty(initialObject, key, desc);
});
const proxyObject = proxy(initialObject);
return proxyObject;
}
const isObject = (x) => typeof x === "object" && x !== null;
const deepClone = (obj) => {
if (!isObject(obj)) {
return obj;
}
const baseObject = Array.isArray(obj) ? [] : Object.create(Object.getPrototypeOf(obj));
Reflect.ownKeys(obj).forEach((key) => {
baseObject[key] = deepClone(obj[key]);
});
return baseObject;
};
function proxyWithHistory(initialValue, skipSubscribe = false) {
const proxyObject = proxy({
value: initialValue,
history: ref({
wip: void 0,
snapshots: [],
index: -1
}),
canUndo: () => proxyObject.history.index > 0,
undo: () => {
if (proxyObject.canUndo()) {
proxyObject.value = proxyObject.history.wip = deepClone(
proxyObject.history.snapshots[--proxyObject.history.index]
);
}
},
canRedo: () => proxyObject.history.index < proxyObject.history.snapshots.length - 1,
redo: () => {
if (proxyObject.canRedo()) {
proxyObject.value = proxyObject.history.wip = deepClone(
proxyObject.history.snapshots[++proxyObject.history.index]
);
}
},
saveHistory: () => {
proxyObject.history.snapshots.splice(proxyObject.history.index + 1);
proxyObject.history.snapshots.push(snapshot(proxyObject).value);
++proxyObject.history.index;
},
subscribe: () => subscribe(proxyObject, (ops) => {
if (ops.every(
(op) => op[1][0] === "value" && (op[0] !== "set" || op[2] !== proxyObject.history.wip)
)) {
proxyObject.saveHistory();
}
})
});
proxyObject.saveHistory();
if (!skipSubscribe) {
proxyObject.subscribe();
}
return proxyObject;
}
function proxySet(initialValues) {
const set = proxy({
data: Array.from(new Set(initialValues)),
has(value) {
return this.data.indexOf(value) !== -1;
},
add(value) {
let hasProxy = false;
if (typeof value === "object" && value !== null) {
hasProxy = this.data.indexOf(proxy(value)) !== -1;
}
if (this.data.indexOf(value) === -1 && !hasProxy) {
this.data.push(value);
}
return this;
},
delete(value) {
const index = this.data.indexOf(value);
if (index === -1) {
return false;
}
this.data.splice(index, 1);
return true;
},
clear() {
this.data.splice(0);
},
get size() {
return this.data.length;
},
forEach(cb) {
this.data.forEach((value) => {
cb(value, value, this);
});
},
get [Symbol.toStringTag]() {
return "Set";
},
toJSON() {
return {};
},
[Symbol.iterator]() {
return this.data[Symbol.iterator]();
},
values() {
return this.data.values();
},
keys() {
return this.data.values();
},
entries() {
return new Set(this.data).entries();
}
});
Object.defineProperties(set, {
data: {
enumerable: false
},
size: {
enumerable: false
},
toJSON: {
enumerable: false
}
});
Object.seal(set);
return set;
}
function proxyMap(entries) {
const map = proxy({
data: Array.from(entries || []),
has(key) {
return this.data.some((p) => p[0] === key);
},
set(key, value) {
const record = this.data.find((p) => p[0] === key);
if (record) {
record[1] = value;
} else {
this.data.push([key, value]);
}
return this;
},
get(key) {
var _a;
return (_a = this.data.find((p) => p[0] === key)) == null ? void 0 : _a[1];
},
delete(key) {
const index = this.data.findIndex((p) => p[0] === key);
if (index === -1) {
return false;
}
this.data.splice(index, 1);
return true;
},
clear() {
this.data.splice(0);
},
get size() {
return this.data.length;
},
toJSON() {
return {};
},
forEach(cb) {
this.data.forEach((p) => {
cb(p[1], p[0], this);
});
},
keys() {
return this.data.map((p) => p[0]).values();
},
values() {
return this.data.map((p) => p[1]).values();
},
entries() {
return new Map(this.data).entries();
},
get [Symbol.toStringTag]() {
return "Map";
},
[Symbol.iterator]() {
return this.entries();
}
});
Object.defineProperties(map, {
data: {
enumerable: false
},
size: {
enumerable: false
},
toJSON: {
enumerable: false
}
});
Object.seal(map);
return map;
}
})
};
}));

2
node_modules/valtio/system/utils.production.js generated vendored Normal file

File diff suppressed because one or more lines are too long

233
node_modules/valtio/system/vanilla.development.js generated vendored Normal file
View File

@@ -0,0 +1,233 @@
System.register(['proxy-compare'], (function (exports) {
'use strict';
var markToTrack, getUntracked;
return {
setters: [function (module) {
markToTrack = module.markToTrack;
getUntracked = module.getUntracked;
}],
execute: (function () {
exports({
getVersion: getVersion,
proxy: proxy,
ref: ref,
snapshot: snapshot,
subscribe: subscribe
});
const isObject = (x) => typeof x === "object" && x !== null;
const refSet = /* @__PURE__ */ new WeakSet();
const VERSION = Symbol("VERSION") ;
const LISTENERS = Symbol("LISTENERS") ;
const SNAPSHOT = Symbol("SNAPSHOT") ;
const buildProxyFunction = (objectIs = Object.is, newProxy = (target, handler) => new Proxy(target, handler), canProxy = (x) => isObject(x) && !refSet.has(x) && (Array.isArray(x) || !(Symbol.iterator in x)) && !(x instanceof WeakMap) && !(x instanceof WeakSet) && !(x instanceof Error) && !(x instanceof Number) && !(x instanceof Date) && !(x instanceof String) && !(x instanceof RegExp) && !(x instanceof ArrayBuffer), PROMISE_RESULT = Symbol("PROMISE_RESULT") , PROMISE_ERROR = Symbol("PROMISE_ERROR") , snapshotCache = /* @__PURE__ */ new WeakMap(), createSnapshot = (version, target, receiver) => {
const cache = snapshotCache.get(receiver);
if ((cache == null ? void 0 : cache[0]) === version) {
return cache[1];
}
const snapshot2 = Array.isArray(target) ? [] : Object.create(Object.getPrototypeOf(target));
markToTrack(snapshot2, true);
snapshotCache.set(receiver, [version, snapshot2]);
Reflect.ownKeys(target).forEach((key) => {
const value = Reflect.get(target, key, receiver);
if (refSet.has(value)) {
markToTrack(value, false);
snapshot2[key] = value;
} else if (value instanceof Promise) {
if (PROMISE_RESULT in value) {
snapshot2[key] = value[PROMISE_RESULT];
} else {
const errorOrPromise = value[PROMISE_ERROR] || value;
Object.defineProperty(snapshot2, key, {
get() {
if (PROMISE_RESULT in value) {
return value[PROMISE_RESULT];
}
throw errorOrPromise;
}
});
}
} else if (value == null ? void 0 : value[LISTENERS]) {
snapshot2[key] = value[SNAPSHOT];
} else {
snapshot2[key] = value;
}
});
return Object.freeze(snapshot2);
}, proxyCache = /* @__PURE__ */ new WeakMap(), versionHolder = [1], proxyFunction2 = (initialObject) => {
if (!isObject(initialObject)) {
throw new Error("object required");
}
const found = proxyCache.get(initialObject);
if (found) {
return found;
}
let version = versionHolder[0];
const listeners = /* @__PURE__ */ new Set();
const notifyUpdate = (op, nextVersion = ++versionHolder[0]) => {
if (version !== nextVersion) {
version = nextVersion;
listeners.forEach((listener) => listener(op, nextVersion));
}
};
const propListeners = /* @__PURE__ */ new Map();
const getPropListener = (prop) => {
let propListener = propListeners.get(prop);
if (!propListener) {
propListener = (op, nextVersion) => {
const newOp = [...op];
newOp[1] = [prop, ...newOp[1]];
notifyUpdate(newOp, nextVersion);
};
propListeners.set(prop, propListener);
}
return propListener;
};
const popPropListener = (prop) => {
const propListener = propListeners.get(prop);
propListeners.delete(prop);
return propListener;
};
const baseObject = Array.isArray(initialObject) ? [] : Object.create(Object.getPrototypeOf(initialObject));
const handler = {
get(target, prop, receiver) {
if (prop === VERSION) {
return version;
}
if (prop === LISTENERS) {
return listeners;
}
if (prop === SNAPSHOT) {
return createSnapshot(version, target, receiver);
}
return Reflect.get(target, prop, receiver);
},
deleteProperty(target, prop) {
const prevValue = Reflect.get(target, prop);
const childListeners = prevValue == null ? void 0 : prevValue[LISTENERS];
if (childListeners) {
childListeners.delete(popPropListener(prop));
}
const deleted = Reflect.deleteProperty(target, prop);
if (deleted) {
notifyUpdate(["delete", [prop], prevValue]);
}
return deleted;
},
set(target, prop, value, receiver) {
var _a;
const hasPrevValue = Reflect.has(target, prop);
const prevValue = Reflect.get(target, prop, receiver);
if (hasPrevValue && objectIs(prevValue, value)) {
return true;
}
const childListeners = prevValue == null ? void 0 : prevValue[LISTENERS];
if (childListeners) {
childListeners.delete(popPropListener(prop));
}
if (isObject(value)) {
value = getUntracked(value) || value;
}
let nextValue;
if ((_a = Object.getOwnPropertyDescriptor(target, prop)) == null ? void 0 : _a.set) {
nextValue = value;
} else if (value instanceof Promise) {
nextValue = value.then((v) => {
nextValue[PROMISE_RESULT] = v;
notifyUpdate(["resolve", [prop], v]);
return v;
}).catch((e) => {
nextValue[PROMISE_ERROR] = e;
notifyUpdate(["reject", [prop], e]);
});
} else if (value == null ? void 0 : value[LISTENERS]) {
nextValue = value;
nextValue[LISTENERS].add(getPropListener(prop));
} else if (canProxy(value)) {
nextValue = proxy(value);
nextValue[LISTENERS].add(getPropListener(prop));
} else {
nextValue = value;
}
Reflect.set(target, prop, nextValue, receiver);
notifyUpdate(["set", [prop], value, prevValue]);
return true;
}
};
const proxyObject = newProxy(baseObject, handler);
proxyCache.set(initialObject, proxyObject);
Reflect.ownKeys(initialObject).forEach((key) => {
const desc = Object.getOwnPropertyDescriptor(
initialObject,
key
);
if (desc.get || desc.set) {
Object.defineProperty(baseObject, key, desc);
} else {
proxyObject[key] = initialObject[key];
}
});
return proxyObject;
}) => [
proxyFunction2,
refSet,
VERSION,
LISTENERS,
SNAPSHOT,
objectIs,
newProxy,
canProxy,
PROMISE_RESULT,
PROMISE_ERROR,
snapshotCache,
createSnapshot,
proxyCache,
versionHolder
];
const [proxyFunction] = buildProxyFunction();
function proxy(initialObject = {}) {
return proxyFunction(initialObject);
}
function getVersion(proxyObject) {
return isObject(proxyObject) ? proxyObject[VERSION] : void 0;
}
function subscribe(proxyObject, callback, notifyInSync) {
if (!(proxyObject == null ? void 0 : proxyObject[LISTENERS])) {
console.warn("Please use proxy object");
}
let promise;
const ops = [];
const listener = (op) => {
ops.push(op);
if (notifyInSync) {
callback(ops.splice(0));
return;
}
if (!promise) {
promise = Promise.resolve().then(() => {
promise = void 0;
callback(ops.splice(0));
});
}
};
proxyObject[LISTENERS].add(listener);
return () => {
proxyObject[LISTENERS].delete(listener);
};
}
function snapshot(proxyObject) {
if (!(proxyObject == null ? void 0 : proxyObject[SNAPSHOT])) {
console.warn("Please use proxy object");
}
return proxyObject[SNAPSHOT];
}
function ref(obj) {
refSet.add(obj);
return obj;
}
const unstable_buildProxyFunction = exports('unstable_buildProxyFunction', buildProxyFunction);
})
};
}));

1
node_modules/valtio/system/vanilla.production.js generated vendored Normal file
View File

@@ -0,0 +1 @@
System.register(["proxy-compare"],function(D){"use strict";var A,M;return{setters:[function(d){A=d.markToTrack,M=d.getUntracked}],execute:function(){D({getVersion:_,proxy:V,ref:B,snapshot:z,subscribe:q});const d=o=>typeof o=="object"&&o!==null,k=new WeakSet,E=Symbol(),a=Symbol(),m=Symbol(),F=(o=Object.is,j=(t,f)=>new Proxy(t,f),P=t=>d(t)&&!k.has(t)&&(Array.isArray(t)||!(Symbol.iterator in t))&&!(t instanceof WeakMap)&&!(t instanceof WeakSet)&&!(t instanceof Error)&&!(t instanceof Number)&&!(t instanceof Date)&&!(t instanceof String)&&!(t instanceof RegExp)&&!(t instanceof ArrayBuffer),u=Symbol(),g=Symbol(),O=new WeakMap,R=(t,f,b)=>{const w=O.get(b);if((w==null?void 0:w[0])===t)return w[1];const s=Array.isArray(f)?[]:Object.create(Object.getPrototypeOf(f));return A(s,!0),O.set(b,[t,s]),Reflect.ownKeys(f).forEach(i=>{const c=Reflect.get(f,i,b);if(k.has(c))A(c,!1),s[i]=c;else if(c instanceof Promise)if(u in c)s[i]=c[u];else{const S=c[g]||c;Object.defineProperty(s,i,{get(){if(u in c)return c[u];throw S}})}else c!=null&&c[a]?s[i]=c[m]:s[i]=c}),Object.freeze(s)},T=new WeakMap,x=[1],I=t=>{if(!d(t))throw new Error("object required");const f=T.get(t);if(f)return f;let b=x[0];const w=new Set,s=(n,e=++x[0])=>{b!==e&&(b=e,w.forEach(r=>r(n,e)))},i=new Map,c=n=>{let e=i.get(n);return e||(e=(r,p)=>{const y=[...r];y[1]=[n,...y[1]],s(y,p)},i.set(n,e)),e},S=n=>{const e=i.get(n);return i.delete(n),e},K=Array.isArray(t)?[]:Object.create(Object.getPrototypeOf(t)),W=j(K,{get(n,e,r){return e===E?b:e===a?w:e===m?R(b,n,r):Reflect.get(n,e,r)},deleteProperty(n,e){const r=Reflect.get(n,e),p=r==null?void 0:r[a];p&&p.delete(S(e));const y=Reflect.deleteProperty(n,e);return y&&s(["delete",[e],r]),y},set(n,e,r,p){var y;const C=Reflect.has(n,e),v=Reflect.get(n,e,p);if(C&&o(v,r))return!0;const N=v==null?void 0:v[a];N&&N.delete(S(e)),d(r)&&(r=M(r)||r);let l;return(y=Object.getOwnPropertyDescriptor(n,e))!=null&&y.set?l=r:r instanceof Promise?l=r.then(h=>(l[u]=h,s(["resolve",[e],h]),h)).catch(h=>{l[g]=h,s(["reject",[e],h])}):r!=null&&r[a]?(l=r,l[a].add(c(e))):P(r)?(l=V(r),l[a].add(c(e))):l=r,Reflect.set(n,e,l,p),s(["set",[e],r,v]),!0}});return T.set(t,W),Reflect.ownKeys(t).forEach(n=>{const e=Object.getOwnPropertyDescriptor(t,n);e.get||e.set?Object.defineProperty(K,n,e):W[n]=t[n]}),W})=>[I,k,E,a,m,o,j,P,u,g,O,R,T,x],[U]=F();function V(o={}){return U(o)}function _(o){return d(o)?o[E]:void 0}function q(o,j,P){let u;const g=[],O=R=>{if(g.push(R),P){j(g.splice(0));return}u||(u=Promise.resolve().then(()=>{u=void 0,j(g.splice(0))}))};return o[a].add(O),()=>{o[a].delete(O)}}function z(o){return o[m]}function B(o){return k.add(o),o}const G=D("unstable_buildProxyFunction",F)}}});