cogsbox-state 0.5.311 → 0.5.313
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 +204 -206
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +18 -33
package/dist/CogsState.jsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as yt } from "react/jsx-runtime";
|
|
3
|
-
import { useState as K, useRef as Y, useEffect as at, useLayoutEffect as dt, useMemo as It, createElement as st, useSyncExternalStore as
|
|
4
|
-
import { transformStateFunc as
|
|
5
|
-
import { pushFunc as vt, updateFn as ot, cutFunc as lt, ValidationWrapper as
|
|
6
|
-
import
|
|
3
|
+
import { useState as K, useRef as Y, useEffect as at, useLayoutEffect as dt, useMemo as It, createElement as st, useSyncExternalStore as Mt, startTransition as jt, useCallback as Et } from "react";
|
|
4
|
+
import { transformStateFunc as Ot, isDeepEqual as H, isFunction as J, getNestedValue as z, getDifferences as pt, debounce as Ut } from "./utility.js";
|
|
5
|
+
import { pushFunc as vt, updateFn as ot, cutFunc as lt, ValidationWrapper as Rt, FormControlComponent as Ft } from "./Functions.jsx";
|
|
6
|
+
import Dt from "superjson";
|
|
7
7
|
import { v4 as wt } from "uuid";
|
|
8
8
|
import "zod";
|
|
9
9
|
import { getGlobalStore as o, formRefStore as At } from "./store.js";
|
|
10
|
-
import { useCogsConfig as
|
|
11
|
-
import { applyPatch as
|
|
12
|
-
import
|
|
10
|
+
import { useCogsConfig as Ct } from "./CogsStateClient.jsx";
|
|
11
|
+
import { applyPatch as Wt } from "fast-json-patch";
|
|
12
|
+
import Gt from "react-use-measure";
|
|
13
13
|
function $t(t, c) {
|
|
14
14
|
const m = o.getState().getInitialOptions, f = o.getState().setInitialStateOptions, y = m(t) || {};
|
|
15
15
|
f(t, {
|
|
@@ -22,20 +22,20 @@ function kt({
|
|
|
22
22
|
options: c,
|
|
23
23
|
initialOptionsPart: m
|
|
24
24
|
}) {
|
|
25
|
-
const f = nt(t) || {}, y = m[t] || {},
|
|
25
|
+
const f = nt(t) || {}, y = m[t] || {}, k = o.getState().setInitialStateOptions, p = { ...y, ...f };
|
|
26
26
|
let I = !1;
|
|
27
27
|
if (c)
|
|
28
28
|
for (const a in c)
|
|
29
29
|
p.hasOwnProperty(a) ? (a == "localStorage" && c[a] && p[a].key !== c[a]?.key && (I = !0, p[a] = c[a]), a == "initialState" && c[a] && p[a] !== c[a] && // Different references
|
|
30
30
|
!H(p[a], c[a]) && (I = !0, p[a] = c[a])) : (I = !0, p[a] = c[a]);
|
|
31
|
-
I &&
|
|
31
|
+
I && k(t, p);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function de(t, { formElements: c, validation: m }) {
|
|
34
34
|
return { initialState: t, formElements: c, validation: m };
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const ue = (t, c) => {
|
|
37
37
|
let m = t;
|
|
38
|
-
const [f, y] =
|
|
38
|
+
const [f, y] = Ot(m);
|
|
39
39
|
(Object.keys(y).length > 0 || c && Object.keys(c).length > 0) && Object.keys(y).forEach((I) => {
|
|
40
40
|
y[I] = y[I] || {}, y[I].formElements = {
|
|
41
41
|
...c?.formElements,
|
|
@@ -45,14 +45,14 @@ const de = (t, c) => {
|
|
|
45
45
|
// State-specific overrides
|
|
46
46
|
}, nt(I) || o.getState().setInitialStateOptions(I, y[I]);
|
|
47
47
|
}), o.getState().setInitialStates(f), o.getState().setCreatedState(f);
|
|
48
|
-
const
|
|
48
|
+
const k = (I, a) => {
|
|
49
49
|
const [v] = K(a?.componentId ?? wt());
|
|
50
50
|
kt({
|
|
51
51
|
stateKey: I,
|
|
52
52
|
options: a,
|
|
53
53
|
initialOptionsPart: y
|
|
54
54
|
});
|
|
55
|
-
const n = o.getState().cogsStateStore[I] || f[I], S = a?.modifyState ? a.modifyState(n) : n, [W, R] =
|
|
55
|
+
const n = o.getState().cogsStateStore[I] || f[I], S = a?.modifyState ? a.modifyState(n) : n, [W, R] = Yt(
|
|
56
56
|
S,
|
|
57
57
|
{
|
|
58
58
|
stateKey: I,
|
|
@@ -71,20 +71,20 @@ const de = (t, c) => {
|
|
|
71
71
|
return R;
|
|
72
72
|
};
|
|
73
73
|
function p(I, a) {
|
|
74
|
-
kt({ stateKey: I, options: a, initialOptionsPart: y }), a.localStorage &&
|
|
74
|
+
kt({ stateKey: I, options: a, initialOptionsPart: y }), a.localStorage && qt(I, a), St(I);
|
|
75
75
|
}
|
|
76
|
-
return { useCogsState:
|
|
76
|
+
return { useCogsState: k, setCogsOptions: p };
|
|
77
77
|
}, {
|
|
78
78
|
setUpdaterState: ut,
|
|
79
79
|
setState: tt,
|
|
80
80
|
getInitialOptions: nt,
|
|
81
|
-
getKeyState:
|
|
81
|
+
getKeyState: Vt,
|
|
82
82
|
getValidationErrors: Lt,
|
|
83
|
-
setStateLog:
|
|
84
|
-
updateInitialStateGlobal:
|
|
85
|
-
addValidationError:
|
|
83
|
+
setStateLog: Ht,
|
|
84
|
+
updateInitialStateGlobal: Tt,
|
|
85
|
+
addValidationError: zt,
|
|
86
86
|
removeValidationError: q,
|
|
87
|
-
setServerSyncActions:
|
|
87
|
+
setServerSyncActions: Bt
|
|
88
88
|
} = o.getState(), bt = (t, c, m, f, y) => {
|
|
89
89
|
m?.log && console.log(
|
|
90
90
|
"saving to localstorage",
|
|
@@ -92,9 +92,9 @@ const de = (t, c) => {
|
|
|
92
92
|
m.localStorage?.key,
|
|
93
93
|
f
|
|
94
94
|
);
|
|
95
|
-
const
|
|
96
|
-
if (
|
|
97
|
-
const p = `${f}-${c}-${
|
|
95
|
+
const k = J(m?.localStorage?.key) ? m.localStorage?.key(t) : m?.localStorage?.key;
|
|
96
|
+
if (k && f) {
|
|
97
|
+
const p = `${f}-${c}-${k}`;
|
|
98
98
|
let I;
|
|
99
99
|
try {
|
|
100
100
|
I = ft(p)?.lastSyncedWithServer;
|
|
@@ -104,7 +104,7 @@ const de = (t, c) => {
|
|
|
104
104
|
state: t,
|
|
105
105
|
lastUpdated: Date.now(),
|
|
106
106
|
lastSyncedWithServer: y ?? I
|
|
107
|
-
}, v =
|
|
107
|
+
}, v = Dt.serialize(a);
|
|
108
108
|
window.localStorage.setItem(
|
|
109
109
|
p,
|
|
110
110
|
JSON.stringify(v.json)
|
|
@@ -118,28 +118,28 @@ const de = (t, c) => {
|
|
|
118
118
|
} catch (c) {
|
|
119
119
|
return console.error("Error loading from localStorage:", c), null;
|
|
120
120
|
}
|
|
121
|
-
},
|
|
122
|
-
const m = o.getState().cogsStateStore[t], { sessionId: f } =
|
|
121
|
+
}, qt = (t, c) => {
|
|
122
|
+
const m = o.getState().cogsStateStore[t], { sessionId: f } = Ct(), y = J(c?.localStorage?.key) ? c.localStorage.key(m) : c?.localStorage?.key;
|
|
123
123
|
if (y && f) {
|
|
124
|
-
const
|
|
124
|
+
const k = ft(
|
|
125
125
|
`${f}-${t}-${y}`
|
|
126
126
|
);
|
|
127
|
-
if (
|
|
128
|
-
return tt(t,
|
|
127
|
+
if (k && k.lastUpdated > (k.lastSyncedWithServer || 0))
|
|
128
|
+
return tt(t, k.state), St(t), !0;
|
|
129
129
|
}
|
|
130
130
|
return !1;
|
|
131
|
-
}, xt = (t, c, m, f, y,
|
|
131
|
+
}, xt = (t, c, m, f, y, k) => {
|
|
132
132
|
const p = {
|
|
133
133
|
initialState: c,
|
|
134
134
|
updaterState: gt(
|
|
135
135
|
t,
|
|
136
136
|
f,
|
|
137
137
|
y,
|
|
138
|
-
|
|
138
|
+
k
|
|
139
139
|
),
|
|
140
140
|
state: m
|
|
141
141
|
};
|
|
142
|
-
|
|
142
|
+
Tt(t, p.initialState), ut(t, p.updaterState), tt(t, p.state);
|
|
143
143
|
}, St = (t) => {
|
|
144
144
|
const c = o.getState().stateComponents.get(t);
|
|
145
145
|
if (!c) return;
|
|
@@ -149,7 +149,7 @@ const de = (t, c) => {
|
|
|
149
149
|
}), queueMicrotask(() => {
|
|
150
150
|
m.forEach((f) => f());
|
|
151
151
|
});
|
|
152
|
-
},
|
|
152
|
+
}, ge = (t, c) => {
|
|
153
153
|
const m = o.getState().stateComponents.get(t);
|
|
154
154
|
if (m) {
|
|
155
155
|
const f = `${t}////${c}`, y = m.components.get(f);
|
|
@@ -157,7 +157,7 @@ const de = (t, c) => {
|
|
|
157
157
|
return;
|
|
158
158
|
y && y.forceUpdate();
|
|
159
159
|
}
|
|
160
|
-
},
|
|
160
|
+
}, Jt = (t, c, m, f) => {
|
|
161
161
|
switch (t) {
|
|
162
162
|
case "update":
|
|
163
163
|
return {
|
|
@@ -180,12 +180,12 @@ const de = (t, c) => {
|
|
|
180
180
|
return { oldValue: null, newValue: null };
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
function
|
|
183
|
+
function Yt(t, {
|
|
184
184
|
stateKey: c,
|
|
185
185
|
serverSync: m,
|
|
186
186
|
localStorage: f,
|
|
187
187
|
formElements: y,
|
|
188
|
-
reactiveDeps:
|
|
188
|
+
reactiveDeps: k,
|
|
189
189
|
reactiveType: p,
|
|
190
190
|
componentId: I,
|
|
191
191
|
initialState: a,
|
|
@@ -193,8 +193,8 @@ function Jt(t, {
|
|
|
193
193
|
dependencies: n,
|
|
194
194
|
serverState: S
|
|
195
195
|
} = {}) {
|
|
196
|
-
const [W, R] = K({}), { sessionId: F } =
|
|
197
|
-
let
|
|
196
|
+
const [W, R] = K({}), { sessionId: F } = Ct();
|
|
197
|
+
let G = !c;
|
|
198
198
|
const [h] = K(c ?? wt()), l = o.getState().stateLog[h], it = Y(/* @__PURE__ */ new Set()), Z = Y(I ?? wt()), O = Y(
|
|
199
199
|
null
|
|
200
200
|
);
|
|
@@ -219,18 +219,18 @@ function Jt(t, {
|
|
|
219
219
|
if (!(i && !H(i, a) || !i) && !s)
|
|
220
220
|
return;
|
|
221
221
|
let u = null;
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
let w = a,
|
|
225
|
-
const _ = s ? Date.now() : 0, x = u?.lastUpdated || 0,
|
|
226
|
-
s && _ > x ? (w = e.serverState.data,
|
|
222
|
+
const T = J(e?.localStorage?.key) ? e?.localStorage?.key(a) : e?.localStorage?.key;
|
|
223
|
+
T && F && (u = ft(`${F}-${h}-${T}`));
|
|
224
|
+
let w = a, E = !1;
|
|
225
|
+
const _ = s ? Date.now() : 0, x = u?.lastUpdated || 0, M = u?.lastSyncedWithServer || 0;
|
|
226
|
+
s && _ > x ? (w = e.serverState.data, E = !0) : u && x > M && (w = u.state, e?.localStorage?.onChange && e?.localStorage?.onChange(w)), o.getState().initializeShadowState(h, a), xt(
|
|
227
227
|
h,
|
|
228
228
|
a,
|
|
229
229
|
w,
|
|
230
230
|
rt,
|
|
231
231
|
Z.current,
|
|
232
232
|
F
|
|
233
|
-
),
|
|
233
|
+
), E && T && F && bt(w, h, e, F, Date.now()), St(h), (Array.isArray(p) ? p : [p || "component"]).includes("none") || R({});
|
|
234
234
|
}
|
|
235
235
|
}, [
|
|
236
236
|
a,
|
|
@@ -238,7 +238,7 @@ function Jt(t, {
|
|
|
238
238
|
S?.data,
|
|
239
239
|
...n || []
|
|
240
240
|
]), dt(() => {
|
|
241
|
-
|
|
241
|
+
G && $t(h, {
|
|
242
242
|
serverSync: m,
|
|
243
243
|
formElements: y,
|
|
244
244
|
initialState: a,
|
|
@@ -252,7 +252,7 @@ function Jt(t, {
|
|
|
252
252
|
forceUpdate: () => R({}),
|
|
253
253
|
paths: /* @__PURE__ */ new Set(),
|
|
254
254
|
deps: [],
|
|
255
|
-
depsFunction:
|
|
255
|
+
depsFunction: k || void 0,
|
|
256
256
|
reactiveType: p ?? ["component", "deps"]
|
|
257
257
|
}), o.getState().stateComponents.set(h, r), R({}), () => {
|
|
258
258
|
r && (r.components.delete(e), r.components.size === 0 && o.getState().stateComponents.delete(h));
|
|
@@ -265,11 +265,11 @@ function Jt(t, {
|
|
|
265
265
|
}
|
|
266
266
|
const g = o.getState();
|
|
267
267
|
tt(h, (u) => {
|
|
268
|
-
const
|
|
268
|
+
const T = J(e) ? e(u) : e, w = `${h}-${r.join(".")}`;
|
|
269
269
|
if (w) {
|
|
270
270
|
let V = !1, N = g.signalDomElements.get(w);
|
|
271
271
|
if ((!N || N.size === 0) && (s.updateType === "insert" || s.updateType === "cut")) {
|
|
272
|
-
const U = r.slice(0, -1), D = z(
|
|
272
|
+
const U = r.slice(0, -1), D = z(T, U);
|
|
273
273
|
if (Array.isArray(D)) {
|
|
274
274
|
V = !0;
|
|
275
275
|
const $ = `${h}-${U.join(".")}`;
|
|
@@ -277,16 +277,16 @@ function Jt(t, {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
if (N) {
|
|
280
|
-
const U = V ? z(
|
|
280
|
+
const U = V ? z(T, r.slice(0, -1)) : z(T, r);
|
|
281
281
|
N.forEach(({ parentId: D, position: $, effect: A }) => {
|
|
282
|
-
const
|
|
282
|
+
const b = document.querySelector(
|
|
283
283
|
`[data-parent-id="${D}"]`
|
|
284
284
|
);
|
|
285
|
-
if (
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
285
|
+
if (b) {
|
|
286
|
+
const j = Array.from(b.childNodes);
|
|
287
|
+
if (j[$]) {
|
|
288
288
|
const C = A ? new Function("state", `return (${A})(state)`)(U) : U;
|
|
289
|
-
|
|
289
|
+
j[$].textContent = String(C);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
});
|
|
@@ -295,48 +295,48 @@ function Jt(t, {
|
|
|
295
295
|
console.log("shadowState", g.shadowStateStore), s.updateType === "update" && (i || O.current?.validation?.key) && r && q(
|
|
296
296
|
(i || O.current?.validation?.key) + "." + r.join(".")
|
|
297
297
|
);
|
|
298
|
-
const
|
|
298
|
+
const E = r.slice(0, r.length - 1);
|
|
299
299
|
s.updateType === "cut" && O.current?.validation?.key && q(
|
|
300
|
-
O.current?.validation?.key + "." +
|
|
300
|
+
O.current?.validation?.key + "." + E.join(".")
|
|
301
301
|
), s.updateType === "insert" && O.current?.validation?.key && Lt(
|
|
302
|
-
O.current?.validation?.key + "." +
|
|
302
|
+
O.current?.validation?.key + "." + E.join(".")
|
|
303
303
|
).filter(([N, U]) => {
|
|
304
304
|
let D = N?.split(".").length;
|
|
305
|
-
if (N ==
|
|
306
|
-
let $ = N + "." +
|
|
307
|
-
q(N),
|
|
305
|
+
if (N == E.join(".") && D == E.length - 1) {
|
|
306
|
+
let $ = N + "." + E;
|
|
307
|
+
q(N), zt($, U);
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
const _ = g.stateComponents.get(h);
|
|
311
311
|
if (console.log("stateEntry >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", _), _) {
|
|
312
|
-
const V = pt(u,
|
|
312
|
+
const V = pt(u, T), N = new Set(V), U = s.updateType === "update" ? r.join(".") : r.slice(0, -1).join(".") || "";
|
|
313
313
|
for (const [
|
|
314
314
|
D,
|
|
315
315
|
$
|
|
316
316
|
] of _.components.entries()) {
|
|
317
317
|
let A = !1;
|
|
318
|
-
const
|
|
319
|
-
if (console.log("component", $), !
|
|
320
|
-
if (
|
|
318
|
+
const b = Array.isArray($.reactiveType) ? $.reactiveType : [$.reactiveType || "component"];
|
|
319
|
+
if (console.log("component", $), !b.includes("none")) {
|
|
320
|
+
if (b.includes("all")) {
|
|
321
321
|
$.forceUpdate();
|
|
322
322
|
continue;
|
|
323
323
|
}
|
|
324
|
-
if (
|
|
325
|
-
for (const
|
|
326
|
-
let C =
|
|
324
|
+
if (b.includes("component") && (($.paths.has(U) || $.paths.has("")) && (A = !0), !A))
|
|
325
|
+
for (const j of N) {
|
|
326
|
+
let C = j;
|
|
327
327
|
for (; ; ) {
|
|
328
328
|
if ($.paths.has(C)) {
|
|
329
329
|
A = !0;
|
|
330
330
|
break;
|
|
331
331
|
}
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
332
|
+
const L = C.lastIndexOf(".");
|
|
333
|
+
if (L !== -1) {
|
|
334
334
|
const et = C.substring(
|
|
335
335
|
0,
|
|
336
|
-
|
|
336
|
+
L
|
|
337
337
|
);
|
|
338
338
|
if (!isNaN(
|
|
339
|
-
Number(C.substring(
|
|
339
|
+
Number(C.substring(L + 1))
|
|
340
340
|
) && $.paths.has(et)) {
|
|
341
341
|
A = !0;
|
|
342
342
|
break;
|
|
@@ -349,10 +349,10 @@ function Jt(t, {
|
|
|
349
349
|
}
|
|
350
350
|
if (A) break;
|
|
351
351
|
}
|
|
352
|
-
if (!A &&
|
|
353
|
-
const
|
|
352
|
+
if (!A && b.includes("deps") && $.depsFunction) {
|
|
353
|
+
const j = $.depsFunction(T);
|
|
354
354
|
let C = !1;
|
|
355
|
-
typeof
|
|
355
|
+
typeof j == "boolean" ? j && (C = !0) : H($.deps, j) || ($.deps = j, C = !0), C && (A = !0);
|
|
356
356
|
}
|
|
357
357
|
A && $.forceUpdate();
|
|
358
358
|
}
|
|
@@ -360,13 +360,13 @@ function Jt(t, {
|
|
|
360
360
|
}
|
|
361
361
|
const x = Date.now();
|
|
362
362
|
r = r.map((V, N) => {
|
|
363
|
-
const U = r.slice(0, -1), D = z(
|
|
363
|
+
const U = r.slice(0, -1), D = z(T, U);
|
|
364
364
|
return N === r.length - 1 && ["insert", "cut"].includes(s.updateType) ? (D.length - 1).toString() : V;
|
|
365
365
|
});
|
|
366
|
-
const { oldValue:
|
|
366
|
+
const { oldValue: M, newValue: P } = Jt(
|
|
367
367
|
s.updateType,
|
|
368
368
|
u,
|
|
369
|
-
|
|
369
|
+
T,
|
|
370
370
|
r
|
|
371
371
|
), B = {
|
|
372
372
|
timeStamp: x,
|
|
@@ -374,30 +374,30 @@ function Jt(t, {
|
|
|
374
374
|
path: r,
|
|
375
375
|
updateType: s.updateType,
|
|
376
376
|
status: "new",
|
|
377
|
-
oldValue:
|
|
378
|
-
newValue:
|
|
377
|
+
oldValue: M,
|
|
378
|
+
newValue: P
|
|
379
379
|
};
|
|
380
380
|
switch (s.updateType) {
|
|
381
381
|
case "update":
|
|
382
|
-
g.updateShadowAtPath(h, r,
|
|
382
|
+
g.updateShadowAtPath(h, r, T);
|
|
383
383
|
break;
|
|
384
384
|
case "insert":
|
|
385
385
|
const V = r.slice(0, -1);
|
|
386
|
-
g.insertShadowArrayElement(h, V,
|
|
386
|
+
g.insertShadowArrayElement(h, V, P);
|
|
387
387
|
break;
|
|
388
388
|
case "cut":
|
|
389
389
|
const N = r.slice(0, -1), U = parseInt(r[r.length - 1]);
|
|
390
390
|
g.removeShadowArrayElement(h, N, U);
|
|
391
391
|
break;
|
|
392
392
|
}
|
|
393
|
-
if (
|
|
393
|
+
if (Ht(h, (V) => {
|
|
394
394
|
const U = [...V ?? [], B].reduce((D, $) => {
|
|
395
|
-
const A = `${$.stateKey}:${JSON.stringify($.path)}`,
|
|
396
|
-
return
|
|
395
|
+
const A = `${$.stateKey}:${JSON.stringify($.path)}`, b = D.get(A);
|
|
396
|
+
return b ? (b.timeStamp = Math.max(b.timeStamp, $.timeStamp), b.newValue = $.newValue, b.oldValue = b.oldValue ?? $.oldValue, b.updateType = $.updateType) : D.set(A, { ...$ }), D;
|
|
397
397
|
}, /* @__PURE__ */ new Map());
|
|
398
398
|
return Array.from(U.values());
|
|
399
399
|
}), bt(
|
|
400
|
-
|
|
400
|
+
T,
|
|
401
401
|
h,
|
|
402
402
|
O.current,
|
|
403
403
|
F
|
|
@@ -406,14 +406,14 @@ function Jt(t, {
|
|
|
406
406
|
update: B
|
|
407
407
|
}), O.current?.serverSync) {
|
|
408
408
|
const V = g.serverState[h], N = O.current?.serverSync;
|
|
409
|
-
|
|
410
|
-
syncKey: typeof N.syncKey == "string" ? N.syncKey : N.syncKey({ state:
|
|
409
|
+
Bt(h, {
|
|
410
|
+
syncKey: typeof N.syncKey == "string" ? N.syncKey : N.syncKey({ state: T }),
|
|
411
411
|
rollBackState: V,
|
|
412
412
|
actionTimeStamp: Date.now() + (N.debounce ?? 3e3),
|
|
413
413
|
status: "waiting"
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
|
-
return
|
|
416
|
+
return T;
|
|
417
417
|
});
|
|
418
418
|
};
|
|
419
419
|
o.getState().updaterState[h] || (ut(
|
|
@@ -424,23 +424,23 @@ function Jt(t, {
|
|
|
424
424
|
Z.current,
|
|
425
425
|
F
|
|
426
426
|
)
|
|
427
|
-
), o.getState().cogsStateStore[h] || tt(h, t), o.getState().initialStateGlobal[h] ||
|
|
427
|
+
), o.getState().cogsStateStore[h] || tt(h, t), o.getState().initialStateGlobal[h] || Tt(h, t));
|
|
428
428
|
const d = It(() => gt(
|
|
429
429
|
h,
|
|
430
430
|
rt,
|
|
431
431
|
Z.current,
|
|
432
432
|
F
|
|
433
433
|
), [h, F]);
|
|
434
|
-
return [
|
|
434
|
+
return [Vt(h), d];
|
|
435
435
|
}
|
|
436
436
|
function gt(t, c, m, f) {
|
|
437
437
|
const y = /* @__PURE__ */ new Map();
|
|
438
|
-
let
|
|
438
|
+
let k = 0;
|
|
439
439
|
const p = (v) => {
|
|
440
440
|
const n = v.join(".");
|
|
441
441
|
for (const [S] of y)
|
|
442
442
|
(S === n || S.startsWith(n + ".")) && y.delete(S);
|
|
443
|
-
|
|
443
|
+
k++;
|
|
444
444
|
}, I = {
|
|
445
445
|
removeValidation: (v) => {
|
|
446
446
|
v?.validationKey && q(v.validationKey);
|
|
@@ -449,30 +449,30 @@ function gt(t, c, m, f) {
|
|
|
449
449
|
const n = o.getState().getInitialOptions(t)?.validation;
|
|
450
450
|
n?.key && q(n?.key), v?.validationKey && q(v.validationKey);
|
|
451
451
|
const S = o.getState().initialStateGlobal[t];
|
|
452
|
-
o.getState().clearSelectedIndexesForState(t), y.clear(),
|
|
453
|
-
const W = a(S, []), R = nt(t), F = J(R?.localStorage?.key) ? R?.localStorage?.key(S) : R?.localStorage?.key,
|
|
454
|
-
|
|
452
|
+
o.getState().clearSelectedIndexesForState(t), y.clear(), k++;
|
|
453
|
+
const W = a(S, []), R = nt(t), F = J(R?.localStorage?.key) ? R?.localStorage?.key(S) : R?.localStorage?.key, G = `${f}-${t}-${F}`;
|
|
454
|
+
G && localStorage.removeItem(G), ut(t, W), tt(t, S);
|
|
455
455
|
const h = o.getState().stateComponents.get(t);
|
|
456
456
|
return h && h.components.forEach((l) => {
|
|
457
457
|
l.forceUpdate();
|
|
458
458
|
}), S;
|
|
459
459
|
},
|
|
460
460
|
updateInitialState: (v) => {
|
|
461
|
-
y.clear(),
|
|
461
|
+
y.clear(), k++;
|
|
462
462
|
const n = gt(
|
|
463
463
|
t,
|
|
464
464
|
c,
|
|
465
465
|
m,
|
|
466
466
|
f
|
|
467
467
|
), S = o.getState().initialStateGlobal[t], W = nt(t), R = J(W?.localStorage?.key) ? W?.localStorage?.key(S) : W?.localStorage?.key, F = `${f}-${t}-${R}`;
|
|
468
|
-
return localStorage.getItem(F) && localStorage.removeItem(F),
|
|
469
|
-
|
|
470
|
-
const
|
|
471
|
-
|
|
468
|
+
return localStorage.getItem(F) && localStorage.removeItem(F), jt(() => {
|
|
469
|
+
Tt(t, v), o.getState().initializeShadowState(t, v), ut(t, n), tt(t, v);
|
|
470
|
+
const G = o.getState().stateComponents.get(t);
|
|
471
|
+
G && G.components.forEach((h) => {
|
|
472
472
|
h.forceUpdate();
|
|
473
473
|
});
|
|
474
474
|
}), {
|
|
475
|
-
fetchId: (
|
|
475
|
+
fetchId: (G) => n.get()[G]
|
|
476
476
|
};
|
|
477
477
|
},
|
|
478
478
|
_initialState: o.getState().initialStateGlobal[t],
|
|
@@ -480,7 +480,7 @@ function gt(t, c, m, f) {
|
|
|
480
480
|
_isLoading: o.getState().isLoadingGlobal[t],
|
|
481
481
|
_isServerSynced: () => {
|
|
482
482
|
const v = o.getState().serverState[t];
|
|
483
|
-
return !!(v && H(v,
|
|
483
|
+
return !!(v && H(v, Vt(t)));
|
|
484
484
|
}
|
|
485
485
|
};
|
|
486
486
|
function a(v, n = [], S) {
|
|
@@ -554,8 +554,8 @@ function gt(t, c, m, f) {
|
|
|
554
554
|
const i = await e.action(r);
|
|
555
555
|
if (i && !i.success && i.errors && s) {
|
|
556
556
|
o.getState().removeValidationError(s), i.errors.forEach((u) => {
|
|
557
|
-
const
|
|
558
|
-
o.getState().addValidationError(
|
|
557
|
+
const T = [s, ...u.path].join(".");
|
|
558
|
+
o.getState().addValidationError(T, u.message);
|
|
559
559
|
});
|
|
560
560
|
const g = o.getState().stateComponents.get(t);
|
|
561
561
|
g && g.components.forEach((u) => {
|
|
@@ -621,74 +621,72 @@ function gt(t, c, m, f) {
|
|
|
621
621
|
itemHeight: r = 50,
|
|
622
622
|
overscan: s = 5,
|
|
623
623
|
stickToBottom: i = !1
|
|
624
|
-
} = e, g = Y(null), [u,
|
|
624
|
+
} = e, g = Y(null), [u, T] = K({
|
|
625
625
|
startIndex: 0,
|
|
626
626
|
endIndex: 10
|
|
627
|
-
}), w = Y(i),
|
|
627
|
+
}), w = Y(i), E = Y(0), [_, x] = K(0);
|
|
628
628
|
at(() => o.getState().subscribeToShadowState(t, () => {
|
|
629
|
-
x((
|
|
629
|
+
x((b) => b + 1);
|
|
630
630
|
}), [t]);
|
|
631
|
-
const
|
|
631
|
+
const M = o().getNestedState(
|
|
632
632
|
t,
|
|
633
633
|
n
|
|
634
|
-
),
|
|
634
|
+
), P = M.length, { totalHeight: B, positions: V } = It(() => {
|
|
635
635
|
const A = o.getState().getShadowMetadata(t, n) || [];
|
|
636
|
-
let
|
|
637
|
-
const
|
|
638
|
-
for (let C = 0; C <
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
636
|
+
let b = 0;
|
|
637
|
+
const j = [];
|
|
638
|
+
for (let C = 0; C < P; C++) {
|
|
639
|
+
j[C] = b;
|
|
640
|
+
const L = A[C]?.virtualizer?.itemHeight;
|
|
641
|
+
b += L || r;
|
|
642
642
|
}
|
|
643
|
-
return { totalHeight:
|
|
643
|
+
return { totalHeight: b, positions: j };
|
|
644
644
|
}, [
|
|
645
|
-
|
|
645
|
+
P,
|
|
646
646
|
t,
|
|
647
647
|
n.join("."),
|
|
648
648
|
r,
|
|
649
649
|
_
|
|
650
650
|
]), N = It(() => {
|
|
651
|
-
const A = Math.max(0, u.startIndex),
|
|
652
|
-
{ length:
|
|
653
|
-
(
|
|
654
|
-
), C =
|
|
651
|
+
const A = Math.max(0, u.startIndex), b = Math.min(P, u.endIndex), j = Array.from(
|
|
652
|
+
{ length: b - A },
|
|
653
|
+
(L, et) => A + et
|
|
654
|
+
), C = j.map((L) => M[L]);
|
|
655
655
|
return a(C, n, {
|
|
656
656
|
...S,
|
|
657
|
-
validIndices:
|
|
657
|
+
validIndices: j
|
|
658
658
|
});
|
|
659
|
-
}, [u.startIndex, u.endIndex,
|
|
659
|
+
}, [u.startIndex, u.endIndex, M, P]);
|
|
660
660
|
dt(() => {
|
|
661
661
|
const A = g.current;
|
|
662
662
|
if (!A) return;
|
|
663
|
-
const
|
|
664
|
-
const { scrollTop:
|
|
665
|
-
w.current =
|
|
666
|
-
let mt = 0, ct =
|
|
663
|
+
const b = P > E.current, j = () => {
|
|
664
|
+
const { scrollTop: C, clientHeight: L, scrollHeight: et } = A, Pt = et - C - L < 1;
|
|
665
|
+
w.current = Pt;
|
|
666
|
+
let mt = 0, ct = P - 1;
|
|
667
667
|
for (; mt <= ct; ) {
|
|
668
668
|
const Q = Math.floor((mt + ct) / 2);
|
|
669
|
-
V[Q] <
|
|
669
|
+
V[Q] < C ? mt = Q + 1 : ct = Q - 1;
|
|
670
670
|
}
|
|
671
671
|
const ht = Math.max(0, ct - s);
|
|
672
672
|
let X = ht;
|
|
673
|
-
const
|
|
674
|
-
for (; X <
|
|
673
|
+
const _t = C + L;
|
|
674
|
+
for (; X < P && V[X] < _t; )
|
|
675
675
|
X++;
|
|
676
|
-
X = Math.min(
|
|
676
|
+
X = Math.min(P, X + s), T((Q) => Q.startIndex !== ht || Q.endIndex !== X ? { startIndex: ht, endIndex: X } : Q);
|
|
677
677
|
};
|
|
678
|
-
if (A.addEventListener("scroll",
|
|
678
|
+
if (A.addEventListener("scroll", j, {
|
|
679
679
|
passive: !0
|
|
680
680
|
}), i && w.current) {
|
|
681
|
-
const
|
|
681
|
+
const C = b && E.current > 0 ? "smooth" : "auto";
|
|
682
682
|
A.scrollTo({
|
|
683
683
|
top: A.scrollHeight,
|
|
684
|
-
behavior:
|
|
684
|
+
behavior: C
|
|
685
685
|
});
|
|
686
686
|
}
|
|
687
|
-
return
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
}, [M, V, s, i]);
|
|
691
|
-
const U = Tt(
|
|
687
|
+
return E.current = P, j(), () => A.removeEventListener("scroll", j);
|
|
688
|
+
}, [P, V, s, i]);
|
|
689
|
+
const U = Et(
|
|
692
690
|
(A = "smooth") => {
|
|
693
691
|
g.current && g.current.scrollTo({
|
|
694
692
|
top: g.current.scrollHeight,
|
|
@@ -696,11 +694,11 @@ function gt(t, c, m, f) {
|
|
|
696
694
|
});
|
|
697
695
|
},
|
|
698
696
|
[]
|
|
699
|
-
), D =
|
|
700
|
-
(A,
|
|
697
|
+
), D = Et(
|
|
698
|
+
(A, b = "smooth") => {
|
|
701
699
|
g.current && V[A] !== void 0 && g.current.scrollTo({
|
|
702
700
|
top: V[A],
|
|
703
|
-
behavior:
|
|
701
|
+
behavior: b
|
|
704
702
|
});
|
|
705
703
|
},
|
|
706
704
|
[V]
|
|
@@ -731,7 +729,7 @@ function gt(t, c, m, f) {
|
|
|
731
729
|
if (l === "stateSort")
|
|
732
730
|
return (e) => {
|
|
733
731
|
const s = [...d()].sort(
|
|
734
|
-
(u,
|
|
732
|
+
(u, T) => e(u.item, T.item)
|
|
735
733
|
), i = s.map(({ item: u }) => u), g = {
|
|
736
734
|
...S,
|
|
737
735
|
validIndices: s.map(
|
|
@@ -743,7 +741,7 @@ function gt(t, c, m, f) {
|
|
|
743
741
|
if (l === "stateFilter")
|
|
744
742
|
return (e) => {
|
|
745
743
|
const s = d().filter(
|
|
746
|
-
({ item: u },
|
|
744
|
+
({ item: u }, T) => e(u, T)
|
|
747
745
|
), i = s.map(({ item: u }) => u), g = {
|
|
748
746
|
...S,
|
|
749
747
|
validIndices: s.map(
|
|
@@ -756,20 +754,20 @@ function gt(t, c, m, f) {
|
|
|
756
754
|
return (e) => {
|
|
757
755
|
const r = o.getState().getNestedState(t, n);
|
|
758
756
|
return Array.isArray(r) ? (S?.validIndices || Array.from({ length: r.length }, (i, g) => g)).map((i, g) => {
|
|
759
|
-
const u = r[i],
|
|
757
|
+
const u = r[i], T = [...n, i.toString()], w = a(u, T, S);
|
|
760
758
|
return e(u, w, {
|
|
761
759
|
register: () => {
|
|
762
760
|
const [, _] = K({}), x = `${m}-${n.join(".")}-${i}`;
|
|
763
761
|
dt(() => {
|
|
764
|
-
const
|
|
762
|
+
const M = `${t}////${x}`, P = o.getState().stateComponents.get(t) || {
|
|
765
763
|
components: /* @__PURE__ */ new Map()
|
|
766
764
|
};
|
|
767
|
-
return
|
|
765
|
+
return P.components.set(M, {
|
|
768
766
|
forceUpdate: () => _({}),
|
|
769
|
-
paths: /* @__PURE__ */ new Set([
|
|
770
|
-
}), o.getState().stateComponents.set(t,
|
|
767
|
+
paths: /* @__PURE__ */ new Set([T.join(".")])
|
|
768
|
+
}), o.getState().stateComponents.set(t, P), () => {
|
|
771
769
|
const B = o.getState().stateComponents.get(t);
|
|
772
|
-
B && B.components.delete(
|
|
770
|
+
B && B.components.delete(M);
|
|
773
771
|
};
|
|
774
772
|
}, [t, x]);
|
|
775
773
|
},
|
|
@@ -785,17 +783,17 @@ function gt(t, c, m, f) {
|
|
|
785
783
|
return (e) => v.map((s, i) => {
|
|
786
784
|
let g;
|
|
787
785
|
S?.validIndices && S.validIndices[i] !== void 0 ? g = S.validIndices[i] : g = i;
|
|
788
|
-
const u = [...n, g.toString()],
|
|
786
|
+
const u = [...n, g.toString()], T = a(s, u, S);
|
|
789
787
|
return e(
|
|
790
788
|
s,
|
|
791
|
-
|
|
789
|
+
T,
|
|
792
790
|
i,
|
|
793
791
|
v,
|
|
794
792
|
a(v, n, S)
|
|
795
793
|
);
|
|
796
794
|
});
|
|
797
795
|
if (l === "$stateMap")
|
|
798
|
-
return (e) => st(
|
|
796
|
+
return (e) => st(Zt, {
|
|
799
797
|
proxy: {
|
|
800
798
|
_stateKey: t,
|
|
801
799
|
_path: n,
|
|
@@ -808,12 +806,12 @@ function gt(t, c, m, f) {
|
|
|
808
806
|
return (e) => {
|
|
809
807
|
const r = o.getState().getNestedState(t, n);
|
|
810
808
|
return Array.isArray(r) ? (S?.validIndices || Array.from({ length: r.length }, (i, g) => g)).map((i, g) => {
|
|
811
|
-
const u = r[i],
|
|
812
|
-
return st(
|
|
809
|
+
const u = r[i], T = [...n, i.toString()], w = a(u, T, S), E = `${m}-${n.join(".")}-${i}`;
|
|
810
|
+
return st(Qt, {
|
|
813
811
|
key: i,
|
|
814
812
|
stateKey: t,
|
|
815
|
-
itemComponentId:
|
|
816
|
-
itemPath:
|
|
813
|
+
itemComponentId: E,
|
|
814
|
+
itemPath: T,
|
|
817
815
|
children: e(
|
|
818
816
|
u,
|
|
819
817
|
w,
|
|
@@ -829,7 +827,7 @@ function gt(t, c, m, f) {
|
|
|
829
827
|
if (l === "stateFlattenOn")
|
|
830
828
|
return (e) => {
|
|
831
829
|
const r = v;
|
|
832
|
-
y.clear(),
|
|
830
|
+
y.clear(), k++;
|
|
833
831
|
const s = r.flatMap(
|
|
834
832
|
(i) => i[e] ?? []
|
|
835
833
|
);
|
|
@@ -867,15 +865,15 @@ function gt(t, c, m, f) {
|
|
|
867
865
|
);
|
|
868
866
|
return _ && (u = w), _;
|
|
869
867
|
}
|
|
870
|
-
const
|
|
871
|
-
return
|
|
868
|
+
const E = H(w, g);
|
|
869
|
+
return E && (u = w), E;
|
|
872
870
|
}))
|
|
873
871
|
p(n), vt(c, g, n, t);
|
|
874
872
|
else if (s && u) {
|
|
875
|
-
const w = s(u),
|
|
873
|
+
const w = s(u), E = i.map(
|
|
876
874
|
(_) => H(_, u) ? w : _
|
|
877
875
|
);
|
|
878
|
-
p(n), ot(c,
|
|
876
|
+
p(n), ot(c, E, n);
|
|
879
877
|
}
|
|
880
878
|
};
|
|
881
879
|
if (l === "cut")
|
|
@@ -976,7 +974,7 @@ function gt(t, c, m, f) {
|
|
|
976
974
|
if (n.length == 0) {
|
|
977
975
|
if (l === "applyJsonPatch")
|
|
978
976
|
return (d) => {
|
|
979
|
-
const e = o.getState().cogsStateStore[t], s =
|
|
977
|
+
const e = o.getState().cogsStateStore[t], s = Wt(e, d).newDocument;
|
|
980
978
|
xt(
|
|
981
979
|
t,
|
|
982
980
|
o.getState().initialStateGlobal[t],
|
|
@@ -989,55 +987,55 @@ function gt(t, c, m, f) {
|
|
|
989
987
|
if (i) {
|
|
990
988
|
const g = pt(e, s), u = new Set(g);
|
|
991
989
|
for (const [
|
|
992
|
-
|
|
990
|
+
T,
|
|
993
991
|
w
|
|
994
992
|
] of i.components.entries()) {
|
|
995
|
-
let
|
|
993
|
+
let E = !1;
|
|
996
994
|
const _ = Array.isArray(w.reactiveType) ? w.reactiveType : [w.reactiveType || "component"];
|
|
997
995
|
if (!_.includes("none")) {
|
|
998
996
|
if (_.includes("all")) {
|
|
999
997
|
w.forceUpdate();
|
|
1000
998
|
continue;
|
|
1001
999
|
}
|
|
1002
|
-
if (_.includes("component") && (w.paths.has("") && (
|
|
1000
|
+
if (_.includes("component") && (w.paths.has("") && (E = !0), !E))
|
|
1003
1001
|
for (const x of u) {
|
|
1004
1002
|
if (w.paths.has(x)) {
|
|
1005
|
-
|
|
1003
|
+
E = !0;
|
|
1006
1004
|
break;
|
|
1007
1005
|
}
|
|
1008
|
-
let
|
|
1009
|
-
for (;
|
|
1010
|
-
const
|
|
1011
|
-
if (w.paths.has(
|
|
1012
|
-
|
|
1006
|
+
let M = x.lastIndexOf(".");
|
|
1007
|
+
for (; M !== -1; ) {
|
|
1008
|
+
const P = x.substring(0, M);
|
|
1009
|
+
if (w.paths.has(P)) {
|
|
1010
|
+
E = !0;
|
|
1013
1011
|
break;
|
|
1014
1012
|
}
|
|
1015
1013
|
const B = x.substring(
|
|
1016
|
-
|
|
1014
|
+
M + 1
|
|
1017
1015
|
);
|
|
1018
1016
|
if (!isNaN(Number(B))) {
|
|
1019
|
-
const V =
|
|
1017
|
+
const V = P.lastIndexOf(".");
|
|
1020
1018
|
if (V !== -1) {
|
|
1021
|
-
const N =
|
|
1019
|
+
const N = P.substring(
|
|
1022
1020
|
0,
|
|
1023
1021
|
V
|
|
1024
1022
|
);
|
|
1025
1023
|
if (w.paths.has(N)) {
|
|
1026
|
-
|
|
1024
|
+
E = !0;
|
|
1027
1025
|
break;
|
|
1028
1026
|
}
|
|
1029
1027
|
}
|
|
1030
1028
|
}
|
|
1031
|
-
|
|
1029
|
+
M = P.lastIndexOf(".");
|
|
1032
1030
|
}
|
|
1033
|
-
if (
|
|
1031
|
+
if (E) break;
|
|
1034
1032
|
}
|
|
1035
|
-
if (!
|
|
1033
|
+
if (!E && _.includes("deps") && w.depsFunction) {
|
|
1036
1034
|
const x = w.depsFunction(s);
|
|
1037
|
-
let
|
|
1038
|
-
typeof x == "boolean" ? x && (
|
|
1035
|
+
let M = !1;
|
|
1036
|
+
typeof x == "boolean" ? x && (M = !0) : H(w.deps, x) || (w.deps = x, M = !0), M && (E = !0);
|
|
1039
1037
|
}
|
|
1040
|
-
|
|
1038
|
+
E && w.forceUpdate();
|
|
1041
1039
|
}
|
|
1042
1040
|
}
|
|
1043
1041
|
}
|
|
@@ -1058,8 +1056,8 @@ function gt(t, c, m, f) {
|
|
|
1058
1056
|
});
|
|
1059
1057
|
const i = d.zodSchema.safeParse(r);
|
|
1060
1058
|
return i.success ? !0 : (i.error.errors.forEach((u) => {
|
|
1061
|
-
const
|
|
1062
|
-
e(
|
|
1059
|
+
const T = u.path, w = u.message, E = [d.key, ...T].join(".");
|
|
1060
|
+
e(E, w);
|
|
1063
1061
|
}), St(t), !1);
|
|
1064
1062
|
} catch (s) {
|
|
1065
1063
|
return console.error("Zod schema validation failed", s), !1;
|
|
@@ -1088,7 +1086,7 @@ function gt(t, c, m, f) {
|
|
|
1088
1086
|
children: d,
|
|
1089
1087
|
hideMessage: e
|
|
1090
1088
|
}) => /* @__PURE__ */ yt(
|
|
1091
|
-
|
|
1089
|
+
Rt,
|
|
1092
1090
|
{
|
|
1093
1091
|
formOpts: e ? { validation: { message: "" } } : void 0,
|
|
1094
1092
|
path: n,
|
|
@@ -1104,7 +1102,7 @@ function gt(t, c, m, f) {
|
|
|
1104
1102
|
if (l === "update")
|
|
1105
1103
|
return (d, e) => {
|
|
1106
1104
|
if (e?.debounce)
|
|
1107
|
-
|
|
1105
|
+
Ut(() => {
|
|
1108
1106
|
ot(c, d, n, "");
|
|
1109
1107
|
const r = o.getState().getNestedState(t, n);
|
|
1110
1108
|
e?.afterUpdate && e.afterUpdate(r);
|
|
@@ -1118,7 +1116,7 @@ function gt(t, c, m, f) {
|
|
|
1118
1116
|
};
|
|
1119
1117
|
if (l === "formElement")
|
|
1120
1118
|
return (d, e) => /* @__PURE__ */ yt(
|
|
1121
|
-
|
|
1119
|
+
Ft,
|
|
1122
1120
|
{
|
|
1123
1121
|
setState: c,
|
|
1124
1122
|
stateKey: t,
|
|
@@ -1130,20 +1128,20 @@ function gt(t, c, m, f) {
|
|
|
1130
1128
|
const O = [...n, l], rt = o.getState().getNestedState(t, O);
|
|
1131
1129
|
return a(rt, O, S);
|
|
1132
1130
|
}
|
|
1133
|
-
},
|
|
1131
|
+
}, G = new Proxy(R, F);
|
|
1134
1132
|
return y.set(W, {
|
|
1135
|
-
proxy:
|
|
1136
|
-
stateVersion:
|
|
1137
|
-
}),
|
|
1133
|
+
proxy: G,
|
|
1134
|
+
stateVersion: k
|
|
1135
|
+
}), G;
|
|
1138
1136
|
}
|
|
1139
1137
|
return a(
|
|
1140
1138
|
o.getState().getNestedState(t, [])
|
|
1141
1139
|
);
|
|
1142
1140
|
}
|
|
1143
1141
|
function Nt(t) {
|
|
1144
|
-
return st(
|
|
1142
|
+
return st(Xt, { proxy: t });
|
|
1145
1143
|
}
|
|
1146
|
-
function
|
|
1144
|
+
function Zt({
|
|
1147
1145
|
proxy: t,
|
|
1148
1146
|
rebuildStateShape: c
|
|
1149
1147
|
}) {
|
|
@@ -1152,10 +1150,10 @@ function Yt({
|
|
|
1152
1150
|
m,
|
|
1153
1151
|
t._path
|
|
1154
1152
|
).stateMapNoRender(
|
|
1155
|
-
(y,
|
|
1153
|
+
(y, k, p, I, a) => t._mapFn(y, k, p, I, a)
|
|
1156
1154
|
) : null;
|
|
1157
1155
|
}
|
|
1158
|
-
function
|
|
1156
|
+
function Xt({
|
|
1159
1157
|
proxy: t
|
|
1160
1158
|
}) {
|
|
1161
1159
|
const c = Y(null), m = `${t._stateKey}-${t._path.join(".")}`;
|
|
@@ -1194,8 +1192,8 @@ function Zt({
|
|
|
1194
1192
|
"data-signal-id": m
|
|
1195
1193
|
});
|
|
1196
1194
|
}
|
|
1197
|
-
function
|
|
1198
|
-
const c =
|
|
1195
|
+
function fe(t) {
|
|
1196
|
+
const c = Mt(
|
|
1199
1197
|
(m) => {
|
|
1200
1198
|
const f = o.getState().stateComponents.get(t._stateKey) || {
|
|
1201
1199
|
components: /* @__PURE__ */ new Map()
|
|
@@ -1209,13 +1207,13 @@ function ge(t) {
|
|
|
1209
1207
|
);
|
|
1210
1208
|
return st("text", {}, String(c));
|
|
1211
1209
|
}
|
|
1212
|
-
function
|
|
1210
|
+
function Qt({
|
|
1213
1211
|
stateKey: t,
|
|
1214
1212
|
itemComponentId: c,
|
|
1215
1213
|
itemPath: m,
|
|
1216
1214
|
children: f
|
|
1217
1215
|
}) {
|
|
1218
|
-
const [, y] = K({}), [
|
|
1216
|
+
const [, y] = K({}), [k, p] = Gt(), I = Y(null);
|
|
1219
1217
|
return at(() => {
|
|
1220
1218
|
p.height > 0 && p.height !== I.current && (I.current = p.height, o.getState().setShadowMetadata(t, m, {
|
|
1221
1219
|
virtualizer: {
|
|
@@ -1233,14 +1231,14 @@ function Xt({
|
|
|
1233
1231
|
const n = o.getState().stateComponents.get(t);
|
|
1234
1232
|
n && n.components.delete(a);
|
|
1235
1233
|
};
|
|
1236
|
-
}, [t, c, m.join(".")]), /* @__PURE__ */ yt("div", { ref:
|
|
1234
|
+
}, [t, c, m.join(".")]), /* @__PURE__ */ yt("div", { ref: k, children: f });
|
|
1237
1235
|
}
|
|
1238
1236
|
export {
|
|
1239
1237
|
Nt as $cogsSignal,
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1238
|
+
fe as $cogsSignalStore,
|
|
1239
|
+
de as addStateOptions,
|
|
1240
|
+
ue as createCogsState,
|
|
1241
|
+
ge as notifyComponent,
|
|
1242
|
+
Yt as useCogsStateFn
|
|
1245
1243
|
};
|
|
1246
1244
|
//# sourceMappingURL=CogsState.jsx.map
|