@effect-app/vue-components 2.7.6 → 2.7.8

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