( vars: string[], id: string, isProd: boolean, isSSR = false, )
| 15 | export const CSS_VARS_HELPER = `useCssVars` |
| 16 | |
| 17 | export function genCssVarsFromList( |
| 18 | vars: string[], |
| 19 | id: string, |
| 20 | isProd: boolean, |
| 21 | isSSR = false, |
| 22 | ): string { |
| 23 | return `{\n ${vars |
| 24 | .map( |
| 25 | key => |
| 26 | // The `:` prefix here is used in `ssrRenderStyle` to distinguish whether |
| 27 | // a custom property comes from `ssrCssVars`. If it does, we need to reset |
| 28 | // its value to `initial` on the component instance to avoid unintentionally |
| 29 | // inheriting the same property value from a different instance of the same |
| 30 | // component in the outer scope. |
| 31 | `"${isSSR ? `:--` : ``}${genVarName(id, key, isProd, isSSR)}": (${key})`, |
| 32 | ) |
| 33 | .join(',\n ')}\n}` |
| 34 | } |
| 35 | |
| 36 | function genVarName( |
| 37 | id: string, |
no test coverage detected