@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,51 +1,10 @@
1
- import {
2
- renderInlineText
3
- } from "./chunk-S7W75MIM.js";
4
- import {
5
- layoutInlineHeader
6
- } from "./chunk-3DOQOXXI.js";
7
- import {
8
- TITLE_FONT_SIZE,
9
- TITLE_FONT_WEIGHT,
10
- TITLE_Y
11
- } from "./chunk-VLC6WNRD.js";
12
- import {
13
- renderIntegratedLegend
14
- } from "./chunk-LHL6HDUL.js";
15
- import {
16
- getLegendExtent,
17
- getMaxLegendReservedHeight
18
- } from "./chunk-FM3WAVB6.js";
19
- import {
20
- FONT_FAMILY
21
- } from "./chunk-ICLB27PZ.js";
22
- import {
23
- LEGEND_GROUP_GAP
24
- } from "./chunk-RH2PROYG.js";
25
1
  import {
26
2
  measureText
27
3
  } from "./chunk-KAO7JL4I.js";
28
- import {
29
- resolveTagColor,
30
- tagAttrKey
31
- } from "./chunk-L5AFONQU.js";
32
- import {
33
- contrastText,
34
- getSeriesColors,
35
- mix,
36
- shapeFill,
37
- themeBaseBg
38
- } from "./chunk-7HWY4QAJ.js";
39
- import {
40
- resolveColor
41
- } from "./chunk-2M4IGSCY.js";
42
4
  import {
43
5
  makeDgmoError
44
6
  } from "./chunk-BYU54C3S.js";
45
7
 
46
- // src/bracket/renderer.ts
47
- import * as d3Selection from "d3-selection";
48
-
49
8
  // src/bracket/layout.ts
50
9
  var BOX_W = 176;
51
10
  var BOX_H = 30;
@@ -390,8 +349,8 @@ function layoutBracket(parsed) {
390
349
  (g) => g.built.nodes.map((n) => commentaryLineCount(n.commentary))
391
350
  )
392
351
  );
393
- const COMMENT_LH2 = 15;
394
- const rowScale = maxComment > 0 ? Math.max(ROW, 2 * BOX_H + PAIR_GAP + maxComment * COMMENT_LH2 + 16) : ROW;
352
+ const COMMENT_LH = 15;
353
+ const rowScale = maxComment > 0 ? Math.max(ROW, 2 * BOX_H + PAIR_GAP + maxComment * COMMENT_LH + 16) : ROW;
395
354
  for (const g of groups) positionSide(g.built, rowScale);
396
355
  const champResults = parsed.matches.filter(
397
356
  (m) => m.side === null && parsed.sides.length >= 1
@@ -560,7 +519,7 @@ function layoutBracket(parsed) {
560
519
  const wl = commentaryLineCount(m.commentary);
561
520
  maxY = Math.max(
562
521
  maxY,
563
- m.y + half + BOX_H / 2 + 13 + (wl - 1) * COMMENT_LH2 + 4
522
+ m.y + half + BOX_H / 2 + 13 + (wl - 1) * COMMENT_LH + 4
564
523
  );
565
524
  }
566
525
  }
@@ -613,391 +572,11 @@ function layoutBracket(parsed) {
613
572
  };
614
573
  }
615
574
 
616
- // src/bracket/renderer.ts
617
- var PADDING = 16;
618
- var TITLE_BAND = 40;
619
- var HALF_SPAN2 = (BOX_H + PAIR_GAP) / 2;
620
- var COMMENT_LH = 15;
621
- var LEGEND_POSITION = {
622
- placement: "top-center",
623
- titleRelation: "below-title"
624
- };
625
- function clip(s, maxW, fs, bold) {
626
- if (measureText(s, fs, { bold }) <= maxW) return s;
627
- let lo = 0;
628
- let hi = s.length;
629
- while (lo < hi) {
630
- const mid = Math.ceil((lo + hi) / 2);
631
- if (measureText(s.slice(0, mid) + "\u2026", fs, { bold }) <= maxW) lo = mid;
632
- else hi = mid - 1;
633
- }
634
- return lo <= 0 ? "" : s.slice(0, lo) + "\u2026";
635
- }
636
- function paintForAccent(palette, isDark, accent, fillMode) {
637
- const base = themeBaseBg(palette, isDark);
638
- return {
639
- accent,
640
- ink: palette.text,
641
- muted: mix(palette.text, base, 52),
642
- // Loser / TBD outlines + connectors are ink-based (not the pale border) so
643
- // they stay legible on top of a colored, shaded column band.
644
- hair: mix(palette.text, base, 34),
645
- wire: mix(palette.text, base, 30),
646
- track: mix(palette.border, base, 55),
647
- // §1.9 fill family rides through shapeFill: solid ⇒ raw accent,
648
- // outline ⇒ theme base bg (accent stays on the stroke), absent ⇒ 25% tint.
649
- tint: shapeFill(palette, accent, isDark, { mode: fillMode })
650
- };
651
- }
652
- function paintFor(palette, isDark, sideColor, fillMode) {
653
- const accent = sideColor && resolveColor(sideColor, palette) || sideColor || getSeriesColors(palette)[0];
654
- return paintForAccent(palette, isDark, accent, fillMode);
655
- }
656
- function resolveBracketLegend(parsed, palette) {
657
- const activeTag = parsed.activeTag;
658
- const activeGroup = activeTag ? parsed.tagGroups.find((g) => tagAttrKey(g.name) === tagAttrKey(activeTag)) : void 0;
659
- const legendGroups = activeGroup && !parsed.noLegend ? [
660
- {
661
- name: activeGroup.name,
662
- entries: activeGroup.entries.map((e) => ({
663
- value: e.value,
664
- color: resolveColor(e.color, palette) ?? e.color
665
- }))
666
- }
667
- ] : [];
668
- return { activeGroup, legendGroups };
669
- }
670
- function bracketExportDimensions(parsed, palette) {
671
- const layout = layoutBracket(parsed);
672
- const width = layout.width + PADDING * 2;
673
- const titleH = parsed.title ? TITLE_BAND : 0;
674
- const { legendGroups } = resolveBracketLegend(parsed, palette);
675
- const legendReserve = legendGroups.length > 0 ? getMaxLegendReservedHeight(
676
- { groups: legendGroups, position: LEGEND_POSITION, mode: "export" },
677
- width
678
- ) + LEGEND_GROUP_GAP : 0;
679
- const height = titleH + legendReserve + PADDING + layout.height + PADDING;
680
- return { width, height };
681
- }
682
- function renderBracket(container, parsed, palette, isDark, exportDims) {
683
- d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
684
- if (parsed.error) return;
685
- const layout = layoutBracket(parsed);
686
- const width = exportDims?.width ?? container.clientWidth;
687
- const height = exportDims?.height ?? container.clientHeight;
688
- if (width <= 0 || height <= 0) return;
689
- const showTitle = !!parsed.title;
690
- const titleH = showTitle ? TITLE_BAND : 0;
691
- const exportMode = exportDims !== void 0;
692
- const seedByName = /* @__PURE__ */ new Map();
693
- for (const s of parsed.seeds)
694
- if (!seedByName.has(s.name)) seedByName.set(s.name, s.seed);
695
- const activeTag = parsed.activeTag;
696
- const activeKey = activeTag ? tagAttrKey(activeTag) : null;
697
- const tagValueOf = (name) => {
698
- if (!name || !activeKey) return null;
699
- const meta = parsed.competitorMeta.get(name);
700
- return meta?.[activeKey] ?? null;
701
- };
702
- const tagColorOf = (name) => {
703
- if (!name || !activeTag) return null;
704
- const meta = parsed.competitorMeta.get(name);
705
- if (!meta || !activeKey || !meta[activeKey]) return null;
706
- const c = resolveTagColor(meta, [...parsed.tagGroups], activeTag);
707
- return c ? resolveColor(c, palette) ?? c : null;
708
- };
709
- const { activeGroup, legendGroups } = resolveBracketLegend(parsed, palette);
710
- const legendReserve = legendGroups.length > 0 ? getMaxLegendReservedHeight(
711
- { groups: legendGroups, position: LEGEND_POSITION, mode: "preview" },
712
- width
713
- ) + LEGEND_GROUP_GAP : 0;
714
- const inlineRequested = parsed.legendInline === true;
715
- const legendExtent = inlineRequested && legendGroups.length > 0 ? getLegendExtent(
716
- {
717
- groups: legendGroups,
718
- position: {
719
- placement: "top-center",
720
- titleRelation: "inline-with-title"
721
- },
722
- mode: exportMode ? "export" : "preview"
723
- },
724
- { activeGroup: activeGroup?.name ?? null },
725
- width
726
- ) : { width: 0, height: 0 };
727
- const header = layoutInlineHeader({
728
- requested: inlineRequested,
729
- title: parsed.title ?? "",
730
- hasLegend: legendGroups.length > 0,
731
- legendWidth: legendExtent.width,
732
- legendHeight: legendExtent.height,
733
- containerWidth: width,
734
- titleBandHeight: titleH,
735
- legendReserve,
736
- titleBaselineY: TITLE_Y,
737
- titleFontSize: TITLE_FONT_SIZE
738
- });
739
- 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(
740
- "aria-label",
741
- `Tournament bracket${parsed.title ? ` \u2014 ${parsed.title}` : ""}${layout.champion ? `, champion ${layout.champion}` : ""}`
742
- ).style("font-family", FONT_FAMILY);
743
- if (showTitle) {
744
- 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);
745
- if (parsed.titleLineNumber !== null)
746
- t.attr("data-line-number", parsed.titleLineNumber);
747
- }
748
- const areaY = (header.inline ? titleH : titleH + legendReserve) + PADDING;
749
- const areaX = PADDING;
750
- const areaW = Math.max(1, width - PADDING * 2);
751
- const areaH = Math.max(1, height - areaY - PADDING);
752
- const scale = Math.min(1, areaW / layout.width, areaH / layout.height);
753
- const offsetX = areaX + (areaW - layout.width * scale) / 2;
754
- const offsetY = areaY;
755
- const root = svg.append("g").attr("class", "dgmo-bracket-body").attr("transform", `translate(${offsetX},${offsetY}) scale(${scale})`);
756
- if (legendGroups.length > 0) {
757
- const legendG = svg.append("g").attr("class", "dgmo-bracket-legend").attr(
758
- "transform",
759
- header.inline ? `translate(${header.legendX}, ${header.legendY})` : `translate(0, ${titleH})`
760
- );
761
- renderIntegratedLegend(legendG, {
762
- groups: legendGroups,
763
- palette: {
764
- bg: palette.bg,
765
- surface: palette.surface,
766
- text: palette.text,
767
- textMuted: palette.textMuted,
768
- primary: palette.primary
769
- },
770
- isDark,
771
- width,
772
- mode: exportMode ? "export" : "preview",
773
- position: {
774
- placement: "top-center",
775
- titleRelation: header.inline ? "inline-with-title" : "below-title"
776
- },
777
- activeGroup: activeGroup?.name ?? null
778
- });
779
- }
780
- const baseAccent = parsed.accentColor ?? resolveColor("blue", palette) ?? getSeriesColors(palette)[0];
781
- const fillMode = parsed.fillMode;
782
- const basePaint = paintForAccent(palette, isDark, baseAccent, fillMode);
783
- const sideColorByLabel = /* @__PURE__ */ new Map();
784
- for (const s of parsed.sides) sideColorByLabel.set(s.label, s.color);
785
- const sideBarH = layout.sideLabels.length ? 30 : 0;
786
- const bandTop = sideBarH + 2;
787
- const roundY = sideBarH + 24;
788
- for (const col of layout.columns) {
789
- if (!col.color) continue;
790
- const covered = layout.sideLabels.some(
791
- (s) => col.x >= s.x0 && col.x <= s.x1
792
- );
793
- const top = covered ? bandTop : 2;
794
- const c = resolveColor(col.color, palette) ?? col.color;
795
- 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(
796
- "fill",
797
- fillMode === "outline" ? themeBaseBg(palette, isDark) : mix(c, palette.bg, isDark ? 12 : 8)
798
- ).call((sel) => {
799
- if (fillMode === "outline")
800
- sel.attr("stroke", mix(c, palette.bg, 35)).attr("stroke-width", 1);
801
- });
802
- }
803
- for (const s of layout.sideLabels) {
804
- const c = s.color ? resolveColor(s.color, palette) ?? s.color : basePaint.accent;
805
- 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(
806
- "fill",
807
- fillMode === "outline" ? themeBaseBg(palette, isDark) : mix(c, palette.bg, isDark ? 20 : 14)
808
- ).attr("stroke", fillMode === "outline" ? c : mix(c, palette.bg, 55)).attr("stroke-width", 1);
809
- 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));
810
- }
811
- for (const col of layout.columns) {
812
- const c = col.color ? resolveColor(col.color, palette) ?? col.color : basePaint.muted;
813
- const covered = layout.sideLabels.some(
814
- (s) => col.x >= s.x0 && col.x <= s.x1
815
- );
816
- 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));
817
- }
818
- for (const m of layout.matches) {
819
- drawConnector(root, m, m.topFrom, m.y - HALF_SPAN2, basePaint);
820
- drawConnector(root, m, m.botFrom, m.y + HALF_SPAN2, basePaint);
821
- }
822
- for (const m of layout.matches) {
823
- const sidePaint = m.side && sideColorByLabel.get(m.side) ? paintFor(palette, isDark, sideColorByLabel.get(m.side), fillMode) : basePaint;
824
- const topSeed = seedByName.get(m.top ?? "") ?? null;
825
- const botSeed = seedByName.get(m.bot ?? "") ?? null;
826
- let homeName = m.home;
827
- if (!homeName && topSeed !== null && botSeed !== null) {
828
- homeName = topSeed <= botSeed ? m.top : m.bot;
829
- }
830
- const [wSeed, lSeed] = m.winner === "top" ? [topSeed, botSeed] : m.winner === "bot" ? [botSeed, topSeed] : [null, null];
831
- const isUpset = wSeed !== null && lSeed !== null && wSeed > lSeed && !m.isChampionship;
832
- const scoreParts = m.score ? m.score.split(/[-–]/).map((p) => p.trim()) : null;
833
- const winScore = scoreParts?.length === 2 ? scoreParts[0] : "";
834
- const loseScore = scoreParts?.length === 2 ? scoreParts[1] : "";
835
- const champWinner = m.isChampionship ? layout.champion : null;
836
- const mkInfo = (side, name) => {
837
- const isWinner = m.winner === side;
838
- const isLoser = m.winner !== null && m.winner !== side;
839
- return {
840
- isWinner,
841
- isLoser,
842
- pending: m.pending,
843
- isChampion: champWinner !== null && isWinner,
844
- score: isWinner ? winScore : isLoser ? loseScore : "",
845
- seed: seedByName.get(name ?? "") ?? null,
846
- tagColor: tagColorOf(name),
847
- tagValue: tagValueOf(name),
848
- isHome: homeName !== null && homeName === name
849
- };
850
- };
851
- drawBox(
852
- root,
853
- m.x,
854
- m.y - HALF_SPAN2,
855
- m.top,
856
- mkInfo("top", m.top),
857
- sidePaint,
858
- palette,
859
- isDark,
860
- m,
861
- activeKey,
862
- fillMode
863
- );
864
- drawBox(
865
- root,
866
- m.x,
867
- m.y + HALF_SPAN2,
868
- m.bot,
869
- mkInfo("bot", m.bot),
870
- sidePaint,
871
- palette,
872
- isDark,
873
- m,
874
- activeKey,
875
- fillMode
876
- );
877
- if (isUpset) drawUpset(root, m, sidePaint);
878
- if (m.commentary.length) drawCommentary(root, m, palette);
879
- }
880
- }
881
- function drawConnector(g, m, from, toCy, paint) {
882
- if (!from) return;
883
- const parentLeft = m.x - BOX_W / 2;
884
- const parentRight = m.x + BOX_W / 2;
885
- const childIsLeft = from.x < m.x;
886
- const childEdge = childIsLeft ? from.x + BOX_W / 2 : from.x - BOX_W / 2;
887
- const parentEdge = childIsLeft ? parentLeft : parentRight;
888
- const midX = (childEdge + parentEdge) / 2;
889
- const vLo = Math.min(from.yA, from.yB, toCy);
890
- const vHi = Math.max(from.yA, from.yB, toCy);
891
- 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}`;
892
- g.append("path").attr("d", d).attr("fill", "none").attr("stroke", paint.wire).attr("stroke-width", 1.5);
893
- }
894
- function drawBox(g, cx, cy, name, info, sidePaint, palette, isDark, m, activeKey, fillMode) {
895
- const x = cx - BOX_W / 2;
896
- const y = cy - BOX_H / 2;
897
- const paint = info.tagColor ? paintForAccent(palette, isDark, info.tagColor, fillMode) : sidePaint;
898
- const cell = g.append("g").attr("class", "dgmo-bracket-box");
899
- if (m.lineNumber !== null) cell.attr("data-line-number", m.lineNumber);
900
- if (activeKey && info.tagValue)
901
- cell.attr(`data-tag-${activeKey}`, info.tagValue.toLowerCase());
902
- const isTBD = name === null;
903
- let fill = "none";
904
- let stroke = paint.hair;
905
- let sw = 1.25;
906
- let dash = null;
907
- let textColor = paint.ink;
908
- let weight = "bold";
909
- if (info.isChampion) {
910
- fill = paint.tint;
911
- stroke = paint.accent;
912
- sw = 3;
913
- weight = "bold";
914
- } else if (isTBD) {
915
- fill = paint.track;
916
- dash = "4 4";
917
- textColor = paint.muted;
918
- weight = "normal";
919
- } else if (info.isWinner) {
920
- fill = paint.tint;
921
- stroke = paint.accent;
922
- sw = 2;
923
- weight = "bold";
924
- } else if (info.isLoser) {
925
- stroke = paint.hair;
926
- textColor = paint.muted;
927
- weight = "normal";
928
- } else if (info.pending) {
929
- stroke = mix(paint.accent, paint.hair, 50);
930
- }
931
- const onSolid = fillMode === "solid" && (info.isChampion || info.isWinner) ? contrastText(
932
- paint.tint,
933
- palette.textOnFillLight,
934
- palette.textOnFillDark
935
- ) : null;
936
- if (onSolid) textColor = onSolid;
937
- const gutterColor = onSolid ?? paint.muted;
938
- 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);
939
- if (dash) rect.attr("stroke-dasharray", dash);
940
- let leftPad = 11;
941
- if (info.seed !== null) {
942
- 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);
943
- leftPad = 9 + Math.max(12, measureText(String(info.seed), 10, { bold: true })) + 6;
944
- }
945
- let rightPad = 11;
946
- if (info.score) rightPad += 20;
947
- if (info.isHome) {
948
- drawHome(cell, x + BOX_W - rightPad - 6, cy, gutterColor);
949
- rightPad += 16;
950
- }
951
- 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(
952
- clip(
953
- isTBD ? "TBD" : name,
954
- BOX_W - leftPad - rightPad,
955
- 12.5,
956
- weight === "bold"
957
- )
958
- );
959
- if (info.score) {
960
- 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);
961
- }
962
- }
963
- function drawHome(cell, hx, cy, color) {
964
- const s = 5;
965
- const yTop = cy - s - 1;
966
- 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`;
967
- cell.append("path").attr("d", d).attr("fill", "none").attr("stroke", color).attr("stroke-width", 1.2).attr("stroke-linejoin", "round");
968
- }
969
- function drawUpset(g, m, paint) {
970
- g.append("text").attr("x", m.x + BOX_W / 2).attr("y", m.y - HALF_SPAN2 - 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");
971
- }
972
- function drawCommentary(g, m, palette) {
973
- const x = m.x - BOX_W / 2 + 2;
974
- let y = m.y + HALF_SPAN2 + BOX_H / 2 + 13;
975
- const muted = mix(palette.text, palette.bg, 45);
976
- const bulletW = measureText("\u2022 ", 11);
977
- const emit = (line, lx) => {
978
- 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);
979
- renderInlineText(t, line, palette, 11);
980
- y += COMMENT_LH;
981
- };
982
- for (const raw of m.commentary) {
983
- const isBullet = raw.startsWith("\u2022 ");
984
- if (isBullet) {
985
- const body = raw.slice(2);
986
- wrapText(body, COMMENT_W - bulletW, 11).forEach(
987
- (line, i) => i === 0 ? emit(`\u2022 ${line}`, x) : emit(line, x + bulletW)
988
- );
989
- } else {
990
- for (const line of wrapText(raw, COMMENT_W, 11)) emit(line, x);
991
- }
992
- }
993
- }
994
- function renderBracketForExport(container, parsed, palette, isDark, exportDims) {
995
- renderBracket(container, parsed, palette, isDark, exportDims);
996
- }
997
-
998
575
  export {
999
- layoutBracket,
1000
- bracketExportDimensions,
1001
- renderBracket,
1002
- renderBracketForExport
576
+ BOX_W,
577
+ BOX_H,
578
+ PAIR_GAP,
579
+ COMMENT_W,
580
+ wrapText,
581
+ layoutBracket
1003
582
  };
@@ -10,7 +10,7 @@ import {
10
10
  renderNoteBadge,
11
11
  renderNoteBox,
12
12
  renderNoteConnector
13
- } from "./chunk-HAH5X345.js";
13
+ } from "./chunk-KATED53P.js";
14
14
  import {
15
15
  appendArrowheadMarkers
16
16
  } from "./chunk-XBJJP2HN.js";
@@ -29,7 +29,7 @@ import {
29
29
  } from "./chunk-XCKNFFKM.js";
30
30
  import {
31
31
  serializeSvg
32
- } from "./chunk-LD2JSKU3.js";
32
+ } from "./chunk-OOCVGX4W.js";
33
33
  import {
34
34
  TITLE_FONT_SIZE,
35
35
  TITLE_FONT_WEIGHT,
@@ -38,19 +38,19 @@ import {
38
38
  import {
39
39
  FONT_FAMILY
40
40
  } from "./chunk-ICLB27PZ.js";
41
- import {
42
- measureText
43
- } from "./chunk-KAO7JL4I.js";
44
41
  import {
45
42
  parseFlowchart
46
43
  } from "./chunk-JRUEIRJB.js";
47
44
  import {
48
45
  fillModeFromOptions
49
46
  } from "./chunk-44GP7PD5.js";
47
+ import {
48
+ measureText
49
+ } from "./chunk-KAO7JL4I.js";
50
50
  import {
51
51
  contrastText,
52
52
  shapeFill
53
- } from "./chunk-7HWY4QAJ.js";
53
+ } from "./chunk-L24LESXF.js";
54
54
 
55
55
  // src/graph/flowchart-renderer.ts
56
56
  import * as d3Selection from "d3-selection";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  layoutOrg
3
- } from "./chunk-33FQ6HNV.js";
3
+ } from "./chunk-IQ6P3HDE.js";
4
4
  import {
5
5
  renderCollapseBar,
6
6
  renderNodeCard
@@ -28,30 +28,20 @@ import {
28
28
  import {
29
29
  extractExportSvg,
30
30
  runInExportContainer
31
- } from "./chunk-QFIXL3OK.js";
31
+ } from "./chunk-SEKNYIMO.js";
32
32
  import {
33
33
  TITLE_FONT_SIZE,
34
34
  TITLE_FONT_WEIGHT
35
35
  } from "./chunk-VLC6WNRD.js";
36
36
  import {
37
37
  renderIntegratedLegend
38
- } from "./chunk-LHL6HDUL.js";
38
+ } from "./chunk-7SX4IY6T.js";
39
39
  import {
40
40
  getMaxLegendReservedHeight
41
- } from "./chunk-FM3WAVB6.js";
41
+ } from "./chunk-NS7L7YKH.js";
42
42
  import {
43
43
  FONT_FAMILY
44
44
  } from "./chunk-ICLB27PZ.js";
45
- import {
46
- EYE_CLOSED_PATH,
47
- EYE_OPEN_PATH,
48
- LEGEND_EYE_GAP,
49
- LEGEND_EYE_SIZE,
50
- LEGEND_HEIGHT
51
- } from "./chunk-RH2PROYG.js";
52
- import {
53
- measureText
54
- } from "./chunk-KAO7JL4I.js";
55
45
  import {
56
46
  parseOrg
57
47
  } from "./chunk-FJNXXGTR.js";
@@ -62,12 +52,22 @@ import {
62
52
  import {
63
53
  fillModeFromOptions
64
54
  } from "./chunk-44GP7PD5.js";
55
+ import {
56
+ EYE_CLOSED_PATH,
57
+ EYE_OPEN_PATH,
58
+ LEGEND_EYE_GAP,
59
+ LEGEND_EYE_SIZE,
60
+ LEGEND_HEIGHT
61
+ } from "./chunk-I6GGMCTV.js";
62
+ import {
63
+ measureText
64
+ } from "./chunk-KAO7JL4I.js";
65
65
  import {
66
66
  contrastText,
67
67
  groupFill,
68
68
  groupStroke,
69
69
  shapeFill
70
- } from "./chunk-7HWY4QAJ.js";
70
+ } from "./chunk-L24LESXF.js";
71
71
 
72
72
  // src/org/renderer.ts
73
73
  import * as d3Selection from "d3-selection";
@@ -15,18 +15,18 @@ import {
15
15
  import {
16
16
  FONT_FAMILY
17
17
  } from "./chunk-ICLB27PZ.js";
18
+ import {
19
+ fillModeFromOptions
20
+ } from "./chunk-44GP7PD5.js";
18
21
  import {
19
22
  CHAR_WIDTH_RATIO,
20
23
  measureText
21
24
  } from "./chunk-KAO7JL4I.js";
22
- import {
23
- fillModeFromOptions
24
- } from "./chunk-44GP7PD5.js";
25
25
  import {
26
26
  contrastText,
27
27
  getSeriesColors,
28
28
  shapeFill
29
- } from "./chunk-7HWY4QAJ.js";
29
+ } from "./chunk-L24LESXF.js";
30
30
  import {
31
31
  resolveColor
32
32
  } from "./chunk-2M4IGSCY.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VLC6WNRD.js";
5
5
  import {
6
6
  LEGEND_HEIGHT
7
- } from "./chunk-RH2PROYG.js";
7
+ } from "./chunk-I6GGMCTV.js";
8
8
  import {
9
9
  measureText
10
10
  } from "./chunk-KAO7JL4I.js";
@@ -30,7 +30,7 @@ import {
30
30
  getSeriesColors,
31
31
  mix,
32
32
  themeBaseBg
33
- } from "./chunk-7HWY4QAJ.js";
33
+ } from "./chunk-L24LESXF.js";
34
34
  import {
35
35
  resolveColor
36
36
  } from "./chunk-2M4IGSCY.js";
@@ -2,19 +2,19 @@ import {
2
2
  FONT_FAMILY,
3
3
  MONO_FAMILY
4
4
  } from "./chunk-ICLB27PZ.js";
5
- import {
6
- measureText,
7
- truncateText
8
- } from "./chunk-KAO7JL4I.js";
9
5
  import {
10
6
  encodeDiagramUrl
11
7
  } from "./chunk-RE27AX7O.js";
12
8
  import {
13
9
  parseDgmoChartType
14
- } from "./chunk-AQIBKTPG.js";
10
+ } from "./chunk-K5XT7NHD.js";
15
11
  import {
16
12
  chartTypes
17
13
  } from "./chunk-44GP7PD5.js";
14
+ import {
15
+ measureText,
16
+ truncateText
17
+ } from "./chunk-KAO7JL4I.js";
18
18
 
19
19
  // src/error-card.ts
20
20
  var DOCS_BASE = "https://diagrammo.app/docs";