@homebound/truss 2.3.3 → 2.3.5
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/build/plugin/index.js +26 -27
- package/build/plugin/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugin/index.ts","../../src/plugin/emit-truss.ts","../../src/plugin/property-priorities.ts","../../src/plugin/priority.ts","../../src/plugin/transform.ts","../../src/plugin/resolve-chain.ts","../../src/plugin/ast-utils.ts","../../src/plugin/rewrite-sites.ts","../../src/plugin/transform-css.ts","../../src/plugin/css-ts-utils.ts","../../src/plugin/rewrite-css-ts-imports.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync } from \"fs\";\nimport { resolve, dirname, isAbsolute, join } from \"path\";\nimport type { TrussMapping } from \"./types\";\nimport type { AtomicRule } from \"./emit-truss\";\nimport { generateCssText } from \"./emit-truss\";\nimport { transformTruss } from \"./transform\";\nimport { transformCssTs } from \"./transform-css\";\nimport { rewriteCssTsImports } from \"./rewrite-css-ts-imports\";\n\nexport interface TrussPluginOptions {\n /** Path to the Css.json mapping file used for transforming files (relative to project root or absolute). */\n mapping: string;\n /** Packages in `node_modules` that should also be transformed, all other `node_modules` files are skipped. */\n externalPackages?: string[];\n}\n\n// Intentionally loose Vite types so we don't depend on the `vite` package at compile time.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TrussVitePlugin {\n name: string;\n enforce?: \"pre\" | \"post\";\n configResolved?: (config: any) => void;\n buildStart?: () => void;\n resolveId?: (source: string, importer: string | undefined) => string | null;\n load?: (id: string) => string | null;\n transform?: (code: string, id: string) => { code: string; map: any } | null;\n configureServer?: (server: any) => void;\n transformIndexHtml?: (html: string) => string;\n handleHotUpdate?: (ctx: any) => void;\n generateBundle?: (options: any, bundle: any) => void;\n writeBundle?: (options: any, bundle: any) => void;\n}\n\n/** Prefix for virtual CSS module IDs generated from .css.ts files. */\nconst VIRTUAL_CSS_PREFIX = \"\\0truss-css:\";\nconst CSS_TS_QUERY = \"?truss-css\";\n\n/** Virtual module IDs for dev HMR. */\nconst VIRTUAL_CSS_ENDPOINT = \"/virtual:truss.css\";\nconst VIRTUAL_RUNTIME_ID = \"virtual:truss:runtime\";\nconst RESOLVED_VIRTUAL_RUNTIME_ID = \"\\0\" + VIRTUAL_RUNTIME_ID;\n\n/**\n * Vite plugin that transforms `Css.*.$` expressions from truss's CssBuilder DSL\n * into Truss-native style hash objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Also supports `.css.ts` files: a `.css.ts` file with\n * `export const css = { \".selector\": Css.blue.$ }` can keep other runtime exports,\n * while imports are supplemented with a virtual CSS side-effect module.\n *\n * In dev mode, serves CSS via a virtual endpoint that the injected runtime keeps in sync.\n * In production, emits a single `truss.css` asset with all atomic rules.\n */\nexport function trussPlugin(opts: TrussPluginOptions): TrussVitePlugin {\n let mapping: TrussMapping | null = null;\n let projectRoot: string;\n let debug = false;\n let isTest = false;\n let isBuild = false;\n const externalPackages = opts.externalPackages ?? [];\n\n // Global CSS rule registry shared across all transform calls within a build\n const cssRegistry = new Map<string, AtomicRule>();\n let cssVersion = 0;\n let lastSentVersion = 0;\n\n function mappingPath(): string {\n return resolve(projectRoot || process.cwd(), opts.mapping);\n }\n\n // Some tooling can call `transform` before `buildStart`; this keeps behavior\n // resilient without requiring hook ordering assumptions.\n function ensureMapping(): TrussMapping {\n if (!mapping) {\n mapping = loadMapping(mappingPath());\n }\n return mapping;\n }\n\n /** Generate the full CSS string from the global registry, ordered by precedence tiers. */\n function collectCss(): string {\n return generateCssText(cssRegistry);\n }\n\n return {\n name: \"truss\",\n enforce: \"pre\",\n\n configResolved(config: any) {\n projectRoot = config.root;\n debug = config.command === \"serve\" || config.mode === \"development\" || config.mode === \"test\";\n isTest = config.mode === \"test\";\n isBuild = config.command === \"build\";\n },\n\n buildStart() {\n ensureMapping();\n // Reset registry at start of each build\n cssRegistry.clear();\n cssVersion = 0;\n lastSentVersion = 0;\n },\n\n // -- Dev mode HMR --\n\n configureServer(server: any) {\n // Skip dev-server setup in test mode — Vitest doesn't start a real HTTP\n // server, so the interval would keep the process alive.\n if (isTest) return;\n\n // Serve the current collected CSS at the virtual endpoint\n server.middlewares.use(function (req: any, res: any, next: any) {\n if (req.url !== VIRTUAL_CSS_ENDPOINT) return next();\n const css = collectCss();\n res.setHeader(\"Content-Type\", \"text/css\");\n res.setHeader(\"Cache-Control\", \"no-store\");\n res.end(css);\n });\n\n // Poll for CSS version changes and push HMR updates\n const interval = setInterval(function () {\n if (cssVersion !== lastSentVersion && server.ws) {\n lastSentVersion = cssVersion;\n server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n }, 150);\n\n // Clean up interval when server closes\n server.httpServer?.on(\"close\", function () {\n clearInterval(interval);\n });\n },\n\n transformIndexHtml(html: string) {\n if (isBuild) return html;\n // Inject the virtual runtime script for dev mode; it owns style updates.\n const tag = `<script type=\"module\" src=\"/${VIRTUAL_RUNTIME_ID}\"></script>`;\n return html.replace(\"</head>\", ` ${tag}\\n </head>`);\n },\n\n handleHotUpdate(ctx: any) {\n // Send CSS update event on any file change for safety\n if (ctx.server?.ws) {\n ctx.server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n },\n\n // -- Virtual module resolution --\n\n resolveId(source: string, importer: string | undefined) {\n // Handle the dev HMR runtime virtual module\n if (source === VIRTUAL_RUNTIME_ID || source === \"/\" + VIRTUAL_RUNTIME_ID) {\n return RESOLVED_VIRTUAL_RUNTIME_ID;\n }\n\n // Handle .css.ts virtual modules\n if (!source.endsWith(CSS_TS_QUERY)) return null;\n\n const absolutePath = resolveImportPath(source.slice(0, -CSS_TS_QUERY.length), importer, projectRoot);\n\n // Only handle it if the .css.ts file actually exists\n if (!existsSync(absolutePath)) return null;\n\n // Return a virtual CSS module ID that maps back to the source .css.ts file.\n // Strip the trailing `.ts` so the ID ends in `.css` — this tells Vite to\n // route the loaded content through its CSS pipeline.\n return VIRTUAL_CSS_PREFIX + absolutePath.slice(0, -3);\n },\n\n load(id: string) {\n // Serve the dev HMR runtime script\n if (id === RESOLVED_VIRTUAL_RUNTIME_ID) {\n return `\n// Truss dev HMR runtime — keeps styles up to date without page reload\n(function() {\n let style = document.getElementById(\"__truss_virtual__\");\n if (!style) {\n style = document.createElement(\"style\");\n style.id = \"__truss_virtual__\";\n document.head.appendChild(style);\n }\n\n function fetchCss() {\n fetch(\"${VIRTUAL_CSS_ENDPOINT}\")\n .then(function(r) { return r.text(); })\n .then(function(css) { style.textContent = css; })\n .catch(function() {});\n }\n\n fetchCss();\n\n if (import.meta.hot) {\n import.meta.hot.on(\"truss:css-update\", fetchCss);\n import.meta.hot.on(\"vite:afterUpdate\", function() {\n setTimeout(fetchCss, 50);\n });\n }\n})();\n`;\n }\n\n // Handle .css.ts virtual modules\n if (!id.startsWith(VIRTUAL_CSS_PREFIX)) return null;\n\n // Re-add `.ts` to recover the original source file path\n const sourcePath = id.slice(VIRTUAL_CSS_PREFIX.length) + \".ts\";\n const sourceCode = readFileSync(sourcePath, \"utf8\");\n return transformCssTs(sourceCode, sourcePath, ensureMapping());\n },\n\n transform(code: string, id: string) {\n // Only process JS/TS/JSX/TSX files\n if (!/\\.[cm]?[jt]sx?(\\?|$)/.test(id)) return null;\n\n const rewrittenImports = rewriteCssTsImports(code, id);\n const rewrittenCode = rewrittenImports.code;\n const hasCssDsl = rewrittenCode.includes(\"Css\");\n if (!hasCssDsl && !rewrittenImports.changed) return null;\n\n const fileId = stripQueryAndHash(id);\n if (isNodeModulesFile(fileId) && !isWhitelistedExternalPackageFile(fileId, externalPackages)) {\n return null;\n }\n\n if (fileId.endsWith(\".css.ts\")) {\n // Keep `.css.ts` modules as normal TS so named exports like class-name\n // constants still work at runtime; only return code when we injected the\n // companion `?truss-css` side-effect import.\n return rewrittenImports.changed ? { code: rewrittenCode, map: null } : null;\n }\n\n if (!hasCssDsl) {\n // Some non-`.css.ts` modules only need the import rewrite and do not have\n // any `Css.*.$` expressions for the main Truss transform to process.\n return { code: rewrittenCode, map: null };\n }\n\n // For regular JS/TS modules that still use the DSL, run the full Truss\n // transform after the import rewrite so both behaviors compose.\n const result = transformTruss(rewrittenCode, fileId, ensureMapping(), {\n debug,\n // In test mode (jsdom), inject CSS directly so document.styleSheets has rules\n injectCss: isTest,\n });\n if (!result) {\n if (!rewrittenImports.changed) return null;\n return { code: rewrittenCode, map: null };\n }\n\n // Merge new rules into the global registry\n if (result.rules) {\n let hasNewRules = false;\n for (const [className, rule] of result.rules) {\n if (!cssRegistry.has(className)) {\n cssRegistry.set(className, rule);\n hasNewRules = true;\n }\n }\n if (hasNewRules) {\n cssVersion++;\n }\n }\n\n return { code: result.code, map: result.map };\n },\n\n // -- Production CSS emission --\n\n generateBundle(_options: any, bundle: any) {\n if (!isBuild) return;\n const css = collectCss();\n if (!css) return;\n\n // Try to append to an existing CSS asset in the bundle\n for (const key of Object.keys(bundle)) {\n const asset = bundle[key];\n if (asset.type === \"asset\" && key.endsWith(\".css\")) {\n asset.source = asset.source + \"\\n\" + css;\n return;\n }\n }\n\n // No existing CSS asset found — emit a standalone truss.css\n (this as any).emitFile({\n type: \"asset\",\n fileName: \"truss.css\",\n source: css,\n });\n },\n\n writeBundle(options: any, bundle: any) {\n if (!isBuild) return;\n const css = collectCss();\n if (!css) return;\n\n // Fallback: if generateBundle didn't find a target, write to disk\n const outDir = options.dir || join(projectRoot, \"dist\");\n const trussPath = join(outDir, \"truss.css\");\n if (!existsSync(trussPath)) {\n // Check if it was appended to an existing CSS asset\n const alreadyEmitted = Object.keys(bundle).some(function (key) {\n const asset = bundle[key];\n return (\n asset.type === \"asset\" &&\n key.endsWith(\".css\") &&\n typeof asset.source === \"string\" &&\n asset.source.includes(css)\n );\n });\n if (!alreadyEmitted) {\n writeFileSync(trussPath, css, \"utf8\");\n }\n }\n },\n };\n}\n\nfunction resolveImportPath(source: string, importer: string | undefined, projectRoot: string | undefined): string {\n if (isAbsolute(source)) {\n return source;\n }\n\n if (importer) {\n return resolve(dirname(importer), source);\n }\n\n return resolve(projectRoot || process.cwd(), source);\n}\n\n/** Strip Vite query/hash suffixes from an id. */\nfunction stripQueryAndHash(id: string): string {\n const queryIndex = id.indexOf(\"?\");\n const hashIndex = id.indexOf(\"#\");\n\n let end = id.length;\n if (queryIndex >= 0) end = Math.min(end, queryIndex);\n if (hashIndex >= 0) end = Math.min(end, hashIndex);\n\n const cleanId = id.slice(0, end);\n // Vite can prefix absolute paths with `/@fs/`.\n if (cleanId.startsWith(\"/@fs/\")) {\n return cleanId.slice(4);\n }\n return cleanId;\n}\n\nfunction isNodeModulesFile(filePath: string): boolean {\n return normalizePath(filePath).includes(\"/node_modules/\");\n}\n\nfunction isWhitelistedExternalPackageFile(filePath: string, externalPackages: string[]): boolean {\n const normalizedPath = normalizePath(filePath);\n return externalPackages.some(function (pkg) {\n return normalizedPath.includes(`/node_modules/${pkg}/`);\n });\n}\n\nfunction normalizePath(path: string): string {\n return path.replace(/\\\\/g, \"/\");\n}\n\n/** Load a truss mapping file synchronously (for tests). */\nexport function loadMapping(path: string): TrussMapping {\n const raw = readFileSync(path, \"utf8\");\n return JSON.parse(raw);\n}\n\nexport type { TrussMapping, TrussMappingEntry } from \"./types\";\n","import * as t from \"@babel/types\";\nimport type { ResolvedChain } from \"./resolve-chain\";\nimport type { ResolvedSegment, TrussMapping } from \"./types\";\nimport { sortRulesByPriority } from \"./priority\";\n\n// -- Atomic CSS rule model --\n\n/** A single atomic CSS rule: one class, one selector, one or more declarations. */\nexport interface AtomicRule {\n className: string;\n cssProperty: string;\n cssValue: string;\n declarations?: Array<{\n cssProperty: string;\n cssValue: string;\n cssVarName?: string;\n }>;\n pseudoClass?: string;\n mediaQuery?: string;\n pseudoElement?: string;\n /** If true, this is a `var(--name)` rule that needs an `@property` declaration. */\n cssVarName?: string;\n /** For when() rules: the relationship selector context. */\n whenSelector?: {\n relationship: string;\n markerClass: string;\n pseudo: string;\n };\n}\n\n/** Pseudo-class short suffixes for class naming. */\nconst PSEUDO_SUFFIX: Record<string, string> = {\n \":hover\": \"_h\",\n \":focus\": \"_f\",\n \":focus-visible\": \"_fv\",\n \":focus-within\": \"_fw\",\n \":active\": \"_a\",\n \":disabled\": \"_d\",\n};\n\n/** Extra pseudo selector abbreviations used when() class names need static-but-safe tokens. */\nconst PSEUDO_SELECTOR_SUFFIX: Record<string, string> = {\n ...PSEUDO_SUFFIX,\n \":not\": \"_n\",\n \":is\": \"_is\",\n \":where\": \"_where\",\n \":has\": \"_has\",\n};\n\n/** Short abbreviations for relationship types in when() class names. */\nconst RELATIONSHIP_SHORT: Record<string, string> = {\n ancestor: \"anc\",\n descendant: \"desc\",\n siblingAfter: \"sibA\",\n siblingBefore: \"sibB\",\n anySibling: \"anyS\",\n};\n\n/** Default marker class name (used when no explicit marker is provided). */\nexport const DEFAULT_MARKER_CLASS = \"_mrk\";\n\n/** Derive a marker class name from a marker AST node (or use the default). */\nexport function markerClassName(markerNode?: { type: string; name?: string }): string {\n if (!markerNode) return DEFAULT_MARKER_CLASS;\n if (markerNode.type === \"Identifier\" && markerNode.name) {\n return `_${markerNode.name}_mrk`;\n }\n return \"_marker_mrk\";\n}\n\n/**\n * Build a when() class name prefix from whenPseudo info.\n *\n * I.e. `when(marker, \"ancestor\", \":hover\")` → `\"wh_anc_h_\"`,\n * `when(row, \"ancestor\", \":hover\")` → `\"wh_anc_h_row_\"`.\n */\nfunction whenPrefix(whenPseudo: { pseudo: string; markerNode?: any; relationship?: string }): string {\n const rel = RELATIONSHIP_SHORT[whenPseudo.relationship ?? \"ancestor\"] ?? \"anc\";\n const pseudoTag = pseudoSelectorTag(whenPseudo.pseudo);\n const markerPart = whenPseudo.markerNode?.type === \"Identifier\" ? `${whenPseudo.markerNode.name}_` : \"\";\n return `wh_${rel}_${pseudoTag}_${markerPart}`;\n}\n\n/** Convert a pseudo selector into a safe class-name token while preserving raw selector emission. */\nfunction pseudoSelectorTag(pseudo: string): string {\n const replaced = pseudo.trim().replace(/::?[a-zA-Z-]+/g, function (match) {\n return `_${pseudoIdentifierTag(match)}_`;\n });\n const cleaned = replaced\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n return cleaned || \"pseudo\";\n}\n\nfunction pseudoIdentifierTag(pseudo: string): string {\n const normalized = normalizePseudoIdentifier(pseudo);\n const known = PSEUDO_SELECTOR_SUFFIX[normalized];\n if (known) {\n return known.replace(/^_/, \"\");\n }\n return normalized.replace(/^::?/, \"\").replace(/-/g, \"_\");\n}\n\nfunction normalizePseudoIdentifier(pseudo: string): string {\n const prefixMatch = pseudo.match(/^::?/);\n const prefix = prefixMatch?.[0] ?? \"\";\n const name = pseudo.slice(prefix.length).replace(/[A-Z]/g, function (match) {\n return `-${match.toLowerCase()}`;\n });\n return `${prefix}${name}`;\n}\n\n/**\n * Build a condition prefix string for class naming.\n *\n * Conditions are prefixed so class names read naturally in the DOM:\n * I.e. `h_bgBlack` reads as \"on hover, bgBlack\".\n */\nfunction conditionPrefix(\n pseudoClass: string | null | undefined,\n mediaQuery: string | null | undefined,\n pseudoElement: string | null | undefined,\n breakpoints?: Record<string, string>,\n): string {\n const parts: string[] = [];\n if (pseudoElement) {\n // I.e. \"::placeholder\" → \"placeholder_\"\n parts.push(`${pseudoElement.replace(/^::/, \"\")}_`);\n }\n if (mediaQuery && breakpoints) {\n // Find breakpoint name, i.e. \"ifSm\" → \"sm_\"\n const bpKey = Object.entries(breakpoints).find(([, v]) => v === mediaQuery)?.[0];\n if (bpKey) {\n const shortName = bpKey.replace(/^if/, \"\").toLowerCase();\n parts.push(`${shortName}_`);\n } else {\n parts.push(\"mq_\");\n }\n } else if (mediaQuery) {\n parts.push(\"mq_\");\n }\n if (pseudoClass) {\n parts.push(`${pseudoSelectorTag(pseudoClass)}_`);\n }\n return parts.join(\"\");\n}\n\n/** Convert camelCase CSS property to kebab-case (handles vendor prefixes like WebkitTransform). */\nexport function camelToKebab(s: string): string {\n return s.replace(/^(Webkit|Moz|Ms|O)/, (m) => `-${m.toLowerCase()}`).replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n}\n\n/** Clean a CSS value for use in a class name. */\nfunction cleanValueForClassName(value: string): string {\n // I.e. -8px → neg8px, 16px → 16px, \"0 0 0 1px blue\" → 0_0_0_1px_blue\n let cleaned = value;\n if (cleaned.startsWith(\"-\")) {\n cleaned = \"neg\" + cleaned.slice(1);\n }\n return cleaned\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n}\n\n/**\n * Build a reverse lookup from `\"cssProperty\\0cssValue\"` → canonical abbreviation name.\n *\n * For each single-property static abbreviation in the mapping, records the\n * canonical name so multi-property abbreviations can reuse it.\n * I.e. `{ paddingTop: \"8px\" }` → `\"pt1\"`, `{ borderStyle: \"solid\" }` → `\"bss\"`.\n */\nfunction buildLonghandLookup(mapping: TrussMapping): Map<string, string> {\n const lookup = new Map<string, string>();\n for (const [abbrev, entry] of Object.entries(mapping.abbreviations)) {\n if (entry.kind !== \"static\") continue;\n const props = Object.keys(entry.defs);\n if (props.length !== 1) continue;\n const prop = props[0];\n const value = String(entry.defs[prop]);\n const key = `${prop}\\0${value}`;\n // First match wins — if multiple abbreviations produce the same declaration,\n // the one that appears first in the mapping is canonical.\n if (!lookup.has(key)) {\n lookup.set(key, abbrev);\n }\n }\n return lookup;\n}\n\n/** Cached longhand lookup per mapping (keyed by identity). */\nlet cachedMapping: TrussMapping | null = null;\nlet cachedLookup: Map<string, string> | null = null;\n\n/** Get or build the longhand lookup for a mapping. */\nfunction getLonghandLookup(mapping: TrussMapping): Map<string, string> {\n if (cachedMapping !== mapping) {\n cachedMapping = mapping;\n cachedLookup = buildLonghandLookup(mapping);\n }\n return cachedLookup!;\n}\n\n/**\n * Compute the base class name for a static segment.\n *\n * For multi-property abbreviations, looks up the canonical single-property\n * abbreviation name so classes are maximally reused.\n * I.e. `p1` → `pt1`, `pr1`, `pb1`, `pl1` (not `p1_paddingTop`, etc.)\n * I.e. `ba` → `bss`, `bw1` (not `ba_borderStyle`, etc.)\n *\n * For literal-folded variables (argResolved set), includes the value:\n * I.e. `mt(2)` → `mt_16px`, `bc(\"red\")` → `bc_red`.\n */\nfunction computeStaticBaseName(\n seg: ResolvedSegment,\n cssProp: string,\n cssValue: string,\n isMultiProp: boolean,\n mapping: TrussMapping,\n): string {\n const abbr = seg.abbr;\n\n if (seg.argResolved !== undefined) {\n const valuePart = cleanValueForClassName(seg.argResolved);\n if (isMultiProp) {\n // Try to find a canonical single-property abbreviation for this longhand\n const lookup = getLonghandLookup(mapping);\n const canonical = lookup.get(`${cssProp}\\0${cssValue}`);\n if (canonical) return canonical;\n return `${abbr}_${valuePart}_${cssProp}`;\n }\n return `${abbr}_${valuePart}`;\n }\n\n if (isMultiProp) {\n // Try to find a canonical single-property abbreviation for this longhand\n const lookup = getLonghandLookup(mapping);\n const canonical = lookup.get(`${cssProp}\\0${cssValue}`);\n if (canonical) return canonical;\n return `${abbr}_${cssProp}`;\n }\n\n return abbr;\n}\n\n// -- Collecting atomic rules from resolved chains --\n\nexport interface CollectedRules {\n rules: Map<string, AtomicRule>;\n needsMaybeInc: boolean;\n}\n\n/**\n * Collect all atomic CSS rules from resolved chains.\n *\n * Each segment maps directly to one or more atomic rules based on its\n * condition context (mediaQuery, pseudoClass, pseudoElement, whenPseudo).\n */\nexport function collectAtomicRules(chains: ResolvedChain[], mapping: TrussMapping): CollectedRules {\n const rules = new Map<string, AtomicRule>();\n let needsMaybeInc = false;\n\n function collectSegment(seg: ResolvedSegment): void {\n if (seg.error || seg.styleArrayArg) return;\n if (seg.typographyLookup) {\n for (const segments of Object.values(seg.typographyLookup.segmentsByName)) {\n for (const nestedSeg of segments) {\n collectSegment(nestedSeg);\n }\n }\n return;\n }\n if (seg.incremented) needsMaybeInc = true;\n if (seg.variableProps) {\n collectVariableRules(rules, seg, mapping);\n } else {\n collectStaticRules(rules, seg, mapping);\n }\n }\n\n for (const chain of chains) {\n for (const part of chain.parts) {\n const segs = part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n for (const seg of segs) {\n collectSegment(seg);\n }\n }\n }\n\n return { rules, needsMaybeInc };\n}\n\n/** Compute the class name prefix and optional whenSelector for a segment. */\nfunction segmentContext(\n seg: ResolvedSegment,\n mapping: TrussMapping,\n): { prefix: string; whenSelector?: AtomicRule[\"whenSelector\"] } {\n if (seg.whenPseudo) {\n const wp = seg.whenPseudo;\n return {\n prefix: whenPrefix(wp),\n whenSelector: {\n relationship: wp.relationship ?? \"ancestor\",\n markerClass: markerClassName(wp.markerNode),\n pseudo: wp.pseudo,\n },\n };\n }\n return { prefix: conditionPrefix(seg.pseudoClass, seg.mediaQuery, seg.pseudoElement, mapping.breakpoints) };\n}\n\n/** Build the base AtomicRule fields (non-when conditions). */\nfunction baseRuleFields(seg: ResolvedSegment): Pick<AtomicRule, \"pseudoClass\" | \"mediaQuery\" | \"pseudoElement\"> {\n return {\n pseudoClass: seg.pseudoClass ?? undefined,\n mediaQuery: seg.mediaQuery ?? undefined,\n pseudoElement: seg.pseudoElement ?? undefined,\n };\n}\n\n/** Collect atomic rules for a static segment (may have multiple CSS properties). */\nfunction collectStaticRules(rules: Map<string, AtomicRule>, seg: ResolvedSegment, mapping: TrussMapping): void {\n const { prefix, whenSelector } = segmentContext(seg, mapping);\n const isMultiProp = Object.keys(seg.defs).length > 1;\n\n for (const [cssProp, value] of Object.entries(seg.defs)) {\n const cssValue = String(value);\n const baseName = computeStaticBaseName(seg, cssProp, cssValue, isMultiProp, mapping);\n const className = prefix ? `${prefix}${baseName}` : baseName;\n\n if (!rules.has(className)) {\n rules.set(className, {\n className,\n cssProperty: camelToKebab(cssProp),\n cssValue,\n ...(!whenSelector && baseRuleFields(seg)),\n whenSelector,\n });\n }\n }\n}\n\n/** Collect atomic rules for a variable segment. */\nfunction collectVariableRules(rules: Map<string, AtomicRule>, seg: ResolvedSegment, mapping: TrussMapping): void {\n const { prefix, whenSelector } = segmentContext(seg, mapping);\n\n for (const prop of seg.variableProps!) {\n const className = prefix ? `${prefix}${seg.abbr}_var` : `${seg.abbr}_var`;\n const varName = toCssVariableName(className, seg.abbr, prop);\n const declaration = { cssProperty: camelToKebab(prop), cssValue: `var(${varName})`, cssVarName: varName };\n\n const existingRule = rules.get(className);\n if (!existingRule) {\n rules.set(className, {\n className,\n cssProperty: declaration.cssProperty,\n cssValue: declaration.cssValue,\n declarations: [declaration],\n cssVarName: varName,\n ...(!whenSelector && baseRuleFields(seg)),\n whenSelector,\n });\n continue;\n }\n\n existingRule.declarations ??= [\n {\n cssProperty: existingRule.cssProperty,\n cssValue: existingRule.cssValue,\n cssVarName: existingRule.cssVarName,\n },\n ];\n if (\n !existingRule.declarations.some(function (entry) {\n return entry.cssProperty === declaration.cssProperty;\n })\n ) {\n existingRule.declarations.push(declaration);\n }\n }\n\n // Extra static defs alongside variable props\n if (seg.variableExtraDefs) {\n for (const [cssProp, value] of Object.entries(seg.variableExtraDefs)) {\n const extraBase = `${seg.abbr}_${cssProp}`;\n const extraName = prefix ? `${prefix}${extraBase}` : extraBase;\n if (!rules.has(extraName)) {\n rules.set(extraName, {\n className: extraName,\n cssProperty: camelToKebab(cssProp),\n cssValue: String(value),\n ...(!whenSelector && baseRuleFields(seg)),\n whenSelector,\n });\n }\n }\n }\n}\n\n// -- CSS text generation --\n\n/**\n * Generate the full CSS text from collected rules, sorted by StyleX priority.\n *\n * Uses an additive priority system where property tier + pseudo + at-rule priorities\n * are summed to produce a single sort key, guaranteeing longhands beat shorthands,\n * pseudo-classes follow LVFHA order, and at-rules override base styles.\n */\nexport function generateCssText(rules: Map<string, AtomicRule>): string {\n const allRules = Array.from(rules.values());\n\n // Single flat sort by computed priority\n sortRulesByPriority(allRules);\n\n const lines: string[] = [];\n\n for (const rule of allRules) {\n lines.push(formatRule(rule));\n }\n\n // @property declarations for variable rules\n for (const rule of allRules) {\n for (const declaration of getRuleDeclarations(rule)) {\n if (declaration.cssVarName) {\n lines.push(`@property ${declaration.cssVarName} { syntax: \"*\"; inherits: false; }`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/** Format a single rule into its CSS text, dispatching by rule type. */\nfunction formatRule(rule: AtomicRule): string {\n if (rule.whenSelector) return formatWhenRule(rule);\n if (rule.mediaQuery && rule.pseudoClass) return formatMediaPseudoRule(rule);\n if (rule.mediaQuery && rule.pseudoElement) return formatMediaPseudoElementRule(rule);\n if (rule.mediaQuery) return formatMediaRule(rule);\n if (rule.pseudoClass && rule.pseudoElement) return formatPseudoRule(rule);\n if (rule.pseudoElement) return formatPseudoElementRule(rule);\n if (rule.pseudoClass) return formatPseudoRule(rule);\n return formatBaseRule(rule);\n}\n\nfunction formatBaseRule(rule: AtomicRule): string {\n return formatRuleBlock(`.${rule.className}`, rule);\n}\n\nfunction formatPseudoRule(rule: AtomicRule): string {\n const pe = rule.pseudoElement ? rule.pseudoElement : \"\";\n return formatRuleBlock(`.${rule.className}${rule.pseudoClass}${pe}`, rule);\n}\n\nfunction formatPseudoElementRule(rule: AtomicRule): string {\n return formatRuleBlock(`.${rule.className}${rule.pseudoElement}`, rule);\n}\n\nfunction formatWhenRule(rule: AtomicRule): string {\n const whenSelector = rule.whenSelector;\n if (!whenSelector) {\n return formatBaseRule(rule);\n }\n\n const markerSelector = `.${whenSelector.markerClass}${whenSelector.pseudo}`;\n const targetSelector = `.${rule.className}`;\n\n if (whenSelector.relationship === \"ancestor\") {\n return formatRuleBlock(`${markerSelector} ${targetSelector}`, rule);\n }\n if (whenSelector.relationship === \"descendant\") {\n return formatRuleBlock(`${targetSelector}:has(${markerSelector})`, rule);\n }\n if (whenSelector.relationship === \"siblingAfter\") {\n return formatRuleBlock(`${targetSelector}:has(~ ${markerSelector})`, rule);\n }\n if (whenSelector.relationship === \"siblingBefore\") {\n return formatRuleBlock(`${markerSelector} ~ ${targetSelector}`, rule);\n }\n if (whenSelector.relationship === \"anySibling\") {\n return formatRuleBlock(`${targetSelector}:has(~ ${markerSelector}), ${markerSelector} ~ ${targetSelector}`, rule);\n }\n\n return formatRuleBlock(`${markerSelector} ${targetSelector}`, rule);\n}\n\nfunction formatMediaRule(rule: AtomicRule): string {\n return formatNestedRuleBlock(rule.mediaQuery!, `.${rule.className}.${rule.className}`, rule);\n}\n\nfunction formatMediaPseudoRule(rule: AtomicRule): string {\n return formatNestedRuleBlock(rule.mediaQuery!, `.${rule.className}.${rule.className}${rule.pseudoClass}`, rule);\n}\n\nfunction formatMediaPseudoElementRule(rule: AtomicRule): string {\n const pe = rule.pseudoElement ?? \"\";\n return formatNestedRuleBlock(rule.mediaQuery!, `.${rule.className}.${rule.className}${pe}`, rule);\n}\n\nfunction getRuleDeclarations(rule: AtomicRule): Array<{ cssProperty: string; cssValue: string; cssVarName?: string }> {\n return rule.declarations ?? [{ cssProperty: rule.cssProperty, cssValue: rule.cssValue, cssVarName: rule.cssVarName }];\n}\n\nfunction formatRuleBlock(selector: string, rule: AtomicRule): string {\n const body = getRuleDeclarations(rule)\n .map(function (declaration) {\n return `${declaration.cssProperty}: ${declaration.cssValue};`;\n })\n .join(\" \");\n return `${selector} { ${body} }`;\n}\n\nfunction formatNestedRuleBlock(wrapper: string, selector: string, rule: AtomicRule): string {\n const body = getRuleDeclarations(rule)\n .map(function (declaration) {\n return `${declaration.cssProperty}: ${declaration.cssValue};`;\n })\n .join(\" \");\n return `${wrapper} { ${selector} { ${body} } }`;\n}\n\n// -- AST generation for style hash objects --\n\n/**\n * Build the style hash AST for a list of segments (from one Css.*.$ expression).\n *\n * Groups segments by CSS property and builds space-separated class bundles.\n * Returns an array of ObjectProperty nodes for `{ display: \"df\", color: \"black blue_h\" }`.\n */\nexport function buildStyleHashProperties(\n segments: ResolvedSegment[],\n mapping: TrussMapping,\n maybeIncHelperName?: string | null,\n): t.ObjectProperty[] {\n // Group: cssProperty -> list of { className, isVariable, isConditional, varName, argNode, incremented, appendPx }\n const propGroups = new Map<\n string,\n Array<{\n className: string;\n isVariable: boolean;\n /** Whether this entry has a condition prefix (pseudo/media/when). */\n isConditional: boolean;\n varName?: string;\n argNode?: unknown;\n incremented?: boolean;\n appendPx?: boolean;\n }>\n >();\n\n /** Push an entry, replacing earlier base-level entries when a new base-level entry overrides the same property. */\n function pushEntry(cssProp: string, entry: typeof propGroups extends Map<string, Array<infer E>> ? E : never): void {\n if (!propGroups.has(cssProp)) propGroups.set(cssProp, []);\n const entries = propGroups.get(cssProp)!;\n // A later base-level entry replaces earlier base-level entries for the same property.\n // Conditional entries (hover/media) always accumulate alongside base entries.\n if (!entry.isConditional) {\n for (let i = entries.length - 1; i >= 0; i--) {\n if (!entries[i].isConditional) {\n entries.splice(i, 1);\n }\n }\n }\n entries.push(entry);\n }\n\n for (const seg of segments) {\n if (seg.error || seg.styleArrayArg || seg.typographyLookup) continue;\n\n const { prefix } = segmentContext(seg, mapping);\n const isConditional = prefix !== \"\";\n\n if (seg.variableProps) {\n for (const prop of seg.variableProps) {\n const className = prefix ? `${prefix}${seg.abbr}_var` : `${seg.abbr}_var`;\n const varName = toCssVariableName(className, seg.abbr, prop);\n\n pushEntry(prop, {\n className,\n isVariable: true,\n isConditional,\n varName,\n argNode: seg.argNode,\n incremented: seg.incremented,\n appendPx: seg.appendPx,\n });\n }\n\n // Extra static defs\n if (seg.variableExtraDefs) {\n for (const [cssProp, value] of Object.entries(seg.variableExtraDefs)) {\n const extraBase = `${seg.abbr}_${cssProp}`;\n const extraName = prefix ? `${prefix}${extraBase}` : extraBase;\n pushEntry(cssProp, { className: extraName, isVariable: false, isConditional });\n }\n }\n } else {\n const isMultiProp = Object.keys(seg.defs).length > 1;\n\n for (const [cssProp, val] of Object.entries(seg.defs)) {\n const baseName = computeStaticBaseName(seg, cssProp, String(val), isMultiProp, mapping);\n const className = prefix ? `${prefix}${baseName}` : baseName;\n\n pushEntry(cssProp, { className, isVariable: false, isConditional });\n }\n }\n }\n\n // Build AST properties\n const properties: t.ObjectProperty[] = [];\n\n for (const [cssProp, entries] of Array.from(propGroups.entries())) {\n const classNames = entries.map((e) => e.className).join(\" \");\n const variableEntries = entries.filter((e) => e.isVariable);\n\n if (variableEntries.length > 0) {\n // Tuple: [classNames, { vars }]\n const varsProps: t.ObjectProperty[] = [];\n for (const dyn of variableEntries) {\n let valueExpr: t.Expression = dyn.argNode as t.Expression;\n if (dyn.incremented) {\n // Wrap with __maybeInc (or whatever name was reserved to avoid collisions)\n valueExpr = t.callExpression(t.identifier(maybeIncHelperName ?? \"__maybeInc\"), [valueExpr]);\n } else if (dyn.appendPx) {\n // Wrap with `${v}px`\n valueExpr = t.templateLiteral(\n [t.templateElement({ raw: \"\", cooked: \"\" }, false), t.templateElement({ raw: \"px\", cooked: \"px\" }, true)],\n [valueExpr],\n );\n }\n varsProps.push(t.objectProperty(t.stringLiteral(dyn.varName!), valueExpr));\n }\n\n const tuple = t.arrayExpression([t.stringLiteral(classNames), t.objectExpression(varsProps)]);\n\n properties.push(t.objectProperty(toPropertyKey(cssProp), tuple));\n } else {\n // Static: plain string\n properties.push(t.objectProperty(toPropertyKey(cssProp), t.stringLiteral(classNames)));\n }\n }\n\n return properties;\n}\n\n/** Build a CSS variable name from the real CSS property and class condition prefix. */\nfunction toCssVariableName(className: string, baseKey: string, cssProp: string): string {\n const baseClassName = `${baseKey}_var`;\n const cp = className.endsWith(baseClassName) ? className.slice(0, -baseClassName.length) : \"\";\n return `--${cp}${cssProp}`;\n}\n\n// -- Helper declarations --\n\n/** Build the per-file increment helper: `const __maybeInc = (inc) => typeof inc === \"string\" ? inc : \\`${inc * N}px\\`` */\nexport function buildMaybeIncDeclaration(helperName: string, increment: number): t.VariableDeclaration {\n const incParam = t.identifier(\"inc\");\n const body = t.blockStatement([\n t.returnStatement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.unaryExpression(\"typeof\", incParam), t.stringLiteral(\"string\")),\n incParam,\n t.templateLiteral(\n [t.templateElement({ raw: \"\", cooked: \"\" }, false), t.templateElement({ raw: \"px\", cooked: \"px\" }, true)],\n [t.binaryExpression(\"*\", incParam, t.numericLiteral(increment))],\n ),\n ),\n ),\n ]);\n\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(helperName), t.arrowFunctionExpression([incParam], body)),\n ]);\n}\n\n/** Use identifier keys when legal, otherwise string literal keys. */\nfunction toPropertyKey(key: string): t.Identifier | t.StringLiteral {\n return isValidIdentifier(key) ? t.identifier(key) : t.stringLiteral(key);\n}\n\nfunction isValidIdentifier(s: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s);\n}\n\n/** Build a runtime lookup table declaration: `const __typography = { f24: { fontSize: \"f24\" }, ... }`. */\nexport function buildRuntimeLookupDeclaration(\n lookupName: string,\n segmentsByName: Record<string, ResolvedSegment[]>,\n mapping: TrussMapping,\n): t.VariableDeclaration {\n const properties: t.ObjectProperty[] = [];\n for (const [name, segs] of Object.entries(segmentsByName)) {\n const hashProps = buildStyleHashProperties(segs, mapping);\n properties.push(t.objectProperty(t.identifier(name), t.objectExpression(hashProps)));\n }\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(lookupName), t.objectExpression(properties)),\n ]);\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Converted from Flow to TypeScript; otherwise kept as-is for easy updates from upstream.\n * Source: https://github.com/facebook/stylex/blob/1ddee1dde1d55134c7d4f6889d8cbf34091e72fd/packages/%40stylexjs/shared/src/utils/property-priorities.js\n */\n\n// Physical properties that have logical equivalents:\nconst longHandPhysical = new Set<string>();\n// Logical properties *and* all other long hand properties:\nconst longHandLogical = new Set<string>();\n// Shorthand properties that override longhand properties:\nconst shorthandsOfLonghands = new Set<string>();\n// Shorthand properties that override other shorthand properties:\nconst shorthandsOfShorthands = new Set<string>();\n\n// Using MDN data as a source of truth to populate the above sets\n// by group in alphabetical order:\n\n// Composition and Blending\nlongHandLogical.add(\"background-blend-mode\");\nlongHandLogical.add(\"isolation\");\nlongHandLogical.add(\"mix-blend-mode\");\n\n// CSS Animations\nshorthandsOfShorthands.add(\"animation\");\nlongHandLogical.add(\"animation-composition\");\nlongHandLogical.add(\"animation-delay\");\nlongHandLogical.add(\"animation-direction\");\nlongHandLogical.add(\"animation-duration\");\nlongHandLogical.add(\"animation-fill-mode\");\nlongHandLogical.add(\"animation-iteration-count\");\nlongHandLogical.add(\"animation-name\");\nlongHandLogical.add(\"animation-play-state\");\nshorthandsOfLonghands.add(\"animation-range\");\nlongHandLogical.add(\"animation-range-end\");\nlongHandLogical.add(\"animation-range-start\");\nlongHandLogical.add(\"animation-timing-function\");\nlongHandLogical.add(\"animation-timeline\");\n\nshorthandsOfLonghands.add(\"scroll-timeline\");\nlongHandLogical.add(\"scroll-timeline-axis\");\nlongHandLogical.add(\"scroll-timeline-name\");\n\nlongHandLogical.add(\"timeline-scope\");\n\nshorthandsOfLonghands.add(\"view-timeline\");\nlongHandLogical.add(\"view-timeline-axis\");\nlongHandLogical.add(\"view-timeline-inset\");\nlongHandLogical.add(\"view-timeline-name\");\n\n// CSS Backgrounds and Borders\nshorthandsOfShorthands.add(\"background\");\nlongHandLogical.add(\"background-attachment\");\nlongHandLogical.add(\"background-clip\");\nlongHandLogical.add(\"background-color\");\nlongHandLogical.add(\"background-image\");\nlongHandLogical.add(\"background-origin\");\nlongHandLogical.add(\"background-repeat\");\nlongHandLogical.add(\"background-size\");\nshorthandsOfLonghands.add(\"background-position\");\nlongHandLogical.add(\"background-position-x\");\nlongHandLogical.add(\"background-position-y\");\n\nshorthandsOfShorthands.add(\"border\"); // OF SHORTHANDS!\nshorthandsOfLonghands.add(\"border-color\");\nshorthandsOfLonghands.add(\"border-style\");\nshorthandsOfLonghands.add(\"border-width\");\nshorthandsOfShorthands.add(\"border-block\"); // Logical Properties\nlongHandLogical.add(\"border-block-color\"); // Logical Properties\nlongHandLogical.add(\"border-block-stylex\"); // Logical Properties\nlongHandLogical.add(\"border-block-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-block-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-top\");\nlongHandLogical.add(\"border-block-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-top-color\");\nlongHandLogical.add(\"border-block-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-top-style\");\nlongHandLogical.add(\"border-block-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-top-width\");\nshorthandsOfLonghands.add(\"border-block-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-bottom\");\nlongHandLogical.add(\"border-block-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-color\");\nlongHandLogical.add(\"border-block-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-style\");\nlongHandLogical.add(\"border-block-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-width\");\nshorthandsOfShorthands.add(\"border-inline\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-color\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-style\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-left\");\nlongHandLogical.add(\"border-inline-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-left-color\");\nlongHandLogical.add(\"border-inline-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-left-style\");\nlongHandLogical.add(\"border-inline-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-left-width\");\nshorthandsOfLonghands.add(\"border-inline-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-right\");\nlongHandLogical.add(\"border-inline-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-right-color\");\nlongHandLogical.add(\"border-inline-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-right-style\");\nlongHandLogical.add(\"border-inline-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-right-width\");\n\nshorthandsOfLonghands.add(\"border-image\");\nlongHandLogical.add(\"border-image-outset\");\nlongHandLogical.add(\"border-image-repeat\");\nlongHandLogical.add(\"border-image-slice\");\nlongHandLogical.add(\"border-image-source\");\nlongHandLogical.add(\"border-image-width\");\n\nshorthandsOfLonghands.add(\"border-radius\");\nlongHandLogical.add(\"border-start-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-start-start-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-start-radius\"); // Logical Properties\nlongHandPhysical.add(\"border-top-left-radius\");\nlongHandPhysical.add(\"border-top-right-radius\");\nlongHandPhysical.add(\"border-bottom-left-radius\");\nlongHandPhysical.add(\"border-bottom-right-radius\");\n\nshorthandsOfLonghands.add(\"corner-shape\");\nlongHandLogical.add(\"corner-start-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-start-end-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-end-shape\"); // Logical Properties\nlongHandPhysical.add(\"corner-top-left-shape\");\nlongHandPhysical.add(\"corner-top-right-shape\");\nlongHandPhysical.add(\"corner-bottom-left-shape\");\nlongHandPhysical.add(\"corner-bottom-right-shape\");\n\nlongHandLogical.add(\"box-shadow\");\n\n// CSS Basic User Interface\nlongHandLogical.add(\"accent-color\");\nlongHandLogical.add(\"appearance\");\nlongHandLogical.add(\"aspect-ratio\");\n\nshorthandsOfLonghands.add(\"caret\");\nlongHandLogical.add(\"caret-color\");\nlongHandLogical.add(\"caret-shape\");\n\nlongHandLogical.add(\"cursor\");\nlongHandLogical.add(\"ime-mode\");\nlongHandLogical.add(\"input-security\");\n\nshorthandsOfLonghands.add(\"outline\");\nlongHandLogical.add(\"outline-color\");\nlongHandLogical.add(\"outline-offset\");\nlongHandLogical.add(\"outline-style\");\nlongHandLogical.add(\"outline-width\");\n\nlongHandLogical.add(\"pointer-events\");\nlongHandLogical.add(\"resize\"); // horizontal, vertical, block, inline, both\nlongHandLogical.add(\"text-overflow\");\nlongHandLogical.add(\"user-select\");\n\n// CSS Box Alignment\nshorthandsOfLonghands.add(\"grid-gap\"); // alias for `gap`\nshorthandsOfLonghands.add(\"gap\");\nlongHandLogical.add(\"grid-row-gap\"); // alias for `row-gap`\nlongHandLogical.add(\"row-gap\");\nlongHandLogical.add(\"grid-column-gap\"); // alias for `column-gap`\nlongHandLogical.add(\"column-gap\");\n\nshorthandsOfLonghands.add(\"place-content\");\nlongHandLogical.add(\"align-content\");\nlongHandLogical.add(\"justify-content\");\n\nshorthandsOfLonghands.add(\"place-items\");\nlongHandLogical.add(\"align-items\");\nlongHandLogical.add(\"justify-items\");\n\nshorthandsOfLonghands.add(\"place-self\");\nlongHandLogical.add(\"align-self\");\nlongHandLogical.add(\"justify-self\");\n\n// CSS Box Model\nlongHandLogical.add(\"box-sizing\");\n\nlongHandLogical.add(\"block-size\"); // Logical Properties\nlongHandPhysical.add(\"height\");\nlongHandLogical.add(\"inline-size\"); // Logical Properties\nlongHandPhysical.add(\"width\");\n\nlongHandLogical.add(\"max-block-size\"); // Logical Properties\nlongHandPhysical.add(\"max-height\");\nlongHandLogical.add(\"max-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"max-width\");\nlongHandLogical.add(\"min-block-size\"); // Logical Properties\nlongHandPhysical.add(\"min-height\");\nlongHandLogical.add(\"min-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"min-width\");\n\nshorthandsOfShorthands.add(\"margin\");\nshorthandsOfLonghands.add(\"margin-block\"); // Logical Properties\nlongHandLogical.add(\"margin-block-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-top\");\nlongHandLogical.add(\"margin-block-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-bottom\");\nshorthandsOfLonghands.add(\"margin-inline\"); // Logical Properties\nlongHandLogical.add(\"margin-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-left\");\nlongHandLogical.add(\"margin-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-right\");\n\nlongHandLogical.add(\"margin-trim\");\n\nshorthandsOfLonghands.add(\"overscroll-behavior\");\nlongHandLogical.add(\"overscroll-behavior-block\");\nlongHandPhysical.add(\"overscroll-behavior-y\");\nlongHandLogical.add(\"overscroll-behavior-inline\");\nlongHandPhysical.add(\"overscroll-behavior-x\");\n\nshorthandsOfShorthands.add(\"padding\");\nshorthandsOfLonghands.add(\"padding-block\"); // Logical Properties\nlongHandLogical.add(\"padding-block-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-top\");\nlongHandLogical.add(\"padding-block-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-bottom\");\nshorthandsOfLonghands.add(\"padding-inline\"); // Logical Properties\nlongHandLogical.add(\"padding-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-left\");\nlongHandLogical.add(\"padding-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-right\");\n\nlongHandLogical.add(\"visibility\");\n\n// CSS Color\nlongHandLogical.add(\"color\");\nlongHandLogical.add(\"color-scheme\");\nlongHandLogical.add(\"forced-color-adjust\");\nlongHandLogical.add(\"opacity\");\nlongHandLogical.add(\"print-color-adjust\");\n\n// CSS Columns\nshorthandsOfLonghands.add(\"columns\");\nlongHandLogical.add(\"column-count\");\nlongHandLogical.add(\"column-width\");\n\nlongHandLogical.add(\"column-fill\");\nlongHandLogical.add(\"column-span\");\n\nshorthandsOfLonghands.add(\"column-rule\");\nlongHandLogical.add(\"column-rule-color\");\nlongHandLogical.add(\"column-rule-style\");\nlongHandLogical.add(\"column-rule-width\");\n\n// CSS Containment\nlongHandLogical.add(\"contain\");\n\nshorthandsOfLonghands.add(\"contain-intrinsic-size\");\nlongHandLogical.add(\"contain-intrinsic-block-size\");\nlongHandLogical.add(\"contain-intrinsic-width\");\nlongHandLogical.add(\"contain-intrinsic-height\");\nlongHandLogical.add(\"contain-intrinsic-inline-size\");\n\nshorthandsOfLonghands.add(\"container\");\nlongHandLogical.add(\"container-name\");\nlongHandLogical.add(\"container-type\");\n\nlongHandLogical.add(\"content-visibility\");\n\n// CSS Counter Styles\nlongHandLogical.add(\"counter-increment\");\nlongHandLogical.add(\"counter-reset\");\nlongHandLogical.add(\"counter-set\");\n\n// CSS Display\nlongHandLogical.add(\"display\");\n\n// CSS Flexible Box Layout\nshorthandsOfLonghands.add(\"flex\");\nlongHandLogical.add(\"flex-basis\");\nlongHandLogical.add(\"flex-grow\");\nlongHandLogical.add(\"flex-shrink\");\n\nshorthandsOfLonghands.add(\"flex-flow\");\nlongHandLogical.add(\"flex-direction\");\nlongHandLogical.add(\"flex-wrap\");\n\nlongHandLogical.add(\"order\");\n\n// CSS Fonts\nshorthandsOfShorthands.add(\"font\");\nlongHandLogical.add(\"font-family\");\nlongHandLogical.add(\"font-size\");\nlongHandLogical.add(\"font-stretch\");\nlongHandLogical.add(\"font-style\");\nlongHandLogical.add(\"font-weight\");\nlongHandLogical.add(\"line-height\");\nshorthandsOfLonghands.add(\"font-variant\");\nlongHandLogical.add(\"font-variant-alternates\");\nlongHandLogical.add(\"font-variant-caps\");\nlongHandLogical.add(\"font-variant-east-asian\");\nlongHandLogical.add(\"font-variant-emoji\");\nlongHandLogical.add(\"font-variant-ligatures\");\nlongHandLogical.add(\"font-variant-numeric\");\nlongHandLogical.add(\"font-variant-position\");\n\nlongHandLogical.add(\"font-feature-settings\");\nlongHandLogical.add(\"font-kerning\");\nlongHandLogical.add(\"font-language-override\");\nlongHandLogical.add(\"font-optical-sizing\");\nlongHandLogical.add(\"font-palette\");\nlongHandLogical.add(\"font-variation-settings\");\nlongHandLogical.add(\"font-size-adjust\");\nlongHandLogical.add(\"font-smooth\"); // Non-standard\nlongHandLogical.add(\"font-synthesis-position\");\nlongHandLogical.add(\"font-synthesis-small-caps\");\nlongHandLogical.add(\"font-synthesis-style\");\nlongHandLogical.add(\"font-synthesis-weight\");\n\nlongHandLogical.add(\"line-height-step\");\n\n// CSS Fragmentation\nlongHandLogical.add(\"box-decoration-break\");\nlongHandLogical.add(\"break-after\");\nlongHandLogical.add(\"break-before\");\nlongHandLogical.add(\"break-inside\");\nlongHandLogical.add(\"orphans\");\nlongHandLogical.add(\"widows\");\n\n// CSS Generated Content\nlongHandLogical.add(\"content\");\nlongHandLogical.add(\"quotes\");\n\n// CSS Grid Layout\nshorthandsOfShorthands.add(\"grid\");\nlongHandLogical.add(\"grid-auto-flow\");\nlongHandLogical.add(\"grid-auto-rows\");\nlongHandLogical.add(\"grid-auto-columns\");\nshorthandsOfShorthands.add(\"grid-template\");\nshorthandsOfLonghands.add(\"grid-template-areas\");\nlongHandLogical.add(\"grid-template-columns\");\nlongHandLogical.add(\"grid-template-rows\");\n\nshorthandsOfShorthands.add(\"grid-area\");\nshorthandsOfLonghands.add(\"grid-row\");\nlongHandLogical.add(\"grid-row-start\");\nlongHandLogical.add(\"grid-row-end\");\nshorthandsOfLonghands.add(\"grid-column\");\nlongHandLogical.add(\"grid-column-start\");\nlongHandLogical.add(\"grid-column-end\");\n\nlongHandLogical.add(\"align-tracks\");\nlongHandLogical.add(\"justify-tracks\");\nlongHandLogical.add(\"masonry-auto-flow\");\n\n// CSS Images\nlongHandLogical.add(\"image-orientation\");\nlongHandLogical.add(\"image-rendering\");\nlongHandLogical.add(\"image-resolution\");\nlongHandLogical.add(\"object-fit\");\nlongHandLogical.add(\"object-position\");\n\n// CSS Inline\nlongHandLogical.add(\"initial-letter\");\nlongHandLogical.add(\"initial-letter-align\");\n\n// CSS Lists and Counters\nshorthandsOfLonghands.add(\"list-style\");\nlongHandLogical.add(\"list-style-image\");\nlongHandLogical.add(\"list-style-position\");\nlongHandLogical.add(\"list-style-type\");\n\n// CSS Masking\nlongHandLogical.add(\"clip\"); // @deprecated\nlongHandLogical.add(\"clip-path\");\n\nshorthandsOfLonghands.add(\"mask\");\nlongHandLogical.add(\"mask-clip\");\nlongHandLogical.add(\"mask-composite\");\nlongHandLogical.add(\"mask-image\");\nlongHandLogical.add(\"mask-mode\");\nlongHandLogical.add(\"mask-origin\");\nlongHandLogical.add(\"mask-position\");\nlongHandLogical.add(\"mask-repeat\");\nlongHandLogical.add(\"mask-size\");\n\nlongHandLogical.add(\"mask-type\");\n\nshorthandsOfLonghands.add(\"mask-border\");\nlongHandLogical.add(\"mask-border-mode\");\nlongHandLogical.add(\"mask-border-outset\");\nlongHandLogical.add(\"mask-border-repeat\");\nlongHandLogical.add(\"mask-border-slice\");\nlongHandLogical.add(\"mask-border-source\");\nlongHandLogical.add(\"mask-border-width\");\n\n// CSS Miscellaneous\nshorthandsOfShorthands.add(\"all\"); // avoid!\nlongHandLogical.add(\"text-rendering\");\n\n// CSS Motion Path\nshorthandsOfLonghands.add(\"offset\");\nlongHandLogical.add(\"offset-anchor\");\nlongHandLogical.add(\"offset-distance\");\nlongHandLogical.add(\"offset-path\");\nlongHandLogical.add(\"offset-position\");\nlongHandLogical.add(\"offset-rotate\");\n\n// CSS Overflow\nlongHandLogical.add(\"-webkit-box-orient\");\nlongHandLogical.add(\"-webkit-line-clamp\");\n\nshorthandsOfLonghands.add(\"overflow\");\nlongHandLogical.add(\"overflow-block\");\nlongHandPhysical.add(\"overflow-y\");\nlongHandLogical.add(\"overflow-inline\");\nlongHandPhysical.add(\"overflow-x\");\n\nlongHandLogical.add(\"overflow-clip-margin\"); // partial support\n\nlongHandLogical.add(\"scroll-gutter\");\nlongHandLogical.add(\"scroll-behavior\");\n\n// CSS Pages\nlongHandLogical.add(\"page\");\nlongHandLogical.add(\"page-break-after\");\nlongHandLogical.add(\"page-break-before\");\nlongHandLogical.add(\"page-break-inside\");\n\n// CSS Positioning\nshorthandsOfShorthands.add(\"inset\"); // Logical Properties\nshorthandsOfLonghands.add(\"inset-block\"); // Logical Properties\nlongHandLogical.add(\"inset-block-start\"); // Logical Properties\nlongHandPhysical.add(\"top\");\nlongHandLogical.add(\"inset-block-end\"); // Logical Properties\nlongHandPhysical.add(\"bottom\");\nshorthandsOfLonghands.add(\"inset-inline\"); // Logical Properties\nlongHandLogical.add(\"inset-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"left\");\nlongHandLogical.add(\"inset-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"right\");\n\nlongHandLogical.add(\"clear\");\nlongHandLogical.add(\"float\");\nlongHandLogical.add(\"position\");\nlongHandLogical.add(\"z-index\");\n\n// CSS Ruby\nlongHandLogical.add(\"ruby-align\");\nlongHandLogical.add(\"ruby-merge\");\nlongHandLogical.add(\"ruby-position\");\n\n// CSS Scroll Anchoring\nlongHandLogical.add(\"overflow-anchor\");\n\n// CSS Scroll Snap\nshorthandsOfShorthands.add(\"scroll-margin\");\nshorthandsOfLonghands.add(\"scroll-margin-block\");\nlongHandLogical.add(\"scroll-margin-block-start\");\nlongHandPhysical.add(\"scroll-margin-top\");\nlongHandLogical.add(\"scroll-margin-block-end\");\nlongHandPhysical.add(\"scroll-margin-bottom\");\nshorthandsOfLonghands.add(\"scroll-margin-inline\");\nlongHandLogical.add(\"scroll-margin-inline-start\");\nlongHandPhysical.add(\"scroll-margin-left\");\nlongHandLogical.add(\"scroll-margin-inline-end\");\nlongHandPhysical.add(\"scroll-margin-right\");\n\nshorthandsOfShorthands.add(\"scroll-padding\");\nshorthandsOfLonghands.add(\"scroll-padding-block\");\nlongHandLogical.add(\"scroll-padding-block-start\");\nlongHandPhysical.add(\"scroll-padding-top\");\nlongHandLogical.add(\"scroll-padding-block-end\");\nlongHandPhysical.add(\"scroll-padding-bottom\");\nshorthandsOfLonghands.add(\"scroll-padding-inline\");\nlongHandLogical.add(\"scroll-padding-inline-start\");\nlongHandPhysical.add(\"scroll-padding-left\");\nlongHandLogical.add(\"scroll-padding-inline-end\");\nlongHandPhysical.add(\"scroll-padding-right\");\n\nlongHandLogical.add(\"scroll-snap-align\");\nlongHandLogical.add(\"scroll-snap-stop\");\nshorthandsOfLonghands.add(\"scroll-snap-type\");\n\n// CSS Scrollbars\nlongHandLogical.add(\"scrollbar-color\");\nlongHandLogical.add(\"scrollbar-width\");\n\n// CSS Shapes\nlongHandLogical.add(\"shape-image-threshold\");\nlongHandLogical.add(\"shape-margin\");\nlongHandLogical.add(\"shape-outside\");\n\n// CSS Speech\nlongHandLogical.add(\"azimuth\");\n\n// CSS Table\nlongHandLogical.add(\"border-collapse\");\nlongHandLogical.add(\"border-spacing\");\nlongHandLogical.add(\"caption-side\");\nlongHandLogical.add(\"empty-cells\");\nlongHandLogical.add(\"table-layout\");\nlongHandLogical.add(\"vertical-align\");\n\n// CSS Text Decoration\nshorthandsOfLonghands.add(\"text-decoration\");\nlongHandLogical.add(\"text-decoration-color\");\nlongHandLogical.add(\"text-decoration-line\");\nlongHandLogical.add(\"text-decoration-skip\");\nlongHandLogical.add(\"text-decoration-skip-ink\");\nlongHandLogical.add(\"text-decoration-style\");\nlongHandLogical.add(\"text-decoration-thickness\");\n\nshorthandsOfLonghands.add(\"text-emphasis\");\nlongHandLogical.add(\"text-emphasis-color\");\nlongHandLogical.add(\"text-emphasis-position\");\nlongHandLogical.add(\"text-emphasis-style\");\nlongHandLogical.add(\"text-shadow\");\nlongHandLogical.add(\"text-underline-offset\");\nlongHandLogical.add(\"text-underline-position\");\n\n// CSS Text\nlongHandLogical.add(\"hanging-punctuation\");\nlongHandLogical.add(\"hyphenate-character\");\nlongHandLogical.add(\"hyphenate-limit-chars\");\nlongHandLogical.add(\"hyphens\");\nlongHandLogical.add(\"letter-spacing\");\nlongHandLogical.add(\"line-break\");\nlongHandLogical.add(\"overflow-wrap\");\nlongHandLogical.add(\"paint-order\");\nlongHandLogical.add(\"tab-size\");\nlongHandLogical.add(\"text-align\");\nlongHandLogical.add(\"text-align-last\");\nlongHandLogical.add(\"text-indent\");\nlongHandLogical.add(\"text-justify\");\nlongHandLogical.add(\"text-size-adjust\");\nlongHandLogical.add(\"text-transform\");\nlongHandLogical.add(\"text-wrap\");\nlongHandLogical.add(\"white-space\");\nlongHandLogical.add(\"white-space-collapse\");\nlongHandLogical.add(\"word-break\");\nlongHandLogical.add(\"word-spacing\");\nlongHandLogical.add(\"word-wrap\");\n\n// CSS Transforms\nlongHandLogical.add(\"backface-visibility\");\nlongHandLogical.add(\"perspective\");\nlongHandLogical.add(\"perspective-origin\");\nlongHandLogical.add(\"rotate\");\nlongHandLogical.add(\"scale\");\nlongHandLogical.add(\"transform\");\nlongHandLogical.add(\"transform-box\");\nlongHandLogical.add(\"transform-origin\");\nlongHandLogical.add(\"transform-style\");\nlongHandLogical.add(\"translate\");\n\n// CSS Transitions\nshorthandsOfLonghands.add(\"transition\");\nlongHandLogical.add(\"transition-delay\");\nlongHandLogical.add(\"transition-duration\");\nlongHandLogical.add(\"transition-property\");\nlongHandLogical.add(\"transition-timing-function\");\n\n// CSS View Transitions\nlongHandLogical.add(\"view-transition-name\");\n\n// CSS Will Change\nlongHandLogical.add(\"will-change\");\n\n// CSS Writing Modes\nlongHandLogical.add(\"direction\");\nlongHandLogical.add(\"text-combine-upright\");\nlongHandLogical.add(\"text-orientation\");\nlongHandLogical.add(\"unicode-bidi\");\nlongHandLogical.add(\"writing-mode\");\n\n// CSS Filter Effects\nlongHandLogical.add(\"backdrop-filter\");\nlongHandLogical.add(\"filter\");\n\n// MathML\nlongHandLogical.add(\"math-depth\");\nlongHandLogical.add(\"math-shift\");\nlongHandLogical.add(\"math-style\");\n\n// CSS Pointer Events\nlongHandLogical.add(\"touch-action\");\n\nexport const PSEUDO_CLASS_PRIORITIES: Readonly<Record<string, number>> = {\n \":is\": 40,\n \":where\": 40,\n \":not\": 40,\n \":has\": 45,\n \":dir\": 50,\n \":lang\": 51,\n \":first-child\": 52,\n \":first-of-type\": 53,\n \":last-child\": 54,\n \":last-of-type\": 55,\n \":only-child\": 56,\n \":only-of-type\": 57,\n \":nth-child\": 60,\n \":nth-last-child\": 61,\n \":nth-of-type\": 62,\n \":nth-last-of-type\": 63,\n \":empty\": 70,\n \":link\": 80,\n \":any-link\": 81,\n \":local-link\": 82,\n \":target-within\": 83,\n \":target\": 84,\n \":visited\": 85,\n \":enabled\": 91,\n \":disabled\": 92,\n \":required\": 93,\n \":optional\": 94,\n \":read-only\": 95,\n \":read-write\": 96,\n \":placeholder-shown\": 97,\n \":in-range\": 98,\n \":out-of-range\": 99,\n \":default\": 100,\n \":checked\": 101,\n \":indeterminate\": 101,\n \":blank\": 102,\n \":valid\": 103,\n \":invalid\": 104,\n \":user-invalid\": 105,\n \":autofill\": 110,\n \":picture-in-picture\": 120,\n \":modal\": 121,\n \":fullscreen\": 122,\n \":paused\": 123,\n \":playing\": 124,\n \":current\": 125,\n \":past\": 126,\n \":future\": 127,\n \":hover\": 130,\n \":focus-within\": 140,\n \":focus\": 150,\n \":focus-visible\": 160,\n \":active\": 170,\n};\n\nexport const AT_RULE_PRIORITIES: Readonly<Record<string, number>> = {\n \"@supports\": 30,\n \"@media\": 200,\n \"@container\": 300,\n};\n\nexport const PSEUDO_ELEMENT_PRIORITY: number = 5000;\n\n/** Get the property tier for a CSS property (kebab-case). */\nexport function getPropertyPriority(property: string): number {\n if (shorthandsOfShorthands.has(property)) return 1000;\n if (shorthandsOfLonghands.has(property)) return 2000;\n if (longHandLogical.has(property)) return 3000;\n if (longHandPhysical.has(property)) return 4000;\n // Unknown properties default to 3000 (longhand) — safest default\n return 3000;\n}\n\n/** Get the priority for a pseudo-class selector. */\nexport function getPseudoClassPriority(pseudo: string): number {\n const leadingPseudo = pseudo.trim().match(/^::?[a-zA-Z-]+/)?.[0] ?? pseudo.split(\"(\")[0];\n const base = leadingPseudo.replace(/[A-Z]/g, function (match) {\n return `-${match.toLowerCase()}`;\n });\n return PSEUDO_CLASS_PRIORITIES[base] ?? 40;\n}\n\n/** Get the priority for an at-rule. */\nexport function getAtRulePriority(atRule: string): number {\n if (atRule.startsWith(\"--\")) return 1;\n if (atRule.startsWith(\"@supports\")) return AT_RULE_PRIORITIES[\"@supports\"];\n if (atRule.startsWith(\"@media\")) return AT_RULE_PRIORITIES[\"@media\"];\n if (atRule.startsWith(\"@container\")) return AT_RULE_PRIORITIES[\"@container\"];\n return 0;\n}\n","/**\n * Computes CSS rule priority using StyleX's priority system.\n *\n * Priority is an additive sum: propertyPriority + pseudoPriority + atRulePriority + pseudoElementPriority.\n * Rules are sorted by this number before emission, guaranteeing longhands beat shorthands,\n * pseudo-classes follow LVFHA order, and at-rules override base styles — all deterministically.\n */\n\nimport {\n getPropertyPriority,\n getPseudoClassPriority,\n getAtRulePriority,\n PSEUDO_ELEMENT_PRIORITY,\n} from \"./property-priorities\";\nimport type { AtomicRule } from \"./emit-truss\";\n\n/** Relationship base priorities for when() selectors, matching StyleX's relational selector system. */\nconst RELATIONSHIP_BASE: Record<string, number> = {\n ancestor: 10,\n descendant: 15,\n anySibling: 20,\n siblingBefore: 30,\n siblingAfter: 40,\n};\n\n/**\n * Compute the numeric priority for a single AtomicRule.\n *\n * I.e. `{ cssProperty: \"border-top-color\", pseudoClass: \":hover\", mediaQuery: \"@media ...\" }`\n * → 4000 (physical longhand) + 130 (:hover) + 200 (@media) = 4330\n */\nexport function computeRulePriority(rule: AtomicRule): number {\n let priority = getPropertyPriority(rule.cssProperty);\n\n if (rule.pseudoElement) {\n priority += PSEUDO_ELEMENT_PRIORITY;\n }\n\n if (rule.pseudoClass) {\n priority += getPseudoClassPriority(rule.pseudoClass);\n }\n\n if (rule.mediaQuery) {\n priority += getAtRulePriority(rule.mediaQuery);\n }\n\n if (rule.whenSelector) {\n const relBase = RELATIONSHIP_BASE[rule.whenSelector.relationship] ?? 10;\n const pseudoFraction = getPseudoClassPriority(rule.whenSelector.pseudo) / 100;\n priority += relBase + pseudoFraction;\n }\n\n // Variable rules get a small bonus (+0.5) so they sort after static rules for the same property\n if (isVariableRule(rule)) {\n priority += 0.5;\n }\n\n return priority;\n}\n\n/** Returns true if this rule uses CSS custom property var() values. */\nfunction isVariableRule(rule: AtomicRule): boolean {\n if (rule.declarations) {\n return rule.declarations.some(function (d) {\n return d.cssVarName !== undefined;\n });\n }\n return rule.cssVarName !== undefined;\n}\n\n/**\n * Sort an array of AtomicRules in-place by their computed priority.\n *\n * When two rules have the same priority (e.g. two different longhands both at 3000),\n * we tiebreak by class name so the output is fully deterministic regardless of\n * file processing order (which differs between dev HMR and production builds).\n */\nexport function sortRulesByPriority(rules: AtomicRule[]): void {\n rules.sort(function (a, b) {\n const diff = computeRulePriority(a) - computeRulePriority(b);\n if (diff !== 0) return diff;\n // Alphabetical tiebreaker ensures identical output in dev and production\n return a.className < b.className ? -1 : a.className > b.className ? 1 : 0;\n });\n}\n","import { parse } from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport type { NodePath } from \"@babel/traverse\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport { basename } from \"path\";\nimport type { TrussMapping, ResolvedSegment } from \"./types\";\nimport { resolveFullChain, type ResolvedChain } from \"./resolve-chain\";\nimport {\n collectTopLevelBindings,\n reservePreferredName,\n findCssImportBinding,\n findCssBuilderBinding,\n removeCssImport,\n hasCssMethodCall,\n findNamedImportBinding,\n findImportDeclaration,\n replaceCssImportWithNamedImports,\n upsertNamedImports,\n extractChain,\n} from \"./ast-utils\";\nimport {\n collectAtomicRules,\n generateCssText,\n buildMaybeIncDeclaration,\n buildRuntimeLookupDeclaration,\n} from \"./emit-truss\";\nimport { rewriteExpressionSites, type ExpressionSite } from \"./rewrite-sites\";\n\n// Babel packages are CJS today; normalize default interop across loaders.\nconst traverse = ((_traverse as unknown as { default?: typeof _traverse }).default ?? _traverse) as typeof _traverse;\nconst generate = ((_generate as unknown as { default?: typeof _generate }).default ?? _generate) as typeof _generate;\n\nexport interface TransformResult {\n code: string;\n map?: unknown;\n /** The generated CSS text for this file's Truss usages. */\n css: string;\n /** The atomic CSS rules collected during this transform, keyed by class name. */\n rules: Map<string, import(\"./emit-truss\").AtomicRule>;\n}\n\nexport interface TransformTrussOptions {\n debug?: boolean;\n /** When true, inject `__injectTrussCSS(cssText)` call for jsdom/test environments. */\n injectCss?: boolean;\n}\n\n/**\n * The core transform function. Given a source file's code and the truss mapping,\n * finds all `Css.*.$` expressions and rewrites them into Truss-native style hash\n * objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Returns null if the file doesn't use Css.\n */\nexport function transformTruss(\n code: string,\n filename: string,\n mapping: TrussMapping,\n options: TransformTrussOptions = {},\n): TransformResult | null {\n // Fast bail: skip files that don't reference Css\n if (!code.includes(\"Css\")) return null;\n\n const ast = parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n });\n\n // Step 1: Find the Css binding name — either from an import or a local `new CssBuilder(...)` declaration\n const cssImportBinding = findCssImportBinding(ast);\n const cssBindingName = cssImportBinding ?? findCssBuilderBinding(ast);\n if (!cssBindingName) return null;\n const cssIsImported = cssImportBinding !== null;\n\n // Step 2: Collect all Css expression sites\n const sites: ExpressionSite[] = [];\n const errorMessages: Array<{ message: string; line: number | null }> = [];\n\n traverse(ast, {\n MemberExpression(path: NodePath<t.MemberExpression>) {\n if (!t.isIdentifier(path.node.property, { name: \"$\" })) return;\n if (path.node.computed) return;\n\n const chain = extractChain(path.node.object, cssBindingName);\n if (!chain) return;\n\n const parentPath = path.parentPath;\n if (parentPath && parentPath.isMemberExpression() && t.isIdentifier(parentPath.node.property, { name: \"$\" })) {\n return;\n }\n\n const resolvedChain = resolveFullChain(chain, mapping);\n sites.push({ path, resolvedChain });\n\n const line = path.node.loc?.start.line ?? null;\n for (const err of resolvedChain.errors) {\n errorMessages.push({ message: err, line });\n }\n },\n });\n\n // Also check for Css.props(...) calls which need rewriting even without Css.$ sites\n const hasCssPropsCall = hasCssMethodCall(ast, cssBindingName, \"props\");\n if (sites.length === 0 && !hasCssPropsCall) return null;\n\n // Step 3: Collect atomic rules for CSS generation\n const chains = sites.map((s) => s.resolvedChain);\n const { rules, needsMaybeInc } = collectAtomicRules(chains, mapping);\n const cssText = generateCssText(rules);\n\n // Step 4: Reserve local names for injected helpers\n const usedTopLevelNames = collectTopLevelBindings(ast);\n const maybeIncHelperName = needsMaybeInc ? reservePreferredName(usedTopLevelNames, \"__maybeInc\") : null;\n const existingMergePropsHelperName = findNamedImportBinding(ast, \"@homebound/truss/runtime\", \"mergeProps\");\n const mergePropsHelperName = existingMergePropsHelperName ?? reservePreferredName(usedTopLevelNames, \"mergeProps\");\n const needsMergePropsHelper = { current: false };\n const existingTrussPropsHelperName = findNamedImportBinding(ast, \"@homebound/truss/runtime\", \"trussProps\");\n const trussPropsHelperName = existingTrussPropsHelperName ?? reservePreferredName(usedTopLevelNames, \"trussProps\");\n const needsTrussPropsHelper = { current: false };\n const existingTrussDebugInfoName = findNamedImportBinding(ast, \"@homebound/truss/runtime\", \"TrussDebugInfo\");\n const trussDebugInfoName = existingTrussDebugInfoName ?? reservePreferredName(usedTopLevelNames, \"TrussDebugInfo\");\n const needsTrussDebugInfo = { current: false };\n\n // Collect typography runtime lookups\n const runtimeLookupNames = new Map<string, string>();\n const runtimeLookups = collectRuntimeLookups(chains);\n for (const [lookupKey] of runtimeLookups) {\n runtimeLookupNames.set(lookupKey, reservePreferredName(usedTopLevelNames, `__${lookupKey}`));\n }\n\n // Step 5: Rewrite Css sites in-place\n rewriteExpressionSites({\n ast,\n sites,\n cssBindingName,\n filename: basename(filename),\n debug: options.debug ?? false,\n mapping,\n maybeIncHelperName,\n mergePropsHelperName,\n needsMergePropsHelper,\n trussPropsHelperName,\n needsTrussPropsHelper,\n trussDebugInfoName,\n needsTrussDebugInfo,\n runtimeLookupNames,\n });\n\n // Step 6: Prepare runtime imports before removing the Css import.\n const runtimeImports: Array<{ importedName: string; localName: string }> = [];\n if (needsTrussPropsHelper.current && !existingTrussPropsHelperName) {\n runtimeImports.push({ importedName: \"trussProps\", localName: trussPropsHelperName });\n }\n if (needsMergePropsHelper.current && !existingMergePropsHelperName) {\n runtimeImports.push({ importedName: \"mergeProps\", localName: mergePropsHelperName });\n }\n if (needsTrussDebugInfo.current && !existingTrussDebugInfoName) {\n runtimeImports.push({ importedName: \"TrussDebugInfo\", localName: trussDebugInfoName });\n }\n if (options.injectCss) {\n runtimeImports.push({ importedName: \"__injectTrussCSS\", localName: \"__injectTrussCSS\" });\n }\n\n // Step 7: Remove/replace the Css import and inject runtime imports.\n // When Css comes from a local `new CssBuilder(...)` (tsup bundles), skip import removal.\n let reusedCssImportLine = false;\n if (cssIsImported) {\n reusedCssImportLine =\n runtimeImports.length > 0 &&\n findImportDeclaration(ast, \"@homebound/truss/runtime\") === null &&\n replaceCssImportWithNamedImports(ast, cssBindingName, \"@homebound/truss/runtime\", runtimeImports);\n\n if (!reusedCssImportLine) {\n removeCssImport(ast, cssBindingName);\n }\n }\n\n if (runtimeImports.length > 0 && !reusedCssImportLine) {\n upsertNamedImports(ast, \"@homebound/truss/runtime\", runtimeImports);\n }\n\n // Step 8: Insert helper declarations after imports\n const declarationsToInsert: t.Statement[] = [];\n if (maybeIncHelperName) {\n declarationsToInsert.push(buildMaybeIncDeclaration(maybeIncHelperName, mapping.increment));\n }\n\n // Insert runtime lookup tables for typography\n for (const [lookupKey, lookup] of runtimeLookups) {\n const lookupName = runtimeLookupNames.get(lookupKey);\n if (!lookupName) continue;\n declarationsToInsert.push(buildRuntimeLookupDeclaration(lookupName, lookup.segmentsByName, mapping));\n }\n\n // Inject __injectTrussCSS call if requested\n if (options.injectCss && cssText.length > 0) {\n declarationsToInsert.push(\n t.expressionStatement(t.callExpression(t.identifier(\"__injectTrussCSS\"), [t.stringLiteral(cssText)])),\n );\n }\n\n // Emit console.error calls for any unsupported patterns\n for (const { message, line } of errorMessages) {\n const location = line !== null ? `${filename}:${line}` : filename;\n const logMessage = `${message} (${location})`;\n declarationsToInsert.push(\n t.expressionStatement(\n t.callExpression(t.memberExpression(t.identifier(\"console\"), t.identifier(\"error\")), [\n t.stringLiteral(logMessage),\n ]),\n ),\n );\n }\n\n if (declarationsToInsert.length > 0) {\n const insertIndex = ast.program.body.findIndex(function (node) {\n return !t.isImportDeclaration(node);\n });\n ast.program.body.splice(insertIndex === -1 ? ast.program.body.length : insertIndex, 0, ...declarationsToInsert);\n }\n\n const output = generate(ast, {\n sourceFileName: filename,\n sourceMaps: true,\n retainLines: false,\n });\n\n const outputCode = preserveBlankLineAfterImports(code, output.code);\n\n return { code: outputCode, map: output.map, css: cssText, rules };\n}\n\n/** Collect typography runtime lookups from all resolved chains. */\nfunction collectRuntimeLookups(\n chains: ResolvedChain[],\n): Map<string, { segmentsByName: Record<string, ResolvedSegment[]> }> {\n const lookups = new Map<string, { segmentsByName: Record<string, ResolvedSegment[]> }>();\n for (const chain of chains) {\n for (const part of chain.parts) {\n const segs = part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n for (const seg of segs) {\n if (seg.typographyLookup && !lookups.has(seg.typographyLookup.lookupKey)) {\n lookups.set(seg.typographyLookup.lookupKey, {\n segmentsByName: seg.typographyLookup.segmentsByName,\n });\n }\n }\n }\n }\n return lookups;\n}\n\nfunction preserveBlankLineAfterImports(input: string, output: string): string {\n const inputLines = input.split(\"\\n\");\n const outputLines = output.split(\"\\n\");\n const lastInputImportLine = findLastImportLine(inputLines);\n const lastOutputImportLine = findLastImportLine(outputLines);\n\n if (lastInputImportLine === -1 || lastOutputImportLine === -1) {\n return output;\n }\n\n const inputHasBlankLineAfterImports = inputLines[lastInputImportLine + 1]?.trim() === \"\";\n const outputHasBlankLineAfterImports = outputLines[lastOutputImportLine + 1]?.trim() === \"\";\n if (!inputHasBlankLineAfterImports || outputHasBlankLineAfterImports) {\n return output;\n }\n\n outputLines.splice(lastOutputImportLine + 1, 0, \"\");\n return outputLines.join(\"\\n\");\n}\n\nfunction findLastImportLine(lines: string[]): number {\n let lastImportLine = -1;\n for (let index = 0; index < lines.length; index++) {\n if (lines[index].trimStart().startsWith(\"import \")) {\n lastImportLine = index;\n }\n }\n return lastImportLine;\n}\n","import type * as t from \"@babel/types\";\nimport type { TrussMapping, TrussMappingEntry, ResolvedSegment, MarkerSegment } from \"./types\";\n\n/**\n * A resolved chain that may contain conditional (if/else) sections.\n *\n * I.e. `ChainNode` from ast-utils.ts is just the raw AST chain from `Css` to `.$`, which may contain if/else\n * nodes; this `ResolvedChain` is the post-processed result where each if/else has been split into separate segments.\n *\n * The `parts` array contains unconditional segments and conditional groups.\n * The `markers` array contains marker directives (Css.marker.$, Css.markerOf(\"x\").$).\n */\nexport interface ResolvedChain {\n parts: ResolvedChainPart[];\n /** Marker directives to attach to the element (not CSS styles). */\n markers: MarkerSegment[];\n /** Error messages from unsupported patterns found in this chain. */\n errors: string[];\n}\n\nexport type ResolvedChainPart =\n | { type: \"unconditional\"; segments: ResolvedSegment[] }\n | { type: \"conditional\"; conditionNode: any; thenSegments: ResolvedSegment[]; elseSegments: ResolvedSegment[] };\n\n/**\n * High-level chain resolver that handles if/else by splitting into parts.\n *\n * ## Chain semantics\n *\n * A `Css.*.$` chain is read left-to-right. Each segment is either a style\n * abbreviation (getter or call) or a modifier that changes the context for\n * subsequent styles. The modifiers and their precedence:\n *\n * - **`if(bool)`** / **`else`** — Boolean conditional. Splits the chain into\n * then/else branches at the AST level. Subsequent styles go into the active\n * branch. A new `if` starts a new conditional.\n *\n * - **`if(mediaQuery)`** — String overload. Sets the media query context\n * (same as `ifSm`, `ifMd` etc.) for subsequent styles. Does NOT create\n * a boolean branch.\n *\n * - **`ifSm`**, **`ifMd`**, **`ifLg`**, etc. — Breakpoint getters. Set the\n * media query context. Stacks with pseudo-classes: `ifSm.onHover.blue.$`\n * applies both conditions.\n *\n * - **`onHover`**, **`onFocus`**, etc. — Pseudo-class getters. Set the\n * pseudo-class context. Stacks with media queries (see above). A new\n * pseudo-class replaces the previous one.\n *\n * - **`element(\"::placeholder\")`** — Pseudo-element. Sets the pseudo-element\n * context for subsequent styles.\n *\n * - **`when(\":hover\")`** — Same-element selector pseudo. Behaves like a custom\n * pseudo-class context and stacks with media queries.\n *\n * - **`when(marker, \"ancestor\", \":hover\")`** — Relationship pseudo. Resets both\n * media query and pseudo-class contexts.\n *\n * - **`ifContainer({ gt, lt })`** — Container query. Sets the media query\n * context to an `@container` query string.\n *\n * Contexts accumulate left-to-right until explicitly replaced. A media query\n * set by `ifSm` persists through `onHover` (they stack). A new `if(bool)`\n * resets all contexts for its branches.\n */\nexport function resolveFullChain(chain: ChainNode[], mapping: TrussMapping): ResolvedChain {\n const parts: ResolvedChainPart[] = [];\n const markers: MarkerSegment[] = [];\n\n // Pre-scan for marker nodes and strip them from the chain\n const filteredChain: ChainNode[] = [];\n /** Errors found during marker scanning — attached to the chain result */\n const scanErrors: string[] = [];\n for (let j = 0; j < chain.length; j++) {\n const node = chain[j];\n if (node.type === \"getter\" && node.name === \"marker\") {\n markers.push({ type: \"marker\" });\n } else if (node.type === \"call\" && node.name === \"markerOf\") {\n if (node.args.length !== 1) {\n scanErrors.push(\"[truss] Unsupported pattern: markerOf() requires exactly one argument (a marker variable)\");\n } else {\n markers.push({ type: \"marker\", markerNode: node.args[0] });\n }\n } else {\n filteredChain.push(node);\n }\n }\n\n // Split chain at if/else boundaries\n let i = 0;\n let currentNodes: ChainNode[] = [];\n\n while (i < filteredChain.length) {\n const node = filteredChain[i];\n const mediaStart = getMediaConditionalStartNode(node, mapping);\n if (mediaStart) {\n const elseIndex = findElseIndex(filteredChain, i + 1);\n if (elseIndex !== -1) {\n if (currentNodes.length > 0) {\n parts.push({ type: \"unconditional\", segments: resolveChain(currentNodes, mapping) });\n currentNodes = [];\n }\n\n const thenNodes = mediaStart.thenNodes\n ? [...mediaStart.thenNodes, ...filteredChain.slice(i + 1, elseIndex)]\n : filteredChain.slice(i, elseIndex);\n const elseNodes = [makeMediaQueryNode(mediaStart.inverseMediaQuery), ...filteredChain.slice(elseIndex + 1)];\n const thenSegs = resolveChain(thenNodes, mapping);\n const elseSegs = resolveChain(elseNodes, mapping);\n parts.push({ type: \"unconditional\", segments: [...thenSegs, ...elseSegs] });\n i = filteredChain.length;\n break;\n }\n }\n\n if (node.type === \"if\") {\n // if(stringLiteral) → media query pseudo, not a boolean conditional\n if (node.conditionNode.type === \"StringLiteral\") {\n const mediaQuery: string = (node.conditionNode as any).value;\n currentNodes.push({ type: \"__mediaQuery\" as any, mediaQuery } as any);\n i++;\n continue;\n }\n\n // Flush any accumulated unconditional nodes\n if (currentNodes.length > 0) {\n parts.push({ type: \"unconditional\", segments: resolveChain(currentNodes, mapping) });\n currentNodes = [];\n }\n // Collect \"then\" nodes until \"else\" or end\n const thenNodes: ChainNode[] = [];\n const elseNodes: ChainNode[] = [];\n i++;\n let inElse = false;\n while (i < filteredChain.length) {\n if (filteredChain[i].type === \"else\") {\n inElse = true;\n i++;\n continue;\n }\n if (filteredChain[i].type === \"if\") {\n // Nested if — break out and let the outer loop handle it\n break;\n }\n if (inElse) {\n elseNodes.push(filteredChain[i]);\n } else {\n thenNodes.push(filteredChain[i]);\n }\n i++;\n }\n const thenSegs = resolveChain(thenNodes, mapping);\n const elseSegs = resolveChain(elseNodes, mapping);\n parts.push({\n type: \"conditional\",\n conditionNode: node.conditionNode,\n thenSegments: thenSegs,\n elseSegments: elseSegs,\n });\n } else {\n currentNodes.push(node);\n i++;\n }\n }\n\n // Flush remaining unconditional nodes\n if (currentNodes.length > 0) {\n parts.push({ type: \"unconditional\", segments: resolveChain(currentNodes, mapping) });\n }\n\n // Collect error messages from all resolved segments\n const segmentErrors: string[] = [];\n for (const part of parts) {\n const segs = part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n for (const seg of segs) {\n if (seg.error) {\n segmentErrors.push(seg.error);\n }\n }\n }\n\n return { parts, markers, errors: [...scanErrors, ...segmentErrors] };\n}\n\nfunction getMediaConditionalStartNode(\n node: ChainNode,\n mapping: TrussMapping,\n): { inverseMediaQuery: string; thenNodes?: ChainNode[] } | null {\n if (node.type === \"if\" && node.conditionNode.type === \"StringLiteral\") {\n return {\n inverseMediaQuery: invertMediaQuery(node.conditionNode.value),\n thenNodes: [makeMediaQueryNode(node.conditionNode.value)],\n };\n }\n\n if (node.type === \"getter\" && mapping.breakpoints && node.name in mapping.breakpoints) {\n return { inverseMediaQuery: invertMediaQuery(mapping.breakpoints[node.name]) };\n }\n\n return null;\n}\n\nfunction findElseIndex(chain: ChainNode[], start: number): number {\n for (let i = start; i < chain.length; i++) {\n if (chain[i].type === \"if\") {\n return -1;\n }\n if (chain[i].type === \"else\") {\n return i;\n }\n }\n return -1;\n}\n\nfunction makeMediaQueryNode(mediaQuery: string): ChainNode {\n return { type: \"__mediaQuery\" as any, mediaQuery } as any;\n}\n\nfunction invertMediaQuery(query: string): string {\n const screenPrefix = \"@media screen and \";\n if (query.startsWith(screenPrefix)) {\n const conditions = query.slice(screenPrefix.length).trim();\n const rangeMatch = conditions.match(/^\\(min-width: (\\d+)px\\) and \\(max-width: (\\d+)px\\)$/);\n if (rangeMatch) {\n const min = Number(rangeMatch[1]);\n const max = Number(rangeMatch[2]);\n return `@media screen and (max-width: ${min - 1}px), screen and (min-width: ${max + 1}px)`;\n }\n const minMatch = conditions.match(/^\\(min-width: (\\d+)px\\)$/);\n if (minMatch) {\n return `@media screen and (max-width: ${Number(minMatch[1]) - 1}px)`;\n }\n const maxMatch = conditions.match(/^\\(max-width: (\\d+)px\\)$/);\n if (maxMatch) {\n return `@media screen and (min-width: ${Number(maxMatch[1]) + 1}px)`;\n }\n }\n return query.replace(\"@media\", \"@media not\");\n}\n\n/**\n * Walks a Css member-expression chain (the AST between `Css` and `.$`) and\n * resolves each segment into CSS property definitions using the truss mapping.\n *\n * Returns an array of ResolvedSegment with flat defs (no condition nesting).\n * Does NOT handle if/else — use resolveFullChain for that.\n */\nexport function resolveChain(chain: ChainNode[], mapping: TrussMapping): ResolvedSegment[] {\n const segments: ResolvedSegment[] = [];\n // Track media query and pseudo-class separately so they can stack.\n // e.g. Css.ifSm.onHover.blue.$ → both mediaQuery and pseudoClass are set\n let currentMediaQuery: string | null = null;\n let currentPseudoClass: string | null = null;\n let currentPseudoElement: string | null = null;\n let currentWhenPseudo: { pseudo: string; markerNode?: any; relationship?: string } | null = null;\n\n for (const node of chain) {\n try {\n // Synthetic media query node injected by resolveFullChain for if(\"@media...\")\n if ((node as any).type === \"__mediaQuery\") {\n currentMediaQuery = (node as any).mediaQuery;\n currentWhenPseudo = null;\n continue;\n }\n\n if (node.type === \"getter\") {\n const abbr = node.name;\n\n // Pseudo-class getters: onHover, onFocus, etc.\n if (isPseudoMethod(abbr)) {\n currentPseudoClass = pseudoSelector(abbr);\n currentWhenPseudo = null;\n continue;\n }\n\n // Breakpoint getters: ifSm, ifMd, ifLg, etc.\n if (mapping.breakpoints && abbr in mapping.breakpoints) {\n currentMediaQuery = mapping.breakpoints[abbr];\n currentWhenPseudo = null;\n continue;\n }\n\n const entry = mapping.abbreviations[abbr];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown abbreviation \"${abbr}\"`);\n }\n\n const resolved = resolveEntry(\n abbr,\n entry,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(...resolved);\n } else if (node.type === \"call\") {\n const abbr = node.name;\n\n // Container query call: ifContainer({ gt, lt, name? })\n if (abbr === \"ifContainer\") {\n currentMediaQuery = containerSelectorFromCall(node);\n currentWhenPseudo = null;\n continue;\n }\n\n // add(prop, value) / addCss(cssProp)\n if (abbr === \"add\" || abbr === \"addCss\") {\n const seg = resolveAddCall(\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(seg);\n continue;\n }\n\n if (abbr === \"typography\") {\n const resolved = resolveTypographyCall(\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n );\n segments.push(...resolved);\n continue;\n }\n\n // Pseudo-element: element(\"::placeholder\") etc.\n if (abbr === \"element\") {\n if (node.args.length !== 1 || node.args[0].type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(\n `element() requires exactly one string literal argument (e.g. \"::placeholder\")`,\n );\n }\n currentPseudoElement = (node.args[0] as any).value;\n continue;\n }\n\n // Generic when(selector) or when(marker, relationship, pseudo)\n if (abbr === \"when\") {\n const resolved = resolveWhenCall(node);\n if (resolved.kind === \"selector\") {\n currentPseudoClass = resolved.pseudo;\n currentWhenPseudo = null;\n } else {\n currentPseudoClass = null;\n currentMediaQuery = null;\n currentWhenPseudo = resolved;\n }\n continue;\n }\n\n // Simple pseudo-class calls (backward compat — pseudos are now getters)\n if (isPseudoMethod(abbr)) {\n currentPseudoClass = pseudoSelector(abbr);\n currentWhenPseudo = null;\n if (node.args.length > 0) {\n throw new UnsupportedPatternError(\n `${abbr}() does not take arguments -- use when(marker, \"ancestor\", \":hover\") for relationship selectors`,\n );\n }\n continue;\n }\n\n const entry = mapping.abbreviations[abbr];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown abbreviation \"${abbr}\"`);\n }\n\n if (entry.kind === \"variable\") {\n const seg = resolveVariableCall(\n abbr,\n entry,\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(seg);\n } else if (entry.kind === \"delegate\") {\n const seg = resolveDelegateCall(\n abbr,\n entry,\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(seg);\n } else {\n throw new UnsupportedPatternError(`Abbreviation \"${abbr}\" is ${entry.kind}, cannot be called as a function`);\n }\n }\n } catch (err) {\n if (err instanceof UnsupportedPatternError) {\n segments.push({ abbr: \"__error\", defs: {}, error: err.message });\n } else {\n throw err;\n }\n }\n }\n\n return segments;\n}\n\n/**\n * Build a typography lookup key suffix from condition context.\n *\n * I.e. `typography(key)` → `\"typography\"`, `ifSm.typography(key)` → `\"typography__sm\"`.\n */\nfunction typographyLookupKeySuffix(\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n breakpoints?: Record<string, string>,\n): string {\n const parts: string[] = [];\n if (pseudoElement) parts.push(pseudoElement.replace(/^::/, \"\"));\n if (mediaQuery && breakpoints) {\n const bp = Object.entries(breakpoints).find(([, v]) => v === mediaQuery)?.[0];\n parts.push(bp ? bp.replace(/^if/, \"\").replace(/^./, (c) => c.toLowerCase()) : \"mq\");\n } else if (mediaQuery) {\n parts.push(\"mq\");\n }\n if (pseudoClass) parts.push(pseudoClass.replace(/^:+/, \"\").replace(/-/g, \"_\"));\n return parts.join(\"_\");\n}\n\n/** Resolve `typography(key)` into either direct segments or a runtime lookup-backed segment. */\nfunction resolveTypographyCall(\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n): ResolvedSegment[] {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`typography() expects exactly 1 argument, got ${node.args.length}`);\n }\n\n const argAst = node.args[0];\n if (argAst.type === \"StringLiteral\") {\n return resolveTypographyEntry(argAst.value, mapping, mediaQuery, pseudoClass, pseudoElement);\n }\n\n const typography = mapping.typography ?? [];\n if (typography.length === 0) {\n throw new UnsupportedPatternError(`typography() is unavailable because no typography abbreviations were generated`);\n }\n\n const suffix = typographyLookupKeySuffix(mediaQuery, pseudoClass, pseudoElement, mapping.breakpoints);\n const lookupKey = suffix ? `typography__${suffix}` : \"typography\";\n const segmentsByName: Record<string, ResolvedSegment[]> = {};\n\n for (const name of typography) {\n segmentsByName[name] = resolveTypographyEntry(name, mapping, mediaQuery, pseudoClass, pseudoElement);\n }\n\n return [\n {\n abbr: lookupKey,\n defs: {},\n typographyLookup: {\n lookupKey,\n argNode: argAst,\n segmentsByName,\n },\n },\n ];\n}\n\n/** Resolve a single typography abbreviation name within the current condition context. */\nfunction resolveTypographyEntry(\n name: string,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n): ResolvedSegment[] {\n if (!(mapping.typography ?? []).includes(name)) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const entry = mapping.abbreviations[name];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const resolved = resolveEntry(name, entry, mapping, mediaQuery, pseudoClass, pseudoElement, null);\n for (const segment of resolved) {\n if (segment.variableProps || segment.whenPseudo) {\n throw new UnsupportedPatternError(`Typography abbreviation \"${name}\" cannot require runtime arguments`);\n }\n }\n return resolved;\n}\n\n/** Resolve a static or alias entry (from a getter access). Defs are always flat. */\nfunction resolveEntry(\n abbr: string,\n entry: TrussMappingEntry,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment[] {\n switch (entry.kind) {\n case \"static\": {\n if (whenPseudo) {\n return [{ abbr, defs: entry.defs, whenPseudo }];\n }\n return [{ abbr, defs: entry.defs, mediaQuery, pseudoClass, pseudoElement }];\n }\n case \"alias\": {\n const result: ResolvedSegment[] = [];\n for (const chainAbbr of entry.chain) {\n const subEntry = mapping.abbreviations[chainAbbr];\n if (!subEntry) {\n throw new UnsupportedPatternError(`Alias \"${abbr}\" references unknown abbreviation \"${chainAbbr}\"`);\n }\n result.push(...resolveEntry(chainAbbr, subEntry, mapping, mediaQuery, pseudoClass, pseudoElement, whenPseudo));\n }\n return result;\n }\n case \"variable\":\n case \"delegate\":\n throw new UnsupportedPatternError(`Abbreviation \"${abbr}\" requires arguments — use ${abbr}() not .${abbr}`);\n default:\n throw new UnsupportedPatternError(`Unhandled entry kind for \"${abbr}\"`);\n }\n}\n\n/** Resolve a variable (parameterized) call like mt(2) or mt(x). */\nfunction resolveVariableCall(\n abbr: string,\n entry: { kind: \"variable\"; props: string[]; incremented: boolean; extraDefs?: Record<string, unknown> },\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`${abbr}() expects exactly 1 argument, got ${node.args.length}`);\n }\n const literalValue = tryEvaluateLiteral(node.args[0], entry.incremented, mapping.increment);\n return buildParameterizedSegment({\n abbr,\n props: entry.props,\n incremented: entry.incremented,\n extraDefs: entry.extraDefs,\n argAst: node.args[0],\n literalValue,\n mediaQuery,\n pseudoClass,\n pseudoElement,\n whenPseudo,\n });\n}\n\n/** Resolve a delegate call like mtPx(12). */\nfunction resolveDelegateCall(\n abbr: string,\n entry: { kind: \"delegate\"; target: string },\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment {\n const targetEntry = mapping.abbreviations[entry.target];\n if (!targetEntry || targetEntry.kind !== \"variable\") {\n throw new UnsupportedPatternError(`Delegate \"${abbr}\" targets \"${entry.target}\" which is not a variable entry`);\n }\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`${abbr}() expects exactly 1 argument, got ${node.args.length}`);\n }\n const literalValue = tryEvaluatePxLiteral(node.args[0]);\n // Use the target abbreviation name for delegate segments (i.e. mtPx → mt)\n return buildParameterizedSegment({\n abbr: entry.target,\n props: targetEntry.props,\n incremented: false,\n appendPx: true,\n extraDefs: targetEntry.extraDefs,\n argAst: node.args[0],\n literalValue,\n mediaQuery,\n pseudoClass,\n pseudoElement,\n whenPseudo,\n });\n}\n\n/** Shared builder for variable and delegate call segments. */\nfunction buildParameterizedSegment(params: {\n abbr: string;\n props: string[];\n incremented: boolean;\n appendPx?: boolean;\n extraDefs?: Record<string, unknown>;\n argAst: t.Expression | t.SpreadElement;\n literalValue: string | null;\n mediaQuery: string | null;\n pseudoClass: string | null;\n pseudoElement: string | null;\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null;\n}): ResolvedSegment {\n const { abbr, props, incremented, appendPx, extraDefs, argAst, literalValue, whenPseudo } = params;\n\n if (literalValue !== null) {\n const defs: Record<string, unknown> = {};\n for (const prop of props) {\n defs[prop] = literalValue;\n }\n if (extraDefs) Object.assign(defs, extraDefs);\n if (whenPseudo) {\n return { abbr, defs, whenPseudo, argResolved: literalValue };\n }\n return {\n abbr,\n defs,\n mediaQuery: params.mediaQuery,\n pseudoClass: params.pseudoClass,\n pseudoElement: params.pseudoElement,\n argResolved: literalValue,\n };\n }\n\n const base: ResolvedSegment = {\n abbr,\n defs: {},\n variableProps: props,\n incremented,\n variableExtraDefs: extraDefs,\n argNode: argAst,\n };\n if (appendPx) base.appendPx = true;\n if (whenPseudo) {\n base.whenPseudo = whenPseudo;\n } else {\n base.mediaQuery = params.mediaQuery;\n base.pseudoClass = params.pseudoClass;\n base.pseudoElement = params.pseudoElement;\n }\n return base;\n}\n\n/**\n * Resolve an `add(...)` or `addCss(...)` call.\n *\n * Supported overloads:\n * - `add(cssProp)` to inline an existing CssProp array into the chain output\n * - `addCss(cssProp)` to inline an existing Truss style hash into the chain output\n * - `add(\"propName\", value)` for an arbitrary CSS property/value pair\n */\nfunction resolveAddCall(\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment {\n const isAddCss = node.name === \"addCss\";\n\n if (isAddCss) {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(\n `addCss() requires exactly 1 argument (an existing CssProp/style hash expression)`,\n );\n }\n\n const styleArg = node.args[0];\n if (styleArg.type === \"SpreadElement\") {\n // I.e. reject call-arg spread like `addCss(...xss)`; callers should use `addCss(xss)` or `addCss({ ...xss })`.\n throw new UnsupportedPatternError(`addCss() does not support spread arguments`);\n }\n return {\n abbr: \"__composed_css_prop\",\n defs: {},\n styleArrayArg: styleArg,\n isAddCss: true,\n };\n }\n\n if (node.args.length === 1) {\n const styleArg = node.args[0];\n if (styleArg.type === \"SpreadElement\") {\n throw new UnsupportedPatternError(`add() does not support spread arguments`);\n }\n if (styleArg.type === \"ObjectExpression\") {\n throw new UnsupportedPatternError(\n `add(cssProp) does not accept object literals -- pass an existing CssProp expression instead`,\n );\n }\n return {\n abbr: \"__composed_css_prop\",\n defs: {},\n styleArrayArg: styleArg,\n };\n }\n\n if (node.args.length !== 2) {\n throw new UnsupportedPatternError(\n `add() requires exactly 2 arguments (property name and value), got ${node.args.length}. ` +\n `Supported overloads are add(cssProp), addCss(cssProp), and add(\"propName\", value)`,\n );\n }\n\n const propArg = node.args[0];\n if (propArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`add() first argument must be a string literal property name`);\n }\n const propName: string = (propArg as any).value;\n\n const valueArg = node.args[1];\n const literalValue = tryEvaluateAddLiteral(valueArg);\n\n if (whenPseudo) {\n if (literalValue !== null) {\n return { abbr: propName, defs: { [propName]: literalValue }, whenPseudo, argResolved: literalValue };\n } else {\n return { abbr: propName, defs: {}, whenPseudo, variableProps: [propName], incremented: false, argNode: valueArg };\n }\n }\n\n if (literalValue !== null) {\n return {\n abbr: propName,\n defs: { [propName]: literalValue },\n mediaQuery,\n pseudoClass,\n pseudoElement,\n argResolved: literalValue,\n };\n } else {\n return {\n abbr: propName,\n defs: {},\n mediaQuery,\n pseudoClass,\n pseudoElement,\n variableProps: [propName],\n incremented: false,\n argNode: valueArg,\n };\n }\n}\n\n/** Try to evaluate a literal for add() — strings, numbers, and template literals with no expressions. */\nfunction tryEvaluateAddLiteral(node: t.Expression | t.SpreadElement): string | null {\n if (node.type === \"StringLiteral\") {\n return (node as any).value;\n }\n if (node.type === \"NumericLiteral\") {\n return String((node as any).value);\n }\n if (node.type === \"UnaryExpression\" && node.operator === \"-\" && node.argument.type === \"NumericLiteral\") {\n return String(-(node.argument as any).value);\n }\n return null;\n}\n\nconst WHEN_RELATIONSHIPS = new Set([\"ancestor\", \"descendant\", \"anySibling\", \"siblingBefore\", \"siblingAfter\"]);\n\n/**\n * Resolve a `when(selector)` or `when(marker, relationship, pseudo)` call.\n *\n * - 1 arg: `when(\":hover\")` — same-element selector, must be a string literal\n * - 3 args: `when(marker, \"ancestor\", \":hover\")` — marker must be a marker variable or\n * the shared `marker` token, relationship/pseudo must be string literals\n */\nfunction resolveWhenCall(\n node: CallChainNode,\n):\n | { kind: \"selector\"; pseudo: string }\n | { kind: \"relationship\"; pseudo: string; markerNode?: any; relationship: string } {\n if (node.args.length !== 1 && node.args.length !== 3) {\n throw new UnsupportedPatternError(\n `when() expects 1 or 3 arguments (selector) or (marker, relationship, pseudo), got ${node.args.length}`,\n );\n }\n\n if (node.args.length === 1) {\n const pseudoArg = node.args[0];\n if (pseudoArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`when() selector must be a string literal`);\n }\n return { kind: \"selector\", pseudo: (pseudoArg as any).value };\n }\n\n const markerArg = node.args[0];\n const markerNode = resolveWhenMarker(markerArg);\n const relationshipArg = node.args[1];\n if (relationshipArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`when() relationship argument must be a string literal`);\n }\n const relationship: string = (relationshipArg as any).value;\n if (!WHEN_RELATIONSHIPS.has(relationship)) {\n throw new UnsupportedPatternError(\n `when() relationship must be one of: ${[...WHEN_RELATIONSHIPS].join(\", \")} -- got \"${relationship}\"`,\n );\n }\n\n const pseudoArg = node.args[2];\n if (pseudoArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`when() pseudo selector (3rd argument) must be a string literal`);\n }\n return { kind: \"relationship\", pseudo: (pseudoArg as any).value, markerNode, relationship };\n}\n\nfunction resolveWhenMarker(node: t.Expression | t.SpreadElement): any | undefined {\n if (isDefaultMarkerNode(node)) {\n return undefined;\n }\n if (node.type === \"Identifier\") {\n return node;\n }\n throw new UnsupportedPatternError(`when() marker must be a marker variable or marker`);\n}\n\nfunction isDefaultMarkerNode(node: t.Expression | t.SpreadElement): boolean {\n if (node.type === \"Identifier\" && (node.name === \"marker\" || node.name === \"defaultMarker\")) {\n return true;\n }\n return isLegacyDefaultMarkerExpression(node);\n}\n\nfunction isLegacyDefaultMarkerExpression(node: t.Expression | t.SpreadElement): boolean {\n return (\n node.type === \"CallExpression\" &&\n node.arguments.length === 0 &&\n node.callee.type === \"MemberExpression\" &&\n !node.callee.computed &&\n node.callee.property.type === \"Identifier\" &&\n node.callee.property.name === \"defaultMarker\"\n );\n}\n\n// ── Helpers ───────────────────────────────────────────────────────────\n\nconst PSEUDO_METHODS: Record<string, string> = {\n onHover: \":hover\",\n onFocus: \":focus\",\n onFocusVisible: \":focus-visible\",\n onFocusWithin: \":focus-within\",\n onActive: \":active\",\n onDisabled: \":disabled\",\n};\n\nfunction isPseudoMethod(name: string): boolean {\n return name in PSEUDO_METHODS;\n}\n\nfunction pseudoSelector(name: string): string {\n return PSEUDO_METHODS[name];\n}\n\n/**\n * Try to evaluate a literal AST node to a string value.\n * For incremented entries, also evaluates `maybeInc(literal)`.\n */\nfunction tryEvaluateLiteral(\n node: t.Expression | t.SpreadElement,\n incremented: boolean,\n increment: number,\n): string | null {\n if (node.type === \"NumericLiteral\") {\n if (incremented) {\n return `${node.value * increment}px`;\n }\n return String(node.value);\n }\n if (node.type === \"StringLiteral\") {\n return node.value;\n }\n if (node.type === \"UnaryExpression\" && node.operator === \"-\" && node.argument.type === \"NumericLiteral\") {\n const val = -node.argument.value;\n if (incremented) {\n return `${val * increment}px`;\n }\n return String(val);\n }\n return null;\n}\n\n/** Try to evaluate a Px delegate argument (always a number → `${n}px`). */\nfunction tryEvaluatePxLiteral(node: t.Expression | t.SpreadElement): string | null {\n if (node.type === \"NumericLiteral\") {\n return `${node.value}px`;\n }\n return null;\n}\n\n/** Resolve ifContainer({ gt, lt, name? }) to a container query pseudo key. */\nfunction containerSelectorFromCall(node: CallChainNode): string {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`ifContainer() expects exactly 1 argument, got ${node.args.length}`);\n }\n\n const arg = node.args[0];\n if (!arg || arg.type !== \"ObjectExpression\") {\n throw new UnsupportedPatternError(\"ifContainer() expects an object literal argument\");\n }\n\n let lt: number | undefined;\n let gt: number | undefined;\n let name: string | undefined;\n\n for (const prop of arg.properties) {\n if (prop.type === \"SpreadElement\") {\n throw new UnsupportedPatternError(\"ifContainer() does not support spread properties\");\n }\n if (prop.type !== \"ObjectProperty\" || prop.computed) {\n throw new UnsupportedPatternError(\"ifContainer() expects plain object properties\");\n }\n\n const key = objectPropertyName(prop.key);\n if (!key) {\n throw new UnsupportedPatternError(\"ifContainer() only supports identifier/string keys\");\n }\n\n const valueNode = prop.value as t.Expression | t.SpreadElement;\n\n if (key === \"lt\") {\n lt = numericLiteralValue(valueNode, \"ifContainer().lt must be a numeric literal\");\n continue;\n }\n if (key === \"gt\") {\n gt = numericLiteralValue(valueNode, \"ifContainer().gt must be a numeric literal\");\n continue;\n }\n if (key === \"name\") {\n name = stringLiteralValue(valueNode, \"ifContainer().name must be a string literal\");\n continue;\n }\n\n throw new UnsupportedPatternError(`ifContainer() does not support property \"${key}\"`);\n }\n\n if (lt === undefined && gt === undefined) {\n throw new UnsupportedPatternError('ifContainer() requires at least one of \"lt\" or \"gt\"');\n }\n\n const parts: string[] = [];\n if (gt !== undefined) {\n parts.push(`(min-width: ${gt + 1}px)`);\n }\n if (lt !== undefined) {\n parts.push(`(max-width: ${lt}px)`);\n }\n\n const query = parts.join(\" and \");\n const namePrefix = name ? `${name} ` : \"\";\n return `@container ${namePrefix}${query}`;\n}\n\nfunction objectPropertyName(node: t.Expression | t.Identifier | t.PrivateName): string | null {\n if (node.type === \"Identifier\") return node.name;\n if (node.type === \"StringLiteral\") return node.value;\n return null;\n}\n\nfunction numericLiteralValue(node: t.Expression | t.SpreadElement, errorMessage: string): number {\n if (node.type === \"NumericLiteral\") {\n return node.value;\n }\n if (node.type === \"UnaryExpression\" && node.operator === \"-\" && node.argument.type === \"NumericLiteral\") {\n return -node.argument.value;\n }\n throw new UnsupportedPatternError(errorMessage);\n}\n\nfunction stringLiteralValue(node: t.Expression | t.SpreadElement, errorMessage: string): string {\n if (node.type === \"StringLiteral\") {\n return node.value;\n }\n if (node.type === \"TemplateLiteral\" && node.expressions.length === 0 && node.quasis.length === 1) {\n return node.quasis[0].value.cooked ?? \"\";\n }\n throw new UnsupportedPatternError(errorMessage);\n}\n\n// ── Chain node types (parsed from AST) ────────────────────────────────\n\nexport interface GetterChainNode {\n type: \"getter\";\n name: string;\n}\n\nexport interface CallChainNode {\n type: \"call\";\n name: string;\n args: (t.Expression | t.SpreadElement)[];\n}\n\nexport interface IfChainNode {\n type: \"if\";\n conditionNode: t.Expression | t.SpreadElement;\n}\n\nexport interface ElseChainNode {\n type: \"else\";\n}\n\nexport type ChainNode = GetterChainNode | CallChainNode | IfChainNode | ElseChainNode;\n\nexport class UnsupportedPatternError extends Error {\n constructor(message: string) {\n super(`[truss] Unsupported pattern: ${message}`);\n this.name = \"UnsupportedPatternError\";\n }\n}\n","import * as t from \"@babel/types\";\nimport type { ChainNode } from \"./resolve-chain\";\n\n/**\n * Collect module-scope bindings so generated declarations can avoid collisions.\n *\n * We only care about top-level names because the transform injects declarations\n * at the module root, not inside nested blocks.\n */\nexport function collectTopLevelBindings(ast: t.File): Set<string> {\n const used = new Set<string>();\n\n for (const node of ast.program.body) {\n if (t.isImportDeclaration(node)) {\n for (const spec of node.specifiers) {\n used.add(spec.local.name);\n }\n continue;\n }\n\n if (t.isVariableDeclaration(node)) {\n for (const decl of node.declarations) {\n collectPatternBindings(decl.id, used);\n }\n continue;\n }\n\n if (t.isFunctionDeclaration(node) && node.id) {\n used.add(node.id.name);\n continue;\n }\n\n if (t.isClassDeclaration(node) && node.id) {\n used.add(node.id.name);\n continue;\n }\n\n if (t.isExportNamedDeclaration(node) && node.declaration) {\n const decl = node.declaration;\n if (t.isVariableDeclaration(decl)) {\n for (const varDecl of decl.declarations) {\n collectPatternBindings(varDecl.id, used);\n }\n } else if ((t.isFunctionDeclaration(decl) || t.isClassDeclaration(decl)) && decl.id) {\n used.add(decl.id.name);\n }\n continue;\n }\n\n if (t.isExportDefaultDeclaration(node)) {\n const decl = node.declaration;\n if ((t.isFunctionDeclaration(decl) || t.isClassDeclaration(decl)) && decl.id) {\n used.add(decl.id.name);\n }\n }\n }\n\n return used;\n}\n\n/**\n * Recursively collect names introduced by binding patterns.\n *\n * This handles destructuring (`const { a } = ...`, `const [x] = ...`) so we do\n * not accidentally generate a helper that shadows an existing binding.\n */\nfunction collectPatternBindings(pattern: t.LVal | t.VoidPattern, used: Set<string>): void {\n if (t.isVoidPattern(pattern)) {\n return;\n }\n\n if (t.isIdentifier(pattern)) {\n used.add(pattern.name);\n return;\n }\n\n if (t.isAssignmentPattern(pattern)) {\n collectPatternBindings(pattern.left, used);\n return;\n }\n\n if (t.isRestElement(pattern)) {\n collectPatternBindings(pattern.argument as t.LVal, used);\n return;\n }\n\n if (t.isObjectPattern(pattern)) {\n for (const prop of pattern.properties) {\n if (t.isObjectProperty(prop)) {\n collectPatternBindings(prop.value as t.LVal, used);\n } else if (t.isRestElement(prop)) {\n collectPatternBindings(prop.argument as t.LVal, used);\n }\n }\n return;\n }\n\n if (t.isArrayPattern(pattern)) {\n for (const el of pattern.elements) {\n if (!el) continue;\n if (t.isIdentifier(el) || t.isAssignmentPattern(el) || t.isObjectPattern(el) || t.isArrayPattern(el)) {\n collectPatternBindings(el, used);\n } else if (t.isRestElement(el)) {\n collectPatternBindings(el.argument as t.LVal, used);\n }\n }\n }\n}\n\n/**\n * Reserve a stable, collision-free identifier.\n *\n * Preference order:\n * 1) preferred\n * 2) secondary (if provided)\n * 3) numbered suffixes based on secondary/preferred\n */\nexport function reservePreferredName(used: Set<string>, preferred: string, secondary?: string): string {\n if (!used.has(preferred)) {\n used.add(preferred);\n return preferred;\n }\n\n if (secondary && !used.has(secondary)) {\n used.add(secondary);\n return secondary;\n }\n\n const base = secondary ?? preferred;\n let i = 1;\n // Numbered fallback keeps generated names deterministic across runs.\n let candidate = `${base}_${i}`;\n while (used.has(candidate)) {\n i++;\n candidate = `${base}_${i}`;\n }\n used.add(candidate);\n return candidate;\n}\n\n/**\n * Find the local binding name for `Css` from import declarations.\n */\nexport function findCssImportBinding(ast: t.File): string | null {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: \"Css\" })) {\n return spec.local.name;\n }\n }\n }\n return null;\n}\n\n/**\n * Find a local binding where `Css` is created via `new CssBuilder(...)`.\n *\n * This handles tsup-bundled libraries where Css is not imported but declared as:\n * var Css = new CssBuilder({ ... });\n */\nexport function findCssBuilderBinding(ast: t.File): string | null {\n for (const node of ast.program.body) {\n if (!t.isVariableDeclaration(node)) continue;\n for (const decl of node.declarations) {\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isNewExpression(decl.init) &&\n t.isIdentifier(decl.init.callee, { name: \"CssBuilder\" })\n ) {\n return decl.id.name;\n }\n }\n }\n return null;\n}\n\n/** Check if the AST contains a `binding.method(...)` call expression. */\nexport function hasCssMethodCall(ast: t.File, binding: string, method: string): boolean {\n let found = false;\n t.traverseFast(ast, (node) => {\n if (found) return;\n if (\n t.isCallExpression(node) &&\n t.isMemberExpression(node.callee) &&\n !node.callee.computed &&\n t.isIdentifier(node.callee.object, { name: binding }) &&\n t.isIdentifier(node.callee.property, { name: method })\n ) {\n found = true;\n }\n });\n return found;\n}\n\n/**\n * Remove the Css import specifier. If it was the only specifier, remove the whole import.\n */\nexport function removeCssImport(ast: t.File, cssBinding: string): void {\n for (let i = 0; i < ast.program.body.length; i++) {\n const node = ast.program.body[i];\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex((s) => t.isImportSpecifier(s) && s.local.name === cssBinding);\n if (cssSpecIndex === -1) continue;\n\n if (node.specifiers.length === 1) {\n ast.program.body.splice(i, 1);\n } else {\n node.specifiers.splice(cssSpecIndex, 1);\n }\n return;\n }\n}\n\n/** Return the index of the last import declaration in the module. */\nexport function findLastImportIndex(ast: t.File): number {\n let lastImportIndex = -1;\n for (let i = 0; i < ast.program.body.length; i++) {\n if (t.isImportDeclaration(ast.program.body[i])) {\n lastImportIndex = i;\n }\n }\n return lastImportIndex;\n}\n\nexport function findNamedImportBinding(ast: t.File, source: string, importedName: string): string | null {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node) || node.source.value !== source) continue;\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: importedName })) {\n return spec.local.name;\n }\n }\n }\n return null;\n}\n\nexport function findImportDeclaration(ast: t.File, source: string): t.ImportDeclaration | null {\n for (const node of ast.program.body) {\n if (t.isImportDeclaration(node) && node.source.value === source) {\n return node;\n }\n }\n return null;\n}\n\nexport function replaceCssImportWithNamedImports(\n ast: t.File,\n cssBinding: string,\n source: string,\n imports: Array<{ importedName: string; localName: string }>,\n): boolean {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex(function (spec) {\n return t.isImportSpecifier(spec) && spec.local.name === cssBinding;\n });\n if (cssSpecIndex === -1 || node.specifiers.length !== 1) continue;\n\n node.source = t.stringLiteral(source);\n node.specifiers = imports.map(function (entry) {\n return t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName));\n });\n return true;\n }\n\n return false;\n}\n\nexport function upsertNamedImports(\n ast: t.File,\n source: string,\n imports: Array<{ importedName: string; localName: string }>,\n): void {\n if (imports.length === 0) return;\n\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node) || node.source.value !== source) continue;\n\n for (const entry of imports) {\n const exists = node.specifiers.some(function (spec) {\n return t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: entry.importedName });\n });\n if (exists) continue;\n\n node.specifiers.push(t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName)));\n }\n return;\n }\n\n const importDecl = t.importDeclaration(\n imports.map(function (entry) {\n return t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName));\n }),\n t.stringLiteral(source),\n );\n const idx = findLastImportIndex(ast);\n ast.program.body.splice(idx + 1, 0, importDecl);\n}\n\n/**\n * Extract a `Css` method/property chain from an expression.\n *\n * Example: `Css.if(cond).df.else.db.$` ->\n * `[{type:\"if\"}, {type:\"getter\", name:\"df\"}, {type:\"else\"}, {type:\"getter\", name:\"db\"}]`\n *\n * Returns `null` when the expression is not rooted at the Css import binding,\n * which lets the caller ignore unrelated member expressions cheaply.\n */\nexport function extractChain(node: t.Expression, cssBinding: string): ChainNode[] | null {\n const chain: ChainNode[] = [];\n let current: t.Expression = node;\n\n while (true) {\n if (t.isIdentifier(current, { name: cssBinding })) {\n chain.reverse();\n return chain;\n }\n\n if (t.isMemberExpression(current) && !current.computed && t.isIdentifier(current.property)) {\n const name = current.property.name;\n if (name === \"else\") {\n chain.push({ type: \"else\" });\n } else {\n chain.push({ type: \"getter\", name });\n }\n current = current.object as t.Expression;\n continue;\n }\n\n if (\n t.isCallExpression(current) &&\n t.isMemberExpression(current.callee) &&\n !current.callee.computed &&\n t.isIdentifier(current.callee.property)\n ) {\n const name = current.callee.property.name;\n\n if (name === \"if\") {\n chain.push({\n type: \"if\",\n conditionNode: current.arguments[0] as t.Expression,\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n chain.push({\n type: \"call\",\n name,\n args: current.arguments as (t.Expression | t.SpreadElement)[],\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n return null;\n }\n}\n","import _traverse from \"@babel/traverse\";\nimport type { NodePath } from \"@babel/traverse\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport type { ResolvedChain } from \"./resolve-chain\";\nimport { buildStyleHashProperties, markerClassName } from \"./emit-truss\";\nimport type { ResolvedSegment } from \"./types\";\n\n// Babel packages are CJS today; normalize default interop across loaders.\nconst generate = ((_generate as unknown as { default?: typeof _generate }).default ?? _generate) as typeof _generate;\nconst traverse = ((_traverse as unknown as { default?: typeof _traverse }).default ?? _traverse) as typeof _traverse;\n\nexport interface ExpressionSite {\n path: NodePath<t.MemberExpression>;\n resolvedChain: ResolvedChain;\n}\n\nexport interface RewriteSitesOptions {\n ast: t.File;\n sites: ExpressionSite[];\n cssBindingName: string;\n filename: string;\n debug: boolean;\n mapping: TrussMapping;\n maybeIncHelperName: string | null;\n mergePropsHelperName: string;\n needsMergePropsHelper: { current: boolean };\n trussPropsHelperName: string;\n needsTrussPropsHelper: { current: boolean };\n trussDebugInfoName: string;\n needsTrussDebugInfo: { current: boolean };\n runtimeLookupNames: Map<string, string>;\n}\n\n/**\n * Rewrite collected `Css...$` expression sites into Truss-native style hash objects.\n *\n * In the new model, each site becomes an ObjectExpression keyed by CSS property.\n * JSX `css=` attributes become `trussProps(hash)` or `mergeProps(className, style, hash)` spreads.\n * Non-JSX positions become plain object expressions.\n */\nexport function rewriteExpressionSites(options: RewriteSitesOptions): void {\n for (const site of options.sites) {\n const styleHash = buildStyleHashFromChain(site.resolvedChain, options);\n const cssAttrPath = getCssAttributePath(site.path);\n const line = site.path.node.loc?.start.line ?? null;\n\n if (cssAttrPath) {\n // JSX css= attribute → spread trussProps or mergeProps\n cssAttrPath.replaceWith(t.jsxSpreadAttribute(buildCssSpreadExpression(cssAttrPath, styleHash, line, options)));\n } else {\n // Non-JSX position → plain object expression with optional debug info\n if (options.debug && line !== null) {\n injectDebugInfo(styleHash, line, options);\n }\n site.path.replaceWith(styleHash);\n }\n }\n\n rewriteCssPropsCalls(options);\n\n // Second pass: lower any remaining `css={...}` expression to `trussProps(...)`.\n rewriteCssAttributeExpressions(options);\n}\n\n/**\n * Return the enclosing `css={...}` JSX attribute path for a transformed site,\n * or null when the site is in a non-`css` expression context.\n */\nfunction getCssAttributePath(path: NodePath<t.MemberExpression>): NodePath<t.JSXAttribute> | null {\n const parentPath = path.parentPath;\n if (!parentPath || !parentPath.isJSXExpressionContainer()) return null;\n\n const attrPath = parentPath.parentPath;\n if (!attrPath || !attrPath.isJSXAttribute()) return null;\n if (!t.isJSXIdentifier(attrPath.node.name, { name: \"css\" })) return null;\n\n return attrPath;\n}\n\n// ---------------------------------------------------------------------------\n// Building style hash objects from resolved chains\n// ---------------------------------------------------------------------------\n\n/** Build an ObjectExpression from a ResolvedChain, handling conditionals. */\nfunction buildStyleHashFromChain(chain: ResolvedChain, options: RewriteSitesOptions): t.ObjectExpression {\n const members: (t.ObjectProperty | t.SpreadElement)[] = [];\n const previousProperties = new Map<string, t.ObjectProperty>();\n\n if (chain.markers.length > 0) {\n const markerClasses = chain.markers.map(function (marker) {\n return markerClassName(marker.markerNode);\n });\n members.push(t.objectProperty(t.identifier(\"__marker\"), t.stringLiteral(markerClasses.join(\" \"))));\n }\n\n for (const part of chain.parts) {\n if (part.type === \"unconditional\") {\n const partMembers = buildStyleHashMembers(part.segments, options);\n members.push(...partMembers);\n for (const member of partMembers) {\n if (t.isObjectProperty(member)) {\n previousProperties.set(propertyName(member.key), member);\n }\n }\n } else {\n // Conditional: ...(cond ? { then } : { else })\n const thenMembers = mergeConditionalBranchMembers(\n buildStyleHashMembers(part.thenSegments, options),\n previousProperties,\n collectConditionalOnlyProps(part.thenSegments),\n );\n const elseMembers = mergeConditionalBranchMembers(\n buildStyleHashMembers(part.elseSegments, options),\n previousProperties,\n collectConditionalOnlyProps(part.elseSegments),\n );\n members.push(\n t.spreadElement(\n t.conditionalExpression(part.conditionNode, t.objectExpression(thenMembers), t.objectExpression(elseMembers)),\n ),\n );\n }\n }\n\n return t.objectExpression(members);\n}\n\n/**\n * Build ObjectExpression members from a list of segments.\n *\n * Normal segments are batched and processed by buildStyleHashProperties.\n * Special segments (styleArrayArg, typographyLookup) produce SpreadElements.\n */\nfunction buildStyleHashMembers(\n segments: ResolvedSegment[],\n options: RewriteSitesOptions,\n): (t.ObjectProperty | t.SpreadElement)[] {\n const members: (t.ObjectProperty | t.SpreadElement)[] = [];\n const normalSegs: ResolvedSegment[] = [];\n\n function flushNormal(): void {\n if (normalSegs.length > 0) {\n members.push(...buildStyleHashProperties(normalSegs, options.mapping, options.maybeIncHelperName));\n normalSegs.length = 0;\n }\n }\n\n for (const seg of segments) {\n if (seg.error) continue;\n\n if (seg.styleArrayArg) {\n flushNormal();\n if (seg.isAddCss && t.isObjectExpression(seg.styleArrayArg)) {\n members.push(...buildAddCssObjectMembers(seg.styleArrayArg));\n } else {\n members.push(t.spreadElement(seg.styleArrayArg as t.Expression));\n }\n continue;\n }\n\n if (seg.typographyLookup) {\n flushNormal();\n const lookupName = options.runtimeLookupNames.get(seg.typographyLookup.lookupKey);\n if (lookupName) {\n // I.e. `{ ...(__typography[key] ?? {}) }`\n const lookupAccess = t.memberExpression(\n t.identifier(lookupName),\n seg.typographyLookup.argNode as t.Expression,\n true,\n );\n members.push(t.spreadElement(t.logicalExpression(\"??\", lookupAccess, t.objectExpression([]))));\n }\n continue;\n }\n\n normalSegs.push(seg);\n }\n\n flushNormal();\n return members;\n}\n\nfunction buildAddCssObjectMembers(styleObject: t.ObjectExpression): (t.ObjectProperty | t.SpreadElement)[] {\n const members: (t.ObjectProperty | t.SpreadElement)[] = [];\n\n for (const property of styleObject.properties) {\n if (t.isSpreadElement(property)) {\n members.push(t.spreadElement(t.cloneNode(property.argument, true) as t.Expression));\n continue;\n }\n\n if (!t.isObjectProperty(property) || property.computed) {\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n continue;\n }\n\n const value = property.value;\n if (t.isIdentifier(value) || t.isMemberExpression(value) || t.isOptionalMemberExpression(value)) {\n members.push(\n t.spreadElement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.cloneNode(value, true), t.identifier(\"undefined\")),\n t.objectExpression([]),\n t.objectExpression([t.objectProperty(clonePropertyKey(property.key), t.cloneNode(value, true))]),\n ),\n ),\n );\n continue;\n }\n\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n }\n\n return members;\n}\n\n/**\n * Collect the set of CSS properties where ALL contributing segments have a condition\n * (pseudo-class, media query, pseudo-element, or when relationship).\n *\n * I.e. `onHover.white` → `color` is conditional-only (needs base merged in),\n * but `bgWhite` → `backgroundColor` is a plain replacement (should NOT merge).\n */\nfunction collectConditionalOnlyProps(segments: ResolvedSegment[]): Set<string> {\n const allProps = new Map<string, boolean>();\n for (const seg of segments) {\n if (seg.error || seg.styleArrayArg || seg.typographyLookup) continue;\n const hasCondition = !!(seg.pseudoClass || seg.mediaQuery || seg.pseudoElement || seg.whenPseudo);\n const props = seg.variableProps ?? Object.keys(seg.defs);\n for (const prop of props) {\n const current = allProps.get(prop);\n // If any segment for this property is unconditional, it's not conditional-only\n allProps.set(prop, current === undefined ? hasCondition : current && hasCondition);\n }\n }\n const result = new Set<string>();\n for (const [prop, isConditionalOnly] of allProps) {\n if (isConditionalOnly) result.add(prop);\n }\n return result;\n}\n\n/**\n * Merge prior base properties into conditional branch members, but only for\n * properties that are purely conditional (pseudo/media overlays). Plain\n * base-level replacements should NOT be merged — the spread will correctly\n * override the base when the condition is true.\n */\nfunction mergeConditionalBranchMembers(\n members: (t.ObjectProperty | t.SpreadElement)[],\n previousProperties: Map<string, t.ObjectProperty>,\n conditionalOnlyProps: Set<string>,\n): (t.ObjectProperty | t.SpreadElement)[] {\n return members.map(function (member) {\n if (!t.isObjectProperty(member)) {\n return member;\n }\n\n const prop = propertyName(member.key);\n const prior = previousProperties.get(prop);\n if (!prior || !conditionalOnlyProps.has(prop)) {\n return member;\n }\n\n return t.objectProperty(\n clonePropertyKey(member.key),\n mergePropertyValues(prior.value as t.Expression, member.value as t.Expression),\n );\n });\n}\n\nfunction mergePropertyValues(previousValue: t.Expression, currentValue: t.Expression): t.Expression {\n if (t.isStringLiteral(previousValue) && t.isStringLiteral(currentValue)) {\n return t.stringLiteral(`${previousValue.value} ${currentValue.value}`);\n }\n\n if (t.isStringLiteral(previousValue) && t.isArrayExpression(currentValue)) {\n return mergeTupleValue(currentValue, previousValue.value, true);\n }\n\n if (t.isArrayExpression(previousValue) && t.isStringLiteral(currentValue)) {\n return mergeTupleValue(previousValue, currentValue.value, false);\n }\n\n if (t.isArrayExpression(previousValue) && t.isArrayExpression(currentValue)) {\n const previousClassNames = tupleClassNames(previousValue);\n return mergeTupleValue(currentValue, previousClassNames, true, arrayElementExpression(previousValue.elements[1]));\n }\n\n return t.cloneNode(currentValue, true);\n}\n\nfunction mergeTupleValue(\n tuple: t.ArrayExpression,\n classNames: string,\n prependClassNames: boolean,\n previousVars?: t.Expression | null,\n): t.ArrayExpression {\n const currentClassNames = tupleClassNames(tuple);\n const mergedClassNames = prependClassNames\n ? `${classNames} ${currentClassNames}`\n : `${currentClassNames} ${classNames}`;\n const varsExpr = tuple.elements[1];\n const mergedVars =\n previousVars && arrayElementExpression(varsExpr)\n ? mergeVarsObject(previousVars, arrayElementExpression(varsExpr)!)\n : (arrayElementExpression(varsExpr) ?? previousVars ?? null);\n\n return t.arrayExpression([\n t.stringLiteral(mergedClassNames),\n mergedVars ? t.cloneNode(mergedVars, true) : t.objectExpression([]),\n ]);\n}\n\nfunction tupleClassNames(tuple: t.ArrayExpression): string {\n const classNames = tuple.elements[0];\n return t.isStringLiteral(classNames) ? classNames.value : \"\";\n}\n\nfunction arrayElementExpression(element: t.Expression | t.SpreadElement | null | undefined): t.Expression | null {\n return element && !t.isSpreadElement(element) ? element : null;\n}\n\nfunction mergeVarsObject(previousVars: t.Expression, currentVars: t.Expression): t.Expression {\n if (t.isObjectExpression(previousVars) && t.isObjectExpression(currentVars)) {\n return t.objectExpression([\n ...previousVars.properties.map(function (property) {\n return t.cloneNode(property, true);\n }),\n ...currentVars.properties.map(function (property) {\n return t.cloneNode(property, true);\n }),\n ]);\n }\n\n return t.cloneNode(currentVars, true);\n}\n\nfunction propertyName(key: t.Expression | t.Identifier | t.PrivateName): string {\n if (t.isIdentifier(key)) {\n return key.name;\n }\n if (t.isStringLiteral(key)) {\n return key.value;\n }\n return generate(key).code;\n}\n\nfunction clonePropertyKey(key: t.Expression | t.Identifier | t.PrivateName): t.Expression | t.Identifier {\n if (t.isPrivateName(key)) {\n return t.identifier(key.id.name);\n }\n return t.cloneNode(key, true);\n}\n\n// ---------------------------------------------------------------------------\n// Debug info injection\n// ---------------------------------------------------------------------------\n\n/**\n * Inject debug info into the first property of a style hash ObjectExpression.\n *\n * For static values, promotes `\"df\"` to `[\"df\", new TrussDebugInfo(\"...\")]`.\n * For variable tuples, appends the debug info as a third element.\n */\nfunction injectDebugInfo(\n expr: t.ObjectExpression,\n line: number,\n options: Pick<RewriteSitesOptions, \"debug\" | \"trussDebugInfoName\" | \"needsTrussDebugInfo\" | \"filename\">,\n): void {\n if (!options.debug) return;\n\n // Find the first real style property (skip SpreadElements and __marker metadata)\n const firstProp = expr.properties.find(function (p) {\n return (\n t.isObjectProperty(p) &&\n !(\n (t.isIdentifier(p.key) && p.key.name === \"__marker\") ||\n (t.isStringLiteral(p.key) && p.key.value === \"__marker\")\n )\n );\n }) as t.ObjectProperty | undefined;\n if (!firstProp) return;\n\n options.needsTrussDebugInfo.current = true;\n const debugExpr = t.newExpression(t.identifier(options.trussDebugInfoName), [\n t.stringLiteral(`${options.filename}:${line}`),\n ]);\n\n if (t.isStringLiteral(firstProp.value)) {\n // Static: \"df\" → [\"df\", new TrussDebugInfo(\"...\")]\n firstProp.value = t.arrayExpression([firstProp.value, debugExpr]);\n } else if (t.isArrayExpression(firstProp.value)) {\n // Variable tuple: [\"mt_var\", { vars }] → [\"mt_var\", { vars }, new TrussDebugInfo(\"...\")]\n firstProp.value.elements.push(debugExpr);\n }\n}\n\n// ---------------------------------------------------------------------------\n// JSX css= attribute handling\n// ---------------------------------------------------------------------------\n\n/** Build the spread expression for a JSX `css=` attribute. */\nfunction buildCssSpreadExpression(\n path: NodePath<t.JSXAttribute>,\n styleHash: t.Expression,\n line: number | null,\n options: RewriteSitesOptions,\n): t.Expression {\n const existingClassNameExpr = removeExistingAttribute(path, \"className\");\n const existingStyleExpr = removeExistingAttribute(path, \"style\");\n\n if (!existingClassNameExpr && !existingStyleExpr) {\n return buildPropsCall(styleHash, line, options);\n }\n\n // mergeProps(className, style, hash)\n options.needsMergePropsHelper.current = true;\n\n if (options.debug && line !== null) {\n injectDebugInfo(styleHash as t.ObjectExpression, line, options);\n }\n\n return t.callExpression(t.identifier(options.mergePropsHelperName), [\n existingClassNameExpr ?? t.identifier(\"undefined\"),\n existingStyleExpr ?? t.identifier(\"undefined\"),\n styleHash,\n ]);\n}\n\n/** Emit `trussProps(hash)` call. In debug mode, injects debug info into the hash first. */\nfunction buildPropsCall(styleHash: t.Expression, line: number | null, options: RewriteSitesOptions): t.CallExpression {\n options.needsTrussPropsHelper.current = true;\n\n if (options.debug && line !== null && t.isObjectExpression(styleHash)) {\n injectDebugInfo(styleHash, line, options);\n }\n\n return t.callExpression(t.identifier(options.trussPropsHelperName), [styleHash]);\n}\n\n/** Remove a sibling JSX attribute and return its expression. */\nfunction removeExistingAttribute(path: NodePath<t.JSXAttribute>, attrName: string): t.Expression | null {\n const openingElement = path.parentPath;\n if (!openingElement || !openingElement.isJSXOpeningElement()) return null;\n\n const attrs = openingElement.node.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs[i];\n if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name, { name: attrName })) continue;\n\n let expr: t.Expression | null = null;\n if (t.isStringLiteral(attr.value)) {\n expr = attr.value;\n } else if (t.isJSXExpressionContainer(attr.value) && t.isExpression(attr.value.expression)) {\n expr = attr.value.expression;\n }\n\n attrs.splice(i, 1);\n return expr;\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Css.props(...) rewriting\n// ---------------------------------------------------------------------------\n\n/**\n * Rewrite `Css.props(expr)` into `trussProps(expr)`.\n *\n * In the new model, the argument is already a style hash, so we just delegate to trussProps.\n */\nfunction rewriteCssPropsCalls(options: RewriteSitesOptions): void {\n traverse(options.ast, {\n CallExpression(path: NodePath<t.CallExpression>) {\n if (!isCssPropsCall(path.node, options.cssBindingName)) return;\n\n const arg = path.node.arguments[0];\n if (!arg || t.isSpreadElement(arg) || !t.isExpression(arg) || path.node.arguments.length !== 1) return;\n\n const line = path.node.loc?.start.line ?? null;\n\n options.needsTrussPropsHelper.current = true;\n\n // Check for a sibling `className` property in the parent object literal\n const classNameExpr = extractSiblingClassName(path);\n if (classNameExpr) {\n options.needsMergePropsHelper.current = true;\n path.replaceWith(\n t.callExpression(t.identifier(options.mergePropsHelperName), [classNameExpr, t.identifier(\"undefined\"), arg]),\n );\n } else {\n path.replaceWith(t.callExpression(t.identifier(options.trussPropsHelperName), [arg]));\n }\n },\n });\n}\n\n// ---------------------------------------------------------------------------\n// Second pass: remaining css={...} attributes\n// ---------------------------------------------------------------------------\n\n/**\n * Rewrite any remaining `css={expr}` JSX attributes into `{...trussProps(expr)}`.\n *\n * This handles cases where the css prop value is not a direct `Css.*.$` chain,\n * e.g. `css={someVariable}`, `css={{ ...a, ...b }}`, `css={cond ? a : b}`.\n *\n * In the new model, all of these just need to be wrapped in trussProps().\n */\nfunction rewriteCssAttributeExpressions(options: RewriteSitesOptions): void {\n traverse(options.ast, {\n JSXAttribute(path: NodePath<t.JSXAttribute>) {\n if (!t.isJSXIdentifier(path.node.name, { name: \"css\" })) return;\n const value = path.node.value;\n if (!t.isJSXExpressionContainer(value)) return;\n if (!t.isExpression(value.expression)) return;\n\n const expr = value.expression;\n const line = path.node.loc?.start.line ?? null;\n\n const existingClassNameExpr = removeExistingAttribute(path, \"className\");\n const existingStyleExpr = removeExistingAttribute(path, \"style\");\n\n if (existingClassNameExpr || existingStyleExpr) {\n options.needsMergePropsHelper.current = true;\n path.replaceWith(\n t.jsxSpreadAttribute(\n t.callExpression(t.identifier(options.mergePropsHelperName), [\n existingClassNameExpr ?? t.identifier(\"undefined\"),\n existingStyleExpr ?? t.identifier(\"undefined\"),\n expr,\n ]),\n ),\n );\n } else {\n options.needsTrussPropsHelper.current = true;\n path.replaceWith(t.jsxSpreadAttribute(t.callExpression(t.identifier(options.trussPropsHelperName), [expr])));\n }\n },\n });\n}\n\n// ---------------------------------------------------------------------------\n// Utility helpers\n// ---------------------------------------------------------------------------\n\n/** Match `Css.props(...)` calls. */\nfunction isCssPropsCall(expr: t.CallExpression, cssBindingName: string): boolean {\n return (\n t.isMemberExpression(expr.callee) &&\n !expr.callee.computed &&\n t.isIdentifier(expr.callee.object, { name: cssBindingName }) &&\n t.isIdentifier(expr.callee.property, { name: \"props\" })\n );\n}\n\n/**\n * If `...Css.props(...)` is spread inside an object literal that has a sibling\n * `className` property, extract and remove that property so the rewrite can\n * merge it via `mergeProps`.\n */\nfunction extractSiblingClassName(callPath: NodePath<t.CallExpression>): t.Expression | null {\n // Walk up: CallExpression → SpreadElement → ObjectExpression\n const spreadPath = callPath.parentPath;\n if (!spreadPath || !spreadPath.isSpreadElement()) return null;\n const objectPath = spreadPath.parentPath;\n if (!objectPath || !objectPath.isObjectExpression()) return null;\n\n const properties = objectPath.node.properties;\n for (let i = 0; i < properties.length; i++) {\n const prop = properties[i];\n if (!t.isObjectProperty(prop)) continue;\n if (!isMatchingPropertyName(prop.key, \"className\")) continue;\n if (!t.isExpression(prop.value)) continue;\n\n const classNameExpr = prop.value;\n properties.splice(i, 1);\n return classNameExpr;\n }\n\n return null;\n}\n\n/** Match static object property names. */\nfunction isMatchingPropertyName(key: t.Expression | t.Identifier | t.PrivateName, name: string): boolean {\n return (t.isIdentifier(key) && key.name === name) || (t.isStringLiteral(key) && key.value === name);\n}\n","import { parse } from \"@babel/parser\";\nimport * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport { resolveFullChain } from \"./resolve-chain\";\nimport { extractChain, findCssImportBinding } from \"./ast-utils\";\nimport { collectStaticStringBindings, resolveStaticString } from \"./css-ts-utils\";\nimport { camelToKebab } from \"./emit-truss\";\n\n/**\n * Transform a `.css.ts` file into a plain CSS string.\n *\n * The file is expected to have the shape:\n * ```ts\n * import { Css } from \"./Css\";\n * export const css = {\n * \".some-selector\": Css.df.blue.$,\n * \".other > .selector\": Css.mt(2).black.$,\n * };\n * ```\n *\n * Each key is a CSS selector (string literal), each value is a `Css.*.$` chain.\n * The chains are resolved via the truss mapping into concrete CSS declarations.\n *\n * Returns the generated CSS string.\n */\nexport function transformCssTs(code: string, filename: string, mapping: TrussMapping): string {\n const ast = parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n });\n\n const cssBindingName = findCssImportBinding(ast);\n if (!cssBindingName) {\n return `/* [truss] ${filename}: no Css import found */\\n`;\n }\n\n // Find the `export const css = { ... }` expression\n const cssExport = findNamedCssExportObject(ast);\n if (!cssExport) {\n return `/* [truss] ${filename}: expected \\`export const css = { ... }\\` with an object literal */\\n`;\n }\n\n const rules: string[] = [];\n const stringBindings = collectStaticStringBindings(ast);\n\n for (const prop of cssExport.properties) {\n if (t.isSpreadElement(prop)) {\n rules.push(`/* [truss] unsupported: spread elements in css.ts export */`);\n continue;\n }\n\n if (!t.isObjectProperty(prop)) {\n rules.push(`/* [truss] unsupported: non-property in css.ts export */`);\n continue;\n }\n\n // Key must be a string literal (the CSS selector)\n const selector = objectPropertyStringKey(prop, stringBindings);\n if (selector === null) {\n rules.push(`/* [truss] unsupported: non-string-literal key in css.ts export */`);\n continue;\n }\n\n // Value must be a Css.*.$ expression\n const valueNode = prop.value;\n if (!t.isExpression(valueNode)) {\n rules.push(`/* [truss] unsupported: \"${selector}\" value is not an expression */`);\n continue;\n }\n\n const cssResult = resolveCssExpression(valueNode, cssBindingName, mapping, filename);\n if (\"error\" in cssResult) {\n rules.push(`/* [truss] unsupported: \"${selector}\" — ${cssResult.error} */`);\n continue;\n }\n\n rules.push(formatCssRule(selector, cssResult.declarations));\n }\n\n return rules.join(\"\\n\\n\") + \"\\n\";\n}\n\n/** Find the object expression in `export const css = { ... }`. */\nfunction findNamedCssExportObject(ast: t.File): t.ObjectExpression | null {\n for (const node of ast.program.body) {\n if (!t.isExportNamedDeclaration(node) || !node.declaration) continue;\n if (!t.isVariableDeclaration(node.declaration)) continue;\n\n for (const declarator of node.declaration.declarations) {\n if (!t.isIdentifier(declarator.id, { name: \"css\" })) continue;\n const value = unwrapObjectExpression(declarator.init);\n if (value) return value;\n }\n }\n return null;\n}\n\nfunction unwrapObjectExpression(node: t.Expression | null | undefined): t.ObjectExpression | null {\n if (!node) return null;\n if (t.isObjectExpression(node)) return node;\n if (t.isTSAsExpression(node) || t.isTSSatisfiesExpression(node)) return unwrapObjectExpression(node.expression);\n return null;\n}\n\n/** Extract a static string key from an ObjectProperty. */\nfunction objectPropertyStringKey(prop: t.ObjectProperty, stringBindings: Map<string, string>): string | null {\n if (t.isStringLiteral(prop.key)) return prop.key.value;\n // Allow unquoted identifiers as keys too (e.g. `body: Css.df.$`)\n if (t.isIdentifier(prop.key) && !prop.computed) return prop.key.name;\n if (prop.computed) return resolveStaticString(prop.key, stringBindings);\n return null;\n}\n\ninterface CssResolution {\n declarations: Array<{ property: string; value: string }>;\n error?: undefined;\n}\ninterface CssError {\n declarations?: undefined;\n error: string;\n}\n\n/**\n * Resolve a `Css.*.$` expression node to CSS declarations.\n *\n * Validates that the chain only uses static/literal patterns (no variable args,\n * no if/else conditionals, no pseudo/media modifiers).\n */\nfunction resolveCssExpression(\n node: t.Expression,\n cssBindingName: string,\n mapping: TrussMapping,\n filename: string,\n): CssResolution | CssError {\n // The expression must end with `.$`\n if (!t.isMemberExpression(node) || node.computed || !t.isIdentifier(node.property, { name: \"$\" })) {\n return { error: \"value must be a Css.*.$ expression\" };\n }\n\n const chain = extractChain(node.object, cssBindingName);\n if (!chain) {\n return { error: \"could not extract Css chain from expression\" };\n }\n\n // Validate: no if/else nodes\n for (const n of chain) {\n if (n.type === \"if\") return { error: \"if() conditionals are not supported in .css.ts files\" };\n if (n.type === \"else\") return { error: \"else is not supported in .css.ts files\" };\n }\n\n const resolved = resolveFullChain(chain, mapping);\n\n // Check for errors from resolution\n if (resolved.errors.length > 0) {\n return { error: resolved.errors[0] };\n }\n\n // Validate: no conditionals came back\n for (const part of resolved.parts) {\n if (part.type === \"conditional\") {\n return { error: \"conditional chains are not supported in .css.ts files\" };\n }\n }\n\n // Collect all declarations from all unconditional parts\n const declarations: Array<{ property: string; value: string }> = [];\n\n for (const part of resolved.parts) {\n if (part.type !== \"unconditional\") continue;\n for (const seg of part.segments) {\n if (seg.error) {\n return { error: seg.error };\n }\n\n // Reject segments that require runtime (variable with variable args)\n if (seg.variableProps && !seg.argResolved) {\n return { error: `variable value with variable argument is not supported in .css.ts files` };\n }\n if (seg.typographyLookup) {\n return { error: `typography() with a runtime key is not supported in .css.ts files` };\n }\n if (seg.styleArrayArg) {\n return { error: `add(cssProp) is not supported in .css.ts files` };\n }\n\n // Reject segments with media query / pseudo-class / pseudo-element / when modifiers\n if (seg.mediaQuery) {\n return { error: `media query modifiers (ifSm, ifMd, etc.) are not supported in .css.ts files` };\n }\n if (seg.pseudoClass) {\n return { error: `pseudo-class modifiers (onHover, onFocus, etc.) are not supported in .css.ts files` };\n }\n if (seg.pseudoElement) {\n return { error: `pseudo-element modifiers are not supported in .css.ts files` };\n }\n if (seg.whenPseudo) {\n return { error: `when() modifiers are not supported in .css.ts files` };\n }\n\n // Extract CSS property/value pairs from defs\n for (const [prop, value] of Object.entries(seg.defs)) {\n if (typeof value === \"string\" || typeof value === \"number\") {\n declarations.push({ property: camelToKebab(prop), value: String(value) });\n } else {\n // Nested condition objects (shouldn't happen after our validation, but defensive)\n return { error: `unexpected nested value for property \"${prop}\"` };\n }\n }\n }\n }\n\n return { declarations };\n}\n\n/** Format a CSS rule block. */\nfunction formatCssRule(selector: string, declarations: Array<{ property: string; value: string }>): string {\n if (declarations.length === 0) {\n return `${selector} {}`;\n }\n const body = declarations.map((d) => ` ${d.property}: ${d.value};`).join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n","import * as t from \"@babel/types\";\n\n/** Resolve module-scope string constants so .css.ts selectors can reuse them. */\nexport function collectStaticStringBindings(ast: t.File): Map<string, string> {\n const bindings = new Map<string, string>();\n let changed = true;\n\n while (changed) {\n changed = false;\n\n for (const node of ast.program.body) {\n const declaration = getTopLevelVariableDeclaration(node);\n if (!declaration) continue;\n\n for (const declarator of declaration.declarations) {\n if (!t.isIdentifier(declarator.id) || !declarator.init) continue;\n if (bindings.has(declarator.id.name)) continue;\n\n const value = resolveStaticString(declarator.init, bindings);\n if (value === null) continue;\n\n bindings.set(declarator.id.name, value);\n changed = true;\n }\n }\n }\n\n return bindings;\n}\n\n/** Resolve a static string expression from a literal, template, or identifier. */\nexport function resolveStaticString(node: t.Node | null | undefined, bindings: Map<string, string>): string | null {\n if (!node) return null;\n\n if (t.isStringLiteral(node)) return node.value;\n\n if (t.isTemplateLiteral(node)) {\n let value = \"\";\n for (let i = 0; i < node.quasis.length; i++) {\n value += node.quasis[i].value.cooked ?? \"\";\n if (i >= node.expressions.length) continue;\n\n const expressionValue = resolveStaticString(node.expressions[i], bindings);\n if (expressionValue === null) return null;\n value += expressionValue;\n }\n return value;\n }\n\n if (t.isIdentifier(node)) {\n return bindings.get(node.name) ?? null;\n }\n\n if (t.isTSAsExpression(node) || t.isTSSatisfiesExpression(node) || t.isTSNonNullExpression(node)) {\n return resolveStaticString(node.expression, bindings);\n }\n\n if (t.isParenthesizedExpression(node)) {\n return resolveStaticString(node.expression, bindings);\n }\n\n if (t.isBinaryExpression(node, { operator: \"+\" })) {\n const left = resolveStaticString(node.left, bindings);\n const right = resolveStaticString(node.right, bindings);\n if (left === null || right === null) return null;\n return left + right;\n }\n\n return null;\n}\n\nfunction getTopLevelVariableDeclaration(node: t.Statement): t.VariableDeclaration | null {\n if (t.isVariableDeclaration(node)) {\n return node;\n }\n\n if (t.isExportNamedDeclaration(node) && node.declaration && t.isVariableDeclaration(node.declaration)) {\n return node.declaration;\n }\n\n return null;\n}\n","import { parse } from \"@babel/parser\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport { findLastImportIndex } from \"./ast-utils\";\n\n// Babel generator is published as CJS, so normalize default interop before using it.\nconst generate = ((_generate as unknown as { default?: typeof _generate }).default ?? _generate) as typeof _generate;\n\nexport interface RewriteCssTsImportsResult {\n code: string;\n changed: boolean;\n}\n\n/**\n * Rewrite `.css.ts` imports so runtime imports stay pointed at the real module,\n * while a separate `?truss-css` side-effect import is added for generated CSS.\n *\n * I.e. `import { foo } from \"./App.css.ts\"` becomes:\n * - `import { foo } from \"./App.css.ts\"`\n * - `import \"./App.css.ts?truss-css\"`\n *\n * Pure side-effect imports are rewritten directly to the virtual CSS import.\n */\nexport function rewriteCssTsImports(code: string, filename: string): RewriteCssTsImportsResult {\n if (!code.includes(\".css.ts\")) {\n return { code, changed: false };\n }\n\n const ast = parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n });\n\n const existingCssSideEffects = new Set<string>();\n const neededCssSideEffects = new Set<string>();\n let changed = false;\n\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n if (typeof node.source.value !== \"string\") continue;\n if (!node.source.value.endsWith(\".css.ts\")) continue;\n\n if (node.specifiers.length === 0) {\n node.source = t.stringLiteral(toVirtualCssSpecifier(node.source.value));\n existingCssSideEffects.add(node.source.value);\n changed = true;\n continue;\n }\n\n neededCssSideEffects.add(toVirtualCssSpecifier(node.source.value));\n }\n\n const sideEffectImports: t.ImportDeclaration[] = [];\n for (const source of neededCssSideEffects) {\n if (existingCssSideEffects.has(source)) continue;\n sideEffectImports.push(t.importDeclaration([], t.stringLiteral(source)));\n changed = true;\n }\n\n if (!changed) {\n return { code, changed: false };\n }\n\n if (sideEffectImports.length > 0) {\n const insertIndex = findLastImportIndex(ast) + 1;\n ast.program.body.splice(insertIndex, 0, ...sideEffectImports);\n }\n\n const output = generate(ast, {\n sourceFileName: filename,\n retainLines: false,\n });\n return { code: output.code, changed: true };\n}\n\nfunction toVirtualCssSpecifier(source: string): string {\n return `${source}?truss-css`;\n}\n"],"mappings":";AAAA,SAAS,cAAc,eAAe,kBAAkB;AACxD,SAAS,SAAS,SAAS,YAAY,YAAY;;;ACDnD,YAAY,OAAO;;;ACWnB,IAAM,mBAAmB,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AAe,QAAQ,IAAI,GAAG,MAAM;AACrD;AAGA,SAAS,kBAAkB,IAAoB;AAC7C,QAAM,aAAa,GAAG,QAAQ,GAAG;AACjC,QAAM,YAAY,GAAG,QAAQ,GAAG;AAEhC,MAAI,MAAM,GAAG;AACb,MAAI,cAAc,EAAG,OAAM,KAAK,IAAI,KAAK,UAAU;AACnD,MAAI,aAAa,EAAG,OAAM,KAAK,IAAI,KAAK,SAAS;AAEjD,QAAM,UAAU,GAAG,MAAM,GAAG,GAAG;AAE/B,MAAI,QAAQ,WAAW,OAAO,GAAG;AAC/B,WAAO,QAAQ,MAAM,CAAC;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,UAA2B;AACpD,SAAO,cAAc,QAAQ,EAAE,SAAS,gBAAgB;AAC1D;AAEA,SAAS,iCAAiC,UAAkB,kBAAqC;AAC/F,QAAM,iBAAiB,cAAc,QAAQ;AAC7C,SAAO,iBAAiB,KAAK,SAAU,KAAK;AAC1C,WAAO,eAAe,SAAS,iBAAiB,GAAG,GAAG;AAAA,EACxD,CAAC;AACH;AAEA,SAAS,cAAc,MAAsB;AAC3C,SAAO,KAAK,QAAQ,OAAO,GAAG;AAChC;AAGO,SAAS,YAAY,MAA4B;AACtD,QAAM,MAAM,aAAa,MAAM,MAAM;AACrC,SAAO,KAAK,MAAM,GAAG;AACvB;","names":["_traverse","_generate","t","pseudoArg","t","t","traverse","_traverse","generate","_generate","parse","t","t","parse","parse","_generate","t","generate","_generate","parse"]}
|
|
1
|
+
{"version":3,"sources":["../../src/plugin/index.ts","../../src/plugin/emit-truss.ts","../../src/plugin/property-priorities.ts","../../src/plugin/priority.ts","../../src/plugin/transform.ts","../../src/plugin/resolve-chain.ts","../../src/plugin/ast-utils.ts","../../src/plugin/rewrite-sites.ts","../../src/plugin/transform-css.ts","../../src/plugin/css-ts-utils.ts","../../src/plugin/rewrite-css-ts-imports.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync } from \"fs\";\nimport { resolve, dirname, isAbsolute, join } from \"path\";\nimport type { TrussMapping } from \"./types\";\nimport type { AtomicRule } from \"./emit-truss\";\nimport { generateCssText } from \"./emit-truss\";\nimport { transformTruss } from \"./transform\";\nimport { transformCssTs } from \"./transform-css\";\nimport { rewriteCssTsImports } from \"./rewrite-css-ts-imports\";\n\nexport interface TrussPluginOptions {\n /** Path to the Css.json mapping file used for transforming files (relative to project root or absolute). */\n mapping: string;\n /** Packages in `node_modules` that should also be transformed, all other `node_modules` files are skipped. */\n externalPackages?: string[];\n}\n\n// Intentionally loose Vite types so we don't depend on the `vite` package at compile time.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TrussVitePlugin {\n name: string;\n enforce?: \"pre\" | \"post\";\n configResolved?: (config: any) => void;\n buildStart?: () => void;\n resolveId?: (source: string, importer: string | undefined) => string | null;\n load?: (id: string) => string | null;\n transform?: (code: string, id: string) => { code: string; map: any } | null;\n configureServer?: (server: any) => void;\n transformIndexHtml?: (html: string) => string;\n handleHotUpdate?: (ctx: any) => void;\n generateBundle?: (options: any, bundle: any) => void;\n writeBundle?: (options: any, bundle: any) => void;\n}\n\n/** Prefix for virtual CSS module IDs generated from .css.ts files. */\nconst VIRTUAL_CSS_PREFIX = \"\\0truss-css:\";\nconst CSS_TS_QUERY = \"?truss-css\";\n\n/** Virtual module IDs for dev HMR. */\nconst VIRTUAL_CSS_ENDPOINT = \"/virtual:truss.css\";\nconst VIRTUAL_RUNTIME_ID = \"virtual:truss:runtime\";\nconst RESOLVED_VIRTUAL_RUNTIME_ID = \"\\0\" + VIRTUAL_RUNTIME_ID;\n\n/**\n * Vite plugin that transforms `Css.*.$` expressions from truss's CssBuilder DSL\n * into Truss-native style hash objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Also supports `.css.ts` files: a `.css.ts` file with\n * `export const css = { \".selector\": Css.blue.$ }` can keep other runtime exports,\n * while imports are supplemented with a virtual CSS side-effect module.\n *\n * In dev mode, serves CSS via a virtual endpoint that the injected runtime keeps in sync.\n * In production, emits a single `truss.css` asset with all atomic rules.\n */\nexport function trussPlugin(opts: TrussPluginOptions): TrussVitePlugin {\n let mapping: TrussMapping | null = null;\n let projectRoot: string;\n let debug = false;\n let isTest = false;\n let isBuild = false;\n const externalPackages = opts.externalPackages ?? [];\n\n // Global CSS rule registry shared across all transform calls within a build\n const cssRegistry = new Map<string, AtomicRule>();\n let cssVersion = 0;\n let lastSentVersion = 0;\n\n function mappingPath(): string {\n return resolve(projectRoot || process.cwd(), opts.mapping);\n }\n\n // Some tooling can call `transform` before `buildStart`; this keeps behavior\n // resilient without requiring hook ordering assumptions.\n function ensureMapping(): TrussMapping {\n if (!mapping) {\n mapping = loadMapping(mappingPath());\n }\n return mapping;\n }\n\n /** Generate the full CSS string from the global registry, ordered by precedence tiers. */\n function collectCss(): string {\n return generateCssText(cssRegistry);\n }\n\n return {\n name: \"truss\",\n enforce: \"pre\",\n\n configResolved(config: any) {\n projectRoot = config.root;\n debug = config.command === \"serve\" || config.mode === \"development\" || config.mode === \"test\";\n isTest = config.mode === \"test\";\n isBuild = config.command === \"build\";\n },\n\n buildStart() {\n ensureMapping();\n // Reset registry at start of each build\n cssRegistry.clear();\n cssVersion = 0;\n lastSentVersion = 0;\n },\n\n // -- Dev mode HMR --\n\n configureServer(server: any) {\n // Skip dev-server setup in test mode — Vitest doesn't start a real HTTP\n // server, so the interval would keep the process alive.\n if (isTest) return;\n\n // Serve the current collected CSS at the virtual endpoint\n server.middlewares.use(function (req: any, res: any, next: any) {\n if (req.url !== VIRTUAL_CSS_ENDPOINT) return next();\n const css = collectCss();\n res.setHeader(\"Content-Type\", \"text/css\");\n res.setHeader(\"Cache-Control\", \"no-store\");\n res.end(css);\n });\n\n // Poll for CSS version changes and push HMR updates\n const interval = setInterval(function () {\n if (cssVersion !== lastSentVersion && server.ws) {\n lastSentVersion = cssVersion;\n server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n }, 150);\n\n // Clean up interval when server closes\n server.httpServer?.on(\"close\", function () {\n clearInterval(interval);\n });\n },\n\n transformIndexHtml(html: string) {\n if (isBuild) return html;\n // Inject the virtual runtime script for dev mode; it owns style updates.\n const tag = `<script type=\"module\" src=\"/${VIRTUAL_RUNTIME_ID}\"></script>`;\n return html.replace(\"</head>\", ` ${tag}\\n </head>`);\n },\n\n handleHotUpdate(ctx: any) {\n // Send CSS update event on any file change for safety\n if (ctx.server?.ws) {\n ctx.server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n },\n\n // -- Virtual module resolution --\n\n resolveId(source: string, importer: string | undefined) {\n // Handle the dev HMR runtime virtual module\n if (source === VIRTUAL_RUNTIME_ID || source === \"/\" + VIRTUAL_RUNTIME_ID) {\n return RESOLVED_VIRTUAL_RUNTIME_ID;\n }\n\n // Handle .css.ts virtual modules\n if (!source.endsWith(CSS_TS_QUERY)) return null;\n\n const absolutePath = resolveImportPath(source.slice(0, -CSS_TS_QUERY.length), importer, projectRoot);\n\n // Only handle it if the .css.ts file actually exists\n if (!existsSync(absolutePath)) return null;\n\n // Return a virtual CSS module ID that maps back to the source .css.ts file.\n // Strip the trailing `.ts` so the ID ends in `.css` — this tells Vite to\n // route the loaded content through its CSS pipeline.\n return VIRTUAL_CSS_PREFIX + absolutePath.slice(0, -3);\n },\n\n load(id: string) {\n // Serve the dev HMR runtime script\n if (id === RESOLVED_VIRTUAL_RUNTIME_ID) {\n return `\n// Truss dev HMR runtime — keeps styles up to date without page reload\n(function() {\n let style = document.getElementById(\"__truss_virtual__\");\n if (!style) {\n style = document.createElement(\"style\");\n style.id = \"__truss_virtual__\";\n document.head.appendChild(style);\n }\n\n function fetchCss() {\n fetch(\"${VIRTUAL_CSS_ENDPOINT}\")\n .then(function(r) { return r.text(); })\n .then(function(css) { style.textContent = css; })\n .catch(function() {});\n }\n\n fetchCss();\n\n if (import.meta.hot) {\n import.meta.hot.on(\"truss:css-update\", fetchCss);\n import.meta.hot.on(\"vite:afterUpdate\", function() {\n setTimeout(fetchCss, 50);\n });\n }\n})();\n`;\n }\n\n // Handle .css.ts virtual modules\n if (!id.startsWith(VIRTUAL_CSS_PREFIX)) return null;\n\n // Re-add `.ts` to recover the original source file path\n const sourcePath = id.slice(VIRTUAL_CSS_PREFIX.length) + \".ts\";\n const sourceCode = readFileSync(sourcePath, \"utf8\");\n return transformCssTs(sourceCode, sourcePath, ensureMapping());\n },\n\n transform(code: string, id: string) {\n // Only process JS/TS/JSX/TSX files\n if (!/\\.[cm]?[jt]sx?(\\?|$)/.test(id)) return null;\n\n const rewrittenImports = rewriteCssTsImports(code, id);\n const rewrittenCode = rewrittenImports.code;\n const hasCssDsl = rewrittenCode.includes(\"Css\");\n if (!hasCssDsl && !rewrittenImports.changed) return null;\n\n const fileId = stripQueryAndHash(id);\n if (isNodeModulesFile(fileId) && !isWhitelistedExternalPackageFile(fileId, externalPackages)) {\n return null;\n }\n\n if (fileId.endsWith(\".css.ts\")) {\n // Keep `.css.ts` modules as normal TS so named exports like class-name\n // constants still work at runtime; only return code when we injected the\n // companion `?truss-css` side-effect import.\n return rewrittenImports.changed ? { code: rewrittenCode, map: null } : null;\n }\n\n if (!hasCssDsl) {\n // Some non-`.css.ts` modules only need the import rewrite and do not have\n // any `Css.*.$` expressions for the main Truss transform to process.\n return { code: rewrittenCode, map: null };\n }\n\n // For regular JS/TS modules that still use the DSL, run the full Truss\n // transform after the import rewrite so both behaviors compose.\n const result = transformTruss(rewrittenCode, fileId, ensureMapping(), {\n debug,\n // In test mode (jsdom), inject CSS directly so document.styleSheets has rules\n injectCss: isTest,\n });\n if (!result) {\n if (!rewrittenImports.changed) return null;\n return { code: rewrittenCode, map: null };\n }\n\n // Merge new rules into the global registry\n if (result.rules) {\n let hasNewRules = false;\n for (const [className, rule] of result.rules) {\n if (!cssRegistry.has(className)) {\n cssRegistry.set(className, rule);\n hasNewRules = true;\n }\n }\n if (hasNewRules) {\n cssVersion++;\n }\n }\n\n return { code: result.code, map: result.map };\n },\n\n // -- Production CSS emission --\n\n generateBundle(_options: any, bundle: any) {\n if (!isBuild) return;\n const css = collectCss();\n if (!css) return;\n\n // Try to append to an existing CSS asset in the bundle\n for (const key of Object.keys(bundle)) {\n const asset = bundle[key];\n if (asset.type === \"asset\" && key.endsWith(\".css\")) {\n asset.source = asset.source + \"\\n\" + css;\n return;\n }\n }\n\n // No existing CSS asset found — emit a standalone truss.css\n (this as any).emitFile({\n type: \"asset\",\n fileName: \"truss.css\",\n source: css,\n });\n },\n\n writeBundle(options: any, bundle: any) {\n if (!isBuild) return;\n const css = collectCss();\n if (!css) return;\n\n // Fallback: if generateBundle didn't find a target, write to disk\n const outDir = options.dir || join(projectRoot, \"dist\");\n const trussPath = join(outDir, \"truss.css\");\n if (!existsSync(trussPath)) {\n // Check if it was appended to an existing CSS asset\n const alreadyEmitted = Object.keys(bundle).some(function (key) {\n const asset = bundle[key];\n return (\n asset.type === \"asset\" &&\n key.endsWith(\".css\") &&\n typeof asset.source === \"string\" &&\n asset.source.includes(css)\n );\n });\n if (!alreadyEmitted) {\n writeFileSync(trussPath, css, \"utf8\");\n }\n }\n },\n };\n}\n\nfunction resolveImportPath(source: string, importer: string | undefined, projectRoot: string | undefined): string {\n if (isAbsolute(source)) {\n return source;\n }\n\n if (importer) {\n return resolve(dirname(importer), source);\n }\n\n return resolve(projectRoot || process.cwd(), source);\n}\n\n/** Strip Vite query/hash suffixes from an id. */\nfunction stripQueryAndHash(id: string): string {\n const queryIndex = id.indexOf(\"?\");\n const hashIndex = id.indexOf(\"#\");\n\n let end = id.length;\n if (queryIndex >= 0) end = Math.min(end, queryIndex);\n if (hashIndex >= 0) end = Math.min(end, hashIndex);\n\n const cleanId = id.slice(0, end);\n // Vite can prefix absolute paths with `/@fs/`.\n if (cleanId.startsWith(\"/@fs/\")) {\n return cleanId.slice(4);\n }\n return cleanId;\n}\n\nfunction isNodeModulesFile(filePath: string): boolean {\n return normalizePath(filePath).includes(\"/node_modules/\");\n}\n\nfunction isWhitelistedExternalPackageFile(filePath: string, externalPackages: string[]): boolean {\n const normalizedPath = normalizePath(filePath);\n return externalPackages.some(function (pkg) {\n return normalizedPath.includes(`/node_modules/${pkg}/`);\n });\n}\n\nfunction normalizePath(path: string): string {\n return path.replace(/\\\\/g, \"/\");\n}\n\n/** Load a truss mapping file synchronously (for tests). */\nexport function loadMapping(path: string): TrussMapping {\n const raw = readFileSync(path, \"utf8\");\n return JSON.parse(raw);\n}\n\nexport type { TrussMapping, TrussMappingEntry } from \"./types\";\n","import * as t from \"@babel/types\";\nimport type { ResolvedChain } from \"./resolve-chain\";\nimport type { ResolvedSegment, TrussMapping } from \"./types\";\nimport { sortRulesByPriority } from \"./priority\";\n\n// -- Atomic CSS rule model --\n\n/** A single atomic CSS rule: one class, one selector, one or more declarations. */\nexport interface AtomicRule {\n className: string;\n cssProperty: string;\n cssValue: string;\n declarations?: Array<{\n cssProperty: string;\n cssValue: string;\n cssVarName?: string;\n }>;\n pseudoClass?: string;\n mediaQuery?: string;\n pseudoElement?: string;\n /** If true, this is a `var(--name)` rule that needs an `@property` declaration. */\n cssVarName?: string;\n /** For when() rules: the relationship selector context. */\n whenSelector?: {\n relationship: string;\n markerClass: string;\n pseudo: string;\n };\n}\n\n/** Pseudo-class short suffixes for class naming. */\nconst PSEUDO_SUFFIX: Record<string, string> = {\n \":hover\": \"_h\",\n \":focus\": \"_f\",\n \":focus-visible\": \"_fv\",\n \":focus-within\": \"_fw\",\n \":active\": \"_a\",\n \":disabled\": \"_d\",\n};\n\n/** Extra pseudo selector abbreviations used when() class names need static-but-safe tokens. */\nconst PSEUDO_SELECTOR_SUFFIX: Record<string, string> = {\n ...PSEUDO_SUFFIX,\n \":not\": \"_n\",\n \":is\": \"_is\",\n \":where\": \"_where\",\n \":has\": \"_has\",\n};\n\n/** Short abbreviations for relationship types in when() class names. */\nconst RELATIONSHIP_SHORT: Record<string, string> = {\n ancestor: \"anc\",\n descendant: \"desc\",\n siblingAfter: \"sibA\",\n siblingBefore: \"sibB\",\n anySibling: \"anyS\",\n};\n\n/** Default marker class name (used when no explicit marker is provided). */\nexport const DEFAULT_MARKER_CLASS = \"_mrk\";\n\n/** Derive a marker class name from a marker AST node (or use the default). */\nexport function markerClassName(markerNode?: { type: string; name?: string }): string {\n if (!markerNode) return DEFAULT_MARKER_CLASS;\n if (markerNode.type === \"Identifier\" && markerNode.name) {\n return `_${markerNode.name}_mrk`;\n }\n return \"_marker_mrk\";\n}\n\n/**\n * Build a when() class name prefix from whenPseudo info.\n *\n * I.e. `when(marker, \"ancestor\", \":hover\")` → `\"wh_anc_h_\"`,\n * `when(row, \"ancestor\", \":hover\")` → `\"wh_anc_h_row_\"`.\n */\nfunction whenPrefix(whenPseudo: { pseudo: string; markerNode?: any; relationship?: string }): string {\n const rel = RELATIONSHIP_SHORT[whenPseudo.relationship ?? \"ancestor\"] ?? \"anc\";\n const pseudoTag = pseudoSelectorTag(whenPseudo.pseudo);\n const markerPart = whenPseudo.markerNode?.type === \"Identifier\" ? `${whenPseudo.markerNode.name}_` : \"\";\n return `wh_${rel}_${pseudoTag}_${markerPart}`;\n}\n\n/** Convert a pseudo selector into a safe class-name token while preserving raw selector emission. */\nfunction pseudoSelectorTag(pseudo: string): string {\n const replaced = pseudo.trim().replace(/::?[a-zA-Z-]+/g, function (match) {\n return `_${pseudoIdentifierTag(match)}_`;\n });\n const cleaned = replaced\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n return cleaned || \"pseudo\";\n}\n\nfunction pseudoIdentifierTag(pseudo: string): string {\n const normalized = normalizePseudoIdentifier(pseudo);\n const known = PSEUDO_SELECTOR_SUFFIX[normalized];\n if (known) {\n return known.replace(/^_/, \"\");\n }\n return normalized.replace(/^::?/, \"\").replace(/-/g, \"_\");\n}\n\nfunction normalizePseudoIdentifier(pseudo: string): string {\n const prefixMatch = pseudo.match(/^::?/);\n const prefix = prefixMatch?.[0] ?? \"\";\n const name = pseudo.slice(prefix.length).replace(/[A-Z]/g, function (match) {\n return `-${match.toLowerCase()}`;\n });\n return `${prefix}${name}`;\n}\n\n/**\n * Build a condition prefix string for class naming.\n *\n * Conditions are prefixed so class names read naturally in the DOM:\n * I.e. `h_bgBlack` reads as \"on hover, bgBlack\".\n */\nfunction conditionPrefix(\n pseudoClass: string | null | undefined,\n mediaQuery: string | null | undefined,\n pseudoElement: string | null | undefined,\n breakpoints?: Record<string, string>,\n): string {\n const parts: string[] = [];\n if (pseudoElement) {\n // I.e. \"::placeholder\" → \"placeholder_\"\n parts.push(`${pseudoElement.replace(/^::/, \"\")}_`);\n }\n if (mediaQuery && breakpoints) {\n // Find breakpoint name, i.e. \"ifSm\" → \"sm_\"\n const bpKey = Object.entries(breakpoints).find(([, v]) => v === mediaQuery)?.[0];\n if (bpKey) {\n const shortName = bpKey.replace(/^if/, \"\").toLowerCase();\n parts.push(`${shortName}_`);\n } else {\n parts.push(\"mq_\");\n }\n } else if (mediaQuery) {\n parts.push(\"mq_\");\n }\n if (pseudoClass) {\n parts.push(`${pseudoSelectorTag(pseudoClass)}_`);\n }\n return parts.join(\"\");\n}\n\n/** Convert camelCase CSS property to kebab-case (handles vendor prefixes like WebkitTransform). */\nexport function camelToKebab(s: string): string {\n return s.replace(/^(Webkit|Moz|Ms|O)/, (m) => `-${m.toLowerCase()}`).replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n}\n\n/** Clean a CSS value for use in a class name. */\nfunction cleanValueForClassName(value: string): string {\n // I.e. -8px → neg8px, 16px → 16px, \"0 0 0 1px blue\" → 0_0_0_1px_blue\n let cleaned = value;\n if (cleaned.startsWith(\"-\")) {\n cleaned = \"neg\" + cleaned.slice(1);\n }\n return cleaned\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n}\n\n/**\n * Build a reverse lookup from `\"cssProperty\\0cssValue\"` → canonical abbreviation name.\n *\n * For each single-property static abbreviation in the mapping, records the\n * canonical name so multi-property abbreviations can reuse it.\n * I.e. `{ paddingTop: \"8px\" }` → `\"pt1\"`, `{ borderStyle: \"solid\" }` → `\"bss\"`.\n */\nfunction buildLonghandLookup(mapping: TrussMapping): Map<string, string> {\n const lookup = new Map<string, string>();\n for (const [abbrev, entry] of Object.entries(mapping.abbreviations)) {\n if (entry.kind !== \"static\") continue;\n const props = Object.keys(entry.defs);\n if (props.length !== 1) continue;\n const prop = props[0];\n const value = String(entry.defs[prop]);\n const key = `${prop}\\0${value}`;\n // First match wins — if multiple abbreviations produce the same declaration,\n // the one that appears first in the mapping is canonical.\n if (!lookup.has(key)) {\n lookup.set(key, abbrev);\n }\n }\n return lookup;\n}\n\n/** Cached longhand lookup per mapping (keyed by identity). */\nlet cachedMapping: TrussMapping | null = null;\nlet cachedLookup: Map<string, string> | null = null;\n\n/** Get or build the longhand lookup for a mapping. */\nfunction getLonghandLookup(mapping: TrussMapping): Map<string, string> {\n if (cachedMapping !== mapping) {\n cachedMapping = mapping;\n cachedLookup = buildLonghandLookup(mapping);\n }\n return cachedLookup!;\n}\n\n/**\n * Compute the base class name for a static segment.\n *\n * For multi-property abbreviations, looks up the canonical single-property\n * abbreviation name so classes are maximally reused.\n * I.e. `p1` → `pt1`, `pr1`, `pb1`, `pl1` (not `p1_paddingTop`, etc.)\n * I.e. `ba` → `bss`, `bw1` (not `ba_borderStyle`, etc.)\n *\n * For literal-folded variables (argResolved set), includes the value:\n * I.e. `mt(2)` → `mt_16px`, `bc(\"red\")` → `bc_red`.\n */\nfunction computeStaticBaseName(\n seg: ResolvedSegment,\n cssProp: string,\n cssValue: string,\n isMultiProp: boolean,\n mapping: TrussMapping,\n): string {\n const abbr = seg.abbr;\n\n if (seg.argResolved !== undefined) {\n const valuePart = cleanValueForClassName(seg.argResolved);\n if (isMultiProp) {\n // Try to find a canonical single-property abbreviation for this longhand\n const lookup = getLonghandLookup(mapping);\n const canonical = lookup.get(`${cssProp}\\0${cssValue}`);\n if (canonical) return canonical;\n return `${abbr}_${valuePart}_${cssProp}`;\n }\n return `${abbr}_${valuePart}`;\n }\n\n if (isMultiProp) {\n // Try to find a canonical single-property abbreviation for this longhand\n const lookup = getLonghandLookup(mapping);\n const canonical = lookup.get(`${cssProp}\\0${cssValue}`);\n if (canonical) return canonical;\n return `${abbr}_${cssProp}`;\n }\n\n return abbr;\n}\n\n// -- Collecting atomic rules from resolved chains --\n\nexport interface CollectedRules {\n rules: Map<string, AtomicRule>;\n needsMaybeInc: boolean;\n}\n\n/**\n * Collect all atomic CSS rules from resolved chains.\n *\n * Each segment maps directly to one or more atomic rules based on its\n * condition context (mediaQuery, pseudoClass, pseudoElement, whenPseudo).\n */\nexport function collectAtomicRules(chains: ResolvedChain[], mapping: TrussMapping): CollectedRules {\n const rules = new Map<string, AtomicRule>();\n let needsMaybeInc = false;\n\n function collectSegment(seg: ResolvedSegment): void {\n if (seg.error || seg.styleArrayArg) return;\n if (seg.typographyLookup) {\n for (const segments of Object.values(seg.typographyLookup.segmentsByName)) {\n for (const nestedSeg of segments) {\n collectSegment(nestedSeg);\n }\n }\n return;\n }\n if (seg.incremented) needsMaybeInc = true;\n if (seg.variableProps) {\n collectVariableRules(rules, seg, mapping);\n } else {\n collectStaticRules(rules, seg, mapping);\n }\n }\n\n for (const chain of chains) {\n for (const part of chain.parts) {\n const segs = part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n for (const seg of segs) {\n collectSegment(seg);\n }\n }\n }\n\n return { rules, needsMaybeInc };\n}\n\n/** Compute the class name prefix and optional whenSelector for a segment. */\nfunction segmentContext(\n seg: ResolvedSegment,\n mapping: TrussMapping,\n): { prefix: string; whenSelector?: AtomicRule[\"whenSelector\"] } {\n if (seg.whenPseudo) {\n const wp = seg.whenPseudo;\n return {\n prefix: whenPrefix(wp),\n whenSelector: {\n relationship: wp.relationship ?? \"ancestor\",\n markerClass: markerClassName(wp.markerNode),\n pseudo: wp.pseudo,\n },\n };\n }\n return { prefix: conditionPrefix(seg.pseudoClass, seg.mediaQuery, seg.pseudoElement, mapping.breakpoints) };\n}\n\n/** Build the base AtomicRule fields (non-when conditions). */\nfunction baseRuleFields(seg: ResolvedSegment): Pick<AtomicRule, \"pseudoClass\" | \"mediaQuery\" | \"pseudoElement\"> {\n return {\n pseudoClass: seg.pseudoClass ?? undefined,\n mediaQuery: seg.mediaQuery ?? undefined,\n pseudoElement: seg.pseudoElement ?? undefined,\n };\n}\n\n/** Collect atomic rules for a static segment (may have multiple CSS properties). */\nfunction collectStaticRules(rules: Map<string, AtomicRule>, seg: ResolvedSegment, mapping: TrussMapping): void {\n const { prefix, whenSelector } = segmentContext(seg, mapping);\n const isMultiProp = Object.keys(seg.defs).length > 1;\n\n for (const [cssProp, value] of Object.entries(seg.defs)) {\n const cssValue = String(value);\n const baseName = computeStaticBaseName(seg, cssProp, cssValue, isMultiProp, mapping);\n const className = prefix ? `${prefix}${baseName}` : baseName;\n\n if (!rules.has(className)) {\n rules.set(className, {\n className,\n cssProperty: camelToKebab(cssProp),\n cssValue,\n ...(!whenSelector && baseRuleFields(seg)),\n whenSelector,\n });\n }\n }\n}\n\n/** Collect atomic rules for a variable segment. */\nfunction collectVariableRules(rules: Map<string, AtomicRule>, seg: ResolvedSegment, mapping: TrussMapping): void {\n const { prefix, whenSelector } = segmentContext(seg, mapping);\n\n for (const prop of seg.variableProps!) {\n const className = prefix ? `${prefix}${seg.abbr}_var` : `${seg.abbr}_var`;\n const varName = toCssVariableName(className, seg.abbr, prop);\n const declaration = { cssProperty: camelToKebab(prop), cssValue: `var(${varName})`, cssVarName: varName };\n\n const existingRule = rules.get(className);\n if (!existingRule) {\n rules.set(className, {\n className,\n cssProperty: declaration.cssProperty,\n cssValue: declaration.cssValue,\n declarations: [declaration],\n cssVarName: varName,\n ...(!whenSelector && baseRuleFields(seg)),\n whenSelector,\n });\n continue;\n }\n\n existingRule.declarations ??= [\n {\n cssProperty: existingRule.cssProperty,\n cssValue: existingRule.cssValue,\n cssVarName: existingRule.cssVarName,\n },\n ];\n if (\n !existingRule.declarations.some(function (entry) {\n return entry.cssProperty === declaration.cssProperty;\n })\n ) {\n existingRule.declarations.push(declaration);\n }\n }\n\n // Extra static defs alongside variable props\n if (seg.variableExtraDefs) {\n for (const [cssProp, value] of Object.entries(seg.variableExtraDefs)) {\n const extraBase = `${seg.abbr}_${cssProp}`;\n const extraName = prefix ? `${prefix}${extraBase}` : extraBase;\n if (!rules.has(extraName)) {\n rules.set(extraName, {\n className: extraName,\n cssProperty: camelToKebab(cssProp),\n cssValue: String(value),\n ...(!whenSelector && baseRuleFields(seg)),\n whenSelector,\n });\n }\n }\n }\n}\n\n// -- CSS text generation --\n\n/**\n * Generate the full CSS text from collected rules, sorted by StyleX priority.\n *\n * Uses an additive priority system where property tier + pseudo + at-rule priorities\n * are summed to produce a single sort key, guaranteeing longhands beat shorthands,\n * pseudo-classes follow LVFHA order, and at-rules override base styles.\n */\nexport function generateCssText(rules: Map<string, AtomicRule>): string {\n const allRules = Array.from(rules.values());\n\n // Single flat sort by computed priority\n sortRulesByPriority(allRules);\n\n const lines: string[] = [];\n\n for (const rule of allRules) {\n lines.push(formatRule(rule));\n }\n\n // @property declarations for variable rules\n for (const rule of allRules) {\n for (const declaration of getRuleDeclarations(rule)) {\n if (declaration.cssVarName) {\n lines.push(`@property ${declaration.cssVarName} { syntax: \"*\"; inherits: false; }`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/** Format a single rule into its CSS text, dispatching by rule type. */\nfunction formatRule(rule: AtomicRule): string {\n if (rule.whenSelector) return formatWhenRule(rule);\n if (rule.mediaQuery && rule.pseudoClass) return formatMediaPseudoRule(rule);\n if (rule.mediaQuery && rule.pseudoElement) return formatMediaPseudoElementRule(rule);\n if (rule.mediaQuery) return formatMediaRule(rule);\n if (rule.pseudoClass && rule.pseudoElement) return formatPseudoRule(rule);\n if (rule.pseudoElement) return formatPseudoElementRule(rule);\n if (rule.pseudoClass) return formatPseudoRule(rule);\n return formatBaseRule(rule);\n}\n\nfunction formatBaseRule(rule: AtomicRule): string {\n return formatRuleBlock(`.${rule.className}`, rule);\n}\n\nfunction formatPseudoRule(rule: AtomicRule): string {\n const pe = rule.pseudoElement ? rule.pseudoElement : \"\";\n return formatRuleBlock(`.${rule.className}${rule.pseudoClass}${pe}`, rule);\n}\n\nfunction formatPseudoElementRule(rule: AtomicRule): string {\n return formatRuleBlock(`.${rule.className}${rule.pseudoElement}`, rule);\n}\n\nfunction formatWhenRule(rule: AtomicRule): string {\n const whenSelector = rule.whenSelector;\n if (!whenSelector) {\n return formatBaseRule(rule);\n }\n\n const markerSelector = `.${whenSelector.markerClass}${whenSelector.pseudo}`;\n const targetSelector = `.${rule.className}`;\n\n if (whenSelector.relationship === \"ancestor\") {\n return formatRuleBlock(`${markerSelector} ${targetSelector}`, rule);\n }\n if (whenSelector.relationship === \"descendant\") {\n return formatRuleBlock(`${targetSelector}:has(${markerSelector})`, rule);\n }\n if (whenSelector.relationship === \"siblingAfter\") {\n return formatRuleBlock(`${targetSelector}:has(~ ${markerSelector})`, rule);\n }\n if (whenSelector.relationship === \"siblingBefore\") {\n return formatRuleBlock(`${markerSelector} ~ ${targetSelector}`, rule);\n }\n if (whenSelector.relationship === \"anySibling\") {\n return formatRuleBlock(`${targetSelector}:has(~ ${markerSelector}), ${markerSelector} ~ ${targetSelector}`, rule);\n }\n\n return formatRuleBlock(`${markerSelector} ${targetSelector}`, rule);\n}\n\nfunction formatMediaRule(rule: AtomicRule): string {\n return formatNestedRuleBlock(rule.mediaQuery!, `.${rule.className}.${rule.className}`, rule);\n}\n\nfunction formatMediaPseudoRule(rule: AtomicRule): string {\n return formatNestedRuleBlock(rule.mediaQuery!, `.${rule.className}.${rule.className}${rule.pseudoClass}`, rule);\n}\n\nfunction formatMediaPseudoElementRule(rule: AtomicRule): string {\n const pe = rule.pseudoElement ?? \"\";\n return formatNestedRuleBlock(rule.mediaQuery!, `.${rule.className}.${rule.className}${pe}`, rule);\n}\n\nfunction getRuleDeclarations(rule: AtomicRule): Array<{ cssProperty: string; cssValue: string; cssVarName?: string }> {\n return rule.declarations ?? [{ cssProperty: rule.cssProperty, cssValue: rule.cssValue, cssVarName: rule.cssVarName }];\n}\n\nfunction formatRuleBlock(selector: string, rule: AtomicRule): string {\n const body = getRuleDeclarations(rule)\n .map(function (declaration) {\n return `${declaration.cssProperty}: ${declaration.cssValue};`;\n })\n .join(\" \");\n return `${selector} { ${body} }`;\n}\n\nfunction formatNestedRuleBlock(wrapper: string, selector: string, rule: AtomicRule): string {\n const body = getRuleDeclarations(rule)\n .map(function (declaration) {\n return `${declaration.cssProperty}: ${declaration.cssValue};`;\n })\n .join(\" \");\n return `${wrapper} { ${selector} { ${body} } }`;\n}\n\n// -- AST generation for style hash objects --\n\n/**\n * Build the style hash AST for a list of segments (from one Css.*.$ expression).\n *\n * Groups segments by CSS property and builds space-separated class bundles.\n * Returns an array of ObjectProperty nodes for `{ display: \"df\", color: \"black blue_h\" }`.\n */\nexport function buildStyleHashProperties(\n segments: ResolvedSegment[],\n mapping: TrussMapping,\n maybeIncHelperName?: string | null,\n): t.ObjectProperty[] {\n // Group: cssProperty -> list of { className, isVariable, isConditional, varName, argNode, incremented, appendPx }\n const propGroups = new Map<\n string,\n Array<{\n className: string;\n isVariable: boolean;\n /** Whether this entry has a condition prefix (pseudo/media/when). */\n isConditional: boolean;\n varName?: string;\n argNode?: unknown;\n incremented?: boolean;\n appendPx?: boolean;\n }>\n >();\n\n /** Push an entry, replacing earlier base-level entries when a new base-level entry overrides the same property. */\n function pushEntry(cssProp: string, entry: typeof propGroups extends Map<string, Array<infer E>> ? E : never): void {\n if (!propGroups.has(cssProp)) propGroups.set(cssProp, []);\n const entries = propGroups.get(cssProp)!;\n // A later base-level entry replaces earlier base-level entries for the same property.\n // Conditional entries (hover/media) always accumulate alongside base entries.\n if (!entry.isConditional) {\n for (let i = entries.length - 1; i >= 0; i--) {\n if (!entries[i].isConditional) {\n entries.splice(i, 1);\n }\n }\n }\n entries.push(entry);\n }\n\n for (const seg of segments) {\n if (seg.error || seg.styleArrayArg || seg.typographyLookup) continue;\n\n const { prefix } = segmentContext(seg, mapping);\n const isConditional = prefix !== \"\";\n\n if (seg.variableProps) {\n for (const prop of seg.variableProps) {\n const className = prefix ? `${prefix}${seg.abbr}_var` : `${seg.abbr}_var`;\n const varName = toCssVariableName(className, seg.abbr, prop);\n\n pushEntry(prop, {\n className,\n isVariable: true,\n isConditional,\n varName,\n argNode: seg.argNode,\n incremented: seg.incremented,\n appendPx: seg.appendPx,\n });\n }\n\n // Extra static defs\n if (seg.variableExtraDefs) {\n for (const [cssProp, value] of Object.entries(seg.variableExtraDefs)) {\n const extraBase = `${seg.abbr}_${cssProp}`;\n const extraName = prefix ? `${prefix}${extraBase}` : extraBase;\n pushEntry(cssProp, { className: extraName, isVariable: false, isConditional });\n }\n }\n } else {\n const isMultiProp = Object.keys(seg.defs).length > 1;\n\n for (const [cssProp, val] of Object.entries(seg.defs)) {\n const baseName = computeStaticBaseName(seg, cssProp, String(val), isMultiProp, mapping);\n const className = prefix ? `${prefix}${baseName}` : baseName;\n\n pushEntry(cssProp, { className, isVariable: false, isConditional });\n }\n }\n }\n\n // Build AST properties\n const properties: t.ObjectProperty[] = [];\n\n for (const [cssProp, entries] of Array.from(propGroups.entries())) {\n const classNames = entries.map((e) => e.className).join(\" \");\n const variableEntries = entries.filter((e) => e.isVariable);\n\n if (variableEntries.length > 0) {\n // Tuple: [classNames, { vars }]\n const varsProps: t.ObjectProperty[] = [];\n for (const dyn of variableEntries) {\n let valueExpr: t.Expression = dyn.argNode as t.Expression;\n if (dyn.incremented) {\n // Wrap with __maybeInc (or whatever name was reserved to avoid collisions)\n valueExpr = t.callExpression(t.identifier(maybeIncHelperName ?? \"__maybeInc\"), [valueExpr]);\n } else if (dyn.appendPx) {\n // Wrap with `${v}px`\n valueExpr = t.templateLiteral(\n [t.templateElement({ raw: \"\", cooked: \"\" }, false), t.templateElement({ raw: \"px\", cooked: \"px\" }, true)],\n [valueExpr],\n );\n }\n varsProps.push(t.objectProperty(t.stringLiteral(dyn.varName!), valueExpr));\n }\n\n const tuple = t.arrayExpression([t.stringLiteral(classNames), t.objectExpression(varsProps)]);\n\n properties.push(t.objectProperty(toPropertyKey(cssProp), tuple));\n } else {\n // Static: plain string\n properties.push(t.objectProperty(toPropertyKey(cssProp), t.stringLiteral(classNames)));\n }\n }\n\n return properties;\n}\n\n/** Build a CSS variable name from the real CSS property and class condition prefix. */\nfunction toCssVariableName(className: string, baseKey: string, cssProp: string): string {\n const baseClassName = `${baseKey}_var`;\n const cp = className.endsWith(baseClassName) ? className.slice(0, -baseClassName.length) : \"\";\n return `--${cp}${cssProp}`;\n}\n\n// -- Helper declarations --\n\n/** Build the per-file increment helper: `const __maybeInc = (inc) => typeof inc === \"string\" ? inc : \\`${inc * N}px\\`` */\nexport function buildMaybeIncDeclaration(helperName: string, increment: number): t.VariableDeclaration {\n const incParam = t.identifier(\"inc\");\n const body = t.blockStatement([\n t.returnStatement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.unaryExpression(\"typeof\", incParam), t.stringLiteral(\"string\")),\n incParam,\n t.templateLiteral(\n [t.templateElement({ raw: \"\", cooked: \"\" }, false), t.templateElement({ raw: \"px\", cooked: \"px\" }, true)],\n [t.binaryExpression(\"*\", incParam, t.numericLiteral(increment))],\n ),\n ),\n ),\n ]);\n\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(helperName), t.arrowFunctionExpression([incParam], body)),\n ]);\n}\n\n/** Use identifier keys when legal, otherwise string literal keys. */\nfunction toPropertyKey(key: string): t.Identifier | t.StringLiteral {\n return isValidIdentifier(key) ? t.identifier(key) : t.stringLiteral(key);\n}\n\nfunction isValidIdentifier(s: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s);\n}\n\n/** Build a runtime lookup table declaration: `const __typography = { f24: { fontSize: \"f24\" }, ... }`. */\nexport function buildRuntimeLookupDeclaration(\n lookupName: string,\n segmentsByName: Record<string, ResolvedSegment[]>,\n mapping: TrussMapping,\n): t.VariableDeclaration {\n const properties: t.ObjectProperty[] = [];\n for (const [name, segs] of Object.entries(segmentsByName)) {\n const hashProps = buildStyleHashProperties(segs, mapping);\n properties.push(t.objectProperty(t.identifier(name), t.objectExpression(hashProps)));\n }\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(lookupName), t.objectExpression(properties)),\n ]);\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Converted from Flow to TypeScript; otherwise kept as-is for easy updates from upstream.\n * Source: https://github.com/facebook/stylex/blob/1ddee1dde1d55134c7d4f6889d8cbf34091e72fd/packages/%40stylexjs/shared/src/utils/property-priorities.js\n */\n\n// Physical properties that have logical equivalents:\nconst longHandPhysical = new Set<string>();\n// Logical properties *and* all other long hand properties:\nconst longHandLogical = new Set<string>();\n// Shorthand properties that override longhand properties:\nconst shorthandsOfLonghands = new Set<string>();\n// Shorthand properties that override other shorthand properties:\nconst shorthandsOfShorthands = new Set<string>();\n\n// Using MDN data as a source of truth to populate the above sets\n// by group in alphabetical order:\n\n// Composition and Blending\nlongHandLogical.add(\"background-blend-mode\");\nlongHandLogical.add(\"isolation\");\nlongHandLogical.add(\"mix-blend-mode\");\n\n// CSS Animations\nshorthandsOfShorthands.add(\"animation\");\nlongHandLogical.add(\"animation-composition\");\nlongHandLogical.add(\"animation-delay\");\nlongHandLogical.add(\"animation-direction\");\nlongHandLogical.add(\"animation-duration\");\nlongHandLogical.add(\"animation-fill-mode\");\nlongHandLogical.add(\"animation-iteration-count\");\nlongHandLogical.add(\"animation-name\");\nlongHandLogical.add(\"animation-play-state\");\nshorthandsOfLonghands.add(\"animation-range\");\nlongHandLogical.add(\"animation-range-end\");\nlongHandLogical.add(\"animation-range-start\");\nlongHandLogical.add(\"animation-timing-function\");\nlongHandLogical.add(\"animation-timeline\");\n\nshorthandsOfLonghands.add(\"scroll-timeline\");\nlongHandLogical.add(\"scroll-timeline-axis\");\nlongHandLogical.add(\"scroll-timeline-name\");\n\nlongHandLogical.add(\"timeline-scope\");\n\nshorthandsOfLonghands.add(\"view-timeline\");\nlongHandLogical.add(\"view-timeline-axis\");\nlongHandLogical.add(\"view-timeline-inset\");\nlongHandLogical.add(\"view-timeline-name\");\n\n// CSS Backgrounds and Borders\nshorthandsOfShorthands.add(\"background\");\nlongHandLogical.add(\"background-attachment\");\nlongHandLogical.add(\"background-clip\");\nlongHandLogical.add(\"background-color\");\nlongHandLogical.add(\"background-image\");\nlongHandLogical.add(\"background-origin\");\nlongHandLogical.add(\"background-repeat\");\nlongHandLogical.add(\"background-size\");\nshorthandsOfLonghands.add(\"background-position\");\nlongHandLogical.add(\"background-position-x\");\nlongHandLogical.add(\"background-position-y\");\n\nshorthandsOfShorthands.add(\"border\"); // OF SHORTHANDS!\nshorthandsOfLonghands.add(\"border-color\");\nshorthandsOfLonghands.add(\"border-style\");\nshorthandsOfLonghands.add(\"border-width\");\nshorthandsOfShorthands.add(\"border-block\"); // Logical Properties\nlongHandLogical.add(\"border-block-color\"); // Logical Properties\nlongHandLogical.add(\"border-block-stylex\"); // Logical Properties\nlongHandLogical.add(\"border-block-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-block-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-top\");\nlongHandLogical.add(\"border-block-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-top-color\");\nlongHandLogical.add(\"border-block-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-top-style\");\nlongHandLogical.add(\"border-block-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-top-width\");\nshorthandsOfLonghands.add(\"border-block-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-bottom\");\nlongHandLogical.add(\"border-block-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-color\");\nlongHandLogical.add(\"border-block-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-style\");\nlongHandLogical.add(\"border-block-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-width\");\nshorthandsOfShorthands.add(\"border-inline\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-color\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-style\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-left\");\nlongHandLogical.add(\"border-inline-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-left-color\");\nlongHandLogical.add(\"border-inline-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-left-style\");\nlongHandLogical.add(\"border-inline-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-left-width\");\nshorthandsOfLonghands.add(\"border-inline-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-right\");\nlongHandLogical.add(\"border-inline-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-right-color\");\nlongHandLogical.add(\"border-inline-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-right-style\");\nlongHandLogical.add(\"border-inline-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-right-width\");\n\nshorthandsOfLonghands.add(\"border-image\");\nlongHandLogical.add(\"border-image-outset\");\nlongHandLogical.add(\"border-image-repeat\");\nlongHandLogical.add(\"border-image-slice\");\nlongHandLogical.add(\"border-image-source\");\nlongHandLogical.add(\"border-image-width\");\n\nshorthandsOfLonghands.add(\"border-radius\");\nlongHandLogical.add(\"border-start-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-start-start-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-start-radius\"); // Logical Properties\nlongHandPhysical.add(\"border-top-left-radius\");\nlongHandPhysical.add(\"border-top-right-radius\");\nlongHandPhysical.add(\"border-bottom-left-radius\");\nlongHandPhysical.add(\"border-bottom-right-radius\");\n\nshorthandsOfLonghands.add(\"corner-shape\");\nlongHandLogical.add(\"corner-start-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-start-end-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-end-shape\"); // Logical Properties\nlongHandPhysical.add(\"corner-top-left-shape\");\nlongHandPhysical.add(\"corner-top-right-shape\");\nlongHandPhysical.add(\"corner-bottom-left-shape\");\nlongHandPhysical.add(\"corner-bottom-right-shape\");\n\nlongHandLogical.add(\"box-shadow\");\n\n// CSS Basic User Interface\nlongHandLogical.add(\"accent-color\");\nlongHandLogical.add(\"appearance\");\nlongHandLogical.add(\"aspect-ratio\");\n\nshorthandsOfLonghands.add(\"caret\");\nlongHandLogical.add(\"caret-color\");\nlongHandLogical.add(\"caret-shape\");\n\nlongHandLogical.add(\"cursor\");\nlongHandLogical.add(\"ime-mode\");\nlongHandLogical.add(\"input-security\");\n\nshorthandsOfLonghands.add(\"outline\");\nlongHandLogical.add(\"outline-color\");\nlongHandLogical.add(\"outline-offset\");\nlongHandLogical.add(\"outline-style\");\nlongHandLogical.add(\"outline-width\");\n\nlongHandLogical.add(\"pointer-events\");\nlongHandLogical.add(\"resize\"); // horizontal, vertical, block, inline, both\nlongHandLogical.add(\"text-overflow\");\nlongHandLogical.add(\"user-select\");\n\n// CSS Box Alignment\nshorthandsOfLonghands.add(\"grid-gap\"); // alias for `gap`\nshorthandsOfLonghands.add(\"gap\");\nlongHandLogical.add(\"grid-row-gap\"); // alias for `row-gap`\nlongHandLogical.add(\"row-gap\");\nlongHandLogical.add(\"grid-column-gap\"); // alias for `column-gap`\nlongHandLogical.add(\"column-gap\");\n\nshorthandsOfLonghands.add(\"place-content\");\nlongHandLogical.add(\"align-content\");\nlongHandLogical.add(\"justify-content\");\n\nshorthandsOfLonghands.add(\"place-items\");\nlongHandLogical.add(\"align-items\");\nlongHandLogical.add(\"justify-items\");\n\nshorthandsOfLonghands.add(\"place-self\");\nlongHandLogical.add(\"align-self\");\nlongHandLogical.add(\"justify-self\");\n\n// CSS Box Model\nlongHandLogical.add(\"box-sizing\");\n\nlongHandLogical.add(\"block-size\"); // Logical Properties\nlongHandPhysical.add(\"height\");\nlongHandLogical.add(\"inline-size\"); // Logical Properties\nlongHandPhysical.add(\"width\");\n\nlongHandLogical.add(\"max-block-size\"); // Logical Properties\nlongHandPhysical.add(\"max-height\");\nlongHandLogical.add(\"max-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"max-width\");\nlongHandLogical.add(\"min-block-size\"); // Logical Properties\nlongHandPhysical.add(\"min-height\");\nlongHandLogical.add(\"min-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"min-width\");\n\nshorthandsOfShorthands.add(\"margin\");\nshorthandsOfLonghands.add(\"margin-block\"); // Logical Properties\nlongHandLogical.add(\"margin-block-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-top\");\nlongHandLogical.add(\"margin-block-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-bottom\");\nshorthandsOfLonghands.add(\"margin-inline\"); // Logical Properties\nlongHandLogical.add(\"margin-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-left\");\nlongHandLogical.add(\"margin-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-right\");\n\nlongHandLogical.add(\"margin-trim\");\n\nshorthandsOfLonghands.add(\"overscroll-behavior\");\nlongHandLogical.add(\"overscroll-behavior-block\");\nlongHandPhysical.add(\"overscroll-behavior-y\");\nlongHandLogical.add(\"overscroll-behavior-inline\");\nlongHandPhysical.add(\"overscroll-behavior-x\");\n\nshorthandsOfShorthands.add(\"padding\");\nshorthandsOfLonghands.add(\"padding-block\"); // Logical Properties\nlongHandLogical.add(\"padding-block-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-top\");\nlongHandLogical.add(\"padding-block-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-bottom\");\nshorthandsOfLonghands.add(\"padding-inline\"); // Logical Properties\nlongHandLogical.add(\"padding-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-left\");\nlongHandLogical.add(\"padding-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-right\");\n\nlongHandLogical.add(\"visibility\");\n\n// CSS Color\nlongHandLogical.add(\"color\");\nlongHandLogical.add(\"color-scheme\");\nlongHandLogical.add(\"forced-color-adjust\");\nlongHandLogical.add(\"opacity\");\nlongHandLogical.add(\"print-color-adjust\");\n\n// CSS Columns\nshorthandsOfLonghands.add(\"columns\");\nlongHandLogical.add(\"column-count\");\nlongHandLogical.add(\"column-width\");\n\nlongHandLogical.add(\"column-fill\");\nlongHandLogical.add(\"column-span\");\n\nshorthandsOfLonghands.add(\"column-rule\");\nlongHandLogical.add(\"column-rule-color\");\nlongHandLogical.add(\"column-rule-style\");\nlongHandLogical.add(\"column-rule-width\");\n\n// CSS Containment\nlongHandLogical.add(\"contain\");\n\nshorthandsOfLonghands.add(\"contain-intrinsic-size\");\nlongHandLogical.add(\"contain-intrinsic-block-size\");\nlongHandLogical.add(\"contain-intrinsic-width\");\nlongHandLogical.add(\"contain-intrinsic-height\");\nlongHandLogical.add(\"contain-intrinsic-inline-size\");\n\nshorthandsOfLonghands.add(\"container\");\nlongHandLogical.add(\"container-name\");\nlongHandLogical.add(\"container-type\");\n\nlongHandLogical.add(\"content-visibility\");\n\n// CSS Counter Styles\nlongHandLogical.add(\"counter-increment\");\nlongHandLogical.add(\"counter-reset\");\nlongHandLogical.add(\"counter-set\");\n\n// CSS Display\nlongHandLogical.add(\"display\");\n\n// CSS Flexible Box Layout\nshorthandsOfLonghands.add(\"flex\");\nlongHandLogical.add(\"flex-basis\");\nlongHandLogical.add(\"flex-grow\");\nlongHandLogical.add(\"flex-shrink\");\n\nshorthandsOfLonghands.add(\"flex-flow\");\nlongHandLogical.add(\"flex-direction\");\nlongHandLogical.add(\"flex-wrap\");\n\nlongHandLogical.add(\"order\");\n\n// CSS Fonts\nshorthandsOfShorthands.add(\"font\");\nlongHandLogical.add(\"font-family\");\nlongHandLogical.add(\"font-size\");\nlongHandLogical.add(\"font-stretch\");\nlongHandLogical.add(\"font-style\");\nlongHandLogical.add(\"font-weight\");\nlongHandLogical.add(\"line-height\");\nshorthandsOfLonghands.add(\"font-variant\");\nlongHandLogical.add(\"font-variant-alternates\");\nlongHandLogical.add(\"font-variant-caps\");\nlongHandLogical.add(\"font-variant-east-asian\");\nlongHandLogical.add(\"font-variant-emoji\");\nlongHandLogical.add(\"font-variant-ligatures\");\nlongHandLogical.add(\"font-variant-numeric\");\nlongHandLogical.add(\"font-variant-position\");\n\nlongHandLogical.add(\"font-feature-settings\");\nlongHandLogical.add(\"font-kerning\");\nlongHandLogical.add(\"font-language-override\");\nlongHandLogical.add(\"font-optical-sizing\");\nlongHandLogical.add(\"font-palette\");\nlongHandLogical.add(\"font-variation-settings\");\nlongHandLogical.add(\"font-size-adjust\");\nlongHandLogical.add(\"font-smooth\"); // Non-standard\nlongHandLogical.add(\"font-synthesis-position\");\nlongHandLogical.add(\"font-synthesis-small-caps\");\nlongHandLogical.add(\"font-synthesis-style\");\nlongHandLogical.add(\"font-synthesis-weight\");\n\nlongHandLogical.add(\"line-height-step\");\n\n// CSS Fragmentation\nlongHandLogical.add(\"box-decoration-break\");\nlongHandLogical.add(\"break-after\");\nlongHandLogical.add(\"break-before\");\nlongHandLogical.add(\"break-inside\");\nlongHandLogical.add(\"orphans\");\nlongHandLogical.add(\"widows\");\n\n// CSS Generated Content\nlongHandLogical.add(\"content\");\nlongHandLogical.add(\"quotes\");\n\n// CSS Grid Layout\nshorthandsOfShorthands.add(\"grid\");\nlongHandLogical.add(\"grid-auto-flow\");\nlongHandLogical.add(\"grid-auto-rows\");\nlongHandLogical.add(\"grid-auto-columns\");\nshorthandsOfShorthands.add(\"grid-template\");\nshorthandsOfLonghands.add(\"grid-template-areas\");\nlongHandLogical.add(\"grid-template-columns\");\nlongHandLogical.add(\"grid-template-rows\");\n\nshorthandsOfShorthands.add(\"grid-area\");\nshorthandsOfLonghands.add(\"grid-row\");\nlongHandLogical.add(\"grid-row-start\");\nlongHandLogical.add(\"grid-row-end\");\nshorthandsOfLonghands.add(\"grid-column\");\nlongHandLogical.add(\"grid-column-start\");\nlongHandLogical.add(\"grid-column-end\");\n\nlongHandLogical.add(\"align-tracks\");\nlongHandLogical.add(\"justify-tracks\");\nlongHandLogical.add(\"masonry-auto-flow\");\n\n// CSS Images\nlongHandLogical.add(\"image-orientation\");\nlongHandLogical.add(\"image-rendering\");\nlongHandLogical.add(\"image-resolution\");\nlongHandLogical.add(\"object-fit\");\nlongHandLogical.add(\"object-position\");\n\n// CSS Inline\nlongHandLogical.add(\"initial-letter\");\nlongHandLogical.add(\"initial-letter-align\");\n\n// CSS Lists and Counters\nshorthandsOfLonghands.add(\"list-style\");\nlongHandLogical.add(\"list-style-image\");\nlongHandLogical.add(\"list-style-position\");\nlongHandLogical.add(\"list-style-type\");\n\n// CSS Masking\nlongHandLogical.add(\"clip\"); // @deprecated\nlongHandLogical.add(\"clip-path\");\n\nshorthandsOfLonghands.add(\"mask\");\nlongHandLogical.add(\"mask-clip\");\nlongHandLogical.add(\"mask-composite\");\nlongHandLogical.add(\"mask-image\");\nlongHandLogical.add(\"mask-mode\");\nlongHandLogical.add(\"mask-origin\");\nlongHandLogical.add(\"mask-position\");\nlongHandLogical.add(\"mask-repeat\");\nlongHandLogical.add(\"mask-size\");\n\nlongHandLogical.add(\"mask-type\");\n\nshorthandsOfLonghands.add(\"mask-border\");\nlongHandLogical.add(\"mask-border-mode\");\nlongHandLogical.add(\"mask-border-outset\");\nlongHandLogical.add(\"mask-border-repeat\");\nlongHandLogical.add(\"mask-border-slice\");\nlongHandLogical.add(\"mask-border-source\");\nlongHandLogical.add(\"mask-border-width\");\n\n// CSS Miscellaneous\nshorthandsOfShorthands.add(\"all\"); // avoid!\nlongHandLogical.add(\"text-rendering\");\n\n// CSS Motion Path\nshorthandsOfLonghands.add(\"offset\");\nlongHandLogical.add(\"offset-anchor\");\nlongHandLogical.add(\"offset-distance\");\nlongHandLogical.add(\"offset-path\");\nlongHandLogical.add(\"offset-position\");\nlongHandLogical.add(\"offset-rotate\");\n\n// CSS Overflow\nlongHandLogical.add(\"-webkit-box-orient\");\nlongHandLogical.add(\"-webkit-line-clamp\");\n\nshorthandsOfLonghands.add(\"overflow\");\nlongHandLogical.add(\"overflow-block\");\nlongHandPhysical.add(\"overflow-y\");\nlongHandLogical.add(\"overflow-inline\");\nlongHandPhysical.add(\"overflow-x\");\n\nlongHandLogical.add(\"overflow-clip-margin\"); // partial support\n\nlongHandLogical.add(\"scroll-gutter\");\nlongHandLogical.add(\"scroll-behavior\");\n\n// CSS Pages\nlongHandLogical.add(\"page\");\nlongHandLogical.add(\"page-break-after\");\nlongHandLogical.add(\"page-break-before\");\nlongHandLogical.add(\"page-break-inside\");\n\n// CSS Positioning\nshorthandsOfShorthands.add(\"inset\"); // Logical Properties\nshorthandsOfLonghands.add(\"inset-block\"); // Logical Properties\nlongHandLogical.add(\"inset-block-start\"); // Logical Properties\nlongHandPhysical.add(\"top\");\nlongHandLogical.add(\"inset-block-end\"); // Logical Properties\nlongHandPhysical.add(\"bottom\");\nshorthandsOfLonghands.add(\"inset-inline\"); // Logical Properties\nlongHandLogical.add(\"inset-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"left\");\nlongHandLogical.add(\"inset-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"right\");\n\nlongHandLogical.add(\"clear\");\nlongHandLogical.add(\"float\");\nlongHandLogical.add(\"position\");\nlongHandLogical.add(\"z-index\");\n\n// CSS Ruby\nlongHandLogical.add(\"ruby-align\");\nlongHandLogical.add(\"ruby-merge\");\nlongHandLogical.add(\"ruby-position\");\n\n// CSS Scroll Anchoring\nlongHandLogical.add(\"overflow-anchor\");\n\n// CSS Scroll Snap\nshorthandsOfShorthands.add(\"scroll-margin\");\nshorthandsOfLonghands.add(\"scroll-margin-block\");\nlongHandLogical.add(\"scroll-margin-block-start\");\nlongHandPhysical.add(\"scroll-margin-top\");\nlongHandLogical.add(\"scroll-margin-block-end\");\nlongHandPhysical.add(\"scroll-margin-bottom\");\nshorthandsOfLonghands.add(\"scroll-margin-inline\");\nlongHandLogical.add(\"scroll-margin-inline-start\");\nlongHandPhysical.add(\"scroll-margin-left\");\nlongHandLogical.add(\"scroll-margin-inline-end\");\nlongHandPhysical.add(\"scroll-margin-right\");\n\nshorthandsOfShorthands.add(\"scroll-padding\");\nshorthandsOfLonghands.add(\"scroll-padding-block\");\nlongHandLogical.add(\"scroll-padding-block-start\");\nlongHandPhysical.add(\"scroll-padding-top\");\nlongHandLogical.add(\"scroll-padding-block-end\");\nlongHandPhysical.add(\"scroll-padding-bottom\");\nshorthandsOfLonghands.add(\"scroll-padding-inline\");\nlongHandLogical.add(\"scroll-padding-inline-start\");\nlongHandPhysical.add(\"scroll-padding-left\");\nlongHandLogical.add(\"scroll-padding-inline-end\");\nlongHandPhysical.add(\"scroll-padding-right\");\n\nlongHandLogical.add(\"scroll-snap-align\");\nlongHandLogical.add(\"scroll-snap-stop\");\nshorthandsOfLonghands.add(\"scroll-snap-type\");\n\n// CSS Scrollbars\nlongHandLogical.add(\"scrollbar-color\");\nlongHandLogical.add(\"scrollbar-width\");\n\n// CSS Shapes\nlongHandLogical.add(\"shape-image-threshold\");\nlongHandLogical.add(\"shape-margin\");\nlongHandLogical.add(\"shape-outside\");\n\n// CSS Speech\nlongHandLogical.add(\"azimuth\");\n\n// CSS Table\nlongHandLogical.add(\"border-collapse\");\nlongHandLogical.add(\"border-spacing\");\nlongHandLogical.add(\"caption-side\");\nlongHandLogical.add(\"empty-cells\");\nlongHandLogical.add(\"table-layout\");\nlongHandLogical.add(\"vertical-align\");\n\n// CSS Text Decoration\nshorthandsOfLonghands.add(\"text-decoration\");\nlongHandLogical.add(\"text-decoration-color\");\nlongHandLogical.add(\"text-decoration-line\");\nlongHandLogical.add(\"text-decoration-skip\");\nlongHandLogical.add(\"text-decoration-skip-ink\");\nlongHandLogical.add(\"text-decoration-style\");\nlongHandLogical.add(\"text-decoration-thickness\");\n\nshorthandsOfLonghands.add(\"text-emphasis\");\nlongHandLogical.add(\"text-emphasis-color\");\nlongHandLogical.add(\"text-emphasis-position\");\nlongHandLogical.add(\"text-emphasis-style\");\nlongHandLogical.add(\"text-shadow\");\nlongHandLogical.add(\"text-underline-offset\");\nlongHandLogical.add(\"text-underline-position\");\n\n// CSS Text\nlongHandLogical.add(\"hanging-punctuation\");\nlongHandLogical.add(\"hyphenate-character\");\nlongHandLogical.add(\"hyphenate-limit-chars\");\nlongHandLogical.add(\"hyphens\");\nlongHandLogical.add(\"letter-spacing\");\nlongHandLogical.add(\"line-break\");\nlongHandLogical.add(\"overflow-wrap\");\nlongHandLogical.add(\"paint-order\");\nlongHandLogical.add(\"tab-size\");\nlongHandLogical.add(\"text-align\");\nlongHandLogical.add(\"text-align-last\");\nlongHandLogical.add(\"text-indent\");\nlongHandLogical.add(\"text-justify\");\nlongHandLogical.add(\"text-size-adjust\");\nlongHandLogical.add(\"text-transform\");\nlongHandLogical.add(\"text-wrap\");\nlongHandLogical.add(\"white-space\");\nlongHandLogical.add(\"white-space-collapse\");\nlongHandLogical.add(\"word-break\");\nlongHandLogical.add(\"word-spacing\");\nlongHandLogical.add(\"word-wrap\");\n\n// CSS Transforms\nlongHandLogical.add(\"backface-visibility\");\nlongHandLogical.add(\"perspective\");\nlongHandLogical.add(\"perspective-origin\");\nlongHandLogical.add(\"rotate\");\nlongHandLogical.add(\"scale\");\nlongHandLogical.add(\"transform\");\nlongHandLogical.add(\"transform-box\");\nlongHandLogical.add(\"transform-origin\");\nlongHandLogical.add(\"transform-style\");\nlongHandLogical.add(\"translate\");\n\n// CSS Transitions\nshorthandsOfLonghands.add(\"transition\");\nlongHandLogical.add(\"transition-delay\");\nlongHandLogical.add(\"transition-duration\");\nlongHandLogical.add(\"transition-property\");\nlongHandLogical.add(\"transition-timing-function\");\n\n// CSS View Transitions\nlongHandLogical.add(\"view-transition-name\");\n\n// CSS Will Change\nlongHandLogical.add(\"will-change\");\n\n// CSS Writing Modes\nlongHandLogical.add(\"direction\");\nlongHandLogical.add(\"text-combine-upright\");\nlongHandLogical.add(\"text-orientation\");\nlongHandLogical.add(\"unicode-bidi\");\nlongHandLogical.add(\"writing-mode\");\n\n// CSS Filter Effects\nlongHandLogical.add(\"backdrop-filter\");\nlongHandLogical.add(\"filter\");\n\n// MathML\nlongHandLogical.add(\"math-depth\");\nlongHandLogical.add(\"math-shift\");\nlongHandLogical.add(\"math-style\");\n\n// CSS Pointer Events\nlongHandLogical.add(\"touch-action\");\n\nexport const PSEUDO_CLASS_PRIORITIES: Readonly<Record<string, number>> = {\n \":is\": 40,\n \":where\": 40,\n \":not\": 40,\n \":has\": 45,\n \":dir\": 50,\n \":lang\": 51,\n \":first-child\": 52,\n \":first-of-type\": 53,\n \":last-child\": 54,\n \":last-of-type\": 55,\n \":only-child\": 56,\n \":only-of-type\": 57,\n \":nth-child\": 60,\n \":nth-last-child\": 61,\n \":nth-of-type\": 62,\n \":nth-last-of-type\": 63,\n \":empty\": 70,\n \":link\": 80,\n \":any-link\": 81,\n \":local-link\": 82,\n \":target-within\": 83,\n \":target\": 84,\n \":visited\": 85,\n \":enabled\": 91,\n \":disabled\": 92,\n \":required\": 93,\n \":optional\": 94,\n \":read-only\": 95,\n \":read-write\": 96,\n \":placeholder-shown\": 97,\n \":in-range\": 98,\n \":out-of-range\": 99,\n \":default\": 100,\n \":checked\": 101,\n \":indeterminate\": 101,\n \":blank\": 102,\n \":valid\": 103,\n \":invalid\": 104,\n \":user-invalid\": 105,\n \":autofill\": 110,\n \":picture-in-picture\": 120,\n \":modal\": 121,\n \":fullscreen\": 122,\n \":paused\": 123,\n \":playing\": 124,\n \":current\": 125,\n \":past\": 126,\n \":future\": 127,\n \":hover\": 130,\n \":focus-within\": 140,\n \":focus\": 150,\n \":focus-visible\": 160,\n \":active\": 170,\n};\n\nexport const AT_RULE_PRIORITIES: Readonly<Record<string, number>> = {\n \"@supports\": 30,\n \"@media\": 200,\n \"@container\": 300,\n};\n\nexport const PSEUDO_ELEMENT_PRIORITY: number = 5000;\n\n/** Get the property tier for a CSS property (kebab-case). */\nexport function getPropertyPriority(property: string): number {\n if (shorthandsOfShorthands.has(property)) return 1000;\n if (shorthandsOfLonghands.has(property)) return 2000;\n if (longHandLogical.has(property)) return 3000;\n if (longHandPhysical.has(property)) return 4000;\n // Unknown properties default to 3000 (longhand) — safest default\n return 3000;\n}\n\n/** Get the priority for a pseudo-class selector. */\nexport function getPseudoClassPriority(pseudo: string): number {\n const leadingPseudo = pseudo.trim().match(/^::?[a-zA-Z-]+/)?.[0] ?? pseudo.split(\"(\")[0];\n const base = leadingPseudo.replace(/[A-Z]/g, function (match) {\n return `-${match.toLowerCase()}`;\n });\n return PSEUDO_CLASS_PRIORITIES[base] ?? 40;\n}\n\n/** Get the priority for an at-rule. */\nexport function getAtRulePriority(atRule: string): number {\n if (atRule.startsWith(\"--\")) return 1;\n if (atRule.startsWith(\"@supports\")) return AT_RULE_PRIORITIES[\"@supports\"];\n if (atRule.startsWith(\"@media\")) return AT_RULE_PRIORITIES[\"@media\"];\n if (atRule.startsWith(\"@container\")) return AT_RULE_PRIORITIES[\"@container\"];\n return 0;\n}\n","/**\n * Computes CSS rule priority using StyleX's priority system.\n *\n * Priority is an additive sum: propertyPriority + pseudoPriority + atRulePriority + pseudoElementPriority.\n * Rules are sorted by this number before emission, guaranteeing longhands beat shorthands,\n * pseudo-classes follow LVFHA order, and at-rules override base styles — all deterministically.\n */\n\nimport {\n getPropertyPriority,\n getPseudoClassPriority,\n getAtRulePriority,\n PSEUDO_ELEMENT_PRIORITY,\n} from \"./property-priorities\";\nimport type { AtomicRule } from \"./emit-truss\";\n\n/** Relationship base priorities for when() selectors, matching StyleX's relational selector system. */\nconst RELATIONSHIP_BASE: Record<string, number> = {\n ancestor: 10,\n descendant: 15,\n anySibling: 20,\n siblingBefore: 30,\n siblingAfter: 40,\n};\n\n/**\n * Compute the numeric priority for a single AtomicRule.\n *\n * I.e. `{ cssProperty: \"border-top-color\", pseudoClass: \":hover\", mediaQuery: \"@media ...\" }`\n * → 4000 (physical longhand) + 130 (:hover) + 200 (@media) = 4330\n */\nexport function computeRulePriority(rule: AtomicRule): number {\n let priority = getPropertyPriority(rule.cssProperty);\n\n if (rule.pseudoElement) {\n priority += PSEUDO_ELEMENT_PRIORITY;\n }\n\n if (rule.pseudoClass) {\n priority += getPseudoClassPriority(rule.pseudoClass);\n }\n\n if (rule.mediaQuery) {\n priority += getAtRulePriority(rule.mediaQuery);\n }\n\n if (rule.whenSelector) {\n const relBase = RELATIONSHIP_BASE[rule.whenSelector.relationship] ?? 10;\n const pseudoFraction = getPseudoClassPriority(rule.whenSelector.pseudo) / 100;\n priority += relBase + pseudoFraction;\n }\n\n // Variable rules get a small bonus (+0.5) so they sort after static rules for the same property\n if (isVariableRule(rule)) {\n priority += 0.5;\n }\n\n return priority;\n}\n\n/** Returns true if this rule uses CSS custom property var() values. */\nfunction isVariableRule(rule: AtomicRule): boolean {\n if (rule.declarations) {\n return rule.declarations.some((d) => d.cssVarName !== undefined);\n }\n return rule.cssVarName !== undefined;\n}\n\n/**\n * Sort an array of AtomicRules in-place by their computed priority.\n *\n * When two rules have the same priority (e.g. two different longhands both at 3000),\n * we tiebreak by class name so the output is fully deterministic regardless of\n * file processing order (which differs between dev HMR and production builds).\n *\n * Uses a decorate-sort-undecorate pattern so each rule's priority is computed\n * once upfront rather than re-evaluated on every comparator call.\n */\nexport function sortRulesByPriority(rules: AtomicRule[]): void {\n // Pre-compute priorities so the O(n log n) comparisons are just number/string compares\n const decorated = rules.map((rule, i) => {\n return { rule, priority: computeRulePriority(rule), index: i };\n });\n decorated.sort((a, b) => {\n const diff = a.priority - b.priority;\n if (diff !== 0) return diff;\n // Alphabetical tiebreaker ensures identical output in dev and production\n return a.rule.className < b.rule.className ? -1 : a.rule.className > b.rule.className ? 1 : 0;\n });\n for (let i = 0; i < decorated.length; i++) {\n rules[i] = decorated[i].rule;\n }\n}\n","import { parse } from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport type { NodePath } from \"@babel/traverse\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport { basename } from \"path\";\nimport type { TrussMapping, ResolvedSegment } from \"./types\";\nimport { resolveFullChain, type ResolvedChain } from \"./resolve-chain\";\nimport {\n collectTopLevelBindings,\n reservePreferredName,\n findCssImportBinding,\n findCssBuilderBinding,\n removeCssImport,\n findNamedImportBinding,\n findImportDeclaration,\n replaceCssImportWithNamedImports,\n upsertNamedImports,\n extractChain,\n} from \"./ast-utils\";\nimport {\n collectAtomicRules,\n generateCssText,\n buildMaybeIncDeclaration,\n buildRuntimeLookupDeclaration,\n} from \"./emit-truss\";\nimport { rewriteExpressionSites, type ExpressionSite } from \"./rewrite-sites\";\n\n// Babel packages are CJS today; normalize default interop across loaders.\nconst traverse = ((_traverse as unknown as { default?: typeof _traverse }).default ?? _traverse) as typeof _traverse;\nconst generate = ((_generate as unknown as { default?: typeof _generate }).default ?? _generate) as typeof _generate;\n\nexport interface TransformResult {\n code: string;\n map?: unknown;\n /** The generated CSS text for this file's Truss usages. */\n css: string;\n /** The atomic CSS rules collected during this transform, keyed by class name. */\n rules: Map<string, import(\"./emit-truss\").AtomicRule>;\n}\n\nexport interface TransformTrussOptions {\n debug?: boolean;\n /** When true, inject `__injectTrussCSS(cssText)` call for jsdom/test environments. */\n injectCss?: boolean;\n}\n\n/**\n * The core transform function. Given a source file's code and the truss mapping,\n * finds all `Css.*.$` expressions and rewrites them into Truss-native style hash\n * objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Returns null if the file doesn't use Css.\n */\nexport function transformTruss(\n code: string,\n filename: string,\n mapping: TrussMapping,\n options: TransformTrussOptions = {},\n): TransformResult | null {\n // Fast bail: skip files that don't reference Css\n if (!code.includes(\"Css\")) return null;\n\n const ast = parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n });\n\n // Step 1: Find the Css binding name — either from an import or a local `new CssBuilder(...)` declaration\n const cssImportBinding = findCssImportBinding(ast);\n const cssBindingName = cssImportBinding ?? findCssBuilderBinding(ast);\n if (!cssBindingName) return null;\n const cssIsImported = cssImportBinding !== null;\n\n // Step 2: Collect all Css.*.$ expression sites AND detect Css.props() in a single pass.\n // Both checks share one traverse to avoid walking the full AST twice.\n const sites: ExpressionSite[] = [];\n const errorMessages: Array<{ message: string; line: number | null }> = [];\n let hasCssPropsCall = false;\n\n traverse(ast, {\n // -- Css.*.$ chain collection --\n MemberExpression(path: NodePath<t.MemberExpression>) {\n if (!t.isIdentifier(path.node.property, { name: \"$\" })) return;\n if (path.node.computed) return;\n\n const chain = extractChain(path.node.object, cssBindingName);\n if (!chain) return;\n\n const parentPath = path.parentPath;\n if (parentPath && parentPath.isMemberExpression() && t.isIdentifier(parentPath.node.property, { name: \"$\" })) {\n return;\n }\n\n const resolvedChain = resolveFullChain(chain, mapping);\n sites.push({ path, resolvedChain });\n\n const line = path.node.loc?.start.line ?? null;\n for (const err of resolvedChain.errors) {\n errorMessages.push({ message: err, line });\n }\n },\n // -- Css.props() detection (so we don't bail early when there are no Css.*.$ sites) --\n CallExpression(path: NodePath<t.CallExpression>) {\n if (hasCssPropsCall) return;\n const callee = path.node.callee;\n if (\n t.isMemberExpression(callee) &&\n !callee.computed &&\n t.isIdentifier(callee.object, { name: cssBindingName }) &&\n t.isIdentifier(callee.property, { name: \"props\" })\n ) {\n hasCssPropsCall = true;\n }\n },\n });\n\n if (sites.length === 0 && !hasCssPropsCall) return null;\n\n // Step 3: Collect atomic rules for CSS generation\n const chains = sites.map((s) => s.resolvedChain);\n const { rules, needsMaybeInc } = collectAtomicRules(chains, mapping);\n const cssText = generateCssText(rules);\n\n // Step 4: Reserve local names for injected helpers\n const usedTopLevelNames = collectTopLevelBindings(ast);\n const maybeIncHelperName = needsMaybeInc ? reservePreferredName(usedTopLevelNames, \"__maybeInc\") : null;\n const existingMergePropsHelperName = findNamedImportBinding(ast, \"@homebound/truss/runtime\", \"mergeProps\");\n const mergePropsHelperName = existingMergePropsHelperName ?? reservePreferredName(usedTopLevelNames, \"mergeProps\");\n const needsMergePropsHelper = { current: false };\n const existingTrussPropsHelperName = findNamedImportBinding(ast, \"@homebound/truss/runtime\", \"trussProps\");\n const trussPropsHelperName = existingTrussPropsHelperName ?? reservePreferredName(usedTopLevelNames, \"trussProps\");\n const needsTrussPropsHelper = { current: false };\n const existingTrussDebugInfoName = findNamedImportBinding(ast, \"@homebound/truss/runtime\", \"TrussDebugInfo\");\n const trussDebugInfoName = existingTrussDebugInfoName ?? reservePreferredName(usedTopLevelNames, \"TrussDebugInfo\");\n const needsTrussDebugInfo = { current: false };\n\n // Collect typography runtime lookups\n const runtimeLookupNames = new Map<string, string>();\n const runtimeLookups = collectRuntimeLookups(chains);\n for (const [lookupKey] of runtimeLookups) {\n runtimeLookupNames.set(lookupKey, reservePreferredName(usedTopLevelNames, `__${lookupKey}`));\n }\n\n // Step 5: Rewrite Css sites in-place\n rewriteExpressionSites({\n ast,\n sites,\n cssBindingName,\n filename: basename(filename),\n debug: options.debug ?? false,\n mapping,\n maybeIncHelperName,\n mergePropsHelperName,\n needsMergePropsHelper,\n trussPropsHelperName,\n needsTrussPropsHelper,\n trussDebugInfoName,\n needsTrussDebugInfo,\n runtimeLookupNames,\n });\n\n // Step 6: Prepare runtime imports before removing the Css import.\n const runtimeImports: Array<{ importedName: string; localName: string }> = [];\n if (needsTrussPropsHelper.current && !existingTrussPropsHelperName) {\n runtimeImports.push({ importedName: \"trussProps\", localName: trussPropsHelperName });\n }\n if (needsMergePropsHelper.current && !existingMergePropsHelperName) {\n runtimeImports.push({ importedName: \"mergeProps\", localName: mergePropsHelperName });\n }\n if (needsTrussDebugInfo.current && !existingTrussDebugInfoName) {\n runtimeImports.push({ importedName: \"TrussDebugInfo\", localName: trussDebugInfoName });\n }\n if (options.injectCss) {\n runtimeImports.push({ importedName: \"__injectTrussCSS\", localName: \"__injectTrussCSS\" });\n }\n\n // Step 7: Remove/replace the Css import and inject runtime imports.\n // When Css comes from a local `new CssBuilder(...)` (tsup bundles), skip import removal.\n let reusedCssImportLine = false;\n if (cssIsImported) {\n reusedCssImportLine =\n runtimeImports.length > 0 &&\n findImportDeclaration(ast, \"@homebound/truss/runtime\") === null &&\n replaceCssImportWithNamedImports(ast, cssBindingName, \"@homebound/truss/runtime\", runtimeImports);\n\n if (!reusedCssImportLine) {\n removeCssImport(ast, cssBindingName);\n }\n }\n\n if (runtimeImports.length > 0 && !reusedCssImportLine) {\n upsertNamedImports(ast, \"@homebound/truss/runtime\", runtimeImports);\n }\n\n // Step 8: Insert helper declarations after imports\n const declarationsToInsert: t.Statement[] = [];\n if (maybeIncHelperName) {\n declarationsToInsert.push(buildMaybeIncDeclaration(maybeIncHelperName, mapping.increment));\n }\n\n // Insert runtime lookup tables for typography\n for (const [lookupKey, lookup] of runtimeLookups) {\n const lookupName = runtimeLookupNames.get(lookupKey);\n if (!lookupName) continue;\n declarationsToInsert.push(buildRuntimeLookupDeclaration(lookupName, lookup.segmentsByName, mapping));\n }\n\n // Inject __injectTrussCSS call if requested\n if (options.injectCss && cssText.length > 0) {\n declarationsToInsert.push(\n t.expressionStatement(t.callExpression(t.identifier(\"__injectTrussCSS\"), [t.stringLiteral(cssText)])),\n );\n }\n\n // Emit console.error calls for any unsupported patterns\n for (const { message, line } of errorMessages) {\n const location = line !== null ? `${filename}:${line}` : filename;\n const logMessage = `${message} (${location})`;\n declarationsToInsert.push(\n t.expressionStatement(\n t.callExpression(t.memberExpression(t.identifier(\"console\"), t.identifier(\"error\")), [\n t.stringLiteral(logMessage),\n ]),\n ),\n );\n }\n\n if (declarationsToInsert.length > 0) {\n const insertIndex = ast.program.body.findIndex(function (node) {\n return !t.isImportDeclaration(node);\n });\n ast.program.body.splice(insertIndex === -1 ? ast.program.body.length : insertIndex, 0, ...declarationsToInsert);\n }\n\n const output = generate(ast, {\n sourceFileName: filename,\n sourceMaps: true,\n retainLines: false,\n });\n\n const outputCode = preserveBlankLineAfterImports(code, output.code);\n\n return { code: outputCode, map: output.map, css: cssText, rules };\n}\n\n/** Collect typography runtime lookups from all resolved chains. */\nfunction collectRuntimeLookups(\n chains: ResolvedChain[],\n): Map<string, { segmentsByName: Record<string, ResolvedSegment[]> }> {\n const lookups = new Map<string, { segmentsByName: Record<string, ResolvedSegment[]> }>();\n for (const chain of chains) {\n for (const part of chain.parts) {\n const segs = part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n for (const seg of segs) {\n if (seg.typographyLookup && !lookups.has(seg.typographyLookup.lookupKey)) {\n lookups.set(seg.typographyLookup.lookupKey, {\n segmentsByName: seg.typographyLookup.segmentsByName,\n });\n }\n }\n }\n }\n return lookups;\n}\n\nfunction preserveBlankLineAfterImports(input: string, output: string): string {\n const inputLines = input.split(\"\\n\");\n const outputLines = output.split(\"\\n\");\n const lastInputImportLine = findLastImportLine(inputLines);\n const lastOutputImportLine = findLastImportLine(outputLines);\n\n if (lastInputImportLine === -1 || lastOutputImportLine === -1) {\n return output;\n }\n\n const inputHasBlankLineAfterImports = inputLines[lastInputImportLine + 1]?.trim() === \"\";\n const outputHasBlankLineAfterImports = outputLines[lastOutputImportLine + 1]?.trim() === \"\";\n if (!inputHasBlankLineAfterImports || outputHasBlankLineAfterImports) {\n return output;\n }\n\n outputLines.splice(lastOutputImportLine + 1, 0, \"\");\n return outputLines.join(\"\\n\");\n}\n\nfunction findLastImportLine(lines: string[]): number {\n let lastImportLine = -1;\n for (let index = 0; index < lines.length; index++) {\n if (lines[index].trimStart().startsWith(\"import \")) {\n lastImportLine = index;\n }\n }\n return lastImportLine;\n}\n","import type * as t from \"@babel/types\";\nimport type { TrussMapping, TrussMappingEntry, ResolvedSegment, MarkerSegment } from \"./types\";\n\n/**\n * A resolved chain that may contain conditional (if/else) sections.\n *\n * I.e. `ChainNode` from ast-utils.ts is just the raw AST chain from `Css` to `.$`, which may contain if/else\n * nodes; this `ResolvedChain` is the post-processed result where each if/else has been split into separate segments.\n *\n * The `parts` array contains unconditional segments and conditional groups.\n * The `markers` array contains marker directives (Css.marker.$, Css.markerOf(\"x\").$).\n */\nexport interface ResolvedChain {\n parts: ResolvedChainPart[];\n /** Marker directives to attach to the element (not CSS styles). */\n markers: MarkerSegment[];\n /** Error messages from unsupported patterns found in this chain. */\n errors: string[];\n}\n\nexport type ResolvedChainPart =\n | { type: \"unconditional\"; segments: ResolvedSegment[] }\n | { type: \"conditional\"; conditionNode: any; thenSegments: ResolvedSegment[]; elseSegments: ResolvedSegment[] };\n\n/**\n * High-level chain resolver that handles if/else by splitting into parts.\n *\n * ## Chain semantics\n *\n * A `Css.*.$` chain is read left-to-right. Each segment is either a style\n * abbreviation (getter or call) or a modifier that changes the context for\n * subsequent styles. The modifiers and their precedence:\n *\n * - **`if(bool)`** / **`else`** — Boolean conditional. Splits the chain into\n * then/else branches at the AST level. Subsequent styles go into the active\n * branch. A new `if` starts a new conditional.\n *\n * - **`if(mediaQuery)`** — String overload. Sets the media query context\n * (same as `ifSm`, `ifMd` etc.) for subsequent styles. Does NOT create\n * a boolean branch.\n *\n * - **`ifSm`**, **`ifMd`**, **`ifLg`**, etc. — Breakpoint getters. Set the\n * media query context. Stacks with pseudo-classes: `ifSm.onHover.blue.$`\n * applies both conditions.\n *\n * - **`onHover`**, **`onFocus`**, etc. — Pseudo-class getters. Set the\n * pseudo-class context. Stacks with media queries (see above). A new\n * pseudo-class replaces the previous one.\n *\n * - **`element(\"::placeholder\")`** — Pseudo-element. Sets the pseudo-element\n * context for subsequent styles.\n *\n * - **`when(\":hover\")`** — Same-element selector pseudo. Behaves like a custom\n * pseudo-class context and stacks with media queries.\n *\n * - **`when(marker, \"ancestor\", \":hover\")`** — Relationship pseudo. Resets both\n * media query and pseudo-class contexts.\n *\n * - **`ifContainer({ gt, lt })`** — Container query. Sets the media query\n * context to an `@container` query string.\n *\n * Contexts accumulate left-to-right until explicitly replaced. A media query\n * set by `ifSm` persists through `onHover` (they stack). A new `if(bool)`\n * resets all contexts for its branches.\n */\nexport function resolveFullChain(chain: ChainNode[], mapping: TrussMapping): ResolvedChain {\n const parts: ResolvedChainPart[] = [];\n const markers: MarkerSegment[] = [];\n\n // Pre-scan for marker nodes and strip them from the chain\n const filteredChain: ChainNode[] = [];\n /** Errors found during marker scanning — attached to the chain result */\n const scanErrors: string[] = [];\n for (let j = 0; j < chain.length; j++) {\n const node = chain[j];\n if (node.type === \"getter\" && node.name === \"marker\") {\n markers.push({ type: \"marker\" });\n } else if (node.type === \"call\" && node.name === \"markerOf\") {\n if (node.args.length !== 1) {\n scanErrors.push(\"[truss] Unsupported pattern: markerOf() requires exactly one argument (a marker variable)\");\n } else {\n markers.push({ type: \"marker\", markerNode: node.args[0] });\n }\n } else {\n filteredChain.push(node);\n }\n }\n\n // Split chain at if/else boundaries\n let i = 0;\n let currentNodes: ChainNode[] = [];\n\n while (i < filteredChain.length) {\n const node = filteredChain[i];\n const mediaStart = getMediaConditionalStartNode(node, mapping);\n if (mediaStart) {\n const elseIndex = findElseIndex(filteredChain, i + 1);\n if (elseIndex !== -1) {\n if (currentNodes.length > 0) {\n parts.push({ type: \"unconditional\", segments: resolveChain(currentNodes, mapping) });\n currentNodes = [];\n }\n\n const thenNodes = mediaStart.thenNodes\n ? [...mediaStart.thenNodes, ...filteredChain.slice(i + 1, elseIndex)]\n : filteredChain.slice(i, elseIndex);\n const elseNodes = [makeMediaQueryNode(mediaStart.inverseMediaQuery), ...filteredChain.slice(elseIndex + 1)];\n const thenSegs = resolveChain(thenNodes, mapping);\n const elseSegs = resolveChain(elseNodes, mapping);\n parts.push({ type: \"unconditional\", segments: [...thenSegs, ...elseSegs] });\n i = filteredChain.length;\n break;\n }\n }\n\n if (node.type === \"if\") {\n // if(stringLiteral) → media query pseudo, not a boolean conditional\n if (node.conditionNode.type === \"StringLiteral\") {\n const mediaQuery: string = (node.conditionNode as any).value;\n currentNodes.push({ type: \"__mediaQuery\" as any, mediaQuery } as any);\n i++;\n continue;\n }\n\n // Flush any accumulated unconditional nodes\n if (currentNodes.length > 0) {\n parts.push({ type: \"unconditional\", segments: resolveChain(currentNodes, mapping) });\n currentNodes = [];\n }\n // Collect \"then\" nodes until \"else\" or end\n const thenNodes: ChainNode[] = [];\n const elseNodes: ChainNode[] = [];\n i++;\n let inElse = false;\n while (i < filteredChain.length) {\n if (filteredChain[i].type === \"else\") {\n inElse = true;\n i++;\n continue;\n }\n if (filteredChain[i].type === \"if\") {\n // Nested if — break out and let the outer loop handle it\n break;\n }\n if (inElse) {\n elseNodes.push(filteredChain[i]);\n } else {\n thenNodes.push(filteredChain[i]);\n }\n i++;\n }\n const thenSegs = resolveChain(thenNodes, mapping);\n const elseSegs = resolveChain(elseNodes, mapping);\n parts.push({\n type: \"conditional\",\n conditionNode: node.conditionNode,\n thenSegments: thenSegs,\n elseSegments: elseSegs,\n });\n } else {\n currentNodes.push(node);\n i++;\n }\n }\n\n // Flush remaining unconditional nodes\n if (currentNodes.length > 0) {\n parts.push({ type: \"unconditional\", segments: resolveChain(currentNodes, mapping) });\n }\n\n // Collect error messages from all resolved segments\n const segmentErrors: string[] = [];\n for (const part of parts) {\n const segs = part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n for (const seg of segs) {\n if (seg.error) {\n segmentErrors.push(seg.error);\n }\n }\n }\n\n return { parts, markers, errors: [...scanErrors, ...segmentErrors] };\n}\n\nfunction getMediaConditionalStartNode(\n node: ChainNode,\n mapping: TrussMapping,\n): { inverseMediaQuery: string; thenNodes?: ChainNode[] } | null {\n if (node.type === \"if\" && node.conditionNode.type === \"StringLiteral\") {\n return {\n inverseMediaQuery: invertMediaQuery(node.conditionNode.value),\n thenNodes: [makeMediaQueryNode(node.conditionNode.value)],\n };\n }\n\n if (node.type === \"getter\" && mapping.breakpoints && node.name in mapping.breakpoints) {\n return { inverseMediaQuery: invertMediaQuery(mapping.breakpoints[node.name]) };\n }\n\n return null;\n}\n\nfunction findElseIndex(chain: ChainNode[], start: number): number {\n for (let i = start; i < chain.length; i++) {\n if (chain[i].type === \"if\") {\n return -1;\n }\n if (chain[i].type === \"else\") {\n return i;\n }\n }\n return -1;\n}\n\nfunction makeMediaQueryNode(mediaQuery: string): ChainNode {\n return { type: \"__mediaQuery\" as any, mediaQuery } as any;\n}\n\nfunction invertMediaQuery(query: string): string {\n const screenPrefix = \"@media screen and \";\n if (query.startsWith(screenPrefix)) {\n const conditions = query.slice(screenPrefix.length).trim();\n const rangeMatch = conditions.match(/^\\(min-width: (\\d+)px\\) and \\(max-width: (\\d+)px\\)$/);\n if (rangeMatch) {\n const min = Number(rangeMatch[1]);\n const max = Number(rangeMatch[2]);\n return `@media screen and (max-width: ${min - 1}px), screen and (min-width: ${max + 1}px)`;\n }\n const minMatch = conditions.match(/^\\(min-width: (\\d+)px\\)$/);\n if (minMatch) {\n return `@media screen and (max-width: ${Number(minMatch[1]) - 1}px)`;\n }\n const maxMatch = conditions.match(/^\\(max-width: (\\d+)px\\)$/);\n if (maxMatch) {\n return `@media screen and (min-width: ${Number(maxMatch[1]) + 1}px)`;\n }\n }\n return query.replace(\"@media\", \"@media not\");\n}\n\n/**\n * Walks a Css member-expression chain (the AST between `Css` and `.$`) and\n * resolves each segment into CSS property definitions using the truss mapping.\n *\n * Returns an array of ResolvedSegment with flat defs (no condition nesting).\n * Does NOT handle if/else — use resolveFullChain for that.\n */\nexport function resolveChain(chain: ChainNode[], mapping: TrussMapping): ResolvedSegment[] {\n const segments: ResolvedSegment[] = [];\n // Track media query and pseudo-class separately so they can stack.\n // e.g. Css.ifSm.onHover.blue.$ → both mediaQuery and pseudoClass are set\n let currentMediaQuery: string | null = null;\n let currentPseudoClass: string | null = null;\n let currentPseudoElement: string | null = null;\n let currentWhenPseudo: { pseudo: string; markerNode?: any; relationship?: string } | null = null;\n\n for (const node of chain) {\n try {\n // Synthetic media query node injected by resolveFullChain for if(\"@media...\")\n if ((node as any).type === \"__mediaQuery\") {\n currentMediaQuery = (node as any).mediaQuery;\n currentWhenPseudo = null;\n continue;\n }\n\n if (node.type === \"getter\") {\n const abbr = node.name;\n\n // Pseudo-class getters: onHover, onFocus, etc.\n if (isPseudoMethod(abbr)) {\n currentPseudoClass = pseudoSelector(abbr);\n currentWhenPseudo = null;\n continue;\n }\n\n // Breakpoint getters: ifSm, ifMd, ifLg, etc.\n if (mapping.breakpoints && abbr in mapping.breakpoints) {\n currentMediaQuery = mapping.breakpoints[abbr];\n currentWhenPseudo = null;\n continue;\n }\n\n const entry = mapping.abbreviations[abbr];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown abbreviation \"${abbr}\"`);\n }\n\n const resolved = resolveEntry(\n abbr,\n entry,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(...resolved);\n } else if (node.type === \"call\") {\n const abbr = node.name;\n\n // Container query call: ifContainer({ gt, lt, name? })\n if (abbr === \"ifContainer\") {\n currentMediaQuery = containerSelectorFromCall(node);\n currentWhenPseudo = null;\n continue;\n }\n\n // add(prop, value) / addCss(cssProp)\n if (abbr === \"add\" || abbr === \"addCss\") {\n const seg = resolveAddCall(\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(seg);\n continue;\n }\n\n if (abbr === \"typography\") {\n const resolved = resolveTypographyCall(\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n );\n segments.push(...resolved);\n continue;\n }\n\n // Pseudo-element: element(\"::placeholder\") etc.\n if (abbr === \"element\") {\n if (node.args.length !== 1 || node.args[0].type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(\n `element() requires exactly one string literal argument (e.g. \"::placeholder\")`,\n );\n }\n currentPseudoElement = (node.args[0] as any).value;\n continue;\n }\n\n // Generic when(selector) or when(marker, relationship, pseudo)\n if (abbr === \"when\") {\n const resolved = resolveWhenCall(node);\n if (resolved.kind === \"selector\") {\n currentPseudoClass = resolved.pseudo;\n currentWhenPseudo = null;\n } else {\n currentPseudoClass = null;\n currentMediaQuery = null;\n currentWhenPseudo = resolved;\n }\n continue;\n }\n\n // Simple pseudo-class calls (backward compat — pseudos are now getters)\n if (isPseudoMethod(abbr)) {\n currentPseudoClass = pseudoSelector(abbr);\n currentWhenPseudo = null;\n if (node.args.length > 0) {\n throw new UnsupportedPatternError(\n `${abbr}() does not take arguments -- use when(marker, \"ancestor\", \":hover\") for relationship selectors`,\n );\n }\n continue;\n }\n\n const entry = mapping.abbreviations[abbr];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown abbreviation \"${abbr}\"`);\n }\n\n if (entry.kind === \"variable\") {\n const seg = resolveVariableCall(\n abbr,\n entry,\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(seg);\n } else if (entry.kind === \"delegate\") {\n const seg = resolveDelegateCall(\n abbr,\n entry,\n node,\n mapping,\n currentMediaQuery,\n currentPseudoClass,\n currentPseudoElement,\n currentWhenPseudo,\n );\n segments.push(seg);\n } else {\n throw new UnsupportedPatternError(`Abbreviation \"${abbr}\" is ${entry.kind}, cannot be called as a function`);\n }\n }\n } catch (err) {\n if (err instanceof UnsupportedPatternError) {\n segments.push({ abbr: \"__error\", defs: {}, error: err.message });\n } else {\n throw err;\n }\n }\n }\n\n return segments;\n}\n\n/**\n * Build a typography lookup key suffix from condition context.\n *\n * I.e. `typography(key)` → `\"typography\"`, `ifSm.typography(key)` → `\"typography__sm\"`.\n */\nfunction typographyLookupKeySuffix(\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n breakpoints?: Record<string, string>,\n): string {\n const parts: string[] = [];\n if (pseudoElement) parts.push(pseudoElement.replace(/^::/, \"\"));\n if (mediaQuery && breakpoints) {\n const bp = Object.entries(breakpoints).find(([, v]) => v === mediaQuery)?.[0];\n parts.push(bp ? bp.replace(/^if/, \"\").replace(/^./, (c) => c.toLowerCase()) : \"mq\");\n } else if (mediaQuery) {\n parts.push(\"mq\");\n }\n if (pseudoClass) parts.push(pseudoClass.replace(/^:+/, \"\").replace(/-/g, \"_\"));\n return parts.join(\"_\");\n}\n\n/** Resolve `typography(key)` into either direct segments or a runtime lookup-backed segment. */\nfunction resolveTypographyCall(\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n): ResolvedSegment[] {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`typography() expects exactly 1 argument, got ${node.args.length}`);\n }\n\n const argAst = node.args[0];\n if (argAst.type === \"StringLiteral\") {\n return resolveTypographyEntry(argAst.value, mapping, mediaQuery, pseudoClass, pseudoElement);\n }\n\n const typography = mapping.typography ?? [];\n if (typography.length === 0) {\n throw new UnsupportedPatternError(`typography() is unavailable because no typography abbreviations were generated`);\n }\n\n const suffix = typographyLookupKeySuffix(mediaQuery, pseudoClass, pseudoElement, mapping.breakpoints);\n const lookupKey = suffix ? `typography__${suffix}` : \"typography\";\n const segmentsByName: Record<string, ResolvedSegment[]> = {};\n\n for (const name of typography) {\n segmentsByName[name] = resolveTypographyEntry(name, mapping, mediaQuery, pseudoClass, pseudoElement);\n }\n\n return [\n {\n abbr: lookupKey,\n defs: {},\n typographyLookup: {\n lookupKey,\n argNode: argAst,\n segmentsByName,\n },\n },\n ];\n}\n\n/** Resolve a single typography abbreviation name within the current condition context. */\nfunction resolveTypographyEntry(\n name: string,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n): ResolvedSegment[] {\n if (!(mapping.typography ?? []).includes(name)) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const entry = mapping.abbreviations[name];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const resolved = resolveEntry(name, entry, mapping, mediaQuery, pseudoClass, pseudoElement, null);\n for (const segment of resolved) {\n if (segment.variableProps || segment.whenPseudo) {\n throw new UnsupportedPatternError(`Typography abbreviation \"${name}\" cannot require runtime arguments`);\n }\n }\n return resolved;\n}\n\n/** Resolve a static or alias entry (from a getter access). Defs are always flat. */\nfunction resolveEntry(\n abbr: string,\n entry: TrussMappingEntry,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment[] {\n switch (entry.kind) {\n case \"static\": {\n if (whenPseudo) {\n return [{ abbr, defs: entry.defs, whenPseudo }];\n }\n return [{ abbr, defs: entry.defs, mediaQuery, pseudoClass, pseudoElement }];\n }\n case \"alias\": {\n const result: ResolvedSegment[] = [];\n for (const chainAbbr of entry.chain) {\n const subEntry = mapping.abbreviations[chainAbbr];\n if (!subEntry) {\n throw new UnsupportedPatternError(`Alias \"${abbr}\" references unknown abbreviation \"${chainAbbr}\"`);\n }\n result.push(...resolveEntry(chainAbbr, subEntry, mapping, mediaQuery, pseudoClass, pseudoElement, whenPseudo));\n }\n return result;\n }\n case \"variable\":\n case \"delegate\":\n throw new UnsupportedPatternError(`Abbreviation \"${abbr}\" requires arguments — use ${abbr}() not .${abbr}`);\n default:\n throw new UnsupportedPatternError(`Unhandled entry kind for \"${abbr}\"`);\n }\n}\n\n/** Resolve a variable (parameterized) call like mt(2) or mt(x). */\nfunction resolveVariableCall(\n abbr: string,\n entry: { kind: \"variable\"; props: string[]; incremented: boolean; extraDefs?: Record<string, unknown> },\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`${abbr}() expects exactly 1 argument, got ${node.args.length}`);\n }\n const literalValue = tryEvaluateLiteral(node.args[0], entry.incremented, mapping.increment);\n return buildParameterizedSegment({\n abbr,\n props: entry.props,\n incremented: entry.incremented,\n extraDefs: entry.extraDefs,\n argAst: node.args[0],\n literalValue,\n mediaQuery,\n pseudoClass,\n pseudoElement,\n whenPseudo,\n });\n}\n\n/** Resolve a delegate call like mtPx(12). */\nfunction resolveDelegateCall(\n abbr: string,\n entry: { kind: \"delegate\"; target: string },\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment {\n const targetEntry = mapping.abbreviations[entry.target];\n if (!targetEntry || targetEntry.kind !== \"variable\") {\n throw new UnsupportedPatternError(`Delegate \"${abbr}\" targets \"${entry.target}\" which is not a variable entry`);\n }\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`${abbr}() expects exactly 1 argument, got ${node.args.length}`);\n }\n const literalValue = tryEvaluatePxLiteral(node.args[0]);\n // Use the target abbreviation name for delegate segments (i.e. mtPx → mt)\n return buildParameterizedSegment({\n abbr: entry.target,\n props: targetEntry.props,\n incremented: false,\n appendPx: true,\n extraDefs: targetEntry.extraDefs,\n argAst: node.args[0],\n literalValue,\n mediaQuery,\n pseudoClass,\n pseudoElement,\n whenPseudo,\n });\n}\n\n/** Shared builder for variable and delegate call segments. */\nfunction buildParameterizedSegment(params: {\n abbr: string;\n props: string[];\n incremented: boolean;\n appendPx?: boolean;\n extraDefs?: Record<string, unknown>;\n argAst: t.Expression | t.SpreadElement;\n literalValue: string | null;\n mediaQuery: string | null;\n pseudoClass: string | null;\n pseudoElement: string | null;\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null;\n}): ResolvedSegment {\n const { abbr, props, incremented, appendPx, extraDefs, argAst, literalValue, whenPseudo } = params;\n\n if (literalValue !== null) {\n const defs: Record<string, unknown> = {};\n for (const prop of props) {\n defs[prop] = literalValue;\n }\n if (extraDefs) Object.assign(defs, extraDefs);\n if (whenPseudo) {\n return { abbr, defs, whenPseudo, argResolved: literalValue };\n }\n return {\n abbr,\n defs,\n mediaQuery: params.mediaQuery,\n pseudoClass: params.pseudoClass,\n pseudoElement: params.pseudoElement,\n argResolved: literalValue,\n };\n }\n\n const base: ResolvedSegment = {\n abbr,\n defs: {},\n variableProps: props,\n incremented,\n variableExtraDefs: extraDefs,\n argNode: argAst,\n };\n if (appendPx) base.appendPx = true;\n if (whenPseudo) {\n base.whenPseudo = whenPseudo;\n } else {\n base.mediaQuery = params.mediaQuery;\n base.pseudoClass = params.pseudoClass;\n base.pseudoElement = params.pseudoElement;\n }\n return base;\n}\n\n/**\n * Resolve an `add(...)` or `addCss(...)` call.\n *\n * Supported overloads:\n * - `add(cssProp)` to inline an existing CssProp array into the chain output\n * - `addCss(cssProp)` to inline an existing Truss style hash into the chain output\n * - `add(\"propName\", value)` for an arbitrary CSS property/value pair\n */\nfunction resolveAddCall(\n node: CallChainNode,\n mapping: TrussMapping,\n mediaQuery: string | null,\n pseudoClass: string | null,\n pseudoElement: string | null,\n whenPseudo?: { pseudo: string; markerNode?: any; relationship?: string } | null,\n): ResolvedSegment {\n const isAddCss = node.name === \"addCss\";\n\n if (isAddCss) {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(\n `addCss() requires exactly 1 argument (an existing CssProp/style hash expression)`,\n );\n }\n\n const styleArg = node.args[0];\n if (styleArg.type === \"SpreadElement\") {\n // I.e. reject call-arg spread like `addCss(...xss)`; callers should use `addCss(xss)` or `addCss({ ...xss })`.\n throw new UnsupportedPatternError(`addCss() does not support spread arguments`);\n }\n return {\n abbr: \"__composed_css_prop\",\n defs: {},\n styleArrayArg: styleArg,\n isAddCss: true,\n };\n }\n\n if (node.args.length === 1) {\n const styleArg = node.args[0];\n if (styleArg.type === \"SpreadElement\") {\n throw new UnsupportedPatternError(`add() does not support spread arguments`);\n }\n if (styleArg.type === \"ObjectExpression\") {\n throw new UnsupportedPatternError(\n `add(cssProp) does not accept object literals -- pass an existing CssProp expression instead`,\n );\n }\n return {\n abbr: \"__composed_css_prop\",\n defs: {},\n styleArrayArg: styleArg,\n };\n }\n\n if (node.args.length !== 2) {\n throw new UnsupportedPatternError(\n `add() requires exactly 2 arguments (property name and value), got ${node.args.length}. ` +\n `Supported overloads are add(cssProp), addCss(cssProp), and add(\"propName\", value)`,\n );\n }\n\n const propArg = node.args[0];\n if (propArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`add() first argument must be a string literal property name`);\n }\n const propName: string = (propArg as any).value;\n\n const valueArg = node.args[1];\n const literalValue = tryEvaluateAddLiteral(valueArg);\n\n if (whenPseudo) {\n if (literalValue !== null) {\n return { abbr: propName, defs: { [propName]: literalValue }, whenPseudo, argResolved: literalValue };\n } else {\n return { abbr: propName, defs: {}, whenPseudo, variableProps: [propName], incremented: false, argNode: valueArg };\n }\n }\n\n if (literalValue !== null) {\n return {\n abbr: propName,\n defs: { [propName]: literalValue },\n mediaQuery,\n pseudoClass,\n pseudoElement,\n argResolved: literalValue,\n };\n } else {\n return {\n abbr: propName,\n defs: {},\n mediaQuery,\n pseudoClass,\n pseudoElement,\n variableProps: [propName],\n incremented: false,\n argNode: valueArg,\n };\n }\n}\n\n/** Try to evaluate a literal for add() — strings, numbers, and template literals with no expressions. */\nfunction tryEvaluateAddLiteral(node: t.Expression | t.SpreadElement): string | null {\n if (node.type === \"StringLiteral\") {\n return (node as any).value;\n }\n if (node.type === \"NumericLiteral\") {\n return String((node as any).value);\n }\n if (node.type === \"UnaryExpression\" && node.operator === \"-\" && node.argument.type === \"NumericLiteral\") {\n return String(-(node.argument as any).value);\n }\n return null;\n}\n\nconst WHEN_RELATIONSHIPS = new Set([\"ancestor\", \"descendant\", \"anySibling\", \"siblingBefore\", \"siblingAfter\"]);\n\n/**\n * Resolve a `when(selector)` or `when(marker, relationship, pseudo)` call.\n *\n * - 1 arg: `when(\":hover\")` — same-element selector, must be a string literal\n * - 3 args: `when(marker, \"ancestor\", \":hover\")` — marker must be a marker variable or\n * the shared `marker` token, relationship/pseudo must be string literals\n */\nfunction resolveWhenCall(\n node: CallChainNode,\n):\n | { kind: \"selector\"; pseudo: string }\n | { kind: \"relationship\"; pseudo: string; markerNode?: any; relationship: string } {\n if (node.args.length !== 1 && node.args.length !== 3) {\n throw new UnsupportedPatternError(\n `when() expects 1 or 3 arguments (selector) or (marker, relationship, pseudo), got ${node.args.length}`,\n );\n }\n\n if (node.args.length === 1) {\n const pseudoArg = node.args[0];\n if (pseudoArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`when() selector must be a string literal`);\n }\n return { kind: \"selector\", pseudo: (pseudoArg as any).value };\n }\n\n const markerArg = node.args[0];\n const markerNode = resolveWhenMarker(markerArg);\n const relationshipArg = node.args[1];\n if (relationshipArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`when() relationship argument must be a string literal`);\n }\n const relationship: string = (relationshipArg as any).value;\n if (!WHEN_RELATIONSHIPS.has(relationship)) {\n throw new UnsupportedPatternError(\n `when() relationship must be one of: ${[...WHEN_RELATIONSHIPS].join(\", \")} -- got \"${relationship}\"`,\n );\n }\n\n const pseudoArg = node.args[2];\n if (pseudoArg.type !== \"StringLiteral\") {\n throw new UnsupportedPatternError(`when() pseudo selector (3rd argument) must be a string literal`);\n }\n return { kind: \"relationship\", pseudo: (pseudoArg as any).value, markerNode, relationship };\n}\n\nfunction resolveWhenMarker(node: t.Expression | t.SpreadElement): any | undefined {\n if (isDefaultMarkerNode(node)) {\n return undefined;\n }\n if (node.type === \"Identifier\") {\n return node;\n }\n throw new UnsupportedPatternError(`when() marker must be a marker variable or marker`);\n}\n\nfunction isDefaultMarkerNode(node: t.Expression | t.SpreadElement): boolean {\n if (node.type === \"Identifier\" && (node.name === \"marker\" || node.name === \"defaultMarker\")) {\n return true;\n }\n return isLegacyDefaultMarkerExpression(node);\n}\n\nfunction isLegacyDefaultMarkerExpression(node: t.Expression | t.SpreadElement): boolean {\n return (\n node.type === \"CallExpression\" &&\n node.arguments.length === 0 &&\n node.callee.type === \"MemberExpression\" &&\n !node.callee.computed &&\n node.callee.property.type === \"Identifier\" &&\n node.callee.property.name === \"defaultMarker\"\n );\n}\n\n// ── Helpers ───────────────────────────────────────────────────────────\n\nconst PSEUDO_METHODS: Record<string, string> = {\n onHover: \":hover\",\n onFocus: \":focus\",\n onFocusVisible: \":focus-visible\",\n onFocusWithin: \":focus-within\",\n onActive: \":active\",\n onDisabled: \":disabled\",\n};\n\nfunction isPseudoMethod(name: string): boolean {\n return name in PSEUDO_METHODS;\n}\n\nfunction pseudoSelector(name: string): string {\n return PSEUDO_METHODS[name];\n}\n\n/**\n * Try to evaluate a literal AST node to a string value.\n * For incremented entries, also evaluates `maybeInc(literal)`.\n */\nfunction tryEvaluateLiteral(\n node: t.Expression | t.SpreadElement,\n incremented: boolean,\n increment: number,\n): string | null {\n if (node.type === \"NumericLiteral\") {\n if (incremented) {\n return `${node.value * increment}px`;\n }\n return String(node.value);\n }\n if (node.type === \"StringLiteral\") {\n return node.value;\n }\n if (node.type === \"UnaryExpression\" && node.operator === \"-\" && node.argument.type === \"NumericLiteral\") {\n const val = -node.argument.value;\n if (incremented) {\n return `${val * increment}px`;\n }\n return String(val);\n }\n return null;\n}\n\n/** Try to evaluate a Px delegate argument (always a number → `${n}px`). */\nfunction tryEvaluatePxLiteral(node: t.Expression | t.SpreadElement): string | null {\n if (node.type === \"NumericLiteral\") {\n return `${node.value}px`;\n }\n return null;\n}\n\n/** Resolve ifContainer({ gt, lt, name? }) to a container query pseudo key. */\nfunction containerSelectorFromCall(node: CallChainNode): string {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`ifContainer() expects exactly 1 argument, got ${node.args.length}`);\n }\n\n const arg = node.args[0];\n if (!arg || arg.type !== \"ObjectExpression\") {\n throw new UnsupportedPatternError(\"ifContainer() expects an object literal argument\");\n }\n\n let lt: number | undefined;\n let gt: number | undefined;\n let name: string | undefined;\n\n for (const prop of arg.properties) {\n if (prop.type === \"SpreadElement\") {\n throw new UnsupportedPatternError(\"ifContainer() does not support spread properties\");\n }\n if (prop.type !== \"ObjectProperty\" || prop.computed) {\n throw new UnsupportedPatternError(\"ifContainer() expects plain object properties\");\n }\n\n const key = objectPropertyName(prop.key);\n if (!key) {\n throw new UnsupportedPatternError(\"ifContainer() only supports identifier/string keys\");\n }\n\n const valueNode = prop.value as t.Expression | t.SpreadElement;\n\n if (key === \"lt\") {\n lt = numericLiteralValue(valueNode, \"ifContainer().lt must be a numeric literal\");\n continue;\n }\n if (key === \"gt\") {\n gt = numericLiteralValue(valueNode, \"ifContainer().gt must be a numeric literal\");\n continue;\n }\n if (key === \"name\") {\n name = stringLiteralValue(valueNode, \"ifContainer().name must be a string literal\");\n continue;\n }\n\n throw new UnsupportedPatternError(`ifContainer() does not support property \"${key}\"`);\n }\n\n if (lt === undefined && gt === undefined) {\n throw new UnsupportedPatternError('ifContainer() requires at least one of \"lt\" or \"gt\"');\n }\n\n const parts: string[] = [];\n if (gt !== undefined) {\n parts.push(`(min-width: ${gt + 1}px)`);\n }\n if (lt !== undefined) {\n parts.push(`(max-width: ${lt}px)`);\n }\n\n const query = parts.join(\" and \");\n const namePrefix = name ? `${name} ` : \"\";\n return `@container ${namePrefix}${query}`;\n}\n\nfunction objectPropertyName(node: t.Expression | t.Identifier | t.PrivateName): string | null {\n if (node.type === \"Identifier\") return node.name;\n if (node.type === \"StringLiteral\") return node.value;\n return null;\n}\n\nfunction numericLiteralValue(node: t.Expression | t.SpreadElement, errorMessage: string): number {\n if (node.type === \"NumericLiteral\") {\n return node.value;\n }\n if (node.type === \"UnaryExpression\" && node.operator === \"-\" && node.argument.type === \"NumericLiteral\") {\n return -node.argument.value;\n }\n throw new UnsupportedPatternError(errorMessage);\n}\n\nfunction stringLiteralValue(node: t.Expression | t.SpreadElement, errorMessage: string): string {\n if (node.type === \"StringLiteral\") {\n return node.value;\n }\n if (node.type === \"TemplateLiteral\" && node.expressions.length === 0 && node.quasis.length === 1) {\n return node.quasis[0].value.cooked ?? \"\";\n }\n throw new UnsupportedPatternError(errorMessage);\n}\n\n// ── Chain node types (parsed from AST) ────────────────────────────────\n\nexport interface GetterChainNode {\n type: \"getter\";\n name: string;\n}\n\nexport interface CallChainNode {\n type: \"call\";\n name: string;\n args: (t.Expression | t.SpreadElement)[];\n}\n\nexport interface IfChainNode {\n type: \"if\";\n conditionNode: t.Expression | t.SpreadElement;\n}\n\nexport interface ElseChainNode {\n type: \"else\";\n}\n\nexport type ChainNode = GetterChainNode | CallChainNode | IfChainNode | ElseChainNode;\n\nexport class UnsupportedPatternError extends Error {\n constructor(message: string) {\n super(`[truss] Unsupported pattern: ${message}`);\n this.name = \"UnsupportedPatternError\";\n }\n}\n","import * as t from \"@babel/types\";\nimport type { ChainNode } from \"./resolve-chain\";\n\n/**\n * Collect module-scope bindings so generated declarations can avoid collisions.\n *\n * We only care about top-level names because the transform injects declarations\n * at the module root, not inside nested blocks.\n */\nexport function collectTopLevelBindings(ast: t.File): Set<string> {\n const used = new Set<string>();\n\n for (const node of ast.program.body) {\n if (t.isImportDeclaration(node)) {\n for (const spec of node.specifiers) {\n used.add(spec.local.name);\n }\n continue;\n }\n\n if (t.isVariableDeclaration(node)) {\n for (const decl of node.declarations) {\n collectPatternBindings(decl.id, used);\n }\n continue;\n }\n\n if (t.isFunctionDeclaration(node) && node.id) {\n used.add(node.id.name);\n continue;\n }\n\n if (t.isClassDeclaration(node) && node.id) {\n used.add(node.id.name);\n continue;\n }\n\n if (t.isExportNamedDeclaration(node) && node.declaration) {\n const decl = node.declaration;\n if (t.isVariableDeclaration(decl)) {\n for (const varDecl of decl.declarations) {\n collectPatternBindings(varDecl.id, used);\n }\n } else if ((t.isFunctionDeclaration(decl) || t.isClassDeclaration(decl)) && decl.id) {\n used.add(decl.id.name);\n }\n continue;\n }\n\n if (t.isExportDefaultDeclaration(node)) {\n const decl = node.declaration;\n if ((t.isFunctionDeclaration(decl) || t.isClassDeclaration(decl)) && decl.id) {\n used.add(decl.id.name);\n }\n }\n }\n\n return used;\n}\n\n/**\n * Recursively collect names introduced by binding patterns.\n *\n * This handles destructuring (`const { a } = ...`, `const [x] = ...`) so we do\n * not accidentally generate a helper that shadows an existing binding.\n */\nfunction collectPatternBindings(pattern: t.LVal | t.VoidPattern, used: Set<string>): void {\n if (t.isVoidPattern(pattern)) {\n return;\n }\n\n if (t.isIdentifier(pattern)) {\n used.add(pattern.name);\n return;\n }\n\n if (t.isAssignmentPattern(pattern)) {\n collectPatternBindings(pattern.left, used);\n return;\n }\n\n if (t.isRestElement(pattern)) {\n collectPatternBindings(pattern.argument as t.LVal, used);\n return;\n }\n\n if (t.isObjectPattern(pattern)) {\n for (const prop of pattern.properties) {\n if (t.isObjectProperty(prop)) {\n collectPatternBindings(prop.value as t.LVal, used);\n } else if (t.isRestElement(prop)) {\n collectPatternBindings(prop.argument as t.LVal, used);\n }\n }\n return;\n }\n\n if (t.isArrayPattern(pattern)) {\n for (const el of pattern.elements) {\n if (!el) continue;\n if (t.isIdentifier(el) || t.isAssignmentPattern(el) || t.isObjectPattern(el) || t.isArrayPattern(el)) {\n collectPatternBindings(el, used);\n } else if (t.isRestElement(el)) {\n collectPatternBindings(el.argument as t.LVal, used);\n }\n }\n }\n}\n\n/**\n * Reserve a stable, collision-free identifier.\n *\n * Preference order:\n * 1) preferred\n * 2) secondary (if provided)\n * 3) numbered suffixes based on secondary/preferred\n */\nexport function reservePreferredName(used: Set<string>, preferred: string, secondary?: string): string {\n if (!used.has(preferred)) {\n used.add(preferred);\n return preferred;\n }\n\n if (secondary && !used.has(secondary)) {\n used.add(secondary);\n return secondary;\n }\n\n const base = secondary ?? preferred;\n let i = 1;\n // Numbered fallback keeps generated names deterministic across runs.\n let candidate = `${base}_${i}`;\n while (used.has(candidate)) {\n i++;\n candidate = `${base}_${i}`;\n }\n used.add(candidate);\n return candidate;\n}\n\n/**\n * Find the local binding name for `Css` from import declarations.\n */\nexport function findCssImportBinding(ast: t.File): string | null {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: \"Css\" })) {\n return spec.local.name;\n }\n }\n }\n return null;\n}\n\n/**\n * Find a local binding where `Css` is created via `new CssBuilder(...)`.\n *\n * This handles tsup-bundled libraries where Css is not imported but declared as:\n * var Css = new CssBuilder({ ... });\n */\nexport function findCssBuilderBinding(ast: t.File): string | null {\n for (const node of ast.program.body) {\n if (!t.isVariableDeclaration(node)) continue;\n for (const decl of node.declarations) {\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isNewExpression(decl.init) &&\n t.isIdentifier(decl.init.callee, { name: \"CssBuilder\" })\n ) {\n return decl.id.name;\n }\n }\n }\n return null;\n}\n\n/** Check if the AST contains a `binding.method(...)` call expression. */\nexport function hasCssMethodCall(ast: t.File, binding: string, method: string): boolean {\n let found = false;\n t.traverseFast(ast, (node) => {\n if (found) return;\n if (\n t.isCallExpression(node) &&\n t.isMemberExpression(node.callee) &&\n !node.callee.computed &&\n t.isIdentifier(node.callee.object, { name: binding }) &&\n t.isIdentifier(node.callee.property, { name: method })\n ) {\n found = true;\n }\n });\n return found;\n}\n\n/**\n * Remove the Css import specifier. If it was the only specifier, remove the whole import.\n */\nexport function removeCssImport(ast: t.File, cssBinding: string): void {\n for (let i = 0; i < ast.program.body.length; i++) {\n const node = ast.program.body[i];\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex((s) => t.isImportSpecifier(s) && s.local.name === cssBinding);\n if (cssSpecIndex === -1) continue;\n\n if (node.specifiers.length === 1) {\n ast.program.body.splice(i, 1);\n } else {\n node.specifiers.splice(cssSpecIndex, 1);\n }\n return;\n }\n}\n\n/** Return the index of the last import declaration in the module. */\nexport function findLastImportIndex(ast: t.File): number {\n let lastImportIndex = -1;\n for (let i = 0; i < ast.program.body.length; i++) {\n if (t.isImportDeclaration(ast.program.body[i])) {\n lastImportIndex = i;\n }\n }\n return lastImportIndex;\n}\n\nexport function findNamedImportBinding(ast: t.File, source: string, importedName: string): string | null {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node) || node.source.value !== source) continue;\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: importedName })) {\n return spec.local.name;\n }\n }\n }\n return null;\n}\n\nexport function findImportDeclaration(ast: t.File, source: string): t.ImportDeclaration | null {\n for (const node of ast.program.body) {\n if (t.isImportDeclaration(node) && node.source.value === source) {\n return node;\n }\n }\n return null;\n}\n\nexport function replaceCssImportWithNamedImports(\n ast: t.File,\n cssBinding: string,\n source: string,\n imports: Array<{ importedName: string; localName: string }>,\n): boolean {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex(function (spec) {\n return t.isImportSpecifier(spec) && spec.local.name === cssBinding;\n });\n if (cssSpecIndex === -1 || node.specifiers.length !== 1) continue;\n\n node.source = t.stringLiteral(source);\n node.specifiers = imports.map(function (entry) {\n return t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName));\n });\n return true;\n }\n\n return false;\n}\n\nexport function upsertNamedImports(\n ast: t.File,\n source: string,\n imports: Array<{ importedName: string; localName: string }>,\n): void {\n if (imports.length === 0) return;\n\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node) || node.source.value !== source) continue;\n\n for (const entry of imports) {\n const exists = node.specifiers.some(function (spec) {\n return t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: entry.importedName });\n });\n if (exists) continue;\n\n node.specifiers.push(t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName)));\n }\n return;\n }\n\n const importDecl = t.importDeclaration(\n imports.map(function (entry) {\n return t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName));\n }),\n t.stringLiteral(source),\n );\n const idx = findLastImportIndex(ast);\n ast.program.body.splice(idx + 1, 0, importDecl);\n}\n\n/**\n * Extract a `Css` method/property chain from an expression.\n *\n * Example: `Css.if(cond).df.else.db.$` ->\n * `[{type:\"if\"}, {type:\"getter\", name:\"df\"}, {type:\"else\"}, {type:\"getter\", name:\"db\"}]`\n *\n * Returns `null` when the expression is not rooted at the Css import binding,\n * which lets the caller ignore unrelated member expressions cheaply.\n */\nexport function extractChain(node: t.Expression, cssBinding: string): ChainNode[] | null {\n const chain: ChainNode[] = [];\n let current: t.Expression = node;\n\n while (true) {\n if (t.isIdentifier(current, { name: cssBinding })) {\n chain.reverse();\n return chain;\n }\n\n if (t.isMemberExpression(current) && !current.computed && t.isIdentifier(current.property)) {\n const name = current.property.name;\n if (name === \"else\") {\n chain.push({ type: \"else\" });\n } else {\n chain.push({ type: \"getter\", name });\n }\n current = current.object as t.Expression;\n continue;\n }\n\n if (\n t.isCallExpression(current) &&\n t.isMemberExpression(current.callee) &&\n !current.callee.computed &&\n t.isIdentifier(current.callee.property)\n ) {\n const name = current.callee.property.name;\n\n if (name === \"if\") {\n chain.push({\n type: \"if\",\n conditionNode: current.arguments[0] as t.Expression,\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n chain.push({\n type: \"call\",\n name,\n args: current.arguments as (t.Expression | t.SpreadElement)[],\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n return null;\n }\n}\n","import _traverse from \"@babel/traverse\";\nimport type { NodePath } from \"@babel/traverse\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport type { ResolvedChain } from \"./resolve-chain\";\nimport { buildStyleHashProperties, markerClassName } from \"./emit-truss\";\nimport type { ResolvedSegment } from \"./types\";\n\n// Babel packages are CJS today; normalize default interop across loaders.\nconst generate = ((_generate as unknown as { default?: typeof _generate }).default ?? _generate) as typeof _generate;\nconst traverse = ((_traverse as unknown as { default?: typeof _traverse }).default ?? _traverse) as typeof _traverse;\n\nexport interface ExpressionSite {\n path: NodePath<t.MemberExpression>;\n resolvedChain: ResolvedChain;\n}\n\nexport interface RewriteSitesOptions {\n ast: t.File;\n sites: ExpressionSite[];\n cssBindingName: string;\n filename: string;\n debug: boolean;\n mapping: TrussMapping;\n maybeIncHelperName: string | null;\n mergePropsHelperName: string;\n needsMergePropsHelper: { current: boolean };\n trussPropsHelperName: string;\n needsTrussPropsHelper: { current: boolean };\n trussDebugInfoName: string;\n needsTrussDebugInfo: { current: boolean };\n runtimeLookupNames: Map<string, string>;\n}\n\n/**\n * Rewrite collected `Css...$` expression sites into Truss-native style hash objects.\n *\n * In the new model, each site becomes an ObjectExpression keyed by CSS property.\n * JSX `css=` attributes become `trussProps(hash)` or `mergeProps(className, style, hash)` spreads.\n * Non-JSX positions become plain object expressions.\n */\nexport function rewriteExpressionSites(options: RewriteSitesOptions): void {\n for (const site of options.sites) {\n const styleHash = buildStyleHashFromChain(site.resolvedChain, options);\n const cssAttrPath = getCssAttributePath(site.path);\n const line = site.path.node.loc?.start.line ?? null;\n\n if (cssAttrPath) {\n // JSX css= attribute → spread trussProps or mergeProps\n cssAttrPath.replaceWith(t.jsxSpreadAttribute(buildCssSpreadExpression(cssAttrPath, styleHash, line, options)));\n } else {\n // Non-JSX position → plain object expression with optional debug info\n if (options.debug && line !== null) {\n injectDebugInfo(styleHash, line, options);\n }\n site.path.replaceWith(styleHash);\n }\n }\n\n // Single pass: rewrite Css.props(...) calls and remaining css={...} attributes together\n rewriteCssPropsAndCssAttributes(options);\n}\n\n/**\n * Return the enclosing `css={...}` JSX attribute path for a transformed site,\n * or null when the site is in a non-`css` expression context.\n */\nfunction getCssAttributePath(path: NodePath<t.MemberExpression>): NodePath<t.JSXAttribute> | null {\n const parentPath = path.parentPath;\n if (!parentPath || !parentPath.isJSXExpressionContainer()) return null;\n\n const attrPath = parentPath.parentPath;\n if (!attrPath || !attrPath.isJSXAttribute()) return null;\n if (!t.isJSXIdentifier(attrPath.node.name, { name: \"css\" })) return null;\n\n return attrPath;\n}\n\n// ---------------------------------------------------------------------------\n// Building style hash objects from resolved chains\n// ---------------------------------------------------------------------------\n\n/** Build an ObjectExpression from a ResolvedChain, handling conditionals. */\nfunction buildStyleHashFromChain(chain: ResolvedChain, options: RewriteSitesOptions): t.ObjectExpression {\n const members: (t.ObjectProperty | t.SpreadElement)[] = [];\n const previousProperties = new Map<string, t.ObjectProperty>();\n\n if (chain.markers.length > 0) {\n const markerClasses = chain.markers.map(function (marker) {\n return markerClassName(marker.markerNode);\n });\n members.push(t.objectProperty(t.identifier(\"__marker\"), t.stringLiteral(markerClasses.join(\" \"))));\n }\n\n for (const part of chain.parts) {\n if (part.type === \"unconditional\") {\n const partMembers = buildStyleHashMembers(part.segments, options);\n members.push(...partMembers);\n for (const member of partMembers) {\n if (t.isObjectProperty(member)) {\n previousProperties.set(propertyName(member.key), member);\n }\n }\n } else {\n // Conditional: ...(cond ? { then } : { else })\n const thenMembers = mergeConditionalBranchMembers(\n buildStyleHashMembers(part.thenSegments, options),\n previousProperties,\n collectConditionalOnlyProps(part.thenSegments),\n );\n const elseMembers = mergeConditionalBranchMembers(\n buildStyleHashMembers(part.elseSegments, options),\n previousProperties,\n collectConditionalOnlyProps(part.elseSegments),\n );\n members.push(\n t.spreadElement(\n t.conditionalExpression(part.conditionNode, t.objectExpression(thenMembers), t.objectExpression(elseMembers)),\n ),\n );\n }\n }\n\n return t.objectExpression(members);\n}\n\n/**\n * Build ObjectExpression members from a list of segments.\n *\n * Normal segments are batched and processed by buildStyleHashProperties.\n * Special segments (styleArrayArg, typographyLookup) produce SpreadElements.\n */\nfunction buildStyleHashMembers(\n segments: ResolvedSegment[],\n options: RewriteSitesOptions,\n): (t.ObjectProperty | t.SpreadElement)[] {\n const members: (t.ObjectProperty | t.SpreadElement)[] = [];\n const normalSegs: ResolvedSegment[] = [];\n\n function flushNormal(): void {\n if (normalSegs.length > 0) {\n members.push(...buildStyleHashProperties(normalSegs, options.mapping, options.maybeIncHelperName));\n normalSegs.length = 0;\n }\n }\n\n for (const seg of segments) {\n if (seg.error) continue;\n\n if (seg.styleArrayArg) {\n flushNormal();\n if (seg.isAddCss && t.isObjectExpression(seg.styleArrayArg)) {\n members.push(...buildAddCssObjectMembers(seg.styleArrayArg));\n } else {\n members.push(t.spreadElement(seg.styleArrayArg as t.Expression));\n }\n continue;\n }\n\n if (seg.typographyLookup) {\n flushNormal();\n const lookupName = options.runtimeLookupNames.get(seg.typographyLookup.lookupKey);\n if (lookupName) {\n // I.e. `{ ...(__typography[key] ?? {}) }`\n const lookupAccess = t.memberExpression(\n t.identifier(lookupName),\n seg.typographyLookup.argNode as t.Expression,\n true,\n );\n members.push(t.spreadElement(t.logicalExpression(\"??\", lookupAccess, t.objectExpression([]))));\n }\n continue;\n }\n\n normalSegs.push(seg);\n }\n\n flushNormal();\n return members;\n}\n\nfunction buildAddCssObjectMembers(styleObject: t.ObjectExpression): (t.ObjectProperty | t.SpreadElement)[] {\n const members: (t.ObjectProperty | t.SpreadElement)[] = [];\n\n for (const property of styleObject.properties) {\n if (t.isSpreadElement(property)) {\n members.push(t.spreadElement(t.cloneNode(property.argument, true) as t.Expression));\n continue;\n }\n\n if (!t.isObjectProperty(property) || property.computed) {\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n continue;\n }\n\n const value = property.value;\n if (t.isIdentifier(value) || t.isMemberExpression(value) || t.isOptionalMemberExpression(value)) {\n members.push(\n t.spreadElement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.cloneNode(value, true), t.identifier(\"undefined\")),\n t.objectExpression([]),\n t.objectExpression([t.objectProperty(clonePropertyKey(property.key), t.cloneNode(value, true))]),\n ),\n ),\n );\n continue;\n }\n\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n }\n\n return members;\n}\n\n/**\n * Collect the set of CSS properties where ALL contributing segments have a condition\n * (pseudo-class, media query, pseudo-element, or when relationship).\n *\n * I.e. `onHover.white` → `color` is conditional-only (needs base merged in),\n * but `bgWhite` → `backgroundColor` is a plain replacement (should NOT merge).\n */\nfunction collectConditionalOnlyProps(segments: ResolvedSegment[]): Set<string> {\n const allProps = new Map<string, boolean>();\n for (const seg of segments) {\n if (seg.error || seg.styleArrayArg || seg.typographyLookup) continue;\n const hasCondition = !!(seg.pseudoClass || seg.mediaQuery || seg.pseudoElement || seg.whenPseudo);\n const props = seg.variableProps ?? Object.keys(seg.defs);\n for (const prop of props) {\n const current = allProps.get(prop);\n // If any segment for this property is unconditional, it's not conditional-only\n allProps.set(prop, current === undefined ? hasCondition : current && hasCondition);\n }\n }\n const result = new Set<string>();\n for (const [prop, isConditionalOnly] of allProps) {\n if (isConditionalOnly) result.add(prop);\n }\n return result;\n}\n\n/**\n * Merge prior base properties into conditional branch members, but only for\n * properties that are purely conditional (pseudo/media overlays). Plain\n * base-level replacements should NOT be merged — the spread will correctly\n * override the base when the condition is true.\n */\nfunction mergeConditionalBranchMembers(\n members: (t.ObjectProperty | t.SpreadElement)[],\n previousProperties: Map<string, t.ObjectProperty>,\n conditionalOnlyProps: Set<string>,\n): (t.ObjectProperty | t.SpreadElement)[] {\n return members.map(function (member) {\n if (!t.isObjectProperty(member)) {\n return member;\n }\n\n const prop = propertyName(member.key);\n const prior = previousProperties.get(prop);\n if (!prior || !conditionalOnlyProps.has(prop)) {\n return member;\n }\n\n return t.objectProperty(\n clonePropertyKey(member.key),\n mergePropertyValues(prior.value as t.Expression, member.value as t.Expression),\n );\n });\n}\n\nfunction mergePropertyValues(previousValue: t.Expression, currentValue: t.Expression): t.Expression {\n if (t.isStringLiteral(previousValue) && t.isStringLiteral(currentValue)) {\n return t.stringLiteral(`${previousValue.value} ${currentValue.value}`);\n }\n\n if (t.isStringLiteral(previousValue) && t.isArrayExpression(currentValue)) {\n return mergeTupleValue(currentValue, previousValue.value, true);\n }\n\n if (t.isArrayExpression(previousValue) && t.isStringLiteral(currentValue)) {\n return mergeTupleValue(previousValue, currentValue.value, false);\n }\n\n if (t.isArrayExpression(previousValue) && t.isArrayExpression(currentValue)) {\n const previousClassNames = tupleClassNames(previousValue);\n return mergeTupleValue(currentValue, previousClassNames, true, arrayElementExpression(previousValue.elements[1]));\n }\n\n return t.cloneNode(currentValue, true);\n}\n\nfunction mergeTupleValue(\n tuple: t.ArrayExpression,\n classNames: string,\n prependClassNames: boolean,\n previousVars?: t.Expression | null,\n): t.ArrayExpression {\n const currentClassNames = tupleClassNames(tuple);\n const mergedClassNames = prependClassNames\n ? `${classNames} ${currentClassNames}`\n : `${currentClassNames} ${classNames}`;\n const varsExpr = tuple.elements[1];\n const mergedVars =\n previousVars && arrayElementExpression(varsExpr)\n ? mergeVarsObject(previousVars, arrayElementExpression(varsExpr)!)\n : (arrayElementExpression(varsExpr) ?? previousVars ?? null);\n\n return t.arrayExpression([\n t.stringLiteral(mergedClassNames),\n mergedVars ? t.cloneNode(mergedVars, true) : t.objectExpression([]),\n ]);\n}\n\nfunction tupleClassNames(tuple: t.ArrayExpression): string {\n const classNames = tuple.elements[0];\n return t.isStringLiteral(classNames) ? classNames.value : \"\";\n}\n\nfunction arrayElementExpression(element: t.Expression | t.SpreadElement | null | undefined): t.Expression | null {\n return element && !t.isSpreadElement(element) ? element : null;\n}\n\nfunction mergeVarsObject(previousVars: t.Expression, currentVars: t.Expression): t.Expression {\n if (t.isObjectExpression(previousVars) && t.isObjectExpression(currentVars)) {\n return t.objectExpression([\n ...previousVars.properties.map(function (property) {\n return t.cloneNode(property, true);\n }),\n ...currentVars.properties.map(function (property) {\n return t.cloneNode(property, true);\n }),\n ]);\n }\n\n return t.cloneNode(currentVars, true);\n}\n\nfunction propertyName(key: t.Expression | t.Identifier | t.PrivateName): string {\n if (t.isIdentifier(key)) {\n return key.name;\n }\n if (t.isStringLiteral(key)) {\n return key.value;\n }\n return generate(key).code;\n}\n\nfunction clonePropertyKey(key: t.Expression | t.Identifier | t.PrivateName): t.Expression | t.Identifier {\n if (t.isPrivateName(key)) {\n return t.identifier(key.id.name);\n }\n return t.cloneNode(key, true);\n}\n\n// ---------------------------------------------------------------------------\n// Debug info injection\n// ---------------------------------------------------------------------------\n\n/**\n * Inject debug info into the first property of a style hash ObjectExpression.\n *\n * For static values, promotes `\"df\"` to `[\"df\", new TrussDebugInfo(\"...\")]`.\n * For variable tuples, appends the debug info as a third element.\n */\nfunction injectDebugInfo(\n expr: t.ObjectExpression,\n line: number,\n options: Pick<RewriteSitesOptions, \"debug\" | \"trussDebugInfoName\" | \"needsTrussDebugInfo\" | \"filename\">,\n): void {\n if (!options.debug) return;\n\n // Find the first real style property (skip SpreadElements and __marker metadata)\n const firstProp = expr.properties.find(function (p) {\n return (\n t.isObjectProperty(p) &&\n !(\n (t.isIdentifier(p.key) && p.key.name === \"__marker\") ||\n (t.isStringLiteral(p.key) && p.key.value === \"__marker\")\n )\n );\n }) as t.ObjectProperty | undefined;\n if (!firstProp) return;\n\n options.needsTrussDebugInfo.current = true;\n const debugExpr = t.newExpression(t.identifier(options.trussDebugInfoName), [\n t.stringLiteral(`${options.filename}:${line}`),\n ]);\n\n if (t.isStringLiteral(firstProp.value)) {\n // Static: \"df\" → [\"df\", new TrussDebugInfo(\"...\")]\n firstProp.value = t.arrayExpression([firstProp.value, debugExpr]);\n } else if (t.isArrayExpression(firstProp.value)) {\n // Variable tuple: [\"mt_var\", { vars }] → [\"mt_var\", { vars }, new TrussDebugInfo(\"...\")]\n firstProp.value.elements.push(debugExpr);\n }\n}\n\n// ---------------------------------------------------------------------------\n// JSX css= attribute handling\n// ---------------------------------------------------------------------------\n\n/** Build the spread expression for a JSX `css=` attribute. */\nfunction buildCssSpreadExpression(\n path: NodePath<t.JSXAttribute>,\n styleHash: t.Expression,\n line: number | null,\n options: RewriteSitesOptions,\n): t.Expression {\n const existingClassNameExpr = removeExistingAttribute(path, \"className\");\n const existingStyleExpr = removeExistingAttribute(path, \"style\");\n\n if (!existingClassNameExpr && !existingStyleExpr) {\n return buildPropsCall(styleHash, line, options);\n }\n\n // mergeProps(className, style, hash)\n options.needsMergePropsHelper.current = true;\n\n if (options.debug && line !== null) {\n injectDebugInfo(styleHash as t.ObjectExpression, line, options);\n }\n\n return t.callExpression(t.identifier(options.mergePropsHelperName), [\n existingClassNameExpr ?? t.identifier(\"undefined\"),\n existingStyleExpr ?? t.identifier(\"undefined\"),\n styleHash,\n ]);\n}\n\n/** Emit `trussProps(hash)` call. In debug mode, injects debug info into the hash first. */\nfunction buildPropsCall(styleHash: t.Expression, line: number | null, options: RewriteSitesOptions): t.CallExpression {\n options.needsTrussPropsHelper.current = true;\n\n if (options.debug && line !== null && t.isObjectExpression(styleHash)) {\n injectDebugInfo(styleHash, line, options);\n }\n\n return t.callExpression(t.identifier(options.trussPropsHelperName), [styleHash]);\n}\n\n/** Remove a sibling JSX attribute and return its expression. */\nfunction removeExistingAttribute(path: NodePath<t.JSXAttribute>, attrName: string): t.Expression | null {\n const openingElement = path.parentPath;\n if (!openingElement || !openingElement.isJSXOpeningElement()) return null;\n\n const attrs = openingElement.node.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs[i];\n if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name, { name: attrName })) continue;\n\n let expr: t.Expression | null = null;\n if (t.isStringLiteral(attr.value)) {\n expr = attr.value;\n } else if (t.isJSXExpressionContainer(attr.value) && t.isExpression(attr.value.expression)) {\n expr = attr.value.expression;\n }\n\n attrs.splice(i, 1);\n return expr;\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Combined pass: Css.props(...) rewriting + remaining css={...} attributes\n// ---------------------------------------------------------------------------\n\n/**\n * Single traversal that rewrites both `Css.props(expr)` calls and remaining\n * `css={expr}` JSX attributes, avoiding two separate full-AST passes.\n */\nfunction rewriteCssPropsAndCssAttributes(options: RewriteSitesOptions): void {\n traverse(options.ast, {\n // -- Css.props(expr) → trussProps(expr) or mergeProps(...) --\n CallExpression(path: NodePath<t.CallExpression>) {\n if (!isCssPropsCall(path.node, options.cssBindingName)) return;\n\n const arg = path.node.arguments[0];\n if (!arg || t.isSpreadElement(arg) || !t.isExpression(arg) || path.node.arguments.length !== 1) return;\n\n options.needsTrussPropsHelper.current = true;\n\n // Check for a sibling `className` property in the parent object literal\n const classNameExpr = extractSiblingClassName(path);\n if (classNameExpr) {\n options.needsMergePropsHelper.current = true;\n path.replaceWith(\n t.callExpression(t.identifier(options.mergePropsHelperName), [classNameExpr, t.identifier(\"undefined\"), arg]),\n );\n } else {\n path.replaceWith(t.callExpression(t.identifier(options.trussPropsHelperName), [arg]));\n }\n },\n // -- Remaining css={expr} JSX attributes → {...trussProps(expr)} spreads --\n // I.e. css={someVariable}, css={{ ...a, ...b }}, css={cond ? a : b}\n JSXAttribute(path: NodePath<t.JSXAttribute>) {\n if (!t.isJSXIdentifier(path.node.name, { name: \"css\" })) return;\n const value = path.node.value;\n if (!t.isJSXExpressionContainer(value)) return;\n if (!t.isExpression(value.expression)) return;\n\n const expr = value.expression;\n\n const existingClassNameExpr = removeExistingAttribute(path, \"className\");\n const existingStyleExpr = removeExistingAttribute(path, \"style\");\n\n if (existingClassNameExpr || existingStyleExpr) {\n options.needsMergePropsHelper.current = true;\n path.replaceWith(\n t.jsxSpreadAttribute(\n t.callExpression(t.identifier(options.mergePropsHelperName), [\n existingClassNameExpr ?? t.identifier(\"undefined\"),\n existingStyleExpr ?? t.identifier(\"undefined\"),\n expr,\n ]),\n ),\n );\n } else {\n options.needsTrussPropsHelper.current = true;\n path.replaceWith(t.jsxSpreadAttribute(t.callExpression(t.identifier(options.trussPropsHelperName), [expr])));\n }\n },\n });\n}\n\n// ---------------------------------------------------------------------------\n// Utility helpers\n// ---------------------------------------------------------------------------\n\n/** Match `Css.props(...)` calls. */\nfunction isCssPropsCall(expr: t.CallExpression, cssBindingName: string): boolean {\n return (\n t.isMemberExpression(expr.callee) &&\n !expr.callee.computed &&\n t.isIdentifier(expr.callee.object, { name: cssBindingName }) &&\n t.isIdentifier(expr.callee.property, { name: \"props\" })\n );\n}\n\n/**\n * If `...Css.props(...)` is spread inside an object literal that has a sibling\n * `className` property, extract and remove that property so the rewrite can\n * merge it via `mergeProps`.\n */\nfunction extractSiblingClassName(callPath: NodePath<t.CallExpression>): t.Expression | null {\n // Walk up: CallExpression → SpreadElement → ObjectExpression\n const spreadPath = callPath.parentPath;\n if (!spreadPath || !spreadPath.isSpreadElement()) return null;\n const objectPath = spreadPath.parentPath;\n if (!objectPath || !objectPath.isObjectExpression()) return null;\n\n const properties = objectPath.node.properties;\n for (let i = 0; i < properties.length; i++) {\n const prop = properties[i];\n if (!t.isObjectProperty(prop)) continue;\n if (!isMatchingPropertyName(prop.key, \"className\")) continue;\n if (!t.isExpression(prop.value)) continue;\n\n const classNameExpr = prop.value;\n properties.splice(i, 1);\n return classNameExpr;\n }\n\n return null;\n}\n\n/** Match static object property names. */\nfunction isMatchingPropertyName(key: t.Expression | t.Identifier | t.PrivateName, name: string): boolean {\n return (t.isIdentifier(key) && key.name === name) || (t.isStringLiteral(key) && key.value === name);\n}\n","import { parse } from \"@babel/parser\";\nimport * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport { resolveFullChain } from \"./resolve-chain\";\nimport { extractChain, findCssImportBinding } from \"./ast-utils\";\nimport { collectStaticStringBindings, resolveStaticString } from \"./css-ts-utils\";\nimport { camelToKebab } from \"./emit-truss\";\n\n/**\n * Transform a `.css.ts` file into a plain CSS string.\n *\n * The file is expected to have the shape:\n * ```ts\n * import { Css } from \"./Css\";\n * export const css = {\n * \".some-selector\": Css.df.blue.$,\n * \".other > .selector\": Css.mt(2).black.$,\n * };\n * ```\n *\n * Each key is a CSS selector (string literal), each value is a `Css.*.$` chain.\n * The chains are resolved via the truss mapping into concrete CSS declarations.\n *\n * Returns the generated CSS string.\n */\nexport function transformCssTs(code: string, filename: string, mapping: TrussMapping): string {\n const ast = parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n });\n\n const cssBindingName = findCssImportBinding(ast);\n if (!cssBindingName) {\n return `/* [truss] ${filename}: no Css import found */\\n`;\n }\n\n // Find the `export const css = { ... }` expression\n const cssExport = findNamedCssExportObject(ast);\n if (!cssExport) {\n return `/* [truss] ${filename}: expected \\`export const css = { ... }\\` with an object literal */\\n`;\n }\n\n const rules: string[] = [];\n const stringBindings = collectStaticStringBindings(ast);\n\n for (const prop of cssExport.properties) {\n if (t.isSpreadElement(prop)) {\n rules.push(`/* [truss] unsupported: spread elements in css.ts export */`);\n continue;\n }\n\n if (!t.isObjectProperty(prop)) {\n rules.push(`/* [truss] unsupported: non-property in css.ts export */`);\n continue;\n }\n\n // Key must be a string literal (the CSS selector)\n const selector = objectPropertyStringKey(prop, stringBindings);\n if (selector === null) {\n rules.push(`/* [truss] unsupported: non-string-literal key in css.ts export */`);\n continue;\n }\n\n // Value must be a Css.*.$ expression\n const valueNode = prop.value;\n if (!t.isExpression(valueNode)) {\n rules.push(`/* [truss] unsupported: \"${selector}\" value is not an expression */`);\n continue;\n }\n\n const cssResult = resolveCssExpression(valueNode, cssBindingName, mapping, filename);\n if (\"error\" in cssResult) {\n rules.push(`/* [truss] unsupported: \"${selector}\" — ${cssResult.error} */`);\n continue;\n }\n\n rules.push(formatCssRule(selector, cssResult.declarations));\n }\n\n return rules.join(\"\\n\\n\") + \"\\n\";\n}\n\n/** Find the object expression in `export const css = { ... }`. */\nfunction findNamedCssExportObject(ast: t.File): t.ObjectExpression | null {\n for (const node of ast.program.body) {\n if (!t.isExportNamedDeclaration(node) || !node.declaration) continue;\n if (!t.isVariableDeclaration(node.declaration)) continue;\n\n for (const declarator of node.declaration.declarations) {\n if (!t.isIdentifier(declarator.id, { name: \"css\" })) continue;\n const value = unwrapObjectExpression(declarator.init);\n if (value) return value;\n }\n }\n return null;\n}\n\nfunction unwrapObjectExpression(node: t.Expression | null | undefined): t.ObjectExpression | null {\n if (!node) return null;\n if (t.isObjectExpression(node)) return node;\n if (t.isTSAsExpression(node) || t.isTSSatisfiesExpression(node)) return unwrapObjectExpression(node.expression);\n return null;\n}\n\n/** Extract a static string key from an ObjectProperty. */\nfunction objectPropertyStringKey(prop: t.ObjectProperty, stringBindings: Map<string, string>): string | null {\n if (t.isStringLiteral(prop.key)) return prop.key.value;\n // Allow unquoted identifiers as keys too (e.g. `body: Css.df.$`)\n if (t.isIdentifier(prop.key) && !prop.computed) return prop.key.name;\n if (prop.computed) return resolveStaticString(prop.key, stringBindings);\n return null;\n}\n\ninterface CssResolution {\n declarations: Array<{ property: string; value: string }>;\n error?: undefined;\n}\ninterface CssError {\n declarations?: undefined;\n error: string;\n}\n\n/**\n * Resolve a `Css.*.$` expression node to CSS declarations.\n *\n * Validates that the chain only uses static/literal patterns (no variable args,\n * no if/else conditionals, no pseudo/media modifiers).\n */\nfunction resolveCssExpression(\n node: t.Expression,\n cssBindingName: string,\n mapping: TrussMapping,\n filename: string,\n): CssResolution | CssError {\n // The expression must end with `.$`\n if (!t.isMemberExpression(node) || node.computed || !t.isIdentifier(node.property, { name: \"$\" })) {\n return { error: \"value must be a Css.*.$ expression\" };\n }\n\n const chain = extractChain(node.object, cssBindingName);\n if (!chain) {\n return { error: \"could not extract Css chain from expression\" };\n }\n\n // Validate: no if/else nodes\n for (const n of chain) {\n if (n.type === \"if\") return { error: \"if() conditionals are not supported in .css.ts files\" };\n if (n.type === \"else\") return { error: \"else is not supported in .css.ts files\" };\n }\n\n const resolved = resolveFullChain(chain, mapping);\n\n // Check for errors from resolution\n if (resolved.errors.length > 0) {\n return { error: resolved.errors[0] };\n }\n\n // Validate: no conditionals came back\n for (const part of resolved.parts) {\n if (part.type === \"conditional\") {\n return { error: \"conditional chains are not supported in .css.ts files\" };\n }\n }\n\n // Collect all declarations from all unconditional parts\n const declarations: Array<{ property: string; value: string }> = [];\n\n for (const part of resolved.parts) {\n if (part.type !== \"unconditional\") continue;\n for (const seg of part.segments) {\n if (seg.error) {\n return { error: seg.error };\n }\n\n // Reject segments that require runtime (variable with variable args)\n if (seg.variableProps && !seg.argResolved) {\n return { error: `variable value with variable argument is not supported in .css.ts files` };\n }\n if (seg.typographyLookup) {\n return { error: `typography() with a runtime key is not supported in .css.ts files` };\n }\n if (seg.styleArrayArg) {\n return { error: `add(cssProp) is not supported in .css.ts files` };\n }\n\n // Reject segments with media query / pseudo-class / pseudo-element / when modifiers\n if (seg.mediaQuery) {\n return { error: `media query modifiers (ifSm, ifMd, etc.) are not supported in .css.ts files` };\n }\n if (seg.pseudoClass) {\n return { error: `pseudo-class modifiers (onHover, onFocus, etc.) are not supported in .css.ts files` };\n }\n if (seg.pseudoElement) {\n return { error: `pseudo-element modifiers are not supported in .css.ts files` };\n }\n if (seg.whenPseudo) {\n return { error: `when() modifiers are not supported in .css.ts files` };\n }\n\n // Extract CSS property/value pairs from defs\n for (const [prop, value] of Object.entries(seg.defs)) {\n if (typeof value === \"string\" || typeof value === \"number\") {\n declarations.push({ property: camelToKebab(prop), value: String(value) });\n } else {\n // Nested condition objects (shouldn't happen after our validation, but defensive)\n return { error: `unexpected nested value for property \"${prop}\"` };\n }\n }\n }\n }\n\n return { declarations };\n}\n\n/** Format a CSS rule block. */\nfunction formatCssRule(selector: string, declarations: Array<{ property: string; value: string }>): string {\n if (declarations.length === 0) {\n return `${selector} {}`;\n }\n const body = declarations.map((d) => ` ${d.property}: ${d.value};`).join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n","import * as t from \"@babel/types\";\n\n/** Resolve module-scope string constants so .css.ts selectors can reuse them. */\nexport function collectStaticStringBindings(ast: t.File): Map<string, string> {\n const bindings = new Map<string, string>();\n let changed = true;\n\n while (changed) {\n changed = false;\n\n for (const node of ast.program.body) {\n const declaration = getTopLevelVariableDeclaration(node);\n if (!declaration) continue;\n\n for (const declarator of declaration.declarations) {\n if (!t.isIdentifier(declarator.id) || !declarator.init) continue;\n if (bindings.has(declarator.id.name)) continue;\n\n const value = resolveStaticString(declarator.init, bindings);\n if (value === null) continue;\n\n bindings.set(declarator.id.name, value);\n changed = true;\n }\n }\n }\n\n return bindings;\n}\n\n/** Resolve a static string expression from a literal, template, or identifier. */\nexport function resolveStaticString(node: t.Node | null | undefined, bindings: Map<string, string>): string | null {\n if (!node) return null;\n\n if (t.isStringLiteral(node)) return node.value;\n\n if (t.isTemplateLiteral(node)) {\n let value = \"\";\n for (let i = 0; i < node.quasis.length; i++) {\n value += node.quasis[i].value.cooked ?? \"\";\n if (i >= node.expressions.length) continue;\n\n const expressionValue = resolveStaticString(node.expressions[i], bindings);\n if (expressionValue === null) return null;\n value += expressionValue;\n }\n return value;\n }\n\n if (t.isIdentifier(node)) {\n return bindings.get(node.name) ?? null;\n }\n\n if (t.isTSAsExpression(node) || t.isTSSatisfiesExpression(node) || t.isTSNonNullExpression(node)) {\n return resolveStaticString(node.expression, bindings);\n }\n\n if (t.isParenthesizedExpression(node)) {\n return resolveStaticString(node.expression, bindings);\n }\n\n if (t.isBinaryExpression(node, { operator: \"+\" })) {\n const left = resolveStaticString(node.left, bindings);\n const right = resolveStaticString(node.right, bindings);\n if (left === null || right === null) return null;\n return left + right;\n }\n\n return null;\n}\n\nfunction getTopLevelVariableDeclaration(node: t.Statement): t.VariableDeclaration | null {\n if (t.isVariableDeclaration(node)) {\n return node;\n }\n\n if (t.isExportNamedDeclaration(node) && node.declaration && t.isVariableDeclaration(node.declaration)) {\n return node.declaration;\n }\n\n return null;\n}\n","import { parse } from \"@babel/parser\";\nimport _generate from \"@babel/generator\";\nimport * as t from \"@babel/types\";\nimport { findLastImportIndex } from \"./ast-utils\";\n\n// Babel generator is published as CJS, so normalize default interop before using it.\nconst generate = ((_generate as unknown as { default?: typeof _generate }).default ?? _generate) as typeof _generate;\n\nexport interface RewriteCssTsImportsResult {\n code: string;\n changed: boolean;\n}\n\n/**\n * Rewrite `.css.ts` imports so runtime imports stay pointed at the real module,\n * while a separate `?truss-css` side-effect import is added for generated CSS.\n *\n * I.e. `import { foo } from \"./App.css.ts\"` becomes:\n * - `import { foo } from \"./App.css.ts\"`\n * - `import \"./App.css.ts?truss-css\"`\n *\n * Pure side-effect imports are rewritten directly to the virtual CSS import.\n */\nexport function rewriteCssTsImports(code: string, filename: string): RewriteCssTsImportsResult {\n if (!code.includes(\".css.ts\")) {\n return { code, changed: false };\n }\n\n const ast = parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n });\n\n const existingCssSideEffects = new Set<string>();\n const neededCssSideEffects = new Set<string>();\n let changed = false;\n\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n if (typeof node.source.value !== \"string\") continue;\n if (!node.source.value.endsWith(\".css.ts\")) continue;\n\n if (node.specifiers.length === 0) {\n node.source = t.stringLiteral(toVirtualCssSpecifier(node.source.value));\n existingCssSideEffects.add(node.source.value);\n changed = true;\n continue;\n }\n\n neededCssSideEffects.add(toVirtualCssSpecifier(node.source.value));\n }\n\n const sideEffectImports: t.ImportDeclaration[] = [];\n for (const source of neededCssSideEffects) {\n if (existingCssSideEffects.has(source)) continue;\n sideEffectImports.push(t.importDeclaration([], t.stringLiteral(source)));\n changed = true;\n }\n\n if (!changed) {\n return { code, changed: false };\n }\n\n if (sideEffectImports.length > 0) {\n const insertIndex = findLastImportIndex(ast) + 1;\n ast.program.body.splice(insertIndex, 0, ...sideEffectImports);\n }\n\n const output = generate(ast, {\n sourceFileName: filename,\n retainLines: false,\n });\n return { code: output.code, changed: true };\n}\n\nfunction toVirtualCssSpecifier(source: string): string {\n return `${source}?truss-css`;\n}\n"],"mappings":";AAAA,SAAS,cAAc,eAAe,kBAAkB;AACxD,SAAS,SAAS,SAAS,YAAY,YAAY;;;ACDnD,YAAY,OAAO;;;ACWnB,IAAM,mBAAmB,oBAAI,IAAY;AAEzC,IAAM,kBAAkB,oBAAI,IAAY;AAExC,IAAM,wBAAwB,oBAAI,IAAY;AAE9C,IAAM,yBAAyB,oBAAI,IAAY;AAM/C,gBAAgB,IAAI,uBAAuB;AAC3C,gBAAgB,IAAI,WAAW;AAC/B,gBAAgB,IAAI,gBAAgB;AAGpC,uBAAuB,IAAI,WAAW;AACtC,gBAAgB,IAAI,uBAAuB;AAC3C,gBAAgB,IAAI,iBAA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AO,QAAQ,MAAM,CAAC;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,UAA2B;AACpD,SAAO,cAAc,QAAQ,EAAE,SAAS,gBAAgB;AAC1D;AAEA,SAAS,iCAAiC,UAAkB,kBAAqC;AAC/F,QAAM,iBAAiB,cAAc,QAAQ;AAC7C,SAAO,iBAAiB,KAAK,SAAU,KAAK;AAC1C,WAAO,eAAe,SAAS,iBAAiB,GAAG,GAAG;AAAA,EACxD,CAAC;AACH;AAEA,SAAS,cAAc,MAAsB;AAC3C,SAAO,KAAK,QAAQ,OAAO,GAAG;AAChC;AAGO,SAAS,YAAY,MAA4B;AACtD,QAAM,MAAM,aAAa,MAAM,MAAM;AACrC,SAAO,KAAK,MAAM,GAAG;AACvB;","names":["_traverse","_generate","t","pseudoArg","t","t","traverse","_traverse","generate","_generate","parse","t","t","parse","parse","_generate","t","generate","_generate","parse"]}
|