@diagrammo/dgmo 0.85.0 → 0.86.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 (95) hide show
  1. package/dist/advanced.d.ts +63 -9
  2. package/dist/advanced.js +69 -51
  3. package/dist/block.js +8 -8
  4. package/dist/chart-meta.js +3 -3
  5. package/dist/{chunk-LRNIYQ6Y.js → chunk-33FQ6HNV.js} +1 -1
  6. package/dist/{chunk-REUEU5PU.js → chunk-3CQS3CIO.js} +2 -2
  7. package/dist/{chunk-LQSNWE3W.js → chunk-4ELXLATB.js} +1 -1
  8. package/dist/{chunk-ADAGWVWJ.js → chunk-4YA5XW43.js} +39 -39
  9. package/dist/{chunk-23RWHHI5.js → chunk-5NU7NII2.js} +14 -2
  10. package/dist/{chunk-HMWZQ53A.js → chunk-7WGCQE2E.js} +1 -1
  11. package/dist/{chunk-NSS2EF5B.js → chunk-AAMCXQPP.js} +1 -1
  12. package/dist/{chunk-XD7XL3SF.js → chunk-AGO3PFGS.js} +1 -1
  13. package/dist/{chunk-JVRDKR5R.js → chunk-AQIBKTPG.js} +1 -1
  14. package/dist/{chunk-ITLPDLBH.js → chunk-BF7JAFJI.js} +1 -1
  15. package/dist/{chunk-RMAJIB6S.js → chunk-BHZE36F7.js} +3 -3
  16. package/dist/{chunk-6HOVLE3H.js → chunk-BT2WH2XT.js} +1 -1
  17. package/dist/{chunk-3MXJMZAN.js → chunk-BV6PKJUS.js} +105 -28
  18. package/dist/{chunk-PSH5DT26.js → chunk-C6FZZFYD.js} +2 -2
  19. package/dist/{chunk-7256EOAE.js → chunk-CFBY77QJ.js} +129 -10
  20. package/dist/{chunk-OZTDXMRQ.js → chunk-D4M25W6R.js} +1 -1
  21. package/dist/{chunk-A4PHPKNR.js → chunk-DAX42XVH.js} +1 -1
  22. package/dist/{chunk-V3LJIPS4.js → chunk-E6S2K6O2.js} +1 -1
  23. package/dist/{chunk-BIQYWWJ2.js → chunk-ERYHC4KJ.js} +1 -1
  24. package/dist/{chunk-JLGN6S4B.js → chunk-EWSESGC2.js} +32 -3
  25. package/dist/{chunk-MIZ46MOF.js → chunk-GYORDNOM.js} +1 -1
  26. package/dist/{chunk-D7D5YK4J.js → chunk-H6AFNCN3.js} +14 -2
  27. package/dist/{chunk-PEFPTQ3Z.js → chunk-HUMQIRJK.js} +1 -1
  28. package/dist/{chunk-XXAZ5C4K.js → chunk-IJ27L3R4.js} +1 -1
  29. package/dist/{chunk-VDMG3MM4.js → chunk-JD4RHBNX.js} +1 -1
  30. package/dist/{chunk-J2ICADUM.js → chunk-LHBMQJC3.js} +1 -1
  31. package/dist/{chunk-Y7FTHOMD.js → chunk-LIYWJ6DV.js} +32 -223
  32. package/dist/{chunk-HATTVAWX.js → chunk-LJFXC3IP.js} +1 -1
  33. package/dist/{chunk-T327J6CE.js → chunk-MSXRNVHB.js} +2 -2
  34. package/dist/{chunk-2QIGN7KL.js → chunk-MYHPRQHR.js} +6 -2
  35. package/dist/{chunk-UJRMARNX.js → chunk-NJIGYGZS.js} +19 -1
  36. package/dist/{chunk-RYZNNXUV.js → chunk-PKXKWHDW.js} +1 -1
  37. package/dist/{chunk-C5FEPGSJ.js → chunk-QJFT5MAH.js} +1 -1
  38. package/dist/{chunk-ULCB4BLF.js → chunk-QPE646M2.js} +1 -1
  39. package/dist/{chunk-UNSN56OJ.js → chunk-R2K5L4UA.js} +1 -1
  40. package/dist/{chunk-SLMAAJPE.js → chunk-RGI64U3A.js} +1 -1
  41. package/dist/chunk-TW6WMZFW.js +287 -0
  42. package/dist/{chunk-ZUUNTOMG.js → chunk-UIUXIDBX.js} +1 -1
  43. package/dist/{chunk-XIYVGO24.js → chunk-UMRZPRAN.js} +3 -3
  44. package/dist/{chunk-67USWFFE.js → chunk-UY6TEJJH.js} +1 -1
  45. package/dist/{chunk-YWHGWLY6.js → chunk-VEE777MD.js} +3 -3
  46. package/dist/{chunk-UGYZ5Q5Y.js → chunk-VJ2KROJ5.js} +1 -1
  47. package/dist/{chunk-OGKP2XGJ.js → chunk-VPVWG2GH.js} +1 -1
  48. package/dist/{chunk-IIEI7VK5.js → chunk-XCKNFFKM.js} +2 -0
  49. package/dist/{chunk-NJS62BAG.js → chunk-XFMQSFS4.js} +1 -1
  50. package/dist/cloud-reference.d.ts +11 -1
  51. package/dist/cloud-reference.js +1 -1
  52. package/dist/{dgmo-router-VILEOWQ2.js → dgmo-router-F2DSURTR.js} +4 -4
  53. package/dist/{dimensions-F3Y5T54V.js → dimensions-6QAWEGIR.js} +2 -2
  54. package/dist/{flowchart-renderer-TGQL4S4L.js → flowchart-renderer-H72L7BEC.js} +2 -2
  55. package/dist/index.js +8 -8
  56. package/dist/{layout-WZCXK7DF.js → layout-5NPBHV5F.js} +2 -2
  57. package/dist/{layout-WXVGMSI3.js → layout-5VSMZPMG.js} +2 -2
  58. package/dist/{layout-K6NI4VCS.js → layout-CUFA7XJD.js} +2 -2
  59. package/dist/{layout-NB7TKAWN.js → layout-LUQKAGGT.js} +2 -2
  60. package/dist/{layout-CFTB7GKV.js → layout-QIPCNUSB.js} +2 -2
  61. package/dist/{layout-PT7IKVCV.js → layout-QX5T6ZNE.js} +2 -2
  62. package/dist/layout-T6TAB5OI.js +10 -0
  63. package/dist/{layout-search-GRJEBAUF.js → layout-search-AW5VBDCV.js} +13 -8
  64. package/dist/live-link-resolve.d.ts +21 -3
  65. package/dist/live-link-resolve.js +47 -17
  66. package/dist/{parser-6TXNMXNB.js → parser-XYY5NHP4.js} +2 -2
  67. package/dist/{renderer-FXX3XSNW.js → renderer-2BWRW23Z.js} +2 -2
  68. package/dist/{renderer-OV3GUJRR.js → renderer-36JH4OMC.js} +4 -4
  69. package/dist/{renderer-EU27D4S6.js → renderer-425QUIYO.js} +2 -2
  70. package/dist/{renderer-HV6ZYJMC.js → renderer-4NZZ5J2F.js} +2 -2
  71. package/dist/{renderer-UGA5DGKR.js → renderer-5JVVJBAS.js} +2 -2
  72. package/dist/{renderer-YSH5EX54.js → renderer-AI2MD52D.js} +1 -1
  73. package/dist/{renderer-HWEGM72C.js → renderer-BICLPGAH.js} +2 -2
  74. package/dist/{renderer-XS42HEXW.js → renderer-CZJ4AMYV.js} +2 -2
  75. package/dist/{renderer-WUDVV363.js → renderer-E7WF75GY.js} +2 -2
  76. package/dist/{renderer-3XRDFNYF.js → renderer-EWJS2RAZ.js} +3 -3
  77. package/dist/{renderer-5YOF2AHJ.js → renderer-JEEGPLMM.js} +2 -2
  78. package/dist/{renderer-OXSLLQQC.js → renderer-KVAQE7PQ.js} +2 -2
  79. package/dist/{renderer-TF3NTKP3.js → renderer-NX4YKWCJ.js} +2 -2
  80. package/dist/{renderer-P7LQBDU2.js → renderer-QM23SWAM.js} +2 -2
  81. package/dist/{renderer-FBAFYSIQ.js → renderer-RAATRF6W.js} +3 -3
  82. package/dist/{renderer-X4KFEKUK.js → renderer-RH4U3UVM.js} +3 -3
  83. package/dist/{renderer-G72GMBKA.js → renderer-RLSR7N6I.js} +4 -4
  84. package/dist/{renderer-3F4K2X57.js → renderer-RMGN3Q7D.js} +2 -2
  85. package/dist/{renderer-OVDVFPAI.js → renderer-RUGMKHX5.js} +3 -3
  86. package/dist/{renderer-DRLLZZ6P.js → renderer-UUWR7NGF.js} +2 -2
  87. package/dist/{renderer-J3O2KVTL.js → renderer-V6LLASGN.js} +2 -2
  88. package/dist/{renderer-FQAZ3KNU.js → renderer-VKAJ52UO.js} +2 -2
  89. package/dist/{renderer-WRWVFEX7.js → renderer-XRALFCIN.js} +6 -4
  90. package/dist/{renderer-5A6VWIVX.js → renderer-YIZ7G4HU.js} +5 -5
  91. package/dist/{state-renderer-B4ZF6ESS.js → state-renderer-DDVJ43HR.js} +2 -2
  92. package/docs/language-reference.md +12 -12
  93. package/package.json +2 -2
  94. package/dist/chunk-WTTIODDV.js +0 -9
  95. package/dist/layout-JQ3IPJYR.js +0 -9
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  renderCollapseBar,
7
7
  renderNodeCard
8
- } from "./chunk-UNSN56OJ.js";
8
+ } from "./chunk-R2K5L4UA.js";
9
9
  import {
10
10
  ScaleContext
11
11
  } from "./chunk-24YPR5EH.js";
@@ -23,7 +23,7 @@ import {
23
23
  LABEL_FONT_SIZE,
24
24
  META_FONT_SIZE,
25
25
  NODE_STROKE_WIDTH
26
- } from "./chunk-IIEI7VK5.js";
26
+ } from "./chunk-XCKNFFKM.js";
27
27
  import {
28
28
  layoutInlineHeader
29
29
  } from "./chunk-3DOQOXXI.js";
@@ -940,7 +940,7 @@ function assignEdgeSides(edges, rectById) {
940
940
  return { s: facing(dx, dy), t: facing(-dx, -dy) };
941
941
  });
942
942
  }
943
- function edgePath(source, target, sSide, tSide, sourcePorts, targetPorts) {
943
+ function edgePath(source, target, sSide, tSide, sourcePorts, targetPorts, ends) {
944
944
  const acx = source.x + source.w / 2;
945
945
  const acy = source.y + source.h / 2;
946
946
  const bcx = target.x + target.w / 2;
@@ -958,8 +958,8 @@ function edgePath(source, target, sSide, tSide, sourcePorts, targetPorts) {
958
958
  return { x, y };
959
959
  };
960
960
  const normal = (side) => side === "L" ? { x: -1, y: 0 } : side === "R" ? { x: 1, y: 0 } : side === "T" ? { x: 0, y: -1 } : { x: 0, y: 1 };
961
- const p0 = attach(sSide, source, sourcePorts, { x: bcx, y: bcy });
962
- const p1 = attach(tSide, target, targetPorts, { x: acx, y: acy });
961
+ const p0 = ends?.p0 ?? attach(sSide, source, sourcePorts, { x: bcx, y: bcy });
962
+ const p1 = ends?.p1 ?? attach(tSide, target, targetPorts, { x: acx, y: acy });
963
963
  const n0 = normal(sSide);
964
964
  const n1 = normal(tSide);
965
965
  const k = Math.max(
@@ -1021,7 +1021,8 @@ function polyCrossings(a, b) {
1021
1021
  if (segmentsCross(a[i], a[i + 1], b[j], b[j + 1])) n++;
1022
1022
  return n;
1023
1023
  }
1024
- function polyIntersection(a, b) {
1024
+ function polyIntersections(a, b) {
1025
+ const out = [];
1025
1026
  for (let i = 0; i + 1 < a.length; i++) {
1026
1027
  const p = a[i];
1027
1028
  const p2 = a[i + 1];
@@ -1036,10 +1037,10 @@ function polyIntersection(a, b) {
1036
1037
  const denom = rx * sy - ry * sx;
1037
1038
  if (denom === 0) continue;
1038
1039
  const t = ((q.x - p.x) * sy - (q.y - p.y) * sx) / denom;
1039
- return { x: p.x + t * rx, y: p.y + t * ry };
1040
+ out.push({ x: p.x + t * rx, y: p.y + t * ry });
1040
1041
  }
1041
1042
  }
1042
- return null;
1043
+ return out;
1043
1044
  }
1044
1045
  var HOP_R = 7;
1045
1046
  function hoppedPath(g, hops) {
@@ -1308,14 +1309,132 @@ function sketchEdgeGeometry(layout, offsets) {
1308
1309
  }
1309
1310
  if (!changed) break;
1310
1311
  }
1312
+ const FAN_GAP_MAX = 32;
1313
+ const fanSides = /* @__PURE__ */ new Map();
1314
+ for (let i = 0; i < layout.edges.length; i++) {
1315
+ const g = geoms[i];
1316
+ if (!g) continue;
1317
+ const e = layout.edges[i];
1318
+ const ch = chosen[i];
1319
+ const ends = [
1320
+ { id: e.sourceId, side: ch.s, end: "p0", at: g.p0, far: g.p1 },
1321
+ { id: e.targetId, side: ch.t, end: "p1", at: g.p1, far: g.p0 }
1322
+ ];
1323
+ for (const en of ends) {
1324
+ if (isBox(en.id)) continue;
1325
+ const n = normalOf(en.side);
1326
+ const along = en.side === "T" || en.side === "B";
1327
+ const dx = en.far.x - en.at.x;
1328
+ const dy = en.far.y - en.at.y;
1329
+ const proj = along ? dx : dy;
1330
+ const key = Math.atan2(proj, dx * n.x + dy * n.y);
1331
+ const k = `${en.side}:${en.id}`;
1332
+ const list = fanSides.get(k) ?? [];
1333
+ list.push({ edge: i, end: en.end, at: en.at, key, proj });
1334
+ fanSides.set(k, list);
1335
+ }
1336
+ }
1337
+ const fanned = layout.edges.map(() => ({}));
1338
+ let anyFanned = false;
1339
+ for (const [k, list] of fanSides) {
1340
+ const count = list.length;
1341
+ if (count < 2) continue;
1342
+ const along = k[0] === "T" || k[0] === "B";
1343
+ const c = ctx[list[0].edge];
1344
+ const rect = list[0].end === "p0" ? c.source : c.target;
1345
+ const len = along ? rect.w : rect.h;
1346
+ const gap = Math.min(len / (count + 1), FAN_GAP_MAX);
1347
+ const span = (count - 1) / 2 * gap;
1348
+ const reach = len / 2 - gap / 2;
1349
+ list.sort(
1350
+ (a, b) => a.key - b.key || a.edge - b.edge || (a.end < b.end ? -1 : 1)
1351
+ );
1352
+ const runs = [];
1353
+ const place = (r) => Math.max(
1354
+ -reach,
1355
+ Math.min(reach - (r.n - 1) * gap, r.an > 0 ? r.as / r.an : r.ls / r.ln)
1356
+ );
1357
+ for (const f of list) {
1358
+ const aligned = Math.abs(f.proj) <= span;
1359
+ const d = Math.max(-span, Math.min(span, f.proj));
1360
+ const run = aligned ? { n: 1, an: 1, as: d, ln: 0, ls: 0, at: 0 } : { n: 1, an: 0, as: 0, ln: 1, ls: d, at: 0 };
1361
+ run.at = place(run);
1362
+ runs.push(run);
1363
+ while (runs.length > 1) {
1364
+ const cur = runs[runs.length - 1];
1365
+ const prev = runs[runs.length - 2];
1366
+ if (prev.at + prev.n * gap <= cur.at) break;
1367
+ runs.pop();
1368
+ prev.as += cur.as - cur.an * prev.n * gap;
1369
+ prev.ls += cur.ls - cur.ln * prev.n * gap;
1370
+ prev.an += cur.an;
1371
+ prev.ln += cur.ln;
1372
+ prev.n += cur.n;
1373
+ prev.at = place(prev);
1374
+ }
1375
+ }
1376
+ let idx = 0;
1377
+ for (const run of runs) {
1378
+ for (let m = 0; m < run.n; m++, idx++) {
1379
+ const f = list[idx];
1380
+ const off2 = run.at + m * gap;
1381
+ fanned[f.edge][f.end] = along ? { x: f.at.x + off2, y: f.at.y } : { x: f.at.x, y: f.at.y + off2 };
1382
+ }
1383
+ }
1384
+ anyFanned = true;
1385
+ }
1386
+ if (anyFanned) {
1387
+ for (let i = 0; i < ctx.length; i++) {
1388
+ const c = ctx[i];
1389
+ const f = fanned[i];
1390
+ if (!c || !f.p0 && !f.p1) continue;
1391
+ const g = edgePath(
1392
+ c.source,
1393
+ c.target,
1394
+ chosen[i].s,
1395
+ chosen[i].t,
1396
+ c.sPorts,
1397
+ c.tPorts,
1398
+ f
1399
+ );
1400
+ geoms[i] = g;
1401
+ polys[i] = polyline(g);
1402
+ }
1403
+ }
1404
+ const SHARED_END_CLEAR = 2 * HOP_R;
1405
+ const endsAt = (i, id) => {
1406
+ const e = layout.edges[i];
1407
+ const g = geoms[i];
1408
+ const out = [];
1409
+ if (e.sourceId === id) out.push(g.p0);
1410
+ if (e.targetId === id) out.push(g.p1);
1411
+ return out;
1412
+ };
1311
1413
  const hopsFor = layout.edges.map(() => []);
1312
1414
  for (let i = 0; i < polys.length; i++) {
1313
1415
  for (let j = i + 1; j < polys.length; j++) {
1314
- if (ctx[i]?.adjacent.has(j)) continue;
1315
1416
  const a = polys[i];
1316
1417
  const b = polys[j];
1317
1418
  if (!a || !b) continue;
1318
- const pt = polyIntersection(a, b);
1419
+ if (!ctx[i]?.adjacent.has(j)) {
1420
+ const pt2 = polyIntersections(a, b)[0];
1421
+ if (pt2) hopsFor[j].push(pt2);
1422
+ continue;
1423
+ }
1424
+ const ei = layout.edges[i];
1425
+ const ej = layout.edges[j];
1426
+ const shared = [ei.sourceId, ei.targetId].filter(
1427
+ (id) => id === ej.sourceId || id === ej.targetId
1428
+ );
1429
+ const nearShared = shared.flatMap((id) => [
1430
+ ...endsAt(i, id),
1431
+ ...endsAt(j, id)
1432
+ ]);
1433
+ const pt = polyIntersections(a, b).find(
1434
+ (p) => nearShared.every(
1435
+ (q) => Math.hypot(p.x - q.x, p.y - q.y) > SHARED_END_CLEAR
1436
+ )
1437
+ );
1319
1438
  if (pt) hopsFor[j].push(pt);
1320
1439
  }
1321
1440
  }
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-RE27AX7O.js";
12
12
  import {
13
13
  parseDgmoChartType
14
- } from "./chunk-JVRDKR5R.js";
14
+ } from "./chunk-AQIBKTPG.js";
15
15
  import {
16
16
  chartTypes
17
17
  } from "./chunk-44GP7PD5.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  META_FONT_SIZE,
3
3
  META_LINE_HEIGHT
4
- } from "./chunk-IIEI7VK5.js";
4
+ } from "./chunk-XCKNFFKM.js";
5
5
  import {
6
6
  LEGEND_CAPSULE_PAD,
7
7
  LEGEND_DOT_R,
@@ -21,7 +21,7 @@ import {
21
21
  CONTAINER_RADIUS,
22
22
  GRID_DASH,
23
23
  NODE_STROKE_WIDTH
24
- } from "./chunk-IIEI7VK5.js";
24
+ } from "./chunk-XCKNFFKM.js";
25
25
  import {
26
26
  serializeSvg
27
27
  } from "./chunk-LD2JSKU3.js";
@@ -22,7 +22,7 @@ import {
22
22
  EDGE_LABEL_KNOCKOUT_OPACITY,
23
23
  EDGE_STROKE_WIDTH,
24
24
  NODE_STROKE_WIDTH
25
- } from "./chunk-IIEI7VK5.js";
25
+ } from "./chunk-XCKNFFKM.js";
26
26
  import {
27
27
  layoutInlineHeader
28
28
  } from "./chunk-3DOQOXXI.js";
@@ -1,7 +1,10 @@
1
1
  import {
2
+ BOX_CLEAR_PAD,
3
+ EDGE_LABEL_FONT_SIZE,
2
4
  NODE_HEIGHT,
3
- NODE_WIDTH
4
- } from "./chunk-WTTIODDV.js";
5
+ NODE_WIDTH,
6
+ measureEdgeLabel
7
+ } from "./chunk-TW6WMZFW.js";
5
8
 
6
9
  // src/boxes-and-lines/edge-clip.ts
7
10
  function rectBorderPoint(rect, toward) {
@@ -297,6 +300,28 @@ function groupedTierCandidates(parsed, sizes, opts) {
297
300
  chain.push(e.target);
298
301
  chains.push({ edgeIdx: i, chain });
299
302
  }
303
+ const labelGap = Array.from({ length: maxRank + 1 }, () => 0);
304
+ if (opts?.reserveEdgeLabels) {
305
+ const leadWall = isTB ? GROUP_LABEL_ZONE : GROUP_PAD;
306
+ const wallsBetween = (a, b) => {
307
+ const pa = pathOf(a);
308
+ const pb = pathOf(b);
309
+ let shared = 0;
310
+ while (shared < pa.length && shared < pb.length && pa[shared] === pb[shared])
311
+ shared++;
312
+ return (pa.length - shared) * GROUP_PAD + (pb.length - shared) * leadWall;
313
+ };
314
+ for (const { e } of edges) {
315
+ if (!e.label) continue;
316
+ const rs = globalRank.get(e.source);
317
+ const rt = globalRank.get(e.target);
318
+ if (rt <= rs) continue;
319
+ const m = measureEdgeLabel(e.label, EDGE_LABEL_FONT_SIZE);
320
+ const need = (isTB ? m.height : m.width) + 2 * BOX_CLEAR_PAD + wallsBetween(e.source, e.target);
321
+ for (let r = rs + 1; r <= rt; r++)
322
+ labelGap[r] = Math.max(labelGap[r], need);
323
+ }
324
+ }
300
325
  const ranks = Array.from({ length: maxRank + 1 }, () => []);
301
326
  for (const n of node.values()) ranks[n.rank].push(n.id);
302
327
  const up = /* @__PURE__ */ new Map();
@@ -468,7 +493,11 @@ function groupedTierCandidates(parsed, sizes, opts) {
468
493
  const bandCenter = [];
469
494
  let acc = MARGIN;
470
495
  for (let r = 0; r <= maxRank; r++) {
471
- if (r > 0) acc += RANKSEP + (tierStartRanks.has(r) ? TIER_GAP : 0);
496
+ if (r > 0)
497
+ acc += Math.max(
498
+ RANKSEP + (tierStartRanks.has(r) ? TIER_GAP : 0),
499
+ labelGap[r]
500
+ );
472
501
  bandCenter[r] = acc + bandDepth[r] / 2;
473
502
  acc += bandDepth[r];
474
503
  }
@@ -22,7 +22,7 @@ import {
22
22
  LABEL_FONT_SIZE,
23
23
  META_FONT_SIZE,
24
24
  NODE_STROKE_WIDTH
25
- } from "./chunk-IIEI7VK5.js";
25
+ } from "./chunk-XCKNFFKM.js";
26
26
  import {
27
27
  INLINE_HEADER_PAD,
28
28
  layoutInlineHeader
@@ -339,15 +339,27 @@ function renderGauge(svg, parsed, metrics, paint) {
339
339
  g.append("line").attr("x1", cx).attr("y1", cy).attr("x2", nx).attr("y2", ny).attr("stroke", paint.text).attr("stroke-width", 5).attr("stroke-linecap", "round");
340
340
  g.append("circle").attr("cx", cx).attr("cy", cy).attr("r", 11).attr("fill", paint.text);
341
341
  const nowLabel = compactNumber(parsed.now);
342
- const nowSize = Math.min(
342
+ const bandInner = r - stroke / 2;
343
+ let nowSize = Math.min(
343
344
  r * 0.62,
344
345
  140,
345
346
  r * 0.95 / Math.max(1, nowLabel.length * 0.6)
346
347
  );
348
+ if (parsed.hasTarget) {
349
+ const shoulderX = (bandInner - 26) * Math.SQRT1_2;
350
+ const shoulderW = Math.max(
351
+ measureText(compactNumber(parsed.target * 0.25), 18),
352
+ measureText(compactNumber(parsed.target * 0.75), 18)
353
+ );
354
+ const halfClear = shoulderX - shoulderW - 8;
355
+ const widthPerPx = measureText(nowLabel, 100, { bold: true }) / 100;
356
+ if (widthPerPx > 0 && halfClear > 0) {
357
+ nowSize = Math.min(nowSize, 2 * halfClear / widthPerPx);
358
+ }
359
+ }
347
360
  const nowY = cy - r * 0.42;
348
361
  g.append("text").attr("x", cx).attr("y", nowY + nowSize * 0.35).attr("text-anchor", "middle").attr("fill", paint.muted).attr("font-family", FONT_FAMILY).attr("font-size", nowSize).attr("font-weight", "bold").text(nowLabel);
349
362
  if (parsed.hasTarget) {
350
- const bandInner = r - stroke / 2;
351
363
  for (const f of [0, 0.25, 0.5, 0.75, 1]) {
352
364
  const isTarget = f === 1;
353
365
  const ang = Math.PI - f * Math.PI;
@@ -15,7 +15,7 @@ import {
15
15
  EDGE_LABEL_KNOCKOUT_OPACITY,
16
16
  EDGE_STROKE_WIDTH,
17
17
  NODE_STROKE_WIDTH
18
- } from "./chunk-IIEI7VK5.js";
18
+ } from "./chunk-XCKNFFKM.js";
19
19
  import {
20
20
  layoutInlineHeader
21
21
  } from "./chunk-3DOQOXXI.js";
@@ -7,7 +7,7 @@ import {
7
7
  META_FONT_SIZE,
8
8
  META_LINE_HEIGHT,
9
9
  SEPARATOR_GAP
10
- } from "./chunk-IIEI7VK5.js";
10
+ } from "./chunk-XCKNFFKM.js";
11
11
  import {
12
12
  buildCoupleQuotient,
13
13
  rankClasses
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-24YPR5EH.js";
4
4
  import {
5
5
  NODE_STROKE_WIDTH
6
- } from "./chunk-IIEI7VK5.js";
6
+ } from "./chunk-XCKNFFKM.js";
7
7
  import {
8
8
  TITLE_FONT_SIZE,
9
9
  TITLE_FONT_WEIGHT,
@@ -18,7 +18,7 @@ import {
18
18
  EDGE_LABEL_KNOCKOUT_OPACITY,
19
19
  EDGE_STROKE_WIDTH,
20
20
  NODE_STROKE_WIDTH
21
- } from "./chunk-IIEI7VK5.js";
21
+ } from "./chunk-XCKNFFKM.js";
22
22
  import {
23
23
  extractExportSvg,
24
24
  runInExportContainer