BIM.works SDKs - v3.0.0-b.115
    Preparing search index...

    Interface TemplateSpec<D>

    interface TemplateSpec<D> {
        compactSize?: [width: number, height: number];
        css?: string;
        defaults?: Partial<AnnotationLayerOptions<D>>;
        expandable?: boolean;
        fields?: Record<string, string>;
        hover?: "template" | "lift";
        kind?: "html" | "svg";
        name: string;
        origin?: [x: number, y: number];
        refreshMs?: number;
        expands?(data: D): boolean;
        label?(data: D): string;
        priority?(data: D): number;
        render(
            data: D,
            ctx: TemplateContext,
        ): string | Node | TemplateResult | null;
        status?(data: D): { color: string; label: string } | null;
    }

    Type Parameters

    • D
    Index

    Properties

    compactSize?: [width: number, height: number]

    The compact state's size in CSS pixels when it is fixed: never measured. Required for kind "svg"

    css?: string

    CSS for this template, in its own shadow root: its class names are its own

    defaults?: Partial<AnnotationLayerOptions<D>>

    Layer options this template works best with; the layer's own options win

    expandable?: boolean

    Whether render draws an expanded state (ctx.state "expanded"), shown in a card on hover or click

    fields?: Record<string, string>

    BQL expressions this template needs, by data key: a layer's {where} query asks for them as GET

    hover?: "template" | "lift"

    How the compact state shows that it, or its object, is hovered: "lift" (default), the viewer raises it with an outline in the accent along its shape; "template", render draws it from ctx.hovered and the viewer adds nothing

    kind?: "html" | "svg"

    "html" (default), or "svg": the viewer draws the result into an root of compactSize

    name: string

    Unique name: of the stylesheet, in diagnostics, and the one a layer or BVL refers to

    origin?: [x: number, y: number]

    Which point of the compact box sits on the anchor: [0.5, 0.5] centre (default), [0.5, 1] a pin's tip

    refreshMs?: number

    Draw the shown annotations again this often, and evaluate every row's status and priority (relative times, readings going stale)

    Methods

    • Whether a row's expanded state shows more than its compact state; a row for which it is false opens no card (that card would repeat the compact state beside it). Default: every row of an expandable template opens one

      Parameters

      • data: D

      Returns boolean

    • Accessible name of the annotation

      Parameters

      • data: D

      Returns string

    • Higher first: which annotations survive limits and front a cluster; nearest first among equals

      Parameters

      • data: D

      Returns number

    • A row's status colour and label: a cluster's count is ringed by its members' colours, and its tooltip counts the labels

      Parameters

      • data: D

      Returns { color: string; label: string } | null