attaform 0.19.0 → 0.20.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/README.md +3 -0
- package/dist/chunks/devtools.cjs +1 -1
- package/dist/chunks/devtools.mjs +1 -1
- package/dist/chunks/indexeddb.cjs +1 -1
- package/dist/chunks/indexeddb.mjs +1 -1
- package/dist/chunks/local-storage.cjs +1 -1
- package/dist/chunks/local-storage.mjs +1 -1
- package/dist/chunks/session-storage.cjs +1 -1
- package/dist/chunks/session-storage.mjs +1 -1
- package/dist/index.cjs +3 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -40
- package/dist/index.d.mts +14 -40
- package/dist/index.d.ts +14 -40
- package/dist/index.mjs +5 -5
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +2 -2
- package/dist/runtime/components/DevtoolsValueTree.d.vue.ts +1 -3
- package/dist/runtime/components/DevtoolsValueTree.vue.d.ts +1 -3
- package/dist/runtime/plugins/attaform.cjs +2 -2
- package/dist/runtime/plugins/attaform.mjs +2 -2
- package/dist/shared/attaform.BCBxTyMC.cjs +1882 -0
- package/dist/shared/attaform.BCBxTyMC.cjs.map +1 -0
- package/dist/shared/{attaform.CrpjyXdO.mjs → attaform.BKozEdTr.mjs} +275 -266
- package/dist/shared/attaform.BKozEdTr.mjs.map +1 -0
- package/dist/shared/{attaform.Bubm_slq.cjs → attaform.BM6YD9kZ.cjs} +212 -269
- package/dist/shared/attaform.BM6YD9kZ.cjs.map +1 -0
- package/dist/shared/{attaform.CoxJ8Qm8.cjs → attaform.BPxsYtTe.cjs} +2 -26
- package/dist/shared/attaform.BPxsYtTe.cjs.map +1 -0
- package/dist/shared/{attaform.BqEfHpVB.cjs → attaform.BPy-4qRx.cjs} +275 -268
- package/dist/shared/attaform.BPy-4qRx.cjs.map +1 -0
- package/dist/shared/{attaform.BTpuvGec.d.ts → attaform.Bh3ACtts.d.ts} +109 -101
- package/dist/shared/{attaform.BTi-PsHr.mjs → attaform.BqZuwLTK.mjs} +1868 -1477
- package/dist/shared/attaform.BqZuwLTK.mjs.map +1 -0
- package/dist/shared/{attaform.JBx8cfMA.cjs → attaform.BrrXNmfK.cjs} +263 -799
- package/dist/shared/attaform.BrrXNmfK.cjs.map +1 -0
- package/dist/shared/{attaform.CXpzmj38.mjs → attaform.BupwXkj_.mjs} +213 -270
- package/dist/shared/attaform.BupwXkj_.mjs.map +1 -0
- package/dist/shared/{attaform.ePUcKxId.d.cts → attaform.D5-1XGQU.d.cts} +109 -101
- package/dist/shared/attaform.D6CwqkPx.mjs +1876 -0
- package/dist/shared/attaform.D6CwqkPx.mjs.map +1 -0
- package/dist/shared/attaform.DHRWn-cu.cjs +785 -0
- package/dist/shared/attaform.DHRWn-cu.cjs.map +1 -0
- package/dist/shared/{attaform.C1msmO2v.cjs → attaform.DLnE5bZa.cjs} +1798 -1405
- package/dist/shared/attaform.DLnE5bZa.cjs.map +1 -0
- package/dist/shared/{attaform.D4I63aBV.d.ts → attaform.DSD85fHb.d.cts} +1 -19
- package/dist/shared/{attaform.CBjmobqk.d.cts → attaform.DSD85fHb.d.mts} +1 -19
- package/dist/shared/{attaform.DXYHL99q.d.mts → attaform.DSD85fHb.d.ts} +1 -19
- package/dist/shared/{attaform.B7rzpK1U.d.cts → attaform.DkA5J8NW.d.cts} +1 -17
- package/dist/shared/{attaform.B7rzpK1U.d.mts → attaform.DkA5J8NW.d.mts} +1 -17
- package/dist/shared/{attaform.B7rzpK1U.d.ts → attaform.DkA5J8NW.d.ts} +1 -17
- package/dist/shared/{attaform.CJ-e9gYI.d.ts → attaform.Dl5kDY-A.d.ts} +1 -1
- package/dist/shared/{attaform.CRNA0vrd.d.mts → attaform.DoKXru-a.d.mts} +1 -1
- package/dist/shared/{attaform.BtBmfLQN.d.mts → attaform.EMzJcQci.d.mts} +109 -101
- package/dist/shared/attaform.EZG6fOFb.mjs +35 -0
- package/dist/shared/attaform.EZG6fOFb.mjs.map +1 -0
- package/dist/shared/{attaform.QvygsFGh.d.cts → attaform.GbDo_lJi.d.cts} +1 -1
- package/dist/shared/{attaform.C0uGZQ4M.d.ts → attaform.SfhU0OEY.d.cts} +134 -30
- package/dist/shared/{attaform.C0uGZQ4M.d.cts → attaform.SfhU0OEY.d.mts} +134 -30
- package/dist/shared/{attaform.C0uGZQ4M.d.mts → attaform.SfhU0OEY.d.ts} +134 -30
- package/dist/shared/{attaform.a3uBo-gw.mjs → attaform.iWo9soNX.mjs} +257 -793
- package/dist/shared/attaform.iWo9soNX.mjs.map +1 -0
- package/dist/shared/attaform.tVkmQh5w.mjs +774 -0
- package/dist/shared/attaform.tVkmQh5w.mjs.map +1 -0
- package/dist/transforms.cjs +2 -2
- package/dist/transforms.d.cts +22 -13
- package/dist/transforms.d.mts +22 -13
- package/dist/transforms.d.ts +22 -13
- package/dist/transforms.mjs +1 -1
- package/dist/vite.cjs +8 -7
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +8 -7
- package/dist/vite.mjs.map +1 -1
- package/dist/zod-v3.cjs +3 -3
- package/dist/zod-v3.d.cts +32 -6
- package/dist/zod-v3.d.mts +32 -6
- package/dist/zod-v3.d.ts +32 -6
- package/dist/zod-v3.mjs +3 -3
- package/dist/zod-v4.cjs +3 -3
- package/dist/zod-v4.d.cts +12 -8
- package/dist/zod-v4.d.mts +12 -8
- package/dist/zod-v4.d.ts +12 -8
- package/dist/zod-v4.mjs +3 -3
- package/dist/zod.cjs +8 -8
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +6 -6
- package/dist/zod.d.mts +6 -6
- package/dist/zod.d.ts +6 -6
- package/dist/zod.mjs +6 -6
- package/package.json +2 -1
- package/dist/shared/attaform.BTi-PsHr.mjs.map +0 -1
- package/dist/shared/attaform.BqEfHpVB.cjs.map +0 -1
- package/dist/shared/attaform.Bubm_slq.cjs.map +0 -1
- package/dist/shared/attaform.C1msmO2v.cjs.map +0 -1
- package/dist/shared/attaform.C8CyvYa_.cjs +0 -36
- package/dist/shared/attaform.C8CyvYa_.cjs.map +0 -1
- package/dist/shared/attaform.CXpzmj38.mjs.map +0 -1
- package/dist/shared/attaform.Cghpuav8.mjs +0 -57
- package/dist/shared/attaform.Cghpuav8.mjs.map +0 -1
- package/dist/shared/attaform.CiMqJHDm.mjs +0 -1594
- package/dist/shared/attaform.CiMqJHDm.mjs.map +0 -1
- package/dist/shared/attaform.CoxJ8Qm8.cjs.map +0 -1
- package/dist/shared/attaform.CrpjyXdO.mjs.map +0 -1
- package/dist/shared/attaform.D13GMFgK.mjs +0 -32
- package/dist/shared/attaform.D13GMFgK.mjs.map +0 -1
- package/dist/shared/attaform.JBx8cfMA.cjs.map +0 -1
- package/dist/shared/attaform.OznWyOPy.cjs +0 -1600
- package/dist/shared/attaform.OznWyOPy.cjs.map +0 -1
- package/dist/shared/attaform.a3uBo-gw.mjs.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { t as FormKey, al as ValidateOnConfig, P as OnInvalidSubmitPolicy, V as PersistConfig, y as HistoryConfig, g as CoercionRegistry } from './attaform.C0uGZQ4M.js';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* v3 mirror of the Zod v4 `StorageShape`. Per top-level key, default
|
|
@@ -23,23 +22,6 @@ type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ?
|
|
|
23
22
|
[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]>;
|
|
24
23
|
} : z.input<S>;
|
|
25
24
|
|
|
26
|
-
/**
|
|
27
|
-
* Configuration object for the Zod v3 `useForm` overload. Same
|
|
28
|
-
* shape as the schema-agnostic `UseFormConfiguration`, but with
|
|
29
|
-
* `schema` constrained to a `z.ZodObject` (or wrapped form).
|
|
30
|
-
*/
|
|
31
|
-
type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValues, K extends FormKey = FormKey> = ValidateOnConfig & {
|
|
32
|
-
/** A Zod v3 `ZodObject` schema (or one wrapped in `.optional()` / `.nullable()` / `.default()` / `.refine()`). */
|
|
33
|
-
schema: Schema extends z.ZodType<unknown> ? UnwrapZodObject<Schema> extends z.ZodObject<z.ZodRawShape> ? Schema : never : never;
|
|
34
|
-
key?: K;
|
|
35
|
-
defaultValues?: DefaultValues | (() => DefaultValues) | (() => Promise<DefaultValues>);
|
|
36
|
-
strict?: boolean;
|
|
37
|
-
onInvalidSubmit?: OnInvalidSubmitPolicy;
|
|
38
|
-
persist?: PersistConfig;
|
|
39
|
-
history?: HistoryConfig;
|
|
40
|
-
rememberVariants?: boolean;
|
|
41
|
-
coerce?: boolean | CoercionRegistry;
|
|
42
|
-
};
|
|
43
25
|
/**
|
|
44
26
|
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
45
27
|
* `.transform()` wrappers off a Zod v3 schema to reach the inner
|
|
@@ -50,4 +32,4 @@ type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValue
|
|
|
50
32
|
*/
|
|
51
33
|
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;
|
|
52
34
|
|
|
53
|
-
export type { StorageShape as S, UnwrapZodObject as U
|
|
35
|
+
export type { StorageShape as S, UnwrapZodObject as U };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { t as FormKey, al as ValidateOnConfig, P as OnInvalidSubmitPolicy, V as PersistConfig, y as HistoryConfig, g as CoercionRegistry } from './attaform.C0uGZQ4M.cjs';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* v3 mirror of the Zod v4 `StorageShape`. Per top-level key, default
|
|
@@ -23,23 +22,6 @@ type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ?
|
|
|
23
22
|
[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]>;
|
|
24
23
|
} : z.input<S>;
|
|
25
24
|
|
|
26
|
-
/**
|
|
27
|
-
* Configuration object for the Zod v3 `useForm` overload. Same
|
|
28
|
-
* shape as the schema-agnostic `UseFormConfiguration`, but with
|
|
29
|
-
* `schema` constrained to a `z.ZodObject` (or wrapped form).
|
|
30
|
-
*/
|
|
31
|
-
type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValues, K extends FormKey = FormKey> = ValidateOnConfig & {
|
|
32
|
-
/** A Zod v3 `ZodObject` schema (or one wrapped in `.optional()` / `.nullable()` / `.default()` / `.refine()`). */
|
|
33
|
-
schema: Schema extends z.ZodType<unknown> ? UnwrapZodObject<Schema> extends z.ZodObject<z.ZodRawShape> ? Schema : never : never;
|
|
34
|
-
key?: K;
|
|
35
|
-
defaultValues?: DefaultValues | (() => DefaultValues) | (() => Promise<DefaultValues>);
|
|
36
|
-
strict?: boolean;
|
|
37
|
-
onInvalidSubmit?: OnInvalidSubmitPolicy;
|
|
38
|
-
persist?: PersistConfig;
|
|
39
|
-
history?: HistoryConfig;
|
|
40
|
-
rememberVariants?: boolean;
|
|
41
|
-
coerce?: boolean | CoercionRegistry;
|
|
42
|
-
};
|
|
43
25
|
/**
|
|
44
26
|
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
45
27
|
* `.transform()` wrappers off a Zod v3 schema to reach the inner
|
|
@@ -50,4 +32,4 @@ type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValue
|
|
|
50
32
|
*/
|
|
51
33
|
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;
|
|
52
34
|
|
|
53
|
-
export type { StorageShape as S, UnwrapZodObject as U
|
|
35
|
+
export type { StorageShape as S, UnwrapZodObject as U };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { t as FormKey, al as ValidateOnConfig, P as OnInvalidSubmitPolicy, V as PersistConfig, y as HistoryConfig, g as CoercionRegistry } from './attaform.C0uGZQ4M.mjs';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* v3 mirror of the Zod v4 `StorageShape`. Per top-level key, default
|
|
@@ -23,23 +22,6 @@ type StorageShape<S extends z.ZodTypeAny> = S extends z.ZodObject<infer Shape> ?
|
|
|
23
22
|
[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]>;
|
|
24
23
|
} : z.input<S>;
|
|
25
24
|
|
|
26
|
-
/**
|
|
27
|
-
* Configuration object for the Zod v3 `useForm` overload. Same
|
|
28
|
-
* shape as the schema-agnostic `UseFormConfiguration`, but with
|
|
29
|
-
* `schema` constrained to a `z.ZodObject` (or wrapped form).
|
|
30
|
-
*/
|
|
31
|
-
type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValues, K extends FormKey = FormKey> = ValidateOnConfig & {
|
|
32
|
-
/** A Zod v3 `ZodObject` schema (or one wrapped in `.optional()` / `.nullable()` / `.default()` / `.refine()`). */
|
|
33
|
-
schema: Schema extends z.ZodType<unknown> ? UnwrapZodObject<Schema> extends z.ZodObject<z.ZodRawShape> ? Schema : never : never;
|
|
34
|
-
key?: K;
|
|
35
|
-
defaultValues?: DefaultValues | (() => DefaultValues) | (() => Promise<DefaultValues>);
|
|
36
|
-
strict?: boolean;
|
|
37
|
-
onInvalidSubmit?: OnInvalidSubmitPolicy;
|
|
38
|
-
persist?: PersistConfig;
|
|
39
|
-
history?: HistoryConfig;
|
|
40
|
-
rememberVariants?: boolean;
|
|
41
|
-
coerce?: boolean | CoercionRegistry;
|
|
42
|
-
};
|
|
43
25
|
/**
|
|
44
26
|
* Peel `.optional()` / `.nullable()` / `.default()` / `.refine()` /
|
|
45
27
|
* `.transform()` wrappers off a Zod v3 schema to reach the inner
|
|
@@ -50,4 +32,4 @@ type UseFormConfigurationWithZod<Schema extends z.ZodType<unknown>, DefaultValue
|
|
|
50
32
|
*/
|
|
51
33
|
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;
|
|
52
34
|
|
|
53
|
-
export type { StorageShape as S, UnwrapZodObject as U
|
|
35
|
+
export type { StorageShape as S, UnwrapZodObject as U };
|
|
@@ -105,22 +105,6 @@ declare class ReservedFormKeyError extends AttaformError {
|
|
|
105
105
|
* `console.warn` so a deployed third-party app shipping the
|
|
106
106
|
* anti-pattern doesn't hard-crash.
|
|
107
107
|
*/
|
|
108
|
-
/**
|
|
109
|
-
* Thrown when `register(path, { persist: true })` or `form.persist(path)`
|
|
110
|
-
* targets a path whose name matches a sensitive-data heuristic
|
|
111
|
-
* (password, cvv, ssn, token, etc.) without an explicit
|
|
112
|
-
* `acknowledgeSensitive: true` override.
|
|
113
|
-
*
|
|
114
|
-
* Sensitive data in client-side storage (localStorage, sessionStorage,
|
|
115
|
-
* IndexedDB) is a compliance risk — it survives logouts, is readable
|
|
116
|
-
* by any same-origin script, and is unencrypted at rest.
|
|
117
|
-
*
|
|
118
|
-
* Fix: pass `acknowledgeSensitive: true` to confirm the persistence
|
|
119
|
-
* is intentional, or persist the data server-side instead.
|
|
120
|
-
*/
|
|
121
|
-
declare class SensitivePersistFieldError extends AttaformError {
|
|
122
|
-
constructor(path: ReadonlyArray<string | number> | string);
|
|
123
|
-
}
|
|
124
108
|
/**
|
|
125
109
|
* Thrown when persistence is misconfigured in a way that would either
|
|
126
110
|
* (a) silently drop writes, or (b) namespace storage under a
|
|
@@ -152,4 +136,4 @@ declare class AnonPersistError extends AttaformError {
|
|
|
152
136
|
});
|
|
153
137
|
}
|
|
154
138
|
|
|
155
|
-
export { AnonPersistError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R,
|
|
139
|
+
export { AnonPersistError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R, SubmitErrorHandlerError as S, AttaformError as a, InvalidUseFormConfigError as b, ReservedFormKeyError as c };
|
|
@@ -105,22 +105,6 @@ declare class ReservedFormKeyError extends AttaformError {
|
|
|
105
105
|
* `console.warn` so a deployed third-party app shipping the
|
|
106
106
|
* anti-pattern doesn't hard-crash.
|
|
107
107
|
*/
|
|
108
|
-
/**
|
|
109
|
-
* Thrown when `register(path, { persist: true })` or `form.persist(path)`
|
|
110
|
-
* targets a path whose name matches a sensitive-data heuristic
|
|
111
|
-
* (password, cvv, ssn, token, etc.) without an explicit
|
|
112
|
-
* `acknowledgeSensitive: true` override.
|
|
113
|
-
*
|
|
114
|
-
* Sensitive data in client-side storage (localStorage, sessionStorage,
|
|
115
|
-
* IndexedDB) is a compliance risk — it survives logouts, is readable
|
|
116
|
-
* by any same-origin script, and is unencrypted at rest.
|
|
117
|
-
*
|
|
118
|
-
* Fix: pass `acknowledgeSensitive: true` to confirm the persistence
|
|
119
|
-
* is intentional, or persist the data server-side instead.
|
|
120
|
-
*/
|
|
121
|
-
declare class SensitivePersistFieldError extends AttaformError {
|
|
122
|
-
constructor(path: ReadonlyArray<string | number> | string);
|
|
123
|
-
}
|
|
124
108
|
/**
|
|
125
109
|
* Thrown when persistence is misconfigured in a way that would either
|
|
126
110
|
* (a) silently drop writes, or (b) namespace storage under a
|
|
@@ -152,4 +136,4 @@ declare class AnonPersistError extends AttaformError {
|
|
|
152
136
|
});
|
|
153
137
|
}
|
|
154
138
|
|
|
155
|
-
export { AnonPersistError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R,
|
|
139
|
+
export { AnonPersistError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R, SubmitErrorHandlerError as S, AttaformError as a, InvalidUseFormConfigError as b, ReservedFormKeyError as c };
|
|
@@ -105,22 +105,6 @@ declare class ReservedFormKeyError extends AttaformError {
|
|
|
105
105
|
* `console.warn` so a deployed third-party app shipping the
|
|
106
106
|
* anti-pattern doesn't hard-crash.
|
|
107
107
|
*/
|
|
108
|
-
/**
|
|
109
|
-
* Thrown when `register(path, { persist: true })` or `form.persist(path)`
|
|
110
|
-
* targets a path whose name matches a sensitive-data heuristic
|
|
111
|
-
* (password, cvv, ssn, token, etc.) without an explicit
|
|
112
|
-
* `acknowledgeSensitive: true` override.
|
|
113
|
-
*
|
|
114
|
-
* Sensitive data in client-side storage (localStorage, sessionStorage,
|
|
115
|
-
* IndexedDB) is a compliance risk — it survives logouts, is readable
|
|
116
|
-
* by any same-origin script, and is unencrypted at rest.
|
|
117
|
-
*
|
|
118
|
-
* Fix: pass `acknowledgeSensitive: true` to confirm the persistence
|
|
119
|
-
* is intentional, or persist the data server-side instead.
|
|
120
|
-
*/
|
|
121
|
-
declare class SensitivePersistFieldError extends AttaformError {
|
|
122
|
-
constructor(path: ReadonlyArray<string | number> | string);
|
|
123
|
-
}
|
|
124
108
|
/**
|
|
125
109
|
* Thrown when persistence is misconfigured in a way that would either
|
|
126
110
|
* (a) silently drop writes, or (b) namespace storage under a
|
|
@@ -152,4 +136,4 @@ declare class AnonPersistError extends AttaformError {
|
|
|
152
136
|
});
|
|
153
137
|
}
|
|
154
138
|
|
|
155
|
-
export { AnonPersistError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R,
|
|
139
|
+
export { AnonPersistError as A, InvalidPathError as I, OutsideSetupError as O, RegistryNotInstalledError as R, SubmitErrorHandlerError as S, AttaformError as a, InvalidUseFormConfigError as b, ReservedFormKeyError as c };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, q as FlatPath, B as NestedType, t as FormKey, ai as UseFormConfiguration, A as AbstractSchema, j as DefaultValuesInput, al as ValidateOnConfig, aj as UseFormReturnType } from './attaform.
|
|
2
|
+
import { G as GenericForm, q as FlatPath, B as NestedType, t as FormKey, ai as UseFormConfiguration, A as AbstractSchema, j as DefaultValuesInput, al as ValidateOnConfig, aj as UseFormReturnType } from './attaform.SfhU0OEY.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The shape `form.values.<key>` returns at runtime.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, q as FlatPath, B as NestedType, t as FormKey, ai as UseFormConfiguration, A as AbstractSchema, j as DefaultValuesInput, al as ValidateOnConfig, aj as UseFormReturnType } from './attaform.
|
|
2
|
+
import { G as GenericForm, q as FlatPath, B as NestedType, t as FormKey, ai as UseFormConfiguration, A as AbstractSchema, j as DefaultValuesInput, al as ValidateOnConfig, aj as UseFormReturnType } from './attaform.SfhU0OEY.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The shape `form.values.<key>` returns at runtime.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as FormKey, ae as SlimPrimitiveKind, C as CoercionEntry, g as CoercionRegistry, G as GenericForm, T as PathKey, S as Path, am as ValidationError, A as AbstractSchema, x as GetDisplayState, aq as WriteMeta, D as DeepPartial, ar as WriteShape, ak as ValidateOn, Y as PersistOptInRegistry,
|
|
1
|
+
import { t as FormKey, ae as SlimPrimitiveKind, C as CoercionEntry, g as CoercionRegistry, G as GenericForm, T as PathKey, S as Path, am as ValidationError, A as AbstractSchema, x as GetDisplayState, aq as WriteMeta, D as DeepPartial, ar as WriteShape, ak as ValidateOn, Y as PersistOptInRegistry, f as AttaformDefaults, aj as UseFormReturnType, a8 as RegisterValue } from './attaform.SfhU0OEY.mjs';
|
|
2
2
|
import { Ref, ComputedRef, App, InjectionKey } from 'vue';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -61,7 +61,7 @@ type FormStatus = {
|
|
|
61
61
|
* entry carries the formKey + path tuple so consumers can route to the
|
|
62
62
|
* offending field from a wizard-wide error summary.
|
|
63
63
|
*/
|
|
64
|
-
type
|
|
64
|
+
type WizardAggregateError = {
|
|
65
65
|
readonly formKey: FormKey;
|
|
66
66
|
readonly path: ReadonlyArray<string | number>;
|
|
67
67
|
readonly message: string;
|
|
@@ -213,7 +213,7 @@ type WizardOnSubmit = (ctx: WizardSubmitContext) => void | Promise<void>;
|
|
|
213
213
|
* validation and activation failures (`atta:activation-failed`). Sync
|
|
214
214
|
* or async; the returned promise gates `wizard.submitting`.
|
|
215
215
|
*/
|
|
216
|
-
type WizardOnError = (errors: readonly
|
|
216
|
+
type WizardOnError = (errors: readonly WizardAggregateError[]) => void | Promise<void>;
|
|
217
217
|
/**
|
|
218
218
|
* Options for `useWizard({ steps, … })`. `steps` is the only required
|
|
219
219
|
* field; the rest are optional and default sensibly for the common
|
|
@@ -439,7 +439,7 @@ type UseWizardReturnType<S extends ReadonlyArray<StepSlot> = ReadonlyArray<StepS
|
|
|
439
439
|
readonly count: number;
|
|
440
440
|
readonly statuses: WizardStatusesProxy<Record<string, FormStatus>>;
|
|
441
441
|
readonly allValues: Readonly<Record<FormKey, unknown>>;
|
|
442
|
-
readonly allErrors: Readonly<Record<FormKey, readonly
|
|
442
|
+
readonly allErrors: Readonly<Record<FormKey, readonly WizardAggregateError[]>>;
|
|
443
443
|
readonly progress: number;
|
|
444
444
|
readonly canAdvance: boolean;
|
|
445
445
|
readonly canGoBack: boolean;
|
|
@@ -701,6 +701,15 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
701
701
|
* plain-value forms. Read by `form.rehydrate()`.
|
|
702
702
|
*/
|
|
703
703
|
readonly defaultValuesFactory: Ref<(() => unknown | Promise<unknown>) | undefined>;
|
|
704
|
+
/**
|
|
705
|
+
* `true` when this store carries an SSR prefetch queue (server path
|
|
706
|
+
* where `state.activate()` must enqueue intent before deciding
|
|
707
|
+
* whether to fire). The flag lets `buildFormApi` skip the lazy
|
|
708
|
+
* activation gate for forms with no factory AND no SSR prefetch —
|
|
709
|
+
* the common client-side case where `gated()` is otherwise pure
|
|
710
|
+
* reactive overhead on every public method call.
|
|
711
|
+
*/
|
|
712
|
+
readonly hasSsrPrefetch: boolean;
|
|
704
713
|
/**
|
|
705
714
|
* `true` once the form's effective defaults have been applied —
|
|
706
715
|
* sync `defaultValues` at construction, or async factory whose
|
|
@@ -797,6 +806,14 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
797
806
|
* answer.
|
|
798
807
|
*/
|
|
799
808
|
pathHasAsyncValidation(path: Path): boolean;
|
|
809
|
+
/**
|
|
810
|
+
* Precomputed-key shortcut for `pathHasAsyncValidation`. The
|
|
811
|
+
* canonical key is required and must correspond to `segments`; the
|
|
812
|
+
* helper skips the `canonicalizePath` round-trip so descendant-walk
|
|
813
|
+
* loops (whose Map iteration already yields the canonical key) can
|
|
814
|
+
* read the async-gate verdict without a per-leaf canonicalize.
|
|
815
|
+
*/
|
|
816
|
+
pathHasAsyncValidationByKey(key: PathKey, segments: Path): boolean;
|
|
800
817
|
/**
|
|
801
818
|
* Per-path counter of in-flight field-level validation runs.
|
|
802
819
|
* `field.validating` on `FieldState` mirrors
|
|
@@ -852,14 +869,6 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
852
869
|
arrayElementKey(path: Path): string;
|
|
853
870
|
reset(nextDefaultValues?: DeepPartial<WriteShape<F>>): void;
|
|
854
871
|
resetField(path: Path): void;
|
|
855
|
-
/**
|
|
856
|
-
* Wipe `path` (or the whole form when `path === ''`) to the
|
|
857
|
-
* schema's "appropriate nullish value" — the underlying type's
|
|
858
|
-
* empty/falsy concrete, with `.default()` / `.catch()` wrappers
|
|
859
|
-
* INTENTIONALLY skipped. Sugar for
|
|
860
|
-
* `setValueAtPath(path, schema.getEmptyValueAtPath(path))`.
|
|
861
|
-
*/
|
|
862
|
-
clear(path: Path): boolean;
|
|
863
872
|
setSchemaErrorsForPath(path: Path, errors: ValidationError[]): void;
|
|
864
873
|
setAllSchemaErrors(errors: readonly ValidationError[]): void;
|
|
865
874
|
clearSchemaErrors(path?: Path): void;
|
|
@@ -912,7 +921,6 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
912
921
|
markFocused(path: Path, focused: boolean, meta?: {
|
|
913
922
|
readonly instance?: WriteMeta['instance'];
|
|
914
923
|
}): void;
|
|
915
|
-
markTouched(path: Path): void;
|
|
916
924
|
/**
|
|
917
925
|
* Flip `interacted: true` on a leaf — the sticky value-mutation flag.
|
|
918
926
|
* Driven by the directive's input listeners (via the RegisterValue's
|
|
@@ -945,6 +953,14 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
945
953
|
* isn't exposed to consumers.
|
|
946
954
|
*/
|
|
947
955
|
isPristineAtPath(path: Path): boolean;
|
|
956
|
+
/**
|
|
957
|
+
* Precomputed-key shortcut for `isPristineAtPath`. The canonical
|
|
958
|
+
* key is required and must correspond to `segments`; the helper
|
|
959
|
+
* skips the `canonicalizePath` round-trip so descendant-walk loops
|
|
960
|
+
* (whose Map iteration already yields the canonical key) can read
|
|
961
|
+
* the pristine verdict without a per-leaf canonicalize.
|
|
962
|
+
*/
|
|
963
|
+
isPristineAtPathByKey(key: PathKey, segments: Path): boolean;
|
|
948
964
|
/**
|
|
949
965
|
* Whether any tracked array under `path` has changed shape — a reorder,
|
|
950
966
|
* insert, or removal — relative to its construction/reset baseline. The
|
|
@@ -1086,7 +1102,7 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
1086
1102
|
* Resolved sensitive-path predicate for THIS form. Honors the
|
|
1087
1103
|
* cascade (`useForm({ sensitiveNames })` > global default >
|
|
1088
1104
|
* library `DEFAULT_SENSITIVE_NAMES`). Used by:
|
|
1089
|
-
* - persistence
|
|
1105
|
+
* - the persistence opt-in gate (`allowSensitivePersist`);
|
|
1090
1106
|
* - the multi-tab sync module (outbound strip + inbound reject);
|
|
1091
1107
|
* - DevTools edit rejection;
|
|
1092
1108
|
* - any future surface that needs to flag "this path holds
|
|
@@ -1097,14 +1113,6 @@ type FormStore<F extends GenericForm, G extends GenericForm = F> = {
|
|
|
1097
1113
|
* resolved-config surface.
|
|
1098
1114
|
*/
|
|
1099
1115
|
readonly isSensitivePath: (path: Path | PathKey | string) => boolean;
|
|
1100
|
-
/**
|
|
1101
|
-
* Single-segment variant of `isSensitivePath`. Used by the DevTools
|
|
1102
|
-
* redact walk to short-circuit whole subtrees the moment any
|
|
1103
|
-
* ancestor segment matches — saving an O(leaves × ancestors) regex
|
|
1104
|
-
* sweep per timeline event. Resolved from the same `sensitiveNames`
|
|
1105
|
-
* cascade as `isSensitivePath`.
|
|
1106
|
-
*/
|
|
1107
|
-
readonly segmentMatchesSensitive: (segment: Segment) => boolean;
|
|
1108
1116
|
/**
|
|
1109
1117
|
* Canonical path keys explicitly opted OUT of multi-tab sync by
|
|
1110
1118
|
* `register(path, { multiTab: false })`. The sync module's outbound
|
|
@@ -1428,6 +1436,83 @@ type InjectFormInput = {
|
|
|
1428
1436
|
*/
|
|
1429
1437
|
declare function injectForm<Form extends GenericForm, GetValueFormType extends GenericForm = Form>(input?: FormKey | InjectFormInput): UseFormReturnType<Form, GetValueFormType> | null;
|
|
1430
1438
|
|
|
1439
|
+
/**
|
|
1440
|
+
* Re-bind a parent's `v-register` onto an inner native element. Use
|
|
1441
|
+
* inside a component that wraps a single form field whose root is
|
|
1442
|
+
* NOT the input itself (e.g. a labelled-row that renders `<label>`
|
|
1443
|
+
* around the input).
|
|
1444
|
+
*
|
|
1445
|
+
* ```vue
|
|
1446
|
+
* <!-- Parent -->
|
|
1447
|
+
* <MyInput v-register="form.register('email')" />
|
|
1448
|
+
*
|
|
1449
|
+
* <!-- MyInput.vue -->
|
|
1450
|
+
* <script setup lang="ts">
|
|
1451
|
+
* import { useRegister } from 'attaform'
|
|
1452
|
+
* const rv = useRegister()
|
|
1453
|
+
* // rv.path / rv.segments / rv.formKey / rv.formInstanceId / rv.innerRef
|
|
1454
|
+
* // are all reachable directly — no `.value` unwrap.
|
|
1455
|
+
* </script>
|
|
1456
|
+
*
|
|
1457
|
+
* <template>
|
|
1458
|
+
* <label class="field">
|
|
1459
|
+
* <span>Email</span>
|
|
1460
|
+
* <input v-register="rv" />
|
|
1461
|
+
* </label>
|
|
1462
|
+
* </template>
|
|
1463
|
+
* ```
|
|
1464
|
+
*
|
|
1465
|
+
* Returns a hybrid Proxy: it answers `__v_isRef` / `.value` like a
|
|
1466
|
+
* Vue `Ref<RegisterValue | undefined>` (so templates auto-unwrap
|
|
1467
|
+
* correctly and `v-register="rv"` feeds the underlying RV to the
|
|
1468
|
+
* directive — preserving the directive's path-migration diff across
|
|
1469
|
+
* renders), AND every other property read pierces to the captured
|
|
1470
|
+
* RV's field (so `rv.path` works directly in script setup). Reads
|
|
1471
|
+
* inside reactive scopes (`computed` / `watchEffect`) track the
|
|
1472
|
+
* underlying `shallowRef`, so `rv.path` re-runs when the parent
|
|
1473
|
+
* rebinds to a different path.
|
|
1474
|
+
*
|
|
1475
|
+
* Unbound state: when the parent didn't pass `v-register`, every
|
|
1476
|
+
* piercing read returns `undefined` at runtime, and the return type
|
|
1477
|
+
* surfaces this honestly as `UseRegisterReturn<V> | undefined`.
|
|
1478
|
+
* Consumers defend with optional chaining (`rv?.formKey`,
|
|
1479
|
+
* `rv?.segments`); the directive accepts `undefined` peacefully (its
|
|
1480
|
+
* binding value type is already `RegisterValue<V> | undefined`), so
|
|
1481
|
+
* `v-register="rv"` works whether or not a parent has bound. The
|
|
1482
|
+
* composable's `onMounted` warn fires once per instance to surface
|
|
1483
|
+
* the misuse case at runtime.
|
|
1484
|
+
*
|
|
1485
|
+
* Diagnostic: in dev mode, a single `console.warn` fires per instance
|
|
1486
|
+
* at `onMounted` if the captured value is still `undefined` — by then
|
|
1487
|
+
* the parent has had its full mount lifecycle to bind, so a missing
|
|
1488
|
+
* binding is conclusive misuse. The warn does NOT fire on every read
|
|
1489
|
+
* of the proxy, and is intentionally silent under SSR
|
|
1490
|
+
* (`renderToString` skips `onMounted`); the CSR hydration pass
|
|
1491
|
+
* surfaces the same diagnostic without double-counting through Nuxt's
|
|
1492
|
+
* `dev:ssr-logs` channel.
|
|
1493
|
+
*
|
|
1494
|
+
* When the wrapper's root IS the input itself, Vue's attribute
|
|
1495
|
+
* fallthrough handles the binding and `useRegister` is unnecessary.
|
|
1496
|
+
* For wrappers that bind multiple fields (compound forms), use
|
|
1497
|
+
* `injectForm<Form>(key?)` and call `ctx.register(...)` directly.
|
|
1498
|
+
*/
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* Return type of `useRegister()`. Hybrid of `RegisterValue<V>` (so
|
|
1502
|
+
* `rv.path` / `rv.segments` / `rv.formKey` etc. work directly in
|
|
1503
|
+
* script setup) and `Ref<RegisterValue<V> | undefined>` (so Vue's
|
|
1504
|
+
* template auto-unwrap surfaces the underlying RV to `v-register`
|
|
1505
|
+
* and the directive's path-migration diff sees the real RV across
|
|
1506
|
+
* renders).
|
|
1507
|
+
*
|
|
1508
|
+
* The two surfaces don't clash at the type level: `RegisterValue`
|
|
1509
|
+
* doesn't carry a `value` field, and `Ref<T>`'s `value: T` becomes
|
|
1510
|
+
* the hybrid's only `.value`. Older code that read `rv.value?.path`
|
|
1511
|
+
* keeps working; new code can write `rv.path` directly.
|
|
1512
|
+
*/
|
|
1513
|
+
type UseRegisterReturn<V = unknown> = RegisterValue<V> & Ref<RegisterValue<V> | undefined>;
|
|
1514
|
+
declare function useRegister<V = unknown>(): UseRegisterReturn<V> | undefined;
|
|
1515
|
+
|
|
1431
1516
|
/**
|
|
1432
1517
|
* Multistep-form orchestrator built around an ordered list of step slots.
|
|
1433
1518
|
* Each slot resolves to a participating form: an existing `useForm`
|
|
@@ -1543,83 +1628,6 @@ declare function injectWizard(input?: string | InjectWizardInput): UseWizardRetu
|
|
|
1543
1628
|
*/
|
|
1544
1629
|
declare function lazy<Ctx = WizardCtx>(resolve: (ctx: Ctx) => AnyForm | string | undefined): LazyMarker<Ctx>;
|
|
1545
1630
|
|
|
1546
|
-
/**
|
|
1547
|
-
* Re-bind a parent's `v-register` onto an inner native element. Use
|
|
1548
|
-
* inside a component that wraps a single form field whose root is
|
|
1549
|
-
* NOT the input itself (e.g. a labelled-row that renders `<label>`
|
|
1550
|
-
* around the input).
|
|
1551
|
-
*
|
|
1552
|
-
* ```vue
|
|
1553
|
-
* <!-- Parent -->
|
|
1554
|
-
* <MyInput v-register="form.register('email')" />
|
|
1555
|
-
*
|
|
1556
|
-
* <!-- MyInput.vue -->
|
|
1557
|
-
* <script setup lang="ts">
|
|
1558
|
-
* import { useRegister } from 'attaform'
|
|
1559
|
-
* const rv = useRegister()
|
|
1560
|
-
* // rv.path / rv.segments / rv.formKey / rv.formInstanceId / rv.innerRef
|
|
1561
|
-
* // are all reachable directly — no `.value` unwrap.
|
|
1562
|
-
* </script>
|
|
1563
|
-
*
|
|
1564
|
-
* <template>
|
|
1565
|
-
* <label class="field">
|
|
1566
|
-
* <span>Email</span>
|
|
1567
|
-
* <input v-register="rv" />
|
|
1568
|
-
* </label>
|
|
1569
|
-
* </template>
|
|
1570
|
-
* ```
|
|
1571
|
-
*
|
|
1572
|
-
* Returns a hybrid Proxy: it answers `__v_isRef` / `.value` like a
|
|
1573
|
-
* Vue `Ref<RegisterValue | undefined>` (so templates auto-unwrap
|
|
1574
|
-
* correctly and `v-register="rv"` feeds the underlying RV to the
|
|
1575
|
-
* directive — preserving the directive's path-migration diff across
|
|
1576
|
-
* renders), AND every other property read pierces to the captured
|
|
1577
|
-
* RV's field (so `rv.path` works directly in script setup). Reads
|
|
1578
|
-
* inside reactive scopes (`computed` / `watchEffect`) track the
|
|
1579
|
-
* underlying `shallowRef`, so `rv.path` re-runs when the parent
|
|
1580
|
-
* rebinds to a different path.
|
|
1581
|
-
*
|
|
1582
|
-
* Unbound state: when the parent didn't pass `v-register`, every
|
|
1583
|
-
* piercing read returns `undefined` at runtime, and the return type
|
|
1584
|
-
* surfaces this honestly as `UseRegisterReturn<V> | undefined`.
|
|
1585
|
-
* Consumers defend with optional chaining (`rv?.formKey`,
|
|
1586
|
-
* `rv?.segments`); the directive accepts `undefined` peacefully (its
|
|
1587
|
-
* binding value type is already `RegisterValue<V> | undefined`), so
|
|
1588
|
-
* `v-register="rv"` works whether or not a parent has bound. The
|
|
1589
|
-
* composable's `onMounted` warn fires once per instance to surface
|
|
1590
|
-
* the misuse case at runtime.
|
|
1591
|
-
*
|
|
1592
|
-
* Diagnostic: in dev mode, a single `console.warn` fires per instance
|
|
1593
|
-
* at `onMounted` if the captured value is still `undefined` — by then
|
|
1594
|
-
* the parent has had its full mount lifecycle to bind, so a missing
|
|
1595
|
-
* binding is conclusive misuse. The warn does NOT fire on every read
|
|
1596
|
-
* of the proxy, and is intentionally silent under SSR
|
|
1597
|
-
* (`renderToString` skips `onMounted`); the CSR hydration pass
|
|
1598
|
-
* surfaces the same diagnostic without double-counting through Nuxt's
|
|
1599
|
-
* `dev:ssr-logs` channel.
|
|
1600
|
-
*
|
|
1601
|
-
* When the wrapper's root IS the input itself, Vue's attribute
|
|
1602
|
-
* fallthrough handles the binding and `useRegister` is unnecessary.
|
|
1603
|
-
* For wrappers that bind multiple fields (compound forms), use
|
|
1604
|
-
* `injectForm<Form>(key?)` and call `ctx.register(...)` directly.
|
|
1605
|
-
*/
|
|
1606
|
-
|
|
1607
|
-
/**
|
|
1608
|
-
* Return type of `useRegister()`. Hybrid of `RegisterValue<V>` (so
|
|
1609
|
-
* `rv.path` / `rv.segments` / `rv.formKey` etc. work directly in
|
|
1610
|
-
* script setup) and `Ref<RegisterValue<V> | undefined>` (so Vue's
|
|
1611
|
-
* template auto-unwrap surfaces the underlying RV to `v-register`
|
|
1612
|
-
* and the directive's path-migration diff sees the real RV across
|
|
1613
|
-
* renders).
|
|
1614
|
-
*
|
|
1615
|
-
* The two surfaces don't clash at the type level: `RegisterValue`
|
|
1616
|
-
* doesn't carry a `value` field, and `Ref<T>`'s `value: T` becomes
|
|
1617
|
-
* the hybrid's only `.value`. Older code that read `rv.value?.path`
|
|
1618
|
-
* keeps working; new code can write `rv.path` directly.
|
|
1619
|
-
*/
|
|
1620
|
-
type UseRegisterReturn<V = unknown> = RegisterValue<V> & Ref<RegisterValue<V> | undefined>;
|
|
1621
|
-
declare function useRegister<V = unknown>(): UseRegisterReturn<V> | undefined;
|
|
1622
|
-
|
|
1623
1631
|
/**
|
|
1624
1632
|
* Stable identifiers for library-emitted `ValidationError` codes.
|
|
1625
1633
|
*
|
|
@@ -1680,5 +1688,5 @@ declare const AttaformErrorCode: {
|
|
|
1680
1688
|
};
|
|
1681
1689
|
type AttaformErrorCode = (typeof AttaformErrorCode)[keyof typeof AttaformErrorCode];
|
|
1682
1690
|
|
|
1683
|
-
export { AttaformErrorCode as
|
|
1684
|
-
export type {
|
|
1691
|
+
export { AttaformErrorCode as a, createRegistry as p, defaultCoercionRules as q, defineCoercion as r, getRegistryFromApp as s, injectForm as t, injectWizard as u, kAttaformRegistry as v, lazy as w, useRegister as x, useRegistry as y, useWizard as z };
|
|
1692
|
+
export type { AnyForm as A, CompiledStep as C, FormStatus as F, InjectWizardInput as I, LazyMarker as L, SSRDetectOptions as S, UseRegisterReturn as U, WizardAggregateError as W, AttaformRegistry as b, SerializedFormData as c, StepSlot as d, UseWizardReturnType as e, WizardCtx as f, WizardCtxForm as g, WizardOnError as h, WizardOnSubmit as i, WizardOptions as j, WizardPersistFn as k, WizardRestoreFn as l, WizardRestoreState as m, WizardStatusesProxy as n, WizardSubmitContext as o };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { r as getRegistryFromApp, C as pathKeyToDotted } from './attaform.BKozEdTr.mjs';
|
|
2
|
+
|
|
3
|
+
function renderAttaformState(app) {
|
|
4
|
+
const registry = getRegistryFromApp(app);
|
|
5
|
+
const forms = [];
|
|
6
|
+
for (const [key, state] of registry.forms) {
|
|
7
|
+
const transientList = [];
|
|
8
|
+
for (const pk of state.blankPaths) {
|
|
9
|
+
const d = pathKeyToDotted(pk);
|
|
10
|
+
if (d !== null) transientList.push(d);
|
|
11
|
+
}
|
|
12
|
+
forms.push([
|
|
13
|
+
key,
|
|
14
|
+
{
|
|
15
|
+
form: state.form.value,
|
|
16
|
+
schemaErrors: Array.from(state.schemaErrors.entries()),
|
|
17
|
+
userErrors: Array.from(state.userErrors.entries()),
|
|
18
|
+
fields: Array.from(state.fields.entries()),
|
|
19
|
+
...transientList.length > 0 ? { blankPaths: transientList } : {}
|
|
20
|
+
}
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
return { forms };
|
|
24
|
+
}
|
|
25
|
+
function hydrateAttaformState(app, payload) {
|
|
26
|
+
const registry = getRegistryFromApp(app);
|
|
27
|
+
for (const [key, data] of payload.forms) {
|
|
28
|
+
registry.pendingHydration.set(key, data);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const DEVTOOLS_WINDOW_KEY = "__attaform_devtools__";
|
|
33
|
+
|
|
34
|
+
export { DEVTOOLS_WINDOW_KEY as D, hydrateAttaformState as h, renderAttaformState as r };
|
|
35
|
+
//# sourceMappingURL=attaform.EZG6fOFb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attaform.EZG6fOFb.mjs","sources":["../../src/runtime/core/serialize.ts","../../src/runtime/core/devtools-shared.ts"],"sourcesContent":["import type { App } from 'vue'\nimport type { FormKey } from '../types/types-api'\nimport { pathKeyToDotted, type PathKey } from './paths'\nimport { getRegistryFromApp, type SerializedFormData } from './registry'\n\n/**\n * Serialised snapshot of every form in a Vue app, produced by\n * `renderAttaformState` and consumed by `hydrateAttaformState`.\n *\n * JSON-safe — pass to `JSON.stringify`, `devalue`, or any other\n * serialiser before embedding in your SSR payload.\n */\nexport type SerializedAttaformState = {\n /** Tuples of `[formKey, snapshot]` for every form in the app. */\n readonly forms: ReadonlyArray<readonly [FormKey, SerializedFormData]>\n}\n\n/**\n * Snapshot every form on a Vue app for SSR. Call from your server\n * entry after rendering the app:\n *\n * ```ts\n * import { renderToString } from '@vue/server-renderer'\n * import { renderAttaformState, escapeForInlineScript } from 'attaform'\n *\n * const html = await renderToString(app)\n * const state = renderAttaformState(app)\n * const payload = escapeForInlineScript(JSON.stringify(state))\n *\n * return `\n * ${html}\n * <script>window.__ATTAFORM_STATE__ = ${payload}</script>\n * `\n * ```\n *\n * Pair with `hydrateAttaformState` on the client to restore the\n * forms in their server-rendered state. Nuxt users don't need this —\n * `attaform/nuxt` wires SSR automatically.\n */\nexport function renderAttaformState(app: App): SerializedAttaformState {\n const registry = getRegistryFromApp(app)\n const forms: Array<readonly [FormKey, SerializedFormData]> = []\n for (const [key, state] of registry.forms) {\n // Skip the blank field when the set is empty so the\n // wire payload stays minimal for forms that don't use it. The\n // optional shape on the consuming side handles the absence\n // cleanly (defaults to \"no blank paths\"). PathKey → dotted at\n // the boundary so the wire shape matches the rest of the\n // public path notation.\n const transientList: string[] = []\n for (const pk of state.blankPaths) {\n const d = pathKeyToDotted(pk as PathKey)\n if (d !== null) transientList.push(d)\n }\n forms.push([\n key,\n {\n form: state.form.value,\n schemaErrors: Array.from(state.schemaErrors.entries()),\n userErrors: Array.from(state.userErrors.entries()),\n fields: Array.from(state.fields.entries()),\n ...(transientList.length > 0 ? { blankPaths: transientList } : {}),\n },\n ])\n }\n return { forms }\n}\n\n/**\n * Restore forms from a server-rendered snapshot on the client. Call\n * from your client entry before mounting:\n *\n * ```ts\n * import { createApp } from 'vue'\n * import { createAttaform, hydrateAttaformState } from 'attaform'\n *\n * const app = createApp(App).use(createAttaform())\n * hydrateAttaformState(app, window.__ATTAFORM_STATE__)\n * app.mount('#app')\n * ```\n *\n * The next `useForm({ key })` call for each serialised form picks up\n * the snapshot transparently — no further action is required.\n */\nexport function hydrateAttaformState(app: App, payload: SerializedAttaformState): void {\n const registry = getRegistryFromApp(app)\n for (const [key, data] of payload.forms) {\n registry.pendingHydration.set(key, data)\n }\n}\n","/**\n * Shared building blocks for Attaform's two devtools surfaces — the Vue\n * DevTools (Chrome-extension) inspector wired up in `./devtools.ts`, and\n * the Nuxt DevTools (overlay) panel wired up via `../../nuxt.ts` +\n * `../pages/_attaform_devtools.vue`.\n *\n * Houses the window-bridge contract both surfaces consume so a new\n * bridge field lands in one file. Both surfaces render RAW form values\n * by design — DevTools is a dev-only surface, and redaction across every\n * place a value surfaces is impractical security theater rather than a\n * real safeguard.\n */\nimport type { AttaformRegistry } from './registry'\n\n/**\n * Property key on `window` that the Nuxt-side dev plugin attaches the\n * bridge object to. The iframe-mounted overlay panel reads\n * `window.parent[DEVTOOLS_WINDOW_KEY]` to reach the host app's registry.\n *\n * Underscored + namespaced to make accidental collision with consumer\n * globals vanishingly unlikely. Stable across versions — bumping it\n * would silently disconnect older library builds from newer overlay\n * panels in the same browser tab during a library upgrade.\n */\nexport const DEVTOOLS_WINDOW_KEY = '__attaform_devtools__'\n\n/**\n * Shape of the object the host plugin attaches to `window` in dev mode.\n * The iframe overlay panel reads this to discover the live registry and\n * render its forms.\n *\n * Single-registry assumption: the latest `createAttaform()` install\n * wins. Multi-app pages (rare; typically only seen in micro-frontend\n * setups) will only see one app's forms in the panel. Documented but\n * not actively supported — the alternative (a Set of registries with\n * union-rendering) is a future call if a real consumer hits it.\n */\nexport interface AttaformDevtoolsBridge {\n registry: AttaformRegistry\n /**\n * The library version, surfaced in the panel's footer for support /\n * bug-report context. Read from `package.json` at host-plugin init.\n */\n version: string\n}\n\ndeclare global {\n interface Window {\n [DEVTOOLS_WINDOW_KEY]?: AttaformDevtoolsBridge\n }\n}\n"],"names":[],"mappings":";;AAuCO,SAAS,oBAAoB,GAAA,EAAmC;AACrE,EAAA,MAAM,QAAA,GAAW,mBAAmB,GAAG,CAAA;AACvC,EAAA,MAAM,QAAuD,EAAC;AAC9D,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,CAAA,IAAK,SAAS,KAAA,EAAO;AAOzC,IAAA,MAAM,gBAA0B,EAAC;AACjC,IAAA,KAAA,MAAW,EAAA,IAAM,MAAM,UAAA,EAAY;AACjC,MAAA,MAAM,CAAA,GAAI,gBAAgB,EAAa,CAAA;AACvC,MAAA,IAAI,CAAA,KAAM,IAAA,EAAM,aAAA,CAAc,IAAA,CAAK,CAAC,CAAA;AAAA,IACtC;AACA,IAAA,KAAA,CAAM,IAAA,CAAK;AAAA,MACT,GAAA;AAAA,MACA;AAAA,QACE,IAAA,EAAM,MAAM,IAAA,CAAK,KAAA;AAAA,QACjB,cAAc,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,SAAS,CAAA;AAAA,QACrD,YAAY,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA;AAAA,QACjD,QAAQ,KAAA,CAAM,IAAA,CAAK,KAAA,CAAM,MAAA,CAAO,SAAS,CAAA;AAAA,QACzC,GAAI,cAAc,MAAA,GAAS,CAAA,GAAI,EAAE,UAAA,EAAY,aAAA,KAAkB;AAAC;AAClE,KACD,CAAA;AAAA,EACH;AACA,EAAA,OAAO,EAAE,KAAA,EAAM;AACjB;AAkBO,SAAS,oBAAA,CAAqB,KAAU,OAAA,EAAwC;AACrF,EAAA,MAAM,QAAA,GAAW,mBAAmB,GAAG,CAAA;AACvC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,IAAI,CAAA,IAAK,QAAQ,KAAA,EAAO;AACvC,IAAA,QAAA,CAAS,gBAAA,CAAiB,GAAA,CAAI,GAAA,EAAK,IAAI,CAAA;AAAA,EACzC;AACF;;ACjEO,MAAM,mBAAA,GAAsB;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { G as GenericForm, q as FlatPath, B as NestedType, t as FormKey, ai as UseFormConfiguration, A as AbstractSchema, j as DefaultValuesInput, al as ValidateOnConfig, aj as UseFormReturnType } from './attaform.
|
|
2
|
+
import { G as GenericForm, q as FlatPath, B as NestedType, t as FormKey, ai as UseFormConfiguration, A as AbstractSchema, j as DefaultValuesInput, al as ValidateOnConfig, aj as UseFormReturnType } from './attaform.SfhU0OEY.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The shape `form.values.<key>` returns at runtime.
|