ComponentAssetOrchestrator
Gathers what the components of one page declared, and emits it once. This is the seam a component previously did not have. Registering a component was always possible; DRESSING one was not, because its stylesheet had to be patched into whichever package happened to render it — so a plugin could contribute markup and behaviour but never a look, and the promise that the component system was extensible by registry was false at exactly that point. Three payloads travel by this one seam — markup's styles, its script, and its words. Splitting them would build the second system this was meant to end: today `milpa/admin` holds one component system's look in a 4,849-line bundle and its words in a 414-string `private const`, and the two have already drifted. The page hands over the contracts it is about to render — the same list {@see \Milpa\Live\Contracts\Client\ClientRuntimeAdapterInterface::bootPayload()} already receives — and gets back one `<style>` and one `<script>`. Emission is keyed by `name@version`, so a component used fifty times costs its stylesheet once: the alternative, per-instance styling, was measured at ~954 bytes an instance in a system that shipped it. Nothing here reaches the filesystem for anything a contract did not name, and nothing is written.
ComponentAssetOrchestrator::__construct()
public function __construct(Milpa\Live\Assets\CssScoper $scoper = new CssScoper(), Milpa\Live\Assets\ComponentMessages $messages = new ComponentMessages(), ?Milpa\Live\Assets\PresentationOverrides $overrides = null):Parameters
| Name | Type | Description |
|---|---|---|
| $scoper | Milpa\Live\Assets\CssScoper | |
| $messages | Milpa\Live\Assets\ComponentMessages | |
| $overrides | ?Milpa\Live\Assets\PresentationOverrides |
ComponentAssetOrchestrator::collect()
public function collect(array $contracts, string $locale = Milpa\Live\Assets\ComponentMessages::DEFAULT_LOCALE): Milpa\Live\Assets\PageAssetsGathers what this page's components declared: read, scoped, deduplicated, ready to embed.
Parameters
| Name | Type | Description |
|---|---|---|
| $contracts | array<int, ComponentContract> | Every contract the page may render. |
| $locale | string | The language this page is being read in. |