import { compare, record } from '@synnaxlabs/x'; export interface Node { key: K; children?: Node[]; } export interface NodeShape { depth: number; expanded: boolean; hasChildren: boolean; } export interface Shape { keys: K[]; nodes: NodeShape[]; } export declare const shouldExpand: (node: Node, expanded: K[]) => boolean; export interface FlattenProps { nodes: Node[]; expanded: K[]; sort?: compare.Comparator>; depth?: number; path?: string; } export declare const flatten: ({ nodes, expanded, sort, depth, }: FlattenProps) => Shape; export interface MoveNodeProps { tree: Node[]; destination: K | null; keys: K | K[]; } export declare const moveNode: ({ tree, destination, keys, }: MoveNodeProps) => Node[]; export interface RemoveNodeProps { tree: Node[]; keys: K | K[]; parent?: K | null; } export declare const removeNode: ({ tree, keys, parent, }: RemoveNodeProps) => Node[]; export interface SetNodeProps { tree: Node[]; destination: K | null; additions: Node | Node[]; throwOnMissing?: boolean; } export declare const setNode: ({ tree, destination, additions, throwOnMissing, }: SetNodeProps) => Node[]; export interface UpdateNodeProps { tree: Node[]; key: K; updater: (node: Node) => Node; throwOnMissing?: boolean; } export declare const updateNode: ({ tree, key, updater, throwOnMissing, }: UpdateNodeProps) => Node[]; interface UpdateNodeChildren { tree: Node[]; parent: K; updater: (nodes: Node[]) => Node[]; throwOnMissing?: boolean; } export declare const updateNodeChildren: ({ tree, parent, updater, throwOnMissing, }: UpdateNodeChildren) => Node[]; export interface FindNodeProps { tree: Node[]; key: K; depth?: number; } export declare const findNode: ({ tree, key, depth, }: FindNodeProps) => Node | null; export interface FindNodesProps { tree: Node[]; keys: K[]; } export declare const findNodes: ({ tree, keys, }: FindNodesProps) => Node[]; export interface FindNodeParentProps { tree: Node[]; key: K; } export declare const findNodeParent: ({ tree, key, }: FindNodeParentProps) => Node | null; export declare const deepCopy: (nodes: Node[]) => Node[]; export declare const getDescendants: (...node: Node[]) => Node[]; export declare const filterShape: (shape: Shape, match: (key: K, depth: number) => boolean) => Shape; export declare const getAllNodesOfMinDepth: (data: Shape) => K[]; /** * Returns the depth of the node with the given key, or null if the shape has no such * key. A shape holds only visible rows, so a node under a contracted parent is absent * even though it is still in the tree. */ export declare const getDepth: (key: K, shape: Shape) => number | null; /** Orders keys shallowest-first. Keys the shape does not contain sort last. */ export declare const compareDepth: (shape: Shape) => compare.Comparator; export declare const getNodeShape: (shape: Shape, key: K) => NodeShape | null; export {}; //# sourceMappingURL=base.d.ts.map