@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.
@@ -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, any>;
17
- state: NonNullable<import("@tanstack/vue-form").DeepValue<From, any>>;
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, any>;
21
- state: NonNullable<import("@tanstack/vue-form").DeepValue<From, any>>;
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, 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>;
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 Z } from "@tanstack/vue-form";
2
- import { Data as G, S as v, Effect as S, Fiber as O, Option as U, Array as _ } from "effect-app";
3
- import { runtimeFiberAsPromise as Q } from "./vue-components.es17.js";
4
- import { isObject as X } from "./vue-components.es18.js";
5
- import { computed as T, onUnmounted as W, onMounted as Y, onBeforeUnmount as C, watch as B, ref as ee, h as H } from "vue";
6
- import te from "./vue-components.es19.js";
7
- import re from "./vue-components.es20.js";
8
- import ne from "./vue-components.es21.js";
9
- import { generateMetaFromSchema as se } from "./vue-components.es12.js";
10
- import oe from "./vue-components.es6.js";
11
- import ie from "./vue-components.es8.js";
12
- import ae from "./vue-components.es22.js";
13
- import { trace as q } from "./vue-components.es23.js";
14
- import { context as L } from "./vue-components.es24.js";
15
- const F = (c) => {
16
- const a = c.ast;
17
- if (a._tag === "Union") {
18
- const o = a.types.map((u) => {
19
- const l = v.make(u);
20
- return F(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.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(m);
25
+ return v.make(p);
26
26
  }
27
- if (a._tag === "Transformation") {
28
- const o = v.make(a.from), m = v.make(a.to), u = F(o), l = F(m), f = {
29
- ...a,
30
- from: u.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 v.make(f);
33
+ return v.make(m);
34
34
  }
35
- if (a._tag === "TypeLiteral") {
36
- const o = a.propertySignatures.map((u) => {
37
- const l = u.type;
38
- let f = l;
39
- if (l._tag === "TypeLiteral" || l._tag === "Union" || l._tag === "Transformation") {
40
- const w = v.make(l);
41
- f = F(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
- ...u,
45
- type: f,
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 v.make(m);
52
+ return v.make(p);
53
53
  }
54
- return c;
54
+ return f;
55
55
  };
56
- class le extends G.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
- }, ce = (c) => function(o) {
67
+ }, me = (f) => function(o) {
68
68
  return {
69
69
  setup() {
70
- const { fieldMap: m, form: u } = c, l = u.useStore((y) => y.errors), f = u.useStore((y) => y.fieldMeta), w = u.useStore((y) => y.errorMap), E = T(() => {
71
- const y = _.filterMap(
72
- Object.entries(f.value),
73
- ([A, h]) => {
74
- const k = h.errors ?? [];
75
- if (!k.length) return U.none();
76
- const i = m.value.get(A);
77
- return i ? U.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: [k[0]?.message].filter(Boolean)
82
- }) : U.none();
81
+ errors: [_[0]?.message].filter(Boolean)
82
+ }) : V.none();
83
83
  }
84
- ), g = [];
85
- if (w.value.onSubmit) {
86
- for (const [A, h] of Object.entries(w.value.onSubmit))
87
- if (_.isArray(h) && h.length)
88
- for (const k of h) {
89
- const i = k;
90
- if (i?.path && _.isArray(i.path) && i.path.length) {
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 (!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,162 +100,161 @@ const D = (c) => function(o) {
100
100
  }
101
101
  }
102
102
  }
103
- return [...y, ...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: u }) {
111
- return H(o, {
112
- errors: m,
113
- generalErrors: u,
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 = v.standardSchemaV1(c), u = v.decode(c), { meta: l } = se(c), f = T(() => {
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(f.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) {
132
- for (const n in t)
133
- t[n] && X(t[n]) ? (e[n] || (e[n] = {}), E(e[n], t[n])) : e[n] = t[n];
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
- for (const n in l) {
140
- const s = l[n], r = t[n], p = (r == null || r === !1 || r === "" || Number.isNaN(r)) && r !== !1 && r !== 0;
141
- s && !s.required && s.nullableOrUndefined && s.type !== "boolean" && (r === void 0 || p) && (t[n] = 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
149
  if (typeof e?.make == "function")
147
150
  try {
148
151
  return e.make({});
149
152
  } catch {
150
153
  }
151
- const n = e?.members || (e?.ast?._tag === "Union" && e.ast.types ? e.ast.types.map((s) => v.make(s)) : null);
152
- if (n && _.isArray(n)) {
153
- for (const s of n) {
154
- const r = g(s);
155
- if (Object.keys(r).length > 0 && s?.fields && Object.entries(s.fields).some(
156
- ([p, K]) => p === "_tag" || p === "type" || p === "kind" ? K?.ast?.defaultValue !== void 0 : !1
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 r;
161
+ return s;
159
162
  }
160
163
  return {};
161
164
  }
162
165
  if (e?.fields && typeof e.fields == "object")
163
- for (const [s, r] of Object.entries(e.fields)) {
164
- if (r?.ast?.defaultValue)
166
+ for (const [n, s] of Object.entries(e.fields)) {
167
+ if (s?.ast?.defaultValue)
165
168
  try {
166
- const p = r.ast.defaultValue();
167
- p !== void 0 && (t[s] = p);
169
+ const l = s.ast.defaultValue();
170
+ l !== void 0 && (t[n] = l);
168
171
  } catch {
169
172
  }
170
- const d = g(r);
171
- Object.keys(d).length > 0 && (t[s] && typeof t[s] == "object" ? Object.assign(t[s], d) : t[s] || (t[s] = d));
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
- }, A = (e = {}) => {
177
+ }, U = (e = {}) => {
175
178
  let t = {};
176
179
  try {
177
- const n = c.make(e);
178
- t = v.encodeSync(F(c))(n);
179
- } catch (n) {
180
- window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:", n);
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 s = g(c);
183
- t = v.encodeSync(F(c))(s);
184
- } catch (s) {
185
- 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);
186
189
  }
187
190
  }
188
- return E(t, e);
189
- }, h = T(() => {
190
- const e = A(
191
- y(
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
- !t && (n.policies.includes("local") || n.policies.includes("session"))
197
+ t?.policies && !e && (t.policies.includes("local") || t.policies.includes("session"))
210
198
  ) {
211
- const s = n.policies.includes("local") ? localStorage : sessionStorage;
212
- if (s)
199
+ const r = t.policies.includes("local") ? localStorage : sessionStorage;
200
+ if (r)
213
201
  try {
214
- const r = JSON.parse(
215
- s.getItem(f.value) || "{}"
202
+ const n = JSON.parse(
203
+ r.getItem(m.value) || "{}"
216
204
  );
217
- s.removeItem(f.value), t = r;
218
- } catch (r) {
219
- console.error(r);
205
+ r.removeItem(m.value), e = n;
206
+ } catch (n) {
207
+ console.error(n);
220
208
  }
221
209
  }
222
- return t ??= A({}), e ? E(e, t) : t;
223
- }), k = (e, t) => e ? L.with(q.setSpan(L.active(), e), t) : t(), i = Z({
224
- ...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,
225
224
  validators: {
226
- onSubmit: m,
227
- ...a?.validators || {}
225
+ onSubmit: p,
226
+ ...c?.validators || {}
228
227
  },
229
- onSubmit: a?.onSubmit ? ({ formApi: e, meta: t, value: n }) => k(t?.currentSpan, async () => {
230
- const s = await S.runPromise(u(n)), r = 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({
231
230
  formApi: e,
232
231
  meta: t,
233
- value: s
232
+ value: n
234
233
  });
235
- return O.isFiber(r) && O.isRuntimeFiber(r) ? await Q(r) : S.isEffect(r) ? await S.runPromise(
236
- r.pipe(
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((d) => O.join(d))
239
+ S.flatMap((a) => j.join(a))
241
240
  )
242
- ) : r;
241
+ ) : s;
243
242
  }) : void 0,
244
243
  defaultValues: h.value
245
244
  }), M = () => {
246
- Object.keys(l).forEach((e) => {
245
+ Object.keys(u).forEach((e) => {
247
246
  i.setFieldValue(e, void 0);
248
247
  });
249
- }, V = (e) => e.reduce((t, n) => {
250
- const s = n.split(".");
251
- return s.reduce((r, d, p) => (p === s.length - 1 ? r[d] = i.getFieldValue(n) : r[d] = r[d] ?? {}, r[d]), t), t;
252
- }, {}), j = (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) => {
253
252
  if (e) {
254
- if (_.isArray(e.keys))
255
- return V(e.keys);
256
- if (_.isArray(e.banKeys)) {
257
- const t = Object.keys(l).filter((n) => e.banKeys?.includes(n));
258
- return V(t);
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 n = j(e);
268
- return t.setItem(f.value, JSON.stringify(n));
266
+ const r = R(e);
267
+ return t.setItem(m.value, JSON.stringify(r));
269
268
  }
270
- }, N = () => {
269
+ }, W = () => {
271
270
  const e = o?.persistency;
272
271
  if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
273
- const t = j(e), n = new URLSearchParams(window.location.search);
274
- n.set(f.value, JSON.stringify(t));
275
- const s = new URL(window.location.href);
276
- s.search = n.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());
277
276
  }
278
- }, I = (e) => {
277
+ }, B = (e) => {
279
278
  i.store.state.isDirty && e.preventDefault();
280
279
  };
281
- if (W(x), Y(() => {
282
- window.addEventListener("beforeunload", x), window.addEventListener("blur", N), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.addEventListener("beforeunload", I);
283
- }), C(() => {
284
- window.removeEventListener("beforeunload", x), 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);
285
284
  }), o?.preventWindowExit === "prevent-and-reset") {
286
- const e = i.useStore((r) => r.isSubmitting), t = i.useStore((r) => r.submissionAttempts), n = i.useStore((r) => r.canSubmit), s = i.useStore((r) => r.values);
287
- B([e, t], ([r, d], [p]) => {
288
- p && !r && d > 0 && n.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);
289
288
  });
290
289
  }
291
- const $ = (e) => S.currentSpan.pipe(
290
+ const q = (e) => S.currentSpan.pipe(
292
291
  S.option,
293
292
  S.flatMap(
294
- (t) => S.promise(() => i.handleSubmit(U.isSome(t) ? { currentSpan: t.value, ...e } : e))
293
+ (t) => S.promise(() => i.handleSubmit(V.isSome(t) ? { currentSpan: t.value, ...e } : e))
295
294
  )
296
- ), J = (e) => e?.checkErrors ? $(e?.meta).pipe(S.flatMap(S.fnUntraced(function* () {
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 le({ form: t.form, fields: t.fields });
300
- }))) : $(e?.meta), z = i.handleSubmit, P = ee(/* @__PURE__ */ new Map()), b = 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, {
301
300
  i18nNamespace: o?.i18nNamespace,
302
301
  ignorePreventCloseEvents: o?.ignorePreventCloseEvents,
303
- meta: l,
302
+ meta: u,
304
303
  clear: M,
305
304
  handleSubmit: (e) => {
306
- const t = q.getSpan(L.active());
307
- return z({ currentSpan: t, ...e });
305
+ const t = z.getSpan(T.active());
306
+ return Q({ currentSpan: t, ...e });
308
307
  },
309
308
  // /** @experimental */
310
- handleSubmitEffect: J,
309
+ handleSubmitEffect: G,
311
310
  registerField: (e) => {
312
- B(e, (t) => P.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), W(() => P.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));
313
312
  }
314
- }), R = { form: b, fieldMap: P };
315
- return Object.assign(b, {
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: R,
320
- Form: D(b)(ae),
321
- Input: D(b)(o?.input ?? oe),
322
- TaggedUnion: D(b)(ie),
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: ce(R)(ne),
325
- Array: D(b)(te),
326
- AutoGen: D(b)(re)
323
+ Errors: me(H)(ae),
324
+ Array: D(w)(oe),
325
+ AutoGen: D(w)(ie)
327
326
  });
328
327
  };
329
328
  export {
330
- le as FormErrors,
331
- Fe as useOmegaForm
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.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