attaform 0.21.2 → 0.23.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 -10
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -33
- package/dist/chunks/dev-key-collision-warnings.cjs.map +1 -1
- package/dist/chunks/dev-key-collision-warnings.mjs +1 -33
- package/dist/chunks/dev-key-collision-warnings.mjs.map +1 -1
- package/dist/chunks/devtools.cjs +3 -5
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +3 -5
- package/dist/chunks/devtools.mjs.map +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -41
- package/dist/index.d.mts +6 -41
- package/dist/index.d.ts +6 -41
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +3 -11
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.BGf_J22U.d.ts → attaform.BGMRvckW.d.ts} +11 -70
- package/dist/shared/{attaform.ory-3WhV.d.mts → attaform.BJnNK75Y.d.cts} +41 -491
- package/dist/shared/{attaform.ory-3WhV.d.ts → attaform.BJnNK75Y.d.mts} +41 -491
- package/dist/shared/{attaform.ory-3WhV.d.cts → attaform.BJnNK75Y.d.ts} +41 -491
- package/dist/shared/{attaform.DP-u7_tk.mjs → attaform.BhI9Icek.mjs} +17 -291
- package/dist/shared/attaform.BhI9Icek.mjs.map +1 -0
- package/dist/shared/{attaform.BwLp9KM7.cjs → attaform.BibT5AS_.cjs} +2 -2
- package/dist/shared/{attaform.BwLp9KM7.cjs.map → attaform.BibT5AS_.cjs.map} +1 -1
- package/dist/shared/{attaform.DkA5J8NW.d.cts → attaform.CO0e7YVY.d.cts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.ts → attaform.CO0e7YVY.d.mts} +1 -46
- package/dist/shared/{attaform.DkA5J8NW.d.mts → attaform.CO0e7YVY.d.ts} +1 -46
- package/dist/shared/{attaform.BwrowMp2.cjs → attaform.CaYj3ZfY.cjs} +3 -3
- package/dist/shared/{attaform.BwrowMp2.cjs.map → attaform.CaYj3ZfY.cjs.map} +1 -1
- package/dist/shared/{attaform.BBDIKtKY.cjs → attaform.Cmb_LCie.cjs} +4 -4
- package/dist/shared/{attaform.BVeLgfEh.mjs.map → attaform.Cmb_LCie.cjs.map} +1 -1
- package/dist/shared/{attaform.CTheKoTc.mjs → attaform.CtJOd7ox.mjs} +446 -525
- package/dist/shared/attaform.CtJOd7ox.mjs.map +1 -0
- package/dist/shared/{attaform.CrD73S4m.mjs → attaform.CzVta5o2.mjs} +116 -47
- package/dist/shared/attaform.CzVta5o2.mjs.map +1 -0
- package/dist/shared/{attaform.CnEl--PF.d.mts → attaform.D52oJiYC.d.cts} +1 -1
- package/dist/shared/{attaform.BoY6RZUl.d.cts → attaform.DCkSNnPr.d.mts} +1 -1
- package/dist/shared/{attaform.B5LNzqQh.cjs → attaform.Db4E4IW6.cjs} +18 -297
- package/dist/shared/attaform.Db4E4IW6.cjs.map +1 -0
- package/dist/shared/{attaform.CcnF1AKJ.cjs → attaform.DbyTD8N2.cjs} +116 -47
- package/dist/shared/attaform.DbyTD8N2.cjs.map +1 -0
- package/dist/shared/{attaform.D6GYGshL.mjs → attaform.Dd1Kmmaj.mjs} +3 -3
- package/dist/shared/{attaform.D6GYGshL.mjs.map → attaform.Dd1Kmmaj.mjs.map} +1 -1
- package/dist/shared/{attaform.BCcrLApm.d.mts → attaform.DrY8srOp.d.mts} +11 -70
- package/dist/shared/{attaform.D2ZuIOCf.cjs → attaform.DsQkXE3o.cjs} +445 -534
- package/dist/shared/attaform.DsQkXE3o.cjs.map +1 -0
- package/dist/shared/{attaform.BkjJfMvJ.d.cts → attaform.DuPneYR0.d.cts} +11 -70
- package/dist/shared/{attaform.C41gjp-a.mjs → attaform.Dx9-QQE2.mjs} +2 -2
- package/dist/shared/{attaform.C41gjp-a.mjs.map → attaform.Dx9-QQE2.mjs.map} +1 -1
- package/dist/shared/{attaform.BYgioWLF.d.ts → attaform.WEwfXcHq.d.ts} +1 -1
- package/dist/shared/{attaform.BVeLgfEh.mjs → attaform.alpG7rT7.mjs} +4 -4
- package/dist/shared/{attaform.BBDIKtKY.cjs.map → attaform.alpG7rT7.mjs.map} +1 -1
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- package/dist/zod-v3.mjs +2 -2
- package/dist/zod-v4.cjs +2 -2
- package/dist/zod-v4.d.cts +5 -5
- package/dist/zod-v4.d.mts +5 -5
- package/dist/zod-v4.d.ts +5 -5
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +5 -5
- package/dist/zod.d.cts +5 -5
- package/dist/zod.d.mts +5 -5
- package/dist/zod.d.ts +5 -5
- package/dist/zod.mjs +5 -5
- package/package.json +2 -2
- package/dist/chunks/indexeddb.cjs +0 -119
- package/dist/chunks/indexeddb.cjs.map +0 -1
- package/dist/chunks/indexeddb.mjs +0 -117
- package/dist/chunks/indexeddb.mjs.map +0 -1
- package/dist/chunks/local-storage.cjs +0 -58
- package/dist/chunks/local-storage.cjs.map +0 -1
- package/dist/chunks/local-storage.mjs +0 -56
- package/dist/chunks/local-storage.mjs.map +0 -1
- package/dist/chunks/multi-tab-sync.cjs +0 -367
- package/dist/chunks/multi-tab-sync.cjs.map +0 -1
- package/dist/chunks/multi-tab-sync.mjs +0 -364
- package/dist/chunks/multi-tab-sync.mjs.map +0 -1
- package/dist/chunks/session-storage.cjs +0 -58
- package/dist/chunks/session-storage.cjs.map +0 -1
- package/dist/chunks/session-storage.mjs +0 -56
- package/dist/chunks/session-storage.mjs.map +0 -1
- package/dist/chunks/wire-persistence.cjs +0 -396
- package/dist/chunks/wire-persistence.cjs.map +0 -1
- package/dist/chunks/wire-persistence.mjs +0 -394
- package/dist/chunks/wire-persistence.mjs.map +0 -1
- package/dist/shared/attaform.B5LNzqQh.cjs.map +0 -1
- package/dist/shared/attaform.CTheKoTc.mjs.map +0 -1
- package/dist/shared/attaform.CcnF1AKJ.cjs.map +0 -1
- package/dist/shared/attaform.CrD73S4m.mjs.map +0 -1
- package/dist/shared/attaform.D2ZuIOCf.cjs.map +0 -1
- package/dist/shared/attaform.DP-u7_tk.mjs.map +0 -1
|
@@ -154,42 +154,6 @@ declare const ROOT_PATH_KEY: PathKey;
|
|
|
154
154
|
*/
|
|
155
155
|
declare function isPathPrefix(prefix: readonly Segment[], path: readonly Segment[]): boolean;
|
|
156
156
|
|
|
157
|
-
/**
|
|
158
|
-
* Per-FormStore registry tracking which DOM elements have opted into
|
|
159
|
-
* persistence for which paths. Lives on the FormStore so that two SFCs
|
|
160
|
-
* sharing a key share the registry — opt-ins are per-element, not
|
|
161
|
-
* per-component.
|
|
162
|
-
*
|
|
163
|
-
* The directive's input handler computes `meta.persist` for each write
|
|
164
|
-
* by calling `hasOptIn(elementId, path)` — only THIS element's writes
|
|
165
|
-
* persist if THIS element opted in. Other call sites that aren't tied
|
|
166
|
-
* to a single element (history undo/redo, field-array helpers, devtools
|
|
167
|
-
* edits) use `hasAnyOptInForPath(path)` — persist if any element has
|
|
168
|
-
* opted into that path.
|
|
169
|
-
*
|
|
170
|
-
* Internal data structure: `Map<PathKey, Set<elementId>>`. Small forms
|
|
171
|
-
* have ~10-50 paths; iteration is cheap. All operations are O(1) given
|
|
172
|
-
* (id, path).
|
|
173
|
-
*/
|
|
174
|
-
type PersistOptInRegistry = {
|
|
175
|
-
/** Add an opt-in entry; idempotent. */
|
|
176
|
-
add(elementId: string, path: PathKey): void;
|
|
177
|
-
/** Remove a single (element, path) entry. */
|
|
178
|
-
remove(elementId: string, path: PathKey): void;
|
|
179
|
-
/** Remove every opt-in for `elementId`. Called from directive's beforeUnmount. */
|
|
180
|
-
removeAllFor(elementId: string): void;
|
|
181
|
-
/** Check whether THIS element has opted into THIS path. */
|
|
182
|
-
hasOptIn(elementId: string, path: PathKey): boolean;
|
|
183
|
-
/** Check whether ANY element has opted into this path. */
|
|
184
|
-
hasAnyOptInForPath(path: PathKey): boolean;
|
|
185
|
-
/** Iterate every path that currently has at least one opt-in. */
|
|
186
|
-
optedInPaths(): IterableIterator<PathKey>;
|
|
187
|
-
/** True iff no element has opted into any path. */
|
|
188
|
-
isEmpty(): boolean;
|
|
189
|
-
/** Drop every entry. Called from FormStore.dispose. */
|
|
190
|
-
clear(): void;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
157
|
/** Internal brand for the `Unset` type. Never exposed at runtime. */
|
|
194
158
|
declare const _unsetBrand: unique symbol;
|
|
195
159
|
/**
|
|
@@ -665,8 +629,8 @@ type DefaultValuesInput<T> = T extends string ? string | Unset : T extends numbe
|
|
|
665
629
|
/**
|
|
666
630
|
* Identifier for a form. A `FormKey` is the string passed via
|
|
667
631
|
* `useForm({ key })`, used to look up a form by name from a distant
|
|
668
|
-
* component
|
|
669
|
-
*
|
|
632
|
+
* component and to label errors and DevTools entries. Anonymous
|
|
633
|
+
* `useForm` calls allocate one
|
|
670
634
|
* automatically; you only need to pick one when the form needs
|
|
671
635
|
* stable identity.
|
|
672
636
|
*/
|
|
@@ -830,9 +794,9 @@ type AbstractSchema<Form, GetValueFormType> = {
|
|
|
830
794
|
*
|
|
831
795
|
* Resolves a `Promise` so adapters can defer the structural walk (and
|
|
832
796
|
* its `canonicalStringify` helper) onto a dynamic import. The framework
|
|
833
|
-
* only ever needs the fingerprint
|
|
834
|
-
*
|
|
835
|
-
*
|
|
797
|
+
* only ever needs the fingerprint for the dev-only shared-key schema
|
|
798
|
+
* mismatch warning, so none of those bytes belong on the eager
|
|
799
|
+
* `useForm` path.
|
|
836
800
|
*
|
|
837
801
|
* The library uses this to detect schema mismatches at a shared
|
|
838
802
|
* form key: two `useForm({ key: 'x', schema })` calls are allowed
|
|
@@ -1394,64 +1358,11 @@ type ValidateOnConfig = {
|
|
|
1394
1358
|
debounceMs?: never;
|
|
1395
1359
|
};
|
|
1396
1360
|
/**
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
* - `'session'` — browser `sessionStorage` (cleared when the tab closes).
|
|
1401
|
-
* - `'indexeddb'` — IndexedDB via a zero-dependency wrapper (handles
|
|
1402
|
-
* structured-cloneable data; suitable for larger drafts).
|
|
1403
|
-
*
|
|
1404
|
-
* For anything else (encrypted storage, a native bridge, a cookie
|
|
1405
|
-
* store) pass a custom `FormStorage` object instead.
|
|
1406
|
-
*/
|
|
1407
|
-
type FormStorageKind = 'local' | 'session' | 'indexeddb';
|
|
1408
|
-
/**
|
|
1409
|
-
* Custom persistence backend. Implement this when none of the built-in
|
|
1410
|
-
* `'local'` / `'session'` / `'indexeddb'` backends fit (e.g. encrypted
|
|
1411
|
-
* storage, a cross-window broadcast layer, or a native mobile bridge).
|
|
1412
|
-
*
|
|
1413
|
-
* All methods are async. Pass values through unchanged — `getItem`
|
|
1414
|
-
* should return whatever `setItem` was given, including non-string
|
|
1415
|
-
* values. The library handles serialization for the built-in
|
|
1416
|
-
* `'local'` / `'session'` backends; custom adapters can store the
|
|
1417
|
-
* value directly if their backing store accepts structured data.
|
|
1418
|
-
*
|
|
1419
|
-
* `listKeys(prefix)` returns every key starting with `prefix`. The
|
|
1420
|
-
* library uses it on mount to clean up entries left over from older
|
|
1421
|
-
* schema versions (each persisted entry carries a schema fingerprint
|
|
1422
|
-
* suffix; mismatched entries are dropped automatically).
|
|
1423
|
-
*/
|
|
1424
|
-
type FormStorage = {
|
|
1425
|
-
/** Fetch the value previously stored under `key`. Resolve to `null`/`undefined` for misses. */
|
|
1426
|
-
getItem(key: string): Promise<unknown>;
|
|
1427
|
-
/** Persist `value` under `key`. */
|
|
1428
|
-
setItem(key: string, value: unknown): Promise<void>;
|
|
1429
|
-
/** Remove the entry at `key`. No-op if not present. */
|
|
1430
|
-
removeItem(key: string): Promise<void>;
|
|
1431
|
-
/** Return every key in this backend whose name starts with `prefix`. */
|
|
1432
|
-
listKeys(prefix: string): Promise<string[]>;
|
|
1433
|
-
};
|
|
1434
|
-
/**
|
|
1435
|
-
* What to include when persisting:
|
|
1436
|
-
*
|
|
1437
|
-
* - `'form'` (default) — only the form value. Errors get repopulated
|
|
1438
|
-
* by validation on reload anyway.
|
|
1439
|
-
* - `'form+errors'` — also persist the current error list. Useful when
|
|
1440
|
-
* the error context is expensive to recompute (e.g. cross-field
|
|
1441
|
-
* refinements that depend on server data).
|
|
1442
|
-
*/
|
|
1443
|
-
type PersistIncludeMode = 'form' | 'form+errors';
|
|
1444
|
-
/**
|
|
1445
|
-
* Per-write metadata. Used internally to flag which writes should
|
|
1446
|
-
* reach the persistence layer (e.g. only writes from elements opted
|
|
1447
|
-
* into persistence via `register(path, { persist: true })`).
|
|
1448
|
-
*
|
|
1449
|
-
* Custom directive integrations may set `persist: true` to forward
|
|
1450
|
-
* a write to the configured storage adapter; otherwise leave unset.
|
|
1361
|
+
* Per-write metadata. Used internally to tag writes so listeners and
|
|
1362
|
+
* the write funnel can treat a write specially (a blank mark, an array
|
|
1363
|
+
* structural op, a hydration replay, a per-instance config override).
|
|
1451
1364
|
*/
|
|
1452
1365
|
type WriteMeta = {
|
|
1453
|
-
/** When `true`, this write is forwarded to the configured persistence backend. */
|
|
1454
|
-
readonly persist?: boolean;
|
|
1455
1366
|
/**
|
|
1456
1367
|
* When `true`, the path being written is added to the FormStore's
|
|
1457
1368
|
* `blankPaths` set — meaning storage holds a real, schema-
|
|
@@ -1513,33 +1424,16 @@ type WriteMeta = {
|
|
|
1513
1424
|
readonly rememberVariants?: boolean;
|
|
1514
1425
|
};
|
|
1515
1426
|
/**
|
|
1516
|
-
* When `true`, marks this `applyFormReplacement` call as
|
|
1517
|
-
*
|
|
1518
|
-
*
|
|
1519
|
-
*
|
|
1520
|
-
* subsequent `undo()` can't
|
|
1521
|
-
* default. Internal — set by
|
|
1522
|
-
*
|
|
1427
|
+
* When `true`, marks this `applyFormReplacement` call as a hydration
|
|
1428
|
+
* step (the async-`defaultValues` / `activate()` / `rehydrate()`
|
|
1429
|
+
* path). Modules that snapshot the form state (notably the history
|
|
1430
|
+
* module) treat hydration as the baseline: stacks reset to a single
|
|
1431
|
+
* seed of the post-hydration value, so a subsequent `undo()` can't
|
|
1432
|
+
* recover the transient pre-hydration default. Internal — set by the
|
|
1433
|
+
* activate path in `create-form-store.ts`. Don't set from consumer
|
|
1434
|
+
* code.
|
|
1523
1435
|
*/
|
|
1524
1436
|
readonly hydration?: boolean;
|
|
1525
|
-
/**
|
|
1526
|
-
* When `true`, this write originated from a sibling tab's
|
|
1527
|
-
* BroadcastChannel broadcast (the multi-tab sync module's inbound
|
|
1528
|
-
* apply). Listeners that initiate side effects check this flag to
|
|
1529
|
-
* avoid amplification loops and spurious side effects:
|
|
1530
|
-
*
|
|
1531
|
-
* - The multi-tab sync OUTBOUND broadcaster skips so a remote-driven
|
|
1532
|
-
* write doesn't echo back across the channel.
|
|
1533
|
-
* - The history module updates its diff anchor but does NOT push a
|
|
1534
|
-
* delta — remote writes aren't part of the local user's undo
|
|
1535
|
-
* timeline.
|
|
1536
|
-
* - The persistence writer skips so the receiving tab doesn't
|
|
1537
|
-
* double-persist a value the originating tab already wrote.
|
|
1538
|
-
*
|
|
1539
|
-
* Internal — set by `createMultiTabSyncModule`. Don't set from
|
|
1540
|
-
* consumer code.
|
|
1541
|
-
*/
|
|
1542
|
-
readonly crossTab?: boolean;
|
|
1543
1437
|
};
|
|
1544
1438
|
/**
|
|
1545
1439
|
* Undo/redo configuration passed via `useForm({ history })`.
|
|
@@ -1605,81 +1499,6 @@ type FormHistoryNamespace = {
|
|
|
1605
1499
|
*/
|
|
1606
1500
|
readonly size: number;
|
|
1607
1501
|
};
|
|
1608
|
-
/**
|
|
1609
|
-
* Full options bag for `useForm({ persist })`. Use this when you need
|
|
1610
|
-
* to override defaults beyond picking the backend.
|
|
1611
|
-
*
|
|
1612
|
-
* For backend-only setup, the shorthand forms are equivalent:
|
|
1613
|
-
*
|
|
1614
|
-
* ```ts
|
|
1615
|
-
* useForm({ persist: 'local' })
|
|
1616
|
-
* // same as
|
|
1617
|
-
* useForm({ persist: { storage: 'local' } })
|
|
1618
|
-
* ```
|
|
1619
|
-
*/
|
|
1620
|
-
type PersistConfigOptions = {
|
|
1621
|
-
/**
|
|
1622
|
-
* Where to persist. Pass `'local'` / `'session'` / `'indexeddb'` to
|
|
1623
|
-
* use a built-in backend, or a custom `FormStorage` object for
|
|
1624
|
-
* anything else. The built-in backends are loaded on demand, so
|
|
1625
|
-
* picking `'local'` doesn't pull in IndexedDB code.
|
|
1626
|
-
*/
|
|
1627
|
-
storage: FormStorageKind | FormStorage;
|
|
1628
|
-
/**
|
|
1629
|
-
* Storage key namespace. Defaults to `attaform:${formKey}`.
|
|
1630
|
-
* Override when you need a custom prefix (e.g. multi-tenant apps
|
|
1631
|
-
* where the same form key may exist per-tenant).
|
|
1632
|
-
*/
|
|
1633
|
-
key?: string;
|
|
1634
|
-
/**
|
|
1635
|
-
* How long to wait after the last mutation before writing. Default
|
|
1636
|
-
* `300` ms.
|
|
1637
|
-
*
|
|
1638
|
-
* Pass `0` to disable debouncing — every form change writes to the
|
|
1639
|
-
* storage adapter immediately, no `setTimeout` indirection. Almost
|
|
1640
|
-
* never the right choice for production (the storage adapter sees
|
|
1641
|
-
* every keystroke), but useful for tests or for diagnosing perceived
|
|
1642
|
-
* lag.
|
|
1643
|
-
*/
|
|
1644
|
-
debounceMs?: number;
|
|
1645
|
-
/**
|
|
1646
|
-
* What to persist. `'form'` (default) is sufficient for most cases —
|
|
1647
|
-
* fresh validation on reload repopulates errors. Pick `'form+errors'`
|
|
1648
|
-
* when the error state is expensive to recompute (e.g. server-side
|
|
1649
|
-
* cross-field validation).
|
|
1650
|
-
*/
|
|
1651
|
-
include?: PersistIncludeMode;
|
|
1652
|
-
/**
|
|
1653
|
-
* When `true` (default), the persisted entry is wiped after
|
|
1654
|
-
* `handleSubmit`'s submit callback resolves successfully. Set to
|
|
1655
|
-
* `false` if you need the draft to survive across submissions.
|
|
1656
|
-
*/
|
|
1657
|
-
clearOnSubmitSuccess?: boolean;
|
|
1658
|
-
};
|
|
1659
|
-
/**
|
|
1660
|
-
* Persistence configuration for `useForm({ persist })`. Off by default —
|
|
1661
|
-
* with no config, the form does no reads, no writes, and pulls in no
|
|
1662
|
-
* storage code.
|
|
1663
|
-
*
|
|
1664
|
-
* Three input forms; pick the one that reads best at the call site:
|
|
1665
|
-
*
|
|
1666
|
-
* ```ts
|
|
1667
|
-
* // shorthand: built-in backend
|
|
1668
|
-
* useForm({ persist: 'local' })
|
|
1669
|
-
*
|
|
1670
|
-
* // shorthand: custom adapter
|
|
1671
|
-
* useForm({ persist: encryptedStorage })
|
|
1672
|
-
*
|
|
1673
|
-
* // full options bag
|
|
1674
|
-
* useForm({ persist: { storage: 'local', debounceMs: 500 } })
|
|
1675
|
-
* ```
|
|
1676
|
-
*
|
|
1677
|
-
* Per-field opt-in: setting `persist` is necessary but not sufficient.
|
|
1678
|
-
* Each field that should actually persist also needs
|
|
1679
|
-
* `register('foo', { persist: true })` — sensitive fields must opt in
|
|
1680
|
-
* explicitly so they don't accidentally land in client-side storage.
|
|
1681
|
-
*/
|
|
1682
|
-
type PersistConfig = FormStorageKind | FormStorage | PersistConfigOptions;
|
|
1683
1502
|
/**
|
|
1684
1503
|
* Configuration object passed to `useForm`. All fields except `schema`
|
|
1685
1504
|
* are optional.
|
|
@@ -1690,7 +1509,6 @@ type PersistConfig = FormStorageKind | FormStorage | PersistConfigOptions;
|
|
|
1690
1509
|
* defaultValues: { email: '' },
|
|
1691
1510
|
* validateOn: 'change',
|
|
1692
1511
|
* debounceMs: 200,
|
|
1693
|
-
* persist: 'local',
|
|
1694
1512
|
* })
|
|
1695
1513
|
* ```
|
|
1696
1514
|
*/
|
|
@@ -1720,8 +1538,7 @@ type UseFormConfiguration<Form extends GenericForm, GetValueFormType, Schema ext
|
|
|
1720
1538
|
* - to look it up from a distant component via `injectForm(key)`;
|
|
1721
1539
|
* - to share state across components (multiple `useForm({ key })`
|
|
1722
1540
|
* calls with the same key resolve to the same form);
|
|
1723
|
-
* - to give DevTools and validation errors a recognisable label
|
|
1724
|
-
* - to namespace persisted drafts.
|
|
1541
|
+
* - to give DevTools and validation errors a recognisable label.
|
|
1725
1542
|
*
|
|
1726
1543
|
* Keys starting with `__atta:` are reserved for internal use and
|
|
1727
1544
|
* throw `ReservedFormKeyError` if passed.
|
|
@@ -1825,30 +1642,6 @@ type UseFormConfiguration<Form extends GenericForm, GetValueFormType, Schema ext
|
|
|
1825
1642
|
* per blur for `<input v-register.lazy>`).
|
|
1826
1643
|
*/
|
|
1827
1644
|
debounceMs?: number;
|
|
1828
|
-
/**
|
|
1829
|
-
* Opt-in persistence of the form's draft state. Off by default —
|
|
1830
|
-
* with no config, no reads, no writes, no storage code is loaded.
|
|
1831
|
-
*
|
|
1832
|
-
* Three input forms; pick the one that reads best:
|
|
1833
|
-
*
|
|
1834
|
-
* ```ts
|
|
1835
|
-
* useForm({ persist: 'local' }) // built-in backend
|
|
1836
|
-
* useForm({ persist: encryptedStorage }) // custom backend
|
|
1837
|
-
* useForm({ persist: { storage: 'local', debounceMs: 500 } })
|
|
1838
|
-
* ```
|
|
1839
|
-
*
|
|
1840
|
-
* Per-field opt-in is required: every field that should actually
|
|
1841
|
-
* persist needs `register(path, { persist: true })`. Without any
|
|
1842
|
-
* opt-ins, the form mounts but never writes to storage — and a
|
|
1843
|
-
* dev-mode warning surfaces the misconfiguration. This guard
|
|
1844
|
-
* prevents sensitive fields from accidentally leaking to
|
|
1845
|
-
* client-side storage.
|
|
1846
|
-
*
|
|
1847
|
-
* Switching backends across reloads (e.g. `'local'` → `'session'`)
|
|
1848
|
-
* automatically clears the previous backend's entry so old drafts
|
|
1849
|
-
* don't orphan.
|
|
1850
|
-
*/
|
|
1851
|
-
persist?: PersistConfig;
|
|
1852
1645
|
/**
|
|
1853
1646
|
* Opt-in undo/redo. Off by default. `true` enables with a 128-position
|
|
1854
1647
|
* cap; `{ max: N }` tunes the cap.
|
|
@@ -1876,12 +1669,8 @@ type UseFormConfiguration<Form extends GenericForm, GetValueFormType, Schema ext
|
|
|
1876
1669
|
* every switch (the data is gone). The new variant initializes
|
|
1877
1670
|
* from its slim default.
|
|
1878
1671
|
*
|
|
1879
|
-
* Memory is in-memory only and does not survive
|
|
1880
|
-
*
|
|
1881
|
-
* variant memory starts empty — the first discriminator switch
|
|
1882
|
-
* after reload loses any persisted typing in the outgoing variant.
|
|
1883
|
-
* Consumers needing cross-session continuity must persist beyond
|
|
1884
|
-
* the variant boundary themselves.
|
|
1672
|
+
* Memory is in-memory only and does not survive a fresh mount: a
|
|
1673
|
+
* page reload starts every discriminator's variant memory empty.
|
|
1885
1674
|
*
|
|
1886
1675
|
* `reset()` clears variant memory. `resetField(path)` clears any
|
|
1887
1676
|
* memory entry whose union path equals or sits under `path`.
|
|
@@ -1937,54 +1726,6 @@ type UseFormConfiguration<Form extends GenericForm, GetValueFormType, Schema ext
|
|
|
1937
1726
|
* and the broader description of where the cap is read.
|
|
1938
1727
|
*/
|
|
1939
1728
|
maxRecursionDepth?: number;
|
|
1940
|
-
/**
|
|
1941
|
-
* Override the path-segment name stems treated as sensitive for this
|
|
1942
|
-
* form. Sensitive paths are excluded from persistence writes and
|
|
1943
|
-
* multi-tab sync broadcasts. (DevTools renders raw values by design;
|
|
1944
|
-
* it does not redact.)
|
|
1945
|
-
*
|
|
1946
|
-
* Resolution: per-form value (this field) > global default
|
|
1947
|
-
* (`createAttaform({ defaults: { sensitiveNames } })`) > library
|
|
1948
|
-
* default (`DEFAULT_SENSITIVE_NAMES`).
|
|
1949
|
-
*
|
|
1950
|
-
* Pass an empty array `[]` as the explicit opt-out — "nothing is
|
|
1951
|
-
* sensitive on this form" — for fully-trusted internal tooling.
|
|
1952
|
-
* See `AttaformDefaults.sensitiveNames` for composition examples.
|
|
1953
|
-
*/
|
|
1954
|
-
sensitiveNames?: readonly string[];
|
|
1955
|
-
/**
|
|
1956
|
-
* Cross-tab synchronisation via BroadcastChannel. **Defaults to
|
|
1957
|
-
* `false` (opt-in).** Setting `true` on a keyed `useForm` callsite
|
|
1958
|
-
* auto-pairs the form with same-keyed siblings in other same-origin
|
|
1959
|
-
* tabs and mirrors their mutations in near real-time.
|
|
1960
|
-
*
|
|
1961
|
-
* **Resolution order (per-register override > per-form > global > library):**
|
|
1962
|
-
*
|
|
1963
|
-
* register(path, { multiTab }) > useForm({ multiTab }) > AttaformDefaults.multiTab > library default (`false`)
|
|
1964
|
-
*
|
|
1965
|
-
* **Why opt-in.** Same-keyed forms broadcasting by default leaks
|
|
1966
|
-
* surprise: a user editing in one tab sees their values appear in a
|
|
1967
|
-
* sibling tab they forgot was open, including PII / PHI for forms
|
|
1968
|
-
* that don't explicitly use `sensitiveNames`. Mirrors the `persist`
|
|
1969
|
-
* default (also opt-in): both opt-in surfaces compose into one
|
|
1970
|
-
* consistent "richer state needs explicit consent" rule.
|
|
1971
|
-
*
|
|
1972
|
-
* **What's stripped even when opt-in.** `File` and `Blob` values
|
|
1973
|
-
* never traverse the channel regardless of this flag (security +
|
|
1974
|
-
* `structuredClone` cost). Sensitive-named paths (via
|
|
1975
|
-
* `sensitiveNames`) are stripped both directions. See the
|
|
1976
|
-
* multi-tab sync page for the full security model.
|
|
1977
|
-
*
|
|
1978
|
-
* **Secure-context requirement.** Even with `multiTab: true`, sync
|
|
1979
|
-
* is silently disabled outside `window.isSecureContext === true`
|
|
1980
|
-
* (HTTPS or localhost). On plain HTTP a one-shot dev warning fires
|
|
1981
|
-
* and the module noops.
|
|
1982
|
-
*
|
|
1983
|
-
* **Anonymous (auto-keyed) forms skip sync entirely** — without a
|
|
1984
|
-
* consumer-supplied `key`, cross-tab identity is undefined and the
|
|
1985
|
-
* channel would be solo by construction.
|
|
1986
|
-
*/
|
|
1987
|
-
multiTab?: boolean;
|
|
1988
1729
|
/**
|
|
1989
1730
|
* Whether `v-register` automatically manages aria attributes
|
|
1990
1731
|
* (`aria-invalid`, `aria-busy`, `aria-required`, `aria-describedby`)
|
|
@@ -2041,8 +1782,8 @@ type UseFormConfiguration<Form extends GenericForm, GetValueFormType, Schema ext
|
|
|
2041
1782
|
* app-level default is fine — forms that switch to `'blur'` /
|
|
2042
1783
|
* `'submit'` simply ignore the inherited `debounceMs`.
|
|
2043
1784
|
*
|
|
2044
|
-
* `schema`, `key`,
|
|
2045
|
-
*
|
|
1785
|
+
* `schema`, `key`, and `defaultValues` are not configurable here —
|
|
1786
|
+
* they belong on the per-form call.
|
|
2046
1787
|
*/
|
|
2047
1788
|
type AttaformDefaults = {
|
|
2048
1789
|
/** Default for `useForm({ strict })`. Default `true`. */
|
|
@@ -2167,56 +1908,6 @@ type AttaformDefaults = {
|
|
|
2167
1908
|
* confident the recursion is bounded by the actual data shape.
|
|
2168
1909
|
*/
|
|
2169
1910
|
maxRecursionDepth?: number;
|
|
2170
|
-
/**
|
|
2171
|
-
* Override the path-segment name stems treated as sensitive.
|
|
2172
|
-
* Sensitive paths are excluded from persistence writes and multi-tab
|
|
2173
|
-
* sync broadcasts — one configurable source of truth across those
|
|
2174
|
-
* surfaces. (DevTools renders raw values by design; it does not
|
|
2175
|
-
* redact.)
|
|
2176
|
-
*
|
|
2177
|
-
* Library default is `DEFAULT_SENSITIVE_NAMES` (exported from
|
|
2178
|
-
* `attaform`); compose to extend:
|
|
2179
|
-
*
|
|
2180
|
-
* ```ts
|
|
2181
|
-
* import { DEFAULT_SENSITIVE_NAMES, createAttaform } from 'attaform'
|
|
2182
|
-
*
|
|
2183
|
-
* createAttaform({
|
|
2184
|
-
* defaults: { sensitiveNames: [...DEFAULT_SENSITIVE_NAMES, 'mrn', 'tax_id'] }
|
|
2185
|
-
* })
|
|
2186
|
-
* ```
|
|
2187
|
-
*
|
|
2188
|
-
* Pass an empty array `[]` as the explicit opt-out — "nothing is
|
|
2189
|
-
* sensitive" — for fully-trusted internal tooling. When present at
|
|
2190
|
-
* the per-form level via `useForm({ sensitiveNames })`, the per-form
|
|
2191
|
-
* list REPLACES the global one (consumers compose their own
|
|
2192
|
-
* additive lists via the exported default).
|
|
2193
|
-
*/
|
|
2194
|
-
sensitiveNames?: readonly string[];
|
|
2195
|
-
/**
|
|
2196
|
-
* App-wide default for `useForm({ multiTab })`. Library default is
|
|
2197
|
-
* `false` (opt-in) — same posture as `persist`. Set to `true` once
|
|
2198
|
-
* at the plugin level to enable cross-tab sync for every form in
|
|
2199
|
-
* the app by default; individual forms can still opt out via
|
|
2200
|
-
* `useForm({ multiTab: false })`.
|
|
2201
|
-
*
|
|
2202
|
-
* **Resolution order (per-form wins):**
|
|
2203
|
-
*
|
|
2204
|
-
* useForm({ multiTab }) > AttaformDefaults.multiTab > library default (`false`)
|
|
2205
|
-
*
|
|
2206
|
-
* **Why opt-in.** Auto-broadcasting same-keyed forms surprises users
|
|
2207
|
-
* (a value typed in one tab appearing in another they forgot was
|
|
2208
|
-
* open) and leaks state for forms that don't explicitly use
|
|
2209
|
-
* `sensitiveNames`. Paired with `persist` (also opt-in), the two
|
|
2210
|
-
* "richer state" surfaces follow one consistent rule: explicit
|
|
2211
|
-
* consent.
|
|
2212
|
-
*
|
|
2213
|
-
* **Secure-context gate.** Even with `multiTab: true`, sync only
|
|
2214
|
-
* activates over HTTPS or localhost. On plain HTTP, the module
|
|
2215
|
-
* silently noops with a one-shot dev-mode warning — production
|
|
2216
|
-
* deployments MUST be served over HTTPS for sync to function. See
|
|
2217
|
-
* the multi-tab-sync recipe's Security section for the threat model.
|
|
2218
|
-
*/
|
|
2219
|
-
multiTab?: boolean;
|
|
2220
1911
|
/**
|
|
2221
1912
|
* App-wide default for `useForm({ autoAria })`. Library default is
|
|
2222
1913
|
* `true`: `v-register` keeps `aria-invalid` / `aria-busy` /
|
|
@@ -2537,55 +2228,10 @@ type CoercionEntry<I extends SlimPrimitiveKind = SlimPrimitiveKind, O extends Sl
|
|
|
2537
2228
|
*/
|
|
2538
2229
|
type CoercionRegistry = readonly CoercionEntry[];
|
|
2539
2230
|
/**
|
|
2540
|
-
* Options for `register(path, options)`. Per-field
|
|
2541
|
-
*
|
|
2542
|
-
* adding a new field can't accidentally leak into the persistence
|
|
2543
|
-
* pipeline unless the field's `register` call says so explicitly.
|
|
2231
|
+
* Options for `register(path, options)`. Per-field configuration
|
|
2232
|
+
* applied at the binding's own call site.
|
|
2544
2233
|
*/
|
|
2545
2234
|
type RegisterOptions = {
|
|
2546
|
-
/**
|
|
2547
|
-
* Opt this field into the form's persistence pipeline. The form
|
|
2548
|
-
* also needs `useForm({ persist })` configured for any storage
|
|
2549
|
-
* activity to happen.
|
|
2550
|
-
*
|
|
2551
|
-
* Persistence follows the field's lifecycle: writes flow on
|
|
2552
|
-
* mount, the field is dropped from the persisted draft on unmount.
|
|
2553
|
-
* If multiple inputs bind to the same path, the path keeps
|
|
2554
|
-
* persisting as long as any opted-in input is mounted.
|
|
2555
|
-
*
|
|
2556
|
-
* When the path looks sensitive (password / cvv / ssn / token /
|
|
2557
|
-
* etc.) the opt-in is skipped with a one-shot dev warning unless
|
|
2558
|
-
* `acknowledgeSensitive: true` is also set — the field simply isn't
|
|
2559
|
-
* persisted (the secure default). It never throws.
|
|
2560
|
-
*/
|
|
2561
|
-
persist?: boolean;
|
|
2562
|
-
/**
|
|
2563
|
-
* Suppress the sensitive-name guard. Required to persist any path
|
|
2564
|
-
* whose name matches the heuristic (password, cvv, ssn, etc.).
|
|
2565
|
-
* Treat this as a code-review checkpoint: setting it should be a
|
|
2566
|
-
* deliberate decision that the path's data is safe to land in
|
|
2567
|
-
* client-side storage for this user's session.
|
|
2568
|
-
*/
|
|
2569
|
-
acknowledgeSensitive?: boolean;
|
|
2570
|
-
/**
|
|
2571
|
-
* Opt this field OUT of multi-tab sync. The form-level cascade
|
|
2572
|
-
* activates sync by default; passing `multiTab: false` on a single
|
|
2573
|
-
* register call keeps that path tab-local — outbound patches at
|
|
2574
|
-
* the path are stripped, and inbound patches at the path are
|
|
2575
|
-
* rejected (symmetric tab-local behaviour).
|
|
2576
|
-
*
|
|
2577
|
-
* The opt-out is downgrade-only — you cannot pass `multiTab: true`
|
|
2578
|
-
* to bring sync back on a form whose form-level `multiTab` is
|
|
2579
|
-
* `false` (in that case the sync module never instantiated; there's
|
|
2580
|
-
* no broadcaster to opt back into).
|
|
2581
|
-
*
|
|
2582
|
-
* Use for fields that hold transient per-tab UI state inside an
|
|
2583
|
-
* otherwise-synced form (e.g. an editor's cursor position field
|
|
2584
|
-
* mirrored into the form for save-on-blur), or for individual
|
|
2585
|
-
* paths the consumer wants to scope to the originating tab without
|
|
2586
|
-
* disabling sync globally.
|
|
2587
|
-
*/
|
|
2588
|
-
multiTab?: boolean;
|
|
2589
2235
|
/**
|
|
2590
2236
|
* Sync transformation pipeline applied to user-typed values before
|
|
2591
2237
|
* they reach form state. Composes left-to-right: each transform
|
|
@@ -2646,7 +2292,7 @@ type RegisterOptions = {
|
|
|
2646
2292
|
* Or read `innerRef` directly when integrating with custom components.
|
|
2647
2293
|
*
|
|
2648
2294
|
* The returned value is a `shallowReadonly` reactive proxy: top-level
|
|
2649
|
-
* reads (`rv.path`, `rv.formKey`, `rv.
|
|
2295
|
+
* reads (`rv.path`, `rv.formKey`, `rv.segments`, …) track in reactive
|
|
2650
2296
|
* scopes, mutations are blocked, and inner refs (`innerRef`,
|
|
2651
2297
|
* `displayValue`) keep their `Ref` shape.
|
|
2652
2298
|
*
|
|
@@ -2666,16 +2312,14 @@ type RegisterValue<Value = unknown> = Readonly<{
|
|
|
2666
2312
|
* automatically; expose it to custom integrations that need to
|
|
2667
2313
|
* register an element manually.
|
|
2668
2314
|
*
|
|
2669
|
-
* Recording the element
|
|
2670
|
-
*
|
|
2671
|
-
* their own.
|
|
2315
|
+
* Recording the element drives the form's element map (used for
|
|
2316
|
+
* `field.meta.connected`, `focusFirstError`, and `scrollToFirstError`).
|
|
2672
2317
|
*/
|
|
2673
2318
|
registerElement: (el: HTMLElement) => void;
|
|
2674
2319
|
/**
|
|
2675
2320
|
* Detach an HTML element from this binding. Pair with
|
|
2676
|
-
* `registerElement` for custom integrations.
|
|
2677
|
-
*
|
|
2678
|
-
* "no auto-persist".
|
|
2321
|
+
* `registerElement` for custom integrations. Drops the element from
|
|
2322
|
+
* the form's element map.
|
|
2679
2323
|
*/
|
|
2680
2324
|
deregisterElement: (el: HTMLElement) => void;
|
|
2681
2325
|
/**
|
|
@@ -2683,16 +2327,10 @@ type RegisterValue<Value = unknown> = Readonly<{
|
|
|
2683
2327
|
* write was accepted, `false` when it was rejected (e.g. wrong
|
|
2684
2328
|
* primitive type for the path).
|
|
2685
2329
|
*
|
|
2686
|
-
*
|
|
2687
|
-
* the
|
|
2688
|
-
*
|
|
2689
|
-
*
|
|
2690
|
-
* and consumer assigners can omit `meta` to participate in the same
|
|
2691
|
-
* persistence channel the default assigner uses.
|
|
2692
|
-
*
|
|
2693
|
-
* Pass an explicit `meta` to override the auto-derivation, e.g.
|
|
2694
|
-
* `{ persist: false }` to skip persistence for a transient write
|
|
2695
|
-
* even when the element is opted in.
|
|
2330
|
+
* The write path for custom directives and consumer assigners: it
|
|
2331
|
+
* routes through the same funnel (and per-instance meta) as the
|
|
2332
|
+
* directive's default assigner. Caller-supplied `meta` passes through
|
|
2333
|
+
* unchanged.
|
|
2696
2334
|
*/
|
|
2697
2335
|
setValueWithInternalPath: (value: unknown, meta?: WriteMeta) => boolean;
|
|
2698
2336
|
/**
|
|
@@ -2741,55 +2379,6 @@ type RegisterValue<Value = unknown> = Readonly<{
|
|
|
2741
2379
|
* `key`.
|
|
2742
2380
|
*/
|
|
2743
2381
|
formInstanceId: string;
|
|
2744
|
-
/**
|
|
2745
|
-
* Whether this binding opted into persistence via `register(path, { persist: true })`.
|
|
2746
|
-
* @internal
|
|
2747
|
-
*/
|
|
2748
|
-
persist: boolean;
|
|
2749
|
-
/**
|
|
2750
|
-
* Whether this binding acknowledged a sensitive-name override.
|
|
2751
|
-
* @internal
|
|
2752
|
-
*/
|
|
2753
|
-
acknowledgeSensitive: boolean;
|
|
2754
|
-
/**
|
|
2755
|
-
* Per-element persistence opt-in registry. Used by directive integrations.
|
|
2756
|
-
* @internal
|
|
2757
|
-
*/
|
|
2758
|
-
persistOptIns: PersistOptInRegistry;
|
|
2759
|
-
/**
|
|
2760
|
-
* Resolved sensitive-path predicate honoring this form's
|
|
2761
|
-
* `sensitiveNames` cascade. The directive calls this through
|
|
2762
|
-
* `allowSensitivePersist` when a `register('path', { persist: true })`
|
|
2763
|
-
* binding mounts so a per-form custom list (e.g. extending with
|
|
2764
|
-
* `'mrn'`) gates persistence enrolment correctly.
|
|
2765
|
-
* @internal
|
|
2766
|
-
*/
|
|
2767
|
-
isSensitivePath: (path: Path | PathKey | string) => boolean;
|
|
2768
|
-
/**
|
|
2769
|
-
* Whether this binding declared `register('path', { multiTab: false })`.
|
|
2770
|
-
* Drives the directive's mount/unmount lifecycle: when `false`, the
|
|
2771
|
-
* directive's `created` hook bumps `state.noSyncPaths` for this
|
|
2772
|
-
* path, and `beforeUnmount` decrements. When `true` (the default),
|
|
2773
|
-
* the binding rides the form-level cascade.
|
|
2774
|
-
* @internal
|
|
2775
|
-
*/
|
|
2776
|
-
multiTab: boolean;
|
|
2777
|
-
/**
|
|
2778
|
-
* Pre-bound mount hook for `multiTab: false` bindings — calls
|
|
2779
|
-
* `state.incrementNoSyncOptOut(path)` with this binding's path.
|
|
2780
|
-
* `undefined` when `multiTab !== false`. The directive invokes
|
|
2781
|
-
* during the mount lifecycle.
|
|
2782
|
-
* @internal
|
|
2783
|
-
*/
|
|
2784
|
-
markNoSync?: () => void;
|
|
2785
|
-
/**
|
|
2786
|
-
* Pre-bound unmount hook for `multiTab: false` bindings — calls
|
|
2787
|
-
* `state.decrementNoSyncOptOut(path)`. Paired with `markNoSync`;
|
|
2788
|
-
* the directive invokes on `beforeUnmount` (and on `beforeUpdate`
|
|
2789
|
-
* when the binding transitions out of opt-out).
|
|
2790
|
-
* @internal
|
|
2791
|
-
*/
|
|
2792
|
-
unmarkNoSync?: () => void;
|
|
2793
2382
|
/**
|
|
2794
2383
|
* Sync transform pipeline applied by the directive's assigner to
|
|
2795
2384
|
* user-typed values before they reach form state. See
|
|
@@ -2841,8 +2430,7 @@ type RegisterValue<Value = unknown> = Readonly<{
|
|
|
2841
2430
|
* Add this field's path to the form's `blankPaths` set,
|
|
2842
2431
|
* writing the slim default to storage. Returns the `setValueAtPath`
|
|
2843
2432
|
* boolean (`true` accepted, `false` rejected by the slim-primitive
|
|
2844
|
-
* gate).
|
|
2845
|
-
* the same persistence channel as user-typed writes.
|
|
2433
|
+
* gate).
|
|
2846
2434
|
*
|
|
2847
2435
|
* Called by the directive's input listener on numeric clear (commit
|
|
2848
2436
|
* 5) and by the imperative `setValue(path, unset)` translation
|
|
@@ -4402,10 +3990,7 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4402
3990
|
*
|
|
4403
3991
|
* ```vue
|
|
4404
3992
|
* <input v-register="form.register('email')" />
|
|
4405
|
-
* <input
|
|
4406
|
-
* type="password"
|
|
4407
|
-
* v-register="form.register('password', { persist: true, acknowledgeSensitive: true })"
|
|
4408
|
-
* />
|
|
3993
|
+
* <input v-register="form.register('username', { transforms: [trim] })" />
|
|
4409
3994
|
* ```
|
|
4410
3995
|
*
|
|
4411
3996
|
* Also accepts a segment-array form for callers building paths
|
|
@@ -4419,9 +4004,8 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4419
4004
|
* </fieldset>
|
|
4420
4005
|
* ```
|
|
4421
4006
|
*
|
|
4422
|
-
* Pass `options.
|
|
4423
|
-
*
|
|
4424
|
-
* for storage activity to actually happen.
|
|
4007
|
+
* Pass `options.transforms` to run a sync normalisation pipeline over
|
|
4008
|
+
* user-typed values before they reach form state.
|
|
4425
4009
|
*/
|
|
4426
4010
|
register: {
|
|
4427
4011
|
<Path extends RegisterFlatPath<Form, keyof Form>>(path: Path, options?: RegisterOptions): RegisterValue<NestedReadType<WriteShape<ReadForm>, Path>>;
|
|
@@ -4665,11 +4249,7 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4665
4249
|
* - field errors;
|
|
4666
4250
|
* - touched / focused / blurred per-field flags;
|
|
4667
4251
|
* - submission state (`submitting` / `submissionAttempts` /
|
|
4668
|
-
* `submitted` / `submitError`)
|
|
4669
|
-
* - the persisted draft, if persistence is configured.
|
|
4670
|
-
*
|
|
4671
|
-
* The next edit on a still-mounted opted-in input will start
|
|
4672
|
-
* persisting again automatically.
|
|
4252
|
+
* `submitted` / `submitError`).
|
|
4673
4253
|
*/
|
|
4674
4254
|
reset: (nextDefaultValues?: DefaultValuesInput<Form>) => void;
|
|
4675
4255
|
/**
|
|
@@ -4679,9 +4259,6 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4679
4259
|
*
|
|
4680
4260
|
* No-op when the path doesn't exist on the form (e.g. a typo'd
|
|
4681
4261
|
* dynamic key).
|
|
4682
|
-
*
|
|
4683
|
-
* If persistence is configured, the matching subpath is removed
|
|
4684
|
-
* from the persisted draft too.
|
|
4685
4262
|
*/
|
|
4686
4263
|
resetField: (path: FlatPath<Form>) => void;
|
|
4687
4264
|
/**
|
|
@@ -4717,8 +4294,8 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4717
4294
|
* on a `false` return.
|
|
4718
4295
|
*
|
|
4719
4296
|
* Sugar over `setValue(path, schema.getEmptyValueAtPath(path))` —
|
|
4720
|
-
* no separate bookkeeping. Variant memory, history,
|
|
4721
|
-
*
|
|
4297
|
+
* no separate bookkeeping. Variant memory, history, and listeners
|
|
4298
|
+
* all see this as a regular write at the path.
|
|
4722
4299
|
*
|
|
4723
4300
|
* `clear()` (no arg) targets the whole form. `clear('')` targets
|
|
4724
4301
|
* the empty-string path slot SPECIFICALLY — the two are NOT
|
|
@@ -4729,33 +4306,6 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4729
4306
|
<Path extends FlatPath<Form> | ''>(path: Path): boolean;
|
|
4730
4307
|
<const S extends ReadonlyArray<string | number>>(segments: S & ([JoinSegments<S>] extends [FlatPath<Form> | ''] ? unknown : never)): boolean;
|
|
4731
4308
|
};
|
|
4732
|
-
/**
|
|
4733
|
-
* Write the current value at `path` to storage immediately. Useful
|
|
4734
|
-
* for explicit "Save draft" buttons, `beforeunload` handlers, or
|
|
4735
|
-
* multi-step checkpoints where the user shouldn't wait for the
|
|
4736
|
-
* debounce window.
|
|
4737
|
-
*
|
|
4738
|
-
* Bypasses both the per-field opt-in and the debouncer. Existing
|
|
4739
|
-
* paths in the persisted draft are preserved (this is a merge,
|
|
4740
|
-
* not a replace).
|
|
4741
|
-
*
|
|
4742
|
-
* For sensitive-looking paths, warns once and no-ops unless you pass
|
|
4743
|
-
* `{ acknowledgeSensitive: true }` — it never throws. Also a no-op
|
|
4744
|
-
* when `useForm({ persist })` wasn't configured.
|
|
4745
|
-
*/
|
|
4746
|
-
persist: (path: FlatPath<Form>, options?: {
|
|
4747
|
-
acknowledgeSensitive?: boolean;
|
|
4748
|
-
}) => Promise<void>;
|
|
4749
|
-
/**
|
|
4750
|
-
* Remove data from the persisted draft. Without arguments, wipes
|
|
4751
|
-
* the entire entry. With a path, removes just that subpath.
|
|
4752
|
-
*
|
|
4753
|
-
* Does not change the in-memory form state — pair with `reset()`
|
|
4754
|
-
* / `resetField()` if you need both. Future edits to still-mounted
|
|
4755
|
-
* opted-in fields will re-populate the entry. No-op when
|
|
4756
|
-
* persistence isn't configured.
|
|
4757
|
-
*/
|
|
4758
|
-
clearPersistedDraft: (path?: FlatPath<Form>) => Promise<void>;
|
|
4759
4309
|
/**
|
|
4760
4310
|
* Consolidated undo/redo namespace — `form.history.{undo, redo,
|
|
4761
4311
|
* clear, canUndo, canRedo, size}`. Always present; inert when
|
|
@@ -4915,5 +4465,5 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4915
4465
|
blankPaths: ComputedRef<BlankPathsView>;
|
|
4916
4466
|
};
|
|
4917
4467
|
|
|
4918
|
-
export { ROOT_PATH as
|
|
4919
|
-
export type {
|
|
4468
|
+
export { ROOT_PATH as $, ROOT_PATH_KEY as a0, canonicalizePath as an, isPathPrefix as ao, isUnset as ap, parseDottedPath as aq, unset as ar };
|
|
4469
|
+
export type { AttaformDefaults as A, HistoryConfig as B, CoercionEntry as C, DefaultValuesInput as D, ErrorsProxyShape as E, FormKey as F, GenericForm as G, HandleSubmit as H, IsTuple as I, IsUnion as J, JoinSegments as K, KeyofUnion as L, LiftedValueShape as M, MetaTrackerValue as N, NestedReadType as O, NestedType as P, OnError as Q, RegisterModelDynamicCustomDirective as R, OnInvalidSubmitPolicy as S, OnSubmit as T, UseFormConfiguration as U, ValidationError as V, PartialFlatPath as W, Path as X, PathKey as Y, PendingValidationStatus as Z, Primitive as _, AbstractSchema as a, ReactiveValidationStatus as a1, RegisterDirective as a2, RegisterFlatPath as a3, RegisterOptions as a4, RegisterSelectModifier as a5, RegisterTextModifier as a6, RegisterTransform as a7, Segment as a8, SetValueCallback as a9, SetValuePayload as aa, SettledValidationStatus as ab, SlimPrimitiveKind as ac, SlimRuntimeOf as ad, SubmitHandler as ae, Unset as af, ValidateOn as ag, ValidateOnConfig as ah, ValidationResponse as ai, ValidationResponseWithoutValue as aj, ValueOfUnion as ak, WriteMeta as al, WriteShape as am, SchemaFactoryOptions as as, TransformAbortHolder as at, UseFormReturnType as b, RegisterValue as c, GetDisplayState as d, ApiErrorEnvelope as e, ApiErrorDetails as f, ApiErrorEntry as g, ArrayItem as h, ArrayPath as i, CoercionRegistry as j, CoercionResult as k, CustomDirectiveRegisterAssignerFn as l, DeepPartial as m, DefaultValuesResponse as n, DefaultValuesShape as o, DisplayCtx as p, DisplayMachine as q, DisplayState as r, FieldMetaPayload as s, FieldState as t, FieldStateMap as u, FieldStateMapEntry as v, FlatPath as w, FormErrorRecord as x, FormErrorsSurface as y, FormMeta as z };
|