@effect-app/vue-components 2.4.4 → 2.4.6

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 (32) hide show
  1. package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +2 -2
  2. package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +5 -5
  3. package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +1 -1
  4. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +7 -7
  5. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +3 -2
  6. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -6
  7. package/dist/vue-components.es10.js +8 -8
  8. package/dist/vue-components.es11.js +2 -2
  9. package/dist/vue-components.es16.js +10 -11
  10. package/dist/vue-components.es17.js +5 -10
  11. package/dist/vue-components.es18.js +55 -5
  12. package/dist/vue-components.es19.js +63 -50
  13. package/dist/vue-components.es20.js +6 -68
  14. package/dist/vue-components.es21.js +4 -4
  15. package/dist/vue-components.es22.js +3 -6
  16. package/dist/vue-components.es23.js +3 -3
  17. package/dist/vue-components.es24.js +2 -3
  18. package/dist/vue-components.es25.js +1 -1
  19. package/dist/vue-components.es26.js +1 -1
  20. package/dist/vue-components.es27.js +1 -1
  21. package/dist/vue-components.es28.js +17 -2
  22. package/dist/vue-components.es29.js +10 -16
  23. package/dist/vue-components.es31.js +1 -1
  24. package/dist/vue-components.es32.js +1 -1
  25. package/dist/vue-components.es5.js +1 -1
  26. package/package.json +1 -1
  27. package/src/components/OmegaForm/OmegaArray.vue +3 -2
  28. package/src/components/OmegaForm/OmegaAutoGen.vue +6 -5
  29. package/src/components/OmegaForm/OmegaFormInput.vue +3 -2
  30. package/src/components/OmegaForm/OmegaFormStuff.ts +18 -8
  31. package/src/components/OmegaForm/OmegaInput.vue +3 -2
  32. package/src/components/OmegaForm/useOmegaForm.ts +6 -6
@@ -1,7 +1,7 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import { type OmegaArrayProps } from "./OmegaFormStuff";
3
- declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<OmegaArrayProps<From, To>> & import("vue").PublicProps;
3
+ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_PrettifyLocal<OmegaArrayProps<From, To, Name>> & import("vue").PublicProps;
5
5
  expose: (exposed: {}) => void;
6
6
  attrs: any;
7
7
  slots: {
@@ -1,21 +1,21 @@
1
1
  import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import { Order } from "effect-app";
3
3
  import { type OmegaAutoGenMeta, type OmegaInputProps } from "./OmegaFormStuff";
4
- declare const __VLS_export: <From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ declare const __VLS_export: <From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
5
  props: __VLS_PrettifyLocal<{
6
- form: OmegaInputProps<From, To>["form"];
6
+ form: OmegaInputProps<From, To, Name>["form"];
7
7
  pick?: DeepKeys<From>[];
8
8
  omit?: DeepKeys<From>[];
9
9
  labelMap?: (key: DeepKeys<From>) => string | undefined;
10
- filterMap?: <M extends OmegaAutoGenMeta<From, To>>(key: DeepKeys<From>, meta: M) => boolean | M;
10
+ filterMap?: <M extends OmegaAutoGenMeta<From, To, Name>>(key: DeepKeys<From>, meta: M) => boolean | M;
11
11
  order?: DeepKeys<From>[];
12
- sort?: Order.Order<OmegaAutoGenMeta<From, To>>;
12
+ sort?: Order.Order<OmegaAutoGenMeta<From, To, Name>>;
13
13
  }> & import("vue").PublicProps;
14
14
  expose: (exposed: {}) => void;
15
15
  attrs: any;
16
16
  slots: {
17
17
  default(props: {
18
- child: OmegaAutoGenMeta<From, To>;
18
+ child: OmegaAutoGenMeta<From, To, Name>;
19
19
  }): void;
20
20
  };
21
21
  emit: {};
@@ -2,7 +2,7 @@ import { type DeepKeys } from "@tanstack/vue-form";
2
2
  import type { MergedInputProps } from "./InputProps";
3
3
  import type { BaseProps, DefaultTypeProps } from "./OmegaFormStuff";
4
4
  declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
- props: __VLS_PrettifyLocal<BaseProps<From> & DefaultTypeProps> & import("vue").PublicProps;
5
+ props: __VLS_PrettifyLocal<BaseProps<From, Name> & DefaultTypeProps> & import("vue").PublicProps;
6
6
  expose: (exposed: {}) => void;
7
7
  attrs: any;
8
8
  slots: {
@@ -9,7 +9,7 @@ export type FieldPath<T> = unknown extends T ? string : T extends string | boole
9
9
  export type FieldPath_<T, Path extends string> = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint ? Path : T extends ReadonlyArray<infer U> ? FieldPath_<U, `${Path}[${number}]`> | Path : {
10
10
  [K in keyof T]: FieldPath_<T[K], `${Path}.${K & string}`>;
11
11
  }[keyof T];
12
- export type BaseProps<From, TName extends FieldPath<From> = FieldPath<From>> = {
12
+ export type BaseProps<From, TName extends FieldPath<From>> = {
13
13
  /**
14
14
  * Will fallback to i18n when not specified.
15
15
  * Can also be provided via #label slot for custom HTML labels.
@@ -37,19 +37,19 @@ export type DefaultTypeProps = {
37
37
  value: unknown;
38
38
  }[];
39
39
  };
40
- export type OmegaInputPropsBase<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = {
40
+ export type OmegaInputPropsBase<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = {
41
41
  form: OF<From, To> & {
42
42
  meta: MetaRecord<From>;
43
43
  i18nNamespace?: string;
44
44
  };
45
- } & BaseProps<From>;
46
- export type OmegaInputProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, TypeProps = DefaultTypeProps> = {
45
+ } & BaseProps<From, Name>;
46
+ export type OmegaInputProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>, TypeProps = DefaultTypeProps> = {
47
47
  form: OmegaFormReturn<From, To, TypeProps> & {
48
48
  meta: MetaRecord<From>;
49
49
  i18nNamespace?: string;
50
50
  };
51
- } & BaseProps<From>;
52
- export type OmegaArrayProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = Omit<OmegaInputProps<From, To>, "validators" | "options" | "label" | "type" | "items" | "name"> & {
51
+ } & BaseProps<From, Name>;
52
+ export type OmegaArrayProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = Omit<OmegaInputProps<From, To, Name>, "validators" | "options" | "label" | "type" | "items" | "name"> & {
53
53
  name: DeepKeys<From>;
54
54
  defaultItems?: DeepValue<From, DeepKeys<From>>;
55
55
  items?: "please use `defaultItems` instead";
@@ -146,7 +146,7 @@ export declare const generateInputStandardSchemaFromFieldMeta: (meta: FieldMeta)
146
146
  export declare const nullableInput: <A, I, R>(schema: S.Schema<A, I, R>, defaultValue: () => A) => S.transform<import("effect/Schema").NullOr<S.Schema<A, I, R>> & {
147
147
  withDefault: S.PropertySignature<":", A | null, never, ":", I | null, true, R>;
148
148
  }, S.SchemaClass<A, A, never>>;
149
- export type OmegaAutoGenMeta<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = Omit<OmegaInputProps<From, To>, "form">;
149
+ export type OmegaAutoGenMeta<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = Omit<OmegaInputProps<From, To, Name>, "form">;
150
150
  declare const supportedInputs: readonly ["button", "checkbox", "color", "date", "email", "number", "password", "radio", "range", "search", "submit", "tel", "text", "time", "url"];
151
151
  export type SupportedInputs = typeof supportedInputs[number];
152
152
  export declare const getInputType: (input: string) => SupportedInputs;
@@ -1,6 +1,7 @@
1
+ import { type DeepKeys } from "@tanstack/vue-form";
1
2
  import { type OmegaInputPropsBase } from "./OmegaFormStuff";
2
- declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: __VLS_PrettifyLocal<OmegaInputPropsBase<From, To>> & import("vue").PublicProps;
3
+ declare const __VLS_export: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
+ props: __VLS_PrettifyLocal<OmegaInputPropsBase<From, To, Name>> & import("vue").PublicProps;
4
5
  expose: (exposed: {}) => void;
5
6
  attrs: any;
6
7
  slots: {
@@ -124,8 +124,8 @@ export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To exten
124
124
  }>) => import("vue").VNode & {
125
125
  __ctx?: Awaited<typeof __VLS_setup>;
126
126
  };
127
- Array: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
128
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaArrayProps<From, To>, "form">) & {}> & import("vue").PublicProps;
127
+ Array: <Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
128
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaArrayProps<From, To, Name>, "form">) & {}> & import("vue").PublicProps;
129
129
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
130
130
  attrs: any;
131
131
  slots: {
@@ -154,20 +154,20 @@ export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To exten
154
154
  }>) => import("vue").VNode & {
155
155
  __ctx?: Awaited<typeof __VLS_setup>;
156
156
  };
157
- AutoGen: (__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
157
+ AutoGen: <Name extends DeepKeys<From>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
158
158
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
159
159
  pick?: DeepKeys<From>[];
160
160
  omit?: DeepKeys<From>[];
161
161
  labelMap?: (key: DeepKeys<From>) => string | undefined;
162
- filterMap?: <M extends OmegaAutoGenMeta<From, To>>(key: DeepKeys<From>, meta: M) => boolean | M;
162
+ filterMap?: <M extends OmegaAutoGenMeta<From, To, Name>>(key: DeepKeys<From>, meta: M) => boolean | M;
163
163
  order?: DeepKeys<From>[];
164
- sort?: Order.Order<OmegaAutoGenMeta<From, To>>;
164
+ sort?: Order.Order<OmegaAutoGenMeta<From, To, Name>>;
165
165
  } & {}> & import("vue").PublicProps;
166
166
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
167
167
  attrs: any;
168
168
  slots: {
169
169
  default(props: {
170
- child: OmegaAutoGenMeta<From, To>;
170
+ child: OmegaAutoGenMeta<From, To, Name>;
171
171
  }): void;
172
172
  };
173
173
  emit: {};
@@ -1,17 +1,17 @@
1
1
  import { useForm as J } from "@tanstack/vue-form";
2
2
  import { Data as z, S as D, Effect as l, Fiber as N, Option as P, Array as g } from "effect-app";
3
- import { runtimeFiberAsPromise as K } from "./vue-components.es17.js";
4
- import { isObject as T } from "./vue-components.es18.js";
3
+ import { runtimeFiberAsPromise as K } from "./vue-components.es16.js";
4
+ import { isObject as T } from "./vue-components.es17.js";
5
5
  import { computed as L, onUnmounted as k, onMounted as Z, onBeforeUnmount as G, watch as W, ref as Q, h as B } from "vue";
6
- import X from "./vue-components.es19.js";
7
- import Y from "./vue-components.es20.js";
8
- import C from "./vue-components.es21.js";
6
+ import X from "./vue-components.es18.js";
7
+ import Y from "./vue-components.es19.js";
8
+ import C from "./vue-components.es20.js";
9
9
  import { generateMetaFromSchema as ee } from "./vue-components.es12.js";
10
10
  import re from "./vue-components.es6.js";
11
11
  import te from "./vue-components.es8.js";
12
- import ne from "./vue-components.es22.js";
13
- import { trace as R } from "./vue-components.es23.js";
14
- import { context as x } from "./vue-components.es24.js";
12
+ import ne from "./vue-components.es21.js";
13
+ import { trace as R } from "./vue-components.es22.js";
14
+ import { context as x } from "./vue-components.es23.js";
15
15
  class se extends z.TaggedError("FormErrors") {
16
16
  }
17
17
  const E = (c) => function(i) {
@@ -1,6 +1,6 @@
1
- import l from "./vue-components.es29.js";
1
+ import l from "./vue-components.es28.js";
2
2
  import { inject as c, provide as u } from "vue";
3
- import { onMountedWithCleanup as f } from "./vue-components.es16.js";
3
+ import { onMountedWithCleanup as f } from "./vue-components.es29.js";
4
4
  const p = () => l(), i = Symbol("DialogBus"), r = () => c(i, null), g = () => {
5
5
  const n = p();
6
6
  return u(i, n), n;
@@ -1,13 +1,12 @@
1
- import { onMounted as e, onUnmounted as u } from "vue";
2
- function p(t) {
3
- let n;
4
- e(() => {
5
- const o = t();
6
- o && (n = o);
7
- }), u(() => {
8
- n && n();
9
- });
10
- }
1
+ import { Exit as c, Runtime as u } from "effect";
2
+ import { dual as n, isFunction as m } from "./vue-components.es30.js";
3
+ const i = Symbol.for("clone-trait"), a = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
4
+ n(2, (e, t) => a(e, { ...e, ...m(t) ? t(e) : t }));
5
+ const p = (e, t) => new Promise((o, s) => e.addObserver((r) => {
6
+ c.isSuccess(r) ? o(r.value) : s(u.makeFiberFailure(r.cause));
7
+ }));
11
8
  export {
12
- p as onMountedWithCleanup
9
+ a as clone,
10
+ i as cloneTrait,
11
+ p as runtimeFiberAsPromise
13
12
  };
@@ -1,12 +1,7 @@
1
- import { Exit as c, Runtime as u } from "effect";
2
- import { dual as n, isFunction as m } from "./vue-components.es30.js";
3
- const i = Symbol.for("clone-trait"), a = n(2, (e, t) => i in e ? e[i](t) : Object.setPrototypeOf(t, Object.getPrototypeOf(e)));
4
- n(2, (e, t) => a(e, { ...e, ...m(t) ? t(e) : t }));
5
- const p = (e, t) => new Promise((o, s) => e.addObserver((r) => {
6
- c.isSuccess(r) ? o(r.value) : s(u.makeFiberFailure(r.cause));
7
- }));
1
+ import { isFunction as c } from "./vue-components.es30.js";
2
+ const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
8
3
  export {
9
- a as clone,
10
- i as cloneTrait,
11
- p as runtimeFiberAsPromise
4
+ s as isFunction,
5
+ i as isObject,
6
+ t as isRecordOrArray
12
7
  };
@@ -1,7 +1,57 @@
1
- import { isFunction as c } from "./vue-components.es30.js";
2
- const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
1
+ import { defineComponent as F, computed as f, 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 C, mergeProps as b } from "vue";
2
+ const N = /* @__PURE__ */ F({
3
+ inheritAttrs: !1,
4
+ __name: "OmegaArray",
5
+ props: {
6
+ form: {},
7
+ inputClass: {},
8
+ name: {},
9
+ defaultItems: {},
10
+ items: {}
11
+ },
12
+ setup(n) {
13
+ const a = n, y = a.form.useStore((e) => e.values), i = f(() => {
14
+ const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
15
+ try {
16
+ return e.split(".").reduce((r, t) => r && r[t], y.value);
17
+ } catch (r) {
18
+ return console.error(r), [];
19
+ }
20
+ });
21
+ M(async () => {
22
+ a.defaultItems && !i.value && a.form.setFieldValue(a.name, a.defaultItems);
23
+ });
24
+ const $ = f(() => (r) => {
25
+ const t = r.replace(/\[\d+\]/g, "");
26
+ return a.form.meta[t];
27
+ });
28
+ return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
29
+ default: g(({ field: t, state: d }) => [
30
+ o(e.$slots, "pre-array", l(u({ field: t, state: d }))),
31
+ (s(!0), k(A, null, C(i.value, (B, m) => (s(), c(p(n.form.Field), {
32
+ key: `${n.name}[${Number(m)}]`,
33
+ name: (
34
+ // eslint-disable-next-line
35
+ `${n.name}[${Number(m)}]`
36
+ )
37
+ }, {
38
+ default: g(({ field: v, state: h }) => [
39
+ o(e.$slots, "default", b({ ref_for: !0 }, {
40
+ subField: v,
41
+ subState: h,
42
+ index: Number(m),
43
+ field: t
44
+ }))
45
+ ]),
46
+ _: 2
47
+ }, 1032, ["name"]))), 128)),
48
+ o(e.$slots, "post-array", l(u({ field: t, state: d }))),
49
+ o(e.$slots, "field", l(u({ field: t })))
50
+ ]),
51
+ _: 3
52
+ }, 8, ["name"]));
53
+ }
54
+ });
3
55
  export {
4
- s as isFunction,
5
- i as isObject,
6
- t as isRecordOrArray
56
+ N as default
7
57
  };
@@ -1,57 +1,70 @@
1
- import { defineComponent as F, computed as f, 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 C, mergeProps as b } from "vue";
2
- const N = /* @__PURE__ */ F({
3
- inheritAttrs: !1,
4
- __name: "OmegaArray",
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
5
  props: {
6
6
  form: {},
7
- inputClass: {},
8
- name: {},
9
- defaultItems: {},
10
- items: {}
7
+ pick: {},
8
+ omit: {},
9
+ labelMap: { type: Function },
10
+ filterMap: { type: Function },
11
+ order: {},
12
+ sort: {}
11
13
  },
12
- setup(n) {
13
- const a = n, y = a.form.useStore((e) => e.values), i = f(() => {
14
- const e = a.name.replace(/\[/g, ".").replace(/\]/g, "");
15
- try {
16
- return e.split(".").reduce((r, t) => r && r[t], y.value);
17
- } catch (r) {
18
- return console.error(r), [];
19
- }
20
- });
21
- M(async () => {
22
- a.defaultItems && !i.value && a.form.setFieldValue(a.name, a.defaultItems);
23
- });
24
- const $ = f(() => (r) => {
25
- const t = r.replace(/\[\d+\]/g, "");
26
- return a.form.meta[t];
27
- });
28
- return P("getMetaFromArray", $), (e, r) => (s(), c(p(n.form.Field), { name: n.name }, {
29
- default: g(({ field: t, state: d }) => [
30
- o(e.$slots, "pre-array", l(u({ field: t, state: d }))),
31
- (s(!0), k(A, null, C(i.value, (B, m) => (s(), c(p(n.form.Field), {
32
- key: `${n.name}[${Number(m)}]`,
33
- name: (
34
- // eslint-disable-next-line
35
- `${n.name}[${Number(m)}]`
36
- )
37
- }, {
38
- default: g(({ field: v, state: h }) => [
39
- o(e.$slots, "default", b({ ref_for: !0 }, {
40
- subField: v,
41
- subState: h,
42
- index: Number(m),
43
- field: t
44
- }))
45
- ]),
46
- _: 2
47
- }, 1032, ["name"]))), 128)),
48
- o(e.$slots, "post-array", l(u({ field: t, state: d }))),
49
- o(e.$slots, "field", l(u({ field: t })))
50
- ]),
51
- _: 3
52
- }, 8, ["name"]));
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));
53
66
  }
54
67
  });
55
68
  export {
56
- N as default
69
+ I as default
57
70
  };
@@ -1,70 +1,8 @@
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
+ (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");if(a.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),document.head.appendChild(a),window.customElements){const e=window.customElements.define;window.customElements.define=function(r,t){const i=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(i&&i.call(this),this.shadowRoot){const d=document.createElement("style");d.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),this.shadowRoot.appendChild(d)}},e.call(window.customElements,r,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import r from "./vue-components.es33.js";
3
+
4
+ import o from "./vue-components.es35.js";
5
+ const e = /* @__PURE__ */ o(r, [["__scopeId", "data-v-d4ffe76f"]]);
68
6
  export {
69
- I as default
7
+ e as default
70
8
  };
@@ -1,8 +1,8 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");if(a.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),document.head.appendChild(a),window.customElements){const e=window.customElements.define;window.customElements.define=function(r,t){const i=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(i&&i.call(this),this.shadowRoot){const d=document.createElement("style");d.appendChild(document.createTextNode(".v-enter-from[data-v-d4ffe76f],.v-leave-to[data-v-d4ffe76f]{max-height:0px;grid-template-rows:0fr;opacity:0}.v-enter-active[data-v-d4ffe76f],.v-leave-active[data-v-d4ffe76f]{display:grid;transition:all .15s}.v-enter-to[data-v-d4ffe76f],.v-leave-from[data-v-d4ffe76f]{grid-template-rows:1fr;max-height:50vh;opacity:1}.error-alert[data-v-d4ffe76f]{transition-behavior:allow-discrete;display:grid;overflow:hidden;min-height:0}.error-alert>*[data-v-d4ffe76f]{min-height:0}.error-list[data-v-d4ffe76f]{list-style-position:inside}div.error-list[data-v-d4ffe76f]{container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;gap:1.5em;align-items:start}@container (max-width: 27.125rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:auto 1fr}.error-link[data-v-d4ffe76f]{grid-column:1 / -1;justify-self:end}}@container (max-width: 17.75rem){div.error-list[data-v-d4ffe76f]{grid-template-columns:1fr}.error-message[data-v-d4ffe76f]{grid-column:1 / -1}}.error-item[data-v-d4ffe76f]{display:contents}a[data-v-d4ffe76f]{min-width:min-content}.error-link[data-v-d4ffe76f]{align-items:center;color:inherit;display:inline-flex;flex-wrap:wrap;gap:.25em;padding-bottom:1em;text-decoration:none}")),this.shadowRoot.appendChild(d)}},e.call(window.customElements,r,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import r from "./vue-components.es33.js";
1
+ (function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import o from "./vue-components.es36.js";
3
3
 
4
- import o from "./vue-components.es35.js";
5
- const e = /* @__PURE__ */ o(r, [["__scopeId", "data-v-d4ffe76f"]]);
4
+ import m from "./vue-components.es35.js";
5
+ const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
6
6
  export {
7
7
  e as default
8
8
  };
@@ -1,8 +1,5 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const d=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(d&&d.call(this),this.shadowRoot){const o=document.createElement("style");o.appendChild(document.createTextNode("fieldset[data-v-05e510ab]{display:contents}fieldset[disabled][data-v-05e510ab]>*{pointer-events:none}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import o from "./vue-components.es36.js";
3
-
4
- import m from "./vue-components.es35.js";
5
- const e = /* @__PURE__ */ m(o, [["__scopeId", "data-v-05e510ab"]]);
1
+ import { TraceAPI as r } from "./vue-components.es52.js";
2
+ var t = r.getInstance();
6
3
  export {
7
- e as default
4
+ t as trace
8
5
  };
@@ -1,5 +1,5 @@
1
- import { TraceAPI as r } from "./vue-components.es52.js";
2
- var t = r.getInstance();
1
+ import { ContextAPI as t } from "./vue-components.es51.js";
2
+ var o = t.getInstance();
3
3
  export {
4
- t as trace
4
+ o as context
5
5
  };
@@ -1,5 +1,4 @@
1
- import { ContextAPI as t } from "./vue-components.es51.js";
2
- var o = t.getInstance();
1
+ import f from "./vue-components.es6.js";
3
2
  export {
4
- o as context
3
+ f as default
5
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es6.js";
1
+ import f from "./vue-components.es7.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es7.js";
1
+ import f from "./vue-components.es8.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es8.js";
1
+ import f from "./vue-components.es9.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,19 @@
1
- import f from "./vue-components.es9.js";
1
+ function c(t) {
2
+ return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, f) {
3
+ var i = t.get(e);
4
+ i ? i.push(f) : t.set(e, [f]);
5
+ }, off: function(e, f) {
6
+ var i = t.get(e);
7
+ i && (f ? i.splice(i.indexOf(f) >>> 0, 1) : t.set(e, []));
8
+ }, emit: function(e, f) {
9
+ var i = t.get(e);
10
+ i && i.slice().map(function(a) {
11
+ a(f);
12
+ }), (i = t.get("*")) && i.slice().map(function(a) {
13
+ a(e, f);
14
+ });
15
+ } };
16
+ }
2
17
  export {
3
- f as default
18
+ c as default
4
19
  };
@@ -1,19 +1,13 @@
1
- function c(t) {
2
- return { all: t = t || /* @__PURE__ */ new Map(), on: function(e, f) {
3
- var i = t.get(e);
4
- i ? i.push(f) : t.set(e, [f]);
5
- }, off: function(e, f) {
6
- var i = t.get(e);
7
- i && (f ? i.splice(i.indexOf(f) >>> 0, 1) : t.set(e, []));
8
- }, emit: function(e, f) {
9
- var i = t.get(e);
10
- i && i.slice().map(function(a) {
11
- a(f);
12
- }), (i = t.get("*")) && i.slice().map(function(a) {
13
- a(e, f);
14
- });
15
- } };
1
+ import { onMounted as e, onUnmounted as u } from "vue";
2
+ function p(t) {
3
+ let n;
4
+ e(() => {
5
+ const o = t();
6
+ o && (n = o);
7
+ }), u(() => {
8
+ n && n();
9
+ });
16
10
  }
17
11
  export {
18
- c as default
12
+ p as onMountedWithCleanup
19
13
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es19.js";
1
+ import f from "./vue-components.es18.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es20.js";
1
+ import f from "./vue-components.es19.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as v, mergeModels as C, useModel as k, useSlots as V, computed as _, resolveComponent as g, createBlock as y, openBlock as B, unref as a, createSlots as E, withCtx as u, renderSlot as d, renderList as M, normalizeProps as S, guardReactiveProps as w } from "vue";
2
2
  import { useOnClose as L } from "./vue-components.es11.js";
3
- import { onMountedWithCleanup as h } from "./vue-components.es16.js";
3
+ import { onMountedWithCleanup as h } from "./vue-components.es29.js";
4
4
  const z = /* @__PURE__ */ v({
5
5
  __name: "Dialog",
6
6
  props: /* @__PURE__ */ C({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "effect": "^3.18.0",
@@ -45,14 +45,15 @@
45
45
  generic="
46
46
  // dprint ignore - somehow with 120 chars, this becomes a mess. should report it.
47
47
  From extends Record<PropertyKey, any>,
48
- To extends Record<PropertyKey, any>
48
+ To extends Record<PropertyKey, any>,
49
+ Name extends DeepKeys<From>
49
50
  "
50
51
  >
51
52
  import { type DeepKeys } from "@tanstack/vue-form"
52
53
  import { computed, onMounted, provide } from "vue"
53
54
  import { type OmegaArrayProps } from "./OmegaFormStuff"
54
55
 
55
- const props = defineProps<OmegaArrayProps<From, To>>()
56
+ const props = defineProps<OmegaArrayProps<From, To, Name>>()
56
57
 
57
58
  defineOptions({
58
59
  inheritAttrs: false
@@ -4,7 +4,7 @@
4
4
  :child="{ name, label, ...attrs }"
5
5
  >
6
6
  <form.Input
7
- :name="name"
7
+ :name="name as FieldPath<From>"
8
8
  :label="label"
9
9
  v-bind="attrs"
10
10
  />
@@ -16,15 +16,16 @@
16
16
  lang="ts"
17
17
  generic="
18
18
  From extends Record<PropertyKey, string>,
19
- To extends Record<PropertyKey, string>
19
+ To extends Record<PropertyKey, string>,
20
+ Name extends DeepKeys<From>
20
21
  "
21
22
  >
22
23
  import { type DeepKeys } from "@tanstack/vue-form"
23
24
  import { Array as A, Order, pipe } from "effect-app"
24
25
  import { computed } from "vue"
25
- import { type FieldMeta, type OmegaAutoGenMeta, type OmegaInputProps } from "./OmegaFormStuff"
26
+ import { type FieldMeta, type FieldPath, type OmegaAutoGenMeta, type OmegaInputProps } from "./OmegaFormStuff"
26
27
 
27
- type NewMeta = OmegaAutoGenMeta<From, To>
28
+ type NewMeta = OmegaAutoGenMeta<From, To, Name>
28
29
 
29
30
  const mapObject = <K extends string, A, B>(fn: (value: A, key: K) => B) => (obj: Record<K, A>): Record<K, B> =>
30
31
  Object.fromEntries(
@@ -51,7 +52,7 @@ const filterMapRecord =
51
52
  )
52
53
 
53
54
  const props = defineProps<{
54
- form: OmegaInputProps<From, To>["form"]
55
+ form: OmegaInputProps<From, To, Name>["form"]
55
56
  pick?: DeepKeys<From>[]
56
57
  omit?: DeepKeys<From>[]
57
58
  labelMap?: (key: DeepKeys<From>) => string | undefined
@@ -27,7 +27,8 @@ import { OmegaFormKey } from "./useOmegaForm"
27
27
 
28
28
  const form = inject(OmegaFormKey) as unknown as OmegaInputProps<
29
29
  From,
30
- To
30
+ To,
31
+ Name
31
32
  >["form"]
32
33
 
33
34
  if (!form) {
@@ -35,7 +36,7 @@ if (!form) {
35
36
  }
36
37
 
37
38
  defineProps<
38
- BaseProps<From> & DefaultTypeProps
39
+ BaseProps<From, Name> & DefaultTypeProps
39
40
  >()
40
41
 
41
42
  defineSlots<{
@@ -7,6 +7,12 @@ import { getTransformationFrom, useIntl } from "../../utils"
7
7
  import { type OmegaFieldInternalApi } from "./InputProps"
8
8
  import { type OF, type OmegaFormReturn } from "./useOmegaForm"
9
9
 
10
+ type Compute<T> =
11
+ & {
12
+ [K in keyof T]: T[K]
13
+ }
14
+ & {}
15
+
10
16
  export type FieldPath<T> = unknown extends T ? string
11
17
  // technically we cannot have primitive at the root
12
18
  : T extends string | boolean | number | null | undefined | symbol | bigint ? ""
@@ -23,7 +29,7 @@ export type FieldPath_<T, Path extends string> = unknown extends T ? string
23
29
  [K in keyof T]: FieldPath_<T[K], `${Path}.${K & string}`>
24
30
  }[keyof T]
25
31
 
26
- export type BaseProps<From, TName extends FieldPath<From> = FieldPath<From>> = {
32
+ export type BaseProps<From, TName extends FieldPath<From>> = {
27
33
  /**
28
34
  * Will fallback to i18n when not specified.
29
35
  * Can also be provided via #label slot for custom HTML labels.
@@ -58,31 +64,34 @@ export type DefaultTypeProps = {
58
64
 
59
65
  export type OmegaInputPropsBase<
60
66
  From extends Record<PropertyKey, any>,
61
- To extends Record<PropertyKey, any>
67
+ To extends Record<PropertyKey, any>,
68
+ Name extends DeepKeys<From>
62
69
  > = {
63
70
  form: OF<From, To> & {
64
71
  meta: MetaRecord<From>
65
72
  i18nNamespace?: string
66
73
  }
67
- } & BaseProps<From>
74
+ } & BaseProps<From, Name>
68
75
 
69
76
  export type OmegaInputProps<
70
77
  From extends Record<PropertyKey, any>,
71
78
  To extends Record<PropertyKey, any>,
79
+ Name extends DeepKeys<From>,
72
80
  TypeProps = DefaultTypeProps
73
81
  > = {
74
82
  form: OmegaFormReturn<From, To, TypeProps> & {
75
83
  meta: MetaRecord<From>
76
84
  i18nNamespace?: string
77
85
  }
78
- } & BaseProps<From>
86
+ } & BaseProps<From, Name>
79
87
 
80
88
  export type OmegaArrayProps<
81
89
  From extends Record<PropertyKey, any>,
82
- To extends Record<PropertyKey, any>
90
+ To extends Record<PropertyKey, any>,
91
+ Name extends DeepKeys<From>
83
92
  > =
84
93
  & Omit<
85
- OmegaInputProps<From, To>,
94
+ OmegaInputProps<From, To, Name>,
86
95
  "validators" | "options" | "label" | "type" | "items" | "name"
87
96
  >
88
97
  & {
@@ -880,8 +889,9 @@ export const nullableInput = <A, I, R>(
880
889
 
881
890
  export type OmegaAutoGenMeta<
882
891
  From extends Record<PropertyKey, any>,
883
- To extends Record<PropertyKey, any>
884
- > = Omit<OmegaInputProps<From, To>, "form">
892
+ To extends Record<PropertyKey, any>,
893
+ Name extends DeepKeys<From>
894
+ > = Omit<OmegaInputProps<From, To, Name>, "form">
885
895
 
886
896
  const supportedInputs = [
887
897
  "button",
@@ -40,7 +40,8 @@
40
40
  generic="
41
41
  // dprint ignore - somehow with 120 chars, this becomes a mess. should report it.
42
42
  From extends Record<PropertyKey, any>,
43
- To extends Record<PropertyKey, any>
43
+ To extends Record<PropertyKey, any>,
44
+ Name extends DeepKeys<From>
44
45
  "
45
46
  >
46
47
  import { type DeepKeys } from "@tanstack/vue-form"
@@ -49,7 +50,7 @@ import { useIntl } from "../../utils"
49
50
  import { type FieldMeta, generateInputStandardSchemaFromFieldMeta, type OmegaInputPropsBase } from "./OmegaFormStuff"
50
51
  import OmegaInternalInput from "./OmegaInternalInput.vue"
51
52
 
52
- const props = defineProps<OmegaInputPropsBase<From, To>>()
53
+ const props = defineProps<OmegaInputPropsBase<From, To, Name>>()
53
54
 
54
55
  // downgrade to *as* DeepKeys<From> to avoid useless and possible infinite recursion in TS
55
56
  const propsName = computed(() => props.name as DeepKeys<From>)
@@ -356,7 +356,7 @@ export interface OmegaFormReturn<
356
356
  ) => import("vue").VNode & {
357
357
  __ctx?: Awaited<typeof __VLS_setup>
358
358
  }
359
- Array: (
359
+ Array: <Name extends DeepKeys<From>>(
360
360
  __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
361
361
  __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
362
362
  __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
@@ -371,7 +371,7 @@ export interface OmegaFormReturn<
371
371
  >,
372
372
  never
373
373
  >
374
- & (Omit<OmegaArrayProps<From, To>, "form">)
374
+ & (Omit<OmegaArrayProps<From, To, Name>, "form">)
375
375
  & {}
376
376
  >
377
377
  & import("vue").PublicProps
@@ -663,7 +663,7 @@ export interface OmegaFormReturn<
663
663
  __ctx?: Awaited<typeof __VLS_setup>
664
664
  }
665
665
 
666
- AutoGen: (
666
+ AutoGen: <Name extends DeepKeys<From>>(
667
667
  __VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"],
668
668
  __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>,
669
669
  __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"],
@@ -682,9 +682,9 @@ export interface OmegaFormReturn<
682
682
  pick?: DeepKeys<From>[]
683
683
  omit?: DeepKeys<From>[]
684
684
  labelMap?: (key: DeepKeys<From>) => string | undefined
685
- filterMap?: <M extends OmegaAutoGenMeta<From, To>>(key: DeepKeys<From>, meta: M) => boolean | M
685
+ filterMap?: <M extends OmegaAutoGenMeta<From, To, Name>>(key: DeepKeys<From>, meta: M) => boolean | M
686
686
  order?: DeepKeys<From>[]
687
- sort?: Order.Order<OmegaAutoGenMeta<From, To>>
687
+ sort?: Order.Order<OmegaAutoGenMeta<From, To, Name>>
688
688
  } & {}
689
689
  >
690
690
  & import("vue").PublicProps
@@ -692,7 +692,7 @@ export interface OmegaFormReturn<
692
692
  attrs: any
693
693
  slots: {
694
694
  default(props: {
695
- child: OmegaAutoGenMeta<From, To>
695
+ child: OmegaAutoGenMeta<From, To, Name>
696
696
  }): void
697
697
  }
698
698
  emit: {}