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
@@ -6689,24 +6689,6 @@ function useWizard(options) {
6689
6689
  (slot) => isGateMarker(slot) || isLazyMarker(slot) || typeof slot === "function"
6690
6690
  );
6691
6691
  const clearedGates = vue.reactive(/* @__PURE__ */ new Set());
6692
- const seededSampled = /* @__PURE__ */ new Set();
6693
- function isGateVerdictSettled(key) {
6694
- const store = registry.forms.get(key);
6695
- if (store === void 0) return false;
6696
- return store.defaultsResolved.value === true && store.firstValidationDone.value === true && store.activeValidations.value === 0;
6697
- }
6698
- function isGateFormValid(key) {
6699
- const form = formsRecord.value[key] ?? formsAccumulator.get(key);
6700
- if (form === void 0) return false;
6701
- return asStatusSource(form).meta?.valid ?? false;
6702
- }
6703
- function sampleSeededGate(key) {
6704
- if (seededSampled.has(key)) return;
6705
- if (noopForms.has(key)) return;
6706
- if (!isGateVerdictSettled(key)) return;
6707
- seededSampled.add(key);
6708
- if (isGateFormValid(key)) clearedGates.add(key);
6709
- }
6710
6692
  const gateSubs = /* @__PURE__ */ new Map();
6711
6693
  function reconcileGates() {
6712
6694
  const gateKeys = /* @__PURE__ */ new Set();
@@ -6723,7 +6705,6 @@ function useWizard(options) {
6723
6705
  );
6724
6706
  }
6725
6707
  }
6726
- sampleSeededGate(key);
6727
6708
  }
6728
6709
  for (const [key, unsub] of gateSubs) {
6729
6710
  if (!gateKeys.has(key)) {
@@ -6781,8 +6762,7 @@ function useWizard(options) {
6781
6762
  for (const step of compiledSteps.value) {
6782
6763
  if (!step.isGate) continue;
6783
6764
  const store = registry.forms.get(step.key);
6784
- const settled = store !== void 0 && isGateVerdictSettled(step.key);
6785
- parts.push(`${step.key}:${store !== void 0 ? 1 : 0}:${settled ? 1 : 0}`);
6765
+ parts.push(`${step.key}:${store !== void 0 ? 1 : 0}`);
6786
6766
  }
6787
6767
  return parts.join("|");
6788
6768
  },
@@ -6815,20 +6795,30 @@ function useWizard(options) {
6815
6795
  });
6816
6796
  }
6817
6797
  }
6798
+ function applyGateSeed(map) {
6799
+ if (map === void 0 || !mightGate) return;
6800
+ const gates = gatePositions.value;
6801
+ for (const key of Object.keys(map)) {
6802
+ if (map[key]?.gate === "cleared" && gates.includes(key)) clearedGates.add(key);
6803
+ }
6804
+ }
6818
6805
  const seedRef = vue.ref(void 0);
6819
6806
  const seedInput = options.defaultStatuses;
6820
6807
  if (seedInput !== void 0) {
6821
6808
  const resolved = resolveTrichotomy(seedInput);
6822
6809
  if (resolved.kind === "sync") {
6823
6810
  seedRef.value = resolved.value;
6811
+ applyGateSeed(resolved.value);
6824
6812
  } else {
6825
6813
  const eager = resolved.factory();
6826
6814
  if (eager instanceof Promise) {
6827
6815
  void eager.then((value) => {
6828
6816
  seedRef.value = value;
6817
+ applyGateSeed(value);
6829
6818
  });
6830
6819
  } else {
6831
6820
  seedRef.value = eager;
6821
+ applyGateSeed(eager);
6832
6822
  }
6833
6823
  }
6834
6824
  }
@@ -6860,7 +6850,7 @@ function useWizard(options) {
6860
6850
  return locked || gate !== null ? { ...NOOP_VALID_STATUS, locked, gate } : NOOP_VALID_STATUS;
6861
6851
  }
6862
6852
  const seed = seedRef.value?.[form.key];
6863
- if (seed !== void 0) return { ...seed, locked, gate };
6853
+ if (seed !== void 0) return { ...PENDING_STATUS, ...seed, locked, gate };
6864
6854
  return locked || gate !== null ? { ...PENDING_STATUS, locked, gate } : PENDING_STATUS;
6865
6855
  });
6866
6856
  statusCache.set(form.key, computedStatus);
@@ -7352,14 +7342,16 @@ function useWizard(options) {
7352
7342
  submitError.value = null;
7353
7343
  if (mightGate) {
7354
7344
  clearedGates.clear();
7355
- seededSampled.clear();
7356
7345
  }
7357
7346
  lazyEpoch.value += 1;
7358
7347
  for (const step of compiledSteps.value) {
7359
7348
  const full = asSubmissionSource(step.form);
7360
7349
  if (typeof full.reset === "function") full.reset();
7361
7350
  }
7362
- if (mightGate) reconcileGates();
7351
+ if (mightGate) {
7352
+ reconcileGates();
7353
+ applyGateSeed(seedRef.value);
7354
+ }
7363
7355
  const firstStep = compiledSteps.value[0];
7364
7356
  if (firstStep !== void 0) {
7365
7357
  const landing = commitActiveKey(firstStep.key);
@@ -7370,6 +7362,29 @@ function useWizard(options) {
7370
7362
  }
7371
7363
  }
7372
7364
  }
7365
+ async function relock(key, commit) {
7366
+ if (!mightGate || !gatePositions.value.includes(key)) {
7367
+ if (devtoolsShared.__DEV__) {
7368
+ console.warn(
7369
+ `[attaform] useWizard.relock(${JSON.stringify(key)}): no gate at that key; nothing to re-lock.`
7370
+ );
7371
+ }
7372
+ return false;
7373
+ }
7374
+ try {
7375
+ await commit();
7376
+ } catch (err) {
7377
+ if (devtoolsShared.__DEV__) {
7378
+ console.warn(
7379
+ `[attaform] useWizard.relock(${JSON.stringify(key)}): commit threw, so the gate was not re-sealed.`,
7380
+ err
7381
+ );
7382
+ }
7383
+ return false;
7384
+ }
7385
+ clearedGates.delete(key);
7386
+ return true;
7387
+ }
7373
7388
  if (mightGate) {
7374
7389
  vue.watchEffect(() => {
7375
7390
  const key = activeKey.value;
@@ -7395,6 +7410,7 @@ function useWizard(options) {
7395
7410
  tryNext,
7396
7411
  handleSubmit,
7397
7412
  reset,
7413
+ relock,
7398
7414
  get currentStep() {
7399
7415
  return currentStep.value;
7400
7416
  },
@@ -7597,4 +7613,4 @@ exports.unset = unset;
7597
7613
  exports.useAbstractForm = useAbstractForm;
7598
7614
  exports.useRegister = useRegister;
7599
7615
  exports.useWizard = useWizard;
7600
- //# sourceMappingURL=attaform.ij2W7VTw.cjs.map
7616
+ //# sourceMappingURL=attaform.Ib2seKUE.cjs.map