How clientio/joint works
1. This is a Yarn workspaces monorepo for the JointJS ecosystem. The center of gravity is packages/joint-core, with companion packages for React integration, reusable shape libraries, layout algorithms, decorators, a CLI utility, and a Vitest SVG mock plugin. The examples/ directory is a large catalog of standalone apps that consume these packages and serve as reference architectures.
2. packages/joint-core is the core diagramming engine. It is SVG-based and MVC-oriented, with the main runtime objects under src/dia such as Graph, Paper, Cell, Element, Link, views, tools, and layer management. This package is the foundation for everything else in the repo.
3. The core rendering and interaction pipeline is: graph model updates in dia/Graph and related cell classes, views render onto dia/Paper, tools/highlighters modify interaction and appearance, and utilities/geometry helpers support layout, routing, and hit-testing. The core also includes anchoring, connection points, connectors, routers, and layout helpers, which are the main boundaries for diagram behavior customization.
4. packages/joint-core/src/shapes and the separate packages/joint-shapes-general / packages/joint-shapes-general-tools packages provide shape catalogs and shape-specific controls. These are not the rendering engine itself; they are higher-level shape definitions and interactive tools built on top of core primitives.
5. packages/joint-layout-directed-graph and packages/joint-layout-msagl are standalone layout engines. They consume graph-like input and produce geometry/layout results that JointJS can apply to cells and links. The examples/layout-* folders demonstrate these as external algorithm integrations rather than core responsibilities.
6. packages/joint-react is the main framework adapter. It bridges React component trees to JointJS Graph/Paper state through contexts, hooks, data stores, and renderer components. The package is organized around paper, graph-provider, measured-node, port, text-node, and highlighter components, showing that React is used as a declarative UI layer on top of the imperative diagram engine.
7. The data flow in joint-react is: React props/state feed a graph store and paper context, hooks create/update/remove cells, and measured DOM nodes are observed to size elements before JointJS renders them. This package is the boundary where React lifecycle, DOM measurement, and JointJS graph synchronization meet.
8. packages/joint-decorators adds TypeScript decorators and parsing helpers for a more declarative way to define JointJS models/views/SVG attributes. It is a small meta-programming layer that sits above core and helps authoring class-based extensions.
9. packages/joint-cli is a Node-based utility for listing and downloading examples or resources from GitHub. It is operational tooling, not part of the diagram runtime, and its tests cover GitHub and download behaviors. It indicates the repo has some distribution/support automation beyond the library packages themselves.
10. The examples/ directory is the primary consumer surface. Most examples are self-contained browser apps built with Vite or Webpack, using plain JavaScript, TypeScript, Angular, or React depending on the example. These demonstrate distinct diagramming concerns such as ports, routing, layouts, custom shapes, drag/drop, and integration patterns.
11. packages/joint-core/demo is a second, older/demo-oriented consumer surface for JointJS Core. These demos are largely browser-based HTML/JS assets and show the lower-level API directly. They are useful for understanding raw core boundaries because they bypass framework adapters.
12. Testing and build infrastructure are split by package and runtime. joint-core uses a legacy Grunt/Rollup/TypeScript build pipeline with browser, node, and type tests; joint-react uses Jest, Storybook, and Vite; layout packages have Karma/Rollup setups; the repo root also has GitHub Actions workflows for CI, publishing docs, CodeQL, and stale issue automation. This matters architecturally because the repo supports both library distribution and documentation/demo publishing.
13. The main architecture boundary is therefore: core diagramming primitives and rendering in joint-core, optional higher-level adapters and libraries in sibling packages, and many example applications that demonstrate how to compose those pieces in different UI stacks. An architecture diagram should show joint-core at the center, with layout/shape/react/decorator packages as satellites, and examples/tests as consumers around the edge.
Main entry points: joint-core joint-core · joint-react joint-react · examples examples · workflows workspace CI
Components 21
Workspace
Yarn monorepo and repo-level automation
- workspace CI · Root-level build, publishing, code scanning, and stale-issue workflows that support the monorepo.
.github/workflows
Core engine
JointJS runtime and its main subsystems
- joint-core · Primary JointJS runtime; MVC-based graph model, SVG paper rendering, tools, routing, geometry, shapes, and legacy demos.
packages/joint-core - Graph model · Graph, cell, element, link, layers, and topology/hierarchy state management.
packages/joint-core/src/dia - Paper view · Paper, cell/link views, layer views, and SVG rendering/interaction surface.
packages/joint-core/src/dia - Tools & highlighters · Cell/link tools and highlighters that modify interaction and appearance.
packages/joint-core/src - Geometry & routing · Geometry primitives plus anchors, connection points, connectors, routers, and layout helpers.
packages/joint-core/src - Built-in shapes · Standard shapes and shape-related exports bundled with the core runtime.
packages/joint-core/src/shapes
Adapters & libraries
Packages layered on top of the core engine
- joint-react · Declarative React layer that syncs component trees with JointJS graph and paper state.
packages/joint-react - Graph store · Graph-provider, paper context, and store logic that coordinate JointJS state with React lifecycle.
packages/joint-react/src - Paper UI · Paper component tree, measured-node support, and rendering bridges for SVG/HTML content.
packages/joint-react/src/components - React hooks · Hooks for creating, updating, removing, and observing cells plus paper/graph wiring.
packages/joint-react/src/hooks - Ports & highlighters · Declarative ports, text nodes, and highlighter components exposed to React users.
packages/joint-react/src/components - shapes-general · Reusable higher-level shape definitions built on top of joint-core primitives.
packages/joint-shapes-general - shape tools · Interactive controls for the general shape library and shape-specific editing affordances.
packages/joint-shapes-general-tools - directed-graph layout · Standalone directed-graph layout package that computes geometry for JointJS cells and links.
packages/joint-layout-directed-graph - MSAGL layout · Standalone MSAGL-based layout engine for graph geometry generation.
packages/joint-layout-msagl - joint-decorators · TypeScript decorators and parsing helpers for declarative JointJS model/view authoring.
packages/joint-decorators - joint-cli · CLI for listing and downloading examples/resources from GitHub; operational tooling around the repo.
packages/joint-cli - svg mock plugin · Vitest SVG mock plugin package with React and Vue test fixtures.
packages/joint-vitest-plugin-mock-svg
Consumers
Example apps and demo surfaces that exercise the libraries
- examples · Large catalog of standalone apps demonstrating ports, routing, layouts, shapes, and framework integrations.
examples - core demos · Older JointJS Core demo catalog showing lower-level APIs directly.
packages/joint-core/demo
Connections 25
- joint-core → Graph model: owns · Core runtime centers on graph and cell state.
- joint-core → Paper view: renders · Model changes are rendered through Paper and views.
- joint-core → Tools & highlighters: exposes · Interaction and appearance are extended via tools and highlighters.
- joint-core → Geometry & routing: computes · Core diagrams depend on geometry, anchors, routers, and connectors.
- joint-core → Built-in shapes: bundles · Standard shapes ship with the core package.
- joint-react → Graph store: syncs · React state is bridged into graph and paper contexts.
- joint-react → Paper UI: renders · Components assemble the paper surface and measured DOM nodes.
- joint-react → React hooks: orchestrates · Hooks create, update, and remove JointJS cells.
- joint-react → Ports & highlighters: provides · Declarative ports, text, and highlighters sit above the core engine.
- shapes-general → joint-core: extends · General shapes are authored on top of core primitives.
- shape tools → shapes-general: controls · Tools customize the reusable shape catalog.
- directed-graph layout → joint-core: feeds · Layout results are applied to JointJS graphs and links.
- MSAGL layout → joint-core: feeds · MSAGL geometry is consumed by JointJS diagrams.
- joint-decorators → joint-core: augments · Decorator helpers sit above core models and views.
- examples → joint-core: consumes · Examples primarily exercise the core engine.
- examples → joint-react: consumes · Some examples demonstrate the React adapter.
- examples → directed-graph layout: demonstrates · Layout examples showcase directed-graph integration.
- examples → MSAGL layout: demonstrates · Layout examples showcase MSAGL integration.
- examples → shapes-general: uses · Example apps consume reusable shape catalogs.
- core demos → joint-core: exercises · Core demos use the low-level API surface directly.
- joint-cli → examples: manages · CLI tooling lists and downloads example resources.
- svg mock plugin → joint-react: tests · The mock plugin package includes React/Vue fixture coverage.
- workspace CI → joint-core: builds · CI covers core build, tests, and publishing tasks.
- workspace CI → joint-react: builds · CI and docs publishing cover the React package.
- workspace CI → joint-cli: builds · CI validates operational tooling as part of the workspace.