@effect-app/vue-components 0.14.6 → 0.15.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.
@@ -98,7 +98,7 @@ export type CreateMeta = {
98
98
  property: S.AST.AST;
99
99
  });
100
100
  export declare const createMeta: <T = any>({ meta, parent, property, propertySignatures }: CreateMeta, acc?: Partial<MetaRecord<T>>) => MetaRecord<T> | FieldMeta;
101
- export declare const duplicateSchema: <From, To>(schema: S.Schema<To, From, never>) => S.extend<S.Schema<To, From, never>, import("effect/Schema").Struct<{}>>;
101
+ export declare const duplicateSchema: <From, To>(schema: S.Schema<To, From, never>) => S.extend<S.Schema<To, From, never>, S.Struct<{}>>;
102
102
  export declare const generateMetaFromSchema: <From, To>(schema: S.Schema<To, From, never>) => {
103
103
  schema: S.Schema<To, From, never>;
104
104
  meta: MetaRecord<To>;
@@ -1,6 +1,6 @@
1
- import { S as n, Option as f, pipe as O } from "effect-app";
2
- import { useIntl as A } from "./vue-components.es3.js";
3
- const M = n.NonEmptyArray(n.String), L = (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, m = ({ meta: e = {}, parent: i = "", property: t, propertySignatures: o }, l = {}) => {
1
+ import { S as n, Option as c, pipe as L } from "effect-app";
2
+ import { useIntl as U } from "./vue-components.es3.js";
3
+ const _ = n.NonEmptyArray(n.String), N = (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, m = ({ meta: e = {}, parent: i = "", property: t, propertySignatures: p }, o = {}) => {
4
4
  if (t && t._tag === "Transformation")
5
5
  return m({
6
6
  parent: i,
@@ -12,72 +12,112 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
12
12
  meta: e,
13
13
  propertySignatures: t.propertySignatures
14
14
  });
15
- if (o) {
16
- for (const r of o) {
17
- const u = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), p = !a, b = r.type;
15
+ if (p) {
16
+ for (const r of p) {
17
+ const l = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), u = !a, A = r.type;
18
18
  if (n.AST.isUnion(r.type)) {
19
- const y = r.type.types.filter(
19
+ const T = r.type.types.filter(
20
20
  (s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
21
21
  );
22
- if (y.some(
22
+ if (T.some(
23
23
  (s) => "propertySignatures" in s
24
24
  )) {
25
25
  if (!a) {
26
26
  const s = m({
27
- parent: u,
27
+ parent: l,
28
28
  property: r.type,
29
- meta: { required: p, nullableOrUndefined: a }
29
+ meta: { required: u, nullableOrUndefined: a }
30
30
  });
31
- l[u] = s;
31
+ o[l] = s;
32
32
  }
33
- for (const s of y)
33
+ for (const s of T)
34
34
  "propertySignatures" in s && Object.assign(
35
- l,
35
+ o,
36
36
  m({
37
- parent: u,
37
+ parent: l,
38
38
  propertySignatures: s.propertySignatures,
39
- meta: { required: p, nullableOrUndefined: a }
39
+ meta: { required: u, nullableOrUndefined: a }
40
40
  })
41
41
  );
42
42
  } else {
43
- const s = m({
44
- parent: u,
45
- property: r.type,
46
- meta: { required: p, nullableOrUndefined: a }
47
- });
48
- l[u] = s;
43
+ const s = T.filter(n.AST.isTupleType);
44
+ if (s.length > 0) {
45
+ const f = s[0];
46
+ if (o[l] = {
47
+ type: "multiple",
48
+ members: f.elements,
49
+ rest: f.rest,
50
+ required: u,
51
+ nullableOrUndefined: a
52
+ }, f.rest && f.rest.length > 0) {
53
+ const d = f.rest[0];
54
+ if (d.type._tag === "TypeLiteral" && "propertySignatures" in d.type)
55
+ for (const y of d.type.propertySignatures) {
56
+ const b = `${l}.${y.name.toString()}`, S = m({
57
+ parent: b,
58
+ property: y.type,
59
+ meta: {
60
+ required: !g(y.type),
61
+ nullableOrUndefined: g(y.type)
62
+ }
63
+ });
64
+ if (S && typeof S == "object" && "type" in S && (o[b] = S, S.type === "multiple" && n.AST.isTupleType(y.type) && y.type.rest && y.type.rest.length > 0)) {
65
+ const O = y.type.rest[0];
66
+ if (O.type._tag === "TypeLiteral" && "propertySignatures" in O.type)
67
+ for (const v of O.type.propertySignatures) {
68
+ const M = `${b}.${v.name.toString()}`, x = m({
69
+ parent: M,
70
+ property: v.type,
71
+ meta: {
72
+ required: !g(v.type),
73
+ nullableOrUndefined: g(v.type)
74
+ }
75
+ });
76
+ x && typeof x == "object" && "type" in x && (o[M] = x);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ } else {
82
+ const f = m({
83
+ parent: l,
84
+ property: r.type,
85
+ meta: { required: u, nullableOrUndefined: a }
86
+ });
87
+ o[l] = f;
88
+ }
49
89
  }
50
- } else if ("propertySignatures" in b)
90
+ } else if ("propertySignatures" in A)
51
91
  Object.assign(
52
- l,
92
+ o,
53
93
  m({
54
- parent: u,
55
- propertySignatures: b.propertySignatures,
56
- meta: { required: p, nullableOrUndefined: a }
94
+ parent: l,
95
+ propertySignatures: A.propertySignatures,
96
+ meta: { required: u, nullableOrUndefined: a }
57
97
  })
58
98
  );
59
99
  else if (n.AST.isTupleType(r.type))
60
100
  if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
61
- const c = r.type.rest[0].type;
62
- if (c._tag === "TypeLiteral" && "propertySignatures" in c)
63
- for (const s of c.propertySignatures) {
64
- const S = `${u}.${s.name.toString()}`;
101
+ const h = r.type.rest[0].type;
102
+ if (h._tag === "TypeLiteral" && "propertySignatures" in h)
103
+ for (const s of h.propertySignatures) {
104
+ const f = `${l}.${s.name.toString()}`;
65
105
  if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
66
106
  const d = s.type.rest[0].type;
67
107
  if (d._tag === "TypeLiteral" && "propertySignatures" in d)
68
- for (const T of d.propertySignatures) {
69
- const h = `${S}.${T.name.toString()}`, x = m({
70
- parent: h,
71
- property: T.type,
108
+ for (const y of d.propertySignatures) {
109
+ const b = `${f}.${y.name.toString()}`, S = m({
110
+ parent: b,
111
+ property: y.type,
72
112
  meta: {
73
- required: !g(T.type),
74
- nullableOrUndefined: g(T.type)
113
+ required: !g(y.type),
114
+ nullableOrUndefined: g(y.type)
75
115
  }
76
116
  });
77
- l[h] = x;
117
+ o[b] = S;
78
118
  }
79
119
  else
80
- l[S] = {
120
+ o[f] = {
81
121
  type: "multiple",
82
122
  members: s.type.elements,
83
123
  rest: s.type.rest,
@@ -86,40 +126,40 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
86
126
  };
87
127
  } else {
88
128
  const d = m({
89
- parent: S,
129
+ parent: f,
90
130
  property: s.type,
91
131
  meta: {
92
132
  required: !g(s.type),
93
133
  nullableOrUndefined: g(s.type)
94
134
  }
95
135
  });
96
- l[S] = d;
136
+ o[f] = d;
97
137
  }
98
138
  }
99
139
  } else
100
- l[u] = {
140
+ o[l] = {
101
141
  type: "multiple",
102
142
  members: r.type.elements,
103
143
  rest: r.type.rest,
104
- required: p,
144
+ required: u,
105
145
  nullableOrUndefined: a
106
146
  };
107
147
  else {
108
- const y = m({
109
- parent: u,
148
+ const T = m({
149
+ parent: l,
110
150
  property: r.type,
111
- meta: { required: p, nullableOrUndefined: a }
151
+ meta: { required: u, nullableOrUndefined: a }
112
152
  });
113
- l[u] = y;
153
+ o[l] = T;
114
154
  }
115
155
  }
116
- return l;
156
+ return o;
117
157
  }
118
158
  if (t) {
119
- const r = L(t);
159
+ const r = N(t);
120
160
  if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
121
161
  const a = t.types.find(
122
- (p) => p._tag !== "UndefinedKeyword" && p !== n.Null.ast
162
+ (u) => u._tag !== "UndefinedKeyword" && u !== n.Null.ast
123
163
  );
124
164
  return "propertySignatures" in a ? m({
125
165
  propertySignatures: a.propertySignatures,
@@ -128,7 +168,7 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
128
168
  }) : t.types.every(n.AST.isLiteral) ? {
129
169
  ...e,
130
170
  type: "select",
131
- members: t.types.map((p) => p.literal)
171
+ members: t.types.map((u) => u.literal)
132
172
  } : {
133
173
  ...e,
134
174
  ...m({
@@ -145,11 +185,11 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
145
185
  members: t.elements,
146
186
  rest: t.rest
147
187
  };
148
- const u = n.AST.getAnnotation(
188
+ const l = n.AST.getAnnotation(
149
189
  t,
150
190
  n.AST.JSONSchemaAnnotationId
151
- ).pipe(f.getOrElse(() => ({})));
152
- return e = { ...e, ...u }, "from" in t ? m({
191
+ ).pipe(c.getOrElse(() => ({})));
192
+ return e = { ...e, ...l }, "from" in t ? m({
153
193
  parent: i,
154
194
  meta: e,
155
195
  property: t.from
@@ -157,50 +197,50 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
157
197
  t,
158
198
  n.AST.TitleAnnotationId
159
199
  ).pipe(
160
- f.getOrElse(() => "unknown")
200
+ c.getOrElse(() => "unknown")
161
201
  ), e);
162
202
  }
163
- return l;
164
- }, v = (e) => {
203
+ return o;
204
+ }, q = (e) => {
165
205
  const i = e.ast, t = {};
166
206
  if (i._tag === "Transformation" || i._tag === "Refinement")
167
- return v(n.make(i.from));
207
+ return q(n.make(i.from));
168
208
  if ("propertySignatures" in i) {
169
- const o = m({
209
+ const p = m({
170
210
  propertySignatures: i.propertySignatures
171
211
  });
172
- if (Object.values(o).every((r) => r && "type" in r))
173
- return o;
174
- const l = (r, u = "") => {
212
+ if (Object.values(p).every((r) => r && "type" in r))
213
+ return p;
214
+ const o = (r, l = "") => {
175
215
  for (const a in r) {
176
- const p = u ? `${u}.${a}` : a;
177
- r[a] && typeof r[a] == "object" && "type" in r[a] ? t[p] = r[a] : r[a] && typeof r[a] == "object" && l(r[a], p);
216
+ const u = l ? `${l}.${a}` : a;
217
+ r[a] && typeof r[a] == "object" && "type" in r[a] ? t[u] = r[a] : r[a] && typeof r[a] == "object" && o(r[a], u);
178
218
  }
179
219
  };
180
- l(o);
220
+ o(p);
181
221
  }
182
222
  return t;
183
- }, N = (e) => n.extend(e, n.Struct({})), _ = (e) => {
184
- const i = v(e), t = O(
223
+ }, w = (e) => n.extend(e, n.Struct({})), $ = (e) => {
224
+ const i = q(e), t = L(
185
225
  e.ast,
186
- f.liftPredicate((o) => o._tag === "Refinement" && "filter" in o),
187
- f.flatMap((o) => n.AST.getJSONSchemaAnnotation(o)),
188
- f.filter((o) => "items" in o),
189
- f.filterMap(
190
- ({ items: o }) => n.decodeUnknownOption(M)(o)
226
+ c.liftPredicate((p) => p._tag === "Refinement" && "filter" in p),
227
+ c.flatMap((p) => n.AST.getJSONSchemaAnnotation(p)),
228
+ c.filter((p) => "items" in p),
229
+ c.filterMap(
230
+ ({ items: p }) => n.decodeUnknownOption(_)(p)
191
231
  ),
192
- f.zipWith(
232
+ c.zipWith(
193
233
  n.AST.getMessageAnnotation(e.ast),
194
- (o, l) => ({
195
- items: o,
196
- message: l("")
234
+ (p, o) => ({
235
+ items: p,
236
+ message: o("")
197
237
  })
198
238
  ),
199
- f.getOrUndefined
239
+ c.getOrUndefined
200
240
  );
201
241
  return { schema: e, meta: i, filterItems: t };
202
- }, k = (e) => {
203
- const { trans: i } = A();
242
+ }, K = (e) => {
243
+ const { trans: i } = U();
204
244
  let t;
205
245
  switch (e.type) {
206
246
  case "string":
@@ -282,7 +322,7 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
282
322
  message: () => i("validation.empty")
283
323
  })
284
324
  ) : t = n.NullishOr(t), n.standardSchemaV1(t);
285
- }, w = (e, i) => n.NullOr(e).pipe(
325
+ }, P = (e, i) => n.NullOr(e).pipe(
286
326
  n.transform(n.typeSchema(e), {
287
327
  decode: (t) => t ?? i(),
288
328
  encode: (t) => t
@@ -290,8 +330,8 @@ const M = n.NonEmptyArray(n.String), L = (e) => n.AST.isUnion(e) && e.types.find
290
330
  );
291
331
  export {
292
332
  m as createMeta,
293
- N as duplicateSchema,
294
- k as generateInputStandardSchemaFromFieldMeta,
295
- _ as generateMetaFromSchema,
296
- w as nullableInput
333
+ w as duplicateSchema,
334
+ K as generateInputStandardSchemaFromFieldMeta,
335
+ $ as generateMetaFromSchema,
336
+ P as nullableInput
297
337
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as w, computed as f, onBeforeMount as E, watch as j, createElementBlock as v, openBlock as b, withModifiers as F, createElementVNode as M, unref as c, renderSlot as p, createCommentVNode as k, Fragment as V } from "vue";
2
2
  import { useStore as g } from "@tanstack/vue-form";
3
- import { getOmegaStore as B } from "./vue-components.es25.js";
3
+ import { getOmegaStore as B } from "./vue-components.es24.js";
4
4
  import { provideOmegaErrors as C } from "./vue-components.es8.js";
5
5
  import { useOmegaForm as I } from "./vue-components.es9.js";
6
6
  const $ = ["disabled"], N = /* @__PURE__ */ w({
@@ -1,92 +1,13 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
- import { useStore as z } from "@tanstack/vue-form";
4
- import { useOmegaErrors as A } from "./vue-components.es8.js";
5
- import D from "./vue-components.es27.js";
6
-
7
- const J = /* @__PURE__ */ w({
8
- inheritAttrs: !1,
9
- __name: "OmegaInternalInput",
10
- props: {
11
- field: {},
12
- meta: {},
13
- label: {},
14
- options: {},
15
- type: {},
16
- validators: {}
17
- },
18
- setup(c) {
19
- const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
- () => (
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
- )
24
- ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
- f(
26
- () => !!n.value,
27
- () => {
28
- y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
- o.setValue(
30
- e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
- );
32
- });
33
- }
34
- ), d(() => {
35
- !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
- });
37
- const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
- k(() => {
39
- (E.value || V === "onChange") && (s.value = !0);
40
- });
41
- const u = () => {
42
- s.value = !0;
43
- };
44
- d(() => {
45
- n.value && u();
46
- });
47
- const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
- f(
49
- () => r.value.meta.errors,
50
- () => {
51
- r.value.meta.errors.length ? h({
52
- inputId: l,
53
- errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
- label: e.label
55
- }) : b(l);
56
- }
57
- );
58
- const i = a(() => ({
59
- id: l,
60
- required: e.meta?.required,
61
- minLength: e.meta?.type === "string" && e.meta?.minLength,
62
- maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
- max: e.meta?.type === "number" && e.meta?.maximum,
64
- min: e.meta?.type === "number" && e.meta?.minimum,
65
- name: e.field.name,
66
- modelValue: e.field.state.value,
67
- errorMessages: p.value,
68
- error: !!p.value.length,
69
- field: e.field,
70
- setRealDirty: u,
71
- type: m.value,
72
- label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
- options: e.options
74
- }));
75
- return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
- _("div", {
77
- class: q(t.$attrs.class),
78
- onFocusout: u
79
- }, [
80
- F(v) ? (S(), L(D, T({
81
- key: 0,
82
- "input-props": i.value
83
- }, t.$attrs, {
84
- "vuetify-value": i.value.field.state.value
85
- }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
- ], 34)
87
- ]);
88
- }
89
- });
1
+ import { useStore as u } from "@tanstack/vue-form";
2
+ import { computed as f } from "vue";
3
+ function c(o, t) {
4
+ return f(() => t ? u(o.store, (n) => {
5
+ const r = {};
6
+ for (const e of t)
7
+ r[e] = n[e];
8
+ return r;
9
+ }).value : {});
10
+ }
90
11
  export {
91
- J as default
12
+ c as getOmegaStore
92
13
  };
@@ -1,13 +1,92 @@
1
- import { useStore as u } from "@tanstack/vue-form";
2
- import { computed as f } from "vue";
3
- function c(o, t) {
4
- return f(() => t ? u(o.store, (n) => {
5
- const r = {};
6
- for (const e of t)
7
- r[e] = n[e];
8
- return r;
9
- }).value : {});
10
- }
1
+ (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
+ import { useStore as z } from "@tanstack/vue-form";
4
+ import { useOmegaErrors as A } from "./vue-components.es8.js";
5
+ import D from "./vue-components.es27.js";
6
+
7
+ const J = /* @__PURE__ */ w({
8
+ inheritAttrs: !1,
9
+ __name: "OmegaInternalInput",
10
+ props: {
11
+ field: {},
12
+ meta: {},
13
+ label: {},
14
+ options: {},
15
+ type: {},
16
+ validators: {}
17
+ },
18
+ setup(c) {
19
+ const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
+ () => (
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
+ )
24
+ ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
+ f(
26
+ () => !!n.value,
27
+ () => {
28
+ y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
+ o.setValue(
30
+ e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
+ );
32
+ });
33
+ }
34
+ ), d(() => {
35
+ !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
+ });
37
+ const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
+ k(() => {
39
+ (E.value || V === "onChange") && (s.value = !0);
40
+ });
41
+ const u = () => {
42
+ s.value = !0;
43
+ };
44
+ d(() => {
45
+ n.value && u();
46
+ });
47
+ const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
+ f(
49
+ () => r.value.meta.errors,
50
+ () => {
51
+ r.value.meta.errors.length ? h({
52
+ inputId: l,
53
+ errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
+ label: e.label
55
+ }) : b(l);
56
+ }
57
+ );
58
+ const i = a(() => ({
59
+ id: l,
60
+ required: e.meta?.required,
61
+ minLength: e.meta?.type === "string" && e.meta?.minLength,
62
+ maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
+ max: e.meta?.type === "number" && e.meta?.maximum,
64
+ min: e.meta?.type === "number" && e.meta?.minimum,
65
+ name: e.field.name,
66
+ modelValue: e.field.state.value,
67
+ errorMessages: p.value,
68
+ error: !!p.value.length,
69
+ field: e.field,
70
+ setRealDirty: u,
71
+ type: m.value,
72
+ label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
+ options: e.options
74
+ }));
75
+ return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
+ _("div", {
77
+ class: q(t.$attrs.class),
78
+ onFocusout: u
79
+ }, [
80
+ F(v) ? (S(), L(D, T({
81
+ key: 0,
82
+ "input-props": i.value
83
+ }, t.$attrs, {
84
+ "vuetify-value": i.value.field.state.value
85
+ }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
+ ], 34)
87
+ ]);
88
+ }
89
+ });
11
90
  export {
12
- c as getOmegaStore
91
+ J as default
13
92
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es24.js";
1
+ import f from "./vue-components.es25.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as d, inject as f, computed as r, createBlock as n, openBlock as m, resolveDynamicComponent as c, withCtx as l, createCommentVNode as v, mergeProps as y, renderSlot as g, normalizeProps as h, guardReactiveProps as b } from "vue";
2
2
  import { generateInputStandardSchemaFromFieldMeta as C } from "./vue-components.es10.js";
3
- import F from "./vue-components.es24.js";
3
+ import F from "./vue-components.es25.js";
4
4
  const P = /* @__PURE__ */ d({
5
5
  inheritAttrs: !1,
6
6
  __name: "OmegaInput",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "0.14.6",
3
+ "version": "0.15.1",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "@tanstack/vue-form": "^1.2.4",
@@ -50,8 +50,8 @@
50
50
  "dependencies": {
51
51
  "highlight.js": "^11.11.1",
52
52
  "vue3-highlightjs": "^1.0.5",
53
- "@effect-app/vue": "2.51.13",
54
- "effect-app": "3.1.0"
53
+ "@effect-app/vue": "2.51.14",
54
+ "effect-app": "3.2.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "pnpm build:run",
@@ -292,13 +292,76 @@ export const createMeta = <T = any>(
292
292
  }
293
293
  }
294
294
  } else {
295
- // If no struct members, process as regular union
296
- const newMeta = createMeta<T>({
297
- parent: key,
298
- property: p.type,
299
- meta: { required: isRequired, nullableOrUndefined },
300
- })
301
- acc[key as NestedKeyOf<T>] = newMeta as FieldMeta
295
+ // Check if any of the union types are arrays (TupleType)
296
+ const arrayTypes = nonNullTypes.filter(S.AST.isTupleType)
297
+ if (arrayTypes.length > 0) {
298
+ const arrayType = arrayTypes[0] // Take the first array type
299
+
300
+ acc[key as NestedKeyOf<T>] = {
301
+ type: "multiple",
302
+ members: arrayType.elements,
303
+ rest: arrayType.rest,
304
+ required: isRequired,
305
+ nullableOrUndefined
306
+ } as FieldMeta
307
+
308
+ // If the array has struct elements, also create metadata for their properties
309
+ if (arrayType.rest && arrayType.rest.length > 0) {
310
+ const restElement = arrayType.rest[0]
311
+ if (restElement.type._tag === "TypeLiteral" && "propertySignatures" in restElement.type) {
312
+
313
+ for (const prop of restElement.type.propertySignatures) {
314
+ const propKey = `${key}.${prop.name.toString()}`
315
+
316
+ const propMeta = createMeta<T>({
317
+ parent: propKey,
318
+ property: prop.type,
319
+ meta: {
320
+ required: !isNullableOrUndefined(prop.type),
321
+ nullableOrUndefined: isNullableOrUndefined(prop.type)
322
+ }
323
+ })
324
+
325
+ // add to accumulator if valid
326
+ if (propMeta && typeof propMeta === 'object' && 'type' in propMeta) {
327
+ acc[propKey as NestedKeyOf<T>] = propMeta as FieldMeta
328
+
329
+ if (propMeta.type === "multiple" && S.AST.isTupleType(prop.type) && prop.type.rest && prop.type.rest.length > 0) {
330
+ const nestedRestElement = prop.type.rest[0]
331
+ if (nestedRestElement.type._tag === "TypeLiteral" && "propertySignatures" in nestedRestElement.type) {
332
+
333
+ for (const nestedProp of nestedRestElement.type.propertySignatures) {
334
+ const nestedPropKey = `${propKey}.${nestedProp.name.toString()}`
335
+
336
+ const nestedPropMeta = createMeta<T>({
337
+ parent: nestedPropKey,
338
+ property: nestedProp.type,
339
+ meta: {
340
+ required: !isNullableOrUndefined(nestedProp.type),
341
+ nullableOrUndefined: isNullableOrUndefined(nestedProp.type)
342
+ }
343
+ })
344
+
345
+ // add to accumulator if valid
346
+ if (nestedPropMeta && typeof nestedPropMeta === 'object' && 'type' in nestedPropMeta) {
347
+ acc[nestedPropKey as NestedKeyOf<T>] = nestedPropMeta as FieldMeta
348
+ }
349
+ }
350
+ }
351
+ }
352
+ }
353
+ }
354
+ }
355
+ }
356
+ } else {
357
+ // If no struct members and no arrays, process as regular union
358
+ const newMeta = createMeta<T>({
359
+ parent: key,
360
+ property: p.type,
361
+ meta: { required: isRequired, nullableOrUndefined },
362
+ })
363
+ acc[key as NestedKeyOf<T>] = newMeta as FieldMeta
364
+ }
302
365
  }
303
366
  } else if ("propertySignatures" in typeToProcess) {
304
367
  Object.assign(
@@ -381,6 +444,8 @@ export const createMeta = <T = any>(
381
444
  property: p.type,
382
445
  meta: { required: isRequired, nullableOrUndefined },
383
446
  })
447
+
448
+
384
449
  acc[key as NestedKeyOf<T>] = newMeta as FieldMeta
385
450
  }
386
451
  }