| 90 | } |
| 91 | |
| 92 | function extractVariables(block: string): Map<string, string> { |
| 93 | const variables = new Map<string, string>(); |
| 94 | for (const match of block.matchAll(/(--[\w-]+)\s*:\s*([^;]+);/g)) { |
| 95 | const variable = match[1]; |
| 96 | const value = match[2]; |
| 97 | if (variable === undefined || value === undefined) { |
| 98 | continue; |
| 99 | } |
| 100 | variables.set(variable, value.trim()); |
| 101 | } |
| 102 | return variables; |
| 103 | } |
| 104 | |
| 105 | function extractEffectiveBlock(css: string, selector: string): string | null { |
| 106 | const block = extractBlock(css, selector); |