attaform 0.27.6 → 0.29.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/abstract.d.mts +5 -4
- package/dist/abstract.mjs +4 -3
- package/dist/chunks/fingerprint.mjs +1 -2
- package/dist/chunks/fingerprint2.mjs +2 -3
- package/dist/dev/abstract.mjs +4 -0
- package/dist/{chunks → dev/chunks}/dev-key-collision-warnings.mjs +0 -1
- package/dist/{chunks → dev/chunks}/devtools.mjs +5 -6
- package/dist/{chunks/fingerprint.cjs → dev/chunks/fingerprint.mjs} +7 -10
- package/dist/{chunks/fingerprint2.cjs → dev/chunks/fingerprint2.mjs} +32 -35
- package/dist/dev/directive.mjs +1 -0
- package/dist/dev/history.mjs +89 -0
- package/dist/dev/index.mjs +5 -0
- package/dist/dev/runtime/plugins/attaform.mjs +40 -0
- package/dist/dev/shared/attaform-dev.A-TpJW0B.mjs +207 -0
- package/dist/dev/shared/attaform-dev.BO-71R54.mjs +820 -0
- package/dist/{shared/attaform.D6tk90Rc.cjs → dev/shared/attaform-dev.BgM6FdtA.mjs} +324 -73
- package/dist/dev/shared/attaform-dev.ButTkwHd.mjs +375 -0
- package/dist/{shared/attaform.BJGA_UOS.mjs → dev/shared/attaform-dev.BxfsuwBR.mjs} +8 -1
- package/dist/{shared/attaform.nMaz2C5P.mjs → dev/shared/attaform-dev.D8aoKb89.mjs} +190 -400
- package/dist/dev/shared/attaform-dev.DD5m2W51.mjs +220 -0
- package/dist/{shared/attaform.CKH2lGdL.mjs → dev/shared/attaform-dev.DHuydLAC.mjs} +3867 -4731
- package/dist/{shared/attaform.DYEr28Pt.mjs → dev/shared/attaform-dev.DrzObAZo.mjs} +6 -7
- package/dist/{shared/attaform.B1ZYt2Li.mjs → dev/shared/attaform-dev.q6UutkCx.mjs} +274 -672
- package/dist/dev/zod-v3.mjs +17 -0
- package/dist/dev/zod-v4.mjs +16 -0
- package/dist/dev/zod.mjs +5 -0
- package/dist/directive.d.mts +20 -0
- package/dist/directive.mjs +1 -0
- package/dist/esbuild.mjs +0 -1
- package/dist/history.d.mts +59 -0
- package/dist/history.mjs +89 -0
- package/dist/index.d.mts +14 -6
- package/dist/index.mjs +5 -4
- package/dist/nuxt.d.mts +10 -10
- package/dist/nuxt.mjs +5 -2
- package/dist/rollup.mjs +0 -1
- package/dist/rspack.d.mts +6 -1
- package/dist/rspack.mjs +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +9 -8
- package/dist/runtime/plugins/attaform.mjs +1 -2
- package/dist/shared/{attaform.CoR4mWfv.mjs → attaform.B0dKL8ST.mjs} +309 -46
- package/dist/shared/{attaform.Cs2Rbdlo.mjs → attaform.BK0cgu2K.mjs} +123 -140
- package/dist/shared/{attaform.B9Wyhfro.cjs → attaform.BndjUUYX.mjs} +11 -16
- package/dist/shared/{attaform.CQN9R62B.cjs → attaform.BxfsuwBR.mjs} +9 -4
- package/dist/shared/attaform.C2MVyuxC.mjs +811 -0
- package/dist/shared/{attaform.Fp3sCrVs.d.ts → attaform.CIWLMY-R.d.mts} +2 -2
- package/dist/shared/attaform.CZMAYwSK.mjs +6383 -0
- package/dist/shared/attaform.CZYt_5N_.mjs +207 -0
- package/dist/shared/{attaform.DniawQLP.d.cts → attaform.CsoeRi3P.d.mts} +490 -98
- package/dist/shared/attaform.Cvao8bW5.mjs +358 -0
- package/dist/shared/attaform.D0x-qSXm.mjs +197 -0
- package/dist/shared/{attaform.D8kliaKw.cjs → attaform.D1fnTifF.mjs} +279 -692
- package/dist/shared/{attaform.CHlJLAiv.d.mts → attaform.DDtqHYv1.d.mts} +155 -184
- package/dist/shared/{attaform.Biytrv0-.cjs → attaform.DffRL5pP.mjs} +215 -547
- package/dist/shared/attaform.DhnPb6nK.mjs +0 -1
- package/dist/shared/attaform.KvlEedlF.mjs +0 -1
- package/dist/shared/attaform.axHXVQO7.d.mts +44 -0
- package/dist/shared/attaform.v0fQtWyA.mjs +0 -1
- package/dist/transforms.d.mts +0 -22
- package/dist/transforms.mjs +1 -2
- package/dist/vite.d.mts +30 -9
- package/dist/vite.mjs +27 -4
- package/dist/webpack.d.mts +6 -1
- package/dist/webpack.mjs +0 -1
- package/dist/zod-v3.d.mts +13 -6
- package/dist/zod-v3.mjs +17 -4
- package/dist/zod-v4.d.mts +19 -26
- package/dist/zod-v4.mjs +16 -4
- package/dist/zod.d.mts +4 -3
- package/dist/zod.mjs +5 -4
- package/package.json +38 -20
- package/skills/attaform/SKILL.md +6 -2
- package/skills/attaform/references/custom-components.md +7 -2
- package/skills/attaform/references/errors.md +8 -3
- package/skills/attaform/references/saving.md +77 -0
- package/skills/attaform/references/wizards.md +10 -8
- package/dist/abstract.cjs +0 -48
- package/dist/abstract.cjs.map +0 -1
- package/dist/abstract.d.cts +0 -42
- package/dist/abstract.d.ts +0 -42
- package/dist/abstract.mjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.cjs +0 -25
- package/dist/chunks/dev-key-collision-warnings.cjs.map +0 -1
- package/dist/chunks/dev-key-collision-warnings.mjs.map +0 -1
- package/dist/chunks/devtools.cjs +0 -157
- package/dist/chunks/devtools.cjs.map +0 -1
- package/dist/chunks/devtools.mjs.map +0 -1
- package/dist/chunks/fingerprint.cjs.map +0 -1
- package/dist/chunks/fingerprint.mjs.map +0 -1
- package/dist/chunks/fingerprint2.cjs.map +0 -1
- package/dist/chunks/fingerprint2.mjs.map +0 -1
- package/dist/esbuild.cjs +0 -28
- package/dist/esbuild.cjs.map +0 -1
- package/dist/esbuild.d.cts +0 -56
- package/dist/esbuild.d.ts +0 -56
- package/dist/esbuild.mjs.map +0 -1
- package/dist/index.cjs +0 -51
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -249
- package/dist/index.d.ts +0 -249
- package/dist/index.mjs.map +0 -1
- package/dist/nuxt.cjs +0 -84
- package/dist/nuxt.cjs.map +0 -1
- package/dist/nuxt.d.cts +0 -66
- package/dist/nuxt.d.ts +0 -66
- package/dist/nuxt.mjs.map +0 -1
- package/dist/rollup.cjs +0 -24
- package/dist/rollup.cjs.map +0 -1
- package/dist/rollup.d.cts +0 -35
- package/dist/rollup.d.ts +0 -35
- package/dist/rollup.mjs.map +0 -1
- package/dist/rspack.cjs +0 -10
- package/dist/rspack.cjs.map +0 -1
- package/dist/rspack.d.cts +0 -40
- package/dist/rspack.d.ts +0 -40
- package/dist/rspack.mjs.map +0 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue.d.ts +0 -7
- package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +0 -35
- package/dist/runtime/plugins/attaform.cjs +0 -43
- package/dist/runtime/plugins/attaform.cjs.map +0 -1
- package/dist/runtime/plugins/attaform.d.cts +0 -5
- package/dist/runtime/plugins/attaform.d.ts +0 -5
- package/dist/runtime/plugins/attaform.mjs.map +0 -1
- package/dist/shared/attaform.B1ZYt2Li.mjs.map +0 -1
- package/dist/shared/attaform.B9Wyhfro.cjs.map +0 -1
- package/dist/shared/attaform.BGDV42hI.d.cts +0 -232
- package/dist/shared/attaform.BJGA_UOS.mjs.map +0 -1
- package/dist/shared/attaform.Biytrv0-.cjs.map +0 -1
- package/dist/shared/attaform.Bn0IzhD_.cjs +0 -800
- package/dist/shared/attaform.Bn0IzhD_.cjs.map +0 -1
- package/dist/shared/attaform.C9fPTxjB.d.cts +0 -41
- package/dist/shared/attaform.C9fPTxjB.d.ts +0 -41
- package/dist/shared/attaform.CKH2lGdL.mjs.map +0 -1
- package/dist/shared/attaform.CQN9R62B.cjs.map +0 -1
- package/dist/shared/attaform.CoR4mWfv.mjs.map +0 -1
- package/dist/shared/attaform.Cs2Rbdlo.mjs.map +0 -1
- package/dist/shared/attaform.D6tk90Rc.cjs.map +0 -1
- package/dist/shared/attaform.D8kliaKw.cjs.map +0 -1
- package/dist/shared/attaform.DLknk9nF.d.mts +0 -232
- package/dist/shared/attaform.DMxM2kol.mjs +0 -1275
- package/dist/shared/attaform.DMxM2kol.mjs.map +0 -1
- package/dist/shared/attaform.DRUT703x.d.cts +0 -56
- package/dist/shared/attaform.DRUT703x.d.ts +0 -56
- package/dist/shared/attaform.DYEr28Pt.mjs.map +0 -1
- package/dist/shared/attaform.DdQN7sgN.cjs +0 -1302
- package/dist/shared/attaform.DdQN7sgN.cjs.map +0 -1
- package/dist/shared/attaform.DhnPb6nK.mjs.map +0 -1
- package/dist/shared/attaform.DniawQLP.d.mts +0 -4763
- package/dist/shared/attaform.DniawQLP.d.ts +0 -4763
- package/dist/shared/attaform.DoQm_Vkd.cjs +0 -58
- package/dist/shared/attaform.DoQm_Vkd.cjs.map +0 -1
- package/dist/shared/attaform.DrvMscNX.cjs +0 -7697
- package/dist/shared/attaform.DrvMscNX.cjs.map +0 -1
- package/dist/shared/attaform.F2Q8iv38.d.ts +0 -2494
- package/dist/shared/attaform.FmqKO1Ex.d.cts +0 -2494
- package/dist/shared/attaform.KvlEedlF.mjs.map +0 -1
- package/dist/shared/attaform.RaTzp1WF.cjs +0 -26
- package/dist/shared/attaform.RaTzp1WF.cjs.map +0 -1
- package/dist/shared/attaform.nMaz2C5P.mjs.map +0 -1
- package/dist/shared/attaform.v0fQtWyA.mjs.map +0 -1
- package/dist/shared/attaform.yUrz7C2z.cjs +0 -29
- package/dist/shared/attaform.yUrz7C2z.cjs.map +0 -1
- package/dist/transforms.cjs +0 -12
- package/dist/transforms.cjs.map +0 -1
- package/dist/transforms.d.cts +0 -73
- package/dist/transforms.d.ts +0 -73
- package/dist/transforms.mjs.map +0 -1
- package/dist/vite.cjs +0 -363
- package/dist/vite.cjs.map +0 -1
- package/dist/vite.d.cts +0 -133
- package/dist/vite.d.ts +0 -133
- package/dist/vite.mjs.map +0 -1
- package/dist/webpack.cjs +0 -10
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.d.cts +0 -37
- package/dist/webpack.d.ts +0 -37
- package/dist/webpack.mjs.map +0 -1
- package/dist/zod-v3.cjs +0 -53
- package/dist/zod-v3.cjs.map +0 -1
- package/dist/zod-v3.d.cts +0 -246
- package/dist/zod-v3.d.ts +0 -246
- package/dist/zod-v3.mjs.map +0 -1
- package/dist/zod-v4.cjs +0 -55
- package/dist/zod-v4.cjs.map +0 -1
- package/dist/zod-v4.d.cts +0 -172
- package/dist/zod-v4.d.ts +0 -172
- package/dist/zod-v4.mjs.map +0 -1
- package/dist/zod.cjs +0 -51
- package/dist/zod.cjs.map +0 -1
- package/dist/zod.d.cts +0 -7
- package/dist/zod.d.ts +0 -7
- package/dist/zod.mjs.map +0 -1
package/dist/index.cjs
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const devtoolsShared = require('./shared/attaform.Biytrv0-.cjs');
|
|
4
|
-
const serializeScript = require('./shared/attaform.DrvMscNX.cjs');
|
|
5
|
-
const fieldMeta = require('./shared/attaform.B9Wyhfro.cjs');
|
|
6
|
-
const registerProtocol = require('./shared/attaform.yUrz7C2z.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.AttaformError = devtoolsShared.AttaformError;
|
|
11
|
-
exports.DEVTOOLS_WINDOW_KEY = devtoolsShared.DEVTOOLS_WINDOW_KEY;
|
|
12
|
-
exports.InvalidPathError = devtoolsShared.InvalidPathError;
|
|
13
|
-
exports.InvalidUseFormConfigError = devtoolsShared.InvalidUseFormConfigError;
|
|
14
|
-
exports.OutsideSetupError = devtoolsShared.OutsideSetupError;
|
|
15
|
-
exports.ROOT_PATH = devtoolsShared.ROOT_PATH;
|
|
16
|
-
exports.ROOT_PATH_KEY = devtoolsShared.ROOT_PATH_KEY;
|
|
17
|
-
exports.RegistryNotInstalledError = devtoolsShared.RegistryNotInstalledError;
|
|
18
|
-
exports.ReservedFormKeyError = devtoolsShared.ReservedFormKeyError;
|
|
19
|
-
exports.SubmitErrorHandlerError = devtoolsShared.SubmitErrorHandlerError;
|
|
20
|
-
exports.assignKey = devtoolsShared.assignKey;
|
|
21
|
-
exports.canonicalizePath = devtoolsShared.canonicalizePath;
|
|
22
|
-
exports.createAttaform = devtoolsShared.createAttaform;
|
|
23
|
-
exports.createRegistry = devtoolsShared.createRegistry;
|
|
24
|
-
exports.getRegistryFromApp = devtoolsShared.getRegistryFromApp;
|
|
25
|
-
exports.hydrateAttaformState = devtoolsShared.hydrateAttaformState;
|
|
26
|
-
exports.isPathPrefix = devtoolsShared.isPathPrefix;
|
|
27
|
-
exports.kAttaformRegistry = devtoolsShared.kAttaformRegistry;
|
|
28
|
-
exports.parseDottedPath = devtoolsShared.parseDottedPath;
|
|
29
|
-
exports.renderAttaformState = devtoolsShared.renderAttaformState;
|
|
30
|
-
exports.useRegistry = devtoolsShared.useRegistry;
|
|
31
|
-
exports.vRegister = devtoolsShared.vRegister;
|
|
32
|
-
exports.AttaformErrorCode = serializeScript.AttaformErrorCode;
|
|
33
|
-
exports.DEFAULT_TIMINGS = serializeScript.DEFAULT_TIMINGS;
|
|
34
|
-
exports.defaultCoercionRules = serializeScript.defaultCoercionRules;
|
|
35
|
-
exports.defaultDisplayState = serializeScript.defaultDisplayState;
|
|
36
|
-
exports.defineCoercion = serializeScript.defineCoercion;
|
|
37
|
-
exports.escapeForInlineScript = serializeScript.escapeForInlineScript;
|
|
38
|
-
exports.gate = serializeScript.gate;
|
|
39
|
-
exports.injectForm = serializeScript.injectForm;
|
|
40
|
-
exports.injectWizard = serializeScript.injectWizard;
|
|
41
|
-
exports.isUnset = serializeScript.isUnset;
|
|
42
|
-
exports.lazy = serializeScript.lazy;
|
|
43
|
-
exports.makeDefaultDisplayState = serializeScript.makeDefaultDisplayState;
|
|
44
|
-
exports.unset = serializeScript.unset;
|
|
45
|
-
exports.useRegister = serializeScript.useRegister;
|
|
46
|
-
exports.useWizard = serializeScript.useWizard;
|
|
47
|
-
exports.fieldMeta = fieldMeta.fieldMeta;
|
|
48
|
-
exports.useForm = fieldMeta.useForm;
|
|
49
|
-
exports.withMeta = fieldMeta.withMeta;
|
|
50
|
-
exports.isRegisterValue = registerProtocol.isRegisterValue;
|
|
51
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.cts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard, a3 as vRegister } from './shared/attaform.FmqKO1Ex.cjs';
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, aq as AcceptableDefaults, ae as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, o as FieldMetaPayload } from './shared/attaform.DniawQLP.cjs';
|
|
3
|
-
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as HistoryConfig, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as PartialFlatPath, S as Path, T as PathKey, V as PendingValidationStatus, W as Primitive, X as ROOT_PATH, Y as ROOT_PATH_KEY, Z as ReactiveValidationStatus, _ as RegisterDirective, $ as RegisterFlatPath, a0 as RegisterOptions, a1 as RegisterSelectModifier, a2 as RegisterTextModifier, a3 as RegisterTransform, a4 as RegisterValue, a5 as Segment, a6 as SetValueCallback, a7 as SetValuePayload, a8 as SettledValidationStatus, a9 as SlimPrimitiveKind, aa as SlimRuntimeOf, ab as SubmitHandler, ac as Unset, ad as ValidateOn, af as ValidationError, ag as ValidationResponse, ah as ValidationResponseWithoutValue, ai as ValueOfUnion, aj as WriteMeta, ak as WriteShape, al as canonicalizePath, am as isPathPrefix, an as isUnset, ao as parseDottedPath, ap as unset } from './shared/attaform.DniawQLP.cjs';
|
|
4
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.BGDV42hI.cjs';
|
|
5
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.BGDV42hI.cjs';
|
|
6
|
-
import { S as SupportedRootSchema$1, U as UnwrapZodRoot, a as StorageShape$1 } from './shared/attaform.DRUT703x.cjs';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import 'vue';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Type-level Zod-major discriminator for the unified `attaform/zod`
|
|
12
|
-
* entry. The runtime dispatch (`use-form.ts`'s impl) already routes on
|
|
13
|
-
* the schema's shape via `isZodV4SchemaShape`; this is the type-level
|
|
14
|
-
* mirror so the overloads and projection helpers discriminate the same
|
|
15
|
-
* way.
|
|
16
|
-
*
|
|
17
|
-
* Why a structural marker instead of `z.ZodObject`: the unified entry's
|
|
18
|
-
* overloads constrain on `z.ZodObject`, but the published `.d.mts`
|
|
19
|
-
* resolves `z` against whichever single Zod major the consumer
|
|
20
|
-
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
21
|
-
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
22
|
-
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
23
|
-
* overload's constraint and binds it — collapsing the read slot to
|
|
24
|
-
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
25
|
-
* schema never does.
|
|
26
|
-
* Intersecting a v4-only constraint or conditional branch with this
|
|
27
|
-
* marker keeps it unreachable for a v3 schema regardless of how `zod`
|
|
28
|
-
* resolves, so v3 schemas fall through to the v3 overload.
|
|
29
|
-
*
|
|
30
|
-
* Distinct from `core/zod-shape.ts`'s runtime `ZodV4Shape` (which reads
|
|
31
|
-
* the public `def` getter): at the type level the stable v4 brand is
|
|
32
|
-
* `_zod.def`, the same internals `StorageShape` (v4) already reads.
|
|
33
|
-
*
|
|
34
|
-
* Pairing requirement: a v4 overload/branch must constrain on
|
|
35
|
-
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
36
|
-
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
37
|
-
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
38
|
-
* arguments — an error type that behaves like `any` under
|
|
39
|
-
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
40
|
-
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
41
|
-
* keeps it a concrete object type in both majors, so the intersection
|
|
42
|
-
* stays meaningful.
|
|
43
|
-
*/
|
|
44
|
-
type ZodV4Internals = {
|
|
45
|
-
_zod: {
|
|
46
|
-
def: unknown;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Per-major projection helpers shared by the unified `attaform/zod`
|
|
52
|
-
* entry. Each maps an arbitrary Zod v4 OR v3 object schema to the
|
|
53
|
-
* `GenericForm`-shaped input / output / storage-read projections the
|
|
54
|
-
* form types are parameterised over. The constraint on each alias scopes
|
|
55
|
-
* `S` to one Zod major, so the projection is a direct read with no
|
|
56
|
-
* dispatch in the type body.
|
|
57
|
-
*
|
|
58
|
-
* Hoisted out of `types-unified.ts` and `use-form.ts` so the two entry
|
|
59
|
-
* points share one definition. Internal — consumer code never reaches
|
|
60
|
-
* for these; the overloaded `useForm` already gives full inference at
|
|
61
|
-
* call sites.
|
|
62
|
-
*/
|
|
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>;
|
|
78
|
-
type V4FormOf<S extends SupportedRootSchema> = z.input<S> extends GenericForm ? z.input<S> : never;
|
|
79
|
-
type V4OutOf<S extends SupportedRootSchema> = z.output<S> extends GenericForm ? z.output<S> : never;
|
|
80
|
-
type V4ReadOf<S extends SupportedRootSchema> = StorageShape<S> extends GenericForm ? StorageShape<S> : never;
|
|
81
|
-
type V3FormOf<S extends SupportedRootSchema$1> = z.input<UnwrapZodRoot<S>> extends GenericForm ? z.input<UnwrapZodRoot<S>> : never;
|
|
82
|
-
type V3OutOf<S extends SupportedRootSchema$1> = z.output<UnwrapZodRoot<S>> extends GenericForm ? z.output<UnwrapZodRoot<S>> : never;
|
|
83
|
-
type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>> extends GenericForm ? StorageShape$1<UnwrapZodRoot<S>> : never;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Create a form bound to a Zod v4 schema.
|
|
87
|
-
*
|
|
88
|
-
* ```ts
|
|
89
|
-
* import { useForm } from 'attaform/zod'
|
|
90
|
-
* import { z } from 'zod'
|
|
91
|
-
*
|
|
92
|
-
* const form = useForm({
|
|
93
|
-
* schema: z.object({
|
|
94
|
-
* username: z.string().min(2, 'At least 2 characters'),
|
|
95
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
96
|
-
* }),
|
|
97
|
-
* })
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* The constraint intersects `ZodV4Internals` (the v4-only `_zod`
|
|
101
|
-
* brand) so a v3 schema can't bind this overload even when `z`
|
|
102
|
-
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
103
|
-
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
104
|
-
*/
|
|
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'> & {
|
|
106
|
-
schema: Schema;
|
|
107
|
-
defaultValues?: AcceptableDefaults<V4FormOf<Schema>, V4SchemaInput<Schema>>;
|
|
108
|
-
} & ValidateOnConfig): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
109
|
-
/**
|
|
110
|
-
* Create a form bound to a Zod v3 schema.
|
|
111
|
-
*
|
|
112
|
-
* ```ts
|
|
113
|
-
* import { useForm } from 'attaform/zod'
|
|
114
|
-
* import { z } from 'zod-v3'
|
|
115
|
-
*
|
|
116
|
-
* const form = useForm({
|
|
117
|
-
* schema: z.object({
|
|
118
|
-
* username: z.string().min(2, 'At least 2 characters'),
|
|
119
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
120
|
-
* }),
|
|
121
|
-
* })
|
|
122
|
-
* ```
|
|
123
|
-
*
|
|
124
|
-
* v3 schemas match this overload; v4 schemas hit the v4 overload
|
|
125
|
-
* above first and never reach here.
|
|
126
|
-
*/
|
|
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'> & {
|
|
128
|
-
schema: Schema;
|
|
129
|
-
defaultValues?: AcceptableDefaults<V3FormOf<Schema>, V3SchemaInput<Schema>>;
|
|
130
|
-
} & ValidateOnConfig): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Type-level helpers for the unified `attaform/zod` entry. These give
|
|
134
|
-
* tests and other type-query call sites a deterministic projection
|
|
135
|
-
* over an arbitrary v4 OR v3 schema, sidestepping the brittle
|
|
136
|
-
* instantiation-expression resolution rules TypeScript applies to
|
|
137
|
-
* overloaded functions (`typeof useForm<X>` can pick the wrong
|
|
138
|
-
* overload or the impl signature, depending on whether the type
|
|
139
|
-
* argument is a concrete schema, a generic, or a constraint).
|
|
140
|
-
*
|
|
141
|
-
* The helpers dispatch ONCE per use site via a binary conditional —
|
|
142
|
-
* no stacking, no amplification across the return type. Equivalent
|
|
143
|
-
* to writing `ReturnType<typeof useForm<S>>` but cache-stable across
|
|
144
|
-
* call patterns.
|
|
145
|
-
*
|
|
146
|
-
* Per `inference-first DX`, these helpers are test- and
|
|
147
|
-
* internal-facing. Consumer code shouldn't reach for them — the
|
|
148
|
-
* overloaded `useForm` already gives full inference at call sites.
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Direct V4 projection — no major-dispatch. Use when the schema's
|
|
153
|
-
* Zod major is known statically (typical for V4 generic helpers like
|
|
154
|
-
* `function setup<S extends z.ZodObject>(s: S)`). TS simplifies the
|
|
155
|
-
* helper cleanly under generic constraints because no conditional
|
|
156
|
-
* is present.
|
|
157
|
-
*/
|
|
158
|
-
type UseFormReturnV4<Schema extends z.ZodObject, K extends FormKey = FormKey> = UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
159
|
-
/**
|
|
160
|
-
* Direct V4 configuration projection. Mirrors `UseFormReturnV4`.
|
|
161
|
-
*/
|
|
162
|
-
type UseFormConfigV4<Schema extends z.ZodObject, K extends FormKey = FormKey> = Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
163
|
-
schema: Schema;
|
|
164
|
-
} & ValidateOnConfig;
|
|
165
|
-
/**
|
|
166
|
-
* Direct V3 projection — no major-dispatch. Use when the schema's
|
|
167
|
-
* Zod major is known statically.
|
|
168
|
-
*/
|
|
169
|
-
type UseFormReturnV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKey = FormKey> = UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
170
|
-
/**
|
|
171
|
-
* Direct V3 configuration projection. Mirrors `UseFormReturnV3`.
|
|
172
|
-
*/
|
|
173
|
-
type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKey = FormKey> = Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
174
|
-
schema: Schema;
|
|
175
|
-
} & ValidateOnConfig;
|
|
176
|
-
/**
|
|
177
|
-
* The return shape of `useForm` for a given Zod schema. Dispatches
|
|
178
|
-
* once on the schema's major version and projects to the matching
|
|
179
|
-
* adapter's `Form` / `Out` / `Read` slots. The dispatch matches the
|
|
180
|
-
* full `SupportedRootSchema` per major, so an object, record, or
|
|
181
|
-
* discriminated-union root all resolve here exactly as the runtime
|
|
182
|
-
* `useForm` overloads accept them.
|
|
183
|
-
*
|
|
184
|
-
* Replaces `ReturnType<typeof useForm<Schema, K>>` in test code with
|
|
185
|
-
* concrete schemas. For generic helpers (`<S extends z.ZodObject>`),
|
|
186
|
-
* use `UseFormReturnV4<S>` directly — TS doesn't simplify
|
|
187
|
-
* conditional types under generic constraints, so the dispatch in
|
|
188
|
-
* this helper stays deferred and TS can't prove return-type
|
|
189
|
-
* compatibility.
|
|
190
|
-
*/
|
|
191
|
-
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends SupportedRootSchema$1 ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
192
|
-
/**
|
|
193
|
-
* The configuration parameter shape of `useForm` for a given Zod
|
|
194
|
-
* schema. Mirrors `UseFormReturn`'s dispatch — replaces
|
|
195
|
-
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
196
|
-
*/
|
|
197
|
-
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
198
|
-
schema: Schema;
|
|
199
|
-
} & ValidateOnConfig : Schema extends SupportedRootSchema$1 ? Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
200
|
-
schema: Schema;
|
|
201
|
-
} & ValidateOnConfig : never;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Field-metadata write/read API for the unified `attaform/zod` entry.
|
|
205
|
-
*
|
|
206
|
-
* Storage is shared with both adapters via `field-meta-store` — a
|
|
207
|
-
* payload written here is visible to whichever adapter the unified
|
|
208
|
-
* `useForm` dispatches to at runtime, regardless of Zod major. No
|
|
209
|
-
* `zod` runtime import; the type-only `import type` is erased at
|
|
210
|
-
* build, so `attaform/zod` carries no `z.registry` reference even
|
|
211
|
-
* when consumed by a Zod 3 project without the Vite plugin alias.
|
|
212
|
-
*
|
|
213
|
-
* The native v4 chain `schema.register(fieldMeta, payload)` continues
|
|
214
|
-
* to work — Zod 4's `.register()` only calls `.add(this, payload)`
|
|
215
|
-
* structurally, satisfied by the shared store.
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
type ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>;
|
|
219
|
-
/**
|
|
220
|
-
* The shared registry every Attaform-aware Zod schema can register
|
|
221
|
-
* field metadata against, regardless of major. Same instance the v3
|
|
222
|
-
* and v4 adapter entries expose — write in one place, read from
|
|
223
|
-
* any.
|
|
224
|
-
*
|
|
225
|
-
* Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native
|
|
226
|
-
* `schema.register(fieldMeta, payload)` chain type-checks for v4
|
|
227
|
-
* users; the runtime call only needs `.add` structurally, which the
|
|
228
|
-
* shared store provides.
|
|
229
|
-
*/
|
|
230
|
-
declare const fieldMeta: ZodFieldMetaRegistry;
|
|
231
|
-
/**
|
|
232
|
-
* Attach `payload` to `schema` in the shared registry and return a
|
|
233
|
-
* clone of `schema` so each call gets its own identity (the registry
|
|
234
|
-
* keys on schema reference, so cloning prevents last-write-wins
|
|
235
|
-
* collisions for sub-schemas reused at multiple paths).
|
|
236
|
-
*
|
|
237
|
-
* Works on both Zod 3 and Zod 4 schemas — branches on the runtime
|
|
238
|
-
* shape of the schema:
|
|
239
|
-
* - Zod 4 schemas expose a public `.clone()` method; we call it.
|
|
240
|
-
* - Zod 3 schemas don't, so we reconstruct via
|
|
241
|
-
* `new schema.constructor(schema._def)`.
|
|
242
|
-
*
|
|
243
|
-
* Both forms produce a fresh schema with the same effective
|
|
244
|
-
* structure, so the registry slot is unique to this call site.
|
|
245
|
-
*/
|
|
246
|
-
declare function withMeta<S>(schema: S, payload: FieldMetaPayload): S;
|
|
247
|
-
|
|
248
|
-
export { DefaultValuesInput, FieldMetaPayload, FormKey, GenericForm, UseFormConfiguration, UseFormReturnType, ValidateOnConfig, fieldMeta, useForm, withMeta };
|
|
249
|
-
export type { UseFormConfig, UseFormConfigV3, UseFormConfigV4, UseFormReturn, UseFormReturnV3, UseFormReturnV4 };
|
package/dist/index.d.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEFAULT_TIMINGS, f as DEVTOOLS_WINDOW_KEY, g as DisplayTimings, F as FormStatus, h as FormStatusSeed, G as GateMarker, I as InjectWizardInput, i as InvalidPathError, j as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, k as ReservedFormKeyError, S as SerializedAttaformState, l as SerializedFormData, m as StepSlot, n as SubmitErrorHandlerError, U as UseRegisterReturn, o as UseWizardReturnType, W as WizardAggregateError, p as WizardCtx, q as WizardCtxForm, r as WizardOnError, s as WizardOnSubmit, t as WizardOptions, u as WizardPersistFn, v as WizardRestoreFn, w as WizardRestoreState, x as WizardStatusesProxy, y as WizardSubmitContext, z as assignKey, B as createAttaform, E as createRegistry, H as defaultCoercionRules, J as defaultDisplayState, K as defineCoercion, M as escapeForInlineScript, N as gate, P as getRegistryFromApp, Q as hydrateAttaformState, T as injectForm, V as injectWizard, X as isRegisterValue, Y as kAttaformRegistry, Z as lazy, _ as makeDefaultDisplayState, $ as renderAttaformState, a0 as useRegister, a1 as useRegistry, a2 as useWizard, a3 as vRegister } from './shared/attaform.F2Q8iv38.js';
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, A as AbstractSchema, aq as AcceptableDefaults, ae as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, o as FieldMetaPayload } from './shared/attaform.DniawQLP.js';
|
|
3
|
-
export { b as ArrayItem, c as ArrayPath, d as AttaformDefaults, C as CoercionEntry, e as CoercionRegistry, f as CoercionResult, g as CustomDirectiveRegisterAssignerFn, h as DeepPartial, i as DefaultValuesResponse, j as DefaultValuesShape, k as DisplayCtx, l as DisplayMachine, m as DisplayState, E as ErrorInput, n as ErrorsProxyShape, p as FieldState, q as FieldStateMap, r as FieldStateMapEntry, s as FlatPath, t as FormErrorRecord, u as FormErrorsSurface, v as FormMeta, w as GetDisplayState, H as HandleSubmit, x as HistoryConfig, I as IsTuple, y as IsUnion, J as JoinSegments, z as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, B as NestedType, O as OnError, P as OnInvalidSubmitPolicy, Q as OnSubmit, R as PartialFlatPath, S as Path, T as PathKey, V as PendingValidationStatus, W as Primitive, X as ROOT_PATH, Y as ROOT_PATH_KEY, Z as ReactiveValidationStatus, _ as RegisterDirective, $ as RegisterFlatPath, a0 as RegisterOptions, a1 as RegisterSelectModifier, a2 as RegisterTextModifier, a3 as RegisterTransform, a4 as RegisterValue, a5 as Segment, a6 as SetValueCallback, a7 as SetValuePayload, a8 as SettledValidationStatus, a9 as SlimPrimitiveKind, aa as SlimRuntimeOf, ab as SubmitHandler, ac as Unset, ad as ValidateOn, af as ValidationError, ag as ValidationResponse, ah as ValidationResponseWithoutValue, ai as ValueOfUnion, aj as WriteMeta, ak as WriteShape, al as canonicalizePath, am as isPathPrefix, an as isUnset, ao as parseDottedPath, ap as unset } from './shared/attaform.DniawQLP.js';
|
|
4
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.Fp3sCrVs.js';
|
|
5
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.Fp3sCrVs.js';
|
|
6
|
-
import { S as SupportedRootSchema$1, U as UnwrapZodRoot, a as StorageShape$1 } from './shared/attaform.DRUT703x.js';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import 'vue';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Type-level Zod-major discriminator for the unified `attaform/zod`
|
|
12
|
-
* entry. The runtime dispatch (`use-form.ts`'s impl) already routes on
|
|
13
|
-
* the schema's shape via `isZodV4SchemaShape`; this is the type-level
|
|
14
|
-
* mirror so the overloads and projection helpers discriminate the same
|
|
15
|
-
* way.
|
|
16
|
-
*
|
|
17
|
-
* Why a structural marker instead of `z.ZodObject`: the unified entry's
|
|
18
|
-
* overloads constrain on `z.ZodObject`, but the published `.d.mts`
|
|
19
|
-
* resolves `z` against whichever single Zod major the consumer
|
|
20
|
-
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
21
|
-
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
22
|
-
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
23
|
-
* overload's constraint and binds it — collapsing the read slot to
|
|
24
|
-
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
25
|
-
* schema never does.
|
|
26
|
-
* Intersecting a v4-only constraint or conditional branch with this
|
|
27
|
-
* marker keeps it unreachable for a v3 schema regardless of how `zod`
|
|
28
|
-
* resolves, so v3 schemas fall through to the v3 overload.
|
|
29
|
-
*
|
|
30
|
-
* Distinct from `core/zod-shape.ts`'s runtime `ZodV4Shape` (which reads
|
|
31
|
-
* the public `def` getter): at the type level the stable v4 brand is
|
|
32
|
-
* `_zod.def`, the same internals `StorageShape` (v4) already reads.
|
|
33
|
-
*
|
|
34
|
-
* Pairing requirement: a v4 overload/branch must constrain on
|
|
35
|
-
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
36
|
-
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
37
|
-
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
38
|
-
* arguments — an error type that behaves like `any` under
|
|
39
|
-
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
40
|
-
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
41
|
-
* keeps it a concrete object type in both majors, so the intersection
|
|
42
|
-
* stays meaningful.
|
|
43
|
-
*/
|
|
44
|
-
type ZodV4Internals = {
|
|
45
|
-
_zod: {
|
|
46
|
-
def: unknown;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Per-major projection helpers shared by the unified `attaform/zod`
|
|
52
|
-
* entry. Each maps an arbitrary Zod v4 OR v3 object schema to the
|
|
53
|
-
* `GenericForm`-shaped input / output / storage-read projections the
|
|
54
|
-
* form types are parameterised over. The constraint on each alias scopes
|
|
55
|
-
* `S` to one Zod major, so the projection is a direct read with no
|
|
56
|
-
* dispatch in the type body.
|
|
57
|
-
*
|
|
58
|
-
* Hoisted out of `types-unified.ts` and `use-form.ts` so the two entry
|
|
59
|
-
* points share one definition. Internal — consumer code never reaches
|
|
60
|
-
* for these; the overloaded `useForm` already gives full inference at
|
|
61
|
-
* call sites.
|
|
62
|
-
*/
|
|
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>;
|
|
78
|
-
type V4FormOf<S extends SupportedRootSchema> = z.input<S> extends GenericForm ? z.input<S> : never;
|
|
79
|
-
type V4OutOf<S extends SupportedRootSchema> = z.output<S> extends GenericForm ? z.output<S> : never;
|
|
80
|
-
type V4ReadOf<S extends SupportedRootSchema> = StorageShape<S> extends GenericForm ? StorageShape<S> : never;
|
|
81
|
-
type V3FormOf<S extends SupportedRootSchema$1> = z.input<UnwrapZodRoot<S>> extends GenericForm ? z.input<UnwrapZodRoot<S>> : never;
|
|
82
|
-
type V3OutOf<S extends SupportedRootSchema$1> = z.output<UnwrapZodRoot<S>> extends GenericForm ? z.output<UnwrapZodRoot<S>> : never;
|
|
83
|
-
type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>> extends GenericForm ? StorageShape$1<UnwrapZodRoot<S>> : never;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Create a form bound to a Zod v4 schema.
|
|
87
|
-
*
|
|
88
|
-
* ```ts
|
|
89
|
-
* import { useForm } from 'attaform/zod'
|
|
90
|
-
* import { z } from 'zod'
|
|
91
|
-
*
|
|
92
|
-
* const form = useForm({
|
|
93
|
-
* schema: z.object({
|
|
94
|
-
* username: z.string().min(2, 'At least 2 characters'),
|
|
95
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
96
|
-
* }),
|
|
97
|
-
* })
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* The constraint intersects `ZodV4Internals` (the v4-only `_zod`
|
|
101
|
-
* brand) so a v3 schema can't bind this overload even when `z`
|
|
102
|
-
* resolves to v3 in a single-major consumer install; v3 schemas fall
|
|
103
|
-
* through to the v3 overload below. See `types-zod-major.ts`.
|
|
104
|
-
*/
|
|
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'> & {
|
|
106
|
-
schema: Schema;
|
|
107
|
-
defaultValues?: AcceptableDefaults<V4FormOf<Schema>, V4SchemaInput<Schema>>;
|
|
108
|
-
} & ValidateOnConfig): UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
109
|
-
/**
|
|
110
|
-
* Create a form bound to a Zod v3 schema.
|
|
111
|
-
*
|
|
112
|
-
* ```ts
|
|
113
|
-
* import { useForm } from 'attaform/zod'
|
|
114
|
-
* import { z } from 'zod-v3'
|
|
115
|
-
*
|
|
116
|
-
* const form = useForm({
|
|
117
|
-
* schema: z.object({
|
|
118
|
-
* username: z.string().min(2, 'At least 2 characters'),
|
|
119
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
120
|
-
* }),
|
|
121
|
-
* })
|
|
122
|
-
* ```
|
|
123
|
-
*
|
|
124
|
-
* v3 schemas match this overload; v4 schemas hit the v4 overload
|
|
125
|
-
* above first and never reach here.
|
|
126
|
-
*/
|
|
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'> & {
|
|
128
|
-
schema: Schema;
|
|
129
|
-
defaultValues?: AcceptableDefaults<V3FormOf<Schema>, V3SchemaInput<Schema>>;
|
|
130
|
-
} & ValidateOnConfig): UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Type-level helpers for the unified `attaform/zod` entry. These give
|
|
134
|
-
* tests and other type-query call sites a deterministic projection
|
|
135
|
-
* over an arbitrary v4 OR v3 schema, sidestepping the brittle
|
|
136
|
-
* instantiation-expression resolution rules TypeScript applies to
|
|
137
|
-
* overloaded functions (`typeof useForm<X>` can pick the wrong
|
|
138
|
-
* overload or the impl signature, depending on whether the type
|
|
139
|
-
* argument is a concrete schema, a generic, or a constraint).
|
|
140
|
-
*
|
|
141
|
-
* The helpers dispatch ONCE per use site via a binary conditional —
|
|
142
|
-
* no stacking, no amplification across the return type. Equivalent
|
|
143
|
-
* to writing `ReturnType<typeof useForm<S>>` but cache-stable across
|
|
144
|
-
* call patterns.
|
|
145
|
-
*
|
|
146
|
-
* Per `inference-first DX`, these helpers are test- and
|
|
147
|
-
* internal-facing. Consumer code shouldn't reach for them — the
|
|
148
|
-
* overloaded `useForm` already gives full inference at call sites.
|
|
149
|
-
*/
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Direct V4 projection — no major-dispatch. Use when the schema's
|
|
153
|
-
* Zod major is known statically (typical for V4 generic helpers like
|
|
154
|
-
* `function setup<S extends z.ZodObject>(s: S)`). TS simplifies the
|
|
155
|
-
* helper cleanly under generic constraints because no conditional
|
|
156
|
-
* is present.
|
|
157
|
-
*/
|
|
158
|
-
type UseFormReturnV4<Schema extends z.ZodObject, K extends FormKey = FormKey> = UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
159
|
-
/**
|
|
160
|
-
* Direct V4 configuration projection. Mirrors `UseFormReturnV4`.
|
|
161
|
-
*/
|
|
162
|
-
type UseFormConfigV4<Schema extends z.ZodObject, K extends FormKey = FormKey> = Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
163
|
-
schema: Schema;
|
|
164
|
-
} & ValidateOnConfig;
|
|
165
|
-
/**
|
|
166
|
-
* Direct V3 projection — no major-dispatch. Use when the schema's
|
|
167
|
-
* Zod major is known statically.
|
|
168
|
-
*/
|
|
169
|
-
type UseFormReturnV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKey = FormKey> = UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
170
|
-
/**
|
|
171
|
-
* Direct V3 configuration projection. Mirrors `UseFormReturnV3`.
|
|
172
|
-
*/
|
|
173
|
-
type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKey = FormKey> = Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
174
|
-
schema: Schema;
|
|
175
|
-
} & ValidateOnConfig;
|
|
176
|
-
/**
|
|
177
|
-
* The return shape of `useForm` for a given Zod schema. Dispatches
|
|
178
|
-
* once on the schema's major version and projects to the matching
|
|
179
|
-
* adapter's `Form` / `Out` / `Read` slots. The dispatch matches the
|
|
180
|
-
* full `SupportedRootSchema` per major, so an object, record, or
|
|
181
|
-
* discriminated-union root all resolve here exactly as the runtime
|
|
182
|
-
* `useForm` overloads accept them.
|
|
183
|
-
*
|
|
184
|
-
* Replaces `ReturnType<typeof useForm<Schema, K>>` in test code with
|
|
185
|
-
* concrete schemas. For generic helpers (`<S extends z.ZodObject>`),
|
|
186
|
-
* use `UseFormReturnV4<S>` directly — TS doesn't simplify
|
|
187
|
-
* conditional types under generic constraints, so the dispatch in
|
|
188
|
-
* this helper stays deferred and TS can't prove return-type
|
|
189
|
-
* compatibility.
|
|
190
|
-
*/
|
|
191
|
-
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends SupportedRootSchema$1 ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
192
|
-
/**
|
|
193
|
-
* The configuration parameter shape of `useForm` for a given Zod
|
|
194
|
-
* schema. Mirrors `UseFormReturn`'s dispatch — replaces
|
|
195
|
-
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
196
|
-
*/
|
|
197
|
-
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
198
|
-
schema: Schema;
|
|
199
|
-
} & ValidateOnConfig : Schema extends SupportedRootSchema$1 ? Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, DefaultValuesInput<V3FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
200
|
-
schema: Schema;
|
|
201
|
-
} & ValidateOnConfig : never;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Field-metadata write/read API for the unified `attaform/zod` entry.
|
|
205
|
-
*
|
|
206
|
-
* Storage is shared with both adapters via `field-meta-store` — a
|
|
207
|
-
* payload written here is visible to whichever adapter the unified
|
|
208
|
-
* `useForm` dispatches to at runtime, regardless of Zod major. No
|
|
209
|
-
* `zod` runtime import; the type-only `import type` is erased at
|
|
210
|
-
* build, so `attaform/zod` carries no `z.registry` reference even
|
|
211
|
-
* when consumed by a Zod 3 project without the Vite plugin alias.
|
|
212
|
-
*
|
|
213
|
-
* The native v4 chain `schema.register(fieldMeta, payload)` continues
|
|
214
|
-
* to work — Zod 4's `.register()` only calls `.add(this, payload)`
|
|
215
|
-
* structurally, satisfied by the shared store.
|
|
216
|
-
*/
|
|
217
|
-
|
|
218
|
-
type ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>;
|
|
219
|
-
/**
|
|
220
|
-
* The shared registry every Attaform-aware Zod schema can register
|
|
221
|
-
* field metadata against, regardless of major. Same instance the v3
|
|
222
|
-
* and v4 adapter entries expose — write in one place, read from
|
|
223
|
-
* any.
|
|
224
|
-
*
|
|
225
|
-
* Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native
|
|
226
|
-
* `schema.register(fieldMeta, payload)` chain type-checks for v4
|
|
227
|
-
* users; the runtime call only needs `.add` structurally, which the
|
|
228
|
-
* shared store provides.
|
|
229
|
-
*/
|
|
230
|
-
declare const fieldMeta: ZodFieldMetaRegistry;
|
|
231
|
-
/**
|
|
232
|
-
* Attach `payload` to `schema` in the shared registry and return a
|
|
233
|
-
* clone of `schema` so each call gets its own identity (the registry
|
|
234
|
-
* keys on schema reference, so cloning prevents last-write-wins
|
|
235
|
-
* collisions for sub-schemas reused at multiple paths).
|
|
236
|
-
*
|
|
237
|
-
* Works on both Zod 3 and Zod 4 schemas — branches on the runtime
|
|
238
|
-
* shape of the schema:
|
|
239
|
-
* - Zod 4 schemas expose a public `.clone()` method; we call it.
|
|
240
|
-
* - Zod 3 schemas don't, so we reconstruct via
|
|
241
|
-
* `new schema.constructor(schema._def)`.
|
|
242
|
-
*
|
|
243
|
-
* Both forms produce a fresh schema with the same effective
|
|
244
|
-
* structure, so the registry slot is unique to this call site.
|
|
245
|
-
*/
|
|
246
|
-
declare function withMeta<S>(schema: S, payload: FieldMetaPayload): S;
|
|
247
|
-
|
|
248
|
-
export { DefaultValuesInput, FieldMetaPayload, FormKey, GenericForm, UseFormConfiguration, UseFormReturnType, ValidateOnConfig, fieldMeta, useForm, withMeta };
|
|
249
|
-
export type { UseFormConfig, UseFormConfigV3, UseFormConfigV4, UseFormReturn, UseFormReturnV3, UseFormReturnV4 };
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/dist/nuxt.cjs
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const node_module = require('node:module');
|
|
4
|
-
const node_path = require('node:path');
|
|
5
|
-
const node_url = require('node:url');
|
|
6
|
-
const kit = require('@nuxt/kit');
|
|
7
|
-
const vite = require('./vite.cjs');
|
|
8
|
-
|
|
9
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
|
-
const pkgVersion = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('nuxt.cjs', document.baseURI).href)))("../package.json").version;
|
|
11
|
-
function isResolvableForVite(specifier, consumerRootDir) {
|
|
12
|
-
const consumerURL = node_url.pathToFileURL(node_path.join(consumerRootDir, "package.json")).href;
|
|
13
|
-
return canResolve(specifier, consumerURL) || canResolve(specifier, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('nuxt.cjs', document.baseURI).href)));
|
|
14
|
-
}
|
|
15
|
-
function canResolve(specifier, fromURL) {
|
|
16
|
-
try {
|
|
17
|
-
undefined(specifier, fromURL);
|
|
18
|
-
return true;
|
|
19
|
-
} catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
var nuxt_default = kit.defineNuxtModule({
|
|
24
|
-
meta: {
|
|
25
|
-
name: "Attaform",
|
|
26
|
-
configKey: "attaform",
|
|
27
|
-
version: pkgVersion,
|
|
28
|
-
docs: "https://attaform.dev/docs",
|
|
29
|
-
compatibility: {
|
|
30
|
-
nuxt: ">=3.0.0"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
defaults: {},
|
|
34
|
-
setup(_options, nuxt) {
|
|
35
|
-
var _a, _b;
|
|
36
|
-
kit.addVitePlugin(vite.attaform({ resolveZodAlias: _options.resolveZodAlias !== false }));
|
|
37
|
-
const runtimePublic = nuxt.options.runtimeConfig.public;
|
|
38
|
-
runtimePublic["attaform"] = {
|
|
39
|
-
defaults: _options.defaults ?? {},
|
|
40
|
-
version: pkgVersion
|
|
41
|
-
};
|
|
42
|
-
(_a = nuxt.options.vite).optimizeDeps ?? (_a.optimizeDeps = {});
|
|
43
|
-
(_b = nuxt.options.vite.optimizeDeps).include ?? (_b.include = []);
|
|
44
|
-
const include = nuxt.options.vite.optimizeDeps.include;
|
|
45
|
-
for (const spec of ["@vue/devtools-api", "zod"]) {
|
|
46
|
-
if (!isResolvableForVite(spec, nuxt.options.rootDir)) continue;
|
|
47
|
-
if (!include.includes(spec)) include.push(spec);
|
|
48
|
-
}
|
|
49
|
-
const resolver = kit.createResolver((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('nuxt.cjs', document.baseURI).href)));
|
|
50
|
-
if (_options.autoImports !== false) {
|
|
51
|
-
kit.addImports(vite.attaformAutoImports);
|
|
52
|
-
}
|
|
53
|
-
kit.addPlugin({
|
|
54
|
-
src: resolver.resolve("./runtime/plugins/attaform")
|
|
55
|
-
});
|
|
56
|
-
if (nuxt.options.dev) {
|
|
57
|
-
nuxt.hook("ready", async () => {
|
|
58
|
-
try {
|
|
59
|
-
const { addCustomTab } = await import('@nuxt/devtools-kit');
|
|
60
|
-
addCustomTab({
|
|
61
|
-
name: "attaform",
|
|
62
|
-
title: "Attaform",
|
|
63
|
-
// Brand mark — purple square with a white "A" silhouette,
|
|
64
|
-
// matching `apps/site/public/favicon.svg`. Served by the
|
|
65
|
-
// `attaform/vite` middleware at the same `/_attaform_devtools`
|
|
66
|
-
// route family (sibling to the panel HTML). A real URL
|
|
67
|
-
// renders reliably across Nuxt DevTools versions where
|
|
68
|
-
// `data:` URIs don't.
|
|
69
|
-
icon: "/_attaform_devtools/icon.svg",
|
|
70
|
-
view: {
|
|
71
|
-
type: "iframe",
|
|
72
|
-
src: "/_attaform_devtools",
|
|
73
|
-
persistent: true
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
} catch {
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
module.exports = nuxt_default;
|
|
84
|
-
//# sourceMappingURL=nuxt.cjs.map
|