@diagrammo/dgmo 0.8.3 → 0.8.4
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/.claude/commands/dgmo-diagram-this.md +60 -0
- package/.claude/commands/dgmo-document-project.md +128 -0
- package/.claude/commands/dgmo.md +185 -50
- package/.cursorrules +32 -37
- package/.github/copilot-instructions.md +35 -44
- package/.windsurfrules +32 -37
- package/README.md +4 -4
- package/dist/cli.cjs +153 -153
- package/dist/editor.cjs +336 -0
- package/dist/editor.cjs.map +1 -0
- package/dist/editor.d.cts +27 -0
- package/dist/editor.d.ts +27 -0
- package/dist/editor.js +305 -0
- package/dist/editor.js.map +1 -0
- package/dist/index.cjs +3336 -1055
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3336 -1055
- package/dist/index.js.map +1 -1
- package/docs/language-reference.md +30 -29
- package/gallery/fixtures/arc.dgmo +18 -0
- package/gallery/fixtures/area.dgmo +19 -0
- package/gallery/fixtures/bar-stacked.dgmo +10 -0
- package/gallery/fixtures/bar.dgmo +10 -0
- package/gallery/fixtures/c4-full.dgmo +52 -0
- package/gallery/fixtures/c4.dgmo +17 -0
- package/gallery/fixtures/chord.dgmo +12 -0
- package/gallery/fixtures/class-basic.dgmo +14 -0
- package/gallery/fixtures/class-full.dgmo +43 -0
- package/gallery/fixtures/doughnut.dgmo +8 -0
- package/gallery/fixtures/flowchart-basic.dgmo +3 -0
- package/gallery/fixtures/flowchart-colors.dgmo +5 -0
- package/gallery/fixtures/flowchart-complex.dgmo +17 -0
- package/gallery/fixtures/flowchart-decision.dgmo +5 -0
- package/gallery/fixtures/flowchart-full.dgmo +13 -0
- package/gallery/fixtures/flowchart-groups.dgmo +10 -0
- package/gallery/fixtures/flowchart-loop.dgmo +7 -0
- package/gallery/fixtures/flowchart-nested.dgmo +7 -0
- package/gallery/fixtures/flowchart-shapes.dgmo +5 -0
- package/gallery/fixtures/function.dgmo +8 -0
- package/gallery/fixtures/funnel.dgmo +7 -0
- package/gallery/fixtures/gantt-full.dgmo +49 -0
- package/gallery/fixtures/gantt.dgmo +42 -0
- package/gallery/fixtures/heatmap.dgmo +8 -0
- package/gallery/fixtures/infra-full.dgmo +78 -0
- package/gallery/fixtures/infra-overload.dgmo +25 -0
- package/gallery/fixtures/infra.dgmo +47 -0
- package/gallery/fixtures/initiative-status-full.dgmo +46 -0
- package/gallery/fixtures/initiative-status-phases.dgmo +29 -0
- package/gallery/fixtures/initiative-status.dgmo +9 -0
- package/gallery/fixtures/line.dgmo +19 -0
- package/gallery/fixtures/multi-line.dgmo +11 -0
- package/gallery/fixtures/org-basic.dgmo +16 -0
- package/gallery/fixtures/org-full.dgmo +69 -0
- package/gallery/fixtures/org-teams.dgmo +25 -0
- package/gallery/fixtures/pie.dgmo +9 -0
- package/gallery/fixtures/polar-area.dgmo +8 -0
- package/gallery/fixtures/quadrant.dgmo +18 -0
- package/gallery/fixtures/radar.dgmo +8 -0
- package/gallery/fixtures/sankey.dgmo +31 -0
- package/gallery/fixtures/scatter.dgmo +21 -0
- package/gallery/fixtures/sequence-tags-protocols.dgmo +45 -0
- package/gallery/fixtures/sequence-tags.dgmo +41 -0
- package/gallery/fixtures/sequence.dgmo +35 -0
- package/gallery/fixtures/sitemap-basic.dgmo +12 -0
- package/gallery/fixtures/sitemap-full.dgmo +156 -0
- package/gallery/fixtures/slope.dgmo +8 -0
- package/gallery/fixtures/spr-eras.dgmo +62 -0
- package/gallery/fixtures/state.dgmo +30 -0
- package/gallery/fixtures/timeline-intraday.dgmo +14 -0
- package/gallery/fixtures/timeline.dgmo +32 -0
- package/gallery/fixtures/venn.dgmo +10 -0
- package/gallery/fixtures/wordcloud.dgmo +24 -0
- package/package.json +51 -2
- package/src/c4/layout.ts +372 -90
- package/src/c4/parser.ts +100 -55
- package/src/chart.ts +91 -28
- package/src/class/parser.ts +41 -12
- package/src/cli.ts +168 -61
- package/src/completion.ts +378 -183
- package/src/d3.ts +887 -288
- package/src/dgmo-mermaid.ts +16 -13
- package/src/dgmo-router.ts +69 -23
- package/src/echarts.ts +646 -153
- package/src/editor/dgmo.grammar +69 -0
- package/src/editor/dgmo.grammar.d.ts +2 -0
- package/src/editor/dgmo.grammar.js +18 -0
- package/src/editor/dgmo.grammar.terms.d.ts +5 -0
- package/src/editor/dgmo.grammar.terms.js +35 -0
- package/src/editor/highlight.ts +36 -0
- package/src/editor/index.ts +28 -0
- package/src/editor/keywords.ts +220 -0
- package/src/editor/tokens.ts +30 -0
- package/src/er/parser.ts +48 -14
- package/src/er/renderer.ts +112 -53
- package/src/gantt/calculator.ts +91 -29
- package/src/gantt/parser.ts +197 -71
- package/src/gantt/renderer.ts +1120 -350
- package/src/graph/flowchart-parser.ts +46 -25
- package/src/graph/state-parser.ts +47 -17
- package/src/infra/parser.ts +157 -53
- package/src/infra/renderer.ts +723 -271
- package/src/initiative-status/parser.ts +138 -44
- package/src/kanban/parser.ts +25 -14
- package/src/org/layout.ts +111 -44
- package/src/org/parser.ts +69 -22
- package/src/palettes/index.ts +3 -2
- package/src/sequence/parser.ts +193 -61
- package/src/sitemap/parser.ts +65 -29
- package/src/utils/arrows.ts +2 -22
- package/src/utils/duration.ts +39 -21
- package/src/utils/legend-constants.ts +0 -2
- package/src/utils/parsing.ts +75 -31
|
@@ -13,18 +13,13 @@ When the user asks for a diagram, visualization, or chart, generate a `.dgmo` fi
|
|
|
13
13
|
|
|
14
14
|
### Sequence diagram
|
|
15
15
|
```
|
|
16
|
-
|
|
17
|
-
title: Auth Flow
|
|
16
|
+
sequence Auth Flow
|
|
18
17
|
|
|
19
|
-
tag
|
|
18
|
+
tag Concern alias c
|
|
20
19
|
Auth(green)
|
|
21
20
|
Data(blue)
|
|
22
21
|
|
|
23
|
-
User
|
|
24
|
-
API is a service | c: Auth
|
|
25
|
-
DB is a database | c: Data
|
|
26
|
-
|
|
27
|
-
User -Login-> API
|
|
22
|
+
User -Login-> API | c: Auth
|
|
28
23
|
API -Find user-> DB | c: Data
|
|
29
24
|
DB -user-> API
|
|
30
25
|
if valid
|
|
@@ -35,8 +30,7 @@ DB -user-> API
|
|
|
35
30
|
|
|
36
31
|
### Flowchart
|
|
37
32
|
```
|
|
38
|
-
|
|
39
|
-
title: Process
|
|
33
|
+
flowchart Process
|
|
40
34
|
|
|
41
35
|
(Start) -> <Valid?>
|
|
42
36
|
-yes-> [Process] -> (Done)
|
|
@@ -45,34 +39,32 @@ title: Process
|
|
|
45
39
|
|
|
46
40
|
### Bar chart
|
|
47
41
|
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
series: USD
|
|
42
|
+
bar Revenue
|
|
43
|
+
series USD
|
|
51
44
|
|
|
52
|
-
North
|
|
53
|
-
South
|
|
54
|
-
East
|
|
45
|
+
North 850
|
|
46
|
+
South 620
|
|
47
|
+
East 1100
|
|
55
48
|
```
|
|
56
49
|
|
|
57
50
|
### ER diagram
|
|
58
51
|
```
|
|
59
|
-
|
|
60
|
-
title: Schema
|
|
52
|
+
er Schema
|
|
61
53
|
|
|
62
54
|
users
|
|
63
|
-
id
|
|
64
|
-
email
|
|
55
|
+
id int [pk]
|
|
56
|
+
email varchar [unique]
|
|
65
57
|
|
|
66
58
|
posts
|
|
67
|
-
id
|
|
68
|
-
user_id
|
|
59
|
+
id int [pk]
|
|
60
|
+
user_id int [fk]
|
|
69
61
|
|
|
70
62
|
users 1--* posts : writes
|
|
71
63
|
```
|
|
72
64
|
|
|
73
65
|
### Org chart
|
|
74
66
|
```
|
|
75
|
-
|
|
67
|
+
org
|
|
76
68
|
|
|
77
69
|
CEO
|
|
78
70
|
VP Engineering
|
|
@@ -83,25 +75,24 @@ CEO
|
|
|
83
75
|
|
|
84
76
|
### C4 architecture
|
|
85
77
|
```
|
|
86
|
-
|
|
87
|
-
title: System
|
|
78
|
+
c4 System
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
Web App is a container | description: SPA, tech: React
|
|
81
|
+
-Uses-> API
|
|
82
|
+
User is a person
|
|
83
|
+
-Browses-> Web App
|
|
92
84
|
```
|
|
93
85
|
|
|
94
|
-
|
|
86
|
+
### Infra chart
|
|
95
87
|
```
|
|
96
|
-
|
|
97
|
-
direction: LR
|
|
88
|
+
infra
|
|
98
89
|
|
|
99
90
|
edge
|
|
100
|
-
rps
|
|
91
|
+
rps 10000
|
|
101
92
|
-> CDN
|
|
102
93
|
|
|
103
94
|
CDN
|
|
104
|
-
cache-hit
|
|
95
|
+
cache-hit 80%
|
|
105
96
|
-> LB
|
|
106
97
|
|
|
107
98
|
LB
|
|
@@ -109,25 +100,25 @@ LB
|
|
|
109
100
|
-/web-> Web | split: 30%
|
|
110
101
|
|
|
111
102
|
API
|
|
112
|
-
instances
|
|
113
|
-
max-rps
|
|
114
|
-
latency-ms
|
|
103
|
+
instances 3
|
|
104
|
+
max-rps 500
|
|
105
|
+
latency-ms 45
|
|
115
106
|
```
|
|
116
107
|
|
|
117
|
-
Properties: `cache-hit`, `firewall-block`, `ratelimit-rps`, `
|
|
108
|
+
Properties: `cache-hit`, `firewall-block`, `ratelimit-rps`, `max-rps`, `instances` (N or N-M), `latency-ms`, `cb-error-threshold`. Groups: `[Name]` with children. Roles are inferred from behavior.
|
|
118
109
|
|
|
119
110
|
## All 32 chart types
|
|
120
111
|
|
|
121
|
-
bar, line, multi-line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, state, class, er, org, kanban, c4, initiative-status, sitemap, infra
|
|
112
|
+
bar, line, multi-line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, state, class, er, org, kanban, c4, initiative-status, sitemap, infra, gantt
|
|
122
113
|
|
|
123
114
|
## Common patterns
|
|
124
115
|
|
|
125
|
-
- `
|
|
126
|
-
- `
|
|
116
|
+
- `TYPE Title` — first line declares chart type and optional title (no colon)
|
|
117
|
+
- `directive value` — directives are space-separated (no colon)
|
|
127
118
|
- `// comment` — only `//` comments (not `#`)
|
|
128
|
-
- `(colorname)` — inline colors: `Label(red)
|
|
129
|
-
- `series
|
|
130
|
-
- `tag
|
|
119
|
+
- `(colorname)` — inline colors: `Label(red) 100`
|
|
120
|
+
- `series A(red), B(blue)` — multi-series with colors
|
|
121
|
+
- `tag Group alias g` — tag groups for metadata
|
|
131
122
|
|
|
132
123
|
## Rendering
|
|
133
124
|
|
|
@@ -144,7 +135,7 @@ Install: `brew install diagrammo/dgmo/dgmo` or `npm install -g @diagrammo/dgmo`
|
|
|
144
135
|
- Don't use `#` for comments — use `//`
|
|
145
136
|
- Don't use `end` to close sequence blocks — indentation closes them
|
|
146
137
|
- Don't use hex colors in section headers — use named colors
|
|
147
|
-
- Don't
|
|
138
|
+
- Don't use colons in chart type, title, directives, or data rows — use spaces
|
|
148
139
|
- Sequence arrows: `->` (sync), `~>` (async) — always left-to-right
|
|
149
140
|
|
|
150
141
|
Full reference: `docs/language-reference.md`
|
package/.windsurfrules
CHANGED
|
@@ -13,8 +13,7 @@ When the user asks for a diagram, visualization, or chart, generate a `.dgmo` fi
|
|
|
13
13
|
|
|
14
14
|
### Sequence diagram
|
|
15
15
|
```
|
|
16
|
-
|
|
17
|
-
title: Auth Flow
|
|
16
|
+
sequence Auth Flow
|
|
18
17
|
|
|
19
18
|
User -Login-> API
|
|
20
19
|
API -Find user-> DB
|
|
@@ -27,8 +26,7 @@ DB -user-> API
|
|
|
27
26
|
|
|
28
27
|
### Flowchart
|
|
29
28
|
```
|
|
30
|
-
|
|
31
|
-
title: Process
|
|
29
|
+
flowchart Process
|
|
32
30
|
|
|
33
31
|
(Start) -> <Valid?>
|
|
34
32
|
-yes-> [Process] -> (Done)
|
|
@@ -37,34 +35,32 @@ title: Process
|
|
|
37
35
|
|
|
38
36
|
### Bar chart
|
|
39
37
|
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
series: USD
|
|
38
|
+
bar Revenue
|
|
39
|
+
series USD
|
|
43
40
|
|
|
44
|
-
North
|
|
45
|
-
South
|
|
46
|
-
East
|
|
41
|
+
North 850
|
|
42
|
+
South 620
|
|
43
|
+
East 1100
|
|
47
44
|
```
|
|
48
45
|
|
|
49
46
|
### ER diagram
|
|
50
47
|
```
|
|
51
|
-
|
|
52
|
-
title: Schema
|
|
48
|
+
er Schema
|
|
53
49
|
|
|
54
50
|
users
|
|
55
|
-
id
|
|
56
|
-
email
|
|
51
|
+
id int [pk]
|
|
52
|
+
email varchar [unique]
|
|
57
53
|
|
|
58
54
|
posts
|
|
59
|
-
id
|
|
60
|
-
user_id
|
|
55
|
+
id int [pk]
|
|
56
|
+
user_id int [fk]
|
|
61
57
|
|
|
62
58
|
users 1--* posts : writes
|
|
63
59
|
```
|
|
64
60
|
|
|
65
61
|
### Org chart
|
|
66
62
|
```
|
|
67
|
-
|
|
63
|
+
org
|
|
68
64
|
|
|
69
65
|
CEO
|
|
70
66
|
VP Engineering
|
|
@@ -75,25 +71,24 @@ CEO
|
|
|
75
71
|
|
|
76
72
|
### C4 architecture
|
|
77
73
|
```
|
|
78
|
-
|
|
79
|
-
title: System
|
|
74
|
+
c4 System
|
|
80
75
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
Web App is a container | description: SPA, tech: React
|
|
77
|
+
-Uses-> API
|
|
78
|
+
User is a person
|
|
79
|
+
-Browses-> Web App
|
|
84
80
|
```
|
|
85
81
|
|
|
86
82
|
### Infra chart
|
|
87
83
|
```
|
|
88
|
-
|
|
89
|
-
direction: LR
|
|
84
|
+
infra
|
|
90
85
|
|
|
91
86
|
edge
|
|
92
|
-
rps
|
|
87
|
+
rps 10000
|
|
93
88
|
-> CDN
|
|
94
89
|
|
|
95
90
|
CDN
|
|
96
|
-
cache-hit
|
|
91
|
+
cache-hit 80%
|
|
97
92
|
-> LB
|
|
98
93
|
|
|
99
94
|
LB
|
|
@@ -101,25 +96,25 @@ LB
|
|
|
101
96
|
-/web-> Web | split: 30%
|
|
102
97
|
|
|
103
98
|
API
|
|
104
|
-
instances
|
|
105
|
-
max-rps
|
|
106
|
-
latency-ms
|
|
99
|
+
instances 3
|
|
100
|
+
max-rps 500
|
|
101
|
+
latency-ms 45
|
|
107
102
|
```
|
|
108
103
|
|
|
109
|
-
Properties: `cache-hit`, `firewall-block`, `ratelimit-rps`, `
|
|
104
|
+
Properties: `cache-hit`, `firewall-block`, `ratelimit-rps`, `max-rps`, `instances` (N or N-M), `latency-ms`, `cb-error-threshold`. Groups: `[Name]` with children. Roles are inferred from behavior.
|
|
110
105
|
|
|
111
106
|
## All 32 chart types
|
|
112
107
|
|
|
113
|
-
bar, line, multi-line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, state, class, er, org, kanban, c4, initiative-status, sitemap, infra
|
|
108
|
+
bar, line, multi-line, area, pie, doughnut, radar, polar-area, bar-stacked, scatter, sankey, chord, function, heatmap, funnel, slope, wordcloud, arc, timeline, venn, quadrant, sequence, flowchart, state, class, er, org, kanban, c4, initiative-status, sitemap, infra, gantt
|
|
114
109
|
|
|
115
110
|
## Common patterns
|
|
116
111
|
|
|
117
|
-
- `
|
|
118
|
-
- `
|
|
112
|
+
- `TYPE Title` — first line declares chart type and optional title (no colon)
|
|
113
|
+
- `directive value` — directives are space-separated (no colon)
|
|
119
114
|
- `// comment` — only `//` comments (not `#`)
|
|
120
|
-
- `(colorname)` — inline colors: `Label(red)
|
|
121
|
-
- `series
|
|
122
|
-
- `tag
|
|
115
|
+
- `(colorname)` — inline colors: `Label(red) 100`
|
|
116
|
+
- `series A(red), B(blue)` — multi-series with colors
|
|
117
|
+
- `tag Group alias g` — tag groups for metadata
|
|
123
118
|
|
|
124
119
|
## Rendering
|
|
125
120
|
|
|
@@ -136,7 +131,7 @@ Install: `brew install diagrammo/dgmo/dgmo` or `npm install -g @diagrammo/dgmo`
|
|
|
136
131
|
- Don't use `#` for comments — use `//`
|
|
137
132
|
- Don't use `end` to close sequence blocks — indentation closes them
|
|
138
133
|
- Don't use hex colors in section headers — use named colors
|
|
139
|
-
- Don't
|
|
134
|
+
- Don't use colons in chart type, title, directives, or data rows — use spaces
|
|
140
135
|
- Sequence arrows: `->` (sync), `~>` (async) — always left-to-right
|
|
141
136
|
|
|
142
137
|
Full reference: `docs/language-reference.md`
|
package/README.md
CHANGED
|
@@ -142,8 +142,8 @@ const colors = getPalette('nord').light;
|
|
|
142
142
|
|
|
143
143
|
const content = `
|
|
144
144
|
bar Revenue by Quarter
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
x-label Quarter
|
|
146
|
+
y-label Revenue ($M)
|
|
147
147
|
|
|
148
148
|
Q1 12
|
|
149
149
|
Q2 19
|
|
@@ -440,8 +440,8 @@ Plain text. Lines starting with `#` or `//` are comments. Empty lines are ignore
|
|
|
440
440
|
|
|
441
441
|
```
|
|
442
442
|
<type> Optional Title
|
|
443
|
-
|
|
444
|
-
|
|
443
|
+
x-label X Axis
|
|
444
|
+
y-label Y Axis
|
|
445
445
|
series Series1, Series2
|
|
446
446
|
orientation horizontal
|
|
447
447
|
|