@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
@@ -25,10 +25,10 @@ import {
25
25
  import {
26
26
  NOTE_BULLET_INDENT,
27
27
  wrapNoteBody
28
- } from "./chunk-D6PVMUCX.js";
28
+ } from "./chunk-VDY2GR6U.js";
29
29
  import {
30
30
  renderInlineText
31
- } from "./chunk-65GPEV5V.js";
31
+ } from "./chunk-QKPOIJBT.js";
32
32
  import {
33
33
  FONT_FAMILY
34
34
  } from "./chunk-ICLB27PZ.js";
@@ -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";
@@ -3,7 +3,7 @@ import {
3
3
  mapLegendConfig,
4
4
  mapLegendGroups,
5
5
  parsePathRings
6
- } from "./chunk-4RY5D5RE.js";
6
+ } from "./chunk-AM42TLSZ.js";
7
7
  import {
8
8
  buildSwatches
9
9
  } from "./chunk-T7NWBVSC.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  searchPlacement
3
- } from "./chunk-LDDDKWL6.js";
3
+ } from "./chunk-TDAGJJPZ.js";
4
4
  import {
5
5
  buildPlacedNotes,
6
6
  noteCanvasShift,
7
7
  resolveNotes
8
- } from "./chunk-NJJCTEBM.js";
8
+ } from "./chunk-7SXV7NUS.js";
9
9
  import {
10
10
  measureText
11
11
  } from "./chunk-KAO7JL4I.js";
@@ -3,13 +3,13 @@ import {
3
3
  } from "./chunk-R2K5L4UA.js";
4
4
  import {
5
5
  formatDateLabel
6
- } from "./chunk-3GCASUWA.js";
6
+ } from "./chunk-TASRGDYP.js";
7
7
  import {
8
8
  parseTimelineDate
9
9
  } from "./chunk-BQO24BDM.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,
@@ -31,10 +31,10 @@ import {
31
31
  } from "./chunk-JILEYZ2V.js";
32
32
  import {
33
33
  wrapDescriptionLines
34
- } from "./chunk-MB2SQF7N.js";
34
+ } from "./chunk-7WEYXYLC.js";
35
35
  import {
36
36
  renderInlineText
37
- } from "./chunk-65GPEV5V.js";
37
+ } from "./chunk-QKPOIJBT.js";
38
38
  import {
39
39
  FONT_FAMILY
40
40
  } from "./chunk-ICLB27PZ.js";
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-CN4RDJDV.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,
@@ -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";
@@ -4,11 +4,6 @@ import {
4
4
  wrapTextToWidth
5
5
  } from "./chunk-KAO7JL4I.js";
6
6
 
7
- // src/boxes-and-lines/node-metrics.ts
8
- var PHI = 1.618;
9
- var NODE_HEIGHT = 60;
10
- var NODE_WIDTH = Math.round(NODE_HEIGHT * PHI);
11
-
12
7
  // src/boxes-and-lines/label-placement.ts
13
8
  import { curveBasis } from "d3-shape";
14
9
  var EDGE_LABEL_FONT_SIZE = 11;
@@ -426,8 +421,6 @@ function placeEdgeLabels(layout, opts) {
426
421
  }
427
422
 
428
423
  export {
429
- NODE_HEIGHT,
430
- NODE_WIDTH,
431
424
  EDGE_LABEL_FONT_SIZE,
432
425
  BOX_CLEAR_PAD,
433
426
  LABEL_REACH_WIDE,
@@ -3,14 +3,14 @@ import {
3
3
  capLabelColumn,
4
4
  computeTimeTicks,
5
5
  showFullOnHover
6
- } from "./chunk-VSOZZYLK.js";
6
+ } from "./chunk-NERQSSYD.js";
7
7
  import {
8
8
  ScaleContext
9
9
  } from "./chunk-24YPR5EH.js";
10
10
  import {
11
11
  INLINE_HEADER_PAD,
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,
@@ -1448,10 +1448,14 @@ function renderErasAndMarkers(g, svg, resolved, xScale, innerHeight, palette, er
1448
1448
  const eraEndDate = parseDateStringToDate(era.endDate);
1449
1449
  const eraG = g.append("g").attr("class", "gantt-era-group").attr("data-line-number", String(era.lineNumber));
1450
1450
  const eraRect = eraG.append("rect").attr("class", "gantt-era").attr("x", sx).attr("y", 0).attr("width", ex - sx).attr("height", innerHeight).attr("fill", color).attr("opacity", baseEraOpacity);
1451
- const eraLabelMaxW = Math.max(0, ex - sx - 8);
1451
+ const [plotStart, plotEnd] = xScale.range();
1452
+ const vsx = Math.max(sx, plotStart);
1453
+ const vex = Math.min(ex, plotEnd);
1454
+ if (vex <= vsx) continue;
1455
+ const eraLabelMaxW = Math.max(0, vex - vsx - 8);
1452
1456
  const eraDisplayLabel = truncateLegendText(era.label, 10, eraLabelMaxW);
1453
1457
  const eraTruncated = eraDisplayLabel !== era.label;
1454
- const eraLabel = eraG.append("text").attr("class", "gantt-era-label").attr("x", (sx + ex) / 2).attr("y", eraLabelY).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", color).attr("opacity", 0.7).style("cursor", "pointer").text(eraDisplayLabel);
1458
+ const eraLabel = eraG.append("text").attr("class", "gantt-era-label").attr("x", (vsx + vex) / 2).attr("y", eraLabelY).attr("text-anchor", "middle").attr("font-size", 10).attr("fill", color).attr("opacity", 0.7).style("cursor", "pointer").text(eraDisplayLabel);
1455
1459
  eraG.on("mouseenter", () => {
1456
1460
  g.selectAll(".gantt-task").attr(
1457
1461
  "opacity",
@@ -2105,6 +2109,18 @@ function dateToFractionalYear(d) {
2105
2109
  const fraction = (d.getTime() - startOfYear.getTime()) / (endOfYear.getTime() - startOfYear.getTime());
2106
2110
  return y + fraction;
2107
2111
  }
2112
+ function fractionalYearToDate(frac) {
2113
+ const y = Math.floor(frac);
2114
+ const startOfYear = new Date(y, 0, 1);
2115
+ const endOfYear = new Date(y + 1, 0, 1);
2116
+ return new Date(
2117
+ startOfYear.getTime() + (frac - y) * (endOfYear.getTime() - startOfYear.getTime())
2118
+ );
2119
+ }
2120
+ var EXACT_FRACTIONAL_YEAR = {
2121
+ toFractionalYear: dateToFractionalYear,
2122
+ fromFractionalYear: fractionalYearToDate
2123
+ };
2108
2124
  function diamondPoints(cx, cy, size) {
2109
2125
  const half = size / 2;
2110
2126
  return `${cx},${cy - half} ${cx + half},${cy} ${cx},${cy + half} ${cx - half},${cy}`;
@@ -2188,7 +2204,17 @@ function renderTimeScaleHorizontal(g, scale, _innerWidth, innerHeight, textColor
2188
2204
  const domain = scale.domain();
2189
2205
  const domainMin = domain[0];
2190
2206
  const domainMax = domain[1];
2191
- const ticks = computeTimeTicks(domainMin, domainMax, scale);
2207
+ const ticks = computeTimeTicks(
2208
+ domainMin,
2209
+ domainMax,
2210
+ scale,
2211
+ void 0,
2212
+ void 0,
2213
+ void 0,
2214
+ void 0,
2215
+ void 0,
2216
+ EXACT_FRACTIONAL_YEAR
2217
+ );
2192
2218
  if (ticks.length < 2) return;
2193
2219
  const tickLen = 6;
2194
2220
  const opacity = 0.4;
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  searchPlacement
3
- } from "./chunk-LDDDKWL6.js";
3
+ } from "./chunk-TDAGJJPZ.js";
4
4
  import {
5
5
  noteCanvasShift,
6
6
  placeNotes,
7
7
  resolveNotes
8
- } from "./chunk-NJJCTEBM.js";
8
+ } from "./chunk-7SXV7NUS.js";
9
9
  import {
10
10
  noteBoxSize
11
- } from "./chunk-D6PVMUCX.js";
11
+ } from "./chunk-VDY2GR6U.js";
12
12
 
13
13
  // src/graph/layout.ts
14
14
  import dagre from "@dagrejs/dagre";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  drawCylinderCard,
3
3
  drawQueueCard
4
- } from "./chunk-KRU2LCIP.js";
4
+ } from "./chunk-IHN6WDEY.js";
5
5
  import {
6
6
  CYLINDER_RY,
7
7
  QUEUE_CAP
@@ -498,6 +498,7 @@ function whiteboardBounds(parsed, options = {}) {
498
498
  maxY: -Infinity
499
499
  };
500
500
  const elements = visibleWhiteboardElements(parsed, options);
501
+ const labelAt = placeConnectorLabels(elements);
501
502
  for (const el of elements) {
502
503
  switch (el.kind) {
503
504
  case "shape":
@@ -527,7 +528,7 @@ function whiteboardBounds(parsed, options = {}) {
527
528
  }
528
529
  if (el.label) {
529
530
  const lines = labelLines(el.label);
530
- const { x: mx, y: my } = whiteboardSegmentMidpoint(s);
531
+ const { x: mx, y: my } = labelAt.get(el);
531
532
  const hw = widest(lines, WHITEBOARD_LABEL_FONT) / 2 + 4;
532
533
  const hh = WHITEBOARD_LABEL_FONT + (lines.length - 1) * WHITEBOARD_LABEL_FONT * WHITEBOARD_LABEL_LINE / 2;
533
534
  grow(b, mx - hw, my - hh, mx + hw, my + hh);
@@ -578,6 +579,79 @@ function curveTrim(s, end, len) {
578
579
  }
579
580
  return (near + far) / 2;
580
581
  }
582
+ var LABEL_SLIDE_STEP = 0.05;
583
+ var LABEL_SLIDE_TRIES = 8;
584
+ var LABEL_CLEAR = 5;
585
+ function boxesOverlap(a, b) {
586
+ return a.x0 < b.x1 && b.x0 < a.x1 && a.y0 < b.y1 && b.y0 < a.y1;
587
+ }
588
+ function connectorLabelBox(lines, x, y) {
589
+ const hw = widest(lines, WHITEBOARD_LABEL_FONT) / 2 + LABEL_CLEAR;
590
+ const hh = lines.length * WHITEBOARD_LABEL_FONT * WHITEBOARD_LABEL_LINE / 2 + LABEL_CLEAR;
591
+ return { x0: x - hw, y0: y - hh, x1: x + hw, y1: y + hh };
592
+ }
593
+ function authoredTextBoxes(elements) {
594
+ const boxes = [];
595
+ for (const el of elements) {
596
+ if (el.kind === "text") {
597
+ const lines = labelLines(el.text);
598
+ boxes.push({
599
+ x0: el.x,
600
+ y0: el.y,
601
+ x1: el.x + widest(lines, WHITEBOARD_TEXT_FONT),
602
+ y1: el.y + lines.length * WHITEBOARD_TEXT_FONT * WHITEBOARD_LABEL_LINE
603
+ });
604
+ } else if (el.kind === "note") {
605
+ boxes.push({
606
+ x0: el.x,
607
+ y0: el.y,
608
+ x1: el.x + el.width,
609
+ y1: el.y + Math.max(el.height, noteTextHeight(el))
610
+ });
611
+ } else if (el.kind === "shape" && el.label) {
612
+ const { lines, font } = fitWhiteboardLabel(el.label, el);
613
+ if (lines.length === 0) continue;
614
+ const cx = el.x + el.width / 2 + whiteboardLabelShift(el);
615
+ const cy = el.y + el.height / 2;
616
+ const hw = widest(lines, font) / 2;
617
+ const hh = lines.length * font * WHITEBOARD_LABEL_LINE / 2;
618
+ boxes.push({ x0: cx - hw, y0: cy - hh, x1: cx + hw, y1: cy + hh });
619
+ }
620
+ }
621
+ return boxes;
622
+ }
623
+ function placeConnectorLabels(elements) {
624
+ const placed = /* @__PURE__ */ new Map();
625
+ const taken = authoredTextBoxes(elements);
626
+ for (const el of elements) {
627
+ if (el.kind !== "arrow" && el.kind !== "line" || !el.label) continue;
628
+ const lines = labelLines(el.label);
629
+ const s = clipWhiteboardConnector(el, elements);
630
+ const mid = whiteboardSegmentMidpoint(s);
631
+ let at = mid;
632
+ const clears = (p) => {
633
+ const box = connectorLabelBox(lines, p.x, p.y);
634
+ return !taken.some((t) => boxesOverlap(box, t));
635
+ };
636
+ if (!clears(mid)) {
637
+ search: for (let k = 1; k <= LABEL_SLIDE_TRIES; k++) {
638
+ for (const t of [
639
+ 0.5 - k * LABEL_SLIDE_STEP,
640
+ 0.5 + k * LABEL_SLIDE_STEP
641
+ ]) {
642
+ const p = segmentPoint(s, t);
643
+ if (clears(p)) {
644
+ at = p;
645
+ break search;
646
+ }
647
+ }
648
+ }
649
+ }
650
+ placed.set(el, at);
651
+ taken.push(connectorLabelBox(lines, at.x, at.y));
652
+ }
653
+ return placed;
654
+ }
581
655
  function whiteboardConnectorPaint(s, heads) {
582
656
  const polygon = (tip, ux, uy, head) => {
583
657
  const bx = tip.x - ux * head;
@@ -665,6 +739,7 @@ function renderWhiteboard(container, parsed, palette, isDark, options = {}) {
665
739
  const titleOffset = showTitle ? TITLE_BAND : 0;
666
740
  const elements = visibleWhiteboardElements(parsed, options);
667
741
  const b = whiteboardBounds(parsed, options);
742
+ const labelAt = placeConnectorLabels(elements);
668
743
  const contentW = b.maxX - b.minX;
669
744
  const contentH = b.maxY - b.minY;
670
745
  const titleW = showTitle ? measureText(parsed.title, TITLE_FONT_SIZE, { bold: true }) : 0;
@@ -814,7 +889,7 @@ function renderWhiteboard(container, parsed, palette, isDark, options = {}) {
814
889
  }
815
890
  if (el.label) {
816
891
  const lines = labelLines(el.label);
817
- const mid = whiteboardSegmentMidpoint(s);
892
+ const mid = labelAt.get(el);
818
893
  const mx = round2(mid.x);
819
894
  const lh = WHITEBOARD_LABEL_FONT * WHITEBOARD_LABEL_LINE;
820
895
  const firstY = mid.y + WHITEBOARD_LABEL_FONT * 0.35 - (lines.length - 1) * lh / 2;
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  INLINE_HEADER_PAD,
16
16
  layoutInlineHeader
17
- } from "./chunk-42UJ23H3.js";
17
+ } from "./chunk-UIEKW4SG.js";
18
18
  import {
19
19
  CAPTION_BOX_PADDING_X,
20
20
  CAPTION_BOX_PADDING_Y,
@@ -38,10 +38,21 @@ function fractionalYearToDate(frac) {
38
38
  function dateToFractionalYear(d) {
39
39
  return d.getFullYear() + d.getMonth() / 12 + (d.getDate() - 1) / 365 + d.getHours() / 8760 + d.getMinutes() / 525600 + d.getSeconds() / 31536e3;
40
40
  }
41
+ var APPROXIMATE_CONVERTERS = {
42
+ toFractionalYear: dateToFractionalYear,
43
+ fromFractionalYear: fractionalYearToDate
44
+ };
45
+ function calendarDay(year, month0, day) {
46
+ const d = new Date(2e3, month0, day);
47
+ d.setFullYear(year);
48
+ return d;
49
+ }
41
50
  function formatYearTick(y) {
42
51
  return y < 0 ? `${-y} BCE` : String(y);
43
52
  }
44
- function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEnd, boundaryStartLabel, boundaryEndLabel, labelFit = { fontSize: 10 }) {
53
+ function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEnd, boundaryStartLabel, boundaryEndLabel, labelFit = { fontSize: 10 }, converters) {
54
+ const { toFractionalYear, fromFractionalYear } = converters ?? APPROXIMATE_CONVERTERS;
55
+ const dayValue = (y, month0, day) => converters ? toFractionalYear(calendarDay(y, month0, day)) : y + month0 / 12 + (day - 1) / 365;
45
56
  const minYear = Math.floor(domainMin);
46
57
  const maxYear = Math.floor(domainMax);
47
58
  const span = domainMax - domainMin;
@@ -70,7 +81,7 @@ function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEn
70
81
  const crossesYear = maxYear > minYear;
71
82
  for (let y = minYear; y <= maxYear + 1; y++) {
72
83
  for (let m = 1; m <= 12; m++) {
73
- const val = y + (m - 1) / 12;
84
+ const val = dayValue(y, m - 1, 1);
74
85
  if (val > domainMax) break;
75
86
  if (val >= domainMin) {
76
87
  const abbr = MONTH_ABBR[m - 1];
@@ -89,13 +100,13 @@ function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEn
89
100
  if (spanSec > 180) stepSec = 30;
90
101
  else if (spanSec > 60) stepSec = 15;
91
102
  else if (spanSec > 30) stepSec = 10;
92
- const startDate = fractionalYearToDate(domainMin);
103
+ const startDate = fromFractionalYear(domainMin);
93
104
  startDate.setSeconds(
94
105
  Math.floor(startDate.getSeconds() / stepSec) * stepSec,
95
106
  0
96
107
  );
97
108
  while (true) {
98
- const val = dateToFractionalYear(startDate);
109
+ const val = toFractionalYear(startDate);
99
110
  if (val > domainMax) break;
100
111
  if (val >= domainMin) {
101
112
  const hh = String(startDate.getHours()).padStart(2, "0");
@@ -115,14 +126,14 @@ function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEn
115
126
  if (spanHours > 3) stepMin = 30;
116
127
  else if (spanHours > 1) stepMin = 15;
117
128
  else if (spanHours > 0.5) stepMin = 10;
118
- const startDate = fractionalYearToDate(domainMin);
129
+ const startDate = fromFractionalYear(domainMin);
119
130
  startDate.setMinutes(
120
131
  Math.floor(startDate.getMinutes() / stepMin) * stepMin,
121
132
  0,
122
133
  0
123
134
  );
124
135
  while (true) {
125
- const val = dateToFractionalYear(startDate);
136
+ const val = toFractionalYear(startDate);
126
137
  if (val > domainMax) break;
127
138
  if (val >= domainMin) {
128
139
  const hh = String(startDate.getHours()).padStart(2, "0");
@@ -142,7 +153,7 @@ function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEn
142
153
  else if (spanHours > 24) stepHour = 3;
143
154
  else if (spanHours > 12) stepHour = 2;
144
155
  const singleDay = spanHours <= 24;
145
- const startDate = fractionalYearToDate(domainMin);
156
+ const startDate = fromFractionalYear(domainMin);
146
157
  startDate.setHours(
147
158
  Math.floor(startDate.getHours() / stepHour) * stepHour,
148
159
  0,
@@ -150,7 +161,7 @@ function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEn
150
161
  0
151
162
  );
152
163
  while (true) {
153
- const val = dateToFractionalYear(startDate);
164
+ const val = toFractionalYear(startDate);
154
165
  if (val > domainMax) break;
155
166
  if (val >= domainMin) {
156
167
  const hh = String(startDate.getHours()).padStart(2, "0");
@@ -177,7 +188,7 @@ function computeTimeTicks(domainMin, domainMax, scale, boundaryStart, boundaryEn
177
188
  for (let y = minYear; y <= maxYear + 1; y++) {
178
189
  for (let m = 1; m <= 12; m++) {
179
190
  for (const d of [1, 8, 15, 22]) {
180
- const val = y + (m - 1) / 12 + (d - 1) / 365;
191
+ const val = dayValue(y, m - 1, d);
181
192
  if (val > domainMax) break;
182
193
  if (val >= domainMin) {
183
194
  ticks.push({
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-24YPR5EH.js";
13
13
  import {
14
14
  layoutInlineHeader
15
- } from "./chunk-42UJ23H3.js";
15
+ } from "./chunk-UIEKW4SG.js";
16
16
  import {
17
17
  TITLE_FONT_SIZE,
18
18
  TITLE_FONT_WEIGHT,
@@ -41,14 +41,14 @@ import {
41
41
  renderNoteBadge,
42
42
  renderNoteBox,
43
43
  renderNoteConnector
44
- } from "./chunk-D6PVMUCX.js";
44
+ } from "./chunk-VDY2GR6U.js";
45
45
  import {
46
46
  wrapDescriptionLines
47
- } from "./chunk-MB2SQF7N.js";
47
+ } from "./chunk-7WEYXYLC.js";
48
48
  import {
49
49
  renderInlineText,
50
50
  stripInlineMarkdown
51
- } from "./chunk-65GPEV5V.js";
51
+ } from "./chunk-QKPOIJBT.js";
52
52
  import {
53
53
  FONT_FAMILY
54
54
  } from "./chunk-ICLB27PZ.js";
@@ -15,10 +15,10 @@ import {
15
15
  } from "./chunk-NMS5XSLX.js";
16
16
  import {
17
17
  wrapDescriptionLines
18
- } from "./chunk-MB2SQF7N.js";
18
+ } from "./chunk-7WEYXYLC.js";
19
19
  import {
20
20
  renderInlineText
21
- } from "./chunk-65GPEV5V.js";
21
+ } from "./chunk-QKPOIJBT.js";
22
22
  import {
23
23
  FONT_FAMILY
24
24
  } from "./chunk-ICLB27PZ.js";
@@ -25,7 +25,7 @@ function safeHref(url) {
25
25
  // src/utils/inline-markdown.ts
26
26
  function parseInlineMarkdown(text) {
27
27
  const spans = [];
28
- const regex = /\*\*(.+?)\*\*|__(.+?)__|\*(.+?)\*|_(.+?)_|`(.+?)`|\[(.+?)\]\((.+?)\)|(https?:\/\/[^\s)>\]]+|www\.[^\s)>\]]+)|([^*_`[]+?(?=https?:\/\/|www\.|$)|[^*_`[]+)/g;
28
+ const regex = /\*\*(.+?)\*\*|__(.+?)__|\*(.+?)\*|_(.+?)_|`(.+?)`|\[([^[\]\n\r]+)\]\(((?:[^()\n\r]|\([^()\n\r]*\))+)\)|(https?:\/\/[^\s)>\]]+|www\.[^\s)>\]]+)|([^*_`[]+?(?=https?:\/\/|www\.|$)|[^*_`[]+|\[)/g;
29
29
  let match;
30
30
  while ((match = regex.exec(text)) !== null) {
31
31
  if (match[1])
@@ -58,7 +58,7 @@ function truncateBareUrl(url) {
58
58
  return stripped.slice(0, BARE_URL_MAX_DISPLAY - 1) + "\u2026";
59
59
  }
60
60
  function stripInlineMarkdown(text) {
61
- return text.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "$1").replace(
61
+ return text.replace(/\[([^[\]\n\r]+)\]\((?:[^()\n\r]|\([^()\n\r]*\))+\)/g, "$1").replace(
62
62
  /https?:\/\/[^\s)>\]]+|www\.[^\s)>\]]+/g,
63
63
  (u) => truncateBareUrl(u)
64
64
  ).replace(/\*\*|__|[*_`]/g, "");
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-XSVWUOUZ.js";
4
4
  import {
5
5
  layoutInlineHeader
6
- } from "./chunk-42UJ23H3.js";
6
+ } from "./chunk-UIEKW4SG.js";
7
7
  import {
8
8
  TITLE_FONT_SIZE,
9
9
  TITLE_FONT_WEIGHT,
@@ -13,7 +13,7 @@ import {
13
13
  import {
14
14
  parseInlineMarkdown,
15
15
  safeHref
16
- } from "./chunk-65GPEV5V.js";
16
+ } from "./chunk-QKPOIJBT.js";
17
17
  import {
18
18
  FONT_FAMILY
19
19
  } from "./chunk-ICLB27PZ.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  searchPlacement
3
- } from "./chunk-LDDDKWL6.js";
3
+ } from "./chunk-TDAGJJPZ.js";
4
4
  import {
5
5
  buildPlacedNotes,
6
6
  noteCanvasShift,
7
7
  resolveNotes
8
- } from "./chunk-NJJCTEBM.js";
8
+ } from "./chunk-7SXV7NUS.js";
9
9
  import {
10
10
  measureText
11
11
  } from "./chunk-KAO7JL4I.js";
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-JILEYZ2V.js";
25
25
  import {
26
26
  renderInlineText
27
- } from "./chunk-65GPEV5V.js";
27
+ } from "./chunk-QKPOIJBT.js";
28
28
  import {
29
29
  FONT_FAMILY
30
30
  } from "./chunk-ICLB27PZ.js";
@@ -18,11 +18,11 @@ import {
18
18
  } from "./chunk-3DPOIW3W.js";
19
19
  import {
20
20
  wrapDescriptionLines
21
- } from "./chunk-MB2SQF7N.js";
21
+ } from "./chunk-7WEYXYLC.js";
22
22
  import {
23
23
  renderInlineText,
24
24
  stripInlineMarkdown
25
- } from "./chunk-65GPEV5V.js";
25
+ } from "./chunk-QKPOIJBT.js";
26
26
  import {
27
27
  FONT_FAMILY
28
28
  } from "./chunk-ICLB27PZ.js";
@@ -9,7 +9,7 @@ import {
9
9
  capLabelColumn,
10
10
  computeTimeTicks,
11
11
  showFullOnHover
12
- } from "./chunk-VSOZZYLK.js";
12
+ } from "./chunk-NERQSSYD.js";
13
13
  import {
14
14
  parseTimelineDate
15
15
  } from "./chunk-BQO24BDM.js";
@@ -4,7 +4,7 @@ import {
4
4
  countSplineCrossings,
5
5
  deroutePierces,
6
6
  searchBudget
7
- } from "./chunk-ADVGV3P7.js";
7
+ } from "./chunk-6JCTW74W.js";
8
8
 
9
9
  // src/utils/placement-search.ts
10
10
  var SEARCH_RANKERS = ["tight-tree", "longest-path"];
@@ -81,5 +81,6 @@ function layoutInlineHeader(input) {
81
81
  export {
82
82
  legendInlineSupported,
83
83
  INLINE_HEADER_PAD,
84
+ measureTitleWidth,
84
85
  layoutInlineHeader
85
86
  };
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-24YPR5EH.js";
12
12
  import {
13
13
  layoutInlineHeader
14
- } from "./chunk-42UJ23H3.js";
14
+ } from "./chunk-UIEKW4SG.js";
15
15
  import {
16
16
  TITLE_FONT_SIZE,
17
17
  TITLE_FONT_WEIGHT,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  wrapDescriptionLines
3
- } from "./chunk-MB2SQF7N.js";
3
+ } from "./chunk-7WEYXYLC.js";
4
4
  import {
5
5
  renderInlineText
6
- } from "./chunk-65GPEV5V.js";
6
+ } from "./chunk-QKPOIJBT.js";
7
7
  import {
8
8
  measureText
9
9
  } from "./chunk-KAO7JL4I.js";
@@ -1,10 +1,12 @@
1
+ import {
2
+ NODE_HEIGHT,
3
+ NODE_WIDTH
4
+ } from "./chunk-WTTIODDV.js";
1
5
  import {
2
6
  BOX_CLEAR_PAD,
3
7
  EDGE_LABEL_FONT_SIZE,
4
- NODE_HEIGHT,
5
- NODE_WIDTH,
6
8
  measureEdgeLabel
7
- } from "./chunk-QT3KDDXK.js";
9
+ } from "./chunk-IN7XI6NO.js";
8
10
  import {
9
11
  measureText
10
12
  } from "./chunk-KAO7JL4I.js";
@@ -0,0 +1,9 @@
1
+ // src/boxes-and-lines/node-metrics.ts
2
+ var PHI = 1.618;
3
+ var NODE_HEIGHT = 60;
4
+ var NODE_WIDTH = Math.round(NODE_HEIGHT * PHI);
5
+
6
+ export {
7
+ NODE_HEIGHT,
8
+ NODE_WIDTH
9
+ };
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-ZI6WC24V.js";
9
9
  import {
10
10
  layoutInlineHeader
11
- } from "./chunk-42UJ23H3.js";
11
+ } from "./chunk-UIEKW4SG.js";
12
12
  import {
13
13
  TITLE_FONT_SIZE,
14
14
  TITLE_FONT_WEIGHT,
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-JILEYZ2V.js";
24
24
  import {
25
25
  renderInlineText
26
- } from "./chunk-65GPEV5V.js";
26
+ } from "./chunk-QKPOIJBT.js";
27
27
  import {
28
28
  FONT_FAMILY
29
29
  } from "./chunk-ICLB27PZ.js";