Skip to content
docsv0.3.0

TuiNodeRendererInterface

Turns one retained-tree {@see TuiNode} into a painted {@see TuiFrame} — the TUI analog of {@see \Milpa\Live\Contracts\Rendering\ComponentRendererInterface}. Dispatch is by node type via {@see supports()}, resolved through a {@see TuiNodeRendererRegistryInterface}, not by the caller hand-wiring a renderer per node type.

TuiNodeRendererInterface::supports()

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

Whether this renderer knows how to paint the given node (typically decided by {@see TuiNode::$type}).

Parameters

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

TuiNodeRendererInterface::render()

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

Renders the node into a frame sized to `$context->bounds`. Implementations MUST return a {@see TuiFrame} matching `$context->bounds`' width/height exactly, since the caller composes it into a {@see \Milpa\Live\Contracts\Tui\VirtualTerminalBufferInterface} at those bounds without further clamping.

Parameters

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