Skip to content

serializeForCanvas

serializeForCanvas(buffer): CanvasCell[][]

Defined in: src/driver/web/canvas-serialize.ts:17

Flatten a ScreenBuffer into the compact, JSON-serializable grid the canvas client consumes (colors resolved to CSS up front). This is the server-side half of the canvas backend: it may touch the icon registry (and, transitively, Node-only deps), so it is kept out of canvas-renderer.ts — which must bundle cleanly for the browser.

Vector icons (heroicons, Seti file icons) are resolved to their raw SVG here and shipped on the cell, so the client can rasterize them natively at the device pixel ratio instead of drawing an emoji/glyph text fallback.

ScreenBuffer

CanvasCell[][]