@effect-app/vue-components 0.0.1 → 0.0.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,3 +1 @@
1
- import TestComponent from './TestComponent.vue';
2
1
  export * from "./OmegaForm";
3
- export { TestComponent };
@@ -1 +1 @@
1
- .cool{color:pink}.super[data-v-24ab8834]{color:#0ff}fieldset[data-v-0de09910]{display:contents}.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}.v-enter-from[data-v-55fda615],.v-leave-to[data-v-55fda615]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-55fda615],.v-leave-active[data-v-55fda615]{display:grid;transition:all .15s}.v-enter-to[data-v-55fda615],.v-leave-from[data-v-55fda615]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-55fda615]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-55fda615]{min-height:0}.error-list[data-v-55fda615]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:start}@container (max-width: 28.125rem){.error-list[data-v-55fda615]{grid-template-columns:auto 1fr}.error-link[data-v-55fda615]{grid-column:1 / -1;justify-self:end;padding-bottom:16px}}@container (max-width: 18.75rem){.error-list[data-v-55fda615]{grid-template-columns:1fr}.error-message[data-v-55fda615]{grid-column:1 / -1}}.error-item[data-v-55fda615]{display:contents}a[data-v-55fda615]{min-width:min-content}.error-link[data-v-55fda615]{color:inherit;text-decoration:none;display:inline-flex;align-items:center}
1
+ fieldset[data-v-0de09910]{display:contents}.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}.v-enter-from[data-v-55fda615],.v-leave-to[data-v-55fda615]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-55fda615],.v-leave-active[data-v-55fda615]{display:grid;transition:all .15s}.v-enter-to[data-v-55fda615],.v-leave-from[data-v-55fda615]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-55fda615]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-55fda615]{min-height:0}.error-list[data-v-55fda615]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:start}@container (max-width: 28.125rem){.error-list[data-v-55fda615]{grid-template-columns:auto 1fr}.error-link[data-v-55fda615]{grid-column:1 / -1;justify-self:end;padding-bottom:16px}}@container (max-width: 18.75rem){.error-list[data-v-55fda615]{grid-template-columns:1fr}.error-message[data-v-55fda615]{grid-column:1 / -1}}.error-item[data-v-55fda615]{display:contents}a[data-v-55fda615]{min-width:min-content}.error-link[data-v-55fda615]{color:inherit;text-decoration:none;display:inline-flex;align-items:center}
@@ -1,38 +1,19 @@
1
- import { defineComponent as A, ref as C, createElementBlock as S, openBlock as c, createTextVNode as M, createElementVNode as k, toDisplayString as E, computed as O, readonly as Se, provide as ne, inject as re, watch as L, withModifiers as Oe, unref as f, renderSlot as ae, useId as _e, onMounted as Ee, watchEffect as Te, resolveComponent as U, createBlock as v, createCommentVNode as w, normalizeClass as ke, createVNode as q, resolveDynamicComponent as I, withCtx as _, Transition as we, Fragment as Y, renderList as Z, defineCustomElement as N } from "vue";
2
- import { useStore as $, useForm as Ie } from "@tanstack/vue-form";
3
- import { S as s, pipe as Ae, Option as h } from "effect-app";
4
- import { VTextField as ee, VSelect as Me } from "vuetify/components";
5
- import { mdiRefresh as qe, mdiLink as $e } from "@mdi/js";
6
- const Le = { class: "cool" }, Ue = { class: "super" }, Ce = /* @__PURE__ */ A({
7
- __name: "TestComponent",
8
- props: {
9
- test: {}
10
- },
11
- setup(e) {
12
- const n = C("COOL");
13
- return (t, r) => (c(), S("div", Le, [
14
- r[0] || (r[0] = M("I'm so ")),
15
- k("span", Ue, E(n.value), 1),
16
- M(" " + E(t.test), 1)
17
- ]));
18
- }
19
- }), V = (e, n) => {
20
- const t = e.__vccOpts || e;
21
- for (const [r, o] of n)
22
- t[r] = o;
23
- return t;
24
- }, Ne = /* @__PURE__ */ V(Ce, [["__scopeId", "data-v-24ab8834"]]);
25
- function Ve(e, n) {
26
- return O(() => n ? $(e.store, (r) => {
1
+ import { computed as S, ref as ee, readonly as Se, provide as te, inject as ne, defineComponent as q, watch as U, createElementBlock as E, openBlock as c, withModifiers as Oe, unref as f, createElementVNode as T, renderSlot as re, useId as Ee, onMounted as _e, watchEffect as ke, resolveComponent as L, createBlock as v, createCommentVNode as w, normalizeClass as Te, createVNode as A, resolveDynamicComponent as I, withCtx as O, Transition as we, toDisplayString as k, Fragment as H, renderList as Q, createTextVNode as X, defineCustomElement as $ } from "vue";
2
+ import { useStore as M, useForm as Ie } from "@tanstack/vue-form";
3
+ import { S as i, pipe as Ae, Option as h } from "effect-app";
4
+ import { VTextField as Y, VSelect as Me } from "vuetify/components";
5
+ import { mdiRefresh as qe, mdiLink as Ue } from "@mdi/js";
6
+ function Le(e, n) {
7
+ return S(() => n ? M(e.store, (r) => {
27
8
  const o = {};
28
9
  for (const a of n)
29
10
  o[a] = r[a];
30
11
  return o;
31
12
  }).value : {});
32
13
  }
33
- const F = Symbol();
34
- function se(e, n) {
35
- const t = C([]), r = (u) => {
14
+ const N = Symbol();
15
+ function ae(e, n) {
16
+ const t = ee([]), r = (u) => {
36
17
  t.value = t.value.filter((l) => l.inputId !== u);
37
18
  }, o = (u) => {
38
19
  r(u.inputId), t.value.push(u);
@@ -46,25 +27,25 @@ function se(e, n) {
46
27
  formSubmissionAttempts: e,
47
28
  generalErrors: n
48
29
  };
49
- return ne(F, d), d;
30
+ return te(N, d), d;
50
31
  }
51
- function x() {
52
- const e = re(F);
32
+ function V() {
33
+ const e = ne(N);
53
34
  if (!e)
54
35
  throw new Error("useOmegaErrors must be used within an OmegaForm provider");
55
36
  return e;
56
37
  }
57
- const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
38
+ const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
58
39
  __proto__: null,
59
- OmegaErrorsKey: F,
60
- provideOmegaErrors: se,
61
- useOmegaErrors: x
62
- }, Symbol.toStringTag, { value: "Module" })), ie = Symbol(), oe = () => {
63
- const e = re(ie);
40
+ OmegaErrorsKey: N,
41
+ provideOmegaErrors: ae,
42
+ useOmegaErrors: V
43
+ }, Symbol.toStringTag, { value: "Module" })), ie = Symbol(), se = () => {
44
+ const e = ne(ie);
64
45
  if (!e)
65
46
  throw new Error("useIntl must be used within a IntlProvider");
66
47
  return e;
67
- }, ot = (e) => ne(ie, e), xe = s.NonEmptyArray(s.String), Be = (e) => s.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKeyword" || n === s.Null.ast), je = (e) => !e || !s.AST.isUnion(e) ? !1 : e.types.find((n) => n._tag === "UndefinedKeyword") ? "undefined" : e.types.find((n) => n === s.Null.ast) ? "null" : !1, y = ({ meta: e = {}, parent: n = "", property: t, propertySignatures: r }, o = {}) => {
48
+ }, rt = (e) => te(ie, e), Ne = i.NonEmptyArray(i.String), Ve = (e) => i.AST.isUnion(e) && e.types.find((n) => n._tag === "UndefinedKeyword" || n === i.Null.ast), Ce = (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, y = ({ meta: e = {}, parent: n = "", property: t, propertySignatures: r }, o = {}) => {
68
49
  if (t && t._tag === "Transformation")
69
50
  return y({
70
51
  parent: n,
@@ -78,10 +59,10 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
78
59
  });
79
60
  if (r) {
80
61
  for (const a of r) {
81
- const d = n ? `${n}.${a.name.toString()}` : a.name.toString(), u = je(a.type), l = e.required ?? !u;
62
+ const d = n ? `${n}.${a.name.toString()}` : a.name.toString(), u = Ce(a.type), l = e.required ?? !u;
82
63
  let p = a.type;
83
- if (s.AST.isUnion(a.type) && (p = a.type.types.find(
84
- (m) => m._tag !== "UndefinedKeyword" && m !== s.Null.ast
64
+ if (i.AST.isUnion(a.type) && (p = a.type.types.find(
65
+ (m) => m._tag !== "UndefinedKeyword" && m !== i.Null.ast
85
66
  )), "propertySignatures" in p)
86
67
  Object.assign(
87
68
  o,
@@ -103,16 +84,16 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
103
84
  return o;
104
85
  }
105
86
  if (t) {
106
- const a = Be(t);
107
- if (Object.hasOwnProperty.call(e, "required") || (e.required = !a), s.AST.isUnion(t)) {
87
+ const a = Ve(t);
88
+ if (Object.hasOwnProperty.call(e, "required") || (e.required = !a), i.AST.isUnion(t)) {
108
89
  const u = t.types.find(
109
- (l) => l._tag !== "UndefinedKeyword" && l !== s.Null.ast
90
+ (l) => l._tag !== "UndefinedKeyword" && l !== i.Null.ast
110
91
  );
111
92
  return "propertySignatures" in u ? y({
112
93
  propertySignatures: u.propertySignatures,
113
94
  parent: n,
114
95
  meta: e
115
- }) : t.types.every(s.AST.isLiteral) ? {
96
+ }) : t.types.every(i.AST.isLiteral) ? {
116
97
  ...e,
117
98
  type: "select",
118
99
  members: t.types.map((l) => l.literal)
@@ -125,32 +106,32 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
125
106
  })
126
107
  };
127
108
  }
128
- if (s.AST.isTupleType(t))
109
+ if (i.AST.isTupleType(t))
129
110
  return {
130
111
  ...e,
131
112
  type: "multiple",
132
113
  members: t.elements
133
114
  };
134
- const d = s.AST.getAnnotation(
115
+ const d = i.AST.getAnnotation(
135
116
  t,
136
- s.AST.JSONSchemaAnnotationId
117
+ i.AST.JSONSchemaAnnotationId
137
118
  ).pipe(h.getOrElse(() => ({})));
138
119
  return e = { ...e, ...d }, "from" in t ? y({
139
120
  parent: n,
140
121
  meta: e,
141
122
  property: t.from
142
- }) : (e.type = s.AST.getAnnotation(
123
+ }) : (e.type = i.AST.getAnnotation(
143
124
  t,
144
- s.AST.TitleAnnotationId
125
+ i.AST.TitleAnnotationId
145
126
  ).pipe(
146
127
  h.getOrElse(() => "unknown")
147
128
  ), e);
148
129
  }
149
130
  return o;
150
- }, le = (e) => {
131
+ }, oe = (e) => {
151
132
  const n = e.ast, t = {};
152
133
  if (n._tag === "Transformation" || n._tag === "Refinement")
153
- return le(s.make(n.from));
134
+ return oe(i.make(n.from));
154
135
  if ("propertySignatures" in n) {
155
136
  const r = y({
156
137
  propertySignatures: n.propertySignatures
@@ -166,17 +147,17 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
166
147
  o(r);
167
148
  }
168
149
  return t;
169
- }, Ke = (e) => s.extend(e, s.Struct({})), ue = (e) => {
170
- const n = le(e), t = Ae(
150
+ }, Fe = (e) => i.extend(e, i.Struct({})), le = (e) => {
151
+ const n = oe(e), t = Ae(
171
152
  e.ast,
172
153
  h.liftPredicate((r) => r._tag === "Refinement" && "filter" in r),
173
- h.flatMap((r) => s.AST.getJSONSchemaAnnotation(r)),
154
+ h.flatMap((r) => i.AST.getJSONSchemaAnnotation(r)),
174
155
  h.filter((r) => "items" in r),
175
156
  h.filterMap(
176
- ({ items: r }) => s.decodeUnknownOption(xe)(r)
157
+ ({ items: r }) => i.decodeUnknownOption(Ne)(r)
177
158
  ),
178
159
  h.zipWith(
179
- s.AST.getMessageAnnotation(e.ast),
160
+ i.AST.getMessageAnnotation(e.ast),
180
161
  (r, o) => ({
181
162
  items: r,
182
163
  message: o("")
@@ -185,51 +166,51 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
185
166
  h.getOrUndefined
186
167
  );
187
168
  return { schema: e, meta: n, filterItems: t };
188
- }, me = (e) => {
189
- const { trans: n } = oe();
169
+ }, ue = (e) => {
170
+ const { trans: n } = se();
190
171
  let t;
191
172
  switch (e.type) {
192
173
  case "string":
193
- t = s.String.annotations({
174
+ t = i.String.annotations({
194
175
  message: () => n("validation.empty")
195
- }), e.format === "email" && (t = s.compose(
176
+ }), e.format === "email" && (t = i.compose(
196
177
  t,
197
- s.Email.annotations({
178
+ i.Email.annotations({
198
179
  message: () => n("validation.email.invalid")
199
180
  })
200
181
  )), e.required && t.annotations({
201
182
  message: () => n("validation.empty")
202
- }), e.maxLength && (t = t.pipe(s.maxLength(e.maxLength)).annotations({
183
+ }), e.maxLength && (t = t.pipe(i.maxLength(e.maxLength)).annotations({
203
184
  message: () => n("validation.string.maxLength", {
204
185
  maxLength: e.maxLength
205
186
  })
206
- })), e.minLength && (t = t.pipe(s.minLength(e.minLength)).annotations({
187
+ })), e.minLength && (t = t.pipe(i.minLength(e.minLength)).annotations({
207
188
  message: () => n("validation.string.minLength", {
208
189
  minLength: e.minLength
209
190
  })
210
191
  }));
211
192
  break;
212
193
  case "number":
213
- t = s.Number.annotations({
194
+ t = i.Number.annotations({
214
195
  message: () => n("validation.empty")
215
196
  }), e.required && t.annotations({
216
197
  message: () => n("validation.empty")
217
- }), e.minimum && (t = t.pipe(s.greaterThanOrEqualTo(e.minimum)).annotations({
198
+ }), e.minimum && (t = t.pipe(i.greaterThanOrEqualTo(e.minimum)).annotations({
218
199
  message: () => n("validation.number.min", {
219
200
  minimum: e.minimum,
220
201
  isExclusive: !0
221
202
  })
222
- })), e.maximum && (t = t.pipe(s.lessThanOrEqualTo(e.maximum)).annotations({
203
+ })), e.maximum && (t = t.pipe(i.lessThanOrEqualTo(e.maximum)).annotations({
223
204
  message: () => n("validation.number.max", {
224
205
  maximum: e.maximum,
225
206
  isExclusive: !0
226
207
  })
227
- })), e.exclusiveMinimum && (t = t.pipe(s.greaterThan(e.exclusiveMinimum)).annotations({
208
+ })), e.exclusiveMinimum && (t = t.pipe(i.greaterThan(e.exclusiveMinimum)).annotations({
228
209
  message: () => n("validation.number.min", {
229
210
  minimum: e.exclusiveMinimum,
230
211
  isExclusive: !1
231
212
  })
232
- })), e.exclusiveMaximum && (t = t.pipe(s.lessThan(e.exclusiveMaximum)).annotations({
213
+ })), e.exclusiveMaximum && (t = t.pipe(i.lessThan(e.exclusiveMaximum)).annotations({
233
214
  message: () => n("validation.number.max", {
234
215
  maximum: e.exclusiveMaximum,
235
216
  isExclusive: !1
@@ -237,7 +218,7 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
237
218
  }));
238
219
  break;
239
220
  case "select":
240
- t = s.Literal(...e.members).annotations({
221
+ t = i.Literal(...e.members).annotations({
241
222
  message: () => ({
242
223
  message: n("validation.not_a_valid", {
243
224
  type: "select",
@@ -248,7 +229,7 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
248
229
  });
249
230
  break;
250
231
  case "multiple":
251
- t = s.Array(s.String).annotations({
232
+ t = i.Array(i.String).annotations({
252
233
  message: () => n("validation.not_a_valid", {
253
234
  type: "multiple",
254
235
  message: e.members.join(", ")
@@ -256,26 +237,26 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
256
237
  });
257
238
  break;
258
239
  case "boolean":
259
- t = s.Boolean;
240
+ t = i.Boolean;
260
241
  break;
261
242
  // todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
262
243
  case "unknown":
263
- t = s.Unknown;
244
+ t = i.Unknown;
264
245
  break;
265
246
  }
266
247
  return e.required ? t.pipe(
267
- s.annotations({
248
+ i.annotations({
268
249
  message: () => n("validation.empty")
269
250
  })
270
- ) : t = s.NullishOr(t), s.standardSchemaV1(t);
271
- }, Pe = (e, n) => s.NullOr(e).pipe(
272
- s.transform(s.typeSchema(e), {
251
+ ) : t = i.NullishOr(t), i.standardSchemaV1(t);
252
+ }, xe = (e, n) => i.NullOr(e).pipe(
253
+ i.transform(i.typeSchema(e), {
273
254
  decode: (t) => t ?? n(),
274
255
  encode: (t) => t
275
256
  })
276
- ), de = (e, n) => {
257
+ ), me = (e, n) => {
277
258
  if (!e) throw new Error("Schema is required");
278
- const t = s.standardSchemaV1(e), { filterItems: r, meta: o } = ue(e), a = Ie({
259
+ const t = i.standardSchemaV1(e), { filterItems: r, meta: o } = le(e), a = Ie({
279
260
  ...n,
280
261
  validators: {
281
262
  onSubmit: t,
@@ -291,7 +272,7 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
291
272
  } : void 0
292
273
  });
293
274
  return Object.assign(a, { meta: o, filterItems: r });
294
- }, Re = ["disabled"], De = /* @__PURE__ */ A({
275
+ }, Be = ["disabled"], je = /* @__PURE__ */ q({
295
276
  __name: "OmegaWrapper",
296
277
  props: {
297
278
  subscribe: {},
@@ -308,16 +289,16 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
308
289
  onSubmit: { type: Function }
309
290
  },
310
291
  setup(e, { expose: n }) {
311
- const t = e, r = t.form ?? de(t.schema, t), o = $(r.store, (l) => l.isSubmitting);
292
+ const t = e, r = t.form ?? me(t.schema, t), o = M(r.store, (l) => l.isSubmitting);
312
293
  n(r);
313
- const a = Ve(
294
+ const a = Le(
314
295
  r,
315
296
  t.subscribe
316
- ), d = $(
297
+ ), d = M(
317
298
  r.store,
318
299
  (l) => l.submissionAttempts
319
300
  ), u = r.useStore((l) => l.errors);
320
- return L(
301
+ return U(
321
302
  () => [r.filterItems, u.value],
322
303
  () => {
323
304
  const l = r.filterItems;
@@ -335,18 +316,23 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
335
316
  });
336
317
  }), {}) : {} : {};
337
318
  }
338
- ), se(d, u), (l, p) => (c(), S("form", {
319
+ ), ae(d, u), (l, p) => (c(), E("form", {
339
320
  onSubmit: p[0] || (p[0] = Oe((m) => f(r).handleSubmit(), ["prevent", "stop"]))
340
321
  }, [
341
- k("fieldset", { disabled: f(o) }, [
342
- ae(l.$slots, "default", {
322
+ T("fieldset", { disabled: f(o) }, [
323
+ re(l.$slots, "default", {
343
324
  form: f(r),
344
325
  subscribedValues: f(a)
345
326
  }, void 0, !0)
346
- ], 8, Re)
327
+ ], 8, Be)
347
328
  ], 32));
348
329
  }
349
- }), fe = /* @__PURE__ */ V(De, [["__scopeId", "data-v-0de09910"]]), ze = { class: "omega-input" }, Je = /* @__PURE__ */ A({
330
+ }), de = (e, n) => {
331
+ const t = e.__vccOpts || e;
332
+ for (const [r, o] of n)
333
+ t[r] = o;
334
+ return t;
335
+ }, fe = /* @__PURE__ */ de(je, [["__scopeId", "data-v-0de09910"]]), Ke = { class: "omega-input" }, Pe = /* @__PURE__ */ q({
350
336
  __name: "OmegaInternalInput",
351
337
  props: {
352
338
  field: {},
@@ -357,92 +343,92 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
357
343
  validators: {}
358
344
  },
359
345
  setup(e) {
360
- const n = e, t = _e(), r = n.field, o = $(r.store, (i) => i), a = O(() => {
361
- var i, g;
362
- return n.type ? n.type : ((i = n.meta) == null ? void 0 : i.type) === "string" ? n.meta.format === "email" ? "email" : "text" : ((g = n.meta) == null ? void 0 : g.type) || "unknown";
363
- }), d = O(() => o.value.value), u = O(
364
- () => o.value.meta.errors.map((i) => i.message).filter(Boolean)
346
+ const n = e, t = Ee(), r = n.field, o = M(r.store, (s) => s), a = S(() => {
347
+ var s, g;
348
+ return n.type ? n.type : ((s = n.meta) == null ? void 0 : s.type) === "string" ? n.meta.format === "email" ? "email" : "text" : ((g = n.meta) == null ? void 0 : g.type) || "unknown";
349
+ }), d = S(() => o.value.value), u = S(
350
+ () => o.value.meta.errors.map((s) => s.message).filter(Boolean)
365
351
  );
366
- L(
352
+ U(
367
353
  () => [!!d.value],
368
354
  () => {
369
- var i, g;
370
- u.value.length && !d.value && !((i = n.meta) != null && i.required) && r.setValue(
355
+ var s, g;
356
+ u.value.length && !d.value && !((s = n.meta) != null && s.required) && r.setValue(
371
357
  ((g = n.meta) == null ? void 0 : g.nullableOrUndefined) === "undefined" ? void 0 : null
372
358
  );
373
359
  }
374
- ), Ee(() => {
375
- var i, g;
376
- !d.value && !((i = n.meta) != null && i.required) && ((g = n.meta) == null ? void 0 : g.nullableOrUndefined) === "null" && r.setValue(null);
360
+ ), _e(() => {
361
+ var s, g;
362
+ !d.value && !((s = n.meta) != null && s.required) && ((g = n.meta) == null ? void 0 : g.nullableOrUndefined) === "null" && r.setValue(null);
377
363
  });
378
- const l = C(!1), p = () => {
364
+ const l = ee(!1), p = () => {
379
365
  l.value = !0;
380
- }, { addError: m, formSubmissionAttempts: b, removeError: ye } = x();
381
- Te(() => {
366
+ }, { addError: m, formSubmissionAttempts: b, removeError: ye } = V();
367
+ ke(() => {
382
368
  b.value > 0 && (l.value = !0);
383
369
  });
384
- const T = O(() => !l.value && a.value !== "select" ? [] : u.value);
385
- return L(
370
+ const _ = S(() => !l.value && a.value !== "select" ? [] : u.value);
371
+ return U(
386
372
  () => o.value.meta.errors,
387
373
  () => {
388
374
  o.value.meta.errors.length ? m({
389
375
  inputId: t,
390
- errors: o.value.meta.errors.map((i) => i.message).filter(Boolean),
376
+ errors: o.value.meta.errors.map((s) => s.message).filter(Boolean),
391
377
  label: n.label
392
378
  }) : ye(t);
393
379
  }
394
- ), (i, g) => {
395
- var B, j, K, P, R, D, z, J, W, G, H, Q;
396
- const he = U("v-btn");
397
- return c(), S("div", ze, [
398
- a.value === "email" || a.value === "text" ? (c(), v(f(ee), {
380
+ ), (s, g) => {
381
+ var C, F, x, B, j, K, P, R, D, z, J, W;
382
+ const he = L("v-btn");
383
+ return c(), E("div", Ke, [
384
+ a.value === "email" || a.value === "text" ? (c(), v(f(Y), {
399
385
  key: 0,
400
386
  id: f(t),
401
- required: (B = i.meta) == null ? void 0 : B.required,
402
- "min-length": ((j = i.meta) == null ? void 0 : j.type) === "string" && ((K = i.meta) == null ? void 0 : K.minLength),
403
- "max-length": ((P = i.meta) == null ? void 0 : P.type) === "string" && ((R = i.meta) == null ? void 0 : R.maxLength),
387
+ required: (C = s.meta) == null ? void 0 : C.required,
388
+ "min-length": ((F = s.meta) == null ? void 0 : F.type) === "string" && ((x = s.meta) == null ? void 0 : x.minLength),
389
+ "max-length": ((B = s.meta) == null ? void 0 : B.type) === "string" && ((j = s.meta) == null ? void 0 : j.maxLength),
404
390
  type: a.value,
405
- name: i.field.name,
406
- label: `${i.label}${(D = i.meta) != null && D.required ? " *" : ""}`,
407
- "model-value": i.field.state.value,
408
- "error-messages": T.value,
409
- error: !!T.value.length,
410
- "onUpdate:modelValue": i.field.handleChange,
391
+ name: s.field.name,
392
+ label: `${s.label}${(K = s.meta) != null && K.required ? " *" : ""}`,
393
+ "model-value": s.field.state.value,
394
+ "error-messages": _.value,
395
+ error: !!_.value.length,
396
+ "onUpdate:modelValue": s.field.handleChange,
411
397
  onBlur: p
412
398
  }, null, 8, ["id", "required", "min-length", "max-length", "type", "name", "label", "model-value", "error-messages", "error", "onUpdate:modelValue"])) : w("", !0),
413
- a.value === "number" ? (c(), v(f(ee), {
399
+ a.value === "number" ? (c(), v(f(Y), {
414
400
  key: 1,
415
401
  id: f(t),
416
- required: (z = i.meta) == null ? void 0 : z.required,
417
- min: ((J = i.meta) == null ? void 0 : J.type) === "number" && i.meta.minimum,
418
- max: ((W = i.meta) == null ? void 0 : W.type) === "number" && i.meta.maximum,
402
+ required: (P = s.meta) == null ? void 0 : P.required,
403
+ min: ((R = s.meta) == null ? void 0 : R.type) === "number" && s.meta.minimum,
404
+ max: ((D = s.meta) == null ? void 0 : D.type) === "number" && s.meta.maximum,
419
405
  type: a.value,
420
- name: i.field.name,
421
- label: `${i.label}${(G = i.meta) != null && G.required ? " *" : ""}`,
422
- "model-value": i.field.state.value,
423
- "error-messages": T.value,
424
- error: !!T.value.length,
425
- "onUpdate:modelValue": g[0] || (g[0] = (X) => {
426
- i.field.handleChange(Number(X));
406
+ name: s.field.name,
407
+ label: `${s.label}${(z = s.meta) != null && z.required ? " *" : ""}`,
408
+ "model-value": s.field.state.value,
409
+ "error-messages": _.value,
410
+ error: !!_.value.length,
411
+ "onUpdate:modelValue": g[0] || (g[0] = (G) => {
412
+ s.field.handleChange(Number(G));
427
413
  }),
428
414
  onBlur: p
429
415
  }, null, 8, ["id", "required", "min", "max", "type", "name", "label", "model-value", "error-messages", "error"])) : w("", !0),
430
- a.value === "select" || a.value === "multiple" ? (c(), S("div", {
416
+ a.value === "select" || a.value === "multiple" ? (c(), E("div", {
431
417
  key: 2,
432
- class: ke(a.value !== "multiple" && "d-flex align-center")
418
+ class: Te(a.value !== "multiple" && "d-flex align-center")
433
419
  }, [
434
- q(f(Me), {
420
+ A(f(Me), {
435
421
  id: f(t),
436
- required: (H = i.meta) == null ? void 0 : H.required,
422
+ required: (J = s.meta) == null ? void 0 : J.required,
437
423
  multiple: a.value === "multiple",
438
424
  chips: a.value === "multiple",
439
- name: i.field.name,
440
- "model-value": i.field.state.value,
441
- label: `${i.label}${(Q = i.meta) != null && Q.required ? " *" : ""}`,
442
- items: i.options,
443
- "error-messages": T.value,
444
- error: !!T.value.length,
445
- "onUpdate:modelValue": i.field.handleChange,
425
+ name: s.field.name,
426
+ "model-value": s.field.state.value,
427
+ label: `${s.label}${(W = s.meta) != null && W.required ? " *" : ""}`,
428
+ items: s.options,
429
+ "error-messages": _.value,
430
+ error: !!_.value.length,
431
+ "onUpdate:modelValue": s.field.handleChange,
446
432
  onBlur: p
447
433
  }, null, 8, ["id", "required", "multiple", "chips", "name", "model-value", "label", "items", "error-messages", "error", "onUpdate:modelValue"]),
448
434
  a.value !== "multiple" ? (c(), v(he, {
@@ -451,13 +437,13 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
451
437
  "variant-icon": f(qe),
452
438
  class: "mr-2",
453
439
  title: "Reset",
454
- onClick: g[1] || (g[1] = (X) => i.field.handleChange(void 0))
440
+ onClick: g[1] || (g[1] = (G) => s.field.handleChange(void 0))
455
441
  }, null, 8, ["variant-icon"])) : w("", !0)
456
442
  ], 2)) : w("", !0)
457
443
  ]);
458
444
  };
459
445
  }
460
- }), ce = /* @__PURE__ */ A({
446
+ }), ce = /* @__PURE__ */ q({
461
447
  __name: "OmegaInput",
462
448
  props: {
463
449
  form: {},
@@ -468,10 +454,10 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
468
454
  type: {}
469
455
  },
470
456
  setup(e) {
471
- const n = e, t = O(() => n.form.meta[n.name]), r = O(() => {
457
+ const n = e, t = S(() => n.form.meta[n.name]), r = S(() => {
472
458
  if (!t.value)
473
459
  throw new Error("Meta is undefined");
474
- return me(t.value);
460
+ return ue(t.value);
475
461
  });
476
462
  return (o, a) => (c(), v(I(o.form.Field), {
477
463
  name: o.name,
@@ -480,17 +466,17 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
480
466
  ...o.validators
481
467
  }
482
468
  }, {
483
- default: _(({
469
+ default: O(({
484
470
  field: d
485
471
  }) => [
486
- ae(o.$slots, "default", {
472
+ re(o.$slots, "default", {
487
473
  field: d,
488
474
  label: o.label,
489
475
  options: o.options,
490
476
  meta: t.value,
491
477
  type: o.type
492
478
  }, () => [
493
- q(Je, {
479
+ A(Pe, {
494
480
  field: d,
495
481
  label: o.label,
496
482
  options: o.options,
@@ -502,13 +488,13 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
502
488
  _: 3
503
489
  }, 8, ["name", "validators"]));
504
490
  }
505
- }), We = {
491
+ }), Re = {
506
492
  key: 0,
507
493
  class: "error-alert"
508
- }, Ge = { class: "text-h6 mb-3" }, He = { class: "font-weight-medium" }, Qe = { class: "error-message" }, Xe = ["href"], Ye = { key: 1 }, Ze = /* @__PURE__ */ A({
494
+ }, De = { class: "text-h6 mb-3" }, ze = { class: "font-weight-medium" }, Je = { class: "error-message" }, We = ["href"], Ge = { key: 1 }, He = /* @__PURE__ */ q({
509
495
  __name: "OmegaErrors",
510
496
  setup(e) {
511
- const { errors: n, formSubmissionAttempts: t, generalErrors: r } = x(), { trans: o } = oe(), a = O(() => r.value ? r.value.filter(
497
+ const { errors: n, formSubmissionAttempts: t, generalErrors: r } = V(), { trans: o } = se(), a = S(() => r.value ? r.value.filter(
512
498
  (d) => !!d
513
499
  ).flatMap(
514
500
  (d) => Object.values(d).filter((u) => !!u).flatMap(
@@ -518,36 +504,36 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
518
504
  )
519
505
  ) : []);
520
506
  return (d, u) => {
521
- const l = U("v-icon"), p = U("v-alert");
507
+ const l = L("v-icon"), p = L("v-alert");
522
508
  return c(), v(we, null, {
523
- default: _(() => [
524
- f(t) > 0 && (f(n).length || a.value.length) ? (c(), S("div", We, [
525
- q(p, {
509
+ default: O(() => [
510
+ f(t) > 0 && (f(n).length || a.value.length) ? (c(), E("div", Re, [
511
+ A(p, {
526
512
  type: "error",
527
513
  variant: "tonal",
528
514
  role: "alert",
529
515
  "aria-live": "polite",
530
516
  class: "mb-4"
531
517
  }, {
532
- default: _(() => [
533
- k("div", Ge, E(f(o)("form.includes_error")) + ":", 1),
518
+ default: O(() => [
519
+ T("div", De, k(f(o)("form.includes_error")) + ":", 1),
534
520
  f(n).length ? (c(), v(I(f(n).length > 1 ? "ul" : "div"), {
535
521
  key: 0,
536
522
  class: "error-list"
537
523
  }, {
538
- default: _(() => [
539
- (c(!0), S(Y, null, Z(f(n), (m) => (c(), v(I(f(n).length > 1 ? "li" : "div"), {
524
+ default: O(() => [
525
+ (c(!0), E(H, null, Q(f(n), (m) => (c(), v(I(f(n).length > 1 ? "li" : "div"), {
540
526
  key: m.inputId,
541
527
  class: "error-item"
542
528
  }, {
543
- default: _(() => [
544
- k("div", He, E(m.label), 1),
545
- k("div", Qe, [
529
+ default: O(() => [
530
+ T("div", ze, k(m.label), 1),
531
+ T("div", Je, [
546
532
  (c(), v(I(m.errors.length > 1 ? "ul" : "div"), { class: "error-list" }, {
547
- default: _(() => [
548
- (c(!0), S(Y, null, Z(m.errors, (b) => (c(), v(I(m.errors.length > 1 ? "li" : "span"), { key: b }, {
549
- default: _(() => [
550
- M(E(b), 1)
533
+ default: O(() => [
534
+ (c(!0), E(H, null, Q(m.errors, (b) => (c(), v(I(m.errors.length > 1 ? "li" : "span"), { key: b }, {
535
+ default: O(() => [
536
+ X(k(b), 1)
551
537
  ]),
552
538
  _: 2
553
539
  }, 1024))), 128))
@@ -555,19 +541,19 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
555
541
  _: 2
556
542
  }, 1024))
557
543
  ]),
558
- k("a", {
544
+ T("a", {
559
545
  href: `#${m.inputId}`,
560
546
  class: "error-link"
561
547
  }, [
562
- q(l, { icon: f($e) }, null, 8, ["icon"]),
563
- M(" " + E(f(o)("form.fix_input")), 1)
564
- ], 8, Xe)
548
+ A(l, { icon: f(Ue) }, null, 8, ["icon"]),
549
+ X(" " + k(f(o)("form.fix_input")), 1)
550
+ ], 8, We)
565
551
  ]),
566
552
  _: 2
567
553
  }, 1024))), 128))
568
554
  ]),
569
555
  _: 1
570
- })) : (c(), S("span", Ye, E(a.value[0]), 1))
556
+ })) : (c(), E("span", Ge, k(a.value[0]), 1))
571
557
  ]),
572
558
  _: 1
573
559
  })
@@ -577,48 +563,46 @@ const Fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
577
563
  });
578
564
  };
579
565
  }
580
- }), pe = /* @__PURE__ */ V(Ze, [["__scopeId", "data-v-55fda615"]]), ge = N(fe), ve = N(ce), be = N(pe);
581
- function et() {
566
+ }), pe = /* @__PURE__ */ de(He, [["__scopeId", "data-v-55fda615"]]), ge = $(fe), ve = $(ce), be = $(pe);
567
+ function Qe() {
582
568
  customElements.get("omega-form") || customElements.define("omega-form", ge), customElements.get("omega-input") || customElements.define("omega-input", ve), customElements.get("omega-errors") || customElements.define("omega-errors", be);
583
569
  }
584
- const te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
570
+ const Z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
585
571
  __proto__: null,
586
572
  OmegaErrors: pe,
587
573
  OmegaErrorsCE: be,
588
- OmegaErrorsContext: Fe,
574
+ OmegaErrorsContext: $e,
589
575
  OmegaForm: fe,
590
576
  OmegaFormCE: ge,
591
577
  OmegaInput: ce,
592
578
  OmegaInputCE: ve,
593
- TestComponent: Ne,
594
- duplicateSchema: Ke,
595
- generateInputStandardSchemaFromFieldMeta: me,
596
- generateMetaFromSchema: ue,
597
- nullableInput: Pe,
598
- registerOmegaForm: et,
599
- useOmegaForm: de
579
+ duplicateSchema: Fe,
580
+ generateInputStandardSchemaFromFieldMeta: ue,
581
+ generateMetaFromSchema: le,
582
+ nullableInput: xe,
583
+ registerOmegaForm: Qe,
584
+ useOmegaForm: me
600
585
  }, Symbol.toStringTag, { value: "Module" }));
601
- function tt(e) {
602
- for (const n in te)
603
- e.component(n, te[n]);
586
+ function Xe(e) {
587
+ for (const n in Z)
588
+ e.component(n, Z[n]);
604
589
  }
605
- const lt = { install: tt };
590
+ const at = { install: Xe };
606
591
  export {
607
592
  pe as OmegaErrors,
608
593
  be as OmegaErrorsCE,
609
- Fe as OmegaErrorsContext,
594
+ $e as OmegaErrorsContext,
610
595
  fe as OmegaForm,
611
596
  ge as OmegaFormCE,
612
597
  ce as OmegaInput,
613
598
  ve as OmegaInputCE,
614
- Ne as TestComponent,
615
- lt as default,
616
- Ke as duplicateSchema,
617
- me as generateInputStandardSchemaFromFieldMeta,
618
- ue as generateMetaFromSchema,
619
- Pe as nullableInput,
620
- ot as provideIntl,
621
- et as registerOmegaForm,
622
- oe as useIntl,
623
- de as useOmegaForm
599
+ at as default,
600
+ Fe as duplicateSchema,
601
+ ue as generateInputStandardSchemaFromFieldMeta,
602
+ le as generateMetaFromSchema,
603
+ xe as nullableInput,
604
+ rt as provideIntl,
605
+ Qe as registerOmegaForm,
606
+ se as useIntl,
607
+ me as useOmegaForm
624
608
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "@tanstack/vue-form": "^1.1.3",
@@ -33,7 +33,7 @@
33
33
  "types": "./dist/types/index.d.ts",
34
34
  "import": "./dist/vue-components.es.js"
35
35
  },
36
- "./dist/style.css": "./dist/style.css"
36
+ "./dist/vue-components.css": "./dist/vue-components.css"
37
37
  },
38
38
  "dependencies": {
39
39
  "@effect-app/vue": "2.39.2",
@@ -1,6 +1 @@
1
- import TestComponent from './TestComponent.vue'
2
-
3
1
  export * from "./OmegaForm"
4
- export {
5
- TestComponent
6
- }
@@ -1,6 +0,0 @@
1
- import "./style.css";
2
- type __VLS_Props = {
3
- test: string;
4
- };
5
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
- export default _default;
@@ -1,15 +0,0 @@
1
- <template>
2
- <div class="cool">I'm so <span class="super">{{ cool }}</span> {{ test }}</div>
3
- </template>
4
- <style scoped>
5
- .super {
6
- color: aqua;
7
- }
8
- </style>
9
- <script setup lang="ts">
10
- import "./style.css"
11
- import { ref, defineProps } from "vue"
12
- const cool = ref("COOL")
13
-
14
- defineProps<{ test: string }>()
15
- </script>