Raxol.UI.Renderer (Raxol v0.3.0)

View Source

Translates a positioned element tree into a flat list of renderable cells.

Takes the output of the Layout Engine and converts UI primitives (text, boxes, etc.) into styled characters at specific coordinates.

Summary

Functions

Renders a tree of positioned elements into a list of cells.

Types

cell()

@type cell() ::
  {x :: integer(), y :: integer(), char :: String.t(), fg :: term(),
   bg :: term(), attrs :: [atom()]}

positioned_element()

@type positioned_element() :: map()

theme()

@type theme() :: map()

Functions

render_to_cells(elements_or_element, theme \\ Raxol.UI.Theming.Theme.default_theme())

@spec render_to_cells(
  positioned_element() | [positioned_element()],
  theme()
) :: [cell()]

Renders a tree of positioned elements into a list of cells.

Args:

  • elements: A list or single map representing positioned elements from the Layout Engine.
  • theme: The current theme map (expected %Theme{}).

Returns:

  • list(cell())