@diagrammo/dgmo 0.90.0 → 0.91.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 (179) hide show
  1. package/dist/advanced.d.ts +156 -2
  2. package/dist/advanced.js +558 -115
  3. package/dist/block.d.ts +10 -1
  4. package/dist/block.js +46 -39
  5. package/dist/{calculator-PX3JHKAS.js → calculator-3LZUWOBK.js} +1 -1
  6. package/dist/chart-meta.js +12 -12
  7. package/dist/{charts-d3-QW4ERNUE.js → charts-d3-YXD6VGZQ.js} +3 -3
  8. package/dist/{chunk-64KSPLU2.js → chunk-273GB7WK.js} +4 -4
  9. package/dist/{chunk-GYBKG4Z6.js → chunk-2A4OFZ2Z.js} +2 -2
  10. package/dist/{chunk-YWRZG6GN.js → chunk-2AM6VA3A.js} +8 -8
  11. package/dist/{chunk-PQ5NW3QZ.js → chunk-2UV627GG.js} +4 -4
  12. package/dist/{chunk-AAC3XQWV.js → chunk-37QQXKFV.js} +8 -9
  13. package/dist/{chunk-RCBHL2B5.js → chunk-3LINSNJT.js} +112 -112
  14. package/dist/{chunk-5TZPIKNV.js → chunk-3SLRZKLB.js} +2 -2
  15. package/dist/{chunk-X3WYJ5T7.js → chunk-3YTAOMMN.js} +1 -1
  16. package/dist/{chunk-A5EE66RQ.js → chunk-53BJIOLF.js} +1 -1
  17. package/dist/{chunk-QRIW46LR.js → chunk-57L2JPP2.js} +6 -2
  18. package/dist/{chunk-IIOLFAGJ.js → chunk-5DIBB2QG.js} +51 -32
  19. package/dist/{chunk-7Z2VFRP5.js → chunk-5U6DXIMV.js} +47 -24
  20. package/dist/{chunk-5M6PMV5Z.js → chunk-5VPWIC6T.js} +3 -3
  21. package/dist/{chunk-SLO22FPS.js → chunk-634LDSN6.js} +1 -1
  22. package/dist/{chunk-G5BGW4BX.js → chunk-6NO3MNBC.js} +3 -3
  23. package/dist/{chunk-NUYWNKHH.js → chunk-6QEXWMBP.js} +12 -16
  24. package/dist/{chunk-POBNN5DP.js → chunk-7BBRSOKS.js} +2 -2
  25. package/dist/{chunk-NFWRIC2V.js → chunk-AR4QVMWG.js} +4 -1
  26. package/dist/{chunk-JRQ4LBQI.js → chunk-B6EUFLRP.js} +4 -4
  27. package/dist/{chunk-LNQDICFJ.js → chunk-CPGKRI7H.js} +5 -8
  28. package/dist/{chunk-ZNNVI5SR.js → chunk-CU2PZLZP.js} +53 -31
  29. package/dist/{chunk-LBRHDWEA.js → chunk-CVZBLHHW.js} +1 -1
  30. package/dist/{chunk-S4LLHDGK.js → chunk-CXIPV2FY.js} +3 -3
  31. package/dist/{chunk-ICYPGWOV.js → chunk-D7DXNQW5.js} +2 -2
  32. package/dist/{chunk-54YUDXGP.js → chunk-D7PP35BA.js} +1 -1
  33. package/dist/{chunk-RRBV4HIM.js → chunk-DLX7MEN4.js} +1 -1
  34. package/dist/{chunk-S7C32S2T.js → chunk-EDPDAUBL.js} +2 -2
  35. package/dist/{chunk-LC5LY5V2.js → chunk-EP7BT3HU.js} +1 -1
  36. package/dist/{chunk-ICZ7M6IZ.js → chunk-EQJ3U5EW.js} +1 -1
  37. package/dist/{chunk-K4GUO7FV.js → chunk-F2436VRR.js} +1 -1
  38. package/dist/{chunk-5M52RPAS.js → chunk-F26ZPBSF.js} +2 -2
  39. package/dist/{chunk-3BQCSQQJ.js → chunk-FJCYK4K3.js} +11 -11
  40. package/dist/{chunk-PXEUQ7EG.js → chunk-G22UV5AF.js} +4 -4
  41. package/dist/{chunk-CUY56BK4.js → chunk-G3EUQMV4.js} +3 -3
  42. package/dist/{chunk-I6FWHICD.js → chunk-GCDW3WAY.js} +5 -5
  43. package/dist/{chunk-WHRIN7N3.js → chunk-HFG7KQOY.js} +12 -14
  44. package/dist/{chunk-SVQDLYX7.js → chunk-HLVGZXM5.js} +1 -1
  45. package/dist/{chunk-3HBR3YAN.js → chunk-HSGWR2FL.js} +6 -6
  46. package/dist/{chunk-RNXX2GOQ.js → chunk-HWXUQCDY.js} +2 -2
  47. package/dist/{chunk-YE7D2S75.js → chunk-HYV6GSXM.js} +5 -2
  48. package/dist/{chunk-AHWA36O7.js → chunk-II4XJETG.js} +1 -1
  49. package/dist/{chunk-EB7AEM2H.js → chunk-IMKPFW67.js} +3 -3
  50. package/dist/{chunk-C4W62JZO.js → chunk-IS6WFBX7.js} +2 -2
  51. package/dist/{chunk-SMEVBJJJ.js → chunk-IUBCDNT2.js} +1 -1
  52. package/dist/{chunk-TQ644YGV.js → chunk-IWTUXGHN.js} +3 -3
  53. package/dist/{chunk-PNCKZFPE.js → chunk-J2SQNZ6D.js} +1 -1
  54. package/dist/{chunk-YKGUSW6D.js → chunk-JA2S7PHR.js} +7 -7
  55. package/dist/{chunk-IRVQT4GR.js → chunk-JJQWCI35.js} +2 -2
  56. package/dist/chunk-JJUDOR4I.js +110 -0
  57. package/dist/{chunk-VCHYS3RD.js → chunk-K3BYD3WU.js} +1 -1
  58. package/dist/{chunk-EEYQFJVK.js → chunk-KFXY5IW2.js} +2 -2
  59. package/dist/{chunk-Y6GQQ4Y2.js → chunk-LKR4FACF.js} +1 -3
  60. package/dist/{chunk-IJ27L3R4.js → chunk-MA42PIGJ.js} +1 -1
  61. package/dist/{chunk-GQVXYRPC.js → chunk-MI6SJJQU.js} +1 -1
  62. package/dist/{chunk-DXPT2HPH.js → chunk-MJKQ5ZYY.js} +2 -2
  63. package/dist/{chunk-J3ODKAWN.js → chunk-MNL547RV.js} +5 -5
  64. package/dist/{chunk-2EDJPHXQ.js → chunk-N254IJM2.js} +6 -6
  65. package/dist/{layout-search-YKUL4VBV.js → chunk-NWPMLX2V.js} +27 -30
  66. package/dist/{chunk-COPSI54O.js → chunk-PSGSFRRE.js} +2 -2
  67. package/dist/{chunk-FDRHBQUG.js → chunk-PUZ63XZM.js} +8 -8
  68. package/dist/{chunk-MIVSVEK4.js → chunk-PZVTFQI2.js} +2 -2
  69. package/dist/{chunk-W7QN5BC5.js → chunk-Q3N7PI3B.js} +180 -7
  70. package/dist/{chunk-HX2KJEPD.js → chunk-QKJ6MQXW.js} +1 -3
  71. package/dist/{chunk-NJYA4QSN.js → chunk-QVKTAU7P.js} +1 -1
  72. package/dist/{chunk-EK7JYFCL.js → chunk-R7BSF7Z7.js} +1 -1
  73. package/dist/{chunk-PIHAUVA4.js → chunk-RHXIUUWB.js} +1 -1
  74. package/dist/{chunk-GXP344YZ.js → chunk-RMTOZALT.js} +6 -3
  75. package/dist/{chunk-CYF2X3CG.js → chunk-ROCBGUJN.js} +7 -7
  76. package/dist/{chunk-RY5RRKYN.js → chunk-RVTYIGWZ.js} +3 -3
  77. package/dist/{chunk-NMKLX57Y.js → chunk-SKF7XLCM.js} +1 -1
  78. package/dist/{chunk-NP2SE6MQ.js → chunk-SMTWQ66K.js} +5 -5
  79. package/dist/{chunk-3AX6MCI6.js → chunk-SPQVER4T.js} +2 -2
  80. package/dist/{chunk-A5PUOHIS.js → chunk-SWBHH2UW.js} +1 -1
  81. package/dist/{chunk-7TF3QOOD.js → chunk-TIVMAITN.js} +14 -0
  82. package/dist/{chunk-4IYJOXGS.js → chunk-TLPY4ZBI.js} +604 -430
  83. package/dist/{chunk-U762HK4D.js → chunk-TPEYEOXA.js} +4 -4
  84. package/dist/{chunk-FS2LZBHG.js → chunk-UWJP4JSZ.js} +2 -2
  85. package/dist/{chunk-JX4RCC6B.js → chunk-V3KHZQPK.js} +2 -2
  86. package/dist/{chunk-RJYFHEP4.js → chunk-VGSSAMLA.js} +2 -2
  87. package/dist/{chunk-HIVJBESO.js → chunk-VMD2CYVP.js} +35 -36
  88. package/dist/{chunk-OSIUWQ3N.js → chunk-WNTPJZU7.js} +1 -1
  89. package/dist/{chunk-R2PTZ6QM.js → chunk-WTE27AJT.js} +7 -7
  90. package/dist/{chunk-OWJVSJLA.js → chunk-XLAREWBK.js} +2 -2
  91. package/dist/{chunk-NY56FM55.js → chunk-XLPJJ35N.js} +2 -2
  92. package/dist/{chunk-DNMICILX.js → chunk-XQTRGKQ3.js} +3 -3
  93. package/dist/{chunk-QOZ4RVQY.js → chunk-YZG37S7L.js} +3 -3
  94. package/dist/{chunk-62VWZ3SE.js → chunk-ZB2Q67NO.js} +10 -10
  95. package/dist/completion-registry.js +2 -2
  96. package/dist/{compute-JAP5E2E4.js → compute-2XWFVO7K.js} +1 -1
  97. package/dist/{dgmo-router-BJBXSZMV.js → dgmo-router-YHBMKTXY.js} +32 -32
  98. package/dist/{dimensions-AMA2S7RO.js → dimensions-QMGWJQTR.js} +3 -3
  99. package/dist/{flowchart-parser-ADZIFVCH.js → flowchart-parser-BLJ6RA53.js} +2 -2
  100. package/dist/{flowchart-renderer-CAG6ZNJ6.js → flowchart-renderer-FXRQKXAK.js} +10 -6
  101. package/dist/index.js +37 -37
  102. package/dist/{layout-5VSMZPMG.js → layout-5HCEF7VO.js} +1 -1
  103. package/dist/{layout-VQ2USZJ3.js → layout-6PLSBB5X.js} +2 -2
  104. package/dist/{layout-UIV56NUA.js → layout-B7PQRAMB.js} +1 -1
  105. package/dist/{layout-C6MKMOBI.js → layout-CCVCLZ6S.js} +1 -1
  106. package/dist/{layout-T2PGKQUQ.js → layout-CRUAP7JG.js} +2 -2
  107. package/dist/{layout-UFB2O4AO.js → layout-G42FDCF3.js} +2 -2
  108. package/dist/{layout-6OSF2UGP.js → layout-IV4H2FLB.js} +2 -2
  109. package/dist/{layout-4RRC7XU7.js → layout-JTNRSGOS.js} +6 -3
  110. package/dist/{layout-H4K54IW3.js → layout-RBLD5EGX.js} +6 -3
  111. package/dist/{layout-SW3XWYKC.js → layout-ROAVGBUC.js} +1 -1
  112. package/dist/{layout-QS2SESBU.js → layout-T2DQ4M77.js} +6 -2
  113. package/dist/{layout-ZP7XYVXF.js → layout-YKGQRFDM.js} +2 -4
  114. package/dist/layout-search-L75YOBME.js +42 -0
  115. package/dist/{parser-NAUUUCI3.js → parser-2XCDVLSN.js} +2 -2
  116. package/dist/{parser-ESZ5J5IJ.js → parser-4QNRCGU5.js} +2 -2
  117. package/dist/{parser-W2DWCCLO.js → parser-6NSQLPTS.js} +2 -2
  118. package/dist/{parser-223VOHSB.js → parser-6X4GGH2R.js} +2 -2
  119. package/dist/{parser-B2FWP7ZO.js → parser-D6YRVV75.js} +2 -2
  120. package/dist/{parser-T2RVIRDG.js → parser-EY3VJWBE.js} +2 -2
  121. package/dist/{parser-KFIK3EOO.js → parser-EYF4ZSZO.js} +2 -2
  122. package/dist/{parser-2PNV7UI3.js → parser-H2DJEAPG.js} +2 -2
  123. package/dist/{parser-OV2WDSEV.js → parser-ILWAA3QJ.js} +2 -2
  124. package/dist/{parser-FV6RGALQ.js → parser-KMFMNZYI.js} +2 -2
  125. package/dist/{parser-LGUT7KKH.js → parser-MDSVVCJP.js} +2 -2
  126. package/dist/{parser-HPR7G7F6.js → parser-QL4DEPVA.js} +3 -3
  127. package/dist/{parser-BJDQX4KV.js → parser-UEDPLM46.js} +2 -2
  128. package/dist/{parser-E5HFYL7B.js → parser-UL6WN6W5.js} +2 -2
  129. package/dist/{parser-5ZD2NKGU.js → parser-ULSUK36C.js} +2 -2
  130. package/dist/{parser-57YQEEMC.js → parser-UY3K4ROB.js} +1 -1
  131. package/dist/{parser-MYRGCK7Q.js → parser-UYQNNQKT.js} +2 -2
  132. package/dist/{parser-NJ5VEZA3.js → parser-VG747VR6.js} +2 -2
  133. package/dist/{parser-CA5WC5HF.js → parser-VK4PNDX4.js} +2 -2
  134. package/dist/{parser-JFNDS5E5.js → parser-X5FQ36KJ.js} +2 -2
  135. package/dist/{parser-I4HZVIHX.js → parser-XO5IAXMT.js} +2 -2
  136. package/dist/{parser-WFY4ZJUW.js → parser-YVHO2NRM.js} +2 -2
  137. package/dist/{parser-J3BM2AP2.js → parser-YWZGIU3C.js} +2 -2
  138. package/dist/{parser-4B2PIXHI.js → parser-ZFLSULFC.js} +2 -2
  139. package/dist/{parser-RARXAHC7.js → parser-ZR7JAKSW.js} +1 -1
  140. package/dist/{renderer-3QM2DK7I.js → renderer-43IVPARP.js} +3 -3
  141. package/dist/{renderer-GWH5ACJ5.js → renderer-4MEZYGU6.js} +2 -2
  142. package/dist/{renderer-A3PMPUO6.js → renderer-54GXA3UO.js} +5 -5
  143. package/dist/{renderer-W22GX72R.js → renderer-7EAWN7MC.js} +4 -4
  144. package/dist/{renderer-IO3D5E4E.js → renderer-7SEXPBGM.js} +3 -3
  145. package/dist/{renderer-B3CPMS5R.js → renderer-B7B7BQM3.js} +7 -7
  146. package/dist/{renderer-IG72UJHW.js → renderer-I2LYSQBV.js} +3 -3
  147. package/dist/{renderer-OPDSKCQS.js → renderer-J2LOMTBC.js} +3 -3
  148. package/dist/{renderer-TTKTBB4C.js → renderer-JUH6M3XF.js} +6 -6
  149. package/dist/{renderer-COSJM7UG.js → renderer-KY6O5JTX.js} +33 -33
  150. package/dist/{renderer-PLRMST57.js → renderer-LHTDI5RV.js} +4 -4
  151. package/dist/{renderer-3W5T3IU6.js → renderer-LWL3IJOF.js} +3 -3
  152. package/dist/{renderer-SBXCPA3S.js → renderer-NCIDGJ2R.js} +5 -5
  153. package/dist/{renderer-AM4VZSBQ.js → renderer-OPA4JJKX.js} +4 -4
  154. package/dist/{renderer-O5RQHGK2.js → renderer-QMNC7TGN.js} +4 -4
  155. package/dist/{renderer-UVFGW2O6.js → renderer-QQNPJGAP.js} +3 -3
  156. package/dist/{renderer-WQ654YT5.js → renderer-R7RK7FKI.js} +1 -1
  157. package/dist/{renderer-TMQNTUQS.js → renderer-RFP55AW7.js} +10 -7
  158. package/dist/{renderer-FXCVH2M5.js → renderer-S3NFBJCY.js} +10 -7
  159. package/dist/{renderer-OA5D3ZKB.js → renderer-SD4ZHHAR.js} +6 -4
  160. package/dist/{renderer-PSMRAL72.js → renderer-SE7Z5AOL.js} +3 -3
  161. package/dist/{renderer-ON4PTUHJ.js → renderer-T2WUA7MC.js} +5 -5
  162. package/dist/{renderer-KK5BU5K2.js → renderer-TWKEZ3DD.js} +3 -3
  163. package/dist/{renderer-MK47ESCB.js → renderer-U5PD72G7.js} +3 -3
  164. package/dist/{renderer-52CHSV6S.js → renderer-VCTKBUTR.js} +5 -5
  165. package/dist/{renderer-PXGCR7N4.js → renderer-VNZTWATB.js} +3 -3
  166. package/dist/{renderer-4Z7FRQ2A.js → renderer-YDNWK6RI.js} +1 -1
  167. package/dist/{renderer-B4KE3NM4.js → renderer-YDOWBIUB.js} +4 -4
  168. package/dist/{renderer-LD2H7WGP.js → renderer-YQPZ7O2C.js} +1 -1
  169. package/dist/{renderer-6OOJNEQE.js → renderer-ZQ77CM6Y.js} +4 -4
  170. package/dist/{renderer-radial-42LVSG74.js → renderer-radial-TNNEL3YN.js} +4 -4
  171. package/dist/{resolver-XSXE2TRX.js → resolver-6DJLZF6Y.js} +1 -1
  172. package/dist/{state-parser-ROKY5KSI.js → state-parser-NIIVOU2Y.js} +2 -2
  173. package/dist/{state-renderer-MMG23G4W.js → state-renderer-TVLEG32M.js} +11 -7
  174. package/package.json +1 -1
  175. package/dist/chunk-6EK55ART.js +0 -116
  176. package/dist/chunk-HTNLLT34.js +0 -72
  177. /package/dist/{chunk-3FCSOYN4.js → chunk-5P2L5QXE.js} +0 -0
  178. /package/dist/{chunk-HJRP6PXL.js → chunk-BQVTV4LB.js} +0 -0
  179. /package/dist/{chunk-LYRDIVSY.js → chunk-GLCMUTO5.js} +0 -0
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-VLC6WNRD.js";
20
20
  import {
21
21
  tagAttrKey
22
- } from "./chunk-HX2KJEPD.js";
22
+ } from "./chunk-QKJ6MQXW.js";
23
23
  import {
24
24
  measureLegendText
25
25
  } from "./chunk-I6GGMCTV.js";
@@ -40,6 +40,7 @@ var LEGEND_BOTTOM_GAP = 10;
40
40
  function mapLegendGroups(legend) {
41
41
  const ramp = legend.ramp;
42
42
  const scoreGroup = ramp ? {
43
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- a blank metric name must still read 'Value'
43
44
  name: ramp.metric?.trim() || "Value",
44
45
  entries: [],
45
46
  gradient: {
@@ -1981,7 +1982,10 @@ function layoutMap(resolvedIn, data, size, opts) {
1981
1982
  const rampHue = resolveColor(resolved.directives.regionMetricColor ?? "", palette) ?? palette.colors.red;
1982
1983
  const rampLow = resolved.directives.regionMetricLowColor ? resolveColor(resolved.directives.regionMetricLowColor, palette) ?? void 0 : void 0;
1983
1984
  const hasRamp = values.length > 0;
1984
- const VALUE_NAME = hasRamp ? resolved.directives.regionMetric?.trim() || "Value" : null;
1985
+ const VALUE_NAME = hasRamp ? (
1986
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- a blank metric name must still read 'Value'
1987
+ resolved.directives.regionMetric?.trim() || "Value"
1988
+ ) : null;
1985
1989
  const matchColorGroup = (v) => {
1986
1990
  const lv = v.trim().toLowerCase();
1987
1991
  if (lv === "none") return null;
@@ -1,9 +1,10 @@
1
1
  import {
2
- buildPlacedNotes
3
- } from "./chunk-HTNLLT34.js";
2
+ searchPlacement
3
+ } from "./chunk-JJUDOR4I.js";
4
4
  import {
5
+ buildPlacedNotes,
5
6
  noteCanvasShift
6
- } from "./chunk-6EK55ART.js";
7
+ } from "./chunk-Q3N7PI3B.js";
7
8
  import {
8
9
  resolveNotes
9
10
  } from "./chunk-O753JUEZ.js";
@@ -69,6 +70,7 @@ function findConnectedComponents(tableIds, relationships) {
69
70
  }
70
71
  return components;
71
72
  }
73
+ var newDagreGraph = () => new dagre.graphlib.Graph({ multigraph: true });
72
74
  function layoutComponent(tables, rels, dimMap) {
73
75
  const nodePositions = /* @__PURE__ */ new Map();
74
76
  const edgePoints = /* @__PURE__ */ new Map();
@@ -87,22 +89,44 @@ function layoutComponent(tables, rels, dimMap) {
87
89
  height: dims.height
88
90
  };
89
91
  }
90
- const g = new dagre.graphlib.Graph({ multigraph: true });
91
- g.setGraph({ rankdir: "LR", nodesep: 40, ranksep: 80, edgesep: 20 });
92
- g.setDefaultEdgeLabel(() => ({}));
93
- for (const table of tables) {
94
- const dims = dimMap.get(table.id);
95
- g.setNode(table.id, { width: dims.width, height: dims.height });
96
- }
97
- for (const rel of rels) {
98
- g.setEdge(
99
- rel.source,
100
- rel.target,
101
- { label: rel.label ?? "" },
102
- String(rel.lineNumber)
103
- );
104
- }
105
- dagre.layout(g);
92
+ const place = (ranker, shuffle) => {
93
+ const ord = shuffle ?? ((a) => a.slice());
94
+ const g2 = newDagreGraph();
95
+ g2.setGraph({
96
+ rankdir: "LR",
97
+ ranker,
98
+ nodesep: 40,
99
+ ranksep: 80,
100
+ edgesep: 20
101
+ });
102
+ g2.setDefaultEdgeLabel(() => ({}));
103
+ for (const table of ord(tables)) {
104
+ const dims = dimMap.get(table.id);
105
+ g2.setNode(table.id, { width: dims.width, height: dims.height });
106
+ }
107
+ for (const rel of ord(rels)) {
108
+ g2.setEdge(
109
+ rel.source,
110
+ rel.target,
111
+ { label: rel.label ?? "" },
112
+ String(rel.lineNumber)
113
+ );
114
+ }
115
+ dagre.layout(g2);
116
+ return g2;
117
+ };
118
+ const { g, edgePoints: bent } = searchPlacement("LR", place, (lay) => ({
119
+ nodes: tables.map((t) => {
120
+ const p = lay.node(t.id);
121
+ return { id: t.id, x: p.x, y: p.y, width: p.width, height: p.height };
122
+ }),
123
+ edges: rels.map((r) => ({
124
+ source: r.source,
125
+ target: r.target,
126
+ points: lay.edge(r.source, r.target, String(r.lineNumber))?.points ?? []
127
+ }))
128
+ }));
129
+ const routeOf = (i, rel) => bent?.[i] ?? g.edge(rel.source, rel.target, String(rel.lineNumber))?.points ?? [];
106
130
  let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
107
131
  for (const table of tables) {
108
132
  const pos = g.node(table.id);
@@ -112,22 +136,21 @@ function layoutComponent(tables, rels, dimMap) {
112
136
  maxX = Math.max(maxX, pos.x + dims.width / 2);
113
137
  maxY = Math.max(maxY, pos.y + dims.height / 2);
114
138
  }
115
- for (const rel of rels) {
116
- const ed = g.edge(rel.source, rel.target, String(rel.lineNumber));
117
- for (const pt of ed?.points ?? []) {
139
+ rels.forEach((rel, i) => {
140
+ const pts = routeOf(i, rel);
141
+ for (const pt of pts) {
118
142
  minX = Math.min(minX, pt.x);
119
143
  minY = Math.min(minY, pt.y);
120
144
  maxX = Math.max(maxX, pt.x);
121
145
  maxY = Math.max(maxY, pt.y);
122
146
  }
123
- if (rel.label && (ed?.points ?? []).length > 0) {
124
- const pts = ed.points;
147
+ if (rel.label && pts.length > 0) {
125
148
  const mid = pts[Math.floor(pts.length / 2)];
126
149
  const hw = (measureText(rel.label, EDGE_LABEL_FONT_SIZE) + 8) / 2;
127
150
  minX = Math.min(minX, mid.x - hw);
128
151
  maxX = Math.max(maxX, mid.x + hw);
129
152
  }
130
- }
153
+ });
131
154
  for (const table of tables) {
132
155
  const pos = g.node(table.id);
133
156
  const dims = dimMap.get(table.id);
@@ -137,16 +160,12 @@ function layoutComponent(tables, rels, dimMap) {
137
160
  ...dims
138
161
  });
139
162
  }
140
- for (const rel of rels) {
141
- const ed = g.edge(rel.source, rel.target, String(rel.lineNumber));
163
+ rels.forEach((rel, i) => {
142
164
  edgePoints.set(
143
165
  rel.lineNumber,
144
- (ed?.points ?? []).map((pt) => ({
145
- x: pt.x - minX,
146
- y: pt.y - minY
147
- }))
166
+ routeOf(i, rel).map((pt) => ({ x: pt.x - minX, y: pt.y - minY }))
148
167
  );
149
- }
168
+ });
150
169
  return {
151
170
  nodePositions,
152
171
  edgePoints,
@@ -1,9 +1,10 @@
1
1
  import {
2
- buildPlacedNotes
3
- } from "./chunk-HTNLLT34.js";
2
+ searchPlacement
3
+ } from "./chunk-JJUDOR4I.js";
4
4
  import {
5
+ buildPlacedNotes,
5
6
  noteCanvasShift
6
- } from "./chunk-6EK55ART.js";
7
+ } from "./chunk-Q3N7PI3B.js";
7
8
  import {
8
9
  resolveNotes
9
10
  } from "./chunk-O753JUEZ.js";
@@ -75,32 +76,51 @@ function computeNodeDimensions(node) {
75
76
  const height = headerHeight + fieldsHeight + methodsHeight;
76
77
  return { width, height, headerHeight, fieldsHeight, methodsHeight };
77
78
  }
79
+ var newDagreGraph = () => new dagre.graphlib.Graph();
78
80
  function layoutClassDiagram(parsed, options) {
79
81
  if (parsed.classes.length === 0) {
80
82
  return { nodes: [], edges: [], width: 0, height: 0 };
81
83
  }
82
- const g = new dagre.graphlib.Graph();
83
- g.setGraph({
84
- rankdir: "TB",
85
- nodesep: 60,
86
- ranksep: 80,
87
- edgesep: 20
88
- });
89
- g.setDefaultEdgeLabel(() => ({}));
90
84
  const dimMap = /* @__PURE__ */ new Map();
91
85
  for (const node of parsed.classes) {
92
- const dims = computeNodeDimensions(node);
93
- dimMap.set(node.id, dims);
94
- g.setNode(node.id, {
95
- label: node.name,
96
- width: dims.width,
97
- height: dims.height
98
- });
86
+ dimMap.set(node.id, computeNodeDimensions(node));
99
87
  }
100
- for (const rel of parsed.relationships) {
101
- g.setEdge(rel.source, rel.target, { label: rel.label ?? "" });
102
- }
103
- dagre.layout(g);
88
+ const place = (ranker, shuffle) => {
89
+ const ord = shuffle ?? ((a) => a.slice());
90
+ const g2 = newDagreGraph();
91
+ g2.setGraph({
92
+ rankdir: "TB",
93
+ ranker,
94
+ nodesep: 60,
95
+ ranksep: 80,
96
+ edgesep: 20
97
+ });
98
+ g2.setDefaultEdgeLabel(() => ({}));
99
+ for (const node of ord(parsed.classes)) {
100
+ const dims = dimMap.get(node.id);
101
+ g2.setNode(node.id, {
102
+ label: node.name,
103
+ width: dims.width,
104
+ height: dims.height
105
+ });
106
+ }
107
+ for (const rel of ord(parsed.relationships)) {
108
+ g2.setEdge(rel.source, rel.target, { label: rel.label ?? "" });
109
+ }
110
+ dagre.layout(g2);
111
+ return g2;
112
+ };
113
+ const { g, edgePoints } = searchPlacement("TB", place, (lay) => ({
114
+ nodes: parsed.classes.map((n) => {
115
+ const p = lay.node(n.id);
116
+ return { id: n.id, x: p.x, y: p.y, width: p.width, height: p.height };
117
+ }),
118
+ edges: parsed.relationships.map((r) => ({
119
+ source: r.source,
120
+ target: r.target,
121
+ points: lay.edge(r.source, r.target)?.points ?? []
122
+ }))
123
+ }));
104
124
  const notesSuppressed = parsed.options?.["no-notes"] === "on";
105
125
  const noteByNode = notesSuppressed || !parsed.notes ? /* @__PURE__ */ new Map() : resolveNotes(
106
126
  parsed.notes,
@@ -137,13 +157,13 @@ function layoutClassDiagram(parsed, options) {
137
157
  ...note && { note }
138
158
  };
139
159
  });
140
- const layoutEdges = parsed.relationships.map((rel) => {
160
+ const layoutEdges = parsed.relationships.map((rel, i) => {
141
161
  const edgeData = g.edge(rel.source, rel.target);
142
162
  const layoutEdge = {
143
163
  source: rel.source,
144
164
  target: rel.target,
145
165
  type: rel.type,
146
- points: edgeData?.points ?? [],
166
+ points: edgePoints?.[i] ?? edgeData?.points ?? [],
147
167
  ...rel.label !== void 0 && { label: rel.label },
148
168
  lineNumber: rel.lineNumber
149
169
  };
@@ -175,6 +195,9 @@ function layoutClassDiagram(parsed, options) {
175
195
  );
176
196
  }
177
197
  }
198
+ for (const edge of layoutEdges) {
199
+ for (const pt of edge.points) extend(pt.x, pt.y, pt.x, pt.y);
200
+ }
178
201
  if (!Number.isFinite(bbMinX)) {
179
202
  bbMinX = 0;
180
203
  bbMinY = 0;
@@ -7,10 +7,10 @@ import {
7
7
  mutedFill,
8
8
  resolveCellColor,
9
9
  resolveColorMode
10
- } from "./chunk-A5EE66RQ.js";
10
+ } from "./chunk-53BJIOLF.js";
11
11
  import {
12
12
  renderIntegratedLegend
13
- } from "./chunk-NJYA4QSN.js";
13
+ } from "./chunk-QVKTAU7P.js";
14
14
  import {
15
15
  layoutInlineHeader
16
16
  } from "./chunk-CNUN5GO6.js";
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-ICLB27PZ.js";
29
29
  import {
30
30
  tagAttrKey
31
- } from "./chunk-HX2KJEPD.js";
31
+ } from "./chunk-QKJ6MQXW.js";
32
32
  import {
33
33
  LEGEND_GROUP_GAP
34
34
  } from "./chunk-I6GGMCTV.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GRAPH_DX
3
- } from "./chunk-7TF3QOOD.js";
3
+ } from "./chunk-TIVMAITN.js";
4
4
  import {
5
5
  tryCollectNote
6
6
  } from "./chunk-KSZHIAI2.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  compactNumber
3
- } from "./chunk-A5EE66RQ.js";
3
+ } from "./chunk-53BJIOLF.js";
4
4
  import {
5
5
  parseInlineMarkdown
6
6
  } from "./chunk-S7W75MIM.js";
@@ -43,11 +43,11 @@ function computeMetrics(parsed) {
43
43
  }
44
44
  function autoBandColor(pctFrac, palette) {
45
45
  const name = pctFrac < 0.5 ? "red" : pctFrac < 0.8 ? "orange" : "green";
46
- return resolveColor(name, palette) || name;
46
+ return resolveColor(name, palette) ?? name;
47
47
  }
48
48
  function resolvePaint(parsed, palette, isDark, pctFrac) {
49
49
  const autoColor = !parsed.options.noAutoColor && parsed.hasTarget ? autoBandColor(pctFrac, palette) : null;
50
- const base = parsed.color && resolveColor(parsed.color, palette) || parsed.color || autoColor || getSeriesColors(palette)[0];
50
+ const base = (parsed.color && resolveColor(parsed.color, palette)) ?? parsed.color ?? autoColor ?? getSeriesColors(palette)[0];
51
51
  return {
52
52
  base,
53
53
  // §1.9 fill family: tint (default) / solid / outline. In outline mode the
@@ -17,7 +17,7 @@ import {
17
17
  stripDefaultModifier,
18
18
  tagAttrKey,
19
19
  validateTagGroupNames
20
- } from "./chunk-HX2KJEPD.js";
20
+ } from "./chunk-QKJ6MQXW.js";
21
21
  import {
22
22
  AliasRegistry,
23
23
  GANTT_BOOLEAN_SET,
@@ -326,7 +326,7 @@ function parseGantt(content, palette) {
326
326
  // Peel after extractColor — the quotes are what keep a trailing
327
327
  // color word inside the label (§2.2).
328
328
  label: peelQuotedName(eraExtracted.label),
329
- color: eraExtracted.color || null,
329
+ color: eraExtracted.color ?? null,
330
330
  lineNumber
331
331
  });
332
332
  } else {
@@ -357,7 +357,7 @@ function parseGantt(content, palette) {
357
357
  // Peel after extractColor — the quotes are what keep a trailing
358
358
  // color word inside the label (§2.2).
359
359
  label: peelQuotedName(markerExtracted.label),
360
- color: markerExtracted.color || null,
360
+ color: markerExtracted.color ?? null,
361
361
  lineNumber
362
362
  });
363
363
  } else {
@@ -383,7 +383,7 @@ function parseGantt(content, palette) {
383
383
  diagnostics,
384
384
  lineNumber
385
385
  );
386
- const color = extracted.color || seriesColors[currentTagGroup.entries.length % seriesColors.length] || "#888888";
386
+ const color = extracted.color ?? seriesColors[currentTagGroup.entries.length % seriesColors.length] ?? "#888888";
387
387
  const isFirstEntry = currentTagGroup.entries.length === 0;
388
388
  currentTagGroup.entries.push({
389
389
  value: extracted.label,
@@ -582,7 +582,7 @@ function parseGantt(content, palette) {
582
582
  startDate: "",
583
583
  endDate: "",
584
584
  label: peelQuotedName(eraExtracted.label),
585
- color: eraExtracted.color || null,
585
+ color: eraExtracted.color ?? null,
586
586
  lineNumber,
587
587
  ...startOff && { offsetStart: startOff },
588
588
  ...endOff && { offsetEnd: endOff }
@@ -602,7 +602,7 @@ function parseGantt(content, palette) {
602
602
  result.markers.push({
603
603
  date: "",
604
604
  label: peelQuotedName(markerExtracted.label),
605
- color: markerExtracted.color || null,
605
+ color: markerExtracted.color ?? null,
606
606
  lineNumber,
607
607
  ...dateOff && { offsetDate: dateOff }
608
608
  });
@@ -685,7 +685,7 @@ function parseGantt(content, palette) {
685
685
  startDate: eraMatch.start,
686
686
  endDate: eraMatch.end,
687
687
  label: peelQuotedName(eraExtracted.label),
688
- color: eraExtracted.color || null,
688
+ color: eraExtracted.color ?? null,
689
689
  lineNumber
690
690
  });
691
691
  continue;
@@ -710,7 +710,7 @@ function parseGantt(content, palette) {
710
710
  result.markers.push({
711
711
  date: markerMatch.iso,
712
712
  label: peelQuotedName(markerExtracted.label),
713
- color: markerExtracted.color || null,
713
+ color: markerExtracted.color ?? null,
714
714
  lineNumber
715
715
  });
716
716
  continue;
@@ -1086,7 +1086,7 @@ function parseGantt(content, palette) {
1086
1086
  validateTagGroupNames(result.tagGroups, warn, (line, msg) => {
1087
1087
  const diag = makeDgmoError(line, msg);
1088
1088
  diagnostics.push(diag);
1089
- if (!result.error) result.error = formatDgmoError(diag);
1089
+ result.error ??= formatDgmoError(diag);
1090
1090
  });
1091
1091
  const activeTagWarning = activeTagNoMatchMessage(
1092
1092
  result.options.activeTag,
@@ -1094,7 +1094,7 @@ function parseGantt(content, palette) {
1094
1094
  );
1095
1095
  if (activeTagWarning) {
1096
1096
  warn(
1097
- result.options.optionLineNumbers["active-tag"] || 1,
1097
+ result.options.optionLineNumbers["active-tag"] ?? 1,
1098
1098
  activeTagWarning,
1099
1099
  "W_ACTIVE_TAG_NO_MATCH"
1100
1100
  );
@@ -1107,12 +1107,8 @@ function parseGantt(content, palette) {
1107
1107
  result.options.sprintMode = "auto";
1108
1108
  }
1109
1109
  if (result.options.sprintMode) {
1110
- if (!result.options.sprintLength) {
1111
- result.options.sprintLength = { amount: 2, unit: "w" };
1112
- }
1113
- if (result.options.sprintNumber === null) {
1114
- result.options.sprintNumber = 1;
1115
- }
1110
+ result.options.sprintLength ??= { amount: 2, unit: "w" };
1111
+ result.options.sprintNumber ??= 1;
1116
1112
  }
1117
1113
  result.diagnostics.push(...nameAliasMap.finish());
1118
1114
  return result;
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-RE27AX7O.js";
8
8
  import {
9
9
  parseDgmoChartType
10
- } from "./chunk-YWRZG6GN.js";
10
+ } from "./chunk-2AM6VA3A.js";
11
11
  import {
12
12
  chartTypes
13
13
  } from "./chunk-MPJQMMBZ.js";
@@ -189,7 +189,7 @@ function frownMark(cx, cy, color) {
189
189
  }
190
190
  function diagrammoIcon(x, y, size) {
191
191
  const s = size / 100;
192
- return `<g transform="translate(${x} ${y}) scale(${s})"><rect width="100" height="100" rx="18" fill="#1f2933"/><path d="M41 71 L41 63.51 A28 28 0 1 1 59 63.51 L59 71" fill="none" stroke="#c9a227" stroke-width="6" stroke-linecap="round" stroke-linejoin="round"/><rect x="36" y="43" width="7" height="9" rx="1.9" fill="#c0504d"/><rect x="45" y="37" width="7" height="15" rx="1.9" fill="#5b9357"/><rect x="54" y="30" width="7" height="22" rx="1.9" fill="#3b6ea5"/><rect x="36" y="75" width="28" height="4.6" rx="2.3" fill="#7d5ba6"/><rect x="36" y="82" width="28" height="4.6" rx="2.3" fill="#7d5ba6"/><rect x="36" y="89" width="28" height="4.6" rx="2.3" fill="#7d5ba6"/></g>`;
192
+ return `<g transform="translate(${x} ${y}) scale(${s})"><g transform="translate(-3.27 -4.56) scale(1.0911)"><rect x="11" y="8" width="22" height="39.5" rx="2.5" fill="#c0504d"/><rect x="11" y="52.5" width="22" height="22.1" rx="2.5" fill="#5b9357"/><rect x="11" y="79.6" width="22" height="12.4" rx="2.5" fill="#4f96c4"/><path fill="#3a9188" d="M45 11.12 A3 3 0 0 1 48.23 8.12 A42 42 0 0 1 86.52 43.65 A3 3 0 0 1 83.78 47.10 L72.76 47.92 A3 3 0 0 1 69.59 45.47 A25 25 0 0 0 47.68 25.14 A3 3 0 0 1 45 22.16 Z"/><path fill="#7d5ba6" d="M83.78 52.90 A3 3 0 0 1 86.52 56.35 A42 42 0 0 1 74.53 79.87 A3 3 0 0 1 70.13 79.67 L62.99 71.24 A3 3 0 0 1 63.12 67.23 A25 25 0 0 0 69.59 54.53 A3 3 0 0 1 72.76 52.08 Z"/><path fill="#cc7a33" d="M65.43 83.08 A3 3 0 0 1 64.27 87.32 A42 42 0 0 1 48.23 91.88 A3 3 0 0 1 45 88.88 L45 77.84 A3 3 0 0 1 47.68 74.86 A25 25 0 0 0 55.78 72.56 A3 3 0 0 1 59.63 73.69 Z"/></g></g>`;
193
193
  }
194
194
  function docIcon(x, y, size, color) {
195
195
  const s = size / 18;
@@ -159,7 +159,10 @@ function parseCycle(content) {
159
159
  warn(lineNum, "Edge line found outside of a node context.");
160
160
  continue;
161
161
  }
162
- const edgeLabel = bareMatch ? void 0 : labeledMatch[1]?.trim() || void 0;
162
+ const edgeLabel = bareMatch ? void 0 : (
163
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- an empty label is stored as no label
164
+ labeledMatch[1]?.trim() || void 0
165
+ );
163
166
  const rest = (bareMatch ? bareMatch[1] ?? "" : labeledMatch[2] ?? "").trim();
164
167
  const edgeSplit = splitNameAndMeta(
165
168
  rest,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  layoutOrg
3
- } from "./chunk-GQVXYRPC.js";
3
+ } from "./chunk-MI6SJJQU.js";
4
4
  import {
5
5
  renderCollapseBar,
6
6
  renderNodeCard
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-24YPR5EH.js";
11
11
  import {
12
12
  renderIntegratedLegend
13
- } from "./chunk-NJYA4QSN.js";
13
+ } from "./chunk-QVKTAU7P.js";
14
14
  import {
15
15
  CARD_RADIUS,
16
16
  COLLAPSE_BAR_HEIGHT,
@@ -44,11 +44,11 @@ import {
44
44
  } from "./chunk-ICLB27PZ.js";
45
45
  import {
46
46
  parseOrg
47
- } from "./chunk-FS2LZBHG.js";
47
+ } from "./chunk-UWJP4JSZ.js";
48
48
  import {
49
49
  resolveTagColor,
50
50
  tagAttrKey
51
- } from "./chunk-HX2KJEPD.js";
51
+ } from "./chunk-QKJ6MQXW.js";
52
52
  import {
53
53
  fillModeFromOptions
54
54
  } from "./chunk-MPJQMMBZ.js";
@@ -4,13 +4,13 @@ import {
4
4
  import {
5
5
  computeNodeSizing,
6
6
  layoutPert
7
- } from "./chunk-64KSPLU2.js";
7
+ } from "./chunk-273GB7WK.js";
8
8
  import {
9
9
  ScaleContext
10
10
  } from "./chunk-24YPR5EH.js";
11
11
  import {
12
12
  renderIntegratedLegend
13
- } from "./chunk-NJYA4QSN.js";
13
+ } from "./chunk-QVKTAU7P.js";
14
14
  import {
15
15
  ARROWHEAD_HEIGHT,
16
16
  ARROWHEAD_WIDTH,
@@ -52,7 +52,7 @@ import {
52
52
  } from "./chunk-ICLB27PZ.js";
53
53
  import {
54
54
  parsePert
55
- } from "./chunk-AAC3XQWV.js";
55
+ } from "./chunk-37QQXKFV.js";
56
56
  import {
57
57
  addCalendarDays,
58
58
  formatDuration,
@@ -65,7 +65,7 @@ import {
65
65
  resolveActiveTagGroup,
66
66
  resolveGroupTagColor,
67
67
  resolveTagColor
68
- } from "./chunk-HX2KJEPD.js";
68
+ } from "./chunk-QKJ6MQXW.js";
69
69
  import {
70
70
  LEGEND_HEIGHT
71
71
  } from "./chunk-I6GGMCTV.js";
@@ -918,10 +918,7 @@ function renderNodes(root, _defs, resolved, layout, palette, isDark, sizing, onC
918
918
  } else {
919
919
  band = isCritical ? "red" : null;
920
920
  }
921
- const g = layer.append("g").attr("class", "pert-node").attr("transform", `translate(${node.x}, ${node.y})`).attr("data-activity-id", node.id).attr("data-line-number", String(r.activity.lineNumber)).attr(
922
- "data-group-id",
923
- r.activity.groupId !== void 0 ? r.activity.groupId : ""
924
- ).attr("data-critical-path", String(isCritical)).attr("data-criticality-band", band ?? "").attr("data-duration-rank", isTopMu ? "top" : isBottomMu ? "bottom" : "");
921
+ const g = layer.append("g").attr("class", "pert-node").attr("transform", `translate(${node.x}, ${node.y})`).attr("data-activity-id", node.id).attr("data-line-number", String(r.activity.lineNumber)).attr("data-group-id", r.activity.groupId ?? "").attr("data-critical-path", String(isCritical)).attr("data-criticality-band", band ?? "").attr("data-duration-rank", isTopMu ? "top" : isBottomMu ? "bottom" : "");
925
922
  if (r.activity.tags) {
926
923
  for (const [tagKey, tagValue] of Object.entries(r.activity.tags)) {
927
924
  g.attr(`data-tag-${tagKey}`, String(tagValue).toLowerCase());