MingaEditor.FocusTree.Node (Minga v0.1.0)

Copy Markdown View Source

A node in the focus tree: one visible region that can receive mouse routing.

Each node owns a rect, a content type tag, optional input handler module, and children in rendered z-order. Later children paint above earlier children, so hit-tests prefer later children. The id, parent, previous_sibling, and next_sibling fields are stable references inside the tree, not parent structs. That keeps the tree acyclic while still letting routing and tests reason about hierarchy.

See MingaEditor.FocusTree for tree construction and traversal.

Summary

Types

Tag identifying what the node represents.

Stable node reference inside a focus tree.

Pixel/cell rect. Same shape as MingaEditor.Layout.rect/0.

t()

A node in the focus tree.

Functions

Returns true when (row, col) is inside the node's half-open rect.

Constructs a node with the given content type and rect.

Types

content_type()

@type content_type() ::
  :viewport
  | :tab_bar
  | :file_tree
  | :editor_area
  | :window
  | :gutter
  | :buffer_content
  | :modeline
  | :status_bar
  | :agent_panel
  | :agent_chat_window
  | :agent_chat_content
  | :bottom_panel
  | :minibuffer
  | :modal_overlay
  | :picker_backdrop
  | :picker
  | :completion_backdrop
  | :completion_menu
  | :hover_popup
  | :signature_help
  | :float_popup
  | :agent_context
  | :tool_manager
  | :extension_panel
  | :observatory
  | :edit_timeline
  | :notifications
  | :extension_overlay
  | :which_key
  | {:custom, atom()}

Tag identifying what the node represents.

id()

@type id() :: term()

Stable node reference inside a focus tree.

rect()

Pixel/cell rect. Same shape as MingaEditor.Layout.rect/0.

t()

@type t() :: %MingaEditor.FocusTree.Node{
  children: [t()],
  content_type: content_type(),
  focusable?: boolean(),
  handler: module() | nil,
  id: id(),
  next_sibling: id() | nil,
  parent: id() | nil,
  previous_sibling: id() | nil,
  rect: rect(),
  ref: term(),
  scrollable?: boolean()
}

A node in the focus tree.

Functions

contains?(node, row, col)

@spec contains?(t(), integer(), integer()) :: boolean()

Returns true when (row, col) is inside the node's half-open rect.

new(content_type, rect, opts \\ [])

@spec new(content_type(), rect(), keyword()) :: t()

Constructs a node with the given content type and rect.