Skip to content
docsv0.25.1

ComponentPresentation

What a component needs on the page besides its markup, declared by the component itself. A component used to be four pieces in four packages: its contract here, its template in the HTML transport, its design contract in a npm package, and its stylesheet in whichever CONSUMER happened to render it. The last one had no seam at all — a plugin could register a component but not dress it, so its look had to be patched into somebody else's bundle. This is that seam. Messages ride the same declaration rather than a catalogue of their own, and that is the point: a component whose text lived somewhere else would drift from its markup exactly the way the styles did. It is also why `messages` belongs HERE, beside a render-target-agnostic contract, while `styles` names an HTML file — "no results" is the same sentence in a terminal, a stylesheet is not. Paths are ABSOLUTE and the component builds them from its own location (`__DIR__`), because the component is the only thing that knows where its package lives. They are read by the render target that understands them — the HTML orchestrator reads `styles`; a TUI target would ignore it — which is why this stays a declaration and never a loaded string: the contract is machine-readable and travels into catalogues, and a stylesheet's bytes have no business there.

ComponentPresentation::__construct()

public function __construct(?string $styles = null, ?string $script = null, ?string $messages = null):

Parameters

Parameters of __construct()
NameTypeDescription
$styles(string | null)Absolute path to the component's stylesheet.
$script(string | null)Absolute path to the component's client script.
$messages(string | null)Absolute path to the component's message catalogue.

ComponentPresentation::declaresAnything()

public function declaresAnything(): bool

Whether this component asks the page for anything at all. Most components declare nothing, and the page must cost nothing for them — no empty tag, no filesystem call for a path that was never named.