@tanstack/svelte-form 1.33.4 → 2.0.0-alpha.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.
- package/dist/AppForm/AppForm.svelte +14 -0
- package/dist/AppForm/Components.lib.d.ts +7 -0
- package/dist/AppForm/Components.lib.js +8 -0
- package/dist/AppForm/SvelteAppFormApi.public.d.ts +10 -0
- package/dist/AppForm/appFormOptions.public.d.ts +12 -0
- package/dist/AppForm/appFormOptions.public.js +1 -0
- package/dist/AppForm/componentMap.public.d.ts +7 -0
- package/dist/AppForm/componentMap.public.js +1 -0
- package/dist/AppForm/contexts.lib.d.ts +4 -0
- package/dist/AppForm/contexts.lib.js +16 -0
- package/dist/AppForm/createFormHook.public.d.ts +3 -0
- package/dist/AppForm/createFormHook.public.js +20 -0
- package/dist/AppForm/createFormHookTypes.public.d.ts +12 -0
- package/dist/AppForm/createFormHookTypes.public.js +1 -0
- package/dist/AppForm/fieldComponentHelpers.lib.d.ts +5 -0
- package/dist/AppForm/fieldComponentHelpers.lib.js +10 -0
- package/dist/AppForm/getFormHookHelpers.public.d.ts +31 -0
- package/dist/AppForm/getFormHookHelpers.public.js +13 -0
- package/dist/AppForm/initializeAppForm.lib.d.ts +4 -0
- package/dist/AppForm/initializeAppForm.lib.js +5 -0
- package/dist/Components.public.d.ts +52 -0
- package/dist/Components.public.js +1 -0
- package/dist/Field.svelte +125 -314
- package/dist/Field.svelte.d.ts +14 -30
- package/dist/FieldGroup/FieldGroupApi.public.d.ts +15 -0
- package/dist/FieldGroup/FieldGroupApi.public.js +1 -0
- package/dist/FieldGroup/withFields.lib.d.ts +5 -0
- package/dist/FieldGroup/withFields.lib.js +44 -0
- package/dist/FieldGroup/withFields.public.d.ts +70 -0
- package/dist/FieldGroup/withFields.public.js +3 -0
- package/dist/FormGroup.svelte +81 -302
- package/dist/FormGroup.svelte.d.ts +13 -30
- package/dist/Subscribe.svelte +18 -8
- package/dist/Subscribe.svelte.d.ts +5 -3
- package/dist/createForm.public.d.ts +5 -0
- package/dist/createForm.public.js +5 -0
- package/dist/createForm.svelte.d.ts +11 -27
- package/dist/createForm.svelte.js +29 -19
- package/dist/formApiTypes.public.d.ts +13 -0
- package/dist/formApiTypes.public.js +1 -0
- package/dist/formType.public.d.ts +7 -0
- package/dist/formType.public.js +1 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.js +13 -3
- package/dist/utils.lib.d.ts +1 -0
- package/dist/utils.lib.js +28 -0
- package/package.json +5 -5
- package/src/AppForm/AppForm.svelte +14 -0
- package/src/AppForm/Components.lib.ts +28 -0
- package/src/AppForm/SvelteAppFormApi.public.ts +14 -0
- package/src/AppForm/appFormOptions.public.ts +57 -0
- package/src/AppForm/componentMap.public.ts +19 -0
- package/src/AppForm/contexts.lib.ts +24 -0
- package/src/AppForm/createFormHook.public.ts +33 -0
- package/src/AppForm/createFormHookTypes.public.ts +30 -0
- package/src/AppForm/fieldComponentHelpers.lib.ts +24 -0
- package/src/AppForm/getFormHookHelpers.public.ts +82 -0
- package/src/AppForm/initializeAppForm.lib.ts +18 -0
- package/src/Components.public.ts +371 -0
- package/src/Field.svelte +125 -314
- package/src/FieldGroup/FieldGroupApi.public.ts +100 -0
- package/src/FieldGroup/withFields.lib.ts +82 -0
- package/src/FieldGroup/withFields.public.ts +179 -0
- package/src/FormGroup.svelte +81 -302
- package/src/Subscribe.svelte +18 -8
- package/src/createForm.public.ts +26 -0
- package/src/createForm.svelte.ts +62 -336
- package/src/formApiTypes.public.ts +48 -0
- package/src/formType.public.ts +46 -0
- package/src/index.ts +13 -12
- package/src/utils.lib.ts +30 -0
- package/dist/AppField.svelte +0 -19
- package/dist/AppField.svelte.d.ts +0 -10
- package/dist/AppForm.svelte +0 -16
- package/dist/InnerAppField.svelte +0 -17
- package/dist/InnerAppField.svelte.d.ts +0 -9
- package/dist/createFormCreator.svelte.d.ts +0 -26
- package/dist/createFormCreator.svelte.js +0 -51
- package/dist/types.d.ts +0 -21
- package/src/AppField.svelte +0 -19
- package/src/AppForm.svelte +0 -16
- package/src/InnerAppField.svelte +0 -17
- package/src/createFormCreator.svelte.ts +0 -321
- package/src/types.ts +0 -567
- /package/dist/{AppForm.svelte.d.ts → AppForm/AppForm.svelte.d.ts} +0 -0
- /package/dist/{types.js → AppForm/SvelteAppFormApi.public.js} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { setContext, untrack, type Snippet } from 'svelte'
|
|
3
|
+
import { formContextKey } from '../context-keys.js'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
form: any
|
|
7
|
+
children: Snippet
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { children, form }: Props = $props()
|
|
11
|
+
setContext(formContextKey, untrack(() => form))
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
{@render children()}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnyInternalFormApi } from '@tanstack/form-core/internals';
|
|
2
|
+
import type { Component } from 'svelte';
|
|
3
|
+
import type { AnySvelteFormComponentMap } from './componentMap.public';
|
|
4
|
+
import type { SvelteAppFormApi } from './SvelteAppFormApi.public';
|
|
5
|
+
type AnySvelteAppFormApi = SvelteAppFormApi<any, any, AnySvelteFormComponentMap>;
|
|
6
|
+
export declare function attachSvelteAppFormComponents(form: AnyInternalFormApi, formComponents: Record<string, Component<any>>, fieldComponents: Record<string, Component<any>>): AnySvelteAppFormApi;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { attachSvelteFormComponents } from '../createForm.svelte';
|
|
2
|
+
import { withComponentProps } from '../utils.lib.js';
|
|
3
|
+
import AppForm from './AppForm.svelte';
|
|
4
|
+
export function attachSvelteAppFormComponents(form, formComponents, fieldComponents) {
|
|
5
|
+
const result = attachSvelteFormComponents(form, fieldComponents);
|
|
6
|
+
result.AppForm = ((internals, props) => AppForm(internals, withComponentProps(props, { form: result })));
|
|
7
|
+
return Object.assign(result, formComponents);
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FormErrorTypes } from '@tanstack/form-core';
|
|
2
|
+
import type { Component, Snippet } from 'svelte';
|
|
3
|
+
import type { SvelteFormApi } from '../formApiTypes.public';
|
|
4
|
+
import type { AnySvelteFormComponentMap } from './componentMap.public';
|
|
5
|
+
export type AppFormComponent = Component<{
|
|
6
|
+
children: Snippet;
|
|
7
|
+
}>;
|
|
8
|
+
export type SvelteAppFormApi<TFormData, TFormErrorTypes extends FormErrorTypes, TComponents extends AnySvelteFormComponentMap> = SvelteFormApi<TFormData, TFormErrorTypes, TComponents> & {
|
|
9
|
+
AppForm: AppFormComponent;
|
|
10
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FormOptions, FormValidatorData, FormValidators, InferUnion, NullableSchemaData } from '@tanstack/form-core';
|
|
2
|
+
import type { AnySvelteFormComponentMap } from './componentMap.public';
|
|
3
|
+
declare const componentsSymbol: unique symbol;
|
|
4
|
+
export interface AppFormOptions<TFormData, TFormValidators extends FormValidators<TFormData>, TSubmitReturn, TComponents extends AnySvelteFormComponentMap> extends FormOptions<TFormData, TFormValidators, TSubmitReturn> {
|
|
5
|
+
[componentsSymbol]: TComponents;
|
|
6
|
+
}
|
|
7
|
+
export interface AppFormOptionsApi<TComponents extends AnySvelteFormComponentMap> {
|
|
8
|
+
<TFormData, const TFormValidators extends FormValidators<TFormData>, TSubmitReturn>(options: FormOptions<TFormData, TFormValidators, TSubmitReturn>): AppFormOptions<TFormData, TFormValidators, TSubmitReturn, TComponents>;
|
|
9
|
+
strictSchema: <const TFormValidators extends FormValidators<any>, TFormData extends FormValidatorData<TFormValidators>, TSubmitReturn>(options: FormOptions<TFormData, TFormValidators, TSubmitReturn>) => AppFormOptions<FormValidatorData<TFormValidators>, TFormValidators, TSubmitReturn, TComponents>;
|
|
10
|
+
looseSchema: <const TFormValidators extends FormValidators<any>, const TFormData extends NullableSchemaData<TFormValidators>, TSubmitReturn>(options: FormOptions<TFormData, TFormValidators, TSubmitReturn>) => AppFormOptions<InferUnion<TFormData, FormValidatorData<TFormValidators>>, TFormValidators, TSubmitReturn, TComponents>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
export interface SvelteFormComponentMap<TFormComponents extends Record<string, Component<any>>, TFieldComponents extends Record<string, Component<any>>> {
|
|
3
|
+
formComponents: TFormComponents;
|
|
4
|
+
fieldComponents: TFieldComponents;
|
|
5
|
+
}
|
|
6
|
+
export type AnySvelteFormComponentMap = SvelteFormComponentMap<Record<string, Component<any>>, Record<string, Component<any>>>;
|
|
7
|
+
export type DefaultSvelteFormComponentMap = SvelteFormComponentMap<Record<never, never>, Record<never, never>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AnyInternalFieldApi } from '@tanstack/form-core/internals';
|
|
2
|
+
import type { InternalSvelteFormApi } from '../createForm.svelte.js';
|
|
3
|
+
export declare function useFieldContext(): AnyInternalFieldApi;
|
|
4
|
+
export declare function useFormContext(): InternalSvelteFormApi;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getContext } from 'svelte';
|
|
2
|
+
import { fieldContextKey, formContextKey } from '../context-keys.js';
|
|
3
|
+
export function useFieldContext() {
|
|
4
|
+
const field = getContext(fieldContextKey);
|
|
5
|
+
if (field === undefined) {
|
|
6
|
+
throw new Error('TanStack Form: Field components must be used within a `form.Field` component.');
|
|
7
|
+
}
|
|
8
|
+
return field;
|
|
9
|
+
}
|
|
10
|
+
export function useFormContext() {
|
|
11
|
+
const form = getContext(formContextKey);
|
|
12
|
+
if (form === undefined) {
|
|
13
|
+
throw new Error('TanStack Form: Form components must be used within a `form.AppForm` component.');
|
|
14
|
+
}
|
|
15
|
+
return form;
|
|
16
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AnySvelteFormComponentMap } from './componentMap.public';
|
|
2
|
+
import type { AppFormHookResult } from './createFormHookTypes.public';
|
|
3
|
+
export declare function createFormHook<const TComponents extends AnySvelteFormComponentMap>(createOptions: TComponents): AppFormHookResult<TComponents>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createInternalForm } from '../createForm.svelte';
|
|
2
|
+
import { defineFieldGroup } from '../FieldGroup/withFields.public';
|
|
3
|
+
import { createAppFormInitializer } from './initializeAppForm.lib';
|
|
4
|
+
import { useFormContext } from './contexts.lib';
|
|
5
|
+
const appFormOptions = ((opts) => opts);
|
|
6
|
+
appFormOptions.strictSchema = (opts) => opts;
|
|
7
|
+
appFormOptions.looseSchema = (opts) => opts;
|
|
8
|
+
export function createFormHook(createOptions) {
|
|
9
|
+
const initializeAppForm = createAppFormInitializer(createOptions);
|
|
10
|
+
function useExtendedForm(options) {
|
|
11
|
+
return createInternalForm(options, initializeAppForm);
|
|
12
|
+
}
|
|
13
|
+
const useAppForm = useExtendedForm;
|
|
14
|
+
return {
|
|
15
|
+
useFormContext: useFormContext,
|
|
16
|
+
appFormOptions,
|
|
17
|
+
defineAppFieldGroup: defineFieldGroup,
|
|
18
|
+
useAppForm,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AppFormOptionsApi } from './appFormOptions.public';
|
|
2
|
+
import type { AnySvelteFormComponentMap } from './componentMap.public';
|
|
3
|
+
import type { SvelteAppFormApi } from './SvelteAppFormApi.public';
|
|
4
|
+
import type { DefineFieldGroupFn } from '../FieldGroup/withFields.public';
|
|
5
|
+
import type { FormOptions, FormValidators, ToFormErrorTypes } from '@tanstack/form-core';
|
|
6
|
+
export type UseAppFormHook<TComponents extends AnySvelteFormComponentMap> = <TFormData, TFormValidators extends FormValidators<TFormData>, TSubmitReturn>(options: () => FormOptions<TFormData, TFormValidators, TSubmitReturn>) => SvelteAppFormApi<TFormData, ToFormErrorTypes<TFormValidators, TSubmitReturn>, TComponents>;
|
|
7
|
+
export interface AppFormHookResult<TComponents extends AnySvelteFormComponentMap> {
|
|
8
|
+
appFormOptions: AppFormOptionsApi<TComponents>;
|
|
9
|
+
defineAppFieldGroup: DefineFieldGroupFn<TComponents['fieldComponents']>;
|
|
10
|
+
useAppForm: UseAppFormHook<TComponents>;
|
|
11
|
+
useFormContext: () => SvelteAppFormApi<any, any, TComponents>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
type AnyFieldComponent = Component<any>;
|
|
3
|
+
export declare function wrapField(Component: AnyFieldComponent, fieldPropKey: string): AnyFieldComponent;
|
|
4
|
+
export declare function brandComponentFactory(): (component: AnyFieldComponent) => AnyFieldComponent;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { withComponentProps } from '../utils.lib.js';
|
|
2
|
+
import { useFieldContext } from './contexts.lib';
|
|
3
|
+
export function wrapField(Component, fieldPropKey) {
|
|
4
|
+
return ((internals, props) => Component(internals, withComponentProps(props, {
|
|
5
|
+
[fieldPropKey]: useFieldContext(),
|
|
6
|
+
})));
|
|
7
|
+
}
|
|
8
|
+
export function brandComponentFactory() {
|
|
9
|
+
return (component) => component;
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Component, ComponentProps } from 'svelte';
|
|
2
|
+
import type { FieldWithValue } from '@tanstack/form-core';
|
|
3
|
+
type ExactFieldBrand<out TValue> = {
|
|
4
|
+
readonly __tanstackFieldExactType: TValue;
|
|
5
|
+
};
|
|
6
|
+
type AcceptsFieldBrand<out TAcceptedValue> = {
|
|
7
|
+
readonly __tanstackFieldAcceptsType: TAcceptedValue;
|
|
8
|
+
};
|
|
9
|
+
type AnyFieldComponent = Component<any>;
|
|
10
|
+
type PropsOf<TComponent extends AnyFieldComponent> = ComponentProps<TComponent>;
|
|
11
|
+
type FieldValuePropKeys<TProps> = {
|
|
12
|
+
[K in keyof TProps]-?: TProps[K] extends FieldWithValue<any> ? K : never;
|
|
13
|
+
}[keyof TProps];
|
|
14
|
+
type FieldValueFromProp<TProp> = TProp extends FieldWithValue<infer TValue> ? TValue : never;
|
|
15
|
+
type PublicPropsReplacingField<TProps, TFieldPropKey extends keyof TProps> = Omit<TProps, TFieldPropKey>;
|
|
16
|
+
type StrictInjectedFieldComponent<TComponent extends AnyFieldComponent, TProps = PropsOf<TComponent>, TFieldPropKey extends FieldValuePropKeys<TProps> = FieldValuePropKeys<TProps>> = Component<PublicPropsReplacingField<TProps, TFieldPropKey>> & ExactFieldBrand<FieldValueFromProp<TProps[TFieldPropKey]>>;
|
|
17
|
+
type LooseInjectedFieldComponent<TComponent extends AnyFieldComponent, TProps = PropsOf<TComponent>, TFieldPropKey extends FieldValuePropKeys<TProps> = FieldValuePropKeys<TProps>> = Component<PublicPropsReplacingField<TProps, TFieldPropKey>> & AcceptsFieldBrand<FieldValueFromProp<TProps[TFieldPropKey]>>;
|
|
18
|
+
interface FieldComponentHelper {
|
|
19
|
+
strict: <TComponent extends AnyFieldComponent, TProps = PropsOf<TComponent>, TFieldPropKey extends FieldValuePropKeys<TProps> = FieldValuePropKeys<TProps>>(Component: TComponent, fieldPropKey: TFieldPropKey) => StrictInjectedFieldComponent<TComponent, TProps, TFieldPropKey>;
|
|
20
|
+
loose: <TComponent extends AnyFieldComponent, TProps = PropsOf<TComponent>, TFieldPropKey extends FieldValuePropKeys<TProps> = FieldValuePropKeys<TProps>>(Component: TComponent, fieldPropKey: TFieldPropKey) => LooseInjectedFieldComponent<TComponent, TProps, TFieldPropKey>;
|
|
21
|
+
}
|
|
22
|
+
interface FieldBrandHelper {
|
|
23
|
+
strict: <TValue>() => <TComponent extends AnyFieldComponent>(component: TComponent) => TComponent & ExactFieldBrand<TValue>;
|
|
24
|
+
loose: <TValue>() => <TComponent extends AnyFieldComponent>(component: TComponent) => TComponent & AcceptsFieldBrand<TValue>;
|
|
25
|
+
}
|
|
26
|
+
export interface FormHookHelpers {
|
|
27
|
+
fieldBrand: FieldBrandHelper;
|
|
28
|
+
fieldComponent: FieldComponentHelper;
|
|
29
|
+
}
|
|
30
|
+
export declare function getFormHookHelpers(): FormHookHelpers;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { brandComponentFactory, wrapField } from './fieldComponentHelpers.lib';
|
|
2
|
+
export function getFormHookHelpers() {
|
|
3
|
+
return {
|
|
4
|
+
fieldComponent: {
|
|
5
|
+
strict: wrapField,
|
|
6
|
+
loose: wrapField,
|
|
7
|
+
},
|
|
8
|
+
fieldBrand: {
|
|
9
|
+
strict: brandComponentFactory,
|
|
10
|
+
loose: brandComponentFactory,
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FormOptions } from '@tanstack/form-core';
|
|
2
|
+
import type { InternalSvelteFormApi } from '../createForm.svelte.js';
|
|
3
|
+
import type { AnySvelteFormComponentMap } from './componentMap.public';
|
|
4
|
+
export declare function createAppFormInitializer<TComponents extends AnySvelteFormComponentMap>(createOptions: TComponents): (options: FormOptions<any, any, any>) => InternalSvelteFormApi;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { InternalFormApi } from '@tanstack/form-core/internals';
|
|
2
|
+
import { attachSvelteAppFormComponents } from './Components.lib';
|
|
3
|
+
export function createAppFormInitializer(createOptions) {
|
|
4
|
+
return (options) => attachSvelteAppFormComponents(new InternalFormApi(options), createOptions.formComponents, createOptions.fieldComponents);
|
|
5
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { DeepKeys, DeepKeysWhereValueIncludes, DeepValue, FieldApi, FieldApiOptions, FieldValidators, FormErrorTypes, FormGroupApi, FormGroupOptions, FormGroupState, FormGroupValidators, FormState, ToFieldError, ToFormGroupErrorTypes } from '@tanstack/form-core';
|
|
2
|
+
import type { Component, ComponentConstructorOptions, Snippet, SvelteComponent } from 'svelte';
|
|
3
|
+
export type WithoutFunction<T> = {
|
|
4
|
+
[K in keyof T as T[K] extends Function ? never : K]: T[K];
|
|
5
|
+
};
|
|
6
|
+
type ExactFieldBrand<out TValue> = {
|
|
7
|
+
readonly __tanstackFieldExactType: TValue;
|
|
8
|
+
};
|
|
9
|
+
type AcceptsFieldBrand<out TAcceptedValue> = {
|
|
10
|
+
readonly __tanstackFieldAcceptsType: TAcceptedValue;
|
|
11
|
+
};
|
|
12
|
+
type CompatibleFieldKey<TKey, TComponent, TTargetValue> = TComponent extends ExactFieldBrand<infer TExact> ? [TExact] extends [TTargetValue] ? [TTargetValue] extends [TExact] ? TKey : never : never : TComponent extends AcceptsFieldBrand<infer TLoose> ? [TTargetValue] extends [TLoose] ? TKey : never : TKey;
|
|
13
|
+
type FilteredFieldComponents<TFieldComponents extends Record<string, Component<any>>, TTargetValue> = {
|
|
14
|
+
[K in keyof TFieldComponents as CompatibleFieldKey<K, TFieldComponents[K], TTargetValue>]: TFieldComponents[K];
|
|
15
|
+
};
|
|
16
|
+
type FieldComponentsMatchingType<TFieldComponents extends Record<string, Component<any>>, TTargetValue> = unknown extends TTargetValue ? TFieldComponents : string extends keyof TFieldComponents ? TFieldComponents : FilteredFieldComponents<TFieldComponents, TTargetValue>;
|
|
17
|
+
export type SvelteFieldApi<TFieldName, TFieldValue, TFieldError, TFormData, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> = FieldApi<TFieldName, TFieldValue, TFieldError, TFormData, TFormErrorTypes> & FieldComponentsMatchingType<TFieldComponents, TFieldValue>;
|
|
18
|
+
interface SvelteSubscribeProps<TSourceData, TSelected> {
|
|
19
|
+
selector: (state: TSourceData) => TSelected;
|
|
20
|
+
when?: (selected: NoInfer<TSelected>) => boolean;
|
|
21
|
+
children: Snippet<[NoInfer<TSelected>]>;
|
|
22
|
+
}
|
|
23
|
+
export type SvelteFormSubscribeProps<TFormData, TFormErrorTypes extends FormErrorTypes, TSelected> = SvelteSubscribeProps<FormState<TFormData, TFormErrorTypes>, TSelected>;
|
|
24
|
+
export type SvelteFormSubscribeComponent<TFormData, TFormErrorTypes extends FormErrorTypes> = (new <TSelected>(options: ComponentConstructorOptions<SvelteFormSubscribeProps<TFormData, TFormErrorTypes, TSelected>>) => SvelteComponent) & Component<any> & WithoutFunction<Component>;
|
|
25
|
+
export interface SvelteFormFieldProps<TFieldData, TFieldName, TFieldValue, TFieldValidators extends FieldValidators<TFieldData, TFieldName, TFieldValue>, TGroupFieldError, TFormData, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> extends FieldApiOptions<TFieldData, TFieldName, TFieldValue, TFieldValidators, TGroupFieldError, TFormData, TFormErrorTypes> {
|
|
26
|
+
children: Snippet<[
|
|
27
|
+
SvelteFieldApi<TFieldName, TFieldValue, ToFieldError<NoInfer<TFieldValidators>, TGroupFieldError, TFormErrorTypes>, TFormData, TFormErrorTypes, TFieldComponents>
|
|
28
|
+
]>;
|
|
29
|
+
}
|
|
30
|
+
export type SvelteFormFieldComponent<TFormData, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> = (new <TFieldName extends DeepKeys<TFormData>, const TFieldValidators extends FieldValidators<TFormData, TFieldName, DeepValue<TFormData, TFieldName>>>(options: ComponentConstructorOptions<SvelteFormFieldProps<TFormData, TFieldName, DeepValue<TFormData, TFieldName>, TFieldValidators, never, TFormData, TFormErrorTypes, TFieldComponents>>) => SvelteComponent) & Component<any> & WithoutFunction<Component>;
|
|
31
|
+
export type SvelteFormArrayFieldComponent<TFormData, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> = (new <TFieldName extends DeepKeysWhereValueIncludes<TFormData, Array<any>>, const TFieldValidators extends FieldValidators<TFormData, TFieldName, DeepValue<TFormData, TFieldName>>>(options: ComponentConstructorOptions<SvelteFormFieldProps<TFormData, TFieldName, DeepValue<TFormData, TFieldName>, TFieldValidators, never, TFormData, TFormErrorTypes, TFieldComponents>>) => SvelteComponent) & Component<any> & WithoutFunction<Component>;
|
|
32
|
+
export type SvelteFormGroupSubscribeComponent<TGroupValue, TGroupErrorTypes extends FormErrorTypes> = (new <TSelected>(options: ComponentConstructorOptions<SvelteSubscribeProps<FormGroupState<TGroupValue, TGroupErrorTypes>, TSelected>>) => SvelteComponent) & Component<any> & WithoutFunction<Component>;
|
|
33
|
+
export type SvelteFormGroupFieldComponent<TFormData, TGroupValue, TGroupErrorTypes extends FormErrorTypes, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> = (new <TFieldName extends DeepKeys<TGroupValue>, const TFieldValidators extends FieldValidators<TGroupValue, TFieldName, DeepValue<TGroupValue, TFieldName>>>(options: ComponentConstructorOptions<SvelteFormFieldProps<TGroupValue, TFieldName, DeepValue<TGroupValue, TFieldName>, TFieldValidators, TGroupErrorTypes['fieldError'], TFormData, TFormErrorTypes, TFieldComponents>>) => SvelteComponent) & Component<any> & WithoutFunction<Component>;
|
|
34
|
+
export type SvelteFormGroupArrayFieldComponent<TFormData, TGroupValue, TGroupErrorTypes extends FormErrorTypes, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> = (new <TFieldName extends DeepKeysWhereValueIncludes<TGroupValue, Array<any>>, const TFieldValidators extends FieldValidators<TGroupValue, TFieldName, DeepValue<TGroupValue, TFieldName>>>(options: ComponentConstructorOptions<SvelteFormFieldProps<TGroupValue, TFieldName, DeepValue<TGroupValue, TFieldName>, TFieldValidators, TGroupErrorTypes['fieldError'], TFormData, TFormErrorTypes, TFieldComponents>>) => SvelteComponent) & Component<any> & WithoutFunction<Component>;
|
|
35
|
+
export interface SvelteFormGroupApi<TFormData, TGroupName, TGroupValue, TGroupErrorTypes extends FormErrorTypes, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> extends FormGroupApi<TFormData, TGroupName, TGroupValue, TGroupErrorTypes, TFormErrorTypes> {
|
|
36
|
+
Field: SvelteFormGroupFieldComponent<TFormData, TGroupValue, TGroupErrorTypes, TFormErrorTypes, TFieldComponents>;
|
|
37
|
+
ArrayField: SvelteFormGroupArrayFieldComponent<TFormData, TGroupValue, TGroupErrorTypes, TFormErrorTypes, TFieldComponents>;
|
|
38
|
+
Subscribe: SvelteFormGroupSubscribeComponent<TGroupValue, TGroupErrorTypes>;
|
|
39
|
+
}
|
|
40
|
+
export interface SvelteFormGroupProps<TFormData, TGroupName, TGroupValue, TGroupValidators extends FormGroupValidators<TGroupValue>, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> extends Omit<FormGroupOptions<TFormData, TGroupName, TGroupValue, TGroupValidators, TFormErrorTypes>, 'form'> {
|
|
41
|
+
children: Snippet<[
|
|
42
|
+
SvelteFormGroupApi<TFormData, TGroupName, TGroupValue, ToFormGroupErrorTypes<NoInfer<TGroupValidators>>, TFormErrorTypes, TFieldComponents>
|
|
43
|
+
]>;
|
|
44
|
+
}
|
|
45
|
+
export type SvelteFormGroupComponent<TFormData, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>>> = (new <TGroupName extends DeepKeys<TFormData>, TGroupValue extends DeepValue<TFormData, TGroupName>, const TGroupValidators extends FormGroupValidators<TGroupValue>>(options: ComponentConstructorOptions<SvelteFormGroupProps<TFormData, TGroupName, TGroupValue, TGroupValidators, TFormErrorTypes, TFieldComponents>>) => SvelteComponent) & Component<any> & WithoutFunction<Component>;
|
|
46
|
+
export interface SvelteTanStackFormComponents<TFormData, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, Component<any>> = Record<never, never>> {
|
|
47
|
+
Field: SvelteFormFieldComponent<TFormData, TFormErrorTypes, TFieldComponents>;
|
|
48
|
+
ArrayField: SvelteFormArrayFieldComponent<TFormData, TFormErrorTypes, TFieldComponents>;
|
|
49
|
+
Subscribe: SvelteFormSubscribeComponent<TFormData, TFormErrorTypes>;
|
|
50
|
+
FormGroup: SvelteFormGroupComponent<TFormData, TFormErrorTypes, TFieldComponents>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|