Skip to content
docsv0.3.0

CancellableLoaderRenderer

A loader that can be cancelled by the user pressing Escape. The TUI analog of pi-tui's `CancellableLoader`. Extends {@see LoaderRenderer} with an `aborted` visual state and a `loader.aborted` event published to the {@see TuiEventBusInterface} when the node's props carry `aborted: true`. The caller is responsible for routing Escape to set that prop — this renderer does not handle keyboard input itself, keeping the "node-in/frame-out" purity of every other renderer in this namespace. The `loader.aborted` event mirrors the `paste.received` convention (typed string + structured payload) so the same bus subscribers can react to either. Payload: `{nodeId, label, reason}`. Node props (all optional, in addition to LoaderRenderer's): - `aborted` bool Show the canceled state and publish the event when true. Default: false. - `nodeId` string Id of the node, included in the event payload for routing. Default: node.id. - `reason` string Caller-provided abort reason, included in the event payload. Default: 'user_canceled'.

CancellableLoaderRenderer::__construct()

public function __construct(?Milpa\Live\Contracts\Tui\TuiEventBusInterface $events = null):

Parameters

Parameters of __construct()
NameTypeDescription
$events?Milpa\Live\Contracts\Tui\TuiEventBusInterface

CancellableLoaderRenderer::supports()

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

True only for `cancellable-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

CancellableLoaderRenderer::render()

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

Draws the spinner together with the hint that Escape cancels it.

Parameters

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