attaform 0.28.0 → 0.29.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/dist/abstract.d.mts +5 -5
- package/dist/abstract.mjs +4 -4
- package/dist/chunks/fingerprint.mjs +1 -1
- package/dist/chunks/fingerprint2.mjs +2 -2
- package/dist/dev/abstract.mjs +4 -4
- package/dist/dev/chunks/devtools.mjs +1 -1
- package/dist/dev/chunks/fingerprint.mjs +1 -1
- package/dist/dev/chunks/fingerprint2.mjs +2 -2
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +1 -1
- package/dist/dev/index.mjs +5 -5
- package/dist/dev/runtime/plugins/attaform.mjs +1 -1
- package/dist/dev/shared/{attaform-dev.Dr2YzS5B.mjs → attaform-dev.A-TpJW0B.mjs} +11 -1
- package/dist/dev/shared/{attaform-dev.oYrkP9dj.mjs → attaform-dev.BO-71R54.mjs} +51 -158
- package/dist/dev/shared/{attaform-dev.6qxD-Yqo.mjs → attaform-dev.BgM6FdtA.mjs} +143 -36
- package/dist/{shared/attaform.h0i6LijT.mjs → dev/shared/attaform-dev.ButTkwHd.mjs} +149 -16
- package/dist/{shared/attaform.BJGA_UOS.mjs → dev/shared/attaform-dev.BxfsuwBR.mjs} +8 -0
- package/dist/dev/shared/{attaform-dev.P7cseiEG.mjs → attaform-dev.D8aoKb89.mjs} +13 -4
- package/dist/dev/shared/{attaform-dev.BXE2cr0L.mjs → attaform-dev.DD5m2W51.mjs} +1 -1
- package/dist/dev/shared/{attaform-dev.WmuhD_CZ.mjs → attaform-dev.DHuydLAC.mjs} +344 -96
- package/dist/dev/shared/{attaform-dev.BR8u0YOZ.mjs → attaform-dev.DrzObAZo.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.D2I8e_Mm.mjs → attaform-dev.q6UutkCx.mjs} +170 -132
- package/dist/dev/zod-v3.mjs +6 -6
- package/dist/dev/zod-v4.mjs +6 -6
- package/dist/dev/zod.mjs +5 -5
- package/dist/directive.d.mts +2 -2
- package/dist/directive.mjs +1 -1
- package/dist/history.d.mts +1 -1
- package/dist/history.mjs +1 -1
- package/dist/index.d.mts +9 -7
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.mts +10 -10
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.C09fpdLS.mjs → attaform.B0dKL8ST.mjs} +143 -36
- package/dist/shared/{attaform.Cs2Rbdlo.mjs → attaform.BK0cgu2K.mjs} +123 -139
- package/dist/shared/{attaform.D6DCnnQu.mjs → attaform.BndjUUYX.mjs} +4 -4
- package/dist/{dev/shared/attaform-dev.BJGA_UOS.mjs → shared/attaform.BxfsuwBR.mjs} +8 -0
- package/dist/shared/{attaform.NLmerepI.mjs → attaform.C2MVyuxC.mjs} +42 -151
- package/dist/shared/{attaform.B4VkS43-.d.mts → attaform.CIWLMY-R.d.mts} +1 -1
- package/dist/shared/{attaform.B8k8JrmK.mjs → attaform.CZMAYwSK.mjs} +338 -95
- package/dist/shared/{attaform.wfY8XFvm.mjs → attaform.CZYt_5N_.mjs} +11 -1
- package/dist/shared/{attaform.Cgu-hdSb.d.mts → attaform.CsoeRi3P.d.mts} +224 -32
- package/dist/{dev/shared/attaform-dev.By4PRjt0.mjs → shared/attaform.Cvao8bW5.mjs} +132 -22
- package/dist/shared/{attaform.Dq4vWxuG.mjs → attaform.D0x-qSXm.mjs} +1 -1
- package/dist/shared/{attaform.CJP3RkGa.mjs → attaform.D1fnTifF.mjs} +168 -132
- package/dist/shared/{attaform.D5V4tZWq.d.mts → attaform.DDtqHYv1.d.mts} +88 -7
- package/dist/shared/{attaform.uLbun31C.mjs → attaform.DffRL5pP.mjs} +12 -4
- package/dist/shared/{attaform.JfSWdEcb.d.mts → attaform.axHXVQO7.d.mts} +1 -1
- package/dist/transforms.d.mts +0 -22
- package/dist/transforms.mjs +1 -1
- package/dist/vite.d.mts +13 -4
- package/dist/vite.mjs +3 -2
- package/dist/zod-v3.d.mts +6 -4
- package/dist/zod-v3.mjs +6 -6
- package/dist/zod-v4.d.mts +14 -27
- package/dist/zod-v4.mjs +6 -6
- package/dist/zod.d.mts +4 -4
- package/dist/zod.mjs +5 -5
- package/package.json +17 -14
- package/skills/attaform/SKILL.md +5 -2
- package/skills/attaform/references/custom-components.md +7 -2
- package/skills/attaform/references/errors.md +8 -3
- package/skills/attaform/references/saving.md +77 -0
- package/skills/attaform/references/wizards.md +10 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as pathsEqual, i as isPathPrefix } from './attaform
|
|
1
|
+
import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform.CZYt_5N_.mjs';
|
|
2
2
|
|
|
3
3
|
const DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS = 0;
|
|
4
4
|
const DEFAULT_HISTORY_MAX_SNAPSHOTS = 128;
|
|
@@ -10,12 +10,6 @@ function normalizeNumericOption(config) {
|
|
|
10
10
|
const { value, source, allowInfinity, min, defaultValue } = config;
|
|
11
11
|
if (allowInfinity && value === Infinity) return Infinity;
|
|
12
12
|
if (typeof value !== "number" || Number.isNaN(value) || value === Infinity || value === -Infinity) {
|
|
13
|
-
{
|
|
14
|
-
const acceptedDescription = allowInfinity ? "a non-negative integer or Infinity" : "a non-negative finite integer";
|
|
15
|
-
console.warn(
|
|
16
|
-
`[attaform] ${source} must be ${acceptedDescription}; got ${String(value)}. Falling back to ${String(defaultValue)}.`
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
13
|
return defaultValue;
|
|
20
14
|
}
|
|
21
15
|
return Math.max(min, Math.floor(value));
|
|
@@ -28,6 +22,49 @@ function pickDefined(bag) {
|
|
|
28
22
|
return out;
|
|
29
23
|
}
|
|
30
24
|
|
|
25
|
+
function callConsumerSchemaFn(fn, fallback, site) {
|
|
26
|
+
try {
|
|
27
|
+
return fn();
|
|
28
|
+
} catch (err) {
|
|
29
|
+
return fallback;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function readConsumerProp(obj, key) {
|
|
33
|
+
try {
|
|
34
|
+
return obj[key];
|
|
35
|
+
} catch {
|
|
36
|
+
return void 0;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function consumerKeys(obj) {
|
|
40
|
+
try {
|
|
41
|
+
return Object.keys(obj);
|
|
42
|
+
} catch {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function readConsumerIndex(arr, i) {
|
|
47
|
+
try {
|
|
48
|
+
return arr[i];
|
|
49
|
+
} catch {
|
|
50
|
+
return void 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function consumerSymbolKeys(obj) {
|
|
54
|
+
try {
|
|
55
|
+
return Object.getOwnPropertySymbols(obj);
|
|
56
|
+
} catch {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function consumerHas(obj, key) {
|
|
61
|
+
try {
|
|
62
|
+
return key in obj;
|
|
63
|
+
} catch {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
31
68
|
function safeAssign(target, key, value) {
|
|
32
69
|
if (key === "__proto__") {
|
|
33
70
|
Object.defineProperty(target, key, {
|
|
@@ -47,17 +84,42 @@ function safeOwnRead(target, key) {
|
|
|
47
84
|
if (isShadowedKey(key)) {
|
|
48
85
|
const desc = Object.getOwnPropertyDescriptor(target, key);
|
|
49
86
|
if (desc === void 0) return void 0;
|
|
50
|
-
return "value" in desc ? desc.value : target
|
|
87
|
+
return "value" in desc ? desc.value : readConsumerProp(target, key);
|
|
51
88
|
}
|
|
52
|
-
return target
|
|
89
|
+
return readConsumerProp(target, key);
|
|
53
90
|
}
|
|
54
91
|
function safeOwnHas(target, key) {
|
|
55
|
-
|
|
92
|
+
try {
|
|
93
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
94
|
+
} catch {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function spreadConsumerRecord(src) {
|
|
99
|
+
try {
|
|
100
|
+
return { ...src };
|
|
101
|
+
} catch {
|
|
102
|
+
const out = {};
|
|
103
|
+
for (const key of Object.keys(src)) {
|
|
104
|
+
safeAssign(out, key, readConsumerProp(src, key));
|
|
105
|
+
}
|
|
106
|
+
return out;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function copyConsumerArray(src) {
|
|
110
|
+
try {
|
|
111
|
+
return src.slice();
|
|
112
|
+
} catch {
|
|
113
|
+
const out = new Array(src.length);
|
|
114
|
+
for (let i = 0; i < src.length; i++) out[i] = readConsumerIndex(src, i);
|
|
115
|
+
return out;
|
|
116
|
+
}
|
|
56
117
|
}
|
|
57
118
|
|
|
58
119
|
function isDescendable(value) {
|
|
59
120
|
if (value === null || typeof value !== "object") return false;
|
|
60
121
|
if (Array.isArray(value)) return true;
|
|
122
|
+
if (value instanceof Map) return mapSegmentKeys(value) !== null;
|
|
61
123
|
const proto = Object.getPrototypeOf(value);
|
|
62
124
|
return proto === null || proto === Object.prototype;
|
|
63
125
|
}
|
|
@@ -83,6 +145,16 @@ function diffAndApply(oldValue, newValue, prefix, visit) {
|
|
|
83
145
|
return;
|
|
84
146
|
}
|
|
85
147
|
if (oldIsDescendable && newIsDescendable) {
|
|
148
|
+
const oldIsMap = oldValue instanceof Map;
|
|
149
|
+
const newIsMap = newValue instanceof Map;
|
|
150
|
+
if (oldIsMap && newIsMap) {
|
|
151
|
+
diffMapsLockstep(oldValue, newValue, prefix, visit);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (oldIsMap !== newIsMap) {
|
|
155
|
+
visit({ kind: "changed", path: prefix, oldValue, newValue });
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
86
158
|
const oldIsArray = Array.isArray(oldValue);
|
|
87
159
|
const newIsArray = Array.isArray(newValue);
|
|
88
160
|
if (oldIsArray && newIsArray) {
|
|
@@ -122,46 +194,79 @@ function diffAndApply(oldValue, newValue, prefix, visit) {
|
|
|
122
194
|
function walkNewDescendable(newValue, prefix, visit) {
|
|
123
195
|
if (Array.isArray(newValue)) {
|
|
124
196
|
for (let i = 0; i < newValue.length; i++) {
|
|
125
|
-
diffAndApply(void 0, newValue
|
|
197
|
+
diffAndApply(void 0, readConsumerIndex(newValue, i), appendSegment(prefix, i), visit);
|
|
198
|
+
}
|
|
199
|
+
} else if (newValue instanceof Map) {
|
|
200
|
+
for (const [key, entry] of newValue) {
|
|
201
|
+
diffAndApply(void 0, entry, appendSegment(prefix, key), visit);
|
|
126
202
|
}
|
|
127
203
|
} else {
|
|
128
204
|
const rec = newValue;
|
|
129
|
-
for (const k of
|
|
130
|
-
diffAndApply(void 0, rec
|
|
205
|
+
for (const k of consumerKeys(rec)) {
|
|
206
|
+
diffAndApply(void 0, readConsumerProp(rec, k), appendSegment(prefix, k), visit);
|
|
131
207
|
}
|
|
132
208
|
}
|
|
133
209
|
}
|
|
134
210
|
function walkOldDescendable(oldValue, prefix, visit) {
|
|
135
211
|
if (Array.isArray(oldValue)) {
|
|
136
212
|
for (let i = 0; i < oldValue.length; i++) {
|
|
137
|
-
diffAndApply(oldValue
|
|
213
|
+
diffAndApply(readConsumerIndex(oldValue, i), void 0, appendSegment(prefix, i), visit);
|
|
214
|
+
}
|
|
215
|
+
} else if (oldValue instanceof Map) {
|
|
216
|
+
for (const [key, entry] of oldValue) {
|
|
217
|
+
diffAndApply(entry, void 0, appendSegment(prefix, key), visit);
|
|
138
218
|
}
|
|
139
219
|
} else {
|
|
140
220
|
const rec = oldValue;
|
|
141
|
-
for (const k of
|
|
142
|
-
diffAndApply(rec
|
|
221
|
+
for (const k of consumerKeys(rec)) {
|
|
222
|
+
diffAndApply(readConsumerProp(rec, k), void 0, appendSegment(prefix, k), visit);
|
|
143
223
|
}
|
|
144
224
|
}
|
|
145
225
|
}
|
|
226
|
+
function diffMapsLockstep(oldMap, newMap, prefix, visit) {
|
|
227
|
+
for (const [key, entry] of newMap) {
|
|
228
|
+
diffAndApply(oldMap.get(key), entry, appendSegment(prefix, key), visit);
|
|
229
|
+
}
|
|
230
|
+
for (const [key, entry] of oldMap) {
|
|
231
|
+
if (newMap.has(key)) continue;
|
|
232
|
+
diffAndApply(entry, void 0, appendSegment(prefix, key), visit);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
146
235
|
function diffArraysLockstep(oldArr, newArr, prefix, visit) {
|
|
147
236
|
const max = Math.max(oldArr.length, newArr.length);
|
|
148
237
|
for (let i = 0; i < max; i++) {
|
|
149
|
-
diffAndApply(
|
|
238
|
+
diffAndApply(
|
|
239
|
+
readConsumerIndex(oldArr, i),
|
|
240
|
+
readConsumerIndex(newArr, i),
|
|
241
|
+
appendSegment(prefix, i),
|
|
242
|
+
visit
|
|
243
|
+
);
|
|
150
244
|
}
|
|
151
245
|
}
|
|
152
246
|
function diffObjectsLockstep(oldRec, newRec, prefix, visit) {
|
|
153
247
|
const seen = /* @__PURE__ */ new Set();
|
|
154
|
-
for (const k of
|
|
248
|
+
for (const k of consumerKeys(oldRec)) {
|
|
155
249
|
seen.add(k);
|
|
156
|
-
diffAndApply(
|
|
250
|
+
diffAndApply(
|
|
251
|
+
readConsumerProp(oldRec, k),
|
|
252
|
+
readConsumerProp(newRec, k),
|
|
253
|
+
appendSegment(prefix, k),
|
|
254
|
+
visit
|
|
255
|
+
);
|
|
157
256
|
}
|
|
158
|
-
for (const k of
|
|
257
|
+
for (const k of consumerKeys(newRec)) {
|
|
159
258
|
if (seen.has(k)) continue;
|
|
160
|
-
diffAndApply(
|
|
259
|
+
diffAndApply(
|
|
260
|
+
readConsumerProp(oldRec, k),
|
|
261
|
+
readConsumerProp(newRec, k),
|
|
262
|
+
appendSegment(prefix, k),
|
|
263
|
+
visit
|
|
264
|
+
);
|
|
161
265
|
}
|
|
162
266
|
}
|
|
163
267
|
function applyChangedKeys(target, source, arrayOpPath, currentPath, patches) {
|
|
164
268
|
if (!isDescendable(target) || !isDescendable(source)) return false;
|
|
269
|
+
if (target instanceof Map || source instanceof Map) return false;
|
|
165
270
|
const targetIsArray = Array.isArray(target);
|
|
166
271
|
const sourceIsArray = Array.isArray(source);
|
|
167
272
|
if (targetIsArray !== sourceIsArray) return false;
|
|
@@ -230,6 +335,11 @@ function applyChangedKeys(target, source, arrayOpPath, currentPath, patches) {
|
|
|
230
335
|
}
|
|
231
336
|
function structuralSnapshot(value) {
|
|
232
337
|
if (!isDescendable(value)) return value;
|
|
338
|
+
if (value instanceof Map) {
|
|
339
|
+
const out2 = /* @__PURE__ */ new Map();
|
|
340
|
+
for (const [k, v] of value) out2.set(k, structuralSnapshot(v));
|
|
341
|
+
return out2;
|
|
342
|
+
}
|
|
233
343
|
if (Array.isArray(value)) {
|
|
234
344
|
const out2 = new Array(value.length);
|
|
235
345
|
for (let i = 0; i < value.length; i++) {
|
|
@@ -245,4 +355,4 @@ function structuralSnapshot(value) {
|
|
|
245
355
|
return out;
|
|
246
356
|
}
|
|
247
357
|
|
|
248
|
-
export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b,
|
|
358
|
+
export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, safeOwnRead as a, safeAssign as b, callConsumerSchemaFn as c, consumerHas as d, safeOwnHas as e, spreadConsumerRecord as f, copyConsumerArray as g, consumerKeys as h, isShadowedKey as i, readConsumerProp as j, diffAndApply as k, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as l, consumerSymbolKeys as m, normalizeNumericOption as n, applyChangedKeys as o, pickDefined as p, DEFAULT_MAX_RECURSION_DEPTH as q, readConsumerIndex as r, structuralSnapshot as s, ANONYMOUS_WIZARD_KEY_PREFIX as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as RegistryNotInstalledError, O as OutsideSetupError, g as pathKeyToDotted } from './attaform.
|
|
1
|
+
import { c as RegistryNotInstalledError, O as OutsideSetupError, g as pathKeyToDotted } from './attaform.CZYt_5N_.mjs';
|
|
2
2
|
import { shallowReactive, getCurrentInstance, inject } from 'vue';
|
|
3
3
|
|
|
4
4
|
function detectSSR(options = {}) {
|