attaform 0.17.0 → 0.17.1
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/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 +2 -2
- 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.ClfCi1i2.d.mts → attaform.B1jvxsOF.d.mts} +1 -1
- package/dist/shared/{attaform.BT55rDNN.mjs → attaform.B3ZaPIzS.mjs} +15 -2
- package/dist/shared/attaform.B3ZaPIzS.mjs.map +1 -0
- package/dist/shared/{attaform.0Wg7UEeX.cjs → attaform.B5qiXQwN.cjs} +10 -2
- package/dist/shared/attaform.B5qiXQwN.cjs.map +1 -0
- package/dist/shared/{attaform.C6_zOf8x.cjs → attaform.BV40t5y2.cjs} +16 -6
- package/dist/shared/attaform.BV40t5y2.cjs.map +1 -0
- package/dist/shared/attaform.C0iFnTN0.d.ts +165 -0
- package/dist/shared/{attaform.D7lomopc.d.cts → attaform.C6qzEdIM.d.cts} +1 -1
- package/dist/shared/attaform.CHorcsIU.d.cts +165 -0
- package/dist/shared/{attaform.B0zue7zt.d.ts → attaform.CTwNcpLE.d.ts} +1 -1
- package/dist/shared/{attaform.D6Q5ZP8L.mjs → attaform.CVCmBKZX.mjs} +10 -2
- package/dist/shared/attaform.CVCmBKZX.mjs.map +1 -0
- package/dist/shared/{attaform.BYbsV2Wv.d.mts → attaform.C_5aB6EQ.d.cts} +95 -15
- package/dist/shared/{attaform.BYbsV2Wv.d.ts → attaform.C_5aB6EQ.d.mts} +95 -15
- package/dist/shared/{attaform.BYbsV2Wv.d.cts → attaform.C_5aB6EQ.d.ts} +95 -15
- package/dist/shared/{attaform.BFumZXY2.cjs → attaform.Cer8JO_P.cjs} +15 -2
- package/dist/shared/attaform.Cer8JO_P.cjs.map +1 -0
- package/dist/shared/{attaform.Cj0pCNVn.mjs → attaform.CpERWz3u.mjs} +16 -6
- package/dist/shared/attaform.CpERWz3u.mjs.map +1 -0
- package/dist/shared/attaform.CuE-bS1C.d.mts +165 -0
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +26 -4
- package/dist/zod-v3.d.mts +26 -4
- package/dist/zod-v3.d.ts +26 -4
- package/dist/zod-v3.mjs +2 -2
- package/dist/zod-v4.cjs +2 -2
- package/dist/zod-v4.d.cts +4 -4
- package/dist/zod-v4.d.mts +4 -4
- package/dist/zod-v4.d.ts +4 -4
- package/dist/zod-v4.mjs +2 -2
- package/dist/zod.cjs +3 -3
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +6 -5
- package/dist/zod.d.mts +6 -5
- package/dist/zod.d.ts +6 -5
- package/dist/zod.mjs +3 -3
- package/dist/zod.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/shared/attaform.0Wg7UEeX.cjs.map +0 -1
- package/dist/shared/attaform.AOgGyRoI.d.cts +0 -65
- package/dist/shared/attaform.BFumZXY2.cjs.map +0 -1
- package/dist/shared/attaform.BQ-iGGWd.d.mts +0 -65
- package/dist/shared/attaform.BT55rDNN.mjs.map +0 -1
- package/dist/shared/attaform.C6_zOf8x.cjs.map +0 -1
- package/dist/shared/attaform.CX9v2M8k.d.ts +0 -65
- package/dist/shared/attaform.Cj0pCNVn.mjs.map +0 -1
- package/dist/shared/attaform.D6Q5ZP8L.mjs.map +0 -1
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { G as GenericForm, s as FlatPath, B as NestedType, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, ag as ValidateOnConfig, d as UseFormReturnType } from './attaform.C_5aB6EQ.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The shape `form.values.<key>` returns at runtime.
|
|
6
|
+
*
|
|
7
|
+
* Per leaf:
|
|
8
|
+
*
|
|
9
|
+
* 1. `z.preprocess(fn, inner)` — compiles to `ZodPipe<ZodTransform, inner>`.
|
|
10
|
+
* The preprocess fn fires at the write boundary (synthesized into
|
|
11
|
+
* `setValue`), so storage holds whatever `inner` stores. Recurse
|
|
12
|
+
* `StorageShape` on `inner` so a defaulted leaf inside `inner` still
|
|
13
|
+
* reads `T` (not `T | undefined`).
|
|
14
|
+
*
|
|
15
|
+
* 2. `inner.transform(fn)` — compiles to `ZodPipe<inner, ZodTransform>`.
|
|
16
|
+
* Transforms fire at submit / validate, NOT at the write boundary,
|
|
17
|
+
* so storage holds whatever `inner` stores. Recurse `StorageShape`
|
|
18
|
+
* on `inner` for the same reason.
|
|
19
|
+
*
|
|
20
|
+
* A bare top-level `ZodTransform` (no `in` schema) reads
|
|
21
|
+
* `_zod.input` directly — there's no inner to recurse into.
|
|
22
|
+
*
|
|
23
|
+
* 3. Codec / generic pipe — neither side is a transform. Read
|
|
24
|
+
* `_zod.output`. Codecs aren't write-boundary-synthesized, so the
|
|
25
|
+
* post-parse view is the only honest storage type.
|
|
26
|
+
*
|
|
27
|
+
* 4. Everything else (defaults, catch, readonly, optional, primitives,
|
|
28
|
+
* nested objects) — read `_zod.output`. Defaults and catches fire
|
|
29
|
+
* at parse time, so the post-init view is what storage holds.
|
|
30
|
+
* Nested objects delegate to Zod's own recursion on `_zod.output`,
|
|
31
|
+
* which peels nested defaults inside structural containers.
|
|
32
|
+
*
|
|
33
|
+
* Recursion: the alias calls itself on the non-transform side of a
|
|
34
|
+
* pipe so the inner shape gets the same per-key storage treatment as
|
|
35
|
+
* the top level. Without it, an inner `.default(...)` inside a
|
|
36
|
+
* transformed object would peel back to `T | undefined` (the broad
|
|
37
|
+
* input contract). Recursion only fires for pipe leaves — most leaves
|
|
38
|
+
* skip it.
|
|
39
|
+
*
|
|
40
|
+
* Implementation note: direct `_zod` property access mirrors Zod's
|
|
41
|
+
* own `$InferObjectOutput` / `$InferObjectInput`, which read
|
|
42
|
+
* `T[k]['_zod']['output']` / `T[k]['_zod']['input']` directly rather
|
|
43
|
+
* than wrapping in the top-level `output<T>` / `input<T>` conditional.
|
|
44
|
+
* Wrapping per key spawns a fresh conditional instantiation for every
|
|
45
|
+
* key; Volar's web-worker checker collapses that per-key walk to
|
|
46
|
+
* `any` once the schema is non-trivial. Property access has no
|
|
47
|
+
* conditional and resolves cleanly under the same budget.
|
|
48
|
+
*
|
|
49
|
+
* Shape access also goes through `_zod.def.shape` rather than
|
|
50
|
+
* `infer Shape from z.ZodObject<Shape>` — the latter collapses to the
|
|
51
|
+
* `$ZodShape` upper bound in the same worker because of
|
|
52
|
+
* `z.ZodObject`'s `out Shape` covariance markers.
|
|
53
|
+
*/
|
|
54
|
+
type StorageShape<S> = S extends {
|
|
55
|
+
_zod: {
|
|
56
|
+
def: {
|
|
57
|
+
type: 'object';
|
|
58
|
+
shape: infer Shape;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
} ? {
|
|
62
|
+
[K in keyof Shape]-?: StorageLeaf<Shape[K]>;
|
|
63
|
+
} : StorageLeaf<S>;
|
|
64
|
+
type StorageLeaf<L> = L extends {
|
|
65
|
+
_zod: {
|
|
66
|
+
def: {
|
|
67
|
+
type: 'pipe';
|
|
68
|
+
in: infer A;
|
|
69
|
+
out: infer B;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
} ? A extends {
|
|
73
|
+
_zod: {
|
|
74
|
+
def: {
|
|
75
|
+
type: 'transform';
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
} ? StorageShape<B> : B extends {
|
|
79
|
+
_zod: {
|
|
80
|
+
def: {
|
|
81
|
+
type: 'transform';
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
} ? StorageShape<A> : L extends {
|
|
85
|
+
_zod: {
|
|
86
|
+
output: infer Out;
|
|
87
|
+
};
|
|
88
|
+
} ? Out : never : L extends {
|
|
89
|
+
_zod: {
|
|
90
|
+
def: {
|
|
91
|
+
type: 'transform';
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
} ? L extends {
|
|
95
|
+
_zod: {
|
|
96
|
+
input: infer In;
|
|
97
|
+
};
|
|
98
|
+
} ? In : never : L extends {
|
|
99
|
+
_zod: {
|
|
100
|
+
output: infer Out;
|
|
101
|
+
};
|
|
102
|
+
} ? Out : never;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Zod v4 adapter entry point. Re-exports the adapter + the useForm
|
|
106
|
+
* wrapper that threads zod-v4-specific schema types through
|
|
107
|
+
* useAbstractForm.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Type of the value accepted at `Path` for `setValue` / `defaultValues`
|
|
112
|
+
* — the schema's `z.input<Schema>` shape at that path. Matches what
|
|
113
|
+
* `form.values.X` returns at runtime (the honest input view storage
|
|
114
|
+
* holds before transforms run).
|
|
115
|
+
*
|
|
116
|
+
* ```ts
|
|
117
|
+
* const schema = z.object({
|
|
118
|
+
* flag: z.string().transform((v) => v.length > 10),
|
|
119
|
+
* })
|
|
120
|
+
* type FlagWriteIn = PathInput<typeof schema, 'flag'> // string
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
type PathInput<Schema extends z.ZodType, Path extends string> = z.input<Schema> extends GenericForm ? Path extends FlatPath<z.input<Schema>> ? NestedType<z.input<Schema>, Path> : never : never;
|
|
124
|
+
/**
|
|
125
|
+
* Type produced at `Path` after the full parse pipeline — the schema's
|
|
126
|
+
* `z.output<Schema>` shape at that path. Matches the `data` payload of
|
|
127
|
+
* `form.process()` and the value handed to `handleSubmit`'s callback.
|
|
128
|
+
*
|
|
129
|
+
* ```ts
|
|
130
|
+
* const schema = z.object({
|
|
131
|
+
* flag: z.string().transform((v) => v.length > 10),
|
|
132
|
+
* })
|
|
133
|
+
* type FlagParsedOut = PathOutput<typeof schema, 'flag'> // boolean
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
type PathOutput<Schema extends z.ZodType, Path extends string> = z.output<Schema> extends GenericForm ? Path extends FlatPath<z.output<Schema>> ? NestedType<z.output<Schema>, Path> : never : never;
|
|
137
|
+
/**
|
|
138
|
+
* Create a form bound to a Zod v4 schema.
|
|
139
|
+
*
|
|
140
|
+
* ```ts
|
|
141
|
+
* import { useForm } from 'attaform/zod'
|
|
142
|
+
* import { z } from 'zod'
|
|
143
|
+
*
|
|
144
|
+
* const form = useForm({
|
|
145
|
+
* schema: z.object({
|
|
146
|
+
* email: z.email(),
|
|
147
|
+
* password: z.string().min(8),
|
|
148
|
+
* }),
|
|
149
|
+
* defaultValues: { email: '' },
|
|
150
|
+
* })
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* Returns a form API exposing `register`, `values`, `errors`,
|
|
154
|
+
* `fields`, `setValue`, `handleSubmit`, `meta`, field-array
|
|
155
|
+
* helpers, and more. See `UseFormReturnType` for the full
|
|
156
|
+
* surface.
|
|
157
|
+
*
|
|
158
|
+
* For Zod v3, import from `attaform/zod-v3` instead.
|
|
159
|
+
*/
|
|
160
|
+
declare function useForm<Schema extends z.ZodObject>(configuration: Omit<UseFormConfiguration<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, AbstractSchema<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>, DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
161
|
+
schema: Schema;
|
|
162
|
+
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never>;
|
|
163
|
+
|
|
164
|
+
export { useForm as u };
|
|
165
|
+
export type { PathInput as P, StorageShape as S, PathOutput as a };
|
package/dist/zod-v3.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useForm = require('./shared/attaform.
|
|
4
|
-
const useFormContext = require('./shared/attaform.
|
|
3
|
+
const useForm = require('./shared/attaform.B5qiXQwN.cjs');
|
|
4
|
+
const useFormContext = require('./shared/attaform.Cer8JO_P.cjs');
|
|
5
5
|
const plugin = require('./shared/attaform.Dee2rU1P.cjs');
|
|
6
6
|
|
|
7
7
|
|
package/dist/zod-v3.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ag as ValidateOnConfig, F as FormKey, E as OnInvalidSubmitPolicy, X as PersistConfig, y as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, ar as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.
|
|
3
|
-
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
4
|
-
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.
|
|
2
|
+
import { ag as ValidateOnConfig, F as FormKey, E as OnInvalidSubmitPolicy, X as PersistConfig, y as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, ar as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.cjs';
|
|
3
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.cjs';
|
|
4
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.C6qzEdIM.cjs';
|
|
5
5
|
import 'vue';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -59,6 +59,28 @@ type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValue
|
|
|
59
59
|
*/
|
|
60
60
|
type UnwrapZodObject<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : never;
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* v3 mirror of the Zod v4 `StorageShape`. Per top-level key, default
|
|
64
|
+
* to `z.output<Shape[K]>` (the post-init view — defaults have fired,
|
|
65
|
+
* Zod's own recursion peels nested defaults inside structural
|
|
66
|
+
* containers); fall back to `z.input<Shape[K]>` for transform / pipe
|
|
67
|
+
* carriers (`ZodEffects`, `ZodPipeline`) where storage holds the
|
|
68
|
+
* pre-transform input — transforms only run at submission /
|
|
69
|
+
* validation, not at the write boundary.
|
|
70
|
+
*
|
|
71
|
+
* v3 quirk: `ZodEffects` covers BOTH `.transform()` and
|
|
72
|
+
* `z.preprocess()` at the TS level — v3 doesn't carry a separate
|
|
73
|
+
* preprocess class the way v4 does. Deferring to `z.input` for
|
|
74
|
+
* `ZodEffects` means a top-level `z.preprocess(fn, T)` leaf reads as
|
|
75
|
+
* the preprocess input (commonly `unknown`); reach for the
|
|
76
|
+
* `AbstractSchema` escape hatch if a stronger type is needed.
|
|
77
|
+
* Transforms preserve their pre-transform input shape, which matches
|
|
78
|
+
* storage.
|
|
79
|
+
*/
|
|
80
|
+
type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ? {
|
|
81
|
+
[K in keyof Shape]-?: Shape[K] extends z.ZodEffects<z.ZodTypeAny> | z.ZodPipeline<z.ZodTypeAny, z.ZodTypeAny> ? z.input<Shape[K]> : z.output<Shape[K]>;
|
|
82
|
+
} : z.input<S>;
|
|
83
|
+
|
|
62
84
|
/**
|
|
63
85
|
* Create a form bound to a custom `AbstractSchema` adapter.
|
|
64
86
|
*
|
|
@@ -97,7 +119,7 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
97
119
|
*
|
|
98
120
|
* For Zod v4, import from `attaform/zod` instead.
|
|
99
121
|
*/
|
|
100
|
-
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = TypeWithNullableDynamicKeys<Schema>>(configuration: UseFormConfigurationWithZod<Schema, DeepPartial<DefaultValuesShape<z.input<UnwrapZodObject<Schema>>>>>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType>;
|
|
122
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = TypeWithNullableDynamicKeys<Schema>>(configuration: UseFormConfigurationWithZod<Schema, DeepPartial<DefaultValuesShape<z.input<UnwrapZodObject<Schema>>>>>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType, StorageShape<UnwrapZodObject<Schema>> extends GenericForm ? StorageShape<UnwrapZodObject<Schema>> : never>;
|
|
101
123
|
|
|
102
124
|
/**
|
|
103
125
|
* Wrap a Zod v3 `ZodObject` schema in an `AbstractSchema` factory.
|
package/dist/zod-v3.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ag as ValidateOnConfig, F as FormKey, E as OnInvalidSubmitPolicy, X as PersistConfig, y as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, ar as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.
|
|
3
|
-
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
4
|
-
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.
|
|
2
|
+
import { ag as ValidateOnConfig, F as FormKey, E as OnInvalidSubmitPolicy, X as PersistConfig, y as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, ar as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.mjs';
|
|
3
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.mjs';
|
|
4
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.B1jvxsOF.mjs';
|
|
5
5
|
import 'vue';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -59,6 +59,28 @@ type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValue
|
|
|
59
59
|
*/
|
|
60
60
|
type UnwrapZodObject<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : never;
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* v3 mirror of the Zod v4 `StorageShape`. Per top-level key, default
|
|
64
|
+
* to `z.output<Shape[K]>` (the post-init view — defaults have fired,
|
|
65
|
+
* Zod's own recursion peels nested defaults inside structural
|
|
66
|
+
* containers); fall back to `z.input<Shape[K]>` for transform / pipe
|
|
67
|
+
* carriers (`ZodEffects`, `ZodPipeline`) where storage holds the
|
|
68
|
+
* pre-transform input — transforms only run at submission /
|
|
69
|
+
* validation, not at the write boundary.
|
|
70
|
+
*
|
|
71
|
+
* v3 quirk: `ZodEffects` covers BOTH `.transform()` and
|
|
72
|
+
* `z.preprocess()` at the TS level — v3 doesn't carry a separate
|
|
73
|
+
* preprocess class the way v4 does. Deferring to `z.input` for
|
|
74
|
+
* `ZodEffects` means a top-level `z.preprocess(fn, T)` leaf reads as
|
|
75
|
+
* the preprocess input (commonly `unknown`); reach for the
|
|
76
|
+
* `AbstractSchema` escape hatch if a stronger type is needed.
|
|
77
|
+
* Transforms preserve their pre-transform input shape, which matches
|
|
78
|
+
* storage.
|
|
79
|
+
*/
|
|
80
|
+
type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ? {
|
|
81
|
+
[K in keyof Shape]-?: Shape[K] extends z.ZodEffects<z.ZodTypeAny> | z.ZodPipeline<z.ZodTypeAny, z.ZodTypeAny> ? z.input<Shape[K]> : z.output<Shape[K]>;
|
|
82
|
+
} : z.input<S>;
|
|
83
|
+
|
|
62
84
|
/**
|
|
63
85
|
* Create a form bound to a custom `AbstractSchema` adapter.
|
|
64
86
|
*
|
|
@@ -97,7 +119,7 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
97
119
|
*
|
|
98
120
|
* For Zod v4, import from `attaform/zod` instead.
|
|
99
121
|
*/
|
|
100
|
-
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = TypeWithNullableDynamicKeys<Schema>>(configuration: UseFormConfigurationWithZod<Schema, DeepPartial<DefaultValuesShape<z.input<UnwrapZodObject<Schema>>>>>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType>;
|
|
122
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = TypeWithNullableDynamicKeys<Schema>>(configuration: UseFormConfigurationWithZod<Schema, DeepPartial<DefaultValuesShape<z.input<UnwrapZodObject<Schema>>>>>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType, StorageShape<UnwrapZodObject<Schema>> extends GenericForm ? StorageShape<UnwrapZodObject<Schema>> : never>;
|
|
101
123
|
|
|
102
124
|
/**
|
|
103
125
|
* Wrap a Zod v3 `ZodObject` schema in an `AbstractSchema` factory.
|
package/dist/zod-v3.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ag as ValidateOnConfig, F as FormKey, E as OnInvalidSubmitPolicy, X as PersistConfig, y as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, ar as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.
|
|
3
|
-
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
4
|
-
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.
|
|
2
|
+
import { ag as ValidateOnConfig, F as FormKey, E as OnInvalidSubmitPolicy, X as PersistConfig, y as HistoryConfig, C as CoercionRegistry, G as GenericForm, U as UseFormConfiguration, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, d as UseFormReturnType, ar as SchemaFactoryOptions, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.js';
|
|
3
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.js';
|
|
4
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.CTwNcpLE.js';
|
|
5
5
|
import 'vue';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -59,6 +59,28 @@ type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValue
|
|
|
59
59
|
*/
|
|
60
60
|
type UnwrapZodObject<T> = T extends z.ZodEffects<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodOptional<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodNullable<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodDefault<infer Inner> ? UnwrapZodObject<Inner> : T extends z.ZodObject<infer Shape> ? z.ZodObject<Shape> : never;
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* v3 mirror of the Zod v4 `StorageShape`. Per top-level key, default
|
|
64
|
+
* to `z.output<Shape[K]>` (the post-init view — defaults have fired,
|
|
65
|
+
* Zod's own recursion peels nested defaults inside structural
|
|
66
|
+
* containers); fall back to `z.input<Shape[K]>` for transform / pipe
|
|
67
|
+
* carriers (`ZodEffects`, `ZodPipeline`) where storage holds the
|
|
68
|
+
* pre-transform input — transforms only run at submission /
|
|
69
|
+
* validation, not at the write boundary.
|
|
70
|
+
*
|
|
71
|
+
* v3 quirk: `ZodEffects` covers BOTH `.transform()` and
|
|
72
|
+
* `z.preprocess()` at the TS level — v3 doesn't carry a separate
|
|
73
|
+
* preprocess class the way v4 does. Deferring to `z.input` for
|
|
74
|
+
* `ZodEffects` means a top-level `z.preprocess(fn, T)` leaf reads as
|
|
75
|
+
* the preprocess input (commonly `unknown`); reach for the
|
|
76
|
+
* `AbstractSchema` escape hatch if a stronger type is needed.
|
|
77
|
+
* Transforms preserve their pre-transform input shape, which matches
|
|
78
|
+
* storage.
|
|
79
|
+
*/
|
|
80
|
+
type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ? {
|
|
81
|
+
[K in keyof Shape]-?: Shape[K] extends z.ZodEffects<z.ZodTypeAny> | z.ZodPipeline<z.ZodTypeAny, z.ZodTypeAny> ? z.input<Shape[K]> : z.output<Shape[K]>;
|
|
82
|
+
} : z.input<S>;
|
|
83
|
+
|
|
62
84
|
/**
|
|
63
85
|
* Create a form bound to a custom `AbstractSchema` adapter.
|
|
64
86
|
*
|
|
@@ -97,7 +119,7 @@ declare function useForm<Form extends GenericForm, GetValueFormType extends Gene
|
|
|
97
119
|
*
|
|
98
120
|
* For Zod v4, import from `attaform/zod` instead.
|
|
99
121
|
*/
|
|
100
|
-
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = TypeWithNullableDynamicKeys<Schema>>(configuration: UseFormConfigurationWithZod<Schema, DeepPartial<DefaultValuesShape<z.input<UnwrapZodObject<Schema>>>>>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType>;
|
|
122
|
+
declare function useForm<Schema extends z.ZodObject<z.ZodRawShape>, GetValueFormType extends GenericForm = TypeWithNullableDynamicKeys<Schema>>(configuration: UseFormConfigurationWithZod<Schema, DeepPartial<DefaultValuesShape<z.input<UnwrapZodObject<Schema>>>>>): UseFormReturnType<z.input<UnwrapZodObject<Schema>>, GetValueFormType, StorageShape<UnwrapZodObject<Schema>> extends GenericForm ? StorageShape<UnwrapZodObject<Schema>> : never>;
|
|
101
123
|
|
|
102
124
|
/**
|
|
103
125
|
* Wrap a Zod v3 `ZodObject` schema in an `AbstractSchema` factory.
|
package/dist/zod-v3.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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 isUnset, u as unset } from './shared/attaform.
|
|
1
|
+
export { f as fieldMeta, i as isZodSchemaType, u as useForm, w as withMeta, z as zodAdapter } from './shared/attaform.CVCmBKZX.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, a as isUnset, u as unset } from './shared/attaform.B3ZaPIzS.mjs';
|
|
3
3
|
export { u as useRegister } from './shared/attaform.CIEQgJnM.mjs';
|
|
4
4
|
//# 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 useFormContext = require('./shared/attaform.
|
|
3
|
+
const index = require('./shared/attaform.BV40t5y2.cjs');
|
|
4
|
+
const useFormContext = require('./shared/attaform.Cer8JO_P.cjs');
|
|
5
5
|
const plugin = require('./shared/attaform.Dee2rU1P.cjs');
|
|
6
6
|
|
|
7
7
|
|
package/dist/zod-v4.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
2
|
-
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.
|
|
3
|
-
import { F as FormKey, ar as SchemaFactoryOptions, b as AbstractSchema, o as FieldMetaPayload } from './shared/attaform.
|
|
4
|
-
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
1
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.CHorcsIU.cjs';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.C6qzEdIM.cjs';
|
|
3
|
+
import { F as FormKey, ar as SchemaFactoryOptions, b as AbstractSchema, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.cjs';
|
|
4
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.cjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { a as AttaformError } from './shared/attaform.B7rzpK1U.cjs';
|
|
7
7
|
import 'vue';
|
package/dist/zod-v4.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
2
|
-
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.
|
|
3
|
-
import { F as FormKey, ar as SchemaFactoryOptions, b as AbstractSchema, o as FieldMetaPayload } from './shared/attaform.
|
|
4
|
-
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
1
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.CuE-bS1C.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.B1jvxsOF.mjs';
|
|
3
|
+
import { F as FormKey, ar as SchemaFactoryOptions, b as AbstractSchema, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.mjs';
|
|
4
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.mjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { a as AttaformError } from './shared/attaform.B7rzpK1U.mjs';
|
|
7
7
|
import 'vue';
|
package/dist/zod-v4.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.
|
|
2
|
-
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.
|
|
3
|
-
import { F as FormKey, ar as SchemaFactoryOptions, b as AbstractSchema, o as FieldMetaPayload } from './shared/attaform.
|
|
4
|
-
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.
|
|
1
|
+
export { P as PathInput, a as PathOutput, u as useForm } from './shared/attaform.C0iFnTN0.js';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.CTwNcpLE.js';
|
|
3
|
+
import { F as FormKey, ar as SchemaFactoryOptions, b as AbstractSchema, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.js';
|
|
4
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { a as AttaformError } from './shared/attaform.B7rzpK1U.js';
|
|
7
7
|
import 'vue';
|
package/dist/zod-v4.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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 isUnset, u as unset } 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.CpERWz3u.mjs';
|
|
2
|
+
export { A as AttaformErrorCode, i as injectForm, a as isUnset, u as unset } from './shared/attaform.B3ZaPIzS.mjs';
|
|
3
3
|
export { u as useRegister } from './shared/attaform.CIEQgJnM.mjs';
|
|
4
4
|
//# sourceMappingURL=zod-v4.mjs.map
|
package/dist/zod.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const plugin = require('./shared/attaform.Dee2rU1P.cjs');
|
|
4
|
-
const useForm$1 = require('./shared/attaform.
|
|
5
|
-
const index = require('./shared/attaform.
|
|
6
|
-
const useFormContext = require('./shared/attaform.
|
|
4
|
+
const useForm$1 = require('./shared/attaform.B5qiXQwN.cjs');
|
|
5
|
+
const index = require('./shared/attaform.BV40t5y2.cjs');
|
|
6
|
+
const useFormContext = require('./shared/attaform.Cer8JO_P.cjs');
|
|
7
7
|
const fieldMetaStore = require('./shared/attaform.C8CyvYa_.cjs');
|
|
8
8
|
|
|
9
9
|
function isZodV4SchemaShape(value) {
|
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 * 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 type { z } from 'zod'\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type {\n AbstractSchema,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DeepPartial, DefaultValuesShape, GenericForm } from '../../types/types-core'\n\n/**\n * Create a form bound to a Zod schema. Accepts both Zod v3 and Zod v4\n * schemas; the runtime picks the right adapter from the schema's\n * shape.\n *\n * Type inference targets Zod v4 — the recommended major. Consumers\n * still on Zod v3 get correct runtime behavior here, but the strongest\n * TypeScript inference comes from importing `attaform/zod-v3`\n * directly.\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 */\nexport function useForm<Schema extends z.ZodObject>(\n configuration: Omit<\n UseFormConfiguration<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n AbstractSchema<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n >,\n DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n> {\n // Foot-gun guard mirrors the typed wrappers'.\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4<Schema>>[0]) as ReturnType<\n typeof useForm<Schema>\n >\n }\n // Anything else (Zod v3 schema, custom AbstractSchema, schema\n // factory) goes through the v3 wrapper, which already accepts both\n // Zod v3 input and AbstractSchema directly via its existing shape\n // branch. Cast through unknown — the unified entry's TS surface\n // tracks v4, but the runtime accepts the broader shape.\n return useFormV3(configuration as never) as unknown as ReturnType<typeof useForm<Schema>>\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;;ACUO,SAAS,QACd,aAAA,EAeA;AAEA,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAIA,gCAAA,EAA0B;AAAA,EACtC;AAEA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOC,cAAU,aAAwD,CAAA;AAAA,EAG3E;AAMA,EAAA,OAAOC,kBAAU,aAAsB,CAAA;AACzC;;ACzDO,MAAM,SAAA,GAAYC;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAWC,oCAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAAD,6BAAA,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 * 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 type { z } from 'zod'\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type { StorageShape } from '../zod-v4/types-storage-shape'\nimport type {\n AbstractSchema,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DeepPartial, DefaultValuesShape, GenericForm } from '../../types/types-core'\n\n/**\n * Create a form bound to a Zod schema. Accepts both Zod v3 and Zod v4\n * schemas; the runtime picks the right adapter from the schema's\n * shape.\n *\n * Type inference targets Zod v4 — the recommended major. Consumers\n * still on Zod v3 get correct runtime behavior here, but the strongest\n * TypeScript inference comes from importing `attaform/zod-v3`\n * directly.\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 */\nexport function useForm<Schema extends z.ZodObject>(\n configuration: Omit<\n UseFormConfiguration<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n AbstractSchema<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n >,\n DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never\n> {\n // Foot-gun guard mirrors the typed wrappers'.\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4<Schema>>[0]) as ReturnType<\n typeof useForm<Schema>\n >\n }\n // Anything else (Zod v3 schema, custom AbstractSchema, schema\n // factory) goes through the v3 wrapper, which already accepts both\n // Zod v3 input and AbstractSchema directly via its existing shape\n // branch. Cast through unknown — the unified entry's TS surface\n // tracks v4, but the runtime accepts the broader shape.\n return useFormV3(configuration as never) as unknown as ReturnType<typeof useForm<Schema>>\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;;ACWO,SAAS,QACd,aAAA,EAgBA;AAEA,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAIA,gCAAA,EAA0B;AAAA,EACtC;AAEA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOC,cAAU,aAAwD,CAAA;AAAA,EAG3E;AAMA,EAAA,OAAOC,kBAAU,aAAsB,CAAA;AACzC;;AC3DO,MAAM,SAAA,GAAYC;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAWC,oCAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAAD,6BAAA,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,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
export {
|
|
2
|
+
import { S as StorageShape } from './shared/attaform.CHorcsIU.cjs';
|
|
3
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.CHorcsIU.cjs';
|
|
4
|
+
import { U as UseFormConfiguration, G as GenericForm, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, ag as ValidateOnConfig, d as UseFormReturnType, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.cjs';
|
|
5
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.cjs';
|
|
6
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.C6qzEdIM.cjs';
|
|
6
7
|
import 'vue';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -50,7 +51,7 @@ import 'vue';
|
|
|
50
51
|
*/
|
|
51
52
|
declare function useForm<Schema extends z.ZodObject>(configuration: Omit<UseFormConfiguration<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, AbstractSchema<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>, DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
52
53
|
schema: Schema;
|
|
53
|
-
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>;
|
|
54
|
+
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never>;
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* Field-metadata write/read API for the unified `attaform/zod` entry.
|
package/dist/zod.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
export {
|
|
2
|
+
import { S as StorageShape } from './shared/attaform.CuE-bS1C.mjs';
|
|
3
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.CuE-bS1C.mjs';
|
|
4
|
+
import { U as UseFormConfiguration, G as GenericForm, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, ag as ValidateOnConfig, d as UseFormReturnType, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.mjs';
|
|
5
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.mjs';
|
|
6
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.B1jvxsOF.mjs';
|
|
6
7
|
import 'vue';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -50,7 +51,7 @@ import 'vue';
|
|
|
50
51
|
*/
|
|
51
52
|
declare function useForm<Schema extends z.ZodObject>(configuration: Omit<UseFormConfiguration<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, AbstractSchema<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>, DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
52
53
|
schema: Schema;
|
|
53
|
-
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>;
|
|
54
|
+
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never>;
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* Field-metadata write/read API for the unified `attaform/zod` entry.
|
package/dist/zod.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
export {
|
|
2
|
+
import { S as StorageShape } from './shared/attaform.C0iFnTN0.js';
|
|
3
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.C0iFnTN0.js';
|
|
4
|
+
import { U as UseFormConfiguration, G as GenericForm, b as AbstractSchema, D as DeepPartial, c as DefaultValuesShape, ag as ValidateOnConfig, d as UseFormReturnType, o as FieldMetaPayload } from './shared/attaform.C_5aB6EQ.js';
|
|
5
|
+
export { ae as Unset, ao as isUnset, aq as unset } from './shared/attaform.C_5aB6EQ.js';
|
|
6
|
+
export { A as AttaformErrorCode, i as injectForm, u as useRegister } from './shared/attaform.CTwNcpLE.js';
|
|
6
7
|
import 'vue';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -50,7 +51,7 @@ import 'vue';
|
|
|
50
51
|
*/
|
|
51
52
|
declare function useForm<Schema extends z.ZodObject>(configuration: Omit<UseFormConfiguration<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, AbstractSchema<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>, DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
52
53
|
schema: Schema;
|
|
53
|
-
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>;
|
|
54
|
+
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never, StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never>;
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
57
|
* Field-metadata write/read API for the unified `attaform/zod` entry.
|
package/dist/zod.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { b as InvalidUseFormConfigError } from './shared/attaform.CIEQgJnM.mjs';
|
|
2
2
|
export { u as useRegister } from './shared/attaform.CIEQgJnM.mjs';
|
|
3
|
-
import { u as useForm$2 } from './shared/attaform.
|
|
4
|
-
import { u as useForm$1 } from './shared/attaform.
|
|
5
|
-
export { A as AttaformErrorCode, i as injectForm, a as isUnset, u as unset } from './shared/attaform.
|
|
3
|
+
import { u as useForm$2 } from './shared/attaform.CVCmBKZX.mjs';
|
|
4
|
+
import { u as useForm$1 } from './shared/attaform.CpERWz3u.mjs';
|
|
5
|
+
export { A as AttaformErrorCode, i as injectForm, a as isUnset, u as unset } from './shared/attaform.B3ZaPIzS.mjs';
|
|
6
6
|
import { f as fieldMetaStore, g as getFieldMetaForSchema } from './shared/attaform.D13GMFgK.mjs';
|
|
7
7
|
|
|
8
8
|
function isZodV4SchemaShape(value) {
|
package/dist/zod.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.mjs","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 * 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 type { z } from 'zod'\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type {\n AbstractSchema,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DeepPartial, DefaultValuesShape, GenericForm } from '../../types/types-core'\n\n/**\n * Create a form bound to a Zod schema. Accepts both Zod v3 and Zod v4\n * schemas; the runtime picks the right adapter from the schema's\n * shape.\n *\n * Type inference targets Zod v4 — the recommended major. Consumers\n * still on Zod v3 get correct runtime behavior here, but the strongest\n * TypeScript inference comes from importing `attaform/zod-v3`\n * directly.\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 */\nexport function useForm<Schema extends z.ZodObject>(\n configuration: Omit<\n UseFormConfiguration<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n AbstractSchema<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n >,\n DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n> {\n // Foot-gun guard mirrors the typed wrappers'.\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4<Schema>>[0]) as ReturnType<\n typeof useForm<Schema>\n >\n }\n // Anything else (Zod v3 schema, custom AbstractSchema, schema\n // factory) goes through the v3 wrapper, which already accepts both\n // Zod v3 input and AbstractSchema directly via its existing shape\n // branch. Cast through unknown — the unified entry's TS surface\n // tracks v4, but the runtime accepts the broader shape.\n return useFormV3(configuration as never) as unknown as ReturnType<typeof useForm<Schema>>\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":["useFormV4","useFormV3"],"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;;ACUO,SAAS,QACd,aAAA,EAeA;AAEA,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAI,yBAAA,EAA0B;AAAA,EACtC;AAEA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOA,UAAU,aAAwD,CAAA;AAAA,EAG3E;AAMA,EAAA,OAAOC,UAAU,aAAsB,CAAA;AACzC;;ACzDO,MAAM,SAAA,GAAY;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAW,qBAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAA,cAAA,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.mjs","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 * 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 type { z } from 'zod'\nimport { InvalidUseFormConfigError } from '../../core/errors'\nimport { isZodV4SchemaShape } from '../../core/zod-shape'\nimport { useForm as useFormV3 } from '../../composables/use-form'\nimport { useForm as useFormV4 } from '../zod-v4'\nimport type { StorageShape } from '../zod-v4/types-storage-shape'\nimport type {\n AbstractSchema,\n ValidateOnConfig,\n UseFormReturnType,\n UseFormConfiguration,\n} from '../../types/types-api'\nimport type { DeepPartial, DefaultValuesShape, GenericForm } from '../../types/types-core'\n\n/**\n * Create a form bound to a Zod schema. Accepts both Zod v3 and Zod v4\n * schemas; the runtime picks the right adapter from the schema's\n * shape.\n *\n * Type inference targets Zod v4 — the recommended major. Consumers\n * still on Zod v3 get correct runtime behavior here, but the strongest\n * TypeScript inference comes from importing `attaform/zod-v3`\n * directly.\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 */\nexport function useForm<Schema extends z.ZodObject>(\n configuration: Omit<\n UseFormConfiguration<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n AbstractSchema<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never\n >,\n DeepPartial<DefaultValuesShape<z.input<Schema> extends GenericForm ? z.input<Schema> : never>>\n >,\n 'schema' | 'validateOn' | 'debounceMs'\n > & { schema: Schema } & ValidateOnConfig\n): UseFormReturnType<\n z.input<Schema> extends GenericForm ? z.input<Schema> : never,\n z.output<Schema> extends GenericForm ? z.output<Schema> : never,\n StorageShape<Schema> extends GenericForm ? StorageShape<Schema> : never\n> {\n // Foot-gun guard mirrors the typed wrappers'.\n if (\n configuration === undefined ||\n configuration === null ||\n (configuration as { schema?: unknown }).schema === undefined\n ) {\n throw new InvalidUseFormConfigError()\n }\n\n const { schema } = configuration as { schema: unknown }\n if (isZodV4SchemaShape(schema)) {\n return useFormV4(configuration as Parameters<typeof useFormV4<Schema>>[0]) as ReturnType<\n typeof useForm<Schema>\n >\n }\n // Anything else (Zod v3 schema, custom AbstractSchema, schema\n // factory) goes through the v3 wrapper, which already accepts both\n // Zod v3 input and AbstractSchema directly via its existing shape\n // branch. Cast through unknown — the unified entry's TS surface\n // tracks v4, but the runtime accepts the broader shape.\n return useFormV3(configuration as never) as unknown as ReturnType<typeof useForm<Schema>>\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":["useFormV4","useFormV3"],"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;;ACWO,SAAS,QACd,aAAA,EAgBA;AAEA,EAAA,IACE,kBAAkB,MAAA,IAClB,aAAA,KAAkB,IAAA,IACjB,aAAA,CAAuC,WAAW,MAAA,EACnD;AACA,IAAA,MAAM,IAAI,yBAAA,EAA0B;AAAA,EACtC;AAEA,EAAA,MAAM,EAAE,QAAO,GAAI,aAAA;AACnB,EAAA,IAAI,kBAAA,CAAmB,MAAM,CAAA,EAAG;AAC9B,IAAA,OAAOA,UAAU,aAAwD,CAAA;AAAA,EAG3E;AAMA,EAAA,OAAOC,UAAU,aAAsB,CAAA;AACzC;;AC3DO,MAAM,SAAA,GAAY;AAiBlB,SAAS,QAAA,CAAY,QAAW,OAAA,EAA8B;AACnE,EAAA,MAAM,MAAA,GAAS,MAAA;AACf,EAAA,MAAM,QAAA,GAAW,qBAAA,CAAsB,MAAM,CAAA,IAAK,EAAC;AACnD,EAAA,MAAM,MAAA,GAAS,YAAY,MAAM,CAAA;AACjC,EAAA,cAAA,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;;;;"}
|