@endeavorance/palette
    Preparing search index...

    Class Template

    Helper class for managing HTML templates.

    Wraps an HTMLTemplateElement to provide rendering and element factory utilities.

    Constructors

    Accessors

    • get raw(): HTMLTemplateElement

      A reference to the wrapped HTMLTemplateElement

      Returns HTMLTemplateElement

    Methods

    • Create an element with the template contents rendered as its children

      Type Parameters

      • TagName extends keyof HTMLElementTagNameMap

      Parameters

      • tagName: TagName

        The HTML tag name of the root element to create

      • Optionalattrs: AttributeRecord | Attributes

        Optional attriubutes to apply to the root element

      • Optionalcontext: TemplateContext

        Optional context object for template value lookups

      Returns HTMLElementTagNameMap[TagName]

      If no context is provided, the root element is used as the context, which allows for accessing nested properties of the host element itself.

    • Render this template into a target host element.

      Parameters

      Returns void

      If no context is provided, the root element is used as the context, which allows for accessing nested properties of the host element itself.

    • Wrap an HTMLElement into a Template. If the element is a