Incrementally collapse a node: remove all descendants that follow it.
Returns the new list and the index of the collapsed node, or null if the
node was not found (caller should fall back to full rebuild).
Incrementally expand a node: insert its flattened subtree right after it.
Returns the new list and the index of the expanded node, or null if the
node was not found (caller should fall back to full rebuild).