cogsbox-state 0.5.257 → 0.5.259
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 +387 -381
- package/dist/CogsState.jsx.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +10 -3
package/dist/CogsState.jsx
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { transformStateFunc as
|
|
5
|
-
import { pushFunc as
|
|
6
|
-
import
|
|
7
|
-
import { v4 as
|
|
2
|
+
import { jsx as Ie } from "react/jsx-runtime";
|
|
3
|
+
import { useState as te, useRef as Y, useEffect as ie, useLayoutEffect as me, useMemo as $e, createElement as de, useSyncExternalStore as Ce, startTransition as _e, useCallback as ge } from "react";
|
|
4
|
+
import { transformStateFunc as Oe, isDeepEqual as L, isFunction as z, getNestedValue as H, getDifferences as ve, debounce as Me } from "./utility.js";
|
|
5
|
+
import { pushFunc as Se, updateFn as ee, cutFunc as se, ValidationWrapper as je, FormControlComponent as Fe } from "./Functions.jsx";
|
|
6
|
+
import Re from "superjson";
|
|
7
|
+
import { v4 as ye } from "uuid";
|
|
8
8
|
import "zod";
|
|
9
|
-
import { getGlobalStore as r, formRefStore as
|
|
10
|
-
import { useCogsConfig as
|
|
11
|
-
import { applyPatch as
|
|
12
|
-
function
|
|
13
|
-
const h = r.getState().getInitialOptions, g = r.getState().setInitialStateOptions, y = h(
|
|
14
|
-
g(
|
|
9
|
+
import { getGlobalStore as r, formRefStore as pe } from "./store.js";
|
|
10
|
+
import { useCogsConfig as xe } from "./CogsStateClient.jsx";
|
|
11
|
+
import { applyPatch as Ue } from "fast-json-patch";
|
|
12
|
+
function we(e, i) {
|
|
13
|
+
const h = r.getState().getInitialOptions, g = r.getState().setInitialStateOptions, y = h(e) || {};
|
|
14
|
+
g(e, {
|
|
15
15
|
...y,
|
|
16
16
|
...i
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
stateKey:
|
|
19
|
+
function Te({
|
|
20
|
+
stateKey: e,
|
|
21
21
|
options: i,
|
|
22
22
|
initialOptionsPart: h
|
|
23
23
|
}) {
|
|
24
|
-
const g = Z(
|
|
24
|
+
const g = Z(e) || {}, y = h[e] || {}, x = r.getState().setInitialStateOptions, T = { ...y, ...g };
|
|
25
25
|
let p = !1;
|
|
26
26
|
if (i)
|
|
27
27
|
for (const s in i)
|
|
28
28
|
T.hasOwnProperty(s) ? (s == "localStorage" && i[s] && T[s].key !== i[s]?.key && (p = !0, T[s] = i[s]), s == "initialState" && i[s] && T[s] !== i[s] && // Different references
|
|
29
29
|
!L(T[s], i[s]) && (p = !0, T[s] = i[s])) : (p = !0, T[s] = i[s]);
|
|
30
|
-
p && x(
|
|
30
|
+
p && x(e, T);
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return { initialState:
|
|
32
|
+
function at(e, { formElements: i, validation: h }) {
|
|
33
|
+
return { initialState: e, formElements: i, validation: h };
|
|
34
34
|
}
|
|
35
|
-
const
|
|
36
|
-
let h =
|
|
37
|
-
const [g, y] =
|
|
35
|
+
const st = (e, i) => {
|
|
36
|
+
let h = e;
|
|
37
|
+
const [g, y] = Oe(h);
|
|
38
38
|
(Object.keys(y).length > 0 || i && Object.keys(i).length > 0) && Object.keys(y).forEach((p) => {
|
|
39
39
|
y[p] = y[p] || {}, y[p].formElements = {
|
|
40
40
|
...i?.formElements,
|
|
@@ -45,18 +45,18 @@ const se = (t, i) => {
|
|
|
45
45
|
}, Z(p) || r.getState().setInitialStateOptions(p, y[p]);
|
|
46
46
|
}), r.getState().setInitialStates(g), r.getState().setCreatedState(g);
|
|
47
47
|
const x = (p, s) => {
|
|
48
|
-
const [
|
|
49
|
-
|
|
48
|
+
const [m] = te(s?.componentId ?? ye());
|
|
49
|
+
Te({
|
|
50
50
|
stateKey: p,
|
|
51
51
|
options: s,
|
|
52
52
|
initialOptionsPart: y
|
|
53
53
|
});
|
|
54
|
-
const o = r.getState().cogsStateStore[p] || g[p], S = s?.modifyState ? s.modifyState(o) : o, [D, j] =
|
|
54
|
+
const o = r.getState().cogsStateStore[p] || g[p], S = s?.modifyState ? s.modifyState(o) : o, [D, j] = qe(
|
|
55
55
|
S,
|
|
56
56
|
{
|
|
57
57
|
stateKey: p,
|
|
58
58
|
syncUpdate: s?.syncUpdate,
|
|
59
|
-
componentId:
|
|
59
|
+
componentId: m,
|
|
60
60
|
localStorage: s?.localStorage,
|
|
61
61
|
middleware: s?.middleware,
|
|
62
62
|
enabledSync: s?.enabledSync,
|
|
@@ -70,77 +70,77 @@ const se = (t, i) => {
|
|
|
70
70
|
return j;
|
|
71
71
|
};
|
|
72
72
|
function T(p, s) {
|
|
73
|
-
|
|
73
|
+
Te({ stateKey: p, options: s, initialOptionsPart: y }), s.localStorage && He(p, s), fe(p);
|
|
74
74
|
}
|
|
75
75
|
return { useCogsState: x, setCogsOptions: T };
|
|
76
76
|
}, {
|
|
77
|
-
setUpdaterState:
|
|
77
|
+
setUpdaterState: ce,
|
|
78
78
|
setState: J,
|
|
79
79
|
getInitialOptions: Z,
|
|
80
|
-
getKeyState:
|
|
81
|
-
getValidationErrors:
|
|
82
|
-
setStateLog:
|
|
83
|
-
updateInitialStateGlobal:
|
|
84
|
-
addValidationError:
|
|
80
|
+
getKeyState: Ae,
|
|
81
|
+
getValidationErrors: De,
|
|
82
|
+
setStateLog: We,
|
|
83
|
+
updateInitialStateGlobal: he,
|
|
84
|
+
addValidationError: Ge,
|
|
85
85
|
removeValidationError: q,
|
|
86
|
-
setServerSyncActions:
|
|
87
|
-
} = r.getState(),
|
|
86
|
+
setServerSyncActions: Le
|
|
87
|
+
} = r.getState(), Ee = (e, i, h, g, y) => {
|
|
88
88
|
h?.log && console.log(
|
|
89
89
|
"saving to localstorage",
|
|
90
90
|
i,
|
|
91
91
|
h.localStorage?.key,
|
|
92
92
|
g
|
|
93
93
|
);
|
|
94
|
-
const x = z(h?.localStorage?.key) ? h.localStorage?.key(
|
|
94
|
+
const x = z(h?.localStorage?.key) ? h.localStorage?.key(e) : h?.localStorage?.key;
|
|
95
95
|
if (x && g) {
|
|
96
96
|
const T = `${g}-${i}-${x}`;
|
|
97
97
|
let p;
|
|
98
98
|
try {
|
|
99
|
-
p =
|
|
99
|
+
p = ue(T)?.lastSyncedWithServer;
|
|
100
100
|
} catch {
|
|
101
101
|
}
|
|
102
102
|
const s = {
|
|
103
|
-
state:
|
|
103
|
+
state: e,
|
|
104
104
|
lastUpdated: Date.now(),
|
|
105
105
|
lastSyncedWithServer: y ?? p
|
|
106
|
-
},
|
|
106
|
+
}, m = Re.serialize(s);
|
|
107
107
|
window.localStorage.setItem(
|
|
108
108
|
T,
|
|
109
|
-
JSON.stringify(
|
|
109
|
+
JSON.stringify(m.json)
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
|
-
},
|
|
113
|
-
if (!
|
|
112
|
+
}, ue = (e) => {
|
|
113
|
+
if (!e) return null;
|
|
114
114
|
try {
|
|
115
|
-
const i = window.localStorage.getItem(
|
|
115
|
+
const i = window.localStorage.getItem(e);
|
|
116
116
|
return i ? JSON.parse(i) : null;
|
|
117
117
|
} catch (i) {
|
|
118
118
|
return console.error("Error loading from localStorage:", i), null;
|
|
119
119
|
}
|
|
120
|
-
},
|
|
121
|
-
const h = r.getState().cogsStateStore[
|
|
120
|
+
}, He = (e, i) => {
|
|
121
|
+
const h = r.getState().cogsStateStore[e], { sessionId: g } = xe(), y = z(i?.localStorage?.key) ? i.localStorage.key(h) : i?.localStorage?.key;
|
|
122
122
|
if (y && g) {
|
|
123
|
-
const x =
|
|
124
|
-
`${g}-${
|
|
123
|
+
const x = ue(
|
|
124
|
+
`${g}-${e}-${y}`
|
|
125
125
|
);
|
|
126
126
|
if (x && x.lastUpdated > (x.lastSyncedWithServer || 0))
|
|
127
|
-
return J(
|
|
127
|
+
return J(e, x.state), fe(e), !0;
|
|
128
128
|
}
|
|
129
129
|
return !1;
|
|
130
|
-
},
|
|
130
|
+
}, Ve = (e, i, h, g, y, x) => {
|
|
131
131
|
const T = {
|
|
132
132
|
initialState: i,
|
|
133
|
-
updaterState:
|
|
134
|
-
|
|
133
|
+
updaterState: le(
|
|
134
|
+
e,
|
|
135
135
|
g,
|
|
136
136
|
y,
|
|
137
137
|
x
|
|
138
138
|
),
|
|
139
139
|
state: h
|
|
140
140
|
};
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
const i = r.getState().stateComponents.get(
|
|
141
|
+
he(e, T.initialState), ce(e, T.updaterState), J(e, T.state);
|
|
142
|
+
}, fe = (e) => {
|
|
143
|
+
const i = r.getState().stateComponents.get(e);
|
|
144
144
|
if (!i) return;
|
|
145
145
|
const h = /* @__PURE__ */ new Set();
|
|
146
146
|
i.components.forEach((g) => {
|
|
@@ -148,16 +148,16 @@ const se = (t, i) => {
|
|
|
148
148
|
}), queueMicrotask(() => {
|
|
149
149
|
h.forEach((g) => g());
|
|
150
150
|
});
|
|
151
|
-
},
|
|
152
|
-
const h = r.getState().stateComponents.get(
|
|
151
|
+
}, it = (e, i) => {
|
|
152
|
+
const h = r.getState().stateComponents.get(e);
|
|
153
153
|
if (h) {
|
|
154
|
-
const g = `${
|
|
154
|
+
const g = `${e}////${i}`, y = h.components.get(g);
|
|
155
155
|
if ((y ? Array.isArray(y.reactiveType) ? y.reactiveType : [y.reactiveType || "component"] : null)?.includes("none"))
|
|
156
156
|
return;
|
|
157
157
|
y && y.forceUpdate();
|
|
158
158
|
}
|
|
159
|
-
},
|
|
160
|
-
switch (
|
|
159
|
+
}, Be = (e, i, h, g) => {
|
|
160
|
+
switch (e) {
|
|
161
161
|
case "update":
|
|
162
162
|
return {
|
|
163
163
|
oldValue: H(i, g),
|
|
@@ -179,7 +179,7 @@ const se = (t, i) => {
|
|
|
179
179
|
return { oldValue: null, newValue: null };
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
|
-
function
|
|
182
|
+
function qe(e, {
|
|
183
183
|
stateKey: i,
|
|
184
184
|
serverSync: h,
|
|
185
185
|
localStorage: g,
|
|
@@ -188,96 +188,96 @@ function qt(t, {
|
|
|
188
188
|
reactiveType: T,
|
|
189
189
|
componentId: p,
|
|
190
190
|
initialState: s,
|
|
191
|
-
syncUpdate:
|
|
191
|
+
syncUpdate: m,
|
|
192
192
|
dependencies: o,
|
|
193
193
|
serverState: S
|
|
194
194
|
} = {}) {
|
|
195
|
-
const [D, j] =
|
|
195
|
+
const [D, j] = te({}), { sessionId: F } = xe();
|
|
196
196
|
let W = !i;
|
|
197
|
-
const [
|
|
197
|
+
const [v] = te(i ?? ye()), l = r.getState().stateLog[v], ne = Y(/* @__PURE__ */ new Set()), B = Y(p ?? ye()), _ = Y(
|
|
198
198
|
null
|
|
199
199
|
);
|
|
200
|
-
_.current = Z(
|
|
201
|
-
if (
|
|
202
|
-
J(
|
|
200
|
+
_.current = Z(v) ?? null, ie(() => {
|
|
201
|
+
if (m && m.stateKey === v && m.path?.[0]) {
|
|
202
|
+
J(v, (n) => ({
|
|
203
203
|
...n,
|
|
204
|
-
[
|
|
204
|
+
[m.path[0]]: m.newValue
|
|
205
205
|
}));
|
|
206
|
-
const
|
|
207
|
-
r.getState().setSyncInfo(
|
|
208
|
-
timeStamp:
|
|
209
|
-
userId:
|
|
206
|
+
const t = `${m.stateKey}:${m.path.join(".")}`;
|
|
207
|
+
r.getState().setSyncInfo(t, {
|
|
208
|
+
timeStamp: m.timeStamp,
|
|
209
|
+
userId: m.userId
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
}, [
|
|
212
|
+
}, [m]), ie(() => {
|
|
213
213
|
if (s) {
|
|
214
|
-
|
|
214
|
+
we(v, {
|
|
215
215
|
initialState: s
|
|
216
216
|
});
|
|
217
|
-
const
|
|
217
|
+
const t = _.current, a = t?.serverState?.id !== void 0 && t?.serverState?.status === "success" && t?.serverState?.data, c = r.getState().initialStateGlobal[v];
|
|
218
218
|
if (!(c && !L(c, s) || !c) && !a)
|
|
219
219
|
return;
|
|
220
220
|
let u = null;
|
|
221
|
-
const b = z(
|
|
222
|
-
b && F && (u =
|
|
221
|
+
const b = z(t?.localStorage?.key) ? t?.localStorage?.key(s) : t?.localStorage?.key;
|
|
222
|
+
b && F && (u = ue(`${F}-${v}-${b}`));
|
|
223
223
|
let w = s, $ = !1;
|
|
224
|
-
const
|
|
225
|
-
a &&
|
|
226
|
-
|
|
224
|
+
const A = a ? Date.now() : 0, k = u?.lastUpdated || 0, O = u?.lastSyncedWithServer || 0;
|
|
225
|
+
a && A > k ? (w = t.serverState.data, $ = !0) : u && k > O && (w = u.state, t?.localStorage?.onChange && t?.localStorage?.onChange(w)), Ve(
|
|
226
|
+
v,
|
|
227
227
|
s,
|
|
228
228
|
w,
|
|
229
229
|
X,
|
|
230
230
|
B.current,
|
|
231
231
|
F
|
|
232
|
-
), $ && b && F &&
|
|
232
|
+
), $ && b && F && Ee(w, v, t, F, Date.now()), fe(v), (Array.isArray(T) ? T : [T || "component"]).includes("none") || j({});
|
|
233
233
|
}
|
|
234
234
|
}, [
|
|
235
235
|
s,
|
|
236
236
|
S?.status,
|
|
237
237
|
S?.data,
|
|
238
238
|
...o || []
|
|
239
|
-
]),
|
|
240
|
-
W &&
|
|
239
|
+
]), me(() => {
|
|
240
|
+
W && we(v, {
|
|
241
241
|
serverSync: h,
|
|
242
242
|
formElements: y,
|
|
243
243
|
initialState: s,
|
|
244
244
|
localStorage: g,
|
|
245
245
|
middleware: _.current?.middleware
|
|
246
246
|
});
|
|
247
|
-
const
|
|
247
|
+
const t = `${v}////${B.current}`, n = r.getState().stateComponents.get(v) || {
|
|
248
248
|
components: /* @__PURE__ */ new Map()
|
|
249
249
|
};
|
|
250
|
-
return n.components.set(
|
|
250
|
+
return n.components.set(t, {
|
|
251
251
|
forceUpdate: () => j({}),
|
|
252
252
|
paths: /* @__PURE__ */ new Set(),
|
|
253
253
|
deps: [],
|
|
254
254
|
depsFunction: x || void 0,
|
|
255
255
|
reactiveType: T ?? ["component", "deps"]
|
|
256
|
-
}), r.getState().stateComponents.set(
|
|
257
|
-
const a = `${
|
|
258
|
-
n && (n.components.delete(a), n.components.size === 0 && r.getState().stateComponents.delete(
|
|
256
|
+
}), r.getState().stateComponents.set(v, n), j({}), () => {
|
|
257
|
+
const a = `${v}////${B.current}`;
|
|
258
|
+
n && (n.components.delete(a), n.components.size === 0 && r.getState().stateComponents.delete(v));
|
|
259
259
|
};
|
|
260
260
|
}, []);
|
|
261
|
-
const X = (
|
|
261
|
+
const X = (t, n, a, c) => {
|
|
262
262
|
if (Array.isArray(n)) {
|
|
263
|
-
const f = `${
|
|
264
|
-
|
|
263
|
+
const f = `${v}-${n.join(".")}`;
|
|
264
|
+
ne.current.add(f);
|
|
265
265
|
}
|
|
266
|
-
J(
|
|
267
|
-
const u = z(
|
|
266
|
+
J(v, (f) => {
|
|
267
|
+
const u = z(t) ? t(f) : t, b = `${v}-${n.join(".")}`;
|
|
268
268
|
if (b) {
|
|
269
|
-
let R = !1,
|
|
270
|
-
if ((!
|
|
269
|
+
let R = !1, V = r.getState().signalDomElements.get(b);
|
|
270
|
+
if ((!V || V.size === 0) && (a.updateType === "insert" || a.updateType === "cut")) {
|
|
271
271
|
const M = n.slice(0, -1), E = H(u, M);
|
|
272
272
|
if (Array.isArray(E)) {
|
|
273
273
|
R = !0;
|
|
274
|
-
const I = `${
|
|
275
|
-
|
|
274
|
+
const I = `${v}-${M.join(".")}`;
|
|
275
|
+
V = r.getState().signalDomElements.get(I);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
if (
|
|
278
|
+
if (V) {
|
|
279
279
|
const M = R ? H(u, n.slice(0, -1)) : H(u, n);
|
|
280
|
-
|
|
280
|
+
V.forEach(({ parentId: E, position: I, effect: N }) => {
|
|
281
281
|
const C = document.querySelector(
|
|
282
282
|
`[data-parent-id="${E}"]`
|
|
283
283
|
);
|
|
@@ -297,18 +297,18 @@ function qt(t, {
|
|
|
297
297
|
const w = n.slice(0, n.length - 1);
|
|
298
298
|
a.updateType === "cut" && _.current?.validation?.key && q(
|
|
299
299
|
_.current?.validation?.key + "." + w.join(".")
|
|
300
|
-
), a.updateType === "insert" && _.current?.validation?.key &&
|
|
300
|
+
), a.updateType === "insert" && _.current?.validation?.key && De(
|
|
301
301
|
_.current?.validation?.key + "." + w.join(".")
|
|
302
|
-
).filter(([
|
|
303
|
-
let E =
|
|
304
|
-
if (
|
|
305
|
-
let I =
|
|
306
|
-
q(
|
|
302
|
+
).filter(([V, M]) => {
|
|
303
|
+
let E = V?.split(".").length;
|
|
304
|
+
if (V == w.join(".") && E == w.length - 1) {
|
|
305
|
+
let I = V + "." + w;
|
|
306
|
+
q(V), Ge(I, M);
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
|
-
const $ = r.getState().stateComponents.get(
|
|
309
|
+
const $ = r.getState().stateComponents.get(v);
|
|
310
310
|
if (console.log("stateEntry >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", $), $) {
|
|
311
|
-
const R =
|
|
311
|
+
const R = ve(f, u), V = new Set(R), M = a.updateType === "update" ? n.join(".") : n.slice(0, -1).join(".") || "";
|
|
312
312
|
for (const [
|
|
313
313
|
E,
|
|
314
314
|
I
|
|
@@ -321,7 +321,7 @@ function qt(t, {
|
|
|
321
321
|
continue;
|
|
322
322
|
}
|
|
323
323
|
if (C.includes("component") && ((I.paths.has(M) || I.paths.has("")) && (N = !0), !N))
|
|
324
|
-
for (const G of
|
|
324
|
+
for (const G of V) {
|
|
325
325
|
let P = G;
|
|
326
326
|
for (; ; ) {
|
|
327
327
|
if (I.paths.has(P)) {
|
|
@@ -330,17 +330,17 @@ function qt(t, {
|
|
|
330
330
|
}
|
|
331
331
|
const Q = P.lastIndexOf(".");
|
|
332
332
|
if (Q !== -1) {
|
|
333
|
-
const
|
|
333
|
+
const re = P.substring(
|
|
334
334
|
0,
|
|
335
335
|
Q
|
|
336
336
|
);
|
|
337
337
|
if (!isNaN(
|
|
338
338
|
Number(P.substring(Q + 1))
|
|
339
|
-
) && I.paths.has(
|
|
339
|
+
) && I.paths.has(re)) {
|
|
340
340
|
N = !0;
|
|
341
341
|
break;
|
|
342
342
|
}
|
|
343
|
-
P =
|
|
343
|
+
P = re;
|
|
344
344
|
} else
|
|
345
345
|
P = "";
|
|
346
346
|
if (P === "")
|
|
@@ -357,136 +357,136 @@ function qt(t, {
|
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
n = n.map((R,
|
|
360
|
+
const A = Date.now();
|
|
361
|
+
n = n.map((R, V) => {
|
|
362
362
|
const M = n.slice(0, -1), E = H(u, M);
|
|
363
|
-
return
|
|
363
|
+
return V === n.length - 1 && ["insert", "cut"].includes(a.updateType) ? (E.length - 1).toString() : R;
|
|
364
364
|
});
|
|
365
|
-
const { oldValue:
|
|
365
|
+
const { oldValue: k, newValue: O } = Be(
|
|
366
366
|
a.updateType,
|
|
367
367
|
f,
|
|
368
368
|
u,
|
|
369
369
|
n
|
|
370
370
|
), U = {
|
|
371
|
-
timeStamp:
|
|
372
|
-
stateKey:
|
|
371
|
+
timeStamp: A,
|
|
372
|
+
stateKey: v,
|
|
373
373
|
path: n,
|
|
374
374
|
updateType: a.updateType,
|
|
375
375
|
status: "new",
|
|
376
|
-
oldValue:
|
|
376
|
+
oldValue: k,
|
|
377
377
|
newValue: O
|
|
378
378
|
};
|
|
379
|
-
if (
|
|
379
|
+
if (We(v, (R) => {
|
|
380
380
|
const M = [...R ?? [], U].reduce((E, I) => {
|
|
381
381
|
const N = `${I.stateKey}:${JSON.stringify(I.path)}`, C = E.get(N);
|
|
382
382
|
return C ? (C.timeStamp = Math.max(C.timeStamp, I.timeStamp), C.newValue = I.newValue, C.oldValue = C.oldValue ?? I.oldValue, C.updateType = I.updateType) : E.set(N, { ...I }), E;
|
|
383
383
|
}, /* @__PURE__ */ new Map());
|
|
384
384
|
return Array.from(M.values());
|
|
385
|
-
}),
|
|
385
|
+
}), Ee(
|
|
386
386
|
u,
|
|
387
|
-
|
|
387
|
+
v,
|
|
388
388
|
_.current,
|
|
389
389
|
F
|
|
390
390
|
), _.current?.middleware && _.current.middleware({
|
|
391
391
|
updateLog: l,
|
|
392
392
|
update: U
|
|
393
393
|
}), _.current?.serverSync) {
|
|
394
|
-
const R = r.getState().serverState[
|
|
395
|
-
|
|
396
|
-
syncKey: typeof
|
|
394
|
+
const R = r.getState().serverState[v], V = _.current?.serverSync;
|
|
395
|
+
Le(v, {
|
|
396
|
+
syncKey: typeof V.syncKey == "string" ? V.syncKey : V.syncKey({ state: u }),
|
|
397
397
|
rollBackState: R,
|
|
398
|
-
actionTimeStamp: Date.now() + (
|
|
398
|
+
actionTimeStamp: Date.now() + (V.debounce ?? 3e3),
|
|
399
399
|
status: "waiting"
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
return u;
|
|
403
403
|
});
|
|
404
404
|
};
|
|
405
|
-
r.getState().updaterState[
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
405
|
+
r.getState().updaterState[v] || (ce(
|
|
406
|
+
v,
|
|
407
|
+
le(
|
|
408
|
+
v,
|
|
409
409
|
X,
|
|
410
410
|
B.current,
|
|
411
411
|
F
|
|
412
412
|
)
|
|
413
|
-
), r.getState().cogsStateStore[
|
|
414
|
-
const d = $
|
|
415
|
-
|
|
413
|
+
), r.getState().cogsStateStore[v] || J(v, e), r.getState().initialStateGlobal[v] || he(v, e));
|
|
414
|
+
const d = $e(() => le(
|
|
415
|
+
v,
|
|
416
416
|
X,
|
|
417
417
|
B.current,
|
|
418
418
|
F
|
|
419
|
-
), [
|
|
420
|
-
return [
|
|
419
|
+
), [v, F]);
|
|
420
|
+
return [Ae(v), d];
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function le(e, i, h, g) {
|
|
423
423
|
const y = /* @__PURE__ */ new Map();
|
|
424
424
|
let x = 0;
|
|
425
|
-
const T = (
|
|
426
|
-
const o =
|
|
425
|
+
const T = (m) => {
|
|
426
|
+
const o = m.join(".");
|
|
427
427
|
for (const [S] of y)
|
|
428
428
|
(S === o || S.startsWith(o + ".")) && y.delete(S);
|
|
429
429
|
x++;
|
|
430
430
|
}, p = {
|
|
431
|
-
removeValidation: (
|
|
432
|
-
|
|
431
|
+
removeValidation: (m) => {
|
|
432
|
+
m?.validationKey && q(m.validationKey);
|
|
433
433
|
},
|
|
434
|
-
revertToInitialState: (
|
|
435
|
-
const o = r.getState().getInitialOptions(
|
|
436
|
-
o?.key && q(o?.key),
|
|
437
|
-
const S = r.getState().initialStateGlobal[
|
|
438
|
-
r.getState().clearSelectedIndexesForState(
|
|
439
|
-
const D = s(S, []), j = Z(
|
|
440
|
-
W && localStorage.removeItem(W),
|
|
441
|
-
const
|
|
442
|
-
return
|
|
434
|
+
revertToInitialState: (m) => {
|
|
435
|
+
const o = r.getState().getInitialOptions(e)?.validation;
|
|
436
|
+
o?.key && q(o?.key), m?.validationKey && q(m.validationKey);
|
|
437
|
+
const S = r.getState().initialStateGlobal[e];
|
|
438
|
+
r.getState().clearSelectedIndexesForState(e), y.clear(), x++;
|
|
439
|
+
const D = s(S, []), j = Z(e), F = z(j?.localStorage?.key) ? j?.localStorage?.key(S) : j?.localStorage?.key, W = `${g}-${e}-${F}`;
|
|
440
|
+
W && localStorage.removeItem(W), ce(e, D), J(e, S);
|
|
441
|
+
const v = r.getState().stateComponents.get(e);
|
|
442
|
+
return v && v.components.forEach((l) => {
|
|
443
443
|
l.forceUpdate();
|
|
444
444
|
}), S;
|
|
445
445
|
},
|
|
446
|
-
updateInitialState: (
|
|
446
|
+
updateInitialState: (m) => {
|
|
447
447
|
y.clear(), x++;
|
|
448
|
-
const o =
|
|
449
|
-
|
|
448
|
+
const o = le(
|
|
449
|
+
e,
|
|
450
450
|
i,
|
|
451
451
|
h,
|
|
452
452
|
g
|
|
453
|
-
), S = r.getState().initialStateGlobal[
|
|
454
|
-
return localStorage.getItem(F) && localStorage.removeItem(F),
|
|
455
|
-
|
|
456
|
-
const W = r.getState().stateComponents.get(
|
|
457
|
-
W && W.components.forEach((
|
|
458
|
-
|
|
453
|
+
), S = r.getState().initialStateGlobal[e], D = Z(e), j = z(D?.localStorage?.key) ? D?.localStorage?.key(S) : D?.localStorage?.key, F = `${g}-${e}-${j}`;
|
|
454
|
+
return localStorage.getItem(F) && localStorage.removeItem(F), _e(() => {
|
|
455
|
+
he(e, m), ce(e, o), J(e, m);
|
|
456
|
+
const W = r.getState().stateComponents.get(e);
|
|
457
|
+
W && W.components.forEach((v) => {
|
|
458
|
+
v.forceUpdate();
|
|
459
459
|
});
|
|
460
460
|
}), {
|
|
461
461
|
fetchId: (W) => o.get()[W]
|
|
462
462
|
};
|
|
463
463
|
},
|
|
464
|
-
_initialState: r.getState().initialStateGlobal[
|
|
465
|
-
_serverState: r.getState().serverState[
|
|
466
|
-
_isLoading: r.getState().isLoadingGlobal[
|
|
464
|
+
_initialState: r.getState().initialStateGlobal[e],
|
|
465
|
+
_serverState: r.getState().serverState[e],
|
|
466
|
+
_isLoading: r.getState().isLoadingGlobal[e],
|
|
467
467
|
_isServerSynced: () => {
|
|
468
|
-
const
|
|
469
|
-
return !!(
|
|
468
|
+
const m = r.getState().serverState[e];
|
|
469
|
+
return !!(m && L(m, Ae(e)));
|
|
470
470
|
}
|
|
471
471
|
};
|
|
472
|
-
function s(
|
|
472
|
+
function s(m, o = [], S) {
|
|
473
473
|
const D = o.map(String).join(".");
|
|
474
474
|
y.get(D);
|
|
475
475
|
const j = function() {
|
|
476
|
-
return r().getNestedState(
|
|
476
|
+
return r().getNestedState(e, o);
|
|
477
477
|
};
|
|
478
|
-
Object.keys(p).forEach((
|
|
479
|
-
j[
|
|
478
|
+
Object.keys(p).forEach((v) => {
|
|
479
|
+
j[v] = p[v];
|
|
480
480
|
});
|
|
481
481
|
const F = {
|
|
482
|
-
apply(
|
|
482
|
+
apply(v, l, ne) {
|
|
483
483
|
return console.log(
|
|
484
|
-
`PROXY APPLY TRAP HIT: stateKey=${
|
|
485
|
-
), console.trace("Apply trap stack trace"), r().getNestedState(
|
|
484
|
+
`PROXY APPLY TRAP HIT: stateKey=${e}, path=${o.join(".")}`
|
|
485
|
+
), console.trace("Apply trap stack trace"), r().getNestedState(e, o);
|
|
486
486
|
},
|
|
487
|
-
get(
|
|
488
|
-
S?.validIndices && !Array.isArray(
|
|
489
|
-
const
|
|
487
|
+
get(v, l) {
|
|
488
|
+
S?.validIndices && !Array.isArray(m) && (S = { ...S, validIndices: void 0 });
|
|
489
|
+
const ne = /* @__PURE__ */ new Set([
|
|
490
490
|
"insert",
|
|
491
491
|
"cut",
|
|
492
492
|
"cutByValue",
|
|
@@ -509,10 +509,10 @@ function lt(t, i, h, g) {
|
|
|
509
509
|
"_stateKey",
|
|
510
510
|
"getComponents"
|
|
511
511
|
]);
|
|
512
|
-
if (l !== "then" && !l.startsWith("$") && l !== "stateMapNoRender" && !
|
|
513
|
-
const d = `${
|
|
514
|
-
if (
|
|
515
|
-
const n =
|
|
512
|
+
if (l !== "then" && !l.startsWith("$") && l !== "stateMapNoRender" && !ne.has(l)) {
|
|
513
|
+
const d = `${e}////${h}`, t = r.getState().stateComponents.get(e);
|
|
514
|
+
if (t) {
|
|
515
|
+
const n = t.components.get(d);
|
|
516
516
|
if (n && !n.paths.has("")) {
|
|
517
517
|
const a = o.join(".");
|
|
518
518
|
let c = !0;
|
|
@@ -526,111 +526,111 @@ function lt(t, i, h, g) {
|
|
|
526
526
|
}
|
|
527
527
|
}
|
|
528
528
|
if (l === "getDifferences")
|
|
529
|
-
return () =>
|
|
530
|
-
r.getState().cogsStateStore[
|
|
531
|
-
r.getState().initialStateGlobal[
|
|
529
|
+
return () => ve(
|
|
530
|
+
r.getState().cogsStateStore[e],
|
|
531
|
+
r.getState().initialStateGlobal[e]
|
|
532
532
|
);
|
|
533
533
|
if (l === "sync" && o.length === 0)
|
|
534
534
|
return async function() {
|
|
535
|
-
const d = r.getState().getInitialOptions(
|
|
536
|
-
if (!
|
|
537
|
-
return console.error(`No mutation defined for state key "${
|
|
538
|
-
const n = r.getState().getNestedState(
|
|
535
|
+
const d = r.getState().getInitialOptions(e), t = d?.sync;
|
|
536
|
+
if (!t)
|
|
537
|
+
return console.error(`No mutation defined for state key "${e}"`), { success: !1, error: "No mutation defined" };
|
|
538
|
+
const n = r.getState().getNestedState(e, []), a = d?.validation?.key;
|
|
539
539
|
try {
|
|
540
|
-
const c = await
|
|
540
|
+
const c = await t.action(n);
|
|
541
541
|
if (c && !c.success && c.errors && a) {
|
|
542
542
|
r.getState().removeValidationError(a), c.errors.forEach((u) => {
|
|
543
543
|
const b = [a, ...u.path].join(".");
|
|
544
544
|
r.getState().addValidationError(b, u.message);
|
|
545
545
|
});
|
|
546
|
-
const f = r.getState().stateComponents.get(
|
|
546
|
+
const f = r.getState().stateComponents.get(e);
|
|
547
547
|
f && f.components.forEach((u) => {
|
|
548
548
|
u.forceUpdate();
|
|
549
549
|
});
|
|
550
550
|
}
|
|
551
|
-
return c?.success &&
|
|
551
|
+
return c?.success && t.onSuccess ? t.onSuccess(c.data) : !c?.success && t.onError && t.onError(c.error), c;
|
|
552
552
|
} catch (c) {
|
|
553
|
-
return
|
|
553
|
+
return t.onError && t.onError(c), { success: !1, error: c };
|
|
554
554
|
}
|
|
555
555
|
};
|
|
556
556
|
if (l === "_status") {
|
|
557
|
-
const d = r.getState().getNestedState(
|
|
557
|
+
const d = r.getState().getNestedState(e, o), t = r.getState().initialStateGlobal[e], n = H(t, o);
|
|
558
558
|
return L(d, n) ? "fresh" : "stale";
|
|
559
559
|
}
|
|
560
560
|
if (l === "getStatus")
|
|
561
561
|
return function() {
|
|
562
562
|
const d = r().getNestedState(
|
|
563
|
-
|
|
563
|
+
e,
|
|
564
564
|
o
|
|
565
|
-
),
|
|
565
|
+
), t = r.getState().initialStateGlobal[e], n = H(t, o);
|
|
566
566
|
return L(d, n) ? "fresh" : "stale";
|
|
567
567
|
};
|
|
568
568
|
if (l === "removeStorage")
|
|
569
569
|
return () => {
|
|
570
|
-
const d = r.getState().initialStateGlobal[
|
|
570
|
+
const d = r.getState().initialStateGlobal[e], t = Z(e), n = z(t?.localStorage?.key) ? t?.localStorage?.key(d) : t?.localStorage?.key, a = `${g}-${e}-${n}`;
|
|
571
571
|
a && localStorage.removeItem(a);
|
|
572
572
|
};
|
|
573
573
|
if (l === "showValidationErrors")
|
|
574
574
|
return () => {
|
|
575
|
-
const d = r.getState().getInitialOptions(
|
|
575
|
+
const d = r.getState().getInitialOptions(e)?.validation;
|
|
576
576
|
if (!d?.key)
|
|
577
577
|
throw new Error("Validation key not found");
|
|
578
578
|
return r.getState().getValidationErrors(d.key + "." + o.join("."));
|
|
579
579
|
};
|
|
580
|
-
if (Array.isArray(
|
|
581
|
-
const d = () => S?.validIndices ?
|
|
580
|
+
if (Array.isArray(m)) {
|
|
581
|
+
const d = () => S?.validIndices ? m.map((n, a) => ({
|
|
582
582
|
item: n,
|
|
583
583
|
originalIndex: S.validIndices[a]
|
|
584
|
-
})) : r.getState().getNestedState(
|
|
584
|
+
})) : r.getState().getNestedState(e, o).map((n, a) => ({
|
|
585
585
|
item: n,
|
|
586
586
|
originalIndex: a
|
|
587
587
|
}));
|
|
588
588
|
if (l === "getSelected")
|
|
589
589
|
return () => {
|
|
590
|
-
const
|
|
591
|
-
if (
|
|
590
|
+
const t = r.getState().getSelectedIndex(e, o.join("."));
|
|
591
|
+
if (t !== void 0)
|
|
592
592
|
return s(
|
|
593
|
-
|
|
594
|
-
[...o,
|
|
593
|
+
m[t],
|
|
594
|
+
[...o, t.toString()],
|
|
595
595
|
S
|
|
596
596
|
);
|
|
597
597
|
};
|
|
598
598
|
if (l === "clearSelected")
|
|
599
599
|
return () => {
|
|
600
|
-
r.getState().clearSelectedIndex({ stateKey:
|
|
600
|
+
r.getState().clearSelectedIndex({ stateKey: e, path: o });
|
|
601
601
|
};
|
|
602
602
|
if (l === "getSelectedIndex")
|
|
603
|
-
return () => r.getState().getSelectedIndex(
|
|
603
|
+
return () => r.getState().getSelectedIndex(e, o.join(".")) ?? -1;
|
|
604
604
|
if (l === "useVirtualView")
|
|
605
|
-
return (
|
|
605
|
+
return (t) => {
|
|
606
606
|
const {
|
|
607
607
|
itemHeight: n,
|
|
608
608
|
overscan: a = 5,
|
|
609
609
|
stickToBottom: c = !1
|
|
610
|
-
} =
|
|
610
|
+
} = t;
|
|
611
611
|
if (typeof n != "number" || n <= 0)
|
|
612
612
|
throw new Error(
|
|
613
613
|
"[cogs-state] `useVirtualView` requires a positive number for `itemHeight` option."
|
|
614
614
|
);
|
|
615
|
-
const f = Y(null), u = Y(!0), [b, w] =
|
|
615
|
+
const f = Y(null), u = Y(!0), [b, w] = te({
|
|
616
616
|
startIndex: 0,
|
|
617
|
-
endIndex: Math.min(20,
|
|
618
|
-
}),
|
|
619
|
-
|
|
617
|
+
endIndex: Math.min(20, m.length)
|
|
618
|
+
}), A = r().getNestedState(
|
|
619
|
+
e,
|
|
620
620
|
o
|
|
621
|
-
).length,
|
|
622
|
-
|
|
621
|
+
).length, k = A * n, O = $e(() => s(m, o, S).stateFilter((I, N) => N >= b.startIndex && N < b.endIndex), [b.startIndex, b.endIndex, A]);
|
|
622
|
+
me(() => {
|
|
623
623
|
const E = f.current;
|
|
624
624
|
if (!E) return;
|
|
625
625
|
let I;
|
|
626
626
|
const N = () => {
|
|
627
627
|
if (!E) return;
|
|
628
|
-
const P = E.scrollTop, Q = E.clientHeight,
|
|
628
|
+
const P = E.scrollTop, Q = E.clientHeight, re = Math.floor(P / n), ke = Math.ceil(
|
|
629
629
|
(P + Q) / n
|
|
630
|
-
),
|
|
630
|
+
), oe = Math.max(0, re - a), ae = Math.min(A, ke + a);
|
|
631
631
|
w((K) => {
|
|
632
|
-
const
|
|
633
|
-
return
|
|
632
|
+
const Ne = Math.abs(K.startIndex - oe), Pe = Math.abs(K.endIndex - ae);
|
|
633
|
+
return Ne > a / 2 || Pe > a / 2 ? { startIndex: oe, endIndex: ae } : oe === 0 && K.startIndex !== 0 || ae === A && K.endIndex !== A ? { startIndex: oe, endIndex: ae } : K;
|
|
634
634
|
});
|
|
635
635
|
}, C = () => {
|
|
636
636
|
const P = f.current;
|
|
@@ -645,15 +645,15 @@ function lt(t, i, h, g) {
|
|
|
645
645
|
return G.observe(E), () => {
|
|
646
646
|
clearTimeout(I), E.removeEventListener("scroll", C), G.disconnect();
|
|
647
647
|
};
|
|
648
|
-
}, [
|
|
648
|
+
}, [A, n, a, c]), ie(() => {
|
|
649
649
|
c && u.current && f.current && (f.current.scrollTop = f.current.scrollHeight);
|
|
650
|
-
}, [
|
|
651
|
-
const U =
|
|
650
|
+
}, [A]);
|
|
651
|
+
const U = ge(
|
|
652
652
|
(E, I = "auto") => {
|
|
653
653
|
f.current?.scrollTo({ top: E, behavior: I });
|
|
654
654
|
},
|
|
655
655
|
[]
|
|
656
|
-
), R =
|
|
656
|
+
), R = ge(
|
|
657
657
|
(E = "smooth") => {
|
|
658
658
|
const I = f.current;
|
|
659
659
|
I && I.scrollTo({
|
|
@@ -662,7 +662,7 @@ function lt(t, i, h, g) {
|
|
|
662
662
|
});
|
|
663
663
|
},
|
|
664
664
|
[]
|
|
665
|
-
),
|
|
665
|
+
), V = ge(
|
|
666
666
|
(E, I = "smooth") => {
|
|
667
667
|
U(E * n, I);
|
|
668
668
|
},
|
|
@@ -679,7 +679,7 @@ function lt(t, i, h, g) {
|
|
|
679
679
|
inner: {
|
|
680
680
|
style: {
|
|
681
681
|
position: "relative",
|
|
682
|
-
height: `${
|
|
682
|
+
height: `${k}px`,
|
|
683
683
|
width: "100%"
|
|
684
684
|
}
|
|
685
685
|
},
|
|
@@ -697,13 +697,13 @@ function lt(t, i, h, g) {
|
|
|
697
697
|
virtualState: O,
|
|
698
698
|
virtualizerProps: M,
|
|
699
699
|
scrollToBottom: R,
|
|
700
|
-
scrollToIndex:
|
|
700
|
+
scrollToIndex: V
|
|
701
701
|
};
|
|
702
702
|
};
|
|
703
703
|
if (l === "stateSort")
|
|
704
|
-
return (
|
|
704
|
+
return (t) => {
|
|
705
705
|
const a = [...d()].sort(
|
|
706
|
-
(u, b) =>
|
|
706
|
+
(u, b) => t(u.item, b.item)
|
|
707
707
|
), c = a.map(({ item: u }) => u), f = {
|
|
708
708
|
...S,
|
|
709
709
|
validIndices: a.map(
|
|
@@ -713,9 +713,9 @@ function lt(t, i, h, g) {
|
|
|
713
713
|
return s(c, o, f);
|
|
714
714
|
};
|
|
715
715
|
if (l === "stateFilter")
|
|
716
|
-
return (
|
|
716
|
+
return (t) => {
|
|
717
717
|
const a = d().filter(
|
|
718
|
-
({ item: u }, b) =>
|
|
718
|
+
({ item: u }, b) => t(u, b)
|
|
719
719
|
), c = a.map(({ item: u }) => u), f = {
|
|
720
720
|
...S,
|
|
721
721
|
validIndices: a.map(
|
|
@@ -725,28 +725,28 @@ function lt(t, i, h, g) {
|
|
|
725
725
|
return s(c, o, f);
|
|
726
726
|
};
|
|
727
727
|
if (l === "stateMap")
|
|
728
|
-
return (
|
|
729
|
-
const n = r.getState().getNestedState(
|
|
728
|
+
return (t) => {
|
|
729
|
+
const n = r.getState().getNestedState(e, o);
|
|
730
730
|
return Array.isArray(n) ? n.map((a, c) => {
|
|
731
731
|
let f;
|
|
732
732
|
S?.validIndices && S.validIndices[c] !== void 0 ? f = S.validIndices[c] : f = c;
|
|
733
733
|
const u = [...o, f.toString()], b = s(a, u, S);
|
|
734
|
-
return
|
|
734
|
+
return t(a, b, {
|
|
735
735
|
register: () => {
|
|
736
|
-
const [, $] =
|
|
737
|
-
|
|
738
|
-
const
|
|
736
|
+
const [, $] = te({}), A = `${h}-${o.join(".")}-${f}`;
|
|
737
|
+
me(() => {
|
|
738
|
+
const k = `${e}////${A}`, O = r.getState().stateComponents.get(e) || {
|
|
739
739
|
components: /* @__PURE__ */ new Map()
|
|
740
740
|
};
|
|
741
|
-
return O.components.set(
|
|
741
|
+
return O.components.set(k, {
|
|
742
742
|
forceUpdate: () => $({}),
|
|
743
743
|
paths: /* @__PURE__ */ new Set([u.join(".")])
|
|
744
744
|
// ATOMIC: Subscribes only to this item's path.
|
|
745
|
-
}), r.getState().stateComponents.set(
|
|
746
|
-
const U = r.getState().stateComponents.get(
|
|
747
|
-
U && U.components.delete(
|
|
745
|
+
}), r.getState().stateComponents.set(e, O), () => {
|
|
746
|
+
const U = r.getState().stateComponents.get(e);
|
|
747
|
+
U && U.components.delete(k);
|
|
748
748
|
};
|
|
749
|
-
}, [
|
|
749
|
+
}, [e, A]);
|
|
750
750
|
},
|
|
751
751
|
index: c,
|
|
752
752
|
originalIndex: f
|
|
@@ -757,111 +757,111 @@ function lt(t, i, h, g) {
|
|
|
757
757
|
), null);
|
|
758
758
|
};
|
|
759
759
|
if (l === "stateMapNoRender")
|
|
760
|
-
return (
|
|
760
|
+
return (t) => m.map((a, c) => {
|
|
761
761
|
let f;
|
|
762
762
|
S?.validIndices && S.validIndices[c] !== void 0 ? f = S.validIndices[c] : f = c;
|
|
763
763
|
const u = [...o, f.toString()], b = s(a, u, S);
|
|
764
|
-
return
|
|
764
|
+
return t(
|
|
765
765
|
a,
|
|
766
766
|
b,
|
|
767
767
|
c,
|
|
768
|
-
|
|
769
|
-
s(
|
|
768
|
+
m,
|
|
769
|
+
s(m, o, S)
|
|
770
770
|
);
|
|
771
771
|
});
|
|
772
772
|
if (l === "$stateMap")
|
|
773
|
-
return (
|
|
773
|
+
return (t) => de(ze, {
|
|
774
774
|
proxy: {
|
|
775
|
-
_stateKey:
|
|
775
|
+
_stateKey: e,
|
|
776
776
|
_path: o,
|
|
777
|
-
_mapFn:
|
|
777
|
+
_mapFn: t
|
|
778
778
|
// Pass the actual function, not string
|
|
779
779
|
},
|
|
780
780
|
rebuildStateShape: s
|
|
781
781
|
});
|
|
782
782
|
if (l === "stateFlattenOn")
|
|
783
|
-
return (
|
|
784
|
-
const n =
|
|
783
|
+
return (t) => {
|
|
784
|
+
const n = m;
|
|
785
785
|
y.clear(), x++;
|
|
786
786
|
const a = n.flatMap(
|
|
787
|
-
(c) => c[
|
|
787
|
+
(c) => c[t] ?? []
|
|
788
788
|
);
|
|
789
789
|
return s(
|
|
790
790
|
a,
|
|
791
|
-
[...o, "[*]",
|
|
791
|
+
[...o, "[*]", t],
|
|
792
792
|
S
|
|
793
793
|
);
|
|
794
794
|
};
|
|
795
795
|
if (l === "index")
|
|
796
|
-
return (
|
|
797
|
-
const n =
|
|
798
|
-
return s(n, [...o,
|
|
796
|
+
return (t) => {
|
|
797
|
+
const n = m[t];
|
|
798
|
+
return s(n, [...o, t.toString()]);
|
|
799
799
|
};
|
|
800
800
|
if (l === "last")
|
|
801
801
|
return () => {
|
|
802
|
-
const
|
|
803
|
-
if (
|
|
804
|
-
const n =
|
|
802
|
+
const t = r.getState().getNestedState(e, o);
|
|
803
|
+
if (t.length === 0) return;
|
|
804
|
+
const n = t.length - 1, a = t[n], c = [...o, n.toString()];
|
|
805
805
|
return s(a, c);
|
|
806
806
|
};
|
|
807
807
|
if (l === "insert")
|
|
808
|
-
return (
|
|
809
|
-
r.getState().getNestedState(
|
|
808
|
+
return (t) => (T(o), Se(i, t, o, e), s(
|
|
809
|
+
r.getState().getNestedState(e, o),
|
|
810
810
|
o
|
|
811
811
|
));
|
|
812
812
|
if (l === "uniqueInsert")
|
|
813
|
-
return (
|
|
814
|
-
const c = r.getState().getNestedState(
|
|
813
|
+
return (t, n, a) => {
|
|
814
|
+
const c = r.getState().getNestedState(e, o), f = z(t) ? t(c) : t;
|
|
815
815
|
let u = null;
|
|
816
816
|
if (!c.some((w) => {
|
|
817
817
|
if (n) {
|
|
818
|
-
const
|
|
819
|
-
(
|
|
818
|
+
const A = n.every(
|
|
819
|
+
(k) => L(w[k], f[k])
|
|
820
820
|
);
|
|
821
|
-
return
|
|
821
|
+
return A && (u = w), A;
|
|
822
822
|
}
|
|
823
823
|
const $ = L(w, f);
|
|
824
824
|
return $ && (u = w), $;
|
|
825
825
|
}))
|
|
826
|
-
T(o),
|
|
826
|
+
T(o), Se(i, f, o, e);
|
|
827
827
|
else if (a && u) {
|
|
828
828
|
const w = a(u), $ = c.map(
|
|
829
|
-
(
|
|
829
|
+
(A) => L(A, u) ? w : A
|
|
830
830
|
);
|
|
831
|
-
T(o),
|
|
831
|
+
T(o), ee(i, $, o);
|
|
832
832
|
}
|
|
833
833
|
};
|
|
834
834
|
if (l === "cut")
|
|
835
|
-
return (
|
|
835
|
+
return (t, n) => {
|
|
836
836
|
if (!n?.waitForSync)
|
|
837
|
-
return T(o),
|
|
838
|
-
r.getState().getNestedState(
|
|
837
|
+
return T(o), se(i, o, e, t), s(
|
|
838
|
+
r.getState().getNestedState(e, o),
|
|
839
839
|
o
|
|
840
840
|
);
|
|
841
841
|
};
|
|
842
842
|
if (l === "cutByValue")
|
|
843
|
-
return (
|
|
844
|
-
for (let n = 0; n <
|
|
845
|
-
|
|
843
|
+
return (t) => {
|
|
844
|
+
for (let n = 0; n < m.length; n++)
|
|
845
|
+
m[n] === t && se(i, o, e, n);
|
|
846
846
|
};
|
|
847
847
|
if (l === "toggleByValue")
|
|
848
|
-
return (
|
|
849
|
-
const n =
|
|
850
|
-
n > -1 ?
|
|
848
|
+
return (t) => {
|
|
849
|
+
const n = m.findIndex((a) => a === t);
|
|
850
|
+
n > -1 ? se(i, o, e, n) : Se(i, t, o, e);
|
|
851
851
|
};
|
|
852
852
|
if (l === "stateFind")
|
|
853
|
-
return (
|
|
853
|
+
return (t) => {
|
|
854
854
|
const a = d().find(
|
|
855
|
-
({ item: f }, u) =>
|
|
855
|
+
({ item: f }, u) => t(f, u)
|
|
856
856
|
);
|
|
857
857
|
if (!a) return;
|
|
858
858
|
const c = [...o, a.originalIndex.toString()];
|
|
859
859
|
return s(a.item, c, S);
|
|
860
860
|
};
|
|
861
861
|
if (l === "findWith")
|
|
862
|
-
return (
|
|
862
|
+
return (t, n) => {
|
|
863
863
|
const c = d().find(
|
|
864
|
-
({ item: u }) => u[
|
|
864
|
+
({ item: u }) => u[t] === n
|
|
865
865
|
);
|
|
866
866
|
if (!c) return;
|
|
867
867
|
const f = [...o, c.originalIndex.toString()];
|
|
@@ -870,104 +870,110 @@ function lt(t, i, h, g) {
|
|
|
870
870
|
}
|
|
871
871
|
const B = o[o.length - 1];
|
|
872
872
|
if (!isNaN(Number(B))) {
|
|
873
|
-
const d = o.slice(0, -1),
|
|
874
|
-
if (Array.isArray(
|
|
875
|
-
return () =>
|
|
873
|
+
const d = o.slice(0, -1), t = r.getState().getNestedState(e, d);
|
|
874
|
+
if (Array.isArray(t) && l === "cut")
|
|
875
|
+
return () => se(
|
|
876
876
|
i,
|
|
877
877
|
d,
|
|
878
|
-
|
|
878
|
+
e,
|
|
879
879
|
Number(B)
|
|
880
880
|
);
|
|
881
881
|
}
|
|
882
882
|
if (l === "get")
|
|
883
|
-
return () =>
|
|
883
|
+
return () => {
|
|
884
|
+
if (S?.validIndices && Array.isArray(m)) {
|
|
885
|
+
const d = r.getState().getNestedState(e, o);
|
|
886
|
+
return S.validIndices.map((t) => d[t]);
|
|
887
|
+
}
|
|
888
|
+
return r.getState().getNestedState(e, o);
|
|
889
|
+
};
|
|
884
890
|
if (l === "$derive")
|
|
885
|
-
return (d) =>
|
|
886
|
-
_stateKey:
|
|
891
|
+
return (d) => be({
|
|
892
|
+
_stateKey: e,
|
|
887
893
|
_path: o,
|
|
888
894
|
_effect: d.toString()
|
|
889
895
|
});
|
|
890
896
|
if (l === "$get")
|
|
891
|
-
return () =>
|
|
892
|
-
_stateKey:
|
|
897
|
+
return () => be({
|
|
898
|
+
_stateKey: e,
|
|
893
899
|
_path: o
|
|
894
900
|
});
|
|
895
901
|
if (l === "lastSynced") {
|
|
896
|
-
const d = `${
|
|
902
|
+
const d = `${e}:${o.join(".")}`;
|
|
897
903
|
return r.getState().getSyncInfo(d);
|
|
898
904
|
}
|
|
899
905
|
if (l == "getLocalStorage")
|
|
900
|
-
return (d) =>
|
|
906
|
+
return (d) => ue(g + "-" + e + "-" + d);
|
|
901
907
|
if (l === "_selected") {
|
|
902
|
-
const d = o.slice(0, -1),
|
|
903
|
-
return Array.isArray(n) ? Number(o[o.length - 1]) === r.getState().getSelectedIndex(
|
|
908
|
+
const d = o.slice(0, -1), t = d.join("."), n = r.getState().getNestedState(e, d);
|
|
909
|
+
return Array.isArray(n) ? Number(o[o.length - 1]) === r.getState().getSelectedIndex(e, t) : void 0;
|
|
904
910
|
}
|
|
905
911
|
if (l === "setSelected")
|
|
906
912
|
return (d) => {
|
|
907
|
-
const
|
|
908
|
-
d ? r.getState().setSelectedIndex(
|
|
909
|
-
const c = r.getState().getNestedState(
|
|
910
|
-
|
|
913
|
+
const t = o.slice(0, -1), n = Number(o[o.length - 1]), a = t.join(".");
|
|
914
|
+
d ? r.getState().setSelectedIndex(e, a, n) : r.getState().setSelectedIndex(e, a, void 0);
|
|
915
|
+
const c = r.getState().getNestedState(e, [...t]);
|
|
916
|
+
ee(i, c, t), T(t);
|
|
911
917
|
};
|
|
912
918
|
if (l === "toggleSelected")
|
|
913
919
|
return () => {
|
|
914
|
-
const d = o.slice(0, -1),
|
|
920
|
+
const d = o.slice(0, -1), t = Number(o[o.length - 1]), n = d.join("."), a = r.getState().getSelectedIndex(e, n);
|
|
915
921
|
r.getState().setSelectedIndex(
|
|
916
|
-
|
|
922
|
+
e,
|
|
917
923
|
n,
|
|
918
|
-
a ===
|
|
924
|
+
a === t ? void 0 : t
|
|
919
925
|
);
|
|
920
|
-
const c = r.getState().getNestedState(
|
|
921
|
-
|
|
926
|
+
const c = r.getState().getNestedState(e, [...d]);
|
|
927
|
+
ee(i, c, d), T(d);
|
|
922
928
|
};
|
|
923
929
|
if (o.length == 0) {
|
|
924
930
|
if (l === "applyJsonPatch")
|
|
925
931
|
return (d) => {
|
|
926
|
-
const
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
r.getState().initialStateGlobal[
|
|
932
|
+
const t = r.getState().cogsStateStore[e], a = Ue(t, d).newDocument;
|
|
933
|
+
Ve(
|
|
934
|
+
e,
|
|
935
|
+
r.getState().initialStateGlobal[e],
|
|
930
936
|
a,
|
|
931
937
|
i,
|
|
932
938
|
h,
|
|
933
939
|
g
|
|
934
940
|
);
|
|
935
|
-
const c = r.getState().stateComponents.get(
|
|
941
|
+
const c = r.getState().stateComponents.get(e);
|
|
936
942
|
if (c) {
|
|
937
|
-
const f =
|
|
943
|
+
const f = ve(t, a), u = new Set(f);
|
|
938
944
|
for (const [
|
|
939
945
|
b,
|
|
940
946
|
w
|
|
941
947
|
] of c.components.entries()) {
|
|
942
948
|
let $ = !1;
|
|
943
|
-
const
|
|
944
|
-
if (!
|
|
945
|
-
if (
|
|
949
|
+
const A = Array.isArray(w.reactiveType) ? w.reactiveType : [w.reactiveType || "component"];
|
|
950
|
+
if (!A.includes("none")) {
|
|
951
|
+
if (A.includes("all")) {
|
|
946
952
|
w.forceUpdate();
|
|
947
953
|
continue;
|
|
948
954
|
}
|
|
949
|
-
if (
|
|
950
|
-
for (const
|
|
951
|
-
if (w.paths.has(
|
|
955
|
+
if (A.includes("component") && (w.paths.has("") && ($ = !0), !$))
|
|
956
|
+
for (const k of u) {
|
|
957
|
+
if (w.paths.has(k)) {
|
|
952
958
|
$ = !0;
|
|
953
959
|
break;
|
|
954
960
|
}
|
|
955
|
-
let O =
|
|
961
|
+
let O = k.lastIndexOf(".");
|
|
956
962
|
for (; O !== -1; ) {
|
|
957
|
-
const U =
|
|
963
|
+
const U = k.substring(0, O);
|
|
958
964
|
if (w.paths.has(U)) {
|
|
959
965
|
$ = !0;
|
|
960
966
|
break;
|
|
961
967
|
}
|
|
962
|
-
const R =
|
|
968
|
+
const R = k.substring(
|
|
963
969
|
O + 1
|
|
964
970
|
);
|
|
965
971
|
if (!isNaN(Number(R))) {
|
|
966
|
-
const
|
|
967
|
-
if (
|
|
972
|
+
const V = U.lastIndexOf(".");
|
|
973
|
+
if (V !== -1) {
|
|
968
974
|
const M = U.substring(
|
|
969
975
|
0,
|
|
970
|
-
|
|
976
|
+
V
|
|
971
977
|
);
|
|
972
978
|
if (w.paths.has(M)) {
|
|
973
979
|
$ = !0;
|
|
@@ -979,10 +985,10 @@ function lt(t, i, h, g) {
|
|
|
979
985
|
}
|
|
980
986
|
if ($) break;
|
|
981
987
|
}
|
|
982
|
-
if (!$ &&
|
|
983
|
-
const
|
|
988
|
+
if (!$ && A.includes("deps") && w.depsFunction) {
|
|
989
|
+
const k = w.depsFunction(a);
|
|
984
990
|
let O = !1;
|
|
985
|
-
typeof
|
|
991
|
+
typeof k == "boolean" ? k && (O = !0) : L(w.deps, k) || (w.deps = k, O = !0), O && ($ = !0);
|
|
986
992
|
}
|
|
987
993
|
$ && w.forceUpdate();
|
|
988
994
|
}
|
|
@@ -991,13 +997,13 @@ function lt(t, i, h, g) {
|
|
|
991
997
|
};
|
|
992
998
|
if (l === "validateZodSchema")
|
|
993
999
|
return () => {
|
|
994
|
-
const d = r.getState().getInitialOptions(
|
|
1000
|
+
const d = r.getState().getInitialOptions(e)?.validation, t = r.getState().addValidationError;
|
|
995
1001
|
if (!d?.zodSchema)
|
|
996
1002
|
throw new Error("Zod schema not found");
|
|
997
1003
|
if (!d?.key)
|
|
998
1004
|
throw new Error("Validation key not found");
|
|
999
1005
|
q(d.key);
|
|
1000
|
-
const n = r.getState().cogsStateStore[
|
|
1006
|
+
const n = r.getState().cogsStateStore[e];
|
|
1001
1007
|
try {
|
|
1002
1008
|
const a = r.getState().getValidationErrors(d.key);
|
|
1003
1009
|
a && a.length > 0 && a.forEach(([f]) => {
|
|
@@ -1006,75 +1012,75 @@ function lt(t, i, h, g) {
|
|
|
1006
1012
|
const c = d.zodSchema.safeParse(n);
|
|
1007
1013
|
return c.success ? !0 : (c.error.errors.forEach((u) => {
|
|
1008
1014
|
const b = u.path, w = u.message, $ = [d.key, ...b].join(".");
|
|
1009
|
-
|
|
1010
|
-
}),
|
|
1015
|
+
t($, w);
|
|
1016
|
+
}), fe(e), !1);
|
|
1011
1017
|
} catch (a) {
|
|
1012
1018
|
return console.error("Zod schema validation failed", a), !1;
|
|
1013
1019
|
}
|
|
1014
1020
|
};
|
|
1015
1021
|
if (l === "_componentId") return h;
|
|
1016
1022
|
if (l === "getComponents")
|
|
1017
|
-
return () => r().stateComponents.get(
|
|
1023
|
+
return () => r().stateComponents.get(e);
|
|
1018
1024
|
if (l === "getAllFormRefs")
|
|
1019
|
-
return () =>
|
|
1025
|
+
return () => pe.getState().getFormRefsByStateKey(e);
|
|
1020
1026
|
if (l === "_initialState")
|
|
1021
|
-
return r.getState().initialStateGlobal[
|
|
1027
|
+
return r.getState().initialStateGlobal[e];
|
|
1022
1028
|
if (l === "_serverState")
|
|
1023
|
-
return r.getState().serverState[
|
|
1029
|
+
return r.getState().serverState[e];
|
|
1024
1030
|
if (l === "_isLoading")
|
|
1025
|
-
return r.getState().isLoadingGlobal[
|
|
1031
|
+
return r.getState().isLoadingGlobal[e];
|
|
1026
1032
|
if (l === "revertToInitialState")
|
|
1027
1033
|
return p.revertToInitialState;
|
|
1028
1034
|
if (l === "updateInitialState") return p.updateInitialState;
|
|
1029
1035
|
if (l === "removeValidation") return p.removeValidation;
|
|
1030
1036
|
}
|
|
1031
1037
|
if (l === "getFormRef")
|
|
1032
|
-
return () =>
|
|
1038
|
+
return () => pe.getState().getFormRef(e + "." + o.join("."));
|
|
1033
1039
|
if (l === "validationWrapper")
|
|
1034
1040
|
return ({
|
|
1035
1041
|
children: d,
|
|
1036
|
-
hideMessage:
|
|
1037
|
-
}) => /* @__PURE__ */
|
|
1038
|
-
|
|
1042
|
+
hideMessage: t
|
|
1043
|
+
}) => /* @__PURE__ */ Ie(
|
|
1044
|
+
je,
|
|
1039
1045
|
{
|
|
1040
|
-
formOpts:
|
|
1046
|
+
formOpts: t ? { validation: { message: "" } } : void 0,
|
|
1041
1047
|
path: o,
|
|
1042
|
-
validationKey: r.getState().getInitialOptions(
|
|
1043
|
-
stateKey:
|
|
1048
|
+
validationKey: r.getState().getInitialOptions(e)?.validation?.key || "",
|
|
1049
|
+
stateKey: e,
|
|
1044
1050
|
validIndices: S?.validIndices,
|
|
1045
1051
|
children: d
|
|
1046
1052
|
}
|
|
1047
1053
|
);
|
|
1048
|
-
if (l === "_stateKey") return
|
|
1054
|
+
if (l === "_stateKey") return e;
|
|
1049
1055
|
if (l === "_path") return o;
|
|
1050
1056
|
if (l === "_isServerSynced") return p._isServerSynced;
|
|
1051
1057
|
if (l === "update")
|
|
1052
|
-
return (d,
|
|
1053
|
-
if (
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
const n = r.getState().getNestedState(
|
|
1057
|
-
|
|
1058
|
-
},
|
|
1058
|
+
return (d, t) => {
|
|
1059
|
+
if (t?.debounce)
|
|
1060
|
+
Me(() => {
|
|
1061
|
+
ee(i, d, o, "");
|
|
1062
|
+
const n = r.getState().getNestedState(e, o);
|
|
1063
|
+
t?.afterUpdate && t.afterUpdate(n);
|
|
1064
|
+
}, t.debounce);
|
|
1059
1065
|
else {
|
|
1060
|
-
|
|
1061
|
-
const n = r.getState().getNestedState(
|
|
1062
|
-
|
|
1066
|
+
ee(i, d, o, "");
|
|
1067
|
+
const n = r.getState().getNestedState(e, o);
|
|
1068
|
+
t?.afterUpdate && t.afterUpdate(n);
|
|
1063
1069
|
}
|
|
1064
1070
|
T(o);
|
|
1065
1071
|
};
|
|
1066
1072
|
if (l === "formElement")
|
|
1067
|
-
return (d,
|
|
1068
|
-
|
|
1073
|
+
return (d, t) => /* @__PURE__ */ Ie(
|
|
1074
|
+
Fe,
|
|
1069
1075
|
{
|
|
1070
1076
|
setState: i,
|
|
1071
|
-
stateKey:
|
|
1077
|
+
stateKey: e,
|
|
1072
1078
|
path: o,
|
|
1073
1079
|
child: d,
|
|
1074
|
-
formOpts:
|
|
1080
|
+
formOpts: t
|
|
1075
1081
|
}
|
|
1076
1082
|
);
|
|
1077
|
-
const _ = [...o, l], X = r.getState().getNestedState(
|
|
1083
|
+
const _ = [...o, l], X = r.getState().getNestedState(e, _);
|
|
1078
1084
|
return s(X, _, S);
|
|
1079
1085
|
}
|
|
1080
1086
|
}, W = new Proxy(j, F);
|
|
@@ -1084,48 +1090,48 @@ function lt(t, i, h, g) {
|
|
|
1084
1090
|
}), W;
|
|
1085
1091
|
}
|
|
1086
1092
|
return s(
|
|
1087
|
-
r.getState().getNestedState(
|
|
1093
|
+
r.getState().getNestedState(e, [])
|
|
1088
1094
|
);
|
|
1089
1095
|
}
|
|
1090
|
-
function
|
|
1091
|
-
return
|
|
1096
|
+
function be(e) {
|
|
1097
|
+
return de(Je, { proxy: e });
|
|
1092
1098
|
}
|
|
1093
|
-
function
|
|
1094
|
-
proxy:
|
|
1099
|
+
function ze({
|
|
1100
|
+
proxy: e,
|
|
1095
1101
|
rebuildStateShape: i
|
|
1096
1102
|
}) {
|
|
1097
|
-
const h = r().getNestedState(
|
|
1103
|
+
const h = r().getNestedState(e._stateKey, e._path);
|
|
1098
1104
|
return Array.isArray(h) ? i(
|
|
1099
1105
|
h,
|
|
1100
|
-
|
|
1106
|
+
e._path
|
|
1101
1107
|
).stateMapNoRender(
|
|
1102
|
-
(y, x, T, p, s) =>
|
|
1108
|
+
(y, x, T, p, s) => e._mapFn(y, x, T, p, s)
|
|
1103
1109
|
) : null;
|
|
1104
1110
|
}
|
|
1105
|
-
function
|
|
1106
|
-
proxy:
|
|
1111
|
+
function Je({
|
|
1112
|
+
proxy: e
|
|
1107
1113
|
}) {
|
|
1108
|
-
const i = Y(null), h = `${
|
|
1109
|
-
return
|
|
1114
|
+
const i = Y(null), h = `${e._stateKey}-${e._path.join(".")}`;
|
|
1115
|
+
return ie(() => {
|
|
1110
1116
|
const g = i.current;
|
|
1111
1117
|
if (!g || !g.parentElement) return;
|
|
1112
1118
|
const y = g.parentElement, T = Array.from(y.childNodes).indexOf(g);
|
|
1113
1119
|
let p = y.getAttribute("data-parent-id");
|
|
1114
1120
|
p || (p = `parent-${crypto.randomUUID()}`, y.setAttribute("data-parent-id", p));
|
|
1115
|
-
const
|
|
1121
|
+
const m = {
|
|
1116
1122
|
instanceId: `instance-${crypto.randomUUID()}`,
|
|
1117
1123
|
parentId: p,
|
|
1118
1124
|
position: T,
|
|
1119
|
-
effect:
|
|
1125
|
+
effect: e._effect
|
|
1120
1126
|
};
|
|
1121
|
-
r.getState().addSignalElement(h,
|
|
1122
|
-
const o = r.getState().getNestedState(
|
|
1127
|
+
r.getState().addSignalElement(h, m);
|
|
1128
|
+
const o = r.getState().getNestedState(e._stateKey, e._path);
|
|
1123
1129
|
let S;
|
|
1124
|
-
if (
|
|
1130
|
+
if (e._effect)
|
|
1125
1131
|
try {
|
|
1126
1132
|
S = new Function(
|
|
1127
1133
|
"state",
|
|
1128
|
-
`return (${
|
|
1134
|
+
`return (${e._effect})(state)`
|
|
1129
1135
|
)(o);
|
|
1130
1136
|
} catch (j) {
|
|
1131
1137
|
console.error("Error evaluating effect function during mount:", j), S = o;
|
|
@@ -1135,33 +1141,33 @@ function Jt({
|
|
|
1135
1141
|
S !== null && typeof S == "object" && (S = JSON.stringify(S));
|
|
1136
1142
|
const D = document.createTextNode(String(S));
|
|
1137
1143
|
g.replaceWith(D);
|
|
1138
|
-
}, [
|
|
1144
|
+
}, [e._stateKey, e._path.join("."), e._effect]), de("span", {
|
|
1139
1145
|
ref: i,
|
|
1140
1146
|
style: { display: "none" },
|
|
1141
1147
|
"data-signal-id": h
|
|
1142
1148
|
});
|
|
1143
1149
|
}
|
|
1144
|
-
function
|
|
1145
|
-
const i =
|
|
1150
|
+
function ct(e) {
|
|
1151
|
+
const i = Ce(
|
|
1146
1152
|
(h) => {
|
|
1147
|
-
const g = r.getState().stateComponents.get(
|
|
1153
|
+
const g = r.getState().stateComponents.get(e._stateKey) || {
|
|
1148
1154
|
components: /* @__PURE__ */ new Map()
|
|
1149
1155
|
};
|
|
1150
|
-
return g.components.set(
|
|
1156
|
+
return g.components.set(e._stateKey, {
|
|
1151
1157
|
forceUpdate: h,
|
|
1152
|
-
paths: /* @__PURE__ */ new Set([
|
|
1153
|
-
}), () => g.components.delete(
|
|
1158
|
+
paths: /* @__PURE__ */ new Set([e._path.join(".")])
|
|
1159
|
+
}), () => g.components.delete(e._stateKey);
|
|
1154
1160
|
},
|
|
1155
|
-
() => r.getState().getNestedState(
|
|
1161
|
+
() => r.getState().getNestedState(e._stateKey, e._path)
|
|
1156
1162
|
);
|
|
1157
|
-
return
|
|
1163
|
+
return de("text", {}, String(i));
|
|
1158
1164
|
}
|
|
1159
1165
|
export {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
+
be as $cogsSignal,
|
|
1167
|
+
ct as $cogsSignalStore,
|
|
1168
|
+
at as addStateOptions,
|
|
1169
|
+
st as createCogsState,
|
|
1170
|
+
it as notifyComponent,
|
|
1171
|
+
qe as useCogsStateFn
|
|
1166
1172
|
};
|
|
1167
1173
|
//# sourceMappingURL=CogsState.jsx.map
|