|
| 1 | +// Single source of truth for Mermaid diagram layout/typography, used by |
| 2 | +// docusaurus.config.js (themeConfig.mermaid.options) and by the dev-only |
| 3 | +// diagram review tool (scripts/mermaid-compare/, regenerate its |
| 4 | +// mermaid-theme.json from this file after editing it). |
| 5 | +// |
| 6 | +// These are mode-independent (no colors) because Docusaurus applies |
| 7 | +// `themeConfig.mermaid.options` identically in light and dark mode; only |
| 8 | +// `themeConfig.mermaid.theme.{light,dark}` (a built-in theme name) varies by |
| 9 | +// color mode. Brand colors are handled separately via CSS overrides in |
| 10 | +// src/css/custom.css targeting Mermaid's generated SVG classes, which is not |
| 11 | +// subject to that light/dark limitation — see the comment there for why. |
| 12 | +module.exports = { |
| 13 | + // Kept mode-aware (matching Docusaurus's own default) rather than pinned |
| 14 | + // to a single base theme, as a safety net for anything custom.css's |
| 15 | + // Mermaid overrides don't explicitly recolor (e.g. rarely-used elements |
| 16 | + // like the sequenceNumber marker) — verified those still need Mermaid's |
| 17 | + // own light/dark split to stay correct, not just the CSS layer. |
| 18 | + theme: { light: 'default', dark: 'dark' }, |
| 19 | + fontFamily: '"Aeonik", "Poppins", -apple-system, BlinkMacSystemFont, sans-serif', |
| 20 | + flowchart: { |
| 21 | + padding: 14, |
| 22 | + nodeSpacing: 45, |
| 23 | + rankSpacing: 60, |
| 24 | + curve: 'basis', |
| 25 | + htmlLabels: true, |
| 26 | + wrap: true, |
| 27 | + }, |
| 28 | + sequence: { |
| 29 | + actorMargin: 60, |
| 30 | + messageMargin: 40, |
| 31 | + boxMargin: 12, |
| 32 | + noteMargin: 12, |
| 33 | + // NOT wrap: true — Mermaid mis-sizes the note/message box width whenever |
| 34 | + // the text already has explicit <br/> breaks (a common pattern in these |
| 35 | + // diagrams) while wrap is on, at any font size: the box comes out |
| 36 | + // narrower than the actual rendered text, so text overflows its own |
| 37 | + // box. Confirmed by direct comparison; flowchart's `wrap` does not have |
| 38 | + // this problem (only sequence). Long single-line messages without <br/> |
| 39 | + // just render unwrapped (no auto line-break) instead — worse for that |
| 40 | + // one case, but the halo on .messageText already keeps unwrapped text |
| 41 | + // readable where it crosses a line, whereas a mis-sized note box is a |
| 42 | + // correctness bug with no equivalent mitigation. |
| 43 | + mirrorActors: false, |
| 44 | + }, |
| 45 | + state: { |
| 46 | + padding: 14, |
| 47 | + }, |
| 48 | +}; |
0 commit comments