@effect-app/vue-components 1.7.1 → 1.8.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.
Files changed (61) hide show
  1. package/dist/types/components/Dialog.vue.d.ts +28 -0
  2. package/dist/types/components/index.d.ts +1 -0
  3. package/dist/vue-components.es.js +25 -23
  4. package/dist/vue-components.es10.js +352 -23
  5. package/dist/vue-components.es11.js +27 -10
  6. package/dist/vue-components.es12.js +2 -5
  7. package/dist/vue-components.es13.js +10 -54
  8. package/dist/vue-components.es14.js +5 -68
  9. package/dist/vue-components.es15.js +54 -6
  10. package/dist/vue-components.es16.js +68 -6
  11. package/dist/vue-components.es17.js +6 -3
  12. package/dist/vue-components.es18.js +6 -3
  13. package/dist/vue-components.es19.js +3 -2
  14. package/dist/vue-components.es2.js +21 -19
  15. package/dist/vue-components.es20.js +3 -2
  16. package/dist/vue-components.es21.js +2 -17
  17. package/dist/vue-components.es22.js +2 -11
  18. package/dist/vue-components.es23.js +17 -135
  19. package/dist/vue-components.es24.js +13 -0
  20. package/dist/vue-components.es25.js +134 -41
  21. package/dist/vue-components.es27.js +42 -2
  22. package/dist/vue-components.es28.js +2 -90
  23. package/dist/vue-components.es29.js +4 -0
  24. package/dist/vue-components.es30.js +90 -7
  25. package/dist/vue-components.es32.js +9 -0
  26. package/dist/vue-components.es33.js +31 -4
  27. package/dist/vue-components.es35.js +4 -5
  28. package/dist/vue-components.es36.js +11 -21
  29. package/dist/vue-components.es37.js +20 -27
  30. package/dist/vue-components.es38.js +5 -22
  31. package/dist/vue-components.es39.js +15 -6
  32. package/dist/vue-components.es4.js +45 -45
  33. package/dist/vue-components.es40.js +30 -5
  34. package/dist/vue-components.es41.js +22 -19
  35. package/dist/vue-components.es42.js +12 -9
  36. package/dist/vue-components.es43.js +5 -31
  37. package/dist/vue-components.es44.js +19 -48
  38. package/dist/vue-components.es45.js +9 -26
  39. package/dist/vue-components.es46.js +31 -11
  40. package/dist/vue-components.es47.js +37 -54
  41. package/dist/vue-components.es48.js +21 -51
  42. package/dist/vue-components.es49.js +64 -16
  43. package/dist/vue-components.es5.js +40 -83
  44. package/dist/vue-components.es50.js +54 -31
  45. package/dist/vue-components.es51.js +16 -28
  46. package/dist/vue-components.es52.js +32 -41
  47. package/dist/vue-components.es53.js +29 -2
  48. package/dist/vue-components.es54.js +41 -43
  49. package/dist/vue-components.es55.js +2 -2
  50. package/dist/vue-components.es56.js +46 -0
  51. package/dist/vue-components.es57.js +4 -0
  52. package/dist/vue-components.es6.js +90 -29
  53. package/dist/vue-components.es7.js +27 -211
  54. package/dist/vue-components.es8.js +211 -28
  55. package/dist/vue-components.es9.js +29 -355
  56. package/package.json +3 -3
  57. package/src/components/Dialog.vue +50 -0
  58. package/src/components/index.ts +1 -0
  59. package/dist/vue-components.es26.js +0 -4
  60. package/dist/vue-components.es31.js +0 -33
  61. package/dist/vue-components.es34.js +0 -25
@@ -0,0 +1,28 @@
1
+ type __VLS_Props = {
2
+ persistent?: boolean;
3
+ };
4
+ type __VLS_ModelProps = {
5
+ modelValue?: boolean;
6
+ };
7
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
+ declare var __VLS_11: {
9
+ open: boolean;
10
+ cancel: () => void;
11
+ isActive: any;
12
+ };
13
+ type __VLS_Slots = {} & {
14
+ default?: (props: typeof __VLS_11) => any;
15
+ };
16
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
+ "update:modelValue": (value: boolean) => any;
18
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
19
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
+ declare const _default: typeof __VLS_export;
23
+ export default _default;
24
+ type __VLS_WithSlots<T, S> = T & {
25
+ new (): {
26
+ $slots: S;
27
+ };
28
+ };
@@ -1 +1,2 @@
1
+ export { default as Dialog } from "./Dialog.vue";
1
2
  export * from "./OmegaForm";
@@ -1,37 +1,39 @@
1
1
  import * as o from "./vue-components.es2.js";
2
- import { getTransformationFrom as f, provideIntl as u, useIntl as l, useIntlKey as c } from "./vue-components.es3.js";
2
+ import { getTransformationFrom as f, provideIntl as u, useIntl as l, useIntlKey as i } from "./vue-components.es3.js";
3
3
  import { default as x } from "./vue-components.es4.js";
4
- import { default as I } from "./vue-components.es5.js";
5
- import * as a from "./vue-components.es6.js";
6
- import { useOmegaForm as y } from "./vue-components.es7.js";
7
- import { useOnClose as F, usePreventClose as h } from "./vue-components.es8.js";
8
- import { createMeta as S, duplicateSchema as b, generateInputStandardSchemaFromFieldMeta as M, generateMetaFromSchema as j, getInputType as v, nullableInput as P } from "./vue-components.es9.js";
9
- import { createUseFormWithCustomInput as k } from "./vue-components.es10.js";
10
- function n(r) {
4
+ import { default as g } from "./vue-components.es5.js";
5
+ import { default as y } from "./vue-components.es6.js";
6
+ import * as n from "./vue-components.es7.js";
7
+ import { useOmegaForm as F } from "./vue-components.es8.js";
8
+ import { useOnClose as C, usePreventClose as S } from "./vue-components.es9.js";
9
+ import { createMeta as M, duplicateSchema as j, generateInputStandardSchemaFromFieldMeta as v, generateMetaFromSchema as P, getInputType as T, nullableInput as k } from "./vue-components.es10.js";
10
+ import { createUseFormWithCustomInput as D } from "./vue-components.es11.js";
11
+ function a(r) {
11
12
  for (const e in o)
12
13
  if (Object.prototype.hasOwnProperty.call(o, e)) {
13
14
  const t = o[e];
14
15
  t && typeof t == "object" && r.component(e, t);
15
16
  }
16
17
  }
17
- const m = { install: n };
18
+ const m = { install: a };
18
19
  export {
19
- a as OmegaErrorsContext,
20
- x as OmegaInput,
21
- I as OmegaVuetifyInput,
22
- S as createMeta,
23
- k as createUseFormWithCustomInput,
20
+ x as Dialog,
21
+ n as OmegaErrorsContext,
22
+ g as OmegaInput,
23
+ y as OmegaVuetifyInput,
24
+ M as createMeta,
25
+ D as createUseFormWithCustomInput,
24
26
  m as default,
25
- b as duplicateSchema,
26
- M as generateInputStandardSchemaFromFieldMeta,
27
- j as generateMetaFromSchema,
28
- v as getInputType,
27
+ j as duplicateSchema,
28
+ v as generateInputStandardSchemaFromFieldMeta,
29
+ P as generateMetaFromSchema,
30
+ T as getInputType,
29
31
  f as getTransformationFrom,
30
- P as nullableInput,
32
+ k as nullableInput,
31
33
  u as provideIntl,
32
34
  l as useIntl,
33
- c as useIntlKey,
34
- y as useOmegaForm,
35
- F as useOnClose,
36
- h as usePreventClose
35
+ i as useIntlKey,
36
+ F as useOmegaForm,
37
+ C as useOnClose,
38
+ S as usePreventClose
37
39
  };
@@ -1,29 +1,358 @@
1
- import { h as t } from "vue";
2
- import i from "./vue-components.es4.js";
3
- import { useOmegaForm as f } from "./vue-components.es7.js";
4
- const g = (r) => (...e) => {
5
- const [o, n, m] = e;
6
- return f(
7
- o,
8
- n,
9
- {
10
- ...m,
11
- input: {
12
- name: "WrappedInput",
13
- inheritAttrs: !1,
14
- setup(p, { attrs: s }) {
15
- return () => t(i, {
16
- ...p,
17
- ...s
18
- }, {
19
- // Override the default slot that OmegaInternalInput provides
20
- default: ({ field: a, ...u }) => t(r, { field: a, inputProps: u })
21
- });
1
+ import { S as n, Option as c, pipe as q } from "effect-app";
2
+ import { getMetadataFromSchema as U } from "@effect-app/vue/form";
3
+ import { useIntl as _, getTransformationFrom as N } from "./vue-components.es3.js";
4
+ const w = 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 = {}) => {
5
+ if (t && t._tag === "Transformation")
6
+ return m({
7
+ parent: i,
8
+ meta: e,
9
+ property: t.from
10
+ });
11
+ if (t?._tag === "TypeLiteral" && "propertySignatures" in t)
12
+ return m({
13
+ meta: e,
14
+ propertySignatures: t.propertySignatures
15
+ });
16
+ if (p) {
17
+ for (const r of p) {
18
+ const l = i ? `${i}.${r.name.toString()}` : r.name.toString(), a = g(r.type), u = !a, A = r.type;
19
+ if (n.AST.isUnion(r.type)) {
20
+ const T = r.type.types.filter(
21
+ (s) => s._tag !== "UndefinedKeyword" && s !== n.Null.ast
22
+ ).map(N);
23
+ if (T.some(
24
+ (s) => "propertySignatures" in s
25
+ )) {
26
+ if (!a) {
27
+ const s = m({
28
+ parent: l,
29
+ property: r.type,
30
+ meta: { required: u, nullableOrUndefined: a }
31
+ });
32
+ o[l] = s;
33
+ }
34
+ for (const s of T)
35
+ "propertySignatures" in s && Object.assign(
36
+ o,
37
+ m({
38
+ parent: l,
39
+ propertySignatures: s.propertySignatures,
40
+ meta: { required: u, nullableOrUndefined: a }
41
+ })
42
+ );
43
+ } else {
44
+ const s = T.filter(n.AST.isTupleType);
45
+ if (s.length > 0) {
46
+ const f = s[0];
47
+ if (o[l] = {
48
+ type: "multiple",
49
+ members: f.elements,
50
+ rest: f.rest,
51
+ required: u,
52
+ nullableOrUndefined: a
53
+ }, f.rest && f.rest.length > 0) {
54
+ const d = f.rest[0];
55
+ if (d.type._tag === "TypeLiteral" && "propertySignatures" in d.type)
56
+ for (const y of d.type.propertySignatures) {
57
+ const b = `${l}.${y.name.toString()}`, S = m({
58
+ parent: b,
59
+ property: y.type,
60
+ meta: {
61
+ required: !g(y.type),
62
+ nullableOrUndefined: g(y.type)
63
+ }
64
+ });
65
+ 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)) {
66
+ const O = y.type.rest[0];
67
+ if (O.type._tag === "TypeLiteral" && "propertySignatures" in O.type)
68
+ for (const x of O.type.propertySignatures) {
69
+ const M = `${b}.${x.name.toString()}`, v = m({
70
+ parent: M,
71
+ property: x.type,
72
+ meta: {
73
+ required: !g(x.type),
74
+ nullableOrUndefined: g(x.type)
75
+ }
76
+ });
77
+ v && typeof v == "object" && "type" in v && (o[M] = v);
78
+ }
79
+ }
80
+ }
81
+ }
82
+ } else {
83
+ const f = m({
84
+ parent: l,
85
+ property: r.type,
86
+ meta: { required: u, nullableOrUndefined: a }
87
+ });
88
+ o[l] = f;
89
+ }
22
90
  }
91
+ } else if ("propertySignatures" in A)
92
+ Object.assign(
93
+ o,
94
+ m({
95
+ parent: l,
96
+ propertySignatures: A.propertySignatures,
97
+ meta: { required: u, nullableOrUndefined: a }
98
+ })
99
+ );
100
+ else if (n.AST.isTupleType(r.type))
101
+ if (r.type.rest.length > 0 && r.type.rest[0].type._tag === "TypeLiteral" && "propertySignatures" in r.type.rest[0].type) {
102
+ const h = r.type.rest[0].type;
103
+ if (h._tag === "TypeLiteral" && "propertySignatures" in h)
104
+ for (const s of h.propertySignatures) {
105
+ const f = `${l}.${s.name.toString()}`;
106
+ if (n.AST.isTupleType(s.type) && s.type.rest.length > 0) {
107
+ const d = s.type.rest[0].type;
108
+ if (d._tag === "TypeLiteral" && "propertySignatures" in d)
109
+ for (const y of d.propertySignatures) {
110
+ const b = `${f}.${y.name.toString()}`, S = m({
111
+ parent: b,
112
+ property: y.type,
113
+ meta: {
114
+ required: !g(y.type),
115
+ nullableOrUndefined: g(y.type)
116
+ }
117
+ });
118
+ o[b] = S;
119
+ }
120
+ else
121
+ o[f] = {
122
+ type: "multiple",
123
+ members: s.type.elements,
124
+ rest: s.type.rest,
125
+ required: !g(s.type),
126
+ nullableOrUndefined: g(s.type)
127
+ };
128
+ } else {
129
+ const d = m({
130
+ parent: f,
131
+ property: s.type,
132
+ meta: {
133
+ required: !g(s.type),
134
+ nullableOrUndefined: g(s.type)
135
+ }
136
+ });
137
+ o[f] = d;
138
+ }
139
+ }
140
+ } else
141
+ o[l] = {
142
+ type: "multiple",
143
+ members: r.type.elements,
144
+ rest: r.type.rest,
145
+ required: u,
146
+ nullableOrUndefined: a
147
+ };
148
+ else {
149
+ const T = m({
150
+ parent: l,
151
+ property: r.type,
152
+ meta: {
153
+ // an empty string is valid for a S.String field, so we should not mark it as required
154
+ // TODO: handle this better via the createMeta minLength parsing
155
+ required: u && (r.type._tag !== "StringKeyword" || U(r.type).minLength),
156
+ nullableOrUndefined: a
157
+ }
158
+ });
159
+ o[l] = T;
23
160
  }
24
161
  }
162
+ return o;
163
+ }
164
+ if (t) {
165
+ const r = E(t);
166
+ if (Object.hasOwnProperty.call(e, "required") || (e.required = !r), n.AST.isUnion(t)) {
167
+ const a = t.types.find(
168
+ (u) => u._tag !== "UndefinedKeyword" && u !== n.Null.ast
169
+ );
170
+ return "propertySignatures" in a ? m({
171
+ propertySignatures: a.propertySignatures,
172
+ parent: i,
173
+ meta: e
174
+ }) : t.types.every(n.AST.isLiteral) ? {
175
+ ...e,
176
+ type: "select",
177
+ members: t.types.map((u) => u.literal)
178
+ } : {
179
+ ...e,
180
+ ...m({
181
+ parent: i,
182
+ meta: e,
183
+ property: a
184
+ })
185
+ };
186
+ }
187
+ if (n.AST.isTupleType(t))
188
+ return {
189
+ ...e,
190
+ type: "multiple",
191
+ members: t.elements,
192
+ rest: t.rest
193
+ };
194
+ const l = n.AST.getAnnotation(
195
+ t,
196
+ n.AST.JSONSchemaAnnotationId
197
+ ).pipe(c.getOrElse(() => ({})));
198
+ return e = { ...e, ...l }, "from" in t ? m({
199
+ parent: i,
200
+ meta: e,
201
+ property: t.from
202
+ }) : (e.type = n.AST.getAnnotation(
203
+ t,
204
+ n.AST.TitleAnnotationId
205
+ ).pipe(
206
+ c.getOrElse(() => "unknown")
207
+ ), e);
208
+ }
209
+ return o;
210
+ }, L = (e) => {
211
+ const i = e.ast, t = {};
212
+ if (i._tag === "Transformation" || i._tag === "Refinement")
213
+ return L(n.make(i.from));
214
+ if ("propertySignatures" in i) {
215
+ const p = m({
216
+ propertySignatures: i.propertySignatures
217
+ });
218
+ if (Object.values(p).every((r) => r && "type" in r))
219
+ return p;
220
+ const o = (r, l = "") => {
221
+ for (const a in r) {
222
+ const u = l ? `${l}.${a}` : a;
223
+ r[a] && typeof r[a] == "object" && "type" in r[a] ? t[u] = r[a] : r[a] && typeof r[a] == "object" && o(r[a], u);
224
+ }
225
+ };
226
+ o(p);
227
+ }
228
+ return t;
229
+ }, P = (e) => n.extend(e, n.Struct({})), F = (e) => {
230
+ const i = L(e), t = q(
231
+ e.ast,
232
+ c.liftPredicate((p) => p._tag === "Refinement" && "filter" in p),
233
+ c.flatMap((p) => n.AST.getJSONSchemaAnnotation(p)),
234
+ c.filter((p) => "items" in p),
235
+ c.filterMap(({ items: p }) => n.decodeUnknownOption(w)(p)),
236
+ c.zipWith(
237
+ n.AST.getMessageAnnotation(e.ast),
238
+ (p, o) => ({
239
+ items: p,
240
+ message: o("")
241
+ })
242
+ ),
243
+ c.getOrUndefined
25
244
  );
26
- };
245
+ return { schema: e, meta: i, filterItems: t };
246
+ }, j = (e) => {
247
+ const { trans: i } = _();
248
+ let t;
249
+ switch (e.type) {
250
+ case "string":
251
+ t = n.String.annotations({
252
+ message: () => i("validation.empty")
253
+ }), e.format === "email" && (t = n.compose(
254
+ t,
255
+ n.Email.annotations({
256
+ message: () => i("validation.email.invalid")
257
+ })
258
+ )), e.required && t.annotations({
259
+ message: () => i("validation.empty")
260
+ }), e.maxLength && (t = t.pipe(n.maxLength(e.maxLength)).annotations({
261
+ message: () => i("validation.string.maxLength", {
262
+ maxLength: e.maxLength
263
+ })
264
+ })), e.minLength && (t = t.pipe(n.minLength(e.minLength)).annotations({
265
+ message: () => i("validation.string.minLength", {
266
+ minLength: e.minLength
267
+ })
268
+ }));
269
+ break;
270
+ case "number":
271
+ t = n.Number.annotations({
272
+ message: () => i("validation.empty")
273
+ }), e.required && t.annotations({
274
+ message: () => i("validation.empty")
275
+ }), e.minimum && (t = t.pipe(n.greaterThanOrEqualTo(e.minimum)).annotations({
276
+ message: () => i("validation.number.min", {
277
+ minimum: e.minimum,
278
+ isExclusive: !0
279
+ })
280
+ })), e.maximum && (t = t.pipe(n.lessThanOrEqualTo(e.maximum)).annotations({
281
+ message: () => i("validation.number.max", {
282
+ maximum: e.maximum,
283
+ isExclusive: !0
284
+ })
285
+ })), e.exclusiveMinimum && (t = t.pipe(n.greaterThan(e.exclusiveMinimum)).annotations({
286
+ message: () => i("validation.number.min", {
287
+ minimum: e.exclusiveMinimum,
288
+ isExclusive: !1
289
+ })
290
+ })), e.exclusiveMaximum && (t = t.pipe(n.lessThan(e.exclusiveMaximum)).annotations({
291
+ message: () => i("validation.number.max", {
292
+ maximum: e.exclusiveMaximum,
293
+ isExclusive: !1
294
+ })
295
+ }));
296
+ break;
297
+ case "select":
298
+ t = n.Literal(...e.members).annotations({
299
+ message: () => ({
300
+ message: i("validation.not_a_valid", {
301
+ type: "select",
302
+ message: e.members.join(", ")
303
+ }),
304
+ override: !0
305
+ })
306
+ });
307
+ break;
308
+ case "multiple":
309
+ t = n.Array(n.String).annotations({
310
+ message: () => i("validation.not_a_valid", {
311
+ type: "multiple",
312
+ message: e.members.join(", ")
313
+ })
314
+ });
315
+ break;
316
+ case "boolean":
317
+ t = n.Boolean;
318
+ break;
319
+ // todo: switch must be exhaustive or have default case, otherwise falls through with schema undefined.
320
+ case "unknown":
321
+ t = n.Unknown;
322
+ break;
323
+ }
324
+ return e.required ? t.pipe(
325
+ n.annotations({
326
+ message: () => i("validation.empty")
327
+ })
328
+ ) : t = n.NullishOr(t), n.standardSchemaV1(t);
329
+ }, R = (e, i) => n.NullOr(e).pipe(
330
+ n.transform(n.typeSchema(e), {
331
+ decode: (t) => t ?? i(),
332
+ encode: (t) => t
333
+ })
334
+ ), k = [
335
+ "button",
336
+ "checkbox",
337
+ "color",
338
+ "date",
339
+ "email",
340
+ "number",
341
+ "password",
342
+ "radio",
343
+ "range",
344
+ "search",
345
+ "submit",
346
+ "tel",
347
+ "text",
348
+ "time",
349
+ "url"
350
+ ], J = (e) => k.includes(e) ? e : "text";
27
351
  export {
28
- g as createUseFormWithCustomInput
352
+ m as createMeta,
353
+ P as duplicateSchema,
354
+ j as generateInputStandardSchemaFromFieldMeta,
355
+ F as generateMetaFromSchema,
356
+ J as getInputType,
357
+ R as nullableInput
29
358
  };
@@ -1,12 +1,29 @@
1
- import { Exit as c, Runtime as s } from "effect";
2
- import { dual as n, isFunction as m } from "./vue-components.es25.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 { h as t } from "vue";
2
+ import i from "./vue-components.es5.js";
3
+ import { useOmegaForm as f } from "./vue-components.es8.js";
4
+ const g = (r) => (...e) => {
5
+ const [o, n, m] = e;
6
+ return f(
7
+ o,
8
+ n,
9
+ {
10
+ ...m,
11
+ input: {
12
+ name: "WrappedInput",
13
+ inheritAttrs: !1,
14
+ setup(p, { attrs: s }) {
15
+ return () => t(i, {
16
+ ...p,
17
+ ...s
18
+ }, {
19
+ // Override the default slot that OmegaInternalInput provides
20
+ default: ({ field: a, ...u }) => t(r, { field: a, inputProps: u })
21
+ });
22
+ }
23
+ }
24
+ }
25
+ );
26
+ };
8
27
  export {
9
- u as clone,
10
- i as cloneTrait,
11
- b as runtimeFiberAsPromise
28
+ g as createUseFormWithCustomInput
12
29
  };
@@ -1,7 +1,4 @@
1
- import { isFunction as c } from "./vue-components.es25.js";
2
- const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
1
+ import f from "./vue-components.es4.js";
3
2
  export {
4
- s as isFunction,
5
- i as isObject,
6
- t as isRecordOrArray
3
+ f as default
7
4
  };
@@ -1,56 +1,12 @@
1
- import { defineComponent as F, computed as i, onMounted as M, provide as P, createBlock as c, openBlock as s, resolveDynamicComponent as p, withCtx as g, renderSlot as o, createElementBlock as k, normalizeProps as l, guardReactiveProps as u, Fragment as A, renderList as b, mergeProps as B } from "vue";
2
- const N = /* @__PURE__ */ F({
3
- inheritAttrs: !1,
4
- __name: "OmegaArray",
5
- props: {
6
- form: {},
7
- name: {},
8
- defaultItems: {},
9
- items: {}
10
- },
11
- setup(n) {
12
- const a = n, y = a.form.useStore((e) => e.values), d = i(() => {
13
- const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
14
- try {
15
- return e.split(".").reduce((r, t) => r && r[t], y.value);
16
- } catch (r) {
17
- return console.error(r), [];
18
- }
19
- });
20
- M(async () => {
21
- a.defaultItems && !d.value && a.form.setFieldValue(a.name, a.defaultItems);
22
- });
23
- const $ = i(() => (r) => {
24
- const t = r.replace(/\[\d+\]/g, "");
25
- return a.form.meta[t];
26
- });
27
- return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
28
- default: g(({ field: t, state: f }) => [
29
- o(e.$slots, "pre-array", l(u({ field: t, state: f }))),
30
- (s(!0), k(A, null, b(d.value, (C, m) => (s(), c(p(n.form.Field), {
31
- key: `${n.name}[${Number(m)}]`,
32
- name: (
33
- // eslint-disable-next-line
34
- `${n.name}[${Number(m)}]`
35
- )
36
- }, {
37
- default: g(({ field: v, state: h }) => [
38
- o(e.$slots, "default", B({ ref_for: !0 }, {
39
- subField: v,
40
- subState: h,
41
- index: Number(m),
42
- field: t
43
- }))
44
- ]),
45
- _: 2
46
- }, 1032, ["name"]))), 128)),
47
- o(e.$slots, "post-array", l(u({ field: t, state: f }))),
48
- o(e.$slots, "field", l(u({ field: t })))
49
- ]),
50
- _: 3
51
- }, 8, ["name"]));
52
- }
53
- });
1
+ import { Exit as c, Runtime as s } from "effect";
2
+ import { dual as n, isFunction as m } from "./vue-components.es27.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
+ }));
54
8
  export {
55
- N as default
9
+ u as clone,
10
+ i as cloneTrait,
11
+ b as runtimeFiberAsPromise
56
12
  };
@@ -1,70 +1,7 @@
1
- import { defineComponent as O, computed as j, createElementBlock as M, openBlock as _, Fragment as E, renderList as A, renderSlot as F, createVNode as g, unref as h, mergeProps as k } from "vue";
2
- import { Order as l, pipe as v, Array as u } from "effect-app";
3
- const I = /* @__PURE__ */ O({
4
- __name: "OmegaAutoGen",
5
- props: {
6
- form: {},
7
- pick: {},
8
- omit: {},
9
- labelMap: { type: Function },
10
- filterMap: { type: Function },
11
- order: {},
12
- sort: {}
13
- },
14
- setup(i) {
15
- const p = (e) => (r) => Object.fromEntries(
16
- Object.entries(r).map(([t, o]) => [t, e(o, t)])
17
- ), a = (e) => (r) => Object.fromEntries(
18
- Object.entries(r).filter(([t, o]) => e(o, t))
19
- ), m = (e) => (r) => Object.entries(r).reduce(
20
- (t, [o, c]) => {
21
- const s = e(c, o);
22
- return s !== !1 && (t[o] = s), t;
23
- },
24
- {}
25
- ), n = i, f = (e, r) => {
26
- const t = r?.indexOf(e) ?? -1;
27
- return t === -1 ? Number.MAX_SAFE_INTEGER : t;
28
- }, d = l.mapInput(
29
- l.number,
30
- (e) => f(e.name, n.order || [])
31
- ), b = j(
32
- () => v(
33
- n.form.meta,
34
- // include / exclude
35
- a(
36
- (e, r) => n.pick ? n.pick.includes(r) && !n.omit?.includes(r) : !n.omit?.includes(r)
37
- ),
38
- (e) => e,
39
- // labelMap and adding name
40
- p((e, r) => ({
41
- name: r,
42
- label: n.labelMap?.(r) || r,
43
- ...e
44
- })),
45
- // filterMap
46
- n.filterMap ? m((e) => {
47
- const r = n.filterMap?.(e.name, e);
48
- return r === void 0 || r === !0 ? e : r;
49
- }) : (e) => e,
50
- // transform to array
51
- (e) => Object.values(e),
52
- // order
53
- u.sort(d),
54
- // sort
55
- n.sort ? u.sort(n.sort) : (e) => e
56
- )
57
- );
58
- return (e, r) => (_(!0), M(E, null, A(b.value, ({ name: t, label: o, ...c }) => F(e.$slots, "default", {
59
- child: { name: t, label: o, ...c }
60
- }, () => [
61
- g(h(i.form).Input, k({
62
- name: t,
63
- label: o
64
- }, { ref_for: !0 }, c), null, 16, ["name", "label"])
65
- ])), 256));
66
- }
67
- });
1
+ import { isFunction as c } from "./vue-components.es27.js";
2
+ const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
68
3
  export {
69
- I as default
4
+ s as isFunction,
5
+ i as isObject,
6
+ t as isRecordOrArray
70
7
  };