import { NodeApi } from "./interfaces/node-api"; import { TreeApi } from "./interfaces/tree-api"; export declare function bound(n: number, min: number, max: number): number; export declare function isItem(node: NodeApi | null): boolean | null; export declare function isClosed(node: NodeApi | null): boolean | null; export declare function isOpenWithEmptyChildren(node: NodeApi | null): boolean | null; /** * Is first param a descendant of the second param */ export declare const isDescendant: (a: NodeApi, b: NodeApi) => boolean; export declare const indexOf: (node: NodeApi) => number; export declare function noop(): void; export declare function dfs(node: NodeApi, id: string): NodeApi | null; export declare function walk(node: NodeApi, fn: (node: NodeApi) => void): void; export declare function focusNextElement(target: HTMLElement): void; export declare function focusPrevElement(target: HTMLElement): void; export declare function access(obj: any, accessor: string | boolean | Function): T; export declare function mergeRefs(...refs: any): (instance: any) => void; export declare function safeRun any>(fn: T | undefined, ...args: Parameters): any; export declare function waitFor(fn: () => boolean): Promise; export declare function getInsertIndex(tree: TreeApi): number; export type TreeLineChars = { last: string; middle: string; pipe: string; blank: string; }; /** * Generate a tree-line prefix string for a node. * * Returns characters like `├ `, `└ `, `│` that visually connect * parent and child nodes, similar to the Unix `tree` command. * * **Styling note:** The prefix uses Box Drawing characters (`│`, `├`, `└`) * which require a monospace font for correct alignment. Wrap the prefix * in a `` with `fontFamily: "monospace"` and use a consistent * `fontSize` (e.g. 14–16px). Inherited `line-height` or `font-size` * from parent elements can cause misalignment. * * @example Basic usage * ```tsx * function MyNode({ node, style }: NodeRendererProps) { * return ( *
* * {getTreeLinePrefix(node)} * * {node.data.name} *
* ); * } * ``` * * @example With folder/file icons * ```tsx * function MyNode({ node, style }: NodeRendererProps) { * const icon = node.isLeaf ? "📄" : node.isOpen ? "📂" : "📁"; * return ( *
* * {getTreeLinePrefix(node)} * * {icon} {node.data.name} *
* ); * } * ``` * * @example Custom characters * ```tsx * // ASCII-only style * getTreeLinePrefix(node, { last: "`- ", middle: "|- ", pipe: "|", blank: " " }) * ``` */ export declare function getTreeLinePrefix(node: NodeApi, chars?: Partial): string; export declare function getInsertParentId(tree: TreeApi): string | null;