ClientRuntimeAdapterInterface
The client-side JS runtime a rendered component boots into (e.g. Alpine). A renderer that produces markup for a live client MUST consult this contract instead of hardcoding runtime-specific attributes or bootstrap data, so swapping the client runtime does not require touching the renderer. Implementations are stateless: every method is a pure projection of its arguments.
ClientRuntimeAdapterInterface::name()
abstract public function name(): stringThe runtime's identifier (e.g. `'alpine'`), also embedded verbatim into {@see rootAttributes()} and {@see bootPayload()} so the client can self-identify which runtime rendered a given root.
ClientRuntimeAdapterInterface::rootAttributes()
abstract public function rootAttributes(Milpa\Live\ValueObjects\ComponentContract $contract, Milpa\Live\ValueObjects\StateSnapshot $state): arrayAttributes that the renderer should add to the component root.
Parameters
| Name | Type | Description |
|---|---|---|
| $contract | Milpa\Live\ValueObjects\ComponentContract | |
| $state | Milpa\Live\ValueObjects\StateSnapshot |
ClientRuntimeAdapterInterface::bootPayload()
abstract public function bootPayload(array $contracts): arrayThe payload embedded on the page so the client runtime knows which component contracts it must be ready to boot.
Parameters
| Name | Type | Description |
|---|---|---|
| $contracts | array<int, ComponentContract> | All contracts the current page/response may render. |
Returns
Runtime-specific, JSON-serializable boot payload.
ClientRuntimeAdapterInterface::assets()
abstract public function assets(): arrayThe static client-runtime assets (e.g. `<script>` src) the page MUST include for the runtime to function.
Returns
Asset kind (e.g. `'script'`) => URL.