All files / src/render/dom create-visual-element.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  33x 33x   33x   33x   33x       671x        
import { ComponentType } from "react"
import { htmlVisualElement } from "../html/visual-element"
import { svgVisualElement } from "../svg/visual-element"
import { CreateVisualElement, VisualElementOptions } from "../types"
import { isSVGComponent } from "./utils/is-svg-component"
 
export const createDomVisualElement: CreateVisualElement<
    HTMLElement | SVGElement
> = (
    Component: string | ComponentType,
    options: VisualElementOptions<HTMLElement | SVGElement>
) => {
    return isSVGComponent(Component)
        ? svgVisualElement(options, { enableHardwareAcceleration: false })
        : htmlVisualElement(options, { enableHardwareAcceleration: true })
}