@effect-app/vue-components 2.7.1 → 2.7.3
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/types/components/OmegaForm/OmegaTaggedUnion.vue.d.ts +6 -6
- package/dist/types/components/OmegaForm/OmegaTaggedUnionInternal.vue.d.ts +2 -0
- package/dist/vue-components.es10.js +193 -194
- package/dist/vue-components.es17.js +1 -1
- package/dist/vue-components.es18.js +1 -1
- package/dist/vue-components.es21.js +2 -2
- package/dist/vue-components.es22.js +2 -2
- package/dist/vue-components.es30.js +191 -41
- package/dist/vue-components.es32.js +42 -2
- package/dist/vue-components.es33.js +2 -89
- package/dist/vue-components.es34.js +4 -0
- package/dist/vue-components.es35.js +89 -7
- package/dist/vue-components.es37.js +9 -0
- package/dist/vue-components.es38.js +27 -187
- package/dist/vue-components.es40.js +1 -1
- package/dist/vue-components.es7.js +1 -1
- package/dist/vue-components.es8.js +8 -7
- package/dist/vue-components.es9.js +10 -9
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +2 -1
- package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +5 -0
- package/src/components/OmegaForm/useOmegaForm.ts +41 -42
- package/dist/vue-components.es31.js +0 -4
- package/dist/vue-components.es36.js +0 -34
|
@@ -13,17 +13,17 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends R
|
|
|
13
13
|
attrs: any;
|
|
14
14
|
slots: {
|
|
15
15
|
[x: string]: ((props: {
|
|
16
|
-
field: import("./InputProps").OmegaFieldInternalApi<From,
|
|
17
|
-
state: NonNullable<import("@tanstack/vue-form").DeepValue<From,
|
|
16
|
+
field: import("./InputProps").OmegaFieldInternalApi<From, `${NonNullable<Name>}._tag` | "_tag">;
|
|
17
|
+
state: NonNullable<import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">>;
|
|
18
18
|
}) => any) | undefined;
|
|
19
19
|
[x: number]: ((props: {
|
|
20
|
-
field: import("./InputProps").OmegaFieldInternalApi<From,
|
|
21
|
-
state: NonNullable<import("@tanstack/vue-form").DeepValue<From,
|
|
20
|
+
field: import("./InputProps").OmegaFieldInternalApi<From, `${NonNullable<Name>}._tag` | "_tag">;
|
|
21
|
+
state: NonNullable<import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">>;
|
|
22
22
|
}) => any) | undefined;
|
|
23
23
|
} & {
|
|
24
24
|
OmegaCustomInput?: (props: {
|
|
25
|
-
field: import("@tanstack/vue-form").FieldApi<From,
|
|
26
|
-
state: import("@tanstack/vue-form").FieldState<From,
|
|
25
|
+
field: import("@tanstack/vue-form").FieldApi<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, Record<string, any> | undefined>;
|
|
26
|
+
state: import("@tanstack/vue-form").FieldState<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, `${NonNullable<Name>}._tag` | "_tag", import("@tanstack/vue-form").DeepValue<From, `${NonNullable<Name>}._tag` | "_tag">> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
|
|
27
27
|
}) => any;
|
|
28
28
|
} & {
|
|
29
29
|
default?: (props: {}) => any;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type DeepKeys, type DeepValue } from "@tanstack/vue-form";
|
|
2
2
|
import { type OmegaFieldInternalApi } from "./InputProps";
|
|
3
|
+
import { type useOmegaForm } from "./useOmegaForm";
|
|
3
4
|
declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
5
|
props: __VLS_PrettifyLocal<{
|
|
5
6
|
state: DeepValue<From, Name>;
|
|
6
7
|
field: OmegaFieldInternalApi<From, Name>;
|
|
7
8
|
name?: DeepKeys<From>;
|
|
9
|
+
form: ReturnType<typeof useOmegaForm<From, To>>;
|
|
8
10
|
}> & import("vue").PublicProps;
|
|
9
11
|
expose: (exposed: {}) => void;
|
|
10
12
|
attrs: any;
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
import { useForm as
|
|
2
|
-
import { Data as
|
|
3
|
-
import { runtimeFiberAsPromise as
|
|
4
|
-
import { isObject as
|
|
5
|
-
import { computed as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { generateMetaFromSchema as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { trace as
|
|
14
|
-
import { context as
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
const o =
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
}),
|
|
22
|
-
...
|
|
1
|
+
import { useForm as Y } from "@tanstack/vue-form";
|
|
2
|
+
import { Data as C, S as v, Effect as S, Fiber as j, Option as V, Array as A } from "effect-app";
|
|
3
|
+
import { runtimeFiberAsPromise as ee } from "./vue-components.es17.js";
|
|
4
|
+
import { isObject as te } from "./vue-components.es18.js";
|
|
5
|
+
import { computed as I, onUnmounted as J, onMounted as re, onBeforeUnmount as ne, watch as K, ref as se, h as Z } from "vue";
|
|
6
|
+
import oe from "./vue-components.es19.js";
|
|
7
|
+
import ie from "./vue-components.es20.js";
|
|
8
|
+
import ae from "./vue-components.es21.js";
|
|
9
|
+
import { generateMetaFromSchema as le } from "./vue-components.es12.js";
|
|
10
|
+
import ce from "./vue-components.es6.js";
|
|
11
|
+
import ue from "./vue-components.es8.js";
|
|
12
|
+
import fe from "./vue-components.es22.js";
|
|
13
|
+
import { trace as z } from "./vue-components.es23.js";
|
|
14
|
+
import { context as T } from "./vue-components.es24.js";
|
|
15
|
+
const k = (f) => {
|
|
16
|
+
const c = f.ast;
|
|
17
|
+
if (c._tag === "Union") {
|
|
18
|
+
const o = c.types.map((d) => {
|
|
19
|
+
const u = v.make(d);
|
|
20
|
+
return k(u).ast;
|
|
21
|
+
}), p = {
|
|
22
|
+
...c,
|
|
23
23
|
types: o
|
|
24
24
|
};
|
|
25
|
-
return v.make(
|
|
25
|
+
return v.make(p);
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
28
|
-
const o = v.make(
|
|
29
|
-
...
|
|
30
|
-
from:
|
|
31
|
-
to:
|
|
27
|
+
if (c._tag === "Transformation") {
|
|
28
|
+
const o = v.make(c.from), p = v.make(c.to), d = k(o), u = k(p), m = {
|
|
29
|
+
...c,
|
|
30
|
+
from: d.ast,
|
|
31
|
+
to: u.ast
|
|
32
32
|
};
|
|
33
|
-
return v.make(
|
|
33
|
+
return v.make(m);
|
|
34
34
|
}
|
|
35
|
-
if (
|
|
36
|
-
const o =
|
|
37
|
-
const
|
|
38
|
-
let
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
41
|
-
|
|
35
|
+
if (c._tag === "TypeLiteral") {
|
|
36
|
+
const o = c.propertySignatures.map((d) => {
|
|
37
|
+
const u = d.type;
|
|
38
|
+
let m = u;
|
|
39
|
+
if (u._tag === "TypeLiteral" || u._tag === "Union" || u._tag === "Transformation") {
|
|
40
|
+
const E = v.make(u);
|
|
41
|
+
m = k(E).ast;
|
|
42
42
|
}
|
|
43
43
|
return {
|
|
44
|
-
...
|
|
45
|
-
type:
|
|
44
|
+
...d,
|
|
45
|
+
type: m,
|
|
46
46
|
isOptional: !0
|
|
47
47
|
};
|
|
48
|
-
}),
|
|
49
|
-
...
|
|
48
|
+
}), p = {
|
|
49
|
+
...c,
|
|
50
50
|
propertySignatures: o
|
|
51
51
|
};
|
|
52
|
-
return v.make(
|
|
52
|
+
return v.make(p);
|
|
53
53
|
}
|
|
54
|
-
return
|
|
54
|
+
return f;
|
|
55
55
|
};
|
|
56
|
-
class
|
|
56
|
+
class de extends C.TaggedError("FormErrors") {
|
|
57
57
|
}
|
|
58
|
-
const D = (
|
|
58
|
+
const D = (f) => function(o) {
|
|
59
59
|
return {
|
|
60
60
|
render() {
|
|
61
|
-
return
|
|
62
|
-
form:
|
|
61
|
+
return Z(o, {
|
|
62
|
+
form: f,
|
|
63
63
|
...this.$attrs
|
|
64
64
|
}, this.$slots);
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
},
|
|
67
|
+
}, me = (f) => function(o) {
|
|
68
68
|
return {
|
|
69
69
|
setup() {
|
|
70
|
-
const { fieldMap:
|
|
71
|
-
const y =
|
|
72
|
-
Object.entries(
|
|
73
|
-
([
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
76
|
-
const i =
|
|
77
|
-
return i ?
|
|
70
|
+
const { fieldMap: p, form: d } = f, u = d.useStore((y) => y.errors), m = d.useStore((y) => y.fieldMeta), E = d.useStore((y) => y.errorMap), b = I(() => {
|
|
71
|
+
const y = A.filterMap(
|
|
72
|
+
Object.entries(m.value),
|
|
73
|
+
([U, h]) => {
|
|
74
|
+
const _ = h.errors ?? [];
|
|
75
|
+
if (!_.length) return V.none();
|
|
76
|
+
const i = p.value.get(U);
|
|
77
|
+
return i ? V.some({
|
|
78
78
|
label: i.label,
|
|
79
79
|
inputId: i.id,
|
|
80
80
|
// Only show the first error
|
|
81
|
-
errors: [
|
|
82
|
-
}) :
|
|
81
|
+
errors: [_[0]?.message].filter(Boolean)
|
|
82
|
+
}) : V.none();
|
|
83
83
|
}
|
|
84
|
-
),
|
|
85
|
-
if (
|
|
86
|
-
for (const [
|
|
87
|
-
if (
|
|
88
|
-
for (const
|
|
89
|
-
const i =
|
|
90
|
-
if (i?.path &&
|
|
84
|
+
), F = [];
|
|
85
|
+
if (E.value.onSubmit) {
|
|
86
|
+
for (const [U, h] of Object.entries(E.value.onSubmit))
|
|
87
|
+
if (A.isArray(h) && h.length)
|
|
88
|
+
for (const _ of h) {
|
|
89
|
+
const i = _;
|
|
90
|
+
if (i?.path && A.isArray(i.path) && i.path.length) {
|
|
91
91
|
const M = i.path.join(".");
|
|
92
|
-
if (!
|
|
93
|
-
|
|
92
|
+
if (!p.value.has(M)) {
|
|
93
|
+
F.push({
|
|
94
94
|
label: M,
|
|
95
95
|
inputId: M,
|
|
96
96
|
errors: [i.message].filter(Boolean)
|
|
@@ -100,162 +100,161 @@ const D = (c) => function(o) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
return [...y, ...
|
|
103
|
+
return [...y, ...F];
|
|
104
104
|
});
|
|
105
105
|
return {
|
|
106
|
-
generalErrors:
|
|
107
|
-
errors:
|
|
106
|
+
generalErrors: u,
|
|
107
|
+
errors: b
|
|
108
108
|
};
|
|
109
109
|
},
|
|
110
|
-
render({ errors:
|
|
111
|
-
return
|
|
112
|
-
errors:
|
|
113
|
-
generalErrors:
|
|
110
|
+
render({ errors: p, generalErrors: d }) {
|
|
111
|
+
return Z(o, {
|
|
112
|
+
errors: p,
|
|
113
|
+
generalErrors: d,
|
|
114
114
|
...this.$attrs
|
|
115
115
|
}, this.$slots);
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
|
-
},
|
|
119
|
-
if (!
|
|
120
|
-
const
|
|
118
|
+
}, De = (f, c, o) => {
|
|
119
|
+
if (!f) throw new Error("Schema is required");
|
|
120
|
+
const p = v.standardSchemaV1(f), d = v.decode(f), { meta: u } = le(f), m = I(() => {
|
|
121
121
|
if (o?.persistency?.id)
|
|
122
122
|
return o.persistency.id;
|
|
123
|
-
const e = window.location.pathname, t = Object.keys(
|
|
123
|
+
const e = window.location.pathname, t = Object.keys(u);
|
|
124
124
|
return `${e}-${t.join("-")}`;
|
|
125
|
-
}),
|
|
125
|
+
}), E = () => {
|
|
126
126
|
const e = new URLSearchParams(window.location.search);
|
|
127
|
-
e.delete(
|
|
127
|
+
e.delete(m.value);
|
|
128
128
|
const t = new URL(window.location.href);
|
|
129
129
|
t.search = e.toString(), window.history.replaceState({}, "", t.toString());
|
|
130
130
|
};
|
|
131
|
-
function
|
|
132
|
-
for (const
|
|
133
|
-
t[
|
|
131
|
+
function b(e, t) {
|
|
132
|
+
for (const r in t)
|
|
133
|
+
t[r] && te(t[r]) ? (e[r] || (e[r] = {}), b(e[r], t[r])) : e[r] = t[r];
|
|
134
134
|
return e;
|
|
135
135
|
}
|
|
136
136
|
const y = (e) => {
|
|
137
137
|
if (!e) return;
|
|
138
|
-
const t = { ...e }
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
const t = { ...e }, r = (s, a) => a.split(".").reduce((l, g) => l?.[g], s), n = (s, a, l) => {
|
|
139
|
+
const g = a.split("."), N = g.pop(), X = g.reduce((L, O) => (L[O] || (L[O] = {}), L[O]), s);
|
|
140
|
+
X[N] = l;
|
|
141
|
+
};
|
|
142
|
+
for (const s in u) {
|
|
143
|
+
const a = u[s], l = r(t, s), N = (l == null || l === !1 || l === "" || Number.isNaN(l)) && l !== !1 && l !== 0;
|
|
144
|
+
a && !a.required && a.nullableOrUndefined && a.type !== "boolean" && (l === void 0 || N) && n(t, s, a.nullableOrUndefined === "undefined" ? void 0 : null);
|
|
142
145
|
}
|
|
143
146
|
return t;
|
|
144
|
-
},
|
|
147
|
+
}, F = (e) => {
|
|
145
148
|
const t = {};
|
|
146
149
|
if (typeof e?.make == "function")
|
|
147
150
|
try {
|
|
148
151
|
return e.make({});
|
|
149
152
|
} catch {
|
|
150
153
|
}
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
for (const
|
|
154
|
-
const
|
|
155
|
-
if (Object.keys(
|
|
156
|
-
([
|
|
154
|
+
const r = e?.members || (e?.ast?._tag === "Union" && e.ast.types ? e.ast.types.map((n) => v.make(n)) : null);
|
|
155
|
+
if (r && A.isArray(r)) {
|
|
156
|
+
for (const n of r) {
|
|
157
|
+
const s = F(n);
|
|
158
|
+
if (Object.keys(s).length > 0 && n?.fields && Object.entries(n.fields).some(
|
|
159
|
+
([l, g]) => l === "_tag" || l === "type" || l === "kind" ? g?.ast?.defaultValue !== void 0 : !1
|
|
157
160
|
))
|
|
158
|
-
return
|
|
161
|
+
return s;
|
|
159
162
|
}
|
|
160
163
|
return {};
|
|
161
164
|
}
|
|
162
165
|
if (e?.fields && typeof e.fields == "object")
|
|
163
|
-
for (const [
|
|
164
|
-
if (
|
|
166
|
+
for (const [n, s] of Object.entries(e.fields)) {
|
|
167
|
+
if (s?.ast?.defaultValue)
|
|
165
168
|
try {
|
|
166
|
-
const
|
|
167
|
-
|
|
169
|
+
const l = s.ast.defaultValue();
|
|
170
|
+
l !== void 0 && (t[n] = l);
|
|
168
171
|
} catch {
|
|
169
172
|
}
|
|
170
|
-
const
|
|
171
|
-
Object.keys(
|
|
173
|
+
const a = F(s);
|
|
174
|
+
Object.keys(a).length > 0 && (t[n] && typeof t[n] == "object" ? Object.assign(t[n], a) : t[n] || (t[n] = a));
|
|
172
175
|
}
|
|
173
176
|
return t;
|
|
174
|
-
},
|
|
177
|
+
}, U = (e = {}) => {
|
|
175
178
|
let t = {};
|
|
176
179
|
try {
|
|
177
|
-
const
|
|
178
|
-
t = v.encodeSync(
|
|
179
|
-
} catch (
|
|
180
|
-
window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:",
|
|
180
|
+
const r = f.make(e);
|
|
181
|
+
t = v.encodeSync(k(f))(r);
|
|
182
|
+
} catch (r) {
|
|
183
|
+
window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:", r);
|
|
181
184
|
try {
|
|
182
|
-
const
|
|
183
|
-
t = v.encodeSync(
|
|
184
|
-
} catch (
|
|
185
|
-
window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:",
|
|
185
|
+
const n = F(f);
|
|
186
|
+
t = v.encodeSync(k(f))(n);
|
|
187
|
+
} catch (n) {
|
|
188
|
+
window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", n);
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
|
-
return
|
|
189
|
-
}, h =
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
a?.defaultValues
|
|
193
|
-
)
|
|
194
|
-
);
|
|
195
|
-
if (e && !o?.persistency?.overrideDefaultValues)
|
|
196
|
-
return e;
|
|
197
|
-
let t;
|
|
198
|
-
const n = o?.persistency;
|
|
199
|
-
if (!n?.policies || n.policies.length === 0) return {};
|
|
200
|
-
if (n.policies.includes("querystring"))
|
|
201
|
-
try {
|
|
202
|
-
const r = new URLSearchParams(window.location.search).get(f.value);
|
|
203
|
-
w(), r && (t = JSON.parse(r));
|
|
204
|
-
} catch (s) {
|
|
205
|
-
console.error(s);
|
|
206
|
-
}
|
|
191
|
+
return b(t, e);
|
|
192
|
+
}, h = I(() => {
|
|
193
|
+
let e;
|
|
194
|
+
const t = o?.persistency;
|
|
207
195
|
if (
|
|
208
196
|
// query string has higher priority than local/session storage
|
|
209
|
-
|
|
197
|
+
t?.policies && !e && (t.policies.includes("local") || t.policies.includes("session"))
|
|
210
198
|
) {
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
199
|
+
const r = t.policies.includes("local") ? localStorage : sessionStorage;
|
|
200
|
+
if (r)
|
|
213
201
|
try {
|
|
214
|
-
const
|
|
215
|
-
|
|
202
|
+
const n = JSON.parse(
|
|
203
|
+
r.getItem(m.value) || "{}"
|
|
216
204
|
);
|
|
217
|
-
|
|
218
|
-
} catch (
|
|
219
|
-
console.error(
|
|
205
|
+
r.removeItem(m.value), e = n;
|
|
206
|
+
} catch (n) {
|
|
207
|
+
console.error(n);
|
|
220
208
|
}
|
|
221
209
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
210
|
+
if (t?.policies && t.policies.includes("querystring"))
|
|
211
|
+
try {
|
|
212
|
+
const n = new URLSearchParams(window.location.search).get(m.value);
|
|
213
|
+
E(), n && (e = b(e || {}, JSON.parse(n)));
|
|
214
|
+
} catch (r) {
|
|
215
|
+
console.error(r);
|
|
216
|
+
}
|
|
217
|
+
return e ??= {}, U(
|
|
218
|
+
y(
|
|
219
|
+
o?.persistency?.overrideDefaultValues ? b(c?.defaultValues || {}, e) : b(e, c?.defaultValues || {})
|
|
220
|
+
)
|
|
221
|
+
);
|
|
222
|
+
}), _ = (e, t) => e ? T.with(z.setSpan(T.active(), e), t) : t(), i = Y({
|
|
223
|
+
...c,
|
|
225
224
|
validators: {
|
|
226
|
-
onSubmit:
|
|
227
|
-
...
|
|
225
|
+
onSubmit: p,
|
|
226
|
+
...c?.validators || {}
|
|
228
227
|
},
|
|
229
|
-
onSubmit:
|
|
230
|
-
const
|
|
228
|
+
onSubmit: c?.onSubmit ? ({ formApi: e, meta: t, value: r }) => _(t?.currentSpan, async () => {
|
|
229
|
+
const n = await S.runPromise(d(r)), s = c.onSubmit({
|
|
231
230
|
formApi: e,
|
|
232
231
|
meta: t,
|
|
233
|
-
value:
|
|
232
|
+
value: n
|
|
234
233
|
});
|
|
235
|
-
return
|
|
236
|
-
|
|
234
|
+
return j.isFiber(s) && j.isRuntimeFiber(s) ? await ee(s) : S.isEffect(s) ? await S.runPromise(
|
|
235
|
+
s.pipe(
|
|
237
236
|
// meta?.currentSpan
|
|
238
237
|
// ? Effect.withParentSpan(meta.currentSpan)
|
|
239
238
|
// : (_) => _,
|
|
240
|
-
S.flatMap((
|
|
239
|
+
S.flatMap((a) => j.join(a))
|
|
241
240
|
)
|
|
242
|
-
) :
|
|
241
|
+
) : s;
|
|
243
242
|
}) : void 0,
|
|
244
243
|
defaultValues: h.value
|
|
245
244
|
}), M = () => {
|
|
246
|
-
Object.keys(
|
|
245
|
+
Object.keys(u).forEach((e) => {
|
|
247
246
|
i.setFieldValue(e, void 0);
|
|
248
247
|
});
|
|
249
|
-
},
|
|
250
|
-
const
|
|
251
|
-
return
|
|
252
|
-
}, {}),
|
|
248
|
+
}, $ = (e) => e.reduce((t, r) => {
|
|
249
|
+
const n = r.split(".");
|
|
250
|
+
return n.reduce((s, a, l) => (l === n.length - 1 ? s[a] = i.getFieldValue(r) : s[a] = s[a] ?? {}, s[a]), t), t;
|
|
251
|
+
}, {}), R = (e) => {
|
|
253
252
|
if (e) {
|
|
254
|
-
if (
|
|
255
|
-
return
|
|
256
|
-
if (
|
|
257
|
-
const t = Object.keys(
|
|
258
|
-
return
|
|
253
|
+
if (A.isArray(e.keys))
|
|
254
|
+
return $(e.keys);
|
|
255
|
+
if (A.isArray(e.banKeys)) {
|
|
256
|
+
const t = Object.keys(u).filter((r) => e.banKeys?.includes(r));
|
|
257
|
+
return $(t);
|
|
259
258
|
}
|
|
260
259
|
return i.store.state.values;
|
|
261
260
|
}
|
|
@@ -264,69 +263,69 @@ const D = (c) => function(o) {
|
|
|
264
263
|
if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
|
|
265
264
|
const t = e.policies.includes("local") ? localStorage : sessionStorage;
|
|
266
265
|
if (!t) return;
|
|
267
|
-
const
|
|
268
|
-
return t.setItem(
|
|
266
|
+
const r = R(e);
|
|
267
|
+
return t.setItem(m.value, JSON.stringify(r));
|
|
269
268
|
}
|
|
270
|
-
},
|
|
269
|
+
}, W = () => {
|
|
271
270
|
const e = o?.persistency;
|
|
272
271
|
if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
|
|
273
|
-
const t =
|
|
274
|
-
|
|
275
|
-
const
|
|
276
|
-
|
|
272
|
+
const t = R(e), r = new URLSearchParams(window.location.search);
|
|
273
|
+
r.set(m.value, JSON.stringify(t));
|
|
274
|
+
const n = new URL(window.location.href);
|
|
275
|
+
n.search = r.toString(), window.history.replaceState({}, "", n.toString());
|
|
277
276
|
}
|
|
278
|
-
},
|
|
277
|
+
}, B = (e) => {
|
|
279
278
|
i.store.state.isDirty && e.preventDefault();
|
|
280
279
|
};
|
|
281
|
-
if (
|
|
282
|
-
window.addEventListener("beforeunload", x), window.addEventListener("blur",
|
|
283
|
-
}),
|
|
284
|
-
window.removeEventListener("beforeunload", x), window.removeEventListener("blur",
|
|
280
|
+
if (J(x), re(() => {
|
|
281
|
+
window.addEventListener("beforeunload", x), window.addEventListener("blur", W), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.addEventListener("beforeunload", B);
|
|
282
|
+
}), ne(() => {
|
|
283
|
+
window.removeEventListener("beforeunload", x), window.removeEventListener("blur", W), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", B);
|
|
285
284
|
}), o?.preventWindowExit === "prevent-and-reset") {
|
|
286
|
-
const e = i.useStore((
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
const e = i.useStore((s) => s.isSubmitting), t = i.useStore((s) => s.submissionAttempts), r = i.useStore((s) => s.canSubmit), n = i.useStore((s) => s.values);
|
|
286
|
+
K([e, t], ([s, a], [l]) => {
|
|
287
|
+
l && !s && a > 0 && r.value && i.reset(n.value);
|
|
289
288
|
});
|
|
290
289
|
}
|
|
291
|
-
const
|
|
290
|
+
const q = (e) => S.currentSpan.pipe(
|
|
292
291
|
S.option,
|
|
293
292
|
S.flatMap(
|
|
294
|
-
(t) => S.promise(() => i.handleSubmit(
|
|
293
|
+
(t) => S.promise(() => i.handleSubmit(V.isSome(t) ? { currentSpan: t.value, ...e } : e))
|
|
295
294
|
)
|
|
296
|
-
),
|
|
295
|
+
), G = (e) => e?.checkErrors ? q(e?.meta).pipe(S.flatMap(S.fnUntraced(function* () {
|
|
297
296
|
const t = i.getAllErrors();
|
|
298
297
|
if (Object.keys(t.fields).length || t.form.errors.length)
|
|
299
|
-
return yield* new
|
|
300
|
-
}))) :
|
|
298
|
+
return yield* new de({ form: t.form, fields: t.fields });
|
|
299
|
+
}))) : q(e?.meta), Q = i.handleSubmit, P = se(/* @__PURE__ */ new Map()), w = Object.assign(i, {
|
|
301
300
|
i18nNamespace: o?.i18nNamespace,
|
|
302
301
|
ignorePreventCloseEvents: o?.ignorePreventCloseEvents,
|
|
303
|
-
meta:
|
|
302
|
+
meta: u,
|
|
304
303
|
clear: M,
|
|
305
304
|
handleSubmit: (e) => {
|
|
306
|
-
const t =
|
|
307
|
-
return
|
|
305
|
+
const t = z.getSpan(T.active());
|
|
306
|
+
return Q({ currentSpan: t, ...e });
|
|
308
307
|
},
|
|
309
308
|
// /** @experimental */
|
|
310
|
-
handleSubmitEffect:
|
|
309
|
+
handleSubmitEffect: G,
|
|
311
310
|
registerField: (e) => {
|
|
312
|
-
|
|
311
|
+
K(e, (t) => P.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), J(() => P.value.delete(e.value.name));
|
|
313
312
|
}
|
|
314
|
-
}),
|
|
315
|
-
return Object.assign(
|
|
313
|
+
}), H = { form: w, fieldMap: P };
|
|
314
|
+
return Object.assign(w, {
|
|
316
315
|
// Type-level properties for performance optimization (not used at runtime)
|
|
317
316
|
_paths: void 0,
|
|
318
317
|
_keys: void 0,
|
|
319
|
-
errorContext:
|
|
320
|
-
Form: D(
|
|
321
|
-
Input: D(
|
|
322
|
-
TaggedUnion: D(
|
|
318
|
+
errorContext: H,
|
|
319
|
+
Form: D(w)(fe),
|
|
320
|
+
Input: D(w)(o?.input ?? ce),
|
|
321
|
+
TaggedUnion: D(w)(ue),
|
|
323
322
|
Field: i.Field,
|
|
324
|
-
Errors:
|
|
325
|
-
Array: D(
|
|
326
|
-
AutoGen: D(
|
|
323
|
+
Errors: me(H)(ae),
|
|
324
|
+
Array: D(w)(oe),
|
|
325
|
+
AutoGen: D(w)(ie)
|
|
327
326
|
});
|
|
328
327
|
};
|
|
329
328
|
export {
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
de as FormErrors,
|
|
330
|
+
De as useOmegaForm
|
|
332
331
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Exit as c, Runtime as u } from "effect";
|
|
2
|
-
import { dual as n, isFunction as m } from "./vue-components.
|
|
2
|
+
import { dual as n, isFunction as m } from "./vue-components.es32.js";
|
|
3
3
|
const i = Symbol.for("clone-trait"), a = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
|
|
4
4
|
n(2, (e, t) => a(e, { ...e, ...m(t) ? t(e) : t }));
|
|
5
5
|
const p = (e, t) => new Promise((o, s) => e.addObserver((r) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");if(a.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),document.head.appendChild(a),window.customElements){const e=window.customElements.define;window.customElements.define=function(r,t){const i=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(i&&i.call(this),this.shadowRoot){const d=document.createElement("style");d.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),this.shadowRoot.appendChild(d)}},e.call(window.customElements,r,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import r from "./vue-components.
|
|
2
|
+
import r from "./vue-components.es35.js";
|
|
3
3
|
|
|
4
|
-
import o from "./vue-components.
|
|
4
|
+
import o from "./vue-components.es37.js";
|
|
5
5
|
const e = /* @__PURE__ */ o(r, [["__scopeId", "data-v-d4ffe76f"]]);
|
|
6
6
|
export {
|
|
7
7
|
e as default
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
import o from "./vue-components.
|
|
2
|
+
import o from "./vue-components.es38.js";
|
|
3
3
|
|
|
4
|
-
import m from "./vue-components.
|
|
4
|
+
import m from "./vue-components.es37.js";
|
|
5
5
|
const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
|
|
6
6
|
export {
|
|
7
7
|
e as default
|