import type { TreeCheckState, TreeNode } from './types'; /** Children fetched through `loadChildren`, keyed by the branch they belong to. */ export type LoadedChildren = Record; /** * A node's children, whether they came with the data or arrived from * `loadChildren`. Every traversal in this component goes through here so lazy * branches behave like static ones everywhere else. */ export declare const childrenOf: (node: TreeNode, loaded?: LoadedChildren) => TreeNode[] | undefined; /** * Whether the node gets a disclosure control. `hasChildren` covers the lazy case * where the caret has to exist before there is anything to show. */ export declare const isBranchNode: (node: TreeNode, loaded?: LoadedChildren) => boolean; export declare const walkTree: (nodes: TreeNode[], visit: (node: TreeNode, depth: number, parent: TreeNode | null) => void, loaded?: LoadedChildren, depth?: number, parent?: TreeNode | null) => void; export declare const findNode: (nodes: TreeNode[], id: string, loaded?: LoadedChildren) => TreeNode | undefined; /** Every branch id, for expand-all. */ export declare const collectBranchIds: (nodes: TreeNode[], loaded?: LoadedChildren) => string[]; /** Branch id → every descendant id below it. Built once per data change. */ export declare const buildDescendantMap: (nodes: TreeNode[], loaded?: LoadedChildren) => Record; /** Child id → parent id, for ArrowLeft and for expanding a match's ancestors. */ export declare const buildParentMap: (nodes: TreeNode[], loaded?: LoadedChildren) => Record; /** Ids expanded before the user touches anything: `startOpen`, or everything. */ export declare const buildInitialExpanded: (nodes: TreeNode[], expandAll: boolean, loaded?: LoadedChildren) => string[]; export interface FilterResult { /** Nodes whose own label matched — what `highlight` marks up. */ matched: Set; /** Matches plus their ancestors: the set still rendered when `hideFiltered`. */ visible: Set; /** Ancestors of matches, opened so the matches can actually be reached. */ ancestors: Set; } /** * Marks matches without rebuilding the tree. The old implementation cloned * every surviving node, which broke referential equality — memoized rows saw a * new node object on each keystroke, and callbacks handed consumers a copy * rather than the node they passed in. */ export declare const filterTree: (nodes: TreeNode[], query: string, loaded?: LoadedChildren) => FilterResult; /** Aggregate check state for a node, from the checked set alone. */ export declare const getCheckState: (node: TreeNode, checked: Set, descendants: string[] | undefined, cascade: boolean) => TreeCheckState; /** * Two-state toggle: a branch goes fully checked or fully unchecked, taking its * descendants with it. The previous tri-state cycle had a "parent checked, no * children" step that was indistinguishable on screen from "some children * checked", so the control looked stuck. */ export declare const toggleCheckedIds: (node: TreeNode, current: string[], descendants: string[] | undefined, cascade: boolean) => string[]; /** Ids between two rows, inclusive, in visible order. */ export declare const idRange: (orderedIds: string[], fromId: string, toId: string) => string[]; /** * Every ancestor id of `id`, nearest first. Guards against a cycle in * `parentMap` — a malformed tree should render wrong, not hang the thread. */ export declare const ancestorIds: (parentMap: Record, id: string) => string[]; /** * First node whose `href` matches, in document order. Backs `activeHref`, so a * consumer can hand the tree a pathname instead of resolving the node itself. */ export declare const findNodeByHref: (nodes: TreeNode[], href: string, loaded?: LoadedChildren) => TreeNode | undefined;