AlpineRuntimeAdapter
The Alpine.js {@see ClientRuntimeAdapterInterface}: marks rendered root elements with `data-milpa-*` attributes an Alpine component picks up, and describes the boot payload / static asset the HTML renderers embed so the browser knows which contracts are live and where to load the runtime script from. Stateless and side-effect-free — every method is a pure projection of its arguments.
AlpineRuntimeAdapter::name()
public function name(): stringThe runtime identifier this adapter targets, `"alpine"`.
AlpineRuntimeAdapter::rootAttributes()
public function rootAttributes(Milpa\Live\ValueObjects\ComponentContract $contract, Milpa\Live\ValueObjects\StateSnapshot $state): arrayRoot-element attributes an HTML renderer merges into a mounted component's wrapper tag so the client runtime can find it and bind to its `$state->componentId`.
Parameters
| Name | Type | Description |
|---|---|---|
| $contract | Milpa\Live\ValueObjects\ComponentContract | |
| $state | Milpa\Live\ValueObjects\StateSnapshot |
AlpineRuntimeAdapter::bootPayload()
public function bootPayload(array $contracts): arrayThe payload embedded in the page for the client runtime to bootstrap from: this adapter's {@see name()} plus a name/version/design-contract summary of every mounted component contract.
Parameters
| Name | Type | Description |
|---|---|---|
| $contracts | array |
AlpineRuntimeAdapter::assets()
public function assets(): arrayStatic assets a page rendering this runtime's components must load — currently just the Alpine runtime script.