Headless-first
Pure state, layout, and geometry with no DOM coupling. Wire any renderer — React, Svelte, vanilla SVG, custom.
A headless, ontologically-grounded directed graph library. Zero dependencies. Production-grade.
A production-grade directed graph library built in three independent, composable layers.
For AI coding agents: llms.txt · llms-full.txt · llms-api.txt
| Package | Purpose | Use independently? |
|---|---|---|
@wity/graph-headless | State, layout, traversal, geometry, ontology | Yes |
@wity/graph-ui-compute | DOM geometry, interaction bindings | Yes (requires headless) |
@wity/graph-player | Temporal replay of graph snapshots | Yes (requires headless) |
@wity/graph | Re-exports all three | Convenience |
import {
GraphStore,
SelectionManager,
GraphCanvasState,
} from '@wity/graph-headless';
// Create the store
const store = new GraphStore({ viewport: { width: 1200, height: 800 } });
const selection = new SelectionManager(store);
const canvas = new GraphCanvasState(store, { width: 1200, height: 800, minZoom: 0.1, maxZoom: 5 });
// React to changes
store.on('layout:computed', ({ nodes, edges }) => render(nodes, edges));
selection.on('selection:changed', ({ selected }) => updateToolbar(selected));
// Add nodes and compute layout
store.ingest([
{ uid: 'a', type: 'continuant', title: 'Concept A' },
{ uid: 'b', type: 'continuant', title: 'Concept B', links: [{ targetUid: 'a' }] },
]);node:moved, node:status-changed, and node:style-changed let the renderer update a single node. nodes:changed is for bulk changes. Both exist.store.batch(fn) defers all events until the block completes.