attaform 0.24.1 → 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/fingerprint2.cjs +1 -1
- package/dist/chunks/fingerprint2.mjs +1 -1
- package/dist/index.cjs +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 +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/shared/{attaform.BwAcpoRw.d.mts → attaform.0zueP54D.d.mts} +10 -1
- package/dist/shared/{attaform.Cn6JoG9o.cjs → attaform.B57G7ePY.cjs} +3 -3
- package/dist/shared/{attaform.FY5r1BpA.mjs.map → attaform.B57G7ePY.cjs.map} +1 -1
- package/dist/shared/{attaform.NWrEGrNo.mjs → attaform.BI7M3wK8.mjs} +36 -1
- package/dist/shared/attaform.BI7M3wK8.mjs.map +1 -0
- package/dist/shared/{attaform.FY5r1BpA.mjs → attaform.B_-nZHtM.mjs} +3 -3
- package/dist/shared/{attaform.Cn6JoG9o.cjs.map → attaform.B_-nZHtM.mjs.map} +1 -1
- package/dist/shared/{attaform.C-tQKknW.mjs → attaform.BjUaX7s8.mjs} +2 -2
- package/dist/shared/{attaform.C-tQKknW.mjs.map → attaform.BjUaX7s8.mjs.map} +1 -1
- package/dist/shared/{attaform.4zesozTg.d.mts → attaform.BjiHiYAZ.d.ts} +3 -2
- package/dist/shared/{attaform.DRQjF16I.cjs → attaform.Bos7wVZw.cjs} +36 -1
- package/dist/shared/attaform.Bos7wVZw.cjs.map +1 -0
- package/dist/shared/{attaform.Bk7vnQhG.d.cts → attaform.Bx6pgrIy.d.cts} +3 -2
- package/dist/shared/{attaform.CrrIaHM8.cjs → attaform.D-gYGj5z.cjs} +3 -3
- package/dist/shared/{attaform.BunnTiTw.mjs.map → attaform.D-gYGj5z.cjs.map} +1 -1
- package/dist/shared/{attaform.Bq6Copxn.d.cts → attaform.DHjRN5JP.d.cts} +10 -1
- package/dist/shared/{attaform.DwLw3Kzv.cjs → attaform.DK6_Ctv7.cjs} +4 -4
- package/dist/shared/attaform.DK6_Ctv7.cjs.map +1 -0
- package/dist/shared/{attaform.DBhrKb2j.d.mts → attaform.DUc6cetN.d.cts} +37 -1
- package/dist/shared/{attaform.DBhrKb2j.d.cts → attaform.DUc6cetN.d.mts} +37 -1
- package/dist/shared/{attaform.DBhrKb2j.d.ts → attaform.DUc6cetN.d.ts} +37 -1
- package/dist/shared/{attaform.C-1W0T1n.cjs → attaform.DdfLrIgM.cjs} +2 -2
- package/dist/shared/{attaform.C-1W0T1n.cjs.map → attaform.DdfLrIgM.cjs.map} +1 -1
- package/dist/shared/{attaform.Df4xXKbE.d.ts → attaform.DvqdxvNU.d.mts} +3 -2
- package/dist/shared/{attaform.DhXl0Kdr.mjs → attaform.DwCtxauq.mjs} +4 -4
- package/dist/shared/attaform.DwCtxauq.mjs.map +1 -0
- package/dist/shared/{attaform.BunnTiTw.mjs → attaform.K1MbxmIu.mjs} +3 -3
- package/dist/shared/{attaform.CrrIaHM8.cjs.map → attaform.K1MbxmIu.mjs.map} +1 -1
- package/dist/shared/{attaform.BrFPMFgi.d.ts → attaform.yqcYwt0d.d.ts} +10 -1
- 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 +4 -4
- 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 +4 -4
- package/dist/zod.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/shared/attaform.DRQjF16I.cjs.map +0 -1
- package/dist/shared/attaform.DhXl0Kdr.mjs.map +0 -1
- package/dist/shared/attaform.DwLw3Kzv.cjs.map +0 -1
- package/dist/shared/attaform.NWrEGrNo.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FormKey, W as PathKey, m as DisplayCtx, d as GetDisplayState, n as DisplayMachine, V as Path, aa as SlimPrimitiveKind, C as CoercionEntry, g as CoercionRegistry, G as GenericForm, ag as ValidationError, a as AbstractSchema, ak as WriteMeta, j as DeepPartial, al as WriteShape,
|
|
1
|
+
import { F as FormKey, W as PathKey, m as DisplayCtx, d as GetDisplayState, n as DisplayMachine, V as Path, aa as SlimPrimitiveKind, C as CoercionEntry, g as CoercionRegistry, G as GenericForm, ag as ValidationError, a as AbstractSchema, ak as WriteMeta, j as DeepPartial, al as WriteShape, at as TransformAbortHolder, ae as ValidateOn, A as AttaformDefaults, b as UseFormReturnType, c as RegisterValue } from './attaform.DUc6cetN.js';
|
|
2
2
|
import { Ref, ComputedRef, App, InjectionKey } from 'vue';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1100,6 +1100,15 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
1100
1100
|
* no longer see the shape change.
|
|
1101
1101
|
*/
|
|
1102
1102
|
hasStructuralChangeUnder(path: Path): boolean;
|
|
1103
|
+
/**
|
|
1104
|
+
* Whether a baseline-present container under `path` was replaced wholesale by
|
|
1105
|
+
* a non-container (e.g. `setValue('profile', undefined)`) and is still absent.
|
|
1106
|
+
* The other half of removal-driven `dirty`: such a subtree's leaves vanish
|
|
1107
|
+
* from the live value, so neither the present-leaf walk nor the array tracker
|
|
1108
|
+
* can see the loss. Self-filters by current liveness, so a refilled path stops
|
|
1109
|
+
* counting.
|
|
1110
|
+
*/
|
|
1111
|
+
hasRemovedSubtreeUnder(path: Path): boolean;
|
|
1103
1112
|
getFieldRecord(path: Path): FieldRecord | undefined;
|
|
1104
1113
|
getOriginalAtPath(path: Path): unknown;
|
|
1105
1114
|
/**
|
package/dist/transforms.cjs
CHANGED
package/dist/transforms.d.cts
CHANGED
|
@@ -10,7 +10,10 @@ import { NodeTransform } from '@vue/compiler-core';
|
|
|
10
10
|
* - `<MyComponent v-register>` and kebab-case custom-element hosts
|
|
11
11
|
* — injects a `:registerValue` bridge prop so `useRegister` inside
|
|
12
12
|
* the child sees the parent's RegisterValue (the binding the audit
|
|
13
|
-
* called out as the transform's "fires on every component" path)
|
|
13
|
+
* called out as the transform's "fires on every component" path),
|
|
14
|
+
* and marks any parent-authored slotted `<option>`s with `:selected`
|
|
15
|
+
* the same way the native path does, so a `<select>` wrapped in a
|
|
16
|
+
* styled component keeps its SSR-selected option (#394).
|
|
14
17
|
*
|
|
15
18
|
* Wired automatically by `attaform/vite` and `attaform/nuxt`. Use
|
|
16
19
|
* directly only when integrating with a custom bundler.
|
package/dist/transforms.d.mts
CHANGED
|
@@ -10,7 +10,10 @@ import { NodeTransform } from '@vue/compiler-core';
|
|
|
10
10
|
* - `<MyComponent v-register>` and kebab-case custom-element hosts
|
|
11
11
|
* — injects a `:registerValue` bridge prop so `useRegister` inside
|
|
12
12
|
* the child sees the parent's RegisterValue (the binding the audit
|
|
13
|
-
* called out as the transform's "fires on every component" path)
|
|
13
|
+
* called out as the transform's "fires on every component" path),
|
|
14
|
+
* and marks any parent-authored slotted `<option>`s with `:selected`
|
|
15
|
+
* the same way the native path does, so a `<select>` wrapped in a
|
|
16
|
+
* styled component keeps its SSR-selected option (#394).
|
|
14
17
|
*
|
|
15
18
|
* Wired automatically by `attaform/vite` and `attaform/nuxt`. Use
|
|
16
19
|
* directly only when integrating with a custom bundler.
|
package/dist/transforms.d.ts
CHANGED
|
@@ -10,7 +10,10 @@ import { NodeTransform } from '@vue/compiler-core';
|
|
|
10
10
|
* - `<MyComponent v-register>` and kebab-case custom-element hosts
|
|
11
11
|
* — injects a `:registerValue` bridge prop so `useRegister` inside
|
|
12
12
|
* the child sees the parent's RegisterValue (the binding the audit
|
|
13
|
-
* called out as the transform's "fires on every component" path)
|
|
13
|
+
* called out as the transform's "fires on every component" path),
|
|
14
|
+
* and marks any parent-authored slotted `<option>`s with `:selected`
|
|
15
|
+
* the same way the native path does, so a `<select>` wrapped in a
|
|
16
|
+
* styled component keeps its SSR-selected option (#394).
|
|
14
17
|
*
|
|
15
18
|
* Wired automatically by `attaform/vite` and `attaform/nuxt`. Use
|
|
16
19
|
* directly only when integrating with a custom bundler.
|
package/dist/transforms.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { c as componentBridgeTransform, i as inputTextAreaNodeTransform, v as vRegisterHintTransform, a as vRegisterPreambleTransform } from './shared/attaform.
|
|
1
|
+
export { c as componentBridgeTransform, i as inputTextAreaNodeTransform, v as vRegisterHintTransform, a as vRegisterPreambleTransform } from './shared/attaform.DwCtxauq.mjs';
|
|
2
2
|
//# sourceMappingURL=transforms.mjs.map
|
package/dist/vite.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const detectZodMajor = require('./shared/attaform.LEWUFqUw.cjs');
|
|
4
|
-
const vRegisterPreambleTransform = require('./shared/attaform.
|
|
4
|
+
const vRegisterPreambleTransform = require('./shared/attaform.DK6_Ctv7.cjs');
|
|
5
5
|
const compilerSfc = require('@vue/compiler-sfc');
|
|
6
6
|
const compilerCore = require('@vue/compiler-core');
|
|
7
7
|
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as resolveZodAliasTarget, Z as ZOD_UNIFIED_SPECIFIER } from './shared/attaform.sHkHv_98.mjs';
|
|
2
|
-
import { a as vRegisterPreambleTransform, c as componentBridgeTransform, i as inputTextAreaNodeTransform, v as vRegisterHintTransform } from './shared/attaform.
|
|
2
|
+
import { a as vRegisterPreambleTransform, c as componentBridgeTransform, i as inputTextAreaNodeTransform, v as vRegisterHintTransform } from './shared/attaform.DwCtxauq.mjs';
|
|
3
3
|
import { parse, babelParse } from '@vue/compiler-sfc';
|
|
4
4
|
import { NodeTypes } from '@vue/compiler-core';
|
|
5
5
|
|
package/dist/zod-v3.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useForm = require('./shared/attaform.
|
|
4
|
-
const injectWizard = require('./shared/attaform.
|
|
3
|
+
const useForm = require('./shared/attaform.B57G7ePY.cjs');
|
|
4
|
+
const injectWizard = require('./shared/attaform.Bos7wVZw.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
package/dist/zod-v3.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema,
|
|
3
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, b as UseFormReturnType, af as ValidateOnConfig, as as SchemaFactoryOptions, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.cjs';
|
|
3
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.cjs';
|
|
4
4
|
import { S as SupportedRootSchema, U as UnwrapZodRoot, a as StorageShape } from './shared/attaform.DdjDqTah.cjs';
|
|
5
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
5
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.DHjRN5JP.cjs';
|
|
6
6
|
import 'vue';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -32,7 +32,9 @@ type ReadOf<Schema extends SupportedRootSchema> = StorageShape<UnwrapZodRoot<Sch
|
|
|
32
32
|
* directly — it wraps the adapter automatically. For Zod v4, import
|
|
33
33
|
* from `attaform/zod` instead.
|
|
34
34
|
*/
|
|
35
|
-
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>,
|
|
35
|
+
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>, never, K>, 'defaultValues'> & {
|
|
36
|
+
defaultValues?: AcceptableDefaults<Form, Form>;
|
|
37
|
+
}): UseFormReturnType<Form, GetValueFormType, Form, K>;
|
|
36
38
|
/**
|
|
37
39
|
* Create a form bound to a Zod v3 `ZodObject` schema.
|
|
38
40
|
*
|
|
@@ -57,8 +59,9 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
57
59
|
*
|
|
58
60
|
* For Zod v4, import from `attaform/zod` instead.
|
|
59
61
|
*/
|
|
60
|
-
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>,
|
|
62
|
+
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
61
63
|
schema: Schema;
|
|
64
|
+
defaultValues?: AcceptableDefaults<FormOf<Schema>, z.input<Schema>>;
|
|
62
65
|
} & ValidateOnConfig): UseFormReturnType<FormOf<Schema>, OutOf<Schema>, ReadOf<Schema>, K>;
|
|
63
66
|
|
|
64
67
|
/**
|
package/dist/zod-v3.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema,
|
|
3
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, b as UseFormReturnType, af as ValidateOnConfig, as as SchemaFactoryOptions, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.mjs';
|
|
3
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.mjs';
|
|
4
4
|
import { S as SupportedRootSchema, U as UnwrapZodRoot, a as StorageShape } from './shared/attaform.DdjDqTah.mjs';
|
|
5
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
5
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.0zueP54D.mjs';
|
|
6
6
|
import 'vue';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -32,7 +32,9 @@ type ReadOf<Schema extends SupportedRootSchema> = StorageShape<UnwrapZodRoot<Sch
|
|
|
32
32
|
* directly — it wraps the adapter automatically. For Zod v4, import
|
|
33
33
|
* from `attaform/zod` instead.
|
|
34
34
|
*/
|
|
35
|
-
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>,
|
|
35
|
+
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>, never, K>, 'defaultValues'> & {
|
|
36
|
+
defaultValues?: AcceptableDefaults<Form, Form>;
|
|
37
|
+
}): UseFormReturnType<Form, GetValueFormType, Form, K>;
|
|
36
38
|
/**
|
|
37
39
|
* Create a form bound to a Zod v3 `ZodObject` schema.
|
|
38
40
|
*
|
|
@@ -57,8 +59,9 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
57
59
|
*
|
|
58
60
|
* For Zod v4, import from `attaform/zod` instead.
|
|
59
61
|
*/
|
|
60
|
-
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>,
|
|
62
|
+
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
61
63
|
schema: Schema;
|
|
64
|
+
defaultValues?: AcceptableDefaults<FormOf<Schema>, z.input<Schema>>;
|
|
62
65
|
} & ValidateOnConfig): UseFormReturnType<FormOf<Schema>, OutOf<Schema>, ReadOf<Schema>, K>;
|
|
63
66
|
|
|
64
67
|
/**
|
package/dist/zod-v3.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema,
|
|
3
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, b as UseFormReturnType, af as ValidateOnConfig, as as SchemaFactoryOptions, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.js';
|
|
3
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.js';
|
|
4
4
|
import { S as SupportedRootSchema, U as UnwrapZodRoot, a as StorageShape } from './shared/attaform.DdjDqTah.js';
|
|
5
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
5
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.yqcYwt0d.js';
|
|
6
6
|
import 'vue';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -32,7 +32,9 @@ type ReadOf<Schema extends SupportedRootSchema> = StorageShape<UnwrapZodRoot<Sch
|
|
|
32
32
|
* directly — it wraps the adapter automatically. For Zod v4, import
|
|
33
33
|
* from `attaform/zod` instead.
|
|
34
34
|
*/
|
|
35
|
-
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>,
|
|
35
|
+
declare function useForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<Form, GetValueFormType, AbstractSchema<Form, GetValueFormType>, never, K>, 'defaultValues'> & {
|
|
36
|
+
defaultValues?: AcceptableDefaults<Form, Form>;
|
|
37
|
+
}): UseFormReturnType<Form, GetValueFormType, Form, K>;
|
|
36
38
|
/**
|
|
37
39
|
* Create a form bound to a Zod v3 `ZodObject` schema.
|
|
38
40
|
*
|
|
@@ -57,8 +59,9 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
57
59
|
*
|
|
58
60
|
* For Zod v4, import from `attaform/zod` instead.
|
|
59
61
|
*/
|
|
60
|
-
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>,
|
|
62
|
+
declare function useForm<Schema extends SupportedRootSchema, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<FormOf<Schema>, OutOf<Schema>, AbstractSchema<FormOf<Schema>, OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
61
63
|
schema: Schema;
|
|
64
|
+
defaultValues?: AcceptableDefaults<FormOf<Schema>, z.input<Schema>>;
|
|
62
65
|
} & ValidateOnConfig): UseFormReturnType<FormOf<Schema>, OutOf<Schema>, ReadOf<Schema>, K>;
|
|
63
66
|
|
|
64
67
|
/**
|
package/dist/zod-v3.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { f as fieldMeta, i as isZodSchemaType, u as useForm, w as withMeta, z as zodAdapter } from './shared/attaform.
|
|
2
|
-
export { A as AttaformErrorCode, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, c as useRegister, d as useWizard } from './shared/attaform.
|
|
1
|
+
export { f as fieldMeta, i as isZodSchemaType, u as useForm, w as withMeta, z as zodAdapter } from './shared/attaform.B_-nZHtM.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, c as useRegister, d as useWizard } from './shared/attaform.BI7M3wK8.mjs';
|
|
3
3
|
//# sourceMappingURL=zod-v3.mjs.map
|
package/dist/zod-v4.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./shared/attaform.
|
|
4
|
-
const injectWizard = require('./shared/attaform.
|
|
3
|
+
const index = require('./shared/attaform.D-gYGj5z.cjs');
|
|
4
|
+
const injectWizard = require('./shared/attaform.Bos7wVZw.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
package/dist/zod-v4.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as SupportedRootSchema } from './shared/attaform.
|
|
2
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
3
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
4
|
-
import { F as FormKey,
|
|
5
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
1
|
+
import { S as SupportedRootSchema } from './shared/attaform.Bx6pgrIy.cjs';
|
|
2
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.Bx6pgrIy.cjs';
|
|
3
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.DHjRN5JP.cjs';
|
|
4
|
+
import { F as FormKey, as as SchemaFactoryOptions, a as AbstractSchema, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.cjs';
|
|
5
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.cjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { A as AttaformError } from './shared/attaform.CO0e7YVY.cjs';
|
|
8
8
|
import 'vue';
|
package/dist/zod-v4.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as SupportedRootSchema } from './shared/attaform.
|
|
2
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
3
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
4
|
-
import { F as FormKey,
|
|
5
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
1
|
+
import { S as SupportedRootSchema } from './shared/attaform.DvqdxvNU.mjs';
|
|
2
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.DvqdxvNU.mjs';
|
|
3
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.0zueP54D.mjs';
|
|
4
|
+
import { F as FormKey, as as SchemaFactoryOptions, a as AbstractSchema, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.mjs';
|
|
5
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.mjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { A as AttaformError } from './shared/attaform.CO0e7YVY.mjs';
|
|
8
8
|
import 'vue';
|
package/dist/zod-v4.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as SupportedRootSchema } from './shared/attaform.
|
|
2
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
3
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
4
|
-
import { F as FormKey,
|
|
5
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
1
|
+
import { S as SupportedRootSchema } from './shared/attaform.BjiHiYAZ.js';
|
|
2
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.BjiHiYAZ.js';
|
|
3
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.yqcYwt0d.js';
|
|
4
|
+
import { F as FormKey, as as SchemaFactoryOptions, a as AbstractSchema, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.js';
|
|
5
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { A as AttaformError } from './shared/attaform.CO0e7YVY.js';
|
|
8
8
|
import 'vue';
|
package/dist/zod-v4.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { U as UnsupportedSchemaError, a as assertZodVersion, f as fieldMeta, k as kindOf, u as useForm, w as withMeta, z as zodAdapter } from './shared/attaform.
|
|
2
|
-
export { A as AttaformErrorCode, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, c as useRegister, d as useWizard } from './shared/attaform.
|
|
1
|
+
export { U as UnsupportedSchemaError, a as assertZodVersion, f as fieldMeta, k as kindOf, u as useForm, w as withMeta, z as zodAdapter } from './shared/attaform.K1MbxmIu.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, c as useRegister, d as useWizard } from './shared/attaform.BI7M3wK8.mjs';
|
|
3
3
|
//# sourceMappingURL=zod-v4.mjs.map
|
package/dist/zod.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const paths = require('./shared/attaform.B7UdTs_o.cjs');
|
|
4
|
-
const useForm$1 = require('./shared/attaform.
|
|
5
|
-
const index = require('./shared/attaform.
|
|
6
|
-
const walkFieldMeta = require('./shared/attaform.
|
|
7
|
-
const injectWizard = require('./shared/attaform.
|
|
4
|
+
const useForm$1 = require('./shared/attaform.B57G7ePY.cjs');
|
|
5
|
+
const index = require('./shared/attaform.D-gYGj5z.cjs');
|
|
6
|
+
const walkFieldMeta = require('./shared/attaform.DdfLrIgM.cjs');
|
|
7
|
+
const injectWizard = require('./shared/attaform.Bos7wVZw.cjs');
|
|
8
8
|
|
|
9
9
|
function isZodV4SchemaShape(value) {
|
|
10
10
|
if (typeof value !== "object" || value === null) return false;
|
package/dist/zod.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.cjs","sources":["../src/runtime/core/zod-shape.ts","../src/runtime/adapters/unified/use-form.ts","../src/runtime/adapters/unified/field-meta.ts"],"sourcesContent":["/**\n * Shape detectors for Zod schemas. Used by the unified `attaform/zod`\n * entry's runtime dispatch (`runtime/adapters/unified/use-form.ts`)\n * to route to the v3 or v4 adapter based on the schema's runtime\n * shape. Mirrors the discrimination already used by the v4\n * introspection helper (`adapters/zod-v4/introspect.ts`'s\n * `assertZodVersion`, which reads `def.type`) and the v3 wrapper's\n * legitimate-input branch (`composables/use-form.ts`'s `isZodType`,\n * which reads `_def`).\n *\n * Why this discriminator and not `_zod` / `_def`:\n * - Zod v4 retained `_def` for backward compat — reading `_def` alone\n * misclassifies v4 schemas as v3.\n * - Zod v4's stable shape is `def.type: string` (lowercase tag like\n * `'object'`); Zod v3's is `_def.typeName: string` (capitalised tag\n * like `'ZodObject'`). Both are checked structurally so consumers\n * who alias one Zod major to a non-standard import path still work.\n */\n\ninterface ZodV4Shape {\n def: { type: unknown }\n}\n\ninterface ZodV3Shape {\n _def: { typeName: unknown }\n}\n\n/**\n * Returns true when `value` looks like a Zod schema of either major\n * version. Convenience wrapper around the v3 / v4 detectors.\n */\nexport function isZodSchemaShape(value: unknown): boolean {\n return isZodV4SchemaShape(value) || isZodV3SchemaShape(value)\n}\n\n/**\n * Returns true when `value` looks like a Zod v4 schema (has\n * `def.type: string`). Used by the unified entry's runtime-dispatch\n * to route to the v4 adapter.\n */\nexport function isZodV4SchemaShape(value: unknown): value is ZodV4Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { def?: unknown }).def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { type?: unknown }).type === 'string'\n}\n\n/**\n * Returns true when `value` looks like a Zod v3 schema (has\n * `_def.typeName: string`). Kept distinct from `isZodV4SchemaShape`\n * because some v4 schemas also expose `_def` for backward compat —\n * the v4 detector wins first in `isZodSchemaShape`.\n */\nexport function isZodV3SchemaShape(value: unknown): value is ZodV3Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { _def?: unknown })._def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { typeName?: unknown }).typeName === 'string'\n}\n","/**\n * Unified `useForm` for the `attaform/zod` entry. Runtime-dispatches\n * on schema shape: a Zod v4 schema (`def.type` truthy) routes to the\n * v4 adapter; a Zod v3 schema (or any other `AbstractSchema`) routes\n * to the v3 wrapper, which already accepts both Zod v3 input and\n * `AbstractSchema` directly via its built-in shape branch.\n *\n * Type-level dispatch happens via TWO typed overloads — v4 first, v3\n * second — plus an untyped impl. Each overload mirrors the matching\n * direct adapter's signature exactly, so a v4-schema call site pays\n * the same per-call depth cost as importing from `attaform/zod-v4`\n * directly. Overload resolution at concrete call sites commits to one\n * overload immediately on argument shape — no type-level dispatch tax.\n *\n * Tests and other call sites that need the equivalent of\n * `typeof useForm<X>` should reach for the `UseFormReturn<X>` /\n * `UseFormConfig<X>` helpers in `types-api.ts` — instantiation\n * expressions on overloaded functions follow brittle resolution rules,\n * and the helper types give a deterministic projection.\n *\n * This module is the FALLBACK path. Vite consumers see the\n * `attaform/vite` plugin's `resolveId` hook rewrite `attaform/zod`\n * imports to either `attaform/zod-v3` or `attaform/zod-v4` at build\n * time — in that case this dispatch never runs and the consumer\n * bundle ships only the matching adapter. Other bundlers (and\n * non-bundled ESM consumption) hit this dispatch instead, paying a\n * modest size cost for the convenience of a single hello-world import.\n *\n * Power users who want a guaranteed lean bundle on non-Vite tooling\n * can import directly from `attaform/zod-v3` or `attaform/zod-v4` —\n * those subpaths are never rewritten and never load the other\n * adapter.\n */\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport type { ZodV4Internals } from './types-zod-major'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type {\n AbstractSchema,\n FormKey,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DefaultValuesInput } from '../../types/types-core'\nimport type { SupportedRootSchema as SupportedRootSchemaV4 } from '../zod-v4/types-root'\nimport type { SupportedRootSchema as SupportedRootSchemaV3 } from '../zod-v3/types-root'\nimport type { V3FormOf, V3OutOf, V3ReadOf, V4FormOf, V4OutOf, V4ReadOf } from './types-projections'\n\n/**\n * Create a form bound to a Zod v4 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * The constraint intersects `ZodV4Internals` (the v4-only `_zod`\n * brand) so a v3 schema can't bind this overload even when `z`\n * resolves to v3 in a single-major consumer install; v3 schemas fall\n * through to the v3 overload below. See `types-zod-major.ts`.\n */\nexport function useForm<\n Schema extends SupportedRootSchemaV4 & ZodV4Internals,\n K extends FormKey = FormKey,\n>(\n configuration: Omit<\n UseFormConfiguration<\n V4FormOf<Schema>,\n V4OutOf<Schema>,\n AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>,\n DefaultValuesInput<V4FormOf<Schema>>,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>\n/**\n * Create a form bound to a Zod v3 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod-v3'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * v3 schemas match this overload; v4 schemas hit the v4 overload\n * above first and never reach here.\n */\nexport function useForm<Schema extends SupportedRootSchemaV3, K extends FormKey = FormKey>(\n configuration: Omit<\n UseFormConfiguration<\n V3FormOf<Schema>,\n V3OutOf<Schema>,\n AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>,\n DefaultValuesInput<V3FormOf<Schema>>,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useForm(configuration: any): any {\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4>[0])\n }\n return useFormV3(configuration as Parameters<typeof useFormV3>[0])\n}\n","/**\n * Field-metadata write/read API for the unified `attaform/zod` entry.\n *\n * Storage is shared with both adapters via `field-meta-store` — a\n * payload written here is visible to whichever adapter the unified\n * `useForm` dispatches to at runtime, regardless of Zod major. No\n * `zod` runtime import; the type-only `import type` is erased at\n * build, so `attaform/zod` carries no `z.registry` reference even\n * when consumed by a Zod 3 project without the Vite plugin alias.\n *\n * The native v4 chain `schema.register(fieldMeta, payload)` continues\n * to work — Zod 4's `.register()` only calls `.add(this, payload)`\n * structurally, satisfied by the shared store.\n */\nimport type { z } from 'zod'\nimport type { FieldMetaPayload } from '../../core/field-meta'\nimport { fieldMetaStore, getFieldMetaForSchema } from '../../core/field-meta-store'\n\n// Zod v4's `$ZodRegistry` class isn't surfaced under the `z` namespace\n// of the classic external entry, but `z.registry()` returns one — so\n// `ReturnType<typeof z.registry<T>>` resolves to the registry type\n// without needing a direct import. The `import type` keeps the\n// reference type-only; nothing about `z.registry` lands in the bundle.\ntype ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>\n\n/**\n * The shared registry every Attaform-aware Zod schema can register\n * field metadata against, regardless of major. Same instance the v3\n * and v4 adapter entries expose — write in one place, read from\n * any.\n *\n * Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native\n * `schema.register(fieldMeta, payload)` chain type-checks for v4\n * users; the runtime call only needs `.add` structurally, which the\n * shared store provides.\n */\nexport const fieldMeta = fieldMetaStore as unknown as ZodFieldMetaRegistry\n\n/**\n * Attach `payload` to `schema` in the shared registry and return a\n * clone of `schema` so each call gets its own identity (the registry\n * keys on schema reference, so cloning prevents last-write-wins\n * collisions for sub-schemas reused at multiple paths).\n *\n * Works on both Zod 3 and Zod 4 schemas — branches on the runtime\n * shape of the schema:\n * - Zod 4 schemas expose a public `.clone()` method; we call it.\n * - Zod 3 schemas don't, so we reconstruct via\n * `new schema.constructor(schema._def)`.\n *\n * Both forms produce a fresh schema with the same effective\n * structure, so the registry slot is unique to this call site.\n */\nexport function withMeta<S>(schema: S, payload: FieldMetaPayload): S {\n const target = schema as object\n const existing = getFieldMetaForSchema(target) ?? {}\n const cloned = cloneSchema(schema)\n fieldMetaStore.add(cloned as object, { ...existing, ...payload })\n return cloned\n}\n\nfunction cloneSchema<S>(schema: S): S {\n const candidate = schema as { clone?: unknown; constructor: unknown; _def: unknown }\n if (typeof candidate.clone === 'function') {\n return (candidate.clone as () => S)()\n }\n // Zod 3 path: reconstruct via constructor + _def (no public\n // `.clone()` on v3).\n const Ctor = candidate.constructor as new (def: unknown) => S\n return new Ctor(candidate._def)\n}\n"],"names":["InvalidUseFormConfigError","useFormV4","useFormV3","fieldMetaStore","getFieldMetaForSchema"],"mappings":";;;;;;;;AAwCO,SAAS,mBAAmB,KAAA,EAAqC;AACtE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,MAAM,OAAO,KAAA;AACxD,EAAA,MAAM,MAAO,KAAA,CAA4B,GAAA;AACzC,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,MAAM,OAAO,KAAA;AACpD,EAAA,OAAO,OAAQ,IAA2B,IAAA,KAAS,QAAA;AACrD;;ACuEO,SAAS,QAAQ,aAAA,EAAyB;AAC/C,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAIA,+BAAA,EAA0B;AAAA,EACtC;AACA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOC,cAAU,aAAgD,CAAA;AAAA,EACnE;AACA,EAAA,OAAOC,kBAAU,aAAgD,CAAA;AACnE;;AC7FO,MAAM,SAAA,GAAYC;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAWC,mCAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAAD,4BAAA,CAAe,IAAI,MAAA,EAAkB,EAAE,GAAG,QAAA,EAAU,GAAG,SAAS,CAAA;AAChE,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,YAAe,MAAA,EAAc;AACpC,EAAA,MAAM,SAAA,GAAY,MAAA;AAClB,EAAA,IAAI,OAAO,SAAA,CAAU,KAAA,KAAU,UAAA,EAAY;AACzC,IAAA,OAAQ,UAAU,KAAA,EAAkB;AAAA,EACtC;AAGA,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,OAAO,IAAI,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAChC;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"zod.cjs","sources":["../src/runtime/core/zod-shape.ts","../src/runtime/adapters/unified/use-form.ts","../src/runtime/adapters/unified/field-meta.ts"],"sourcesContent":["/**\n * Shape detectors for Zod schemas. Used by the unified `attaform/zod`\n * entry's runtime dispatch (`runtime/adapters/unified/use-form.ts`)\n * to route to the v3 or v4 adapter based on the schema's runtime\n * shape. Mirrors the discrimination already used by the v4\n * introspection helper (`adapters/zod-v4/introspect.ts`'s\n * `assertZodVersion`, which reads `def.type`) and the v3 wrapper's\n * legitimate-input branch (`composables/use-form.ts`'s `isZodType`,\n * which reads `_def`).\n *\n * Why this discriminator and not `_zod` / `_def`:\n * - Zod v4 retained `_def` for backward compat — reading `_def` alone\n * misclassifies v4 schemas as v3.\n * - Zod v4's stable shape is `def.type: string` (lowercase tag like\n * `'object'`); Zod v3's is `_def.typeName: string` (capitalised tag\n * like `'ZodObject'`). Both are checked structurally so consumers\n * who alias one Zod major to a non-standard import path still work.\n */\n\ninterface ZodV4Shape {\n def: { type: unknown }\n}\n\ninterface ZodV3Shape {\n _def: { typeName: unknown }\n}\n\n/**\n * Returns true when `value` looks like a Zod schema of either major\n * version. Convenience wrapper around the v3 / v4 detectors.\n */\nexport function isZodSchemaShape(value: unknown): boolean {\n return isZodV4SchemaShape(value) || isZodV3SchemaShape(value)\n}\n\n/**\n * Returns true when `value` looks like a Zod v4 schema (has\n * `def.type: string`). Used by the unified entry's runtime-dispatch\n * to route to the v4 adapter.\n */\nexport function isZodV4SchemaShape(value: unknown): value is ZodV4Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { def?: unknown }).def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { type?: unknown }).type === 'string'\n}\n\n/**\n * Returns true when `value` looks like a Zod v3 schema (has\n * `_def.typeName: string`). Kept distinct from `isZodV4SchemaShape`\n * because some v4 schemas also expose `_def` for backward compat —\n * the v4 detector wins first in `isZodSchemaShape`.\n */\nexport function isZodV3SchemaShape(value: unknown): value is ZodV3Shape {\n if (typeof value !== 'object' || value === null) return false\n const def = (value as { _def?: unknown })._def\n if (typeof def !== 'object' || def === null) return false\n return typeof (def as { typeName?: unknown }).typeName === 'string'\n}\n","/**\n * Unified `useForm` for the `attaform/zod` entry. Runtime-dispatches\n * on schema shape: a Zod v4 schema (`def.type` truthy) routes to the\n * v4 adapter; a Zod v3 schema (or any other `AbstractSchema`) routes\n * to the v3 wrapper, which already accepts both Zod v3 input and\n * `AbstractSchema` directly via its built-in shape branch.\n *\n * Type-level dispatch happens via TWO typed overloads — v4 first, v3\n * second — plus an untyped impl. Each overload mirrors the matching\n * direct adapter's signature exactly, so a v4-schema call site pays\n * the same per-call depth cost as importing from `attaform/zod-v4`\n * directly. Overload resolution at concrete call sites commits to one\n * overload immediately on argument shape — no type-level dispatch tax.\n *\n * Tests and other call sites that need the equivalent of\n * `typeof useForm<X>` should reach for the `UseFormReturn<X>` /\n * `UseFormConfig<X>` helpers in `types-api.ts` — instantiation\n * expressions on overloaded functions follow brittle resolution rules,\n * and the helper types give a deterministic projection.\n *\n * This module is the FALLBACK path. Vite consumers see the\n * `attaform/vite` plugin's `resolveId` hook rewrite `attaform/zod`\n * imports to either `attaform/zod-v3` or `attaform/zod-v4` at build\n * time — in that case this dispatch never runs and the consumer\n * bundle ships only the matching adapter. Other bundlers (and\n * non-bundled ESM consumption) hit this dispatch instead, paying a\n * modest size cost for the convenience of a single hello-world import.\n *\n * Power users who want a guaranteed lean bundle on non-Vite tooling\n * can import directly from `attaform/zod-v3` or `attaform/zod-v4` —\n * those subpaths are never rewritten and never load the other\n * adapter.\n */\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport type { ZodV4Internals } from './types-zod-major'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type {\n AbstractSchema,\n FormKey,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { AcceptableDefaults } from '../../types/types-core'\nimport type { SupportedRootSchema as SupportedRootSchemaV4 } from '../zod-v4/types-root'\nimport type { SupportedRootSchema as SupportedRootSchemaV3 } from '../zod-v3/types-root'\nimport type {\n V3FormOf,\n V3OutOf,\n V3ReadOf,\n V3SchemaInput,\n V4FormOf,\n V4OutOf,\n V4ReadOf,\n V4SchemaInput,\n} from './types-projections'\n\n/**\n * Create a form bound to a Zod v4 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * The constraint intersects `ZodV4Internals` (the v4-only `_zod`\n * brand) so a v3 schema can't bind this overload even when `z`\n * resolves to v3 in a single-major consumer install; v3 schemas fall\n * through to the v3 overload below. See `types-zod-major.ts`.\n */\nexport function useForm<\n Schema extends SupportedRootSchemaV4 & ZodV4Internals,\n K extends FormKey = FormKey,\n>(\n configuration: Omit<\n UseFormConfiguration<\n V4FormOf<Schema>,\n V4OutOf<Schema>,\n AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>,\n // `defaultValues` is Omitted below and re-supplied via the\n // `AcceptableDefaults` intersection, so this `DefaultValues` slot is\n // inert. `never` keeps it from re-instantiating the deep\n // `DefaultValuesInput` cascade here — that redundant instantiation,\n // across both overloads at a concrete call site, tips the bundled\n // `.d.ts` into TS2589.\n never,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'\n > & {\n schema: Schema\n // #422: the `AcceptableDefaults` slot adds the schema's own input\n // (`V4SchemaInput<Schema>`) as a reflexive escape arm so a generic form\n // wrapper forwarding `defaultValues` does not trip TS2589 / TS2769.\n // The arm is redundant at concrete call sites (a schema's input is a\n // subset of its `DefaultValuesInput`), so concrete checking is\n // unchanged. The return type never references the slot, so field\n // inference is preserved through the wrapper. See `AcceptableDefaults`.\n defaultValues?: AcceptableDefaults<V4FormOf<Schema>, V4SchemaInput<Schema>>\n } & ValidateOnConfig\n): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>\n/**\n * Create a form bound to a Zod v3 schema.\n *\n * ```ts\n * import { useForm } from 'attaform/zod'\n * import { z } from 'zod-v3'\n *\n * const form = useForm({\n * schema: z.object({\n * username: z.string().min(2, 'At least 2 characters'),\n * password: z.string().min(8, 'At least 8 characters'),\n * }),\n * })\n * ```\n *\n * v3 schemas match this overload; v4 schemas hit the v4 overload\n * above first and never reach here.\n */\nexport function useForm<Schema extends SupportedRootSchemaV3, K extends FormKey = FormKey>(\n configuration: Omit<\n UseFormConfiguration<\n V3FormOf<Schema>,\n V3OutOf<Schema>,\n AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>,\n // Inert `DefaultValues` slot — see the v4 overload above.\n never,\n K\n >,\n 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'\n > & {\n schema: Schema\n // #422 — see the v4 overload above for the escape-arm rationale.\n defaultValues?: AcceptableDefaults<V3FormOf<Schema>, V3SchemaInput<Schema>>\n } & ValidateOnConfig\n): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useForm(configuration: any): any {\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4>[0])\n }\n return useFormV3(configuration as Parameters<typeof useFormV3>[0])\n}\n","/**\n * Field-metadata write/read API for the unified `attaform/zod` entry.\n *\n * Storage is shared with both adapters via `field-meta-store` — a\n * payload written here is visible to whichever adapter the unified\n * `useForm` dispatches to at runtime, regardless of Zod major. No\n * `zod` runtime import; the type-only `import type` is erased at\n * build, so `attaform/zod` carries no `z.registry` reference even\n * when consumed by a Zod 3 project without the Vite plugin alias.\n *\n * The native v4 chain `schema.register(fieldMeta, payload)` continues\n * to work — Zod 4's `.register()` only calls `.add(this, payload)`\n * structurally, satisfied by the shared store.\n */\nimport type { z } from 'zod'\nimport type { FieldMetaPayload } from '../../core/field-meta'\nimport { fieldMetaStore, getFieldMetaForSchema } from '../../core/field-meta-store'\n\n// Zod v4's `$ZodRegistry` class isn't surfaced under the `z` namespace\n// of the classic external entry, but `z.registry()` returns one — so\n// `ReturnType<typeof z.registry<T>>` resolves to the registry type\n// without needing a direct import. The `import type` keeps the\n// reference type-only; nothing about `z.registry` lands in the bundle.\ntype ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>\n\n/**\n * The shared registry every Attaform-aware Zod schema can register\n * field metadata against, regardless of major. Same instance the v3\n * and v4 adapter entries expose — write in one place, read from\n * any.\n *\n * Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native\n * `schema.register(fieldMeta, payload)` chain type-checks for v4\n * users; the runtime call only needs `.add` structurally, which the\n * shared store provides.\n */\nexport const fieldMeta = fieldMetaStore as unknown as ZodFieldMetaRegistry\n\n/**\n * Attach `payload` to `schema` in the shared registry and return a\n * clone of `schema` so each call gets its own identity (the registry\n * keys on schema reference, so cloning prevents last-write-wins\n * collisions for sub-schemas reused at multiple paths).\n *\n * Works on both Zod 3 and Zod 4 schemas — branches on the runtime\n * shape of the schema:\n * - Zod 4 schemas expose a public `.clone()` method; we call it.\n * - Zod 3 schemas don't, so we reconstruct via\n * `new schema.constructor(schema._def)`.\n *\n * Both forms produce a fresh schema with the same effective\n * structure, so the registry slot is unique to this call site.\n */\nexport function withMeta<S>(schema: S, payload: FieldMetaPayload): S {\n const target = schema as object\n const existing = getFieldMetaForSchema(target) ?? {}\n const cloned = cloneSchema(schema)\n fieldMetaStore.add(cloned as object, { ...existing, ...payload })\n return cloned\n}\n\nfunction cloneSchema<S>(schema: S): S {\n const candidate = schema as { clone?: unknown; constructor: unknown; _def: unknown }\n if (typeof candidate.clone === 'function') {\n return (candidate.clone as () => S)()\n }\n // Zod 3 path: reconstruct via constructor + _def (no public\n // `.clone()` on v3).\n const Ctor = candidate.constructor as new (def: unknown) => S\n return new Ctor(candidate._def)\n}\n"],"names":["InvalidUseFormConfigError","useFormV4","useFormV3","fieldMetaStore","getFieldMetaForSchema"],"mappings":";;;;;;;;AAwCO,SAAS,mBAAmB,KAAA,EAAqC;AACtE,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,MAAM,OAAO,KAAA;AACxD,EAAA,MAAM,MAAO,KAAA,CAA4B,GAAA;AACzC,EAAA,IAAI,OAAO,GAAA,KAAQ,QAAA,IAAY,GAAA,KAAQ,MAAM,OAAO,KAAA;AACpD,EAAA,OAAO,OAAQ,IAA2B,IAAA,KAAS,QAAA;AACrD;;ACqGO,SAAS,QAAQ,aAAA,EAAyB;AAC/C,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAIA,+BAAA,EAA0B;AAAA,EACtC;AACA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOC,cAAU,aAAgD,CAAA;AAAA,EACnE;AACA,EAAA,OAAOC,kBAAU,aAAgD,CAAA;AACnE;;AC3HO,MAAM,SAAA,GAAYC;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAWC,mCAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAAD,4BAAA,CAAe,IAAI,MAAA,EAAkB,EAAE,GAAG,QAAA,EAAU,GAAG,SAAS,CAAA;AAChE,EAAA,OAAO,MAAA;AACT;AAEA,SAAS,YAAe,MAAA,EAAc;AACpC,EAAA,MAAM,SAAA,GAAY,MAAA;AAClB,EAAA,IAAI,OAAO,SAAA,CAAU,KAAA,KAAU,UAAA,EAAY;AACzC,IAAA,OAAQ,UAAU,KAAA,EAAkB;AAAA,EACtC;AAGA,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,OAAO,IAAI,IAAA,CAAK,SAAA,CAAU,IAAI,CAAA;AAChC;;;;;;;;;;;;;;"}
|
package/dist/zod.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema,
|
|
2
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
3
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.
|
|
4
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
1
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType, D as DefaultValuesInput, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.cjs';
|
|
2
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.cjs';
|
|
3
|
+
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.Bx6pgrIy.cjs';
|
|
4
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.Bx6pgrIy.cjs';
|
|
5
5
|
import { S as SupportedRootSchema$1, U as UnwrapZodRoot, a as StorageShape$1 } from './shared/attaform.DdjDqTah.cjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
7
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.DHjRN5JP.cjs';
|
|
8
8
|
import 'vue';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -61,6 +61,20 @@ type ZodV4Internals = {
|
|
|
61
61
|
* call sites.
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* The schema's own input type, exactly as a consumer would reference it
|
|
66
|
+
* (`z.input<S>`) — NOT routed through `GenericForm` / `UnwrapZodRoot`. This
|
|
67
|
+
* is the reflexive escape arm `AcceptableDefaults` adds to the
|
|
68
|
+
* `defaultValues` slot so a generic form wrapper forwarding `z.input<S>`
|
|
69
|
+
* type-checks under a free `S` (#422). It must stay syntactically identical
|
|
70
|
+
* to what the wrapper forwards: wrapping it in a conditional makes it a
|
|
71
|
+
* deferred conditional that no longer matches the forwarded value under a
|
|
72
|
+
* generic. Wrong-major schemas can't actually bind the slot — they are
|
|
73
|
+
* rejected at the overload's `schema` constraint — so the raw input never
|
|
74
|
+
* widens the slot for the wrong major.
|
|
75
|
+
*/
|
|
76
|
+
type V4SchemaInput<S extends SupportedRootSchema> = z.input<S>;
|
|
77
|
+
type V3SchemaInput<S extends SupportedRootSchema$1> = z.input<S>;
|
|
64
78
|
type V4FormOf<S extends SupportedRootSchema> = z.input<S> extends GenericForm ? z.input<S> : never;
|
|
65
79
|
type V4OutOf<S extends SupportedRootSchema> = z.output<S> extends GenericForm ? z.output<S> : never;
|
|
66
80
|
type V4ReadOf<S extends SupportedRootSchema> = StorageShape<S> extends GenericForm ? StorageShape<S> : never;
|
|
@@ -88,8 +102,9 @@ type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>
|
|
|
88
102
|
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
89
103
|
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
90
104
|
*/
|
|
91
|
-
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>,
|
|
105
|
+
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
92
106
|
schema: Schema;
|
|
107
|
+
defaultValues?: AcceptableDefaults<V4FormOf<Schema>, V4SchemaInput<Schema>>;
|
|
93
108
|
} & ValidateOnConfig): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
94
109
|
/**
|
|
95
110
|
* Create a form bound to a Zod v3 schema.
|
|
@@ -109,8 +124,9 @@ declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K
|
|
|
109
124
|
* v3 schemas match this overload; v4 schemas hit the v4 overload
|
|
110
125
|
* above first and never reach here.
|
|
111
126
|
*/
|
|
112
|
-
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>,
|
|
127
|
+
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
113
128
|
schema: Schema;
|
|
129
|
+
defaultValues?: AcceptableDefaults<V3FormOf<Schema>, V3SchemaInput<Schema>>;
|
|
114
130
|
} & ValidateOnConfig): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
115
131
|
|
|
116
132
|
/**
|
package/dist/zod.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema,
|
|
2
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
3
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.
|
|
4
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
1
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType, D as DefaultValuesInput, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.mjs';
|
|
2
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.mjs';
|
|
3
|
+
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.DvqdxvNU.mjs';
|
|
4
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.DvqdxvNU.mjs';
|
|
5
5
|
import { S as SupportedRootSchema$1, U as UnwrapZodRoot, a as StorageShape$1 } from './shared/attaform.DdjDqTah.mjs';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
7
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.0zueP54D.mjs';
|
|
8
8
|
import 'vue';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -61,6 +61,20 @@ type ZodV4Internals = {
|
|
|
61
61
|
* call sites.
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* The schema's own input type, exactly as a consumer would reference it
|
|
66
|
+
* (`z.input<S>`) — NOT routed through `GenericForm` / `UnwrapZodRoot`. This
|
|
67
|
+
* is the reflexive escape arm `AcceptableDefaults` adds to the
|
|
68
|
+
* `defaultValues` slot so a generic form wrapper forwarding `z.input<S>`
|
|
69
|
+
* type-checks under a free `S` (#422). It must stay syntactically identical
|
|
70
|
+
* to what the wrapper forwards: wrapping it in a conditional makes it a
|
|
71
|
+
* deferred conditional that no longer matches the forwarded value under a
|
|
72
|
+
* generic. Wrong-major schemas can't actually bind the slot — they are
|
|
73
|
+
* rejected at the overload's `schema` constraint — so the raw input never
|
|
74
|
+
* widens the slot for the wrong major.
|
|
75
|
+
*/
|
|
76
|
+
type V4SchemaInput<S extends SupportedRootSchema> = z.input<S>;
|
|
77
|
+
type V3SchemaInput<S extends SupportedRootSchema$1> = z.input<S>;
|
|
64
78
|
type V4FormOf<S extends SupportedRootSchema> = z.input<S> extends GenericForm ? z.input<S> : never;
|
|
65
79
|
type V4OutOf<S extends SupportedRootSchema> = z.output<S> extends GenericForm ? z.output<S> : never;
|
|
66
80
|
type V4ReadOf<S extends SupportedRootSchema> = StorageShape<S> extends GenericForm ? StorageShape<S> : never;
|
|
@@ -88,8 +102,9 @@ type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>
|
|
|
88
102
|
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
89
103
|
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
90
104
|
*/
|
|
91
|
-
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>,
|
|
105
|
+
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
92
106
|
schema: Schema;
|
|
107
|
+
defaultValues?: AcceptableDefaults<V4FormOf<Schema>, V4SchemaInput<Schema>>;
|
|
93
108
|
} & ValidateOnConfig): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
94
109
|
/**
|
|
95
110
|
* Create a form bound to a Zod v3 schema.
|
|
@@ -109,8 +124,9 @@ declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K
|
|
|
109
124
|
* v3 schemas match this overload; v4 schemas hit the v4 overload
|
|
110
125
|
* above first and never reach here.
|
|
111
126
|
*/
|
|
112
|
-
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>,
|
|
127
|
+
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
113
128
|
schema: Schema;
|
|
129
|
+
defaultValues?: AcceptableDefaults<V3FormOf<Schema>, V3SchemaInput<Schema>>;
|
|
114
130
|
} & ValidateOnConfig): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
115
131
|
|
|
116
132
|
/**
|
package/dist/zod.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema,
|
|
2
|
-
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
3
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.
|
|
4
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
1
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, a as AbstractSchema, ar as AcceptableDefaults, af as ValidateOnConfig, b as UseFormReturnType, D as DefaultValuesInput, q as FieldMetaPayload } from './shared/attaform.DUc6cetN.js';
|
|
2
|
+
export { ad as Unset, ao as isUnset, aq as unset } from './shared/attaform.DUc6cetN.js';
|
|
3
|
+
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.BjiHiYAZ.js';
|
|
4
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.BjiHiYAZ.js';
|
|
5
5
|
import { S as SupportedRootSchema$1, U as UnwrapZodRoot, a as StorageShape$1 } from './shared/attaform.DdjDqTah.js';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.
|
|
7
|
+
export { b as AnyForm, c as AttaformErrorCode, C as CompiledStep, F as FormStatus, I as InjectWizardInput, L as LazyMarker, d as StepSlot, U as UseRegisterReturn, e as UseWizardReturnType, W as WizardAggregateError, f as WizardCtx, g as WizardCtxForm, h as WizardOnError, i as WizardOnSubmit, j as WizardOptions, k as WizardPersistFn, l as WizardRestoreFn, m as WizardRestoreState, n as WizardStatusesProxy, o as WizardSubmitContext, t as injectForm, u as injectWizard, w as lazy, x as useRegister, z as useWizard } from './shared/attaform.yqcYwt0d.js';
|
|
8
8
|
import 'vue';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -61,6 +61,20 @@ type ZodV4Internals = {
|
|
|
61
61
|
* call sites.
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* The schema's own input type, exactly as a consumer would reference it
|
|
66
|
+
* (`z.input<S>`) — NOT routed through `GenericForm` / `UnwrapZodRoot`. This
|
|
67
|
+
* is the reflexive escape arm `AcceptableDefaults` adds to the
|
|
68
|
+
* `defaultValues` slot so a generic form wrapper forwarding `z.input<S>`
|
|
69
|
+
* type-checks under a free `S` (#422). It must stay syntactically identical
|
|
70
|
+
* to what the wrapper forwards: wrapping it in a conditional makes it a
|
|
71
|
+
* deferred conditional that no longer matches the forwarded value under a
|
|
72
|
+
* generic. Wrong-major schemas can't actually bind the slot — they are
|
|
73
|
+
* rejected at the overload's `schema` constraint — so the raw input never
|
|
74
|
+
* widens the slot for the wrong major.
|
|
75
|
+
*/
|
|
76
|
+
type V4SchemaInput<S extends SupportedRootSchema> = z.input<S>;
|
|
77
|
+
type V3SchemaInput<S extends SupportedRootSchema$1> = z.input<S>;
|
|
64
78
|
type V4FormOf<S extends SupportedRootSchema> = z.input<S> extends GenericForm ? z.input<S> : never;
|
|
65
79
|
type V4OutOf<S extends SupportedRootSchema> = z.output<S> extends GenericForm ? z.output<S> : never;
|
|
66
80
|
type V4ReadOf<S extends SupportedRootSchema> = StorageShape<S> extends GenericForm ? StorageShape<S> : never;
|
|
@@ -88,8 +102,9 @@ type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>
|
|
|
88
102
|
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
89
103
|
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
90
104
|
*/
|
|
91
|
-
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>,
|
|
105
|
+
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
92
106
|
schema: Schema;
|
|
107
|
+
defaultValues?: AcceptableDefaults<V4FormOf<Schema>, V4SchemaInput<Schema>>;
|
|
93
108
|
} & ValidateOnConfig): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
94
109
|
/**
|
|
95
110
|
* Create a form bound to a Zod v3 schema.
|
|
@@ -109,8 +124,9 @@ declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K
|
|
|
109
124
|
* v3 schemas match this overload; v4 schemas hit the v4 overload
|
|
110
125
|
* above first and never reach here.
|
|
111
126
|
*/
|
|
112
|
-
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>,
|
|
127
|
+
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
113
128
|
schema: Schema;
|
|
129
|
+
defaultValues?: AcceptableDefaults<V3FormOf<Schema>, V3SchemaInput<Schema>>;
|
|
114
130
|
} & ValidateOnConfig): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
115
131
|
|
|
116
132
|
/**
|
package/dist/zod.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as InvalidUseFormConfigError } from './shared/attaform.C0au8oXd.mjs';
|
|
2
|
-
import { u as useForm$2 } from './shared/attaform.
|
|
3
|
-
import { u as useForm$1 } from './shared/attaform.
|
|
4
|
-
import { f as fieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.
|
|
5
|
-
export { A as AttaformErrorCode, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, c as useRegister, d as useWizard } from './shared/attaform.
|
|
2
|
+
import { u as useForm$2 } from './shared/attaform.B_-nZHtM.mjs';
|
|
3
|
+
import { u as useForm$1 } from './shared/attaform.K1MbxmIu.mjs';
|
|
4
|
+
import { f as fieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.BjUaX7s8.mjs';
|
|
5
|
+
export { A as AttaformErrorCode, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, c as useRegister, d as useWizard } from './shared/attaform.BI7M3wK8.mjs';
|
|
6
6
|
|
|
7
7
|
function isZodV4SchemaShape(value) {
|
|
8
8
|
if (typeof value !== "object" || value === null) return false;
|