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