attaform 0.24.3 → 0.25.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/chunks/devtools.cjs +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/chunks/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/{attaform.DQcdvxKZ.cjs → attaform.3heDHayA.cjs} +146 -3
- package/dist/shared/attaform.3heDHayA.cjs.map +1 -0
- package/dist/shared/{attaform.yqcYwt0d.d.ts → attaform.8vmdOURQ.d.mts} +124 -56
- package/dist/shared/{attaform.BjiHiYAZ.d.ts → attaform.B3cgZE3c.d.ts} +1 -1
- package/dist/shared/{attaform.DHjRN5JP.d.cts → attaform.B5GFS3Su.d.cts} +124 -56
- package/dist/shared/{attaform.BVjueUPu.cjs → attaform.B5YcWrKi.cjs} +3 -3
- package/dist/shared/{attaform.BVjueUPu.cjs.map → attaform.B5YcWrKi.cjs.map} +1 -1
- package/dist/shared/{attaform.Bx6pgrIy.d.cts → attaform.BJt4ZCkM.d.mts} +1 -1
- package/dist/shared/{attaform.DK6_Ctv7.cjs → attaform.BRzKBj2g.cjs} +182 -7
- package/dist/shared/attaform.BRzKBj2g.cjs.map +1 -0
- package/dist/shared/{attaform.CB1kYKUB.cjs → attaform.BkUzunyB.cjs} +180 -38
- package/dist/shared/attaform.BkUzunyB.cjs.map +1 -0
- package/dist/shared/{attaform.Dbzwtn4g.mjs → attaform.CN4ZEGo6.mjs} +4 -4
- package/dist/shared/{attaform.Dbzwtn4g.mjs.map → attaform.CN4ZEGo6.mjs.map} +1 -1
- package/dist/shared/{attaform.C5qkSN6t.mjs → attaform.CqwcTExO.mjs} +146 -3
- package/dist/shared/attaform.CqwcTExO.mjs.map +1 -0
- package/dist/shared/{attaform.D4ebpNbS.mjs → attaform.CwXXbZIQ.mjs} +3 -3
- package/dist/shared/{attaform.D4ebpNbS.mjs.map → attaform.CwXXbZIQ.mjs.map} +1 -1
- package/dist/shared/{attaform.B_F61Rx1.mjs → attaform.DK3xUBkj.mjs} +181 -39
- package/dist/shared/attaform.DK3xUBkj.mjs.map +1 -0
- package/dist/shared/{attaform.ByIB7i15.mjs → attaform.DMNnfQq_.mjs} +4 -4
- package/dist/shared/{attaform.ByIB7i15.mjs.map → attaform.DMNnfQq_.mjs.map} +1 -1
- package/dist/shared/{attaform.0zueP54D.d.mts → attaform.DS_zBcdr.d.ts} +124 -56
- package/dist/shared/{attaform.DvqdxvNU.d.mts → attaform.DmKLa4tL.d.cts} +1 -1
- package/dist/shared/{attaform.DgbHNLf_.mjs → attaform.OLtKd9gM.mjs} +2 -2
- package/dist/shared/{attaform.DgbHNLf_.mjs.map → attaform.OLtKd9gM.mjs.map} +1 -1
- package/dist/shared/{attaform.WvcckZMD.mjs → attaform.Vp2-CWZB.mjs} +3 -2
- package/dist/shared/attaform.Vp2-CWZB.mjs.map +1 -0
- package/dist/shared/{attaform.CqlLImc1.cjs → attaform.Xe8dATED.cjs} +4 -4
- package/dist/shared/{attaform.CqlLImc1.cjs.map → attaform.Xe8dATED.cjs.map} +1 -1
- package/dist/shared/{attaform.CjdepGnw.cjs → attaform.ZXZ6dH72.cjs} +3 -1
- package/dist/shared/attaform.ZXZ6dH72.cjs.map +1 -0
- package/dist/shared/{attaform.DUc6cetN.d.cts → attaform.i_LA3X9o.d.cts} +54 -2
- package/dist/shared/{attaform.DUc6cetN.d.ts → attaform.i_LA3X9o.d.mts} +54 -2
- package/dist/shared/{attaform.DUc6cetN.d.mts → attaform.i_LA3X9o.d.ts} +54 -2
- package/dist/shared/{attaform.DwCtxauq.mjs → attaform.k9V0py0s.mjs} +182 -8
- package/dist/shared/attaform.k9V0py0s.mjs.map +1 -0
- package/dist/shared/{attaform.DfnwaGW2.cjs → attaform.sks1MFVO.cjs} +4 -4
- package/dist/shared/{attaform.DfnwaGW2.cjs.map → attaform.sks1MFVO.cjs.map} +1 -1
- package/dist/shared/{attaform.DRWrVSkH.cjs → attaform.xBDo0Ko0.cjs} +2 -2
- package/dist/shared/{attaform.DRWrVSkH.cjs.map → attaform.xBDo0Ko0.cjs.map} +1 -1
- package/dist/transforms.cjs +2 -1
- package/dist/transforms.cjs.map +1 -1
- package/dist/transforms.d.cts +13 -1
- package/dist/transforms.d.mts +13 -1
- package/dist/transforms.d.ts +13 -1
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +2 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +2 -1
- package/dist/vite.mjs.map +1 -1
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +3 -3
- package/dist/zod-v3.d.mts +3 -3
- package/dist/zod-v3.d.ts +3 -3
- package/dist/zod-v3.mjs +2 -2
- package/dist/zod-v4.cjs +2 -2
- package/dist/zod-v4.d.cts +5 -5
- package/dist/zod-v4.d.mts +5 -5
- package/dist/zod-v4.d.ts +5 -5
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +5 -5
- package/dist/zod.d.cts +5 -5
- package/dist/zod.d.mts +5 -5
- package/dist/zod.d.ts +5 -5
- package/dist/zod.mjs +5 -5
- package/package.json +6 -2
- package/dist/shared/attaform.B_F61Rx1.mjs.map +0 -1
- package/dist/shared/attaform.C5qkSN6t.mjs.map +0 -1
- package/dist/shared/attaform.CB1kYKUB.cjs.map +0 -1
- package/dist/shared/attaform.CjdepGnw.cjs.map +0 -1
- package/dist/shared/attaform.DK6_Ctv7.cjs.map +0 -1
- package/dist/shared/attaform.DQcdvxKZ.cjs.map +0 -1
- package/dist/shared/attaform.DwCtxauq.mjs.map +0 -1
- package/dist/shared/attaform.WvcckZMD.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const vue = require('vue');
|
|
4
|
-
const paths = require('./attaform.
|
|
5
|
-
const registerProtocol = require('./attaform.
|
|
4
|
+
const paths = require('./attaform.3heDHayA.cjs');
|
|
5
|
+
const registerProtocol = require('./attaform.ZXZ6dH72.cjs');
|
|
6
6
|
|
|
7
7
|
function safeAssign(target, key, value) {
|
|
8
8
|
if (key === "__proto__") {
|
|
@@ -941,6 +941,15 @@ function buildContainerFieldStateBase(state, segments, key, formInstanceId) {
|
|
|
941
941
|
if (since !== void 0 && (transformingSince === null || since < transformingSince))
|
|
942
942
|
transformingSince = since;
|
|
943
943
|
}
|
|
944
|
+
const ownRecord = state.fields.get(key);
|
|
945
|
+
if (ownRecord !== void 0) {
|
|
946
|
+
if (ownRecord.focused === true) focused = true;
|
|
947
|
+
if (ownRecord.blurred === true) blurred = true;
|
|
948
|
+
if (ownRecord.touched === true) touched = true;
|
|
949
|
+
if (ownRecord.interacted === true) interacted = true;
|
|
950
|
+
if (ownRecord.blurredAfterInteraction === true) blurredAfterInteraction = true;
|
|
951
|
+
if (ownRecord.connected === true) connected = true;
|
|
952
|
+
}
|
|
944
953
|
const ownTransformError = state.transformErrors.get(key) ?? null;
|
|
945
954
|
const gated = asyncPending && !state.firstValidationDone.value;
|
|
946
955
|
const valid = !gated && errors.length === 0 && !validating;
|
|
@@ -2011,11 +2020,11 @@ function applyInvalidSubmitPolicy(state, formInstanceId, policy) {
|
|
|
2011
2020
|
return;
|
|
2012
2021
|
}
|
|
2013
2022
|
if (policy === "focus-first-error") {
|
|
2014
|
-
target.element.focus();
|
|
2023
|
+
target.element.focus({ focusVisible: true });
|
|
2015
2024
|
return;
|
|
2016
2025
|
}
|
|
2017
2026
|
target.element.scrollIntoView();
|
|
2018
|
-
target.element.focus({ preventScroll: true });
|
|
2027
|
+
target.element.focus({ preventScroll: true, focusVisible: true });
|
|
2019
2028
|
}
|
|
2020
2029
|
|
|
2021
2030
|
const warnedRejections = paths.__DEV__ ? /* @__PURE__ */ new WeakMap() : null;
|
|
@@ -2286,6 +2295,7 @@ function coerceValue(value, accepted, elementAccepted, index) {
|
|
|
2286
2295
|
return coerceScalar(value, accepted, index);
|
|
2287
2296
|
}
|
|
2288
2297
|
|
|
2298
|
+
const warnedMultiRootHosts = /* @__PURE__ */ new Set();
|
|
2289
2299
|
const EMPTY_TRANSFORMS = Object.freeze([]);
|
|
2290
2300
|
const attaformListenersSymbol = Symbol.for("attaform:focus-listeners");
|
|
2291
2301
|
function attachFocusListeners(state, segments, element, instanceMeta) {
|
|
@@ -2390,6 +2400,24 @@ function buildRegister(state, formInstanceId, instanceConfig) {
|
|
|
2390
2400
|
setValueWithInternalPath: (value, meta) => {
|
|
2391
2401
|
return state.setValueAtPath(segments, value, withInstanceMeta(meta));
|
|
2392
2402
|
},
|
|
2403
|
+
setValueFromHost: (value) => {
|
|
2404
|
+
state.markInteracted(segments);
|
|
2405
|
+
const accepted = state.setValueAtPath(segments, value, withInstanceMeta(void 0));
|
|
2406
|
+
if (paths.__DEV__) {
|
|
2407
|
+
const dedupeKey = `${formInstanceId}:${pathKey}`;
|
|
2408
|
+
const isWired = () => (state.elements.get(pathKey)?.elements.size ?? 0) > 0 || state.getFieldRecord(segments)?.connected === true;
|
|
2409
|
+
if (!warnedMultiRootHosts.has(dedupeKey) && !isWired()) {
|
|
2410
|
+
warnedMultiRootHosts.add(dedupeKey);
|
|
2411
|
+
void vue.nextTick(() => {
|
|
2412
|
+
if (isWired()) return;
|
|
2413
|
+
vue.warn(
|
|
2414
|
+
`[attaform] v-register received a value update from a component it never attached to. Vue drops a runtime directive on a component with more than one root node (a fragment / multi-root template), so v-register's value binding works but its field state (connected, focus, aria, scroll-to-error) does not. Give the component a single element root, or wrap it so v-register lands on one element.`
|
|
2415
|
+
);
|
|
2416
|
+
});
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
return accepted;
|
|
2420
|
+
},
|
|
2393
2421
|
// Called by the `vRegisterHint` compile-time transform's wrapping
|
|
2394
2422
|
// IIFE on every server-side render of `<element v-register="…">`.
|
|
2395
2423
|
// Without it, every SSR'd FieldState serialises `connected: false`
|
|
@@ -2401,6 +2429,24 @@ function buildRegister(state, formInstanceId, instanceConfig) {
|
|
|
2401
2429
|
markConnectedOptimistically: () => {
|
|
2402
2430
|
state.markConnectedOptimistically(segments);
|
|
2403
2431
|
},
|
|
2432
|
+
markHostConnected: (connected) => {
|
|
2433
|
+
state.markHostConnected(segments, connected);
|
|
2434
|
+
},
|
|
2435
|
+
markFocused: (focused) => {
|
|
2436
|
+
state.markFocused(
|
|
2437
|
+
segments,
|
|
2438
|
+
focused,
|
|
2439
|
+
instanceMeta !== void 0 ? { instance: instanceMeta } : void 0
|
|
2440
|
+
);
|
|
2441
|
+
},
|
|
2442
|
+
hasRegisteredDescendant: (hostElement) => {
|
|
2443
|
+
const record = state.elements.get(pathKey);
|
|
2444
|
+
if (record === void 0) return false;
|
|
2445
|
+
for (const element of record.elements) {
|
|
2446
|
+
if (hostElement.contains(element)) return true;
|
|
2447
|
+
}
|
|
2448
|
+
return false;
|
|
2449
|
+
},
|
|
2404
2450
|
// --- Async transform lifecycle (internal; the directive's
|
|
2405
2451
|
// deferred orchestrator is the only legitimate consumer). Thin
|
|
2406
2452
|
// path-bound delegates to the store's per-path token / counter
|
|
@@ -3183,7 +3229,7 @@ function buildFormApi(state, formInstanceId, options = {}) {
|
|
|
3183
3229
|
const focusFirstError = (options2) => {
|
|
3184
3230
|
const target = state.getFirstErrorElement(formInstanceId);
|
|
3185
3231
|
if (target === null) return false;
|
|
3186
|
-
target.element.focus(options2);
|
|
3232
|
+
target.element.focus({ focusVisible: true, ...options2 });
|
|
3187
3233
|
return true;
|
|
3188
3234
|
};
|
|
3189
3235
|
const scrollToFirstError = (options2) => {
|
|
@@ -4974,6 +5020,21 @@ function createFormStore(options) {
|
|
|
4974
5020
|
blurred: current?.blurred ?? true
|
|
4975
5021
|
});
|
|
4976
5022
|
}
|
|
5023
|
+
function markHostConnected(path, connected) {
|
|
5024
|
+
const { key } = paths.canonicalizePath(path);
|
|
5025
|
+
const current = fields.get(key);
|
|
5026
|
+
if (connected) {
|
|
5027
|
+
if (current?.connected === true) return;
|
|
5028
|
+
touchFieldRecord(key, path, {
|
|
5029
|
+
connected: true,
|
|
5030
|
+
focused: current?.focused ?? false,
|
|
5031
|
+
blurred: current?.blurred ?? true
|
|
5032
|
+
});
|
|
5033
|
+
} else {
|
|
5034
|
+
if (current?.connected !== true) return;
|
|
5035
|
+
touchFieldRecord(key, path, { connected: false, focused: null, blurred: null });
|
|
5036
|
+
}
|
|
5037
|
+
}
|
|
4977
5038
|
function markFocused(path, focused, meta) {
|
|
4978
5039
|
const { key } = paths.canonicalizePath(path);
|
|
4979
5040
|
const current = fields.get(key);
|
|
@@ -5305,10 +5366,7 @@ function createFormStore(options) {
|
|
|
5305
5366
|
if (elementToFormInstance.get(entry.element) !== formInstanceId) continue;
|
|
5306
5367
|
if (!entry.element.isConnected) continue;
|
|
5307
5368
|
if (entry.element.offsetParent === null) continue;
|
|
5308
|
-
|
|
5309
|
-
const hasSchemaErr = (schemaErrors.get(key)?.length ?? 0) > 0;
|
|
5310
|
-
const hasUserErr = (userErrors.get(key)?.length ?? 0) > 0;
|
|
5311
|
-
if (!hasSchemaErr && !hasUserErr) continue;
|
|
5369
|
+
if (getErrorsForPath(entry.path).length === 0) continue;
|
|
5312
5370
|
return { path: entry.path, element: entry.element };
|
|
5313
5371
|
}
|
|
5314
5372
|
return null;
|
|
@@ -5383,6 +5441,7 @@ function createFormStore(options) {
|
|
|
5383
5441
|
markInteracted,
|
|
5384
5442
|
touchAtPath,
|
|
5385
5443
|
markConnectedOptimistically,
|
|
5444
|
+
markHostConnected,
|
|
5386
5445
|
isPristineAtPath,
|
|
5387
5446
|
isPristineAtPathByKey,
|
|
5388
5447
|
hasStructuralChangeUnder,
|
|
@@ -5887,7 +5946,7 @@ function resolveState(key, registry) {
|
|
|
5887
5946
|
if (key !== void 0) {
|
|
5888
5947
|
const stored = registry.forms.get(key);
|
|
5889
5948
|
if (stored === void 0) {
|
|
5890
|
-
warnMiss$1(`no form registered for key '${key}'`, registry.ssr);
|
|
5949
|
+
warnMiss$1(`no form registered for key '${key}'`, registry.ssr, registry.forms);
|
|
5891
5950
|
return null;
|
|
5892
5951
|
}
|
|
5893
5952
|
return stored;
|
|
@@ -5897,12 +5956,22 @@ function resolveState(key, registry) {
|
|
|
5897
5956
|
warnIfAmbientProviderHadDuplicates();
|
|
5898
5957
|
return ambient;
|
|
5899
5958
|
}
|
|
5900
|
-
function
|
|
5959
|
+
function availableKeysHint$1(forms) {
|
|
5960
|
+
const addressable = [...forms.keys()].filter((key) => !key.startsWith(RESERVED_KEY_PREFIX));
|
|
5961
|
+
if (addressable.length === 0) return void 0;
|
|
5962
|
+
return `Registered keys: ${addressable.map((key) => `'${key}'`).join(", ")}.`;
|
|
5963
|
+
}
|
|
5964
|
+
function warnMiss$1(detail, ssr, forms) {
|
|
5901
5965
|
if (!paths.__DEV__ || ssr) return;
|
|
5902
5966
|
const frame = captureUserCallSite();
|
|
5903
|
-
|
|
5904
|
-
|
|
5967
|
+
const parts = [`[attaform] injectForm: ${detail}. Returning null.`];
|
|
5968
|
+
const keys = availableKeysHint$1(forms);
|
|
5969
|
+
if (keys !== void 0) parts.push(keys);
|
|
5970
|
+
parts.push(
|
|
5971
|
+
`A form created by a child or sibling component is not registered until that component's own setup runs, which happens after this point. Lift its useForm({ key }) call to a common ancestor, or read the form after mount.`
|
|
5905
5972
|
);
|
|
5973
|
+
if (frame !== void 0) parts.push(frame);
|
|
5974
|
+
console.warn(parts.join(" "));
|
|
5906
5975
|
}
|
|
5907
5976
|
function warnIfAmbientProviderHadDuplicates() {
|
|
5908
5977
|
if (!paths.__DEV__ || ambientProvideHistory === null) return;
|
|
@@ -5981,6 +6050,8 @@ function useRegister() {
|
|
|
5981
6050
|
}
|
|
5982
6051
|
}
|
|
5983
6052
|
if ("value" in rawAttrs) delete rawAttrs["value"];
|
|
6053
|
+
if ("modelValue" in rawAttrs) delete rawAttrs["modelValue"];
|
|
6054
|
+
if ("onUpdate:modelValue" in rawAttrs) delete rawAttrs["onUpdate:modelValue"];
|
|
5984
6055
|
};
|
|
5985
6056
|
refreshAndStripBridgeAttrs();
|
|
5986
6057
|
vue.onBeforeMount(refreshAndStripBridgeAttrs);
|
|
@@ -6160,6 +6231,9 @@ function asStatusSource(form) {
|
|
|
6160
6231
|
function asSubmissionSource(form) {
|
|
6161
6232
|
return form;
|
|
6162
6233
|
}
|
|
6234
|
+
function asHandleSubmitSource(form) {
|
|
6235
|
+
return form;
|
|
6236
|
+
}
|
|
6163
6237
|
function useWizard(options) {
|
|
6164
6238
|
const rawSteps = Array.isArray(options.steps) ? options.steps : [];
|
|
6165
6239
|
if (rawSteps.length === 0 && paths.__DEV__) {
|
|
@@ -6254,6 +6328,7 @@ function useWizard(options) {
|
|
|
6254
6328
|
}
|
|
6255
6329
|
};
|
|
6256
6330
|
function resolveSlot(slot, index, ctx) {
|
|
6331
|
+
if (slot === void 0 || slot === null) return void 0;
|
|
6257
6332
|
if (typeof slot === "string") {
|
|
6258
6333
|
return getOrBuildNoop(slot);
|
|
6259
6334
|
}
|
|
@@ -6269,7 +6344,7 @@ function useWizard(options) {
|
|
|
6269
6344
|
return void 0;
|
|
6270
6345
|
}
|
|
6271
6346
|
function resolveSlotResult(result) {
|
|
6272
|
-
if (result === void 0) return void 0;
|
|
6347
|
+
if (result === void 0 || result === null) return void 0;
|
|
6273
6348
|
if (typeof result === "string") {
|
|
6274
6349
|
return getOrBuildNoop(result);
|
|
6275
6350
|
}
|
|
@@ -6337,6 +6412,50 @@ function useWizard(options) {
|
|
|
6337
6412
|
const first = list[0];
|
|
6338
6413
|
return first === void 0 ? void 0 : first.form;
|
|
6339
6414
|
});
|
|
6415
|
+
vue.watch(compiledSteps, (list, prevList) => {
|
|
6416
|
+
const key = activeKey.value;
|
|
6417
|
+
if (key === "") return;
|
|
6418
|
+
if (list.some((step) => step.key === key)) return;
|
|
6419
|
+
if (list.length === 0) {
|
|
6420
|
+
activeKey.value = "";
|
|
6421
|
+
return;
|
|
6422
|
+
}
|
|
6423
|
+
const oldIndex = prevList.findIndex((step) => step.key === key);
|
|
6424
|
+
const slid = list[oldIndex < 0 ? 0 : Math.min(oldIndex, list.length - 1)];
|
|
6425
|
+
if (slid !== void 0) activeKey.value = slid.key;
|
|
6426
|
+
});
|
|
6427
|
+
const activeFormFacade = new Proxy({}, {
|
|
6428
|
+
get(_target, prop) {
|
|
6429
|
+
const form = activeForm.value;
|
|
6430
|
+
if (form === void 0) return void 0;
|
|
6431
|
+
if (prop === "handleSubmit") {
|
|
6432
|
+
const lateBound = (onValid, onInvalid) => {
|
|
6433
|
+
return (event) => {
|
|
6434
|
+
const current = activeForm.value;
|
|
6435
|
+
if (current === void 0) return Promise.resolve();
|
|
6436
|
+
return asHandleSubmitSource(current).handleSubmit(onValid, onInvalid)(event);
|
|
6437
|
+
};
|
|
6438
|
+
};
|
|
6439
|
+
return lateBound;
|
|
6440
|
+
}
|
|
6441
|
+
return Reflect.get(form, prop, form);
|
|
6442
|
+
},
|
|
6443
|
+
has(_target, prop) {
|
|
6444
|
+
const form = activeForm.value;
|
|
6445
|
+
return form === void 0 ? false : Reflect.has(form, prop);
|
|
6446
|
+
},
|
|
6447
|
+
ownKeys(_target) {
|
|
6448
|
+
const form = activeForm.value;
|
|
6449
|
+
return form === void 0 ? [] : Reflect.ownKeys(form);
|
|
6450
|
+
},
|
|
6451
|
+
getOwnPropertyDescriptor(_target, prop) {
|
|
6452
|
+
const form = activeForm.value;
|
|
6453
|
+
if (form === void 0) return void 0;
|
|
6454
|
+
const descriptor = Reflect.getOwnPropertyDescriptor(form, prop);
|
|
6455
|
+
if (descriptor === void 0) return void 0;
|
|
6456
|
+
return { ...descriptor, configurable: true };
|
|
6457
|
+
}
|
|
6458
|
+
});
|
|
6340
6459
|
const isFinalStep = vue.computed(() => {
|
|
6341
6460
|
const list = compiledSteps.value;
|
|
6342
6461
|
const idx = activeIndex.value;
|
|
@@ -6701,6 +6820,39 @@ function useWizard(options) {
|
|
|
6701
6820
|
const target = list[idx + 1];
|
|
6702
6821
|
moveTo(target.key);
|
|
6703
6822
|
}
|
|
6823
|
+
async function tryNext() {
|
|
6824
|
+
if (submitting.value) {
|
|
6825
|
+
if (paths.__DEV__) {
|
|
6826
|
+
console.warn(`[attaform] wizard.tryNext(): blocked while a submit is in flight.`);
|
|
6827
|
+
}
|
|
6828
|
+
return false;
|
|
6829
|
+
}
|
|
6830
|
+
const list = compiledSteps.value;
|
|
6831
|
+
if (list.length === 0) {
|
|
6832
|
+
if (paths.__DEV__) {
|
|
6833
|
+
console.warn(`[attaform] wizard.tryNext(): wizard has no compiled steps; no-op.`);
|
|
6834
|
+
}
|
|
6835
|
+
return false;
|
|
6836
|
+
}
|
|
6837
|
+
const idx = activeIndex.value;
|
|
6838
|
+
if (idx < 0 || idx >= list.length - 1) {
|
|
6839
|
+
if (paths.__DEV__) {
|
|
6840
|
+
console.warn(
|
|
6841
|
+
`[attaform] wizard.tryNext(): already on the final step ("${activeKey.value}"). Use wizard.handleSubmit() to submit.`
|
|
6842
|
+
);
|
|
6843
|
+
}
|
|
6844
|
+
return false;
|
|
6845
|
+
}
|
|
6846
|
+
const form = activeForm.value;
|
|
6847
|
+
if (form === void 0) return false;
|
|
6848
|
+
let advanced = false;
|
|
6849
|
+
await asHandleSubmitSource(form).handleSubmit(() => {
|
|
6850
|
+
const before = activeKey.value;
|
|
6851
|
+
next();
|
|
6852
|
+
advanced = activeKey.value !== before;
|
|
6853
|
+
})();
|
|
6854
|
+
return advanced;
|
|
6855
|
+
}
|
|
6704
6856
|
function back() {
|
|
6705
6857
|
if (submitting.value) {
|
|
6706
6858
|
if (paths.__DEV__) {
|
|
@@ -6837,20 +6989,13 @@ function useWizard(options) {
|
|
|
6837
6989
|
const final = isFinalStep.value;
|
|
6838
6990
|
const list = compiledSteps.value;
|
|
6839
6991
|
const results = /* @__PURE__ */ new Map();
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
);
|
|
6848
|
-
} else {
|
|
6849
|
-
const active = activeForm.value;
|
|
6850
|
-
registry.forms.get(active.key)?.clearUserErrors();
|
|
6851
|
-
const result = await processOne(active);
|
|
6852
|
-
results.set(active.key, result);
|
|
6853
|
-
}
|
|
6992
|
+
await Promise.all(
|
|
6993
|
+
list.map(async (step) => {
|
|
6994
|
+
registry.forms.get(step.key)?.clearUserErrors();
|
|
6995
|
+
const result = await processOne(step.form);
|
|
6996
|
+
results.set(step.key, result);
|
|
6997
|
+
})
|
|
6998
|
+
);
|
|
6854
6999
|
for (const key of results.keys()) {
|
|
6855
7000
|
const store = registry.forms.get(key);
|
|
6856
7001
|
if (store !== void 0) {
|
|
@@ -6885,14 +7030,7 @@ function useWizard(options) {
|
|
|
6885
7030
|
}
|
|
6886
7031
|
return;
|
|
6887
7032
|
}
|
|
6888
|
-
|
|
6889
|
-
done.value = true;
|
|
6890
|
-
} else {
|
|
6891
|
-
recordDeparture(currentKey);
|
|
6892
|
-
const idx = activeIndex.value;
|
|
6893
|
-
const target = list[idx + 1];
|
|
6894
|
-
if (target !== void 0) moveTo(target.key);
|
|
6895
|
-
}
|
|
7033
|
+
done.value = true;
|
|
6896
7034
|
} else {
|
|
6897
7035
|
await focusFirstWizardError(errors);
|
|
6898
7036
|
if (onError !== void 0) {
|
|
@@ -6942,13 +7080,14 @@ function useWizard(options) {
|
|
|
6942
7080
|
next,
|
|
6943
7081
|
back,
|
|
6944
7082
|
goTo,
|
|
7083
|
+
tryNext,
|
|
6945
7084
|
handleSubmit,
|
|
6946
7085
|
reset,
|
|
6947
7086
|
get currentStep() {
|
|
6948
7087
|
return currentStep.value;
|
|
6949
7088
|
},
|
|
6950
7089
|
get activeForm() {
|
|
6951
|
-
return activeForm.value;
|
|
7090
|
+
return activeForm.value === void 0 ? void 0 : activeFormFacade;
|
|
6952
7091
|
},
|
|
6953
7092
|
get activeIndex() {
|
|
6954
7093
|
return activeIndex.value;
|
|
@@ -7080,6 +7219,9 @@ function warnMiss(detail, ssr, hint) {
|
|
|
7080
7219
|
const frame = captureUserCallSite();
|
|
7081
7220
|
const parts = [`[attaform] injectWizard: ${detail}. Returning null.`];
|
|
7082
7221
|
if (hint !== void 0) parts.push(hint);
|
|
7222
|
+
parts.push(
|
|
7223
|
+
`A wizard created by a child or sibling component is not registered until that component's own setup runs, which happens after this point. Lift its useWizard({ key }) call to a common ancestor, or read the wizard after mount.`
|
|
7224
|
+
);
|
|
7083
7225
|
if (frame !== void 0) parts.push(frame);
|
|
7084
7226
|
console.warn(parts.join(" "));
|
|
7085
7227
|
}
|
|
@@ -7122,4 +7264,4 @@ exports.unset = unset;
|
|
|
7122
7264
|
exports.useAbstractForm = useAbstractForm;
|
|
7123
7265
|
exports.useRegister = useRegister;
|
|
7124
7266
|
exports.useWizard = useWizard;
|
|
7125
|
-
//# sourceMappingURL=attaform.
|
|
7267
|
+
//# sourceMappingURL=attaform.BkUzunyB.cjs.map
|