Raxol.Core.Runtime.Rendering.Backends (Raxol v2.6.0)

View Source

Rendering backend implementations for different output targets.

Handles converting cells to output for terminal, VSCode, LiveView, and SSH backends. Extracted from Raxol.Core.Runtime.Rendering.Engine to keep rendering dispatch separate from the GenServer lifecycle.

Summary

Functions

Transforms raw cells and writes them into a fresh ScreenBuffer.

Renders cells to the LiveView backend via PubSub broadcast.

Renders cells to an SSH channel via an io_writer function.

Renders cells to a Telegram chat via an io_writer function.

Renders cells to the terminal backend with ANSI output.

Renders cells to the VSCode backend via stdio interface.

Functions

apply_cells_to_buffer(cells, state)

Transforms raw cells and writes them into a fresh ScreenBuffer.

A new buffer is created each frame so stale cells from previous views don't persist.

render_to_liveview(cells, state, positioned_elements \\ [], a11y_map \\ %{})

Renders cells to the LiveView backend via PubSub broadcast.

When positioned_elements carry animation hints, generates a companion <style> block with CSS transitions and broadcasts it alongside the terminal HTML. LiveView receives {:render_update, html, animation_css}.

a11y_map is an id -> accessibility_node map (from Raxol.Core.Accessibility.Projection.by_id/1) that the bridge uses to emit per-element ARIA on spans whose data-raxol-id matches an entry.

render_to_ssh(cells, state)

Renders cells to an SSH channel via an io_writer function.

render_to_telegram(cells, state)

@spec render_to_telegram(list(), map()) :: {:ok, map()}

Renders cells to a Telegram chat via an io_writer function.

Converts the buffer to plain text (no ANSI) and delivers it to the session's io_writer callback, which sends/edits the Telegram message.

render_to_terminal(cells, state)

Renders cells to the terminal backend with ANSI output.

render_to_vscode(cells, state)

Renders cells to the VSCode backend via stdio interface.