attaform 0.24.0 → 0.24.2
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 +5 -4
- package/dist/index.cjs.map +1 -1
- 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 -3
- package/dist/index.mjs.map +1 -1
- 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.CAWKNCzc.mjs → attaform.0-00cYGw.mjs} +2 -2
- package/dist/shared/{attaform.CAWKNCzc.mjs.map → attaform.0-00cYGw.mjs.map} +1 -1
- package/dist/shared/{attaform.DdUYEhkV.d.cts → attaform.0zueP54D.d.mts} +33 -15
- package/dist/shared/{attaform.Z1qTwOYE.cjs → attaform.B57G7ePY.cjs} +4 -4
- package/dist/shared/{attaform.BJ_W7q3U.mjs.map → attaform.B57G7ePY.cjs.map} +1 -1
- package/dist/shared/{attaform.DwkU0oY9.cjs → attaform.B7UdTs_o.cjs} +79 -75
- package/dist/shared/attaform.B7UdTs_o.cjs.map +1 -0
- package/dist/shared/{attaform.CuBdtfbe.mjs → attaform.BI7M3wK8.mjs} +88 -16
- package/dist/shared/attaform.BI7M3wK8.mjs.map +1 -0
- package/dist/shared/{attaform.nycEksJn.cjs → attaform.BOi6n2Pn.cjs} +2 -2
- package/dist/shared/{attaform.nycEksJn.cjs.map → attaform.BOi6n2Pn.cjs.map} +1 -1
- package/dist/shared/{attaform.BJ_W7q3U.mjs → attaform.B_-nZHtM.mjs} +4 -4
- package/dist/shared/{attaform.Z1qTwOYE.cjs.map → attaform.B_-nZHtM.mjs.map} +1 -1
- package/dist/shared/{attaform.o95Kjd3U.mjs → attaform.BjUaX7s8.mjs} +3 -3
- package/dist/shared/{attaform.o95Kjd3U.mjs.map → attaform.BjUaX7s8.mjs.map} +1 -1
- package/dist/shared/{attaform.BNmkKz0q.d.mts → attaform.BjiHiYAZ.d.ts} +3 -2
- package/dist/shared/{attaform.C42wL7EJ.cjs → attaform.Bos7wVZw.cjs} +90 -18
- package/dist/shared/attaform.Bos7wVZw.cjs.map +1 -0
- package/dist/shared/{attaform.CwFZGv5-.d.ts → attaform.Bx6pgrIy.d.cts} +3 -2
- package/dist/shared/{attaform.Df-s8j1X.mjs → attaform.C0au8oXd.mjs} +36 -29
- package/dist/shared/attaform.C0au8oXd.mjs.map +1 -0
- package/dist/shared/attaform.CjdepGnw.cjs +27 -0
- package/dist/shared/attaform.CjdepGnw.cjs.map +1 -0
- package/dist/shared/{attaform.BnUXV01g.cjs → attaform.D-gYGj5z.cjs} +4 -4
- package/dist/shared/{attaform.C-dAB90u.mjs.map → attaform.D-gYGj5z.cjs.map} +1 -1
- package/dist/shared/{attaform.C6eE50re.d.ts → attaform.DHjRN5JP.d.cts} +33 -15
- package/dist/shared/{attaform.CR6wGvNu.cjs → attaform.DK6_Ctv7.cjs} +10 -4
- package/dist/shared/attaform.DK6_Ctv7.cjs.map +1 -0
- package/dist/shared/{attaform.GJbSmwLB.d.mts → attaform.DUc6cetN.d.cts} +62 -13
- package/dist/shared/{attaform.GJbSmwLB.d.cts → attaform.DUc6cetN.d.mts} +62 -13
- package/dist/shared/{attaform.GJbSmwLB.d.ts → attaform.DUc6cetN.d.ts} +62 -13
- package/dist/shared/{attaform.BV_HyaMO.cjs → attaform.DdfLrIgM.cjs} +3 -3
- package/dist/shared/{attaform.BV_HyaMO.cjs.map → attaform.DdfLrIgM.cjs.map} +1 -1
- package/dist/shared/{attaform.K-3glmiT.d.cts → attaform.DvqdxvNU.d.mts} +3 -2
- package/dist/shared/{attaform.BFWb6hDk.mjs → attaform.DwCtxauq.mjs} +10 -4
- package/dist/shared/attaform.DwCtxauq.mjs.map +1 -0
- package/dist/shared/{attaform.C-dAB90u.mjs → attaform.K1MbxmIu.mjs} +4 -4
- package/dist/shared/{attaform.BnUXV01g.cjs.map → attaform.K1MbxmIu.mjs.map} +1 -1
- package/dist/shared/attaform.WvcckZMD.mjs +21 -0
- package/dist/shared/attaform.WvcckZMD.mjs.map +1 -0
- package/dist/shared/{attaform.DiWNbKWa.d.mts → attaform.yqcYwt0d.d.ts} +33 -15
- package/dist/transforms.cjs +1 -1
- package/dist/transforms.d.cts +4 -1
- package/dist/transforms.d.mts +4 -1
- package/dist/transforms.d.ts +4 -1
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +8 -5
- package/dist/zod-v3.d.mts +8 -5
- package/dist/zod-v3.d.ts +8 -5
- 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.cjs.map +1 -1
- package/dist/zod.d.cts +23 -7
- package/dist/zod.d.mts +23 -7
- package/dist/zod.d.ts +23 -7
- package/dist/zod.mjs +5 -5
- package/dist/zod.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/shared/attaform.BFWb6hDk.mjs.map +0 -1
- package/dist/shared/attaform.C42wL7EJ.cjs.map +0 -1
- package/dist/shared/attaform.CR6wGvNu.cjs.map +0 -1
- package/dist/shared/attaform.CuBdtfbe.mjs.map +0 -1
- package/dist/shared/attaform.Df-s8j1X.mjs.map +0 -1
- package/dist/shared/attaform.DwkU0oY9.cjs.map +0 -1
|
@@ -644,6 +644,42 @@ type DefaultValuesInput<T> = T extends string ? string | Unset : T extends numbe
|
|
|
644
644
|
} | Unset : Array<DefaultValuesInput<U>> | Unset : T extends object ? {
|
|
645
645
|
[K in keyof T]?: DefaultValuesInput<T[K]>;
|
|
646
646
|
} | Unset : T;
|
|
647
|
+
/**
|
|
648
|
+
* The type accepted at a `useForm` overload's `defaultValues` slot.
|
|
649
|
+
*
|
|
650
|
+
* `Form` is the schema's input projection; `SchemaInput` is the schema's
|
|
651
|
+
* own input type (`z.input<Schema>`). A `defaultValues` value is one of:
|
|
652
|
+
* - `DefaultValuesInput<Form>` — the partial, `Unset`-widened in-progress
|
|
653
|
+
* shape. `defaultValues` deliberately accepts a form mid-completion: a
|
|
654
|
+
* leaf may be blank or hold a not-yet-valid value (a `z.email()` field
|
|
655
|
+
* accepts any `string`, not only valid emails). Sharp, fully-validated
|
|
656
|
+
* types are produced only at `handleSubmit`.
|
|
657
|
+
* - `SchemaInput` — the schema's full input shape.
|
|
658
|
+
* - a sync or async factory returning either of the above.
|
|
659
|
+
*
|
|
660
|
+
* `SchemaInput` is REDUNDANT at a concrete call site: a schema's input is
|
|
661
|
+
* always assignable to its own `DefaultValuesInput`, so this arm adds
|
|
662
|
+
* nothing a concrete caller could not already pass and does not weaken the
|
|
663
|
+
* per-field checking (`number` is still rejected where `string` is
|
|
664
|
+
* expected). It earns its place for the generic form-wrapper case (#422):
|
|
665
|
+
* when the schema is a free type parameter `S`, a forwarded `z.input<S>`
|
|
666
|
+
* is REFLEXIVELY assignable to the `SchemaInput` arm — a relation TS can
|
|
667
|
+
* decide even under a generic — whereas `DefaultValuesInput<Form>` alone
|
|
668
|
+
* stays a deferred conditional cascade that is not provably assignable,
|
|
669
|
+
* tripping TS2589 / TS2769. No runtime effect; the slot only governs what
|
|
670
|
+
* the type checker accepts.
|
|
671
|
+
*
|
|
672
|
+
* `DefaultValuesInput<Form>` is computed ONCE — passed as the `DVI` type
|
|
673
|
+
* argument to `AcceptableDefaultsOf` and referenced across the value and
|
|
674
|
+
* factory arms — rather than inlined in each arm, which would
|
|
675
|
+
* re-instantiate the (deep) cascade three times per overload and, across
|
|
676
|
+
* the unified entry's two overloads at a concrete call site, tip the
|
|
677
|
+
* bundled `.d.ts` into TS2589. The arms stay a DIRECT union (not a
|
|
678
|
+
* conditional over the cascade) so the `SchemaInput` arm remains
|
|
679
|
+
* reflexively matchable under a generic.
|
|
680
|
+
*/
|
|
681
|
+
type AcceptableDefaults<Form, SchemaInput> = AcceptableDefaultsOf<DefaultValuesInput<Form>, SchemaInput>;
|
|
682
|
+
type AcceptableDefaultsOf<DVI, SchemaInput> = DVI | SchemaInput | (() => DVI | SchemaInput) | (() => Promise<DVI | SchemaInput>);
|
|
647
683
|
|
|
648
684
|
/**
|
|
649
685
|
* Identifier for a form. A `FormKey` is the string passed via
|
|
@@ -2002,9 +2038,11 @@ type AttaformDefaults = {
|
|
|
2002
2038
|
*/
|
|
2003
2039
|
type OnSubmit<Form extends GenericForm> = (form: Form) => void | Promise<void>;
|
|
2004
2040
|
/**
|
|
2005
|
-
* Callback invoked by `handleSubmit`
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2041
|
+
* Callback invoked by `handleSubmit` on a failed submit. Fires when
|
|
2042
|
+
* client validation fails AND when the submit callback leaves errors in
|
|
2043
|
+
* the user-error layer (the `setErrors(...); return` server-rejection
|
|
2044
|
+
* pattern). Receives the full list of errors. Bind this when you want to
|
|
2045
|
+
* react to submit failures explicitly (alongside or instead of the
|
|
2008
2046
|
* automatic `onInvalidSubmit` UI nudge).
|
|
2009
2047
|
*/
|
|
2010
2048
|
type OnError = (error: ValidationError[]) => void | Promise<void>;
|
|
@@ -3649,10 +3687,14 @@ type FormMeta<F = unknown> = FieldState<F> & {
|
|
|
3649
3687
|
*
|
|
3650
3688
|
* The submit handler does NOT re-throw — its returned promise always
|
|
3651
3689
|
* resolves, so binding it to `@submit.prevent` never manufactures a
|
|
3652
|
-
* `window` unhandledrejection. This is the
|
|
3653
|
-
* submit
|
|
3654
|
-
* imperative `await submit()`.
|
|
3655
|
-
*
|
|
3690
|
+
* `window` unhandledrejection. This is the channel for an UNEXPECTED
|
|
3691
|
+
* submit failure (a thrown exception or rejected promise), read the
|
|
3692
|
+
* same way in templates and after an imperative `await submit()`. An
|
|
3693
|
+
* EXPECTED rejection handled the documented way (`setErrors(...)` then
|
|
3694
|
+
* `return`, no throw) surfaces through the error store and `onError`
|
|
3695
|
+
* instead, leaving `submitError` `null`. Like `hydrateError`, it stays
|
|
3696
|
+
* distinct from the curated user-error store: render it where you
|
|
3697
|
+
* choose:
|
|
3656
3698
|
*
|
|
3657
3699
|
* ```vue
|
|
3658
3700
|
* <p v-if="form.meta.submitError">{{ form.meta.submitError.message }}</p>
|
|
@@ -3669,11 +3711,18 @@ type FormMeta<F = unknown> = FieldState<F> & {
|
|
|
3669
3711
|
*/
|
|
3670
3712
|
readonly errorCount: number;
|
|
3671
3713
|
/**
|
|
3672
|
-
* `true` once a `handleSubmit` callback has resolved without
|
|
3673
|
-
*
|
|
3674
|
-
* (validation failure
|
|
3675
|
-
*
|
|
3676
|
-
*
|
|
3714
|
+
* `true` once a `handleSubmit` callback has resolved without throwing
|
|
3715
|
+
* AND left no errors behind. Independent of `submissionAttempts` — a
|
|
3716
|
+
* failed submit (validation failure, callback rejection, or a callback
|
|
3717
|
+
* that calls `setErrors` and returns) increments attempts but leaves
|
|
3718
|
+
* `submitted` at `false`. Templates read it as "the form has been
|
|
3719
|
+
* submitted successfully at least once."
|
|
3720
|
+
*
|
|
3721
|
+
* The error check is scoped to the user-error layer (`setErrors` /
|
|
3722
|
+
* `clearErrors`): the documented server-rejection pattern
|
|
3723
|
+
* (`setErrors(response.errors); return`) is a failed submit, so it does
|
|
3724
|
+
* not flip `submitted`. A background async refinement that writes a
|
|
3725
|
+
* schema error mid-submit does not retroactively fail it.
|
|
3677
3726
|
*
|
|
3678
3727
|
* Cleared by `form.reset()` alongside `submissionAttempts` and
|
|
3679
3728
|
* `submitError`. For "the user has attempted a submit," read
|
|
@@ -4491,4 +4540,4 @@ type UseFormReturnType<Form extends GenericForm, GetValueFormType extends Generi
|
|
|
4491
4540
|
};
|
|
4492
4541
|
|
|
4493
4542
|
export { ROOT_PATH as Z, ROOT_PATH_KEY as _, canonicalizePath as am, isPathPrefix as an, isUnset as ao, parseDottedPath as ap, unset as aq };
|
|
4494
|
-
export type { ReactiveValidationStatus as $, AttaformDefaults as A, Json as B, CoercionEntry as C, DefaultValuesInput as D, ErrorInput as E, FormKey as F, GenericForm as G, HandleSubmit as H, IsTuple as I, JoinSegments as J, KeyofUnion as K, LiftedValueShape as L, MetaTrackerValue as M, NestedReadType as N, NestedType as O, OnError as P, OnInvalidSubmitPolicy as Q, RegisterModelDynamicCustomDirective as R, OnSubmit as S, PartialFlatPath as T, UseFormConfiguration as U, Path as V, PathKey as W, PendingValidationStatus as X, Primitive as Y, AbstractSchema as a, RegisterDirective as a0, RegisterFlatPath as a1, RegisterOptions as a2, RegisterSelectModifier as a3, RegisterTextModifier as a4, RegisterTransform as a5, Segment as a6, SetValueCallback as a7, SetValuePayload as a8, SettledValidationStatus as a9, SlimPrimitiveKind as aa, SlimRuntimeOf as ab, SubmitHandler as ac, Unset as ad, ValidateOn as ae, ValidateOnConfig as af, ValidationError as ag, ValidationResponse as ah, ValidationResponseWithoutValue as ai, ValueOfUnion as aj, WriteMeta as ak, WriteShape as al,
|
|
4543
|
+
export type { ReactiveValidationStatus as $, AttaformDefaults as A, Json as B, CoercionEntry as C, DefaultValuesInput as D, ErrorInput as E, FormKey as F, GenericForm as G, HandleSubmit as H, IsTuple as I, JoinSegments as J, KeyofUnion as K, LiftedValueShape as L, MetaTrackerValue as M, NestedReadType as N, NestedType as O, OnError as P, OnInvalidSubmitPolicy as Q, RegisterModelDynamicCustomDirective as R, OnSubmit as S, PartialFlatPath as T, UseFormConfiguration as U, Path as V, PathKey as W, PendingValidationStatus as X, Primitive as Y, AbstractSchema as a, RegisterDirective as a0, RegisterFlatPath as a1, RegisterOptions as a2, RegisterSelectModifier as a3, RegisterTextModifier as a4, RegisterTransform as a5, Segment as a6, SetValueCallback as a7, SetValuePayload as a8, SettledValidationStatus as a9, SlimPrimitiveKind as aa, SlimRuntimeOf as ab, SubmitHandler as ac, Unset as ad, ValidateOn as ae, ValidateOnConfig as af, ValidationError as ag, ValidationResponse as ah, ValidationResponseWithoutValue as ai, ValueOfUnion as aj, WriteMeta as ak, WriteShape as al, AcceptableDefaults as ar, SchemaFactoryOptions as as, TransformAbortHolder as at, UseFormReturnType as b, RegisterValue as c, GetDisplayState as d, ArrayItem as e, ArrayPath as f, CoercionRegistry as g, CoercionResult as h, CustomDirectiveRegisterAssignerFn as i, DeepPartial as j, DefaultValuesResponse as k, DefaultValuesShape as l, DisplayCtx as m, DisplayMachine as n, DisplayState as o, ErrorsProxyShape as p, FieldMetaPayload as q, FieldState as r, FieldStateMap as s, FieldStateMapEntry as t, FlatPath as u, FormErrorRecord as v, FormErrorsSurface as w, FormMeta as x, HistoryConfig as y, IsUnion as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const injectWizard = require('./attaform.
|
|
4
|
-
const paths = require('./attaform.
|
|
3
|
+
const injectWizard = require('./attaform.Bos7wVZw.cjs');
|
|
4
|
+
const paths = require('./attaform.B7UdTs_o.cjs');
|
|
5
5
|
|
|
6
6
|
const PATH_SEPARATOR = ".";
|
|
7
7
|
function createAbstractSchema(rootSchema, intro, services, formKey, options) {
|
|
@@ -916,4 +916,4 @@ exports.mergeDeep = mergeDeep;
|
|
|
916
916
|
exports.peelEmbeddedDefault = peelEmbeddedDefault;
|
|
917
917
|
exports.slimPrimitivesWalk = slimPrimitivesWalk;
|
|
918
918
|
exports.walkPathSegments = walkPathSegments;
|
|
919
|
-
//# sourceMappingURL=attaform.
|
|
919
|
+
//# sourceMappingURL=attaform.DdfLrIgM.cjs.map
|