@formvk/react 0.0.0-stage → 0.1.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.
- package/dist/index.d.ts +231 -0
- package/dist/index.js +616 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -3
- package/src/__tests__/expression.spec.tsx +87 -0
- package/src/__tests__/form.spec.tsx +164 -0
- package/src/__tests__/hooks.spec.tsx +198 -0
- package/src/__tests__/render.spec.tsx +704 -0
- package/src/__tests__/schema.spec.tsx +598 -0
- package/src/__tests__/shared.tsx +44 -0
- package/src/components/ExpressionScope.tsx +16 -0
- package/src/components/FormConsumer.tsx +20 -0
- package/src/components/FormProvider.tsx +35 -0
- package/src/components/ReactiveField.tsx +161 -0
- package/src/components/RecursionField.tsx +113 -0
- package/src/components/SchemaField.tsx +195 -0
- package/src/components/index.ts +7 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/useAttach.ts +20 -0
- package/src/hooks/useField.ts +8 -0
- package/src/hooks/useFieldSchema.ts +8 -0
- package/src/hooks/useForm.ts +8 -0
- package/src/hooks/useFormEffects.ts +19 -0
- package/src/hooks/useParentForm.ts +18 -0
- package/src/index.ts +5 -0
- package/src/shared/connect.tsx +72 -0
- package/src/shared/context.ts +15 -0
- package/src/shared/createForm.ts +10 -0
- package/src/shared/index.ts +2 -0
- package/src/types/index.ts +144 -0
- package/src/utils/getRawComponent.ts +12 -0
- package/src/utils/slots.ts +9 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +7 -0
- package/vite.config.ts +32 -0
- package/README.md +0 -3
package/dist/index.js
ADDED
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
import { Schema as e, createFragment as t } from "@formvk/schema";
|
|
2
|
+
import { FormPath as n, each as r, isFn as i, isStr as a, isValid as o, lazyMerge as s, uid as c } from "@formvk/shared";
|
|
3
|
+
import { createContext as l, createElement as u, isValidElement as d, useContext as f, useEffect as p, useLayoutEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
4
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
5
|
+
import { observer as y } from "@formvk/reactive-react";
|
|
6
|
+
import { createForm as b, isObjectField as x, isVoidField as S } from "@formvk/core";
|
|
7
|
+
import { toJS as C } from "@formvk/reactive";
|
|
8
|
+
export * from "@formvk/schema";
|
|
9
|
+
// \0rolldown/runtime.js
|
|
10
|
+
var w = Object.create, T = Object.defineProperty, E = Object.getOwnPropertyDescriptor, ee = Object.getOwnPropertyNames, D = Object.getPrototypeOf, O = Object.prototype.hasOwnProperty, k = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), A = (e, t, n, r) => {
|
|
11
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = ee(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !O.call(e, s) && s !== n && T(e, s, {
|
|
12
|
+
get: ((e) => t[e]).bind(null, s),
|
|
13
|
+
enumerable: !(r = E(t, s)) || r.enumerable
|
|
14
|
+
});
|
|
15
|
+
return e;
|
|
16
|
+
}, j = (e, t, n) => (n = e == null ? {} : w(D(e)), A(t || !e || !e.__esModule || !O.call(e, "default") ? T(n, "default", {
|
|
17
|
+
value: e,
|
|
18
|
+
enumerable: !0
|
|
19
|
+
}) : n, e)), M = l(void 0), N = l(void 0), P = l(void 0), F = l(void 0), I = l(void 0);
|
|
20
|
+
// src/components/ExpressionScope.tsx
|
|
21
|
+
function L(e) {
|
|
22
|
+
let t = f(F), n = h(() => s(t ?? {}, e.value), [t, e.value]);
|
|
23
|
+
return /* @__PURE__ */ v(F.Provider, {
|
|
24
|
+
value: n,
|
|
25
|
+
children: e.children
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
L.displayName = "ExpressionScope";
|
|
29
|
+
// src/hooks/useForm.ts
|
|
30
|
+
function R() {
|
|
31
|
+
return f(M);
|
|
32
|
+
}
|
|
33
|
+
// src/components/FormConsumer.tsx
|
|
34
|
+
var z = y((e) => {
|
|
35
|
+
let t = R(), { children: n } = e;
|
|
36
|
+
return typeof n == "function" ? n({ form: t }) : null;
|
|
37
|
+
});
|
|
38
|
+
z.displayName = "FormConsumer";
|
|
39
|
+
// src/hooks/useAttach.ts
|
|
40
|
+
function B(e) {
|
|
41
|
+
return p(() => (e?.onMount(), () => {
|
|
42
|
+
e?.onUnmount();
|
|
43
|
+
}), [e]), e;
|
|
44
|
+
}
|
|
45
|
+
// src/components/FormProvider.tsx
|
|
46
|
+
function V(e) {
|
|
47
|
+
let { form: t, children: n } = e;
|
|
48
|
+
return B(t), /* @__PURE__ */ v(M.Provider, {
|
|
49
|
+
value: t,
|
|
50
|
+
children: /* @__PURE__ */ v(N.Provider, {
|
|
51
|
+
value: void 0,
|
|
52
|
+
children: /* @__PURE__ */ v(P.Provider, {
|
|
53
|
+
value: void 0,
|
|
54
|
+
children: /* @__PURE__ */ v(F.Provider, {
|
|
55
|
+
value: void 0,
|
|
56
|
+
children: /* @__PURE__ */ v(I.Provider, {
|
|
57
|
+
value: void 0,
|
|
58
|
+
children: n
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
V.displayName = "FormProvider";
|
|
66
|
+
// src/hooks/useField.ts
|
|
67
|
+
function H() {
|
|
68
|
+
return f(N);
|
|
69
|
+
}
|
|
70
|
+
// src/utils/getRawComponent.ts
|
|
71
|
+
function U(e, t) {
|
|
72
|
+
return a(t) ? n.getIn(e, t) ?? t : t;
|
|
73
|
+
}
|
|
74
|
+
// src/utils/slots.ts
|
|
75
|
+
function W(e) {
|
|
76
|
+
return Array.isArray(e) ? e : e == null ? [] : [e];
|
|
77
|
+
}
|
|
78
|
+
// src/components/ReactiveField.tsx
|
|
79
|
+
function G(e) {
|
|
80
|
+
return e ? i(e) ? !0 : typeof e == "object" && ("$$typeof" in e || i(e.render)) : !1;
|
|
81
|
+
}
|
|
82
|
+
function te(e) {
|
|
83
|
+
return d(e) || a(e) ? e : G(e) ? u(e) : e;
|
|
84
|
+
}
|
|
85
|
+
function ne(e, t) {
|
|
86
|
+
let n = { ...e };
|
|
87
|
+
if (!t) return n;
|
|
88
|
+
function i(e, t) {
|
|
89
|
+
let r = te(t), i = n[e];
|
|
90
|
+
n[e] = i === void 0 ? r : [].concat(W(i), W(r));
|
|
91
|
+
}
|
|
92
|
+
return a(t) || d(t) || G(t) ? i("default", t) : typeof t == "object" && r(t, (e, t) => {
|
|
93
|
+
i(t, e);
|
|
94
|
+
}), n;
|
|
95
|
+
}
|
|
96
|
+
function re(e) {
|
|
97
|
+
let t = {}, n = {};
|
|
98
|
+
return r(e, (e, r) => {
|
|
99
|
+
if (r.startsWith("on")) {
|
|
100
|
+
let t = `${r[2].toLowerCase()}${r.slice(3)}`;
|
|
101
|
+
n[t] = n[t] ?? e;
|
|
102
|
+
} else r.startsWith("@") ? n[r.slice(1)] = e : t[r] = e;
|
|
103
|
+
}), {
|
|
104
|
+
props: t,
|
|
105
|
+
events: n
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function K(e) {
|
|
109
|
+
let t = {};
|
|
110
|
+
return r(e, (e, n) => {
|
|
111
|
+
t[`on${n.charAt(0).toUpperCase()}${n.slice(1)}`] = e;
|
|
112
|
+
}), t;
|
|
113
|
+
}
|
|
114
|
+
var q = y((e) => {
|
|
115
|
+
let t = R(), n = H(), r = f(I), { fieldType: i = "Field", fieldProps: o, slots: s, children: c } = e, l = h(() => {
|
|
116
|
+
let e = o ?? {};
|
|
117
|
+
return t?.[`create${i}`]?.({
|
|
118
|
+
...e,
|
|
119
|
+
basePath: e.basePath ?? n?.address
|
|
120
|
+
});
|
|
121
|
+
}, [
|
|
122
|
+
t,
|
|
123
|
+
i,
|
|
124
|
+
o,
|
|
125
|
+
n
|
|
126
|
+
]);
|
|
127
|
+
B(l);
|
|
128
|
+
let d = null;
|
|
129
|
+
if (!l) d = c ?? null;
|
|
130
|
+
else if (l.display !== "visible") d = null;
|
|
131
|
+
else {
|
|
132
|
+
let e = ne(s ?? {}, l.content);
|
|
133
|
+
function t(e) {
|
|
134
|
+
if (!l.decoratorType) return e;
|
|
135
|
+
let t = U(r?.components, l.decoratorType), { props: n, events: i } = re(C(l.decorator[1]) || {});
|
|
136
|
+
return u(t, {
|
|
137
|
+
...n,
|
|
138
|
+
...K(i)
|
|
139
|
+
}, e);
|
|
140
|
+
}
|
|
141
|
+
function n() {
|
|
142
|
+
if (!l.componentType) return e.default ?? null;
|
|
143
|
+
let t = U(r?.components, l.componentType), { props: n, events: i } = re(C(l.component[1]) || {}), o = i.change, s = i.focus, c = i.blur;
|
|
144
|
+
i.change = (...e) => {
|
|
145
|
+
S(l) || l.onInput(...e), o?.(...e);
|
|
146
|
+
}, i.focus = (...e) => {
|
|
147
|
+
S(l) || l.onFocus(...e), s?.(...e);
|
|
148
|
+
}, i.blur = (...e) => {
|
|
149
|
+
S(l) || l.onBlur(...e), c?.(...e);
|
|
150
|
+
};
|
|
151
|
+
let d = {
|
|
152
|
+
...S(l) ? {} : {
|
|
153
|
+
disabled: l.pattern === "disabled" || l.pattern === "readPretty",
|
|
154
|
+
readOnly: l.pattern === "readOnly"
|
|
155
|
+
},
|
|
156
|
+
...n,
|
|
157
|
+
...S(l) ? {} : { value: l.value },
|
|
158
|
+
...K(i)
|
|
159
|
+
};
|
|
160
|
+
if (a(t)) {
|
|
161
|
+
let n = Object.keys(e).flatMap((t) => W(e[t]));
|
|
162
|
+
return u(t, d, ...n);
|
|
163
|
+
}
|
|
164
|
+
return u(t, {
|
|
165
|
+
...d,
|
|
166
|
+
slots: e
|
|
167
|
+
}, e.default);
|
|
168
|
+
}
|
|
169
|
+
d = t(n());
|
|
170
|
+
}
|
|
171
|
+
return /* @__PURE__ */ v(N.Provider, {
|
|
172
|
+
value: l,
|
|
173
|
+
children: d
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
q.displayName = "ReactiveField";
|
|
177
|
+
// src/components/RecursionField.tsx
|
|
178
|
+
function J(e) {
|
|
179
|
+
let t = Object.keys(e);
|
|
180
|
+
if (!t.length) return null;
|
|
181
|
+
let n = t.flatMap((t) => W(e[t]));
|
|
182
|
+
return u("div", { style: { display: "contents" } }, ...n);
|
|
183
|
+
}
|
|
184
|
+
function Y(t) {
|
|
185
|
+
let n = H(), r = f(I) ?? {}, a = f(F), c = h(() => e.isSchemaInstance(t.schema) ? t.schema : new e(t.schema), [t.schema]), l = h(() => c.toFieldProps({
|
|
186
|
+
...r,
|
|
187
|
+
get scope() {
|
|
188
|
+
return s(r.scope, a ?? {});
|
|
189
|
+
}
|
|
190
|
+
}), [
|
|
191
|
+
c,
|
|
192
|
+
r,
|
|
193
|
+
a
|
|
194
|
+
]);
|
|
195
|
+
function u() {
|
|
196
|
+
return t.onlyRenderProperties ? t.basePath ?? (o(t.name) ? (n?.address ?? "").concat(t.name) : n?.address) : t.basePath ?? n?.address;
|
|
197
|
+
}
|
|
198
|
+
let d = u();
|
|
199
|
+
function p() {
|
|
200
|
+
if (t.onlyRenderSelf) return {};
|
|
201
|
+
let n = e.getOrderProperties(c);
|
|
202
|
+
if (!n.length) return {};
|
|
203
|
+
let r = {}, a = t.mapProperties, o = t.filterProperties;
|
|
204
|
+
return n.forEach(({ schema: e, key: t }, n) => {
|
|
205
|
+
let s = e;
|
|
206
|
+
if (i(a)) {
|
|
207
|
+
let n = a(e, t);
|
|
208
|
+
n && (s = n);
|
|
209
|
+
}
|
|
210
|
+
if (i(o) && o(s, t) === !1) return;
|
|
211
|
+
let c = s.slot ?? "default", l = /* @__PURE__ */ v(Y, {
|
|
212
|
+
schema: s,
|
|
213
|
+
name: t,
|
|
214
|
+
basePath: d
|
|
215
|
+
}, `${n}-${String(t)}`);
|
|
216
|
+
(r[c] ??= []).push(l);
|
|
217
|
+
}), r;
|
|
218
|
+
}
|
|
219
|
+
let m = (e) => /* @__PURE__ */ v(P.Provider, {
|
|
220
|
+
value: c,
|
|
221
|
+
children: e
|
|
222
|
+
});
|
|
223
|
+
if (!o(t.name)) return m(J(p()));
|
|
224
|
+
let g = {
|
|
225
|
+
...l,
|
|
226
|
+
name: t.name,
|
|
227
|
+
basePath: d
|
|
228
|
+
};
|
|
229
|
+
return c.type === "object" ? t.onlyRenderProperties ? m(J(p())) : m(/* @__PURE__ */ v(q, {
|
|
230
|
+
fieldType: "ObjectField",
|
|
231
|
+
fieldProps: g,
|
|
232
|
+
slots: p()
|
|
233
|
+
})) : c.type === "array" ? m(/* @__PURE__ */ v(q, {
|
|
234
|
+
fieldType: "ArrayField",
|
|
235
|
+
fieldProps: g
|
|
236
|
+
})) : c.type === "void" ? t.onlyRenderProperties ? m(J(p())) : m(/* @__PURE__ */ v(q, {
|
|
237
|
+
fieldType: "VoidField",
|
|
238
|
+
fieldProps: g,
|
|
239
|
+
slots: p()
|
|
240
|
+
})) : m(/* @__PURE__ */ v(q, {
|
|
241
|
+
fieldType: "Field",
|
|
242
|
+
fieldProps: g
|
|
243
|
+
}));
|
|
244
|
+
}
|
|
245
|
+
Y.displayName = "RecursionField";
|
|
246
|
+
// src/components/SchemaField.tsx
|
|
247
|
+
function X(e, t) {
|
|
248
|
+
return e ? `${e}.${t}` : String(t);
|
|
249
|
+
}
|
|
250
|
+
function ie(e, t, n) {
|
|
251
|
+
let r = [], i = [], a = (e, t) => {
|
|
252
|
+
e.type === "array" && i.push(X(t, "*")), s(e, t);
|
|
253
|
+
}, s = (e, t) => {
|
|
254
|
+
let n = e.properties ?? {};
|
|
255
|
+
Object.keys(n).forEach((e) => {
|
|
256
|
+
let i = X(t, e);
|
|
257
|
+
r.push(i), a(n[e], i);
|
|
258
|
+
});
|
|
259
|
+
let i = e.items;
|
|
260
|
+
i && (Array.isArray(i) ? i : [i]).forEach((e) => {
|
|
261
|
+
e && s(e, X(t, "*"));
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
if (o(n)) {
|
|
265
|
+
let i = X(t, String(n));
|
|
266
|
+
r.push(i), a(e, i);
|
|
267
|
+
} else s(e, t);
|
|
268
|
+
return {
|
|
269
|
+
fields: r,
|
|
270
|
+
arrays: i
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function ae(t) {
|
|
274
|
+
return e.isSchemaInstance(t) ? t : new e({
|
|
275
|
+
type: "object",
|
|
276
|
+
...t
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
function oe(e, t, n, r, i) {
|
|
280
|
+
let a = ie(t, r, i), o = ie(n, r, i), s = new Set(o.fields);
|
|
281
|
+
a.fields.forEach((t) => {
|
|
282
|
+
s.has(t) || (e.deleteValuesIn(t), e.deleteInitialValuesIn(t));
|
|
283
|
+
}), (/* @__PURE__ */ new Set([
|
|
284
|
+
...a.fields,
|
|
285
|
+
...o.fields,
|
|
286
|
+
...a.arrays,
|
|
287
|
+
...o.arrays
|
|
288
|
+
])).forEach((t) => {
|
|
289
|
+
e.clearFormGraph(t, !1);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function Z(e) {
|
|
293
|
+
let t = R(), r = H(), i = h(() => ae(e.schema), [e.schema]), a = h(() => ({
|
|
294
|
+
components: {
|
|
295
|
+
...e.prebound?.components,
|
|
296
|
+
...e.components
|
|
297
|
+
},
|
|
298
|
+
scope: {
|
|
299
|
+
...e.prebound?.scope,
|
|
300
|
+
...e.scope
|
|
301
|
+
}
|
|
302
|
+
}), [
|
|
303
|
+
e.prebound,
|
|
304
|
+
e.components,
|
|
305
|
+
e.scope
|
|
306
|
+
]), [o, s] = _(0), c = g(i), l = e.basePath ? n.parse(e.basePath).toString() : r?.address?.toString() ?? "";
|
|
307
|
+
return m(() => {
|
|
308
|
+
if (!e.hotReload || !t || c.current === i) return;
|
|
309
|
+
let n = c.current;
|
|
310
|
+
c.current = i, oe(t, n, i, l, e.name), s((e) => e + 1);
|
|
311
|
+
}, [
|
|
312
|
+
e.hotReload,
|
|
313
|
+
t,
|
|
314
|
+
i,
|
|
315
|
+
l,
|
|
316
|
+
e.name
|
|
317
|
+
]), /* @__PURE__ */ v(I.Provider, {
|
|
318
|
+
value: a,
|
|
319
|
+
children: /* @__PURE__ */ v(F.Provider, {
|
|
320
|
+
value: a.scope,
|
|
321
|
+
children: /* @__PURE__ */ v(Y, {
|
|
322
|
+
schema: i,
|
|
323
|
+
name: e.name,
|
|
324
|
+
basePath: e.basePath,
|
|
325
|
+
onlyRenderProperties: e.onlyRenderProperties,
|
|
326
|
+
onlyRenderSelf: e.onlyRenderSelf,
|
|
327
|
+
mapProperties: e.mapProperties,
|
|
328
|
+
filterProperties: e.filterProperties
|
|
329
|
+
}, o)
|
|
330
|
+
})
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
Z.displayName = "SchemaField";
|
|
334
|
+
function se(e = {}) {
|
|
335
|
+
let n = e.voidComponents ?? {}, r = e.arrayComponents ?? {}, i = {
|
|
336
|
+
...e.components,
|
|
337
|
+
...n,
|
|
338
|
+
...r
|
|
339
|
+
}, a = t({
|
|
340
|
+
patches: e.patches,
|
|
341
|
+
voidComponentNames: Object.keys(n),
|
|
342
|
+
arrayComponentNames: Object.keys(r),
|
|
343
|
+
defaultDecorator: e.defaultDecorator
|
|
344
|
+
}), o = {
|
|
345
|
+
components: i,
|
|
346
|
+
scope: e.scope
|
|
347
|
+
}, s = (e) => /* @__PURE__ */ v(Z, {
|
|
348
|
+
...e,
|
|
349
|
+
prebound: o
|
|
350
|
+
});
|
|
351
|
+
return s.displayName = "SchemaField", {
|
|
352
|
+
SchemaField: s,
|
|
353
|
+
fragment: a
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
// src/hooks/useFieldSchema.ts
|
|
357
|
+
function ce() {
|
|
358
|
+
return f(P);
|
|
359
|
+
}
|
|
360
|
+
// src/hooks/useFormEffects.ts
|
|
361
|
+
function le(e) {
|
|
362
|
+
let t = R();
|
|
363
|
+
p(() => {
|
|
364
|
+
if (!t || !e) return;
|
|
365
|
+
let n = c();
|
|
366
|
+
return t.addEffects(n, e), () => {
|
|
367
|
+
t.removeEffects(n);
|
|
368
|
+
};
|
|
369
|
+
}, [t, e]);
|
|
370
|
+
}
|
|
371
|
+
// src/hooks/useParentForm.ts
|
|
372
|
+
function ue() {
|
|
373
|
+
let e = H(), t = R();
|
|
374
|
+
function n(e) {
|
|
375
|
+
return e ? x(e) ? e : n(e.parent) : t;
|
|
376
|
+
}
|
|
377
|
+
return n(e);
|
|
378
|
+
}
|
|
379
|
+
// ../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js
|
|
380
|
+
var de = /* @__PURE__ */ k(((e) => {
|
|
381
|
+
var t = typeof Symbol == "function" && Symbol.for, n = t ? Symbol.for("react.element") : 60103, r = t ? Symbol.for("react.portal") : 60106, i = t ? Symbol.for("react.fragment") : 60107, a = t ? Symbol.for("react.strict_mode") : 60108, o = t ? Symbol.for("react.profiler") : 60114, s = t ? Symbol.for("react.provider") : 60109, c = t ? Symbol.for("react.context") : 60110, l = t ? Symbol.for("react.async_mode") : 60111, u = t ? Symbol.for("react.concurrent_mode") : 60111, d = t ? Symbol.for("react.forward_ref") : 60112, f = t ? Symbol.for("react.suspense") : 60113, p = t ? Symbol.for("react.suspense_list") : 60120, m = t ? Symbol.for("react.memo") : 60115, h = t ? Symbol.for("react.lazy") : 60116, g = t ? Symbol.for("react.block") : 60121, _ = t ? Symbol.for("react.fundamental") : 60117, v = t ? Symbol.for("react.responder") : 60118, y = t ? Symbol.for("react.scope") : 60119;
|
|
382
|
+
function b(e) {
|
|
383
|
+
if (typeof e == "object" && e) {
|
|
384
|
+
var t = e.$$typeof;
|
|
385
|
+
switch (t) {
|
|
386
|
+
case n: switch (e = e.type, e) {
|
|
387
|
+
case l:
|
|
388
|
+
case u:
|
|
389
|
+
case i:
|
|
390
|
+
case o:
|
|
391
|
+
case a:
|
|
392
|
+
case f: return e;
|
|
393
|
+
default: switch (e &&= e.$$typeof, e) {
|
|
394
|
+
case c:
|
|
395
|
+
case d:
|
|
396
|
+
case h:
|
|
397
|
+
case m:
|
|
398
|
+
case s: return e;
|
|
399
|
+
default: return t;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
case r: return t;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
function x(e) {
|
|
407
|
+
return b(e) === u;
|
|
408
|
+
}
|
|
409
|
+
e.AsyncMode = l, e.ConcurrentMode = u, e.ContextConsumer = c, e.ContextProvider = s, e.Element = n, e.ForwardRef = d, e.Fragment = i, e.Lazy = h, e.Memo = m, e.Portal = r, e.Profiler = o, e.StrictMode = a, e.Suspense = f, e.isAsyncMode = function(e) {
|
|
410
|
+
return x(e) || b(e) === l;
|
|
411
|
+
}, e.isConcurrentMode = x, e.isContextConsumer = function(e) {
|
|
412
|
+
return b(e) === c;
|
|
413
|
+
}, e.isContextProvider = function(e) {
|
|
414
|
+
return b(e) === s;
|
|
415
|
+
}, e.isElement = function(e) {
|
|
416
|
+
return typeof e == "object" && !!e && e.$$typeof === n;
|
|
417
|
+
}, e.isForwardRef = function(e) {
|
|
418
|
+
return b(e) === d;
|
|
419
|
+
}, e.isFragment = function(e) {
|
|
420
|
+
return b(e) === i;
|
|
421
|
+
}, e.isLazy = function(e) {
|
|
422
|
+
return b(e) === h;
|
|
423
|
+
}, e.isMemo = function(e) {
|
|
424
|
+
return b(e) === m;
|
|
425
|
+
}, e.isPortal = function(e) {
|
|
426
|
+
return b(e) === r;
|
|
427
|
+
}, e.isProfiler = function(e) {
|
|
428
|
+
return b(e) === o;
|
|
429
|
+
}, e.isStrictMode = function(e) {
|
|
430
|
+
return b(e) === a;
|
|
431
|
+
}, e.isSuspense = function(e) {
|
|
432
|
+
return b(e) === f;
|
|
433
|
+
}, e.isValidElementType = function(e) {
|
|
434
|
+
return typeof e == "string" || typeof e == "function" || e === i || e === u || e === o || e === a || e === f || e === p || typeof e == "object" && !!e && (e.$$typeof === h || e.$$typeof === m || e.$$typeof === s || e.$$typeof === c || e.$$typeof === d || e.$$typeof === _ || e.$$typeof === v || e.$$typeof === y || e.$$typeof === g);
|
|
435
|
+
}, e.typeOf = b;
|
|
436
|
+
})), fe = /* @__PURE__ */ k(((e) => {
|
|
437
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
438
|
+
var t = typeof Symbol == "function" && Symbol.for, n = t ? Symbol.for("react.element") : 60103, r = t ? Symbol.for("react.portal") : 60106, i = t ? Symbol.for("react.fragment") : 60107, a = t ? Symbol.for("react.strict_mode") : 60108, o = t ? Symbol.for("react.profiler") : 60114, s = t ? Symbol.for("react.provider") : 60109, c = t ? Symbol.for("react.context") : 60110, l = t ? Symbol.for("react.async_mode") : 60111, u = t ? Symbol.for("react.concurrent_mode") : 60111, d = t ? Symbol.for("react.forward_ref") : 60112, f = t ? Symbol.for("react.suspense") : 60113, p = t ? Symbol.for("react.suspense_list") : 60120, m = t ? Symbol.for("react.memo") : 60115, h = t ? Symbol.for("react.lazy") : 60116, g = t ? Symbol.for("react.block") : 60121, _ = t ? Symbol.for("react.fundamental") : 60117, v = t ? Symbol.for("react.responder") : 60118, y = t ? Symbol.for("react.scope") : 60119;
|
|
439
|
+
function b(e) {
|
|
440
|
+
return typeof e == "string" || typeof e == "function" || e === i || e === u || e === o || e === a || e === f || e === p || typeof e == "object" && !!e && (e.$$typeof === h || e.$$typeof === m || e.$$typeof === s || e.$$typeof === c || e.$$typeof === d || e.$$typeof === _ || e.$$typeof === v || e.$$typeof === y || e.$$typeof === g);
|
|
441
|
+
}
|
|
442
|
+
function x(e) {
|
|
443
|
+
if (typeof e == "object" && e) {
|
|
444
|
+
var t = e.$$typeof;
|
|
445
|
+
switch (t) {
|
|
446
|
+
case n:
|
|
447
|
+
var p = e.type;
|
|
448
|
+
switch (p) {
|
|
449
|
+
case l:
|
|
450
|
+
case u:
|
|
451
|
+
case i:
|
|
452
|
+
case o:
|
|
453
|
+
case a:
|
|
454
|
+
case f: return p;
|
|
455
|
+
default:
|
|
456
|
+
var g = p && p.$$typeof;
|
|
457
|
+
switch (g) {
|
|
458
|
+
case c:
|
|
459
|
+
case d:
|
|
460
|
+
case h:
|
|
461
|
+
case m:
|
|
462
|
+
case s: return g;
|
|
463
|
+
default: return t;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
case r: return t;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
var S = l, C = u, w = c, T = s, E = n, ee = d, D = i, O = h, k = m, A = r, j = o, M = a, N = f, P = !1;
|
|
471
|
+
function F(e) {
|
|
472
|
+
return P || (P = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")), I(e) || x(e) === l;
|
|
473
|
+
}
|
|
474
|
+
function I(e) {
|
|
475
|
+
return x(e) === u;
|
|
476
|
+
}
|
|
477
|
+
function L(e) {
|
|
478
|
+
return x(e) === c;
|
|
479
|
+
}
|
|
480
|
+
function R(e) {
|
|
481
|
+
return x(e) === s;
|
|
482
|
+
}
|
|
483
|
+
function z(e) {
|
|
484
|
+
return typeof e == "object" && !!e && e.$$typeof === n;
|
|
485
|
+
}
|
|
486
|
+
function B(e) {
|
|
487
|
+
return x(e) === d;
|
|
488
|
+
}
|
|
489
|
+
function V(e) {
|
|
490
|
+
return x(e) === i;
|
|
491
|
+
}
|
|
492
|
+
function H(e) {
|
|
493
|
+
return x(e) === h;
|
|
494
|
+
}
|
|
495
|
+
function U(e) {
|
|
496
|
+
return x(e) === m;
|
|
497
|
+
}
|
|
498
|
+
function W(e) {
|
|
499
|
+
return x(e) === r;
|
|
500
|
+
}
|
|
501
|
+
function G(e) {
|
|
502
|
+
return x(e) === o;
|
|
503
|
+
}
|
|
504
|
+
function te(e) {
|
|
505
|
+
return x(e) === a;
|
|
506
|
+
}
|
|
507
|
+
function ne(e) {
|
|
508
|
+
return x(e) === f;
|
|
509
|
+
}
|
|
510
|
+
e.AsyncMode = S, e.ConcurrentMode = C, e.ContextConsumer = w, e.ContextProvider = T, e.Element = E, e.ForwardRef = ee, e.Fragment = D, e.Lazy = O, e.Memo = k, e.Portal = A, e.Profiler = j, e.StrictMode = M, e.Suspense = N, e.isAsyncMode = F, e.isConcurrentMode = I, e.isContextConsumer = L, e.isContextProvider = R, e.isElement = z, e.isForwardRef = B, e.isFragment = V, e.isLazy = H, e.isMemo = U, e.isPortal = W, e.isProfiler = G, e.isStrictMode = te, e.isSuspense = ne, e.isValidElementType = b, e.typeOf = x;
|
|
511
|
+
})();
|
|
512
|
+
})), pe = /* @__PURE__ */ k(((e, t) => {
|
|
513
|
+
t.exports = process.env.NODE_ENV === "production" ? de() : fe();
|
|
514
|
+
})), Q = /* @__PURE__ */ j((/* @__PURE__ */ k(((e, t) => {
|
|
515
|
+
var n = pe(), r = {
|
|
516
|
+
childContextTypes: !0,
|
|
517
|
+
contextType: !0,
|
|
518
|
+
contextTypes: !0,
|
|
519
|
+
defaultProps: !0,
|
|
520
|
+
displayName: !0,
|
|
521
|
+
getDefaultProps: !0,
|
|
522
|
+
getDerivedStateFromError: !0,
|
|
523
|
+
getDerivedStateFromProps: !0,
|
|
524
|
+
mixins: !0,
|
|
525
|
+
propTypes: !0,
|
|
526
|
+
type: !0
|
|
527
|
+
}, i = {
|
|
528
|
+
name: !0,
|
|
529
|
+
length: !0,
|
|
530
|
+
prototype: !0,
|
|
531
|
+
caller: !0,
|
|
532
|
+
callee: !0,
|
|
533
|
+
arguments: !0,
|
|
534
|
+
arity: !0
|
|
535
|
+
}, a = {
|
|
536
|
+
$$typeof: !0,
|
|
537
|
+
render: !0,
|
|
538
|
+
defaultProps: !0,
|
|
539
|
+
displayName: !0,
|
|
540
|
+
propTypes: !0
|
|
541
|
+
}, o = {
|
|
542
|
+
$$typeof: !0,
|
|
543
|
+
compare: !0,
|
|
544
|
+
defaultProps: !0,
|
|
545
|
+
displayName: !0,
|
|
546
|
+
propTypes: !0,
|
|
547
|
+
type: !0
|
|
548
|
+
}, s = {};
|
|
549
|
+
s[n.ForwardRef] = a, s[n.Memo] = o;
|
|
550
|
+
function c(e) {
|
|
551
|
+
return n.isMemo(e) ? o : s[e.$$typeof] || r;
|
|
552
|
+
}
|
|
553
|
+
var l = Object.defineProperty, u = Object.getOwnPropertyNames, d = Object.getOwnPropertySymbols, f = Object.getOwnPropertyDescriptor, p = Object.getPrototypeOf, m = Object.prototype;
|
|
554
|
+
function h(e, t, n) {
|
|
555
|
+
if (typeof t != "string") {
|
|
556
|
+
if (m) {
|
|
557
|
+
var r = p(t);
|
|
558
|
+
r && r !== m && h(e, r, n);
|
|
559
|
+
}
|
|
560
|
+
var a = u(t);
|
|
561
|
+
d && (a = a.concat(d(t)));
|
|
562
|
+
for (var o = c(e), s = c(t), g = 0; g < a.length; ++g) {
|
|
563
|
+
var _ = a[g];
|
|
564
|
+
if (!i[_] && !(n && n[_]) && !(s && s[_]) && !(o && o[_])) {
|
|
565
|
+
var v = f(t, _);
|
|
566
|
+
try {
|
|
567
|
+
l(e, _, v);
|
|
568
|
+
} catch {}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return e;
|
|
573
|
+
}
|
|
574
|
+
t.exports = h;
|
|
575
|
+
})))(), 1);
|
|
576
|
+
function $(e) {
|
|
577
|
+
return e.displayName ?? e.name;
|
|
578
|
+
}
|
|
579
|
+
function me(...e) {
|
|
580
|
+
function t(t, s) {
|
|
581
|
+
return e.reduce((e, t) => (i(t) ? e = Object.assign(e, t(e, s)) : r(t, (t, r) => {
|
|
582
|
+
let i = n.getIn(s, r), c = a(t) ? t : r, l = n.getIn(e, c);
|
|
583
|
+
r === "value" && t !== r && delete e.value, (!o(l) || o(i)) && n.setIn(e, c, i);
|
|
584
|
+
}), e), t);
|
|
585
|
+
}
|
|
586
|
+
return function(e) {
|
|
587
|
+
let n = y((n) => {
|
|
588
|
+
let r = H(), i = r ? t({ ...n }, r) : { ...n };
|
|
589
|
+
return u(e, i);
|
|
590
|
+
}), r = $(e);
|
|
591
|
+
return n.displayName = r ? `Connected${r}` : "ConnectedComponent", (0, Q.default)(n, e), n;
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
function he(e, t) {
|
|
595
|
+
return function(n) {
|
|
596
|
+
let r = y((r) => {
|
|
597
|
+
let i = H(), a = i && !S(i) && i.pattern === "readPretty" ? e : n;
|
|
598
|
+
return u(a, {
|
|
599
|
+
...t,
|
|
600
|
+
...r
|
|
601
|
+
});
|
|
602
|
+
}), i = $(n);
|
|
603
|
+
return r.displayName = i ? `Read${i}` : "ReadComponent", (0, Q.default)(r, n), r;
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
function ge(e, ...t) {
|
|
607
|
+
let n = t.reduce((e, t) => t(e), e), r = (e) => u(n, e);
|
|
608
|
+
return r.displayName = $(e), (0, Q.default)(r, e), r;
|
|
609
|
+
}
|
|
610
|
+
// src/shared/createForm.ts
|
|
611
|
+
function _e(e) {
|
|
612
|
+
return b(e);
|
|
613
|
+
}
|
|
614
|
+
export { L as ExpressionScope, z as FormConsumer, V as FormProvider, q as ReactiveField, Y as RecursionField, Z as SchemaField, ge as connect, _e as createForm, se as createSchemaField, me as mapProps, he as mapReadPretty, B as useAttach, H as useField, ce as useFieldSchema, R as useForm, le as useFormEffects, ue as useParentForm };
|
|
615
|
+
|
|
616
|
+
//# sourceMappingURL=index.js.map
|