@diagrammo/dgmo 0.5.5 → 0.6.1

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 CHANGED
@@ -58,34 +58,57 @@ dgmo diagram.dgmo --theme dark --palette catppuccin
58
58
 
59
59
  ## Supported chart types
60
60
 
61
+ ### Data Charts
62
+
61
63
  | Type | Description |
62
64
  |------|-------------|
63
- | `arc` | Arc/network diagrams |
64
- | `area` | Filled area charts |
65
65
  | `bar` | Vertical/horizontal bar charts |
66
- | `bar-stacked` | Stacked bar charts |
67
- | `chord` | Circular relationship diagrams |
68
- | `class` | UML class diagrams with inheritance, composition, and visibility |
69
- | `doughnut` | Doughnut charts |
70
- | `er` | Entity-relationship diagrams with crow's foot notation |
71
- | `flowchart` | Directed graph flowcharts with branching and 6 node shapes |
72
- | `function` | Mathematical function plots |
73
- | `funnel` | Conversion funnels |
74
- | `heatmap` | Matrix heatmaps |
75
66
  | `line` | Line charts with crosshair |
76
- | `multi-line` | Multi-series line charts |
77
- | `org` | Org charts with hierarchy, team containers, and tag group color-coding |
67
+ | `area` | Filled area charts |
78
68
  | `pie` | Pie charts with connector labels |
79
- | `polar-area` | Polar area charts |
80
- | `quadrant` | 2D quadrant scatter |
69
+ | `doughnut` | Doughnut charts |
81
70
  | `radar` | Radar/spider charts |
82
- | `sankey` | Flow diagrams |
71
+ | `polar-area` | Polar area charts |
72
+ | `bar-stacked` | Stacked bar charts |
73
+ | `multi-line` | Multi-series line charts |
83
74
  | `scatter` | XY scatter with categories and sizing |
84
- | `sequence` | Sequence diagrams with type inference |
75
+ | `heatmap` | Matrix heatmaps |
76
+ | `funnel` | Conversion funnels |
77
+ | `sankey` | Flow diagrams |
78
+ | `chord` | Circular relationship diagrams |
79
+
80
+ ### Visualizations
81
+
82
+ | Type | Description |
83
+ |------|-------------|
85
84
  | `slope` | Before/after comparison |
85
+ | `wordcloud` | Weighted text clouds |
86
+ | `arc` | Arc/network diagrams |
86
87
  | `timeline` | Timelines with eras and markers |
87
88
  | `venn` | Set intersection diagrams |
88
- | `wordcloud` | Weighted text clouds |
89
+ | `quadrant` | 2D quadrant scatter |
90
+
91
+ ### Structural Diagrams
92
+
93
+ | Type | Description |
94
+ |------|-------------|
95
+ | `sequence` | Sequence diagrams with type inference |
96
+ | `flowchart` | Directed graph flowcharts with branching and 6 node shapes |
97
+ | `class` | UML class diagrams with inheritance, composition, and visibility |
98
+ | `er` | Entity-relationship diagrams with crow's foot notation |
99
+ | `org` | Org charts with hierarchy, team containers, and tag group color-coding |
100
+ | `c4` | C4 architecture diagrams (context, containers, components, deployment) |
101
+ | `state` | State machine diagrams |
102
+ | `infra` | Infrastructure capacity and latency diagrams |
103
+ | `kanban` | Kanban boards |
104
+ | `initiative-status` | Initiative status and dependency graphs |
105
+ | `sitemap` | Site structure and navigation maps |
106
+
107
+ ### Other
108
+
109
+ | Type | Description |
110
+ |------|-------------|
111
+ | `function` | Mathematical function plots |
89
112
 
90
113
  ## How it works
91
114
 
@@ -102,10 +125,10 @@ All parsers are pure functions with no DOM dependency. The CLI sets up jsdom int
102
125
 
103
126
  ## Usage
104
127
 
105
- ### Standard charts (bar, line, pie, radar, etc.)
128
+ ### Data charts — standard (bar, line, pie, radar, etc.)
106
129
 
107
130
  ```typescript
108
- import { parseChart, buildEChartsOptionFromChart, getPalette } from '@diagrammo/dgmo';
131
+ import { parseChart, buildSimpleChartOption, getPalette } from '@diagrammo/dgmo';
109
132
  import * as echarts from 'echarts';
110
133
 
111
134
  const colors = getPalette('nord').light;
@@ -123,14 +146,14 @@ Q4: 22
123
146
  `;
124
147
 
125
148
  const parsed = parseChart(content, colors);
126
- const option = buildEChartsOptionFromChart(parsed, colors, false);
149
+ const option = buildSimpleChartOption(parsed, colors, false);
127
150
  echarts.init(container).setOption(option);
128
151
  ```
129
152
 
130
- ### ECharts (scatter, sankey, heatmap, etc.)
153
+ ### Data charts — extended (scatter, sankey, heatmap, etc.)
131
154
 
132
155
  ```typescript
133
- import { parseEChart, buildEChartsOption, getPalette } from '@diagrammo/dgmo';
156
+ import { parseExtendedChart, buildExtendedChartOption, getPalette } from '@diagrammo/dgmo';
134
157
  import * as echarts from 'echarts';
135
158
 
136
159
  const colors = getPalette('nord').light;
@@ -147,15 +170,15 @@ Electricity -> Industry: 45
147
170
  Electricity -> Homes: 35
148
171
  `;
149
172
 
150
- const parsed = parseEChart(content);
151
- const option = buildEChartsOption(parsed, colors, false);
173
+ const parsed = parseExtendedChart(content);
174
+ const option = buildExtendedChartOption(parsed, colors, false);
152
175
  echarts.init(container).setOption(option);
153
176
  ```
154
177
 
155
- ### D3 (slope, timeline, wordcloud, etc.)
178
+ ### Visualizations (slope, timeline, wordcloud, etc.)
156
179
 
157
180
  ```typescript
158
- import { parseD3, renderTimeline, getPalette } from '@diagrammo/dgmo';
181
+ import { parseVisualization, renderTimeline, getPalette } from '@diagrammo/dgmo';
159
182
 
160
183
  const colors = getPalette('nord').light;
161
184
 
@@ -168,7 +191,7 @@ title: Project Milestones
168
191
  2024-07: Launch
169
192
  `;
170
193
 
171
- const parsed = parseD3(content, colors);
194
+ const parsed = parseVisualization(content, colors);
172
195
  renderTimeline(container, parsed, colors, false);
173
196
  ```
174
197
 
@@ -397,10 +420,17 @@ tag: Location alias l
397
420
  If you don't know the chart type ahead of time, use the router:
398
421
 
399
422
  ```typescript
400
- import { parseDgmoChartType, getDgmoFramework } from '@diagrammo/dgmo';
423
+ import { parseDgmoChartType, getRenderCategory, isExtendedChartType, parseChart, parseExtendedChart } from '@diagrammo/dgmo';
401
424
 
402
425
  const chartType = parseDgmoChartType(content); // e.g. 'bar'
403
- const framework = getDgmoFramework(chartType); // 'echart' | 'd3' | 'mermaid'
426
+ const category = getRenderCategory(chartType); // 'data-chart' | 'visualization' | 'diagram' | null
427
+
428
+ // Dispatch within data-chart: standard vs extended parser
429
+ if (isExtendedChartType(chartType)) {
430
+ const parsed = parseExtendedChart(content); // scatter, sankey, heatmap, funnel, chord, function
431
+ } else {
432
+ const parsed = parseChart(content); // bar, line, pie, etc.
433
+ }
404
434
  ```
405
435
 
406
436
  Content with `->` arrows and no `chart:` header is automatically detected as a sequence diagram.
@@ -502,13 +532,13 @@ const css = buildThemeCSS(palette.light); // complete CSS string
502
532
  Render any chart to an SVG string without a visible DOM:
503
533
 
504
534
  ```typescript
505
- import { renderD3ForExport, renderEChartsForExport } from '@diagrammo/dgmo';
535
+ import { renderForExport, renderExtendedChartForExport } from '@diagrammo/dgmo';
506
536
 
507
- // D3 and sequence charts
508
- const svg = await renderD3ForExport(content, 'light');
537
+ // Diagrams, visualizations, and sequence charts
538
+ const svg = await renderForExport(content, 'light');
509
539
 
510
- // ECharts charts
511
- const svg = await renderEChartsForExport(content, 'light');
540
+ // Data charts (bar, line, scatter, sankey, etc.)
541
+ const svg = await renderExtendedChartForExport(content, 'light');
512
542
  ```
513
543
 
514
544
  Both accept an optional third argument for a custom `PaletteColors` object (defaults to Nord).
@@ -520,16 +550,17 @@ Both accept an optional third argument for a custom `PaletteColors` object (defa
520
550
  | Export | Description |
521
551
  |--------|-------------|
522
552
  | `parseDgmoChartType(content)` | Extract chart type from content (infers `sequence` from arrow syntax) |
523
- | `getDgmoFramework(type)` | Map chart type → `'echart'` \| `'d3'` \| `'mermaid'` |
524
- | `DGMO_CHART_TYPE_MAP` | Full type-to-framework registry |
553
+ | `getRenderCategory(type)` | Map chart type → `'data-chart'` \| `'visualization'` \| `'diagram'` \| `null` |
554
+ | `isExtendedChartType(type)` | Returns `true` for extended data-chart types (scatter, sankey, chord, function, heatmap, funnel) |
555
+ | `RenderCategory` | Type alias for `'data-chart' \| 'visualization' \| 'diagram'` |
525
556
 
526
557
  ### Parsers
527
558
 
528
559
  | Export | Description |
529
560
  |--------|-------------|
530
- | `parseChart(content, colors)` | Parse standard chart types (bar, line, pie, radar, etc.) |
531
- | `parseEChart(content)` | Parse ECharts-specific types (scatter, sankey, heatmap, etc.) |
532
- | `parseD3(content, colors)` | Parse D3 chart types (slope, arc, timeline, etc.) |
561
+ | `parseChart(content, colors)` | Parse standard data-chart types (bar, line, pie, radar, etc.) |
562
+ | `parseExtendedChart(content)` | Parse extended data-chart types (scatter, sankey, heatmap, etc.) |
563
+ | `parseVisualization(content, colors)` | Parse visualization types (slope, arc, timeline, etc.) |
533
564
  | `parseSequenceDgmo(content)` | Parse sequence diagrams |
534
565
  | `parseFlowchart(content, colors)` | Parse flowchart diagrams |
535
566
  | `parseClassDiagram(content, colors)` | Parse class diagrams |
@@ -541,8 +572,8 @@ Both accept an optional third argument for a custom `PaletteColors` object (defa
541
572
 
542
573
  | Export | Description |
543
574
  |--------|-------------|
544
- | `buildEChartsOptionFromChart(parsed, colors, dark)` | ECharts option from `parseChart` result |
545
- | `buildEChartsOption(parsed, colors, dark)` | ECharts option from `parseEChart` result |
575
+ | `buildSimpleChartOption(parsed, colors, dark)` | ECharts option from `parseChart` result (bar, line, pie, etc.) |
576
+ | `buildExtendedChartOption(parsed, colors, dark)` | ECharts option from `parseExtendedChart` result (scatter, sankey, etc.) |
546
577
  | `buildMermaidQuadrant(parsed, colors)` | Mermaid quadrantChart syntax string |
547
578
 
548
579
  ### Renderers
@@ -563,8 +594,8 @@ Both accept an optional third argument for a custom `PaletteColors` object (defa
563
594
  | `layoutERDiagram(parsed)` | Compute ER diagram node positions |
564
595
  | `layoutGraph(parsed)` | Compute flowchart node positions |
565
596
  | `renderSequenceDiagram(el, parsed, colors, dark, onClick)` | Sequence diagram SVG |
566
- | `renderD3ForExport(content, theme, palette?)` | Any D3/sequence chart → SVG string |
567
- | `renderEChartsForExport(content, theme, palette?)` | Any ECharts chart → SVG string |
597
+ | `renderForExport(content, theme, palette?)` | Any diagram or visualization → SVG string |
598
+ | `renderExtendedChartForExport(content, theme, palette?)` | Any data-chart → SVG string |
568
599
 
569
600
  ### Sequence internals
570
601