import type { ReactNode } from 'react'; import type { TreeNode } from '../Tree.types'; /** * Internal node representation with computed fields. * NOT exported from index.ts — internal to the tree component. */ export interface NodeState { /** Unique identifier */ id: string; /** Visible text label */ label: string; /** Selection state */ checked: boolean; /** Whether the node is interactive */ disabled: boolean; /** Computed: true when children have mixed checked states */ indeterminate: boolean; /** Parent node ID, null for root nodes */ parentId: string | null; /** IDs of direct children */ childIds: string[]; /** Depth in the tree (0 = root) */ depth: number; /** Optional icon */ icon?: ReactNode; /** Arbitrary payload */ data?: T; } /** * Build a flat Map from a tree array. * Computes parentId, childIds, depth for each node. * Performs a DFS traversal to populate all computed fields. */ export declare function buildNodeMap(nodes: TreeNode[]): Map>; /** * Cascade a checked state change downward to all enabled descendants. * Disabled nodes are SKIPPED — they retain their current state. * Returns a new Map with updated states. */ export declare function cascadeDown(nodeId: string, checked: boolean, nodeMap: Map>): Map>; /** * Propagate state change upward through all ancestors. * Each ancestor recalculates checked/indeterminate from its children. * Returns a new Map with updated ancestor states. */ export declare function propagateUp(nodeId: string, nodeMap: Map>): Map>; /** * Flatten the tree into a pre-order depth-first array. * Used for keyboard navigation and imperative API. */ export declare function flattenTree(nodeMap: Map>, rootIds: string[]): NodeState[]; /** * Get visible nodes considering expand/collapse state. * A node is visible if all its ancestors are expanded. */ export declare function getVisibleNodes(nodeMap: Map>, rootIds: string[], expandedIds: Set): NodeState[]; /** * Diff current checked states against original. * Returns nodes whose checked state changed since initialization. */ export declare function diffNodes(current: Map>, original: Map): NodeState[]; /** * Reconstruct TreeNode[] from the flat nodeMap. * Used to convert internal state back to public API format. */ export declare function toTreeNodes(nodeMap: Map>, rootIds: string[]): TreeNode[]; //# sourceMappingURL=treeOperations.d.ts.map