Skip to content

Setup, TypeScript and Nuxt ​

How to load the package in a Vue or Nuxt application, type your data, import the stylesheet under strict TypeScript settings, and run the core on a server or in a Worker. For installation and a first component, start with Getting started.

Node.js and TypeScript ​

The package exports ES modules. Use @eightkk/vue-weave/core for calculations on a server or in a worker; that entry runs without Vue or browser globals. Both public entries support module: NodeNext with moduleResolution: NodeNext, as well as bundler-based TypeScript applications. Relative imports in the emitted declarations use explicit .js paths so NodeNext can resolve them. The build also finalizes Vue component re-exports to resolve the generated .vue.d.ts files in that mode. Vue applications should import the components from the root and load @eightkk/vue-weave/style.css once.

Both components are generic over their item types. Type the data of your items, for example NetworkNode<MyData>[] or TimelineBar<MyData>[], and the slot props, layout, columns callbacks and export label callbacks receive that type without casts. For a template ref, use useTemplateRef, which vue-tsc infers from the template, or NetworkGraphExposed and GanttChartExposed; InstanceType<typeof NetworkGraph> keeps working with the default types. See Typed data.

For installation, follow the README: npm install @eightkk/vue-weave, with Vue ^3.5.0 as a peer dependency.

The stylesheet and TypeScript ​

Load the stylesheet once in the application, usually with import '@eightkk/vue-weave/style.css' in its entry file. The package exports it at that path (the file is dist/style.css). Vite and other bundlers with CSS support handle the import. In a setup without a CSS loader, add the file to your build or serve it and link it, for example by copying node_modules/@eightkk/vue-weave/dist/style.css to your static assets; in Nuxt, list it in css (see Nuxt).

The package ships no type declaration for the stylesheet. Importing the components never needs one: the declarations work with noUncheckedSideEffectImports. With that option enabled, TypeScript reports the side-effect import import '@eightkk/vue-weave/style.css' unless your project declares CSS modules. Vite projects get that declaration from vite/client (a /// <reference types="vite/client" /> line or "types": ["vite/client"] in tsconfig.json). Elsewhere, add one to a declaration file of your own:

ts
// src/assets.d.ts
declare module '*.css' {}

Core only: servers and Workers ​

@eightkk/vue-weave/core does not import Vue, the DOM or browser globals at runtime, so scheduling, layout, interchange and SVG export run in Node.js, Workers and serverless functions. The package still declares Vue as a required peer dependency (^3.5.0); it is not marked optional (peerDependenciesMeta), so npm install @eightkk/vue-weave installs Vue as well, even when you only import @eightkk/vue-weave/core. That costs disk space but no runtime work, because the core never loads it. To leave Vue out of a core-only deployment, install with npm install @eightkk/vue-weave --omit=peer and use the same flag for later installs (or omit=peer in the project's .npmrc); note that it omits every peer dependency of the project. Other package managers have their own peer dependency settings.

Nuxt ​

Install the package as described in the README, then add the stylesheet once in the Nuxt application.

ts
// nuxt.config.ts
export default defineNuxtConfig({
  css: ['@eightkk/vue-weave/style.css'],
})

Import components explicitly in a page or component.

vue
<script setup lang="ts">
import { NetworkGraph, type GraphEdge, type NetworkNode } from '@eightkk/vue-weave'
const nodes: NetworkNode[] = [{ id: 'root', label: 'Root' }]
const edges: GraphEdge[] = []
</script>
<template>
  <NetworkGraph :nodes="nodes" :edges="edges" />
</template>

The library accesses DOM measurement and ResizeObserver after mounting. Initial server rendering uses deterministic fallback viewport dimensions, then measures the actual container. Vue useId supplies instance-specific SVG marker IDs. Keep server/client data and formatTime output consistent. For timezone-specific labels, use Intl.DateTimeFormat with an explicit timeZone and locale.

Released under the MIT License.