import type { ASTAttrs, ASTContainerNode, ASTNode, ASTType } from './types'; export declare function createASTNode(type: ASTType, id: string, cupName: string, attrs?: ASTAttrs): ASTNode; /** * Find node in ast by path like '0.1' */ export declare function findTargetNodeByPath(root: ASTContainerNode, path: string): { parent: ASTContainerNode; target: ASTNode; targetIndex: number; } | false; /** * Find node by id in a tree which include more info * @param root tree root * @param nodeId find node id */ export declare function findTargetNodeById(root: ASTContainerNode, nodeId: string): { parent: ASTContainerNode; target: ASTNode; targetIndex: number; } | false; /** * Get AST Tree Path by node id */ export declare function getNodePathById(root: ASTContainerNode, nodeId: string, currentPathArr?: number[]): string | false; /** * Whether a node is container */ export declare function isContainerNode(node: ASTNode): node is ASTContainerNode; /** * Traverse Tree and find node by node id * @param root tree root node * @param id node id */ export declare function findNodeById(root: ASTNode, id: string): ASTNode | null; /** * Move node by path * @param root * @param fromPath * @param toPath */ export declare function moveNodeByPath(root: ASTContainerNode, fromPath: string, toPath: string): void; /** * traverse and update tree, return new tree * @param root tree root node * @param id node id */ declare type TraverseUpdaterNode = ASTNode & Partial>; interface TraverseUpdaterInfo { path: string; } declare type TraverseUpdater = (node: TraverseUpdaterNode, info: TraverseUpdaterInfo) => any; export declare function traverseUpdateTree(root: ASTNode, updater: TraverseUpdater): T; /** * Decrease last index of path */ export declare function getPrevPath(originPath: string): string; /** * Increase last index of path */ export declare function getNextPath(originPath: string): string; /** * Get first index of path in same level */ export declare function getFirstPath(originPath: string): string; /** * Get parent path */ export declare function getParentPath(originPath: string): string; /** * resetPathLastIndex * @param lastIndex Last index to reset */ export declare function resetPathLastIndex(originPath: string, lastIndex: number): string; export {};