English
API reference
Vue Weave has two entry points. @eightkk/vue-weave is the Vue entry: the components, the composables and, re-exported, all of the core. @eightkk/vue-weave/core is the headless core: pure TypeScript that runs without Vue, the DOM or browser globals, in Node.js 22.18+, Workers and servers. The stylesheet is @eightkk/vue-weave/style.css.
ts
// In a Vue application
import { GanttChart, NetworkGraph, useEditHistory, scheduleTasks } from '@eightkk/vue-weave'
import '@eightkk/vue-weave/style.css'
// On a server or in a Worker: no Vue needed
import { scheduleTasks, layoutLayeredGraph, toMsProjectXml } from '@eightkk/vue-weave/core'The pages below show the hand-written reference from the repository's docs/ folder, which also ships in the npm package. The type reference is generated from the TypeScript declarations and lists every exported function, interface and type.
Map of the API
Components (@eightkk/vue-weave)
All components are controlled: they never change their props, and a user edit is emitted as a proposal that your code applies.
| Component | What it is |
|---|---|
| NetworkGraph | Interactive network graph: layouts, editing, groups, swimlanes, minimap, export |
| GanttChart | Controlled Gantt chart and timeline: dependencies, baselines, columns, spreadsheet editing, load histogram |
| TreeGrid | Tree grid and matrix with two-dimensional virtualization and cell, sheet and row editing |
| TaskBoard | Kanban board with columns, swimlanes and WIP limits |
| EventCalendar | Day, week and month calendar with resources and recurring events |
| GraphPalette and PropertyInspector | Shape palette and property form for a diagram editor around NetworkGraph |
Composables (@eightkk/vue-weave)
useLinkedSelection, useEditHistory, useEditTransaction, useTimelineView, useWindowedData and useAsyncGraphLayout wire core state to Vue: linked selection across views, undo and redo, saving through a server, searched and sorted timeline views, partial loading and layouts in a Worker.
Core (@eightkk/vue-weave/core)
| Area | Main exports |
|---|---|
| Core entry point | The table of every core export |
| Graph layout and routing | layoutLayeredGraph, extra layouts, ports, routeGraphEdges, incremental placement, quantity flows, viewport helpers |
| Graph algorithms and traversal | topologicalOrder, shortestGraphPath, centrality, communities, traverseGraph |
| Timeline and scales | createTimeScale, editTimeRange, row trees, typed fields and timeline views |
| Scheduling and resources | scheduleTasks, levelResources, calculateResourceLoad, actuals, earned value, diagnostics, plan comparison |
| Linked views and data | View bindings, time range exploration, diffStructure, windowed data, graph expansion, time buckets |
| Interchange and export | MS Project, iCalendar, CSV, Mermaid, GraphML, draw.io, snapshots, SVG export |
Cross-cutting topics
- Errors and validation: the shared ID rule, error classes and message formats.
- Theming and CSS variables:
--vw-*custom properties, the dark theme, class names, custom content and right-to-left layout. - Guides: Setup and Nuxt, Graph integration, Data, saving and linked views, Scheduling, Resources and plan analysis and Architecture and scope.
Entry points
Identifiers are nonempty strings and must be unique within their corresponding collection. Named port IDs are scoped to each node. Labels are rendered as Vue text. Escape/sanitize any HTML you supply in custom slots according to your application's trust boundaries.
The package is ESM-only. Import Vue components and shared types from @eightkk/vue-weave, headless calculations from @eightkk/vue-weave/core, and the stylesheet from @eightkk/vue-weave/style.css. Declarations support TypeScript's Bundler and NodeNext resolution. The core entry does not require Vue or browser globals at runtime. Node.js 22.18+ is the declared runtime baseline; Vue components require the Vue 3.5+ peer dependency. The package also exports @eightkk/vue-weave/package.json, so tools can read the installed version.
The stylesheet also ships opt-in vw-theme-dark and vw-theme-auto classes and forced-colors, reduced-motion and print rules; see docs/integration.md.
Compatibility and versioning
From 1.0.0, releases follow Semantic Versioning. A breaking change to the public API below is made only in a major release and is listed under "Breaking changes" in the changelog. Minor releases add backward-compatible, opt-in features; patch releases contain backward-compatible fixes.
The public API is:
- The names exported from
@eightkk/vue-weaveand@eightkk/vue-weave/core, with the types and signatures of their published declarations, and the@eightkk/vue-weave/style.cssand@eightkk/vue-weave/package.jsonentries. - The props (and their documented defaults), events and their payloads, slots and slot props, and exposed methods of NetworkGraph and GanttChart, as documented on this page.
- The
--vw-*CSS custom properties documented in Themes and localization, except those described there as internal (such as--vw-item-*and--vw-band-dash), and the classes you add yourself (vw-theme-dark,vw-theme-auto). - The snapshot format: a
schemaVersion: 1document written by a 1.x release is accepted byparseWeaveSnapshotandrestoreWeaveSnapshotof every later 1.x release.
Not covered, and allowed to change in a minor or patch release (noted in the changelog):
- The exact English text of error messages and of diagnostic
messagefields. The formats in Validation and errors describe the current texts. Branch on the error class (RangeErrororError) and on thecodeandidfields of diagnostics, not on message text. - The
vw-classes that the components emit, the generated DOM and SVG structure, and the exact bytes of server-rendered markup and of SVG export (exportSvg,renderGraphSvg,renderTimelineSvg,renderTaskBoardSvg,renderEventCalendarSvg,renderTreeGridSvg). Output is deterministic for the same input and version, and server rendering hydrates cleanly with the same version on the client, but markup can change between releases. Custom stylesheets and tests that rely on these classes or that structure may need updates; prefer slots,--vw-*properties, and roles and accessible names in tests. - Undocumented modules and files inside
dist/; import only the published entries.
Typed data
NetworkNode, GraphEdge, TimelineRow and TimelineBar take the type of their optional data as a type parameter that defaults to unknown: NetworkNode<D = unknown>, GraphEdge<D = unknown>, TimelineRow<D = unknown> and TimelineBar<D = unknown>. Both components are generic over the whole item types, so extra fields that an application adds to its items (for example NetworkNode<Owner> & { priority: number }) reach the slots and callbacks as well. Vue infers the parameters from the props in a template; nothing is written at the component. Without type arguments every type has unknown data.
| Component | Type parameters | Inferred from | Where the items come back |
|---|---|---|---|
| NetworkGraph | N extends NetworkNode = NetworkNode, E extends GraphEdge = GraphEdge, G extends NetworkGroup = never | nodes, edges, groups | node, edge, tooltip, node-toolbar, edge-toolbar, group and minimap-node slot props, layout, the exportSvg and exportPng label callbacks |
| GanttChart | R extends TimelineRow = TimelineRow, B extends TimelineBar = TimelineBar | rows, bars | row, cell, bar and tooltip slot props, columns (value, editable), creatable, the exportSvg and exportPng label callbacks |
Events and validators carry IDs and intervals, not items (select(id), node-move, connect, edit, cell-edit, row-move, context-menu targets and the others), so their types do not change; look an item up by its ID in your own typed array.
A graph with groups can collapse them, and a collapsed group is drawn as a proxy node: a GraphCollapsedNode (NetworkNode<GraphCollapsedNodeData>), whose edges are re-attached and may merge into an edge without data. That is why the graph's slots and callbacks receive GraphShownNode<N, G> and GraphShownEdge<E, G>: N and E alone without groups (G is never), and with groups also the proxy node and a GraphEdge<never>. Narrow before reading application fields, for example with node.data && 'collapsedGroup' in node.data.
vue
<script setup lang="ts">
import { NetworkGraph, type GraphEdge, type NetworkNode } from '@eightkk/vue-weave'
interface Task { owner: string }
const nodes: NetworkNode<Task>[] = [{ id: 'cut', label: 'Cut', data: { owner: 'Ada' } }]
const edges: GraphEdge<{ weight: number }>[] = []
</script>
<template>
<NetworkGraph :nodes="nodes" :edges="edges">
<template #node="{ node, box }">
<!-- node.data is Task | undefined -->
<text :x="12" :y="box.height / 2">{{ node.label }} · {{ node.data?.owner }}</text>
</template>
<template #edge="{ edge, path }">
<path :d="path" :stroke-width="edge.data?.weight ?? 1" />
</template>
</NetworkGraph>
</template>vue
<script setup lang="ts">
import { GanttChart, type TimelineBar, type TimelineColumn, type TimelineRow } from '@eightkk/vue-weave'
type Team = TimelineRow<{ lead: string }>
const rows: Team[] = [{ id: 'core', label: 'Core', data: { lead: 'Grace' } }]
const bars: TimelineBar<{ cost: number }>[] = [{ id: 'b', rowId: 'core', label: 'Build', start: 0, end: 3_600_000, data: { cost: 4 } }]
const columns: TimelineColumn<Team>[] = [{ id: 'lead', label: 'Lead', width: 96, value: row => row.data?.lead ?? '' }]
</script>
<template>
<GanttChart :rows="rows" :bars="bars" :columns="columns" :range="{ start: 0, end: 8 * 3_600_000 }">
<template #bar="{ bar }">{{ bar.label }} ({{ bar.data?.cost }})</template>
</GanttChart>
</template>Template refs: in a single-file component, useTemplateRef('graph') (Vue 3.5) is inferred by vue-tsc from the template, including the item types. To declare the type yourself, use NetworkGraphExposed<N, E, G> and GanttChartExposed<R, B>, the methods each component exposes, with the same type arguments as the props. InstanceType<typeof NetworkGraph> and InstanceType<typeof GanttChart> keep working and give the component instance with the default item types, so their exportSvg callbacks receive unknown data.
ts
import { ref, useTemplateRef } from 'vue'
import type { GanttChartExposed, GraphEdge, NetworkGraphExposed, NetworkNode, TimelineBar, TimelineRow } from '@eightkk/vue-weave'
const graph = useTemplateRef('graph') // inferred from <NetworkGraph ref="graph" ...>
const typedGraph = ref<NetworkGraphExposed<NetworkNode<{ owner: string }>, GraphEdge>>()
const chart = ref<GanttChartExposed<TimelineRow, TimelineBar<{ cost: number }>>>()
typedGraph.value?.exportSvg({ nodeLabel: node => node.data?.owner ?? node.label })
chart.value?.exportSvg({ barLabel: bar => `${bar.label} ${bar.data?.cost}` })The public component types are NetworkGraphComponent and GanttChartComponent. Core helpers that return the items they receive keep their types as well: moveTimelineRow, indentTimelineRow, outdentTimelineRow, removeTimelineBars, assignLanes, createTimelineRowTree, collapseGraphGroups, removeGraphElements, cloneGraphElements, searchGraphNodes and filterGraph, and the label callbacks of renderGraphSvg and renderTimelineSvg.