@formisch/qwik 0.10.1 → 0.11.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 CHANGED
@@ -64,7 +64,11 @@ In addition, Formisch offers several functions (we call them "methods") that can
64
64
 
65
65
  ## Comparison
66
66
 
67
- 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. The result is a small bundle size and native performance for any UI update. This feature, along with a few others, distinguishes Formisch from other form libraries. My vision for Formisch is to create a framework-agnostic platform similar to [Vite](https://vite.dev/), but for forms.
67
+ 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.
68
+
69
+ ## Vision
70
+
71
+ 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.
68
72
 
69
73
  ## Partners
70
74
 
package/dist/index.d.ts CHANGED
@@ -9,6 +9,31 @@ import * as _qwik_dev_core_internal0 from "@qwik.dev/core/internal";
9
9
  * Schema type.
10
10
  */
11
11
  type Schema = v.GenericSchema | v.GenericSchemaAsync;
12
+ /**
13
+ * Object schema type.
14
+ */
15
+ 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>;
16
+ /**
17
+ * Object schema async type.
18
+ */
19
+ 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>;
20
+ /**
21
+ * Object root schema type.
22
+ */
23
+ type ObjectRootSchema = ObjectSchema | v.IntersectSchema<ObjectSchema[], v.ErrorMessage<v.IntersectIssue> | undefined> | v.UnionSchema<ObjectSchema[], v.ErrorMessage<v.UnionIssue<v.BaseIssue<unknown>>> | undefined>;
24
+ /**
25
+ * Object root schema async type.
26
+ */
27
+ type ObjectRootSchemaAsync = ObjectSchemaAsync | v.IntersectSchemaAsync<(ObjectSchema | ObjectSchemaAsync)[], v.ErrorMessage<v.IntersectIssue> | undefined> | v.UnionSchemaAsync<(ObjectSchema | ObjectSchemaAsync)[], v.ErrorMessage<v.UnionIssue<v.BaseIssue<unknown>>> | undefined>;
28
+ /**
29
+ * Form schema type.
30
+ *
31
+ * Hint: Forms must have an object root, so only object schemas (sync or async),
32
+ * combinators (intersect, union, variant) whose options resolve to objects, and
33
+ * `lazy` schemas wrapping any of these are allowed at the top level. Use
34
+ * {@link Schema} for nested field schemas.
35
+ */
36
+ type FormSchema = ObjectRootSchema | ObjectRootSchemaAsync | v.LazySchema<ObjectRootSchema> | v.LazySchemaAsync<ObjectRootSchema | ObjectRootSchemaAsync>;
12
37
  //#endregion
13
38
  //#region src/types/signal/signal.d.ts
14
39
  /**
@@ -231,17 +256,17 @@ type ValidationMode = "initial" | "touch" | "input" | "change" | "blur" | "submi
231
256
  /**
232
257
  * Submit handler type.
233
258
  */
234
- type SubmitHandler<TSchema extends Schema> = (output: v.InferOutput<TSchema>) => MaybePromise<unknown>;
259
+ type SubmitHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>) => MaybePromise<unknown>;
235
260
  /**
236
261
  * Submit event handler type.
237
262
  */
238
- type SubmitEventHandler<TSchema extends Schema> = (output: v.InferOutput<TSchema>, event: SubmitEvent) => MaybePromise<unknown>;
263
+ type SubmitEventHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>, event: SubmitEvent) => MaybePromise<unknown>;
239
264
  //#endregion
240
265
  //#region src/types/form/form.qwik.d.ts
241
266
  /**
242
267
  * Form config interface.
243
268
  */
244
- interface FormConfig<TSchema extends Schema = Schema> {
269
+ interface FormConfig<TSchema extends FormSchema = FormSchema> {
245
270
  /**
246
271
  * The schema of the form.
247
272
  */
@@ -262,7 +287,7 @@ interface FormConfig<TSchema extends Schema = Schema> {
262
287
  /**
263
288
  * Internal form store interface.
264
289
  */
265
- interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObjectStore {
290
+ interface InternalFormStore<TSchema extends FormSchema = FormSchema> extends InternalObjectStore {
266
291
  /**
267
292
  * The element of the form.
268
293
  */
@@ -299,7 +324,7 @@ interface InternalFormStore<TSchema extends Schema = Schema> extends InternalObj
299
324
  /**
300
325
  * Base form store interface.
301
326
  */
302
- interface BaseFormStore<TSchema extends Schema = Schema> {
327
+ interface BaseFormStore<TSchema extends FormSchema = FormSchema> {
303
328
  /**
304
329
  * The internal form store.
305
330
  *
@@ -409,6 +434,28 @@ type LazyArrayPath<TValue, TPathToCheck extends Path, TValidPath extends Path =
409
434
  * based on the given value.
410
435
  */
411
436
  type ValidArrayPath<TValue, TPath extends RequiredPath> = TPath extends LazyArrayPath<Required<TValue>, TPath> ? TPath : LazyArrayPath<Required<TValue>, TPath>;
437
+ /**
438
+ * Recursive helper for `DirtyPath` that prepends `TKey` to each deeper path,
439
+ * or falls through to `never` when the child is not an object.
440
+ */
441
+ type DeepDirtyPath<TChild, TKey$1 extends PathKey, TDepth extends 0[]> = TChild extends Record<PropertyKey, unknown> ? readonly [TKey$1, ...DirtyPath<TChild, [...TDepth, 0]>] : never;
442
+ /**
443
+ * Returns the union of all `RequiredPath`s that `getDirtyPaths` can emit
444
+ * for a given input type. Object fields contribute their own path and the
445
+ * paths of their descendants; arrays and tuples are atomic and contribute
446
+ * only their own path, because dirty arrays are returned as complete units.
447
+ *
448
+ * Narrowing is exact for the first 5 levels of nesting; deeper paths fall
449
+ * back to `RequiredPath` to keep the result a complete superset of any
450
+ * path the runtime can address.
451
+ *
452
+ * Hint: Arrays and tuples are atomic because they don't structurally
453
+ * extend `Record<PropertyKey, unknown>` and so fall through to `never`
454
+ * via `DeepDirtyPath` — no explicit array check is needed. `TDepth` is
455
+ * a tuple-length counter capped at 5 to bound TypeScript instantiation
456
+ * cost.
457
+ */
458
+ 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;
412
459
  //#endregion
413
460
  //#region src/array/copyItemState/copyItemState.d.ts
414
461
  /**
@@ -427,7 +474,7 @@ type ValidArrayPath<TValue, TPath extends RequiredPath> = TPath extends LazyArra
427
474
  /**
428
475
  * Focus field config interface.
429
476
  */
430
- interface FocusFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPath> {
477
+ interface FocusFieldConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
431
478
  /**
432
479
  * The path to the field to focus.
433
480
  */
@@ -441,7 +488,7 @@ interface FocusFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPa
441
488
  * @param form The form store containing the field.
442
489
  * @param config The focus field configuration.
443
490
  */
444
- declare function focus<TSchema extends Schema, TFieldPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: FocusFieldConfig<TSchema, TFieldPath>): void;
491
+ declare function focus<TSchema extends FormSchema, TFieldPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: FocusFieldConfig<TSchema, TFieldPath>): void;
445
492
  //#endregion
446
493
  //#region src/getAllErrors/getAllErrors.d.ts
447
494
  /**
@@ -455,6 +502,93 @@ declare function focus<TSchema extends Schema, TFieldPath extends RequiredPath>(
455
502
  */
456
503
  declare function getAllErrors(form: BaseFormStore): [string, ...string[]] | null;
457
504
  //#endregion
505
+ //#region src/getDirtyInput/getDirtyInput.d.ts
506
+ /**
507
+ * Get form dirty input config interface.
508
+ */
509
+ interface GetFormDirtyInputConfig {
510
+ /**
511
+ * The path to a field. Leave undefined to get the dirty input of the entire
512
+ * form.
513
+ */
514
+ readonly path?: undefined;
515
+ }
516
+ /**
517
+ * Get field dirty input config interface.
518
+ */
519
+ interface GetFieldDirtyInputConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
520
+ /**
521
+ * The path to the field to retrieve the dirty input from.
522
+ */
523
+ readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
524
+ }
525
+ /**
526
+ * Retrieves only the dirty input values of a specific field or the entire
527
+ * form. Arrays are treated as atomic and returned in full if any item is
528
+ * dirty, while object keys without a dirty descendant are omitted. Returns
529
+ * `undefined` if no field in the inspected subtree is dirty.
530
+ *
531
+ * @param form The form store to retrieve dirty input from.
532
+ *
533
+ * @returns The dirty input of the form or specified field, or `undefined`.
534
+ */
535
+ declare function getDirtyInput<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): DeepPartial<v.InferInput<TSchema>> | undefined;
536
+ /**
537
+ * Retrieves only the dirty input values of a specific field or the entire
538
+ * form. Arrays are treated as atomic and returned in full if any item is
539
+ * dirty, while object keys without a dirty descendant are omitted. Returns
540
+ * `undefined` if no field in the inspected subtree is dirty.
541
+ *
542
+ * @param form The form store to retrieve dirty input from.
543
+ * @param config The get dirty input configuration.
544
+ *
545
+ * @returns The dirty input of the form or specified field, or `undefined`.
546
+ */
547
+ 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;
548
+ //#endregion
549
+ //#region src/getDirtyPaths/getDirtyPaths.d.ts
550
+ /**
551
+ * Get form dirty paths config interface.
552
+ */
553
+ interface GetFormDirtyPathsConfig {
554
+ /**
555
+ * The path to a field. Leave undefined to inspect the entire form.
556
+ */
557
+ readonly path?: undefined;
558
+ }
559
+ /**
560
+ * Get field dirty paths config interface.
561
+ */
562
+ interface GetFieldDirtyPathsConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
563
+ /**
564
+ * The path to the field to inspect.
565
+ */
566
+ readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
567
+ }
568
+ /**
569
+ * Returns a list of paths to the dirty fields of a specific field or the
570
+ * entire form. Arrays are treated as atomic and contribute only their own
571
+ * path if any item is dirty, while object branches are recursed into. Returns
572
+ * an empty list if no field in the inspected subtree is dirty.
573
+ *
574
+ * @param form The form store to inspect.
575
+ *
576
+ * @returns The list of paths to the dirty fields.
577
+ */
578
+ declare function getDirtyPaths<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): DirtyPath<v.InferInput<TSchema>>[];
579
+ /**
580
+ * Returns a list of paths to the dirty fields of a specific field or the
581
+ * entire form. Arrays are treated as atomic and contribute only their own
582
+ * path if any item is dirty, while object branches are recursed into. Returns
583
+ * an empty list if no field in the inspected subtree is dirty.
584
+ *
585
+ * @param form The form store to inspect.
586
+ * @param config The get dirty paths configuration.
587
+ *
588
+ * @returns The list of paths to the dirty fields.
589
+ */
590
+ 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>>[];
591
+ //#endregion
458
592
  //#region src/getErrors/getErrors.d.ts
459
593
  /**
460
594
  * Get form errors config interface.
@@ -468,7 +602,7 @@ interface GetFormErrorsConfig {
468
602
  /**
469
603
  * Get field errors config interface.
470
604
  */
471
- interface GetFieldErrorsConfig<TSchema extends Schema, TFieldPath extends RequiredPath> {
605
+ interface GetFieldErrorsConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
472
606
  /**
473
607
  * The path to the field to retrieve errors from.
474
608
  */
@@ -483,7 +617,7 @@ interface GetFieldErrorsConfig<TSchema extends Schema, TFieldPath extends Requir
483
617
  *
484
618
  * @returns A non-empty array of error messages, or null if no errors exist.
485
619
  */
486
- declare function getErrors<TSchema extends Schema>(form: BaseFormStore<TSchema>): [string, ...string[]] | null;
620
+ declare function getErrors<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): [string, ...string[]] | null;
487
621
  /**
488
622
  * Retrieves error messages from the form. When called without a config,
489
623
  * returns form-level errors. When called with a path, returns errors for
@@ -494,7 +628,7 @@ declare function getErrors<TSchema extends Schema>(form: BaseFormStore<TSchema>)
494
628
  *
495
629
  * @returns A non-empty array of error messages, or null if no errors exist.
496
630
  */
497
- declare function getErrors<TSchema extends Schema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? GetFieldErrorsConfig<TSchema, TFieldPath> : GetFormErrorsConfig): [string, ...string[]] | null;
631
+ 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;
498
632
  //#endregion
499
633
  //#region src/getInput/getInput.d.ts
500
634
  /**
@@ -509,7 +643,7 @@ interface GetFormInputConfig {
509
643
  /**
510
644
  * Get field input config interface.
511
645
  */
512
- interface GetFieldInputConfig<TSchema extends Schema, TFieldPath extends RequiredPath> {
646
+ interface GetFieldInputConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
513
647
  /**
514
648
  * The path to the field to retrieve input from.
515
649
  */
@@ -523,7 +657,7 @@ interface GetFieldInputConfig<TSchema extends Schema, TFieldPath extends Require
523
657
  *
524
658
  * @returns The partial input values of the form or the specified field.
525
659
  */
526
- declare function getInput<TSchema extends Schema>(form: BaseFormStore<TSchema>): PartialValues<v.InferInput<TSchema>>;
660
+ declare function getInput<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): PartialValues<v.InferInput<TSchema>>;
527
661
  /**
528
662
  * Retrieves the current input value of a specific field or the entire form.
529
663
  * Returns a partial object as not all fields may have been set.
@@ -533,7 +667,7 @@ declare function getInput<TSchema extends Schema>(form: BaseFormStore<TSchema>):
533
667
  *
534
668
  * @returns The partial input values of the form or the specified field.
535
669
  */
536
- declare function getInput<TSchema extends Schema, 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>>;
670
+ 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>>;
537
671
  //#endregion
538
672
  //#region src/handleSubmit/handleSubmit.d.ts
539
673
  /**
@@ -546,7 +680,7 @@ declare function getInput<TSchema extends Schema, TFieldPath extends RequiredPat
546
680
  *
547
681
  * @returns A submit event handler function to attach to the form element.
548
682
  */
549
- declare function handleSubmit<TSchema extends Schema>(form: BaseFormStore<TSchema>, handler: SubmitHandler<TSchema>): () => Promise<void>;
683
+ declare function handleSubmit<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, handler: SubmitHandler<TSchema>): () => Promise<void>;
550
684
  /**
551
685
  * Creates a submit event handler for the form that prevents default browser
552
686
  * submission, validates the form input, and calls the provided handler if
@@ -557,13 +691,13 @@ declare function handleSubmit<TSchema extends Schema>(form: BaseFormStore<TSchem
557
691
  *
558
692
  * @returns A submit event handler function to attach to the form element.
559
693
  */
560
- declare function handleSubmit<TSchema extends Schema>(form: BaseFormStore<TSchema>, handler: SubmitEventHandler<TSchema>): (event: SubmitEvent) => Promise<void>;
694
+ declare function handleSubmit<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, handler: SubmitEventHandler<TSchema>): (event: SubmitEvent) => Promise<void>;
561
695
  //#endregion
562
696
  //#region src/insert/insert.d.ts
563
697
  /**
564
698
  * Insert array field config interface.
565
699
  */
566
- interface InsertConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPath> {
700
+ interface InsertConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
567
701
  /**
568
702
  * The path to the field array to insert into.
569
703
  */
@@ -584,13 +718,13 @@ interface InsertConfig<TSchema extends Schema, TFieldArrayPath extends RequiredP
584
718
  * @param form The form store containing the field array.
585
719
  * @param config The insert configuration specifying the path, index, and initial value.
586
720
  */
587
- declare function insert<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: InsertConfig<TSchema, TFieldArrayPath>): void;
721
+ declare function insert<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: InsertConfig<TSchema, TFieldArrayPath>): void;
588
722
  //#endregion
589
723
  //#region src/move/move.d.ts
590
724
  /**
591
725
  * Move array field config interface.
592
726
  */
593
- interface MoveConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPath> {
727
+ interface MoveConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
594
728
  /**
595
729
  * The path to the field array to move an item within.
596
730
  */
@@ -611,13 +745,38 @@ interface MoveConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPat
611
745
  * @param form The form store containing the field array.
612
746
  * @param config The move configuration specifying the path and source/destination indices.
613
747
  */
614
- declare function move<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: MoveConfig<TSchema, TFieldArrayPath>): void;
748
+ declare function move<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: MoveConfig<TSchema, TFieldArrayPath>): void;
749
+ //#endregion
750
+ //#region src/pickDirty/pickDirty.d.ts
751
+ /**
752
+ * Pick dirty config interface.
753
+ */
754
+ interface PickDirtyConfig<TValue extends object> {
755
+ /**
756
+ * The value to filter down to its dirty parts. Must be structurally
757
+ * compatible with the form's schema.
758
+ */
759
+ readonly from: TValue;
760
+ }
761
+ /**
762
+ * Picks only the dirty parts of the given value, using the form's dirty fields
763
+ * as a structural mask. Arrays are treated as atomic and object keys without a
764
+ * dirty descendant are omitted. Returns `undefined` if no field is dirty.
765
+ * Useful for filtering a validated output down to its changed parts before
766
+ * submitting.
767
+ *
768
+ * @param form The form store providing the dirty mask.
769
+ * @param config The pick dirty configuration.
770
+ *
771
+ * @returns The dirty parts of the value, or `undefined`.
772
+ */
773
+ declare function pickDirty<TSchema extends FormSchema, TValue extends object>(form: BaseFormStore<TSchema>, config: PickDirtyConfig<TValue>): DeepPartial<TValue> | undefined;
615
774
  //#endregion
616
775
  //#region src/remove/remove.d.ts
617
776
  /**
618
777
  * Remove array field config interface.
619
778
  */
620
- interface RemoveConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPath> {
779
+ interface RemoveConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
621
780
  /**
622
781
  * The path to the field array to remove an item from.
623
782
  */
@@ -634,13 +793,13 @@ interface RemoveConfig<TSchema extends Schema, TFieldArrayPath extends RequiredP
634
793
  * @param form The form store containing the field array.
635
794
  * @param config The remove configuration specifying the path and index.
636
795
  */
637
- declare function remove<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: RemoveConfig<TSchema, TFieldArrayPath>): void;
796
+ declare function remove<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: RemoveConfig<TSchema, TFieldArrayPath>): void;
638
797
  //#endregion
639
798
  //#region src/replace/replace.d.ts
640
799
  /**
641
800
  * Replace array field config interface.
642
801
  */
643
- interface ReplaceConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPath> {
802
+ interface ReplaceConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
644
803
  /**
645
804
  * The path to the field array to replace an item within.
646
805
  */
@@ -660,7 +819,7 @@ interface ReplaceConfig<TSchema extends Schema, TFieldArrayPath extends Required
660
819
  * @param form The form store containing the field array.
661
820
  * @param config The replace configuration specifying the path, index, and initial input.
662
821
  */
663
- declare function replace<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: ReplaceConfig<TSchema, TFieldArrayPath>): void;
822
+ declare function replace<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: ReplaceConfig<TSchema, TFieldArrayPath>): void;
664
823
  //#endregion
665
824
  //#region src/reset/reset.d.ts
666
825
  /**
@@ -683,7 +842,7 @@ interface ResetBaseConfig {
683
842
  /**
684
843
  * Reset form config interface.
685
844
  */
686
- interface ResetFormConfig<TSchema extends Schema> extends ResetBaseConfig {
845
+ interface ResetFormConfig<TSchema extends FormSchema> extends ResetBaseConfig {
687
846
  /**
688
847
  * The path to a field. Leave undefined to reset the entire form.
689
848
  */
@@ -701,7 +860,7 @@ interface ResetFormConfig<TSchema extends Schema> extends ResetBaseConfig {
701
860
  /**
702
861
  * Reset field config interface.
703
862
  */
704
- interface ResetFieldConfig<TSchema extends Schema, TFieldPath extends RequiredPath> extends ResetBaseConfig {
863
+ interface ResetFieldConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> extends ResetBaseConfig {
705
864
  /**
706
865
  * The path to the field to reset.
707
866
  */
@@ -728,7 +887,7 @@ declare function reset(form: BaseFormStore): void;
728
887
  * @param form The form store to reset.
729
888
  * @param config The reset configuration specifying what to reset and what to keep.
730
889
  */
731
- declare function reset<TSchema extends Schema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? ResetFieldConfig<TSchema, TFieldPath> : ResetFormConfig<TSchema>): void;
890
+ declare function reset<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? ResetFieldConfig<TSchema, TFieldPath> : ResetFormConfig<TSchema>): void;
732
891
  //#endregion
733
892
  //#region src/setErrors/setErrors.d.ts
734
893
  /**
@@ -747,7 +906,7 @@ interface SetFormErrorsConfig {
747
906
  /**
748
907
  * Set field errors config interface.
749
908
  */
750
- interface SetFieldErrorsConfig<TSchema extends Schema, TFieldPath extends RequiredPath> {
909
+ interface SetFieldErrorsConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
751
910
  /**
752
911
  * The path to the field to set errors on.
753
912
  */
@@ -765,13 +924,13 @@ interface SetFieldErrorsConfig<TSchema extends Schema, TFieldPath extends Requir
765
924
  * @param form The form store to set errors on.
766
925
  * @param config The set errors configuration specifying the path and error messages.
767
926
  */
768
- declare function setErrors<TSchema extends Schema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? SetFieldErrorsConfig<TSchema, TFieldPath> : SetFormErrorsConfig): void;
927
+ declare function setErrors<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? SetFieldErrorsConfig<TSchema, TFieldPath> : SetFormErrorsConfig): void;
769
928
  //#endregion
770
929
  //#region src/setInput/setInput.d.ts
771
930
  /**
772
931
  * Set form input config interface.
773
932
  */
774
- interface SetFormInputConfig<TSchema extends Schema> {
933
+ interface SetFormInputConfig<TSchema extends FormSchema> {
775
934
  /**
776
935
  * The path to a field. Leave undefined to set the entire form input.
777
936
  */
@@ -784,7 +943,7 @@ interface SetFormInputConfig<TSchema extends Schema> {
784
943
  /**
785
944
  * Set field input config interface.
786
945
  */
787
- interface SetFieldInputConfig<TSchema extends Schema, TFieldPath extends RequiredPath> {
946
+ interface SetFieldInputConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
788
947
  /**
789
948
  * The path to the field to set input on.
790
949
  */
@@ -802,7 +961,7 @@ interface SetFieldInputConfig<TSchema extends Schema, TFieldPath extends Require
802
961
  * @param form The form store to set input on.
803
962
  * @param config The set form input configuration specifying the new input values.
804
963
  */
805
- declare function setInput<TSchema extends Schema>(form: BaseFormStore<TSchema>, config: SetFormInputConfig<TSchema>): void;
964
+ declare function setInput<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, config: SetFormInputConfig<TSchema>): void;
806
965
  /**
807
966
  * Sets the input value of a specific field or the entire form. This updates
808
967
  * the field value(s) and triggers validation if required by the form's
@@ -811,7 +970,7 @@ declare function setInput<TSchema extends Schema>(form: BaseFormStore<TSchema>,
811
970
  * @param form The form store to set input on.
812
971
  * @param config The set input configuration specifying the path and new value.
813
972
  */
814
- declare function setInput<TSchema extends Schema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? SetFieldInputConfig<TSchema, TFieldPath> : SetFormInputConfig<TSchema>): void;
973
+ declare function setInput<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? SetFieldInputConfig<TSchema, TFieldPath> : SetFormInputConfig<TSchema>): void;
815
974
  //#endregion
816
975
  //#region src/submit/submit.d.ts
817
976
  /**
@@ -826,7 +985,7 @@ declare function submit(form: BaseFormStore): void;
826
985
  /**
827
986
  * Swap array field config interface.
828
987
  */
829
- interface SwapConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPath> {
988
+ interface SwapConfig<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath> {
830
989
  /**
831
990
  * The path to the field array to swap items within.
832
991
  */
@@ -846,7 +1005,7 @@ interface SwapConfig<TSchema extends Schema, TFieldArrayPath extends RequiredPat
846
1005
  * @param form The form store containing the field array.
847
1006
  * @param config The swap configuration specifying the path and indices to swap.
848
1007
  */
849
- declare function swap<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: SwapConfig<TSchema, TFieldArrayPath>): void;
1008
+ declare function swap<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: SwapConfig<TSchema, TFieldArrayPath>): void;
850
1009
  //#endregion
851
1010
  //#region src/validate/validate.d.ts
852
1011
  /**
@@ -868,7 +1027,7 @@ interface ValidateFormConfig {
868
1027
  *
869
1028
  * @returns A promise resolving to the validation result.
870
1029
  */
871
- declare function validate<TSchema extends Schema>(form: BaseFormStore<TSchema>, config?: ValidateFormConfig): Promise<v.SafeParseResult<TSchema>>;
1030
+ declare function validate<TSchema extends FormSchema>(form: BaseFormStore<TSchema>, config?: ValidateFormConfig): Promise<v.SafeParseResult<TSchema>>;
872
1031
  //#endregion
873
1032
  //#endregion
874
1033
  //#region src/types/field.d.ts
@@ -908,7 +1067,7 @@ interface FieldElementProps {
908
1067
  /**
909
1068
  * Field store interface.
910
1069
  */
911
- interface FieldStore<TSchema extends Schema = Schema, TFieldPath extends RequiredPath = RequiredPath> {
1070
+ interface FieldStore<TSchema extends FormSchema = FormSchema, TFieldPath extends RequiredPath = RequiredPath> {
912
1071
  /**
913
1072
  * The path to the field within the form.
914
1073
  */
@@ -945,7 +1104,7 @@ interface FieldStore<TSchema extends Schema = Schema, TFieldPath extends Require
945
1104
  /**
946
1105
  * Field array store interface.
947
1106
  */
948
- interface FieldArrayStore<TSchema extends Schema = Schema, TFieldArrayPath extends RequiredPath = RequiredPath> {
1107
+ interface FieldArrayStore<TSchema extends FormSchema = FormSchema, TFieldArrayPath extends RequiredPath = RequiredPath> {
949
1108
  /**
950
1109
  * The path to the array field within the form.
951
1110
  */
@@ -976,7 +1135,7 @@ interface FieldArrayStore<TSchema extends Schema = Schema, TFieldArrayPath exten
976
1135
  /**
977
1136
  * Form store interface.
978
1137
  */
979
- interface FormStore<TSchema extends Schema = Schema> extends BaseFormStore<TSchema> {
1138
+ interface FormStore<TSchema extends FormSchema = FormSchema> extends BaseFormStore<TSchema> {
980
1139
  /**
981
1140
  * Whether the form is currently submitting.
982
1141
  */
@@ -1014,7 +1173,7 @@ interface FormStore<TSchema extends Schema = Schema> extends BaseFormStore<TSche
1014
1173
  /**
1015
1174
  * Field component props interface.
1016
1175
  */
1017
- interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends RequiredPath = RequiredPath> {
1176
+ interface FieldProps<TSchema extends FormSchema = FormSchema, TFieldPath extends RequiredPath = RequiredPath> {
1018
1177
  /**
1019
1178
  * The form store to which the field belongs.
1020
1179
  */
@@ -1035,13 +1194,13 @@ interface FieldProps<TSchema extends Schema = Schema, TFieldPath extends Require
1035
1194
  *
1036
1195
  * @returns The UI of the field to be rendered.
1037
1196
  */
1038
- declare const Field: <TSchema extends Schema, TFieldPath extends RequiredPath>(props: _qwik_dev_core_internal0.PublicProps<FieldProps<TSchema, TFieldPath>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal0.DevJSX) => JSXOutput;
1197
+ declare const Field: <TSchema extends FormSchema, TFieldPath extends RequiredPath>(props: _qwik_dev_core_internal0.PublicProps<FieldProps<TSchema, TFieldPath>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal0.DevJSX) => JSXOutput;
1039
1198
  //#endregion
1040
1199
  //#region src/components/FieldArray/FieldArray.d.ts
1041
1200
  /**
1042
1201
  * FieldArray component props interface.
1043
1202
  */
1044
- interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath extends RequiredPath = RequiredPath> {
1203
+ interface FieldArrayProps<TSchema extends FormSchema = FormSchema, TFieldArrayPath extends RequiredPath = RequiredPath> {
1045
1204
  /**
1046
1205
  * The form store to which the field array belongs.
1047
1206
  */
@@ -1063,13 +1222,13 @@ interface FieldArrayProps<TSchema extends Schema = Schema, TFieldArrayPath exten
1063
1222
  *
1064
1223
  * @returns The UI of the field array to be rendered.
1065
1224
  */
1066
- declare const FieldArray: <TSchema extends Schema, TFieldArrayPath extends RequiredPath>(props: _qwik_dev_core_internal0.PublicProps<FieldArrayProps<TSchema, TFieldArrayPath>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal0.DevJSX) => JSXOutput;
1225
+ declare const FieldArray: <TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(props: _qwik_dev_core_internal0.PublicProps<FieldArrayProps<TSchema, TFieldArrayPath>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal0.DevJSX) => JSXOutput;
1067
1226
  //#endregion
1068
1227
  //#region src/components/Form/Form.d.ts
1069
1228
  /**
1070
1229
  * Form component props type.
1071
1230
  */
1072
- type FormProps<TSchema extends Schema = Schema> = Omit<PropsOf<'form'>, 'onSubmit$' | 'noValidate'> & {
1231
+ type FormProps<TSchema extends FormSchema = FormSchema> = Omit<PropsOf<'form'>, 'onSubmit$' | 'noValidate'> & {
1073
1232
  /**
1074
1233
  * The form store instance.
1075
1234
  */
@@ -1085,13 +1244,13 @@ type FormProps<TSchema extends Schema = Schema> = Omit<PropsOf<'form'>, 'onSubmi
1085
1244
  *
1086
1245
  * @returns The a native form element.
1087
1246
  */
1088
- declare const Form: <TSchema extends Schema>(props: _qwik_dev_core_internal0.PublicProps<FormProps<TSchema>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal0.DevJSX) => JSXOutput;
1247
+ declare const Form: <TSchema extends FormSchema>(props: _qwik_dev_core_internal0.PublicProps<FormProps<TSchema>>, key: string | null, flags: number, dev?: _qwik_dev_core_internal0.DevJSX) => JSXOutput;
1089
1248
  //#endregion
1090
1249
  //#region src/hooks/useField/useField.d.ts
1091
1250
  /**
1092
1251
  * Use field config interface.
1093
1252
  */
1094
- interface UseFieldConfig<TSchema extends Schema = Schema, TFieldPath extends RequiredPath = RequiredPath> {
1253
+ interface UseFieldConfig<TSchema extends FormSchema = FormSchema, TFieldPath extends RequiredPath = RequiredPath> {
1095
1254
  /**
1096
1255
  * The path to the field within the form schema.
1097
1256
  */
@@ -1105,13 +1264,13 @@ interface UseFieldConfig<TSchema extends Schema = Schema, TFieldPath extends Req
1105
1264
  *
1106
1265
  * @returns The field store with reactive properties and element props.
1107
1266
  */
1108
- declare function useField<TSchema extends Schema, TFieldPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldConfig<TSchema, TFieldPath>): FieldStore<TSchema, TFieldPath>;
1267
+ declare function useField<TSchema extends FormSchema, TFieldPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldConfig<TSchema, TFieldPath>): FieldStore<TSchema, TFieldPath>;
1109
1268
  //#endregion
1110
1269
  //#region src/hooks/useFieldArray/useFieldArray.d.ts
1111
1270
  /**
1112
1271
  * Use field array config interface.
1113
1272
  */
1114
- interface UseFieldArrayConfig<TSchema extends Schema = Schema, TFieldArrayPath extends RequiredPath = RequiredPath> {
1273
+ interface UseFieldArrayConfig<TSchema extends FormSchema = FormSchema, TFieldArrayPath extends RequiredPath = RequiredPath> {
1115
1274
  /**
1116
1275
  * The path to the field array within the form schema.
1117
1276
  */
@@ -1125,7 +1284,7 @@ interface UseFieldArrayConfig<TSchema extends Schema = Schema, TFieldArrayPath e
1125
1284
  *
1126
1285
  * @returns The field array store with reactive properties for array management.
1127
1286
  */
1128
- declare function useFieldArray<TSchema extends Schema, TFieldArrayPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldArrayConfig<TSchema, TFieldArrayPath>): FieldArrayStore<TSchema, TFieldArrayPath>;
1287
+ declare function useFieldArray<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: FormStore<TSchema>, config: UseFieldArrayConfig<TSchema, TFieldArrayPath>): FieldArrayStore<TSchema, TFieldArrayPath>;
1129
1288
  //#endregion
1130
1289
  //#region src/hooks/useForm$/useForm$.d.ts
1131
1290
  /**
@@ -1136,7 +1295,7 @@ declare function useFieldArray<TSchema extends Schema, TFieldArrayPath extends R
1136
1295
  *
1137
1296
  * @returns The form store with reactive properties.
1138
1297
  */
1139
- declare function useFormQrl<TSchema extends Schema>(configQrl: QRL<() => FormConfig<TSchema>>): FormStore<TSchema>;
1298
+ declare function useFormQrl<TSchema extends FormSchema>(configQrl: QRL<() => FormConfig<TSchema>>): FormStore<TSchema>;
1140
1299
  /**
1141
1300
  * Creates a reactive form store from a form configuration. The form store
1142
1301
  * manages form state and provides reactive properties.
@@ -1145,6 +1304,6 @@ declare function useFormQrl<TSchema extends Schema>(configQrl: QRL<() => FormCon
1145
1304
  *
1146
1305
  * @returns The form store with reactive properties.
1147
1306
  */
1148
- declare const useForm$: <TSchema extends Schema>(qrl: () => FormConfig<TSchema>) => FormStore<TSchema>;
1307
+ declare const useForm$: <TSchema extends FormSchema>(qrl: () => FormConfig<TSchema>) => FormStore<TSchema>;
1149
1308
  //#endregion
1150
- 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, SetFieldInputConfig, SetFormErrorsConfig, 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$, useFormQrl, validate };
1309
+ 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, SetFieldInputConfig, SetFormErrorsConfig, 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$, useFormQrl, validate };
@@ -243,6 +243,63 @@ function swapItemState(firstInternalFieldStore, secondInternalFieldStore) {
243
243
  });
244
244
  }
245
245
  /**
246
+ * Returns whether the specified boolean property is true for the field store
247
+ * or any of its nested children. Recursively checks arrays and objects.
248
+ *
249
+ * @param internalFieldStore The field store to check.
250
+ * @param type The boolean property type to check.
251
+ *
252
+ * @returns Whether the property is true.
253
+ */
254
+ /* @__NO_SIDE_EFFECTS__ */
255
+ function getFieldBool(internalFieldStore, type) {
256
+ if (internalFieldStore[type].value) return true;
257
+ if (internalFieldStore.kind === "array") {
258
+ for (let index = 0; index < internalFieldStore.items.value.length; index++) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[index], type)) return true;
259
+ return false;
260
+ }
261
+ if (internalFieldStore.kind == "object") {
262
+ for (const key in internalFieldStore.children) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[key], type)) return true;
263
+ return false;
264
+ }
265
+ return false;
266
+ }
267
+ /**
268
+ * Returns only the dirty input of the field store. Arrays are treated as
269
+ * atomic and returned in full if any item is dirty, while object keys without
270
+ * a dirty descendant are omitted. Returns `undefined` if no descendant is
271
+ * dirty.
272
+ *
273
+ * @param internalFieldStore The field store to get dirty input from.
274
+ * @param dirtyOnly Whether to only include dirty fields. Defaults to `true`.
275
+ *
276
+ * @returns The dirty input, or `undefined` if no descendant is dirty.
277
+ */
278
+ /* @__NO_SIDE_EFFECTS__ */
279
+ function getDirtyFieldInput(internalFieldStore, dirtyOnly = true) {
280
+ if (dirtyOnly && !/* @__PURE__ */ getFieldBool(internalFieldStore, "isDirty")) return;
281
+ if (internalFieldStore.kind === "array") {
282
+ if (internalFieldStore.input.value) {
283
+ const value = [];
284
+ for (let index = 0; index < internalFieldStore.items.value.length; index++) value[index] = /* @__PURE__ */ getDirtyFieldInput(internalFieldStore.children[index], false);
285
+ return value;
286
+ }
287
+ return internalFieldStore.input.value;
288
+ }
289
+ if (internalFieldStore.kind === "object") {
290
+ if (internalFieldStore.input.value) {
291
+ const value = {};
292
+ for (const key in internalFieldStore.children) {
293
+ const child = internalFieldStore.children[key];
294
+ if (!dirtyOnly || /* @__PURE__ */ getFieldBool(child, "isDirty")) value[key] = /* @__PURE__ */ getDirtyFieldInput(child, dirtyOnly);
295
+ }
296
+ return value;
297
+ }
298
+ return internalFieldStore.input.value;
299
+ }
300
+ return internalFieldStore.input.value;
301
+ }
302
+ /**
246
303
  * Returns the current input of the field store. For arrays and objects,
247
304
  * recursively collects input from all children. Returns `null` or `undefined`
248
305
  * for nullish array/object inputs, or the primitive value for value fields.
@@ -299,28 +356,6 @@ function getElementInput(element, internalFieldStore) {
299
356
  return element.value;
300
357
  }
301
358
  /**
302
- * Returns whether the specified boolean property is true for the field store
303
- * or any of its nested children. Recursively checks arrays and objects.
304
- *
305
- * @param internalFieldStore The field store to check.
306
- * @param type The boolean property type to check.
307
- *
308
- * @returns Whether the property is true.
309
- */
310
- /* @__NO_SIDE_EFFECTS__ */
311
- function getFieldBool(internalFieldStore, type) {
312
- if (internalFieldStore[type].value) return true;
313
- if (internalFieldStore.kind === "array") {
314
- for (let index = 0; index < internalFieldStore.items.value.length; index++) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[index], type)) return true;
315
- return false;
316
- }
317
- if (internalFieldStore.kind == "object") {
318
- for (const key in internalFieldStore.children) if (/* @__PURE__ */ getFieldBool(internalFieldStore.children[key], type)) return true;
319
- return false;
320
- }
321
- return false;
322
- }
323
- /**
324
359
  * Returns the field store at the specified path by traversing the form store's
325
360
  * children hierarchy.
326
361
  *
@@ -577,6 +612,17 @@ function getAllErrors(form) {
577
612
  return allErrors;
578
613
  }
579
614
  /* @__NO_SIDE_EFFECTS__ */
615
+ function getDirtyInput(form, config) {
616
+ return getDirtyFieldInput(config?.path ? getFieldStore(form[INTERNAL], config.path) : form[INTERNAL]);
617
+ }
618
+ /* @__NO_SIDE_EFFECTS__ */
619
+ function getDirtyPaths(form, config) {
620
+ config?.path ? getFieldStore(form[INTERNAL], config.path) : form[INTERNAL];
621
+ const paths = [];
622
+ config?.path && [...config.path];
623
+ return paths;
624
+ }
625
+ /* @__NO_SIDE_EFFECTS__ */
580
626
  function getErrors(form, config) {
581
627
  return (config?.path ? getFieldStore(form[INTERNAL], config.path) : form[INTERNAL]).errors.value;
582
628
  }
@@ -670,6 +716,48 @@ function move(form, config) {
670
716
  });
671
717
  }
672
718
  /**
719
+ * Picks only the dirty parts of the given value, using the form's dirty fields
720
+ * as a structural mask. Arrays are treated as atomic and object keys without a
721
+ * dirty descendant are omitted. Returns `undefined` if no field is dirty.
722
+ * Useful for filtering a validated output down to its changed parts before
723
+ * submitting.
724
+ *
725
+ * @param form The form store providing the dirty mask.
726
+ * @param config The pick dirty configuration.
727
+ *
728
+ * @returns The dirty parts of the value, or `undefined`.
729
+ */
730
+ /* @__NO_SIDE_EFFECTS__ */
731
+ function pickDirty(form, config) {
732
+ if (!getFieldBool(form[INTERNAL], "isDirty")) return;
733
+ const result = /* @__PURE__ */ pickFieldValue(form[INTERNAL], config.from);
734
+ return Object.keys(result).length ? result : void 0;
735
+ }
736
+ /**
737
+ * Recursively picks the dirty parts of a value using the field store as a
738
+ * structural mask, reading from the supplied value rather than the form's own
739
+ * input. Objects with non-nullish input recurse into their dirty children that
740
+ * are present in the value, while arrays, primitives, nullish-cleared fields
741
+ * and shape-diverging values are returned as-is.
742
+ *
743
+ * @param internalFieldStore The field store used as the dirty mask.
744
+ * @param value The value to pick the dirty parts from.
745
+ *
746
+ * @returns The dirty parts of the value.
747
+ */
748
+ /* @__NO_SIDE_EFFECTS__ */
749
+ function pickFieldValue(internalFieldStore, value) {
750
+ if (internalFieldStore.kind === "object" && internalFieldStore.input.value && value && typeof value === "object" && !Array.isArray(value)) {
751
+ const result = {};
752
+ for (const key in internalFieldStore.children) {
753
+ const child = internalFieldStore.children[key];
754
+ if (getFieldBool(child, "isDirty") && key in value) result[key] = /* @__PURE__ */ pickFieldValue(child, value[key]);
755
+ }
756
+ return result;
757
+ }
758
+ return value;
759
+ }
760
+ /**
673
761
  * Removes an item from a field array at the specified index. All items after
674
762
  * the removed item are shifted down by one index.
675
763
  *
@@ -996,4 +1084,4 @@ const Form = component$(({ of, onSubmit$,...other }) => {
996
1084
  });
997
1085
 
998
1086
  //#endregion
999
- export { Field, FieldArray, Form, focus, getAllErrors, getErrors, getInput, handleSubmit, insert, move, remove, replace, reset, setErrors, setInput, submit, swap, useField, useFieldArray, useForm$, useFormQrl, validate };
1087
+ export { Field, FieldArray, Form, focus, getAllErrors, getDirtyInput, getDirtyPaths, getErrors, getInput, handleSubmit, insert, move, pickDirty, remove, replace, reset, setErrors, setInput, submit, swap, useField, useFieldArray, useForm$, useFormQrl, validate };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@formisch/qwik",
3
3
  "description": "The lightweight, schema-first, and fully type-safe form library for Qwik",
4
- "version": "0.10.1",
4
+ "version": "0.11.0",
5
5
  "license": "MIT",
6
6
  "author": "Fabian Hiller",
7
7
  "homepage": "https://formisch.dev",
@@ -55,14 +55,14 @@
55
55
  "prettier": "3.6.2",
56
56
  "tsdown": "0.12.9",
57
57
  "typescript": "5.8.3",
58
- "valibot": "^1.2.0",
58
+ "valibot": "^1.4.1",
59
59
  "vite": "7.0.4",
60
60
  "vite-tsconfig-paths": "^5.1.4"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@qwik.dev/core": ">=2",
64
64
  "typescript": ">=5",
65
- "valibot": "^1.0.0"
65
+ "valibot": "^1.4.1"
66
66
  },
67
67
  "peerDependenciesMeta": {
68
68
  "typescript": {