(node: RootNode | TemplateChildNode)
| 36 | } |
| 37 | |
| 38 | function injectCssVars(node: RootNode | TemplateChildNode) { |
| 39 | if ( |
| 40 | node.type === NodeTypes.ELEMENT && |
| 41 | (node.tagType === ElementTypes.ELEMENT || |
| 42 | node.tagType === ElementTypes.COMPONENT) && |
| 43 | !findDir(node, 'for') |
| 44 | ) { |
| 45 | if (node.tag === 'suspense' || node.tag === 'Suspense') { |
| 46 | for (const child of node.children) { |
| 47 | if ( |
| 48 | child.type === NodeTypes.ELEMENT && |
| 49 | child.tagType === ElementTypes.TEMPLATE |
| 50 | ) { |
| 51 | // suspense slot |
| 52 | child.children.forEach(injectCssVars) |
| 53 | } else { |
| 54 | injectCssVars(child) |
| 55 | } |
| 56 | } |
| 57 | } else { |
| 58 | node.props.push({ |
| 59 | type: NodeTypes.DIRECTIVE, |
| 60 | name: 'bind', |
| 61 | arg: undefined, |
| 62 | exp: createSimpleExpression(`_cssVars`, false), |
| 63 | modifiers: [], |
| 64 | loc: locStub, |
| 65 | }) |
| 66 | } |
| 67 | } |
| 68 | } |
no test coverage detected