papirus
Описание
Языки
- TypeScript99,9%
- JavaScript0,1%
Papirus
TypeScript library for building interactive 2D diagrams and flowcharts on HTML Canvas. Supports nodes, edges, groups, styling, serialization, export, and interactivity.
About
Papirus is a diagram rendering and interaction engine designed to be embedded in any UI (SPA, static pages, design systems). The library provides:
with coordinate system, zoom, and panningDiagramRenderer- Set of elements (nodes/edges/groups) and base types
- Interaction managers (selection, drag, connection, history)
- Context menu and search/filtering
- Basic animations and animated edge flow
- Theming and styling via StyleManager
- Overlays (grid, minimap, rulers, guides) and export utilities
Installation
Requirements
- Node.js >=18
- A modern browser with Canvas API support (Chrome, Edge, Firefox, Safari)
Quick Start
Documentation
Features
Interactivity
Built-in includes:
- drag/select/connect/undo/redo/copy/paste
- Pan on empty canvas area
- Zoom with mouse wheel, pinch-to-zoom, two-finger pan
- Smart alignment to other nodes while dragging (with guide lines)
Default edge creation: drag from one node anchor point to another (no modifier key required).
Default keyboard shortcuts:
— delete selectionDelete/Backspace/Ctrl/Cmd + C— copy/pasteCtrl/Cmd + V— undoCtrl/Cmd + ZorCtrl/Cmd + Y— redoCtrl/Cmd + Shift + Z
Editable polyline edges:
supports draggable bend points.type: 'editable-polyline'- Mid-segment
controls add new bend points.+ - Double-click a bend point to remove it.
- Bend points support grid snapping and axis magnet behavior while dragging.
Elements & Groups
Content Layout and Edge Label Background
Node layout is built in two steps:
defines node content area (inside shape bounds).contentInsetdefines text inset inside content area.label.inset
Icon and text share the same content area:
- icon position is controlled by
+icon.placement;icon.inset - text alignment is controlled by
andlabel.style.align.label.style.verticalAlign
Edge labels support background styling through :
CompositeNode (Flex Components)
lets you build notation-specific visual structures as a component tree (, , , , ) with a flexbox-like layout engine:
Serialized composite components () include editor/integration fields:
— human-readable component caption for host editors.label— bindbindToPropertyvalue to a property name (textfor node display name).'__name__'— markbindsNotationIconsource as notation-level icon binding.icon
Styling
applies themes and classes to nodes/edges/text/ports/groups.
Built-in themes: , .
Serialization
Export
Overlays
Also available: , , , , , .
Framework Integrations
Papirus is framework-agnostic. It can be embedded in Vue/React/Svelte/vanilla apps.
Example
See for interactive local demos.
Versioning and Stability
Papirus follows Semantic Versioning.
Current major version is , so some API changes are still possible between minor releases.
Breaking and notable changes are documented in CHANGELOG.md.
Development
Useful commands:
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
Key governance and contribution files:
- CONTRIBUTING.md / CONTRIBUTING.ru.md
- SECURITY.md / SECURITY.ru.md
- CODE_OF_CONDUCT.md / CODE_OF_CONDUCT.ru.md
License
This project uses dual licensing:
for open-source usageAGPL-3.0-or-later- Commercial license for proprietary/closed-source commercial usage
See: