All files / html / mod.ts

100.00% Branches 1/1
100.00% Lines 12/12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
x8
 
 
 
x8
x8
x8
x8
x10
x11
x11
x11
x10
x8
 
 
x8















// Imports
import { type Directive, Phase } from "@mizu/internal/engine"
export type * from "@mizu/internal/engine"

/** `*html` directive. */
export const _html = {
  name: "*html",
  phase: Phase.CONTENT,
  async execute(renderer, element, { attributes: [attribute], ...options }) {
    if (!renderer.isHtmlElement(element)) {
      return
    }
    element.innerHTML = `${await renderer.evaluate(element, attribute.value, options)}`
  },
} as Directive & { default: NonNullable<Directive["default"]> }

/** Default exports. */
export default _html