Search documentation of Plushie

# Plushie.Runtime.Windows (Plushie v0.7.2)

Copy Markdown View Source

Window lifecycle management for the Plushie runtime.

Detects window nodes in the UI tree, opens/closes/updates windows via the bridge, and tracks the set of active window IDs on the runtime state.

## Summary

### Functions

detect_windows(tree)

Detects window node IDs from the tree. Searches the entire tree recursively, matching the Rust renderer's behavior.

sync_windows(state, tree)

Synchronizes the runtime's tracked windows with the current tree.

sync_windows(state, tree, new_windows)

Same as `sync_windows/2` but accepts a pre-computed window set, avoiding a redundant tree walk when the caller already has it.

## Functions

# detect_windows(tree)

    @spec detect_windows(map() | nil) :: MapSet.t()

Detects window node IDs from the tree. Searches the entire tree recursively, matching the Rust renderer's behavior.

# sync_windows(state, tree)

    @spec sync_windows(map(), map() | nil) :: map()

Synchronizes the runtime's tracked windows with the current tree.

Opens windows that appeared in the new tree, closes windows that were removed, and sends update ops for windows whose props changed. Returns the updated state with the new window set.

# sync_windows(state, tree, new_windows)

    @spec sync_windows(map(), map() | nil, MapSet.t()) :: map()

Same as `sync_windows/2` but accepts a pre-computed window set, avoiding a redundant tree walk when the caller already has it.