attaform 0.27.5 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/dist/abstract.d.mts +5 -4
  2. package/dist/abstract.mjs +4 -3
  3. package/dist/chunks/fingerprint.mjs +0 -1
  4. package/dist/chunks/fingerprint2.mjs +1 -2
  5. package/dist/dev/abstract.mjs +4 -0
  6. package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
  7. package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
  8. package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
  9. package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
  10. package/dist/dev/directive.mjs +1 -0
  11. package/dist/dev/history.mjs +89 -0
  12. package/dist/dev/index.mjs +5 -0
  13. package/dist/dev/runtime/plugins/attaform.mjs +40 -0
  14. package/dist/{shared/attaform.f2zyNh5d.cjs → dev/shared/attaform-dev.6qxD-Yqo.mjs} +187 -43
  15. package/dist/{shared/attaform.CQN9R62B.cjs → dev/shared/attaform-dev.BJGA_UOS.mjs} +1 -4
  16. package/dist/{shared/attaform.Dc1mx48r.mjs → dev/shared/attaform-dev.BR8u0YOZ.mjs} +6 -7
  17. package/dist/dev/shared/attaform-dev.BXE2cr0L.mjs +220 -0
  18. package/dist/dev/shared/attaform-dev.By4PRjt0.mjs +248 -0
  19. package/dist/{shared/attaform.Cg_8gFQ7.mjs → dev/shared/attaform-dev.D2I8e_Mm.mjs} +132 -568
  20. package/dist/dev/shared/attaform-dev.Dr2YzS5B.mjs +197 -0
  21. package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.P7cseiEG.mjs} +178 -397
  22. package/dist/{shared/attaform.BypWgXRB.mjs → dev/shared/attaform-dev.WmuhD_CZ.mjs} +3955 -5029
  23. package/dist/{shared/attaform.Dkjh_F30.mjs → dev/shared/attaform-dev.oYrkP9dj.mjs} +160 -508
  24. package/dist/dev/zod-v3.mjs +17 -0
  25. package/dist/dev/zod-v4.mjs +16 -0
  26. package/dist/dev/zod.mjs +5 -0
  27. package/dist/directive.d.mts +20 -0
  28. package/dist/directive.mjs +1 -0
  29. package/dist/esbuild.mjs +0 -1
  30. package/dist/history.d.mts +59 -0
  31. package/dist/history.mjs +89 -0
  32. package/dist/index.d.mts +11 -5
  33. package/dist/index.mjs +5 -4
  34. package/dist/nuxt.d.mts +1 -1
  35. package/dist/nuxt.mjs +5 -2
  36. package/dist/rollup.mjs +0 -1
  37. package/dist/rspack.d.mts +6 -1
  38. package/dist/rspack.mjs +0 -1
  39. package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
  40. package/dist/runtime/plugins/attaform.mjs +1 -2
  41. package/dist/shared/{attaform.CIBMfxg9.d.ts → attaform.B4VkS43-.d.mts} +2 -2
  42. package/dist/shared/{attaform.Cg1rUfcF.cjs → attaform.B8k8JrmK.mjs} +3778 -5297
  43. package/dist/shared/attaform.BJGA_UOS.mjs +0 -1
  44. package/dist/shared/{attaform.CTiZ9Rrv.mjs → attaform.C09fpdLS.mjs} +172 -16
  45. package/dist/shared/{attaform.Bh8A6YAc.cjs → attaform.CJP3RkGa.mjs} +141 -590
  46. package/dist/shared/{attaform.CzL2CZ8U.d.ts → attaform.Cgu-hdSb.d.mts} +328 -78
  47. package/dist/shared/attaform.Cs2Rbdlo.mjs +0 -1
  48. package/dist/shared/{attaform.DcFDQVpa.d.ts → attaform.D5V4tZWq.d.mts} +79 -179
  49. package/dist/shared/{attaform.CF-EnyJn.cjs → attaform.D6DCnnQu.mjs} +11 -16
  50. package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
  51. package/dist/shared/attaform.Dq4vWxuG.mjs +197 -0
  52. package/dist/shared/attaform.JfSWdEcb.d.mts +44 -0
  53. package/dist/shared/attaform.KvlEedlF.mjs +0 -1
  54. package/dist/shared/{attaform.Crv0RNiz.cjs → attaform.NLmerepI.mjs} +175 -557
  55. package/dist/shared/attaform.h0i6LijT.mjs +242 -0
  56. package/dist/shared/{attaform.Biytrv0-.cjs → attaform.uLbun31C.mjs} +204 -544
  57. package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
  58. package/dist/shared/attaform.wfY8XFvm.mjs +197 -0
  59. package/dist/transforms.mjs +0 -1
  60. package/dist/vite.d.mts +17 -5
  61. package/dist/vite.mjs +24 -2
  62. package/dist/webpack.d.mts +6 -1
  63. package/dist/webpack.mjs +0 -1
  64. package/dist/zod-v3.d.mts +11 -6
  65. package/dist/zod-v3.mjs +17 -4
  66. package/dist/zod-v4.d.mts +12 -6
  67. package/dist/zod-v4.mjs +16 -4
  68. package/dist/zod.d.mts +4 -3
  69. package/dist/zod.mjs +5 -4
  70. package/package.json +23 -8
  71. package/skills/attaform/SKILL.md +2 -1
  72. package/dist/abstract.cjs +0 -48
  73. package/dist/abstract.cjs.map +0 -1
  74. package/dist/abstract.d.cts +0 -42
  75. package/dist/abstract.d.ts +0 -42
  76. package/dist/abstract.mjs.map +0 -1
  77. package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
  78. package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
  79. package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
  80. package/dist/chunks/devtools.cjs +0 -157
  81. package/dist/chunks/devtools.cjs.map +0 -1
  82. package/dist/chunks/devtools.mjs.map +0 -1
  83. package/dist/chunks/fingerprint.cjs.map +0 -1
  84. package/dist/chunks/fingerprint.mjs.map +0 -1
  85. package/dist/chunks/fingerprint2.cjs.map +0 -1
  86. package/dist/chunks/fingerprint2.mjs.map +0 -1
  87. package/dist/esbuild.cjs +0 -28
  88. package/dist/esbuild.cjs.map +0 -1
  89. package/dist/esbuild.d.cts +0 -56
  90. package/dist/esbuild.d.ts +0 -56
  91. package/dist/esbuild.mjs.map +0 -1
  92. package/dist/index.cjs +0 -51
  93. package/dist/index.cjs.map +0 -1
  94. package/dist/index.d.cts +0 -249
  95. package/dist/index.d.ts +0 -249
  96. package/dist/index.mjs.map +0 -1
  97. package/dist/nuxt.cjs +0 -84
  98. package/dist/nuxt.cjs.map +0 -1
  99. package/dist/nuxt.d.cts +0 -66
  100. package/dist/nuxt.d.ts +0 -66
  101. package/dist/nuxt.mjs.map +0 -1
  102. package/dist/rollup.cjs +0 -24
  103. package/dist/rollup.cjs.map +0 -1
  104. package/dist/rollup.d.cts +0 -35
  105. package/dist/rollup.d.ts +0 -35
  106. package/dist/rollup.mjs.map +0 -1
  107. package/dist/rspack.cjs +0 -10
  108. package/dist/rspack.cjs.map +0 -1
  109. package/dist/rspack.d.cts +0 -40
  110. package/dist/rspack.d.ts +0 -40
  111. package/dist/rspack.mjs.map +0 -1
  112. package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
  113. package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
  114. package/dist/runtime/plugins/attaform.cjs +0 -43
  115. package/dist/runtime/plugins/attaform.cjs.map +0 -1
  116. package/dist/runtime/plugins/attaform.d.cts +0 -5
  117. package/dist/runtime/plugins/attaform.d.ts +0 -5
  118. package/dist/runtime/plugins/attaform.mjs.map +0 -1
  119. package/dist/shared/attaform.B3abZaCV.d.cts +0 -2484
  120. package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
  121. package/dist/shared/attaform.Bh8A6YAc.cjs.map +0 -1
  122. package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
  123. package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
  124. package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
  125. package/dist/shared/attaform.BypWgXRB.mjs.map +0 -1
  126. package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
  127. package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
  128. package/dist/shared/attaform.CF-EnyJn.cjs.map +0 -1
  129. package/dist/shared/attaform.CJ1Z9Mz4.d.mts +0 -2484
  130. package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
  131. package/dist/shared/attaform.CTiZ9Rrv.mjs.map +0 -1
  132. package/dist/shared/attaform.Cg1rUfcF.cjs.map +0 -1
  133. package/dist/shared/attaform.Cg_8gFQ7.mjs.map +0 -1
  134. package/dist/shared/attaform.Crv0RNiz.cjs.map +0 -1
  135. package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
  136. package/dist/shared/attaform.CzL2CZ8U.d.cts +0 -4713
  137. package/dist/shared/attaform.CzL2CZ8U.d.mts +0 -4713
  138. package/dist/shared/attaform.DRUT703x.d.cts +0 -56
  139. package/dist/shared/attaform.DRUT703x.d.ts +0 -56
  140. package/dist/shared/attaform.DYwyM5Cp.d.cts +0 -232
  141. package/dist/shared/attaform.Dc1mx48r.mjs.map +0 -1
  142. package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
  143. package/dist/shared/attaform.Dkjh_F30.mjs.map +0 -1
  144. package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
  145. package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
  146. package/dist/shared/attaform.DrHOqB-d.d.mts +0 -232
  147. package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
  148. package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
  149. package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
  150. package/dist/shared/attaform.f2zyNh5d.cjs.map +0 -1
  151. package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
  152. package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
  153. package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
  154. package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
  155. package/dist/transforms.cjs +0 -12
  156. package/dist/transforms.cjs.map +0 -1
  157. package/dist/transforms.d.cts +0 -73
  158. package/dist/transforms.d.ts +0 -73
  159. package/dist/transforms.mjs.map +0 -1
  160. package/dist/vite.cjs +0 -363
  161. package/dist/vite.cjs.map +0 -1
  162. package/dist/vite.d.cts +0 -133
  163. package/dist/vite.d.ts +0 -133
  164. package/dist/vite.mjs.map +0 -1
  165. package/dist/webpack.cjs +0 -10
  166. package/dist/webpack.cjs.map +0 -1
  167. package/dist/webpack.d.cts +0 -37
  168. package/dist/webpack.d.ts +0 -37
  169. package/dist/webpack.mjs.map +0 -1
  170. package/dist/zod-v3.cjs +0 -53
  171. package/dist/zod-v3.cjs.map +0 -1
  172. package/dist/zod-v3.d.cts +0 -246
  173. package/dist/zod-v3.d.ts +0 -246
  174. package/dist/zod-v3.mjs.map +0 -1
  175. package/dist/zod-v4.cjs +0 -55
  176. package/dist/zod-v4.cjs.map +0 -1
  177. package/dist/zod-v4.d.cts +0 -172
  178. package/dist/zod-v4.d.ts +0 -172
  179. package/dist/zod-v4.mjs.map +0 -1
  180. package/dist/zod.cjs +0 -51
  181. package/dist/zod.cjs.map +0 -1
  182. package/dist/zod.d.cts +0 -7
  183. package/dist/zod.d.ts +0 -7
  184. package/dist/zod.mjs.map +0 -1
@@ -0,0 +1,242 @@
1
+ import { f as pathsEqual, i as isPathPrefix } from './attaform.wfY8XFvm.mjs';
2
+
3
+ const DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS = 0;
4
+ const DEFAULT_HISTORY_MAX_SNAPSHOTS = 128;
5
+ const RESERVED_KEY_PREFIX = "__atta:";
6
+ const ANONYMOUS_FORM_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon:`;
7
+ const ANONYMOUS_WIZARD_KEY_PREFIX = `${RESERVED_KEY_PREFIX}anon-wizard:`;
8
+ const DEFAULT_MAX_RECURSION_DEPTH = 64;
9
+ function normalizeNumericOption(config) {
10
+ const { value, source, allowInfinity, min, defaultValue } = config;
11
+ if (allowInfinity && value === Infinity) return Infinity;
12
+ if (typeof value !== "number" || Number.isNaN(value) || value === Infinity || value === -Infinity) {
13
+ return defaultValue;
14
+ }
15
+ return Math.max(min, Math.floor(value));
16
+ }
17
+ function pickDefined(bag) {
18
+ const out = {};
19
+ for (const key of Object.keys(bag)) {
20
+ if (bag[key] !== void 0) out[key] = bag[key];
21
+ }
22
+ return out;
23
+ }
24
+
25
+ function safeAssign(target, key, value) {
26
+ if (key === "__proto__") {
27
+ Object.defineProperty(target, key, {
28
+ value,
29
+ writable: true,
30
+ enumerable: true,
31
+ configurable: true
32
+ });
33
+ return;
34
+ }
35
+ target[key] = value;
36
+ }
37
+ function isShadowedKey(key) {
38
+ return key in Object.prototype;
39
+ }
40
+ function safeOwnRead(target, key) {
41
+ if (isShadowedKey(key)) {
42
+ const desc = Object.getOwnPropertyDescriptor(target, key);
43
+ if (desc === void 0) return void 0;
44
+ return "value" in desc ? desc.value : target[key];
45
+ }
46
+ return target[key];
47
+ }
48
+ function safeOwnHas(target, key) {
49
+ return Object.prototype.hasOwnProperty.call(target, key);
50
+ }
51
+
52
+ function isDescendable(value) {
53
+ if (value === null || typeof value !== "object") return false;
54
+ if (Array.isArray(value)) return true;
55
+ const proto = Object.getPrototypeOf(value);
56
+ return proto === null || proto === Object.prototype;
57
+ }
58
+ function appendSegment(prefix, segment) {
59
+ const next = new Array(prefix.length + 1);
60
+ for (let i = 0; i < prefix.length; i++) {
61
+ const s = prefix[i];
62
+ next[i] = s;
63
+ }
64
+ next[prefix.length] = segment;
65
+ return next;
66
+ }
67
+ function diffAndApply(oldValue, newValue, prefix, visit) {
68
+ if (Object.is(oldValue, newValue)) return;
69
+ const oldIsDescendable = isDescendable(oldValue);
70
+ const newIsDescendable = isDescendable(newValue);
71
+ if (oldValue === void 0 && newIsDescendable) {
72
+ walkNewDescendable(newValue, prefix, visit);
73
+ return;
74
+ }
75
+ if (oldIsDescendable && newValue === void 0) {
76
+ walkOldDescendable(oldValue, prefix, visit);
77
+ return;
78
+ }
79
+ if (oldIsDescendable && newIsDescendable) {
80
+ const oldIsArray = Array.isArray(oldValue);
81
+ const newIsArray = Array.isArray(newValue);
82
+ if (oldIsArray && newIsArray) {
83
+ diffArraysLockstep(oldValue, newValue, prefix, visit);
84
+ return;
85
+ }
86
+ if (!oldIsArray && !newIsArray) {
87
+ diffObjectsLockstep(
88
+ oldValue,
89
+ newValue,
90
+ prefix,
91
+ visit
92
+ );
93
+ return;
94
+ }
95
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
96
+ return;
97
+ }
98
+ if (oldIsDescendable && !newIsDescendable) {
99
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
100
+ return;
101
+ }
102
+ if (!oldIsDescendable && newIsDescendable) {
103
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
104
+ return;
105
+ }
106
+ if (oldValue === void 0) {
107
+ visit({ kind: "added", path: prefix, newValue });
108
+ return;
109
+ }
110
+ if (newValue === void 0) {
111
+ visit({ kind: "removed", path: prefix, oldValue });
112
+ return;
113
+ }
114
+ visit({ kind: "changed", path: prefix, oldValue, newValue });
115
+ }
116
+ function walkNewDescendable(newValue, prefix, visit) {
117
+ if (Array.isArray(newValue)) {
118
+ for (let i = 0; i < newValue.length; i++) {
119
+ diffAndApply(void 0, newValue[i], appendSegment(prefix, i), visit);
120
+ }
121
+ } else {
122
+ const rec = newValue;
123
+ for (const k of Object.keys(rec)) {
124
+ diffAndApply(void 0, rec[k], appendSegment(prefix, k), visit);
125
+ }
126
+ }
127
+ }
128
+ function walkOldDescendable(oldValue, prefix, visit) {
129
+ if (Array.isArray(oldValue)) {
130
+ for (let i = 0; i < oldValue.length; i++) {
131
+ diffAndApply(oldValue[i], void 0, appendSegment(prefix, i), visit);
132
+ }
133
+ } else {
134
+ const rec = oldValue;
135
+ for (const k of Object.keys(rec)) {
136
+ diffAndApply(rec[k], void 0, appendSegment(prefix, k), visit);
137
+ }
138
+ }
139
+ }
140
+ function diffArraysLockstep(oldArr, newArr, prefix, visit) {
141
+ const max = Math.max(oldArr.length, newArr.length);
142
+ for (let i = 0; i < max; i++) {
143
+ diffAndApply(oldArr[i], newArr[i], appendSegment(prefix, i), visit);
144
+ }
145
+ }
146
+ function diffObjectsLockstep(oldRec, newRec, prefix, visit) {
147
+ const seen = /* @__PURE__ */ new Set();
148
+ for (const k of Object.keys(oldRec)) {
149
+ seen.add(k);
150
+ diffAndApply(oldRec[k], newRec[k], appendSegment(prefix, k), visit);
151
+ }
152
+ for (const k of Object.keys(newRec)) {
153
+ if (seen.has(k)) continue;
154
+ diffAndApply(oldRec[k], newRec[k], appendSegment(prefix, k), visit);
155
+ }
156
+ }
157
+ function applyChangedKeys(target, source, arrayOpPath, currentPath, patches) {
158
+ if (!isDescendable(target) || !isDescendable(source)) return false;
159
+ const targetIsArray = Array.isArray(target);
160
+ const sourceIsArray = Array.isArray(source);
161
+ if (targetIsArray !== sourceIsArray) return false;
162
+ const depth = currentPath.length;
163
+ const changedFirstSegments = /* @__PURE__ */ new Set();
164
+ for (const patch of patches) {
165
+ if (patch.path.length === depth) return false;
166
+ changedFirstSegments.add(patch.path[depth]);
167
+ }
168
+ if (targetIsArray) {
169
+ const t = target;
170
+ const s = source;
171
+ if (arrayOpPath === null || pathsEqual(currentPath, arrayOpPath)) {
172
+ if (t.length > s.length) t.length = s.length;
173
+ for (const idx of changedFirstSegments) {
174
+ const i = typeof idx === "number" ? idx : Number(idx);
175
+ if (i >= s.length) continue;
176
+ t[i] = s[i];
177
+ }
178
+ } else {
179
+ for (const idx of changedFirstSegments) {
180
+ const i = typeof idx === "number" ? idx : Number(idx);
181
+ if (i >= s.length) continue;
182
+ const childPath = appendSegment(currentPath, i);
183
+ const curEl = t[i];
184
+ const nextEl = s[i];
185
+ if (isPathPrefix(childPath, arrayOpPath) && isDescendable(curEl) && isDescendable(nextEl) && applyChangedKeys(
186
+ curEl,
187
+ nextEl,
188
+ arrayOpPath,
189
+ childPath,
190
+ patches.filter((p) => isPathPrefix(childPath, p.path))
191
+ )) {
192
+ continue;
193
+ }
194
+ t[i] = nextEl;
195
+ }
196
+ }
197
+ } else {
198
+ const t = target;
199
+ const s = source;
200
+ const sourceKeys = new Set(Object.keys(s));
201
+ for (const k of Object.keys(t)) {
202
+ if (!sourceKeys.has(k)) delete t[k];
203
+ }
204
+ for (const k of changedFirstSegments) {
205
+ const key = String(k);
206
+ const nextVal = safeOwnRead(s, key);
207
+ if (arrayOpPath !== null) {
208
+ const curVal = safeOwnRead(t, key);
209
+ const childPath = appendSegment(currentPath, key);
210
+ if (isDescendable(curVal) && isDescendable(nextVal) && applyChangedKeys(
211
+ curVal,
212
+ nextVal,
213
+ arrayOpPath,
214
+ childPath,
215
+ patches.filter((p) => isPathPrefix(childPath, p.path))
216
+ )) {
217
+ continue;
218
+ }
219
+ }
220
+ safeAssign(t, key, nextVal);
221
+ }
222
+ }
223
+ return true;
224
+ }
225
+ function structuralSnapshot(value) {
226
+ if (!isDescendable(value)) return value;
227
+ if (Array.isArray(value)) {
228
+ const out2 = new Array(value.length);
229
+ for (let i = 0; i < value.length; i++) {
230
+ out2[i] = structuralSnapshot(value[i]);
231
+ }
232
+ return out2;
233
+ }
234
+ const src = value;
235
+ const out = {};
236
+ for (const k of Object.keys(src)) {
237
+ safeAssign(out, k, structuralSnapshot(safeOwnRead(src, k)));
238
+ }
239
+ return out;
240
+ }
241
+
242
+ export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b, safeOwnHas as c, diffAndApply as d, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as e, applyChangedKeys as f, DEFAULT_MAX_RECURSION_DEPTH as g, ANONYMOUS_WIZARD_KEY_PREFIX as h, isShadowedKey as i, normalizeNumericOption as n, pickDefined as p, structuralSnapshot as s };