(value: string)
| 933 | } |
| 934 | |
| 935 | export function canonicalizeVarName(value: string): string | null { |
| 936 | if (!value) return null |
| 937 | const cleaned = stripFallback(preprocessCssValue(value)).trim() |
| 938 | |
| 939 | if (cleaned.startsWith('var(') && cleaned.endsWith(')')) { |
| 940 | // stripFallback() guarantees we have no comma at top-level. |
| 941 | let inner = cleaned.slice(4, -1).trim() |
| 942 | if (inner.startsWith('--')) { |
| 943 | inner = inner.slice(2).trim() |
| 944 | return normalizeCustomPropertyName(inner) |
| 945 | } |
| 946 | return null |
| 947 | } |
| 948 | |
| 949 | if (cleaned.startsWith('--')) { |
| 950 | return normalizeCustomPropertyName(cleaned) |
| 951 | } |
| 952 | |
| 953 | return null |
| 954 | } |
| 955 | |
| 956 | export function toVarExpr(name: string): string { |
| 957 | return `var(${normalizeCustomPropertyName(name)})` |
no test coverage detected