cogsbox-state 0.5.476 → 0.5.479
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/README.md +92 -0
- package/dist/CogsState.d.ts +84 -74
- package/dist/CogsState.d.ts.map +1 -1
- package/dist/CogsState.js +920 -844
- package/dist/CogsState.js.map +1 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +110 -108
- package/dist/Components.js.map +1 -1
- package/dist/PluginRunner.d.ts.map +1 -1
- package/dist/PluginRunner.js +0 -1
- package/dist/PluginRunner.js.map +1 -1
- package/dist/index.js +35 -34
- package/dist/plugins.d.ts +93 -294
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +191 -60
- package/dist/plugins.js.map +1 -1
- package/dist/store.d.ts +3 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +470 -417
- package/dist/store.js.map +1 -1
- package/dist/utility.d.ts +1 -3
- package/dist/utility.d.ts.map +1 -1
- package/dist/utility.js +63 -73
- package/dist/utility.js.map +1 -1
- package/package.json +3 -3
- package/src/CogsState.tsx +405 -115
- package/src/Components.tsx +3 -1
- package/src/PluginRunner.tsx +3 -3
- package/src/plugins.ts +822 -108
- package/src/store.ts +131 -3
- package/src/utility.ts +1 -33
package/dist/Components.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Components.d.ts","sourceRoot":"","sources":["../src/Components.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGjB,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAQrB,OAAO,KASN,MAAM,OAAO,CAAC;AAsBf,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,wBAAgB,iBA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AM,EACnB,WAAW,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,QAcjC;AAED,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,IAAI,EAAE,8CAA8C;AACpD,YAAY,EAAE,sDAAsD;AACpE,iBAAiB,EACjB,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,iBAAiB,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,CAAC;CAC3C,2CAuCA"}
|
package/dist/Components.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as I, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import { pluginStore as C } from "./pluginStore.js";
|
|
3
3
|
import { createScopedMetadataContext as _, toDeconstructedMethods as J } from "./plugins.js";
|
|
4
|
-
import O, { memo as $, useState as E, useRef as
|
|
5
|
-
import { getGlobalStore as
|
|
4
|
+
import O, { memo as $, useState as E, useRef as W, useCallback as N, useEffect as P, useLayoutEffect as Q, useMemo as X } from "react";
|
|
5
|
+
import { getGlobalStore as h } from "./store.js";
|
|
6
6
|
import { useInView as Y } from "react-intersection-observer";
|
|
7
7
|
import { v4 as q } from "uuid";
|
|
8
8
|
import { isDeepEqual as Z } from "./utility.js";
|
|
@@ -16,18 +16,18 @@ const {
|
|
|
16
16
|
unregisterComponent: tt,
|
|
17
17
|
notifyPathSubscribers: pt,
|
|
18
18
|
subscribeToPath: et
|
|
19
|
-
} =
|
|
19
|
+
} = h.getState(), { stateHandlers: St, notifyFormUpdate: L } = C.getState();
|
|
20
20
|
function nt({
|
|
21
21
|
formOpts: e,
|
|
22
22
|
path: t,
|
|
23
23
|
stateKey: o,
|
|
24
|
-
children:
|
|
24
|
+
children: s
|
|
25
25
|
}) {
|
|
26
|
-
const { getInitialOptions: p, getShadowMetadata: S, getShadowValue:
|
|
26
|
+
const { getInitialOptions: p, getShadowMetadata: S, getShadowValue: r } = h.getState(), u = p(o), y = S(o, t)?.validation, D = y?.status || "NOT_VALIDATED", i = (y?.errors || []).map((f) => ({
|
|
27
27
|
...f,
|
|
28
28
|
path: t
|
|
29
|
-
})),
|
|
30
|
-
return
|
|
29
|
+
})), d = i.filter((f) => f.severity === "error").map((f) => f.message), a = i.filter((f) => f.severity === "warning").map((f) => f.message), A = d[0] || a[0], g = d.length > 0 ? "error" : a.length > 0 ? "warning" : void 0, { registeredPlugins: c } = C.getState(), T = {};
|
|
30
|
+
return c.forEach((f) => {
|
|
31
31
|
if (u && u.hasOwnProperty(f.name)) {
|
|
32
32
|
const k = f.name, j = C.getState().getHookResult(o, k), F = _(
|
|
33
33
|
o,
|
|
@@ -42,18 +42,18 @@ function nt({
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
}), /* @__PURE__ */ I(U, { children: u?.formElements?.validation && !e?.validation?.disable ? u.formElements.validation({
|
|
45
|
-
children: /* @__PURE__ */ I(O.Fragment, { children:
|
|
45
|
+
children: /* @__PURE__ */ I(O.Fragment, { children: s }, t.toString()),
|
|
46
46
|
status: D,
|
|
47
47
|
// Now passes the new ValidationStatus type
|
|
48
48
|
message: e?.validation?.hideMessage ? "" : e?.validation?.message || A || "",
|
|
49
49
|
severity: g,
|
|
50
|
-
hasErrors:
|
|
50
|
+
hasErrors: d.length > 0,
|
|
51
51
|
hasWarnings: a.length > 0,
|
|
52
|
-
allErrors:
|
|
52
|
+
allErrors: i,
|
|
53
53
|
path: t,
|
|
54
|
-
getData: () =>
|
|
54
|
+
getData: () => r(o, t),
|
|
55
55
|
plugins: T
|
|
56
|
-
}) : /* @__PURE__ */ I(O.Fragment, { children:
|
|
56
|
+
}) : /* @__PURE__ */ I(O.Fragment, { children: s }, t.toString()) });
|
|
57
57
|
}
|
|
58
58
|
const vt = $(
|
|
59
59
|
ot,
|
|
@@ -63,56 +63,58 @@ function ot({
|
|
|
63
63
|
stateKey: e,
|
|
64
64
|
itemComponentId: t,
|
|
65
65
|
itemPath: o,
|
|
66
|
-
localIndex:
|
|
66
|
+
localIndex: s,
|
|
67
67
|
arraySetter: p,
|
|
68
68
|
rebuildStateShape: S,
|
|
69
|
-
renderFn:
|
|
69
|
+
renderFn: r
|
|
70
70
|
}) {
|
|
71
|
-
const [, u] = E({}), { ref: m, inView:
|
|
71
|
+
const [, u] = E({}), { ref: m, inView: y } = Y(), D = W(null), i = [e, ...o].join(".");
|
|
72
72
|
B(e, t, u);
|
|
73
|
-
const
|
|
74
|
-
(
|
|
75
|
-
D.current =
|
|
73
|
+
const d = N(
|
|
74
|
+
(c) => {
|
|
75
|
+
D.current = c, m(c);
|
|
76
76
|
},
|
|
77
77
|
[m]
|
|
78
78
|
);
|
|
79
|
-
|
|
80
|
-
const
|
|
79
|
+
P(() => {
|
|
80
|
+
const c = et(i, (T) => {
|
|
81
81
|
u({});
|
|
82
82
|
});
|
|
83
|
-
return () =>
|
|
84
|
-
}, [
|
|
83
|
+
return () => c();
|
|
84
|
+
}, [i]);
|
|
85
85
|
const a = z(e, o);
|
|
86
86
|
if (a === void 0) return null;
|
|
87
87
|
const A = S({
|
|
88
88
|
currentState: a,
|
|
89
89
|
path: o,
|
|
90
90
|
componentId: t
|
|
91
|
-
}), g =
|
|
91
|
+
}), g = r(A, s, p);
|
|
92
92
|
return O.isValidElement(g) ? O.cloneElement(g, {
|
|
93
|
-
ref: (
|
|
94
|
-
|
|
93
|
+
ref: (c) => {
|
|
94
|
+
d(c);
|
|
95
95
|
const { ref: T } = g;
|
|
96
|
-
typeof T == "function" ? T(
|
|
96
|
+
typeof T == "function" ? T(c) : T && "current" in T && (T.current = c);
|
|
97
97
|
}
|
|
98
|
-
}) : /* @__PURE__ */ I("div", { ref:
|
|
98
|
+
}) : /* @__PURE__ */ I("div", { ref: d, children: g });
|
|
99
99
|
}
|
|
100
100
|
function bt({
|
|
101
101
|
stateKey: e,
|
|
102
102
|
path: t,
|
|
103
103
|
rebuildStateShape: o,
|
|
104
|
-
renderFn:
|
|
104
|
+
renderFn: s,
|
|
105
105
|
formOpts: p,
|
|
106
106
|
setState: S
|
|
107
107
|
}) {
|
|
108
|
-
const
|
|
109
|
-
B(e,
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
!g.current && !Z(
|
|
113
|
-
}, [
|
|
114
|
-
const { getShadowMetadata: n, setShadowMetadata: w } =
|
|
115
|
-
|
|
108
|
+
const r = W(q()).current, [, u] = E({}), m = W(null), y = [e, ...t].join(".");
|
|
109
|
+
B(e, r, u);
|
|
110
|
+
const i = h.getState().getShadowNode(e, t)?._meta?.typeInfo, d = z(e, t), [a, A] = E(d), g = W(!1), c = W(null);
|
|
111
|
+
P(() => {
|
|
112
|
+
!g.current && !Z(d, a) && A(d);
|
|
113
|
+
}, [d]), P(() => {
|
|
114
|
+
const { getShadowMetadata: n, setShadowMetadata: w } = h.getState();
|
|
115
|
+
console.log("FormElementWrapper effect running for:", e, t);
|
|
116
|
+
const l = n(e, t) || {};
|
|
117
|
+
l.clientActivityState || (l.clientActivityState = { elements: /* @__PURE__ */ new Map() });
|
|
116
118
|
const v = () => {
|
|
117
119
|
const b = m.current;
|
|
118
120
|
if (!b) return "input";
|
|
@@ -120,44 +122,44 @@ function bt({
|
|
|
120
122
|
if (R === "textarea") return "textarea";
|
|
121
123
|
if (R === "select") return "select";
|
|
122
124
|
if (R === "input") {
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
if (
|
|
126
|
-
if (
|
|
127
|
-
if (
|
|
125
|
+
const M = b.type;
|
|
126
|
+
if (M === "checkbox") return "checkbox";
|
|
127
|
+
if (M === "radio") return "radio";
|
|
128
|
+
if (M === "range") return "range";
|
|
129
|
+
if (M === "file") return "file";
|
|
128
130
|
}
|
|
129
131
|
return "input";
|
|
130
132
|
};
|
|
131
|
-
|
|
133
|
+
l.clientActivityState.elements.set(r, {
|
|
132
134
|
domRef: m,
|
|
133
135
|
elementType: v(),
|
|
134
136
|
inputType: m.current?.type,
|
|
135
137
|
mountedAt: Date.now()
|
|
136
|
-
}), w(e, t,
|
|
137
|
-
const x =
|
|
138
|
+
}), console.log("currentMeta", l), w(e, t, l);
|
|
139
|
+
const x = h.getState().subscribeToPath(y, (b) => {
|
|
138
140
|
!g.current && a !== b && u({});
|
|
139
141
|
});
|
|
140
142
|
return () => {
|
|
141
|
-
x(),
|
|
142
|
-
const b =
|
|
143
|
-
b?.clientActivityState?.elements && (b.clientActivityState.elements.delete(
|
|
143
|
+
x(), c.current && (clearTimeout(c.current), g.current = !1);
|
|
144
|
+
const b = h.getState().getShadowMetadata(e, t);
|
|
145
|
+
b?.clientActivityState?.elements && (b.clientActivityState.elements.delete(r), w(e, t, b));
|
|
144
146
|
};
|
|
145
147
|
}, []);
|
|
146
148
|
const T = N(
|
|
147
149
|
(n) => {
|
|
148
|
-
|
|
149
|
-
const { getShadowMetadata: w, setShadowMetadata:
|
|
150
|
-
if (v?.clientActivityState?.elements?.has(
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
...
|
|
150
|
+
i ? i.type === "number" && typeof n == "string" ? n = n === "" ? i.nullable ? null : i.default ?? 0 : Number(n) : i.type === "boolean" && typeof n == "string" ? n = n === "true" || n === "1" : i.type === "date" && typeof n == "string" && (n = new Date(n)) : typeof d === "number" && typeof n == "string" && (n = n === "" ? 0 : Number(n)), A(n);
|
|
151
|
+
const { getShadowMetadata: w, setShadowMetadata: l } = h.getState(), v = w(e, t);
|
|
152
|
+
if (v?.clientActivityState?.elements?.has(r)) {
|
|
153
|
+
const M = v.clientActivityState.elements.get(r);
|
|
154
|
+
M && M.currentActivity?.type === "focus" && (M.currentActivity.details = {
|
|
155
|
+
...M.currentActivity.details,
|
|
154
156
|
value: n,
|
|
155
|
-
previousValue:
|
|
157
|
+
previousValue: M.currentActivity.details?.value || d,
|
|
156
158
|
inputLength: typeof n == "string" ? n.length : void 0,
|
|
157
|
-
keystrokeCount: (
|
|
158
|
-
},
|
|
159
|
+
keystrokeCount: (M.currentActivity.details?.keystrokeCount || 0) + 1
|
|
160
|
+
}, l(e, t, v));
|
|
159
161
|
}
|
|
160
|
-
const x = v?.clientActivityState?.elements?.get(
|
|
162
|
+
const x = v?.clientActivityState?.elements?.get(r);
|
|
161
163
|
L({
|
|
162
164
|
stateKey: e,
|
|
163
165
|
activityType: "input",
|
|
@@ -178,9 +180,9 @@ function bt({
|
|
|
178
180
|
path: t,
|
|
179
181
|
newValue: n,
|
|
180
182
|
updateType: "update"
|
|
181
|
-
}, "onChange"), g.current = !0,
|
|
183
|
+
}, "onChange"), g.current = !0, c.current && clearTimeout(c.current);
|
|
182
184
|
const R = p?.debounceTime ?? 200;
|
|
183
|
-
|
|
185
|
+
c.current = setTimeout(() => {
|
|
184
186
|
g.current = !1, S(n, t, {
|
|
185
187
|
updateType: "update",
|
|
186
188
|
validationTrigger: "onChange"
|
|
@@ -191,15 +193,15 @@ function bt({
|
|
|
191
193
|
S,
|
|
192
194
|
t,
|
|
193
195
|
p?.debounceTime,
|
|
194
|
-
|
|
195
|
-
|
|
196
|
+
i,
|
|
197
|
+
d,
|
|
196
198
|
e,
|
|
197
|
-
|
|
199
|
+
r
|
|
198
200
|
]
|
|
199
201
|
), f = N(() => {
|
|
200
|
-
const { getShadowMetadata: n, setShadowMetadata: w } =
|
|
201
|
-
if (
|
|
202
|
-
const v =
|
|
202
|
+
const { getShadowMetadata: n, setShadowMetadata: w } = h.getState(), l = n(e, t);
|
|
203
|
+
if (l?.clientActivityState?.elements?.has(r)) {
|
|
204
|
+
const v = l.clientActivityState.elements.get(r);
|
|
203
205
|
v.currentActivity = {
|
|
204
206
|
type: "focus",
|
|
205
207
|
startTime: Date.now(),
|
|
@@ -207,7 +209,7 @@ function bt({
|
|
|
207
209
|
value: a,
|
|
208
210
|
inputLength: typeof a == "string" ? a.length : void 0
|
|
209
211
|
}
|
|
210
|
-
}, w(e, t,
|
|
212
|
+
}, w(e, t, l);
|
|
211
213
|
}
|
|
212
214
|
L({
|
|
213
215
|
stateKey: e,
|
|
@@ -219,18 +221,18 @@ function bt({
|
|
|
219
221
|
cursorPosition: m.current?.selectionStart
|
|
220
222
|
}
|
|
221
223
|
});
|
|
222
|
-
}, [e, t,
|
|
223
|
-
const { getShadowMetadata: n, setShadowMetadata: w } =
|
|
224
|
-
|
|
224
|
+
}, [e, t, r, a]), k = N(() => {
|
|
225
|
+
const { getShadowMetadata: n, setShadowMetadata: w } = h.getState();
|
|
226
|
+
c.current && (clearTimeout(c.current), c.current = null, g.current = !1, S(a, t, {
|
|
225
227
|
updateType: "update",
|
|
226
228
|
validationTrigger: "onBlur"
|
|
227
229
|
}));
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
const b =
|
|
231
|
-
b.currentActivity = void 0, w(e, t,
|
|
230
|
+
const l = n(e, t);
|
|
231
|
+
if (l?.clientActivityState?.elements?.has(r)) {
|
|
232
|
+
const b = l.clientActivityState.elements.get(r);
|
|
233
|
+
b.currentActivity = void 0, w(e, t, l);
|
|
232
234
|
}
|
|
233
|
-
const v =
|
|
235
|
+
const v = l?.clientActivityState?.elements?.get(r)?.currentActivity?.startTime;
|
|
234
236
|
L({
|
|
235
237
|
stateKey: e,
|
|
236
238
|
activityType: "blur",
|
|
@@ -247,56 +249,56 @@ function bt({
|
|
|
247
249
|
newValue: a,
|
|
248
250
|
updateType: "update"
|
|
249
251
|
}, "onBlur");
|
|
250
|
-
}, [a, S, t, e,
|
|
252
|
+
}, [a, S, t, e, r, d]), j = o({
|
|
251
253
|
path: t,
|
|
252
|
-
componentId:
|
|
254
|
+
componentId: r,
|
|
253
255
|
meta: void 0
|
|
254
256
|
}), F = new Proxy(j, {
|
|
255
257
|
get(n, w) {
|
|
256
258
|
return w === "$inputProps" ? {
|
|
257
259
|
value: a ?? "",
|
|
258
|
-
onChange: (
|
|
259
|
-
T(
|
|
260
|
+
onChange: (l) => {
|
|
261
|
+
T(l.target.value);
|
|
260
262
|
},
|
|
261
263
|
onFocus: f,
|
|
262
264
|
onBlur: k,
|
|
263
265
|
ref: m
|
|
264
266
|
} : n[w];
|
|
265
267
|
}
|
|
266
|
-
}), G =
|
|
268
|
+
}), G = s(F);
|
|
267
269
|
return /* @__PURE__ */ I(nt, { formOpts: p, path: t, stateKey: e, children: G });
|
|
268
270
|
}
|
|
269
271
|
function B(e, t, o) {
|
|
270
|
-
const
|
|
271
|
-
Q(() => (K(e,
|
|
272
|
+
const s = `${e}////${t}`;
|
|
273
|
+
Q(() => (K(e, s, {
|
|
272
274
|
forceUpdate: () => o({}),
|
|
273
275
|
paths: /* @__PURE__ */ new Set(),
|
|
274
276
|
reactiveType: ["component"]
|
|
275
277
|
}), () => {
|
|
276
|
-
tt(e,
|
|
277
|
-
}), [e,
|
|
278
|
+
tt(e, s);
|
|
279
|
+
}), [e, s]);
|
|
278
280
|
}
|
|
279
|
-
function
|
|
281
|
+
function Mt({
|
|
280
282
|
stateKey: e,
|
|
281
283
|
path: t,
|
|
282
284
|
// The path of the parent node (e.g. ['form'])
|
|
283
285
|
dependencies: o,
|
|
284
286
|
// NEW: Optional array of Proxy objects or path arrays
|
|
285
|
-
rebuildStateShape:
|
|
287
|
+
rebuildStateShape: s,
|
|
286
288
|
renderFn: p
|
|
287
289
|
}) {
|
|
288
|
-
const [S] = E(() => q()), [,
|
|
289
|
-
B(e, S,
|
|
290
|
-
const u = X(() => o && o.length > 0 ? o.map((
|
|
291
|
-
|
|
292
|
-
const
|
|
293
|
-
|
|
290
|
+
const [S] = E(() => q()), [, r] = E({});
|
|
291
|
+
B(e, S, r);
|
|
292
|
+
const u = X(() => o && o.length > 0 ? o.map((y) => [e, ...y.$_path].join(".")) : [[e, ...t].join(".")], [e, t, o]);
|
|
293
|
+
P(() => {
|
|
294
|
+
const y = h.getState(), D = u.map((i) => y.subscribeToPath(i, () => {
|
|
295
|
+
r({});
|
|
294
296
|
}));
|
|
295
297
|
return () => {
|
|
296
|
-
D.forEach((
|
|
298
|
+
D.forEach((i) => i());
|
|
297
299
|
};
|
|
298
300
|
}, [u]);
|
|
299
|
-
const m =
|
|
301
|
+
const m = s({
|
|
300
302
|
path: t,
|
|
301
303
|
componentId: S,
|
|
302
304
|
meta: void 0
|
|
@@ -306,41 +308,41 @@ function ht({
|
|
|
306
308
|
$(function({
|
|
307
309
|
children: t,
|
|
308
310
|
stateKey: o,
|
|
309
|
-
path:
|
|
311
|
+
path: s,
|
|
310
312
|
pluginName: p,
|
|
311
313
|
wrapperDepth: S
|
|
312
314
|
}) {
|
|
313
|
-
const [,
|
|
314
|
-
|
|
315
|
-
const A = [o, ...
|
|
316
|
-
return
|
|
317
|
-
|
|
315
|
+
const [, r] = E({});
|
|
316
|
+
P(() => {
|
|
317
|
+
const A = [o, ...s].join(".");
|
|
318
|
+
return h.getState().subscribeToPath(A, () => {
|
|
319
|
+
r({});
|
|
318
320
|
});
|
|
319
|
-
}, [o,
|
|
320
|
-
const u = C.getState().registeredPlugins.find((A) => A.name === p), m = C.getState().stateHandlers.get(o),
|
|
321
|
+
}, [o, s]);
|
|
322
|
+
const u = C.getState().registeredPlugins.find((A) => A.name === p), m = C.getState().stateHandlers.get(o), y = h.getState().getShadowNode(o, s)?._meta?.typeInfo, D = C.getState().pluginOptions.get(o)?.get(p), i = C.getState().getHookResult(o, p);
|
|
321
323
|
if (!u?.formWrapper || !m)
|
|
322
324
|
return /* @__PURE__ */ I(U, { children: t });
|
|
323
|
-
const
|
|
325
|
+
const d = J(m), a = _(
|
|
324
326
|
o,
|
|
325
327
|
u.name,
|
|
326
|
-
|
|
328
|
+
s
|
|
327
329
|
);
|
|
328
330
|
return u.formWrapper({
|
|
329
331
|
element: t,
|
|
330
|
-
path:
|
|
332
|
+
path: s,
|
|
331
333
|
stateKey: o,
|
|
332
334
|
pluginName: u.name,
|
|
333
|
-
...
|
|
335
|
+
...d,
|
|
334
336
|
...a,
|
|
335
337
|
options: D,
|
|
336
|
-
hookData:
|
|
337
|
-
fieldType:
|
|
338
|
+
hookData: i,
|
|
339
|
+
fieldType: y?.type,
|
|
338
340
|
wrapperDepth: S
|
|
339
341
|
});
|
|
340
342
|
});
|
|
341
343
|
export {
|
|
342
344
|
bt as FormElementWrapper,
|
|
343
|
-
|
|
345
|
+
Mt as IsolatedComponentWrapper,
|
|
344
346
|
ot as ListItemWrapper,
|
|
345
347
|
vt as MemoizedCogsItemWrapper,
|
|
346
348
|
nt as ValidationWrapper,
|
package/dist/Components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Components.js","sources":["../src/Components.tsx"],"sourcesContent":["import {\r\n FormElementParams,\r\n StateObject,\r\n UpdateTypeDetail,\r\n type FormOptsType,\r\n} from './CogsState';\r\nimport { pluginStore } from './pluginStore';\r\nimport {\r\n createMetadataContext,\r\n createScopedMetadataContext,\r\n PluginsApi,\r\n toDeconstructedMethods,\r\n} from './plugins';\r\nimport React, {\r\n memo,\r\n RefObject,\r\n useCallback,\r\n useEffect,\r\n useLayoutEffect,\r\n useRef,\r\n useState,\r\n useMemo,\r\n} from 'react';\r\nimport { getGlobalStore, ValidationError, ValidationSeverity } from './store';\r\nimport { useInView } from 'react-intersection-observer';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { isDeepEqual } from './utility';\r\nimport { runValidation } from './validation';\r\n\r\nconst {\r\n getInitialOptions,\r\n\r\n getShadowMetadata,\r\n setShadowMetadata,\r\n getShadowValue,\r\n\r\n registerComponent,\r\n unregisterComponent,\r\n\r\n notifyPathSubscribers,\r\n subscribeToPath,\r\n} = getGlobalStore.getState();\r\nconst { stateHandlers, notifyFormUpdate } = pluginStore.getState();\r\n\r\nexport type ValidationWrapperProps = {\r\n formOpts?: FormOptsType;\r\n path: string[];\r\n stateKey: string;\r\n children: React.ReactNode;\r\n};\r\n\r\nexport function ValidationWrapper({\r\n formOpts,\r\n path,\r\n stateKey,\r\n children,\r\n}: ValidationWrapperProps) {\r\n const { getInitialOptions, getShadowMetadata, getShadowValue } =\r\n getGlobalStore.getState();\r\n const thisStateOpts = getInitialOptions(stateKey!);\r\n\r\n const shadowMeta = getShadowMetadata(stateKey!, path);\r\n const validationState = shadowMeta?.validation;\r\n\r\n const status = validationState?.status || 'NOT_VALIDATED';\r\n\r\n const errors = (validationState?.errors || []).map((err) => ({\r\n ...err,\r\n path: path,\r\n })) as ValidationError[];\r\n const errorMessages = errors\r\n .filter((err) => err.severity === 'error')\r\n .map((err) => err.message);\r\n const warningMessages = errors\r\n .filter((err) => err.severity === 'warning')\r\n .map((err) => err.message);\r\n\r\n // Use first error, or first warning if no errors\r\n const message = errorMessages[0] || warningMessages[0];\r\n const primarySeverity: ValidationSeverity =\r\n errorMessages.length > 0\r\n ? 'error'\r\n : warningMessages.length > 0\r\n ? 'warning'\r\n : undefined;\r\n const { registeredPlugins } = pluginStore.getState();\r\n const pluginsApi: PluginsApi = {};\r\n\r\n // We iterate over ALL registered plugins in the app.\r\n registeredPlugins.forEach((plugin) => {\r\n if (thisStateOpts && thisStateOpts.hasOwnProperty(plugin.name)) {\r\n const pluginName = plugin.name;\r\n\r\n const hookData = pluginStore\r\n .getState()\r\n .getHookResult(stateKey!, pluginName);\r\n\r\n const scopedMetadata = createScopedMetadataContext(\r\n stateKey!,\r\n pluginName,\r\n path\r\n );\r\n\r\n pluginsApi[pluginName] = {\r\n hookData,\r\n getFieldMetaData: scopedMetadata.getFieldMetaData,\r\n setFieldMetaData: scopedMetadata.setFieldMetaData,\r\n removeFieldMetaData: scopedMetadata.removeFieldMetaData,\r\n };\r\n }\r\n });\r\n\r\n return (\r\n <>\r\n {thisStateOpts?.formElements?.validation &&\r\n !formOpts?.validation?.disable ? (\r\n thisStateOpts.formElements!.validation!({\r\n children: (\r\n <React.Fragment key={path.toString()}>{children}</React.Fragment>\r\n ),\r\n status, // Now passes the new ValidationStatus type\r\n message: formOpts?.validation?.hideMessage\r\n ? ''\r\n : formOpts?.validation?.message || message || '',\r\n severity: primarySeverity,\r\n hasErrors: errorMessages.length > 0,\r\n hasWarnings: warningMessages.length > 0,\r\n allErrors: errors,\r\n path: path,\r\n getData: () => getShadowValue(stateKey!, path),\r\n plugins: pluginsApi,\r\n })\r\n ) : (\r\n <React.Fragment key={path.toString()}>{children}</React.Fragment>\r\n )}\r\n </>\r\n );\r\n}\r\nexport const MemoizedCogsItemWrapper = memo(\r\n ListItemWrapper,\r\n (prevProps, nextProps) => {\r\n // Re-render if any of these change:\r\n return (\r\n prevProps.itemPath.join('.') === nextProps.itemPath.join('.') &&\r\n prevProps.stateKey === nextProps.stateKey &&\r\n prevProps.itemComponentId === nextProps.itemComponentId &&\r\n prevProps.localIndex === nextProps.localIndex\r\n );\r\n }\r\n);\r\n\r\nexport function ListItemWrapper({\r\n stateKey,\r\n itemComponentId,\r\n itemPath,\r\n localIndex,\r\n arraySetter,\r\n rebuildStateShape,\r\n renderFn,\r\n}: {\r\n stateKey: string;\r\n itemComponentId: string;\r\n itemPath: string[];\r\n localIndex: number;\r\n arraySetter: any;\r\n rebuildStateShape: any;\r\n renderFn: any;\r\n}) {\r\n const [, forceUpdate] = useState({});\r\n const { ref: inViewRef, inView } = useInView();\r\n const elementRef = useRef<HTMLElement | null>(null); // Changed to HTMLElement to be generic\r\n\r\n const fullKey = [stateKey, ...itemPath].join('.');\r\n\r\n useRegisterComponent(stateKey, itemComponentId, forceUpdate);\r\n\r\n const setRefs = useCallback(\r\n (element: HTMLElement | null) => {\r\n elementRef.current = element;\r\n inViewRef(element);\r\n },\r\n [inViewRef]\r\n );\r\n\r\n useEffect(() => {\r\n const unsubscribe = subscribeToPath(fullKey, (e) => {\r\n forceUpdate({});\r\n });\r\n return () => unsubscribe();\r\n }, [fullKey]);\r\n\r\n const itemValue = getShadowValue(stateKey, itemPath);\r\n if (itemValue === undefined) return null;\r\n\r\n const itemSetter = rebuildStateShape({\r\n currentState: itemValue,\r\n path: itemPath,\r\n componentId: itemComponentId,\r\n });\r\n\r\n // 1. Render the user's content (e.g. the <tr>)\r\n const children = renderFn(itemSetter, localIndex, arraySetter);\r\n\r\n // 2. AUTO-DETECT: If it is a single valid element (<tr>, <div>, <li>), inject the ref.\r\n if (React.isValidElement(children)) {\r\n // We clone the element and force our ref onto it\r\n return React.cloneElement(children as React.ReactElement<any>, {\r\n ref: (node: any) => {\r\n // Apply our virtualization ref\r\n setRefs(node);\r\n\r\n // Preserve any ref the user might have put on the element themselves\r\n const { ref: existingRef } = children as any;\r\n if (typeof existingRef === 'function') {\r\n existingRef(node);\r\n } else if (existingRef && 'current' in existingRef) {\r\n (existingRef as any).current = node;\r\n }\r\n },\r\n });\r\n }\r\n\r\n // 3. Fallback: If they returned a Fragment or string, we MUST wrap it to measure it.\r\n // (Note: This specific fallback will still break inside a <tbody>, but\r\n // as long as you return a <tr> above, line 90 catches it).\r\n return <div ref={setRefs}>{children}</div>;\r\n}\r\n\r\nexport function FormElementWrapper({\r\n stateKey,\r\n path,\r\n rebuildStateShape,\r\n renderFn,\r\n formOpts,\r\n setState,\r\n}: {\r\n stateKey: string;\r\n path: string[];\r\n rebuildStateShape: (options: {\r\n path: string[];\r\n componentId: string;\r\n meta?: any;\r\n }) => any;\r\n renderFn: (params: FormElementParams<any>) => React.ReactNode;\r\n formOpts?: FormOptsType;\r\n setState: any;\r\n}) {\r\n const componentId = useRef(uuidv4()).current;\r\n\r\n const [, forceUpdate] = useState({});\r\n const formElementRef = useRef<any>(null);\r\n const stateKeyPathKey = [stateKey, ...path].join('.');\r\n useRegisterComponent(stateKey, componentId, forceUpdate);\r\n // Get the shadow node to access typeInfo and schema\r\n const shadowNode = getGlobalStore.getState().getShadowNode(stateKey, path);\r\n const typeInfo = shadowNode?._meta?.typeInfo;\r\n\r\n const globalStateValue = getShadowValue(stateKey, path);\r\n const [localValue, setLocalValue] = useState<any>(globalStateValue);\r\n const isCurrentlyDebouncing = useRef(false);\r\n const debounceTimeoutRef = useRef<NodeJS.Timeout | null>(null);\r\n\r\n useEffect(() => {\r\n if (\r\n !isCurrentlyDebouncing.current &&\r\n !isDeepEqual(globalStateValue, localValue)\r\n ) {\r\n setLocalValue(globalStateValue);\r\n }\r\n }, [globalStateValue]);\r\n\r\n useEffect(() => {\r\n const { getShadowMetadata, setShadowMetadata } = getGlobalStore.getState();\r\n\r\n // Initialize clientActivityState if needed\r\n const currentMeta = getShadowMetadata(stateKey, path) || {};\r\n if (!currentMeta.clientActivityState) {\r\n currentMeta.clientActivityState = { elements: new Map() };\r\n }\r\n\r\n // Detect element type from the ref\r\n const detectElementType = () => {\r\n const el = formElementRef.current;\r\n if (!el) return 'input';\r\n const tagName = el.tagName.toLowerCase();\r\n if (tagName === 'textarea') return 'textarea';\r\n if (tagName === 'select') return 'select';\r\n if (tagName === 'input') {\r\n const type = (el as HTMLInputElement).type;\r\n if (type === 'checkbox') return 'checkbox';\r\n if (type === 'radio') return 'radio';\r\n if (type === 'range') return 'range';\r\n if (type === 'file') return 'file';\r\n }\r\n return 'input';\r\n };\r\n\r\n // Add this element to the Map\r\n currentMeta.clientActivityState.elements.set(componentId, {\r\n domRef: formElementRef,\r\n elementType: detectElementType(),\r\n inputType: formElementRef.current?.type,\r\n mountedAt: Date.now(),\r\n });\r\n\r\n setShadowMetadata(stateKey, path, currentMeta);\r\n\r\n // Subscribe to path updates\r\n const unsubscribe = getGlobalStore\r\n .getState()\r\n .subscribeToPath(stateKeyPathKey, (newValue) => {\r\n if (!isCurrentlyDebouncing.current && localValue !== newValue) {\r\n forceUpdate({});\r\n }\r\n });\r\n\r\n // Cleanup\r\n return () => {\r\n unsubscribe();\r\n\r\n if (debounceTimeoutRef.current) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n isCurrentlyDebouncing.current = false;\r\n }\r\n\r\n // Remove element from Map\r\n const meta = getGlobalStore.getState().getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements) {\r\n meta.clientActivityState.elements.delete(componentId);\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n };\r\n }, []);\r\n\r\n const debouncedUpdate = useCallback(\r\n (newValue: any) => {\r\n // Type conversion logic (keep existing)\r\n if (typeInfo) {\r\n if (typeInfo.type === 'number' && typeof newValue === 'string') {\r\n newValue =\r\n newValue === ''\r\n ? typeInfo.nullable\r\n ? null\r\n : (typeInfo.default ?? 0)\r\n : Number(newValue);\r\n } else if (\r\n typeInfo.type === 'boolean' &&\r\n typeof newValue === 'string'\r\n ) {\r\n newValue = newValue === 'true' || newValue === '1';\r\n } else if (typeInfo.type === 'date' && typeof newValue === 'string') {\r\n newValue = new Date(newValue);\r\n }\r\n } else {\r\n const currentType = typeof globalStateValue;\r\n if (currentType === 'number' && typeof newValue === 'string') {\r\n newValue = newValue === '' ? 0 : Number(newValue);\r\n }\r\n }\r\n\r\n setLocalValue(newValue);\r\n\r\n // Update input activity details\r\n const { getShadowMetadata, setShadowMetadata } =\r\n getGlobalStore.getState();\r\n const meta = getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements?.has(componentId)) {\r\n const element = meta.clientActivityState.elements.get(componentId);\r\n if (element && element.currentActivity?.type === 'focus') {\r\n element!.currentActivity.details = {\r\n ...element!.currentActivity.details,\r\n value: newValue,\r\n previousValue:\r\n element!.currentActivity.details?.value || globalStateValue,\r\n inputLength:\r\n typeof newValue === 'string' ? newValue.length : undefined,\r\n keystrokeCount:\r\n (element!.currentActivity.details?.keystrokeCount || 0) + 1,\r\n };\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n }\r\n const element = meta?.clientActivityState?.elements?.get(componentId);\r\n\r\n // Notify plugins\r\n notifyFormUpdate({\r\n stateKey,\r\n activityType: 'input', // Changed from 'type'\r\n path,\r\n timestamp: Date.now(),\r\n details: {\r\n value: newValue,\r\n inputLength:\r\n typeof newValue === 'string' ? newValue.length : undefined,\r\n isComposing: false, // You'd need to track this from the actual input event\r\n isPasting: false, // You'd need to track this from paste events\r\n keystrokeCount:\r\n (element?.currentActivity?.details?.keystrokeCount || 0) + 1,\r\n },\r\n });\r\n // Validation (keep existing)\r\n const virtualOperation: UpdateTypeDetail = {\r\n stateKey,\r\n path,\r\n newValue: newValue,\r\n updateType: 'update',\r\n timeStamp: Date.now(),\r\n status: 'new',\r\n oldValue: globalStateValue,\r\n };\r\n runValidation(virtualOperation, 'onChange');\r\n\r\n // Debounce state update (keep existing)\r\n isCurrentlyDebouncing.current = true;\r\n if (debounceTimeoutRef.current) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n }\r\n\r\n const debounceTime = formOpts?.debounceTime ?? 200;\r\n debounceTimeoutRef.current = setTimeout(() => {\r\n isCurrentlyDebouncing.current = false;\r\n setState(newValue, path, {\r\n updateType: 'update',\r\n validationTrigger: 'onChange',\r\n });\r\n }, debounceTime);\r\n },\r\n [\r\n setState,\r\n path,\r\n formOpts?.debounceTime,\r\n typeInfo,\r\n globalStateValue,\r\n stateKey,\r\n componentId,\r\n ]\r\n );\r\n\r\n const handleFocus = useCallback(() => {\r\n const { getShadowMetadata, setShadowMetadata } = getGlobalStore.getState();\r\n\r\n // Update element's current activity\r\n const meta = getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements?.has(componentId)) {\r\n const element = meta.clientActivityState.elements.get(componentId)!;\r\n element.currentActivity = {\r\n type: 'focus',\r\n startTime: Date.now(),\r\n details: {\r\n value: localValue,\r\n inputLength:\r\n typeof localValue === 'string' ? localValue.length : undefined,\r\n },\r\n };\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n\r\n // Notify plugins\r\n notifyFormUpdate({\r\n stateKey,\r\n activityType: 'focus', // Changed from 'type'\r\n path,\r\n timestamp: Date.now(),\r\n details: {\r\n cursorPosition: formElementRef.current?.selectionStart,\r\n },\r\n });\r\n }, [stateKey, path, componentId, localValue]);\r\n const handleBlur = useCallback(() => {\r\n const { getShadowMetadata, setShadowMetadata } = getGlobalStore.getState();\r\n\r\n // Clear debounce if active\r\n if (debounceTimeoutRef.current) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n debounceTimeoutRef.current = null;\r\n isCurrentlyDebouncing.current = false;\r\n setState(localValue, path, {\r\n updateType: 'update',\r\n validationTrigger: 'onBlur',\r\n });\r\n }\r\n\r\n // Clear element's current activity\r\n const meta = getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements?.has(componentId)) {\r\n const element = meta.clientActivityState.elements.get(componentId)!;\r\n element.currentActivity = undefined;\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n const focusStartTime =\r\n meta?.clientActivityState?.elements?.get(componentId)?.currentActivity\r\n ?.startTime;\r\n\r\n // Notify plugins\r\n notifyFormUpdate({\r\n stateKey,\r\n activityType: 'blur', // Changed from 'type'\r\n path,\r\n timestamp: Date.now(),\r\n duration: focusStartTime ? Date.now() - focusStartTime : undefined,\r\n details: {\r\n duration: focusStartTime ? Date.now() - focusStartTime : 0,\r\n },\r\n });\r\n\r\n // Run validation if configured\r\n const validationOptions = getInitialOptions(stateKey)?.validation;\r\n if (validationOptions?.onBlur) {\r\n const virtualOperation: UpdateTypeDetail = {\r\n stateKey,\r\n path,\r\n newValue: localValue,\r\n updateType: 'update',\r\n timeStamp: Date.now(),\r\n status: 'new',\r\n oldValue: globalStateValue,\r\n };\r\n runValidation(virtualOperation, 'onBlur');\r\n }\r\n }, [localValue, setState, path, stateKey, componentId, globalStateValue]);\r\n\r\n const baseState = rebuildStateShape({\r\n path: path,\r\n componentId: componentId,\r\n meta: undefined,\r\n });\r\n\r\n const stateWithInputProps = new Proxy(baseState, {\r\n get(target, prop) {\r\n if (prop === '$inputProps') {\r\n return {\r\n value: localValue ?? '',\r\n onChange: (e: any) => {\r\n debouncedUpdate(e.target.value);\r\n },\r\n onFocus: handleFocus,\r\n onBlur: handleBlur,\r\n ref: formElementRef,\r\n };\r\n }\r\n\r\n return target[prop];\r\n },\r\n });\r\n\r\n const initialElement = renderFn(stateWithInputProps);\r\n\r\n return (\r\n <ValidationWrapper formOpts={formOpts} path={path} stateKey={stateKey}>\r\n {initialElement}\r\n </ValidationWrapper>\r\n );\r\n}\r\nexport function useRegisterComponent(\r\n stateKey: string,\r\n componentId: string,\r\n forceUpdate: (o: object) => void\r\n) {\r\n const fullComponentId = `${stateKey}////${componentId}`;\r\n\r\n useLayoutEffect(() => {\r\n registerComponent(stateKey, fullComponentId, {\r\n forceUpdate: () => forceUpdate({}),\r\n paths: new Set(),\r\n reactiveType: ['component'],\r\n });\r\n return () => {\r\n unregisterComponent(stateKey, fullComponentId);\r\n };\r\n }, [stateKey, fullComponentId]);\r\n}\r\n\r\nexport function IsolatedComponentWrapper({\r\n stateKey,\r\n path, // The path of the parent node (e.g. ['form'])\r\n dependencies, // NEW: Optional array of Proxy objects or path arrays\r\n rebuildStateShape,\r\n renderFn,\r\n}: {\r\n stateKey: string;\r\n path: string[];\r\n dependencies?: any[]; // The explicit list of dependencies\r\n rebuildStateShape: (options: any) => any;\r\n renderFn: (state: any) => React.ReactNode;\r\n}) {\r\n const [componentId] = useState(() => uuidv4());\r\n const [, forceUpdate] = useState({});\r\n\r\n useRegisterComponent(stateKey, componentId, forceUpdate);\r\n\r\n const pathsToSubscribe = useMemo(() => {\r\n if (dependencies && dependencies.length > 0) {\r\n return dependencies.map((dep) => {\r\n return [stateKey, ...dep.$_path].join('.');\r\n });\r\n }\r\n\r\n return [[stateKey, ...path].join('.')];\r\n }, [stateKey, path, dependencies]);\r\n\r\n // 2. Subscribe to ALL calculated paths\r\n useEffect(() => {\r\n const store = getGlobalStore.getState();\r\n\r\n // Create an array of unsubscribe functions\r\n const unsubs = pathsToSubscribe.map((fullPathKey) => {\r\n return store.subscribeToPath(fullPathKey, () => {\r\n forceUpdate({});\r\n });\r\n });\r\n\r\n return () => {\r\n unsubs.forEach((unsub) => unsub());\r\n };\r\n }, [pathsToSubscribe]);\r\n\r\n const baseState = rebuildStateShape({\r\n path: path,\r\n componentId: componentId,\r\n meta: undefined,\r\n });\r\n\r\n return <>{renderFn(baseState)}</>;\r\n}\r\n// 1. Define the MINIMAL props needed.\r\ntype PluginWrapperProps = {\r\n children: React.ReactNode;\r\n stateKey: string;\r\n path: string[];\r\n pluginName: string;\r\n wrapperDepth: number;\r\n};\r\n\r\nconst PluginWrapper = memo(function PluginWrapper({\r\n children,\r\n stateKey,\r\n path,\r\n pluginName,\r\n wrapperDepth,\r\n}: PluginWrapperProps) {\r\n const [, forceUpdate] = useState({});\r\n\r\n useEffect(() => {\r\n const fullPathKey = [stateKey, ...path].join('.');\r\n const unsubscribe = getGlobalStore\r\n .getState()\r\n .subscribeToPath(fullPathKey, () => {\r\n forceUpdate({});\r\n });\r\n return unsubscribe;\r\n }, [stateKey, path]);\r\n\r\n const plugin = pluginStore\r\n .getState()\r\n .registeredPlugins.find((p) => p.name === pluginName);\r\n\r\n const stateHandler: StateObject<any> | undefined = pluginStore\r\n .getState()\r\n .stateHandlers.get(stateKey);\r\n\r\n const typeInfo = getGlobalStore.getState().getShadowNode(stateKey, path)\r\n ?._meta?.typeInfo;\r\n\r\n const options = pluginStore\r\n .getState()\r\n .pluginOptions.get(stateKey)\r\n ?.get(pluginName);\r\n\r\n const hookData = pluginStore.getState().getHookResult(stateKey, pluginName);\r\n\r\n if (!plugin?.formWrapper || !stateHandler) {\r\n return <>{children}</>;\r\n }\r\n\r\n const deconstructed = toDeconstructedMethods(stateHandler);\r\n const scopedMetadataContext = createScopedMetadataContext(\r\n stateKey,\r\n plugin.name,\r\n path\r\n );\r\n return plugin.formWrapper({\r\n element: children,\r\n path,\r\n stateKey,\r\n pluginName: plugin.name,\r\n ...deconstructed,\r\n\r\n ...scopedMetadataContext,\r\n options,\r\n hookData,\r\n fieldType: typeInfo?.type,\r\n wrapperDepth,\r\n });\r\n});\r\n"],"names":["getInitialOptions","getShadowMetadata","setShadowMetadata","getShadowValue","registerComponent","unregisterComponent","notifyPathSubscribers","subscribeToPath","getGlobalStore","stateHandlers","notifyFormUpdate","pluginStore","ValidationWrapper","formOpts","path","stateKey","children","thisStateOpts","validationState","status","errors","err","errorMessages","warningMessages","message","primarySeverity","registeredPlugins","pluginsApi","plugin","pluginName","hookData","scopedMetadata","createScopedMetadataContext","jsx","Fragment","React","MemoizedCogsItemWrapper","memo","ListItemWrapper","prevProps","nextProps","itemComponentId","itemPath","localIndex","arraySetter","rebuildStateShape","renderFn","forceUpdate","useState","inViewRef","inView","useInView","elementRef","useRef","fullKey","useRegisterComponent","setRefs","useCallback","element","useEffect","unsubscribe","e","itemValue","itemSetter","node","existingRef","FormElementWrapper","setState","componentId","uuidv4","formElementRef","stateKeyPathKey","typeInfo","globalStateValue","localValue","setLocalValue","isCurrentlyDebouncing","debounceTimeoutRef","isDeepEqual","currentMeta","detectElementType","el","tagName","type","newValue","meta","debouncedUpdate","runValidation","debounceTime","handleFocus","handleBlur","focusStartTime","baseState","stateWithInputProps","target","prop","initialElement","fullComponentId","useLayoutEffect","IsolatedComponentWrapper","dependencies","pathsToSubscribe","useMemo","dep","store","unsubs","fullPathKey","unsub","wrapperDepth","p","stateHandler","options","deconstructed","toDeconstructedMethods","scopedMetadataContext"],"mappings":";;;;;;;;;AA6BA,MAAM;AAAA,EACJ,mBAAAA;AAAA,EAEA,mBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EAEA,mBAAAC;AAAA,EACA,qBAAAC;AAAA,EAEA,uBAAAC;AAAA,EACA,iBAAAC;AACF,IAAIC,EAAe,SAAA,GACb,EAAE,eAAAC,IAAe,kBAAAC,MAAqBC,EAAY,SAAA;AASjD,SAASC,GAAkB;AAAA,EAChC,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACF,GAA2B;AACzB,QAAM,EAAE,mBAAAhB,GAAmB,mBAAAC,GAAmB,gBAAAE,EAAAA,IAC5CK,EAAe,SAAA,GACXS,IAAgBjB,EAAkBe,CAAS,GAG3CG,IADajB,EAAkBc,GAAWD,CAAI,GAChB,YAE9BK,IAASD,GAAiB,UAAU,iBAEpCE,KAAUF,GAAiB,UAAU,CAAA,GAA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B,KAAK,CAACkG,MAAMA,EAAE,SAAShF,CAAU,GAEhDiF,IAA6CnG,EAChD,SAAA,EACA,cAAc,IAAII,CAAQ,GAEvByD,IAAWhE,EAAe,SAAA,EAAW,cAAcO,GAAUD,CAAI,GACnE,OAAO,UAELiG,IAAUpG,EACb,WACA,cAAc,IAAII,CAAQ,GACzB,IAAIc,CAAU,GAEZC,IAAWnB,EAAY,SAAA,EAAW,cAAcI,GAAUc,CAAU;AAE1E,MAAI,CAACD,GAAQ,eAAe,CAACkF;AAC3B,kCAAU,UAAA9F,GAAS;AAGrB,QAAMgG,IAAgBC,EAAuBH,CAAY,GACnDI,IAAwBlF;AAAA,IAC5BjB;AAAA,IACAa,EAAO;AAAA,IACPd;AAAA,EAAA;AAEF,SAAOc,EAAO,YAAY;AAAA,IACxB,SAASZ;AAAA,IACT,MAAAF;AAAA,IACA,UAAAC;AAAA,IACA,YAAYa,EAAO;AAAA,IACnB,GAAGoF;AAAA,IAEH,GAAGE;AAAA,IACH,SAAAH;AAAA,IACA,UAAAjF;AAAA,IACA,WAAW0C,GAAU;AAAA,IACrB,cAAAoC;AAAA,EAAA,CACD;AACH,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Components.js","sources":["../src/Components.tsx"],"sourcesContent":["import {\r\n FormElementParams,\r\n StateObject,\r\n UpdateTypeDetail,\r\n type FormOptsType,\r\n} from './CogsState';\r\nimport { pluginStore } from './pluginStore';\r\nimport {\r\n createMetadataContext,\r\n createScopedMetadataContext,\r\n PluginsApi,\r\n toDeconstructedMethods,\r\n} from './plugins';\r\nimport React, {\r\n memo,\r\n RefObject,\r\n useCallback,\r\n useEffect,\r\n useLayoutEffect,\r\n useRef,\r\n useState,\r\n useMemo,\r\n} from 'react';\r\nimport { getGlobalStore, ValidationError, ValidationSeverity } from './store';\r\nimport { useInView } from 'react-intersection-observer';\r\nimport { v4 as uuidv4 } from 'uuid';\r\nimport { isDeepEqual } from './utility';\r\nimport { runValidation } from './validation';\r\n\r\nconst {\r\n getInitialOptions,\r\n\r\n getShadowMetadata,\r\n setShadowMetadata,\r\n getShadowValue,\r\n\r\n registerComponent,\r\n unregisterComponent,\r\n\r\n notifyPathSubscribers,\r\n subscribeToPath,\r\n} = getGlobalStore.getState();\r\nconst { stateHandlers, notifyFormUpdate } = pluginStore.getState();\r\n\r\nexport type ValidationWrapperProps = {\r\n formOpts?: FormOptsType;\r\n path: string[];\r\n stateKey: string;\r\n children: React.ReactNode;\r\n};\r\n\r\nexport function ValidationWrapper({\r\n formOpts,\r\n path,\r\n stateKey,\r\n children,\r\n}: ValidationWrapperProps) {\r\n const { getInitialOptions, getShadowMetadata, getShadowValue } =\r\n getGlobalStore.getState();\r\n const thisStateOpts = getInitialOptions(stateKey!);\r\n\r\n const shadowMeta = getShadowMetadata(stateKey!, path);\r\n const validationState = shadowMeta?.validation;\r\n\r\n const status = validationState?.status || 'NOT_VALIDATED';\r\n\r\n const errors = (validationState?.errors || []).map((err) => ({\r\n ...err,\r\n path: path,\r\n })) as ValidationError[];\r\n const errorMessages = errors\r\n .filter((err) => err.severity === 'error')\r\n .map((err) => err.message);\r\n const warningMessages = errors\r\n .filter((err) => err.severity === 'warning')\r\n .map((err) => err.message);\r\n\r\n // Use first error, or first warning if no errors\r\n const message = errorMessages[0] || warningMessages[0];\r\n const primarySeverity: ValidationSeverity =\r\n errorMessages.length > 0\r\n ? 'error'\r\n : warningMessages.length > 0\r\n ? 'warning'\r\n : undefined;\r\n const { registeredPlugins } = pluginStore.getState();\r\n const pluginsApi: PluginsApi = {};\r\n\r\n // We iterate over ALL registered plugins in the app.\r\n registeredPlugins.forEach((plugin) => {\r\n if (thisStateOpts && thisStateOpts.hasOwnProperty(plugin.name)) {\r\n const pluginName = plugin.name;\r\n\r\n const hookData = pluginStore\r\n .getState()\r\n .getHookResult(stateKey!, pluginName);\r\n\r\n const scopedMetadata = createScopedMetadataContext(\r\n stateKey!,\r\n pluginName,\r\n path\r\n );\r\n\r\n pluginsApi[pluginName] = {\r\n hookData,\r\n getFieldMetaData: scopedMetadata.getFieldMetaData,\r\n setFieldMetaData: scopedMetadata.setFieldMetaData,\r\n removeFieldMetaData: scopedMetadata.removeFieldMetaData,\r\n };\r\n }\r\n });\r\n\r\n return (\r\n <>\r\n {thisStateOpts?.formElements?.validation &&\r\n !formOpts?.validation?.disable ? (\r\n thisStateOpts.formElements!.validation!({\r\n children: (\r\n <React.Fragment key={path.toString()}>{children}</React.Fragment>\r\n ),\r\n status, // Now passes the new ValidationStatus type\r\n message: formOpts?.validation?.hideMessage\r\n ? ''\r\n : formOpts?.validation?.message || message || '',\r\n severity: primarySeverity,\r\n hasErrors: errorMessages.length > 0,\r\n hasWarnings: warningMessages.length > 0,\r\n allErrors: errors,\r\n path: path,\r\n getData: () => getShadowValue(stateKey!, path),\r\n plugins: pluginsApi,\r\n })\r\n ) : (\r\n <React.Fragment key={path.toString()}>{children}</React.Fragment>\r\n )}\r\n </>\r\n );\r\n}\r\nexport const MemoizedCogsItemWrapper = memo(\r\n ListItemWrapper,\r\n (prevProps, nextProps) => {\r\n // Re-render if any of these change:\r\n return (\r\n prevProps.itemPath.join('.') === nextProps.itemPath.join('.') &&\r\n prevProps.stateKey === nextProps.stateKey &&\r\n prevProps.itemComponentId === nextProps.itemComponentId &&\r\n prevProps.localIndex === nextProps.localIndex\r\n );\r\n }\r\n);\r\n\r\nexport function ListItemWrapper({\r\n stateKey,\r\n itemComponentId,\r\n itemPath,\r\n localIndex,\r\n arraySetter,\r\n rebuildStateShape,\r\n renderFn,\r\n}: {\r\n stateKey: string;\r\n itemComponentId: string;\r\n itemPath: string[];\r\n localIndex: number;\r\n arraySetter: any;\r\n rebuildStateShape: any;\r\n renderFn: any;\r\n}) {\r\n const [, forceUpdate] = useState({});\r\n const { ref: inViewRef, inView } = useInView();\r\n const elementRef = useRef<HTMLElement | null>(null); // Changed to HTMLElement to be generic\r\n\r\n const fullKey = [stateKey, ...itemPath].join('.');\r\n\r\n useRegisterComponent(stateKey, itemComponentId, forceUpdate);\r\n\r\n const setRefs = useCallback(\r\n (element: HTMLElement | null) => {\r\n elementRef.current = element;\r\n inViewRef(element);\r\n },\r\n [inViewRef]\r\n );\r\n\r\n useEffect(() => {\r\n const unsubscribe = subscribeToPath(fullKey, (e) => {\r\n forceUpdate({});\r\n });\r\n return () => unsubscribe();\r\n }, [fullKey]);\r\n\r\n const itemValue = getShadowValue(stateKey, itemPath);\r\n if (itemValue === undefined) return null;\r\n\r\n const itemSetter = rebuildStateShape({\r\n currentState: itemValue,\r\n path: itemPath,\r\n componentId: itemComponentId,\r\n });\r\n\r\n // 1. Render the user's content (e.g. the <tr>)\r\n const children = renderFn(itemSetter, localIndex, arraySetter);\r\n\r\n // 2. AUTO-DETECT: If it is a single valid element (<tr>, <div>, <li>), inject the ref.\r\n if (React.isValidElement(children)) {\r\n // We clone the element and force our ref onto it\r\n return React.cloneElement(children as React.ReactElement<any>, {\r\n ref: (node: any) => {\r\n // Apply our virtualization ref\r\n setRefs(node);\r\n\r\n // Preserve any ref the user might have put on the element themselves\r\n const { ref: existingRef } = children as any;\r\n if (typeof existingRef === 'function') {\r\n existingRef(node);\r\n } else if (existingRef && 'current' in existingRef) {\r\n (existingRef as any).current = node;\r\n }\r\n },\r\n });\r\n }\r\n\r\n // 3. Fallback: If they returned a Fragment or string, we MUST wrap it to measure it.\r\n // (Note: This specific fallback will still break inside a <tbody>, but\r\n // as long as you return a <tr> above, line 90 catches it).\r\n return <div ref={setRefs}>{children}</div>;\r\n}\r\n\r\nexport function FormElementWrapper({\r\n stateKey,\r\n path,\r\n rebuildStateShape,\r\n renderFn,\r\n formOpts,\r\n setState,\r\n}: {\r\n stateKey: string;\r\n path: string[];\r\n rebuildStateShape: (options: {\r\n path: string[];\r\n componentId: string;\r\n meta?: any;\r\n }) => any;\r\n renderFn: (params: FormElementParams<any>) => React.ReactNode;\r\n formOpts?: FormOptsType;\r\n setState: any;\r\n}) {\r\n const componentId = useRef(uuidv4()).current;\r\n\r\n const [, forceUpdate] = useState({});\r\n const formElementRef = useRef<any>(null);\r\n const stateKeyPathKey = [stateKey, ...path].join('.');\r\n useRegisterComponent(stateKey, componentId, forceUpdate);\r\n // Get the shadow node to access typeInfo and schema\r\n const shadowNode = getGlobalStore.getState().getShadowNode(stateKey, path);\r\n const typeInfo = shadowNode?._meta?.typeInfo;\r\n\r\n const globalStateValue = getShadowValue(stateKey, path);\r\n const [localValue, setLocalValue] = useState<any>(globalStateValue);\r\n const isCurrentlyDebouncing = useRef(false);\r\n const debounceTimeoutRef = useRef<NodeJS.Timeout | null>(null);\r\n\r\n useEffect(() => {\r\n if (\r\n !isCurrentlyDebouncing.current &&\r\n !isDeepEqual(globalStateValue, localValue)\r\n ) {\r\n setLocalValue(globalStateValue);\r\n }\r\n }, [globalStateValue]);\r\n\r\n useEffect(() => {\r\n const { getShadowMetadata, setShadowMetadata } = getGlobalStore.getState();\r\n console.log('FormElementWrapper effect running for:', stateKey, path);\r\n\r\n // Initialize clientActivityState if needed\r\n const currentMeta = getShadowMetadata(stateKey, path) || {};\r\n if (!currentMeta.clientActivityState) {\r\n currentMeta.clientActivityState = { elements: new Map() };\r\n }\r\n\r\n // Detect element type from the ref\r\n const detectElementType = () => {\r\n const el = formElementRef.current;\r\n if (!el) return 'input';\r\n const tagName = el.tagName.toLowerCase();\r\n if (tagName === 'textarea') return 'textarea';\r\n if (tagName === 'select') return 'select';\r\n if (tagName === 'input') {\r\n const type = (el as HTMLInputElement).type;\r\n if (type === 'checkbox') return 'checkbox';\r\n if (type === 'radio') return 'radio';\r\n if (type === 'range') return 'range';\r\n if (type === 'file') return 'file';\r\n }\r\n return 'input';\r\n };\r\n\r\n // Add this element to the Map\r\n currentMeta.clientActivityState.elements.set(componentId, {\r\n domRef: formElementRef,\r\n elementType: detectElementType(),\r\n inputType: formElementRef.current?.type,\r\n mountedAt: Date.now(),\r\n });\r\n console.log('currentMeta', currentMeta);\r\n setShadowMetadata(stateKey, path, currentMeta);\r\n\r\n // Subscribe to path updates\r\n const unsubscribe = getGlobalStore\r\n .getState()\r\n .subscribeToPath(stateKeyPathKey, (newValue) => {\r\n if (!isCurrentlyDebouncing.current && localValue !== newValue) {\r\n forceUpdate({});\r\n }\r\n });\r\n\r\n // Cleanup\r\n return () => {\r\n unsubscribe();\r\n\r\n if (debounceTimeoutRef.current) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n isCurrentlyDebouncing.current = false;\r\n }\r\n\r\n // Remove element from Map\r\n const meta = getGlobalStore.getState().getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements) {\r\n meta.clientActivityState.elements.delete(componentId);\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n };\r\n }, []);\r\n\r\n const debouncedUpdate = useCallback(\r\n (newValue: any) => {\r\n // Type conversion logic (keep existing)\r\n if (typeInfo) {\r\n if (typeInfo.type === 'number' && typeof newValue === 'string') {\r\n newValue =\r\n newValue === ''\r\n ? typeInfo.nullable\r\n ? null\r\n : (typeInfo.default ?? 0)\r\n : Number(newValue);\r\n } else if (\r\n typeInfo.type === 'boolean' &&\r\n typeof newValue === 'string'\r\n ) {\r\n newValue = newValue === 'true' || newValue === '1';\r\n } else if (typeInfo.type === 'date' && typeof newValue === 'string') {\r\n newValue = new Date(newValue);\r\n }\r\n } else {\r\n const currentType = typeof globalStateValue;\r\n if (currentType === 'number' && typeof newValue === 'string') {\r\n newValue = newValue === '' ? 0 : Number(newValue);\r\n }\r\n }\r\n\r\n setLocalValue(newValue);\r\n\r\n // Update input activity details\r\n const { getShadowMetadata, setShadowMetadata } =\r\n getGlobalStore.getState();\r\n const meta = getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements?.has(componentId)) {\r\n const element = meta.clientActivityState.elements.get(componentId);\r\n if (element && element.currentActivity?.type === 'focus') {\r\n element!.currentActivity.details = {\r\n ...element!.currentActivity.details,\r\n value: newValue,\r\n previousValue:\r\n element!.currentActivity.details?.value || globalStateValue,\r\n inputLength:\r\n typeof newValue === 'string' ? newValue.length : undefined,\r\n keystrokeCount:\r\n (element!.currentActivity.details?.keystrokeCount || 0) + 1,\r\n };\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n }\r\n const element = meta?.clientActivityState?.elements?.get(componentId);\r\n\r\n // Notify plugins\r\n notifyFormUpdate({\r\n stateKey,\r\n activityType: 'input', // Changed from 'type'\r\n path,\r\n timestamp: Date.now(),\r\n details: {\r\n value: newValue,\r\n inputLength:\r\n typeof newValue === 'string' ? newValue.length : undefined,\r\n isComposing: false, // You'd need to track this from the actual input event\r\n isPasting: false, // You'd need to track this from paste events\r\n keystrokeCount:\r\n (element?.currentActivity?.details?.keystrokeCount || 0) + 1,\r\n },\r\n });\r\n // Validation (keep existing)\r\n const virtualOperation: UpdateTypeDetail = {\r\n stateKey,\r\n path,\r\n newValue: newValue,\r\n updateType: 'update',\r\n timeStamp: Date.now(),\r\n status: 'new',\r\n oldValue: globalStateValue,\r\n };\r\n runValidation(virtualOperation, 'onChange');\r\n\r\n // Debounce state update (keep existing)\r\n isCurrentlyDebouncing.current = true;\r\n if (debounceTimeoutRef.current) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n }\r\n\r\n const debounceTime = formOpts?.debounceTime ?? 200;\r\n debounceTimeoutRef.current = setTimeout(() => {\r\n isCurrentlyDebouncing.current = false;\r\n setState(newValue, path, {\r\n updateType: 'update',\r\n validationTrigger: 'onChange',\r\n });\r\n }, debounceTime);\r\n },\r\n [\r\n setState,\r\n path,\r\n formOpts?.debounceTime,\r\n typeInfo,\r\n globalStateValue,\r\n stateKey,\r\n componentId,\r\n ]\r\n );\r\n\r\n const handleFocus = useCallback(() => {\r\n const { getShadowMetadata, setShadowMetadata } = getGlobalStore.getState();\r\n\r\n // Update element's current activity\r\n const meta = getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements?.has(componentId)) {\r\n const element = meta.clientActivityState.elements.get(componentId)!;\r\n element.currentActivity = {\r\n type: 'focus',\r\n startTime: Date.now(),\r\n details: {\r\n value: localValue,\r\n inputLength:\r\n typeof localValue === 'string' ? localValue.length : undefined,\r\n },\r\n };\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n\r\n // Notify plugins\r\n notifyFormUpdate({\r\n stateKey,\r\n activityType: 'focus', // Changed from 'type'\r\n path,\r\n timestamp: Date.now(),\r\n details: {\r\n cursorPosition: formElementRef.current?.selectionStart,\r\n },\r\n });\r\n }, [stateKey, path, componentId, localValue]);\r\n const handleBlur = useCallback(() => {\r\n const { getShadowMetadata, setShadowMetadata } = getGlobalStore.getState();\r\n\r\n // Clear debounce if active\r\n if (debounceTimeoutRef.current) {\r\n clearTimeout(debounceTimeoutRef.current);\r\n debounceTimeoutRef.current = null;\r\n isCurrentlyDebouncing.current = false;\r\n setState(localValue, path, {\r\n updateType: 'update',\r\n validationTrigger: 'onBlur',\r\n });\r\n }\r\n\r\n // Clear element's current activity\r\n const meta = getShadowMetadata(stateKey, path);\r\n if (meta?.clientActivityState?.elements?.has(componentId)) {\r\n const element = meta.clientActivityState.elements.get(componentId)!;\r\n element.currentActivity = undefined;\r\n setShadowMetadata(stateKey, path, meta);\r\n }\r\n const focusStartTime =\r\n meta?.clientActivityState?.elements?.get(componentId)?.currentActivity\r\n ?.startTime;\r\n\r\n // Notify plugins\r\n notifyFormUpdate({\r\n stateKey,\r\n activityType: 'blur', // Changed from 'type'\r\n path,\r\n timestamp: Date.now(),\r\n duration: focusStartTime ? Date.now() - focusStartTime : undefined,\r\n details: {\r\n duration: focusStartTime ? Date.now() - focusStartTime : 0,\r\n },\r\n });\r\n\r\n // Run validation if configured\r\n const validationOptions = getInitialOptions(stateKey)?.validation;\r\n if (validationOptions?.onBlur) {\r\n const virtualOperation: UpdateTypeDetail = {\r\n stateKey,\r\n path,\r\n newValue: localValue,\r\n updateType: 'update',\r\n timeStamp: Date.now(),\r\n status: 'new',\r\n oldValue: globalStateValue,\r\n };\r\n runValidation(virtualOperation, 'onBlur');\r\n }\r\n }, [localValue, setState, path, stateKey, componentId, globalStateValue]);\r\n\r\n const baseState = rebuildStateShape({\r\n path: path,\r\n componentId: componentId,\r\n meta: undefined,\r\n });\r\n\r\n const stateWithInputProps = new Proxy(baseState, {\r\n get(target, prop) {\r\n if (prop === '$inputProps') {\r\n return {\r\n value: localValue ?? '',\r\n onChange: (e: any) => {\r\n debouncedUpdate(e.target.value);\r\n },\r\n onFocus: handleFocus,\r\n onBlur: handleBlur,\r\n ref: formElementRef,\r\n };\r\n }\r\n\r\n return target[prop];\r\n },\r\n });\r\n\r\n const initialElement = renderFn(stateWithInputProps);\r\n\r\n return (\r\n <ValidationWrapper formOpts={formOpts} path={path} stateKey={stateKey}>\r\n {initialElement}\r\n </ValidationWrapper>\r\n );\r\n}\r\n\r\nexport function useRegisterComponent(\r\n stateKey: string,\r\n componentId: string,\r\n forceUpdate: (o: object) => void\r\n) {\r\n const fullComponentId = `${stateKey}////${componentId}`;\r\n\r\n useLayoutEffect(() => {\r\n registerComponent(stateKey, fullComponentId, {\r\n forceUpdate: () => forceUpdate({}),\r\n paths: new Set(),\r\n reactiveType: ['component'],\r\n });\r\n return () => {\r\n unregisterComponent(stateKey, fullComponentId);\r\n };\r\n }, [stateKey, fullComponentId]);\r\n}\r\n\r\nexport function IsolatedComponentWrapper({\r\n stateKey,\r\n path, // The path of the parent node (e.g. ['form'])\r\n dependencies, // NEW: Optional array of Proxy objects or path arrays\r\n rebuildStateShape,\r\n renderFn,\r\n}: {\r\n stateKey: string;\r\n path: string[];\r\n dependencies?: any[]; // The explicit list of dependencies\r\n rebuildStateShape: (options: any) => any;\r\n renderFn: (state: any) => React.ReactNode;\r\n}) {\r\n const [componentId] = useState(() => uuidv4());\r\n const [, forceUpdate] = useState({});\r\n\r\n useRegisterComponent(stateKey, componentId, forceUpdate);\r\n\r\n const pathsToSubscribe = useMemo(() => {\r\n if (dependencies && dependencies.length > 0) {\r\n return dependencies.map((dep) => {\r\n return [stateKey, ...dep.$_path].join('.');\r\n });\r\n }\r\n\r\n return [[stateKey, ...path].join('.')];\r\n }, [stateKey, path, dependencies]);\r\n\r\n // 2. Subscribe to ALL calculated paths\r\n useEffect(() => {\r\n const store = getGlobalStore.getState();\r\n\r\n // Create an array of unsubscribe functions\r\n const unsubs = pathsToSubscribe.map((fullPathKey) => {\r\n return store.subscribeToPath(fullPathKey, () => {\r\n forceUpdate({});\r\n });\r\n });\r\n\r\n return () => {\r\n unsubs.forEach((unsub) => unsub());\r\n };\r\n }, [pathsToSubscribe]);\r\n\r\n const baseState = rebuildStateShape({\r\n path: path,\r\n componentId: componentId,\r\n meta: undefined,\r\n });\r\n\r\n return <>{renderFn(baseState)}</>;\r\n}\r\n// 1. Define the MINIMAL props needed.\r\ntype PluginWrapperProps = {\r\n children: React.ReactNode;\r\n stateKey: string;\r\n path: string[];\r\n pluginName: string;\r\n wrapperDepth: number;\r\n};\r\n\r\nconst PluginWrapper = memo(function PluginWrapper({\r\n children,\r\n stateKey,\r\n path,\r\n pluginName,\r\n wrapperDepth,\r\n}: PluginWrapperProps) {\r\n const [, forceUpdate] = useState({});\r\n\r\n useEffect(() => {\r\n const fullPathKey = [stateKey, ...path].join('.');\r\n const unsubscribe = getGlobalStore\r\n .getState()\r\n .subscribeToPath(fullPathKey, () => {\r\n forceUpdate({});\r\n });\r\n return unsubscribe;\r\n }, [stateKey, path]);\r\n\r\n const plugin = pluginStore\r\n .getState()\r\n .registeredPlugins.find((p) => p.name === pluginName);\r\n\r\n const stateHandler: StateObject<any> | undefined = pluginStore\r\n .getState()\r\n .stateHandlers.get(stateKey);\r\n\r\n const typeInfo = getGlobalStore.getState().getShadowNode(stateKey, path)\r\n ?._meta?.typeInfo;\r\n\r\n const options = pluginStore\r\n .getState()\r\n .pluginOptions.get(stateKey)\r\n ?.get(pluginName);\r\n\r\n const hookData = pluginStore.getState().getHookResult(stateKey, pluginName);\r\n\r\n if (!plugin?.formWrapper || !stateHandler) {\r\n return <>{children}</>;\r\n }\r\n\r\n const deconstructed = toDeconstructedMethods(stateHandler);\r\n const scopedMetadataContext = createScopedMetadataContext(\r\n stateKey,\r\n plugin.name,\r\n path\r\n );\r\n return plugin.formWrapper({\r\n element: children,\r\n path,\r\n stateKey,\r\n pluginName: plugin.name,\r\n ...deconstructed,\r\n\r\n ...scopedMetadataContext,\r\n options,\r\n hookData,\r\n fieldType: typeInfo?.type,\r\n wrapperDepth,\r\n });\r\n});\r\n"],"names":["getInitialOptions","getShadowMetadata","setShadowMetadata","getShadowValue","registerComponent","unregisterComponent","notifyPathSubscribers","subscribeToPath","getGlobalStore","stateHandlers","notifyFormUpdate","pluginStore","ValidationWrapper","formOpts","path","stateKey","children","thisStateOpts","validationState","status","errors","err","errorMessages","warningMessages","message","primarySeverity","registeredPlugins","pluginsApi","plugin","pluginName","hookData","scopedMetadata","createScopedMetadataContext","jsx","Fragment","React","MemoizedCogsItemWrapper","memo","ListItemWrapper","prevProps","nextProps","itemComponentId","itemPath","localIndex","arraySetter","rebuildStateShape","renderFn","forceUpdate","useState","inViewRef","inView","useInView","elementRef","useRef","fullKey","useRegisterComponent","setRefs","useCallback","element","useEffect","unsubscribe","e","itemValue","itemSetter","node","existingRef","FormElementWrapper","setState","componentId","uuidv4","formElementRef","stateKeyPathKey","typeInfo","globalStateValue","localValue","setLocalValue","isCurrentlyDebouncing","debounceTimeoutRef","isDeepEqual","currentMeta","detectElementType","el","tagName","type","newValue","meta","debouncedUpdate","runValidation","debounceTime","handleFocus","handleBlur","focusStartTime","baseState","stateWithInputProps","target","prop","initialElement","fullComponentId","useLayoutEffect","IsolatedComponentWrapper","dependencies","pathsToSubscribe","useMemo","dep","store","unsubs","fullPathKey","unsub","wrapperDepth","p","stateHandler","options","deconstructed","toDeconstructedMethods","scopedMetadataContext"],"mappings":";;;;;;;;;AA6BA,MAAM;AAAA,EACJ,mBAAAA;AAAA,EAEA,mBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,gBAAAC;AAAA,EAEA,mBAAAC;AAAA,EACA,qBAAAC;AAAA,EAEA,uBAAAC;AA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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginRunner.d.ts","sourceRoot":"","sources":["../src/PluginRunner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginRunner.d.ts","sourceRoot":"","sources":["../src/PluginRunner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAsKhF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAkDvE"}
|