@littledragon_wxl/drawio-style-graph 1.0.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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +175 -0
- package/README_zh.md +171 -0
- package/SKILL.md +419 -0
- package/data/SHAPE-INDEX-NOTICE.md +17 -0
- package/data/lobe-icons.json +878 -0
- package/data/shape-index.json.gz +0 -0
- package/package.json +43 -0
- package/references/autolayout.md +125 -0
- package/references/diagram-types.md +83 -0
- package/references/shapes.md +151 -0
- package/references/style-application-guide.md +120 -0
- package/references/style-diagram-matrix.md +159 -0
- package/references/style-extraction.md +255 -0
- package/references/style-presets.md +110 -0
- package/references/styles/style-1-flat-icon.md +79 -0
- package/references/styles/style-2-dark-terminal.md +80 -0
- package/references/styles/style-3-blueprint.md +84 -0
- package/references/styles/style-4-notion-clean.md +78 -0
- package/references/styles/style-5-glassmorphism.md +85 -0
- package/references/styles/style-6-claude-official.md +84 -0
- package/references/styles/style-7-openai.md +94 -0
- package/references/styles/style-8-dark-luxury.md +109 -0
- package/references/troubleshooting.md +63 -0
- package/scripts/aiicons.py +201 -0
- package/scripts/autolayout.py +341 -0
- package/scripts/encode_drawio_url.py +58 -0
- package/scripts/goimports.py +141 -0
- package/scripts/jsimports.py +162 -0
- package/scripts/pyclasses.py +156 -0
- package/scripts/pyimports.py +153 -0
- package/scripts/repair_png.py +37 -0
- package/scripts/rustimports.py +203 -0
- package/scripts/shapesearch.py +162 -0
- package/scripts/validate.py +137 -0
- package/styles/built-in/corporate.json +49 -0
- package/styles/built-in/default.json +49 -0
- package/styles/built-in/handdrawn.json +49 -0
- package/styles/schema-drawio.json +112 -0
- package/styles/schema.json +213 -0
package/SKILL.md
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: drawio-style-graph
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: >-
|
|
5
|
+
Use when the user wants to create any technical diagram with custom visual
|
|
6
|
+
styles — architecture, data flow, flowchart, sequence, agent/memory, ERD,
|
|
7
|
+
UML, or concept map — and export as .drawio (editable) + PNG/SVG/PDF.
|
|
8
|
+
8 built-in visual styles adapted from fireworks-tech-graph, rendered
|
|
9
|
+
through draw.io's rich shape vocabulary and icon system.
|
|
10
|
+
Self-contained — no other skills required.
|
|
11
|
+
Trigger on: "风格图" "带风格的图" "暗黑风格" "蓝图风格" "极简风格"
|
|
12
|
+
"玻璃风格" "奢华风格" "style diagram" "styled architecture"
|
|
13
|
+
"drawio" "draw.io" ".drawio" "可编辑的图" "editable diagram"
|
|
14
|
+
or when the user explicitly asks for drawio format or a specific visual style.
|
|
15
|
+
Also trigger on "画图" "架构图" "流程图" ONLY when the user requests
|
|
16
|
+
a specific visual style name, AI brand icons, or editable .drawio output.
|
|
17
|
+
Do NOT trigger for: raw SVG generation, CSS-heavy effects, quick sketches,
|
|
18
|
+
or mermaid/plantuml code blocks.
|
|
19
|
+
license: MIT
|
|
20
|
+
homepage: https://github.com/Agents365-ai/drawio-style-graph
|
|
21
|
+
install: npx skills add agents365-ai/drawio-style-graph
|
|
22
|
+
compatibility: >-
|
|
23
|
+
Requires draw.io desktop app CLI on PATH (macOS/Linux/Windows) for export.
|
|
24
|
+
Core .drawio generation needs Python 3 only.
|
|
25
|
+
Optional auto-layout (scripts/autolayout.py) needs Graphviz (dot).
|
|
26
|
+
platforms: [macos, linux, windows]
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# Draw.io Style Graph
|
|
30
|
+
|
|
31
|
+
Generate `.drawio` XML files with 8 professional visual styles and export to
|
|
32
|
+
PNG/SVG/PDF/JPG locally using the native draw.io desktop app CLI.
|
|
33
|
+
|
|
34
|
+
**Supported formats:** PNG, SVG, PDF, JPG — no browser automation needed.
|
|
35
|
+
PNG, SVG, and PDF exports support `--embed-diagram` (`-e`) — opening the
|
|
36
|
+
exported file in draw.io recovers the editable diagram.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx skills add agents365-ai/drawio-style-graph
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Or directly from npm:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install @agents365-ai/drawio-style-graph
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
No other skills required — everything is self-contained.
|
|
51
|
+
|
|
52
|
+
## When to use / when NOT to use
|
|
53
|
+
|
|
54
|
+
**Use this skill for:**
|
|
55
|
+
- Polished, precise diagrams with custom visual styles
|
|
56
|
+
- Architecture, network, UML, ERD, flowcharts, ML/DL models, sequence diagrams
|
|
57
|
+
- 10,000+ stock/branded shapes (AWS/Azure/GCP/Cisco/K8s)
|
|
58
|
+
- 321 AI/LLM brand logos (OpenAI, Claude, Gemini, Mistral, etc.)
|
|
59
|
+
- Swimlanes, custom geometry, solid opaque fills
|
|
60
|
+
- Export to editable PNG/SVG/PDF
|
|
61
|
+
- Diagrams needing a specific visual style (dark terminal, blueprint, glassmorphism, etc.)
|
|
62
|
+
|
|
63
|
+
**Do NOT use — route elsewhere — for:**
|
|
64
|
+
- A casual hand-drawn / whiteboard look → **excalidraw** or **tldraw**
|
|
65
|
+
- Diagrams-as-code that live in git / render in Markdown → **mermaid** or **plantuml**
|
|
66
|
+
- Freeform infinite-canvas sketching → **tldraw**
|
|
67
|
+
- Raw SVG with CSS backdrop-filter, complex gradients, or pixel-level effects → **fireworks-tech-graph**
|
|
68
|
+
|
|
69
|
+
## Relationship with Other Skills
|
|
70
|
+
|
|
71
|
+
This skill is a **superset of drawio-skill** and can replace it entirely.
|
|
72
|
+
Here is how the three diagram skills relate:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
┌──────────────────────────────────────────────────┐
|
|
76
|
+
│ drawio-style-graph ← 这个 (推荐保留) │
|
|
77
|
+
│ .drawio 格式 · 可编辑 · 8 风格 · 10k+ 形状 │
|
|
78
|
+
│ = drawio-skill 的全部能力 + fireworks 的 8 种风格 │
|
|
79
|
+
├──────────────────────────────────────────────────┤
|
|
80
|
+
│ fireworks-tech-graph ← 独立场景 (建议保留) │
|
|
81
|
+
│ SVG+PNG 直出 · CSS 特效 · 像素级控制 │
|
|
82
|
+
│ draw.io 做不到的: backdrop-filter, 复杂渐变, │
|
|
83
|
+
│ jump-over 弧线, foreignObject, 精确滤镜 │
|
|
84
|
+
├──────────────────────────────────────────────────┤
|
|
85
|
+
│ drawio-skill ← 已被取代 (可以删除) │
|
|
86
|
+
│ drawio-style-graph 包含其全部脚本+数据+能力 │
|
|
87
|
+
└──────────────────────────────────────────────────┘
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**建议配置:**
|
|
91
|
+
- ✅ 保留 `drawio-style-graph` + `fireworks-tech-graph`(分工明确,无冲突)
|
|
92
|
+
- ❌ 删除 `drawio-skill`(`drawio-style-graph` 已包含其全部能力)
|
|
93
|
+
|
|
94
|
+
**分工规则:**
|
|
95
|
+
| 用户说 | 路由到 |
|
|
96
|
+
|--------|--------|
|
|
97
|
+
| "画一个架构图" / "画个流程图" | `drawio-style-graph`(默认,输出可编辑 .drawio) |
|
|
98
|
+
| "用暗黑风格画图" / "用蓝图风格" | `drawio-style-graph`(风格关键词) |
|
|
99
|
+
| "生成 SVG 格式的架构图" / "导出 SVG" | `fireworks-tech-graph`(明确要 SVG) |
|
|
100
|
+
| "要做毛玻璃效果" / "要 CSS 特效" | `fireworks-tech-graph`(draw.io 做不到) |
|
|
101
|
+
| "画个可编辑的图" / "生成 drawio" | `drawio-style-graph`(明确要 drawio) |
|
|
102
|
+
|
|
103
|
+
## 8 Built-in Visual Styles
|
|
104
|
+
|
|
105
|
+
These styles are adapted from fireworks-tech-graph's design tokens, mapped to
|
|
106
|
+
draw.io-compatible `style=` attribute values.
|
|
107
|
+
|
|
108
|
+
| # | Style | Aesthetic | Load when |
|
|
109
|
+
|---|-------|-----------|-----------|
|
|
110
|
+
| 1 | **Flat Icon** | Clean, colorful, draw.io-native | Default style |
|
|
111
|
+
| 2 | **Dark Terminal** | Neon-on-dark, hacker aesthetic | AI/ML architecture, dev blogs |
|
|
112
|
+
| 3 | **Blueprint** | Technical blueprint, formal docs | UML, Network, Infrastructure |
|
|
113
|
+
| 4 | **Notion Clean** | Minimal, warm gray, sans-serif | Notion docs, clean documentation |
|
|
114
|
+
| 5 | **Glassmorphism** | Frosted glass, layered depth | Product demos, presentations |
|
|
115
|
+
| 6 | **Claude Official** | Warm, earthy, Anthropic-style | AI system docs, presentations |
|
|
116
|
+
| 7 | **OpenAI Official** | Clean, precise, minimal borders | API docs, technical specs |
|
|
117
|
+
| 8 | **Dark Luxury** | Gold-on-black, premium editorial | Premium docs, keynotes |
|
|
118
|
+
|
|
119
|
+
Each style is defined in `references/styles/style-N-<name>.md` with:
|
|
120
|
+
- Color palette → `fillColor`/`strokeColor` pairs for each role
|
|
121
|
+
- Typography → `fontFamily`, `fontSize`, `fontColor` settings
|
|
122
|
+
- Shape preferences → `rounded`, shape keywords per role
|
|
123
|
+
- Edge style → base edge style, arrow colors, dash patterns
|
|
124
|
+
- Extras → `sketch`, `shadow`, `glass`, `strokeWidth` flags
|
|
125
|
+
|
|
126
|
+
For style-diagram compatibility recommendations, see `references/style-diagram-matrix.md`.
|
|
127
|
+
For detailed application instructions, see `references/style-application-guide.md`.
|
|
128
|
+
|
|
129
|
+
## Bundled Resources
|
|
130
|
+
|
|
131
|
+
When the workflow references one of these, read it on demand — none need to be in
|
|
132
|
+
context up front.
|
|
133
|
+
|
|
134
|
+
| File | Read it when |
|
|
135
|
+
|------|-------------|
|
|
136
|
+
| `references/styles/style-N-<name>.md` | A visual style is selected (8 files, one per style) |
|
|
137
|
+
| `references/style-application-guide.md` | You need to apply style tokens to draw.io shapes |
|
|
138
|
+
| `references/style-diagram-matrix.md` | Choosing which style works best for a diagram type |
|
|
139
|
+
| `references/diagram-types.md` | The user names a specific diagram type (ERD, UML class, sequence, architecture, ML/DL, flowchart) |
|
|
140
|
+
| `references/shapes.md` + `scripts/shapesearch.py` | The diagram needs a **specific shape** — cloud icons (AWS/Azure/GCP), Cisco/K8s/network symbols, UML/BPMN/ER elements. `shapesearch.py "<keywords>"` returns the exact official style for 10,446 shapes |
|
|
141
|
+
| `scripts/aiicons.py` | The diagram involves an **AI/LLM brand** (OpenAI, Claude, Gemini, Mistral, Llama, HuggingFace, Ollama, LangChain, …321 brands). Returns a draw.io `image` style for the brand logo |
|
|
142
|
+
| `references/style-presets.md` | The user asks to learn / save / list / set-default / delete a style preset |
|
|
143
|
+
| `references/style-extraction.md` | You're inside the Learn flow (called from `style-presets.md`) |
|
|
144
|
+
| `references/troubleshooting.md` | An export fails or rendering looks wrong |
|
|
145
|
+
| `scripts/repair_png.py` | After every `-e` PNG export — fixes draw.io's truncated IEND chunk |
|
|
146
|
+
| `scripts/encode_drawio_url.py` | The CLI is unavailable and you need a browser-fallback diagrams.net URL |
|
|
147
|
+
| `references/autolayout.md` | Large diagrams (>~15 nodes) — use Graphviz to place nodes + route edges |
|
|
148
|
+
| `scripts/pyimports.py` / `jsimports.py` / `goimports.py` / `rustimports.py` | Visualize a **Python/JS-TS/Go/Rust project** structure — extracts import graph |
|
|
149
|
+
| `scripts/pyclasses.py` | Visualize a **Python class hierarchy** — extracts classes + inheritance |
|
|
150
|
+
| `scripts/validate.py` | After generating `.drawio` — fast structural lint (dangling edges, dup ids, overlaps) |
|
|
151
|
+
|
|
152
|
+
## Prerequisites
|
|
153
|
+
|
|
154
|
+
The draw.io desktop app must be installed and the CLI accessible:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# macOS (Homebrew — `drawio`, not `draw.io`)
|
|
158
|
+
brew install --cask drawio
|
|
159
|
+
drawio --version
|
|
160
|
+
|
|
161
|
+
# macOS (full path)
|
|
162
|
+
/Applications/draw.io.app/Contents/MacOS/draw.io --version
|
|
163
|
+
|
|
164
|
+
# Windows
|
|
165
|
+
"C:\Program Files\draw.io\draw.io.exe" --version
|
|
166
|
+
|
|
167
|
+
# Linux
|
|
168
|
+
drawio --version
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Install draw.io desktop if missing:
|
|
172
|
+
- macOS: `brew install --cask drawio` or download from https://github.com/jgraph/drawio-desktop/releases
|
|
173
|
+
- Windows: download from https://github.com/jgraph/drawio-desktop/releases
|
|
174
|
+
- Linux: download `.deb`/`.rpm` from https://github.com/jgraph/drawio-desktop/releases — **do not use snap**
|
|
175
|
+
|
|
176
|
+
**macOS sandbox note:** In sandboxed environments, the CLI may crash. Treat CLI
|
|
177
|
+
as unavailable in that case — use browser fallback or `.drawio` XML only.
|
|
178
|
+
|
|
179
|
+
## Workflow
|
|
180
|
+
|
|
181
|
+
### Step 0 — Gather Requirements
|
|
182
|
+
|
|
183
|
+
Before starting, assess the user's request. If key details are missing, ask
|
|
184
|
+
1-3 focused questions:
|
|
185
|
+
|
|
186
|
+
- **Diagram type** — architecture, flowchart, sequence, ERD, UML, ML/DL, mind map?
|
|
187
|
+
- **Visual style** — which of the 8 styles? (Default: Style 1 Flat Icon if not specified)
|
|
188
|
+
- **Output format** — PNG (default), SVG, PDF, or JPG?
|
|
189
|
+
- **Output location** — default is working dir; honor explicit paths.
|
|
190
|
+
- **Scope** — how many components? Specific technologies or labels?
|
|
191
|
+
|
|
192
|
+
Skip clarification if the request is clearly specified.
|
|
193
|
+
|
|
194
|
+
**Style resolution — check the user's message for style keywords:**
|
|
195
|
+
- "dark terminal", "暗黑", "terminal" → Style 2
|
|
196
|
+
- "blueprint", "蓝图" → Style 3
|
|
197
|
+
- "notion", "极简", "clean" → Style 4
|
|
198
|
+
- "glass", "玻璃", "glassmorphism" → Style 5
|
|
199
|
+
- "claude", "anthropic" → Style 6
|
|
200
|
+
- "openai" → Style 7
|
|
201
|
+
- "luxury", "奢华", "dark luxury" → Style 8
|
|
202
|
+
- No keyword → Style 1 (Flat Icon, default)
|
|
203
|
+
|
|
204
|
+
### Step 1 — Check Dependencies
|
|
205
|
+
|
|
206
|
+
Resolve the draw.io binary name:
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
if command -v drawio &>/dev/null; then
|
|
210
|
+
DRAWIO="drawio"
|
|
211
|
+
elif command -v draw.io &>/dev/null; then
|
|
212
|
+
DRAWIO="draw.io"
|
|
213
|
+
elif [ -f "/Applications/draw.io.app/Contents/MacOS/draw.io" ]; then
|
|
214
|
+
DRAWIO="/Applications/draw.io.app/Contents/MacOS/draw.io"
|
|
215
|
+
elif grep -qi microsoft /proc/version 2>/dev/null && [ -f "/mnt/c/Program Files/draw.io/draw.io.exe" ]; then
|
|
216
|
+
DRAWIO="/mnt/c/Program Files/draw.io/draw.io.exe"
|
|
217
|
+
fi
|
|
218
|
+
$DRAWIO --version
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Step 2 — Load Style, Plan, Generate
|
|
222
|
+
|
|
223
|
+
1. **Load the style reference** from `references/styles/style-N-<name>.md`
|
|
224
|
+
2. **Load diagram-type preset** (if applicable) from `references/diagram-types.md`
|
|
225
|
+
3. **Merge**: Diagram-type structural keywords + visual style colors/fonts/edges/extras.
|
|
226
|
+
When both define a color, the visual style wins.
|
|
227
|
+
4. **Plan layout** — identify shapes, roles, relationships, layout direction (LR/TB).
|
|
228
|
+
|
|
229
|
+
**Role → Style Palette mapping:**
|
|
230
|
+
| Role | Style Slot | Example |
|
|
231
|
+
|------|-----------|---------|
|
|
232
|
+
| Service / component | primary | API service, microservice |
|
|
233
|
+
| Database / storage | success | PostgreSQL, Redis, S3 |
|
|
234
|
+
| Queue / message bus | warning | Kafka, RabbitMQ |
|
|
235
|
+
| Gateway / API / LB | accent | API Gateway, Load Balancer |
|
|
236
|
+
| Error / alert | danger | Error handler, monitoring |
|
|
237
|
+
| Security / auth | secondary | OAuth, IAM |
|
|
238
|
+
| External system | neutral | Third-party API |
|
|
239
|
+
|
|
240
|
+
### Step 3 — Generate & Validate .drawio
|
|
241
|
+
|
|
242
|
+
Write the `.drawio` file:
|
|
243
|
+
|
|
244
|
+
```xml
|
|
245
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
246
|
+
<mxfile host="drawio" version="26.0.0">
|
|
247
|
+
<diagram name="Page-1">
|
|
248
|
+
<mxGraphModel>
|
|
249
|
+
<root>
|
|
250
|
+
<mxCell id="0" />
|
|
251
|
+
<mxCell id="1" parent="0" />
|
|
252
|
+
<!-- User shapes start at id="2" -->
|
|
253
|
+
</root>
|
|
254
|
+
</mxGraphModel>
|
|
255
|
+
</diagram>
|
|
256
|
+
</mxfile>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
**Rules:**
|
|
260
|
+
- `id="0"` and `id="1"` are required root cells
|
|
261
|
+
- User shapes start at `id="2"`, increment sequentially
|
|
262
|
+
- All shapes have `parent="1"` (unless inside a container)
|
|
263
|
+
- Escape: `&` `<` `>` `"`
|
|
264
|
+
- Multi-line labels: `
` (not `\n`)
|
|
265
|
+
- Never use `--` in XML comments
|
|
266
|
+
|
|
267
|
+
For **large diagrams (>15 nodes)**, use auto-layout:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
python3 scripts/autolayout.py graph.json -o output.drawio
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
After generating, run validation:
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
python3 scripts/validate.py output.drawio
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Report the generated `.drawio` file path. Done.
|
|
280
|
+
|
|
281
|
+
### Optional: Export to PNG/SVG/PDF
|
|
282
|
+
|
|
283
|
+
If the user explicitly asks for an exported image, use the draw.io CLI:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Resolve binary first
|
|
287
|
+
if command -v drawio &>/dev/null; then DRAWIO="drawio"
|
|
288
|
+
elif command -v draw.io &>/dev/null; then DRAWIO="draw.io"
|
|
289
|
+
elif [ -f "/Applications/draw.io.app/Contents/MacOS/draw.io" ]; then
|
|
290
|
+
DRAWIO="/Applications/draw.io.app/Contents/MacOS/draw.io"
|
|
291
|
+
fi
|
|
292
|
+
|
|
293
|
+
# PNG (editable, embeds .drawio XML)
|
|
294
|
+
$DRAWIO -x -f png -e -s 2 -o diagram.drawio.png diagram.drawio
|
|
295
|
+
python3 scripts/repair_png.py diagram.drawio.png
|
|
296
|
+
|
|
297
|
+
# SVG
|
|
298
|
+
$DRAWIO -x -f svg -e -o diagram.svg diagram.drawio
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
If CLI is unavailable, use browser fallback:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
python3 scripts/encode_drawio_url.py diagram.drawio # viewer
|
|
305
|
+
python3 scripts/encode_drawio_url.py --edit diagram.drawio # editor
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
## Draw.io XML Quick Reference
|
|
309
|
+
|
|
310
|
+
### Vertex (Shape)
|
|
311
|
+
|
|
312
|
+
```xml
|
|
313
|
+
<mxCell id="2" value="Label" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Helvetica;fontSize=14;" vertex="1" parent="1">
|
|
314
|
+
<mxGeometry x="100" y="100" width="160" height="60" as="geometry" />
|
|
315
|
+
</mxCell>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Edge (Connector) — MUST include `<mxGeometry relative="1" as="geometry" />`
|
|
319
|
+
|
|
320
|
+
```xml
|
|
321
|
+
<mxCell id="10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;entryX=0.5;entryY=0;" edge="1" parent="1" source="2" target="3">
|
|
322
|
+
<mxGeometry relative="1" as="geometry" />
|
|
323
|
+
</mxCell>
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Self-closing edge cells (`<mxCell ... edge="1" ... />`) are **invalid** — always use expanded form.
|
|
327
|
+
|
|
328
|
+
### Container (Swimlane)
|
|
329
|
+
|
|
330
|
+
```xml
|
|
331
|
+
<mxCell id="svc1" value="Service Layer" style="swimlane;startSize=30;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
|
|
332
|
+
<mxGeometry x="100" y="100" width="300" height="200" as="geometry"/>
|
|
333
|
+
</mxCell>
|
|
334
|
+
<!-- Child — coordinates relative to container -->
|
|
335
|
+
<mxCell id="api1" value="REST API" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="svc1">
|
|
336
|
+
<mxGeometry x="20" y="40" width="120" height="60" as="geometry"/>
|
|
337
|
+
</mxCell>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Common Shape Keywords
|
|
341
|
+
|
|
342
|
+
| Shape | Style keyword |
|
|
343
|
+
|-------|--------------|
|
|
344
|
+
| Rectangle | `rounded=0;` |
|
|
345
|
+
| Rounded rect | `rounded=1;` |
|
|
346
|
+
| Ellipse/Circle | `ellipse;` |
|
|
347
|
+
| Diamond | `rhombus;` |
|
|
348
|
+
| Cylinder (DB) | `shape=cylinder3;` |
|
|
349
|
+
| Cloud | `cloud;` |
|
|
350
|
+
| Parallelogram | `shape=parallelogram;perimeter=parallelogramPerimeter;` |
|
|
351
|
+
| Hexagon | `shape=hexagon;perimeter=hexagonPerimeter2;` |
|
|
352
|
+
| Document | `shape=document;` |
|
|
353
|
+
|
|
354
|
+
For vendor icons (AWS, Azure, GCP, Cisco, Kubernetes), **run shapesearch.py** —
|
|
355
|
+
never guess a `shape=mxgraph.*` name:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
python3 scripts/shapesearch.py "aws lambda" --limit 5
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
For AI/LLM brand logos:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
python3 scripts/aiicons.py "openai" --json
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## Edge Routing
|
|
368
|
+
|
|
369
|
+
- Always include `rounded=1;orthogonalLoop=1;jettySize=auto` for smart routing
|
|
370
|
+
- Pin `exitX/exitY/entryX/entryY` when a node has 2+ connections
|
|
371
|
+
- Add `<Array as="points">` waypoints when routing around shapes
|
|
372
|
+
- Leave ≥20px for the final straight segment before arrowhead
|
|
373
|
+
- Distribute connections across shape perimeter:
|
|
374
|
+
|
|
375
|
+
| Position | exitX/entryX | exitY/entryY |
|
|
376
|
+
|----------|-------------|-------------|
|
|
377
|
+
| Top center | 0.5 | 0 |
|
|
378
|
+
| Top-left | 0.25 | 0 |
|
|
379
|
+
| Top-right | 0.75 | 0 |
|
|
380
|
+
| Right center | 1 | 0.5 |
|
|
381
|
+
| Bottom center | 0.5 | 1 |
|
|
382
|
+
| Left center | 0 | 0.5 |
|
|
383
|
+
|
|
384
|
+
## Spacing & Layout
|
|
385
|
+
|
|
386
|
+
| Complexity | Nodes | H-Gap | V-Gap |
|
|
387
|
+
|-----------|-------|-------|-------|
|
|
388
|
+
| Simple | ≤5 | 200px | 150px |
|
|
389
|
+
| Medium | 6-10 | 280px | 200px |
|
|
390
|
+
| Complex | >10 | 350px | 250px |
|
|
391
|
+
|
|
392
|
+
- Snap x, y, width, height to multiples of 10
|
|
393
|
+
- Leave 80px routing corridors between rows/columns
|
|
394
|
+
- Place hub nodes centrally, satellites around them
|
|
395
|
+
- Center-align children under parents (same center x)
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
## Style Presets System
|
|
399
|
+
|
|
400
|
+
Users can save custom style presets:
|
|
401
|
+
|
|
402
|
+
- User presets:
|
|
403
|
+
- Built-in presets: (, , )
|
|
404
|
+
|
|
405
|
+
For the full preset system — Learn flow, management ops, application rules —
|
|
406
|
+
read and .
|
|
407
|
+
|
|
408
|
+
## Common Mistakes
|
|
409
|
+
|
|
410
|
+
| Symptom | Fix |
|
|
411
|
+
|---------|-----|
|
|
412
|
+
| Edge doesn't render | Add `<mxGeometry relative="1" as="geometry" />` child |
|
|
413
|
+
| Blank shape for vendor icon | Use `shapesearch.py`, don't guess `shape=mxgraph.*` |
|
|
414
|
+
| Text overflows shape | Increase width or use `
` for line breaks |
|
|
415
|
+
| Arrowhead overlaps bend | Increase spacing or add waypoints |
|
|
416
|
+
| PNG corrupted after `-e` export | Run `scripts/repair_png.py` |
|
|
417
|
+
| CLI unavailable | Use `scripts/encode_drawio_url.py` browser fallback |
|
|
418
|
+
|
|
419
|
+
For detailed troubleshooting, see `references/troubleshooting.md`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Shape index attribution
|
|
2
|
+
|
|
3
|
+
`shape-index.json.gz` is a gzipped copy of the shape search index from
|
|
4
|
+
[jgraph/drawio-mcp](https://github.com/jgraph/drawio-mcp) (`shape-search/search-index.json`),
|
|
5
|
+
which is generated from the official draw.io / diagrams.net client shape
|
|
6
|
+
libraries. Both upstream sources are licensed under the **Apache License 2.0**.
|
|
7
|
+
|
|
8
|
+
- Each entry is `{style, w, h, title, tags, type}` for one palette shape.
|
|
9
|
+
- 10,446 shapes spanning AWS, Azure, GCP, Cisco, Kubernetes, UML, BPMN, P&ID,
|
|
10
|
+
electrical, flowchart, network, and the general shape sets.
|
|
11
|
+
- Used read-only by `scripts/shapesearch.py` to resolve exact official style
|
|
12
|
+
strings instead of hand-guessing them.
|
|
13
|
+
|
|
14
|
+
To refresh against a newer draw.io release, regenerate upstream with
|
|
15
|
+
`shape-search/generate-index.js` in the drawio-mcp repo, then re-gzip:
|
|
16
|
+
|
|
17
|
+
gzip -9 -c search-index.json > data/shape-index.json.gz
|