@dskripchenko/diagrams 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Denis Skripchenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,69 @@
1
- # Temporary Holding Version
1
+ # @dskripchenko/diagrams
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![CI](https://github.com/dskripchenko/diagrams/actions/workflows/ci.yml/badge.svg)](https://github.com/dskripchenko/diagrams/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/@dskripchenko/diagrams.svg)](https://www.npmjs.com/package/@dskripchenko/diagrams)
5
+ [![license](https://img.shields.io/npm/l/@dskripchenko/diagrams.svg)](LICENSE)
6
+
7
+ Diagrams written in Mermaid syntax, rendered to SVG — with **no runtime
8
+ dependencies** and **no DOM**. A string goes in, a string of SVG comes out:
9
+ the same call works in a browser, in server-side rendering and in a Node
10
+ build script.
11
+
12
+ ```ts
13
+ import { render } from '@dskripchenko/diagrams'
14
+
15
+ const { svg } = render(`flowchart LR
16
+ A[Request] --> B{Valid?}
17
+ B -->|yes| C[Render PDF]
18
+ B -->|no| D[Reject]`)
19
+
20
+ element.innerHTML = svg
21
+ ```
22
+
23
+ **Supported:** `flowchart` (with subgraphs and per-subgraph direction),
24
+ `sequenceDiagram`, `stateDiagram-v2`, `pie`, `gantt`.
25
+
26
+ ## Why another renderer
27
+
28
+ - **Zero dependencies.** Mermaid pulls in d3, dagre, DOMPurify and more —
29
+ megabytes. This package is one module under 60 KB gzipped before your
30
+ bundler minifies it, layout engine included.
31
+ - **Safe by construction.** Every label and attribute is escaped by the one
32
+ SVG builder that produces the output; HTML in labels is shown as text.
33
+ Styles are parsed and limited to a fixed set of properties with validated
34
+ values, links to `http(s)`, `mailto` and relative addresses. Nothing from
35
+ the diagram text is ever executed.
36
+ - **Deterministic.** The same source and the same text measurer give the
37
+ same SVG, byte for byte — diagrams can be snapshot-tested and cached.
38
+ - **Themeable with CSS.** Every colour is a CSS custom property
39
+ (`--dg-*`) with a default; a dark theme is a dozen declarations.
40
+ - **Errors you can act on.** A source that cannot be read raises a
41
+ `DiagramError` with the line, the column and, where there is one, a hint.
42
+
43
+ The syntax is a declared subset of Mermaid's. What is supported is listed
44
+ per diagram type in the documentation; anything else is an error rather
45
+ than a silently wrong picture.
46
+
47
+ ## Documentation
48
+
49
+ | | English | Русский | Deutsch | 中文 |
50
+ |---|---|---|---|---|
51
+ | Getting started | [en](docs/en/getting-started.md) | [ru](docs/ru/getting-started.md) | [de](docs/de/getting-started.md) | [zh](docs/zh/getting-started.md) |
52
+ | Flowchart | [en](docs/en/flowchart.md) | [ru](docs/ru/flowchart.md) | [de](docs/de/flowchart.md) | [zh](docs/zh/flowchart.md) |
53
+ | Sequence diagram | [en](docs/en/sequence.md) | [ru](docs/ru/sequence.md) | [de](docs/de/sequence.md) | [zh](docs/zh/sequence.md) |
54
+ | State diagram | [en](docs/en/state.md) | [ru](docs/ru/state.md) | [de](docs/de/state.md) | [zh](docs/zh/state.md) |
55
+ | Pie chart | [en](docs/en/pie.md) | [ru](docs/ru/pie.md) | [de](docs/de/pie.md) | [zh](docs/zh/pie.md) |
56
+ | Gantt chart | [en](docs/en/gantt.md) | [ru](docs/ru/gantt.md) | [de](docs/de/gantt.md) | [zh](docs/zh/gantt.md) |
57
+ | Theming | [en](docs/en/theming.md) | [ru](docs/ru/theming.md) | [de](docs/de/theming.md) | [zh](docs/zh/theming.md) |
58
+
59
+ ## Install
60
+
61
+ ```bash
62
+ npm install @dskripchenko/diagrams
63
+ ```
64
+
65
+ Node 20 or newer for server-side use; any current browser.
66
+
67
+ ## License
68
+
69
+ [MIT](LICENSE). Security issues: see [SECURITY.md](SECURITY.md).