@gramforge/images-wasm
v0.1.0
Published
The **JSR-publishable, Deno/browser-portable** Gramforge image renderer.
Readme
@gramforge/images-wasm
The JSR-publishable, Deno/browser-portable Gramforge image renderer.
It re-exports the node-free surface of @gramforge/images (its
./wasm entry): the six card tree builders (buildStatusTree,
buildFleetOverviewTree, …), the zod schemas, the ECharts→SVG chart projection,
the Takumi WASM backend, the resvg-wasm rasterizer, and renderCardWasm.
No node: builtin, no sharp, no native napi — the wasm module bytes and font
buffers are injected by the caller. That is exactly what lets it run:
- in Deno and on the edge (JSR-published, slow-types clean), and
- client-side in a browser — the Gramforge showcase Image Lab renders cards in-page from this package, no server round-trip.
On Node, prefer @gramforge/images directly for the native Takumi (napi) +
sharp fast paths; this package is the portable sibling that shares the same
tree builders and schemas.
Usage
import { buildStatusTree, renderCardWasm, STATUS_DIMENSIONS } from "@gramforge/images-wasm";
// `wasm` = the @takumi-rs/wasm module bytes; `fonts` = font buffers you fetched.
const tree = buildStatusTree({
template: "status",
agentName: "ci-runner",
level: "ok",
headline: "build passed",
detail: { kind: "text", value: "42 tests green" },
timestampIso: new Date().toISOString()
});
const png = await renderCardWasm(tree, STATUS_DIMENSIONS, { wasm, fonts });