cogsbox-state 0.5.473 → 0.5.474

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