@diagrammo/dgmo 0.87.0 → 0.89.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 (149) hide show
  1. package/README.md +4 -2
  2. package/dist/advanced.d.ts +47 -11
  3. package/dist/advanced.js +110 -106
  4. package/dist/{analyzer-R5UBTRO2.js → analyzer-7ZGAZIE6.js} +2 -2
  5. package/dist/block.js +26 -25
  6. package/dist/{chart-meta-PbgpGwYo.d.ts → chart-meta-Bev5Ebjr.d.ts} +1 -1
  7. package/dist/chart-meta.d.ts +2 -2
  8. package/dist/chart-meta.js +11 -11
  9. package/dist/{chart-types-Db_EGf1o.d.ts → chart-types-Bf8C5QQW.d.ts} +1 -1
  10. package/dist/{charts-d3-3BZRSZV6.js → charts-d3-KEQSUWKP.js} +10 -10
  11. package/dist/{chunk-LJFXC3IP.js → chunk-2GM7N5TV.js} +10 -10
  12. package/dist/{chunk-H2GEIFUF.js → chunk-3AQJNY65.js} +8 -8
  13. package/dist/chunk-44FTCIRI.js +438 -0
  14. package/dist/{chunk-WZ23JJ7U.js → chunk-4AJKOUBO.js} +11 -11
  15. package/dist/{chunk-YK4N6TBN.js → chunk-4R6OMKXB.js} +7 -7
  16. package/dist/{chunk-HEYGGSNQ.js → chunk-5LE2CTLS.js} +2 -2
  17. package/dist/{chunk-AGO3PFGS.js → chunk-7C2RAGPT.js} +46 -31
  18. package/dist/{chunk-VJ2KROJ5.js → chunk-7KPHRTND.js} +1 -1
  19. package/dist/{chunk-LHL6HDUL.js → chunk-7SX4IY6T.js} +84 -12
  20. package/dist/{chunk-LSQGJN5H.js → chunk-7W4XLIVH.js} +15 -15
  21. package/dist/{chunk-Q2U5635V.js → chunk-ABP5BUD6.js} +9 -430
  22. package/dist/{chunk-XUDGZJTJ.js → chunk-AZ24RI5L.js} +6 -6
  23. package/dist/{chunk-UMRZPRAN.js → chunk-BB6QKWHZ.js} +15 -15
  24. package/dist/{chunk-6I5UN4FD.js → chunk-C4FRGZGX.js} +4 -4
  25. package/dist/{chunk-3DOQOXXI.js → chunk-CNUN5GO6.js} +1 -1
  26. package/dist/{chunk-5KGM44TG.js → chunk-CX6OH5WP.js} +1 -1
  27. package/dist/{chunk-D4M25W6R.js → chunk-DDPGEGHB.js} +5 -5
  28. package/dist/{chunk-B7CU2HW5.js → chunk-DZPHN2WN.js} +9 -9
  29. package/dist/{chunk-O6MMQQLF.js → chunk-ECMA6XE2.js} +10 -10
  30. package/dist/{chunk-MGBV4JEI.js → chunk-EDXGEQW3.js} +1 -1
  31. package/dist/{chunk-FBKPSU3A.js → chunk-EXKCRXPO.js} +9 -9
  32. package/dist/{chunk-HTPZDZKQ.js → chunk-FKLE6QA3.js} +13 -13
  33. package/dist/{chunk-ERNCPKD4.js → chunk-G2KHLANR.js} +1 -1
  34. package/dist/{chunk-NJIGYGZS.js → chunk-HAMF4F3P.js} +12 -7
  35. package/dist/{chunk-UY6TEJJH.js → chunk-HJRP6PXL.js} +1 -1
  36. package/dist/{chunk-LNO3ASX5.js → chunk-HUNDJTTH.js} +1 -1
  37. package/dist/{chunk-RH2PROYG.js → chunk-I6GGMCTV.js} +4 -2
  38. package/dist/{chunk-DOXBS7F5.js → chunk-ID2K3IHI.js} +4 -4
  39. package/dist/{chunk-33FQ6HNV.js → chunk-IQ6P3HDE.js} +9 -9
  40. package/dist/{chunk-BAZT6CIF.js → chunk-ITSBBQTH.js} +7 -7
  41. package/dist/{chunk-UNNJCSSQ.js → chunk-JVZ7KFAX.js} +1 -1
  42. package/dist/{chunk-AQIBKTPG.js → chunk-K5XT7NHD.js} +3 -3
  43. package/dist/{chunk-HAH5X345.js → chunk-KATED53P.js} +1 -1
  44. package/dist/{chunk-7HWY4QAJ.js → chunk-L24LESXF.js} +1 -0
  45. package/dist/{chunk-VPASQOR3.js → chunk-LFKSHDVI.js} +1 -1
  46. package/dist/{chunk-XVSJYAK7.js → chunk-LPYYZCSI.js} +2 -2
  47. package/dist/{chunk-BV6PKJUS.js → chunk-LR6RRDWN.js} +5 -5
  48. package/dist/{chunk-DAX42XVH.js → chunk-LYLNMN77.js} +8 -8
  49. package/dist/{chunk-PJQZWJ5I.js → chunk-M2BCY7H3.js} +1015 -146
  50. package/dist/{chunk-A4XPI4YN.js → chunk-MFW6P7WH.js} +27 -0
  51. package/dist/{chunk-CFBY77QJ.js → chunk-N4BBSDWI.js} +9 -9
  52. package/dist/{chunk-IDJGV6VM.js → chunk-NIUO2TNR.js} +215 -1
  53. package/dist/{chunk-PLE2432T.js → chunk-NRPELUB6.js} +2 -2
  54. package/dist/{chunk-FM3WAVB6.js → chunk-NS7L7YKH.js} +1 -1
  55. package/dist/{chunk-YMG7JDEY.js → chunk-NSR2CGV6.js} +71 -24
  56. package/dist/{chunk-LD2JSKU3.js → chunk-OOCVGX4W.js} +15 -0
  57. package/dist/{chunk-N4XHXBDQ.js → chunk-PMNITNPR.js} +4 -4
  58. package/dist/{chunk-MSXRNVHB.js → chunk-Q6SQISHT.js} +12 -11
  59. package/dist/{chunk-UNAP6O26.js → chunk-QIOYTQDZ.js} +9 -9
  60. package/dist/{chunk-BT2WH2XT.js → chunk-RGWYZR3S.js} +1 -1
  61. package/dist/{chunk-PPH6ILHL.js → chunk-RPKBWJBB.js} +4 -4
  62. package/dist/{chunk-JD4RHBNX.js → chunk-RXIKESRI.js} +7 -7
  63. package/dist/{chunk-BMUWF77V.js → chunk-S2WE7TVK.js} +4 -4
  64. package/dist/{chunk-QFIXL3OK.js → chunk-SEKNYIMO.js} +1 -1
  65. package/dist/{chunk-FPXMCGS5.js → chunk-SLQT3JP3.js} +1 -1
  66. package/dist/{chunk-LL6D3MES.js → chunk-SOPM5PLO.js} +9 -9
  67. package/dist/{chunk-J7Q4VPBJ.js → chunk-TAP2NZEU.js} +22 -16
  68. package/dist/{chunk-RE6TVIAV.js → chunk-UKJLPA7R.js} +4 -4
  69. package/dist/{chunk-RGI64U3A.js → chunk-UQLHKLF4.js} +9 -9
  70. package/dist/{chunk-LPXC4I4R.js → chunk-UWKRPQZO.js} +61 -32
  71. package/dist/{chunk-XIFK423U.js → chunk-W7QN5BC5.js} +4 -4
  72. package/dist/{chunk-XWYR5T52.js → chunk-WEF6MXFG.js} +14 -14
  73. package/dist/{chunk-P5V63L35.js → chunk-WP22MHH6.js} +17 -17
  74. package/dist/{chunk-PUVTFUNH.js → chunk-WRCAH3UO.js} +18 -18
  75. package/dist/{chunk-N7XRBWXA.js → chunk-XJ2TBXHA.js} +10 -10
  76. package/dist/{chunk-DSG6GBUQ.js → chunk-XUCQVKLQ.js} +6 -6
  77. package/dist/{chunk-NZCSVD4M.js → chunk-Y7PSAHAY.js} +8 -8
  78. package/dist/{chunk-AAMCXQPP.js → chunk-YMFQLWZ2.js} +6 -6
  79. package/dist/completion-registry.d.ts +1 -1
  80. package/dist/completion-registry.js +4 -16
  81. package/dist/countdown.js +1 -1
  82. package/dist/{dgmo-router-F2DSURTR.js → dgmo-router-7WANZOBD.js} +11 -11
  83. package/dist/{dimensions-6QAWEGIR.js → dimensions-7MF7VSGS.js} +6 -6
  84. package/dist/{flowchart-renderer-THC6Y7EH.js → flowchart-renderer-DZQZRL2F.js} +6 -5
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +28 -27
  87. package/dist/{layout-P6DTD4RT.js → layout-4RRC7XU7.js} +2 -2
  88. package/dist/{layout-QX5T6ZNE.js → layout-6L3BIFEZ.js} +4 -4
  89. package/dist/{layout-SOPAVXIH.js → layout-DXVAYF6W.js} +3 -3
  90. package/dist/{layout-LUQKAGGT.js → layout-EFEZ533S.js} +4 -4
  91. package/dist/{layout-EHTYSMV4.js → layout-H4K54IW3.js} +2 -2
  92. package/dist/{layout-AM57TGN5.js → layout-IGAVGDME.js} +3 -3
  93. package/dist/{layout-5NPBHV5F.js → layout-PP36LUTA.js} +2 -2
  94. package/dist/{layout-CUFA7XJD.js → layout-Q3RYSODA.js} +4 -4
  95. package/dist/layout-XUW444O5.js +1 -1
  96. package/dist/{layout-BOVTLAOT.js → layout-ZP7XYVXF.js} +2 -2
  97. package/dist/{layout-search-VKSBUCDM.js → layout-search-YKUL4VBV.js} +105 -6
  98. package/dist/{legend-constants-ZVO4FLAK.js → legend-constants-HE7FVDJP.js} +4 -2
  99. package/dist/{palettes-BIV54XLS.js → palettes-WZAIQTEG.js} +6 -4
  100. package/dist/{parser-ACW6C6OY.js → parser-337TACHB.js} +1 -1
  101. package/dist/{parser-WUK6CP5X.js → parser-GCCWMBTU.js} +3 -3
  102. package/dist/{parser-GPW4ZHPQ.js → parser-IMM2JJX3.js} +2 -1
  103. package/dist/{parser-JXS4426S.js → parser-P4TOQYNN.js} +2 -2
  104. package/dist/{parser-PVIWHVGY.js → parser-TL3JA4RI.js} +1 -1
  105. package/dist/{parser-C327BBE3.js → parser-UTXFJG4X.js} +1 -1
  106. package/dist/{renderer-RWJ45DWH.js → renderer-2ZQ6DPVD.js} +3 -3
  107. package/dist/{renderer-NHPKNNBD.js → renderer-3AD4NDF5.js} +9 -9
  108. package/dist/{renderer-2KVQGGTT.js → renderer-43ESBXVY.js} +8 -8
  109. package/dist/{renderer-A4LMOBZL.js → renderer-4JE5ORRO.js} +12 -12
  110. package/dist/{renderer-RAATRF6W.js → renderer-5GZNGZU5.js} +7 -7
  111. package/dist/{renderer-RMGN3Q7D.js → renderer-6OQM32X3.js} +3 -3
  112. package/dist/{renderer-222OTVQV.js → renderer-7HOSI6JJ.js} +4 -4
  113. package/dist/{renderer-NX4YKWCJ.js → renderer-7L7J4DHO.js} +8 -8
  114. package/dist/{renderer-DCFQDBGJ.js → renderer-7MCC6GKH.js} +2 -2
  115. package/dist/{renderer-3FF4QVGW.js → renderer-7VQOKAII.js} +8 -8
  116. package/dist/{renderer-4BHOELCE.js → renderer-BLHN3RCY.js} +3 -3
  117. package/dist/{renderer-PQYO2HCE.js → renderer-CEIX5JPA.js} +3 -3
  118. package/dist/{renderer-2OOPQ4CH.js → renderer-CHQZES6G.js} +3 -3
  119. package/dist/{renderer-36JH4OMC.js → renderer-DBNDLKPE.js} +9 -9
  120. package/dist/{renderer-KVAQE7PQ.js → renderer-DCJ4AQ3N.js} +7 -7
  121. package/dist/{renderer-LODEVN3V.js → renderer-EAORWLVK.js} +10 -10
  122. package/dist/{renderer-XRALFCIN.js → renderer-FCXRDYSJ.js} +8 -8
  123. package/dist/{renderer-YDAVCRTP.js → renderer-IR5GGAPB.js} +8 -8
  124. package/dist/{renderer-QM23SWAM.js → renderer-J4OS77PK.js} +2 -2
  125. package/dist/{renderer-4BIMRO4X.js → renderer-JR2XNZAH.js} +6 -6
  126. package/dist/{renderer-JKV2DBYP.js → renderer-JRVY7HAD.js} +6 -6
  127. package/dist/{renderer-R34GJL7U.js → renderer-NAA7D33G.js} +11 -11
  128. package/dist/{renderer-SDUSBCJI.js → renderer-P4XCRNCY.js} +7 -7
  129. package/dist/{renderer-A6ACVK4X.js → renderer-QQHQY3GT.js} +6 -6
  130. package/dist/{renderer-YIZ7G4HU.js → renderer-TJJGFQGT.js} +13 -13
  131. package/dist/{renderer-3CTUWCO7.js → renderer-VGQMJC5K.js} +12 -12
  132. package/dist/{renderer-ELYPDPNF.js → renderer-VYWCMRWA.js} +8 -7
  133. package/dist/{renderer-WH2HWE5Z.js → renderer-WB75JME5.js} +8 -8
  134. package/dist/{renderer-BICLPGAH.js → renderer-WQ654YT5.js} +2 -2
  135. package/dist/{renderer-6BUUTWVS.js → renderer-XFEZ5UBE.js} +8 -8
  136. package/dist/{renderer-4NZZ5J2F.js → renderer-XHEMXBQM.js} +7 -7
  137. package/dist/{renderer-RENDISO5.js → renderer-YTEZK3GC.js} +12 -12
  138. package/dist/{renderer-X5A5VIRD.js → renderer-ZXQXRNDR.js} +8 -8
  139. package/dist/{renderer-radial-XZ5TKUT4.js → renderer-radial-NA5DVBG4.js} +7 -7
  140. package/dist/{state-renderer-5IQ4OJUI.js → state-renderer-4S2C2CHB.js} +9 -9
  141. package/docs/ai-integration.md +5 -3
  142. package/docs/language-reference.md +2 -2
  143. package/package.json +1 -1
  144. package/dist/{chunk-3TYUXC7D.js → chunk-2SKMEL7V.js} +0 -0
  145. package/dist/{chunk-CLQIXD2C.js → chunk-7Z2VFRP5.js} +3 -3
  146. package/dist/{chunk-NF5YKFRH.js → chunk-B3S76BZO.js} +0 -0
  147. package/dist/{chunk-UIUXIDBX.js → chunk-CUYHST3B.js} +4 -4
  148. package/dist/{chunk-GUYVKGFN.js → chunk-DPSMX4EY.js} +0 -0
  149. package/dist/{chunk-2A4DQAXG.js → chunk-IIOLFAGJ.js} +3 -3
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  normalizePertSourceForShare,
3
3
  resolveOrgImports
4
- } from "./chunk-FPXMCGS5.js";
4
+ } from "./chunk-SLQT3JP3.js";
5
5
  import {
6
6
  decodeDiagramUrl,
7
7
  decodeViewState,
@@ -10,22 +10,26 @@ import {
10
10
  } from "./chunk-RE27AX7O.js";
11
11
  import {
12
12
  parseDgmoChartType
13
- } from "./chunk-AQIBKTPG.js";
13
+ } from "./chunk-K5XT7NHD.js";
14
14
  import {
15
15
  parseRaci
16
16
  } from "./chunk-3RYBTEF5.js";
17
- import "./chunk-UNNJCSSQ.js";
18
- import "./chunk-3TYUXC7D.js";
17
+ import "./chunk-JVZ7KFAX.js";
18
+ import "./chunk-2SKMEL7V.js";
19
19
  import "./chunk-7WGCQE2E.js";
20
20
  import "./chunk-EQW6HOP4.js";
21
21
  import "./chunk-DAOFNU6J.js";
22
- import "./chunk-VPASQOR3.js";
22
+ import {
23
+ getAvailablePalettes,
24
+ getPalette
25
+ } from "./chunk-NIUO2TNR.js";
26
+ import "./chunk-LFKSHDVI.js";
23
27
  import "./chunk-C3Z4DX3V.js";
24
28
  import "./chunk-JRUEIRJB.js";
25
29
  import "./chunk-7TF3QOOD.js";
26
30
  import "./chunk-AYOVY75O.js";
27
31
  import "./chunk-NXMESY4J.js";
28
- import "./chunk-A4XPI4YN.js";
32
+ import "./chunk-MFW6P7WH.js";
29
33
  import "./chunk-WPL5PFXE.js";
30
34
  import "./chunk-J64NZ6NF.js";
31
35
  import "./chunk-O753JUEZ.js";
@@ -44,13 +48,9 @@ import {
44
48
  parseFirstLine
45
49
  } from "./chunk-44GP7PD5.js";
46
50
  import "./chunk-5NU7NII2.js";
47
- import {
48
- getAvailablePalettes,
49
- getPalette
50
- } from "./chunk-IDJGV6VM.js";
51
51
  import {
52
52
  hexToHSLString
53
- } from "./chunk-7HWY4QAJ.js";
53
+ } from "./chunk-L24LESXF.js";
54
54
  import "./chunk-2M4IGSCY.js";
55
55
  import "./chunk-BYU54C3S.js";
56
56
  import "./chunk-5WRI5ZAA.js";
@@ -4,7 +4,7 @@ import { P as PaletteConfig } from './tag-groups-fgxWTyyB.js';
4
4
  declare function isValidHex(value: string): boolean;
5
5
  /**
6
6
  * Register a palette. Called at module initialization.
7
- * Validates that all 19 color fields per mode are present and valid hex.
7
+ * Validates that all 23 color fields per mode are present and valid hex.
8
8
  * Throws on malformed palettes to catch errors at startup, not at render time.
9
9
  */
10
10
  declare function registerPalette(palette: PaletteConfig): void;
@@ -2,24 +2,24 @@ import {
2
2
  D3_DATA_CHART_TYPES,
3
3
  renderDataChartD3,
4
4
  supportsD3DataChart
5
- } from "./chunk-H2GEIFUF.js";
5
+ } from "./chunk-3AQJNY65.js";
6
6
  import "./chunk-KMU65FYM.js";
7
7
  import "./chunk-EPDBWATV.js";
8
8
  import "./chunk-7UDAIP6W.js";
9
9
  import "./chunk-2CW5ZTNH.js";
10
- import "./chunk-RE6TVIAV.js";
11
- import "./chunk-QFIXL3OK.js";
12
- import "./chunk-3DOQOXXI.js";
13
- import "./chunk-LD2JSKU3.js";
10
+ import "./chunk-UKJLPA7R.js";
11
+ import "./chunk-SEKNYIMO.js";
12
+ import "./chunk-CNUN5GO6.js";
13
+ import "./chunk-OOCVGX4W.js";
14
14
  import "./chunk-VLC6WNRD.js";
15
- import "./chunk-FM3WAVB6.js";
15
+ import "./chunk-NS7L7YKH.js";
16
16
  import "./chunk-ICLB27PZ.js";
17
- import "./chunk-RH2PROYG.js";
18
- import "./chunk-KAO7JL4I.js";
17
+ import "./chunk-NIUO2TNR.js";
19
18
  import "./chunk-L5AFONQU.js";
20
19
  import "./chunk-44GP7PD5.js";
21
- import "./chunk-IDJGV6VM.js";
22
- import "./chunk-7HWY4QAJ.js";
20
+ import "./chunk-I6GGMCTV.js";
21
+ import "./chunk-KAO7JL4I.js";
22
+ import "./chunk-L24LESXF.js";
23
23
  import "./chunk-2M4IGSCY.js";
24
24
  import "./chunk-BYU54C3S.js";
25
25
  import "./chunk-5WRI5ZAA.js";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-XCKNFFKM.js";
19
19
  import {
20
20
  layoutInlineHeader
21
- } from "./chunk-3DOQOXXI.js";
21
+ } from "./chunk-CNUN5GO6.js";
22
22
  import {
23
23
  TITLE_FONT_SIZE,
24
24
  TITLE_FONT_WEIGHT,
@@ -26,20 +26,14 @@ import {
26
26
  } from "./chunk-VLC6WNRD.js";
27
27
  import {
28
28
  renderIntegratedLegend
29
- } from "./chunk-LHL6HDUL.js";
29
+ } from "./chunk-7SX4IY6T.js";
30
30
  import {
31
31
  getLegendExtent,
32
32
  getMaxLegendReservedHeight
33
- } from "./chunk-FM3WAVB6.js";
33
+ } from "./chunk-NS7L7YKH.js";
34
34
  import {
35
35
  FONT_FAMILY
36
36
  } from "./chunk-ICLB27PZ.js";
37
- import {
38
- LEGEND_GROUP_GAP
39
- } from "./chunk-RH2PROYG.js";
40
- import {
41
- measureText
42
- } from "./chunk-KAO7JL4I.js";
43
37
  import {
44
38
  UNTAGGED_TAG_COLOR,
45
39
  resolveTagColor,
@@ -50,12 +44,18 @@ import {
50
44
  legendInlineRequested,
51
45
  legendSuppressed
52
46
  } from "./chunk-44GP7PD5.js";
47
+ import {
48
+ LEGEND_GROUP_GAP
49
+ } from "./chunk-I6GGMCTV.js";
50
+ import {
51
+ measureText
52
+ } from "./chunk-KAO7JL4I.js";
53
53
  import {
54
54
  contrastText,
55
55
  mix,
56
56
  shapeFill,
57
57
  themeBaseBg
58
- } from "./chunk-7HWY4QAJ.js";
58
+ } from "./chunk-L24LESXF.js";
59
59
  import {
60
60
  resolveColor
61
61
  } from "./chunk-2M4IGSCY.js";
@@ -25,10 +25,10 @@ import {
25
25
  initD3Chart,
26
26
  renderChartTitle,
27
27
  resolveExportPalette
28
- } from "./chunk-RE6TVIAV.js";
28
+ } from "./chunk-UKJLPA7R.js";
29
29
  import {
30
30
  layoutInlineHeader
31
- } from "./chunk-3DOQOXXI.js";
31
+ } from "./chunk-CNUN5GO6.js";
32
32
  import {
33
33
  TITLE_FONT_SIZE,
34
34
  TITLE_FONT_WEIGHT,
@@ -37,23 +37,23 @@ import {
37
37
  } from "./chunk-VLC6WNRD.js";
38
38
  import {
39
39
  computeLegendLayout
40
- } from "./chunk-FM3WAVB6.js";
40
+ } from "./chunk-NS7L7YKH.js";
41
41
  import {
42
42
  FONT_FAMILY
43
43
  } from "./chunk-ICLB27PZ.js";
44
+ import {
45
+ tagAttrKey
46
+ } from "./chunk-L5AFONQU.js";
44
47
  import {
45
48
  LEGEND_DOT_R,
46
49
  LEGEND_ENTRY_FONT_SIZE,
47
50
  LEGEND_HEIGHT,
48
51
  LEGEND_PILL_FONT_SIZE,
49
52
  legendChromeColors
50
- } from "./chunk-RH2PROYG.js";
53
+ } from "./chunk-I6GGMCTV.js";
51
54
  import {
52
55
  measureText
53
56
  } from "./chunk-KAO7JL4I.js";
54
- import {
55
- tagAttrKey
56
- } from "./chunk-L5AFONQU.js";
57
57
  import {
58
58
  contrastText,
59
59
  getSegmentColors,
@@ -63,7 +63,7 @@ import {
63
63
  mix,
64
64
  shapeFill,
65
65
  themeBaseBg
66
- } from "./chunk-7HWY4QAJ.js";
66
+ } from "./chunk-L24LESXF.js";
67
67
 
68
68
  // src/charts-d3/natural-size.ts
69
69
  var UNCOUNTED_WIDTH = 720;
@@ -0,0 +1,438 @@
1
+ import {
2
+ renderInlineText
3
+ } from "./chunk-S7W75MIM.js";
4
+ import {
5
+ BOX_H,
6
+ BOX_W,
7
+ COMMENT_W,
8
+ PAIR_GAP,
9
+ layoutBracket,
10
+ wrapText
11
+ } from "./chunk-ABP5BUD6.js";
12
+ import {
13
+ layoutInlineHeader
14
+ } from "./chunk-CNUN5GO6.js";
15
+ import {
16
+ TITLE_FONT_SIZE,
17
+ TITLE_FONT_WEIGHT,
18
+ TITLE_Y
19
+ } from "./chunk-VLC6WNRD.js";
20
+ import {
21
+ renderIntegratedLegend
22
+ } from "./chunk-7SX4IY6T.js";
23
+ import {
24
+ getLegendExtent,
25
+ getMaxLegendReservedHeight
26
+ } from "./chunk-NS7L7YKH.js";
27
+ import {
28
+ FONT_FAMILY
29
+ } from "./chunk-ICLB27PZ.js";
30
+ import {
31
+ resolveTagColor,
32
+ tagAttrKey
33
+ } from "./chunk-L5AFONQU.js";
34
+ import {
35
+ LEGEND_GROUP_GAP
36
+ } from "./chunk-I6GGMCTV.js";
37
+ import {
38
+ measureText
39
+ } from "./chunk-KAO7JL4I.js";
40
+ import {
41
+ contrastText,
42
+ getSeriesColors,
43
+ mix,
44
+ shapeFill,
45
+ themeBaseBg
46
+ } from "./chunk-L24LESXF.js";
47
+ import {
48
+ resolveColor
49
+ } from "./chunk-2M4IGSCY.js";
50
+
51
+ // src/bracket/renderer.ts
52
+ import * as d3Selection from "d3-selection";
53
+ var PADDING = 16;
54
+ var TITLE_BAND = 40;
55
+ var HALF_SPAN = (BOX_H + PAIR_GAP) / 2;
56
+ var COMMENT_LH = 15;
57
+ var LEGEND_POSITION = {
58
+ placement: "top-center",
59
+ titleRelation: "below-title"
60
+ };
61
+ function clip(s, maxW, fs, bold) {
62
+ if (measureText(s, fs, { bold }) <= maxW) return s;
63
+ let lo = 0;
64
+ let hi = s.length;
65
+ while (lo < hi) {
66
+ const mid = Math.ceil((lo + hi) / 2);
67
+ if (measureText(s.slice(0, mid) + "\u2026", fs, { bold }) <= maxW) lo = mid;
68
+ else hi = mid - 1;
69
+ }
70
+ return lo <= 0 ? "" : s.slice(0, lo) + "\u2026";
71
+ }
72
+ function paintForAccent(palette, isDark, accent, fillMode) {
73
+ const base = themeBaseBg(palette, isDark);
74
+ return {
75
+ accent,
76
+ ink: palette.text,
77
+ muted: mix(palette.text, base, 52),
78
+ // Loser / TBD outlines + connectors are ink-based (not the pale border) so
79
+ // they stay legible on top of a colored, shaded column band.
80
+ hair: mix(palette.text, base, 34),
81
+ wire: mix(palette.text, base, 30),
82
+ track: mix(palette.border, base, 55),
83
+ // §1.9 fill family rides through shapeFill: solid ⇒ raw accent,
84
+ // outline ⇒ theme base bg (accent stays on the stroke), absent ⇒ 25% tint.
85
+ tint: shapeFill(palette, accent, isDark, { mode: fillMode })
86
+ };
87
+ }
88
+ function paintFor(palette, isDark, sideColor, fillMode) {
89
+ const accent = sideColor && resolveColor(sideColor, palette) || sideColor || getSeriesColors(palette)[0];
90
+ return paintForAccent(palette, isDark, accent, fillMode);
91
+ }
92
+ function resolveBracketLegend(parsed, palette) {
93
+ const activeTag = parsed.activeTag;
94
+ const activeGroup = activeTag ? parsed.tagGroups.find((g) => tagAttrKey(g.name) === tagAttrKey(activeTag)) : void 0;
95
+ const legendGroups = activeGroup && !parsed.noLegend ? [
96
+ {
97
+ name: activeGroup.name,
98
+ entries: activeGroup.entries.map((e) => ({
99
+ value: e.value,
100
+ color: resolveColor(e.color, palette) ?? e.color
101
+ }))
102
+ }
103
+ ] : [];
104
+ return { activeGroup, legendGroups };
105
+ }
106
+ function bracketExportDimensions(parsed, palette) {
107
+ const layout = layoutBracket(parsed);
108
+ const width = layout.width + PADDING * 2;
109
+ const titleH = parsed.title ? TITLE_BAND : 0;
110
+ const { legendGroups } = resolveBracketLegend(parsed, palette);
111
+ const legendReserve = legendGroups.length > 0 ? getMaxLegendReservedHeight(
112
+ { groups: legendGroups, position: LEGEND_POSITION, mode: "export" },
113
+ width
114
+ ) + LEGEND_GROUP_GAP : 0;
115
+ const height = titleH + legendReserve + PADDING + layout.height + PADDING;
116
+ return { width, height };
117
+ }
118
+ function renderBracket(container, parsed, palette, isDark, exportDims) {
119
+ d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
120
+ if (parsed.error) return;
121
+ const layout = layoutBracket(parsed);
122
+ const width = exportDims?.width ?? container.clientWidth;
123
+ const height = exportDims?.height ?? container.clientHeight;
124
+ if (width <= 0 || height <= 0) return;
125
+ const showTitle = !!parsed.title;
126
+ const titleH = showTitle ? TITLE_BAND : 0;
127
+ const exportMode = exportDims !== void 0;
128
+ const seedByName = /* @__PURE__ */ new Map();
129
+ for (const s of parsed.seeds)
130
+ if (!seedByName.has(s.name)) seedByName.set(s.name, s.seed);
131
+ const activeTag = parsed.activeTag;
132
+ const activeKey = activeTag ? tagAttrKey(activeTag) : null;
133
+ const tagValueOf = (name) => {
134
+ if (!name || !activeKey) return null;
135
+ const meta = parsed.competitorMeta.get(name);
136
+ return meta?.[activeKey] ?? null;
137
+ };
138
+ const tagColorOf = (name) => {
139
+ if (!name || !activeTag) return null;
140
+ const meta = parsed.competitorMeta.get(name);
141
+ if (!meta || !activeKey || !meta[activeKey]) return null;
142
+ const c = resolveTagColor(meta, [...parsed.tagGroups], activeTag);
143
+ return c ? resolveColor(c, palette) ?? c : null;
144
+ };
145
+ const { activeGroup, legendGroups } = resolveBracketLegend(parsed, palette);
146
+ const legendReserve = legendGroups.length > 0 ? getMaxLegendReservedHeight(
147
+ { groups: legendGroups, position: LEGEND_POSITION, mode: "preview" },
148
+ width
149
+ ) + LEGEND_GROUP_GAP : 0;
150
+ const inlineRequested = parsed.legendInline === true;
151
+ const legendExtent = inlineRequested && legendGroups.length > 0 ? getLegendExtent(
152
+ {
153
+ groups: legendGroups,
154
+ position: {
155
+ placement: "top-center",
156
+ titleRelation: "inline-with-title"
157
+ },
158
+ mode: exportMode ? "export" : "preview"
159
+ },
160
+ { activeGroup: activeGroup?.name ?? null },
161
+ width
162
+ ) : { width: 0, height: 0 };
163
+ const header = layoutInlineHeader({
164
+ requested: inlineRequested,
165
+ title: parsed.title ?? "",
166
+ hasLegend: legendGroups.length > 0,
167
+ legendWidth: legendExtent.width,
168
+ legendHeight: legendExtent.height,
169
+ containerWidth: width,
170
+ titleBandHeight: titleH,
171
+ legendReserve,
172
+ titleBaselineY: TITLE_Y,
173
+ titleFontSize: TITLE_FONT_SIZE
174
+ });
175
+ 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-bracket").attr("role", "img").attr(
176
+ "aria-label",
177
+ `Tournament bracket${parsed.title ? ` \u2014 ${parsed.title}` : ""}${layout.champion ? `, champion ${layout.champion}` : ""}`
178
+ ).style("font-family", FONT_FAMILY);
179
+ if (showTitle) {
180
+ const t = svg.append("text").attr("class", "chart-title").attr("x", header.titleX).attr("y", TITLE_Y).attr("text-anchor", header.titleAnchor).attr("fill", palette.text).attr("font-family", FONT_FAMILY).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", TITLE_FONT_WEIGHT).text(parsed.title);
181
+ if (parsed.titleLineNumber !== null)
182
+ t.attr("data-line-number", parsed.titleLineNumber);
183
+ }
184
+ const areaY = (header.inline ? titleH : titleH + legendReserve) + PADDING;
185
+ const areaX = PADDING;
186
+ const areaW = Math.max(1, width - PADDING * 2);
187
+ const areaH = Math.max(1, height - areaY - PADDING);
188
+ const scale = Math.min(1, areaW / layout.width, areaH / layout.height);
189
+ const offsetX = areaX + (areaW - layout.width * scale) / 2;
190
+ const offsetY = areaY;
191
+ const root = svg.append("g").attr("class", "dgmo-bracket-body").attr("transform", `translate(${offsetX},${offsetY}) scale(${scale})`);
192
+ if (legendGroups.length > 0) {
193
+ const legendG = svg.append("g").attr("class", "dgmo-bracket-legend").attr(
194
+ "transform",
195
+ header.inline ? `translate(${header.legendX}, ${header.legendY})` : `translate(0, ${titleH})`
196
+ );
197
+ renderIntegratedLegend(legendG, {
198
+ groups: legendGroups,
199
+ palette: {
200
+ bg: palette.bg,
201
+ surface: palette.surface,
202
+ text: palette.text,
203
+ textMuted: palette.textMuted,
204
+ primary: palette.primary
205
+ },
206
+ isDark,
207
+ width,
208
+ mode: exportMode ? "export" : "preview",
209
+ position: {
210
+ placement: "top-center",
211
+ titleRelation: header.inline ? "inline-with-title" : "below-title"
212
+ },
213
+ activeGroup: activeGroup?.name ?? null
214
+ });
215
+ }
216
+ const baseAccent = parsed.accentColor ?? resolveColor("blue", palette) ?? getSeriesColors(palette)[0];
217
+ const fillMode = parsed.fillMode;
218
+ const basePaint = paintForAccent(palette, isDark, baseAccent, fillMode);
219
+ const sideColorByLabel = /* @__PURE__ */ new Map();
220
+ for (const s of parsed.sides) sideColorByLabel.set(s.label, s.color);
221
+ const sideBarH = layout.sideLabels.length ? 30 : 0;
222
+ const bandTop = sideBarH + 2;
223
+ const roundY = sideBarH + 24;
224
+ for (const col of layout.columns) {
225
+ if (!col.color) continue;
226
+ const covered = layout.sideLabels.some(
227
+ (s) => col.x >= s.x0 && col.x <= s.x1
228
+ );
229
+ const top = covered ? bandTop : 2;
230
+ const c = resolveColor(col.color, palette) ?? col.color;
231
+ root.append("rect").attr("x", col.x - BOX_W / 2 - 10).attr("y", top).attr("width", BOX_W + 20).attr("height", Math.max(0, layout.height - top)).attr("rx", 10).attr(
232
+ "fill",
233
+ fillMode === "outline" ? themeBaseBg(palette, isDark) : mix(c, palette.bg, isDark ? 12 : 8)
234
+ ).call((sel) => {
235
+ if (fillMode === "outline")
236
+ sel.attr("stroke", mix(c, palette.bg, 35)).attr("stroke-width", 1);
237
+ });
238
+ }
239
+ for (const s of layout.sideLabels) {
240
+ const c = s.color ? resolveColor(s.color, palette) ?? s.color : basePaint.accent;
241
+ root.append("rect").attr("x", s.x0 - 8).attr("y", 2).attr("width", s.x1 - s.x0 + 16).attr("height", 24).attr("rx", 8).attr(
242
+ "fill",
243
+ fillMode === "outline" ? themeBaseBg(palette, isDark) : mix(c, palette.bg, isDark ? 20 : 14)
244
+ ).attr("stroke", fillMode === "outline" ? c : mix(c, palette.bg, 55)).attr("stroke-width", 1);
245
+ root.append("text").attr("x", (s.x0 + s.x1) / 2).attr("y", 18).attr("text-anchor", "middle").attr("font-size", 13).attr("font-weight", "bold").attr("letter-spacing", 0.3).attr("fill", c).text(clip(s.label, s.x1 - s.x0, 13, true));
246
+ }
247
+ for (const col of layout.columns) {
248
+ const c = col.color ? resolveColor(col.color, palette) ?? col.color : basePaint.muted;
249
+ const covered = layout.sideLabels.some(
250
+ (s) => col.x >= s.x0 && col.x <= s.x1
251
+ );
252
+ root.append("text").attr("x", col.x).attr("y", covered ? roundY : 22).attr("text-anchor", "middle").attr("font-size", covered ? 14 : 15).attr("font-weight", "bold").attr("fill", c).attr("letter-spacing", 0.4).text(clip(col.label, BOX_W + 20, covered ? 14 : 15, true));
253
+ }
254
+ for (const m of layout.matches) {
255
+ drawConnector(root, m, m.topFrom, m.y - HALF_SPAN, basePaint);
256
+ drawConnector(root, m, m.botFrom, m.y + HALF_SPAN, basePaint);
257
+ }
258
+ for (const m of layout.matches) {
259
+ const sidePaint = m.side && sideColorByLabel.get(m.side) ? paintFor(palette, isDark, sideColorByLabel.get(m.side), fillMode) : basePaint;
260
+ const topSeed = seedByName.get(m.top ?? "") ?? null;
261
+ const botSeed = seedByName.get(m.bot ?? "") ?? null;
262
+ let homeName = m.home;
263
+ if (!homeName && topSeed !== null && botSeed !== null) {
264
+ homeName = topSeed <= botSeed ? m.top : m.bot;
265
+ }
266
+ const [wSeed, lSeed] = m.winner === "top" ? [topSeed, botSeed] : m.winner === "bot" ? [botSeed, topSeed] : [null, null];
267
+ const isUpset = wSeed !== null && lSeed !== null && wSeed > lSeed && !m.isChampionship;
268
+ const scoreParts = m.score ? m.score.split(/[-–]/).map((p) => p.trim()) : null;
269
+ const winScore = scoreParts?.length === 2 ? scoreParts[0] : "";
270
+ const loseScore = scoreParts?.length === 2 ? scoreParts[1] : "";
271
+ const champWinner = m.isChampionship ? layout.champion : null;
272
+ const mkInfo = (side, name) => {
273
+ const isWinner = m.winner === side;
274
+ const isLoser = m.winner !== null && m.winner !== side;
275
+ return {
276
+ isWinner,
277
+ isLoser,
278
+ pending: m.pending,
279
+ isChampion: champWinner !== null && isWinner,
280
+ score: isWinner ? winScore : isLoser ? loseScore : "",
281
+ seed: seedByName.get(name ?? "") ?? null,
282
+ tagColor: tagColorOf(name),
283
+ tagValue: tagValueOf(name),
284
+ isHome: homeName !== null && homeName === name
285
+ };
286
+ };
287
+ drawBox(
288
+ root,
289
+ m.x,
290
+ m.y - HALF_SPAN,
291
+ m.top,
292
+ mkInfo("top", m.top),
293
+ sidePaint,
294
+ palette,
295
+ isDark,
296
+ m,
297
+ activeKey,
298
+ fillMode
299
+ );
300
+ drawBox(
301
+ root,
302
+ m.x,
303
+ m.y + HALF_SPAN,
304
+ m.bot,
305
+ mkInfo("bot", m.bot),
306
+ sidePaint,
307
+ palette,
308
+ isDark,
309
+ m,
310
+ activeKey,
311
+ fillMode
312
+ );
313
+ if (isUpset) drawUpset(root, m, sidePaint);
314
+ if (m.commentary.length) drawCommentary(root, m, palette);
315
+ }
316
+ }
317
+ function drawConnector(g, m, from, toCy, paint) {
318
+ if (!from) return;
319
+ const parentLeft = m.x - BOX_W / 2;
320
+ const parentRight = m.x + BOX_W / 2;
321
+ const childIsLeft = from.x < m.x;
322
+ const childEdge = childIsLeft ? from.x + BOX_W / 2 : from.x - BOX_W / 2;
323
+ const parentEdge = childIsLeft ? parentLeft : parentRight;
324
+ const midX = (childEdge + parentEdge) / 2;
325
+ const vLo = Math.min(from.yA, from.yB, toCy);
326
+ const vHi = Math.max(from.yA, from.yB, toCy);
327
+ const d = from.yA !== from.yB ? `M ${childEdge} ${from.yA} H ${midX} M ${childEdge} ${from.yB} H ${midX} M ${midX} ${vLo} V ${vHi} M ${midX} ${toCy} H ${parentEdge}` : `M ${childEdge} ${from.y} H ${midX} V ${toCy} H ${parentEdge}`;
328
+ g.append("path").attr("d", d).attr("fill", "none").attr("stroke", paint.wire).attr("stroke-width", 1.5);
329
+ }
330
+ function drawBox(g, cx, cy, name, info, sidePaint, palette, isDark, m, activeKey, fillMode) {
331
+ const x = cx - BOX_W / 2;
332
+ const y = cy - BOX_H / 2;
333
+ const paint = info.tagColor ? paintForAccent(palette, isDark, info.tagColor, fillMode) : sidePaint;
334
+ const cell = g.append("g").attr("class", "dgmo-bracket-box");
335
+ if (m.lineNumber !== null) cell.attr("data-line-number", m.lineNumber);
336
+ if (activeKey && info.tagValue)
337
+ cell.attr(`data-tag-${activeKey}`, info.tagValue.toLowerCase());
338
+ const isTBD = name === null;
339
+ let fill = "none";
340
+ let stroke = paint.hair;
341
+ let sw = 1.25;
342
+ let dash = null;
343
+ let textColor = paint.ink;
344
+ let weight = "bold";
345
+ if (info.isChampion) {
346
+ fill = paint.tint;
347
+ stroke = paint.accent;
348
+ sw = 3;
349
+ weight = "bold";
350
+ } else if (isTBD) {
351
+ fill = paint.track;
352
+ dash = "4 4";
353
+ textColor = paint.muted;
354
+ weight = "normal";
355
+ } else if (info.isWinner) {
356
+ fill = paint.tint;
357
+ stroke = paint.accent;
358
+ sw = 2;
359
+ weight = "bold";
360
+ } else if (info.isLoser) {
361
+ stroke = paint.hair;
362
+ textColor = paint.muted;
363
+ weight = "normal";
364
+ } else if (info.pending) {
365
+ stroke = mix(paint.accent, paint.hair, 50);
366
+ }
367
+ const onSolid = fillMode === "solid" && (info.isChampion || info.isWinner) ? contrastText(
368
+ paint.tint,
369
+ palette.textOnFillLight,
370
+ palette.textOnFillDark
371
+ ) : null;
372
+ if (onSolid) textColor = onSolid;
373
+ const gutterColor = onSolid ?? paint.muted;
374
+ const rect = cell.append("rect").attr("x", x).attr("y", y).attr("width", BOX_W).attr("height", BOX_H).attr("rx", 6).attr("fill", fill).attr("stroke", stroke).attr("stroke-width", sw);
375
+ if (dash) rect.attr("stroke-dasharray", dash);
376
+ let leftPad = 11;
377
+ if (info.seed !== null) {
378
+ cell.append("text").attr("x", x + 9).attr("y", cy + 4).attr("text-anchor", "start").attr("font-size", 10).attr("font-weight", "bold").attr("fill", gutterColor).text(info.seed);
379
+ leftPad = 9 + Math.max(12, measureText(String(info.seed), 10, { bold: true })) + 6;
380
+ }
381
+ let rightPad = 11;
382
+ if (info.score) rightPad += 20;
383
+ if (info.isHome) {
384
+ drawHome(cell, x + BOX_W - rightPad - 6, cy, gutterColor);
385
+ rightPad += 16;
386
+ }
387
+ cell.append("text").attr("x", x + leftPad).attr("y", cy + 4).attr("text-anchor", "start").attr("font-size", 12.5).attr("font-weight", weight).attr("fill", textColor).text(
388
+ clip(
389
+ isTBD ? "TBD" : name,
390
+ BOX_W - leftPad - rightPad,
391
+ 12.5,
392
+ weight === "bold"
393
+ )
394
+ );
395
+ if (info.score) {
396
+ cell.append("text").attr("x", x + BOX_W - 11).attr("y", cy + 4).attr("text-anchor", "end").attr("font-size", 12).attr("font-weight", info.isWinner ? "bold" : "normal").attr("fill", info.isWinner ? textColor : gutterColor).text(info.score);
397
+ }
398
+ }
399
+ function drawHome(cell, hx, cy, color) {
400
+ const s = 5;
401
+ const yTop = cy - s - 1;
402
+ const d = `M ${hx - s} ${cy - 1} L ${hx} ${yTop} L ${hx + s} ${cy - 1} L ${hx + s} ${cy + s} L ${hx - s} ${cy + s} Z`;
403
+ cell.append("path").attr("d", d).attr("fill", "none").attr("stroke", color).attr("stroke-width", 1.2).attr("stroke-linejoin", "round");
404
+ }
405
+ function drawUpset(g, m, paint) {
406
+ g.append("text").attr("x", m.x + BOX_W / 2).attr("y", m.y - HALF_SPAN - BOX_H / 2 - 4).attr("text-anchor", "end").attr("font-size", 9).attr("font-weight", "bold").attr("letter-spacing", 0.6).attr("fill", paint.accent).text("UPSET");
407
+ }
408
+ function drawCommentary(g, m, palette) {
409
+ const x = m.x - BOX_W / 2 + 2;
410
+ let y = m.y + HALF_SPAN + BOX_H / 2 + 13;
411
+ const muted = mix(palette.text, palette.bg, 45);
412
+ const bulletW = measureText("\u2022 ", 11);
413
+ const emit = (line, lx) => {
414
+ const t = g.append("text").attr("x", lx).attr("y", y).attr("text-anchor", "start").attr("font-size", 11).attr("font-style", "italic").attr("fill", muted);
415
+ renderInlineText(t, line, palette, 11);
416
+ y += COMMENT_LH;
417
+ };
418
+ for (const raw of m.commentary) {
419
+ const isBullet = raw.startsWith("\u2022 ");
420
+ if (isBullet) {
421
+ const body = raw.slice(2);
422
+ wrapText(body, COMMENT_W - bulletW, 11).forEach(
423
+ (line, i) => i === 0 ? emit(`\u2022 ${line}`, x) : emit(line, x + bulletW)
424
+ );
425
+ } else {
426
+ for (const line of wrapText(raw, COMMENT_W, 11)) emit(line, x);
427
+ }
428
+ }
429
+ }
430
+ function renderBracketForExport(container, parsed, palette, isDark, exportDims) {
431
+ renderBracket(container, parsed, palette, isDark, exportDims);
432
+ }
433
+
434
+ export {
435
+ bracketExportDimensions,
436
+ renderBracket,
437
+ renderBracketForExport
438
+ };