agentic-mermaid 0.4.1 → 0.5.3

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 (253) hide show
  1. package/AGENT_NATIVE.md +94 -627
  2. package/CHANGELOG.md +651 -0
  3. package/Instructions_for_agents.md +44 -23
  4. package/LICENSES/Khroma-MIT.txt +21 -0
  5. package/LICENSES/Mermaid-MIT.txt +21 -0
  6. package/LICENSES/es-toolkit-MIT.txt +21 -0
  7. package/LICENSES/pele-MIT.txt +40 -0
  8. package/LICENSES/zenuml-core-MIT.txt +21 -0
  9. package/README.md +93 -50
  10. package/SECURITY.md +28 -12
  11. package/THIRD_PARTY_NOTICES.md +60 -0
  12. package/assets/hero.png +0 -0
  13. package/dist/agent-core.d.ts +478 -210
  14. package/dist/agent-core.js +1 -396
  15. package/dist/agent.d.ts +17 -8
  16. package/dist/agent.js +1 -408
  17. package/dist/agentic-mermaid-mcp.js +1 -11
  18. package/dist/am.js +1 -34562
  19. package/dist/browser-lazy/chunks/agentic-producer-core-CC6OOLDW.js +1 -0
  20. package/dist/browser-lazy/chunks/architecture-QUFVKYJR.js +13 -0
  21. package/dist/browser-lazy/chunks/block-6J3Q63BO.js +11 -0
  22. package/dist/browser-lazy/chunks/builtin-backends-7SOZZHPF.js +12 -0
  23. package/dist/browser-lazy/chunks/c4-SQVBZAKJ.js +10 -0
  24. package/dist/browser-lazy/chunks/chunk-2GPK4VFF.js +5 -0
  25. package/dist/browser-lazy/chunks/chunk-2I4UPL7Q.js +3 -0
  26. package/dist/browser-lazy/chunks/chunk-2SH76OTH.js +1 -0
  27. package/dist/browser-lazy/chunks/chunk-2UIA2IME.js +3 -0
  28. package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +1 -0
  29. package/dist/browser-lazy/chunks/chunk-5B2Z7575.js +1 -0
  30. package/dist/browser-lazy/chunks/chunk-5FQ534HP.js +1 -0
  31. package/dist/browser-lazy/chunks/chunk-5UVGUSD6.js +1 -0
  32. package/dist/browser-lazy/chunks/chunk-5X6MJX3H.js +1 -0
  33. package/dist/browser-lazy/chunks/chunk-AMJLVPUB.js +4 -0
  34. package/dist/browser-lazy/chunks/chunk-BU5LHXNJ.js +3 -0
  35. package/dist/browser-lazy/chunks/chunk-BY2CPG6B.js +1 -0
  36. package/dist/browser-lazy/chunks/chunk-CN7WTBWB.js +1 -0
  37. package/dist/browser-lazy/chunks/chunk-CQE4HQEW.js +1 -0
  38. package/dist/browser-lazy/chunks/chunk-CSFUKSU6.js +1 -0
  39. package/dist/browser-lazy/chunks/chunk-DF6765YX.js +17 -0
  40. package/dist/browser-lazy/chunks/chunk-E2WMJZNM.js +1 -0
  41. package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +6 -0
  42. package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +1 -0
  43. package/dist/browser-lazy/chunks/chunk-HLWUNUCM.js +1 -0
  44. package/dist/browser-lazy/chunks/chunk-ICC7HBJX.js +1 -0
  45. package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +20 -0
  46. package/dist/browser-lazy/chunks/chunk-J7FFAFQF.js +1 -0
  47. package/dist/browser-lazy/chunks/chunk-LH7HUDKW.js +1 -0
  48. package/dist/browser-lazy/chunks/chunk-N5ELX7LR.js +2 -0
  49. package/dist/browser-lazy/chunks/chunk-NMQQMRIR.js +1 -0
  50. package/dist/browser-lazy/chunks/chunk-NO7ZIVRU.js +1 -0
  51. package/dist/browser-lazy/chunks/chunk-OZ443IVJ.js +16 -0
  52. package/dist/browser-lazy/chunks/chunk-PQGPS2YV.js +7 -0
  53. package/dist/browser-lazy/chunks/chunk-QA6GJQ4X.js +1 -0
  54. package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +1 -0
  55. package/dist/browser-lazy/chunks/chunk-SZELX2EJ.js +1 -0
  56. package/dist/browser-lazy/chunks/chunk-TYZOZXUJ.js +22 -0
  57. package/dist/browser-lazy/chunks/chunk-UL6NDWLL.js +1 -0
  58. package/dist/browser-lazy/chunks/chunk-VQYYGAXP.js +1 -0
  59. package/dist/browser-lazy/chunks/chunk-VWVZGQE2.js +1 -0
  60. package/dist/browser-lazy/chunks/chunk-X2UYKWKM.js +4 -0
  61. package/dist/browser-lazy/chunks/chunk-YCEICNM6.js +1 -0
  62. package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +20 -0
  63. package/dist/browser-lazy/chunks/class-5QA4SCTS.js +13 -0
  64. package/dist/browser-lazy/chunks/decode-63UIZGD2.js +1 -0
  65. package/dist/browser-lazy/chunks/elk.bundled-L4CADV5W.js +24 -0
  66. package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +11 -0
  67. package/dist/browser-lazy/chunks/eventmodeling-2BPLHWRN.js +19 -0
  68. package/dist/browser-lazy/chunks/flowchart-NEIMZTB5.js +4 -0
  69. package/dist/browser-lazy/chunks/forest-implementation-AEP24AIP.js +1 -0
  70. package/dist/browser-lazy/chunks/gantt-RDPIFYAF.js +11 -0
  71. package/dist/browser-lazy/chunks/gitgraph-N4Y5RYB7.js +9 -0
  72. package/dist/browser-lazy/chunks/ishikawa-LD3YBDJN.js +6 -0
  73. package/dist/browser-lazy/chunks/journey-6YQR5DJX.js +16 -0
  74. package/dist/browser-lazy/chunks/kanban-PLMJ7NBW.js +20 -0
  75. package/dist/browser-lazy/chunks/mermaid-yaml-runtime-QVYX4EWK.js +136 -0
  76. package/dist/browser-lazy/chunks/mindmap-K2UBFO3Y.js +12 -0
  77. package/dist/browser-lazy/chunks/packet-CUW4QY6Y.js +7 -0
  78. package/dist/browser-lazy/chunks/pie-7F7UUCG3.js +15 -0
  79. package/dist/browser-lazy/chunks/quadrant-TOONO2WC.js +10 -0
  80. package/dist/browser-lazy/chunks/radar-J6JVWVAX.js +16 -0
  81. package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +3 -0
  82. package/dist/browser-lazy/chunks/requirement-CMAKDJPO.js +19 -0
  83. package/dist/browser-lazy/chunks/sankey-AWXQEP3F.js +13 -0
  84. package/dist/browser-lazy/chunks/sequence-Q2RJRB4L.js +5 -0
  85. package/dist/browser-lazy/chunks/state-WRBFQEDX.js +4 -0
  86. package/dist/browser-lazy/chunks/timeline-D2KILFXM.js +6 -0
  87. package/dist/browser-lazy/chunks/treemap-N3VYX5D4.js +6 -0
  88. package/dist/browser-lazy/chunks/xychart-G73OGK66.js +16 -0
  89. package/dist/browser-lazy/chunks/zenuml-H4BXNYXR.js +16 -0
  90. package/dist/browser-lazy/index.d.ts +544 -275
  91. package/dist/browser-lazy/index.js +1 -1
  92. package/dist/browser.global.js +802 -565
  93. package/dist/chunk-3LGLPG33.js +2 -0
  94. package/dist/chunk-7CRDX2QR.js +2 -0
  95. package/dist/chunk-7PPW2BMO.js +2 -0
  96. package/dist/chunk-DQDKA5ND.js +2 -0
  97. package/dist/chunk-EHCMJUMD.js +52 -0
  98. package/dist/chunk-GVCHLSHH.js +4 -0
  99. package/dist/chunk-H3NCS2XZ.js +19 -0
  100. package/dist/chunk-JZOJ4YGS.js +201 -0
  101. package/dist/chunk-MKE7GNYU.js +146 -0
  102. package/dist/chunk-NKNFOREZ.js +2 -0
  103. package/dist/chunk-O7H2UX5K.js +2 -0
  104. package/dist/chunk-OMY6NRQD.js +58 -0
  105. package/dist/chunk-UA234O4M.js +4 -0
  106. package/dist/chunk-VUFVLGTH.js +2 -0
  107. package/dist/chunk-XU5LPD2D.js +2 -0
  108. package/dist/cli-YGGTJZH7.js +226 -0
  109. package/dist/elk-constructor.js +2 -0
  110. package/dist/elk-constructor.node.js +11 -0
  111. package/dist/index-EeXqJXr5.d.ts +1223 -0
  112. package/dist/index.d.ts +4 -1
  113. package/dist/index.js +1 -334
  114. package/dist/jsonl-RPJY6YWO.js +2 -0
  115. package/dist/mcp-cli-63DYXTVD.js +2 -0
  116. package/dist/{index-BGA_-6LV.d.ts → paint-certification-6rwQjIv_.d.ts} +5283 -6173
  117. package/dist/server-5NEOHOFS.js +524 -0
  118. package/dist/svg-styles-BdnoM7AT.d.ts +724 -0
  119. package/dist/svg-styles.d.ts +1 -0
  120. package/dist/svg-styles.js +2 -0
  121. package/dist/svg.d.ts +13 -0
  122. package/dist/svg.js +2 -0
  123. package/dist/types-BcS52Mjt.d.ts +1360 -0
  124. package/dist/zenuml/chunks/appearance-UOQ5KA6O.js +1 -0
  125. package/dist/zenuml/chunks/builtin-backends-KDKE7YHO.js +12 -0
  126. package/dist/zenuml/chunks/chunk-42DXZ5C6.js +4 -0
  127. package/dist/zenuml/chunks/chunk-7TVYPTDW.js +1 -0
  128. package/dist/zenuml/chunks/chunk-EVPSMEKN.js +1 -0
  129. package/dist/zenuml/chunks/chunk-OXQWRSBM.js +20 -0
  130. package/dist/zenuml/chunks/chunk-QWX77U7G.js +2 -0
  131. package/dist/zenuml/chunks/chunk-RLJEI7YN.js +29 -0
  132. package/dist/zenuml/chunks/chunk-RZ6XK5CD.js +29 -0
  133. package/dist/zenuml/chunks/decode-BWERFDGK.js +1 -0
  134. package/dist/zenuml/chunks/mermaid-yaml-runtime-KZVU74WU.js +136 -0
  135. package/dist/zenuml/chunks/render-core-V5RQ737O.js +3 -0
  136. package/dist/zenuml/chunks/zenuml-EA2ZFRUX.js +20 -0
  137. package/dist/zenuml-frame.global.js +3626 -0
  138. package/dist/zenuml.d.ts +83 -0
  139. package/dist/zenuml.js +1 -0
  140. package/docs/MCP-DIRECTORY-LISTINGS.md +5 -1
  141. package/docs/README.md +59 -103
  142. package/docs/agent-api-cookbook.md +26 -16
  143. package/docs/agent-mutation-policy.md +86 -15
  144. package/docs/agent-workflow-examples.md +1 -1
  145. package/docs/api-advanced.md +385 -0
  146. package/docs/api.md +320 -366
  147. package/docs/ascii.md +40 -4
  148. package/docs/browser.md +46 -7
  149. package/docs/choosing-a-diagram.md +148 -0
  150. package/docs/code-mode-impact.md +1 -0
  151. package/docs/comparison.md +244 -28
  152. package/docs/computational-aesthetics-prototype-plan.md +10 -10
  153. package/docs/config.md +60 -2
  154. package/docs/custom-fonts.md +78 -21
  155. package/docs/diagram-families.md +160 -10
  156. package/docs/eventmodeling-and-zenuml.md +165 -0
  157. package/docs/features.md +21 -19
  158. package/docs/fork-differences.md +105 -32
  159. package/docs/getting-started.md +56 -51
  160. package/docs/layout-certification.md +126 -0
  161. package/docs/mcp-code-mode-rationale.md +20 -12
  162. package/docs/mcp-http-transport.md +14 -8
  163. package/docs/quality.md +145 -15
  164. package/docs/react.md +76 -31
  165. package/docs/style-authoring.md +23 -11
  166. package/docs/svg-semantic-contract.md +104 -4
  167. package/docs/testing-strategy.md +684 -126
  168. package/docs/theming.md +27 -8
  169. package/examples/styles/readme-hero.md +25 -0
  170. package/examples/styles/readme-hero.mmd +13 -0
  171. package/examples/styles/readme-hero.style.json +7 -0
  172. package/package.json +114 -57
  173. package/server.json +2 -2
  174. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +26 -8
  175. package/skills/agentic-mermaid-diagram-workflow/references/cli.md +13 -3
  176. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +2 -1
  177. package/skills/agentic-mermaid-diagram-workflow/references/flowchart.md +9 -6
  178. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +1 -0
  179. package/skills/agentic-mermaid-diagram-workflow/references/sequence.md +4 -3
  180. package/skills/agentic-mermaid-diagram-workflow/references/timeline.md +7 -6
  181. package/skills/agentic-mermaid-diagram-workflow/references/upstream/agentflow.md +574 -0
  182. package/skills/agentic-mermaid-diagram-workflow/references/upstream/architecture.md +10 -2
  183. package/skills/agentic-mermaid-diagram-workflow/references/upstream/c4.md +18 -0
  184. package/skills/agentic-mermaid-diagram-workflow/references/upstream/classDiagram.md +123 -0
  185. package/skills/agentic-mermaid-diagram-workflow/references/upstream/cynefin.md +6 -1
  186. package/skills/agentic-mermaid-diagram-workflow/references/upstream/entityRelationshipDiagram.md +129 -9
  187. package/skills/agentic-mermaid-diagram-workflow/references/upstream/eventmodeling.md +22 -0
  188. package/skills/agentic-mermaid-diagram-workflow/references/upstream/flowchart.md +188 -60
  189. package/skills/agentic-mermaid-diagram-workflow/references/upstream/gitgraph.md +13 -7
  190. package/skills/agentic-mermaid-diagram-workflow/references/upstream/mindmap.md +110 -1
  191. package/skills/agentic-mermaid-diagram-workflow/references/upstream/packet.md +38 -0
  192. package/skills/agentic-mermaid-diagram-workflow/references/upstream/requirementDiagram.md +115 -0
  193. package/skills/agentic-mermaid-diagram-workflow/references/upstream/sequenceDiagram.md +101 -0
  194. package/skills/agentic-mermaid-diagram-workflow/references/upstream/stateDiagram.md +87 -0
  195. package/skills/agentic-mermaid-diagram-workflow/references/upstream/swimlanes.md +105 -2
  196. package/skills/agentic-mermaid-diagram-workflow/references/upstream/timeline.md +12 -6
  197. package/skills/agentic-mermaid-diagram-workflow/references/upstream/usecase.md +953 -0
  198. package/skills/agentic-mermaid-diagram-workflow/references/upstream/venn.md +77 -0
  199. package/skills/agentic-mermaid-diagram-workflow/references/upstream/xyChart.md +1 -1
  200. package/dist/browser-lazy/chunks/architecture-KTHE2HX3.js +0 -31
  201. package/dist/browser-lazy/chunks/chunk-2XCPFAD5.js +0 -46
  202. package/dist/browser-lazy/chunks/chunk-3H4F7RBT.js +0 -1
  203. package/dist/browser-lazy/chunks/chunk-4EVLW2NJ.js +0 -1
  204. package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +0 -1
  205. package/dist/browser-lazy/chunks/chunk-6OAPWSDO.js +0 -1
  206. package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +0 -143
  207. package/dist/browser-lazy/chunks/chunk-C7FJO2I3.js +0 -4
  208. package/dist/browser-lazy/chunks/chunk-D3XXDKIO.js +0 -1
  209. package/dist/browser-lazy/chunks/chunk-DXA5WL7H.js +0 -4
  210. package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +0 -1
  211. package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +0 -2
  212. package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +0 -2
  213. package/dist/browser-lazy/chunks/chunk-G6OLSHRG.js +0 -7
  214. package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
  215. package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +0 -1
  216. package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +0 -1
  217. package/dist/browser-lazy/chunks/chunk-L227EPFP.js +0 -11
  218. package/dist/browser-lazy/chunks/chunk-LNIHDJSF.js +0 -1
  219. package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +0 -1
  220. package/dist/browser-lazy/chunks/chunk-NZRUMODH.js +0 -1
  221. package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +0 -1
  222. package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +0 -1
  223. package/dist/browser-lazy/chunks/chunk-PXKL3O6H.js +0 -1
  224. package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +0 -1
  225. package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +0 -1
  226. package/dist/browser-lazy/chunks/chunk-SUFMSWTX.js +0 -1
  227. package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +0 -3
  228. package/dist/browser-lazy/chunks/chunk-UAEZO5VL.js +0 -1
  229. package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +0 -1
  230. package/dist/browser-lazy/chunks/chunk-X64T74C5.js +0 -24
  231. package/dist/browser-lazy/chunks/class-F7R6TJ73.js +0 -9
  232. package/dist/browser-lazy/chunks/er-BDK7CM5L.js +0 -9
  233. package/dist/browser-lazy/chunks/flowchart-KFU6XV7S.js +0 -4
  234. package/dist/browser-lazy/chunks/gantt-I64VVDSP.js +0 -28
  235. package/dist/browser-lazy/chunks/gitgraph-EDUVJ5IJ.js +0 -8
  236. package/dist/browser-lazy/chunks/journey-TLO2RNM3.js +0 -40
  237. package/dist/browser-lazy/chunks/mindmap-OJCNDYPM.js +0 -9
  238. package/dist/browser-lazy/chunks/pie-HVG6XO7K.js +0 -19
  239. package/dist/browser-lazy/chunks/quadrant-U6S2L4MJ.js +0 -24
  240. package/dist/browser-lazy/chunks/radar-ZDLOBTVG.js +0 -32
  241. package/dist/browser-lazy/chunks/render-core-Y2DFNMQG.js +0 -12
  242. package/dist/browser-lazy/chunks/sequence-Z4WFS3VB.js +0 -12
  243. package/dist/browser-lazy/chunks/state-2HV2YGN3.js +0 -4
  244. package/dist/browser-lazy/chunks/timeline-XM4UFPOC.js +0 -20
  245. package/dist/browser-lazy/chunks/xychart-7JDHWTQY.js +0 -36
  246. package/dist/chunk-GGXCNCNA.js +0 -4118
  247. package/dist/chunk-IVD4NXNE.js +0 -615
  248. package/dist/chunk-JDMRPUAG.js +0 -37
  249. package/dist/chunk-JWAAW3FH.js +0 -149
  250. package/dist/chunk-LCGBT32P.js +0 -62036
  251. package/dist/chunk-RWMZRUIC.js +0 -4715
  252. package/dist/mcp-cli-4MLKC3ZH.js +0 -17
  253. package/docs/mutation-testing.md +0 -285
@@ -0,0 +1,1360 @@
1
+ import { S as StyleInput, Q as InternalStyleFace } from './svg-styles-BdnoM7AT.js';
2
+
3
+ interface DiagramColors {
4
+ /** Background color → CSS variable --bg */
5
+ bg: string;
6
+ /** Foreground / primary text color → CSS variable --fg */
7
+ fg: string;
8
+ /** Edge/connector color → CSS variable --line */
9
+ line?: string;
10
+ /** Arrow heads, highlights, special nodes → CSS variable --accent */
11
+ accent?: string;
12
+ /** Secondary text, edge labels → CSS variable --muted */
13
+ muted?: string;
14
+ /** Node/box fill tint → CSS variable --surface */
15
+ surface?: string;
16
+ /** Base node/group stroke color → --border; automatic outlines repair contrast. */
17
+ border?: string;
18
+ /** Optional explicit drop shadows on node shapes. Default: false */
19
+ shadow?: boolean;
20
+ /**
21
+ * Font family for all text. Emitted on the SVG root as `--font`, so the family
22
+ * stays overridable post-render via inline style. Default: 'Inter'.
23
+ *
24
+ * Accepts a plain family name ('Inter'), a CSS variable reference
25
+ * ('var(--brand-font)'), or a multi-family stack ('Inter, system-ui').
26
+ * Only plain names get a Google Fonts `@import`; var() references and
27
+ * stacks are emitted as-is (unquoted) and never fetched.
28
+ */
29
+ font?: string;
30
+ /**
31
+ * Whether to embed the Google Fonts `@import` line in the SVG `<style>` block.
32
+ * Default: `false`. Set `true` explicitly when a fetching font import is
33
+ * appropriate for the target document.
34
+ *
35
+ * PNG paths keep this disabled to render offline.
36
+ * The CSS variable `--font` is always emitted on the SVG root regardless,
37
+ * so the family stays overridable post-render even when the @import is gone.
38
+ */
39
+ embedFontImport?: boolean;
40
+ }
41
+ /** Default bg/fg when no colors are provided (zinc light) */
42
+ declare const DEFAULTS: Readonly<{
43
+ bg: string;
44
+ fg: string;
45
+ }>;
46
+ /**
47
+ * Minimal subset of Shiki's ThemeRegistrationResolved that we need.
48
+ * We don't import from shiki to avoid a hard dependency.
49
+ */
50
+ interface ShikiThemeLike {
51
+ type?: string;
52
+ colors?: Record<string, string>;
53
+ tokenColors?: Array<{
54
+ scope?: string | string[];
55
+ settings?: {
56
+ foreground?: string;
57
+ };
58
+ }>;
59
+ }
60
+ /**
61
+ * Extract diagram colors from a Shiki theme object.
62
+ * Works with any VS Code / TextMate theme loaded by Shiki.
63
+ *
64
+ * Maps editor UI colors to diagram roles:
65
+ * editor.background → bg
66
+ * editor.foreground → fg
67
+ * editorLineNumber.fg → line (optional)
68
+ * focusBorder / keyword → accent (optional)
69
+ * comment token → muted (optional)
70
+ * editor.selectionBackground→ surface (optional)
71
+ * editorWidget.border → border (optional)
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { getSingletonHighlighter } from 'shiki'
76
+ * import { fromShikiTheme } from 'agentic-mermaid'
77
+ *
78
+ * const hl = await getSingletonHighlighter({ themes: ['tokyo-night'] })
79
+ * const colors = fromShikiTheme(hl.getTheme('tokyo-night'))
80
+ * const svg = renderMermaidSVG(code, colors)
81
+ * ```
82
+ */
83
+ declare function fromShikiTheme(theme: ShikiThemeLike): DiagramColors;
84
+ /**
85
+ * All derived diagram colors resolved to concrete hex values.
86
+ * Mirrors the CSS variable derivation system in buildStyleBlock().
87
+ */
88
+ interface ResolvedColors {
89
+ bg: string;
90
+ fg: string;
91
+ text: string;
92
+ textSec: string;
93
+ textMuted: string;
94
+ textFaint: string;
95
+ line: string;
96
+ arrow: string;
97
+ nodeFill: string;
98
+ nodeStroke: string;
99
+ groupFill: string;
100
+ groupHdr: string;
101
+ innerStroke: string;
102
+ keyBadge: string;
103
+ }
104
+ /**
105
+ * Resolve all derived colors from a DiagramColors to concrete hex values.
106
+ * Starts from the CSS color-mix() derivations in buildStyleBlock(), then repairs
107
+ * concrete text, connector and outline tones against their known backgrounds.
108
+ */
109
+ declare function resolveColors(colors: DiagramColors): ResolvedColors;
110
+ /**
111
+ * Resolve all CSS var() and color-mix() expressions in an SVG string to
112
+ * concrete hex color values. This makes the SVG render correctly in
113
+ * non-browser renderers (resvg, librsvg, etc.) that don't support CSS
114
+ * custom properties or color-mix().
115
+ *
116
+ * Operates via iterative string replacement:
117
+ * 1. Replace var(--name) with known resolved values
118
+ * 2. Replace var(--name, fallback) — use value if known, else fallback
119
+ * 3. Resolve color-mix(in srgb, #hex P%, #hex) to computed hex
120
+ * 4. Extract CSS variable definitions from <style> and resolve remaining refs
121
+ * 5. Repeat until stable
122
+ *
123
+ * When bg/fg cannot be resolved (e.g. CSS variables for live theming), the SVG
124
+ * is returned as-is since the eventual host supplies their values.
125
+ */
126
+ declare function inlineResolvedColors(svg: string, colors: DiagramColors): string;
127
+
128
+ /** A title placed on the canvas: its display text centered at (x, y). */
129
+ interface PositionedDiagramTitle {
130
+ text: string;
131
+ x: number;
132
+ y: number;
133
+ block?: PixelTextBlock;
134
+ }
135
+
136
+ interface LayoutPreferenceScore {
137
+ unreadableTitles: 0 | 1;
138
+ edgeCrossings: number;
139
+ labelConflicts: number;
140
+ totalBends: number;
141
+ nonCanonicalEndpointRate: number;
142
+ peerBarycenterDelta: number;
143
+ /** Candidate canvas before document title-band projection. */
144
+ area: number;
145
+ }
146
+ type PreferenceCriterion = keyof LayoutPreferenceScore;
147
+ interface LayoutPreferenceEvidence {
148
+ /** Score of the returned geometry, including the optional final route choice. */
149
+ selectedScore: LayoutPreferenceScore;
150
+ /** Placement-strategy decision, before the optional final route comparison. */
151
+ reason: PreferenceCriterion | 'candidate-order' | 'first-certified' | 'work-budget' | 'no-alternative' | 'alternative-invalid';
152
+ /** Certified placement scores before the optional final route comparison. */
153
+ compared: readonly {
154
+ strategy: string;
155
+ score: LayoutPreferenceScore;
156
+ }[];
157
+ /** Final bundled/unbundled decision using the selected placement's ELK result.
158
+ * Its selected score describes the same final geometry as selectedScore above. */
159
+ routing?: {
160
+ strategy: 'bundled' | 'without-generic-bundling';
161
+ preference: Omit<LayoutPreferenceEvidence, 'routing'>;
162
+ };
163
+ }
164
+ interface LayoutCertificationReceipt {
165
+ status: 'passed';
166
+ strategy: string;
167
+ /** Placement-production attempts; an optional final routing comparison is separate. */
168
+ attempts: number;
169
+ hardViolations: 0;
170
+ preference: LayoutPreferenceEvidence;
171
+ }
172
+
173
+ interface GraphLayoutDecision {
174
+ readonly requested: 'elk' | 'agentic';
175
+ readonly fallback: 'none' | 'elk';
176
+ readonly selected: 'elk' | 'agentic';
177
+ readonly reason?: string;
178
+ readonly attempts: readonly {
179
+ readonly backend: 'elk' | 'agentic';
180
+ readonly outcome: 'selected' | 'unsupported' | 'candidate-rejected';
181
+ readonly reason?: string;
182
+ }[];
183
+ readonly implementation: string;
184
+ readonly role?: 'primary' | 'companion';
185
+ }
186
+ declare class GraphLayoutUnsupportedError extends Error {
187
+ readonly reason: string;
188
+ readonly code = "GRAPH_LAYOUT_UNSUPPORTED";
189
+ constructor(reason: string);
190
+ }
191
+
192
+ interface MermaidAccessibility {
193
+ title?: string;
194
+ descr?: string;
195
+ }
196
+
197
+ type MermaidCleanupView = 'text' | 'payloadText' | 'authoredPayloadText' | 'lineText' | 'upstreamText' | 'prepassedText';
198
+ type MermaidCleanupReason = 'line-ending' | 'xml-entity' | 'html-attribute-quotes' | 'style-semicolon' | 'native-accessibility';
199
+ /** Offsets are UTF-16 boundaries, matching String.slice and public source spans. */
200
+ interface MermaidCleanupEdit {
201
+ readonly originalStart: number;
202
+ readonly originalEnd: number;
203
+ readonly cleanedStart: number;
204
+ readonly cleanedEnd: number;
205
+ }
206
+ /** One sparse transformation. Coordinates refer to this pass's input/output. */
207
+ interface MermaidCleanupMapping {
208
+ readonly edits: readonly MermaidCleanupEdit[];
209
+ }
210
+ interface MermaidCleanupChange extends MermaidCleanupEdit {
211
+ readonly reason: MermaidCleanupReason;
212
+ readonly view: MermaidCleanupView;
213
+ readonly line: number;
214
+ readonly col: number;
215
+ }
216
+ /** Immutable data only: safe to retain in normalized sources and request snapshots. */
217
+ interface MermaidCleanup {
218
+ readonly originalText: string;
219
+ /** Generous rendering convention: XML decode once and normalize line endings. */
220
+ readonly text: string;
221
+ /** CRLF normalized, lone CR retained for grammar-owned payload identities. */
222
+ readonly payloadText: string;
223
+ /** The same payload-aware line endings without transport XML decoding. */
224
+ readonly authoredPayloadText: string;
225
+ /** Authored grammar spelling with CRLF and lone CR normalized. */
226
+ readonly lineText: string;
227
+ /** Mermaid's cleanupText result: normalized line endings and tag quotes.
228
+ * The generous grammar preserves authored quotes instead. */
229
+ readonly upstreamText: string;
230
+ /** Authored spelling after line endings and the style/classDef semicolon pass. */
231
+ readonly prepassedText: string;
232
+ readonly changes: readonly MermaidCleanupChange[];
233
+ readonly mappings: readonly MermaidCleanupMapping[];
234
+ readonly lineMappings: readonly MermaidCleanupMapping[];
235
+ readonly upstreamMappings: readonly MermaidCleanupMapping[];
236
+ readonly prepassedMappings: readonly MermaidCleanupMapping[];
237
+ }
238
+
239
+ type MermaidConfigScalar = string | number | boolean | null;
240
+ type MermaidConfigValue = MermaidConfigScalar | MermaidConfigValue[] | MermaidConfigMap;
241
+ interface MermaidConfigMap {
242
+ [key: string]: MermaidConfigValue | undefined;
243
+ }
244
+ interface MermaidFrontmatterMap extends MermaidConfigMap {
245
+ }
246
+ interface MermaidThemeVariables extends MermaidConfigMap {
247
+ fontFamily?: string;
248
+ }
249
+ interface TimelineRuntimeConfig extends MermaidConfigMap {
250
+ disableMulticolor?: boolean;
251
+ sectionFills?: string[];
252
+ sectionColours?: string[];
253
+ }
254
+ /** Mermaid stateDiagram config. Faithful ELK/measured-text fields are wired; unsupported fields warn. */
255
+ interface StateRuntimeConfig extends MermaidConfigMap {
256
+ titleTopMargin?: number;
257
+ arrowMarkerAbsolute?: boolean;
258
+ dividerMargin?: number;
259
+ sizeUnit?: number;
260
+ padding?: number;
261
+ textHeight?: number;
262
+ titleShift?: number;
263
+ noteMargin?: number;
264
+ nodeSpacing?: number;
265
+ rankSpacing?: number;
266
+ forkWidth?: number;
267
+ forkHeight?: number;
268
+ miniPadding?: number;
269
+ fontSizeFactor?: number;
270
+ fontSize?: number;
271
+ labelHeight?: number;
272
+ edgeLengthFactor?: string;
273
+ compositTitleSize?: number;
274
+ radius?: number;
275
+ defaultRenderer?: 'dagre-d3' | 'dagre-wrapper' | 'elk';
276
+ layout?: string;
277
+ look?: string;
278
+ minNodeWidth?: number;
279
+ theme?: string;
280
+ wrappingWidth?: number;
281
+ }
282
+ interface XyChartRuntimeConfig extends MermaidConfigMap {
283
+ width?: number;
284
+ height?: number;
285
+ useMaxWidth?: boolean;
286
+ useWidth?: number;
287
+ titleFontSize?: number;
288
+ titlePadding?: number;
289
+ chartOrientation?: 'vertical' | 'horizontal';
290
+ plotReservedSpacePercent?: number;
291
+ showDataLabel?: boolean;
292
+ showDataLabelOutsideBar?: boolean;
293
+ showTitle?: boolean;
294
+ showLegend?: boolean;
295
+ legendFontSize?: number;
296
+ legendPadding?: number;
297
+ xAxis?: MermaidConfigMap;
298
+ yAxis?: MermaidConfigMap;
299
+ }
300
+ interface PieRuntimeConfig extends MermaidConfigMap {
301
+ textPosition?: number;
302
+ donutHole?: number;
303
+ legendPosition?: 'top' | 'bottom' | 'left' | 'right' | 'center';
304
+ highlightSlice?: string;
305
+ useMaxWidth?: boolean;
306
+ useWidth?: number;
307
+ }
308
+ interface SankeyRuntimeConfig extends MermaidConfigMap {
309
+ width?: number;
310
+ height?: number;
311
+ linkColor?: 'source' | 'target' | 'gradient' | string;
312
+ nodeAlignment?: 'justify' | 'center' | 'left' | 'right';
313
+ showValues?: boolean;
314
+ prefix?: string;
315
+ suffix?: string;
316
+ labelStyle?: 'legacy' | 'outlined';
317
+ nodeWidth?: number;
318
+ nodePadding?: number;
319
+ nodeColors?: Record<string, string>;
320
+ useMaxWidth?: boolean;
321
+ }
322
+ interface RadarRuntimeConfig extends MermaidConfigMap {
323
+ width?: number;
324
+ height?: number;
325
+ marginTop?: number;
326
+ marginRight?: number;
327
+ marginBottom?: number;
328
+ marginLeft?: number;
329
+ axisScaleFactor?: number;
330
+ axisLabelFactor?: number;
331
+ curveTension?: number;
332
+ useMaxWidth?: boolean;
333
+ useWidth?: number;
334
+ /** Agentic extension: draw the ring value labels (default off). */
335
+ tickLabels?: boolean;
336
+ }
337
+ interface QuadrantRuntimeConfig extends MermaidConfigMap {
338
+ chartWidth?: number;
339
+ chartHeight?: number;
340
+ titleFontSize?: number;
341
+ titlePadding?: number;
342
+ quadrantPadding?: number;
343
+ quadrantLabelFontSize?: number;
344
+ xAxisLabelFontSize?: number;
345
+ yAxisLabelFontSize?: number;
346
+ xAxisLabelPadding?: number;
347
+ yAxisLabelPadding?: number;
348
+ pointLabelFontSize?: number;
349
+ pointRadius?: number;
350
+ pointTextPadding?: number;
351
+ quadrantInternalBorderStrokeWidth?: number;
352
+ quadrantExternalBorderStrokeWidth?: number;
353
+ useMaxWidth?: boolean;
354
+ quadrantTextTopPadding?: number;
355
+ xAxisPosition?: string;
356
+ yAxisPosition?: string;
357
+ useWidth?: number;
358
+ }
359
+ interface JourneyRuntimeConfig extends MermaidConfigMap {
360
+ diagramMarginX?: number;
361
+ diagramMarginY?: number;
362
+ leftMargin?: number;
363
+ maxLabelWidth?: number;
364
+ width?: number;
365
+ height?: number;
366
+ boxMargin?: number;
367
+ boxTextMargin?: number;
368
+ noteMargin?: number;
369
+ messageMargin?: number;
370
+ messageAlign?: 'left' | 'center' | 'right';
371
+ bottomMarginAdj?: number;
372
+ useMaxWidth?: boolean;
373
+ rightAngles?: boolean;
374
+ taskFontSize?: string | number;
375
+ taskFontFamily?: string;
376
+ taskMargin?: number;
377
+ activationWidth?: number;
378
+ textPlacement?: string;
379
+ actorColours?: string[];
380
+ sectionFills?: string[];
381
+ sectionColours?: string[];
382
+ titleColor?: string;
383
+ titleFontFamily?: string;
384
+ titleFontSize?: string | number;
385
+ }
386
+ interface GanttRuntimeConfig extends MermaidConfigMap {
387
+ displayMode?: string;
388
+ barHeight?: number;
389
+ topAxis?: boolean;
390
+ tickInterval?: string;
391
+ barGap?: number;
392
+ topPadding?: number;
393
+ leftPadding?: number;
394
+ gridLineStartPadding?: number;
395
+ fontSize?: number;
396
+ sectionFontSize?: number;
397
+ numberSectionStyles?: number;
398
+ axisFormat?: string;
399
+ todayMarker?: string;
400
+ weekday?: string;
401
+ }
402
+ /** Wired deterministic mindmap layout fields. */
403
+ interface MindmapRuntimeConfig extends MermaidConfigMap {
404
+ padding?: number;
405
+ maxNodeWidth?: number;
406
+ }
407
+ /** Wired GitGraph presentation and replay fields. */
408
+ interface GitGraphRuntimeConfig extends MermaidConfigMap {
409
+ showBranches?: boolean;
410
+ showCommitLabel?: boolean;
411
+ mainBranchName?: string;
412
+ mainBranchOrder?: number;
413
+ parallelCommits?: boolean;
414
+ rotateCommitLabel?: boolean;
415
+ }
416
+ /**
417
+ * Mermaid's documented classDiagram config shape (wire-or-warn, P4):
418
+ * nodeSpacing/rankSpacing are wired into the ELK layout
419
+ * (src/class/layout.ts resolveClassRenderOptions); every other documented
420
+ * key is accepted for config-shape compatibility and named by verify's
421
+ * INEFFECTIVE_CONFIG lint (the family's config.noopKeys in src/agent/families.ts).
422
+ */
423
+ interface ClassRuntimeConfig extends MermaidConfigMap {
424
+ nodeSpacing?: number;
425
+ rankSpacing?: number;
426
+ titleTopMargin?: number;
427
+ arrowMarkerAbsolute?: boolean;
428
+ dividerMargin?: number;
429
+ padding?: number;
430
+ textHeight?: number;
431
+ defaultRenderer?: string;
432
+ diagramPadding?: number;
433
+ htmlLabels?: boolean;
434
+ hideEmptyMembersBox?: boolean;
435
+ hierarchicalNamespaces?: boolean;
436
+ }
437
+ /**
438
+ * Mermaid's documented er config shape (wire-or-warn, P4): layoutDirection +
439
+ * nodeSpacing/rankSpacing are wired (src/er/layout.ts
440
+ * applyErFrontmatterConfig); the rest emit INEFFECTIVE_CONFIG
441
+ * (the family's config.noopKeys in src/agent/families.ts).
442
+ */
443
+ interface ErRuntimeConfig extends MermaidConfigMap {
444
+ layoutDirection?: string;
445
+ nodeSpacing?: number;
446
+ rankSpacing?: number;
447
+ titleTopMargin?: number;
448
+ diagramPadding?: number;
449
+ minEntityWidth?: number;
450
+ minEntityHeight?: number;
451
+ entityPadding?: number;
452
+ stroke?: string;
453
+ fill?: string;
454
+ fontSize?: number;
455
+ }
456
+ /**
457
+ * Mermaid's documented architecture config shape (wire-or-warn, P4): padding,
458
+ * iconSize, fontSize, nodeSeparation, and idealEdgeLengthMultiplier are wired
459
+ * (src/architecture/config.ts); the fcose simulation knobs — edgeElasticity,
460
+ * numIter, seed, randomize — have no meaning in the deterministic layout and
461
+ * emit INEFFECTIVE_CONFIG (the family's config.noopKeys in
462
+ * src/agent/families.ts).
463
+ */
464
+ interface ArchitectureRuntimeConfig extends MermaidConfigMap {
465
+ padding?: number;
466
+ iconSize?: number;
467
+ fontSize?: number;
468
+ nodeSeparation?: number;
469
+ idealEdgeLengthMultiplier?: number;
470
+ edgeElasticity?: number;
471
+ numIter?: number;
472
+ seed?: number;
473
+ randomize?: boolean;
474
+ }
475
+ /**
476
+ * Mermaid's documented flowchart config shape (wire-or-warn, P4):
477
+ * nodeSpacing/rankSpacing/wrappingWidth are wired
478
+ * (src/flowchart-config.ts resolveFlowchartRenderOptions); every other
479
+ * documented key is accepted for config-shape compatibility and named by
480
+ * verify's INEFFECTIVE_CONFIG lint (the family's config.noopKeys in
481
+ * src/agent/families.ts).
482
+ */
483
+ interface FlowchartRuntimeConfig extends MermaidConfigMap {
484
+ nodeSpacing?: number;
485
+ rankSpacing?: number;
486
+ wrappingWidth?: number;
487
+ titleTopMargin?: number;
488
+ subGraphTitleMargin?: MermaidConfigMap;
489
+ arrowMarkerAbsolute?: boolean;
490
+ diagramPadding?: number;
491
+ htmlLabels?: boolean;
492
+ curve?: string;
493
+ padding?: number;
494
+ defaultRenderer?: string;
495
+ inheritDir?: boolean;
496
+ }
497
+ /**
498
+ * Mermaid's documented sequence config shape (wire-or-warn, P4): actorMargin,
499
+ * width, height, diagramMarginX/Y, messageMargin, noteMargin, activationWidth,
500
+ * and showSequenceNumbers are wired (src/sequence/config.ts
501
+ * resolveSequenceConfig → src/sequence/layout.ts); every other documented key
502
+ * is accepted for config-shape compatibility and named by verify's
503
+ * INEFFECTIVE_CONFIG lint (the family's config.noopKeys in
504
+ * src/agent/families.ts).
505
+ */
506
+ interface SequenceRuntimeConfig extends MermaidConfigMap {
507
+ actorMargin?: number;
508
+ width?: number;
509
+ height?: number;
510
+ diagramMarginX?: number;
511
+ diagramMarginY?: number;
512
+ messageMargin?: number;
513
+ noteMargin?: number;
514
+ activationWidth?: number;
515
+ showSequenceNumbers?: boolean;
516
+ boxMargin?: number;
517
+ boxTextMargin?: number;
518
+ messageAlign?: 'left' | 'center' | 'right';
519
+ mirrorActors?: boolean;
520
+ bottomMarginAdj?: number;
521
+ rightAngles?: boolean;
522
+ wrap?: boolean;
523
+ wrapPadding?: number;
524
+ labelBoxWidth?: number;
525
+ labelBoxHeight?: number;
526
+ hideUnusedParticipants?: boolean;
527
+ forceMenus?: boolean;
528
+ arrowMarkerAbsolute?: boolean;
529
+ noteAlign?: 'left' | 'center' | 'right';
530
+ actorFontSize?: string | number;
531
+ actorFontFamily?: string;
532
+ actorFontWeight?: string | number;
533
+ noteFontSize?: string | number;
534
+ noteFontFamily?: string;
535
+ noteFontWeight?: string | number;
536
+ messageFontSize?: string | number;
537
+ messageFontFamily?: string;
538
+ messageFontWeight?: string | number;
539
+ }
540
+ /** C4 spacing is pixel-space; terminal layout allocates its own cell geometry. */
541
+ interface C4RuntimeConfig extends MermaidConfigMap {
542
+ /** Reflow budget in pixels; minimum legible geometry may exceed it with a diagnostic. */
543
+ maxWidth?: number;
544
+ /** Compact independently measured pixel and terminal layouts. */
545
+ compact?: boolean;
546
+ /** Automatic semantic type legend; authored legend directives remain independent. */
547
+ typeLegend?: boolean;
548
+ diagramMarginX?: number;
549
+ diagramMarginY?: number;
550
+ c4ShapeMargin?: number;
551
+ c4ShapePadding?: number;
552
+ width?: number;
553
+ height?: number;
554
+ boxMargin?: number;
555
+ nextLinePaddingX?: number;
556
+ c4ShapeInRow?: number;
557
+ c4BoundaryInRow?: number;
558
+ wrap?: boolean;
559
+ wrapPadding?: number;
560
+ useMaxWidth?: boolean;
561
+ }
562
+ interface MermaidRuntimeConfig extends MermaidConfigMap {
563
+ theme?: string;
564
+ fontFamily?: string;
565
+ themeVariables?: MermaidThemeVariables;
566
+ flowchart?: FlowchartRuntimeConfig;
567
+ state?: StateRuntimeConfig;
568
+ timeline?: TimelineRuntimeConfig;
569
+ journey?: JourneyRuntimeConfig;
570
+ xyChart?: XyChartRuntimeConfig;
571
+ pie?: PieRuntimeConfig;
572
+ quadrantChart?: QuadrantRuntimeConfig;
573
+ radar?: RadarRuntimeConfig;
574
+ sankey?: SankeyRuntimeConfig;
575
+ c4?: C4RuntimeConfig;
576
+ gantt?: GanttRuntimeConfig;
577
+ sequence?: SequenceRuntimeConfig;
578
+ class?: ClassRuntimeConfig;
579
+ er?: ErRuntimeConfig;
580
+ architecture?: ArchitectureRuntimeConfig;
581
+ mindmap?: MindmapRuntimeConfig;
582
+ gitGraph?: GitGraphRuntimeConfig;
583
+ useMaxWidth?: boolean;
584
+ useWidth?: number;
585
+ themeCSS?: string;
586
+ }
587
+ interface MermaidSourceInitDirective {
588
+ raw: string;
589
+ parsed: MermaidFrontmatterMap;
590
+ }
591
+ interface MermaidSourceComment {
592
+ text: string;
593
+ line: number;
594
+ }
595
+ interface MermaidSourceAccessibility extends MermaidAccessibility {
596
+ }
597
+ interface NormalizedMermaidSource {
598
+ /** Original bytes supplied at the public boundary. */
599
+ originalText: string;
600
+ /** Shared cleanup receipt, with offsets back to the exact input. */
601
+ cleanup?: MermaidCleanup;
602
+ /** Authored grammar view retained when transport decoding changes source. */
603
+ authoredFamilyLines?: string[];
604
+ /** Indentation-preserving grammar view for field-owned XML interpretation. */
605
+ authoredFamilyBody?: string;
606
+ authoredHeader?: string;
607
+ authoredWrapperLength?: number;
608
+ text: string;
609
+ body: string;
610
+ lines: string[];
611
+ /** Line-preserving body presented to family grammars after universal
612
+ * accessibility directives have been removed. */
613
+ familyBody: string;
614
+ /** Trimmed logical family grammar view. */
615
+ familyText: string;
616
+ /** Family grammar view with universal accessibility directives removed. */
617
+ familyLines: string[];
618
+ firstLine: string;
619
+ config: MermaidRuntimeConfig;
620
+ frontmatter: MermaidFrontmatterMap;
621
+ /** Lossless universal wrapper before the family header, when present. */
622
+ wrapperSource?: string;
623
+ initDirectives: MermaidSourceInitDirective[];
624
+ comments: MermaidSourceComment[];
625
+ accessibility: MermaidSourceAccessibility;
626
+ }
627
+
628
+ interface ArchitectureVisualConfig {
629
+ groupHeaderHeight: number;
630
+ groupFontSize: number;
631
+ groupFontWeight: number;
632
+ groupLetterSpacing: number;
633
+ groupFont?: string;
634
+ groupTextTransform?: TextTransform;
635
+ groupPaddingX: number;
636
+ groupPaddingY: number;
637
+ groupLabelPaddingX: number;
638
+ groupCornerRadius: number;
639
+ groupLineWidth: number;
640
+ groupText?: string;
641
+ serviceFontSize: number;
642
+ serviceFontWeight: number;
643
+ serviceLetterSpacing: number;
644
+ serviceTextTransform?: TextTransform;
645
+ servicePaddingX: number;
646
+ servicePaddingY: number;
647
+ serviceCornerRadius: number;
648
+ serviceLineWidth: number;
649
+ serviceText?: string;
650
+ edgeFontSize: number;
651
+ edgeFontWeight: number;
652
+ edgeLetterSpacing: number;
653
+ edgeTextTransform?: TextTransform;
654
+ edgeLineWidth: number;
655
+ edgeBendRadius: number;
656
+ edgeStroke?: string;
657
+ edgeText?: string;
658
+ iconSize: number;
659
+ serviceIconSize: number;
660
+ junctionOuterRadius: number;
661
+ junctionInnerRadius: number;
662
+ groupSurface?: string;
663
+ groupHeaderSurface?: string;
664
+ groupBorder?: string;
665
+ serviceSurface?: string;
666
+ serviceBorder?: string;
667
+ }
668
+ /** Sparse public input merged over the complete request-resolved visual
669
+ * configuration. Callers can change one metric without copying internal
670
+ * defaults; renderers continue to consume ArchitectureVisualConfig only. */
671
+ type ArchitectureVisualOverrides = Partial<ArchitectureVisualConfig>;
672
+
673
+ interface MermaidGraph {
674
+ direction: Direction;
675
+ nodes: Map<string, MermaidNode>;
676
+ edges: MermaidEdge[];
677
+ subgraphs: MermaidSubgraph[];
678
+ classDefs: Map<string, Record<string, string>>;
679
+ /** Maps node/edge IDs to authored class names in assignment order, separated by spaces. */
680
+ classAssignments: Map<string, string>;
681
+ /** Maps node IDs to inline styles (from `style X fill:#f00,stroke:#333`) */
682
+ nodeStyles: Map<string, Record<string, string>>;
683
+ /** Maps edge indices (or 'default') to inline styles from `linkStyle` directives */
684
+ linkStyles: Map<number | 'default', Record<string, string>>;
685
+ /** State diagrams only: `note left|right of X` annotations, in source order.
686
+ * Placed by a post-layout pass (layout-engine placeStateNotes); flowcharts
687
+ * never populate this. */
688
+ stateNotes?: StateNoteSpec[];
689
+ /** Floating annotations remain distinct from states and attached notes;
690
+ * their physical node participates in ordinary scoped layout. */
691
+ floatingStateNotes?: Array<FloatingStateNote & {
692
+ nodeId: string;
693
+ }>;
694
+ }
695
+ /** A state-diagram note (`note left of X : text` / block form). ONE grammar
696
+ * models these for the render parser and the agent body alike —
697
+ * src/state/parse-core.ts (plan §State 1, repo #118). */
698
+ interface StateNoteSpec {
699
+ /** Stable id (`note#<i>` in source order). */
700
+ id: string;
701
+ /** The state (or composite) the note is anchored to. */
702
+ target: string;
703
+ /** Declared side — the placement invariant is that the note box sits on
704
+ * this side of its target's box (upstream's own placement bug: #3782). */
705
+ side: 'left' | 'right';
706
+ /** Note text; block-note body lines are joined with '\n'. */
707
+ text: string;
708
+ textContent?: LabelContent;
709
+ }
710
+ type Direction = 'TD' | 'TB' | 'LR' | 'BT' | 'RL';
711
+ interface MermaidNode {
712
+ id: string;
713
+ label: string;
714
+ labelContent?: LabelContent;
715
+ /** Runtime pixel wrapping; the authored label and its display runs stay intact. */
716
+ labelBlock?: PixelTextBlock;
717
+ shape: NodeShape;
718
+ /** Authored note identity when this physical node is a floating annotation. */
719
+ floatingNoteId?: string;
720
+ /** Mermaid v11 `@{ shape: ... }` semantic shape, normalized to the canonical
721
+ * short name (e.g. 'sl-rect' for `manual-input`). Set only for
722
+ * metadata-declared nodes; `shape` stays the rendering geometry
723
+ * (src/flowchart-shapes.ts is the one mapping table). */
724
+ semanticShape?: string;
725
+ /** The authored v11 shape spelling (alias preserved verbatim, e.g.
726
+ * 'manual-input') — the serializer re-emits exactly this. */
727
+ authoredShape?: string;
728
+ /** True when the label came from a Mermaid markdown string. */
729
+ markdownLabel?: true;
730
+ /** Safe local icon token from v11 node metadata. */
731
+ icon?: string;
732
+ /** Authored image URL retained as inert data; the renderer never fetches it. */
733
+ image?: string;
734
+ iconForm?: 'square' | 'circle' | 'rounded';
735
+ /** Safe inert interaction metadata; callbacks and unsafe schemes never enter SVG. */
736
+ href?: string;
737
+ }
738
+ type NodeShape = 'rectangle' | 'service' | 'rounded' | 'diamond' | 'stadium' | 'circle' | 'ellipse' | 'subroutine' | 'doublecircle' | 'hexagon' | 'cylinder' | 'asymmetric' | 'trapezoid' | 'trapezoid-alt' | 'lean-r' | 'lean-l' | 'state-start' | 'state-end' | 'state-fork' | 'state-join' | 'state-choice' | 'state-history' | 'state-note';
739
+ interface MermaidEdge {
740
+ source: string;
741
+ target: string;
742
+ /** Authored Mermaid v11.6 edge ID (`e1@-->`): stable edge identity.
743
+ * Round-trips verbatim, emitted as the SVG edge's data-id, and accepted
744
+ * by remove_edge/set_label as a target selector. */
745
+ id?: string;
746
+ label?: string;
747
+ labelContent?: LabelContent;
748
+ style: EdgeStyle;
749
+ /** Whether to render a marker at the start (source end) of the edge */
750
+ hasArrowStart: boolean;
751
+ /** Whether to render a marker at the end (target end) of the edge */
752
+ hasArrowEnd: boolean;
753
+ /** Marker shape at start when hasArrowStart=true. Defaults to 'arrow' if undefined. */
754
+ startMarker?: EdgeMarker;
755
+ /** Marker shape at end when hasArrowEnd=true. Defaults to 'arrow' if undefined. */
756
+ endMarker?: EdgeMarker;
757
+ /** Authored v11 edge presentation metadata. */
758
+ curve?: string;
759
+ animate?: boolean;
760
+ animation?: 'fast' | 'slow';
761
+ /** Mermaid link length (rank-distance intent): 1 = base operator, 2 = one
762
+ * extra shaft unit (`--->`, `-..->`, `====>`, `~~~~`), etc. Undefined ≡ 1,
763
+ * so base-form edges serialize byte-identically. Preserved through
764
+ * round-trip; layout honors this conservatively for simple primary-forward
765
+ * no-subgraph DAGs and leaves grouped/cyclic cases to ELK. */
766
+ length?: number;
767
+ }
768
+ /** 'invisible' is Mermaid's `~~~` link: it participates in layout ordering
769
+ * but draws no stroke. */
770
+ type EdgeStyle = 'solid' | 'dotted' | 'thick' | 'invisible';
771
+ type EdgeMarker = 'arrow' | 'circle' | 'cross';
772
+ interface MermaidSubgraph {
773
+ id: string;
774
+ label: string;
775
+ labelContent?: LabelContent;
776
+ /** State diagrams only: a composite state, whose classes' classDef paint
777
+ * is drawn on its body, as Mermaid draws it. */
778
+ stateComposite?: true;
779
+ nodeIds: string[];
780
+ children: MermaidSubgraph[];
781
+ /** Optional direction override for this subgraph's internal layout */
782
+ direction?: Direction;
783
+ /** State diagrams only: this subgraph is one concurrency region of its
784
+ * parent composite (`--` separators, plan §State 2c). Regions draw no box
785
+ * of their own; the renderer draws dashed separators between siblings. */
786
+ concurrencyRegion?: true;
787
+ /** Where the family draws the group's title, from the group's left edge,
788
+ * when something comes first (an architecture group's icon). Defaults to
789
+ * the style's group label padding. */
790
+ titleOffset?: number;
791
+ /** @internal Family projection request; measured text can require more. */
792
+ headerMinHeight?: number;
793
+ }
794
+ interface PositionedDiagram {
795
+ width: number;
796
+ height: number;
797
+ }
798
+ /** Explicit request-boundary data consumed by family layout/render code. */
799
+ interface ResolvedFamilyRenderContext {
800
+ readonly renderOptions: Readonly<RenderOptions>;
801
+ readonly styleFace?: Readonly<InternalStyleFace>;
802
+ /** Actual frozen graphical backend, or the nominal Style backend modeled
803
+ * by an unpainted layout projection. Graphical host policy wins. */
804
+ readonly paintBackendId?: string;
805
+ readonly familyConfig?: Readonly<Record<string, unknown>>;
806
+ readonly familyAppearance?: Readonly<Record<string, unknown>>;
807
+ }
808
+ interface RenderContext<TPositioned extends PositionedDiagram = PositionedDiagram> {
809
+ positioned: TPositioned;
810
+ colors: DiagramColors;
811
+ resolved: ResolvedFamilyRenderContext;
812
+ }
813
+ interface PositionedGraph extends PositionedDiagram {
814
+ /** Deterministic evidence for the graph geometry producer. */
815
+ layoutDecision?: GraphLayoutDecision;
816
+ width: number;
817
+ height: number;
818
+ nodes: PositionedNode[];
819
+ edges: PositionedEdge[];
820
+ groups: PositionedGroup[];
821
+ /** State-diagram notes with final placement (present only when the source
822
+ * graph carried stateNotes). Invariants enforced by construction in
823
+ * placeStateNotes: the box sits on the declared side of its target and
824
+ * overlaps no node/group box. */
825
+ notes?: PositionedStateNote[];
826
+ /** The diagram's frontmatter title, in its band above the graph. */
827
+ title?: PositionedDiagramTitle;
828
+ /** Final hard-geometry certification, after bounded layout alternatives. */
829
+ certification?: LayoutCertificationReceipt;
830
+ }
831
+ /** A placed state-diagram note box. */
832
+ interface PositionedStateNote {
833
+ textBlock?: PixelTextBlock;
834
+ id: string;
835
+ target: string;
836
+ side: 'left' | 'right';
837
+ text: string;
838
+ textContent?: LabelContent;
839
+ x: number;
840
+ y: number;
841
+ width: number;
842
+ height: number;
843
+ }
844
+ interface PositionedNode {
845
+ labelBlock?: PixelTextBlock;
846
+ iconFallbackBlock?: PixelTextBlock;
847
+ id: string;
848
+ label: string;
849
+ labelContent?: LabelContent;
850
+ shape: NodeShape;
851
+ floatingNoteId?: string;
852
+ /** Mermaid v11 semantic shape id when the node was declared via
853
+ * `@{ shape: ... }` metadata — emitted as the SVG data-semantic-shape. */
854
+ semanticShape?: string;
855
+ x: number;
856
+ y: number;
857
+ width: number;
858
+ height: number;
859
+ /** Inline styles resolved from classDef + explicit `style` statements — override theme defaults */
860
+ inlineStyle?: Record<string, string>;
861
+ /** User-assigned Mermaid class names (from `class X myClass` / `:::myClass`). Emitted as SVG CSS classes so external stylesheets can target them. */
862
+ classNames?: string[];
863
+ icon?: string;
864
+ image?: string;
865
+ iconForm?: 'square' | 'circle' | 'rounded';
866
+ href?: string;
867
+ }
868
+ interface PositionedEdge {
869
+ labelBlock?: PixelTextBlock;
870
+ source: string;
871
+ target: string;
872
+ /** Authored Mermaid v11.6 edge ID (`e1@-->`) — SVG identity (data-id). */
873
+ id?: string;
874
+ label?: string;
875
+ labelContent?: LabelContent;
876
+ style: EdgeStyle;
877
+ hasArrowStart: boolean;
878
+ hasArrowEnd: boolean;
879
+ /** Marker shape at start when hasArrowStart=true. Defaults to 'arrow' if undefined. */
880
+ startMarker?: EdgeMarker;
881
+ /** Marker shape at end when hasArrowEnd=true. Defaults to 'arrow' if undefined. */
882
+ endMarker?: EdgeMarker;
883
+ /** Full path including bends — array of {x, y} points */
884
+ points: Point[];
885
+ /** Layout-computed label center position (avoids label-label collisions) */
886
+ labelPosition?: Point;
887
+ /** Inline styles resolved from edge-ID classDef and `linkStyle` directives — override theme defaults */
888
+ inlineStyle?: Record<string, string>;
889
+ /** Authored edge-ID classes for external CSS targeting. */
890
+ classNames?: string[];
891
+ /** Index into MermaidGraph.edges this positioned edge was extracted from */
892
+ edgeIndex?: number;
893
+ /** Authored edge presentation metadata. */
894
+ curve?: string;
895
+ animate?: boolean;
896
+ animation?: 'fast' | 'slow';
897
+ /** Route contract certificate attached by the layout pipeline (docs/design/system/route-contracts.md) */
898
+ routeCertificate?: RouteCertificate;
899
+ }
900
+ type RouteClass = 'primary-forward' | 'feedback' | 'self-loop' | 'container' | 'cross-hierarchy';
901
+ type LayoutRouteClass = RouteClass | 'family-layout';
902
+ /** The four canonical connection points of a shape (Visio connection-point /
903
+ * yFiles port-candidate model). For every Mermaid shape these lie at the
904
+ * bbox side midpoints: the diamond's vertices, the rectangle's side
905
+ * midpoints, and the boundary extremes of circles, stadiums, hexagons and
906
+ * cylinders are the same four points, because each shape is symmetric and
907
+ * inscribed in its bbox. */
908
+ type PortSide = 'N' | 'E' | 'S' | 'W';
909
+ /** Diamond facet-midpoints: the four points halfway along each slanted edge
910
+ * (NE/SE/SW/NW). They lie exactly on the diamond outline and serve as
911
+ * designated attachment points alongside the four cardinal vertices, but are
912
+ * diamond-only — shapePorts() stays four-cardinal for every shape. */
913
+ type DiamondFacet = 'NE' | 'SE' | 'SW' | 'NW';
914
+ /** A port an endpoint may sit on: a cardinal vertex/side-midpoint, or — on a
915
+ * diamond — a facet-midpoint. */
916
+ type AnyPort = PortSide | DiamondFacet;
917
+ type PortSemanticRole = 'flow-source' | 'flow-target' | 'feedback-source' | 'feedback-target' | 'self-loop-source' | 'self-loop-target' | 'container-source' | 'container-target' | 'cross-hierarchy-source' | 'cross-hierarchy-target';
918
+ /** Dynamic port allocation metadata: which side an endpoint semantically uses,
919
+ * its deterministic order among the endpoints on that side, and why it is
920
+ * there. This extends `sourcePort`/`targetPort` without changing their V1
921
+ * vocabulary: exact endpoint ports remain `AnyPort`, while the allocation
922
+ * records side-level slot/role intent for pre-layout and debugging. */
923
+ interface RoutePortAssignment {
924
+ side: PortSide;
925
+ /** 0-based deterministic order along the side (N/S: left→right; E/W: top→bottom). */
926
+ slotIndex: number;
927
+ /** Number of endpoints allocated to this node side. */
928
+ slotCount: number;
929
+ role: PortSemanticRole;
930
+ /** Exact designated port when the final endpoint landed on one. */
931
+ port?: AnyPort;
932
+ }
933
+ interface RouteBlocker {
934
+ kind: 'node' | 'label' | 'channel' | 'span' | 'crossing' | 'port' | 'group-header';
935
+ id: string;
936
+ }
937
+ type RouteInvariant = 'straight' | 'explained-detour' | 'bundle' | 'outer-feedback' | 'feedback-detour' | 'self-loop' | 'container-attach' | 'unverified-shape';
938
+ interface RouteCertificateBase {
939
+ /** Index into MermaidGraph.edges */
940
+ edgeIndex: number;
941
+ routeClass: RouteClass;
942
+ bendCount: number;
943
+ directLaneClear?: boolean;
944
+ directLaneBlockedBy?: RouteBlocker[];
945
+ /** Set when the endpoint sits exactly on a port: a cardinal side-midpoint
946
+ * for every shape, or a diamond facet-midpoint (NE/SE/SW/NW). */
947
+ sourcePort?: AnyPort;
948
+ /** Set when the endpoint sits exactly on a port: a cardinal side-midpoint
949
+ * for every shape, or a diamond facet-midpoint (NE/SE/SW/NW). */
950
+ targetPort?: AnyPort;
951
+ /** Dynamic side/slot/role allocation for the source endpoint. */
952
+ sourcePortAssignment?: RoutePortAssignment;
953
+ /** Dynamic side/slot/role allocation for the target endpoint. */
954
+ targetPortAssignment?: RoutePortAssignment;
955
+ /** Self-loop routes only: the node side the loop departs from and returns
956
+ * to. Part of the self-loop certificate vocabulary (plan §State 6) — the
957
+ * arc leaves and re-enters this side at distinct boundary points. */
958
+ loopSide?: PortSide;
959
+ }
960
+ type StraightRouteCertificate = RouteCertificateBase & {
961
+ invariant: 'straight';
962
+ /** True when the certifying straightener collapsed this route */
963
+ straightened?: true;
964
+ };
965
+ type NonStraightRouteCertificate = RouteCertificateBase & {
966
+ invariant: Exclude<RouteInvariant, 'straight'>;
967
+ /** Non-straight certificates cannot claim a straightening happened. */
968
+ straightened?: never;
969
+ };
970
+ type RouteCertificate = StraightRouteCertificate | NonStraightRouteCertificate;
971
+ type FamilyEdgeRouteCertificate = {
972
+ family: 'class' | 'er';
973
+ edgeIndex: number;
974
+ routeClass: 'family-layout';
975
+ invariant: 'orthogonal-box' | 'unverified-family-route';
976
+ bendCount: number;
977
+ orthogonal: boolean;
978
+ sourceBoundary: boolean;
979
+ targetBoundary: boolean;
980
+ } | {
981
+ family: 'architecture';
982
+ edgeIndex: number;
983
+ routeClass: 'family-layout';
984
+ invariant: 'side-anchored' | 'unverified-family-route';
985
+ bendCount: number;
986
+ orthogonal: boolean;
987
+ sourceSide: 'L' | 'R' | 'T' | 'B';
988
+ targetSide: 'L' | 'R' | 'T' | 'B';
989
+ sourceBoundary: 'item' | 'group';
990
+ targetBoundary: 'item' | 'group';
991
+ sourceAnchored: boolean;
992
+ targetAnchored: boolean;
993
+ /** Authored endpoint half-plane constraints after deterministic placement. */
994
+ placement: 'satisfied' | 'conflicted';
995
+ sourceFacesTarget: boolean;
996
+ targetFacesSource: boolean;
997
+ /** Every route segment clears non-incident service, junction, and group interiors. */
998
+ obstacleFree: boolean;
999
+ } | {
1000
+ family: 'sequence' | 'zenuml';
1001
+ edgeIndex: number;
1002
+ routeClass: 'family-layout';
1003
+ invariant: 'lifeline-message' | 'self-message' | 'unverified-family-route';
1004
+ bendCount: number;
1005
+ horizontal: boolean;
1006
+ sourceLifeline: boolean;
1007
+ targetLifeline: boolean;
1008
+ selfMessage: boolean;
1009
+ };
1010
+ type RegionContainmentCertificate = {
1011
+ family: 'timeline' | 'xychart' | 'pie' | 'quadrant' | 'gantt';
1012
+ elementId: string;
1013
+ routeClass: 'family-layout';
1014
+ invariant: 'timeline-interval' | 'plot-contained' | 'legend-contained' | 'section-contained' | 'unverified-family-layout';
1015
+ /** Node/mark box in layout coordinates; included so cert consumers do not have to join back to nodes. */
1016
+ bounds: {
1017
+ x: number;
1018
+ y: number;
1019
+ w: number;
1020
+ h: number;
1021
+ };
1022
+ /** Center point used by plot/region-mark containment certs. */
1023
+ center: {
1024
+ x: number;
1025
+ y: number;
1026
+ };
1027
+ /** Whether the cert proves the full box or the semantic mark center is contained. */
1028
+ containment: 'bounds' | 'center';
1029
+ withinBounds: boolean;
1030
+ groupId?: string;
1031
+ withinGroup?: boolean;
1032
+ };
1033
+ type EdgeRouteCertificate = RouteCertificate | FamilyEdgeRouteCertificate;
1034
+ type FamilyRouteCertificate = FamilyEdgeRouteCertificate | RegionContainmentCertificate;
1035
+ type LayoutRouteCertificate = EdgeRouteCertificate | RegionContainmentCertificate;
1036
+ interface Point {
1037
+ x: number;
1038
+ y: number;
1039
+ }
1040
+ interface PositionedGroup {
1041
+ /** Authored direct leaf ownership, retained independently of geometry. */
1042
+ nodeIds?: string[];
1043
+ headerHeight?: number;
1044
+ /** @internal Retained family placement request; absent on ordinary graphs. */
1045
+ headerMinHeight?: number;
1046
+ labelBlock?: PixelTextBlock;
1047
+ id: string;
1048
+ label: string;
1049
+ labelContent?: LabelContent;
1050
+ x: number;
1051
+ y: number;
1052
+ width: number;
1053
+ height: number;
1054
+ children: PositionedGroup[];
1055
+ /** State diagrams only: this group is a concurrency region (drawn as dashed
1056
+ * separators between siblings instead of its own box). */
1057
+ concurrencyRegion?: true;
1058
+ /** A State composite's classDef paint (fill, stroke, stroke-width, color),
1059
+ * drawn on its body and outline, and color on its title. */
1060
+ inlineStyle?: Record<string, string>;
1061
+ }
1062
+ type TextTransform = 'uppercase' | 'lowercase' | 'capitalize';
1063
+ /** A deterministic warning for accepted configuration that cannot affect output. */
1064
+ interface ConfigDiagnostic {
1065
+ code: 'INEFFECTIVE_CONFIG';
1066
+ /** Fully-qualified config path, for example `state.titleTopMargin`. */
1067
+ field: string;
1068
+ message: string;
1069
+ }
1070
+ interface GraphLayoutHints {
1071
+ /** Ordered ELK partitions; unlisted nodes use partition zero. These are relative ranks, not pixel coordinates. */
1072
+ ranks?: Record<string, number>;
1073
+ /** Preferred consecutive model order within one container; geometry remains certified. */
1074
+ adjacent?: readonly (readonly string[])[];
1075
+ /** Authored edge IDs or from->to / from->to#k occurrence IDs to prioritize for short routes. */
1076
+ shortEdges?: readonly string[];
1077
+ }
1078
+ interface GraphLayoutOptions {
1079
+ backend: 'elk' | 'agentic';
1080
+ /** Agentic may explicitly fall back to ELK; omitted means none. */
1081
+ fallback?: 'none' | 'elk';
1082
+ }
1083
+ interface RenderOptions {
1084
+ /** Explicit deterministic Flowchart/State placement preferences; included in render receipts. */
1085
+ layoutHints?: GraphLayoutHints;
1086
+ /** Graph geometry producer; omitted preserves the existing ELK pipeline. */
1087
+ graphLayout?: GraphLayoutOptions;
1088
+ /** Require complete native layout evidence, or report explicit limitations. */
1089
+ layoutSafety?: 'report' | 'strict';
1090
+ /** Background color → CSS variable --bg. Default: '#FFFFFF' */
1091
+ bg?: string;
1092
+ /** Foreground / primary text color → CSS variable --fg. Default: '#27272A' */
1093
+ fg?: string;
1094
+ /** Edge/connector color → CSS variable --line */
1095
+ line?: string;
1096
+ /** Arrow heads, highlights → CSS variable --accent */
1097
+ accent?: string;
1098
+ /** Secondary text, edge labels → CSS variable --muted */
1099
+ muted?: string;
1100
+ /** Node/box fill tint → CSS variable --surface */
1101
+ surface?: string;
1102
+ /** Node/group stroke color → CSS variable --border */
1103
+ border?: string;
1104
+ /** Font family for all text. Default: 'Inter' */
1105
+ font?: string;
1106
+ /**
1107
+ * How the diagram looks: a registered style name ('hand-drawn',
1108
+ * 'tufte', or any registered Palette input name like 'dracula'),
1109
+ * an inline StyleSpec, or a STACK
1110
+ * of either merged left-to-right ({ style: ['hand-drawn', 'dracula'] } is
1111
+ * hand-drawn geometry with the dracula palette). A colors-only style is a
1112
+ * palette.
1113
+ * Precedence: defaults < style stack < themeVariables < explicit color
1114
+ * options. Unknown names throw. Unset (or 'crisp') = the default renderer.
1115
+ */
1116
+ style?: StyleInput | StyleInput[];
1117
+ /** Canvas padding in px. Default: 40 */
1118
+ padding?: number;
1119
+ /** Horizontal spacing between sibling nodes. Default: 24 */
1120
+ nodeSpacing?: number;
1121
+ /** Vertical spacing between layers. Default: 40 */
1122
+ layerSpacing?: number;
1123
+ /**
1124
+ * Flowchart-only: measured-pixel auto-wrap budget for node labels (mermaid's
1125
+ * `flowchart.wrappingWidth`). Unset = no wrapping for regular labels;
1126
+ * markdown-string labels always wrap at the upstream default of 200.
1127
+ * Explicit option wins over frontmatter config. Other families ignore it.
1128
+ */
1129
+ wrappingWidth?: number;
1130
+ /** Spacing between disconnected components. Default: nodeSpacing (24) */
1131
+ componentSpacing?: number;
1132
+ /** Render with transparent background (no background style on SVG). Default: false */
1133
+ transparent?: boolean;
1134
+ /** Enable hover tooltips on chart data points (xychart, quadrant, and pie). Default: false */
1135
+ interactive?: boolean;
1136
+ /** Optional explicit drop shadows on node shapes. Default: false */
1137
+ shadow?: boolean;
1138
+ /** Family-specific class-diagram options. */
1139
+ class?: {
1140
+ /** Nest namespace compounds (default true); false lays them out compactly as siblings. */
1141
+ hierarchicalNamespaces?: boolean;
1142
+ };
1143
+ /** Opt-in graphical Kanban layout controls; source order and card membership remain unchanged. */
1144
+ kanban?: {
1145
+ /** Wrap whole columns into rows within this best-effort pixel width, retaining readable column widths. */
1146
+ maxWidth?: number;
1147
+ };
1148
+ /** Opt-in graphical fitting; selected typography and slice meaning are retained. */
1149
+ pie?: {
1150
+ /** Best-effort pixel width; explicit legend placement retains precedence. */
1151
+ maxWidth?: number;
1152
+ };
1153
+ /** Opt-in graphical fitting; authored frames and radar scale meaning are retained. */
1154
+ radar?: {
1155
+ /** Best-effort pixel width with a bounded plot/legend arrangement search. */
1156
+ maxWidth?: number;
1157
+ };
1158
+ /** Family-specific SVG renderer options for architecture-beta diagrams. */
1159
+ architecture?: {
1160
+ visual?: ArchitectureVisualOverrides;
1161
+ };
1162
+ /** Family-specific layout options for timeline diagrams. */
1163
+ timeline?: {
1164
+ /**
1165
+ * Best-effort width budget (px) for HORIZONTAL timelines: when the chart
1166
+ * would exceed it, the per-column wrap caps compress proportionally so
1167
+ * labels wrap tighter instead of the canvas growing (13 periods stop
1168
+ * rendering 2,400+px wide). No-op when the chart already fits — the
1169
+ * default layout stays byte-identical — and ignored in `timeline TD`
1170
+ * mode (vertical timelines are inherently narrow). Unbreakable tokens
1171
+ * and extra-wide section headers can still exceed the budget.
1172
+ */
1173
+ maxWidth?: number;
1174
+ };
1175
+ /** Family-specific SVG renderer options for user-journey diagrams. */
1176
+ journey?: {
1177
+ /**
1178
+ * Draw the experience-curve line connecting score markers in task order.
1179
+ * Default: `true`. Set `false` for the marker-only Mermaid-classic look.
1180
+ */
1181
+ experienceCurve?: boolean;
1182
+ };
1183
+ /** Family-specific SVG renderer options for gantt diagrams. */
1184
+ gantt?: {
1185
+ /**
1186
+ * Draw dependency connectors — deterministic elbow arrows from each
1187
+ * predecessor bar's end to its successor bar's start — for every
1188
+ * `after`/`until` reference. No new Mermaid syntax: the edges come from
1189
+ * the scheduler's dependency graph. Default: `false`.
1190
+ */
1191
+ dependencyArrows?: boolean;
1192
+ /**
1193
+ * Emphasize the critical path from the scheduler's analysis
1194
+ * (GanttScheduleAnalysis.criticalPathTaskIds): stronger stroke on
1195
+ * critical-path bars/milestones and, when `dependencyArrows` is also on,
1196
+ * on the connectors along the path. Default: `false`.
1197
+ */
1198
+ criticalPath?: boolean;
1199
+ };
1200
+ /** Optional Mermaid-style runtime config (analogous to initialize/frontmatter config). */
1201
+ mermaidConfig?: MermaidRuntimeConfig;
1202
+ /**
1203
+ * Receives warnings for explicit config that cannot affect output. Installing
1204
+ * a collector never changes SVG bytes. Without one, explicit ineffective
1205
+ * config is reported through `console.warn` rather than accepted silently.
1206
+ */
1207
+ onConfigDiagnostic?: (diagnostic: ConfigDiagnostic) => void;
1208
+ /**
1209
+ * Whether to embed the Google Fonts `@import` line in the SVG `<style>` block.
1210
+ * Default: `false`; opt in only when the target permits a network font import.
1211
+ *
1212
+ * CLI / PNG paths set `false` explicitly to render offline / CSP-friendly.
1213
+ * The CSS variable `--font` is always emitted on the SVG root regardless,
1214
+ * so the family stays overridable post-render even when the @import is gone.
1215
+ */
1216
+ embedFontImport?: boolean;
1217
+ /**
1218
+ * Compact SVG output. Default `false`. When true:
1219
+ * - Formatting newlines between structural SVG elements are collapsed.
1220
+ * - Geometry, authored text, accessibility content, attribute boundaries,
1221
+ * and whitespace inside `<style>` are preserved exactly.
1222
+ * - `data-*` and `class=` attributes are preserved (agent inspection hooks).
1223
+ *
1224
+ * Useful for the PNG render path (no need for human-readable indentation)
1225
+ * and for bandwidth-sensitive consumers without changing diagram semantics.
1226
+ */
1227
+ compact?: boolean;
1228
+ /**
1229
+ * Namespace prefix for all generated SVG def ids (markers, filters) and
1230
+ * their `url(#…)` references. Omit it to leave ids unprefixed. Set a distinct
1231
+ * non-empty prefix per diagram when rendering
1232
+ * multiple diagrams onto one HTML page so their `<defs>` don't collide
1233
+ * (e.g. two `arrowhead` markers — the browser dedupes by id and the second
1234
+ * diagram's arrows break). `am batch` auto-assigns per-line prefixes.
1235
+ * Must be deterministic per call site to preserve render determinism.
1236
+ */
1237
+ idPrefix?: string;
1238
+ /**
1239
+ * Security posture for the rendered output. Default `'default'`.
1240
+ * `'strict'` (agent / untrusted-diagram mode): guarantees no external-fetch
1241
+ * references in the SVG — forces `embedFontImport` off (no Google Fonts
1242
+ * `@import`), so the SVG renders with no network calls. The `--font` CSS
1243
+ * variable still declares the family. Use `verifyNoExternalRefs(svg)` to
1244
+ * assert the guarantee. Agent/untrusted SVG callers should opt into strict
1245
+ * mode explicitly. See SECURITY.md.
1246
+ */
1247
+ security?: 'default' | 'strict';
1248
+ /**
1249
+ * Explicit "today" for the Gantt `todayMarker` (a date in the diagram's
1250
+ * `dateFormat`, or ISO `YYYY-MM-DD`). Gantt rendering never reads the wall
1251
+ * clock; without this value the today marker is simply not drawn, and
1252
+ * `todayMarker off` disables it even when a clock is supplied.
1253
+ */
1254
+ ganttToday?: string;
1255
+ /**
1256
+ * Deterministic re-roll seed for stochastic styles.
1257
+ * The same source + options + seed always produces identical bytes; it
1258
+ * re-rolls ink wobble only — layout never moves. The crisp path ignores
1259
+ * it. Default 0.
1260
+ */
1261
+ seed?: number;
1262
+ }
1263
+
1264
+ interface TextBreak {
1265
+ readonly kind: 'authored' | 'wrap' | 'hyphen';
1266
+ readonly sourceOffset: number;
1267
+ readonly replacedText?: string;
1268
+ }
1269
+ interface PixelTextLine {
1270
+ readonly runs: readonly DisplayRun[];
1271
+ readonly text: string;
1272
+ readonly width: number;
1273
+ readonly baseline: number;
1274
+ readonly originX: number;
1275
+ /** ASCII tracking and styled runs use these exact allocations during emission. */
1276
+ readonly fragments?: readonly PixelTextFragment[];
1277
+ }
1278
+ interface PixelTextFragment {
1279
+ readonly runIndex: number;
1280
+ readonly text: string;
1281
+ readonly x: number;
1282
+ readonly width: number;
1283
+ }
1284
+ interface PixelTextBlock {
1285
+ readonly unit: 'px';
1286
+ readonly prepared: PreparedDisplayText;
1287
+ readonly text: string;
1288
+ readonly lines: string[];
1289
+ readonly lineBlocks: readonly PixelTextLine[];
1290
+ readonly breaks: readonly TextBreak[];
1291
+ readonly width: number;
1292
+ readonly height: number;
1293
+ readonly lineHeight: number;
1294
+ readonly fontSize: number;
1295
+ readonly fontWeight: number;
1296
+ readonly letterSpacing: number;
1297
+ readonly monospace: boolean;
1298
+ readonly safeFont: boolean;
1299
+ readonly fontFamily?: string;
1300
+ }
1301
+
1302
+ /**
1303
+ * How a context displays a normalized label. In both, `\n` breaks the line
1304
+ * and tag-like text other than the formatting tags (`a<c>d`) is text.
1305
+ * - `formatted`: the formatting tags (<b>/<strong>, <i>/<em>, <u>, <s>/<del>)
1306
+ * style runs and are not text (renderMultilineText's default).
1307
+ * - `literal`: every character is text, formatting tags included (Pie,
1308
+ * Timeline, Gantt, XYChart and GitGraph draw labels as written).
1309
+ */
1310
+ type LabelDisplay = 'formatted' | 'literal';
1311
+
1312
+ interface StyledSegment {
1313
+ text: string;
1314
+ bold: boolean;
1315
+ italic: boolean;
1316
+ underline: boolean;
1317
+ strikethrough: boolean;
1318
+ }
1319
+
1320
+ interface DisplayRun extends Readonly<StyledSegment> {
1321
+ readonly sourceStart: number;
1322
+ readonly sourceEnd: number;
1323
+ readonly clusters?: readonly {
1324
+ text: string;
1325
+ sourceStart: number;
1326
+ sourceEnd: number;
1327
+ }[];
1328
+ }
1329
+ interface PreparedDisplayText {
1330
+ readonly source: string;
1331
+ readonly display: LabelDisplay;
1332
+ readonly transform?: TextTransform;
1333
+ readonly lines: readonly (readonly DisplayRun[])[];
1334
+ readonly lineStarts: readonly number[];
1335
+ }
1336
+ /** A family's public string and the display reading that produced it. The
1337
+ * snapshot prevents a later direct string edit from reusing stale runs. */
1338
+ interface LabelContent {
1339
+ readonly value: string;
1340
+ readonly prepared: PreparedDisplayText;
1341
+ /** Family lexical payload before display/entity normalization, with its
1342
+ * quoting removed. This is not an original diagram source coordinate. */
1343
+ readonly authored?: string;
1344
+ }
1345
+
1346
+ interface StateScope {
1347
+ parent: string;
1348
+ /** Zero-based concurrent region; absent for an ordinary composite. */
1349
+ region?: number;
1350
+ }
1351
+ /** A named annotation in its own scope, with no attachment to a state. Its
1352
+ * identity is in the note namespace, independently of authored state IDs. */
1353
+ interface FloatingStateNote {
1354
+ id: string;
1355
+ text: string;
1356
+ textContent?: LabelContent;
1357
+ scope?: StateScope;
1358
+ }
1359
+
1360
+ export { type ResolvedColors as $, type AnyPort as A, type MermaidNode as B, type ConfigDiagnostic as C, type DiamondFacet as D, type EdgeRouteCertificate as E, type FamilyEdgeRouteCertificate as F, type GraphLayoutDecision as G, type MermaidRuntimeConfig as H, type C4RuntimeConfig as I, DEFAULTS as J, type GitGraphRuntimeConfig as K, type LabelContent as L, type MermaidEdge as M, type NormalizedMermaidSource as N, type GraphLayoutHints as O, type PortSemanticRole as P, type GraphLayoutOptions as Q, type RenderOptions as R, GraphLayoutUnsupportedError as S, type JourneyRuntimeConfig as T, type LayoutCertificationReceipt as U, type MermaidThemeVariables as V, type MindmapRuntimeConfig as W, type PieRuntimeConfig as X, type PositionedGraph as Y, type QuadrantRuntimeConfig as Z, type RadarRuntimeConfig as _, type ArchitectureVisualOverrides as a, type SankeyRuntimeConfig as a0, type StateRuntimeConfig as a1, type TimelineRuntimeConfig as a2, type XyChartRuntimeConfig as a3, fromShikiTheme as a4, inlineResolvedColors as a5, resolveColors as a6, type DisplayRun as b, type FamilyRouteCertificate as c, type LayoutRouteCertificate as d, type LayoutRouteClass as e, type PortSide as f, type PreparedDisplayText as g, type RegionContainmentCertificate as h, type RouteBlocker as i, type RouteCertificate as j, type RouteClass as k, type RoutePortAssignment as l, type Direction as m, type PositionedDiagram as n, type LabelDisplay as o, type PixelTextBlock as p, type DiagramColors as q, type ResolvedFamilyRenderContext as r, type RenderContext as s, type PositionedDiagramTitle as t, type MermaidFrontmatterMap as u, type MermaidConfigMap as v, type MermaidGraph as w, type FloatingStateNote as x, type NodeShape as y, type EdgeStyle as z };