@diagrammo/dgmo 0.46.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 (232) hide show
  1. package/dist/advanced.d.cts +3 -855
  2. package/dist/advanced.d.ts +3 -855
  3. package/dist/advanced.js +541 -70107
  4. package/dist/analyzer-UYKBXAKR.js +15 -0
  5. package/dist/auto.cjs +1 -1
  6. package/dist/auto.js +1 -1
  7. package/dist/auto.mjs +1 -1
  8. package/dist/block.js +83 -69417
  9. package/dist/calculator-LDYQCDDY.js +11 -0
  10. package/dist/charts-d3-QOZHKTCT.js +25 -0
  11. package/dist/chunk-2DXMZRWJ.js +800 -0
  12. package/dist/chunk-2LACINWN.js +786 -0
  13. package/dist/chunk-33LCUH4H.js +893 -0
  14. package/dist/chunk-3CIOJ5YJ.js +35 -0
  15. package/dist/chunk-3HDBAXF5.js +86 -0
  16. package/dist/chunk-3JLKYGBQ.js +290 -0
  17. package/dist/chunk-3MQQNXPD.js +415 -0
  18. package/dist/chunk-3R5POCTZ.js +967 -0
  19. package/dist/chunk-3SMGIJDD.js +112 -0
  20. package/dist/chunk-44CM72SQ.js +409 -0
  21. package/dist/chunk-4GRI7MEB.js +1604 -0
  22. package/dist/chunk-4OHACBGX.js +606 -0
  23. package/dist/chunk-5DH3KYFH.js +21 -0
  24. package/dist/chunk-5MLYVTYM.js +76 -0
  25. package/dist/chunk-5QXL4NYS.js +553 -0
  26. package/dist/chunk-5WRI5ZAA.js +31 -0
  27. package/dist/chunk-6EK55ART.js +117 -0
  28. package/dist/chunk-6FZYCKXB.js +2065 -0
  29. package/dist/chunk-6HO5ZTXK.js +277 -0
  30. package/dist/chunk-6KFWC4CO.js +7 -0
  31. package/dist/chunk-6MTWIQVO.js +121 -0
  32. package/dist/chunk-6NYWYNBI.js +329 -0
  33. package/dist/chunk-6SM5NJQH.js +620 -0
  34. package/dist/chunk-725LDASD.js +422 -0
  35. package/dist/chunk-76OWZ3BA.js +130 -0
  36. package/dist/chunk-7JEGTRLD.js +338 -0
  37. package/dist/chunk-A44USUV7.js +923 -0
  38. package/dist/chunk-A4GOY3PE.js +25 -0
  39. package/dist/chunk-A4VFQH5G.js +251 -0
  40. package/dist/chunk-AELOBFW5.js +375 -0
  41. package/dist/chunk-AN2MOO5T.js +522 -0
  42. package/dist/chunk-BMR4CIEO.js +41 -0
  43. package/dist/chunk-BS7SV7C3.js +51 -0
  44. package/dist/chunk-BUPDIHML.js +613 -0
  45. package/dist/chunk-BUVJFRPY.js +887 -0
  46. package/dist/chunk-C3Z4DX3V.js +112 -0
  47. package/dist/chunk-CI2G3OEB.js +1818 -0
  48. package/dist/chunk-CKNVO24D.js +54 -0
  49. package/dist/chunk-CUVHQHZ7.js +391 -0
  50. package/dist/chunk-CXK4DZH3.js +114 -0
  51. package/dist/chunk-DKEPS5LH.js +315 -0
  52. package/dist/chunk-DU7W62N5.js +487 -0
  53. package/dist/chunk-DZAQBW35.js +751 -0
  54. package/dist/chunk-EB6FPQUP.js +316 -0
  55. package/dist/chunk-EMS2SK26.js +376 -0
  56. package/dist/chunk-ERLBPDGU.js +510 -0
  57. package/dist/chunk-EVCVDTXE.js +732 -0
  58. package/dist/chunk-FCIIHT24.js +384 -0
  59. package/dist/chunk-FFUN5D66.js +97 -0
  60. package/dist/chunk-FITOLXSX.js +714 -0
  61. package/dist/chunk-FMDSF3OV.js +68 -0
  62. package/dist/chunk-FNB3PNGF.js +410 -0
  63. package/dist/chunk-G2H74XJZ.js +2104 -0
  64. package/dist/chunk-GMR5MFHJ.js +339 -0
  65. package/dist/chunk-H6PI3KJT.js +305 -0
  66. package/dist/chunk-I46X5VUA.js +59 -0
  67. package/dist/chunk-I5IGB56C.js +255 -0
  68. package/dist/chunk-IH6ZMVQ5.js +3950 -0
  69. package/dist/chunk-IJZFN3HM.js +463 -0
  70. package/dist/chunk-IPWPWM6R.js +3079 -0
  71. package/dist/chunk-IYULMRBE.js +23 -0
  72. package/dist/chunk-IZMRON6C.js +167 -0
  73. package/dist/chunk-J5FIXQRT.js +813 -0
  74. package/dist/chunk-JED6ZDEE.js +73 -0
  75. package/dist/chunk-JEUJOX5X.js +136 -0
  76. package/dist/chunk-JM4LEPY3.js +436 -0
  77. package/dist/chunk-L3UHP6TD.js +101 -0
  78. package/dist/chunk-L66GEFB6.js +524 -0
  79. package/dist/chunk-LIOHW36Z.js +469 -0
  80. package/dist/chunk-LP7EC4MI.js +16 -0
  81. package/dist/chunk-MITI6NOL.js +548 -0
  82. package/dist/chunk-MO5YHHMQ.js +168 -0
  83. package/dist/chunk-MZSBFAPJ.js +885 -0
  84. package/dist/chunk-NNAAJVBU.js +9 -0
  85. package/dist/chunk-NOTA6TEI.js +47 -0
  86. package/dist/chunk-NURGB5Z4.js +335 -0
  87. package/dist/chunk-NX4EQS3U.js +1062 -0
  88. package/dist/chunk-NXMESY4J.js +1 -0
  89. package/dist/chunk-OJR3MQYV.js +1458 -0
  90. package/dist/chunk-OURHMODR.js +454 -0
  91. package/dist/chunk-P235SVAH.js +1057 -0
  92. package/dist/chunk-P4RH4OSP.js +1038 -0
  93. package/dist/chunk-P6T66CCZ.js +226 -0
  94. package/dist/chunk-PBAHEPLQ.js +223 -0
  95. package/dist/chunk-PBHE5UG6.js +1530 -0
  96. package/dist/chunk-PDKUANDZ.js +35 -0
  97. package/dist/chunk-PWIHZ6NJ.js +296 -0
  98. package/dist/chunk-QEBUY5NY.js +1685 -0
  99. package/dist/chunk-QLCCJEJI.js +253 -0
  100. package/dist/chunk-QOOUC2J5.js +52 -0
  101. package/dist/chunk-QYTPPDAO.js +402 -0
  102. package/dist/chunk-R3XI2VC7.js +801 -0
  103. package/dist/chunk-RCERWOJR.js +154 -0
  104. package/dist/chunk-RJE5JTVK.js +362 -0
  105. package/dist/chunk-RTLBSQ3G.js +1155 -0
  106. package/dist/chunk-RUNNI6VE.js +448 -0
  107. package/dist/chunk-RVMRZAPB.js +354 -0
  108. package/dist/chunk-RYEGFMUO.js +955 -0
  109. package/dist/chunk-RZCF2VVM.js +528 -0
  110. package/dist/chunk-SML67VPV.js +1025 -0
  111. package/dist/chunk-SQ7IY53Q.js +44 -0
  112. package/dist/chunk-SQAG3UXH.js +161 -0
  113. package/dist/chunk-SRTU6HMQ.js +1851 -0
  114. package/dist/chunk-T2OE3YQB.js +550 -0
  115. package/dist/chunk-T3UBLACL.js +299 -0
  116. package/dist/chunk-TLVIHFRO.js +296 -0
  117. package/dist/chunk-TYS6CSS5.js +52 -0
  118. package/dist/chunk-U6EQI3U6.js +130 -0
  119. package/dist/chunk-UJ4FJLBF.js +86 -0
  120. package/dist/chunk-ULOEATBZ.js +347 -0
  121. package/dist/chunk-UNCCZ3NU.js +127 -0
  122. package/dist/chunk-USZW2HHU.js +197 -0
  123. package/dist/chunk-UWN33VNX.js +1610 -0
  124. package/dist/chunk-UZ7EZW3B.js +40 -0
  125. package/dist/chunk-VOKGH627.js +37 -0
  126. package/dist/chunk-WBRZJOEC.js +204 -0
  127. package/dist/chunk-WCSOJFU3.js +380 -0
  128. package/dist/chunk-WCT3NYCV.js +160 -0
  129. package/dist/chunk-WVAJFAIA.js +529 -0
  130. package/dist/chunk-X5LCYCL5.js +394 -0
  131. package/dist/chunk-XAKEUMEJ.js +1256 -0
  132. package/dist/chunk-Y2ZE3MSG.js +590 -0
  133. package/dist/chunk-Y3J7VR52.js +646 -0
  134. package/dist/chunk-Y5QGVTVC.js +33 -0
  135. package/dist/chunk-YAA6IID3.js +548 -0
  136. package/dist/chunk-YGJTDXVR.js +692 -0
  137. package/dist/chunk-YRYKTYMQ.js +186 -0
  138. package/dist/chunk-YYVTBZZC.js +61 -0
  139. package/dist/chunk-Z5CGSFJB.js +647 -0
  140. package/dist/chunk-Z72XRXD4.js +787 -0
  141. package/dist/chunk-ZGR7ULFJ.js +978 -0
  142. package/dist/chunk-ZJEL4H2R.js +851 -0
  143. package/dist/chunk-ZO27FGJS.js +554 -0
  144. package/dist/collapse-CLPJD2RL.js +11 -0
  145. package/dist/collapse-SLINJQW6.js +9 -0
  146. package/dist/collapse-ZWUFFCK2.js +9 -0
  147. package/dist/compute-G55RG53N.js +8 -0
  148. package/dist/dgmo-router-DZCIDUO5.js +73 -0
  149. package/dist/dimensions-J3FHIMJ6.js +22 -0
  150. package/dist/element.cjs +1 -1
  151. package/dist/element.js +1 -1
  152. package/dist/element.mjs +1 -1
  153. package/dist/flowchart-parser-ZNSKIBVR.js +21 -0
  154. package/dist/flowchart-renderer-ZAEOL4DX.js +35 -0
  155. package/dist/index.cjs +3 -3
  156. package/dist/index.d.cts +3 -469
  157. package/dist/index.d.ts +3 -469
  158. package/dist/index.js +137 -69685
  159. package/dist/layout-46N4JJYK.js +17 -0
  160. package/dist/layout-5RA6QWR6.js +26 -0
  161. package/dist/layout-5T6RH5M6.js +14 -0
  162. package/dist/layout-7QXCNOVS.js +13 -0
  163. package/dist/layout-EE6GE46Y.js +17 -0
  164. package/dist/layout-G23F7LDH.js +9 -0
  165. package/dist/layout-HRBZPFCN.js +23 -0
  166. package/dist/layout-HWDSRX5E.js +20 -0
  167. package/dist/layout-HYZPWAK5.js +18 -0
  168. package/dist/layout-N76NR4ZO.js +19 -0
  169. package/dist/layout-OB3RI63S.js +14 -0
  170. package/dist/layout-S2QBYSK2.js +15 -0
  171. package/dist/layout-UM5F4DJB.js +15 -0
  172. package/dist/layout-search-OYV77HHS.js +1655 -0
  173. package/dist/load-data-EHDDZ5ZS.js +8 -0
  174. package/dist/palettes-PRJ2RI6D.js +56 -0
  175. package/dist/parser-2MFP2H2E.js +11 -0
  176. package/dist/parser-3STE62GB.js +21 -0
  177. package/dist/parser-4FL2CMDG.js +18 -0
  178. package/dist/parser-4OGOBJJ4.js +13 -0
  179. package/dist/parser-6BTRLKRZ.js +15 -0
  180. package/dist/parser-AQETEVRW.js +21 -0
  181. package/dist/parser-CFZD5IBL.js +12 -0
  182. package/dist/parser-FUSKFGZN.js +16 -0
  183. package/dist/parser-I6KXEYFK.js +13 -0
  184. package/dist/parser-IXSZZQHY.js +18 -0
  185. package/dist/parser-JAL2HD4I.js +13 -0
  186. package/dist/parser-KNSQSKQO.js +20 -0
  187. package/dist/parser-N5O4IHUN.js +13 -0
  188. package/dist/parser-NGU3ETO6.js +16 -0
  189. package/dist/parser-NRAI6O25.js +19 -0
  190. package/dist/parser-O5J4VBII.js +11 -0
  191. package/dist/parser-OV7NOBW6.js +21 -0
  192. package/dist/parser-PQ3POX45.js +23 -0
  193. package/dist/parser-TFZFBVWN.js +11 -0
  194. package/dist/parser-TRTHDFPP.js +18 -0
  195. package/dist/parser-VQP2UJ6W.js +11 -0
  196. package/dist/parser-XDVELHRK.js +13 -0
  197. package/dist/parser-XKRP7QKP.js +11 -0
  198. package/dist/parser-Y6WTBU76.js +14 -0
  199. package/dist/parser-ZSDPZYQP.js +12 -0
  200. package/dist/renderer-2XQQQ6QR.js +28 -0
  201. package/dist/renderer-5NDVNDAZ.js +26 -0
  202. package/dist/renderer-6EEZHMH4.js +26 -0
  203. package/dist/renderer-6W5462RB.js +43 -0
  204. package/dist/renderer-7MVLWWQD.js +22 -0
  205. package/dist/renderer-AWWAF6XD.js +33 -0
  206. package/dist/renderer-BYCNMBF7.js +34 -0
  207. package/dist/renderer-CLJHQPBJ.js +29 -0
  208. package/dist/renderer-GHPZMFU2.js +15 -0
  209. package/dist/renderer-JGBKUCZD.js +16 -0
  210. package/dist/renderer-KQB7UGDS.js +19 -0
  211. package/dist/renderer-PGX2TKVS.js +24 -0
  212. package/dist/renderer-QIWVHWZO.js +15 -0
  213. package/dist/renderer-RPOA5YPZ.js +35 -0
  214. package/dist/renderer-SMIBCRVB.js +24 -0
  215. package/dist/renderer-T7YKC5VP.js +28 -0
  216. package/dist/renderer-TOCOVLHS.js +37 -0
  217. package/dist/renderer-UWA5XS74.js +39 -0
  218. package/dist/renderer-VACVQYML.js +25 -0
  219. package/dist/renderer-W4M6QLIJ.js +37 -0
  220. package/dist/renderer-WZRREQ2P.js +23 -0
  221. package/dist/renderer-YY2OSF6E.js +27 -0
  222. package/dist/renderer-Z7I3W2PP.js +24 -0
  223. package/dist/renderer-ZGNTUWC4.js +22 -0
  224. package/dist/renderer-ZTR3DER3.js +19 -0
  225. package/dist/renderer-radial-C32GPJQ7.js +21 -0
  226. package/dist/resolver-NOAA7ID7.js +13 -0
  227. package/dist/state-collapse-HCGD6IVJ.js +8 -0
  228. package/dist/state-parser-Z2V23ATR.js +18 -0
  229. package/dist/state-renderer-RFYHSP4K.js +34 -0
  230. package/dist/themes-1-CuKpeH.d.cts +908 -0
  231. package/dist/themes-1-CuKpeH.d.ts +908 -0
  232. package/package.json +1 -1
@@ -0,0 +1,130 @@
1
+ import {
2
+ TITLE_FONT_SIZE,
3
+ TITLE_FONT_WEIGHT,
4
+ TITLE_Y
5
+ } from "./chunk-A4GOY3PE.js";
6
+ import {
7
+ FONT_FAMILY
8
+ } from "./chunk-6KFWC4CO.js";
9
+ import {
10
+ getSeriesColors
11
+ } from "./chunk-P6T66CCZ.js";
12
+
13
+ // src/utils/d3-helpers.ts
14
+ import * as d3Selection from "d3-selection";
15
+ function renderChartTitle(svg, title, titleLineNumber, width, textColor, onClickItem) {
16
+ if (!title) return;
17
+ const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", TITLE_Y).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", TITLE_FONT_WEIGHT).style("cursor", onClickItem && titleLineNumber ? "pointer" : "default").text(title);
18
+ if (titleLineNumber) {
19
+ titleEl.attr("data-line-number", titleLineNumber);
20
+ if (onClickItem) {
21
+ titleEl.on("click", () => onClickItem(titleLineNumber)).on("mouseenter", function() {
22
+ d3Selection.select(this).attr("opacity", 0.7);
23
+ }).on("mouseleave", function() {
24
+ d3Selection.select(this).attr("opacity", 1);
25
+ });
26
+ }
27
+ }
28
+ }
29
+ function initD3Chart(container, palette, exportDims) {
30
+ d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
31
+ const width = exportDims?.width ?? container.clientWidth;
32
+ const height = exportDims?.height ?? container.clientHeight;
33
+ if (width <= 0 || height <= 0) return null;
34
+ const textColor = palette.text;
35
+ const mutedColor = palette.border;
36
+ const bgColor = palette.bg;
37
+ const colors = getSeriesColors(palette);
38
+ const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).style("background", bgColor);
39
+ return { svg, width, height, textColor, mutedColor, bgColor, colors };
40
+ }
41
+ function createTooltip(container, palette, isDark) {
42
+ container.style.position = "relative";
43
+ const existing = container.querySelector("[data-d3-tooltip]");
44
+ if (existing) {
45
+ existing.style.display = "none";
46
+ existing.style.background = palette.surface;
47
+ existing.style.color = palette.text;
48
+ existing.style.boxShadow = isDark ? "0 2px 6px rgba(0,0,0,0.3)" : "0 2px 6px rgba(0,0,0,0.12)";
49
+ return existing;
50
+ }
51
+ const tip = document.createElement("div");
52
+ tip.setAttribute("data-d3-tooltip", "");
53
+ tip.style.position = "absolute";
54
+ tip.style.display = "none";
55
+ tip.style.pointerEvents = "none";
56
+ tip.style.background = palette.surface;
57
+ tip.style.color = palette.text;
58
+ tip.style.padding = "6px 10px";
59
+ tip.style.borderRadius = "4px";
60
+ tip.style.fontSize = "12px";
61
+ tip.style.lineHeight = "1.4";
62
+ tip.style.whiteSpace = "nowrap";
63
+ tip.style.zIndex = "10";
64
+ tip.style.boxShadow = isDark ? "0 2px 6px rgba(0,0,0,0.3)" : "0 2px 6px rgba(0,0,0,0.12)";
65
+ container.appendChild(tip);
66
+ return tip;
67
+ }
68
+ function showTooltip(tooltip, html, event) {
69
+ tooltip.innerHTML = html;
70
+ tooltip.style.display = "block";
71
+ const container = tooltip.parentElement;
72
+ const rect = container.getBoundingClientRect();
73
+ let left = event.clientX - rect.left + 12;
74
+ let top = event.clientY - rect.top - 28;
75
+ const tipW = tooltip.offsetWidth;
76
+ const tipH = tooltip.offsetHeight;
77
+ if (left + tipW > rect.width) left = rect.width - tipW - 4;
78
+ if (top < 0) top = event.clientY - rect.top + 16;
79
+ if (top + tipH > rect.height) top = rect.height - tipH - 4;
80
+ tooltip.style.left = `${left}px`;
81
+ tooltip.style.top = `${top}px`;
82
+ }
83
+ function hideTooltip(tooltip) {
84
+ tooltip.style.display = "none";
85
+ }
86
+ var EXPORT_WIDTH = 1200;
87
+ var EXPORT_HEIGHT = 800;
88
+ async function resolveExportPalette(theme, palette) {
89
+ if (palette) return palette;
90
+ const { getPalette } = await import("./palettes-PRJ2RI6D.js");
91
+ return theme === "dark" ? getPalette("nord").dark : getPalette("nord").light;
92
+ }
93
+ function createExportContainer(width, height) {
94
+ const container = document.createElement("div");
95
+ container.style.width = `${width}px`;
96
+ container.style.height = `${height}px`;
97
+ container.style.position = "absolute";
98
+ container.style.left = "-9999px";
99
+ document.body.appendChild(container);
100
+ return container;
101
+ }
102
+ function finalizeSvgExport(container, theme, palette) {
103
+ const svgEl = container.querySelector("svg");
104
+ if (!svgEl) return "";
105
+ if (theme === "transparent") {
106
+ svgEl.style.background = "none";
107
+ } else if (!svgEl.style.background) {
108
+ svgEl.style.background = palette.bg;
109
+ }
110
+ svgEl.setAttribute("xmlns", "http://www.w3.org/2000/svg");
111
+ svgEl.style.fontFamily = FONT_FAMILY;
112
+ svgEl.querySelectorAll("[data-export-ignore]").forEach((el) => el.remove());
113
+ const svgHtml = svgEl.outerHTML;
114
+ document.body.removeChild(container);
115
+ return svgHtml;
116
+ }
117
+
118
+ export {
119
+ renderChartTitle,
120
+ initD3Chart,
121
+ createTooltip,
122
+ showTooltip,
123
+ hideTooltip,
124
+ EXPORT_WIDTH,
125
+ EXPORT_HEIGHT,
126
+ resolveExportPalette,
127
+ createExportContainer,
128
+ finalizeSvgExport
129
+ };
130
+ //# sourceMappingURL=chunk-U6EQI3U6.js.map
@@ -0,0 +1,86 @@
1
+ import {
2
+ collapseTree
3
+ } from "./chunk-BS7SV7C3.js";
4
+
5
+ // src/org/collapse.ts
6
+ function cloneNode(node) {
7
+ return {
8
+ id: node.id,
9
+ label: node.label,
10
+ metadata: { ...node.metadata },
11
+ children: node.children.map(cloneNode),
12
+ parentId: node.parentId,
13
+ isContainer: node.isContainer,
14
+ lineNumber: node.lineNumber,
15
+ ...node.color !== void 0 && { color: node.color }
16
+ };
17
+ }
18
+ var ORG_SHAPE = {
19
+ getId: (node) => node.id,
20
+ getChildren: (node) => node.children,
21
+ clone: cloneNode,
22
+ setChildren: (node, children) => {
23
+ node.children = children;
24
+ },
25
+ countsAsHidden: (node) => !node.isContainer
26
+ };
27
+ function collapseOrgTree(original, collapsedIds) {
28
+ if (collapsedIds.size === 0) {
29
+ return { parsed: original, hiddenCounts: /* @__PURE__ */ new Map() };
30
+ }
31
+ const { roots, hiddenCounts } = collapseTree(
32
+ original.roots,
33
+ collapsedIds,
34
+ ORG_SHAPE
35
+ );
36
+ return { parsed: { ...original, roots }, hiddenCounts };
37
+ }
38
+ function findNodeWithPath(nodes, targetId, path) {
39
+ for (const node of nodes) {
40
+ if (node.id === targetId) {
41
+ return { node, path };
42
+ }
43
+ const result = findNodeWithPath(node.children, targetId, [
44
+ ...path,
45
+ {
46
+ id: node.id,
47
+ label: node.label,
48
+ lineNumber: node.lineNumber,
49
+ ...node.color !== void 0 && { color: node.color },
50
+ metadata: { ...node.metadata },
51
+ isContainer: node.isContainer
52
+ }
53
+ ]);
54
+ if (result) return result;
55
+ }
56
+ return null;
57
+ }
58
+ function focusOrgTree(original, focusNodeId) {
59
+ const found = findNodeWithPath(original.roots, focusNodeId, []);
60
+ if (!found) return null;
61
+ const isRoot = original.roots.some((r) => r.id === focusNodeId);
62
+ if (isRoot) {
63
+ return {
64
+ parsed: {
65
+ ...original,
66
+ roots: [cloneNode(found.node)]
67
+ },
68
+ ancestorPath: []
69
+ };
70
+ }
71
+ const cloned = cloneNode(found.node);
72
+ cloned.parentId = null;
73
+ return {
74
+ parsed: {
75
+ ...original,
76
+ roots: [cloned]
77
+ },
78
+ ancestorPath: found.path
79
+ };
80
+ }
81
+
82
+ export {
83
+ collapseOrgTree,
84
+ focusOrgTree
85
+ };
86
+ //# sourceMappingURL=chunk-UJ4FJLBF.js.map
@@ -0,0 +1,347 @@
1
+ import {
2
+ buildHeatScale,
3
+ buildLegend,
4
+ compactNumber,
5
+ formatPct,
6
+ resolveCellColor,
7
+ resolveColorMode
8
+ } from "./chunk-IZMRON6C.js";
9
+ import {
10
+ renderIntegratedLegend
11
+ } from "./chunk-PWIHZ6NJ.js";
12
+ import {
13
+ getMaxLegendReservedHeight
14
+ } from "./chunk-YAA6IID3.js";
15
+ import {
16
+ FONT_FAMILY
17
+ } from "./chunk-6KFWC4CO.js";
18
+ import {
19
+ LEGEND_GROUP_GAP
20
+ } from "./chunk-QOOUC2J5.js";
21
+ import {
22
+ measureText
23
+ } from "./chunk-WCT3NYCV.js";
24
+ import {
25
+ contrastText,
26
+ getSeriesColors
27
+ } from "./chunk-P6T66CCZ.js";
28
+ import {
29
+ tagAttrKey
30
+ } from "./chunk-QLCCJEJI.js";
31
+
32
+ // src/treemap/renderer-radial.ts
33
+ import * as d3Selection from "d3-selection";
34
+ import { arc as d3arc } from "d3-shape";
35
+
36
+ // src/treemap/layout-radial.ts
37
+ import {
38
+ hierarchy,
39
+ partition
40
+ } from "d3-hierarchy";
41
+ function toDatum(node) {
42
+ if (node.children.length === 0) {
43
+ return {
44
+ ref: node,
45
+ label: node.label,
46
+ value: node.value ?? 0,
47
+ ...node.heat !== void 0 && { heat: node.heat },
48
+ lineNumber: node.lineNumber
49
+ };
50
+ }
51
+ return {
52
+ ref: node,
53
+ label: node.label,
54
+ ...node.heat !== void 0 && { heat: node.heat },
55
+ lineNumber: node.lineNumber,
56
+ children: node.children.map((c) => toDatum(c))
57
+ };
58
+ }
59
+ function datumHeat(node) {
60
+ if (node.data.heat !== void 0) return node.data.heat;
61
+ const xs = [];
62
+ for (const l of node.leaves()) {
63
+ if (l.data.heat !== void 0) xs.push(l.data.heat);
64
+ }
65
+ if (xs.length === 0) return void 0;
66
+ return xs.reduce((a, b) => a + b, 0) / xs.length;
67
+ }
68
+ function defaultDiscRadius(radius, treeDepth) {
69
+ const frac = radius * 0.32;
70
+ const share = radius / (Math.max(1, treeDepth) + 1);
71
+ return Math.min(frac, share);
72
+ }
73
+ function layoutTreemapRadial(roots, opts) {
74
+ const maxDepth = opts.maxDepth ?? Infinity;
75
+ const radius = Math.max(1, opts.radius);
76
+ const rootDatum = {
77
+ label: "__root",
78
+ children: roots.map((r) => toDatum(r))
79
+ };
80
+ const h = hierarchy(rootDatum).sum(
81
+ (d) => d.children?.length ? 0 : d.value ?? 0
82
+ );
83
+ const total = h.value ?? 0;
84
+ if (total <= 0) {
85
+ return {
86
+ cells: [],
87
+ total: 0,
88
+ discRadius: opts.discRadius ?? defaultDiscRadius(radius, 1),
89
+ maxDepthReached: 0,
90
+ isEmpty: true
91
+ };
92
+ }
93
+ const hroot = partition().size([2 * Math.PI, 1])(h);
94
+ const treeDepth = hroot.height;
95
+ const discRadius = Math.min(
96
+ radius - 1,
97
+ opts.discRadius ?? defaultDiscRadius(radius, treeDepth)
98
+ );
99
+ const ringSpan = Math.max(1, radius - discRadius);
100
+ const ringWidth = ringSpan / Math.max(1, treeDepth);
101
+ (hroot.children ?? []).forEach((top, i) => {
102
+ top.each((d) => {
103
+ d._topIndex = i;
104
+ });
105
+ });
106
+ const cells = [];
107
+ let maxDepthReached = 0;
108
+ for (const d of hroot.descendants()) {
109
+ if (d.depth === 0) continue;
110
+ if (d.depth > maxDepth) continue;
111
+ const hasChildren = !!d.children && d.children.length > 0;
112
+ if (d.depth > maxDepthReached) maxDepthReached = d.depth;
113
+ const path = [];
114
+ let p = d;
115
+ while (p && p.depth > 0) {
116
+ path.unshift(p.data.label);
117
+ p = p.parent;
118
+ }
119
+ const innerR = discRadius + (d.depth - 1) * ringWidth;
120
+ const outerR = discRadius + d.depth * ringWidth;
121
+ const heatVal = datumHeat(d);
122
+ cells.push({
123
+ node: d.data.ref ?? null,
124
+ label: d.data.label,
125
+ startAngle: d.x0,
126
+ endAngle: d.x1,
127
+ innerR,
128
+ outerR,
129
+ depth: d.depth,
130
+ value: d.value ?? 0,
131
+ isContainer: hasChildren,
132
+ isCollapsed: false,
133
+ topIndex: d._topIndex ?? 0,
134
+ pctOfRoot: total > 0 ? (d.value ?? 0) / total : 0,
135
+ pctOfParent: d.parent && (d.parent.value ?? 0) > 0 ? (d.value ?? 0) / (d.parent.value ?? 1) : 1,
136
+ ...heatVal !== void 0 && { heat: heatVal },
137
+ path,
138
+ ...d.data.lineNumber !== void 0 && { lineNumber: d.data.lineNumber }
139
+ });
140
+ }
141
+ return { cells, total, discRadius, maxDepthReached, isEmpty: false };
142
+ }
143
+
144
+ // src/treemap/renderer-radial.ts
145
+ var PADDING = 12;
146
+ var LEGEND_POSITION = {
147
+ placement: "top-center",
148
+ titleRelation: "below-title"
149
+ };
150
+ var MIN_LABEL_SWEEP = 6 * Math.PI / 180;
151
+ var MIN_LABEL_FS = 8;
152
+ function renderTreemapRadialForExport(container, parsed, palette, isDark, exportDims, options) {
153
+ renderTreemapRadial(container, parsed, palette, isDark, exportDims, {
154
+ exportMode: true,
155
+ ...options
156
+ });
157
+ }
158
+ function renderTreemapRadial(container, parsed, palette, isDark, exportDims, options = {}) {
159
+ if (parsed.error || parsed.roots.length === 0) return;
160
+ void isDark;
161
+ d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
162
+ const width = exportDims?.width ?? container.clientWidth;
163
+ const height = exportDims?.height ?? container.clientHeight;
164
+ if (width <= 0 || height <= 0) return;
165
+ const mode = resolveColorMode(parsed, options.colorMode);
166
+ const opts = parsed.options;
167
+ const exportMode = options.exportMode ?? false;
168
+ const seriesColors = getSeriesColors(palette);
169
+ const heat = buildHeatScale(parsed, palette);
170
+ const legend = !opts.noLegend ? buildLegend(mode, parsed, heat, seriesColors, options.colorOffset ?? 0) : null;
171
+ const legendReserve = legend ? getMaxLegendReservedHeight(
172
+ { groups: legend.groups, position: LEGEND_POSITION, mode: "preview" },
173
+ width
174
+ ) + LEGEND_GROUP_GAP : 0;
175
+ const areaY = legendReserve + PADDING;
176
+ const areaW = Math.max(1, width - PADDING * 2);
177
+ const areaH = Math.max(1, height - areaY - PADDING);
178
+ const radius = Math.max(1, Math.min(areaW, areaH) / 2 - PADDING);
179
+ const cx = width / 2;
180
+ const cy = areaY + areaH / 2;
181
+ const layout = layoutTreemapRadial(parsed.roots, {
182
+ radius,
183
+ ...options.maxDepth !== void 0 && { maxDepth: options.maxDepth }
184
+ });
185
+ const svg = d3Selection.select(container).append("svg").attr("width", width).attr("height", height).attr("viewBox", `0 0 ${width} ${height}`).attr("preserveAspectRatio", "xMidYMin meet").attr("xmlns", "http://www.w3.org/2000/svg").attr("class", "dgmo-treemap dgmo-treemap-radial").style("font-family", FONT_FAMILY);
186
+ const defs = svg.append("defs");
187
+ svg.append("rect").attr("width", width).attr("height", height).attr("fill", palette.bg);
188
+ const plot = svg.append("g").attr("class", "dgmo-treemap-cells").attr("transform", `translate(${cx},${cy})`);
189
+ const activeGroup = parsed.tagGroups.length > 0 ? parsed.tagGroups[0].name : null;
190
+ const rootIndexByLabel = new Map(parsed.roots.map((r, i) => [r.label, i]));
191
+ const colorCtx = {
192
+ mode,
193
+ heat,
194
+ tagGroups: parsed.tagGroups,
195
+ activeGroup,
196
+ rootIndexByLabel,
197
+ seriesColors,
198
+ colorOffset: options.colorOffset ?? 0,
199
+ bg: palette.bg
200
+ };
201
+ const arcGen = d3arc().startAngle((c) => c.startAngle).endAngle((c) => c.endAngle).innerRadius((c) => c.innerR).outerRadius((c) => c.outerR).padAngle(4e-3).padRadius(radius);
202
+ let labelSeq = 0;
203
+ if (!layout.isEmpty) {
204
+ for (const cell of layout.cells) {
205
+ const fill = resolveCellColor(cell, colorCtx);
206
+ const g = plot.append("g").attr("class", "dgmo-treemap-cell").attr("data-node-path", cell.path.join(" / "));
207
+ if (cell.lineNumber !== void 0) {
208
+ g.attr("data-line-number", cell.lineNumber);
209
+ }
210
+ if (cell.heat !== void 0) g.attr("data-heat", cell.heat);
211
+ if (cell.node && activeGroup) {
212
+ const key = tagAttrKey(activeGroup);
213
+ const tagVal = cell.node.metadata[key];
214
+ if (tagVal) g.attr(`data-tag-${key}`, tagVal);
215
+ }
216
+ g.append("path").attr(
217
+ "class",
218
+ cell.isContainer ? "dgmo-treemap-arc branch" : "dgmo-treemap-arc"
219
+ ).attr("d", arcGen(cell) ?? "").attr("fill", fill).attr("stroke", palette.bg).attr("stroke-width", 1);
220
+ drawArcLabel(
221
+ g,
222
+ defs,
223
+ `dgmo-arc-lbl-${labelSeq++}`,
224
+ cell,
225
+ opts,
226
+ palette,
227
+ fill
228
+ );
229
+ }
230
+ }
231
+ drawCenterDisc(
232
+ plot,
233
+ parsed,
234
+ layout.discRadius,
235
+ layout.total,
236
+ layout.isEmpty,
237
+ palette
238
+ );
239
+ if (legend) {
240
+ const legendG = svg.append("g").attr("class", "dgmo-treemap-legend").attr("transform", "translate(0, 0)");
241
+ renderIntegratedLegend(legendG, {
242
+ groups: legend.groups,
243
+ palette: {
244
+ bg: palette.bg,
245
+ surface: palette.surface,
246
+ text: palette.text,
247
+ textMuted: palette.textMuted,
248
+ primary: palette.primary
249
+ },
250
+ isDark,
251
+ width,
252
+ mode: exportMode ? "export" : "preview",
253
+ position: LEGEND_POSITION,
254
+ activeGroup: legend.activeGroup,
255
+ showInactivePills: !exportMode,
256
+ showEmptyGroups: !exportMode
257
+ });
258
+ }
259
+ }
260
+ function drawCenterDisc(plot, parsed, discRadius, total, isEmpty, palette) {
261
+ const disc = plot.append("g").attr("class", "dgmo-treemap-disc");
262
+ disc.append("circle").attr("r", discRadius).attr("fill", palette.surface).attr("stroke", palette.bg).attr("stroke-width", 1);
263
+ const ink = contrastText(
264
+ palette.surface,
265
+ palette.textOnFillLight,
266
+ palette.textOnFillDark
267
+ );
268
+ const maxW = discRadius * 1.7;
269
+ if (isEmpty) {
270
+ disc.append("text").attr("class", "dgmo-treemap-empty").attr("text-anchor", "middle").attr("y", 4).attr("fill", ink).attr("font-size", clampFs(13, discRadius)).text(clip("No values to chart", maxW, 13));
271
+ return;
272
+ }
273
+ const title = parsed.title ?? "";
274
+ const totalStr = compactNumber(total);
275
+ const titleFs = clampFs(15, discRadius);
276
+ const totalFs = clampFs(22, discRadius);
277
+ if (title) {
278
+ const t = disc.append("text").attr("class", "dgmo-treemap-disc-title").attr("text-anchor", "middle").attr("y", -4).attr("fill", ink).attr("font-size", titleFs).attr("font-weight", 600).text(clip(title, maxW, titleFs));
279
+ if (parsed.titleLineNumber !== null) {
280
+ t.attr("data-line-number", parsed.titleLineNumber);
281
+ }
282
+ }
283
+ disc.append("text").attr("class", "dgmo-treemap-disc-total").attr("text-anchor", "middle").attr("y", title ? titleFs : 8).attr("fill", ink).attr("font-size", totalFs).attr("font-weight", 700).text(clip(totalStr, maxW, totalFs));
284
+ }
285
+ function drawArcLabel(g, defs, pathId, cell, opts, palette, fill) {
286
+ const sweep = cell.endAngle - cell.startAngle;
287
+ if (sweep < MIN_LABEL_SWEEP) return;
288
+ const ringThickness = cell.outerR - cell.innerR;
289
+ if (ringThickness < 10) return;
290
+ const ink = contrastText(
291
+ fill,
292
+ palette.textOnFillLight,
293
+ palette.textOnFillDark
294
+ );
295
+ const rMid = (cell.innerR + cell.outerR) / 2;
296
+ const maxFs = clampFs(13, ringThickness);
297
+ const valParts = [
298
+ opts.noValues ? "" : compactNumber(cell.value),
299
+ opts.noPercent ? "" : formatPct(cell.pctOfRoot)
300
+ ].filter(Boolean);
301
+ const valStr = valParts.join(" \xB7 ");
302
+ const full = valStr ? `${cell.label} ${valStr}` : cell.label;
303
+ const availLen = sweep * rMid * 0.94;
304
+ let fs = maxFs;
305
+ const wAtMax = measureText(full, maxFs);
306
+ if (wAtMax > availLen) {
307
+ fs = Math.max(MIN_LABEL_FS, Math.floor(maxFs * availLen / wAtMax));
308
+ }
309
+ const text = clip(full, availLen, fs);
310
+ if (!text) return;
311
+ drawCurvedLabel(g, defs, pathId, cell, rMid, fs, text, ink);
312
+ }
313
+ function drawCurvedLabel(g, defs, pathId, cell, rMid, fs, text, ink) {
314
+ const mid = (cell.startAngle + cell.endAngle) / 2;
315
+ const bottom = mid > Math.PI / 2 && mid < 3 * Math.PI / 2;
316
+ const rPath = bottom ? rMid + fs * 0.32 : rMid - fs * 0.32;
317
+ const [a0, a1] = bottom ? [cell.endAngle, cell.startAngle] : [cell.startAngle, cell.endAngle];
318
+ const p0x = Math.sin(a0) * rPath;
319
+ const p0y = -Math.cos(a0) * rPath;
320
+ const p1x = Math.sin(a1) * rPath;
321
+ const p1y = -Math.cos(a1) * rPath;
322
+ const sweepFlag = bottom ? 0 : 1;
323
+ const d = `M ${p0x.toFixed(2)} ${p0y.toFixed(2)} A ${rPath.toFixed(2)} ${rPath.toFixed(2)} 0 0 ${sweepFlag} ${p1x.toFixed(2)} ${p1y.toFixed(2)}`;
324
+ defs.append("path").attr("id", pathId).attr("d", d);
325
+ g.append("text").attr("class", "dgmo-treemap-label").attr("font-size", fs).attr("font-weight", 600).attr("fill", ink).append("textPath").attr("href", `#${pathId}`).attr("startOffset", "50%").attr("text-anchor", "middle").text(text);
326
+ }
327
+ function clampFs(base, thickness) {
328
+ return Math.max(8, Math.min(base, Math.round(thickness * 0.9)));
329
+ }
330
+ function clip(s, maxWidth, fs) {
331
+ if (measureText(s, fs) <= maxWidth) return s;
332
+ let lo = 0;
333
+ let hi = s.length;
334
+ while (lo < hi) {
335
+ const mid = Math.ceil((lo + hi) / 2);
336
+ if (measureText(s.slice(0, mid) + "\u2026", fs) <= maxWidth) lo = mid;
337
+ else hi = mid - 1;
338
+ }
339
+ return lo <= 0 ? "" : s.slice(0, lo) + "\u2026";
340
+ }
341
+
342
+ export {
343
+ layoutTreemapRadial,
344
+ renderTreemapRadialForExport,
345
+ renderTreemapRadial
346
+ };
347
+ //# sourceMappingURL=chunk-ULOEATBZ.js.map
@@ -0,0 +1,127 @@
1
+ import {
2
+ collapseTree,
3
+ collectTreeIds
4
+ } from "./chunk-BS7SV7C3.js";
5
+
6
+ // src/utils/collapse-engine/tree-edges.ts
7
+ function buildParentMap(roots, shape) {
8
+ const map = /* @__PURE__ */ new Map();
9
+ const walk = (nodes) => {
10
+ for (const node of nodes) {
11
+ for (const child of shape.getChildren(node)) {
12
+ map.set(shape.getId(child), shape.getId(node));
13
+ walk([child]);
14
+ }
15
+ }
16
+ };
17
+ walk(roots);
18
+ return map;
19
+ }
20
+ function findVisibleAncestor(nodeId, parentMap, visibleIds, collapsedIds) {
21
+ let current = nodeId;
22
+ while (true) {
23
+ const parentId = parentMap.get(current);
24
+ if (!parentId) return null;
25
+ if (visibleIds.has(parentId) && collapsedIds.has(parentId)) {
26
+ return parentId;
27
+ }
28
+ current = parentId;
29
+ }
30
+ }
31
+ function reterminateEdges(originalRoots, prunedRoots, edges, collapsedIds, nodeShape, edgeShape) {
32
+ const visibleIds = collectTreeIds(prunedRoots, nodeShape);
33
+ const parentMap = buildParentMap(originalRoots, nodeShape);
34
+ const result = [];
35
+ for (const edge of edges) {
36
+ let sourceId = edgeShape.getSource(edge);
37
+ let targetId = edgeShape.getTarget(edge);
38
+ const sourceVisible = visibleIds.has(sourceId);
39
+ const targetVisible = visibleIds.has(targetId);
40
+ if (sourceVisible && targetVisible) {
41
+ result.push(edgeShape.withEndpoints(edge, sourceId, targetId));
42
+ continue;
43
+ }
44
+ if (!sourceVisible) {
45
+ const ancestor = findVisibleAncestor(
46
+ sourceId,
47
+ parentMap,
48
+ visibleIds,
49
+ collapsedIds
50
+ );
51
+ if (!ancestor) continue;
52
+ sourceId = ancestor;
53
+ }
54
+ if (!targetVisible) {
55
+ const ancestor = findVisibleAncestor(
56
+ targetId,
57
+ parentMap,
58
+ visibleIds,
59
+ collapsedIds
60
+ );
61
+ if (!ancestor) continue;
62
+ targetId = ancestor;
63
+ }
64
+ if (sourceId === targetId) continue;
65
+ result.push(edgeShape.withEndpoints(edge, sourceId, targetId));
66
+ }
67
+ return result;
68
+ }
69
+
70
+ // src/sitemap/collapse.ts
71
+ function cloneNode(node) {
72
+ return {
73
+ id: node.id,
74
+ label: node.label,
75
+ metadata: { ...node.metadata },
76
+ children: node.children.map(cloneNode),
77
+ parentId: node.parentId,
78
+ isContainer: node.isContainer,
79
+ lineNumber: node.lineNumber,
80
+ ...node.color !== void 0 && { color: node.color }
81
+ };
82
+ }
83
+ var SITEMAP_SHAPE = {
84
+ getId: (node) => node.id,
85
+ getChildren: (node) => node.children,
86
+ clone: cloneNode,
87
+ setChildren: (node, children) => {
88
+ node.children = children;
89
+ },
90
+ countsAsHidden: (node) => !node.isContainer
91
+ };
92
+ var SITEMAP_EDGE_SHAPE = {
93
+ getSource: (edge) => edge.sourceId,
94
+ getTarget: (edge) => edge.targetId,
95
+ withEndpoints: (edge, sourceId, targetId) => ({
96
+ ...edge,
97
+ sourceId,
98
+ targetId
99
+ })
100
+ };
101
+ function collapseSitemapTree(original, collapsedIds) {
102
+ if (collapsedIds.size === 0) {
103
+ return { parsed: original, hiddenCounts: /* @__PURE__ */ new Map() };
104
+ }
105
+ const { roots, hiddenCounts } = collapseTree(
106
+ original.roots,
107
+ collapsedIds,
108
+ SITEMAP_SHAPE
109
+ );
110
+ const edges = reterminateEdges(
111
+ original.roots,
112
+ roots,
113
+ original.edges,
114
+ collapsedIds,
115
+ SITEMAP_SHAPE,
116
+ SITEMAP_EDGE_SHAPE
117
+ );
118
+ return {
119
+ parsed: { ...original, roots, edges },
120
+ hiddenCounts
121
+ };
122
+ }
123
+
124
+ export {
125
+ collapseSitemapTree
126
+ };
127
+ //# sourceMappingURL=chunk-UNCCZ3NU.js.map