@effect-app/vue-components 2.7.0 → 2.7.2

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