class / @typed/template/Template

SparseAttrNode

Represents a sparse attribute (e.g. class="foo ${bar}").

Package version
1.0.0-beta.7
Category
Sparse attributes
Since
1.0.0

Import

import { SparseAttrNode } from "@typed/template/Template";

Signatures

export declare class SparseAttrNode {
    readonly _tag: "sparse-attr";
    readonly name: string;
    readonly nodes: Array<AttrPartNode | TextNode>;
    constructor(name: string, nodes: Array<AttrPartNode | TextNode>);
}

Why

Static and dynamic segments remain ordered under one native attribute target.

Ownership and lifetime

The model owns its segment array; the renderer Scope owns the live updater.

Constructor

Creates sparse attribute syntax.

Property: _tag

Sparse-attribute discriminant.

Property: _tag: Why

Selects ordered segment joining under attribute escaping.

Property: _tag: Ownership and lifetime

Immutable AST metadata.

Property: name

Native attribute name.

Property: name: Why

Identifies the direct attribute target for one interpolation.

Property: name: Ownership and lifetime

Retained string metadata.

Property: nodes

Ordered literal and dynamic segments.

Property: nodes: Why

Reconstructs one attribute value from its authored order.

Property: nodes: Ownership and lifetime

Retained AST array; mounted parts own live inputs.

Examples

import { SparseAttrNode } from "@typed/template/Template"

const node = new SparseAttrNode("title", [])

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source