@effect-app/vue-components 2.9.2 → 2.10.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.
Files changed (52) hide show
  1. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +2 -0
  2. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +13 -2
  3. package/dist/vue-components.es.js +17 -15
  4. package/dist/vue-components.es10.js +120 -115
  5. package/dist/vue-components.es12.js +282 -204
  6. package/dist/vue-components.es16.js +4 -10
  7. package/dist/vue-components.es17.js +10 -97
  8. package/dist/vue-components.es2.js +29 -27
  9. package/dist/vue-components.es20.js +2 -2
  10. package/dist/vue-components.es21.js +2 -2
  11. package/dist/vue-components.es22.js +1 -1
  12. package/dist/vue-components.es23.js +1 -1
  13. package/dist/vue-components.es31.js +2 -4
  14. package/dist/vue-components.es32.js +1 -1
  15. package/dist/vue-components.es33.js +111 -2
  16. package/dist/vue-components.es35.js +9 -0
  17. package/dist/vue-components.es36.js +32 -7
  18. package/dist/vue-components.es40.js +6 -0
  19. package/dist/vue-components.es41.js +23 -4
  20. package/dist/vue-components.es42.js +5 -23
  21. package/dist/vue-components.es43.js +21 -5
  22. package/dist/vue-components.es44.js +25 -16
  23. package/dist/vue-components.es45.js +15 -23
  24. package/dist/vue-components.es46.js +7 -17
  25. package/dist/vue-components.es47.js +5 -12
  26. package/dist/vue-components.es48.js +19 -5
  27. package/dist/vue-components.es49.js +9 -19
  28. package/dist/vue-components.es50.js +31 -9
  29. package/dist/vue-components.es51.js +42 -25
  30. package/dist/vue-components.es52.js +16 -38
  31. package/dist/vue-components.es53.js +11 -26
  32. package/dist/vue-components.es54.js +65 -11
  33. package/dist/vue-components.es55.js +45 -54
  34. package/dist/vue-components.es56.js +15 -54
  35. package/dist/vue-components.es57.js +31 -15
  36. package/dist/vue-components.es58.js +26 -30
  37. package/dist/vue-components.es59.js +42 -29
  38. package/dist/vue-components.es60.js +2 -42
  39. package/dist/vue-components.es61.js +44 -2
  40. package/dist/vue-components.es62.js +2 -44
  41. package/dist/vue-components.es7.js +1 -1
  42. package/dist/vue-components.es9.js +10 -33
  43. package/package.json +3 -3
  44. package/src/components/OmegaForm/OmegaFormStuff.ts +174 -11
  45. package/src/components/OmegaForm/OmegaTaggedUnionInternal.vue +0 -48
  46. package/src/components/OmegaForm/useOmegaForm.ts +49 -25
  47. package/dist/types/components/OmegaForm/defaultAST.d.ts +0 -4
  48. package/dist/vue-components.es34.js +0 -113
  49. package/dist/vue-components.es37.js +0 -34
  50. package/dist/vue-components.es63.js +0 -4
  51. package/src/components/OmegaForm/defaultAST.ts +0 -191
  52. /package/dist/{vue-components.es39.js → vue-components.es38.js} +0 -0
@@ -1,328 +1,329 @@
1
- import { S as n, Option as L } from "effect-app";
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
- const i = [];
1
+ import { S as i, Option as M } from "effect-app";
2
+ import { getMetadataFromSchema as k } from "@effect-app/vue/form";
3
+ import { useIntl as V, getTransformationFrom as q } from "./vue-components.es3.js";
4
+ import { isObject as E } from "./vue-components.es16.js";
5
+ const $ = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKeyword" || n === i.Null.ast), g = (e) => !e || !i.AST.isUnion(e) ? !1 : e.types.find((n) => n._tag === "UndefinedKeyword") ? "undefined" : e.types.find((n) => n === i.Null.ast) ? "null" : !1, w = (e) => {
6
+ const n = [];
6
7
  for (const t of e)
7
- if (n.AST.isUnion(t)) {
8
- const c = _(t.types);
9
- i.push(...c);
8
+ if (i.AST.isUnion(t)) {
9
+ const l = w(t.types);
10
+ n.push(...l);
10
11
  } else
11
- i.push(t);
12
- return i;
13
- }, u = ({ meta: e = {}, parent: i = "", property: t, propertySignatures: c }, o = {}) => {
12
+ n.push(t);
13
+ return n;
14
+ }, m = ({ meta: e = {}, parent: n = "", property: t, propertySignatures: l }, o = {}) => {
14
15
  if (t && t._tag === "Transformation")
15
- return u({
16
- parent: i,
16
+ return m({
17
+ parent: n,
17
18
  meta: e,
18
19
  property: t.from
19
20
  });
20
21
  if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
21
- return u({
22
+ return m({
22
23
  meta: e,
23
24
  propertySignatures: t.propertySignatures
24
25
  });
25
- if (c) {
26
- for (const r of c) {
27
- const p = i ? `${i}.${r.name.toString()}` : r.name.toString(), s = g(r.type);
26
+ if (l) {
27
+ for (const s of l) {
28
+ const r = n ? `${n}.${s.name.toString()}` : s.name.toString(), p = g(s.type);
28
29
  let a;
29
- e._isNullableDiscriminatedUnion && r.name.toString() === "_tag" || e.required === !1 ? a = !1 : a = !s;
30
- const f = r.type;
31
- if (n.AST.isUnion(r.type)) {
32
- const S = _(r.type.types).filter(
33
- (l) => l._tag !== "UndefinedKeyword" && l !== n.Null.ast
34
- ).map(w);
30
+ e._isNullableDiscriminatedUnion && s.name.toString() === "_tag" || e.required === !1 ? a = !1 : a = !p;
31
+ const f = s.type;
32
+ if (i.AST.isUnion(s.type)) {
33
+ const S = w(s.type.types).filter(
34
+ (u) => u._tag !== "UndefinedKeyword" && u !== i.Null.ast
35
+ ).map(q);
35
36
  if (S.some(
36
- (l) => "propertySignatures" in l
37
+ (u) => "propertySignatures" in u
37
38
  )) {
38
- if (!s) {
39
- const l = u({
40
- parent: p,
41
- property: r.type,
42
- meta: { required: a, nullableOrUndefined: s }
39
+ if (!p) {
40
+ const u = m({
41
+ parent: r,
42
+ property: s.type,
43
+ meta: { required: a, nullableOrUndefined: p }
43
44
  });
44
- o[p] = l;
45
+ o[r] = u;
45
46
  }
46
- for (const l of S)
47
- if ("propertySignatures" in l) {
48
- const m = s && S.length > 1;
47
+ for (const u of S)
48
+ if ("propertySignatures" in u) {
49
+ const y = p && S.length > 1;
49
50
  Object.assign(
50
51
  o,
51
- u({
52
- parent: p,
53
- propertySignatures: l.propertySignatures,
54
- meta: m ? { _isNullableDiscriminatedUnion: !0 } : {}
52
+ m({
53
+ parent: r,
54
+ propertySignatures: u.propertySignatures,
55
+ meta: y ? { _isNullableDiscriminatedUnion: !0 } : {}
55
56
  })
56
57
  );
57
58
  }
58
59
  } else {
59
- const l = S.filter(n.AST.isTupleType);
60
- if (l.length > 0) {
61
- const m = l[0];
62
- if (o[p] = {
60
+ const u = S.filter(i.AST.isTupleType);
61
+ if (u.length > 0) {
62
+ const y = u[0];
63
+ if (o[r] = {
63
64
  type: "multiple",
64
- members: m.elements,
65
- rest: m.rest,
65
+ members: y.elements,
66
+ rest: y.rest,
66
67
  required: a,
67
- nullableOrUndefined: s
68
- }, m.rest && m.rest.length > 0) {
69
- const T = m.rest[0];
70
- if (T.type._tag === "TypeLiteral" && "propertySignatures" in T.type)
71
- for (const d of T.type.propertySignatures) {
72
- const h = `${p}.${d.name.toString()}`, v = u({
68
+ nullableOrUndefined: p
69
+ }, y.rest && y.rest.length > 0) {
70
+ const b = y.rest[0];
71
+ if (b.type._tag === "TypeLiteral" && "propertySignatures" in b.type)
72
+ for (const c of b.type.propertySignatures) {
73
+ const h = `${r}.${c.name.toString()}`, x = m({
73
74
  parent: h,
74
- property: d.type,
75
+ property: c.type,
75
76
  meta: {
76
- required: !g(d.type),
77
- nullableOrUndefined: g(d.type)
77
+ required: !g(c.type),
78
+ nullableOrUndefined: g(c.type)
78
79
  }
79
80
  });
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
- parent: A,
86
- property: x.type,
81
+ if (x && typeof x == "object" && "type" in x && (o[h] = x, x.type === "multiple" && i.AST.isTupleType(c.type) && c.type.rest && c.type.rest.length > 0)) {
82
+ const U = c.type.rest[0];
83
+ if (U.type._tag === "TypeLiteral" && "propertySignatures" in U.type)
84
+ for (const A of U.type.propertySignatures) {
85
+ const L = `${h}.${A.name.toString()}`, O = m({
86
+ parent: L,
87
+ property: A.type,
87
88
  meta: {
88
- required: !g(x.type),
89
- nullableOrUndefined: g(x.type)
89
+ required: !g(A.type),
90
+ nullableOrUndefined: g(A.type)
90
91
  }
91
92
  });
92
- U && typeof U == "object" && "type" in U && (o[A] = U);
93
+ O && typeof O == "object" && "type" in O && (o[L] = O);
93
94
  }
94
95
  }
95
96
  }
96
97
  }
97
98
  } else {
98
- const m = u({
99
- parent: p,
100
- property: r.type,
101
- meta: { required: a, nullableOrUndefined: s }
99
+ const y = m({
100
+ parent: r,
101
+ property: s.type,
102
+ meta: { required: a, nullableOrUndefined: p }
102
103
  });
103
- o[p] = m;
104
+ o[r] = y;
104
105
  }
105
106
  }
106
107
  } else if ("propertySignatures" in f)
107
108
  Object.assign(
108
109
  o,
109
- u({
110
- parent: p,
110
+ m({
111
+ parent: r,
111
112
  propertySignatures: f.propertySignatures,
112
- meta: { required: a, nullableOrUndefined: s }
113
+ meta: { required: a, nullableOrUndefined: p }
113
114
  })
114
115
  );
115
- else if (n.AST.isTupleType(r.type))
116
- if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
117
- const S = r.type.rest[0].type;
116
+ else if (i.AST.isTupleType(s.type))
117
+ if (s.type.rest.length > 0 && s.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in s.type.rest[0].type) {
118
+ const S = s.type.rest[0].type;
118
119
  if (S._tag === "TypeLiteral" && "propertySignatures" in S)
119
- for (const y of S.propertySignatures) {
120
- const l = `${p}.${y.name.toString()}`;
121
- if (n.AST.isTupleType(y.type) && y.type.rest.length > 0) {
122
- const m = y.type.rest[0].type;
123
- if (m._tag === "TypeLiteral" && "propertySignatures" in m)
124
- for (const T of m.propertySignatures) {
125
- const d = `${l}.${T.name.toString()}`, h = u({
126
- parent: d,
127
- property: T.type,
120
+ for (const d of S.propertySignatures) {
121
+ const u = `${r}.${d.name.toString()}`;
122
+ if (i.AST.isTupleType(d.type) && d.type.rest.length > 0) {
123
+ const y = d.type.rest[0].type;
124
+ if (y._tag === "TypeLiteral" && "propertySignatures" in y)
125
+ for (const b of y.propertySignatures) {
126
+ const c = `${u}.${b.name.toString()}`, h = m({
127
+ parent: c,
128
+ property: b.type,
128
129
  meta: {
129
- required: !g(T.type),
130
- nullableOrUndefined: g(T.type)
130
+ required: !g(b.type),
131
+ nullableOrUndefined: g(b.type)
131
132
  }
132
133
  });
133
- o[d] = h;
134
+ o[c] = h;
134
135
  }
135
136
  else
136
- o[l] = {
137
+ o[u] = {
137
138
  type: "multiple",
138
- members: y.type.elements,
139
- rest: y.type.rest,
140
- required: !g(y.type),
141
- nullableOrUndefined: g(y.type)
139
+ members: d.type.elements,
140
+ rest: d.type.rest,
141
+ required: !g(d.type),
142
+ nullableOrUndefined: g(d.type)
142
143
  };
143
144
  } else {
144
- const m = u({
145
- parent: l,
146
- property: y.type,
145
+ const y = m({
146
+ parent: u,
147
+ property: d.type,
147
148
  meta: {
148
- required: !g(y.type),
149
- nullableOrUndefined: g(y.type)
149
+ required: !g(d.type),
150
+ nullableOrUndefined: g(d.type)
150
151
  }
151
152
  });
152
- o[l] = m;
153
+ o[u] = y;
153
154
  }
154
155
  }
155
156
  } else
156
- o[p] = {
157
+ o[r] = {
157
158
  type: "multiple",
158
- members: r.type.elements,
159
- rest: r.type.rest,
159
+ members: s.type.elements,
160
+ rest: s.type.rest,
160
161
  required: a,
161
- nullableOrUndefined: s
162
+ nullableOrUndefined: p
162
163
  };
163
164
  else {
164
- const b = u({
165
- parent: p,
166
- property: r.type,
165
+ const T = m({
166
+ parent: r,
167
+ property: s.type,
167
168
  meta: {
168
169
  // an empty string is valid for a S.String field, so we should not mark it as required
169
170
  // TODO: handle this better via the createMeta minLength parsing
170
- required: a && (r.type._tag !== "StringKeyword" || q(r.type).minLength),
171
- nullableOrUndefined: s
171
+ required: a && (s.type._tag !== "StringKeyword" || k(s.type).minLength),
172
+ nullableOrUndefined: p
172
173
  }
173
174
  });
174
- o[p] = b;
175
+ o[r] = T;
175
176
  }
176
177
  }
177
178
  return o;
178
179
  }
179
180
  if (t) {
180
- const r = k(t);
181
- if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
182
- const s = _(t.types), a = s.find(
183
- (f) => f._tag !== "UndefinedKeyword" && f !== n.Null.ast
181
+ const s = $(t);
182
+ if (Object.hasOwnProperty.call(e, "required") || (e.required = !s), i.AST.isUnion(t)) {
183
+ const p = w(t.types), a = p.find(
184
+ (f) => f._tag !== "UndefinedKeyword" && f !== i.Null.ast
184
185
  );
185
- return "propertySignatures" in a ? u({
186
+ return "propertySignatures" in a ? m({
186
187
  propertySignatures: a.propertySignatures,
187
- parent: i,
188
+ parent: n,
188
189
  meta: e
189
- }) : s.every(n.AST.isLiteral) ? {
190
+ }) : p.every(i.AST.isLiteral) ? {
190
191
  ...e,
191
192
  type: "select",
192
- members: s.map((f) => f.literal)
193
+ members: p.map((f) => f.literal)
193
194
  } : {
194
195
  ...e,
195
- ...u({
196
- parent: i,
196
+ ...m({
197
+ parent: n,
197
198
  meta: e,
198
199
  property: a
199
200
  })
200
201
  };
201
202
  }
202
- if (n.AST.isTupleType(t))
203
+ if (i.AST.isTupleType(t))
203
204
  return {
204
205
  ...e,
205
206
  type: "multiple",
206
207
  members: t.elements,
207
208
  rest: t.rest
208
209
  };
209
- const p = n.AST.getAnnotation(
210
+ const r = i.AST.getAnnotation(
210
211
  t,
211
- n.AST.JSONSchemaAnnotationId
212
- ).pipe(L.getOrElse(() => ({})));
213
- return e = { ...e, ...p }, "from" in t ? u({
214
- parent: i,
212
+ i.AST.JSONSchemaAnnotationId
213
+ ).pipe(M.getOrElse(() => ({})));
214
+ return e = { ...e, ...r }, "from" in t ? m({
215
+ parent: n,
215
216
  meta: e,
216
217
  property: t.from
217
- }) : (e.type = n.AST.getAnnotation(
218
+ }) : (e.type = i.AST.getAnnotation(
218
219
  t,
219
- n.AST.TitleAnnotationId
220
+ i.AST.TitleAnnotationId
220
221
  ).pipe(
221
- L.getOrElse(() => "unknown")
222
+ M.getOrElse(() => "unknown")
222
223
  ), e);
223
224
  }
224
225
  return o;
225
- }, M = (e) => {
226
- const i = e.ast, t = {};
227
- if (i._tag === "Transformation" || i._tag === "Refinement")
228
- return M(n.make(i.from));
229
- if (i._tag === "Union") {
230
- const r = (i.types || []).filter((s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast).map(w);
231
- if (r.every((s) => s._tag === "TypeLiteral" && "propertySignatures" in s) && r.length > 0) {
232
- const s = [];
233
- for (const a of r)
234
- if ("propertySignatures" in a) {
235
- const f = a.propertySignatures.find(
236
- (S) => S.name.toString() === "_tag"
226
+ }, N = (e) => {
227
+ const n = e.ast, t = {}, l = {};
228
+ if (n._tag === "Transformation" || n._tag === "Refinement")
229
+ return N(i.make(n.from));
230
+ if (n._tag === "Union") {
231
+ const r = (n.types || []).filter((a) => a._tag !== "UndefinedKeyword" && a !== i.Null.ast).map(q);
232
+ if (r.every((a) => a._tag === "TypeLiteral" && "propertySignatures" in a) && r.length > 0) {
233
+ const a = [];
234
+ for (const f of r)
235
+ if ("propertySignatures" in f) {
236
+ const T = f.propertySignatures.find(
237
+ (d) => d.name.toString() === "_tag"
237
238
  );
238
- f && n.AST.isLiteral(f.type) && s.push(f.type.literal);
239
- const b = u({
240
- propertySignatures: a.propertySignatures
239
+ T && i.AST.isLiteral(T.type) && a.push(T.type.literal);
240
+ const S = m({
241
+ propertySignatures: f.propertySignatures
241
242
  });
242
- Object.assign(t, b);
243
+ Object.assign(t, S);
243
244
  }
244
- return s.length > 0 && (t._tag = {
245
+ return a.length > 0 && (t._tag = {
245
246
  type: "select",
246
- members: s,
247
+ members: a,
247
248
  required: !0
248
- }), t;
249
+ }), { meta: t, defaultValues: l };
249
250
  }
250
251
  }
251
- if ("propertySignatures" in i) {
252
- const c = u({
253
- propertySignatures: i.propertySignatures
252
+ if ("propertySignatures" in n) {
253
+ const o = m({
254
+ propertySignatures: n.propertySignatures
254
255
  });
255
- if (Object.values(c).every((r) => r && "type" in r))
256
- return c;
257
- const o = (r, p = "") => {
258
- for (const s in r) {
259
- const a = p ? `${p}.${s}` : s;
260
- r[s] && typeof r[s] == "object" && "type" in r[s] ? t[a] = r[s] : r[s] && typeof r[s] == "object" && o(r[s], a);
256
+ if (Object.values(o).every((r) => r && "type" in r))
257
+ return { meta: o, defaultValues: l };
258
+ const s = (r, p = "") => {
259
+ for (const a in r) {
260
+ const f = p ? `${p}.${a}` : a;
261
+ r[a] && typeof r[a] == "object" && "type" in r[a] ? t[f] = r[a] : r[a] && typeof r[a] == "object" && s(r[a], f);
261
262
  }
262
263
  };
263
- o(c);
264
+ s(o);
264
265
  }
265
- return t;
266
- }, P = (e) => n.extend(e, n.Struct({})), j = (e) => {
267
- const i = M(e);
268
- return { schema: e, meta: i };
269
- }, F = (e) => {
270
- const { trans: i } = N();
266
+ return { meta: t, defaultValues: l };
267
+ }, B = (e) => i.extend(e, i.Struct({})), J = (e) => {
268
+ const { meta: n } = N(e);
269
+ return { schema: e, meta: n };
270
+ }, z = (e) => {
271
+ const { trans: n } = V();
271
272
  let t;
272
273
  switch (e.type) {
273
274
  case "string":
274
- t = n.String.annotations({
275
- message: () => i("validation.empty")
276
- }), e.format === "email" && (t = n.compose(
275
+ t = i.String.annotations({
276
+ message: () => n("validation.empty")
277
+ }), e.format === "email" && (t = i.compose(
277
278
  t,
278
- n.Email.annotations({
279
- message: () => i("validation.email.invalid")
279
+ i.Email.annotations({
280
+ message: () => n("validation.email.invalid")
280
281
  })
281
282
  )), e.required && (t = t.annotations({
282
- message: () => i("validation.empty")
283
- }).pipe(n.minLength(1)).annotations({
284
- message: () => i("validation.empty")
285
- })), typeof e.maxLength == "number" && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
286
- message: () => i("validation.string.maxLength", {
283
+ message: () => n("validation.empty")
284
+ }).pipe(i.minLength(1)).annotations({
285
+ message: () => n("validation.empty")
286
+ })), typeof e.maxLength == "number" && (t = t.pipe(i.maxLength(e.maxLength)).annotations({
287
+ message: () => n("validation.string.maxLength", {
287
288
  maxLength: e.maxLength
288
289
  })
289
- })), typeof e.minLength == "number" && (t = t.pipe(n.minLength(e.minLength)).annotations({
290
- message: () => i("validation.string.minLength", {
290
+ })), typeof e.minLength == "number" && (t = t.pipe(i.minLength(e.minLength)).annotations({
291
+ message: () => n("validation.string.minLength", {
291
292
  minLength: e.minLength
292
293
  })
293
294
  }));
294
295
  break;
295
296
  case "number":
296
- t = n.Number.annotations({
297
- message: () => i("validation.empty")
297
+ t = i.Number.annotations({
298
+ message: () => n("validation.empty")
298
299
  }), e.required && t.annotations({
299
- message: () => i("validation.empty")
300
- }), typeof e.minimum == "number" && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
301
- message: () => i(e.minimum === 0 ? "validation.number.positive" : "validation.number.min", {
300
+ message: () => n("validation.empty")
301
+ }), typeof e.minimum == "number" && (t = t.pipe(i.greaterThanOrEqualTo(e.minimum)).annotations({
302
+ message: () => n(e.minimum === 0 ? "validation.number.positive" : "validation.number.min", {
302
303
  minimum: e.minimum,
303
304
  isExclusive: !0
304
305
  })
305
- })), typeof e.maximum == "number" && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
306
- message: () => i("validation.number.max", {
306
+ })), typeof e.maximum == "number" && (t = t.pipe(i.lessThanOrEqualTo(e.maximum)).annotations({
307
+ message: () => n("validation.number.max", {
307
308
  maximum: e.maximum,
308
309
  isExclusive: !0
309
310
  })
310
- })), typeof e.exclusiveMinimum == "number" && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
311
- message: () => i(e.exclusiveMinimum === 0 ? "validation.number.positive" : "validation.number.min", {
311
+ })), typeof e.exclusiveMinimum == "number" && (t = t.pipe(i.greaterThan(e.exclusiveMinimum)).annotations({
312
+ message: () => n(e.exclusiveMinimum === 0 ? "validation.number.positive" : "validation.number.min", {
312
313
  minimum: e.exclusiveMinimum,
313
314
  isExclusive: !1
314
315
  })
315
- })), typeof e.exclusiveMaximum == "number" && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
316
- message: () => i("validation.number.max", {
316
+ })), typeof e.exclusiveMaximum == "number" && (t = t.pipe(i.lessThan(e.exclusiveMaximum)).annotations({
317
+ message: () => n("validation.number.max", {
317
318
  maximum: e.exclusiveMaximum,
318
319
  isExclusive: !1
319
320
  })
320
321
  }));
321
322
  break;
322
323
  case "select":
323
- t = n.Literal(...e.members).annotations({
324
+ t = i.Literal(...e.members).annotations({
324
325
  message: () => ({
325
- message: i("validation.not_a_valid", {
326
+ message: n("validation.not_a_valid", {
326
327
  type: "select",
327
328
  message: e.members.join(", ")
328
329
  }),
@@ -331,34 +332,34 @@ const k = (e) => n.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKe
331
332
  });
332
333
  break;
333
334
  case "multiple":
334
- t = n.Array(n.String).annotations({
335
- message: () => i("validation.not_a_valid", {
335
+ t = i.Array(i.String).annotations({
336
+ message: () => n("validation.not_a_valid", {
336
337
  type: "multiple",
337
338
  message: e.members.join(", ")
338
339
  })
339
340
  });
340
341
  break;
341
342
  case "boolean":
342
- t = n.Boolean;
343
+ t = i.Boolean;
343
344
  break;
344
345
  case "unknown":
345
- t = n.Unknown;
346
+ t = i.Unknown;
346
347
  break;
347
348
  default:
348
- console.warn(`Unhandled field type: ${e}`), t = n.Unknown;
349
+ console.warn(`Unhandled field type: ${e}`), t = i.Unknown;
349
350
  break;
350
351
  }
351
352
  return e.required ? t.pipe(
352
- n.annotations({
353
- message: () => i("validation.empty")
353
+ i.annotations({
354
+ message: () => n("validation.empty")
354
355
  })
355
- ) : t = n.NullishOr(t), n.standardSchemaV1(t);
356
- }, D = (e, i) => n.NullOr(e).pipe(
357
- n.transform(n.typeSchema(e), {
358
- decode: (t) => t ?? i(),
356
+ ) : t = i.NullishOr(t), i.standardSchemaV1(t);
357
+ }, C = (e, n) => i.NullOr(e).pipe(
358
+ i.transform(i.typeSchema(e), {
359
+ decode: (t) => t ?? n(),
359
360
  encode: (t) => t
360
361
  })
361
- ), E = [
362
+ ), K = [
362
363
  "button",
363
364
  "checkbox",
364
365
  "color",
@@ -374,13 +375,90 @@ const k = (e) => n.AST.isUnion(e) && e.types.find((i) => i._tag === "UndefinedKe
374
375
  "text",
375
376
  "time",
376
377
  "url"
377
- ], R = (e) => E.includes(e) ? e : "text";
378
+ ], G = (e) => K.includes(e) ? e : "text";
379
+ function j(e, n) {
380
+ const t = { ...e };
381
+ for (const l in n)
382
+ Array.isArray(n[l]) ? t[l] = n[l] : n[l] && E(n[l]) ? t[l] = j(t[l], n[l]) : t[l] = n[l];
383
+ return t;
384
+ }
385
+ function _(e) {
386
+ return e && "fields" in e && typeof e.fields == "object";
387
+ }
388
+ function F(e) {
389
+ return e && "members" in e && Array.isArray(e.members);
390
+ }
391
+ const v = (e, n = {}) => {
392
+ const t = e.ast;
393
+ if (t?.defaultValue)
394
+ return t.defaultValue();
395
+ if (g(e.ast) === "null")
396
+ return null;
397
+ if (g(e.ast) !== "undefined") {
398
+ if (_(e)) {
399
+ const l = {};
400
+ for (const [o, s] of Object.entries(e.fields)) {
401
+ const r = s?.ast;
402
+ if (r?.defaultValue)
403
+ try {
404
+ l[o] = r.defaultValue();
405
+ continue;
406
+ } catch {
407
+ }
408
+ const p = v(s, n[o] || {});
409
+ p !== void 0 && (l[o] = p);
410
+ }
411
+ return { ...l, ...n };
412
+ }
413
+ if (e?.from && _(e.from))
414
+ return v(e.from, n);
415
+ if (F(e)) {
416
+ const l = e.members.reduce((o, s) => (_(s) && Object.entries(s.fields).forEach(([r, p]) => {
417
+ const a = p.ast, f = o[r]?.ast;
418
+ (!o[r] || a?.defaultValue && !f?.defaultValue) && (o[r] = p);
419
+ }), o), {});
420
+ return Object.entries(l).reduce((o, [s, r]) => (o[s] = v(r, n[s] || {}), o), n);
421
+ }
422
+ if (Object.keys(n).length === 0)
423
+ switch (e.ast._tag) {
424
+ case "Refinement":
425
+ return v(i.make(e.ast.from), n);
426
+ case "Transformation": {
427
+ const l = i.make(e.ast.from);
428
+ return v(l, n);
429
+ }
430
+ case "TypeLiteral": {
431
+ const l = { ...n };
432
+ for (const o of t.propertySignatures) {
433
+ const s = o.name.toString(), r = o.type;
434
+ if (r._tag === "Transformation" && r.defaultValue) {
435
+ l[s] = r.defaultValue();
436
+ continue;
437
+ }
438
+ if (r.defaultValue) {
439
+ l[s] = r.defaultValue();
440
+ continue;
441
+ }
442
+ const p = i.make(r), a = v(p, n[s] || {});
443
+ a !== void 0 && (l[s] = a);
444
+ }
445
+ return l;
446
+ }
447
+ case "StringKeyword":
448
+ return "";
449
+ case "BooleanKeyword":
450
+ return !1;
451
+ }
452
+ }
453
+ };
378
454
  export {
379
- u as createMeta,
380
- P as duplicateSchema,
381
- F as generateInputStandardSchemaFromFieldMeta,
382
- j as generateMetaFromSchema,
383
- R as getInputType,
455
+ m as createMeta,
456
+ j as deepMerge,
457
+ v as defaultsValueFromSchema,
458
+ B as duplicateSchema,
459
+ z as generateInputStandardSchemaFromFieldMeta,
460
+ J as generateMetaFromSchema,
461
+ G as getInputType,
384
462
  g as isNullableOrUndefined,
385
- D as nullableInput
463
+ C as nullableInput
386
464
  };