attaform 0.18.2 → 0.19.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.
Files changed (71) hide show
  1. package/README.md +3 -0
  2. package/dist/chunks/devtools.cjs +1 -1
  3. package/dist/chunks/devtools.mjs +1 -1
  4. package/dist/chunks/indexeddb.cjs +1 -1
  5. package/dist/chunks/indexeddb.mjs +1 -1
  6. package/dist/chunks/local-storage.cjs +1 -1
  7. package/dist/chunks/local-storage.mjs +1 -1
  8. package/dist/chunks/session-storage.cjs +1 -1
  9. package/dist/chunks/session-storage.mjs +1 -1
  10. package/dist/index.cjs +4 -4
  11. package/dist/index.d.cts +68 -75
  12. package/dist/index.d.mts +68 -75
  13. package/dist/index.d.ts +68 -75
  14. package/dist/index.mjs +5 -5
  15. package/dist/nuxt.d.cts +1 -1
  16. package/dist/nuxt.d.mts +1 -1
  17. package/dist/nuxt.d.ts +1 -1
  18. package/dist/runtime/plugins/attaform.cjs +2 -2
  19. package/dist/runtime/plugins/attaform.mjs +2 -2
  20. package/dist/shared/{attaform.CZ-XtZt_.mjs → attaform.BTi-PsHr.mjs} +544 -134
  21. package/dist/shared/attaform.BTi-PsHr.mjs.map +1 -0
  22. package/dist/shared/{attaform.CuN7ZhBy.d.cts → attaform.BTpuvGec.d.ts} +44 -11
  23. package/dist/shared/{attaform.BqK_L4gK.cjs → attaform.BqEfHpVB.cjs} +119 -1
  24. package/dist/shared/attaform.BqEfHpVB.cjs.map +1 -0
  25. package/dist/shared/{attaform.D1gzu2GL.d.mts → attaform.BtBmfLQN.d.mts} +44 -11
  26. package/dist/shared/{attaform.Ca5_6Ky-.d.cts → attaform.C0uGZQ4M.d.cts} +365 -86
  27. package/dist/shared/{attaform.Ca5_6Ky-.d.mts → attaform.C0uGZQ4M.d.mts} +365 -86
  28. package/dist/shared/{attaform.Ca5_6Ky-.d.ts → attaform.C0uGZQ4M.d.ts} +365 -86
  29. package/dist/shared/{attaform.II89Pcf4.cjs → attaform.C1msmO2v.cjs} +544 -134
  30. package/dist/shared/attaform.C1msmO2v.cjs.map +1 -0
  31. package/dist/shared/{attaform.CRmmNAYp.d.cts → attaform.CBjmobqk.d.cts} +1 -1
  32. package/dist/shared/{attaform.B957T6NU.d.ts → attaform.CJ-e9gYI.d.ts} +1 -1
  33. package/dist/shared/{attaform.XDjA7sRz.d.cts → attaform.CRNA0vrd.d.mts} +1 -1
  34. package/dist/shared/{attaform.Dl161U6E.mjs → attaform.Cghpuav8.mjs} +2 -2
  35. package/dist/shared/{attaform.Dl161U6E.mjs.map → attaform.Cghpuav8.mjs.map} +1 -1
  36. package/dist/shared/{attaform.Df0tU0Ut.mjs → attaform.CiMqJHDm.mjs} +3 -3
  37. package/dist/shared/{attaform.Df0tU0Ut.mjs.map → attaform.CiMqJHDm.mjs.map} +1 -1
  38. package/dist/shared/{attaform.5UhpSVFI.cjs → attaform.CoxJ8Qm8.cjs} +2 -2
  39. package/dist/shared/{attaform.5UhpSVFI.cjs.map → attaform.CoxJ8Qm8.cjs.map} +1 -1
  40. package/dist/shared/{attaform.CDmaxrt2.mjs → attaform.CrpjyXdO.mjs} +119 -1
  41. package/dist/shared/attaform.CrpjyXdO.mjs.map +1 -0
  42. package/dist/shared/{attaform.FnEwjhvX.d.ts → attaform.D4I63aBV.d.ts} +1 -1
  43. package/dist/shared/{attaform.D9wuTGu9.d.mts → attaform.DXYHL99q.d.mts} +1 -1
  44. package/dist/shared/{attaform.Dlk1jMuv.cjs → attaform.JBx8cfMA.cjs} +3 -3
  45. package/dist/shared/{attaform.Dlk1jMuv.cjs.map → attaform.JBx8cfMA.cjs.map} +1 -1
  46. package/dist/shared/{attaform.DUHru0OF.cjs → attaform.OznWyOPy.cjs} +3 -3
  47. package/dist/shared/{attaform.DUHru0OF.cjs.map → attaform.OznWyOPy.cjs.map} +1 -1
  48. package/dist/shared/{attaform.M-RanbyV.d.mts → attaform.QvygsFGh.d.cts} +1 -1
  49. package/dist/shared/{attaform.-1GQTX2T.mjs → attaform.a3uBo-gw.mjs} +3 -3
  50. package/dist/shared/{attaform.-1GQTX2T.mjs.map → attaform.a3uBo-gw.mjs.map} +1 -1
  51. package/dist/shared/{attaform.CGX1CNpz.d.ts → attaform.ePUcKxId.d.cts} +44 -11
  52. package/dist/zod-v3.cjs +3 -3
  53. package/dist/zod-v3.d.cts +4 -4
  54. package/dist/zod-v3.d.mts +4 -4
  55. package/dist/zod-v3.d.ts +4 -4
  56. package/dist/zod-v3.mjs +3 -3
  57. package/dist/zod-v4.cjs +3 -3
  58. package/dist/zod-v4.d.cts +4 -4
  59. package/dist/zod-v4.d.mts +4 -4
  60. package/dist/zod-v4.d.ts +4 -4
  61. package/dist/zod-v4.mjs +3 -3
  62. package/dist/zod.cjs +4 -4
  63. package/dist/zod.d.cts +6 -6
  64. package/dist/zod.d.mts +6 -6
  65. package/dist/zod.d.ts +6 -6
  66. package/dist/zod.mjs +5 -5
  67. package/package.json +2 -2
  68. package/dist/shared/attaform.BqK_L4gK.cjs.map +0 -1
  69. package/dist/shared/attaform.CDmaxrt2.mjs.map +0 -1
  70. package/dist/shared/attaform.CZ-XtZt_.mjs.map +0 -1
  71. package/dist/shared/attaform.II89Pcf4.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { s as FormKey, ae as SlimPrimitiveKind, C as CoercionEntry, g as CoercionRegistry, G as GenericForm, R as PathKey, Q as Path, am as ValidationError, A as AbstractSchema, ac as ShouldShowErrors, aq as WriteMeta, D as DeepPartial, ar as WriteShape, ak as ValidateOn, W as PersistOptInRegistry, a8 as Segment, f as AttaformDefaults, aj as UseFormReturnType, a6 as RegisterValue } from './attaform.Ca5_6Ky-.mjs';
1
+ import { t as FormKey, ae as SlimPrimitiveKind, C as CoercionEntry, g as CoercionRegistry, G as GenericForm, T as PathKey, S as Path, am as ValidationError, A as AbstractSchema, x as GetDisplayState, aq as WriteMeta, D as DeepPartial, ar as WriteShape, ak as ValidateOn, Y as PersistOptInRegistry, aa as Segment, f as AttaformDefaults, aj as UseFormReturnType, a8 as RegisterValue } from './attaform.C0uGZQ4M.mjs';
2
2
  import { Ref, ComputedRef, App, InjectionKey } from 'vue';
3
3
 
4
4
  /**
@@ -517,19 +517,29 @@ declare const defaultCoercionRules: CoercionRegistry;
517
517
  */
518
518
  /**
519
519
  * Per-path field status. Replaced wholesale (not mutated in place) on
520
- * every change. Three semantic groups:
520
+ * every change. Five semantic groups:
521
521
  *
522
522
  * - `connected` — is a DOM element registered for this path?
523
523
  * - `focused` / `blurred` — DOM-state flags. `null` while no element
524
524
  * is connected (no DOM means the concepts don't apply); plain
525
525
  * booleans once connected, with the invariant `blurred === !focused`
526
526
  * enforced by `markFocused`.
527
- * - `touched` — interaction history, not DOM state. Always a plain
527
+ * - `touched` — focus/blur history, not DOM state. Always a plain
528
528
  * boolean: `false` at registration, sticky `true` after first blur,
529
529
  * cleared only by `form.reset()` / `form.resetField(path)`. Persists
530
530
  * across disconnects so v-if'd-away fields don't lose their touched
531
531
  * state on rehide (wizard "show review of touched fields" patterns
532
532
  * rely on this).
533
+ * - `interacted` — value-mutation history, not DOM state. Plain
534
+ * boolean: `false` at registration, sticky `true` once the user
535
+ * issues a value edit through the directive's input listeners
536
+ * (never on hydration, default seeding, or programmatic setValue);
537
+ * cleared with `touched` by `form.reset()` / `form.resetField(path)`.
538
+ * - `blurredAfterInteraction` — the first blur that follows a value
539
+ * edit (the field has been edited and then left). Plain boolean,
540
+ * sticky `true`. A tab-through blur with no prior edit does NOT set
541
+ * it (`interacted` is still false at that blur). Composes
542
+ * `interacted` with the departure; drives the default display gate.
533
543
  */
534
544
  type FieldRecord = {
535
545
  readonly path: Path;
@@ -538,6 +548,8 @@ type FieldRecord = {
538
548
  readonly focused: boolean | null;
539
549
  readonly blurred: boolean | null;
540
550
  readonly touched: boolean;
551
+ readonly interacted: boolean;
552
+ readonly blurredAfterInteraction: boolean;
541
553
  };
542
554
  /** Per-path DOM element tracking. Client-only. */
543
555
  type ElementRecord = {
@@ -649,15 +661,14 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
649
661
  */
650
662
  readonly ssr: boolean;
651
663
  /**
652
- * Resolved `shouldShowErrors` predicate driving `field.showErrors`
653
- * and `form.meta.showErrors`. Resolved once at construction via
654
- * `resolveShouldShowErrors(options.shouldShowErrors)` so the
655
- * field-state computeds don't repeat the boolean-vs-function
656
- * branch on every read. Boolean shorthand has already been lifted
657
- * to a constant predicate by the time it lands here; `undefined`
658
- * config falls through to `defaultShouldShowErrors`.
664
+ * Resolved `getDisplayState` predicate driving `field.displayState`,
665
+ * the `show*` booleans, and their `form.meta` rollups. Resolved once
666
+ * at construction via `resolveGetDisplayState(options.getDisplayState)`;
667
+ * `undefined` config falls through to `defaultDisplayState`. The
668
+ * field-state computeds read the resolved function directly on every
669
+ * read.
659
670
  */
660
- readonly shouldShowErrors: ShouldShowErrors;
671
+ readonly getDisplayState: GetDisplayState;
661
672
  readonly submitting: Ref<boolean>;
662
673
  readonly activeSubmissions: Ref<number>;
663
674
  readonly submissionAttempts: Ref<number>;
@@ -831,6 +842,14 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
831
842
  */
832
843
  setValueAtPath(path: Path, value: unknown, meta?: WriteMeta): boolean;
833
844
  getValueAtPath(path: Path): unknown;
845
+ /**
846
+ * Stable identity for the array element at `path`. An array element
847
+ * (numeric last segment) carries its allocated identity token,
848
+ * maintained by `array-identity.ts` across structural mutations.
849
+ * Empty for any non-array-element path: a record entry, a
850
+ * fixed-object field, a container, or the root. Backs `FieldState.key`.
851
+ */
852
+ arrayElementKey(path: Path): string;
834
853
  reset(nextDefaultValues?: DeepPartial<WriteShape<F>>): void;
835
854
  resetField(path: Path): void;
836
855
  /**
@@ -894,6 +913,12 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
894
913
  readonly instance?: WriteMeta['instance'];
895
914
  }): void;
896
915
  markTouched(path: Path): void;
916
+ /**
917
+ * Flip `interacted: true` on a leaf — the sticky value-mutation flag.
918
+ * Driven by the directive's input listeners (via the RegisterValue's
919
+ * `markInteracted`); idempotent, never set by programmatic writes.
920
+ */
921
+ markInteracted(path: Path): void;
897
922
  /**
898
923
  * Walk every active-variant leaf under `segments` and flip
899
924
  * `touched: true`. Powers `form.touch(path?)`. Idempotent;
@@ -920,6 +945,14 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
920
945
  * isn't exposed to consumers.
921
946
  */
922
947
  isPristineAtPath(path: Path): boolean;
948
+ /**
949
+ * Whether any tracked array under `path` has changed shape — a reorder,
950
+ * insert, or removal — relative to its construction/reset baseline. The
951
+ * structural half of `dirty`: per-element baselines travel with their
952
+ * element across a mutation, so a positional value comparison alone can
953
+ * no longer see the shape change.
954
+ */
955
+ hasStructuralChangeUnder(path: Path): boolean;
923
956
  getFieldRecord(path: Path): FieldRecord | undefined;
924
957
  getOriginalAtPath(path: Path): unknown;
925
958
  /**