cogsbox-state 0.5.475-canary.6 → 0.5.475-canary.8
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 +4 -1
- package/dist/CogsState.d.ts.map +1 -1
- package/dist/CogsState.jsx +198 -198
- package/dist/CogsState.jsx.map +1 -1
- package/dist/Components.d.ts +5 -6
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.jsx +165 -158
- package/dist/Components.jsx.map +1 -1
- package/package.json +2 -2
package/dist/Components.d.ts
CHANGED
|
@@ -36,14 +36,13 @@ export declare function FormElementWrapper({ stateKey, path, rebuildStateShape,
|
|
|
36
36
|
setState: any;
|
|
37
37
|
}): import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
export declare function useRegisterComponent(stateKey: string, componentId: string, forceUpdate: (o: object) => void): void;
|
|
39
|
-
export declare function IsolatedComponentWrapper({ stateKey, path,
|
|
39
|
+
export declare function IsolatedComponentWrapper({ stateKey, path, // The path of the parent node (e.g. ['form'])
|
|
40
|
+
dependencies, // NEW: Optional array of Proxy objects or path arrays
|
|
41
|
+
rebuildStateShape, renderFn, }: {
|
|
40
42
|
stateKey: string;
|
|
41
43
|
path: string[];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
componentId: string;
|
|
45
|
-
meta?: any;
|
|
46
|
-
}) => any;
|
|
44
|
+
dependencies?: any[];
|
|
45
|
+
rebuildStateShape: (options: any) => any;
|
|
47
46
|
renderFn: (state: any) => React.ReactNode;
|
|
48
47
|
}): import("react/jsx-runtime").JSX.Element;
|
|
49
48
|
//# sourceMappingURL=Components.d.ts.map
|
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;AAOrB,OAAO,KASN,M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AC;IACzC,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,SAAS,CAAC;CAC3C,2CAuCA"}
|
package/dist/Components.jsx
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { pluginStore as
|
|
1
|
+
import { jsx as C, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { pluginStore as E } from "./pluginStore.js";
|
|
3
3
|
import { createScopedMetadataContext as _, toDeconstructedMethods as Q } from "./plugins.js";
|
|
4
|
-
import U, { memo as $, useState as D, useRef as R, useCallback as N, useEffect as H, useLayoutEffect as q } from "react";
|
|
5
|
-
import { getGlobalStore as
|
|
6
|
-
import { useInView as
|
|
4
|
+
import U, { memo as $, useState as D, useRef as R, useCallback as N, useEffect as H, useLayoutEffect as q, useMemo as X } from "react";
|
|
5
|
+
import { getGlobalStore as M } from "./store.js";
|
|
6
|
+
import { useInView as Y } from "react-intersection-observer";
|
|
7
7
|
import { v4 as z } from "uuid";
|
|
8
|
-
import { isDeepEqual as
|
|
8
|
+
import { isDeepEqual as Z } from "./utility.js";
|
|
9
9
|
import { runValidation as B } from "./validation.js";
|
|
10
10
|
const {
|
|
11
|
-
getInitialOptions:
|
|
12
|
-
getShadowMetadata:
|
|
13
|
-
setShadowMetadata:
|
|
11
|
+
getInitialOptions: V,
|
|
12
|
+
getShadowMetadata: St,
|
|
13
|
+
setShadowMetadata: K,
|
|
14
14
|
getShadowValue: G,
|
|
15
|
-
registerComponent:
|
|
16
|
-
unregisterComponent:
|
|
17
|
-
notifyPathSubscribers:
|
|
18
|
-
subscribeToPath:
|
|
19
|
-
} =
|
|
20
|
-
function
|
|
15
|
+
registerComponent: tt,
|
|
16
|
+
unregisterComponent: et,
|
|
17
|
+
notifyPathSubscribers: nt,
|
|
18
|
+
subscribeToPath: ot
|
|
19
|
+
} = M.getState(), { stateHandlers: vt, notifyFormUpdate: O } = E.getState();
|
|
20
|
+
function rt({
|
|
21
21
|
formOpts: t,
|
|
22
22
|
path: e,
|
|
23
23
|
stateKey: n,
|
|
24
24
|
children: a
|
|
25
25
|
}) {
|
|
26
|
-
const { getInitialOptions:
|
|
26
|
+
const { getInitialOptions: m, getShadowMetadata: c, getShadowValue: r } = M.getState(), l = m(n), p = c(n, e)?.validation, T = p?.status || "NOT_VALIDATED", s = (p?.errors || []).map((i) => ({
|
|
27
27
|
...i,
|
|
28
28
|
path: e
|
|
29
|
-
})), d =
|
|
30
|
-
return
|
|
29
|
+
})), d = s.filter((i) => i.severity === "error").map((i) => i.message), u = s.filter((i) => i.severity === "warning").map((i) => i.message), A = d[0] || u[0], h = d.length > 0 ? "error" : u.length > 0 ? "warning" : void 0, { registeredPlugins: y } = E.getState(), L = {};
|
|
30
|
+
return y.forEach((i) => {
|
|
31
31
|
if (l && l.hasOwnProperty(i.name)) {
|
|
32
|
-
const I = i.name, F =
|
|
32
|
+
const I = i.name, F = E.getState().getHookResult(n, I), k = _(
|
|
33
33
|
n,
|
|
34
34
|
I,
|
|
35
35
|
e
|
|
@@ -40,138 +40,138 @@ function ot({
|
|
|
40
40
|
setFieldMetaData: k.setFieldMetaData
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
}), /* @__PURE__ */
|
|
44
|
-
children: /* @__PURE__ */
|
|
45
|
-
status:
|
|
43
|
+
}), /* @__PURE__ */ C(x, { children: l?.formElements?.validation && !t?.validation?.disable ? l.formElements.validation({
|
|
44
|
+
children: /* @__PURE__ */ C(U.Fragment, { children: a }, e.toString()),
|
|
45
|
+
status: T,
|
|
46
46
|
// Now passes the new ValidationStatus type
|
|
47
|
-
message: t?.validation?.hideMessage ? "" : t?.validation?.message ||
|
|
48
|
-
severity:
|
|
47
|
+
message: t?.validation?.hideMessage ? "" : t?.validation?.message || A || "",
|
|
48
|
+
severity: h,
|
|
49
49
|
hasErrors: d.length > 0,
|
|
50
|
-
hasWarnings:
|
|
51
|
-
allErrors:
|
|
50
|
+
hasWarnings: u.length > 0,
|
|
51
|
+
allErrors: s,
|
|
52
52
|
path: e,
|
|
53
53
|
getData: () => r(n, e),
|
|
54
54
|
plugins: L
|
|
55
|
-
}) : /* @__PURE__ */
|
|
55
|
+
}) : /* @__PURE__ */ C(U.Fragment, { children: a }, e.toString()) });
|
|
56
56
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
57
|
+
const ht = $(
|
|
58
|
+
it,
|
|
59
59
|
(t, e) => t.itemPath.join(".") === e.itemPath.join(".") && t.stateKey === e.stateKey && t.itemComponentId === e.itemComponentId && t.localIndex === e.localIndex
|
|
60
60
|
);
|
|
61
|
-
function
|
|
61
|
+
function it({
|
|
62
62
|
stateKey: t,
|
|
63
63
|
itemComponentId: e,
|
|
64
64
|
itemPath: n,
|
|
65
65
|
localIndex: a,
|
|
66
|
-
arraySetter:
|
|
67
|
-
rebuildStateShape:
|
|
66
|
+
arraySetter: m,
|
|
67
|
+
rebuildStateShape: c,
|
|
68
68
|
renderFn: r
|
|
69
69
|
}) {
|
|
70
|
-
const [, l] = D({}), { ref: f, inView:
|
|
71
|
-
|
|
72
|
-
const
|
|
70
|
+
const [, l] = D({}), { ref: f, inView: p } = Y(), T = R(null), s = at(T), d = R(!1), u = [t, ...n].join(".");
|
|
71
|
+
P(t, e, l);
|
|
72
|
+
const A = N(
|
|
73
73
|
(i) => {
|
|
74
|
-
|
|
74
|
+
T.current = i, f(i);
|
|
75
75
|
},
|
|
76
76
|
[f]
|
|
77
77
|
);
|
|
78
78
|
H(() => {
|
|
79
|
-
const i =
|
|
79
|
+
const i = ot(u, (I) => {
|
|
80
80
|
l({});
|
|
81
81
|
});
|
|
82
82
|
return () => i();
|
|
83
|
-
}, [
|
|
84
|
-
if (!
|
|
83
|
+
}, [u]), H(() => {
|
|
84
|
+
if (!p || !s || d.current)
|
|
85
85
|
return;
|
|
86
|
-
const i =
|
|
86
|
+
const i = T.current;
|
|
87
87
|
if (i && i.offsetHeight > 0) {
|
|
88
88
|
d.current = !0;
|
|
89
89
|
const I = i.offsetHeight;
|
|
90
|
-
|
|
90
|
+
K(t, n, {
|
|
91
91
|
virtualizer: {
|
|
92
92
|
itemHeight: I,
|
|
93
93
|
domRef: i
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
const F = n.slice(0, -1), k = [t, ...F].join(".");
|
|
97
|
-
|
|
97
|
+
nt(k, {
|
|
98
98
|
type: "ITEMHEIGHT",
|
|
99
99
|
itemKey: n.join("."),
|
|
100
|
-
ref:
|
|
100
|
+
ref: T.current
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
}, [
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
103
|
+
}, [p, s, t, n]);
|
|
104
|
+
const h = G(t, n);
|
|
105
|
+
if (h === void 0)
|
|
106
106
|
return null;
|
|
107
|
-
const
|
|
108
|
-
currentState:
|
|
107
|
+
const y = c({
|
|
108
|
+
currentState: h,
|
|
109
109
|
path: n,
|
|
110
110
|
componentId: e
|
|
111
|
-
}), L = r(
|
|
112
|
-
return /* @__PURE__ */
|
|
111
|
+
}), L = r(y, a, m);
|
|
112
|
+
return /* @__PURE__ */ C("div", { ref: A, children: L });
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function yt({
|
|
115
115
|
stateKey: t,
|
|
116
116
|
path: e,
|
|
117
117
|
rebuildStateShape: n,
|
|
118
118
|
renderFn: a,
|
|
119
|
-
formOpts:
|
|
120
|
-
setState:
|
|
119
|
+
formOpts: m,
|
|
120
|
+
setState: c
|
|
121
121
|
}) {
|
|
122
|
-
const r = R(z()).current, [, l] = D({}), f = R(null),
|
|
123
|
-
|
|
124
|
-
const
|
|
122
|
+
const r = R(z()).current, [, l] = D({}), f = R(null), p = [t, ...e].join(".");
|
|
123
|
+
P(t, r, l);
|
|
124
|
+
const s = M.getState().getShadowNode(t, e)?._meta?.typeInfo, d = G(t, e), [u, A] = D(d), h = R(!1), y = R(null);
|
|
125
125
|
H(() => {
|
|
126
|
-
!
|
|
126
|
+
!h.current && !Z(d, u) && A(d);
|
|
127
127
|
}, [d]), H(() => {
|
|
128
|
-
const { getShadowMetadata: o, setShadowMetadata:
|
|
128
|
+
const { getShadowMetadata: o, setShadowMetadata: w } = M.getState(), g = o(t, e) || {};
|
|
129
129
|
g.clientActivityState || (g.clientActivityState = { elements: /* @__PURE__ */ new Map() });
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
136
|
-
if (
|
|
137
|
-
const
|
|
138
|
-
if (
|
|
139
|
-
if (
|
|
140
|
-
if (
|
|
141
|
-
if (
|
|
130
|
+
const S = () => {
|
|
131
|
+
const v = f.current;
|
|
132
|
+
if (!v) return "input";
|
|
133
|
+
const j = v.tagName.toLowerCase();
|
|
134
|
+
if (j === "textarea") return "textarea";
|
|
135
|
+
if (j === "select") return "select";
|
|
136
|
+
if (j === "input") {
|
|
137
|
+
const b = v.type;
|
|
138
|
+
if (b === "checkbox") return "checkbox";
|
|
139
|
+
if (b === "radio") return "radio";
|
|
140
|
+
if (b === "range") return "range";
|
|
141
|
+
if (b === "file") return "file";
|
|
142
142
|
}
|
|
143
143
|
return "input";
|
|
144
144
|
};
|
|
145
145
|
g.clientActivityState.elements.set(r, {
|
|
146
146
|
domRef: f,
|
|
147
|
-
elementType:
|
|
147
|
+
elementType: S(),
|
|
148
148
|
inputType: f.current?.type,
|
|
149
149
|
mountedAt: Date.now()
|
|
150
|
-
}),
|
|
151
|
-
const
|
|
152
|
-
!
|
|
150
|
+
}), w(t, e, g);
|
|
151
|
+
const W = M.getState().subscribeToPath(p, (v) => {
|
|
152
|
+
!h.current && u !== v && l({});
|
|
153
153
|
});
|
|
154
154
|
return () => {
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
155
|
+
W(), y.current && (clearTimeout(y.current), h.current = !1);
|
|
156
|
+
const v = M.getState().getShadowMetadata(t, e);
|
|
157
|
+
v?.clientActivityState?.elements && (v.clientActivityState.elements.delete(r), w(t, e, v));
|
|
158
158
|
};
|
|
159
159
|
}, []);
|
|
160
160
|
const L = N(
|
|
161
161
|
(o) => {
|
|
162
|
-
|
|
163
|
-
const { getShadowMetadata:
|
|
164
|
-
if (
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
...
|
|
162
|
+
s ? s.type === "number" && typeof o == "string" ? o = o === "" ? s.nullable ? null : s.default ?? 0 : Number(o) : s.type === "boolean" && typeof o == "string" ? o = o === "true" || o === "1" : s.type === "date" && typeof o == "string" && (o = new Date(o)) : typeof d === "number" && typeof o == "string" && (o = o === "" ? 0 : Number(o)), A(o);
|
|
163
|
+
const { getShadowMetadata: w, setShadowMetadata: g } = M.getState(), S = w(t, e);
|
|
164
|
+
if (S?.clientActivityState?.elements?.has(r)) {
|
|
165
|
+
const b = S.clientActivityState.elements.get(r);
|
|
166
|
+
b && b.currentActivity?.type === "focus" && (b.currentActivity.details = {
|
|
167
|
+
...b.currentActivity.details,
|
|
168
168
|
value: o,
|
|
169
|
-
previousValue:
|
|
169
|
+
previousValue: b.currentActivity.details?.value || d,
|
|
170
170
|
inputLength: typeof o == "string" ? o.length : void 0,
|
|
171
|
-
keystrokeCount: (
|
|
172
|
-
}, g(t, e,
|
|
171
|
+
keystrokeCount: (b.currentActivity.details?.keystrokeCount || 0) + 1
|
|
172
|
+
}, g(t, e, S));
|
|
173
173
|
}
|
|
174
|
-
const
|
|
174
|
+
const W = S?.clientActivityState?.elements?.get(r);
|
|
175
175
|
O({
|
|
176
176
|
stateKey: t,
|
|
177
177
|
activityType: "input",
|
|
@@ -185,43 +185,43 @@ function ht({
|
|
|
185
185
|
// You'd need to track this from the actual input event
|
|
186
186
|
isPasting: !1,
|
|
187
187
|
// You'd need to track this from paste events
|
|
188
|
-
keystrokeCount: (
|
|
188
|
+
keystrokeCount: (W?.currentActivity?.details?.keystrokeCount || 0) + 1
|
|
189
189
|
}
|
|
190
190
|
}), B({
|
|
191
191
|
stateKey: t,
|
|
192
192
|
path: e,
|
|
193
193
|
newValue: o,
|
|
194
194
|
updateType: "update"
|
|
195
|
-
}, "onChange"),
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
}, "onChange"), h.current = !0, y.current && clearTimeout(y.current);
|
|
196
|
+
const j = m?.debounceTime ?? 200;
|
|
197
|
+
y.current = setTimeout(() => {
|
|
198
|
+
h.current = !1, c(o, e, {
|
|
199
199
|
updateType: "update",
|
|
200
200
|
validationTrigger: "onChange"
|
|
201
201
|
});
|
|
202
|
-
},
|
|
202
|
+
}, j);
|
|
203
203
|
},
|
|
204
204
|
[
|
|
205
|
-
|
|
205
|
+
c,
|
|
206
206
|
e,
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
m?.debounceTime,
|
|
208
|
+
s,
|
|
209
209
|
d,
|
|
210
210
|
t,
|
|
211
211
|
r
|
|
212
212
|
]
|
|
213
213
|
), i = N(() => {
|
|
214
|
-
const { getShadowMetadata: o, setShadowMetadata:
|
|
214
|
+
const { getShadowMetadata: o, setShadowMetadata: w } = M.getState(), g = o(t, e);
|
|
215
215
|
if (g?.clientActivityState?.elements?.has(r)) {
|
|
216
|
-
const
|
|
217
|
-
|
|
216
|
+
const S = g.clientActivityState.elements.get(r);
|
|
217
|
+
S.currentActivity = {
|
|
218
218
|
type: "focus",
|
|
219
219
|
startTime: Date.now(),
|
|
220
220
|
details: {
|
|
221
|
-
value:
|
|
222
|
-
inputLength: typeof
|
|
221
|
+
value: u,
|
|
222
|
+
inputLength: typeof u == "string" ? u.length : void 0
|
|
223
223
|
}
|
|
224
|
-
},
|
|
224
|
+
}, w(t, e, g);
|
|
225
225
|
}
|
|
226
226
|
O({
|
|
227
227
|
stateKey: t,
|
|
@@ -233,64 +233,64 @@ function ht({
|
|
|
233
233
|
cursorPosition: f.current?.selectionStart
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
|
-
}, [t, e, r,
|
|
237
|
-
const { getShadowMetadata: o, setShadowMetadata:
|
|
238
|
-
|
|
236
|
+
}, [t, e, r, u]), I = N(() => {
|
|
237
|
+
const { getShadowMetadata: o, setShadowMetadata: w } = M.getState();
|
|
238
|
+
y.current && (clearTimeout(y.current), y.current = null, h.current = !1, c(u, e, {
|
|
239
239
|
updateType: "update",
|
|
240
240
|
validationTrigger: "onBlur"
|
|
241
241
|
}));
|
|
242
242
|
const g = o(t, e);
|
|
243
243
|
if (g?.clientActivityState?.elements?.has(r)) {
|
|
244
|
-
const
|
|
245
|
-
|
|
244
|
+
const v = g.clientActivityState.elements.get(r);
|
|
245
|
+
v.currentActivity = void 0, w(t, e, g);
|
|
246
246
|
}
|
|
247
|
-
const
|
|
247
|
+
const S = g?.clientActivityState?.elements?.get(r)?.currentActivity?.startTime;
|
|
248
248
|
O({
|
|
249
249
|
stateKey: t,
|
|
250
250
|
activityType: "blur",
|
|
251
251
|
// Changed from 'type'
|
|
252
252
|
path: e,
|
|
253
253
|
timestamp: Date.now(),
|
|
254
|
-
duration:
|
|
254
|
+
duration: S ? Date.now() - S : void 0,
|
|
255
255
|
details: {
|
|
256
|
-
duration:
|
|
256
|
+
duration: S ? Date.now() - S : 0
|
|
257
257
|
}
|
|
258
|
-
}),
|
|
258
|
+
}), V(t)?.validation?.onBlur && B({
|
|
259
259
|
stateKey: t,
|
|
260
260
|
path: e,
|
|
261
|
-
newValue:
|
|
261
|
+
newValue: u,
|
|
262
262
|
updateType: "update"
|
|
263
263
|
}, "onBlur");
|
|
264
|
-
}, [
|
|
264
|
+
}, [u, c, e, t, r, d]), F = n({
|
|
265
265
|
path: e,
|
|
266
266
|
componentId: r,
|
|
267
267
|
meta: void 0
|
|
268
268
|
}), k = new Proxy(F, {
|
|
269
|
-
get(o,
|
|
270
|
-
return
|
|
271
|
-
value:
|
|
269
|
+
get(o, w) {
|
|
270
|
+
return w === "$inputProps" ? {
|
|
271
|
+
value: u ?? "",
|
|
272
272
|
onChange: (g) => {
|
|
273
273
|
L(g.target.value);
|
|
274
274
|
},
|
|
275
275
|
onFocus: i,
|
|
276
276
|
onBlur: I,
|
|
277
277
|
ref: f
|
|
278
|
-
} : o[
|
|
278
|
+
} : o[w];
|
|
279
279
|
}
|
|
280
280
|
}), J = a(k);
|
|
281
|
-
return /* @__PURE__ */
|
|
281
|
+
return /* @__PURE__ */ C(rt, { formOpts: m, path: e, stateKey: t, children: J });
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function P(t, e, n) {
|
|
284
284
|
const a = `${t}////${e}`;
|
|
285
|
-
q(() => (
|
|
285
|
+
q(() => (tt(t, a, {
|
|
286
286
|
forceUpdate: () => n({}),
|
|
287
287
|
paths: /* @__PURE__ */ new Set(),
|
|
288
288
|
reactiveType: ["component"]
|
|
289
289
|
}), () => {
|
|
290
|
-
|
|
290
|
+
et(t, a);
|
|
291
291
|
}), [t, a]);
|
|
292
292
|
}
|
|
293
|
-
const
|
|
293
|
+
const at = (t) => {
|
|
294
294
|
const [e, n] = D(!1);
|
|
295
295
|
return q(() => {
|
|
296
296
|
if (!t.current) {
|
|
@@ -302,57 +302,64 @@ const it = (t) => {
|
|
|
302
302
|
n(!0);
|
|
303
303
|
return;
|
|
304
304
|
}
|
|
305
|
-
let
|
|
306
|
-
const
|
|
307
|
-
|
|
305
|
+
let m = 0;
|
|
306
|
+
const c = () => {
|
|
307
|
+
m++, m === a.length && n(!0);
|
|
308
308
|
};
|
|
309
309
|
return a.forEach((r) => {
|
|
310
|
-
r.complete ?
|
|
310
|
+
r.complete ? c() : (r.addEventListener("load", c), r.addEventListener("error", c));
|
|
311
311
|
}), () => {
|
|
312
312
|
a.forEach((r) => {
|
|
313
|
-
r.removeEventListener("load",
|
|
313
|
+
r.removeEventListener("load", c), r.removeEventListener("error", c);
|
|
314
314
|
});
|
|
315
315
|
};
|
|
316
316
|
}, [t.current]), e;
|
|
317
317
|
};
|
|
318
|
-
function
|
|
318
|
+
function bt({
|
|
319
319
|
stateKey: t,
|
|
320
320
|
path: e,
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
// The path of the parent node (e.g. ['form'])
|
|
322
|
+
dependencies: n,
|
|
323
|
+
// NEW: Optional array of Proxy objects or path arrays
|
|
324
|
+
rebuildStateShape: a,
|
|
325
|
+
renderFn: m
|
|
323
326
|
}) {
|
|
324
|
-
const [
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
327
|
+
const [c] = D(() => z()), [, r] = D({});
|
|
328
|
+
P(t, c, r);
|
|
329
|
+
const l = X(() => n && n.length > 0 ? n.map((p) => [t, ...p.$_path].join(".")) : [[t, ...e].join(".")], [t, e, n]);
|
|
330
|
+
H(() => {
|
|
331
|
+
const p = M.getState(), T = l.map((s) => p.subscribeToPath(s, () => {
|
|
332
|
+
r({});
|
|
333
|
+
}));
|
|
334
|
+
return () => {
|
|
335
|
+
T.forEach((s) => s());
|
|
336
|
+
};
|
|
337
|
+
}, [l]);
|
|
338
|
+
const f = a({
|
|
332
339
|
path: e,
|
|
333
|
-
componentId:
|
|
340
|
+
componentId: c,
|
|
334
341
|
meta: void 0
|
|
335
342
|
});
|
|
336
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ C(x, { children: m(f) });
|
|
337
344
|
}
|
|
338
345
|
$(function({
|
|
339
346
|
children: e,
|
|
340
347
|
stateKey: n,
|
|
341
348
|
path: a,
|
|
342
|
-
pluginName:
|
|
343
|
-
wrapperDepth:
|
|
349
|
+
pluginName: m,
|
|
350
|
+
wrapperDepth: c
|
|
344
351
|
}) {
|
|
345
352
|
const [, r] = D({});
|
|
346
353
|
H(() => {
|
|
347
|
-
const
|
|
348
|
-
return
|
|
354
|
+
const A = [n, ...a].join(".");
|
|
355
|
+
return M.getState().subscribeToPath(A, () => {
|
|
349
356
|
r({});
|
|
350
357
|
});
|
|
351
358
|
}, [n, a]);
|
|
352
|
-
const l =
|
|
359
|
+
const l = E.getState().registeredPlugins.find((A) => A.name === m), f = E.getState().stateHandlers.get(n), p = M.getState().getShadowNode(n, a)?._meta?.typeInfo, T = E.getState().pluginOptions.get(n)?.get(m), s = E.getState().getHookResult(n, m);
|
|
353
360
|
if (!l?.formWrapper || !f)
|
|
354
|
-
return /* @__PURE__ */
|
|
355
|
-
const d = Q(f),
|
|
361
|
+
return /* @__PURE__ */ C(x, { children: e });
|
|
362
|
+
const d = Q(f), u = _(
|
|
356
363
|
n,
|
|
357
364
|
l.name,
|
|
358
365
|
a
|
|
@@ -363,19 +370,19 @@ $(function({
|
|
|
363
370
|
stateKey: n,
|
|
364
371
|
pluginName: l.name,
|
|
365
372
|
...d,
|
|
366
|
-
...
|
|
367
|
-
options:
|
|
368
|
-
hookData:
|
|
369
|
-
fieldType:
|
|
370
|
-
wrapperDepth:
|
|
373
|
+
...u,
|
|
374
|
+
options: T,
|
|
375
|
+
hookData: s,
|
|
376
|
+
fieldType: p?.type,
|
|
377
|
+
wrapperDepth: c
|
|
371
378
|
});
|
|
372
379
|
});
|
|
373
380
|
export {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
381
|
+
yt as FormElementWrapper,
|
|
382
|
+
bt as IsolatedComponentWrapper,
|
|
383
|
+
it as ListItemWrapper,
|
|
384
|
+
ht as MemoizedCogsItemWrapper,
|
|
385
|
+
rt as ValidationWrapper,
|
|
386
|
+
P as useRegisterComponent
|
|
380
387
|
};
|
|
381
388
|
//# sourceMappingURL=Components.jsx.map
|