@diagrammo/dgmo 0.93.0 → 0.94.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 (112) hide show
  1. package/dist/advanced.d.ts +26 -18
  2. package/dist/advanced.js +58 -57
  3. package/dist/block.js +17 -17
  4. package/dist/chart-meta.js +9 -9
  5. package/dist/{charts-d3-ERYYVGP6.js → charts-d3-SZV2SFTM.js} +2 -2
  6. package/dist/{chunk-FIYW7JW4.js → chunk-2FDQEQID.js} +1 -1
  7. package/dist/{chunk-UVX3IYXF.js → chunk-2HSHWPTO.js} +4 -4
  8. package/dist/{chunk-J6AEKIRQ.js → chunk-2I4UQG7W.js} +1 -1
  9. package/dist/{chunk-M4NV5PPU.js → chunk-2MS623GW.js} +1 -1
  10. package/dist/{chunk-A5WIAMCT.js → chunk-2XMTZ5JR.js} +1 -1
  11. package/dist/{chunk-KPGPK4SK.js → chunk-3TWBMU7K.js} +4 -4
  12. package/dist/{chunk-P5FUWXPW.js → chunk-3ZP3QC47.js} +7 -5
  13. package/dist/{chunk-QDRCWVV3.js → chunk-4EX4OKGZ.js} +71 -8
  14. package/dist/{chunk-IESUM4N5.js → chunk-4SP6OUO7.js} +92 -59
  15. package/dist/{chunk-2TFXRBCD.js → chunk-4TEPDQHJ.js} +2 -2
  16. package/dist/{chunk-YDZIVDVR.js → chunk-5ZUZZDW5.js} +6 -6
  17. package/dist/{chunk-ADVGV3P7.js → chunk-6JCTW74W.js} +7 -5
  18. package/dist/{chunk-NMK7KJZZ.js → chunk-7IOZ6JE4.js} +4 -4
  19. package/dist/{chunk-NJJCTEBM.js → chunk-7SXV7NUS.js} +1 -1
  20. package/dist/{chunk-MB2SQF7N.js → chunk-7WEYXYLC.js} +1 -1
  21. package/dist/{chunk-4RY5D5RE.js → chunk-AM42TLSZ.js} +98 -93
  22. package/dist/{chunk-472EOHVW.js → chunk-AYUSD4Z6.js} +31 -5
  23. package/dist/{chunk-CYDM2XII.js → chunk-B25IWGDH.js} +54 -5
  24. package/dist/{chunk-7OWK5K5C.js → chunk-BH2SF4TT.js} +2 -2
  25. package/dist/{chunk-MUJVNSEW.js → chunk-C6G36F5S.js} +1 -1
  26. package/dist/{chunk-Q7Y6JQ3R.js → chunk-CIHHTS5B.js} +1 -1
  27. package/dist/{chunk-KPSSNGAE.js → chunk-DDIOWNHS.js} +4 -4
  28. package/dist/{chunk-KCMGIYPO.js → chunk-DLJJOCIT.js} +1 -1
  29. package/dist/{chunk-M6ZQAFPD.js → chunk-DNM3XZCK.js} +1 -1
  30. package/dist/{chunk-AUS7V54P.js → chunk-ERT7XDQW.js} +1 -1
  31. package/dist/{chunk-YXXIRM4C.js → chunk-FWVE373X.js} +2 -2
  32. package/dist/{chunk-USAGHYRD.js → chunk-G3HZ4PGE.js} +2 -2
  33. package/dist/{chunk-EQWC76GQ.js → chunk-GWQRTA5W.js} +2 -2
  34. package/dist/{chunk-GJXMG4S3.js → chunk-HHVIE45A.js} +1 -1
  35. package/dist/{chunk-TNV4F5WA.js → chunk-HI6R27YA.js} +2 -2
  36. package/dist/{chunk-IIV4SMJL.js → chunk-I37S3EZE.js} +4 -4
  37. package/dist/{chunk-4FT5KQ7H.js → chunk-IGJEKO2P.js} +1 -1
  38. package/dist/{chunk-KRU2LCIP.js → chunk-IHN6WDEY.js} +1 -1
  39. package/dist/{chunk-QT3KDDXK.js → chunk-IN7XI6NO.js} +0 -7
  40. package/dist/{chunk-4WQX55VX.js → chunk-IZHGT5HD.js} +31 -5
  41. package/dist/{chunk-WK5QEYFA.js → chunk-JT2BG7LM.js} +3 -3
  42. package/dist/{chunk-ZTLMEBAC.js → chunk-KBHT5XEY.js} +78 -3
  43. package/dist/{chunk-KHL652SX.js → chunk-KSZB7TIY.js} +1 -1
  44. package/dist/{chunk-VSOZZYLK.js → chunk-NERQSSYD.js} +20 -9
  45. package/dist/{chunk-U7U64UUN.js → chunk-NOQB4KMV.js} +4 -4
  46. package/dist/{chunk-UG7AQQNR.js → chunk-OSSTOSXU.js} +2 -2
  47. package/dist/{chunk-65GPEV5V.js → chunk-QKPOIJBT.js} +2 -2
  48. package/dist/{chunk-QJOVZ4TC.js → chunk-QPQWY5RU.js} +1 -1
  49. package/dist/{chunk-LNVB75QU.js → chunk-RBVFNUAL.js} +1 -1
  50. package/dist/{chunk-J43OCO22.js → chunk-RESEJSCV.js} +2 -2
  51. package/dist/{chunk-DAHQL57W.js → chunk-RITTLIDJ.js} +1 -1
  52. package/dist/{chunk-LUDUDBO6.js → chunk-S5Y3OO3V.js} +2 -2
  53. package/dist/{chunk-3GCASUWA.js → chunk-TASRGDYP.js} +1 -1
  54. package/dist/{chunk-LDDDKWL6.js → chunk-TDAGJJPZ.js} +1 -1
  55. package/dist/{chunk-42UJ23H3.js → chunk-UIEKW4SG.js} +1 -0
  56. package/dist/{chunk-CQYFZOUC.js → chunk-VBMRZCMQ.js} +1 -1
  57. package/dist/{chunk-D6PVMUCX.js → chunk-VDY2GR6U.js} +2 -2
  58. package/dist/{chunk-EJS3K44P.js → chunk-VGAMBOOC.js} +5 -3
  59. package/dist/chunk-WTTIODDV.js +9 -0
  60. package/dist/{chunk-5CBX66KB.js → chunk-XJQ6Z3FO.js} +2 -2
  61. package/dist/{chunk-XUTR7GNT.js → chunk-XKCRKD2B.js} +67 -28
  62. package/dist/{chunk-KCHQVED5.js → chunk-YQMIKX54.js} +43 -7
  63. package/dist/countdown.js +1 -1
  64. package/dist/{dgmo-router-CZN36TR3.js → dgmo-router-E5O7RJSW.js} +11 -11
  65. package/dist/{dimensions-7HHKO5BS.js → dimensions-DS6FWLRY.js} +2 -2
  66. package/dist/{flowchart-parser-4MZPWYK6.js → flowchart-parser-NZXASOZG.js} +5 -5
  67. package/dist/{flowchart-renderer-5XDN575E.js → flowchart-renderer-PTCRIANF.js} +14 -12
  68. package/dist/index.js +17 -17
  69. package/dist/layout-ISSBWBH7.js +24 -0
  70. package/dist/layout-IT4ZTV6C.js +24 -0
  71. package/dist/{layout-QXGPY7KA.js → layout-U3AH6M7J.js} +7 -6
  72. package/dist/{layout-5GHV7HNM.js → layout-VC3MXRB4.js} +11 -10
  73. package/dist/layout-VDCJOZSH.js +11 -0
  74. package/dist/{layout-search-EMTCDC3C.js → layout-search-BBX2BMEF.js} +9 -8
  75. package/dist/{parser-YX72VLDZ.js → parser-4RFY7D52.js} +5 -5
  76. package/dist/{parser-VKYUAT4Y.js → parser-7QKQ4P4P.js} +5 -5
  77. package/dist/{parser-OGF2CDA6.js → parser-TAYRTCPR.js} +5 -5
  78. package/dist/{redraw-T324XAF3.js → redraw-AHW7EUUF.js} +2 -2
  79. package/dist/{redraw-MSXU4ZD2.js → redraw-STZ4WJAI.js} +3 -3
  80. package/dist/{renderer-HYGTMBHT.js → renderer-2LYX6NHN.js} +3 -3
  81. package/dist/{renderer-GPAVVUET.js → renderer-3NLDX7DQ.js} +3 -3
  82. package/dist/{renderer-HJ54YXT3.js → renderer-4SE7R22T.js} +12 -12
  83. package/dist/{renderer-CNRQFIEI.js → renderer-53B523PM.js} +4 -4
  84. package/dist/{renderer-FL7EOSBU.js → renderer-7OGGV327.js} +3 -3
  85. package/dist/{renderer-37PLQHVB.js → renderer-BXD5KVSR.js} +2 -2
  86. package/dist/{renderer-5ITLW7MX.js → renderer-FMTLSOCX.js} +6 -4
  87. package/dist/{renderer-TSCSZ6CL.js → renderer-HX6ICPDX.js} +2 -2
  88. package/dist/{renderer-DD6T3C4J.js → renderer-ISQJ2ELA.js} +2 -2
  89. package/dist/{renderer-POBGKIUT.js → renderer-IXBOT6DU.js} +3 -3
  90. package/dist/{renderer-IHCWBFPI.js → renderer-J3GPDK73.js} +14 -13
  91. package/dist/{renderer-VI34SD5V.js → renderer-J7ZSTJUE.js} +6 -6
  92. package/dist/{renderer-GFALLIYT.js → renderer-JYHA6R2D.js} +3 -3
  93. package/dist/{renderer-GOXAP2IE.js → renderer-KJ3V5BYP.js} +2 -2
  94. package/dist/{renderer-XJMVG2WJ.js → renderer-LNP23NSM.js} +5 -5
  95. package/dist/{renderer-BO73LSVT.js → renderer-M5DUMITP.js} +3 -3
  96. package/dist/{renderer-GFGFHYWY.js → renderer-MWZC7TMD.js} +2 -2
  97. package/dist/{renderer-3F47TPZ2.js → renderer-O6RP52CQ.js} +2 -2
  98. package/dist/{renderer-PBKTAWQV.js → renderer-OUDHH5MV.js} +14 -13
  99. package/dist/{renderer-RDI2RYUP.js → renderer-PHLCYVSN.js} +3 -3
  100. package/dist/{renderer-VDBNC7A6.js → renderer-QTPWRRJ7.js} +2 -2
  101. package/dist/{renderer-J3QWK6IM.js → renderer-RUSQJFFC.js} +3 -3
  102. package/dist/{renderer-7Y3LR4R2.js → renderer-TINHO2IO.js} +2 -2
  103. package/dist/{renderer-EVKWGUGT.js → renderer-UTEEJDGB.js} +4 -3
  104. package/dist/{renderer-ISDKO3DI.js → renderer-WPN2SXGT.js} +2 -2
  105. package/dist/{renderer-6GJWADLO.js → renderer-XCLARXCK.js} +2 -2
  106. package/dist/{renderer-J6H4Q3RM.js → renderer-XOWDERU2.js} +4 -3
  107. package/dist/{state-parser-NPYTMRXP.js → state-parser-KPVW5CRI.js} +5 -5
  108. package/dist/{state-renderer-44K2KDX7.js → state-renderer-ZVEI265C.js} +14 -13
  109. package/package.json +1 -1
  110. package/dist/layout-33FHGDEV.js +0 -23
  111. package/dist/layout-FTOGDNUL.js +0 -23
  112. package/dist/layout-J3AGFZZ7.js +0 -10
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-24YPR5EH.js";
20
20
  import {
21
21
  layoutInlineHeader
22
- } from "./chunk-42UJ23H3.js";
22
+ } from "./chunk-UIEKW4SG.js";
23
23
  import {
24
24
  TITLE_FONT_SIZE,
25
25
  TITLE_FONT_WEIGHT
@@ -43,7 +43,7 @@ import {
43
43
  } from "./chunk-IYULMRBE.js";
44
44
  import {
45
45
  renderInlineText
46
- } from "./chunk-65GPEV5V.js";
46
+ } from "./chunk-QKPOIJBT.js";
47
47
  import {
48
48
  FONT_FAMILY
49
49
  } from "./chunk-ICLB27PZ.js";
@@ -97,10 +97,10 @@ import {
97
97
  } from "./chunk-JXGSTBW6.js";
98
98
  import {
99
99
  parseBoxesAndLines
100
- } from "./chunk-A5WIAMCT.js";
100
+ } from "./chunk-2XMTZ5JR.js";
101
101
  import {
102
102
  parseDgmoChartType
103
- } from "./chunk-UVX3IYXF.js";
103
+ } from "./chunk-2HSHWPTO.js";
104
104
  import {
105
105
  parseRaci
106
106
  } from "./chunk-KRPLP5LP.js";
@@ -123,13 +123,13 @@ import {
123
123
  } from "./chunk-CDM6XMOT.js";
124
124
  import {
125
125
  parseFlowchart
126
- } from "./chunk-M6ZQAFPD.js";
126
+ } from "./chunk-DNM3XZCK.js";
127
127
  import {
128
128
  GRAPH_DIAGNOSTICS
129
129
  } from "./chunk-TIVMAITN.js";
130
130
  import {
131
131
  parseState
132
- } from "./chunk-M4NV5PPU.js";
132
+ } from "./chunk-2MS623GW.js";
133
133
  import {
134
134
  makeYearContext,
135
135
  parseDateToken,
@@ -141,10 +141,10 @@ import {
141
141
  } from "./chunk-CYTFO2LF.js";
142
142
  import {
143
143
  parseERDiagram
144
- } from "./chunk-Q7Y6JQ3R.js";
144
+ } from "./chunk-CIHHTS5B.js";
145
145
  import {
146
146
  parseClassDiagram
147
- } from "./chunk-KCMGIYPO.js";
147
+ } from "./chunk-DLJJOCIT.js";
148
148
  import {
149
149
  ARROW_DIAGNOSTIC_CODES
150
150
  } from "./chunk-N7VMGZCU.js";
@@ -1,16 +1,18 @@
1
1
  import {
2
2
  clipEndpointsToNodes,
3
3
  groupedTierCandidates
4
- } from "./chunk-EJS3K44P.js";
4
+ } from "./chunk-VGAMBOOC.js";
5
5
  import {
6
6
  computeNodeSize
7
- } from "./chunk-P5FUWXPW.js";
7
+ } from "./chunk-3ZP3QC47.js";
8
8
  import {
9
- EDGE_LABEL_FONT_SIZE,
10
9
  NODE_HEIGHT,
11
- NODE_WIDTH,
10
+ NODE_WIDTH
11
+ } from "./chunk-WTTIODDV.js";
12
+ import {
13
+ EDGE_LABEL_FONT_SIZE,
12
14
  measureEdgeLabel
13
- } from "./chunk-QT3KDDXK.js";
15
+ } from "./chunk-IN7XI6NO.js";
14
16
 
15
17
  // src/boxes-and-lines/layout-search.ts
16
18
  import dagre from "@dagrejs/dagre";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  layoutERDiagram
3
- } from "./chunk-TNV4F5WA.js";
3
+ } from "./chunk-HI6R27YA.js";
4
4
  import {
5
5
  serializeSvg
6
6
  } from "./chunk-CYRB2JTN.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-24YPR5EH.js";
10
10
  import {
11
11
  layoutInlineHeader
12
- } from "./chunk-42UJ23H3.js";
12
+ } from "./chunk-UIEKW4SG.js";
13
13
  import {
14
14
  TITLE_FONT_SIZE,
15
15
  TITLE_FONT_WEIGHT,
@@ -28,14 +28,14 @@ import {
28
28
  } from "./chunk-JILEYZ2V.js";
29
29
  import {
30
30
  parseERDiagram
31
- } from "./chunk-Q7Y6JQ3R.js";
31
+ } from "./chunk-CIHHTS5B.js";
32
32
  import {
33
33
  NOTE_BADGE_RADIUS,
34
34
  noteConnectorPoints,
35
35
  renderNoteBadge,
36
36
  renderNoteBox,
37
37
  renderNoteConnector
38
- } from "./chunk-D6PVMUCX.js";
38
+ } from "./chunk-VDY2GR6U.js";
39
39
  import {
40
40
  FONT_FAMILY
41
41
  } from "./chunk-ICLB27PZ.js";
@@ -5,7 +5,7 @@ import {
5
5
  NOTE_GAP,
6
6
  noteBoxSize,
7
7
  noteConnectorPoints
8
- } from "./chunk-D6PVMUCX.js";
8
+ } from "./chunk-VDY2GR6U.js";
9
9
  import {
10
10
  extractColor,
11
11
  measureIndent
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  stripInlineMarkdown
3
- } from "./chunk-65GPEV5V.js";
3
+ } from "./chunk-QKPOIJBT.js";
4
4
 
5
5
  // src/utils/wrapped-desc.ts
6
6
  var BULLET_PREFIX = "\u2022 ";
@@ -620,6 +620,88 @@ function layoutEdgeLabels(args) {
620
620
  return chosen;
621
621
  }
622
622
 
623
+ // src/map/dot-labels.ts
624
+ var DOT_LABEL_GAP = 3;
625
+ function dotLabelRect(dot, w, h, side) {
626
+ const GAP2 = DOT_LABEL_GAP;
627
+ switch (side) {
628
+ case "right":
629
+ return { x: dot.cx + dot.r + GAP2, y: dot.cy - h / 2, w, h };
630
+ case "left":
631
+ return { x: dot.cx - dot.r - GAP2 - w, y: dot.cy - h / 2, w, h };
632
+ case "above":
633
+ return { x: dot.cx - w / 2, y: dot.cy - dot.r - GAP2 - h, w, h };
634
+ case "below":
635
+ return { x: dot.cx - w / 2, y: dot.cy + dot.r + GAP2, w, h };
636
+ // Diagonal corners: offset both axes by (r+GAP)/√2 so the box's near
637
+ // corner clears the dot rim by the same gap as a cardinal side.
638
+ case "below-right": {
639
+ const d = (dot.r + GAP2) * 0.7071;
640
+ return { x: dot.cx + d, y: dot.cy + d, w, h };
641
+ }
642
+ case "below-left": {
643
+ const d = (dot.r + GAP2) * 0.7071;
644
+ return { x: dot.cx - d - w, y: dot.cy + d, w, h };
645
+ }
646
+ case "above-right": {
647
+ const d = (dot.r + GAP2) * 0.7071;
648
+ return { x: dot.cx + d, y: dot.cy - d - h, w, h };
649
+ }
650
+ case "above-left": {
651
+ const d = (dot.r + GAP2) * 0.7071;
652
+ return { x: dot.cx - d - w, y: dot.cy - d - h, w, h };
653
+ }
654
+ }
655
+ }
656
+ function dotLabelFits(rect, width, height, collides) {
657
+ return rect.x >= 0 && rect.x + rect.w <= width && rect.y >= 0 && rect.y + rect.h <= height && !collides(rect);
658
+ }
659
+ var CLEAR_CAP = 48;
660
+ var CLEAR_W = 8;
661
+ var WATER_W = 0.25;
662
+ var LEGIBILITY = {
663
+ right: 160,
664
+ left: 160,
665
+ above: 100,
666
+ below: 100,
667
+ "below-right": 0,
668
+ "below-left": 0,
669
+ "above-right": 0,
670
+ "above-left": 0
671
+ };
672
+ var ALL_SIDES = Object.keys(LEGIBILITY);
673
+ function ptSegDist(px, py, ax, ay, bx, by) {
674
+ const dx = bx - ax;
675
+ const dy = by - ay;
676
+ const len2 = dx * dx + dy * dy;
677
+ let t = len2 > 0 ? ((px - ax) * dx + (py - ay) * dy) / len2 : 0;
678
+ t = Math.max(0, Math.min(1, t));
679
+ return Math.hypot(px - (ax + t * dx), py - (ay + t * dy));
680
+ }
681
+ function clearanceOf(rect, ownId, dots, segments) {
682
+ const cxL = rect.x + rect.w / 2;
683
+ const cyL = rect.y + rect.h / 2;
684
+ let d = CLEAR_CAP;
685
+ for (const q of dots) {
686
+ if (q.id === ownId) continue;
687
+ d = Math.min(d, Math.hypot(q.cx - cxL, q.cy - cyL) - q.r);
688
+ }
689
+ for (const s of segments)
690
+ d = Math.min(d, ptSegDist(cxL, cyL, s[0], s[1], s[2], s[3]));
691
+ return Math.max(0, d);
692
+ }
693
+ function placeDotLabel(args) {
694
+ const { dot, w, h, width, height, collides, dots, segments, openness } = args;
695
+ let best = null;
696
+ for (const side of ALL_SIDES) {
697
+ const rect = dotLabelRect(dot, w, h, side);
698
+ if (!dotLabelFits(rect, width, height, collides)) continue;
699
+ const v = CLEAR_W * clearanceOf(rect, dot.id, dots, segments) + WATER_W * openness(rect) + LEGIBILITY[side];
700
+ if (best === null || v > best.v) best = { side, rect, v };
701
+ }
702
+ return best && { side: best.side, rect: best.rect };
703
+ }
704
+
623
705
  // src/map/connectors.ts
624
706
  var W_MIN = 1.25;
625
707
  var W_MAX = 8;
@@ -2920,7 +3002,7 @@ function layoutMap(resolvedIn, data, size, opts) {
2920
3002
  const text = labelText(p);
2921
3003
  return { text, w: measureLegendText(text, FONT2) };
2922
3004
  };
2923
- const GAP2 = 3;
3005
+ const GAP2 = DOT_LABEL_GAP;
2924
3006
  const POI_EDGE_CLEAR = Math.max(
2925
3007
  20,
2926
3008
  Math.round(Math.min(width, height) * 0.03)
@@ -2932,46 +3014,7 @@ function layoutMap(resolvedIn, data, size, opts) {
2932
3014
  if (arr) arr.push(p);
2933
3015
  else clusterMembersById.set(p.clusterId, [p]);
2934
3016
  }
2935
- const inlineRect = (p, w, side) => {
2936
- switch (side) {
2937
- case "right":
2938
- return { x: p.cx + p.r + GAP2, y: p.cy - poiLabH / 2, w, h: poiLabH };
2939
- case "left":
2940
- return {
2941
- x: p.cx - p.r - GAP2 - w,
2942
- y: p.cy - poiLabH / 2,
2943
- w,
2944
- h: poiLabH
2945
- };
2946
- case "above":
2947
- return {
2948
- x: p.cx - w / 2,
2949
- y: p.cy - p.r - GAP2 - poiLabH,
2950
- w,
2951
- h: poiLabH
2952
- };
2953
- case "below":
2954
- return { x: p.cx - w / 2, y: p.cy + p.r + GAP2, w, h: poiLabH };
2955
- // Diagonal corners: offset both axes by (r+GAP)/√2 so the box's near
2956
- // corner clears the dot rim by the same gap as a cardinal side.
2957
- case "below-right": {
2958
- const d = (p.r + GAP2) * 0.7071;
2959
- return { x: p.cx + d, y: p.cy + d, w, h: poiLabH };
2960
- }
2961
- case "below-left": {
2962
- const d = (p.r + GAP2) * 0.7071;
2963
- return { x: p.cx - d - w, y: p.cy + d, w, h: poiLabH };
2964
- }
2965
- case "above-right": {
2966
- const d = (p.r + GAP2) * 0.7071;
2967
- return { x: p.cx + d, y: p.cy - d - poiLabH, w, h: poiLabH };
2968
- }
2969
- case "above-left": {
2970
- const d = (p.r + GAP2) * 0.7071;
2971
- return { x: p.cx - d - w, y: p.cy - d - poiLabH, w, h: poiLabH };
2972
- }
2973
- }
2974
- };
3017
+ const inlineRect = (p, w, side) => dotLabelRect(p, w, poiLabH, side);
2975
3018
  const pushInline = (p, text, w, side, clusterId) => {
2976
3019
  const rect = inlineRect(p, w, side);
2977
3020
  obstacles.push(rect);
@@ -2992,10 +3035,6 @@ function layoutMap(resolvedIn, data, size, opts) {
2992
3035
  ...clusterId !== void 0 && { clusterMember: clusterId }
2993
3036
  });
2994
3037
  };
2995
- const inlineFits = (p, w, side) => {
2996
- const rect = inlineRect(p, w, side);
2997
- return rect.x >= 0 && rect.x + rect.w <= width && rect.y >= 0 && rect.y + rect.h <= height && !collides(rect);
2998
- };
2999
3038
  const GROUP_R = 30;
3000
3039
  const groups2 = [];
3001
3040
  for (const p of ordered) {
@@ -3135,7 +3174,7 @@ function layoutMap(resolvedIn, data, size, opts) {
3135
3174
  ];
3136
3175
  const side = order.find((s) => {
3137
3176
  const rect = inlineRect(p, w, s);
3138
- return rect.x >= 0 && rect.x + rect.w <= width && rect.y >= 0 && rect.y + rect.h <= height && !collides(rect) && !temp.some((t) => rectsOverlap(t, rect));
3177
+ return dotLabelFits(rect, width, height, collides) && !temp.some((t) => rectsOverlap(t, rect));
3139
3178
  });
3140
3179
  if (side === void 0) return false;
3141
3180
  temp.push(inlineRect(p, w, side));
@@ -3154,62 +3193,28 @@ function layoutMap(resolvedIn, data, size, opts) {
3154
3193
  const side = cleanR && cleanL ? defaultColumnSide(items) : cleanR ? "right" : cleanL ? "left" : defaultColumnSide(items);
3155
3194
  commitColumn(items, side, clusterId);
3156
3195
  }
3157
- const CLEAR_CAP = 48;
3158
- const CLEAR_W = 8;
3159
- const WATER_W = 0.25;
3160
- const ptSegDist = (px, py, ax, ay, bx, by) => {
3161
- const dx = bx - ax;
3162
- const dy = by - ay;
3163
- const len2 = dx * dx + dy * dy;
3164
- let t = len2 > 0 ? ((px - ax) * dx + (py - ay) * dy) / len2 : 0;
3165
- t = Math.max(0, Math.min(1, t));
3166
- return Math.hypot(px - (ax + t * dx), py - (ay + t * dy));
3167
- };
3168
- const clearanceOf = (rect, ownId) => {
3169
- const cxL = rect.x + rect.w / 2;
3170
- const cyL = rect.y + rect.h / 2;
3171
- let d = CLEAR_CAP;
3172
- for (const q of pois) {
3173
- if (q.id === ownId) continue;
3174
- d = Math.min(d, Math.hypot(q.cx - cxL, q.cy - cyL) - q.r);
3175
- }
3176
- for (const s of legSegments)
3177
- d = Math.min(d, ptSegDist(cxL, cyL, s[0], s[1], s[2], s[3]));
3178
- return Math.max(0, d);
3179
- };
3180
- const LEGIBILITY = {
3181
- right: 160,
3182
- left: 160,
3183
- above: 100,
3184
- below: 100,
3185
- "below-right": 0,
3186
- "below-left": 0,
3187
- "above-right": 0,
3188
- "above-left": 0
3189
- };
3190
- const ALL_SIDES = Object.keys(LEGIBILITY);
3191
- const placementScore = (p, w, side) => {
3192
- const rect = inlineRect(p, w, side);
3193
- return CLEAR_W * clearanceOf(rect, p.id) + WATER_W * openness(rect) + LEGIBILITY[side];
3194
- };
3195
3196
  const maxExtent = MAX_CLUSTER_EXTENT_FACTOR * Math.min(width, height);
3196
3197
  const clusterPending = [];
3197
3198
  for (const g of groups2) {
3198
3199
  const items = makeItems(g);
3199
3200
  if (g.length === 1) {
3200
3201
  const { p, text, w } = items[0];
3201
- const scored = ALL_SIDES.filter((s) => inlineFits(p, w, s)).map(
3202
- (s) => ({
3203
- s,
3204
- v: placementScore(p, w, s)
3205
- })
3206
- );
3207
- if (scored.length === 0) {
3202
+ const placed = placeDotLabel({
3203
+ dot: p,
3204
+ w,
3205
+ h: poiLabH,
3206
+ width,
3207
+ height,
3208
+ collides,
3209
+ dots: pois,
3210
+ segments: legSegments,
3211
+ openness
3212
+ });
3213
+ if (placed === null) {
3208
3214
  commitColumn(items, defaultColumnSide(items));
3209
3215
  continue;
3210
3216
  }
3211
- const side = scored.reduce((b, c) => c.v > b.v ? c : b).s;
3212
- pushInline(p, text, w, side);
3217
+ pushInline(p, text, w, placed.side);
3213
3218
  continue;
3214
3219
  }
3215
3220
  const left = Math.min(...items.map((o) => o.p.cx - o.p.r));
@@ -5,7 +5,7 @@ import {
5
5
  NODE_LABEL_LINE_HEIGHT,
6
6
  layoutGraph,
7
7
  wrapNodeLabel
8
- } from "./chunk-WK5QEYFA.js";
8
+ } from "./chunk-JT2BG7LM.js";
9
9
  import {
10
10
  appendArrowheadMarkers
11
11
  } from "./chunk-XBJJP2HN.js";
@@ -18,6 +18,11 @@ import {
18
18
  import {
19
19
  ScaleContext
20
20
  } from "./chunk-24YPR5EH.js";
21
+ import {
22
+ INLINE_HEADER_PAD,
23
+ layoutInlineHeader,
24
+ measureTitleWidth
25
+ } from "./chunk-UIEKW4SG.js";
21
26
  import {
22
27
  TITLE_FONT_SIZE,
23
28
  TITLE_FONT_WEIGHT,
@@ -32,14 +37,14 @@ import {
32
37
  } from "./chunk-XCKNFFKM.js";
33
38
  import {
34
39
  parseFlowchart
35
- } from "./chunk-M6ZQAFPD.js";
40
+ } from "./chunk-DNM3XZCK.js";
36
41
  import {
37
42
  NOTE_BADGE_RADIUS,
38
43
  noteConnectorPoints,
39
44
  renderNoteBadge,
40
45
  renderNoteBox,
41
46
  renderNoteConnector
42
- } from "./chunk-D6PVMUCX.js";
47
+ } from "./chunk-VDY2GR6U.js";
43
48
  import {
44
49
  FONT_FAMILY
45
50
  } from "./chunk-ICLB27PZ.js";
@@ -331,7 +336,7 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
331
336
  const titleHeight = showTitle ? 40 : 0;
332
337
  const diagramW = layout.width;
333
338
  const diagramH = layout.height;
334
- const { scale, offsetX, offsetY, canvasHeight, canvasWidth } = fitDiagramToCanvas({
339
+ const fit = fitDiagramToCanvas({
335
340
  width,
336
341
  height,
337
342
  diagramW,
@@ -341,6 +346,27 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
341
346
  maxScale: MAX_SCALE,
342
347
  exportMode: !!exportDims
343
348
  });
349
+ const { scale, offsetY, canvasHeight } = fit;
350
+ let { offsetX, canvasWidth } = fit;
351
+ if (showTitle && exportDims) {
352
+ const titleW = Math.ceil(
353
+ measureTitleWidth(graph.title, sTitleFontSize) + INLINE_HEADER_PAD * 2
354
+ );
355
+ if (titleW > canvasWidth) {
356
+ offsetX += (titleW - canvasWidth) / 2;
357
+ canvasWidth = titleW;
358
+ }
359
+ }
360
+ const header = layoutInlineHeader({
361
+ requested: false,
362
+ title: graph.title ?? "",
363
+ hasLegend: false,
364
+ legendWidth: 0,
365
+ legendHeight: 0,
366
+ containerWidth: canvasWidth,
367
+ titleBandHeight: titleHeight,
368
+ legendReserve: 0
369
+ });
344
370
  const svg = d3Selection.select(container).append("svg").attr("width", canvasWidth).attr("height", canvasHeight).attr("viewBox", `0 0 ${canvasWidth} ${canvasHeight}`).attr("preserveAspectRatio", "xMidYMin meet").style("font-family", FONT_FAMILY);
345
371
  if (ctx.isBelowFloor) {
346
372
  svg.attr("width", "100%");
@@ -355,7 +381,7 @@ function renderFlowchart(container, graph, layout, palette, isDark, onClickItem,
355
381
  colors: edgeColors
356
382
  });
357
383
  if (showTitle) {
358
- const titleEl = svg.append("text").attr("class", "chart-title").attr("x", width / 2).attr("y", sTitleY).attr("text-anchor", "middle").attr("fill", palette.text).attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).style(
384
+ const titleEl = svg.append("text").attr("class", "chart-title").attr("x", header.titleX).attr("y", sTitleY).attr("text-anchor", header.titleAnchor).attr("fill", palette.text).attr("font-size", sTitleFontSize).attr("font-weight", TITLE_FONT_WEIGHT).style(
359
385
  "cursor",
360
386
  onClickItem && graph.titleLineNumber ? "pointer" : "default"
361
387
  ).text(graph.title);
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  renderNodeCard
3
3
  } from "./chunk-R2K5L4UA.js";
4
+ import {
5
+ placeEdgeLabels
6
+ } from "./chunk-IN7XI6NO.js";
4
7
  import {
5
8
  serializeSvg
6
9
  } from "./chunk-CYRB2JTN.js";
@@ -9,7 +12,7 @@ import {
9
12
  } from "./chunk-24YPR5EH.js";
10
13
  import {
11
14
  layoutInlineHeader
12
- } from "./chunk-42UJ23H3.js";
15
+ } from "./chunk-UIEKW4SG.js";
13
16
  import {
14
17
  TITLE_FONT_SIZE,
15
18
  TITLE_FONT_WEIGHT
@@ -45,7 +48,7 @@ import {
45
48
  } from "./chunk-IYULMRBE.js";
46
49
  import {
47
50
  renderInlineText
48
- } from "./chunk-65GPEV5V.js";
51
+ } from "./chunk-QKPOIJBT.js";
49
52
  import {
50
53
  FONT_FAMILY
51
54
  } from "./chunk-ICLB27PZ.js";
@@ -101,6 +104,51 @@ function containerStroke(palette, nodeColor) {
101
104
  }
102
105
  var lineGenerator = d3Shape.line().x((d) => d.x).y((d) => d.y).curve(d3Shape.curveBasis);
103
106
  var lineGeneratorLinear = d3Shape.line().x((d) => d.x).y((d) => d.y).curve(d3Shape.curveLinear);
107
+ function placeSitemapEdgeLabels(layout, fontSize) {
108
+ const nodes = [
109
+ ...layout.nodes.map((n) => ({
110
+ label: n.id,
111
+ x: n.x,
112
+ y: n.y + n.height / 2,
113
+ width: n.width,
114
+ height: n.height
115
+ })),
116
+ ...layout.containers.map((c) => ({
117
+ label: c.nodeId,
118
+ x: c.x + c.width / 2,
119
+ y: c.y + c.labelHeight / 2,
120
+ width: c.width,
121
+ height: c.labelHeight
122
+ }))
123
+ ];
124
+ const adapted = {
125
+ nodes,
126
+ groups: [],
127
+ width: layout.width,
128
+ height: layout.height,
129
+ edges: layout.edges.map((e) => ({
130
+ source: e.sourceId,
131
+ target: e.targetId,
132
+ ...e.label !== void 0 && { label: e.label },
133
+ bidirectional: false,
134
+ lineNumber: e.lineNumber,
135
+ points: e.points,
136
+ yOffset: 0,
137
+ parallelCount: 1,
138
+ metadata: {}
139
+ }))
140
+ };
141
+ const placed = placeEdgeLabels(adapted, {
142
+ fontSize,
143
+ maxWidth: Number.POSITIVE_INFINITY
144
+ });
145
+ const out = /* @__PURE__ */ new Map();
146
+ placed.layout.edges.forEach((e, idx) => {
147
+ if (e.labelX !== void 0 && e.labelY !== void 0)
148
+ out.set(idx, { x: e.labelX, y: e.labelY });
149
+ });
150
+ return out;
151
+ }
104
152
  function renderSitemap(container, parsed, layout, palette, isDark, onClickItem, exportDims, activeTagGroup, hiddenAttributes, exportMode) {
105
153
  d3Selection.select(container).selectAll(":not([data-d3-tooltip])").remove();
106
154
  const width = exportDims?.width ?? container.clientWidth;
@@ -277,7 +325,8 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
277
325
  cG.append("rect").attr("y", c.height - sCollapseBarHeight).attr("width", c.width).attr("height", sCollapseBarHeight).attr("fill", stroke).attr("clip-path", `url(#${clipId})`).attr("class", "sitemap-collapse-bar");
278
326
  }
279
327
  }
280
- for (const edge of layout.edges) {
328
+ const labelCentres = placeSitemapEdgeLabels(layout, sEdgeLabelFontSize);
329
+ for (const [edgeIdx, edge] of layout.edges.entries()) {
281
330
  if (edge.points.length < 2) continue;
282
331
  const edgeG = contentG.append("g").attr("class", "sitemap-edge-group").attr("data-line-number", String(edge.lineNumber)).attr("data-from", edge.sourceId).attr("data-to", edge.targetId);
283
332
  const edgeColor = palette.textMuted;
@@ -287,8 +336,8 @@ function renderSitemap(container, parsed, layout, palette, isDark, onClickItem,
287
336
  if (pathD) {
288
337
  edgeG.append("path").attr("d", pathD).attr("fill", "none").attr("stroke", edgeColor).attr("stroke-width", sEdgeStrokeWidth).attr("marker-end", `url(#${markerId})`).attr("class", "sitemap-edge");
289
338
  }
290
- if (edge.label && edge.points.length >= 2) {
291
- const mid = edge.points[Math.floor(edge.points.length / 2)];
339
+ const mid = labelCentres.get(edgeIdx);
340
+ if (edge.label && mid) {
292
341
  const labelW = measureText(edge.label, sEdgeLabelFontSize) + 10;
293
342
  const labelH = sEdgeLabelFontSize + 6;
294
343
  edgeG.append("rect").attr("x", mid.x - labelW / 2).attr("y", mid.y - labelH / 2 - 1).attr("width", labelW).attr("height", labelH).attr("rx", 3).attr("fill", palette.bg).attr("opacity", EDGE_LABEL_KNOCKOUT_OPACITY).attr("class", "sitemap-edge-label-bg");
@@ -8,10 +8,10 @@ import {
8
8
  } from "./chunk-VLC6WNRD.js";
9
9
  import {
10
10
  wrapDescriptionLines
11
- } from "./chunk-MB2SQF7N.js";
11
+ } from "./chunk-7WEYXYLC.js";
12
12
  import {
13
13
  renderInlineText
14
- } from "./chunk-65GPEV5V.js";
14
+ } from "./chunk-QKPOIJBT.js";
15
15
  import {
16
16
  FONT_FAMILY
17
17
  } from "./chunk-ICLB27PZ.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-2CW5ZTNH.js";
8
8
  import {
9
9
  layoutInlineHeader
10
- } from "./chunk-42UJ23H3.js";
10
+ } from "./chunk-UIEKW4SG.js";
11
11
  import {
12
12
  TITLE_FONT_SIZE,
13
13
  TITLE_FONT_WEIGHT,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  resolveNotes,
6
6
  tryCollectNote
7
- } from "./chunk-NJJCTEBM.js";
7
+ } from "./chunk-7SXV7NUS.js";
8
8
  import {
9
9
  displayName,
10
10
  normalizeName
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  layoutClassDiagram
3
- } from "./chunk-J43OCO22.js";
3
+ } from "./chunk-RESEJSCV.js";
4
4
  import {
5
5
  extractExportSvg,
6
6
  runInExportContainer
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-24YPR5EH.js";
11
11
  import {
12
12
  layoutInlineHeader
13
- } from "./chunk-42UJ23H3.js";
13
+ } from "./chunk-UIEKW4SG.js";
14
14
  import {
15
15
  TITLE_FONT_SIZE,
16
16
  TITLE_FONT_WEIGHT,
@@ -32,14 +32,14 @@ import {
32
32
  } from "./chunk-JILEYZ2V.js";
33
33
  import {
34
34
  parseClassDiagram
35
- } from "./chunk-KCMGIYPO.js";
35
+ } from "./chunk-DLJJOCIT.js";
36
36
  import {
37
37
  NOTE_BADGE_RADIUS,
38
38
  noteConnectorPoints,
39
39
  renderNoteBadge,
40
40
  renderNoteBox,
41
41
  renderNoteConnector
42
- } from "./chunk-D6PVMUCX.js";
42
+ } from "./chunk-VDY2GR6U.js";
43
43
  import {
44
44
  FONT_FAMILY
45
45
  } from "./chunk-ICLB27PZ.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  resolveNotes,
6
6
  tryCollectNote
7
- } from "./chunk-NJJCTEBM.js";
7
+ } from "./chunk-7SXV7NUS.js";
8
8
  import {
9
9
  displayName,
10
10
  normalizeName
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  resolveNotes,
9
9
  tryCollectNote
10
- } from "./chunk-NJJCTEBM.js";
10
+ } from "./chunk-7SXV7NUS.js";
11
11
  import {
12
12
  displayName,
13
13
  normalizeName
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  acyclicOrient
3
- } from "./chunk-EJS3K44P.js";
3
+ } from "./chunk-VGAMBOOC.js";
4
4
 
5
5
  // src/swimlane/layout.ts
6
6
  var MARGIN = 30;
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-VLC6WNRD.js";
7
7
  import {
8
8
  parseInlineMarkdown
9
- } from "./chunk-65GPEV5V.js";
9
+ } from "./chunk-QKPOIJBT.js";
10
10
  import {
11
11
  FONT_FAMILY
12
12
  } from "./chunk-ICLB27PZ.js";
@@ -82,7 +82,7 @@ function renderGoalForExport(container, parsed, palette, isDark, exportDims) {
82
82
  renderGoal(container, parsed, palette, isDark, exportDims);
83
83
  }
84
84
  function displayLen(token) {
85
- return token.replace(/\[(.+?)\]\((.+?)\)/g, "$1").replace(/\*\*|__|\*|_|`/g, "").length;
85
+ return token.replace(/\[([^[\]\n\r]+)\]\((?:[^()\n\r]|\([^()\n\r]*\))+\)/g, "$1").replace(/\*\*|__|\*|_|`/g, "").length;
86
86
  }
87
87
  function wrapText(text, maxChars) {
88
88
  const words = text.split(/\s+/);