meo-canvas
    Preparing search index...

    Interface SceneNode

    One node of the tree.

    Every field is present on every node, undefined where it does not apply, and always in this order. That is not tidiness: a node that sometimes carries src and sometimes does not gives V8 two hidden classes for one shape, and every property read in the encoder deoptimises to a megamorphic lookup. One shape, one hidden class, and the encoder's reads stay inline.

    The factories are the only thing that should build one, for that reason — an object literal written by hand is one key order away from a second class.

    interface SceneNode {
        children: readonly SceneNode[] | undefined;
        d: string | undefined;
        kind: NodeKind;
        markup: string | undefined;
        name: string | undefined;
        paragraph: ParagraphOptions | undefined;
        segments: readonly TextSegment[] | undefined;
        src: ImageSource | undefined;
        style: Style | undefined;
    }
    Index
    children: readonly SceneNode[] | undefined

    Its children, in paint order before zIndex applies.

    d: string | undefined

    A path node's SVG d attribute.

    kind: NodeKind

    What this node draws.

    markup: string | undefined

    A text node's content as markup, to be parsed by the renderer.

    Set by Text and left undefined by RichText, which is how the two are told apart on the wire: rich text of one run is otherwise byte-identical to plain text of one run, and the decoder would have to guess. Parse everything and RichText can no longer carry a literal <; parse nothing and a caller gets no rich text at all.

    name: string | undefined

    A name carried through for diagnostics, which the renderer never reads.

    paragraph: ParagraphOptions | undefined

    A text node's paragraph properties, which are not style and do not inherit.

    Separate from SceneNode.style because the scene keeps them separate: maxLines and ellipsis describe the block, not the glyphs, and nothing inherits them from a parent.

    segments: readonly TextSegment[] | undefined

    The runs of a text node, built by the caller and not interpreted.

    src: ImageSource | undefined

    Where an image node's bytes come from.

    style: Style | undefined

    How it is styled, or undefined for a node that sets nothing.