attaform 0.30.0 → 0.30.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/abstract.d.mts +15 -21
- package/dist/abstract.mjs +2 -2
- package/dist/dev/abstract.mjs +4 -4
- package/dist/dev/chunks/devtools.mjs +2 -2
- package/dist/dev/directive.mjs +1 -1
- package/dist/dev/history.mjs +1 -1
- package/dist/dev/index.mjs +5 -5
- package/dist/dev/runtime/plugins/attaform.mjs +1 -1
- package/dist/dev/shared/{attaform-dev.BK6Ge2qR.mjs → attaform-dev.BJK1kqHY.mjs} +14 -14
- package/dist/dev/shared/{attaform-dev.D6CLvaQT.mjs → attaform-dev.BMQ3GcgD.mjs} +46 -59
- package/dist/dev/shared/{attaform-dev.BisFstxh.mjs → attaform-dev.BUIFcTYf.mjs} +6 -6
- package/dist/dev/shared/{attaform-dev.DTrHonpc.mjs → attaform-dev.CT7MDjPy.mjs} +27 -36
- package/dist/dev/shared/{attaform-dev.BcYT6tFh.mjs → attaform-dev.CZz4GYZ6.mjs} +21 -9
- package/dist/dev/shared/{attaform-dev.DUZckyV8.mjs → attaform-dev.Chm4D6SJ.mjs} +2 -2
- package/dist/dev/shared/{attaform-dev.BcNtyOmf.mjs → attaform-dev.DuEE4GU1.mjs} +4 -4
- package/dist/dev/shared/{attaform-dev.CQ2rJiAX.mjs → attaform-dev.DxHdkkPG.mjs} +126 -115
- package/dist/dev/shared/{attaform-dev.BQc5QV3Y.mjs → attaform-dev.zlvDr0WB.mjs} +2 -2
- package/dist/dev/zod-v3.mjs +6 -6
- package/dist/dev/zod-v4.mjs +6 -6
- package/dist/dev/zod.mjs +5 -5
- package/dist/directive.d.mts +4 -4
- package/dist/directive.mjs +1 -1
- package/dist/esbuild.d.mts +11 -0
- package/dist/esbuild.mjs +1 -1
- package/dist/history.d.mts +3 -32
- package/dist/history.mjs +1 -1
- package/dist/index.d.mts +67 -70
- package/dist/index.mjs +3 -3
- package/dist/nuxt.d.mts +4 -3
- package/dist/nuxt.mjs +3 -6
- package/dist/rollup.d.mts +11 -0
- package/dist/rollup.mjs +1 -1
- package/dist/rspack.d.mts +19 -11
- package/dist/rspack.mjs +1 -1
- package/dist/runtime/components/AttaformDevtoolsPanel.vue +12 -12
- package/dist/runtime/components/DevtoolsValueTree.vue +2 -2
- package/dist/shared/{attaform.Rc9u4Vfw.d.mts → attaform.2FslhB9R.d.mts} +83 -95
- package/dist/shared/{attaform.BRDDQeHV.mjs → attaform.8mfKZCwH.mjs} +2 -2
- package/dist/shared/{attaform.DRUT703x.d.mts → attaform.B-Tb62qV.d.mts} +12 -12
- package/dist/shared/{attaform.v0fQtWyA.mjs → attaform.B1rH9ht6.mjs} +1 -1
- package/dist/shared/{attaform.ByWP6kSx.mjs → attaform.B2iebkPA.mjs} +3 -3
- package/dist/shared/{attaform.DhnPb6nK.mjs → attaform.BAf3UNn4.mjs} +1 -1
- package/dist/shared/{attaform.DNJOWjQw.mjs → attaform.BIWicztt.mjs} +102 -100
- package/dist/shared/attaform.BcQwgWaq.d.mts +2153 -0
- package/dist/shared/attaform.Br8EBn5B.d.mts +4553 -0
- package/dist/shared/{attaform.BXneBxEj.mjs → attaform.CO918TdU.mjs} +13 -13
- package/dist/shared/{attaform.CUfrMK7t.mjs → attaform.DRsANMok.mjs} +5 -5
- package/dist/shared/{attaform.B3resMQ1.mjs → attaform.D_f1WgYf.mjs} +40 -53
- package/dist/shared/{attaform.CJ8DpRGj.mjs → attaform.D_pt1gOj.mjs} +26 -33
- package/dist/shared/attaform.L0kUn3vL.d.mts +42 -0
- package/dist/shared/{attaform.BK0cgu2K.mjs → attaform.ZYn2ahzJ.mjs} +3 -3
- package/dist/transforms.d.mts +153 -26
- package/dist/transforms.mjs +1 -1
- package/dist/vite.d.mts +29 -52
- package/dist/vite.mjs +3 -3
- package/dist/webpack.d.mts +20 -12
- package/dist/webpack.mjs +1 -1
- package/dist/zod-v3.d.mts +90 -96
- package/dist/zod-v3.mjs +4 -4
- package/dist/zod-v4.d.mts +118 -118
- package/dist/zod-v4.mjs +4 -4
- package/dist/zod.d.mts +5 -5
- package/dist/zod.mjs +3 -3
- package/package.json +7 -6
- package/dist/shared/attaform.Clz0ArIi.d.mts +0 -44
- package/dist/shared/attaform.UGyOK83T.d.mts +0 -2366
- package/dist/shared/attaform.bKLzMU0o.d.mts +0 -4761
package/dist/esbuild.d.mts
CHANGED
|
@@ -50,6 +50,17 @@ interface AttaformEsbuildPlugin {
|
|
|
50
50
|
name: string;
|
|
51
51
|
setup(build: EsbuildPluginBuild): void;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* esbuild plugin that resolves `attaform` and `attaform/zod` to the one
|
|
55
|
+
* adapter subpath matching the installed Zod major, so the build ships a
|
|
56
|
+
* single adapter instead of both.
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* import { attaform } from 'attaform/esbuild'
|
|
60
|
+
*
|
|
61
|
+
* await build({ entryPoints: ['src/main.ts'], bundle: true, plugins: [attaform()] })
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
53
64
|
declare function attaform(options?: AttaformEsbuildPluginOptions): AttaformEsbuildPlugin;
|
|
54
65
|
|
|
55
66
|
export { attaform };
|
package/dist/esbuild.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveZodAliasTarget, R as REWRITABLE_ZOD_SPECIFIER_FILTER } from './shared/attaform.
|
|
1
|
+
import { r as resolveZodAliasTarget, R as REWRITABLE_ZOD_SPECIFIER_FILTER } from './shared/attaform.BAf3UNn4.mjs';
|
|
2
2
|
|
|
3
3
|
function attaform(options = {}) {
|
|
4
4
|
const resolveZodAlias = options.resolveZodAlias !== false;
|
package/dist/history.d.mts
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
|
-
import { p as HistoryPlugin } from './shared/attaform.
|
|
1
|
+
import { p as HistoryPlugin } from './shared/attaform.Br8EBn5B.mjs';
|
|
2
2
|
import 'vue';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Bounded undo/redo history for a form, delivered as the `attaform/history`
|
|
6
|
-
* entry: `useForm({ history: historyPlugin({ max }) })`. The plugin object
|
|
7
|
-
* is the delivery seam — `useForm` calls its `attach(kernel)` against the
|
|
8
|
-
* form's store, so the runtime here rides the consumer's own import instead
|
|
9
|
-
* of every form's eager path.
|
|
10
|
-
*
|
|
11
|
-
* Storage is a snapshot ring buffer: `positions` holds one full
|
|
12
|
-
* `HistorySnapshot` per reachable state (oldest → newest) and `cursor`
|
|
13
|
-
* points at the current one. Every form change appends a snapshot (dropping
|
|
14
|
-
* any redo branch past the cursor); `undo()` / `redo()` move the cursor and
|
|
15
|
-
* restore that position's snapshot wholesale. When the buffer exceeds the
|
|
16
|
-
* capacity cap, the oldest position falls off the front (FIFO eviction).
|
|
17
|
-
*
|
|
18
|
-
* Each snapshot carries the form value (deep structural clone), the
|
|
19
|
-
* `blankPaths` set, and both error stores' entries — everything `undo()`
|
|
20
|
-
* needs to restore a position without consulting neighbours.
|
|
21
|
-
*
|
|
22
|
-
* `reset()` is treated as an ordinary mutation: `applyFormReplacement`
|
|
23
|
-
* fires `onFormChange`, the post-reset state lands as a new position, and
|
|
24
|
-
* the pre-reset state stays one undo away. Persistence hydration
|
|
25
|
-
* (`meta.hydration === true`) is the floor — the buffer wipes and reseeds
|
|
26
|
-
* from the post-hydration snapshot, so `undo()` can't reach back into a
|
|
27
|
-
* pre-hydration default the consumer never saw.
|
|
28
|
-
*
|
|
29
|
-
* Field record state (touched / focused / blurred / connected) is
|
|
30
|
-
* deliberately NOT snapshotted. Those flags represent UI interaction
|
|
31
|
-
* history and shouldn't rewind when the user hits undo — a field that
|
|
32
|
-
* was touched stays touched.
|
|
33
|
-
*/
|
|
4
|
+
/** Options for `historyPlugin()`, passed as `useForm({ history })`. */
|
|
34
5
|
type HistoryPluginOptions = {
|
|
35
6
|
/**
|
|
36
7
|
* Cap on total reachable positions (the current one plus everything
|
|
37
8
|
* reachable via `undo()` / `redo()`). Default `128`. When a fresh
|
|
38
9
|
* mutation would exceed it, the oldest position is dropped. `0` keeps
|
|
39
|
-
* no positions beyond the current state
|
|
10
|
+
* no positions beyond the current state, so history is effectively off,
|
|
40
11
|
* preserved as an explicit override.
|
|
41
12
|
*/
|
|
42
13
|
max?: number;
|
package/dist/history.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { shallowRef, computed } from 'vue';
|
|
2
|
-
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.
|
|
2
|
+
import { n as normalizeNumericOption, D as DEFAULT_HISTORY_MAX_SNAPSHOTS, s as structuralSnapshot } from './shared/attaform.8mfKZCwH.mjs';
|
|
3
3
|
|
|
4
4
|
function captureErrorCells(map) {
|
|
5
5
|
const out = [];
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.
|
|
2
|
-
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, aq as AcceptableDefaults, ac as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, h as FieldMetaPayload } from './shared/attaform.
|
|
1
|
+
export { a as AnyForm, b as AttaformDevtoolsBridge, c as AttaformError, d as AttaformErrorCode, e as AttaformPluginOptions, A as AttaformRegistry, C as CompiledStep, D as DEVTOOLS_WINDOW_KEY, F as FormStatus, f as FormStatusSeed, G as GateMarker, I as InjectWizardInput, g as InvalidPathError, h as InvalidUseFormConfigError, L as LazyMarker, O as OutsideSetupError, R as RegistryNotInstalledError, i as ReservedFormKeyError, S as SerializedAttaformState, j as SerializedFormData, k as StepSlot, l as SubmitErrorHandlerError, U as UseRegisterOptions, m as UseRegisterReturn, n as UseWizardReturnType, W as WizardAggregateError, o as WizardCtx, p as WizardCtxForm, q as WizardOnError, r as WizardOnSubmit, s as WizardOptions, t as WizardPersistFn, u as WizardRestoreFn, v as WizardRestoreState, w as WizardStatusesProxy, x as WizardSubmitContext, y as assignKey, z as createAttaform, B as createRegistry, E as escapeForInlineScript, H as gate, J as getRegistryFromApp, K as hydrateAttaformState, M as injectForm, N as injectWizard, P as isRegisterValue, Q as kAttaformRegistry, T as lazy, V as renderAttaformState, X as useRegister, Y as useRegistry, Z as useWizard } from './shared/attaform.BcQwgWaq.mjs';
|
|
2
|
+
import { G as GenericForm, F as FormKey, U as UseFormConfiguration, aq as AcceptableDefaults, ac as ValidateOnConfig, a as UseFormReturnType, D as DefaultValuesInput, h as FieldMetaPayload } from './shared/attaform.Br8EBn5B.mjs';
|
|
3
3
|
import { AbstractSchema } from './abstract.mjs';
|
|
4
|
-
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaDefaultsResult, a0 as SchemaParseErrorWithData, a1 as SchemaParseErrorWithoutData, a2 as SchemaParseResult, a3 as SchemaParseSuccess, a4 as Segment, a5 as SetValueCallback, a6 as SetValuePayload, a7 as SettledValidationStatus, a8 as SlimPrimitiveKind, a9 as SubmitHandler, aa as Unset, ab as ValidateOn, ad as ValidationError, ae as ValidationResponse, af as ValidationResponseWithoutValue, ag as ValueOfUnion, ah as WriteMeta, ai as WriteShape, aj as canonicalizePath, ak as isPathPrefix, al as isUnset, am as parseDottedPath, an as unset } from './shared/attaform.
|
|
5
|
-
export { v as vRegister } from './shared/attaform.
|
|
6
|
-
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.
|
|
7
|
-
export { P as PathInput, a as PathOutput } from './shared/attaform.
|
|
8
|
-
import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.
|
|
4
|
+
export { b as ArrayItem, c as ArrayPath, C as CustomDirectiveRegisterAssignerFn, d as DeepPartial, e as DefaultValuesShape, f as DisplayState, E as ErrorInput, g as ErrorsProxyShape, i as FieldState, j as FieldStateMap, k as FieldStateMapEntry, l as FlatPath, m as FormErrorRecord, n as FormErrorsSurface, o as FormMeta, H as HandleSubmit, p as HistoryPlugin, I as IsTuple, q as IsUnion, J as JoinSegments, r as Json, K as KeyofUnion, L as LiftedValueShape, M as MetaTrackerValue, N as NestedReadType, s as NestedType, O as OnError, t as OnSubmit, P as ParseOptions, u as PartialFlatPath, v as Path, w as PathKey, x as PendingValidationStatus, y as Primitive, R as ROOT_PATH, z as ROOT_PATH_KEY, B as ReactiveValidationStatus, Q as RecordPath, S as RecordValue, T as RegisterDirective, V as RegisterFlatPath, W as RegisterOptions, X as RegisterSelectModifier, Y as RegisterTextModifier, Z as RegisterTransform, _ as RegisterValue, $ as SchemaDefaultsResult, a0 as SchemaParseErrorWithData, a1 as SchemaParseErrorWithoutData, a2 as SchemaParseResult, a3 as SchemaParseSuccess, a4 as Segment, a5 as SetValueCallback, a6 as SetValuePayload, a7 as SettledValidationStatus, a8 as SlimPrimitiveKind, a9 as SubmitHandler, aa as Unset, ab as ValidateOn, ad as ValidationError, ae as ValidationResponse, af as ValidationResponseWithoutValue, ag as ValueOfUnion, ah as WriteMeta, ai as WriteShape, aj as canonicalizePath, ak as isPathPrefix, al as isUnset, am as parseDottedPath, an as unset } from './shared/attaform.Br8EBn5B.mjs';
|
|
5
|
+
export { v as vRegister } from './shared/attaform.L0kUn3vL.mjs';
|
|
6
|
+
import { S as SupportedRootSchema, b as StorageShape } from './shared/attaform.2FslhB9R.mjs';
|
|
7
|
+
export { P as PathInput, a as PathOutput } from './shared/attaform.2FslhB9R.mjs';
|
|
8
|
+
import { S as SupportedRootSchema$1, a as StorageShape$1 } from './shared/attaform.B-Tb62qV.mjs';
|
|
9
9
|
import { UnwrapZodRoot } from './zod-v3.mjs';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import 'vue';
|
|
@@ -23,7 +23,7 @@ import 'vue';
|
|
|
23
23
|
* installed. In a v3-only install `z.ZodObject` is v3's `ZodObject`
|
|
24
24
|
* (and, lacking its required type arguments, degrades to an `any`-like
|
|
25
25
|
* error type under `skipLibCheck`), so a v3 schema satisfies the v4
|
|
26
|
-
* overload's constraint and binds it
|
|
26
|
+
* overload's constraint and binds it, collapsing the read slot to
|
|
27
27
|
* `never`. A Zod v4 schema carries the `_zod` internals brand; a v3
|
|
28
28
|
* schema never does.
|
|
29
29
|
* Intersecting a v4-only constraint or conditional branch with this
|
|
@@ -38,7 +38,7 @@ import 'vue';
|
|
|
38
38
|
* `z.ZodObject<z.ZodRawShape> & ZodV4Internals`, NOT bare
|
|
39
39
|
* `z.ZodObject & ZodV4Internals`. In a v3-only install `z.ZodObject`
|
|
40
40
|
* with no type argument is `ZodObject<T, ...>` missing its required
|
|
41
|
-
* arguments
|
|
41
|
+
* arguments, an error type that behaves like `any` under
|
|
42
42
|
* `skipLibCheck`, so `any & ZodV4Internals` collapses back to `any` and
|
|
43
43
|
* the marker stops excluding v3 schemas. Supplying `z.ZodRawShape`
|
|
44
44
|
* keeps it a concrete object type in both majors, so the intersection
|
|
@@ -58,23 +58,24 @@ type ZodV4Internals = {
|
|
|
58
58
|
* `S` to one Zod major, so the projection is a direct read with no
|
|
59
59
|
* dispatch in the type body.
|
|
60
60
|
*
|
|
61
|
-
*
|
|
62
|
-
* points share one definition. Internal
|
|
63
|
-
*
|
|
64
|
-
*
|
|
61
|
+
* They live here rather than in `types-unified.ts` or `use-form.ts` so
|
|
62
|
+
* the two entry points share one definition. Internal: the overloaded
|
|
63
|
+
* `useForm` already infers fully at a call site, so consumer code never
|
|
64
|
+
* reaches for them.
|
|
65
65
|
*/
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
|
-
* The schema's own input type
|
|
69
|
-
*
|
|
70
|
-
* is the reflexive escape arm `AcceptableDefaults`
|
|
71
|
-
* `defaultValues` slot so a generic form wrapper forwarding
|
|
72
|
-
* type-checks under a free `S` (#422).
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
68
|
+
* The schema's own input type exactly as a consumer would write it,
|
|
69
|
+
* `z.input<S>`, routed through neither `GenericForm` nor
|
|
70
|
+
* `UnwrapZodRoot`. It is the reflexive escape arm `AcceptableDefaults`
|
|
71
|
+
* adds to the `defaultValues` slot, so a generic form wrapper forwarding
|
|
72
|
+
* `z.input<S>` type-checks under a free `S` (#422).
|
|
73
|
+
*
|
|
74
|
+
* It MUST stay syntactically identical to what the wrapper forwards:
|
|
75
|
+
* wrapping it in a conditional makes it a deferred conditional, which
|
|
76
|
+
* stops matching the forwarded value under a generic. A wrong-major
|
|
77
|
+
* schema cannot bind the slot anyway, being rejected at the overload's
|
|
78
|
+
* `schema` constraint, so the raw input never widens it.
|
|
78
79
|
*/
|
|
79
80
|
type V4SchemaInput<S extends SupportedRootSchema> = z.input<S>;
|
|
80
81
|
type V3SchemaInput<S extends SupportedRootSchema$1> = z.input<S>;
|
|
@@ -92,18 +93,18 @@ type V3ReadOf<S extends SupportedRootSchema$1> = StorageShape$1<UnwrapZodRoot<S>
|
|
|
92
93
|
* import { useForm } from 'attaform/zod'
|
|
93
94
|
* import { z } from 'zod'
|
|
94
95
|
*
|
|
95
|
-
* const
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
99
|
-
* }),
|
|
96
|
+
* const schema = z.object({
|
|
97
|
+
* username: z.string().min(2, 'At least 2 characters'),
|
|
98
|
+
* password: z.string().min(8, 'At least 8 characters'),
|
|
100
99
|
* })
|
|
100
|
+
*
|
|
101
|
+
* const form = useForm({ schema })
|
|
101
102
|
* ```
|
|
102
103
|
*
|
|
103
|
-
* The constraint intersects `ZodV4Internals
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
104
|
+
* The constraint intersects `ZodV4Internals`, the v4-only `_zod` brand,
|
|
105
|
+
* so a v3 schema cannot bind this overload even where `z` resolves to v3
|
|
106
|
+
* in a single-major install; it falls through to the v3 overload below.
|
|
107
|
+
* See `types-zod-major.ts`.
|
|
107
108
|
*/
|
|
108
109
|
declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
109
110
|
schema: Schema;
|
|
@@ -116,16 +117,15 @@ declare function useForm<Schema extends SupportedRootSchema & ZodV4Internals, K
|
|
|
116
117
|
* import { useForm } from 'attaform/zod'
|
|
117
118
|
* import { z } from 'zod-v3'
|
|
118
119
|
*
|
|
119
|
-
* const
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* password: z.string().min(8, 'At least 8 characters'),
|
|
123
|
-
* }),
|
|
120
|
+
* const schema = z.object({
|
|
121
|
+
* username: z.string().min(2, 'At least 2 characters'),
|
|
122
|
+
* password: z.string().min(8, 'At least 8 characters'),
|
|
124
123
|
* })
|
|
124
|
+
*
|
|
125
|
+
* const form = useForm({ schema })
|
|
125
126
|
* ```
|
|
126
127
|
*
|
|
127
|
-
*
|
|
128
|
-
* above first and never reach here.
|
|
128
|
+
* A v4 schema binds the overload above and never reaches this one.
|
|
129
129
|
*/
|
|
130
130
|
declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey = FormKey>(configuration: Omit<UseFormConfiguration<V3FormOf<Schema>, V3OutOf<Schema>, AbstractSchema<V3FormOf<Schema>, V3OutOf<Schema>>, never, K>, 'schema' | 'validateOn' | 'debounceMs' | 'defaultValues'> & {
|
|
131
131
|
schema: Schema;
|
|
@@ -141,21 +141,21 @@ declare function useForm<Schema extends SupportedRootSchema$1, K extends FormKey
|
|
|
141
141
|
* overload or the impl signature, depending on whether the type
|
|
142
142
|
* argument is a concrete schema, a generic, or a constraint).
|
|
143
143
|
*
|
|
144
|
-
* The helpers dispatch ONCE per use site
|
|
145
|
-
*
|
|
146
|
-
* to
|
|
144
|
+
* The helpers dispatch ONCE per use site through a binary conditional,
|
|
145
|
+
* so nothing stacks and nothing amplifies across the return type.
|
|
146
|
+
* Equivalent to `ReturnType<typeof useForm<S>>`, but cache-stable across
|
|
147
147
|
* call patterns.
|
|
148
148
|
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
149
|
+
* They are test- and internal-facing. Consumer code has no reason to
|
|
150
|
+
* reach for them: the overloaded `useForm` already infers fully at the
|
|
151
|
+
* call site.
|
|
152
152
|
*/
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
* Direct V4 projection
|
|
156
|
-
* Zod major is known
|
|
157
|
-
* `function setup<S extends z.ZodObject>(s: S)
|
|
158
|
-
*
|
|
155
|
+
* Direct V4 projection, with no major dispatch. Use it when the schema's
|
|
156
|
+
* Zod major is statically known, the usual case for a V4 generic helper
|
|
157
|
+
* like `function setup<S extends z.ZodObject>(s: S)`. TS simplifies it
|
|
158
|
+
* cleanly under a generic constraint because no conditional
|
|
159
159
|
* is present.
|
|
160
160
|
*/
|
|
161
161
|
type UseFormReturnV4<Schema extends z.ZodObject, K extends FormKey = FormKey> = UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K>;
|
|
@@ -166,8 +166,8 @@ type UseFormConfigV4<Schema extends z.ZodObject, K extends FormKey = FormKey> =
|
|
|
166
166
|
schema: Schema;
|
|
167
167
|
} & ValidateOnConfig;
|
|
168
168
|
/**
|
|
169
|
-
* Direct V3 projection
|
|
170
|
-
* Zod major is known
|
|
169
|
+
* Direct V3 projection, with no major dispatch. Use it when the schema's
|
|
170
|
+
* Zod major is statically known.
|
|
171
171
|
*/
|
|
172
172
|
type UseFormReturnV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKey = FormKey> = UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K>;
|
|
173
173
|
/**
|
|
@@ -184,17 +184,16 @@ type UseFormConfigV3<Schema extends z.ZodObject<z.ZodRawShape>, K extends FormKe
|
|
|
184
184
|
* discriminated-union root all resolve here exactly as the runtime
|
|
185
185
|
* `useForm` overloads accept them.
|
|
186
186
|
*
|
|
187
|
-
* Replaces `ReturnType<typeof useForm<Schema, K>>` in test code
|
|
188
|
-
* concrete schemas.
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* compatibility.
|
|
187
|
+
* Replaces `ReturnType<typeof useForm<Schema, K>>` in test code holding
|
|
188
|
+
* concrete schemas. In a generic helper, `<S extends z.ZodObject>`, reach
|
|
189
|
+
* for `UseFormReturnV4<S>` instead: TS does not simplify a conditional
|
|
190
|
+
* under a generic constraint, so this helper's dispatch stays deferred
|
|
191
|
+
* and return-type compatibility cannot be proven.
|
|
193
192
|
*/
|
|
194
193
|
type UseFormReturn<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? UseFormReturnType<V4FormOf<Schema>, V4OutOf<Schema>, V4ReadOf<Schema>, K> : Schema extends SupportedRootSchema$1 ? UseFormReturnType<V3FormOf<Schema>, V3OutOf<Schema>, V3ReadOf<Schema>, K> : never;
|
|
195
194
|
/**
|
|
196
195
|
* The configuration parameter shape of `useForm` for a given Zod
|
|
197
|
-
* schema.
|
|
196
|
+
* schema. Same dispatch as `UseFormReturn`; it replaces
|
|
198
197
|
* `Parameters<typeof useForm<Schema, K>>[0]` in test code.
|
|
199
198
|
*/
|
|
200
199
|
type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends SupportedRootSchema & ZodV4Internals ? Omit<UseFormConfiguration<V4FormOf<Schema>, V4OutOf<Schema>, AbstractSchema<V4FormOf<Schema>, V4OutOf<Schema>>, DefaultValuesInput<V4FormOf<Schema>>, K>, 'schema' | 'validateOn' | 'debounceMs'> & {
|
|
@@ -206,24 +205,23 @@ type UseFormConfig<Schema, K extends FormKey = FormKey> = Schema extends Support
|
|
|
206
205
|
/**
|
|
207
206
|
* Field-metadata write/read API for the unified `attaform/zod` entry.
|
|
208
207
|
*
|
|
209
|
-
* Storage is shared with both adapters
|
|
210
|
-
* payload written here is visible to whichever adapter the unified
|
|
211
|
-
* `useForm` dispatches to at runtime,
|
|
208
|
+
* Storage is shared with both adapters through `core/field-meta-store`,
|
|
209
|
+
* so a payload written here is visible to whichever adapter the unified
|
|
210
|
+
* `useForm` dispatches to at runtime, whatever the Zod major. No
|
|
212
211
|
* `zod` runtime import; the type-only `import type` is erased at
|
|
213
212
|
* build, so `attaform/zod` carries no `z.registry` reference even
|
|
214
213
|
* when consumed by a Zod 3 project without the Vite plugin alias.
|
|
215
214
|
*
|
|
216
|
-
* The native v4 chain `schema.register(fieldMeta, payload)`
|
|
217
|
-
*
|
|
218
|
-
*
|
|
215
|
+
* The native v4 chain `schema.register(fieldMeta, payload)` works too:
|
|
216
|
+
* Zod 4's `.register()` only calls `.add(this, payload)` structurally,
|
|
217
|
+
* which the shared store satisfies.
|
|
219
218
|
*/
|
|
220
219
|
|
|
221
220
|
type ZodFieldMetaRegistry = ReturnType<typeof z.registry<FieldMetaPayload>>;
|
|
222
221
|
/**
|
|
223
|
-
* The shared registry
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* any.
|
|
222
|
+
* The shared registry an Attaform-aware Zod schema registers field
|
|
223
|
+
* metadata against, whatever its major. The same instance the v3 and v4
|
|
224
|
+
* adapter entries expose: write in one place, read from any.
|
|
227
225
|
*
|
|
228
226
|
* Cast to Zod 4's `$ZodRegistry<FieldMetaPayload>` so the native
|
|
229
227
|
* `schema.register(fieldMeta, payload)` chain type-checks for v4
|
|
@@ -242,8 +240,7 @@ declare const fieldMeta: ZodFieldMetaRegistry;
|
|
|
242
240
|
* keys on schema reference, so cloning prevents last-write-wins
|
|
243
241
|
* collisions for sub-schemas reused at multiple paths).
|
|
244
242
|
*
|
|
245
|
-
* Works on
|
|
246
|
-
* shape of the schema:
|
|
243
|
+
* Works on a Zod 3 or a Zod 4 schema, branching on runtime shape:
|
|
247
244
|
* - Zod 4 schemas expose a public `.clone()` method; we call it.
|
|
248
245
|
* - Zod 3 schemas don't, so we reconstruct via
|
|
249
246
|
* `new schema.constructor(schema._def)`.
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { A as AttaformError, I as InvalidPathError, a as InvalidUseFormConfigError, O as OutsideSetupError, R as ROOT_PATH, b as ROOT_PATH_KEY, c as RegistryNotInstalledError, d as ReservedFormKeyError, S as SubmitErrorHandlerError, e as canonicalizePath, i as isPathPrefix, p as parseDottedPath } from './shared/attaform.CdZIEf7_.mjs';
|
|
2
|
-
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.
|
|
2
|
+
export { A as AttaformErrorCode, e as escapeForInlineScript, g as gate, i as injectForm, a as injectWizard, b as isUnset, l as lazy, u as unset, d as useRegister, f as useWizard } from './shared/attaform.BIWicztt.mjs';
|
|
3
3
|
export { D as DEVTOOLS_WINDOW_KEY, c as createAttaform, a as createRegistry, g as getRegistryFromApp, h as hydrateAttaformState, k as kAttaformRegistry, r as renderAttaformState, u as useRegistry } from './shared/attaform.WiGdIqgx.mjs';
|
|
4
|
-
export { a as assignKey, v as vRegister } from './shared/attaform.
|
|
5
|
-
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.
|
|
4
|
+
export { a as assignKey, v as vRegister } from './shared/attaform.D_f1WgYf.mjs';
|
|
5
|
+
export { f as fieldMeta, u as useForm, w as withMeta } from './shared/attaform.B2iebkPA.mjs';
|
|
6
6
|
export { i as isRegisterValue } from './shared/attaform.KvlEedlF.mjs';
|
package/dist/nuxt.d.mts
CHANGED
|
@@ -17,8 +17,9 @@ import * as _nuxt_schema from '@nuxt/schema';
|
|
|
17
17
|
interface AttaformModuleOptions {
|
|
18
18
|
/**
|
|
19
19
|
* Forwarded to `attaform/vite`'s `resolveZodAlias` option.
|
|
20
|
-
* Default `true
|
|
21
|
-
* at build time to
|
|
20
|
+
* Default `true`, so `attaform` and `attaform/zod` imports are
|
|
21
|
+
* rewritten at build time to `attaform/zod-v3` or `attaform/zod-v4`,
|
|
22
|
+
* based
|
|
22
23
|
* on the consumer's installed Zod major. Set to `false` to bypass
|
|
23
24
|
* the rewrite and ship the runtime-dispatch unified entry instead.
|
|
24
25
|
*/
|
|
@@ -46,7 +47,7 @@ type AttaformRuntimeConfig = {
|
|
|
46
47
|
/**
|
|
47
48
|
* Library version, read from the package's own `package.json` at
|
|
48
49
|
* module setup. Surfaced to the runtime plugin so the DevTools
|
|
49
|
-
* overlay panel can render a version pill
|
|
50
|
+
* overlay panel can render a version pill. One source of truth, so it
|
|
50
51
|
* matches the `meta.version` Nuxt DevTools sees in the Modules panel.
|
|
51
52
|
*/
|
|
52
53
|
version: string;
|
package/dist/nuxt.mjs
CHANGED
|
@@ -60,12 +60,9 @@ var nuxt_default = defineNuxtModule({
|
|
|
60
60
|
addCustomTab({
|
|
61
61
|
name: "attaform",
|
|
62
62
|
title: "Attaform",
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
// route family (sibling to the panel HTML). A real URL
|
|
67
|
-
// renders reliably across Nuxt DevTools versions where
|
|
68
|
-
// `data:` URIs don't.
|
|
63
|
+
// Served by the `attaform/vite` middleware, sibling to the
|
|
64
|
+
// panel HTML. A real URL renders reliably across Nuxt
|
|
65
|
+
// DevTools versions where `data:` URIs do not.
|
|
69
66
|
icon: "/_attaform_devtools/icon.svg",
|
|
70
67
|
view: {
|
|
71
68
|
type: "iframe",
|
package/dist/rollup.d.mts
CHANGED
|
@@ -29,6 +29,17 @@ interface AttaformRollupPlugin {
|
|
|
29
29
|
id: string;
|
|
30
30
|
} | null> | null;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Rollup plugin that resolves `attaform` and `attaform/zod` to the one
|
|
34
|
+
* adapter subpath matching the installed Zod major, so the build ships a
|
|
35
|
+
* single adapter instead of both.
|
|
36
|
+
*
|
|
37
|
+
* ```js
|
|
38
|
+
* import { attaform } from 'attaform/rollup'
|
|
39
|
+
*
|
|
40
|
+
* export default { plugins: [attaform()] }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
32
43
|
declare function attaform(options?: AttaformRollupPluginOptions): AttaformRollupPlugin;
|
|
33
44
|
|
|
34
45
|
export { attaform };
|
package/dist/rollup.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as resolveZodAliasTarget, i as isRewritableZodSpecifier } from './shared/attaform.
|
|
1
|
+
import { r as resolveZodAliasTarget, i as isRewritableZodSpecifier } from './shared/attaform.BAf3UNn4.mjs';
|
|
2
2
|
|
|
3
3
|
function attaform(options = {}) {
|
|
4
4
|
const resolveZodAlias = options.resolveZodAlias !== false;
|
package/dist/rspack.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './shared/attaform.C9fPTxjB.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* `attaform/rspack
|
|
4
|
+
* `attaform/rspack`, the Rspack plugin that rewrites `attaform/zod`
|
|
5
|
+
* imports
|
|
5
6
|
* to the single matching adapter subpath (`attaform/zod-v3` or
|
|
6
7
|
* `attaform/zod-v4`) at build time, based on the consumer's installed Zod
|
|
7
8
|
* major. Without it, Rspack ships both adapters because the unified
|
|
@@ -20,16 +21,12 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
|
|
|
20
21
|
* so this shares its body with `attaform/webpack` via
|
|
21
22
|
* `createWebpackFamilyPlugin`; only the diagnostic tag differs.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* that pipeline register it once per app:
|
|
30
|
-
*
|
|
31
|
-
* import { installVRegister } from 'attaform/directive'
|
|
32
|
-
* installVRegister(app)
|
|
24
|
+
* The adapter rewrite is all this plugin does. Two things
|
|
25
|
+
* `attaform/vite` also provides do NOT transfer, because both are
|
|
26
|
+
* `@vitejs/plugin-vue`-specific: wire `attaform/transforms` into your
|
|
27
|
+
* Vue compiler for the SSR-critical template transforms, and register
|
|
28
|
+
* the directive once per app with `installVRegister(app)` from
|
|
29
|
+
* `attaform/directive`.
|
|
33
30
|
*
|
|
34
31
|
* Zero-dep: the plugin imports nothing from `@rspack/core` (it taps the
|
|
35
32
|
* resolve hook the compiler injects at the consumer's build).
|
|
@@ -39,6 +36,17 @@ import { W as WebpackFamilyPlugin, a as WebpackFamilyPluginOptions } from './sha
|
|
|
39
36
|
type AttaformRspackPluginOptions = WebpackFamilyPluginOptions;
|
|
40
37
|
/** The structural shape Rspack requires of the plugin. */
|
|
41
38
|
type AttaformRspackPlugin = WebpackFamilyPlugin;
|
|
39
|
+
/**
|
|
40
|
+
* Rspack plugin that resolves `attaform/zod` to the one adapter subpath
|
|
41
|
+
* matching the installed Zod major, so the build ships a single adapter
|
|
42
|
+
* instead of both.
|
|
43
|
+
*
|
|
44
|
+
* ```js
|
|
45
|
+
* import { attaform } from 'attaform/rspack'
|
|
46
|
+
*
|
|
47
|
+
* export default { plugins: [attaform()] }
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
42
50
|
declare function attaform(options?: AttaformRspackPluginOptions): AttaformRspackPlugin;
|
|
43
51
|
|
|
44
52
|
export { attaform };
|
package/dist/rspack.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
5
5
|
// can resolve through the consumer's node_modules → `dist/index.mjs`,
|
|
6
6
|
// rather than through brittle relative paths into the rollup-bundled
|
|
7
7
|
// shared chunks (which mkdist doesn't co-locate). Type-only imports of
|
|
8
|
-
// internal types stay relative
|
|
8
|
+
// internal types stay relative: they're erased at compile time and
|
|
9
9
|
// don't need to resolve at the consumer's runtime.
|
|
10
10
|
import { type AttaformDevtoolsBridge, canonicalizePath, type Segment } from 'attaform'
|
|
11
11
|
import type { FormStore } from '../core/create-form-store'
|
|
@@ -18,7 +18,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
18
18
|
}>()
|
|
19
19
|
|
|
20
20
|
// Cross-iframe reactivity bridge. Vue's reactivity system is module-
|
|
21
|
-
// scoped
|
|
21
|
+
// scoped: the host's `@vue/reactivity` instance and the panel's are
|
|
22
22
|
// different copies of the same module, each with its own targetMap.
|
|
23
23
|
// When the panel reads `host.form.value` in a `computed`, the proxy's
|
|
24
24
|
// get trap runs in the host's tracking context (the function lives
|
|
@@ -31,7 +31,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
31
31
|
// (`onFormChange` / `onSubmitSuccess` / `onReset`), plus a 250ms
|
|
32
32
|
// polling fallback for state that changes outside those events (user
|
|
33
33
|
// errors via `setErrors`, submit-lifecycle flags). The panel's
|
|
34
|
-
// own reactivity then re-evaluates everything in one pass
|
|
34
|
+
// own reactivity then re-evaluates everything in one pass, cheap
|
|
35
35
|
// because the underlying reads are direct property accesses.
|
|
36
36
|
const updateTick = ref(0)
|
|
37
37
|
|
|
@@ -120,7 +120,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
* Render a JS value as a debug-friendly string with no masking
|
|
123
|
+
* Render a JS value as a debug-friendly string with no masking,
|
|
124
124
|
* `null` / `undefined` show as their literal names, booleans and
|
|
125
125
|
* numbers as-is, strings bare (no surrounding quotes), everything
|
|
126
126
|
* else JSON-stringified. Devtools is for inspecting state, not for
|
|
@@ -169,13 +169,13 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
169
169
|
/**
|
|
170
170
|
* Raw field data at the selected path, composed from `FormStore`
|
|
171
171
|
* primitives. The callable `form.fields(path)` proxy lives on the
|
|
172
|
-
* public `useForm` return, not on `FormStore
|
|
172
|
+
* public `useForm` return, not on `FormStore`: the bridge exposes
|
|
173
173
|
* the store, so we synthesise the same data from `fields.get(key)`
|
|
174
174
|
* + the error Maps + an inline value walk.
|
|
175
175
|
*
|
|
176
176
|
* Returns the raw `FieldRecord` (updatedAt / focused / blurred /
|
|
177
177
|
* touched / connected) rather than the wrapped `FieldState`
|
|
178
|
-
* surface. Sufficient for inspection
|
|
178
|
+
* surface. Sufficient for inspection: the full aggregated
|
|
179
179
|
* FieldState would require either lifting the surface-proxy into
|
|
180
180
|
* `FormStore` (architectural change) or rebuilding the aggregation
|
|
181
181
|
* walker in the panel (duplication).
|
|
@@ -211,7 +211,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
211
211
|
| undefined) ?? null
|
|
212
212
|
|
|
213
213
|
// Inline path walk (avoids importing path-walker through the
|
|
214
|
-
// bridge
|
|
214
|
+
// bridge: it lives in the host's shared chunk).
|
|
215
215
|
let value: unknown = form.form.value
|
|
216
216
|
for (const seg of path) {
|
|
217
217
|
if (value === null || typeof value !== 'object') {
|
|
@@ -259,7 +259,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
259
259
|
const { segments: canonicalPath } = canonicalizePath(rawPath as readonly Segment[])
|
|
260
260
|
form.setValueAtPath(canonicalPath, next)
|
|
261
261
|
// The host's setValueAtPath fires `onFormChange` listeners, which
|
|
262
|
-
// bumps our updateTick (see subscribeForm)
|
|
262
|
+
// bumps our updateTick (see subscribeForm): that refreshes the
|
|
263
263
|
// panel's view of the new value on the next microtask.
|
|
264
264
|
} catch (err) {
|
|
265
265
|
// Surface cross-iframe write failures (e.g., type-instance checks
|
|
@@ -285,7 +285,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
285
285
|
|
|
286
286
|
/**
|
|
287
287
|
* Hard cap on the in-memory event log. Sized for a debugging session,
|
|
288
|
-
* not an audit log
|
|
288
|
+
* not an audit log, older events fall off the back when capacity
|
|
289
289
|
* fills. Tunable later if real consumers ask for more.
|
|
290
290
|
*/
|
|
291
291
|
const MAX_TIMELINE_EVENTS = 200
|
|
@@ -325,7 +325,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
325
325
|
|
|
326
326
|
function subscribeForm(key: FormKey, form: FormStore<GenericForm>): void {
|
|
327
327
|
if (subscribers.has(key)) return
|
|
328
|
-
// Deep-clone the form value at the moment of fire
|
|
328
|
+
// Deep-clone the form value at the moment of fire, FormStore
|
|
329
329
|
// mutates form data in place, so a stored reference would update
|
|
330
330
|
// every existing timeline entry whenever the form changed again
|
|
331
331
|
// ("type a, delete a, both timeline events show the empty value"
|
|
@@ -336,7 +336,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
336
336
|
try {
|
|
337
337
|
return structuredClone(form.form.value)
|
|
338
338
|
} catch {
|
|
339
|
-
// Non-cloneable values (functions, Symbols, Vue refs, etc.)
|
|
339
|
+
// Non-cloneable values (functions, Symbols, Vue refs, etc.),
|
|
340
340
|
// fall back to the live reference. Worst case: that one entry
|
|
341
341
|
// still shows the current state, same as before this fix.
|
|
342
342
|
return form.form.value
|
|
@@ -379,7 +379,7 @@ import { computed, onUnmounted, ref, watch } from 'vue'
|
|
|
379
379
|
)
|
|
380
380
|
|
|
381
381
|
// Polling fallback for state that changes outside the `onFormChange` /
|
|
382
|
-
// `onSubmitSuccess` / `onReset` event surface
|
|
382
|
+
// `onSubmitSuccess` / `onReset` event surface, user errors injected
|
|
383
383
|
// via `setErrors`, submit-lifecycle flags between events, or
|
|
384
384
|
// new forms registered in the host's registry. 120ms is faster than
|
|
385
385
|
// a human can notice between an input event and a visible panel
|
|
@@ -100,7 +100,7 @@ import { computed, nextTick, ref } from 'vue'
|
|
|
100
100
|
// Array indices arrive as stringified numbers from `Object.entries` /
|
|
101
101
|
// `array.map`. Coerce back to numbers when the parent is an array
|
|
102
102
|
// so `canonicalizePath` on the consumer side gets a structured Path
|
|
103
|
-
// with the right shape
|
|
103
|
+
// with the right shape, `["users", 0, "name"]`, not
|
|
104
104
|
// `["users", "0", "name"]`.
|
|
105
105
|
if (type.value === 'array') return [...path.value, Number(rawKey)]
|
|
106
106
|
return [...path.value, rawKey]
|
|
@@ -159,7 +159,7 @@ import { computed, nextTick, ref } from 'vue'
|
|
|
159
159
|
|
|
160
160
|
// Selection (Field-state inspector hook). Canonical key uses JSON-
|
|
161
161
|
// serialised path-array form so two arrays with the same shape produce
|
|
162
|
-
// the same string
|
|
162
|
+
// the same string, direct equality check.
|
|
163
163
|
const ownKey = computed(() => JSON.stringify(path.value))
|
|
164
164
|
const isSelected = computed(
|
|
165
165
|
() =>
|