UNPKG

mind-elixir

Version:

Mind elixir is a free open source mind map core.

19 lines (18 loc) • 1.06 kB
import type { NodeObj } from '../types'; export declare function removeNodeObj(obj: NodeObj): number; export declare function insertNodeObj(newObj: NodeObj, type: 'before' | 'after', obj: NodeObj): void; export declare function insertParentNodeObj(obj: NodeObj, newObj: NodeObj): void; /** * True when `to` is `from` itself or lives inside `from`'s subtree. Moving a * node under itself re-parents it as its own ancestor — the data becomes a * cycle and `fillParent` / `getData` blow up — so callers must reject it. * The visited set only guards against an already-corrupted tree whose parent * chain loops; a healthy chain strictly shrinks towards the root. */ export declare function isDescendantOrSelf(from: NodeObj, to: NodeObj): boolean; /** * Move `from` relative to `to`. Returns `false` (data untouched) when the * target is `from` itself or one of its descendants — callers can use the * return value to detect a rejected move. */ export declare function moveNodeObj(type: 'in' | 'before' | 'after', from: NodeObj, to: NodeObj): boolean;