cogsbox-state 0.5.474 → 0.5.475-canary.1
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/README.md +11 -11
- package/dist/CogsState.d.ts +26 -17
- package/dist/CogsState.d.ts.map +1 -1
- package/dist/CogsState.jsx +383 -380
- package/dist/CogsState.jsx.map +1 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.jsx +231 -225
- package/dist/Components.jsx.map +1 -1
- package/dist/PluginRunner.d.ts.map +1 -1
- package/dist/PluginRunner.jsx +82 -67
- package/dist/PluginRunner.jsx.map +1 -1
- package/dist/index.js +17 -16
- package/dist/plugins.d.ts +98 -980
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +48 -36
- package/dist/plugins.js.map +1 -1
- package/dist/store.js +168 -169
- package/dist/store.js.map +1 -1
- package/package.json +4 -3
- package/src/CogsState.tsx +234 -551
- package/src/Components.tsx +43 -34
- package/src/PluginRunner.tsx +24 -6
- package/src/plugins.ts +93 -127
- package/src/store.ts +1 -1
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;
|
|
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,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,2CAkFxB;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;CACtB,kDAkEA;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;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,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"}
|
package/dist/Components.jsx
CHANGED
|
@@ -1,126 +1,140 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { pluginStore as
|
|
3
|
-
import {
|
|
4
|
-
import U, { memo as
|
|
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
|
|
7
|
-
import { v4 as
|
|
8
|
-
import { isDeepEqual as
|
|
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:
|
|
12
|
-
getShadowMetadata:
|
|
13
|
-
setShadowMetadata:
|
|
14
|
-
getShadowValue:
|
|
15
|
-
registerComponent:
|
|
16
|
-
unregisterComponent:
|
|
17
|
-
notifyPathSubscribers:
|
|
18
|
-
subscribeToPath:
|
|
19
|
-
} = b.getState(), { stateHandlers:
|
|
20
|
-
function
|
|
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:
|
|
24
|
-
children:
|
|
23
|
+
stateKey: n,
|
|
24
|
+
children: a
|
|
25
25
|
}) {
|
|
26
|
-
const { getInitialOptions:
|
|
27
|
-
...
|
|
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 =
|
|
30
|
-
return
|
|
31
|
-
|
|
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 ||
|
|
35
|
-
severity:
|
|
47
|
+
message: t?.validation?.hideMessage ? "" : t?.validation?.message || T || "",
|
|
48
|
+
severity: v,
|
|
36
49
|
hasErrors: d.length > 0,
|
|
37
|
-
hasWarnings:
|
|
38
|
-
allErrors:
|
|
50
|
+
hasWarnings: c.length > 0,
|
|
51
|
+
allErrors: m,
|
|
39
52
|
path: e,
|
|
40
|
-
getData: () =>
|
|
41
|
-
|
|
53
|
+
getData: () => r(n, e),
|
|
54
|
+
plugins: L
|
|
55
|
+
}) : /* @__PURE__ */ E(U.Fragment, { children: a }, e.toString()) });
|
|
42
56
|
}
|
|
43
|
-
const
|
|
44
|
-
|
|
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
|
|
61
|
+
function rt({
|
|
48
62
|
stateKey: t,
|
|
49
63
|
itemComponentId: e,
|
|
50
|
-
itemPath:
|
|
51
|
-
localIndex:
|
|
52
|
-
arraySetter:
|
|
53
|
-
rebuildStateShape:
|
|
54
|
-
renderFn:
|
|
64
|
+
itemPath: n,
|
|
65
|
+
localIndex: a,
|
|
66
|
+
arraySetter: u,
|
|
67
|
+
rebuildStateShape: s,
|
|
68
|
+
renderFn: r
|
|
55
69
|
}) {
|
|
56
|
-
const [,
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
(
|
|
60
|
-
A.current =
|
|
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
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
78
|
+
H(() => {
|
|
79
|
+
const i = nt(c, (I) => {
|
|
80
|
+
l({});
|
|
67
81
|
});
|
|
68
|
-
return () =>
|
|
69
|
-
}, [
|
|
70
|
-
if (!w || !
|
|
82
|
+
return () => i();
|
|
83
|
+
}, [c]), H(() => {
|
|
84
|
+
if (!w || !m || d.current)
|
|
71
85
|
return;
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
86
|
+
const i = A.current;
|
|
87
|
+
if (i && i.offsetHeight > 0) {
|
|
74
88
|
d.current = !0;
|
|
75
|
-
const
|
|
76
|
-
|
|
89
|
+
const I = i.offsetHeight;
|
|
90
|
+
V(t, n, {
|
|
77
91
|
virtualizer: {
|
|
78
|
-
itemHeight:
|
|
79
|
-
domRef:
|
|
92
|
+
itemHeight: I,
|
|
93
|
+
domRef: i
|
|
80
94
|
}
|
|
81
95
|
});
|
|
82
|
-
const F =
|
|
83
|
-
|
|
96
|
+
const F = n.slice(0, -1), k = [t, ...F].join(".");
|
|
97
|
+
et(k, {
|
|
84
98
|
type: "ITEMHEIGHT",
|
|
85
|
-
itemKey:
|
|
99
|
+
itemKey: n.join("."),
|
|
86
100
|
ref: A.current
|
|
87
101
|
});
|
|
88
102
|
}
|
|
89
|
-
}, [w,
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
103
|
+
}, [w, m, t, n]);
|
|
104
|
+
const v = G(t, n);
|
|
105
|
+
if (v === void 0)
|
|
92
106
|
return null;
|
|
93
|
-
const
|
|
94
|
-
currentState:
|
|
95
|
-
path:
|
|
107
|
+
const h = s({
|
|
108
|
+
currentState: v,
|
|
109
|
+
path: n,
|
|
96
110
|
componentId: e
|
|
97
|
-
}),
|
|
98
|
-
return /* @__PURE__ */
|
|
111
|
+
}), L = r(h, a, u);
|
|
112
|
+
return /* @__PURE__ */ E("div", { ref: T, children: L });
|
|
99
113
|
}
|
|
100
|
-
function
|
|
114
|
+
function ht({
|
|
101
115
|
stateKey: t,
|
|
102
116
|
path: e,
|
|
103
|
-
rebuildStateShape:
|
|
104
|
-
renderFn:
|
|
105
|
-
formOpts:
|
|
106
|
-
setState:
|
|
117
|
+
rebuildStateShape: n,
|
|
118
|
+
renderFn: a,
|
|
119
|
+
formOpts: u,
|
|
120
|
+
setState: s
|
|
107
121
|
}) {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
!
|
|
113
|
-
}, [d]),
|
|
114
|
-
const { getShadowMetadata:
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
121
|
-
if (
|
|
122
|
-
if (
|
|
123
|
-
const y =
|
|
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
|
-
|
|
145
|
+
g.clientActivityState.elements.set(r, {
|
|
132
146
|
domRef: f,
|
|
133
|
-
elementType:
|
|
147
|
+
elementType: p(),
|
|
134
148
|
inputType: f.current?.type,
|
|
135
149
|
mountedAt: Date.now()
|
|
136
|
-
}),
|
|
137
|
-
const
|
|
138
|
-
!
|
|
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
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
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
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
const { getShadowMetadata:
|
|
150
|
-
if (
|
|
151
|
-
const y =
|
|
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:
|
|
168
|
+
value: o,
|
|
155
169
|
previousValue: y.currentActivity.details?.value || d,
|
|
156
|
-
inputLength: typeof
|
|
170
|
+
inputLength: typeof o == "string" ? o.length : void 0,
|
|
157
171
|
keystrokeCount: (y.currentActivity.details?.keystrokeCount || 0) + 1
|
|
158
|
-
},
|
|
172
|
+
}, g(t, e, p));
|
|
159
173
|
}
|
|
160
|
-
const
|
|
161
|
-
|
|
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:
|
|
169
|
-
inputLength: typeof
|
|
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: (
|
|
188
|
+
keystrokeCount: (j?.currentActivity?.details?.keystrokeCount || 0) + 1
|
|
175
189
|
}
|
|
176
190
|
}), B({
|
|
177
191
|
stateKey: t,
|
|
178
192
|
path: e,
|
|
179
|
-
newValue:
|
|
193
|
+
newValue: o,
|
|
180
194
|
updateType: "update"
|
|
181
|
-
}, "onChange"),
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
},
|
|
202
|
+
}, W);
|
|
189
203
|
},
|
|
190
204
|
[
|
|
191
|
-
|
|
205
|
+
s,
|
|
192
206
|
e,
|
|
193
|
-
|
|
194
|
-
|
|
207
|
+
u?.debounceTime,
|
|
208
|
+
m,
|
|
195
209
|
d,
|
|
196
210
|
t,
|
|
197
|
-
|
|
211
|
+
r
|
|
198
212
|
]
|
|
199
|
-
),
|
|
200
|
-
const { getShadowMetadata:
|
|
201
|
-
if (
|
|
202
|
-
const
|
|
203
|
-
|
|
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:
|
|
208
|
-
inputLength: typeof
|
|
221
|
+
value: c,
|
|
222
|
+
inputLength: typeof c == "string" ? c.length : void 0
|
|
209
223
|
}
|
|
210
|
-
},
|
|
224
|
+
}, M(t, e, g);
|
|
211
225
|
}
|
|
212
|
-
|
|
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,
|
|
223
|
-
const { getShadowMetadata:
|
|
224
|
-
|
|
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
|
|
229
|
-
if (
|
|
230
|
-
const
|
|
231
|
-
|
|
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
|
|
234
|
-
|
|
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:
|
|
254
|
+
duration: p ? Date.now() - p : void 0,
|
|
241
255
|
details: {
|
|
242
|
-
duration:
|
|
256
|
+
duration: p ? Date.now() - p : 0
|
|
243
257
|
}
|
|
244
|
-
}),
|
|
258
|
+
}), Z(t)?.validation?.onBlur && B({
|
|
245
259
|
stateKey: t,
|
|
246
260
|
path: e,
|
|
247
|
-
newValue:
|
|
261
|
+
newValue: c,
|
|
248
262
|
updateType: "update"
|
|
249
263
|
}, "onBlur");
|
|
250
|
-
}, [
|
|
264
|
+
}, [c, s, e, t, r, d]), F = n({
|
|
251
265
|
path: e,
|
|
252
|
-
componentId:
|
|
266
|
+
componentId: r,
|
|
253
267
|
meta: void 0
|
|
254
|
-
}),
|
|
255
|
-
get(
|
|
256
|
-
return
|
|
257
|
-
value:
|
|
258
|
-
onChange: (
|
|
259
|
-
|
|
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:
|
|
262
|
-
onBlur:
|
|
275
|
+
onFocus: i,
|
|
276
|
+
onBlur: I,
|
|
263
277
|
ref: f
|
|
264
|
-
} :
|
|
278
|
+
} : o[M];
|
|
265
279
|
}
|
|
266
|
-
}), J =
|
|
267
|
-
|
|
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
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
forceUpdate: () =>
|
|
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
|
-
|
|
289
|
-
}), [t,
|
|
290
|
+
tt(t, a);
|
|
291
|
+
}), [t, a]);
|
|
290
292
|
}
|
|
291
|
-
const
|
|
292
|
-
const [e,
|
|
293
|
-
return
|
|
293
|
+
const it = (t) => {
|
|
294
|
+
const [e, n] = D(!1);
|
|
295
|
+
return q(() => {
|
|
294
296
|
if (!t.current) {
|
|
295
|
-
|
|
297
|
+
n(!0);
|
|
296
298
|
return;
|
|
297
299
|
}
|
|
298
|
-
const
|
|
299
|
-
if (
|
|
300
|
-
|
|
300
|
+
const a = Array.from(t.current.querySelectorAll("img"));
|
|
301
|
+
if (a.length === 0) {
|
|
302
|
+
n(!0);
|
|
301
303
|
return;
|
|
302
304
|
}
|
|
303
|
-
let
|
|
304
|
-
const
|
|
305
|
-
|
|
305
|
+
let u = 0;
|
|
306
|
+
const s = () => {
|
|
307
|
+
u++, u === a.length && n(!0);
|
|
306
308
|
};
|
|
307
|
-
return
|
|
308
|
-
|
|
309
|
+
return a.forEach((r) => {
|
|
310
|
+
r.complete ? s() : (r.addEventListener("load", s), r.addEventListener("error", s));
|
|
309
311
|
}), () => {
|
|
310
|
-
|
|
311
|
-
|
|
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
|
|
318
|
+
function yt({
|
|
317
319
|
stateKey: t,
|
|
318
320
|
path: e,
|
|
319
|
-
rebuildStateShape:
|
|
320
|
-
renderFn:
|
|
321
|
+
rebuildStateShape: n,
|
|
322
|
+
renderFn: a
|
|
321
323
|
}) {
|
|
322
|
-
const [
|
|
323
|
-
|
|
324
|
-
const f = b.getState().subscribeToPath(
|
|
325
|
-
|
|
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
|
-
}, [
|
|
329
|
-
const
|
|
330
|
+
}, [r]);
|
|
331
|
+
const l = n({
|
|
330
332
|
path: e,
|
|
331
|
-
componentId:
|
|
333
|
+
componentId: u,
|
|
332
334
|
meta: void 0
|
|
333
335
|
});
|
|
334
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ E(P, { children: a(l) });
|
|
335
337
|
}
|
|
336
|
-
|
|
338
|
+
$(function({
|
|
337
339
|
children: e,
|
|
338
|
-
stateKey:
|
|
339
|
-
path:
|
|
340
|
-
pluginName:
|
|
341
|
-
wrapperDepth:
|
|
340
|
+
stateKey: n,
|
|
341
|
+
path: a,
|
|
342
|
+
pluginName: u,
|
|
343
|
+
wrapperDepth: s
|
|
342
344
|
}) {
|
|
343
|
-
const [,
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
return b.getState().subscribeToPath(
|
|
347
|
-
|
|
345
|
+
const [, r] = D({});
|
|
346
|
+
H(() => {
|
|
347
|
+
const T = [n, ...a].join(".");
|
|
348
|
+
return b.getState().subscribeToPath(T, () => {
|
|
349
|
+
r({});
|
|
348
350
|
});
|
|
349
|
-
}, [
|
|
350
|
-
const
|
|
351
|
-
if (!
|
|
352
|
-
return /* @__PURE__ */
|
|
353
|
-
const d =
|
|
354
|
-
|
|
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:
|
|
357
|
-
stateKey:
|
|
358
|
-
pluginName:
|
|
359
|
-
...s,
|
|
362
|
+
path: a,
|
|
363
|
+
stateKey: n,
|
|
364
|
+
pluginName: l.name,
|
|
360
365
|
...d,
|
|
366
|
+
...c,
|
|
361
367
|
options: A,
|
|
362
|
-
hookData:
|
|
368
|
+
hookData: m,
|
|
363
369
|
fieldType: w?.type,
|
|
364
|
-
wrapperDepth:
|
|
370
|
+
wrapperDepth: s
|
|
365
371
|
});
|
|
366
372
|
});
|
|
367
373
|
export {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|