attaform 0.30.1 → 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 +3 -3
- 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.DxHdkkPG.mjs → attaform-dev.3uTCYwy8.mjs} +770 -254
- package/dist/dev/shared/{attaform-dev.BJK1kqHY.mjs → attaform-dev.BpVGFSFa.mjs} +88 -115
- package/dist/dev/shared/{attaform-dev.Chm4D6SJ.mjs → attaform-dev.Bu6wgrA5.mjs} +3 -3
- package/dist/dev/shared/{attaform-dev.BMQ3GcgD.mjs → attaform-dev.Cbx0AiQF.mjs} +476 -337
- package/dist/dev/shared/attaform-dev.CwYTWyPX.mjs +120 -0
- package/dist/dev/shared/{attaform-dev.DuEE4GU1.mjs → attaform-dev.D7lKyM_7.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.CT7MDjPy.mjs → attaform-dev.OceE0X3v.mjs} +154 -229
- package/dist/{shared/attaform.DRsANMok.mjs → dev/shared/attaform-dev.PTGM9KE1.mjs} +16 -15
- 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/components/AttaformDevtoolsPanel.vue +3 -3
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.CO918TdU.mjs → attaform.B5b-HmhH.mjs} +88 -115
- package/dist/shared/{attaform.2FslhB9R.d.mts → attaform.B9PYKlhB.d.mts} +43 -19
- package/dist/shared/{attaform.D_f1WgYf.mjs → attaform.BPMOl562.mjs} +458 -319
- 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.BcQwgWaq.d.mts → attaform.CYlF4P6X.d.mts} +58 -17
- package/dist/shared/{attaform.WiGdIqgx.mjs → attaform.CdA9bfRv.mjs} +3 -3
- package/dist/shared/{attaform.BIWicztt.mjs → attaform.DAf4ehIe.mjs} +765 -251
- package/dist/shared/{attaform.ZYn2ahzJ.mjs → attaform.DBCbxlyk.mjs} +59 -1
- package/dist/shared/{attaform.L0kUn3vL.d.mts → attaform.DZOynI6c.d.mts} +1 -1
- package/dist/shared/{attaform.B2iebkPA.mjs → attaform.KEfNRDot.mjs} +4 -4
- package/dist/shared/attaform._1Zp3mDG.mjs +96 -0
- package/dist/shared/{attaform.Br8EBn5B.d.mts → attaform.i13OEHJF.d.mts} +195 -38
- package/dist/{dev/shared/attaform-dev.BUIFcTYf.mjs → shared/attaform.j9xI_ObC.mjs} +16 -15
- package/dist/shared/{attaform.D_pt1gOj.mjs → attaform.u6jfHoed.mjs} +154 -229
- package/dist/transforms.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/zod-v3.d.mts +4 -4
- package/dist/zod-v3.mjs +6 -6
- package/dist/zod-v4.d.mts +22 -16
- 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 +2 -1
- package/skills/attaform/references/custom-components.md +4 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AttaformErrorCode, k as isPlainRecord, s as slimKindOf } from './attaform.
|
|
2
|
-
import { e as canonicalizePath, h as SET_MEMBER_SEGMENT } from './attaform.
|
|
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) {
|
|
@@ -37,9 +37,6 @@ function createAbstractSchema(rootSchema, intro, services, options) {
|
|
|
37
37
|
const discriminatorCache = /* @__PURE__ */ new Map();
|
|
38
38
|
const entryKeyKindCache = /* @__PURE__ */ new Map();
|
|
39
39
|
const slimKindsCache = /* @__PURE__ */ new Map();
|
|
40
|
-
let asyncValidationFlag = null;
|
|
41
|
-
let containerRefineFlag = null;
|
|
42
|
-
let discriminatedUnionFlag = null;
|
|
43
40
|
function mapKeySegmentKind(schema) {
|
|
44
41
|
const keyType = intro.getMapKeyType(schema);
|
|
45
42
|
if (keyType === void 0) return void 0;
|
|
@@ -92,20 +89,24 @@ function createAbstractSchema(rootSchema, intro, services, options) {
|
|
|
92
89
|
}
|
|
93
90
|
const abstractSchema = {
|
|
94
91
|
needsAsyncValidation() {
|
|
95
|
-
|
|
96
|
-
return
|
|
92
|
+
const { asyncRefine, asyncTransform } = intro.capabilitiesOf(rootSchema);
|
|
93
|
+
return asyncRefine || asyncTransform;
|
|
97
94
|
},
|
|
98
95
|
hasContainerOrRootRefine() {
|
|
99
|
-
|
|
100
|
-
return containerRefineFlag;
|
|
96
|
+
return intro.capabilitiesOf(rootSchema).containerOrRootRefine;
|
|
101
97
|
},
|
|
102
98
|
hasDiscriminatedUnions() {
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
return intro.capabilitiesOf(rootSchema).discriminatedUnion;
|
|
100
|
+
},
|
|
101
|
+
hasPreprocessOrCoerce() {
|
|
102
|
+
return intro.capabilitiesOf(rootSchema).preprocessOrCoerce;
|
|
105
103
|
},
|
|
106
104
|
getDefaultValues(config) {
|
|
107
105
|
return services.runGetDefaults(rootSchema, config, maxRecursionDepth);
|
|
108
106
|
},
|
|
107
|
+
validateSync(data) {
|
|
108
|
+
return services.validateSync(rootSchema, data);
|
|
109
|
+
},
|
|
109
110
|
getDefaultAtPath(path) {
|
|
110
111
|
if (path.length === 0) {
|
|
111
112
|
return services.deriveDefault(rootSchema, true, maxRecursionDepth);
|
|
@@ -349,7 +350,7 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
|
|
|
349
350
|
switch (kind) {
|
|
350
351
|
case "object": {
|
|
351
352
|
const shape = intro.getObjectShape(schema);
|
|
352
|
-
if (!
|
|
353
|
+
if (!safeOwnHas(shape, head)) return [];
|
|
353
354
|
const next = shape[head];
|
|
354
355
|
return next === void 0 ? [] : walkPathSegments(next, rest, intro, maxDepth, lazyDepth);
|
|
355
356
|
}
|
|
@@ -381,7 +382,7 @@ function walkPathSegments(schema, segments, intro, maxDepth, lazyDepth) {
|
|
|
381
382
|
return intro.getUnionOptions(schema).flatMap((opt) => walkPathSegments(opt, segments, intro, maxDepth, lazyDepth));
|
|
382
383
|
case "discriminated-union": {
|
|
383
384
|
const options = intro.getDiscriminatedOptions(schema);
|
|
384
|
-
const matching = options.filter((opt) =>
|
|
385
|
+
const matching = options.filter((opt) => safeOwnHas(intro.getObjectShape(opt), head));
|
|
385
386
|
const candidates = matching.length > 0 ? matching : options;
|
|
386
387
|
return candidates.flatMap(
|
|
387
388
|
(opt) => walkPathSegments(opt, segments, intro, maxDepth, lazyDepth)
|
|
@@ -716,7 +717,7 @@ function deriveDefaultWalk(schema, useDefault, intro, maxDepth, lazyDepth = 0) {
|
|
|
716
717
|
case "number":
|
|
717
718
|
return 0;
|
|
718
719
|
case "bigint":
|
|
719
|
-
return
|
|
720
|
+
return typeof BigInt === "function" ? BigInt(0) : void 0;
|
|
720
721
|
case "boolean":
|
|
721
722
|
return false;
|
|
722
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 {
|
|
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
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,55 +1,15 @@
|
|
|
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.
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration,
|
|
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';
|
|
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
|
|
5
|
-
export { v as vRegister } from './shared/attaform.
|
|
6
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.
|
|
7
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
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';
|
|
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';
|
|
11
11
|
import 'vue';
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Type-level Zod-major discriminator for the unified `attaform/zod`
|
|
15
|
-
* entry. The runtime dispatch (`use-form.ts`'s impl) already routes on
|
|
16
|
-
* the schema's shape via `isZodV4SchemaShape`; this is the type-level
|
|
17
|
-
* mirror so the overloads and projection helpers discriminate the same
|
|
18
|
-
* way.
|
|
19
|
-
*
|
|
20
|
-
* Why a structural marker instead of `z.ZodObject`: the unified entry's
|
|
21
|
-
* overloads constrain on `z.ZodObject`, but the published `.d.mts`
|
|
22
|
-
* resolves `z` against whichever single Zod major the consumer
|
|
23
|
-
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
24
|
-
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
25
|
-
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
26
|
-
* overload's constraint and binds it, collapsing the read slot to
|
|
27
|
-
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
28
|
-
* schema never does.
|
|
29
|
-
* Intersecting a v4-only constraint or conditional branch with this
|
|
30
|
-
* marker keeps it unreachable for a v3 schema regardless of how `zod`
|
|
31
|
-
* resolves, so v3 schemas fall through to the v3 overload.
|
|
32
|
-
*
|
|
33
|
-
* Distinct from `core/zod-shape.ts`'s runtime `ZodV4Shape` (which reads
|
|
34
|
-
* the public `def` getter): at the type level the stable v4 brand is
|
|
35
|
-
* `_zod.def`, the same internals `StorageShape` (v4) already reads.
|
|
36
|
-
*
|
|
37
|
-
* Pairing requirement: a v4 overload/branch must constrain on
|
|
38
|
-
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
39
|
-
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
40
|
-
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
41
|
-
* arguments, an error type that behaves like `any` under
|
|
42
|
-
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
43
|
-
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
44
|
-
* keeps it a concrete object type in both majors, so the intersection
|
|
45
|
-
* stays meaningful.
|
|
46
|
-
*/
|
|
47
|
-
type ZodV4Internals = {
|
|
48
|
-
_zod: {
|
|
49
|
-
def: unknown;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
13
|
/**
|
|
54
14
|
* Per-major projection helpers shared by the unified `attaform/zod`
|
|
55
15
|
* entry. Each maps an arbitrary Zod v4 OR v3 object schema to the
|
|
@@ -101,12 +61,13 @@ type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>
|
|
|
101
61
|
* const form = useForm({ schema })
|
|
102
62
|
* ```
|
|
103
63
|
*
|
|
104
|
-
* The constraint
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
64
|
+
* The constraint is structural on Zod's core `_zod` internals. A
|
|
65
|
+
* `zod/mini` schema binds it as its classic twin does, and a v3 schema,
|
|
66
|
+
* which carries no `_zod`, cannot bind it even where `zod` resolves to v3
|
|
67
|
+
* in a single-major install, so it falls through to the v3 overload
|
|
68
|
+
* below. See `SupportedRootSchema` in `../zod-v4/types-root.ts`.
|
|
108
69
|
*/
|
|
109
|
-
declare function useForm<Schema extends SupportedRootSchema
|
|
70
|
+
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
110
71
|
schema: Schema;
|
|
111
72
|
defaultValues?: AcceptableDefaults<V4FormOf<Schema>, V4SchemaInput<Schema>>;
|
|
112
73
|
} & ValidateOnConfig): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
@@ -158,11 +119,11 @@ declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey
|
|
|
158
119
|
* cleanly under a generic constraint because no conditional
|
|
159
120
|
* is present.
|
|
160
121
|
*/
|
|
161
|
-
type UseFormReturnV4<Schema extends
|
|
122
|
+
type UseFormReturnV4<Schema extends SupportedRootSchema, K extends FormKey = FormKey> = UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
162
123
|
/**
|
|
163
124
|
* Direct V4 configuration projection. Mirrors `UseFormReturnV4`.
|
|
164
125
|
*/
|
|
165
|
-
type UseFormConfigV4<Schema extends
|
|
126
|
+
type UseFormConfigV4<Schema extends SupportedRootSchema, K extends FormKey = FormKey> = Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
166
127
|
schema: Schema;
|
|
167
128
|
} & ValidateOnConfig;
|
|
168
129
|
/**
|
|
@@ -190,13 +151,13 @@ type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKe
|
|
|
190
151
|
* under a generic constraint, so this helper's dispatch stays deferred
|
|
191
152
|
* and return-type compatibility cannot be proven.
|
|
192
153
|
*/
|
|
193
|
-
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema
|
|
154
|
+
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends SupportedRootSchema$1 ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
194
155
|
/**
|
|
195
156
|
* The configuration parameter shape of `useForm` for a given Zod
|
|
196
157
|
* schema. Same dispatch as `UseFormReturn`; it replaces
|
|
197
158
|
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
198
159
|
*/
|
|
199
|
-
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema
|
|
160
|
+
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
200
161
|
schema: Schema;
|
|
201
162
|
} & ValidateOnConfig : Schema extends SupportedRootSchema$1 ? Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
202
163
|
schema: Schema;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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.
|
|
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.
|
|
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.
|
|
4
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.
|
|
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';
|
|
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';
|
|
6
6
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
|
@@ -72,7 +72,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
72
72
|
void updateTick.value
|
|
73
73
|
const form = activeForm.value
|
|
74
74
|
if (form === null) return []
|
|
75
|
-
return Array.from(form.errorCells.entries())
|
|
75
|
+
return Array.from(form.errorCells().entries())
|
|
76
76
|
.filter(([, cell]) => cell.schema.length > 0)
|
|
77
77
|
.map(([key, cell]) => [key, cell.schema] as const)
|
|
78
78
|
})
|
|
@@ -81,7 +81,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
81
81
|
void updateTick.value
|
|
82
82
|
const form = activeForm.value
|
|
83
83
|
if (form === null) return []
|
|
84
|
-
return Array.from(form.errorCells.entries())
|
|
84
|
+
return Array.from(form.errorCells().entries())
|
|
85
85
|
.filter(([, cell]) => cell.user.length > 0)
|
|
86
86
|
.map(([key, cell]) => [key, cell.user] as const)
|
|
87
87
|
})
|
|
@@ -221,7 +221,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
221
221
|
value = (value as Record<string | number, unknown>)[seg]
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
const cell = form.errorCells.get(canonicalKey)
|
|
224
|
+
const cell = form.errorCells().get(canonicalKey)
|
|
225
225
|
const schemaEntries =
|
|
226
226
|
(cell?.schema as ReadonlyArray<{ message: string; code: string }> | undefined) ?? []
|
|
227
227
|
const userEntries =
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRuntimeConfig, useRoute } from 'nuxt/app';
|
|
2
|
-
import { c as createAttaform, b as kAttaformWizardActiveStepResolver, r as renderAttaformState, h as hydrateAttaformState, g as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform.
|
|
2
|
+
import { c as createAttaform, b as kAttaformWizardActiveStepResolver, r as renderAttaformState, h as hydrateAttaformState, g as getRegistryFromApp, D as DEVTOOLS_WINDOW_KEY } from '../../shared/attaform.CdA9bfRv.mjs';
|
|
3
3
|
|
|
4
4
|
var attaform_default = defineNuxtPlugin({
|
|
5
5
|
// `enforce: 'pre'` makes the "we run before any component's setup" claim
|