Companion View

← Views
STRVCT

A persistent secondary context docked alongside a node's navigation, collapsing behind an edge handle or disappearing as the viewport narrows.

Overview

A companion is a secondary region the view layer displays alongside a node's primary master-detail navigation: a chat panel beside a gaming session, a property inspector beside a document editor, or a reference pane beside a campaign tree.

Unlike popovers or modal drawers, a docked companion lives in normal layout flow: it reserves real layout space, causing adjacent navigation columns to compact smoothly without obscuring content.

SvStackView / SvDetailView Layout Container Primary Navigation Subchain (SvStackView) SvNavView (Master) • Column 1 Tiles • Column 2 Tiles SvNavView (Detail) • Selected Node Tiles ⋮ SvCompanionView node = nodeCompanionNode() Embedded SvBrowserView Isolated Navigation Context (handlesGlobalNav = false)

Model-View Boundary Protocol (`nodeCompanionNode`)

A domain node opts into displaying a companion by answering the optional protocol method:

nodeCompanionNode () {
    return this.someOwnedCompanionNode(); // returns the companion root node, or null for none
}

The node specifies which node to show alongside itself, but zero UI details: width, axis, pinning, and collapse state are managed entirely by the view layer. This maintains strict headless testability.

The Three Display States

StateVisual BehaviorSpace Allocation
dockedPanel is expanded alongside or beneath navigation columns.Reserves full length (companionReservedWidth()); columns compact to fit.
tabPanel is collapsed into a zero-width tab handle.Panel occupies 0px. Adjacent SvNavView displays expansion handle.
hiddenPanel and handle are both suppressed.Viewport is too narrow to offer companion without breaking primary content.

Space Arbitration & Keyboard Shortcuts

SvDetailView arbitrates layout space using setAvailableLength():

  • Threshold Check: If available width falls below tabLength, mode switches to hidden.
  • User Pinning: Clicking the edge handle toggles between docked and tab, persisting the choice as userMode.
  • Shortcut: Pressing Meta+\\ (Cmd+\\ or Ctrl+\\) toggles the deepest visible companion in the active navigation chain.

View Class Structure

SvStackView
 └─ SvDetailView                       (owns space arbitration)
     ├── childStackView                (primary flexible navigation)
     └── SvCompanionView              (node = nodeCompanionNode())
         ├── contentView              (embedded isolated SvBrowserView)
         ├── SvEdgeHandleView         (collapse/expand handle)
         └── SvCompanionTabView       (internal badge plumbing)

Theming & CSS Variables

CSS VariableApplies To
--SvCompanion-bgCompanion panel background color
--SvCompanionTab-colorLegacy tab text styling
--SvCompanionTab-border-colorLegacy tab border color