@formisch/svelte 0.7.5 → 0.8.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/README.md +7 -1
- package/dist/components/Field/Field.svelte +7 -3
- package/dist/components/Field/Field.svelte.d.ts +7 -7
- package/dist/components/FieldArray/FieldArray.svelte +3 -3
- package/dist/components/FieldArray/FieldArray.svelte.d.ts +7 -7
- package/dist/components/Form/Form.svelte +3 -3
- package/dist/components/Form/Form.svelte.d.ts +7 -7
- package/dist/core/index.svelte.d.ts +134 -27
- package/dist/core/index.svelte.js +66 -27
- package/dist/index.d.ts +1 -1
- package/dist/methods/index.svelte.d.ts +144 -32
- package/dist/methods/index.svelte.js +65 -3
- package/dist/runes/createForm/createForm.svelte.d.ts +2 -2
- package/dist/runes/useField/useField.svelte.d.ts +3 -3
- package/dist/runes/useFieldArray/useFieldArray.svelte.d.ts +3 -3
- package/dist/types/field.d.ts +3 -3
- package/dist/types/form.d.ts +2 -2
- package/package.json +14 -6
package/README.md
CHANGED
|
@@ -59,7 +59,13 @@ In addition, Formisch offers several functions (we call them "methods") that can
|
|
|
59
59
|
|
|
60
60
|
## Comparison
|
|
61
61
|
|
|
62
|
-
What makes Formisch unique is its framework-agnostic core, which is fully native to the framework you are using. It works by inserting framework-specific reactivity blocks when the core package is built
|
|
62
|
+
What makes Formisch unique is its framework-agnostic core, which is fully native to the framework you are using. It works by inserting framework-specific reactivity blocks when the core package is built, giving you native performance for any UI update. A modular methods API keeps bundles starting at just ~2.5 kB by only including the methods you import, and end-to-end type safety covers deeply nested paths and field arrays with TypeScript inference that stays fast even as forms grow.
|
|
63
|
+
|
|
64
|
+
For a side-by-side look at how Formisch compares to Superforms and TanStack Form, see the [comparison guide](https://formisch.dev/svelte/guides/comparison/).
|
|
65
|
+
|
|
66
|
+
## Vision
|
|
67
|
+
|
|
68
|
+
My vision for Formisch is to create a framework-agnostic platform similar to [Vite](https://vite.dev/), but for forms — a shared core that lets the same mental model and codebase work natively across every modern UI framework.
|
|
63
69
|
|
|
64
70
|
## Partners
|
|
65
71
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
<script
|
|
2
2
|
lang="ts"
|
|
3
|
-
generics="TSchema extends
|
|
3
|
+
generics="TSchema extends FormSchema, TFieldPath extends RequiredPath"
|
|
4
4
|
>
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
RequiredPath,
|
|
7
|
+
FormSchema,
|
|
8
|
+
ValidPath,
|
|
9
|
+
} from '../../core/index.svelte';
|
|
6
10
|
import type * as v from 'valibot';
|
|
7
11
|
import { useField } from '../../runes/index';
|
|
8
12
|
import type { FieldStore, FormStore } from '../../types/index';
|
|
@@ -12,7 +16,7 @@
|
|
|
12
16
|
* Field component props interface.
|
|
13
17
|
*/
|
|
14
18
|
export interface FieldProps<
|
|
15
|
-
TSchema extends
|
|
19
|
+
TSchema extends FormSchema = FormSchema,
|
|
16
20
|
TFieldPath extends RequiredPath = RequiredPath,
|
|
17
21
|
> {
|
|
18
22
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { RequiredPath,
|
|
1
|
+
import type { RequiredPath, FormSchema, ValidPath } from '../../core/index.svelte';
|
|
2
2
|
import type * as v from 'valibot';
|
|
3
3
|
import type { FieldStore, FormStore } from '../../types/index';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
/**
|
|
6
6
|
* Field component props interface.
|
|
7
7
|
*/
|
|
8
|
-
export interface FieldProps<TSchema extends
|
|
8
|
+
export interface FieldProps<TSchema extends FormSchema = FormSchema, TFieldPath extends RequiredPath = RequiredPath> {
|
|
9
9
|
/**
|
|
10
10
|
* The form store to which the field belongs.
|
|
11
11
|
*/
|
|
@@ -19,14 +19,14 @@ export interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends
|
|
|
19
19
|
*/
|
|
20
20
|
readonly children: Snippet<[FieldStore<TSchema, TFieldPath>]>;
|
|
21
21
|
}
|
|
22
|
-
declare function $$render<TSchema extends
|
|
22
|
+
declare function $$render<TSchema extends FormSchema, TFieldPath extends RequiredPath>(): {
|
|
23
23
|
props: FieldProps<TSchema, TFieldPath>;
|
|
24
24
|
exports: {};
|
|
25
25
|
bindings: "";
|
|
26
26
|
slots: {};
|
|
27
27
|
events: {};
|
|
28
28
|
};
|
|
29
|
-
declare class __sveltets_Render<TSchema extends
|
|
29
|
+
declare class __sveltets_Render<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
30
30
|
props(): ReturnType<typeof $$render<TSchema, TFieldPath>>['props'];
|
|
31
31
|
events(): ReturnType<typeof $$render<TSchema, TFieldPath>>['events'];
|
|
32
32
|
slots(): ReturnType<typeof $$render<TSchema, TFieldPath>>['slots'];
|
|
@@ -34,12 +34,12 @@ declare class __sveltets_Render<TSchema extends Schema, TFieldPath extends Requi
|
|
|
34
34
|
exports(): {};
|
|
35
35
|
}
|
|
36
36
|
interface $$IsomorphicComponent {
|
|
37
|
-
new <TSchema extends
|
|
37
|
+
new <TSchema extends FormSchema, TFieldPath extends RequiredPath>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TSchema, TFieldPath>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TSchema, TFieldPath>['props']>, ReturnType<__sveltets_Render<TSchema, TFieldPath>['events']>, ReturnType<__sveltets_Render<TSchema, TFieldPath>['slots']>> & {
|
|
38
38
|
$$bindings?: ReturnType<__sveltets_Render<TSchema, TFieldPath>['bindings']>;
|
|
39
39
|
} & ReturnType<__sveltets_Render<TSchema, TFieldPath>['exports']>;
|
|
40
|
-
<TSchema extends
|
|
40
|
+
<TSchema extends FormSchema, TFieldPath extends RequiredPath>(internal: unknown, props: ReturnType<__sveltets_Render<TSchema, TFieldPath>['props']> & {}): ReturnType<__sveltets_Render<TSchema, TFieldPath>['exports']>;
|
|
41
41
|
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
42
42
|
}
|
|
43
43
|
declare const Field: $$IsomorphicComponent;
|
|
44
|
-
type Field<TSchema extends
|
|
44
|
+
type Field<TSchema extends FormSchema, TFieldPath extends RequiredPath> = InstanceType<typeof Field<TSchema, TFieldPath>>;
|
|
45
45
|
export default Field;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script
|
|
2
2
|
lang="ts"
|
|
3
|
-
generics="TSchema extends
|
|
3
|
+
generics="TSchema extends FormSchema, TFieldArrayPath extends RequiredPath"
|
|
4
4
|
>
|
|
5
5
|
import type {
|
|
6
6
|
RequiredPath,
|
|
7
|
-
|
|
7
|
+
FormSchema,
|
|
8
8
|
ValidArrayPath,
|
|
9
9
|
} from '../../core/index.svelte';
|
|
10
10
|
import type * as v from 'valibot';
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Field array component props interface.
|
|
17
17
|
*/
|
|
18
18
|
export interface FieldArrayProps<
|
|
19
|
-
TSchema extends
|
|
19
|
+
TSchema extends FormSchema = FormSchema,
|
|
20
20
|
TFieldArrayPath extends RequiredPath = RequiredPath,
|
|
21
21
|
> {
|
|
22
22
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { RequiredPath,
|
|
1
|
+
import type { RequiredPath, FormSchema, ValidArrayPath } from '../../core/index.svelte';
|
|
2
2
|
import type * as v from 'valibot';
|
|
3
3
|
import type { FieldArrayStore, FormStore } from '../../types/index';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
/**
|
|
6
6
|
* Field array component props interface.
|
|
7
7
|
*/
|
|
8
|
-
export interface FieldArrayProps<TSchema extends
|
|
8
|
+
export interface FieldArrayProps<TSchema extends FormSchema = FormSchema, TFieldArrayPath extends RequiredPath = RequiredPath> {
|
|
9
9
|
/**
|
|
10
10
|
* The form store to which the field array belongs.
|
|
11
11
|
*/
|
|
@@ -19,14 +19,14 @@ export interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPat
|
|
|
19
19
|
*/
|
|
20
20
|
readonly children: Snippet<[FieldArrayStore<TSchema, TFieldArrayPath>]>;
|
|
21
21
|
}
|
|
22
|
-
declare function $$render<TSchema extends
|
|
22
|
+
declare function $$render<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(): {
|
|
23
23
|
props: FieldArrayProps<TSchema, TFieldArrayPath>;
|
|
24
24
|
exports: {};
|
|
25
25
|
bindings: "";
|
|
26
26
|
slots: {};
|
|
27
27
|
events: {};
|
|
28
28
|
};
|
|
29
|
-
declare class __sveltets_Render<TSchema extends
|
|
29
|
+
declare class __sveltets_Render<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
|
|
30
30
|
props(): ReturnType<typeof $$render<TSchema, TFieldArrayPath>>['props'];
|
|
31
31
|
events(): ReturnType<typeof $$render<TSchema, TFieldArrayPath>>['events'];
|
|
32
32
|
slots(): ReturnType<typeof $$render<TSchema, TFieldArrayPath>>['slots'];
|
|
@@ -34,12 +34,12 @@ declare class __sveltets_Render<TSchema extends Schema, TFieldArrayPath extends
|
|
|
34
34
|
exports(): {};
|
|
35
35
|
}
|
|
36
36
|
interface $$IsomorphicComponent {
|
|
37
|
-
new <TSchema extends
|
|
37
|
+
new <TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['props']>, ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['events']>, ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['slots']>> & {
|
|
38
38
|
$$bindings?: ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['bindings']>;
|
|
39
39
|
} & ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['exports']>;
|
|
40
|
-
<TSchema extends
|
|
40
|
+
<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(internal: unknown, props: ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['props']> & {}): ReturnType<__sveltets_Render<TSchema, TFieldArrayPath>['exports']>;
|
|
41
41
|
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
42
42
|
}
|
|
43
43
|
declare const FieldArray: $$IsomorphicComponent;
|
|
44
|
-
type FieldArray<TSchema extends
|
|
44
|
+
type FieldArray<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> = InstanceType<typeof FieldArray<TSchema, TFieldArrayPath>>;
|
|
45
45
|
export default FieldArray;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
<script lang="ts" generics="TSchema extends
|
|
1
|
+
<script lang="ts" generics="TSchema extends FormSchema = FormSchema">
|
|
2
2
|
import {
|
|
3
3
|
INTERNAL,
|
|
4
|
-
type
|
|
4
|
+
type FormSchema,
|
|
5
5
|
type SubmitEventHandler,
|
|
6
6
|
} from '../../core/index.svelte';
|
|
7
7
|
import { handleSubmit } from '../../methods/index.svelte';
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/**
|
|
13
13
|
* Form component props type.
|
|
14
14
|
*/
|
|
15
|
-
export type FormProps<TSchema extends
|
|
15
|
+
export type FormProps<TSchema extends FormSchema = FormSchema> = Omit<
|
|
16
16
|
HTMLFormAttributes,
|
|
17
17
|
'on:submit' | 'onsubmit' | 'novalidate'
|
|
18
18
|
> & {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FormSchema, type SubmitEventHandler } from '../../core/index.svelte';
|
|
2
2
|
import type { FormStore } from '../../types/index';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
5
5
|
/**
|
|
6
6
|
* Form component props type.
|
|
7
7
|
*/
|
|
8
|
-
export type FormProps<TSchema extends
|
|
8
|
+
export type FormProps<TSchema extends FormSchema = FormSchema> = Omit<HTMLFormAttributes, 'on:submit' | 'onsubmit' | 'novalidate'> & {
|
|
9
9
|
/**
|
|
10
10
|
* The form store instance.
|
|
11
11
|
*/
|
|
@@ -19,14 +19,14 @@ export type FormProps<TSchema extends Schema = Schema> = Omit<HTMLFormAttributes
|
|
|
19
19
|
*/
|
|
20
20
|
children: Snippet;
|
|
21
21
|
};
|
|
22
|
-
declare function $$render<TSchema extends
|
|
22
|
+
declare function $$render<TSchema extends FormSchema = FormSchema>(): {
|
|
23
23
|
props: FormProps<TSchema>;
|
|
24
24
|
exports: {};
|
|
25
25
|
bindings: "";
|
|
26
26
|
slots: {};
|
|
27
27
|
events: {};
|
|
28
28
|
};
|
|
29
|
-
declare class __sveltets_Render<TSchema extends
|
|
29
|
+
declare class __sveltets_Render<TSchema extends FormSchema = FormSchema> {
|
|
30
30
|
props(): ReturnType<typeof $$render<TSchema>>['props'];
|
|
31
31
|
events(): ReturnType<typeof $$render<TSchema>>['events'];
|
|
32
32
|
slots(): ReturnType<typeof $$render<TSchema>>['slots'];
|
|
@@ -34,12 +34,12 @@ declare class __sveltets_Render<TSchema extends Schema = Schema> {
|
|
|
34
34
|
exports(): {};
|
|
35
35
|
}
|
|
36
36
|
interface $$IsomorphicComponent {
|
|
37
|
-
new <TSchema extends
|
|
37
|
+
new <TSchema extends FormSchema = FormSchema>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TSchema>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TSchema>['props']>, ReturnType<__sveltets_Render<TSchema>['events']>, ReturnType<__sveltets_Render<TSchema>['slots']>> & {
|
|
38
38
|
$$bindings?: ReturnType<__sveltets_Render<TSchema>['bindings']>;
|
|
39
39
|
} & ReturnType<__sveltets_Render<TSchema>['exports']>;
|
|
40
|
-
<TSchema extends
|
|
40
|
+
<TSchema extends FormSchema = FormSchema>(internal: unknown, props: ReturnType<__sveltets_Render<TSchema>['props']> & {}): ReturnType<__sveltets_Render<TSchema>['exports']>;
|
|
41
41
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
42
42
|
}
|
|
43
43
|
declare const Form: $$IsomorphicComponent;
|
|
44
|
-
type Form<TSchema extends
|
|
44
|
+
type Form<TSchema extends FormSchema = FormSchema> = InstanceType<typeof Form<TSchema>>;
|
|
45
45
|
export default Form;
|
|
@@ -1,13 +1,38 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { untrack } from "svelte";
|
|
3
3
|
|
|
4
|
-
//#region src/types/schema.d.ts
|
|
4
|
+
//#region src/types/schema/schema.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Schema type.
|
|
7
7
|
*/
|
|
8
8
|
type Schema = v.GenericSchema | v.GenericSchemaAsync;
|
|
9
|
+
/**
|
|
10
|
+
* Object schema type.
|
|
11
|
+
*/
|
|
12
|
+
type ObjectSchema = v.LooseObjectSchema<v.ObjectEntries, v.ErrorMessage<v.LooseObjectIssue> | undefined> | v.ObjectSchema<v.ObjectEntries, v.ErrorMessage<v.ObjectIssue> | undefined> | v.StrictObjectSchema<v.ObjectEntries, v.ErrorMessage<v.StrictObjectIssue> | undefined> | v.VariantSchema<string, v.VariantOptions<string>, v.ErrorMessage<v.VariantIssue> | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Object schema async type.
|
|
15
|
+
*/
|
|
16
|
+
type ObjectSchemaAsync = v.LooseObjectSchemaAsync<v.ObjectEntriesAsync, v.ErrorMessage<v.LooseObjectIssue> | undefined> | v.ObjectSchemaAsync<v.ObjectEntriesAsync, v.ErrorMessage<v.ObjectIssue> | undefined> | v.StrictObjectSchemaAsync<v.ObjectEntriesAsync, v.ErrorMessage<v.StrictObjectIssue> | undefined> | v.VariantSchemaAsync<string, v.VariantOptionsAsync<string>, v.ErrorMessage<v.VariantIssue> | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Object root schema type.
|
|
19
|
+
*/
|
|
20
|
+
type ObjectRootSchema = ObjectSchema | v.IntersectSchema<ObjectSchema[], v.ErrorMessage<v.IntersectIssue> | undefined> | v.UnionSchema<ObjectSchema[], v.ErrorMessage<v.UnionIssue<v.BaseIssue<unknown>>> | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* Object root schema async type.
|
|
23
|
+
*/
|
|
24
|
+
type ObjectRootSchemaAsync = ObjectSchemaAsync | v.IntersectSchemaAsync<(ObjectSchema | ObjectSchemaAsync)[], v.ErrorMessage<v.IntersectIssue> | undefined> | v.UnionSchemaAsync<(ObjectSchema | ObjectSchemaAsync)[], v.ErrorMessage<v.UnionIssue<v.BaseIssue<unknown>>> | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Form schema type.
|
|
27
|
+
*
|
|
28
|
+
* Hint: Forms must have an object root, so only object schemas (sync or async),
|
|
29
|
+
* combinators (intersect, union, variant) whose options resolve to objects, and
|
|
30
|
+
* `lazy` schemas wrapping any of these are allowed at the top level. Use
|
|
31
|
+
* {@link Schema} for nested field schemas.
|
|
32
|
+
*/
|
|
33
|
+
type FormSchema = ObjectRootSchema | ObjectRootSchemaAsync | v.LazySchema<ObjectRootSchema> | v.LazySchemaAsync<ObjectRootSchema | ObjectRootSchemaAsync>;
|
|
9
34
|
//#endregion
|
|
10
|
-
//#region src/types/signal.d.ts
|
|
35
|
+
//#region src/types/signal/signal.d.ts
|
|
11
36
|
/**
|
|
12
37
|
* Signal interface.
|
|
13
38
|
*/
|
|
@@ -30,7 +55,7 @@ interface Untrack {
|
|
|
30
55
|
<T>(fn: () => T): T;
|
|
31
56
|
}
|
|
32
57
|
//#endregion
|
|
33
|
-
//#region src/types/field.d.ts
|
|
58
|
+
//#region src/types/field/field.d.ts
|
|
34
59
|
/**
|
|
35
60
|
* Field element type.
|
|
36
61
|
*/
|
|
@@ -196,7 +221,7 @@ type InternalFieldStore = InternalArrayStore | InternalObjectStore | InternalVal
|
|
|
196
221
|
*/
|
|
197
222
|
declare const INTERNAL: "~internal";
|
|
198
223
|
//#endregion
|
|
199
|
-
//#region src/types/utils.d.ts
|
|
224
|
+
//#region src/types/utils/utils.d.ts
|
|
200
225
|
/**
|
|
201
226
|
* Checks if a type is `any`.
|
|
202
227
|
*/
|
|
@@ -222,7 +247,7 @@ type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonl
|
|
|
222
247
|
*/
|
|
223
248
|
type PartialValues<TValue> = TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? (TItem extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TItem]: PartialValues<TItem[TKey]> } : TItem)[] : { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue | undefined;
|
|
224
249
|
//#endregion
|
|
225
|
-
//#region src/types/form.d.ts
|
|
250
|
+
//#region src/types/form/form.d.ts
|
|
226
251
|
/**
|
|
227
252
|
* Validation mode type.
|
|
228
253
|
*/
|
|
@@ -230,7 +255,7 @@ type ValidationMode = "initial" | "touch" | "input" | "change" | "blur" | "submi
|
|
|
230
255
|
/**
|
|
231
256
|
* Form config interface.
|
|
232
257
|
*/
|
|
233
|
-
interface FormConfig<TSchema extends
|
|
258
|
+
interface FormConfig<TSchema extends FormSchema = FormSchema> {
|
|
234
259
|
/**
|
|
235
260
|
* The schema of the form.
|
|
236
261
|
*/
|
|
@@ -251,7 +276,7 @@ interface FormConfig<TSchema extends Schema = Schema> {
|
|
|
251
276
|
/**
|
|
252
277
|
* Internal form store interface.
|
|
253
278
|
*/
|
|
254
|
-
interface InternalFormStore<TSchema extends
|
|
279
|
+
interface InternalFormStore<TSchema extends FormSchema = FormSchema> extends InternalObjectStore {
|
|
255
280
|
/**
|
|
256
281
|
* The element of the form.
|
|
257
282
|
*/
|
|
@@ -288,7 +313,7 @@ interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObj
|
|
|
288
313
|
/**
|
|
289
314
|
* Base form store interface.
|
|
290
315
|
*/
|
|
291
|
-
interface BaseFormStore<TSchema extends
|
|
316
|
+
interface BaseFormStore<TSchema extends FormSchema = FormSchema> {
|
|
292
317
|
/**
|
|
293
318
|
* The internal form store.
|
|
294
319
|
*
|
|
@@ -299,13 +324,13 @@ interface BaseFormStore<TSchema extends Schema = Schema> {
|
|
|
299
324
|
/**
|
|
300
325
|
* Submit handler type.
|
|
301
326
|
*/
|
|
302
|
-
type SubmitHandler<TSchema extends
|
|
327
|
+
type SubmitHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>) => MaybePromise<unknown>;
|
|
303
328
|
/**
|
|
304
329
|
* Submit event handler type.
|
|
305
330
|
*/
|
|
306
|
-
type SubmitEventHandler<TSchema extends
|
|
331
|
+
type SubmitEventHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>, event: SubmitEvent) => MaybePromise<unknown>;
|
|
307
332
|
//#endregion
|
|
308
|
-
//#region src/types/path.d.ts
|
|
333
|
+
//#region src/types/path/path.d.ts
|
|
309
334
|
/**
|
|
310
335
|
* Path key type.
|
|
311
336
|
*/
|
|
@@ -319,47 +344,115 @@ type Path = readonly PathKey[];
|
|
|
319
344
|
*/
|
|
320
345
|
type RequiredPath = readonly [PathKey, ...Path];
|
|
321
346
|
/**
|
|
322
|
-
* Extracts the exact keys of a tuple, array or object.
|
|
347
|
+
* Extracts the exact keys of a tuple, array or object. Tuples return their
|
|
348
|
+
* literal numeric indices, dynamic arrays return `number`, objects return
|
|
349
|
+
* their `keyof` keys, and any other input returns `never`.
|
|
323
350
|
*/
|
|
324
|
-
type
|
|
351
|
+
type ExactKeysOf<TValue> = IsAny<TValue> extends true ? never : TValue extends readonly unknown[] ? number extends TValue["length"] ? number : { [TKey in keyof TValue]: TKey extends `${infer TIndex extends number}` ? TIndex : never }[number] : TValue extends Record<PropertyKey, unknown> ? keyof TValue & PathKey : never;
|
|
325
352
|
/**
|
|
326
|
-
*
|
|
353
|
+
* Returns the flat object of all indexable properties of `TValue`. For object
|
|
354
|
+
* unions, properties from every member are merged so that any single property
|
|
355
|
+
* is accessible. For primitives and other non-indexable types, the result is
|
|
356
|
+
* `{}`.
|
|
327
357
|
*
|
|
328
|
-
* Hint: This is necessary to make
|
|
329
|
-
* properties that do not exist in all union options are not
|
|
330
|
-
* and result in "any" when accessed.
|
|
358
|
+
* Hint: This is necessary to make properties accessible across union members.
|
|
359
|
+
* By default, properties that do not exist in all union options are not
|
|
360
|
+
* accessible and result in "any" when accessed.
|
|
331
361
|
*/
|
|
332
|
-
type
|
|
362
|
+
type PropertiesOf<TValue> = { [TKey in ExactKeysOf<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
333
363
|
/**
|
|
334
364
|
* Lazily evaluates only the first valid path segment based on the given value.
|
|
335
365
|
*/
|
|
336
|
-
type LazyPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValidPath : TPathToCheck extends readonly [infer TFirstKey extends
|
|
366
|
+
type LazyPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValidPath : TPathToCheck extends readonly [infer TFirstKey extends ExactKeysOf<TValue>, ...infer TPathRest extends Path] ? LazyPath<Required<PropertiesOf<TValue>[TFirstKey]>, TPathRest, readonly [...TValidPath, TFirstKey]> : IsNever<ExactKeysOf<TValue>> extends false ? readonly [...TValidPath, ExactKeysOf<TValue>] : TValidPath;
|
|
337
367
|
/**
|
|
338
368
|
* Returns the path if valid, otherwise the first possible valid path based on
|
|
339
369
|
* the given value.
|
|
340
370
|
*/
|
|
341
371
|
type ValidPath<TValue, TPath extends RequiredPath> = TPath extends LazyPath<Required<TValue>, TPath> ? TPath : LazyPath<Required<TValue>, TPath>;
|
|
342
372
|
/**
|
|
373
|
+
* Detects whether the consuming project is configured with
|
|
374
|
+
* `exactOptionalPropertyTypes: true`.
|
|
375
|
+
*
|
|
376
|
+
* Hint: If `false` the built-in `Required<T>` strips `| undefined` from
|
|
377
|
+
* optional properties, so `Required<{ key?: undefined }>['key']` collapses
|
|
378
|
+
* to `never` — under strict mode the same expression yields `undefined`.
|
|
379
|
+
*/
|
|
380
|
+
type IsExactOptionalProps = Required<{
|
|
381
|
+
key?: undefined;
|
|
382
|
+
}>["key"] extends never ? false : true;
|
|
383
|
+
/**
|
|
384
|
+
* Like the built-in `Required<T>`, but preserves `| undefined` in two
|
|
385
|
+
* places where `Required<T>` strips it:
|
|
386
|
+
*
|
|
387
|
+
* 1. Optional property values under `exactOptionalPropertyTypes: false`
|
|
388
|
+
* — without this, input typings for `v.optional`/`v.nullish` schemas
|
|
389
|
+
* narrow incorrectly (issue #15).
|
|
390
|
+
* 2. Array/tuple element types — e.g. `(string | undefined)[]` stays
|
|
391
|
+
* `(string | undefined)[]` instead of becoming `string[]`. Arrays
|
|
392
|
+
* fall through unchanged because they only have a numeric index
|
|
393
|
+
* signature and don't structurally extend `Record<PropertyKey,
|
|
394
|
+
* unknown>` (which requires string keys).
|
|
395
|
+
*/
|
|
396
|
+
type ExactRequired<TValue> = TValue extends Record<PropertyKey, unknown> ? IsExactOptionalProps extends true ? Required<TValue> : { [TKey in keyof Required<TValue>]: TValue[TKey] } : TValue;
|
|
397
|
+
/**
|
|
343
398
|
* Extracts the value type at the given path.
|
|
344
399
|
*/
|
|
345
|
-
type PathValue<TValue, TPath extends Path> = TPath extends readonly [infer TKey, ...infer TRest extends Path] ? TKey extends
|
|
400
|
+
type PathValue<TValue, TPath extends Path> = TPath extends readonly [infer TKey, ...infer TRest extends Path] ? TKey extends ExactKeysOf<ExactRequired<TValue>> ? PathValue<PropertiesOf<ExactRequired<TValue>>[TKey], TRest> : unknown : TValue;
|
|
346
401
|
/**
|
|
347
|
-
* Checks
|
|
402
|
+
* Checks whether a value is an array or contains one anywhere in its shape.
|
|
403
|
+
*
|
|
404
|
+
* Hint: The inner conditionals (`TValue extends readonly unknown[]` and
|
|
405
|
+
* `TValue extends Record<PropertyKey, unknown>`) distribute over union members,
|
|
406
|
+
* so the inner expression returns the union of each member's result (e.g.
|
|
407
|
+
* `true | false` when some members contain arrays and others don't).
|
|
408
|
+
* Downstream code uses `IsOrHasArray<T> extends true`, but
|
|
409
|
+
* `boolean extends true` is `false` — so we collapse the result via
|
|
410
|
+
* `true extends ...`, which is `true` whenever at least one union member
|
|
411
|
+
* contributed `true`.
|
|
348
412
|
*/
|
|
349
|
-
type IsOrHasArray<TValue> = IsAny<TValue> extends true ? false : TValue extends readonly unknown[] ? true : TValue extends Record<
|
|
413
|
+
type IsOrHasArray<TValue> = true extends (IsAny<TValue> extends true ? false : TValue extends readonly unknown[] ? true : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: IsOrHasArray<TValue[TKey]> }[keyof TValue] : false) ? true : false;
|
|
350
414
|
/**
|
|
351
415
|
* Extracts the exact keys of a tuple, array or object that contain arrays.
|
|
352
416
|
*/
|
|
353
|
-
type
|
|
417
|
+
type ExactKeysOfArrayPath<TValue> = IsAny<TValue> extends true ? never : TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? IsOrHasArray<TItem> extends true ? number : never : { [TKey in keyof TValue]: TKey extends `${infer TIndex extends number}` ? IsOrHasArray<NonNullable<TValue[TKey]>> extends true ? TIndex : never : never }[number] : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: IsOrHasArray<NonNullable<TValue[TKey]>> extends true ? TKey : never }[keyof TValue] & PathKey : never;
|
|
418
|
+
/**
|
|
419
|
+
* Returns the flat object of indexable properties of `TValue` whose values
|
|
420
|
+
* are or contain arrays. Mirrors `PropertiesOf` but keyed by
|
|
421
|
+
* `ExactKeysOfArrayPath` so the lookup is provably valid for array-path
|
|
422
|
+
* navigation in `LazyArrayPath`.
|
|
423
|
+
*/
|
|
424
|
+
type PropertiesOfArrayPath<TValue> = { [TKey in ExactKeysOfArrayPath<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
354
425
|
/**
|
|
355
426
|
* Lazily evaluates only the first valid array path segment based on the given value.
|
|
356
427
|
*/
|
|
357
|
-
type LazyArrayPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValue extends readonly unknown[] ? TValidPath : readonly [...TValidPath,
|
|
428
|
+
type LazyArrayPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValue extends readonly unknown[] ? TValidPath : readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : TPathToCheck extends readonly [infer TFirstKey extends ExactKeysOfArrayPath<TValue>, ...infer TPathRest extends Path] ? LazyArrayPath<Required<PropertiesOfArrayPath<TValue>[TFirstKey]>, TPathRest, readonly [...TValidPath, TFirstKey]> : IsNever<ExactKeysOfArrayPath<TValue>> extends false ? readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : never;
|
|
358
429
|
/**
|
|
359
430
|
* Returns the path if valid, otherwise the first possible valid array path
|
|
360
431
|
* based on the given value.
|
|
361
432
|
*/
|
|
362
433
|
type ValidArrayPath<TValue, TPath extends RequiredPath> = TPath extends LazyArrayPath<Required<TValue>, TPath> ? TPath : LazyArrayPath<Required<TValue>, TPath>;
|
|
434
|
+
/**
|
|
435
|
+
* Recursive helper for `DirtyPath` that prepends `TKey` to each deeper path,
|
|
436
|
+
* or falls through to `never` when the child is not an object.
|
|
437
|
+
*/
|
|
438
|
+
type DeepDirtyPath<TChild, TKey$1 extends PathKey, TDepth extends 0[]> = TChild extends Record<PropertyKey, unknown> ? readonly [TKey$1, ...DirtyPath<TChild, [...TDepth, 0]>] : never;
|
|
439
|
+
/**
|
|
440
|
+
* Returns the union of all `RequiredPath`s that `getDirtyPaths` can emit
|
|
441
|
+
* for a given input type. Object fields contribute their own path and the
|
|
442
|
+
* paths of their descendants; arrays and tuples are atomic and contribute
|
|
443
|
+
* only their own path, because dirty arrays are returned as complete units.
|
|
444
|
+
*
|
|
445
|
+
* Narrowing is exact for the first 5 levels of nesting; deeper paths fall
|
|
446
|
+
* back to `RequiredPath` to keep the result a complete superset of any
|
|
447
|
+
* path the runtime can address.
|
|
448
|
+
*
|
|
449
|
+
* Hint: Arrays and tuples are atomic because they don't structurally
|
|
450
|
+
* extend `Record<PropertyKey, unknown>` and so fall through to `never`
|
|
451
|
+
* via `DeepDirtyPath` — no explicit array check is needed. `TDepth` is
|
|
452
|
+
* a tuple-length counter capped at 5 to bound TypeScript instantiation
|
|
453
|
+
* cost.
|
|
454
|
+
*/
|
|
455
|
+
type DirtyPath<TValue, TDepth extends 0[] = []> = TDepth["length"] extends 5 ? RequiredPath : TValue extends Record<PropertyKey, unknown> ? { [TKey in ExactKeysOf<TValue>]: readonly [TKey] | DeepDirtyPath<NonNullable<PropertiesOf<TValue>[TKey]>, TKey, TDepth> }[ExactKeysOf<TValue>] : never;
|
|
363
456
|
//#endregion
|
|
364
457
|
//#region src/array/copyItemState/copyItemState.d.ts
|
|
365
458
|
/**
|
|
@@ -398,6 +491,20 @@ declare function resetItemState(internalFieldStore: InternalFieldStore, initialI
|
|
|
398
491
|
*/
|
|
399
492
|
declare function swapItemState(firstInternalFieldStore: InternalFieldStore, secondInternalFieldStore: InternalFieldStore): void;
|
|
400
493
|
//#endregion
|
|
494
|
+
//#region src/field/getDirtyFieldInput/getDirtyFieldInput.d.ts
|
|
495
|
+
/**
|
|
496
|
+
* Returns only the dirty input of the field store. Arrays are treated as
|
|
497
|
+
* atomic and returned in full if any item is dirty, while object keys without
|
|
498
|
+
* a dirty descendant are omitted. Returns `undefined` if no descendant is
|
|
499
|
+
* dirty.
|
|
500
|
+
*
|
|
501
|
+
* @param internalFieldStore The field store to get dirty input from.
|
|
502
|
+
* @param dirtyOnly Whether to only include dirty fields. Defaults to `true`.
|
|
503
|
+
*
|
|
504
|
+
* @returns The dirty input, or `undefined` if no descendant is dirty.
|
|
505
|
+
*/
|
|
506
|
+
declare function getDirtyFieldInput(internalFieldStore: InternalFieldStore, dirtyOnly?: boolean): unknown;
|
|
507
|
+
//#endregion
|
|
401
508
|
//#region src/field/getElementInput/getElementInput.d.ts
|
|
402
509
|
/**
|
|
403
510
|
* Returns the current input of the element. Handles special cases for select
|
|
@@ -515,7 +622,7 @@ declare function walkFieldStore(internalFieldStore: InternalFieldStore, callback
|
|
|
515
622
|
*
|
|
516
623
|
* @returns The internal form store.
|
|
517
624
|
*/
|
|
518
|
-
declare function createFormStore(config: FormConfig, parse: (input: unknown) => Promise<v.SafeParseResult<
|
|
625
|
+
declare function createFormStore(config: FormConfig, parse: (input: unknown) => Promise<v.SafeParseResult<FormSchema>>): InternalFormStore;
|
|
519
626
|
//#endregion
|
|
520
627
|
//#region src/form/validateFormInput/validateFormInput.d.ts
|
|
521
628
|
/**
|
|
@@ -555,7 +662,7 @@ declare function validateIfRequired(internalFormStore: InternalFormStore, intern
|
|
|
555
662
|
/**
|
|
556
663
|
* Framework type.
|
|
557
664
|
*/
|
|
558
|
-
type Framework = "preact" | "qwik" | "react" | "solid" | "svelte" | "vue";
|
|
665
|
+
type Framework = "angular" | "preact" | "qwik" | "react" | "solid" | "svelte" | "vue";
|
|
559
666
|
//#endregion
|
|
560
667
|
//#region src/framework/index.svelte.d.ts
|
|
561
668
|
/**
|
|
@@ -586,4 +693,4 @@ declare function createSignal<T>(initialValue: T): Signal<T>;
|
|
|
586
693
|
*/
|
|
587
694
|
declare function batch<T>(fn: () => T): T;
|
|
588
695
|
//#endregion
|
|
589
|
-
export { BaseFormStore, Batch, DeepPartial, FieldElement, FieldSchema, FormConfig, INTERNAL, InternalArrayStore, InternalBaseStore, InternalFieldStore, InternalFormStore, InternalObjectStore, InternalValueStore, IsAny, IsNever, MaybePromise, PartialValues, Path, PathKey, PathValue, RequiredPath, Schema, Signal, SubmitEventHandler, SubmitHandler, Untrack, ValidArrayPath, ValidPath, ValidateFormInputConfig, ValidationMode, batch, copyItemState, createFormStore, createId, createSignal, framework, getElementInput, getFieldBool, getFieldInput, getFieldStore, initializeFieldStore, resetItemState, setFieldBool, setFieldInput, setInitialFieldInput, swapItemState, untrack, validateFormInput, validateIfRequired, walkFieldStore };
|
|
696
|
+
export { BaseFormStore, Batch, DeepPartial, DirtyPath, FieldElement, FieldSchema, FormConfig, FormSchema, INTERNAL, InternalArrayStore, InternalBaseStore, InternalFieldStore, InternalFormStore, InternalObjectStore, InternalValueStore, IsAny, IsNever, MaybePromise, PartialValues, Path, PathKey, PathValue, RequiredPath, Schema, Signal, SubmitEventHandler, SubmitHandler, Untrack, ValidArrayPath, ValidPath, ValidateFormInputConfig, ValidationMode, batch, copyItemState, createFormStore, createId, createSignal, framework, getDirtyFieldInput, getElementInput, getFieldBool, getFieldInput, getFieldStore, initializeFieldStore, resetItemState, setFieldBool, setFieldInput, setInitialFieldInput, swapItemState, untrack, validateFormInput, validateIfRequired, walkFieldStore };
|
|
@@ -107,7 +107,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
107
107
|
if (internalFieldStore.kind === "object") {
|
|
108
108
|
internalFieldStore.children ??= {};
|
|
109
109
|
for (const key in schema.entries) {
|
|
110
|
-
internalFieldStore.children[key]
|
|
110
|
+
internalFieldStore.children[key] ??= {};
|
|
111
111
|
path.push(key);
|
|
112
112
|
initializeFieldStore(internalFieldStore.children[key], schema.entries[key], initialInput?.[key], path);
|
|
113
113
|
path.pop();
|
|
@@ -118,6 +118,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
118
118
|
internalFieldStore.input = /* @__PURE__ */ createSignal(objectInput);
|
|
119
119
|
}
|
|
120
120
|
} else {
|
|
121
|
+
if (internalFieldStore.kind && internalFieldStore.kind !== "value") throw new Error(`Store initialized as "${internalFieldStore.kind}" cannot be reinitialized as "value"`);
|
|
121
122
|
internalFieldStore.kind = "value";
|
|
122
123
|
if (internalFieldStore.kind === "value") {
|
|
123
124
|
internalFieldStore.initialInput = /* @__PURE__ */ createSignal(initialInput);
|
|
@@ -272,6 +273,69 @@ function swapItemState(firstInternalFieldStore, secondInternalFieldStore) {
|
|
|
272
273
|
});
|
|
273
274
|
}
|
|
274
275
|
|
|
276
|
+
//#endregion
|
|
277
|
+
//#region src/field/getFieldBool/getFieldBool.ts
|
|
278
|
+
/**
|
|
279
|
+
* Returns whether the specified boolean property is true for the field store
|
|
280
|
+
* or any of its nested children. Recursively checks arrays and objects.
|
|
281
|
+
*
|
|
282
|
+
* @param internalFieldStore The field store to check.
|
|
283
|
+
* @param type The boolean property type to check.
|
|
284
|
+
*
|
|
285
|
+
* @returns Whether the property is true.
|
|
286
|
+
*/
|
|
287
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
288
|
+
function getFieldBool(internalFieldStore, type) {
|
|
289
|
+
if (internalFieldStore[type].value) return true;
|
|
290
|
+
if (internalFieldStore.kind === "array") {
|
|
291
|
+
for (let index = 0; index < internalFieldStore.items.value.length; index++) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[index], type)) return true;
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
if (internalFieldStore.kind == "object") {
|
|
295
|
+
for (const key in internalFieldStore.children) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[key], type)) return true;
|
|
296
|
+
return false;
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/field/getDirtyFieldInput/getDirtyFieldInput.ts
|
|
303
|
+
/**
|
|
304
|
+
* Returns only the dirty input of the field store. Arrays are treated as
|
|
305
|
+
* atomic and returned in full if any item is dirty, while object keys without
|
|
306
|
+
* a dirty descendant are omitted. Returns `undefined` if no descendant is
|
|
307
|
+
* dirty.
|
|
308
|
+
*
|
|
309
|
+
* @param internalFieldStore The field store to get dirty input from.
|
|
310
|
+
* @param dirtyOnly Whether to only include dirty fields. Defaults to `true`.
|
|
311
|
+
*
|
|
312
|
+
* @returns The dirty input, or `undefined` if no descendant is dirty.
|
|
313
|
+
*/
|
|
314
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
315
|
+
function getDirtyFieldInput(internalFieldStore, dirtyOnly = true) {
|
|
316
|
+
if (dirtyOnly && !/* @__PURE__ */ getFieldBool(internalFieldStore, "isDirty")) return;
|
|
317
|
+
if (internalFieldStore.kind === "array") {
|
|
318
|
+
if (internalFieldStore.input.value) {
|
|
319
|
+
const value = [];
|
|
320
|
+
for (let index = 0; index < internalFieldStore.items.value.length; index++) value[index] = /* @__PURE__ */ getDirtyFieldInput(internalFieldStore.children[index], false);
|
|
321
|
+
return value;
|
|
322
|
+
}
|
|
323
|
+
return internalFieldStore.input.value;
|
|
324
|
+
}
|
|
325
|
+
if (internalFieldStore.kind === "object") {
|
|
326
|
+
if (internalFieldStore.input.value) {
|
|
327
|
+
const value = {};
|
|
328
|
+
for (const key in internalFieldStore.children) {
|
|
329
|
+
const child = internalFieldStore.children[key];
|
|
330
|
+
if (!dirtyOnly || /* @__PURE__ */ getFieldBool(child, "isDirty")) value[key] = /* @__PURE__ */ getDirtyFieldInput(child, dirtyOnly);
|
|
331
|
+
}
|
|
332
|
+
return value;
|
|
333
|
+
}
|
|
334
|
+
return internalFieldStore.input.value;
|
|
335
|
+
}
|
|
336
|
+
return internalFieldStore.input.value;
|
|
337
|
+
}
|
|
338
|
+
|
|
275
339
|
//#endregion
|
|
276
340
|
//#region src/field/getFieldInput/getFieldInput.ts
|
|
277
341
|
/**
|
|
@@ -334,31 +398,6 @@ function getElementInput(element, internalFieldStore) {
|
|
|
334
398
|
return element.value;
|
|
335
399
|
}
|
|
336
400
|
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region src/field/getFieldBool/getFieldBool.ts
|
|
339
|
-
/**
|
|
340
|
-
* Returns whether the specified boolean property is true for the field store
|
|
341
|
-
* or any of its nested children. Recursively checks arrays and objects.
|
|
342
|
-
*
|
|
343
|
-
* @param internalFieldStore The field store to check.
|
|
344
|
-
* @param type The boolean property type to check.
|
|
345
|
-
*
|
|
346
|
-
* @returns Whether the property is true.
|
|
347
|
-
*/
|
|
348
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
349
|
-
function getFieldBool(internalFieldStore, type) {
|
|
350
|
-
if (internalFieldStore[type].value) return true;
|
|
351
|
-
if (internalFieldStore.kind === "array") {
|
|
352
|
-
for (let index = 0; index < internalFieldStore.items.value.length; index++) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[index], type)) return true;
|
|
353
|
-
return false;
|
|
354
|
-
}
|
|
355
|
-
if (internalFieldStore.kind == "object") {
|
|
356
|
-
for (const key in internalFieldStore.children) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[key], type)) return true;
|
|
357
|
-
return false;
|
|
358
|
-
}
|
|
359
|
-
return false;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
401
|
//#endregion
|
|
363
402
|
//#region src/field/getFieldStore/getFieldStore.ts
|
|
364
403
|
/**
|
|
@@ -609,4 +648,4 @@ function validateIfRequired(internalFormStore, internalFieldStore, validationMod
|
|
|
609
648
|
const INTERNAL = "~internal";
|
|
610
649
|
|
|
611
650
|
//#endregion
|
|
612
|
-
export { INTERNAL, batch, copyItemState, createFormStore, createId, createSignal, framework, getElementInput, getFieldBool, getFieldInput, getFieldStore, initializeFieldStore, resetItemState, setFieldBool, setFieldInput, setInitialFieldInput, swapItemState, untrack, validateFormInput, validateIfRequired, walkFieldStore };
|
|
651
|
+
export { INTERNAL, batch, copyItemState, createFormStore, createId, createSignal, framework, getDirtyFieldInput, getElementInput, getFieldBool, getFieldInput, getFieldStore, initializeFieldStore, resetItemState, setFieldBool, setFieldInput, setInitialFieldInput, swapItemState, untrack, validateFormInput, validateIfRequired, walkFieldStore };
|