Skip to content
docsv0.3.0

ProgressBarRenderer

Determinate progress bar: `label ──────────── 42%` or indeterminate spinner when `value` is null. Compatible with `BackgroundJob::$progress` (0..1). The fill character is read from the theme's `symbol('progress-fill')` (default '█') and the track from `symbol('progress-track')` (default '─') so a theme can swap the look without touching this renderer. Node props (all optional): - `value` float|null Fraction complete in [0,1]. `null` => indeterminate. Default: 0. - `label` string Left-side label. Default: ''. - `showPercent` bool Append `NN%` after the bar. Default: true. - `barWidth` int Fixed bar width in columns. Default: remaining width after label/percent. - `indeterminate` bool Force indeterminate mode. Default: false (auto when value is null).

ProgressBarRenderer::supports()

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

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

Parameters

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

ProgressBarRenderer::render()

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

Draws the label, the bar and the percentage — or the indeterminate mark when `value` is null.

Parameters

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