$ show bpmn-io/bpmn-js
bpmn-js is a mature, extensible JavaScript library for rendering and editing BPMN 2.0 diagrams in the browser. It provides a full-featured modeler (Viewer, NavigatedViewer, Modeler) built on top of diagram-js, with support for import/export of BPMN XML and SVG, undo/redo, copy/paste, element replacement, grid snapping, auto-layout, and a rich set of modeling behaviors that enforce BPMN semantic rules. The architecture follows a modular dependency injection pattern (didi) with event-driven communication, command interceptors for undoable operations, and pluggable providers for context pads, palettes, popup menus, and renderers. The codebase is well-tested with hundreds of integration and unit tests, and includes benchmarks for large diagrams. It is actively maintained by the bpmn.io team and used widely in workflow and process automation tools.
The LLM identified 4 files worth highlighting for reuse:
Defines a comprehensive set of SVG path definitions for all BPMN shape types (events, gateways, tasks, markers) and provides `getRawPath` and `getScaledPath` methods to retrieve and scale paths based on container dimensions. This module is self-contained, has no internal dependencies, and can be extracted and reused in any SVG-based diagramming or icon library that needs BPMN-compatible shapes.
Implements a configurable property copier for BPMN model elements. It uses an event-based mechanism (`moddleCopy.canCopyProperty`, `canSetCopiedProperty`) to allow or deny property transfer during copy/paste operations, supporting primitives, nested objects, references, and extension elements. The pattern is reusable for any model-driven application that needs fine-grained control over property copying, and the module is decoupled from the rest of the modeling logic.
Provides pure mathematical functions for computing attachment points on lines, including closest point on a line segment, perpendicular projection, and distance calculations. These utilities are used by connection layout and snapping behaviors. The module has no dependencies on the rest of bpmn-js and can be extracted as a standalone geometry helper for any diagramming or CAD application.
Implements a Manhattan-style connection layout algorithm for BPMN flows (sequence flows, message flows, associations, compensation associations). It extends the diagram-js BaseLayouter and provides preferred layout directions, docking point preservation, and compensation-aware routing. The algorithm is self-contained and can be adapted for other diagram types that require orthogonal routing with configurable preferences.