π΅ TypeScript BindingsΒΆ
Official TypeScript interfaces for the Visualli specification. These bindings provide type-safe interfaces corresponding to the JSON Schema.
Use them to validate, create, and serialize valid .visualli data programmatically in any TypeScript project.
InstallationΒΆ
npm install @visualli/bindings
The TypeScript bindings are also bundled within @visualli/core.
UsageΒΆ
These types are purely for type-checking and interface implementation. They do not include parsing logic.
import { Layer, Node, VisualliFragment } from '@visualli/bindings';
// Create typed objects
const node: Node = {
id: 'node-1',
position: { x: 0, y: 0 },
data: {
label: 'Central Idea',
summary: 'A short description of the core concept'
}
};
const layer: Layer = {
type: 'layer',
id: 'layer-1',
level: 0,
nodes: [node],
connections: [],
containers: []
};
// Type narrowing
function processFragment(fragment: VisualliFragment) {
if (fragment.type === 'meta') {
console.log('Version:', fragment.version);
} else if (fragment.type === 'layer') {
console.log('Layer Level:', fragment.level);
}
}
DevelopmentΒΆ
The TypeScript interfaces are generated automatically from the master JSON Schema.
If you are contributing to the spec, do not edit this file directly. Instead:
1. Modify visualli.schema.json at the repo root.
2. Run make generate to update the interfaces.
For more details on the build process, see the Contributing guide.