Canvas SDK

@internote/canvas-sdk is how an environment is written — the environments (graph, code, …) a scene’s canvas is built from. One definition covers both sides: the attributes and child vocabulary the compiler validates, and the surface, animation and chrome the reader sees.

@internote/canvas-sdk566 exports5 entry points
On this page

Build Internote canvas environments — the graph, code, … a scene's canvas holds — and declare how the compiler reads them.

This is the package root, and it is React-free: everything here runs in a browser, on a server, in a build script or under node --test. It holds both halves of an environment that are not drawing:

  • Defining and registering — defineEnvironment, EnvironmentDefinition, the EnvironmentRegistry, and the declarations a definition carries: toolbar items, footer, storage tiers, plugin manifest.
  • The compile side — attribute and value types, the library builder, the refiner kit for parsing your own value types, and the semantic pass a validate hook is written with.
  • Reading content — compiled documents, the node tree (flatNodes, nodesOf, attrOf…), expressions, data columns, colours, text measurement, parameters, the reader's view.
  • Time — steps, cues, keyframe tracks and the per-environment EnvironmentAnimationRuntime.
  • Live values — the LiveValueStore a surface publishes computed numbers into and prose reads them from.

The other entry points:

  • @internote/canvas-sdk/react — what a surface is drawn with: the hooks, labels, maths, footer controls and chrome components.
  • @internote/canvas-sdk/host — for an application embedding the canvas: the document host, the scene view and the adapters it is given.
  • @internote/canvas-sdk/compile — the compile pipeline. Server only.
  • @internote/canvas-sdk/testing — a headless host and a worked example.
  • @internote/canvas-sdk/styles — the stylesheet, imported once.

The package depends on @internote/chalk, the language, for the compiled document's shapes, the expression grammar and the base vocabulary, and on React and KaTeX for the React entry points.

#By area

#Entry points

The root is React-free; @internote/canvas-sdk/react is the half that draws. @internote/canvas-sdk/styles is the stylesheet, imported once by the application, and exports nothing.

@internote/canvas-sdk
packages/canvas-sdk/src/index.ts
491
@internote/canvas-sdk/compile
packages/canvas-sdk/src/compile/index.ts
Documented under Compiling.
3
@internote/canvas-sdk/host
packages/canvas-sdk/src/host/index.ts
Documented under Host.
23
@internote/canvas-sdk/react
packages/canvas-sdk/src/react/index.ts
Documented under Drawing and Toolbar and footer.
94
@internote/canvas-sdk/testing
packages/canvas-sdk/src/testing/index.ts
Documented under Testing.
15

Last updated