attaform 0.31.0 → 0.31.1
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/dev/abstract.mjs +4 -4
- package/dist/dev/chunks/devtools.mjs +1 -1
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +15 -2
- package/dist/dev/index.mjs +5 -5
- package/dist/dev/runtime/plugins/attaform.mjs +1 -1
- package/dist/dev/shared/{attaform-dev.zlvDr0WB.mjs → attaform-dev.04aupFBW.mjs} +3 -2
- package/dist/dev/shared/{attaform-dev.y9x9Vp9F.mjs → attaform-dev.3uTCYwy8.mjs} +572 -135
- package/dist/dev/shared/{attaform-dev.DJ3nsWw6.mjs → attaform-dev.BpVGFSFa.mjs} +18 -9
- package/dist/dev/shared/{attaform-dev.B1q-x9R9.mjs → attaform-dev.Bu6wgrA5.mjs} +1 -1
- package/dist/dev/shared/{attaform-dev.k5X47GMD.mjs → attaform-dev.Cbx0AiQF.mjs} +3 -2
- package/dist/dev/shared/attaform-dev.CwYTWyPX.mjs +120 -0
- package/dist/dev/shared/{attaform-dev.DlaT4xGd.mjs → attaform-dev.D7lKyM_7.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.CtyqGia7.mjs → attaform-dev.OceE0X3v.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.Caibt7sb.mjs → attaform-dev.PTGM9KE1.mjs} +6 -6
- package/dist/{shared/attaform.8mfKZCwH.mjs → dev/shared/attaform-dev.n6n00owJ.mjs} +49 -128
- 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 +15 -2
- package/dist/index.d.mts +16 -55
- package/dist/index.mjs +5 -5
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.BWUn8Kjy.mjs → attaform.B5b-HmhH.mjs} +18 -9
- package/dist/shared/{attaform.CRVe8s82.d.mts → attaform.B9PYKlhB.d.mts} +43 -19
- package/dist/shared/{attaform.DxKQsqFZ.mjs → attaform.BPMOl562.mjs} +3 -2
- package/dist/{dev/shared/attaform-dev.CZz4GYZ6.mjs → shared/attaform.BPSqtU7a.mjs} +44 -156
- package/dist/shared/{attaform.CdZIEf7_.mjs → attaform.BhtAZysa.mjs} +3 -2
- package/dist/shared/{attaform.DAo0QBmS.d.mts → attaform.CYlF4P6X.d.mts} +31 -10
- package/dist/shared/{attaform.C4shmwyJ.mjs → attaform.CdA9bfRv.mjs} +1 -1
- package/dist/shared/{attaform.DNPJPOO7.mjs → attaform.DAf4ehIe.mjs} +569 -134
- package/dist/shared/{attaform.D9RqPgGu.d.mts → attaform.DZOynI6c.d.mts} +1 -1
- package/dist/shared/{attaform.L011tHgJ.mjs → attaform.KEfNRDot.mjs} +4 -4
- package/dist/shared/attaform._1Zp3mDG.mjs +96 -0
- package/dist/shared/{attaform.DZnrDrNb.d.mts → attaform.i13OEHJF.d.mts} +60 -7
- package/dist/shared/{attaform.DL2nl_QR.mjs → attaform.j9xI_ObC.mjs} +6 -6
- package/dist/shared/{attaform.LUPC-2Qg.mjs → attaform.u6jfHoed.mjs} +4 -4
- package/dist/zod-v3.d.mts +4 -4
- package/dist/zod-v3.mjs +6 -6
- package/dist/zod-v4.d.mts +15 -11
- package/dist/zod-v4.mjs +6 -6
- package/dist/zod.d.mts +4 -4
- package/dist/zod.mjs +5 -5
- package/package.json +2 -1
- package/skills/attaform/SKILL.md +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { j as humanize, c as useAbstractForm } from './attaform-dev.
|
|
2
|
-
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.
|
|
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-dev.
|
|
4
|
-
import {
|
|
1
|
+
import { j as humanize, c as useAbstractForm } from './attaform-dev.3uTCYwy8.mjs';
|
|
2
|
+
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.04aupFBW.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-dev.PTGM9KE1.mjs';
|
|
4
|
+
import { d as callConsumerFn } from './attaform-dev.CwYTWyPX.mjs';
|
|
5
5
|
|
|
6
6
|
function readDef(schema) {
|
|
7
7
|
if (schema === null || typeof schema !== "object") return void 0;
|
|
@@ -181,6 +181,9 @@ function getDiscriminatedOptions(schema) {
|
|
|
181
181
|
return Array.isArray(options) ? options : [];
|
|
182
182
|
}
|
|
183
183
|
function assertZodVersion(schema) {
|
|
184
|
+
assertZodV4Node(schema);
|
|
185
|
+
}
|
|
186
|
+
function assertZodV4Node(schema) {
|
|
184
187
|
const def = readDef(schema);
|
|
185
188
|
if (def?.type === void 0) {
|
|
186
189
|
throw new Error(
|
|
@@ -239,7 +242,7 @@ function walkCapabilities(node, capabilities, visited) {
|
|
|
239
242
|
if (def === void 0) return;
|
|
240
243
|
const checks = getChecks(node);
|
|
241
244
|
if (checks.some(isAsyncCheck)) capabilities.asyncRefine = true;
|
|
242
|
-
if (checks.
|
|
245
|
+
if (checks.some(isVerdictCheck) && CONTAINER_SLOTS.some((key) => def[key] !== void 0)) {
|
|
243
246
|
capabilities.containerOrRootRefine = true;
|
|
244
247
|
}
|
|
245
248
|
if (typeof def.transform === "function" && def.transform.constructor.name === "AsyncFunction") {
|
|
@@ -261,6 +264,11 @@ function walkCapabilities(node, capabilities, visited) {
|
|
|
261
264
|
}
|
|
262
265
|
}
|
|
263
266
|
}
|
|
267
|
+
function isVerdictCheck(check) {
|
|
268
|
+
if (typeof check !== "object" || check === null) return true;
|
|
269
|
+
const kind = check._zod?.def?.check;
|
|
270
|
+
return kind !== "describe" && kind !== "meta";
|
|
271
|
+
}
|
|
264
272
|
function isAsyncCheck(check) {
|
|
265
273
|
if (typeof check !== "object" || check === null) return false;
|
|
266
274
|
const c = check;
|
|
@@ -324,9 +332,9 @@ function zodIssuesToValidationErrors(issues) {
|
|
|
324
332
|
|
|
325
333
|
const V4_INTROSPECTOR = {
|
|
326
334
|
kindOf: (schema) => kindOf(schema),
|
|
327
|
-
getObjectShape
|
|
335
|
+
getObjectShape,
|
|
328
336
|
getTupleItems,
|
|
329
|
-
getDiscriminatedOptions
|
|
337
|
+
getDiscriminatedOptions,
|
|
330
338
|
getDiscriminator,
|
|
331
339
|
getLiteralValues,
|
|
332
340
|
isPreprocessNode,
|
|
@@ -490,7 +498,7 @@ function isLeafRequired(schema, depth = 0) {
|
|
|
490
498
|
return true;
|
|
491
499
|
}
|
|
492
500
|
function zodV4Adapter(rootSchema) {
|
|
493
|
-
|
|
501
|
+
assertZodV4Node(rootSchema);
|
|
494
502
|
assertKeyedRoot(rootSchema);
|
|
495
503
|
return (_formKey, options) => sharedV4Schemas(
|
|
496
504
|
rootSchema,
|
|
@@ -611,7 +619,8 @@ function resolveFieldMetaAtPath(rootSchema, path, maxRecursionDepth) {
|
|
|
611
619
|
};
|
|
612
620
|
}
|
|
613
621
|
function readDescription(schema) {
|
|
614
|
-
const
|
|
622
|
+
const scope = globalThis;
|
|
623
|
+
const candidate = scope.__zod_globalRegistry?.get(schema)?.description ?? schema.description;
|
|
615
624
|
return typeof candidate === "string" ? candidate : void 0;
|
|
616
625
|
}
|
|
617
626
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as RegistryNotInstalledError, O as OutsideSetupError, g as pathKeyToDotted } from './attaform-dev.
|
|
1
|
+
import { c as RegistryNotInstalledError, O as OutsideSetupError, g as pathKeyToDotted } from './attaform-dev.04aupFBW.mjs';
|
|
2
2
|
import { shallowReactive, getCurrentInstance, inject } from 'vue';
|
|
3
3
|
|
|
4
4
|
function detectSSR(options = {}) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isRef, warn, toRaw, reactive, markRaw, effectScope, watch, nextTick } from 'vue';
|
|
2
|
-
import { e as canonicalizePath } from './attaform-dev.
|
|
2
|
+
import { e as canonicalizePath } from './attaform-dev.04aupFBW.mjs';
|
|
3
|
+
import { e as safeOwnHas } from './attaform-dev.CwYTWyPX.mjs';
|
|
3
4
|
|
|
4
5
|
function activeElementOf(node) {
|
|
5
6
|
const rootNode = node.getRootNode();
|
|
@@ -330,7 +331,7 @@ function createHostChannel() {
|
|
|
330
331
|
return commit(rv, value, modifiers);
|
|
331
332
|
},
|
|
332
333
|
writeInput(rv, payload, modifiers) {
|
|
333
|
-
if (typeof payload !== "object" || payload === null || payload instanceof Event || !("value" in payload) || !
|
|
334
|
+
if (typeof payload !== "object" || payload === null || payload instanceof Event || !("value" in payload) || !safeOwnHas(payload, "value")) {
|
|
334
335
|
return false;
|
|
335
336
|
}
|
|
336
337
|
return rv.setValueFromHost(payload.value, modifiers);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
const reported = /* @__PURE__ */ new Set() ;
|
|
2
|
+
function reportConsumerThrow(site, detail, err) {
|
|
3
|
+
const key = detail === void 0 ? site : `${site}|${detail}`;
|
|
4
|
+
if (reported === null || reported.has(key)) return;
|
|
5
|
+
reported.add(key);
|
|
6
|
+
const at = detail === void 0 ? "" : ` at \`${detail}\``;
|
|
7
|
+
const advice = {
|
|
8
|
+
"default-factory": "a `.default(() => ...)` factory threw. Attaform used `undefined` for that field's initial value.",
|
|
9
|
+
"catch-factory": "a `.catch(() => ...)` fallback threw. Attaform used `undefined` for that value.",
|
|
10
|
+
"lazy-getter": "a `z.lazy(() => ...)` factory threw. Attaform stopped descending at that node, so paths below it will not resolve.",
|
|
11
|
+
"wizard-slot": `a function step slot threw${at}. Attaform dropped that step from the compiled list; the rest of the flow still navigates.`,
|
|
12
|
+
"wizard-lazy-slot": `a \`lazy()\` step resolver threw${at}. Attaform dropped that step from the compiled list until the resolver's own dependencies change.`,
|
|
13
|
+
"wizard-progress": "a `useWizard({ progress })` override threw. Attaform fell back to its own valid-step ratio.",
|
|
14
|
+
"wizard-restore": "a `useWizard({ restore })` callback threw. Attaform read no step from it, so the wizard stays where it is.",
|
|
15
|
+
"wizard-persist": "a `useWizard({ persist })` callback threw. Attaform navigated anyway, so the step is live but unrecorded.",
|
|
16
|
+
"wizard-default-statuses": "a `useWizard({ defaultStatuses })` factory threw or rejected. Attaform seeded no statuses, the same as omitting the option.",
|
|
17
|
+
"stored-value": "a written value threw as Vue read it to store it (a Proxy whose `get` trap throws). Attaform skipped that write, so the form keeps the value it had."
|
|
18
|
+
};
|
|
19
|
+
console.error(
|
|
20
|
+
`[attaform] ${advice[site]} Attaform has nowhere to surface this, so it must not throw; wrap your own try/catch if the failure is recoverable. Original error:`,
|
|
21
|
+
err
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
function callConsumerFn(fn, fallback, site, detail) {
|
|
25
|
+
try {
|
|
26
|
+
return fn();
|
|
27
|
+
} catch (err) {
|
|
28
|
+
reportConsumerThrow(site, detail, 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
|
+
|
|
68
|
+
function safeAssign(target, key, value) {
|
|
69
|
+
if (key === "__proto__") {
|
|
70
|
+
Object.defineProperty(target, key, {
|
|
71
|
+
value,
|
|
72
|
+
writable: true,
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
target[key] = value;
|
|
79
|
+
}
|
|
80
|
+
const SHADOWED_KEYS = new Set(Object.getOwnPropertyNames(Object.prototype));
|
|
81
|
+
function isShadowedKey(key) {
|
|
82
|
+
return SHADOWED_KEYS.has(key);
|
|
83
|
+
}
|
|
84
|
+
function safeOwnRead(target, key) {
|
|
85
|
+
if (isShadowedKey(key)) {
|
|
86
|
+
const desc = Object.getOwnPropertyDescriptor(target, key);
|
|
87
|
+
if (desc === void 0) return void 0;
|
|
88
|
+
return "value" in desc ? desc.value : readConsumerProp(target, key);
|
|
89
|
+
}
|
|
90
|
+
return readConsumerProp(target, key);
|
|
91
|
+
}
|
|
92
|
+
function safeOwnHas(target, key) {
|
|
93
|
+
try {
|
|
94
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
95
|
+
} catch {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function spreadConsumerRecord(src) {
|
|
100
|
+
try {
|
|
101
|
+
return { ...src };
|
|
102
|
+
} catch {
|
|
103
|
+
const out = {};
|
|
104
|
+
for (const key of Object.keys(src)) {
|
|
105
|
+
safeAssign(out, key, readConsumerProp(src, key));
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function copyConsumerArray(src) {
|
|
111
|
+
try {
|
|
112
|
+
return src.slice();
|
|
113
|
+
} catch {
|
|
114
|
+
const out = new Array(src.length);
|
|
115
|
+
for (let i = 0; i < src.length; i++) out[i] = readConsumerIndex(src, i);
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
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, reportConsumerThrow as k, readConsumerIndex as r, safeAssign as s };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as InvalidUseFormConfigError } from './attaform-dev.
|
|
2
|
-
import { u as useForm$2 } from './attaform-dev.
|
|
3
|
-
import { u as useForm$1 } from './attaform-dev.
|
|
4
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform-dev.
|
|
1
|
+
import { a as InvalidUseFormConfigError } from './attaform-dev.04aupFBW.mjs';
|
|
2
|
+
import { u as useForm$2 } from './attaform-dev.OceE0X3v.mjs';
|
|
3
|
+
import { u as useForm$1 } from './attaform-dev.BpVGFSFa.mjs';
|
|
4
|
+
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './attaform-dev.PTGM9KE1.mjs';
|
|
5
5
|
|
|
6
6
|
function isZodV4SchemaShape(value) {
|
|
7
7
|
if (typeof value !== "object" || value === null) return false;
|
|
@@ -1,7 +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-dev.
|
|
2
|
-
import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform-dev.
|
|
3
|
-
import {
|
|
4
|
-
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.
|
|
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-dev.PTGM9KE1.mjs';
|
|
2
|
+
import { h as getAtPath, j as humanize, c as useAbstractForm } from './attaform-dev.3uTCYwy8.mjs';
|
|
3
|
+
import { d as callConsumerFn } from './attaform-dev.CwYTWyPX.mjs';
|
|
4
|
+
import { A as AttaformError, e as canonicalizePath, a as InvalidUseFormConfigError } from './attaform-dev.04aupFBW.mjs';
|
|
5
5
|
|
|
6
6
|
function isZodSchemaType(schema, expectedType) {
|
|
7
7
|
if (typeof schema !== "object" || schema === null) return false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform-dev.
|
|
2
|
-
import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform-dev.
|
|
3
|
-
import { a as safeOwnRead,
|
|
1
|
+
import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform-dev.3uTCYwy8.mjs';
|
|
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';
|
|
4
4
|
|
|
5
5
|
const PATH_SEPARATOR = ".";
|
|
6
6
|
function isOpaqueKind(kind) {
|
|
@@ -350,7 +350,7 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
|
|
|
350
350
|
switch (kind) {
|
|
351
351
|
case "object": {
|
|
352
352
|
const shape = intro.getObjectShape(schema);
|
|
353
|
-
if (!
|
|
353
|
+
if (!safeOwnHas(shape, head)) return [];
|
|
354
354
|
const next = shape[head];
|
|
355
355
|
return next === void 0 ? [] : walkPathSegments(next, rest, intro, maxDepth, lazyDepth);
|
|
356
356
|
}
|
|
@@ -382,7 +382,7 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
|
|
|
382
382
|
return intro.getUnionOptions(schema).flatMap((opt) => walkPathSegments(opt, segments, intro, maxDepth, lazyDepth));
|
|
383
383
|
case "discriminated-union": {
|
|
384
384
|
const options = intro.getDiscriminatedOptions(schema);
|
|
385
|
-
const matching = options.filter((opt) =>
|
|
385
|
+
const matching = options.filter((opt) => safeOwnHas(intro.getObjectShape(opt), head));
|
|
386
386
|
const candidates = matching.length > 0 ? matching : options;
|
|
387
387
|
return candidates.flatMap(
|
|
388
388
|
(opt) => walkPathSegments(opt, segments, intro, maxDepth, lazyDepth)
|
|
@@ -717,7 +717,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
|
|
|
717
717
|
case "number":
|
|
718
718
|
return 0;
|
|
719
719
|
case "bigint":
|
|
720
|
-
return
|
|
720
|
+
return typeof BigInt === "function" ? BigInt(0) : void 0;
|
|
721
721
|
case "boolean":
|
|
722
722
|
return false;
|
|
723
723
|
case "date":
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as safeAssign, a as safeOwnRead, r as readConsumerIndex, c as consumerKeys, b as readConsumerProp } from './attaform-dev.CwYTWyPX.mjs';
|
|
2
|
+
import { m as mapSegmentKeys, f as pathsEqual, i as isPathPrefix } from './attaform-dev.04aupFBW.mjs';
|
|
2
3
|
|
|
3
4
|
const DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS = 0;
|
|
4
5
|
const DEFAULT_HISTORY_MAX_SNAPSHOTS = 128;
|
|
@@ -9,6 +10,11 @@ const DEFAULT_MAX_RECURSION_DEPTH = 64;
|
|
|
9
10
|
function normalizeNumericOption(config) {
|
|
10
11
|
const { value, source, min, defaultValue } = config;
|
|
11
12
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
13
|
+
{
|
|
14
|
+
console.warn(
|
|
15
|
+
`[attaform] ${source} must be a non-negative finite integer; got ${String(value)}. Falling back to ${String(defaultValue)}.`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
12
18
|
return defaultValue;
|
|
13
19
|
}
|
|
14
20
|
return Math.max(min, Math.floor(value));
|
|
@@ -21,101 +27,6 @@ function pickDefined(bag) {
|
|
|
21
27
|
return out;
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
function callConsumerFn(fn, fallback, site, detail) {
|
|
25
|
-
try {
|
|
26
|
-
return fn();
|
|
27
|
-
} catch (err) {
|
|
28
|
-
return fallback;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function readConsumerProp(obj, key) {
|
|
32
|
-
try {
|
|
33
|
-
return obj[key];
|
|
34
|
-
} catch {
|
|
35
|
-
return void 0;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function consumerKeys(obj) {
|
|
39
|
-
try {
|
|
40
|
-
return Object.keys(obj);
|
|
41
|
-
} catch {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function readConsumerIndex(arr, i) {
|
|
46
|
-
try {
|
|
47
|
-
return arr[i];
|
|
48
|
-
} catch {
|
|
49
|
-
return void 0;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function consumerSymbolKeys(obj) {
|
|
53
|
-
try {
|
|
54
|
-
return Object.getOwnPropertySymbols(obj);
|
|
55
|
-
} catch {
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function consumerHas(obj, key) {
|
|
60
|
-
try {
|
|
61
|
-
return key in obj;
|
|
62
|
-
} catch {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function safeAssign(target, key, value) {
|
|
68
|
-
if (key === "__proto__") {
|
|
69
|
-
Object.defineProperty(target, key, {
|
|
70
|
-
value,
|
|
71
|
-
writable: true,
|
|
72
|
-
enumerable: true,
|
|
73
|
-
configurable: true
|
|
74
|
-
});
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
target[key] = value;
|
|
78
|
-
}
|
|
79
|
-
const SHADOWED_KEYS = new Set(Object.getOwnPropertyNames(Object.prototype));
|
|
80
|
-
function isShadowedKey(key) {
|
|
81
|
-
return SHADOWED_KEYS.has(key);
|
|
82
|
-
}
|
|
83
|
-
function safeOwnRead(target, key) {
|
|
84
|
-
if (isShadowedKey(key)) {
|
|
85
|
-
const desc = Object.getOwnPropertyDescriptor(target, key);
|
|
86
|
-
if (desc === void 0) return void 0;
|
|
87
|
-
return "value" in desc ? desc.value : readConsumerProp(target, key);
|
|
88
|
-
}
|
|
89
|
-
return readConsumerProp(target, key);
|
|
90
|
-
}
|
|
91
|
-
function safeOwnHas(target, key) {
|
|
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
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
30
|
function isDescendable(value) {
|
|
120
31
|
if (value === null || typeof value !== "object") return false;
|
|
121
32
|
if (Array.isArray(value)) return true;
|
|
@@ -123,6 +34,9 @@ function isDescendable(value) {
|
|
|
123
34
|
const proto = Object.getPrototypeOf(value);
|
|
124
35
|
return proto === null || proto === Object.prototype;
|
|
125
36
|
}
|
|
37
|
+
function isBarePatch(patch) {
|
|
38
|
+
return patch.kind === "added" ? isDescendable(patch.newValue) : patch.kind === "removed" && isDescendable(patch.oldValue);
|
|
39
|
+
}
|
|
126
40
|
function appendSegment(prefix, segment) {
|
|
127
41
|
const next = new Array(prefix.length + 1);
|
|
128
42
|
for (let i = 0; i < prefix.length; i++) {
|
|
@@ -137,11 +51,11 @@ function diffAndApply(oldValue, newValue, prefix, visit) {
|
|
|
137
51
|
const oldIsDescendable = isDescendable(oldValue);
|
|
138
52
|
const newIsDescendable = isDescendable(newValue);
|
|
139
53
|
if (oldValue === void 0 && newIsDescendable) {
|
|
140
|
-
|
|
54
|
+
walkDescendable(newValue, prefix, visit, true);
|
|
141
55
|
return;
|
|
142
56
|
}
|
|
143
57
|
if (oldIsDescendable && newValue === void 0) {
|
|
144
|
-
|
|
58
|
+
walkDescendable(oldValue, prefix, visit, false);
|
|
145
59
|
return;
|
|
146
60
|
}
|
|
147
61
|
if (oldIsDescendable && newIsDescendable) {
|
|
@@ -191,50 +105,51 @@ function diffAndApply(oldValue, newValue, prefix, visit) {
|
|
|
191
105
|
}
|
|
192
106
|
visit({ kind: "changed", path: prefix, oldValue, newValue });
|
|
193
107
|
}
|
|
194
|
-
function
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
108
|
+
function walkDescendable(value, prefix, visit, arrived) {
|
|
109
|
+
let reported = false;
|
|
110
|
+
if (Array.isArray(value)) {
|
|
111
|
+
for (let i = 0; i < value.length; i++) {
|
|
112
|
+
diffSlot(readConsumerIndex(value, i), appendSegment(prefix, i), visit, arrived);
|
|
198
113
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
114
|
+
reported = value.length > 0;
|
|
115
|
+
} else if (value instanceof Map) {
|
|
116
|
+
for (const [key, entry] of value) {
|
|
117
|
+
diffSlot(entry, appendSegment(prefix, key), visit, arrived);
|
|
202
118
|
}
|
|
119
|
+
reported = value.size > 0;
|
|
203
120
|
} else {
|
|
204
|
-
const rec =
|
|
121
|
+
const rec = value;
|
|
205
122
|
for (const k of consumerKeys(rec)) {
|
|
206
|
-
|
|
123
|
+
const entry = readConsumerProp(rec, k);
|
|
124
|
+
if (entry === void 0) continue;
|
|
125
|
+
reported = true;
|
|
126
|
+
if (arrived) diffAndApply(void 0, entry, appendSegment(prefix, k), visit);
|
|
127
|
+
else diffAndApply(entry, void 0, appendSegment(prefix, k), visit);
|
|
207
128
|
}
|
|
208
129
|
}
|
|
130
|
+
if (!reported) visit(presencePatch(arrived, prefix, value));
|
|
209
131
|
}
|
|
210
|
-
function
|
|
211
|
-
if (
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
diffAndApply(entry, void 0, appendSegment(prefix, key), visit);
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
const rec = oldValue;
|
|
221
|
-
for (const k of consumerKeys(rec)) {
|
|
222
|
-
diffAndApply(readConsumerProp(rec, k), void 0, appendSegment(prefix, k), visit);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
132
|
+
function diffSlot(entry, path, visit, arrived) {
|
|
133
|
+
if (entry === void 0) visit(presencePatch(arrived, path, entry));
|
|
134
|
+
else if (arrived) diffAndApply(void 0, entry, path, visit);
|
|
135
|
+
else diffAndApply(entry, void 0, path, visit);
|
|
136
|
+
}
|
|
137
|
+
function presencePatch(arrived, path, value) {
|
|
138
|
+
return arrived ? { kind: "added", path, newValue: value } : { kind: "removed", path, oldValue: value };
|
|
225
139
|
}
|
|
226
140
|
function diffMapsLockstep(oldMap, newMap, prefix, visit) {
|
|
227
141
|
for (const [key, entry] of newMap) {
|
|
228
|
-
|
|
142
|
+
const path = appendSegment(prefix, key);
|
|
143
|
+
if (oldMap.has(key)) diffAndApply(oldMap.get(key), entry, path, visit);
|
|
144
|
+
else diffSlot(entry, path, visit, true);
|
|
229
145
|
}
|
|
230
146
|
for (const [key, entry] of oldMap) {
|
|
231
|
-
if (newMap.has(key))
|
|
232
|
-
diffAndApply(entry, void 0, appendSegment(prefix, key), visit);
|
|
147
|
+
if (!newMap.has(key)) diffSlot(entry, appendSegment(prefix, key), visit, false);
|
|
233
148
|
}
|
|
234
149
|
}
|
|
235
150
|
function diffArraysLockstep(oldArr, newArr, prefix, visit) {
|
|
236
|
-
const
|
|
237
|
-
for (let i = 0; i <
|
|
151
|
+
const min = Math.min(oldArr.length, newArr.length);
|
|
152
|
+
for (let i = 0; i < min; i++) {
|
|
238
153
|
diffAndApply(
|
|
239
154
|
readConsumerIndex(oldArr, i),
|
|
240
155
|
readConsumerIndex(newArr, i),
|
|
@@ -242,6 +157,12 @@ function diffArraysLockstep(oldArr, newArr, prefix, visit) {
|
|
|
242
157
|
visit
|
|
243
158
|
);
|
|
244
159
|
}
|
|
160
|
+
for (let i = min; i < newArr.length; i++) {
|
|
161
|
+
diffSlot(readConsumerIndex(newArr, i), appendSegment(prefix, i), visit, true);
|
|
162
|
+
}
|
|
163
|
+
for (let i = min; i < oldArr.length; i++) {
|
|
164
|
+
diffSlot(readConsumerIndex(oldArr, i), appendSegment(prefix, i), visit, false);
|
|
165
|
+
}
|
|
245
166
|
}
|
|
246
167
|
function diffObjectsLockstep(oldRec, newRec, prefix, visit) {
|
|
247
168
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -355,4 +276,4 @@ function structuralSnapshot(value) {
|
|
|
355
276
|
return out;
|
|
356
277
|
}
|
|
357
278
|
|
|
358
|
-
export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R,
|
|
279
|
+
export { ANONYMOUS_FORM_KEY_PREFIX as A, DEFAULT_HISTORY_MAX_SNAPSHOTS as D, RESERVED_KEY_PREFIX as R, DEFAULT_FIELD_VALIDATION_DEBOUNCE_MS as a, isDescendable as b, applyChangedKeys as c, diffAndApply as d, DEFAULT_MAX_RECURSION_DEPTH as e, ANONYMOUS_WIZARD_KEY_PREFIX as f, isBarePatch as i, normalizeNumericOption as n, pickDefined as p, structuralSnapshot as s };
|
package/dist/dev/zod-v3.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { i as isZodSchemaType, u as useForm, z as zodAdapter } from './shared/attaform-dev.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
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.
|
|
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.
|
|
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.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
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';
|
|
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';
|
|
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';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/zod-v4.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { a as assertZodVersion, k as kindOf, u as useForm, z as zodAdapter } from './shared/attaform-dev.
|
|
2
|
-
import { i as installingFieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform-dev.
|
|
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.
|
|
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.
|
|
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.
|
|
6
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
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';
|
|
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';
|
|
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';
|
|
7
7
|
|
|
8
8
|
const fieldMeta = installingFieldMetaStore;
|
|
9
9
|
function withMeta(schema, payload) {
|
package/dist/dev/zod.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
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.
|
|
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.
|
|
4
|
-
export { a as assignKey, i as isRegisterValue, v as vRegister } from './shared/attaform-dev.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform-dev.
|
|
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';
|
|
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';
|
package/dist/directive.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister } from './shared/attaform.
|
|
2
|
-
import { an as RegisterModelDynamicCustomDirective } from './shared/attaform.
|
|
1
|
+
export { i as installVRegister, v as vRegister } from './shared/attaform.DZOynI6c.mjs';
|
|
2
|
+
import { an as RegisterModelDynamicCustomDirective } from './shared/attaform.i13OEHJF.mjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/directive.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.
|
|
1
|
+
export { i as installVRegister, v as vRegister, b as vRegisterFile } from './shared/attaform.BPMOl562.mjs';
|
package/dist/history.d.mts
CHANGED
package/dist/history.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef, computed } from 'vue';
|
|
2
|
-
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.
|
|
2
|
+
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.BPSqtU7a.mjs';
|
|
3
3
|
|
|
4
4
|
function captureErrorCells(map) {
|
|
5
5
|
const out = [];
|
|
@@ -10,11 +10,14 @@ function captureErrorCells(map) {
|
|
|
10
10
|
}
|
|
11
11
|
function createHistoryRuntime(kernel, max) {
|
|
12
12
|
const capacity = Math.max(1, max);
|
|
13
|
+
let generation = 0;
|
|
13
14
|
function captureSnapshot() {
|
|
14
15
|
return {
|
|
15
16
|
form: structuralSnapshot(kernel.form.value),
|
|
16
17
|
blankPaths: [...kernel.blankPaths],
|
|
17
|
-
errorCells: captureErrorCells(kernel.errorCells())
|
|
18
|
+
errorCells: captureErrorCells(kernel.errorCells()),
|
|
19
|
+
structure: kernel.captureStructure(),
|
|
20
|
+
generation
|
|
18
21
|
};
|
|
19
22
|
}
|
|
20
23
|
const positions = shallowRef([captureSnapshot()]);
|
|
@@ -35,7 +38,16 @@ function createHistoryRuntime(kernel, max) {
|
|
|
35
38
|
positions.value = next;
|
|
36
39
|
cursor.value = next.length - 1;
|
|
37
40
|
});
|
|
41
|
+
const unsubscribeReset = kernel.onReset(() => {
|
|
42
|
+
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;
|
|
48
|
+
});
|
|
38
49
|
function restorePosition(snap) {
|
|
50
|
+
if (snap.generation === generation) kernel.restoreStructure(snap.structure);
|
|
39
51
|
suppressNext = true;
|
|
40
52
|
kernel.blankPaths.clear();
|
|
41
53
|
for (const key of snap.blankPaths) kernel.blankPaths.add(key);
|
|
@@ -68,6 +80,7 @@ function createHistoryRuntime(kernel, max) {
|
|
|
68
80
|
historySize: computed(() => positions.value.length),
|
|
69
81
|
dispose() {
|
|
70
82
|
unsubscribeChange();
|
|
83
|
+
unsubscribeReset();
|
|
71
84
|
positions.value = positions.value.slice(cursor.value, cursor.value + 1);
|
|
72
85
|
cursor.value = 0;
|
|
73
86
|
}
|