attaform 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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.BPRHR3Zs.cjs} +20 -8
- package/dist/shared/attaform.BPRHR3Zs.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.C5MH4lNh.d.mts +53 -0
- package/dist/shared/attaform.C6lbmMUe.d.ts +53 -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.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/shared/{attaform.D6Q5ZP8L.mjs → attaform.Drt6fivF.mjs} +20 -8
- package/dist/shared/attaform.Drt6fivF.mjs.map +1 -0
- package/dist/shared/attaform.DtMN-MAm.d.cts +53 -0
- package/dist/zod-v3.cjs +2 -2
- package/dist/zod-v3.d.cts +35 -61
- package/dist/zod-v3.d.mts +35 -61
- package/dist/zod-v3.d.ts +35 -61
- 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 +9 -5
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +37 -11
- package/dist/zod.d.mts +37 -11
- package/dist/zod.d.ts +37 -11
- package/dist/zod.mjs +9 -5
- 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
|
@@ -1,65 +0,0 @@
|
|
|
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.BYbsV2Wv.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Zod v4 adapter entry point. Re-exports the adapter + the useForm
|
|
6
|
-
* wrapper that threads zod-v4-specific schema types through
|
|
7
|
-
* useAbstractForm.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Type of the value accepted at `Path` for `setValue` / `defaultValues`
|
|
12
|
-
* — the schema's `z.input<Schema>` shape at that path. Matches what
|
|
13
|
-
* `form.values.X` returns at runtime (the honest input view storage
|
|
14
|
-
* holds before transforms run).
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* const schema = z.object({
|
|
18
|
-
* flag: z.string().transform((v) => v.length > 10),
|
|
19
|
-
* })
|
|
20
|
-
* type FlagWriteIn = PathInput<typeof schema, 'flag'> // string
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
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;
|
|
24
|
-
/**
|
|
25
|
-
* Type produced at `Path` after the full parse pipeline — the schema's
|
|
26
|
-
* `z.output<Schema>` shape at that path. Matches the `data` payload of
|
|
27
|
-
* `form.process()` and the value handed to `handleSubmit`'s callback.
|
|
28
|
-
*
|
|
29
|
-
* ```ts
|
|
30
|
-
* const schema = z.object({
|
|
31
|
-
* flag: z.string().transform((v) => v.length > 10),
|
|
32
|
-
* })
|
|
33
|
-
* type FlagParsedOut = PathOutput<typeof schema, 'flag'> // boolean
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
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;
|
|
37
|
-
/**
|
|
38
|
-
* Create a form bound to a Zod v4 schema.
|
|
39
|
-
*
|
|
40
|
-
* ```ts
|
|
41
|
-
* import { useForm } from 'attaform/zod'
|
|
42
|
-
* import { z } from 'zod'
|
|
43
|
-
*
|
|
44
|
-
* const form = useForm({
|
|
45
|
-
* schema: z.object({
|
|
46
|
-
* email: z.email(),
|
|
47
|
-
* password: z.string().min(8),
|
|
48
|
-
* }),
|
|
49
|
-
* defaultValues: { email: '' },
|
|
50
|
-
* })
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* Returns a form API exposing `register`, `values`, `errors`,
|
|
54
|
-
* `fields`, `setValue`, `handleSubmit`, `meta`, field-array
|
|
55
|
-
* helpers, and more. See `UseFormReturnType` for the full
|
|
56
|
-
* surface.
|
|
57
|
-
*
|
|
58
|
-
* For Zod v3, import from `attaform/zod-v3` instead.
|
|
59
|
-
*/
|
|
60
|
-
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'> & {
|
|
61
|
-
schema: Schema;
|
|
62
|
-
} & ValidateOnConfig): UseFormReturnType<z.input<Schema> extends GenericForm ? z.input<Schema> : never, z.output<Schema> extends GenericForm ? z.output<Schema> : never>;
|
|
63
|
-
|
|
64
|
-
export { useForm as u };
|
|
65
|
-
export type { PathInput as P, PathOutput as a };
|