@vunk/plus 1.10.1 → 1.10.2

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 (296) hide show
  1. package/components/bubble-list/index.css +0 -22
  2. package/components/bubble-list/index.mjs +413 -9
  3. package/components/drawer/index.mjs +1 -1
  4. package/components/index3.mjs +20 -79450
  5. package/components/xgplayer/index.mjs +2 -16357
  6. package/index.css +0 -22
  7. package/package.json +1 -1
  8. package/components/_baseUniq-BXtq6_NW.mjs +0 -239
  9. package/components/abap-B7h4dtBh.mjs +0 -6
  10. package/components/actionscript-3-Bmm7RA3Y.mjs +0 -6
  11. package/components/ada-BZS802Se.mjs +0 -6
  12. package/components/andromeeda-CrngpmZk.mjs +0 -3
  13. package/components/apache-D4roVlsU.mjs +0 -6
  14. package/components/apex-D6mfw0H5.mjs +0 -6
  15. package/components/apl-DDK-VObo.mjs +0 -18
  16. package/components/applescript-C43Knf0G.mjs +0 -6
  17. package/components/ara-DRBH84ND.mjs +0 -6
  18. package/components/arc-Js_tyW10.mjs +0 -131
  19. package/components/architecture-O4VJ6CD3-ZoZ2IAk2.mjs +0 -15
  20. package/components/architectureDiagram-SUXI7LT5-kyYGGrHN.mjs +0 -8678
  21. package/components/asm-3tg4MVib.mjs +0 -6
  22. package/components/astro-v4FYbRud.mjs +0 -19
  23. package/components/aurora-x-wJ4-eM2h.mjs +0 -3
  24. package/components/awk-ChreaG-G.mjs +0 -6
  25. package/components/ayu-dark-BEKp3oqs.mjs +0 -3
  26. package/components/ballerina-B0yt0TYU.mjs +0 -6
  27. package/components/batch-Ce_EX3Sx.mjs +0 -14
  28. package/components/beancount-BRIsdQEB.mjs +0 -6
  29. package/components/berry-Brv4WWdL.mjs +0 -14
  30. package/components/bibtex-BLeFwAes.mjs +0 -6
  31. package/components/bicep-BVrgfErX.mjs +0 -6
  32. package/components/blade-By3Sw_Ex.mjs +0 -22
  33. package/components/blockDiagram-6J76NXCF-IAr4zDV3.mjs +0 -3610
  34. package/components/c-C4VtT7JA.mjs +0 -6
  35. package/components/c4Diagram-6F6E4RAY-Dv27rXcJ.mjs +0 -2492
  36. package/components/catppuccin-frappe-zLMNRRUx.mjs +0 -3
  37. package/components/catppuccin-latte-CdF5jC3c.mjs +0 -3
  38. package/components/catppuccin-macchiato-DyjXeyRt.mjs +0 -3
  39. package/components/catppuccin-mocha-66IdYxR8.mjs +0 -3
  40. package/components/cdc-30ktANo3.mjs +0 -14
  41. package/components/channel-BBZy6zOT.mjs +0 -7
  42. package/components/chunk-353BL4L5-Dn_Y_Yna.mjs +0 -17
  43. package/components/chunk-67H74DCK-Br5U8bfD.mjs +0 -102
  44. package/components/chunk-AACKK3MU-DH_MKxca.mjs +0 -17
  45. package/components/chunk-BFAMUDN2-DHLCoYMN.mjs +0 -13
  46. package/components/chunk-E2GYISFI-DQPHyyga.mjs +0 -19
  47. package/components/chunk-OW32GOEJ-CQOSE6Bn.mjs +0 -1924
  48. package/components/chunk-SKB7J2MH-BlwHRDiW.mjs +0 -25
  49. package/components/chunk-SZ463SBG-DEp8buKJ.mjs +0 -1823
  50. package/components/clarity-6uBl6Vpb.mjs +0 -6
  51. package/components/classDiagram-M3E45YP4-D0ySDe-v.mjs +0 -32
  52. package/components/classDiagram-v2-YAWTLIQI-D0ySDe-v.mjs +0 -32
  53. package/components/clojure-COBRmwo8.mjs +0 -14
  54. package/components/clone-CEJtuQzg.mjs +0 -8
  55. package/components/cmake-CDfQILeU.mjs +0 -6
  56. package/components/cobol-BOOIiISO.mjs +0 -13
  57. package/components/coffee-DO_RGoZp.mjs +0 -9
  58. package/components/cpp-DAK8ktHO.mjs +0 -25
  59. package/components/crystal-CBGbbyVp.mjs +0 -19
  60. package/components/cs-h3ksD6-P.mjs +0 -14
  61. package/components/css-BtVcDqlU.mjs +0 -6
  62. package/components/cue-BFSVLV6N.mjs +0 -6
  63. package/components/cypher-Dl2CXoXF.mjs +0 -14
  64. package/components/cytoscape.esm-BojS1z60.mjs +0 -30216
  65. package/components/d-9qSZPw74.mjs +0 -6
  66. package/components/dagre-JOIXM2OF-5zx0JY2T.mjs +0 -707
  67. package/components/dark-plus-DmZ1Dzd4.mjs +0 -3
  68. package/components/dart-CCSsOg9l.mjs +0 -6
  69. package/components/dax-CvsmLV-B.mjs +0 -6
  70. package/components/defaultLocale-DVr69WTU.mjs +0 -202
  71. package/components/diagram-5UYTHUR4-C19nyAKc.mjs +0 -215
  72. package/components/diagram-VMROVX33-DkGwo-hj.mjs +0 -861
  73. package/components/diagram-ZTM2IBQH-CBgHCu9L.mjs +0 -317
  74. package/components/diff-BEdzuHlE.mjs +0 -6
  75. package/components/dockerfile-B3DP334t.mjs +0 -14
  76. package/components/dracula-B8-AVrwI.mjs +0 -3
  77. package/components/dracula-soft-BHeefow7.mjs +0 -3
  78. package/components/dream-maker-CNLQpoF-.mjs +0 -6
  79. package/components/elixir-0rTCSSfp.mjs +0 -11
  80. package/components/elm-BhwiZPvf.mjs +0 -10
  81. package/components/erDiagram-3M52JZNH-cttdAJXW.mjs +0 -1169
  82. package/components/erb-Lra8TlYM.mjs +0 -27
  83. package/components/erlang-D2NNgvtR.mjs +0 -17
  84. package/components/everforest-dark-Cg1xdODP.mjs +0 -3
  85. package/components/everforest-light-BmTD3bxe.mjs +0 -3
  86. package/components/fish-BU5HSdZy.mjs +0 -6
  87. package/components/flowDiagram-KYDEHFYC-9HpsqDdB.mjs +0 -2345
  88. package/components/fs-CdBSddpF.mjs +0 -17
  89. package/components/ganttDiagram-EK5VF46D-8QB3ofs6.mjs +0 -3497
  90. package/components/gdresource-CAbkn6H_.mjs +0 -11
  91. package/components/gdscript-Be_cubqt.mjs +0 -6
  92. package/components/gdshader-BEzE4j_3.mjs +0 -6
  93. package/components/gherkin-xCNF9gh8.mjs +0 -6
  94. package/components/git-commit-PP9xCApN.mjs +0 -9
  95. package/components/git-rebase-DqdGofLo.mjs +0 -9
  96. package/components/gitGraph-ZV4HHKMB-BSmtVGRu.mjs +0 -15
  97. package/components/gitGraphDiagram-GW3U2K7C-DNzc0Vx_.mjs +0 -1227
  98. package/components/github-dark-O22yVQaY.mjs +0 -3
  99. package/components/github-dark-default-DB2Hkvqn.mjs +0 -3
  100. package/components/github-dark-dimmed-CMZ_OfqC.mjs +0 -3
  101. package/components/github-dark-high-contrast-DmxWVmCU.mjs +0 -3
  102. package/components/github-light-BTbR9xVK.mjs +0 -3
  103. package/components/github-light-default-DWEonwFe.mjs +0 -3
  104. package/components/github-light-high-contrast-WJ_cPDts.mjs +0 -3
  105. package/components/glimmer-js-BkPYTyD4.mjs +0 -23
  106. package/components/glsl-CGsiYPcu.mjs +0 -9
  107. package/components/gnuplot-tV8vezdE.mjs +0 -6
  108. package/components/go-CBmVHZBz.mjs +0 -6
  109. package/components/graph-3zJxsO-i.mjs +0 -425
  110. package/components/graphql-D4pgneW3.mjs +0 -15
  111. package/components/groovy-Bn4MhXgW.mjs +0 -6
  112. package/components/gruvbox-dark-hard-C89wZ4s3.mjs +0 -3
  113. package/components/gruvbox-dark-medium-swz85q_b.mjs +0 -3
  114. package/components/gruvbox-dark-soft-BYHBHQJW.mjs +0 -3
  115. package/components/gruvbox-light-hard-DEF_ZxYZ.mjs +0 -3
  116. package/components/gruvbox-light-medium-ziUMnHJx.mjs +0 -3
  117. package/components/gruvbox-light-soft-Cuwp0tsB.mjs +0 -3
  118. package/components/gts-d3WsqAZM.mjs +0 -23
  119. package/components/hack-CwaBuF5l.mjs +0 -13
  120. package/components/haml-gLijj4rW.mjs +0 -11
  121. package/components/hbs-CFi5SpI3.mjs +0 -23
  122. package/components/hcl-axoq0Ycu.mjs +0 -6
  123. package/components/hjson-I7LcauIB.mjs +0 -6
  124. package/components/hlsl-TRzjajlb.mjs +0 -6
  125. package/components/houston-CF_ws8Cq.mjs +0 -3
  126. package/components/hs-DXSGqUFF.mjs +0 -14
  127. package/components/html-CLq-n30c.mjs +0 -11
  128. package/components/html-derivative-C8POX8SL.mjs +0 -9
  129. package/components/http-BYUKZ6kX.mjs +0 -20
  130. package/components/imba-C4923lSV.mjs +0 -6
  131. package/components/index4.mjs +0 -78
  132. package/components/info-63CPKGFF-C8sYWczU.mjs +0 -15
  133. package/components/infoDiagram-LHK5PUON-C-vFFPTf.mjs +0 -44
  134. package/components/init-ZxktEp_H.mjs +0 -15
  135. package/components/java-BfXh-0uJ.mjs +0 -6
  136. package/components/jinja-html-BmW4v_vu.mjs +0 -11
  137. package/components/jison-C9kAT_Oj.mjs +0 -9
  138. package/components/journeyDiagram-EWQZEKCU-BJrw4-AG.mjs +0 -1264
  139. package/components/js-CN_xSsjU.mjs +0 -14
  140. package/components/json-TjWBGEk1.mjs +0 -6
  141. package/components/json5-DCGCKrmX.mjs +0 -6
  142. package/components/jsonc-DLVLp8id.mjs +0 -6
  143. package/components/jsonl-B-R_pDGg.mjs +0 -6
  144. package/components/jsonnet-Cs8BnnC6.mjs +0 -6
  145. package/components/jssm-D_YBQ_cM.mjs +0 -14
  146. package/components/jsx-BPmvoin2.mjs +0 -6
  147. package/components/julia-C-JjBobP.mjs +0 -19
  148. package/components/kanagawa-dragon-DU8n2NNT.mjs +0 -3
  149. package/components/kanagawa-lotus-Byd0CDet.mjs +0 -3
  150. package/components/kanagawa-wave-DExoagcR.mjs +0 -3
  151. package/components/kanban-definition-ZSS6B67P-BptAnqU-.mjs +0 -1059
  152. package/components/kotlin-BM2ZNTMh.mjs +0 -6
  153. package/components/kusto-D9MF7CZf.mjs +0 -14
  154. package/components/laserwave-DF03wMlf.mjs +0 -3
  155. package/components/latex-BsqkLZB_.mjs +0 -10
  156. package/components/layout-sGZIJplX.mjs +0 -2043
  157. package/components/less-BAzLMJNR.mjs +0 -6
  158. package/components/light-plus-DS08Xg5J.mjs +0 -3
  159. package/components/linear-DqgVh5FN.mjs +0 -336
  160. package/components/liquid-f2VHt0dg.mjs +0 -15
  161. package/components/lisp-DAq1kaby.mjs +0 -6
  162. package/components/logo-D9l7oEJ8.mjs +0 -6
  163. package/components/lua-CH3ttzl_.mjs +0 -9
  164. package/components/makefile-D2qLe7q0.mjs +0 -14
  165. package/components/marko-DwRyI_--.mjs +0 -15
  166. package/components/material-theme-B8B2U48Q.mjs +0 -3
  167. package/components/material-theme-darker-BV0iY_T3.mjs +0 -3
  168. package/components/material-theme-lighter-DrzybSTF.mjs +0 -3
  169. package/components/material-theme-ocean-BRPLVReX.mjs +0 -3
  170. package/components/material-theme-palenight-DSJwsR_D.mjs +0 -3
  171. package/components/matlab-7XHduepk.mjs +0 -6
  172. package/components/md-BIvDPr-W.mjs +0 -14
  173. package/components/mdc-Rx6hWSHn.mjs +0 -16
  174. package/components/mdx-D5wExp-O.mjs +0 -6
  175. package/components/mermaid-CUjtoYEe.mjs +0 -6
  176. package/components/mermaid-parser.core-CH9ryA1K.mjs +0 -16987
  177. package/components/mermaid.core-CAqkCmS1.mjs +0 -20977
  178. package/components/min-BngCxx8g.mjs +0 -109
  179. package/components/min-dark-BNaN9fWk.mjs +0 -3
  180. package/components/min-light-CMrjentn.mjs +0 -3
  181. package/components/mindmap-definition-6CBA2TL7-Cp_EeEsh.mjs +0 -5856
  182. package/components/mojo-CrbF881p.mjs +0 -6
  183. package/components/monokai-DelygWXa.mjs +0 -3
  184. package/components/narrat-DOwkIbBe.mjs +0 -14
  185. package/components/nf-DHfvJ2gH.mjs +0 -14
  186. package/components/nginx-B_jWsywZ.mjs +0 -10
  187. package/components/night-owl-DSS199ra.mjs +0 -3
  188. package/components/nim-yzbnZKJd.mjs +0 -22
  189. package/components/nix--3K2gyjg.mjs +0 -6
  190. package/components/nord-CvDbBq5M.mjs +0 -3
  191. package/components/objective-c-DkOBZg1J.mjs +0 -14
  192. package/components/objective-cpp-DEoN9Fe5.mjs +0 -6
  193. package/components/ocaml-B1kfGk9Y.mjs +0 -6
  194. package/components/one-dark-pro-CsMf0BoJ.mjs +0 -3
  195. package/components/one-light-BwwAsfsj.mjs +0 -3
  196. package/components/ordinal-DSZU4PqD.mjs +0 -76
  197. package/components/packet-HUATNLJX-bfFWFja0.mjs +0 -15
  198. package/components/pascal-CU8Kjkr_.mjs +0 -6
  199. package/components/perl-FH6su6vZ.mjs +0 -18
  200. package/components/php-Dnl1TfYH.mjs +0 -20
  201. package/components/pie-WTHONI2E-QPrWs3SR.mjs +0 -15
  202. package/components/pieDiagram-NIOCPIFQ-C46Y_4C6.mjs +0 -250
  203. package/components/plastic-BjwMpBc0.mjs +0 -3
  204. package/components/plsql-B3Na24V4.mjs +0 -6
  205. package/components/poimandres-ChWyhPrn.mjs +0 -3
  206. package/components/postcss-kj1IbjVd.mjs +0 -6
  207. package/components/powerquery-B-e1fO-k.mjs +0 -6
  208. package/components/prisma-bmxcSDxq.mjs +0 -6
  209. package/components/prolog-BT9GCzqD.mjs +0 -6
  210. package/components/properties-D6yKO1eW.mjs +0 -14
  211. package/components/proto-BIXM0k1a.mjs +0 -6
  212. package/components/ps1-aFyNx8UH.mjs +0 -18
  213. package/components/pug-BrOx0bSt.mjs +0 -21
  214. package/components/puppet-N15G4Usj.mjs +0 -6
  215. package/components/purescript-DrwsEYNH.mjs +0 -6
  216. package/components/python-D2s92fRP.mjs +0 -14
  217. package/components/ql-DTm-NCRo.mjs +0 -14
  218. package/components/quadrantDiagram-2OG54O6I-Dgf6d6F_.mjs +0 -1349
  219. package/components/r-oprfD2-9.mjs +0 -6
  220. package/components/radar-NJJJXTRR-BnUCJhQL.mjs +0 -15
  221. package/components/raku-xArQd_rF.mjs +0 -14
  222. package/components/razor-BoXCAbWQ.mjs +0 -13
  223. package/components/red-DByOl5N0.mjs +0 -3
  224. package/components/reg-CULnG2WX.mjs +0 -6
  225. package/components/rel-CHRwzjd4.mjs +0 -6
  226. package/components/requirementDiagram-QOLK2EJ7-CSF6N7HA.mjs +0 -1173
  227. package/components/riscv-BNQ9cVpw.mjs +0 -6
  228. package/components/rose-pine-LL9gXmP2.mjs +0 -3
  229. package/components/rose-pine-dawn-CH9zdisO.mjs +0 -3
  230. package/components/rose-pine-moon-B1oKSfEJ.mjs +0 -3
  231. package/components/rst-bEtD1v7N.mjs +0 -36
  232. package/components/ruby-BmfBy6EV.mjs +0 -44
  233. package/components/rust-Bf_fdNdL.mjs +0 -14
  234. package/components/sankeyDiagram-4UZDY2LN-BAHB7dMS.mjs +0 -1201
  235. package/components/sas-BLBgC3TA.mjs +0 -9
  236. package/components/sass-BheygBdF.mjs +0 -6
  237. package/components/scala-B-_7vFVn.mjs +0 -6
  238. package/components/scheme-BSHdPinv.mjs +0 -6
  239. package/components/scss-Dq-LbI_c.mjs +0 -9
  240. package/components/sequenceDiagram-SKLFT4DO-10gLJ50N.mjs +0 -3424
  241. package/components/shaderlab-BOQRTiQi.mjs +0 -17
  242. package/components/shellsession-Cu3c0QAc.mjs +0 -17
  243. package/components/slack-dark-BEe10hxO.mjs +0 -3
  244. package/components/slack-ochin-BKmu9pBc.mjs +0 -3
  245. package/components/smalltalk-qxcGy4fT.mjs +0 -6
  246. package/components/snazzy-light-Dcvd-ZyI.mjs +0 -3
  247. package/components/solarized-dark-BBl5y5sR.mjs +0 -3
  248. package/components/solarized-light-DW9b_AY8.mjs +0 -3
  249. package/components/solidity-CewKZgp-.mjs +0 -6
  250. package/components/sparql-DswowMAp.mjs +0 -9
  251. package/components/splunk-gK6Iw_P9.mjs +0 -14
  252. package/components/sql-DzUuSofg.mjs +0 -6
  253. package/components/ssh-config-Bk_I5wDR.mjs +0 -6
  254. package/components/stata-Dl7wDdBE.mjs +0 -9
  255. package/components/stateDiagram-MI5ZYTHO-D6p6nCaj.mjs +0 -461
  256. package/components/stateDiagram-v2-5AN5P6BG-DaN5hC-t.mjs +0 -31
  257. package/components/stylus-qRNkxrFU.mjs +0 -14
  258. package/components/svelte-B9qv3vkS.mjs +0 -15
  259. package/components/swift-BRQRsam8.mjs +0 -6
  260. package/components/synthwave-84-CoUef9sh.mjs +0 -3
  261. package/components/system-verilog-BcESSvRn.mjs +0 -6
  262. package/components/tasl-DfOr2qHi.mjs +0 -6
  263. package/components/tcl-CTsc4-t7.mjs +0 -6
  264. package/components/tex-CumJx1zu.mjs +0 -9
  265. package/components/timeline-definition-MYPXXCX6-gLqnWxDu.mjs +0 -1236
  266. package/components/tokyo-night-DjtLpAEY.mjs +0 -3
  267. package/components/toml-vHPzWDj6.mjs +0 -6
  268. package/components/treemap-75Q7IDZK-B2atdfMH.mjs +0 -15
  269. package/components/tsx-CmGGo4Hm.mjs +0 -6
  270. package/components/turtle-BnC7StHY.mjs +0 -6
  271. package/components/twig-0XKNpXN1.mjs +0 -35
  272. package/components/typescript-CgxwwAuC.mjs +0 -14
  273. package/components/v-Bmdjo9cy.mjs +0 -6
  274. package/components/vb-DuF6ZenW.mjs +0 -14
  275. package/components/verilog-CCb_iTfF.mjs +0 -6
  276. package/components/vesper-4Q1cEwPL.mjs +0 -3
  277. package/components/vhdl-DMqk4T2s.mjs +0 -6
  278. package/components/vimscript-aKp9YbYm.mjs +0 -18
  279. package/components/vitesse-black-BqNLki8b.mjs +0 -3
  280. package/components/vitesse-dark-jJ32WhwH.mjs +0 -3
  281. package/components/vitesse-light-476zM4e6.mjs +0 -3
  282. package/components/vue-DVNNTw2l.mjs +0 -40
  283. package/components/vue-html-Cr5wciIP.mjs +0 -16
  284. package/components/vyper-DYedWgAE.mjs +0 -14
  285. package/components/wasm-BBh6f151.mjs +0 -6
  286. package/components/wasm-DDgzZJey.mjs +0 -7
  287. package/components/wenyan-BdqozpMZ.mjs +0 -6
  288. package/components/wgsl-Vo-hHVWH.mjs +0 -6
  289. package/components/wolfram-CRmjUoI4.mjs +0 -6
  290. package/components/xml-BMzZeaqs.mjs +0 -9
  291. package/components/xsl-CAhvzxWv.mjs +0 -10
  292. package/components/xychartDiagram-H2YORKM3-Whqa4ezL.mjs +0 -1895
  293. package/components/yml-BhSrWWMS.mjs +0 -14
  294. package/components/zenscript-DFINJL6j.mjs +0 -6
  295. package/components/zig-CS4FMAZp.mjs +0 -6
  296. package/components/zsh-hcK4TBd7.mjs +0 -26
@@ -1,861 +0,0 @@
1
- import { s as setupViewPortForSVG } from './chunk-SKB7J2MH-BlwHRDiW.mjs';
2
- import { _ as __name, b as setAccTitle, a as getAccTitle, q as setDiagramTitle, t as getDiagramTitle, g as getAccDescription, s as setAccDescription, G as getConfig, F as cleanAndMerge, aP as isLabelStyle, z as clear$2, l as log, H as defaultConfig_default, K as selectSvgElement, e as configureSvgSize, aO as styles2String, d as select } from './mermaid.core-CAqkCmS1.mjs';
3
- import { p as populateCommonDb } from './chunk-353BL4L5-Dn_Y_Yna.mjs';
4
- import { p as parse } from './mermaid-parser.core-CH9ryA1K.mjs';
5
- import { b as format } from './defaultLocale-DVr69WTU.mjs';
6
- import { o as ordinal } from './ordinal-DSZU4PqD.mjs';
7
- import './index3.mjs';
8
- import 'vue';
9
- import '@vunk/plus/components/bubble-templates';
10
- import 'element-plus';
11
- import './index4.mjs';
12
- import '@vueuse/core';
13
- import '@vunk/plus/components/scrollbar';
14
- import './_plugin-vue_export-helper.mjs';
15
- import '@vunk/shared/function';
16
- import '@vunk/plus/components/agent-chat-provider';
17
- import './_baseUniq-BXtq6_NW.mjs';
18
- import './min-BngCxx8g.mjs';
19
- import './clone-CEJtuQzg.mjs';
20
- import './init-ZxktEp_H.mjs';
21
-
22
- var _a;
23
- function count(node) {
24
- var sum = 0, children = node.children, i = children && children.length;
25
- if (!i) sum = 1;
26
- else while (--i >= 0) sum += children[i].value;
27
- node.value = sum;
28
- }
29
- function node_count() {
30
- return this.eachAfter(count);
31
- }
32
- function node_each(callback, that) {
33
- let index = -1;
34
- for (const node of this) {
35
- callback.call(that, node, ++index, this);
36
- }
37
- return this;
38
- }
39
- function node_eachBefore(callback, that) {
40
- var node = this, nodes = [node], children, i, index = -1;
41
- while (node = nodes.pop()) {
42
- callback.call(that, node, ++index, this);
43
- if (children = node.children) {
44
- for (i = children.length - 1; i >= 0; --i) {
45
- nodes.push(children[i]);
46
- }
47
- }
48
- }
49
- return this;
50
- }
51
- function node_eachAfter(callback, that) {
52
- var node = this, nodes = [node], next = [], children, i, n, index = -1;
53
- while (node = nodes.pop()) {
54
- next.push(node);
55
- if (children = node.children) {
56
- for (i = 0, n = children.length; i < n; ++i) {
57
- nodes.push(children[i]);
58
- }
59
- }
60
- }
61
- while (node = next.pop()) {
62
- callback.call(that, node, ++index, this);
63
- }
64
- return this;
65
- }
66
- function node_find(callback, that) {
67
- let index = -1;
68
- for (const node of this) {
69
- if (callback.call(that, node, ++index, this)) {
70
- return node;
71
- }
72
- }
73
- }
74
- function node_sum(value) {
75
- return this.eachAfter(function(node) {
76
- var sum = +value(node.data) || 0, children = node.children, i = children && children.length;
77
- while (--i >= 0) sum += children[i].value;
78
- node.value = sum;
79
- });
80
- }
81
- function node_sort(compare) {
82
- return this.eachBefore(function(node) {
83
- if (node.children) {
84
- node.children.sort(compare);
85
- }
86
- });
87
- }
88
- function node_path(end) {
89
- var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start];
90
- while (start !== ancestor) {
91
- start = start.parent;
92
- nodes.push(start);
93
- }
94
- var k = nodes.length;
95
- while (end !== ancestor) {
96
- nodes.splice(k, 0, end);
97
- end = end.parent;
98
- }
99
- return nodes;
100
- }
101
- function leastCommonAncestor(a, b) {
102
- if (a === b) return a;
103
- var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null;
104
- a = aNodes.pop();
105
- b = bNodes.pop();
106
- while (a === b) {
107
- c = a;
108
- a = aNodes.pop();
109
- b = bNodes.pop();
110
- }
111
- return c;
112
- }
113
- function node_ancestors() {
114
- var node = this, nodes = [node];
115
- while (node = node.parent) {
116
- nodes.push(node);
117
- }
118
- return nodes;
119
- }
120
- function node_descendants() {
121
- return Array.from(this);
122
- }
123
- function node_leaves() {
124
- var leaves = [];
125
- this.eachBefore(function(node) {
126
- if (!node.children) {
127
- leaves.push(node);
128
- }
129
- });
130
- return leaves;
131
- }
132
- function node_links() {
133
- var root = this, links = [];
134
- root.each(function(node) {
135
- if (node !== root) {
136
- links.push({ source: node.parent, target: node });
137
- }
138
- });
139
- return links;
140
- }
141
- function* node_iterator() {
142
- var node = this, current, next = [node], children, i, n;
143
- do {
144
- current = next.reverse(), next = [];
145
- while (node = current.pop()) {
146
- yield node;
147
- if (children = node.children) {
148
- for (i = 0, n = children.length; i < n; ++i) {
149
- next.push(children[i]);
150
- }
151
- }
152
- }
153
- } while (next.length);
154
- }
155
- function hierarchy(data, children) {
156
- if (data instanceof Map) {
157
- data = [void 0, data];
158
- if (children === void 0) children = mapChildren;
159
- } else if (children === void 0) {
160
- children = objectChildren;
161
- }
162
- var root = new Node(data), node, nodes = [root], child, childs, i, n;
163
- while (node = nodes.pop()) {
164
- if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
165
- node.children = childs;
166
- for (i = n - 1; i >= 0; --i) {
167
- nodes.push(child = childs[i] = new Node(childs[i]));
168
- child.parent = node;
169
- child.depth = node.depth + 1;
170
- }
171
- }
172
- }
173
- return root.eachBefore(computeHeight);
174
- }
175
- function node_copy() {
176
- return hierarchy(this).eachBefore(copyData);
177
- }
178
- function objectChildren(d) {
179
- return d.children;
180
- }
181
- function mapChildren(d) {
182
- return Array.isArray(d) ? d[1] : null;
183
- }
184
- function copyData(node) {
185
- if (node.data.value !== void 0) node.value = node.data.value;
186
- node.data = node.data.data;
187
- }
188
- function computeHeight(node) {
189
- var height = 0;
190
- do
191
- node.height = height;
192
- while ((node = node.parent) && node.height < ++height);
193
- }
194
- function Node(data) {
195
- this.data = data;
196
- this.depth = this.height = 0;
197
- this.parent = null;
198
- }
199
- Node.prototype = hierarchy.prototype = {
200
- constructor: Node,
201
- count: node_count,
202
- each: node_each,
203
- eachAfter: node_eachAfter,
204
- eachBefore: node_eachBefore,
205
- find: node_find,
206
- sum: node_sum,
207
- sort: node_sort,
208
- path: node_path,
209
- ancestors: node_ancestors,
210
- descendants: node_descendants,
211
- leaves: node_leaves,
212
- links: node_links,
213
- copy: node_copy,
214
- [Symbol.iterator]: node_iterator
215
- };
216
- function required(f) {
217
- if (typeof f !== "function") throw new Error();
218
- return f;
219
- }
220
- function constantZero() {
221
- return 0;
222
- }
223
- function constant(x) {
224
- return function() {
225
- return x;
226
- };
227
- }
228
- function roundNode(node) {
229
- node.x0 = Math.round(node.x0);
230
- node.y0 = Math.round(node.y0);
231
- node.x1 = Math.round(node.x1);
232
- node.y1 = Math.round(node.y1);
233
- }
234
- function treemapDice(parent, x0, y0, x1, y1) {
235
- var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;
236
- while (++i < n) {
237
- node = nodes[i], node.y0 = y0, node.y1 = y1;
238
- node.x0 = x0, node.x1 = x0 += node.value * k;
239
- }
240
- }
241
- function treemapSlice(parent, x0, y0, x1, y1) {
242
- var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value;
243
- while (++i < n) {
244
- node = nodes[i], node.x0 = x0, node.x1 = x1;
245
- node.y0 = y0, node.y1 = y0 += node.value * k;
246
- }
247
- }
248
- var phi = (1 + Math.sqrt(5)) / 2;
249
- function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
250
- var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;
251
- while (i0 < n) {
252
- dx = x1 - x0, dy = y1 - y0;
253
- do
254
- sumValue = nodes[i1++].value;
255
- while (!sumValue && i1 < n);
256
- minValue = maxValue = sumValue;
257
- alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
258
- beta = sumValue * sumValue * alpha;
259
- minRatio = Math.max(maxValue / beta, beta / minValue);
260
- for (; i1 < n; ++i1) {
261
- sumValue += nodeValue = nodes[i1].value;
262
- if (nodeValue < minValue) minValue = nodeValue;
263
- if (nodeValue > maxValue) maxValue = nodeValue;
264
- beta = sumValue * sumValue * alpha;
265
- newRatio = Math.max(maxValue / beta, beta / minValue);
266
- if (newRatio > minRatio) {
267
- sumValue -= nodeValue;
268
- break;
269
- }
270
- minRatio = newRatio;
271
- }
272
- rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) });
273
- if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
274
- else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
275
- value -= sumValue, i0 = i1;
276
- }
277
- return rows;
278
- }
279
- const squarify = function custom(ratio) {
280
- function squarify2(parent, x0, y0, x1, y1) {
281
- squarifyRatio(ratio, parent, x0, y0, x1, y1);
282
- }
283
- squarify2.ratio = function(x) {
284
- return custom((x = +x) > 1 ? x : 1);
285
- };
286
- return squarify2;
287
- }(phi);
288
- function treemap() {
289
- var tile = squarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
290
- function treemap2(root) {
291
- root.x0 = root.y0 = 0;
292
- root.x1 = dx;
293
- root.y1 = dy;
294
- root.eachBefore(positionNode);
295
- paddingStack = [0];
296
- if (round) root.eachBefore(roundNode);
297
- return root;
298
- }
299
- function positionNode(node) {
300
- var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;
301
- if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
302
- if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
303
- node.x0 = x0;
304
- node.y0 = y0;
305
- node.x1 = x1;
306
- node.y1 = y1;
307
- if (node.children) {
308
- p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
309
- x0 += paddingLeft(node) - p;
310
- y0 += paddingTop(node) - p;
311
- x1 -= paddingRight(node) - p;
312
- y1 -= paddingBottom(node) - p;
313
- if (x1 < x0) x0 = x1 = (x0 + x1) / 2;
314
- if (y1 < y0) y0 = y1 = (y0 + y1) / 2;
315
- tile(node, x0, y0, x1, y1);
316
- }
317
- }
318
- treemap2.round = function(x) {
319
- return arguments.length ? (round = !!x, treemap2) : round;
320
- };
321
- treemap2.size = function(x) {
322
- return arguments.length ? (dx = +x[0], dy = +x[1], treemap2) : [dx, dy];
323
- };
324
- treemap2.tile = function(x) {
325
- return arguments.length ? (tile = required(x), treemap2) : tile;
326
- };
327
- treemap2.padding = function(x) {
328
- return arguments.length ? treemap2.paddingInner(x).paddingOuter(x) : treemap2.paddingInner();
329
- };
330
- treemap2.paddingInner = function(x) {
331
- return arguments.length ? (paddingInner = typeof x === "function" ? x : constant(+x), treemap2) : paddingInner;
332
- };
333
- treemap2.paddingOuter = function(x) {
334
- return arguments.length ? treemap2.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap2.paddingTop();
335
- };
336
- treemap2.paddingTop = function(x) {
337
- return arguments.length ? (paddingTop = typeof x === "function" ? x : constant(+x), treemap2) : paddingTop;
338
- };
339
- treemap2.paddingRight = function(x) {
340
- return arguments.length ? (paddingRight = typeof x === "function" ? x : constant(+x), treemap2) : paddingRight;
341
- };
342
- treemap2.paddingBottom = function(x) {
343
- return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant(+x), treemap2) : paddingBottom;
344
- };
345
- treemap2.paddingLeft = function(x) {
346
- return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant(+x), treemap2) : paddingLeft;
347
- };
348
- return treemap2;
349
- }
350
- var TreeMapDB = (_a = class {
351
- constructor() {
352
- this.nodes = [];
353
- this.levels = /* @__PURE__ */ new Map();
354
- this.outerNodes = [];
355
- this.classes = /* @__PURE__ */ new Map();
356
- this.setAccTitle = setAccTitle;
357
- this.getAccTitle = getAccTitle;
358
- this.setDiagramTitle = setDiagramTitle;
359
- this.getDiagramTitle = getDiagramTitle;
360
- this.getAccDescription = getAccDescription;
361
- this.setAccDescription = setAccDescription;
362
- }
363
- getNodes() {
364
- return this.nodes;
365
- }
366
- getConfig() {
367
- const defaultConfig = defaultConfig_default;
368
- const userConfig = getConfig();
369
- return cleanAndMerge({
370
- ...defaultConfig.treemap,
371
- ...userConfig.treemap ?? {}
372
- });
373
- }
374
- addNode(node, level) {
375
- this.nodes.push(node);
376
- this.levels.set(node, level);
377
- if (level === 0) {
378
- this.outerNodes.push(node);
379
- this.root ?? (this.root = node);
380
- }
381
- }
382
- getRoot() {
383
- return { name: "", children: this.outerNodes };
384
- }
385
- addClass(id, _style) {
386
- const styleClass = this.classes.get(id) ?? { id, styles: [], textStyles: [] };
387
- const styles = _style.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
388
- if (styles) {
389
- styles.forEach((s) => {
390
- if (isLabelStyle(s)) {
391
- if (styleClass == null ? void 0 : styleClass.textStyles) {
392
- styleClass.textStyles.push(s);
393
- } else {
394
- styleClass.textStyles = [s];
395
- }
396
- }
397
- if (styleClass == null ? void 0 : styleClass.styles) {
398
- styleClass.styles.push(s);
399
- } else {
400
- styleClass.styles = [s];
401
- }
402
- });
403
- }
404
- this.classes.set(id, styleClass);
405
- }
406
- getClasses() {
407
- return this.classes;
408
- }
409
- getStylesForClass(classSelector) {
410
- var _a2;
411
- return ((_a2 = this.classes.get(classSelector)) == null ? void 0 : _a2.styles) ?? [];
412
- }
413
- clear() {
414
- clear$2();
415
- this.nodes = [];
416
- this.levels = /* @__PURE__ */ new Map();
417
- this.outerNodes = [];
418
- this.classes = /* @__PURE__ */ new Map();
419
- this.root = void 0;
420
- }
421
- }, __name(_a, "TreeMapDB"), _a);
422
- function buildHierarchy(items) {
423
- if (!items.length) {
424
- return [];
425
- }
426
- const root = [];
427
- const stack = [];
428
- items.forEach((item) => {
429
- const node = {
430
- name: item.name,
431
- children: item.type === "Leaf" ? void 0 : []
432
- };
433
- node.classSelector = item == null ? void 0 : item.classSelector;
434
- if (item == null ? void 0 : item.cssCompiledStyles) {
435
- node.cssCompiledStyles = [item.cssCompiledStyles];
436
- }
437
- if (item.type === "Leaf" && item.value !== void 0) {
438
- node.value = item.value;
439
- }
440
- while (stack.length > 0 && stack[stack.length - 1].level >= item.level) {
441
- stack.pop();
442
- }
443
- if (stack.length === 0) {
444
- root.push(node);
445
- } else {
446
- const parent = stack[stack.length - 1].node;
447
- if (parent.children) {
448
- parent.children.push(node);
449
- } else {
450
- parent.children = [node];
451
- }
452
- }
453
- if (item.type !== "Leaf") {
454
- stack.push({ node, level: item.level });
455
- }
456
- });
457
- return root;
458
- }
459
- __name(buildHierarchy, "buildHierarchy");
460
- var populate = /* @__PURE__ */ __name((ast, db) => {
461
- populateCommonDb(ast, db);
462
- const items = [];
463
- for (const row of ast.TreemapRows ?? []) {
464
- if (row.$type === "ClassDefStatement") {
465
- db.addClass(row.className ?? "", row.styleText ?? "");
466
- }
467
- }
468
- for (const row of ast.TreemapRows ?? []) {
469
- const item = row.item;
470
- if (!item) {
471
- continue;
472
- }
473
- const level = row.indent ? parseInt(row.indent) : 0;
474
- const name = getItemName(item);
475
- const styles = item.classSelector ? db.getStylesForClass(item.classSelector) : [];
476
- const cssCompiledStyles = styles.length > 0 ? styles.join(";") : void 0;
477
- const itemData = {
478
- level,
479
- name,
480
- type: item.$type,
481
- value: item.value,
482
- classSelector: item.classSelector,
483
- cssCompiledStyles
484
- };
485
- items.push(itemData);
486
- }
487
- const hierarchyNodes = buildHierarchy(items);
488
- const addNodesRecursively = /* @__PURE__ */ __name((nodes, level) => {
489
- for (const node of nodes) {
490
- db.addNode(node, level);
491
- if (node.children && node.children.length > 0) {
492
- addNodesRecursively(node.children, level + 1);
493
- }
494
- }
495
- }, "addNodesRecursively");
496
- addNodesRecursively(hierarchyNodes, 0);
497
- }, "populate");
498
- var getItemName = /* @__PURE__ */ __name((item) => {
499
- return item.name ? String(item.name) : "";
500
- }, "getItemName");
501
- var parser = {
502
- // @ts-expect-error - TreeMapDB is not assignable to DiagramDB
503
- parser: { yy: void 0 },
504
- parse: /* @__PURE__ */ __name(async (text) => {
505
- var _a2;
506
- try {
507
- const parseFunc = parse;
508
- const ast = await parseFunc("treemap", text);
509
- log.debug("Treemap AST:", ast);
510
- const db = (_a2 = parser.parser) == null ? void 0 : _a2.yy;
511
- if (!(db instanceof TreeMapDB)) {
512
- throw new Error(
513
- "parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
514
- );
515
- }
516
- populate(ast, db);
517
- } catch (error) {
518
- log.error("Error parsing treemap:", error);
519
- throw error;
520
- }
521
- }, "parse")
522
- };
523
- var DEFAULT_INNER_PADDING = 10;
524
- var SECTION_INNER_PADDING = 10;
525
- var SECTION_HEADER_HEIGHT = 25;
526
- var draw = /* @__PURE__ */ __name((_text, id, _version, diagram2) => {
527
- const treemapDb = diagram2.db;
528
- const config = treemapDb.getConfig();
529
- const treemapInnerPadding = config.padding ?? DEFAULT_INNER_PADDING;
530
- const title = treemapDb.getDiagramTitle();
531
- const root = treemapDb.getRoot();
532
- const { themeVariables } = getConfig();
533
- if (!root) {
534
- return;
535
- }
536
- const titleHeight = title ? 30 : 0;
537
- const svg = selectSvgElement(id);
538
- const width = config.nodeWidth ? config.nodeWidth * SECTION_INNER_PADDING : 960;
539
- const height = config.nodeHeight ? config.nodeHeight * SECTION_INNER_PADDING : 500;
540
- const svgWidth = width;
541
- const svgHeight = height + titleHeight;
542
- svg.attr("viewBox", `0 0 ${svgWidth} ${svgHeight}`);
543
- configureSvgSize(svg, svgHeight, svgWidth, config.useMaxWidth);
544
- let valueFormat;
545
- try {
546
- const formatStr = config.valueFormat || ",";
547
- if (formatStr === "$0,0") {
548
- valueFormat = /* @__PURE__ */ __name((value) => "$" + format(",")(value), "valueFormat");
549
- } else if (formatStr.startsWith("$") && formatStr.includes(",")) {
550
- const precision = /\.\d+/.exec(formatStr);
551
- const precisionStr = precision ? precision[0] : "";
552
- valueFormat = /* @__PURE__ */ __name((value) => "$" + format("," + precisionStr)(value), "valueFormat");
553
- } else if (formatStr.startsWith("$")) {
554
- const restOfFormat = formatStr.substring(1);
555
- valueFormat = /* @__PURE__ */ __name((value) => "$" + format(restOfFormat || "")(value), "valueFormat");
556
- } else {
557
- valueFormat = format(formatStr);
558
- }
559
- } catch (error) {
560
- log.error("Error creating format function:", error);
561
- valueFormat = format(",");
562
- }
563
- const colorScale = ordinal().range([
564
- "transparent",
565
- themeVariables.cScale0,
566
- themeVariables.cScale1,
567
- themeVariables.cScale2,
568
- themeVariables.cScale3,
569
- themeVariables.cScale4,
570
- themeVariables.cScale5,
571
- themeVariables.cScale6,
572
- themeVariables.cScale7,
573
- themeVariables.cScale8,
574
- themeVariables.cScale9,
575
- themeVariables.cScale10,
576
- themeVariables.cScale11
577
- ]);
578
- const colorScalePeer = ordinal().range([
579
- "transparent",
580
- themeVariables.cScalePeer0,
581
- themeVariables.cScalePeer1,
582
- themeVariables.cScalePeer2,
583
- themeVariables.cScalePeer3,
584
- themeVariables.cScalePeer4,
585
- themeVariables.cScalePeer5,
586
- themeVariables.cScalePeer6,
587
- themeVariables.cScalePeer7,
588
- themeVariables.cScalePeer8,
589
- themeVariables.cScalePeer9,
590
- themeVariables.cScalePeer10,
591
- themeVariables.cScalePeer11
592
- ]);
593
- const colorScaleLabel = ordinal().range([
594
- themeVariables.cScaleLabel0,
595
- themeVariables.cScaleLabel1,
596
- themeVariables.cScaleLabel2,
597
- themeVariables.cScaleLabel3,
598
- themeVariables.cScaleLabel4,
599
- themeVariables.cScaleLabel5,
600
- themeVariables.cScaleLabel6,
601
- themeVariables.cScaleLabel7,
602
- themeVariables.cScaleLabel8,
603
- themeVariables.cScaleLabel9,
604
- themeVariables.cScaleLabel10,
605
- themeVariables.cScaleLabel11
606
- ]);
607
- if (title) {
608
- svg.append("text").attr("x", svgWidth / 2).attr("y", titleHeight / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(title);
609
- }
610
- const g = svg.append("g").attr("transform", `translate(0, ${titleHeight})`).attr("class", "treemapContainer");
611
- const hierarchyRoot = hierarchy(root).sum((d) => d.value ?? 0).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
612
- const treemapLayout = treemap().size([width, height]).paddingTop(
613
- (d) => d.children && d.children.length > 0 ? SECTION_HEADER_HEIGHT + SECTION_INNER_PADDING : 0
614
- ).paddingInner(treemapInnerPadding).paddingLeft((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingRight((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).paddingBottom((d) => d.children && d.children.length > 0 ? SECTION_INNER_PADDING : 0).round(true);
615
- const treemapData = treemapLayout(hierarchyRoot);
616
- const branchNodes = treemapData.descendants().filter((d) => d.children && d.children.length > 0);
617
- const sections = g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class", "treemapSection").attr("transform", (d) => `translate(${d.x0},${d.y0})`);
618
- sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", SECTION_HEADER_HEIGHT).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (d) => {
619
- if (d.depth === 0) {
620
- return "display: none;";
621
- }
622
- return "";
623
- });
624
- sections.append("clipPath").attr("id", (_d, i) => `clip-section-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 12)).attr("height", SECTION_HEADER_HEIGHT);
625
- sections.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", (_d, i) => {
626
- return `treemapSection section${i}`;
627
- }).attr("fill", (d) => colorScale(d.data.name)).attr("fill-opacity", 0.6).attr("stroke", (d) => colorScalePeer(d.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (d) => {
628
- if (d.depth === 0) {
629
- return "display: none;";
630
- }
631
- const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
632
- return styles.nodeStyles + ";" + styles.borderStyles.join(";");
633
- });
634
- sections.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", SECTION_HEADER_HEIGHT / 2).attr("dominant-baseline", "middle").text((d) => d.depth === 0 ? "" : d.data.name).attr("font-weight", "bold").attr("style", (d) => {
635
- if (d.depth === 0) {
636
- return "display: none;";
637
- }
638
- const labelStyles = "dominant-baseline: middle; font-size: 12px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
639
- const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
640
- return labelStyles + styles.labelStyles.replace("color:", "fill:");
641
- }).each(function(d) {
642
- if (d.depth === 0) {
643
- return;
644
- }
645
- const self = select(this);
646
- const originalText = d.data.name;
647
- self.text(originalText);
648
- const totalHeaderWidth = d.x1 - d.x0;
649
- const labelXPosition = 6;
650
- let spaceForTextContent;
651
- if (config.showValues !== false && d.value) {
652
- const valueEndsAtXRelative = totalHeaderWidth - 10;
653
- const estimatedValueTextActualWidth = 30;
654
- const gapBetweenLabelAndValue = 10;
655
- const labelMustEndBeforeX = valueEndsAtXRelative - estimatedValueTextActualWidth - gapBetweenLabelAndValue;
656
- spaceForTextContent = labelMustEndBeforeX - labelXPosition;
657
- } else {
658
- const labelOwnRightPadding = 6;
659
- spaceForTextContent = totalHeaderWidth - labelXPosition - labelOwnRightPadding;
660
- }
661
- const minimumWidthToDisplay = 15;
662
- const actualAvailableWidth = Math.max(minimumWidthToDisplay, spaceForTextContent);
663
- const textNode = self.node();
664
- const currentTextContentLength = textNode.getComputedTextLength();
665
- if (currentTextContentLength > actualAvailableWidth) {
666
- const ellipsis = "...";
667
- let currentTruncatedText = originalText;
668
- while (currentTruncatedText.length > 0) {
669
- currentTruncatedText = originalText.substring(0, currentTruncatedText.length - 1);
670
- if (currentTruncatedText.length === 0) {
671
- self.text(ellipsis);
672
- if (textNode.getComputedTextLength() > actualAvailableWidth) {
673
- self.text("");
674
- }
675
- break;
676
- }
677
- self.text(currentTruncatedText + ellipsis);
678
- if (textNode.getComputedTextLength() <= actualAvailableWidth) {
679
- break;
680
- }
681
- }
682
- }
683
- });
684
- if (config.showValues !== false) {
685
- sections.append("text").attr("class", "treemapSectionValue").attr("x", (d) => d.x1 - d.x0 - 10).attr("y", SECTION_HEADER_HEIGHT / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((d) => d.value ? valueFormat(d.value) : "").attr("font-style", "italic").attr("style", (d) => {
686
- if (d.depth === 0) {
687
- return "display: none;";
688
- }
689
- const labelStyles = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + colorScaleLabel(d.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;";
690
- const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
691
- return labelStyles + styles.labelStyles.replace("color:", "fill:");
692
- });
693
- }
694
- const leafNodes = treemapData.leaves();
695
- const cell = g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class", (d, i) => {
696
- return `treemapNode treemapLeafGroup leaf${i}${d.data.classSelector ? ` ${d.data.classSelector}` : ""}x`;
697
- }).attr("transform", (d) => `translate(${d.x0},${d.y0})`);
698
- cell.append("rect").attr("width", (d) => d.x1 - d.x0).attr("height", (d) => d.y1 - d.y0).attr("class", "treemapLeaf").attr("fill", (d) => {
699
- return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
700
- }).attr("style", (d) => {
701
- const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
702
- return styles.nodeStyles;
703
- }).attr("fill-opacity", 0.3).attr("stroke", (d) => {
704
- return d.parent ? colorScale(d.parent.data.name) : colorScale(d.data.name);
705
- }).attr("stroke-width", 3);
706
- cell.append("clipPath").attr("id", (_d, i) => `clip-${id}-${i}`).append("rect").attr("width", (d) => Math.max(0, d.x1 - d.x0 - 4)).attr("height", (d) => Math.max(0, d.y1 - d.y0 - 4));
707
- const leafLabels = cell.append("text").attr("class", "treemapLabel").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", (d) => (d.y1 - d.y0) / 2).attr("style", (d) => {
708
- const labelStyles = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + colorScaleLabel(d.data.name) + ";";
709
- const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
710
- return labelStyles + styles.labelStyles.replace("color:", "fill:");
711
- }).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.data.name);
712
- leafLabels.each(function(d) {
713
- const self = select(this);
714
- const nodeWidth = d.x1 - d.x0;
715
- const nodeHeight = d.y1 - d.y0;
716
- const textNode = self.node();
717
- const padding = 4;
718
- const availableWidth = nodeWidth - 2 * padding;
719
- const availableHeight = nodeHeight - 2 * padding;
720
- if (availableWidth < 10 || availableHeight < 10) {
721
- self.style("display", "none");
722
- return;
723
- }
724
- let currentLabelFontSize = parseInt(self.style("font-size"), 10);
725
- const minLabelFontSize = 8;
726
- const originalValueRelFontSize = 28;
727
- const valueScaleFactor = 0.6;
728
- const minValueFontSize = 6;
729
- const spacingBetweenLabelAndValue = 2;
730
- while (textNode.getComputedTextLength() > availableWidth && currentLabelFontSize > minLabelFontSize) {
731
- currentLabelFontSize--;
732
- self.style("font-size", `${currentLabelFontSize}px`);
733
- }
734
- let prospectiveValueFontSize = Math.max(
735
- minValueFontSize,
736
- Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
737
- );
738
- let combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
739
- while (combinedHeight > availableHeight && currentLabelFontSize > minLabelFontSize) {
740
- currentLabelFontSize--;
741
- prospectiveValueFontSize = Math.max(
742
- minValueFontSize,
743
- Math.min(originalValueRelFontSize, Math.round(currentLabelFontSize * valueScaleFactor))
744
- );
745
- if (prospectiveValueFontSize < minValueFontSize && currentLabelFontSize === minLabelFontSize) {
746
- break;
747
- }
748
- self.style("font-size", `${currentLabelFontSize}px`);
749
- combinedHeight = currentLabelFontSize + spacingBetweenLabelAndValue + prospectiveValueFontSize;
750
- }
751
- self.style("font-size", `${currentLabelFontSize}px`);
752
- if (textNode.getComputedTextLength() > availableWidth || currentLabelFontSize < minLabelFontSize || availableHeight < currentLabelFontSize) {
753
- self.style("display", "none");
754
- }
755
- });
756
- if (config.showValues !== false) {
757
- const leafValues = cell.append("text").attr("class", "treemapValue").attr("x", (d) => (d.x1 - d.x0) / 2).attr("y", function(d) {
758
- return (d.y1 - d.y0) / 2;
759
- }).attr("style", (d) => {
760
- const labelStyles = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + colorScaleLabel(d.data.name) + ";";
761
- const styles = styles2String({ cssCompiledStyles: d.data.cssCompiledStyles });
762
- return labelStyles + styles.labelStyles.replace("color:", "fill:");
763
- }).attr("clip-path", (_d, i) => `url(#clip-${id}-${i})`).text((d) => d.value ? valueFormat(d.value) : "");
764
- leafValues.each(function(d) {
765
- const valueTextElement = select(this);
766
- const parentCellNode = this.parentNode;
767
- if (!parentCellNode) {
768
- valueTextElement.style("display", "none");
769
- return;
770
- }
771
- const labelElement = select(parentCellNode).select(".treemapLabel");
772
- if (labelElement.empty() || labelElement.style("display") === "none") {
773
- valueTextElement.style("display", "none");
774
- return;
775
- }
776
- const finalLabelFontSize = parseFloat(labelElement.style("font-size"));
777
- const originalValueFontSize = 28;
778
- const valueScaleFactor = 0.6;
779
- const minValueFontSize = 6;
780
- const spacingBetweenLabelAndValue = 2;
781
- const actualValueFontSize = Math.max(
782
- minValueFontSize,
783
- Math.min(originalValueFontSize, Math.round(finalLabelFontSize * valueScaleFactor))
784
- );
785
- valueTextElement.style("font-size", `${actualValueFontSize}px`);
786
- const labelCenterY = (d.y1 - d.y0) / 2;
787
- const valueTopActualY = labelCenterY + finalLabelFontSize / 2 + spacingBetweenLabelAndValue;
788
- valueTextElement.attr("y", valueTopActualY);
789
- const nodeWidth = d.x1 - d.x0;
790
- const nodeTotalHeight = d.y1 - d.y0;
791
- const cellBottomPadding = 4;
792
- const maxValueBottomY = nodeTotalHeight - cellBottomPadding;
793
- const availableWidthForValue = nodeWidth - 2 * 4;
794
- if (valueTextElement.node().getComputedTextLength() > availableWidthForValue || valueTopActualY + actualValueFontSize > maxValueBottomY || actualValueFontSize < minValueFontSize) {
795
- valueTextElement.style("display", "none");
796
- } else {
797
- valueTextElement.style("display", null);
798
- }
799
- });
800
- }
801
- const diagramPadding = config.diagramPadding ?? 8;
802
- setupViewPortForSVG(svg, diagramPadding, "flowchart", (config == null ? void 0 : config.useMaxWidth) || false);
803
- }, "draw");
804
- var getClasses = /* @__PURE__ */ __name(function(_text, diagramObj) {
805
- return diagramObj.db.getClasses();
806
- }, "getClasses");
807
- var renderer = { draw, getClasses };
808
- var defaultTreemapStyleOptions = {
809
- sectionStrokeColor: "black",
810
- sectionStrokeWidth: "1",
811
- sectionFillColor: "#efefef",
812
- leafStrokeColor: "black",
813
- leafStrokeWidth: "1",
814
- leafFillColor: "#efefef",
815
- labelColor: "black",
816
- labelFontSize: "12px",
817
- valueFontSize: "10px",
818
- valueColor: "black",
819
- titleColor: "black",
820
- titleFontSize: "14px"
821
- };
822
- var getStyles = /* @__PURE__ */ __name(({
823
- treemap: treemap2
824
- } = {}) => {
825
- const options = cleanAndMerge(defaultTreemapStyleOptions, treemap2);
826
- return `
827
- .treemapNode.section {
828
- stroke: ${options.sectionStrokeColor};
829
- stroke-width: ${options.sectionStrokeWidth};
830
- fill: ${options.sectionFillColor};
831
- }
832
- .treemapNode.leaf {
833
- stroke: ${options.leafStrokeColor};
834
- stroke-width: ${options.leafStrokeWidth};
835
- fill: ${options.leafFillColor};
836
- }
837
- .treemapLabel {
838
- fill: ${options.labelColor};
839
- font-size: ${options.labelFontSize};
840
- }
841
- .treemapValue {
842
- fill: ${options.valueColor};
843
- font-size: ${options.valueFontSize};
844
- }
845
- .treemapTitle {
846
- fill: ${options.titleColor};
847
- font-size: ${options.titleFontSize};
848
- }
849
- `;
850
- }, "getStyles");
851
- var styles_default = getStyles;
852
- var diagram = {
853
- parser,
854
- get db() {
855
- return new TreeMapDB();
856
- },
857
- renderer,
858
- styles: styles_default
859
- };
860
-
861
- export { diagram };