@effect-app/vue-components 2.7.1 → 2.7.2

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,96 +1,96 @@
1
- import { useForm as Z } from "@tanstack/vue-form";
2
- import { Data as G, S as v, Effect as S, Fiber as O, Option as U, Array as _ } from "effect-app";
3
- import { runtimeFiberAsPromise as Q } from "./vue-components.es17.js";
4
- import { isObject as X } from "./vue-components.es18.js";
5
- import { computed as T, onUnmounted as W, onMounted as Y, onBeforeUnmount as C, watch as B, ref as ee, h as H } from "vue";
6
- import te from "./vue-components.es19.js";
7
- import re from "./vue-components.es20.js";
8
- import ne from "./vue-components.es21.js";
9
- import { generateMetaFromSchema as se } from "./vue-components.es12.js";
10
- import oe from "./vue-components.es6.js";
11
- import ie from "./vue-components.es8.js";
12
- import ae from "./vue-components.es22.js";
13
- import { trace as q } from "./vue-components.es23.js";
14
- import { context as L } from "./vue-components.es24.js";
15
- const F = (c) => {
16
- const a = c.ast;
17
- if (a._tag === "Union") {
18
- const o = a.types.map((u) => {
19
- const l = v.make(u);
20
- return F(l).ast;
21
- }), m = {
22
- ...a,
1
+ import { useForm as Y } from "@tanstack/vue-form";
2
+ import { Data as C, S as v, Effect as S, Fiber as j, Option as V, Array as A } from "effect-app";
3
+ import { runtimeFiberAsPromise as ee } from "./vue-components.es16.js";
4
+ import { isObject as te } from "./vue-components.es17.js";
5
+ import { computed as I, onUnmounted as J, onMounted as re, onBeforeUnmount as ne, watch as K, ref as se, h as Z } from "vue";
6
+ import oe from "./vue-components.es18.js";
7
+ import ie from "./vue-components.es19.js";
8
+ import ae from "./vue-components.es20.js";
9
+ import { generateMetaFromSchema as le } from "./vue-components.es12.js";
10
+ import ce from "./vue-components.es6.js";
11
+ import ue from "./vue-components.es8.js";
12
+ import fe from "./vue-components.es21.js";
13
+ import { trace as z } from "./vue-components.es22.js";
14
+ import { context as T } from "./vue-components.es23.js";
15
+ const k = (f) => {
16
+ const c = f.ast;
17
+ if (c._tag === "Union") {
18
+ const o = c.types.map((d) => {
19
+ const u = v.make(d);
20
+ return k(u).ast;
21
+ }), p = {
22
+ ...c,
23
23
  types: o
24
24
  };
25
- return v.make(m);
25
+ return v.make(p);
26
26
  }
27
- if (a._tag === "Transformation") {
28
- const o = v.make(a.from), m = v.make(a.to), u = F(o), l = F(m), f = {
29
- ...a,
30
- from: u.ast,
31
- to: l.ast
27
+ if (c._tag === "Transformation") {
28
+ const o = v.make(c.from), p = v.make(c.to), d = k(o), u = k(p), m = {
29
+ ...c,
30
+ from: d.ast,
31
+ to: u.ast
32
32
  };
33
- return v.make(f);
33
+ return v.make(m);
34
34
  }
35
- if (a._tag === "TypeLiteral") {
36
- const o = a.propertySignatures.map((u) => {
37
- const l = u.type;
38
- let f = l;
39
- if (l._tag === "TypeLiteral" || l._tag === "Union" || l._tag === "Transformation") {
40
- const w = v.make(l);
41
- f = F(w).ast;
35
+ if (c._tag === "TypeLiteral") {
36
+ const o = c.propertySignatures.map((d) => {
37
+ const u = d.type;
38
+ let m = u;
39
+ if (u._tag === "TypeLiteral" || u._tag === "Union" || u._tag === "Transformation") {
40
+ const E = v.make(u);
41
+ m = k(E).ast;
42
42
  }
43
43
  return {
44
- ...u,
45
- type: f,
44
+ ...d,
45
+ type: m,
46
46
  isOptional: !0
47
47
  };
48
- }), m = {
49
- ...a,
48
+ }), p = {
49
+ ...c,
50
50
  propertySignatures: o
51
51
  };
52
- return v.make(m);
52
+ return v.make(p);
53
53
  }
54
- return c;
54
+ return f;
55
55
  };
56
- class le extends G.TaggedError("FormErrors") {
56
+ class de extends C.TaggedError("FormErrors") {
57
57
  }
58
- const D = (c) => function(o) {
58
+ const D = (f) => function(o) {
59
59
  return {
60
60
  render() {
61
- return H(o, {
62
- form: c,
61
+ return Z(o, {
62
+ form: f,
63
63
  ...this.$attrs
64
64
  }, this.$slots);
65
65
  }
66
66
  };
67
- }, ce = (c) => function(o) {
67
+ }, me = (f) => function(o) {
68
68
  return {
69
69
  setup() {
70
- const { fieldMap: m, form: u } = c, l = u.useStore((y) => y.errors), f = u.useStore((y) => y.fieldMeta), w = u.useStore((y) => y.errorMap), E = T(() => {
71
- const y = _.filterMap(
72
- Object.entries(f.value),
73
- ([A, h]) => {
74
- const k = h.errors ?? [];
75
- if (!k.length) return U.none();
76
- const i = m.value.get(A);
77
- return i ? U.some({
70
+ const { fieldMap: p, form: d } = f, u = d.useStore((y) => y.errors), m = d.useStore((y) => y.fieldMeta), E = d.useStore((y) => y.errorMap), b = I(() => {
71
+ const y = A.filterMap(
72
+ Object.entries(m.value),
73
+ ([U, h]) => {
74
+ const _ = h.errors ?? [];
75
+ if (!_.length) return V.none();
76
+ const i = p.value.get(U);
77
+ return i ? V.some({
78
78
  label: i.label,
79
79
  inputId: i.id,
80
80
  // Only show the first error
81
- errors: [k[0]?.message].filter(Boolean)
82
- }) : U.none();
81
+ errors: [_[0]?.message].filter(Boolean)
82
+ }) : V.none();
83
83
  }
84
- ), g = [];
85
- if (w.value.onSubmit) {
86
- for (const [A, h] of Object.entries(w.value.onSubmit))
87
- if (_.isArray(h) && h.length)
88
- for (const k of h) {
89
- const i = k;
90
- if (i?.path && _.isArray(i.path) && i.path.length) {
84
+ ), F = [];
85
+ if (E.value.onSubmit) {
86
+ for (const [U, h] of Object.entries(E.value.onSubmit))
87
+ if (A.isArray(h) && h.length)
88
+ for (const _ of h) {
89
+ const i = _;
90
+ if (i?.path && A.isArray(i.path) && i.path.length) {
91
91
  const M = i.path.join(".");
92
- if (!m.value.has(M)) {
93
- g.push({
92
+ if (!p.value.has(M)) {
93
+ F.push({
94
94
  label: M,
95
95
  inputId: M,
96
96
  errors: [i.message].filter(Boolean)
@@ -100,162 +100,161 @@ const D = (c) => function(o) {
100
100
  }
101
101
  }
102
102
  }
103
- return [...y, ...g];
103
+ return [...y, ...F];
104
104
  });
105
105
  return {
106
- generalErrors: l,
107
- errors: E
106
+ generalErrors: u,
107
+ errors: b
108
108
  };
109
109
  },
110
- render({ errors: m, generalErrors: u }) {
111
- return H(o, {
112
- errors: m,
113
- generalErrors: u,
110
+ render({ errors: p, generalErrors: d }) {
111
+ return Z(o, {
112
+ errors: p,
113
+ generalErrors: d,
114
114
  ...this.$attrs
115
115
  }, this.$slots);
116
116
  }
117
117
  };
118
- }, Fe = (c, a, o) => {
119
- if (!c) throw new Error("Schema is required");
120
- const m = v.standardSchemaV1(c), u = v.decode(c), { meta: l } = se(c), f = T(() => {
118
+ }, De = (f, c, o) => {
119
+ if (!f) throw new Error("Schema is required");
120
+ const p = v.standardSchemaV1(f), d = v.decode(f), { meta: u } = le(f), m = I(() => {
121
121
  if (o?.persistency?.id)
122
122
  return o.persistency.id;
123
- const e = window.location.pathname, t = Object.keys(l);
123
+ const e = window.location.pathname, t = Object.keys(u);
124
124
  return `${e}-${t.join("-")}`;
125
- }), w = () => {
125
+ }), E = () => {
126
126
  const e = new URLSearchParams(window.location.search);
127
- e.delete(f.value);
127
+ e.delete(m.value);
128
128
  const t = new URL(window.location.href);
129
129
  t.search = e.toString(), window.history.replaceState({}, "", t.toString());
130
130
  };
131
- function E(e, t) {
132
- for (const n in t)
133
- t[n] && X(t[n]) ? (e[n] || (e[n] = {}), E(e[n], t[n])) : e[n] = t[n];
131
+ function b(e, t) {
132
+ for (const r in t)
133
+ t[r] && te(t[r]) ? (e[r] || (e[r] = {}), b(e[r], t[r])) : e[r] = t[r];
134
134
  return e;
135
135
  }
136
136
  const y = (e) => {
137
137
  if (!e) return;
138
- const t = { ...e };
139
- for (const n in l) {
140
- const s = l[n], r = t[n], p = (r == null || r === !1 || r === "" || Number.isNaN(r)) && r !== !1 && r !== 0;
141
- s && !s.required && s.nullableOrUndefined && s.type !== "boolean" && (r === void 0 || p) && (t[n] = s.nullableOrUndefined === "undefined" ? void 0 : null);
138
+ const t = { ...e }, r = (s, a) => a.split(".").reduce((l, g) => l?.[g], s), n = (s, a, l) => {
139
+ const g = a.split("."), N = g.pop(), X = g.reduce((L, O) => (L[O] || (L[O] = {}), L[O]), s);
140
+ X[N] = l;
141
+ };
142
+ for (const s in u) {
143
+ const a = u[s], l = r(t, s), N = (l == null || l === !1 || l === "" || Number.isNaN(l)) && l !== !1 && l !== 0;
144
+ a && !a.required && a.nullableOrUndefined && a.type !== "boolean" && (l === void 0 || N) && n(t, s, a.nullableOrUndefined === "undefined" ? void 0 : null);
142
145
  }
143
146
  return t;
144
- }, g = (e) => {
147
+ }, F = (e) => {
145
148
  const t = {};
146
149
  if (typeof e?.make == "function")
147
150
  try {
148
151
  return e.make({});
149
152
  } catch {
150
153
  }
151
- const n = e?.members || (e?.ast?._tag === "Union" && e.ast.types ? e.ast.types.map((s) => v.make(s)) : null);
152
- if (n && _.isArray(n)) {
153
- for (const s of n) {
154
- const r = g(s);
155
- if (Object.keys(r).length > 0 && s?.fields && Object.entries(s.fields).some(
156
- ([p, K]) => p === "_tag" || p === "type" || p === "kind" ? K?.ast?.defaultValue !== void 0 : !1
154
+ const r = e?.members || (e?.ast?._tag === "Union" && e.ast.types ? e.ast.types.map((n) => v.make(n)) : null);
155
+ if (r && A.isArray(r)) {
156
+ for (const n of r) {
157
+ const s = F(n);
158
+ if (Object.keys(s).length > 0 && n?.fields && Object.entries(n.fields).some(
159
+ ([l, g]) => l === "_tag" || l === "type" || l === "kind" ? g?.ast?.defaultValue !== void 0 : !1
157
160
  ))
158
- return r;
161
+ return s;
159
162
  }
160
163
  return {};
161
164
  }
162
165
  if (e?.fields && typeof e.fields == "object")
163
- for (const [s, r] of Object.entries(e.fields)) {
164
- if (r?.ast?.defaultValue)
166
+ for (const [n, s] of Object.entries(e.fields)) {
167
+ if (s?.ast?.defaultValue)
165
168
  try {
166
- const p = r.ast.defaultValue();
167
- p !== void 0 && (t[s] = p);
169
+ const l = s.ast.defaultValue();
170
+ l !== void 0 && (t[n] = l);
168
171
  } catch {
169
172
  }
170
- const d = g(r);
171
- Object.keys(d).length > 0 && (t[s] && typeof t[s] == "object" ? Object.assign(t[s], d) : t[s] || (t[s] = d));
173
+ const a = F(s);
174
+ Object.keys(a).length > 0 && (t[n] && typeof t[n] == "object" ? Object.assign(t[n], a) : t[n] || (t[n] = a));
172
175
  }
173
176
  return t;
174
- }, A = (e = {}) => {
177
+ }, U = (e = {}) => {
175
178
  let t = {};
176
179
  try {
177
- const n = c.make(e);
178
- t = v.encodeSync(F(c))(n);
179
- } catch (n) {
180
- window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:", n);
180
+ const r = f.make(e);
181
+ t = v.encodeSync(k(f))(r);
182
+ } catch (r) {
183
+ window.location.hostname === "localhost" && console.warn("schema.make() failed, extracting defaults from AST:", r);
181
184
  try {
182
- const s = g(c);
183
- t = v.encodeSync(F(c))(s);
184
- } catch (s) {
185
- window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", s);
185
+ const n = F(f);
186
+ t = v.encodeSync(k(f))(n);
187
+ } catch (n) {
188
+ window.location.hostname === "localhost" && console.warn("Could not extract defaults from AST:", n);
186
189
  }
187
190
  }
188
- return E(t, e);
189
- }, h = T(() => {
190
- const e = A(
191
- y(
192
- a?.defaultValues
193
- )
194
- );
195
- if (e && !o?.persistency?.overrideDefaultValues)
196
- return e;
197
- let t;
198
- const n = o?.persistency;
199
- if (!n?.policies || n.policies.length === 0) return {};
200
- if (n.policies.includes("querystring"))
201
- try {
202
- const r = new URLSearchParams(window.location.search).get(f.value);
203
- w(), r && (t = JSON.parse(r));
204
- } catch (s) {
205
- console.error(s);
206
- }
191
+ return b(t, e);
192
+ }, h = I(() => {
193
+ let e;
194
+ const t = o?.persistency;
207
195
  if (
208
196
  // query string has higher priority than local/session storage
209
- !t && (n.policies.includes("local") || n.policies.includes("session"))
197
+ t?.policies && !e && (t.policies.includes("local") || t.policies.includes("session"))
210
198
  ) {
211
- const s = n.policies.includes("local") ? localStorage : sessionStorage;
212
- if (s)
199
+ const r = t.policies.includes("local") ? localStorage : sessionStorage;
200
+ if (r)
213
201
  try {
214
- const r = JSON.parse(
215
- s.getItem(f.value) || "{}"
202
+ const n = JSON.parse(
203
+ r.getItem(m.value) || "{}"
216
204
  );
217
- s.removeItem(f.value), t = r;
218
- } catch (r) {
219
- console.error(r);
205
+ r.removeItem(m.value), e = n;
206
+ } catch (n) {
207
+ console.error(n);
220
208
  }
221
209
  }
222
- return t ??= A({}), e ? E(e, t) : t;
223
- }), k = (e, t) => e ? L.with(q.setSpan(L.active(), e), t) : t(), i = Z({
224
- ...a,
210
+ if (t?.policies && t.policies.includes("querystring"))
211
+ try {
212
+ const n = new URLSearchParams(window.location.search).get(m.value);
213
+ E(), n && (e = b(e || {}, JSON.parse(n)));
214
+ } catch (r) {
215
+ console.error(r);
216
+ }
217
+ return e ??= {}, U(
218
+ y(
219
+ o?.persistency?.overrideDefaultValues ? b(c?.defaultValues || {}, e) : b(e, c?.defaultValues || {})
220
+ )
221
+ );
222
+ }), _ = (e, t) => e ? T.with(z.setSpan(T.active(), e), t) : t(), i = Y({
223
+ ...c,
225
224
  validators: {
226
- onSubmit: m,
227
- ...a?.validators || {}
225
+ onSubmit: p,
226
+ ...c?.validators || {}
228
227
  },
229
- onSubmit: a?.onSubmit ? ({ formApi: e, meta: t, value: n }) => k(t?.currentSpan, async () => {
230
- const s = await S.runPromise(u(n)), r = a.onSubmit({
228
+ onSubmit: c?.onSubmit ? ({ formApi: e, meta: t, value: r }) => _(t?.currentSpan, async () => {
229
+ const n = await S.runPromise(d(r)), s = c.onSubmit({
231
230
  formApi: e,
232
231
  meta: t,
233
- value: s
232
+ value: n
234
233
  });
235
- return O.isFiber(r) && O.isRuntimeFiber(r) ? await Q(r) : S.isEffect(r) ? await S.runPromise(
236
- r.pipe(
234
+ return j.isFiber(s) && j.isRuntimeFiber(s) ? await ee(s) : S.isEffect(s) ? await S.runPromise(
235
+ s.pipe(
237
236
  // meta?.currentSpan
238
237
  // ? Effect.withParentSpan(meta.currentSpan)
239
238
  // : (_) => _,
240
- S.flatMap((d) => O.join(d))
239
+ S.flatMap((a) => j.join(a))
241
240
  )
242
- ) : r;
241
+ ) : s;
243
242
  }) : void 0,
244
243
  defaultValues: h.value
245
244
  }), M = () => {
246
- Object.keys(l).forEach((e) => {
245
+ Object.keys(u).forEach((e) => {
247
246
  i.setFieldValue(e, void 0);
248
247
  });
249
- }, V = (e) => e.reduce((t, n) => {
250
- const s = n.split(".");
251
- return s.reduce((r, d, p) => (p === s.length - 1 ? r[d] = i.getFieldValue(n) : r[d] = r[d] ?? {}, r[d]), t), t;
252
- }, {}), j = (e) => {
248
+ }, $ = (e) => e.reduce((t, r) => {
249
+ const n = r.split(".");
250
+ return n.reduce((s, a, l) => (l === n.length - 1 ? s[a] = i.getFieldValue(r) : s[a] = s[a] ?? {}, s[a]), t), t;
251
+ }, {}), R = (e) => {
253
252
  if (e) {
254
- if (_.isArray(e.keys))
255
- return V(e.keys);
256
- if (_.isArray(e.banKeys)) {
257
- const t = Object.keys(l).filter((n) => e.banKeys?.includes(n));
258
- return V(t);
253
+ if (A.isArray(e.keys))
254
+ return $(e.keys);
255
+ if (A.isArray(e.banKeys)) {
256
+ const t = Object.keys(u).filter((r) => e.banKeys?.includes(r));
257
+ return $(t);
259
258
  }
260
259
  return i.store.state.values;
261
260
  }
@@ -264,69 +263,69 @@ const D = (c) => function(o) {
264
263
  if (!(!e?.policies || e.policies.length === 0) && (e.policies.includes("local") || e.policies.includes("session"))) {
265
264
  const t = e.policies.includes("local") ? localStorage : sessionStorage;
266
265
  if (!t) return;
267
- const n = j(e);
268
- return t.setItem(f.value, JSON.stringify(n));
266
+ const r = R(e);
267
+ return t.setItem(m.value, JSON.stringify(r));
269
268
  }
270
- }, N = () => {
269
+ }, W = () => {
271
270
  const e = o?.persistency;
272
271
  if (!(!e?.policies || e.policies.length === 0) && e.policies.includes("querystring")) {
273
- const t = j(e), n = new URLSearchParams(window.location.search);
274
- n.set(f.value, JSON.stringify(t));
275
- const s = new URL(window.location.href);
276
- s.search = n.toString(), window.history.replaceState({}, "", s.toString());
272
+ const t = R(e), r = new URLSearchParams(window.location.search);
273
+ r.set(m.value, JSON.stringify(t));
274
+ const n = new URL(window.location.href);
275
+ n.search = r.toString(), window.history.replaceState({}, "", n.toString());
277
276
  }
278
- }, I = (e) => {
277
+ }, B = (e) => {
279
278
  i.store.state.isDirty && e.preventDefault();
280
279
  };
281
- if (W(x), Y(() => {
282
- window.addEventListener("beforeunload", x), window.addEventListener("blur", N), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.addEventListener("beforeunload", I);
283
- }), C(() => {
284
- window.removeEventListener("beforeunload", x), window.removeEventListener("blur", N), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", I);
280
+ if (J(x), re(() => {
281
+ window.addEventListener("beforeunload", x), window.addEventListener("blur", W), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.addEventListener("beforeunload", B);
282
+ }), ne(() => {
283
+ window.removeEventListener("beforeunload", x), window.removeEventListener("blur", W), o?.preventWindowExit && o.preventWindowExit !== "nope" && window.removeEventListener("beforeunload", B);
285
284
  }), o?.preventWindowExit === "prevent-and-reset") {
286
- const e = i.useStore((r) => r.isSubmitting), t = i.useStore((r) => r.submissionAttempts), n = i.useStore((r) => r.canSubmit), s = i.useStore((r) => r.values);
287
- B([e, t], ([r, d], [p]) => {
288
- p && !r && d > 0 && n.value && i.reset(s.value);
285
+ const e = i.useStore((s) => s.isSubmitting), t = i.useStore((s) => s.submissionAttempts), r = i.useStore((s) => s.canSubmit), n = i.useStore((s) => s.values);
286
+ K([e, t], ([s, a], [l]) => {
287
+ l && !s && a > 0 && r.value && i.reset(n.value);
289
288
  });
290
289
  }
291
- const $ = (e) => S.currentSpan.pipe(
290
+ const q = (e) => S.currentSpan.pipe(
292
291
  S.option,
293
292
  S.flatMap(
294
- (t) => S.promise(() => i.handleSubmit(U.isSome(t) ? { currentSpan: t.value, ...e } : e))
293
+ (t) => S.promise(() => i.handleSubmit(V.isSome(t) ? { currentSpan: t.value, ...e } : e))
295
294
  )
296
- ), J = (e) => e?.checkErrors ? $(e?.meta).pipe(S.flatMap(S.fnUntraced(function* () {
295
+ ), G = (e) => e?.checkErrors ? q(e?.meta).pipe(S.flatMap(S.fnUntraced(function* () {
297
296
  const t = i.getAllErrors();
298
297
  if (Object.keys(t.fields).length || t.form.errors.length)
299
- return yield* new le({ form: t.form, fields: t.fields });
300
- }))) : $(e?.meta), z = i.handleSubmit, P = ee(/* @__PURE__ */ new Map()), b = Object.assign(i, {
298
+ return yield* new de({ form: t.form, fields: t.fields });
299
+ }))) : q(e?.meta), Q = i.handleSubmit, P = se(/* @__PURE__ */ new Map()), w = Object.assign(i, {
301
300
  i18nNamespace: o?.i18nNamespace,
302
301
  ignorePreventCloseEvents: o?.ignorePreventCloseEvents,
303
- meta: l,
302
+ meta: u,
304
303
  clear: M,
305
304
  handleSubmit: (e) => {
306
- const t = q.getSpan(L.active());
307
- return z({ currentSpan: t, ...e });
305
+ const t = z.getSpan(T.active());
306
+ return Q({ currentSpan: t, ...e });
308
307
  },
309
308
  // /** @experimental */
310
- handleSubmitEffect: J,
309
+ handleSubmitEffect: G,
311
310
  registerField: (e) => {
312
- B(e, (t) => P.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), W(() => P.value.delete(e.value.name));
311
+ K(e, (t) => P.value.set(t.name, { label: t.label, id: t.id }), { immediate: !0 }), J(() => P.value.delete(e.value.name));
313
312
  }
314
- }), R = { form: b, fieldMap: P };
315
- return Object.assign(b, {
313
+ }), H = { form: w, fieldMap: P };
314
+ return Object.assign(w, {
316
315
  // Type-level properties for performance optimization (not used at runtime)
317
316
  _paths: void 0,
318
317
  _keys: void 0,
319
- errorContext: R,
320
- Form: D(b)(ae),
321
- Input: D(b)(o?.input ?? oe),
322
- TaggedUnion: D(b)(ie),
318
+ errorContext: H,
319
+ Form: D(w)(fe),
320
+ Input: D(w)(o?.input ?? ce),
321
+ TaggedUnion: D(w)(ue),
323
322
  Field: i.Field,
324
- Errors: ce(R)(ne),
325
- Array: D(b)(te),
326
- AutoGen: D(b)(re)
323
+ Errors: me(H)(ae),
324
+ Array: D(w)(oe),
325
+ AutoGen: D(w)(ie)
327
326
  });
328
327
  };
329
328
  export {
330
- le as FormErrors,
331
- Fe as useOmegaForm
329
+ de as FormErrors,
330
+ De as useOmegaForm
332
331
  };
@@ -1,6 +1,6 @@
1
- import l from "./vue-components.es29.js";
1
+ import l from "./vue-components.es28.js";
2
2
  import { inject as c, provide as u } from "vue";
3
- import { onMountedWithCleanup as f } from "./vue-components.es16.js";
3
+ import { onMountedWithCleanup as f } from "./vue-components.es29.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,13 +1,12 @@
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
- }
1
+ import { Exit as c, Runtime as u } from "effect";
2
+ import { dual as n, isFunction as m } from "./vue-components.es32.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
+ }));
11
8
  export {
12
- p as onMountedWithCleanup
9
+ a as clone,
10
+ i as cloneTrait,
11
+ p as runtimeFiberAsPromise
13
12
  };
@@ -1,12 +1,7 @@
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 { isFunction as c } from "./vue-components.es32.js";
2
+ const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
8
3
  export {
9
- a as clone,
10
- i as cloneTrait,
11
- p as runtimeFiberAsPromise
4
+ s as isFunction,
5
+ i as isObject,
6
+ t as isRecordOrArray
12
7
  };
@@ -1,7 +1,57 @@
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 { 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
+ });
3
55
  export {
4
- s as isFunction,
5
- i as isObject,
6
- t as isRecordOrArray
56
+ N as default
7
57
  };