@tanstack/preact-form 1.30.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/Components.lib.js +91 -0
- package/dist/AppForm/PreactAppFormApi.public.d.ts +14 -0
- package/dist/AppForm/appFormOptions.public.d.ts +14 -0
- package/dist/AppForm/componentMap.public.d.ts +10 -0
- package/dist/AppForm/contexts.lib.js +18 -0
- package/dist/AppForm/createFormHook.public.d.ts +6 -0
- package/dist/AppForm/createFormHook.public.js +26 -0
- package/dist/AppForm/createFormHookTypes.public.d.ts +15 -0
- package/dist/AppForm/fieldComponentHelpers.lib.js +22 -0
- package/dist/AppForm/getFormHookHelpers.public.d.ts +34 -0
- package/dist/AppForm/getFormHookHelpers.public.js +18 -0
- package/dist/AppForm/initializeAppForm.lib.js +13 -0
- package/dist/FieldGroup/FieldGroupApi.public.d.ts +24 -0
- package/dist/FieldGroup/withFields.lib.js +62 -0
- package/dist/FieldGroup/withFields.public.d.ts +55 -0
- package/dist/FieldGroup/withFields.public.js +8 -0
- package/dist/PreactForm/Components.lib.js +99 -0
- package/dist/PreactForm/Components.public.d.ts +66 -0
- package/dist/PreactForm/PreactFormApi.lib.js +28 -0
- package/dist/PreactForm/fieldSubscriptions.lib.js +29 -0
- package/dist/PreactForm/formApiTypes.public.d.ts +10 -0
- package/dist/PreactForm/formType.public.d.ts +9 -0
- package/dist/PreactForm/useField.lib.js +31 -0
- package/dist/PreactForm/useForm.public.d.ts +8 -0
- package/dist/PreactForm/useForm.public.js +10 -0
- package/dist/Subscribe.public.d.ts +29 -0
- package/dist/Subscribe.public.js +16 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +11 -0
- package/dist/preactTypes.public.d.ts +8 -0
- package/dist/types.public.d.ts +2 -0
- package/package.json +17 -18
- package/src/AppForm/Components.lib.tsx +160 -0
- package/src/AppForm/PreactAppFormApi.public.tsx +17 -0
- package/src/AppForm/appFormOptions.public.ts +59 -0
- package/src/AppForm/componentMap.public.ts +19 -0
- package/src/AppForm/contexts.lib.ts +28 -0
- package/src/AppForm/createFormHook.public.ts +37 -0
- package/src/AppForm/createFormHookTypes.public.ts +32 -0
- package/src/AppForm/fieldComponentHelpers.lib.tsx +30 -0
- package/src/AppForm/getFormHookHelpers.public.ts +114 -0
- package/src/AppForm/initializeAppForm.lib.ts +22 -0
- package/src/FieldGroup/FieldGroupApi.public.ts +91 -0
- package/src/FieldGroup/withFields.lib.ts +109 -0
- package/src/FieldGroup/withFields.public.ts +203 -0
- package/src/PreactForm/Components.lib.tsx +166 -0
- package/src/PreactForm/Components.public.ts +383 -0
- package/src/PreactForm/PreactFormApi.lib.tsx +48 -0
- package/src/PreactForm/fieldSubscriptions.lib.ts +32 -0
- package/src/PreactForm/formApiTypes.public.ts +29 -0
- package/src/PreactForm/formType.public.ts +52 -0
- package/src/PreactForm/useField.lib.ts +52 -0
- package/src/PreactForm/useForm.public.ts +34 -0
- package/src/Subscribe.public.tsx +56 -0
- package/src/index.ts +16 -9
- package/src/preactTypes.public.ts +6 -0
- package/src/types.public.ts +2 -0
- package/dist/cjs/createFormHook.cjs +0 -101
- package/dist/cjs/createFormHook.cjs.map +0 -1
- package/dist/cjs/createFormHook.d.cts +0 -80
- package/dist/cjs/index.cjs +0 -34
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.d.cts +0 -9
- package/dist/cjs/types.d.cts +0 -17
- package/dist/cjs/useField.cjs +0 -108
- package/dist/cjs/useField.cjs.map +0 -1
- package/dist/cjs/useField.d.cts +0 -52
- package/dist/cjs/useFieldGroup.cjs +0 -48
- package/dist/cjs/useFieldGroup.cjs.map +0 -1
- package/dist/cjs/useFieldGroup.d.cts +0 -30
- package/dist/cjs/useForm.cjs +0 -78
- package/dist/cjs/useForm.cjs.map +0 -1
- package/dist/cjs/useForm.d.cts +0 -31
- package/dist/cjs/useFormGroup.cjs +0 -163
- package/dist/cjs/useFormGroup.cjs.map +0 -1
- package/dist/cjs/useFormGroup.d.cts +0 -13
- package/dist/cjs/useFormId.cjs +0 -6
- package/dist/cjs/useFormId.cjs.map +0 -1
- package/dist/cjs/useFormId.d.cts +0 -2
- package/dist/cjs/useIsomorphicLayoutEffect.cjs +0 -6
- package/dist/cjs/useIsomorphicLayoutEffect.cjs.map +0 -1
- package/dist/cjs/useIsomorphicLayoutEffect.d.cts +0 -2
- package/dist/esm/createFormHook.d.ts +0 -80
- package/dist/esm/createFormHook.js +0 -101
- package/dist/esm/createFormHook.js.map +0 -1
- package/dist/esm/index.d.ts +0 -9
- package/dist/esm/index.js +0 -22
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types.d.ts +0 -17
- package/dist/esm/useField.d.ts +0 -52
- package/dist/esm/useField.js +0 -108
- package/dist/esm/useField.js.map +0 -1
- package/dist/esm/useFieldGroup.d.ts +0 -30
- package/dist/esm/useFieldGroup.js +0 -48
- package/dist/esm/useFieldGroup.js.map +0 -1
- package/dist/esm/useForm.d.ts +0 -31
- package/dist/esm/useForm.js +0 -78
- package/dist/esm/useForm.js.map +0 -1
- package/dist/esm/useFormGroup.d.ts +0 -13
- package/dist/esm/useFormGroup.js +0 -163
- package/dist/esm/useFormGroup.js.map +0 -1
- package/dist/esm/useFormId.d.ts +0 -2
- package/dist/esm/useFormId.js +0 -6
- package/dist/esm/useFormId.js.map +0 -1
- package/dist/esm/useIsomorphicLayoutEffect.d.ts +0 -2
- package/dist/esm/useIsomorphicLayoutEffect.js +0 -6
- package/dist/esm/useIsomorphicLayoutEffect.js.map +0 -1
- package/src/createFormHook.tsx +0 -603
- package/src/types.ts +0 -143
- package/src/useField.tsx +0 -730
- package/src/useFieldGroup.tsx +0 -259
- package/src/useForm.tsx +0 -300
- package/src/useFormGroup.tsx +0 -741
- package/src/useFormId.ts +0 -3
- package/src/useIsomorphicLayoutEffect.ts +0 -4
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { attachPreactFormComponents } from "./Components.lib.js";
|
|
2
|
+
import { InternalFormApi } from "@tanstack/form-core/internals";
|
|
3
|
+
import * as Preact$1 from "preact/compat";
|
|
4
|
+
import { useEffect, useRef } from "preact/compat";
|
|
5
|
+
|
|
6
|
+
//#region src/PreactForm/PreactFormApi.lib.tsx
|
|
7
|
+
const usePreactId = Preact$1.useId ?? (() => void 0);
|
|
8
|
+
function initializeForm(options) {
|
|
9
|
+
const form = new InternalFormApi(options);
|
|
10
|
+
return attachPreactFormComponents(form, null);
|
|
11
|
+
}
|
|
12
|
+
function useInternalForm(options, initializeFn) {
|
|
13
|
+
const preactFormId = usePreactId();
|
|
14
|
+
const resolvedOptions = options.formId === void 0 ? {
|
|
15
|
+
...options,
|
|
16
|
+
formId: preactFormId
|
|
17
|
+
} : options;
|
|
18
|
+
const formRef = useRef(null);
|
|
19
|
+
if (!formRef.current) formRef.current = initializeFn(resolvedOptions);
|
|
20
|
+
useEffect(() => formRef.current._update(resolvedOptions));
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
return formRef.current.mount();
|
|
23
|
+
}, []);
|
|
24
|
+
return formRef.current;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { initializeForm, useInternalForm };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useSelector } from "@tanstack/preact-store";
|
|
2
|
+
import { useMemo } from "preact/compat";
|
|
3
|
+
|
|
4
|
+
//#region src/PreactForm/fieldSubscriptions.lib.ts
|
|
5
|
+
function useValueFieldSubscription(fieldApi) {
|
|
6
|
+
const value = useSelector(fieldApi.atom, (state) => state.value);
|
|
7
|
+
const meta = useSelector(fieldApi.atom, (state) => state.meta);
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
return Object.create(fieldApi);
|
|
10
|
+
}, [
|
|
11
|
+
fieldApi,
|
|
12
|
+
meta,
|
|
13
|
+
value
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
function useArrayFieldSubscription(fieldApi) {
|
|
17
|
+
const length = useSelector(fieldApi.atom, (state) => state.value.length);
|
|
18
|
+
const arrayVersion = useSelector(fieldApi.atom, (state) => state.meta._arrayVersion);
|
|
19
|
+
return useMemo(() => {
|
|
20
|
+
return Object.create(fieldApi);
|
|
21
|
+
}, [
|
|
22
|
+
fieldApi,
|
|
23
|
+
arrayVersion,
|
|
24
|
+
length
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { useArrayFieldSubscription, useValueFieldSubscription };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AnyPreactFormComponentMap, PreactFormComponentMap } from "../AppForm/componentMap.public.js";
|
|
2
|
+
import { PreactTanStackFormComponents } from "./Components.public.js";
|
|
3
|
+
import { AnyFormApi, FormApi, FormErrorTypes } from "@tanstack/form-core";
|
|
4
|
+
import { FunctionComponent } from "preact/compat";
|
|
5
|
+
//#region src/PreactForm/formApiTypes.public.d.ts
|
|
6
|
+
type ExtendedFormApi<TFormData, TFormErrorTypes extends FormErrorTypes, TFieldComponents extends Record<string, FunctionComponent<any>>> = FormApi<TFormData, TFormErrorTypes> & PreactTanStackFormComponents<TFormData, TFormErrorTypes, TFieldComponents>;
|
|
7
|
+
type PreactFormApi<TFormData, TFormErrorTypes extends FormErrorTypes, TComponents extends AnyPreactFormComponentMap> = unknown extends TComponents['formComponents'] ? ExtendedFormApi<TFormData, TFormErrorTypes, TComponents['fieldComponents']> : ExtendedFormApi<TFormData, TFormErrorTypes, TComponents['fieldComponents']> & TComponents['formComponents'];
|
|
8
|
+
type AnyPreactFormApi = AnyFormApi & PreactTanStackFormComponents<any, any, any>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { AnyPreactFormApi, PreactFormApi, type PreactFormComponentMap };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnyPreactFormComponentMap, DefaultPreactFormComponentMap } from "../AppForm/componentMap.public.js";
|
|
2
|
+
import { PreactFormApi } from "./formApiTypes.public.js";
|
|
3
|
+
import { AppFormOptions } from "../AppForm/appFormOptions.public.js";
|
|
4
|
+
import { AnyFormOptions, FormOptions, FormValidators, ToFormErrorTypes } from "@tanstack/form-core";
|
|
5
|
+
//#region src/PreactForm/formType.public.d.ts
|
|
6
|
+
type PreactFormTypeErrorTypes<TFormValidators extends FormValidators<any>, TSubmitReturn> = unknown extends TSubmitReturn ? any : ToFormErrorTypes<TFormValidators, TSubmitReturn>;
|
|
7
|
+
type PreactFormType<TOptions extends AnyFormOptions | AppFormOptions<any, any, any, AnyPreactFormComponentMap>> = TOptions extends AppFormOptions<infer TFormData, infer TFormValidators, infer TSubmitReturn, infer TComponents> ? PreactFormApi<TFormData, PreactFormTypeErrorTypes<TFormValidators, TSubmitReturn>, TComponents> : TOptions extends FormOptions<infer TFormData, infer TFormValidators, infer TSubmitReturn> ? PreactFormApi<TFormData, PreactFormTypeErrorTypes<TFormValidators, TSubmitReturn>, DefaultPreactFormComponentMap> : never;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { PreactFormType };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useSelector } from "@tanstack/preact-store";
|
|
2
|
+
import { useEffect, useMemo, useRef } from "preact/compat";
|
|
3
|
+
|
|
4
|
+
//#region src/PreactForm/useField.lib.ts
|
|
5
|
+
function useField(options, fieldComponents) {
|
|
6
|
+
const optionsRef = useRef(options);
|
|
7
|
+
optionsRef.current = options;
|
|
8
|
+
const resetVersion = useSelector(options.form._atoms.resetVersion);
|
|
9
|
+
const fieldApi = useMemo(() => {
|
|
10
|
+
const field = options.form._getOrCreateFieldApi({
|
|
11
|
+
...optionsRef.current,
|
|
12
|
+
name: options.name
|
|
13
|
+
});
|
|
14
|
+
if (fieldComponents === null) return field;
|
|
15
|
+
Object.assign(field, fieldComponents);
|
|
16
|
+
return field;
|
|
17
|
+
}, [
|
|
18
|
+
options.name,
|
|
19
|
+
options.form,
|
|
20
|
+
resetVersion,
|
|
21
|
+
fieldComponents
|
|
22
|
+
]);
|
|
23
|
+
useEffect(() => fieldApi._update(options));
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
return fieldApi._register();
|
|
26
|
+
}, [fieldApi]);
|
|
27
|
+
return fieldApi;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { useField };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnyPreactFormComponentMap, DefaultPreactFormComponentMap } from "../AppForm/componentMap.public.js";
|
|
2
|
+
import { PreactFormApi } from "./formApiTypes.public.js";
|
|
3
|
+
import { FormOptions, FormValidators, ToFormErrorTypes } from "@tanstack/form-core";
|
|
4
|
+
//#region src/PreactForm/useForm.public.d.ts
|
|
5
|
+
type UseFormHook<in out TComponents extends AnyPreactFormComponentMap> = <TFormData, const TFormValidators extends FormValidators<TFormData>, TSubmitReturn>(options: FormOptions<TFormData, TFormValidators, TSubmitReturn>) => PreactFormApi<TFormData, ToFormErrorTypes<TFormValidators, TSubmitReturn>, TComponents>;
|
|
6
|
+
declare const useForm: UseFormHook<DefaultPreactFormComponentMap>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { UseFormHook, useForm };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { initializeForm, useInternalForm } from "./PreactFormApi.lib.js";
|
|
2
|
+
|
|
3
|
+
//#region src/PreactForm/useForm.public.ts
|
|
4
|
+
function useFormHook(options) {
|
|
5
|
+
return useInternalForm(options, initializeForm);
|
|
6
|
+
}
|
|
7
|
+
const useForm = useFormHook;
|
|
8
|
+
|
|
9
|
+
//#endregion
|
|
10
|
+
export { useForm };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CrossVersionPreactNode } from "./preactTypes.public.js";
|
|
2
|
+
import { Atom, ReadonlyAtom, ReadonlyStore, Store } from "@tanstack/preact-store";
|
|
3
|
+
//#region src/Subscribe.public.d.ts
|
|
4
|
+
type SubscribeSource<TValue> = Atom<TValue> | ReadonlyAtom<TValue> | Store<TValue> | ReadonlyStore<TValue>;
|
|
5
|
+
/**
|
|
6
|
+
* Subscribe to `form.atom` (full form state). The selector receives the full
|
|
7
|
+
* {@link FormState}.
|
|
8
|
+
*/
|
|
9
|
+
interface SubscribeProps<in out TSourceData, in out TSelected> {
|
|
10
|
+
source: SubscribeSource<TSourceData>;
|
|
11
|
+
/**
|
|
12
|
+
* Select from full form state. Re-renders when the selected value changes
|
|
13
|
+
* (shallow compare).
|
|
14
|
+
*/
|
|
15
|
+
selector: (state: TSourceData) => TSelected;
|
|
16
|
+
/**
|
|
17
|
+
* Optional. If provided, the component will only render when the `when` function returns `true`.
|
|
18
|
+
*/
|
|
19
|
+
when?: (selected: NoInfer<TSelected>) => boolean;
|
|
20
|
+
children: ((state: NoInfer<TSelected>) => CrossVersionPreactNode) | CrossVersionPreactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A Preact component that allows you to subscribe to source state.
|
|
24
|
+
*
|
|
25
|
+
* This is useful for opting into state re-renders for specific parts of the state.
|
|
26
|
+
*/
|
|
27
|
+
declare function Subscribe<TSourceData, const TSelected>(props: SubscribeProps<TSourceData, TSelected>): CrossVersionPreactNode;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Subscribe, SubscribeProps, SubscribeSource };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { shallow, useSelector } from "@tanstack/preact-store";
|
|
2
|
+
|
|
3
|
+
//#region src/Subscribe.public.tsx
|
|
4
|
+
/**
|
|
5
|
+
* A Preact component that allows you to subscribe to source state.
|
|
6
|
+
*
|
|
7
|
+
* This is useful for opting into state re-renders for specific parts of the state.
|
|
8
|
+
*/
|
|
9
|
+
function Subscribe(props) {
|
|
10
|
+
const selected = useSelector(props.source, props.selector, { compare: shallow });
|
|
11
|
+
if (props.when?.(selected) === false) return null;
|
|
12
|
+
return typeof props.children === "function" ? props.children(selected) : props.children;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Subscribe };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AnyPreactFormComponentMap, DefaultPreactFormComponentMap, PreactFormComponentMap } from "./AppForm/componentMap.public.js";
|
|
2
|
+
import { CrossVersionPreactNode } from "./preactTypes.public.js";
|
|
3
|
+
import { PreactFieldApi, PreactFormArrayFieldComponent, PreactFormFieldComponent, PreactFormFieldProps, PreactFormGroupApi, PreactFormGroupArrayFieldComponent, PreactFormGroupComponent, PreactFormGroupFieldComponent, PreactFormGroupProps, PreactFormGroupSubscribeComponent, PreactFormGroupSubscribeProps, PreactFormSubscribeComponent, PreactFormSubscribeProps, PreactTanStackFormComponents } from "./PreactForm/Components.public.js";
|
|
4
|
+
import { AnyPreactFormApi, PreactFormApi } from "./PreactForm/formApiTypes.public.js";
|
|
5
|
+
import { UseFormHook, useForm } from "./PreactForm/useForm.public.js";
|
|
6
|
+
import { AppFormOptions, AppFormOptionsApi } from "./AppForm/appFormOptions.public.js";
|
|
7
|
+
import { PreactFormType } from "./PreactForm/formType.public.js";
|
|
8
|
+
import { AnyFieldGroupApi, FieldGroupApi, FieldGroupArrayFieldComponent, FieldGroupFieldComponent, FieldGroupFormState, FieldGroupSubscribeComponent, FieldGroupSubscribeProps } from "./FieldGroup/FieldGroupApi.public.js";
|
|
9
|
+
import { AnyFieldGroupFieldSlot, DefineFieldGroupFn, FieldGroupDefinition, FieldGroupFieldBindingForSlot, FieldGroupFieldBindings, FieldGroupFieldBindingsOf, FieldGroupFieldComponentsOf, FieldGroupFieldData, FieldGroupFieldNameForSlot, FieldGroupFieldNames, FieldGroupFieldSlot, FieldGroupFieldSlotAllows, FieldGroupFieldSlotMode, FieldGroupFieldSlotModeOf, FieldGroupFieldSlotValue, FieldGroupFields, FieldGroupFieldsOf, FieldGroupFieldsPropName, FieldGroupForm, FieldGroupHelper, FieldGroupWithFieldsFn, LooseFieldGroupFieldSlot, PreactFieldGroup, StrictFieldGroupFieldSlot, defineFieldGroup } from "./FieldGroup/withFields.public.js";
|
|
10
|
+
import "./types.public.js";
|
|
11
|
+
import { Subscribe, SubscribeProps, SubscribeSource } from "./Subscribe.public.js";
|
|
12
|
+
import { AppFormComponent, PreactAppFormApi } from "./AppForm/PreactAppFormApi.public.js";
|
|
13
|
+
import { AppFormHookResult, UseAppFormHook } from "./AppForm/createFormHookTypes.public.js";
|
|
14
|
+
import { createFormHook } from "./AppForm/createFormHook.public.js";
|
|
15
|
+
import { FormHookHelpers, getFormHookHelpers } from "./AppForm/getFormHookHelpers.public.js";
|
|
16
|
+
export * from "@tanstack/form-core";
|
|
17
|
+
export * from "@tanstack/preact-store";
|
|
18
|
+
export { AnyFieldGroupApi, AnyFieldGroupFieldSlot, AnyPreactFormApi, AnyPreactFormComponentMap, AppFormComponent, AppFormHookResult, AppFormOptions, AppFormOptionsApi, CrossVersionPreactNode, DefaultPreactFormComponentMap, DefineFieldGroupFn, FieldGroupApi, FieldGroupArrayFieldComponent, FieldGroupDefinition, FieldGroupFieldBindingForSlot, FieldGroupFieldBindings, FieldGroupFieldBindingsOf, FieldGroupFieldComponent, FieldGroupFieldComponentsOf, FieldGroupFieldData, FieldGroupFieldNameForSlot, FieldGroupFieldNames, FieldGroupFieldSlot, FieldGroupFieldSlotAllows, FieldGroupFieldSlotMode, FieldGroupFieldSlotModeOf, FieldGroupFieldSlotValue, FieldGroupFields, FieldGroupFieldsOf, FieldGroupFieldsPropName, FieldGroupForm, FieldGroupFormState, FieldGroupHelper, FieldGroupSubscribeComponent, FieldGroupSubscribeProps, FieldGroupWithFieldsFn, FormHookHelpers, LooseFieldGroupFieldSlot, PreactAppFormApi, PreactFieldApi, PreactFieldGroup, PreactFormApi, PreactFormArrayFieldComponent, PreactFormComponentMap, PreactFormFieldComponent, PreactFormFieldProps, PreactFormGroupApi, PreactFormGroupArrayFieldComponent, PreactFormGroupComponent, PreactFormGroupFieldComponent, PreactFormGroupProps, PreactFormGroupSubscribeComponent, PreactFormGroupSubscribeProps, PreactFormSubscribeComponent, PreactFormSubscribeProps, PreactFormType, PreactTanStackFormComponents, StrictFieldGroupFieldSlot, Subscribe, SubscribeProps, SubscribeSource, UseAppFormHook, UseFormHook, createFormHook, defineFieldGroup, getFormHookHelpers, useForm };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Subscribe } from "./Subscribe.public.js";
|
|
2
|
+
import { useForm } from "./PreactForm/useForm.public.js";
|
|
3
|
+
import { defineFieldGroup } from "./FieldGroup/withFields.public.js";
|
|
4
|
+
import { createFormHook } from "./AppForm/createFormHook.public.js";
|
|
5
|
+
import { getFormHookHelpers } from "./AppForm/getFormHookHelpers.public.js";
|
|
6
|
+
|
|
7
|
+
export * from "@tanstack/form-core"
|
|
8
|
+
|
|
9
|
+
export * from "@tanstack/preact-store"
|
|
10
|
+
|
|
11
|
+
export { Subscribe, createFormHook, defineFieldGroup, getFormHookHelpers, useForm };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionComponent } from "preact/compat";
|
|
2
|
+
//#region src/preactTypes.public.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Keeps component children compatible across supported Preact versions.
|
|
5
|
+
*/
|
|
6
|
+
type CrossVersionPreactNode = ReturnType<FunctionComponent<{}>>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { CrossVersionPreactNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/preact-form",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.0",
|
|
4
4
|
"description": "Powerful, type-safe forms for Preact.",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,37 +14,36 @@
|
|
|
14
14
|
"type": "github",
|
|
15
15
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
16
|
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"preact",
|
|
19
|
+
"tanstack",
|
|
20
|
+
"form",
|
|
21
|
+
"tanstack-intent"
|
|
22
|
+
],
|
|
17
23
|
"type": "module",
|
|
18
|
-
"types": "dist/
|
|
19
|
-
"main": "dist/cjs/index.cjs",
|
|
20
|
-
"module": "dist/esm/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
21
25
|
"exports": {
|
|
22
|
-
".":
|
|
23
|
-
"import": {
|
|
24
|
-
"types": "./dist/esm/index.d.ts",
|
|
25
|
-
"default": "./dist/esm/index.js"
|
|
26
|
-
},
|
|
27
|
-
"require": {
|
|
28
|
-
"types": "./dist/cjs/index.d.cts",
|
|
29
|
-
"default": "./dist/cjs/index.cjs"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
26
|
+
".": "./dist/index.js",
|
|
32
27
|
"./package.json": "./package.json"
|
|
33
28
|
},
|
|
34
29
|
"sideEffects": false,
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18"
|
|
32
|
+
},
|
|
35
33
|
"files": [
|
|
36
34
|
"dist",
|
|
37
35
|
"src"
|
|
38
36
|
],
|
|
39
37
|
"dependencies": {
|
|
40
|
-
"@tanstack/preact-store": "^0.13.
|
|
41
|
-
"@tanstack/form-core": "
|
|
38
|
+
"@tanstack/preact-store": "^0.13.2",
|
|
39
|
+
"@tanstack/form-core": "2.0.0-alpha.0"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
42
|
+
"@eslint-react/eslint-plugin": "^5.18.3",
|
|
44
43
|
"@preact/preset-vite": "^2.10.2",
|
|
45
44
|
"@testing-library/preact": "^3.2.4",
|
|
46
45
|
"preact": "^10.26.4",
|
|
47
|
-
"
|
|
46
|
+
"zod": "^4.4.3"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
49
|
"preact": ">10.11.0"
|
|
@@ -62,6 +61,6 @@
|
|
|
62
61
|
"test:lib": "vitest",
|
|
63
62
|
"test:lib:dev": "pnpm run test:lib --watch",
|
|
64
63
|
"test:build": "publint --strict",
|
|
65
|
-
"build": "
|
|
64
|
+
"build": "tsdown"
|
|
66
65
|
}
|
|
67
66
|
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import Preact from 'preact/compat'
|
|
2
|
+
|
|
3
|
+
import { InternalFormGroupApi } from '@tanstack/form-core/internals'
|
|
4
|
+
import { attachPreactFormComponents } from '../PreactForm/Components.lib'
|
|
5
|
+
import { useField } from '../PreactForm/useField.lib'
|
|
6
|
+
import { useValueFieldSubscription } from '../PreactForm/fieldSubscriptions.lib'
|
|
7
|
+
import { Subscribe } from '../Subscribe.public'
|
|
8
|
+
import { FieldContext, FormContext } from './contexts.lib'
|
|
9
|
+
import type { AnyInternalFormApi } from '@tanstack/form-core/internals'
|
|
10
|
+
import type { FunctionComponent } from 'preact/compat'
|
|
11
|
+
import type {
|
|
12
|
+
AppFormComponent,
|
|
13
|
+
PreactAppFormApi,
|
|
14
|
+
} from './PreactAppFormApi.public'
|
|
15
|
+
import type { AnyPreactFormComponentMap } from './componentMap.public'
|
|
16
|
+
import type { CrossVersionPreactNode } from '../preactTypes.public'
|
|
17
|
+
import type {
|
|
18
|
+
PreactFormFieldProps,
|
|
19
|
+
PreactFormGroupProps,
|
|
20
|
+
} from '../PreactForm/Components.public'
|
|
21
|
+
import type { InternalPreactFormApi } from '../PreactForm/PreactFormApi.lib'
|
|
22
|
+
|
|
23
|
+
type AnyPreactAppFormApi = PreactAppFormApi<any, any, AnyPreactFormComponentMap>
|
|
24
|
+
|
|
25
|
+
export function attachPreactAppFormComponents(
|
|
26
|
+
form: AnyInternalFormApi,
|
|
27
|
+
formComponents: Record<string, FunctionComponent<any>>,
|
|
28
|
+
fieldComponents: Record<string, FunctionComponent<any>>,
|
|
29
|
+
): AnyPreactAppFormApi {
|
|
30
|
+
const resultForm = attachPreactFormComponents(
|
|
31
|
+
form,
|
|
32
|
+
fieldComponents,
|
|
33
|
+
) as never as AnyPreactAppFormApi
|
|
34
|
+
resultForm.AppForm = createAppForm(form)
|
|
35
|
+
resultForm.Field = createFieldWithContext(
|
|
36
|
+
form,
|
|
37
|
+
fieldComponents,
|
|
38
|
+
) as AnyPreactAppFormApi['Field']
|
|
39
|
+
resultForm.FormGroup = createFormGroupWithContext(
|
|
40
|
+
resultForm as any,
|
|
41
|
+
) as AnyPreactAppFormApi['FormGroup']
|
|
42
|
+
|
|
43
|
+
return Object.assign(resultForm, formComponents)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function createAppForm(form: AnyInternalFormApi): AppFormComponent {
|
|
47
|
+
const AppForm: FunctionComponent<{
|
|
48
|
+
children: Exclude<CrossVersionPreactNode, Promise<any>>
|
|
49
|
+
}> = function AppFormComponent(props) {
|
|
50
|
+
// eslint-disable-next-line @eslint-react/no-context-provider
|
|
51
|
+
return <FormContext.Provider value={form as never} {...props} />
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
AppForm.displayName = 'TanStackForm.AppForm'
|
|
55
|
+
|
|
56
|
+
return AppForm
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type AnyFieldComponent = FunctionComponent<
|
|
60
|
+
PreactFormFieldProps<any, any, any, any, never, any, any, any>
|
|
61
|
+
>
|
|
62
|
+
|
|
63
|
+
function createFieldWithContext(
|
|
64
|
+
form: AnyInternalFormApi,
|
|
65
|
+
fieldComponents: Record<string, FunctionComponent<any>>,
|
|
66
|
+
) {
|
|
67
|
+
const TanStackFormField: AnyFieldComponent = (props) => {
|
|
68
|
+
const fieldApi = useField({ ...props, form }, fieldComponents)
|
|
69
|
+
const field = useValueFieldSubscription(fieldApi)
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
// eslint-disable-next-line @eslint-react/no-context-provider
|
|
73
|
+
<FieldContext.Provider value={field}>
|
|
74
|
+
{props.children(field) as never}
|
|
75
|
+
</FieldContext.Provider>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
TanStackFormField.displayName = 'TanStackForm.Field'
|
|
80
|
+
|
|
81
|
+
return TanStackFormField
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type AnyFormGroupComponent = FunctionComponent<
|
|
85
|
+
PreactFormGroupProps<any, any, any, any, any, any>
|
|
86
|
+
>
|
|
87
|
+
|
|
88
|
+
function createFormGroupWithContext(
|
|
89
|
+
form: InternalPreactFormApi,
|
|
90
|
+
): AnyFormGroupComponent {
|
|
91
|
+
const TanStackFormGroup: AnyFormGroupComponent = (props) => {
|
|
92
|
+
const groupRef =
|
|
93
|
+
Preact.useRef<InternalFormGroupApi<any, any, any, any, any>>(null)
|
|
94
|
+
|
|
95
|
+
if (!groupRef.current) {
|
|
96
|
+
groupRef.current = attachAppFormGroupComponents(
|
|
97
|
+
new InternalFormGroupApi({ ...props, form } as never),
|
|
98
|
+
form,
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
Preact.useEffect(() => groupRef.current?.update({ ...props, form }))
|
|
103
|
+
|
|
104
|
+
Preact.useEffect(() => {
|
|
105
|
+
const group = groupRef.current!
|
|
106
|
+
group.mount()
|
|
107
|
+
return () => group._cleanup()
|
|
108
|
+
}, [])
|
|
109
|
+
|
|
110
|
+
return props.children(groupRef.current as never)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
TanStackFormGroup.displayName = 'TanStackForm.FormGroup'
|
|
114
|
+
|
|
115
|
+
return TanStackFormGroup
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function attachAppFormGroupComponents(
|
|
119
|
+
group: InternalFormGroupApi<any, any, any, any, any>,
|
|
120
|
+
form: InternalPreactFormApi,
|
|
121
|
+
) {
|
|
122
|
+
type GroupWithComponents = InternalFormGroupApi<any, any, any, any, any> & {
|
|
123
|
+
Field: FunctionComponent<any>
|
|
124
|
+
ArrayField: FunctionComponent<any>
|
|
125
|
+
Subscribe: FunctionComponent<any>
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const resultGroup: GroupWithComponents = group as never
|
|
129
|
+
|
|
130
|
+
resultGroup.Field = function Field(props) {
|
|
131
|
+
return (
|
|
132
|
+
<form.Field
|
|
133
|
+
{...(group._getFormFieldOptions(props, (base, overrides) => ({
|
|
134
|
+
...base,
|
|
135
|
+
...overrides,
|
|
136
|
+
})) as any)}
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
resultGroup.Field.displayName = 'TanStackForm.FormGroup.Field'
|
|
141
|
+
|
|
142
|
+
resultGroup.ArrayField = function ArrayField(props) {
|
|
143
|
+
return (
|
|
144
|
+
<form.ArrayField
|
|
145
|
+
{...(group._getFormFieldOptions(props, (base, overrides) => ({
|
|
146
|
+
...base,
|
|
147
|
+
...overrides,
|
|
148
|
+
})) as any)}
|
|
149
|
+
/>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
resultGroup.ArrayField.displayName = 'TanStackForm.FormGroup.ArrayField'
|
|
153
|
+
|
|
154
|
+
resultGroup.Subscribe = (props) => {
|
|
155
|
+
return <Subscribe source={group.atom} {...props} />
|
|
156
|
+
}
|
|
157
|
+
resultGroup.Subscribe.displayName = 'TanStackForm.FormGroup.Subscribe'
|
|
158
|
+
|
|
159
|
+
return resultGroup
|
|
160
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FormErrorTypes } from '@tanstack/form-core'
|
|
2
|
+
import type { PreactFormApi } from '../PreactForm/formApiTypes.public'
|
|
3
|
+
import type { FunctionComponent } from 'preact/compat'
|
|
4
|
+
import type { CrossVersionPreactNode } from '../preactTypes.public'
|
|
5
|
+
import type { AnyPreactFormComponentMap } from './componentMap.public'
|
|
6
|
+
|
|
7
|
+
export type AppFormComponent = FunctionComponent<{
|
|
8
|
+
children: Exclude<CrossVersionPreactNode, Promise<any>>
|
|
9
|
+
}>
|
|
10
|
+
|
|
11
|
+
export type PreactAppFormApi<
|
|
12
|
+
TFormData,
|
|
13
|
+
TFormErrorTypes extends FormErrorTypes,
|
|
14
|
+
TComponents extends AnyPreactFormComponentMap,
|
|
15
|
+
> = PreactFormApi<TFormData, TFormErrorTypes, TComponents> & {
|
|
16
|
+
AppForm: AppFormComponent
|
|
17
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FormOptions,
|
|
3
|
+
FormValidatorData,
|
|
4
|
+
FormValidators,
|
|
5
|
+
InferUnion,
|
|
6
|
+
NullableSchemaData,
|
|
7
|
+
} from '@tanstack/form-core'
|
|
8
|
+
import type { AnyPreactFormComponentMap } from './componentMap.public'
|
|
9
|
+
|
|
10
|
+
declare const componentsSymbol: unique symbol
|
|
11
|
+
|
|
12
|
+
export interface AppFormOptions<
|
|
13
|
+
in out TFormData,
|
|
14
|
+
in out TFormValidators extends FormValidators<TFormData>,
|
|
15
|
+
in out TSubmitReturn,
|
|
16
|
+
out TComponents extends AnyPreactFormComponentMap,
|
|
17
|
+
> extends FormOptions<TFormData, TFormValidators, TSubmitReturn> {
|
|
18
|
+
[componentsSymbol]: TComponents
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AppFormOptionsApi<
|
|
22
|
+
in out TComponents extends AnyPreactFormComponentMap,
|
|
23
|
+
> {
|
|
24
|
+
<
|
|
25
|
+
TFormData,
|
|
26
|
+
const TFormValidators extends FormValidators<TFormData>,
|
|
27
|
+
TSubmitReturn,
|
|
28
|
+
>(
|
|
29
|
+
options: FormOptions<TFormData, TFormValidators, TSubmitReturn>,
|
|
30
|
+
): AppFormOptions<TFormData, TFormValidators, TSubmitReturn, TComponents>
|
|
31
|
+
|
|
32
|
+
strictSchema: <
|
|
33
|
+
const TFormValidators extends FormValidators<any>,
|
|
34
|
+
// Not quite sure why, but using FormValidatorData directly in the generic breaks things.
|
|
35
|
+
// Probably something recursive going on that resolves it to `never`?
|
|
36
|
+
TFormData extends FormValidatorData<TFormValidators>,
|
|
37
|
+
TSubmitReturn,
|
|
38
|
+
>(
|
|
39
|
+
options: FormOptions<TFormData, TFormValidators, TSubmitReturn>,
|
|
40
|
+
) => AppFormOptions<
|
|
41
|
+
FormValidatorData<TFormValidators>,
|
|
42
|
+
TFormValidators,
|
|
43
|
+
TSubmitReturn,
|
|
44
|
+
TComponents
|
|
45
|
+
>
|
|
46
|
+
|
|
47
|
+
looseSchema: <
|
|
48
|
+
const TFormValidators extends FormValidators<any>,
|
|
49
|
+
const TFormData extends NullableSchemaData<TFormValidators>,
|
|
50
|
+
TSubmitReturn,
|
|
51
|
+
>(
|
|
52
|
+
options: FormOptions<TFormData, TFormValidators, TSubmitReturn>,
|
|
53
|
+
) => AppFormOptions<
|
|
54
|
+
InferUnion<TFormData, FormValidatorData<TFormValidators>>,
|
|
55
|
+
TFormValidators,
|
|
56
|
+
TSubmitReturn,
|
|
57
|
+
TComponents
|
|
58
|
+
>
|
|
59
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'preact/compat'
|
|
2
|
+
|
|
3
|
+
export interface PreactFormComponentMap<
|
|
4
|
+
in out TFormComponents extends Record<string, FunctionComponent<any>>,
|
|
5
|
+
in out TFieldComponents extends Record<string, FunctionComponent<any>>,
|
|
6
|
+
> {
|
|
7
|
+
formComponents: TFormComponents
|
|
8
|
+
fieldComponents: TFieldComponents
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type AnyPreactFormComponentMap = PreactFormComponentMap<
|
|
12
|
+
Record<string, FunctionComponent<any>>,
|
|
13
|
+
Record<string, FunctionComponent<any>>
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
export type DefaultPreactFormComponentMap = PreactFormComponentMap<
|
|
17
|
+
Record<never, never>,
|
|
18
|
+
Record<never, never>
|
|
19
|
+
>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createContext, useContext } from 'preact/compat'
|
|
2
|
+
import type { AnyInternalFieldApi } from '@tanstack/form-core/internals'
|
|
3
|
+
import type { InternalPreactFormApi } from '../PreactForm/PreactFormApi.lib'
|
|
4
|
+
|
|
5
|
+
export const FormContext = createContext<InternalPreactFormApi | null>(null)
|
|
6
|
+
export const FieldContext = createContext<AnyInternalFieldApi | null>(null)
|
|
7
|
+
|
|
8
|
+
export function useFieldContext(): AnyInternalFieldApi {
|
|
9
|
+
const field = useContext(FieldContext)
|
|
10
|
+
if (field === null) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
'TanStack Form: Field components must be used within a `form.Field` component.',
|
|
13
|
+
)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return field
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function useFormContext(): InternalPreactFormApi {
|
|
20
|
+
const form = useContext(FormContext)
|
|
21
|
+
if (form === null) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
'TanStack Form: Form components must be used within a `form.AppForm` component.',
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return form
|
|
28
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useInternalForm } from '../PreactForm/PreactFormApi.lib'
|
|
2
|
+
import { defineFieldGroup } from '../FieldGroup/withFields.public'
|
|
3
|
+
import { createAppFormInitializer } from './initializeAppForm.lib'
|
|
4
|
+
import { useFormContext } from './contexts.lib'
|
|
5
|
+
import type { AppFormOptionsApi } from './appFormOptions.public'
|
|
6
|
+
import type { AnyPreactFormComponentMap } from './componentMap.public'
|
|
7
|
+
import type {
|
|
8
|
+
AppFormHookResult,
|
|
9
|
+
UseAppFormHook,
|
|
10
|
+
} from './createFormHookTypes.public'
|
|
11
|
+
import type { FormOptions } from '@tanstack/form-core'
|
|
12
|
+
|
|
13
|
+
const appFormOptions = ((opts) => {
|
|
14
|
+
return opts
|
|
15
|
+
}) as AppFormOptionsApi<any>
|
|
16
|
+
|
|
17
|
+
appFormOptions.strictSchema = (opts) => opts as never
|
|
18
|
+
appFormOptions.looseSchema = (opts) => opts as never
|
|
19
|
+
|
|
20
|
+
export function createFormHook<
|
|
21
|
+
const TComponents extends AnyPreactFormComponentMap,
|
|
22
|
+
>(createOptions: TComponents): AppFormHookResult<TComponents> {
|
|
23
|
+
const initializeAppForm = createAppFormInitializer(createOptions)
|
|
24
|
+
|
|
25
|
+
function useExtendedForm(hookOptions: FormOptions<any, any, any>) {
|
|
26
|
+
const form = useInternalForm(hookOptions, initializeAppForm)
|
|
27
|
+
return form
|
|
28
|
+
}
|
|
29
|
+
const useAppForm = useExtendedForm as never as UseAppFormHook<TComponents>
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
useFormContext: useFormContext as never,
|
|
33
|
+
appFormOptions,
|
|
34
|
+
defineAppFieldGroup: defineFieldGroup,
|
|
35
|
+
useAppForm,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AppFormOptionsApi } from './appFormOptions.public'
|
|
2
|
+
import type { AnyPreactFormComponentMap } from './componentMap.public'
|
|
3
|
+
import type { PreactAppFormApi } from './PreactAppFormApi.public'
|
|
4
|
+
import type { DefineFieldGroupFn } from '../FieldGroup/withFields.public'
|
|
5
|
+
import type {
|
|
6
|
+
FormOptions,
|
|
7
|
+
FormValidators,
|
|
8
|
+
ToFormErrorTypes,
|
|
9
|
+
} from '@tanstack/form-core'
|
|
10
|
+
|
|
11
|
+
export type UseAppFormHook<
|
|
12
|
+
in out TComponents extends AnyPreactFormComponentMap,
|
|
13
|
+
> = <
|
|
14
|
+
TFormData,
|
|
15
|
+
TFormValidators extends FormValidators<TFormData>,
|
|
16
|
+
TSubmitReturn,
|
|
17
|
+
>(
|
|
18
|
+
options: FormOptions<TFormData, TFormValidators, TSubmitReturn>,
|
|
19
|
+
) => PreactAppFormApi<
|
|
20
|
+
TFormData,
|
|
21
|
+
ToFormErrorTypes<TFormValidators, TSubmitReturn>,
|
|
22
|
+
TComponents
|
|
23
|
+
>
|
|
24
|
+
|
|
25
|
+
export interface AppFormHookResult<
|
|
26
|
+
in out TComponents extends AnyPreactFormComponentMap,
|
|
27
|
+
> {
|
|
28
|
+
appFormOptions: AppFormOptionsApi<TComponents>
|
|
29
|
+
defineAppFieldGroup: DefineFieldGroupFn<TComponents['fieldComponents']>
|
|
30
|
+
useAppForm: UseAppFormHook<TComponents>
|
|
31
|
+
useFormContext: () => PreactAppFormApi<any, any, TComponents>
|
|
32
|
+
}
|