cogsbox-state 0.5.436 → 0.5.437
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.d.ts +7 -0
- package/dist/CogsState.d.ts.map +1 -0
- package/dist/CogsState.jsx +524 -509
- package/dist/CogsState.jsx.map +1 -1
- package/dist/CogsStateClient.d.ts +1 -0
- package/dist/CogsStateClient.d.ts.map +1 -0
- package/dist/Functions.d.ts +1 -0
- package/dist/Functions.d.ts.map +1 -0
- package/dist/TRPCValidationLink.d.ts +1 -0
- package/dist/TRPCValidationLink.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -20
- package/dist/index.js.map +1 -1
- package/dist/store.d.ts +1 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/utility.d.ts +1 -0
- package/dist/utility.d.ts.map +1 -0
- package/package.json +2 -3
- package/src/CogsState.tsx +83 -3
- package/src/index.ts +5 -4
package/dist/CogsState.jsx
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as ot, Fragment as Ut } from "react/jsx-runtime";
|
|
3
|
-
import { memo as Ot, useState as K, useRef as q, useCallback as ct, useEffect as Z, useLayoutEffect as dt, useMemo as
|
|
3
|
+
import { memo as Ot, useState as K, useRef as q, useCallback as ct, useEffect as Z, useLayoutEffect as dt, useMemo as St, createElement as lt, startTransition as Rt } from "react";
|
|
4
4
|
import { createRoot as At } from "react-dom/client";
|
|
5
|
-
import { transformStateFunc as
|
|
5
|
+
import { transformStateFunc as Nt, isFunction as at, isArray as Tt, getDifferences as Ct, isDeepEqual as st } from "./utility.js";
|
|
6
6
|
import { ValidationWrapper as kt } from "./Functions.jsx";
|
|
7
7
|
import Ft from "superjson";
|
|
8
8
|
import { v4 as rt } from "uuid";
|
|
9
9
|
import { getGlobalStore as e, formRefStore as vt } from "./store.js";
|
|
10
10
|
import { useCogsConfig as Pt } from "./CogsStateClient.jsx";
|
|
11
|
-
import { useInView as
|
|
12
|
-
function
|
|
13
|
-
const
|
|
11
|
+
import { useInView as jt } from "react-intersection-observer";
|
|
12
|
+
function yt(t, n) {
|
|
13
|
+
const g = e.getState().getInitialOptions, S = e.getState().setInitialStateOptions, y = g(t) || {};
|
|
14
14
|
S(t, {
|
|
15
15
|
...y,
|
|
16
|
-
...
|
|
16
|
+
...n
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Et({
|
|
20
20
|
stateKey: t,
|
|
21
|
-
options:
|
|
22
|
-
initialOptionsPart:
|
|
21
|
+
options: n,
|
|
22
|
+
initialOptionsPart: g
|
|
23
23
|
}) {
|
|
24
|
-
const S = nt(t) || {}, y =
|
|
24
|
+
const S = nt(t) || {}, y = g[t] || {}, I = e.getState().setInitialStateOptions, E = { ...y, ...S };
|
|
25
25
|
let u = !1;
|
|
26
|
-
if (
|
|
27
|
-
for (const f in
|
|
28
|
-
|
|
29
|
-
u && I(t,
|
|
26
|
+
if (n)
|
|
27
|
+
for (const f in n)
|
|
28
|
+
E.hasOwnProperty(f) ? (f == "localStorage" && n[f] && E[f].key !== n[f]?.key && (u = !0, E[f] = n[f]), f == "defaultState" && n[f] && E[f] !== n[f] && !st(E[f], n[f]) && (u = !0, E[f] = n[f])) : (u = !0, E[f] = n[f]);
|
|
29
|
+
u && I(t, E);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return { initialState: t, formElements:
|
|
31
|
+
function ie(t, { formElements: n, validation: g }) {
|
|
32
|
+
return { initialState: t, formElements: n, validation: g };
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
let
|
|
36
|
-
const [S, y] =
|
|
37
|
-
Object.keys(S).forEach((u) => {
|
|
34
|
+
const Lt = (t, n) => {
|
|
35
|
+
let g = t;
|
|
36
|
+
const [S, y] = Nt(g);
|
|
37
|
+
n?.__fromSyncSchema && n?.__syncNotifications && e.getState().setInitialStateOptions("__notifications", n.__syncNotifications), Object.keys(S).forEach((u) => {
|
|
38
38
|
let f = y[u] || {};
|
|
39
39
|
const A = {
|
|
40
40
|
...f
|
|
41
41
|
};
|
|
42
|
-
if (
|
|
43
|
-
...
|
|
42
|
+
if (n?.formElements && (A.formElements = {
|
|
43
|
+
...n.formElements,
|
|
44
44
|
...f.formElements || {}
|
|
45
|
-
}),
|
|
46
|
-
...
|
|
45
|
+
}), n?.validation && (A.validation = {
|
|
46
|
+
...n.validation,
|
|
47
47
|
...f.validation || {}
|
|
48
|
-
},
|
|
48
|
+
}, n.validation.key && !f.validation?.key && (A.validation.key = `${n.validation.key}.${u}`)), Object.keys(A).length > 0) {
|
|
49
49
|
const w = nt(u);
|
|
50
50
|
w ? e.getState().setInitialStateOptions(u, {
|
|
51
51
|
...w,
|
|
@@ -57,13 +57,13 @@ const ie = (t, o) => {
|
|
|
57
57
|
});
|
|
58
58
|
const I = (u, f) => {
|
|
59
59
|
const [A] = K(f?.componentId ?? rt());
|
|
60
|
-
|
|
60
|
+
Et({
|
|
61
61
|
stateKey: u,
|
|
62
62
|
options: f,
|
|
63
63
|
initialOptionsPart: y
|
|
64
64
|
});
|
|
65
65
|
const w = e.getState().getShadowValue(u) || S[u], i = f?.modifyState ? f.modifyState(w) : w;
|
|
66
|
-
return
|
|
66
|
+
return zt(i, {
|
|
67
67
|
stateKey: u,
|
|
68
68
|
syncUpdate: f?.syncUpdate,
|
|
69
69
|
componentId: A,
|
|
@@ -76,33 +76,45 @@ const ie = (t, o) => {
|
|
|
76
76
|
serverState: f?.serverState
|
|
77
77
|
});
|
|
78
78
|
};
|
|
79
|
-
function
|
|
80
|
-
|
|
79
|
+
function E(u, f) {
|
|
80
|
+
Et({ stateKey: u, options: f, initialOptionsPart: y }), f.localStorage && xt(u, f), it(u);
|
|
81
81
|
}
|
|
82
|
-
return { useCogsState: I, setCogsOptions:
|
|
83
|
-
}
|
|
82
|
+
return { useCogsState: I, setCogsOptions: E };
|
|
83
|
+
};
|
|
84
|
+
function ce(t) {
|
|
85
|
+
const n = {};
|
|
86
|
+
for (const g in t.schemas) {
|
|
87
|
+
const S = t.schemas[g];
|
|
88
|
+
S.rawSchema ? n[g] = S.rawSchema : S.schemas?.defaults ? n[g] = S.schemas.defaults : n[g] = {};
|
|
89
|
+
}
|
|
90
|
+
return Lt(n, {
|
|
91
|
+
__fromSyncSchema: !0,
|
|
92
|
+
__syncNotifications: t.notifications
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const {
|
|
84
96
|
getInitialOptions: nt,
|
|
85
|
-
getValidationErrors:
|
|
86
|
-
setStateLog:
|
|
87
|
-
updateInitialStateGlobal:
|
|
88
|
-
addValidationError:
|
|
97
|
+
getValidationErrors: le,
|
|
98
|
+
setStateLog: Wt,
|
|
99
|
+
updateInitialStateGlobal: _t,
|
|
100
|
+
addValidationError: pt,
|
|
89
101
|
removeValidationError: ut
|
|
90
|
-
} = e.getState(),
|
|
91
|
-
|
|
102
|
+
} = e.getState(), Ht = (t, n, g, S, y) => {
|
|
103
|
+
g?.log && console.log(
|
|
92
104
|
"saving to localstorage",
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
n,
|
|
106
|
+
g.localStorage?.key,
|
|
95
107
|
S
|
|
96
108
|
);
|
|
97
|
-
const I = at(
|
|
109
|
+
const I = at(g?.localStorage?.key) ? g.localStorage?.key(t) : g?.localStorage?.key;
|
|
98
110
|
if (I && S) {
|
|
99
|
-
const
|
|
111
|
+
const E = `${S}-${n}-${I}`;
|
|
100
112
|
let u;
|
|
101
113
|
try {
|
|
102
|
-
u = gt(
|
|
114
|
+
u = gt(E)?.lastSyncedWithServer;
|
|
103
115
|
} catch {
|
|
104
116
|
}
|
|
105
|
-
const f = e.getState().getShadowMetadata(
|
|
117
|
+
const f = e.getState().getShadowMetadata(n, []), A = {
|
|
106
118
|
state: t,
|
|
107
119
|
lastUpdated: Date.now(),
|
|
108
120
|
lastSyncedWithServer: u,
|
|
@@ -110,20 +122,20 @@ const ie = (t, o) => {
|
|
|
110
122
|
baseServerState: f?.baseServerState
|
|
111
123
|
}, w = Ft.serialize(A);
|
|
112
124
|
window.localStorage.setItem(
|
|
113
|
-
|
|
125
|
+
E,
|
|
114
126
|
JSON.stringify(w.json)
|
|
115
127
|
);
|
|
116
128
|
}
|
|
117
129
|
}, gt = (t) => {
|
|
118
130
|
if (!t) return null;
|
|
119
131
|
try {
|
|
120
|
-
const
|
|
121
|
-
return
|
|
122
|
-
} catch (
|
|
123
|
-
return console.error("Error loading from localStorage:",
|
|
132
|
+
const n = window.localStorage.getItem(t);
|
|
133
|
+
return n ? JSON.parse(n) : null;
|
|
134
|
+
} catch (n) {
|
|
135
|
+
return console.error("Error loading from localStorage:", n), null;
|
|
124
136
|
}
|
|
125
|
-
},
|
|
126
|
-
const
|
|
137
|
+
}, xt = (t, n) => {
|
|
138
|
+
const g = e.getState().getShadowValue(t), { sessionId: S } = Pt(), y = at(n?.localStorage?.key) ? n.localStorage.key(g) : n?.localStorage?.key;
|
|
127
139
|
if (y && S) {
|
|
128
140
|
const I = gt(
|
|
129
141
|
`${S}-${t}-${y}`
|
|
@@ -133,34 +145,34 @@ const ie = (t, o) => {
|
|
|
133
145
|
}
|
|
134
146
|
return !1;
|
|
135
147
|
}, it = (t) => {
|
|
136
|
-
const
|
|
137
|
-
if (!
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
(S ? Array.isArray(S.reactiveType) ? S.reactiveType : [S.reactiveType || "component"] : null)?.includes("none") ||
|
|
148
|
+
const n = e.getState().getShadowMetadata(t, []);
|
|
149
|
+
if (!n) return;
|
|
150
|
+
const g = /* @__PURE__ */ new Set();
|
|
151
|
+
n?.components?.forEach((S) => {
|
|
152
|
+
(S ? Array.isArray(S.reactiveType) ? S.reactiveType : [S.reactiveType || "component"] : null)?.includes("none") || g.add(() => S.forceUpdate());
|
|
141
153
|
}), queueMicrotask(() => {
|
|
142
|
-
|
|
154
|
+
g.forEach((S) => S());
|
|
143
155
|
});
|
|
144
|
-
},
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
147
|
-
const S = `${t}////${
|
|
156
|
+
}, ue = (t, n) => {
|
|
157
|
+
const g = e.getState().getShadowMetadata(t, []);
|
|
158
|
+
if (g) {
|
|
159
|
+
const S = `${t}////${n}`, y = g?.components?.get(S);
|
|
148
160
|
if ((y ? Array.isArray(y.reactiveType) ? y.reactiveType : [y.reactiveType || "component"] : null)?.includes("none"))
|
|
149
161
|
return;
|
|
150
162
|
y && y.forceUpdate();
|
|
151
163
|
}
|
|
152
164
|
};
|
|
153
|
-
function wt(t,
|
|
154
|
-
const y = e.getState(), I = y.getShadowMetadata(t,
|
|
155
|
-
if (y.setShadowMetadata(t,
|
|
165
|
+
function wt(t, n, g, S) {
|
|
166
|
+
const y = e.getState(), I = y.getShadowMetadata(t, n);
|
|
167
|
+
if (y.setShadowMetadata(t, n, {
|
|
156
168
|
...I,
|
|
157
169
|
isDirty: !1,
|
|
158
170
|
stateSource: "server",
|
|
159
171
|
lastServerSync: S || Date.now()
|
|
160
|
-
}), Array.isArray(
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
const A = u.split(".").slice(1), w =
|
|
172
|
+
}), Array.isArray(g)) {
|
|
173
|
+
const E = y.getShadowMetadata(t, n);
|
|
174
|
+
E?.arrayKeys && E.arrayKeys.forEach((u, f) => {
|
|
175
|
+
const A = u.split(".").slice(1), w = g[f];
|
|
164
176
|
w !== void 0 && wt(
|
|
165
177
|
t,
|
|
166
178
|
A,
|
|
@@ -168,40 +180,40 @@ function wt(t, o, h, S) {
|
|
|
168
180
|
S
|
|
169
181
|
);
|
|
170
182
|
});
|
|
171
|
-
} else
|
|
172
|
-
const u = [...
|
|
183
|
+
} else g && typeof g == "object" && g.constructor === Object && Object.keys(g).forEach((E) => {
|
|
184
|
+
const u = [...n, E], f = g[E];
|
|
173
185
|
wt(t, u, f, S);
|
|
174
186
|
});
|
|
175
187
|
}
|
|
176
|
-
function
|
|
177
|
-
stateKey:
|
|
178
|
-
localStorage:
|
|
188
|
+
function zt(t, {
|
|
189
|
+
stateKey: n,
|
|
190
|
+
localStorage: g,
|
|
179
191
|
formElements: S,
|
|
180
192
|
reactiveDeps: y,
|
|
181
193
|
reactiveType: I,
|
|
182
|
-
componentId:
|
|
194
|
+
componentId: E,
|
|
183
195
|
defaultState: u,
|
|
184
196
|
syncUpdate: f,
|
|
185
197
|
dependencies: A,
|
|
186
198
|
serverState: w
|
|
187
199
|
} = {}) {
|
|
188
|
-
const [i,
|
|
189
|
-
let z = !
|
|
190
|
-
const [c] = K(
|
|
200
|
+
const [i, h] = K({}), { sessionId: M } = Pt();
|
|
201
|
+
let z = !n;
|
|
202
|
+
const [c] = K(n ?? rt()), B = e.getState().stateLog[c], J = q(/* @__PURE__ */ new Set()), H = q(E ?? rt()), W = q(
|
|
191
203
|
null
|
|
192
204
|
);
|
|
193
205
|
W.current = nt(c) ?? null, Z(() => {
|
|
194
206
|
if (f && f.stateKey === c && f.path?.[0]) {
|
|
195
|
-
const
|
|
196
|
-
e.getState().setSyncInfo(
|
|
207
|
+
const o = `${f.stateKey}:${f.path.join(".")}`;
|
|
208
|
+
e.getState().setSyncInfo(o, {
|
|
197
209
|
timeStamp: f.timeStamp,
|
|
198
210
|
userId: f.userId
|
|
199
211
|
});
|
|
200
212
|
}
|
|
201
213
|
}, [f]);
|
|
202
214
|
const m = ct(
|
|
203
|
-
(
|
|
204
|
-
const a =
|
|
215
|
+
(o) => {
|
|
216
|
+
const a = o ? { ...nt(c), ...o } : nt(c), d = a?.defaultState || u || t;
|
|
205
217
|
if (a?.serverState?.status === "success" && a?.serverState?.data !== void 0)
|
|
206
218
|
return {
|
|
207
219
|
value: a.serverState.data,
|
|
@@ -209,14 +221,14 @@ function xt(t, {
|
|
|
209
221
|
timestamp: a.serverState.timestamp || Date.now()
|
|
210
222
|
};
|
|
211
223
|
if (a?.localStorage?.key && M) {
|
|
212
|
-
const p = at(a.localStorage.key) ? a.localStorage.key(d) : a.localStorage.key,
|
|
224
|
+
const p = at(a.localStorage.key) ? a.localStorage.key(d) : a.localStorage.key, V = gt(
|
|
213
225
|
`${M}-${c}-${p}`
|
|
214
226
|
);
|
|
215
|
-
if (
|
|
227
|
+
if (V && V.lastUpdated > (a?.serverState?.timestamp || 0))
|
|
216
228
|
return {
|
|
217
|
-
value:
|
|
229
|
+
value: V.state,
|
|
218
230
|
source: "localStorage",
|
|
219
|
-
timestamp:
|
|
231
|
+
timestamp: V.lastUpdated
|
|
220
232
|
};
|
|
221
233
|
}
|
|
222
234
|
return {
|
|
@@ -233,25 +245,25 @@ function xt(t, {
|
|
|
233
245
|
if (r?.type === "SERVER_STATE_UPDATE") {
|
|
234
246
|
const a = r.serverState;
|
|
235
247
|
if (a?.status === "success" && a.data !== void 0) {
|
|
236
|
-
|
|
237
|
-
const l = typeof a.merge == "object" ? a.merge : a.merge === !0 ? {} : null, p = e.getState().getShadowValue(c),
|
|
238
|
-
if (l && Array.isArray(p) && Array.isArray(
|
|
248
|
+
yt(c, { serverState: a });
|
|
249
|
+
const l = typeof a.merge == "object" ? a.merge : a.merge === !0 ? {} : null, p = e.getState().getShadowValue(c), V = a.data;
|
|
250
|
+
if (l && Array.isArray(p) && Array.isArray(V)) {
|
|
239
251
|
const U = l.key || "id", C = new Set(
|
|
240
252
|
p.map((x) => x[U])
|
|
241
|
-
), F =
|
|
253
|
+
), F = V.filter((x) => !C.has(x[U]));
|
|
242
254
|
F.length > 0 && F.forEach((x) => {
|
|
243
255
|
e.getState().insertShadowArrayElement(c, [], x);
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
-
if (
|
|
248
|
-
const b =
|
|
256
|
+
const N = e.getState().getShadowMetadata(c, []);
|
|
257
|
+
if (N?.arrayKeys) {
|
|
258
|
+
const j = N.arrayKeys[N.arrayKeys.length - 1];
|
|
259
|
+
if (j) {
|
|
260
|
+
const b = j.split(".").slice(1);
|
|
249
261
|
e.getState().setShadowMetadata(c, b, {
|
|
250
262
|
isDirty: !1,
|
|
251
263
|
stateSource: "server",
|
|
252
264
|
lastServerSync: a.timestamp || Date.now()
|
|
253
265
|
});
|
|
254
|
-
const k = e.getState().getShadowValue(
|
|
266
|
+
const k = e.getState().getShadowValue(j);
|
|
255
267
|
k && typeof k == "object" && !Array.isArray(k) && Object.keys(k).forEach((P) => {
|
|
256
268
|
const O = [...b, P];
|
|
257
269
|
e.getState().setShadowMetadata(c, O, {
|
|
@@ -264,15 +276,15 @@ function xt(t, {
|
|
|
264
276
|
}
|
|
265
277
|
});
|
|
266
278
|
} else
|
|
267
|
-
e.getState().initializeShadowState(c,
|
|
279
|
+
e.getState().initializeShadowState(c, V), wt(
|
|
268
280
|
c,
|
|
269
281
|
[],
|
|
270
|
-
|
|
282
|
+
V,
|
|
271
283
|
a.timestamp
|
|
272
284
|
);
|
|
273
|
-
const
|
|
285
|
+
const _ = e.getState().getShadowMetadata(c, []);
|
|
274
286
|
e.getState().setShadowMetadata(c, [], {
|
|
275
|
-
...
|
|
287
|
+
..._,
|
|
276
288
|
stateSource: "server",
|
|
277
289
|
lastServerSync: a.timestamp || Date.now(),
|
|
278
290
|
isDirty: !1
|
|
@@ -280,13 +292,13 @@ function xt(t, {
|
|
|
280
292
|
}
|
|
281
293
|
}
|
|
282
294
|
}), [c, m]), Z(() => {
|
|
283
|
-
const
|
|
284
|
-
if (
|
|
295
|
+
const o = e.getState().getShadowMetadata(c, []);
|
|
296
|
+
if (o && o.stateSource)
|
|
285
297
|
return;
|
|
286
298
|
const r = nt(c);
|
|
287
299
|
if (r?.defaultState !== void 0 || u !== void 0) {
|
|
288
300
|
const a = r?.defaultState || u;
|
|
289
|
-
r?.defaultState ||
|
|
301
|
+
r?.defaultState || yt(c, {
|
|
290
302
|
defaultState: a
|
|
291
303
|
});
|
|
292
304
|
const { value: d, source: l, timestamp: p } = m();
|
|
@@ -298,15 +310,15 @@ function xt(t, {
|
|
|
298
310
|
}), it(c);
|
|
299
311
|
}
|
|
300
312
|
}, [c, ...A || []]), dt(() => {
|
|
301
|
-
z &&
|
|
313
|
+
z && yt(c, {
|
|
302
314
|
formElements: S,
|
|
303
315
|
defaultState: u,
|
|
304
|
-
localStorage:
|
|
316
|
+
localStorage: g,
|
|
305
317
|
middleware: W.current?.middleware
|
|
306
318
|
});
|
|
307
|
-
const
|
|
308
|
-
return a.set(
|
|
309
|
-
forceUpdate: () =>
|
|
319
|
+
const o = `${c}////${H.current}`, r = e.getState().getShadowMetadata(c, []), a = r?.components || /* @__PURE__ */ new Map();
|
|
320
|
+
return a.set(o, {
|
|
321
|
+
forceUpdate: () => h({}),
|
|
310
322
|
reactiveType: I ?? ["component", "deps"],
|
|
311
323
|
paths: /* @__PURE__ */ new Set(),
|
|
312
324
|
depsFunction: y || void 0,
|
|
@@ -315,28 +327,28 @@ function xt(t, {
|
|
|
315
327
|
}), e.getState().setShadowMetadata(c, [], {
|
|
316
328
|
...r,
|
|
317
329
|
components: a
|
|
318
|
-
}),
|
|
319
|
-
const d = e.getState().getShadowMetadata(c, []), l = d?.components?.get(
|
|
330
|
+
}), h({}), () => {
|
|
331
|
+
const d = e.getState().getShadowMetadata(c, []), l = d?.components?.get(o);
|
|
320
332
|
l?.paths && l.paths.forEach((p) => {
|
|
321
|
-
const
|
|
322
|
-
U?.pathComponents && U.pathComponents.size === 0 && (delete U.pathComponents, e.getState().setShadowMetadata(c,
|
|
333
|
+
const _ = p.split(".").slice(1), U = e.getState().getShadowMetadata(c, _);
|
|
334
|
+
U?.pathComponents && U.pathComponents.size === 0 && (delete U.pathComponents, e.getState().setShadowMetadata(c, _, U));
|
|
323
335
|
}), d?.components && e.getState().setShadowMetadata(c, [], d);
|
|
324
336
|
};
|
|
325
337
|
}, []);
|
|
326
|
-
const Y = q(null), Q = (
|
|
338
|
+
const Y = q(null), Q = (o, r, a) => {
|
|
327
339
|
const d = [c, ...r].join(".");
|
|
328
340
|
if (Array.isArray(r)) {
|
|
329
341
|
const b = `${c}-${r.join(".")}`;
|
|
330
342
|
J.current.add(b);
|
|
331
343
|
}
|
|
332
|
-
const l = e.getState(), p = l.getShadowMetadata(c, r),
|
|
344
|
+
const l = e.getState(), p = l.getShadowMetadata(c, r), V = l.getShadowValue(d), _ = a.updateType === "insert" && at(o) ? o({ state: V, uuid: rt() }) : at(o) ? o(V) : o, C = {
|
|
333
345
|
timeStamp: Date.now(),
|
|
334
346
|
stateKey: c,
|
|
335
347
|
path: r,
|
|
336
348
|
updateType: a.updateType,
|
|
337
349
|
status: "new",
|
|
338
|
-
oldValue:
|
|
339
|
-
newValue:
|
|
350
|
+
oldValue: V,
|
|
351
|
+
newValue: _
|
|
340
352
|
};
|
|
341
353
|
switch (a.updateType) {
|
|
342
354
|
case "insert": {
|
|
@@ -362,7 +374,7 @@ function xt(t, {
|
|
|
362
374
|
}
|
|
363
375
|
}
|
|
364
376
|
if (a.sync !== !1 && Y.current && Y.current.connected && Y.current.updateState({ operation: C }), p?.signals && p.signals.length > 0) {
|
|
365
|
-
const b = a.updateType === "cut" ? null :
|
|
377
|
+
const b = a.updateType === "cut" ? null : _;
|
|
366
378
|
p.signals.forEach(({ parentId: k, position: P, effect: O }) => {
|
|
367
379
|
const v = document.querySelector(`[data-parent-id="${k}"]`);
|
|
368
380
|
if (v) {
|
|
@@ -375,8 +387,8 @@ function xt(t, {
|
|
|
375
387
|
"state",
|
|
376
388
|
`return (${O})(state)`
|
|
377
389
|
)(b);
|
|
378
|
-
} catch (
|
|
379
|
-
console.error("Error evaluating effect function:",
|
|
390
|
+
} catch (D) {
|
|
391
|
+
console.error("Error evaluating effect function:", D);
|
|
380
392
|
}
|
|
381
393
|
$ != null && typeof $ == "object" && ($ = JSON.stringify($)), T[P].textContent = String($ ?? "");
|
|
382
394
|
}
|
|
@@ -391,47 +403,47 @@ function xt(t, {
|
|
|
391
403
|
p.mapWrappers.forEach((v) => {
|
|
392
404
|
let T = !0, $ = -1;
|
|
393
405
|
if (v.meta?.transforms && v.meta.transforms.length > 0) {
|
|
394
|
-
for (const
|
|
395
|
-
if (
|
|
406
|
+
for (const D of v.meta.transforms)
|
|
407
|
+
if (D.type === "filter" && !D.fn(P, -1)) {
|
|
396
408
|
T = !1;
|
|
397
409
|
break;
|
|
398
410
|
}
|
|
399
411
|
if (T) {
|
|
400
|
-
const
|
|
412
|
+
const D = It(
|
|
401
413
|
c,
|
|
402
414
|
r,
|
|
403
415
|
v.meta.transforms
|
|
404
416
|
), R = v.meta.transforms.find(
|
|
405
|
-
(
|
|
417
|
+
(L) => L.type === "sort"
|
|
406
418
|
);
|
|
407
419
|
if (R) {
|
|
408
|
-
const
|
|
420
|
+
const L = D.map((G) => ({
|
|
409
421
|
key: G,
|
|
410
422
|
value: l.getShadowValue(G)
|
|
411
423
|
}));
|
|
412
|
-
|
|
424
|
+
L.push({ key: k, value: P }), L.sort((G, tt) => R.fn(G.value, tt.value)), $ = L.findIndex(
|
|
413
425
|
(G) => G.key === k
|
|
414
426
|
);
|
|
415
427
|
} else
|
|
416
|
-
$ =
|
|
428
|
+
$ = D.length;
|
|
417
429
|
}
|
|
418
430
|
} else
|
|
419
431
|
T = !0, $ = b.length - 1;
|
|
420
432
|
if (T && v.containerRef && v.containerRef.isConnected) {
|
|
421
|
-
const
|
|
422
|
-
|
|
433
|
+
const D = document.createElement("div");
|
|
434
|
+
D.setAttribute("data-item-path", k);
|
|
423
435
|
const R = Array.from(v.containerRef.children);
|
|
424
436
|
$ >= 0 && $ < R.length ? v.containerRef.insertBefore(
|
|
425
|
-
|
|
437
|
+
D,
|
|
426
438
|
R[$]
|
|
427
|
-
) : v.containerRef.appendChild(
|
|
428
|
-
const
|
|
439
|
+
) : v.containerRef.appendChild(D);
|
|
440
|
+
const L = At(D), G = rt(), tt = k.split(".").slice(1), et = v.rebuildStateShape({
|
|
429
441
|
path: v.path,
|
|
430
442
|
currentState: O,
|
|
431
443
|
componentId: v.componentId,
|
|
432
444
|
meta: v.meta
|
|
433
445
|
});
|
|
434
|
-
|
|
446
|
+
L.render(
|
|
435
447
|
lt(Mt, {
|
|
436
448
|
stateKey: c,
|
|
437
449
|
itemComponentId: G,
|
|
@@ -456,33 +468,33 @@ function xt(t, {
|
|
|
456
468
|
}
|
|
457
469
|
});
|
|
458
470
|
}
|
|
459
|
-
const x = e.getState().getShadowValue(c),
|
|
471
|
+
const x = e.getState().getShadowValue(c), N = e.getState().getShadowMetadata(c, []), j = /* @__PURE__ */ new Set();
|
|
460
472
|
if (console.log(
|
|
461
473
|
"rootMeta",
|
|
462
474
|
c,
|
|
463
475
|
e.getState().shadowStateStore
|
|
464
|
-
), !
|
|
476
|
+
), !N?.components)
|
|
465
477
|
return x;
|
|
466
478
|
if (a.updateType === "update") {
|
|
467
479
|
let b = [...r];
|
|
468
480
|
for (; ; ) {
|
|
469
481
|
const k = l.getShadowMetadata(c, b);
|
|
470
482
|
if (k?.pathComponents && k.pathComponents.forEach((P) => {
|
|
471
|
-
if (
|
|
483
|
+
if (j.has(P))
|
|
472
484
|
return;
|
|
473
|
-
const O =
|
|
474
|
-
O && ((Array.isArray(O.reactiveType) ? O.reactiveType : [O.reactiveType || "component"]).includes("none") || (O.forceUpdate(),
|
|
485
|
+
const O = N.components?.get(P);
|
|
486
|
+
O && ((Array.isArray(O.reactiveType) ? O.reactiveType : [O.reactiveType || "component"]).includes("none") || (O.forceUpdate(), j.add(P)));
|
|
475
487
|
}), b.length === 0)
|
|
476
488
|
break;
|
|
477
489
|
b.pop();
|
|
478
490
|
}
|
|
479
|
-
|
|
491
|
+
_ && typeof _ == "object" && !Tt(_) && V && typeof V == "object" && !Tt(V) && Ct(_, V).forEach((P) => {
|
|
480
492
|
const O = P.split("."), v = [...r, ...O], T = l.getShadowMetadata(c, v);
|
|
481
493
|
T?.pathComponents && T.pathComponents.forEach(($) => {
|
|
482
|
-
if (
|
|
494
|
+
if (j.has($))
|
|
483
495
|
return;
|
|
484
|
-
const
|
|
485
|
-
|
|
496
|
+
const D = N.components?.get($);
|
|
497
|
+
D && ((Array.isArray(D.reactiveType) ? D.reactiveType : [D.reactiveType || "component"]).includes("none") || (D.forceUpdate(), j.add($)));
|
|
486
498
|
});
|
|
487
499
|
});
|
|
488
500
|
} else if (a.updateType === "insert" || a.updateType === "cut") {
|
|
@@ -490,55 +502,55 @@ function xt(t, {
|
|
|
490
502
|
if (k?.signals && k.signals.length > 0) {
|
|
491
503
|
const P = [c, ...b].join("."), O = l.getShadowValue(P);
|
|
492
504
|
k.signals.forEach(({ parentId: v, position: T, effect: $ }) => {
|
|
493
|
-
const
|
|
505
|
+
const D = document.querySelector(
|
|
494
506
|
`[data-parent-id="${v}"]`
|
|
495
507
|
);
|
|
496
|
-
if (
|
|
497
|
-
const R = Array.from(
|
|
508
|
+
if (D) {
|
|
509
|
+
const R = Array.from(D.childNodes);
|
|
498
510
|
if (R[T]) {
|
|
499
|
-
let
|
|
511
|
+
let L = O;
|
|
500
512
|
if ($)
|
|
501
513
|
try {
|
|
502
|
-
|
|
514
|
+
L = new Function(
|
|
503
515
|
"state",
|
|
504
516
|
`return (${$})(state)`
|
|
505
517
|
)(O);
|
|
506
518
|
} catch (G) {
|
|
507
|
-
console.error("Error evaluating effect function:", G),
|
|
519
|
+
console.error("Error evaluating effect function:", G), L = O;
|
|
508
520
|
}
|
|
509
|
-
|
|
521
|
+
L != null && typeof L == "object" && (L = JSON.stringify(L)), R[T].textContent = String(L ?? "");
|
|
510
522
|
}
|
|
511
523
|
}
|
|
512
524
|
});
|
|
513
525
|
}
|
|
514
526
|
k?.pathComponents && k.pathComponents.forEach((P) => {
|
|
515
|
-
if (!
|
|
516
|
-
const O =
|
|
517
|
-
O && (O.forceUpdate(),
|
|
527
|
+
if (!j.has(P)) {
|
|
528
|
+
const O = N.components?.get(P);
|
|
529
|
+
O && (O.forceUpdate(), j.add(P));
|
|
518
530
|
}
|
|
519
531
|
});
|
|
520
532
|
}
|
|
521
|
-
return
|
|
522
|
-
if (
|
|
533
|
+
return N.components.forEach((b, k) => {
|
|
534
|
+
if (j.has(k))
|
|
523
535
|
return;
|
|
524
536
|
const P = Array.isArray(b.reactiveType) ? b.reactiveType : [b.reactiveType || "component"];
|
|
525
537
|
if (P.includes("all")) {
|
|
526
|
-
b.forceUpdate(),
|
|
538
|
+
b.forceUpdate(), j.add(k);
|
|
527
539
|
return;
|
|
528
540
|
}
|
|
529
541
|
if (P.includes("deps") && b.depsFunction) {
|
|
530
542
|
const O = l.getShadowValue(c), v = b.depsFunction(O);
|
|
531
543
|
let T = !1;
|
|
532
|
-
v === !0 ? T = !0 : Array.isArray(v) && (st(b.prevDeps, v) || (b.prevDeps = v, T = !0)), T && (b.forceUpdate(),
|
|
544
|
+
v === !0 ? T = !0 : Array.isArray(v) && (st(b.prevDeps, v) || (b.prevDeps = v, T = !0)), T && (b.forceUpdate(), j.add(k));
|
|
533
545
|
}
|
|
534
|
-
}),
|
|
546
|
+
}), j.clear(), Wt(c, (b) => {
|
|
535
547
|
const k = [...b ?? [], C], P = /* @__PURE__ */ new Map();
|
|
536
548
|
return k.forEach((O) => {
|
|
537
549
|
const v = `${O.stateKey}:${JSON.stringify(O.path)}`, T = P.get(v);
|
|
538
550
|
T ? (T.timeStamp = Math.max(T.timeStamp, O.timeStamp), T.newValue = O.newValue, T.oldValue = T.oldValue ?? O.oldValue, T.updateType = O.updateType) : P.set(v, { ...O });
|
|
539
551
|
}), Array.from(P.values());
|
|
540
|
-
}),
|
|
541
|
-
|
|
552
|
+
}), Ht(
|
|
553
|
+
_,
|
|
542
554
|
c,
|
|
543
555
|
W.current,
|
|
544
556
|
M
|
|
@@ -547,8 +559,8 @@ function xt(t, {
|
|
|
547
559
|
update: C
|
|
548
560
|
}), x;
|
|
549
561
|
};
|
|
550
|
-
e.getState().initialStateGlobal[c] ||
|
|
551
|
-
const X =
|
|
562
|
+
e.getState().initialStateGlobal[c] || _t(c, t);
|
|
563
|
+
const X = St(() => Dt(
|
|
552
564
|
c,
|
|
553
565
|
Q,
|
|
554
566
|
H.current,
|
|
@@ -556,65 +568,65 @@ function xt(t, {
|
|
|
556
568
|
), [c, M]), s = W.current?.cogsSync;
|
|
557
569
|
return s && (Y.current = s(X)), X;
|
|
558
570
|
}
|
|
559
|
-
function
|
|
571
|
+
function Bt(t) {
|
|
560
572
|
return !t || t.length === 0 ? "" : t.map(
|
|
561
|
-
(
|
|
573
|
+
(n) => (
|
|
562
574
|
// Safely stringify dependencies. An empty array becomes '[]'.
|
|
563
|
-
`${
|
|
575
|
+
`${n.type}${JSON.stringify(n.dependencies || [])}`
|
|
564
576
|
)
|
|
565
577
|
).join("");
|
|
566
578
|
}
|
|
567
|
-
const It = (t,
|
|
568
|
-
let S = e.getState().getShadowMetadata(t,
|
|
569
|
-
if (!
|
|
579
|
+
const It = (t, n, g) => {
|
|
580
|
+
let S = e.getState().getShadowMetadata(t, n)?.arrayKeys || [];
|
|
581
|
+
if (!g || g.length === 0)
|
|
570
582
|
return S;
|
|
571
583
|
let y = S.map((I) => ({
|
|
572
584
|
key: I,
|
|
573
585
|
value: e.getState().getShadowValue(I)
|
|
574
586
|
}));
|
|
575
|
-
for (const I of
|
|
587
|
+
for (const I of g)
|
|
576
588
|
I.type === "filter" ? y = y.filter(
|
|
577
|
-
({ value:
|
|
578
|
-
) : I.type === "sort" && y.sort((
|
|
589
|
+
({ value: E }, u) => I.fn(E, u)
|
|
590
|
+
) : I.type === "sort" && y.sort((E, u) => I.fn(E.value, u.value));
|
|
579
591
|
return y.map(({ key: I }) => I);
|
|
580
|
-
},
|
|
581
|
-
const S = `${t}////${
|
|
582
|
-
!u || u.reactiveType === "none" || !(Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType]).includes("component") || y(t,
|
|
583
|
-
},
|
|
592
|
+
}, Vt = (t, n, g) => {
|
|
593
|
+
const S = `${t}////${n}`, { addPathComponent: y, getShadowMetadata: I } = e.getState(), u = I(t, [])?.components?.get(S);
|
|
594
|
+
!u || u.reactiveType === "none" || !(Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType]).includes("component") || y(t, g, S);
|
|
595
|
+
}, ft = (t, n, g) => {
|
|
584
596
|
const S = e.getState(), y = S.getShadowMetadata(t, []), I = /* @__PURE__ */ new Set();
|
|
585
597
|
y?.components && y.components.forEach((u, f) => {
|
|
586
598
|
(Array.isArray(u.reactiveType) ? u.reactiveType : [u.reactiveType || "component"]).includes("all") && (u.forceUpdate(), I.add(f));
|
|
587
|
-
}), S.getShadowMetadata(t, [...
|
|
599
|
+
}), S.getShadowMetadata(t, [...n, "getSelected"])?.pathComponents?.forEach((u) => {
|
|
588
600
|
y?.components?.get(u)?.forceUpdate();
|
|
589
601
|
});
|
|
590
|
-
const
|
|
591
|
-
for (let u of
|
|
602
|
+
const E = S.getShadowMetadata(t, n);
|
|
603
|
+
for (let u of E?.arrayKeys || []) {
|
|
592
604
|
const f = u + ".selected", A = S.getShadowMetadata(
|
|
593
605
|
t,
|
|
594
606
|
f.split(".").slice(1)
|
|
595
607
|
);
|
|
596
|
-
u ==
|
|
608
|
+
u == g && A?.pathComponents?.forEach((w) => {
|
|
597
609
|
y?.components?.get(w)?.forceUpdate();
|
|
598
610
|
});
|
|
599
611
|
}
|
|
600
612
|
};
|
|
601
|
-
function
|
|
613
|
+
function Dt(t, n, g, S) {
|
|
602
614
|
const y = /* @__PURE__ */ new Map();
|
|
603
615
|
let I = 0;
|
|
604
|
-
const
|
|
616
|
+
const E = (w) => {
|
|
605
617
|
const i = w.join(".");
|
|
606
|
-
for (const [
|
|
607
|
-
(
|
|
618
|
+
for (const [h] of y)
|
|
619
|
+
(h === i || h.startsWith(i + ".")) && y.delete(h);
|
|
608
620
|
I++;
|
|
609
621
|
};
|
|
610
622
|
function u({
|
|
611
623
|
currentState: w,
|
|
612
624
|
path: i = [],
|
|
613
|
-
meta:
|
|
625
|
+
meta: h,
|
|
614
626
|
componentId: M
|
|
615
627
|
}) {
|
|
616
628
|
const z = i.map(String).join("."), c = [t, ...i].join(".");
|
|
617
|
-
w = e.getState().getShadowValue(c,
|
|
629
|
+
w = e.getState().getShadowValue(c, h?.validIds);
|
|
618
630
|
const B = function() {
|
|
619
631
|
return e().getShadowValue(t, i);
|
|
620
632
|
}, J = {
|
|
@@ -627,18 +639,18 @@ function _t(t, o, h, S) {
|
|
|
627
639
|
return f[m];
|
|
628
640
|
if (m === "getDifferences")
|
|
629
641
|
return () => {
|
|
630
|
-
const s = e.getState().getShadowMetadata(t, []),
|
|
642
|
+
const s = e.getState().getShadowMetadata(t, []), o = e.getState().getShadowValue(t);
|
|
631
643
|
let r;
|
|
632
|
-
return s?.stateSource === "server" && s.baseServerState ? r = s.baseServerState : r = e.getState().initialStateGlobal[t], Ct(
|
|
644
|
+
return s?.stateSource === "server" && s.baseServerState ? r = s.baseServerState : r = e.getState().initialStateGlobal[t], Ct(o, r);
|
|
633
645
|
};
|
|
634
646
|
if (m === "sync" && i.length === 0)
|
|
635
647
|
return async function() {
|
|
636
|
-
const s = e.getState().getInitialOptions(t),
|
|
637
|
-
if (!
|
|
648
|
+
const s = e.getState().getInitialOptions(t), o = s?.sync;
|
|
649
|
+
if (!o)
|
|
638
650
|
return console.error(`No mutation defined for state key "${t}"`), { success: !1, error: "No mutation defined" };
|
|
639
651
|
const r = e.getState().getShadowValue(t, []), a = s?.validation?.key;
|
|
640
652
|
try {
|
|
641
|
-
const d = await
|
|
653
|
+
const d = await o.action(r);
|
|
642
654
|
if (d && !d.success && d.errors && a && (e.getState().removeValidationError(a), d.errors.forEach((l) => {
|
|
643
655
|
const p = [a, ...l.path].join(".");
|
|
644
656
|
e.getState().addValidationError(p, l.message);
|
|
@@ -651,23 +663,23 @@ function _t(t, o, h, S) {
|
|
|
651
663
|
stateSource: "server",
|
|
652
664
|
baseServerState: r
|
|
653
665
|
// Update base server state
|
|
654
|
-
}),
|
|
655
|
-
} else !d?.success &&
|
|
666
|
+
}), o.onSuccess && o.onSuccess(d.data);
|
|
667
|
+
} else !d?.success && o.onError && o.onError(d.error);
|
|
656
668
|
return d;
|
|
657
669
|
} catch (d) {
|
|
658
|
-
return
|
|
670
|
+
return o.onError && o.onError(d), { success: !1, error: d };
|
|
659
671
|
}
|
|
660
672
|
};
|
|
661
673
|
if (m === "_status" || m === "getStatus") {
|
|
662
674
|
const s = () => {
|
|
663
|
-
const
|
|
664
|
-
return
|
|
675
|
+
const o = e.getState().getShadowMetadata(t, i), r = e.getState().getShadowValue(c);
|
|
676
|
+
return o?.isDirty === !0 ? "dirty" : o?.isDirty === !1 || o?.stateSource === "server" ? "synced" : o?.stateSource === "localStorage" ? "restored" : o?.stateSource === "default" ? "fresh" : e.getState().getShadowMetadata(t, [])?.stateSource === "server" && !o?.isDirty ? "synced" : r !== void 0 && !o ? "fresh" : "unknown";
|
|
665
677
|
};
|
|
666
678
|
return m === "_status" ? s() : s;
|
|
667
679
|
}
|
|
668
680
|
if (m === "removeStorage")
|
|
669
681
|
return () => {
|
|
670
|
-
const s = e.getState().initialStateGlobal[t],
|
|
682
|
+
const s = e.getState().initialStateGlobal[t], o = nt(t), r = at(o?.localStorage?.key) ? o.localStorage.key(s) : o?.localStorage?.key, a = `${S}-${t}-${r}`;
|
|
671
683
|
a && localStorage.removeItem(a);
|
|
672
684
|
};
|
|
673
685
|
if (m === "showValidationErrors")
|
|
@@ -679,15 +691,15 @@ function _t(t, o, h, S) {
|
|
|
679
691
|
if (m === "getSelected")
|
|
680
692
|
return () => {
|
|
681
693
|
const s = t + "." + i.join(".");
|
|
682
|
-
|
|
694
|
+
Vt(t, M, [
|
|
683
695
|
...i,
|
|
684
696
|
"getSelected"
|
|
685
697
|
]);
|
|
686
|
-
const
|
|
687
|
-
if (!
|
|
698
|
+
const o = e.getState().selectedIndicesMap;
|
|
699
|
+
if (!o || !o.has(s))
|
|
688
700
|
return;
|
|
689
|
-
const r =
|
|
690
|
-
if (
|
|
701
|
+
const r = o.get(s);
|
|
702
|
+
if (h?.validIds && !h.validIds.includes(r))
|
|
691
703
|
return;
|
|
692
704
|
const a = e.getState().getShadowValue(r);
|
|
693
705
|
if (a)
|
|
@@ -700,10 +712,10 @@ function _t(t, o, h, S) {
|
|
|
700
712
|
if (m === "getSelectedIndex")
|
|
701
713
|
return () => e.getState().getSelectedIndex(
|
|
702
714
|
t + "." + i.join("."),
|
|
703
|
-
|
|
715
|
+
h?.validIds
|
|
704
716
|
);
|
|
705
717
|
if (m === "clearSelected")
|
|
706
|
-
return
|
|
718
|
+
return ft(t, i), () => {
|
|
707
719
|
e.getState().clearSelectedIndex({
|
|
708
720
|
arrayKey: t + "." + i.join(".")
|
|
709
721
|
});
|
|
@@ -711,14 +723,14 @@ function _t(t, o, h, S) {
|
|
|
711
723
|
if (m === "useVirtualView")
|
|
712
724
|
return (s) => {
|
|
713
725
|
const {
|
|
714
|
-
itemHeight:
|
|
726
|
+
itemHeight: o = 50,
|
|
715
727
|
overscan: r = 6,
|
|
716
728
|
stickToBottom: a = !1,
|
|
717
729
|
scrollStickTolerance: d = 75
|
|
718
|
-
} = s, l = q(null), [p,
|
|
730
|
+
} = s, l = q(null), [p, V] = K({
|
|
719
731
|
startIndex: 0,
|
|
720
732
|
endIndex: 10
|
|
721
|
-
}), [
|
|
733
|
+
}), [_, U] = K({}), C = q(!0), F = q({
|
|
722
734
|
isUserScrolling: !1,
|
|
723
735
|
lastScrollTop: 0,
|
|
724
736
|
scrollUpCount: 0,
|
|
@@ -734,29 +746,29 @@ function _t(t, o, h, S) {
|
|
|
734
746
|
top: v.scrollHeight,
|
|
735
747
|
behavior: C.current ? "instant" : "smooth"
|
|
736
748
|
});
|
|
737
|
-
}, [
|
|
738
|
-
const
|
|
749
|
+
}, [_, a]);
|
|
750
|
+
const N = e.getState().getShadowMetadata(t, i)?.arrayKeys || [], { totalHeight: j, itemOffsets: b } = St(() => {
|
|
739
751
|
let v = 0;
|
|
740
752
|
const T = /* @__PURE__ */ new Map();
|
|
741
|
-
return (e.getState().getShadowMetadata(t, i)?.arrayKeys || []).forEach((
|
|
742
|
-
const R =
|
|
743
|
-
T.set(
|
|
744
|
-
height:
|
|
753
|
+
return (e.getState().getShadowMetadata(t, i)?.arrayKeys || []).forEach((D) => {
|
|
754
|
+
const R = D.split(".").slice(1), L = e.getState().getShadowMetadata(t, R)?.virtualizer?.itemHeight || o;
|
|
755
|
+
T.set(D, {
|
|
756
|
+
height: L,
|
|
745
757
|
offset: v
|
|
746
|
-
}), v +=
|
|
758
|
+
}), v += L;
|
|
747
759
|
}), x.current = T, { totalHeight: v, itemOffsets: T };
|
|
748
|
-
}, [
|
|
760
|
+
}, [N.length, o]);
|
|
749
761
|
dt(() => {
|
|
750
|
-
if (a &&
|
|
762
|
+
if (a && N.length > 0 && l.current && !F.current.isUserScrolling && C.current) {
|
|
751
763
|
const v = l.current, T = () => {
|
|
752
764
|
if (v.clientHeight > 0) {
|
|
753
765
|
const $ = Math.ceil(
|
|
754
|
-
v.clientHeight /
|
|
755
|
-
),
|
|
766
|
+
v.clientHeight / o
|
|
767
|
+
), D = N.length - 1, R = Math.max(
|
|
756
768
|
0,
|
|
757
|
-
|
|
769
|
+
D - $ - r
|
|
758
770
|
);
|
|
759
|
-
|
|
771
|
+
V({ startIndex: R, endIndex: D }), requestAnimationFrame(() => {
|
|
760
772
|
P("instant"), C.current = !1;
|
|
761
773
|
});
|
|
762
774
|
} else
|
|
@@ -764,34 +776,34 @@ function _t(t, o, h, S) {
|
|
|
764
776
|
};
|
|
765
777
|
T();
|
|
766
778
|
}
|
|
767
|
-
}, [
|
|
779
|
+
}, [N.length, a, o, r]);
|
|
768
780
|
const k = ct(() => {
|
|
769
781
|
const v = l.current;
|
|
770
782
|
if (!v) return;
|
|
771
|
-
const T = v.scrollTop, { scrollHeight: $, clientHeight:
|
|
772
|
-
R.isNearBottom =
|
|
783
|
+
const T = v.scrollTop, { scrollHeight: $, clientHeight: D } = v, R = F.current, L = $ - (T + D), G = R.isNearBottom;
|
|
784
|
+
R.isNearBottom = L <= d, T < R.lastScrollTop ? (R.scrollUpCount++, R.scrollUpCount > 3 && G && (R.isUserScrolling = !0, console.log("User scrolled away from bottom"))) : R.isNearBottom && (R.isUserScrolling = !1, R.scrollUpCount = 0), R.lastScrollTop = T;
|
|
773
785
|
let tt = 0;
|
|
774
|
-
for (let et = 0; et <
|
|
775
|
-
const
|
|
776
|
-
if (
|
|
786
|
+
for (let et = 0; et < N.length; et++) {
|
|
787
|
+
const ht = N[et], mt = x.current.get(ht);
|
|
788
|
+
if (mt && mt.offset + mt.height > T) {
|
|
777
789
|
tt = et;
|
|
778
790
|
break;
|
|
779
791
|
}
|
|
780
792
|
}
|
|
781
793
|
if (tt !== p.startIndex) {
|
|
782
|
-
const et = Math.ceil(
|
|
783
|
-
|
|
794
|
+
const et = Math.ceil(D / o);
|
|
795
|
+
V({
|
|
784
796
|
startIndex: Math.max(0, tt - r),
|
|
785
797
|
endIndex: Math.min(
|
|
786
|
-
|
|
798
|
+
N.length - 1,
|
|
787
799
|
tt + et + r
|
|
788
800
|
)
|
|
789
801
|
});
|
|
790
802
|
}
|
|
791
803
|
}, [
|
|
792
|
-
|
|
804
|
+
N.length,
|
|
793
805
|
p.startIndex,
|
|
794
|
-
|
|
806
|
+
o,
|
|
795
807
|
r,
|
|
796
808
|
d
|
|
797
809
|
]);
|
|
@@ -810,18 +822,18 @@ function _t(t, o, h, S) {
|
|
|
810
822
|
if (!T) return;
|
|
811
823
|
F.current.isUserScrolling = !1, F.current.isNearBottom = !0, F.current.scrollUpCount = 0;
|
|
812
824
|
const $ = () => {
|
|
813
|
-
const
|
|
825
|
+
const D = (R = 0) => {
|
|
814
826
|
if (R > 5) return;
|
|
815
|
-
const
|
|
816
|
-
G + tt >=
|
|
817
|
-
top:
|
|
827
|
+
const L = T.scrollHeight, G = T.scrollTop, tt = T.clientHeight;
|
|
828
|
+
G + tt >= L - 1 || (T.scrollTo({
|
|
829
|
+
top: L,
|
|
818
830
|
behavior: v
|
|
819
831
|
}), setTimeout(() => {
|
|
820
|
-
const et = T.scrollHeight,
|
|
821
|
-
(et !==
|
|
832
|
+
const et = T.scrollHeight, ht = T.scrollTop;
|
|
833
|
+
(et !== L || ht + tt < et - 1) && D(R + 1);
|
|
822
834
|
}, 50));
|
|
823
835
|
};
|
|
824
|
-
|
|
836
|
+
D();
|
|
825
837
|
};
|
|
826
838
|
"requestIdleCallback" in window ? requestIdleCallback($, { timeout: 100 }) : requestAnimationFrame(() => {
|
|
827
839
|
requestAnimationFrame($);
|
|
@@ -833,14 +845,14 @@ function _t(t, o, h, S) {
|
|
|
833
845
|
if (!a || !l.current) return;
|
|
834
846
|
const v = l.current, T = F.current;
|
|
835
847
|
let $;
|
|
836
|
-
const
|
|
848
|
+
const D = () => {
|
|
837
849
|
clearTimeout($), $ = setTimeout(() => {
|
|
838
850
|
!T.isUserScrolling && T.isNearBottom && P(
|
|
839
851
|
C.current ? "instant" : "smooth"
|
|
840
852
|
);
|
|
841
853
|
}, 100);
|
|
842
854
|
}, R = new MutationObserver(() => {
|
|
843
|
-
T.isUserScrolling ||
|
|
855
|
+
T.isUserScrolling || D();
|
|
844
856
|
});
|
|
845
857
|
R.observe(v, {
|
|
846
858
|
childList: !0,
|
|
@@ -849,19 +861,19 @@ function _t(t, o, h, S) {
|
|
|
849
861
|
attributeFilter: ["style", "class"]
|
|
850
862
|
// More specific than just 'height'
|
|
851
863
|
});
|
|
852
|
-
const
|
|
853
|
-
G.target instanceof HTMLImageElement && !T.isUserScrolling &&
|
|
864
|
+
const L = (G) => {
|
|
865
|
+
G.target instanceof HTMLImageElement && !T.isUserScrolling && D();
|
|
854
866
|
};
|
|
855
|
-
return v.addEventListener("load",
|
|
867
|
+
return v.addEventListener("load", L, !0), C.current ? setTimeout(() => {
|
|
856
868
|
P("instant");
|
|
857
|
-
}, 0) :
|
|
858
|
-
clearTimeout($), R.disconnect(), v.removeEventListener("load",
|
|
869
|
+
}, 0) : D(), () => {
|
|
870
|
+
clearTimeout($), R.disconnect(), v.removeEventListener("load", L, !0);
|
|
859
871
|
};
|
|
860
|
-
}, [a,
|
|
861
|
-
virtualState:
|
|
872
|
+
}, [a, N.length, P]), {
|
|
873
|
+
virtualState: St(() => {
|
|
862
874
|
const v = e.getState(), T = v.getShadowValue(
|
|
863
875
|
[t, ...i].join(".")
|
|
864
|
-
), $ = v.getShadowMetadata(t, i)?.arrayKeys || [],
|
|
876
|
+
), $ = v.getShadowMetadata(t, i)?.arrayKeys || [], D = T.slice(
|
|
865
877
|
p.startIndex,
|
|
866
878
|
p.endIndex + 1
|
|
867
879
|
), R = $.slice(
|
|
@@ -869,12 +881,12 @@ function _t(t, o, h, S) {
|
|
|
869
881
|
p.endIndex + 1
|
|
870
882
|
);
|
|
871
883
|
return u({
|
|
872
|
-
currentState:
|
|
884
|
+
currentState: D,
|
|
873
885
|
path: i,
|
|
874
886
|
componentId: M,
|
|
875
|
-
meta: { ...
|
|
887
|
+
meta: { ...h, validIds: R }
|
|
876
888
|
});
|
|
877
|
-
}, [p.startIndex, p.endIndex,
|
|
889
|
+
}, [p.startIndex, p.endIndex, N.length]),
|
|
878
890
|
virtualizerProps: {
|
|
879
891
|
outer: {
|
|
880
892
|
ref: l,
|
|
@@ -886,22 +898,22 @@ function _t(t, o, h, S) {
|
|
|
886
898
|
},
|
|
887
899
|
inner: {
|
|
888
900
|
style: {
|
|
889
|
-
height: `${
|
|
901
|
+
height: `${j}px`,
|
|
890
902
|
position: "relative"
|
|
891
903
|
}
|
|
892
904
|
},
|
|
893
905
|
list: {
|
|
894
906
|
style: {
|
|
895
907
|
transform: `translateY(${x.current.get(
|
|
896
|
-
|
|
908
|
+
N[p.startIndex]
|
|
897
909
|
)?.offset || 0}px)`
|
|
898
910
|
}
|
|
899
911
|
}
|
|
900
912
|
},
|
|
901
913
|
scrollToBottom: P,
|
|
902
914
|
scrollToIndex: (v, T = "smooth") => {
|
|
903
|
-
if (l.current &&
|
|
904
|
-
const $ = x.current.get(
|
|
915
|
+
if (l.current && N[v]) {
|
|
916
|
+
const $ = x.current.get(N[v])?.offset || 0;
|
|
905
917
|
l.current.scrollTo({ top: $, behavior: T });
|
|
906
918
|
}
|
|
907
919
|
}
|
|
@@ -909,47 +921,47 @@ function _t(t, o, h, S) {
|
|
|
909
921
|
};
|
|
910
922
|
if (m === "stateMap")
|
|
911
923
|
return (s) => {
|
|
912
|
-
const [
|
|
913
|
-
|
|
914
|
-
), a = e.getState().getShadowValue(c,
|
|
915
|
-
if (!
|
|
924
|
+
const [o, r] = K(
|
|
925
|
+
h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys
|
|
926
|
+
), a = e.getState().getShadowValue(c, h?.validIds);
|
|
927
|
+
if (!o)
|
|
916
928
|
throw new Error("No array keys found for mapping");
|
|
917
929
|
const d = u({
|
|
918
930
|
currentState: a,
|
|
919
931
|
path: i,
|
|
920
932
|
componentId: M,
|
|
921
|
-
meta:
|
|
933
|
+
meta: h
|
|
922
934
|
});
|
|
923
935
|
return a.map((l, p) => {
|
|
924
|
-
const
|
|
936
|
+
const V = o[p]?.split(".").slice(1), _ = u({
|
|
925
937
|
currentState: l,
|
|
926
|
-
path:
|
|
938
|
+
path: V,
|
|
927
939
|
componentId: M,
|
|
928
|
-
meta:
|
|
940
|
+
meta: h
|
|
929
941
|
});
|
|
930
942
|
return s(
|
|
931
|
-
|
|
943
|
+
_,
|
|
932
944
|
p,
|
|
933
945
|
d
|
|
934
946
|
);
|
|
935
947
|
});
|
|
936
948
|
};
|
|
937
949
|
if (m === "$stateMap")
|
|
938
|
-
return (s) => lt(
|
|
950
|
+
return (s) => lt(qt, {
|
|
939
951
|
proxy: {
|
|
940
952
|
_stateKey: t,
|
|
941
953
|
_path: i,
|
|
942
954
|
_mapFn: s,
|
|
943
|
-
_meta:
|
|
955
|
+
_meta: h
|
|
944
956
|
},
|
|
945
957
|
rebuildStateShape: u
|
|
946
958
|
});
|
|
947
959
|
if (m === "stateFind")
|
|
948
960
|
return (s) => {
|
|
949
|
-
const
|
|
950
|
-
if (
|
|
951
|
-
for (let r = 0; r <
|
|
952
|
-
const a =
|
|
961
|
+
const o = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
|
|
962
|
+
if (o)
|
|
963
|
+
for (let r = 0; r < o.length; r++) {
|
|
964
|
+
const a = o[r];
|
|
953
965
|
if (!a) continue;
|
|
954
966
|
const d = e.getState().getShadowValue(a);
|
|
955
967
|
if (s(d, r)) {
|
|
@@ -958,7 +970,7 @@ function _t(t, o, h, S) {
|
|
|
958
970
|
currentState: d,
|
|
959
971
|
path: l,
|
|
960
972
|
componentId: M,
|
|
961
|
-
meta:
|
|
973
|
+
meta: h
|
|
962
974
|
// Pass along meta for potential further chaining
|
|
963
975
|
});
|
|
964
976
|
}
|
|
@@ -966,11 +978,11 @@ function _t(t, o, h, S) {
|
|
|
966
978
|
};
|
|
967
979
|
if (m === "stateFilter")
|
|
968
980
|
return (s) => {
|
|
969
|
-
const
|
|
970
|
-
if (!
|
|
981
|
+
const o = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
|
|
982
|
+
if (!o)
|
|
971
983
|
throw new Error("No array keys found for filtering.");
|
|
972
984
|
const r = [], a = w.filter(
|
|
973
|
-
(d, l) => s(d, l) ? (r.push(
|
|
985
|
+
(d, l) => s(d, l) ? (r.push(o[l]), !0) : !1
|
|
974
986
|
);
|
|
975
987
|
return u({
|
|
976
988
|
currentState: a,
|
|
@@ -979,7 +991,7 @@ function _t(t, o, h, S) {
|
|
|
979
991
|
meta: {
|
|
980
992
|
validIds: r,
|
|
981
993
|
transforms: [
|
|
982
|
-
...
|
|
994
|
+
...h?.transforms || [],
|
|
983
995
|
{
|
|
984
996
|
type: "filter",
|
|
985
997
|
fn: s
|
|
@@ -990,12 +1002,12 @@ function _t(t, o, h, S) {
|
|
|
990
1002
|
};
|
|
991
1003
|
if (m === "stateSort")
|
|
992
1004
|
return (s) => {
|
|
993
|
-
const
|
|
994
|
-
if (!
|
|
1005
|
+
const o = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
|
|
1006
|
+
if (!o)
|
|
995
1007
|
throw new Error("No array keys found for sorting");
|
|
996
1008
|
const r = w.map((a, d) => ({
|
|
997
1009
|
item: a,
|
|
998
|
-
key:
|
|
1010
|
+
key: o[d]
|
|
999
1011
|
}));
|
|
1000
1012
|
return r.sort((a, d) => s(a.item, d.item)).filter(Boolean), u({
|
|
1001
1013
|
currentState: r.map((a) => a.item),
|
|
@@ -1004,7 +1016,7 @@ function _t(t, o, h, S) {
|
|
|
1004
1016
|
meta: {
|
|
1005
1017
|
validIds: r.map((a) => a.key),
|
|
1006
1018
|
transforms: [
|
|
1007
|
-
...
|
|
1019
|
+
...h?.transforms || [],
|
|
1008
1020
|
{ type: "sort", fn: s }
|
|
1009
1021
|
]
|
|
1010
1022
|
}
|
|
@@ -1013,74 +1025,74 @@ function _t(t, o, h, S) {
|
|
|
1013
1025
|
if (m === "stream")
|
|
1014
1026
|
return function(s = {}) {
|
|
1015
1027
|
const {
|
|
1016
|
-
bufferSize:
|
|
1028
|
+
bufferSize: o = 100,
|
|
1017
1029
|
flushInterval: r = 100,
|
|
1018
1030
|
bufferStrategy: a = "accumulate",
|
|
1019
1031
|
store: d,
|
|
1020
1032
|
onFlush: l
|
|
1021
1033
|
} = s;
|
|
1022
|
-
let p = [],
|
|
1023
|
-
const U = (
|
|
1024
|
-
if (!
|
|
1025
|
-
if (a === "sliding" && p.length >=
|
|
1034
|
+
let p = [], V = !1, _ = null;
|
|
1035
|
+
const U = (j) => {
|
|
1036
|
+
if (!V) {
|
|
1037
|
+
if (a === "sliding" && p.length >= o)
|
|
1026
1038
|
p.shift();
|
|
1027
|
-
else if (a === "dropping" && p.length >=
|
|
1039
|
+
else if (a === "dropping" && p.length >= o)
|
|
1028
1040
|
return;
|
|
1029
|
-
p.push(
|
|
1041
|
+
p.push(j), p.length >= o && C();
|
|
1030
1042
|
}
|
|
1031
1043
|
}, C = () => {
|
|
1032
1044
|
if (p.length === 0) return;
|
|
1033
|
-
const
|
|
1045
|
+
const j = [...p];
|
|
1034
1046
|
if (p = [], d) {
|
|
1035
|
-
const b = d(
|
|
1047
|
+
const b = d(j);
|
|
1036
1048
|
b !== void 0 && (Array.isArray(b) ? b : [b]).forEach((P) => {
|
|
1037
|
-
|
|
1049
|
+
n(P, i, {
|
|
1038
1050
|
updateType: "insert"
|
|
1039
1051
|
});
|
|
1040
1052
|
});
|
|
1041
1053
|
} else
|
|
1042
|
-
|
|
1043
|
-
|
|
1054
|
+
j.forEach((b) => {
|
|
1055
|
+
n(b, i, {
|
|
1044
1056
|
updateType: "insert"
|
|
1045
1057
|
});
|
|
1046
1058
|
});
|
|
1047
|
-
l?.(
|
|
1059
|
+
l?.(j);
|
|
1048
1060
|
};
|
|
1049
|
-
r > 0 && (
|
|
1050
|
-
const F = rt(), x = e.getState().getShadowMetadata(t, i) || {},
|
|
1051
|
-
return
|
|
1061
|
+
r > 0 && (_ = setInterval(C, r));
|
|
1062
|
+
const F = rt(), x = e.getState().getShadowMetadata(t, i) || {}, N = x.streams || /* @__PURE__ */ new Map();
|
|
1063
|
+
return N.set(F, { buffer: p, flushTimer: _ }), e.getState().setShadowMetadata(t, i, {
|
|
1052
1064
|
...x,
|
|
1053
|
-
streams:
|
|
1065
|
+
streams: N
|
|
1054
1066
|
}), {
|
|
1055
|
-
write: (
|
|
1056
|
-
writeMany: (
|
|
1067
|
+
write: (j) => U(j),
|
|
1068
|
+
writeMany: (j) => j.forEach(U),
|
|
1057
1069
|
flush: () => C(),
|
|
1058
1070
|
pause: () => {
|
|
1059
|
-
|
|
1071
|
+
V = !0;
|
|
1060
1072
|
},
|
|
1061
1073
|
resume: () => {
|
|
1062
|
-
|
|
1074
|
+
V = !1, p.length > 0 && C();
|
|
1063
1075
|
},
|
|
1064
1076
|
close: () => {
|
|
1065
|
-
C(),
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1077
|
+
C(), _ && clearInterval(_);
|
|
1078
|
+
const j = e.getState().getShadowMetadata(t, i);
|
|
1079
|
+
j?.streams && j.streams.delete(F);
|
|
1068
1080
|
}
|
|
1069
1081
|
};
|
|
1070
1082
|
};
|
|
1071
1083
|
if (m === "stateList")
|
|
1072
1084
|
return (s) => /* @__PURE__ */ ot(() => {
|
|
1073
|
-
const r = q(/* @__PURE__ */ new Map()), a =
|
|
1085
|
+
const r = q(/* @__PURE__ */ new Map()), a = h?.transforms && h.transforms.length > 0 ? `${M}-${Bt(h.transforms)}` : `${M}-base`, [d, l] = K({}), { validIds: p, arrayValues: V } = St(() => {
|
|
1074
1086
|
const U = e.getState().getShadowMetadata(t, i)?.transformCaches?.get(a);
|
|
1075
1087
|
let C;
|
|
1076
1088
|
U && U.validIds ? C = U.validIds : (C = It(
|
|
1077
1089
|
t,
|
|
1078
1090
|
i,
|
|
1079
|
-
|
|
1091
|
+
h?.transforms
|
|
1080
1092
|
), e.getState().setTransformCache(t, i, a, {
|
|
1081
1093
|
validIds: C,
|
|
1082
1094
|
computedAt: Date.now(),
|
|
1083
|
-
transforms:
|
|
1095
|
+
transforms: h?.transforms || []
|
|
1084
1096
|
}));
|
|
1085
1097
|
const F = e.getState().getShadowValue(c, C);
|
|
1086
1098
|
return {
|
|
@@ -1088,44 +1100,44 @@ function _t(t, o, h, S) {
|
|
|
1088
1100
|
arrayValues: F || []
|
|
1089
1101
|
};
|
|
1090
1102
|
}, [a, d]);
|
|
1091
|
-
if (
|
|
1103
|
+
if (Z(() => {
|
|
1092
1104
|
const U = e.getState().subscribeToPath(c, (C) => {
|
|
1093
1105
|
if (C.type === "GET_SELECTED")
|
|
1094
1106
|
return;
|
|
1095
1107
|
const x = e.getState().getShadowMetadata(t, i)?.transformCaches;
|
|
1096
1108
|
if (x)
|
|
1097
|
-
for (const
|
|
1098
|
-
|
|
1109
|
+
for (const N of x.keys())
|
|
1110
|
+
N.startsWith(M) && x.delete(N);
|
|
1099
1111
|
(C.type === "INSERT" || C.type === "REMOVE" || C.type === "CLEAR_SELECTION") && l({});
|
|
1100
1112
|
});
|
|
1101
1113
|
return () => {
|
|
1102
1114
|
U();
|
|
1103
1115
|
};
|
|
1104
|
-
}, [M, c]), !Array.isArray(
|
|
1116
|
+
}, [M, c]), !Array.isArray(V))
|
|
1105
1117
|
return null;
|
|
1106
|
-
const
|
|
1107
|
-
currentState:
|
|
1118
|
+
const _ = u({
|
|
1119
|
+
currentState: V,
|
|
1108
1120
|
path: i,
|
|
1109
1121
|
componentId: M,
|
|
1110
1122
|
meta: {
|
|
1111
|
-
...
|
|
1123
|
+
...h,
|
|
1112
1124
|
validIds: p
|
|
1113
1125
|
}
|
|
1114
1126
|
});
|
|
1115
|
-
return
|
|
1127
|
+
return /* @__PURE__ */ ot(Ut, { children: V.map((U, C) => {
|
|
1116
1128
|
const F = p[C];
|
|
1117
1129
|
if (!F)
|
|
1118
1130
|
return null;
|
|
1119
1131
|
let x = r.current.get(F);
|
|
1120
1132
|
x || (x = rt(), r.current.set(F, x));
|
|
1121
|
-
const
|
|
1133
|
+
const N = F.split(".").slice(1);
|
|
1122
1134
|
return lt(Mt, {
|
|
1123
1135
|
key: F,
|
|
1124
1136
|
stateKey: t,
|
|
1125
1137
|
itemComponentId: x,
|
|
1126
|
-
itemPath:
|
|
1138
|
+
itemPath: N,
|
|
1127
1139
|
localIndex: C,
|
|
1128
|
-
arraySetter:
|
|
1140
|
+
arraySetter: _,
|
|
1129
1141
|
rebuildStateShape: u,
|
|
1130
1142
|
renderFn: s
|
|
1131
1143
|
});
|
|
@@ -1133,79 +1145,79 @@ function _t(t, o, h, S) {
|
|
|
1133
1145
|
}, {});
|
|
1134
1146
|
if (m === "stateFlattenOn")
|
|
1135
1147
|
return (s) => {
|
|
1136
|
-
const
|
|
1148
|
+
const o = w;
|
|
1137
1149
|
y.clear(), I++;
|
|
1138
|
-
const r =
|
|
1150
|
+
const r = o.flatMap(
|
|
1139
1151
|
(a) => a[s] ?? []
|
|
1140
1152
|
);
|
|
1141
1153
|
return u({
|
|
1142
1154
|
currentState: r,
|
|
1143
1155
|
path: [...i, "[*]", s],
|
|
1144
1156
|
componentId: M,
|
|
1145
|
-
meta:
|
|
1157
|
+
meta: h
|
|
1146
1158
|
});
|
|
1147
1159
|
};
|
|
1148
1160
|
if (m === "index")
|
|
1149
1161
|
return (s) => {
|
|
1150
1162
|
const r = e.getState().getShadowMetadata(t, i)?.arrayKeys?.filter(
|
|
1151
|
-
(l) => !
|
|
1163
|
+
(l) => !h?.validIds || h?.validIds && h?.validIds?.includes(l)
|
|
1152
1164
|
)?.[s];
|
|
1153
1165
|
if (!r) return;
|
|
1154
|
-
const a = e.getState().getShadowValue(r,
|
|
1166
|
+
const a = e.getState().getShadowValue(r, h?.validIds);
|
|
1155
1167
|
return u({
|
|
1156
1168
|
currentState: a,
|
|
1157
1169
|
path: r.split(".").slice(1),
|
|
1158
1170
|
componentId: M,
|
|
1159
|
-
meta:
|
|
1171
|
+
meta: h
|
|
1160
1172
|
});
|
|
1161
1173
|
};
|
|
1162
1174
|
if (m === "last")
|
|
1163
1175
|
return () => {
|
|
1164
1176
|
const s = e.getState().getShadowValue(t, i);
|
|
1165
1177
|
if (s.length === 0) return;
|
|
1166
|
-
const
|
|
1178
|
+
const o = s.length - 1, r = s[o], a = [...i, o.toString()];
|
|
1167
1179
|
return u({
|
|
1168
1180
|
currentState: r,
|
|
1169
1181
|
path: a,
|
|
1170
1182
|
componentId: M,
|
|
1171
|
-
meta:
|
|
1183
|
+
meta: h
|
|
1172
1184
|
});
|
|
1173
1185
|
};
|
|
1174
1186
|
if (m === "insert")
|
|
1175
|
-
return (s,
|
|
1187
|
+
return (s, o) => (n(s, i, { updateType: "insert" }), u({
|
|
1176
1188
|
currentState: e.getState().getShadowValue(t, i),
|
|
1177
1189
|
path: i,
|
|
1178
1190
|
componentId: M,
|
|
1179
|
-
meta:
|
|
1191
|
+
meta: h
|
|
1180
1192
|
}));
|
|
1181
1193
|
if (m === "uniqueInsert")
|
|
1182
|
-
return (s,
|
|
1194
|
+
return (s, o, r) => {
|
|
1183
1195
|
const a = e.getState().getShadowValue(t, i), d = at(s) ? s(a) : s;
|
|
1184
1196
|
let l = null;
|
|
1185
|
-
if (!a.some((
|
|
1186
|
-
const
|
|
1187
|
-
(U) => st(
|
|
1188
|
-
) : st(
|
|
1189
|
-
return
|
|
1197
|
+
if (!a.some((V) => {
|
|
1198
|
+
const _ = o ? o.every(
|
|
1199
|
+
(U) => st(V[U], d[U])
|
|
1200
|
+
) : st(V, d);
|
|
1201
|
+
return _ && (l = V), _;
|
|
1190
1202
|
}))
|
|
1191
|
-
|
|
1203
|
+
E(i), n(d, i, { updateType: "insert" });
|
|
1192
1204
|
else if (r && l) {
|
|
1193
|
-
const
|
|
1194
|
-
(U) => st(U, l) ?
|
|
1205
|
+
const V = r(l), _ = a.map(
|
|
1206
|
+
(U) => st(U, l) ? V : U
|
|
1195
1207
|
);
|
|
1196
|
-
|
|
1208
|
+
E(i), n(_, i, {
|
|
1197
1209
|
updateType: "update"
|
|
1198
1210
|
});
|
|
1199
1211
|
}
|
|
1200
1212
|
};
|
|
1201
1213
|
if (m === "cut")
|
|
1202
|
-
return (s,
|
|
1203
|
-
const r =
|
|
1214
|
+
return (s, o) => {
|
|
1215
|
+
const r = h?.validIds ?? e.getState().getShadowMetadata(t, i)?.arrayKeys;
|
|
1204
1216
|
if (!r || r.length === 0) return;
|
|
1205
1217
|
const a = s == -1 ? r.length - 1 : s !== void 0 ? s : r.length - 1, d = r[a];
|
|
1206
1218
|
if (!d) return;
|
|
1207
1219
|
const l = d.split(".").slice(1);
|
|
1208
|
-
|
|
1220
|
+
n(w, l, {
|
|
1209
1221
|
updateType: "cut"
|
|
1210
1222
|
});
|
|
1211
1223
|
};
|
|
@@ -1214,21 +1226,23 @@ function _t(t, o, h, S) {
|
|
|
1214
1226
|
const s = It(
|
|
1215
1227
|
t,
|
|
1216
1228
|
i,
|
|
1217
|
-
|
|
1229
|
+
h?.transforms
|
|
1218
1230
|
);
|
|
1219
1231
|
if (!s || s.length === 0) return;
|
|
1220
|
-
const
|
|
1232
|
+
const o = e.getState().selectedIndicesMap.get(c);
|
|
1221
1233
|
let r = s.findIndex(
|
|
1222
|
-
(
|
|
1234
|
+
(l) => l === o
|
|
1223
1235
|
);
|
|
1224
1236
|
const a = s[r == -1 ? s.length - 1 : r]?.split(".").slice(1);
|
|
1225
|
-
e.getState().clearSelectedIndex({ arrayKey: c })
|
|
1237
|
+
e.getState().clearSelectedIndex({ arrayKey: c });
|
|
1238
|
+
const d = a?.slice(0, -1);
|
|
1239
|
+
ft(t, d), n(w, a, {
|
|
1226
1240
|
updateType: "cut"
|
|
1227
1241
|
});
|
|
1228
1242
|
};
|
|
1229
1243
|
if (m === "cutByValue")
|
|
1230
1244
|
return (s) => {
|
|
1231
|
-
const
|
|
1245
|
+
const o = e.getState().getShadowMetadata(t, i), r = h?.validIds ?? o?.arrayKeys;
|
|
1232
1246
|
if (!r) return;
|
|
1233
1247
|
let a = null;
|
|
1234
1248
|
for (const d of r)
|
|
@@ -1238,12 +1252,12 @@ function _t(t, o, h, S) {
|
|
|
1238
1252
|
}
|
|
1239
1253
|
if (a) {
|
|
1240
1254
|
const d = a.split(".").slice(1);
|
|
1241
|
-
|
|
1255
|
+
n(null, d, { updateType: "cut" });
|
|
1242
1256
|
}
|
|
1243
1257
|
};
|
|
1244
1258
|
if (m === "toggleByValue")
|
|
1245
1259
|
return (s) => {
|
|
1246
|
-
const
|
|
1260
|
+
const o = e.getState().getShadowMetadata(t, i), r = h?.validIds ?? o?.arrayKeys;
|
|
1247
1261
|
if (!r) return;
|
|
1248
1262
|
let a = null;
|
|
1249
1263
|
for (const d of r) {
|
|
@@ -1255,21 +1269,21 @@ function _t(t, o, h, S) {
|
|
|
1255
1269
|
}
|
|
1256
1270
|
if (console.log("itemValue keyToCut", a), a) {
|
|
1257
1271
|
const d = a.split(".").slice(1);
|
|
1258
|
-
console.log("itemValue keyToCut", a),
|
|
1272
|
+
console.log("itemValue keyToCut", a), n(s, d, {
|
|
1259
1273
|
updateType: "cut"
|
|
1260
1274
|
});
|
|
1261
1275
|
} else
|
|
1262
|
-
|
|
1276
|
+
n(s, i, { updateType: "insert" });
|
|
1263
1277
|
};
|
|
1264
1278
|
if (m === "findWith")
|
|
1265
|
-
return (s,
|
|
1279
|
+
return (s, o) => {
|
|
1266
1280
|
const r = e.getState().getShadowMetadata(t, i)?.arrayKeys;
|
|
1267
1281
|
if (!r)
|
|
1268
1282
|
throw new Error("No array keys found for sorting");
|
|
1269
1283
|
let a = null, d = [];
|
|
1270
1284
|
for (const l of r) {
|
|
1271
|
-
let p = e.getState().getShadowValue(l,
|
|
1272
|
-
if (p && p[s] ===
|
|
1285
|
+
let p = e.getState().getShadowValue(l, h?.validIds);
|
|
1286
|
+
if (p && p[s] === o) {
|
|
1273
1287
|
a = p, d = l.split(".").slice(1);
|
|
1274
1288
|
break;
|
|
1275
1289
|
}
|
|
@@ -1278,29 +1292,29 @@ function _t(t, o, h, S) {
|
|
|
1278
1292
|
currentState: a,
|
|
1279
1293
|
path: d,
|
|
1280
1294
|
componentId: M,
|
|
1281
|
-
meta:
|
|
1295
|
+
meta: h
|
|
1282
1296
|
});
|
|
1283
1297
|
};
|
|
1284
1298
|
}
|
|
1285
1299
|
if (m === "cut") {
|
|
1286
1300
|
let s = e.getState().getShadowValue(i.join("."));
|
|
1287
1301
|
return () => {
|
|
1288
|
-
|
|
1302
|
+
n(s, i, { updateType: "cut" });
|
|
1289
1303
|
};
|
|
1290
1304
|
}
|
|
1291
1305
|
if (m === "get")
|
|
1292
|
-
return () => (
|
|
1306
|
+
return () => (Vt(t, M, i), e.getState().getShadowValue(c, h?.validIds));
|
|
1293
1307
|
if (m === "getState")
|
|
1294
|
-
return () => e.getState().getShadowValue(c,
|
|
1308
|
+
return () => e.getState().getShadowValue(c, h?.validIds);
|
|
1295
1309
|
if (m === "$derive")
|
|
1296
1310
|
return (s) => bt({
|
|
1297
1311
|
_stateKey: t,
|
|
1298
1312
|
_path: i,
|
|
1299
1313
|
_effect: s.toString(),
|
|
1300
|
-
_meta:
|
|
1314
|
+
_meta: h
|
|
1301
1315
|
});
|
|
1302
1316
|
if (m === "$get")
|
|
1303
|
-
return () => bt({ _stateKey: t, _path: i, _meta:
|
|
1317
|
+
return () => bt({ _stateKey: t, _path: i, _meta: h });
|
|
1304
1318
|
if (m === "lastSynced") {
|
|
1305
1319
|
const s = `${t}:${i.join(".")}`;
|
|
1306
1320
|
return e.getState().getSyncInfo(s);
|
|
@@ -1309,40 +1323,40 @@ function _t(t, o, h, S) {
|
|
|
1309
1323
|
return (s) => gt(S + "-" + t + "-" + s);
|
|
1310
1324
|
if (m === "isSelected") {
|
|
1311
1325
|
const s = [t, ...i].slice(0, -1);
|
|
1312
|
-
if (
|
|
1313
|
-
e.getState().getShadowValue(s.join("."),
|
|
1326
|
+
if (ft(t, i, void 0), Array.isArray(
|
|
1327
|
+
e.getState().getShadowValue(s.join("."), h?.validIds)
|
|
1314
1328
|
)) {
|
|
1315
1329
|
i[i.length - 1];
|
|
1316
|
-
const
|
|
1330
|
+
const o = s.join("."), r = e.getState().selectedIndicesMap.get(o), a = t + "." + i.join(".");
|
|
1317
1331
|
return r === a;
|
|
1318
1332
|
}
|
|
1319
1333
|
return;
|
|
1320
1334
|
}
|
|
1321
1335
|
if (m === "setSelected")
|
|
1322
1336
|
return (s) => {
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1337
|
+
const o = i.slice(0, -1), r = t + "." + o.join("."), a = t + "." + i.join(".");
|
|
1338
|
+
ft(t, o, void 0), e.getState().selectedIndicesMap.get(r), s && e.getState().setSelectedIndex(r, a);
|
|
1325
1339
|
};
|
|
1326
1340
|
if (m === "toggleSelected")
|
|
1327
1341
|
return () => {
|
|
1328
|
-
const s = i.slice(0, -1),
|
|
1329
|
-
e.getState().selectedIndicesMap.get(
|
|
1342
|
+
const s = i.slice(0, -1), o = t + "." + s.join("."), r = t + "." + i.join(".");
|
|
1343
|
+
e.getState().selectedIndicesMap.get(o) === r ? e.getState().clearSelectedIndex({ arrayKey: o }) : e.getState().setSelectedIndex(o, r);
|
|
1330
1344
|
};
|
|
1331
1345
|
if (m === "_componentId")
|
|
1332
1346
|
return M;
|
|
1333
1347
|
if (i.length == 0) {
|
|
1334
1348
|
if (m === "addValidation")
|
|
1335
1349
|
return (s) => {
|
|
1336
|
-
const
|
|
1337
|
-
if (!
|
|
1338
|
-
ut(
|
|
1339
|
-
const a = [
|
|
1340
|
-
|
|
1350
|
+
const o = e.getState().getInitialOptions(t)?.validation;
|
|
1351
|
+
if (!o?.key) throw new Error("Validation key not found");
|
|
1352
|
+
ut(o.key), s.forEach((r) => {
|
|
1353
|
+
const a = [o.key, ...r.path].join(".");
|
|
1354
|
+
pt(a, r.message);
|
|
1341
1355
|
}), it(t);
|
|
1342
1356
|
};
|
|
1343
1357
|
if (m === "applyJsonPatch")
|
|
1344
1358
|
return (s) => {
|
|
1345
|
-
const
|
|
1359
|
+
const o = e.getState(), r = o.getShadowMetadata(t, []);
|
|
1346
1360
|
if (!r?.components) return;
|
|
1347
1361
|
const a = (l) => !l || l === "/" ? [] : l.split("/").slice(1).map((p) => p.replace(/~1/g, "/").replace(/~0/g, "~")), d = /* @__PURE__ */ new Set();
|
|
1348
1362
|
for (const l of s) {
|
|
@@ -1350,40 +1364,40 @@ function _t(t, o, h, S) {
|
|
|
1350
1364
|
switch (l.op) {
|
|
1351
1365
|
case "add":
|
|
1352
1366
|
case "replace": {
|
|
1353
|
-
const { value:
|
|
1354
|
-
|
|
1355
|
-
let
|
|
1367
|
+
const { value: V } = l;
|
|
1368
|
+
o.updateShadowAtPath(t, p, V), o.markAsDirty(t, p, { bubble: !0 });
|
|
1369
|
+
let _ = [...p];
|
|
1356
1370
|
for (; ; ) {
|
|
1357
|
-
const U =
|
|
1371
|
+
const U = o.getShadowMetadata(
|
|
1358
1372
|
t,
|
|
1359
|
-
|
|
1373
|
+
_
|
|
1360
1374
|
);
|
|
1361
1375
|
if (console.log("pathMeta", U), U?.pathComponents && U.pathComponents.forEach((C) => {
|
|
1362
1376
|
if (!d.has(C)) {
|
|
1363
1377
|
const F = r.components?.get(C);
|
|
1364
1378
|
F && (F.forceUpdate(), d.add(C));
|
|
1365
1379
|
}
|
|
1366
|
-
}),
|
|
1367
|
-
|
|
1380
|
+
}), _.length === 0) break;
|
|
1381
|
+
_.pop();
|
|
1368
1382
|
}
|
|
1369
1383
|
break;
|
|
1370
1384
|
}
|
|
1371
1385
|
case "remove": {
|
|
1372
|
-
const
|
|
1373
|
-
|
|
1374
|
-
let
|
|
1386
|
+
const V = p.slice(0, -1);
|
|
1387
|
+
o.removeShadowArrayElement(t, p), o.markAsDirty(t, V, { bubble: !0 });
|
|
1388
|
+
let _ = [...V];
|
|
1375
1389
|
for (; ; ) {
|
|
1376
|
-
const U =
|
|
1390
|
+
const U = o.getShadowMetadata(
|
|
1377
1391
|
t,
|
|
1378
|
-
|
|
1392
|
+
_
|
|
1379
1393
|
);
|
|
1380
1394
|
if (U?.pathComponents && U.pathComponents.forEach((C) => {
|
|
1381
1395
|
if (!d.has(C)) {
|
|
1382
1396
|
const F = r.components?.get(C);
|
|
1383
1397
|
F && (F.forceUpdate(), d.add(C));
|
|
1384
1398
|
}
|
|
1385
|
-
}),
|
|
1386
|
-
|
|
1399
|
+
}), _.length === 0) break;
|
|
1400
|
+
_.pop();
|
|
1387
1401
|
}
|
|
1388
1402
|
break;
|
|
1389
1403
|
}
|
|
@@ -1392,19 +1406,19 @@ function _t(t, o, h, S) {
|
|
|
1392
1406
|
};
|
|
1393
1407
|
if (m === "validateZodSchema")
|
|
1394
1408
|
return () => {
|
|
1395
|
-
const s = e.getState().getInitialOptions(t)?.validation,
|
|
1396
|
-
if (!
|
|
1409
|
+
const s = e.getState().getInitialOptions(t)?.validation, o = s?.zodSchemaV4 || s?.zodSchemaV3;
|
|
1410
|
+
if (!o || !s?.key)
|
|
1397
1411
|
throw new Error(
|
|
1398
1412
|
"Zod schema (v3 or v4) or validation key not found"
|
|
1399
1413
|
);
|
|
1400
1414
|
ut(s.key);
|
|
1401
|
-
const r = e.getState().getShadowValue(t), a =
|
|
1415
|
+
const r = e.getState().getShadowValue(t), a = o.safeParse(r);
|
|
1402
1416
|
return a.success ? !0 : ("issues" in a.error ? a.error.issues.forEach((d) => {
|
|
1403
1417
|
const l = [s.key, ...d.path].join(".");
|
|
1404
|
-
|
|
1418
|
+
pt(l, d.message);
|
|
1405
1419
|
}) : a.error.errors.forEach((d) => {
|
|
1406
1420
|
const l = [s.key, ...d.path].join(".");
|
|
1407
|
-
|
|
1421
|
+
pt(l, d.message);
|
|
1408
1422
|
}), it(t), !1);
|
|
1409
1423
|
};
|
|
1410
1424
|
if (m === "getComponents")
|
|
@@ -1417,11 +1431,11 @@ function _t(t, o, h, S) {
|
|
|
1417
1431
|
if (m === "validationWrapper")
|
|
1418
1432
|
return ({
|
|
1419
1433
|
children: s,
|
|
1420
|
-
hideMessage:
|
|
1434
|
+
hideMessage: o
|
|
1421
1435
|
}) => /* @__PURE__ */ ot(
|
|
1422
1436
|
kt,
|
|
1423
1437
|
{
|
|
1424
|
-
formOpts:
|
|
1438
|
+
formOpts: o ? { validation: { message: "" } } : void 0,
|
|
1425
1439
|
path: i,
|
|
1426
1440
|
stateKey: t,
|
|
1427
1441
|
children: s
|
|
@@ -1430,14 +1444,14 @@ function _t(t, o, h, S) {
|
|
|
1430
1444
|
if (m === "_stateKey") return t;
|
|
1431
1445
|
if (m === "_path") return i;
|
|
1432
1446
|
if (m === "update")
|
|
1433
|
-
return (s) => (
|
|
1447
|
+
return (s) => (n(s, i, { updateType: "update" }), {
|
|
1434
1448
|
/**
|
|
1435
1449
|
* Marks this specific item, which was just updated, as 'synced' (not dirty).
|
|
1436
1450
|
*/
|
|
1437
1451
|
synced: () => {
|
|
1438
|
-
const
|
|
1452
|
+
const o = e.getState().getShadowMetadata(t, i);
|
|
1439
1453
|
e.getState().setShadowMetadata(t, i, {
|
|
1440
|
-
...
|
|
1454
|
+
...o,
|
|
1441
1455
|
isDirty: !1,
|
|
1442
1456
|
// EXPLICITLY set to false, not just undefined
|
|
1443
1457
|
stateSource: "server",
|
|
@@ -1457,20 +1471,20 @@ function _t(t, o, h, S) {
|
|
|
1457
1471
|
if (console.log("currentValueAtPath", s), typeof w != "boolean")
|
|
1458
1472
|
throw new Error("toggle() can only be used on boolean values");
|
|
1459
1473
|
return () => {
|
|
1460
|
-
|
|
1474
|
+
n(!s, i, {
|
|
1461
1475
|
updateType: "update"
|
|
1462
1476
|
});
|
|
1463
1477
|
};
|
|
1464
1478
|
}
|
|
1465
1479
|
if (m === "formElement")
|
|
1466
|
-
return (s,
|
|
1467
|
-
|
|
1480
|
+
return (s, o) => /* @__PURE__ */ ot(
|
|
1481
|
+
Zt,
|
|
1468
1482
|
{
|
|
1469
1483
|
stateKey: t,
|
|
1470
1484
|
path: i,
|
|
1471
1485
|
rebuildStateShape: u,
|
|
1472
|
-
setState:
|
|
1473
|
-
formOpts:
|
|
1486
|
+
setState: n,
|
|
1487
|
+
formOpts: o,
|
|
1474
1488
|
renderFn: s
|
|
1475
1489
|
}
|
|
1476
1490
|
);
|
|
@@ -1479,7 +1493,7 @@ function _t(t, o, h, S) {
|
|
|
1479
1493
|
currentState: X,
|
|
1480
1494
|
path: Q,
|
|
1481
1495
|
componentId: M,
|
|
1482
|
-
meta:
|
|
1496
|
+
meta: h
|
|
1483
1497
|
});
|
|
1484
1498
|
}
|
|
1485
1499
|
}, H = new Proxy(B, J);
|
|
@@ -1495,13 +1509,13 @@ function _t(t, o, h, S) {
|
|
|
1495
1509
|
revertToInitialState: (w) => {
|
|
1496
1510
|
const i = e.getState().getInitialOptions(t)?.validation;
|
|
1497
1511
|
i?.key && ut(i.key), w?.validationKey && ut(w.validationKey);
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1512
|
+
const h = e.getState().getShadowMetadata(t, []);
|
|
1513
|
+
h?.stateSource === "server" && h.baseServerState ? h.baseServerState : e.getState().initialStateGlobal[t];
|
|
1500
1514
|
const M = e.getState().initialStateGlobal[t];
|
|
1501
1515
|
e.getState().clearSelectedIndexesForState(t), y.clear(), I++, e.getState().initializeShadowState(t, M), u({
|
|
1502
1516
|
currentState: M,
|
|
1503
1517
|
path: [],
|
|
1504
|
-
componentId:
|
|
1518
|
+
componentId: g
|
|
1505
1519
|
});
|
|
1506
1520
|
const z = nt(t), c = at(z?.localStorage?.key) ? z?.localStorage?.key(M) : z?.localStorage?.key, B = `${S}-${t}-${c}`;
|
|
1507
1521
|
B && localStorage.removeItem(B);
|
|
@@ -1512,14 +1526,14 @@ function _t(t, o, h, S) {
|
|
|
1512
1526
|
},
|
|
1513
1527
|
updateInitialState: (w) => {
|
|
1514
1528
|
y.clear(), I++;
|
|
1515
|
-
const i =
|
|
1529
|
+
const i = Dt(
|
|
1516
1530
|
t,
|
|
1517
|
-
|
|
1518
|
-
|
|
1531
|
+
n,
|
|
1532
|
+
g,
|
|
1519
1533
|
S
|
|
1520
|
-
),
|
|
1534
|
+
), h = e.getState().initialStateGlobal[t], M = nt(t), z = at(M?.localStorage?.key) ? M?.localStorage?.key(h) : M?.localStorage?.key, c = `${S}-${t}-${z}`;
|
|
1521
1535
|
return localStorage.getItem(c) && localStorage.removeItem(c), Rt(() => {
|
|
1522
|
-
|
|
1536
|
+
_t(t, w), e.getState().initializeShadowState(t, w);
|
|
1523
1537
|
const B = e.getState().getShadowMetadata(t, []);
|
|
1524
1538
|
B && B?.components?.forEach((J) => {
|
|
1525
1539
|
J.forceUpdate();
|
|
@@ -1531,20 +1545,20 @@ function _t(t, o, h, S) {
|
|
|
1531
1545
|
};
|
|
1532
1546
|
return u({
|
|
1533
1547
|
currentState: e.getState().getShadowValue(t, []),
|
|
1534
|
-
componentId:
|
|
1548
|
+
componentId: g,
|
|
1535
1549
|
path: []
|
|
1536
1550
|
});
|
|
1537
1551
|
}
|
|
1538
1552
|
function bt(t) {
|
|
1539
|
-
return lt(
|
|
1553
|
+
return lt(Gt, { proxy: t });
|
|
1540
1554
|
}
|
|
1541
|
-
function
|
|
1555
|
+
function qt({
|
|
1542
1556
|
proxy: t,
|
|
1543
|
-
rebuildStateShape:
|
|
1557
|
+
rebuildStateShape: n
|
|
1544
1558
|
}) {
|
|
1545
|
-
const
|
|
1559
|
+
const g = q(null), S = q(`map-${crypto.randomUUID()}`), y = q(!1), I = q(/* @__PURE__ */ new Map());
|
|
1546
1560
|
Z(() => {
|
|
1547
|
-
const u =
|
|
1561
|
+
const u = g.current;
|
|
1548
1562
|
if (!u || y.current) return;
|
|
1549
1563
|
const f = setTimeout(() => {
|
|
1550
1564
|
const A = e.getState().getShadowMetadata(t._stateKey, t._path) || {}, w = A.mapWrappers || [];
|
|
@@ -1552,14 +1566,14 @@ function Bt({
|
|
|
1552
1566
|
instanceId: S.current,
|
|
1553
1567
|
mapFn: t._mapFn,
|
|
1554
1568
|
containerRef: u,
|
|
1555
|
-
rebuildStateShape:
|
|
1569
|
+
rebuildStateShape: n,
|
|
1556
1570
|
path: t._path,
|
|
1557
1571
|
componentId: S.current,
|
|
1558
1572
|
meta: t._meta
|
|
1559
1573
|
}), e.getState().setShadowMetadata(t._stateKey, t._path, {
|
|
1560
1574
|
...A,
|
|
1561
1575
|
mapWrappers: w
|
|
1562
|
-
}), y.current = !0,
|
|
1576
|
+
}), y.current = !0, E();
|
|
1563
1577
|
}, 0);
|
|
1564
1578
|
return () => {
|
|
1565
1579
|
if (clearTimeout(f), S.current) {
|
|
@@ -1571,22 +1585,22 @@ function Bt({
|
|
|
1571
1585
|
I.current.forEach((A) => A.unmount());
|
|
1572
1586
|
};
|
|
1573
1587
|
}, []);
|
|
1574
|
-
const
|
|
1575
|
-
const u =
|
|
1588
|
+
const E = () => {
|
|
1589
|
+
const u = g.current;
|
|
1576
1590
|
if (!u) return;
|
|
1577
1591
|
const f = e.getState().getShadowValue(
|
|
1578
1592
|
[t._stateKey, ...t._path].join("."),
|
|
1579
1593
|
t._meta?.validIds
|
|
1580
1594
|
);
|
|
1581
1595
|
if (!Array.isArray(f)) return;
|
|
1582
|
-
const A = t._meta?.validIds ?? e.getState().getShadowMetadata(t._stateKey, t._path)?.arrayKeys ?? [], w =
|
|
1596
|
+
const A = t._meta?.validIds ?? e.getState().getShadowMetadata(t._stateKey, t._path)?.arrayKeys ?? [], w = n({
|
|
1583
1597
|
currentState: f,
|
|
1584
1598
|
path: t._path,
|
|
1585
1599
|
componentId: S.current,
|
|
1586
1600
|
meta: t._meta
|
|
1587
1601
|
});
|
|
1588
|
-
f.forEach((i,
|
|
1589
|
-
const M = A[
|
|
1602
|
+
f.forEach((i, h) => {
|
|
1603
|
+
const M = A[h];
|
|
1590
1604
|
if (!M) return;
|
|
1591
1605
|
const z = rt(), c = document.createElement("div");
|
|
1592
1606
|
c.setAttribute("data-item-path", M), u.appendChild(c);
|
|
@@ -1598,42 +1612,42 @@ function Bt({
|
|
|
1598
1612
|
stateKey: t._stateKey,
|
|
1599
1613
|
itemComponentId: z,
|
|
1600
1614
|
itemPath: J,
|
|
1601
|
-
localIndex:
|
|
1615
|
+
localIndex: h,
|
|
1602
1616
|
arraySetter: w,
|
|
1603
|
-
rebuildStateShape:
|
|
1617
|
+
rebuildStateShape: n,
|
|
1604
1618
|
renderFn: t._mapFn
|
|
1605
1619
|
})
|
|
1606
1620
|
);
|
|
1607
1621
|
});
|
|
1608
1622
|
};
|
|
1609
|
-
return /* @__PURE__ */ ot("div", { ref:
|
|
1623
|
+
return /* @__PURE__ */ ot("div", { ref: g, "data-map-container": S.current });
|
|
1610
1624
|
}
|
|
1611
|
-
function
|
|
1625
|
+
function Gt({
|
|
1612
1626
|
proxy: t
|
|
1613
1627
|
}) {
|
|
1614
|
-
const
|
|
1628
|
+
const n = q(null), g = q(null), S = q(!1), y = `${t._stateKey}-${t._path.join(".")}`, I = e.getState().getShadowValue(
|
|
1615
1629
|
[t._stateKey, ...t._path].join("."),
|
|
1616
1630
|
t._meta?.validIds
|
|
1617
1631
|
);
|
|
1618
1632
|
return Z(() => {
|
|
1619
|
-
const
|
|
1620
|
-
if (!
|
|
1633
|
+
const E = n.current;
|
|
1634
|
+
if (!E || S.current) return;
|
|
1621
1635
|
const u = setTimeout(() => {
|
|
1622
|
-
if (!
|
|
1636
|
+
if (!E.parentElement) {
|
|
1623
1637
|
console.warn("Parent element not found for signal", y);
|
|
1624
1638
|
return;
|
|
1625
1639
|
}
|
|
1626
|
-
const f =
|
|
1640
|
+
const f = E.parentElement, w = Array.from(f.childNodes).indexOf(E);
|
|
1627
1641
|
let i = f.getAttribute("data-parent-id");
|
|
1628
|
-
i || (i = `parent-${crypto.randomUUID()}`, f.setAttribute("data-parent-id", i)),
|
|
1629
|
-
const
|
|
1642
|
+
i || (i = `parent-${crypto.randomUUID()}`, f.setAttribute("data-parent-id", i)), g.current = `instance-${crypto.randomUUID()}`;
|
|
1643
|
+
const h = e.getState().getShadowMetadata(t._stateKey, t._path) || {}, M = h.signals || [];
|
|
1630
1644
|
M.push({
|
|
1631
|
-
instanceId:
|
|
1645
|
+
instanceId: g.current,
|
|
1632
1646
|
parentId: i,
|
|
1633
1647
|
position: w,
|
|
1634
1648
|
effect: t._effect
|
|
1635
1649
|
}), e.getState().setShadowMetadata(t._stateKey, t._path, {
|
|
1636
|
-
...
|
|
1650
|
+
...h,
|
|
1637
1651
|
signals: M
|
|
1638
1652
|
});
|
|
1639
1653
|
let z = I;
|
|
@@ -1648,61 +1662,61 @@ function qt({
|
|
|
1648
1662
|
}
|
|
1649
1663
|
z !== null && typeof z == "object" && (z = JSON.stringify(z));
|
|
1650
1664
|
const c = document.createTextNode(String(z ?? ""));
|
|
1651
|
-
|
|
1665
|
+
E.replaceWith(c), S.current = !0;
|
|
1652
1666
|
}, 0);
|
|
1653
1667
|
return () => {
|
|
1654
|
-
if (clearTimeout(u),
|
|
1668
|
+
if (clearTimeout(u), g.current) {
|
|
1655
1669
|
const f = e.getState().getShadowMetadata(t._stateKey, t._path) || {};
|
|
1656
1670
|
f.signals && (f.signals = f.signals.filter(
|
|
1657
|
-
(A) => A.instanceId !==
|
|
1671
|
+
(A) => A.instanceId !== g.current
|
|
1658
1672
|
), e.getState().setShadowMetadata(t._stateKey, t._path, f));
|
|
1659
1673
|
}
|
|
1660
1674
|
};
|
|
1661
1675
|
}, []), lt("span", {
|
|
1662
|
-
ref:
|
|
1676
|
+
ref: n,
|
|
1663
1677
|
style: { display: "contents" },
|
|
1664
1678
|
"data-signal-id": y
|
|
1665
1679
|
});
|
|
1666
1680
|
}
|
|
1667
1681
|
const Mt = Ot(
|
|
1668
|
-
|
|
1669
|
-
(t,
|
|
1670
|
-
),
|
|
1671
|
-
const [
|
|
1682
|
+
Yt,
|
|
1683
|
+
(t, n) => t.itemPath.join(".") === n.itemPath.join(".") && t.stateKey === n.stateKey && t.itemComponentId === n.itemComponentId && t.localIndex === n.localIndex
|
|
1684
|
+
), Jt = (t) => {
|
|
1685
|
+
const [n, g] = K(!1);
|
|
1672
1686
|
return dt(() => {
|
|
1673
1687
|
if (!t.current) {
|
|
1674
|
-
|
|
1688
|
+
g(!0);
|
|
1675
1689
|
return;
|
|
1676
1690
|
}
|
|
1677
1691
|
const S = Array.from(t.current.querySelectorAll("img"));
|
|
1678
1692
|
if (S.length === 0) {
|
|
1679
|
-
|
|
1693
|
+
g(!0);
|
|
1680
1694
|
return;
|
|
1681
1695
|
}
|
|
1682
1696
|
let y = 0;
|
|
1683
1697
|
const I = () => {
|
|
1684
|
-
y++, y === S.length &&
|
|
1698
|
+
y++, y === S.length && g(!0);
|
|
1685
1699
|
};
|
|
1686
|
-
return S.forEach((
|
|
1687
|
-
|
|
1700
|
+
return S.forEach((E) => {
|
|
1701
|
+
E.complete ? I() : (E.addEventListener("load", I), E.addEventListener("error", I));
|
|
1688
1702
|
}), () => {
|
|
1689
|
-
S.forEach((
|
|
1690
|
-
|
|
1703
|
+
S.forEach((E) => {
|
|
1704
|
+
E.removeEventListener("load", I), E.removeEventListener("error", I);
|
|
1691
1705
|
});
|
|
1692
1706
|
};
|
|
1693
|
-
}, [t.current]),
|
|
1707
|
+
}, [t.current]), n;
|
|
1694
1708
|
};
|
|
1695
|
-
function
|
|
1709
|
+
function Yt({
|
|
1696
1710
|
stateKey: t,
|
|
1697
|
-
itemComponentId:
|
|
1698
|
-
itemPath:
|
|
1711
|
+
itemComponentId: n,
|
|
1712
|
+
itemPath: g,
|
|
1699
1713
|
localIndex: S,
|
|
1700
1714
|
arraySetter: y,
|
|
1701
1715
|
rebuildStateShape: I,
|
|
1702
|
-
renderFn:
|
|
1716
|
+
renderFn: E
|
|
1703
1717
|
}) {
|
|
1704
|
-
const [, u] = K({}), { ref: f, inView: A } =
|
|
1705
|
-
$t(t,
|
|
1718
|
+
const [, u] = K({}), { ref: f, inView: A } = jt(), w = q(null), i = Jt(w), h = q(!1), M = [t, ...g].join(".");
|
|
1719
|
+
$t(t, n, u);
|
|
1706
1720
|
const z = ct(
|
|
1707
1721
|
(W) => {
|
|
1708
1722
|
w.current = W, f(W);
|
|
@@ -1714,68 +1728,68 @@ function Jt({
|
|
|
1714
1728
|
u({});
|
|
1715
1729
|
});
|
|
1716
1730
|
}, []), Z(() => {
|
|
1717
|
-
if (!A || !i ||
|
|
1731
|
+
if (!A || !i || h.current)
|
|
1718
1732
|
return;
|
|
1719
1733
|
const W = w.current;
|
|
1720
1734
|
if (W && W.offsetHeight > 0) {
|
|
1721
|
-
|
|
1735
|
+
h.current = !0;
|
|
1722
1736
|
const m = W.offsetHeight;
|
|
1723
|
-
e.getState().setShadowMetadata(t,
|
|
1737
|
+
e.getState().setShadowMetadata(t, g, {
|
|
1724
1738
|
virtualizer: {
|
|
1725
1739
|
itemHeight: m,
|
|
1726
1740
|
domRef: W
|
|
1727
1741
|
}
|
|
1728
1742
|
});
|
|
1729
|
-
const Y =
|
|
1743
|
+
const Y = g.slice(0, -1), Q = [t, ...Y].join(".");
|
|
1730
1744
|
e.getState().notifyPathSubscribers(Q, {
|
|
1731
1745
|
type: "ITEMHEIGHT",
|
|
1732
|
-
itemKey:
|
|
1746
|
+
itemKey: g.join("."),
|
|
1733
1747
|
ref: w.current
|
|
1734
1748
|
});
|
|
1735
1749
|
}
|
|
1736
|
-
}, [A, i, t,
|
|
1737
|
-
const c = [t, ...
|
|
1750
|
+
}, [A, i, t, g]);
|
|
1751
|
+
const c = [t, ...g].join("."), B = e.getState().getShadowValue(c);
|
|
1738
1752
|
if (B === void 0)
|
|
1739
1753
|
return null;
|
|
1740
1754
|
const J = I({
|
|
1741
1755
|
currentState: B,
|
|
1742
|
-
path:
|
|
1743
|
-
componentId:
|
|
1744
|
-
}), H =
|
|
1756
|
+
path: g,
|
|
1757
|
+
componentId: n
|
|
1758
|
+
}), H = E(J, S, y);
|
|
1745
1759
|
return /* @__PURE__ */ ot("div", { ref: z, children: H });
|
|
1746
1760
|
}
|
|
1747
|
-
function
|
|
1761
|
+
function Zt({
|
|
1748
1762
|
stateKey: t,
|
|
1749
|
-
path:
|
|
1750
|
-
rebuildStateShape:
|
|
1763
|
+
path: n,
|
|
1764
|
+
rebuildStateShape: g,
|
|
1751
1765
|
renderFn: S,
|
|
1752
1766
|
formOpts: y,
|
|
1753
1767
|
setState: I
|
|
1754
1768
|
}) {
|
|
1755
|
-
const [
|
|
1756
|
-
$t(t,
|
|
1757
|
-
const A = e.getState().getShadowValue(f), [w, i] = K(A),
|
|
1769
|
+
const [E] = K(() => rt()), [, u] = K({}), f = [t, ...n].join(".");
|
|
1770
|
+
$t(t, E, u);
|
|
1771
|
+
const A = e.getState().getShadowValue(f), [w, i] = K(A), h = q(!1), M = q(null);
|
|
1758
1772
|
Z(() => {
|
|
1759
|
-
!
|
|
1773
|
+
!h.current && !st(A, w) && i(A);
|
|
1760
1774
|
}, [A]), Z(() => {
|
|
1761
1775
|
const H = e.getState().subscribeToPath(f, (W) => {
|
|
1762
|
-
!
|
|
1776
|
+
!h.current && w !== W && u({});
|
|
1763
1777
|
});
|
|
1764
1778
|
return () => {
|
|
1765
|
-
H(), M.current && (clearTimeout(M.current),
|
|
1779
|
+
H(), M.current && (clearTimeout(M.current), h.current = !1);
|
|
1766
1780
|
};
|
|
1767
1781
|
}, []);
|
|
1768
1782
|
const z = ct(
|
|
1769
1783
|
(H) => {
|
|
1770
|
-
typeof A === "number" && typeof H == "string" && (H = H === "" ? 0 : Number(H)), i(H),
|
|
1784
|
+
typeof A === "number" && typeof H == "string" && (H = H === "" ? 0 : Number(H)), i(H), h.current = !0, M.current && clearTimeout(M.current);
|
|
1771
1785
|
const m = y?.debounceTime ?? 200;
|
|
1772
1786
|
M.current = setTimeout(() => {
|
|
1773
|
-
|
|
1774
|
-
const { getInitialOptions: Y, setShadowMetadata: Q, getShadowMetadata: X } = e.getState(), s = Y(t)?.validation,
|
|
1775
|
-
if (
|
|
1776
|
-
const r = e.getState().getShadowValue(t), a =
|
|
1787
|
+
h.current = !1, I(H, n, { updateType: "update" });
|
|
1788
|
+
const { getInitialOptions: Y, setShadowMetadata: Q, getShadowMetadata: X } = e.getState(), s = Y(t)?.validation, o = s?.zodSchemaV4 || s?.zodSchemaV3;
|
|
1789
|
+
if (o) {
|
|
1790
|
+
const r = e.getState().getShadowValue(t), a = o.safeParse(r), d = X(t, n) || {};
|
|
1777
1791
|
if (a.success)
|
|
1778
|
-
Q(t,
|
|
1792
|
+
Q(t, n, {
|
|
1779
1793
|
...d,
|
|
1780
1794
|
validation: {
|
|
1781
1795
|
status: "VALID_LIVE",
|
|
@@ -1784,16 +1798,16 @@ function Yt({
|
|
|
1784
1798
|
});
|
|
1785
1799
|
else {
|
|
1786
1800
|
const p = ("issues" in a.error ? a.error.issues : a.error.errors).filter(
|
|
1787
|
-
(
|
|
1801
|
+
(V) => JSON.stringify(V.path) === JSON.stringify(n)
|
|
1788
1802
|
);
|
|
1789
|
-
p.length > 0 ? Q(t,
|
|
1803
|
+
p.length > 0 ? Q(t, n, {
|
|
1790
1804
|
...d,
|
|
1791
1805
|
validation: {
|
|
1792
1806
|
status: "INVALID_LIVE",
|
|
1793
1807
|
message: p[0]?.message,
|
|
1794
1808
|
validatedValue: H
|
|
1795
1809
|
}
|
|
1796
|
-
}) : Q(t,
|
|
1810
|
+
}) : Q(t, n, {
|
|
1797
1811
|
...d,
|
|
1798
1812
|
validation: {
|
|
1799
1813
|
status: "VALID_LIVE",
|
|
@@ -1804,13 +1818,13 @@ function Yt({
|
|
|
1804
1818
|
}
|
|
1805
1819
|
}, m), u({});
|
|
1806
1820
|
},
|
|
1807
|
-
[I,
|
|
1821
|
+
[I, n, y?.debounceTime, t]
|
|
1808
1822
|
), c = ct(async () => {
|
|
1809
|
-
console.log("handleBlur triggered"), M.current && (clearTimeout(M.current), M.current = null,
|
|
1823
|
+
console.log("handleBlur triggered"), M.current && (clearTimeout(M.current), M.current = null, h.current = !1, I(w, n, { updateType: "update" }));
|
|
1810
1824
|
const { getInitialOptions: H } = e.getState(), W = H(t)?.validation, m = W?.zodSchemaV4 || W?.zodSchemaV3;
|
|
1811
1825
|
if (!m) return;
|
|
1812
|
-
const Y = e.getState().getShadowMetadata(t,
|
|
1813
|
-
e.getState().setShadowMetadata(t,
|
|
1826
|
+
const Y = e.getState().getShadowMetadata(t, n);
|
|
1827
|
+
e.getState().setShadowMetadata(t, n, {
|
|
1814
1828
|
...Y,
|
|
1815
1829
|
validation: {
|
|
1816
1830
|
status: "DIRTY",
|
|
@@ -1819,7 +1833,7 @@ function Yt({
|
|
|
1819
1833
|
});
|
|
1820
1834
|
const Q = e.getState().getShadowValue(t), X = m.safeParse(Q);
|
|
1821
1835
|
if (console.log("result ", X), X.success)
|
|
1822
|
-
e.getState().setShadowMetadata(t,
|
|
1836
|
+
e.getState().setShadowMetadata(t, n, {
|
|
1823
1837
|
...Y,
|
|
1824
1838
|
validation: {
|
|
1825
1839
|
status: "VALID_PENDING_SYNC",
|
|
@@ -1828,45 +1842,45 @@ function Yt({
|
|
|
1828
1842
|
});
|
|
1829
1843
|
else {
|
|
1830
1844
|
const s = "issues" in X.error ? X.error.issues : X.error.errors;
|
|
1831
|
-
console.log("All validation errors:", s), console.log("Current blur path:",
|
|
1832
|
-
const
|
|
1833
|
-
if (console.log("Processing error:", r),
|
|
1845
|
+
console.log("All validation errors:", s), console.log("Current blur path:", n);
|
|
1846
|
+
const o = s.filter((r) => {
|
|
1847
|
+
if (console.log("Processing error:", r), n.some((d) => d.startsWith("id:"))) {
|
|
1834
1848
|
console.log("Detected array path with ULID");
|
|
1835
|
-
const d =
|
|
1849
|
+
const d = n[0].startsWith("id:") ? [] : n.slice(0, -1);
|
|
1836
1850
|
console.log("Parent path:", d);
|
|
1837
1851
|
const l = e.getState().getShadowMetadata(t, d);
|
|
1838
1852
|
if (console.log("Array metadata:", l), l?.arrayKeys) {
|
|
1839
|
-
const p = [t, ...
|
|
1840
|
-
console.log("Item key:", p, "Index:",
|
|
1841
|
-
const
|
|
1853
|
+
const p = [t, ...n.slice(0, -1)].join("."), V = l.arrayKeys.indexOf(p);
|
|
1854
|
+
console.log("Item key:", p, "Index:", V);
|
|
1855
|
+
const _ = [...d, V, ...n.slice(-1)], U = JSON.stringify(r.path) === JSON.stringify(_);
|
|
1842
1856
|
return console.log("Zod path comparison:", {
|
|
1843
|
-
zodPath:
|
|
1857
|
+
zodPath: _,
|
|
1844
1858
|
errorPath: r.path,
|
|
1845
1859
|
match: U
|
|
1846
1860
|
}), U;
|
|
1847
1861
|
}
|
|
1848
1862
|
}
|
|
1849
|
-
const a = JSON.stringify(r.path) === JSON.stringify(
|
|
1863
|
+
const a = JSON.stringify(r.path) === JSON.stringify(n);
|
|
1850
1864
|
return console.log("Direct path comparison:", {
|
|
1851
1865
|
errorPath: r.path,
|
|
1852
|
-
currentPath:
|
|
1866
|
+
currentPath: n,
|
|
1853
1867
|
match: a
|
|
1854
1868
|
}), a;
|
|
1855
1869
|
});
|
|
1856
|
-
console.log("Filtered path errors:",
|
|
1870
|
+
console.log("Filtered path errors:", o), e.getState().setShadowMetadata(t, n, {
|
|
1857
1871
|
...Y,
|
|
1858
1872
|
validation: {
|
|
1859
1873
|
status: "VALIDATION_FAILED",
|
|
1860
|
-
message:
|
|
1874
|
+
message: o[0]?.message,
|
|
1861
1875
|
validatedValue: w
|
|
1862
1876
|
}
|
|
1863
1877
|
});
|
|
1864
1878
|
}
|
|
1865
1879
|
u({});
|
|
1866
|
-
}, [t,
|
|
1880
|
+
}, [t, n, w, I]), B = g({
|
|
1867
1881
|
currentState: A,
|
|
1868
|
-
path:
|
|
1869
|
-
componentId:
|
|
1882
|
+
path: n,
|
|
1883
|
+
componentId: E
|
|
1870
1884
|
}), J = new Proxy(B, {
|
|
1871
1885
|
get(H, W) {
|
|
1872
1886
|
return W === "inputProps" ? {
|
|
@@ -1876,18 +1890,18 @@ function Yt({
|
|
|
1876
1890
|
},
|
|
1877
1891
|
// 5. Wire the new onBlur handler to the input props.
|
|
1878
1892
|
onBlur: c,
|
|
1879
|
-
ref: vt.getState().getFormRef(t + "." +
|
|
1893
|
+
ref: vt.getState().getFormRef(t + "." + n.join("."))
|
|
1880
1894
|
} : H[W];
|
|
1881
1895
|
}
|
|
1882
1896
|
});
|
|
1883
|
-
return /* @__PURE__ */ ot(kt, { formOpts: y, path:
|
|
1897
|
+
return /* @__PURE__ */ ot(kt, { formOpts: y, path: n, stateKey: t, children: S(J) });
|
|
1884
1898
|
}
|
|
1885
|
-
function $t(t,
|
|
1886
|
-
const S = `${t}////${
|
|
1899
|
+
function $t(t, n, g) {
|
|
1900
|
+
const S = `${t}////${n}`;
|
|
1887
1901
|
dt(() => {
|
|
1888
1902
|
const { registerComponent: y, unregisterComponent: I } = e.getState();
|
|
1889
1903
|
return y(t, S, {
|
|
1890
|
-
forceUpdate: () =>
|
|
1904
|
+
forceUpdate: () => g({}),
|
|
1891
1905
|
paths: /* @__PURE__ */ new Set(),
|
|
1892
1906
|
reactiveType: ["component"]
|
|
1893
1907
|
}), () => {
|
|
@@ -1897,9 +1911,10 @@ function $t(t, o, h) {
|
|
|
1897
1911
|
}
|
|
1898
1912
|
export {
|
|
1899
1913
|
bt as $cogsSignal,
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1914
|
+
ie as addStateOptions,
|
|
1915
|
+
Lt as createCogsState,
|
|
1916
|
+
ce as createCogsStateFromSync,
|
|
1917
|
+
ue as notifyComponent,
|
|
1918
|
+
zt as useCogsStateFn
|
|
1904
1919
|
};
|
|
1905
1920
|
//# sourceMappingURL=CogsState.jsx.map
|