attaform 0.14.0 → 0.15.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/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.DlgKK10S.mjs → attaform.CRk8NhlD.mjs} +18 -17
- package/dist/shared/attaform.CRk8NhlD.mjs.map +1 -0
- package/dist/shared/{attaform.CXZgUECn.d.cts → attaform.CVv9Oh0a.d.mts} +41 -9
- package/dist/shared/{attaform.BYc9kugA.d.ts → attaform.CWCx2r0x.d.ts} +41 -9
- package/dist/shared/attaform.CXpzmj38.mjs.map +1 -1
- 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.DOKOyb3Y.d.mts → attaform.Dq5BabH1.d.cts} +41 -9
- 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/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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attaform.Bubm_slq.cjs","sources":["../../src/runtime/lib/core/transforms/input-text-area-transform.ts","../../src/runtime/lib/core/transforms/select-transform.ts","../../src/runtime/lib/core/transforms/v-register-hint-transform.ts","../../src/runtime/lib/core/transforms/v-register-preamble-transform.ts"],"sourcesContent":["import type {\n AttributeNode,\n CompoundExpressionNode,\n DirectiveNode,\n ExpressionNode,\n NodeTransform,\n PlainElementNode,\n RootNode,\n SourceLocation,\n TemplateChildNode,\n} from '@vue/compiler-core'\nimport { createCompoundExpression, NodeTypes } from '@vue/compiler-core'\n\ntype SummarizedProp = {\n key: string\n value: string | CompoundExpressionNode['children']\n}\n\nfunction getSummarizedProps(node: RootNode | TemplateChildNode) {\n if (!('props' in node)) return []\n const props = node.props\n\n const summarizedProps = props.reduce<SummarizedProp[]>((acc, currProp) => {\n if (currProp.type === NodeTypes.ATTRIBUTE) {\n const key = currProp.name\n const value = currProp.value?.content ?? ''\n return [...acc, { key, value: renderAsStatic(value, true) }]\n }\n\n if (currProp.exp === undefined) return acc\n const key = currProp.arg\n ? getSummarizedPropValue(currProp.arg)\n : renderAsStatic(currProp.name, true)\n if (typeof key !== 'string') return acc // key must always be a string\n const value = getSummarizedPropValue(currProp.exp)\n\n return [...acc, { key, value }]\n }, [])\n\n return summarizedProps\n}\n\nfunction renderAsStatic(val: string, isStatic: boolean) {\n return isStatic ? `\"${val}\"` : val\n}\n\nfunction getSummarizedPropValue(exp: ExpressionNode): SummarizedProp['value'] {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {\n return renderAsStatic(exp.content, exp.isStatic)\n }\n\n return exp.children\n}\n\nfunction generateEqualityExpression(\n registerValue: SummarizedProp['value'],\n optionValue: SummarizedProp['value'],\n scalarTarget: SummarizedProp['value']\n): CompoundExpressionNode['children'] {\n const registerValueArr = Array.isArray(registerValue) ? registerValue : [registerValue]\n const optionValueArr = Array.isArray(optionValue) ? optionValue : [optionValue]\n const scalarTargetArr = Array.isArray(scalarTarget) ? scalarTarget : [scalarTarget]\n\n // Discriminator selection:\n // - Array model → membership of the option-value (e.g. value=\"apple\")\n // - Set model → membership of the option-value\n // - Scalar model → equality with the scalar-equality target\n //\n // The scalar target differs from the option-value for two checkbox\n // shapes that the directive's runtime `setChecked` already handles\n // via `getCheckboxValue(el, true)`:\n //\n // - boolean model + no `value=` → target is `true`\n // - string model + `:true-value=\"'X'\"` → target is `'X'`\n //\n // For radio inputs the model is always scalar and the discriminator\n // IS the option-value, so `optionValue === scalarTarget` there.\n return [\n 'Array.isArray((',\n ...registerValueArr,\n ')?.innerRef?.value) ? ',\n '(',\n ...registerValueArr,\n ')?.innerRef?.value?.includes(',\n ...optionValueArr,\n ') : ',\n '(',\n ...registerValueArr,\n ')?.innerRef?.value instanceof Set ? (',\n ...registerValueArr,\n ')?.innerRef?.value?.has(',\n ...optionValueArr,\n ') : ',\n '((',\n ...registerValueArr,\n ')?.innerRef?.value === (',\n ...scalarTargetArr,\n '))',\n ]\n}\n\nfunction removePropsByName(props: (AttributeNode | DirectiveNode)[], propNames: string[]) {\n const removePropIndices: number[] = []\n for (let index = 0; index < props.length; index++) {\n const prop = props[index]\n if (!prop) continue\n\n if (\n propNames.includes(prop.name) ||\n ('arg' in prop && prop.arg && 'content' in prop.arg && propNames.includes(prop.arg.content))\n ) {\n removePropIndices.push(index) // store index to remove later, don't mutate variable while looping through it\n }\n }\n\n for (const index of removePropIndices.sort((a, z) => z - a)) {\n props.splice(index, 1) // index runs from high to low, so this works\n }\n}\n\n// Exact prop-name match. Pre-rewrite used .includes('register') / .includes('value') /\n// .includes('type') which false-positived on any user prop whose name contained those\n// substrings (e.g. `data-register-id`, `valueFoo`, `prototype`, `:registerField`).\nfunction isExactKey(summarizedKey: string, name: string): boolean {\n // Summarized keys come in three shapes depending on prop type:\n // attribute -> \"name\" (from getSummarizedProps)\n // v-bind:name=\"x\" -> \"\\\"name\\\"\" (quoted via renderAsStatic)\n // static v-prefix -> \"\\\"name\\\"\"\n return summarizedKey === name || summarizedKey === `\"${name}\"`\n}\n\n/**\n * Returns true iff the type prop's value is the static-attribute literal\n * matching one of `names` (case-insensitive). Used to detect static\n * `type=\"checkbox\"` / `type=\"radio\"` shapes where the `value` attribute\n * is the option-value (a discriminator within the group), not display\n * state — so the transform must NOT strip it.\n *\n * Conservative on dynamic shapes — `:type=\"x\"` returns false, falling\n * through to the text-input branch which strips `value`. Authors using\n * dynamic types between checkbox/radio and text are rare; if they hit\n * this they can add a static `type=` to lock the shape.\n */\nfunction isStaticTypeOneOf(value: SummarizedProp['value'], names: readonly string[]): boolean {\n if (Array.isArray(value)) return false\n const trimmed = value.trim()\n const literalMatch = /^([\"'`])(.*)\\1$/.exec(trimmed)\n if (literalMatch === null) return false\n const inner = (literalMatch[2] as string).toLowerCase()\n return names.includes(inner)\n}\n\n/**\n * Returns true if the type prop's value MIGHT resolve to \"file\" at runtime.\n * Conservative — anything not provably non-\"file\" returns true so the caller\n * skips the transform.\n *\n * Concretely:\n * - `type=\"text\"` → value is `'\"text\"'` → false (static literal != \"file\")\n * - `type=\"file\"` → value is `'\"file\"'` → true (static \"file\")\n * - `:type=\"'text'\"`→ value is `\"'text'\"` → false\n * - `:type=\"'file'\"`→ value is `\"'file'\"` → true\n * - `:type=\"kind\"` → value is `'kind'` → true (dynamic identifier)\n * - `:type=\"`a-${x}`\"` → array or template lit → true (compound expression)\n */\nfunction couldResolveToFileType(value: SummarizedProp['value']): boolean {\n if (Array.isArray(value)) return true\n const trimmed = value.trim()\n // Match a one-line JS string literal: '...', \"...\", or `...`. Doesn't\n // attempt to handle escaped quotes inside the literal — a `type` prop\n // containing escaped quotes is vanishingly rare and falling through to\n // \"could be file\" here is the safe direction anyway.\n const literalMatch = /^([\"'`])(.*)\\1$/.exec(trimmed)\n if (literalMatch === null) return true // dynamic expression — can't prove safe\n const quote = literalMatch[1] as string\n const inner = literalMatch[2] as string\n // Template literals with interpolations resolve at runtime.\n if (quote === '`' && inner.includes('${')) return true\n // The HTML spec matches `type` ASCII case-insensitively, so\n // `<input type=\"FILE\">` behaves identically to `<input type=\"file\">`.\n // Compare lower-cased so we catch both.\n return inner.toLowerCase() === 'file'\n}\n\n/**\n * Vue compiler node transform for `<input v-register>` and\n * `<textarea v-register>`. Injects the `:value` / `:checked`\n * bindings required for SSR-correct initial render.\n *\n * Wired automatically by `attaform/vite` and\n * `attaform/nuxt`. Use directly only when integrating with\n * a custom bundler.\n */\nexport const inputTextAreaNodeTransform: NodeTransform = (node) => {\n try {\n if (node.type !== NodeTypes.ELEMENT) return\n\n const isInput = node.tag === 'input'\n const isTextArea = node.tag === 'textarea'\n\n if (!isInput && !isTextArea) return\n\n const elementProps = getSummarizedProps(node)\n\n const registerIndex = elementProps.findIndex((p) => isExactKey(p.key, 'register'))\n const registerSummarizedProp = elementProps[registerIndex]\n if (!registerSummarizedProp) return // no v-register directive; nothing to transform\n\n // <input type=\"file\" v-register=\"...\"> silently skipped — at runtime the\n // directive routes to a no-op variant. Trying to set el.value on a file\n // input throws a DOMException for security reasons. We must skip not just\n // the static type=\"file\" case but any dynamic binding (`:type=\"x\"`,\n // template-literal expressions, etc.) that COULD resolve to \"file\" at\n // runtime — `couldResolveToFileType` errs on the conservative side.\n const typeIndex = elementProps.findIndex((p) => isExactKey(p.key, 'type'))\n const typeProp = elementProps[typeIndex]\n if (typeProp !== undefined && couldResolveToFileType(typeProp.value)) return\n\n const valueIndex = elementProps.findIndex((p) => isExactKey(p.key, 'value'))\n const elementValueSummarizedProp = elementProps?.[valueIndex] ?? {\n key: 'value',\n value: \"''\",\n }\n\n const inputTypeIndex = typeIndex\n\n const defaultSummarizedTextProp = { key: 'type', value: \"'text'\" }\n const inputTypeSummarizedProp: SummarizedProp =\n inputTypeIndex === -1\n ? defaultSummarizedTextProp\n : (elementProps[inputTypeIndex] ?? defaultSummarizedTextProp)\n const inputTypeExpressionArray =\n typeof inputTypeSummarizedProp.value === 'string'\n ? [inputTypeSummarizedProp.value]\n : inputTypeSummarizedProp.value\n\n // this gets paired with `value` to get the [selectionLabel]=[label] prop for the given input\n // checkbox and radio are marked as selected via `checked`, others typically use `value`\n //\n // The HTML spec matches `type` ASCII case-insensitively, so\n // `<input type=\"CHECKBOX\">` and `<input type=\"Radio\">` produce the\n // same runtime element as their lowercase counterparts. The\n // injected expression normalizes via `String(t).toLowerCase()`\n // before comparing — the compile-time `isStaticTypeOneOf` already\n // uses case-insensitive matching, so without the runtime\n // normalization a `type=\"CHECKBOX\"` input would have its static\n // `value` preserved (per `keepStaticValue`) but still emit\n // `:value=\"...\"` instead of `:checked=\"...\"`, breaking SSR initial\n // checked state.\n const elementSelectionLabelExpression = createCompoundExpression([\n '(',\n 'String((',\n ...inputTypeExpressionArray,\n ')).toLowerCase()',\n \" === 'checkbox' || \",\n 'String((',\n ...inputTypeExpressionArray,\n \")).toLowerCase() === 'radio'\",\n \") ? 'checked' : 'value'\",\n ])\n\n // Narrowed from `PlainElementNode | ComponentNode | SlotOutletNode |\n // TemplateNode` — `<input>` / `<textarea>` are always PlainElementNode\n // in Vue's AST. The previous wide union let a TemplateNode slip\n // through and crash on `_node.props`.\n function computeProps(\n _node: PlainElementNode,\n registerSummarizedProp: SummarizedProp,\n elementValueSummarizedProp: SummarizedProp\n ): void {\n // Reuse the originating element's source location for the\n // injected directive — runtime errors in the synthesized expression\n // get reported at the v-register binding site rather than line 0.\n const injectedLoc: SourceLocation = _node.loc\n\n const props = _node.props\n // For statically-typed checkbox / radio inputs, the `value=`\n // attribute is the OPTION-value (the discriminator the directive\n // matches against the model), not display state. The synthesized\n // binding below resolves to `:checked=\"...\"` for those types, a\n // different attribute key — so the static `value` survives\n // alongside it without conflict. Stripping it (as we still do\n // for text/textarea, where the synthesized binding resolves to\n // `:value`) leaves the SSR HTML without the attribute, and on\n // hydration the directive can't tell which option this checkbox\n // represents.\n const isStaticCheckbox =\n typeProp !== undefined && isStaticTypeOneOf(typeProp.value, ['checkbox'])\n const isStaticRadio = typeProp !== undefined && isStaticTypeOneOf(typeProp.value, ['radio'])\n const keepStaticValue = isStaticCheckbox || isStaticRadio\n removePropsByName(props, keepStaticValue ? ['checked'] : ['checked', 'value'])\n const registerValueArr = Array.isArray(registerSummarizedProp.value)\n ? registerSummarizedProp.value\n : [registerSummarizedProp.value]\n // Read `displayValue.value` rather than `innerRef.value` so the\n // `:value` binding renders the blank `''` when the\n // user clears a numeric field. `displayValue` returns\n // `String(storage)` for non-empty storage and `''` for both\n // null/undefined storage and paths in the form's\n // `blankPaths` set — a single read surface for the\n // injected expression. For checkbox / radio (the ternary's\n // truthy branch above), this leg is unreached, so behaviour\n // there is unchanged.\n const valueExpression = createCompoundExpression([\n '(',\n ...registerValueArr,\n ')?.displayValue?.value',\n ])\n\n // Scalar-equality target. Three cases (see the long-form comment\n // on `generateEqualityExpression`):\n // - static checkbox + `:true-value=\"X\"` → X (the explicit\n // mapped string the model takes when checked)\n // - static checkbox without `:true-value` → boolean `true`\n // (matches the runtime's `getCheckboxValue(el, true)` default)\n // - static radio → the option-value (since radio model is\n // always scalar and the `value=` IS the discriminator)\n // - dynamic type → fall back to the option-value (current\n // behaviour); a dynamic-type element can't be statically\n // classified into checkbox vs radio vs text.\n const trueValueIndex = elementProps.findIndex((p) => isExactKey(p.key, 'true-value'))\n const trueValueProp = elementProps[trueValueIndex]\n const scalarTarget: SummarizedProp['value'] = isStaticCheckbox\n ? trueValueProp !== undefined\n ? trueValueProp.value\n : 'true'\n : elementValueSummarizedProp.value\n\n const valueOrCheckedProp: DirectiveNode = {\n // reconstruct the `value` attribute based on the provided v-registerer, now that the computation is complete\n arg: elementSelectionLabelExpression,\n exp: createCompoundExpression([\n '(',\n ...elementSelectionLabelExpression.children,\n \") === 'checked' ? (\",\n // resolves to a boolean\n ...generateEqualityExpression(\n registerSummarizedProp.value,\n elementValueSummarizedProp.value,\n scalarTarget\n ),\n ') : (',\n // resolves to the provided register value\n ...valueExpression.children,\n ')',\n ]),\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: injectedLoc,\n }\n\n props.push(valueOrCheckedProp)\n }\n\n // The outer guards (`node.type === NodeTypes.ELEMENT` + `node.tag\n // === 'input' | 'textarea'`) narrow `node` to a PlainElementNode\n // at runtime; the cast records that for the type system.\n computeProps(node as PlainElementNode, registerSummarizedProp, elementValueSummarizedProp)\n } catch (err) {\n // AST shapes can shift with minor Vue compiler updates. If we hit\n // anything unexpected, skip this transform — the runtime directive\n // alone handles value binding (via mounted/beforeUpdate), so the only\n // cost is a one-frame flash on SSR initial render.\n\n console.error('[attaform] input/textarea transform failed, skipping:', err)\n }\n}\n","import {\n createCompoundExpression,\n createSimpleExpression,\n ElementTypes,\n NodeTypes,\n processExpression,\n type AttributeNode,\n type CompoundExpressionNode,\n type DirectiveNode,\n type ExpressionNode,\n type NodeTransform,\n type RootNode,\n type SourceLocation,\n type TemplateChildNode,\n} from '@vue/compiler-core'\n\ntype SummarizedProp = {\n key: string\n value: string | CompoundExpressionNode['children']\n}\n\nfunction getSummarizedProps(node: RootNode | TemplateChildNode) {\n if (!('props' in node)) return []\n const props = node.props\n\n const summarizedProps = props.reduce<SummarizedProp[]>((acc, currProp) => {\n if (currProp.type === NodeTypes.ATTRIBUTE) {\n const key = currProp.name\n const value = currProp.value?.content ?? ''\n return [...acc, { key, value: renderAsStatic(value, true) }]\n }\n\n if (currProp.exp === undefined) return acc\n const key = currProp.arg\n ? getSummarizedPropValue(currProp.arg)\n : renderAsStatic(currProp.name, true)\n if (typeof key !== 'string') return acc // key must always be a string\n const value = getSummarizedPropValue(currProp.exp)\n\n return [...acc, { key, value }]\n }, [])\n\n return summarizedProps\n}\n\nfunction renderAsStatic(val: string, isStatic: boolean) {\n return isStatic ? `\"${val}\"` : val\n}\n\nfunction getSummarizedPropValue(exp: ExpressionNode): SummarizedProp['value'] {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {\n return renderAsStatic(exp.content, exp.isStatic)\n }\n\n return exp.children\n}\n\nfunction generateEqualityExpression(\n selectValue: SummarizedProp['value'],\n optionValue: SummarizedProp['value'],\n previousOptionExpressions: CompoundExpressionNode['children'][]\n) {\n function getExpressionNodeChildren(\n _selectValue: SummarizedProp['value'],\n _optionValue: SummarizedProp['value'],\n _previousOptionExpressions: CompoundExpressionNode['children'][]\n ): CompoundExpressionNode['children'] {\n const multipleExpression = _previousOptionExpressions?.[0] // this should always exist\n if (multipleExpression === undefined) {\n // this should NEVER happen\n throw new Error(\n 'Programming error: `multiple` expression for `select` node not generated while transforming AST'\n )\n }\n\n const optExpressions = _previousOptionExpressions.slice(1)\n\n // for `multiple`=\"false\", we ONLY execute latest expression if all past expressions were falsy\n const noMultipleOptExpressions = optExpressions.reduce<CompoundExpressionNode['children']>(\n (acc, curr, index) => {\n if (index === 0) {\n acc.push('(')\n }\n\n acc.push(...curr) // all expressions from last operation were grouped into an array\n if (index < optExpressions.length - 1) {\n acc.push(' || ')\n }\n\n if (index === optExpressions.length - 1) {\n acc.push(')')\n }\n\n return acc\n },\n []\n )\n\n const selectValueArr = Array.isArray(_selectValue) ? _selectValue : [_selectValue]\n const optionValueArr = Array.isArray(_optionValue) ? _optionValue : [_optionValue]\n\n function getImplicitTrueMultipleExpression(expression: CompoundExpressionNode['children']) {\n // Identify user passing in `multiple` as an implied truthy prop\n if (expression.length === 1 && expression[0] === '') return [`true`]\n return expression\n }\n\n // capture the current expression for the next round\n _previousOptionExpressions.push(['(', ...selectValueArr, ') === (', ...optionValueArr, ')'])\n // Single-select branch String-coerces both sides to mirror the\n // runtime directive's `looseEqual`-style match — a typed-numeric\n // model (`z.number()`) matches `<option value=\"1\">` at SSR time.\n // The `typeof !== 'object'` guard preserves the pre-existing\n // \"array model on a single-select doesn't match\" behaviour: an\n // array stringifies to its joined elements, which would otherwise\n // false-positive against a single-element option.\n // The multi-select branch keeps `innerRef.value` because Array\n // / Set models need findIndex / membership iteration.\n if (!noMultipleOptExpressions.length) {\n return [\n '(',\n ...getImplicitTrueMultipleExpression(multipleExpression),\n `) ? ((`,\n ...selectValueArr,\n `)?.innerRef?.value?.findIndex?.(el => el === (`,\n ...optionValueArr,\n `)) > -1) : (typeof (`,\n ...selectValueArr,\n `)?.innerRef?.value !== 'object' && String((`,\n ...selectValueArr,\n `)?.innerRef?.value) === String((`,\n ...optionValueArr,\n `)))`,\n ]\n }\n\n return [\n '(',\n ...getImplicitTrueMultipleExpression(multipleExpression),\n `) ? ((`,\n ...selectValueArr,\n `)?.innerRef?.value?.findIndex?.(el => el === (`,\n ...optionValueArr,\n `)) > -1) : ((`,\n ...noMultipleOptExpressions, // if true, we already found the relevant option\n `) ? false : (typeof (`,\n ...selectValueArr,\n `)?.innerRef?.value !== 'object' && String((`,\n ...selectValueArr,\n `)?.innerRef?.value) === String((`,\n ...optionValueArr,\n `))))`,\n ]\n }\n\n return getExpressionNodeChildren(selectValue, optionValue, previousOptionExpressions)\n}\n\nfunction extractMultipleFromSelectSummarizedProps(\n props: SummarizedProp[]\n): SummarizedProp['value'] {\n const multipleDirectiveIndex = props.findIndex(\n (prop) => prop.key.replace(/\"/g, `'`) === \"'multiple'\"\n )\n const multipleAttributeIndex = props.findIndex((prop) => prop.key === 'multiple')\n\n if (multipleDirectiveIndex === -1 && multipleAttributeIndex === -1) {\n return 'false'\n }\n const priorityIndex =\n multipleDirectiveIndex >= 0 ? multipleDirectiveIndex : multipleAttributeIndex\n const value = props[priorityIndex]?.value\n\n // attempt to convert expression within string into boolean\n // if undefined, make value `true` because of `<input multiple />` usage\n return typeof value === 'string' ? value.replace(/'|\"/g, '') : (value ?? 'true')\n}\n\nfunction removePropsByName(props: (AttributeNode | DirectiveNode)[], propNames: string[]) {\n const removePropIndices: number[] = []\n for (let index = 0; index < props.length; index++) {\n const prop = props[index]\n if (!prop) continue\n\n if (\n propNames.includes(prop.name) ||\n ('arg' in prop && prop.arg && 'content' in prop.arg && propNames.includes(prop.arg.content))\n ) {\n removePropIndices.push(index) // store index to remove later, don't mutate variable while looping through it\n }\n }\n\n for (const index of removePropIndices.sort((a, z) => z - a)) {\n props.splice(index, 1) // index runs from high to low, so this works\n }\n}\n\nfunction flattenCompoundExpression(node: CompoundExpressionNode): string {\n let result = ''\n\n for (const child of node.children) {\n if (typeof child === 'string') {\n result += child\n } else if (typeof child === 'symbol') {\n continue\n } else if (child.type === NodeTypes.SIMPLE_EXPRESSION) {\n result += child.content\n } else if (child.type === NodeTypes.COMPOUND_EXPRESSION) {\n result += flattenCompoundExpression(child)\n }\n }\n\n return result\n}\n\n// Exact prop-name match. Pre-rewrite used .includes('register') / .includes('value')\n// which false-positived on user props with those substrings in their names.\nfunction isExactKey(summarizedKey: string, name: string): boolean {\n return summarizedKey === name || summarizedKey === `\"${name}\"`\n}\n\n// Whitelist of node types that contain iterable child nodes. Used by\n// traverseSelectNode so we don't recurse into interpolation / comment / text\n// nodes (which have no `children` in the traversal sense) and don't crash on\n// future Vue node-type additions.\nconst RECURSABLE_NODE_TYPES: ReadonlySet<number> = new Set<number>([\n NodeTypes.ELEMENT,\n NodeTypes.FOR,\n NodeTypes.IF,\n NodeTypes.IF_BRANCH,\n])\n\n// Native form-shell tags excluded from the kebab-case extension. The\n// hyphen check on `node.tag` already excludes most native HTML tags\n// (which have no hyphen), but listing the form-shell ones explicitly\n// documents the conservative stance: even if a future native tag like\n// `<my-form-something>` lands, it won't accidentally collide with a\n// custom-element transform branch. `<input>`, `<select>`, `<textarea>`\n// already have dedicated branches via inputTextAreaNodeTransform and\n// the isSelect path above; the others (form, fieldset, label, button,\n// option) carry no meaningful v-register binding and shouldn't be\n// rewritten with component-style props.\nconst NATIVE_FORM_TAGS: ReadonlySet<string> = new Set<string>([\n 'input',\n 'textarea',\n 'select',\n 'option',\n 'form',\n 'fieldset',\n 'label',\n 'button',\n])\n\n/**\n * Synthesise a static value for `<option>foo</option>` (no `value=`\n * attr). Returns the text content as a single-quoted JS string literal\n * so the equality check rendered into the AST treats it as a string.\n *\n * Returns:\n * - quoted-string `\"'apple'\"` for a single static text child,\n * - `null` for mixed / dynamic / empty children — caller skips the\n * binding rather than synthesise a guess.\n *\n * The HTML spec says an option's value defaults to its descendant\n * text. We restrict to \"single static text node\" to keep the\n * code-path safe: handling interpolation correctly would need a\n * wrapped runtime expression, which we can't emit at compile time\n * without leaking runtime references that may not exist in the\n * template's binding scope.\n */\nfunction inferOptionValueFromChildren(node: TemplateChildNode | RootNode): string | null {\n if (!('children' in node)) return null\n const children = node.children\n if (children.length !== 1) return null\n const only = children[0]\n if (only === undefined) return null\n if (typeof only === 'string' || typeof only === 'symbol') return null\n if (only.type !== NodeTypes.TEXT) return null\n // Mirror Vue's option-value semantic: trim leading/trailing whitespace\n // so `<option> apple </option>` matches a model value of `'apple'`.\n const text = only.content.trim()\n // Emit a fully escaped JS string literal — `JSON.stringify` covers\n // backslashes, quotes, and line terminators (`\\n`, `\\r`, U+2028,\n // U+2029) so the synthesized literal stays single-line and valid.\n return JSON.stringify(text)\n}\n\n/**\n * Vue compiler node transform for `<select v-register>` and any\n * component that wraps a select. Injects the `:value` /\n * `:registerValue` bridge bindings the runtime directive needs to\n * pre-mark selected options at SSR time.\n *\n * Wired automatically by `attaform/vite` and\n * `attaform/nuxt`. Use directly only when integrating with\n * a custom bundler.\n */\nexport const selectNodeTransform: NodeTransform = (node, context) => {\n // Snapshot every prop array we're about to mutate so a throw\n // mid-traversal rewinds to the pre-transform state. Without this,\n // a partial transform leaves the template with some `<option\n // :selected>` bindings rewritten and others not — worse than\n // skipping the transform entirely, since the runtime directive\n // would then miscompute initial state against a shape it doesn't\n // recognise. `snapshotProps` is idempotent per target; calling\n // twice records one snapshot.\n type NodeProps = (AttributeNode | DirectiveNode)[]\n const snapshots: Array<{ target: NodeProps; snapshot: NodeProps }> = []\n const snapshotProps = (target: NodeProps): void => {\n if (snapshots.some((entry) => entry.target === target)) return\n snapshots.push({ target, snapshot: [...target] })\n }\n try {\n const isSelect = node.type === NodeTypes.ELEMENT && node.tag === 'select'\n const isCustomComponent =\n node.type === NodeTypes.ELEMENT && node.tagType === ElementTypes.COMPONENT\n // Kebab-case tags (those with a hyphen, like `<my-input>`) compile\n // as `tagType === ElementTypes.ELEMENT` — Vue's compiler can't tell\n // statically whether the tag will resolve to an `app.component`\n // registration or to a user-supplied `compilerOptions.isCustomElement`\n // predicate, so it emits an element creation that the runtime\n // disambiguates. The transform fires the bridge prop injection on\n // these tags too: a kebab-case Vue component sees `useRegister`\n // work in its setup; a real Web Component sees `:value` /\n // `:registerValue` as DOM attributes (the documented `assignKey`\n // escape hatch handles that interop).\n //\n // NATIVE_FORM_TAGS keeps the conservative stance: only inject on\n // tags Vue would NEVER treat as a component. The hyphen check\n // already excludes most native HTML tags (which have no hyphen);\n // the explicit list documents the contract and guards against\n // hypothetical future native form tags with hyphens.\n const isKebabCustomElement =\n node.type === NodeTypes.ELEMENT &&\n node.tagType === ElementTypes.ELEMENT &&\n node.tag.includes('-') &&\n !NATIVE_FORM_TAGS.has(node.tag)\n\n if (!(isSelect || isCustomComponent || isKebabCustomElement)) return\n\n const selectSummarizedProps = getSummarizedProps(node)\n\n const registerIndex = selectSummarizedProps.findIndex((p) => isExactKey(p.key, 'register'))\n if (\n selectSummarizedProps.length === 0 ||\n registerIndex < 0 ||\n registerIndex >= selectSummarizedProps.length\n )\n return\n\n const registerSummarizedProp = selectSummarizedProps[registerIndex]\n\n // Inject location matches the originating element so source maps\n // for runtime errors in the synthesized expressions point at the\n // user's <select v-register=...> rather than line 0.\n const selectLoc: SourceLocation = node.loc\n\n function traverseSelectNode(\n _node: RootNode | TemplateChildNode,\n previousOptionExpressions: CompoundExpressionNode['children'][]\n ): void {\n const isOption = _node.type === NodeTypes.ELEMENT && _node.tag === 'option'\n if (!isOption) {\n // Only recurse into node types that genuinely hold iterable children.\n // Text / interpolation / comment nodes are skipped; future Vue node\n // types that we don't know about are also skipped rather than\n // crashing on a shape we didn't expect.\n if (!RECURSABLE_NODE_TYPES.has(_node.type)) return\n const hasChildren = 'children' in _node\n if (!hasChildren) return\n for (const child of _node.children) {\n if (typeof child === 'symbol' || typeof child === 'string') continue\n if (child.type === NodeTypes.SIMPLE_EXPRESSION) continue\n traverseSelectNode(child, previousOptionExpressions)\n }\n return\n }\n\n const optionProps = getSummarizedProps(_node)\n const valueIndex = optionProps.findIndex((p) => isExactKey(p.key, 'value'))\n\n // D3: HTML lets `<option>apple</option>` use text content as the\n // value. The original transform required an explicit `value=`\n // attr and silently dropped value-less options — they'd render\n // unselectable through `register('fruit')` because the AST\n // emitted no `:selected` binding.\n //\n // Fallback: if no `value=`, look at the option's children. A\n // single static TextNode → use it as the static value. Anything\n // else (interpolation, mixed children, no children) → skip with\n // a dev-warn rather than guess.\n let optionValueSummarizedProp: SummarizedProp | undefined\n if (valueIndex >= 0 && valueIndex < optionProps.length) {\n optionValueSummarizedProp = optionProps[valueIndex]\n } else {\n const fallback = inferOptionValueFromChildren(_node)\n if (fallback === null) {\n // Dynamic / mixed children — can't synthesize a static\n // equality expression. Bail without binding so the option\n // simply isn't reactive (matches pre-D3 behaviour for the\n // genuinely-dynamic cases). Producing a wrong binding would\n // be worse than no binding.\n return\n }\n optionValueSummarizedProp = { key: 'value', value: fallback }\n }\n\n const props = _node.props\n snapshotProps(props)\n removePropsByName(props, ['selected'])\n\n const newProp: DirectiveNode = {\n arg: createSimpleExpression('selected', true),\n exp: createCompoundExpression(\n generateEqualityExpression(\n registerSummarizedProp?.value ?? 'undefined',\n optionValueSummarizedProp?.value ?? 'undefined',\n previousOptionExpressions\n )\n ),\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: _node.loc,\n }\n props.push(newProp)\n }\n\n const multipleExpression = extractMultipleFromSelectSummarizedProps(selectSummarizedProps)\n\n const previousOptionExpressions: CompoundExpressionNode['children'][] =\n typeof multipleExpression === 'string' ? [[multipleExpression]] : [multipleExpression]\n\n // Multi-select hydration trap. Setting `select.value = X` on a\n // `<select multiple>` runs the spec's value-setter loop: for each\n // option, set selectedness to (option.value === X). For an array\n // model, `displayValue.value` resolves to `String(arr)` —\n // `\"red,blue\"` — which matches NO option's value, so the patch\n // DESELECTS every option (including the SSR-selected ones the\n // per-option `:selected` injection just placed). At runtime the\n // directive's `setSelected` re-syncs from the model, but the value\n // patch + the directive's identity-skip path can leave the DOM\n // stuck deselected if the model hasn't moved since the last apply.\n //\n // Per-option `:selected` bindings are the canonical mechanism for\n // multi-select initial state — the runtime directive's setSelected\n // mirrors exactly the same logic on the client. The select-level\n // `:value` adds nothing for multi: it's only useful as Vue's\n // single-select `value` patch shorthand, which is benign there\n // (`select.value = \"1\"` selects the matching option, a no-op when\n // it's already selected via `<option selected>`).\n //\n // Conservative gate: skip `:value` whenever `multiple` isn't\n // statically false. Static `<select>` and static `<select\n // multiple=\"false\">` keep the injection (`extractMultipleFromSelect…`\n // returns the literal string `'false'` for both). Anything else —\n // static `multiple`, `multiple=\"true\"`, or a dynamic `:multiple`\n // expression we can't evaluate at compile time — skips. The\n // dynamic case is rare; trading SSR `value=` on the select for\n // hydration correctness is the right call.\n const isStaticallyNonMultiple = multipleExpression === 'false'\n\n const selectProps = node.props\n snapshotProps(selectProps)\n removePropsByName(selectProps, ['value']) // actively prevent an attribute collision\n\n if (isStaticallyNonMultiple) {\n // construct `:value` dynamic prop based on the existing `v-register` directive\n const valuePropExpArray = Array.isArray(registerSummarizedProp?.value)\n ? registerSummarizedProp.value\n : [registerSummarizedProp?.value ?? 'undefined']\n // Read `displayValue.value` rather than `innerRef.value` so\n // selects share the same single read surface as text inputs.\n // The directive never marks select paths blank (no\n // DOM \"empty\" state), so in normal flow `displayValue` is just\n // `String(storage)` — identical to today. The edge case where a\n // consumer programmatically calls `setValue(numericPath, unset)`\n // bound to a `<select>` is documented in the docs (browser falls\n // back to first option; meta.blank surfaces the intent).\n const initExpression = createCompoundExpression([\n '(',\n ...valuePropExpArray,\n ')?.displayValue.value',\n ])\n\n const simpleExpression = createSimpleExpression(\n flattenCompoundExpression(initExpression),\n false\n )\n // `processExpression` can throw on malformed identifiers or\n // exotic expression shapes. Pre-fix, the throw bubbled to the\n // outer try/catch, which then ran the snapshot-restore path AND\n // skipped both the select's `:value` injection AND every option's\n // `:selected` binding — turning a single-expression problem into\n // a whole-template fallback. Isolate here so a parser failure on\n // this one expression keeps the other injections.\n let outputExp: ExpressionNode\n try {\n outputExp = processExpression(simpleExpression, { ...context, prefixIdentifiers: false })\n } catch (err) {\n console.error(\n '[attaform] select transform: processExpression failed; falling back to the unprocessed expression.',\n err\n )\n outputExp = simpleExpression\n }\n\n const valueProp: DirectiveNode = {\n rawName: ':value',\n arg: createSimpleExpression('value', true),\n exp: outputExp,\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: selectLoc,\n }\n\n node.props.push(valueProp)\n }\n\n if (isSelect) {\n for (const child of node.children) {\n traverseSelectNode(child, previousOptionExpressions) // start searching for options in dfs manner\n }\n return\n }\n\n const registerProps = node.props.filter(\n (x) => x.type === NodeTypes.DIRECTIVE && x.name === 'register'\n )\n const registerProp = registerProps[0]\n\n if (!registerProp) return\n\n // Idempotency marker. The hint and preamble transforms record\n // their own per-node markers; this one detects an already-injected\n // `:registerValue` directive on the props array and skips\n // re-pushing. Without the check, a doubly-registered transform\n // pipeline (rare in production, common in test combinatorics)\n // would emit two `registerValue:` keys in the generated render —\n // the last wins for prop resolution, but the output is bloated and\n // confusing under codegen inspection.\n const alreadyInjected = node.props.some(\n (p) =>\n p.type === NodeTypes.DIRECTIVE &&\n p.name === 'bind' &&\n p.arg !== undefined &&\n 'content' in p.arg &&\n p.arg.content === 'registerValue'\n )\n if (alreadyInjected) return\n\n const customElementProp: DirectiveNode = {\n arg: createSimpleExpression('registerValue', true),\n exp: 'exp' in registerProp ? registerProp.exp : createSimpleExpression('undefined', false),\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: selectLoc,\n }\n\n node.props.push(customElementProp)\n } catch (err) {\n // AST shape drift or malformed template: rewind every prop array\n // we mutated so the template falls back cleanly to the runtime\n // directive. Reverse order mirrors the push order so later\n // snapshots restore against the state their earlier siblings\n // saw. Runtime directive alone still handles value binding; only\n // SSR initial-render correctness is affected.\n for (const { target, snapshot } of snapshots.slice().reverse()) {\n target.splice(0, target.length, ...snapshot)\n }\n\n console.error('[attaform] select transform failed, skipping:', err)\n }\n}\n","import {\n createCompoundExpression,\n NodeTypes,\n type CompoundExpressionNode,\n type ExpressionNode,\n type NodeTransform,\n} from '@vue/compiler-core'\n\n/**\n * `vRegisterHintTransform` — for every `<element v-register=\"<expr>\">`,\n * rewrite the directive's binding expression to wrap `<expr>` in an\n * IIFE that calls `markConnectedOptimistically()` on the resulting\n * `RegisterValue` and returns the same object:\n *\n * ((__attaRv) => (__attaRv?.markConnectedOptimistically?.(), __attaRv))(<expr>)\n *\n * Why this exists: Vue intentionally skips directive lifecycle hooks\n * during SSR (see `core/directive.ts`'s top comment). That means the\n * `v-register` directive's `created` hook — the one that flips\n * `isConnected: true` for the field — never fires server-side. Every\n * SSR'd FieldState therefore serialises `isConnected: false`, and on\n * hydration the directive runs and the flag flickers to `true`. Anyone\n * reading `getFieldState(path).isConnected` in a server-rendered\n * template sees the stale value baked into the static HTML.\n *\n * The wrapping IIFE captures the `RegisterValue` produced by `<expr>`,\n * fires the optimistic mark (which itself is guarded by `state.isSSR`,\n * so client-side it's a free no-op), and returns the same object so\n * the directive receives exactly what the author wrote.\n *\n * The transform is deliberately agnostic to the shape of `<expr>`:\n *\n * - inline: `v-register=\"form.register('email')\"`\n * - hoisted: `v-register=\"emailReg\"` (where `emailReg = form.register(...)`)\n * - dynamic: `v-register=\"form.register(`${prefix}.email`)\"`\n *\n * All three produce a `RegisterValue` at runtime, and the wrapper\n * doesn't need to know the path string. Setup-time `register()` calls\n * that are NEVER bound to `v-register` get no wrapper, no optimistic\n * mark, and stay `isConnected: false` post-hydration — exactly the\n * desired negative case (those calls don't represent a rendered DOM\n * element).\n *\n * Idempotent: if the transform runs twice on the same AST (some\n * bundler configurations do this), the second pass detects the marker\n * and skips re-wrapping.\n */\n\nconst HINT_MARKER = '__attaRv'\nconst HINT_PREFIX = `((${HINT_MARKER}) => (${HINT_MARKER}?.markConnectedOptimistically?.(), ${HINT_MARKER}))(`\nconst HINT_SUFFIX = `)`\n\n/**\n * Vue compiler node transform that wraps every `v-register`\n * expression in a small IIFE so the directive can flag a field as\n * connected during SSR. Eliminates the `false → true` flicker on\n * `getFieldState(path).isConnected` after hydration.\n *\n * Must run after `vRegisterPreambleTransform`. Wired automatically\n * by `attaform/vite` and `attaform/nuxt`.\n */\nexport const vRegisterHintTransform: NodeTransform = (node) => {\n try {\n if (node.type !== NodeTypes.ELEMENT) return\n for (const prop of node.props) {\n if (prop.type !== NodeTypes.DIRECTIVE) continue\n if (prop.name !== 'register') continue\n if (prop.exp === undefined) continue\n if (isAlreadyWrapped(prop.exp)) continue\n prop.exp = wrapWithOptimisticHint(prop.exp)\n }\n } catch (err) {\n // AST shape drift across @vue/compiler-core versions or a malformed\n // directive: skip this transform entirely. The runtime mark is\n // fail-safe — without the wrapper, we just get the existing\n // false→true flicker on first paint, never an incorrect render.\n console.error('[attaform] v-register hint transform failed, skipping:', err)\n }\n}\n\nfunction isAlreadyWrapped(exp: ExpressionNode): boolean {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {\n return exp.content.includes(HINT_MARKER)\n }\n // Compound expression: scan only the string children. Nested\n // SimpleExpressionNodes were copied verbatim from the user's\n // expression and won't contain our marker; the marker only ever\n // appears in the literal prefix/suffix strings we add.\n for (const child of exp.children) {\n if (typeof child === 'string' && child.includes(HINT_MARKER)) return true\n }\n return false\n}\n\nfunction wrapWithOptimisticHint(exp: ExpressionNode): CompoundExpressionNode {\n // For a SimpleExpression we keep the node intact as a child so any\n // later `processExpression` pass (identifier prefixing for setup\n // refs) still walks it. For a CompoundExpression we splice its\n // children in — prepending the prefix string and appending the\n // suffix preserves the post-prefix shape downstream transforms\n // expect.\n const innerChildren: CompoundExpressionNode['children'] =\n exp.type === NodeTypes.SIMPLE_EXPRESSION ? [exp] : [...exp.children]\n // Reuse the wrapped expression's source location — runtime errors\n // in the wrapped IIFE point at the v-register binding site rather\n // than line 0.\n return createCompoundExpression([HINT_PREFIX, ...innerChildren, HINT_SUFFIX], exp.loc)\n}\n","import {\n createSimpleExpression,\n NodeTypes,\n type DirectiveNode,\n type ElementNode,\n type ExpressionNode,\n type NodeTransform,\n type RootNode,\n type SimpleExpressionNode,\n} from '@vue/compiler-core'\n\n/**\n * `vRegisterPreambleTransform` — closes the render-order edge that\n * `vRegisterHintTransform` alone leaves open.\n *\n * The hint transform wraps each `v-register` directive expression in an\n * IIFE that calls `markConnectedOptimistically()` when the element's\n * vnode is created. That works for any expression evaluated AT or AFTER\n * the input in render order. But Vue's SSR is single-pass top-to-bottom,\n * so a template like:\n *\n * <pre>{{ form.fields.password.isConnected }}</pre>\n * <input v-register=\"form.register('password')\" />\n *\n * evaluates the `<pre>` first, BEFORE the v-register wrapper has had a\n * chance to fire. The serialized HTML carries `isConnected: false` for\n * password — and the post-hydration steady state shows `true`, leaving\n * a one-tick `false → true` flicker visible to the user.\n *\n * Fix: hoist the marks one level up. We walk the entire template AST,\n * collect every static `v-register` binding (skipping descendants of\n * `v-for`, since those reference loop locals not available at root\n * scope), and prepend a synthetic `:data-atta-pre-mark` directive on the\n * first root element. Vue evaluates element prop bindings before\n * recursing into children, so the IIFE inside `:data-atta-pre-mark` fires\n * every collected mark BEFORE any descendant template expression runs.\n *\n * The binding's expression resolves to `undefined`, which Vue's SSR\n * renderer drops (no `data-atta-pre-mark` attribute appears in the\n * rendered HTML). The side effect — flipping `isConnected: true` on\n * each field record — is the only output we want.\n *\n * Companion to `vRegisterHintTransform`: register both, with this one\n * BEFORE the hint transform. The pre-order pass here captures each\n * `v-register` expression's original (un-wrapped) text into a\n * per-template state map; the hint transform then wraps the in-place\n * directive expression. The exit hook on the first root element\n * builds the preamble using the captured originals — exit hooks on\n * an element fire before `transformElement`'s codegen exit, so the\n * injected prop lands in the rendered output.\n *\n * For `v-for` descendants the per-element wrapper from\n * `vRegisterHintTransform` is still load-bearing — those bindings can't\n * be hoisted because their path expressions reference loop-scoped\n * identifiers (e.g. `form.register(`item.${i}`)`).\n */\n\n/**\n * Per-root traversal state. Keyed by the RootNode object — stable for\n * the duration of one compile pass and GC-friendly across pipelines.\n * - `captured`: collected pre-wrap expression strings, in template\n * visit order.\n * - `vForDepth`: nesting count for `v-for` ancestry, bumped on FOR\n * entry / decremented on FOR exit, so element visits in between\n * can skip captures cheaply.\n * - `firstRootElementVisited`: ensures we only register the\n * injection exit-hook on the very first root element (templates\n * with multiple top-level elements still have one \"first\" — Vue\n * wraps multi-root in a fragment, but the FIRST element's props\n * evaluate before any sibling).\n */\ntype TraversalState = {\n readonly captured: string[]\n /**\n * Elements whose v-register binding has already been captured for\n * THIS root traversal. Guards against double-capture when the same\n * transform is registered twice in the `nodeTransforms` array (some\n * bundler chains do this) — without it, every binding's mark call\n * would be duplicated in the injected expression.\n */\n readonly capturedElements: WeakSet<ElementNode>\n vForDepth: number\n firstRootElementVisited: boolean\n}\nconst stateByRoot: WeakMap<RootNode, TraversalState> = new WeakMap()\n\nconst PREAMBLE_ATTR = 'data-atta-pre-mark'\n\n/**\n * Vue compiler node transform that hoists `v-register`'s SSR\n * connection marks to the root of the template. Together with\n * `vRegisterHintTransform`, ensures expressions earlier in the\n * template that read `getFieldState(path).isConnected` see the\n * correct value during the server's single-pass render.\n *\n * Must run before `vRegisterHintTransform`. Wired automatically\n * by `attaform/vite` and `attaform/nuxt`.\n */\nexport const vRegisterPreambleTransform: NodeTransform = (node, context) => {\n try {\n if (node.type === NodeTypes.ROOT) {\n // If state already exists, a duplicate registration of this\n // transform is at work — keep the first run's state intact.\n // Otherwise its captures would get wiped by this re-init.\n if (stateByRoot.has(node)) return\n stateByRoot.set(node, {\n captured: [],\n capturedElements: new WeakSet<ElementNode>(),\n vForDepth: 0,\n firstRootElementVisited: false,\n })\n return () => {\n // Cleanup on root exit. The actual injection happened on the\n // first root element's exit (registered below) — by the time\n // we get here, that element's transformElement codegen has\n // already absorbed the injected prop.\n stateByRoot.delete(node)\n }\n }\n\n const state = stateByRoot.get(context.root)\n if (state === undefined) return\n\n if (node.type === NodeTypes.FOR) {\n // The structural `transformFor` (built into compiler-core, runs\n // before our transform) wraps any element carrying v-for in a\n // NodeTypes.FOR node. Bumping the depth on entry / decrementing\n // on exit gives us O(1) \"am I inside a v-for ancestor?\" checks\n // during the element visits below.\n state.vForDepth += 1\n return () => {\n state.vForDepth -= 1\n }\n }\n\n if (node.type !== NodeTypes.ELEMENT) return\n\n // Capture this element's v-register binding (if any) BEFORE\n // deciding about exit-hook registration — that way the very first\n // root element, which itself might carry v-register, contributes\n // its binding to the preamble it hosts.\n captureVRegisterIfStatic(node, state)\n\n // First root element — register the exit hook that injects the\n // preamble using the FINAL collected state. Exit hooks fire after\n // children are traversed, so by then every descendant capture has\n // landed in `state.captured`.\n if (!state.firstRootElementVisited && context.parent?.type === NodeTypes.ROOT) {\n state.firstRootElementVisited = true\n return () => {\n const finalState = stateByRoot.get(context.root)\n if (finalState === undefined || finalState.captured.length === 0) return\n injectPreamble(node, finalState.captured)\n }\n }\n return\n } catch (err) {\n // AST shape drift or a malformed directive: skip this transform\n // entirely. The per-element vRegisterHintTransform still covers\n // the common case (read at-or-after the input). Failure here only\n // affects the read-before-input edge.\n console.error('[attaform] v-register preamble transform failed, skipping:', err)\n return\n }\n}\n\nfunction captureVRegisterIfStatic(node: ElementNode, state: TraversalState): void {\n if (state.vForDepth > 0) return\n // An element that itself carries v-for hasn't been wrapped yet by\n // transformFor at the moment user transforms see it (transform\n // ordering varies by bundler), so check the directive directly.\n if (hasVForDirective(node)) return\n // Idempotency: only one capture per element per root traversal.\n // Without this, registering the transform twice in the\n // `nodeTransforms` array would double every binding's mark call\n // inside the injected expression.\n if (state.capturedElements.has(node)) return\n\n const exp = findVRegisterExpression(node)\n if (exp === null) return\n state.capturedElements.add(node)\n // Pre-wrap capture. This transform is registered BEFORE\n // vRegisterHintTransform, so prop.exp is still the original\n // expression here; the hint's wrap happens after our pre-order\n // returns from the same node.\n state.captured.push(flattenExpression(exp))\n}\n\nfunction findVRegisterExpression(node: ElementNode): ExpressionNode | null {\n for (const prop of node.props) {\n if (prop.type !== NodeTypes.DIRECTIVE) continue\n if (prop.name !== 'register') continue\n if (prop.exp === undefined) continue\n return prop.exp\n }\n return null\n}\n\nfunction hasVForDirective(node: ElementNode): boolean {\n for (const prop of node.props) {\n if (prop.type === NodeTypes.DIRECTIVE && prop.name === 'for') return true\n }\n return false\n}\n\n/**\n * Flatten an ExpressionNode to its source text. The compiler-core AST\n * stores expressions either as a SimpleExpressionNode (one piece of\n * text) or a CompoundExpressionNode (a list of strings + nested\n * SimpleExpressionNodes interleaved, which is what `processExpression`\n * produces when prefixing identifiers). We can serialise either back\n * to source by concatenating the textual content.\n */\nfunction flattenExpression(exp: ExpressionNode): string {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) return exp.content\n let out = ''\n for (const child of exp.children) {\n if (typeof child === 'string') {\n out += child\n continue\n }\n if (typeof child === 'symbol') continue\n if ('content' in child) {\n out += child.content\n continue\n }\n out += flattenExpression(child as ExpressionNode)\n }\n return out\n}\n\n/**\n * Build and prepend the `:data-atta-pre-mark` directive to the element's\n * props. The expression is a comma-chain of\n * `(<expr>)?.markConnectedOptimistically?.()` calls, ending in\n * `undefined` so the attribute resolves to `undefined` and Vue's SSR\n * renderer omits it entirely. Side effects (the marks) happen during\n * evaluation; no observable HTML attribute appears.\n *\n * The exp is a SimpleExpressionNode with `isStatic: false` — when\n * `transformElement`'s exit codegen processes it, identifiers like\n * `form` get prefixed (`_ctx.form`) the same way every other dynamic\n * binding does. This works because our exit hook runs BEFORE\n * `transformElement`'s exit (we're registered later in the\n * `nodeTransforms` array, so our exit fires earlier in the reverse\n * pass).\n */\nfunction injectPreamble(element: ElementNode, captured: readonly string[]): void {\n if (hasPreamble(element)) return\n\n // Each entry is wrapped in a try/catch IIFE: the preamble is best-\n // effort optimisation (only matters for the read-before-input edge,\n // see the file header), and any throw inside one entry must not\n // prevent the rest from firing or break SSR. Common throw paths the\n // catch covers: a v-register against a null `ctx` (e.g. when\n // `injectForm` returned null and the input is gated by a v-if\n // the AST walker can't see — the v-if check fires later, so the\n // preamble would otherwise dereference null here).\n const callList = captured\n .map((source) => `(()=>{try{(${source})?.markConnectedOptimistically?.()}catch{}})()`)\n .join(', ')\n const expressionText = `(${callList}, undefined)`\n const exp: SimpleExpressionNode = createSimpleExpression(expressionText, false /* not static */)\n\n const directive: DirectiveNode = {\n type: NodeTypes.DIRECTIVE,\n name: 'bind',\n arg: createSimpleExpression(PREAMBLE_ATTR, true /* static arg */),\n exp,\n modifiers: [],\n // Reuse the host element's source location so any runtime error\n // in the synthesized expression points at the consumer's template\n // line, not at the dummyLoc that pre-fix was line 0.\n loc: element.loc,\n }\n element.props.unshift(directive)\n}\n\nfunction hasPreamble(element: ElementNode): boolean {\n for (const prop of element.props) {\n if (prop.type !== NodeTypes.DIRECTIVE) continue\n if (prop.name !== 'bind') continue\n if (prop.arg === undefined) continue\n if (prop.arg.type !== NodeTypes.SIMPLE_EXPRESSION) continue\n if (prop.arg.content === PREAMBLE_ATTR) return true\n }\n return false\n}\n"],"names":["getSummarizedProps","NodeTypes","key","value","renderAsStatic","getSummarizedPropValue","generateEqualityExpression","removePropsByName","isExactKey","registerSummarizedProp","elementValueSummarizedProp","createCompoundExpression","previousOptionExpressions","createSimpleExpression","ElementTypes","processExpression"],"mappings":";;;;AAkBA,SAASA,qBAAmB,IAAA,EAAoC;AAC9D,EAAA,IAAI,EAAE,OAAA,IAAW,IAAA,CAAA,EAAO,OAAO,EAAC;AAChC,EAAA,MAAM,QAAQ,IAAA,CAAK,KAAA;AA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M,QAAA,GAAW,QAAA,CACd,GAAA,CAAI,CAAC,MAAA,KAAW,cAAc,MAAM,CAAA,8CAAA,CAAgD,CAAA,CACpF,IAAA,CAAK,IAAI,CAAA;AACZ,EAAA,MAAM,cAAA,GAAiB,IAAI,QAAQ,CAAA,YAAA,CAAA;AACnC,EAAA,MAAM,GAAA,GAA4BY,mCAAA;AAAA,IAAuB,cAAA;AAAA,IAAgB;AAAA;AAAA,GAAsB;AAE/F,EAAA,MAAM,SAAA,GAA2B;AAAA,IAC/B,MAAMZ,sBAAA,CAAU,SAAA;AAAA,IAChB,IAAA,EAAM,MAAA;AAAA,IACN,GAAA,EAAKY,mCAAA;AAAA,MAAuB,aAAA;AAAA,MAAe;AAAA;AAAA,KAAqB;AAAA,IAChE,GAAA;AAAA,IACA,WAAW,EAAC;AAAA;AAAA;AAAA;AAAA,IAIZ,KAAK,OAAA,CAAQ;AAAA,GACf;AACA,EAAA,OAAA,CAAQ,KAAA,CAAM,QAAQ,SAAS,CAAA;AACjC;AAEA,SAAS,YAAY,OAAA,EAA+B;AAClD,EAAA,KAAA,MAAW,IAAA,IAAQ,QAAQ,KAAA,EAAO;AAChC,IAAA,IAAI,IAAA,CAAK,IAAA,KAASZ,sBAAA,CAAU,SAAA,EAAW;AACvC,IAAA,IAAI,IAAA,CAAK,SAAS,MAAA,EAAQ;AAC1B,IAAA,IAAI,IAAA,CAAK,QAAQ,MAAA,EAAW;AAC5B,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,IAAA,KAASA,sBAAA,CAAU,iBAAA,EAAmB;AACnD,IAAA,IAAI,IAAA,CAAK,GAAA,CAAI,OAAA,KAAY,aAAA,EAAe,OAAO,IAAA;AAAA,EACjD;AACA,EAAA,OAAO,KAAA;AACT;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"attaform.Bubm_slq.cjs","sources":["../../src/runtime/lib/core/transforms/input-text-area-transform.ts","../../src/runtime/lib/core/transforms/select-transform.ts","../../src/runtime/lib/core/transforms/v-register-hint-transform.ts","../../src/runtime/lib/core/transforms/v-register-preamble-transform.ts"],"sourcesContent":["import type {\n AttributeNode,\n CompoundExpressionNode,\n DirectiveNode,\n ExpressionNode,\n NodeTransform,\n PlainElementNode,\n RootNode,\n SourceLocation,\n TemplateChildNode,\n} from '@vue/compiler-core'\nimport { createCompoundExpression, NodeTypes } from '@vue/compiler-core'\n\ntype SummarizedProp = {\n key: string\n value: string | CompoundExpressionNode['children']\n}\n\nfunction getSummarizedProps(node: RootNode | TemplateChildNode) {\n if (!('props' in node)) return []\n const props = node.props\n\n const summarizedProps = props.reduce<SummarizedProp[]>((acc, currProp) => {\n if (currProp.type === NodeTypes.ATTRIBUTE) {\n const key = currProp.name\n const value = currProp.value?.content ?? ''\n return [...acc, { key, value: renderAsStatic(value, true) }]\n }\n\n if (currProp.exp === undefined) return acc\n const key = currProp.arg\n ? getSummarizedPropValue(currProp.arg)\n : renderAsStatic(currProp.name, true)\n if (typeof key !== 'string') return acc // key must always be a string\n const value = getSummarizedPropValue(currProp.exp)\n\n return [...acc, { key, value }]\n }, [])\n\n return summarizedProps\n}\n\nfunction renderAsStatic(val: string, isStatic: boolean) {\n return isStatic ? `\"${val}\"` : val\n}\n\nfunction getSummarizedPropValue(exp: ExpressionNode): SummarizedProp['value'] {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {\n return renderAsStatic(exp.content, exp.isStatic)\n }\n\n return exp.children\n}\n\nfunction generateEqualityExpression(\n registerValue: SummarizedProp['value'],\n optionValue: SummarizedProp['value'],\n scalarTarget: SummarizedProp['value']\n): CompoundExpressionNode['children'] {\n const registerValueArr = Array.isArray(registerValue) ? registerValue : [registerValue]\n const optionValueArr = Array.isArray(optionValue) ? optionValue : [optionValue]\n const scalarTargetArr = Array.isArray(scalarTarget) ? scalarTarget : [scalarTarget]\n\n // Discriminator selection:\n // - Array model → membership of the option-value (e.g. value=\"apple\")\n // - Set model → membership of the option-value\n // - Scalar model → equality with the scalar-equality target\n //\n // The scalar target differs from the option-value for two checkbox\n // shapes that the directive's runtime `setChecked` already handles\n // via `getCheckboxValue(el, true)`:\n //\n // - boolean model + no `value=` → target is `true`\n // - string model + `:true-value=\"'X'\"` → target is `'X'`\n //\n // For radio inputs the model is always scalar and the discriminator\n // IS the option-value, so `optionValue === scalarTarget` there.\n return [\n 'Array.isArray((',\n ...registerValueArr,\n ')?.innerRef?.value) ? ',\n '(',\n ...registerValueArr,\n ')?.innerRef?.value?.includes(',\n ...optionValueArr,\n ') : ',\n '(',\n ...registerValueArr,\n ')?.innerRef?.value instanceof Set ? (',\n ...registerValueArr,\n ')?.innerRef?.value?.has(',\n ...optionValueArr,\n ') : ',\n '((',\n ...registerValueArr,\n ')?.innerRef?.value === (',\n ...scalarTargetArr,\n '))',\n ]\n}\n\nfunction removePropsByName(props: (AttributeNode | DirectiveNode)[], propNames: string[]) {\n const removePropIndices: number[] = []\n for (let index = 0; index < props.length; index++) {\n const prop = props[index]\n if (!prop) continue\n\n if (\n propNames.includes(prop.name) ||\n ('arg' in prop && prop.arg && 'content' in prop.arg && propNames.includes(prop.arg.content))\n ) {\n removePropIndices.push(index) // store index to remove later, don't mutate variable while looping through it\n }\n }\n\n for (const index of removePropIndices.sort((a, z) => z - a)) {\n props.splice(index, 1) // index runs from high to low, so this works\n }\n}\n\n// Exact prop-name match. Pre-rewrite used .includes('register') / .includes('value') /\n// .includes('type') which false-positived on any user prop whose name contained those\n// substrings (e.g. `data-register-id`, `valueFoo`, `prototype`, `:registerField`).\nfunction isExactKey(summarizedKey: string, name: string): boolean {\n // Summarized keys come in three shapes depending on prop type:\n // attribute -> \"name\" (from getSummarizedProps)\n // v-bind:name=\"x\" -> \"\\\"name\\\"\" (quoted via renderAsStatic)\n // static v-prefix -> \"\\\"name\\\"\"\n return summarizedKey === name || summarizedKey === `\"${name}\"`\n}\n\n/**\n * Returns true iff the type prop's value is the static-attribute literal\n * matching one of `names` (case-insensitive). Used to detect static\n * `type=\"checkbox\"` / `type=\"radio\"` shapes where the `value` attribute\n * is the option-value (a discriminator within the group), not display\n * state — so the transform must NOT strip it.\n *\n * Conservative on dynamic shapes — `:type=\"x\"` returns false, falling\n * through to the text-input branch which strips `value`. Authors using\n * dynamic types between checkbox/radio and text are rare; if they hit\n * this they can add a static `type=` to lock the shape.\n */\nfunction isStaticTypeOneOf(value: SummarizedProp['value'], names: readonly string[]): boolean {\n if (Array.isArray(value)) return false\n const trimmed = value.trim()\n const literalMatch = /^([\"'`])(.*)\\1$/.exec(trimmed)\n if (literalMatch === null) return false\n const inner = (literalMatch[2] as string).toLowerCase()\n return names.includes(inner)\n}\n\n/**\n * Returns true if the type prop's value MIGHT resolve to \"file\" at runtime.\n * Conservative — anything not provably non-\"file\" returns true so the caller\n * skips the transform.\n *\n * Concretely:\n * - `type=\"text\"` → value is `'\"text\"'` → false (static literal != \"file\")\n * - `type=\"file\"` → value is `'\"file\"'` → true (static \"file\")\n * - `:type=\"'text'\"`→ value is `\"'text'\"` → false\n * - `:type=\"'file'\"`→ value is `\"'file'\"` → true\n * - `:type=\"kind\"` → value is `'kind'` → true (dynamic identifier)\n * - `:type=\"`a-${x}`\"` → array or template lit → true (compound expression)\n */\nfunction couldResolveToFileType(value: SummarizedProp['value']): boolean {\n if (Array.isArray(value)) return true\n const trimmed = value.trim()\n // Match a one-line JS string literal: '...', \"...\", or `...`. Doesn't\n // attempt to handle escaped quotes inside the literal — a `type` prop\n // containing escaped quotes is vanishingly rare and falling through to\n // \"could be file\" here is the safe direction anyway.\n const literalMatch = /^([\"'`])(.*)\\1$/.exec(trimmed)\n if (literalMatch === null) return true // dynamic expression — can't prove safe\n const quote = literalMatch[1] as string\n const inner = literalMatch[2] as string\n // Template literals with interpolations resolve at runtime.\n if (quote === '`' && inner.includes('${')) return true\n // The HTML spec matches `type` ASCII case-insensitively, so\n // `<input type=\"FILE\">` behaves identically to `<input type=\"file\">`.\n // Compare lower-cased so we catch both.\n return inner.toLowerCase() === 'file'\n}\n\n/**\n * Vue compiler node transform for `<input v-register>` and\n * `<textarea v-register>`. Injects the `:value` / `:checked`\n * bindings required for SSR-correct initial render.\n *\n * Wired automatically by `attaform/vite` and\n * `attaform/nuxt`. Use directly only when integrating with\n * a custom bundler.\n */\nexport const inputTextAreaNodeTransform: NodeTransform = (node) => {\n try {\n if (node.type !== NodeTypes.ELEMENT) return\n\n const isInput = node.tag === 'input'\n const isTextArea = node.tag === 'textarea'\n\n if (!isInput && !isTextArea) return\n\n const elementProps = getSummarizedProps(node)\n\n const registerIndex = elementProps.findIndex((p) => isExactKey(p.key, 'register'))\n const registerSummarizedProp = elementProps[registerIndex]\n if (!registerSummarizedProp) return // no v-register directive; nothing to transform\n\n // <input type=\"file\" v-register=\"...\"> silently skipped — at runtime the\n // directive routes to a no-op variant. Trying to set el.value on a file\n // input throws a DOMException for security reasons. We must skip not just\n // the static type=\"file\" case but any dynamic binding (`:type=\"x\"`,\n // template-literal expressions, etc.) that COULD resolve to \"file\" at\n // runtime — `couldResolveToFileType` errs on the conservative side.\n const typeIndex = elementProps.findIndex((p) => isExactKey(p.key, 'type'))\n const typeProp = elementProps[typeIndex]\n if (typeProp !== undefined && couldResolveToFileType(typeProp.value)) return\n\n const valueIndex = elementProps.findIndex((p) => isExactKey(p.key, 'value'))\n const elementValueSummarizedProp = elementProps?.[valueIndex] ?? {\n key: 'value',\n value: \"''\",\n }\n\n const inputTypeIndex = typeIndex\n\n const defaultSummarizedTextProp = { key: 'type', value: \"'text'\" }\n const inputTypeSummarizedProp: SummarizedProp =\n inputTypeIndex === -1\n ? defaultSummarizedTextProp\n : (elementProps[inputTypeIndex] ?? defaultSummarizedTextProp)\n const inputTypeExpressionArray =\n typeof inputTypeSummarizedProp.value === 'string'\n ? [inputTypeSummarizedProp.value]\n : inputTypeSummarizedProp.value\n\n // this gets paired with `value` to get the [selectionLabel]=[label] prop for the given input\n // checkbox and radio are marked as selected via `checked`, others typically use `value`\n //\n // The HTML spec matches `type` ASCII case-insensitively, so\n // `<input type=\"CHECKBOX\">` and `<input type=\"Radio\">` produce the\n // same runtime element as their lowercase counterparts. The\n // injected expression normalizes via `String(t).toLowerCase()`\n // before comparing — the compile-time `isStaticTypeOneOf` already\n // uses case-insensitive matching, so without the runtime\n // normalization a `type=\"CHECKBOX\"` input would have its static\n // `value` preserved (per `keepStaticValue`) but still emit\n // `:value=\"...\"` instead of `:checked=\"...\"`, breaking SSR initial\n // checked state.\n const elementSelectionLabelExpression = createCompoundExpression([\n '(',\n 'String((',\n ...inputTypeExpressionArray,\n ')).toLowerCase()',\n \" === 'checkbox' || \",\n 'String((',\n ...inputTypeExpressionArray,\n \")).toLowerCase() === 'radio'\",\n \") ? 'checked' : 'value'\",\n ])\n\n // Narrowed from `PlainElementNode | ComponentNode | SlotOutletNode |\n // TemplateNode` — `<input>` / `<textarea>` are always PlainElementNode\n // in Vue's AST. The previous wide union let a TemplateNode slip\n // through and crash on `_node.props`.\n function computeProps(\n _node: PlainElementNode,\n registerSummarizedProp: SummarizedProp,\n elementValueSummarizedProp: SummarizedProp\n ): void {\n // Reuse the originating element's source location for the\n // injected directive — runtime errors in the synthesized expression\n // get reported at the v-register binding site rather than line 0.\n const injectedLoc: SourceLocation = _node.loc\n\n const props = _node.props\n // For statically-typed checkbox / radio inputs, the `value=`\n // attribute is the OPTION-value (the discriminator the directive\n // matches against the model), not display state. The synthesized\n // binding below resolves to `:checked=\"...\"` for those types, a\n // different attribute key — so the static `value` survives\n // alongside it without conflict. Stripping it (as we still do\n // for text/textarea, where the synthesized binding resolves to\n // `:value`) leaves the SSR HTML without the attribute, and on\n // hydration the directive can't tell which option this checkbox\n // represents.\n const isStaticCheckbox =\n typeProp !== undefined && isStaticTypeOneOf(typeProp.value, ['checkbox'])\n const isStaticRadio = typeProp !== undefined && isStaticTypeOneOf(typeProp.value, ['radio'])\n const keepStaticValue = isStaticCheckbox || isStaticRadio\n removePropsByName(props, keepStaticValue ? ['checked'] : ['checked', 'value'])\n const registerValueArr = Array.isArray(registerSummarizedProp.value)\n ? registerSummarizedProp.value\n : [registerSummarizedProp.value]\n // Read `displayValue.value` rather than `innerRef.value` so the\n // `:value` binding renders the blank `''` when the\n // user clears a numeric field. `displayValue` returns\n // `String(storage)` for non-empty storage and `''` for both\n // null/undefined storage and paths in the form's\n // `blankPaths` set — a single read surface for the\n // injected expression. For checkbox / radio (the ternary's\n // truthy branch above), this leg is unreached, so behaviour\n // there is unchanged.\n const valueExpression = createCompoundExpression([\n '(',\n ...registerValueArr,\n ')?.displayValue?.value',\n ])\n\n // Scalar-equality target. Three cases (see the long-form comment\n // on `generateEqualityExpression`):\n // - static checkbox + `:true-value=\"X\"` → X (the explicit\n // mapped string the model takes when checked)\n // - static checkbox without `:true-value` → boolean `true`\n // (matches the runtime's `getCheckboxValue(el, true)` default)\n // - static radio → the option-value (since radio model is\n // always scalar and the `value=` IS the discriminator)\n // - dynamic type → fall back to the option-value (current\n // behaviour); a dynamic-type element can't be statically\n // classified into checkbox vs radio vs text.\n const trueValueIndex = elementProps.findIndex((p) => isExactKey(p.key, 'true-value'))\n const trueValueProp = elementProps[trueValueIndex]\n const scalarTarget: SummarizedProp['value'] = isStaticCheckbox\n ? trueValueProp !== undefined\n ? trueValueProp.value\n : 'true'\n : elementValueSummarizedProp.value\n\n const valueOrCheckedProp: DirectiveNode = {\n // reconstruct the `value` attribute based on the provided v-registerer, now that the computation is complete\n arg: elementSelectionLabelExpression,\n exp: createCompoundExpression([\n '(',\n ...elementSelectionLabelExpression.children,\n \") === 'checked' ? (\",\n // resolves to a boolean\n ...generateEqualityExpression(\n registerSummarizedProp.value,\n elementValueSummarizedProp.value,\n scalarTarget\n ),\n ') : (',\n // resolves to the provided register value\n ...valueExpression.children,\n ')',\n ]),\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: injectedLoc,\n }\n\n props.push(valueOrCheckedProp)\n }\n\n // The outer guards (`node.type === NodeTypes.ELEMENT` + `node.tag\n // === 'input' | 'textarea'`) narrow `node` to a PlainElementNode\n // at runtime; the cast records that for the type system.\n computeProps(node as PlainElementNode, registerSummarizedProp, elementValueSummarizedProp)\n } catch (err) {\n // AST shapes can shift with minor Vue compiler updates. If we hit\n // anything unexpected, skip this transform — the runtime directive\n // alone handles value binding (via mounted/beforeUpdate), so the only\n // cost is a one-frame flash on SSR initial render.\n\n console.error('[attaform] input/textarea transform failed, skipping:', err)\n }\n}\n","import {\n createCompoundExpression,\n createSimpleExpression,\n ElementTypes,\n NodeTypes,\n processExpression,\n type AttributeNode,\n type CompoundExpressionNode,\n type DirectiveNode,\n type ExpressionNode,\n type NodeTransform,\n type RootNode,\n type SourceLocation,\n type TemplateChildNode,\n} from '@vue/compiler-core'\n\ntype SummarizedProp = {\n key: string\n value: string | CompoundExpressionNode['children']\n}\n\nfunction getSummarizedProps(node: RootNode | TemplateChildNode) {\n if (!('props' in node)) return []\n const props = node.props\n\n const summarizedProps = props.reduce<SummarizedProp[]>((acc, currProp) => {\n if (currProp.type === NodeTypes.ATTRIBUTE) {\n const key = currProp.name\n const value = currProp.value?.content ?? ''\n return [...acc, { key, value: renderAsStatic(value, true) }]\n }\n\n if (currProp.exp === undefined) return acc\n const key = currProp.arg\n ? getSummarizedPropValue(currProp.arg)\n : renderAsStatic(currProp.name, true)\n if (typeof key !== 'string') return acc // key must always be a string\n const value = getSummarizedPropValue(currProp.exp)\n\n return [...acc, { key, value }]\n }, [])\n\n return summarizedProps\n}\n\nfunction renderAsStatic(val: string, isStatic: boolean) {\n return isStatic ? `\"${val}\"` : val\n}\n\nfunction getSummarizedPropValue(exp: ExpressionNode): SummarizedProp['value'] {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {\n return renderAsStatic(exp.content, exp.isStatic)\n }\n\n return exp.children\n}\n\nfunction generateEqualityExpression(\n selectValue: SummarizedProp['value'],\n optionValue: SummarizedProp['value'],\n previousOptionExpressions: CompoundExpressionNode['children'][]\n) {\n function getExpressionNodeChildren(\n _selectValue: SummarizedProp['value'],\n _optionValue: SummarizedProp['value'],\n _previousOptionExpressions: CompoundExpressionNode['children'][]\n ): CompoundExpressionNode['children'] {\n const multipleExpression = _previousOptionExpressions?.[0] // this should always exist\n if (multipleExpression === undefined) {\n // this should NEVER happen\n throw new Error(\n 'Programming error: `multiple` expression for `select` node not generated while transforming AST'\n )\n }\n\n const optExpressions = _previousOptionExpressions.slice(1)\n\n // for `multiple`=\"false\", we ONLY execute latest expression if all past expressions were falsy\n const noMultipleOptExpressions = optExpressions.reduce<CompoundExpressionNode['children']>(\n (acc, curr, index) => {\n if (index === 0) {\n acc.push('(')\n }\n\n acc.push(...curr) // all expressions from last operation were grouped into an array\n if (index < optExpressions.length - 1) {\n acc.push(' || ')\n }\n\n if (index === optExpressions.length - 1) {\n acc.push(')')\n }\n\n return acc\n },\n []\n )\n\n const selectValueArr = Array.isArray(_selectValue) ? _selectValue : [_selectValue]\n const optionValueArr = Array.isArray(_optionValue) ? _optionValue : [_optionValue]\n\n function getImplicitTrueMultipleExpression(expression: CompoundExpressionNode['children']) {\n // Identify user passing in `multiple` as an implied truthy prop\n if (expression.length === 1 && expression[0] === '') return [`true`]\n return expression\n }\n\n // capture the current expression for the next round\n _previousOptionExpressions.push(['(', ...selectValueArr, ') === (', ...optionValueArr, ')'])\n // Single-select branch String-coerces both sides to mirror the\n // runtime directive's `looseEqual`-style match — a typed-numeric\n // model (`z.number()`) matches `<option value=\"1\">` at SSR time.\n // The `typeof !== 'object'` guard preserves the pre-existing\n // \"array model on a single-select doesn't match\" behaviour: an\n // array stringifies to its joined elements, which would otherwise\n // false-positive against a single-element option.\n // The multi-select branch keeps `innerRef.value` because Array\n // / Set models need findIndex / membership iteration.\n if (!noMultipleOptExpressions.length) {\n return [\n '(',\n ...getImplicitTrueMultipleExpression(multipleExpression),\n `) ? ((`,\n ...selectValueArr,\n `)?.innerRef?.value?.findIndex?.(el => el === (`,\n ...optionValueArr,\n `)) > -1) : (typeof (`,\n ...selectValueArr,\n `)?.innerRef?.value !== 'object' && String((`,\n ...selectValueArr,\n `)?.innerRef?.value) === String((`,\n ...optionValueArr,\n `)))`,\n ]\n }\n\n return [\n '(',\n ...getImplicitTrueMultipleExpression(multipleExpression),\n `) ? ((`,\n ...selectValueArr,\n `)?.innerRef?.value?.findIndex?.(el => el === (`,\n ...optionValueArr,\n `)) > -1) : ((`,\n ...noMultipleOptExpressions, // if true, we already found the relevant option\n `) ? false : (typeof (`,\n ...selectValueArr,\n `)?.innerRef?.value !== 'object' && String((`,\n ...selectValueArr,\n `)?.innerRef?.value) === String((`,\n ...optionValueArr,\n `))))`,\n ]\n }\n\n return getExpressionNodeChildren(selectValue, optionValue, previousOptionExpressions)\n}\n\nfunction extractMultipleFromSelectSummarizedProps(\n props: SummarizedProp[]\n): SummarizedProp['value'] {\n const multipleDirectiveIndex = props.findIndex(\n (prop) => prop.key.replace(/\"/g, `'`) === \"'multiple'\"\n )\n const multipleAttributeIndex = props.findIndex((prop) => prop.key === 'multiple')\n\n if (multipleDirectiveIndex === -1 && multipleAttributeIndex === -1) {\n return 'false'\n }\n const priorityIndex =\n multipleDirectiveIndex >= 0 ? multipleDirectiveIndex : multipleAttributeIndex\n const value = props[priorityIndex]?.value\n\n // attempt to convert expression within string into boolean\n // if undefined, make value `true` because of `<input multiple />` usage\n return typeof value === 'string' ? value.replace(/'|\"/g, '') : (value ?? 'true')\n}\n\nfunction removePropsByName(props: (AttributeNode | DirectiveNode)[], propNames: string[]) {\n const removePropIndices: number[] = []\n for (let index = 0; index < props.length; index++) {\n const prop = props[index]\n if (!prop) continue\n\n if (\n propNames.includes(prop.name) ||\n ('arg' in prop && prop.arg && 'content' in prop.arg && propNames.includes(prop.arg.content))\n ) {\n removePropIndices.push(index) // store index to remove later, don't mutate variable while looping through it\n }\n }\n\n for (const index of removePropIndices.sort((a, z) => z - a)) {\n props.splice(index, 1) // index runs from high to low, so this works\n }\n}\n\nfunction flattenCompoundExpression(node: CompoundExpressionNode): string {\n let result = ''\n\n for (const child of node.children) {\n if (typeof child === 'string') {\n result += child\n } else if (typeof child === 'symbol') {\n continue\n } else if (child.type === NodeTypes.SIMPLE_EXPRESSION) {\n result += child.content\n } else if (child.type === NodeTypes.COMPOUND_EXPRESSION) {\n result += flattenCompoundExpression(child)\n }\n }\n\n return result\n}\n\n// Exact prop-name match. Pre-rewrite used .includes('register') / .includes('value')\n// which false-positived on user props with those substrings in their names.\nfunction isExactKey(summarizedKey: string, name: string): boolean {\n return summarizedKey === name || summarizedKey === `\"${name}\"`\n}\n\n// Whitelist of node types that contain iterable child nodes. Used by\n// traverseSelectNode so we don't recurse into interpolation / comment / text\n// nodes (which have no `children` in the traversal sense) and don't crash on\n// future Vue node-type additions.\nconst RECURSABLE_NODE_TYPES: ReadonlySet<number> = new Set<number>([\n NodeTypes.ELEMENT,\n NodeTypes.FOR,\n NodeTypes.IF,\n NodeTypes.IF_BRANCH,\n])\n\n// Native form-shell tags excluded from the kebab-case extension. The\n// hyphen check on `node.tag` already excludes most native HTML tags\n// (which have no hyphen), but listing the form-shell ones explicitly\n// documents the conservative stance: even if a future native tag like\n// `<my-form-something>` lands, it won't accidentally collide with a\n// custom-element transform branch. `<input>`, `<select>`, `<textarea>`\n// already have dedicated branches via inputTextAreaNodeTransform and\n// the isSelect path above; the others (form, fieldset, label, button,\n// option) carry no meaningful v-register binding and shouldn't be\n// rewritten with component-style props.\nconst NATIVE_FORM_TAGS: ReadonlySet<string> = new Set<string>([\n 'input',\n 'textarea',\n 'select',\n 'option',\n 'form',\n 'fieldset',\n 'label',\n 'button',\n])\n\n/**\n * Synthesise a static value for `<option>foo</option>` (no `value=`\n * attr). Returns the text content as a single-quoted JS string literal\n * so the equality check rendered into the AST treats it as a string.\n *\n * Returns:\n * - quoted-string `\"'apple'\"` for a single static text child,\n * - `null` for mixed / dynamic / empty children — caller skips the\n * binding rather than synthesise a guess.\n *\n * The HTML spec says an option's value defaults to its descendant\n * text. We restrict to \"single static text node\" to keep the\n * code-path safe: handling interpolation correctly would need a\n * wrapped runtime expression, which we can't emit at compile time\n * without leaking runtime references that may not exist in the\n * template's binding scope.\n */\nfunction inferOptionValueFromChildren(node: TemplateChildNode | RootNode): string | null {\n if (!('children' in node)) return null\n const children = node.children\n if (children.length !== 1) return null\n const only = children[0]\n if (only === undefined) return null\n if (typeof only === 'string' || typeof only === 'symbol') return null\n if (only.type !== NodeTypes.TEXT) return null\n // Mirror Vue's option-value semantic: trim leading/trailing whitespace\n // so `<option> apple </option>` matches a model value of `'apple'`.\n const text = only.content.trim()\n // Emit a fully escaped JS string literal — `JSON.stringify` covers\n // backslashes, quotes, and line terminators (`\\n`, `\\r`, U+2028,\n // U+2029) so the synthesized literal stays single-line and valid.\n return JSON.stringify(text)\n}\n\n/**\n * Vue compiler node transform for `<select v-register>` and any\n * component that wraps a select. Injects the `:value` /\n * `:registerValue` bridge bindings the runtime directive needs to\n * pre-mark selected options at SSR time.\n *\n * Wired automatically by `attaform/vite` and\n * `attaform/nuxt`. Use directly only when integrating with\n * a custom bundler.\n */\nexport const selectNodeTransform: NodeTransform = (node, context) => {\n // Snapshot every prop array we're about to mutate so a throw\n // mid-traversal rewinds to the pre-transform state. Without this,\n // a partial transform leaves the template with some `<option\n // :selected>` bindings rewritten and others not — worse than\n // skipping the transform entirely, since the runtime directive\n // would then miscompute initial state against a shape it doesn't\n // recognise. `snapshotProps` is idempotent per target; calling\n // twice records one snapshot.\n type NodeProps = (AttributeNode | DirectiveNode)[]\n const snapshots: Array<{ target: NodeProps; snapshot: NodeProps }> = []\n const snapshotProps = (target: NodeProps): void => {\n if (snapshots.some((entry) => entry.target === target)) return\n snapshots.push({ target, snapshot: [...target] })\n }\n try {\n const isSelect = node.type === NodeTypes.ELEMENT && node.tag === 'select'\n const isCustomComponent =\n node.type === NodeTypes.ELEMENT && node.tagType === ElementTypes.COMPONENT\n // Kebab-case tags (those with a hyphen, like `<my-input>`) compile\n // as `tagType === ElementTypes.ELEMENT` — Vue's compiler can't tell\n // statically whether the tag will resolve to an `app.component`\n // registration or to a user-supplied `compilerOptions.isCustomElement`\n // predicate, so it emits an element creation that the runtime\n // disambiguates. The transform fires the bridge prop injection on\n // these tags too: a kebab-case Vue component sees `useRegister`\n // work in its setup; a real Web Component sees `:value` /\n // `:registerValue` as DOM attributes (the documented `assignKey`\n // escape hatch handles that interop).\n //\n // NATIVE_FORM_TAGS keeps the conservative stance: only inject on\n // tags Vue would NEVER treat as a component. The hyphen check\n // already excludes most native HTML tags (which have no hyphen);\n // the explicit list documents the contract and guards against\n // hypothetical future native form tags with hyphens.\n const isKebabCustomElement =\n node.type === NodeTypes.ELEMENT &&\n node.tagType === ElementTypes.ELEMENT &&\n node.tag.includes('-') &&\n !NATIVE_FORM_TAGS.has(node.tag)\n\n if (!(isSelect || isCustomComponent || isKebabCustomElement)) return\n\n const selectSummarizedProps = getSummarizedProps(node)\n\n const registerIndex = selectSummarizedProps.findIndex((p) => isExactKey(p.key, 'register'))\n if (\n selectSummarizedProps.length === 0 ||\n registerIndex < 0 ||\n registerIndex >= selectSummarizedProps.length\n )\n return\n\n const registerSummarizedProp = selectSummarizedProps[registerIndex]\n\n // Inject location matches the originating element so source maps\n // for runtime errors in the synthesized expressions point at the\n // user's <select v-register=...> rather than line 0.\n const selectLoc: SourceLocation = node.loc\n\n function traverseSelectNode(\n _node: RootNode | TemplateChildNode,\n previousOptionExpressions: CompoundExpressionNode['children'][]\n ): void {\n const isOption = _node.type === NodeTypes.ELEMENT && _node.tag === 'option'\n if (!isOption) {\n // Only recurse into node types that genuinely hold iterable children.\n // Text / interpolation / comment nodes are skipped; future Vue node\n // types that we don't know about are also skipped rather than\n // crashing on a shape we didn't expect.\n if (!RECURSABLE_NODE_TYPES.has(_node.type)) return\n const hasChildren = 'children' in _node\n if (!hasChildren) return\n for (const child of _node.children) {\n if (typeof child === 'symbol' || typeof child === 'string') continue\n if (child.type === NodeTypes.SIMPLE_EXPRESSION) continue\n traverseSelectNode(child, previousOptionExpressions)\n }\n return\n }\n\n const optionProps = getSummarizedProps(_node)\n const valueIndex = optionProps.findIndex((p) => isExactKey(p.key, 'value'))\n\n // D3: HTML lets `<option>apple</option>` use text content as the\n // value. The original transform required an explicit `value=`\n // attr and silently dropped value-less options — they'd render\n // unselectable through `register('fruit')` because the AST\n // emitted no `:selected` binding.\n //\n // Fallback: if no `value=`, look at the option's children. A\n // single static TextNode → use it as the static value. Anything\n // else (interpolation, mixed children, no children) → skip with\n // a dev-warn rather than guess.\n let optionValueSummarizedProp: SummarizedProp | undefined\n if (valueIndex >= 0 && valueIndex < optionProps.length) {\n optionValueSummarizedProp = optionProps[valueIndex]\n } else {\n const fallback = inferOptionValueFromChildren(_node)\n if (fallback === null) {\n // Dynamic / mixed children — can't synthesize a static\n // equality expression. Bail without binding so the option\n // simply isn't reactive (matches pre-D3 behaviour for the\n // genuinely-dynamic cases). Producing a wrong binding would\n // be worse than no binding.\n return\n }\n optionValueSummarizedProp = { key: 'value', value: fallback }\n }\n\n const props = _node.props\n snapshotProps(props)\n removePropsByName(props, ['selected'])\n\n const newProp: DirectiveNode = {\n arg: createSimpleExpression('selected', true),\n exp: createCompoundExpression(\n generateEqualityExpression(\n registerSummarizedProp?.value ?? 'undefined',\n optionValueSummarizedProp?.value ?? 'undefined',\n previousOptionExpressions\n )\n ),\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: _node.loc,\n }\n props.push(newProp)\n }\n\n const multipleExpression = extractMultipleFromSelectSummarizedProps(selectSummarizedProps)\n\n const previousOptionExpressions: CompoundExpressionNode['children'][] =\n typeof multipleExpression === 'string' ? [[multipleExpression]] : [multipleExpression]\n\n // Multi-select hydration trap. Setting `select.value = X` on a\n // `<select multiple>` runs the spec's value-setter loop: for each\n // option, set selectedness to (option.value === X). For an array\n // model, `displayValue.value` resolves to `String(arr)` —\n // `\"red,blue\"` — which matches NO option's value, so the patch\n // DESELECTS every option (including the SSR-selected ones the\n // per-option `:selected` injection just placed). At runtime the\n // directive's `setSelected` re-syncs from the model, but the value\n // patch + the directive's identity-skip path can leave the DOM\n // stuck deselected if the model hasn't moved since the last apply.\n //\n // Per-option `:selected` bindings are the canonical mechanism for\n // multi-select initial state — the runtime directive's setSelected\n // mirrors exactly the same logic on the client. The select-level\n // `:value` adds nothing for multi: it's only useful as Vue's\n // single-select `value` patch shorthand, which is benign there\n // (`select.value = \"1\"` selects the matching option, a no-op when\n // it's already selected via `<option selected>`).\n //\n // Conservative gate: skip `:value` whenever `multiple` isn't\n // statically false. Static `<select>` and static `<select\n // multiple=\"false\">` keep the injection (`extractMultipleFromSelect…`\n // returns the literal string `'false'` for both). Anything else —\n // static `multiple`, `multiple=\"true\"`, or a dynamic `:multiple`\n // expression we can't evaluate at compile time — skips. The\n // dynamic case is rare; trading SSR `value=` on the select for\n // hydration correctness is the right call.\n const isStaticallyNonMultiple = multipleExpression === 'false'\n\n const selectProps = node.props\n snapshotProps(selectProps)\n removePropsByName(selectProps, ['value']) // actively prevent an attribute collision\n\n if (isStaticallyNonMultiple) {\n // construct `:value` dynamic prop based on the existing `v-register` directive\n const valuePropExpArray = Array.isArray(registerSummarizedProp?.value)\n ? registerSummarizedProp.value\n : [registerSummarizedProp?.value ?? 'undefined']\n // Read `displayValue.value` rather than `innerRef.value` so\n // selects share the same single read surface as text inputs.\n // The directive never marks select paths blank (no\n // DOM \"empty\" state), so in normal flow `displayValue` is just\n // `String(storage)` — identical to today. The edge case where a\n // consumer programmatically calls `setValue(numericPath, unset)`\n // bound to a `<select>` is documented in the docs (browser falls\n // back to first option; meta.blank surfaces the intent).\n const initExpression = createCompoundExpression([\n '(',\n ...valuePropExpArray,\n ')?.displayValue.value',\n ])\n\n const simpleExpression = createSimpleExpression(\n flattenCompoundExpression(initExpression),\n false\n )\n // `processExpression` can throw on malformed identifiers or\n // exotic expression shapes. Pre-fix, the throw bubbled to the\n // outer try/catch, which then ran the snapshot-restore path AND\n // skipped both the select's `:value` injection AND every option's\n // `:selected` binding — turning a single-expression problem into\n // a whole-template fallback. Isolate here so a parser failure on\n // this one expression keeps the other injections.\n let outputExp: ExpressionNode\n try {\n outputExp = processExpression(simpleExpression, { ...context, prefixIdentifiers: false })\n } catch (err) {\n console.error(\n '[attaform] select transform: processExpression failed; falling back to the unprocessed expression.',\n err\n )\n outputExp = simpleExpression\n }\n\n const valueProp: DirectiveNode = {\n rawName: ':value',\n arg: createSimpleExpression('value', true),\n exp: outputExp,\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: selectLoc,\n }\n\n node.props.push(valueProp)\n }\n\n if (isSelect) {\n for (const child of node.children) {\n traverseSelectNode(child, previousOptionExpressions) // start searching for options in dfs manner\n }\n return\n }\n\n const registerProps = node.props.filter(\n (x) => x.type === NodeTypes.DIRECTIVE && x.name === 'register'\n )\n const registerProp = registerProps[0]\n\n if (!registerProp) return\n\n // Idempotency marker. The hint and preamble transforms record\n // their own per-node markers; this one detects an already-injected\n // `:registerValue` directive on the props array and skips\n // re-pushing. Without the check, a doubly-registered transform\n // pipeline (rare in production, common in test combinatorics)\n // would emit two `registerValue:` keys in the generated render —\n // the last wins for prop resolution, but the output is bloated and\n // confusing under codegen inspection.\n const alreadyInjected = node.props.some(\n (p) =>\n p.type === NodeTypes.DIRECTIVE &&\n p.name === 'bind' &&\n p.arg !== undefined &&\n 'content' in p.arg &&\n p.arg.content === 'registerValue'\n )\n if (alreadyInjected) return\n\n const customElementProp: DirectiveNode = {\n arg: createSimpleExpression('registerValue', true),\n exp: 'exp' in registerProp ? registerProp.exp : createSimpleExpression('undefined', false),\n name: 'bind',\n modifiers: [],\n type: NodeTypes.DIRECTIVE,\n loc: selectLoc,\n }\n\n node.props.push(customElementProp)\n } catch (err) {\n // AST shape drift or malformed template: rewind every prop array\n // we mutated so the template falls back cleanly to the runtime\n // directive. Reverse order mirrors the push order so later\n // snapshots restore against the state their earlier siblings\n // saw. Runtime directive alone still handles value binding; only\n // SSR initial-render correctness is affected.\n for (const { target, snapshot } of snapshots.slice().reverse()) {\n target.splice(0, target.length, ...snapshot)\n }\n\n console.error('[attaform] select transform failed, skipping:', err)\n }\n}\n","import {\n createCompoundExpression,\n NodeTypes,\n type CompoundExpressionNode,\n type ExpressionNode,\n type NodeTransform,\n} from '@vue/compiler-core'\n\n/**\n * `vRegisterHintTransform` — for every `<element v-register=\"<expr>\">`,\n * rewrite the directive's binding expression to wrap `<expr>` in an\n * IIFE that calls `markConnectedOptimistically()` on the resulting\n * `RegisterValue` and returns the same object:\n *\n * ((__attaRv) => (__attaRv?.markConnectedOptimistically?.(), __attaRv))(<expr>)\n *\n * Why this exists: Vue intentionally skips directive lifecycle hooks\n * during SSR (see `core/directive.ts`'s top comment). That means the\n * `v-register` directive's `created` hook — the one that flips\n * `connected: true` for the field — never fires server-side. Every\n * SSR'd FieldState therefore serialises `connected: false`, and on\n * hydration the directive runs and the flag flickers to `true`. Anyone\n * reading `getFieldState(path).connected` in a server-rendered\n * template sees the stale value baked into the static HTML.\n *\n * The wrapping IIFE captures the `RegisterValue` produced by `<expr>`,\n * fires the optimistic mark (which itself is guarded by `state.ssr`,\n * so client-side it's a free no-op), and returns the same object so\n * the directive receives exactly what the author wrote.\n *\n * The transform is deliberately agnostic to the shape of `<expr>`:\n *\n * - inline: `v-register=\"form.register('email')\"`\n * - hoisted: `v-register=\"emailReg\"` (where `emailReg = form.register(...)`)\n * - dynamic: `v-register=\"form.register(`${prefix}.email`)\"`\n *\n * All three produce a `RegisterValue` at runtime, and the wrapper\n * doesn't need to know the path string. Setup-time `register()` calls\n * that are NEVER bound to `v-register` get no wrapper, no optimistic\n * mark, and stay `connected: false` post-hydration — exactly the\n * desired negative case (those calls don't represent a rendered DOM\n * element).\n *\n * Idempotent: if the transform runs twice on the same AST (some\n * bundler configurations do this), the second pass detects the marker\n * and skips re-wrapping.\n */\n\nconst HINT_MARKER = '__attaRv'\nconst HINT_PREFIX = `((${HINT_MARKER}) => (${HINT_MARKER}?.markConnectedOptimistically?.(), ${HINT_MARKER}))(`\nconst HINT_SUFFIX = `)`\n\n/**\n * Vue compiler node transform that wraps every `v-register`\n * expression in a small IIFE so the directive can flag a field as\n * connected during SSR. Eliminates the `false → true` flicker on\n * `getFieldState(path).connected` after hydration.\n *\n * Must run after `vRegisterPreambleTransform`. Wired automatically\n * by `attaform/vite` and `attaform/nuxt`.\n */\nexport const vRegisterHintTransform: NodeTransform = (node) => {\n try {\n if (node.type !== NodeTypes.ELEMENT) return\n for (const prop of node.props) {\n if (prop.type !== NodeTypes.DIRECTIVE) continue\n if (prop.name !== 'register') continue\n if (prop.exp === undefined) continue\n if (isAlreadyWrapped(prop.exp)) continue\n prop.exp = wrapWithOptimisticHint(prop.exp)\n }\n } catch (err) {\n // AST shape drift across @vue/compiler-core versions or a malformed\n // directive: skip this transform entirely. The runtime mark is\n // fail-safe — without the wrapper, we just get the existing\n // false→true flicker on first paint, never an incorrect render.\n console.error('[attaform] v-register hint transform failed, skipping:', err)\n }\n}\n\nfunction isAlreadyWrapped(exp: ExpressionNode): boolean {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) {\n return exp.content.includes(HINT_MARKER)\n }\n // Compound expression: scan only the string children. Nested\n // SimpleExpressionNodes were copied verbatim from the user's\n // expression and won't contain our marker; the marker only ever\n // appears in the literal prefix/suffix strings we add.\n for (const child of exp.children) {\n if (typeof child === 'string' && child.includes(HINT_MARKER)) return true\n }\n return false\n}\n\nfunction wrapWithOptimisticHint(exp: ExpressionNode): CompoundExpressionNode {\n // For a SimpleExpression we keep the node intact as a child so any\n // later `processExpression` pass (identifier prefixing for setup\n // refs) still walks it. For a CompoundExpression we splice its\n // children in — prepending the prefix string and appending the\n // suffix preserves the post-prefix shape downstream transforms\n // expect.\n const innerChildren: CompoundExpressionNode['children'] =\n exp.type === NodeTypes.SIMPLE_EXPRESSION ? [exp] : [...exp.children]\n // Reuse the wrapped expression's source location — runtime errors\n // in the wrapped IIFE point at the v-register binding site rather\n // than line 0.\n return createCompoundExpression([HINT_PREFIX, ...innerChildren, HINT_SUFFIX], exp.loc)\n}\n","import {\n createSimpleExpression,\n NodeTypes,\n type DirectiveNode,\n type ElementNode,\n type ExpressionNode,\n type NodeTransform,\n type RootNode,\n type SimpleExpressionNode,\n} from '@vue/compiler-core'\n\n/**\n * `vRegisterPreambleTransform` — closes the render-order edge that\n * `vRegisterHintTransform` alone leaves open.\n *\n * The hint transform wraps each `v-register` directive expression in an\n * IIFE that calls `markConnectedOptimistically()` when the element's\n * vnode is created. That works for any expression evaluated AT or AFTER\n * the input in render order. But Vue's SSR is single-pass top-to-bottom,\n * so a template like:\n *\n * <pre>{{ form.fields.password.connected }}</pre>\n * <input v-register=\"form.register('password')\" />\n *\n * evaluates the `<pre>` first, BEFORE the v-register wrapper has had a\n * chance to fire. The serialized HTML carries `connected: false` for\n * password — and the post-hydration steady state shows `true`, leaving\n * a one-tick `false → true` flicker visible to the user.\n *\n * Fix: hoist the marks one level up. We walk the entire template AST,\n * collect every static `v-register` binding (skipping descendants of\n * `v-for`, since those reference loop locals not available at root\n * scope), and prepend a synthetic `:data-atta-pre-mark` directive on the\n * first root element. Vue evaluates element prop bindings before\n * recursing into children, so the IIFE inside `:data-atta-pre-mark` fires\n * every collected mark BEFORE any descendant template expression runs.\n *\n * The binding's expression resolves to `undefined`, which Vue's SSR\n * renderer drops (no `data-atta-pre-mark` attribute appears in the\n * rendered HTML). The side effect — flipping `connected: true` on\n * each field record — is the only output we want.\n *\n * Companion to `vRegisterHintTransform`: register both, with this one\n * BEFORE the hint transform. The pre-order pass here captures each\n * `v-register` expression's original (un-wrapped) text into a\n * per-template state map; the hint transform then wraps the in-place\n * directive expression. The exit hook on the first root element\n * builds the preamble using the captured originals — exit hooks on\n * an element fire before `transformElement`'s codegen exit, so the\n * injected prop lands in the rendered output.\n *\n * For `v-for` descendants the per-element wrapper from\n * `vRegisterHintTransform` is still load-bearing — those bindings can't\n * be hoisted because their path expressions reference loop-scoped\n * identifiers (e.g. `form.register(`item.${i}`)`).\n */\n\n/**\n * Per-root traversal state. Keyed by the RootNode object — stable for\n * the duration of one compile pass and GC-friendly across pipelines.\n * - `captured`: collected pre-wrap expression strings, in template\n * visit order.\n * - `vForDepth`: nesting count for `v-for` ancestry, bumped on FOR\n * entry / decremented on FOR exit, so element visits in between\n * can skip captures cheaply.\n * - `firstRootElementVisited`: ensures we only register the\n * injection exit-hook on the very first root element (templates\n * with multiple top-level elements still have one \"first\" — Vue\n * wraps multi-root in a fragment, but the FIRST element's props\n * evaluate before any sibling).\n */\ntype TraversalState = {\n readonly captured: string[]\n /**\n * Elements whose v-register binding has already been captured for\n * THIS root traversal. Guards against double-capture when the same\n * transform is registered twice in the `nodeTransforms` array (some\n * bundler chains do this) — without it, every binding's mark call\n * would be duplicated in the injected expression.\n */\n readonly capturedElements: WeakSet<ElementNode>\n vForDepth: number\n firstRootElementVisited: boolean\n}\nconst stateByRoot: WeakMap<RootNode, TraversalState> = new WeakMap()\n\nconst PREAMBLE_ATTR = 'data-atta-pre-mark'\n\n/**\n * Vue compiler node transform that hoists `v-register`'s SSR\n * connection marks to the root of the template. Together with\n * `vRegisterHintTransform`, ensures expressions earlier in the\n * template that read `getFieldState(path).connected` see the\n * correct value during the server's single-pass render.\n *\n * Must run before `vRegisterHintTransform`. Wired automatically\n * by `attaform/vite` and `attaform/nuxt`.\n */\nexport const vRegisterPreambleTransform: NodeTransform = (node, context) => {\n try {\n if (node.type === NodeTypes.ROOT) {\n // If state already exists, a duplicate registration of this\n // transform is at work — keep the first run's state intact.\n // Otherwise its captures would get wiped by this re-init.\n if (stateByRoot.has(node)) return\n stateByRoot.set(node, {\n captured: [],\n capturedElements: new WeakSet<ElementNode>(),\n vForDepth: 0,\n firstRootElementVisited: false,\n })\n return () => {\n // Cleanup on root exit. The actual injection happened on the\n // first root element's exit (registered below) — by the time\n // we get here, that element's transformElement codegen has\n // already absorbed the injected prop.\n stateByRoot.delete(node)\n }\n }\n\n const state = stateByRoot.get(context.root)\n if (state === undefined) return\n\n if (node.type === NodeTypes.FOR) {\n // The structural `transformFor` (built into compiler-core, runs\n // before our transform) wraps any element carrying v-for in a\n // NodeTypes.FOR node. Bumping the depth on entry / decrementing\n // on exit gives us O(1) \"am I inside a v-for ancestor?\" checks\n // during the element visits below.\n state.vForDepth += 1\n return () => {\n state.vForDepth -= 1\n }\n }\n\n if (node.type !== NodeTypes.ELEMENT) return\n\n // Capture this element's v-register binding (if any) BEFORE\n // deciding about exit-hook registration — that way the very first\n // root element, which itself might carry v-register, contributes\n // its binding to the preamble it hosts.\n captureVRegisterIfStatic(node, state)\n\n // First root element — register the exit hook that injects the\n // preamble using the FINAL collected state. Exit hooks fire after\n // children are traversed, so by then every descendant capture has\n // landed in `state.captured`.\n if (!state.firstRootElementVisited && context.parent?.type === NodeTypes.ROOT) {\n state.firstRootElementVisited = true\n return () => {\n const finalState = stateByRoot.get(context.root)\n if (finalState === undefined || finalState.captured.length === 0) return\n injectPreamble(node, finalState.captured)\n }\n }\n return\n } catch (err) {\n // AST shape drift or a malformed directive: skip this transform\n // entirely. The per-element vRegisterHintTransform still covers\n // the common case (read at-or-after the input). Failure here only\n // affects the read-before-input edge.\n console.error('[attaform] v-register preamble transform failed, skipping:', err)\n return\n }\n}\n\nfunction captureVRegisterIfStatic(node: ElementNode, state: TraversalState): void {\n if (state.vForDepth > 0) return\n // An element that itself carries v-for hasn't been wrapped yet by\n // transformFor at the moment user transforms see it (transform\n // ordering varies by bundler), so check the directive directly.\n if (hasVForDirective(node)) return\n // Idempotency: only one capture per element per root traversal.\n // Without this, registering the transform twice in the\n // `nodeTransforms` array would double every binding's mark call\n // inside the injected expression.\n if (state.capturedElements.has(node)) return\n\n const exp = findVRegisterExpression(node)\n if (exp === null) return\n state.capturedElements.add(node)\n // Pre-wrap capture. This transform is registered BEFORE\n // vRegisterHintTransform, so prop.exp is still the original\n // expression here; the hint's wrap happens after our pre-order\n // returns from the same node.\n state.captured.push(flattenExpression(exp))\n}\n\nfunction findVRegisterExpression(node: ElementNode): ExpressionNode | null {\n for (const prop of node.props) {\n if (prop.type !== NodeTypes.DIRECTIVE) continue\n if (prop.name !== 'register') continue\n if (prop.exp === undefined) continue\n return prop.exp\n }\n return null\n}\n\nfunction hasVForDirective(node: ElementNode): boolean {\n for (const prop of node.props) {\n if (prop.type === NodeTypes.DIRECTIVE && prop.name === 'for') return true\n }\n return false\n}\n\n/**\n * Flatten an ExpressionNode to its source text. The compiler-core AST\n * stores expressions either as a SimpleExpressionNode (one piece of\n * text) or a CompoundExpressionNode (a list of strings + nested\n * SimpleExpressionNodes interleaved, which is what `processExpression`\n * produces when prefixing identifiers). We can serialise either back\n * to source by concatenating the textual content.\n */\nfunction flattenExpression(exp: ExpressionNode): string {\n if (exp.type === NodeTypes.SIMPLE_EXPRESSION) return exp.content\n let out = ''\n for (const child of exp.children) {\n if (typeof child === 'string') {\n out += child\n continue\n }\n if (typeof child === 'symbol') continue\n if ('content' in child) {\n out += child.content\n continue\n }\n out += flattenExpression(child as ExpressionNode)\n }\n return out\n}\n\n/**\n * Build and prepend the `:data-atta-pre-mark` directive to the element's\n * props. The expression is a comma-chain of\n * `(<expr>)?.markConnectedOptimistically?.()` calls, ending in\n * `undefined` so the attribute resolves to `undefined` and Vue's SSR\n * renderer omits it entirely. Side effects (the marks) happen during\n * evaluation; no observable HTML attribute appears.\n *\n * The exp is a SimpleExpressionNode with `isStatic: false` — when\n * `transformElement`'s exit codegen processes it, identifiers like\n * `form` get prefixed (`_ctx.form`) the same way every other dynamic\n * binding does. This works because our exit hook runs BEFORE\n * `transformElement`'s exit (we're registered later in the\n * `nodeTransforms` array, so our exit fires earlier in the reverse\n * pass).\n */\nfunction injectPreamble(element: ElementNode, captured: readonly string[]): void {\n if (hasPreamble(element)) return\n\n // Each entry is wrapped in a try/catch IIFE: the preamble is best-\n // effort optimisation (only matters for the read-before-input edge,\n // see the file header), and any throw inside one entry must not\n // prevent the rest from firing or break SSR. Common throw paths the\n // catch covers: a v-register against a null `ctx` (e.g. when\n // `injectForm` returned null and the input is gated by a v-if\n // the AST walker can't see — the v-if check fires later, so the\n // preamble would otherwise dereference null here).\n const callList = captured\n .map((source) => `(()=>{try{(${source})?.markConnectedOptimistically?.()}catch{}})()`)\n .join(', ')\n const expressionText = `(${callList}, undefined)`\n const exp: SimpleExpressionNode = createSimpleExpression(expressionText, false /* not static */)\n\n const directive: DirectiveNode = {\n type: NodeTypes.DIRECTIVE,\n name: 'bind',\n arg: createSimpleExpression(PREAMBLE_ATTR, true /* static arg */),\n exp,\n modifiers: [],\n // Reuse the host element's source location so any runtime error\n // in the synthesized expression points at the consumer's template\n // line, not at the dummyLoc that pre-fix was line 0.\n loc: element.loc,\n }\n element.props.unshift(directive)\n}\n\nfunction hasPreamble(element: ElementNode): boolean {\n for (const prop of element.props) {\n if (prop.type !== NodeTypes.DIRECTIVE) continue\n if (prop.name !== 'bind') continue\n if (prop.arg === undefined) continue\n if (prop.arg.type !== NodeTypes.SIMPLE_EXPRESSION) continue\n if (prop.arg.content === PREAMBLE_ATTR) return true\n }\n return false\n}\n"],"names":["getSummarizedProps","NodeTypes","key","value","renderAsStatic","getSummarizedPropValue","generateEqualityExpression","removePropsByName","isExactKey","registerSummarizedProp","elementValueSummarizedProp","createCompoundExpression","previousOptionExpressions","createSimpleExpression","ElementTypes","processExpression"],"mappings":";;;;AAkBA,SAASA,qBAAmB,IAAA,EAAoC;AAC9D,EAAA,IAAI,EAAE,OAAA,IAAW,IAAA,CAAA,EAAO,OAAO,EAAC;AAChC,EAAA,MAAM,QAAQ,IAAA,CAAK,KAAA;AAEnB,EAAA,MAAM,eAAA,GAAkB,KAAA,CAAM,MAAA,CAAyB,CAAC,KAAK,QAAA,KAAa;AACxE,IAAA,IAAI,QAAA,CAAS,IAAA,KAASC,sBAAA,CAAU,SAAA,EAAW;AACzC,MAAA,MAAMC,OAAM,QAAA,CAAS,IAAA;AACrB,MAAA,MAAMC,MAAAA,GAAQ,QAAA,CAAS,KAAA,EAAO,OAAA,IAAW,EAAA;AACzC,MAAA,OAAO,CAAC,GAAG,GAAA,EAAK,EAAE,GAAA,EAAAD,IAAAA,E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