@diagrammo/dgmo 0.8.11 → 0.8.13

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 (68) hide show
  1. package/dist/cli.cjs +115 -719
  2. package/dist/index.cjs +196 -53
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +2 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.js +194 -54
  7. package/dist/index.js.map +1 -1
  8. package/docs/guide/chart-arc.md +71 -0
  9. package/docs/guide/chart-area.md +73 -0
  10. package/docs/guide/chart-bar-stacked.md +61 -0
  11. package/docs/guide/chart-bar.md +62 -0
  12. package/docs/guide/chart-boxes-and-lines.md +243 -0
  13. package/docs/guide/chart-c4.md +300 -0
  14. package/docs/guide/chart-chord.md +43 -0
  15. package/docs/guide/chart-class.md +204 -0
  16. package/docs/guide/chart-doughnut.md +38 -0
  17. package/docs/guide/chart-er.md +218 -0
  18. package/docs/guide/chart-flowchart.md +102 -0
  19. package/docs/guide/chart-function.md +56 -0
  20. package/docs/guide/chart-funnel.md +38 -0
  21. package/docs/guide/chart-gantt.md +368 -0
  22. package/docs/guide/chart-heatmap.md +41 -0
  23. package/docs/guide/chart-infra.md +694 -0
  24. package/docs/guide/chart-kanban.md +156 -0
  25. package/docs/guide/chart-line.md +79 -0
  26. package/docs/guide/chart-multi-line.md +84 -0
  27. package/docs/guide/chart-org.md +209 -0
  28. package/docs/guide/chart-pie.md +39 -0
  29. package/docs/guide/chart-polar-area.md +38 -0
  30. package/docs/guide/chart-quadrant.md +69 -0
  31. package/docs/guide/chart-radar.md +38 -0
  32. package/docs/guide/chart-sankey.md +103 -0
  33. package/docs/guide/chart-scatter.md +94 -0
  34. package/docs/guide/chart-sequence.md +332 -0
  35. package/docs/guide/chart-sitemap.md +248 -0
  36. package/docs/guide/chart-slope.md +56 -0
  37. package/docs/guide/chart-state.md +171 -0
  38. package/docs/guide/chart-timeline.md +229 -0
  39. package/docs/guide/chart-venn.md +81 -0
  40. package/docs/guide/chart-wordcloud.md +66 -0
  41. package/docs/guide/colors.md +283 -0
  42. package/docs/guide/index.md +55 -0
  43. package/docs/guide/keyboard-shortcuts.md +49 -0
  44. package/docs/guide/registry.json +51 -0
  45. package/gallery/fixtures/boxes-and-lines.dgmo +4 -6
  46. package/gallery/fixtures/er.dgmo +36 -0
  47. package/gallery/fixtures/kanban.dgmo +27 -0
  48. package/package.json +1 -1
  49. package/src/boxes-and-lines/parser.ts +2 -0
  50. package/src/boxes-and-lines/renderer.ts +12 -4
  51. package/src/c4/parser.ts +5 -1
  52. package/src/completion.ts +17 -2
  53. package/src/d3.ts +140 -71
  54. package/src/echarts.ts +1 -1
  55. package/src/er/parser.ts +5 -1
  56. package/src/gantt/parser.ts +8 -0
  57. package/src/gantt/renderer.ts +6 -7
  58. package/src/gantt/types.ts +1 -0
  59. package/src/infra/parser.ts +4 -0
  60. package/src/kanban/parser.ts +4 -1
  61. package/src/kanban/renderer.ts +1 -1
  62. package/src/org/parser.ts +3 -0
  63. package/src/sequence/parser.ts +2 -0
  64. package/src/sequence/renderer.ts +8 -6
  65. package/src/sharing.ts +18 -9
  66. package/src/sitemap/parser.ts +2 -0
  67. package/src/utils/legend-layout.ts +7 -3
  68. package/src/utils/tag-groups.ts +64 -0
@@ -0,0 +1,71 @@
1
+ # Arc Diagram
2
+
3
+ ```dgmo
4
+ arc Pirate Alliances
5
+ //order appearance | name | group | degree
6
+
7
+ // Source -> Target weight
8
+ [Caribbean](red)
9
+ Blackbeard -> Bonnet 8
10
+ Blackbeard -> Vane 5
11
+ Blackbeard -> Hornigold 4
12
+ Hornigold -> Bonnet 2
13
+
14
+ [Women Pirates](purple)
15
+ Bonny -> Rackham 9
16
+ Bonny -> Read 7
17
+ Rackham -> Vane 3
18
+
19
+ [West Africa](teal)
20
+ Roberts -> Davis 6
21
+ ```
22
+
23
+ ## Syntax
24
+
25
+ ```
26
+ arc Chart Title
27
+ order appearance
28
+
29
+ Source -> Target weight
30
+ ```
31
+
32
+ ## Metadata Keys
33
+
34
+ | Key | Description | Required |
35
+ | ------- | ------------------------------------------------------------------- | -------- |
36
+ | `chart` | Must be `arc` | Yes |
37
+ | `title` | Chart title displayed above the chart | No |
38
+ | `order` | Node ordering: `appearance` (default), `name`, `group`, or `degree` | No |
39
+
40
+ ## Data Format
41
+
42
+ Each data line defines a connection between two nodes with an optional weight:
43
+
44
+ ```
45
+ Source -> Target weight
46
+ Source -> Target
47
+ ```
48
+
49
+ If weight is omitted, it defaults to 1. Arc thickness is proportional to weight.
50
+
51
+ ## Node Groups
52
+
53
+ Use `[Group Name](color)` headers to group nodes by color:
54
+
55
+ ```
56
+ [Captains](red)
57
+ Blackbeard -> Bonnet 8
58
+ Blackbeard -> Vane 5
59
+
60
+ [Crew](blue)
61
+ Bonny -> Read 7
62
+ ```
63
+
64
+ Nodes inherit the color of the group in which they first appear.
65
+
66
+ ## Node Ordering
67
+
68
+ - `appearance` — nodes appear in the order they are first mentioned (default)
69
+ - `name` — nodes sorted alphabetically
70
+ - `group` — nodes sorted by group, then by appearance within group
71
+ - `degree` — nodes sorted by number of connections (most connected first)
@@ -0,0 +1,73 @@
1
+ # Area Chart
2
+
3
+ ```dgmo
4
+ area Fleet Growth Over Time
5
+ series Ships
6
+ x-label Year
7
+
8
+ era 1710 -> 1716 Rise (green)
9
+ era 1716 -> 1720 Decline (red)
10
+
11
+ 1710: 3
12
+ 1712: 5
13
+ 1714: 9
14
+ 1716: 14
15
+ 1718: 8
16
+ 1720: 4
17
+ ```
18
+
19
+ ## Syntax
20
+
21
+ ```
22
+ area Chart Title
23
+ series Series Name
24
+ x-label X Axis Label
25
+ y-label Y Axis Label
26
+
27
+ Label: value
28
+ ```
29
+
30
+ ## Era Bands
31
+
32
+ Annotate named time periods with a shaded background band and label:
33
+
34
+ ```dgmo
35
+ area Fleet Growth by Era
36
+ x-label Year
37
+
38
+ era 1710 -> 1714 Early Growth (blue)
39
+ era 1714 -> 1720 Decline (red)
40
+
41
+ 1710: 3
42
+ 1712: 5
43
+ 1714: 9
44
+ 1716: 14
45
+ 1718: 8
46
+ 1720: 4
47
+ ```
48
+
49
+ Era syntax: `era <start> -> <end> Label (color)`
50
+
51
+ - `start` and `end` must exactly match data point labels
52
+ - Color is optional; omit for the palette default
53
+
54
+ ## Metadata Keys
55
+
56
+ | Key | Description | Required |
57
+ | --------- | ----------------------------------------- | -------- |
58
+ | `chart` | Must be `area` | Yes |
59
+ | `title` | Chart title displayed above the chart | No |
60
+ | `series` | Name of the data series (shown in legend) | No |
61
+ | `x-label` | Label for the X axis | No |
62
+ | `y-label` | Label for the Y axis | No |
63
+ | `color` | Override the area fill color | No |
64
+
65
+ ## Data Format
66
+
67
+ Each data line follows the pattern `Label: value`:
68
+
69
+ ```
70
+ 1710: 3
71
+ 1712: 5
72
+ 1714: 9
73
+ ```
@@ -0,0 +1,61 @@
1
+ # Stacked Bar Chart
2
+
3
+ ```dgmo
4
+ bar-stacked Cargo by Voyage
5
+ series Rum, Spices, Silk, Gold
6
+
7
+ Voyage 1 40, 20, 10, 30
8
+ Voyage 2 25, 35, 20, 20
9
+ Voyage 3 15, 10, 45, 30
10
+ Voyage 4 30, 25, 15, 30
11
+ ```
12
+
13
+ ## Syntax
14
+
15
+ ```
16
+ bar-stacked Chart Title
17
+ series Series1, Series2, Series3
18
+
19
+ Label value1, value2, value3
20
+ ```
21
+
22
+ ## Metadata Keys
23
+
24
+ | Key | Description | Required |
25
+ | ------------------------ | ---------------------------------------------------------------- | -------- |
26
+ | `chart` | Must be `bar-stacked` | Yes |
27
+ | `title` | Chart title displayed above the chart | No |
28
+ | `series` | Comma-separated series names with optional colors in parentheses | Yes |
29
+ | `orientation-horizontal` | Horizontal bars (default is vertical) | No |
30
+
31
+ ## Data Format
32
+
33
+ Each data line provides comma-separated values matching the series order:
34
+
35
+ ```
36
+ Voyage 1 40, 20, 10, 30
37
+ Voyage 2 25, 35, 20, 20
38
+ ```
39
+
40
+ ## Series Colors
41
+
42
+ Colors can be specified per series:
43
+
44
+ ```
45
+ series Imports(blue), Exports(green), Tariffs(orange)
46
+ ```
47
+
48
+ ## Variants
49
+
50
+ ### Horizontal Stacked Bar
51
+
52
+ ```dgmo
53
+ bar-stacked Port Revenue by Trade
54
+ orientation-horizontal
55
+ series Imports(blue), Exports(green), Tariffs(orange)
56
+
57
+ Port Royal 300, 450, 80
58
+ Tortuga 150, 200, 30
59
+ Nassau 400, 350, 120
60
+ Havana 500, 600, 150
61
+ ```
@@ -0,0 +1,62 @@
1
+ # Bar Chart
2
+
3
+ ```dgmo
4
+ bar Treasure Hauls by Port
5
+ series Gold Doubloons
6
+
7
+ Port Royal 850
8
+ Tortuga 620
9
+ Nassau 1100
10
+ Havana 430
11
+ Cartagena 780
12
+ ```
13
+
14
+ ## Syntax
15
+
16
+ ```
17
+ bar Chart Title
18
+ series Series Name
19
+ x-label X Axis Label
20
+ y-label Y Axis Label
21
+
22
+ Label value
23
+ ```
24
+
25
+ ## Metadata Keys
26
+
27
+ | Key | Description | Required |
28
+ | ------------------------ | ----------------------------------------- | -------- |
29
+ | `chart` | Must be `bar` | Yes |
30
+ | `title` | Chart title displayed above the chart | No |
31
+ | `series` | Name of the data series (shown in legend) | No |
32
+ | `x-label` | Label for the X axis | No |
33
+ | `y-label` | Label for the Y axis | No |
34
+ | `orientation-horizontal` | Horizontal bars (default is vertical) | No |
35
+ | `color` | Override the bar color (e.g., `red`) | No |
36
+
37
+ ## Data Format
38
+
39
+ Each data line follows the pattern `Label value`:
40
+
41
+ ```
42
+ Port Royal 850
43
+ Tortuga 620
44
+ Nassau 1100
45
+ ```
46
+
47
+ ## Variants
48
+
49
+ ### Horizontal Bar
50
+
51
+ Add `orientation-horizontal` to display bars horizontally:
52
+
53
+ ```dgmo
54
+ bar Crew Size by Ship
55
+ orientation-horizontal
56
+ series Crew Members
57
+
58
+ Queen Anne's Revenge 300
59
+ Royal Fortune 262
60
+ Whydah Gally 146
61
+ Adventure Galley 152
62
+ ```
@@ -0,0 +1,243 @@
1
+ # Boxes and Lines
2
+
3
+ ```dgmo
4
+ boxes-and-lines Pirate Software
5
+
6
+ tag Status s
7
+ Done(green)
8
+ Doing(yellow)
9
+ Todo(red)
10
+ NA(gray) default
11
+
12
+ active-tag Status
13
+
14
+ MobileApp | s:Todo
15
+ -> API
16
+
17
+ WebSite | s:Doing
18
+ -> API
19
+
20
+ [Backend]
21
+ API | s:Doing
22
+ -> DB
23
+ -> AuthVendor
24
+
25
+ DB | s:Done
26
+
27
+ AuthVendor
28
+ ```
29
+
30
+ ## Overview
31
+
32
+ Boxes and lines is a general-purpose node-edge diagram for modeling systems, architectures, and relationships. Nodes are connected with labeled arrows, organized into nested groups, and annotated with color-coded tags.
33
+
34
+ Unlike more specialized diagram types (infra for traffic simulation, C4 for system context), boxes-and-lines is intentionally flexible. Node shapes are inferred from names — a node called "UserDB" renders as a cylinder, "Redis" as a diamond, "OrderQueue" as a hexagon.
35
+
36
+ ## Declaration
37
+
38
+ ```
39
+ boxes-and-lines Optional Title
40
+ ```
41
+
42
+ The first line declares the diagram type and optional title.
43
+
44
+ ## Nodes
45
+
46
+ Nodes are created explicitly or implicitly when referenced in edges.
47
+
48
+ ### Explicit nodes
49
+
50
+ ```
51
+ API Gateway | description: Main entry point
52
+ UserDB
53
+ ```
54
+
55
+ A name on its own line creates a node. Pipe metadata is optional.
56
+
57
+ ### Implicit nodes
58
+
59
+ ```
60
+ API Gateway -routes-> UserService
61
+ ```
62
+
63
+ If `UserService` hasn't been declared yet, it's created automatically from the edge.
64
+
65
+ ### Pipe metadata
66
+
67
+ ```
68
+ API Gateway | t: Backend, description: Main entry point
69
+ ```
70
+
71
+ Metadata uses pipe syntax with `key: value` pairs separated by commas. Common keys:
72
+
73
+ - Tag aliases (e.g., `t: Backend` where `t` is a tag alias)
74
+ - `description` — shown as a subtitle on the node
75
+
76
+ ### Shape inference
77
+
78
+ Node shapes are inferred from names:
79
+
80
+ | Name contains | Shape |
81
+ | ---------------------------------------------- | ----------------- |
82
+ | `DB`, `Database`, `Postgres`, `MySQL`, `Mongo` | Cylinder |
83
+ | `Cache`, `Redis`, `Memcached` | Diamond |
84
+ | `Queue`, `Kafka`, `SQS`, `EventBus` | Hexagon |
85
+ | `Gateway`, `LB`, `Proxy`, `Router` | Wide rectangle |
86
+ | `User`, `Actor`, `Client`, `Admin` | Rounded rectangle |
87
+ | `External`, `Stripe`, `Twilio` | Dashed border |
88
+ | Everything else | Default rectangle |
89
+
90
+ ## Edges
91
+
92
+ ### Directed edges
93
+
94
+ ```
95
+ A -> B // unlabeled
96
+ A -routes-> B // labeled
97
+ ```
98
+
99
+ ### Bidirectional edges
100
+
101
+ ```
102
+ A <-syncs-> B // bidirectional with label
103
+ A <-> B // bidirectional unlabeled
104
+ ```
105
+
106
+ ### Indented shorthand
107
+
108
+ When a node has multiple outbound edges, indent them below:
109
+
110
+ ```
111
+ API Gateway
112
+ -routes-> UserService
113
+ -routes-> ProductService
114
+ -routes-> OrderService
115
+ ```
116
+
117
+ This is equivalent to writing three separate edge lines with `API Gateway` as the source.
118
+
119
+ ### Edge metadata
120
+
121
+ ```
122
+ SessionCache <-syncs-> ProductDB | p: Medium
123
+ ```
124
+
125
+ Edges support pipe metadata, typically for tag values.
126
+
127
+ ## Groups
128
+
129
+ Groups visually contain nodes in a dashed rectangle.
130
+
131
+ ### Basic groups
132
+
133
+ ```
134
+ [AWS us-east-1]
135
+ API Gateway
136
+ UserService
137
+ ProductDB
138
+ ```
139
+
140
+ ### Nested groups (max 2 levels)
141
+
142
+ ```
143
+ [AWS us-east-1]
144
+ [Compute]
145
+ API Gateway
146
+ UserService
147
+ [Data]
148
+ UserDB
149
+ ProductDB
150
+ ```
151
+
152
+ ### Group-to-group edges
153
+
154
+ Groups can be edge endpoints:
155
+
156
+ ```
157
+ [Frontend] -> [Backend]
158
+ ```
159
+
160
+ ## Tags
161
+
162
+ Tags add colored metadata dimensions for filtering and visual grouping.
163
+
164
+ ### Declaring tags
165
+
166
+ ```
167
+ tag Team t Backend(blue), Frontend(green), Platform(purple)
168
+ tag Priority p High(red), Medium(orange), Low(gray)
169
+ ```
170
+
171
+ Format: `tag Name alias Value1(color), Value2(color), ...`
172
+
173
+ ### Assigning tags
174
+
175
+ Use the alias in pipe metadata:
176
+
177
+ ```
178
+ API Gateway | t: Backend
179
+ UserDB | t: Platform
180
+ ```
181
+
182
+ ### Filtering
183
+
184
+ ```
185
+ active-tag Team // color nodes by Team tag
186
+ hide priority:Low // hide nodes tagged Low priority
187
+ ```
188
+
189
+ ## Options
190
+
191
+ | Directive | Values | Default | Description |
192
+ | ------------ | -------------- | ------- | ------------------------------------------- |
193
+ | `direction` | `LR`, `TB` | `TB` | Layout direction (left-right or top-bottom) |
194
+ | `active-tag` | tag group name | none | Which tag group drives node coloring |
195
+ | `hide` | `alias:value` | none | Hide nodes with a specific tag value |
196
+ | `mode` | `shapes` | — | Force shape rendering mode |
197
+
198
+ ## Comments
199
+
200
+ ```
201
+ // This is a comment
202
+ ```
203
+
204
+ Only `//` comments are supported.
205
+
206
+ ## Complete Example
207
+
208
+ ```dgmo
209
+ boxes-and-lines Microservices
210
+
211
+ tag Team t Backend(blue), Frontend(green), Infra(purple)
212
+ active-tag Team
213
+ direction LR
214
+
215
+ WebApp | t: Frontend
216
+ -> API Gateway
217
+
218
+ API Gateway | t: Infra
219
+ -auth-> AuthService
220
+ -data-> DataService
221
+
222
+ AuthService | t: Backend
223
+ -> UserDB
224
+
225
+ DataService | t: Backend
226
+ -> PostgreSQL
227
+ -> Redis
228
+
229
+ UserDB | t: Infra
230
+ PostgreSQL | t: Infra
231
+ Redis | t: Infra
232
+
233
+ [Cloud]
234
+ [Services]
235
+ API Gateway
236
+ AuthService
237
+ DataService
238
+ [Storage]
239
+ UserDB
240
+ PostgreSQL
241
+
242
+ Redis <-cache-> DataService
243
+ ```