cogsbox-state 0.5.293 → 0.5.294
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 +93 -93
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +1 -1
package/dist/CogsState.jsx
CHANGED
|
@@ -22,13 +22,13 @@ function At({
|
|
|
22
22
|
options: i,
|
|
23
23
|
initialOptionsPart: h
|
|
24
24
|
}) {
|
|
25
|
-
const f = nt(t) || {}, v = h[t] || {}, k = o.getState().setInitialStateOptions,
|
|
25
|
+
const f = nt(t) || {}, v = h[t] || {}, k = o.getState().setInitialStateOptions, w = { ...v, ...f };
|
|
26
26
|
let I = !1;
|
|
27
27
|
if (i)
|
|
28
28
|
for (const a in i)
|
|
29
|
-
|
|
30
|
-
!H(
|
|
31
|
-
I && k(t,
|
|
29
|
+
w.hasOwnProperty(a) ? (a == "localStorage" && i[a] && w[a].key !== i[a]?.key && (I = !0, w[a] = i[a]), a == "initialState" && i[a] && w[a] !== i[a] && // Different references
|
|
30
|
+
!H(w[a], i[a]) && (I = !0, w[a] = i[a])) : (I = !0, w[a] = i[a]);
|
|
31
|
+
I && k(t, w);
|
|
32
32
|
}
|
|
33
33
|
function se(t, { formElements: i, validation: h }) {
|
|
34
34
|
return { initialState: t, formElements: i, validation: h };
|
|
@@ -70,10 +70,10 @@ const ie = (t, i) => {
|
|
|
70
70
|
);
|
|
71
71
|
return R;
|
|
72
72
|
};
|
|
73
|
-
function
|
|
73
|
+
function w(I, a) {
|
|
74
74
|
At({ stateKey: I, options: a, initialOptionsPart: v }), a.localStorage && Lt(I, a), St(I);
|
|
75
75
|
}
|
|
76
|
-
return { useCogsState: k, setCogsOptions:
|
|
76
|
+
return { useCogsState: k, setCogsOptions: w };
|
|
77
77
|
}, {
|
|
78
78
|
setUpdaterState: ut,
|
|
79
79
|
setState: K,
|
|
@@ -94,10 +94,10 @@ const ie = (t, i) => {
|
|
|
94
94
|
);
|
|
95
95
|
const k = Z(h?.localStorage?.key) ? h.localStorage?.key(t) : h?.localStorage?.key;
|
|
96
96
|
if (k && f) {
|
|
97
|
-
const
|
|
97
|
+
const w = `${f}-${i}-${k}`;
|
|
98
98
|
let I;
|
|
99
99
|
try {
|
|
100
|
-
I = ft(
|
|
100
|
+
I = ft(w)?.lastSyncedWithServer;
|
|
101
101
|
} catch {
|
|
102
102
|
}
|
|
103
103
|
const a = {
|
|
@@ -106,7 +106,7 @@ const ie = (t, i) => {
|
|
|
106
106
|
lastSyncedWithServer: v ?? I
|
|
107
107
|
}, y = jt.serialize(a);
|
|
108
108
|
window.localStorage.setItem(
|
|
109
|
-
|
|
109
|
+
w,
|
|
110
110
|
JSON.stringify(y.json)
|
|
111
111
|
);
|
|
112
112
|
}
|
|
@@ -129,7 +129,7 @@ const ie = (t, i) => {
|
|
|
129
129
|
}
|
|
130
130
|
return !1;
|
|
131
131
|
}, Vt = (t, i, h, f, v, k) => {
|
|
132
|
-
const
|
|
132
|
+
const w = {
|
|
133
133
|
initialState: i,
|
|
134
134
|
updaterState: gt(
|
|
135
135
|
t,
|
|
@@ -139,7 +139,7 @@ const ie = (t, i) => {
|
|
|
139
139
|
),
|
|
140
140
|
state: h
|
|
141
141
|
};
|
|
142
|
-
wt(t,
|
|
142
|
+
wt(t, w.initialState), ut(t, w.updaterState), K(t, w.state);
|
|
143
143
|
}, St = (t) => {
|
|
144
144
|
const i = o.getState().stateComponents.get(t);
|
|
145
145
|
if (!i) return;
|
|
@@ -186,7 +186,7 @@ function zt(t, {
|
|
|
186
186
|
localStorage: f,
|
|
187
187
|
formElements: v,
|
|
188
188
|
reactiveDeps: k,
|
|
189
|
-
reactiveType:
|
|
189
|
+
reactiveType: w,
|
|
190
190
|
componentId: I,
|
|
191
191
|
initialState: a,
|
|
192
192
|
syncUpdate: y,
|
|
@@ -221,16 +221,16 @@ function zt(t, {
|
|
|
221
221
|
let u = null;
|
|
222
222
|
const T = Z(e?.localStorage?.key) ? e?.localStorage?.key(a) : e?.localStorage?.key;
|
|
223
223
|
T && U && (u = ft(`${U}-${m}-${T}`));
|
|
224
|
-
let
|
|
224
|
+
let E = a, $ = !1;
|
|
225
225
|
const P = s ? Date.now() : 0, x = u?.lastUpdated || 0, N = u?.lastSyncedWithServer || 0;
|
|
226
|
-
s && P > x ? (
|
|
226
|
+
s && P > x ? (E = e.serverState.data, $ = !0) : u && x > N && (E = u.state, e?.localStorage?.onChange && e?.localStorage?.onChange(E)), o.getState().initializeShadowState(m, a), Vt(
|
|
227
227
|
m,
|
|
228
228
|
a,
|
|
229
|
-
|
|
229
|
+
E,
|
|
230
230
|
ot,
|
|
231
231
|
X.current,
|
|
232
232
|
U
|
|
233
|
-
), $ && T && U && $t(
|
|
233
|
+
), $ && T && U && $t(E, m, e, U, Date.now()), St(m), (Array.isArray(w) ? w : [w || "component"]).includes("none") || R({});
|
|
234
234
|
}
|
|
235
235
|
}, [
|
|
236
236
|
a,
|
|
@@ -253,7 +253,7 @@ function zt(t, {
|
|
|
253
253
|
paths: /* @__PURE__ */ new Set(),
|
|
254
254
|
deps: [],
|
|
255
255
|
depsFunction: k || void 0,
|
|
256
|
-
reactiveType:
|
|
256
|
+
reactiveType: w ?? ["component", "deps"]
|
|
257
257
|
}), o.getState().stateComponents.set(m, r), R({}), () => {
|
|
258
258
|
r && (r.components.delete(e), r.components.size === 0 && o.getState().stateComponents.delete(m));
|
|
259
259
|
};
|
|
@@ -265,9 +265,9 @@ function zt(t, {
|
|
|
265
265
|
}
|
|
266
266
|
const g = o.getState();
|
|
267
267
|
K(m, (u) => {
|
|
268
|
-
const T = Z(e) ? e(u) : e,
|
|
269
|
-
if (
|
|
270
|
-
let b = !1, C = g.signalDomElements.get(
|
|
268
|
+
const T = Z(e) ? e(u) : e, E = `${m}-${r.join(".")}`;
|
|
269
|
+
if (E) {
|
|
270
|
+
let b = !1, C = g.signalDomElements.get(E);
|
|
271
271
|
if ((!C || C.size === 0) && (s.updateType === "insert" || s.updateType === "cut")) {
|
|
272
272
|
const j = r.slice(0, -1), D = z(T, j);
|
|
273
273
|
if (Array.isArray(D)) {
|
|
@@ -278,14 +278,14 @@ function zt(t, {
|
|
|
278
278
|
}
|
|
279
279
|
if (C) {
|
|
280
280
|
const j = b ? z(T, r.slice(0, -1)) : z(T, r);
|
|
281
|
-
C.forEach(({ parentId: D, position: A, effect:
|
|
281
|
+
C.forEach(({ parentId: D, position: A, effect: p }) => {
|
|
282
282
|
const V = document.querySelector(
|
|
283
283
|
`[data-parent-id="${D}"]`
|
|
284
284
|
);
|
|
285
285
|
if (V) {
|
|
286
286
|
const _ = Array.from(V.childNodes);
|
|
287
287
|
if (_[A]) {
|
|
288
|
-
const M =
|
|
288
|
+
const M = p ? new Function("state", `return (${p})(state)`)(j) : j;
|
|
289
289
|
_[A].textContent = String(M);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
@@ -314,19 +314,19 @@ function zt(t, {
|
|
|
314
314
|
D,
|
|
315
315
|
A
|
|
316
316
|
] of P.components.entries()) {
|
|
317
|
-
let
|
|
317
|
+
let p = !1;
|
|
318
318
|
const V = Array.isArray(A.reactiveType) ? A.reactiveType : [A.reactiveType || "component"];
|
|
319
319
|
if (console.log("component", A), !V.includes("none")) {
|
|
320
320
|
if (V.includes("all")) {
|
|
321
321
|
A.forceUpdate();
|
|
322
322
|
continue;
|
|
323
323
|
}
|
|
324
|
-
if (V.includes("component") && ((A.paths.has(j) || A.paths.has("")) && (
|
|
324
|
+
if (V.includes("component") && ((A.paths.has(j) || A.paths.has("")) && (p = !0), !p))
|
|
325
325
|
for (const _ of C) {
|
|
326
326
|
let M = _;
|
|
327
327
|
for (; ; ) {
|
|
328
328
|
if (A.paths.has(M)) {
|
|
329
|
-
|
|
329
|
+
p = !0;
|
|
330
330
|
break;
|
|
331
331
|
}
|
|
332
332
|
const B = M.lastIndexOf(".");
|
|
@@ -338,7 +338,7 @@ function zt(t, {
|
|
|
338
338
|
if (!isNaN(
|
|
339
339
|
Number(M.substring(B + 1))
|
|
340
340
|
) && A.paths.has(tt)) {
|
|
341
|
-
|
|
341
|
+
p = !0;
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
344
|
M = tt;
|
|
@@ -347,14 +347,14 @@ function zt(t, {
|
|
|
347
347
|
if (M === "")
|
|
348
348
|
break;
|
|
349
349
|
}
|
|
350
|
-
if (
|
|
350
|
+
if (p) break;
|
|
351
351
|
}
|
|
352
|
-
if (!
|
|
352
|
+
if (!p && V.includes("deps") && A.depsFunction) {
|
|
353
353
|
const _ = A.depsFunction(T);
|
|
354
354
|
let M = !1;
|
|
355
|
-
typeof _ == "boolean" ? _ && (M = !0) : H(A.deps, _) || (A.deps = _, M = !0), M && (
|
|
355
|
+
typeof _ == "boolean" ? _ && (M = !0) : H(A.deps, _) || (A.deps = _, M = !0), M && (p = !0);
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
p && A.forceUpdate();
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
360
|
}
|
|
@@ -392,8 +392,8 @@ function zt(t, {
|
|
|
392
392
|
}
|
|
393
393
|
if (Dt(m, (b) => {
|
|
394
394
|
const j = [...b ?? [], L].reduce((D, A) => {
|
|
395
|
-
const
|
|
396
|
-
return V ? (V.timeStamp = Math.max(V.timeStamp, A.timeStamp), V.newValue = A.newValue, V.oldValue = V.oldValue ?? A.oldValue, V.updateType = A.updateType) : D.set(
|
|
395
|
+
const p = `${A.stateKey}:${JSON.stringify(A.path)}`, V = D.get(p);
|
|
396
|
+
return V ? (V.timeStamp = Math.max(V.timeStamp, A.timeStamp), V.newValue = A.newValue, V.oldValue = V.oldValue ?? A.oldValue, V.updateType = A.updateType) : D.set(p, { ...A }), D;
|
|
397
397
|
}, /* @__PURE__ */ new Map());
|
|
398
398
|
return Array.from(j.values());
|
|
399
399
|
}), $t(
|
|
@@ -436,7 +436,7 @@ function zt(t, {
|
|
|
436
436
|
function gt(t, i, h, f) {
|
|
437
437
|
const v = /* @__PURE__ */ new Map();
|
|
438
438
|
let k = 0;
|
|
439
|
-
const
|
|
439
|
+
const w = (y) => {
|
|
440
440
|
const n = y.join(".");
|
|
441
441
|
for (const [S] of v)
|
|
442
442
|
(S === n || S.startsWith(n + ".")) && v.delete(S);
|
|
@@ -625,22 +625,22 @@ function gt(t, i, h, f) {
|
|
|
625
625
|
} = e, g = Y(null), [u, T] = rt({
|
|
626
626
|
startIndex: 0,
|
|
627
627
|
endIndex: 10
|
|
628
|
-
}),
|
|
628
|
+
}), E = Y(c), $ = Y(0), P = Y(!1), x = o().getNestedState(
|
|
629
629
|
t,
|
|
630
630
|
n
|
|
631
631
|
), N = x.length, F = mt(
|
|
632
|
-
(
|
|
632
|
+
(p) => o.getState().getShadowMetadata(t, [...n, p.toString()])?.virtualizer?.itemHeight || r,
|
|
633
633
|
[r, t, n]
|
|
634
634
|
), { totalHeight: L, positions: b } = vt(() => {
|
|
635
|
-
let
|
|
635
|
+
let p = 0;
|
|
636
636
|
const V = [];
|
|
637
637
|
for (let _ = 0; _ < N; _++)
|
|
638
|
-
V[_] =
|
|
639
|
-
return console.log("totalHeight",
|
|
638
|
+
V[_] = p, p += F(_);
|
|
639
|
+
return console.log("totalHeight", p), { totalHeight: p, positions: V };
|
|
640
640
|
}, [N, F]), C = vt(() => {
|
|
641
|
-
const
|
|
642
|
-
{ length: V -
|
|
643
|
-
(B, tt) =>
|
|
641
|
+
const p = Math.max(0, u.startIndex), V = Math.min(N, u.endIndex), _ = Array.from(
|
|
642
|
+
{ length: V - p },
|
|
643
|
+
(B, tt) => p + tt
|
|
644
644
|
), M = _.map((B) => x[B]);
|
|
645
645
|
return a(M, n, {
|
|
646
646
|
...S,
|
|
@@ -648,16 +648,16 @@ function gt(t, i, h, f) {
|
|
|
648
648
|
});
|
|
649
649
|
}, [u.startIndex, u.endIndex, x, N]);
|
|
650
650
|
dt(() => {
|
|
651
|
-
const
|
|
652
|
-
|
|
651
|
+
const p = g.current;
|
|
652
|
+
p && P.current && (P.current = !1, E.current && (p.scrollTop = p.scrollHeight));
|
|
653
653
|
}, [L]), st(() => {
|
|
654
|
-
const
|
|
655
|
-
if (!
|
|
654
|
+
const p = g.current;
|
|
655
|
+
if (!p) return;
|
|
656
656
|
let V = N;
|
|
657
657
|
const _ = () => {
|
|
658
|
-
if (!
|
|
659
|
-
const { scrollTop: M, clientHeight: B, scrollHeight: tt } =
|
|
660
|
-
|
|
658
|
+
if (!p) return;
|
|
659
|
+
const { scrollTop: M, clientHeight: B, scrollHeight: tt } = p;
|
|
660
|
+
E.current = tt - M - B < 10, $.current = M;
|
|
661
661
|
let et = 0;
|
|
662
662
|
for (let q = 0; q < b.length; q++)
|
|
663
663
|
if (b[q] >= M) {
|
|
@@ -669,22 +669,22 @@ function gt(t, i, h, f) {
|
|
|
669
669
|
Q++;
|
|
670
670
|
et = Math.max(0, et - s), Q = Math.min(N, Q + s), T((q) => q.startIndex !== et || q.endIndex !== Q ? { startIndex: et, endIndex: Q } : q);
|
|
671
671
|
};
|
|
672
|
-
return N > V && (P.current = !0), V = N,
|
|
672
|
+
return N > V && (P.current = !0), V = N, p.addEventListener("scroll", _, {
|
|
673
673
|
passive: !0
|
|
674
|
-
}), _(), () =>
|
|
674
|
+
}), _(), () => p.removeEventListener("scroll", _);
|
|
675
675
|
}, [N, s, b]);
|
|
676
676
|
const j = mt(
|
|
677
|
-
(
|
|
677
|
+
(p = "smooth") => {
|
|
678
678
|
g.current && g.current.scrollTo({
|
|
679
679
|
top: g.current.scrollHeight,
|
|
680
|
-
behavior:
|
|
680
|
+
behavior: p
|
|
681
681
|
});
|
|
682
682
|
},
|
|
683
683
|
[]
|
|
684
684
|
), D = mt(
|
|
685
|
-
(
|
|
686
|
-
g.current && b[
|
|
687
|
-
top: b[
|
|
685
|
+
(p, V = "smooth") => {
|
|
686
|
+
g.current && b[p] !== void 0 && g.current.scrollTo({
|
|
687
|
+
top: b[p],
|
|
688
688
|
behavior: V
|
|
689
689
|
});
|
|
690
690
|
},
|
|
@@ -738,8 +738,8 @@ function gt(t, i, h, f) {
|
|
|
738
738
|
return (e) => {
|
|
739
739
|
const r = o.getState().getNestedState(t, n);
|
|
740
740
|
return Array.isArray(r) ? (S?.validIndices || Array.from({ length: r.length }, (c, g) => g)).map((c, g) => {
|
|
741
|
-
const u = r[c], T = [...n, c.toString()],
|
|
742
|
-
return e(u,
|
|
741
|
+
const u = r[c], T = [...n, c.toString()], E = a(u, T, S);
|
|
742
|
+
return e(u, E, {
|
|
743
743
|
register: () => {
|
|
744
744
|
const [, P] = rt({}), x = `${h}-${n.join(".")}-${c}`;
|
|
745
745
|
dt(() => {
|
|
@@ -790,7 +790,7 @@ function gt(t, i, h, f) {
|
|
|
790
790
|
return (e) => {
|
|
791
791
|
const r = o.getState().getNestedState(t, n);
|
|
792
792
|
return Array.isArray(r) ? (S?.validIndices || Array.from({ length: r.length }, (c, g) => g)).map((c, g) => {
|
|
793
|
-
const u = r[c], T = [...n, c.toString()],
|
|
793
|
+
const u = r[c], T = [...n, c.toString()], E = a(u, T, S), $ = `${h}-${n.join(".")}-${c}`;
|
|
794
794
|
return it(Jt, {
|
|
795
795
|
key: c,
|
|
796
796
|
stateKey: t,
|
|
@@ -798,7 +798,7 @@ function gt(t, i, h, f) {
|
|
|
798
798
|
itemPath: T,
|
|
799
799
|
children: e(
|
|
800
800
|
u,
|
|
801
|
-
|
|
801
|
+
E,
|
|
802
802
|
g,
|
|
803
803
|
r,
|
|
804
804
|
a(r, n, S)
|
|
@@ -834,7 +834,7 @@ function gt(t, i, h, f) {
|
|
|
834
834
|
return a(s, c);
|
|
835
835
|
};
|
|
836
836
|
if (l === "insert")
|
|
837
|
-
return (e) => (
|
|
837
|
+
return (e) => (w(n), ht(i, e, n, t), a(
|
|
838
838
|
o.getState().getNestedState(t, n),
|
|
839
839
|
n
|
|
840
840
|
));
|
|
@@ -842,28 +842,28 @@ function gt(t, i, h, f) {
|
|
|
842
842
|
return (e, r, s) => {
|
|
843
843
|
const c = o.getState().getNestedState(t, n), g = Z(e) ? e(c) : e;
|
|
844
844
|
let u = null;
|
|
845
|
-
if (!c.some((
|
|
845
|
+
if (!c.some((E) => {
|
|
846
846
|
if (r) {
|
|
847
847
|
const P = r.every(
|
|
848
|
-
(x) => H(
|
|
848
|
+
(x) => H(E[x], g[x])
|
|
849
849
|
);
|
|
850
|
-
return P && (u =
|
|
850
|
+
return P && (u = E), P;
|
|
851
851
|
}
|
|
852
|
-
const $ = H(
|
|
853
|
-
return $ && (u =
|
|
852
|
+
const $ = H(E, g);
|
|
853
|
+
return $ && (u = E), $;
|
|
854
854
|
}))
|
|
855
|
-
|
|
855
|
+
w(n), ht(i, g, n, t);
|
|
856
856
|
else if (s && u) {
|
|
857
|
-
const
|
|
858
|
-
(P) => H(P, u) ?
|
|
857
|
+
const E = s(u), $ = c.map(
|
|
858
|
+
(P) => H(P, u) ? E : P
|
|
859
859
|
);
|
|
860
|
-
|
|
860
|
+
w(n), at(i, $, n);
|
|
861
861
|
}
|
|
862
862
|
};
|
|
863
863
|
if (l === "cut")
|
|
864
864
|
return (e, r) => {
|
|
865
865
|
if (!r?.waitForSync)
|
|
866
|
-
return
|
|
866
|
+
return w(n), lt(i, n, t, e), a(
|
|
867
867
|
o.getState().getNestedState(t, n),
|
|
868
868
|
n
|
|
869
869
|
);
|
|
@@ -942,7 +942,7 @@ function gt(t, i, h, f) {
|
|
|
942
942
|
const e = n.slice(0, -1), r = Number(n[n.length - 1]), s = e.join(".");
|
|
943
943
|
d ? o.getState().setSelectedIndex(t, s, r) : o.getState().setSelectedIndex(t, s, void 0);
|
|
944
944
|
const c = o.getState().getNestedState(t, [...e]);
|
|
945
|
-
at(i, c, e),
|
|
945
|
+
at(i, c, e), w(e);
|
|
946
946
|
};
|
|
947
947
|
if (l === "toggleSelected")
|
|
948
948
|
return () => {
|
|
@@ -953,7 +953,7 @@ function gt(t, i, h, f) {
|
|
|
953
953
|
s === e ? void 0 : e
|
|
954
954
|
);
|
|
955
955
|
const c = o.getState().getNestedState(t, [...d]);
|
|
956
|
-
at(i, c, d),
|
|
956
|
+
at(i, c, d), w(d);
|
|
957
957
|
};
|
|
958
958
|
if (n.length == 0) {
|
|
959
959
|
if (l === "applyJsonPatch")
|
|
@@ -972,25 +972,25 @@ function gt(t, i, h, f) {
|
|
|
972
972
|
const g = It(e, s), u = new Set(g);
|
|
973
973
|
for (const [
|
|
974
974
|
T,
|
|
975
|
-
|
|
975
|
+
E
|
|
976
976
|
] of c.components.entries()) {
|
|
977
977
|
let $ = !1;
|
|
978
|
-
const P = Array.isArray(
|
|
978
|
+
const P = Array.isArray(E.reactiveType) ? E.reactiveType : [E.reactiveType || "component"];
|
|
979
979
|
if (!P.includes("none")) {
|
|
980
980
|
if (P.includes("all")) {
|
|
981
|
-
|
|
981
|
+
E.forceUpdate();
|
|
982
982
|
continue;
|
|
983
983
|
}
|
|
984
|
-
if (P.includes("component") && (
|
|
984
|
+
if (P.includes("component") && (E.paths.has("") && ($ = !0), !$))
|
|
985
985
|
for (const x of u) {
|
|
986
|
-
if (
|
|
986
|
+
if (E.paths.has(x)) {
|
|
987
987
|
$ = !0;
|
|
988
988
|
break;
|
|
989
989
|
}
|
|
990
990
|
let N = x.lastIndexOf(".");
|
|
991
991
|
for (; N !== -1; ) {
|
|
992
992
|
const F = x.substring(0, N);
|
|
993
|
-
if (
|
|
993
|
+
if (E.paths.has(F)) {
|
|
994
994
|
$ = !0;
|
|
995
995
|
break;
|
|
996
996
|
}
|
|
@@ -1004,7 +1004,7 @@ function gt(t, i, h, f) {
|
|
|
1004
1004
|
0,
|
|
1005
1005
|
b
|
|
1006
1006
|
);
|
|
1007
|
-
if (
|
|
1007
|
+
if (E.paths.has(C)) {
|
|
1008
1008
|
$ = !0;
|
|
1009
1009
|
break;
|
|
1010
1010
|
}
|
|
@@ -1014,12 +1014,12 @@ function gt(t, i, h, f) {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
if ($) break;
|
|
1016
1016
|
}
|
|
1017
|
-
if (!$ && P.includes("deps") &&
|
|
1018
|
-
const x =
|
|
1017
|
+
if (!$ && P.includes("deps") && E.depsFunction) {
|
|
1018
|
+
const x = E.depsFunction(s);
|
|
1019
1019
|
let N = !1;
|
|
1020
|
-
typeof x == "boolean" ? x && (N = !0) : H(
|
|
1020
|
+
typeof x == "boolean" ? x && (N = !0) : H(E.deps, x) || (E.deps = x, N = !0), N && ($ = !0);
|
|
1021
1021
|
}
|
|
1022
|
-
$ &&
|
|
1022
|
+
$ && E.forceUpdate();
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
@@ -1040,8 +1040,8 @@ function gt(t, i, h, f) {
|
|
|
1040
1040
|
});
|
|
1041
1041
|
const c = d.zodSchema.safeParse(r);
|
|
1042
1042
|
return c.success ? !0 : (c.error.errors.forEach((u) => {
|
|
1043
|
-
const T = u.path,
|
|
1044
|
-
e($,
|
|
1043
|
+
const T = u.path, E = u.message, $ = [d.key, ...T].join(".");
|
|
1044
|
+
e($, E);
|
|
1045
1045
|
}), St(t), !1);
|
|
1046
1046
|
} catch (s) {
|
|
1047
1047
|
return console.error("Zod schema validation failed", s), !1;
|
|
@@ -1096,7 +1096,7 @@ function gt(t, i, h, f) {
|
|
|
1096
1096
|
const r = o.getState().getNestedState(t, n);
|
|
1097
1097
|
e?.afterUpdate && e.afterUpdate(r);
|
|
1098
1098
|
}
|
|
1099
|
-
|
|
1099
|
+
w(n);
|
|
1100
1100
|
};
|
|
1101
1101
|
if (l === "formElement")
|
|
1102
1102
|
return (d, e) => /* @__PURE__ */ yt(
|
|
@@ -1134,7 +1134,7 @@ function Bt({
|
|
|
1134
1134
|
h,
|
|
1135
1135
|
t._path
|
|
1136
1136
|
).stateMapNoRender(
|
|
1137
|
-
(v, k,
|
|
1137
|
+
(v, k, w, I, a) => t._mapFn(v, k, w, I, a)
|
|
1138
1138
|
) : null;
|
|
1139
1139
|
}
|
|
1140
1140
|
function qt({
|
|
@@ -1144,13 +1144,13 @@ function qt({
|
|
|
1144
1144
|
return st(() => {
|
|
1145
1145
|
const f = i.current;
|
|
1146
1146
|
if (!f || !f.parentElement) return;
|
|
1147
|
-
const v = f.parentElement,
|
|
1147
|
+
const v = f.parentElement, w = Array.from(v.childNodes).indexOf(f);
|
|
1148
1148
|
let I = v.getAttribute("data-parent-id");
|
|
1149
1149
|
I || (I = `parent-${crypto.randomUUID()}`, v.setAttribute("data-parent-id", I));
|
|
1150
1150
|
const y = {
|
|
1151
1151
|
instanceId: `instance-${crypto.randomUUID()}`,
|
|
1152
1152
|
parentId: I,
|
|
1153
|
-
position:
|
|
1153
|
+
position: w,
|
|
1154
1154
|
effect: t._effect
|
|
1155
1155
|
};
|
|
1156
1156
|
o.getState().addSignalElement(h, y);
|
|
@@ -1197,14 +1197,14 @@ function Jt({
|
|
|
1197
1197
|
itemPath: h,
|
|
1198
1198
|
children: f
|
|
1199
1199
|
}) {
|
|
1200
|
-
const [, v] = rt({}), [k,
|
|
1200
|
+
const [, v] = rt({}), [k, w] = Ut();
|
|
1201
1201
|
return st(() => {
|
|
1202
|
-
|
|
1202
|
+
w.height > 0 && o.getState().setShadowMetadata(t, h, {
|
|
1203
1203
|
virtualizer: {
|
|
1204
|
-
itemHeight:
|
|
1204
|
+
itemHeight: w.height
|
|
1205
1205
|
}
|
|
1206
1206
|
});
|
|
1207
|
-
}, [
|
|
1207
|
+
}, [w.height]), dt(() => {
|
|
1208
1208
|
const I = `${t}////${i}`, a = o.getState().stateComponents.get(t) || {
|
|
1209
1209
|
components: /* @__PURE__ */ new Map()
|
|
1210
1210
|
};
|