Prismv0.4

runtime · built on the HTML-in-Canvas proposal

Runtime infrastructure for managed HTML/CSS canvas surfaces.

Prism does not replace your renderer. It gives canvas applications managed DOM-authored surfaces, with runtime support for registration, paint lifecycle, coordinate conversion, invalidation, readiness, and cleanup.

npm i @synthesisengineering/prism
<canvas> · 720 × 360Preview mode

Enable the browser flag to view the live Prism runtime.

chrome://flags/#canvas-draw-element
surface · #s_1f3
Surface registeredbounds · 184 × 92
origin · (28, 86)
attached · <canvas>
register.tsts
const runtime = new CanvasRuntime(canvas);
runtime.registerSurface(el, opts);
await runtime.paintOnce();
tooltip · surface#3
x · y460.0, 180.5
value0.612
Prism paint pass
registered
paintOnce()
ready

01 · Boundaries

What Prism owns

Prism is a DOM-surface runtime, not a renderer or framework. It manages surfaces, paint, and timing and stays out of your render decisions.

App owns

Userland
  • state01
  • data02
  • templates03
  • transforms04
  • rendering decisions05
  • animation loop06
  • interaction state07

Prism owns

Runtime
  • CanvasRuntime01
  • CanvasSurface registration02
  • paint lifecycle03
  • invalidation04
  • CSS-pixel bounds05
  • paint readiness06
  • cleanup07

02 · Pipeline

The surface model

One pass, four stages. Prism owns registration and painting; your code owns the source element and the final canvas frame.

01 · App

HTML elementyour DOM/JSX

02 · Prism

Prism surfaceregisterSurface()

03 · Prism

canvas paint passpaintOnce()

04 · App

canvas framedisplay · toBlob()

03 · Reference apps

Examples

Three apps built on Prism. Start with the one closest to what you are shipping.