Expand description
§pathland-render-html
A Pathland renderer that maps opcode frames onto declarative HTML
elements. Like every Pathland renderer it is a pure function of the opcode
stream: it retains only its own decoded output tree (a cache), never
application state, and emits WHAT the UI is — never layout rects. Native
browser layout does the positioning.
This is the “server-side render” / remote-projection target (Goal #15): the same opcode stream that drives a native backend drives this HTML document.
Frames are self-contained: apply(opcodes, strings) resolves SET_TEXT
by a relative offset into the frame’s own string section (no mirrored
arena), and every rendered element carries a stable data-pathland-id so a
client can hydrate it and apply later deltas in place.
Modules§
- css
- The renderer’s built-in CSS — delivered inline in a
<style>tag. - icons
- icons — this renderer’s canonical
ICON_NAME→ glyph mapping - role_
spec - Canonical
ROLE→ semantic HTML element mapping (spec/OPCODE.md §semantic properties) + typography-driven heading levels, shared with the TypeScript DOM client: the Rust renderer consumes these tables directly, andpathland-ts-codegenemits the TS equivalents intogenerated/role-spec.ts— so the semantic-tag / ARIA / heading mapping cannot drift between the renderers. - token_
spec - Canonical design-token conventions (spec/TOKENS.md), shared with the
TypeScript DOM client: the Rust renderer consumes these tables directly, and
pathland-ts-codegenemits the TS equivalents from them — so the--pl-*naming, thedark.scheme prefix, the generativespace.<N>family, and the length-token rules cannot drift between the renderers.
Structs§
- Document
Meta - Optional document metadata supplied by the host for one render call.
- Html
Renderer - A stateless, streaming HTML renderer. Each render call decodes a self-contained snapshot batch into a transient map, walks it once, and streams HTML text out — zero state retained across calls. A pure function of the opcode stream (Renderer Statelessness).
- Node
- A decoded node in the retained description.
Constants§
- MEDIA_
CONTROLLER_ SHELL_ STYLE - The
MEDIA_CONTROLLERshell’s inline style (spec/MEDIA.md). A media controller owns playback but renders nothing: the container is off-flow (position:absolute, 1×1, transparent) so it contributes no spacing while still being rendered — browsers refuse to route a<video>’s audio to the output when its ancestor isdisplay:none(the pipeline still runs andcurrentTimeadvances, so the failure is silent).visibility:hidden/display:noneare both wrong here for the same reason.