@diagrammo/dgmo 0.1.7 → 0.2.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A unified diagram markup language — parser, config builder, renderer, and color system.
4
4
 
5
- Write simple, readable `.dgmo` text files and render them as charts, diagrams, and visualizations using Chart.js, ECharts, D3, or Mermaid.
5
+ Write simple, readable `.dgmo` text files and render them as charts, diagrams, and visualizations using ECharts, D3, or Mermaid.
6
6
 
7
7
  ## Install
8
8
 
@@ -57,7 +57,7 @@ dgmo diagram.dgmo --theme dark --palette catppuccin
57
57
 
58
58
  Every `.dgmo` file is plain text with a `chart: <type>` header followed by metadata and data. The library routes each chart type to the right framework and gives you either:
59
59
 
60
- - A **framework config object** you render yourself (Chart.js, ECharts, Mermaid)
60
+ - A **framework config object** you render yourself (ECharts, Mermaid)
61
61
  - A **rendered SVG** via D3 or the built-in sequence renderer
62
62
 
63
63
  ```
@@ -70,14 +70,14 @@ All parsers are pure functions with no DOM dependency. Renderers that produce SV
70
70
 
71
71
  | Type | Framework | Description |
72
72
  |------|-----------|-------------|
73
- | `bar` | Chart.js | Vertical/horizontal bar charts |
74
- | `bar-stacked` | Chart.js | Stacked bar charts |
75
- | `line` | Chart.js | Line charts with crosshair |
76
- | `area` | Chart.js | Filled area charts |
77
- | `pie` | Chart.js | Pie charts with connector labels |
78
- | `doughnut` | Chart.js | Doughnut charts |
79
- | `radar` | Chart.js | Radar/spider charts |
80
- | `polar-area` | Chart.js | Polar area charts |
73
+ | `bar` | ECharts | Vertical/horizontal bar charts |
74
+ | `bar-stacked` | ECharts | Stacked bar charts |
75
+ | `line` | ECharts | Line charts with crosshair |
76
+ | `area` | ECharts | Filled area charts |
77
+ | `pie` | ECharts | Pie charts with connector labels |
78
+ | `doughnut` | ECharts | Doughnut charts |
79
+ | `radar` | ECharts | Radar/spider charts |
80
+ | `polar-area` | ECharts | Polar area charts |
81
81
  | `scatter` | ECharts | XY scatter with categories and sizing |
82
82
  | `sankey` | ECharts | Flow diagrams |
83
83
  | `chord` | ECharts | Circular relationship diagrams |
@@ -94,11 +94,11 @@ All parsers are pure functions with no DOM dependency. Renderers that produce SV
94
94
 
95
95
  ## Usage
96
96
 
97
- ### Chart.js (bar, line, pie, radar, etc.)
97
+ ### Standard charts (bar, line, pie, radar, etc.)
98
98
 
99
99
  ```typescript
100
- import { parseChartJs, buildChartJsConfig } from '@diagrammo/dgmo';
101
- import { Chart } from 'chart.js/auto';
100
+ import { parseChart, buildEChartsOptionFromChart } from '@diagrammo/dgmo';
101
+ import * as echarts from 'echarts';
102
102
 
103
103
  const content = `
104
104
  chart: bar
@@ -112,9 +112,9 @@ Q3: 15
112
112
  Q4: 22
113
113
  `;
114
114
 
115
- const parsed = parseChartJs(content, palette.light);
116
- const config = buildChartJsConfig(parsed, palette.light, false);
117
- new Chart(canvas, config);
115
+ const parsed = parseChart(content, palette.light);
116
+ const option = buildEChartsOptionFromChart(parsed, palette.light, false);
117
+ echarts.init(container).setOption(option);
118
118
  ```
119
119
 
120
120
  ### ECharts (scatter, sankey, heatmap, etc.)
@@ -212,7 +212,7 @@ If you don't know the chart type ahead of time, use the router:
212
212
  import { parseDgmoChartType, getDgmoFramework } from '@diagrammo/dgmo';
213
213
 
214
214
  const chartType = parseDgmoChartType(content); // e.g. 'bar'
215
- const framework = getDgmoFramework(chartType); // e.g. 'chartjs'
215
+ const framework = getDgmoFramework(chartType); // e.g. 'echart'
216
216
  ```
217
217
 
218
218
  Content with `->` arrows and no `chart:` header is automatically detected as a sequence diagram.
@@ -323,7 +323,7 @@ const svgString = await renderD3ForExport(content, 'light');
323
323
 
324
324
  | Export | Description |
325
325
  |--------|-------------|
326
- | `parseChartJs(content, colors)` | Parse Chart.js chart types |
326
+ | `parseChart(content, colors)` | Parse standard chart types |
327
327
  | `parseEChart(content)` | Parse ECharts chart types |
328
328
  | `parseD3(content, colors)` | Parse D3 chart types |
329
329
  | `parseSequenceDgmo(content)` | Parse sequence diagrams |
@@ -333,7 +333,7 @@ const svgString = await renderD3ForExport(content, 'light');
333
333
 
334
334
  | Export | Description |
335
335
  |--------|-------------|
336
- | `buildChartJsConfig(parsed, colors, dark)` | Chart.js configuration object |
336
+ | `buildEChartsOptionFromChart(parsed, colors, dark)` | ECharts option object |
337
337
  | `buildEChartsOption(parsed, colors, dark)` | ECharts option object |
338
338
  | `buildMermaidQuadrant(parsed, colors)` | Mermaid quadrant syntax string |
339
339