JSON Canvas editing engine
State: open/verified · Kind: module · Audience: system
Summary
Section titled “Summary”- Framework-agnostic domain model for JSON Canvas (Obsidian
.canvas) documents — spec types, validation, an immutable operation engine, undo/redo history, geometry math, and a pan/zoom view model — with no DOM or UI framework dependency. - Source-shipped (exports point at
src/); consumers compile it with their own bundler. - The Vue rendering and interaction surface lives in the sibling
@augment/json-canvas-vuepackage, which imports this engine.
Statement
Section titled “Statement”The package models JSON Canvas documents (the four node kinds, edges, groups) and exposes a mutation
engine — the CanvasOperation kinds (create/delete/update nodes and edges, move, resize, align,
distribute, match-size, duplicate, batch) executed immutably via immer — plus SnapshotHistory for
undo/redo, geometry helpers (bounds, bezier edge routing, anchor points, snap guides, hit testing),
and CanvasViewModel for pan/zoom and screen-to-canvas transforms. Nothing in it touches the DOM or
a UI framework: it is consumed by @augment/json-canvas-vue (the Vue 3 renderer) and by
solutions/augmented/apps/augmented_web, which together render and edit Obsidian .canvas files
for end users. The two split along the framework boundary and are siblings under the markdown
ecosystem core; see C-0029.
What it provides
Section titled “What it provides”ICanvasContenttypes andvalidateCanvasDatafor untrusted canvas inputexecuteOperation/executeBatchover the immutableCanvasOperationkindsSnapshotHistoryundo/redo with checkpoints- Geometry: bounds, bezier routing, anchors, snap guides, resize math, hit testing
CanvasViewModelfor pan/zoom and canvas/screen coordinate transforms
Underlying implementation
Section titled “Underlying implementation”- packages/ts/json-canvas-core/src/index.ts
- consumed by packages/ts/json-canvas-vue/
- consumed by solutions/augmented/apps/augmented_web/
Locations
Section titled “Locations”packages/ts/json-canvas-core/