agentic-mermaid 0.1.1 → 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/AGENT_NATIVE.md +155 -91
- package/CHANGELOG.md +163 -4
- package/Instructions_for_agents.md +10 -10
- package/LICENSES/Apache-2.0.txt +202 -0
- package/README.md +31 -38
- package/THIRD_PARTY_NOTICES.md +29 -0
- package/assets/hero.png +0 -0
- package/dist/agent-core.d.ts +463 -0
- package/dist/agent-core.js +397 -0
- package/dist/agent.d.ts +73 -1868
- package/dist/agent.js +336 -37325
- package/dist/agentic-mermaid-mcp.js +7 -38399
- package/dist/am.js +33626 -40446
- package/dist/chunk-2P5FKUQC.js +3485 -0
- package/dist/chunk-2S3VSS6I.js +149 -0
- package/dist/chunk-2SILJDW2.js +37 -0
- package/dist/chunk-BJYMBT4I.js +61963 -0
- package/dist/chunk-FDM43XU7.js +615 -0
- package/dist/chunk-MYPDVZCO.js +4702 -0
- package/dist/index-DWPa2MJs.d.ts +6780 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +310 -33014
- package/dist/mcp-cli-5J47WEY3.js +17 -0
- package/docs/README.md +39 -31
- package/docs/agent-api-cookbook.md +44 -35
- package/docs/agent-mutation-policy.md +1 -1
- package/docs/agent-workflow-examples.md +2 -2
- package/docs/api.md +284 -77
- package/docs/ascii.md +26 -16
- package/docs/code-mode-impact.md +214 -0
- package/docs/comparison.md +23 -11
- package/docs/computational-aesthetics-prototype-plan.md +252 -0
- package/docs/config.md +26 -10
- package/docs/custom-fonts.md +265 -0
- package/docs/custom-style-cookbook.md +130 -9
- package/docs/diagram-families.md +48 -23
- package/docs/features.md +59 -52
- package/docs/fork-differences.md +6 -3
- package/docs/getting-started.md +23 -16
- package/docs/issue-derived-test-cases.md +29 -22
- package/docs/mcp-code-mode-rationale.md +13 -6
- package/docs/mcp-http-transport.md +20 -13
- package/docs/mermaid-layout-complaints.md +66 -52
- package/docs/mutation-testing.md +145 -66
- package/docs/quality.md +23 -14
- package/docs/react.md +2 -2
- package/docs/schemas/style-spec.schema.json +1221 -30
- package/docs/style-authoring.md +241 -38
- package/docs/svg-semantic-contract.md +49 -0
- package/docs/testing-strategy.md +166 -58
- package/docs/theming.md +19 -32
- package/examples/styles/catalog.json +54 -0
- package/examples/styles/cloudflare-workers-inspired-prototype.mmd +9 -0
- package/examples/styles/cloudflare-workers-inspired-prototype.style.json +110 -0
- package/examples/styles/cupertino-prototype.mmd +10 -0
- package/examples/styles/cupertino-prototype.style.json +63 -0
- package/examples/styles/mid-century-report.style.json +2 -2
- package/examples/styles/star-chart-atlas.style.json +2 -1
- package/examples/styles/transit-route-map.style.json +2 -2
- package/examples/styles/vercel-inspired-prototype.mmd +6 -0
- package/examples/styles/vercel-inspired-prototype.style.json +87 -0
- package/package.json +85 -45
- package/server.json +2 -2
- package/skills/agentic-mermaid-diagram-workflow/SKILL.md +17 -36
- package/skills/agentic-mermaid-diagram-workflow/references/cli.md +4 -5
- package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +15 -31
- package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +10 -14
- package/skills/agentic-mermaid-live-editor/SKILL.md +100 -206
- package/TODO.md +0 -684
- package/dist/index-wjRjbsP-.d.ts +0 -1102
- package/docs/assets/improvements/box-start-connector.png +0 -0
- package/docs/assets/improvements/comment-dropped-lint.png +0 -0
- package/docs/assets/improvements/er-content-loss.png +0 -0
- package/docs/assets/improvements/fan-in-trunks.png +0 -0
- package/docs/assets/improvements/gantt-family.png +0 -0
- package/docs/assets/improvements/gantt-milestone-clamp.png +0 -0
- package/docs/assets/improvements/gantt-verify-seam.png +0 -0
- package/docs/assets/improvements/subgraph-container-edges.png +0 -0
- package/docs/assets/improvements/wrapper-frontmatter.png +0 -0
- package/docs/assets/improvements/wrapper-init-directive.png +0 -0
- package/docs/assets/improvements/wrapper-leading-comment.png +0 -0
- package/docs/assets/style-cookbook/mid-century-report.png +0 -0
- package/docs/assets/style-cookbook/star-chart-atlas.png +0 -0
- package/docs/assets/style-cookbook/transit-route-map.png +0 -0
- package/docs/contributing/adding-diagram-types.md +0 -144
- package/docs/contributing/diagram-family-citizenship.matrix.json +0 -2127
- package/docs/contributing/diagram-family-citizenship.md +0 -82
- package/docs/contributing/harvesting-upstream-tests.md +0 -126
- package/docs/contributing/lessons-learned.md +0 -276
- package/docs/contributing/releasing.md +0 -82
- package/docs/contributing/visual-review-evidence.md +0 -53
- package/docs/design/families/README.md +0 -26
- package/docs/design/families/architecture-beta.md +0 -48
- package/docs/design/families/flowchart-parser-conformance.md +0 -22
- package/docs/design/families/gantt-research.md +0 -137
- package/docs/design/families/gantt.md +0 -329
- package/docs/design/families/journey-agentic-cards-before.png +0 -0
- package/docs/design/families/journey-experience-curve-implementation.png +0 -0
- package/docs/design/families/journey-mermaid-classic-implementation.png +0 -0
- package/docs/design/families/journey-mermaid-classic-prototype.png +0 -0
- package/docs/design/families/journey-mermaid-classic-prototype.svg +0 -163
- package/docs/design/families/journey-mermaid-classic-prototype.svg.png +0 -0
- package/docs/design/families/journey-migration-parity.md +0 -439
- package/docs/design/families/journey-section-overlap-after.png +0 -0
- package/docs/design/families/journey-section-overlap-before.png +0 -0
- package/docs/design/families/journey-usage-research.md +0 -423
- package/docs/design/families/journey.md +0 -153
- package/docs/design/families/xychart.md +0 -85
- package/docs/design/system/README.md +0 -45
- package/docs/design/system/abstraction-audit.md +0 -224
- package/docs/design/system/abstraction-recommendations.md +0 -655
- package/docs/design/system/architecture.mmd +0 -29
- package/docs/design/system/architecture.svg +0 -137
- package/docs/design/system/layout-guarantees-and-robustness.md +0 -351
- package/docs/design/system/layout-rubric.md +0 -138
- package/docs/design/system/route-contracts.md +0 -848
- package/docs/design/system/source-preservation-ladder.md +0 -52
- package/docs/design/system/styles-rollout.md +0 -216
- package/docs/design/system/ugly-layouts.md +0 -119
- package/docs/layout-characterization/README.md +0 -245
- package/docs/layout-characterization/contact-sheet-families.md +0 -498
- package/docs/layout-characterization/contact-sheet.md +0 -638
- package/docs/layout-characterization/properties.md +0 -281
- package/docs/layout-characterization/visual-quality.md +0 -160
- package/docs/layout-characterization/visual-snapshots/architecture.svg +0 -79
- package/docs/layout-characterization/visual-snapshots/class.svg +0 -60
- package/docs/layout-characterization/visual-snapshots/er.svg +0 -61
- package/docs/layout-characterization/visual-snapshots/flowchart.svg +0 -58
- package/docs/layout-characterization/visual-snapshots/gantt.svg +0 -52
- package/docs/layout-characterization/visual-snapshots/journey.svg +0 -98
- package/docs/layout-characterization/visual-snapshots/pie.svg +0 -36
- package/docs/layout-characterization/visual-snapshots/quadrant.svg +0 -47
- package/docs/layout-characterization/visual-snapshots/sequence.svg +0 -59
- package/docs/layout-characterization/visual-snapshots/state.svg +0 -52
- package/docs/layout-characterization/visual-snapshots/timeline.svg +0 -64
- package/docs/layout-characterization/visual-snapshots/xychart.svg +0 -97
- package/docs/project/divergences.md +0 -98
- package/docs/project/dogfooding-docs-strategy.md +0 -66
- package/docs/project/hosted-mcp-cloudflare-plan.md +0 -338
- package/docs/project/lessons-learned.md +0 -1019
- package/docs/project/remove-role-styling-plan.md +0 -176
- package/examples/agent-improve-auth-flow.ts +0 -206
- package/examples/agent-loop.ts +0 -53
- package/examples/mcp-vs-cli-complex-diagrams.ts +0 -133
- package/llms.txt +0 -104
- package/skill-evals/README.md +0 -77
- package/skill-evals/fixtures/architecture-cache/input.mmd +0 -5
- package/skill-evals/fixtures/class-payment/input.mmd +0 -4
- package/skill-evals/fixtures/er-orders/input.mmd +0 -10
- package/skill-evals/fixtures/flowchart-cache/input.mmd +0 -3
- package/skill-evals/fixtures/gantt-release/input.mmd +0 -7
- package/skill-evals/fixtures/journey-checkout/input.mmd +0 -6
- package/skill-evals/fixtures/pie-exports/input.mmd +0 -5
- package/skill-evals/fixtures/quadrant-priorities/input.mmd +0 -11
- package/skill-evals/fixtures/sequence-retry/input.mmd +0 -8
- package/skill-evals/fixtures/state-lifecycle/input.mmd +0 -5
- package/skill-evals/fixtures/timeline-release/input.mmd +0 -6
- package/skill-evals/fixtures/xychart-growth/input.mmd +0 -5
- package/skill-evals/shared-benchmark.json +0 -510
- package/src/agent/analyze.ts +0 -157
- package/src/agent/apply.ts +0 -146
- package/src/agent/architecture-body.ts +0 -458
- package/src/agent/certificates.ts +0 -110
- package/src/agent/class-body.ts +0 -319
- package/src/agent/core.ts +0 -207
- package/src/agent/create.ts +0 -106
- package/src/agent/describe.ts +0 -368
- package/src/agent/er-body.ts +0 -224
- package/src/agent/facts.ts +0 -360
- package/src/agent/families-builtin.ts +0 -920
- package/src/agent/families.ts +0 -232
- package/src/agent/family-layouts.ts +0 -832
- package/src/agent/flowchart-body.ts +0 -372
- package/src/agent/flowchart-unsupported.ts +0 -243
- package/src/agent/font-coverage.ts +0 -288
- package/src/agent/gantt-body.ts +0 -495
- package/src/agent/index.ts +0 -10
- package/src/agent/journey-body.ts +0 -374
- package/src/agent/label-metrics.ts +0 -28
- package/src/agent/layout-to-rendered.ts +0 -63
- package/src/agent/mutate.ts +0 -97
- package/src/agent/mutation-ops.ts +0 -51
- package/src/agent/op-schema.ts +0 -443
- package/src/agent/parse.ts +0 -223
- package/src/agent/pie-body.ts +0 -270
- package/src/agent/png.ts +0 -171
- package/src/agent/quadrant-body.ts +0 -336
- package/src/agent/quality.ts +0 -363
- package/src/agent/readability-audit.ts +0 -92
- package/src/agent/rendered-route-audit.ts +0 -61
- package/src/agent/sequence-body.ts +0 -345
- package/src/agent/serialize.ts +0 -214
- package/src/agent/state-body.ts +0 -589
- package/src/agent/structural-count.ts +0 -150
- package/src/agent/timeline-body.ts +0 -280
- package/src/agent/trace-log.ts +0 -43
- package/src/agent/types.ts +0 -995
- package/src/agent/verify.ts +0 -603
- package/src/agent/xychart-body.ts +0 -472
- package/src/architecture/config.ts +0 -282
- package/src/architecture/layout.ts +0 -496
- package/src/architecture/parser.ts +0 -375
- package/src/architecture/renderer.ts +0 -611
- package/src/architecture/types.ts +0 -113
- package/src/ascii/ansi.ts +0 -423
- package/src/ascii/architecture.ts +0 -210
- package/src/ascii/canvas.ts +0 -443
- package/src/ascii/class-diagram.ts +0 -697
- package/src/ascii/converter.ts +0 -475
- package/src/ascii/draw.ts +0 -1693
- package/src/ascii/edge-bundling.ts +0 -328
- package/src/ascii/edge-routing.ts +0 -330
- package/src/ascii/er-diagram.ts +0 -439
- package/src/ascii/gantt.ts +0 -276
- package/src/ascii/grid.ts +0 -747
- package/src/ascii/index.ts +0 -196
- package/src/ascii/journey.ts +0 -169
- package/src/ascii/meta.ts +0 -244
- package/src/ascii/multiline-utils.ts +0 -80
- package/src/ascii/pathfinder.ts +0 -301
- package/src/ascii/pie.ts +0 -67
- package/src/ascii/quadrant.ts +0 -158
- package/src/ascii/reverse.ts +0 -216
- package/src/ascii/sequence.ts +0 -499
- package/src/ascii/shapes/circle.ts +0 -27
- package/src/ascii/shapes/corners.ts +0 -143
- package/src/ascii/shapes/diamond.ts +0 -27
- package/src/ascii/shapes/hexagon.ts +0 -27
- package/src/ascii/shapes/index.ts +0 -106
- package/src/ascii/shapes/rectangle.ts +0 -168
- package/src/ascii/shapes/rounded.ts +0 -27
- package/src/ascii/shapes/special.ts +0 -332
- package/src/ascii/shapes/stadium.ts +0 -110
- package/src/ascii/shapes/state.ts +0 -192
- package/src/ascii/shapes/types.ts +0 -73
- package/src/ascii/timeline.ts +0 -141
- package/src/ascii/types.ts +0 -312
- package/src/ascii/validate.ts +0 -120
- package/src/ascii/width.ts +0 -81
- package/src/ascii/wrap.ts +0 -131
- package/src/ascii/xychart.ts +0 -919
- package/src/browser.ts +0 -29
- package/src/class/layout.ts +0 -240
- package/src/class/parser.ts +0 -332
- package/src/class/renderer.ts +0 -638
- package/src/class/types.ts +0 -129
- package/src/cli/agent-instructions.ts +0 -1
- package/src/cli/am-bin.ts +0 -6
- package/src/cli/exit-codes.ts +0 -18
- package/src/cli/index.ts +0 -1132
- package/src/cli/init-agent.ts +0 -147
- package/src/cli/run-entrypoint.ts +0 -10
- package/src/color-resolver.ts +0 -152
- package/src/elk-instance.ts +0 -114
- package/src/er/layout.ts +0 -187
- package/src/er/parser.ts +0 -226
- package/src/er/renderer.ts +0 -792
- package/src/er/types.ts +0 -99
- package/src/family-rubric.ts +0 -425
- package/src/font-manifest.ts +0 -31
- package/src/gantt/layout.ts +0 -365
- package/src/gantt/parser.ts +0 -282
- package/src/gantt/pipeline.ts +0 -27
- package/src/gantt/renderer.ts +0 -414
- package/src/gantt/schedule.ts +0 -513
- package/src/gantt/types.ts +0 -255
- package/src/index.ts +0 -368
- package/src/journey/layout.ts +0 -554
- package/src/journey/parse-core.ts +0 -251
- package/src/journey/parser.ts +0 -101
- package/src/journey/renderer.ts +0 -917
- package/src/journey/types.ts +0 -144
- package/src/layout/geometry.ts +0 -182
- package/src/layout/pass.ts +0 -142
- package/src/layout/passes/index.ts +0 -3916
- package/src/layout-engine.ts +0 -1565
- package/src/layout-rubric.ts +0 -659
- package/src/mcp/artifacts.ts +0 -137
- package/src/mcp/dynamic-harness.ts +0 -31
- package/src/mcp/dynamic-modules.d.ts +0 -7
- package/src/mcp/facade.ts +0 -608
- package/src/mcp/harness-runtime.ts +0 -203
- package/src/mcp/hosted-server.ts +0 -468
- package/src/mcp/mcp-bin.ts +0 -3
- package/src/mcp/mcp-cli.ts +0 -82
- package/src/mcp/protocol.ts +0 -13
- package/src/mcp/sandbox.ts +0 -195
- package/src/mcp/sdk-decl.ts +0 -391
- package/src/mcp/server.ts +0 -362
- package/src/mcp/tool-surface.ts +0 -146
- package/src/mermaid-source.ts +0 -655
- package/src/multiline-utils.ts +0 -228
- package/src/parser.ts +0 -1031
- package/src/pie/layout.ts +0 -168
- package/src/pie/parser.ts +0 -136
- package/src/pie/renderer.ts +0 -234
- package/src/pie/types.ts +0 -82
- package/src/quadrant/layout.ts +0 -191
- package/src/quadrant/parser.ts +0 -183
- package/src/quadrant/renderer.ts +0 -322
- package/src/quadrant/types.ts +0 -113
- package/src/render-family-hooks.ts +0 -244
- package/src/renderer.ts +0 -1099
- package/src/route-contracts.ts +0 -2723
- package/src/scene/backend.ts +0 -76
- package/src/scene/fidelity.ts +0 -183
- package/src/scene/hybrid-backend.ts +0 -174
- package/src/scene/ir.ts +0 -181
- package/src/scene/marks.ts +0 -127
- package/src/scene/rough-backend.ts +0 -378
- package/src/scene/seed.ts +0 -46
- package/src/scene/style-registry.ts +0 -556
- package/src/sequence/layout.ts +0 -456
- package/src/sequence/parser.ts +0 -255
- package/src/sequence/renderer.ts +0 -604
- package/src/sequence/types.ts +0 -154
- package/src/shape-clipping.ts +0 -351
- package/src/shared/accessibility-directives.ts +0 -22
- package/src/shared/batched.ts +0 -61
- package/src/shared/color-math.ts +0 -93
- package/src/shared/svg-a11y.ts +0 -29
- package/src/shared/syntax-error.ts +0 -17
- package/src/shared/unicode-ranges.ts +0 -135
- package/src/styles.ts +0 -318
- package/src/svg-paths.ts +0 -28
- package/src/text-metrics.ts +0 -248
- package/src/theme.ts +0 -710
- package/src/timeline/layout.ts +0 -381
- package/src/timeline/parser.ts +0 -215
- package/src/timeline/renderer.ts +0 -538
- package/src/timeline/types.ts +0 -105
- package/src/types.ts +0 -462
- package/src/website-worker-modules.d.ts +0 -18
- package/src/xychart/axis-utils.ts +0 -109
- package/src/xychart/colors.ts +0 -124
- package/src/xychart/config.ts +0 -88
- package/src/xychart/layout.ts +0 -656
- package/src/xychart/parser.ts +0 -504
- package/src/xychart/renderer.ts +0 -640
- package/src/xychart/types.ts +0 -282
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Fonts in custom styles
|
|
2
|
+
|
|
3
|
+
A custom style chooses a font family; the environment that renders the
|
|
4
|
+
diagram supplies the actual face. The public `StyleSpec` deliberately keeps
|
|
5
|
+
those responsibilities separate:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"$schema": "https://agentic-mermaid.dev/schemas/style-spec.schema.json",
|
|
10
|
+
"name": "acme-report",
|
|
11
|
+
"font": "'Acme Sans', Inter, system-ui",
|
|
12
|
+
"colors": {
|
|
13
|
+
"bg": "#fffdf8",
|
|
14
|
+
"fg": "#171512",
|
|
15
|
+
"accent": "#1d4ed8"
|
|
16
|
+
},
|
|
17
|
+
"stroke": "crisp"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`font` is a CSS family name or family stack. It does not load a file, register
|
|
22
|
+
a browser `FontFace`, or tell the PNG rasterizer where to find one. This keeps
|
|
23
|
+
the same style usable across SVG and PNG while each output surface resolves
|
|
24
|
+
fonts in its own way.
|
|
25
|
+
|
|
26
|
+
For the rest of the Style model — inline specs, registration, stacking, and
|
|
27
|
+
validation — see [Authoring styles](./style-authoring.md).
|
|
28
|
+
|
|
29
|
+
## Quick recipe
|
|
30
|
+
|
|
31
|
+
Save the JSON above as `acme-report.style.json`. For an SVG that declares the
|
|
32
|
+
family without making an external font request:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
am render diagram.mmd \
|
|
36
|
+
--format svg \
|
|
37
|
+
--style acme-report.style.json \
|
|
38
|
+
--security strict \
|
|
39
|
+
--output diagram.svg
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For a PNG, point the local rasterizer at a directory containing the matching
|
|
43
|
+
font faces:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
am render diagram.mmd \
|
|
47
|
+
--format png \
|
|
48
|
+
--style acme-report.style.json \
|
|
49
|
+
--font-dirs ./fonts \
|
|
50
|
+
--output diagram.png
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The same workflow through the library is:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
57
|
+
import {
|
|
58
|
+
renderMermaidPNG,
|
|
59
|
+
renderMermaidSVG,
|
|
60
|
+
validateStyleSpec,
|
|
61
|
+
} from 'agentic-mermaid/agent'
|
|
62
|
+
|
|
63
|
+
const source = readFileSync('diagram.mmd', 'utf8')
|
|
64
|
+
const style = JSON.parse(readFileSync('acme-report.style.json', 'utf8'))
|
|
65
|
+
const problems = validateStyleSpec(style)
|
|
66
|
+
if (problems.length) throw new Error(problems.join('\n'))
|
|
67
|
+
|
|
68
|
+
const svg = renderMermaidSVG(source, {
|
|
69
|
+
style,
|
|
70
|
+
security: 'strict',
|
|
71
|
+
})
|
|
72
|
+
writeFileSync('diagram.svg', svg)
|
|
73
|
+
|
|
74
|
+
const png = renderMermaidPNG(source, {
|
|
75
|
+
style,
|
|
76
|
+
fontDirs: ['./fonts'],
|
|
77
|
+
})
|
|
78
|
+
writeFileSync('diagram.png', png)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Which font value wins
|
|
82
|
+
|
|
83
|
+
For `renderMermaidSVG`, font selection follows this precedence, from strongest
|
|
84
|
+
to weakest:
|
|
85
|
+
|
|
86
|
+
1. The render call's explicit `font` option.
|
|
87
|
+
2. Mermaid `fontFamily` configuration.
|
|
88
|
+
3. Mermaid `themeVariables.fontFamily` configuration.
|
|
89
|
+
4. The resolved Style stack's `font` field.
|
|
90
|
+
5. The default, Inter.
|
|
91
|
+
|
|
92
|
+
`renderMermaidPNG` accepts the same shared `font` option and precedence as SVG.
|
|
93
|
+
`fontDirs` makes faces available to the rasterizer but does not choose the
|
|
94
|
+
family.
|
|
95
|
+
|
|
96
|
+
Within a Style stack, later entries win. For example, `[style, 'dracula']`
|
|
97
|
+
keeps the inline/file-loaded Style's font because `dracula` is a palette-only
|
|
98
|
+
Style; a later Style that defines `font` would replace it. A file's `name`
|
|
99
|
+
field does not register it automatically — give it a canonical `look:` or
|
|
100
|
+
`palette:` name and call `registerStyle(style)` before using that identity in a
|
|
101
|
+
library stack.
|
|
102
|
+
|
|
103
|
+
`validateStyleSpec` checks that `font` is a string. It cannot prove that the
|
|
104
|
+
family is installed, present under `fontDirs`, or available to a browser.
|
|
105
|
+
|
|
106
|
+
## Resolution by output surface
|
|
107
|
+
|
|
108
|
+
| Surface | Where the face comes from | Custom-font control |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| SVG library/CLI | Browser, viewing application, or host-page CSS | `font`, `embedFontImport`, `security` |
|
|
111
|
+
| PNG library/CLI | Bundled faces, `fontDirs`, optionally OS fonts | `font`, `fontDirs`, `loadSystemFonts` / `--system-fonts` |
|
|
112
|
+
| Live editor | Faces available to the editor page and browser | Font picker; no `fontDirs` |
|
|
113
|
+
| Local MCP `render_png` | Bundled faces, `fontDirs`, optionally OS fonts | `fontDirs`, `loadSystemFonts` |
|
|
114
|
+
| Hosted MCP `render_png` | Faces bundled into the Worker | No filesystem font input; use local MCP/library/CLI for custom directories |
|
|
115
|
+
| ASCII, Unicode, JSON layout | Terminal/layout output has no font face | Style fonts do not apply |
|
|
116
|
+
|
|
117
|
+
### SVG
|
|
118
|
+
|
|
119
|
+
SVG output always declares the selected family through the root `--font` CSS
|
|
120
|
+
custom property and a `font-family` rule. The SVG renderer does not read
|
|
121
|
+
`fontDirs`.
|
|
122
|
+
|
|
123
|
+
By default, a single plain family name such as `Acme Sans` produces a Google
|
|
124
|
+
Fonts `@import`. Class and ER diagrams can also import JetBrains Mono for their
|
|
125
|
+
monospace labels. Set `embedFontImport: false`, or use `security: 'strict'`, to
|
|
126
|
+
omit all of those requests while keeping the family declaration:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const svg = renderMermaidSVG(source, {
|
|
130
|
+
style: { font: 'Acme Sans' },
|
|
131
|
+
embedFontImport: false,
|
|
132
|
+
})
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
CSS variable references and family stacks are declared as-is and do not
|
|
136
|
+
produce an import for the selected family:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
renderMermaidSVG(source, {
|
|
140
|
+
style: { font: "'Acme Sans', Inter, system-ui" },
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
renderMermaidSVG(source, {
|
|
144
|
+
font: 'var(--brand-font, Inter)',
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The class/ER JetBrains Mono import still applies unless `embedFontImport` is
|
|
149
|
+
false or strict security is enabled.
|
|
150
|
+
|
|
151
|
+
If the selected family is unavailable when the SVG is viewed, normal CSS
|
|
152
|
+
fallback applies. A family stack makes that fallback explicit.
|
|
153
|
+
|
|
154
|
+
Raw SVG declares the family through `var(--font, ...)`. Some static SVG
|
|
155
|
+
rasterizers, including resvg and librsvg, do not resolve CSS custom properties.
|
|
156
|
+
Use `renderMermaidPNG` for Agentic Mermaid's built-in workaround, or resolve
|
|
157
|
+
the font variable to a concrete `font-family` before feeding raw SVG to another
|
|
158
|
+
static rasterizer.
|
|
159
|
+
|
|
160
|
+
### Host-page and browser fonts
|
|
161
|
+
|
|
162
|
+
An inline SVG can use a face registered by its host document. A stylesheet can
|
|
163
|
+
map an installed face:
|
|
164
|
+
|
|
165
|
+
```css
|
|
166
|
+
@font-face {
|
|
167
|
+
font-family: "Acme Sans";
|
|
168
|
+
src: local("Acme Sans Regular"), local("AcmeSans-Regular");
|
|
169
|
+
font-weight: 400;
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Browser applications can also register bytes selected by the user:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
const face = new FontFace('Acme Sans', await file.arrayBuffer(), {
|
|
177
|
+
weight: '400',
|
|
178
|
+
})
|
|
179
|
+
await face.load()
|
|
180
|
+
document.fonts.add(face)
|
|
181
|
+
await document.fonts.load('400 14px "Acme Sans"')
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Register one `FontFace` or `@font-face` rule per required weight, or accept the
|
|
185
|
+
browser's synthesized/fallback face for weights that are missing.
|
|
186
|
+
|
|
187
|
+
Register the face in the same document that displays the SVG, and wait for it
|
|
188
|
+
before displaying or raster-capturing the result. A raw SVG export still only
|
|
189
|
+
declares the family; it does not serialize a dynamically registered `FontFace`.
|
|
190
|
+
The public live editor can use faces already available to its page/browser,
|
|
191
|
+
but it has no filesystem `fontDirs` option or arbitrary font-file input.
|
|
192
|
+
|
|
193
|
+
### PNG
|
|
194
|
+
|
|
195
|
+
`renderMermaidPNG` renders offline with `@resvg/resvg-js`. It loads:
|
|
196
|
+
|
|
197
|
+
1. The bundled Inter faces used by the text-metrics model.
|
|
198
|
+
2. DejaVu Sans as a per-glyph fallback for symbols Inter lacks.
|
|
199
|
+
3. The bundled faces referenced by built-in Styles: Caveat, EB Garamond,
|
|
200
|
+
Architects Daughter, and Share Tech Mono.
|
|
201
|
+
4. Any directories supplied through `fontDirs`.
|
|
202
|
+
5. OS-installed fonts only when `loadSystemFonts: true` is requested.
|
|
203
|
+
|
|
204
|
+
The CLI equivalents are `--font-dirs <dir[,dir...]>` and `--system-fonts`.
|
|
205
|
+
Prefer a dedicated `fontDirs` directory when reproducible output matters.
|
|
206
|
+
System-font loading makes the result depend on the machine's installed faces.
|
|
207
|
+
|
|
208
|
+
The family stored inside the font file must match the intended family token in
|
|
209
|
+
the Style's `font` value — normally the first family in its stack. Supply the
|
|
210
|
+
weights the diagram uses; Agentic Mermaid commonly emits 400, 500, 600, and
|
|
211
|
+
700. If an unbundled requested family cannot be resolved, PNG rasterization
|
|
212
|
+
uses Inter, with DejaVu available for per-glyph fallback.
|
|
213
|
+
|
|
214
|
+
## Diagnostics and layout limits
|
|
215
|
+
|
|
216
|
+
`PNG_FONT_COVERAGE` warns when no loaded face contains a character, such as a
|
|
217
|
+
CJK or emoji code point. It is a glyph-coverage check, not a family-presence
|
|
218
|
+
check. If `Acme Sans` is missing but Inter covers every Latin character, the
|
|
219
|
+
render can fall back without a coverage warning. Confirm custom-family output
|
|
220
|
+
visually or with a font-specific render fixture.
|
|
221
|
+
|
|
222
|
+
Diagram geometry uses the deterministic proportional measurement contract
|
|
223
|
+
recorded in `TEXT_MEASUREMENT_CONTRACT`; it never reads ambient system-font
|
|
224
|
+
state. Every continuous painted text advance—bundled, monospace, or custom—gets
|
|
225
|
+
SVG `textLength` with `lengthAdjust="spacingAndGlyphs"`, because loading a font
|
|
226
|
+
resource does not calibrate its metrics to the layout estimator. Independently
|
|
227
|
+
positioned multiline tspans are fitted per line, while nested formatting
|
|
228
|
+
contributes inherited size, weight, and tracking to that line's width. Explicit
|
|
229
|
+
emitter-owned `textLength` remains authoritative. Native and browser PNG consume
|
|
230
|
+
the same secured SVG, so a materially wider face cannot silently overflow its
|
|
231
|
+
measured box. The tradeoff is explicit: unusually wide or narrow glyphs may be
|
|
232
|
+
horizontally fitted rather than changing deterministic layout. Test long labels
|
|
233
|
+
across target families for visual quality, especially for extreme proportions.
|
|
234
|
+
|
|
235
|
+
## Troubleshooting
|
|
236
|
+
|
|
237
|
+
**The custom family is not visible in PNG.** Check the font's internal family
|
|
238
|
+
name, include the directory through `fontDirs`, supply the required weights,
|
|
239
|
+
and make sure Mermaid `fontFamily` configuration in the source is not
|
|
240
|
+
overriding the Style.
|
|
241
|
+
|
|
242
|
+
**The SVG requests a font from the network.** Render with
|
|
243
|
+
`security: 'strict'` or `embedFontImport: false`.
|
|
244
|
+
|
|
245
|
+
**The SVG looks different in another viewer.** The other environment did not
|
|
246
|
+
resolve the same family or selected a different fallback. Use a deliberate
|
|
247
|
+
family stack and make the required face available to that viewer.
|
|
248
|
+
|
|
249
|
+
**PNG warns about CJK or emoji.** Add a face covering those code points through
|
|
250
|
+
`fontDirs`, or opt into `loadSystemFonts` when machine-dependent output is
|
|
251
|
+
acceptable.
|
|
252
|
+
|
|
253
|
+
## Related documentation
|
|
254
|
+
|
|
255
|
+
- [Authoring styles](./style-authoring.md) — Style fields, stacks, registration,
|
|
256
|
+
validation, and the quality rubric.
|
|
257
|
+
- [Custom style cookbook](./custom-style-cookbook.md) — complete JSON examples
|
|
258
|
+
and screenshots.
|
|
259
|
+
- [API reference](./api.md) — `RenderOptions` and `PngOptions`.
|
|
260
|
+
- [Security posture](../SECURITY.md) — strict SVG and external-reference
|
|
261
|
+
guarantees.
|
|
262
|
+
- [PNG determinism](./quality.md#png-determinism) — bundled fonts and the
|
|
263
|
+
reproducibility tradeoff of system fonts.
|
|
264
|
+
- [Bundled font inventory](../assets/fonts/FONT-LICENSES.md) — the faces shipped
|
|
265
|
+
with the package.
|
|
@@ -26,6 +26,129 @@ const problems = validateStyleSpec(style)
|
|
|
26
26
|
if (problems.length) throw new Error(problems.join('\n'))
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
The `font` field names a family; the output environment still has to provide
|
|
30
|
+
that face. See [Fonts in custom styles](./custom-fonts.md) for SVG behavior,
|
|
31
|
+
PNG `fontDirs`, system fonts, fallbacks, and browser usage.
|
|
32
|
+
|
|
33
|
+
## Public brand-inspired prototypes — documentation only
|
|
34
|
+
|
|
35
|
+
These three files are the highest supported non-built-in form of a Style probe:
|
|
36
|
+
version-controlled public `StyleSpec` records with schema validation, executable
|
|
37
|
+
fixtures, deterministic screenshot gates, strict rendering, inspect-only
|
|
38
|
+
constraints, and optional process-local registration. The reviewed image hashes
|
|
39
|
+
are pinned in
|
|
40
|
+
[`eval/style-prototype-evidence/visual-approval.json`](../eval/style-prototype-evidence/visual-approval.json).
|
|
41
|
+
They are not package-owned built-ins, installed BrandPacks, claims of pixel
|
|
42
|
+
equivalence, or endorsements.
|
|
43
|
+
|
|
44
|
+
### Cupertino-inspired prototype
|
|
45
|
+
|
|
46
|
+
Complete file:
|
|
47
|
+
[`examples/styles/cupertino-prototype.style.json`](../examples/styles/cupertino-prototype.style.json).
|
|
48
|
+
|
|
49
|
+
This is an implementation example, not a built-in Style. Agentic Mermaid ships
|
|
50
|
+
the opt-in file but does not register `cupertino`, give it a package-owned
|
|
51
|
+
runtime identity, expose it in a built-in catalog or picker, or retain a
|
|
52
|
+
registered short name. Load the JSON explicitly when you want to study or
|
|
53
|
+
adapt the prototype:
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
am render examples/styles/cupertino-prototype.mmd --format svg \
|
|
59
|
+
--style examples/styles/cupertino-prototype.style.json \
|
|
60
|
+
--options '{"shadow":true}' \
|
|
61
|
+
--output diagram.svg
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Library hosts can opt into a reusable name without creating a built-in registry
|
|
65
|
+
identity. Registration is explicit, process-local, and disposable:
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
import { readFileSync } from 'node:fs'
|
|
69
|
+
import { registerStyle, renderMermaidSVG, validateStyleSpec } from 'agentic-mermaid'
|
|
70
|
+
|
|
71
|
+
const prototype = JSON.parse(
|
|
72
|
+
readFileSync('examples/styles/cupertino-prototype.style.json', 'utf8'),
|
|
73
|
+
)
|
|
74
|
+
const source = readFileSync('examples/styles/cupertino-prototype.mmd', 'utf8')
|
|
75
|
+
const problems = validateStyleSpec(prototype)
|
|
76
|
+
if (problems.length) throw new Error(problems.join('\n'))
|
|
77
|
+
|
|
78
|
+
const unregister = registerStyle(prototype)
|
|
79
|
+
try {
|
|
80
|
+
const svg = renderMermaidSVG(source, {
|
|
81
|
+
style: 'look:cupertino-prototype',
|
|
82
|
+
shadow: true,
|
|
83
|
+
})
|
|
84
|
+
} finally {
|
|
85
|
+
unregister()
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The public `StyleSpec` expresses the prototype's palette, font, weight-based
|
|
90
|
+
role typography, surface-first border policy, padding, geometry, and inspect-only
|
|
91
|
+
contrast/accent-area constraints. Its 10-unit node corners, 26-unit group
|
|
92
|
+
corners, and 16-unit connector bend radius make the intended Cupertino-inspired
|
|
93
|
+
curve discipline directly inspectable; `shadow` remains the shared render option
|
|
94
|
+
supplying elevation. The file still does not claim pixel equivalence with an
|
|
95
|
+
Apple interface: it uses bundled Inter rather than licensed SF Pro, has no
|
|
96
|
+
motion/spring system, and provides no designed dark companion.
|
|
97
|
+
|
|
98
|
+
Agentic Mermaid is independent of and not affiliated with Apple Inc.;
|
|
99
|
+
“Cupertino” describes the prototype's design inspiration, not an Apple product
|
|
100
|
+
or endorsed implementation.
|
|
101
|
+
|
|
102
|
+
### Vercel-inspired prototype
|
|
103
|
+
|
|
104
|
+
Complete file:
|
|
105
|
+
[`examples/styles/vercel-inspired-prototype.style.json`](../examples/styles/vercel-inspired-prototype.style.json).
|
|
106
|
+
|
|
107
|
+

|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
am verify examples/styles/vercel-inspired-prototype.mmd \
|
|
111
|
+
--style examples/styles/vercel-inspired-prototype.style.json
|
|
112
|
+
am render examples/styles/vercel-inspired-prototype.mmd --format svg \
|
|
113
|
+
--style examples/styles/vercel-inspired-prototype.style.json > diagram.svg
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This static prototype uses the public palette and role records for dark surfaces,
|
|
117
|
+
hairlines, compact typography, and restrained geometry. Its executable XYChart
|
|
118
|
+
fixture exercises `bar-0` and `line-0` category bindings through named semantic
|
|
119
|
+
slots; contrast and accent-area policy remains inspect-only. It deliberately
|
|
120
|
+
does not imitate Geist assets, Vercel motion, live application chrome, or a
|
|
121
|
+
complete product design system.
|
|
122
|
+
|
|
123
|
+
Agentic Mermaid is independent of and not affiliated with Vercel Inc.;
|
|
124
|
+
“Vercel-inspired” describes visual research, not a Vercel product or endorsed
|
|
125
|
+
implementation.
|
|
126
|
+
|
|
127
|
+
### Cloudflare Workers-inspired prototype
|
|
128
|
+
|
|
129
|
+
Complete file:
|
|
130
|
+
[`examples/styles/cloudflare-workers-inspired-prototype.style.json`](../examples/styles/cloudflare-workers-inspired-prototype.style.json).
|
|
131
|
+
|
|
132
|
+

|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
am verify examples/styles/cloudflare-workers-inspired-prototype.mmd \
|
|
136
|
+
--style examples/styles/cloudflare-workers-inspired-prototype.style.json
|
|
137
|
+
am render examples/styles/cloudflare-workers-inspired-prototype.mmd --format svg \
|
|
138
|
+
--style examples/styles/cloudflare-workers-inspired-prototype.style.json > diagram.svg
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
This static prototype combines warm surface tokens, sans/mono role typography,
|
|
142
|
+
Gantt section-category bindings, and visible `outline`/`pattern` cues. The cues
|
|
143
|
+
survive no-color terminal projection where that family supports them; contrast
|
|
144
|
+
and accent-area rules diagnose without repainting. It does not reproduce
|
|
145
|
+
Cloudflare application chrome, motion, tinted multi-layer shadow systems, or a
|
|
146
|
+
complete Workers design system.
|
|
147
|
+
|
|
148
|
+
Agentic Mermaid is independent of and not affiliated with Cloudflare, Inc.;
|
|
149
|
+
“Cloudflare Workers-inspired” describes visual research, not a Cloudflare
|
|
150
|
+
product or endorsed implementation.
|
|
151
|
+
|
|
29
152
|
## Transit route map
|
|
30
153
|
|
|
31
154
|
Complete file:
|
|
@@ -43,7 +166,7 @@ Use it when you want to test whether a style keeps connectors readable:
|
|
|
43
166
|
```json
|
|
44
167
|
{
|
|
45
168
|
"$schema": "https://agentic-mermaid.dev/schemas/style-spec.schema.json",
|
|
46
|
-
"name": "transit-route-map",
|
|
169
|
+
"name": "look:transit-route-map",
|
|
47
170
|
"colors": {
|
|
48
171
|
"bg": "#fbfbf8",
|
|
49
172
|
"fg": "#171923",
|
|
@@ -53,8 +176,7 @@ Use it when you want to test whether a style keeps connectors readable:
|
|
|
53
176
|
},
|
|
54
177
|
"font": "DejaVu Sans",
|
|
55
178
|
"stroke": "crisp",
|
|
56
|
-
"strokeWidth": 4
|
|
57
|
-
"fill": "none"
|
|
179
|
+
"strokeWidth": 4
|
|
58
180
|
}
|
|
59
181
|
```
|
|
60
182
|
|
|
@@ -66,8 +188,8 @@ Complete file:
|
|
|
66
188
|

|
|
67
189
|
|
|
68
190
|
This is the easiest uncovered cluster to teach with today's StyleSpec. It is
|
|
69
|
-
mostly palette,
|
|
70
|
-
|
|
191
|
+
mostly palette, typography, and page treatment. No new backend capability is
|
|
192
|
+
needed.
|
|
71
193
|
|
|
72
194
|
Use it when you want a report figure with visible section bands and square
|
|
73
195
|
technical connectors:
|
|
@@ -75,7 +197,7 @@ technical connectors:
|
|
|
75
197
|
```json
|
|
76
198
|
{
|
|
77
199
|
"$schema": "https://agentic-mermaid.dev/schemas/style-spec.schema.json",
|
|
78
|
-
"name": "mid-century-report",
|
|
200
|
+
"name": "look:mid-century-report",
|
|
79
201
|
"colors": {
|
|
80
202
|
"bg": "#f4ead8",
|
|
81
203
|
"fg": "#24211d",
|
|
@@ -85,8 +207,7 @@ technical connectors:
|
|
|
85
207
|
},
|
|
86
208
|
"font": "DejaVu Sans",
|
|
87
209
|
"stroke": "crisp",
|
|
88
|
-
"strokeWidth": 1.6
|
|
89
|
-
"fill": "solid"
|
|
210
|
+
"strokeWidth": 1.6
|
|
90
211
|
}
|
|
91
212
|
```
|
|
92
213
|
|
|
@@ -106,7 +227,7 @@ Use it when you need a dark page style that still keeps labels readable:
|
|
|
106
227
|
```json
|
|
107
228
|
{
|
|
108
229
|
"$schema": "https://agentic-mermaid.dev/schemas/style-spec.schema.json",
|
|
109
|
-
"name": "star-chart-atlas",
|
|
230
|
+
"name": "look:star-chart-atlas",
|
|
110
231
|
"colors": {
|
|
111
232
|
"bg": "#0b1026",
|
|
112
233
|
"fg": "#ece4c4",
|
package/docs/diagram-families.md
CHANGED
|
@@ -2,22 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Agentic Mermaid supports Mermaid's common diagram families through a split pipeline: parse source, layout typed structures, render SVG/PNG/ASCII, and verify structural warnings.
|
|
4
4
|
|
|
5
|
-
## Capability
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|---|---|---|---|---|
|
|
9
|
-
| Flowchart | `flowchart`, `graph` | SVG/PNG/ASCII | ✓ | 6 graph ops; narrow with `asFlowchart`. |
|
|
10
|
-
| State | `stateDiagram-v2` | SVG/PNG/ASCII | ✓ | Dedicated `StateBody` (BUILD-19): narrow with `asState`, 8 state-shaped ops. `asFlowchart` returns null. |
|
|
11
|
-
| Sequence | `sequenceDiagram` | SVG/PNG/ASCII | structured (5 ops) | Notes/alt/loop bodies are segment-preserving; un-segmentable syntax falls back to opaque. |
|
|
12
|
-
| Timeline | `timeline` | SVG/PNG/ASCII | ✓ | Supports sections, periods, events, title changes. |
|
|
13
|
-
| Class | `classDiagram` | SVG/PNG/ASCII | ✓ | Classes, members, relations, notes. |
|
|
14
|
-
| ER | `erDiagram` | SVG/PNG/ASCII | ✓ | Entities, attributes, relations. |
|
|
15
|
-
| Journey | `journey` | SVG/PNG/ASCII | structured (10 ops) | `asJourney` narrows documented Journey syntax: title, accTitle/accDescr, sections, scored tasks, and actors. |
|
|
16
|
-
| XY chart | `xychart`, `xychart-beta` | SVG/PNG/ASCII | structured (8 ops) | Vertical/horizontal bar/line/mixed charts; modeled subset is structurally mutable via `asXyChart`. |
|
|
17
|
-
| Pie | `pie` | SVG/PNG/ASCII | structured (7 ops) | `asPie` narrows title/showData/slices; malformed entries and accTitle/accDescr stay opaque. |
|
|
18
|
-
| Quadrant | `quadrantChart` | SVG/PNG/ASCII | structured (7 ops) | `asQuadrant` narrows title/axes/quadrant labels/points; styling and out-of-range coords stay opaque. |
|
|
19
|
-
| Architecture | `architecture-beta` | SVG/PNG/ASCII | structured (10 ops) | `asArchitecture` narrows the modeled subset (groups/services/junctions/edges); the `{group}` boundary modifier and accTitle/accDescr stay opaque. |
|
|
20
|
-
| Gantt | `gantt` | SVG/PNG/ASCII | structured (9 ops) | `asGantt` narrows title/sections/tasks; calendar directives, `click` lines, and comments ride along verbatim as opaque segments. Deterministic: the today marker draws only from a caller-supplied `ganttToday`. See [design/families/gantt.md](./design/families/gantt.md). |
|
|
5
|
+
## Capability authority
|
|
6
|
+
|
|
7
|
+
The checked roster and per-family capability states are generated from `FamilyDescriptor` in the [Section A capability report](./project/section-a-capability-report.md). Agents can discover the live roster and operation shapes through `am capabilities --json`; its compact Section A summary links to the exhaustive audit. Library and Code Mode callers can use `describeOps(family)` for the exact mutation schema. This guide keeps examples and family-specific caveats, not a second inventory.
|
|
21
8
|
|
|
22
9
|
Opaque fallback does not mean unsupported: those bodies parse, render, verify, and round-trip losslessly, but agents should edit preserved source deliberately instead of calling `mutate`.
|
|
23
10
|
|
|
@@ -39,7 +26,7 @@ stateDiagram-v2
|
|
|
39
26
|
Idle --> Running
|
|
40
27
|
```
|
|
41
28
|
|
|
42
|
-
State diagrams own a dedicated `StateBody
|
|
29
|
+
State diagrams own a dedicated `StateBody`: narrow with `asState`. States, transitions, start/end, composites, concurrency regions, fork/join/choice and history pseudostates, notes, declarations, direction, and paint are modeled. Use `describeOps('state')` for the current mutation schema; malformed or otherwise unmodeled syntax falls back losslessly and stays source-level. Verify runs the full Tier 1 + Tier 2 geometric path by projecting the body to a graph.
|
|
43
30
|
|
|
44
31
|
## Sequence
|
|
45
32
|
|
|
@@ -51,7 +38,7 @@ sequenceDiagram
|
|
|
51
38
|
API-->>User: Session
|
|
52
39
|
```
|
|
53
40
|
|
|
54
|
-
|
|
41
|
+
Participants and messages are structured. Rich statements such as notes, `alt`, `loop`, and activation syntax remain ordered verbatim segments while participant/message operations stay live; only un-segmentable input falls back to a whole opaque body.
|
|
55
42
|
|
|
56
43
|
## Timeline
|
|
57
44
|
|
|
@@ -98,7 +85,7 @@ journey
|
|
|
98
85
|
Pay: 3: Customer, Gateway
|
|
99
86
|
```
|
|
100
87
|
|
|
101
|
-
Journey diagrams narrow via `asJourney
|
|
88
|
+
Journey diagrams narrow via `asJourney`; discover the exact section, task, score, actor, ordering, and accessibility operation schema with `describeOps('journey')`. Documented Mermaid accessibility directives (`accTitle`, inline `accDescr`, and block `accDescr { ... }`) stay structured and round-trip through canonical serialization. Malformed or unknown Journey syntax falls back to a lossless opaque body.
|
|
102
89
|
|
|
103
90
|
SVG rendering uses Mermaid's left-to-right Journey metaphor rather than the older Agentic card layout: sections span task columns, actors appear in a left legend, per-task actor dots show participation, and scores map to sentiment markers on a progression baseline. Mermaid `journey` config fields for actor colors, section fills/text colors, task/title fonts, task spacing, and actor label width are honored. Agentic Mermaid `style` and palette colors also reach Journey-specific surfaces such as section spans, actor dots, score markers, and the baseline.
|
|
104
91
|
|
|
@@ -112,7 +99,7 @@ xychart-beta
|
|
|
112
99
|
line [50, 180, 420]
|
|
113
100
|
```
|
|
114
101
|
|
|
115
|
-
The modeled
|
|
102
|
+
The modeled title, axes, orientation, and bar/line series are structurally mutable through `asXyChart`; use `describeOps('xychart')` for the exact schema. Unmodeled or malformed syntax falls back losslessly and stays source-level. See [`design/families/xychart.md`](./design/families/xychart.md) for compatibility details and layout notes.
|
|
116
103
|
|
|
117
104
|
## Pie
|
|
118
105
|
|
|
@@ -124,7 +111,7 @@ pie showData
|
|
|
124
111
|
"Rats" : 15
|
|
125
112
|
```
|
|
126
113
|
|
|
127
|
-
Pie charts accept the `pie` header with optional `showData`, an optional `title`, and `"label" : value` entries with positive numeric values. Slices render clockwise in source order. `showData` adds the raw value beside each legend label; the legend always shows the computed percentage. Malformed entries (negative/zero values, missing colon, unquoted labels) fall back to a lossless opaque body — never silently dropped — and the renderer still surfaces the loud error at render time. The ASCII renderer draws a proportional bar list. Pie is structured
|
|
114
|
+
Pie charts accept the `pie` header with optional `showData`, an optional `title`, and `"label" : value` entries with positive numeric values. Slices render clockwise in source order. `showData` adds the raw value beside each legend label; the legend always shows the computed percentage. Malformed entries (negative/zero values, missing colon, unquoted labels) fall back to a lossless opaque body — never silently dropped — and the renderer still surfaces the loud error at render time. The ASCII renderer draws a proportional bar list. Pie is structured when narrowed through `asPie`; slices are addressed by their unique label. The operation schema is generated from the registry rather than duplicated here.
|
|
128
115
|
|
|
129
116
|
## Quadrant
|
|
130
117
|
|
|
@@ -141,7 +128,20 @@ quadrantChart
|
|
|
141
128
|
Campaign B: [0.45, 0.23]
|
|
142
129
|
```
|
|
143
130
|
|
|
144
|
-
Quadrant charts accept the `quadrantChart` header, an optional `title`, `x-axis <left> --> <right>` and `y-axis <bottom> --> <top>` axis labels (the far side is optional), four `quadrant-1..quadrant-4 <label>` region labels, and `<Label>: [x, y]` points with coordinates in `[0, 1]`. Quadrant numbering follows Mermaid core: **1 = top-right, 2 = top-left, 3 = bottom-left, 4 = bottom-right**. The SVG renderer draws a square plot split into four theme-tinted quadrants with the points as circles; the ASCII renderer draws a bordered grid with a coordinate legend. Official point style metadata (`radius`, `color`, `stroke-color`, `stroke-width`)
|
|
131
|
+
Quadrant charts accept the `quadrantChart` header, an optional `title`, `x-axis <left> --> <right>` and `y-axis <bottom> --> <top>` axis labels (the far side is optional), four `quadrant-1..quadrant-4 <label>` region labels, and `<Label>: [x, y]` points with coordinates in `[0, 1]`. Quadrant numbering follows Mermaid core: **1 = top-right, 2 = top-left, 3 = bottom-left, 4 = bottom-right**. The SVG renderer draws a square plot split into four theme-tinted quadrants with the points as circles; the ASCII renderer draws a bordered grid with a coordinate legend. Official point style metadata (`radius`, `color`, `stroke-color`, `stroke-width`), `classDef` lines, and class assignments are modeled for rendering and typed mutation. Malformed lines — out-of-range/non-numeric coordinates, missing brackets, duplicate point labels, and unknown point style metadata — fall back to a lossless opaque body, never silently dropped, and the renderer still surfaces the loud error at render time. Quadrant is structured when narrowed through `asQuadrant`; points are addressed by their unique label and coordinates stay in `[0, 1]`. The operation schema is generated from the registry rather than duplicated here.
|
|
132
|
+
|
|
133
|
+
## Radar
|
|
134
|
+
|
|
135
|
+
```mermaid
|
|
136
|
+
radar-beta
|
|
137
|
+
title Skills
|
|
138
|
+
axis speed["Speed"], power["Power"], range["Range"]
|
|
139
|
+
curve now["Current"]{4, 3, 5}
|
|
140
|
+
curve goal["Target"]{5, 5, 4}
|
|
141
|
+
max 5
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Radar (spider) chart — multivariate profiles compared across equi-angular axes from a shared center; one closed translucent area per entity. The `radar-beta` header takes an optional `title`, `axis <id>["Label"], …` declarations, one `curve <id>["Label"]{v1, v2, …}` per entity (one value per axis, in axis order), and optional `max`/`min`/config lines. The SVG renderer draws the axis spokes, concentric grid, and per-curve polygons; the ASCII renderer draws a grouped proportional-bar table like pie. Malformed lines fall back to a lossless opaque body, never silently dropped. Radar is structured when narrowed through `asRadar`; axes and curves are addressed by their unique id. The operation schema is generated from the registry rather than duplicated here.
|
|
145
145
|
|
|
146
146
|
## Gantt
|
|
147
147
|
|
|
@@ -158,7 +158,32 @@ gantt
|
|
|
158
158
|
another task :24d
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
Gantt charts accept the `gantt` header, `title`, calendar directives (`dateFormat`, `axisFormat`, `tickInterval`, `inclusiveEndDates`, `topAxis`, multiple `excludes`/`includes` lines, `weekend friday|saturday`, `weekday <day>`, `todayMarker`), `section` lines, and task lines `Label :[tags,] [id,] [start,] end` where tags are `active`/`done`/`crit`/`milestone`/`vert`, start is a date or `after id…`, and end is a date, a duration token (`ms s m h d w M y`, decimals allowed), or `until id…`. Dependencies resolve in a pure scheduler ([design/families/gantt.md](./design/families/gantt.md)): `after` starts at the latest referenced end, `until` ends at the earliest referenced start, working durations extend over excluded days, `includes` overrides `excludes`, and dependency cycles / unknown references / invalid dates are named structured errors (`GANTT_*`), never wall-clock fallbacks. Rendering is deterministic: the `todayMarker` draws only when the caller passes `ganttToday` (a date in the diagram's `dateFormat`), and `todayMarker off` always wins. `displayMode: compact` (frontmatter or `config.gantt`) packs non-overlapping tasks of a section into shared rows; `vert` markers draw a full-height line without consuming a task row. `click … href` is sanitized under strict security and `click … call` is parsed but never executed. Gantt is structured
|
|
161
|
+
Gantt charts accept the `gantt` header, `title`, calendar directives (`dateFormat`, `axisFormat`, `tickInterval`, `inclusiveEndDates`, `topAxis`, multiple `excludes`/`includes` lines, `weekend friday|saturday`, `weekday <day>`, `todayMarker`), `section` lines, and task lines `Label :[tags,] [id,] [start,] end` where tags are `active`/`done`/`crit`/`milestone`/`vert`, start is a date or `after id…`, and end is a date, a duration token (`ms s m h d w M y`, decimals allowed), or `until id…`. Dependencies resolve in a pure scheduler ([design/families/gantt.md](./design/families/gantt.md)): `after` starts at the latest referenced end, `until` ends at the earliest referenced start, working durations extend over excluded days, `includes` overrides `excludes`, and dependency cycles / unknown references / invalid dates are named structured errors (`GANTT_*`), never wall-clock fallbacks. Rendering is deterministic: the `todayMarker` draws only when the caller passes `ganttToday` (a date in the diagram's `dateFormat`), and `todayMarker off` always wins. `displayMode: compact` (frontmatter or `config.gantt`) packs non-overlapping tasks of a section into shared rows; `vert` markers draw a full-height line without consuming a task row. `click … href` is sanitized under strict security and `click … call` is parsed but never executed. Gantt is structured when narrowed and segment-preserving: `asGantt` edits title/sections/tasks while calendar directives, click lines, and comments ride along verbatim as opaque segments; duplicate task ids or an unclosed `accDescr` block fall back to a lossless whole-opaque body.
|
|
162
|
+
|
|
163
|
+
## Mindmap
|
|
164
|
+
|
|
165
|
+
```mermaid
|
|
166
|
+
mindmap
|
|
167
|
+
root((Product))
|
|
168
|
+
Research
|
|
169
|
+
Evidence
|
|
170
|
+
Delivery
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Mindmap uses indentation for parentage and supports Mermaid node shapes, `::icon(...)`, `:::class`, accessibility directives, deterministic tree layout, and structured mutation through `asMindmap`. Duplicate semantic ids are rejected. Use `describeOps('mindmap')` for the exact operation schema; see [`design/families/mindmap.md`](./design/families/mindmap.md).
|
|
174
|
+
|
|
175
|
+
## GitGraph
|
|
176
|
+
|
|
177
|
+
```mermaid
|
|
178
|
+
gitGraph
|
|
179
|
+
commit id:"base"
|
|
180
|
+
branch feature
|
|
181
|
+
commit id:"work"
|
|
182
|
+
checkout main
|
|
183
|
+
merge feature id:"merge"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
GitGraph replays commits and branch movement in source order and exposes structured mutation through `asGitGraph`. Generated ids are deterministic `c<N>` values and duplicate custom ids are rejected. Use `describeOps('gitgraph')` for the exact operation schema; see [`design/families/gitgraph.md`](./design/families/gitgraph.md).
|
|
162
187
|
|
|
163
188
|
## Architecture
|
|
164
189
|
|