import * as Platform from '../../../core/platform/platform.js'; import * as LitHtml from '../../lit-html/lit-html.js'; export type TreeNodeId = string; interface BaseTreeNode { treeNodeData: TreeNodeDataType; renderer?: (node: TreeNode, state: { isExpanded: boolean; }) => LitHtml.TemplateResult; id: TreeNodeId; } export interface TreeNodeWithChildren extends BaseTreeNode { children: () => Promise[]>; } interface LeafNode extends BaseTreeNode { children?: never; } export type TreeNode = TreeNodeWithChildren | LeafNode; export declare function isExpandableNode(node: TreeNode): node is TreeNodeWithChildren; /** * This is a custom lit-html directive that lets us track the DOM nodes that Lit * creates and maps them to the tree node that was given to us. This means we * can navigate between real DOM node and structural tree node easily in code. */ declare class TrackDOMNodeToTreeNode extends LitHtml.Directive.Directive { constructor(partInfo: LitHtml.Directive.PartInfo); update(part: LitHtml.Directive.ElementPart, [weakMap, treeNode]: LitHtml.Directive.DirectiveParameters): void; render(_weakmap: WeakMap>, _treeNode: TreeNode): void; } export declare const trackDOMNodeToTreeNode: (_weakmap: WeakMap>, _treeNode: TreeNode) => LitHtml.Directive.DirectiveResult; export declare const getNodeChildren: (node: TreeNode) => Promise[]>; /** * Searches the tree and returns a path to the given node. * e.g. if the tree is: * A * - B * - C * - D * - E * - F * * And you look for F, you'll get back [A, D, F] */ export declare const getPathToTreeNode: (tree: readonly TreeNode[], nodeIdToFind: TreeNodeId) => Promise[] | null>; interface KeyboardNavigationOptions { currentDOMNode: HTMLLIElement; currentTreeNode: TreeNode; direction: Platform.KeyboardUtilities.ArrowKey; setNodeExpandedState: (treeNode: TreeNode, expanded: boolean) => void; } export declare const findNextNodeForTreeOutlineKeyboardNavigation: (options: KeyboardNavigationOptions) => HTMLLIElement; export {};