@samatawy/diagrams
    Preparing search index...

    Class DiagramToolset

    A toolbar component that displays a list of tools for the diagram editor. It allows users to select a tool, and the selected tool is highlighted. The component emits a 'tool-selected' event when a tool is selected. The layout of the tools can be customized via the configuration options.

    Index

    Constructors

    Properties

    host: HTMLElement
    manualTools: Map<string, string> = ...
    renderedTools: string[] = []

    Accessors

    Methods

    • Adds a tool entry manually, useful for custom or non-registered tools.

      Parameters

      • tool: string

        The tool identifier string.

      • Optionallabel: string

        Optional display label; defaults to a prettified version of the tool name.

      Returns void

    • Handles diagram tool-change events and updates the highlighted tool button.

      Parameters

      • event: Event

        The custom event carrying the new tool name.

      Returns void

    • Orders the available tools according to the configured layout, inserting wildcard tools as needed.

      Parameters

      • allTools: string[]

        The full list of tool identifiers to arrange.

      Returns string[]

      The ordered list of tool identifiers to render.

    • Builds and appends a single tool button to the palette.

      Parameters

      • tool: string

        The tool identifier string.

      • label: string

        The display label and tooltip for the button.

      Returns void

    • Attaches pointer-based drag-to-create behavior to a tool button. Does nothing when the tool's adapter does not produce a draft node.

      Parameters

      • button: HTMLButtonElement

        The button element to instrument.

      • tool: string

        The tool identifier whose adapter supplies the draft node.

      Returns void

    • Marks the given tool button as active and clears the active state from all others.

      Parameters

      • tool: string

        The tool identifier to highlight.

      Returns void