@effect-app/vue-components 0.12.21 → 0.13.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 (29) hide show
  1. package/dist/types/components/OmegaForm/InputProps.d.ts +6 -4
  2. package/dist/types/components/OmegaForm/OmegaArray.vue.d.ts +1 -1
  3. package/dist/types/components/OmegaForm/OmegaAutoGen.vue.d.ts +2 -2
  4. package/dist/types/components/OmegaForm/OmegaFormInput.vue.d.ts +3 -3
  5. package/dist/types/components/OmegaForm/OmegaFormStuff.d.ts +3 -3
  6. package/dist/types/components/OmegaForm/OmegaInput.vue.d.ts +2 -2
  7. package/dist/types/components/OmegaForm/OmegaInputVuetify.vue.d.ts +3 -2
  8. package/dist/types/components/OmegaForm/OmegaInternalInput.vue.d.ts +5 -4
  9. package/dist/types/components/OmegaForm/OmegaWrapper.vue.d.ts +5 -5
  10. package/dist/types/components/OmegaForm/useOmegaForm.d.ts +6 -5
  11. package/dist/vue-components.es11.js +3 -3
  12. package/dist/vue-components.es13.js +1 -1
  13. package/dist/vue-components.es22.js +1 -1
  14. package/dist/vue-components.es23.js +90 -2
  15. package/dist/vue-components.es24.js +11 -90
  16. package/dist/vue-components.es25.js +2 -11
  17. package/dist/vue-components.es26.js +1 -1
  18. package/dist/vue-components.es4.js +1 -1
  19. package/package.json +1 -1
  20. package/src/components/OmegaForm/InputProps.ts +34 -23
  21. package/src/components/OmegaForm/OmegaArray.vue +1 -1
  22. package/src/components/OmegaForm/OmegaAutoGen.vue +2 -2
  23. package/src/components/OmegaForm/OmegaFormInput.vue +3 -4
  24. package/src/components/OmegaForm/OmegaFormStuff.ts +3 -3
  25. package/src/components/OmegaForm/OmegaInput.vue +1 -1
  26. package/src/components/OmegaForm/OmegaInputVuetify.vue +7 -6
  27. package/src/components/OmegaForm/OmegaInternalInput.vue +6 -6
  28. package/src/components/OmegaForm/OmegaWrapper.vue +3 -3
  29. package/src/components/OmegaForm/useOmegaForm.ts +23 -22
@@ -1,6 +1,8 @@
1
1
  import type { DeepValue, DeepKeys, FieldApi, FormAsyncValidateOrFn, FormValidateOrFn, StandardSchemaV1, FieldValidateOrFn, FieldValidateFn, FieldValidateAsyncFn, FieldAsyncValidateOrFn } from "@tanstack/vue-form";
2
- export type OmegaFieldInternalApi<From, To> = FieldApi<From, DeepKeys<From>, DeepValue<From, any>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined, StandardSchemaV1<unknown, To> | FieldValidateFn<From, any, To>, StandardSchemaV1<unknown, To> | FieldValidateAsyncFn<From, any, To>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>>, FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined, FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, any, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
3
- export type InputProps<T, S = unknown> = {
2
+ export type OmegaFieldInternalApi<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = FieldApi<From, TName, DeepValue<From, TName>, FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined, StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateFn<From, TName>, StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateAsyncFn<From, TName>, FieldValidateOrFn<From, TName, DeepValue<From, TName>>, FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>>, FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined, FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>> | undefined, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, any, // FormAsyncValidateOrFn<From>,
3
+ // FormAsyncValidateOrFn<From>,
4
+ FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
5
+ export type InputProps<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = {
4
6
  id: string;
5
7
  required?: boolean;
6
8
  minLength?: number | false;
@@ -8,10 +10,10 @@ export type InputProps<T, S = unknown> = {
8
10
  max?: number | false;
9
11
  min?: number | false;
10
12
  name: string;
11
- modelValue: S;
13
+ modelValue: DeepValue<From, TName>;
12
14
  errorMessages: string[];
13
15
  error: boolean;
14
- field: OmegaFieldInternalApi<T, S>;
16
+ field: OmegaFieldInternalApi<From, TName>;
15
17
  setRealDirty: () => void;
16
18
  type: string;
17
19
  label: string;
@@ -1,6 +1,6 @@
1
1
  import { type OmegaInputProps } from "./OmegaFormStuff";
2
2
  import { type DeepValue, type DeepKeys } from "@tanstack/vue-form";
3
- declare const _default: <From, To>(__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
+ declare const _default: <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
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & (Omit<OmegaInputProps<From, To>, "type" | "label" | "items" | "options" | "validators"> & {
5
5
  items?: DeepValue<To, DeepKeys<To>>;
6
6
  }) & Partial<{}>> & import("vue").PublicProps;
@@ -1,8 +1,8 @@
1
1
  import { type OmegaInputProps } from "./OmegaFormStuff";
2
2
  import { Order } from "effect-app";
3
3
  import { DeepKeys } from "@tanstack/vue-form";
4
- export type OmegaAutoGenMeta<From, To> = Omit<OmegaInputProps<From, To>, "form">;
5
- declare const _default: <From, To>(__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
+ export type OmegaAutoGenMeta<From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>> = Omit<OmegaInputProps<From, To>, "form">;
5
+ declare const _default: <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<{
6
6
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
7
7
  form: OmegaInputProps<From, To>["form"];
8
8
  pick?: DeepKeys<From>[];
@@ -1,9 +1,9 @@
1
1
  import type { FieldValidators, TypeOverride } from "./OmegaFormStuff";
2
2
  import type { InputProps } from "./InputProps";
3
3
  import { DeepKeys } from "@tanstack/vue-form";
4
- declare const _default: <From, 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
+ declare const _default: <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
5
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
6
- name: DeepKeys<From>;
6
+ name: Name;
7
7
  label: string;
8
8
  validators?: FieldValidators<From>;
9
9
  options?: {
@@ -15,7 +15,7 @@ declare const _default: <From, To extends Record<PropertyKey, any>>(__VLS_props:
15
15
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
16
16
  attrs: any;
17
17
  slots: {
18
- default: InputProps<From, To>;
18
+ default(props: InputProps<From, Name>): void;
19
19
  };
20
20
  emit: {};
21
21
  }>) => import("vue").VNode & {
@@ -3,7 +3,7 @@ import { type FormAsyncValidateOrFn, type FormValidateOrFn, type StandardSchemaV
3
3
  import { OmegaFormReturn } from "./useOmegaForm";
4
4
  import { OmegaFieldInternalApi } from "./InputProps";
5
5
  export type ShowErrorsOn = "onChange" | "onBlur" | "onSubmit";
6
- export type OmegaInputProps<From, To> = {
6
+ export type OmegaInputProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = {
7
7
  form: OmegaFormReturn<From, To> & {
8
8
  meta: MetaRecord<From>;
9
9
  };
@@ -33,8 +33,8 @@ export type OmegaFormParams<From, To> = FormApi<From, FormValidateOrFn<From> | u
33
33
  export type OmegaFormState<From, To> = FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
34
34
  export type OmegaFormApi<From, To> = OmegaFormParams<From, To> & VueFormApi<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From> | undefined>;
35
35
  export type FormComponent<T, S> = VueFormApi<T, FormValidateOrFn<T> | undefined, FormValidateOrFn<T> | undefined, StandardSchemaV1<T, S>, FormValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined, FormValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined, FormAsyncValidateOrFn<T> | undefined>;
36
- export type FormType<T, S = unknown> = OmegaFormApi<T, S> & {
37
- Field: OmegaFieldInternalApi<T, S>;
36
+ export type FormType<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = OmegaFormApi<From, To> & {
37
+ Field: OmegaFieldInternalApi<From, Name>;
38
38
  };
39
39
  export type PrefixFromDepth<K extends string | number, _TDepth extends any[]> = K;
40
40
  export type NestedKeyOf<T> = DeepKeys<T>;
@@ -1,5 +1,5 @@
1
1
  import { type OmegaInputProps } from "./OmegaFormStuff";
2
- declare const _default: <From, To>(__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<{
2
+ declare const _default: <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
3
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & OmegaInputProps<From, To> & Partial<{}>> & import("vue").PublicProps;
4
4
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
5
5
  attrs: any;
@@ -12,7 +12,7 @@ declare const _default: <From, To>(__VLS_props: NonNullable<Awaited<typeof __VLS
12
12
  max?: number | false;
13
13
  min?: number | false;
14
14
  name: string;
15
- modelValue: any;
15
+ modelValue: import("@tanstack/vue-form").DeepValue<From, any>;
16
16
  errorMessages: string[];
17
17
  error: boolean;
18
18
  field: import("./InputProps").OmegaFieldInternalApi<From, any>;
@@ -1,10 +1,11 @@
1
+ import { DeepKeys } from "@tanstack/vue-form";
1
2
  import type { InputProps } from "./InputProps";
2
- declare const _default: <T, S>(__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
+ declare const _default: <From 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<{
3
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
5
  readonly onBlur?: ((event: Event) => any) | undefined;
5
6
  readonly onFocus?: ((event: Event) => any) | undefined;
6
7
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onBlur" | "onFocus"> & {
7
- inputProps: InputProps<T, S>;
8
+ inputProps: InputProps<From, Name>;
8
9
  vuetifyValue: unknown;
9
10
  } & Partial<{}>> & import("vue").PublicProps;
10
11
  expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
@@ -1,8 +1,9 @@
1
+ import { DeepKeys } from "@tanstack/vue-form";
1
2
  import type { FieldValidators, MetaRecord, NestedKeyOf, TypeOverride } from "./OmegaFormStuff";
2
3
  import type { OmegaFieldInternalApi } from "./InputProps";
3
- declare const _default: <From, To>(__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 _default: <From 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
5
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
5
- field: OmegaFieldInternalApi<From, To>;
6
+ field: OmegaFieldInternalApi<From, Name>;
6
7
  meta: MetaRecord<From>[NestedKeyOf<From>];
7
8
  label: string;
8
9
  options?: {
@@ -23,10 +24,10 @@ declare const _default: <From, To>(__VLS_props: NonNullable<Awaited<typeof __VLS
23
24
  max?: number | false;
24
25
  min?: number | false;
25
26
  name: string;
26
- modelValue: To;
27
+ modelValue: import("@tanstack/vue-form").DeepValue<From, Name>;
27
28
  errorMessages: string[];
28
29
  error: boolean;
29
- field: OmegaFieldInternalApi<From, To>;
30
+ field: OmegaFieldInternalApi<From, Name>;
30
31
  setRealDirty: () => void;
31
32
  type: string;
32
33
  label: string;
@@ -1,16 +1,16 @@
1
1
  import { type S } from "effect-app";
2
2
  import { type OmegaFormState, type ShowErrorsOn } from "./OmegaFormStuff";
3
3
  import { type OmegaConfig, type OmegaFormReturn } from "./useOmegaForm";
4
- declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, 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
+ declare const _default: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, K extends keyof OmegaFormState<From, To> = keyof OmegaFormState<From, To>>(__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<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ({
6
6
  omegaConfig?: OmegaConfig<From>;
7
7
  subscribe?: K[];
8
8
  showErrorsOn?: ShowErrorsOn;
9
- } & Omit<import("@tanstack/vue-form").FormOptions<To, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").StandardSchemaV1<To, From>, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<To> | undefined>, "onSubmit"> & ({
9
+ } & Omit<import("@tanstack/vue-form").FormOptions<From, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").StandardSchemaV1<From, To>, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined, import("@tanstack/vue-form").FormAsyncValidateOrFn<From> | undefined>, "onSubmit"> & ({
10
10
  onSubmit?: ((props: {
11
- formApi: import("./OmegaFormStuff").OmegaFormParams<To, From>;
11
+ formApi: import("./OmegaFormStuff").OmegaFormParams<From, To>;
12
12
  meta: any;
13
- value: From;
13
+ value: To;
14
14
  }) => Promise<any> | any) | undefined;
15
15
  } & ({
16
16
  form: OmegaFormReturn<From, To>;
@@ -24,7 +24,7 @@ declare const _default: <From extends Record<PropertyKey, any>, To extends Recor
24
24
  slots: {
25
25
  default(): void;
26
26
  internalForm(props: {
27
- form: OmegaFormReturn<To, From>;
27
+ form: OmegaFormReturn<From, To>;
28
28
  subscribedValues: K[] extends undefined[] ? Record<string, never> : Pick<OmegaFormState<From, To>, K>;
29
29
  }): void;
30
30
  externalForm(props: {
@@ -1,3 +1,4 @@
1
+ import { DeepKeys } from "@tanstack/vue-form";
1
2
  import { type Record, S } from "effect-app";
2
3
  import { type NestedKeyOf, type FilterItems, type FormProps, type MetaRecord, type OmegaFormApi } from "./OmegaFormStuff";
3
4
  import { type InjectionKey } from "vue";
@@ -20,14 +21,14 @@ export type OmegaConfig<T> = {
20
21
  id?: string;
21
22
  } & keysRule<T>;
22
23
  };
23
- interface OF<To, From> extends OmegaFormApi<To, From> {
24
- meta: MetaRecord<To>;
24
+ interface OF<From, To> extends OmegaFormApi<From, To> {
25
+ meta: MetaRecord<From>;
25
26
  filterItems?: FilterItems;
26
27
  clear: () => void;
27
28
  }
28
29
  export declare const OmegaFormKey: InjectionKey<OF<any, any>>;
29
- export interface OmegaFormReturn<From, To> extends OF<From, To> {
30
- Input: typeof OmegaFormInput;
30
+ export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> extends OF<From, To> {
31
+ Input: typeof OmegaFormInput<From, To, DeepKeys<From>>;
31
32
  }
32
- export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(schema: S.Schema<From, To, never>, tanstackFormOptions?: NoInfer<FormProps<To, From>>, omegaConfig?: OmegaConfig<From>) => OmegaFormReturn<From, To>;
33
+ export declare const useOmegaForm: <From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>>(schema: S.Schema<To, From, never>, tanstackFormOptions?: NoInfer<FormProps<From, To>>, omegaConfig?: OmegaConfig<To>) => OmegaFormReturn<From, To>;
33
34
  export {};
@@ -1,8 +1,8 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-69817219]{display:contents}")),document.head.appendChild(n),window.customElements){const e=window.customElements.define;window.customElements.define=function(i,t){const o=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(o&&o.call(this),this.shadowRoot){const d=document.createElement("style");d.appendChild(document.createTextNode("fieldset[data-v-69817219]{display:contents}")),this.shadowRoot.appendChild(d)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");if(n.appendChild(document.createTextNode("fieldset[data-v-b5d2d31e]{display:contents}")),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-b5d2d31e]{display:contents}")),this.shadowRoot.appendChild(o)}},e.call(window.customElements,i,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
2
  import o from "./vue-components.es13.js";
3
3
 
4
4
  import r from "./vue-components.es15.js";
5
- const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-69817219"]]);
5
+ const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b5d2d31e"]]);
6
6
  export {
7
- m as default
7
+ e as default
8
8
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as w, computed as f, onBeforeMount as E, watch as j, createElementBlock as v, openBlock as b, withModifiers as F, createElementVNode as M, unref as c, renderSlot as p, createCommentVNode as k, Fragment as V } from "vue";
2
2
  import { useStore as g } from "@tanstack/vue-form";
3
- import { getOmegaStore as B } from "./vue-components.es25.js";
3
+ import { getOmegaStore as B } from "./vue-components.es24.js";
4
4
  import { provideOmegaErrors as C } from "./vue-components.es8.js";
5
5
  import { useOmegaForm as I } from "./vue-components.es9.js";
6
6
  const $ = ["disabled"], N = /* @__PURE__ */ w({
@@ -1,4 +1,4 @@
1
- import { isFunction as c } from "./vue-components.es23.js";
1
+ import { isFunction as c } from "./vue-components.es25.js";
2
2
  const s = c, t = (o) => typeof o == "object" && o !== null, i = (o) => t(o) || s(o);
3
3
  export {
4
4
  s as isFunction,
@@ -1,4 +1,92 @@
1
- const o = (n) => typeof n == "function";
1
+ (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
+ import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
+ import { useStore as z } from "@tanstack/vue-form";
4
+ import { useOmegaErrors as A } from "./vue-components.es8.js";
5
+ import D from "./vue-components.es27.js";
6
+
7
+ const J = /* @__PURE__ */ w({
8
+ inheritAttrs: !1,
9
+ __name: "OmegaInternalInput",
10
+ props: {
11
+ field: {},
12
+ meta: {},
13
+ label: {},
14
+ options: {},
15
+ type: {},
16
+ validators: {}
17
+ },
18
+ setup(c) {
19
+ const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
+ () => (
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
+ )
24
+ ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
+ f(
26
+ () => !!n.value,
27
+ () => {
28
+ y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
+ o.setValue(
30
+ e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
+ );
32
+ });
33
+ }
34
+ ), d(() => {
35
+ !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
+ });
37
+ const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
+ k(() => {
39
+ (E.value || V === "onChange") && (s.value = !0);
40
+ });
41
+ const u = () => {
42
+ s.value = !0;
43
+ };
44
+ d(() => {
45
+ n.value && u();
46
+ });
47
+ const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
+ f(
49
+ () => r.value.meta.errors,
50
+ () => {
51
+ r.value.meta.errors.length ? h({
52
+ inputId: l,
53
+ errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
+ label: e.label
55
+ }) : b(l);
56
+ }
57
+ );
58
+ const i = a(() => ({
59
+ id: l,
60
+ required: e.meta?.required,
61
+ minLength: e.meta?.type === "string" && e.meta?.minLength,
62
+ maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
+ max: e.meta?.type === "number" && e.meta?.maximum,
64
+ min: e.meta?.type === "number" && e.meta?.minimum,
65
+ name: e.field.name,
66
+ modelValue: e.field.state.value,
67
+ errorMessages: p.value,
68
+ error: !!p.value.length,
69
+ field: e.field,
70
+ setRealDirty: u,
71
+ type: m.value,
72
+ label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
+ options: e.options
74
+ }));
75
+ return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
+ _("div", {
77
+ class: q(t.$attrs.class),
78
+ onFocusout: u
79
+ }, [
80
+ F(v) ? (S(), L(D, T({
81
+ key: 0,
82
+ "input-props": i.value
83
+ }, t.$attrs, {
84
+ "vuetify-value": i.value.field.state.value
85
+ }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
+ ], 34)
87
+ ]);
88
+ }
89
+ });
2
90
  export {
3
- o as isFunction
91
+ J as default
4
92
  };
@@ -1,92 +1,13 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var i=document.createElement("style");if(i.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),document.head.appendChild(i),window.customElements){const e=window.customElements.define;window.customElements.define=function(s,t){const n=t.prototype.connectedCallback;return t.prototype.connectedCallback=function(){if(n&&n.call(this),this.shadowRoot){const a=document.createElement("style");a.appendChild(document.createTextNode(".omega-input .v-input__details:has(.v-messages:empty){grid-template-rows:0fr;transition:all .2s}.omega-input .v-messages:empty{min-height:0}.omega-input .v-input__details:has(.v-messages){transition:all .2s;overflow:hidden;min-height:0;display:grid;grid-template-rows:1fr}.omega-input .v-messages{transition:all .2s}.omega-input .v-messages>*{transition-duration:0s!important}.omega-input [role=alert]:has(.v-messages:empty){padding:0}.omega-input .v-btn{cursor:pointer;width:auto;appearance:none;box-shadow:none;display:block;min-width:auto;height:auto;padding:.5em .5em .5em 1em}")),this.shadowRoot.appendChild(a)}},e.call(window.customElements,s,t)}}}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
2
- import { defineComponent as w, getCurrentInstance as x, useId as C, computed as a, watch as f, nextTick as N, onMounted as d, ref as $, watchEffect as k, renderSlot as B, normalizeProps as I, guardReactiveProps as O, createElementVNode as _, normalizeClass as q, createBlock as L, createCommentVNode as P, unref as F, openBlock as S, mergeProps as T } from "vue";
3
- import { useStore as z } from "@tanstack/vue-form";
4
- import { useOmegaErrors as A } from "./vue-components.es8.js";
5
- import D from "./vue-components.es27.js";
6
-
7
- const J = /* @__PURE__ */ w({
8
- inheritAttrs: !1,
9
- __name: "OmegaInternalInput",
10
- props: {
11
- field: {},
12
- meta: {},
13
- label: {},
14
- options: {},
15
- type: {},
16
- validators: {}
17
- },
18
- setup(c) {
19
- const e = c, v = x()?.appContext.components.VTextField, l = C(), o = e.field, r = z(o.store, (t) => t), m = a(() => e.type ? e.type : e.meta?.type === "string" ? e.meta.format === "email" ? "email" : "string" : e.meta?.type || "unknown"), n = a(() => r.value.value), g = a(
20
- () => (
21
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
- r.value.meta.errors.map((t) => t?.message).filter(Boolean)
23
- )
24
- ), y = (t) => t == null || t === !1 || t === "" || Number.isNaN(t);
25
- f(
26
- () => !!n.value,
27
- () => {
28
- y(n.value) && e.meta?.type !== "boolean" && N(() => {
29
- o.setValue(
30
- e.meta?.nullableOrUndefined === "undefined" ? void 0 : null
31
- );
32
- });
33
- }
34
- ), d(() => {
35
- !n.value && !e.meta?.required && e.meta?.nullableOrUndefined === "null" && o.setValue(null);
36
- });
37
- const { addError: h, removeError: b, showErrors: E, showErrorsOn: V } = A(), s = $(!1);
38
- k(() => {
39
- (E.value || V === "onChange") && (s.value = !0);
40
- });
41
- const u = () => {
42
- s.value = !0;
43
- };
44
- d(() => {
45
- n.value && u();
46
- });
47
- const p = a(() => !s.value && m.value !== "select" ? [] : g.value);
48
- f(
49
- () => r.value.meta.errors,
50
- () => {
51
- r.value.meta.errors.length ? h({
52
- inputId: l,
53
- errors: r.value.meta.errors.map((t) => t.message).filter(Boolean),
54
- label: e.label
55
- }) : b(l);
56
- }
57
- );
58
- const i = a(() => ({
59
- id: l,
60
- required: e.meta?.required,
61
- minLength: e.meta?.type === "string" && e.meta?.minLength,
62
- maxLength: e.meta?.type === "string" && e.meta?.maxLength,
63
- max: e.meta?.type === "number" && e.meta?.maximum,
64
- min: e.meta?.type === "number" && e.meta?.minimum,
65
- name: e.field.name,
66
- modelValue: e.field.state.value,
67
- errorMessages: p.value,
68
- error: !!p.value.length,
69
- field: e.field,
70
- setRealDirty: u,
71
- type: m.value,
72
- label: `${e.label}${e.meta?.required ? " *" : ""}`,
73
- options: e.options
74
- }));
75
- return (t, R) => B(t.$slots, "default", I(O(i.value)), () => [
76
- _("div", {
77
- class: q(t.$attrs.class),
78
- onFocusout: u
79
- }, [
80
- F(v) ? (S(), L(D, T({
81
- key: 0,
82
- "input-props": i.value
83
- }, t.$attrs, {
84
- "vuetify-value": i.value.field.state.value
85
- }), null, 16, ["input-props", "vuetify-value"])) : P("", !0)
86
- ], 34)
87
- ]);
88
- }
89
- });
1
+ import { useStore as u } from "@tanstack/vue-form";
2
+ import { computed as f } from "vue";
3
+ function c(o, t) {
4
+ return f(() => t ? u(o.store, (n) => {
5
+ const r = {};
6
+ for (const e of t)
7
+ r[e] = n[e];
8
+ return r;
9
+ }).value : {});
10
+ }
90
11
  export {
91
- J as default
12
+ c as getOmegaStore
92
13
  };
@@ -1,13 +1,4 @@
1
- import { useStore as u } from "@tanstack/vue-form";
2
- import { computed as f } from "vue";
3
- function c(o, t) {
4
- return f(() => t ? u(o.store, (n) => {
5
- const r = {};
6
- for (const e of t)
7
- r[e] = n[e];
8
- return r;
9
- }).value : {});
10
- }
1
+ const o = (n) => typeof n == "function";
11
2
  export {
12
- c as getOmegaStore
3
+ o as isFunction
13
4
  };
@@ -1,4 +1,4 @@
1
- import f from "./vue-components.es24.js";
1
+ import f from "./vue-components.es23.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as d, inject as f, computed as o, createBlock as n, openBlock as m, resolveDynamicComponent as v, withCtx as l, createCommentVNode as c, mergeProps as y, renderSlot as g, normalizeProps as h, guardReactiveProps as C } from "vue";
2
2
  import { generateInputStandardSchemaFromFieldMeta as F } from "./vue-components.es10.js";
3
- import b from "./vue-components.es24.js";
3
+ import b from "./vue-components.es23.js";
4
4
  const P = /* @__PURE__ */ d({
5
5
  inheritAttrs: !1,
6
6
  __name: "OmegaInput",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/vue-components",
3
- "version": "0.12.21",
3
+ "version": "0.13.0",
4
4
  "peerDependencies": {
5
5
  "@mdi/js": "^7.4.47",
6
6
  "@tanstack/vue-form": "^1.2.4",
@@ -13,29 +13,40 @@ import type {
13
13
  FieldAsyncValidateOrFn,
14
14
  } from "@tanstack/vue-form"
15
15
 
16
- export type OmegaFieldInternalApi<From, To> = FieldApi<
17
- From,
18
- DeepKeys<From>,
19
- DeepValue<From, any>,
20
- FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined,
21
- StandardSchemaV1<unknown, To> | FieldValidateFn<From, any, To>,
22
- StandardSchemaV1<unknown, To> | FieldValidateAsyncFn<From, any, To>,
23
- FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>>,
24
- FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>>,
25
- FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined,
26
- FieldAsyncValidateOrFn<From, DeepKeys<From>, DeepValue<From, any>> | undefined,
27
- FormValidateOrFn<From> | undefined,
28
- FormValidateOrFn<From> | undefined,
29
- any,
30
- FormValidateOrFn<From> | undefined,
31
- FormAsyncValidateOrFn<From> | undefined,
32
- FormValidateOrFn<From> | undefined,
33
- FormAsyncValidateOrFn<From> | undefined,
34
- FormAsyncValidateOrFn<From> | undefined,
35
- FormAsyncValidateOrFn<From> | undefined
16
+ export type OmegaFieldInternalApi<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = FieldApi<
17
+ /* in out TParentData*/ From,
18
+ /* in out TName*/ TName,
19
+ /* in out TData*/ DeepValue<From, TName>,
20
+ /* in out TOnMount*/ FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined,
21
+ /* in out TOnChange*/ StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateFn<From, TName>,
22
+ /* in out TOnChangeAsync*/ StandardSchemaV1<DeepValue<From, TName>, unknown> | FieldValidateAsyncFn<From, TName>,
23
+ /* in out TOnBlur*/ FieldValidateOrFn<From, TName, DeepValue<From, TName>>,
24
+ /* in out TOnBlurAsync*/ FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>>,
25
+ /* in out TOnSubmit*/ FieldValidateOrFn<From, TName, DeepValue<From, TName>> | undefined,
26
+ /* in out TOnSubmitAsync*/ FieldAsyncValidateOrFn<From, TName, DeepValue<From, TName>> | undefined,
27
+ /* in out TFormOnMount*/ FormValidateOrFn<From> | undefined,
28
+ /* in out TFormOnChange*/ FormValidateOrFn<From> | undefined,
29
+ // using `any` for now to silence:
30
+ /*
31
+ Type 'FieldApi<From, DeepKeys<From>, DeepValue<From, DeepKeys<From>>, FieldValidateOrFn<From, DeepKeys<From>, DeepValue<From, DeepKeys<...>>> | undefined, ... 14 more ..., FormAsyncValidateOrFn<...> | undefined>' is not assignable to type 'OmegaFieldInternalApi<From, any>'.
32
+ The types of 'form.options.defaultState' are incompatible between these types.
33
+ Type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>> | undefined' is not assignable to type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>> | undefined'.
34
+ Type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, StandardSchemaV1<From, To>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>>' is not assignable to type 'Partial<FormState<From, FormValidateOrFn<From> | undefined, FormValidateOrFn<From> | undefined, FormAsyncValidateOrFn<From>, ... 4 more ..., FormAsyncValidateOrFn<...> | undefined>>'.
35
+ Types of property 'errorMap' are incompatible.
36
+ Type 'FormValidationErrorMap<undefined, undefined, Record<string, StandardSchemaV1Issue[]>, undefined, undefined, undefined, undefined, undefined> | undefined' is not assignable to type 'FormValidationErrorMap<undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined> | undefined'.
37
+ Type 'FormValidationErrorMap<undefined, undefined, Record<string, StandardSchemaV1Issue[]>, undefined, undefined, undefined, undefined, undefined>' is not assignable to type 'FormValidationErrorMap<undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined>'.
38
+ Type 'Record<string, StandardSchemaV1Issue[]>' is not assignable to type 'undefined'.
39
+ */
40
+ /* in out TFormOnChangeAsync*/ any, // FormAsyncValidateOrFn<From>,
41
+ /* in out TFormOnBlur*/ FormValidateOrFn<From> | undefined,
42
+ /* in out TFormOnBlurAsync*/ FormAsyncValidateOrFn<From> | undefined,
43
+ /* in out TFormOnSubmit*/ FormValidateOrFn<From> | undefined,
44
+ /* in out TFormOnSubmitAsync*/ FormAsyncValidateOrFn<From> | undefined,
45
+ /* in out TFormOnServer*/ FormAsyncValidateOrFn<From> | undefined,
46
+ /* in out TParentSubmitMeta*/ FormAsyncValidateOrFn<From> | undefined
36
47
  >
37
48
 
38
- export type InputProps<T, S = unknown> = {
49
+ export type InputProps<From extends Record<PropertyKey, any>, TName extends DeepKeys<From>> = {
39
50
  id: string
40
51
  required?: boolean
41
52
  minLength?: number | false
@@ -43,10 +54,10 @@ export type InputProps<T, S = unknown> = {
43
54
  max?: number | false
44
55
  min?: number | false
45
56
  name: string
46
- modelValue: S
57
+ modelValue: DeepValue<From, TName>
47
58
  errorMessages: string[]
48
59
  error: boolean
49
- field: OmegaFieldInternalApi<T, S>
60
+ field: OmegaFieldInternalApi<From, TName>
50
61
  setRealDirty: () => void
51
62
  type: string
52
63
  label: string
@@ -25,7 +25,7 @@
25
25
  </component>
26
26
  </template>
27
27
 
28
- <script setup lang="ts" generic="From, To">
28
+ <script setup lang="ts" generic="From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>">
29
29
  import { computed, onMounted, provide } from "vue"
30
30
  import {
31
31
  type CreateMeta,
@@ -7,7 +7,7 @@
7
7
  </slot>
8
8
  </template>
9
9
 
10
- <script setup lang="ts" generic="From, To">
10
+ <script setup lang="ts" generic="From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>">
11
11
  import { computed } from "vue"
12
12
  import {
13
13
  type NestedKeyOf,
@@ -21,7 +21,7 @@ import OmegaInput from "./OmegaInput.vue"
21
21
  import { DeepKeys } from "@tanstack/vue-form"
22
22
  import { OmegaFormReturn } from "./useOmegaForm"
23
23
 
24
- export type OmegaAutoGenMeta<From, To> = Omit<OmegaInputProps<From, To>, "form">
24
+ export type OmegaAutoGenMeta<From extends Record<PropertyKey, string>, To extends Record<PropertyKey, string>> = Omit<OmegaInputProps<From, To>, "form">
25
25
  type NewMeta = OmegaAutoGenMeta<From, To>
26
26
 
27
27
  const mapObject =
@@ -14,7 +14,7 @@
14
14
  </OmegaInput>
15
15
  </template>
16
16
 
17
- <script setup lang="ts" generic="From, To extends Record<PropertyKey, any>">
17
+ <script setup lang="ts" generic="From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>">
18
18
  import { inject } from "vue"
19
19
  import type {
20
20
  FieldValidators,
@@ -33,7 +33,7 @@ if (!form) {
33
33
  }
34
34
 
35
35
  defineProps<{
36
- name: DeepKeys<From>
36
+ name: Name
37
37
  label: string
38
38
  validators?: FieldValidators<From>
39
39
  options?: { title: string; value: string }[]
@@ -41,7 +41,6 @@ defineProps<{
41
41
  }>()
42
42
 
43
43
  defineSlots<{
44
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
- default: InputProps<From, To>
44
+ default(props: InputProps<From, Name>): void
46
45
  }>()
47
46
  </script>
@@ -18,7 +18,7 @@ import { OmegaFieldInternalApi } from "./InputProps"
18
18
 
19
19
  export type ShowErrorsOn = "onChange" | "onBlur" | "onSubmit"
20
20
 
21
- export type OmegaInputProps<From, To> = {
21
+ export type OmegaInputProps<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> = {
22
22
  form: OmegaFormReturn<From, To> & {
23
23
  meta: MetaRecord<From>
24
24
  }
@@ -123,8 +123,8 @@ export type FormComponent<T, S> = VueFormApi<
123
123
  FormAsyncValidateOrFn<T> | undefined
124
124
  >
125
125
 
126
- export type FormType<T, S = unknown> = OmegaFormApi<T, S> & {
127
- Field: OmegaFieldInternalApi<T, S>
126
+ export type FormType<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>, Name extends DeepKeys<From>> = OmegaFormApi<From, To> & {
127
+ Field: OmegaFieldInternalApi<From, Name>
128
128
  }
129
129
 
130
130
  export type PrefixFromDepth<
@@ -25,7 +25,7 @@
25
25
  </component>
26
26
  </template>
27
27
 
28
- <script setup lang="ts" generic="From, To">
28
+ <script setup lang="ts" generic="From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>">
29
29
  import { computed, inject, type Ref } from "vue"
30
30
  import {
31
31
  type FieldMeta,
@@ -64,9 +64,9 @@
64
64
  @update:model-value="
65
65
  (e: any) => {
66
66
  if (e || e === 0) {
67
- inputProps.field.handleChange(Number(e))
67
+ inputProps.field.handleChange(Number(e) as any)
68
68
  } else {
69
- inputProps.field.handleChange(undefined)
69
+ inputProps.field.handleChange(undefined as any)
70
70
  }
71
71
  }
72
72
  "
@@ -85,7 +85,7 @@
85
85
  :error="inputProps.error"
86
86
  v-bind="$attrs"
87
87
  :model-value="vuetifyValue"
88
- @clear="inputProps.field.handleChange(undefined)"
88
+ @clear="inputProps.field.handleChange(undefined as any)"
89
89
  @update:model-value="inputProps.field.handleChange"
90
90
  />
91
91
 
@@ -106,17 +106,18 @@
106
106
  :chips="inputProps.type === 'autocompletemultiple'"
107
107
  v-bind="$attrs"
108
108
  :model-value="vuetifyValue"
109
- @clear="inputProps.field.handleChange(undefined)"
109
+ @clear="inputProps.field.handleChange(undefined as any)"
110
110
  @update:model-value="inputProps.field.handleChange"
111
111
  />
112
112
  </div>
113
113
  </template>
114
114
 
115
- <script setup lang="ts" generic="T, S">
115
+ <script setup lang="ts" generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>">
116
+ import { DeepKeys } from "@tanstack/vue-form";
116
117
  import type { InputProps } from "./InputProps"
117
118
 
118
119
  defineProps<{
119
- inputProps: InputProps<T, S>
120
+ inputProps: InputProps<From, Name>
120
121
  vuetifyValue: unknown
121
122
  }>()
122
123
 
@@ -11,8 +11,8 @@
11
11
  </slot>
12
12
  </template>
13
13
 
14
- <script setup lang="ts" generic="From, To">
15
- import { useStore } from "@tanstack/vue-form"
14
+ <script setup lang="ts" generic="From extends Record<PropertyKey, any>, Name extends DeepKeys<From>">
15
+ import { DeepKeys, useStore } from "@tanstack/vue-form"
16
16
  import {
17
17
  useId,
18
18
  computed,
@@ -39,7 +39,7 @@ defineOptions({
39
39
  })
40
40
 
41
41
  const props = defineProps<{
42
- field: OmegaFieldInternalApi<From, To>
42
+ field: OmegaFieldInternalApi<From, Name>
43
43
  meta: MetaRecord<From>[NestedKeyOf<From>]
44
44
  label: string
45
45
  options?: { title: string; value: string }[]
@@ -83,7 +83,7 @@ watch(
83
83
  if (isFalsyButNotZero(fieldValue.value) && props.meta?.type !== "boolean") {
84
84
  nextTick(() => {
85
85
  fieldApi.setValue(
86
- props.meta?.nullableOrUndefined === "undefined" ? undefined : null,
86
+ props.meta?.nullableOrUndefined === "undefined" ? undefined : null as any,
87
87
  )
88
88
  })
89
89
  }
@@ -96,7 +96,7 @@ onMounted(() => {
96
96
  !props.meta?.required &&
97
97
  props.meta?.nullableOrUndefined === "null"
98
98
  ) {
99
- fieldApi.setValue(null)
99
+ fieldApi.setValue(null as any)
100
100
  }
101
101
  })
102
102
  const { addError, removeError, showErrors, showErrorsOn } = useOmegaErrors()
@@ -143,7 +143,7 @@ watch(
143
143
  },
144
144
  )
145
145
 
146
- const inputProps: ComputedRef<InputProps<From, To>> = computed(() => ({
146
+ const inputProps: ComputedRef<InputProps<From, Name>> = computed(() => ({
147
147
  id,
148
148
  required: props.meta?.required,
149
149
  minLength: props.meta?.type === "string" && props.meta?.minLength,
@@ -24,7 +24,7 @@
24
24
  generic="
25
25
  From extends Record<PropertyKey, any>,
26
26
  To extends Record<PropertyKey, any>,
27
- K extends keyof OmegaFormState<To, From> = keyof OmegaFormState<To, From>
27
+ K extends keyof OmegaFormState<From, To> = keyof OmegaFormState<From, To>
28
28
  "
29
29
  >
30
30
  /**
@@ -81,7 +81,7 @@ const props = defineProps<
81
81
  omegaConfig?: OmegaConfig<From>
82
82
  subscribe?: K[]
83
83
  showErrorsOn?: ShowErrorsOn
84
- } & FormProps<To, From> &
84
+ } & FormProps<From, To> &
85
85
  (
86
86
  | {
87
87
  form: OmegaFormReturn<From, To>
@@ -214,7 +214,7 @@ defineSlots<{
214
214
  default(): void
215
215
  // Named slot when form is created internally via schema
216
216
  internalForm(props: {
217
- form: OmegaFormReturn<To, From>
217
+ form: OmegaFormReturn<From, To>
218
218
  subscribedValues: typeof subscribedValues.value
219
219
  }): void
220
220
  // Named slot when form is passed via props (provides subscribedValues)
@@ -4,6 +4,7 @@ import {
4
4
  type FormValidateOrFn,
5
5
  type FormAsyncValidateOrFn,
6
6
  type StandardSchemaV1,
7
+ DeepKeys,
7
8
  } from "@tanstack/vue-form"
8
9
  import { type Record, S } from "effect-app"
9
10
  import {
@@ -48,27 +49,27 @@ export type OmegaConfig<T> = {
48
49
  } & keysRule<T>
49
50
  }
50
51
 
51
- interface OF<To, From> extends OmegaFormApi<To, From> {
52
- meta: MetaRecord<To>
52
+ interface OF<From, To> extends OmegaFormApi<From, To> {
53
+ meta: MetaRecord<From>
53
54
  filterItems?: FilterItems
54
55
  clear: () => void
55
56
  }
56
57
 
57
58
  export const OmegaFormKey = Symbol("OmegaForm") as InjectionKey<OF<any, any>>
58
59
 
59
- export interface OmegaFormReturn<From, To> extends OF<From, To> {
60
- Input: typeof OmegaFormInput
60
+ export interface OmegaFormReturn<From extends Record<PropertyKey, any>, To extends Record<PropertyKey, any>> extends OF<From, To> {
61
+ Input: typeof OmegaFormInput<From, To, DeepKeys<From>>
61
62
  }
62
63
 
63
64
  export const useOmegaForm = <
64
65
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
65
66
  From extends Record<PropertyKey, any>,
66
67
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
- To extends Record<PropertyKey, any>
68
+ To extends Record<PropertyKey, any>,
68
69
  >(
69
- schema: S.Schema<From, To, never>,
70
- tanstackFormOptions?: NoInfer<FormProps<To, From>>,
71
- omegaConfig?: OmegaConfig<From>
70
+ schema: S.Schema<To, From, never>,
71
+ tanstackFormOptions?: NoInfer<FormProps<From, To>>,
72
+ omegaConfig?: OmegaConfig<To>
72
73
  ): OmegaFormReturn<From, To> => {
73
74
  if (!schema) throw new Error("Schema is required")
74
75
  const standardSchema = S.standardSchemaV1(schema)
@@ -172,16 +173,16 @@ export const useOmegaForm = <
172
173
  })
173
174
 
174
175
  const form = useForm<
175
- To,
176
- FormValidateOrFn<To> | undefined,
177
- FormValidateOrFn<To> | undefined,
178
- StandardSchemaV1<To, From>,
179
- FormValidateOrFn<To> | undefined,
180
- FormAsyncValidateOrFn<To> | undefined,
181
- FormValidateOrFn<To> | undefined,
182
- FormAsyncValidateOrFn<To> | undefined,
183
- FormAsyncValidateOrFn<To> | undefined,
184
- FormAsyncValidateOrFn<To> | undefined
176
+ From,
177
+ FormValidateOrFn<From> | undefined,
178
+ FormValidateOrFn<From> | undefined,
179
+ StandardSchemaV1<From, To>,
180
+ FormValidateOrFn<From> | undefined,
181
+ FormAsyncValidateOrFn<From> | undefined,
182
+ FormValidateOrFn<From> | undefined,
183
+ FormAsyncValidateOrFn<From> | undefined,
184
+ FormAsyncValidateOrFn<From> | undefined,
185
+ FormAsyncValidateOrFn<From> | undefined
185
186
  >({
186
187
  ...tanstackFormOptions,
187
188
  validators: {
@@ -191,9 +192,9 @@ export const useOmegaForm = <
191
192
  onSubmit: tanstackFormOptions?.onSubmit
192
193
  ? ({ formApi, meta, value }) =>
193
194
  tanstackFormOptions.onSubmit?.({
194
- formApi: formApi as OmegaFormApi<To, From>,
195
+ formApi: formApi as OmegaFormApi<From, To>,
195
196
  meta,
196
- value: value as unknown as From,
197
+ value: value as unknown as To,
197
198
  })
198
199
  : undefined,
199
200
  defaultValues: defaultValues.value as any,
@@ -277,7 +278,7 @@ export const useOmegaForm = <
277
278
  window.removeEventListener("blur", saveDataInUrl)
278
279
  })
279
280
 
280
- const formWithExtras: OF<To, From> = Object.assign(form, {
281
+ const formWithExtras: OF<From, To> = Object.assign(form, {
281
282
  meta,
282
283
  filterItems,
283
284
  clear,
@@ -287,6 +288,6 @@ export const useOmegaForm = <
287
288
 
288
289
  return Object.assign(formWithExtras, {
289
290
  Input: OmegaFormInput,
290
- Field: form.Field as unknown as OmegaFieldInternalApi<From, To>,
291
+ Field: form.Field
291
292
  })
292
293
  }