TermUI.Runtime.NodeRenderer (TermUI v1.0.0)

View Source

Converts render trees to buffer cells for terminal output.

This module bridges the gap between the component's render tree output and the low-level buffer cell representation needed for terminal rendering.

Supports both tuple-based render nodes (from TermUI.Elm.Helpers) and struct-based RenderNodes (from TermUI.Component.RenderNode).

Summary

Functions

Renders a node tree to the buffer starting at the given position.

Renders a node tree directly to a Buffer struct (not via BufferManager).

Functions

render_to_buffer(node, buffer_manager, start_row \\ 1, start_col \\ 1)

Renders a node tree to the buffer starting at the given position.

Returns the bounds of the rendered content as {width, height}.

render_to_buffer_direct(node, buffer, start_row \\ 1, start_col \\ 1)

@spec render_to_buffer_direct(
  term(),
  TermUI.Renderer.Buffer.t(),
  pos_integer(),
  pos_integer()
) ::
  {non_neg_integer(), non_neg_integer()}

Renders a node tree directly to a Buffer struct (not via BufferManager).

This is used for TTY mode where we create temporary buffers per frame.

Returns the bounds of the rendered content as {width, height}.