attaform 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/devtools.cjs +3 -3
- package/dist/chunks/devtools.cjs.map +1 -1
- package/dist/chunks/devtools.mjs +3 -3
- package/dist/chunks/devtools.mjs.map +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 +5 -4
- package/dist/index.cjs.map +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 +6 -6
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/runtime/plugins/attaform.cjs +1 -1
- package/dist/runtime/plugins/attaform.mjs +1 -1
- package/dist/shared/{attaform.DDXrY-1Q.d.mts → attaform.0Gxd_OOx.d.cts} +558 -174
- package/dist/shared/{attaform.DDXrY-1Q.d.ts → attaform.0Gxd_OOx.d.mts} +558 -174
- package/dist/shared/{attaform.DDXrY-1Q.d.cts → attaform.0Gxd_OOx.d.ts} +558 -174
- package/dist/shared/{attaform.xKWYHMdq.cjs → attaform.BOi138GE.cjs} +10 -2
- package/dist/shared/{attaform.xKWYHMdq.cjs.map → attaform.BOi138GE.cjs.map} +1 -1
- package/dist/shared/{attaform.CRgix6_n.cjs → attaform.BgYBU8gV.cjs} +18 -17
- package/dist/shared/attaform.BgYBU8gV.cjs.map +1 -0
- package/dist/shared/attaform.Bubm_slq.cjs.map +1 -1
- package/dist/shared/{attaform.CNJO3mME.cjs → attaform.CDJVeoJU.cjs} +633 -236
- package/dist/shared/attaform.CDJVeoJU.cjs.map +1 -0
- package/dist/shared/{attaform.CXZgUECn.d.cts → attaform.CPx7zTgS.d.mts} +39 -9
- package/dist/shared/{attaform.DlgKK10S.mjs → attaform.CRk8NhlD.mjs} +18 -17
- package/dist/shared/attaform.CRk8NhlD.mjs.map +1 -0
- package/dist/shared/attaform.CXpzmj38.mjs.map +1 -1
- package/dist/shared/{attaform.DOKOyb3Y.d.mts → attaform.D-eHWfVx.d.cts} +39 -9
- package/dist/shared/{attaform.Cc93zNzD.mjs → attaform.DXye3JKf.mjs} +10 -3
- package/dist/shared/{attaform.Cc93zNzD.mjs.map → attaform.DXye3JKf.mjs.map} +1 -1
- package/dist/shared/{attaform.B5GWYl76.cjs → attaform.RypIkgVy.cjs} +38 -7
- package/dist/shared/attaform.RypIkgVy.cjs.map +1 -0
- package/dist/shared/{attaform.al_rpt7_.mjs → attaform.a99dQV7Q.mjs} +39 -8
- package/dist/shared/attaform.a99dQV7Q.mjs.map +1 -0
- package/dist/shared/{attaform.BRTxpA3q.mjs → attaform.qxyip_aN.mjs} +634 -238
- package/dist/shared/attaform.qxyip_aN.mjs.map +1 -0
- package/dist/shared/{attaform.BYc9kugA.d.ts → attaform.riAENZQM.d.ts} +39 -9
- package/dist/transforms.d.cts +2 -2
- package/dist/transforms.d.mts +2 -2
- package/dist/transforms.d.ts +2 -2
- package/dist/zod-v3.cjs +55 -3
- package/dist/zod-v3.cjs.map +1 -1
- package/dist/zod-v3.d.cts +77 -4
- package/dist/zod-v3.d.mts +77 -4
- package/dist/zod-v3.d.ts +77 -4
- package/dist/zod-v3.mjs +56 -6
- package/dist/zod-v3.mjs.map +1 -1
- package/dist/zod.cjs +372 -5
- package/dist/zod.cjs.map +1 -1
- package/dist/zod.d.cts +120 -4
- package/dist/zod.d.mts +120 -4
- package/dist/zod.d.ts +120 -4
- package/dist/zod.mjs +371 -8
- package/dist/zod.mjs.map +1 -1
- package/package.json +3 -1
- package/dist/shared/attaform.B5GWYl76.cjs.map +0 -1
- package/dist/shared/attaform.BRTxpA3q.mjs.map +0 -1
- package/dist/shared/attaform.CNJO3mME.cjs.map +0 -1
- package/dist/shared/attaform.CRgix6_n.cjs.map +0 -1
- package/dist/shared/attaform.DlgKK10S.mjs.map +0 -1
- package/dist/shared/attaform.al_rpt7_.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GenericForm, F as FormKey, d as UseFormReturnType, R as RegisterValue } from './attaform.
|
|
2
|
-
import {
|
|
1
|
+
import { G as GenericForm, F as FormKey, d as UseFormReturnType, R as RegisterValue } from './attaform.0Gxd_OOx.mjs';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Access an existing form from a descendant component without passing
|
|
@@ -56,26 +56,42 @@ declare function injectForm<Form extends GenericForm, GetValueFormType extends G
|
|
|
56
56
|
* <!-- MyInput.vue -->
|
|
57
57
|
* <script setup lang="ts">
|
|
58
58
|
* import { useRegister } from 'attaform'
|
|
59
|
-
* const
|
|
59
|
+
* const rv = useRegister()
|
|
60
|
+
* // rv.path / rv.segments / rv.formKey / rv.formInstanceId / rv.innerRef
|
|
61
|
+
* // are all reachable directly — no `.value` unwrap.
|
|
60
62
|
* </script>
|
|
61
63
|
*
|
|
62
64
|
* <template>
|
|
63
65
|
* <label class="field">
|
|
64
66
|
* <span>Email</span>
|
|
65
|
-
* <input v-register="
|
|
67
|
+
* <input v-register="rv" />
|
|
66
68
|
* </label>
|
|
67
69
|
* </template>
|
|
68
70
|
* ```
|
|
69
71
|
*
|
|
70
|
-
* Returns a `
|
|
71
|
-
*
|
|
72
|
-
*
|
|
72
|
+
* Returns a hybrid Proxy: it answers `__v_isRef` / `.value` like a
|
|
73
|
+
* Vue `Ref<RegisterValue | undefined>` (so templates auto-unwrap
|
|
74
|
+
* correctly and `v-register="rv"` feeds the underlying RV to the
|
|
75
|
+
* directive — preserving the directive's path-migration diff across
|
|
76
|
+
* renders), AND every other property read pierces to the captured
|
|
77
|
+
* RV's field (so `rv.path` works directly in script setup). Reads
|
|
78
|
+
* inside reactive scopes (`computed` / `watchEffect`) track the
|
|
79
|
+
* underlying `shallowRef`, so `rv.path` re-runs when the parent
|
|
80
|
+
* rebinds to a different path.
|
|
81
|
+
*
|
|
82
|
+
* Unbound state: when the parent didn't pass `v-register`, every
|
|
83
|
+
* piercing read returns `undefined` at runtime even though the type
|
|
84
|
+
* says otherwise. The composable's `onMounted` warn fires once per
|
|
85
|
+
* instance to flag this misuse — the type "lies" because the bound
|
|
86
|
+
* case is the only correct one, and forcing every consumer through
|
|
87
|
+
* a `T | undefined` narrow at every property access is a worse
|
|
88
|
+
* trade than the runtime warn.
|
|
73
89
|
*
|
|
74
90
|
* Diagnostic: in dev mode, a single `console.warn` fires per instance
|
|
75
91
|
* at `onMounted` if the captured value is still `undefined` — by then
|
|
76
92
|
* the parent has had its full mount lifecycle to bind, so a missing
|
|
77
93
|
* binding is conclusive misuse. The warn does NOT fire on every read
|
|
78
|
-
* of the
|
|
94
|
+
* of the proxy, and is intentionally silent under SSR
|
|
79
95
|
* (`renderToString` skips `onMounted`); the CSR hydration pass
|
|
80
96
|
* surfaces the same diagnostic without double-counting through Nuxt's
|
|
81
97
|
* `dev:ssr-logs` channel.
|
|
@@ -86,7 +102,21 @@ declare function injectForm<Form extends GenericForm, GetValueFormType extends G
|
|
|
86
102
|
* `injectForm<Form>(key?)` and call `ctx.register(...)` directly.
|
|
87
103
|
*/
|
|
88
104
|
|
|
89
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Return type of `useRegister()`. Hybrid of `RegisterValue<V>` (so
|
|
107
|
+
* `rv.path` / `rv.segments` / `rv.formKey` etc. work directly in
|
|
108
|
+
* script setup) and `Ref<RegisterValue<V> | undefined>` (so Vue's
|
|
109
|
+
* template auto-unwrap surfaces the underlying RV to `v-register`
|
|
110
|
+
* and the directive's path-migration diff sees the real RV across
|
|
111
|
+
* renders).
|
|
112
|
+
*
|
|
113
|
+
* The two surfaces don't clash at the type level: `RegisterValue`
|
|
114
|
+
* doesn't carry a `value` field, and `Ref<T>`'s `value: T` becomes
|
|
115
|
+
* the hybrid's only `.value`. Older code that read `rv.value?.path`
|
|
116
|
+
* keeps working; new code can write `rv.path` directly.
|
|
117
|
+
*/
|
|
118
|
+
type UseRegisterReturn<V = unknown> = RegisterValue<V> & Ref<RegisterValue<V> | undefined>;
|
|
119
|
+
declare function useRegister<V = unknown>(): UseRegisterReturn<V>;
|
|
90
120
|
|
|
91
121
|
/**
|
|
92
122
|
* Stable identifiers for library-emitted `ValidationError` codes.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as getOrAssignElementId, _ as __DEV__, h as REGISTER_OWNER_MARKER, j as enforceSensitiveCheck, d as createRegistry, l as attachRegistryToApp, g as getRegistryFromApp } from './attaform.
|
|
1
|
+
import { f as getOrAssignElementId, _ as __DEV__, h as REGISTER_OWNER_MARKER, j as enforceSensitiveCheck, d as createRegistry, l as attachRegistryToApp, g as getRegistryFromApp } from './attaform.a99dQV7Q.mjs';
|
|
2
2
|
import { nextTick, warn, isRef } from 'vue';
|
|
3
3
|
|
|
4
4
|
const isArray = Array.isArray;
|
|
@@ -100,6 +100,9 @@ function removeTrackedListeners(el) {
|
|
|
100
100
|
}
|
|
101
101
|
delete carrier[listenersKey];
|
|
102
102
|
}
|
|
103
|
+
function writeLastTypedForm(rv, next) {
|
|
104
|
+
rv.lastTypedForm.value = next;
|
|
105
|
+
}
|
|
103
106
|
function computePersistMeta(el, registerValue) {
|
|
104
107
|
const elementId = getOrAssignElementId(el);
|
|
105
108
|
return { persist: registerValue.persistOptIns.hasOptIn(elementId, registerValue.path) };
|
|
@@ -283,7 +286,7 @@ const vRegisterText = {
|
|
|
283
286
|
return;
|
|
284
287
|
}
|
|
285
288
|
if (isRegisterValue(value)) {
|
|
286
|
-
value
|
|
289
|
+
writeLastTypedForm(value, null);
|
|
287
290
|
value.markBlank();
|
|
288
291
|
}
|
|
289
292
|
return;
|
|
@@ -292,7 +295,7 @@ const vRegisterText = {
|
|
|
292
295
|
domValue = looseToNumber(domValue);
|
|
293
296
|
if (typeof domValue !== "number") {
|
|
294
297
|
if (isRegisterValue(value)) {
|
|
295
|
-
value
|
|
298
|
+
writeLastTypedForm(value, null);
|
|
296
299
|
value.markBlank();
|
|
297
300
|
}
|
|
298
301
|
return;
|
|
@@ -304,7 +307,7 @@ const vRegisterText = {
|
|
|
304
307
|
}
|
|
305
308
|
return;
|
|
306
309
|
}
|
|
307
|
-
if (isRegisterValue(value)) value
|
|
310
|
+
if (isRegisterValue(value)) writeLastTypedForm(value, typedString);
|
|
308
311
|
}
|
|
309
312
|
el[assignKey]?.(domValue);
|
|
310
313
|
if (isRegisterValue(value) && isDefaultAssigner(el[assignKey])) {
|
|
@@ -312,7 +315,7 @@ const vRegisterText = {
|
|
|
312
315
|
if (storage !== domValue) {
|
|
313
316
|
const display = storage == null ? "" : String(storage);
|
|
314
317
|
if (el.value !== display) el.value = display;
|
|
315
|
-
if (castToNumber) value
|
|
318
|
+
if (castToNumber) writeLastTypedForm(value, null);
|
|
316
319
|
}
|
|
317
320
|
}
|
|
318
321
|
});
|
|
@@ -324,12 +327,12 @@ const vRegisterText = {
|
|
|
324
327
|
if (castToNumber) {
|
|
325
328
|
const cast = looseToNumber(normalized);
|
|
326
329
|
if (typeof cast === "number" && Number.isFinite(cast)) {
|
|
327
|
-
if (isRegisterValue(value)) value
|
|
330
|
+
if (isRegisterValue(value)) writeLastTypedForm(value, null);
|
|
328
331
|
el.value = String(cast);
|
|
329
332
|
if (lazy !== true) el[assignKey]?.(cast);
|
|
330
333
|
} else {
|
|
331
334
|
if (isRegisterValue(value)) {
|
|
332
|
-
value
|
|
335
|
+
writeLastTypedForm(value, null);
|
|
333
336
|
value.markBlank();
|
|
334
337
|
}
|
|
335
338
|
el.value = "";
|
|
@@ -365,16 +368,14 @@ const vRegisterText = {
|
|
|
365
368
|
// set value on mounted so it's after min/max for type="range"
|
|
366
369
|
mounted(el, { value }) {
|
|
367
370
|
if (!isRegisterValue(value)) return;
|
|
368
|
-
|
|
369
|
-
el.value = typeof _val === "string" || typeof _val === "number" ? `${_val}` : "";
|
|
371
|
+
el.value = value.displayValue.value;
|
|
370
372
|
},
|
|
371
|
-
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim
|
|
373
|
+
beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim } }, vnode) {
|
|
372
374
|
setAssignFunction(el, vnode, value);
|
|
373
375
|
if (el.composing === true) return;
|
|
374
376
|
if (!isRegisterValue(value)) return;
|
|
375
|
-
const
|
|
376
|
-
|
|
377
|
-
if (elValue === newValue) {
|
|
377
|
+
const target = value.displayValue.value;
|
|
378
|
+
if (el.value === target) {
|
|
378
379
|
return;
|
|
379
380
|
}
|
|
380
381
|
const rootNode = el.getRootNode();
|
|
@@ -383,11 +384,11 @@ const vRegisterText = {
|
|
|
383
384
|
if (lazy === true && value.innerRef.value === oldValue) {
|
|
384
385
|
return;
|
|
385
386
|
}
|
|
386
|
-
if (trim === true && el.value.trim() ===
|
|
387
|
+
if (trim === true && el.value.trim() === target) {
|
|
387
388
|
return;
|
|
388
389
|
}
|
|
389
390
|
}
|
|
390
|
-
el.value =
|
|
391
|
+
el.value = target;
|
|
391
392
|
}
|
|
392
393
|
};
|
|
393
394
|
const vRegisterCheckbox = {
|
|
@@ -746,7 +747,7 @@ function createAttaform(options = {}) {
|
|
|
746
747
|
const registry = createRegistry(options);
|
|
747
748
|
attachRegistryToApp(app, registry);
|
|
748
749
|
app.directive("register", vRegister);
|
|
749
|
-
if (options.devtools !== false && !registry.
|
|
750
|
+
if (options.devtools !== false && !registry.ssr) {
|
|
750
751
|
void (async () => {
|
|
751
752
|
try {
|
|
752
753
|
const { setupAttaformDevtools } = await import('../chunks/devtools.mjs');
|
|
@@ -786,4 +787,4 @@ function hydrateAttaformState(app, payload) {
|
|
|
786
787
|
}
|
|
787
788
|
|
|
788
789
|
export { assignKey as a, createAttaform as c, hydrateAttaformState as h, isRegisterValue as i, renderAttaformState as r, vRegister as v };
|
|
789
|
-
//# sourceMappingURL=attaform.
|
|
790
|
+
//# sourceMappingURL=attaform.CRk8NhlD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attaform.CRk8NhlD.mjs","sources":["../../src/runtime/core/vue-shared-shim.ts","../../src/runtime/core/directive.ts","../../src/runtime/core/plugin.ts","../../src/runtime/core/serialize.ts"],"sourcesContent":["/**\n * Inlined copies of the handful of utilities we use from @vue/shared.\n *\n * @vue/shared is technically an internal Vue package. Treating it as stable\n * API for a runtime-only form library is a fragility we don't need — these\n * implementations are six functions + ~40 lines, and keeping them in-tree\n * insulates us from future renames or semantic drift.\n *\n * Source (MIT © Vue.js contributors):\n * https://github.com/vuejs/core/blob/main/packages/shared/src/general.ts\n * https://github.com/vuejs/core/blob/main/packages/shared/src/looseEqual.ts\n * https://github.com/vuejs/core/blob/main/packages/shared/src/toDisplayString.ts\n *\n * Behavior preserved byte-for-byte where possible; minor cosmetic changes for\n * our stricter ESLint rules (strict-boolean-expressions, prefer-nullish-\n * coalescing). Any divergence from @vue/shared is a bug in this file.\n */\n\nexport const isArray = Array.isArray\n\nexport function isFunction(value: unknown): value is (...args: unknown[]) => unknown {\n return typeof value === 'function'\n}\n\nfunction toTypeString(value: unknown): string {\n return Object.prototype.toString.call(value)\n}\n\nexport function isSet(value: unknown): value is Set<unknown> {\n return toTypeString(value) === '[object Set]'\n}\n\nexport function isMap(value: unknown): value is Map<unknown, unknown> {\n return toTypeString(value) === '[object Map]'\n}\n\nexport function isDate(value: unknown): value is Date {\n return toTypeString(value) === '[object Date]'\n}\n\nexport function isSymbol(value: unknown): value is symbol {\n return typeof value === 'symbol'\n}\n\nexport function isObject(value: unknown): value is Record<string | symbol, unknown> {\n return value !== null && typeof value === 'object'\n}\n\nexport function looseToNumber<T>(val: T): T | number {\n const n = parseFloat(val as unknown as string)\n return isNaN(n) ? val : n\n}\n\nfunction looseCompareArrays(a: unknown[], b: unknown[]): boolean {\n if (a.length !== b.length) return false\n let equal = true\n for (let i = 0; equal && i < a.length; i++) {\n equal = looseEqual(a[i], b[i])\n }\n return equal\n}\n\nexport function looseEqual(a: unknown, b: unknown): boolean {\n if (a === b) return true\n const aValidType = isDate(a)\n const bValidType = isDate(b)\n if (aValidType || bValidType) {\n return aValidType && bValidType ? a.getTime() === b.getTime() : false\n }\n const aSymbol = isSymbol(a)\n const bSymbol = isSymbol(b)\n if (aSymbol || bSymbol) return a === b\n const aIsArray = isArray(a)\n const bIsArray = isArray(b)\n if (aIsArray || bIsArray) {\n return aIsArray && bIsArray ? looseCompareArrays(a, b) : false\n }\n // Short-circuit on object/non-object mismatch BEFORE the deep-equality\n // block. Without this, the fallthrough to `String(a) === String(b)` at\n // the bottom would coerce `{}` to `'[object Object]'` and incorrectly\n // claim `looseEqual({}, '[object Object]') === true`. @vue/shared's\n // own implementation makes the same early return.\n const aIsObject = isObject(a)\n const bIsObject = isObject(b)\n if (aIsObject !== bIsObject) return false\n if (aIsObject && bIsObject) {\n const keysA = Object.keys(a)\n if (keysA.length !== Object.keys(b).length) return false\n for (const key of keysA) {\n const hasA = Object.prototype.hasOwnProperty.call(a, key)\n const hasB = Object.prototype.hasOwnProperty.call(b, key)\n if (!hasA || !hasB || !looseEqual(a[key], b[key])) return false\n }\n return true\n }\n return String(a) === String(b)\n}\n\nexport function looseIndexOf(arr: readonly unknown[], val: unknown): number {\n return arr.findIndex((item) => looseEqual(item, val))\n}\n\nexport function invokeArrayFns(fns: ((...args: unknown[]) => unknown)[], ...args: unknown[]): void {\n for (let i = 0; i < fns.length; i++) {\n const fn = fns[i]\n if (fn) fn(...args)\n }\n}\n","/**\n * The `v-register` directive. Two-way binding with `v-model`-like\n * semantics, but writes go through the form's `RegisterValue` so\n * dirty / pristine / touched / errors stay coherent across the form.\n *\n * Bind to a native input, select, textarea, checkbox, or radio:\n *\n * ```vue\n * <input v-register=\"form.register('email')\" />\n * ```\n *\n * Installed automatically by `createAttaform()`; the export is\n * for advanced consumers who install directives manually. Works\n * identically under Nuxt, bare Vue CSR, and bare Vue +\n * `@vue/server-renderer` — Vue skips directive lifecycle hooks during\n * SSR, so the directive is a safe no-op server-side.\n */\nimport {\n invokeArrayFns,\n isArray,\n isFunction,\n isSet,\n looseEqual,\n looseIndexOf,\n looseToNumber,\n} from './vue-shared-shim'\nimport type { DirectiveBinding, DirectiveHook, ObjectDirective, VNode } from 'vue'\nimport { isRef, nextTick, warn } from 'vue'\nimport { REGISTER_OWNER_MARKER } from '../composables/use-register'\nimport { __DEV__ } from './dev'\nimport type {\n CustomDirectiveRegisterAssignerFn,\n InternalRegisterValue,\n RegisterCheckboxCustomDirective,\n RegisterModelDynamicCustomDirective,\n RegisterRadioCustomDirective,\n RegisterSelectCustomDirective,\n RegisterTextCustomDirective,\n RegisterTransform,\n RegisterValue,\n WriteMeta,\n} from '../types/types-api'\nimport type { PathKey } from './paths'\nimport { getOrAssignElementId } from './persistence/opt-in-registry'\nimport { enforceSensitiveCheck } from './persistence/sensitive-names'\n\n/**\n * Symbol slot used by custom directive integrations to install an\n * assigner on the bound element. Read by the v-register directive\n * when a DOM event fires:\n *\n * ```ts\n * import { assignKey } from 'attaform'\n * el[assignKey] = (value) => myCustomWriter(value)\n * ```\n *\n * Most consumers never need this — the built-in directives wire\n * default assigners for text inputs, checkboxes, radios, and selects.\n */\n// `Symbol.for(...)` so `el[assignKey] = ...` round-trips across\n// duplicate copies of attaform. The directive (which writes the\n// default assigner) and the consumer-side composables/utilities (which\n// may read or override it) must agree on the key, or the directive\n// stops recognising consumer-installed assigners after the page is\n// served from a Vite-optimised copy that's distinct from the one the\n// directive registration came from. Same reasoning for `listenersKey`\n// and `DEFAULT_ASSIGNER_TAG` below.\nexport const assignKey: unique symbol = Symbol.for('attaform:assign-key')\n\n/**\n * Per-element bag of listener tuples added by the active directive\n * variant in `created`. `vRegisterDynamic.beforeUnmount` drains the bag\n * so reused elements (KeepAlive, v-show) don't accumulate orphaned\n * handlers across activation cycles.\n */\nconst listenersKey: unique symbol = Symbol.for('attaform:directive-listeners')\n\ntype TrackedListener = {\n event: string\n handler: EventListener\n // Explicitly `undefined`-able so `exactOptionalPropertyTypes` lets us\n // stash tuples where the caller didn't pass options.\n options: EventListenerOptions | undefined\n}\n\ntype ListenerCarrier = { [listenersKey]?: TrackedListener[] }\n\n/**\n * Type guard for a `RegisterValue`. Returns `true` when `val` looks\n * like the object returned from `form.register(path)`.\n *\n * ```ts\n * if (isRegisterValue(slotValue)) {\n * // slotValue.innerRef is now a Ref<unknown>\n * }\n * ```\n *\n * Useful when building wrapper components that accept either a\n * `RegisterValue` or a plain ref via the same prop.\n */\nexport function isRegisterValue<Value = unknown>(val: unknown): val is RegisterValue<Value> {\n if (typeof val !== 'object' || val === null) return false\n if (!('innerRef' in val)) return false\n if (!isRef(val.innerRef)) return false\n if (!('registerElement' in val)) return false\n if (typeof val.registerElement !== 'function') return false\n if (!('setValueWithInternalPath' in val)) return false\n if (typeof val.setValueWithInternalPath !== 'function') return false\n return true\n}\n\ntype ComposingTarget = (EventTarget & { composing: boolean }) | null\nfunction addEventListener(\n el: Element,\n event: string,\n handler: EventListener,\n options?: EventListenerOptions\n): void {\n el.addEventListener(event, handler, options)\n // Stash the tuple on the element so `beforeUnmount` can detach it.\n // A bare `addEventListener` without tracking would leak across\n // KeepAlive re-activations where the DOM node is reused.\n const carrier = el as ListenerCarrier\n const bag = carrier[listenersKey] ?? []\n bag.push({ event, handler, options })\n carrier[listenersKey] = bag\n}\n\nfunction removeTrackedListeners(el: Element): void {\n const carrier = el as ListenerCarrier\n const bag = carrier[listenersKey]\n if (bag === undefined) return\n for (const { event, handler, options } of bag) {\n el.removeEventListener(event, handler, options)\n }\n delete carrier[listenersKey]\n}\n\n/**\n * Write the directive-private `lastTypedForm` ref. Lives on the\n * `InternalRegisterValue` extension of `RegisterValue` (it's not part\n * of the public type), but every RV constructed by `register-api.ts`\n * carries it — so the cast captures a runtime invariant the type\n * system can't otherwise express. Used by the numeric-text listener\n * to surface the user's typed form (`'1e2'`) to `displayValue`\n * mid-typing without yanking the caret on the next render.\n */\nfunction writeLastTypedForm(rv: RegisterValue, next: string | null): void {\n ;(rv as InternalRegisterValue).lastTypedForm.value = next\n}\n\n/**\n * Compute the WriteMeta the default assigner attaches to its\n * `setValueWithInternalPath` call. Per-element semantics: only THIS\n * element's writes carry `persist: true`, and only if THIS element opted\n * in via `register('foo', { persist: true })`. Other elements bound to\n * the same path get `persist: false` from their own assigners.\n *\n * The assigner closure captures `el` and `registerValue` directly.\n * `el` is stable across the assigner's lifetime; `registerValue` is the\n * latest one, since the assigner is recreated on every `beforeUpdate`\n * via `setAssignFunction`.\n */\nfunction computePersistMeta(el: HTMLElement, registerValue: RegisterValue): WriteMeta {\n const elementId = getOrAssignElementId(el)\n return { persist: registerValue.persistOptIns.hasOptIn(elementId, registerValue.path) }\n}\n\n/**\n * Symbol-tagged on default-installed assigners so listener bodies can\n * tell \"no consumer override\" from \"consumer-installed assigner\". The\n * bail check (`shouldBailListener`) uses this to avoid the bubbled-\n * write bug for non-supported roots: the default assigner reading\n * `el.value` off a `<div>` would clobber form state with `''` /\n * `undefined` on every keystroke from a descendant input. A consumer-\n * installed assigner (via `assignKey` or `onUpdate:registerValue`)\n * has explicitly opted into reading whatever the listener captures,\n * so the bail doesn't apply.\n */\nconst DEFAULT_ASSIGNER_TAG: unique symbol = Symbol.for('attaform:default-assigner-tag')\n\ntype DefaultAssignerCarrier = { [DEFAULT_ASSIGNER_TAG]?: boolean }\n\nfunction isDefaultAssigner(fn: unknown): boolean {\n return typeof fn === 'function' && (fn as DefaultAssignerCarrier)[DEFAULT_ASSIGNER_TAG] === true\n}\n\n/**\n * Listener-body bail. Called at the top of every event handler the\n * directive attaches. Bails when:\n * - the rendered root is a non-supported tag (where `el.value` is\n * meaningless), AND\n * - the assigner is the default (no consumer override).\n *\n * Catches two cases without needing instance-level sentinel detection:\n * 1. A `useRegister`-using child component — its rendered root is\n * usually a `<label>` / `<div>` / etc., and the inner\n * `<input v-register>` handles binding. The parent's directive's\n * listener on the rendered root would otherwise read `el.value`\n * off the wrapper and clobber the form.\n * 2. A bare `<div v-register>` with no escape hatch — same story,\n * the dev gets a deferred warn pointing at the recipe.\n *\n * Pre-installed `assignKey` AND `@update:registerValue` listener\n * shapes both bypass this bail (their assigner replaces the default,\n * stripping the tag). Post-installed `assignKey` (set via\n * `onMounted` or a ref callback) ALSO bypasses, because by the time\n * the next input event fires, the user's assigner is in place.\n */\nfunction shouldBailListener(el: HTMLElement): boolean {\n if (SUPPORTED_TAGS.has(el.tagName)) return false\n return isDefaultAssigner((el as unknown as { [k: symbol]: unknown })[assignKey])\n}\n\n/**\n * Result of running a field's `transforms: [...]` pipeline. Discriminated\n * so each assigner branch can short-circuit on failure without re-checking\n * a sentinel. `ok: false` means the write should be aborted (the helper\n * already logged via `console.error`); the caller returns `false` from\n * the assigner so the existing rejected-write contract carries through.\n */\ntype TransformResult = { ok: true; value: unknown } | { ok: false }\n\n/**\n * Apply the field's transform pipeline to a value. Each transform runs\n * inside a per-call try/catch so a buggy or defensive-throw transform\n * doesn't crash the host app. On throw the pipeline aborts (subsequent\n * transforms don't run), nothing is written to form state, and the\n * caller returns `false`. A `Promise` return is treated identically —\n * transforms must be sync; canonicalize-before-write patterns belong\n * in async field validation, not the assigner pipeline.\n *\n * `transforms` on `RegisterValue` is optional (test fixtures and\n * custom integrations can omit it); a missing array short-circuits to\n * the original value with no allocation.\n */\nfunction runTransforms(initial: unknown, registerValue: RegisterValue): TransformResult {\n const transforms = registerValue.transforms\n if (transforms === undefined || transforms.length === 0) {\n return { ok: true, value: initial }\n }\n let v = initial\n for (let i = 0; i < transforms.length; i++) {\n const fn = transforms[i] as RegisterTransform\n try {\n v = fn(v)\n } catch (err) {\n logTransformFailure(registerValue.path, i, fn, err)\n return { ok: false }\n }\n }\n if (v instanceof Promise) {\n logTransformAsync(registerValue.path)\n return { ok: false }\n }\n return { ok: true, value: v }\n}\n\n/**\n * Log a transform throw. Dev message includes path, index, transform name,\n * remediation hint, and the original error (with message + stack). Prod\n * message is a fixed string with NONE of those — transform bodies are\n * consumer code we don't control, so error messages and stack frames are\n * an information-leak surface (consumer-typed values, file paths, internal\n * function names). Set `NODE_ENV=development` to surface details.\n */\nfunction logTransformFailure(\n path: PathKey,\n index: number,\n fn: RegisterTransform,\n err: unknown\n): void {\n if (__DEV__) {\n const namePart = fn.name !== '' ? `, '${fn.name}'` : ''\n console.error(\n `[attaform] transform threw for path '${path}' (index ${index}${namePart}) — ` +\n `write aborted. Transforms must not throw; wrap your own try/catch if the throw is recoverable. ` +\n `Original error:`,\n err\n )\n } else {\n console.error(\n `[attaform] transform error — write aborted (set NODE_ENV=development for details).`\n )\n }\n}\n\n/**\n * Log a Promise-returning transform. Same dev/prod posture as\n * `logTransformFailure` — informative in dev, opaque in prod.\n */\n/**\n * Apply the field's coerce closure (built at register-time by\n * `buildCoerceFn`) to a post-transform value. Identity when the\n * RegisterValue is a hand-rolled mock that omits the field, or when\n * coercion was disabled / no coerction target was resolved at the\n * path. The closure itself runs the registry rule, post-validates\n * the result, and falls back to the original on any rule failure\n * (throw, wrong-kind, NaN) — see `schema-coerce.ts` for details.\n */\nfunction applyCoerce(value: unknown, registerValue: RegisterValue): unknown {\n return registerValue.coerce !== undefined ? registerValue.coerce(value) : value\n}\n\n/**\n * Apply the field's element-level coerce closure (built at\n * register-time by `buildElementCoerceFn`) to a scalar DOM-side\n * value that should match an array/Set member. `coerceElement` is\n * only set on container paths; for scalar paths or when coercion\n * is disabled it's `undefined` and the raw value passes through.\n * Mirrors `applyCoerce` for the path-level case.\n */\nfunction applyElementCoerce(value: unknown, registerValue: RegisterValue): unknown {\n return registerValue.coerceElement !== undefined ? registerValue.coerceElement(value) : value\n}\n\nfunction logTransformAsync(path: PathKey): void {\n if (__DEV__) {\n console.error(\n `[attaform] transform pipeline for path '${path}' returned a Promise — ` +\n `transforms must be sync. Use async field validation for canonicalize-before-write patterns. ` +\n `Write aborted.`\n )\n } else {\n console.error(\n `[attaform] transform error — write aborted (set NODE_ENV=development for details).`\n )\n }\n}\n\nconst getModelAssigner = (\n el: HTMLElement,\n vnode: VNode,\n registerValue: RegisterValue\n): CustomDirectiveRegisterAssignerFn => {\n // developer escape hatch — Vue wires `onUpdate:registerValue` as either a\n // single function or an array of functions depending on how many listeners\n // are bound. We narrow before dispatching.\n //\n // Both shapes invoke the consumer's handler as `(value, registerValue)` so\n // a top-level handler can call `rv.setValueWithInternalPath(value)` to\n // forward the write into form state without having to capture `rv` via\n // closure. Consumers wanting persistence-aware writes pass their own\n // `meta` to `setValueWithInternalPath`; the default assigner below\n // auto-attaches per-element meta.\n //\n // Vue 3.5's compiler emits TWO different prop keys for `@update:registerValue`\n // depending on context. For native elements with an uppercase letter in the\n // event name (e.g. the `V` in `registerValue`), the compiler preserves\n // casing via the `on:` prefix form: `\"on:update:registerValue\"`. For\n // components, vnode lifecycle events, or all-lowercase event names, it\n // emits `\"onUpdate:registerValue\"`. Render-function authors using `h(...)`\n // pick whichever key they like. We read both forms; for components the\n // `onUpdate:` form normally wins, for plain `<input v-register>` the\n // `on:update:` form is what survives the compiler.\n // See @vue/compiler-core/transformOn (search for `[A-Z]/.test(rawName)`).\n const fn: unknown =\n vnode.props?.['onUpdate:registerValue'] ?? vnode.props?.['on:update:registerValue']\n if (isArray(fn)) {\n const fnArr = fn.filter((x) => isFunction(x)) as ((...args: unknown[]) => unknown)[]\n return (value) => {\n // Transforms run BEFORE the override sees the value. A consumer\n // who declared `transforms: [...]` intended \"always normalize\"; a\n // silent bypass on override would be the surprise. If they want\n // raw, they don't register transforms.\n const r = runTransforms(value, registerValue)\n if (!r.ok) return false\n // Schema-driven coerce runs AFTER transforms — it's the final\n // type-fixup before storage. Custom override handlers receive\n // the coerced value, mirroring how transforms compose with\n // overrides today. Consumers who want raw don't enable coerce.\n const coerced = applyCoerce(r.value, registerValue)\n invokeArrayFns(fnArr, coerced, registerValue)\n // Multi-listener case: no single boolean to surface. Return\n // undefined so the listener treats this as \"succeeded\" — matches\n // the back-compat contract for consumer-installed assigners.\n return undefined\n }\n }\n if (isFunction(fn)) {\n const handler = fn as CustomDirectiveRegisterAssignerFn\n return (value) => {\n const r = runTransforms(value, registerValue)\n if (!r.ok) return false\n const coerced = applyCoerce(r.value, registerValue)\n return handler(coerced, registerValue)\n }\n }\n // Default-installed assigner. Tagged so the listener-body bail\n // (`shouldBailListener`) can distinguish it from consumer overrides\n // and prevent the bubbled-write bug on non-supported roots.\n //\n // Returns the underlying setValue boolean so listeners (e.g.\n // vRegisterSelect's change handler) can detect rejection and gate\n // post-write side effects like the `_assigning` flag.\n const defaultAssigner: CustomDirectiveRegisterAssignerFn = (value) => {\n const r = runTransforms(value, registerValue)\n if (!r.ok) return false\n const coerced = applyCoerce(r.value, registerValue)\n return registerValue.setValueWithInternalPath(coerced, computePersistMeta(el, registerValue))\n }\n ;(defaultAssigner as unknown as DefaultAssignerCarrier)[DEFAULT_ASSIGNER_TAG] = true\n return defaultAssigner\n}\n\n/**\n * Idempotent reconciliation of a single element's opt-in across the\n * directive lifecycle. Called from `created` (oldValue undefined),\n * `beforeUpdate` (oldValue the previous RegisterValue), and as a\n * convenience from `beforeUnmount` (value undefined).\n *\n * Handles every transition: persist flag flipping in either direction,\n * `register()` path changing (e.g. dynamic v-for index), and the\n * cross-form / cross-SFC case where `register()` returns a value bound\n * to a different FormStore (different `persistOptIns` instance).\n */\nfunction syncPersistOptIn(el: HTMLElement, value: unknown, oldValue: unknown): void {\n const wasOptedIn = isRegisterValue(oldValue) && oldValue.persist === true\n const wantsOptIn = isRegisterValue(value) && value.persist === true\n if (!wasOptedIn && !wantsOptIn) return\n const elementId = getOrAssignElementId(el)\n // Detach the old opt-in unless every dimension matches (persist still\n // requested, same canonical path, same registry instance).\n if (wasOptedIn) {\n const old = oldValue as RegisterValue\n const samePathAndRegistry =\n wantsOptIn &&\n (value as RegisterValue).path === old.path &&\n (value as RegisterValue).persistOptIns === old.persistOptIns\n if (!samePathAndRegistry) {\n old.persistOptIns.remove(elementId, old.path)\n }\n }\n // Attach the new opt-in. `add` is idempotent, so if oldValue already\n // had the same (path, registry) we just re-touch the same entry.\n // The sensitive-name check fires here (not on every keystroke) — it's\n // the act of OPTING IN that crosses the compliance threshold.\n if (wantsOptIn) {\n const v = value as RegisterValue\n enforceSensitiveCheck(v.path, v.acknowledgeSensitive)\n v.persistOptIns.add(elementId, v.path)\n }\n}\n\n/**\n * Migrate the element's registration entry across binding-value\n * transitions. Symmetric with `syncPersistOptIn` for the\n * persistence opt-in dimension; this one tracks element-to-path\n * registration the form's element map relies on for\n * `getFieldState(path).meta.connected`, `focusFirstError`, and\n * `scrollToFirstError`.\n *\n * Cases:\n * - undefined → undefined: nothing to do.\n * - undefined → RV: register the new RV's element (the per-tag\n * `created` hook skipped this when the binding mounted with an\n * undefined value, so we have to catch up here).\n * - RV → undefined: deregister the old RV's element.\n * - RV → RV (same path + same form): no-op. `register('foo')`\n * returns a fresh closure on every parent re-render; without\n * the early-out, every tick would deregister-and-re-register\n * the element, thrashing the `connected` flag.\n * - RV → RV (different path or different form): deregister old,\n * register new. Covers dynamic-path templates\n * (`v-register=\"form.register(\\`item.${i}\\`)\"`) and the\n * cross-form case where a wrapper component switches the\n * `registerValue` it forwards.\n */\nfunction syncElementRegistration(el: HTMLElement, value: unknown, oldValue: unknown): void {\n const wasRegistered = isRegisterValue(oldValue)\n const isRegistered = isRegisterValue(value)\n if (!wasRegistered && !isRegistered) return\n\n if (wasRegistered && isRegistered) {\n const old = oldValue\n const next = value\n if (old.path === next.path && old.persistOptIns === next.persistOptIns) return\n }\n\n if (wasRegistered) {\n oldValue.deregisterElement(el)\n }\n if (isRegistered) {\n value.registerElement(el)\n }\n}\n\nfunction onCompositionStart(e: Event) {\n const target = e.target as ComposingTarget\n if (!target) return\n\n target.composing = true\n}\n\nfunction onCompositionEnd(e: Event) {\n const target = e.target as ComposingTarget\n if (target?.composing === true) {\n target.composing = false\n target.dispatchEvent(new Event('input'))\n }\n}\n\nfunction makeNoopAssigner(): CustomDirectiveRegisterAssignerFn {\n const noop: CustomDirectiveRegisterAssignerFn = (_) => undefined\n // Tag so `shouldBailListener` recognizes this as the default,\n // alongside the real default-model assigner.\n ;(noop as unknown as DefaultAssignerCarrier)[DEFAULT_ASSIGNER_TAG] = true\n return noop\n}\n\nfunction setAssignFunction(\n el: HTMLElement & { [AssignKey: symbol]: CustomDirectiveRegisterAssignerFn },\n vnode: VNode,\n value: RegisterValue<unknown> | undefined\n) {\n // Pre-install respect: if the consumer installed `el[assignKey]`\n // BEFORE this directive's `created` hook ran (e.g. via a companion\n // directive ordered first in `withDirectives`, or by a custom\n // element's constructor), preserve their assigner across the\n // entire directive lifecycle. The default assigner is a fallback\n // for the common case where nobody overrides; it should NEVER\n // clobber an explicit consumer override.\n if (el[assignKey] !== undefined && !isDefaultAssigner(el[assignKey])) {\n return\n }\n\n // Invariant 4: `v-register=\"undefined\"` is a graceful no-op. The\n // composable `useRegister()` returns `ComputedRef<undefined>` when\n // a child is rendered standalone (no parent passed registerValue);\n // the inner `<input v-register=\"register\">` lands undefined here\n // and we silently install a no-op assigner. The composable already\n // emitted its own dev-warn at the call site, so a second warn from\n // the directive would be redundant noise.\n //\n // Other non-RegisterValue types still fall through to the warn —\n // those are likely typos (passing a string, an object literal, the\n // form API itself, etc.) and the developer benefits from a hint.\n if (value === undefined) {\n el[assignKey] = makeNoopAssigner()\n return\n }\n if (!isRegisterValue(value)) {\n warn(\n `v-register expected a RegisterValue, got '${typeof value}'. ` +\n `Bind to form.register('field') — not the field's ref, value, or path string.`\n )\n el[assignKey] = makeNoopAssigner()\n return\n }\n\n el[assignKey] = getModelAssigner(el, vnode, value)\n}\n\n// We are exporting the v-model runtime directly as vnode hooks so that it can\n// be tree-shaken in case v-model is never used.\nconst vRegisterText: RegisterTextCustomDirective = {\n created(el, { value, modifiers: { lazy, trim, number } }, vnode) {\n const castToNumber = number === true || vnode.props?.['type'] === 'number'\n if (isRegisterValue(value)) {\n value.registerElement(el)\n setAssignFunction(el, vnode, value)\n }\n addEventListener(el, lazy === true ? 'change' : 'input', (e) => {\n // Bail if this listener was attached on a non-supported root\n // (a `<label>` / `<div>` etc.) AND the assigner is the default.\n // The bubbled-write bug fires here without this guard: a\n // descendant's `input` event reaches this handler, reads\n // `el.value` off the wrapper (`''` in jsdom, `undefined` in\n // browsers), and clobbers the form. See `shouldBailListener`.\n if (shouldBailListener(el)) return\n const target = e.target as ComposingTarget\n if (target === null || target.composing) return\n let domValue: string | number = el.value\n // Deferred-to-blur trim: only trim here when this listener is\n // already on `change` (i.e. `.lazy.trim`). Per-keystroke trim\n // on the `input` event fights Vue's `:value` patch — when the\n // user types a trailing space the trimmed write reaches the\n // model first, Vue's patch then sees `el.value` ahead of the\n // model and rewrites the DOM back to the trimmed form,\n // swallowing the space the user is still typing. The `change`-\n // bound normalization listener below catches the canonical\n // trimmed write at blur instead.\n if (trim === true && lazy === true) {\n domValue = domValue.trim()\n }\n if (castToNumber) {\n // Empty after the (deferred) trim — most commonly a backspace-\n // clear on `<input type=\"number\">` or a `.number` text input.\n // Mark the path blank rather than skipping silently:\n // storage gets the slim default (0), the UI shows blank via\n // `displayValue.value === ''`, and submit-time validation\n // raises \"No value supplied\" if the schema demands a number (the\n // public-housing footgun fix). Without this, the directive's\n // pre-fix skip-on-empty silently desynced storage from UI.\n //\n // `<input type=\"number\">` quirk: the browser blanks `el.value`\n // mid-typing for malformed input (`1e` is incomplete scientific\n // notation, so the browser hides the typed text from\n // `el.value` even though it's still visually in the DOM).\n // `validity.badInput` is `true` in that case and `false` for\n // a genuine empty field — we use it to distinguish a real\n // user-clear (mark) from a transient mid-edit (skip). Without\n // this guard, typing `1e` into a `type=\"number\"` field fires\n // `markBlank`, `displayValue` recomputes to `''`,\n // Vue patches the DOM and yanks the user's `1e` away.\n if (domValue === '') {\n // Guard against non-input elements with custom assigners\n // (the directive bails on default-assigner non-inputs via\n // `shouldBailListener`, but a consumer-installed assigner\n // can land on any tag — `validity` only exists on form\n // controls). The cast types `validity` as optional to\n // capture that shape.\n const validity = (el as { validity?: ValidityState }).validity\n if (validity?.badInput === true) {\n return\n }\n if (isRegisterValue(value)) {\n writeLastTypedForm(value, null)\n value.markBlank()\n }\n return\n }\n const typedString = domValue\n domValue = looseToNumber(domValue)\n if (typeof domValue !== 'number') {\n // Non-castable garbage like \"abc\" — text input with `.number`,\n // not protected by the beforeinput filter (e.g. consumer\n // pasted via JS or programmatic `el.value = 'abc'`). Treat\n // as the empty case so the gate's slim-primitive rejection\n // doesn't surface a dev warning for a transient mid-edit\n // state.\n if (isRegisterValue(value)) {\n writeLastTypedForm(value, null)\n value.markBlank()\n }\n return\n }\n if (!Number.isFinite(domValue)) {\n // Overflow: parseFloat returned Infinity / -Infinity for\n // values past Number.MAX_VALUE (e.g. `1e309`). Don't commit\n // — Zod's z.number() rejects non-finite, and\n // JSON.stringify() renders Infinity as `null`, both confusing\n // for devs and downstream consumers. Snap the DOM back to\n // the last good displayValue so the user gets immediate\n // visual feedback that their input was rejected (analogous\n // to a native `<input type=\"number\" max>` cap). Storage\n // stays at whatever the last finite write committed.\n if (isRegisterValue(value)) {\n const target = value.displayValue.value\n if (el.value !== target) el.value = target\n }\n return\n }\n // Castable: record the user's typed string so `displayValue`\n // surfaces it mid-typing. Storage commits real-time via the\n // assigner below; without `lastTypedForm`, Vue's `:value`\n // patch would write `String(cast)` (e.g. `'100'`) into the\n // DOM and yank the user away from the `1e2` they're typing.\n // The blur normalizer clears `lastTypedForm` so the post-blur\n // DOM matches storage exactly.\n if (isRegisterValue(value)) writeLastTypedForm(value, typedString)\n }\n el[assignKey]?.(domValue)\n // After the default assigner runs, force-sync the DOM when\n // storage diverges from the post-cast/post-trim `domValue`.\n // Two cases produce no Vue re-render and so leave the\n // imperative `beforeUpdate` DOM-from-storage sync stranded:\n // 1. A `transforms` pipeline mutated the write to a value\n // identical to current storage (a clamp at the cap, an\n // idempotent normalize, a coerce that re-emits the prior\n // stored shape) — `setValueWithInternalPath` produces no\n // patch, no reactive trigger, no render.\n // 2. The slim-primitive gate (or a transform-throw) silently\n // rejected the write — storage stays at the prior value,\n // again no render.\n // Either way the DOM keeps the user's raw typed text divorced\n // from storage. Comparing post-cast `domValue` (not the raw\n // typed string) preserves the typed-form contract: typing\n // `1e2` against a number schema casts to 100, storage updates\n // to 100, post-cast `domValue === storage`, no force-sync —\n // the user keeps seeing `1e2` mid-typing.\n //\n // Gated on `isDefaultAssigner` because custom assigners\n // (`@update:registerValue`, pre-installed `el[assignKey]`)\n // own their own DOM/storage relationship — they may write to\n // a different store, defer / batch / debounce, or intentionally\n // not update `innerRef.value`. The default assigner's contract\n // (\"a successful write reflects in `innerRef.value` immediately\")\n // is what makes the post-write storage comparison meaningful.\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey])) {\n const storage = value.innerRef.value\n if (storage !== domValue) {\n const display = storage == null ? '' : String(storage)\n if (el.value !== display) el.value = display\n if (castToNumber) writeLastTypedForm(value, null)\n }\n }\n })\n if (trim === true || castToNumber) {\n addEventListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n // Mirror Vue's `castValue(el.value, trim, castToNumber)` so the\n // visible DOM normalizes after blur for both modifiers — without\n // the cast branch, a user typing ` 12 ` into a `.number` input\n // sees ` 12 ` stick after blur instead of `12`.\n let normalized: string | number = el.value\n if (trim === true) normalized = normalized.trim()\n if (castToNumber) {\n const cast = looseToNumber(normalized)\n if (typeof cast === 'number' && Number.isFinite(cast)) {\n // Blur: clear the typed-form override so `displayValue`\n // returns `String(storage)`. The DOM then patches to the\n // canonical form (`'1e2'` → `'100'`, `'01'` → `'1'`,\n // `'1.'` → `'1'`). Honest by design — what the user sees\n // after blur matches what's in storage. The model commit\n // is gated on `lazy !== true` because the lazy listener\n // already wrote on the same change event ahead of this\n // handler.\n if (isRegisterValue(value)) writeLastTypedForm(value, null)\n el.value = String(cast)\n if (lazy !== true) el[assignKey]?.(cast)\n } else {\n // Uncastable mid-edit residue (lone '.', '-', 'abc') OR\n // overflow (`1e309` parses to Infinity). Native\n // `<input type=\"number\">` blur behaviour clears in both\n // cases; we match that. The keystroke listener has\n // already markBlank'd uncastable input under\n // non-lazy, but under `.lazy.number` (or for an overflow\n // pasted directly via the change event) this is the first\n // chance, so re-mark defensively.\n if (isRegisterValue(value)) {\n writeLastTypedForm(value, null)\n value.markBlank()\n }\n el.value = ''\n }\n return\n }\n el.value = typeof normalized === 'number' ? String(normalized) : normalized\n // Catch up the model on blur for non-lazy `.trim`. The input\n // listener wrote the raw mid-typing value (deferred trim);\n // here on `change` we commit the canonical trimmed form so\n // the DOM and the model agree once the user leaves the\n // field. Under `.lazy.trim`, the input listener (on\n // `change`) already wrote the trimmed value, so this branch\n // skips to avoid a redundant duplicate write.\n if (trim === true && lazy !== true) {\n el[assignKey]?.(normalized)\n }\n })\n }\n if (lazy !== true) {\n addEventListener(el, 'compositionstart', onCompositionStart)\n addEventListener(el, 'compositionend', onCompositionEnd)\n // Safari < 10.2 & UIWebView doesn't fire compositionend when\n // switching focus before confirming composition choice\n // this also fixes the issue where some browsers e.g. iOS Chrome\n // fires \"change\" instead of \"input\" on autocomplete.\n addEventListener(el, 'change', onCompositionEnd)\n }\n // `.number` × text input — block non-numeric characters at the\n // DOM layer so `el.value` never holds garbage. Native\n // `<input type=\"number\">` already filters at the browser layer,\n // so we skip the listener there to avoid double-filtering. The\n // regex allows an optional leading `-`, a single `.`, any number\n // of digits, and an optional scientific-notation suffix\n // (`[eE][+-]?\\d*`) so devs get parity with native `type=\"number\"`\n // for inputs like `1e3`. Partial states (just `-`, `1.`, `1e`,\n // `1e-`) are accepted as the user is still typing; the blur\n // normalizer commits the cast value (or clears the DOM if the\n // residue is non-castable). Composition events\n // (`insertCompositionText`) aren't blocked — IME input proceeds\n // normally and the directive's `compositionend` handler catches\n // the final value.\n if (number === true && vnode.props?.['type'] !== 'number') {\n addEventListener(el, 'beforeinput', (e) => {\n const ev = e as InputEvent\n if (\n ev.inputType !== 'insertText' &&\n ev.inputType !== 'insertFromPaste' &&\n ev.inputType !== 'insertFromDrop'\n ) {\n return\n }\n const data = ev.data\n if (data === null) return\n const start = el.selectionStart ?? 0\n const end = el.selectionEnd ?? 0\n const next = el.value.slice(0, start) + data + el.value.slice(end)\n if (!/^-?\\d*\\.?\\d*([eE][+-]?\\d*)?$/.test(next)) ev.preventDefault()\n })\n }\n },\n // set value on mounted so it's after min/max for type=\"range\"\n mounted(el, { value }) {\n if (!isRegisterValue(value)) return\n\n // Read through `displayValue` rather than `innerRef`: it's the\n // string projection that already honours `blankPaths` (returns\n // `''` for a numeric leaf marked blank, even though storage\n // holds the slim default `0`). Without this, the storage `0`\n // round-trips to `'0'` here and the change handler at blur\n // sees `el.value === '0'`, casts to 0, and writes-back through\n // the assigner — wiping the blank flag and locking the user\n // out of the empty display state.\n el.value = value.displayValue.value\n },\n beforeUpdate(el, { value, oldValue, modifiers: { lazy, trim } }, vnode) {\n setAssignFunction(el, vnode, value)\n // Skip the el.value sync while the user is mid-IME-composition;\n // overwriting `el.value` would clobber the unresolved input.\n if ((el as { composing?: boolean }).composing === true) return\n if (!isRegisterValue(value)) return\n\n // `displayValue` is the canonical string view: it folds in the\n // blank/unset rule (returns `''` for blank-marked numeric\n // leaves) AND the typed-form preference (`lastTypedForm` so\n // mid-typing `'1e2'` doesn't get clobbered by a sibling\n // re-render). String comparison against the live DOM is honest:\n // pre-fix this branch parsed `el.value` through `looseToNumber`\n // and compared against raw storage, which paints `'0'` over a\n // blank-empty DOM on every reactive update.\n const target = value.displayValue.value\n if (el.value === target) {\n return\n }\n\n // ShadowRoot-aware activeElement check: a v-register'd input mounted\n // inside a shadow tree's `activeElement` lives on the rootNode, not\n // on `document`. Falling back to `document.activeElement === el` for\n // shadow-mounted inputs would always be `false`, defeating the\n // lazy/trim escape-hatches below.\n const rootNode = el.getRootNode()\n const activeElement =\n rootNode instanceof Document || rootNode instanceof ShadowRoot ? rootNode.activeElement : null\n if (activeElement === el && el.type !== 'range') {\n // Lazy escape: the consumer chose `change`-only updates. While\n // the user is still editing, suppress reverse-syncs that would\n // otherwise revert their typing on every parent re-render.\n if (lazy === true && value.innerRef.value === oldValue) {\n return\n }\n // Trim escape: same rationale — the trimmed-but-otherwise-equal\n // value is what we'd land on at blur anyway, so don't fight the\n // user's whitespace mid-typing.\n if (trim === true && el.value.trim() === target) {\n return\n }\n }\n\n el.value = target\n },\n}\n\nconst vRegisterCheckbox: RegisterCheckboxCustomDirective = {\n // #4096 array checkboxes need to be deep traversed\n deep: true,\n created(el, { value }, vnode) {\n if (!isRegisterValue(value)) return\n\n value.registerElement(el)\n setAssignFunction(el, vnode, value)\n addEventListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n const modelValue = value.innerRef.value ?? []\n\n // this side-steps subtle 2-way binding bugs where ref updates but input cannot be tracked by value\n const explicitValueRequired = true\n const rawElementValue = getValue(el, explicitValueRequired)\n\n const checked = el.checked\n const assign = el[assignKey]\n if (isArray(modelValue)) {\n if (rawElementValue === undefined) {\n warn(\n 'Checkbox bound to an array model is missing a `value` attribute — ' +\n 'cannot determine which item to add or remove. ' +\n 'Add value=\"...\" to each <input type=\"checkbox\">.'\n )\n return\n }\n // Element-level coerce on the raw DOM value so the\n // looseIndexOf lookup and the new array's element shape\n // match the post-coerce model. Without this, the change\n // handler builds a mixed-type array (e.g. boolean members\n // plus a raw string) and either fails to find the existing\n // entry on uncheck (case-sensitive looseEqual on booleans)\n // or appends a string to a typed-element array. The path-\n // level coerce in the assigner cleans up the new array\n // afterwards either way.\n const elementValue = applyElementCoerce(rawElementValue, value)\n const index = looseIndexOf(modelValue, elementValue)\n const found = index !== -1\n if (checked && !found) {\n assign?.(modelValue.concat(elementValue))\n } else if (!checked && found) {\n const filtered = [...modelValue]\n filtered.splice(index, 1)\n assign?.(filtered)\n }\n } else if (isSet(modelValue)) {\n if (rawElementValue === undefined) {\n warn(\n 'Checkbox bound to a Set model is missing a `value` attribute — ' +\n 'cannot determine which item to add or remove. ' +\n 'Add value=\"...\" to each <input type=\"checkbox\">.'\n )\n return\n }\n // Set's `.delete` uses strict ===, so coerce the element\n // BEFORE the Set ops or removals silently fail when the\n // model holds post-coerce booleans/numbers and the DOM\n // gives back the raw string.\n const elementValue = applyElementCoerce(rawElementValue, value)\n const cloned = new Set(modelValue)\n if (checked) {\n cloned.add(elementValue)\n } else {\n cloned.delete(elementValue)\n }\n assign?.(cloned)\n } else {\n assign?.(getCheckboxValue(el, checked))\n }\n // After the default assigner runs, force-sync `el.checked` to\n // current storage. Catches the no-op-write case: a transform\n // mapped the click's value to current storage (e.g. an always-\n // false transform on an already-false checkbox) — no patch, no\n // render, no `beforeUpdate` setChecked. Without this the DOM\n // stays at the user's click state, divorced from storage.\n // Skipped for custom assigners (they own DOM/storage sync).\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey])) {\n setChecked(el, value)\n el._lastAppliedModel = value.innerRef.value\n }\n })\n },\n // set initial checked on mount to wait for true-value/false-value\n mounted(el, { value }) {\n setChecked(el, value)\n if (isRegisterValue(value)) el._lastAppliedModel = value.innerRef.value\n },\n // Skip the DOM sync when the model is identity-unchanged from the\n // last application. Pre-fix the scalar branch in `setChecked`\n // gated on `originalValue === oldValue`, comparing a primitive\n // scalar against the wrapper RegisterValue object — always !==,\n // so the guard was a silent no-op. Array / Set branches lacked\n // any guard. The per-render re-apply mirrors the just-fixed\n // `vRegisterSelect` shape: a sibling's reactive write triggers\n // `beforeUpdate` mid-click, `setChecked` re-applies the prior\n // model state, and the in-flight user toggle is clobbered before\n // the browser fires `change`. Identity comparison on\n // `innerRef.value` is sound for the same reason as multi-select —\n // every form write produces a fresh value at the path (new\n // primitives; new array/Set references along the spine), so\n // reference equality tracks \"did the model move\" exactly.\n beforeUpdate(el, binding, vnode) {\n setAssignFunction(el, vnode, binding.value)\n if (!isRegisterValue(binding.value)) return\n const currentModel = binding.value.innerRef.value\n if (el._lastAppliedModel === currentModel) return\n setChecked(el, binding.value)\n el._lastAppliedModel = currentModel\n },\n}\n\nfunction setChecked(el: HTMLInputElement, value: unknown): void {\n if (!isRegisterValue(value)) return\n\n const originalValue = value.innerRef.value\n let checked: boolean\n\n // Read the option-value via `getValue(el)` rather than\n // `vnode.props?.['value']`. On SSR + hydration, Vue skips\n // `patchProp` for hoisted static `value=\"...\"` attributes — vnode\n // props don't carry the value AND `el._value` is never set, so the\n // old code returned undefined and unchecked the box even when the\n // DOM `value` attribute matched the model. `getValue` (post the\n // static-attr fix) checks `_value` first, then the DOM property,\n // so all three paths (Vue dynamic, Vue hydrated static, manual\n // setAttribute) resolve identically.\n // All three branches compare the post-coerce model against the\n // RAW DOM-side value (the option's `value` attribute, or the\n // checkbox's `_trueValue`). Coerce normalizes the WRITE direction\n // (e.g. `\"True\"` → `true` for `z.boolean()`); without symmetric\n // normalization on the READ direction, `looseEqual` /\n // `looseIndexOf` / `Set.has` fight the user's click on every\n // re-render. Route the raw value through the same `applyCoerce`\n // closure to restore parity. See setChecked-mid-coerce regression\n // tests in coerce.test.ts.\n if (isArray(originalValue)) {\n // Element-level coerce: the DOM-side raw value is a SCALAR\n // matching against the array's element type, not the path's\n // top-level type (which would be `array`, with no scalar\n // coerce target).\n checked = looseIndexOf(originalValue, applyElementCoerce(getValue(el), value)) > -1\n } else if (isSet(originalValue)) {\n // Set.has uses SameValueZero (===), not loose comparison —\n // mismatch is fatal here, not just for case-sensitive booleans.\n checked = originalValue.has(applyElementCoerce(getValue(el), value))\n } else {\n const trueValueCoerced = applyCoerce(getCheckboxValue(el, true), value)\n checked = looseEqual(originalValue, trueValueCoerced)\n }\n\n if (el.checked !== checked) {\n el.checked = checked\n }\n}\n\nconst vRegisterRadio: RegisterRadioCustomDirective = {\n created(el, { value }, vnode) {\n if (!isRegisterValue(value)) return\n\n value.registerElement(el)\n setAssignFunction(el, vnode, value)\n addEventListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n el[assignKey]?.(getValue(el))\n // After the default assigner runs, force-sync `el.checked` to\n // current storage. Catches the no-op-write case where a\n // transform maps the click's value to current storage — no\n // patch, no render, no `beforeUpdate` sync. Skipped for custom\n // assigners (they own DOM/storage sync).\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey])) {\n const currentModel = value.innerRef.value\n const target = looseEqual(currentModel, applyCoerce(getValue(el), value))\n if (el.checked !== target) el.checked = target\n el._lastAppliedModel = currentModel\n }\n })\n },\n // Initial checked-state sync runs in `mounted`, NOT `created` —\n // Vue's directive lifecycle fires `created` BEFORE the element's\n // attributes are patched (`type`, `value`, `_value` etc. aren't on\n // the element yet), so `getValue(el)` would return `undefined` and\n // every radio in a group would mount unchecked regardless of the\n // model. Checkbox already uses `mounted: setChecked` for the same\n // reason.\n mounted(el, { value }) {\n if (!isRegisterValue(value)) return\n // Read the option-value via `getValue(el)` rather than\n // `vnode.props?.['value']` so SSR-hydrated static `value=\"...\"`\n // attributes (which don't surface in vnode.props because Vue's\n // static-attr fast path skips patchProp) still resolve correctly.\n // Coerce the raw value the same way the change handler will so\n // the comparison stays symmetric — see setChecked's note.\n el.checked = looseEqual(value.innerRef.value, applyCoerce(getValue(el), value))\n el._lastAppliedModel = value.innerRef.value\n },\n // Skip the DOM sync when the model is identity-unchanged from the\n // last application. Pre-fix the guard read `value.innerRef.value\n // !== oldValue`, comparing a primitive scalar against the previous\n // binding's wrapper RegisterValue object — always !==, so the\n // guard was a silent no-op and `el.checked = …` re-applied on\n // every parent re-render. Same shape as the just-fixed\n // `vRegisterSelect` and `setChecked` bugs: a sibling's reactive\n // write triggers `beforeUpdate` mid-click and writes back the\n // prior model state, clobbering the in-flight selection.\n beforeUpdate(el, { value }, vnode) {\n if (!isRegisterValue(value)) return\n\n setAssignFunction(el, vnode, value)\n const currentModel = value.innerRef.value\n if (el._lastAppliedModel === currentModel) return\n el.checked = looseEqual(currentModel, applyCoerce(getValue(el), value))\n el._lastAppliedModel = currentModel\n },\n}\n\nconst vRegisterSelect: RegisterSelectCustomDirective = {\n // <select multiple> value need to be deep traversed\n deep: true,\n created(el, { value, modifiers: { number } }, vnode) {\n if (!isRegisterValue(value)) return\n\n value.registerElement(el)\n const isSetModel = isSet(value.innerRef.value)\n addEventListener(el, 'change', () => {\n if (shouldBailListener(el)) return\n const selectedVal = Array.prototype.filter\n .call(el.options, (o: HTMLOptionElement) => o.selected)\n .map((o: HTMLOptionElement) => (number === true ? looseToNumber(getValue(o)) : getValue(o)))\n const wrote = el[assignKey]?.(\n el.multiple ? (isSetModel ? new Set(selectedVal) : selectedVal) : selectedVal[0]\n )\n // Only set `_assigning` when the write actually landed. A\n // rejected write (slim-primitive gate said no) should NOT\n // suppress the next `updated` hook's `setSelected` — we want\n // the DOM to revert to `innerRef.value` since the form state\n // didn't change. `undefined` from a consumer-installed assigner\n // counts as \"succeeded\" for back-compat (their assigner has no\n // way to signal otherwise).\n if (wrote !== false) {\n el._assigning = true\n void nextTick(() => {\n el._assigning = false\n })\n }\n // After the default assigner runs, force-sync the `<select>`\n // selection to current storage. Catches the no-op-write case:\n // a transform mapped the user's pick to current storage (e.g.\n // always-fixed transform) — no patch, no render, no `updated`\n // setSelected. Without this the DOM stays at the user's\n // selection, divorced from storage. Skipped for custom\n // assigners (they own DOM/storage sync).\n if (isRegisterValue(value) && isDefaultAssigner(el[assignKey])) {\n setSelected(el, value)\n el._lastAppliedModel = value.innerRef.value\n }\n })\n setAssignFunction(el, vnode, value)\n },\n // set value in mounted & updated because <select> relies on its children\n // <option>s.\n mounted(el, { value }) {\n setSelected(el, value)\n if (isRegisterValue(value)) el._lastAppliedModel = value.innerRef.value\n },\n beforeUpdate(el, binding, vnode) {\n setAssignFunction(el, vnode, binding.value)\n },\n // Skip the DOM sync when the model is identity-unchanged from the\n // last application. Parent re-renders fire `updated` whether or not\n // the bound model actually moved (a typed character in a sibling,\n // an async-validation tick, any reactive read elsewhere on the\n // page). Without this guard, every such render unconditionally re-\n // applies `setSelected` against the prior model, which on a\n // `<select multiple>` clobbers any in-progress user selection\n // between mousedown and the browser's change-event decision — the\n // browser then sees no net change, never fires `change`, and the\n // model never updates. Identity comparison is sound: every form\n // write produces a new array/Set reference at the path (the diff-\n // apply replacement of `form.value` rolls forward fresh structures\n // along the spine), so reference equality on `innerRef.value`\n // tracks \"did the model move\" exactly. The `_assigning` gate stays\n // — it short-circuits the immediate post-write render where the\n // DOM is already in sync from the user's click.\n updated(el, { value }) {\n if (el._assigning === true) return\n if (!isRegisterValue(value)) return\n const currentModel = value.innerRef.value\n if (el._lastAppliedModel === currentModel) return\n setSelected(el, value)\n el._lastAppliedModel = currentModel\n },\n}\n\nfunction setSelected(el: HTMLSelectElement, value: unknown) {\n if (!isRegisterValue(value)) return\n\n // Use the model value directly — mirrors Vue's reference\n // `vModelSelect.setSelected`. Pre-fix this went through a\n // `getBaseValue` indirection that read DOM-current selection state\n // instead of the model, returning an empty Set for single-select\n // numeric models. The downstream `looseEqual('1', Set{})` always\n // failed, so `selectedIndex` ended at `-1` (no option highlighted)\n // even though the bound value matched an option. Single-select with\n // number / string / boolean now correctly drives the DOM via\n // `looseEqual` (which coerces primitives through `String(...)`),\n // and multi-select uses the Array / Set membership it always did.\n const externalValue = value.innerRef.value\n const isMultiple = el.multiple\n const isArrayValue = isArray(externalValue)\n\n if (isMultiple && !isArrayValue && !isSet(externalValue)) {\n if (__DEV__) {\n warn(\n `<select multiple v-register> expected an Array or Set, got ` +\n `${Object.prototype.toString.call(externalValue).slice(8, -1)}. ` +\n `Bind to a list-typed schema (e.g. z.array(z.string()) or z.set(z.string())).`\n )\n }\n return\n }\n // Symmetric misuse: non-multiple select bound to an Array / Set\n // model. The change handler would write `selectedVal[0]` (scalar)\n // back, which the slim-primitive gate rejects against an Array\n // path — so the user's clicks silently fail. Mount-time\n // `looseEqual('a', ['a', 'b'])` also returns false, so no option\n // ever appears highlighted. Bail with a dev-warn pointing at the\n // fix (`add multiple` for list bindings, or use a scalar model).\n if (!isMultiple && (isArrayValue || isSet(externalValue))) {\n if (__DEV__) {\n warn(\n `<select v-register> (no \\`multiple\\` attribute) expected a scalar value for its ` +\n `binding, but got ${Object.prototype.toString.call(externalValue).slice(8, -1)}. ` +\n `Add the \\`multiple\\` attribute to bind to a list, or use a scalar schema (e.g. ` +\n `\\`z.string()\\`) for a single-select binding.`\n )\n }\n return\n }\n\n if (isMultiple) {\n // Precompute a `Set<string>` of stringified model members once,\n // then do O(1) lookups per option. Drops the per-option work\n // from O(N) to O(1), so total `setSelected` cost is O(N + M)\n // for an N-item model and an M-option <select> — matters for\n // long forms (thousands of options or selected items). Both\n // Array and Set primitive paths share this; only object-valued\n // option binds (rare) keep their original identity comparisons.\n //\n // Each option's raw `value` is routed through `applyCoerce`\n // before stringifying so the comparison stays symmetric with\n // the change handler's WRITE-side coerce — without it,\n // `String(true) === \"true\"` but the option's raw `\"True\"`\n // stringifies to `\"True\"` and the option silently never matches.\n const stringifiedMembers = new Set<string>()\n const iter: Iterable<unknown> = isArrayValue\n ? (externalValue as ReadonlyArray<unknown>)\n : (externalValue as Set<unknown>)\n for (const v of iter) stringifiedMembers.add(String(v))\n\n for (let i = 0, l = el.options.length; i < l; i++) {\n const option = el.options[i]\n if (!option) continue\n // Element-level coerce: a multi-select's option matches a\n // member of an array/Set model, so the comparison must run\n // against the element type, not the path's top-level type.\n const optionValue = applyElementCoerce(getValue(option), value)\n const optionType = typeof optionValue\n if (optionType === 'string' || optionType === 'number') {\n option.selected = stringifiedMembers.has(String(optionValue))\n } else if (optionType === 'boolean') {\n // Booleans go through the same stringify channel — covers\n // `<option value=\"True\">` × `z.array(z.boolean())` after\n // coerce normalises to `true`.\n option.selected = stringifiedMembers.has(String(optionValue))\n } else if (isArrayValue) {\n // Object option, Array model: structural equality via\n // `looseIndexOf` (mirrors Vue's reference).\n option.selected = looseIndexOf(externalValue, optionValue) > -1\n } else {\n // Object option, Set model: identity-based `.has` (Sets\n // can't structurally compare without iterating, and Vue's\n // reference uses identity here).\n option.selected = (externalValue as Set<unknown>).has(optionValue)\n }\n }\n return\n }\n\n // Non-multiple: find the first option matching the scalar model\n // and set selectedIndex; clear if nothing matches. Coerce the\n // raw option value to keep parity with the change handler.\n for (let i = 0, l = el.options.length; i < l; i++) {\n const option = el.options[i]\n if (!option) continue\n if (looseEqual(applyCoerce(getValue(option), value), externalValue)) {\n if (el.selectedIndex !== i) el.selectedIndex = i\n return\n }\n }\n if (el.selectedIndex !== -1) el.selectedIndex = -1\n}\n\n// retrieve raw value set via :value bindings\n//\n// `explicitRequired` is the checkbox-array / checkbox-Set caller's way\n// of saying \"the user must have provided an option-value via either a\n// dynamic `:value` binding (Vue sets `el._value`) OR a static `value`\n// attribute (DOM has `value` attribute set). If neither is present,\n// the default `el.value` of 'on' would silently add the bogus literal\n// 'on' to the array on every toggle — surface as undefined so the\n// caller can warn instead.\"\n//\n// Without the `hasAttribute('value')` fallback, the SSR + static-attr\n// hydration path fails: Vue's hydration skips patchProp for hoisted\n// static attributes, `el._value` is never set, but the DOM still\n// reflects the rendered `value=\"apple\"` attribute. We need to honor\n// either signal.\nfunction getValue(el: HTMLOptionElement | HTMLInputElement, explicitRequired = false) {\n if ('_value' in el) return el._value\n if (explicitRequired && !el.hasAttribute('value')) return undefined\n return el.value\n}\n\n// retrieve raw value for true-value and false-value set via :true-value or :false-value bindings\nfunction getCheckboxValue(\n el: HTMLInputElement & { _trueValue?: unknown; _falseValue?: unknown },\n checked: boolean\n) {\n const key = checked ? '_trueValue' : '_falseValue'\n return key in el ? el[key] : checked\n}\n\n// Tags the directive's text/checkbox/radio/select variants handle\n// natively. A v-register binding on anything else (a `<div>`, a\n// `<span>`, a Vue component whose root is a non-form element) gets\n// listeners attached normally — but the listener bodies bail (via\n// `shouldBailListener`) when the assigner is still the default. This\n// prevents the bubbled-write bug while letting consumer-installed\n// `assignKey` / `@update:registerValue` shapes flow through.\n//\n// The dev-warn for the \"no escape hatch\" case is deferred to the\n// next tick after `created`, so `useRegister`'s `onMounted` marker\n// has a chance to set `REGISTER_OWNER_MARKER` on the rendered root\n// before the warn check runs. Without the deferral, deeply-nested\n// `useRegister` children would always warn (the directive can't\n// reach the child instance via `binding.instance` — that's the\n// page/parent component, whose `subTree` is the outer element tree,\n// not the child component vnode directly).\nconst SUPPORTED_TAGS = new Set(['INPUT', 'TEXTAREA', 'SELECT'])\n\n// One-shot dev-warn dedupe so a v-for over 100 unsupported elements\n// produces one warning, not 100. Keyed by element identity (WeakSet\n// for GC-friendliness).\nconst warnedUnsupportedElements: WeakSet<HTMLElement> | null = __DEV__\n ? new WeakSet<HTMLElement>()\n : null\n\nconst vRegisterDynamic: RegisterModelDynamicCustomDirective = {\n created(el, binding, vnode) {\n // Per-element persist opt-in is reconciled at the dynamic level so\n // the per-tag variants stay focused on their input semantics.\n syncPersistOptIn(el, binding.value, undefined)\n\n // Always run the per-tag variant's `created` — listener-body bail\n // (`shouldBailListener`) prevents the bubbled-write bug on\n // non-supported roots while letting consumer overrides through.\n callModelHook(el, binding, vnode, null, 'created')\n\n // Defer the unsupported-element warn to nextTick. By then:\n // - useRegister's onMounted has run, setting REGISTER_OWNER_MARKER\n // on the el if the child component called useRegister()\n // - any post-install assignKey override (via onMounted /\n // ref-callback) is in place, so the assigner isn't default\n // anymore. The warn fires only when neither escape hatch was used.\n if (\n __DEV__ &&\n warnedUnsupportedElements !== null &&\n !SUPPORTED_TAGS.has(el.tagName) &&\n !warnedUnsupportedElements.has(el)\n ) {\n void nextTick(() => {\n if (warnedUnsupportedElements.has(el)) return\n const hasMarker =\n (el as unknown as { [k: symbol]: unknown })[REGISTER_OWNER_MARKER] === true\n const hasUserAssigner = !isDefaultAssigner(\n (el as unknown as { [k: symbol]: unknown })[assignKey]\n )\n if (hasMarker || hasUserAssigner) return\n warnedUnsupportedElements.add(el)\n warn(\n `[attaform] v-register on <${el.tagName.toLowerCase()}> is a no-op — ` +\n `non-input roots aren't bound to text-input semantics. For custom components: ` +\n `call \\`useRegister()\\` in the child's setup and re-bind v-register to an inner ` +\n `native element. Lower-level: install a custom assigner via the \\`assignKey\\` ` +\n `symbol on the element.`\n )\n })\n }\n },\n mounted(el, binding, vnode) {\n callModelHook(el, binding, vnode, null, 'mounted')\n },\n beforeUpdate(el, binding, vnode, prevVNode) {\n // Reactive opt-in toggling: `register('foo', { persist: rememberMe })`\n // re-evaluates on every parent render. `binding.oldValue` holds the\n // prior RegisterValue so the helper can diff persist / path / registry\n // and migrate the entry without thrashing.\n syncPersistOptIn(el, binding.value, binding.oldValue)\n // Same diff for the form's element map. Catches the\n // `useRegister`-driven swap (binding mounted with `undefined`,\n // a real RV arrives on the next render), the dynamic-path case,\n // and the cross-form swap. Same-path + same-form transitions\n // short-circuit so identity-stable bindings don't thrash.\n syncElementRegistration(el, binding.value, binding.oldValue)\n callModelHook(el, binding, vnode, prevVNode, 'beforeUpdate')\n },\n updated(el, binding, vnode, prevVNode) {\n callModelHook(el, binding, vnode, prevVNode, 'updated')\n },\n beforeUnmount(el, { value }) {\n // Detach every listener the variant attached in `created`, regardless\n // of whether the binding is still a valid RegisterValue. An element\n // re-used by KeepAlive / v-show would otherwise double its listener\n // count on the next activation cycle.\n removeTrackedListeners(el)\n\n // Drop every opt-in this element ever held — `removeAllFor` sweeps\n // by elementId rather than (id, path), which covers the case where\n // the binding's path changed across updates and we don't want to\n // hunt for the latest entry.\n if (isRegisterValue(value)) {\n value.persistOptIns.removeAllFor(getOrAssignElementId(el))\n }\n\n if (!isRegisterValue(value)) return\n\n value.deregisterElement(el)\n\n // Remove internal state that the directive attaches directly to the\n // element. If the element is reused (<KeepAlive>, v-show), stale flags\n // like `composing: true` (IME in progress) would swallow user input.\n delete (el as { composing?: boolean }).composing\n delete (el as { _assigning?: boolean })._assigning\n delete (el as unknown as { [k: symbol]: unknown })[assignKey]\n },\n}\n\n// No-op variant for <input type=\"file\">. Setting el.value on a file input\n// throws a DOMException for security reasons; the compile-time transform\n// skips this case, and this runtime directive routes reactive type=\"file\"\n// (e.g. `:type=\"isUpload ? 'file' : 'text'\"`) to a no-op too, still tracking\n// the element for focus-state purposes.\nconst vRegisterFileNoop: RegisterModelDynamicCustomDirective = {\n created(el, { value }) {\n if (!isRegisterValue(value)) return\n value.registerElement(el)\n if (__DEV__) {\n warn(\n '[attaform] v-register on <input type=\"file\"> is not supported. ' +\n 'Handle uploads with a manual @change listener.'\n )\n }\n },\n beforeUnmount(el, { value }) {\n // The file-input variant attaches no listeners, but we still drain\n // the bag defensively — a runtime-typed `:type` binding that flipped\n // from 'text' to 'file' on a reused element would have left the text\n // variant's listeners attached.\n removeTrackedListeners(el)\n if (!isRegisterValue(value)) return\n value.deregisterElement(el)\n },\n}\n\nfunction resolveDynamicModel(tagName: string, type: unknown) {\n // tagName is always uppercase per DOM spec (el.tagName); type comes from\n // vnode.props and is usually a string, but reactive bindings (`:type=\"x\"`)\n // can pass other values — guard defensively.\n if (tagName === 'SELECT') return vRegisterSelect\n if (tagName === 'TEXTAREA') return vRegisterText\n if (typeof type !== 'string') return vRegisterText\n if (type === 'file') return vRegisterFileNoop\n if (type === 'checkbox') return vRegisterCheckbox\n if (type === 'radio') return vRegisterRadio\n return vRegisterText\n}\n\nfunction callModelHook(\n el: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement,\n binding: DirectiveBinding,\n vnode: VNode,\n prevVNode: VNode | null,\n hook: keyof ObjectDirective\n) {\n const modelToUse = resolveDynamicModel(el.tagName, vnode.props?.['type'])\n const fn = modelToUse[hook] as DirectiveHook | undefined\n fn?.(el, binding, vnode, prevVNode)\n}\n\nexport type VXCustomDirective =\n | typeof vRegisterText\n | typeof vRegisterCheckbox\n | typeof vRegisterSelect\n | typeof vRegisterRadio\n | typeof vRegisterDynamic\n\n/**\n * The `v-register` directive. Bind a form field to a native input,\n * select, textarea, checkbox, or radio:\n *\n * ```vue\n * <input v-register=\"form.register('email')\" />\n * <select v-register=\"form.register('country')\">\n * <option value=\"us\">US</option>\n * <option value=\"uk\">UK</option>\n * </select>\n * ```\n *\n * The directive picks the right binding strategy automatically based\n * on the element's `tagName` and `type`. Registered globally by\n * `createAttaform()` — most consumers never import it\n * directly, but it's exposed for advanced integrations that wire\n * directives manually.\n */\nexport const vRegister = vRegisterDynamic\n","import type { App, Plugin } from 'vue'\nimport { __DEV__ } from './dev'\nimport { attachRegistryToApp, createRegistry } from './registry'\nimport { vRegister } from './directive'\nimport type { SSRDetectOptions } from './ssr'\nimport type { AttaformDefaults } from '../types/types-api'\n\n/**\n * Options for `createAttaform()`.\n */\nexport type AttaformPluginOptions = SSRDetectOptions & {\n /**\n * Whether to install the Vue DevTools integration. Default `true`.\n * The DevTools peer dependency is loaded lazily — in production\n * builds where it's absent, the import fails silently and no\n * extra bundle is shipped. Pass `false` to skip even attempting\n * the import.\n */\n devtools?: boolean\n /**\n * App-level defaults applied to every `useForm` call in this app.\n * Per-form options always win. See `AttaformDefaults` for\n * the supported option set and the merge rules.\n *\n * ```ts\n * app.use(\n * createAttaform({\n * defaults: { debounceMs: 100 },\n * })\n * )\n * ```\n */\n defaults?: AttaformDefaults\n}\n\n/**\n * Create the Vue plugin that installs the form library on a Vue\n * application. Call once per app, then `app.use(...)` the result.\n *\n * ```ts\n * import { createApp } from 'vue'\n * import { createAttaform } from 'attaform'\n *\n * createApp(App)\n * .use(createAttaform())\n * .mount('#app')\n * ```\n *\n * Under SSR with bare Vue 3, pass `{ ssr: true }` from your server\n * entry. Under Nuxt, install via `attaform/nuxt` instead —\n * the Nuxt module wires both server and client automatically.\n *\n * Installing more than once on the same app is a no-op (the second\n * call logs a dev-mode warning).\n */\nexport function createAttaform(options: AttaformPluginOptions = {}): Plugin {\n const plugin: Plugin = {\n install(app: App) {\n // Idempotent install: a second `app.use(createAttaform())`\n // (e.g. accidentally registered twice in vite.config + nuxt\n // module, or by a higher-order plugin that installs us alongside\n // a consumer's own install) would otherwise overwrite the\n // existing registry — orphaning every FormStore the previous\n // instance had built. Detect via the `_attaform` slot\n // `attachRegistryToApp` writes; bail with a dev warning so the\n // duplicate is visible during development.\n if (app._attaform !== undefined) {\n if (__DEV__) {\n console.warn(\n '[attaform] createAttaform() install was called twice on the same app; ' +\n 'the second call is a no-op. ' +\n 'Likely cause: registering the plugin via both the Nuxt module AND a manual `app.use(...)`.'\n )\n }\n return\n }\n const registry = createRegistry(options)\n attachRegistryToApp(app, registry)\n app.directive('register', vRegister)\n\n if (options.devtools !== false && !registry.ssr) {\n void (async () => {\n try {\n const { setupAttaformDevtools } = await import('./devtools')\n await setupAttaformDevtools(app, registry)\n } catch {\n // Missing peer dep / DevTools not attached — silently\n // skip. The form runtime works without DevTools; this is\n // pure-observability tooling.\n }\n })()\n }\n },\n }\n return plugin\n}\n","import type { App } from 'vue'\nimport type { FormKey } from '../types/types-api'\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\").\n const transientList = Array.from(state.blankPaths)\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"],"names":["target"],"mappings":";;;AAkBO,MAAM,UAAU,KAAA,CAAM,OAAA;AAEtB,SAAS,WAAW,KAAA,EAA0D;AACnF,EAAA,OAAO,OAAO,KAAA,KAAU,UAAA;AAC1B;AAEA,SAAS,aAAa,KAAA,EAAwB;AAC5C,EAAA,OAAO,MAAA,CAAO,SAAA,CAAU,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAC7C;AAEO,SAAS,MAAM,KAAA,EAAuC;AAC3D,EAAA,OAAO,YAAA,CAAa,KAAK,CAAA,KAAM,cAAA;AACjC;AAMO,SAAS,OAAO,KAAA,EAA+B;AACpD,EAAA,OAAO,YAAA,CAAa,KAAK,CAAA,KAAM,eAAA;AACjC;AAEO,SAAS,SAAS,KAAA,EAAiC;AACxD,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA;AAC1B;AAEO,SAAS,SAAS,KAAA,EAA2D;AAClF,EAAA,OAAO,KAAA,KAAU,IAAA,IAAQ,OAAO,KAAA,KAAU,QAAA;AAC5C;AAEO,SAAS,cAAiB,GAAA,EAAoB;AACnD,EAAA,MAAM,CAAA,GAAI,WAAW,GAAwB,CAA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