@effect-app/vue-components 2.1.5 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/types/components/OmegaForm/InputProps.d.ts +1 -0
  2. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +9 -2
  3. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +1 -0
  4. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +4 -2
  5. package/dist/vue-components.es10.js +148 -145
  6. package/dist/vue-components.es18.js +10 -9
  7. package/dist/vue-components.es21.js +3 -3
  8. package/dist/vue-components.es22.js +1 -1
  9. package/dist/vue-components.es23.js +1 -1
  10. package/dist/vue-components.es36.js +1 -1
  11. package/dist/vue-components.es41.js +22 -10
  12. package/dist/vue-components.es42.js +5 -23
  13. package/dist/vue-components.es43.js +21 -5
  14. package/dist/vue-components.es44.js +25 -16
  15. package/dist/vue-components.es45.js +15 -23
  16. package/dist/vue-components.es46.js +7 -17
  17. package/dist/vue-components.es47.js +5 -12
  18. package/dist/vue-components.es48.js +19 -5
  19. package/dist/vue-components.es49.js +9 -19
  20. package/dist/vue-components.es50.js +31 -9
  21. package/dist/vue-components.es51.js +42 -25
  22. package/dist/vue-components.es52.js +16 -38
  23. package/dist/vue-components.es53.js +11 -26
  24. package/dist/vue-components.es54.js +1 -1
  25. package/dist/vue-components.es56.js +1 -1
  26. package/dist/vue-components.es58.js +3 -3
  27. package/dist/vue-components.es59.js +1 -1
  28. package/dist/vue-components.es6.js +27 -23
  29. package/dist/vue-components.es7.js +33 -36
  30. package/package.json +1 -1
  31. package/src/components/OmegaForm/InputProps.ts +1 -0
  32. package/src/components/OmegaForm/OmegaFormStuff.ts +12 -5
  33. package/src/components/OmegaForm/OmegaInput.vue +11 -2
  34. package/src/components/OmegaForm/OmegaInternalInput.vue +17 -35
  35. package/src/components/OmegaForm/OmegaWrapper.vue +0 -1
  36. package/src/components/OmegaForm/useOmegaForm.ts +41 -6
@@ -12,6 +12,7 @@ export type InputProps<From extends Record<PropertyKey, any>, TName extends Deep
12
12
  error: boolean;
13
13
  label: string;
14
14
  type: string;
15
+ inputClass: string | undefined | null;
15
16
  };
16
17
  field: OmegaFieldInternalApi<From, TName>;
17
18
  /** be sure to use this state and not `field.state` as it is not reactive */
@@ -6,12 +6,19 @@ import { type OF, type OmegaFormReturn } from "./useOmegaForm";
6
6
  export type Leaves<T, Path extends string = ""> = T extends ReadonlyArray<infer U> ? Leaves<U, `${Path}[number]`> & {} : {
7
7
  [K in keyof T]: T[K] extends string | boolean | number | null | undefined | symbol | bigint ? `${Path extends "" ? "" : `${Path}.`}${K & string}` : Leaves<T[K], `${Path extends "" ? "" : `${Path}.`}${K & string}`> & {};
8
8
  }[keyof T];
9
- export type FlexibleArrayPath<T extends string> = T extends `${infer Before}[number]${infer After}` ? T | `${Before}[${number}]${FlexibleArrayPath<After>}` : T;
9
+ export type FlexibleArrayPath<T extends string> = T extends `${string}[${string}]${string}` ? T : never;
10
10
  export type BaseProps<From, TName extends DeepKeys<From> = DeepKeys<From>> = {
11
11
  /** Will fallback to i18n when not specified */
12
12
  label?: string;
13
13
  validators?: FieldValidators<From>;
14
- name: TName;
14
+ name: FlexibleArrayPath<TName> extends never ? Leaves<From> : TName;
15
+ /**
16
+ * Optional class to apply to the input element.
17
+ * - If a string is provided, it will be used instead of the general class
18
+ * - If null is provided, no class will be applied (neither inputClass nor general class)
19
+ * - If undefined (not provided), the general class will be used
20
+ */
21
+ inputClass?: string | null;
15
22
  };
16
23
  export type TypesWithOptions = "radio" | "select" | "multiple" | "autocomplete" | "autocompletemultiple";
17
24
  export type DefaultTypeProps = {
@@ -17,6 +17,7 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends R
17
17
  error: boolean;
18
18
  label: string;
19
19
  type: string;
20
+ inputClass: string | undefined | null;
20
21
  }) => any;
21
22
  };
22
23
  emit: {};
@@ -1,4 +1,4 @@
1
- import { type DeepKeys, type DeepValue } from "@tanstack/vue-form";
1
+ import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import { type ComputedRef } from "vue";
3
3
  import type { OmegaFieldInternalApi } from "./InputProps";
4
4
  import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff";
@@ -11,6 +11,7 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends
11
11
  type?: TypeOverride;
12
12
  validators?: FieldValidators<From>;
13
13
  required?: boolean;
14
+ inputClass?: string | null;
14
15
  register: (field: ComputedRef<{
15
16
  name: string;
16
17
  label: string;
@@ -26,7 +27,7 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends
26
27
  slots: {
27
28
  default?: (props: {
28
29
  field: OmegaFieldInternalApi<From, Name>;
29
- state: import("@tanstack/vue-form").FieldState<From, Name, DeepValue<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").StandardSchemaV1<DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateFn<From, Name>, import("@tanstack/vue-form").StandardSchemaV1<DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateAsyncFn<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>>, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, DeepValue<From, Name>>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, any, 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>;
30
+ state: import("@tanstack/vue-form").FieldState<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").StandardSchemaV1<import("@tanstack/vue-form").DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateFn<From, Name>, import("@tanstack/vue-form").StandardSchemaV1<import("@tanstack/vue-form").DeepValue<From, Name>, unknown> | import("@tanstack/vue-form").FieldValidateAsyncFn<From, Name>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>>, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>>, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, Name, import("@tanstack/vue-form").DeepValue<From, Name>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, any, 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>;
30
31
  id: string;
31
32
  required?: boolean;
32
33
  minLength?: number | false;
@@ -37,6 +38,7 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, Name extends
37
38
  error: boolean;
38
39
  label: string;
39
40
  type: string;
41
+ inputClass: string | undefined | null;
40
42
  }) => any;
41
43
  };
42
44
  emit: {};
@@ -1,57 +1,57 @@
1
- import { useForm as q } from "@tanstack/vue-form";
2
- import { Data as B, S as D, Effect as c, Fiber as x, Option as P, Array as g } from "effect-app";
1
+ import { useForm as J } from "@tanstack/vue-form";
2
+ import { Data as z, S as D, Effect as l, Fiber as N, Option as P, Array as g } from "effect-app";
3
3
  import { runtimeFiberAsPromise as K } from "./vue-components.es16.js";
4
4
  import { isObject as T } from "./vue-components.es17.js";
5
- import { computed as O, onUnmounted as N, onMounted as G, onBeforeUnmount as z, watch as W, ref as Q, h as H } from "vue";
5
+ import { computed as L, onUnmounted as k, onMounted as Z, onBeforeUnmount as G, watch as W, ref as Q, h as B } from "vue";
6
6
  import X from "./vue-components.es18.js";
7
7
  import Y from "./vue-components.es19.js";
8
- import Z from "./vue-components.es20.js";
9
- import { generateMetaFromSchema as C } from "./vue-components.es12.js";
10
- import ee from "./vue-components.es6.js";
11
- import re from "./vue-components.es8.js";
12
- import te from "./vue-components.es21.js";
8
+ import C from "./vue-components.es20.js";
9
+ import { generateMetaFromSchema as ee } from "./vue-components.es12.js";
10
+ import re from "./vue-components.es6.js";
11
+ import te from "./vue-components.es8.js";
12
+ import ne from "./vue-components.es21.js";
13
13
  import { trace as R } from "./vue-components.es22.js";
14
- import { context as L } from "./vue-components.es23.js";
15
- class ne extends B.TaggedError("FormErrors") {
14
+ import { context as x } from "./vue-components.es23.js";
15
+ class se extends z.TaggedError("FormErrors") {
16
16
  }
17
- const E = (u) => function(s) {
17
+ const E = (c) => function(i) {
18
18
  return {
19
19
  render() {
20
- return H(s, {
21
- form: u,
20
+ return B(i, {
21
+ form: c,
22
22
  ...this.$attrs
23
23
  }, this.$slots);
24
24
  }
25
25
  };
26
- }, se = (u) => function(s) {
26
+ }, oe = (c) => function(i) {
27
27
  return {
28
28
  setup() {
29
- const { fieldMap: b, form: p } = u, y = p.useStore((d) => d.errors), f = p.useStore((d) => d.fieldMeta), M = p.useStore((d) => d.errorMap), j = O(() => {
30
- const d = g.filterMap(
31
- Object.entries(f.value),
32
- ([i, v]) => {
33
- const h = v.errors ?? [];
34
- if (!h.length) return P.none();
35
- const a = b.value.get(i);
29
+ const { fieldMap: S, form: v } = c, m = v.useStore((u) => u.errors), p = v.useStore((u) => u.fieldMeta), F = v.useStore((u) => u.errorMap), M = L(() => {
30
+ const u = g.filterMap(
31
+ Object.entries(p.value),
32
+ ([j, o]) => {
33
+ const b = o.errors ?? [];
34
+ if (!b.length) return P.none();
35
+ const a = S.value.get(j);
36
36
  return a ? P.some({
37
37
  label: a.label,
38
38
  inputId: a.id,
39
39
  // Only show the first error
40
- errors: [h[0]?.message].filter(Boolean)
40
+ errors: [b[0]?.message].filter(Boolean)
41
41
  }) : P.none();
42
42
  }
43
- ), F = [];
44
- if (M.value.onSubmit) {
45
- for (const [i, v] of Object.entries(M.value.onSubmit))
46
- if (g.isArray(v) && v.length)
47
- for (const h of v) {
48
- const a = h;
43
+ ), O = [];
44
+ if (F.value.onSubmit) {
45
+ for (const [j, o] of Object.entries(F.value.onSubmit))
46
+ if (g.isArray(o) && o.length)
47
+ for (const b of o) {
48
+ const a = b;
49
49
  if (a?.path && g.isArray(a.path) && a.path.length) {
50
- const S = a.path.join(".");
51
- if (!b.value.has(S)) {
52
- F.push({
53
- label: S,
54
- inputId: S,
50
+ const w = a.path.join(".");
51
+ if (!S.value.has(w)) {
52
+ O.push({
53
+ label: w,
54
+ inputId: w,
55
55
  errors: [a.message].filter(Boolean)
56
56
  });
57
57
  break;
@@ -59,177 +59,180 @@ const E = (u) => function(s) {
59
59
  }
60
60
  }
61
61
  }
62
- return [...d, ...F];
62
+ return [...u, ...O];
63
63
  });
64
64
  return {
65
- generalErrors: y,
66
- errors: j
65
+ generalErrors: m,
66
+ errors: M
67
67
  };
68
68
  },
69
- render({ errors: b, generalErrors: p }) {
70
- return H(s, {
71
- errors: b,
72
- generalErrors: p,
69
+ render({ errors: S, generalErrors: v }) {
70
+ return B(i, {
71
+ errors: S,
72
+ generalErrors: v,
73
73
  ...this.$attrs
74
74
  }, this.$slots);
75
75
  }
76
76
  };
77
- }, be = (u, l, s) => {
78
- if (!u) throw new Error("Schema is required");
79
- const b = D.standardSchemaV1(u), p = D.decode(u), { meta: y } = C(u), f = O(() => {
80
- if (s?.persistency?.id)
81
- return s.persistency.id;
82
- const e = window.location.pathname, r = Object.keys(y);
77
+ }, ye = (c, f, i) => {
78
+ if (!c) throw new Error("Schema is required");
79
+ const S = D.standardSchemaV1(c), v = D.decode(c), { meta: m } = ee(c), p = L(() => {
80
+ if (i?.persistency?.id)
81
+ return i.persistency.id;
82
+ const e = window.location.pathname, r = Object.keys(m);
83
83
  return `${e}-${r.join("-")}`;
84
- }), M = () => {
84
+ }), F = () => {
85
85
  const e = new URLSearchParams(window.location.search);
86
- e.delete(f.value);
86
+ e.delete(p.value);
87
87
  const r = new URL(window.location.href);
88
88
  r.search = e.toString(), window.history.replaceState({}, "", r.toString());
89
89
  };
90
- function j(e, r) {
91
- for (const t in r)
92
- r[t] && T(r[t]) ? (e[t] || (e[t] = {}), j(e[t], r[t])) : e[t] = r[t];
90
+ function M(e, r) {
91
+ for (const n in r)
92
+ r[n] && T(r[n]) ? (e[n] || (e[n] = {}), M(e[n], r[n])) : e[n] = r[n];
93
93
  return e;
94
94
  }
95
- const d = O(() => {
96
- if (l?.defaultValues && !s?.persistency?.overrideDefaultValues)
97
- return l?.defaultValues;
98
- let e;
99
- const r = s?.persistency;
100
- if (!r?.policies || r.policies.length === 0) return {};
101
- if (r.policies.includes("querystring"))
95
+ const u = (e) => {
96
+ const r = { ...e };
97
+ for (const n in m) {
98
+ const s = m[n], t = r[n], y = (t == null || t === !1 || t === "" || Number.isNaN(t)) && t !== !1 && t !== 0;
99
+ s && !s.required && s.nullableOrUndefined && s.type !== "boolean" && (t === void 0 || y) && (r[n] = s.nullableOrUndefined === "undefined" ? void 0 : null);
100
+ }
101
+ return r;
102
+ }, O = L(() => {
103
+ const e = f?.defaultValues ? u(f.defaultValues) : void 0;
104
+ if (e && !i?.persistency?.overrideDefaultValues)
105
+ return e;
106
+ let r;
107
+ const n = i?.persistency;
108
+ if (!n?.policies || n.policies.length === 0) return {};
109
+ if (n.policies.includes("querystring"))
102
110
  try {
103
- const o = new URLSearchParams(window.location.search).get(f.value);
104
- M(), o && (e = JSON.parse(o));
105
- } catch (t) {
106
- console.error(t);
111
+ const t = new URLSearchParams(window.location.search).get(p.value);
112
+ F(), t && (r = JSON.parse(t));
113
+ } catch (s) {
114
+ console.error(s);
107
115
  }
108
116
  if (
109
117
  // query string has higher priority than local/session storage
110
- !e && (r.policies.includes("local") || r.policies.includes("session"))
118
+ !r && (n.policies.includes("local") || n.policies.includes("session"))
111
119
  ) {
112
- const t = r.policies.includes("local") ? localStorage : sessionStorage;
113
- if (t)
120
+ const s = n.policies.includes("local") ? localStorage : sessionStorage;
121
+ if (s)
114
122
  try {
115
- const o = JSON.parse(
116
- t.getItem(f.value) || "{}"
123
+ const t = JSON.parse(
124
+ s.getItem(p.value) || "{}"
117
125
  );
118
- t.removeItem(f.value), e = o;
119
- } catch (o) {
120
- console.error(o);
126
+ s.removeItem(p.value), r = t;
127
+ } catch (t) {
128
+ console.error(t);
121
129
  }
122
130
  }
123
- if (e ??= {}, l?.defaultValues == null)
124
- return e;
125
- {
126
- const t = l?.defaultValues;
127
- return j(t, e);
128
- }
129
- }), F = (e, r) => e ? L.with(R.setSpan(L.active(), e), r) : r(), i = q({
130
- ...l,
131
+ return r ??= {}, e ? M(e, r) : r;
132
+ }), j = (e, r) => e ? x.with(R.setSpan(x.active(), e), r) : r(), o = J({
133
+ ...f,
131
134
  validators: {
132
- onSubmit: b,
133
- ...l?.validators || {}
135
+ onSubmit: S,
136
+ ...f?.validators || {}
134
137
  },
135
- onSubmit: l?.onSubmit ? ({ formApi: e, meta: r, value: t }) => F(r?.currentSpan, async () => {
136
- const o = await c.runPromise(p(t)), n = l.onSubmit({
138
+ onSubmit: f?.onSubmit ? ({ formApi: e, meta: r, value: n }) => j(r?.currentSpan, async () => {
139
+ const s = await l.runPromise(v(n)), t = f.onSubmit({
137
140
  formApi: e,
138
141
  meta: r,
139
- value: o
142
+ value: s
140
143
  });
141
- return x.isFiber(n) && x.isRuntimeFiber(n) ? await K(n) : c.isEffect(n) ? await c.runPromise(
142
- n.pipe(
144
+ return N.isFiber(t) && N.isRuntimeFiber(t) ? await K(t) : l.isEffect(t) ? await l.runPromise(
145
+ t.pipe(
143
146
  // meta?.currentSpan
144
147
  // ? Effect.withParentSpan(meta.currentSpan)
145
148
  // : (_) => _,
146
- c.flatMap((m) => x.join(m))
149
+ l.flatMap((d) => N.join(d))
147
150
  )
148
- ) : n;
151
+ ) : t;
149
152
  }) : void 0,
150
- defaultValues: d.value
151
- }), v = () => {
152
- Object.keys(y).forEach((e) => {
153
- i.setFieldValue(e, void 0);
153
+ defaultValues: O.value
154
+ }), b = () => {
155
+ Object.keys(m).forEach((e) => {
156
+ o.setFieldValue(e, void 0);
154
157
  });
155
- }, h = (e) => e.reduce((r, t) => {
156
- const o = t.split(".");
157
- return o.reduce((n, m, A) => (A === o.length - 1 ? n[m] = i.getFieldValue(t) : n[m] = n[m] ?? {}, n[m]), r), r;
158
- }, {}), a = (e) => {
158
+ }, a = (e) => e.reduce((r, n) => {
159
+ const s = n.split(".");
160
+ return s.reduce((t, d, y) => (y === s.length - 1 ? t[d] = o.getFieldValue(n) : t[d] = t[d] ?? {}, t[d]), r), r;
161
+ }, {}), w = (e) => {
159
162
  if (e) {
160
163
  if (g.isArray(e.keys))
161
- return h(e.keys);
164
+ return a(e.keys);
162
165
  if (g.isArray(e.banKeys)) {
163
- const r = Object.keys(y).filter((t) => e.banKeys?.includes(t));
164
- return h(r);
166
+ const r = Object.keys(m).filter((n) => e.banKeys?.includes(n));
167
+ return a(r);
165
168
  }
166
- return i.store.state.values;
169
+ return o.store.state.values;
167
170
  }
168
- }, S = () => {
169
- const e = s?.persistency;
171
+ }, U = () => {
172
+ const e = i?.persistency;
170
173
  if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
171
174
  const r = e.policies.includes("local") ? localStorage : sessionStorage;
172
175
  if (!r) return;
173
- const t = a(e);
174
- return r.setItem(f.value, JSON.stringify(t));
176
+ const n = w(e);
177
+ return r.setItem(p.value, JSON.stringify(n));
175
178
  }
176
- }, U = () => {
177
- const e = s?.persistency;
179
+ }, V = () => {
180
+ const e = i?.persistency;
178
181
  if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
179
- const r = a(e), t = new URLSearchParams(window.location.search);
180
- t.set(f.value, JSON.stringify(r));
181
- const o = new URL(window.location.href);
182
- o.search = t.toString(), window.history.replaceState({}, "", o.toString());
182
+ const r = w(e), n = new URLSearchParams(window.location.search);
183
+ n.set(p.value, JSON.stringify(r));
184
+ const s = new URL(window.location.href);
185
+ s.search = n.toString(), window.history.replaceState({}, "", s.toString());
183
186
  }
184
187
  }, _ = (e) => {
185
- i.store.state.isDirty && e.preventDefault();
188
+ o.store.state.isDirty && e.preventDefault();
186
189
  };
187
- if (N(S), G(() => {
188
- window.addEventListener("beforeunload", S), window.addEventListener("blur", U), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.addEventListener("beforeunload", _);
189
- }), z(() => {
190
- window.removeEventListener("beforeunload", S), window.removeEventListener("blur", U), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", _);
191
- }), s?.preventWindowExit === "prevent-and-reset") {
192
- const e = i.useStore((n) => n.isSubmitting), r = i.useStore((n) => n.submissionAttempts), t = i.useStore((n) => n.canSubmit), o = i.useStore((n) => n.values);
193
- W([e, r], ([n, m], [A]) => {
194
- A && !n && m > 0 && t.value && i.reset(o.value);
190
+ if (k(U), Z(() => {
191
+ window.addEventListener("beforeunload", U), window.addEventListener("blur", V), i?.preventWindowExit && i.preventWindowExit !== "nope" && window.addEventListener("beforeunload", _);
192
+ }), G(() => {
193
+ window.removeEventListener("beforeunload", U), window.removeEventListener("blur", V), i?.preventWindowExit && i.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", _);
194
+ }), i?.preventWindowExit === "prevent-and-reset") {
195
+ const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts), n = o.useStore((t) => t.canSubmit), s = o.useStore((t) => t.values);
196
+ W([e, r], ([t, d], [y]) => {
197
+ y && !t && d > 0 && n.value && o.reset(s.value);
195
198
  });
196
199
  }
197
- const I = (e) => c.currentSpan.pipe(
198
- c.option,
199
- c.flatMap(
200
- (r) => c.promise(() => i.handleSubmit(P.isSome(r) ? { currentSpan: r.value, ...e } : e))
200
+ const I = (e) => l.currentSpan.pipe(
201
+ l.option,
202
+ l.flatMap(
203
+ (r) => l.promise(() => o.handleSubmit(P.isSome(r) ? { currentSpan: r.value, ...e } : e))
201
204
  )
202
- ), J = (e) => e?.checkErrors ? I(e?.meta).pipe(c.flatMap(c.fnUntraced(function* () {
203
- const r = i.getAllErrors();
205
+ ), q = (e) => e?.checkErrors ? I(e?.meta).pipe(l.flatMap(l.fnUntraced(function* () {
206
+ const r = o.getAllErrors();
204
207
  if (Object.keys(r.fields).length || r.form.errors.length)
205
- return yield* new ne({ form: r.form, fields: r.fields });
206
- }))) : I(e?.meta), k = i.handleSubmit, V = Q(/* @__PURE__ */ new Map()), w = Object.assign(i, {
207
- i18nNamespace: s?.i18nNamespace,
208
- ignorePreventCloseEvents: s?.ignorePreventCloseEvents,
209
- meta: y,
210
- clear: v,
208
+ return yield* new se({ form: r.form, fields: r.fields });
209
+ }))) : I(e?.meta), H = o.handleSubmit, A = Q(/* @__PURE__ */ new Map()), h = Object.assign(o, {
210
+ i18nNamespace: i?.i18nNamespace,
211
+ ignorePreventCloseEvents: i?.ignorePreventCloseEvents,
212
+ meta: m,
213
+ clear: b,
211
214
  handleSubmit: (e) => {
212
- const r = R.getSpan(L.active());
213
- return k({ currentSpan: r, ...e });
215
+ const r = R.getSpan(x.active());
216
+ return H({ currentSpan: r, ...e });
214
217
  },
215
218
  // /** @experimental */
216
- handleSubmitEffect: J,
219
+ handleSubmitEffect: q,
217
220
  registerField: (e) => {
218
- W(e, (r) => V.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), N(() => V.value.delete(e.value.name));
221
+ W(e, (r) => A.value.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), k(() => A.value.delete(e.value.name));
219
222
  }
220
- }), $ = { form: w, fieldMap: V };
221
- return Object.assign(w, {
223
+ }), $ = { form: h, fieldMap: A };
224
+ return Object.assign(h, {
222
225
  errorContext: $,
223
- Form: E(w)(te),
224
- Input: E(w)(s?.input ?? ee),
225
- TaggedUnion: E(w)(re),
226
- Field: i.Field,
227
- Errors: se($)(Z),
228
- Array: E(w)(X),
229
- AutoGen: E(w)(Y)
226
+ Form: E(h)(ne),
227
+ Input: E(h)(i?.input ?? re),
228
+ TaggedUnion: E(h)(te),
229
+ Field: o.Field,
230
+ Errors: oe($)(C),
231
+ Array: E(h)(X),
232
+ AutoGen: E(h)(Y)
230
233
  });
231
234
  };
232
235
  export {
233
- ne as FormErrors,
234
- be as useOmegaForm
236
+ se as FormErrors,
237
+ ye as useOmegaForm
235
238
  };
@@ -1,15 +1,16 @@
1
- import { defineComponent as F, computed as i, onMounted as M, provide as P, createBlock as c, openBlock as s, resolveDynamicComponent as p, withCtx as g, renderSlot as o, createElementBlock as k, normalizeProps as l, guardReactiveProps as u, Fragment as A, renderList as b, mergeProps as B } from "vue";
1
+ import { defineComponent as F, computed as f, onMounted as M, provide as P, createBlock as c, openBlock as s, resolveDynamicComponent as p, withCtx as g, renderSlot as o, createElementBlock as k, normalizeProps as l, guardReactiveProps as u, Fragment as A, renderList as C, mergeProps as b } from "vue";
2
2
  const N = /* @__PURE__ */ F({
3
3
  inheritAttrs: !1,
4
4
  __name: "OmegaArray",
5
5
  props: {
6
6
  form: {},
7
+ inputClass: {},
7
8
  name: {},
8
9
  defaultItems: {},
9
10
  items: {}
10
11
  },
11
12
  setup(n) {
12
- const a = n, y = a.form.useStore((e) => e.values), d = i(() => {
13
+ const a = n, y = a.form.useStore((e) => e.values), i = f(() => {
13
14
  const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
14
15
  try {
15
16
  return e.split(".").reduce((r, t) => r && r[t], y.value);
@@ -18,16 +19,16 @@ const N = /* @__PURE__ */ F({
18
19
  }
19
20
  });
20
21
  M(async () => {
21
- a.defaultItems && !d.value && a.form.setFieldValue(a.name, a.defaultItems);
22
+ a.defaultItems && !i.value && a.form.setFieldValue(a.name, a.defaultItems);
22
23
  });
23
- const $ = i(() => (r) => {
24
+ const $ = f(() => (r) => {
24
25
  const t = r.replace(/\[\d+\]/g, "");
25
26
  return a.form.meta[t];
26
27
  });
27
28
  return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
28
- default: g(({ field: t, state: f }) => [
29
- o(e.$slots, "pre-array", l(u({ field: t, state: f }))),
30
- (s(!0), k(A, null, b(d.value, (C, m) => (s(), c(p(n.form.Field), {
29
+ default: g(({ field: t, state: d }) => [
30
+ o(e.$slots, "pre-array", l(u({ field: t, state: d }))),
31
+ (s(!0), k(A, null, C(i.value, (B, m) => (s(), c(p(n.form.Field), {
31
32
  key: `${n.name}[${Number(m)}]`,
32
33
  name: (
33
34
  // eslint-disable-next-line
@@ -35,7 +36,7 @@ const N = /* @__PURE__ */ F({
35
36
  )
36
37
  }, {
37
38
  default: g(({ field: v, state: h }) => [
38
- o(e.$slots, "default", B({ ref_for: !0 }, {
39
+ o(e.$slots, "default", b({ ref_for: !0 }, {
39
40
  subField: v,
40
41
  subState: h,
41
42
  index: Number(m),
@@ -44,7 +45,7 @@ const N = /* @__PURE__ */ F({
44
45
  ]),
45
46
  _: 2
46
47
  }, 1032, ["name"]))), 128)),
47
- o(e.$slots, "post-array", l(u({ field: t, state: f }))),
48
+ o(e.$slots, "post-array", l(u({ field: t, state: d }))),
48
49
  o(e.$slots, "field", l(u({ field: t })))
49
50
  ]),
50
51
  _: 3
@@ -1,8 +1,8 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-8a2f9d6f]{display:contents}fieldset[disabled][data-v-8a2f9d6f]>*{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-8a2f9d6f]{display:contents}fieldset[disabled][data-v-8a2f9d6f]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
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
2
  import o from "./vue-components.es36.js";
3
3
 
4
4
  import m from "./vue-components.es35.js";
5
- const f = /* @__PURE__ */ m(o, [["__scopeId", "data-v-8a2f9d6f"]]);
5
+ const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
6
6
  export {
7
- f as default
7
+ e as default
8
8
  };
@@ -1,4 +1,4 @@
1
- import { TraceAPI as r } from "./vue-components.es53.js";
1
+ import { TraceAPI as r } from "./vue-components.es52.js";
2
2
  var t = r.getInstance();
3
3
  export {
4
4
  t as trace
@@ -1,4 +1,4 @@
1
- import { ContextAPI as t } from "./vue-components.es52.js";
1
+ import { ContextAPI as t } from "./vue-components.es51.js";
2
2
  var o = t.getInstance();
3
3
  export {
4
4
  o as context
@@ -1,7 +1,7 @@
1
1
  import { defineComponent as m, createElementBlock as d, openBlock as u, withModifiers as f, createElementVNode as l, unref as s, renderSlot as a } from "vue";
2
2
  import { useStore as b } from "@tanstack/vue-form";
3
3
  import { usePreventClose as p } from "./vue-components.es11.js";
4
- import { getOmegaStore as c } from "./vue-components.es41.js";
4
+ import { getOmegaStore as c } from "./vue-components.es53.js";
5
5
  const S = ["disabled"], V = /* @__PURE__ */ m({
6
6
  __name: "OmegaWrapper",
7
7
  props: {
@@ -1,13 +1,25 @@
1
- import { useStore as u } from "@tanstack/vue-form";
2
- import { computed as f } from "vue";
3
- function c(o, t) {
4
- return f(() => t ? u(o.store, (n) => {
5
- const r = {};
6
- for (const e of t)
7
- r[e] = n[e];
8
- return r;
9
- }).value : {});
1
+ function a(t) {
2
+ return Symbol.for(t);
10
3
  }
4
+ var c = (
5
+ /** @class */
6
+ /* @__PURE__ */ (function() {
7
+ function t(u) {
8
+ var e = this;
9
+ e._currentContext = u ? new Map(u) : /* @__PURE__ */ new Map(), e.getValue = function(n) {
10
+ return e._currentContext.get(n);
11
+ }, e.setValue = function(n, r) {
12
+ var o = new t(e._currentContext);
13
+ return o._currentContext.set(n, r), o;
14
+ }, e.deleteValue = function(n) {
15
+ var r = new t(e._currentContext);
16
+ return r._currentContext.delete(n), r;
17
+ };
18
+ }
19
+ return t;
20
+ })()
21
+ ), x = new c();
11
22
  export {
12
- c as getOmegaStore
23
+ x as ROOT_CONTEXT,
24
+ a as createContextKey
13
25
  };
@@ -1,25 +1,7 @@
1
- function a(t) {
2
- return Symbol.for(t);
3
- }
4
- var c = (
5
- /** @class */
6
- /* @__PURE__ */ (function() {
7
- function t(u) {
8
- var e = this;
9
- e._currentContext = u ? new Map(u) : /* @__PURE__ */ new Map(), e.getValue = function(n) {
10
- return e._currentContext.get(n);
11
- }, e.setValue = function(n, r) {
12
- var o = new t(e._currentContext);
13
- return o._currentContext.set(n, r), o;
14
- }, e.deleteValue = function(n) {
15
- var r = new t(e._currentContext);
16
- return r._currentContext.delete(n), r;
17
- };
18
- }
19
- return t;
20
- })()
21
- ), x = new c();
1
+ var R;
2
+ (function(E) {
3
+ E[E.NONE = 0] = "NONE", E[E.ERROR = 30] = "ERROR", E[E.WARN = 50] = "WARN", E[E.INFO = 60] = "INFO", E[E.DEBUG = 70] = "DEBUG", E[E.VERBOSE = 80] = "VERBOSE", E[E.ALL = 9999] = "ALL";
4
+ })(R || (R = {}));
22
5
  export {
23
- x as ROOT_CONTEXT,
24
- a as createContextKey
6
+ R as DiagLogLevel
25
7
  };