Skip to content
docsv0.3.0

TuiComponentRenderer

Renders a Live component to the terminal, the counterpart of the HTML renderers in `milpa/live-web`. Same component definition, same state snapshot, different target — this is the seam that lets one component description serve both surfaces.

TuiComponentRenderer::__construct()

public function __construct(?Milpa\Live\Contracts\Tui\TerminalThemeInterface $theme = null, ?Milpa\Interfaces\Event\MilpaEventDispatcherInterface $dispatcher = null):

Parameters

Parameters of __construct()
NameTypeDescription
$theme?Milpa\Live\Contracts\Tui\TerminalThemeInterface
$dispatcher?Milpa\Interfaces\Event\MilpaEventDispatcherInterface

TuiComponentRenderer::supportsTarget()

public function supportsTarget(Milpa\Live\ValueObjects\RenderTarget $target): bool

True only for {@see \Milpa\Live\ValueObjects\RenderTarget::TUI} — this renderer produces terminal lines, not markup.

Parameters

Parameters of supportsTarget()
NameTypeDescription
$targetMilpa\Live\ValueObjects\RenderTarget

TuiComponentRenderer::render()

public function render(Milpa\Live\Contracts\Component\ComponentDefinitionInterface $component, Milpa\Live\ValueObjects\RenderRequest $request): Milpa\Live\ValueObjects\RenderResult

Renders one Live component to terminal lines, using the same component definition and state snapshot the HTML renderers consume.

Parameters

Parameters of render()
NameTypeDescription
$componentMilpa\Live\Contracts\Component\ComponentDefinitionInterface
$requestMilpa\Live\ValueObjects\RenderRequest