@diagrammo/dgmo 0.2.8 → 0.2.10
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/README.md +29 -1
- package/dist/cli.cjs +105 -105
- package/dist/index.cjs +6457 -6137
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +6474 -6158
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/chart.ts +11 -0
- package/src/cli.ts +14 -34
- package/src/d3.ts +160 -15
- package/src/echarts.ts +56 -2
- package/src/graph/flowchart-parser.ts +1 -0
- package/src/graph/flowchart-renderer.ts +15 -4
- package/src/graph/types.ts +1 -0
- package/src/index.ts +7 -0
- package/src/render.ts +68 -0
- package/src/sequence/parser.ts +3 -0
- package/src/sequence/renderer.ts +311 -127
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A diagram markup language — parser, config builder, renderer, and color system.
|
|
4
4
|
|
|
5
|
-
Write plain-text `.dgmo` files and render them as charts, diagrams, and visualizations. Supports
|
|
5
|
+
Write plain-text `.dgmo` files and render them as charts, diagrams, and visualizations. Supports 24 chart types across ECharts, D3, and a built-in sequence renderer. Ships as both a library and a standalone CLI.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -82,6 +82,7 @@ dgmo diagram.dgmo --theme dark --palette catppuccin
|
|
|
82
82
|
| `venn` | D3 | Set intersection diagrams |
|
|
83
83
|
| `quadrant` | D3 | 2D quadrant scatter (also has a Mermaid output path) |
|
|
84
84
|
| `sequence` | D3 | Sequence diagrams with type inference |
|
|
85
|
+
| `flowchart` | D3 | Directed graph flowcharts with branching and 6 node shapes |
|
|
85
86
|
|
|
86
87
|
## How it works
|
|
87
88
|
|
|
@@ -218,6 +219,29 @@ renderSequenceDiagram(container, parsed, colors, false, (lineNum) => {
|
|
|
218
219
|
| Service, API, Lambda, Fn | service | pill shape |
|
|
219
220
|
| External, ThirdParty, Vendor | external | dashed square |
|
|
220
221
|
|
|
222
|
+
### Flowcharts
|
|
223
|
+
|
|
224
|
+
Flowcharts use a concise syntax with 6 node shapes: `(terminal)`, `[process]`, `<decision>`, `/io/`, `{preparation}`, and `[[subroutine]]`. Edges support labels and branching.
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
import { parseFlowchart, layoutGraph, renderFlowchart, getPalette } from '@diagrammo/dgmo';
|
|
228
|
+
|
|
229
|
+
const colors = getPalette('nord').dark;
|
|
230
|
+
|
|
231
|
+
const content = `
|
|
232
|
+
chart: flowchart
|
|
233
|
+
title: Decision Flow
|
|
234
|
+
|
|
235
|
+
(Start) -> /Get Input/ -> <Valid?>
|
|
236
|
+
-yes-> [Process Data] -> (Done)
|
|
237
|
+
-no-> [Show Error] -> /Get Input/
|
|
238
|
+
`;
|
|
239
|
+
|
|
240
|
+
const parsed = parseFlowchart(content, colors);
|
|
241
|
+
const layout = layoutGraph(parsed);
|
|
242
|
+
renderFlowchart(container, parsed, layout, colors, true);
|
|
243
|
+
```
|
|
244
|
+
|
|
221
245
|
### Routing
|
|
222
246
|
|
|
223
247
|
If you don't know the chart type ahead of time, use the router:
|
|
@@ -347,6 +371,7 @@ Both accept an optional third argument for a custom `PaletteColors` object (defa
|
|
|
347
371
|
| `parseEChart(content)` | Parse ECharts-specific types (scatter, sankey, heatmap, etc.) |
|
|
348
372
|
| `parseD3(content, colors)` | Parse D3 chart types (slope, arc, timeline, etc.) |
|
|
349
373
|
| `parseSequenceDgmo(content)` | Parse sequence diagrams |
|
|
374
|
+
| `parseFlowchart(content, colors)` | Parse flowchart diagrams |
|
|
350
375
|
| `parseQuadrant(content)` | Parse quadrant charts |
|
|
351
376
|
|
|
352
377
|
### Config builders
|
|
@@ -367,6 +392,8 @@ Both accept an optional third argument for a custom `PaletteColors` object (defa
|
|
|
367
392
|
| `renderWordCloud(el, parsed, colors, dark)` | Word cloud SVG |
|
|
368
393
|
| `renderVenn(el, parsed, colors, dark)` | Venn diagram SVG |
|
|
369
394
|
| `renderQuadrant(el, parsed, colors, dark)` | Quadrant chart SVG |
|
|
395
|
+
| `renderFlowchart(el, parsed, layout, colors, dark)` | Flowchart SVG |
|
|
396
|
+
| `layoutGraph(parsed)` | Compute flowchart node positions |
|
|
370
397
|
| `renderSequenceDiagram(el, parsed, colors, dark, onClick)` | Sequence diagram SVG |
|
|
371
398
|
| `renderD3ForExport(content, theme, palette?)` | Any D3/sequence chart → SVG string |
|
|
372
399
|
| `renderEChartsForExport(content, theme, palette?)` | Any ECharts chart → SVG string |
|
|
@@ -436,6 +463,7 @@ src/
|
|
|
436
463
|
├── chart.ts # Standard chart parser (bar, line, pie, etc.)
|
|
437
464
|
├── echarts.ts # ECharts parser, config builder, SSR export
|
|
438
465
|
├── d3.ts # D3 parsers + renderers (slope, arc, timeline, wordcloud, venn, quadrant)
|
|
466
|
+
├── graph/ # Flowchart parser, layout engine, and renderer
|
|
439
467
|
├── dgmo-mermaid.ts # Quadrant parser + Mermaid syntax builder
|
|
440
468
|
├── colors.ts # Named color map, resolve helper
|
|
441
469
|
├── fonts.ts # Font family constants (Helvetica for resvg)
|