cogsbox-state 0.5.483 → 0.5.484
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CogsState.d.ts.map +1 -1
- package/dist/CogsState.js +360 -363
- package/dist/CogsState.js.map +1 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +202 -201
- package/dist/Components.js.map +1 -1
- package/dist/PluginRunner.d.ts.map +1 -1
- package/dist/PluginRunner.js +44 -44
- package/dist/PluginRunner.js.map +1 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +124 -118
- package/dist/store.js.map +1 -1
- package/package.json +1 -1
- package/src/CogsState.tsx +31 -27
- package/src/Components.tsx +13 -6
- package/src/PluginRunner.tsx +2 -1
- package/src/store.ts +24 -7
package/dist/store.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { create as N } from "zustand";
|
|
2
|
-
function
|
|
2
|
+
function A(f, o = "zod4") {
|
|
3
3
|
if (!f) return null;
|
|
4
4
|
let t = f, e = !1, n = !1, a, s = !1;
|
|
5
5
|
for (let l = 0; l < 20; l++) {
|
|
@@ -8,7 +8,10 @@ function v(f, o = "zod4") {
|
|
|
8
8
|
const y = d.typeName || d.type || t._type;
|
|
9
9
|
if (y === "ZodUnion" || y === "union")
|
|
10
10
|
if (d.options && d.options.length > 0) {
|
|
11
|
-
t = d.options
|
|
11
|
+
t = d.options.find((c) => {
|
|
12
|
+
const h = c?.def || c?._def, m = h?.typeName || h?.type || c?._type;
|
|
13
|
+
return m !== "ZodNull" && m !== "null" && m !== "ZodUndefined" && m !== "undefined";
|
|
14
|
+
}) ?? d.options[0];
|
|
12
15
|
continue;
|
|
13
16
|
} else
|
|
14
17
|
break;
|
|
@@ -20,10 +23,10 @@ function v(f, o = "zod4") {
|
|
|
20
23
|
s = !0, a = typeof d.defaultValue == "function" ? d.defaultValue() : d.defaultValue;
|
|
21
24
|
else if (y !== "ZodEffects" && y !== "effects")
|
|
22
25
|
break;
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
26
|
+
const b = d.innerType || d.schema || t._inner;
|
|
27
|
+
if (!b || b === t)
|
|
25
28
|
break;
|
|
26
|
-
t =
|
|
29
|
+
t = b;
|
|
27
30
|
}
|
|
28
31
|
const i = t, r = i?.def || i?._def, u = r?.typeName || r?.type || i?._type;
|
|
29
32
|
return u === "ZodNumber" || u === "number" ? {
|
|
@@ -70,7 +73,7 @@ function v(f, o = "zod4") {
|
|
|
70
73
|
optional: n
|
|
71
74
|
} : null;
|
|
72
75
|
}
|
|
73
|
-
function
|
|
76
|
+
function O(f) {
|
|
74
77
|
if (f === null)
|
|
75
78
|
return {
|
|
76
79
|
type: "unknown",
|
|
@@ -90,64 +93,64 @@ function A(f) {
|
|
|
90
93
|
const o = typeof f;
|
|
91
94
|
return o === "number" ? { type: "number", schema: null, source: "runtime", default: f } : o === "string" ? { type: "string", schema: null, source: "runtime", default: f } : o === "boolean" ? { type: "boolean", schema: null, source: "runtime", default: f } : Array.isArray(f) ? { type: "array", schema: null, source: "runtime", default: [] } : f instanceof Date ? { type: "date", schema: null, source: "runtime", default: f } : o === "object" ? { type: "object", schema: null, source: "runtime", default: {} } : { type: "unknown", schema: null, source: "runtime", default: f };
|
|
92
95
|
}
|
|
93
|
-
function
|
|
96
|
+
function g(f, o, t) {
|
|
94
97
|
if (o == null || typeof o != "object") {
|
|
95
98
|
const e = { _meta: { value: o } };
|
|
96
|
-
return e._meta.typeInfo =
|
|
99
|
+
return e._meta.typeInfo = v(o, t), e;
|
|
97
100
|
}
|
|
98
101
|
if (Array.isArray(o)) {
|
|
99
102
|
const e = { _meta: { arrayKeys: [] } };
|
|
100
|
-
return e._meta.typeInfo =
|
|
101
|
-
const s =
|
|
103
|
+
return e._meta.typeInfo = v(o, t), o.forEach((n, a) => {
|
|
104
|
+
const s = I(), i = t ? {
|
|
102
105
|
...t,
|
|
103
106
|
path: [...t.path, a.toString()]
|
|
104
107
|
} : void 0;
|
|
105
|
-
e[s] =
|
|
108
|
+
e[s] = g(f, n, i), e._meta.arrayKeys.push(s);
|
|
106
109
|
}), e;
|
|
107
110
|
}
|
|
108
111
|
if (o.constructor === Object) {
|
|
109
112
|
const e = { _meta: {} };
|
|
110
|
-
e._meta.typeInfo =
|
|
113
|
+
e._meta.typeInfo = v(o, t);
|
|
111
114
|
for (const n in o)
|
|
112
115
|
if (Object.prototype.hasOwnProperty.call(o, n)) {
|
|
113
116
|
const a = t ? {
|
|
114
117
|
...t,
|
|
115
118
|
path: [...t.path, n]
|
|
116
119
|
} : void 0;
|
|
117
|
-
e[n] =
|
|
120
|
+
e[n] = g(f, o[n], a);
|
|
118
121
|
}
|
|
119
122
|
return e;
|
|
120
123
|
}
|
|
121
124
|
return {
|
|
122
125
|
_meta: {
|
|
123
126
|
value: o,
|
|
124
|
-
typeInfo:
|
|
127
|
+
typeInfo: O(o)
|
|
125
128
|
}
|
|
126
129
|
};
|
|
127
130
|
}
|
|
128
|
-
function
|
|
131
|
+
function v(f, o) {
|
|
129
132
|
if (o) {
|
|
130
133
|
let t = null;
|
|
131
134
|
if (o.schemas.zodV4) {
|
|
132
135
|
const e = o.path.length === 0 ? o.schemas.zodV4 : E(o.schemas.zodV4, o.path);
|
|
133
|
-
e && (t =
|
|
136
|
+
e && (t = A(e, "zod4"));
|
|
134
137
|
}
|
|
135
138
|
if (!t && o.schemas.zodV3) {
|
|
136
139
|
const e = o.path.length === 0 ? o.schemas.zodV3 : E(o.schemas.zodV3, o.path);
|
|
137
|
-
e && (t =
|
|
140
|
+
e && (t = A(e, "zod3"));
|
|
138
141
|
}
|
|
139
|
-
if (!t && o.schemas.sync?.[o.stateKey] && (t =
|
|
142
|
+
if (!t && o.schemas.sync?.[o.stateKey] && (t = O(f), t.source = "sync"), t) return t;
|
|
140
143
|
}
|
|
141
|
-
return
|
|
144
|
+
return O(f);
|
|
142
145
|
}
|
|
143
|
-
function
|
|
144
|
-
const e =
|
|
146
|
+
function w(f, o, t) {
|
|
147
|
+
const e = S.get(f) || S.get(`[${f}`);
|
|
145
148
|
if (!e) return;
|
|
146
149
|
function n(a, s) {
|
|
147
150
|
if (!a || typeof a != "object") return;
|
|
148
151
|
const i = E(o, s);
|
|
149
152
|
if (i) {
|
|
150
|
-
const r =
|
|
153
|
+
const r = A(i, t);
|
|
151
154
|
r && (a._meta || (a._meta = {}), a._meta.typeInfo = {
|
|
152
155
|
...r,
|
|
153
156
|
schema: i
|
|
@@ -161,7 +164,7 @@ function j(f, o, t) {
|
|
|
161
164
|
}
|
|
162
165
|
n(e, []);
|
|
163
166
|
}
|
|
164
|
-
function
|
|
167
|
+
function z(f) {
|
|
165
168
|
let o = f;
|
|
166
169
|
for (; o; ) {
|
|
167
170
|
const t = o.def || o._def, e = t?.typeName || t?.type || o._type;
|
|
@@ -177,12 +180,13 @@ function E(f, o) {
|
|
|
177
180
|
if (o.length === 0) return f;
|
|
178
181
|
let t = f;
|
|
179
182
|
for (const e of o) {
|
|
180
|
-
const n =
|
|
183
|
+
const n = z(t);
|
|
181
184
|
if (!n) return null;
|
|
182
185
|
const a = n.def || n._def, s = a?.typeName || a?.type || n._type;
|
|
183
|
-
if (s === "ZodObject" || s === "object")
|
|
184
|
-
|
|
185
|
-
|
|
186
|
+
if (s === "ZodObject" || s === "object") {
|
|
187
|
+
const i = a?.shape ?? n.shape ?? n._shape;
|
|
188
|
+
t = (typeof i == "function" ? i() : i)?.[e];
|
|
189
|
+
} else if (s === "ZodArray" || s === "array")
|
|
186
190
|
t = n.element || a?.type;
|
|
187
191
|
else
|
|
188
192
|
return null;
|
|
@@ -191,11 +195,11 @@ function E(f, o) {
|
|
|
191
195
|
}
|
|
192
196
|
return t;
|
|
193
197
|
}
|
|
194
|
-
const
|
|
195
|
-
let
|
|
198
|
+
const S = /* @__PURE__ */ new Map();
|
|
199
|
+
let K = 0;
|
|
196
200
|
const V = Date.now().toString(36);
|
|
197
|
-
function
|
|
198
|
-
return `id:local_${V}_${(
|
|
201
|
+
function I(f) {
|
|
202
|
+
return `id:local_${V}_${(K++).toString(36)}`;
|
|
199
203
|
}
|
|
200
204
|
const C = N((f, o) => ({
|
|
201
205
|
getPluginMetaDataMap: (t, e) => o().getShadowMetadata(t, e)?.pluginMetaData,
|
|
@@ -219,75 +223,75 @@ const C = N((f, o) => ({
|
|
|
219
223
|
},
|
|
220
224
|
// Replace your entire `initializeAndMergeShadowState` function with this one.
|
|
221
225
|
initializeAndMergeShadowState: (t, e) => {
|
|
222
|
-
const a = e?._meta?.arrayKeys !== void 0 ? `[${t}` : t, s =
|
|
226
|
+
const a = e?._meta?.arrayKeys !== void 0 ? `[${t}` : t, s = S.get(a) || S.get(t) || S.get(`[${t}`);
|
|
223
227
|
let i = {};
|
|
224
228
|
if (s?._meta) {
|
|
225
229
|
const {
|
|
226
230
|
components: d,
|
|
227
231
|
features: y,
|
|
228
|
-
lastServerSync:
|
|
232
|
+
lastServerSync: b,
|
|
229
233
|
stateSource: p,
|
|
230
234
|
baseServerState: c,
|
|
231
|
-
pathComponents:
|
|
232
|
-
signals:
|
|
233
|
-
validation:
|
|
235
|
+
pathComponents: h,
|
|
236
|
+
signals: m,
|
|
237
|
+
validation: _
|
|
234
238
|
} = s._meta;
|
|
235
|
-
d && (i.components = d), y && (i.features = y),
|
|
239
|
+
d && (i.components = d), y && (i.features = y), b && (i.lastServerSync = b), p && (i.stateSource = p), c && (i.baseServerState = c), h && (i.pathComponents = h), m && (i.signals = m), _ && (i.validation = _);
|
|
236
240
|
}
|
|
237
241
|
function r(d, y) {
|
|
238
242
|
if (y._meta || d._meta) {
|
|
239
|
-
const c = d._meta || {},
|
|
240
|
-
c.typeInfo?.schema && !
|
|
243
|
+
const c = d._meta || {}, h = y._meta || {}, m = { ...c, ...h };
|
|
244
|
+
c.typeInfo?.schema && !h.typeInfo?.schema && (m.typeInfo = c.typeInfo), c.validation && !h.validation && (m.validation = c.validation), c.components && (m.components = c.components), c.clientActivityState && !h.clientActivityState && (m.clientActivityState = c.clientActivityState), c.pluginMetaData && !h.pluginMetaData && (m.pluginMetaData = c.pluginMetaData), d._meta = m;
|
|
241
245
|
}
|
|
242
246
|
if (y._meta?.hasOwnProperty("value")) {
|
|
243
247
|
for (const c in d)
|
|
244
248
|
c !== "_meta" && delete d[c];
|
|
245
249
|
return;
|
|
246
250
|
}
|
|
247
|
-
const
|
|
251
|
+
const b = new Set(
|
|
248
252
|
Object.keys(y).filter((c) => c !== "_meta")
|
|
249
253
|
), p = new Set(
|
|
250
254
|
Object.keys(d).filter((c) => c !== "_meta")
|
|
251
255
|
);
|
|
252
256
|
for (const c of p)
|
|
253
|
-
|
|
254
|
-
for (const c of
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
+
b.has(c) || delete d[c];
|
|
258
|
+
for (const c of b) {
|
|
259
|
+
const h = y[c], m = d[c];
|
|
260
|
+
m && typeof m == "object" && h && typeof h == "object" ? r(m, h) : d[c] = h;
|
|
257
261
|
}
|
|
258
262
|
}
|
|
259
|
-
s ? (r(s, e), s._meta || (s._meta = {}), Object.assign(s._meta, i),
|
|
263
|
+
s ? (r(s, e), s._meta || (s._meta = {}), Object.assign(s._meta, i), S.set(a, s)) : (i && Object.keys(i).length > 0 && (e._meta || (e._meta = {}), Object.assign(e._meta, i)), S.set(a, e));
|
|
260
264
|
const u = o().getInitialOptions(t);
|
|
261
|
-
(u?.validation?.zodSchemaV4 || u?.validation?.zodSchemaV3) && (u.validation?.zodSchemaV4 ?
|
|
265
|
+
(u?.validation?.zodSchemaV4 || u?.validation?.zodSchemaV3) && (u.validation?.zodSchemaV4 ? w(t, u.validation.zodSchemaV4, "zod4") : u.validation?.zodSchemaV3 && w(t, u.validation.zodSchemaV3, "zod3")), a === t ? S.delete(`[${t}`) : S.delete(t);
|
|
262
266
|
},
|
|
263
267
|
initializeShadowState: (t, e) => {
|
|
264
|
-
const n =
|
|
268
|
+
const n = S.get(t) || S.get(`[${t}`);
|
|
265
269
|
let a = {};
|
|
266
270
|
const s = /* @__PURE__ */ new Map();
|
|
267
271
|
if (n) {
|
|
268
|
-
const
|
|
269
|
-
if (!(!
|
|
270
|
-
(
|
|
271
|
-
clientActivityState:
|
|
272
|
-
pluginMetaData:
|
|
272
|
+
const p = (c, h) => {
|
|
273
|
+
if (!(!c || typeof c != "object")) {
|
|
274
|
+
(c._meta?.clientActivityState || c._meta?.pluginMetaData) && s.set(h.join("\0"), {
|
|
275
|
+
clientActivityState: c._meta.clientActivityState,
|
|
276
|
+
pluginMetaData: c._meta.pluginMetaData
|
|
273
277
|
});
|
|
274
|
-
for (const m in
|
|
275
|
-
m !== "_meta" &&
|
|
278
|
+
for (const m in c)
|
|
279
|
+
m !== "_meta" && p(c[m], [...h, m]);
|
|
276
280
|
}
|
|
277
281
|
};
|
|
278
|
-
|
|
282
|
+
p(n, []);
|
|
279
283
|
}
|
|
280
284
|
if (n?._meta) {
|
|
281
285
|
const {
|
|
282
|
-
components:
|
|
283
|
-
features:
|
|
284
|
-
lastServerSync:
|
|
286
|
+
components: p,
|
|
287
|
+
features: c,
|
|
288
|
+
lastServerSync: h,
|
|
285
289
|
stateSource: m,
|
|
286
|
-
baseServerState:
|
|
290
|
+
baseServerState: _
|
|
287
291
|
} = n._meta;
|
|
288
|
-
|
|
292
|
+
p && (a.components = p), c && (a.features = c), h && (a.lastServerSync = h), m && (a.stateSource = m), _ && (a.baseServerState = _);
|
|
289
293
|
}
|
|
290
|
-
|
|
294
|
+
S.delete(t), S.delete(`[${t}`);
|
|
291
295
|
const i = o().getInitialOptions(t), r = o().getInitialOptions("__syncSchemas"), u = {
|
|
292
296
|
stateKey: t,
|
|
293
297
|
path: [],
|
|
@@ -296,21 +300,23 @@ const C = N((f, o) => ({
|
|
|
296
300
|
zodV4: i?.validation?.zodSchemaV4,
|
|
297
301
|
zodV3: i?.validation?.zodSchemaV3
|
|
298
302
|
}
|
|
299
|
-
}, l =
|
|
303
|
+
}, l = g(t, e, u);
|
|
300
304
|
l._meta || (l._meta = {}), Object.assign(l._meta, a);
|
|
301
|
-
const d = (
|
|
302
|
-
if (!
|
|
303
|
-
const
|
|
304
|
-
m && (
|
|
305
|
-
for (const
|
|
306
|
-
|
|
305
|
+
const d = (p, c) => {
|
|
306
|
+
if (!p || typeof p != "object") return;
|
|
307
|
+
const h = c.join("\0"), m = s.get(h);
|
|
308
|
+
m && (p._meta || (p._meta = {}), m.clientActivityState && (p._meta.clientActivityState = m.clientActivityState), m.pluginMetaData && (p._meta.pluginMetaData = m.pluginMetaData));
|
|
309
|
+
for (const _ in p)
|
|
310
|
+
_ !== "_meta" && d(p[_], [...c, _]);
|
|
307
311
|
};
|
|
308
312
|
d(l, []);
|
|
309
313
|
const y = Array.isArray(e) ? `[${t}` : t;
|
|
310
|
-
|
|
314
|
+
S.set(y, l);
|
|
315
|
+
const b = o().getInitialOptions(t);
|
|
316
|
+
b?.validation?.zodSchemaV4 ? w(t, b.validation.zodSchemaV4, "zod4") : b?.validation?.zodSchemaV3 && w(t, b.validation.zodSchemaV3, "zod3");
|
|
311
317
|
},
|
|
312
318
|
getShadowNode: (t, e) => {
|
|
313
|
-
let n =
|
|
319
|
+
let n = S.get(t) || S.get(`[${t}`);
|
|
314
320
|
if (n) {
|
|
315
321
|
if (e.length === 0) return n;
|
|
316
322
|
for (const a of e)
|
|
@@ -320,10 +326,10 @@ const C = N((f, o) => ({
|
|
|
320
326
|
},
|
|
321
327
|
getShadowMetadata: (t, e) => o().getShadowNode(t, e)?._meta,
|
|
322
328
|
setShadowMetadata: (t, e, n) => {
|
|
323
|
-
const a =
|
|
324
|
-
let s =
|
|
329
|
+
const a = S.has(`[${t}`) ? `[${t}` : t;
|
|
330
|
+
let s = S.get(a);
|
|
325
331
|
if (!s) {
|
|
326
|
-
s = { _meta: n },
|
|
332
|
+
s = { _meta: n }, S.set(a, s);
|
|
327
333
|
return;
|
|
328
334
|
}
|
|
329
335
|
let i = s;
|
|
@@ -345,25 +351,25 @@ const C = N((f, o) => ({
|
|
|
345
351
|
continue;
|
|
346
352
|
}
|
|
347
353
|
if (r._meta?.arrayKeys) {
|
|
348
|
-
const
|
|
354
|
+
const b = n || r._meta.arrayKeys, p = [];
|
|
349
355
|
u[l] = p;
|
|
350
|
-
for (let c =
|
|
351
|
-
const
|
|
352
|
-
r[
|
|
356
|
+
for (let c = b.length - 1; c >= 0; c--) {
|
|
357
|
+
const h = b[c];
|
|
358
|
+
r[h] && i.push([r[h], p, c]);
|
|
353
359
|
}
|
|
354
360
|
continue;
|
|
355
361
|
}
|
|
356
362
|
const d = {};
|
|
357
363
|
u[l] = d;
|
|
358
364
|
const y = Object.keys(r);
|
|
359
|
-
for (const
|
|
360
|
-
|
|
365
|
+
for (const b of y)
|
|
366
|
+
b !== "_meta" && i.push([r[b], d, b]);
|
|
361
367
|
}
|
|
362
368
|
return s.final;
|
|
363
369
|
},
|
|
364
370
|
updateShadowAtPath: (t, e, n) => {
|
|
365
|
-
const a =
|
|
366
|
-
let s =
|
|
371
|
+
const a = S.has(`[${t}`) ? `[${t}` : t;
|
|
372
|
+
let s = S.get(a);
|
|
367
373
|
if (!s) return;
|
|
368
374
|
let i = s;
|
|
369
375
|
for (let l = 0; l < e.length - 1; l++)
|
|
@@ -379,40 +385,40 @@ const C = N((f, o) => ({
|
|
|
379
385
|
}
|
|
380
386
|
if (Array.isArray(d)) {
|
|
381
387
|
l._meta || (l._meta = {}), l._meta.arrayKeys || (l._meta.arrayKeys = []);
|
|
382
|
-
const p = l._meta.arrayKeys, c = d,
|
|
383
|
-
for (let
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
const M = p[
|
|
387
|
-
u(l[M],
|
|
388
|
+
const p = l._meta.arrayKeys, c = d, h = [];
|
|
389
|
+
for (let m = 0; m < c.length; m++) {
|
|
390
|
+
const _ = c[m];
|
|
391
|
+
if (m < p.length) {
|
|
392
|
+
const M = p[m];
|
|
393
|
+
u(l[M], _, [
|
|
388
394
|
...y,
|
|
389
395
|
M
|
|
390
|
-
]),
|
|
396
|
+
]), h.push(M);
|
|
391
397
|
} else {
|
|
392
|
-
const M =
|
|
398
|
+
const M = I(), D = o().getInitialOptions(t), j = {
|
|
393
399
|
stateKey: t,
|
|
394
400
|
path: [...y, "0"],
|
|
395
401
|
// Use '0' for array element schema lookup
|
|
396
402
|
schemas: {
|
|
397
|
-
zodV4:
|
|
398
|
-
zodV3:
|
|
403
|
+
zodV4: D?.validation?.zodSchemaV4,
|
|
404
|
+
zodV3: D?.validation?.zodSchemaV3
|
|
399
405
|
}
|
|
400
406
|
};
|
|
401
|
-
l[M] =
|
|
407
|
+
l[M] = g(
|
|
402
408
|
t,
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
),
|
|
409
|
+
_,
|
|
410
|
+
j
|
|
411
|
+
), h.push(M);
|
|
406
412
|
}
|
|
407
413
|
}
|
|
408
|
-
p.length > c.length && p.slice(c.length).forEach((
|
|
409
|
-
delete l[
|
|
410
|
-
}), l._meta.arrayKeys =
|
|
414
|
+
p.length > c.length && p.slice(c.length).forEach((_) => {
|
|
415
|
+
delete l[_];
|
|
416
|
+
}), l._meta.arrayKeys = h;
|
|
411
417
|
return;
|
|
412
418
|
}
|
|
413
|
-
const
|
|
419
|
+
const b = new Set(Object.keys(d));
|
|
414
420
|
l._meta?.hasOwnProperty("value") && delete l._meta.value;
|
|
415
|
-
for (const p of
|
|
421
|
+
for (const p of b) {
|
|
416
422
|
const c = d[p];
|
|
417
423
|
if (l[p])
|
|
418
424
|
u(l[p], c, [
|
|
@@ -420,28 +426,28 @@ const C = N((f, o) => ({
|
|
|
420
426
|
p
|
|
421
427
|
]);
|
|
422
428
|
else {
|
|
423
|
-
const
|
|
429
|
+
const h = o().getInitialOptions(t), m = {
|
|
424
430
|
stateKey: t,
|
|
425
431
|
path: [...y, p],
|
|
426
432
|
schemas: {
|
|
427
|
-
zodV4:
|
|
428
|
-
zodV3:
|
|
433
|
+
zodV4: h?.validation?.zodSchemaV4,
|
|
434
|
+
zodV3: h?.validation?.zodSchemaV3
|
|
429
435
|
}
|
|
430
436
|
};
|
|
431
|
-
l[p] =
|
|
437
|
+
l[p] = g(t, c, m);
|
|
432
438
|
}
|
|
433
439
|
}
|
|
434
440
|
for (const p in l)
|
|
435
|
-
p === "_meta" || !Object.prototype.hasOwnProperty.call(l, p) ||
|
|
441
|
+
p === "_meta" || !Object.prototype.hasOwnProperty.call(l, p) || b.has(p) || delete l[p];
|
|
436
442
|
}
|
|
437
|
-
r ? u(r, n, e) : i[e[e.length - 1]] =
|
|
443
|
+
r ? u(r, n, e) : i[e[e.length - 1]] = g(t, n), o().notifyPathSubscribers([t, ...e].join("."), {
|
|
438
444
|
type: "UPDATE",
|
|
439
445
|
newValue: n
|
|
440
446
|
});
|
|
441
447
|
},
|
|
442
448
|
addItemsToArrayNode: (t, e, n) => {
|
|
443
|
-
const a =
|
|
444
|
-
let s =
|
|
449
|
+
const a = S.has(`[${t}`) ? `[${t}` : t;
|
|
450
|
+
let s = S.get(a);
|
|
445
451
|
if (!s) {
|
|
446
452
|
console.error("Root not found for state key:", t);
|
|
447
453
|
return;
|
|
@@ -457,8 +463,8 @@ const C = N((f, o) => ({
|
|
|
457
463
|
throw new Error(
|
|
458
464
|
`Array not found at path: ${[t, ...e].join(".")}`
|
|
459
465
|
);
|
|
460
|
-
const r = s || `${
|
|
461
|
-
i[r] =
|
|
466
|
+
const r = s || `${I()}`;
|
|
467
|
+
i[r] = g(t, n);
|
|
462
468
|
const u = i._meta.arrayKeys, l = a !== void 0 && a >= 0 && a <= u.length ? a : u.length;
|
|
463
469
|
l >= u.length ? u.push(r) : u.splice(l, 0, r);
|
|
464
470
|
const d = [t, ...e].join(".");
|
|
@@ -481,8 +487,8 @@ const C = N((f, o) => ({
|
|
|
481
487
|
}
|
|
482
488
|
const i = [];
|
|
483
489
|
n.forEach((d) => {
|
|
484
|
-
const y = `${
|
|
485
|
-
i.push(y), s[y] =
|
|
490
|
+
const y = `${I()}`;
|
|
491
|
+
i.push(y), s[y] = g(t, d);
|
|
486
492
|
});
|
|
487
493
|
const r = s._meta.arrayKeys, u = a !== void 0 && a >= 0 && a <= r.length ? a : r.length;
|
|
488
494
|
u >= r.length ? r.push(...i) : r.splice(u, 0, ...i);
|
|
@@ -656,7 +662,7 @@ const C = N((f, o) => ({
|
|
|
656
662
|
getSyncInfo: (t) => o().syncInfoStore.get(t) || null
|
|
657
663
|
}));
|
|
658
664
|
function P(f) {
|
|
659
|
-
const o = [], t =
|
|
665
|
+
const o = [], t = S.get(f) || S.get(`[${f}`);
|
|
660
666
|
if (!t) return o;
|
|
661
667
|
const e = (n) => {
|
|
662
668
|
if (!(!n || typeof n != "object")) {
|
|
@@ -670,7 +676,7 @@ function P(f) {
|
|
|
670
676
|
return e(t), o;
|
|
671
677
|
}
|
|
672
678
|
function R(f, o) {
|
|
673
|
-
const t =
|
|
679
|
+
const t = S.get(f) || S.get(`[${f}`);
|
|
674
680
|
if (!t) return;
|
|
675
681
|
const e = (n) => {
|
|
676
682
|
if (!(!n || typeof n != "object")) {
|
|
@@ -685,12 +691,12 @@ function R(f, o) {
|
|
|
685
691
|
e(t);
|
|
686
692
|
}
|
|
687
693
|
export {
|
|
688
|
-
|
|
689
|
-
|
|
694
|
+
g as buildShadowNode,
|
|
695
|
+
I as generateId,
|
|
690
696
|
P as getAllFieldElements,
|
|
691
697
|
C as getGlobalStore,
|
|
692
698
|
R as setAllFieldsDisabled,
|
|
693
|
-
|
|
694
|
-
|
|
699
|
+
S as shadowStateStore,
|
|
700
|
+
w as updateShadowTypeInfo
|
|
695
701
|
};
|
|
696
702
|
//# sourceMappingURL=store.js.map
|