Skip to content

JSON Canvas editing engine

State: open/verified · Kind: module · Audience: system

  • 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-vue package, which imports this engine.

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.

  • ICanvasContent types and validateCanvasData for untrusted canvas input
  • executeOperation/executeBatch over the immutable CanvasOperation kinds
  • SnapshotHistory undo/redo with checkpoints
  • Geometry: bounds, bezier routing, anchors, snap guides, resize math, hit testing
  • CanvasViewModel for pan/zoom and canvas/screen coordinate transforms
  • packages/ts/json-canvas-core/src/index.ts
  • consumed by packages/ts/json-canvas-vue/
  • consumed by solutions/augmented/apps/augmented_web/
  • packages/ts/json-canvas-core/

← Back to Capabilities