@effect-app/vue-components 1.8.2 → 1.8.4

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 (72) hide show
  1. package/dist/types/components/OmegaForm/InputProps.d.ts +0 -1
  2. package/dist/types/components/OmegaForm/OmegaErrorsInternal.vue.d.ts +0 -1
  3. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +0 -1
  4. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +10 -1
  5. package/dist/types/components/OmegaForm/index.d.ts +0 -1
  6. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -1
  7. package/dist/types/components/OmegaForm/useRegisterField.d.ts +7 -0
  8. package/dist/vue-components.es.js +24 -26
  9. package/dist/vue-components.es10.js +23 -352
  10. package/dist/vue-components.es11.js +2 -27
  11. package/dist/vue-components.es12.js +10 -2
  12. package/dist/vue-components.es13.js +5 -10
  13. package/dist/vue-components.es14.js +54 -5
  14. package/dist/vue-components.es15.js +63 -49
  15. package/dist/vue-components.es16.js +6 -68
  16. package/dist/vue-components.es17.js +5 -5
  17. package/dist/vue-components.es18.js +3 -6
  18. package/dist/vue-components.es19.js +3 -3
  19. package/dist/vue-components.es2.js +19 -21
  20. package/dist/vue-components.es20.js +2 -3
  21. package/dist/vue-components.es21.js +1 -1
  22. package/dist/vue-components.es22.js +17 -2
  23. package/dist/vue-components.es23.js +10 -16
  24. package/dist/vue-components.es24.js +135 -11
  25. package/dist/vue-components.es26.js +44 -0
  26. package/dist/vue-components.es27.js +2 -42
  27. package/dist/vue-components.es29.js +89 -2
  28. package/dist/vue-components.es31.js +9 -0
  29. package/dist/vue-components.es32.js +31 -7
  30. package/dist/vue-components.es34.js +6 -0
  31. package/dist/vue-components.es35.js +23 -4
  32. package/dist/vue-components.es36.js +5 -23
  33. package/dist/vue-components.es37.js +21 -5
  34. package/dist/vue-components.es38.js +25 -16
  35. package/dist/vue-components.es39.js +15 -23
  36. package/dist/vue-components.es4.js +2 -2
  37. package/dist/vue-components.es40.js +7 -17
  38. package/dist/vue-components.es41.js +5 -12
  39. package/dist/vue-components.es42.js +19 -5
  40. package/dist/vue-components.es43.js +9 -19
  41. package/dist/vue-components.es44.js +31 -9
  42. package/dist/vue-components.es45.js +42 -25
  43. package/dist/vue-components.es46.js +16 -38
  44. package/dist/vue-components.es47.js +11 -26
  45. package/dist/vue-components.es48.js +65 -11
  46. package/dist/vue-components.es49.js +45 -54
  47. package/dist/vue-components.es5.js +10 -9
  48. package/dist/vue-components.es50.js +15 -54
  49. package/dist/vue-components.es51.js +31 -15
  50. package/dist/vue-components.es52.js +26 -30
  51. package/dist/vue-components.es53.js +42 -29
  52. package/dist/vue-components.es54.js +2 -42
  53. package/dist/vue-components.es55.js +44 -2
  54. package/dist/vue-components.es56.js +2 -44
  55. package/dist/vue-components.es6.js +37 -58
  56. package/dist/vue-components.es7.js +219 -27
  57. package/dist/vue-components.es8.js +28 -211
  58. package/dist/vue-components.es9.js +355 -29
  59. package/package.json +1 -1
  60. package/src/components/OmegaForm/InputProps.ts +0 -1
  61. package/src/components/OmegaForm/OmegaErrorsInternal.vue +1 -2
  62. package/src/components/OmegaForm/OmegaInput.vue +1 -0
  63. package/src/components/OmegaForm/OmegaInternalInput.vue +20 -58
  64. package/src/components/OmegaForm/index.ts +0 -1
  65. package/src/components/OmegaForm/useOmegaForm.ts +42 -13
  66. package/src/components/OmegaForm/useRegisterField.ts +15 -0
  67. package/dist/types/components/OmegaForm/OmegaErrorsContext.d.ts +0 -38
  68. package/dist/vue-components.es25.js +0 -137
  69. package/dist/vue-components.es30.js +0 -92
  70. package/dist/vue-components.es33.js +0 -33
  71. package/dist/vue-components.es57.js +0 -4
  72. package/src/components/OmegaForm/OmegaErrorsContext.ts +0 -67
@@ -1,4 +1,46 @@
1
- var r = "1.9.0";
1
+ import { VERSION as d } from "./vue-components.es54.js";
2
+ var h = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
3
+ function s(c) {
4
+ var m = /* @__PURE__ */ new Set([c]), f = /* @__PURE__ */ new Set(), t = c.match(h);
5
+ if (!t)
6
+ return function() {
7
+ return !1;
8
+ };
9
+ var e = {
10
+ major: +t[1],
11
+ minor: +t[2],
12
+ patch: +t[3],
13
+ prerelease: t[4]
14
+ };
15
+ if (e.prerelease != null)
16
+ return function(r) {
17
+ return r === c;
18
+ };
19
+ function a(n) {
20
+ return f.add(n), !1;
21
+ }
22
+ function p(n) {
23
+ return m.add(n), !0;
24
+ }
25
+ return function(r) {
26
+ if (m.has(r))
27
+ return !0;
28
+ if (f.has(r))
29
+ return !1;
30
+ var i = r.match(h);
31
+ if (!i)
32
+ return a(r);
33
+ var u = {
34
+ major: +i[1],
35
+ minor: +i[2],
36
+ patch: +i[3],
37
+ prerelease: i[4]
38
+ };
39
+ return u.prerelease != null || e.major !== u.major ? a(r) : e.major === 0 ? e.minor === u.minor && e.patch <= u.patch ? p(r) : a(r) : e.minor <= u.minor ? p(r) : a(r);
40
+ };
41
+ }
42
+ var v = s(d);
2
43
  export {
3
- r as VERSION
44
+ s as _makeCompatibilityCheck,
45
+ v as isCompatible
4
46
  };
@@ -1,46 +1,4 @@
1
- import { VERSION as d } from "./vue-components.es55.js";
2
- var h = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
3
- function s(c) {
4
- var m = /* @__PURE__ */ new Set([c]), f = /* @__PURE__ */ new Set(), t = c.match(h);
5
- if (!t)
6
- return function() {
7
- return !1;
8
- };
9
- var e = {
10
- major: +t[1],
11
- minor: +t[2],
12
- patch: +t[3],
13
- prerelease: t[4]
14
- };
15
- if (e.prerelease != null)
16
- return function(r) {
17
- return r === c;
18
- };
19
- function a(n) {
20
- return f.add(n), !1;
21
- }
22
- function p(n) {
23
- return m.add(n), !0;
24
- }
25
- return function(r) {
26
- if (m.has(r))
27
- return !0;
28
- if (f.has(r))
29
- return !1;
30
- var i = r.match(h);
31
- if (!i)
32
- return a(r);
33
- var u = {
34
- major: +i[1],
35
- minor: +i[2],
36
- patch: +i[3],
37
- prerelease: i[4]
38
- };
39
- return u.prerelease != null || e.major !== u.major ? a(r) : e.major === 0 ? e.minor === u.minor && e.patch <= u.patch ? p(r) : a(r) : e.minor <= u.minor ? p(r) : a(r);
40
- };
41
- }
42
- var v = s(d);
1
+ var o = typeof globalThis == "object" ? globalThis : typeof self == "object" ? self : typeof window == "object" ? window : typeof global == "object" ? global : {};
43
2
  export {
44
- s as _makeCompatibilityCheck,
45
- v as isCompatible
3
+ o as _globalThis
46
4
  };
@@ -1,9 +1,9 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { defineComponent as I, getCurrentInstance as V, useId as $, computed as n, onMounted as g, ref as k, watchEffect as q, watch as D, onUnmounted as F, useAttrs as L, renderSlot as O, normalizeProps as h, guardReactiveProps as A, createElementVNode as M, normalizeClass as R, createBlock as S, createCommentVNode as U, unref as z, openBlock as T, mergeProps as Z } from "vue";
3
- import { useStore as j } from "@tanstack/vue-form";
4
- import G from "./vue-components.es25.js";
2
+ import { defineComponent as C, getCurrentInstance as x, useId as P, computed as r, onMounted as _, renderSlot as $, normalizeProps as u, guardReactiveProps as N, createElementVNode as V, normalizeClass as k, createBlock as q, createCommentVNode as w, unref as B, openBlock as F, mergeProps as I } from "vue";
3
+ import { useStore as L } from "@tanstack/vue-form";
4
+ import D from "./vue-components.es24.js";
5
5
 
6
- const te = /* @__PURE__ */ I({
6
+ const U = /* @__PURE__ */ C({
7
7
  inheritAttrs: !1,
8
8
  __name: "OmegaInternalInput",
9
9
  props: {
@@ -11,82 +11,61 @@ const te = /* @__PURE__ */ I({
11
11
  meta: {},
12
12
  label: {},
13
13
  type: {},
14
- validators: {}
14
+ validators: {},
15
+ register: { type: Function },
16
+ options: {}
15
17
  },
16
- setup(v) {
17
- const e = v, y = V()?.appContext.components.VTextField, a = $(), l = e.field, o = j(l.store, (t) => t), m = n(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), d = n(() => o.value.value), f = n(() => o.value.meta.errors ?? []), b = n(
18
+ setup(p) {
19
+ const e = p, d = x()?.appContext.components.VTextField, o = P(), l = e.field, n = L(l.store, (t) => t), i = r(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown");
20
+ e.register(r(() => ({ name: e.field.name, label: e.label, id: o })));
21
+ const f = r(() => n.value.value), c = r(() => n.value.meta.errors ?? []), g = r(
18
22
  () => (
19
23
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
- f.value.map((t) => t?.message).filter(Boolean)
24
+ c.value.map((t) => t?.message).filter(Boolean)
21
25
  )
22
- ), C = (t) => t == null || t === !1 || t === "" || Number.isNaN(t), x = (t) => {
23
- C(t) && e.meta?.type !== "boolean" ? e.field.handleChange(
26
+ ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t), h = (t) => {
27
+ y(t) && e.meta?.type !== "boolean" ? e.field.handleChange(
24
28
  e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
25
29
  ) : e.field.handleChange(t);
26
30
  };
27
- g(() => {
28
- if (!d.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null") {
29
- const t = o.value.meta.isDirty;
30
- l.setValue(null), l.setMeta((r) => ({ ...r, isDirty: t }));
31
+ _(() => {
32
+ if (!f.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null") {
33
+ const t = n.value.meta.isDirty;
34
+ l.setValue(null), l.setMeta((a) => ({ ...a, isDirty: t }));
31
35
  }
32
36
  });
33
- const { mapError: _, removeError: c, showErrors: w, showErrorsOn: E } = e.field.form.errorContext, s = k(!1);
34
- q(() => {
35
- (w.value || E === "onChange") && (s.value = !0);
36
- });
37
- const i = () => {
38
- s.value = !0;
39
- };
40
- g(() => {
41
- d.value && i();
42
- });
43
- const p = n(() => !s.value && m.value !== "select" ? [] : b.value);
44
- D(
45
- f,
46
- (t) => {
47
- t.length ? _({
48
- inputId: a,
49
- errors: o.value.meta.errors.map((r) => r.message).filter(Boolean),
50
- label: e.label
51
- }) : c(a);
52
- }
53
- ), F(() => {
54
- c(a);
55
- });
56
- const P = (t) => {
57
- const r = {
58
- get(K, B, Q) {
59
- return B === "handleChange" ? x : Reflect.get(...arguments);
37
+ const m = r(() => !n.value.meta.isDirty && i.value !== "select" ? [] : g.value), v = (t) => {
38
+ const a = {
39
+ get(S, b, z) {
40
+ return b === "handleChange" ? h : Reflect.get(...arguments);
60
41
  }
61
42
  };
62
- return new Proxy(t, r);
63
- }, N = L(), u = n(() => ({
43
+ return new Proxy(t, a);
44
+ }, s = r(() => ({
64
45
  inputProps: {
65
- ...N,
66
- id: a,
46
+ id: o,
67
47
  required: e.meta?.required,
68
48
  minLength: e.meta?.type === "string" && e.meta?.minLength,
69
49
  maxLength: e.meta?.type === "string" && e.meta?.maxLength,
70
50
  max: e.meta?.type === "number" && e.meta?.maximum,
71
51
  min: e.meta?.type === "number" && e.meta?.minimum,
72
- errorMessages: p.value,
73
- error: !!p.value.length,
74
- setRealDirty: i,
75
- type: m.value,
76
- label: `${e.label}${e.meta?.required ? " *" : ""}`
52
+ errorMessages: m.value,
53
+ error: !!m.value.length,
54
+ type: i.value,
55
+ label: `${e.label}${e.meta?.required ? " *" : ""}`,
56
+ options: e.options
77
57
  },
78
- field: P(e.field)
58
+ field: v(e.field)
79
59
  }));
80
- return (t, r) => O(t.$slots, "default", h(A({ ...u.value.inputProps, field: u.value.field })), () => [
81
- M("div", {
82
- class: R(t.$attrs.class),
83
- onFocusout: i
60
+ return (t, a) => $(t.$slots, "default", u(N({ ...t.$attrs, ...s.value.inputProps, field: s.value.field })), () => [
61
+ V("div", {
62
+ class: k(t.$attrs.class)
84
63
  }, [
85
- z(y) ? (T(), S(G, h(Z({ key: 0 }, u.value)), null, 16)) : U("", !0)
86
- ], 34)
64
+ B(d) ? (F(), q(D, u(I({ key: 0 }, { ...t.$attrs, ...s.value })), null, 16)) : w("", !0)
65
+ ], 2)
87
66
  ]);
88
67
  }
89
68
  });
90
69
  export {
91
- te as default
70
+ U as default
92
71
  };
@@ -1,31 +1,223 @@
1
- import { ref as a, computed as l, readonly as E, inject as p } from "vue";
2
- const d = Symbol();
3
- function b(o, u, t = "onSubmit") {
4
- const r = a([]), n = (e) => {
5
- r.value = r.value.filter((m) => m.inputId !== e);
6
- }, s = (e) => {
7
- n(e.inputId), r.value.push(e);
8
- }, c = () => {
9
- r.value = [];
10
- }, i = l(() => t === "onSubmit" ? o.value > 0 : !0);
1
+ import { useForm as T } from "@tanstack/vue-form";
2
+ import { Data as W, S as U, Effect as l, Array as g, Option as E, Fiber as F } from "effect-app";
3
+ import { runtimeFiberAsPromise as k } from "./vue-components.es12.js";
4
+ import { isObject as z } from "./vue-components.es13.js";
5
+ import { computed as $, onUnmounted as A, onMounted as Q, onBeforeUnmount as X, watch as N, h as D } from "vue";
6
+ import { usePreventClose as Y } from "./vue-components.es8.js";
7
+ import Z from "./vue-components.es14.js";
8
+ import C from "./vue-components.es15.js";
9
+ import ee from "./vue-components.es16.js";
10
+ import { generateMetaFromSchema as re } from "./vue-components.es9.js";
11
+ import te from "./vue-components.es5.js";
12
+ import se from "./vue-components.es17.js";
13
+ import { trace as _ } from "./vue-components.es18.js";
14
+ import { context as M } from "./vue-components.es19.js";
15
+ class ne extends W.TaggedError("FormErrors") {
16
+ }
17
+ const h = (c) => function(o) {
11
18
  return {
12
- errors: E(r),
13
- mapError: s,
14
- removeError: n,
15
- clearErrors: c,
16
- showErrors: i,
17
- generalErrors: u,
18
- showErrorsOn: t ?? "onSubmit"
19
+ render() {
20
+ return D(o, {
21
+ form: c,
22
+ ...this.$attrs
23
+ }, this.$slots);
24
+ }
19
25
  };
20
- }
21
- function g() {
22
- const o = p(d);
23
- if (!o)
24
- throw new Error("useOmegaErrors must be used within an OmegaForm provider");
25
- return o;
26
- }
26
+ }, oe = (c) => function(o) {
27
+ return {
28
+ setup() {
29
+ return {
30
+ ...c
31
+ };
32
+ },
33
+ render({ errors: S, generalErrors: w, showErrors: v }) {
34
+ return D(o, {
35
+ errors: S,
36
+ generalErrors: w,
37
+ showErrors: v,
38
+ ...this.$attrs
39
+ }, this.$slots);
40
+ }
41
+ };
42
+ }, ye = (c, a, o) => {
43
+ if (!c) throw new Error("Schema is required");
44
+ const S = U.standardSchemaV1(c), w = U.decode(c), { filterItems: v, meta: p } = re(c), m = $(() => {
45
+ if (o?.persistency?.id)
46
+ return o.persistency.id;
47
+ const e = window.location.pathname, r = Object.keys(p);
48
+ return `${e}-${r.join("-")}`;
49
+ }), R = () => {
50
+ const e = new URLSearchParams(window.location.search);
51
+ e.delete(m.value);
52
+ const r = new URL(window.location.href);
53
+ r.search = e.toString(), window.history.replaceState({}, "", r.toString());
54
+ };
55
+ function j(e, r) {
56
+ for (const t in r)
57
+ r[t] && z(r[t]) ? (e[t] || (e[t] = {}), j(e[t], r[t])) : e[t] = r[t];
58
+ return e;
59
+ }
60
+ const x = $(() => {
61
+ if (a?.defaultValues && !o?.persistency?.overrideDefaultValues)
62
+ return a?.defaultValues;
63
+ let e;
64
+ const r = o?.persistency;
65
+ if (!r?.policies || r.policies.length === 0) return {};
66
+ if (r.policies.includes("querystring"))
67
+ try {
68
+ const s = new URLSearchParams(window.location.search).get(m.value);
69
+ R(), s && (e = JSON.parse(s));
70
+ } catch (t) {
71
+ console.error(t);
72
+ }
73
+ if (
74
+ // query string has higher priority than local/session storage
75
+ !e && (r.policies.includes("local") || r.policies.includes("session"))
76
+ ) {
77
+ const t = r.policies.includes("local") ? localStorage : sessionStorage;
78
+ if (t)
79
+ try {
80
+ const s = JSON.parse(
81
+ t.getItem(m.value) || "{}"
82
+ );
83
+ t.removeItem(m.value), e = s;
84
+ } catch (s) {
85
+ console.error(s);
86
+ }
87
+ }
88
+ if (e ??= {}, a?.defaultValues == null)
89
+ return e;
90
+ {
91
+ const t = a?.defaultValues;
92
+ return j(t, e);
93
+ }
94
+ }), H = (e, r) => e ? M.with(_.setSpan(M.active(), e), r) : r(), u = T({
95
+ ...a,
96
+ validators: {
97
+ onSubmit: S,
98
+ ...a?.validators || {}
99
+ },
100
+ onSubmit: a?.onSubmit ? ({ formApi: e, meta: r, value: t }) => H(r?.currentSpan, async () => {
101
+ const s = await l.runPromise(w(t)), n = a.onSubmit({
102
+ formApi: e,
103
+ meta: r,
104
+ value: s
105
+ });
106
+ return F.isFiber(n) && F.isRuntimeFiber(n) ? await k(n) : l.isEffect(n) ? await l.runPromise(
107
+ n.pipe(
108
+ // meta?.currentSpan
109
+ // ? Effect.withParentSpan(meta.currentSpan)
110
+ // : (_) => _,
111
+ l.flatMap((d) => F.join(d))
112
+ )
113
+ ) : n;
114
+ }) : void 0,
115
+ defaultValues: x.value
116
+ }), J = () => {
117
+ Object.keys(p).forEach((e) => {
118
+ u.setFieldValue(e, void 0);
119
+ });
120
+ }, V = (e) => e.reduce((r, t) => {
121
+ const s = t.split(".");
122
+ return s.reduce((n, d, G) => (G === s.length - 1 ? n[d] = u.getFieldValue(t) : n[d] = n[d] ?? {}, n[d]), r), r;
123
+ }, {}), O = (e) => {
124
+ if (e) {
125
+ if (g.isArray(e.keys))
126
+ return V(e.keys);
127
+ if (g.isArray(e.banKeys)) {
128
+ const r = Object.keys(p).filter((t) => e.banKeys?.includes(t));
129
+ return V(r);
130
+ }
131
+ return u.store.state.values;
132
+ }
133
+ }, b = () => {
134
+ const e = o?.persistency;
135
+ if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
136
+ const r = e.policies.includes("local") ? localStorage : sessionStorage;
137
+ if (!r) return;
138
+ const t = O(e);
139
+ return r.setItem(m.value, JSON.stringify(t));
140
+ }
141
+ }, P = () => {
142
+ const e = o?.persistency;
143
+ if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
144
+ const r = O(e), t = new URLSearchParams(window.location.search);
145
+ t.set(m.value, JSON.stringify(r));
146
+ const s = new URL(window.location.href);
147
+ s.search = t.toString(), window.history.replaceState({}, "", s.toString());
148
+ }
149
+ };
150
+ A(b), Q(() => {
151
+ window.addEventListener("beforeunload", b), window.addEventListener("blur", P);
152
+ }), X(() => {
153
+ window.removeEventListener("beforeunload", b), window.removeEventListener("blur", P);
154
+ });
155
+ const I = (e) => l.currentSpan.pipe(
156
+ l.option,
157
+ l.flatMap(
158
+ (r) => l.promise(() => u.handleSubmit(E.isSome(r) ? { currentSpan: r.value, ...e } : e))
159
+ )
160
+ ), q = (e) => e?.checkErrors ? I(e?.meta).pipe(l.flatMap(l.fnUntraced(function* () {
161
+ const r = u.getAllErrors();
162
+ if (Object.keys(r.fields).length || r.form.errors.length)
163
+ return yield* new ne({ form: r.form, fields: r.fields });
164
+ }))) : I(e?.meta), B = u.handleSubmit, f = /* @__PURE__ */ new Map(), i = Object.assign(u, {
165
+ i18nNamespace: o?.i18nNamespace,
166
+ meta: p,
167
+ filterItems: v,
168
+ clear: J,
169
+ handleSubmit: (e) => {
170
+ const r = _.getSpan(M.active());
171
+ return B({ currentSpan: r, ...e });
172
+ },
173
+ // /** @experimental */
174
+ handleSubmitEffect: q,
175
+ registerField: (e) => {
176
+ N(e, (r) => f.set(r.name, { label: r.label, id: r.id }), { immediate: !0 }), A(() => f.delete(e.value.name));
177
+ }
178
+ }), y = i.useStore((e) => e.errors), K = i.useStore(
179
+ (e) => g.filterMap(
180
+ Object.entries(e.fieldMeta),
181
+ ([r, t]) => (t.errors ?? []).length && f.get(r)?.id ? E.some({
182
+ label: f.get(r).label,
183
+ inputId: f.get(r).id,
184
+ errors: (t.errors ?? []).map((s) => s.message).filter(Boolean)
185
+ }) : E.none()
186
+ )
187
+ );
188
+ N(
189
+ () => [i.filterItems, y.value],
190
+ () => {
191
+ const e = i.filterItems, r = y.value;
192
+ return e ? r ? (Object.values(r).filter(
193
+ (s) => !!s
194
+ ).flatMap(
195
+ (s) => Object.values(s).flat().map((n) => n.message)
196
+ ).some((s) => s === e.message) && e.items.forEach((s) => {
197
+ const n = i.getFieldMeta(s);
198
+ n && i.setFieldMeta(s, {
199
+ ...n,
200
+ errorMap: {
201
+ onSubmit: [
202
+ { path: [s], message: e.message }
203
+ ]
204
+ }
205
+ });
206
+ }), {}) : {} : {};
207
+ }
208
+ );
209
+ const L = { generalErrors: y, errors: K };
210
+ return o?.ignorePreventCloseEvents || Y(() => i.useStore((e) => e.isDirty)), Object.assign(i, {
211
+ errorContext: L,
212
+ Form: h(i)(se),
213
+ Input: h(i)(o?.input ?? te),
214
+ Field: u.Field,
215
+ Errors: oe(L)(ee),
216
+ Array: h(i)(Z),
217
+ AutoGen: h(i)(C)
218
+ });
219
+ };
27
220
  export {
28
- d as OmegaErrorsKey,
29
- b as buildOmegaErrors,
30
- g as useOmegaErrors
221
+ ne as FormErrors,
222
+ ye as useOmegaForm
31
223
  };