@formisch/svelte 0.3.0 → 0.4.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/components/Field/Field.svelte +10 -1
- package/dist/components/Field/Field.svelte.d.ts +10 -1
- package/dist/components/FieldArray/FieldArray.svelte +10 -1
- package/dist/components/FieldArray/FieldArray.svelte.d.ts +10 -1
- package/dist/components/Form/Form.svelte +12 -0
- package/dist/components/Form/Form.svelte.d.ts +12 -0
- package/dist/core/index.svelte.d.ts +350 -27
- package/dist/core/index.svelte.js +162 -25
- package/dist/methods/index.svelte.d.ts +317 -3
- package/dist/methods/index.svelte.js +72 -2
- package/dist/runes/createForm/createForm.svelte.d.ts +8 -0
- package/dist/runes/createForm/createForm.svelte.js +30 -60
- package/dist/runes/useField/useField.svelte.d.ts +14 -0
- package/dist/runes/useField/useField.svelte.js +20 -21
- package/dist/runes/useFieldArray/useFieldArray.svelte.d.ts +14 -0
- package/dist/runes/useFieldArray/useFieldArray.svelte.js +6 -5
- package/dist/types/field.d.ts +63 -3
- package/dist/types/form.d.ts +27 -0
- package/package.json +3 -3
|
@@ -9,14 +9,23 @@
|
|
|
9
9
|
import type { Snippet } from 'svelte';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Field component props interface.
|
|
13
13
|
*/
|
|
14
14
|
export interface FieldProps<
|
|
15
15
|
TSchema extends Schema = Schema,
|
|
16
16
|
TFieldPath extends RequiredPath = RequiredPath,
|
|
17
17
|
> {
|
|
18
|
+
/**
|
|
19
|
+
* The form store to which the field belongs.
|
|
20
|
+
*/
|
|
18
21
|
readonly of: FormStore<TSchema>;
|
|
22
|
+
/**
|
|
23
|
+
* The path to the field within the form schema.
|
|
24
|
+
*/
|
|
19
25
|
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
26
|
+
/**
|
|
27
|
+
* The render function that receives the field store and returns JSX.
|
|
28
|
+
*/
|
|
20
29
|
readonly children: Snippet<[FieldStore<TSchema, TFieldPath>]>;
|
|
21
30
|
}
|
|
22
31
|
|
|
@@ -3,11 +3,20 @@ import type * as v from 'valibot';
|
|
|
3
3
|
import type { FieldStore, FormStore } from '../../types/index.ts';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Field component props interface.
|
|
7
7
|
*/
|
|
8
8
|
export interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends RequiredPath = RequiredPath> {
|
|
9
|
+
/**
|
|
10
|
+
* The form store to which the field belongs.
|
|
11
|
+
*/
|
|
9
12
|
readonly of: FormStore<TSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* The path to the field within the form schema.
|
|
15
|
+
*/
|
|
10
16
|
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
17
|
+
/**
|
|
18
|
+
* The render function that receives the field store and returns JSX.
|
|
19
|
+
*/
|
|
11
20
|
readonly children: Snippet<[FieldStore<TSchema, TFieldPath>]>;
|
|
12
21
|
}
|
|
13
22
|
declare function $$render<TSchema extends Schema, TFieldPath extends RequiredPath>(): {
|
|
@@ -13,14 +13,23 @@
|
|
|
13
13
|
import type { Snippet } from 'svelte';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Field array component props interface.
|
|
17
17
|
*/
|
|
18
18
|
export interface FieldArrayProps<
|
|
19
19
|
TSchema extends Schema = Schema,
|
|
20
20
|
TFieldArrayPath extends RequiredPath = RequiredPath,
|
|
21
21
|
> {
|
|
22
|
+
/**
|
|
23
|
+
* The form store to which the field array belongs.
|
|
24
|
+
*/
|
|
22
25
|
readonly of: FormStore<TSchema>;
|
|
26
|
+
/**
|
|
27
|
+
* The path to the field array within the form schema.
|
|
28
|
+
*/
|
|
23
29
|
readonly path: ValidArrayPath<v.InferInput<TSchema>, TFieldArrayPath>;
|
|
30
|
+
/**
|
|
31
|
+
* The render function that receives the field array store and returns JSX.
|
|
32
|
+
*/
|
|
24
33
|
readonly children: Snippet<[FieldArrayStore<TSchema, TFieldArrayPath>]>;
|
|
25
34
|
}
|
|
26
35
|
|
|
@@ -3,11 +3,20 @@ import type * as v from 'valibot';
|
|
|
3
3
|
import type { FieldArrayStore, FormStore } from '../../types/index.ts';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Field array component props interface.
|
|
7
7
|
*/
|
|
8
8
|
export interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath extends RequiredPath = RequiredPath> {
|
|
9
|
+
/**
|
|
10
|
+
* The form store to which the field array belongs.
|
|
11
|
+
*/
|
|
9
12
|
readonly of: FormStore<TSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* The path to the field array within the form schema.
|
|
15
|
+
*/
|
|
10
16
|
readonly path: ValidArrayPath<v.InferInput<TSchema>, TFieldArrayPath>;
|
|
17
|
+
/**
|
|
18
|
+
* The render function that receives the field array store and returns JSX.
|
|
19
|
+
*/
|
|
11
20
|
readonly children: Snippet<[FieldArrayStore<TSchema, TFieldArrayPath>]>;
|
|
12
21
|
}
|
|
13
22
|
declare function $$render<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(): {
|
|
@@ -9,12 +9,24 @@
|
|
|
9
9
|
import type { Snippet } from 'svelte';
|
|
10
10
|
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Form component props type.
|
|
14
|
+
*/
|
|
12
15
|
export type FormProps<TSchema extends Schema = Schema> = Omit<
|
|
13
16
|
HTMLFormAttributes,
|
|
14
17
|
'on:submit' | 'onsubmit' | 'novalidate'
|
|
15
18
|
> & {
|
|
19
|
+
/**
|
|
20
|
+
* The form store instance.
|
|
21
|
+
*/
|
|
16
22
|
of: FormStore<TSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* The submit handler called when the form is submitted and validation succeeds.
|
|
25
|
+
*/
|
|
17
26
|
onsubmit: SubmitHandler<TSchema>;
|
|
27
|
+
/**
|
|
28
|
+
* The child elements to render within the form.
|
|
29
|
+
*/
|
|
18
30
|
children: Snippet;
|
|
19
31
|
};
|
|
20
32
|
|
|
@@ -2,9 +2,21 @@ import { type Schema, type SubmitHandler } from '../../core/index.svelte';
|
|
|
2
2
|
import type { FormStore } from '../../types/index.ts';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
5
|
+
/**
|
|
6
|
+
* Form component props type.
|
|
7
|
+
*/
|
|
5
8
|
export type FormProps<TSchema extends Schema = Schema> = Omit<HTMLFormAttributes, 'on:submit' | 'onsubmit' | 'novalidate'> & {
|
|
9
|
+
/**
|
|
10
|
+
* The form store instance.
|
|
11
|
+
*/
|
|
6
12
|
of: FormStore<TSchema>;
|
|
13
|
+
/**
|
|
14
|
+
* The submit handler called when the form is submitted and validation succeeds.
|
|
15
|
+
*/
|
|
7
16
|
onsubmit: SubmitHandler<TSchema>;
|
|
17
|
+
/**
|
|
18
|
+
* The child elements to render within the form.
|
|
19
|
+
*/
|
|
8
20
|
children: Snippet;
|
|
9
21
|
};
|
|
10
22
|
declare function $$render<TSchema extends Schema = Schema>(): {
|