TuiNode
One node in the retained TUI tree — the TUI analog of an HTML element. `$type` selects which {@see \Milpa\Live\Contracts\Tui\TuiNodeRendererInterface} paints this node (see {@see \Milpa\Live\Contracts\Tui\TuiNodeRendererInterface::supports()}); `$props` is renderer- and layout-engine-defined (e.g. `'hidden'`, `'overlay'`, `'layer'`, `'width'`/`'height'`/`'flex'`, `'gap'`, `'padding'`) rather than a fixed schema, mirroring how HTML attributes are interpreted differently per element/CSS rule.
TuiNode::__construct()
public function __construct(string $id, string $type, array $props = [], array $children = [], bool $focusable = false):Parameters
| Name | Type | Description |
|---|---|---|
| $id | string | Unique id within the tree; MUST NOT be empty. |
| $type | string | The node type, dispatched to a matching node renderer; MUST NOT be empty. |
| $props | array<string, mixed> | Renderer/layout-engine-defined properties. |
| $children | array<int, TuiNode> | Child nodes, laid out according to `$props['layout']` (vertical by default). |
| $focusable | bool | Whether this node participates in keyboard focus rotation. |
Throws
\InvalidArgumentException If `$id` or `$type` is empty, or if `$children` contains a non-{@see TuiNode} value.
TuiNode::hidden()
public function hidden(): boolWhether the layout engine MUST exclude this node (and its subtree) from {@see \Milpa\Live\ValueObjects\Tui\TuiLayoutFrame}. Reads `props['hidden']`.
TuiNode::overlay()
public function overlay(): boolWhether this node is positioned independently of normal document flow (e.g. centered/floating over its parent) rather than participating in the parent's vertical/horizontal allocation. Reads `props['overlay']`.
TuiNode::layer()
public function layer(): intThe paint-order layer this node belongs to; higher layers are painted on top of lower ones. Reads `props['layer']`, defaulting to `100` for {@see overlay()} nodes and `0` otherwise, so overlays sit above normal content without every overlay node having to set `layer` explicitly.