@effect-app/vue-components 1.0.0-next.9 → 1.0.0

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 (53) hide show
  1. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +1 -1
  2. package/dist/types/components/OmegaForm/index.d.ts +1 -0
  3. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +26 -13
  4. package/dist/vue-components.es.js +21 -19
  5. package/dist/vue-components.es10.js +10 -5
  6. package/dist/vue-components.es11.js +5 -54
  7. package/dist/vue-components.es12.js +49 -66
  8. package/dist/vue-components.es13.js +71 -6
  9. package/dist/vue-components.es14.js +5 -5
  10. package/dist/vue-components.es15.js +6 -3
  11. package/dist/vue-components.es16.js +3 -3
  12. package/dist/vue-components.es17.js +3 -89
  13. package/dist/vue-components.es18.js +2 -42
  14. package/dist/vue-components.es19.js +135 -2
  15. package/dist/vue-components.es2.js +10 -8
  16. package/dist/vue-components.es21.js +41 -89
  17. package/dist/vue-components.es23.js +2 -7
  18. package/dist/vue-components.es24.js +86 -27
  19. package/dist/vue-components.es26.js +7 -2
  20. package/dist/vue-components.es27.js +31 -23
  21. package/dist/vue-components.es29.js +4 -21
  22. package/dist/vue-components.es30.js +20 -27
  23. package/dist/vue-components.es31.js +5 -22
  24. package/dist/vue-components.es32.js +15 -6
  25. package/dist/vue-components.es33.js +30 -5
  26. package/dist/vue-components.es34.js +22 -19
  27. package/dist/vue-components.es35.js +12 -9
  28. package/dist/vue-components.es36.js +5 -31
  29. package/dist/vue-components.es37.js +19 -48
  30. package/dist/vue-components.es38.js +9 -26
  31. package/dist/vue-components.es39.js +31 -115
  32. package/dist/vue-components.es4.js +80 -42
  33. package/dist/vue-components.es40.js +50 -0
  34. package/dist/vue-components.es41.js +26 -11
  35. package/dist/vue-components.es42.js +11 -65
  36. package/dist/vue-components.es43.js +54 -45
  37. package/dist/vue-components.es44.js +54 -15
  38. package/dist/vue-components.es45.js +15 -31
  39. package/dist/vue-components.es46.js +30 -26
  40. package/dist/vue-components.es47.js +29 -42
  41. package/dist/vue-components.es48.js +42 -4
  42. package/dist/vue-components.es5.js +51 -29
  43. package/dist/vue-components.es6.js +27 -207
  44. package/dist/vue-components.es7.js +202 -343
  45. package/dist/vue-components.es8.js +350 -2
  46. package/dist/vue-components.es9.js +2 -10
  47. package/package.json +3 -3
  48. package/src/components/OmegaForm/OmegaFormStuff.ts +1 -0
  49. package/src/components/OmegaForm/OmegaInputVuetify.vue +19 -0
  50. package/src/components/OmegaForm/index.ts +2 -0
  51. package/src/components/OmegaForm/useOmegaForm.ts +287 -29
  52. package/dist/vue-components.es28.js +0 -7
  53. /package/dist/{vue-components.es20.js → vue-components.es22.js} +0 -0
@@ -1,4 +1,352 @@
1
- import f from "./vue-components.es4.js";
1
+ import { S as n, Option as c, pipe as L } from "effect-app";
2
+ import { getTransformationFrom as U, useIntl as _ } from "./vue-components.es3.js";
3
+ const N = n.NonEmptyArray(n.String), E = (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
+ if (t && t._tag === "Transformation")
5
+ return m({
6
+ parent: i,
7
+ meta: e,
8
+ property: t.from
9
+ });
10
+ if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
11
+ return m({
12
+ meta: e,
13
+ propertySignatures: t.propertySignatures
14
+ });
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
+ if (n.AST.isUnion(r.type)) {
19
+ const T = r.type.types.filter(
20
+ (s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
21
+ ).map(U);
22
+ if (T.some(
23
+ (s) => "propertySignatures" in s
24
+ )) {
25
+ if (!a) {
26
+ const s = m({
27
+ parent: l,
28
+ property: r.type,
29
+ meta: { required: u, nullableOrUndefined: a }
30
+ });
31
+ o[l] = s;
32
+ }
33
+ for (const s of T)
34
+ "propertySignatures" in s && Object.assign(
35
+ o,
36
+ m({
37
+ parent: l,
38
+ propertySignatures: s.propertySignatures,
39
+ meta: { required: u, nullableOrUndefined: a }
40
+ })
41
+ );
42
+ } else {
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 x of O.type.propertySignatures) {
68
+ const M = `${b}.${x.name.toString()}`, v = m({
69
+ parent: M,
70
+ property: x.type,
71
+ meta: {
72
+ required: !g(x.type),
73
+ nullableOrUndefined: g(x.type)
74
+ }
75
+ });
76
+ v && typeof v == "object" && "type" in v && (o[M] = v);
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
+ }
89
+ }
90
+ } else if ("propertySignatures" in A)
91
+ Object.assign(
92
+ o,
93
+ m({
94
+ parent: l,
95
+ propertySignatures: A.propertySignatures,
96
+ meta: { required: u, nullableOrUndefined: a }
97
+ })
98
+ );
99
+ else if (n.AST.isTupleType(r.type))
100
+ if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
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()}`;
105
+ if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
106
+ const d = s.type.rest[0].type;
107
+ if (d._tag === "TypeLiteral" && "propertySignatures" in d)
108
+ for (const y of d.propertySignatures) {
109
+ const b = `${f}.${y.name.toString()}`, S = m({
110
+ parent: b,
111
+ property: y.type,
112
+ meta: {
113
+ required: !g(y.type),
114
+ nullableOrUndefined: g(y.type)
115
+ }
116
+ });
117
+ o[b] = S;
118
+ }
119
+ else
120
+ o[f] = {
121
+ type: "multiple",
122
+ members: s.type.elements,
123
+ rest: s.type.rest,
124
+ required: !g(s.type),
125
+ nullableOrUndefined: g(s.type)
126
+ };
127
+ } else {
128
+ const d = m({
129
+ parent: f,
130
+ property: s.type,
131
+ meta: {
132
+ required: !g(s.type),
133
+ nullableOrUndefined: g(s.type)
134
+ }
135
+ });
136
+ o[f] = d;
137
+ }
138
+ }
139
+ } else
140
+ o[l] = {
141
+ type: "multiple",
142
+ members: r.type.elements,
143
+ rest: r.type.rest,
144
+ required: u,
145
+ nullableOrUndefined: a
146
+ };
147
+ else {
148
+ const T = m({
149
+ parent: l,
150
+ property: r.type,
151
+ meta: { required: u, nullableOrUndefined: a }
152
+ });
153
+ o[l] = T;
154
+ }
155
+ }
156
+ return o;
157
+ }
158
+ if (t) {
159
+ const r = E(t);
160
+ if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
161
+ const a = t.types.find(
162
+ (u) => u._tag !== "UndefinedKeyword" && u !== n.Null.ast
163
+ );
164
+ return "propertySignatures" in a ? m({
165
+ propertySignatures: a.propertySignatures,
166
+ parent: i,
167
+ meta: e
168
+ }) : t.types.every(n.AST.isLiteral) ? {
169
+ ...e,
170
+ type: "select",
171
+ members: t.types.map((u) => u.literal)
172
+ } : {
173
+ ...e,
174
+ ...m({
175
+ parent: i,
176
+ meta: e,
177
+ property: a
178
+ })
179
+ };
180
+ }
181
+ if (n.AST.isTupleType(t))
182
+ return {
183
+ ...e,
184
+ type: "multiple",
185
+ members: t.elements,
186
+ rest: t.rest
187
+ };
188
+ const l = n.AST.getAnnotation(
189
+ t,
190
+ n.AST.JSONSchemaAnnotationId
191
+ ).pipe(c.getOrElse(() => ({})));
192
+ return e = { ...e, ...l }, "from" in t ? m({
193
+ parent: i,
194
+ meta: e,
195
+ property: t.from
196
+ }) : (e.type = n.AST.getAnnotation(
197
+ t,
198
+ n.AST.TitleAnnotationId
199
+ ).pipe(
200
+ c.getOrElse(() => "unknown")
201
+ ), e);
202
+ }
203
+ return o;
204
+ }, q = (e) => {
205
+ const i = e.ast, t = {};
206
+ if (i._tag === "Transformation" || i._tag === "Refinement")
207
+ return q(n.make(i.from));
208
+ if ("propertySignatures" in i) {
209
+ const p = m({
210
+ propertySignatures: i.propertySignatures
211
+ });
212
+ if (Object.values(p).every((r) => r && "type" in r))
213
+ return p;
214
+ const o = (r, l = "") => {
215
+ for (const a in r) {
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);
218
+ }
219
+ };
220
+ o(p);
221
+ }
222
+ return t;
223
+ }, I = (e) => n.extend(e, n.Struct({})), K = (e) => {
224
+ const i = q(e), t = L(
225
+ e.ast,
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(({ items: p }) => n.decodeUnknownOption(N)(p)),
230
+ c.zipWith(
231
+ n.AST.getMessageAnnotation(e.ast),
232
+ (p, o) => ({
233
+ items: p,
234
+ message: o("")
235
+ })
236
+ ),
237
+ c.getOrUndefined
238
+ );
239
+ return { schema: e, meta: i, filterItems: t };
240
+ }, P = (e) => {
241
+ const { trans: i } = _();
242
+ let t;
243
+ switch (e.type) {
244
+ case "string":
245
+ t = n.String.annotations({
246
+ message: () => i("validation.empty")
247
+ }), e.format === "email" && (t = n.compose(
248
+ t,
249
+ n.Email.annotations({
250
+ message: () => i("validation.email.invalid")
251
+ })
252
+ )), e.required && t.annotations({
253
+ message: () => i("validation.empty")
254
+ }), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
255
+ message: () => i("validation.string.maxLength", {
256
+ maxLength: e.maxLength
257
+ })
258
+ })), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
259
+ message: () => i("validation.string.minLength", {
260
+ minLength: e.minLength
261
+ })
262
+ }));
263
+ break;
264
+ case "number":
265
+ t = n.Number.annotations({
266
+ message: () => i("validation.empty")
267
+ }), e.required && t.annotations({
268
+ message: () => i("validation.empty")
269
+ }), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
270
+ message: () => i("validation.number.min", {
271
+ minimum: e.minimum,
272
+ isExclusive: !0
273
+ })
274
+ })), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
275
+ message: () => i("validation.number.max", {
276
+ maximum: e.maximum,
277
+ isExclusive: !0
278
+ })
279
+ })), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
280
+ message: () => i("validation.number.min", {
281
+ minimum: e.exclusiveMinimum,
282
+ isExclusive: !1
283
+ })
284
+ })), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
285
+ message: () => i("validation.number.max", {
286
+ maximum: e.exclusiveMaximum,
287
+ isExclusive: !1
288
+ })
289
+ }));
290
+ break;
291
+ case "select":
292
+ t = n.Literal(...e.members).annotations({
293
+ message: () => ({
294
+ message: i("validation.not_a_valid", {
295
+ type: "select",
296
+ message: e.members.join(", ")
297
+ }),
298
+ override: !0
299
+ })
300
+ });
301
+ break;
302
+ case "multiple":
303
+ t = n.Array(n.String).annotations({
304
+ message: () => i("validation.not_a_valid", {
305
+ type: "multiple",
306
+ message: e.members.join(", ")
307
+ })
308
+ });
309
+ break;
310
+ case "boolean":
311
+ t = n.Boolean;
312
+ break;
313
+ // todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
314
+ case "unknown":
315
+ t = n.Unknown;
316
+ break;
317
+ }
318
+ return e.required ? t.pipe(
319
+ n.annotations({
320
+ message: () => i("validation.empty")
321
+ })
322
+ ) : t = n.NullishOr(t), n.standardSchemaV1(t);
323
+ }, j = (e, i) => n.NullOr(e).pipe(
324
+ n.transform(n.typeSchema(e), {
325
+ decode: (t) => t ?? i(),
326
+ encode: (t) => t
327
+ })
328
+ ), k = [
329
+ "button",
330
+ "checkbox",
331
+ "color",
332
+ "date",
333
+ "email",
334
+ "number",
335
+ "password",
336
+ "radio",
337
+ "range",
338
+ "search",
339
+ "submit",
340
+ "tel",
341
+ "text",
342
+ "time",
343
+ "url"
344
+ ], F = (e) => k.includes(e) ? e : "text";
2
345
  export {
3
- f as default
346
+ m as createMeta,
347
+ I as duplicateSchema,
348
+ P as generateInputStandardSchemaFromFieldMeta,
349
+ K as generateMetaFromSchema,
350
+ F as getInputType,
351
+ j as nullableInput
4
352
  };
@@ -1,12 +1,4 @@
1
- import { Exit as c, Runtime as s } from "effect";
2
- import { dual as n, isFunction as m } from "./vue-components.es18.js";
3
- const i = Symbol.for("clone-trait"), u = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
4
- n(2, (e, t) => u(e, { ...e, ...m(t) ? t(e) : t }));
5
- const b = (e) => new Promise((t, r) => e.addObserver((o) => {
6
- c.isSuccess(o) ? t(o.value) : r(s.makeFiberFailure(o.cause));
7
- }));
1
+ import f from "./vue-components.es5.js";
8
2
  export {
9
- u as clone,
10
- i as cloneTrait,
11
- b as runtimeFiberAsPromise
3
+ f as default
12
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "1.0.0-next.9",
3
+ "version": "1.0.0",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "effect": "^3.17.13",
@@ -49,8 +49,8 @@
49
49
  "@tanstack/vue-form": "^1.23.0",
50
50
  "highlight.js": "^11.11.1",
51
51
  "vue3-highlightjs": "^1.0.5",
52
- "@effect-app/vue": "2.80.2",
53
- "effect-app": "3.8.0"
52
+ "@effect-app/vue": "2.80.3",
53
+ "effect-app": "3.8.1"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "pnpm build:run",
@@ -48,6 +48,7 @@ export type TypeOverride =
48
48
  | "select"
49
49
  | "multiple"
50
50
  | "boolean"
51
+ | "radio"
51
52
  | "autocomplete"
52
53
  | "autocompletemultiple"
53
54
  | "switch"
@@ -68,6 +68,25 @@
68
68
  }
69
69
  }"
70
70
  />
71
+ <template v-if="inputProps.type === 'radio'">
72
+ <v-radio-group
73
+ :id="inputProps.id"
74
+ :name="inputProps.name"
75
+ :label="inputProps.label"
76
+ :error-messages="inputProps.errorMessages"
77
+ :error="inputProps.error"
78
+ v-bind="$attrs"
79
+ :model-value="vuetifyValue"
80
+ @update:model-value="inputProps.field.handleChange"
81
+ >
82
+ <v-radio
83
+ v-for="option in inputProps.options"
84
+ :key="option.value"
85
+ :label="option.title"
86
+ :value="option.value"
87
+ />
88
+ </v-radio-group>
89
+ </template>
71
90
  <v-select
72
91
  v-if="inputProps.type === 'select' || inputProps.type === 'multiple'"
73
92
  :id="inputProps.id"
@@ -4,6 +4,8 @@ export * as OmegaErrorsContext from "./OmegaErrorsContext"
4
4
  export * from "./OmegaFormStuff"
5
5
  export { type OmegaFormReturn, useOmegaForm } from "./useOmegaForm"
6
6
 
7
+ export { default as OmegaVuetifyInput } from "./OmegaInternalInput.vue"
8
+
7
9
  export { getInputType } from "./OmegaFormStuff"
8
10
 
9
11
  export { OmegaInput }