attaform 0.25.0 → 0.26.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 +3 -3
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +3 -3
- 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.CO0e7YVY.d.cts → attaform.55hFR_cl.d.ts} +3 -0
- package/dist/shared/{attaform.BJt4ZCkM.d.mts → attaform.B71rfNL5.d.mts} +1 -1
- package/dist/shared/{attaform.DmKLa4tL.d.cts → attaform.BFfY7HRI.d.cts} +1 -1
- package/dist/shared/{attaform.3heDHayA.cjs → attaform.BPl-ECRT.cjs} +25 -1
- package/dist/shared/attaform.BPl-ECRT.cjs.map +1 -0
- package/dist/shared/{attaform.B5YcWrKi.cjs → attaform.BQflyVOL.cjs} +3 -3
- package/dist/shared/{attaform.B5YcWrKi.cjs.map → attaform.BQflyVOL.cjs.map} +1 -1
- package/dist/shared/{attaform.B3cgZE3c.d.ts → attaform.Be5otUVw.d.ts} +1 -1
- package/dist/shared/{attaform.DK3xUBkj.mjs → attaform.BoYqnIPI.mjs} +109 -45
- package/dist/shared/attaform.BoYqnIPI.mjs.map +1 -0
- package/dist/shared/{attaform.B5GFS3Su.d.cts → attaform.CEY_WLRJ.d.mts} +12 -1
- package/dist/shared/{attaform.DMNnfQq_.mjs → attaform.CSXDW2tO.mjs} +4 -4
- package/dist/shared/{attaform.DMNnfQq_.mjs.map → attaform.CSXDW2tO.mjs.map} +1 -1
- package/dist/shared/{attaform.CwXXbZIQ.mjs → attaform.CXVmZtFq.mjs} +3 -3
- package/dist/shared/{attaform.CwXXbZIQ.mjs.map → attaform.CXVmZtFq.mjs.map} +1 -1
- package/dist/shared/{attaform.sks1MFVO.cjs → attaform.Cs0UZ7q6.cjs} +4 -4
- package/dist/shared/{attaform.sks1MFVO.cjs.map → attaform.Cs0UZ7q6.cjs.map} +1 -1
- package/dist/shared/{attaform.xBDo0Ko0.cjs → attaform.D51IwDtP.cjs} +2 -2
- package/dist/shared/{attaform.xBDo0Ko0.cjs.map → attaform.D51IwDtP.cjs.map} +1 -1
- package/dist/shared/{attaform.i_LA3X9o.d.cts → attaform.DBNjHgNj.d.cts} +70 -15
- package/dist/shared/{attaform.i_LA3X9o.d.mts → attaform.DBNjHgNj.d.mts} +70 -15
- package/dist/shared/{attaform.i_LA3X9o.d.ts → attaform.DBNjHgNj.d.ts} +70 -15
- package/dist/shared/{attaform.CqwcTExO.mjs → attaform.DGhIix5D.mjs} +24 -2
- package/dist/shared/attaform.DGhIix5D.mjs.map +1 -0
- package/dist/shared/{attaform.CO0e7YVY.d.mts → attaform.DJRz_bzM.d.cts} +3 -0
- package/dist/shared/{attaform.CN4ZEGo6.mjs → attaform.DSOIz08n.mjs} +4 -4
- package/dist/shared/{attaform.CN4ZEGo6.mjs.map → attaform.DSOIz08n.mjs.map} +1 -1
- package/dist/shared/{attaform.BkUzunyB.cjs → attaform.Du9RZp8m.cjs} +109 -45
- package/dist/shared/attaform.Du9RZp8m.cjs.map +1 -0
- package/dist/shared/{attaform.CO0e7YVY.d.ts → attaform.JPsaqjLl.d.mts} +3 -0
- package/dist/shared/{attaform.8vmdOURQ.d.mts → attaform.MgaYKlPP.d.cts} +12 -1
- package/dist/shared/{attaform.OLtKd9gM.mjs → attaform.NqYEzRcM.mjs} +2 -2
- package/dist/shared/{attaform.OLtKd9gM.mjs.map → attaform.NqYEzRcM.mjs.map} +1 -1
- package/dist/shared/{attaform.DS_zBcdr.d.ts → attaform.ceYeVkjn.d.ts} +12 -1
- package/dist/shared/{attaform.Xe8dATED.cjs → attaform.tZ0YKisf.cjs} +4 -4
- package/dist/shared/{attaform.Xe8dATED.cjs.map → attaform.tZ0YKisf.cjs.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 +6 -6
- package/dist/zod-v4.d.mts +6 -6
- package/dist/zod-v4.d.ts +6 -6
- 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 +1 -1
- package/dist/shared/attaform.3heDHayA.cjs.map +0 -1
- package/dist/shared/attaform.BkUzunyB.cjs.map +0 -1
- package/dist/shared/attaform.CqwcTExO.mjs.map +0 -1
- package/dist/shared/attaform.DK3xUBkj.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, u as FlatPath, O as NestedType, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType } from './attaform.
|
|
2
|
+
import { G as GenericForm, u as FlatPath, O as NestedType, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType } from './attaform.DBNjHgNj.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The shape `form.values.<key>` returns at runtime.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed, ref, watchEffect, getCurrentScope, onScopeDispose, shallowReadonly, nextTick, warn, readonly, toRaw, reactive, watch, markRaw, triggerRef, shallowRef, getCurrentInstance, onServerPrefetch, provide, useId, inject, onBeforeMount, onBeforeUpdate, onMounted, effectScope } from 'vue';
|
|
2
|
-
import { n as pathsEqual, j as isPathPrefix, _ as __DEV__, f as canonicalizePath, s as segmentsForPathKey, o as keyForSegments, b as ROOT_PATH_KEY, S as SubmitErrorHandlerError, t as toError, q as INTERACTIVE_TAG_NAMES, R as ROOT_PATH,
|
|
2
|
+
import { n as pathsEqual, j as isPathPrefix, _ as __DEV__, f as canonicalizePath, s as segmentsForPathKey, o as keyForSegments, b as ROOT_PATH_KEY, S as SubmitErrorHandlerError, t as toError, q as normalizeErrorInput, r as INTERACTIVE_TAG_NAMES, R as ROOT_PATH, w as normalizeErrorInputs, x as coerceToPathKey, a as InvalidUseFormConfigError, y as ensureAttaformInstalled, u as useRegistry, z as kFormContext, B as kFormInstanceId, d as ReservedFormKeyError, l as kAttaformWizardActiveStepResolver, C as kAttaformAncestorWizard } from './attaform.DGhIix5D.mjs';
|
|
3
3
|
import { R as REGISTER_OWNER_MARKER, b as V_REGISTER_MARKER } from './attaform.Vp2-CWZB.mjs';
|
|
4
4
|
|
|
5
5
|
function safeAssign(target, key, value) {
|
|
@@ -582,7 +582,18 @@ const AttaformErrorCode = {
|
|
|
582
582
|
* produced `ValidationError` carrying a stable, branchable identifier.
|
|
583
583
|
* Override it per error by passing your own `code` (`api:…`, `auth:…`).
|
|
584
584
|
*/
|
|
585
|
-
UserError: "atta:user-error"
|
|
585
|
+
UserError: "atta:user-error",
|
|
586
|
+
/**
|
|
587
|
+
* Stamped on a `ValidationError` synthesized from a throw or rejection
|
|
588
|
+
* out of a `handleSubmit` `onSubmit` callback. The raw error also lands
|
|
589
|
+
* on `form.meta.submitError` (a raw-`Error` inspection channel); this
|
|
590
|
+
* code marks the copy piped into the user-error layer so the failure
|
|
591
|
+
* also surfaces on `form.errors` / `meta.ownErrors` / `firstOwnError`
|
|
592
|
+
* where the UI already reads. A throw carrying its own `path` / `code`
|
|
593
|
+
* keeps them; a bare `Error` or a non-Error throw defaults here at the
|
|
594
|
+
* form-level path `[]`.
|
|
595
|
+
*/
|
|
596
|
+
SubmitError: "atta:submit-error"
|
|
586
597
|
};
|
|
587
598
|
function makeBlankRequiredError(segments, formKey) {
|
|
588
599
|
return {
|
|
@@ -790,6 +801,11 @@ function buildLeafFieldStateBase(state, segments, key, formInstanceId) {
|
|
|
790
801
|
elements: elementsArr,
|
|
791
802
|
updatedAt: record?.updatedAt ?? null,
|
|
792
803
|
errors,
|
|
804
|
+
// A leaf has no descendants, so its own-bucket errors ARE its subtree
|
|
805
|
+
// errors. Reuse the same array reference: referential `ownErrors ===
|
|
806
|
+
// errors`, and no second read of the whole-form `derivedBlankErrors`
|
|
807
|
+
// map (preserves the P3 blank-reactivity optimization above).
|
|
808
|
+
ownErrors: errors,
|
|
793
809
|
validating,
|
|
794
810
|
valid,
|
|
795
811
|
transforming,
|
|
@@ -968,6 +984,12 @@ function buildContainerFieldStateBase(state, segments, key, formInstanceId) {
|
|
|
968
984
|
elements: EMPTY_ELEMENTS,
|
|
969
985
|
updatedAt,
|
|
970
986
|
errors,
|
|
987
|
+
// The container's OWN bucket only (this exact path), excluding every
|
|
988
|
+
// descendant that `errors` rolls up: a cross-field `.refine()` here,
|
|
989
|
+
// or `setErrors` pinned at this node. The same raw union the leaf
|
|
990
|
+
// builds from the three stores; the container already depends on all
|
|
991
|
+
// three via `aggregateErrorsAt`, so there's no new reactivity cost.
|
|
992
|
+
ownErrors: state.getErrorsForPath(segments),
|
|
971
993
|
validating,
|
|
972
994
|
valid,
|
|
973
995
|
transforming,
|
|
@@ -1006,6 +1028,7 @@ function buildContainerFieldState(state, segments, key, formInstanceId, getFormM
|
|
|
1006
1028
|
}
|
|
1007
1029
|
function decorateWithDerivedProps(base, state, getFormMetaBase, key, validatingSince, transformingSince, revealedDescendantError, isRoot, getDisplayState) {
|
|
1008
1030
|
const firstError = base.errors[0];
|
|
1031
|
+
const firstOwnError = base.ownErrors[0];
|
|
1009
1032
|
const predicate = getDisplayState ?? state.getDisplayState;
|
|
1010
1033
|
const formMeta = getFormMetaBase();
|
|
1011
1034
|
const ctx = {
|
|
@@ -1041,7 +1064,8 @@ function decorateWithDerivedProps(base, state, getFormMetaBase, key, validatingS
|
|
|
1041
1064
|
showPending: displayState === "pending",
|
|
1042
1065
|
showSuccess: displayState === "success",
|
|
1043
1066
|
showIdle: displayState === "idle",
|
|
1044
|
-
firstError
|
|
1067
|
+
firstError,
|
|
1068
|
+
firstOwnError
|
|
1045
1069
|
};
|
|
1046
1070
|
}
|
|
1047
1071
|
function aggregateErrorsAt(state, prefix) {
|
|
@@ -1410,17 +1434,15 @@ function buildErrorsProxy(state) {
|
|
|
1410
1434
|
// shared `aggregateErrorsAt` helper that `form.meta.errors` and
|
|
1411
1435
|
// `form.fields(path).errors` also use, so the surfaces never drift.
|
|
1412
1436
|
//
|
|
1413
|
-
// The root is
|
|
1414
|
-
//
|
|
1415
|
-
//
|
|
1416
|
-
//
|
|
1417
|
-
//
|
|
1418
|
-
//
|
|
1419
|
-
|
|
1420
|
-
resolveCallTarget: (path) => path.length === 0 ? state.getErrorsForPath([]) : aggregateErrorsAt(state, path),
|
|
1437
|
+
// The root is uniform with every other path: `errors([])` is the
|
|
1438
|
+
// subtree aggregate at `[]`, which is the whole form, identical to
|
|
1439
|
+
// the no-arg `errors()` and to `meta.errors`. The root `[]` bucket
|
|
1440
|
+
// alone (root `.refine()`, hydration failures, path-less
|
|
1441
|
+
// `setErrors`) is read through `meta.ownErrors` / `meta.firstOwnError`,
|
|
1442
|
+
// the dedicated own-bucket accessor, not a call-form carve-out.
|
|
1443
|
+
resolveCallTarget: (path) => aggregateErrorsAt(state, path),
|
|
1421
1444
|
// No-arg `errors()` = the whole-form aggregate, matching
|
|
1422
|
-
// `meta.errors
|
|
1423
|
-
// see `resolveCallTarget`.
|
|
1445
|
+
// `meta.errors` and `errors([])`. All three are the same aggregate.
|
|
1424
1446
|
resolveRootCall: () => aggregateErrorsAt(state, []),
|
|
1425
1447
|
// Enumeration unions the live form-data keys at this path with the
|
|
1426
1448
|
// first-child segments drawn from every error store. Without the
|
|
@@ -1604,6 +1626,7 @@ const FIELD_STATE_KEYS = /* @__PURE__ */ new Set([
|
|
|
1604
1626
|
"elements",
|
|
1605
1627
|
"updatedAt",
|
|
1606
1628
|
"errors",
|
|
1629
|
+
"ownErrors",
|
|
1607
1630
|
"validating",
|
|
1608
1631
|
"valid",
|
|
1609
1632
|
"transforming",
|
|
@@ -1615,6 +1638,7 @@ const FIELD_STATE_KEYS = /* @__PURE__ */ new Set([
|
|
|
1615
1638
|
"showSuccess",
|
|
1616
1639
|
"showIdle",
|
|
1617
1640
|
"firstError",
|
|
1641
|
+
"firstOwnError",
|
|
1618
1642
|
"path",
|
|
1619
1643
|
"id",
|
|
1620
1644
|
"aria",
|
|
@@ -1756,6 +1780,32 @@ function walk$1(value, basePath, schema, snapshotFieldStateAt) {
|
|
|
1756
1780
|
}
|
|
1757
1781
|
|
|
1758
1782
|
const warnedNoScopeStores = __DEV__ ? /* @__PURE__ */ new WeakSet() : null;
|
|
1783
|
+
function isErrorInputLike(value) {
|
|
1784
|
+
if (value instanceof Error) return true;
|
|
1785
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1786
|
+
const shape = value;
|
|
1787
|
+
return typeof shape.message === "string" && shape.message.length > 0 || Array.isArray(shape.path);
|
|
1788
|
+
}
|
|
1789
|
+
function deriveSubmitErrors(err, formKey) {
|
|
1790
|
+
if (Array.isArray(err) && err.length > 0 && err.every(isErrorInputLike)) {
|
|
1791
|
+
return {
|
|
1792
|
+
entries: err.map(
|
|
1793
|
+
(item) => normalizeErrorInput(item, void 0, formKey, AttaformErrorCode.SubmitError)
|
|
1794
|
+
),
|
|
1795
|
+
messageless: false
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
if (isErrorInputLike(err)) {
|
|
1799
|
+
return {
|
|
1800
|
+
entries: [normalizeErrorInput(err, void 0, formKey, AttaformErrorCode.SubmitError)],
|
|
1801
|
+
messageless: false
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
return {
|
|
1805
|
+
entries: [normalizeErrorInput({}, void 0, formKey, AttaformErrorCode.SubmitError)],
|
|
1806
|
+
messageless: true
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1759
1809
|
function buildProcessForm(state, formInstanceId, options = {}) {
|
|
1760
1810
|
const invalidPolicy = options.onInvalidSubmit ?? "focus-first-error";
|
|
1761
1811
|
function validate(pathInput) {
|
|
@@ -1937,13 +1987,6 @@ function buildProcessForm(state, formInstanceId, options = {}) {
|
|
|
1937
1987
|
if (state.submissionGeneration.value === genAtEntry) {
|
|
1938
1988
|
applyInvalidSubmitPolicy(state, formInstanceId, invalidPolicy);
|
|
1939
1989
|
}
|
|
1940
|
-
if (onError !== void 0) {
|
|
1941
|
-
try {
|
|
1942
|
-
await onError(Array.from(state.userErrors.values()).flat());
|
|
1943
|
-
} catch (cause) {
|
|
1944
|
-
throw new SubmitErrorHandlerError("User-provided onError threw", { cause });
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
1990
|
return;
|
|
1948
1991
|
}
|
|
1949
1992
|
if (state.submissionGeneration.value === genAtEntry) {
|
|
@@ -1953,6 +1996,25 @@ function buildProcessForm(state, formInstanceId, options = {}) {
|
|
|
1953
1996
|
} catch (err) {
|
|
1954
1997
|
if (state.submissionGeneration.value === genAtEntry) {
|
|
1955
1998
|
state.submitError.value = toError(err);
|
|
1999
|
+
if (!(err instanceof SubmitErrorHandlerError)) {
|
|
2000
|
+
const { entries, messageless } = deriveSubmitErrors(err, state.formKey);
|
|
2001
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
2002
|
+
for (const entry of entries) {
|
|
2003
|
+
const { key } = canonicalizePath(entry.path);
|
|
2004
|
+
const bucket = byPath.get(key);
|
|
2005
|
+
if (bucket === void 0) byPath.set(key, { segments: entry.path, entries: [entry] });
|
|
2006
|
+
else bucket.entries.push(entry);
|
|
2007
|
+
}
|
|
2008
|
+
for (const { segments, entries: bucket } of byPath.values()) {
|
|
2009
|
+
state.setUserErrorsForPath(segments, bucket);
|
|
2010
|
+
}
|
|
2011
|
+
applyInvalidSubmitPolicy(state, formInstanceId, invalidPolicy);
|
|
2012
|
+
if (__DEV__ && messageless) {
|
|
2013
|
+
console.warn(
|
|
2014
|
+
"[attaform] handleSubmit callback threw a non-Error value; throw an Error or a ValidationError ({ message, path? }) so the failure surfaces with a usable message."
|
|
2015
|
+
);
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
1956
2018
|
}
|
|
1957
2019
|
} finally {
|
|
1958
2020
|
if (!validationSettled) {
|
|
@@ -2814,6 +2876,9 @@ function buildFormApi(state, formInstanceId, options = {}) {
|
|
|
2814
2876
|
get errors() {
|
|
2815
2877
|
return rootBase().errors;
|
|
2816
2878
|
},
|
|
2879
|
+
get ownErrors() {
|
|
2880
|
+
return rootBase().ownErrors;
|
|
2881
|
+
},
|
|
2817
2882
|
get validating() {
|
|
2818
2883
|
return rootBase().validating;
|
|
2819
2884
|
},
|
|
@@ -2977,28 +3042,6 @@ function buildFormApi(state, formInstanceId, options = {}) {
|
|
|
2977
3042
|
return true;
|
|
2978
3043
|
}
|
|
2979
3044
|
const errorsProxy = buildErrorsProxy(state);
|
|
2980
|
-
function normalizeErrorInput(item, scope) {
|
|
2981
|
-
if (item instanceof Error) {
|
|
2982
|
-
return {
|
|
2983
|
-
message: item.message.length > 0 ? item.message : "Unknown error",
|
|
2984
|
-
path: scope !== void 0 ? [...scope] : [],
|
|
2985
|
-
formKey: state.formKey,
|
|
2986
|
-
code: AttaformErrorCode.UserError
|
|
2987
|
-
};
|
|
2988
|
-
}
|
|
2989
|
-
const entry = {
|
|
2990
|
-
message: typeof item.message === "string" && item.message.length > 0 ? item.message : "Unknown error",
|
|
2991
|
-
path: scope !== void 0 ? [...scope] : Array.isArray(item.path) ? [...item.path] : [],
|
|
2992
|
-
formKey: state.formKey,
|
|
2993
|
-
code: typeof item.code === "string" && item.code.length > 0 ? item.code : AttaformErrorCode.UserError
|
|
2994
|
-
};
|
|
2995
|
-
if (item.data !== void 0) entry.data = item.data;
|
|
2996
|
-
return entry;
|
|
2997
|
-
}
|
|
2998
|
-
function normalizeErrorInputs(input, scope) {
|
|
2999
|
-
const items = Array.isArray(input) ? input : [input];
|
|
3000
|
-
return items.map((item) => normalizeErrorInput(item, scope));
|
|
3001
|
-
}
|
|
3002
3045
|
function flattenUserErrors() {
|
|
3003
3046
|
const all = [];
|
|
3004
3047
|
for (const errs of state.userErrors.values()) all.push(...errs);
|
|
@@ -3010,12 +3053,17 @@ function buildFormApi(state, formInstanceId, options = {}) {
|
|
|
3010
3053
|
const { segments, key } = canonicalizePath(arg1);
|
|
3011
3054
|
const input2 = arg2;
|
|
3012
3055
|
const resolved2 = typeof input2 === "function" ? input2((state.userErrors.get(key) ?? []).slice()) : input2;
|
|
3013
|
-
state.setUserErrorsForPath(
|
|
3056
|
+
state.setUserErrorsForPath(
|
|
3057
|
+
segments,
|
|
3058
|
+
normalizeErrorInputs(resolved2, segments, state.formKey, AttaformErrorCode.UserError)
|
|
3059
|
+
);
|
|
3014
3060
|
return;
|
|
3015
3061
|
}
|
|
3016
3062
|
const input = arg1;
|
|
3017
3063
|
const resolved = typeof input === "function" ? input(flattenUserErrors()) : input;
|
|
3018
|
-
state.setAllUserErrors(
|
|
3064
|
+
state.setAllUserErrors(
|
|
3065
|
+
normalizeErrorInputs(resolved, void 0, state.formKey, AttaformErrorCode.UserError)
|
|
3066
|
+
);
|
|
3019
3067
|
}
|
|
3020
3068
|
function clearErrors(path) {
|
|
3021
3069
|
if (path === void 0) {
|
|
@@ -3110,6 +3158,17 @@ function buildFormApi(state, formInstanceId, options = {}) {
|
|
|
3110
3158
|
// keep the explicit form-level computation for the gate.
|
|
3111
3159
|
valid,
|
|
3112
3160
|
errors: metaErrors,
|
|
3161
|
+
// The root `[]` bucket alone: form-level errors from a root
|
|
3162
|
+
// `.refine()` or a path-less `setErrors`, excluding every field error
|
|
3163
|
+
// that `errors` (the whole-form aggregate) rolls up. This is the
|
|
3164
|
+
// banner accessor. Mirrors `rootFieldState` rather than taking a
|
|
3165
|
+
// dedicated computed: `getFieldState([])` routes a container root
|
|
3166
|
+
// through `getErrorsForPath([])` and a primitive root through its own
|
|
3167
|
+
// bucket, and both equal the root bucket, so the root field state is
|
|
3168
|
+
// already the single source of truth.
|
|
3169
|
+
get ownErrors() {
|
|
3170
|
+
return rootFieldState.value.ownErrors;
|
|
3171
|
+
},
|
|
3113
3172
|
// Whole-form transforming mirrors the global `activeTransforms`
|
|
3114
3173
|
// counter ORed with any per-leaf transform in flight (the root
|
|
3115
3174
|
// rollup), exactly as `validating` composes its lifecycle and
|
|
@@ -3148,6 +3207,11 @@ function buildFormApi(state, formInstanceId, options = {}) {
|
|
|
3148
3207
|
get firstError() {
|
|
3149
3208
|
return rootFieldState.value.firstError;
|
|
3150
3209
|
},
|
|
3210
|
+
// `ownErrors[0]`: the form's first top-level error. Pair it with
|
|
3211
|
+
// `ownErrors` for the form-level banner.
|
|
3212
|
+
get firstOwnError() {
|
|
3213
|
+
return rootFieldState.value.firstOwnError;
|
|
3214
|
+
},
|
|
3151
3215
|
get path() {
|
|
3152
3216
|
return rootFieldState.value.path;
|
|
3153
3217
|
},
|
|
@@ -7242,4 +7306,4 @@ function warnIfAmbientWizardProviderHadDuplicates() {
|
|
|
7242
7306
|
}
|
|
7243
7307
|
|
|
7244
7308
|
export { AttaformErrorCode as A, DEFAULT_TIMINGS as D, injectWizard as a, isUnset as b, useRegister as c, useWizard as d, defaultCoercionRules as e, defaultDisplayState as f, defineCoercion as g, useAbstractForm as h, injectForm as i, isPlainRecord as j, safeAssign as k, lazy as l, makeDefaultDisplayState as m, slimKindOf as n, humanize as o, getAtPath as p, setAtPath as q, safeOwnRead as s, unset as u };
|
|
7245
|
-
//# sourceMappingURL=attaform.
|
|
7309
|
+
//# sourceMappingURL=attaform.BoYqnIPI.mjs.map
|