Skip to main content

Module layout_helpers

Module layout_helpers 

Source
Expand description

Layout-tree + pending-action writers used by the tear-off / promote / redock handlers. SPEC_864 Phase 3/4 โ€” all of them route through the reducer (seed_layout_via_reducer / queue_layout_actions_via_reducer); nothing here writes mstore directly anymore. setup_torn_off_block_layout is re-exported crate-wide (the pane app-API uses it).

Functionsยง

action_id_or_new ๐Ÿ”’
The id a frontend minted for its own command, so that frontend skips the queued copy (processedActionIds, layoutPersistence.ts); a fresh one when it sent none or an unusable one.
order_stack ๐Ÿ”’
The stack as the caller gave it (tear_off_order moves the visible block first, but the paneโ€™s tab order is the order of members).
queue_source_layout_delete ๐Ÿ”’
Take a block that moved (tear-off, promote, redock) or was deleted (sagas::delete_block, sagas::close_pane) out of its source tabโ€™s layout: srvโ€™s tree, then a queued delete so a window that already shows the tab drops it too (a window that missed it would show a pane whose block is gone; INVESTIGATION_LAYOUT_DEAD_SPACE_STALE_TREE_RESURRECTION_2026_07_08.md).
queue_stack_activate ๐Ÿ”’
Tell the frontend that block_id became the visible tab of its pane (Command::LayoutStackActivate). Matches LayoutTreeActionType.StackActivate = "stackactivate".
queue_stack_remove ๐Ÿ”’
Tell the frontend that block_id left its pane (one tab of a stack, or the pane with its last tab): the delete action, under the callerโ€™s id.
queue_target_layout_insert ๐Ÿ”’
Place a block (re-docked, re-placed by the orphan reaper) at the first free slot of its tab: srvโ€™s tree first, then the queued insert for the window showing the tab (layout_intents::place_block).
queue_target_layout_split ๐Ÿ”’
Phase 4b/4c โ€” place a redocked block in the exact slot the ghost overlay previewed: a split of the pane holding target_block_id.
queue_target_stack_move ๐Ÿ”’
Tell the frontend that block_id was moved โ€” already, in the reducer โ€” to position relative to target_block_id (Command::LayoutStackMove): a same-pane reorder when both are already in one leafโ€™s stack, otherwise a cross-pane move. Matches LayoutTreeActionType.StackMove = "stackmove" in frontend/layout/lib/types.ts. position is the same "before"/"after"/"end" string pane.moveTabโ€™s caller supplied โ€” reused verbatim, not re-derived, so the frontend applies the identical operation rather than inferring it from resulting tree state. activate rides on LayoutActionData.focused โ€” the same field queue_target_stack_push above already overloads for this purpose (both carry the callerโ€™s activate value: a new tab and a reorder may or may not be shown). SPEC_PANE_TAB_DRAG_AND_DROP_2026_09_19.md ยง4.1, Phase 3.
queue_target_stack_moves ๐Ÿ”’
Tell the frontend that several blocks were moved โ€” already, in the reducer โ€” to the end of target_block_idโ€™s pane (Command::LayoutStackMoveMany): one stackmove per block, in order, the visible tabโ€™s (when it is one of them) carrying focused; and a stackactivate when the visible tab is a member of that pane that was not moved. The ids are <action_id>:<index>, which the calling frontend registered as its own. SPEC_PANE_TAB_MULTI_SELECT_MOVE_AND_COLLAPSED_EXPAND_2026_10_24.md ยง5.
queue_target_stack_push ๐Ÿ”’
Tell the frontend that block_id was added โ€” already, in the reducer โ€” as a tab of the pane holding target_block_id, the visible one when activate (Command::CreateBlockInStack). Matches LayoutTreeActionType.StackPush = "stackpush" in frontend/layout/lib/types.ts. SPEC_PANE_TABS_REDUCER_COMMANDS_2026_09_18.md ยง3.3.
setup_torn_off_block_layout ๐Ÿ”’
Phase E.5.5 โ€” set up the layout tree for a tab that just received its first block via the TearOffBlock saga. Called from the TearOffBlock / PromoteBlockToTab handlers and the floating pane.open path after the sagaโ€™s reducer-state portion (CreateTab + MoveBlock) completes. (NOT RedockFloatingPane โ€” that redocks into an EXISTING tab and goes through queue_target_layout_insert/_split instead; reagent P2 on #1971.)
setup_torn_off_stack_layout ๐Ÿ”’
setup_torn_off_block_layout for a whole pane torn off with its tabs: the one leaf holds members as its block_stack (in order), with block_id the visible one. Fewer than two members seed a plain leaf.
source_delete_action ๐Ÿ”’
The frontend delete action for one block: its handler removes just that stack member (the leaf goes with the last one) and never runs closeNode.