nodes

nodes.collect

collect(parentId: string, childIds: NodeSelector): Promise<void>

Group child nodes under a parent (collection) node.

The parent node must already exist. Recorded in history as "CollectNodes". Emits "collection:changed" with { type: "collect", parentId }.

Note: the parent is marked with a binary "collected" flag; the child count is no longer recorded on the parent (count rendering is retired in Phase 5). Use a Badge if you need to display the count. The children themselves are not reparented. Use explode() to revert the visual state.

parentIdstringId of the existing node that will act as the collection parent.
childIdsNodeSelectorIdentifies the nodes to collect; accepts any NodeSelector.

Returns: Promise<void>

Example

await api.nodes.collect("parent1", ["child1", "child2"]);