cogsbox-state 0.5.483 → 0.5.484

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