You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Core seam for server-side and export embedders #37
Everything renderable goes through drawShape, but its browser dependencies are hardcoded: the global Path2D class, OffscreenCanvas/document canvases for measurement and hatch tiles, and the browser Image loader with its warming cache. Any server-side renderer (see #36) must fork or monkey-patch globals to reuse the engine. The paint order (Editor.shapesSorted()) and several geometry/layout helpers are likewise unreachable behind the exports map.
Proposal
A small, dependency-free, behavior-preserving seam:
setShapePlatform({ Path2D, measureCtx, tileCanvas }) — explicit backend injection (never global monkey-patching; the browser never calls it).
drawShape accepts per-render opts.images (pre-decoded bitmaps, bypassing the loader), opts.patternCache and opts.Path2D — no cross-request shared state.
Export the shared paint order as sortShapesForRender() (used by Editor.shapesSorted(), identical behavior), plus the textLayout / noteLayout / boundsUnion helpers embedders need.
Full type declarations. No new dependencies, no DOM touched, full suite green.
Follow-up to #33 territory (font stacks) but independent of it; together they are everything an out-of-tree headless renderer imports from core.
Activity