@effect-app/vue-components 2.7.0 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,12 +12,23 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends R
12
12
  expose: (exposed: {}) => void;
13
13
  attrs: any;
14
14
  slots: {
15
- [x: string]: ((props: any) => any) | undefined;
16
- [x: number]: ((props: any) => any) | undefined;
15
+ [x: string]: ((props: {
16
+ field: import("./InputProps").OmegaFieldInternalApi<From, any>;
17
+ state: NonNullable<import("@tanstack/vue-form").DeepValue<From, any>>;
18
+ }) => any) | undefined;
19
+ [x: number]: ((props: {
20
+ field: import("./InputProps").OmegaFieldInternalApi<From, any>;
21
+ state: NonNullable<import("@tanstack/vue-form").DeepValue<From, any>>;
22
+ }) => any) | undefined;
17
23
  } & {
18
- OmegaCustomInput?: (props: {}) => any;
24
+ OmegaCustomInput?: (props: {
25
+ field: import("@tanstack/vue-form").FieldApi<From, any, import("@tanstack/vue-form").DeepValue<From, any>, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, Record<string, any> | undefined>;
26
+ state: import("@tanstack/vue-form").FieldState<From, any, import("@tanstack/vue-form").DeepValue<From, any>, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FieldAsyncValidateOrFn<From, any, import("@tanstack/vue-form").DeepValue<From, any>> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>;
27
+ }) => any;
19
28
  } & {
20
29
  default?: (props: {}) => any;
30
+ } & {
31
+ OmegaCommon?: (props: {}) => any;
21
32
  };
22
33
  emit: {};
23
34
  }>) => import("vue").VNode & {
@@ -9,9 +9,9 @@ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends R
9
9
  expose: (exposed: {}) => void;
10
10
  attrs: any;
11
11
  slots: {
12
- [x: `${string}${any}`]: ((props: {
12
+ [x: string]: ((props: {
13
13
  field: OmegaFieldInternalApi<From, Name>;
14
- state: NonNullable<NonNullable<DeepValue<From, Name>>>;
14
+ state: NonNullable<DeepValue<From, Name>>;
15
15
  }) => any) | undefined;
16
16
  };
17
17
  emit: {};
@@ -1,59 +1,59 @@
1
- import { useForm as K } from "@tanstack/vue-form";
2
- import { Data as Z, S as p, Effect as v, Fiber as P, Option as O, Array as A } from "effect-app";
3
- import { runtimeFiberAsPromise as G } from "./vue-components.es16.js";
4
- import { isObject as Q } from "./vue-components.es17.js";
5
- import { computed as L, onUnmounted as W, onMounted as X, onBeforeUnmount as Y, watch as B, ref as C, h as H } from "vue";
6
- import ee from "./vue-components.es18.js";
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";
7
6
  import te from "./vue-components.es19.js";
8
7
  import re from "./vue-components.es20.js";
9
- import { generateMetaFromSchema as ne } from "./vue-components.es12.js";
10
- import se from "./vue-components.es6.js";
11
- import oe from "./vue-components.es8.js";
12
- import ie from "./vue-components.es21.js";
13
- import { trace as q } from "./vue-components.es22.js";
14
- import { context as U } from "./vue-components.es23.js";
15
- const k = (c) => {
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
16
  const a = c.ast;
17
17
  if (a._tag === "Union") {
18
- const o = a.types.map((f) => {
19
- const l = p.make(f);
20
- return k(l).ast;
18
+ const o = a.types.map((u) => {
19
+ const l = v.make(u);
20
+ return F(l).ast;
21
21
  }), m = {
22
22
  ...a,
23
23
  types: o
24
24
  };
25
- return p.make(m);
25
+ return v.make(m);
26
26
  }
27
27
  if (a._tag === "Transformation") {
28
- const o = p.make(a.from), m = p.make(a.to), f = k(o), l = k(m), d = {
28
+ const o = v.make(a.from), m = v.make(a.to), u = F(o), l = F(m), f = {
29
29
  ...a,
30
- from: f.ast,
30
+ from: u.ast,
31
31
  to: l.ast
32
32
  };
33
- return p.make(d);
33
+ return v.make(f);
34
34
  }
35
35
  if (a._tag === "TypeLiteral") {
36
- const o = a.propertySignatures.map((f) => {
37
- const l = f.type;
38
- let d = l;
36
+ const o = a.propertySignatures.map((u) => {
37
+ const l = u.type;
38
+ let f = l;
39
39
  if (l._tag === "TypeLiteral" || l._tag === "Union" || l._tag === "Transformation") {
40
- const w = p.make(l);
41
- d = k(w).ast;
40
+ const w = v.make(l);
41
+ f = F(w).ast;
42
42
  }
43
43
  return {
44
- ...f,
45
- type: d,
44
+ ...u,
45
+ type: f,
46
46
  isOptional: !0
47
47
  };
48
48
  }), m = {
49
49
  ...a,
50
50
  propertySignatures: o
51
51
  };
52
- return p.make(m);
52
+ return v.make(m);
53
53
  }
54
54
  return c;
55
55
  };
56
- class ae extends Z.TaggedError("FormErrors") {
56
+ class le extends G.TaggedError("FormErrors") {
57
57
  }
58
58
  const D = (c) => function(o) {
59
59
  return {
@@ -64,30 +64,30 @@ const D = (c) => function(o) {
64
64
  }, this.$slots);
65
65
  }
66
66
  };
67
- }, le = (c) => function(o) {
67
+ }, ce = (c) => function(o) {
68
68
  return {
69
69
  setup() {
70
- const { fieldMap: m, form: f } = c, l = f.useStore((S) => S.errors), d = f.useStore((S) => S.fieldMeta), w = f.useStore((S) => S.errorMap), E = L(() => {
71
- const S = A.filterMap(
72
- Object.entries(d.value),
73
- ([_, b]) => {
74
- const F = b.errors ?? [];
75
- if (!F.length) return O.none();
76
- const i = m.value.get(_);
77
- return i ? O.some({
70
+ const { fieldMap: 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({
78
78
  label: i.label,
79
79
  inputId: i.id,
80
80
  // Only show the first error
81
- errors: [F[0]?.message].filter(Boolean)
82
- }) : O.none();
81
+ errors: [k[0]?.message].filter(Boolean)
82
+ }) : U.none();
83
83
  }
84
84
  ), g = [];
85
85
  if (w.value.onSubmit) {
86
- for (const [_, b] of Object.entries(w.value.onSubmit))
87
- if (A.isArray(b) && b.length)
88
- for (const F of b) {
89
- const i = F;
90
- if (i?.path && A.isArray(i.path) && i.path.length) {
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) {
91
91
  const M = i.path.join(".");
92
92
  if (!m.value.has(M)) {
93
93
  g.push({
@@ -100,227 +100,233 @@ const D = (c) => function(o) {
100
100
  }
101
101
  }
102
102
  }
103
- return [...S, ...g];
103
+ return [...y, ...g];
104
104
  });
105
105
  return {
106
106
  generalErrors: l,
107
107
  errors: E
108
108
  };
109
109
  },
110
- render({ errors: m, generalErrors: f }) {
110
+ render({ errors: m, generalErrors: u }) {
111
111
  return H(o, {
112
112
  errors: m,
113
- generalErrors: f,
113
+ generalErrors: u,
114
114
  ...this.$attrs
115
115
  }, this.$slots);
116
116
  }
117
117
  };
118
118
  }, Fe = (c, a, o) => {
119
119
  if (!c) throw new Error("Schema is required");
120
- const m = p.standardSchemaV1(c), f = p.decode(c), { meta: l } = ne(c), d = L(() => {
120
+ const m = v.standardSchemaV1(c), u = v.decode(c), { meta: l } = se(c), f = T(() => {
121
121
  if (o?.persistency?.id)
122
122
  return o.persistency.id;
123
123
  const e = window.location.pathname, t = Object.keys(l);
124
124
  return `${e}-${t.join("-")}`;
125
125
  }), w = () => {
126
126
  const e = new URLSearchParams(window.location.search);
127
- e.delete(d.value);
127
+ e.delete(f.value);
128
128
  const t = new URL(window.location.href);
129
129
  t.search = e.toString(), window.history.replaceState({}, "", t.toString());
130
130
  };
131
131
  function E(e, t) {
132
- for (const r in t)
133
- t[r] && Q(t[r]) ? (e[r] || (e[r] = {}), E(e[r], t[r])) : e[r] = t[r];
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];
134
134
  return e;
135
135
  }
136
- const S = (e) => {
136
+ const y = (e) => {
137
137
  if (!e) return;
138
138
  const t = { ...e };
139
- for (const r in l) {
140
- const s = l[r], n = t[r], y = (n == null || n === !1 || n === "" || Number.isNaN(n)) && n !== !1 && n !== 0;
141
- s && !s.required && s.nullableOrUndefined && s.type !== "boolean" && (n === void 0 || y) && (t[r] = s.nullableOrUndefined === "undefined" ? void 0 : null);
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);
142
142
  }
143
143
  return t;
144
144
  }, g = (e) => {
145
145
  const t = {};
146
- if (e?.members && A.isArray(e.members)) {
147
- for (const r of e.members) {
148
- const s = g(r);
149
- if (Object.keys(s).length > 0 && r?.fields && Object.entries(r.fields).some(
150
- ([u, y]) => u === "_tag" || u === "type" || u === "kind" ? y?.ast?.defaultValue !== void 0 : !1
146
+ if (typeof e?.make == "function")
147
+ try {
148
+ return e.make({});
149
+ } catch {
150
+ }
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
151
157
  ))
152
- return s;
158
+ return r;
153
159
  }
154
160
  return {};
155
161
  }
156
162
  if (e?.fields && typeof e.fields == "object")
157
- for (const [r, s] of Object.entries(e.fields)) {
158
- if (s?.ast?.defaultValue)
163
+ for (const [s, r] of Object.entries(e.fields)) {
164
+ if (r?.ast?.defaultValue)
159
165
  try {
160
- const u = s.ast.defaultValue();
161
- u !== void 0 && (t[r] = u);
166
+ const p = r.ast.defaultValue();
167
+ p !== void 0 && (t[s] = p);
162
168
  } catch {
163
169
  }
164
- const n = g(s);
165
- Object.keys(n).length > 0 && (t[r] && typeof t[r] == "object" ? Object.assign(t[r], n) : t[r] || (t[r] = n));
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));
166
172
  }
167
173
  return t;
168
- }, _ = (e = {}) => {
174
+ }, A = (e = {}) => {
169
175
  let t = {};
170
176
  try {
171
- const r = c.make(e);
172
- t = p.encodeSync(k(c))(r);
173
- } catch (r) {
174
- window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:", r);
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);
175
181
  try {
176
182
  const s = g(c);
177
- t = p.encodeSync(k(c))(s);
183
+ t = v.encodeSync(F(c))(s);
178
184
  } catch (s) {
179
185
  window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", s);
180
186
  }
181
187
  }
182
188
  return E(t, e);
183
- }, b = L(() => {
184
- const e = _(
185
- S(
189
+ }, h = T(() => {
190
+ const e = A(
191
+ y(
186
192
  a?.defaultValues
187
193
  )
188
194
  );
189
195
  if (e && !o?.persistency?.overrideDefaultValues)
190
196
  return e;
191
197
  let t;
192
- const r = o?.persistency;
193
- if (!r?.policies || r.policies.length === 0) return {};
194
- if (r.policies.includes("querystring"))
198
+ const n = o?.persistency;
199
+ if (!n?.policies || n.policies.length === 0) return {};
200
+ if (n.policies.includes("querystring"))
195
201
  try {
196
- const n = new URLSearchParams(window.location.search).get(d.value);
197
- w(), n && (t = JSON.parse(n));
202
+ const r = new URLSearchParams(window.location.search).get(f.value);
203
+ w(), r && (t = JSON.parse(r));
198
204
  } catch (s) {
199
205
  console.error(s);
200
206
  }
201
207
  if (
202
208
  // query string has higher priority than local/session storage
203
- !t && (r.policies.includes("local") || r.policies.includes("session"))
209
+ !t && (n.policies.includes("local") || n.policies.includes("session"))
204
210
  ) {
205
- const s = r.policies.includes("local") ? localStorage : sessionStorage;
211
+ const s = n.policies.includes("local") ? localStorage : sessionStorage;
206
212
  if (s)
207
213
  try {
208
- const n = JSON.parse(
209
- s.getItem(d.value) || "{}"
214
+ const r = JSON.parse(
215
+ s.getItem(f.value) || "{}"
210
216
  );
211
- s.removeItem(d.value), t = n;
212
- } catch (n) {
213
- console.error(n);
217
+ s.removeItem(f.value), t = r;
218
+ } catch (r) {
219
+ console.error(r);
214
220
  }
215
221
  }
216
- return t ??= _({}), e ? E(e, t) : t;
217
- }), F = (e, t) => e ? U.with(q.setSpan(U.active(), e), t) : t(), i = K({
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({
218
224
  ...a,
219
225
  validators: {
220
226
  onSubmit: m,
221
227
  ...a?.validators || {}
222
228
  },
223
- onSubmit: a?.onSubmit ? ({ formApi: e, meta: t, value: r }) => F(t?.currentSpan, async () => {
224
- const s = await v.runPromise(f(r)), n = a.onSubmit({
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({
225
231
  formApi: e,
226
232
  meta: t,
227
233
  value: s
228
234
  });
229
- return P.isFiber(n) && P.isRuntimeFiber(n) ? await G(n) : v.isEffect(n) ? await v.runPromise(
230
- n.pipe(
235
+ return O.isFiber(r) && O.isRuntimeFiber(r) ? await Q(r) : S.isEffect(r) ? await S.runPromise(
236
+ r.pipe(
231
237
  // meta?.currentSpan
232
238
  // ? Effect.withParentSpan(meta.currentSpan)
233
239
  // : (_) => _,
234
- v.flatMap((u) => P.join(u))
240
+ S.flatMap((d) => O.join(d))
235
241
  )
236
- ) : n;
242
+ ) : r;
237
243
  }) : void 0,
238
- defaultValues: b.value
244
+ defaultValues: h.value
239
245
  }), M = () => {
240
246
  Object.keys(l).forEach((e) => {
241
247
  i.setFieldValue(e, void 0);
242
248
  });
243
- }, T = (e) => e.reduce((t, r) => {
244
- const s = r.split(".");
245
- return s.reduce((n, u, y) => (y === s.length - 1 ? n[u] = i.getFieldValue(r) : n[u] = n[u] ?? {}, n[u]), t), t;
246
- }, {}), V = (e) => {
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) => {
247
253
  if (e) {
248
- if (A.isArray(e.keys))
249
- return T(e.keys);
250
- if (A.isArray(e.banKeys)) {
251
- const t = Object.keys(l).filter((r) => e.banKeys?.includes(r));
252
- return T(t);
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
259
  }
254
260
  return i.store.state.values;
255
261
  }
256
- }, j = () => {
262
+ }, x = () => {
257
263
  const e = o?.persistency;
258
264
  if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
259
265
  const t = e.policies.includes("local") ? localStorage : sessionStorage;
260
266
  if (!t) return;
261
- const r = V(e);
262
- return t.setItem(d.value, JSON.stringify(r));
267
+ const n = j(e);
268
+ return t.setItem(f.value, JSON.stringify(n));
263
269
  }
264
270
  }, N = () => {
265
271
  const e = o?.persistency;
266
272
  if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
267
- const t = V(e), r = new URLSearchParams(window.location.search);
268
- r.set(d.value, JSON.stringify(t));
273
+ const t = j(e), n = new URLSearchParams(window.location.search);
274
+ n.set(f.value, JSON.stringify(t));
269
275
  const s = new URL(window.location.href);
270
- s.search = r.toString(), window.history.replaceState({}, "", s.toString());
276
+ s.search = n.toString(), window.history.replaceState({}, "", s.toString());
271
277
  }
272
278
  }, I = (e) => {
273
279
  i.store.state.isDirty && e.preventDefault();
274
280
  };
275
- if (W(j), X(() => {
276
- window.addEventListener("beforeunload", j), window.addEventListener("blur", N), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.addEventListener("beforeunload", I);
277
- }), Y(() => {
278
- window.removeEventListener("beforeunload", j), window.removeEventListener("blur", N), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", I);
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);
279
285
  }), o?.preventWindowExit === "prevent-and-reset") {
280
- const e = i.useStore((n) => n.isSubmitting), t = i.useStore((n) => n.submissionAttempts), r = i.useStore((n) => n.canSubmit), s = i.useStore((n) => n.values);
281
- B([e, t], ([n, u], [y]) => {
282
- y && !n && u > 0 && r.value && i.reset(s.value);
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);
283
289
  });
284
290
  }
285
- const $ = (e) => v.currentSpan.pipe(
286
- v.option,
287
- v.flatMap(
288
- (t) => v.promise(() => i.handleSubmit(O.isSome(t) ? { currentSpan: t.value, ...e } : e))
291
+ const $ = (e) => S.currentSpan.pipe(
292
+ S.option,
293
+ S.flatMap(
294
+ (t) => S.promise(() => i.handleSubmit(U.isSome(t) ? { currentSpan: t.value, ...e } : e))
289
295
  )
290
- ), J = (e) => e?.checkErrors ? $(e?.meta).pipe(v.flatMap(v.fnUntraced(function* () {
296
+ ), J = (e) => e?.checkErrors ? $(e?.meta).pipe(S.flatMap(S.fnUntraced(function* () {
291
297
  const t = i.getAllErrors();
292
298
  if (Object.keys(t.fields).length || t.form.errors.length)
293
- return yield* new ae({ form: t.form, fields: t.fields });
294
- }))) : $(e?.meta), z = i.handleSubmit, x = C(/* @__PURE__ */ new Map()), h = Object.assign(i, {
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, {
295
301
  i18nNamespace: o?.i18nNamespace,
296
302
  ignorePreventCloseEvents: o?.ignorePreventCloseEvents,
297
303
  meta: l,
298
304
  clear: M,
299
305
  handleSubmit: (e) => {
300
- const t = q.getSpan(U.active());
306
+ const t = q.getSpan(L.active());
301
307
  return z({ currentSpan: t, ...e });
302
308
  },
303
309
  // /** @experimental */
304
310
  handleSubmitEffect: J,
305
311
  registerField: (e) => {
306
- B(e, (t) => x.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), W(() => x.value.delete(e.value.name));
312
+ B(e, (t) => P.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), W(() => P.value.delete(e.value.name));
307
313
  }
308
- }), R = { form: h, fieldMap: x };
309
- return Object.assign(h, {
314
+ }), R = { form: b, fieldMap: P };
315
+ return Object.assign(b, {
310
316
  // Type-level properties for performance optimization (not used at runtime)
311
317
  _paths: void 0,
312
318
  _keys: void 0,
313
319
  errorContext: R,
314
- Form: D(h)(ie),
315
- Input: D(h)(o?.input ?? se),
316
- TaggedUnion: D(h)(oe),
320
+ Form: D(b)(ae),
321
+ Input: D(b)(o?.input ?? oe),
322
+ TaggedUnion: D(b)(ie),
317
323
  Field: i.Field,
318
- Errors: le(R)(re),
319
- Array: D(h)(ee),
320
- AutoGen: D(h)(te)
324
+ Errors: ce(R)(ne),
325
+ Array: D(b)(te),
326
+ AutoGen: D(b)(re)
321
327
  });
322
328
  };
323
329
  export {
324
- ae as FormErrors,
330
+ le as FormErrors,
325
331
  Fe as useOmegaForm
326
332
  };
@@ -1,6 +1,6 @@
1
- import l from "./vue-components.es28.js";
1
+ import l from "./vue-components.es29.js";
2
2
  import { inject as c, provide as u } from "vue";
3
- import { onMountedWithCleanup as f } from "./vue-components.es29.js";
3
+ import { onMountedWithCleanup as f } from "./vue-components.es16.js";
4
4
  const p = () => l(), i = Symbol("DialogBus"), r = () => c(i, null), g = () => {
5
5
  const n = p();
6
6
  return u(i, n), n;
@@ -1,12 +1,13 @@
1
- import { Exit as c, Runtime as u } from "effect";
2
- import { dual as n, isFunction as m } from "./vue-components.es30.js";
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
- n(2, (e, t) => a(e, { ...e, ...m(t) ? t(e) : t }));
5
- const p = (e, t) => new Promise((o, s) => e.addObserver((r) => {
6
- c.isSuccess(r) ? o(r.value) : s(u.makeFiberFailure(r.cause));
7
- }));
1
+ import { onMounted as e, onUnmounted as u } from "vue";
2
+ function p(t) {
3
+ let n;
4
+ e(() => {
5
+ const o = t();
6
+ o && (n = o);
7
+ }), u(() => {
8
+ n && n();
9
+ });
10
+ }
8
11
  export {
9
- a as clone,
10
- i as cloneTrait,
11
- p as runtimeFiberAsPromise
12
+ p as onMountedWithCleanup
12
13
  };
@@ -1,7 +1,12 @@
1
- import { isFunction as c } from "./vue-components.es30.js";
2
- const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
1
+ import { Exit as c, Runtime as u } from "effect";
2
+ import { dual as n, isFunction as m } from "./vue-components.es30.js";
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
+ n(2, (e, t) => a(e, { ...e, ...m(t) ? t(e) : t }));
5
+ const p = (e, t) => new Promise((o, s) => e.addObserver((r) => {
6
+ c.isSuccess(r) ? o(r.value) : s(u.makeFiberFailure(r.cause));
7
+ }));
3
8
  export {
4
- s as isFunction,
5
- i as isObject,
6
- t as isRecordOrArray
9
+ a as clone,
10
+ i as cloneTrait,
11
+ p as runtimeFiberAsPromise
7
12
  };
@@ -1,57 +1,7 @@
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
- const N = /* @__PURE__ */ F({
3
- inheritAttrs: !1,
4
- __name: "OmegaArray",
5
- props: {
6
- form: {},
7
- inputClass: {},
8
- name: {},
9
- defaultItems: {},
10
- items: {}
11
- },
12
- setup(n) {
13
- const a = n, y = a.form.useStore((e) => e.values), i = f(() => {
14
- const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
15
- try {
16
- return e.split(".").reduce((r, t) => r && r[t], y.value);
17
- } catch (r) {
18
- return console.error(r), [];
19
- }
20
- });
21
- M(async () => {
22
- a.defaultItems && !i.value && a.form.setFieldValue(a.name, a.defaultItems);
23
- });
24
- const $ = f(() => (r) => {
25
- const t = r.replace(/\[\d+\]/g, "");
26
- return a.form.meta[t];
27
- });
28
- return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
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), {
32
- key: `${n.name}[${Number(m)}]`,
33
- name: (
34
- // eslint-disable-next-line
35
- `${n.name}[${Number(m)}]`
36
- )
37
- }, {
38
- default: g(({ field: v, state: h }) => [
39
- o(e.$slots, "default", b({ ref_for: !0 }, {
40
- subField: v,
41
- subState: h,
42
- index: Number(m),
43
- field: t
44
- }))
45
- ]),
46
- _: 2
47
- }, 1032, ["name"]))), 128)),
48
- o(e.$slots, "post-array", l(u({ field: t, state: d }))),
49
- o(e.$slots, "field", l(u({ field: t })))
50
- ]),
51
- _: 3
52
- }, 8, ["name"]));
53
- }
54
- });
1
+ import { isFunction as c } from "./vue-components.es30.js";
2
+ const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
55
3
  export {
56
- N as default
4
+ s as isFunction,
5
+ i as isObject,
6
+ t as isRecordOrArray
57
7
  };
@@ -1,70 +1,57 @@
1
- import { defineComponent as O, computed as j, createElementBlock as M, openBlock as _, Fragment as E, renderList as A, renderSlot as F, createVNode as g, unref as h, mergeProps as k } from "vue";
2
- import { Order as l, pipe as v, Array as u } from "effect-app";
3
- const I = /* @__PURE__ */ O({
4
- __name: "OmegaAutoGen",
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
+ const N = /* @__PURE__ */ F({
3
+ inheritAttrs: !1,
4
+ __name: "OmegaArray",
5
5
  props: {
6
6
  form: {},
7
- pick: {},
8
- omit: {},
9
- labelMap: { type: Function },
10
- filterMap: { type: Function },
11
- order: {},
12
- sort: {}
7
+ inputClass: {},
8
+ name: {},
9
+ defaultItems: {},
10
+ items: {}
13
11
  },
14
- setup(i) {
15
- const p = (e) => (r) => Object.fromEntries(
16
- Object.entries(r).map(([t, o]) => [t, e(o, t)])
17
- ), a = (e) => (r) => Object.fromEntries(
18
- Object.entries(r).filter(([t, o]) => e(o, t))
19
- ), m = (e) => (r) => Object.entries(r).reduce(
20
- (t, [o, c]) => {
21
- const s = e(c, o);
22
- return s !== !1 && (t[o] = s), t;
23
- },
24
- {}
25
- ), n = i, f = (e, r) => {
26
- const t = r?.indexOf(e) ?? -1;
27
- return t === -1 ? Number.MAX_SAFE_INTEGER : t;
28
- }, d = l.mapInput(
29
- l.number,
30
- (e) => f(e.name, n.order || [])
31
- ), b = j(
32
- () => v(
33
- n.form.meta,
34
- // include / exclude
35
- a(
36
- (e, r) => n.pick ? n.pick.includes(r) && !n.omit?.includes(r) : !n.omit?.includes(r)
37
- ),
38
- (e) => e,
39
- // labelMap and adding name
40
- p((e, r) => ({
41
- name: r,
42
- label: n.labelMap?.(r) || r,
43
- ...e
44
- })),
45
- // filterMap
46
- n.filterMap ? m((e) => {
47
- const r = n.filterMap?.(e.name, e);
48
- return r === void 0 || r === !0 ? e : r;
49
- }) : (e) => e,
50
- // transform to array
51
- (e) => Object.values(e),
52
- // order
53
- u.sort(d),
54
- // sort
55
- n.sort ? u.sort(n.sort) : (e) => e
56
- )
57
- );
58
- return (e, r) => (_(!0), M(E, null, A(b.value, ({ name: t, label: o, ...c }) => F(e.$slots, "default", {
59
- child: { name: t, label: o, ...c }
60
- }, () => [
61
- g(h(i.form).Input, k({
62
- name: t,
63
- label: o
64
- }, { ref_for: !0 }, c), null, 16, ["name", "label"])
65
- ])), 256));
12
+ setup(n) {
13
+ const a = n, y = a.form.useStore((e) => e.values), i = f(() => {
14
+ const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
15
+ try {
16
+ return e.split(".").reduce((r, t) => r && r[t], y.value);
17
+ } catch (r) {
18
+ return console.error(r), [];
19
+ }
20
+ });
21
+ M(async () => {
22
+ a.defaultItems && !i.value && a.form.setFieldValue(a.name, a.defaultItems);
23
+ });
24
+ const $ = f(() => (r) => {
25
+ const t = r.replace(/\[\d+\]/g, "");
26
+ return a.form.meta[t];
27
+ });
28
+ return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
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), {
32
+ key: `${n.name}[${Number(m)}]`,
33
+ name: (
34
+ // eslint-disable-next-line
35
+ `${n.name}[${Number(m)}]`
36
+ )
37
+ }, {
38
+ default: g(({ field: v, state: h }) => [
39
+ o(e.$slots, "default", b({ ref_for: !0 }, {
40
+ subField: v,
41
+ subState: h,
42
+ index: Number(m),
43
+ field: t
44
+ }))
45
+ ]),
46
+ _: 2
47
+ }, 1032, ["name"]))), 128)),
48
+ o(e.$slots, "post-array", l(u({ field: t, state: d }))),
49
+ o(e.$slots, "field", l(u({ field: t })))
50
+ ]),
51
+ _: 3
52
+ }, 8, ["name"]));
66
53
  }
67
54
  });
68
55
  export {
69
- I as default
56
+ N as default
70
57
  };
@@ -1,8 +1,70 @@
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";
3
-
4
- import o from "./vue-components.es35.js";
5
- const e = /* @__PURE__ */ o(r, [["__scopeId", "data-v-d4ffe76f"]]);
1
+ import { defineComponent as O, computed as j, createElementBlock as M, openBlock as _, Fragment as E, renderList as A, renderSlot as F, createVNode as g, unref as h, mergeProps as k } from "vue";
2
+ import { Order as l, pipe as v, Array as u } from "effect-app";
3
+ const I = /* @__PURE__ */ O({
4
+ __name: "OmegaAutoGen",
5
+ props: {
6
+ form: {},
7
+ pick: {},
8
+ omit: {},
9
+ labelMap: { type: Function },
10
+ filterMap: { type: Function },
11
+ order: {},
12
+ sort: {}
13
+ },
14
+ setup(i) {
15
+ const p = (e) => (r) => Object.fromEntries(
16
+ Object.entries(r).map(([t, o]) => [t, e(o, t)])
17
+ ), a = (e) => (r) => Object.fromEntries(
18
+ Object.entries(r).filter(([t, o]) => e(o, t))
19
+ ), m = (e) => (r) => Object.entries(r).reduce(
20
+ (t, [o, c]) => {
21
+ const s = e(c, o);
22
+ return s !== !1 && (t[o] = s), t;
23
+ },
24
+ {}
25
+ ), n = i, f = (e, r) => {
26
+ const t = r?.indexOf(e) ?? -1;
27
+ return t === -1 ? Number.MAX_SAFE_INTEGER : t;
28
+ }, d = l.mapInput(
29
+ l.number,
30
+ (e) => f(e.name, n.order || [])
31
+ ), b = j(
32
+ () => v(
33
+ n.form.meta,
34
+ // include / exclude
35
+ a(
36
+ (e, r) => n.pick ? n.pick.includes(r) && !n.omit?.includes(r) : !n.omit?.includes(r)
37
+ ),
38
+ (e) => e,
39
+ // labelMap and adding name
40
+ p((e, r) => ({
41
+ name: r,
42
+ label: n.labelMap?.(r) || r,
43
+ ...e
44
+ })),
45
+ // filterMap
46
+ n.filterMap ? m((e) => {
47
+ const r = n.filterMap?.(e.name, e);
48
+ return r === void 0 || r === !0 ? e : r;
49
+ }) : (e) => e,
50
+ // transform to array
51
+ (e) => Object.values(e),
52
+ // order
53
+ u.sort(d),
54
+ // sort
55
+ n.sort ? u.sort(n.sort) : (e) => e
56
+ )
57
+ );
58
+ return (e, r) => (_(!0), M(E, null, A(b.value, ({ name: t, label: o, ...c }) => F(e.$slots, "default", {
59
+ child: { name: t, label: o, ...c }
60
+ }, () => [
61
+ g(h(i.form).Input, k({
62
+ name: t,
63
+ label: o
64
+ }, { ref_for: !0 }, c), null, 16, ["name", "label"])
65
+ ])), 256));
66
+ }
67
+ });
6
68
  export {
7
- e as default
69
+ I as default
8
70
  };
@@ -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-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";
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";
3
3
 
4
- import m from "./vue-components.es35.js";
5
- const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
4
+ import o from "./vue-components.es35.js";
5
+ const e = /* @__PURE__ */ o(r, [["__scopeId", "data-v-d4ffe76f"]]);
6
6
  export {
7
7
  e as default
8
8
  };
@@ -1,5 +1,8 @@
1
- import { TraceAPI as r } from "./vue-components.es52.js";
2
- var t = r.getInstance();
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";
3
+
4
+ import m from "./vue-components.es35.js";
5
+ const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
3
6
  export {
4
- t as trace
7
+ e as default
5
8
  };
@@ -1,5 +1,5 @@
1
- import { ContextAPI as t } from "./vue-components.es51.js";
2
- var o = t.getInstance();
1
+ import { TraceAPI as r } from "./vue-components.es52.js";
2
+ var t = r.getInstance();
3
3
  export {
4
- o as context
4
+ t as trace
5
5
  };
@@ -1,4 +1,5 @@
1
- import f from "./vue-components.es6.js";
1
+ import { ContextAPI as t } from "./vue-components.es51.js";
2
+ var o = t.getInstance();
2
3
  export {
3
- f as default
4
+ o as context
4
5
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es7.js";
1
+ import f from "./vue-components.es6.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es8.js";
1
+ import f from "./vue-components.es7.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es9.js";
1
+ import f from "./vue-components.es8.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,19 +1,4 @@
1
- function c(t) {
2
- return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, f) {
3
- var i = t.get(e);
4
- i ? i.push(f) : t.set(e, [f]);
5
- }, off: function(e, f) {
6
- var i = t.get(e);
7
- i && (f ? i.splice(i.indexOf(f) >>> 0, 1) : t.set(e, []));
8
- }, emit: function(e, f) {
9
- var i = t.get(e);
10
- i && i.slice().map(function(a) {
11
- a(f);
12
- }), (i = t.get("*")) && i.slice().map(function(a) {
13
- a(e, f);
14
- });
15
- } };
16
- }
1
+ import f from "./vue-components.es9.js";
17
2
  export {
18
- c as default
3
+ f as default
19
4
  };
@@ -1,13 +1,19 @@
1
- import { onMounted as e, onUnmounted as u } from "vue";
2
- function p(t) {
3
- let n;
4
- e(() => {
5
- const o = t();
6
- o && (n = o);
7
- }), u(() => {
8
- n && n();
9
- });
1
+ function c(t) {
2
+ return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, f) {
3
+ var i = t.get(e);
4
+ i ? i.push(f) : t.set(e, [f]);
5
+ }, off: function(e, f) {
6
+ var i = t.get(e);
7
+ i && (f ? i.splice(i.indexOf(f) >>> 0, 1) : t.set(e, []));
8
+ }, emit: function(e, f) {
9
+ var i = t.get(e);
10
+ i && i.slice().map(function(a) {
11
+ a(f);
12
+ }), (i = t.get("*")) && i.slice().map(function(a) {
13
+ a(e, f);
14
+ });
15
+ } };
10
16
  }
11
17
  export {
12
- p as onMountedWithCleanup
18
+ c as default
13
19
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es18.js";
1
+ import f from "./vue-components.es19.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es19.js";
1
+ import f from "./vue-components.es20.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as v, mergeModels as C, useModel as k, useSlots as V, computed as _, resolveComponent as g, createBlock as y, openBlock as B, unref as a, createSlots as E, withCtx as u, renderSlot as d, renderList as M, normalizeProps as S, guardReactiveProps as w } from "vue";
2
2
  import { useOnClose as L } from "./vue-components.es11.js";
3
- import { onMountedWithCleanup as h } from "./vue-components.es29.js";
3
+ import { onMountedWithCleanup as h } from "./vue-components.es16.js";
4
4
  const z = /* @__PURE__ */ v({
5
5
  __name: "Dialog",
6
6
  props: /* @__PURE__ */ C({
@@ -1,6 +1,6 @@
1
- import { defineComponent as s, createElementBlock as f, openBlock as d, Fragment as c, renderSlot as n, createVNode as a, unref as o, withCtx as r, createCommentVNode as g, createSlots as $, renderList as y, normalizeProps as b, guardReactiveProps as p } from "vue";
1
+ import { defineComponent as d, createBlock as u, openBlock as g, unref as l, withCtx as o, renderSlot as n, createVNode as r, createCommentVNode as c, normalizeProps as s, guardReactiveProps as f, createSlots as $, renderList as y } from "vue";
2
2
  import C from "./vue-components.es9.js";
3
- const F = /* @__PURE__ */ s({
3
+ const h = /* @__PURE__ */ d({
4
4
  __name: "OmegaTaggedUnion",
5
5
  props: {
6
6
  name: {},
@@ -10,38 +10,37 @@ const F = /* @__PURE__ */ s({
10
10
  label: {}
11
11
  },
12
12
  setup(e) {
13
- return (t, k) => (d(), f(c, null, [
14
- n(t.$slots, "OmegaCustomInput", {}, () => [
15
- a(o(e.form).Input, {
16
- name: e.name ? `${e.name}._tag` : "_tag",
17
- label: e.label,
18
- type: e.type ?? "select",
19
- options: e.options
20
- }, null, 8, ["name", "label", "type", "options"])
21
- ]),
22
- a(o(e.form).Field, {
23
- name: e.name ?? ""
24
- }, {
25
- default: r(({ field: u, state: m }) => [
26
- m.value ? n(t.$slots, "default", { key: 0 }) : g("", !0),
27
- a(C, {
28
- field: u,
29
- state: m.value,
30
- name: e.name
31
- }, $({ _: 2 }, [
32
- y(t.$slots, (v, l) => ({
33
- name: l,
34
- fn: r((i) => [
35
- n(t.$slots, l, b(p(i)))
36
- ])
37
- }))
38
- ]), 1032, ["field", "state", "name"])
13
+ return (a, b) => (g(), u(l(e.form).Field, {
14
+ name: e.name ? `${e.name}._tag` : "_tag"
15
+ }, {
16
+ default: o((t) => [
17
+ n(a.$slots, "OmegaCustomInput", s(f(t)), () => [
18
+ r(l(e.form).Input, {
19
+ name: e.name ? `${e.name}._tag` : "_tag",
20
+ label: e.label,
21
+ type: e.type ?? "select",
22
+ options: e.options
23
+ }, null, 8, ["name", "label", "type", "options"])
39
24
  ]),
40
- _: 3
41
- }, 8, ["name"])
42
- ], 64));
25
+ n(a.$slots, "default"),
26
+ r(C, {
27
+ field: t.field,
28
+ state: t.state.value,
29
+ name: e.name
30
+ }, $({ _: 2 }, [
31
+ y(a.$slots, (k, m) => ({
32
+ name: m,
33
+ fn: o((i) => [
34
+ n(a.$slots, m, s(f(i)))
35
+ ])
36
+ }))
37
+ ]), 1032, ["field", "state", "name"]),
38
+ t.state.value ? n(a.$slots, "OmegaCommon", { key: 0 }) : c("", !0)
39
+ ]),
40
+ _: 3
41
+ }, 8, ["name"]));
43
42
  }
44
43
  });
45
44
  export {
46
- F as default
45
+ h as default
47
46
  };
@@ -8,11 +8,11 @@ const f = /* @__PURE__ */ l({
8
8
  },
9
9
  setup(e) {
10
10
  const a = e;
11
- return i(() => a.state?._tag, (t, n) => {
11
+ return i(() => a.state, (t, n) => {
12
12
  t === null && a.field.setValue(null), t !== n && setTimeout(() => {
13
13
  a.field.validate("change");
14
14
  }, 0);
15
- }), (t, n) => e.state?._tag ? m(t.$slots, `${e.name ? `${e.name}.` : ""}${e.state?._tag}`, o(r({ key: 0 }, { field: e.field, state: e.state }))) : s("", !0);
15
+ }), (t, n) => e.state ? m(t.$slots, `${e.name ? `${e.name}.` : ""}${e.state}`, o(r({ key: 0 }, { field: e.field, state: e.state }))) : s("", !0);
16
16
  }
17
17
  });
18
18
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "effect": "^3.18.0",
@@ -23,20 +23,23 @@ defineProps<{
23
23
  </script>
24
24
 
25
25
  <template>
26
- <slot name="OmegaCustomInput">
27
- <form.Input
28
- :name="(name ? `${name}._tag` : '_tag') as FieldPath<From>"
29
- :label="label"
30
- :type="type ?? 'select'"
31
- :options="options"
32
- />
33
- </slot>
34
- <form.Field :name="(name ?? '') as any">
35
- <template #default="{ field, state }">
36
- <slot v-if="state.value" />
26
+ <form.Field :name="(name ? `${name}._tag` : '_tag') as any">
27
+ <template #default="inputProps">
28
+ <slot
29
+ name="OmegaCustomInput"
30
+ v-bind="inputProps"
31
+ >
32
+ <form.Input
33
+ :name="(name ? `${name}._tag` : '_tag') as FieldPath<From>"
34
+ :label="label"
35
+ :type="type ?? 'select'"
36
+ :options="options"
37
+ />
38
+ </slot>
39
+ <slot />
37
40
  <OmegaTaggedUnionInternal
38
- :field="field as any"
39
- :state="state.value"
41
+ :field="inputProps.field as any"
42
+ :state="inputProps.state.value"
40
43
  :name="name"
41
44
  >
42
45
  <template
@@ -49,6 +52,10 @@ defineProps<{
49
52
  />
50
53
  </template>
51
54
  </OmegaTaggedUnionInternal>
55
+ <slot
56
+ v-if="inputProps.state.value"
57
+ name="OmegaCommon"
58
+ />
52
59
  </template>
53
60
  </form.Field>
54
61
  </template>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <slot
3
- v-if="state?._tag"
4
- :name="`${name ? `${name}.` : ''}${state?._tag}`"
3
+ v-if="state"
4
+ :name="`${name ? `${name}.` : ''}${state}`"
5
5
  v-bind="{ field, state }"
6
6
  />
7
7
  </template>
@@ -26,7 +26,7 @@ const props = defineProps<{
26
26
  }>()
27
27
 
28
28
  // Watch for _tag changes
29
- watch(() => props.state?._tag, (newTag, oldTag) => {
29
+ watch(() => props.state, (newTag, oldTag) => {
30
30
  if (newTag === null) {
31
31
  props.field.setValue(null as DeepValue<From, Name>)
32
32
  }
@@ -791,11 +791,27 @@ export const useOmegaForm = <
791
791
  const extractDefaultsFromAST = (schemaObj: any): any => {
792
792
  const result: Record<string, any> = {}
793
793
 
794
- // Check if this schema is a union
795
- if (schemaObj?.members && Array.isArray(schemaObj.members)) {
794
+ // If this schema has a .make() method (like ExtendedClass), use it to get complete defaults
795
+ // This is more reliable than manually extracting fields, especially for classes
796
+ if (typeof schemaObj?.make === "function") {
797
+ try {
798
+ const instance = schemaObj.make({})
799
+ // For ExtendedClass, the instance is already in the correct encoded format
800
+ return instance
801
+ } catch {
802
+ // If make() fails, fall through to manual extraction
803
+ }
804
+ }
805
+
806
+ // Check if this schema is a union - check both direct property and AST
807
+ const unionMembers = schemaObj?.members
808
+ || (schemaObj?.ast?._tag === "Union" && schemaObj.ast.types
809
+ ? schemaObj.ast.types.map((t: any) => S.make(t))
810
+ : null)
811
+ if (unionMembers && Array.isArray(unionMembers)) {
796
812
  // For unions, we try to find the first member that has a complete set of defaults
797
813
  // Priority is given to members with default values for discriminator fields
798
- for (const member of schemaObj.members) {
814
+ for (const member of unionMembers as any[]) {
799
815
  const memberDefaults = extractDefaultsFromAST(member)
800
816
  if (Object.keys(memberDefaults).length > 0) {
801
817
  // Check if this member has a default value for a discriminator field (like _tag)