Skip to content
docsv0.3.0

LoaderRenderer

Animated loading spinner. The TUI analog of pi-tui's `Loader` / `CancellableLoader`. Pure renderer: it draws whatever `frame` index and `message` the node's props carry — animation advance (picking the next frame on each tick) is the caller's job, not the renderer's, so the renderer stays a deterministic node-in/frame-out mapping with no internal clock. The caller drives animation by mutating `props['frame']` from the `RetainedTuiLoop` `tick` callback or from a live component's state. The default frame set is a braille spinner compatible with the lab's mb-aware string utils; callers can pass a custom `frames` array. When `aborted` is true, the spinner is replaced by a static glyph and the message is dimmed via the `muted` theme role (applied by the `TuiAnsiPainter` pass, not here). Node props (all optional): - `message` string Text shown next to the spinner. Default: 'Loading…'. - `frame` int Index into `frames` (wrapped modulo). Default: 0. - `frames` array Custom spinner frames. Default: braille 8-step. - `aborted` bool Show a static canceled state. Default: false. - `done` bool Show a static done state (checkmark). Default: false. - `color` string Theme role for the spinner glyph. Default: 'accent'.

LoaderRenderer::supports()

public function supports(Milpa\Live\ValueObjects\Tui\TuiNode $node): bool

True only for `loader` nodes — dispatch is by declared node type, never by where the node came from.

Parameters

Parameters of supports()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode

LoaderRenderer::render()

public function render(Milpa\Live\ValueObjects\Tui\TuiNode $node, Milpa\Live\ValueObjects\Tui\TuiRenderContext $context): Milpa\Live\ValueObjects\Tui\TuiFrame

Draws the current spinner frame; the caller advances the animation by re-rendering, since the renderer keeps no state.

Parameters

Parameters of render()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode
$contextMilpa\Live\ValueObjects\Tui\TuiRenderContext