This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
JointJS is a JavaScript/TypeScript diagramming library for building visual and no-code/low-code applications. It's a Yarn workspace monorepo with multiple packages.
Stack: Node 22.14.0, Yarn 4.18.0, TypeScript 5.8 (5.9 in joint-react),
Grunt (build), QUnit/Karma/Mocha/Jest (testing)
# Install dependencies
yarn install
# Build distribution files (runs Grunt)
yarn dist
# Run all tests (QUnit + Jest + TypeScript checks)
yarn test
# Run specific test types
yarn test-server # Server-side tests (Node.js)
yarn test-client # Client-side tests (Browser with Karma)
yarn test-ts # TypeScript type definition tests
yarn test-e2e # End-to-end tests (Puppeteer)
# Linting
yarn lint # Check all packages
yarn lint-fix # Auto-fix errors
# Build bundles
yarn build
yarn build-bundlesFor joint-react Jest tests:
cd packages/joint-react
yarn jest --testPathPatterns="ComponentName"- @joint/core - Main diagramming library (MVC architecture, SVG rendering)
- @joint/react - React bindings and hooks (Rollup + esbuild, Storybook)
- @joint/layout-directed-graph - Graph layout algorithms
- @joint/layout-msagl - Microsoft MSAGL layout integration
- @joint/shapes-general - General-purpose diagram shapes
- @joint/eslint-config - Shared ESLint configuration
The library follows an MVC pattern:
mvc/- Base MVC components: Model, View, Collection, Events, Domdia/- Diagramming API built on MVC:Graph.mjs- Graph data structure and cell managementPaper.mjs- SVG canvas and rendering engineElement.mjs/ElementView.mjs- Diagram nodesLink.mjs/LinkView.mjs- Connections between elements
g/- Geometry library (points, lines, curves, polygons, matrices)V/- Vectorizer for SVG manipulationconnectors/- Link path strategies (line, curve, bezier, jumpover)routers/- Link routing algorithms (manhattan, orthogonal, metro)anchors/- Connection point anchors on elementshighlighters/- Visual highlighting mechanismslinkTools/,elementTools/- Interactive manipulation toolsshapes/- Built-in shapes (standard)layout/- Built-in layouts (port, port label)alg/- Graph algorithms (DFS, BFS, shortest path)
export { anchors, linkAnchors, config, connectionPoints, connectionStrategies,
connectors, dia, env, highlighters, layout, mvc, routers, setTheme,
util, version, linkTools, elementTools, V, Vectorizer, g };/packages/joint-core/test/jointjs/- QUnit tests for core functionality/packages/joint-core/test/jointjs-nodejs/- Mocha tests run bytest-server/packages/joint-core/test/geometry/- Geometry library tests/packages/joint-core/test/vectorizer/- SVG vectorizer tests/packages/joint-core/test/ts/,test/ts-exports/- TypeScript definition validation/packages/joint-core/test/e2e/- Puppeteer E2E tests/packages/joint-react/src/- Jest tests with @testing-library/react, colocated in__tests__folders
Releasable changes need a changeset in /.changeset. Before writing one, read
the Changeset format section of CONTRIBUTING.md - it defines the required
frontmatter, the scope - description changelog style (dia.Paper, anchors,
<Paper />, ...), and the backtick/() conventions - and follow it exactly.
- Change tracking: Models emit
change:*events;changeIdevent triggers only when ID actually changes - Workspace commands: Use
yarn workspaces foreach --all -tvv run <cmd>for cross-package operations - TypeScript: Strict mode enabled; the settings are per package, not
repo-wide.
tsconfig.common.jsonaddsnoUnusedLocals,noUnusedParametersandnoImplicitReturns, and is used byjoint-cli,joint-decoratorsand theshapes-generalpackages -joint-coreandjoint-reacteach have their own - ESLint: Uses flat config format (v9) via
@joint/eslint-config