@effect-app/vue-components 4.0.0-beta.33 → 4.0.0-beta.36

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.
@@ -1,13 +1,14 @@
1
1
  import { Effect, S } from "effect-app";
2
2
  import { type DeepKeys, type DeepValue, type FieldAsyncValidateOrFn, type FieldValidateOrFn, type FormApi, type FormAsyncValidateOrFn, type FormOptions, type FormState, type FormValidateOrFn, type StandardSchemaV1, type VueFormApi } from "@tanstack/vue-form";
3
3
  import type { Fiber as EffectFiber } from "effect/Fiber";
4
+ import type { Redacted } from "effect/Redacted";
4
5
  import { useIntl } from "../../utils";
5
6
  import { type OmegaFieldInternalApi } from "./InputProps";
6
7
  import { type OF, type OmegaFormReturn } from "./useOmegaForm";
7
- export type FieldPath<T> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint ? "" : T extends ReadonlyArray<infer U> ? FieldPath_<U, `[${number}]`> : {
8
+ export type FieldPath<T> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? "" : T extends ReadonlyArray<infer U> ? FieldPath_<U, `[${number}]`> : {
8
9
  [K in keyof T]: FieldPath_<T[K], `${K & string}`>;
9
10
  }[keyof T];
10
- export type FieldPath_<T, Path extends string> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint ? Path : T extends ReadonlyArray<infer U> ? FieldPath_<U, `${Path}[${number}]`> | Path : {
11
+ export type FieldPath_<T, Path extends string> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint | Redacted<any> ? Path : T extends ReadonlyArray<infer U> ? FieldPath_<U, `${Path}[${number}]`> | Path : {
11
12
  [K in keyof T]: FieldPath_<T[K], `${Path}.${K & string}`>;
12
13
  }[keyof T];
13
14
  export type BaseProps<From, TName extends FieldPath<From>> = {
@@ -77,7 +78,10 @@ export type FormType<From extends Record<PropertyKey, any>, To extends Record<Pr
77
78
  Field: OmegaFieldInternalApi<From, Name>;
78
79
  };
79
80
  export type PrefixFromDepth<K extends string | number, _TDepth extends any[]> = K;
80
- export type NestedKeyOf<T> = DeepKeys<T>;
81
+ type StripRedacted<T> = T extends Redacted<any> ? string : T extends ReadonlyArray<infer U> ? ReadonlyArray<StripRedacted<U>> : T extends Record<string, any> ? {
82
+ [K in keyof T]: StripRedacted<T[K]>;
83
+ } : T;
84
+ export type NestedKeyOf<T> = DeepKeys<StripRedacted<T>>;
81
85
  export type FieldValidators<T> = {
82
86
  onChangeAsync?: FieldAsyncValidateOrFn<T, any, any>;
83
87
  onChange?: FieldValidateOrFn<T, any, any>;
@@ -143,6 +147,7 @@ export type CreateMeta = {
143
147
  });
144
148
  export declare const isNullableOrUndefined: (property: false | S.AST.AST | undefined) => false | "undefined" | "null";
145
149
  export declare const createMeta: <T = any>({ meta, parent, property, propertySignatures }: CreateMeta, acc?: Partial<MetaRecord<T>>) => MetaRecord<T> | FieldMeta;
150
+ export declare const toFormSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never>;
146
151
  export declare const duplicateSchema: <From, To>(schema: S.Codec<To, From, never>) => S.Codec<To, From, never, never>;
147
152
  export declare const generateMetaFromSchema: <From, To>(schema: S.Codec<To, From, never>) => {
148
153
  schema: S.Codec<To, From, never>;
@@ -93,7 +93,7 @@ type CachedFieldApi<From, To, TypeProps = DefaultTypeProps> = import("@tanstack/
93
93
  type CachedFieldState<From, To, TypeProps = DefaultTypeProps> = import("@tanstack/vue-form").FieldState<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>, import("@tanstack/vue-form").FieldValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, OmegaFormReturn<From, To, TypeProps>["_keys"], DeepValue<From, OmegaFormReturn<From, To, TypeProps>["_keys"]>> | 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>;
94
94
  export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps> extends OF<From, To> {
95
95
  _paths: FieldPath<From>;
96
- _keys: DeepKeys<From>;
96
+ _keys: NestedKeyOf<From>;
97
97
  _schema: S.Codec<To, From, never>;
98
98
  Input: <Name extends OmegaFormReturn<From, To, TypeProps>["_paths"]>(__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<{
99
99
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & TypeProps & Partial<{}>> & BaseProps<From, Name> & import("vue").PublicProps;
@@ -3,13 +3,13 @@ import { getTransformationFrom as p, provideIntl as l, useIntl as s, useIntlKey
3
3
  import { default as i } from "./vue-components.es4.js";
4
4
  import { default as g } from "./vue-components.es5.js";
5
5
  import { default as I } from "./vue-components.es6.js";
6
- import { default as y } from "./vue-components.es7.js";
7
- import { default as h } from "./vue-components.es8.js";
6
+ import { default as F } from "./vue-components.es7.js";
7
+ import { default as y } from "./vue-components.es8.js";
8
8
  import { default as C } from "./vue-components.es9.js";
9
9
  import { useOmegaForm as T } from "./vue-components.es10.js";
10
10
  import { useOnClose as b, usePreventClose as j } from "./vue-components.es11.js";
11
- import { createMeta as P, deepMerge as V, defaultsValueFromSchema as k, duplicateSchema as w, generateInputStandardSchemaFromFieldMeta as B, generateMetaFromSchema as D, getInputType as K, isNullableOrUndefined as N } from "./vue-components.es12.js";
12
- import { createUseFormWithCustomInput as $ } from "./vue-components.es13.js";
11
+ import { createMeta as P, deepMerge as V, defaultsValueFromSchema as k, duplicateSchema as w, generateInputStandardSchemaFromFieldMeta as B, generateMetaFromSchema as D, getInputType as K, isNullableOrUndefined as N, toFormSchema as W } from "./vue-components.es12.js";
12
+ import { createUseFormWithCustomInput as q } from "./vue-components.es13.js";
13
13
  function r(a) {
14
14
  for (const e in o)
15
15
  if (Object.prototype.hasOwnProperty.call(o, e)) {
@@ -22,11 +22,11 @@ export {
22
22
  i as CommandButton,
23
23
  g as Dialog,
24
24
  I as OmegaInput,
25
- h as OmegaTaggedUnion,
25
+ y as OmegaTaggedUnion,
26
26
  C as OmegaTaggedUnionInternal,
27
- y as OmegaVuetifyInput,
27
+ F as OmegaVuetifyInput,
28
28
  P as createMeta,
29
- $ as createUseFormWithCustomInput,
29
+ q as createUseFormWithCustomInput,
30
30
  V as deepMerge,
31
31
  n as default,
32
32
  k as defaultsValueFromSchema,
@@ -37,6 +37,7 @@ export {
37
37
  p as getTransformationFrom,
38
38
  N as isNullableOrUndefined,
39
39
  l as provideIntl,
40
+ W as toFormSchema,
40
41
  s as useIntl,
41
42
  u as useIntlKey,
42
43
  T as useOmegaForm,
@@ -1,56 +1,56 @@
1
- import { useForm as K } from "@tanstack/vue-form";
2
- import { Data as T, S as I, Effect as m, Fiber as V, Option as z, Array as P } from "effect-app";
3
- import { runtimeFiberAsPromise as W } from "./vue-components.es17.js";
4
- import { computed as $, onUnmounted as D, onMounted as G, onBeforeUnmount as Z, watch as R, ref as Q, h as J } from "vue";
5
- import { useIntl as X } from "./vue-components.es3.js";
6
- import Y from "./vue-components.es18.js";
7
- import C from "./vue-components.es19.js";
8
- import ee from "./vue-components.es20.js";
9
- import { generateMetaFromSchema as re, deepMerge as N, defaultsValueFromSchema as te } from "./vue-components.es12.js";
10
- import se from "./vue-components.es6.js";
11
- import ne from "./vue-components.es8.js";
12
- import oe from "./vue-components.es21.js";
13
- import { trace as H } from "./vue-components.es22.js";
1
+ import { useForm as T } from "@tanstack/vue-form";
2
+ import { Data as z, S as V, Effect as p, Fiber as W, Option as G, Array as A } from "effect-app";
3
+ import { runtimeFiberAsPromise as D } from "./vue-components.es17.js";
4
+ import { computed as $, onUnmounted as R, onMounted as Z, onBeforeUnmount as Q, watch as N, ref as X, h as q } from "vue";
5
+ import { useIntl as Y } from "./vue-components.es3.js";
6
+ import C from "./vue-components.es18.js";
7
+ import ee from "./vue-components.es19.js";
8
+ import re from "./vue-components.es20.js";
9
+ import { toFormSchema as te, generateMetaFromSchema as se, deepMerge as H, defaultsValueFromSchema as ne } 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.es21.js";
13
+ import { trace as J } from "./vue-components.es22.js";
14
14
  import { context as _ } from "./vue-components.es23.js";
15
- class ie extends T.TaggedError("FormErrors") {
15
+ class ce extends z.TaggedError("FormErrors") {
16
16
  }
17
- const M = (a) => function(s) {
17
+ const F = (a) => function(s) {
18
18
  return {
19
19
  render() {
20
- return J(s, {
20
+ return q(s, {
21
21
  form: a,
22
22
  ...this.$attrs
23
23
  }, this.$slots);
24
24
  }
25
25
  };
26
- }, ae = (a) => {
27
- const { formatMessage: l } = X(), s = (c) => c.replace(/([A-Z])/g, " $1").replace(/^./, (F) => F.toUpperCase()).trim(), p = (c) => l ? l({ id: `general.fields.${c}`, defaultMessage: s(c) }) : s(c);
28
- return (c) => a.i18nNamespace ? l({ id: `${a.i18nNamespace}.fields.${c}`, defaultMessage: p(c) }) : p(c);
29
- }, ce = (a) => function(s) {
26
+ }, le = (a) => {
27
+ const { formatMessage: c } = Y(), s = (l) => l.replace(/([A-Z])/g, " $1").replace(/^./, (S) => S.toUpperCase()).trim(), f = (l) => c ? c({ id: `general.fields.${l}`, defaultMessage: s(l) }) : s(l);
28
+ return (l) => a.i18nNamespace ? c({ id: `${a.i18nNamespace}.fields.${l}`, defaultMessage: f(l) }) : f(l);
29
+ }, ue = (a) => function(s) {
30
30
  return {
31
31
  setup() {
32
- const { fieldMap: p, form: v } = a, c = v.useStore((S) => S.errors), F = v.useStore((S) => S.fieldMeta), h = v.useStore((S) => S.errorMap), A = ae(v), L = $(() => {
33
- const S = Object.entries(F.value).reduce((y, [w, g]) => {
32
+ const { fieldMap: f, form: v } = a, l = v.useStore((h) => h.errors), S = v.useStore((h) => h.fieldMeta), M = v.useStore((h) => h.errorMap), b = le(v), L = $(() => {
33
+ const h = Object.entries(S.value).reduce((o, [y, g]) => {
34
34
  const u = g?.errors ?? [];
35
35
  if (!u.length)
36
- return y;
37
- const d = p.value.get(w);
38
- return d && y.push({
36
+ return o;
37
+ const d = f.value.get(y);
38
+ return d && o.push({
39
39
  label: d.label,
40
40
  inputId: d.id,
41
41
  errors: [u[0]?.message].filter(Boolean)
42
- }), y;
43
- }, []), o = [];
44
- if (h.value.onSubmit) {
45
- for (const [y, w] of Object.entries(h.value.onSubmit))
46
- if (P.isArray(w) && w.length)
47
- for (const g of w) {
42
+ }), o;
43
+ }, []), O = [];
44
+ if (M.value.onSubmit) {
45
+ for (const [o, y] of Object.entries(M.value.onSubmit))
46
+ if (A.isArray(y) && y.length)
47
+ for (const g of y) {
48
48
  const u = g;
49
- if (u?.path && P.isArray(u.path) && u.path.length) {
49
+ if (u?.path && A.isArray(u.path) && u.path.length) {
50
50
  const d = u.path.join(".");
51
- if (!p.value.has(d)) {
52
- o.push({
53
- label: A(d),
51
+ if (!f.value.has(d)) {
52
+ O.push({
53
+ label: b(d),
54
54
  inputId: d,
55
55
  errors: [u.message].filter(Boolean)
56
56
  });
@@ -59,181 +59,181 @@ const M = (a) => function(s) {
59
59
  }
60
60
  }
61
61
  }
62
- return [...S, ...o];
62
+ return [...h, ...O];
63
63
  });
64
64
  return {
65
- generalErrors: c,
65
+ generalErrors: l,
66
66
  errors: L
67
67
  };
68
68
  },
69
- render({ errors: p, generalErrors: v }) {
70
- return J(s, {
71
- errors: p,
69
+ render({ errors: f, generalErrors: v }) {
70
+ return q(s, {
71
+ errors: f,
72
72
  generalErrors: v,
73
73
  ...this.$attrs
74
74
  }, this.$slots);
75
75
  }
76
76
  };
77
- }, b = (a, l) => a.includes(l), Fe = (a, l, s) => {
77
+ }, w = (a, c) => a.includes(c), Oe = (a, c, s) => {
78
78
  if (!a) throw new Error("Schema is required");
79
- const p = I.toStandardSchemaV1(a), v = I.decodeUnknownEffect(a), { meta: c, unionMeta: F } = re(a), h = $(() => {
79
+ const f = te(a), v = V.toStandardSchemaV1(f), l = V.decodeUnknownEffect(f), { meta: S, unionMeta: M } = se(a), b = $(() => {
80
80
  if (s?.persistency?.id)
81
81
  return s.persistency.id;
82
- const e = window.location.pathname, r = Object.keys(c);
82
+ const e = window.location.pathname, r = Object.keys(S);
83
83
  return `${e}-${r.join("-")}`;
84
- }), A = () => {
84
+ }), L = () => {
85
85
  const e = new URLSearchParams(window.location.search);
86
- e.delete(h.value);
86
+ e.delete(b.value);
87
87
  const r = new URL(window.location.href);
88
88
  r.search = e.toString(), window.history.replaceState({}, "", r.toString());
89
- }, L = $(() => {
89
+ }, h = $(() => {
90
90
  let e;
91
91
  const r = s?.persistency;
92
92
  if (
93
93
  // query string has higher priority than local/session storage
94
- r?.policies && !e && (b(r.policies, "local") || b(r.policies, "session"))
94
+ r?.policies && !e && (w(r.policies, "local") || w(r.policies, "session"))
95
95
  ) {
96
- const n = b(r.policies, "local") ? localStorage : sessionStorage;
96
+ const n = w(r.policies, "local") ? localStorage : sessionStorage;
97
97
  if (n)
98
98
  try {
99
99
  const t = JSON.parse(
100
- n.getItem(h.value) || "{}"
100
+ n.getItem(b.value) || "{}"
101
101
  );
102
- n.removeItem(h.value), e = t;
102
+ n.removeItem(b.value), e = t;
103
103
  } catch (t) {
104
104
  console.error(t);
105
105
  }
106
106
  }
107
- if (r?.policies && b(r.policies, "querystring"))
107
+ if (r?.policies && w(r.policies, "querystring"))
108
108
  try {
109
- const t = new URLSearchParams(window.location.search).get(h.value);
110
- A(), t && (e = N(e || {}, JSON.parse(t)));
109
+ const t = new URLSearchParams(window.location.search).get(b.value);
110
+ L(), t && (e = H(e || {}, JSON.parse(t)));
111
111
  } catch (n) {
112
112
  console.error(n);
113
113
  }
114
114
  e ??= {};
115
115
  const i = {
116
- tanstack: l?.defaultValues || {},
116
+ tanstack: c?.defaultValues || {},
117
117
  persistency: e,
118
- schema: te(a)
118
+ schema: ne(a)
119
119
  };
120
120
  return (s?.defaultValuesPriority || ["tanstack", "persistency", "schema"]).reverse().reduce(
121
- (n, t) => Object.keys(n).length ? N(n, i[t]) : i[t],
121
+ (n, t) => Object.keys(n).length ? H(n, i[t]) : i[t],
122
122
  {}
123
123
  );
124
- }), S = (e, r) => e ? _.with(H.setSpan(_.active(), e), r) : r(), o = K({
125
- ...l,
124
+ }), O = (e, r) => e ? _.with(J.setSpan(_.active(), e), r) : r(), o = T({
125
+ ...c,
126
126
  validators: {
127
- onSubmit: p,
128
- ...l?.validators || {}
127
+ onSubmit: v,
128
+ ...c?.validators || {}
129
129
  },
130
- onSubmit: l?.onSubmit ? ({ formApi: e, meta: r, value: i }) => S(r?.currentSpan, async () => {
131
- const n = await m.runPromise(v(i)), t = l.onSubmit({
130
+ onSubmit: c?.onSubmit ? ({ formApi: e, meta: r, value: i }) => O(r?.currentSpan, async () => {
131
+ const n = await p.runPromise(l(i)), t = c.onSubmit({
132
132
  formApi: e,
133
133
  meta: r,
134
134
  value: n
135
135
  });
136
- if (V.isFiber(t))
137
- return await W(t);
138
- if (m.isEffect(t)) {
139
- const f = await m.runPromise(t);
140
- return V.isFiber(f) ? await W(f) : f;
136
+ if (W.isFiber(t))
137
+ return await D(t);
138
+ if (p.isEffect(t)) {
139
+ const m = await p.runPromise(t);
140
+ return W.isFiber(m) ? await D(m) : m;
141
141
  }
142
142
  return t;
143
143
  }) : void 0,
144
- defaultValues: L.value
144
+ defaultValues: h.value
145
145
  }), y = () => {
146
- Object.keys(c).forEach((e) => {
146
+ Object.keys(S).forEach((e) => {
147
147
  o.setFieldValue(e, void 0);
148
148
  });
149
- }, w = (e) => e.reduce((r, i) => {
149
+ }, g = (e) => e.reduce((r, i) => {
150
150
  const n = i.split(".");
151
- return n.reduce((t, f, U) => (U === n.length - 1 ? t[f] = o.getFieldValue(i) : t[f] = t[f] ?? {}, t[f]), r), r;
152
- }, {}), g = (e) => {
151
+ return n.reduce((t, m, U) => (U === n.length - 1 ? t[m] = o.getFieldValue(i) : t[m] = t[m] ?? {}, t[m]), r), r;
152
+ }, {}), u = (e) => {
153
153
  if (!e) return;
154
154
  const { banKeys: r, keys: i } = e;
155
- if (P.isArray(i))
156
- return w(i);
157
- if (P.isArray(r)) {
158
- const n = Object.keys(c).filter((t) => r.includes(t));
159
- return w(n);
155
+ if (A.isArray(i))
156
+ return g(i);
157
+ if (A.isArray(r)) {
158
+ const n = Object.keys(S).filter((t) => r.includes(t));
159
+ return g(n);
160
160
  }
161
161
  return o.store.state.values;
162
- }, u = () => {
162
+ }, d = () => {
163
163
  const e = s?.persistency;
164
- if (!(!e?.policies || e.policies.length === 0) && (b(e.policies, "local") || b(e.policies, "session"))) {
165
- const r = b(e.policies, "local") ? localStorage : sessionStorage;
164
+ if (!(!e?.policies || e.policies.length === 0) && (w(e.policies, "local") || w(e.policies, "session"))) {
165
+ const r = w(e.policies, "local") ? localStorage : sessionStorage;
166
166
  if (!r) return;
167
- const i = g(e);
168
- return r.setItem(h.value, JSON.stringify(i));
167
+ const i = u(e);
168
+ return r.setItem(b.value, JSON.stringify(i));
169
169
  }
170
- }, d = () => {
170
+ }, j = () => {
171
171
  const e = s?.persistency;
172
- if (!(!e?.policies || e.policies.length === 0) && b(e.policies, "querystring")) {
173
- const r = g(e), i = new URLSearchParams(window.location.search);
174
- i.set(h.value, JSON.stringify(r));
172
+ if (!(!e?.policies || e.policies.length === 0) && w(e.policies, "querystring")) {
173
+ const r = u(e), i = new URLSearchParams(window.location.search);
174
+ i.set(b.value, JSON.stringify(r));
175
175
  const n = new URL(window.location.href);
176
176
  n.search = i.toString(), window.history.replaceState({}, "", n.toString());
177
177
  }
178
- }, j = (e) => {
178
+ }, x = (e) => {
179
179
  o.store.state.isDirty && e.preventDefault();
180
180
  };
181
- if (D(u), G(() => {
182
- window.addEventListener("beforeunload", u), window.addEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.addEventListener("beforeunload", j);
183
- }), Z(() => {
184
- window.removeEventListener("beforeunload", u), window.removeEventListener("blur", d), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", j);
181
+ if (R(d), Z(() => {
182
+ window.addEventListener("beforeunload", d), window.addEventListener("blur", j), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.addEventListener("beforeunload", x);
183
+ }), Q(() => {
184
+ window.removeEventListener("beforeunload", d), window.removeEventListener("blur", j), s?.preventWindowExit && s.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", x);
185
185
  }), s?.preventWindowExit === "prevent-and-reset") {
186
186
  const e = o.useStore((t) => t.isSubmitting), r = o.useStore((t) => t.submissionAttempts), i = o.useStore((t) => t.canSubmit), n = o.useStore((t) => t.values);
187
- R([e, r], ([t, f], [U]) => {
188
- U && !t && f > 0 && i.value && o.reset(n.value);
187
+ N([e, r], ([t, m], [U]) => {
188
+ U && !t && m > 0 && i.value && o.reset(n.value);
189
189
  });
190
190
  }
191
- const x = (e) => m.currentSpan.pipe(
192
- m.option,
193
- m.flatMap(
194
- (r) => m.promise(() => o.handleSubmit(z.isSome(r) ? { currentSpan: r.value, ...e } : e))
191
+ const k = (e) => p.currentSpan.pipe(
192
+ p.option,
193
+ p.flatMap(
194
+ (r) => p.promise(() => o.handleSubmit(G.isSome(r) ? { currentSpan: r.value, ...e } : e))
195
195
  )
196
- ), q = (e) => e?.checkErrors ? x(e?.meta).pipe(m.flatMap(m.fnUntraced(function* () {
196
+ ), B = (e) => e?.checkErrors ? k(e?.meta).pipe(p.flatMap(p.fnUntraced(function* () {
197
197
  const r = o.getAllErrors();
198
198
  if (Object.keys(r.fields).length || r.form.errors.length)
199
- return yield* m.fail(new ie({ form: r.form, fields: r.fields }));
200
- }))) : x(e?.meta), B = o.handleSubmit, O = Q(/* @__PURE__ */ new Map()), E = Object.assign(o, {
199
+ return yield* p.fail(new ce({ form: r.form, fields: r.fields }));
200
+ }))) : k(e?.meta), K = o.handleSubmit, P = X(/* @__PURE__ */ new Map()), E = Object.assign(o, {
201
201
  i18nNamespace: s?.i18nNamespace,
202
202
  ignorePreventCloseEvents: s?.ignorePreventCloseEvents,
203
- meta: c,
204
- unionMeta: F,
203
+ meta: S,
204
+ unionMeta: M,
205
205
  clear: y,
206
206
  handleSubmit: (e) => {
207
- const r = H.getSpan(_.active());
208
- return B({ currentSpan: r, ...e });
207
+ const r = J.getSpan(_.active());
208
+ return K({ currentSpan: r, ...e });
209
209
  },
210
210
  // /** @experimental */
211
- handleSubmitEffect: q,
211
+ handleSubmitEffect: B,
212
212
  registerField: (e) => {
213
- R(e, (r) => {
214
- O.value.set(r.name, { label: r.label, id: r.id });
215
- }, { immediate: !0 }), D(() => {
216
- O.value.get(e.value.name)?.id === e.value.id && O.value.delete(e.value.name);
213
+ N(e, (r) => {
214
+ P.value.set(r.name, { label: r.label, id: r.id });
215
+ }, { immediate: !0 }), R(() => {
216
+ P.value.get(e.value.name)?.id === e.value.id && P.value.delete(e.value.name);
217
217
  });
218
218
  }
219
- }), k = { form: E, fieldMap: O };
219
+ }), I = { form: E, fieldMap: P };
220
220
  return Object.assign(E, {
221
221
  // Type-level properties for performance optimization (not used at runtime)
222
222
  _paths: void 0,
223
223
  _keys: void 0,
224
224
  _schema: a,
225
- errorContext: k,
226
- Form: M(E)(oe),
227
- Input: M(E)(s?.input ?? se),
228
- TaggedUnion: M(E)(ne),
225
+ errorContext: I,
226
+ Form: F(E)(ae),
227
+ Input: F(E)(s?.input ?? oe),
228
+ TaggedUnion: F(E)(ie),
229
229
  Field: o.Field,
230
- Errors: ce(k)(ee),
231
- Array: M(E)(Y),
232
- AutoGen: M(E)(C)
230
+ Errors: ue(I)(re),
231
+ Array: F(E)(C),
232
+ AutoGen: F(E)(ee)
233
233
  });
234
234
  };
235
235
  export {
236
- ie as FormErrors,
237
- ae as useErrorLabel,
238
- Fe as useOmegaForm
236
+ ce as FormErrors,
237
+ le as useErrorLabel,
238
+ Oe as useOmegaForm
239
239
  };