import type { Tree, TreeNode } from './tree'; import { TreeSelection, SelectableTreeNode } from './tree-selection'; /** * A tree selection that might contain additional information about the tree node that has the focus. */ export type FocusableTreeSelection = { /** * The tree node that has the focus in the tree selection. In case of a range selection, * the `focus` differs from the `node`. */ readonly focus?: SelectableTreeNode | undefined; } & TreeSelection; export declare namespace FocusableTreeSelection { /** * `true` if the argument is a focusable tree selection. Otherwise, `false`. */ function is(arg: object | undefined): arg is FocusableTreeSelection; /** * Returns with the tree node that has the focus if the argument is a focusable tree selection. * Otherwise, returns `undefined`. */ function focus(arg: TreeSelection | undefined): SelectableTreeNode | undefined; } /** * Class for representing and managing the selection state and the focus of a tree. */ export declare class TreeSelectionState { protected readonly tree: Tree; readonly selectionStack: readonly FocusableTreeSelection[]; constructor(tree: Tree, selectionStack?: readonly FocusableTreeSelection[]); nextState(selection: FocusableTreeSelection): TreeSelectionState; selection(): readonly SelectableTreeNode[]; get focus(): SelectableTreeNode | undefined; protected handleDefault(state: TreeSelectionState, node: Readonly): TreeSelectionState; protected handleToggle(state: TreeSelectionState, node: Readonly): TreeSelectionState; protected handleRange(state: TreeSelectionState, node: Readonly): TreeSelectionState; /** * Returns with an array of items representing the selection range. The from node is the `focus` the to node * is the selected node itself on the tree selection. Both the `from` node and the `to` node are inclusive. */ protected selectionRange(selection: FocusableTreeSelection): Readonly[]; protected toSelectableTreeNode(node: TreeNode | undefined): SelectableTreeNode | undefined; /** * Checks whether the argument contains any `DEFAULT` tree selection type. If yes, throws an error, otherwise returns with a reference the argument. */ protected checkNoDefaultSelection(selections: readonly T[]): readonly T[]; } //# sourceMappingURL=tree-selection-state.d.ts.map