cogsbox-state 0.5.346 → 0.5.347
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CogsState.jsx +424 -417
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +36 -29
package/dist/CogsState.jsx
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { transformStateFunc as
|
|
5
|
-
import { pushFunc as
|
|
6
|
-
import
|
|
7
|
-
import { v4 as
|
|
2
|
+
import { jsx as mt } from "react/jsx-runtime";
|
|
3
|
+
import { useState as X, useRef as Q, useEffect as et, useLayoutEffect as ct, useMemo as ht, createElement as ot, useSyncExternalStore as Vt, startTransition as Pt, useCallback as wt } from "react";
|
|
4
|
+
import { transformStateFunc as _t, isDeepEqual as z, isFunction as Y, getNestedValue as B, getDifferences as vt, debounce as Mt } from "./utility.js";
|
|
5
|
+
import { pushFunc as St, updateFn as rt, cutFunc as it, ValidationWrapper as jt, FormControlComponent as Ot } from "./Functions.jsx";
|
|
6
|
+
import Rt from "superjson";
|
|
7
|
+
import { v4 as yt } from "uuid";
|
|
8
8
|
import "zod";
|
|
9
|
-
import { getGlobalStore as r, formRefStore as
|
|
10
|
-
import { useCogsConfig as
|
|
11
|
-
import { applyPatch as
|
|
12
|
-
import
|
|
13
|
-
function
|
|
9
|
+
import { getGlobalStore as r, formRefStore as Tt } from "./store.js";
|
|
10
|
+
import { useCogsConfig as kt } from "./CogsStateClient.jsx";
|
|
11
|
+
import { applyPatch as Ut } from "fast-json-patch";
|
|
12
|
+
import Ft from "react-use-measure";
|
|
13
|
+
function At(t, i) {
|
|
14
14
|
const h = r.getState().getInitialOptions, f = r.getState().setInitialStateOptions, I = h(t) || {};
|
|
15
15
|
f(t, {
|
|
16
16
|
...I,
|
|
17
17
|
...i
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function Et({
|
|
21
21
|
stateKey: t,
|
|
22
22
|
options: i,
|
|
23
23
|
initialOptionsPart: h
|
|
24
24
|
}) {
|
|
25
|
-
const f =
|
|
25
|
+
const f = tt(t) || {}, I = h[t] || {}, k = r.getState().setInitialStateOptions, w = { ...I, ...f };
|
|
26
26
|
let p = !1;
|
|
27
27
|
if (i)
|
|
28
28
|
for (const a in i)
|
|
29
29
|
w.hasOwnProperty(a) ? (a == "localStorage" && i[a] && w[a].key !== i[a]?.key && (p = !0, w[a] = i[a]), a == "initialState" && i[a] && w[a] !== i[a] && // Different references
|
|
30
|
-
!
|
|
30
|
+
!z(w[a], i[a]) && (p = !0, w[a] = i[a])) : (p = !0, w[a] = i[a]);
|
|
31
31
|
p && k(t, w);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ie(t, { formElements: i, validation: h }) {
|
|
34
34
|
return { initialState: t, formElements: i, validation: h };
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const ce = (t, i) => {
|
|
37
37
|
let h = t;
|
|
38
|
-
const [f, I] =
|
|
38
|
+
const [f, I] = _t(h);
|
|
39
39
|
(Object.keys(I).length > 0 || i && Object.keys(i).length > 0) && Object.keys(I).forEach((p) => {
|
|
40
40
|
I[p] = I[p] || {}, I[p].formElements = {
|
|
41
41
|
...i?.formElements,
|
|
@@ -43,17 +43,17 @@ const oe = (t, i) => {
|
|
|
43
43
|
...i?.validation,
|
|
44
44
|
...I[p].formElements || {}
|
|
45
45
|
// State-specific overrides
|
|
46
|
-
},
|
|
46
|
+
}, tt(p) || r.getState().setInitialStateOptions(p, I[p]);
|
|
47
47
|
}), r.getState().setInitialStates(f), r.getState().setCreatedState(f);
|
|
48
48
|
const k = (p, a) => {
|
|
49
|
-
const [y] =
|
|
50
|
-
|
|
49
|
+
const [y] = X(a?.componentId ?? yt());
|
|
50
|
+
Et({
|
|
51
51
|
stateKey: p,
|
|
52
52
|
options: a,
|
|
53
53
|
initialOptionsPart: I
|
|
54
54
|
});
|
|
55
|
-
const n = r.getState().cogsStateStore[p] || f[p],
|
|
56
|
-
|
|
55
|
+
const n = r.getState().cogsStateStore[p] || f[p], m = a?.modifyState ? a.modifyState(n) : n, [L, R] = Bt(
|
|
56
|
+
m,
|
|
57
57
|
{
|
|
58
58
|
stateKey: p,
|
|
59
59
|
syncUpdate: a?.syncUpdate,
|
|
@@ -68,49 +68,49 @@ const oe = (t, i) => {
|
|
|
68
68
|
serverState: a?.serverState
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
|
-
return
|
|
71
|
+
return R;
|
|
72
72
|
};
|
|
73
73
|
function w(p, a) {
|
|
74
|
-
|
|
74
|
+
Et({ stateKey: p, options: a, initialOptionsPart: I }), a.localStorage && Ht(p, a), gt(p);
|
|
75
75
|
}
|
|
76
76
|
return { useCogsState: k, setCogsOptions: w };
|
|
77
77
|
}, {
|
|
78
|
-
setUpdaterState:
|
|
79
|
-
setState:
|
|
80
|
-
getInitialOptions:
|
|
81
|
-
getKeyState:
|
|
82
|
-
getValidationErrors:
|
|
83
|
-
setStateLog:
|
|
84
|
-
updateInitialStateGlobal:
|
|
85
|
-
addValidationError:
|
|
86
|
-
removeValidationError:
|
|
87
|
-
setServerSyncActions:
|
|
88
|
-
} = r.getState(),
|
|
78
|
+
setUpdaterState: lt,
|
|
79
|
+
setState: K,
|
|
80
|
+
getInitialOptions: tt,
|
|
81
|
+
getKeyState: Ct,
|
|
82
|
+
getValidationErrors: Dt,
|
|
83
|
+
setStateLog: Wt,
|
|
84
|
+
updateInitialStateGlobal: It,
|
|
85
|
+
addValidationError: Lt,
|
|
86
|
+
removeValidationError: J,
|
|
87
|
+
setServerSyncActions: Gt
|
|
88
|
+
} = r.getState(), $t = (t, i, h, f, I) => {
|
|
89
89
|
h?.log && console.log(
|
|
90
90
|
"saving to localstorage",
|
|
91
91
|
i,
|
|
92
92
|
h.localStorage?.key,
|
|
93
93
|
f
|
|
94
94
|
);
|
|
95
|
-
const k =
|
|
95
|
+
const k = Y(h?.localStorage?.key) ? h.localStorage?.key(t) : h?.localStorage?.key;
|
|
96
96
|
if (k && f) {
|
|
97
97
|
const w = `${f}-${i}-${k}`;
|
|
98
98
|
let p;
|
|
99
99
|
try {
|
|
100
|
-
p =
|
|
100
|
+
p = ut(w)?.lastSyncedWithServer;
|
|
101
101
|
} catch {
|
|
102
102
|
}
|
|
103
103
|
const a = {
|
|
104
104
|
state: t,
|
|
105
105
|
lastUpdated: Date.now(),
|
|
106
106
|
lastSyncedWithServer: I ?? p
|
|
107
|
-
}, y =
|
|
107
|
+
}, y = Rt.serialize(a);
|
|
108
108
|
window.localStorage.setItem(
|
|
109
109
|
w,
|
|
110
110
|
JSON.stringify(y.json)
|
|
111
111
|
);
|
|
112
112
|
}
|
|
113
|
-
},
|
|
113
|
+
}, ut = (t) => {
|
|
114
114
|
if (!t) return null;
|
|
115
115
|
try {
|
|
116
116
|
const i = window.localStorage.getItem(t);
|
|
@@ -118,20 +118,20 @@ const oe = (t, i) => {
|
|
|
118
118
|
} catch (i) {
|
|
119
119
|
return console.error("Error loading from localStorage:", i), null;
|
|
120
120
|
}
|
|
121
|
-
},
|
|
122
|
-
const h = r.getState().cogsStateStore[t], { sessionId: f } =
|
|
121
|
+
}, Ht = (t, i) => {
|
|
122
|
+
const h = r.getState().cogsStateStore[t], { sessionId: f } = kt(), I = Y(i?.localStorage?.key) ? i.localStorage.key(h) : i?.localStorage?.key;
|
|
123
123
|
if (I && f) {
|
|
124
|
-
const k =
|
|
124
|
+
const k = ut(
|
|
125
125
|
`${f}-${t}-${I}`
|
|
126
126
|
);
|
|
127
127
|
if (k && k.lastUpdated > (k.lastSyncedWithServer || 0))
|
|
128
|
-
return
|
|
128
|
+
return K(t, k.state), gt(t), !0;
|
|
129
129
|
}
|
|
130
130
|
return !1;
|
|
131
|
-
},
|
|
131
|
+
}, xt = (t, i, h, f, I, k) => {
|
|
132
132
|
const w = {
|
|
133
133
|
initialState: i,
|
|
134
|
-
updaterState:
|
|
134
|
+
updaterState: dt(
|
|
135
135
|
t,
|
|
136
136
|
f,
|
|
137
137
|
I,
|
|
@@ -139,8 +139,8 @@ const oe = (t, i) => {
|
|
|
139
139
|
),
|
|
140
140
|
state: h
|
|
141
141
|
};
|
|
142
|
-
|
|
143
|
-
},
|
|
142
|
+
It(t, w.initialState), lt(t, w.updaterState), K(t, w.state);
|
|
143
|
+
}, gt = (t) => {
|
|
144
144
|
const i = r.getState().stateComponents.get(t);
|
|
145
145
|
if (!i) return;
|
|
146
146
|
const h = /* @__PURE__ */ new Set();
|
|
@@ -149,7 +149,7 @@ const oe = (t, i) => {
|
|
|
149
149
|
}), queueMicrotask(() => {
|
|
150
150
|
h.forEach((f) => f());
|
|
151
151
|
});
|
|
152
|
-
},
|
|
152
|
+
}, le = (t, i) => {
|
|
153
153
|
const h = r.getState().stateComponents.get(t);
|
|
154
154
|
if (h) {
|
|
155
155
|
const f = `${t}////${i}`, I = h.components.get(f);
|
|
@@ -157,7 +157,7 @@ const oe = (t, i) => {
|
|
|
157
157
|
return;
|
|
158
158
|
I && I.forceUpdate();
|
|
159
159
|
}
|
|
160
|
-
},
|
|
160
|
+
}, zt = (t, i, h, f) => {
|
|
161
161
|
switch (t) {
|
|
162
162
|
case "update":
|
|
163
163
|
return {
|
|
@@ -180,7 +180,7 @@ const oe = (t, i) => {
|
|
|
180
180
|
return { oldValue: null, newValue: null };
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
function
|
|
183
|
+
function Bt(t, {
|
|
184
184
|
stateKey: i,
|
|
185
185
|
serverSync: h,
|
|
186
186
|
localStorage: f,
|
|
@@ -191,16 +191,16 @@ function Gt(t, {
|
|
|
191
191
|
initialState: a,
|
|
192
192
|
syncUpdate: y,
|
|
193
193
|
dependencies: n,
|
|
194
|
-
serverState:
|
|
194
|
+
serverState: m
|
|
195
195
|
} = {}) {
|
|
196
|
-
const [
|
|
196
|
+
const [L, R] = X({}), { sessionId: U } = kt();
|
|
197
197
|
let G = !i;
|
|
198
|
-
const [v] =
|
|
198
|
+
const [v] = X(i ?? yt()), l = r.getState().stateLog[v], at = Q(/* @__PURE__ */ new Set()), Z = Q(p ?? yt()), j = Q(
|
|
199
199
|
null
|
|
200
200
|
);
|
|
201
|
-
|
|
201
|
+
j.current = tt(v) ?? null, et(() => {
|
|
202
202
|
if (y && y.stateKey === v && y.path?.[0]) {
|
|
203
|
-
|
|
203
|
+
K(v, (o) => ({
|
|
204
204
|
...o,
|
|
205
205
|
[y.path[0]]: y.newValue
|
|
206
206
|
}));
|
|
@@ -210,263 +210,263 @@ function Gt(t, {
|
|
|
210
210
|
userId: y.userId
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
}, [y]),
|
|
213
|
+
}, [y]), et(() => {
|
|
214
214
|
if (a) {
|
|
215
|
-
|
|
215
|
+
At(v, {
|
|
216
216
|
initialState: a
|
|
217
217
|
});
|
|
218
|
-
const e =
|
|
219
|
-
if (!(c && !
|
|
218
|
+
const e = j.current, s = e?.serverState?.id !== void 0 && e?.serverState?.status === "success" && e?.serverState?.data, c = r.getState().initialStateGlobal[v];
|
|
219
|
+
if (!(c && !z(c, a) || !c) && !s)
|
|
220
220
|
return;
|
|
221
221
|
let u = null;
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
let
|
|
225
|
-
const
|
|
226
|
-
s &&
|
|
222
|
+
const A = Y(e?.localStorage?.key) ? e?.localStorage?.key(a) : e?.localStorage?.key;
|
|
223
|
+
A && U && (u = ut(`${U}-${v}-${A}`));
|
|
224
|
+
let T = a, E = !1;
|
|
225
|
+
const _ = s ? Date.now() : 0, N = u?.lastUpdated || 0, $ = u?.lastSyncedWithServer || 0;
|
|
226
|
+
s && _ > N ? (T = e.serverState.data, E = !0) : u && N > $ && (T = u.state, e?.localStorage?.onChange && e?.localStorage?.onChange(T)), r.getState().initializeShadowState(v, a), xt(
|
|
227
227
|
v,
|
|
228
228
|
a,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
), E &&
|
|
229
|
+
T,
|
|
230
|
+
nt,
|
|
231
|
+
Z.current,
|
|
232
|
+
U
|
|
233
|
+
), E && A && U && $t(T, v, e, U, Date.now()), gt(v), (Array.isArray(w) ? w : [w || "component"]).includes("none") || R({});
|
|
234
234
|
}
|
|
235
235
|
}, [
|
|
236
236
|
a,
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
m?.status,
|
|
238
|
+
m?.data,
|
|
239
239
|
...n || []
|
|
240
|
-
]),
|
|
241
|
-
G &&
|
|
240
|
+
]), ct(() => {
|
|
241
|
+
G && At(v, {
|
|
242
242
|
serverSync: h,
|
|
243
243
|
formElements: I,
|
|
244
244
|
initialState: a,
|
|
245
245
|
localStorage: f,
|
|
246
|
-
middleware:
|
|
246
|
+
middleware: j.current?.middleware
|
|
247
247
|
});
|
|
248
|
-
const e = `${v}////${
|
|
248
|
+
const e = `${v}////${Z.current}`, o = r.getState().stateComponents.get(v) || {
|
|
249
249
|
components: /* @__PURE__ */ new Map()
|
|
250
250
|
};
|
|
251
251
|
return o.components.set(e, {
|
|
252
|
-
forceUpdate: () =>
|
|
252
|
+
forceUpdate: () => R({}),
|
|
253
253
|
paths: /* @__PURE__ */ new Set(),
|
|
254
254
|
deps: [],
|
|
255
255
|
depsFunction: k || void 0,
|
|
256
256
|
reactiveType: w ?? ["component", "deps"]
|
|
257
|
-
}), r.getState().stateComponents.set(v, o),
|
|
257
|
+
}), r.getState().stateComponents.set(v, o), R({}), () => {
|
|
258
258
|
o && (o.components.delete(e), o.components.size === 0 && r.getState().stateComponents.delete(v));
|
|
259
259
|
};
|
|
260
260
|
}, []);
|
|
261
|
-
const
|
|
261
|
+
const nt = (e, o, s, c) => {
|
|
262
262
|
if (Array.isArray(o)) {
|
|
263
263
|
const u = `${v}-${o.join(".")}`;
|
|
264
264
|
at.current.add(u);
|
|
265
265
|
}
|
|
266
266
|
const g = r.getState();
|
|
267
|
-
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
270
|
-
let
|
|
271
|
-
if ((!
|
|
272
|
-
const
|
|
273
|
-
if (Array.isArray(
|
|
274
|
-
|
|
275
|
-
const
|
|
276
|
-
|
|
267
|
+
K(v, (u) => {
|
|
268
|
+
const A = Y(e) ? e(u) : e, T = `${v}-${o.join(".")}`;
|
|
269
|
+
if (T) {
|
|
270
|
+
let M = !1, x = g.signalDomElements.get(T);
|
|
271
|
+
if ((!x || x.size === 0) && (s.updateType === "insert" || s.updateType === "cut")) {
|
|
272
|
+
const O = o.slice(0, -1), D = B(A, O);
|
|
273
|
+
if (Array.isArray(D)) {
|
|
274
|
+
M = !0;
|
|
275
|
+
const S = `${v}-${O.join(".")}`;
|
|
276
|
+
x = g.signalDomElements.get(S);
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
if (
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const
|
|
283
|
-
`[data-parent-id="${
|
|
279
|
+
if (x) {
|
|
280
|
+
const O = M ? B(A, o.slice(0, -1)) : B(A, o);
|
|
281
|
+
x.forEach(({ parentId: D, position: S, effect: b }) => {
|
|
282
|
+
const C = document.querySelector(
|
|
283
|
+
`[data-parent-id="${D}"]`
|
|
284
284
|
);
|
|
285
|
-
if (
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
288
|
-
const
|
|
289
|
-
|
|
285
|
+
if (C) {
|
|
286
|
+
const V = Array.from(C.childNodes);
|
|
287
|
+
if (V[S]) {
|
|
288
|
+
const P = b ? new Function("state", `return (${b})(state)`)(O) : O;
|
|
289
|
+
V[S].textContent = String(P);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
console.log("shadowState", g.shadowStateStore), s.updateType === "update" && (c ||
|
|
296
|
-
(c ||
|
|
295
|
+
console.log("shadowState", g.shadowStateStore), s.updateType === "update" && (c || j.current?.validation?.key) && o && J(
|
|
296
|
+
(c || j.current?.validation?.key) + "." + o.join(".")
|
|
297
297
|
);
|
|
298
298
|
const E = o.slice(0, o.length - 1);
|
|
299
|
-
s.updateType === "cut" &&
|
|
300
|
-
|
|
301
|
-
), s.updateType === "insert" &&
|
|
302
|
-
|
|
303
|
-
).filter(([
|
|
304
|
-
let
|
|
305
|
-
if (
|
|
306
|
-
let
|
|
307
|
-
|
|
299
|
+
s.updateType === "cut" && j.current?.validation?.key && J(
|
|
300
|
+
j.current?.validation?.key + "." + E.join(".")
|
|
301
|
+
), s.updateType === "insert" && j.current?.validation?.key && Dt(
|
|
302
|
+
j.current?.validation?.key + "." + E.join(".")
|
|
303
|
+
).filter(([x, O]) => {
|
|
304
|
+
let D = x?.split(".").length;
|
|
305
|
+
if (x == E.join(".") && D == E.length - 1) {
|
|
306
|
+
let S = x + "." + E;
|
|
307
|
+
J(x), Lt(S, O);
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
|
-
const
|
|
311
|
-
if (console.log("stateEntry >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",
|
|
312
|
-
const
|
|
310
|
+
const _ = g.stateComponents.get(v);
|
|
311
|
+
if (console.log("stateEntry >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", _), _) {
|
|
312
|
+
const M = vt(u, A), x = new Set(M), O = s.updateType === "update" ? o.join(".") : o.slice(0, -1).join(".") || "";
|
|
313
313
|
for (const [
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
] of
|
|
317
|
-
let
|
|
318
|
-
const
|
|
319
|
-
if (console.log("component",
|
|
320
|
-
if (
|
|
321
|
-
|
|
314
|
+
D,
|
|
315
|
+
S
|
|
316
|
+
] of _.components.entries()) {
|
|
317
|
+
let b = !1;
|
|
318
|
+
const C = Array.isArray(S.reactiveType) ? S.reactiveType : [S.reactiveType || "component"];
|
|
319
|
+
if (console.log("component", S), !C.includes("none")) {
|
|
320
|
+
if (C.includes("all")) {
|
|
321
|
+
S.forceUpdate();
|
|
322
322
|
continue;
|
|
323
323
|
}
|
|
324
|
-
if (
|
|
325
|
-
for (const
|
|
326
|
-
let
|
|
324
|
+
if (C.includes("component") && ((S.paths.has(O) || S.paths.has("")) && (b = !0), !b))
|
|
325
|
+
for (const V of x) {
|
|
326
|
+
let P = V;
|
|
327
327
|
for (; ; ) {
|
|
328
|
-
if (
|
|
329
|
-
|
|
328
|
+
if (S.paths.has(P)) {
|
|
329
|
+
b = !0;
|
|
330
330
|
break;
|
|
331
331
|
}
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
334
|
-
const
|
|
332
|
+
const H = P.lastIndexOf(".");
|
|
333
|
+
if (H !== -1) {
|
|
334
|
+
const q = P.substring(
|
|
335
335
|
0,
|
|
336
|
-
|
|
336
|
+
H
|
|
337
337
|
);
|
|
338
338
|
if (!isNaN(
|
|
339
|
-
Number(
|
|
340
|
-
) &&
|
|
341
|
-
|
|
339
|
+
Number(P.substring(H + 1))
|
|
340
|
+
) && S.paths.has(q)) {
|
|
341
|
+
b = !0;
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
|
-
|
|
344
|
+
P = q;
|
|
345
345
|
} else
|
|
346
|
-
|
|
347
|
-
if (
|
|
346
|
+
P = "";
|
|
347
|
+
if (P === "")
|
|
348
348
|
break;
|
|
349
349
|
}
|
|
350
|
-
if (
|
|
350
|
+
if (b) break;
|
|
351
351
|
}
|
|
352
|
-
if (
|
|
353
|
-
const
|
|
354
|
-
let
|
|
355
|
-
typeof
|
|
352
|
+
if (!b && C.includes("deps") && S.depsFunction) {
|
|
353
|
+
const V = S.depsFunction(A);
|
|
354
|
+
let P = !1;
|
|
355
|
+
typeof V == "boolean" ? V && (P = !0) : z(S.deps, V) || (S.deps = V, P = !0), P && (b = !0);
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
b && S.forceUpdate();
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
const
|
|
362
|
-
o = o.map((
|
|
363
|
-
const
|
|
364
|
-
return
|
|
361
|
+
const N = Date.now();
|
|
362
|
+
o = o.map((M, x) => {
|
|
363
|
+
const O = o.slice(0, -1), D = B(A, O);
|
|
364
|
+
return x === o.length - 1 && ["insert", "cut"].includes(s.updateType) ? (D.length - 1).toString() : M;
|
|
365
365
|
});
|
|
366
|
-
const { oldValue:
|
|
366
|
+
const { oldValue: $, newValue: W } = zt(
|
|
367
367
|
s.updateType,
|
|
368
368
|
u,
|
|
369
|
-
|
|
369
|
+
A,
|
|
370
370
|
o
|
|
371
|
-
),
|
|
372
|
-
timeStamp:
|
|
371
|
+
), F = {
|
|
372
|
+
timeStamp: N,
|
|
373
373
|
stateKey: v,
|
|
374
374
|
path: o,
|
|
375
375
|
updateType: s.updateType,
|
|
376
376
|
status: "new",
|
|
377
|
-
oldValue:
|
|
378
|
-
newValue:
|
|
377
|
+
oldValue: $,
|
|
378
|
+
newValue: W
|
|
379
379
|
};
|
|
380
380
|
switch (s.updateType) {
|
|
381
381
|
case "update":
|
|
382
|
-
g.updateShadowAtPath(v, o,
|
|
382
|
+
g.updateShadowAtPath(v, o, A);
|
|
383
383
|
break;
|
|
384
384
|
case "insert":
|
|
385
|
-
const
|
|
386
|
-
g.insertShadowArrayElement(v,
|
|
385
|
+
const M = o.slice(0, -1);
|
|
386
|
+
g.insertShadowArrayElement(v, M, W);
|
|
387
387
|
break;
|
|
388
388
|
case "cut":
|
|
389
|
-
const
|
|
390
|
-
g.removeShadowArrayElement(v,
|
|
389
|
+
const x = o.slice(0, -1), O = parseInt(o[o.length - 1]);
|
|
390
|
+
g.removeShadowArrayElement(v, x, O);
|
|
391
391
|
break;
|
|
392
392
|
}
|
|
393
|
-
if (
|
|
394
|
-
const
|
|
395
|
-
const
|
|
396
|
-
return
|
|
393
|
+
if (Wt(v, (M) => {
|
|
394
|
+
const O = [...M ?? [], F].reduce((D, S) => {
|
|
395
|
+
const b = `${S.stateKey}:${JSON.stringify(S.path)}`, C = D.get(b);
|
|
396
|
+
return C ? (C.timeStamp = Math.max(C.timeStamp, S.timeStamp), C.newValue = S.newValue, C.oldValue = C.oldValue ?? S.oldValue, C.updateType = S.updateType) : D.set(b, { ...S }), D;
|
|
397
397
|
}, /* @__PURE__ */ new Map());
|
|
398
|
-
return Array.from(
|
|
399
|
-
}),
|
|
400
|
-
|
|
398
|
+
return Array.from(O.values());
|
|
399
|
+
}), $t(
|
|
400
|
+
A,
|
|
401
401
|
v,
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
),
|
|
402
|
+
j.current,
|
|
403
|
+
U
|
|
404
|
+
), j.current?.middleware && j.current.middleware({
|
|
405
405
|
updateLog: l,
|
|
406
|
-
update:
|
|
407
|
-
}),
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
syncKey: typeof
|
|
411
|
-
rollBackState:
|
|
412
|
-
actionTimeStamp: Date.now() + (
|
|
406
|
+
update: F
|
|
407
|
+
}), j.current?.serverSync) {
|
|
408
|
+
const M = g.serverState[v], x = j.current?.serverSync;
|
|
409
|
+
Gt(v, {
|
|
410
|
+
syncKey: typeof x.syncKey == "string" ? x.syncKey : x.syncKey({ state: A }),
|
|
411
|
+
rollBackState: M,
|
|
412
|
+
actionTimeStamp: Date.now() + (x.debounce ?? 3e3),
|
|
413
413
|
status: "waiting"
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
|
-
return
|
|
416
|
+
return A;
|
|
417
417
|
});
|
|
418
418
|
};
|
|
419
|
-
r.getState().updaterState[v] || (
|
|
419
|
+
r.getState().updaterState[v] || (lt(
|
|
420
420
|
v,
|
|
421
|
-
|
|
421
|
+
dt(
|
|
422
422
|
v,
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
423
|
+
nt,
|
|
424
|
+
Z.current,
|
|
425
|
+
U
|
|
426
426
|
)
|
|
427
|
-
), r.getState().cogsStateStore[v] ||
|
|
428
|
-
const d =
|
|
427
|
+
), r.getState().cogsStateStore[v] || K(v, t), r.getState().initialStateGlobal[v] || It(v, t));
|
|
428
|
+
const d = ht(() => dt(
|
|
429
429
|
v,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
), [v,
|
|
434
|
-
return [
|
|
430
|
+
nt,
|
|
431
|
+
Z.current,
|
|
432
|
+
U
|
|
433
|
+
), [v, U]);
|
|
434
|
+
return [Ct(v), d];
|
|
435
435
|
}
|
|
436
|
-
function
|
|
436
|
+
function dt(t, i, h, f) {
|
|
437
437
|
const I = /* @__PURE__ */ new Map();
|
|
438
438
|
let k = 0;
|
|
439
439
|
const w = (y) => {
|
|
440
440
|
const n = y.join(".");
|
|
441
|
-
for (const [
|
|
442
|
-
(
|
|
441
|
+
for (const [m] of I)
|
|
442
|
+
(m === n || m.startsWith(n + ".")) && I.delete(m);
|
|
443
443
|
k++;
|
|
444
444
|
}, p = {
|
|
445
445
|
removeValidation: (y) => {
|
|
446
|
-
y?.validationKey &&
|
|
446
|
+
y?.validationKey && J(y.validationKey);
|
|
447
447
|
},
|
|
448
448
|
revertToInitialState: (y) => {
|
|
449
449
|
const n = r.getState().getInitialOptions(t)?.validation;
|
|
450
|
-
n?.key &&
|
|
451
|
-
const
|
|
450
|
+
n?.key && J(n?.key), y?.validationKey && J(y.validationKey);
|
|
451
|
+
const m = r.getState().initialStateGlobal[t];
|
|
452
452
|
r.getState().clearSelectedIndexesForState(t), I.clear(), k++;
|
|
453
|
-
const
|
|
454
|
-
G && localStorage.removeItem(G),
|
|
453
|
+
const L = a(m, []), R = tt(t), U = Y(R?.localStorage?.key) ? R?.localStorage?.key(m) : R?.localStorage?.key, G = `${f}-${t}-${U}`;
|
|
454
|
+
G && localStorage.removeItem(G), lt(t, L), K(t, m);
|
|
455
455
|
const v = r.getState().stateComponents.get(t);
|
|
456
456
|
return v && v.components.forEach((l) => {
|
|
457
457
|
l.forceUpdate();
|
|
458
|
-
}),
|
|
458
|
+
}), m;
|
|
459
459
|
},
|
|
460
460
|
updateInitialState: (y) => {
|
|
461
461
|
I.clear(), k++;
|
|
462
|
-
const n =
|
|
462
|
+
const n = dt(
|
|
463
463
|
t,
|
|
464
464
|
i,
|
|
465
465
|
h,
|
|
466
466
|
f
|
|
467
|
-
),
|
|
468
|
-
return localStorage.getItem(
|
|
469
|
-
|
|
467
|
+
), m = r.getState().initialStateGlobal[t], L = tt(t), R = Y(L?.localStorage?.key) ? L?.localStorage?.key(m) : L?.localStorage?.key, U = `${f}-${t}-${R}`;
|
|
468
|
+
return localStorage.getItem(U) && localStorage.removeItem(U), Pt(() => {
|
|
469
|
+
It(t, y), r.getState().initializeShadowState(t, y), lt(t, n), K(t, y);
|
|
470
470
|
const G = r.getState().stateComponents.get(t);
|
|
471
471
|
G && G.components.forEach((v) => {
|
|
472
472
|
v.forceUpdate();
|
|
@@ -480,26 +480,26 @@ function lt(t, i, h, f) {
|
|
|
480
480
|
_isLoading: r.getState().isLoadingGlobal[t],
|
|
481
481
|
_isServerSynced: () => {
|
|
482
482
|
const y = r.getState().serverState[t];
|
|
483
|
-
return !!(y &&
|
|
483
|
+
return !!(y && z(y, Ct(t)));
|
|
484
484
|
}
|
|
485
485
|
};
|
|
486
|
-
function a(y, n = [],
|
|
487
|
-
const
|
|
488
|
-
I.get(
|
|
489
|
-
const
|
|
486
|
+
function a(y, n = [], m) {
|
|
487
|
+
const L = n.map(String).join(".");
|
|
488
|
+
I.get(L);
|
|
489
|
+
const R = function() {
|
|
490
490
|
return r().getNestedState(t, n);
|
|
491
491
|
};
|
|
492
492
|
Object.keys(p).forEach((v) => {
|
|
493
|
-
|
|
493
|
+
R[v] = p[v];
|
|
494
494
|
});
|
|
495
|
-
const
|
|
495
|
+
const U = {
|
|
496
496
|
apply(v, l, at) {
|
|
497
497
|
return console.log(
|
|
498
498
|
`PROXY APPLY TRAP HIT: stateKey=${t}, path=${n.join(".")}`
|
|
499
499
|
), console.trace("Apply trap stack trace"), r().getNestedState(t, n);
|
|
500
500
|
},
|
|
501
501
|
get(v, l) {
|
|
502
|
-
|
|
502
|
+
m?.validIndices && !Array.isArray(y) && (m = { ...m, validIndices: void 0 });
|
|
503
503
|
const at = /* @__PURE__ */ new Set([
|
|
504
504
|
"insert",
|
|
505
505
|
"cut",
|
|
@@ -540,7 +540,7 @@ function lt(t, i, h, f) {
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
if (l === "getDifferences")
|
|
543
|
-
return () =>
|
|
543
|
+
return () => vt(
|
|
544
544
|
r.getState().cogsStateStore[t],
|
|
545
545
|
r.getState().initialStateGlobal[t]
|
|
546
546
|
);
|
|
@@ -554,8 +554,8 @@ function lt(t, i, h, f) {
|
|
|
554
554
|
const c = await e.action(o);
|
|
555
555
|
if (c && !c.success && c.errors && s) {
|
|
556
556
|
r.getState().removeValidationError(s), c.errors.forEach((u) => {
|
|
557
|
-
const
|
|
558
|
-
r.getState().addValidationError(
|
|
557
|
+
const A = [s, ...u.path].join(".");
|
|
558
|
+
r.getState().addValidationError(A, u.message);
|
|
559
559
|
});
|
|
560
560
|
const g = r.getState().stateComponents.get(t);
|
|
561
561
|
g && g.components.forEach((u) => {
|
|
@@ -569,7 +569,7 @@ function lt(t, i, h, f) {
|
|
|
569
569
|
};
|
|
570
570
|
if (l === "_status") {
|
|
571
571
|
const d = r.getState().getNestedState(t, n), e = r.getState().initialStateGlobal[t], o = B(e, n);
|
|
572
|
-
return
|
|
572
|
+
return z(d, o) ? "fresh" : "stale";
|
|
573
573
|
}
|
|
574
574
|
if (l === "getStatus")
|
|
575
575
|
return function() {
|
|
@@ -577,11 +577,11 @@ function lt(t, i, h, f) {
|
|
|
577
577
|
t,
|
|
578
578
|
n
|
|
579
579
|
), e = r.getState().initialStateGlobal[t], o = B(e, n);
|
|
580
|
-
return
|
|
580
|
+
return z(d, o) ? "fresh" : "stale";
|
|
581
581
|
};
|
|
582
582
|
if (l === "removeStorage")
|
|
583
583
|
return () => {
|
|
584
|
-
const d = r.getState().initialStateGlobal[t], e =
|
|
584
|
+
const d = r.getState().initialStateGlobal[t], e = tt(t), o = Y(e?.localStorage?.key) ? e?.localStorage?.key(d) : e?.localStorage?.key, s = `${f}-${t}-${o}`;
|
|
585
585
|
s && localStorage.removeItem(s);
|
|
586
586
|
};
|
|
587
587
|
if (l === "showValidationErrors")
|
|
@@ -592,9 +592,9 @@ function lt(t, i, h, f) {
|
|
|
592
592
|
return r.getState().getValidationErrors(d.key + "." + n.join("."));
|
|
593
593
|
};
|
|
594
594
|
if (Array.isArray(y)) {
|
|
595
|
-
const d = () =>
|
|
595
|
+
const d = () => m?.validIndices ? y.map((o, s) => ({
|
|
596
596
|
item: o,
|
|
597
|
-
originalIndex:
|
|
597
|
+
originalIndex: m.validIndices[s]
|
|
598
598
|
})) : r.getState().getNestedState(t, n).map((o, s) => ({
|
|
599
599
|
item: o,
|
|
600
600
|
originalIndex: s
|
|
@@ -606,7 +606,7 @@ function lt(t, i, h, f) {
|
|
|
606
606
|
return a(
|
|
607
607
|
y[e],
|
|
608
608
|
[...n, e.toString()],
|
|
609
|
-
|
|
609
|
+
m
|
|
610
610
|
);
|
|
611
611
|
};
|
|
612
612
|
if (l === "clearSelected")
|
|
@@ -621,125 +621,132 @@ function lt(t, i, h, f) {
|
|
|
621
621
|
itemHeight: o = 50,
|
|
622
622
|
overscan: s = 6,
|
|
623
623
|
stickToBottom: c = !1
|
|
624
|
-
} = e, g =
|
|
624
|
+
} = e, g = Q(null), [u, A] = X({
|
|
625
625
|
startIndex: 0,
|
|
626
626
|
endIndex: 10
|
|
627
|
-
}),
|
|
628
|
-
|
|
629
|
-
|
|
627
|
+
}), T = Q(c), [E, _] = X(0);
|
|
628
|
+
et(() => r.getState().subscribeToShadowState(t, () => {
|
|
629
|
+
_((b) => b + 1);
|
|
630
630
|
}), [t]);
|
|
631
|
-
const
|
|
631
|
+
const N = r().getNestedState(
|
|
632
632
|
t,
|
|
633
633
|
n
|
|
634
|
-
),
|
|
635
|
-
const
|
|
636
|
-
let
|
|
637
|
-
const
|
|
638
|
-
for (let
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
634
|
+
), $ = N.length, { totalHeight: W, positions: F } = ht(() => {
|
|
635
|
+
const S = r.getState().getShadowMetadata(t, n) || [];
|
|
636
|
+
let b = 0;
|
|
637
|
+
const C = [];
|
|
638
|
+
for (let V = 0; V < $; V++) {
|
|
639
|
+
C[V] = b;
|
|
640
|
+
const P = S[V]?.virtualizer?.itemHeight;
|
|
641
|
+
b += P || o;
|
|
642
642
|
}
|
|
643
|
-
return { totalHeight:
|
|
643
|
+
return { totalHeight: b, positions: C };
|
|
644
644
|
}, [
|
|
645
|
-
|
|
645
|
+
$,
|
|
646
646
|
t,
|
|
647
647
|
n.join("."),
|
|
648
648
|
o,
|
|
649
649
|
E
|
|
650
|
-
]),
|
|
651
|
-
const
|
|
652
|
-
{ length:
|
|
653
|
-
(
|
|
654
|
-
),
|
|
655
|
-
return a(
|
|
656
|
-
...
|
|
657
|
-
validIndices:
|
|
650
|
+
]), M = ht(() => {
|
|
651
|
+
const S = Math.max(0, u.startIndex), b = Math.min($, u.endIndex), C = Array.from(
|
|
652
|
+
{ length: b - S },
|
|
653
|
+
(P, H) => S + H
|
|
654
|
+
), V = C.map((P) => N[P]);
|
|
655
|
+
return a(V, n, {
|
|
656
|
+
...m,
|
|
657
|
+
validIndices: C
|
|
658
658
|
});
|
|
659
|
-
}, [u.startIndex, u.endIndex,
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
if (!
|
|
659
|
+
}, [u.startIndex, u.endIndex, N, $]);
|
|
660
|
+
ct(() => {
|
|
661
|
+
const S = g.current;
|
|
662
|
+
if (!S || !T.current || $ === 0)
|
|
663
663
|
return;
|
|
664
|
-
|
|
665
|
-
startIndex: Math.max(0,
|
|
666
|
-
endIndex:
|
|
667
|
-
})
|
|
668
|
-
|
|
669
|
-
)
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
nt > 0 ? (console.log(
|
|
675
|
-
`%cSUCCESS: Last item height is ${nt}. Scrolling now.`,
|
|
676
|
-
"color: green; font-weight: bold;"
|
|
677
|
-
), clearInterval(x), m.scrollTo({
|
|
678
|
-
top: m.scrollHeight,
|
|
664
|
+
A({
|
|
665
|
+
startIndex: Math.max(0, $ - 10 - s),
|
|
666
|
+
endIndex: $
|
|
667
|
+
});
|
|
668
|
+
let C = 0;
|
|
669
|
+
const V = setInterval(() => {
|
|
670
|
+
C++;
|
|
671
|
+
const P = $ - 1;
|
|
672
|
+
((r.getState().getShadowMetadata(t, n) || [])[P]?.virtualizer?.itemHeight || 0) > 0 ? (clearInterval(V), S.scrollTo({
|
|
673
|
+
top: S.scrollHeight,
|
|
679
674
|
behavior: "smooth"
|
|
680
|
-
})) :
|
|
681
|
-
"LOOP TIMEOUT: Last item was never measured. Stopping loop."
|
|
682
|
-
), clearInterval(x)));
|
|
675
|
+
})) : C > 20 && clearInterval(V);
|
|
683
676
|
}, 100);
|
|
684
|
-
return () =>
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
677
|
+
return () => clearInterval(V);
|
|
678
|
+
}, [$]), et(() => {
|
|
679
|
+
const S = g.current;
|
|
680
|
+
if (!S) return;
|
|
681
|
+
const b = () => {
|
|
682
|
+
const { scrollTop: V, clientHeight: P } = S;
|
|
683
|
+
let H = 0, q = $ - 1;
|
|
684
|
+
for (; H <= q; ) {
|
|
685
|
+
const ft = Math.floor((H + q) / 2);
|
|
686
|
+
F[ft] < V ? H = ft + 1 : q = ft - 1;
|
|
687
|
+
}
|
|
688
|
+
const pt = Math.max(0, q - s);
|
|
689
|
+
let st = pt;
|
|
690
|
+
const Nt = V + P;
|
|
691
|
+
for (; st < $ && F[st] < Nt; )
|
|
692
|
+
st++;
|
|
693
|
+
A({
|
|
694
|
+
startIndex: pt,
|
|
695
|
+
endIndex: Math.min($, st + s)
|
|
696
|
+
});
|
|
697
|
+
}, C = () => {
|
|
698
|
+
S.scrollHeight - S.scrollTop - S.clientHeight < 1 || (T.current = !1), b();
|
|
692
699
|
};
|
|
693
|
-
return
|
|
700
|
+
return S.addEventListener("scroll", C, {
|
|
694
701
|
passive: !0
|
|
695
|
-
}), () =>
|
|
696
|
-
}, []);
|
|
697
|
-
const
|
|
698
|
-
(
|
|
699
|
-
g.current && (
|
|
702
|
+
}), b(), () => S.removeEventListener("scroll", C);
|
|
703
|
+
}, [$, F]);
|
|
704
|
+
const x = wt(
|
|
705
|
+
(S = "smooth") => {
|
|
706
|
+
g.current && (T.current = !0, g.current.scrollTo({
|
|
700
707
|
top: g.current.scrollHeight,
|
|
701
|
-
behavior:
|
|
708
|
+
behavior: S
|
|
702
709
|
}));
|
|
703
710
|
},
|
|
704
711
|
[]
|
|
705
|
-
),
|
|
706
|
-
(
|
|
707
|
-
g.current &&
|
|
708
|
-
top:
|
|
709
|
-
behavior:
|
|
712
|
+
), O = wt(
|
|
713
|
+
(S, b = "smooth") => {
|
|
714
|
+
g.current && F[S] !== void 0 && (T.current = !1, g.current.scrollTo({
|
|
715
|
+
top: F[S],
|
|
716
|
+
behavior: b
|
|
710
717
|
}));
|
|
711
718
|
},
|
|
712
|
-
[
|
|
713
|
-
),
|
|
719
|
+
[F]
|
|
720
|
+
), D = {
|
|
714
721
|
outer: {
|
|
715
722
|
ref: g,
|
|
716
723
|
style: { overflowY: "auto", height: "100%" }
|
|
717
724
|
},
|
|
718
725
|
inner: {
|
|
719
726
|
style: {
|
|
720
|
-
height: `${
|
|
727
|
+
height: `${W}px`,
|
|
721
728
|
position: "relative"
|
|
722
729
|
}
|
|
723
730
|
},
|
|
724
731
|
list: {
|
|
725
732
|
style: {
|
|
726
|
-
transform: `translateY(${
|
|
733
|
+
transform: `translateY(${F[u.startIndex] || 0}px)`
|
|
727
734
|
}
|
|
728
735
|
}
|
|
729
736
|
};
|
|
730
737
|
return {
|
|
731
|
-
virtualState:
|
|
732
|
-
virtualizerProps:
|
|
733
|
-
scrollToBottom:
|
|
734
|
-
scrollToIndex:
|
|
738
|
+
virtualState: M,
|
|
739
|
+
virtualizerProps: D,
|
|
740
|
+
scrollToBottom: x,
|
|
741
|
+
scrollToIndex: O
|
|
735
742
|
};
|
|
736
743
|
};
|
|
737
744
|
if (l === "stateSort")
|
|
738
745
|
return (e) => {
|
|
739
746
|
const s = [...d()].sort(
|
|
740
|
-
(u,
|
|
747
|
+
(u, A) => e(u.item, A.item)
|
|
741
748
|
), c = s.map(({ item: u }) => u), g = {
|
|
742
|
-
...
|
|
749
|
+
...m,
|
|
743
750
|
validIndices: s.map(
|
|
744
751
|
({ originalIndex: u }) => u
|
|
745
752
|
)
|
|
@@ -749,9 +756,9 @@ function lt(t, i, h, f) {
|
|
|
749
756
|
if (l === "stateFilter")
|
|
750
757
|
return (e) => {
|
|
751
758
|
const s = d().filter(
|
|
752
|
-
({ item: u },
|
|
759
|
+
({ item: u }, A) => e(u, A)
|
|
753
760
|
), c = s.map(({ item: u }) => u), g = {
|
|
754
|
-
...
|
|
761
|
+
...m,
|
|
755
762
|
validIndices: s.map(
|
|
756
763
|
({ originalIndex: u }) => u
|
|
757
764
|
)
|
|
@@ -761,23 +768,23 @@ function lt(t, i, h, f) {
|
|
|
761
768
|
if (l === "stateMap")
|
|
762
769
|
return (e) => {
|
|
763
770
|
const o = r.getState().getNestedState(t, n);
|
|
764
|
-
return Array.isArray(o) ? (
|
|
765
|
-
const u = o[c],
|
|
766
|
-
return e(u,
|
|
771
|
+
return Array.isArray(o) ? (m?.validIndices || Array.from({ length: o.length }, (c, g) => g)).map((c, g) => {
|
|
772
|
+
const u = o[c], A = [...n, c.toString()], T = a(u, A, m);
|
|
773
|
+
return e(u, T, {
|
|
767
774
|
register: () => {
|
|
768
|
-
const [,
|
|
769
|
-
|
|
770
|
-
const
|
|
775
|
+
const [, _] = X({}), N = `${h}-${n.join(".")}-${c}`;
|
|
776
|
+
ct(() => {
|
|
777
|
+
const $ = `${t}////${N}`, W = r.getState().stateComponents.get(t) || {
|
|
771
778
|
components: /* @__PURE__ */ new Map()
|
|
772
779
|
};
|
|
773
|
-
return
|
|
774
|
-
forceUpdate: () =>
|
|
775
|
-
paths: /* @__PURE__ */ new Set([
|
|
776
|
-
}), r.getState().stateComponents.set(t,
|
|
777
|
-
const
|
|
778
|
-
|
|
780
|
+
return W.components.set($, {
|
|
781
|
+
forceUpdate: () => _({}),
|
|
782
|
+
paths: /* @__PURE__ */ new Set([A.join(".")])
|
|
783
|
+
}), r.getState().stateComponents.set(t, W), () => {
|
|
784
|
+
const F = r.getState().stateComponents.get(t);
|
|
785
|
+
F && F.components.delete($);
|
|
779
786
|
};
|
|
780
|
-
}, [t,
|
|
787
|
+
}, [t, N]);
|
|
781
788
|
},
|
|
782
789
|
index: g,
|
|
783
790
|
originalIndex: c
|
|
@@ -790,18 +797,18 @@ function lt(t, i, h, f) {
|
|
|
790
797
|
if (l === "stateMapNoRender")
|
|
791
798
|
return (e) => y.map((s, c) => {
|
|
792
799
|
let g;
|
|
793
|
-
|
|
794
|
-
const u = [...n, g.toString()],
|
|
800
|
+
m?.validIndices && m.validIndices[c] !== void 0 ? g = m.validIndices[c] : g = c;
|
|
801
|
+
const u = [...n, g.toString()], A = a(s, u, m);
|
|
795
802
|
return e(
|
|
796
803
|
s,
|
|
797
|
-
|
|
804
|
+
A,
|
|
798
805
|
c,
|
|
799
806
|
y,
|
|
800
|
-
a(y, n,
|
|
807
|
+
a(y, n, m)
|
|
801
808
|
);
|
|
802
809
|
});
|
|
803
810
|
if (l === "$stateMap")
|
|
804
|
-
return (e) => ot(
|
|
811
|
+
return (e) => ot(qt, {
|
|
805
812
|
proxy: {
|
|
806
813
|
_stateKey: t,
|
|
807
814
|
_path: n,
|
|
@@ -813,19 +820,19 @@ function lt(t, i, h, f) {
|
|
|
813
820
|
if (l === "stateList")
|
|
814
821
|
return (e) => {
|
|
815
822
|
const o = r.getState().getNestedState(t, n);
|
|
816
|
-
return Array.isArray(o) ? (
|
|
817
|
-
const u = o[c],
|
|
818
|
-
return ot(
|
|
823
|
+
return Array.isArray(o) ? (m?.validIndices || Array.from({ length: o.length }, (c, g) => g)).map((c, g) => {
|
|
824
|
+
const u = o[c], A = [...n, c.toString()], T = a(u, A, m), E = `${h}-${n.join(".")}-${c}`;
|
|
825
|
+
return ot(Yt, {
|
|
819
826
|
key: c,
|
|
820
827
|
stateKey: t,
|
|
821
828
|
itemComponentId: E,
|
|
822
|
-
itemPath:
|
|
829
|
+
itemPath: A,
|
|
823
830
|
children: e(
|
|
824
831
|
u,
|
|
825
|
-
|
|
832
|
+
T,
|
|
826
833
|
g,
|
|
827
834
|
o,
|
|
828
|
-
a(o, n,
|
|
835
|
+
a(o, n, m)
|
|
829
836
|
)
|
|
830
837
|
});
|
|
831
838
|
}) : (console.warn(
|
|
@@ -842,7 +849,7 @@ function lt(t, i, h, f) {
|
|
|
842
849
|
return a(
|
|
843
850
|
s,
|
|
844
851
|
[...n, "[*]", e],
|
|
845
|
-
|
|
852
|
+
m
|
|
846
853
|
);
|
|
847
854
|
};
|
|
848
855
|
if (l === "index")
|
|
@@ -858,28 +865,28 @@ function lt(t, i, h, f) {
|
|
|
858
865
|
return a(s, c);
|
|
859
866
|
};
|
|
860
867
|
if (l === "insert")
|
|
861
|
-
return (e) => (w(n),
|
|
868
|
+
return (e) => (w(n), St(i, e, n, t), a(
|
|
862
869
|
r.getState().getNestedState(t, n),
|
|
863
870
|
n
|
|
864
871
|
));
|
|
865
872
|
if (l === "uniqueInsert")
|
|
866
873
|
return (e, o, s) => {
|
|
867
|
-
const c = r.getState().getNestedState(t, n), g =
|
|
874
|
+
const c = r.getState().getNestedState(t, n), g = Y(e) ? e(c) : e;
|
|
868
875
|
let u = null;
|
|
869
|
-
if (!c.some((
|
|
876
|
+
if (!c.some((T) => {
|
|
870
877
|
if (o) {
|
|
871
|
-
const
|
|
872
|
-
(
|
|
878
|
+
const _ = o.every(
|
|
879
|
+
(N) => z(T[N], g[N])
|
|
873
880
|
);
|
|
874
|
-
return
|
|
881
|
+
return _ && (u = T), _;
|
|
875
882
|
}
|
|
876
|
-
const E =
|
|
877
|
-
return E && (u =
|
|
883
|
+
const E = z(T, g);
|
|
884
|
+
return E && (u = T), E;
|
|
878
885
|
}))
|
|
879
|
-
w(n),
|
|
886
|
+
w(n), St(i, g, n, t);
|
|
880
887
|
else if (s && u) {
|
|
881
|
-
const
|
|
882
|
-
(
|
|
888
|
+
const T = s(u), E = c.map(
|
|
889
|
+
(_) => z(_, u) ? T : _
|
|
883
890
|
);
|
|
884
891
|
w(n), rt(i, E, n);
|
|
885
892
|
}
|
|
@@ -887,7 +894,7 @@ function lt(t, i, h, f) {
|
|
|
887
894
|
if (l === "cut")
|
|
888
895
|
return (e, o) => {
|
|
889
896
|
if (!o?.waitForSync)
|
|
890
|
-
return w(n),
|
|
897
|
+
return w(n), it(i, n, t, e), a(
|
|
891
898
|
r.getState().getNestedState(t, n),
|
|
892
899
|
n
|
|
893
900
|
);
|
|
@@ -895,12 +902,12 @@ function lt(t, i, h, f) {
|
|
|
895
902
|
if (l === "cutByValue")
|
|
896
903
|
return (e) => {
|
|
897
904
|
for (let o = 0; o < y.length; o++)
|
|
898
|
-
y[o] === e &&
|
|
905
|
+
y[o] === e && it(i, n, t, o);
|
|
899
906
|
};
|
|
900
907
|
if (l === "toggleByValue")
|
|
901
908
|
return (e) => {
|
|
902
909
|
const o = y.findIndex((s) => s === e);
|
|
903
|
-
o > -1 ?
|
|
910
|
+
o > -1 ? it(i, n, t, o) : St(i, e, n, t);
|
|
904
911
|
};
|
|
905
912
|
if (l === "stateFind")
|
|
906
913
|
return (e) => {
|
|
@@ -909,7 +916,7 @@ function lt(t, i, h, f) {
|
|
|
909
916
|
);
|
|
910
917
|
if (!s) return;
|
|
911
918
|
const c = [...n, s.originalIndex.toString()];
|
|
912
|
-
return a(s.item, c,
|
|
919
|
+
return a(s.item, c, m);
|
|
913
920
|
};
|
|
914
921
|
if (l === "findWith")
|
|
915
922
|
return (e, o) => {
|
|
@@ -918,36 +925,36 @@ function lt(t, i, h, f) {
|
|
|
918
925
|
);
|
|
919
926
|
if (!c) return;
|
|
920
927
|
const g = [...n, c.originalIndex.toString()];
|
|
921
|
-
return a(c.item, g,
|
|
928
|
+
return a(c.item, g, m);
|
|
922
929
|
};
|
|
923
930
|
}
|
|
924
|
-
const
|
|
925
|
-
if (!isNaN(Number(
|
|
931
|
+
const Z = n[n.length - 1];
|
|
932
|
+
if (!isNaN(Number(Z))) {
|
|
926
933
|
const d = n.slice(0, -1), e = r.getState().getNestedState(t, d);
|
|
927
934
|
if (Array.isArray(e) && l === "cut")
|
|
928
|
-
return () =>
|
|
935
|
+
return () => it(
|
|
929
936
|
i,
|
|
930
937
|
d,
|
|
931
938
|
t,
|
|
932
|
-
Number(
|
|
939
|
+
Number(Z)
|
|
933
940
|
);
|
|
934
941
|
}
|
|
935
942
|
if (l === "get")
|
|
936
943
|
return () => {
|
|
937
|
-
if (
|
|
944
|
+
if (m?.validIndices && Array.isArray(y)) {
|
|
938
945
|
const d = r.getState().getNestedState(t, n);
|
|
939
|
-
return
|
|
946
|
+
return m.validIndices.map((e) => d[e]);
|
|
940
947
|
}
|
|
941
948
|
return r.getState().getNestedState(t, n);
|
|
942
949
|
};
|
|
943
950
|
if (l === "$derive")
|
|
944
|
-
return (d) =>
|
|
951
|
+
return (d) => bt({
|
|
945
952
|
_stateKey: t,
|
|
946
953
|
_path: n,
|
|
947
954
|
_effect: d.toString()
|
|
948
955
|
});
|
|
949
956
|
if (l === "$get")
|
|
950
|
-
return () =>
|
|
957
|
+
return () => bt({
|
|
951
958
|
_stateKey: t,
|
|
952
959
|
_path: n
|
|
953
960
|
});
|
|
@@ -956,7 +963,7 @@ function lt(t, i, h, f) {
|
|
|
956
963
|
return r.getState().getSyncInfo(d);
|
|
957
964
|
}
|
|
958
965
|
if (l == "getLocalStorage")
|
|
959
|
-
return (d) =>
|
|
966
|
+
return (d) => ut(f + "-" + t + "-" + d);
|
|
960
967
|
if (l === "_selected") {
|
|
961
968
|
const d = n.slice(0, -1), e = d.join("."), o = r.getState().getNestedState(t, d);
|
|
962
969
|
return Array.isArray(o) ? Number(n[n.length - 1]) === r.getState().getSelectedIndex(t, e) : void 0;
|
|
@@ -982,8 +989,8 @@ function lt(t, i, h, f) {
|
|
|
982
989
|
if (n.length == 0) {
|
|
983
990
|
if (l === "applyJsonPatch")
|
|
984
991
|
return (d) => {
|
|
985
|
-
const e = r.getState().cogsStateStore[t], s =
|
|
986
|
-
|
|
992
|
+
const e = r.getState().cogsStateStore[t], s = Ut(e, d).newDocument;
|
|
993
|
+
xt(
|
|
987
994
|
t,
|
|
988
995
|
r.getState().initialStateGlobal[t],
|
|
989
996
|
s,
|
|
@@ -993,57 +1000,57 @@ function lt(t, i, h, f) {
|
|
|
993
1000
|
);
|
|
994
1001
|
const c = r.getState().stateComponents.get(t);
|
|
995
1002
|
if (c) {
|
|
996
|
-
const g =
|
|
1003
|
+
const g = vt(e, s), u = new Set(g);
|
|
997
1004
|
for (const [
|
|
998
|
-
|
|
999
|
-
|
|
1005
|
+
A,
|
|
1006
|
+
T
|
|
1000
1007
|
] of c.components.entries()) {
|
|
1001
1008
|
let E = !1;
|
|
1002
|
-
const
|
|
1003
|
-
if (!
|
|
1004
|
-
if (
|
|
1005
|
-
|
|
1009
|
+
const _ = Array.isArray(T.reactiveType) ? T.reactiveType : [T.reactiveType || "component"];
|
|
1010
|
+
if (!_.includes("none")) {
|
|
1011
|
+
if (_.includes("all")) {
|
|
1012
|
+
T.forceUpdate();
|
|
1006
1013
|
continue;
|
|
1007
1014
|
}
|
|
1008
|
-
if (
|
|
1009
|
-
for (const
|
|
1010
|
-
if (
|
|
1015
|
+
if (_.includes("component") && (T.paths.has("") && (E = !0), !E))
|
|
1016
|
+
for (const N of u) {
|
|
1017
|
+
if (T.paths.has(N)) {
|
|
1011
1018
|
E = !0;
|
|
1012
1019
|
break;
|
|
1013
1020
|
}
|
|
1014
|
-
let
|
|
1015
|
-
for (;
|
|
1016
|
-
const
|
|
1017
|
-
if (
|
|
1021
|
+
let $ = N.lastIndexOf(".");
|
|
1022
|
+
for (; $ !== -1; ) {
|
|
1023
|
+
const W = N.substring(0, $);
|
|
1024
|
+
if (T.paths.has(W)) {
|
|
1018
1025
|
E = !0;
|
|
1019
1026
|
break;
|
|
1020
1027
|
}
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1028
|
+
const F = N.substring(
|
|
1029
|
+
$ + 1
|
|
1023
1030
|
);
|
|
1024
|
-
if (!isNaN(Number(
|
|
1025
|
-
const
|
|
1026
|
-
if (
|
|
1027
|
-
const
|
|
1031
|
+
if (!isNaN(Number(F))) {
|
|
1032
|
+
const M = W.lastIndexOf(".");
|
|
1033
|
+
if (M !== -1) {
|
|
1034
|
+
const x = W.substring(
|
|
1028
1035
|
0,
|
|
1029
|
-
|
|
1036
|
+
M
|
|
1030
1037
|
);
|
|
1031
|
-
if (
|
|
1038
|
+
if (T.paths.has(x)) {
|
|
1032
1039
|
E = !0;
|
|
1033
1040
|
break;
|
|
1034
1041
|
}
|
|
1035
1042
|
}
|
|
1036
1043
|
}
|
|
1037
|
-
|
|
1044
|
+
$ = W.lastIndexOf(".");
|
|
1038
1045
|
}
|
|
1039
1046
|
if (E) break;
|
|
1040
1047
|
}
|
|
1041
|
-
if (!E &&
|
|
1042
|
-
const
|
|
1043
|
-
let
|
|
1044
|
-
typeof
|
|
1048
|
+
if (!E && _.includes("deps") && T.depsFunction) {
|
|
1049
|
+
const N = T.depsFunction(s);
|
|
1050
|
+
let $ = !1;
|
|
1051
|
+
typeof N == "boolean" ? N && ($ = !0) : z(T.deps, N) || (T.deps = N, $ = !0), $ && (E = !0);
|
|
1045
1052
|
}
|
|
1046
|
-
E &&
|
|
1053
|
+
E && T.forceUpdate();
|
|
1047
1054
|
}
|
|
1048
1055
|
}
|
|
1049
1056
|
}
|
|
@@ -1055,18 +1062,18 @@ function lt(t, i, h, f) {
|
|
|
1055
1062
|
throw new Error("Zod schema not found");
|
|
1056
1063
|
if (!d?.key)
|
|
1057
1064
|
throw new Error("Validation key not found");
|
|
1058
|
-
|
|
1065
|
+
J(d.key);
|
|
1059
1066
|
const o = r.getState().cogsStateStore[t];
|
|
1060
1067
|
try {
|
|
1061
1068
|
const s = r.getState().getValidationErrors(d.key);
|
|
1062
1069
|
s && s.length > 0 && s.forEach(([g]) => {
|
|
1063
|
-
g && g.startsWith(d.key) &&
|
|
1070
|
+
g && g.startsWith(d.key) && J(g);
|
|
1064
1071
|
});
|
|
1065
1072
|
const c = d.zodSchema.safeParse(o);
|
|
1066
1073
|
return c.success ? !0 : (c.error.errors.forEach((u) => {
|
|
1067
|
-
const
|
|
1068
|
-
e(E,
|
|
1069
|
-
}),
|
|
1074
|
+
const A = u.path, T = u.message, E = [d.key, ...A].join(".");
|
|
1075
|
+
e(E, T);
|
|
1076
|
+
}), gt(t), !1);
|
|
1070
1077
|
} catch (s) {
|
|
1071
1078
|
return console.error("Zod schema validation failed", s), !1;
|
|
1072
1079
|
}
|
|
@@ -1075,7 +1082,7 @@ function lt(t, i, h, f) {
|
|
|
1075
1082
|
if (l === "getComponents")
|
|
1076
1083
|
return () => r().stateComponents.get(t);
|
|
1077
1084
|
if (l === "getAllFormRefs")
|
|
1078
|
-
return () =>
|
|
1085
|
+
return () => Tt.getState().getFormRefsByStateKey(t);
|
|
1079
1086
|
if (l === "_initialState")
|
|
1080
1087
|
return r.getState().initialStateGlobal[t];
|
|
1081
1088
|
if (l === "_serverState")
|
|
@@ -1088,19 +1095,19 @@ function lt(t, i, h, f) {
|
|
|
1088
1095
|
if (l === "removeValidation") return p.removeValidation;
|
|
1089
1096
|
}
|
|
1090
1097
|
if (l === "getFormRef")
|
|
1091
|
-
return () =>
|
|
1098
|
+
return () => Tt.getState().getFormRef(t + "." + n.join("."));
|
|
1092
1099
|
if (l === "validationWrapper")
|
|
1093
1100
|
return ({
|
|
1094
1101
|
children: d,
|
|
1095
1102
|
hideMessage: e
|
|
1096
|
-
}) => /* @__PURE__ */
|
|
1097
|
-
|
|
1103
|
+
}) => /* @__PURE__ */ mt(
|
|
1104
|
+
jt,
|
|
1098
1105
|
{
|
|
1099
1106
|
formOpts: e ? { validation: { message: "" } } : void 0,
|
|
1100
1107
|
path: n,
|
|
1101
1108
|
validationKey: r.getState().getInitialOptions(t)?.validation?.key || "",
|
|
1102
1109
|
stateKey: t,
|
|
1103
|
-
validIndices:
|
|
1110
|
+
validIndices: m?.validIndices,
|
|
1104
1111
|
children: d
|
|
1105
1112
|
}
|
|
1106
1113
|
);
|
|
@@ -1110,7 +1117,7 @@ function lt(t, i, h, f) {
|
|
|
1110
1117
|
if (l === "update")
|
|
1111
1118
|
return (d, e) => {
|
|
1112
1119
|
if (e?.debounce)
|
|
1113
|
-
|
|
1120
|
+
Mt(() => {
|
|
1114
1121
|
rt(i, d, n, "");
|
|
1115
1122
|
const o = r.getState().getNestedState(t, n);
|
|
1116
1123
|
e?.afterUpdate && e.afterUpdate(o);
|
|
@@ -1123,8 +1130,8 @@ function lt(t, i, h, f) {
|
|
|
1123
1130
|
w(n);
|
|
1124
1131
|
};
|
|
1125
1132
|
if (l === "formElement")
|
|
1126
|
-
return (d, e) => /* @__PURE__ */
|
|
1127
|
-
|
|
1133
|
+
return (d, e) => /* @__PURE__ */ mt(
|
|
1134
|
+
Ot,
|
|
1128
1135
|
{
|
|
1129
1136
|
setState: i,
|
|
1130
1137
|
stateKey: t,
|
|
@@ -1133,11 +1140,11 @@ function lt(t, i, h, f) {
|
|
|
1133
1140
|
formOpts: e
|
|
1134
1141
|
}
|
|
1135
1142
|
);
|
|
1136
|
-
const
|
|
1137
|
-
return a(
|
|
1143
|
+
const j = [...n, l], nt = r.getState().getNestedState(t, j);
|
|
1144
|
+
return a(nt, j, m);
|
|
1138
1145
|
}
|
|
1139
|
-
}, G = new Proxy(
|
|
1140
|
-
return I.set(
|
|
1146
|
+
}, G = new Proxy(R, U);
|
|
1147
|
+
return I.set(L, {
|
|
1141
1148
|
proxy: G,
|
|
1142
1149
|
stateVersion: k
|
|
1143
1150
|
}), G;
|
|
@@ -1146,10 +1153,10 @@ function lt(t, i, h, f) {
|
|
|
1146
1153
|
r.getState().getNestedState(t, [])
|
|
1147
1154
|
);
|
|
1148
1155
|
}
|
|
1149
|
-
function
|
|
1150
|
-
return ot(
|
|
1156
|
+
function bt(t) {
|
|
1157
|
+
return ot(Jt, { proxy: t });
|
|
1151
1158
|
}
|
|
1152
|
-
function
|
|
1159
|
+
function qt({
|
|
1153
1160
|
proxy: t,
|
|
1154
1161
|
rebuildStateShape: i
|
|
1155
1162
|
}) {
|
|
@@ -1161,11 +1168,11 @@ function Wt({
|
|
|
1161
1168
|
(I, k, w, p, a) => t._mapFn(I, k, w, p, a)
|
|
1162
1169
|
) : null;
|
|
1163
1170
|
}
|
|
1164
|
-
function
|
|
1171
|
+
function Jt({
|
|
1165
1172
|
proxy: t
|
|
1166
1173
|
}) {
|
|
1167
|
-
const i =
|
|
1168
|
-
return
|
|
1174
|
+
const i = Q(null), h = `${t._stateKey}-${t._path.join(".")}`;
|
|
1175
|
+
return et(() => {
|
|
1169
1176
|
const f = i.current;
|
|
1170
1177
|
if (!f || !f.parentElement) return;
|
|
1171
1178
|
const I = f.parentElement, w = Array.from(I.childNodes).indexOf(f);
|
|
@@ -1179,29 +1186,29 @@ function Ht({
|
|
|
1179
1186
|
};
|
|
1180
1187
|
r.getState().addSignalElement(h, y);
|
|
1181
1188
|
const n = r.getState().getNestedState(t._stateKey, t._path);
|
|
1182
|
-
let
|
|
1189
|
+
let m;
|
|
1183
1190
|
if (t._effect)
|
|
1184
1191
|
try {
|
|
1185
|
-
|
|
1192
|
+
m = new Function(
|
|
1186
1193
|
"state",
|
|
1187
1194
|
`return (${t._effect})(state)`
|
|
1188
1195
|
)(n);
|
|
1189
|
-
} catch (
|
|
1190
|
-
console.error("Error evaluating effect function during mount:",
|
|
1196
|
+
} catch (R) {
|
|
1197
|
+
console.error("Error evaluating effect function during mount:", R), m = n;
|
|
1191
1198
|
}
|
|
1192
1199
|
else
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
const
|
|
1196
|
-
f.replaceWith(
|
|
1200
|
+
m = n;
|
|
1201
|
+
m !== null && typeof m == "object" && (m = JSON.stringify(m));
|
|
1202
|
+
const L = document.createTextNode(String(m));
|
|
1203
|
+
f.replaceWith(L);
|
|
1197
1204
|
}, [t._stateKey, t._path.join("."), t._effect]), ot("span", {
|
|
1198
1205
|
ref: i,
|
|
1199
1206
|
style: { display: "none" },
|
|
1200
1207
|
"data-signal-id": h
|
|
1201
1208
|
});
|
|
1202
1209
|
}
|
|
1203
|
-
function
|
|
1204
|
-
const i =
|
|
1210
|
+
function de(t) {
|
|
1211
|
+
const i = Vt(
|
|
1205
1212
|
(h) => {
|
|
1206
1213
|
const f = r.getState().stateComponents.get(t._stateKey) || {
|
|
1207
1214
|
components: /* @__PURE__ */ new Map()
|
|
@@ -1215,20 +1222,20 @@ function se(t) {
|
|
|
1215
1222
|
);
|
|
1216
1223
|
return ot("text", {}, String(i));
|
|
1217
1224
|
}
|
|
1218
|
-
function
|
|
1225
|
+
function Yt({
|
|
1219
1226
|
stateKey: t,
|
|
1220
1227
|
itemComponentId: i,
|
|
1221
1228
|
itemPath: h,
|
|
1222
1229
|
children: f
|
|
1223
1230
|
}) {
|
|
1224
|
-
const [, I] =
|
|
1225
|
-
return
|
|
1231
|
+
const [, I] = X({}), [k, w] = Ft(), p = Q(null);
|
|
1232
|
+
return et(() => {
|
|
1226
1233
|
w.height > 0 && w.height !== p.current && (p.current = w.height, r.getState().setShadowMetadata(t, h, {
|
|
1227
1234
|
virtualizer: {
|
|
1228
1235
|
itemHeight: w.height
|
|
1229
1236
|
}
|
|
1230
1237
|
}));
|
|
1231
|
-
}, [w.height, t, h]),
|
|
1238
|
+
}, [w.height, t, h]), ct(() => {
|
|
1232
1239
|
const a = `${t}////${i}`, y = r.getState().stateComponents.get(t) || {
|
|
1233
1240
|
components: /* @__PURE__ */ new Map()
|
|
1234
1241
|
};
|
|
@@ -1239,14 +1246,14 @@ function Bt({
|
|
|
1239
1246
|
const n = r.getState().stateComponents.get(t);
|
|
1240
1247
|
n && n.components.delete(a);
|
|
1241
1248
|
};
|
|
1242
|
-
}, [t, i, h.join(".")]), /* @__PURE__ */
|
|
1249
|
+
}, [t, i, h.join(".")]), /* @__PURE__ */ mt("div", { ref: k, children: f });
|
|
1243
1250
|
}
|
|
1244
1251
|
export {
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1252
|
+
bt as $cogsSignal,
|
|
1253
|
+
de as $cogsSignalStore,
|
|
1254
|
+
ie as addStateOptions,
|
|
1255
|
+
ce as createCogsState,
|
|
1256
|
+
le as notifyComponent,
|
|
1257
|
+
Bt as useCogsStateFn
|
|
1251
1258
|
};
|
|
1252
1259
|
//# sourceMappingURL=CogsState.jsx.map
|