cogsbox-state 0.5.365 → 0.5.366
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 +77 -79
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +11 -6
package/dist/CogsState.jsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as ve } from "react/jsx-runtime";
|
|
3
|
-
import { useState as Z, useRef as Q, useEffect as
|
|
4
|
-
import { transformStateFunc as
|
|
3
|
+
import { useState as Z, useRef as Q, useEffect as oe, useLayoutEffect as ie, useMemo as ye, createElement as ce, useSyncExternalStore as xe, startTransition as Pe, useCallback as Ee } from "react";
|
|
4
|
+
import { transformStateFunc as Ge, isDeepEqual as Y, isFunction as X, getNestedValue as z, getDifferences as Ae, debounce as Ue } from "./utility.js";
|
|
5
5
|
import { pushFunc as Te, updateFn as se, cutFunc as ge, ValidationWrapper as je, FormControlComponent as Fe } from "./Functions.jsx";
|
|
6
6
|
import De from "superjson";
|
|
7
7
|
import { v4 as pe } from "uuid";
|
|
@@ -9,7 +9,7 @@ import "zod";
|
|
|
9
9
|
import { getGlobalStore as r, formRefStore as Oe } from "./store.js";
|
|
10
10
|
import { useCogsConfig as Me } from "./CogsStateClient.jsx";
|
|
11
11
|
import { applyPatch as He } from "fast-json-patch";
|
|
12
|
-
import
|
|
12
|
+
import Le from "react-use-measure";
|
|
13
13
|
function Ne(e, i) {
|
|
14
14
|
const m = r.getState().getInitialOptions, g = r.getState().setInitialStateOptions, T = m(e) || {};
|
|
15
15
|
g(e, {
|
|
@@ -22,7 +22,7 @@ function Ce({
|
|
|
22
22
|
options: i,
|
|
23
23
|
initialOptionsPart: m
|
|
24
24
|
}) {
|
|
25
|
-
const g =
|
|
25
|
+
const g = re(e) || {}, T = m[e] || {}, N = r.getState().setInitialStateOptions, A = { ...T, ...g };
|
|
26
26
|
let v = !1;
|
|
27
27
|
if (i)
|
|
28
28
|
for (const a in i)
|
|
@@ -35,7 +35,7 @@ function ut(e, { formElements: i, validation: m }) {
|
|
|
35
35
|
}
|
|
36
36
|
const gt = (e, i) => {
|
|
37
37
|
let m = e;
|
|
38
|
-
const [g, T] =
|
|
38
|
+
const [g, T] = Ge(m);
|
|
39
39
|
(Object.keys(T).length > 0 || i && Object.keys(i).length > 0) && Object.keys(T).forEach((v) => {
|
|
40
40
|
T[v] = T[v] || {}, T[v].formElements = {
|
|
41
41
|
...i?.formElements,
|
|
@@ -43,7 +43,7 @@ const gt = (e, i) => {
|
|
|
43
43
|
...i?.validation,
|
|
44
44
|
...T[v].formElements || {}
|
|
45
45
|
// State-specific overrides
|
|
46
|
-
},
|
|
46
|
+
}, re(v) || r.getState().setInitialStateOptions(v, T[v]);
|
|
47
47
|
}), r.getState().setInitialStates(g), r.getState().setCreatedState(g);
|
|
48
48
|
const N = (v, a) => {
|
|
49
49
|
const [h] = Z(a?.componentId ?? pe());
|
|
@@ -52,7 +52,7 @@ const gt = (e, i) => {
|
|
|
52
52
|
options: a,
|
|
53
53
|
initialOptionsPart: T
|
|
54
54
|
});
|
|
55
|
-
const n = r.getState().cogsStateStore[v] || g[v], S = a?.modifyState ? a.modifyState(n) : n, [
|
|
55
|
+
const n = r.getState().cogsStateStore[v] || g[v], S = a?.modifyState ? a.modifyState(n) : n, [L, G] = Ze(
|
|
56
56
|
S,
|
|
57
57
|
{
|
|
58
58
|
stateKey: v,
|
|
@@ -68,7 +68,7 @@ const gt = (e, i) => {
|
|
|
68
68
|
serverState: a?.serverState
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
|
-
return
|
|
71
|
+
return G;
|
|
72
72
|
};
|
|
73
73
|
function A(v, a) {
|
|
74
74
|
Ce({ stateKey: v, options: a, initialOptionsPart: T }), a.localStorage && qe(v, a), Ie(v);
|
|
@@ -77,9 +77,9 @@ const gt = (e, i) => {
|
|
|
77
77
|
}, {
|
|
78
78
|
setUpdaterState: fe,
|
|
79
79
|
setState: te,
|
|
80
|
-
getInitialOptions:
|
|
80
|
+
getInitialOptions: re,
|
|
81
81
|
getKeyState: Re,
|
|
82
|
-
getValidationErrors:
|
|
82
|
+
getValidationErrors: We,
|
|
83
83
|
setStateLog: Be,
|
|
84
84
|
updateInitialStateGlobal: _e,
|
|
85
85
|
addValidationError: Ye,
|
|
@@ -193,12 +193,12 @@ function Ze(e, {
|
|
|
193
193
|
dependencies: n,
|
|
194
194
|
serverState: S
|
|
195
195
|
} = {}) {
|
|
196
|
-
const [
|
|
196
|
+
const [L, G] = Z({}), { sessionId: U } = Me();
|
|
197
197
|
let W = !i;
|
|
198
198
|
const [I] = Z(i ?? pe()), l = r.getState().stateLog[I], le = Q(/* @__PURE__ */ new Set()), K = Q(v ?? pe()), V = Q(
|
|
199
199
|
null
|
|
200
200
|
);
|
|
201
|
-
V.current =
|
|
201
|
+
V.current = re(I) ?? null, oe(() => {
|
|
202
202
|
if (h && h.stateKey === I && h.path?.[0]) {
|
|
203
203
|
te(I, (o) => ({
|
|
204
204
|
...o,
|
|
@@ -210,7 +210,7 @@ function Ze(e, {
|
|
|
210
210
|
userId: h.userId
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
}, [h]),
|
|
213
|
+
}, [h]), oe(() => {
|
|
214
214
|
if (a) {
|
|
215
215
|
Ne(I, {
|
|
216
216
|
initialState: a
|
|
@@ -227,10 +227,10 @@ function Ze(e, {
|
|
|
227
227
|
I,
|
|
228
228
|
a,
|
|
229
229
|
_,
|
|
230
|
-
|
|
230
|
+
ae,
|
|
231
231
|
K.current,
|
|
232
232
|
U
|
|
233
|
-
), w && p && U && $e(_, I, t, U, Date.now()), Ie(I), (Array.isArray(A) ? A : [A || "component"]).includes("none") ||
|
|
233
|
+
), w && p && U && $e(_, I, t, U, Date.now()), Ie(I), (Array.isArray(A) ? A : [A || "component"]).includes("none") || G({});
|
|
234
234
|
}
|
|
235
235
|
}, [
|
|
236
236
|
a,
|
|
@@ -249,16 +249,16 @@ function Ze(e, {
|
|
|
249
249
|
components: /* @__PURE__ */ new Map()
|
|
250
250
|
};
|
|
251
251
|
return o.components.set(t, {
|
|
252
|
-
forceUpdate: () =>
|
|
252
|
+
forceUpdate: () => G({}),
|
|
253
253
|
paths: /* @__PURE__ */ new Set(),
|
|
254
254
|
deps: [],
|
|
255
255
|
depsFunction: N || void 0,
|
|
256
256
|
reactiveType: A ?? ["component", "deps"]
|
|
257
|
-
}), r.getState().stateComponents.set(I, o),
|
|
257
|
+
}), r.getState().stateComponents.set(I, o), G({}), () => {
|
|
258
258
|
o && (o.components.delete(t), o.components.size === 0 && r.getState().stateComponents.delete(I));
|
|
259
259
|
};
|
|
260
260
|
}, []);
|
|
261
|
-
const
|
|
261
|
+
const ae = (t, o, s, c) => {
|
|
262
262
|
if (Array.isArray(o)) {
|
|
263
263
|
const u = `${I}-${o.join(".")}`;
|
|
264
264
|
le.current.add(u);
|
|
@@ -279,11 +279,11 @@ function Ze(e, {
|
|
|
279
279
|
if (y) {
|
|
280
280
|
const x = M ? z(p, o.slice(0, -1)) : z(p, o);
|
|
281
281
|
y.forEach(({ parentId: R, position: O, effect: j }) => {
|
|
282
|
-
const
|
|
282
|
+
const P = document.querySelector(
|
|
283
283
|
`[data-parent-id="${R}"]`
|
|
284
284
|
);
|
|
285
|
-
if (
|
|
286
|
-
const B = Array.from(
|
|
285
|
+
if (P) {
|
|
286
|
+
const B = Array.from(P.childNodes);
|
|
287
287
|
if (B[O]) {
|
|
288
288
|
const E = j ? new Function("state", `return (${j})(state)`)(x) : x;
|
|
289
289
|
B[O].textContent = String(E);
|
|
@@ -298,7 +298,7 @@ function Ze(e, {
|
|
|
298
298
|
const w = o.slice(0, o.length - 1);
|
|
299
299
|
s.updateType === "cut" && V.current?.validation?.key && J(
|
|
300
300
|
V.current?.validation?.key + "." + w.join(".")
|
|
301
|
-
), s.updateType === "insert" && V.current?.validation?.key &&
|
|
301
|
+
), s.updateType === "insert" && V.current?.validation?.key && We(
|
|
302
302
|
V.current?.validation?.key + "." + w.join(".")
|
|
303
303
|
).filter(([y, x]) => {
|
|
304
304
|
let R = y?.split(".").length;
|
|
@@ -315,13 +315,13 @@ function Ze(e, {
|
|
|
315
315
|
O
|
|
316
316
|
] of C.components.entries()) {
|
|
317
317
|
let j = !1;
|
|
318
|
-
const
|
|
319
|
-
if (console.log("component", O), !
|
|
320
|
-
if (
|
|
318
|
+
const P = Array.isArray(O.reactiveType) ? O.reactiveType : [O.reactiveType || "component"];
|
|
319
|
+
if (console.log("component", O), !P.includes("none")) {
|
|
320
|
+
if (P.includes("all")) {
|
|
321
321
|
O.forceUpdate();
|
|
322
322
|
continue;
|
|
323
323
|
}
|
|
324
|
-
if (
|
|
324
|
+
if (P.includes("component") && ((O.paths.has(x) || O.paths.has("")) && (j = !0), !j))
|
|
325
325
|
for (const B of y) {
|
|
326
326
|
let E = B;
|
|
327
327
|
for (; ; ) {
|
|
@@ -331,17 +331,17 @@ function Ze(e, {
|
|
|
331
331
|
}
|
|
332
332
|
const b = E.lastIndexOf(".");
|
|
333
333
|
if (b !== -1) {
|
|
334
|
-
const
|
|
334
|
+
const H = E.substring(
|
|
335
335
|
0,
|
|
336
336
|
b
|
|
337
337
|
);
|
|
338
338
|
if (!isNaN(
|
|
339
339
|
Number(E.substring(b + 1))
|
|
340
|
-
) && O.paths.has(
|
|
340
|
+
) && O.paths.has(H)) {
|
|
341
341
|
j = !0;
|
|
342
342
|
break;
|
|
343
343
|
}
|
|
344
|
-
E =
|
|
344
|
+
E = H;
|
|
345
345
|
} else
|
|
346
346
|
E = "";
|
|
347
347
|
if (E === "")
|
|
@@ -349,7 +349,7 @@ function Ze(e, {
|
|
|
349
349
|
}
|
|
350
350
|
if (j) break;
|
|
351
351
|
}
|
|
352
|
-
if (!j &&
|
|
352
|
+
if (!j && P.includes("deps") && O.depsFunction) {
|
|
353
353
|
const B = O.depsFunction(p);
|
|
354
354
|
let E = !1;
|
|
355
355
|
typeof B == "boolean" ? B && (E = !0) : Y(O.deps, B) || (O.deps = B, E = !0), E && (j = !0);
|
|
@@ -392,8 +392,8 @@ function Ze(e, {
|
|
|
392
392
|
}
|
|
393
393
|
if (Be(I, (M) => {
|
|
394
394
|
const x = [...M ?? [], q].reduce((R, O) => {
|
|
395
|
-
const j = `${O.stateKey}:${JSON.stringify(O.path)}`,
|
|
396
|
-
return
|
|
395
|
+
const j = `${O.stateKey}:${JSON.stringify(O.path)}`, P = R.get(j);
|
|
396
|
+
return P ? (P.timeStamp = Math.max(P.timeStamp, O.timeStamp), P.newValue = O.newValue, P.oldValue = P.oldValue ?? O.oldValue, P.updateType = O.updateType) : R.set(j, { ...O }), R;
|
|
397
397
|
}, /* @__PURE__ */ new Map());
|
|
398
398
|
return Array.from(x.values());
|
|
399
399
|
}), $e(
|
|
@@ -420,14 +420,14 @@ function Ze(e, {
|
|
|
420
420
|
I,
|
|
421
421
|
Se(
|
|
422
422
|
I,
|
|
423
|
-
|
|
423
|
+
ae,
|
|
424
424
|
K.current,
|
|
425
425
|
U
|
|
426
426
|
)
|
|
427
427
|
), r.getState().cogsStateStore[I] || te(I, e), r.getState().initialStateGlobal[I] || _e(I, e));
|
|
428
428
|
const d = ye(() => Se(
|
|
429
429
|
I,
|
|
430
|
-
|
|
430
|
+
ae,
|
|
431
431
|
K.current,
|
|
432
432
|
U
|
|
433
433
|
), [I, U]);
|
|
@@ -450,8 +450,8 @@ function Se(e, i, m, g) {
|
|
|
450
450
|
n?.key && J(n?.key), h?.validationKey && J(h.validationKey);
|
|
451
451
|
const S = r.getState().initialStateGlobal[e];
|
|
452
452
|
r.getState().clearSelectedIndexesForState(e), T.clear(), N++;
|
|
453
|
-
const
|
|
454
|
-
W && localStorage.removeItem(W), fe(e,
|
|
453
|
+
const L = a(S, []), G = re(e), U = X(G?.localStorage?.key) ? G?.localStorage?.key(S) : G?.localStorage?.key, W = `${g}-${e}-${U}`;
|
|
454
|
+
W && localStorage.removeItem(W), fe(e, L), te(e, S);
|
|
455
455
|
const I = r.getState().stateComponents.get(e);
|
|
456
456
|
return I && I.components.forEach((l) => {
|
|
457
457
|
l.forceUpdate();
|
|
@@ -464,8 +464,8 @@ function Se(e, i, m, g) {
|
|
|
464
464
|
i,
|
|
465
465
|
m,
|
|
466
466
|
g
|
|
467
|
-
), S = r.getState().initialStateGlobal[e],
|
|
468
|
-
return localStorage.getItem(U) && localStorage.removeItem(U),
|
|
467
|
+
), S = r.getState().initialStateGlobal[e], L = re(e), G = X(L?.localStorage?.key) ? L?.localStorage?.key(S) : L?.localStorage?.key, U = `${g}-${e}-${G}`;
|
|
468
|
+
return localStorage.getItem(U) && localStorage.removeItem(U), Pe(() => {
|
|
469
469
|
_e(e, h), r.getState().initializeShadowState(e, h), fe(e, n), te(e, h);
|
|
470
470
|
const W = r.getState().stateComponents.get(e);
|
|
471
471
|
W && W.components.forEach((I) => {
|
|
@@ -484,13 +484,13 @@ function Se(e, i, m, g) {
|
|
|
484
484
|
}
|
|
485
485
|
};
|
|
486
486
|
function a(h, n = [], S) {
|
|
487
|
-
const
|
|
488
|
-
T.get(
|
|
489
|
-
const
|
|
487
|
+
const L = n.map(String).join(".");
|
|
488
|
+
T.get(L);
|
|
489
|
+
const G = function() {
|
|
490
490
|
return r().getNestedState(e, n);
|
|
491
491
|
};
|
|
492
492
|
Object.keys(v).forEach((I) => {
|
|
493
|
-
|
|
493
|
+
G[I] = v[I];
|
|
494
494
|
});
|
|
495
495
|
const U = {
|
|
496
496
|
apply(I, l, le) {
|
|
@@ -581,7 +581,7 @@ function Se(e, i, m, g) {
|
|
|
581
581
|
};
|
|
582
582
|
if (l === "removeStorage")
|
|
583
583
|
return () => {
|
|
584
|
-
const d = r.getState().initialStateGlobal[e], t =
|
|
584
|
+
const d = r.getState().initialStateGlobal[e], t = re(e), o = X(t?.localStorage?.key) ? t?.localStorage?.key(d) : t?.localStorage?.key, s = `${g}-${e}-${o}`;
|
|
585
585
|
s && localStorage.removeItem(s);
|
|
586
586
|
};
|
|
587
587
|
if (l === "showValidationErrors")
|
|
@@ -626,7 +626,7 @@ function Se(e, i, m, g) {
|
|
|
626
626
|
startIndex: 0,
|
|
627
627
|
endIndex: 10
|
|
628
628
|
}), [w, C] = Z("WAITING_FOR_ARRAY"), $ = Q(0), k = Q(f), [D, q] = Z(0);
|
|
629
|
-
|
|
629
|
+
oe(() => r.getState().subscribeToShadowState(e, () => {
|
|
630
630
|
q((b) => b + 1);
|
|
631
631
|
}), [e]);
|
|
632
632
|
const M = r().getNestedState(
|
|
@@ -635,13 +635,13 @@ function Se(e, i, m, g) {
|
|
|
635
635
|
), y = M.length, { totalHeight: x, positions: R } = ye(() => {
|
|
636
636
|
const E = r.getState().getShadowMetadata(e, n) || [];
|
|
637
637
|
let b = 0;
|
|
638
|
-
const
|
|
639
|
-
for (let
|
|
640
|
-
F
|
|
641
|
-
const ee = E[
|
|
638
|
+
const H = [];
|
|
639
|
+
for (let F = 0; F < y; F++) {
|
|
640
|
+
H[F] = b;
|
|
641
|
+
const ee = E[F]?.virtualizer?.itemHeight;
|
|
642
642
|
b += ee || o;
|
|
643
643
|
}
|
|
644
|
-
return { totalHeight: b, positions:
|
|
644
|
+
return { totalHeight: b, positions: H };
|
|
645
645
|
}, [
|
|
646
646
|
y,
|
|
647
647
|
e,
|
|
@@ -649,13 +649,13 @@ function Se(e, i, m, g) {
|
|
|
649
649
|
o,
|
|
650
650
|
D
|
|
651
651
|
]), O = ye(() => {
|
|
652
|
-
const E = Math.max(0, p.startIndex), b = Math.min(y, p.endIndex),
|
|
652
|
+
const E = Math.max(0, p.startIndex), b = Math.min(y, p.endIndex), H = Array.from(
|
|
653
653
|
{ length: b - E },
|
|
654
|
-
(ee,
|
|
655
|
-
),
|
|
656
|
-
return a(
|
|
654
|
+
(ee, ne) => E + ne
|
|
655
|
+
), F = H.map((ee) => M[ee]);
|
|
656
|
+
return a(F, n, {
|
|
657
657
|
...S,
|
|
658
|
-
validIndices:
|
|
658
|
+
validIndices: H
|
|
659
659
|
});
|
|
660
660
|
}, [p.startIndex, p.endIndex, M, y]);
|
|
661
661
|
ie(() => {
|
|
@@ -675,7 +675,7 @@ function Se(e, i, m, g) {
|
|
|
675
675
|
}, [y, ...f]), ie(() => {
|
|
676
676
|
const E = u.current;
|
|
677
677
|
if (!E) return;
|
|
678
|
-
let b;
|
|
678
|
+
let b, H;
|
|
679
679
|
if (w === "WAITING_FOR_ARRAY" && y > 0 && c)
|
|
680
680
|
console.log(
|
|
681
681
|
"ACTION: WAITING_FOR_ARRAY -> GETTING_ARRAY_HEIGHTS"
|
|
@@ -698,8 +698,7 @@ function Se(e, i, m, g) {
|
|
|
698
698
|
E.scrollTo({
|
|
699
699
|
top: E.scrollHeight,
|
|
700
700
|
behavior: F
|
|
701
|
-
})
|
|
702
|
-
const L = setTimeout(
|
|
701
|
+
}), H = setTimeout(
|
|
703
702
|
() => {
|
|
704
703
|
console.log(
|
|
705
704
|
"ACTION: Scroll finished. -> LOCKED_AT_BOTTOM"
|
|
@@ -707,27 +706,26 @@ function Se(e, i, m, g) {
|
|
|
707
706
|
},
|
|
708
707
|
F === "smooth" ? 500 : 50
|
|
709
708
|
);
|
|
710
|
-
return () => clearTimeout(L);
|
|
711
709
|
}
|
|
712
710
|
return () => {
|
|
713
|
-
b && clearInterval(b);
|
|
711
|
+
b && (console.log("CLEANUP: Clearing measurement loop timer."), clearInterval(b)), H && (console.log("CLEANUP: Clearing scroll-end timer."), clearTimeout(H));
|
|
714
712
|
};
|
|
715
|
-
}, [w, y, R]),
|
|
713
|
+
}, [w, y, R]), oe(() => {
|
|
716
714
|
const E = u.current;
|
|
717
715
|
if (!E) return;
|
|
718
716
|
const b = () => {
|
|
719
717
|
!(E.scrollHeight - E.scrollTop - E.clientHeight < 1) && (w === "LOCKED_AT_BOTTOM" || w === "MOVING_TO_BOTTOM") && (console.log(
|
|
720
718
|
"USER_ACTION: Scrolled up. -> IDLE_NOT_AT_BOTTOM"
|
|
721
719
|
), C("IDLE_NOT_AT_BOTTOM"));
|
|
722
|
-
const { scrollTop:
|
|
723
|
-
let
|
|
724
|
-
for (;
|
|
725
|
-
const he = Math.floor((
|
|
726
|
-
R[he] <
|
|
720
|
+
const { scrollTop: F, clientHeight: ee } = E;
|
|
721
|
+
let ne = 0, de = y - 1;
|
|
722
|
+
for (; ne <= de; ) {
|
|
723
|
+
const he = Math.floor((ne + de) / 2);
|
|
724
|
+
R[he] < F ? ne = he + 1 : de = he - 1;
|
|
727
725
|
}
|
|
728
726
|
const we = Math.max(0, de - s);
|
|
729
727
|
let ue = we;
|
|
730
|
-
const Ve =
|
|
728
|
+
const Ve = F + ee;
|
|
731
729
|
for (; ue < y && R[ue] < Ve; )
|
|
732
730
|
ue++;
|
|
733
731
|
_({
|
|
@@ -746,7 +744,7 @@ function Se(e, i, m, g) {
|
|
|
746
744
|
), C("MOVING_TO_BOTTOM");
|
|
747
745
|
},
|
|
748
746
|
[]
|
|
749
|
-
),
|
|
747
|
+
), P = Ee(
|
|
750
748
|
(E, b = "smooth") => {
|
|
751
749
|
},
|
|
752
750
|
[R]
|
|
@@ -771,7 +769,7 @@ function Se(e, i, m, g) {
|
|
|
771
769
|
virtualState: O,
|
|
772
770
|
virtualizerProps: B,
|
|
773
771
|
scrollToBottom: j,
|
|
774
|
-
scrollToIndex:
|
|
772
|
+
scrollToIndex: P
|
|
775
773
|
};
|
|
776
774
|
};
|
|
777
775
|
if (l === "stateSort")
|
|
@@ -1173,11 +1171,11 @@ function Se(e, i, m, g) {
|
|
|
1173
1171
|
formOpts: t
|
|
1174
1172
|
}
|
|
1175
1173
|
);
|
|
1176
|
-
const V = [...n, l],
|
|
1177
|
-
return a(
|
|
1174
|
+
const V = [...n, l], ae = r.getState().getNestedState(e, V);
|
|
1175
|
+
return a(ae, V, S);
|
|
1178
1176
|
}
|
|
1179
|
-
}, W = new Proxy(
|
|
1180
|
-
return T.set(
|
|
1177
|
+
}, W = new Proxy(G, U);
|
|
1178
|
+
return T.set(L, {
|
|
1181
1179
|
proxy: W,
|
|
1182
1180
|
stateVersion: N
|
|
1183
1181
|
}), W;
|
|
@@ -1205,7 +1203,7 @@ function Qe({
|
|
|
1205
1203
|
proxy: e
|
|
1206
1204
|
}) {
|
|
1207
1205
|
const i = Q(null), m = `${e._stateKey}-${e._path.join(".")}`;
|
|
1208
|
-
return
|
|
1206
|
+
return oe(() => {
|
|
1209
1207
|
const g = i.current;
|
|
1210
1208
|
if (!g || !g.parentElement) return;
|
|
1211
1209
|
const T = g.parentElement, A = Array.from(T.childNodes).indexOf(g);
|
|
@@ -1226,14 +1224,14 @@ function Qe({
|
|
|
1226
1224
|
"state",
|
|
1227
1225
|
`return (${e._effect})(state)`
|
|
1228
1226
|
)(n);
|
|
1229
|
-
} catch (
|
|
1230
|
-
console.error("Error evaluating effect function during mount:",
|
|
1227
|
+
} catch (G) {
|
|
1228
|
+
console.error("Error evaluating effect function during mount:", G), S = n;
|
|
1231
1229
|
}
|
|
1232
1230
|
else
|
|
1233
1231
|
S = n;
|
|
1234
1232
|
S !== null && typeof S == "object" && (S = JSON.stringify(S));
|
|
1235
|
-
const
|
|
1236
|
-
g.replaceWith(
|
|
1233
|
+
const L = document.createTextNode(String(S));
|
|
1234
|
+
g.replaceWith(L);
|
|
1237
1235
|
}, [e._stateKey, e._path.join("."), e._effect]), ce("span", {
|
|
1238
1236
|
ref: i,
|
|
1239
1237
|
style: { display: "none" },
|
|
@@ -1261,8 +1259,8 @@ function Ke({
|
|
|
1261
1259
|
itemPath: m,
|
|
1262
1260
|
children: g
|
|
1263
1261
|
}) {
|
|
1264
|
-
const [, T] = Z({}), [N, A] =
|
|
1265
|
-
return
|
|
1262
|
+
const [, T] = Z({}), [N, A] = Le(), v = Q(null);
|
|
1263
|
+
return oe(() => {
|
|
1266
1264
|
A.height > 0 && A.height !== v.current && (v.current = A.height, r.getState().setShadowMetadata(e, m, {
|
|
1267
1265
|
virtualizer: {
|
|
1268
1266
|
itemHeight: A.height
|