g3-toolkit API Reference
    Preparing search index...

    Interface SelectionState

    interface SelectionState {
        addEdgesToSelection: (ids: string[]) => void;
        addNodesToSelection: (ids: string[]) => void;
        clear: () => void;
        clearSelection: () => void;
        hoveredNodeId: string | null;
        removeNodesFromSelection: (ids: string[]) => void;
        selectedEdgeIds: ReadonlySet<string>;
        selectEdges: (ids: string[]) => void;
        selectedNodeIds: ReadonlySet<string>;
        selectNodes: (ids: string[]) => void;
        setHover: (nodeId: string | null) => void;
        toggleNodeSelection: (id: string) => void;
    }
    Index

    Properties

    addEdgesToSelection: (ids: string[]) => void

    Add edge IDs to the existing selection.

    addNodesToSelection: (ids: string[]) => void

    Add node IDs to the existing selection (shift-click).

    clear: () => void

    Clear all node and edge selections.

    The uniform reset name across every exported store. The other six have always called it clear; this one called it clearSelection, so a host wiring up two stores had to remember which was which.

    clearSelection: () => void

    Use clear. Kept working so this is not a breaking change, and removed no earlier than the next major, per the deprecation policy in RELEASE.md.

    hoveredNodeId: string | null

    Node currently being hovered (null if none).

    removeNodesFromSelection: (ids: string[]) => void

    Remove ids from the node selection (review 4.12: the collapse counterpart to addNodesToSelection).

    selectedEdgeIds: ReadonlySet<string>

    Currently selected edge IDs. See selectedNodeIds.

    selectEdges: (ids: string[]) => void

    Replace the entire selection with the given edge IDs.

    selectedNodeIds: ReadonlySet<string>

    Currently selected node IDs.

    ReadonlySet on purpose. This store is one of the three declared host-integration channels, so the collection is handed to code this package does not own; typed as a mutable Set a host could call .add() on it and change the selection without going through an action, leaving subscribers unnotified and the canvas out of sync with the store. The narrowing is compile-time only, so nothing changes at runtime for a host that was already using the actions.

    selectNodes: (ids: string[]) => void

    Replace the entire selection with the given node IDs.

    setHover: (nodeId: string | null) => void

    Set the hovered node (or null to clear hover).

    toggleNodeSelection: (id: string) => void

    Toggle a node in/out of selection (ctrl-click).