attaform 0.31.1 → 0.31.2

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 (44) hide show
  1. package/dist/abstract.d.mts +5 -5
  2. package/dist/abstract.mjs +3 -2
  3. package/dist/dev/abstract.mjs +3 -2
  4. package/dist/dev/directive.mjs +1 -1
  5. package/dist/dev/history.mjs +118 -11
  6. package/dist/dev/index.mjs +4 -3
  7. package/dist/dev/shared/{attaform-dev.OceE0X3v.mjs → attaform-dev.BKWPjEB2.mjs} +4 -3
  8. package/dist/dev/shared/{attaform-dev.D7lKyM_7.mjs → attaform-dev.BnLLxX2l.mjs} +3 -3
  9. package/dist/dev/shared/{attaform-dev.Cbx0AiQF.mjs → attaform-dev.CKSqs_xQ.mjs} +1 -1
  10. package/dist/dev/shared/{attaform-dev.BpVGFSFa.mjs → attaform-dev.Cf_hZfbT.mjs} +3 -3
  11. package/dist/dev/shared/{attaform-dev.3uTCYwy8.mjs → attaform-dev.DLk51W7-.mjs} +111 -909
  12. package/dist/dev/shared/{attaform-dev.CwYTWyPX.mjs → attaform-dev.DoG8mZTq.mjs} +8 -1
  13. package/dist/dev/shared/attaform-dev.G-3XDl9F.mjs +1192 -0
  14. package/dist/dev/shared/{attaform-dev.PTGM9KE1.mjs → attaform-dev.oguHqv1W.mjs} +7 -6
  15. package/dist/dev/zod-v3.mjs +5 -4
  16. package/dist/dev/zod-v4.mjs +5 -4
  17. package/dist/dev/zod.mjs +4 -3
  18. package/dist/directive.d.mts +2 -2
  19. package/dist/directive.mjs +1 -1
  20. package/dist/history.d.mts +1 -1
  21. package/dist/history.mjs +118 -11
  22. package/dist/index.d.mts +6 -6
  23. package/dist/index.mjs +4 -3
  24. package/dist/shared/{attaform.j9xI_ObC.mjs → attaform.3kV6PqVJ.mjs} +7 -6
  25. package/dist/shared/{attaform.KEfNRDot.mjs → attaform.BJeiuJE2.mjs} +3 -3
  26. package/dist/shared/{attaform._1Zp3mDG.mjs → attaform.BNUhW4qC.mjs} +8 -1
  27. package/dist/shared/{attaform.B5b-HmhH.mjs → attaform.BlAmZ-WU.mjs} +3 -3
  28. package/dist/shared/{attaform.u6jfHoed.mjs → attaform.CMzc4bPI.mjs} +4 -3
  29. package/dist/shared/attaform.CgyyJVuq.mjs +1187 -0
  30. package/dist/shared/{attaform.CYlF4P6X.d.mts → attaform.CibLYe9-.d.mts} +185 -165
  31. package/dist/shared/{attaform.DAf4ehIe.mjs → attaform.DCUJCKyG.mjs} +111 -909
  32. package/dist/shared/{attaform.DZOynI6c.d.mts → attaform.DCyZT7u-.d.mts} +1 -1
  33. package/dist/shared/{attaform.B9PYKlhB.d.mts → attaform.DD0Y8krq.d.mts} +1 -1
  34. package/dist/shared/{attaform.BPMOl562.mjs → attaform.T0YjhjPU.mjs} +1 -1
  35. package/dist/shared/{attaform.i13OEHJF.d.mts → attaform.bI_4nKZp.d.mts} +61 -3
  36. package/dist/zod-v3.d.mts +4 -4
  37. package/dist/zod-v3.mjs +5 -4
  38. package/dist/zod-v4.d.mts +6 -6
  39. package/dist/zod-v4.mjs +5 -4
  40. package/dist/zod.d.mts +4 -4
  41. package/dist/zod.mjs +4 -3
  42. package/package.json +1 -1
  43. package/dist/dev/shared/attaform-dev.n6n00owJ.mjs +0 -279
  44. package/dist/shared/attaform.BPSqtU7a.mjs +0 -274
@@ -1,6 +1,7 @@
1
- import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform-dev.3uTCYwy8.mjs';
1
+ import { A as AttaformErrorCode, i as isPlainRecord, s as structuralSnapshot } from './attaform-dev.G-3XDl9F.mjs';
2
2
  import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform-dev.04aupFBW.mjs';
3
- import { a as safeOwnRead, s as safeAssign, e as safeOwnHas } from './attaform-dev.CwYTWyPX.mjs';
3
+ import { a as safeOwnRead, s as safeAssign, d as safeOwnHas } from './attaform-dev.DoG8mZTq.mjs';
4
+ import { s as slimKindOf } from './attaform-dev.DLk51W7-.mjs';
4
5
 
5
6
  const PATH_SEPARATOR = ".";
6
7
  function isOpaqueKind(kind) {
@@ -593,9 +594,9 @@ function peelEmbeddedDefault(schema, intro) {
593
594
  for (let i = 0; i < 32; i++) {
594
595
  if (current === void 0) return NO_EMBEDDED_DEFAULT;
595
596
  const k = intro.kindOf(current);
596
- if (k === "default") return intro.getDefaultValue(current);
597
+ if (k === "default") return structuralSnapshot(intro.getDefaultValue(current));
597
598
  if (k === "catch") {
598
- if (intro.hasCatchValue(current)) return intro.getCatchDefault(current);
599
+ if (intro.hasCatchValue(current)) return structuralSnapshot(intro.getCatchDefault(current));
599
600
  current = intro.unwrapInner(current);
600
601
  continue;
601
602
  }
@@ -674,7 +675,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
674
675
  case "nullable":
675
676
  return null;
676
677
  case "default": {
677
- if (useDefault) return intro.getDefaultValue(schema);
678
+ if (useDefault) return structuralSnapshot(intro.getDefaultValue(schema));
678
679
  const inner = intro.unwrapInner(schema);
679
680
  return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
680
681
  }
@@ -764,7 +765,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
764
765
  return mergeDeep(l, r);
765
766
  }
766
767
  case "catch": {
767
- if (useDefault) return intro.getCatchDefault(schema);
768
+ if (useDefault) return structuralSnapshot(intro.getCatchDefault(schema));
768
769
  const inner = intro.unwrapInner(schema);
769
770
  return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
770
771
  }
@@ -1,9 +1,10 @@
1
- export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.OceE0X3v.mjs';
2
- import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.PTGM9KE1.mjs';
1
+ export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.BKWPjEB2.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.oguHqv1W.mjs';
3
3
  export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.04aupFBW.mjs';
4
- export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.3uTCYwy8.mjs';
4
+ export { A as AttaformErrorCode } from './shared/attaform-dev.G-3XDl9F.mjs';
5
5
  export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.Bu6wgrA5.mjs';
6
- export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.Cbx0AiQF.mjs';
6
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.CKSqs_xQ.mjs';
7
+ export { e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.DLk51W7-.mjs';
7
8
 
8
9
  const fieldMeta = installingFieldMetaStore;
9
10
  function withMeta(schema, payload) {
@@ -1,9 +1,10 @@
1
- export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.BpVGFSFa.mjs';
2
- import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.PTGM9KE1.mjs';
1
+ export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.Cf_hZfbT.mjs';
2
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.oguHqv1W.mjs';
3
3
  export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.04aupFBW.mjs';
4
- export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.3uTCYwy8.mjs';
4
+ export { A as AttaformErrorCode } from './shared/attaform-dev.G-3XDl9F.mjs';
5
5
  export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.Bu6wgrA5.mjs';
6
- export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.Cbx0AiQF.mjs';
6
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.CKSqs_xQ.mjs';
7
+ export { e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.DLk51W7-.mjs';
7
8
 
8
9
  const fieldMeta = installingFieldMetaStore;
9
10
  function withMeta(schema, payload) {
package/dist/dev/zod.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform-dev.04aupFBW.mjs';
2
- export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.3uTCYwy8.mjs';
2
+ export { A as AttaformErrorCode } from './shared/attaform-dev.G-3XDl9F.mjs';
3
3
  export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform-dev.Bu6wgrA5.mjs';
4
- export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.Cbx0AiQF.mjs';
5
- export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.D7lKyM_7.mjs';
4
+ export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.CKSqs_xQ.mjs';
5
+ export { e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform-dev.DLk51W7-.mjs';
6
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.BnLLxX2l.mjs';
@@ -1,5 +1,5 @@
1
- export { i as installVRegister, v as vRegister } from './shared/attaform.DZOynI6c.mjs';
2
- import { an as RegisterModelDynamicCustomDirective } from './shared/attaform.i13OEHJF.mjs';
1
+ export { i as installVRegister, v as vRegister } from './shared/attaform.DCyZT7u-.mjs';
2
+ import { an as RegisterModelDynamicCustomDirective } from './shared/attaform.bI_4nKZp.mjs';
3
3
  import 'vue';
4
4
 
5
5
  /**
@@ -1 +1 @@
1
- export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.BPMOl562.mjs';
1
+ export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.T0YjhjPU.mjs';
@@ -1,4 +1,4 @@
1
- import { p as HistoryPlugin } from './shared/attaform.i13OEHJF.mjs';
1
+ import { p as HistoryPlugin } from './shared/attaform.bI_4nKZp.mjs';
2
2
  import 'vue';
3
3
 
4
4
  /** Options for `historyPlugin()`, passed as `useForm({ history })`. */
package/dist/history.mjs CHANGED
@@ -1,6 +1,72 @@
1
- import { shallowRef, computed } from 'vue';
2
- import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.BPSqtU7a.mjs';
1
+ import { shallowRef, computed, toRaw } from 'vue';
2
+ import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot, m as migrateMapSubtree, g as getAtPath } from './shared/attaform.CgyyJVuq.mjs';
3
+ import { e as canonicalizePath, s as segmentsForPathKey } from './shared/attaform.BhtAZysa.mjs';
3
4
 
5
+ const flagged = (record) => record.touched || record.interacted || record.blurredAfterInteraction;
6
+ function captureRecords(fields) {
7
+ const out = [];
8
+ for (const record of toRaw(fields).values()) {
9
+ if (flagged(record) && record.path.some((segment) => typeof segment === "number")) {
10
+ out.push(record);
11
+ }
12
+ }
13
+ return out;
14
+ }
15
+ function underIndexIn(path, indices) {
16
+ for (let i = 0; i < path.length; i++) {
17
+ const segment = path[i];
18
+ if (typeof segment === "number" && indices.get(canonicalizePath(path.slice(0, i)).key)?.has(segment) === true) {
19
+ return true;
20
+ }
21
+ }
22
+ return false;
23
+ }
24
+ function planOrders(current, target, holdsList) {
25
+ const live = new Map(current.tokens);
26
+ const liveBaselines = new Map(current.baselines);
27
+ const tokens = new Map(target.tokens);
28
+ const baselines = new Map(target.baselines);
29
+ const remaps = [];
30
+ const depths = /* @__PURE__ */ new Set();
31
+ for (const key of live.keys()) depths.add(segmentsForPathKey(key)?.length ?? 0);
32
+ for (const depth of [...depths].sort((a, b) => a - b)) {
33
+ for (const [key, ids] of [...live]) {
34
+ const segs = segmentsForPathKey(key);
35
+ if (segs?.length !== depth) continue;
36
+ let order = tokens.get(key);
37
+ const baseline = liveBaselines.get(key);
38
+ if (order === void 0) {
39
+ if (baseline === void 0 || !holdsList(segs)) continue;
40
+ order = baseline;
41
+ tokens.set(key, order);
42
+ baselines.set(key, baseline);
43
+ }
44
+ const remap = remapBetween(ids, order);
45
+ if (remap === null) continue;
46
+ remaps.push([segs, remap]);
47
+ migrateMapSubtree(live, segs, remap, (value) => value);
48
+ migrateMapSubtree(liveBaselines, segs, remap, (value) => value);
49
+ }
50
+ }
51
+ return { orders: { tokens, baselines }, remaps };
52
+ }
53
+ function remapBetween(from, to) {
54
+ const slots = new Map(to.map((id, i) => [id, i]));
55
+ const kept = new Set(from);
56
+ const moved = /* @__PURE__ */ new Map();
57
+ const vacated = /* @__PURE__ */ new Set();
58
+ const fresh = /* @__PURE__ */ new Set();
59
+ from.forEach((id, i) => {
60
+ const at = slots.get(id);
61
+ if (at === void 0) vacated.add(i);
62
+ else if (at !== i) moved.set(i, at);
63
+ });
64
+ to.forEach((id, i) => {
65
+ if (!kept.has(id)) fresh.add(i);
66
+ });
67
+ if (moved.size === 0 && vacated.size === 0 && fresh.size === 0) return null;
68
+ return { moved, vacated, fresh, oldLen: from.length, newLen: to.length };
69
+ }
4
70
  function captureErrorCells(map) {
5
71
  const out = [];
6
72
  for (const [k, cell] of map) {
@@ -17,37 +83,74 @@ function createHistoryRuntime(kernel, max) {
17
83
  blankPaths: [...kernel.blankPaths],
18
84
  errorCells: captureErrorCells(kernel.errorCells()),
19
85
  structure: kernel.captureStructure(),
86
+ records: captureRecords(kernel.fields),
20
87
  generation
21
88
  };
22
89
  }
23
90
  const positions = shallowRef([captureSnapshot()]);
24
91
  const cursor = shallowRef(0);
25
92
  let suppressNext = false;
93
+ let disposed = false;
94
+ let released = [];
95
+ kernel.noteReleased = (records) => {
96
+ for (const record of records) if (flagged(record)) released.push(record);
97
+ };
26
98
  const unsubscribeChange = kernel.onFormChange((_next, meta) => {
99
+ const left = released;
100
+ released = [];
27
101
  if (suppressNext) {
28
102
  suppressNext = false;
29
103
  return;
30
104
  }
31
105
  if (meta?.hydration === true) {
32
- clear();
106
+ queueMicrotask(() => {
107
+ if (!disposed) clear();
108
+ });
33
109
  return;
34
110
  }
35
111
  const next = positions.value.slice(0, cursor.value + 1);
112
+ const before = next[next.length - 1];
113
+ if (left.length > 0 && before !== void 0) {
114
+ next[next.length - 1] = { ...before, records: [...before.records, ...left] };
115
+ }
36
116
  next.push(captureSnapshot());
37
117
  while (next.length > capacity) next.shift();
38
118
  positions.value = next;
39
119
  cursor.value = next.length - 1;
40
120
  });
121
+ function retake() {
122
+ const structure = kernel.captureStructure();
123
+ const current = positions.value[cursor.value];
124
+ if (current !== void 0) {
125
+ const next = [...positions.value];
126
+ next[cursor.value] = {
127
+ ...current,
128
+ structure,
129
+ records: captureRecords(kernel.fields),
130
+ generation
131
+ };
132
+ positions.value = next;
133
+ }
134
+ return structure;
135
+ }
41
136
  const unsubscribeReset = kernel.onReset(() => {
42
137
  generation += 1;
43
- const current = positions.value[cursor.value];
44
- if (current === void 0) return;
45
- const next = [...positions.value];
46
- next[cursor.value] = { ...current, structure: kernel.captureStructure(), generation };
47
- positions.value = next;
138
+ retake();
48
139
  });
49
- function restorePosition(snap) {
50
- if (snap.generation === generation) kernel.restoreStructure(snap.structure);
140
+ function restorePosition(snap, live) {
141
+ if (snap.generation === generation) {
142
+ const { orders, remaps } = planOrders(
143
+ live.identity,
144
+ snap.structure.identity,
145
+ (segments) => Array.isArray(getAtPath(snap.form, segments))
146
+ );
147
+ const fresh = /* @__PURE__ */ new Map();
148
+ for (const [segments, remap] of remaps) {
149
+ if (remap.fresh.size > 0) fresh.set(canonicalizePath(segments).key, remap.fresh);
150
+ }
151
+ const returning = fresh.size === 0 ? [] : snap.records.filter((record) => underIndexIn(record.path, fresh));
152
+ kernel.restoreStructure({ ...snap.structure, identity: orders }, remaps, returning);
153
+ }
51
154
  suppressNext = true;
52
155
  kernel.blankPaths.clear();
53
156
  for (const key of snap.blankPaths) kernel.blankPaths.add(key);
@@ -57,8 +160,10 @@ function createHistoryRuntime(kernel, max) {
57
160
  function stepTo(nextCursor) {
58
161
  const snap = positions.value[nextCursor];
59
162
  if (snap === void 0) return false;
163
+ const live = retake();
60
164
  cursor.value = nextCursor;
61
- restorePosition(snap);
165
+ restorePosition(snap, live);
166
+ released = [];
62
167
  return true;
63
168
  }
64
169
  function undo() {
@@ -79,6 +184,8 @@ function createHistoryRuntime(kernel, max) {
79
184
  canRedo: computed(() => cursor.value < positions.value.length - 1),
80
185
  historySize: computed(() => positions.value.length),
81
186
  dispose() {
187
+ disposed = true;
188
+ kernel.noteReleased = void 0;
82
189
  unsubscribeChange();
83
190
  unsubscribeReset();
84
191
  positions.value = positions.value.slice(cursor.value, cursor.value + 1);
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
- export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.CYlF4P6X.mjs';
2
- import { G as GenericForm, F as FormKey, U as UseFormConfiguration, ap as AcceptableDefaults, ab as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, h as FieldMetaPayload } from './shared/attaform.i13OEHJF.mjs';
1
+ export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.CibLYe9-.mjs';
2
+ import { G as GenericForm, F as FormKey, U as UseFormConfiguration, ap as AcceptableDefaults, ab as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, h as FieldMetaPayload } from './shared/attaform.bI_4nKZp.mjs';
3
3
  import { AbstractSchema } from './abstract.mjs';
4
- export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, aa as ValidateOn, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.i13OEHJF.mjs';
5
- export { v as vRegister } from './shared/attaform.DZOynI6c.mjs';
6
- import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.B9PYKlhB.mjs';
7
- export { P as PathInput, a as PathOutput } from './shared/attaform.B9PYKlhB.mjs';
4
+ export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaParseErrorWithData, a0 as SchemaParseErrorWithoutData, a1 as SchemaParseResult, a2 as SchemaParseSuccess, a3 as Segment, a4 as SetValueCallback, a5 as SetValuePayload, a6 as SettledValidationStatus, a7 as SlimPrimitiveKind, a8 as SubmitHandler, a9 as Unset, aa as ValidateOn, ac as ValidationError, ad as ValidationResponse, ae as ValidationResponseWithoutValue, af as ValueOfUnion, ag as WriteMeta, ah as WriteShape, ai as canonicalizePath, aj as isPathPrefix, ak as isUnset, al as parseDottedPath, am as unset } from './shared/attaform.bI_4nKZp.mjs';
5
+ export { v as vRegister } from './shared/attaform.DCyZT7u-.mjs';
6
+ import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.DD0Y8krq.mjs';
7
+ export { P as PathInput, a as PathOutput } from './shared/attaform.DD0Y8krq.mjs';
8
8
  import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.B-Tb62qV.mjs';
9
9
  import { UnwrapZodRoot } from './zod-v3.mjs';
10
10
  import { z } from 'zod';
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.BhtAZysa.mjs';
2
- export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.DAf4ehIe.mjs';
2
+ export { A as AttaformErrorCode } from './shared/attaform.CgyyJVuq.mjs';
3
3
  export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.CdA9bfRv.mjs';
4
- export { a as assignKey, v as vRegister } from './shared/attaform.BPMOl562.mjs';
5
- export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.KEfNRDot.mjs';
4
+ export { a as assignKey, v as vRegister } from './shared/attaform.T0YjhjPU.mjs';
5
+ export { e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.DCUJCKyG.mjs';
6
+ export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.BJeiuJE2.mjs';
6
7
  export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
@@ -1,6 +1,7 @@
1
- import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform.DAf4ehIe.mjs';
1
+ import { A as AttaformErrorCode, i as isPlainRecord, s as structuralSnapshot } from './attaform.CgyyJVuq.mjs';
2
2
  import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform.BhtAZysa.mjs';
3
- import { a as safeOwnRead, s as safeAssign, e as safeOwnHas } from './attaform._1Zp3mDG.mjs';
3
+ import { a as safeOwnRead, s as safeAssign, d as safeOwnHas } from './attaform.BNUhW4qC.mjs';
4
+ import { s as slimKindOf } from './attaform.DCUJCKyG.mjs';
4
5
 
5
6
  const PATH_SEPARATOR = ".";
6
7
  function isOpaqueKind(kind) {
@@ -593,9 +594,9 @@ function peelEmbeddedDefault(schema, intro) {
593
594
  for (let i = 0; i < 32; i++) {
594
595
  if (current === void 0) return NO_EMBEDDED_DEFAULT;
595
596
  const k = intro.kindOf(current);
596
- if (k === "default") return intro.getDefaultValue(current);
597
+ if (k === "default") return structuralSnapshot(intro.getDefaultValue(current));
597
598
  if (k === "catch") {
598
- if (intro.hasCatchValue(current)) return intro.getCatchDefault(current);
599
+ if (intro.hasCatchValue(current)) return structuralSnapshot(intro.getCatchDefault(current));
599
600
  current = intro.unwrapInner(current);
600
601
  continue;
601
602
  }
@@ -674,7 +675,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
674
675
  case "nullable":
675
676
  return null;
676
677
  case "default": {
677
- if (useDefault) return intro.getDefaultValue(schema);
678
+ if (useDefault) return structuralSnapshot(intro.getDefaultValue(schema));
678
679
  const inner = intro.unwrapInner(schema);
679
680
  return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
680
681
  }
@@ -764,7 +765,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
764
765
  return mergeDeep(l, r);
765
766
  }
766
767
  case "catch": {
767
- if (useDefault) return intro.getCatchDefault(schema);
768
+ if (useDefault) return structuralSnapshot(intro.getCatchDefault(schema));
768
769
  const inner = intro.unwrapInner(schema);
769
770
  return inner === void 0 ? void 0 : deriveDefaultWalk(inner, useDefault, intro, maxDepth, lazyDepth);
770
771
  }
@@ -1,7 +1,7 @@
1
1
  import { a as InvalidUseFormConfigError } from './attaform.BhtAZysa.mjs';
2
- import { u as useForm$2 } from './attaform.u6jfHoed.mjs';
3
- import { u as useForm$1 } from './attaform.B5b-HmhH.mjs';
4
- import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.j9xI_ObC.mjs';
2
+ import { u as useForm$2 } from './attaform.CMzc4bPI.mjs';
3
+ import { u as useForm$1 } from './attaform.BlAmZ-WU.mjs';
4
+ import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform.3kV6PqVJ.mjs';
5
5
 
6
6
  function isZodV4SchemaShape(value) {
7
7
  if (typeof value !== "object" || value === null) return false;
@@ -40,6 +40,13 @@ function consumerHas(obj, key) {
40
40
  return false;
41
41
  }
42
42
  }
43
+ function consumerExtensible(obj) {
44
+ try {
45
+ return Object.isExtensible(obj);
46
+ } catch {
47
+ return true;
48
+ }
49
+ }
43
50
 
44
51
  function safeAssign(target, key, value) {
45
52
  if (key === "__proto__") {
@@ -93,4 +100,4 @@ function copyConsumerArray(src) {
93
100
  }
94
101
  }
95
102
 
96
- export { safeOwnRead as a, readConsumerProp as b, consumerKeys as c, callConsumerFn as d, safeOwnHas as e, consumerHas as f, spreadConsumerRecord as g, copyConsumerArray as h, isShadowedKey as i, consumerSymbolKeys as j, readConsumerIndex as r, safeAssign as s };
103
+ export { safeOwnRead as a, readConsumerProp as b, consumerKeys as c, safeOwnHas as d, consumerHas as e, spreadConsumerRecord as f, copyConsumerArray as g, callConsumerFn as h, isShadowedKey as i, consumerExtensible as j, consumerSymbolKeys as k, readConsumerIndex as r, safeAssign as s };
@@ -1,7 +1,7 @@
1
- import { j as humanize, c as useAbstractForm } from './attaform.DAf4ehIe.mjs';
1
+ import { h as humanize, c as useAbstractForm } from './attaform.DCUJCKyG.mjs';
2
2
  import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.BhtAZysa.mjs';
3
- import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.j9xI_ObC.mjs';
4
- import { d as callConsumerFn } from './attaform._1Zp3mDG.mjs';
3
+ import { s as slimPrimitivesWalk, d as deriveDefaultWalk, m as mergeDeep, f as fixStructuralDefaults, w as walkPathSegments, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, e as getFieldMetaListForSchema, g as getFieldMetaForSchema } from './attaform.3kV6PqVJ.mjs';
4
+ import { h as callConsumerFn } from './attaform.BNUhW4qC.mjs';
5
5
 
6
6
  function readDef(schema) {
7
7
  if (schema === null || typeof schema !== "object") return void 0;
@@ -1,6 +1,7 @@
1
- import { w as walkPathSegments, s as slimPrimitivesWalk, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, g as getFieldMetaForSchema, f as fixStructuralDefaults, m as mergeDeep, d as deriveDefaultWalk, e as getFieldMetaListForSchema } from './attaform.j9xI_ObC.mjs';
2
- import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform.DAf4ehIe.mjs';
3
- import { d as callConsumerFn } from './attaform._1Zp3mDG.mjs';
1
+ import { w as walkPathSegments, s as slimPrimitivesWalk, c as createAbstractSchema, a as createSharedSchemaStore, b as buildFieldMetaPathMap, g as getFieldMetaForSchema, f as fixStructuralDefaults, m as mergeDeep, d as deriveDefaultWalk, e as getFieldMetaListForSchema } from './attaform.3kV6PqVJ.mjs';
2
+ import { g as getAtPath } from './attaform.CgyyJVuq.mjs';
3
+ import { h as callConsumerFn } from './attaform.BNUhW4qC.mjs';
4
+ import { h as humanize, c as useAbstractForm } from './attaform.DCUJCKyG.mjs';
4
5
  import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform.BhtAZysa.mjs';
5
6
 
6
7
  function isZodSchemaType(schema, expectedType) {