Module / v1.0.0-beta.7

@typed/template/Wire

21 unique exports available through this public import path, including their members and aliases.

import * as Wire from "@typed/template/Wire";

DOM serialization

  • toHtml

    function

    Converts a Rendered value to an HTML string.

Existing range boundaries

  • fromComments

    variable

    Creates a published advanced Wire from a fragment and exact boundary comments.

Native element recognition

  • isElement

    function

    Checks if a rendered node is an Element.

  • isHtmlElement

    function

    Checks if a rendered node is an HTMLElement.

  • isSvgElement

    function

    Checks if a rendered node is an SVGElement.

Native node recognition

  • isAttr

    function

    Checks if a rendered node is an Attr node.

  • isComment

    function

    Checks if a rendered node is a Comment node.

  • isDocumentFragment

    function

    Checks if a rendered node is a DocumentFragment.

  • isNode

    function

    Checks if a rendered node is a standard DOM Node.

  • isText

    function

    Checks if a rendered node is a Text node.

Native output shapes

  • Rendered

    type-alias

    A union type representing all possible rendered values. Can be a single Node, a DocumentFragment, a Wire, or an array of these.

  • Rendered.Elements

    type-alias

    Extract the elements from a Rendered type

  • Rendered.Value

    type-alias

    Single rendered value type.

  • Rendered.Values

    type-alias

    Extract the values from a Rendered type

Output collection recognition

  • isArray

    function

    Checks if a rendered value is an array of nodes.

Persistent DOM ranges

  • Wire

    interface

    Wire is a data type that serves as a persistent, reusable DocumentFragment.

    Unlike a standard DocumentFragment, which empties itself when appended to the DOM, a Wire retains references to its child nodes. This allows it to be moved around the DOM or updated without losing track of its content.

    It is used internally to manage the lifecycle of template instances.

  • persistent

    variable

    Creates a Wire from a DocumentFragment.

    If the fragment has only one child, that child is returned directly. If it has multiple children, they are wrapped in a Wire structure (bounded by comments) to allow them to be treated as a single unit.

Range recognition

  • isWire

    function

    Checks if a rendered node is a Wire.

Range reconciliation

  • diffable

    variable

    Creates the advanced node adapter used by local DOM reconciliation.

Range traversal

  • getAllSiblingsBetween

    function

    Gets all sibling nodes between exact range boundaries, excluding both markers.

Rendered element traversal

  • getElements

    function

    Extracts all Elements from a Rendered value.