attaform 0.27.3 → 0.27.4

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 (51) hide show
  1. package/dist/abstract.cjs +1 -1
  2. package/dist/abstract.d.cts +2 -2
  3. package/dist/abstract.d.mts +2 -2
  4. package/dist/abstract.d.ts +2 -2
  5. package/dist/abstract.mjs +1 -1
  6. package/dist/chunks/fingerprint2.cjs +1 -1
  7. package/dist/chunks/fingerprint2.mjs +1 -1
  8. package/dist/index.cjs +2 -2
  9. package/dist/index.d.cts +1 -1
  10. package/dist/index.d.mts +1 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.mjs +2 -2
  13. package/dist/shared/{attaform.DeHCOlC8.cjs → attaform.B3spfqIA.cjs} +3 -3
  14. package/dist/shared/{attaform.DeHCOlC8.cjs.map → attaform.B3spfqIA.cjs.map} +1 -1
  15. package/dist/shared/{attaform.DuVCclwv.mjs → attaform.BrVzB14N.mjs} +3 -3
  16. package/dist/shared/{attaform.DuVCclwv.mjs.map → attaform.BrVzB14N.mjs.map} +1 -1
  17. package/dist/shared/{attaform.Mg4g-J0z.cjs → attaform.C9arOC5p.cjs} +4 -4
  18. package/dist/shared/{attaform.Mg4g-J0z.cjs.map → attaform.C9arOC5p.cjs.map} +1 -1
  19. package/dist/shared/{attaform.DHQjaGMP.mjs → attaform.CC4KCx_q.mjs} +4 -4
  20. package/dist/shared/{attaform.DHQjaGMP.mjs.map → attaform.CC4KCx_q.mjs.map} +1 -1
  21. package/dist/shared/{attaform.dX58Auwf.cjs → attaform.CX2NHAFs.cjs} +2 -2
  22. package/dist/shared/{attaform.dX58Auwf.cjs.map → attaform.CX2NHAFs.cjs.map} +1 -1
  23. package/dist/shared/{attaform.BjGedLx2.d.cts → attaform.Cjh6b6xU.d.cts} +50 -14
  24. package/dist/shared/{attaform.BqkFQ2B9.mjs → attaform.CuUx4jWI.mjs} +41 -25
  25. package/dist/shared/{attaform.ij2W7VTw.cjs.map → attaform.CuUx4jWI.mjs.map} +1 -1
  26. package/dist/shared/{attaform.gqOCvpSB.d.ts → attaform.DKtXMaJB.d.ts} +50 -14
  27. package/dist/shared/{attaform.BOIpRdeG.cjs → attaform.DXwJVUNS.cjs} +3 -3
  28. package/dist/shared/{attaform.BOIpRdeG.cjs.map → attaform.DXwJVUNS.cjs.map} +1 -1
  29. package/dist/shared/{attaform.ij2W7VTw.cjs → attaform.Ib2seKUE.cjs} +41 -25
  30. package/dist/shared/{attaform.BqkFQ2B9.mjs.map → attaform.Ib2seKUE.cjs.map} +1 -1
  31. package/dist/shared/{attaform.BKxpBJVF.mjs → attaform.a1GnhjVk.mjs} +2 -2
  32. package/dist/shared/{attaform.BKxpBJVF.mjs.map → attaform.a1GnhjVk.mjs.map} +1 -1
  33. package/dist/shared/{attaform.CEZP3i3I.d.mts → attaform.gj8dtOlx.d.mts} +50 -14
  34. package/dist/shared/{attaform.DDIn4fv-.mjs → attaform.shkNCMEz.mjs} +3 -3
  35. package/dist/shared/{attaform.DDIn4fv-.mjs.map → attaform.shkNCMEz.mjs.map} +1 -1
  36. package/dist/zod-v3.cjs +2 -2
  37. package/dist/zod-v3.d.cts +1 -1
  38. package/dist/zod-v3.d.mts +1 -1
  39. package/dist/zod-v3.d.ts +1 -1
  40. package/dist/zod-v3.mjs +2 -2
  41. package/dist/zod-v4.cjs +2 -2
  42. package/dist/zod-v4.d.cts +2 -2
  43. package/dist/zod-v4.d.mts +2 -2
  44. package/dist/zod-v4.d.ts +2 -2
  45. package/dist/zod-v4.mjs +2 -2
  46. package/dist/zod.cjs +2 -2
  47. package/dist/zod.d.cts +1 -1
  48. package/dist/zod.d.mts +1 -1
  49. package/dist/zod.d.ts +1 -1
  50. package/dist/zod.mjs +2 -2
  51. package/package.json +1 -1
@@ -1036,9 +1036,9 @@ type AnyForm = {
1036
1036
  * - `gate`: this step's own role as a hard prerequisite. `null` when the
1037
1037
  * step is not a `gate()`; `'uncleared'` while its member form is
1038
1038
  * unconfirmed (so it seals every later step); `'cleared'` once
1039
- * confirmed by a clean member submit or a seeded-valid form gate at
1040
- * mount. Reflects the live compiled shape, so a conditional `gate()`
1041
- * that a function slot drops resolves to `null`.
1039
+ * confirmed by a clean member submit or seeded cleared via
1040
+ * `defaultStatuses`. Reflects the live compiled shape, so a conditional
1041
+ * `gate()` that a function slot drops resolves to `null`.
1042
1042
  *
1043
1043
  * Noop forms generated for string slots surface as default-valid
1044
1044
  * (`{ valid: true, dirty: false, submitted: false, errorCount: 0, locked: false, gate: null }`),
@@ -1054,12 +1054,27 @@ type FormStatus = {
1054
1054
  readonly gate: 'cleared' | 'uncleared' | null;
1055
1055
  };
1056
1056
  /**
1057
- * Seed shape accepted by `useWizard({ defaultStatuses })`. Mirrors
1058
- * `FormStatus` minus its two live-computed flags, `locked` and `gate`:
1059
- * both are derived from the wizard's gates and overlaid on every status
1060
- * read, so a seed never carries them (a seeded value would be ignored).
1061
- */
1062
- type FormStatusSeed = Omit<FormStatus, 'locked' | 'gate'>;
1057
+ * Seed shape accepted by `useWizard({ defaultStatuses })`. Every field is
1058
+ * optional; an omitted meta field falls back to the pending sentinel on
1059
+ * read.
1060
+ *
1061
+ * `locked` is never accepted: it is purely live-derived (sealed behind an
1062
+ * earlier uncleared gate) and overlaid on every status read, so a seeded
1063
+ * value would be ignored.
1064
+ *
1065
+ * `gate` is a WRITE-only seed, not a status field echoed back on read. A
1066
+ * seed of `'cleared'` latches the gate's cleared state once at construction
1067
+ * (an SSR restore of a confirmed prerequisite); the live `gate` overlay
1068
+ * then owns the read. `'uncleared'` is the default and seeds nothing. Only
1069
+ * a step that compiles to a `gate()` honors it — other keys ignore it.
1070
+ */
1071
+ type FormStatusSeed = {
1072
+ readonly valid?: boolean;
1073
+ readonly dirty?: boolean;
1074
+ readonly submitted?: boolean;
1075
+ readonly errorCount?: number;
1076
+ readonly gate?: 'cleared' | 'uncleared';
1077
+ };
1063
1078
  /**
1064
1079
  * Flat error shape returned per form by `wizard.allErrors[key]`. Each
1065
1080
  * entry carries the formKey + path tuple so consumers can route to the
@@ -1314,12 +1329,20 @@ type WizardOptions = {
1314
1329
  * Status resolution priority per form:
1315
1330
  * 1. `store.defaultsResolved === true` → derive from `form.meta`
1316
1331
  * 2. else noop form → built-in always-valid status
1317
- * 3. else seed value for this key → frozen seed
1332
+ * 3. else seed value for this key → seed over the pending sentinel
1318
1333
  * 4. else → pending sentinel
1319
1334
  *
1320
- * The `locked` flag is never seeded: it is computed live from the
1321
- * wizard's gates and overlaid on every status read, so the seed shape
1322
- * is `FormStatus` minus `locked`.
1335
+ * `locked` is never seeded: it is computed live from the wizard's gates
1336
+ * and overlaid on every status read. `gate: 'cleared'` IS honored, but as
1337
+ * a one-shot seed of the gate's cleared latch at construction (an SSR
1338
+ * restore of a confirmed prerequisite), not as a status field echoed on
1339
+ * read — the live `gate` overlay owns the read. Only a step that compiles
1340
+ * to a `gate()` honors it. See `FormStatusSeed`.
1341
+ *
1342
+ * SSR note: the async factory resolves after hydration (client-only), so
1343
+ * a gate seeded through it clears post-hydration. For a gate that must
1344
+ * render open on the first server byte, use the plain or sync-factory
1345
+ * form (resolve server truth in the page's `setup` await).
1323
1346
  *
1324
1347
  * Unknown keys in the seed object dev-warn so a stale resume payload
1325
1348
  * surfaces at construction.
@@ -1559,7 +1582,19 @@ type WizardForms<S> = FormsRecordOf<S> & Readonly<Record<FormKey, AnyForm>>;
1559
1582
  * - `reset()` — zeros wizard lifecycle (`submissionAttempts`,
1560
1583
  * `visited`), resets every form, returns
1561
1584
  * `currentStep` to `steps[0].key`, and invokes
1562
- * `persist` with the cleared state.
1585
+ * `persist` with the cleared state. Re-applies the
1586
+ * `defaultStatuses` gate seed, so a reboot returns to
1587
+ * the seeded initial clearance, not fully sealed.
1588
+ * - `relock(key, commit)` — re-seal a cleared gate, contingent on
1589
+ * `commit`. Awaits `commit` (a server-side revoke) and
1590
+ * re-seals only if it resolves clean, so the gate reflects
1591
+ * server-confirmed truth the same way a clearing submit
1592
+ * does; a thrown `commit` leaves it as-is. Seal-only (never
1593
+ * opens a gate), so it cannot become the leading-signal
1594
+ * foot-gun `gate()` exists to prevent. `commit` is required
1595
+ * (pass `() => {}` for a deliberate client-only re-seal).
1596
+ * Resolves whether the gate ended up sealed; never rejects.
1597
+ * Resolves `false` (dev-warn) on a non-gate key.
1563
1598
  */
1564
1599
  type UseWizardReturnType<S extends ReadonlyArray<StepSlot> = ReadonlyArray<StepSlot>> = {
1565
1600
  readonly key: string;
@@ -1588,6 +1623,7 @@ type UseWizardReturnType<S extends ReadonlyArray<StepSlot> = ReadonlyArray<StepS
1588
1623
  readonly tryNext: () => Promise<boolean>;
1589
1624
  readonly handleSubmit: (onSubmit: WizardOnSubmit, onError?: WizardOnError) => (event?: Event) => Promise<void>;
1590
1625
  readonly reset: () => void;
1626
+ readonly relock: (key: FormKey, commit: () => void | Promise<void>) => Promise<boolean>;
1591
1627
  };
1592
1628
 
1593
1629
  /**
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const serializeScript = require('./attaform.ij2W7VTw.cjs');
3
+ const serializeScript = require('./attaform.Ib2seKUE.cjs');
4
4
  const devtoolsShared = require('./attaform.BBaMFa-k.cjs');
5
- const walkFieldMeta = require('./attaform.dX58Auwf.cjs');
5
+ const walkFieldMeta = require('./attaform.CX2NHAFs.cjs');
6
6
  const zod = require('zod');
7
7
 
8
8
  const fieldMeta = walkFieldMeta.fieldMetaStore;
@@ -1299,4 +1299,4 @@ exports.unwrapPipe = unwrapPipe;
1299
1299
  exports.useForm = useForm;
1300
1300
  exports.withMeta = withMeta;
1301
1301
  exports.zodV4Adapter = zodV4Adapter;
1302
- //# sourceMappingURL=attaform.BOIpRdeG.cjs.map
1302
+ //# sourceMappingURL=attaform.DXwJVUNS.cjs.map