@adecore/diagram 0.17.0-beta.1 → 0.17.0-beta.2

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.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +39 -24
  3. package/package.json +2 -2
package/LICENSE CHANGED
@@ -6,7 +6,7 @@ FSL-1.1-MIT
6
6
 
7
7
  ## Notice
8
8
 
9
- Copyright 2026 Bas Milius
9
+ Copyright 2026 - present Bas Milius
10
10
 
11
11
  ## Terms and Conditions
12
12
 
package/README.md CHANGED
@@ -1,35 +1,50 @@
1
1
  # @adecore/diagram
2
2
 
3
- Directed graph schemas, deterministic layered layout, orthogonal routes, SVG export and reading order. The core has no DOM or canvas state. It depends on Zod and `@adecore/drawing` for shared schemas, geometry and palette defaults.
3
+ [![npm](https://img.shields.io/npm/v/@adecore/diagram)](https://www.npmjs.com/package/@adecore/diagram)
4
+ [![Docs](https://img.shields.io/badge/docs-adecore.dev-blue)](https://adecore.dev/diagram/)
4
5
 
5
- The package is private at `0.0.0` pending initial publication. Use local source exports or build drawing before diagram for default compiled JavaScript/declarations. The transferred code retains FSL-1.1-MIT in [LICENSE](./LICENSE).
6
+ Directed graphs that are written rather than drawn. A diagram file names its nodes, groups and edges; the package lays them out, routes the edges and writes the result as SVG or as lines of text. The same file gives the same picture on every machine, and it needs no DOM.
7
+
8
+ **[Documentation with live demos](https://adecore.dev/diagram/)**
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ bun add @adecore/diagram
14
+ ```
15
+
16
+ ## Use
6
17
 
7
18
  ```ts
8
19
  import { layoutOf, readingOrder, toSvg } from '@adecore/diagram';
9
- import { DiagramDocumentSchema, diagramProblemIn } from '@adecore/diagram/protocol';
10
-
11
- const document = DiagramDocumentSchema.parse({
12
- version: 1,
13
- rev: 0,
14
- meta: { title: 'Delivery', direction: 'right' },
15
- nodes: [
16
- { id: 'draft', label: 'Draft' },
17
- { id: 'review', label: 'Review', shape: 'diamond' }
18
- ],
19
- groups: [],
20
- edges: [{ from: 'draft', to: 'review' }]
21
- });
22
- const problem = diagramProblemIn(document);
23
- if (problem !== null) {
24
- throw new Error(problem);
20
+ import { diagramProblemIn, migrateDiagram } from '@adecore/diagram/protocol';
21
+
22
+ const diagram = migrateDiagram(JSON.parse(file));
23
+ const problem = diagram && diagramProblemIn(diagram);
24
+ if (diagram === null || problem) {
25
+ throw new Error(problem ?? 'Not a diagram');
25
26
  }
26
- const layout = layoutOf(document);
27
- const svg = toSvg(document, { layout });
28
- const lines = readingOrder(document);
27
+
28
+ const layout = layoutOf(diagram);
29
+ const svg = toSvg(diagram, { layout });
30
+ const lines = readingOrder(diagram);
29
31
  ```
30
32
 
31
- Graph validation is separate from parsing. It caps documents at 100 nodes/120 edges and checks ids and references. Cycles, loops and parallel edges are supported. Pins keep manual positions but do not reserve automatic-layout space. The host owns dragging, collision policy, fonts, persistence and revision checks.
33
+ ## Entry points
34
+
35
+ | Import | What it holds |
36
+ |---|---|
37
+ | `@adecore/diagram` | Layout, SVG export, the shape and text helpers and reading order |
38
+ | `@adecore/diagram/protocol` | The Zod schemas and types of a diagram, and `diagramProblemIn` |
39
+
40
+ ## Documentation
41
+
42
+ | Page | What it covers |
43
+ |---|---|
44
+ | [Documents](https://adecore.dev/diagram/documents) | Nodes, groups and edges, and checking a file |
45
+ | [Layout](https://adecore.dev/diagram/layout) | Layers, ordering, sizes, groups, edge routes and dragged nodes |
46
+ | [Painting and reading](https://adecore.dev/diagram/rendering) | `toSvg`, helpers for a painter of your own and `readingOrder` |
32
47
 
33
- Read the [overview](https://adecore.dev/diagram/), [getting started](https://adecore.dev/diagram/getting-started), [layout guide](https://adecore.dev/diagram/layout), [painting/output guide](https://adecore.dev/diagram/rendering), [API reference](https://adecore.dev/diagram/api), [protocol](https://adecore.dev/diagram/protocol) and [integration/testing guide](https://adecore.dev/diagram/migration).
48
+ ## License
34
49
 
35
- From the repository root, run `bun run --cwd packages/diagram test`, `typecheck` or `build`. A standalone source-relative example is in [examples/export-graph.ts](./examples/export-graph.ts).
50
+ FSL-1.1-MIT, see [LICENSE](./LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/diagram",
3
- "version": "0.17.0-beta.1",
3
+ "version": "0.17.0-beta.2",
4
4
  "description": "Directed graph schemas, layered layout, SVG export and reading order.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "author": "Bas Milius",
@@ -45,6 +45,6 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "zod": "^4.6.5",
48
- "@adecore/drawing": "0.17.0-beta.1"
48
+ "@adecore/drawing": "0.17.0-beta.2"
49
49
  }
50
50
  }