@diagrammo/dgmo 0.45.0 → 0.47.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.
Files changed (250) hide show
  1. package/dist/advanced.cjs +31 -25
  2. package/dist/advanced.d.cts +3 -855
  3. package/dist/advanced.d.ts +3 -855
  4. package/dist/advanced.js +541 -70101
  5. package/dist/analyzer-UYKBXAKR.js +15 -0
  6. package/dist/auto.cjs +500 -341
  7. package/dist/auto.css +342 -159
  8. package/dist/auto.d.cts +10 -8
  9. package/dist/auto.d.ts +10 -8
  10. package/dist/auto.js +373 -265
  11. package/dist/auto.mjs +500 -341
  12. package/dist/block.cjs +31 -25
  13. package/dist/block.js +83 -69411
  14. package/dist/calculator-LDYQCDDY.js +11 -0
  15. package/dist/charts-d3-QOZHKTCT.js +25 -0
  16. package/dist/chunk-2DXMZRWJ.js +800 -0
  17. package/dist/chunk-2LACINWN.js +786 -0
  18. package/dist/chunk-33LCUH4H.js +893 -0
  19. package/dist/chunk-3CIOJ5YJ.js +35 -0
  20. package/dist/chunk-3HDBAXF5.js +86 -0
  21. package/dist/chunk-3JLKYGBQ.js +290 -0
  22. package/dist/chunk-3MQQNXPD.js +415 -0
  23. package/dist/chunk-3R5POCTZ.js +967 -0
  24. package/dist/chunk-3SMGIJDD.js +112 -0
  25. package/dist/chunk-44CM72SQ.js +409 -0
  26. package/dist/chunk-4GRI7MEB.js +1604 -0
  27. package/dist/chunk-4OHACBGX.js +606 -0
  28. package/dist/chunk-5DH3KYFH.js +21 -0
  29. package/dist/chunk-5MLYVTYM.js +76 -0
  30. package/dist/chunk-5QXL4NYS.js +553 -0
  31. package/dist/chunk-5WRI5ZAA.js +31 -0
  32. package/dist/chunk-6EK55ART.js +117 -0
  33. package/dist/chunk-6FZYCKXB.js +2065 -0
  34. package/dist/chunk-6HO5ZTXK.js +277 -0
  35. package/dist/chunk-6KFWC4CO.js +7 -0
  36. package/dist/chunk-6MTWIQVO.js +121 -0
  37. package/dist/chunk-6NYWYNBI.js +329 -0
  38. package/dist/chunk-6SM5NJQH.js +620 -0
  39. package/dist/chunk-725LDASD.js +422 -0
  40. package/dist/chunk-76OWZ3BA.js +130 -0
  41. package/dist/chunk-7JEGTRLD.js +338 -0
  42. package/dist/chunk-A44USUV7.js +923 -0
  43. package/dist/chunk-A4GOY3PE.js +25 -0
  44. package/dist/chunk-A4VFQH5G.js +251 -0
  45. package/dist/chunk-AELOBFW5.js +375 -0
  46. package/dist/chunk-AN2MOO5T.js +522 -0
  47. package/dist/chunk-BMR4CIEO.js +41 -0
  48. package/dist/chunk-BS7SV7C3.js +51 -0
  49. package/dist/chunk-BUPDIHML.js +613 -0
  50. package/dist/chunk-BUVJFRPY.js +887 -0
  51. package/dist/chunk-C3Z4DX3V.js +112 -0
  52. package/dist/chunk-CI2G3OEB.js +1818 -0
  53. package/dist/chunk-CKNVO24D.js +54 -0
  54. package/dist/chunk-CUVHQHZ7.js +391 -0
  55. package/dist/chunk-CXK4DZH3.js +114 -0
  56. package/dist/chunk-DKEPS5LH.js +315 -0
  57. package/dist/chunk-DU7W62N5.js +487 -0
  58. package/dist/chunk-DZAQBW35.js +751 -0
  59. package/dist/chunk-EB6FPQUP.js +316 -0
  60. package/dist/chunk-EMS2SK26.js +376 -0
  61. package/dist/chunk-ERLBPDGU.js +510 -0
  62. package/dist/chunk-EVCVDTXE.js +732 -0
  63. package/dist/chunk-FCIIHT24.js +384 -0
  64. package/dist/chunk-FFUN5D66.js +97 -0
  65. package/dist/chunk-FITOLXSX.js +714 -0
  66. package/dist/chunk-FMDSF3OV.js +68 -0
  67. package/dist/chunk-FNB3PNGF.js +410 -0
  68. package/dist/chunk-G2H74XJZ.js +2104 -0
  69. package/dist/chunk-GMR5MFHJ.js +339 -0
  70. package/dist/chunk-H6PI3KJT.js +305 -0
  71. package/dist/chunk-I46X5VUA.js +59 -0
  72. package/dist/chunk-I5IGB56C.js +255 -0
  73. package/dist/chunk-IH6ZMVQ5.js +3950 -0
  74. package/dist/chunk-IJZFN3HM.js +463 -0
  75. package/dist/chunk-IPWPWM6R.js +3079 -0
  76. package/dist/chunk-IYULMRBE.js +23 -0
  77. package/dist/chunk-IZMRON6C.js +167 -0
  78. package/dist/chunk-J5FIXQRT.js +813 -0
  79. package/dist/chunk-JED6ZDEE.js +73 -0
  80. package/dist/chunk-JEUJOX5X.js +136 -0
  81. package/dist/chunk-JM4LEPY3.js +436 -0
  82. package/dist/chunk-L3UHP6TD.js +101 -0
  83. package/dist/chunk-L66GEFB6.js +524 -0
  84. package/dist/chunk-LIOHW36Z.js +469 -0
  85. package/dist/chunk-LP7EC4MI.js +16 -0
  86. package/dist/chunk-MITI6NOL.js +548 -0
  87. package/dist/chunk-MO5YHHMQ.js +168 -0
  88. package/dist/chunk-MZSBFAPJ.js +885 -0
  89. package/dist/chunk-NNAAJVBU.js +9 -0
  90. package/dist/chunk-NOTA6TEI.js +47 -0
  91. package/dist/chunk-NURGB5Z4.js +335 -0
  92. package/dist/chunk-NX4EQS3U.js +1062 -0
  93. package/dist/chunk-NXMESY4J.js +1 -0
  94. package/dist/chunk-OJR3MQYV.js +1458 -0
  95. package/dist/chunk-OURHMODR.js +454 -0
  96. package/dist/chunk-P235SVAH.js +1057 -0
  97. package/dist/chunk-P4RH4OSP.js +1038 -0
  98. package/dist/chunk-P6T66CCZ.js +226 -0
  99. package/dist/chunk-PBAHEPLQ.js +223 -0
  100. package/dist/chunk-PBHE5UG6.js +1530 -0
  101. package/dist/chunk-PDKUANDZ.js +35 -0
  102. package/dist/chunk-PWIHZ6NJ.js +296 -0
  103. package/dist/chunk-QEBUY5NY.js +1685 -0
  104. package/dist/chunk-QLCCJEJI.js +253 -0
  105. package/dist/chunk-QOOUC2J5.js +52 -0
  106. package/dist/chunk-QYTPPDAO.js +402 -0
  107. package/dist/chunk-R3XI2VC7.js +801 -0
  108. package/dist/chunk-RCERWOJR.js +154 -0
  109. package/dist/chunk-RJE5JTVK.js +362 -0
  110. package/dist/chunk-RTLBSQ3G.js +1155 -0
  111. package/dist/chunk-RUNNI6VE.js +448 -0
  112. package/dist/chunk-RVMRZAPB.js +354 -0
  113. package/dist/chunk-RYEGFMUO.js +955 -0
  114. package/dist/chunk-RZCF2VVM.js +528 -0
  115. package/dist/chunk-SML67VPV.js +1025 -0
  116. package/dist/chunk-SQ7IY53Q.js +44 -0
  117. package/dist/chunk-SQAG3UXH.js +161 -0
  118. package/dist/chunk-SRTU6HMQ.js +1851 -0
  119. package/dist/chunk-T2OE3YQB.js +550 -0
  120. package/dist/chunk-T3UBLACL.js +299 -0
  121. package/dist/chunk-TLVIHFRO.js +296 -0
  122. package/dist/chunk-TYS6CSS5.js +52 -0
  123. package/dist/chunk-U6EQI3U6.js +130 -0
  124. package/dist/chunk-UJ4FJLBF.js +86 -0
  125. package/dist/chunk-ULOEATBZ.js +347 -0
  126. package/dist/chunk-UNCCZ3NU.js +127 -0
  127. package/dist/chunk-USZW2HHU.js +197 -0
  128. package/dist/chunk-UWN33VNX.js +1610 -0
  129. package/dist/chunk-UZ7EZW3B.js +40 -0
  130. package/dist/chunk-VOKGH627.js +37 -0
  131. package/dist/chunk-WBRZJOEC.js +204 -0
  132. package/dist/chunk-WCSOJFU3.js +380 -0
  133. package/dist/chunk-WCT3NYCV.js +160 -0
  134. package/dist/chunk-WVAJFAIA.js +529 -0
  135. package/dist/chunk-X5LCYCL5.js +394 -0
  136. package/dist/chunk-XAKEUMEJ.js +1256 -0
  137. package/dist/chunk-Y2ZE3MSG.js +590 -0
  138. package/dist/chunk-Y3J7VR52.js +646 -0
  139. package/dist/chunk-Y5QGVTVC.js +33 -0
  140. package/dist/chunk-YAA6IID3.js +548 -0
  141. package/dist/chunk-YGJTDXVR.js +692 -0
  142. package/dist/chunk-YRYKTYMQ.js +186 -0
  143. package/dist/chunk-YYVTBZZC.js +61 -0
  144. package/dist/chunk-Z5CGSFJB.js +647 -0
  145. package/dist/chunk-Z72XRXD4.js +787 -0
  146. package/dist/chunk-ZGR7ULFJ.js +978 -0
  147. package/dist/chunk-ZJEL4H2R.js +851 -0
  148. package/dist/chunk-ZO27FGJS.js +554 -0
  149. package/dist/cli.cjs +112 -112
  150. package/dist/collapse-CLPJD2RL.js +11 -0
  151. package/dist/collapse-SLINJQW6.js +9 -0
  152. package/dist/collapse-ZWUFFCK2.js +9 -0
  153. package/dist/compute-G55RG53N.js +8 -0
  154. package/dist/dgmo-router-DZCIDUO5.js +73 -0
  155. package/dist/dimensions-J3FHIMJ6.js +22 -0
  156. package/dist/element.cjs +492 -325
  157. package/dist/element.js +367 -259
  158. package/dist/element.mjs +492 -325
  159. package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
  160. package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
  161. package/dist/index.cjs +34 -28
  162. package/dist/index.d.cts +3 -469
  163. package/dist/index.d.ts +3 -469
  164. package/dist/index.js +137 -69679
  165. package/dist/layout-46N4JJYK.js +17 -0
  166. package/dist/layout-5RA6QWR6.js +26 -0
  167. package/dist/layout-5T6RH5M6.js +14 -0
  168. package/dist/layout-7QXCNOVS.js +13 -0
  169. package/dist/layout-EE6GE46Y.js +17 -0
  170. package/dist/layout-G23F7LDH.js +9 -0
  171. package/dist/layout-HRBZPFCN.js +23 -0
  172. package/dist/layout-HWDSRX5E.js +20 -0
  173. package/dist/layout-HYZPWAK5.js +18 -0
  174. package/dist/layout-N76NR4ZO.js +19 -0
  175. package/dist/layout-OB3RI63S.js +14 -0
  176. package/dist/layout-S2QBYSK2.js +15 -0
  177. package/dist/layout-UM5F4DJB.js +15 -0
  178. package/dist/layout-search-OYV77HHS.js +1655 -0
  179. package/dist/load-data-EHDDZ5ZS.js +8 -0
  180. package/dist/palettes-PRJ2RI6D.js +56 -0
  181. package/dist/parser-2MFP2H2E.js +11 -0
  182. package/dist/parser-3STE62GB.js +21 -0
  183. package/dist/parser-4FL2CMDG.js +18 -0
  184. package/dist/parser-4OGOBJJ4.js +13 -0
  185. package/dist/parser-6BTRLKRZ.js +15 -0
  186. package/dist/parser-AQETEVRW.js +21 -0
  187. package/dist/parser-CFZD5IBL.js +12 -0
  188. package/dist/parser-FUSKFGZN.js +16 -0
  189. package/dist/parser-I6KXEYFK.js +13 -0
  190. package/dist/parser-IXSZZQHY.js +18 -0
  191. package/dist/parser-JAL2HD4I.js +13 -0
  192. package/dist/parser-KNSQSKQO.js +20 -0
  193. package/dist/parser-N5O4IHUN.js +13 -0
  194. package/dist/parser-NGU3ETO6.js +16 -0
  195. package/dist/parser-NRAI6O25.js +19 -0
  196. package/dist/parser-O5J4VBII.js +11 -0
  197. package/dist/parser-OV7NOBW6.js +21 -0
  198. package/dist/parser-PQ3POX45.js +23 -0
  199. package/dist/parser-TFZFBVWN.js +11 -0
  200. package/dist/parser-TRTHDFPP.js +18 -0
  201. package/dist/parser-VQP2UJ6W.js +11 -0
  202. package/dist/parser-XDVELHRK.js +13 -0
  203. package/dist/parser-XKRP7QKP.js +11 -0
  204. package/dist/parser-Y6WTBU76.js +14 -0
  205. package/dist/parser-ZSDPZYQP.js +12 -0
  206. package/dist/renderer-2XQQQ6QR.js +28 -0
  207. package/dist/renderer-5NDVNDAZ.js +26 -0
  208. package/dist/renderer-6EEZHMH4.js +26 -0
  209. package/dist/renderer-6W5462RB.js +43 -0
  210. package/dist/renderer-7MVLWWQD.js +22 -0
  211. package/dist/renderer-AWWAF6XD.js +33 -0
  212. package/dist/renderer-BYCNMBF7.js +34 -0
  213. package/dist/renderer-CLJHQPBJ.js +29 -0
  214. package/dist/renderer-GHPZMFU2.js +15 -0
  215. package/dist/renderer-JGBKUCZD.js +16 -0
  216. package/dist/renderer-KQB7UGDS.js +19 -0
  217. package/dist/renderer-PGX2TKVS.js +24 -0
  218. package/dist/renderer-QIWVHWZO.js +15 -0
  219. package/dist/renderer-RPOA5YPZ.js +35 -0
  220. package/dist/renderer-SMIBCRVB.js +24 -0
  221. package/dist/renderer-T7YKC5VP.js +28 -0
  222. package/dist/renderer-TOCOVLHS.js +37 -0
  223. package/dist/renderer-UWA5XS74.js +39 -0
  224. package/dist/renderer-VACVQYML.js +25 -0
  225. package/dist/renderer-W4M6QLIJ.js +37 -0
  226. package/dist/renderer-WZRREQ2P.js +23 -0
  227. package/dist/renderer-YY2OSF6E.js +27 -0
  228. package/dist/renderer-Z7I3W2PP.js +24 -0
  229. package/dist/renderer-ZGNTUWC4.js +22 -0
  230. package/dist/renderer-ZTR3DER3.js +19 -0
  231. package/dist/renderer-radial-C32GPJQ7.js +21 -0
  232. package/dist/resolver-NOAA7ID7.js +13 -0
  233. package/dist/state-collapse-HCGD6IVJ.js +8 -0
  234. package/dist/state-parser-Z2V23ATR.js +18 -0
  235. package/dist/state-renderer-RFYHSP4K.js +34 -0
  236. package/dist/themes-1-CuKpeH.d.cts +908 -0
  237. package/dist/themes-1-CuKpeH.d.ts +908 -0
  238. package/package.json +1 -1
  239. package/src/auto/index.ts +55 -57
  240. package/src/auto/shared.ts +142 -142
  241. package/src/auto/styles.ts +44 -199
  242. package/src/c4/renderer.ts +2 -2
  243. package/src/element/index.ts +29 -21
  244. package/src/infra/renderer.ts +1 -1
  245. package/src/render.ts +34 -14
  246. package/src/sitemap/renderer.ts +1 -1
  247. package/src/timeline/renderer.ts +1 -1
  248. package/src/utils/hover-styles.ts +6 -1
  249. package/src/utils/legend-d3.ts +1 -4
  250. package/src/utils/legend-svg.ts +1 -1
@@ -0,0 +1,68 @@
1
+ import {
2
+ normalizeName
3
+ } from "./chunk-NOTA6TEI.js";
4
+ import {
5
+ makeDgmoError,
6
+ suggest
7
+ } from "./chunk-CXK4DZH3.js";
8
+
9
+ // src/utils/notes/resolve.ts
10
+ function resolveNotes(notes, targets, diagnostics) {
11
+ const byNodeId = /* @__PURE__ */ new Map();
12
+ if (notes.length === 0) return byNodeId;
13
+ const byNormLabel = /* @__PURE__ */ new Map();
14
+ for (const t of targets) {
15
+ const key = normalizeName(t.label);
16
+ const arr = byNormLabel.get(key);
17
+ if (arr) arr.push(t);
18
+ else byNormLabel.set(key, [t]);
19
+ }
20
+ for (const note of notes) {
21
+ const matches = byNormLabel.get(normalizeName(note.ref));
22
+ if (!matches || matches.length === 0) {
23
+ if (diagnostics) {
24
+ const hint = suggest(
25
+ note.ref,
26
+ targets.map((t) => t.label)
27
+ );
28
+ diagnostics.push(
29
+ makeDgmoError(
30
+ note.lineNumber,
31
+ `Note references unknown node id "${note.ref}".${hint ? " " + hint : ""}`,
32
+ "error"
33
+ )
34
+ );
35
+ }
36
+ continue;
37
+ }
38
+ const target = matches[0];
39
+ if (matches.length > 1 && diagnostics) {
40
+ diagnostics.push(
41
+ makeDgmoError(
42
+ note.lineNumber,
43
+ `Note ref "${note.ref}" matches ${matches.length} nodes; attaching to the first.`,
44
+ "warning"
45
+ )
46
+ );
47
+ }
48
+ if (byNodeId.has(target.id)) {
49
+ if (diagnostics) {
50
+ diagnostics.push(
51
+ makeDgmoError(
52
+ note.lineNumber,
53
+ `Multiple notes on node "${target.label}"; keeping the first.`,
54
+ "warning"
55
+ )
56
+ );
57
+ }
58
+ continue;
59
+ }
60
+ byNodeId.set(target.id, note);
61
+ }
62
+ return byNodeId;
63
+ }
64
+
65
+ export {
66
+ resolveNotes
67
+ };
68
+ //# sourceMappingURL=chunk-FMDSF3OV.js.map
@@ -0,0 +1,410 @@
1
+ import {
2
+ layoutClassDiagram
3
+ } from "./chunk-WBRZJOEC.js";
4
+ import {
5
+ NOTE_BADGE_RADIUS,
6
+ noteConnectorPoints,
7
+ renderNoteBadge,
8
+ renderNoteBox,
9
+ renderNoteConnector
10
+ } from "./chunk-JEUJOX5X.js";
11
+ import {
12
+ extractExportSvg,
13
+ runInExportContainer
14
+ } from "./chunk-Y5QGVTVC.js";
15
+ import {
16
+ EDGE_STROKE_WIDTH,
17
+ NODE_STROKE_WIDTH
18
+ } from "./chunk-3CIOJ5YJ.js";
19
+ import {
20
+ renderIntegratedLegend
21
+ } from "./chunk-PWIHZ6NJ.js";
22
+ import {
23
+ ScaleContext
24
+ } from "./chunk-YYVTBZZC.js";
25
+ import {
26
+ TITLE_FONT_SIZE,
27
+ TITLE_FONT_WEIGHT,
28
+ TITLE_Y
29
+ } from "./chunk-A4GOY3PE.js";
30
+ import {
31
+ FONT_FAMILY
32
+ } from "./chunk-6KFWC4CO.js";
33
+ import {
34
+ LEGEND_HEIGHT
35
+ } from "./chunk-QOOUC2J5.js";
36
+ import {
37
+ measureText
38
+ } from "./chunk-WCT3NYCV.js";
39
+ import {
40
+ contrastText,
41
+ shapeFill
42
+ } from "./chunk-P6T66CCZ.js";
43
+ import {
44
+ parseClassDiagram
45
+ } from "./chunk-RUNNI6VE.js";
46
+
47
+ // src/class/renderer.ts
48
+ import * as d3Selection from "d3-selection";
49
+ import * as d3Shape from "d3-shape";
50
+ var DIAGRAM_PADDING = 20;
51
+ var MAX_SCALE = 3;
52
+ var CLASS_FONT_SIZE = 13;
53
+ var MEMBER_FONT_SIZE = 11;
54
+ var EDGE_LABEL_FONT_SIZE = 11;
55
+ var MEMBER_LINE_HEIGHT = 18;
56
+ var COMPARTMENT_PADDING_Y = 8;
57
+ var MEMBER_PADDING_X = 10;
58
+ function modifierColor(modifier, palette, colorOff) {
59
+ if (colorOff) return palette.textMuted;
60
+ switch (modifier) {
61
+ case "interface":
62
+ return palette.colors.blue;
63
+ case "abstract":
64
+ return palette.colors.purple;
65
+ case "enum":
66
+ return palette.colors.yellow;
67
+ default:
68
+ return palette.colors.teal;
69
+ }
70
+ }
71
+ function nodeFill(palette, isDark, modifier, nodeColor, colorOff, solid) {
72
+ const color = nodeColor ?? modifierColor(modifier, palette, colorOff);
73
+ return shapeFill(palette, color, isDark, {
74
+ ...solid !== void 0 && { solid }
75
+ });
76
+ }
77
+ function nodeStroke(palette, modifier, nodeColor, colorOff) {
78
+ return nodeColor ?? modifierColor(modifier, palette, colorOff);
79
+ }
80
+ var CLASS_TYPE_MAP = {
81
+ class: { label: "Class", colorKey: "teal" },
82
+ abstract: { label: "Abstract", colorKey: "purple" },
83
+ interface: { label: "Interface", colorKey: "blue" },
84
+ enum: { label: "Enum", colorKey: "yellow" }
85
+ };
86
+ var CLASS_TYPE_ORDER = ["class", "abstract", "interface", "enum"];
87
+ function collectClassTypes(parsed) {
88
+ if (parsed.options?.["no-auto-color"]) return [];
89
+ const present = /* @__PURE__ */ new Set();
90
+ for (const c of parsed.classes) {
91
+ if (c.color) continue;
92
+ present.add(c.modifier ?? "class");
93
+ }
94
+ return CLASS_TYPE_ORDER.filter((k) => present.has(k)).map(
95
+ (k) => CLASS_TYPE_MAP[k]
96
+ );
97
+ }
98
+ var LEGEND_GROUP_NAME = "Type";
99
+ function classTypeKey(modifier) {
100
+ return modifier ?? "class";
101
+ }
102
+ function visibilitySymbol(vis) {
103
+ switch (vis) {
104
+ case "public":
105
+ return "+";
106
+ case "private":
107
+ return "-";
108
+ case "protected":
109
+ return "#";
110
+ }
111
+ }
112
+ var lineGenerator = d3Shape.line().x((d) => d.x).y((d) => d.y).curve(d3Shape.curveBasis);
113
+ function isDashedEdge(type) {
114
+ return type === "implements" || type === "depends";
115
+ }
116
+ function markerIdForType(type) {
117
+ switch (type) {
118
+ case "extends":
119
+ return "cd-arrow-inherit";
120
+ case "implements":
121
+ return "cd-arrow-implement";
122
+ case "composes":
123
+ return "cd-arrow-compose";
124
+ case "aggregates":
125
+ return "cd-arrow-aggregate";
126
+ case "depends":
127
+ return "cd-arrow-depend";
128
+ case "associates":
129
+ return "cd-arrow-assoc";
130
+ }
131
+ }
132
+ function isSourceMarker(type) {
133
+ return type === "composes" || type === "aggregates";
134
+ }
135
+ function renderClassDiagram(container, parsed, layout, palette, isDark, onClickItem, exportDims, legendActive, exportMode) {
136
+ d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
137
+ const width = exportDims?.width ?? container.clientWidth;
138
+ const height = exportDims?.height ?? container.clientHeight;
139
+ if (width <= 0 || height <= 0) return;
140
+ const ctx = ScaleContext.identity();
141
+ const sDiagramPadding = ctx.aesthetic(DIAGRAM_PADDING);
142
+ const sClassFontSize = ctx.text(CLASS_FONT_SIZE);
143
+ const sMemberFontSize = ctx.text(MEMBER_FONT_SIZE);
144
+ const sEdgeLabelFontSize = ctx.text(EDGE_LABEL_FONT_SIZE);
145
+ const sEdgeStrokeWidth = ctx.structural(EDGE_STROKE_WIDTH);
146
+ const sNodeStrokeWidth = ctx.structural(NODE_STROKE_WIDTH);
147
+ const sMemberLineHeight = ctx.structural(MEMBER_LINE_HEIGHT);
148
+ const sCompartmentPaddingY = ctx.structural(COMPARTMENT_PADDING_Y);
149
+ const sMemberPaddingX = ctx.structural(MEMBER_PADDING_X);
150
+ const sTitleFontSize = ctx.text(TITLE_FONT_SIZE);
151
+ const sTitleY = ctx.structural(TITLE_Y);
152
+ const sLegendHeight = ctx.structural(LEGEND_HEIGHT);
153
+ const legendEntries = collectClassTypes(parsed);
154
+ const hasLegend = legendEntries.length > 1;
155
+ const showTitle = !!parsed.title && parsed.options["no-title"] !== "on";
156
+ const titleHeight = showTitle ? 40 : 0;
157
+ const LEGEND_FIXED_GAP = 8;
158
+ const sLegendFixedGap = ctx.aesthetic(LEGEND_FIXED_GAP);
159
+ const legendReserve = hasLegend ? sLegendHeight + sLegendFixedGap : 0;
160
+ const diagramW = layout.width;
161
+ const diagramH = layout.height;
162
+ const availH = height - titleHeight - legendReserve;
163
+ const scaleX = (width - sDiagramPadding * 2) / diagramW;
164
+ const scaleY = (availH - sDiagramPadding * 2) / diagramH;
165
+ const scale = Math.min(MAX_SCALE, scaleX, scaleY);
166
+ const scaledW = diagramW * scale;
167
+ const offsetX = (width - scaledW) / 2;
168
+ const offsetY = titleHeight + legendReserve + sDiagramPadding;
169
+ const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("preserveAspectRatio", "xMidYMin meet").style("font-family", FONT_FAMILY);
170
+ if (ctx.isBelowFloor) {
171
+ svg.attr("width", "100%");
172
+ }
173
+ const defs = svg.append("defs");
174
+ const AW = 12;
175
+ const AH = 8;
176
+ defs.append("marker").attr("id", "cd-arrow-inherit").attr("viewBox", `0 0 ${AW} ${AH}`).attr("refX", AW).attr("refY", AH / 2).attr("markerWidth", AW).attr("markerHeight", AH).attr("orient", "auto").append("polygon").attr("points", `0,0 ${AW},${AH / 2} 0,${AH}`).attr("fill", palette.textMuted).attr("stroke", palette.textMuted).attr("stroke-width", 1);
177
+ defs.append("marker").attr("id", "cd-arrow-implement").attr("viewBox", `0 0 ${AW} ${AH}`).attr("refX", AW).attr("refY", AH / 2).attr("markerWidth", AW).attr("markerHeight", AH).attr("orient", "auto").append("polygon").attr("points", `0,0 ${AW},${AH / 2} 0,${AH}`).attr("fill", palette.bg).attr("stroke", palette.textMuted).attr("stroke-width", 1);
178
+ const DW = 12;
179
+ const DH = 8;
180
+ defs.append("marker").attr("id", "cd-arrow-compose").attr("viewBox", `0 0 ${DW} ${DH}`).attr("refX", 0).attr("refY", DH / 2).attr("markerWidth", DW).attr("markerHeight", DH).attr("orient", "auto").append("polygon").attr("points", `${DW / 2},0 ${DW},${DH / 2} ${DW / 2},${DH} 0,${DH / 2}`).attr("fill", palette.textMuted).attr("stroke", palette.textMuted).attr("stroke-width", 1);
181
+ defs.append("marker").attr("id", "cd-arrow-aggregate").attr("viewBox", `0 0 ${DW} ${DH}`).attr("refX", 0).attr("refY", DH / 2).attr("markerWidth", DW).attr("markerHeight", DH).attr("orient", "auto").append("polygon").attr("points", `${DW / 2},0 ${DW},${DH / 2} ${DW / 2},${DH} 0,${DH / 2}`).attr("fill", palette.bg).attr("stroke", palette.textMuted).attr("stroke-width", 1);
182
+ defs.append("marker").attr("id", "cd-arrow-depend").attr("viewBox", `0 0 ${AW} ${AH}`).attr("refX", AW).attr("refY", AH / 2).attr("markerWidth", AW).attr("markerHeight", AH).attr("orient", "auto").append("polyline").attr("points", `0,0 ${AW},${AH / 2} 0,${AH}`).attr("fill", "none").attr("stroke", palette.textMuted).attr("stroke-width", 1.5);
183
+ defs.append("marker").attr("id", "cd-arrow-assoc").attr("viewBox", `0 0 ${AW} ${AH}`).attr("refX", AW).attr("refY", AH / 2).attr("markerWidth", AW).attr("markerHeight", AH).attr("orient", "auto").append("polyline").attr("points", `0,0 ${AW},${AH / 2} 0,${AH}`).attr("fill", "none").attr("stroke", palette.textMuted).attr("stroke-width", 1.5);
184
+ if (showTitle) {
185
+ const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", sTitleY).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).style(
186
+ "cursor",
187
+ onClickItem && parsed.titleLineNumber ? "pointer" : "default"
188
+ ).text(parsed.title);
189
+ if (parsed.titleLineNumber) {
190
+ titleEl.attr("data-line-number", parsed.titleLineNumber);
191
+ if (onClickItem) {
192
+ titleEl.on("click", () => onClickItem(parsed.titleLineNumber)).on("mouseenter", function() {
193
+ d3Selection.select(this).attr("opacity", 0.7);
194
+ }).on("mouseleave", function() {
195
+ d3Selection.select(this).attr("opacity", 1);
196
+ });
197
+ }
198
+ }
199
+ }
200
+ const isLegendExpanded = legendActive !== false;
201
+ if (hasLegend) {
202
+ const legendGroups = [
203
+ {
204
+ name: LEGEND_GROUP_NAME,
205
+ entries: legendEntries.map((entry) => ({
206
+ value: entry.label,
207
+ color: palette.colors[entry.colorKey]
208
+ }))
209
+ }
210
+ ];
211
+ const legendG = svg.append("g").attr("class", "cd-legend").attr("transform", `translate(0,${titleHeight})`);
212
+ renderIntegratedLegend(legendG, {
213
+ groups: legendGroups,
214
+ activeGroup: isLegendExpanded ? LEGEND_GROUP_NAME : null,
215
+ mode: exportMode ? "export" : "preview",
216
+ palette,
217
+ isDark,
218
+ width
219
+ });
220
+ }
221
+ const contentG = svg.append("g").attr("transform", `translate(${offsetX}, ${offsetY}) scale(${scale})`);
222
+ for (const edge of layout.edges) {
223
+ if (edge.points.length < 2) continue;
224
+ const edgeG = contentG.append("g").attr("class", "cd-edge-group").attr("data-line-number", String(edge.lineNumber)).attr("data-source", edge.source).attr("data-target", edge.target);
225
+ const edgeColor = palette.textMuted;
226
+ const markerId = markerIdForType(edge.type);
227
+ const dashed = isDashedEdge(edge.type);
228
+ const sourceMarker = isSourceMarker(edge.type);
229
+ const pathD = lineGenerator(edge.points);
230
+ if (pathD) {
231
+ const pathEl = edgeG.append("path").attr("d", pathD).attr("fill", "none").attr("stroke", edgeColor).attr("stroke-width", sEdgeStrokeWidth).attr("class", "cd-edge");
232
+ if (dashed) {
233
+ pathEl.attr("stroke-dasharray", "6 3");
234
+ }
235
+ if (sourceMarker) {
236
+ pathEl.attr("marker-start", `url(#${markerId})`);
237
+ } else {
238
+ pathEl.attr("marker-end", `url(#${markerId})`);
239
+ }
240
+ }
241
+ if (edge.label) {
242
+ const midIdx = Math.floor(edge.points.length / 2);
243
+ const midPt = edge.points[midIdx];
244
+ const bgW = measureText(edge.label, sEdgeLabelFontSize) + 8;
245
+ const bgH = 16;
246
+ edgeG.append("rect").attr("x", midPt.x - bgW / 2).attr("y", midPt.y - bgH / 2 - 1).attr("width", bgW).attr("height", bgH).attr("rx", 3).attr("fill", palette.bg).attr("opacity", 0.85).attr("class", "cd-edge-label-bg");
247
+ edgeG.append("text").attr("x", midPt.x).attr("y", midPt.y + 4).attr("text-anchor", "middle").attr("fill", edgeColor).attr("font-size", sEdgeLabelFontSize).attr("class", "cd-edge-label").text(edge.label);
248
+ }
249
+ }
250
+ for (const node of layout.nodes) {
251
+ const nodeG = contentG.append("g").attr("transform", `translate(${node.x}, ${node.y})`).attr("class", "cd-class").attr("data-line-number", String(node.lineNumber)).attr("data-node-id", node.id).attr("data-cd-type", classTypeKey(node.modifier));
252
+ if (onClickItem) {
253
+ nodeG.style("cursor", "pointer").on("click", () => {
254
+ onClickItem(node.lineNumber);
255
+ });
256
+ }
257
+ const w = node.width;
258
+ const h = node.height;
259
+ const colorOff = !!parsed.options?.["no-auto-color"];
260
+ const neutralize = hasLegend && !isLegendExpanded && !node.color;
261
+ const effectiveColor = neutralize ? palette.primary : node.color;
262
+ const solid = parsed.options?.["solid-fill"] === "on";
263
+ const fill = nodeFill(
264
+ palette,
265
+ isDark,
266
+ node.modifier,
267
+ effectiveColor,
268
+ colorOff,
269
+ solid
270
+ );
271
+ const stroke = nodeStroke(palette, node.modifier, effectiveColor, colorOff);
272
+ const onFillText = contrastText(
273
+ fill,
274
+ palette.textOnFillLight,
275
+ palette.textOnFillDark
276
+ );
277
+ nodeG.append("rect").attr("x", -w / 2).attr("y", -h / 2).attr("width", w).attr("height", h).attr("rx", 3).attr("ry", 3).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", sNodeStrokeWidth);
278
+ let yPos = -h / 2;
279
+ const headerCenterY = yPos + node.headerHeight / 2;
280
+ if (node.modifier) {
281
+ const badgeText = `\xAB${node.modifier}\xBB`;
282
+ nodeG.append("text").attr("x", 0).attr("y", headerCenterY - 6).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("fill", onFillText).attr("font-size", sMemberFontSize).attr("font-style", "italic").text(badgeText);
283
+ nodeG.append("text").attr("x", 0).attr("y", headerCenterY + 10).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("fill", onFillText).attr("font-size", sClassFontSize).attr("font-weight", "bold").attr("font-style", node.modifier === "abstract" ? "italic" : "normal").text(node.name);
284
+ } else {
285
+ nodeG.append("text").attr("x", 0).attr("y", headerCenterY).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("fill", onFillText).attr("font-size", sClassFontSize).attr("font-weight", "bold").text(node.name);
286
+ }
287
+ yPos += node.headerHeight;
288
+ const isEnum = node.modifier === "enum";
289
+ const fields = node.members.filter((m) => !m.isMethod);
290
+ const methods = node.members.filter((m) => m.isMethod);
291
+ if (isEnum) {
292
+ nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", solid ? onFillText : stroke).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
293
+ let memberY = yPos + sCompartmentPaddingY;
294
+ for (const member of node.members) {
295
+ nodeG.append("text").attr("x", -w / 2 + sMemberPaddingX).attr("y", memberY + sMemberLineHeight / 2).attr("dominant-baseline", "central").attr("fill", onFillText).attr("font-size", sMemberFontSize).text(member.name);
296
+ memberY += sMemberLineHeight;
297
+ }
298
+ } else {
299
+ nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", solid ? onFillText : stroke).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
300
+ if (fields.length > 0) {
301
+ let memberY = yPos + sCompartmentPaddingY;
302
+ for (const field of fields) {
303
+ const vis = visibilitySymbol(field.visibility);
304
+ let text = `${vis} ${field.name}`;
305
+ if (field.type) text += `: ${field.type}`;
306
+ const textEl = nodeG.append("text").attr("x", -w / 2 + sMemberPaddingX).attr("y", memberY + sMemberLineHeight / 2).attr("dominant-baseline", "central").attr("fill", onFillText).attr("font-size", sMemberFontSize);
307
+ if (field.isStatic) {
308
+ textEl.attr("text-decoration", "underline");
309
+ }
310
+ textEl.text(text);
311
+ memberY += sMemberLineHeight;
312
+ }
313
+ }
314
+ yPos += node.fieldsHeight;
315
+ nodeG.append("line").attr("x1", -w / 2).attr("y1", yPos).attr("x2", w / 2).attr("y2", yPos).attr("stroke", solid ? onFillText : stroke).attr("stroke-width", 0.5).attr("stroke-opacity", 0.5);
316
+ if (methods.length > 0) {
317
+ let memberY = yPos + sCompartmentPaddingY;
318
+ for (const method of methods) {
319
+ const vis = visibilitySymbol(method.visibility);
320
+ let text = `${vis} ${method.name}(${method.params ?? ""})`;
321
+ if (method.type) text += `: ${method.type}`;
322
+ const textEl = nodeG.append("text").attr("x", -w / 2 + sMemberPaddingX).attr("y", memberY + sMemberLineHeight / 2).attr("dominant-baseline", "central").attr("fill", onFillText).attr("font-size", sMemberFontSize);
323
+ if (method.isStatic) {
324
+ textEl.attr("text-decoration", "underline");
325
+ }
326
+ textEl.text(text);
327
+ memberY += sMemberLineHeight;
328
+ }
329
+ }
330
+ }
331
+ if (node.note) {
332
+ if (node.note.collapsed) {
333
+ renderNoteBadge(
334
+ nodeG,
335
+ {
336
+ x: w / 2 - NOTE_BADGE_RADIUS - 3,
337
+ y: -h / 2 + NOTE_BADGE_RADIUS + 3
338
+ },
339
+ palette,
340
+ {
341
+ isDark,
342
+ ...node.note.color && { color: node.note.color },
343
+ lineNumber: node.note.lineNumber,
344
+ endLineNumber: node.note.endLineNumber
345
+ }
346
+ );
347
+ } else {
348
+ const [cx1, cy1, cx2, cy2] = noteConnectorPoints(
349
+ { width: w, height: h },
350
+ node.note
351
+ );
352
+ renderNoteConnector(nodeG, cx1, cy1, cx2, cy2, palette);
353
+ renderNoteBox(
354
+ nodeG,
355
+ {
356
+ x: node.note.x,
357
+ y: node.note.y,
358
+ width: node.note.width,
359
+ height: node.note.height
360
+ },
361
+ node.note.lines,
362
+ palette,
363
+ {
364
+ isDark,
365
+ ...node.note.color && { color: node.note.color },
366
+ lineNumber: node.note.lineNumber,
367
+ endLineNumber: node.note.endLineNumber,
368
+ interactive: true
369
+ }
370
+ );
371
+ }
372
+ }
373
+ }
374
+ }
375
+ function renderClassDiagramForExport(content, theme, palette) {
376
+ const parsed = parseClassDiagram(content, palette);
377
+ if (parsed.error || parsed.classes.length === 0) return "";
378
+ const layout = layoutClassDiagram(parsed);
379
+ const isDark = theme === "dark";
380
+ const legendEntries = collectClassTypes(parsed);
381
+ const EXPORT_LEGEND_GAP = 8;
382
+ const legendReserve = legendEntries.length > 1 ? LEGEND_HEIGHT + EXPORT_LEGEND_GAP : 0;
383
+ const exportWidth = layout.width + DIAGRAM_PADDING * 2;
384
+ const exportHeight = layout.height + DIAGRAM_PADDING * 2 + (parsed.title ? 40 : 0) + legendReserve;
385
+ return runInExportContainer(exportWidth, exportHeight, (container) => {
386
+ renderClassDiagram(
387
+ container,
388
+ parsed,
389
+ layout,
390
+ palette,
391
+ isDark,
392
+ void 0,
393
+ {
394
+ width: exportWidth,
395
+ height: exportHeight
396
+ },
397
+ true,
398
+ // legendActive for export
399
+ true
400
+ // exportMode
401
+ );
402
+ return extractExportSvg(container, theme);
403
+ });
404
+ }
405
+
406
+ export {
407
+ renderClassDiagram,
408
+ renderClassDiagramForExport
409
+ };
410
+ //# sourceMappingURL=chunk-FNB3PNGF.js.map