cogsbox-state 0.5.474 → 0.5.475-canary.0

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