From 6a111f3c47a33058834623af6f6b648c049f0941 Mon Sep 17 00:00:00 2001 From: Davide Di Pumpo Date: Fri, 31 Oct 2025 13:31:54 +0100 Subject: [PATCH] revert to cleaner solution --- .changeset/legal-lions-greet.md | 5 + .../src/components/OmegaForm/OmegaArray.vue | 5 +- .../src/components/OmegaForm/OmegaAutoGen.vue | 11 +- .../components/OmegaForm/OmegaFormInput.vue | 5 +- .../components/OmegaForm/OmegaFormStuff.ts | 28 +- .../src/components/OmegaForm/OmegaInput.vue | 5 +- .../src/components/OmegaForm/useOmegaForm.ts | 587 +++++++++++------- .../stories/OmegaForm/SimpleForm.vue | 3 +- 8 files changed, 399 insertions(+), 250 deletions(-) create mode 100644 .changeset/legal-lions-greet.md diff --git a/.changeset/legal-lions-greet.md b/.changeset/legal-lions-greet.md new file mode 100644 index 0000000000..b21afea3e9 --- /dev/null +++ b/.changeset/legal-lions-greet.md @@ -0,0 +1,5 @@ +--- +"@effect-app/vue-components": patch +--- + +revert to cleaner solution diff --git a/packages/vue-components/src/components/OmegaForm/OmegaArray.vue b/packages/vue-components/src/components/OmegaForm/OmegaArray.vue index 7aeede001d..3f62a9810a 100644 --- a/packages/vue-components/src/components/OmegaForm/OmegaArray.vue +++ b/packages/vue-components/src/components/OmegaForm/OmegaArray.vue @@ -45,14 +45,15 @@ generic=" // dprint ignore - somehow with 120 chars, this becomes a mess. should report it. From extends Record, - To extends Record + To extends Record, + Name extends DeepKeys " > import { type DeepKeys } from "@tanstack/vue-form" import { computed, onMounted, provide } from "vue" import { type OmegaArrayProps } from "./OmegaFormStuff" -const props = defineProps>() +const props = defineProps>() defineOptions({ inheritAttrs: false diff --git a/packages/vue-components/src/components/OmegaForm/OmegaAutoGen.vue b/packages/vue-components/src/components/OmegaForm/OmegaAutoGen.vue index 7021347e93..cb36af8dae 100644 --- a/packages/vue-components/src/components/OmegaForm/OmegaAutoGen.vue +++ b/packages/vue-components/src/components/OmegaForm/OmegaAutoGen.vue @@ -4,7 +4,7 @@ :child="{ name, label, ...attrs }" > @@ -16,15 +16,16 @@ lang="ts" generic=" From extends Record, - To extends Record + To extends Record, + Name extends DeepKeys " > import { type DeepKeys } from "@tanstack/vue-form" import { Array as A, Order, pipe } from "effect-app" import { computed } from "vue" -import { type FieldMeta, type OmegaAutoGenMeta, type OmegaInputProps } from "./OmegaFormStuff" +import { type FieldMeta, type FieldPath, type OmegaAutoGenMeta, type OmegaInputProps } from "./OmegaFormStuff" -type NewMeta = OmegaAutoGenMeta +type NewMeta = OmegaAutoGenMeta const mapObject = (fn: (value: A, key: K) => B) => (obj: Record): Record => Object.fromEntries( @@ -51,7 +52,7 @@ const filterMapRecord = ) const props = defineProps<{ - form: OmegaInputProps["form"] + form: OmegaInputProps["form"] pick?: DeepKeys[] omit?: DeepKeys[] labelMap?: (key: DeepKeys) => string | undefined diff --git a/packages/vue-components/src/components/OmegaForm/OmegaFormInput.vue b/packages/vue-components/src/components/OmegaForm/OmegaFormInput.vue index 4e8b9d2472..e598b0c2bc 100644 --- a/packages/vue-components/src/components/OmegaForm/OmegaFormInput.vue +++ b/packages/vue-components/src/components/OmegaForm/OmegaFormInput.vue @@ -27,7 +27,8 @@ import { OmegaFormKey } from "./useOmegaForm" const form = inject(OmegaFormKey) as unknown as OmegaInputProps< From, - To + To, + Name >["form"] if (!form) { @@ -35,7 +36,7 @@ if (!form) { } defineProps< - BaseProps & DefaultTypeProps + BaseProps & DefaultTypeProps >() defineSlots<{ diff --git a/packages/vue-components/src/components/OmegaForm/OmegaFormStuff.ts b/packages/vue-components/src/components/OmegaForm/OmegaFormStuff.ts index 8682e4558e..855c480c7f 100644 --- a/packages/vue-components/src/components/OmegaForm/OmegaFormStuff.ts +++ b/packages/vue-components/src/components/OmegaForm/OmegaFormStuff.ts @@ -17,19 +17,19 @@ export type FieldPath = unknown extends T ? string // technically we cannot have primitive at the root : T extends string | boolean | number | null | undefined | symbol | bigint ? "" // technically we cannot have array at the root - : T extends ReadonlyArray ? Compute> + : T extends ReadonlyArray ? FieldPath_ : { - [K in keyof T]: Compute> + [K in keyof T]: FieldPath_ }[keyof T] export type FieldPath_ = unknown extends T ? string : T extends string | boolean | number | null | undefined | symbol | bigint ? Path - : T extends ReadonlyArray ? Compute> | Path + : T extends ReadonlyArray ? FieldPath_ | Path : { - [K in keyof T]: Compute> + [K in keyof T]: FieldPath_ }[keyof T] -export type BaseProps = FieldPath> = { +export type BaseProps> = { /** * Will fallback to i18n when not specified. * Can also be provided via #label slot for custom HTML labels. @@ -64,31 +64,34 @@ export type DefaultTypeProps = { export type OmegaInputPropsBase< From extends Record, - To extends Record + To extends Record, + Name extends DeepKeys > = { form: OF & { meta: MetaRecord i18nNamespace?: string } -} & BaseProps +} & BaseProps export type OmegaInputProps< From extends Record, To extends Record, + Name extends DeepKeys, TypeProps = DefaultTypeProps > = { form: OmegaFormReturn & { meta: MetaRecord i18nNamespace?: string } -} & BaseProps +} & BaseProps export type OmegaArrayProps< From extends Record, - To extends Record + To extends Record, + Name extends DeepKeys > = & Omit< - OmegaInputProps, + OmegaInputProps, "validators" | "options" | "label" | "type" | "items" | "name" > & { @@ -886,8 +889,9 @@ export const nullableInput = ( export type OmegaAutoGenMeta< From extends Record, - To extends Record -> = Omit, "form"> + To extends Record, + Name extends DeepKeys +> = Omit, "form"> const supportedInputs = [ "button", diff --git a/packages/vue-components/src/components/OmegaForm/OmegaInput.vue b/packages/vue-components/src/components/OmegaForm/OmegaInput.vue index 9da3d19995..de2e80f90a 100644 --- a/packages/vue-components/src/components/OmegaForm/OmegaInput.vue +++ b/packages/vue-components/src/components/OmegaForm/OmegaInput.vue @@ -40,7 +40,8 @@ generic=" // dprint ignore - somehow with 120 chars, this becomes a mess. should report it. From extends Record, - To extends Record + To extends Record, + Name extends DeepKeys " > import { type DeepKeys } from "@tanstack/vue-form" @@ -49,7 +50,7 @@ import { useIntl } from "../../utils" import { type FieldMeta, generateInputStandardSchemaFromFieldMeta, type OmegaInputPropsBase } from "./OmegaFormStuff" import OmegaInternalInput from "./OmegaInternalInput.vue" -const props = defineProps>() +const props = defineProps>() // downgrade to *as* DeepKeys to avoid useless and possible infinite recursion in TS const propsName = computed(() => props.name as DeepKeys) diff --git a/packages/vue-components/src/components/OmegaForm/useOmegaForm.ts b/packages/vue-components/src/components/OmegaForm/useOmegaForm.ts index ad1b343ace..19b787ee16 100644 --- a/packages/vue-components/src/components/OmegaForm/useOmegaForm.ts +++ b/packages/vue-components/src/components/OmegaForm/useOmegaForm.ts @@ -11,7 +11,7 @@ import { MergedInputProps } from "./InputProps" import OmegaArray from "./OmegaArray.vue" import OmegaAutoGen from "./OmegaAutoGen.vue" import OmegaErrorsInternal from "./OmegaErrorsInternal.vue" -import { BaseProps, DefaultTypeProps, FieldPath, type FormProps, generateMetaFromSchema, type MetaRecord, type NestedKeyOf, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff" +import { BaseProps, DefaultTypeProps, FieldPath, type FormProps, generateMetaFromSchema, type MetaRecord, type NestedKeyOf, OmegaArrayProps, OmegaAutoGenMeta, OmegaError, type OmegaFormApi, OmegaFormState } from "./OmegaFormStuff" import OmegaInput from "./OmegaInput.vue" import OmegaTaggedUnion from "./OmegaTaggedUnion.vue" import OmegaForm from "./OmegaWrapper.vue" @@ -207,48 +207,243 @@ type __VLS_PrettifyLocal = } & {} +// Type aliases for Array component slots - using cached types for performance +type CachedFieldApi = import("@tanstack/vue-form").FieldApi< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]>, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").StandardSchemaV1, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormAsyncValidateOrFn | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormAsyncValidateOrFn | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormAsyncValidateOrFn | undefined, + import("@tanstack/vue-form").FormAsyncValidateOrFn | undefined, + Record | undefined +> + +type CachedFieldState = import("@tanstack/vue-form").FieldState< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]>, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + | import("@tanstack/vue-form").FieldAsyncValidateOrFn< + From, + OmegaFormReturn["_keys"], + DeepValue["_keys"]> + > + | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").StandardSchemaV1, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormAsyncValidateOrFn | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormAsyncValidateOrFn | undefined, + import("@tanstack/vue-form").FormValidateOrFn | undefined, + import("@tanstack/vue-form").FormAsyncValidateOrFn | undefined +> + export interface OmegaFormReturn< From extends Record, To extends Record, TypeProps = DefaultTypeProps > extends OF { - // Pre-bound Input component with type-checked Name parameter - Input: >( - props: BaseProps & TypeProps & { - key?: string | number - ref?: any - }, - context?: { - slots?: { - default?(props: MergedInputProps): any - label?: (props: { required: boolean; id: string; label: string }) => any + // Pre-computed type aliases - computed ONCE for performance + _paths: FieldPath + _keys: DeepKeys + + // this crazy thing here is copied from the OmegaFormInput.vue.d.ts, with `From` removed as Generic, instead closed over from the From generic above.. + Input: ["_paths"]>( + __VLS_props: NonNullable>["props"], + __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, + __VLS_expose?: NonNullable>["expose"], + __VLS_setup?: Promise<{ + props: + & __VLS_PrettifyLocal< + & Pick< + & Partial<{}> + & Omit< + {} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, + never + >, + never + > + & TypeProps + & Partial<{}> + > + & BaseProps + & import("vue").PublicProps + expose(exposed: import("vue").ShallowUnwrapRef<{}>): void + attrs: any + slots: { + default?(props: MergedInputProps): void + label?: (props: { required: boolean; id: string; label: string }) => void } - attrs?: Record - } - ) => import("vue").VNode + emit: {} + }> + ) => import("vue").VNode & { + __ctx?: Awaited + } Errors: ( - props?: { - key?: string | number - ref?: any - }, - context?: { - slots?: { - default: (props: { errors: readonly OmegaError[]; showedGeneralErrors: string[] }) => any + __VLS_props: NonNullable>["props"], + __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, + __VLS_expose?: NonNullable>["expose"], + __VLS_setup?: Promise<{ + props: + & __VLS_PrettifyLocal< + & Pick< + & Partial<{}> + & Omit< + {} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, + never + >, + never + > + & Partial<{}> + > + & import("vue").PublicProps + expose(exposed: import("vue").ShallowUnwrapRef<{}>): void + attrs: any + slots: { + default: (props: { errors: readonly OmegaError[]; showedGeneralErrors: string[] }) => void } - attrs?: Record - } - ) => import("vue").VNode - TaggedUnion: >( - props: { - name: Name - type?: "select" | "radio" - options: import("./InputProps").TaggedUnionOptionsArray - label?: string - key?: string | number - ref?: any - }, - context?: { - slots?: Record< + emit: {} + }> + ) => import("vue").VNode & { + __ctx?: Awaited + } + TaggedUnion: ["_keys"]>( + __VLS_props: NonNullable>["props"], + __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, + __VLS_expose?: NonNullable>["expose"], + __VLS_setup?: Promise<{ + props: + & __VLS_PrettifyLocal< + & Pick< + & Partial<{}> + & Omit< + {} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, + never + >, + never + > + & { + name: Name + type?: "select" | "radio" + options: import("./InputProps").TaggedUnionOptionsArray + label?: string + } + & {} + > + & import("vue").PublicProps + expose(exposed: import("vue").ShallowUnwrapRef<{}>): void + attrs: any + slots: Record< string, (props: { field: import("@tanstack/vue-form").FieldApi< @@ -301,62 +496,134 @@ export interface OmegaFormReturn< > }) => any > - attrs?: Record - } - ) => import("vue").VNode - Array: >( - props: { - name: Name - defaultItems?: DeepValue - key?: string | number - ref?: any - }, - context?: { - slots?: { - "pre-array"?: (props: { field: any; state: any }) => any - default?: (props: { subField: any; subState: any; index: number; field: any }) => any - "post-array"?: (props: { field: any; state: any }) => any - field?: (props: { field: any }) => any + emit: {} + }> + ) => import("vue").VNode & { + __ctx?: Awaited + } + Array: ["_keys"]>( + __VLS_props: NonNullable>["props"], + __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, + __VLS_expose?: NonNullable>["expose"], + __VLS_setup?: Promise<{ + props: + & __VLS_PrettifyLocal< + & Pick< + & Partial<{}> + & Omit< + {} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, + never + >, + never + > + & (Omit, "form">) + & {} + > + & import("vue").PublicProps + expose(exposed: import("vue").ShallowUnwrapRef<{}>): void + attrs: any + slots: { + "pre-array"?: (props: { + field: CachedFieldApi + state: CachedFieldState + }) => any + } & { + default?: (props: { + subField: CachedFieldApi + subState: CachedFieldState + index: number + field: CachedFieldApi + }) => any + } & { + "post-array"?: (props: { + field: CachedFieldApi + state: CachedFieldState + }) => any + } & { + field?: (props: { + field: CachedFieldApi + }) => any } - attrs?: Record - } - ) => import("vue").VNode - - AutoGen: ( - props: { - pick?: DeepKeys[] - omit?: DeepKeys[] - labelMap?: (key: DeepKeys) => string | undefined - filterMap?: >(key: DeepKeys, meta: M) => boolean | M - order?: DeepKeys[] - sort?: Order.Order> - key?: string | number - ref?: any - }, - context?: { - slots?: { - default(props: { child: OmegaAutoGenMeta }): any + emit: {} + }> + ) => import("vue").VNode & { + __ctx?: Awaited + } + + AutoGen: ["_keys"]>( + __VLS_props: NonNullable>["props"], + __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, + __VLS_expose?: NonNullable>["expose"], + __VLS_setup?: Promise<{ + props: + & __VLS_PrettifyLocal< + Pick< + & Partial<{}> + & Omit< + {} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, + never + >, + never + > & { + // form: OmegaInputProps["form"] + pick?: OmegaFormReturn["_keys"][] + omit?: OmegaFormReturn["_keys"][] + labelMap?: (key: OmegaFormReturn["_keys"]) => string | undefined + filterMap?: >( + key: OmegaFormReturn["_keys"], + meta: M + ) => boolean | M + order?: OmegaFormReturn["_keys"][] + sort?: Order.Order> + } & {} + > + & import("vue").PublicProps + expose(exposed: import("vue").ShallowUnwrapRef<{}>): void + attrs: any + slots: { + default(props: { + child: OmegaAutoGenMeta + }): void } - attrs?: Record - } - ) => import("vue").VNode - - Form: >( - props: { - disabled?: boolean - subscribe?: K[] - key?: string | number - ref?: any - }, - context?: { - slots?: { + emit: {} + }> + ) => import("vue").VNode & { + __ctx?: Awaited + } + + Form: >( + __VLS_props: NonNullable>["props"], + __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, + __VLS_expose?: NonNullable>["expose"], + __VLS_setup?: Promise<{ + props: + & __VLS_PrettifyLocal< + Pick< + & Partial<{}> + & Omit< + {} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, + never + >, + never + > & { + // form: OmegaFormReturn + disabled?: boolean + subscribe?: K[] + } & {} + > + & import("vue").PublicProps + expose(exposed: import("vue").ShallowUnwrapRef<{}>): void + attrs: any + slots: { default(props: { subscribedValues: K[] extends undefined[] ? Record : Pick, K> - }): any + }): void } - attrs?: Record - } - ) => import("vue").VNode + emit: {} + }> + ) => import("vue").VNode & { + __ctx?: Awaited + } } export const useOmegaForm = < @@ -712,147 +979,17 @@ export const useOmegaForm = < const errorContext = { form: formWithExtras, fieldMap } - // Pre-bound component functions with From and To already bound - const Input = >( - props: BaseProps & DefaultTypeProps & { - key?: string | number - ref?: any - }, - context?: { - slots?: { - default?(props: MergedInputProps): any - label?: (props: { required: boolean; id: string; label: string }) => any - } - attrs?: Record - } - ) => { - const InputComponent = omegaConfig?.input ?? OmegaInput - return h(InputComponent, { - ...props, - form: formWithExtras, - ...context?.attrs - }, context?.slots) - } - - const Errors = ( - props?: { - key?: string | number - ref?: any - }, - context?: { - slots?: { - default: (props: { errors: readonly OmegaError[]; showedGeneralErrors: string[] }) => any - } - attrs?: Record - } - ) => { - return h(eHoc(errorContext)(OmegaErrorsInternal) as any, { - ...props, - ...context?.attrs - }, context?.slots) - } - - const TaggedUnion = >( - props: { - name: Name - type?: "select" | "radio" - options: import("./InputProps").TaggedUnionOptionsArray - label?: string - key?: string | number - ref?: any - }, - context?: { - slots?: Record - attrs?: Record - } - ) => { - return h(OmegaTaggedUnion, { - ...props, - form: formWithExtras as any, - ...context?.attrs - }, context?.slots) - } - - const ArrayComponent = >( - props: { - name: Name - defaultItems?: DeepValue - key?: string | number - ref?: any - }, - context?: { - slots?: { - "pre-array"?: (props: { field: any; state: any }) => any - default?: (props: { subField: any; subState: any; index: number; field: any }) => any - "post-array"?: (props: { field: any; state: any }) => any - field?: (props: { field: any }) => any - } - attrs?: Record - } - ) => { - return h(OmegaArray, { - ...props, - form: formWithExtras as any, - ...context?.attrs - }, context?.slots) - } - - const AutoGen = ( - props: { - pick?: DeepKeys[] - omit?: DeepKeys[] - labelMap?: (key: DeepKeys) => string | undefined - filterMap?: >(key: DeepKeys, meta: M) => boolean | M - order?: DeepKeys[] - sort?: Order.Order> - key?: string | number - ref?: any - }, - context?: { - slots?: { - default(props: { child: OmegaAutoGenMeta }): any - } - attrs?: Record - } - ) => { - return h(OmegaAutoGen as any, { - ...props, - form: formWithExtras, - ...context?.attrs - }, context?.slots) - } - - const Form = >( - props: { - disabled?: boolean - subscribe?: K[] - key?: string | number - ref?: any - }, - context?: { - slots?: { - default(props: { - subscribedValues: K[] extends undefined[] ? Record : Pick, K> - }): any - } - attrs?: Record - } - ) => { - return h(OmegaForm as any, { - ...props, - form: formWithExtras, - ...context?.attrs - }, context?.slots) - } - return Object.assign(formWithExtras, { + // Type-level properties for performance optimization (not used at runtime) + _paths: undefined as any, + _keys: undefined as any, errorContext, - Form, - Input, - TaggedUnion, + Form: fHoc(formWithExtras)(OmegaForm as any) as any, + Input: fHoc(formWithExtras)(omegaConfig?.input ?? OmegaInput) as any, + TaggedUnion: fHoc(formWithExtras)(OmegaTaggedUnion) as any, Field: form.Field, - Errors, - Array: ArrayComponent, - AutoGen + Errors: eHoc(errorContext)(OmegaErrorsInternal) as any, + Array: fHoc(formWithExtras)(OmegaArray) as any, + AutoGen: fHoc(formWithExtras)(OmegaAutoGen as any) as any }) } diff --git a/packages/vue-components/stories/OmegaForm/SimpleForm.vue b/packages/vue-components/stories/OmegaForm/SimpleForm.vue index f335158095..5d9d179c3f 100644 --- a/packages/vue-components/stories/OmegaForm/SimpleForm.vue +++ b/packages/vue-components/stories/OmegaForm/SimpleForm.vue @@ -4,10 +4,9 @@
values: {{ values }} {{ isDirty }} {{ canSubmit }}