@formisch/react 0.4.5 → 0.5.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/index.d.ts +275 -70
- package/dist/index.js +114 -25
- package/package.json +11 -4
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 React Hook Form and TanStack Form, see the [comparison guide](https://formisch.dev/react/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
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,13 +3,38 @@ import { ChangeEventHandler, FocusEventHandler, FormEvent, FormHTMLAttributes, R
|
|
|
3
3
|
|
|
4
4
|
//#region ../../packages/core/dist/index.react.d.ts
|
|
5
5
|
|
|
6
|
-
//#region src/types/schema.d.ts
|
|
6
|
+
//#region src/types/schema/schema.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Schema type.
|
|
9
9
|
*/
|
|
10
10
|
type Schema = v.GenericSchema | v.GenericSchemaAsync;
|
|
11
|
+
/**
|
|
12
|
+
* Object schema type.
|
|
13
|
+
*/
|
|
14
|
+
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>;
|
|
15
|
+
/**
|
|
16
|
+
* Object schema async type.
|
|
17
|
+
*/
|
|
18
|
+
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>;
|
|
19
|
+
/**
|
|
20
|
+
* Object root schema type.
|
|
21
|
+
*/
|
|
22
|
+
type ObjectRootSchema = ObjectSchema | v.IntersectSchema<ObjectSchema[], v.ErrorMessage<v.IntersectIssue> | undefined> | v.UnionSchema<ObjectSchema[], v.ErrorMessage<v.UnionIssue<v.BaseIssue<unknown>>> | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Object root schema async type.
|
|
25
|
+
*/
|
|
26
|
+
type ObjectRootSchemaAsync = ObjectSchemaAsync | v.IntersectSchemaAsync<(ObjectSchema | ObjectSchemaAsync)[], v.ErrorMessage<v.IntersectIssue> | undefined> | v.UnionSchemaAsync<(ObjectSchema | ObjectSchemaAsync)[], v.ErrorMessage<v.UnionIssue<v.BaseIssue<unknown>>> | undefined>;
|
|
27
|
+
/**
|
|
28
|
+
* Form schema type.
|
|
29
|
+
*
|
|
30
|
+
* Hint: Forms must have an object root, so only object schemas (sync or async),
|
|
31
|
+
* combinators (intersect, union, variant) whose options resolve to objects, and
|
|
32
|
+
* `lazy` schemas wrapping any of these are allowed at the top level. Use
|
|
33
|
+
* {@link Schema} for nested field schemas.
|
|
34
|
+
*/
|
|
35
|
+
type FormSchema = ObjectRootSchema | ObjectRootSchemaAsync | v.LazySchema<ObjectRootSchema> | v.LazySchemaAsync<ObjectRootSchema | ObjectRootSchemaAsync>;
|
|
11
36
|
//#endregion
|
|
12
|
-
//#region src/types/signal.d.ts
|
|
37
|
+
//#region src/types/signal/signal.d.ts
|
|
13
38
|
/**
|
|
14
39
|
* Signal interface.
|
|
15
40
|
*/
|
|
@@ -24,7 +49,7 @@ interface Signal<T> {
|
|
|
24
49
|
*/
|
|
25
50
|
|
|
26
51
|
//#endregion
|
|
27
|
-
//#region src/types/field.d.ts
|
|
52
|
+
//#region src/types/field/field.d.ts
|
|
28
53
|
/**
|
|
29
54
|
* Field element type.
|
|
30
55
|
*/
|
|
@@ -184,7 +209,7 @@ interface InternalValueStore extends InternalBaseStore {
|
|
|
184
209
|
*/
|
|
185
210
|
type InternalFieldStore = InternalArrayStore | InternalObjectStore | InternalValueStore;
|
|
186
211
|
//#endregion
|
|
187
|
-
//#region src/types/utils.d.ts
|
|
212
|
+
//#region src/types/utils/utils.d.ts
|
|
188
213
|
/**
|
|
189
214
|
* Checks if a type is `any`.
|
|
190
215
|
*/
|
|
@@ -216,7 +241,7 @@ type PartialValues<TValue> = TValue extends readonly (infer TItem)[] ? number ex
|
|
|
216
241
|
*/
|
|
217
242
|
declare const INTERNAL: "~internal";
|
|
218
243
|
//#endregion
|
|
219
|
-
//#region src/types/form.d.ts
|
|
244
|
+
//#region src/types/form/form.d.ts
|
|
220
245
|
/**
|
|
221
246
|
* Validation mode type.
|
|
222
247
|
*/
|
|
@@ -224,7 +249,7 @@ type ValidationMode = "initial" | "touch" | "input" | "change" | "blur" | "submi
|
|
|
224
249
|
/**
|
|
225
250
|
* Form config interface.
|
|
226
251
|
*/
|
|
227
|
-
interface FormConfig<TSchema extends
|
|
252
|
+
interface FormConfig<TSchema extends FormSchema = FormSchema> {
|
|
228
253
|
/**
|
|
229
254
|
* The schema of the form.
|
|
230
255
|
*/
|
|
@@ -245,7 +270,7 @@ interface FormConfig<TSchema extends Schema = Schema> {
|
|
|
245
270
|
/**
|
|
246
271
|
* Internal form store interface.
|
|
247
272
|
*/
|
|
248
|
-
interface InternalFormStore<TSchema extends
|
|
273
|
+
interface InternalFormStore<TSchema extends FormSchema = FormSchema> extends InternalObjectStore {
|
|
249
274
|
/**
|
|
250
275
|
* The element of the form.
|
|
251
276
|
*/
|
|
@@ -282,7 +307,7 @@ interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObj
|
|
|
282
307
|
/**
|
|
283
308
|
* Base form store interface.
|
|
284
309
|
*/
|
|
285
|
-
interface BaseFormStore<TSchema extends
|
|
310
|
+
interface BaseFormStore<TSchema extends FormSchema = FormSchema> {
|
|
286
311
|
/**
|
|
287
312
|
* The internal form store.
|
|
288
313
|
*
|
|
@@ -291,17 +316,17 @@ interface BaseFormStore<TSchema extends Schema = Schema> {
|
|
|
291
316
|
readonly [INTERNAL]: InternalFormStore<TSchema>;
|
|
292
317
|
}
|
|
293
318
|
//#endregion
|
|
294
|
-
//#region src/types/form.react.d.ts
|
|
319
|
+
//#region src/types/form/form.react.d.ts
|
|
295
320
|
/**
|
|
296
321
|
* Submit handler type.
|
|
297
322
|
*/
|
|
298
|
-
type SubmitHandler<TSchema extends
|
|
323
|
+
type SubmitHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>) => MaybePromise<unknown>;
|
|
299
324
|
/**
|
|
300
325
|
* Submit event handler type.
|
|
301
326
|
*/
|
|
302
|
-
type SubmitEventHandler<TSchema extends
|
|
327
|
+
type SubmitEventHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>, event: FormEvent<HTMLFormElement>) => MaybePromise<unknown>;
|
|
303
328
|
//#endregion
|
|
304
|
-
//#region src/types/path.d.ts
|
|
329
|
+
//#region src/types/path/path.d.ts
|
|
305
330
|
/**
|
|
306
331
|
* Path key type.
|
|
307
332
|
*/
|
|
@@ -315,47 +340,115 @@ type Path = readonly PathKey[];
|
|
|
315
340
|
*/
|
|
316
341
|
type RequiredPath = readonly [PathKey, ...Path];
|
|
317
342
|
/**
|
|
318
|
-
* Extracts the exact keys of a tuple, array or object.
|
|
343
|
+
* Extracts the exact keys of a tuple, array or object. Tuples return their
|
|
344
|
+
* literal numeric indices, dynamic arrays return `number`, objects return
|
|
345
|
+
* their `keyof` keys, and any other input returns `never`.
|
|
319
346
|
*/
|
|
320
|
-
type
|
|
347
|
+
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;
|
|
321
348
|
/**
|
|
322
|
-
*
|
|
349
|
+
* Returns the flat object of all indexable properties of `TValue`. For object
|
|
350
|
+
* unions, properties from every member are merged so that any single property
|
|
351
|
+
* is accessible. For primitives and other non-indexable types, the result is
|
|
352
|
+
* `{}`.
|
|
323
353
|
*
|
|
324
|
-
* Hint: This is necessary to make
|
|
325
|
-
* properties that do not exist in all union options are not
|
|
326
|
-
* and result in "any" when accessed.
|
|
354
|
+
* Hint: This is necessary to make properties accessible across union members.
|
|
355
|
+
* By default, properties that do not exist in all union options are not
|
|
356
|
+
* accessible and result in "any" when accessed.
|
|
327
357
|
*/
|
|
328
|
-
type
|
|
358
|
+
type PropertiesOf<TValue> = { [TKey in ExactKeysOf<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
329
359
|
/**
|
|
330
360
|
* Lazily evaluates only the first valid path segment based on the given value.
|
|
331
361
|
*/
|
|
332
|
-
type LazyPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValidPath : TPathToCheck extends readonly [infer TFirstKey extends
|
|
362
|
+
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;
|
|
333
363
|
/**
|
|
334
364
|
* Returns the path if valid, otherwise the first possible valid path based on
|
|
335
365
|
* the given value.
|
|
336
366
|
*/
|
|
337
367
|
type ValidPath<TValue, TPath extends RequiredPath> = TPath extends LazyPath<Required<TValue>, TPath> ? TPath : LazyPath<Required<TValue>, TPath>;
|
|
338
368
|
/**
|
|
369
|
+
* Detects whether the consuming project is configured with
|
|
370
|
+
* `exactOptionalPropertyTypes: true`.
|
|
371
|
+
*
|
|
372
|
+
* Hint: If `false` the built-in `Required<T>` strips `| undefined` from
|
|
373
|
+
* optional properties, so `Required<{ key?: undefined }>['key']` collapses
|
|
374
|
+
* to `never` — under strict mode the same expression yields `undefined`.
|
|
375
|
+
*/
|
|
376
|
+
type IsExactOptionalProps = Required<{
|
|
377
|
+
key?: undefined;
|
|
378
|
+
}>["key"] extends never ? false : true;
|
|
379
|
+
/**
|
|
380
|
+
* Like the built-in `Required<T>`, but preserves `| undefined` in two
|
|
381
|
+
* places where `Required<T>` strips it:
|
|
382
|
+
*
|
|
383
|
+
* 1. Optional property values under `exactOptionalPropertyTypes: false`
|
|
384
|
+
* — without this, input typings for `v.optional`/`v.nullish` schemas
|
|
385
|
+
* narrow incorrectly (issue #15).
|
|
386
|
+
* 2. Array/tuple element types — e.g. `(string | undefined)[]` stays
|
|
387
|
+
* `(string | undefined)[]` instead of becoming `string[]`. Arrays
|
|
388
|
+
* fall through unchanged because they only have a numeric index
|
|
389
|
+
* signature and don't structurally extend `Record<PropertyKey,
|
|
390
|
+
* unknown>` (which requires string keys).
|
|
391
|
+
*/
|
|
392
|
+
type ExactRequired<TValue> = TValue extends Record<PropertyKey, unknown> ? IsExactOptionalProps extends true ? Required<TValue> : { [TKey in keyof Required<TValue>]: TValue[TKey] } : TValue;
|
|
393
|
+
/**
|
|
339
394
|
* Extracts the value type at the given path.
|
|
340
395
|
*/
|
|
341
|
-
type PathValue<TValue, TPath extends Path> = TPath extends readonly [infer TKey, ...infer TRest extends Path] ? TKey extends
|
|
396
|
+
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;
|
|
342
397
|
/**
|
|
343
|
-
* Checks
|
|
398
|
+
* Checks whether a value is an array or contains one anywhere in its shape.
|
|
399
|
+
*
|
|
400
|
+
* Hint: The inner conditionals (`TValue extends readonly unknown[]` and
|
|
401
|
+
* `TValue extends Record<PropertyKey, unknown>`) distribute over union members,
|
|
402
|
+
* so the inner expression returns the union of each member's result (e.g.
|
|
403
|
+
* `true | false` when some members contain arrays and others don't).
|
|
404
|
+
* Downstream code uses `IsOrHasArray<T> extends true`, but
|
|
405
|
+
* `boolean extends true` is `false` — so we collapse the result via
|
|
406
|
+
* `true extends ...`, which is `true` whenever at least one union member
|
|
407
|
+
* contributed `true`.
|
|
344
408
|
*/
|
|
345
|
-
type IsOrHasArray<TValue> = IsAny<TValue> extends true ? false : TValue extends readonly unknown[] ? true : TValue extends Record<
|
|
409
|
+
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;
|
|
346
410
|
/**
|
|
347
411
|
* Extracts the exact keys of a tuple, array or object that contain arrays.
|
|
348
412
|
*/
|
|
349
|
-
type
|
|
413
|
+
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;
|
|
414
|
+
/**
|
|
415
|
+
* Returns the flat object of indexable properties of `TValue` whose values
|
|
416
|
+
* are or contain arrays. Mirrors `PropertiesOf` but keyed by
|
|
417
|
+
* `ExactKeysOfArrayPath` so the lookup is provably valid for array-path
|
|
418
|
+
* navigation in `LazyArrayPath`.
|
|
419
|
+
*/
|
|
420
|
+
type PropertiesOfArrayPath<TValue> = { [TKey in ExactKeysOfArrayPath<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
350
421
|
/**
|
|
351
422
|
* Lazily evaluates only the first valid array path segment based on the given value.
|
|
352
423
|
*/
|
|
353
|
-
type LazyArrayPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValue extends readonly unknown[] ? TValidPath : readonly [...TValidPath,
|
|
424
|
+
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;
|
|
354
425
|
/**
|
|
355
426
|
* Returns the path if valid, otherwise the first possible valid array path
|
|
356
427
|
* based on the given value.
|
|
357
428
|
*/
|
|
358
429
|
type ValidArrayPath<TValue, TPath extends RequiredPath> = TPath extends LazyArrayPath<Required<TValue>, TPath> ? TPath : LazyArrayPath<Required<TValue>, TPath>;
|
|
430
|
+
/**
|
|
431
|
+
* Recursive helper for `DirtyPath` that prepends `TKey` to each deeper path,
|
|
432
|
+
* or falls through to `never` when the child is not an object.
|
|
433
|
+
*/
|
|
434
|
+
type DeepDirtyPath<TChild, TKey$1 extends PathKey, TDepth extends 0[]> = TChild extends Record<PropertyKey, unknown> ? readonly [TKey$1, ...DirtyPath<TChild, [...TDepth, 0]>] : never;
|
|
435
|
+
/**
|
|
436
|
+
* Returns the union of all `RequiredPath`s that `getDirtyPaths` can emit
|
|
437
|
+
* for a given input type. Object fields contribute their own path and the
|
|
438
|
+
* paths of their descendants; arrays and tuples are atomic and contribute
|
|
439
|
+
* only their own path, because dirty arrays are returned as complete units.
|
|
440
|
+
*
|
|
441
|
+
* Narrowing is exact for the first 5 levels of nesting; deeper paths fall
|
|
442
|
+
* back to `RequiredPath` to keep the result a complete superset of any
|
|
443
|
+
* path the runtime can address.
|
|
444
|
+
*
|
|
445
|
+
* Hint: Arrays and tuples are atomic because they don't structurally
|
|
446
|
+
* extend `Record<PropertyKey, unknown>` and so fall through to `never`
|
|
447
|
+
* via `DeepDirtyPath` — no explicit array check is needed. `TDepth` is
|
|
448
|
+
* a tuple-length counter capped at 5 to bound TypeScript instantiation
|
|
449
|
+
* cost.
|
|
450
|
+
*/
|
|
451
|
+
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;
|
|
359
452
|
//#endregion
|
|
360
453
|
//#region src/array/copyItemState/copyItemState.d.ts
|
|
361
454
|
/**
|
|
@@ -373,7 +466,7 @@ type ValidArrayPath<TValue, TPath extends RequiredPath> = TPath extends LazyArra
|
|
|
373
466
|
/**
|
|
374
467
|
* Focus field config interface.
|
|
375
468
|
*/
|
|
376
|
-
interface FocusFieldConfig<TSchema extends
|
|
469
|
+
interface FocusFieldConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
377
470
|
/**
|
|
378
471
|
* The path to the field to focus.
|
|
379
472
|
*/
|
|
@@ -387,7 +480,7 @@ interface FocusFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPa
|
|
|
387
480
|
* @param form The form store containing the field.
|
|
388
481
|
* @param config The focus field configuration.
|
|
389
482
|
*/
|
|
390
|
-
declare function focus<TSchema extends
|
|
483
|
+
declare function focus<TSchema extends FormSchema, TFieldPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: FocusFieldConfig<TSchema, TFieldPath>): void;
|
|
391
484
|
//#endregion
|
|
392
485
|
//#region src/getAllErrors/getAllErrors.d.ts
|
|
393
486
|
/**
|
|
@@ -401,6 +494,93 @@ declare function focus<TSchema extends Schema, TFieldPath extends RequiredPath>(
|
|
|
401
494
|
*/
|
|
402
495
|
declare function getAllErrors(form: BaseFormStore): [string, ...string[]] | null;
|
|
403
496
|
//#endregion
|
|
497
|
+
//#region src/getDirtyInput/getDirtyInput.d.ts
|
|
498
|
+
/**
|
|
499
|
+
* Get form dirty input config interface.
|
|
500
|
+
*/
|
|
501
|
+
interface GetFormDirtyInputConfig {
|
|
502
|
+
/**
|
|
503
|
+
* The path to a field. Leave undefined to get the dirty input of the entire
|
|
504
|
+
* form.
|
|
505
|
+
*/
|
|
506
|
+
readonly path?: undefined;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Get field dirty input config interface.
|
|
510
|
+
*/
|
|
511
|
+
interface GetFieldDirtyInputConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
512
|
+
/**
|
|
513
|
+
* The path to the field to retrieve the dirty input from.
|
|
514
|
+
*/
|
|
515
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Retrieves only the dirty input values of a specific field or the entire
|
|
519
|
+
* form. Arrays are treated as atomic and returned in full if any item is
|
|
520
|
+
* dirty, while object keys without a dirty descendant are omitted. Returns
|
|
521
|
+
* `undefined` if no field in the inspected subtree is dirty.
|
|
522
|
+
*
|
|
523
|
+
* @param form The form store to retrieve dirty input from.
|
|
524
|
+
*
|
|
525
|
+
* @returns The dirty input of the form or specified field, or `undefined`.
|
|
526
|
+
*/
|
|
527
|
+
declare function getDirtyInput<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): DeepPartial<v.InferInput<TSchema>> | undefined;
|
|
528
|
+
/**
|
|
529
|
+
* Retrieves only the dirty input values of a specific field or the entire
|
|
530
|
+
* form. Arrays are treated as atomic and returned in full if any item is
|
|
531
|
+
* dirty, while object keys without a dirty descendant are omitted. Returns
|
|
532
|
+
* `undefined` if no field in the inspected subtree is dirty.
|
|
533
|
+
*
|
|
534
|
+
* @param form The form store to retrieve dirty input from.
|
|
535
|
+
* @param config The get dirty input configuration.
|
|
536
|
+
*
|
|
537
|
+
* @returns The dirty input of the form or specified field, or `undefined`.
|
|
538
|
+
*/
|
|
539
|
+
declare function getDirtyInput<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? GetFieldDirtyInputConfig<TSchema, TFieldPath> : GetFormDirtyInputConfig): DeepPartial<TFieldPath extends RequiredPath ? PathValue<v.InferInput<TSchema>, TFieldPath> : v.InferInput<TSchema>> | undefined;
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/getDirtyPaths/getDirtyPaths.d.ts
|
|
542
|
+
/**
|
|
543
|
+
* Get form dirty paths config interface.
|
|
544
|
+
*/
|
|
545
|
+
interface GetFormDirtyPathsConfig {
|
|
546
|
+
/**
|
|
547
|
+
* The path to a field. Leave undefined to inspect the entire form.
|
|
548
|
+
*/
|
|
549
|
+
readonly path?: undefined;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Get field dirty paths config interface.
|
|
553
|
+
*/
|
|
554
|
+
interface GetFieldDirtyPathsConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
555
|
+
/**
|
|
556
|
+
* The path to the field to inspect.
|
|
557
|
+
*/
|
|
558
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Returns a list of paths to the dirty fields of a specific field or the
|
|
562
|
+
* entire form. Arrays are treated as atomic and contribute only their own
|
|
563
|
+
* path if any item is dirty, while object branches are recursed into. Returns
|
|
564
|
+
* an empty list if no field in the inspected subtree is dirty.
|
|
565
|
+
*
|
|
566
|
+
* @param form The form store to inspect.
|
|
567
|
+
*
|
|
568
|
+
* @returns The list of paths to the dirty fields.
|
|
569
|
+
*/
|
|
570
|
+
declare function getDirtyPaths<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): DirtyPath<v.InferInput<TSchema>>[];
|
|
571
|
+
/**
|
|
572
|
+
* Returns a list of paths to the dirty fields of a specific field or the
|
|
573
|
+
* entire form. Arrays are treated as atomic and contribute only their own
|
|
574
|
+
* path if any item is dirty, while object branches are recursed into. Returns
|
|
575
|
+
* an empty list if no field in the inspected subtree is dirty.
|
|
576
|
+
*
|
|
577
|
+
* @param form The form store to inspect.
|
|
578
|
+
* @param config The get dirty paths configuration.
|
|
579
|
+
*
|
|
580
|
+
* @returns The list of paths to the dirty fields.
|
|
581
|
+
*/
|
|
582
|
+
declare function getDirtyPaths<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? GetFieldDirtyPathsConfig<TSchema, TFieldPath> : GetFormDirtyPathsConfig): DirtyPath<v.InferInput<TSchema>>[];
|
|
583
|
+
//#endregion
|
|
404
584
|
//#region src/getErrors/getErrors.d.ts
|
|
405
585
|
/**
|
|
406
586
|
* Get form errors config interface.
|
|
@@ -414,7 +594,7 @@ interface GetFormErrorsConfig {
|
|
|
414
594
|
/**
|
|
415
595
|
* Get field errors config interface.
|
|
416
596
|
*/
|
|
417
|
-
interface GetFieldErrorsConfig<TSchema extends
|
|
597
|
+
interface GetFieldErrorsConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
418
598
|
/**
|
|
419
599
|
* The path to the field to retrieve errors from.
|
|
420
600
|
*/
|
|
@@ -429,7 +609,7 @@ interface GetFieldErrorsConfig<TSchema extends Schema, TFieldPath extends Requir
|
|
|
429
609
|
*
|
|
430
610
|
* @returns A non-empty array of error messages, or null if no errors exist.
|
|
431
611
|
*/
|
|
432
|
-
declare function getErrors<TSchema extends
|
|
612
|
+
declare function getErrors<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): [string, ...string[]] | null;
|
|
433
613
|
/**
|
|
434
614
|
* Retrieves error messages from the form. When called without a config,
|
|
435
615
|
* returns form-level errors. When called with a path, returns errors for
|
|
@@ -440,7 +620,7 @@ declare function getErrors<TSchema extends Schema>(form: BaseFormStore<TSchema>)
|
|
|
440
620
|
*
|
|
441
621
|
* @returns A non-empty array of error messages, or null if no errors exist.
|
|
442
622
|
*/
|
|
443
|
-
declare function getErrors<TSchema extends
|
|
623
|
+
declare function getErrors<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? GetFieldErrorsConfig<TSchema, TFieldPath> : GetFormErrorsConfig): [string, ...string[]] | null;
|
|
444
624
|
//#endregion
|
|
445
625
|
//#region src/getInput/getInput.d.ts
|
|
446
626
|
/**
|
|
@@ -455,7 +635,7 @@ interface GetFormInputConfig {
|
|
|
455
635
|
/**
|
|
456
636
|
* Get field input config interface.
|
|
457
637
|
*/
|
|
458
|
-
interface GetFieldInputConfig<TSchema extends
|
|
638
|
+
interface GetFieldInputConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
459
639
|
/**
|
|
460
640
|
* The path to the field to retrieve input from.
|
|
461
641
|
*/
|
|
@@ -469,7 +649,7 @@ interface GetFieldInputConfig<TSchema extends Schema, TFieldPath extends Require
|
|
|
469
649
|
*
|
|
470
650
|
* @returns The partial input values of the form or the specified field.
|
|
471
651
|
*/
|
|
472
|
-
declare function getInput<TSchema extends
|
|
652
|
+
declare function getInput<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): PartialValues<v.InferInput<TSchema>>;
|
|
473
653
|
/**
|
|
474
654
|
* Retrieves the current input value of a specific field or the entire form.
|
|
475
655
|
* Returns a partial object as not all fields may have been set.
|
|
@@ -479,7 +659,7 @@ declare function getInput<TSchema extends Schema>(form: BaseFormStore<TSchema>):
|
|
|
479
659
|
*
|
|
480
660
|
* @returns The partial input values of the form or the specified field.
|
|
481
661
|
*/
|
|
482
|
-
declare function getInput<TSchema extends
|
|
662
|
+
declare function getInput<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? GetFieldInputConfig<TSchema, TFieldPath> : GetFormInputConfig): PartialValues<TFieldPath extends RequiredPath ? PathValue<v.InferInput<TSchema>, TFieldPath> : v.InferInput<TSchema>>;
|
|
483
663
|
//#endregion
|
|
484
664
|
//#region src/handleSubmit/handleSubmit.react.d.ts
|
|
485
665
|
/**
|
|
@@ -492,7 +672,7 @@ declare function getInput<TSchema extends Schema, TFieldPath extends RequiredPat
|
|
|
492
672
|
*
|
|
493
673
|
* @returns A submit event handler function to attach to the form element.
|
|
494
674
|
*/
|
|
495
|
-
declare function handleSubmit<TSchema extends
|
|
675
|
+
declare function handleSubmit<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, handler: SubmitHandler<TSchema>): () => Promise<void>;
|
|
496
676
|
/**
|
|
497
677
|
* Creates a submit event handler for the form that prevents default browser
|
|
498
678
|
* submission, validates the form input, and calls the provided handler if
|
|
@@ -503,13 +683,13 @@ declare function handleSubmit<TSchema extends Schema>(form: BaseFormStore<TSchem
|
|
|
503
683
|
*
|
|
504
684
|
* @returns A submit event handler function to attach to the form element.
|
|
505
685
|
*/
|
|
506
|
-
declare function handleSubmit<TSchema extends
|
|
686
|
+
declare function handleSubmit<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, handler: SubmitEventHandler<TSchema>): (event: FormEvent<HTMLFormElement>) => Promise<void>;
|
|
507
687
|
//#endregion
|
|
508
688
|
//#region src/insert/insert.d.ts
|
|
509
689
|
/**
|
|
510
690
|
* Insert array field config interface.
|
|
511
691
|
*/
|
|
512
|
-
interface InsertConfig<TSchema extends
|
|
692
|
+
interface InsertConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
|
|
513
693
|
/**
|
|
514
694
|
* The path to the field array to insert into.
|
|
515
695
|
*/
|
|
@@ -530,13 +710,13 @@ interface InsertConfig<TSchema extends Schema, TFieldArrayPath extends RequiredP
|
|
|
530
710
|
* @param form The form store containing the field array.
|
|
531
711
|
* @param config The insert configuration specifying the path, index, and initial value.
|
|
532
712
|
*/
|
|
533
|
-
declare function insert<TSchema extends
|
|
713
|
+
declare function insert<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: InsertConfig<TSchema, TFieldArrayPath>): void;
|
|
534
714
|
//#endregion
|
|
535
715
|
//#region src/move/move.d.ts
|
|
536
716
|
/**
|
|
537
717
|
* Move array field config interface.
|
|
538
718
|
*/
|
|
539
|
-
interface MoveConfig<TSchema extends
|
|
719
|
+
interface MoveConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
|
|
540
720
|
/**
|
|
541
721
|
* The path to the field array to move an item within.
|
|
542
722
|
*/
|
|
@@ -557,13 +737,38 @@ interface MoveConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPat
|
|
|
557
737
|
* @param form The form store containing the field array.
|
|
558
738
|
* @param config The move configuration specifying the path and source/destination indices.
|
|
559
739
|
*/
|
|
560
|
-
declare function move<TSchema extends
|
|
740
|
+
declare function move<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: MoveConfig<TSchema, TFieldArrayPath>): void;
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region src/pickDirty/pickDirty.d.ts
|
|
743
|
+
/**
|
|
744
|
+
* Pick dirty config interface.
|
|
745
|
+
*/
|
|
746
|
+
interface PickDirtyConfig<TValue extends object> {
|
|
747
|
+
/**
|
|
748
|
+
* The value to filter down to its dirty parts. Must be structurally
|
|
749
|
+
* compatible with the form's schema.
|
|
750
|
+
*/
|
|
751
|
+
readonly from: TValue;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Picks only the dirty parts of the given value, using the form's dirty fields
|
|
755
|
+
* as a structural mask. Arrays are treated as atomic and object keys without a
|
|
756
|
+
* dirty descendant are omitted. Returns `undefined` if no field is dirty.
|
|
757
|
+
* Useful for filtering a validated output down to its changed parts before
|
|
758
|
+
* submitting.
|
|
759
|
+
*
|
|
760
|
+
* @param form The form store providing the dirty mask.
|
|
761
|
+
* @param config The pick dirty configuration.
|
|
762
|
+
*
|
|
763
|
+
* @returns The dirty parts of the value, or `undefined`.
|
|
764
|
+
*/
|
|
765
|
+
declare function pickDirty<TSchema extends FormSchema, TValue extends object>(form: BaseFormStore<TSchema>, config: PickDirtyConfig<TValue>): DeepPartial<TValue> | undefined;
|
|
561
766
|
//#endregion
|
|
562
767
|
//#region src/remove/remove.d.ts
|
|
563
768
|
/**
|
|
564
769
|
* Remove array field config interface.
|
|
565
770
|
*/
|
|
566
|
-
interface RemoveConfig<TSchema extends
|
|
771
|
+
interface RemoveConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
|
|
567
772
|
/**
|
|
568
773
|
* The path to the field array to remove an item from.
|
|
569
774
|
*/
|
|
@@ -580,13 +785,13 @@ interface RemoveConfig<TSchema extends Schema, TFieldArrayPath extends RequiredP
|
|
|
580
785
|
* @param form The form store containing the field array.
|
|
581
786
|
* @param config The remove configuration specifying the path and index.
|
|
582
787
|
*/
|
|
583
|
-
declare function remove<TSchema extends
|
|
788
|
+
declare function remove<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: RemoveConfig<TSchema, TFieldArrayPath>): void;
|
|
584
789
|
//#endregion
|
|
585
790
|
//#region src/replace/replace.d.ts
|
|
586
791
|
/**
|
|
587
792
|
* Replace array field config interface.
|
|
588
793
|
*/
|
|
589
|
-
interface ReplaceConfig<TSchema extends
|
|
794
|
+
interface ReplaceConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
|
|
590
795
|
/**
|
|
591
796
|
* The path to the field array to replace an item within.
|
|
592
797
|
*/
|
|
@@ -606,7 +811,7 @@ interface ReplaceConfig<TSchema extends Schema, TFieldArrayPath extends Required
|
|
|
606
811
|
* @param form The form store containing the field array.
|
|
607
812
|
* @param config The replace configuration specifying the path, index, and initial input.
|
|
608
813
|
*/
|
|
609
|
-
declare function replace<TSchema extends
|
|
814
|
+
declare function replace<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: ReplaceConfig<TSchema, TFieldArrayPath>): void;
|
|
610
815
|
//#endregion
|
|
611
816
|
//#region src/reset/reset.d.ts
|
|
612
817
|
/**
|
|
@@ -629,7 +834,7 @@ interface ResetBaseConfig {
|
|
|
629
834
|
/**
|
|
630
835
|
* Reset form config interface.
|
|
631
836
|
*/
|
|
632
|
-
interface ResetFormConfig<TSchema extends
|
|
837
|
+
interface ResetFormConfig<TSchema extends FormSchema> extends ResetBaseConfig {
|
|
633
838
|
/**
|
|
634
839
|
* The path to a field. Leave undefined to reset the entire form.
|
|
635
840
|
*/
|
|
@@ -647,7 +852,7 @@ interface ResetFormConfig<TSchema extends Schema> extends ResetBaseConfig {
|
|
|
647
852
|
/**
|
|
648
853
|
* Reset field config interface.
|
|
649
854
|
*/
|
|
650
|
-
interface ResetFieldConfig<TSchema extends
|
|
855
|
+
interface ResetFieldConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> extends ResetBaseConfig {
|
|
651
856
|
/**
|
|
652
857
|
* The path to the field to reset.
|
|
653
858
|
*/
|
|
@@ -674,7 +879,7 @@ declare function reset(form: BaseFormStore): void;
|
|
|
674
879
|
* @param form The form store to reset.
|
|
675
880
|
* @param config The reset configuration specifying what to reset and what to keep.
|
|
676
881
|
*/
|
|
677
|
-
declare function reset<TSchema extends
|
|
882
|
+
declare function reset<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? ResetFieldConfig<TSchema, TFieldPath> : ResetFormConfig<TSchema>): void;
|
|
678
883
|
//#endregion
|
|
679
884
|
//#region src/setErrors/setErrors.d.ts
|
|
680
885
|
/**
|
|
@@ -693,7 +898,7 @@ interface SetFormErrorsConfig {
|
|
|
693
898
|
/**
|
|
694
899
|
* Set field errors config interface.
|
|
695
900
|
*/
|
|
696
|
-
interface SetFieldErrorsConfig<TSchema extends
|
|
901
|
+
interface SetFieldErrorsConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
697
902
|
/**
|
|
698
903
|
* The path to the field to set errors on.
|
|
699
904
|
*/
|
|
@@ -711,13 +916,13 @@ interface SetFieldErrorsConfig<TSchema extends Schema, TFieldPath extends Requir
|
|
|
711
916
|
* @param form The form store to set errors on.
|
|
712
917
|
* @param config The set errors configuration specifying the path and error messages.
|
|
713
918
|
*/
|
|
714
|
-
declare function setErrors<TSchema extends
|
|
919
|
+
declare function setErrors<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? SetFieldErrorsConfig<TSchema, TFieldPath> : SetFormErrorsConfig): void;
|
|
715
920
|
//#endregion
|
|
716
921
|
//#region src/setInput/setInput.d.ts
|
|
717
922
|
/**
|
|
718
923
|
* Set form input config interface.
|
|
719
924
|
*/
|
|
720
|
-
interface SetFormInputConfig<TSchema extends
|
|
925
|
+
interface SetFormInputConfig<TSchema extends FormSchema> {
|
|
721
926
|
/**
|
|
722
927
|
* The path to a field. Leave undefined to set the entire form input.
|
|
723
928
|
*/
|
|
@@ -730,7 +935,7 @@ interface SetFormInputConfig<TSchema extends Schema> {
|
|
|
730
935
|
/**
|
|
731
936
|
* Set field input config interface.
|
|
732
937
|
*/
|
|
733
|
-
interface SetFieldInputConfig<TSchema extends
|
|
938
|
+
interface SetFieldInputConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
734
939
|
/**
|
|
735
940
|
* The path to the field to set input on.
|
|
736
941
|
*/
|
|
@@ -750,7 +955,7 @@ interface SetFieldInputConfig<TSchema extends Schema, TFieldPath extends Require
|
|
|
750
955
|
* @param form The form store to set input on.
|
|
751
956
|
* @param config The set form input configuration specifying the new input values.
|
|
752
957
|
*/
|
|
753
|
-
declare function setInput<TSchema extends
|
|
958
|
+
declare function setInput<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, config: SetFormInputConfig<TSchema>): void;
|
|
754
959
|
/**
|
|
755
960
|
* Sets the input value of a specific field or the entire form. This updates
|
|
756
961
|
* the field value(s) and triggers validation if required by the form's
|
|
@@ -759,7 +964,7 @@ declare function setInput<TSchema extends Schema>(form: BaseFormStore<TSchema>,
|
|
|
759
964
|
* @param form The form store to set input on.
|
|
760
965
|
* @param config The set input configuration specifying the path and new value.
|
|
761
966
|
*/
|
|
762
|
-
declare function setInput<TSchema extends
|
|
967
|
+
declare function setInput<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? SetFieldInputConfig<TSchema, TFieldPath> : SetFormInputConfig<TSchema>): void;
|
|
763
968
|
//#endregion
|
|
764
969
|
//#region src/submit/submit.d.ts
|
|
765
970
|
/**
|
|
@@ -774,7 +979,7 @@ declare function submit(form: BaseFormStore): void;
|
|
|
774
979
|
/**
|
|
775
980
|
* Swap array field config interface.
|
|
776
981
|
*/
|
|
777
|
-
interface SwapConfig<TSchema extends
|
|
982
|
+
interface SwapConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
|
|
778
983
|
/**
|
|
779
984
|
* The path to the field array to swap items within.
|
|
780
985
|
*/
|
|
@@ -794,7 +999,7 @@ interface SwapConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPat
|
|
|
794
999
|
* @param form The form store containing the field array.
|
|
795
1000
|
* @param config The swap configuration specifying the path and indices to swap.
|
|
796
1001
|
*/
|
|
797
|
-
declare function swap<TSchema extends
|
|
1002
|
+
declare function swap<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: SwapConfig<TSchema, TFieldArrayPath>): void;
|
|
798
1003
|
//#endregion
|
|
799
1004
|
//#region src/validate/validate.d.ts
|
|
800
1005
|
/**
|
|
@@ -816,7 +1021,7 @@ interface ValidateFormConfig {
|
|
|
816
1021
|
*
|
|
817
1022
|
* @returns A promise resolving to the validation result.
|
|
818
1023
|
*/
|
|
819
|
-
declare function validate<TSchema extends
|
|
1024
|
+
declare function validate<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, config?: ValidateFormConfig): Promise<v.SafeParseResult<TSchema>>;
|
|
820
1025
|
//#endregion
|
|
821
1026
|
//#endregion
|
|
822
1027
|
//#region src/types/field.d.ts
|
|
@@ -852,7 +1057,7 @@ interface FieldElementProps {
|
|
|
852
1057
|
/**
|
|
853
1058
|
* Field store interface.
|
|
854
1059
|
*/
|
|
855
|
-
interface FieldStore<TSchema extends
|
|
1060
|
+
interface FieldStore<TSchema extends FormSchema = FormSchema, TFieldPath extends RequiredPath = RequiredPath> {
|
|
856
1061
|
/**
|
|
857
1062
|
* The path to the field within the form.
|
|
858
1063
|
*/
|
|
@@ -889,7 +1094,7 @@ interface FieldStore<TSchema extends Schema = Schema, TFieldPath extends Require
|
|
|
889
1094
|
/**
|
|
890
1095
|
* Field array store interface.
|
|
891
1096
|
*/
|
|
892
|
-
interface FieldArrayStore<TSchema extends
|
|
1097
|
+
interface FieldArrayStore<TSchema extends FormSchema = FormSchema, TFieldArrayPath extends RequiredPath = RequiredPath> {
|
|
893
1098
|
/**
|
|
894
1099
|
* The path to the array field within the form.
|
|
895
1100
|
*/
|
|
@@ -920,7 +1125,7 @@ interface FieldArrayStore<TSchema extends Schema = Schema, TFieldArrayPath exten
|
|
|
920
1125
|
/**
|
|
921
1126
|
* Form store interface.
|
|
922
1127
|
*/
|
|
923
|
-
interface FormStore<TSchema extends
|
|
1128
|
+
interface FormStore<TSchema extends FormSchema = FormSchema> extends BaseFormStore<TSchema> {
|
|
924
1129
|
/**
|
|
925
1130
|
* Whether the form is currently submitting.
|
|
926
1131
|
*/
|
|
@@ -958,7 +1163,7 @@ interface FormStore<TSchema extends Schema = Schema> extends BaseFormStore<TSche
|
|
|
958
1163
|
/**
|
|
959
1164
|
* Field component props interface.
|
|
960
1165
|
*/
|
|
961
|
-
interface FieldProps<TSchema extends
|
|
1166
|
+
interface FieldProps<TSchema extends FormSchema = FormSchema, TFieldPath extends RequiredPath = RequiredPath> {
|
|
962
1167
|
/**
|
|
963
1168
|
* The form store to which the field belongs.
|
|
964
1169
|
*/
|
|
@@ -981,7 +1186,7 @@ interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends Require
|
|
|
981
1186
|
*
|
|
982
1187
|
* @returns The UI of the field to be rendered.
|
|
983
1188
|
*/
|
|
984
|
-
declare function Field<TSchema extends
|
|
1189
|
+
declare function Field<TSchema extends FormSchema, TFieldPath extends RequiredPath>({
|
|
985
1190
|
of,
|
|
986
1191
|
path,
|
|
987
1192
|
children
|
|
@@ -991,7 +1196,7 @@ declare function Field<TSchema extends Schema, TFieldPath extends RequiredPath>(
|
|
|
991
1196
|
/**
|
|
992
1197
|
* FieldArray component props interface.
|
|
993
1198
|
*/
|
|
994
|
-
interface FieldArrayProps<TSchema extends
|
|
1199
|
+
interface FieldArrayProps<TSchema extends FormSchema = FormSchema, TFieldArrayPath extends RequiredPath = RequiredPath> {
|
|
995
1200
|
/**
|
|
996
1201
|
* The form store to which the field array belongs.
|
|
997
1202
|
*/
|
|
@@ -1015,7 +1220,7 @@ interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath exten
|
|
|
1015
1220
|
*
|
|
1016
1221
|
* @returns The UI of the field array to be rendered.
|
|
1017
1222
|
*/
|
|
1018
|
-
declare function FieldArray<TSchema extends
|
|
1223
|
+
declare function FieldArray<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>({
|
|
1019
1224
|
of,
|
|
1020
1225
|
path,
|
|
1021
1226
|
children
|
|
@@ -1025,7 +1230,7 @@ declare function FieldArray<TSchema extends Schema, TFieldArrayPath extends Requ
|
|
|
1025
1230
|
/**
|
|
1026
1231
|
* Form component props type.
|
|
1027
1232
|
*/
|
|
1028
|
-
type FormProps<TSchema extends
|
|
1233
|
+
type FormProps<TSchema extends FormSchema = FormSchema> = Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit" | "novalidate" | "noValidate"> & {
|
|
1029
1234
|
/**
|
|
1030
1235
|
* The form store instance.
|
|
1031
1236
|
*/
|
|
@@ -1043,13 +1248,13 @@ type FormProps<TSchema extends Schema = Schema> = Omit<FormHTMLAttributes<HTMLFo
|
|
|
1043
1248
|
*
|
|
1044
1249
|
* @returns The a native form element.
|
|
1045
1250
|
*/
|
|
1046
|
-
declare function Form<TSchema extends
|
|
1251
|
+
declare function Form<TSchema extends FormSchema>(props: FormProps<TSchema>): ReactElement;
|
|
1047
1252
|
//#endregion
|
|
1048
1253
|
//#region src/hooks/useField/useField.d.ts
|
|
1049
1254
|
/**
|
|
1050
1255
|
* Use field config interface.
|
|
1051
1256
|
*/
|
|
1052
|
-
interface UseFieldConfig<TSchema extends
|
|
1257
|
+
interface UseFieldConfig<TSchema extends FormSchema = FormSchema, TFieldPath extends RequiredPath = RequiredPath> {
|
|
1053
1258
|
/**
|
|
1054
1259
|
* The path to the field within the form schema.
|
|
1055
1260
|
*/
|
|
@@ -1063,13 +1268,13 @@ interface UseFieldConfig<TSchema extends Schema = Schema, TFieldPath extends Req
|
|
|
1063
1268
|
*
|
|
1064
1269
|
* @returns The field store with reactive properties and element props.
|
|
1065
1270
|
*/
|
|
1066
|
-
declare function useField<TSchema extends
|
|
1271
|
+
declare function useField<TSchema extends FormSchema, TFieldPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldConfig<TSchema, TFieldPath>): FieldStore<TSchema, TFieldPath>;
|
|
1067
1272
|
//#endregion
|
|
1068
1273
|
//#region src/hooks/useFieldArray/useFieldArray.d.ts
|
|
1069
1274
|
/**
|
|
1070
1275
|
* Use field array config interface.
|
|
1071
1276
|
*/
|
|
1072
|
-
interface UseFieldArrayConfig<TSchema extends
|
|
1277
|
+
interface UseFieldArrayConfig<TSchema extends FormSchema = FormSchema, TFieldArrayPath extends RequiredPath = RequiredPath> {
|
|
1073
1278
|
/**
|
|
1074
1279
|
* The path to the array field within the form schema.
|
|
1075
1280
|
*/
|
|
@@ -1083,7 +1288,7 @@ interface UseFieldArrayConfig<TSchema extends Schema = Schema, TFieldArrayPath e
|
|
|
1083
1288
|
*
|
|
1084
1289
|
* @returns The field array store with reactive properties for array management.
|
|
1085
1290
|
*/
|
|
1086
|
-
declare function useFieldArray<TSchema extends
|
|
1291
|
+
declare function useFieldArray<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldArrayConfig<TSchema, TFieldArrayPath>): FieldArrayStore<TSchema, TFieldArrayPath>;
|
|
1087
1292
|
//#endregion
|
|
1088
1293
|
//#region src/hooks/useForm/useForm.d.ts
|
|
1089
1294
|
/**
|
|
@@ -1094,6 +1299,6 @@ declare function useFieldArray<TSchema extends Schema, TFieldArrayPath extends R
|
|
|
1094
1299
|
*
|
|
1095
1300
|
* @returns The form store with reactive properties.
|
|
1096
1301
|
*/
|
|
1097
|
-
declare function useForm<TSchema extends
|
|
1302
|
+
declare function useForm<TSchema extends FormSchema>(config: FormConfig<TSchema>): FormStore<TSchema>;
|
|
1098
1303
|
//#endregion
|
|
1099
|
-
export { type DeepPartial, Field, FieldArray, FieldArrayProps, FieldArrayStore, type FieldElement, FieldElementProps, FieldProps, FieldStore, FocusFieldConfig, Form, type FormConfig, FormProps, FormStore, GetFieldErrorsConfig, GetFieldInputConfig, GetFormErrorsConfig, GetFormInputConfig, InsertConfig, MoveConfig, type PartialValues, type PathValue, RemoveConfig, ReplaceConfig, type RequiredPath, ResetFieldConfig, ResetFormConfig, type Schema, SetFieldErrorsConfig, type SetFieldInputConfig, SetFormErrorsConfig, type SetFormInputConfig, type SubmitEventHandler, type SubmitHandler, SwapConfig, UseFieldArrayConfig, UseFieldConfig, type ValidArrayPath, type ValidPath, ValidateFormConfig, type ValidationMode, focus, getAllErrors, getErrors, getInput, handleSubmit, insert, move, remove, replace, reset, setErrors, setInput, submit, swap, useField, useFieldArray, useForm, validate };
|
|
1304
|
+
export { type DeepPartial, Field, FieldArray, FieldArrayProps, FieldArrayStore, type FieldElement, FieldElementProps, FieldProps, FieldStore, FocusFieldConfig, Form, type FormConfig, FormProps, type FormSchema, FormStore, GetFieldDirtyInputConfig, GetFieldDirtyPathsConfig, GetFieldErrorsConfig, GetFieldInputConfig, GetFormDirtyInputConfig, GetFormDirtyPathsConfig, GetFormErrorsConfig, GetFormInputConfig, InsertConfig, MoveConfig, type PartialValues, type PathValue, PickDirtyConfig, RemoveConfig, ReplaceConfig, type RequiredPath, ResetFieldConfig, ResetFormConfig, type Schema, SetFieldErrorsConfig, type SetFieldInputConfig, SetFormErrorsConfig, type SetFormInputConfig, type SubmitEventHandler, type SubmitHandler, SwapConfig, UseFieldArrayConfig, UseFieldConfig, type ValidArrayPath, type ValidPath, ValidateFormConfig, type ValidationMode, focus, getAllErrors, getDirtyInput, getDirtyPaths, getErrors, getInput, handleSubmit, insert, move, pickDirty, remove, replace, reset, setErrors, setInput, submit, swap, useField, useFieldArray, useForm, validate };
|
package/dist/index.js
CHANGED
|
@@ -162,7 +162,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
162
162
|
if (internalFieldStore.kind === "object") {
|
|
163
163
|
internalFieldStore.children ??= {};
|
|
164
164
|
for (const key in schema.entries) {
|
|
165
|
-
internalFieldStore.children[key]
|
|
165
|
+
internalFieldStore.children[key] ??= {};
|
|
166
166
|
path.push(key);
|
|
167
167
|
initializeFieldStore(internalFieldStore.children[key], schema.entries[key], initialInput?.[key], path);
|
|
168
168
|
path.pop();
|
|
@@ -173,6 +173,7 @@ function initializeFieldStore(internalFieldStore, schema, initialInput, path, nu
|
|
|
173
173
|
internalFieldStore.input = /* @__PURE__ */ createSignal(objectInput);
|
|
174
174
|
}
|
|
175
175
|
} else {
|
|
176
|
+
if (internalFieldStore.kind && internalFieldStore.kind !== "value") throw new Error(`Store initialized as "${internalFieldStore.kind}" cannot be reinitialized as "value"`);
|
|
176
177
|
internalFieldStore.kind = "value";
|
|
177
178
|
if (internalFieldStore.kind === "value") {
|
|
178
179
|
internalFieldStore.initialInput = /* @__PURE__ */ createSignal(initialInput);
|
|
@@ -318,6 +319,63 @@ function swapItemState(firstInternalFieldStore, secondInternalFieldStore) {
|
|
|
318
319
|
});
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
322
|
+
* Returns whether the specified boolean property is true for the field store
|
|
323
|
+
* or any of its nested children. Recursively checks arrays and objects.
|
|
324
|
+
*
|
|
325
|
+
* @param internalFieldStore The field store to check.
|
|
326
|
+
* @param type The boolean property type to check.
|
|
327
|
+
*
|
|
328
|
+
* @returns Whether the property is true.
|
|
329
|
+
*/
|
|
330
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
331
|
+
function getFieldBool(internalFieldStore, type) {
|
|
332
|
+
if (internalFieldStore[type].value) return true;
|
|
333
|
+
if (internalFieldStore.kind === "array") {
|
|
334
|
+
for (let index = 0; index < internalFieldStore.items.value.length; index++) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[index], type)) return true;
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
if (internalFieldStore.kind == "object") {
|
|
338
|
+
for (const key in internalFieldStore.children) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[key], type)) return true;
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Returns only the dirty input of the field store. Arrays are treated as
|
|
345
|
+
* atomic and returned in full if any item is dirty, while object keys without
|
|
346
|
+
* a dirty descendant are omitted. Returns `undefined` if no descendant is
|
|
347
|
+
* dirty.
|
|
348
|
+
*
|
|
349
|
+
* @param internalFieldStore The field store to get dirty input from.
|
|
350
|
+
* @param dirtyOnly Whether to only include dirty fields. Defaults to `true`.
|
|
351
|
+
*
|
|
352
|
+
* @returns The dirty input, or `undefined` if no descendant is dirty.
|
|
353
|
+
*/
|
|
354
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
355
|
+
function getDirtyFieldInput(internalFieldStore, dirtyOnly = true) {
|
|
356
|
+
if (dirtyOnly && !/* @__PURE__ */ getFieldBool(internalFieldStore, "isDirty")) return;
|
|
357
|
+
if (internalFieldStore.kind === "array") {
|
|
358
|
+
if (internalFieldStore.input.value) {
|
|
359
|
+
const value = [];
|
|
360
|
+
for (let index = 0; index < internalFieldStore.items.value.length; index++) value[index] = /* @__PURE__ */ getDirtyFieldInput(internalFieldStore.children[index], false);
|
|
361
|
+
return value;
|
|
362
|
+
}
|
|
363
|
+
return internalFieldStore.input.value;
|
|
364
|
+
}
|
|
365
|
+
if (internalFieldStore.kind === "object") {
|
|
366
|
+
if (internalFieldStore.input.value) {
|
|
367
|
+
const value = {};
|
|
368
|
+
for (const key in internalFieldStore.children) {
|
|
369
|
+
const child = internalFieldStore.children[key];
|
|
370
|
+
if (!dirtyOnly || /* @__PURE__ */ getFieldBool(child, "isDirty")) value[key] = /* @__PURE__ */ getDirtyFieldInput(child, dirtyOnly);
|
|
371
|
+
}
|
|
372
|
+
return value;
|
|
373
|
+
}
|
|
374
|
+
return internalFieldStore.input.value;
|
|
375
|
+
}
|
|
376
|
+
return internalFieldStore.input.value;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
321
379
|
* Returns the current input of the field store. For arrays and objects,
|
|
322
380
|
* recursively collects input from all children. Returns `null` or `undefined`
|
|
323
381
|
* for nullish array/object inputs, or the primitive value for value fields.
|
|
@@ -374,28 +432,6 @@ function getElementInput(element, internalFieldStore) {
|
|
|
374
432
|
return element.value;
|
|
375
433
|
}
|
|
376
434
|
/**
|
|
377
|
-
* Returns whether the specified boolean property is true for the field store
|
|
378
|
-
* or any of its nested children. Recursively checks arrays and objects.
|
|
379
|
-
*
|
|
380
|
-
* @param internalFieldStore The field store to check.
|
|
381
|
-
* @param type The boolean property type to check.
|
|
382
|
-
*
|
|
383
|
-
* @returns Whether the property is true.
|
|
384
|
-
*/
|
|
385
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
386
|
-
function getFieldBool(internalFieldStore, type) {
|
|
387
|
-
if (internalFieldStore[type].value) return true;
|
|
388
|
-
if (internalFieldStore.kind === "array") {
|
|
389
|
-
for (let index = 0; index < internalFieldStore.items.value.length; index++) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[index], type)) return true;
|
|
390
|
-
return false;
|
|
391
|
-
}
|
|
392
|
-
if (internalFieldStore.kind == "object") {
|
|
393
|
-
for (const key in internalFieldStore.children) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[key], type)) return true;
|
|
394
|
-
return false;
|
|
395
|
-
}
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
435
|
* Returns the field store at the specified path by traversing the form store's
|
|
400
436
|
* children hierarchy.
|
|
401
437
|
*
|
|
@@ -652,6 +688,17 @@ function getAllErrors(form) {
|
|
|
652
688
|
return allErrors;
|
|
653
689
|
}
|
|
654
690
|
/* @__NO_SIDE_EFFECTS__ */
|
|
691
|
+
function getDirtyInput(form, config) {
|
|
692
|
+
return getDirtyFieldInput(config?.path ? getFieldStore(form[INTERNAL], config.path) : form[INTERNAL]);
|
|
693
|
+
}
|
|
694
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
695
|
+
function getDirtyPaths(form, config) {
|
|
696
|
+
config?.path ? getFieldStore(form[INTERNAL], config.path) : form[INTERNAL];
|
|
697
|
+
const paths = [];
|
|
698
|
+
config?.path && [...config.path];
|
|
699
|
+
return paths;
|
|
700
|
+
}
|
|
701
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
655
702
|
function getErrors(form, config) {
|
|
656
703
|
return (config?.path ? getFieldStore(form[INTERNAL], config.path) : form[INTERNAL]).errors.value;
|
|
657
704
|
}
|
|
@@ -749,6 +796,48 @@ function move(form, config) {
|
|
|
749
796
|
});
|
|
750
797
|
}
|
|
751
798
|
/**
|
|
799
|
+
* Picks only the dirty parts of the given value, using the form's dirty fields
|
|
800
|
+
* as a structural mask. Arrays are treated as atomic and object keys without a
|
|
801
|
+
* dirty descendant are omitted. Returns `undefined` if no field is dirty.
|
|
802
|
+
* Useful for filtering a validated output down to its changed parts before
|
|
803
|
+
* submitting.
|
|
804
|
+
*
|
|
805
|
+
* @param form The form store providing the dirty mask.
|
|
806
|
+
* @param config The pick dirty configuration.
|
|
807
|
+
*
|
|
808
|
+
* @returns The dirty parts of the value, or `undefined`.
|
|
809
|
+
*/
|
|
810
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
811
|
+
function pickDirty(form, config) {
|
|
812
|
+
if (!getFieldBool(form[INTERNAL], "isDirty")) return;
|
|
813
|
+
const result = /* @__PURE__ */ pickFieldValue(form[INTERNAL], config.from);
|
|
814
|
+
return Object.keys(result).length ? result : void 0;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Recursively picks the dirty parts of a value using the field store as a
|
|
818
|
+
* structural mask, reading from the supplied value rather than the form's own
|
|
819
|
+
* input. Objects with non-nullish input recurse into their dirty children that
|
|
820
|
+
* are present in the value, while arrays, primitives, nullish-cleared fields
|
|
821
|
+
* and shape-diverging values are returned as-is.
|
|
822
|
+
*
|
|
823
|
+
* @param internalFieldStore The field store used as the dirty mask.
|
|
824
|
+
* @param value The value to pick the dirty parts from.
|
|
825
|
+
*
|
|
826
|
+
* @returns The dirty parts of the value.
|
|
827
|
+
*/
|
|
828
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
829
|
+
function pickFieldValue(internalFieldStore, value) {
|
|
830
|
+
if (internalFieldStore.kind === "object" && internalFieldStore.input.value && value && typeof value === "object" && !Array.isArray(value)) {
|
|
831
|
+
const result = {};
|
|
832
|
+
for (const key in internalFieldStore.children) {
|
|
833
|
+
const child = internalFieldStore.children[key];
|
|
834
|
+
if (getFieldBool(child, "isDirty") && key in value) result[key] = /* @__PURE__ */ pickFieldValue(child, value[key]);
|
|
835
|
+
}
|
|
836
|
+
return result;
|
|
837
|
+
}
|
|
838
|
+
return value;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
752
841
|
* Removes an item from a field array at the specified index. All items after
|
|
753
842
|
* the removed item are shifted down by one index.
|
|
754
843
|
*
|
|
@@ -794,7 +883,7 @@ function reset(form, config) {
|
|
|
794
883
|
untrack(() => {
|
|
795
884
|
const internalFormStore = form[INTERNAL];
|
|
796
885
|
const internalFieldStore = config?.path ? getFieldStore(internalFormStore, config.path) : internalFormStore;
|
|
797
|
-
if (config
|
|
886
|
+
if (config && "initialInput" in config) setInitialFieldInput(internalFieldStore, config.initialInput);
|
|
798
887
|
walkFieldStore(internalFieldStore, (internalFieldStore$1) => {
|
|
799
888
|
internalFieldStore$1.elements = internalFieldStore$1.initialElements;
|
|
800
889
|
if (!config?.keepErrors) internalFieldStore$1.errors.value = null;
|
|
@@ -1069,4 +1158,4 @@ function Form({ of, onSubmit, ...other }) {
|
|
|
1069
1158
|
}
|
|
1070
1159
|
|
|
1071
1160
|
//#endregion
|
|
1072
|
-
export { Field, FieldArray, Form, focus, getAllErrors, getErrors, getInput, handleSubmit, insert, move, remove, replace, reset, setErrors, setInput, submit, swap, useField, useFieldArray, useForm, validate };
|
|
1161
|
+
export { Field, FieldArray, Form, focus, getAllErrors, getDirtyInput, getDirtyPaths, getErrors, getInput, handleSubmit, insert, move, pickDirty, remove, replace, reset, setErrors, setInput, submit, swap, useField, useFieldArray, useForm, validate };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formisch/react",
|
|
3
|
-
"description": "The
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "The lightweight, schema-first, and fully type-safe form library for React",
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabian Hiller",
|
|
7
7
|
"homepage": "https://formisch.dev",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsdown",
|
|
37
|
+
"test": "vitest run --typecheck",
|
|
37
38
|
"lint": "eslint \"src/**/*.ts*\" && tsc --noEmit",
|
|
38
39
|
"lint.fix": "eslint \"src/**/*.ts*\" --fix",
|
|
39
40
|
"format": "prettier --write ./src",
|
|
@@ -43,25 +44,31 @@
|
|
|
43
44
|
"@formisch/core": "workspace:*",
|
|
44
45
|
"@formisch/eslint-config": "workspace:*",
|
|
45
46
|
"@formisch/methods": "workspace:*",
|
|
47
|
+
"@testing-library/dom": "^10.4.0",
|
|
48
|
+
"@testing-library/jest-dom": "^6.6.0",
|
|
49
|
+
"@testing-library/react": "^16.3.0",
|
|
46
50
|
"@types/node": "^24.10.1",
|
|
47
51
|
"@types/react": "^19.2.5",
|
|
48
52
|
"@types/react-dom": "^19.2.3",
|
|
49
53
|
"@vitejs/plugin-react": "^5.1.1",
|
|
54
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
50
55
|
"eslint": "^9.39.1",
|
|
51
56
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
52
57
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
53
58
|
"globals": "^16.5.0",
|
|
59
|
+
"jsdom": "^26.1.0",
|
|
54
60
|
"react": "^19.2.1",
|
|
55
61
|
"react-dom": "^19.2.1",
|
|
56
62
|
"tsdown": "^0.16.8",
|
|
57
63
|
"typescript": "~5.9.3",
|
|
58
|
-
"vite": "^7.2.4"
|
|
64
|
+
"vite": "^7.2.4",
|
|
65
|
+
"vitest": "^3.2.4"
|
|
59
66
|
},
|
|
60
67
|
"peerDependencies": {
|
|
61
68
|
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
62
69
|
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
63
70
|
"typescript": ">=5",
|
|
64
|
-
"valibot": "^1.
|
|
71
|
+
"valibot": "^1.4.1"
|
|
65
72
|
},
|
|
66
73
|
"peerDependenciesMeta": {
|
|
67
74
|
"typescript": {
|