vectojs-core-runtime
VectoJS Core Runtime
Use this skill to build canvas-native VectoJS scenes that remain accessible, automatable, and cleanly disposable.
Core workflow
- Confirm installed package versions and inspect local source/docs when exact API behavior matters.
- Start from
@vectojs/coreprimitives: oneSceneper canvas,Entitysubclasses for custom drawing, and the built-inRect/Circle/Groupshape primitives (1.9.0+) for plain boxes, dots, and transform containers — no subclass needed. - Develop with
@vectojs/devtoolsattached. Add the dep and gateattachDevtools(scene, …)behind a?debugquery flag so it never ships; the headless layer (pickInScene,inspectEntity,auditScene,auditSceneSelection,diagnoseDirty,inspectText) is the fast path for verifying geometry/state in tests and agent loops without the panel. One devtools instance per inspected Scene; detach on unmount. - Use world/local coordinate conversion in hit tests. Do not subtract only
this.xonce nested transforms, scale, or rotation are possible. - Expose semantics for interactive entities with
getA11yAttributes(). - Prefer
scene.renderMode = 'onDemand'for static or event-driven UI; callscene.markDirty()after external mutations. - Always call
scene.destroy()when the host framework unmounts.
For copyable examples, read references/scene-recipes.md.
Package layout
@vectojs/core owns the Scene/Entity runtime, renderers (Canvas/SVG/WebGL/WebGPU), a11y projection, and the Entity-based text renderers (MSDFTextEntity, SVGEntity, TextEntity/GridTextEntity). The lower-level engines are now standalone packages: @vectojs/text (BiDi, Arabic shaping, typography, MSDF fonts, prepared content grids), @vectojs/layout (LayoutEngine, LayoutWorkerManager, measurement), @vectojs/math (SpatialHashGrid, SpringPhysics), and @vectojs/animation (Easing, TweenDriver, SpringDriver). @vectojs/core depends on and re-exports all four, so import { LayoutEngine, SpringPhysics, … } from '@vectojs/core' and the @vectojs/core/{text,layout,renderer} subpaths keep working unchanged — prefer importing from the standalone packages only when you want a smaller dependency surface.