Skip to content

FilterTreeService

Pure tree-manipulation service used by the filter-tree UI.

new FilterTreeService(): FilterTreeService

FilterTreeService

applyDrop(root, dragId, position): FilterNode

Apply a drop operation to the tree and return a new root.

Deep-clones the incoming root first so the caller’s reference is never mutated. All splice / replace operations happen on the clone.

FilterNode

string

DropPosition

FilterNode


canRedo(history): boolean

FilterTreeHistory

boolean


canUndo(history): boolean

FilterTreeHistory

boolean


commitState(history, newRoot): FilterTreeHistory

Push a new tree state onto the history stack. Truncates any redo states beyond the current index.

FilterTreeHistory

FilterNode

FilterTreeHistory


currentRoot(history): FilterNode

The tree at the current history position.

FilterTreeHistory

FilterNode


deleteNode(root, nodeId): FilterNode

Delete a node from the tree by ID.

Deep-clones the tree first, extracts the target node from the clone, enforces the >=2-children invariant, then returns the clone.

FilterNode

string

FilterNode


initHistory(root): FilterTreeHistory

Create a fresh history with a single initial state.

FilterNode

FilterTreeHistory


redo(history): FilterTreeHistory | null

Step forward one state. Returns null if already at the end.

FilterTreeHistory

FilterTreeHistory | null


toggleConjunction(root, branchId): FilterNode

Toggle a branch’s conjunction between ”&&” and ”||”. Deep-clones the tree first so the original is never mutated.

FilterNode

string

FilterNode


undo(history): FilterTreeHistory | null

Step back one state. Returns null if already at the beginning.

FilterTreeHistory

FilterTreeHistory | null