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