@cardenelabs/cdl 0.122.0 → 0.124.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 (64) hide show
  1. package/CHANGELOG.md +28 -1
  2. package/README.md +70 -1
  3. package/dist/index.cjs +1125 -618
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +38 -26
  6. package/dist/index.d.ts +38 -26
  7. package/dist/index.js +1125 -619
  8. package/dist/index.js.map +1 -1
  9. package/dist/react.cjs +894 -404
  10. package/dist/react.cjs.map +1 -1
  11. package/dist/react.d.cts +1 -1
  12. package/dist/react.d.ts +1 -1
  13. package/dist/react.js +894 -404
  14. package/dist/react.js.map +1 -1
  15. package/dist/{render-U_pC-Ksh.d.cts → render-U6omSNH2.d.cts} +23 -4
  16. package/dist/{render-U_pC-Ksh.d.ts → render-U6omSNH2.d.ts} +23 -4
  17. package/package.json +9 -12
  18. package/src/builder.ts +5 -0
  19. package/src/index.ts +2 -0
  20. package/src/kinds/box-lines.ts +17 -4
  21. package/src/kinds/chart-bar.tsx +4 -0
  22. package/src/kinds/chart-gauge.tsx +20 -9
  23. package/src/kinds/chart-pie.tsx +67 -17
  24. package/src/kinds/chart-radial.tsx +7 -2
  25. package/src/kinds/chart-slope.tsx +26 -7
  26. package/src/kinds/chart-stacked-bar.tsx +8 -4
  27. package/src/kinds/chart-stat.tsx +19 -4
  28. package/src/kinds/chart-waffle.tsx +7 -2
  29. package/src/kinds/funnel.tsx +9 -2
  30. package/src/kinds/generic.tsx +5 -2
  31. package/src/kinds/mind-map.tsx +26 -10
  32. package/src/kinds/quadrant.tsx +14 -4
  33. package/src/kinds/row-align.ts +19 -7
  34. package/src/kinds/sequence-board-metrics.ts +13 -3
  35. package/src/kinds/sequence-board.tsx +4 -2
  36. package/src/kinds/shape-basement.tsx +57 -32
  37. package/src/kinds/shape-blockchain.tsx +83 -34
  38. package/src/kinds/shape-commerce.tsx +65 -24
  39. package/src/kinds/shape-finance.tsx +90 -26
  40. package/src/kinds/shape-hardware.tsx +48 -17
  41. package/src/kinds/shape-region.tsx +16 -6
  42. package/src/kinds/shape-software.tsx +30 -8
  43. package/src/kinds/text-width.ts +17 -3
  44. package/src/kinds/tree.tsx +25 -7
  45. package/src/layout/collisions.ts +21 -8
  46. package/src/layout/curve-path.ts +3 -2
  47. package/src/layout/edges.ts +173 -29
  48. package/src/layout/head-label.ts +3 -1
  49. package/src/layout/lanes.ts +3 -2
  50. package/src/layout/metro-path.ts +3 -2
  51. package/src/layout/nodes.ts +14 -6
  52. package/src/layout/predict-bbox.ts +6 -3
  53. package/src/layout/self-loop.ts +10 -4
  54. package/src/layout/spec.ts +20 -6
  55. package/src/layout/text-width.ts +25 -8
  56. package/src/layout.ts +39 -15
  57. package/src/presets.ts +69 -43
  58. package/src/render/edges.tsx +18 -3
  59. package/src/render/interactive-panel.tsx +34 -7
  60. package/src/render/nodes.tsx +97 -48
  61. package/src/render/stage.tsx +3 -0
  62. package/src/text-metrics.ts +9 -0
  63. package/src/types.ts +22 -2
  64. package/src/visual-validate.ts +67 -17
package/dist/index.js CHANGED
@@ -710,6 +710,11 @@ function \u5B57\u3092\u5DEE\u3057\u8FBC\u3080(template, values) {
710
710
  return template.replace(/\{(\w+)\}/g, (whole, name) => name in values ? String(values[name]) : whole);
711
711
  }
712
712
 
713
+ // src/text-metrics.ts
714
+ function resolveTextMetrics(value) {
715
+ return value === "monospace" ? "monospace" : "proportional";
716
+ }
717
+
713
718
  // src/formula/ast.ts
714
719
  var ALLOWED_MATH_FNS = /* @__PURE__ */ new Set([
715
720
  "min",
@@ -1648,13 +1653,215 @@ function \u5024\u3092\u540D\u524D\u3067\u8AAD\u3080(\u5165\u529B\u6B04, \u5024)
1648
1653
  return \u5024.split(",").map((v) => \u5165\u529B\u6B04.\u540D\u524D.get(v) ?? v).join(",");
1649
1654
  }
1650
1655
 
1656
+ // src/layout/text-width.ts
1657
+ var INTER_BOLD_ADVANCE_EM = {
1658
+ // uppercase (実測係数化、 Inter Bold 仕様 × 1.20)
1659
+ A: 0.86,
1660
+ B: 0.86,
1661
+ C: 0.88,
1662
+ D: 0.93,
1663
+ E: 0.82,
1664
+ F: 0.79,
1665
+ G: 0.94,
1666
+ H: 0.92,
1667
+ I: 0.44,
1668
+ J: 0.66,
1669
+ K: 0.86,
1670
+ L: 0.74,
1671
+ M: 1.12,
1672
+ N: 0.94,
1673
+ O: 0.94,
1674
+ P: 0.85,
1675
+ Q: 0.94,
1676
+ R: 0.87,
1677
+ S: 0.79,
1678
+ T: 0.82,
1679
+ U: 0.91,
1680
+ V: 0.85,
1681
+ W: 1.22,
1682
+ X: 0.85,
1683
+ Y: 0.82,
1684
+ Z: 0.82,
1685
+ // lowercase (実測係数化、 Inter Bold 仕様 × 1.22)
1686
+ a: 0.73,
1687
+ b: 0.77,
1688
+ c: 0.68,
1689
+ d: 0.77,
1690
+ e: 0.73,
1691
+ f: 0.51,
1692
+ g: 0.76,
1693
+ h: 0.77,
1694
+ i: 0.39,
1695
+ j: 0.41,
1696
+ k: 0.73,
1697
+ l: 0.39,
1698
+ m: 1.15,
1699
+ n: 0.77,
1700
+ o: 0.76,
1701
+ p: 0.77,
1702
+ q: 0.77,
1703
+ r: 0.54,
1704
+ s: 0.65,
1705
+ t: 0.54,
1706
+ u: 0.77,
1707
+ v: 0.71,
1708
+ w: 1.05,
1709
+ x: 0.71,
1710
+ y: 0.71,
1711
+ z: 0.66,
1712
+ // digits (Inter Bold tabular-nums、 実測係数化 × 1.20)
1713
+ "0": 0.72,
1714
+ "1": 0.72,
1715
+ "2": 0.72,
1716
+ "3": 0.72,
1717
+ "4": 0.72,
1718
+ "5": 0.72,
1719
+ "6": 0.72,
1720
+ "7": 0.72,
1721
+ "8": 0.72,
1722
+ "9": 0.72,
1723
+ // ascii symbols (実測係数化 × 1.15、 punct 系は kerning が広く効くため 1.20)
1724
+ " ": 0.35,
1725
+ "!": 0.44,
1726
+ '"': 0.59,
1727
+ "#": 0.78,
1728
+ "$": 0.72,
1729
+ "%": 1,
1730
+ "&": 0.86,
1731
+ "'": 0.32,
1732
+ "(": 0.46,
1733
+ ")": 0.46,
1734
+ "*": 0.63,
1735
+ "+": 0.78,
1736
+ ",": 0.36,
1737
+ "-": 0.5,
1738
+ ".": 0.36,
1739
+ "/": 0.51,
1740
+ ":": 0.36,
1741
+ ";": 0.36,
1742
+ "<": 0.78,
1743
+ "=": 0.78,
1744
+ ">": 0.78,
1745
+ "?": 0.63,
1746
+ "@": 1.17,
1747
+ "[": 0.48,
1748
+ "\\": 0.51,
1749
+ "]": 0.48,
1750
+ "^": 0.63,
1751
+ "_": 0.63,
1752
+ "`": 0.48,
1753
+ "{": 0.52,
1754
+ "|": 0.37,
1755
+ "}": 0.52,
1756
+ "~": 0.78
1757
+ };
1758
+ var JETBRAINS_MONO_ADVANCE_EM = 0.63;
1759
+ function isCJK(code) {
1760
+ return code >= 12288 && code <= 12543 || // CJK symbols / hiragana / katakana
1761
+ code >= 13312 && code <= 40959 || // CJK ideographs
1762
+ code >= 63744 && code <= 64255 || // CJK compat ideographs
1763
+ code >= 65281 && code <= 65376 || // fullwidth ASCII
1764
+ code >= 65504 && code <= 65510;
1765
+ }
1766
+ function isHalfwidthKana(code) {
1767
+ return code >= 65377 && code <= 65500;
1768
+ }
1769
+ var EMOJI_ADVANCE_EM = 1.05;
1770
+ var MONO_EMOJI_ADVANCE_EM = 1.16;
1771
+ var DRAWN_CJK_RATIO = 1.08;
1772
+ var DRAWN_ASCII_RATIO = 1.16;
1773
+ function isAscii(code) {
1774
+ return code < 128;
1775
+ }
1776
+ var WIDE_SYMBOL_ADVANCE_EM = 0.95;
1777
+ function isEmoji(code) {
1778
+ return code >= 126976 && code <= 129791 || // 絵文字の主要面
1779
+ code >= 9728 && code <= 10175 || // 記号と絵文字 (♻ ✅ ❤ 等)
1780
+ code >= 127462 && code <= 127487;
1781
+ }
1782
+ function isEmojiGrapheme(grapheme, firstCode) {
1783
+ return isEmoji(firstCode) || grapheme.includes("\uFE0F");
1784
+ }
1785
+ function isWideSymbol(code) {
1786
+ return code >= 8592 && code <= 8703 || // 矢印
1787
+ code >= 9472 && code <= 9599 || // 罫線
1788
+ code >= 9632 && code <= 9727 || // 幾何図形
1789
+ code >= 11008 && code <= 11263;
1790
+ }
1791
+ var CLUSTER_JOINER_RE = /\u200d|\ufe0f|[\u{1f000}-\u{1faff}]|[\u{2600}-\u{27bf}]/u;
1792
+ var \u66F8\u8A18\u7D20\u3067\u5206\u3051\u308B;
1793
+ function segmentGraphemes(text) {
1794
+ if (typeof Intl === "undefined" || typeof Intl.Segmenter !== "function") {
1795
+ return [...text];
1796
+ }
1797
+ \u66F8\u8A18\u7D20\u3067\u5206\u3051\u308B ??= new Intl.Segmenter(void 0, { granularity: "grapheme" });
1798
+ return [...\u66F8\u8A18\u7D20\u3067\u5206\u3051\u308B.segment(text)].map((s) => s.segment);
1799
+ }
1800
+ function defaultAdvanceEm(ch, code) {
1801
+ if (isEmoji(code)) return EMOJI_ADVANCE_EM;
1802
+ if (isWideSymbol(code)) return WIDE_SYMBOL_ADVANCE_EM;
1803
+ if (isCJK(code)) return 1.08;
1804
+ if (isHalfwidthKana(code)) return 0.72;
1805
+ if (ch >= "a" && ch <= "z") return 0.73;
1806
+ if (ch >= "A" && ch <= "Z") return 0.86;
1807
+ if (ch >= "0" && ch <= "9") return 0.72;
1808
+ return 0.65;
1809
+ }
1810
+ function measureAdvanceWidth(text, opts = {}) {
1811
+ const fontSize = opts.fontSize ?? 22;
1812
+ const letterSpacing = opts.letterSpacing ?? 0;
1813
+ const fontFamily = opts.textMetrics === "monospace" ? "mono" : opts.fontFamily ?? "sans";
1814
+ const bound = opts.bound ?? "layout";
1815
+ let advanceEmSum = 0;
1816
+ let charCount = 0;
1817
+ const \u6587\u5B57\u5217 = CLUSTER_JOINER_RE.test(text) ? segmentGraphemes(text) : [...text];
1818
+ for (const ch of \u6587\u5B57\u5217) {
1819
+ charCount++;
1820
+ const code = ch.codePointAt(0) ?? 0;
1821
+ const \u5272\u308A\u623B\u3057 = bound === "drawn" && !isEmojiGrapheme(ch, code) ? isAscii(code) && fontFamily !== "mono" ? DRAWN_ASCII_RATIO : isCJK(code) ? DRAWN_CJK_RATIO : 1 : 1;
1822
+ if (isEmojiGrapheme(ch, code)) {
1823
+ advanceEmSum += fontFamily === "mono" ? MONO_EMOJI_ADVANCE_EM : EMOJI_ADVANCE_EM;
1824
+ continue;
1825
+ }
1826
+ if (fontFamily === "mono") {
1827
+ advanceEmSum += (isCJK(code) ? 1.08 : JETBRAINS_MONO_ADVANCE_EM) / \u5272\u308A\u623B\u3057;
1828
+ continue;
1829
+ }
1830
+ if (isCJK(code)) {
1831
+ advanceEmSum += 1.08 / \u5272\u308A\u623B\u3057;
1832
+ continue;
1833
+ }
1834
+ const table = ch.length === 1 ? INTER_BOLD_ADVANCE_EM[ch] : void 0;
1835
+ advanceEmSum += (table !== void 0 ? table : defaultAdvanceEm(ch, code)) / \u5272\u308A\u623B\u3057;
1836
+ }
1837
+ return advanceEmSum * fontSize + letterSpacing * charCount;
1838
+ }
1839
+ function measureTextWidth(text, opts = {}) {
1840
+ const fontSize = opts.fontSize ?? 22;
1841
+ const bound = opts.bound ?? "layout";
1842
+ const w = measureAdvanceWidth(text, opts);
1843
+ return bound === "drawn" ? w : Math.max(w, fontSize * 1.2);
1844
+ }
1845
+ function \u53CE\u3081\u308B\u500D\u7387(text, opts, \u5E45) {
1846
+ if (!(\u5E45 > 0) || !(opts.fontSize > 0)) return 1;
1847
+ const \u5B9F\u5E45 = measureTextWidth(text, { ...opts, letterSpacing: 0 });
1848
+ return \u5B9F\u5E45 > \u5E45 ? \u5E45 / \u5B9F\u5E45 : 1;
1849
+ }
1850
+
1651
1851
  // src/kinds/text-width.ts
1652
1852
  var WIDE_RATIO = 1.04;
1653
1853
  var NARROW_RATIO = 0.37;
1654
1854
  var ASCII_RATIO = 0.86;
1655
1855
  var WIDE_CHARS = "W@%Mm";
1656
1856
  var NARROW_CHARS = "ijlI.,:;'! ";
1657
- function textWidth(s, size, \u5B57\u9001\u308A = 0) {
1857
+ function textWidth(s, size, \u5B57\u9001\u308A = 0, textMetrics = "proportional") {
1858
+ if (textMetrics === "monospace") {
1859
+ return measureAdvanceWidth(s, {
1860
+ fontSize: size,
1861
+ letterSpacing: \u5B57\u9001\u308A,
1862
+ fontFamily: "mono"
1863
+ });
1864
+ }
1658
1865
  let \u5E45 = 0;
1659
1866
  let \u5B57\u6570 = 0;
1660
1867
  for (const c of s) {
@@ -1691,8 +1898,8 @@ function splitRow(row) {
1691
1898
  }
1692
1899
  return { left: row.trim(), right: "", split: false };
1693
1900
  }
1694
- function rowColumnWidth(text, size, mono) {
1695
- return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size);
1901
+ function rowColumnWidth(text, size, mono, textMetrics = "proportional") {
1902
+ return mono ? displayWidth(text) * size * MONO_ADVANCE_RATIO : textWidth(text, size, 0, textMetrics);
1696
1903
  }
1697
1904
  function displayWidth(text) {
1698
1905
  let w = 0;
@@ -1718,12 +1925,12 @@ function \u6841\u3067\u7701\u304F(text, \u4E0A\u9650) {
1718
1925
  if (displayWidth(text) <= \u4E0A\u9650) return text;
1719
1926
  return `${\u6841\u3067\u5272\u308B(text, \u4E0A\u9650 - 1)[0]}\u2026`;
1720
1927
  }
1721
- function requiredRowsWidth(rows, kind) {
1928
+ function requiredRowsWidth(rows, kind, textMetrics = "proportional") {
1722
1929
  if (!rows || rows.length === 0) return 0;
1723
1930
  const splits = rows.map(splitRow);
1724
1931
  const \u4E00\u756A\u5E83\u3044 = (\u53D6\u308B) => splits.reduce((m, s) => Math.max(m, \u53D6\u308B(s)), 0);
1725
- const storage = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, 26, true)) + STORAGE_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, 26, true)) + ROW_RIGHT_PAD_PX;
1726
- const generic = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)) + ROW_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, GENERIC_ROW_RIGHT_SIZE_PX, true)) + ROW_RIGHT_PAD_PX;
1932
+ const storage = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, 26, true, textMetrics)) + STORAGE_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, 26, true, textMetrics)) + ROW_RIGHT_PAD_PX;
1933
+ const generic = ROW_PAD_X_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false, textMetrics)) + ROW_COL_GAP_PX + \u4E00\u756A\u5E83\u3044((s) => rowColumnWidth(s.right, GENERIC_ROW_RIGHT_SIZE_PX, true, textMetrics)) + ROW_RIGHT_PAD_PX;
1727
1934
  if (kind === void 0) return Math.ceil(Math.max(storage, generic));
1728
1935
  return Math.ceil(kind === "storage" ? storage : generic);
1729
1936
  }
@@ -1788,7 +1995,10 @@ var \u5DE6\u53F3\u306E\u4F59\u767D = 8;
1788
1995
  function \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45) {
1789
1996
  return \u7BB1\u306E\u5E45 - \u5DE6\u53F3\u306E\u4F59\u767D * 2;
1790
1997
  }
1791
- function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B = textWidth) {
1998
+ function \u7BB1\u306E\u5B57\u3092\u6E2C\u308B(textMetrics = "proportional") {
1999
+ return (text, fontSize) => textWidth(text, fontSize, 0, textMetrics);
2000
+ }
2001
+ function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B) {
1792
2002
  if (\u4F7F\u3048\u308B\u5E452 <= 0) return "";
1793
2003
  if (\u6E2C\u308B(text, fontSize) <= \u4F7F\u3048\u308B\u5E452) return text;
1794
2004
  const \u7701\u7565 = "\u2026";
@@ -1805,7 +2015,7 @@ function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6
1805
2015
  return `${\u51FA}${\u7701\u7565}`;
1806
2016
  }
1807
2017
  var \u7E2E\u3081\u306E\u4E0B\u9650 = MIN_TEXT_SIZE;
1808
- function \u5E45\u306B\u53CE\u3081\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B = textWidth) {
2018
+ function \u5E45\u306B\u53CE\u3081\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B) {
1809
2019
  let size = fontSize;
1810
2020
  while (size > \u7E2E\u3081\u306E\u4E0B\u9650 && \u6E2C\u308B(text, size) > \u4F7F\u3048\u308B\u5E452) size -= 1;
1811
2021
  return { text: \u5E45\u3067\u5207\u308B(text, size, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B), fontSize: size };
@@ -1815,7 +2025,7 @@ function \u66F8\u8A18\u7D20\u306B\u5206\u3051\u308B(text) {
1815
2025
  if (typeof \u533A\u5207\u308A !== "function") return [...text];
1816
2026
  return [...new \u533A\u5207\u308A(void 0, { granularity: "grapheme" }).segment(text)].map((g) => g.segment);
1817
2027
  }
1818
- function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8\u30553) {
2028
+ function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8\u30553, \u6E2C\u308B) {
1819
2029
  const \u5019\u88DC = \u884C.filter((r, i) => i === 0 || r.text.trim() !== "");
1820
2030
  if (\u5019\u88DC.length === 0) return [];
1821
2031
  const \u4F7F\u3048\u308B\u9AD8\u3055 = \u7BB1\u306E\u9AD8\u30553 - \u4E0A\u4E0B\u306E\u4F59\u767D * 2;
@@ -1823,7 +2033,7 @@ function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8
1823
2033
  const \u6B8B\u3059 = [...\u5019\u88DC];
1824
2034
  while (\u6B8B\u3059.length > 1 && \u9AD8\u3055(\u6B8B\u3059) > \u4F7F\u3048\u308B\u9AD8\u3055) \u6B8B\u3059.pop();
1825
2035
  const \u5E45 = \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45);
1826
- const \u53CE\u3081\u305F = \u6B8B\u3059.map((r) => ({ ...r, ...\u5E45\u306B\u53CE\u3081\u308B(r.text, r.fontSize, \u5E45) }));
2036
+ const \u53CE\u3081\u305F = \u6B8B\u3059.map((r) => ({ ...r, ...\u5E45\u306B\u53CE\u3081\u308B(r.text, r.fontSize, \u5E45, \u6E2C\u308B) }));
1827
2037
  const \u7DCF\u9AD8 = \u9AD8\u3055(\u53CE\u3081\u305F);
1828
2038
  let \u7A4D\u307F = -\u7DCF\u9AD8 / 2;
1829
2039
  return \u53CE\u3081\u305F.map((r) => {
@@ -2180,7 +2390,15 @@ function useInteractiveIntegration(diagram2, options = {}) {
2180
2390
  f.id
2181
2391
  )) }),
2182
2392
  scrolls.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: scrolls.map((s) => /* @__PURE__ */ jsx(ScrollReadout, { id: s.id, name: s.label || s.id, progress: stateOverrides[s.id] }, s.id)) }),
2183
- readouts.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: readouts.map((r) => /* @__PURE__ */ jsx(ReadoutWidget, { readout: r, stateOverrides: mergedStateValues }, r.id)) })
2393
+ readouts.length > 0 && /* @__PURE__ */ jsx("div", { className: "cdl-ip-group", children: readouts.map((r) => /* @__PURE__ */ jsx(
2394
+ ReadoutWidget,
2395
+ {
2396
+ readout: r,
2397
+ stateOverrides: mergedStateValues,
2398
+ textMetrics: resolveTextMetrics(diagram2.textMetrics)
2399
+ },
2400
+ r.id
2401
+ )) })
2184
2402
  ] }) })
2185
2403
  );
2186
2404
  }, [diagram2, signals, stateOverrides, mergedStateValues]);
@@ -2601,7 +2819,8 @@ function StepperWidget({
2601
2819
  }
2602
2820
  function ReadoutWidget({
2603
2821
  readout,
2604
- stateOverrides
2822
+ stateOverrides,
2823
+ textMetrics = "proportional"
2605
2824
  }) {
2606
2825
  const rawValue = "source" in readout ? stateOverrides[readout.source] : void 0;
2607
2826
  const numericValue = typeof rawValue === "number" ? rawValue : typeof rawValue === "string" ? Number(rawValue) : Number.NaN;
@@ -2849,7 +3068,8 @@ function ReadoutWidget({
2849
3068
  max: readout.max,
2850
3069
  viewW: readout.viewW ?? 280,
2851
3070
  viewH: readout.viewH ?? 60,
2852
- color: readout.color ?? "#2563eb"
3071
+ color: readout.color ?? "#2563eb",
3072
+ textMetrics
2853
3073
  }
2854
3074
  );
2855
3075
  case "radar": {
@@ -3665,7 +3885,8 @@ function ReadoutWidget({
3665
3885
  { status: "idle", color: "#94a3b8" },
3666
3886
  { status: "error", color: "#ef4444" }
3667
3887
  ],
3668
- max: readout.max ?? 10
3888
+ max: readout.max ?? 10,
3889
+ textMetrics
3669
3890
  }
3670
3891
  );
3671
3892
  case "calendar-week":
@@ -4809,8 +5030,8 @@ function ProgressGroupReadout({
4809
5030
  }) })
4810
5031
  ] });
4811
5032
  }
4812
- function sequenceLabelAnchor(x, name, fontSize, viewW) {
4813
- const half = textWidth(name, fontSize) / 2;
5033
+ function sequenceLabelAnchor(x, name, fontSize, viewW, textMetrics = "proportional") {
5034
+ const half = textWidth(name, fontSize, 0, textMetrics) / 2;
4814
5035
  if (x - half < 0) return "start";
4815
5036
  if (x + half > viewW) return "end";
4816
5037
  return "middle";
@@ -4823,7 +5044,8 @@ function SequenceTimelineReadout({
4823
5044
  max,
4824
5045
  viewW,
4825
5046
  viewH,
4826
- color
5047
+ color,
5048
+ textMetrics = "proportional"
4827
5049
  }) {
4828
5050
  const events = [];
4829
5051
  const trimmed = value.trim();
@@ -4866,7 +5088,17 @@ function SequenceTimelineReadout({
4866
5088
  const x = xFor(e.t);
4867
5089
  return /* @__PURE__ */ jsxs("g", { "data-cdl-event-marker": e.name, children: [
4868
5090
  /* @__PURE__ */ jsx("circle", { cx: x, cy: trackY, r: 5, fill: color, stroke: "#fff", strokeWidth: 1.5, children: /* @__PURE__ */ jsx(\u5B57\u306E\u898B\u51FA\u3057, { k: "readout.sequenceTimeline.title", v: { name: e.name, t: e.t } }) }),
4869
- /* @__PURE__ */ jsx("text", { x, y: trackY - 12, textAnchor: sequenceLabelAnchor(x, e.name, 10, viewW), fontSize: 10, fill: "var(--v4-ink, #1a1f2a)", children: e.name }),
5091
+ /* @__PURE__ */ jsx(
5092
+ "text",
5093
+ {
5094
+ x,
5095
+ y: trackY - 12,
5096
+ textAnchor: sequenceLabelAnchor(x, e.name, 10, viewW, textMetrics),
5097
+ fontSize: 10,
5098
+ fill: "var(--v4-ink, #1a1f2a)",
5099
+ children: e.name
5100
+ }
5101
+ ),
4870
5102
  /* @__PURE__ */ jsx("text", { x, y: trackY + 18, textAnchor: "middle", fontSize: 9, fill: "var(--v4-mute, #64748b)", children: e.t })
4871
5103
  ] }, i);
4872
5104
  })
@@ -7943,7 +8175,8 @@ function StatusTimelineReadout({
7943
8175
  label,
7944
8176
  value,
7945
8177
  colorMap,
7946
- max
8178
+ max,
8179
+ textMetrics = "proportional"
7947
8180
  }) {
7948
8181
  const events = [];
7949
8182
  const trimmed = value.trim();
@@ -7968,6 +8201,7 @@ function StatusTimelineReadout({
7968
8201
  const cellW = shown.length > 0 ? (width - 20) / shown.length : 0;
7969
8202
  const height = stripHeight + 40;
7970
8203
  const \u533A\u9593\u306E\u5B57 = (status) => status === "active" || status === "idle" || status === "error" ? \u5F15\u304F(`readout.statusTimeline.${status}`) : status.toUpperCase();
8204
+ const \u6E2C\u308B = \u7BB1\u306E\u5B57\u3092\u6E2C\u308B(textMetrics);
7971
8205
  return /* @__PURE__ */ jsxs("div", { className: "cdl-ip-item cdl-ip-readout-status-timeline", "data-cdl-readout": id, children: [
7972
8206
  /* @__PURE__ */ jsx("span", { className: "cdl-ip-label", children: label }),
7973
8207
  /* @__PURE__ */ jsx(
@@ -7981,7 +8215,7 @@ function StatusTimelineReadout({
7981
8215
  const x = 10 + i * cellW;
7982
8216
  const c = colorLookup.get(ev.status) ?? "#cbd5e1";
7983
8217
  const \u5B572 = \u533A\u9593\u306E\u5B57(ev.status);
7984
- const \u63CF\u304F\u5B57 = \u5E45\u3067\u5207\u308B(\u5B572, 10, cellW - 8);
8218
+ const \u63CF\u304F\u5B57 = \u5E45\u3067\u5207\u308B(\u5B572, 10, cellW - 8, \u6E2C\u308B);
7985
8219
  return /* @__PURE__ */ jsxs("g", { "data-cdl-status-event": i, "data-cdl-status": ev.status, children: [
7986
8220
  /* @__PURE__ */ jsx("rect", { x, y: 10, width: cellW - 2, height: stripHeight, fill: c, rx: 2 }),
7987
8221
  /* @__PURE__ */ jsxs(
@@ -12092,6 +12326,8 @@ function diagram(id, options) {
12092
12326
  ...options.palette !== void 0 ? { palette: options.palette } : {},
12093
12327
  // 言語も素通しする。 型の外の値を既定に落とすのは `layout` の 1 箇所に置く
12094
12328
  ...options.lang !== void 0 ? { lang: options.lang } : {},
12329
+ // 字幅の測り方も素通しする。型の外の値を既定に落とすのは `layout` の 1 箇所に置く
12330
+ ...options.textMetrics !== void 0 ? { textMetrics: options.textMetrics } : {},
12095
12331
  // 種類の名前も同じ経路で渡し、空文字の扱いを `layout` の 1 箇所に揃える
12096
12332
  ...options.type !== void 0 ? { type: options.type } : {},
12097
12333
  // inputs / formulas / scrollTriggers / eventBindings は空なら省略 (static diagram の JSON 形状維持)
@@ -12124,196 +12360,6 @@ var ARROW_ANGLE_MAX_DEG = 100;
12124
12360
  var FAN_GAP = 120;
12125
12361
  var DETOUR_GAP = 94;
12126
12362
 
12127
- // src/layout/text-width.ts
12128
- var INTER_BOLD_ADVANCE_EM = {
12129
- // uppercase (実測係数化、 Inter Bold 仕様 × 1.20)
12130
- A: 0.86,
12131
- B: 0.86,
12132
- C: 0.88,
12133
- D: 0.93,
12134
- E: 0.82,
12135
- F: 0.79,
12136
- G: 0.94,
12137
- H: 0.92,
12138
- I: 0.44,
12139
- J: 0.66,
12140
- K: 0.86,
12141
- L: 0.74,
12142
- M: 1.12,
12143
- N: 0.94,
12144
- O: 0.94,
12145
- P: 0.85,
12146
- Q: 0.94,
12147
- R: 0.87,
12148
- S: 0.79,
12149
- T: 0.82,
12150
- U: 0.91,
12151
- V: 0.85,
12152
- W: 1.22,
12153
- X: 0.85,
12154
- Y: 0.82,
12155
- Z: 0.82,
12156
- // lowercase (実測係数化、 Inter Bold 仕様 × 1.22)
12157
- a: 0.73,
12158
- b: 0.77,
12159
- c: 0.68,
12160
- d: 0.77,
12161
- e: 0.73,
12162
- f: 0.51,
12163
- g: 0.76,
12164
- h: 0.77,
12165
- i: 0.39,
12166
- j: 0.41,
12167
- k: 0.73,
12168
- l: 0.39,
12169
- m: 1.15,
12170
- n: 0.77,
12171
- o: 0.76,
12172
- p: 0.77,
12173
- q: 0.77,
12174
- r: 0.54,
12175
- s: 0.65,
12176
- t: 0.54,
12177
- u: 0.77,
12178
- v: 0.71,
12179
- w: 1.05,
12180
- x: 0.71,
12181
- y: 0.71,
12182
- z: 0.66,
12183
- // digits (Inter Bold tabular-nums、 実測係数化 × 1.20)
12184
- "0": 0.72,
12185
- "1": 0.72,
12186
- "2": 0.72,
12187
- "3": 0.72,
12188
- "4": 0.72,
12189
- "5": 0.72,
12190
- "6": 0.72,
12191
- "7": 0.72,
12192
- "8": 0.72,
12193
- "9": 0.72,
12194
- // ascii symbols (実測係数化 × 1.15、 punct 系は kerning が広く効くため 1.20)
12195
- " ": 0.35,
12196
- "!": 0.44,
12197
- '"': 0.59,
12198
- "#": 0.78,
12199
- "$": 0.72,
12200
- "%": 1,
12201
- "&": 0.86,
12202
- "'": 0.32,
12203
- "(": 0.46,
12204
- ")": 0.46,
12205
- "*": 0.63,
12206
- "+": 0.78,
12207
- ",": 0.36,
12208
- "-": 0.5,
12209
- ".": 0.36,
12210
- "/": 0.51,
12211
- ":": 0.36,
12212
- ";": 0.36,
12213
- "<": 0.78,
12214
- "=": 0.78,
12215
- ">": 0.78,
12216
- "?": 0.63,
12217
- "@": 1.17,
12218
- "[": 0.48,
12219
- "\\": 0.51,
12220
- "]": 0.48,
12221
- "^": 0.63,
12222
- "_": 0.63,
12223
- "`": 0.48,
12224
- "{": 0.52,
12225
- "|": 0.37,
12226
- "}": 0.52,
12227
- "~": 0.78
12228
- };
12229
- var JETBRAINS_MONO_ADVANCE_EM = 0.63;
12230
- function isCJK(code) {
12231
- return code >= 12288 && code <= 12543 || // CJK symbols / hiragana / katakana
12232
- code >= 13312 && code <= 40959 || // CJK ideographs
12233
- code >= 63744 && code <= 64255 || // CJK compat ideographs
12234
- code >= 65281 && code <= 65376 || // fullwidth ASCII
12235
- code >= 65504 && code <= 65510;
12236
- }
12237
- function isHalfwidthKana(code) {
12238
- return code >= 65377 && code <= 65500;
12239
- }
12240
- var EMOJI_ADVANCE_EM = 1.05;
12241
- var MONO_EMOJI_ADVANCE_EM = 1.16;
12242
- var DRAWN_CJK_RATIO = 1.08;
12243
- var DRAWN_ASCII_RATIO = 1.16;
12244
- function isAscii(code) {
12245
- return code < 128;
12246
- }
12247
- var WIDE_SYMBOL_ADVANCE_EM = 0.95;
12248
- function isEmoji(code) {
12249
- return code >= 126976 && code <= 129791 || // 絵文字の主要面
12250
- code >= 9728 && code <= 10175 || // 記号と絵文字 (♻ ✅ ❤ 等)
12251
- code >= 127462 && code <= 127487;
12252
- }
12253
- function isEmojiGrapheme(grapheme, firstCode) {
12254
- return isEmoji(firstCode) || grapheme.includes("\uFE0F");
12255
- }
12256
- function isWideSymbol(code) {
12257
- return code >= 8592 && code <= 8703 || // 矢印
12258
- code >= 9472 && code <= 9599 || // 罫線
12259
- code >= 9632 && code <= 9727 || // 幾何図形
12260
- code >= 11008 && code <= 11263;
12261
- }
12262
- var CLUSTER_JOINER_RE = /\u200d|\ufe0f|[\u{1f000}-\u{1faff}]|[\u{2600}-\u{27bf}]/u;
12263
- var \u66F8\u8A18\u7D20\u3067\u5206\u3051\u308B;
12264
- function segmentGraphemes(text) {
12265
- if (typeof Intl === "undefined" || typeof Intl.Segmenter !== "function") {
12266
- return [...text];
12267
- }
12268
- \u66F8\u8A18\u7D20\u3067\u5206\u3051\u308B ??= new Intl.Segmenter(void 0, { granularity: "grapheme" });
12269
- return [...\u66F8\u8A18\u7D20\u3067\u5206\u3051\u308B.segment(text)].map((s) => s.segment);
12270
- }
12271
- function defaultAdvanceEm(ch, code) {
12272
- if (isEmoji(code)) return EMOJI_ADVANCE_EM;
12273
- if (isWideSymbol(code)) return WIDE_SYMBOL_ADVANCE_EM;
12274
- if (isCJK(code)) return 1.08;
12275
- if (isHalfwidthKana(code)) return 0.72;
12276
- if (ch >= "a" && ch <= "z") return 0.73;
12277
- if (ch >= "A" && ch <= "Z") return 0.86;
12278
- if (ch >= "0" && ch <= "9") return 0.72;
12279
- return 0.65;
12280
- }
12281
- function measureTextWidth(text, opts = {}) {
12282
- const fontSize = opts.fontSize ?? 22;
12283
- const letterSpacing = opts.letterSpacing ?? 0;
12284
- const fontFamily = opts.fontFamily ?? "sans";
12285
- const bound = opts.bound ?? "layout";
12286
- let advanceEmSum = 0;
12287
- let charCount = 0;
12288
- const \u6587\u5B57\u5217 = CLUSTER_JOINER_RE.test(text) ? segmentGraphemes(text) : [...text];
12289
- for (const ch of \u6587\u5B57\u5217) {
12290
- charCount++;
12291
- const code = ch.codePointAt(0) ?? 0;
12292
- const \u5272\u308A\u623B\u3057 = bound === "drawn" && !isEmojiGrapheme(ch, code) ? isAscii(code) ? DRAWN_ASCII_RATIO : isCJK(code) ? DRAWN_CJK_RATIO : 1 : 1;
12293
- if (isEmojiGrapheme(ch, code)) {
12294
- advanceEmSum += fontFamily === "mono" ? MONO_EMOJI_ADVANCE_EM : EMOJI_ADVANCE_EM;
12295
- continue;
12296
- }
12297
- if (fontFamily === "mono") {
12298
- advanceEmSum += (isCJK(code) ? 1.08 : JETBRAINS_MONO_ADVANCE_EM) / \u5272\u308A\u623B\u3057;
12299
- continue;
12300
- }
12301
- if (isCJK(code)) {
12302
- advanceEmSum += 1.08 / \u5272\u308A\u623B\u3057;
12303
- continue;
12304
- }
12305
- const table = ch.length === 1 ? INTER_BOLD_ADVANCE_EM[ch] : void 0;
12306
- advanceEmSum += (table !== void 0 ? table : defaultAdvanceEm(ch, code)) / \u5272\u308A\u623B\u3057;
12307
- }
12308
- const w = advanceEmSum * fontSize + letterSpacing * charCount;
12309
- return bound === "drawn" ? w : Math.max(w, fontSize * 1.2);
12310
- }
12311
- function \u53CE\u3081\u308B\u500D\u7387(text, opts, \u5E45) {
12312
- if (!(\u5E45 > 0) || !(opts.fontSize > 0)) return 1;
12313
- const \u5B9F\u5E45 = measureTextWidth(text, { ...opts, letterSpacing: 0 });
12314
- return \u5B9F\u5E45 > \u5E45 ? \u5E45 / \u5B9F\u5E45 : 1;
12315
- }
12316
-
12317
12363
  // src/label-text.ts
12318
12364
  var EDGE_LABEL_TEXT = {
12319
12365
  // main 行は family を指定せず、 host 側の指定を継承する。
@@ -12673,15 +12719,22 @@ function requiredVerticalLabelGap(pillHs) {
12673
12719
  const step = parallelLabelStepY(pillHs);
12674
12720
  return (pillHs.length - 1) * step + Math.max(first, last) + CLEARANCE_NODE_LABEL * 2;
12675
12721
  }
12676
- function computeLabelBoxW(label, sub) {
12677
- const mainW = measureTextWidth(label ?? "", { fontSize: EDGE_LABEL_TEXT.main.fontSize });
12678
- const subW = sub ? measureTextWidth(sub, { fontSize: EDGE_LABEL_TEXT.sub.fontSize, fontFamily: "mono" }) : 0;
12722
+ function computeLabelBoxW(label, sub, textMetrics = "proportional") {
12723
+ const mainW = measureTextWidth(label ?? "", {
12724
+ fontSize: EDGE_LABEL_TEXT.main.fontSize,
12725
+ textMetrics
12726
+ });
12727
+ const subW = sub ? measureTextWidth(sub, {
12728
+ fontSize: EDGE_LABEL_TEXT.sub.fontSize,
12729
+ fontFamily: "mono",
12730
+ textMetrics
12731
+ }) : 0;
12679
12732
  const raw = Math.max(mainW, subW) + LABEL_PILL_PAD_X * 2;
12680
12733
  const EPSILON = 1e-6;
12681
12734
  return Math.ceil((raw - EPSILON) / 2) * 2;
12682
12735
  }
12683
- function computeLabelBBoxWorld(edge) {
12684
- const boxW = computeLabelBoxW(edge.label, edge.sub);
12736
+ function computeLabelBBoxWorld(edge, textMetrics = "proportional") {
12737
+ const boxW = computeLabelBoxW(edge.label, edge.sub, textMetrics);
12685
12738
  const boxH = edge.sub ? LABEL_PILL_H_WITH_SUB : LABEL_PILL_H_MAIN_ONLY;
12686
12739
  const anchor = edge.labelAnchor;
12687
12740
  const boxLeftX = anchor === "start" ? 0 : anchor === "end" ? -boxW : -boxW / 2;
@@ -12920,7 +12973,7 @@ function footerShapeDrawTop(node) {
12920
12973
  // src/layout/collisions.ts
12921
12974
  var LANE_LABEL_CLEARANCE_MARGIN = 2;
12922
12975
  var NEAR_MISS_MARGIN = LANE_LABEL_CLEARANCE_MARGIN;
12923
- function collectBBoxes(lanes, nodes, edges) {
12976
+ function collectBBoxes(lanes, nodes, edges, textMetrics = "proportional") {
12924
12977
  const out = [];
12925
12978
  for (const lane of lanes) {
12926
12979
  if (!lane.label) continue;
@@ -12929,7 +12982,7 @@ function collectBBoxes(lanes, nodes, edges) {
12929
12982
  id: lane.id,
12930
12983
  x: lane.x + 16,
12931
12984
  y: lane.y + 8,
12932
- w: measureTextWidth(lane.label, { fontSize: 20, letterSpacing: 2 }) + 24,
12985
+ w: measureTextWidth(lane.label, { fontSize: 20, letterSpacing: 2, textMetrics }) + 24,
12933
12986
  h: 28
12934
12987
  });
12935
12988
  }
@@ -12947,7 +13000,7 @@ function collectBBoxes(lanes, nodes, edges) {
12947
13000
  }
12948
13001
  for (const e of edges) {
12949
13002
  if (!hasRenderedLabel(e)) continue;
12950
- const bbox = computeLabelBBoxWorld(e);
13003
+ const bbox = computeLabelBBoxWorld(e, textMetrics);
12951
13004
  out.push({
12952
13005
  kind: "edge-label",
12953
13006
  id: e.id,
@@ -13645,10 +13698,10 @@ function forEachCandidatePair(bboxes, margin, visit) {
13645
13698
  }
13646
13699
  }
13647
13700
  }
13648
- function resolveEdgeLabelOverlapsWithChain(edges, fixedObstacles, minClearance = 16, maxIter = 20) {
13701
+ function resolveEdgeLabelOverlapsWithChain(edges, fixedObstacles, minClearance = 16, maxIter = 20, textMetrics = "proportional") {
13649
13702
  if (edges.length === 0) return edges;
13650
13703
  const labelBBox = (e, offsetX, offsetY) => {
13651
- const base = computeLabelBBoxWorld(e);
13704
+ const base = computeLabelBBoxWorld(e, textMetrics);
13652
13705
  return {
13653
13706
  kind: "edge-label",
13654
13707
  id: e.id,
@@ -13749,7 +13802,7 @@ function clampShiftMagnitude(shift, maxMagnitude) {
13749
13802
  };
13750
13803
  return { dx: clampAxis(shift.dx), dy: clampAxis(shift.dy) };
13751
13804
  }
13752
- function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClearance = 16, maxIter = 20, pathLabelClearance = LABEL_TO_PATH_CLEARANCE) {
13805
+ function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClearance = 16, maxIter = 20, pathLabelClearance = LABEL_TO_PATH_CLEARANCE, textMetrics = "proportional") {
13753
13806
  if (edges.length === 0) {
13754
13807
  return {
13755
13808
  edges,
@@ -13760,7 +13813,7 @@ function resolveEdgeLabelOverlapsWithChainAndPropagate(edges, obstacles, minClea
13760
13813
  }
13761
13814
  const MAX_ACCUMULATED_SHIFT = CHAIN_SHIFT_MAX_ACCUMULATED;
13762
13815
  const labelBBox = (e, offsetX, offsetY) => {
13763
- const base = computeLabelBBoxWorld(e);
13816
+ const base = computeLabelBBoxWorld(e, textMetrics);
13764
13817
  return {
13765
13818
  kind: "edge-label",
13766
13819
  id: e.id,
@@ -14361,11 +14414,15 @@ var \u5411\u304D\u306E\u9806 = [
14361
14414
  { axis: "x", sign: -1, \u540D\u524D: "\u5DE6" },
14362
14415
  { axis: "x", sign: 1, \u540D\u524D: "\u53F3" }
14363
14416
  ];
14364
- function \u672D\u304C\u52D5\u3051\u306A\u3044\u7406\u7531(labelId, \u76F8\u624B, edges, obstacles) {
14417
+ function \u672D\u304C\u52D5\u3051\u306A\u3044\u7406\u7531(labelId, \u76F8\u624B, edges, obstacles, textMetrics = "proportional") {
14365
14418
  const edgeById = new Map(edges.map((e) => [e.id, e]));
14366
14419
  const \u81EA\u5206 = edgeById.get(labelId);
14367
14420
  if (!\u81EA\u5206) return null;
14368
- const labels = edges.filter((e) => e.label?.trim() || e.sub?.trim()).map((e) => ({ kind: "edge-label", id: e.id, ...computeLabelBBoxWorld(e) }));
14421
+ const labels = edges.filter((e) => e.label?.trim() || e.sub?.trim()).map((e) => ({
14422
+ kind: "edge-label",
14423
+ id: e.id,
14424
+ ...computeLabelBBoxWorld(e, textMetrics)
14425
+ }));
14369
14426
  const label = labels.find((l) => l.id === labelId);
14370
14427
  if (!label) return null;
14371
14428
  const \u6E2C\u308A\u65B9 = \u7DDA\u306E\u6E2C\u308A\u65B9\u3092\u4F5C\u308B();
@@ -14407,7 +14464,7 @@ function \u672D\u304C\u52D5\u3051\u306A\u3044\u7406\u7531(labelId, \u76F8\u624B,
14407
14464
  }
14408
14465
  return `\u9003\u3052\u5834\u306A\u3057: ${\u7406\u7531.sort((a, b) => a.\u9806 - b.\u9806).map((r) => r.\u6587).join(" / ")}`;
14409
14466
  }
14410
- function resolveLabelClearanceAfterPathPasses(edges, obstacles, maxIter = 8) {
14467
+ function resolveLabelClearanceAfterPathPasses(edges, obstacles, maxIter = 8, textMetrics = "proportional") {
14411
14468
  if (edges.length === 0) return edges;
14412
14469
  const labeledIds = new Set(
14413
14470
  edges.filter((e) => e.label?.trim() || e.sub?.trim()).map((e) => e.id)
@@ -14425,7 +14482,7 @@ function resolveLabelClearanceAfterPathPasses(edges, obstacles, maxIter = 8) {
14425
14482
  const out = [];
14426
14483
  for (const e of edges) {
14427
14484
  if (!labeledIds.has(e.id)) continue;
14428
- const base = computeLabelBBoxWorld(e);
14485
+ const base = computeLabelBBoxWorld(e, textMetrics);
14429
14486
  const s = getShift(e.id);
14430
14487
  out.push({ kind: "edge-label", id: e.id, x: base.x + s.dx, y: base.y + s.dy, w: base.w, h: base.h });
14431
14488
  }
@@ -14558,7 +14615,7 @@ function applyEdgeLabelAndPathShifts(edges, labelShiftMap, edgePathShiftMap) {
14558
14615
 
14559
14616
  // src/layout/curve-path.ts
14560
14617
  var SAME_HEIGHT_THRESHOLD = 1;
14561
- function curvePath(from, to, edge, labelMarginExtra = 0) {
14618
+ function curvePath(from, to, edge, labelMarginExtra = 0, textMetrics = "proportional") {
14562
14619
  const fromLeft = from.cx - from.w / 2;
14563
14620
  const fromRight = from.cx + from.w / 2;
14564
14621
  const toLeft = to.cx - to.w / 2;
@@ -14626,7 +14683,7 @@ function curvePath(from, to, edge, labelMarginExtra = 0) {
14626
14683
  normalX *= -1;
14627
14684
  normalY *= -1;
14628
14685
  }
14629
- const labelW = computeLabelBoxW(edge?.label, edge?.sub);
14686
+ const labelW = computeLabelBoxW(edge?.label, edge?.sub, textMetrics);
14630
14687
  const labelH = labelPillH(edge?.sub);
14631
14688
  const distance = labelPathClearanceHorizontal(edge) + (Math.abs(normalX) * labelW + Math.abs(normalY) * labelH) / 2 + labelMarginExtra;
14632
14689
  return {
@@ -14658,7 +14715,7 @@ function polyline(points) {
14658
14715
  });
14659
14716
  return distinct.map((p, i) => `${i === 0 ? "M" : "L"} ${point(p)}`).join(" ");
14660
14717
  }
14661
- function metroPath(from, to, edge, labelMarginExtra = 0) {
14718
+ function metroPath(from, to, edge, labelMarginExtra = 0, textMetrics = "proportional") {
14662
14719
  const fromLeft = from.cx - from.w / 2;
14663
14720
  const fromRight = from.cx + from.w / 2;
14664
14721
  const toLeft = to.cx - to.w / 2;
@@ -14769,7 +14826,7 @@ function metroPath(from, to, edge, labelMarginExtra = 0) {
14769
14826
  normalX *= -1;
14770
14827
  normalY *= -1;
14771
14828
  }
14772
- const labelW = computeLabelBoxW(edge?.label, edge?.sub);
14829
+ const labelW = computeLabelBoxW(edge?.label, edge?.sub, textMetrics);
14773
14830
  const labelH = labelPillH(edge?.sub);
14774
14831
  const distance = labelPathClearanceHorizontal(edge) + (Math.abs(normalX) * labelW + Math.abs(normalY) * labelH) / 2 + labelMarginExtra;
14775
14832
  return {
@@ -14938,9 +14995,9 @@ function \u66F8\u3044\u305F\u5024\u304B\u63A7\u3048(\u66F8\u3044\u305F, \u63A7\u
14938
14995
  const v = (\u66F8\u3044\u305F ?? "").trim();
14939
14996
  return v === "" ? \u63A7\u3048 : v;
14940
14997
  }
14941
- function \u5E45\u306E\u500D\u7387(text, size, letterSpacing, \u5E45) {
14998
+ function \u5E45\u306E\u500D\u7387(text, size, letterSpacing, \u5E45, textMetrics = "proportional") {
14942
14999
  if (!(\u5E45 > 0) || !(size > 0)) return 1;
14943
- const \u5B9F\u5E45 = textWidth(text, size, letterSpacing);
15000
+ const \u5B9F\u5E45 = textWidth(text, size, letterSpacing, textMetrics);
14944
15001
  return \u5B9F\u5E45 > \u5E45 ? \u5E45 / \u5B9F\u5E45 : 1;
14945
15002
  }
14946
15003
  function \u8AAD\u3081\u308B\u4E0B\u9650\u306E\u500D\u7387(\u5927\u304D\u3055) {
@@ -15155,13 +15212,13 @@ function fitArt(region, extent, art) {
15155
15212
  );
15156
15213
  }
15157
15214
  var \u5E2F\u306E\u9AD8\u3055\u306B\u5BFE\u3059\u308B\u4E0A\u9650 = 0.8;
15158
- function \u7D75\u306E\u4E2D\u306E\u5B57\u306E\u5E45(text, size, letterSpacing = 0) {
15215
+ function \u7D75\u306E\u4E2D\u306E\u5B57\u306E\u5E45(text, size, letterSpacing = 0, textMetrics = "proportional") {
15159
15216
  return Math.max(
15160
15217
  displayWidth(text) * size * MONO_ADVANCE_RATIO,
15161
- textWidth(text, size, letterSpacing)
15218
+ textWidth(text, size, letterSpacing, textMetrics)
15162
15219
  );
15163
15220
  }
15164
- function \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u5B57\u3089) {
15221
+ function \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u5B57\u3089, textMetrics = "proportional") {
15165
15222
  const \u623B\u3057 = Number.isFinite(\u500D\u7387) && \u500D\u7387 > 0 ? 1 / \u500D\u7387 : 1;
15166
15223
  let \u4E0A\u9650 = Number.POSITIVE_INFINITY;
15167
15224
  for (const \u5B572 of \u5B57\u3089) {
@@ -15170,7 +15227,7 @@ function \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u5B57\u3089)
15170
15227
  if (Number.isFinite(\u9AD8\u3055) && \u9AD8\u3055 > 0) {
15171
15228
  \u4E0A\u9650 = Math.min(\u4E0A\u9650, \u9AD8\u3055 * \u5E2F\u306E\u9AD8\u3055\u306B\u5BFE\u3059\u308B\u4E0A\u9650 / \u5B572.size);
15172
15229
  }
15173
- const \u5B9F\u5E45 = \u7D75\u306E\u4E2D\u306E\u5B57\u306E\u5E45(\u5B572.text, \u5B572.size, \u5B572.letterSpacing ?? 0);
15230
+ const \u5B9F\u5E45 = \u7D75\u306E\u4E2D\u306E\u5B57\u306E\u5E45(\u5B572.text, \u5B572.size, \u5B572.letterSpacing ?? 0, textMetrics);
15174
15231
  if (Number.isFinite(\u5E45) && \u5E45 > 0 && \u5B9F\u5E45 > 0) {
15175
15232
  \u4E0A\u9650 = Math.min(\u4E0A\u9650, \u5E45 / \u5B9F\u5E45);
15176
15233
  }
@@ -16026,9 +16083,14 @@ function \u6728\u306E\u5F62(treeNodes) {
16026
16083
  return { \u8449\u306E\u6570, \u6BB5\u6570 };
16027
16084
  }
16028
16085
  var \u6728\u306E\u679D\u306E\u592A\u3055 = (\u6BB5) => Math.max(1.1, 2.6 - \u6BB5 * 0.45);
16029
- function \u6728\u306E\u4E2D\u8EAB(node, stateValues = {}) {
16086
+ function \u6728\u306E\u4E2D\u8EAB(node, stateValues = {}, textMetrics = "proportional") {
16030
16087
  const treeNodes = resolveTreeData(node.treeData ?? [], stateValues);
16031
- return computeTreeLayout(treeNodes, node.w - PAD_LEFT - PAD_RIGHT, node.h - PAD_TOP - PAD_BOTTOM);
16088
+ return computeTreeLayout(
16089
+ treeNodes,
16090
+ node.w - PAD_LEFT - PAD_RIGHT,
16091
+ node.h - PAD_TOP - PAD_BOTTOM,
16092
+ textMetrics
16093
+ );
16032
16094
  }
16033
16095
  function \u6728\u306E\u884C(n) {
16034
16096
  return [
@@ -16041,12 +16103,14 @@ function TreeNode({
16041
16103
  active,
16042
16104
  stateValues = {},
16043
16105
  drawing = false,
16044
- progress = 1
16106
+ progress = 1,
16107
+ textMetrics = "proportional"
16045
16108
  }) {
16046
16109
  const x0 = node.cx - node.w / 2;
16047
16110
  const y0 = node.cy - node.h / 2;
16048
16111
  const gradientId = `tree-root-grad-${node.id}`;
16049
- const layout2 = \u6728\u306E\u4E2D\u8EAB(node, stateValues);
16112
+ const layout2 = \u6728\u306E\u4E2D\u8EAB(node, stateValues, textMetrics);
16113
+ const \u6E2C\u308B = \u7BB1\u306E\u5B57\u3092\u6E2C\u308B(textMetrics);
16050
16114
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
16051
16115
  const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
16052
16116
  const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
@@ -16100,10 +16164,10 @@ function TreeNode({
16100
16164
  const accent = depthColors[Math.min(n.depth, depthColors.length - 1)] ?? depthColors[0];
16101
16165
  const isRoot = n.depth === 0;
16102
16166
  const \u6750\u6599 = \u6728\u306E\u884C(n);
16103
- const \u884C = \u7BB1\u306B\u7A4D\u3080(\u6750\u6599, n.w, n.h);
16167
+ const \u884C = \u7BB1\u306B\u7A4D\u3080(\u6750\u6599, n.w, n.h, \u6E2C\u308B);
16104
16168
  const \u88DC\u8DB3\u3042\u308A = (n.subtitle ?? "").trim() !== "";
16105
16169
  const \u540D\u524D = \u6750\u6599[0];
16106
- const \u53CE\u3081\u305F\u540D\u524D = \u88DC\u8DB3\u3042\u308A ? void 0 : \u5E45\u306B\u53CE\u3081\u308B(\u540D\u524D.text, \u540D\u524D.fontSize, \u4F7F\u3048\u308B\u5E45(n.w));
16170
+ const \u53CE\u3081\u305F\u540D\u524D = \u88DC\u8DB3\u3042\u308A ? void 0 : \u5E45\u306B\u53CE\u3081\u308B(\u540D\u524D.text, \u540D\u524D.fontSize, \u4F7F\u3048\u308B\u5E45(n.w), \u6E2C\u308B);
16107
16171
  return /* @__PURE__ */ jsx(
16108
16172
  "g",
16109
16173
  {
@@ -16185,7 +16249,7 @@ function TreeNode({
16185
16249
  })
16186
16250
  ] });
16187
16251
  }
16188
- function computeTreeLayout(treeNodes, canvasW, canvasH) {
16252
+ function computeTreeLayout(treeNodes, canvasW, canvasH, textMetrics = "proportional") {
16189
16253
  const ids = new Set(treeNodes.map((n) => n.id));
16190
16254
  const childrenOf = /* @__PURE__ */ new Map();
16191
16255
  for (const n of treeNodes) {
@@ -16233,7 +16297,7 @@ function computeTreeLayout(treeNodes, canvasW, canvasH) {
16233
16297
  const \u7BB1\u306E\u5E45 = (n, depth) => {
16234
16298
  const \u6750\u6599 = \u6728\u306E\u884C({ ...n, depth });
16235
16299
  const \u540D\u524D = \u6750\u6599[0];
16236
- const \u8981\u308B = measureTextWidth(\u540D\u524D.text, { fontSize: \u540D\u524D.fontSize}) + (nodeW - \u4F7F\u3048\u308B\u5E45(nodeW));
16300
+ const \u8981\u308B = measureTextWidth(\u540D\u524D.text, { fontSize: \u540D\u524D.fontSize, textMetrics }) + (nodeW - \u4F7F\u3048\u308B\u5E45(nodeW));
16237
16301
  return Math.min(Math.max(\u8981\u308B, nodeW), slotW * 0.92);
16238
16302
  };
16239
16303
  const \u8449\u306E\u4E26\u3073 = [];
@@ -16337,7 +16401,7 @@ var BRANCH_BOX_H_MAX = 48;
16337
16401
  var SUB_BOX_H_MAX = 40;
16338
16402
  var \u7E26\u306E\u9593\u9694\u306E\u4E0A\u9650 = (\u679D\u306E\u6A2A\u306E\u4F38\u3073) => \u679D\u306E\u6A2A\u306E\u4F38\u3073;
16339
16403
  var MIND_PAD = 40;
16340
- function \u653E\u5C04\u306E\u4E2D\u8EAB(node, stateValues = {}) {
16404
+ function \u653E\u5C04\u306E\u4E2D\u8EAB(node, stateValues = {}, textMetrics = "proportional") {
16341
16405
  const mindData = node.mindData ? resolveMindData(node.mindData, stateValues) : void 0;
16342
16406
  if (!mindData) return void 0;
16343
16407
  return computeMindMapLayout(
@@ -16345,7 +16409,8 @@ function \u653E\u5C04\u306E\u4E2D\u8EAB(node, stateValues = {}) {
16345
16409
  node.w / 2,
16346
16410
  node.h / 2,
16347
16411
  node.w - MIND_PAD * 2,
16348
- node.h - MIND_PAD * 2
16412
+ node.h - MIND_PAD * 2,
16413
+ textMetrics
16349
16414
  );
16350
16415
  }
16351
16416
  function \u653E\u5C04\u306E\u884C(n) {
@@ -16359,12 +16424,14 @@ function MindMapNode({
16359
16424
  active,
16360
16425
  stateValues = {},
16361
16426
  drawing = false,
16362
- progress = 1
16427
+ progress = 1,
16428
+ textMetrics = "proportional"
16363
16429
  }) {
16364
16430
  const x0 = node.cx - node.w / 2;
16365
16431
  const y0 = node.cy - node.h / 2;
16366
- const layout2 = \u653E\u5C04\u306E\u4E2D\u8EAB(node, stateValues);
16432
+ const layout2 = \u653E\u5C04\u306E\u4E2D\u8EAB(node, stateValues, textMetrics);
16367
16433
  if (!layout2) return /* @__PURE__ */ jsx("g", { transform: `translate(${x0} ${y0})` });
16434
+ const \u6E2C\u308B = \u7BB1\u306E\u5B57\u3092\u6E2C\u308B(textMetrics);
16368
16435
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
16369
16436
  const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
16370
16437
  const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
@@ -16411,8 +16478,13 @@ function MindMapNode({
16411
16478
  const \u6587\u5B57\u306E\u5BC4\u305B = \u67A0\u306A\u3057 ? \u5916\u3078 ? "start" : "end" : "middle";
16412
16479
  const \u63CF\u753B\u57DF\u306E\u7AEF = \u5916\u3078 ? node.w - MIND_PAD : MIND_PAD;
16413
16480
  const \u4F7F\u3048\u308B = \u67A0\u306A\u3057 ? Math.abs(\u63CF\u753B\u57DF\u306E\u7AEF - \u6587\u5B57\u306Ex) : \u4F7F\u3048\u308B\u5E45(n.w);
16414
- const \u53CE\u3081\u305F\u540D\u524D = \u88DC\u8DB3\u3042\u308A ? void 0 : \u5E45\u306B\u53CE\u3081\u308B(\u540D\u524D.text, \u540D\u524D.fontSize, \u4F7F\u3048\u308B);
16415
- const \u884C = \u7BB1\u306B\u7A4D\u3080(\u6750\u6599, \u67A0\u306A\u3057 ? \u4F7F\u3048\u308B + (n.w - \u4F7F\u3048\u308B\u5E45(n.w)) : n.w, n.h);
16481
+ const \u53CE\u3081\u305F\u540D\u524D = \u88DC\u8DB3\u3042\u308A ? void 0 : \u5E45\u306B\u53CE\u3081\u308B(\u540D\u524D.text, \u540D\u524D.fontSize, \u4F7F\u3048\u308B, \u6E2C\u308B);
16482
+ const \u884C = \u7BB1\u306B\u7A4D\u3080(
16483
+ \u6750\u6599,
16484
+ \u67A0\u306A\u3057 ? \u4F7F\u3048\u308B + (n.w - \u4F7F\u3048\u308B\u5E45(n.w)) : n.w,
16485
+ n.h,
16486
+ \u6E2C\u308B
16487
+ );
16416
16488
  const \u6587\u5B57\u306E\u8272 = n.isRoot ? "var(--cdl-text-on-tone, #ffffff)" : "var(--cdl-chip-text, #1a1f2a)";
16417
16489
  return /* @__PURE__ */ jsxs("g", { "data-cdl-unresolved": n.unresolved ? "true" : void 0, children: [
16418
16490
  \u67A0\u306A\u3057 ? null : /* @__PURE__ */ jsx(
@@ -16464,14 +16536,14 @@ function MindMapNode({
16464
16536
  })
16465
16537
  ] });
16466
16538
  }
16467
- function \u63CF\u304F\u6A2A\u306E\u7AEF(n) {
16539
+ function \u63CF\u304F\u6A2A\u306E\u7AEF(n, textMetrics = "proportional") {
16468
16540
  if (n.isRoot || !n.isLeaf) return [n.x - n.w / 2, n.x + n.w / 2];
16469
16541
  const \u8D77\u70B9 = n.x + (n.side === "right" ? -n.w / 2 : n.w / 2);
16470
16542
  const \u540D\u524D = \u653E\u5C04\u306E\u884C(n)[0];
16471
- const \u5E45 = textWidth(\u540D\u524D.text, \u540D\u524D.fontSize);
16543
+ const \u5E45 = textWidth(\u540D\u524D.text, \u540D\u524D.fontSize, 0, textMetrics);
16472
16544
  return n.side === "right" ? [\u8D77\u70B9, \u8D77\u70B9 + \u5E45] : [\u8D77\u70B9 - \u5E45, \u8D77\u70B9];
16473
16545
  }
16474
- function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
16546
+ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH, textMetrics = "proportional") {
16475
16547
  const nodes = [];
16476
16548
  const edges = [];
16477
16549
  const rootW = 120;
@@ -16549,7 +16621,7 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
16549
16621
  const PREFERRED_GAP = MIND_BOX_GAP;
16550
16622
  const \u679D\u306E\u540D\u524D\u306E\u5E45 = (title) => {
16551
16623
  const \u540D\u524D = \u653E\u5C04\u306E\u884C({ title, isRoot: false })[0];
16552
- return textWidth(\u540D\u524D.text, \u540D\u524D.fontSize);
16624
+ return textWidth(\u540D\u524D.text, \u540D\u524D.fontSize, 0, textMetrics);
16553
16625
  };
16554
16626
  const \u679D\u306E\u6A2A\u3092\u6C7A\u3081\u308B = (br) => {
16555
16627
  const maxSubDepth = subDepthOf(br.id, /* @__PURE__ */ new Set());
@@ -16667,7 +16739,7 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
16667
16739
  let maxExtentX = rootW / 2;
16668
16740
  let maxExtentY = rootH / 2;
16669
16741
  for (const n of nodes) {
16670
- const [\u5DE6, \u53F3] = \u63CF\u304F\u6A2A\u306E\u7AEF(n);
16742
+ const [\u5DE6, \u53F3] = \u63CF\u304F\u6A2A\u306E\u7AEF(n, textMetrics);
16671
16743
  maxExtentX = Math.max(maxExtentX, Math.abs(\u5DE6 - cx), Math.abs(\u53F3 - cx));
16672
16744
  maxExtentY = Math.max(maxExtentY, Math.abs(n.y - cy) + n.h / 2);
16673
16745
  }
@@ -16687,7 +16759,7 @@ function computeMindMapLayout(mindData, cx, cy, canvasW, canvasH) {
16687
16759
  let \u5DE6\u7AEF = Number.POSITIVE_INFINITY;
16688
16760
  let \u53F3\u7AEF = Number.NEGATIVE_INFINITY;
16689
16761
  for (const n of nodes) {
16690
- const [l, r] = \u63CF\u304F\u6A2A\u306E\u7AEF(n);
16762
+ const [l, r] = \u63CF\u304F\u6A2A\u306E\u7AEF(n, textMetrics);
16691
16763
  \u5DE6\u7AEF = Math.min(\u5DE6\u7AEF, l);
16692
16764
  \u53F3\u7AEF = Math.max(\u53F3\u7AEF, r);
16693
16765
  }
@@ -16930,10 +17002,16 @@ function emptyCounts() {
16930
17002
  "validation-interrupted": 0
16931
17003
  };
16932
17004
  }
16933
- function \u7A4D\u3080\u7BB1\u3092\u96C6\u3081\u308B(n) {
16934
- const \u7BB1 = (b, \u884C) => ({ \u884C, w: b.w, h: b.h });
16935
- if (n.kind === "tree-hierarchy") return \u6728\u306E\u4E2D\u8EAB(n).nodes.map((b) => \u7BB1(b, \u6728\u306E\u884C(b)));
16936
- if (n.kind === "mind-map") return (\u653E\u5C04\u306E\u4E2D\u8EAB(n)?.nodes ?? []).map((b) => \u7BB1(b, \u653E\u5C04\u306E\u884C(b)));
17005
+ function \u7A4D\u3080\u7BB1\u3092\u96C6\u3081\u308B(n, textMetrics = "proportional") {
17006
+ const \u7BB1 = (b, \u884C, \u6E2C\u308B) => ({ \u884C, w: b.w, h: b.h, \u6E2C\u308B });
17007
+ if (n.kind === "tree-hierarchy") {
17008
+ const \u6E2C\u308B = \u7BB1\u306E\u5B57\u3092\u6E2C\u308B(textMetrics);
17009
+ return \u6728\u306E\u4E2D\u8EAB(n, {}, textMetrics).nodes.map((b) => \u7BB1(b, \u6728\u306E\u884C(b), \u6E2C\u308B));
17010
+ }
17011
+ if (n.kind === "mind-map") {
17012
+ const \u6E2C\u308B = \u7BB1\u306E\u5B57\u3092\u6E2C\u308B(textMetrics);
17013
+ return (\u653E\u5C04\u306E\u4E2D\u8EAB(n, {}, textMetrics)?.nodes ?? []).map((b) => \u7BB1(b, \u653E\u5C04\u306E\u884C(b), \u6E2C\u308B));
17014
+ }
16937
17015
  return [];
16938
17016
  }
16939
17017
  function measureStubOut(segs) {
@@ -17619,6 +17697,7 @@ function \u4F4D\u7F6E\u3092\u624B\u3067\u66F8\u3044\u305F(n) {
17619
17697
  return n.posX !== void 0 && n.posY !== void 0;
17620
17698
  }
17621
17699
  function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5668) {
17700
+ const textMetrics = laid.textMetrics ?? "proportional";
17622
17701
  const LIFELINE_W_THRESHOLD = 8;
17623
17702
  for (const n of laid.nodes) {
17624
17703
  if (n.w < LIFELINE_W_THRESHOLD) continue;
@@ -17630,7 +17709,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17630
17709
  );
17631
17710
  }
17632
17711
  }
17633
- const bboxes = collectBBoxes(laid.lanes, laid.nodes, laid.edges);
17712
+ const bboxes = collectBBoxes(laid.lanes, laid.nodes, laid.edges, textMetrics);
17634
17713
  const collisions = detectCollisions(bboxes, laid.edges);
17635
17714
  for (const c of collisions) {
17636
17715
  const involvesEdgeLabel = c.a.kind === "edge-label" || c.b.kind === "edge-label";
@@ -17650,7 +17729,11 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17650
17729
  if (!titleTrimmed) continue;
17651
17730
  const \u4F59\u767D = drawsTitleOutsideBox(n.kind) ? 0 : TITLE_BOX_PADDING;
17652
17731
  const \u4F7F\u3048\u308B\u5E452 = n.w - \u4F59\u767D;
17653
- const \u5B9F\u5E45 = measureTextWidth(titleTrimmed, { fontSize: titleFontSize(n.kind), bound: "drawn" });
17732
+ const \u5B9F\u5E45 = measureTextWidth(titleTrimmed, {
17733
+ fontSize: titleFontSize(n.kind),
17734
+ bound: "drawn",
17735
+ textMetrics
17736
+ });
17654
17737
  if (titleScalesToFit(n.kind, n.h)) {
17655
17738
  const \u7E2E\u3081\u305F\u5927\u304D\u3055 = \u5B9F\u5E45 > 0 ? titleFontSize(n.kind) * Math.min(1, \u4F7F\u3048\u308B\u5E452 / \u5B9F\u5E45) : titleFontSize(n.kind);
17656
17739
  if (\u7E2E\u3081\u305F\u5927\u304D\u3055 < MIN_TITLE_FONT_SIZE) {
@@ -17718,7 +17801,13 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17718
17801
  const b\u306F\u672D = n.b.kind === "edge-label";
17719
17802
  const \u52D5\u304B\u3059 = a\u306F\u672D && b\u306F\u672D ? (\u8FBA\u306E\u9806.get(n.a.id) ?? 0) > (\u8FBA\u306E\u9806.get(n.b.id) ?? 0) ? n.a : n.b : a\u306F\u672D ? n.a : b\u306F\u672D ? n.b : null;
17720
17803
  const \u76F8\u624B = \u52D5\u304B\u3059 === n.a ? n.b : n.a;
17721
- const reason = \u52D5\u304B\u3059 !== null ? \u672D\u304C\u52D5\u3051\u306A\u3044\u7406\u7531(\u52D5\u304B\u3059.id, \u76F8\u624B, laid.edges, \u672D\u306E\u969C\u5BB3\u7269) ?? void 0 : void 0;
17804
+ const reason = \u52D5\u304B\u3059 !== null ? \u672D\u304C\u52D5\u3051\u306A\u3044\u7406\u7531(
17805
+ \u52D5\u304B\u3059.id,
17806
+ \u76F8\u624B,
17807
+ laid.edges,
17808
+ \u672D\u306E\u969C\u5BB3\u7269,
17809
+ textMetrics
17810
+ ) ?? void 0 : void 0;
17722
17811
  push(
17723
17812
  "clearance",
17724
17813
  `${n.a.kind}:${n.a.id} \u2194 ${n.b.kind}:${n.b.id} gap=${n.gap.toFixed(1)}px (need ${n.required}px)`,
@@ -17732,7 +17821,10 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17732
17821
  if (!hasRenderedLabel(e)) continue;
17733
17822
  const segs = extractPathSegments(e.d);
17734
17823
  if (segs.length === 0) continue;
17735
- const minDist = measurePathLabelGapSegs(flattenPathSegments(segs), computeLabelBBoxWorld(e));
17824
+ const minDist = measurePathLabelGapSegs(
17825
+ flattenPathSegments(segs),
17826
+ computeLabelBBoxWorld(e, textMetrics)
17827
+ );
17736
17828
  if (!Number.isFinite(minDist)) continue;
17737
17829
  if (minDist > PROXIMITY_ERROR_THRESHOLD) {
17738
17830
  push(
@@ -17782,8 +17874,15 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17782
17874
  }
17783
17875
  for (const e of laid.edges) {
17784
17876
  if (!hasRenderedLabel(e)) continue;
17785
- const mainW = measureTextWidth(e.label ?? "", { fontSize: EDGE_LABEL_TEXT.main.fontSize });
17786
- const subW = e.sub ? measureTextWidth(e.sub, { fontSize: EDGE_LABEL_TEXT.sub.fontSize, fontFamily: "mono" }) : 0;
17877
+ const mainW = measureTextWidth(e.label ?? "", {
17878
+ fontSize: EDGE_LABEL_TEXT.main.fontSize,
17879
+ textMetrics
17880
+ });
17881
+ const subW = e.sub ? measureTextWidth(e.sub, {
17882
+ fontSize: EDGE_LABEL_TEXT.sub.fontSize,
17883
+ fontFamily: "mono",
17884
+ textMetrics
17885
+ }) : 0;
17787
17886
  const expectedBoxW = Math.max(mainW, subW) + LABEL_PILL_PAD_X * 2;
17788
17887
  const bbox = bboxes.find((b) => b.kind === "edge-label" && b.id === e.id);
17789
17888
  if (!bbox) continue;
@@ -17925,7 +18024,9 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17925
18024
  }
17926
18025
  }
17927
18026
  for (const n of laid.nodes) {
17928
- const \u843D\u3068\u3057\u305F = labelPlan(n).\u843D\u3068\u3057\u305F.filter((line) => droppedLineIsHidden(n.kind, line));
18027
+ const \u843D\u3068\u3057\u305F = labelPlan(n).\u843D\u3068\u3057\u305F.filter(
18028
+ (line) => droppedLineIsHidden(n.kind, line)
18029
+ );
17929
18030
  if (\u843D\u3068\u3057\u305F.length === 0) continue;
17930
18031
  push(
17931
18032
  "shape-label-dropped",
@@ -17934,7 +18035,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17934
18035
  );
17935
18036
  }
17936
18037
  for (const n of laid.nodes) {
17937
- const \u7BB1 = \u7A4D\u3080\u7BB1\u3092\u96C6\u3081\u308B(n);
18038
+ const \u7BB1 = \u7A4D\u3080\u7BB1\u3092\u96C6\u3081\u308B(n, textMetrics);
17938
18039
  if (\u7BB1.length === 0) continue;
17939
18040
  let \u5BFE\u8C61 = 0;
17940
18041
  const \u843D\u3061\u305F = [];
@@ -17942,7 +18043,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
17942
18043
  const \u5BA3\u8A00 = b.\u884C.slice(1).filter((r) => r.text.trim() !== "");
17943
18044
  if (\u5BA3\u8A00.length === 0) continue;
17944
18045
  \u5BFE\u8C61 += 1;
17945
- const \u6B8B\u3063\u305F = new Set(\u7BB1\u306B\u7A4D\u3080(b.\u884C, b.w, b.h).map((r) => r.\u5F79\u5272));
18046
+ const \u6B8B\u3063\u305F = new Set(\u7BB1\u306B\u7A4D\u3080(b.\u884C, b.w, b.h, b.\u6E2C\u308B).map((r) => r.\u5F79\u5272));
17946
18047
  if (\u5BA3\u8A00.every((r) => \u6B8B\u3063\u305F.has(r.\u5F79\u5272))) continue;
17947
18048
  \u843D\u3061\u305F.push({ title: b.\u884C[0]?.text ?? "", h: b.h });
17948
18049
  }
@@ -19005,7 +19106,7 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes, \u5
19005
19106
  const allowedLanes = /* @__PURE__ */ new Set();
19006
19107
  if (fromNode) allowedLanes.add(fromNode.lane);
19007
19108
  if (toNode) allowedLanes.add(toNode.lane);
19008
- const box = computeLabelBBoxWorld(e);
19109
+ const box = computeLabelBBoxWorld(e, textMetrics);
19009
19110
  for (const lane of laid.lanes) {
19010
19111
  if (allowedLanes.has(lane.id)) continue;
19011
19112
  const side = rectCrossesLaneBorder(box, lane, rangeByLane.get(lane.id));
@@ -19383,7 +19484,7 @@ function pickFreeSides(occupied, count) {
19383
19484
  const \u4F7F\u3046 = \u7A7A\u304D.length > 0 ? \u7A7A\u304D : [SELF_LOOP_SIDE_FALLBACK];
19384
19485
  return Array.from({ length: count }, (_, i) => \u4F7F\u3046[i % \u4F7F\u3046.length]);
19385
19486
  }
19386
- function routeSelfLoopGroup(edges, node, side) {
19487
+ function routeSelfLoopGroup(edges, node, side, textMetrics = "proportional") {
19387
19488
  const horizontal = side === "left" || side === "right";
19388
19489
  const g = sideGeometry(node, side);
19389
19490
  const span = fitSpan(horizontal ? node.h : node.w, SELF_LOOP_SPAN);
@@ -19392,7 +19493,7 @@ function routeSelfLoopGroup(edges, node, side) {
19392
19493
  const \u6700\u5916 = controlOffset(SELF_LOOP_OUT + (edges.length - 1) * SELF_LOOP_STAGGER);
19393
19494
  const \u8A9E\u307E\u3067 = \u6700\u5916 + LABEL_TO_PATH_CLEARANCE;
19394
19495
  const \u8A9E\u5E45 = edges.map(
19395
- (e) => horizontal ? labelPillH(e.sub) : computeLabelBoxW(e.label, e.sub)
19496
+ (e) => horizontal ? labelPillH(e.sub) : computeLabelBoxW(e.label, e.sub, textMetrics)
19396
19497
  );
19397
19498
  const \u4F4D\u7F6E = [];
19398
19499
  let \u7A4D = 0;
@@ -19422,7 +19523,7 @@ function routeSelfLoopGroup(edges, node, side) {
19422
19523
  function isSelfLoop(e) {
19423
19524
  return e.from === e.to;
19424
19525
  }
19425
- function layoutSelfLoops(edges, nodes, occupiedBySide) {
19526
+ function layoutSelfLoops(edges, nodes, occupiedBySide, textMetrics = "proportional") {
19426
19527
  const \u5272\u5F53 = /* @__PURE__ */ new Map();
19427
19528
  for (const edge of edges) {
19428
19529
  if (edge.side) continue;
@@ -19449,7 +19550,7 @@ function layoutSelfLoops(edges, nodes, occupiedBySide) {
19449
19550
  if (\u65E2) \u65E2.edges.push(edge);
19450
19551
  else \u675F.set(key, { node, side, edges: [edge] });
19451
19552
  }
19452
- return [...\u675F.values()].flatMap((b) => routeSelfLoopGroup(b.edges, b.node, b.side));
19553
+ return [...\u675F.values()].flatMap((b) => routeSelfLoopGroup(b.edges, b.node, b.side, textMetrics));
19453
19554
  }
19454
19555
 
19455
19556
  // src/layout/tokens.ts
@@ -19667,7 +19768,7 @@ function verticalDetourBlockers(A, B, obstacles) {
19667
19768
  function detourColumnFor(blockers, side) {
19668
19769
  return side === "left" ? Math.min(...blockers.map((n) => n.cx - n.w / 2)) - VERTICAL_DETOUR_GAP : Math.max(...blockers.map((n) => n.cx + n.w / 2)) + VERTICAL_DETOUR_GAP;
19669
19770
  }
19670
- function layoutEdges(diag, nodes, lanes = []) {
19771
+ function layoutEdges(diag, nodes, lanes = [], textMetrics = "proportional") {
19671
19772
  const labelMarginExtra = (diag.viewport?.labelMargin ?? diag.viewport?.gap ?? DEFAULT_LABEL_MARGIN) - DEFAULT_LABEL_MARGIN;
19672
19773
  const nmap = new Map(nodes.map((n) => [n.id, n]));
19673
19774
  const lmap = new Map(lanes.map((l) => [l.id, l]));
@@ -19700,7 +19801,7 @@ function layoutEdges(diag, nodes, lanes = []) {
19700
19801
  const to = nmap.get(e.to);
19701
19802
  if (!from) throw new Error(`cdl layout: edge "${e.id}" \u306E from "${e.from}" \u304C node \u306B\u7121\u3044`);
19702
19803
  if (!to) throw new Error(`cdl layout: edge "${e.id}" \u306E to "${e.to}" \u304C node \u306B\u7121\u3044`);
19703
- const c = curvePath(from, to, e, labelMarginExtra);
19804
+ const c = curvePath(from, to, e, labelMarginExtra, textMetrics);
19704
19805
  positionedEdges.push({
19705
19806
  ...e,
19706
19807
  d: c.d,
@@ -19715,7 +19816,7 @@ function layoutEdges(diag, nodes, lanes = []) {
19715
19816
  const to = nmap.get(e.to);
19716
19817
  if (!from) throw new Error(`cdl layout: edge "${e.id}" \u306E from "${e.from}" \u304C node \u306B\u7121\u3044`);
19717
19818
  if (!to) throw new Error(`cdl layout: edge "${e.id}" \u306E to "${e.to}" \u304C node \u306B\u7121\u3044`);
19718
- const m = metroPath(from, to, e, labelMarginExtra);
19819
+ const m = metroPath(from, to, e, labelMarginExtra, textMetrics);
19719
19820
  positionedEdges.push({
19720
19821
  ...e,
19721
19822
  d: m.d,
@@ -19763,7 +19864,7 @@ function layoutEdges(diag, nodes, lanes = []) {
19763
19864
  \u4F7F\u3046(le.from, le.fromSide);
19764
19865
  \u4F7F\u3046(le.to, le.toSide);
19765
19866
  }
19766
- const loopEdges = layoutSelfLoops(selfLoopEdges, nmap, occupiedBySide);
19867
+ const loopEdges = layoutSelfLoops(selfLoopEdges, nmap, occupiedBySide, textMetrics);
19767
19868
  const labelOffsetsByEdgeId = /* @__PURE__ */ new Map();
19768
19869
  const parallelKey = (p) => p.e.from < p.e.to ? `${p.e.from}::${p.e.to}` : `${p.e.to}::${p.e.from}`;
19769
19870
  const byParallel = /* @__PURE__ */ new Map();
@@ -19917,7 +20018,7 @@ function layoutEdges(diag, nodes, lanes = []) {
19917
20018
  const others = nodes.filter((n) => n.id !== c.from && n.id !== c.to);
19918
20019
  if (others.some((n) => segmentsCrossRect(segs, nodeRect(n)))) return true;
19919
20020
  if (!hasRenderedLabel(c.e)) return false;
19920
- const boxW = computeLabelBoxW(c.e.label, c.e.sub);
20021
+ const boxW = computeLabelBoxW(c.e.label, c.e.sub, textMetrics);
19921
20022
  const boxH = labelPillH(c.e.sub);
19922
20023
  const centerX = columnX - (labelPathClearanceHorizontal(c.e) + boxW / 2);
19923
20024
  const pill = { x: centerX - boxW / 2, y: (exitY + returnY) / 2 - boxH / 2, w: boxW, h: boxH };
@@ -20032,7 +20133,8 @@ function layoutEdges(diag, nodes, lanes = []) {
20032
20133
  allOtherNodes,
20033
20134
  { x: endpointOffset.fromDx, y: endpointOffset.fromDy },
20034
20135
  { x: endpointOffset.toDx, y: endpointOffset.toDy },
20035
- avoidRects
20136
+ avoidRects,
20137
+ textMetrics
20036
20138
  );
20037
20139
  const routed1 = route([]);
20038
20140
  const { d, labelX, labelY, labelAnchor, labelAltX } = routed1;
@@ -20088,13 +20190,13 @@ function layoutEdges(diag, nodes, lanes = []) {
20088
20190
  const pillById = /* @__PURE__ */ new Map();
20089
20191
  for (const r of list) {
20090
20192
  if (!hasRenderedLabel(r.e)) continue;
20091
- const w = computeLabelBoxW(r.e.label, r.e.sub);
20193
+ const w = computeLabelBoxW(r.e.label, r.e.sub, textMetrics);
20092
20194
  const h = labelPillH(r.e.sub);
20093
20195
  pillById.set(r.e.id, { x: r.baseLabelX - w / 2, y: r.baseLabelY - h / 2, w, h });
20094
20196
  }
20095
20197
  for (const le of positionedEdges) {
20096
20198
  if (!hasRenderedLabel(le)) continue;
20097
- const w = computeLabelBoxW(le.label, le.sub);
20199
+ const w = computeLabelBoxW(le.label, le.sub, textMetrics);
20098
20200
  const h = labelPillH(le.sub);
20099
20201
  pillById.set(le.id, { x: le.labelX - w / 2, y: le.labelY - h / 2, w, h });
20100
20202
  }
@@ -20124,7 +20226,7 @@ function layoutEdges(diag, nodes, lanes = []) {
20124
20226
  const laneOfNode = new Map(nodes.map((n) => [n.id, n.lane]));
20125
20227
  for (const r of flippable) {
20126
20228
  const ownSegs = segsByEdgeId.get(r.e.id);
20127
- const boxW = computeLabelBoxW(r.e.label, r.e.sub);
20229
+ const boxW = computeLabelBoxW(r.e.label, r.e.sub, textMetrics);
20128
20230
  const boxH = labelPillH(r.e.sub);
20129
20231
  const pillAt = (centerX) => ({
20130
20232
  x: centerX - boxW / 2,
@@ -20169,7 +20271,7 @@ function layoutEdges(diag, nodes, lanes = []) {
20169
20271
  if (list.length < 2) continue;
20170
20272
  const boxes = list.map((r) => ({
20171
20273
  cx: r.baseLabelX,
20172
- halfW: computeLabelBoxW(r.e.label, r.e.sub) / 2
20274
+ halfW: computeLabelBoxW(r.e.label, r.e.sub, textMetrics) / 2
20173
20275
  }));
20174
20276
  const overlapsX = (i, j) => Math.abs(boxes[i].cx - boxes[j].cx) < boxes[i].halfW + boxes[j].halfW + CLEARANCE_LABEL_LABEL;
20175
20277
  const componentOf = list.map((_, i) => i);
@@ -20219,7 +20321,7 @@ function layoutEdges(diag, nodes, lanes = []) {
20219
20321
  r,
20220
20322
  baseX: r.baseLabelX,
20221
20323
  baseY: r.baseLabelY,
20222
- w: computeLabelBoxW(r.e.label, r.e.sub),
20324
+ w: computeLabelBoxW(r.e.label, r.e.sub, textMetrics),
20223
20325
  h: labelPillH(r.e.sub)
20224
20326
  }));
20225
20327
  items.sort((a, b) => a.baseX - b.baseX);
@@ -20331,7 +20433,7 @@ function singleStraightSegment(d) {
20331
20433
  if (x1 === x2 && y1 === y2) return null;
20332
20434
  return { x1, y1, x2, y2 };
20333
20435
  }
20334
- function bowSharedStraightPaths(edges, nodes, skipIds) {
20436
+ function bowSharedStraightPaths(edges, nodes, skipIds, textMetrics = "proportional") {
20335
20437
  const groups = /* @__PURE__ */ new Map();
20336
20438
  for (const e of edges) {
20337
20439
  if (skipIds.has(e.id)) continue;
@@ -20367,7 +20469,7 @@ function bowSharedStraightPaths(edges, nodes, skipIds) {
20367
20469
  )
20368
20470
  );
20369
20471
  const groupIds = new Set(group.map((g) => g.e.id));
20370
- const labelRects = edges.filter((x) => hasRenderedLabel(x) && !groupIds.has(x.id)).map((x) => computeLabelBBoxWorld(x));
20472
+ const labelRects = edges.filter((x) => hasRenderedLabel(x) && !groupIds.has(x.id)).map((x) => computeLabelBBoxWorld(x, textMetrics));
20371
20473
  const nodeRects = nodes.map((n) => ({ x: n.cx - n.w / 2, y: n.cy - n.h / 2, w: n.w, h: n.h }));
20372
20474
  const build = (seg, offset) => {
20373
20475
  const cx = midX + nx * offset * 2;
@@ -20410,6 +20512,55 @@ function bowSharedStraightPaths(edges, nodes, skipIds) {
20410
20512
  function nodeRect(n) {
20411
20513
  return { x: n.cx - n.w / 2, y: n.cy - n.h / 2, w: n.w, h: n.h };
20412
20514
  }
20515
+ function countPathObstacleCrossings(d, obstacles) {
20516
+ const segments = flattenPathSegments(extractPathSegments(d));
20517
+ return obstacles.filter((obstacle) => segmentsCrossRect(segments, nodeRect(obstacle))).length;
20518
+ }
20519
+ function makeBackDetourCandidate(A, B, from, to, obstacles, detourY, side) {
20520
+ const lowIsA = A.y >= B.y;
20521
+ const low = lowIsA ? A : B;
20522
+ const lowBendY = low.y - VERTICAL_DETOUR_EXIT;
20523
+ const bandTop = Math.min(detourY, lowBendY);
20524
+ const bandBottom = Math.max(detourY, lowBendY);
20525
+ const bandObstacles = obstacles.map(nodeRect).filter((rect) => rect.y + rect.h >= bandTop && rect.y <= bandBottom);
20526
+ let columnX = detourColumnFor([from, to], side);
20527
+ while (true) {
20528
+ const blockers = bandObstacles.filter(
20529
+ (rect) => rect.x - VERTICAL_DETOUR_GAP < columnX && columnX < rect.x + rect.w + VERTICAL_DETOUR_GAP
20530
+ );
20531
+ if (blockers.length === 0) break;
20532
+ columnX = side === "left" ? Math.min(...blockers.map((rect) => rect.x - VERTICAL_DETOUR_GAP)) : Math.max(...blockers.map((rect) => rect.x + rect.w + VERTICAL_DETOUR_GAP));
20533
+ }
20534
+ const bendAY = lowIsA ? lowBendY : detourY;
20535
+ const bendBY = lowIsA ? detourY : lowBendY;
20536
+ const vertices = [
20537
+ A,
20538
+ { x: A.x, y: bendAY },
20539
+ { x: columnX, y: bendAY },
20540
+ { x: columnX, y: bendBY },
20541
+ { x: B.x, y: bendBY },
20542
+ B
20543
+ ];
20544
+ const d = verticesToPath(vertices);
20545
+ const high = lowIsA ? B : A;
20546
+ return {
20547
+ d,
20548
+ labelX: (high.x + columnX) / 2,
20549
+ crossings: countPathObstacleCrossings(d, obstacles),
20550
+ length: vertices.slice(1).reduce((sum, vertex, index) => {
20551
+ const previous = vertices[index];
20552
+ return sum + Math.hypot(vertex.x - previous.x, vertex.y - previous.y);
20553
+ }, 0)
20554
+ };
20555
+ }
20556
+ function chooseBackDetourCandidate(A, B, from, to, obstacles, detourY) {
20557
+ const left = makeBackDetourCandidate(A, B, from, to, obstacles, detourY, "left");
20558
+ const right = makeBackDetourCandidate(A, B, from, to, obstacles, detourY, "right");
20559
+ if (left.crossings !== right.crossings) return left.crossings < right.crossings ? left : right;
20560
+ if (Math.abs(left.length - right.length) >= 0.5) return left.length < right.length ? left : right;
20561
+ const preferred = Math.abs(A.x - B.x) < 0.5 ? "right" : A.x < B.x ? "left" : "right";
20562
+ return preferred === "left" ? left : right;
20563
+ }
20413
20564
  function rectGap(a, b) {
20414
20565
  const dx = Math.max(0, a.x - (b.x + b.w), b.x - (a.x + a.w));
20415
20566
  const dy = Math.max(0, a.y - (b.y + b.h), b.y - (a.y + a.h));
@@ -20487,8 +20638,8 @@ function sidePoint(n, side) {
20487
20638
  return { x: n.cx + n.w / 2, y: n.cy };
20488
20639
  }
20489
20640
  }
20490
- function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _fromLane, _toLane, edge, labelObstacles = obstacles, fromOffset = { x: 0, y: 0 }, toOffset = { x: 0, y: 0 }, avoidRects = []) {
20491
- const labelBoxW = edge ? computeLabelBoxW(edge.label, edge.sub) : 0;
20641
+ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _fromLane, _toLane, edge, labelObstacles = obstacles, fromOffset = { x: 0, y: 0 }, toOffset = { x: 0, y: 0 }, avoidRects = [], textMetrics = "proportional") {
20642
+ const labelBoxW = edge ? computeLabelBoxW(edge.label, edge.sub, textMetrics) : 0;
20492
20643
  const labelHalfW = labelBoxW / 2;
20493
20644
  const labelInit = labelInitClearance(edge);
20494
20645
  const verticalPair = fromSide === "bottom" && toSide === "top" || fromSide === "top" && toSide === "bottom";
@@ -20860,7 +21011,7 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
20860
21011
  const detourY = Math.min(A.y, B.y) - 100;
20861
21012
  const corner = 14;
20862
21013
  const xDir = B.x > A.x ? 1 : -1;
20863
- return {
21014
+ const existing = {
20864
21015
  d: `M ${A.x} ${A.y}
20865
21016
  L ${A.x} ${detourY + corner}
20866
21017
  Q ${A.x} ${detourY}, ${A.x + xDir * corner} ${detourY}
@@ -20874,6 +21025,16 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
20874
21025
  labelY: detourY - labelInit,
20875
21026
  labelAnchor: "middle"
20876
21027
  };
21028
+ const existingCrossings = countPathObstacleCrossings(existing.d, obstacles);
21029
+ if (existingCrossings === 0) return existing;
21030
+ const candidate = chooseBackDetourCandidate(A, B, from, to, obstacles, detourY);
21031
+ if (candidate.crossings >= existingCrossings) return existing;
21032
+ return {
21033
+ d: candidate.d,
21034
+ labelX: candidate.labelX,
21035
+ labelY: detourY - labelInit,
21036
+ labelAnchor: "middle"
21037
+ };
20877
21038
  }
20878
21039
  const midX = fromSide === "left" || fromSide === "right" ? B.x : A.x;
20879
21040
  const midY = fromSide === "top" || fromSide === "bottom" ? B.y : A.y;
@@ -20887,7 +21048,7 @@ function routePath(from, to, fromSide, toSide, obstacles = [], detourSide, _from
20887
21048
  labelAnchor: "middle"
20888
21049
  };
20889
21050
  }
20890
- function repositionParallelLabels(edges, nodes) {
21051
+ function repositionParallelLabels(edges, nodes, textMetrics = "proportional") {
20891
21052
  const allSegs = new Map(
20892
21053
  edges.map((e) => [e.id, flattenPathSegments(extractPathSegments(e.d))])
20893
21054
  );
@@ -20912,7 +21073,7 @@ function repositionParallelLabels(edges, nodes) {
20912
21073
  for (const pair of byPair.values()) {
20913
21074
  if (pair.length < 2) continue;
20914
21075
  const pairOrder = [...pair].sort(compareSharedPairOrder);
20915
- const boxes = pair.map((e) => computeLabelBBoxWorld(e));
21076
+ const boxes = pair.map((e) => computeLabelBBoxWorld(e, textMetrics));
20916
21077
  const componentOf = pair.map((_, i) => i);
20917
21078
  for (let i = 0; i < pair.length; i++) {
20918
21079
  for (let j = i + 1; j < pair.length; j++) {
@@ -20937,17 +21098,27 @@ function repositionParallelLabels(edges, nodes) {
20937
21098
  nodes,
20938
21099
  allEdges: edges,
20939
21100
  allSegs,
20940
- xRange
21101
+ xRange,
21102
+ textMetrics
20941
21103
  });
20942
21104
  for (let i = 0; i < members.length; i++) members[i].labelY = placed[i];
20943
21105
  }
20944
21106
  }
20945
21107
  }
20946
21108
  function placeAvoidingSiblingPaths(args) {
20947
- const { members, pair, pairOrder, nodes, allEdges, allSegs, xRange } = args;
21109
+ const {
21110
+ members,
21111
+ pair,
21112
+ pairOrder,
21113
+ nodes,
21114
+ allEdges,
21115
+ allSegs,
21116
+ xRange,
21117
+ textMetrics = "proportional"
21118
+ } = args;
20948
21119
  const sizes = members.map((e) => labelPillH(e.sub));
20949
21120
  const wants = members.map((e) => e.labelY);
20950
- const boxes = members.map((e) => computeLabelBBoxWorld(e));
21121
+ const boxes = members.map((e) => computeLabelBBoxWorld(e, textMetrics));
20951
21122
  const all = members.map((_, i) => i);
20952
21123
  const spread = (idx) => spreadWithMinimalShift(
20953
21124
  idx.map((i) => ({ want: wants[i], size: sizes[i] })),
@@ -21138,14 +21309,14 @@ function labelRectAt(cx, cy, w, h) {
21138
21309
  function inflate(r, pad) {
21139
21310
  return { x: r.x - pad, y: r.y - pad, w: r.w + pad * 2, h: r.h + pad * 2 };
21140
21311
  }
21141
- function slideLabelsAlongOwnPath(edges, nodes) {
21312
+ function slideLabelsAlongOwnPath(edges, nodes, textMetrics = "proportional") {
21142
21313
  const withLabel = edges.filter((e) => hasRenderedLabel(e));
21143
21314
  if (withLabel.length === 0) return;
21144
21315
  const segsById = /* @__PURE__ */ new Map();
21145
21316
  for (const e of edges) segsById.set(e.id, flattenPathSegments(extractPathSegments(e.d)));
21146
21317
  const nodeRects = nodes.map(nodeRect);
21147
21318
  for (const e of withLabel) {
21148
- const w = computeLabelBoxW(e.label, e.sub);
21319
+ const w = computeLabelBoxW(e.label, e.sub, textMetrics);
21149
21320
  const h = labelPillH(e.sub);
21150
21321
  if (w === 0 || h === 0) continue;
21151
21322
  const own = segsById.get(e.id) ?? [];
@@ -21447,7 +21618,7 @@ function separateSharedStraightRuns(edges, nodes) {
21447
21618
  e.d = verticesToPath(verts.get(e.id));
21448
21619
  }
21449
21620
  }
21450
- function pullOutgoingFirstCorner(edges, nodes) {
21621
+ function pullOutgoingFirstCorner(edges, nodes, textMetrics = "proportional") {
21451
21622
  if (edges.length < 2) return;
21452
21623
  const \u675F = /* @__PURE__ */ new Map();
21453
21624
  const \u540C\u3058\u7D44\u306E\u6570 = /* @__PURE__ */ new Map();
@@ -21501,10 +21672,10 @@ function pullOutgoingFirstCorner(edges, nodes) {
21501
21672
  }
21502
21673
  e.d = \u524D;
21503
21674
  if (!\u672D\u3092\u65E7\u7D4C\u8DEF\u3078\u8FFD\u5F93\u6E08\u307F) {
21504
- slideLabelsAlongOwnPath(edges, nodes);
21675
+ slideLabelsAlongOwnPath(edges, nodes, textMetrics);
21505
21676
  \u672D\u3092\u65E7\u7D4C\u8DEF\u3078\u8FFD\u5F93\u6E08\u307F = true;
21506
21677
  }
21507
- const labelBox = computeLabelBBoxWorld(e);
21678
+ const labelBox = computeLabelBBoxWorld(e, textMetrics);
21508
21679
  const label = { x: labelBox.x + labelBox.w / 2, y: labelBox.y + labelBox.h / 2 };
21509
21680
  const \u7DDA\u5206\u307E\u3067\u306E\u8DDD\u96E22 = (a, b) => {
21510
21681
  const dx = b.x - a.x;
@@ -21616,13 +21787,13 @@ function fanIncomingEndpoints(edges, nodes) {
21616
21787
  }
21617
21788
  return \u7D42\u70B9\u306E\u79FB\u52D5;
21618
21789
  }
21619
- function followLabelsToFannedTails(edges, obstacles, shifts) {
21790
+ function followLabelsToFannedTails(edges, obstacles, shifts, textMetrics = "proportional") {
21620
21791
  if (shifts.size === 0) return;
21621
21792
  const \u6E2C\u308A\u65B9 = \u7DDA\u306E\u6E2C\u308A\u65B9\u3092\u4F5C\u308B();
21622
21793
  const labels = edges.filter(hasRenderedLabel).map((e) => ({
21623
21794
  kind: "edge-label",
21624
21795
  id: e.id,
21625
- ...computeLabelBBoxWorld(e)
21796
+ ...computeLabelBBoxWorld(e, textMetrics)
21626
21797
  }));
21627
21798
  const labelIndexByEdgeId = new Map(labels.map((label, index) => [label.id, index]));
21628
21799
  const edgeById = new Map(edges.map((e) => [e.id, e]));
@@ -21654,7 +21825,7 @@ function followLabelsToFannedTails(edges, obstacles, shifts) {
21654
21825
  labelY: e.labelY + \u79FB\u52D5.dy,
21655
21826
  labelAnchor: e.labelAnchor
21656
21827
  };
21657
- const \u5019\u88DCa\u306E\u7BB1 = computeLabelBBoxWorld({ ...e, ...\u5019\u88DCa });
21828
+ const \u5019\u88DCa\u306E\u7BB1 = computeLabelBBoxWorld({ ...e, ...\u5019\u88DCa }, textMetrics);
21658
21829
  const \u6700\u5F8C\u306F\u7E26 = Math.abs(\u6700\u5F8C.x2 - \u6700\u5F8C.x1) <= Math.abs(\u6700\u5F8C.y2 - \u6700\u5F8C.y1);
21659
21830
  const \u5019\u88DC = [
21660
21831
  \u5019\u88DCa,
@@ -21665,7 +21836,11 @@ function followLabelsToFannedTails(edges, obstacles, shifts) {
21665
21836
  }
21666
21837
  ];
21667
21838
  for (const c of \u5019\u88DC) {
21668
- const \u672D = { kind: "edge-label", id: e.id, ...computeLabelBBoxWorld({ ...e, ...c }) };
21839
+ const \u672D = {
21840
+ kind: "edge-label",
21841
+ id: e.id,
21842
+ ...computeLabelBBoxWorld({ ...e, ...c }, textMetrics)
21843
+ };
21669
21844
  if (segmentsCrossRect([\u6700\u5F8C], \u672D)) continue;
21670
21845
  if (\u672D\u306E\u79FB\u52D5\u3092\u585E\u3050\u76F8\u624B\u3092\u63A2\u3059(\u5468\u308A, \u5143\u306E\u672D, \u672D) !== null) continue;
21671
21846
  e.labelX = c.labelX;
@@ -21859,7 +22034,7 @@ function expandLanesForNodes(lanes, nodes) {
21859
22034
  };
21860
22035
  });
21861
22036
  }
21862
- function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
22037
+ function expandLaneGapsForEdgeLabels(lanes, nodes, edges, textMetrics = "proportional") {
21863
22038
  if (lanes.length < 2) return lanes;
21864
22039
  const layoutedLanes = lanes.filter((l) => !(l.posX !== void 0 && l.posY !== void 0));
21865
22040
  if (layoutedLanes.length < 2) return lanes;
@@ -21875,7 +22050,7 @@ function expandLaneGapsForEdgeLabels(lanes, nodes, edges) {
21875
22050
  const fi = laneIndexById.get(fromLane);
21876
22051
  const ti = laneIndexById.get(toLane);
21877
22052
  if (fi === void 0 || ti === void 0 || fi === ti) continue;
21878
- const labelBoxW = computeLabelBoxW(edge.label, edge.sub);
22053
+ const labelBoxW = computeLabelBoxW(edge.label, edge.sub, textMetrics);
21879
22054
  if (labelBoxW === 0) continue;
21880
22055
  const lo = Math.min(fi, ti);
21881
22056
  const hi = Math.max(fi, ti);
@@ -21997,7 +22172,7 @@ function \u7DDA\u306E\u7AEF\u306E\u5411\u304D(d, \u7AEF) {
21997
22172
  const \u5019\u88DC = segs.flatMap((s) => [...s.ctrl ?? [], { x: s.x2, y: s.y2 }]);
21998
22173
  return \u5411\u304D\u3092\u53D6\u308B(end, \u5019\u88DC);
21999
22174
  }
22000
- function \u7AEF\u306E\u5B57\u3092\u7F6E\u304F(edge, \u7AEF = "head") {
22175
+ function \u7AEF\u306E\u5B57\u3092\u7F6E\u304F(edge, \u7AEF = "head", textMetrics = "proportional") {
22001
22176
  const text = (\u7AEF === "head" ? edge.headLabel : edge.tailLabel)?.trim();
22002
22177
  if (!text) return null;
22003
22178
  const \u5411\u304D = \u7DDA\u306E\u7AEF\u306E\u5411\u304D(edge.d, \u7AEF);
@@ -22008,7 +22183,8 @@ function \u7AEF\u306E\u5B57\u3092\u7F6E\u304F(edge, \u7AEF = "head") {
22008
22183
  const w = measureTextWidth(text, {
22009
22184
  fontSize: \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055,
22010
22185
  fontWeight: EDGE_LABEL_TEXT.sub.fontWeight,
22011
- fontFamily: "mono"
22186
+ fontFamily: "mono",
22187
+ textMetrics
22012
22188
  });
22013
22189
  const h = \u7BB1\u306E\u9AD8\u3055;
22014
22190
  const \u672D = hasRenderedLabel(edge) && edge.labelX !== void 0 && edge.labelY !== void 0 ? { x: edge.labelX, y: edge.labelY } : null;
@@ -22057,10 +22233,10 @@ function autoStorageHeight(n, defaultH) {
22057
22233
  }
22058
22234
  return Math.max(defaultH, \u5FC5\u8981);
22059
22235
  }
22060
- function autoRowsWidth(n, defaultW) {
22236
+ function autoRowsWidth(n, defaultW, textMetrics = "proportional") {
22061
22237
  if (n.w != null) return n.w;
22062
22238
  if (!n.rows || n.rows.length === 0) return defaultW;
22063
- const required = requiredRowsWidth(n.rows, n.kind);
22239
+ const required = requiredRowsWidth(n.rows, n.kind, textMetrics);
22064
22240
  return Math.max(defaultW, required);
22065
22241
  }
22066
22242
  function \u7BB1\u306E\u9AD8\u30552(n, \u65E2\u5B9Ah) {
@@ -22098,7 +22274,7 @@ function requiredStackGapForEdgeLabels(diag, allStacks) {
22098
22274
  }
22099
22275
  return required;
22100
22276
  }
22101
- function layoutNodes(diag, lanes) {
22277
+ function layoutNodes(diag, lanes, textMetrics) {
22102
22278
  const laneMap = new Map(lanes.map((l) => [l.id, l]));
22103
22279
  const allStacks = Array.from(new Set(diag.nodes.map((n) => n.stack))).sort((a, b) => a - b);
22104
22280
  const rowH = /* @__PURE__ */ new Map();
@@ -22142,7 +22318,7 @@ function layoutNodes(diag, lanes) {
22142
22318
  }
22143
22319
  const size = NODE_SIZE[n.kind];
22144
22320
  if (n.posX !== void 0 && n.posY !== void 0) {
22145
- const w2 = n.posW ?? n.w ?? autoRowsWidth(n, size.w);
22321
+ const w2 = n.posW ?? n.w ?? autoRowsWidth(n, size.w, textMetrics);
22146
22322
  const h2 = n.posH ?? n.h ?? rowH.get(n.stack) ?? size.h;
22147
22323
  out.push({
22148
22324
  ...n,
@@ -22160,7 +22336,7 @@ function layoutNodes(diag, lanes) {
22160
22336
  const \u81EA\u524D\u306E\u9AD8\u3055 = n.rowMarks !== void 0;
22161
22337
  const h = n.h ?? (\u81EA\u524D\u306E\u9AD8\u3055 ? \u7BB1\u306E\u9AD8\u30552(n, size.h) : \u6BB5\u306E\u9AD8\u3055);
22162
22338
  const cy = \u6BB5\u306E\u82AF;
22163
- const w = autoRowsWidth(n, size.w);
22339
+ const w = autoRowsWidth(n, size.w, textMetrics);
22164
22340
  out.push({
22165
22341
  ...n,
22166
22342
  cx,
@@ -22280,10 +22456,16 @@ function applyRowLevelNodeShifts(nodes, lanes, nodeShifts) {
22280
22456
  return moved ? { nodes: outNodes, lanes: outLanes } : null;
22281
22457
  }
22282
22458
  function layout(diag) {
22459
+ const textMetrics = resolveTextMetrics(diag.textMetrics);
22283
22460
  const lanes = layoutLanes(diag);
22284
- const rawNodes = applyFooterShapeDrops(lanes, layoutNodes(diag, lanes));
22461
+ const rawNodes = applyFooterShapeDrops(lanes, layoutNodes(diag, lanes, textMetrics));
22285
22462
  const expandedLanes = expandLanesForNodes(lanes, rawNodes);
22286
- const gapExpandedLanes = expandLaneGapsForEdgeLabels(expandedLanes, rawNodes, diag.edges);
22463
+ const gapExpandedLanes = expandLaneGapsForEdgeLabels(
22464
+ expandedLanes,
22465
+ rawNodes,
22466
+ diag.edges,
22467
+ textMetrics
22468
+ );
22287
22469
  const nodes = rawNodes.map((n) => {
22288
22470
  if (n.posX !== void 0 && n.posY !== void 0) return n;
22289
22471
  const oldLane = lanes.find((l) => l.id === n.lane);
@@ -22292,13 +22474,13 @@ function layout(diag) {
22292
22474
  return { ...n, cx: newLane.x + newLane.width / 2 };
22293
22475
  });
22294
22476
  const containedLanesPre = recomputeContainedLanes(gapExpandedLanes, nodes);
22295
- const edgesPre = layoutEdges(diag, nodes, containedLanesPre);
22296
- const bboxesPre = collectBBoxes(containedLanesPre, nodes, edgesPre);
22477
+ const edgesPre = layoutEdges(diag, nodes, containedLanesPre, textMetrics);
22478
+ const bboxesPre = collectBBoxes(containedLanesPre, nodes, edgesPre, textMetrics);
22297
22479
  const collisionsPre = detectCollisions(bboxesPre, edgesPre);
22298
22480
  const nodesResolved = resolveOverlaps(nodes, collisionsPre);
22299
22481
  const moved = nodesResolved !== nodes;
22300
22482
  const containedLanes = moved ? recomputeContainedLanes(gapExpandedLanes, nodesResolved) : containedLanesPre;
22301
- const edgesAfterMove = moved ? layoutEdges(diag, nodesResolved, containedLanes) : edgesPre;
22483
+ const edgesAfterMove = moved ? layoutEdges(diag, nodesResolved, containedLanes, textMetrics) : edgesPre;
22302
22484
  const chainShiftClearance = Math.max(CLEARANCE_LABEL_LABEL, CLEARANCE_NODE_LABEL);
22303
22485
  let edges;
22304
22486
  let nodesFinal = nodesResolved;
@@ -22309,10 +22491,13 @@ function layout(diag) {
22309
22491
  } else {
22310
22492
  const propagateResult = resolveEdgeLabelOverlapsWithChainAndPropagate(
22311
22493
  edgesAfterMove,
22312
- collectBBoxes(containedLanes, nodesResolved, []).filter(
22494
+ collectBBoxes(containedLanes, nodesResolved, [], textMetrics).filter(
22313
22495
  (b) => b.kind === "node" || b.kind === "lane-label"
22314
22496
  ),
22315
- chainShiftClearance
22497
+ chainShiftClearance,
22498
+ void 0,
22499
+ void 0,
22500
+ textMetrics
22316
22501
  );
22317
22502
  edges = propagateResult.edges;
22318
22503
  if (propagateResult.nodeShifts.size > 0) {
@@ -22324,7 +22509,7 @@ function layout(diag) {
22324
22509
  }
22325
22510
  if (nodesFinal !== nodesResolved) {
22326
22511
  containedLanesFinal = recomputeContainedLanes(laneShiftedBase, nodesFinal);
22327
- edges = layoutEdges(diag, nodesFinal, containedLanesFinal);
22512
+ edges = layoutEdges(diag, nodesFinal, containedLanesFinal, textMetrics);
22328
22513
  }
22329
22514
  }
22330
22515
  const positionedEdgeIds = new Set(
@@ -22332,21 +22517,31 @@ function layout(diag) {
22332
22517
  (e) => e.routing === "curve" || e.routing === "metro" || e.posX1 !== void 0 && e.posY1 !== void 0 && e.posX2 !== void 0 && e.posY2 !== void 0
22333
22518
  ).map((e) => e.id)
22334
22519
  );
22335
- bowSharedStraightPaths(edges, nodesFinal, positionedEdgeIds);
22336
- pullOutgoingFirstCorner(edges, nodesFinal);
22520
+ bowSharedStraightPaths(edges, nodesFinal, positionedEdgeIds, textMetrics);
22521
+ pullOutgoingFirstCorner(edges, nodesFinal, textMetrics);
22337
22522
  const fannedTailShifts = fanIncomingEndpoints(edges, nodesFinal);
22338
22523
  separateSharedStraightRuns(edges, nodesFinal);
22339
22524
  hopEdgeCrossings(edges);
22340
- const labelClearanceObstacles = collectBBoxes(containedLanesFinal, nodesFinal, []).filter(
22525
+ const labelClearanceObstacles = collectBBoxes(
22526
+ containedLanesFinal,
22527
+ nodesFinal,
22528
+ [],
22529
+ textMetrics
22530
+ ).filter(
22341
22531
  (b) => b.kind === "node" || b.kind === "lane-label"
22342
22532
  );
22343
- followLabelsToFannedTails(edges, labelClearanceObstacles, fannedTailShifts);
22344
- repositionParallelLabels(edges, nodesFinal);
22345
- slideLabelsAlongOwnPath(edges, nodesFinal);
22533
+ followLabelsToFannedTails(edges, labelClearanceObstacles, fannedTailShifts, textMetrics);
22534
+ repositionParallelLabels(edges, nodesFinal, textMetrics);
22535
+ slideLabelsAlongOwnPath(edges, nodesFinal, textMetrics);
22346
22536
  if (!isChainEdgeLabelDisabled()) {
22347
- edges = resolveLabelClearanceAfterPathPasses(edges, labelClearanceObstacles);
22537
+ edges = resolveLabelClearanceAfterPathPasses(
22538
+ edges,
22539
+ labelClearanceObstacles,
22540
+ void 0,
22541
+ textMetrics
22542
+ );
22348
22543
  }
22349
- const bboxes = collectBBoxes(containedLanesFinal, nodesFinal, edges);
22544
+ const bboxes = collectBBoxes(containedLanesFinal, nodesFinal, edges, textMetrics);
22350
22545
  const collisions = detectCollisions(bboxes, edges);
22351
22546
  const nearCollisions = detectNearCollisions(bboxes, edges);
22352
22547
  if (collisions.length > 0) {
@@ -22386,6 +22581,8 @@ function layout(diag) {
22386
22581
  // 描画側の固定の字の言語 (#847)。 既定 (`en`) と型の外の値は持たせない = 配置の結果の形を
22387
22582
  // 変更前と揃え、記法の書き損じで一部の字だけ日本語になる形を作らない
22388
22583
  ...resolveLang(diag.lang) === "ja" ? { lang: "ja" } : {},
22584
+ // 既定は持ち越さない。既存の LaidDiagram の形を変えず、等幅の図だけ描画へ伝える
22585
+ ...textMetrics === "monospace" ? { textMetrics: "monospace" } : {},
22389
22586
  // 種類も配色と同じく空の目印を出さない。 遮断をここに揃えると手書きの図にも効く
22390
22587
  ...diag.type ? { type: diag.type } : {},
22391
22588
  bboxes,
@@ -24511,6 +24708,7 @@ function CdlEdgeView({
24511
24708
  "data-cdl-edge-label": edge.label,
24512
24709
  "data-cdl-edge-sub": edge.sub ?? "",
24513
24710
  "data-cdl-tone": edge.tone,
24711
+ "data-cdl-edge-role": edge.role,
24514
24712
  children: [
24515
24713
  isDotted ? /* @__PURE__ */ jsxs("g", { children: [
24516
24714
  /* @__PURE__ */ jsx("path", { id: glowPathId, d: glowPathD, fill: "none", stroke: "none" }),
@@ -24662,11 +24860,12 @@ function CdlEdgeGlowView({
24662
24860
  }
24663
24861
  function CdlEdgeLabelView({
24664
24862
  edge,
24665
- active
24863
+ active,
24864
+ textMetrics = "proportional"
24666
24865
  }) {
24667
24866
  if (!hasRenderedLabel(edge)) return null;
24668
24867
  const color = edgeColor(edge);
24669
- const bbox = computeLabelBBoxWorld(edge);
24868
+ const bbox = computeLabelBBoxWorld(edge, textMetrics);
24670
24869
  const boxW = bbox.w;
24671
24870
  const boxH = bbox.h;
24672
24871
  const boxLeftX = bbox.x - edge.labelX;
@@ -24682,6 +24881,8 @@ function CdlEdgeLabelView({
24682
24881
  "data-cdl-edge-label-for": edge.id,
24683
24882
  "data-cdl-edge-label-text": edge.label,
24684
24883
  "data-cdl-edge-sub-text": edge.sub ?? "",
24884
+ "data-cdl-tone": edge.tone,
24885
+ "data-cdl-edge-role": edge.role,
24685
24886
  children: [
24686
24887
  edge.labelPlate !== false && /* @__PURE__ */ jsx(
24687
24888
  "rect",
@@ -24735,9 +24936,10 @@ function CdlEdgeLabelView({
24735
24936
  function CdlEdgeEndLabelView({
24736
24937
  edge,
24737
24938
  active,
24738
- \u7AEF
24939
+ \u7AEF,
24940
+ textMetrics = "proportional"
24739
24941
  }) {
24740
- const \u7F6E\u304D\u5834\u6240 = \u7AEF\u306E\u5B57\u3092\u7F6E\u304F(edge, \u7AEF);
24942
+ const \u7F6E\u304D\u5834\u6240 = \u7AEF\u306E\u5B57\u3092\u7F6E\u304F(edge, \u7AEF, textMetrics);
24741
24943
  if (!\u7F6E\u304D\u5834\u6240) return null;
24742
24944
  const color = edgeColor(edge);
24743
24945
  return /* @__PURE__ */ jsx(
@@ -24746,6 +24948,8 @@ function CdlEdgeEndLabelView({
24746
24948
  "data-cdl-role": "edge-end-label",
24747
24949
  "data-cdl-edge-end-label-for": edge.id,
24748
24950
  "data-cdl-edge-end": \u7AEF,
24951
+ "data-cdl-tone": edge.tone,
24952
+ "data-cdl-edge-role": edge.role,
24749
24953
  x: \u7F6E\u304D\u5834\u6240.x,
24750
24954
  y: \u7F6E\u304D\u5834\u6240.y,
24751
24955
  fontSize: \u7AEF\u306E\u5B57\u306E\u5927\u304D\u3055,
@@ -24993,12 +25197,18 @@ var g4 = (v) => Math.round(v / 4) * 4;
24993
25197
  function sequenceStepId() {
24994
25198
  return "seq_step";
24995
25199
  }
24996
- function sequenceBoardMetrics(data) {
25200
+ function sequenceBoardMetrics(data, textMetrics = "proportional") {
24997
25201
  const \u540D\u5E45 = data.actors.map(
24998
- (a) => Math.max(textWidth(a.name, SEQ_NAME), a.subtitle ? textWidth(a.subtitle, SEQ_SUB) : 0)
25202
+ (a) => Math.max(
25203
+ textWidth(a.name, SEQ_NAME, 0, textMetrics),
25204
+ a.subtitle ? textWidth(a.subtitle, SEQ_SUB, 0, textMetrics) : 0
25205
+ )
24999
25206
  );
25000
25207
  const colW = g4(Math.max(SEQ_COL_MIN, Math.max(0, ...\u540D\u5E45) + SEQ_COL_PAD));
25001
- const \u8A9E\u5E45 = Math.max(0, ...data.messages.map((m) => textWidth(m.label, SEQ_LABEL)));
25208
+ const \u8A9E\u5E45 = Math.max(
25209
+ 0,
25210
+ ...data.messages.map((m) => textWidth(m.label, SEQ_LABEL, 0, textMetrics))
25211
+ );
25002
25212
  const gutter = g4(SEQ_EDGE + SEQ_GUTTER_PAD + \u8A9E\u5E45 + SEQ_GUTTER_GAP);
25003
25213
  const headY = SEQ_EDGE + SEQ_HEAD;
25004
25214
  const rowY = (i) => headY + SEQ_ROW_PAD + i * SEQ_ROW;
@@ -25011,11 +25221,12 @@ function sequenceBoardMetrics(data) {
25011
25221
  }
25012
25222
  function SequenceBoardNode({
25013
25223
  node,
25014
- stateValues
25224
+ stateValues,
25225
+ textMetrics = "proportional"
25015
25226
  }) {
25016
25227
  const data = node.sequenceData;
25017
25228
  if (!data) return /* @__PURE__ */ jsx("g", { "data-cdl-role": "sequence-board" });
25018
- const m = sequenceBoardMetrics(data);
25229
+ const m = sequenceBoardMetrics(data, textMetrics);
25019
25230
  const x = node.cx - node.w / 2;
25020
25231
  const y = node.cy - node.h / 2;
25021
25232
  const \u73FE\u5728 = (() => {
@@ -25666,7 +25877,8 @@ function GenericNode({
25666
25877
  active,
25667
25878
  value,
25668
25879
  stateValues,
25669
- \u5024\u306E\u540D\u524D
25880
+ \u5024\u306E\u540D\u524D,
25881
+ textMetrics = "proportional"
25670
25882
  }) {
25671
25883
  const base = STYLES[node.kind] ?? FALLBACK;
25672
25884
  const toned = toneColor3(node.tone);
@@ -25805,7 +26017,7 @@ function GenericNode({
25805
26017
  const resolved = node.rows.map((row) => interpolate(row, stateValues, \u5024\u306E\u540D\u524D));
25806
26018
  const splits = resolved.map(splitRow);
25807
26019
  const leftMaxWidth = splits.reduce(
25808
- (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false)),
26020
+ (m, s) => Math.max(m, rowColumnWidth(s.left, GENERIC_ROW_LEFT_SIZE_PX, false, textMetrics)),
25809
26021
  0
25810
26022
  );
25811
26023
  const rightColX = ROW_PAD_X_PX + leftMaxWidth + ROW_COL_GAP_PX;
@@ -26289,8 +26501,8 @@ function \u5024\u3068\u5272\u5408\u306E\u6587\u5B57(\u5024, \u5272\u5408, \u5408
26289
26501
  return \u7D44.\u5024 === null ? \u7D44.\u5272\u5408 : `${\u7D44.\u5024} ${\u7D44.\u5272\u5408}`;
26290
26502
  }
26291
26503
  var \u7A74\u306B\u5BFE\u3059\u308B\u4E0A\u9650 = 0.8;
26292
- function \u4E2D\u592E\u306E\u5B57(\u6BD4\u4F8B\u3057\u305F\u5927\u304D\u3055, \u7A74\u306E\u534A\u5F84, \u6587) {
26293
- const \u5165\u308B\u5927\u304D\u3055 = \u7A74\u306E\u534A\u5F84 * 2 * \u7A74\u306B\u5BFE\u3059\u308B\u4E0A\u9650 / Math.max(textWidth(\u6587, 1), 1e-6);
26504
+ function \u4E2D\u592E\u306E\u5B57(\u6BD4\u4F8B\u3057\u305F\u5927\u304D\u3055, \u7A74\u306E\u534A\u5F84, \u6587, textMetrics = "proportional") {
26505
+ const \u5165\u308B\u5927\u304D\u3055 = \u7A74\u306E\u534A\u5F84 * 2 * \u7A74\u306B\u5BFE\u3059\u308B\u4E0A\u9650 / Math.max(textWidth(\u6587, 1, 0, textMetrics), 1e-6);
26294
26506
  return Math.min(Math.max(\u6BD4\u4F8B\u3057\u305F\u5927\u304D\u3055, \u7E2E\u3093\u3060\u7D75\u306E\u5B57\u306E\u4E0B\u9650), \u5165\u308B\u5927\u304D\u3055);
26295
26507
  }
26296
26508
  function ChartPieNode({
@@ -26298,7 +26510,8 @@ function ChartPieNode({
26298
26510
  active,
26299
26511
  stateValues = {},
26300
26512
  drawing = false,
26301
- progress = 1
26513
+ progress = 1,
26514
+ textMetrics = "proportional"
26302
26515
  }) {
26303
26516
  const instanceId = useId().replace(/[^A-Za-z0-9_-]/g, "");
26304
26517
  const x0 = node.cx - node.w / 2;
@@ -26329,15 +26542,26 @@ function ChartPieNode({
26329
26542
  return `${\u5B9F\u5024\u8868\u8A18(d.value)}%` === \u5272\u5408\u306E\u6587\u5B57[i] ? \u540D : `${\u540D} ${\u5B9F\u5024\u8868\u8A18(d.value)}`;
26330
26543
  });
26331
26544
  if (\u5F62 !== "ring") {
26332
- const \u5171\u901A = { node, active, data, \u5272\u5408: \u4ECA\u306E\u5272\u5408, x0, y0, drawing, progress, instanceId };
26545
+ const \u5171\u901A = {
26546
+ node,
26547
+ active,
26548
+ data,
26549
+ \u5272\u5408: \u4ECA\u306E\u5272\u5408,
26550
+ x0,
26551
+ y0,
26552
+ drawing,
26553
+ progress,
26554
+ instanceId,
26555
+ textMetrics
26556
+ };
26333
26557
  return \u5F62 === "arcs" ? \u5F27\u306E\u5F62(\u5171\u901A) : \u8868\u306E\u5F62(\u5171\u901A);
26334
26558
  }
26335
26559
  const \u540D\u672D\u5E45 = Math.max(
26336
26560
  0,
26337
26561
  ...data.map(
26338
26562
  (_d, i) => Math.max(
26339
- textWidth(\u5272\u5408\u306E\u6587\u5B57[i] ?? "", \u5272\u5408\u306E\u7D1A),
26340
- textWidth(\u540D\u524D\u306E\u6587\u5B57[i] ?? "", \u540D\u524D\u306E\u7D1A)
26563
+ textWidth(\u5272\u5408\u306E\u6587\u5B57[i] ?? "", \u5272\u5408\u306E\u7D1A, 0, textMetrics),
26564
+ textWidth(\u540D\u524D\u306E\u6587\u5B57[i] ?? "", \u540D\u524D\u306E\u7D1A, 0, textMetrics)
26341
26565
  )
26342
26566
  )
26343
26567
  );
@@ -26352,8 +26576,8 @@ function ChartPieNode({
26352
26576
  const \u524D\u306Eslices = \u524D\u3042\u308A ? \u8F2A\u3092\u7D44\u3080(data, cx, cy, \u524D\u306E\u5916\u534A\u5F84, \u524D\u306E\u5185\u534A\u5F84, \u524D\u306E\u5272\u5408) : [];
26353
26577
  const \u7A74 = \u524D\u3042\u308A ? \u524D\u306E\u5185\u534A\u5F84 : \u5916\u306E\u5185\u534A\u5F84;
26354
26578
  const \u5408\u8A08\u306E\u6587 = \u5B9F\u5024\u8868\u8A18(Math.round(\u524D\u3042\u308A ? \u4ECA\u306E\u5408\u8A08 : total));
26355
- const \u5408\u8A08\u306E\u5B57 = \u4E2D\u592E\u306E\u5B57(Math.round(radius * 0.26), \u7A74, \u5408\u8A08\u306E\u6587);
26356
- const \u898B\u51FA\u3057\u306E\u5B572 = \u4E2D\u592E\u306E\u5B57(Math.round(radius * 0.12), \u7A74, "\u5408\u8A08");
26579
+ const \u5408\u8A08\u306E\u5B57 = \u4E2D\u592E\u306E\u5B57(Math.round(radius * 0.26), \u7A74, \u5408\u8A08\u306E\u6587, textMetrics);
26580
+ const \u898B\u51FA\u3057\u306E\u5B572 = \u4E2D\u592E\u306E\u5B57(Math.round(radius * 0.12), \u7A74, "\u5408\u8A08", textMetrics);
26357
26581
  const \u5408\u8A08\u306E\u4E0B = Math.max(Math.round(radius * 0.2), \u5408\u8A08\u306E\u5B57 * 0.25 + \u898B\u51FA\u3057\u306E\u5B572 * 0.8);
26358
26582
  const slices = \u8F2A\u3092\u7D44\u3080(data, cx, cy, radius, \u5916\u306E\u5185\u534A\u5F84, \u4ECA\u306E\u5272\u5408);
26359
26583
  const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
@@ -26536,14 +26760,24 @@ function \u67A0(node, active) {
26536
26760
  }
26537
26761
  );
26538
26762
  }
26539
- function \u5F27\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress }) {
26763
+ function \u5F27\u306E\u5F62({
26764
+ node,
26765
+ active,
26766
+ data,
26767
+ \u5272\u5408,
26768
+ x0,
26769
+ y0,
26770
+ drawing,
26771
+ progress,
26772
+ textMetrics
26773
+ }) {
26540
26774
  const PAD = 20;
26541
26775
  const \u540D\u524D\u306E\u7D1A = 14;
26542
26776
  const \u5272\u5408\u306E\u7D1A = 24;
26543
26777
  const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
26544
26778
  const \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 = 24;
26545
26779
  const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
26546
- const \u4E00\u89A7\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A))) + \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 + Math.max(0, ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A)));
26780
+ const \u4E00\u89A7\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A, 0, textMetrics))) + \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 + Math.max(0, ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A, 0, textMetrics)));
26547
26781
  const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
26548
26782
  const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u4E00\u89A7\u5E45 - 28) / 2;
26549
26783
  const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
@@ -26629,7 +26863,18 @@ function \u5F27\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing,
26629
26863
  })
26630
26864
  ] });
26631
26865
  }
26632
- function \u8868\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress, instanceId }) {
26866
+ function \u8868\u306E\u5F62({
26867
+ node,
26868
+ active,
26869
+ data,
26870
+ \u5272\u5408,
26871
+ x0,
26872
+ y0,
26873
+ drawing,
26874
+ progress,
26875
+ instanceId,
26876
+ textMetrics
26877
+ }) {
26633
26878
  const PAD = 20;
26634
26879
  const \u898B\u51FA\u3057\u306E\u7D1A = 11;
26635
26880
  const \u540D\u524D\u306E\u7D1A = 15;
@@ -26638,9 +26883,18 @@ function \u8868\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing,
26638
26883
  const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
26639
26884
  const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
26640
26885
  const \u5B9F\u6570\u306E\u6587\u5B57 = data.map((d) => \u5B9F\u5024\u8868\u8A18(d.value));
26641
- const \u540D\u524D\u5E45 = Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A)));
26642
- const \u5272\u5408\u5E45 = Math.max(textWidth("\u5272\u5408", \u898B\u51FA\u3057\u306E\u7D1A), ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A)));
26643
- const \u5B9F\u6570\u5E45 = Math.max(textWidth("\u5024", \u898B\u51FA\u3057\u306E\u7D1A), ...\u5B9F\u6570\u306E\u6587\u5B57.map((t) => textWidth(t, \u5B9F\u6570\u306E\u7D1A)));
26886
+ const \u540D\u524D\u5E45 = Math.max(
26887
+ 0,
26888
+ ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A, 0, textMetrics))
26889
+ );
26890
+ const \u5272\u5408\u5E45 = Math.max(
26891
+ textWidth("\u5272\u5408", \u898B\u51FA\u3057\u306E\u7D1A, 0, textMetrics),
26892
+ ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A, 0, textMetrics))
26893
+ );
26894
+ const \u5B9F\u6570\u5E45 = Math.max(
26895
+ textWidth("\u5024", \u898B\u51FA\u3057\u306E\u7D1A, 0, textMetrics),
26896
+ ...\u5B9F\u6570\u306E\u6587\u5B57.map((t) => textWidth(t, \u5B9F\u6570\u306E\u7D1A, 0, textMetrics))
26897
+ );
26644
26898
  const \u8868\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + \u540D\u524D\u5E45 + 28 + \u5272\u5408\u5E45 + 24 + \u5B9F\u6570\u5E45;
26645
26899
  const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
26646
26900
  const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u8868\u5E45 - 28) / 2;
@@ -26649,8 +26903,8 @@ function \u8868\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing,
26649
26903
  const cx = PAD + R;
26650
26904
  const cy = node.h / 2;
26651
26905
  const \u5408\u8A08\u306E\u6587 = \u5B9F\u5024\u8868\u8A18(Math.round(data.reduce((acc, d) => acc + d.value, 0)));
26652
- const \u5408\u8A08\u306E\u5B57 = \u4E2D\u592E\u306E\u5B57(Math.round(R * 0.26), \u5185\u534A\u5F84, \u5408\u8A08\u306E\u6587);
26653
- const \u898B\u51FA\u3057\u306E\u5B572 = \u4E2D\u592E\u306E\u5B57(Math.round(R * 0.12), \u5185\u534A\u5F84, "\u5408\u8A08");
26906
+ const \u5408\u8A08\u306E\u5B57 = \u4E2D\u592E\u306E\u5B57(Math.round(R * 0.26), \u5185\u534A\u5F84, \u5408\u8A08\u306E\u6587, textMetrics);
26907
+ const \u898B\u51FA\u3057\u306E\u5B572 = \u4E2D\u592E\u306E\u5B57(Math.round(R * 0.12), \u5185\u534A\u5F84, "\u5408\u8A08", textMetrics);
26654
26908
  const \u5408\u8A08\u306E\u4E0B = Math.max(Math.round(R * 0.2), \u5408\u8A08\u306E\u5B57 * 0.25 + \u898B\u51FA\u3057\u306E\u5B572 * 0.8);
26655
26909
  const \u8868\u5DE6 = node.w - PAD - \u8868\u5E45;
26656
26910
  const \u53F3\u7AEF = node.w - PAD;
@@ -26781,7 +27035,8 @@ function ChartGaugeNode({
26781
27035
  active,
26782
27036
  stateValues = {},
26783
27037
  drawing = false,
26784
- progress = 1
27038
+ progress = 1,
27039
+ textMetrics = "proportional"
26785
27040
  }) {
26786
27041
  const x0 = node.cx - node.w / 2;
26787
27042
  const y0 = node.cy - node.h / 2;
@@ -26800,7 +27055,10 @@ function ChartGaugeNode({
26800
27055
  const \u533A\u753B\u306E\u9593 = 12;
26801
27056
  const \u6570\u5024\u306E\u884C = (d) => \u5024\u3068\u5272\u5408\u306E\u6587\u5B57(\u5B9F\u5024\u8868\u8A18(d.value), \u5272\u5408\u8868\u8A18(d.value / total), total);
26802
27057
  const \u5272\u308A\u4ED8\u3051\u308B = (\u4EF6\u305F\u3061) => {
26803
- const \u5E45 = Math.max(\u5370\u306E\u5E452, ...\u4EF6\u305F\u3061.map((d) => textWidth(\u6570\u5024\u306E\u884C(d), \u6570\u5024\u306E\u7D1A))) + \u533A\u753B\u306E\u9593;
27058
+ const \u5E45 = Math.max(
27059
+ \u5370\u306E\u5E452,
27060
+ ...\u4EF6\u305F\u3061.map((d) => textWidth(\u6570\u5024\u306E\u884C(d), \u6570\u5024\u306E\u7D1A, 0, textMetrics))
27061
+ ) + \u533A\u753B\u306E\u9593;
26804
27062
  const \u884C\u306E\u4EF6\u65702 = Math.min(
26805
27063
  Math.max(1, Math.floor(\u4F7F\u3048\u308B\u5E452 / Math.max(\u5E45, 1))),
26806
27064
  Math.max(\u4EF6\u305F\u3061.length, 1)
@@ -26875,7 +27133,7 @@ function ChartGaugeNode({
26875
27133
  return { d, frac, path: \u6247\u306E\u9053(a0, a1, \u524D\u306E\u5185\u534A\u5F84, \u524D\u306E\u5916\u534A\u5F84) };
26876
27134
  });
26877
27135
  const \u5408\u8A08\u306E\u6587\u5B57 = \u5B9F\u5024\u8868\u8A18(Math.round(total));
26878
- const \u5358\u4F4D\u5E45 = Math.max(textWidth(\u5408\u8A08\u306E\u6587\u5B57, 100), 1) / 100;
27136
+ const \u5358\u4F4D\u5E45 = Math.max(textWidth(\u5408\u8A08\u306E\u6587\u5B57, 100, 0, textMetrics), 1) / 100;
26879
27137
  const \u7D1A\u306E\u5019\u88DC = Math.min(
26880
27138
  // 横 = 字の上の角が内側の円に入る大きさ
26881
27139
  \u5185\u534A\u5F84 / Math.sqrt((\u5358\u4F4D\u5E45 / 2) ** 2 + 1.25 ** 2),
@@ -26968,7 +27226,7 @@ function ChartGaugeNode({
26968
27226
  const y = \u5185\u8A33\u306Ey + \u6BB5\u306E\u9AD8\u3055 * \u6BB5;
26969
27227
  const \u53CE\u307E\u308B\u5E45 = \u5185\u8A33\u306E\u5E45 - \u533A\u753B\u306E\u9593;
26970
27228
  const \u6570\u306E\u884C = \u5185\u8A33\u306E\u6570\u5024[idx] ?? "";
26971
- const \u5207\u3063\u305F\u6570\u306E\u884C = \u5207\u308A\u8A70\u3081\u308B(\u6570\u306E\u884C, \u53CE\u307E\u308B\u5E45, \u6570\u5024\u306E\u7D1A);
27229
+ const \u5207\u3063\u305F\u6570\u306E\u884C = \u5207\u308A\u8A70\u3081\u308B(\u6570\u306E\u884C, \u53CE\u307E\u308B\u5E45, \u6570\u5024\u306E\u7D1A, textMetrics);
26972
27230
  return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-gauge-item", children: [
26973
27231
  /* @__PURE__ */ jsx(
26974
27232
  "rect",
@@ -26989,7 +27247,7 @@ function ChartGaugeNode({
26989
27247
  fontSize: \u540D\u524D\u306E\u7D1A,
26990
27248
  fontWeight: 700,
26991
27249
  fill: "var(--cdl-text, #1a1f2a)",
26992
- children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u53CE\u307E\u308B\u5E45, \u540D\u524D\u306E\u7D1A)
27250
+ children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u53CE\u307E\u308B\u5E45, \u540D\u524D\u306E\u7D1A, textMetrics)
26993
27251
  }
26994
27252
  ),
26995
27253
  /* @__PURE__ */ jsx("text", { x, y: y + 46, fontSize: \u6570\u5024\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u5207\u3063\u305F\u6570\u306E\u884C === \u6570\u306E\u884C ? /* @__PURE__ */ jsx(
@@ -27007,12 +27265,12 @@ function ChartGaugeNode({
27007
27265
  function \u6975(cx, cy, r, a) {
27008
27266
  return { x: cx + r * Math.cos(a), y: cy + r * Math.sin(a) };
27009
27267
  }
27010
- function \u5207\u308A\u8A70\u3081\u308B(s, \u4E0A\u9650, \u7D1A) {
27011
- if (\u4E0A\u9650 <= 0 || textWidth(s, \u7D1A) <= \u4E0A\u9650) return s;
27012
- const \u8A18\u53F7\u5E45 = textWidth("\u2026", \u7D1A);
27268
+ function \u5207\u308A\u8A70\u3081\u308B(s, \u4E0A\u9650, \u7D1A, textMetrics = "proportional") {
27269
+ if (\u4E0A\u9650 <= 0 || textWidth(s, \u7D1A, 0, textMetrics) <= \u4E0A\u9650) return s;
27270
+ const \u8A18\u53F7\u5E45 = textWidth("\u2026", \u7D1A, 0, textMetrics);
27013
27271
  let out = "";
27014
27272
  for (const c of s) {
27015
- if (textWidth(out + c, \u7D1A) + \u8A18\u53F7\u5E45 > \u4E0A\u9650) break;
27273
+ if (textWidth(out + c, \u7D1A, 0, textMetrics) + \u8A18\u53F7\u5E45 > \u4E0A\u9650) break;
27016
27274
  out += c;
27017
27275
  }
27018
27276
  return `${out}\u2026`;
@@ -27026,7 +27284,8 @@ function ChartRadialNode({
27026
27284
  active,
27027
27285
  stateValues = {},
27028
27286
  drawing = false,
27029
- progress = 1
27287
+ progress = 1,
27288
+ textMetrics = "proportional"
27030
27289
  }) {
27031
27290
  const x0 = node.cx - node.w / 2;
27032
27291
  const y0 = node.cy - node.h / 2;
@@ -27044,7 +27303,10 @@ function ChartRadialNode({
27044
27303
  const \u4E00\u89A7\u306E\u5E45 = \u5370\u306E\u5E45 + Math.max(
27045
27304
  0,
27046
27305
  ...data.map(
27047
- (d, i) => Math.max(textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A), textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A))
27306
+ (d, i) => Math.max(
27307
+ textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A, 0, textMetrics),
27308
+ textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A, 0, textMetrics)
27309
+ )
27048
27310
  )
27049
27311
  );
27050
27312
  const \u5F27\u306B\u4F7F\u3048\u308B\u5E45 = node.w - PAD * 2 - \u4E00\u89A7\u306E\u5E45 - \u4E00\u89A7\u3068\u5F27\u306E\u9593;
@@ -27191,7 +27453,8 @@ function arcColor2(tone, idx) {
27191
27453
  function ChartStatNode({
27192
27454
  node,
27193
27455
  active,
27194
- stateValues = {}
27456
+ stateValues = {},
27457
+ textMetrics = "proportional"
27195
27458
  }) {
27196
27459
  const x0 = node.cx - node.w / 2;
27197
27460
  const y0 = node.cy - node.h / 2;
@@ -27220,7 +27483,13 @@ function ChartStatNode({
27220
27483
  const frac = total > 0 ? d.value / total : 0;
27221
27484
  const \u8272 = \u5370\u306E\u8272(d.tone, idx);
27222
27485
  const \u6570\u5024 = \u5B9F\u5024\u8868\u8A18(d.value);
27223
- const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(\u6570\u5024, \u67A02.w - \u533A\u753B.\u4F59\u767D * 2, \u533A\u753B.\u6570\u5024\u306E\u7D1A, \u533A\u753B.\u540D\u524D\u306E\u7D1A + 1);
27486
+ const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(
27487
+ \u6570\u5024,
27488
+ \u67A02.w - \u533A\u753B.\u4F59\u767D * 2,
27489
+ \u533A\u753B.\u6570\u5024\u306E\u7D1A,
27490
+ \u533A\u753B.\u540D\u524D\u306E\u7D1A + 1,
27491
+ textMetrics
27492
+ );
27224
27493
  return /* @__PURE__ */ jsxs(
27225
27494
  "g",
27226
27495
  {
@@ -27277,7 +27546,8 @@ function ChartStatNode({
27277
27546
  `\u524D ${\u5B9F\u5024\u8868\u8A18(d.previous)}`,
27278
27547
  \u67A02.w - \u533A\u753B.\u4F59\u767D * 2,
27279
27548
  \u533A\u753B.\u524D\u306E\u7D1A,
27280
- 8
27549
+ 8,
27550
+ textMetrics
27281
27551
  ),
27282
27552
  textAnchor: "middle",
27283
27553
  fill: "var(--cdl-text-dim, #5a6270)",
@@ -27366,9 +27636,9 @@ function \u533A\u753B\u306E\u5272\u4ED8(w, h, \u4EF6\u6570, \u524D\u3092\u51FA\u
27366
27636
  \u67A0: (idx) => ({ x: \u5E45 * idx, y: 0, w: \u5E45, h })
27367
27637
  };
27368
27638
  }
27369
- function \u53CE\u3081\u308B\u7D1A(\u5B572, \u4F7F\u3048\u308B\u5E452, \u521D\u671F, \u4E0B\u9650) {
27639
+ function \u53CE\u3081\u308B\u7D1A(\u5B572, \u4F7F\u3048\u308B\u5E452, \u521D\u671F, \u4E0B\u9650, textMetrics = "proportional") {
27370
27640
  let \u7D1A = \u521D\u671F;
27371
- while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B572, \u7D1A) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
27641
+ while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B572, \u7D1A, 0, textMetrics) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
27372
27642
  return \u7D1A;
27373
27643
  }
27374
27644
  function \u5F27\u306E\u90533(cx, cy, r, \u5272\u5408) {
@@ -27403,7 +27673,8 @@ function ChartWaffleNode({
27403
27673
  active,
27404
27674
  stateValues = {},
27405
27675
  drawing = false,
27406
- progress = 1
27676
+ progress = 1,
27677
+ textMetrics = "proportional"
27407
27678
  }) {
27408
27679
  const x0 = node.cx - node.w / 2;
27409
27680
  const y0 = node.cy - node.h / 2;
@@ -27422,7 +27693,10 @@ function ChartWaffleNode({
27422
27693
  const \u4E00\u89A7\u306E\u5E45 = \u5370\u306E\u5E452 + Math.max(
27423
27694
  0,
27424
27695
  ...data.map(
27425
- (d, i) => Math.max(textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A), textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A))
27696
+ (d, i) => Math.max(
27697
+ textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A, 0, textMetrics),
27698
+ textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A, 0, textMetrics)
27699
+ )
27426
27700
  )
27427
27701
  );
27428
27702
  const \u4F7F\u3048\u308B\u9AD8\u3055 = node.h - PAD * 2;
@@ -27524,7 +27798,8 @@ function ChartStackedBarNode({
27524
27798
  active,
27525
27799
  stateValues = {},
27526
27800
  drawing = false,
27527
- progress = 1
27801
+ progress = 1,
27802
+ textMetrics = "proportional"
27528
27803
  }) {
27529
27804
  const x0 = node.cx - node.w / 2;
27530
27805
  const y0 = node.cy - node.h / 2;
@@ -27534,7 +27809,7 @@ function ChartStackedBarNode({
27534
27809
  const \u540D\u524D\u306E\u7D1A = 13;
27535
27810
  const \u533A\u753B\u306E\u7D1A = 12;
27536
27811
  const \u6642\u70B9\u306E\u7D1A = 13;
27537
- const \u6642\u70B9\u306E\u5E45 = Math.max(0, ...\u5E2F\u305F\u3061.map((b) => textWidth(b.\u540D\u524D, \u6642\u70B9\u306E\u7D1A))) + (\u5E2F\u305F\u3061.length > 1 ? 16 : 0);
27812
+ const \u6642\u70B9\u306E\u5E45 = Math.max(0, ...\u5E2F\u305F\u3061.map((b) => textWidth(b.\u540D\u524D, \u6642\u70B9\u306E\u7D1A, 0, textMetrics))) + (\u5E2F\u305F\u3061.length > 1 ? 16 : 0);
27538
27813
  const \u5E2F\u306E\u5DE6 = PAD + \u6642\u70B9\u306E\u5E45;
27539
27814
  const \u5E2F\u306E\u5E45 = Math.max(40, node.w - \u5E2F\u306E\u5DE6 - PAD);
27540
27815
  const \u5E2F\u306E\u9AD8\u3055 = 44;
@@ -27627,7 +27902,7 @@ function ChartStackedBarNode({
27627
27902
  })()
27628
27903
  ] }, `bar-${\u6BB5}`);
27629
27904
  }),
27630
- \u4E00\u89A7\u306E\u4E26\u3073(data, \u5E2F\u306E\u5DE6, node.w - PAD, \u540D\u524D\u306E\u7D1A).map(({ d, idx, x, \u884C }) => {
27905
+ \u4E00\u89A7\u306E\u4E26\u3073(data, \u5E2F\u306E\u5DE6, node.w - PAD, \u540D\u524D\u306E\u7D1A, textMetrics).map(({ d, idx, x, \u884C }) => {
27631
27906
  const y = \u4E0A\u7AEF + \u5E2F\u305F\u3061.length * (\u5E2F\u306E\u9AD8\u3055 + \u5E2F\u306E\u9593) - \u5E2F\u306E\u9593 + 16 + \u4E00\u89A7\u306E\u9AD8\u3055 / 2 + \u884C * \u4E00\u89A7\u306E\u9AD8\u3055;
27632
27907
  return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stacked-bar-legend", children: [
27633
27908
  /* @__PURE__ */ jsx("rect", { x, y: y - 5, width: 10, height: 10, rx: 2, fill: \u5370\u306E\u82723(d.tone, idx) }),
@@ -27662,12 +27937,12 @@ function \u5370\u306E\u82723(tone, idx) {
27662
27937
  }
27663
27938
  var \u5370\u304B\u3089\u540D\u524D\u307E\u3067 = 16;
27664
27939
  var \u4EF6\u306E\u9593 = 10;
27665
- function \u4E00\u89A7\u306E\u4E26\u3073(data, \u5DE6, \u53F3\u7AEF, \u7D1A) {
27940
+ function \u4E00\u89A7\u306E\u4E26\u3073(data, \u5DE6, \u53F3\u7AEF, \u7D1A, textMetrics = "proportional") {
27666
27941
  const out = [];
27667
27942
  let x = \u5DE6;
27668
27943
  let \u884C = 0;
27669
27944
  data.forEach((d, idx) => {
27670
- const \u5E45 = \u5370\u304B\u3089\u540D\u524D\u307E\u3067 + textWidth(d.label ?? "", \u7D1A);
27945
+ const \u5E45 = \u5370\u304B\u3089\u540D\u524D\u307E\u3067 + textWidth(d.label ?? "", \u7D1A, 0, textMetrics);
27671
27946
  if (x > \u5DE6 && x + \u5E45 > \u53F3\u7AEF) {
27672
27947
  \u884C += 1;
27673
27948
  x = \u5DE6;
@@ -27683,7 +27958,8 @@ function ChartSlopeNode({
27683
27958
  active,
27684
27959
  stateValues = {},
27685
27960
  drawing = false,
27686
- progress = 1
27961
+ progress = 1,
27962
+ textMetrics = "proportional"
27687
27963
  }) {
27688
27964
  const x0 = node.cx - node.w / 2;
27689
27965
  const y0 = node.cy - node.h / 2;
@@ -27726,16 +28002,22 @@ function ChartSlopeNode({
27726
28002
  const \u53F3\u306E\u5B57 = \u7CFB\u5217\u305F\u3061.map(
27727
28003
  (s) => \u5F62 === "delta" ? \u5897\u6E1B\u8868\u8A18(s.\u524D, s.\u4ECA) : \u5B9F\u5024\u8868\u8A18(s.\u4ECA)
27728
28004
  );
27729
- const \u5DE6\u5024\u5E45 = Math.max(0, ...\u5DE6\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A)));
27730
- const \u53F3\u5024\u5E45 = Math.max(0, ...\u53F3\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A)));
28005
+ const \u5DE6\u5024\u5E45 = Math.max(0, ...\u5DE6\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A, 0, textMetrics)));
28006
+ const \u53F3\u5024\u5E45 = Math.max(0, ...\u53F3\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A, 0, textMetrics)));
27731
28007
  const \u540D\u524D\u306B\u4F7F\u3048\u308B = Math.max(
27732
28008
  0,
27733
28009
  (node.w - PAD * 2 - \u7DDA\u306E\u6700\u5C0F\u5E45 - (\u5DE6\u5024\u5E45 + \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067) - (\u53F3\u5024\u5E45 + \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067)) / 2
27734
28010
  );
27735
- const \u540D\u524D\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A2(\u7CFB\u5217\u305F\u3061.map((s) => s.\u540D\u524D), \u540D\u524D\u306B\u4F7F\u3048\u308B, \u540D\u524D\u306E\u4E0A\u9650\u7D1A, \u540D\u524D\u306E\u4E0B\u9650\u7D1A);
28011
+ const \u540D\u524D\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A2(
28012
+ \u7CFB\u5217\u305F\u3061.map((s) => s.\u540D\u524D),
28013
+ \u540D\u524D\u306B\u4F7F\u3048\u308B,
28014
+ \u540D\u524D\u306E\u4E0A\u9650\u7D1A,
28015
+ \u540D\u524D\u306E\u4E0B\u9650\u7D1A,
28016
+ textMetrics
28017
+ );
27736
28018
  const \u540D\u524D\u5E45 = Math.min(
27737
28019
  \u540D\u524D\u306B\u4F7F\u3048\u308B,
27738
- Math.max(0, ...\u7CFB\u5217\u305F\u3061.map((s) => textWidth(s.\u540D\u524D, \u540D\u524D\u306E\u7D1A)))
28020
+ Math.max(0, ...\u7CFB\u5217\u305F\u3061.map((s) => textWidth(s.\u540D\u524D, \u540D\u524D\u306E\u7D1A, 0, textMetrics)))
27739
28021
  );
27740
28022
  const \u5DE6\u306E\u4F59\u767D = \u540D\u524D\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067 + \u5DE6\u5024\u5E45 + \u8EF8\u304B\u3089\u5024\u307E\u3067;
27741
28023
  const \u53F3\u306E\u4F59\u767D = \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u53F3\u5024\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067 + \u540D\u524D\u5E45;
@@ -27921,10 +28203,12 @@ function \u5370\u306E\u82724(tone, idx) {
27921
28203
  if (tone) return TONE[tone];
27922
28204
  return chartSeriesColor(idx);
27923
28205
  }
27924
- function \u53CE\u3081\u308B\u7D1A2(\u540D\u524D\u305F\u3061, \u5E45, \u4E0A\u9650, \u4E0B\u9650) {
28206
+ function \u53CE\u3081\u308B\u7D1A2(\u540D\u524D\u305F\u3061, \u5E45, \u4E0A\u9650, \u4E0B\u9650, textMetrics = "proportional") {
27925
28207
  if (\u540D\u524D\u305F\u3061.length === 0) return \u4E0A\u9650;
27926
28208
  let \u7D1A = \u4E0A\u9650;
27927
- while (\u7D1A > \u4E0B\u9650 && Math.max(...\u540D\u524D\u305F\u3061.map((n) => textWidth(n, \u7D1A))) > \u5E45) \u7D1A -= 1;
28209
+ while (\u7D1A > \u4E0B\u9650 && Math.max(...\u540D\u524D\u305F\u3061.map((n) => textWidth(n, \u7D1A, 0, textMetrics))) > \u5E45) {
28210
+ \u7D1A -= 1;
28211
+ }
27928
28212
  return \u7D1A;
27929
28213
  }
27930
28214
  function \u5C0F\u6570\u306E\u6841(n) {
@@ -27972,6 +28256,7 @@ function ChartBarNode({
27972
28256
  return { y: yAt(v), value: v };
27973
28257
  });
27974
28258
  const \u6FC3\u3055 = (v) => vMax > 0 ? v >= vMax ? 1 : 0.45 : 0.9;
28259
+ const \u4E3B\u5F79\u306E\u68D2\u304B = (v) => vMax > 0 && v >= vMax;
27975
28260
  const \u89D2\u4E38 = Math.min(barW * 0.06, 8);
27976
28261
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
27977
28262
  const \u6A2A\u8EF8\u306Ey = PAD_TOP2 + canvasH;
@@ -28038,6 +28323,7 @@ function ChartBarNode({
28038
28323
  {
28039
28324
  "data-cdl-role": "chart-bar",
28040
28325
  "data-cdl-unresolved": d.unresolved ? "true" : void 0,
28326
+ "data-cdl-emphasis": \u4E3B\u5F79\u306E\u68D2\u304B(d.value) ? "primary" : void 0,
28041
28327
  x: bx,
28042
28328
  y: by,
28043
28329
  width: barW,
@@ -28384,7 +28670,8 @@ function FunnelNode({
28384
28670
  active,
28385
28671
  stateValues = {},
28386
28672
  drawing = false,
28387
- progress = 1
28673
+ progress = 1,
28674
+ textMetrics = "proportional"
28388
28675
  }) {
28389
28676
  const x0 = node.cx - node.w / 2;
28390
28677
  const y0 = node.cy - node.h / 2;
@@ -28433,7 +28720,11 @@ function FunnelNode({
28433
28720
  const \u540D\u524D\u306E\u5B9F\u5B57 = \u540D\u524D\u306E\u5B57 * \u7E26\u500D;
28434
28721
  const \u88DC\u8DB3\u306E\u67A0\u5B57 = \u88DC\u8DB3\u306E\u5B57 * \u7E26\u500D;
28435
28722
  const \u53CE\u307E\u308B\u5E45 = Math.max(0, bottomW - 16);
28436
- const \u88DC\u8DB3\u306E\u5B9F\u5B57 = \u88DC\u8DB3\u306E\u67A0\u5B57 * \u53CE\u3081\u308B\u500D\u7387(\u88DC\u8DB3, { fontSize: \u88DC\u8DB3\u306E\u67A0\u5B57, fontWeight: 500 }, \u53CE\u307E\u308B\u5E45);
28723
+ const \u88DC\u8DB3\u306E\u5B9F\u5B57 = \u88DC\u8DB3\u306E\u67A0\u5B57 * \u53CE\u3081\u308B\u500D\u7387(
28724
+ \u88DC\u8DB3,
28725
+ { fontSize: \u88DC\u8DB3\u306E\u67A0\u5B57, fontWeight: 500, textMetrics },
28726
+ \u53CE\u307E\u308B\u5E45
28727
+ );
28437
28728
  const \u584A\u306E\u4E0A = y + stageH / 2 - (\u540D\u524D\u306E\u5B9F\u5B57 * 1.2 + \u88DC\u8DB3\u306E\u67A0\u5B57 * 1.25) / 2;
28438
28729
  const \u540D\u524D\u306Ey = \u88DC\u8DB3\u3042\u308A ? \u584A\u306E\u4E0A + \u540D\u524D\u306E\u5B9F\u5B57 * 0.95 : y + stageH / 2 + 5;
28439
28730
  const \u88DC\u8DB3\u306Ey = \u584A\u306E\u4E0A + \u540D\u524D\u306E\u5B9F\u5B57 * 1.2 + \u88DC\u8DB3\u306E\u67A0\u5B57 * 0.95;
@@ -28536,7 +28827,8 @@ function \u7573\u3093\u3060\u6587(\u4EF6\u6570) {
28536
28827
  function QuadrantNode({
28537
28828
  node,
28538
28829
  active,
28539
- stateValues = {}
28830
+ stateValues = {},
28831
+ textMetrics = "proportional"
28540
28832
  }) {
28541
28833
  const x0 = node.cx - node.w / 2;
28542
28834
  const y0 = node.cy - node.h / 2;
@@ -28555,7 +28847,10 @@ function QuadrantNode({
28555
28847
  const SUB_FONT = 10;
28556
28848
  const axisLabelPad = (text) => Math.max(
28557
28849
  PAD_MIN,
28558
- measureTextWidth(`\u2190 ${text}`, { fontSize: AXIS_LABEL_FONT}) + 12
28850
+ measureTextWidth(`\u2190 ${text}`, {
28851
+ fontSize: AXIS_LABEL_FONT,
28852
+ textMetrics
28853
+ }) + 12
28559
28854
  );
28560
28855
  const padBudget = Math.max(0, node.w * 0.5 - PAD_MIN * 2);
28561
28856
  const wantLeft = axisLabelPad(data.xAxis.left) - PAD_MIN;
@@ -28809,7 +29104,11 @@ function QuadrantNode({
28809
29104
  ITEM_MIN_W,
28810
29105
  Math.max(
28811
29106
  ...\u884C\u30892.map(
28812
- (r) => measureTextWidth(r.text, { fontSize: r.size, fontWeight: r.weight })
29107
+ (r) => measureTextWidth(r.text, {
29108
+ fontSize: r.size,
29109
+ fontWeight: r.weight,
29110
+ textMetrics
29111
+ })
28813
29112
  )
28814
29113
  ) + ITEM_PAD_X * 2
28815
29114
  )
@@ -28835,7 +29134,7 @@ function QuadrantNode({
28835
29134
  const \u88DC\u8DB3 = (it.subtitle ?? "").trim();
28836
29135
  const \u88DC\u8DB3\u306E\u5B57 = SUB_FONT * \u53CE\u3081\u308B\u500D\u7387(
28837
29136
  \u88DC\u8DB3,
28838
- { fontSize: SUB_FONT, fontWeight: 500 },
29137
+ { fontSize: SUB_FONT, fontWeight: 500, textMetrics },
28839
29138
  Math.max(0, \u5E45 - ITEM_PAD_X * 2)
28840
29139
  );
28841
29140
  return /* @__PURE__ */ jsxs("g", { children: [
@@ -29239,24 +29538,30 @@ var EYEBROW_GAP2 = 8;
29239
29538
  var EYEBROW_TRACKING = 2;
29240
29539
  var SUB_SIZE = 11;
29241
29540
  var SUB_GAP = 4;
29242
- function labelBlock(node, pos, size, band) {
29541
+ function labelBlock(node, pos, size, band, textMetrics = "proportional") {
29243
29542
  const \u4E0A = node.eyebrow ? size + EYEBROW_GAP2 + EYEBROW_SIZE2 * ASCENT2 : size * ASCENT2;
29244
29543
  const \u4E0B = node.subtitle ? size + SUB_GAP + SUB_SIZE * DESCENT2 : size * DESCENT2;
29245
29544
  const \u5E45 = Math.max(
29246
- textWidth(node.title ?? "", size),
29247
- node.eyebrow ? textWidth(node.eyebrow, EYEBROW_SIZE2, EYEBROW_TRACKING) : 0,
29248
- node.subtitle ? textWidth(node.subtitle, SUB_SIZE) : 0
29545
+ textWidth(node.title ?? "", size, 0, textMetrics),
29546
+ node.eyebrow ? textWidth(node.eyebrow, EYEBROW_SIZE2, EYEBROW_TRACKING, textMetrics) : 0,
29547
+ node.subtitle ? textWidth(node.subtitle, SUB_SIZE, 0, textMetrics) : 0
29249
29548
  );
29250
- const \u984C\u5E45 = textWidth(node.title ?? "", size);
29251
- const \u4E0B\u9650 = \u984C\u5E45 >= \u5E45 ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(node.title ?? "", size, 0, band.w, textWidth) : 0;
29549
+ const \u984C\u5E45 = textWidth(node.title ?? "", size, 0, textMetrics);
29550
+ const \u6E2C\u308B = (t, s, ls) => textWidth(t, s, ls, textMetrics);
29551
+ const \u4E0B\u9650 = \u984C\u5E45 >= \u5E45 ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(node.title ?? "", size, 0, band.w, \u6E2C\u308B) : 0;
29252
29552
  const { k, x, y: baseline } = fitLabel(band, { \u4E0A, \u4E0B, \u5E45 }, pos, \u4E0B\u9650);
29253
29553
  return { k, x, baseline, \u4E0A\u7AEF: baseline - \u4E0A * k, \u4E0B\u7AEF: baseline + \u4E0B * k };
29254
29554
  }
29255
- function commonLabel(node, pos, size, band) {
29256
- const \u584A = labelBlock(node, pos, size, band);
29555
+ function commonLabel(node, pos, size, band, textMetrics = "proportional") {
29556
+ const \u584A = labelBlock(node, pos, size, band, textMetrics);
29257
29557
  const k = \u584A.k;
29258
29558
  const x = \u584A.x;
29259
- const \u5207\u308B = (t, \u5927\u304D\u3055, \u5B57\u9593 = 0) => \u5E2F\u3067\u5207\u308B(t, \u5927\u304D\u3055 * k, band.w, (u, f) => textWidth(u, f, \u5B57\u9593 * k));
29559
+ const \u5207\u308B = (t, \u5927\u304D\u3055, \u5B57\u9593 = 0) => \u5E2F\u3067\u5207\u308B(
29560
+ t,
29561
+ \u5927\u304D\u3055 * k,
29562
+ band.w,
29563
+ (u, f) => textWidth(u, f, \u5B57\u9593 * k, textMetrics)
29564
+ );
29260
29565
  return /* @__PURE__ */ jsxs(Fragment, { children: [
29261
29566
  node.eyebrow && /* @__PURE__ */ jsx(
29262
29567
  "text",
@@ -29307,7 +29612,7 @@ var RULE_GAP_RATIO = 0.1;
29307
29612
  var RULE_PAD_MAX = 20;
29308
29613
  var RULE_PAD_RATIO = 0.14;
29309
29614
  var RULE_SHRINK_RATIO = 0.055;
29310
- function ShapeFileNode({ node, active }) {
29615
+ function ShapeFileNode({ node, active, textMetrics = "proportional" }) {
29311
29616
  const \u5E2F = bodyBand(node, { \u5F71ry: SHADOW_RY });
29312
29617
  const \u7D19h = \u5E2F.h;
29313
29618
  const \u7D19w = Math.min(\u5E2F.w, \u7D19h * 0.72);
@@ -29327,7 +29632,7 @@ function ShapeFileNode({ node, active }) {
29327
29632
  const foldTriangle = `M ${x + \u7D19w - fold} ${y} L ${x + \u7D19w} ${y + fold} L ${x + \u7D19w - fold} ${y + fold} Z`;
29328
29633
  const \u540D\u524D\u5E2F = { x, y, w: \u7D19w, h: \u7D19h };
29329
29634
  const \u540D\u524D\u4F4D\u7F6E = { x: \u5E2F.cx, y: node.cy + node.h * 0.12 };
29330
- const \u540D\u524D = labelBlock(node, \u540D\u524D\u4F4D\u7F6E, 16, \u540D\u524D\u5E2F);
29635
+ const \u540D\u524D = labelBlock(node, \u540D\u524D\u4F4D\u7F6E, 16, \u540D\u524D\u5E2F, textMetrics);
29331
29636
  const \u9593\u9694 = Math.min(RULE_GAP_MAX, \u7D19h * RULE_GAP_RATIO);
29332
29637
  const \u7DDA\u4F59\u767D = Math.min(RULE_PAD_MAX, \u7D19w * RULE_PAD_RATIO);
29333
29638
  const textLines = [0, 1, 2].map((i) => ({ i, ly: y + fold + \u9593\u9694 * (i + 1) })).filter(({ ly }) => ly < \u540D\u524D.\u4E0A\u7AEF);
@@ -29359,12 +29664,12 @@ function ShapeFileNode({ node, active }) {
29359
29664
  i
29360
29665
  );
29361
29666
  }),
29362
- commonLabel(node, \u540D\u524D\u4F4D\u7F6E, 16, \u540D\u524D\u5E2F)
29667
+ commonLabel(node, \u540D\u524D\u4F4D\u7F6E, 16, \u540D\u524D\u5E2F, textMetrics)
29363
29668
  ] });
29364
29669
  }
29365
29670
  var TAB_H_MAX = 22;
29366
29671
  var TAB_H_RATIO = 0.3;
29367
- function ShapeFolderNode({ node, active }) {
29672
+ function ShapeFolderNode({ node, active, textMetrics = "proportional" }) {
29368
29673
  const \u5E2F = bodyBand(node, { \u5F71ry: SHADOW_RY });
29369
29674
  const x = \u5E2F.x;
29370
29675
  const y = \u5E2F.y;
@@ -29385,7 +29690,7 @@ function ShapeFolderNode({ node, active }) {
29385
29690
  const \u5883\u754Cy = y + tabH + Math.min(8, (\u5E2F.h - tabH) * 0.2);
29386
29691
  const \u7AEF = Math.min(6, \u5E2F.w * 0.1);
29387
29692
  const \u540D\u524D\u4F4D\u7F6E = { x: \u5E2F.cx, y: node.cy + 18 };
29388
- const \u540D\u524D = labelBlock(node, \u540D\u524D\u4F4D\u7F6E, 16, \u5E2F);
29693
+ const \u540D\u524D = labelBlock(node, \u540D\u524D\u4F4D\u7F6E, 16, \u5E2F, textMetrics);
29389
29694
  return /* @__PURE__ */ jsxs("g", { children: [
29390
29695
  dropShadow(\u5E2F.cx, \u5E2F.\u5E95, \u5E2F.w * 0.44),
29391
29696
  /* @__PURE__ */ jsx("path", { "data-cdl-role": "node-body", d: bodyPath, ...frame, strokeLinejoin: "round" }),
@@ -29401,13 +29706,13 @@ function ShapeFolderNode({ node, active }) {
29401
29706
  opacity: 0.35
29402
29707
  }
29403
29708
  ),
29404
- commonLabel(node, \u540D\u524D\u4F4D\u7F6E, 16, \u5E2F)
29709
+ commonLabel(node, \u540D\u524D\u4F4D\u7F6E, 16, \u5E2F, textMetrics)
29405
29710
  ] });
29406
29711
  }
29407
29712
  var CLOUD_VB_W = 640;
29408
29713
  var CLOUD_VB_H = 512;
29409
29714
  var CLOUD_W_RATIO = 0.9;
29410
- function ShapeCloudNode({ node, active }) {
29715
+ function ShapeCloudNode({ node, active, textMetrics = "proportional" }) {
29411
29716
  const \u5E2F = bodyBand(node, { \u5F71ry: SHADOW_RY });
29412
29717
  const frame = commonFrame(active);
29413
29718
  const \u7D20\u306E\u500D\u7387 = Math.min(\u5E2F.h / CLOUD_VB_H, \u5E2F.w * CLOUD_W_RATIO / CLOUD_VB_W);
@@ -29430,13 +29735,13 @@ function ShapeCloudNode({ node, active }) {
29430
29735
  strokeLinejoin: "round"
29431
29736
  }
29432
29737
  ) }),
29433
- commonLabel(node, { x: \u5E2F.cx, y: node.cy + node.h * 0.05 }, 16, \u5E2F)
29738
+ commonLabel(node, { x: \u5E2F.cx, y: node.cy + node.h * 0.05 }, 16, \u5E2F, textMetrics)
29434
29739
  ] });
29435
29740
  }
29436
29741
  var CYLINDER_RY_MAX = 18;
29437
29742
  var CYLINDER_RY_RATIO = 0.1;
29438
29743
  var CYLINDER_DISKS = [0.3, 0.55, 0.8];
29439
- function ShapeCylinderNode({ node, active }) {
29744
+ function ShapeCylinderNode({ node, active, textMetrics = "proportional" }) {
29440
29745
  const \u5E2F = bodyBand(node, { \u5F71ry: CYLINDER_SHADOW_RY });
29441
29746
  const x = \u5E2F.x;
29442
29747
  const y = \u5E2F.y;
@@ -29453,7 +29758,7 @@ function ShapeCylinderNode({ node, active }) {
29453
29758
  const \u84CB\u5E95 = y + ry * 2;
29454
29759
  const \u540D\u524D\u4F4D\u7F6E = { x: \u5E2F.cx, y: node.cy + 6 };
29455
29760
  const \u540D\u524D\u5E2F = { x: \u5E2F.x, y: \u84CB\u5E95, w: \u5E2F.w, h: Math.max(0, \u5E2F.\u5E95 - \u84CB\u5E95) };
29456
- const \u540D\u524D = labelBlock(node, \u540D\u524D\u4F4D\u7F6E, 15, \u540D\u524D\u5E2F);
29761
+ const \u540D\u524D = labelBlock(node, \u540D\u524D\u4F4D\u7F6E, 15, \u540D\u524D\u5E2F, textMetrics);
29457
29762
  return /* @__PURE__ */ jsxs("g", { children: [
29458
29763
  dropShadow(\u5E2F.cx, \u5E2F.\u5E95, rx * 0.85, CYLINDER_SHADOW_RY),
29459
29764
  /* @__PURE__ */ jsx("path", { "data-cdl-role": "node-body", d: bodyPath, ...frame, strokeLinejoin: "round" }),
@@ -29477,11 +29782,11 @@ function ShapeCylinderNode({ node, active }) {
29477
29782
  },
29478
29783
  i
29479
29784
  )),
29480
- commonLabel(node, \u540D\u524D\u4F4D\u7F6E, 15, \u540D\u524D\u5E2F)
29785
+ commonLabel(node, \u540D\u524D\u4F4D\u7F6E, 15, \u540D\u524D\u5E2F, textMetrics)
29481
29786
  ] });
29482
29787
  }
29483
29788
  var HEX_DOT_R = 2.5;
29484
- function ShapeHexagonNode({ node, active }) {
29789
+ function ShapeHexagonNode({ node, active, textMetrics = "proportional" }) {
29485
29790
  const \u5E2F = bodyBand(node, { \u5F71ry: SHADOW_RY, \u5916: Math.max(HEX_DOT_R, FRAME_HALF) });
29486
29791
  const cx = \u5E2F.cx;
29487
29792
  const cy = \u5E2F.cy;
@@ -29504,11 +29809,12 @@ function ShapeHexagonNode({ node, active }) {
29504
29809
  node,
29505
29810
  { x: cx, y: node.cy + 6 },
29506
29811
  16,
29507
- { x: \u5E2F.x + cut, y: \u5E2F.y, w: Math.max(0, \u5E2F.w - cut * 2), h: \u5E2F.h }
29812
+ { x: \u5E2F.x + cut, y: \u5E2F.y, w: Math.max(0, \u5E2F.w - cut * 2), h: \u5E2F.h },
29813
+ textMetrics
29508
29814
  )
29509
29815
  ] });
29510
29816
  }
29511
- function ShapeDiamondNode({ node, active }) {
29817
+ function ShapeDiamondNode({ node, active, textMetrics = "proportional" }) {
29512
29818
  const \u5E2F = bodyBand(node, { \u5F71ry: SHADOW_RY });
29513
29819
  const cx = \u5E2F.cx;
29514
29820
  const cy = \u5E2F.cy;
@@ -29549,13 +29855,14 @@ function ShapeDiamondNode({ node, active }) {
29549
29855
  y: cy - \u5E2F.h * innerScale / 4,
29550
29856
  w: \u5E2F.w * innerScale / 2,
29551
29857
  h: \u5E2F.h * innerScale / 2
29552
- }
29858
+ },
29859
+ textMetrics
29553
29860
  )
29554
29861
  ] });
29555
29862
  }
29556
29863
  var STACK_OFFSET_MAX = 12;
29557
29864
  var STACK_OFFSET_RATIO = 0.15;
29558
- function ShapeStackNode({ node, active }) {
29865
+ function ShapeStackNode({ node, active, textMetrics = "proportional" }) {
29559
29866
  const \u5E2F = bodyBand(node, { \u5F71ry: SHADOW_RY });
29560
29867
  const x = \u5E2F.x;
29561
29868
  const y = \u5E2F.y;
@@ -29609,7 +29916,8 @@ function ShapeStackNode({ node, active }) {
29609
29916
  node,
29610
29917
  { x: \u624B\u524Dcx, y: node.cy + \u305A\u308C + 6 },
29611
29918
  15,
29612
- { x, y: y + \u305A\u308C * 2, w: cardW, h: cardH }
29919
+ { x, y: y + \u305A\u308C * 2, w: cardW, h: cardH },
29920
+ textMetrics
29613
29921
  )
29614
29922
  ] });
29615
29923
  }
@@ -29621,16 +29929,22 @@ var PERSON_BODY_LEN = 90;
29621
29929
  var PERSON_SHADOW_DY = 20;
29622
29930
  var PERSON_SHADOW_RY = 4;
29623
29931
  var PERSON_SHADOW_RX = 55;
29624
- function planLabel(node, cx, \u5E45\u4E0A\u9650, plan) {
29932
+ function planLabel(node, cx, \u5E45\u4E0A\u9650, plan, textMetrics = "proportional") {
29625
29933
  const \u5E45 = Math.max(
29626
- textWidth(node.title ?? "", plan.\u540D\u524D.size),
29627
- node.eyebrow && plan.\u80A9\u66F8 ? textWidth(node.eyebrow, plan.\u80A9\u66F8.size, EYEBROW_TRACKING) : 0,
29628
- node.subtitle && plan.\u8AAC\u660E ? textWidth(node.subtitle, plan.\u8AAC\u660E.size) : 0
29934
+ textWidth(node.title ?? "", plan.\u540D\u524D.size, 0, textMetrics),
29935
+ node.eyebrow && plan.\u80A9\u66F8 ? textWidth(node.eyebrow, plan.\u80A9\u66F8.size, EYEBROW_TRACKING, textMetrics) : 0,
29936
+ node.subtitle && plan.\u8AAC\u660E ? textWidth(node.subtitle, plan.\u8AAC\u660E.size, 0, textMetrics) : 0
29629
29937
  );
29630
- const \u984C\u5E45 = textWidth(node.title ?? "", plan.\u540D\u524D.size);
29631
- const \u4E0B\u9650 = \u984C\u5E45 >= \u5E45 ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(node.title ?? "", plan.\u540D\u524D.size, 0, \u5E45\u4E0A\u9650, textWidth) : 0;
29938
+ const \u984C\u5E45 = textWidth(node.title ?? "", plan.\u540D\u524D.size, 0, textMetrics);
29939
+ const \u6E2C\u308B = (t, s, ls) => textWidth(t, s, ls, textMetrics);
29940
+ const \u4E0B\u9650 = \u984C\u5E45 >= \u5E45 ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(node.title ?? "", plan.\u540D\u524D.size, 0, \u5E45\u4E0A\u9650, \u6E2C\u308B) : 0;
29632
29941
  const k = \u5E45 > 0 && \u5E45\u4E0A\u9650 > 0 ? Math.min(1, Math.max(\u5E45\u4E0A\u9650 / \u5E45, \u4E0B\u9650)) : 1;
29633
- const \u5207\u308B = (t, \u5927\u304D\u3055, \u5B57\u9593 = 0) => \u5E2F\u3067\u5207\u308B(t, \u5927\u304D\u3055 * k, \u5E45\u4E0A\u9650, (u, f) => textWidth(u, f, \u5B57\u9593 * k));
29942
+ const \u5207\u308B = (t, \u5927\u304D\u3055, \u5B57\u9593 = 0) => \u5E2F\u3067\u5207\u308B(
29943
+ t,
29944
+ \u5927\u304D\u3055 * k,
29945
+ \u5E45\u4E0A\u9650,
29946
+ (u, f) => textWidth(u, f, \u5B57\u9593 * k, textMetrics)
29947
+ );
29634
29948
  return /* @__PURE__ */ jsxs(Fragment, { children: [
29635
29949
  node.eyebrow && plan.\u80A9\u66F8 && /* @__PURE__ */ jsx(
29636
29950
  "text",
@@ -29671,7 +29985,7 @@ function planLabel(node, cx, \u5E45\u4E0A\u9650, plan) {
29671
29985
  )
29672
29986
  ] });
29673
29987
  }
29674
- function ShapePersonNode({ node, active }) {
29988
+ function ShapePersonNode({ node, active, textMetrics = "proportional" }) {
29675
29989
  const r = shapeRegion(node);
29676
29990
  const cx = r.cx;
29677
29991
  const strokeColor = active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)";
@@ -29733,7 +30047,7 @@ function ShapePersonNode({ node, active }) {
29733
30047
  )
29734
30048
  ] })
29735
30049
  ),
29736
- planLabel(node, r.cx, Math.max(0, node.w), r.label)
30050
+ planLabel(node, r.cx, Math.max(0, node.w), r.label, textMetrics)
29737
30051
  ] });
29738
30052
  }
29739
30053
  var commonFrame2 = (active) => ({
@@ -29983,7 +30297,12 @@ function ShapeTerminalNode({ node, active, lang }) {
29983
30297
  )
29984
30298
  ] });
29985
30299
  }
29986
- function ShapeCodeBlockNode({ node, active, lang }) {
30300
+ function ShapeCodeBlockNode({
30301
+ node,
30302
+ active,
30303
+ lang,
30304
+ textMetrics = "proportional"
30305
+ }) {
29987
30306
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
29988
30307
  const frame = commonFrame2(active);
29989
30308
  const \u7DDA = frame.strokeWidth / 2;
@@ -29994,7 +30313,10 @@ function ShapeCodeBlockNode({ node, active, lang }) {
29994
30313
  const lineFont = "ui-monospace, SFMono-Regular, Menlo, monospace";
29995
30314
  const \u672D = \u66F8\u3044\u305F\u5024\u304B\u63A7\u3048(node.subtitle, \u5B57\u5F15("codeBlock.fileName"));
29996
30315
  const \u672D\u306E\u5B57 = 11;
29997
- const \u30BF\u30D6\u5E45 = Math.min(Math.max(100, textWidth(\u672D, \u672D\u306E\u5B57, 0) + 24), Math.max(0, w));
30316
+ const \u30BF\u30D6\u5E45 = Math.min(
30317
+ Math.max(100, textWidth(\u672D, \u672D\u306E\u5B57, 0, textMetrics) + 24),
30318
+ Math.max(0, w)
30319
+ );
29998
30320
  const \u30BF\u30D6\u9AD8 = 24;
29999
30321
  const \u89D2 = 10;
30000
30322
  const \u6E9D = 32;
@@ -30034,7 +30356,7 @@ function ShapeCodeBlockNode({ node, active, lang }) {
30034
30356
  { text: \u672D, size: \u672D\u306E\u5B57, \u5E2F: { \u5E45: \u30BF\u30D6\u5E45, \u9AD8\u3055: \u30BF\u30D6\u9AD8 } },
30035
30357
  { text: "1", size: \u884C\u756A\u53F7\u306E\u5B57, \u5E2F: { \u5E45: \u6E9D - \u6301\u3061\u4E0A\u3052, \u9AD8\u3055: \u884C\u9593 } }
30036
30358
  ];
30037
- const \u500D\u8FD4\u3057 = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D, \u6253\u3061\u6D88\u3059\u5B57\u3089);
30359
+ const \u500D\u8FD4\u3057 = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
30038
30360
  const tabW = \u30BF\u30D6\u5E45 * \u500D;
30039
30361
  const tabH = \u30BF\u30D6\u9AD8 * \u500D;
30040
30362
  const \u4E38 = \u89D2 * \u500D;
@@ -30073,7 +30395,7 @@ function ShapeCodeBlockNode({ node, active, lang }) {
30073
30395
  "data-cdl-counter-scaled": "1",
30074
30396
  x: x + tabW / 2,
30075
30397
  y: y + tabH / 2 + 4 * \u500D,
30076
- fontSize: \u672D\u306E\u5B57 * \u500D * \u500D\u8FD4\u3057 * \u5E45\u306E\u500D\u7387(\u672D, \u672D\u306E\u5B57 * \u500D * \u500D\u8FD4\u3057, 0, tabW),
30398
+ fontSize: \u672D\u306E\u5B57 * \u500D * \u500D\u8FD4\u3057 * \u5E45\u306E\u500D\u7387(\u672D, \u672D\u306E\u5B57 * \u500D * \u500D\u8FD4\u3057, 0, tabW, textMetrics),
30077
30399
  fontFamily: lineFont,
30078
30400
  textAnchor: "middle",
30079
30401
  fill: "#e6edf3",
@@ -30155,7 +30477,12 @@ function ShapeCodeBlockNode({ node, active, lang }) {
30155
30477
  )
30156
30478
  ] });
30157
30479
  }
30158
- function ShapeKanbanCardNode({ node, active, lang }) {
30480
+ function ShapeKanbanCardNode({
30481
+ node,
30482
+ active,
30483
+ lang,
30484
+ textMetrics = "proportional"
30485
+ }) {
30159
30486
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
30160
30487
  const frame = commonFrame2(active);
30161
30488
  const \u7DDA = frame.strokeWidth / 2;
@@ -30209,7 +30536,7 @@ function ShapeKanbanCardNode({ node, active, lang }) {
30209
30536
  );
30210
30537
  const \u8AAC\u660E = \u66F8\u3044\u305F\u5024\u304B\u63A7\u3048(node.subtitle, \u5B57\u5F15("kanbanCard.task"));
30211
30538
  const \u72B6\u614B = \u66F8\u3044\u305F\u5024\u304B\u63A7\u3048(node.eyebrow, \u5B57\u5F15("kanbanCard.status"));
30212
- const \u72B6\u614B\u306E\u500D\u7387 = \u5E45\u306E\u500D\u7387(\u72B6\u614B, PILL\u5B57, PILL\u5B57\u9593, PILL\u5B57\u5E45);
30539
+ const \u72B6\u614B\u306E\u500D\u7387 = \u5E45\u306E\u500D\u7387(\u72B6\u614B, PILL\u5B57, PILL\u5B57\u9593, PILL\u5B57\u5E45, textMetrics);
30213
30540
  const \u8AAC\u660E\u306E\u5B57 = \u540D\u524D.size * \u8AAC\u660E\u5B57\u6BD4;
30214
30541
  const \u4F7F\u3048\u308B\u5E452 = Math.max(0, w - \u5DE6\u53F3\u4F59\u767D * \u500D * 2);
30215
30542
  return /* @__PURE__ */ jsxs("g", { children: [
@@ -30296,7 +30623,7 @@ function ShapeKanbanCardNode({ node, active, lang }) {
30296
30623
  {
30297
30624
  x: x + w / 2,
30298
30625
  y: \u540D\u524D.y + \u540D\u524D.size * \u8AAC\u660E\u57FA\u6E96\u6BD4,
30299
- fontSize: \u8AAC\u660E\u306E\u5B57 * \u5E45\u306E\u500D\u7387(\u8AAC\u660E, \u8AAC\u660E\u306E\u5B57, 0, \u4F7F\u3048\u308B\u5E452),
30626
+ fontSize: \u8AAC\u660E\u306E\u5B57 * \u5E45\u306E\u500D\u7387(\u8AAC\u660E, \u8AAC\u660E\u306E\u5B57, 0, \u4F7F\u3048\u308B\u5E452, textMetrics),
30300
30627
  textAnchor: "middle",
30301
30628
  fill: "var(--cdl-text-dim, #5a6270)",
30302
30629
  children: \u8AAC\u660E
@@ -30587,18 +30914,33 @@ var externalLabel = (node, cx, bottomY) => /* @__PURE__ */ jsxs(Fragment, { chil
30587
30914
  )
30588
30915
  ] });
30589
30916
  var LABEL_EYEBROW_SPACING = 2;
30590
- function \u5E45\u306B\u53CE\u3081\u308B2(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u984C\u304B = false) {
30591
- const \u5E45 = textWidth(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593);
30592
- const \u4E0B\u9650 = \u984C\u304B ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, textWidth) : 0;
30917
+ function \u5E45\u306B\u53CE\u3081\u308B2(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u984C\u304B = false, textMetrics = "proportional") {
30918
+ const \u6E2C\u308B = (t, s, ls) => textWidth(t, s, ls, textMetrics);
30919
+ const \u5E45 = \u6E2C\u308B(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593);
30920
+ const \u4E0B\u9650 = \u984C\u304B ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u6E2C\u308B) : 0;
30593
30921
  const \u500D\u7387 = \u5E45 > 0 && \u7BB1\u5E45 > 0 ? Math.min(1, Math.max(\u7BB1\u5E45 / \u5E45, \u4E0B\u9650)) : 1;
30594
30922
  const size = \u5927\u304D\u3055 * \u500D\u7387;
30595
30923
  const spacing = \u5B57\u9593 * \u500D\u7387;
30596
- return { size, spacing, text: \u5E2F\u3067\u5207\u308B(\u6587\u5B57\u5217, size, \u7BB1\u5E45, (u, f) => textWidth(u, f, spacing)) };
30597
- }
30598
- function bottomLabel(node, cx, plan) {
30599
- const \u80A9 = \u5E45\u306B\u53CE\u3081\u308B2(node.eyebrow ?? "", plan.\u80A9\u66F8?.size ?? 0, LABEL_EYEBROW_SPACING, node.w);
30600
- const \u540D = \u5E45\u306B\u53CE\u3081\u308B2(node.title ?? "", plan.\u540D\u524D.size, 0, node.w, true);
30601
- const \u8AAC = \u5E45\u306B\u53CE\u3081\u308B2(node.subtitle ?? "", plan.\u8AAC\u660E?.size ?? 0, 0, node.w);
30924
+ return { size, spacing, text: \u5E2F\u3067\u5207\u308B(\u6587\u5B57\u5217, size, \u7BB1\u5E45, (u, f) => \u6E2C\u308B(u, f, spacing)) };
30925
+ }
30926
+ function bottomLabel(node, cx, plan, textMetrics = "proportional") {
30927
+ const \u80A9 = \u5E45\u306B\u53CE\u3081\u308B2(
30928
+ node.eyebrow ?? "",
30929
+ plan.\u80A9\u66F8?.size ?? 0,
30930
+ LABEL_EYEBROW_SPACING,
30931
+ node.w,
30932
+ false,
30933
+ textMetrics
30934
+ );
30935
+ const \u540D = \u5E45\u306B\u53CE\u3081\u308B2(node.title ?? "", plan.\u540D\u524D.size, 0, node.w, true, textMetrics);
30936
+ const \u8AAC = \u5E45\u306B\u53CE\u3081\u308B2(
30937
+ node.subtitle ?? "",
30938
+ plan.\u8AAC\u660E?.size ?? 0,
30939
+ 0,
30940
+ node.w,
30941
+ false,
30942
+ textMetrics
30943
+ );
30602
30944
  return /* @__PURE__ */ jsxs(Fragment, { children: [
30603
30945
  node.eyebrow && plan.\u80A9\u66F8 && /* @__PURE__ */ jsx("text", { x: cx, y: plan.\u80A9\u66F8.y, fontSize: \u80A9.size, fontWeight: 700, letterSpacing: \u80A9.spacing, textAnchor: "middle", fill: "var(--cdl-tone-accent, #2d6a8f)", children: \u80A9.text }),
30604
30946
  /* @__PURE__ */ jsx("text", { "data-cdl-role": "node-label", x: cx, y: plan.\u540D\u524D.y, fontSize: \u540D.size, fontWeight: 700, textAnchor: "middle", fill: "var(--cdl-text, #1a1f2a)", children: \u540D.text }),
@@ -30612,7 +30954,7 @@ var RACK_SLOT_N = 4;
30612
30954
  var RACK_BOTTOM = 8;
30613
30955
  var RACK_H = RACK_SLOT_TOP + RACK_SLOT_N * RACK_SLOT_H + (RACK_SLOT_N - 1) * RACK_SLOT_GAP + RACK_BOTTOM;
30614
30956
  var RACK_W_MIN = 120;
30615
- function ShapeServerRackNode({ node, active }) {
30957
+ function ShapeServerRackNode({ node, active, textMetrics = "proportional" }) {
30616
30958
  const r = shapeRegion(node);
30617
30959
  const frame = commonFrame3(active);
30618
30960
  const \u7DDA = frame.strokeWidth / 2;
@@ -30694,7 +31036,7 @@ function ShapeServerRackNode({ node, active }) {
30694
31036
  ] }, i);
30695
31037
  })
30696
31038
  ] })),
30697
- bottomLabel(node, r.cx, r.label)
31039
+ bottomLabel(node, r.cx, r.label, textMetrics)
30698
31040
  ] });
30699
31041
  }
30700
31042
  var HUB_R = 30;
@@ -30702,7 +31044,7 @@ var ARM_LEN = 68;
30702
31044
  var END_R = 7;
30703
31045
  var WIFI_ARC_R = [10, 16, 22];
30704
31046
  var WIFI_BASE_Y = 5;
30705
- function ShapeNetworkNodeNode({ node, active }) {
31047
+ function ShapeNetworkNodeNode({ node, active, textMetrics = "proportional" }) {
30706
31048
  const r = shapeRegion(node);
30707
31049
  const cx = r.cx;
30708
31050
  const cy = r.cy;
@@ -30778,12 +31120,12 @@ function ShapeNetworkNodeNode({ node, active }) {
30778
31120
  )),
30779
31121
  /* @__PURE__ */ jsx("circle", { cx, cy: cy + WIFI_BASE_Y + 3, r: 2.5, fill: "var(--cdl-tone-accent, #2d6a8f)", stroke: "none" })
30780
31122
  ] })),
30781
- bottomLabel(node, r.cx, r.label)
31123
+ bottomLabel(node, r.cx, r.label, textMetrics)
30782
31124
  ] });
30783
31125
  }
30784
31126
  var PHONE_H = 240;
30785
31127
  var PHONE_W = 110;
30786
- function ShapeMobileDeviceNode({ node, active }) {
31128
+ function ShapeMobileDeviceNode({ node, active, textMetrics = "proportional" }) {
30787
31129
  const r = shapeRegion(node);
30788
31130
  const frame = commonFrame3(active);
30789
31131
  const \u7DDA = frame.strokeWidth / 2;
@@ -30850,7 +31192,7 @@ function ShapeMobileDeviceNode({ node, active }) {
30850
31192
  }
30851
31193
  )
30852
31194
  ] })),
30853
- bottomLabel(node, r.cx, r.label)
31195
+ bottomLabel(node, r.cx, r.label, textMetrics)
30854
31196
  ] });
30855
31197
  }
30856
31198
  function ShapeIotSensorNode({ node, active }) {
@@ -31121,7 +31463,7 @@ var SAT_DISH_R = 12;
31121
31463
  var SAT_DISH_STEM = 12;
31122
31464
  var SAT_MAST_LEN = 22;
31123
31465
  var SAT_MAST_TIP_R = 4;
31124
- function ShapeSatelliteNode({ node, active }) {
31466
+ function ShapeSatelliteNode({ node, active, textMetrics = "proportional" }) {
31125
31467
  const r = shapeRegion(node);
31126
31468
  const cx = r.cx;
31127
31469
  const cy = r.cy;
@@ -31310,7 +31652,7 @@ function ShapeSatelliteNode({ node, active }) {
31310
31652
  ),
31311
31653
  /* @__PURE__ */ jsx("circle", { cx, cy: cy - bodyH / 2 - SAT_MAST_LEN, r: 2, fill: "#ff5f56", stroke: "none", children: /* @__PURE__ */ jsx("animate", { attributeName: "opacity", values: "0.4;1;0.4", dur: "1.4s", repeatCount: "indefinite" }) })
31312
31654
  ] })),
31313
- bottomLabel(node, r.cx, r.label)
31655
+ bottomLabel(node, r.cx, r.label, textMetrics)
31314
31656
  ] });
31315
31657
  }
31316
31658
  var FRAME_SW_ACTIVE = 3;
@@ -31396,9 +31738,9 @@ function blockchainNodeExtent(strokeWidth) {
31396
31738
  const \u6A2A = (NODE_PEER_DIST + NODE_PEER_R) * Math.cos(Math.PI / 6) + \u7DDA;
31397
31739
  return { \u4E0A: \u7E26, \u4E0B: \u7E26, \u5DE6: \u6A2A, \u53F3: \u6A2A };
31398
31740
  }
31399
- function bottomLabel2(node, cx, plan) {
31741
+ function bottomLabel2(node, cx, plan, textMetrics = "proportional") {
31400
31742
  const \u53CE\u3081\u308B = (t, \u5927\u304D\u3055, \u5B57\u9593, \u984C\u304B = false) => {
31401
- const \u6E2C\u308B = (u, f, ls) => \u5B57\u306E\u5E45(u, f) + ls * [...u].length;
31743
+ const \u6E2C\u308B = (u, f, ls) => \u5B57\u306E\u5E45(u, f, textMetrics) + ls * [...u].length;
31402
31744
  const \u7D20\u306E\u5E45 = \u6E2C\u308B(t, \u5927\u304D\u3055, \u5B57\u9593);
31403
31745
  const \u53CE\u307E\u308B = \u7D20\u306E\u5E45 > node.w && node.w > 0 ? node.w / \u7D20\u306E\u5E45 : 1;
31404
31746
  const \u4E0B\u9650 = \u984C\u304B ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(t, \u5927\u304D\u3055, \u5B57\u9593, node.w, \u6E2C\u308B) : 0;
@@ -31431,7 +31773,12 @@ function EthereumDiamond({ cx, cy, h, colors }) {
31431
31773
  /* @__PURE__ */ jsx("path", { d: `M ${cx} ${midY} L ${cx + w} ${cy + h * 0.05} L ${cx} ${lowerBotY} Z`, fill: c.dark, stroke: c.stroke, strokeWidth: 0.6, strokeLinejoin: "round" })
31432
31774
  ] });
31433
31775
  }
31434
- function ShapeSmartContractNode({ node, active, lang }) {
31776
+ function ShapeSmartContractNode({
31777
+ node,
31778
+ active,
31779
+ lang,
31780
+ textMetrics = "proportional"
31781
+ }) {
31435
31782
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
31436
31783
  const frame = commonFrame4(active);
31437
31784
  const r = shapeRegion(node);
@@ -31472,7 +31819,7 @@ function ShapeSmartContractNode({ node, active, lang }) {
31472
31819
  }
31473
31820
  ];
31474
31821
  const art = (\u500D\u7387) => {
31475
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
31822
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
31476
31823
  return /* @__PURE__ */ jsxs("g", { children: [
31477
31824
  /* @__PURE__ */ jsx("path", { "data-cdl-role": "node-body", d: path, ...frame, strokeLinejoin: "round" }),
31478
31825
  /* @__PURE__ */ jsx("path", { d: foldPath, fill: "none", stroke: frame.stroke, strokeWidth: frame.strokeWidth, strokeLinejoin: "round" }),
@@ -31494,10 +31841,10 @@ function ShapeSmartContractNode({ node, active, lang }) {
31494
31841
  };
31495
31842
  return /* @__PURE__ */ jsxs("g", { children: [
31496
31843
  fitArt(r, smartContractExtent(frame.strokeWidth), art),
31497
- bottomLabel2(node, r.cx, r.label)
31844
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31498
31845
  ] });
31499
31846
  }
31500
- var \u5B57\u306E\u5E45 = (text, size) => \u7D75\u306E\u4E2D\u306E\u5B57\u306E\u5E45(text, size);
31847
+ var \u5B57\u306E\u5E45 = (text, size, textMetrics = "proportional") => \u7D75\u306E\u4E2D\u306E\u5B57\u306E\u5E45(text, size, 0, textMetrics);
31501
31848
  var BLOCK_DEFAULT_FIELDS = [
31502
31849
  { key: "hash", label: "blockchainBlock.hash", value: { text: "0xaf31..." } },
31503
31850
  { key: "prev", label: "blockchainBlock.prev", value: { text: "0x7b3f..." } },
@@ -31505,10 +31852,16 @@ var BLOCK_DEFAULT_FIELDS = [
31505
31852
  { key: "nonce", label: "blockchainBlock.nonce", value: { text: "82,914" } },
31506
31853
  { key: "tx", label: "blockchainBlock.tx", value: { \u8F9E\u66F8: "blockchainBlock.txCount" } }
31507
31854
  ];
31508
- function ShapeBlockchainBlockNode({ node, active, lang }) {
31855
+ function ShapeBlockchainBlockNode({
31856
+ node,
31857
+ active,
31858
+ lang,
31859
+ textMetrics = "proportional"
31860
+ }) {
31509
31861
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
31510
31862
  const frame = commonFrame4(active);
31511
31863
  const r = shapeRegion(node);
31864
+ const \u6E2C\u308B\u5B57 = (text, size) => \u5B57\u306E\u5E45(text, size, textMetrics);
31512
31865
  const bw = BLOCK_W;
31513
31866
  const bh = BLOCK_H;
31514
31867
  const cx = r.cx;
@@ -31529,9 +31882,9 @@ function ShapeBlockchainBlockNode({ node, active, lang }) {
31529
31882
  const \u5E2F\u306E\u6B8B\u308A = bw - 14 - 30;
31530
31883
  const \u80A9\u66F8\u306E\u9699\u9593 = 8;
31531
31884
  const \u80A9\u66F8\u306E\u4E0A\u9650 = (\u5E2F\u306E\u6B8B\u308A - \u80A9\u66F8\u306E\u9699\u9593) / 2;
31532
- const \u80A9\u66F8\u306E\u500D\u7387 = \u80A9\u66F8 === "" ? 1 : \u5E45\u306E\u500D\u7387(\u80A9\u66F8, \u80A9\u66F8\u306E\u5B57, 0, \u80A9\u66F8\u306E\u4E0A\u9650);
31885
+ const \u80A9\u66F8\u306E\u500D\u7387 = \u80A9\u66F8 === "" ? 1 : \u5E45\u306E\u500D\u7387(\u80A9\u66F8, \u80A9\u66F8\u306E\u5B57, 0, \u80A9\u66F8\u306E\u4E0A\u9650, textMetrics);
31533
31886
  const \u80A9\u66F8\u306E\u6307\u5B9A = \u80A9\u66F8\u306E\u5B57 * \u80A9\u66F8\u306E\u500D\u7387;
31534
- const \u80A9\u66F8\u306E\u5E45 = \u80A9\u66F8 === "" ? 0 : \u5B57\u306E\u5E45(\u80A9\u66F8, \u80A9\u66F8\u306E\u6307\u5B9A);
31887
+ const \u80A9\u66F8\u306E\u5E45 = \u80A9\u66F8 === "" ? 0 : \u6E2C\u308B\u5B57(\u80A9\u66F8, \u80A9\u66F8\u306E\u6307\u5B9A);
31535
31888
  const \u898B\u51FA\u3057\u306E\u5E45 = \u5E2F\u306E\u6B8B\u308A - (\u80A9\u66F8 === "" ? 0 : \u80A9\u66F8\u306E\u5E45 + \u80A9\u66F8\u306E\u9699\u9593);
31536
31889
  const \u6253\u3061\u6D88\u3059\u5B57\u3089 = [
31537
31890
  { text: \u898B\u51FA\u3057, size: \u898B\u51FA\u3057\u306E\u5B57, \u5E2F: { \u5E45: \u898B\u51FA\u3057\u306E\u5E45, \u9AD8\u3055: \u898B\u51FA\u3057\u306E\u5E2F } },
@@ -31542,12 +31895,12 @@ function ShapeBlockchainBlockNode({ node, active, lang }) {
31542
31895
  {
31543
31896
  text: f.value,
31544
31897
  size: \u5024\u306E\u5B57,
31545
- \u5E2F: { \u5E45: bw - 28 - \u5B57\u306E\u5E45(f.label, \u540D\u306E\u5B57) - 8, \u9AD8\u3055: \u884C\u306E\u9593\u9694 }
31898
+ \u5E2F: { \u5E45: bw - 28 - \u6E2C\u308B\u5B57(f.label, \u540D\u306E\u5B57) - 8, \u9AD8\u3055: \u884C\u306E\u9593\u9694 }
31546
31899
  }
31547
31900
  ])
31548
31901
  ];
31549
31902
  const art = (\u500D\u7387) => {
31550
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
31903
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
31551
31904
  const \u984C\u306E\u5927\u304D\u3055 = \u898B\u51FA\u3057\u306E\u5B57 * \u500D;
31552
31905
  const \u80A9\u66F8\u306E\u5927\u304D\u3055 = \u80A9\u66F8\u306E\u6307\u5B9A * \u500D;
31553
31906
  const \u540D\u306E\u5927\u304D\u3055 = \u540D\u306E\u5B57 * \u500D;
@@ -31556,7 +31909,7 @@ function ShapeBlockchainBlockNode({ node, active, lang }) {
31556
31909
  /* @__PURE__ */ jsx("rect", { x: x + 6, y: y + 6, width: bw, height: bh, rx: 8, fill: frame.stroke, opacity: 0.2, stroke: "none" }),
31557
31910
  /* @__PURE__ */ jsx("rect", { "data-cdl-role": "node-body", x, y, width: bw, height: bh, rx: 8, ...frame }),
31558
31911
  /* @__PURE__ */ jsx("path", { d: `M ${x} ${y + 32} L ${x} ${y + 8} Q ${x} ${y}, ${x + 8} ${y} L ${x + bw - 8} ${y} Q ${x + bw} ${y}, ${x + bw} ${y + 8} L ${x + bw} ${y + 32} Z`, fill: "var(--cdl-tone-accent, #2d6a8f)", fillOpacity: 0.9, stroke: "none" }),
31559
- /* @__PURE__ */ jsx("text", { "data-cdl-role": "blockchain-block-title", "data-cdl-counter-scaled": "1", x: x + 14, y: y + 22, fontSize: \u984C\u306E\u5927\u304D\u3055, fontWeight: 700, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: "#ffffff", children: \u5E45\u3067\u5207\u308B(\u898B\u51FA\u3057, \u984C\u306E\u5927\u304D\u3055, \u898B\u51FA\u3057\u306E\u5E45, \u5B57\u306E\u5E45) }),
31912
+ /* @__PURE__ */ jsx("text", { "data-cdl-role": "blockchain-block-title", "data-cdl-counter-scaled": "1", x: x + 14, y: y + 22, fontSize: \u984C\u306E\u5927\u304D\u3055, fontWeight: 700, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: "#ffffff", children: \u5E45\u3067\u5207\u308B(\u898B\u51FA\u3057, \u984C\u306E\u5927\u304D\u3055, \u898B\u51FA\u3057\u306E\u5E45, \u6E2C\u308B\u5B57) }),
31560
31913
  \u80A9\u66F8 !== "" && /* @__PURE__ */ jsx(
31561
31914
  "text",
31562
31915
  {
@@ -31576,7 +31929,12 @@ function ShapeBlockchainBlockNode({ node, active, lang }) {
31576
31929
  /* @__PURE__ */ jsx("circle", { cx: x + bw - 16, cy: y + 16, r: 5.5, fill: "#7cd88f", stroke: "#ffffff", strokeWidth: 1.5 }),
31577
31930
  fields.map((f, i) => /* @__PURE__ */ jsxs("g", { children: [
31578
31931
  /* @__PURE__ */ jsx("text", { "data-cdl-counter-scaled": "1", x: x + 14, y: y + 54 + i * \u884C\u306E\u9593\u9694, fontSize: \u540D\u306E\u5927\u304D\u3055, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fill: "var(--cdl-text-dim, #5a6270)", children: f.label }),
31579
- /* @__PURE__ */ jsx("text", { "data-cdl-role": `blockchain-block-${f.key}`, "data-cdl-counter-scaled": "1", x: x + bw - 14, y: y + 54 + i * \u884C\u306E\u9593\u9694, fontSize: \u5024\u306E\u5927\u304D\u3055, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fontWeight: 600, textAnchor: "end", fill: "var(--cdl-text, #1a1f2a)", children: \u5E45\u3067\u5207\u308B(f.value, \u5024\u306E\u5927\u304D\u3055, bw - 28 - \u5B57\u306E\u5E45(f.label, \u540D\u306E\u5927\u304D\u3055) - 8, \u5B57\u306E\u5E45) }),
31932
+ /* @__PURE__ */ jsx("text", { "data-cdl-role": `blockchain-block-${f.key}`, "data-cdl-counter-scaled": "1", x: x + bw - 14, y: y + 54 + i * \u884C\u306E\u9593\u9694, fontSize: \u5024\u306E\u5927\u304D\u3055, fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", fontWeight: 600, textAnchor: "end", fill: "var(--cdl-text, #1a1f2a)", children: \u5E45\u3067\u5207\u308B(
31933
+ f.value,
31934
+ \u5024\u306E\u5927\u304D\u3055,
31935
+ bw - 28 - \u6E2C\u308B\u5B57(f.label, \u540D\u306E\u5927\u304D\u3055) - 8,
31936
+ \u6E2C\u308B\u5B57
31937
+ ) }),
31580
31938
  /* @__PURE__ */ jsx("line", { x1: x + 14, y1: y + 60 + i * \u884C\u306E\u9593\u9694, x2: x + bw - 14, y2: y + 60 + i * \u884C\u306E\u9593\u9694, stroke: "var(--cdl-divider, #d4d4d8)", strokeWidth: 0.5, opacity: 0.5 })
31581
31939
  ] }, i)),
31582
31940
  /* @__PURE__ */ jsxs("g", { transform: `translate(${cx - 32}, ${y + bh - 26})`, children: [
@@ -31588,7 +31946,11 @@ function ShapeBlockchainBlockNode({ node, active, lang }) {
31588
31946
  };
31589
31947
  return /* @__PURE__ */ jsx("g", { children: fitArt(r, blockchainBlockExtent(frame.strokeWidth), art) });
31590
31948
  }
31591
- function ShapeBlockchainNode({ node, active }) {
31949
+ function ShapeBlockchainNode({
31950
+ node,
31951
+ active,
31952
+ textMetrics = "proportional"
31953
+ }) {
31592
31954
  const frame = commonFrame4(active);
31593
31955
  const r = shapeRegion(node);
31594
31956
  const cx = r.cx;
@@ -31604,7 +31966,7 @@ function ShapeBlockchainNode({ node, active }) {
31604
31966
  { text: "0x\u2026", size: CHAIN_HASH_SIZE, \u5E2F: { \u5E45: CHAIN_TEXT_W, \u9AD8\u3055: CHAIN_ROW_GAP } }
31605
31967
  ];
31606
31968
  const art = (\u500D\u7387) => {
31607
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
31969
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
31608
31970
  return /* @__PURE__ */ jsx("g", { children: Array.from({ length: blockCount }, (_, i) => i).map((i) => {
31609
31971
  const bx = startX + i * (blockW + linkW);
31610
31972
  const isCurrent = i === blockCount - 1;
@@ -31640,10 +32002,14 @@ function ShapeBlockchainNode({ node, active }) {
31640
32002
  };
31641
32003
  return /* @__PURE__ */ jsxs("g", { children: [
31642
32004
  fitArt(r, chainExtent(), art),
31643
- bottomLabel2(node, r.cx, r.label)
32005
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31644
32006
  ] });
31645
32007
  }
31646
- function ShapeBitcoinChainNode({ node, active }) {
32008
+ function ShapeBitcoinChainNode({
32009
+ node,
32010
+ active,
32011
+ textMetrics = "proportional"
32012
+ }) {
31647
32013
  const frame = commonFrame4(active);
31648
32014
  const r = shapeRegion(node);
31649
32015
  const cx = r.cx;
@@ -31659,7 +32025,7 @@ function ShapeBitcoinChainNode({ node, active }) {
31659
32025
  { text: "#820", size: BTC_NO_SIZE, \u5E2F: { \u5E45: CHAIN_TEXT_W, \u9AD8\u3055: 20 } }
31660
32026
  ];
31661
32027
  const art = (\u500D\u7387) => {
31662
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
32028
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
31663
32029
  return /* @__PURE__ */ jsx("g", { children: Array.from({ length: blockCount }, (_, i) => i).map((i) => {
31664
32030
  const bx = startX + i * (blockW + linkW);
31665
32031
  const isCurrent = i === blockCount - 1;
@@ -31690,10 +32056,14 @@ function ShapeBitcoinChainNode({ node, active }) {
31690
32056
  };
31691
32057
  return /* @__PURE__ */ jsxs("g", { children: [
31692
32058
  fitArt(r, chainExtent(), art),
31693
- bottomLabel2(node, r.cx, r.label)
32059
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31694
32060
  ] });
31695
32061
  }
31696
- function ShapeEthereumChainNode({ node, active }) {
32062
+ function ShapeEthereumChainNode({
32063
+ node,
32064
+ active,
32065
+ textMetrics = "proportional"
32066
+ }) {
31697
32067
  const frame = commonFrame4(active);
31698
32068
  const r = shapeRegion(node);
31699
32069
  const cx = r.cx;
@@ -31709,7 +32079,7 @@ function ShapeEthereumChainNode({ node, active }) {
31709
32079
  { text: "#214", size: ETH_NO_SIZE, \u5E2F: { \u5E45: CHAIN_TEXT_W, \u9AD8\u3055: 20 } }
31710
32080
  ];
31711
32081
  const art = (\u500D\u7387) => {
31712
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
32082
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
31713
32083
  return /* @__PURE__ */ jsx("g", { children: Array.from({ length: blockCount }, (_, i) => i).map((i) => {
31714
32084
  const bx = startX + i * (blockW + linkW);
31715
32085
  const isCurrent = i === blockCount - 1;
@@ -31741,10 +32111,14 @@ function ShapeEthereumChainNode({ node, active }) {
31741
32111
  };
31742
32112
  return /* @__PURE__ */ jsxs("g", { children: [
31743
32113
  fitArt(r, chainExtent(), art),
31744
- bottomLabel2(node, r.cx, r.label)
32114
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31745
32115
  ] });
31746
32116
  }
31747
- function ShapeBlockchainNodeNode({ node, active }) {
32117
+ function ShapeBlockchainNodeNode({
32118
+ node,
32119
+ active,
32120
+ textMetrics = "proportional"
32121
+ }) {
31748
32122
  const frame = commonFrame4(active);
31749
32123
  const r = shapeRegion(node);
31750
32124
  const cx = r.cx;
@@ -31798,10 +32172,15 @@ function ShapeBlockchainNodeNode({ node, active }) {
31798
32172
  ] });
31799
32173
  return /* @__PURE__ */ jsxs("g", { children: [
31800
32174
  fitArt(r, blockchainNodeExtent(frame.strokeWidth), art),
31801
- bottomLabel2(node, r.cx, r.label)
32175
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31802
32176
  ] });
31803
32177
  }
31804
- function ShapeRpcNodeNode({ node, active, lang }) {
32178
+ function ShapeRpcNodeNode({
32179
+ node,
32180
+ active,
32181
+ lang,
32182
+ textMetrics = "proportional"
32183
+ }) {
31805
32184
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
31806
32185
  const frame = commonFrame4(active);
31807
32186
  const r = shapeRegion(node);
@@ -31820,10 +32199,10 @@ function ShapeRpcNodeNode({ node, active, lang }) {
31820
32199
  /* @__PURE__ */ jsx("text", { x: cx, y: cy + 26, fontSize: 11, textAnchor: "middle", fill: "#7a8290", fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace", children: "JSON-RPC 2.0" }),
31821
32200
  /* @__PURE__ */ jsx("rect", { x: x + 16, y: y + bh - 24, width: bw - 32, height: 8, rx: 4, fill: "#0f1419", stroke: "none" }),
31822
32201
  /* @__PURE__ */ jsx("rect", { x: x + 16, y: y + bh - 24, width: (bw - 32) * 0.92, height: 8, rx: 4, fill: "#27c93f", stroke: "none", children: /* @__PURE__ */ jsx("animate", { attributeName: "width", values: `${(bw - 32) * 0.86};${(bw - 32) * 0.96};${(bw - 32) * 0.86}`, dur: "3s", repeatCount: "indefinite" }) }),
31823
- bottomLabel2(node, r.cx, r.label)
32202
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31824
32203
  ] });
31825
32204
  }
31826
- function ShapeWalletNode({ node, active }) {
32205
+ function ShapeWalletNode({ node, active, textMetrics = "proportional" }) {
31827
32206
  const frame = commonFrame4(active);
31828
32207
  const r = shapeRegion(node);
31829
32208
  const cx = r.cx;
@@ -31897,10 +32276,10 @@ function ShapeWalletNode({ node, active }) {
31897
32276
  /* @__PURE__ */ jsx("text", { x: cx, y: foldY + 3, fontSize: 9, fontWeight: 700, fill: "#5a3a10", textAnchor: "middle", opacity: 0.8, children: "\u039E" }),
31898
32277
  /* @__PURE__ */ jsx("path", { d: `M ${x + 2} ${y + 6} L ${x + w - 2} ${y + 6}`, fill: "none", stroke: "#ffffff", strokeWidth: 1, opacity: 0.4 })
31899
32278
  ] }),
31900
- bottomLabel2(node, r.cx, r.label)
32279
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31901
32280
  ] });
31902
32281
  }
31903
- function ShapeNftNode({ node, active }) {
32282
+ function ShapeNftNode({ node, active, textMetrics = "proportional" }) {
31904
32283
  const frame = commonFrame4(active);
31905
32284
  const r = shapeRegion(node);
31906
32285
  const cx = r.cx;
@@ -31916,7 +32295,7 @@ function ShapeNftNode({ node, active }) {
31916
32295
  { text: "#1024", size: NFT_ID_SIZE, \u5E2F: { \u5E45: cardW - 16 - 34, \u9AD8\u3055: cardH - artH } }
31917
32296
  ];
31918
32297
  const art = (\u500D\u7387) => {
31919
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
32298
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
31920
32299
  return /* @__PURE__ */ jsxs("g", { children: [
31921
32300
  /* @__PURE__ */ jsx("rect", { x: x + 4, y: y + 4, width: cardW, height: cardH, rx: 14, fill: frame.stroke, opacity: 0.2, stroke: "none" }),
31922
32301
  /* @__PURE__ */ jsx("rect", { "data-cdl-role": "node-body", x, y, width: cardW, height: cardH, rx: 14, ...frame }),
@@ -31954,10 +32333,10 @@ function ShapeNftNode({ node, active }) {
31954
32333
  };
31955
32334
  return /* @__PURE__ */ jsxs("g", { children: [
31956
32335
  fitArt(r, nftExtent(frame.strokeWidth), art),
31957
- bottomLabel2(node, r.cx, r.label)
32336
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31958
32337
  ] });
31959
32338
  }
31960
- function ShapeTokenNode({ node, active }) {
32339
+ function ShapeTokenNode({ node, active, textMetrics = "proportional" }) {
31961
32340
  const frame = commonFrame4(active);
31962
32341
  const r = shapeRegion(node);
31963
32342
  const cx = r.cx;
@@ -31994,7 +32373,7 @@ function ShapeTokenNode({ node, active }) {
31994
32373
  }
31995
32374
  }
31996
32375
  ),
31997
- bottomLabel2(node, r.cx, r.label)
32376
+ bottomLabel2(node, r.cx, r.label, textMetrics)
31998
32377
  ] });
31999
32378
  }
32000
32379
  var commonFrame5 = (active) => ({
@@ -32013,7 +32392,8 @@ function \u5B57\u306E\u6BD4(c) {
32013
32392
  if (\u5E83\u5B57.has(c)) return \u5E83\u5B57\u6BD4;
32014
32393
  return (c.codePointAt(0) ?? 0) < 128 ? \u4E26\u5B57\u6BD4 : \u5E83\u5B57\u6BD4;
32015
32394
  }
32016
- function \u5B57\u5E45(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593) {
32395
+ function \u5B57\u5E45(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, textMetrics = "proportional") {
32396
+ if (textMetrics === "monospace") return textWidth(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, textMetrics);
32017
32397
  let \u5E45 = 0;
32018
32398
  let \u5B57\u6570 = 0;
32019
32399
  for (const c of \u6587\u5B57\u5217) {
@@ -32022,18 +32402,33 @@ function \u5B57\u5E45(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593) {
32022
32402
  }
32023
32403
  return \u5E45 + \u5B57\u9593 * \u5B57\u6570;
32024
32404
  }
32025
- function \u5E45\u306B\u53CE\u3081\u308B3(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u984C\u304B = false) {
32026
- const \u5E45 = \u5B57\u5E45(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593);
32027
- const \u4E0B\u9650 = \u984C\u304B ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u5B57\u5E45) : 0;
32405
+ function \u5E45\u306B\u53CE\u3081\u308B3(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u984C\u304B = false, textMetrics = "proportional") {
32406
+ const \u6E2C\u308B = (t, s, ls) => \u5B57\u5E45(t, s, ls, textMetrics);
32407
+ const \u5E45 = \u6E2C\u308B(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593);
32408
+ const \u4E0B\u9650 = \u984C\u304B ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u6E2C\u308B) : 0;
32028
32409
  const \u500D\u7387 = \u5E45 > 0 && \u7BB1\u5E45 > 0 ? Math.min(1, Math.max(\u7BB1\u5E45 / \u5E45, \u4E0B\u9650)) : 1;
32029
32410
  const size = \u5927\u304D\u3055 * \u500D\u7387;
32030
32411
  const spacing = \u5B57\u9593 * \u500D\u7387;
32031
- return { size, spacing, text: \u5E2F\u3067\u5207\u308B(\u6587\u5B57\u5217, size, \u7BB1\u5E45, (u, f) => \u5B57\u5E45(u, f, spacing)) };
32032
- }
32033
- function bottomLabel3(node, cx, plan) {
32034
- const \u80A9 = \u5E45\u306B\u53CE\u3081\u308B3(node.eyebrow ?? "", plan.\u80A9\u66F8?.size ?? 0, LABEL_EYEBROW_SPACING2, node.w);
32035
- const \u540D = \u5E45\u306B\u53CE\u3081\u308B3(node.title ?? "", plan.\u540D\u524D.size, 0, node.w, true);
32036
- const \u8AAC = \u5E45\u306B\u53CE\u3081\u308B3(node.subtitle ?? "", plan.\u8AAC\u660E?.size ?? 0, 0, node.w);
32412
+ return { size, spacing, text: \u5E2F\u3067\u5207\u308B(\u6587\u5B57\u5217, size, \u7BB1\u5E45, (u, f) => \u6E2C\u308B(u, f, spacing)) };
32413
+ }
32414
+ function bottomLabel3(node, cx, plan, textMetrics = "proportional") {
32415
+ const \u80A9 = \u5E45\u306B\u53CE\u3081\u308B3(
32416
+ node.eyebrow ?? "",
32417
+ plan.\u80A9\u66F8?.size ?? 0,
32418
+ LABEL_EYEBROW_SPACING2,
32419
+ node.w,
32420
+ false,
32421
+ textMetrics
32422
+ );
32423
+ const \u540D = \u5E45\u306B\u53CE\u3081\u308B3(node.title ?? "", plan.\u540D\u524D.size, 0, node.w, true, textMetrics);
32424
+ const \u8AAC = \u5E45\u306B\u53CE\u3081\u308B3(
32425
+ node.subtitle ?? "",
32426
+ plan.\u8AAC\u660E?.size ?? 0,
32427
+ 0,
32428
+ node.w,
32429
+ false,
32430
+ textMetrics
32431
+ );
32037
32432
  return /* @__PURE__ */ jsxs(Fragment, { children: [
32038
32433
  node.eyebrow && plan.\u80A9\u66F8 && /* @__PURE__ */ jsx("text", { x: cx, y: plan.\u80A9\u66F8.y, fontSize: \u80A9.size, fontWeight: 700, letterSpacing: \u80A9.spacing, textAnchor: "middle", fill: "var(--cdl-tone-accent, #2d6a8f)", children: \u80A9.text }),
32039
32434
  /* @__PURE__ */ jsx("text", { "data-cdl-role": "node-label", x: cx, y: plan.\u540D\u524D.y, fontSize: \u540D.size, fontWeight: 700, textAnchor: "middle", fill: "var(--cdl-text, #1a1f2a)", children: \u540D.text }),
@@ -32052,7 +32447,7 @@ var BANK_STEP_SW = 1;
32052
32447
  var BANK_COLUMN_MIN = 24;
32053
32448
  var BANK_BLD_W_MIN = 120;
32054
32449
  var BANK_BLD_W_MAX = 280;
32055
- function ShapeBankNode({ node, active }) {
32450
+ function ShapeBankNode({ node, active, textMetrics = "proportional" }) {
32056
32451
  const frame = commonFrame5(active);
32057
32452
  const r = shapeRegion(node);
32058
32453
  const \u7DDA = frame.strokeWidth / 2;
@@ -32099,7 +32494,7 @@ function ShapeBankNode({ node, active }) {
32099
32494
  ] });
32100
32495
  return /* @__PURE__ */ jsxs("g", { children: [
32101
32496
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32102
- bottomLabel3(node, r.cx, r.label)
32497
+ bottomLabel3(node, r.cx, r.label, textMetrics)
32103
32498
  ] });
32104
32499
  }
32105
32500
  var TRUST_CROWN_RISE = 4;
@@ -32111,7 +32506,12 @@ var TRUST_BASE_H = 14;
32111
32506
  var TRUST_BODY_OUT = 8;
32112
32507
  var TRUST_BLD_W_MIN = 140;
32113
32508
  var TRUST_BLD_W_MAX = 280;
32114
- function ShapeTrustBankNode({ node, active, lang }) {
32509
+ function ShapeTrustBankNode({
32510
+ node,
32511
+ active,
32512
+ lang,
32513
+ textMetrics = "proportional"
32514
+ }) {
32115
32515
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32116
32516
  const frame = commonFrame5(active);
32117
32517
  const r = shapeRegion(node);
@@ -32165,10 +32565,15 @@ function ShapeTrustBankNode({ node, active, lang }) {
32165
32565
  ] });
32166
32566
  return /* @__PURE__ */ jsxs("g", { children: [
32167
32567
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32168
- bottomLabel3(node, r.cx, r.label)
32568
+ bottomLabel3(node, r.cx, r.label, textMetrics)
32169
32569
  ] });
32170
32570
  }
32171
- function ShapePaymentProviderNode({ node, active, lang }) {
32571
+ function ShapePaymentProviderNode({
32572
+ node,
32573
+ active,
32574
+ lang,
32575
+ textMetrics = "proportional"
32576
+ }) {
32172
32577
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32173
32578
  const frame = commonFrame5(active);
32174
32579
  const r = shapeRegion(node);
@@ -32193,10 +32598,14 @@ function ShapePaymentProviderNode({ node, active, lang }) {
32193
32598
  /* @__PURE__ */ jsx("text", { x: cx, y: cy + 9, fontSize: 13, fontWeight: 700, textAnchor: "middle", fill: accentDarker, fontFamily: "Georgia, serif", children: "$" })
32194
32599
  ] }),
32195
32600
  /* @__PURE__ */ jsx("text", { x: cx, y: y + boxH - 16, fontSize: 11, fontWeight: 700, letterSpacing: 2, textAnchor: "middle", fill: "#a4b5f2", children: \u5B57\u5F15("paymentProvider.status") }),
32196
- bottomLabel3(node, r.cx, r.label)
32601
+ bottomLabel3(node, r.cx, r.label, textMetrics)
32197
32602
  ] });
32198
32603
  }
32199
- function ShapeCreditCardNode({ node, active }) {
32604
+ function ShapeCreditCardNode({
32605
+ node,
32606
+ active,
32607
+ textMetrics = "proportional"
32608
+ }) {
32200
32609
  const frame = commonFrame5(active);
32201
32610
  const r = shapeRegion(node);
32202
32611
  const cardW = Math.min(r.availW - 30, 260);
@@ -32218,7 +32627,7 @@ function ShapeCreditCardNode({ node, active }) {
32218
32627
  [0, 1, 2, 3].map((block) => /* @__PURE__ */ jsx("g", { children: [0, 1, 2, 3].map((dot) => /* @__PURE__ */ jsx("circle", { cx: x + 32 + block * (cardW - 64) / 4 + dot * 8, cy: y + cardH - 40, r: 2.8, fill: "#ffffff", stroke: "none" }, dot)) }, block)),
32219
32628
  /* @__PURE__ */ jsx("circle", { cx: x + cardW - 48, cy: y + cardH - 24, r: 15, fill: "#c9302c", opacity: 0.9, stroke: "none" }),
32220
32629
  /* @__PURE__ */ jsx("circle", { cx: x + cardW - 30, cy: y + cardH - 24, r: 15, fill: "#e5c07b", opacity: 0.9, stroke: "none" }),
32221
- bottomLabel3(node, r.cx, r.label)
32630
+ bottomLabel3(node, r.cx, r.label, textMetrics)
32222
32631
  ] });
32223
32632
  }
32224
32633
  var BROKERAGE_TICK_H = 18;
@@ -32243,7 +32652,12 @@ var BROKERAGE_SHADE_OUT = 2;
32243
32652
  var BROKERAGE_W_MIN = BROKERAGE_COLS * BROKERAGE_CELL_W + (BROKERAGE_COLS - 1) * BROKERAGE_GAP_X + 6;
32244
32653
  var BROKERAGE_W_MAX = 140;
32245
32654
  var BROKERAGE_H_MIN = BROKERAGE_TICK_H + BROKERAGE_LOGO_H + BROKERAGE_BASE_H;
32246
- function ShapeBrokerageNode({ node, active, lang }) {
32655
+ function ShapeBrokerageNode({
32656
+ node,
32657
+ active,
32658
+ lang,
32659
+ textMetrics = "proportional"
32660
+ }) {
32247
32661
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32248
32662
  const frame = commonFrame5(active);
32249
32663
  const r = shapeRegion(node);
@@ -32282,7 +32696,7 @@ function ShapeBrokerageNode({ node, active, lang }) {
32282
32696
  }
32283
32697
  ];
32284
32698
  const \u7D75 = (\u500D\u7387) => {
32285
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
32699
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
32286
32700
  return /* @__PURE__ */ jsxs("g", { children: [
32287
32701
  /* @__PURE__ */ jsx("ellipse", { cx, cy: y + h + BROKERAGE_SHADOW_DY, rx: w * BROKERAGE_SHADOW_RX_RATIO, ry: BROKERAGE_SHADOW_RY, fill: frame.stroke, opacity: 0.2, stroke: "none" }),
32288
32702
  /* @__PURE__ */ jsx("rect", { "data-cdl-role": "node-body", x, y, width: w, height: h, fill: "#255a7a", stroke: accentDarker, strokeWidth: frame.strokeWidth }),
@@ -32310,12 +32724,17 @@ function ShapeBrokerageNode({ node, active, lang }) {
32310
32724
  };
32311
32725
  return /* @__PURE__ */ jsxs("g", { children: [
32312
32726
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32313
- bottomLabel3(node, r.cx, r.label)
32727
+ bottomLabel3(node, r.cx, r.label, textMetrics)
32314
32728
  ] });
32315
32729
  }
32316
32730
  var EXCHANGE_SUB_SIZE = 11;
32317
32731
  var EXCHANGE_HEX_R = 52;
32318
- function ShapeExchangeNode({ node, active, lang }) {
32732
+ function ShapeExchangeNode({
32733
+ node,
32734
+ active,
32735
+ lang,
32736
+ textMetrics = "proportional"
32737
+ }) {
32319
32738
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32320
32739
  const frame = commonFrame5(active);
32321
32740
  const r = shapeRegion(node);
@@ -32360,7 +32779,7 @@ function ShapeExchangeNode({ node, active, lang }) {
32360
32779
  }
32361
32780
  ];
32362
32781
  const \u7D75 = (\u500D\u7387) => {
32363
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
32782
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
32364
32783
  return /* @__PURE__ */ jsxs("g", { children: [
32365
32784
  nodes.map((n, i) => /* @__PURE__ */ jsx("line", { x1: cx, y1: cy, x2: n.cx, y2: n.cy, stroke: accentDarker, strokeWidth: 1.5, strokeDasharray: "3 2" }, `l${i}`)),
32366
32785
  nodes.map((n, i) => {
@@ -32379,7 +32798,7 @@ function ShapeExchangeNode({ node, active, lang }) {
32379
32798
  };
32380
32799
  return /* @__PURE__ */ jsxs("g", { children: [
32381
32800
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32382
- bottomLabel3(node, r.cx, r.label)
32801
+ bottomLabel3(node, r.cx, r.label, textMetrics)
32383
32802
  ] });
32384
32803
  }
32385
32804
  var ATM_SIGN_H = 26;
@@ -32396,7 +32815,12 @@ var ATM_PANEL_H = 146;
32396
32815
  var ATM_W_MIN = 100;
32397
32816
  var ATM_W_MAX = ATM_PANEL_W;
32398
32817
  var ATM_H_MIN = ATM_SIGN_H + ATM_SIGN_GAP + 30 + ATM_FLOOR_RESERVE;
32399
- function ShapeAtmNode({ node, active, lang }) {
32818
+ function ShapeAtmNode({
32819
+ node,
32820
+ active,
32821
+ lang,
32822
+ textMetrics = "proportional"
32823
+ }) {
32400
32824
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32401
32825
  const frame = commonFrame5(active);
32402
32826
  const r = shapeRegion(node);
@@ -32480,7 +32904,7 @@ function ShapeAtmNode({ node, active, lang }) {
32480
32904
  ] });
32481
32905
  return /* @__PURE__ */ jsxs("g", { children: [
32482
32906
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32483
- bottomLabel3(node, r.cx, r.label)
32907
+ bottomLabel3(node, r.cx, r.label, textMetrics)
32484
32908
  ] });
32485
32909
  }
32486
32910
  var commonFrame6 = (active) => ({
@@ -32499,7 +32923,8 @@ function \u5B57\u306E\u6BD42(c) {
32499
32923
  if (\u5E83\u5B572.has(c)) return \u5E83\u5B57\u6BD42;
32500
32924
  return (c.codePointAt(0) ?? 0) < 128 ? \u4E26\u5B57\u6BD42 : \u5E83\u5B57\u6BD42;
32501
32925
  }
32502
- function \u5B57\u5E452(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593) {
32926
+ function \u5B57\u5E452(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, textMetrics = "proportional") {
32927
+ if (textMetrics === "monospace") return textWidth(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, textMetrics);
32503
32928
  let \u5E45 = 0;
32504
32929
  let \u5B57\u6570 = 0;
32505
32930
  for (const c of \u6587\u5B57\u5217) {
@@ -32508,18 +32933,33 @@ function \u5B57\u5E452(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593) {
32508
32933
  }
32509
32934
  return \u5E45 + \u5B57\u9593 * \u5B57\u6570;
32510
32935
  }
32511
- function \u5E45\u306B\u53CE\u3081\u308B4(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u984C\u304B = false) {
32512
- const \u5E45 = \u5B57\u5E452(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593);
32513
- const \u4E0B\u9650 = \u984C\u304B ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u5B57\u5E452) : 0;
32936
+ function \u5E45\u306B\u53CE\u3081\u308B4(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u984C\u304B = false, textMetrics = "proportional") {
32937
+ const \u6E2C\u308B = (t, s, ls) => \u5B57\u5E452(t, s, ls, textMetrics);
32938
+ const \u5E45 = \u6E2C\u308B(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593);
32939
+ const \u4E0B\u9650 = \u984C\u304B ? \u5207\u3063\u3066\u53CE\u307E\u308B\u4E0B\u9650(\u6587\u5B57\u5217, \u5927\u304D\u3055, \u5B57\u9593, \u7BB1\u5E45, \u6E2C\u308B) : 0;
32514
32940
  const \u500D\u7387 = \u5E45 > 0 && \u7BB1\u5E45 > 0 ? Math.min(1, Math.max(\u7BB1\u5E45 / \u5E45, \u4E0B\u9650)) : 1;
32515
32941
  const size = \u5927\u304D\u3055 * \u500D\u7387;
32516
32942
  const spacing = \u5B57\u9593 * \u500D\u7387;
32517
- return { size, spacing, text: \u5E2F\u3067\u5207\u308B(\u6587\u5B57\u5217, size, \u7BB1\u5E45, (u, f) => \u5B57\u5E452(u, f, spacing)) };
32518
- }
32519
- function bottomLabel4(node, cx, plan) {
32520
- const \u80A9 = \u5E45\u306B\u53CE\u3081\u308B4(node.eyebrow ?? "", plan.\u80A9\u66F8?.size ?? 0, LABEL_EYEBROW_SPACING3, node.w);
32521
- const \u540D = \u5E45\u306B\u53CE\u3081\u308B4(node.title ?? "", plan.\u540D\u524D.size, 0, node.w, true);
32522
- const \u8AAC = \u5E45\u306B\u53CE\u3081\u308B4(node.subtitle ?? "", plan.\u8AAC\u660E?.size ?? 0, 0, node.w);
32943
+ return { size, spacing, text: \u5E2F\u3067\u5207\u308B(\u6587\u5B57\u5217, size, \u7BB1\u5E45, (u, f) => \u6E2C\u308B(u, f, spacing)) };
32944
+ }
32945
+ function bottomLabel4(node, cx, plan, textMetrics = "proportional") {
32946
+ const \u80A9 = \u5E45\u306B\u53CE\u3081\u308B4(
32947
+ node.eyebrow ?? "",
32948
+ plan.\u80A9\u66F8?.size ?? 0,
32949
+ LABEL_EYEBROW_SPACING3,
32950
+ node.w,
32951
+ false,
32952
+ textMetrics
32953
+ );
32954
+ const \u540D = \u5E45\u306B\u53CE\u3081\u308B4(node.title ?? "", plan.\u540D\u524D.size, 0, node.w, true, textMetrics);
32955
+ const \u8AAC = \u5E45\u306B\u53CE\u3081\u308B4(
32956
+ node.subtitle ?? "",
32957
+ plan.\u8AAC\u660E?.size ?? 0,
32958
+ 0,
32959
+ node.w,
32960
+ false,
32961
+ textMetrics
32962
+ );
32523
32963
  return /* @__PURE__ */ jsxs(Fragment, { children: [
32524
32964
  node.eyebrow && plan.\u80A9\u66F8 && /* @__PURE__ */ jsx("text", { x: cx, y: plan.\u80A9\u66F8.y, fontSize: \u80A9.size, fontWeight: 700, letterSpacing: \u80A9.spacing, textAnchor: "middle", fill: "var(--cdl-tone-accent, #2d6a8f)", children: \u80A9.text }),
32525
32965
  /* @__PURE__ */ jsx("text", { "data-cdl-role": "node-label", x: cx, y: plan.\u540D\u524D.y, fontSize: \u540D.size, fontWeight: 700, textAnchor: "middle", fill: "var(--cdl-text, #1a1f2a)", children: \u540D.text }),
@@ -32531,7 +32971,7 @@ var WEBSITE_BAR_H = 32;
32531
32971
  var WEBSITE_H_MIN = WEBSITE_BAR_H + 98;
32532
32972
  var WEBSITE_W_MIN = 160;
32533
32973
  var WEBSITE_W_MAX = 280;
32534
- function ShapeWebsiteNode({ node, active }) {
32974
+ function ShapeWebsiteNode({ node, active, textMetrics = "proportional" }) {
32535
32975
  const frame = commonFrame6(active);
32536
32976
  const r = shapeRegion(node);
32537
32977
  const cx = r.cx;
@@ -32557,10 +32997,10 @@ function ShapeWebsiteNode({ node, active }) {
32557
32997
  ] });
32558
32998
  return /* @__PURE__ */ jsxs("g", { children: [
32559
32999
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32560
- bottomLabel4(node, r.cx, r.label)
33000
+ bottomLabel4(node, r.cx, r.label, textMetrics)
32561
33001
  ] });
32562
33002
  }
32563
- function ShapeStorefrontNode({ node, active, lang }) {
33003
+ function ShapeStorefrontNode({ node, active, lang, textMetrics = "proportional" }) {
32564
33004
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32565
33005
  const frame = commonFrame6(active);
32566
33006
  const r = shapeRegion(node);
@@ -32605,7 +33045,7 @@ function ShapeStorefrontNode({ node, active, lang }) {
32605
33045
  /* @__PURE__ */ jsx("text", { x: doorX + doorW / 2, y: doorY + doorH * 0.85 + 11, fontSize: 11, fontWeight: 700, letterSpacing: 1, textAnchor: "middle", fill: "#5a3a10", children: \u5B57\u5F15("storefront.open") }),
32606
33046
  /* @__PURE__ */ jsx("circle", { cx: doorX + 6, cy: doorY + doorH * 0.55, r: 1.5, fill: "#c15a4a" }),
32607
33047
  /* @__PURE__ */ jsx("rect", { x: x - 6, y: y + bh - 6, width: bw + 12, height: 8, fill: "#5a6270", stroke: "none" }),
32608
- bottomLabel4(node, r.cx, r.label)
33048
+ bottomLabel4(node, r.cx, r.label, textMetrics)
32609
33049
  ] });
32610
33050
  }
32611
33051
  var WAREHOUSE_ROOF_H = 18;
@@ -32619,7 +33059,7 @@ var WAREHOUSE_SHADOW_RX_RATIO = 0.5;
32619
33059
  var WAREHOUSE_H_MIN = WAREHOUSE_ROOF_H + WAREHOUSE_SIGN_H + 68;
32620
33060
  var WAREHOUSE_W_MIN = 160;
32621
33061
  var WAREHOUSE_W_MAX = 240;
32622
- function ShapeWarehouseNode({ node, active, lang }) {
33062
+ function ShapeWarehouseNode({ node, active, lang, textMetrics = "proportional" }) {
32623
33063
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32624
33064
  const frame = commonFrame6(active);
32625
33065
  const r = shapeRegion(node);
@@ -32672,13 +33112,13 @@ function ShapeWarehouseNode({ node, active, lang }) {
32672
33112
  ] });
32673
33113
  return /* @__PURE__ */ jsxs("g", { children: [
32674
33114
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32675
- bottomLabel4(node, r.cx, r.label)
33115
+ bottomLabel4(node, r.cx, r.label, textMetrics)
32676
33116
  ] });
32677
33117
  }
32678
33118
  var HANDLE_GRIP_X = 118;
32679
33119
  var HANDLE_GRIP_R = 4;
32680
33120
  var CART_SHADOW_RX = 80;
32681
- function ShapeOnlineShopNode({ node, active }) {
33121
+ function ShapeOnlineShopNode({ node, active, textMetrics = "proportional" }) {
32682
33122
  const frame = commonFrame6(active);
32683
33123
  const r = shapeRegion(node);
32684
33124
  const cy = r.cy + 10;
@@ -32734,10 +33174,10 @@ function ShapeOnlineShopNode({ node, active }) {
32734
33174
  /* @__PURE__ */ jsx("circle", { cx: wheelR, cy: wheelY, r: 16 * s, fill: "#0f1830", stroke: "#000", strokeWidth: 2 * s }),
32735
33175
  /* @__PURE__ */ jsx("circle", { cx: wheelR, cy: wheelY, r: 8 * s, fill: "#5a6270", stroke: "#0f1830", strokeWidth: 1.5 * s }),
32736
33176
  /* @__PURE__ */ jsx("circle", { cx: wheelR, cy: wheelY, r: 2 * s, fill: "#0f1830" }),
32737
- bottomLabel4(node, r.cx, r.label)
33177
+ bottomLabel4(node, r.cx, r.label, textMetrics)
32738
33178
  ] });
32739
33179
  }
32740
- function ShapeCdnEdgeNode({ node, active }) {
33180
+ function ShapeCdnEdgeNode({ node, active, textMetrics = "proportional" }) {
32741
33181
  const frame = commonFrame6(active);
32742
33182
  const r = shapeRegion(node);
32743
33183
  const cx = r.cx;
@@ -32800,7 +33240,7 @@ function ShapeCdnEdgeNode({ node, active }) {
32800
33240
  ] });
32801
33241
  return /* @__PURE__ */ jsxs("g", { children: [
32802
33242
  fitArt(r, { \u4E0A: \u5E83\u304C\u308A, \u4E0B: \u5E83\u304C\u308A, \u5DE6: \u5E83\u304C\u308A, \u53F3: \u5E83\u304C\u308A }, \u7D75),
32803
- bottomLabel4(node, r.cx, r.label)
33243
+ bottomLabel4(node, r.cx, r.label, textMetrics)
32804
33244
  ] });
32805
33245
  }
32806
33246
  var API_ROW_TOP = 52;
@@ -32815,7 +33255,7 @@ var API_METHOD_BOX_W = 54;
32815
33255
  var API_METHOD_TEXT_W = 48;
32816
33256
  var API_W_MIN = 200;
32817
33257
  var API_W_MAX = 300;
32818
- function ShapeApiGatewayNode({ node, active, lang }) {
33258
+ function ShapeApiGatewayNode({ node, active, lang, textMetrics = "proportional" }) {
32819
33259
  const \u5B57\u5F15 = \u5B57\u5F15\u304D\u3092\u4F5C\u308B(lang);
32820
33260
  const frame = commonFrame6(active);
32821
33261
  const r = shapeRegion(node);
@@ -32827,7 +33267,13 @@ function ShapeApiGatewayNode({ node, active, lang }) {
32827
33267
  const x = cx - bw / 2;
32828
33268
  const y = r.cy - \u7E26 / 2 + \u4F59\u767D;
32829
33269
  const \u5E83\u304C\u308A = { \u4E0A: \u7E26 / 2, \u4E0B: \u7E26 / 2, \u5DE6: bw / 2 + \u4F59\u767D, \u53F3: bw / 2 + \u4F59\u767D };
32830
- const \u7A2E\u985E\u306E\u5B57 = (s) => Math.min(11, 11 * API_METHOD_TEXT_W / Math.max(displayWidth(s) * 11 * MONO_ADVANCE_RATIO, textWidth(s, 11)));
33270
+ const \u7A2E\u985E\u306E\u5B57 = (s) => Math.min(
33271
+ 11,
33272
+ 11 * API_METHOD_TEXT_W / Math.max(
33273
+ displayWidth(s) * 11 * MONO_ADVANCE_RATIO,
33274
+ textWidth(s, 11, 0, textMetrics)
33275
+ )
33276
+ );
32831
33277
  const rowPitch = Math.max(
32832
33278
  API_ROW_PITCH_MIN,
32833
33279
  (bh - API_ROW_TOP - API_ROW_H - API_ROW_BOTTOM_PAD) / (API_ROWS - 1)
@@ -32843,7 +33289,7 @@ function ShapeApiGatewayNode({ node, active, lang }) {
32843
33289
  \u5E2F: { \u5E45: bw - 32 - 64 - 16, \u9AD8\u3055: API_ROW_H }
32844
33290
  }));
32845
33291
  const \u7D75 = (\u500D\u7387) => {
32846
- const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089);
33292
+ const \u500D = \u6253\u3061\u6D88\u3057\u306E\u500D\u7387(\u500D\u7387, \u6253\u3061\u6D88\u3059\u5B57\u3089, textMetrics);
32847
33293
  return /* @__PURE__ */ jsxs("g", { children: [
32848
33294
  /* @__PURE__ */ jsx("rect", { x: x + DROP_SHADOW_D, y: y + DROP_SHADOW_D, width: bw, height: bh, rx: 10, fill: frame.stroke, opacity: 0.2, stroke: "none" }),
32849
33295
  /* @__PURE__ */ jsx("rect", { "data-cdl-role": "node-body", x, y, width: bw, height: bh, rx: 10, fill: "#1a2332", stroke: frame.stroke, strokeWidth: frame.strokeWidth }),
@@ -32860,7 +33306,7 @@ function ShapeApiGatewayNode({ node, active, lang }) {
32860
33306
  };
32861
33307
  return /* @__PURE__ */ jsxs("g", { children: [
32862
33308
  fitArt(r, \u5E83\u304C\u308A, \u7D75),
32863
- bottomLabel4(node, r.cx, r.label)
33309
+ bottomLabel4(node, r.cx, r.label, textMetrics)
32864
33310
  ] });
32865
33311
  }
32866
33312
  function bottomLabel5(node, cx, plan) {
@@ -33160,6 +33606,7 @@ function CdlNodeView({
33160
33606
  chartLineScale,
33161
33607
  \u95A2\u4FC2\u306E\u53D7\u3051\u53E3,
33162
33608
  lang,
33609
+ textMetrics,
33163
33610
  \u5024\u306E\u540D\u524D
33164
33611
  }) {
33165
33612
  const value = node.value ? interpolate(node.value, stateValues, \u5024\u306E\u540D\u524D) : void 0;
@@ -33204,7 +33651,14 @@ function CdlNodeView({
33204
33651
  return /* @__PURE__ */ jsx(CardNode, { node: resolvedNode, active });
33205
33652
  // 時系列のやり取り (#578)。 1 つの箱が図を丸ごと描く = 縦が時間で、参加者は箱を持たない
33206
33653
  case "sequence-board":
33207
- return /* @__PURE__ */ jsx(SequenceBoardNode, { node: resolvedNode, stateValues });
33654
+ return /* @__PURE__ */ jsx(
33655
+ SequenceBoardNode,
33656
+ {
33657
+ node: resolvedNode,
33658
+ stateValues,
33659
+ textMetrics
33660
+ }
33661
+ );
33208
33662
  // 図表 9 種は payload が `{signal}` を取れるので stateValues を渡す
33209
33663
  // (`render/payload-binding.ts` が描画直前に解決する)。 取れる欄は種別で違い、
33210
33664
  // 数と語を取る 7 種に対し、mind-map / tree-hierarchy は **名前だけ** を取る (#467)。
@@ -33229,7 +33683,8 @@ function CdlNodeView({
33229
33683
  active,
33230
33684
  stateValues,
33231
33685
  drawing,
33232
- progress
33686
+ progress,
33687
+ textMetrics
33233
33688
  }
33234
33689
  );
33235
33690
  case "chart-gauge":
@@ -33240,7 +33695,8 @@ function CdlNodeView({
33240
33695
  active,
33241
33696
  stateValues,
33242
33697
  drawing,
33243
- progress
33698
+ progress,
33699
+ textMetrics
33244
33700
  }
33245
33701
  );
33246
33702
  case "chart-stacked-bar":
@@ -33251,7 +33707,8 @@ function CdlNodeView({
33251
33707
  active,
33252
33708
  stateValues,
33253
33709
  drawing,
33254
- progress
33710
+ progress,
33711
+ textMetrics
33255
33712
  }
33256
33713
  );
33257
33714
  case "chart-slope":
@@ -33262,7 +33719,8 @@ function CdlNodeView({
33262
33719
  active,
33263
33720
  stateValues,
33264
33721
  drawing,
33265
- progress
33722
+ progress,
33723
+ textMetrics
33266
33724
  }
33267
33725
  );
33268
33726
  case "chart-waffle":
@@ -33273,11 +33731,20 @@ function CdlNodeView({
33273
33731
  active,
33274
33732
  stateValues,
33275
33733
  drawing,
33276
- progress
33734
+ progress,
33735
+ textMetrics
33277
33736
  }
33278
33737
  );
33279
33738
  case "chart-stat":
33280
- return /* @__PURE__ */ jsx(ChartStatNode, { node: resolvedNode, active, stateValues });
33739
+ return /* @__PURE__ */ jsx(
33740
+ ChartStatNode,
33741
+ {
33742
+ node: resolvedNode,
33743
+ active,
33744
+ stateValues,
33745
+ textMetrics
33746
+ }
33747
+ );
33281
33748
  case "chart-radial":
33282
33749
  return /* @__PURE__ */ jsx(
33283
33750
  ChartRadialNode,
@@ -33286,7 +33753,8 @@ function CdlNodeView({
33286
33753
  active,
33287
33754
  stateValues,
33288
33755
  drawing,
33289
- progress
33756
+ progress,
33757
+ textMetrics
33290
33758
  }
33291
33759
  );
33292
33760
  case "chart-bar":
@@ -33319,7 +33787,8 @@ function CdlNodeView({
33319
33787
  active,
33320
33788
  stateValues,
33321
33789
  drawing,
33322
- progress
33790
+ progress,
33791
+ textMetrics
33323
33792
  }
33324
33793
  );
33325
33794
  case "funnel-stages":
@@ -33330,11 +33799,20 @@ function CdlNodeView({
33330
33799
  active,
33331
33800
  stateValues,
33332
33801
  drawing,
33333
- progress
33802
+ progress,
33803
+ textMetrics
33334
33804
  }
33335
33805
  );
33336
33806
  case "quadrant-matrix":
33337
- return /* @__PURE__ */ jsx(QuadrantNode, { node: resolvedNode, active, stateValues });
33807
+ return /* @__PURE__ */ jsx(
33808
+ QuadrantNode,
33809
+ {
33810
+ node: resolvedNode,
33811
+ active,
33812
+ stateValues,
33813
+ textMetrics
33814
+ }
33815
+ );
33338
33816
  case "tree-hierarchy":
33339
33817
  return /* @__PURE__ */ jsx(
33340
33818
  TreeNode,
@@ -33343,7 +33821,8 @@ function CdlNodeView({
33343
33821
  active,
33344
33822
  stateValues,
33345
33823
  drawing,
33346
- progress
33824
+ progress,
33825
+ textMetrics
33347
33826
  }
33348
33827
  );
33349
33828
  case "journey-map":
@@ -33358,91 +33837,91 @@ function CdlNodeView({
33358
33837
  }
33359
33838
  );
33360
33839
  case "shape-file":
33361
- return /* @__PURE__ */ jsx(ShapeFileNode, { node: resolvedNode, active });
33840
+ return /* @__PURE__ */ jsx(ShapeFileNode, { node: resolvedNode, active, textMetrics });
33362
33841
  case "shape-folder":
33363
- return /* @__PURE__ */ jsx(ShapeFolderNode, { node: resolvedNode, active });
33842
+ return /* @__PURE__ */ jsx(ShapeFolderNode, { node: resolvedNode, active, textMetrics });
33364
33843
  case "shape-cloud":
33365
- return /* @__PURE__ */ jsx(ShapeCloudNode, { node: resolvedNode, active });
33844
+ return /* @__PURE__ */ jsx(ShapeCloudNode, { node: resolvedNode, active, textMetrics });
33366
33845
  case "shape-cylinder":
33367
- return /* @__PURE__ */ jsx(ShapeCylinderNode, { node: resolvedNode, active });
33846
+ return /* @__PURE__ */ jsx(ShapeCylinderNode, { node: resolvedNode, active, textMetrics });
33368
33847
  case "shape-hexagon":
33369
- return /* @__PURE__ */ jsx(ShapeHexagonNode, { node: resolvedNode, active });
33848
+ return /* @__PURE__ */ jsx(ShapeHexagonNode, { node: resolvedNode, active, textMetrics });
33370
33849
  case "shape-diamond":
33371
- return /* @__PURE__ */ jsx(ShapeDiamondNode, { node: resolvedNode, active });
33850
+ return /* @__PURE__ */ jsx(ShapeDiamondNode, { node: resolvedNode, active, textMetrics });
33372
33851
  case "shape-stack":
33373
- return /* @__PURE__ */ jsx(ShapeStackNode, { node: resolvedNode, active });
33852
+ return /* @__PURE__ */ jsx(ShapeStackNode, { node: resolvedNode, active, textMetrics });
33374
33853
  case "shape-person":
33375
- return /* @__PURE__ */ jsx(ShapePersonNode, { node: resolvedNode, active });
33854
+ return /* @__PURE__ */ jsx(ShapePersonNode, { node: resolvedNode, active, textMetrics });
33376
33855
  case "shape-window":
33377
33856
  return /* @__PURE__ */ jsx(ShapeWindowNode, { node: resolvedNode, active });
33378
33857
  case "shape-terminal":
33379
33858
  return /* @__PURE__ */ jsx(ShapeTerminalNode, { node: resolvedNode, active, lang });
33380
33859
  case "shape-code-block":
33381
- return /* @__PURE__ */ jsx(ShapeCodeBlockNode, { node: resolvedNode, active, lang });
33860
+ return /* @__PURE__ */ jsx(ShapeCodeBlockNode, { node: resolvedNode, active, lang, textMetrics });
33382
33861
  case "shape-kanban-card":
33383
- return /* @__PURE__ */ jsx(ShapeKanbanCardNode, { node: resolvedNode, active, lang });
33862
+ return /* @__PURE__ */ jsx(ShapeKanbanCardNode, { node: resolvedNode, active, lang, textMetrics });
33384
33863
  case "shape-message-bubble":
33385
33864
  return /* @__PURE__ */ jsx(ShapeMessageBubbleNode, { node: resolvedNode, active });
33386
33865
  case "shape-gear":
33387
33866
  return /* @__PURE__ */ jsx(ShapeGearNode, { node: resolvedNode, active });
33388
33867
  case "shape-server-rack":
33389
- return /* @__PURE__ */ jsx(ShapeServerRackNode, { node: resolvedNode, active });
33868
+ return /* @__PURE__ */ jsx(ShapeServerRackNode, { node: resolvedNode, active, textMetrics });
33390
33869
  case "shape-network-node":
33391
- return /* @__PURE__ */ jsx(ShapeNetworkNodeNode, { node: resolvedNode, active });
33870
+ return /* @__PURE__ */ jsx(ShapeNetworkNodeNode, { node: resolvedNode, active, textMetrics });
33392
33871
  case "shape-mobile-device":
33393
- return /* @__PURE__ */ jsx(ShapeMobileDeviceNode, { node: resolvedNode, active });
33872
+ return /* @__PURE__ */ jsx(ShapeMobileDeviceNode, { node: resolvedNode, active, textMetrics });
33394
33873
  case "shape-iot-sensor":
33395
33874
  return /* @__PURE__ */ jsx(ShapeIotSensorNode, { node: resolvedNode, active });
33396
33875
  case "shape-robot-arm":
33397
33876
  return /* @__PURE__ */ jsx(ShapeRobotArmNode, { node: resolvedNode, active });
33398
33877
  case "shape-satellite":
33399
- return /* @__PURE__ */ jsx(ShapeSatelliteNode, { node: resolvedNode, active });
33878
+ return /* @__PURE__ */ jsx(ShapeSatelliteNode, { node: resolvedNode, active, textMetrics });
33400
33879
  case "shape-smart-contract":
33401
- return /* @__PURE__ */ jsx(ShapeSmartContractNode, { node: resolvedNode, active, lang });
33880
+ return /* @__PURE__ */ jsx(ShapeSmartContractNode, { node: resolvedNode, active, lang, textMetrics });
33402
33881
  case "shape-blockchain-block":
33403
- return /* @__PURE__ */ jsx(ShapeBlockchainBlockNode, { node: resolvedNode, active, lang });
33882
+ return /* @__PURE__ */ jsx(ShapeBlockchainBlockNode, { node: resolvedNode, active, lang, textMetrics });
33404
33883
  case "shape-rpc-node":
33405
- return /* @__PURE__ */ jsx(ShapeRpcNodeNode, { node: resolvedNode, active, lang });
33884
+ return /* @__PURE__ */ jsx(ShapeRpcNodeNode, { node: resolvedNode, active, lang, textMetrics });
33406
33885
  case "shape-wallet":
33407
- return /* @__PURE__ */ jsx(ShapeWalletNode, { node: resolvedNode, active });
33886
+ return /* @__PURE__ */ jsx(ShapeWalletNode, { node: resolvedNode, active, textMetrics });
33408
33887
  case "shape-nft":
33409
- return /* @__PURE__ */ jsx(ShapeNftNode, { node: resolvedNode, active });
33888
+ return /* @__PURE__ */ jsx(ShapeNftNode, { node: resolvedNode, active, textMetrics });
33410
33889
  case "shape-token":
33411
- return /* @__PURE__ */ jsx(ShapeTokenNode, { node: resolvedNode, active });
33890
+ return /* @__PURE__ */ jsx(ShapeTokenNode, { node: resolvedNode, active, textMetrics });
33412
33891
  case "shape-blockchain":
33413
- return /* @__PURE__ */ jsx(ShapeBlockchainNode, { node: resolvedNode, active });
33892
+ return /* @__PURE__ */ jsx(ShapeBlockchainNode, { node: resolvedNode, active, textMetrics });
33414
33893
  case "shape-bitcoin-chain":
33415
- return /* @__PURE__ */ jsx(ShapeBitcoinChainNode, { node: resolvedNode, active });
33894
+ return /* @__PURE__ */ jsx(ShapeBitcoinChainNode, { node: resolvedNode, active, textMetrics });
33416
33895
  case "shape-ethereum-chain":
33417
- return /* @__PURE__ */ jsx(ShapeEthereumChainNode, { node: resolvedNode, active });
33896
+ return /* @__PURE__ */ jsx(ShapeEthereumChainNode, { node: resolvedNode, active, textMetrics });
33418
33897
  case "shape-blockchain-node":
33419
- return /* @__PURE__ */ jsx(ShapeBlockchainNodeNode, { node: resolvedNode, active });
33898
+ return /* @__PURE__ */ jsx(ShapeBlockchainNodeNode, { node: resolvedNode, active, textMetrics });
33420
33899
  case "shape-bank":
33421
- return /* @__PURE__ */ jsx(ShapeBankNode, { node: resolvedNode, active });
33900
+ return /* @__PURE__ */ jsx(ShapeBankNode, { node: resolvedNode, active, textMetrics });
33422
33901
  case "shape-trust-bank":
33423
- return /* @__PURE__ */ jsx(ShapeTrustBankNode, { node: resolvedNode, active, lang });
33902
+ return /* @__PURE__ */ jsx(ShapeTrustBankNode, { node: resolvedNode, active, lang, textMetrics });
33424
33903
  case "shape-payment-provider":
33425
- return /* @__PURE__ */ jsx(ShapePaymentProviderNode, { node: resolvedNode, active, lang });
33904
+ return /* @__PURE__ */ jsx(ShapePaymentProviderNode, { node: resolvedNode, active, lang, textMetrics });
33426
33905
  case "shape-credit-card":
33427
- return /* @__PURE__ */ jsx(ShapeCreditCardNode, { node: resolvedNode, active });
33906
+ return /* @__PURE__ */ jsx(ShapeCreditCardNode, { node: resolvedNode, active, textMetrics });
33428
33907
  case "shape-brokerage":
33429
- return /* @__PURE__ */ jsx(ShapeBrokerageNode, { node: resolvedNode, active, lang });
33908
+ return /* @__PURE__ */ jsx(ShapeBrokerageNode, { node: resolvedNode, active, lang, textMetrics });
33430
33909
  case "shape-exchange":
33431
- return /* @__PURE__ */ jsx(ShapeExchangeNode, { node: resolvedNode, active, lang });
33910
+ return /* @__PURE__ */ jsx(ShapeExchangeNode, { node: resolvedNode, active, lang, textMetrics });
33432
33911
  case "shape-atm":
33433
- return /* @__PURE__ */ jsx(ShapeAtmNode, { node: resolvedNode, active, lang });
33912
+ return /* @__PURE__ */ jsx(ShapeAtmNode, { node: resolvedNode, active, lang, textMetrics });
33434
33913
  case "shape-website":
33435
- return /* @__PURE__ */ jsx(ShapeWebsiteNode, { node: resolvedNode, active });
33914
+ return /* @__PURE__ */ jsx(ShapeWebsiteNode, { node: resolvedNode, active, textMetrics });
33436
33915
  case "shape-storefront":
33437
- return /* @__PURE__ */ jsx(ShapeStorefrontNode, { node: resolvedNode, active, lang });
33916
+ return /* @__PURE__ */ jsx(ShapeStorefrontNode, { node: resolvedNode, active, lang, textMetrics });
33438
33917
  case "shape-warehouse":
33439
- return /* @__PURE__ */ jsx(ShapeWarehouseNode, { node: resolvedNode, active, lang });
33918
+ return /* @__PURE__ */ jsx(ShapeWarehouseNode, { node: resolvedNode, active, lang, textMetrics });
33440
33919
  case "shape-online-shop":
33441
- return /* @__PURE__ */ jsx(ShapeOnlineShopNode, { node: resolvedNode, active });
33920
+ return /* @__PURE__ */ jsx(ShapeOnlineShopNode, { node: resolvedNode, active, textMetrics });
33442
33921
  case "shape-cdn-edge":
33443
- return /* @__PURE__ */ jsx(ShapeCdnEdgeNode, { node: resolvedNode, active });
33922
+ return /* @__PURE__ */ jsx(ShapeCdnEdgeNode, { node: resolvedNode, active, textMetrics });
33444
33923
  case "shape-api-gateway":
33445
- return /* @__PURE__ */ jsx(ShapeApiGatewayNode, { node: resolvedNode, active, lang });
33924
+ return /* @__PURE__ */ jsx(ShapeApiGatewayNode, { node: resolvedNode, active, lang, textMetrics });
33446
33925
  case "shape-auditor":
33447
33926
  return /* @__PURE__ */ jsx(ShapeAuditorNode, { node: resolvedNode, active });
33448
33927
  case "shape-regulator":
@@ -33462,7 +33941,17 @@ function CdlNodeView({
33462
33941
  case "station":
33463
33942
  return /* @__PURE__ */ jsx(StationNode, { node: resolvedNode, active });
33464
33943
  default:
33465
- return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues, \u5024\u306E\u540D\u524D });
33944
+ return /* @__PURE__ */ jsx(
33945
+ GenericNode,
33946
+ {
33947
+ node: resolvedNode,
33948
+ active,
33949
+ value: node.value,
33950
+ stateValues,
33951
+ \u5024\u306E\u540D\u524D,
33952
+ textMetrics
33953
+ }
33954
+ );
33466
33955
  }
33467
33956
  })();
33468
33957
  const offsetX = node.renderOffsetX !== void 0 ? resolveNumericAttr(node.renderOffsetX, stateValues, 0) : 0;
@@ -33523,7 +34012,7 @@ function CdlNodeView({
33523
34012
  }
33524
34013
  ),
33525
34014
  inner,
33526
- \u7BB1\u306E\u4E0A\u306E\u8A9E(resolvedNode)
34015
+ \u7BB1\u306E\u4E0A\u306E\u8A9E(resolvedNode, textMetrics ?? "proportional")
33527
34016
  ]
33528
34017
  }
33529
34018
  );
@@ -33532,17 +34021,17 @@ var FIGURE_TITLE_GAP = 10;
33532
34021
  var FIGURE_TITLE_SIZE = 15;
33533
34022
  var FIGURE_EYEBROW_SIZE = 11;
33534
34023
  var FIGURE_EYEBROW_LIFT = 1.1;
33535
- function \u5E45\u306B\u53CE\u3081\u305F\u5927\u304D\u3055(\u8A9E, \u7D20\u306E\u5927\u304D\u3055, \u5E45) {
33536
- const \u5B9F\u5E45 = textWidth(\u8A9E, \u7D20\u306E\u5927\u304D\u3055, 0);
34024
+ function \u5E45\u306B\u53CE\u3081\u305F\u5927\u304D\u3055(\u8A9E, \u7D20\u306E\u5927\u304D\u3055, \u5E45, textMetrics = "proportional") {
34025
+ const \u5B9F\u5E45 = textWidth(\u8A9E, \u7D20\u306E\u5927\u304D\u3055, 0, textMetrics);
33537
34026
  return \u5B9F\u5E45 > \u5E45 ? \u7D20\u306E\u5927\u304D\u3055 * \u5E45 / \u5B9F\u5E45 : \u7D20\u306E\u5927\u304D\u3055;
33538
34027
  }
33539
- function \u7BB1\u306E\u4E0A\u306E\u8A9E(node) {
34028
+ function \u7BB1\u306E\u4E0A\u306E\u8A9E(node, textMetrics = "proportional") {
33540
34029
  if (!drawsFigureTitle(node.kind)) return null;
33541
34030
  const \u540D\u524D = (node.title ?? "").trim();
33542
34031
  const \u5C0F\u898B\u51FA\u3057 = (node.eyebrow ?? "").trim();
33543
34032
  if (\u540D\u524D === "" && \u5C0F\u898B\u51FA\u3057 === "") return null;
33544
34033
  const \u984C\u306Ey = node.cy - node.h / 2 - FIGURE_TITLE_GAP;
33545
- const \u984C\u306E\u5927\u304D\u3055 = \u5E45\u306B\u53CE\u3081\u305F\u5927\u304D\u3055(\u540D\u524D, FIGURE_TITLE_SIZE, node.w);
34034
+ const \u984C\u306E\u5927\u304D\u3055 = \u5E45\u306B\u53CE\u3081\u305F\u5927\u304D\u3055(\u540D\u524D, FIGURE_TITLE_SIZE, node.w, textMetrics);
33546
34035
  const \u5C0F\u898B\u51FA\u3057\u306Ey = \u540D\u524D === "" ? \u984C\u306Ey : \u984C\u306Ey - \u984C\u306E\u5927\u304D\u3055 * FIGURE_EYEBROW_LIFT;
33547
34036
  return /* @__PURE__ */ jsxs(Fragment, { children: [
33548
34037
  \u5C0F\u898B\u51FA\u3057 !== "" && /* @__PURE__ */ jsx(
@@ -33552,7 +34041,7 @@ function \u7BB1\u306E\u4E0A\u306E\u8A9E(node) {
33552
34041
  x: node.cx,
33553
34042
  y: \u5C0F\u898B\u51FA\u3057\u306Ey,
33554
34043
  textAnchor: "middle",
33555
- fontSize: \u5E45\u306B\u53CE\u3081\u305F\u5927\u304D\u3055(\u5C0F\u898B\u51FA\u3057, FIGURE_EYEBROW_SIZE, node.w),
34044
+ fontSize: \u5E45\u306B\u53CE\u3081\u305F\u5927\u304D\u3055(\u5C0F\u898B\u51FA\u3057, FIGURE_EYEBROW_SIZE, node.w, textMetrics),
33556
34045
  fontWeight: 600,
33557
34046
  letterSpacing: 0.6,
33558
34047
  fill: "var(--cdl-text-dim, #5a6270)",
@@ -33877,6 +34366,7 @@ function CdlStage({
33877
34366
  node,
33878
34367
  active: activeSet.has(node.id),
33879
34368
  lang: laid.lang,
34369
+ textMetrics: laid.textMetrics,
33880
34370
  \u95A2\u4FC2\u306E\u53D7\u3051\u53E3: \u7BB1\u306E\u53D7\u3051\u53E3,
33881
34371
  drawing: \u63CF\u304F,
33882
34372
  progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
@@ -33893,7 +34383,8 @@ function CdlStage({
33893
34383
  CdlEdgeLabelView,
33894
34384
  {
33895
34385
  edge,
33896
- active: activeSet.has(edge.id)
34386
+ active: activeSet.has(edge.id),
34387
+ textMetrics: laid.textMetrics
33897
34388
  },
33898
34389
  `label-${edge.id}`
33899
34390
  )),
@@ -33903,7 +34394,8 @@ function CdlStage({
33903
34394
  {
33904
34395
  edge,
33905
34396
  active: activeSet.has(edge.id),
33906
- \u7AEF
34397
+ \u7AEF,
34398
+ textMetrics: laid.textMetrics
33907
34399
  },
33908
34400
  `${\u7AEF}-label-${edge.id}`
33909
34401
  ))
@@ -34348,8 +34840,8 @@ function pointToSegmentDistance2(px, py, seg) {
34348
34840
  }
34349
34841
 
34350
34842
  // src/layout/predict-bbox.ts
34351
- function predictLabelBBoxWorld(edge) {
34352
- return computeLabelBBoxWorld(edge);
34843
+ function predictLabelBBoxWorld(edge, textMetrics = "proportional") {
34844
+ return computeLabelBBoxWorld(edge, textMetrics);
34353
34845
  }
34354
34846
  function predictNodeBBoxWorld(n) {
34355
34847
  return {
@@ -34409,12 +34901,12 @@ function resolveStorageBoxW(width, presetName, optionName) {
34409
34901
  }
34410
34902
  return width;
34411
34903
  }
34412
- function fitRowsWidth(boxW, rows) {
34413
- return Math.max(boxW, requiredRowsWidth(rows ? [...rows] : void 0, "storage"));
34904
+ function fitRowsWidth(boxW, rows, textMetrics = "proportional") {
34905
+ return Math.max(boxW, requiredRowsWidth(rows ? [...rows] : void 0, "storage", textMetrics));
34414
34906
  }
34415
34907
  function swimlane(preset) {
34416
34908
  const w = preset.laneWidth ?? 400;
34417
- const b = diagram(preset.id, { topic: preset.topic, type: "swimlane" });
34909
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "swimlane" });
34418
34910
  const labelToId = /* @__PURE__ */ new Map();
34419
34911
  const idsInOrder = [];
34420
34912
  for (const label of preset.lanes) {
@@ -34434,7 +34926,7 @@ function swimlane(preset) {
34434
34926
  }
34435
34927
  function flow(preset) {
34436
34928
  const w = preset.laneWidth ?? 400;
34437
- const b = diagram(preset.id, { topic: preset.topic, type: "flow" });
34929
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "flow" });
34438
34930
  b.lane("flow", { width: w, ...preset.laneLabel ? { label: preset.laneLabel } : {} });
34439
34931
  const tone = preset.defaultTone ?? "accent";
34440
34932
  const style = preset.defaultStyle ?? "dotted-flow";
@@ -34495,7 +34987,7 @@ var SEQUENCE_MESSAGE_LOOK = {
34495
34987
  };
34496
34988
  function sequence(preset) {
34497
34989
  const tone = preset.defaultTone ?? "accent";
34498
- const b = diagram(preset.id, { topic: preset.topic, type: "sequence" });
34990
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "sequence" });
34499
34991
  const \u9762\u3005 = preset.actors.map(
34500
34992
  (a) => typeof a === "string" ? { name: a } : { name: a.name, ...a.subtitle ? { subtitle: a.subtitle } : {} }
34501
34993
  );
@@ -34521,7 +35013,7 @@ function sequence(preset) {
34521
35013
  return \u51FA\u756A.length > 0 ? { actor: i, from: \u51FA\u756A[0], to: \u51FA\u756A[\u51FA\u756A.length - 1] } : null;
34522
35014
  }).filter((x) => x !== null);
34523
35015
  const data = { actors: \u9762\u3005, messages: \u8A00\u3065\u3066, bands: \u5E2F };
34524
- const m = sequenceBoardMetrics(data);
35016
+ const m = sequenceBoardMetrics(data, resolveTextMetrics(preset.textMetrics));
34525
35017
  const laneId = "seq";
34526
35018
  b.lane(laneId, { width: m.w + LANE_PAD_MIN * 2 });
34527
35019
  b.node(preset.id, {
@@ -34550,7 +35042,7 @@ function topology(preset) {
34550
35042
  const groupW = preset.groupWidth ?? 460;
34551
35043
  const tone = preset.defaultTone ?? "accent";
34552
35044
  const style = preset.defaultStyle ?? "solid";
34553
- const b = diagram(preset.id, { topic: preset.topic, type: "topology" });
35045
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "topology" });
34554
35046
  const groupOrder = [];
34555
35047
  const groupStackCount = /* @__PURE__ */ new Map();
34556
35048
  const phaseActivate = [];
@@ -34619,7 +35111,12 @@ function er(preset) {
34619
35111
  const entityW = resolveStorageBoxW(preset.entityWidth, "er", "entityWidth");
34620
35112
  const tone = preset.defaultTone ?? "info";
34621
35113
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
34622
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "er" });
35114
+ const b = diagram(preset.id, {
35115
+ topic: preset.topic,
35116
+ palette: preset.palette,
35117
+ textMetrics: preset.textMetrics,
35118
+ type: "er"
35119
+ });
34623
35120
  const entities = [];
34624
35121
  const phaseActivate = [];
34625
35122
  let relIdx = 0;
@@ -34642,7 +35139,7 @@ function er(preset) {
34642
35139
  \u5024.forEach(\u8DB3\u3059);
34643
35140
  const \u8A2D\u8A08\u306E\u5F62 = \u884C.length > 0;
34644
35141
  const rows = \u8A2D\u8A08\u306E\u5F62 ? \u884C : e.rows ?? [];
34645
- const boxW = fitRowsWidth(entityW, rows);
35142
+ const boxW = fitRowsWidth(entityW, rows, resolveTextMetrics(preset.textMetrics));
34646
35143
  b.lane(laneId, { width: boxLaneW(boxW) });
34647
35144
  b.node(e.id, {
34648
35145
  lane: laneId,
@@ -34706,7 +35203,7 @@ function stateMachine(preset) {
34706
35203
  const stateW = resolveStateW(preset.stateWidth, "stateMachine");
34707
35204
  const tone = preset.defaultTone ?? "accent";
34708
35205
  const diagramType = "state";
34709
- const b = diagram(preset.id, { topic: preset.topic, type: diagramType });
35206
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: diagramType });
34710
35207
  const phaseActivate = [];
34711
35208
  const stateOrder = /* @__PURE__ */ new Map();
34712
35209
  const \u72B6\u614B = [];
@@ -34737,7 +35234,7 @@ function stateMachine(preset) {
34737
35234
  const \u884C = (s.actions ?? []).map((a) => a.note ? `${a.label}: ${a.note}` : a.label);
34738
35235
  const \u5370 = (s.actions ?? []).map((a) => FSM_ACTION_MARK[a.when]);
34739
35236
  const laneId = \u683C\u5B50 && s.col !== void 0 ? `col-${s.col}` : `lane-${s.id}`;
34740
- const boxW = \u8A2D\u8A08\u306E\u5F62 ? fitRowsWidth(stateW, \u884C) : stateW;
35237
+ const boxW = \u8A2D\u8A08\u306E\u5F62 ? fitRowsWidth(stateW, \u884C, resolveTextMetrics(preset.textMetrics)) : stateW;
34741
35238
  return { s, \u884C, \u5370, laneId, boxW, stack: \u683C\u5B50 ? s.row ?? 0 : 0 };
34742
35239
  });
34743
35240
  const \u7BC0\u70B9\u306E\u4E2D\u8EAB = \u7BC0\u70B9.map((m) => ({
@@ -34818,7 +35315,11 @@ function infrastructure(preset) {
34818
35315
  const laneW = preset.laneWidth ?? 380;
34819
35316
  const tone = preset.defaultTone ?? "accent";
34820
35317
  const style = preset.defaultStyle ?? "solid";
34821
- const b = diagram(preset.id, { topic: preset.topic, type: "infrastructure" });
35318
+ const b = diagram(preset.id, {
35319
+ topic: preset.topic,
35320
+ textMetrics: preset.textMetrics,
35321
+ type: "infrastructure"
35322
+ });
34822
35323
  const colLaneIds = /* @__PURE__ */ new Map();
34823
35324
  const phaseActivate = [];
34824
35325
  let connIdx = 0;
@@ -34899,7 +35400,12 @@ function classDiagram(preset) {
34899
35400
  const classW = resolveStorageBoxW(preset.classWidth, "classDiagram", "classWidth");
34900
35401
  const \u56F3\u306E\u65E2\u5B9A = preset.defaultTone;
34901
35402
  const \u7E1E\u3092\u6577\u304F = preset.rowStripe ?? true;
34902
- const b = diagram(preset.id, { topic: preset.topic, palette: preset.palette, type: "class" });
35403
+ const b = diagram(preset.id, {
35404
+ topic: preset.topic,
35405
+ palette: preset.palette,
35406
+ textMetrics: preset.textMetrics,
35407
+ type: "class"
35408
+ });
34903
35409
  const classes = [];
34904
35410
  const phaseActivate = [];
34905
35411
  const \u7BB1 = [];
@@ -34925,7 +35431,7 @@ function classDiagram(preset) {
34925
35431
  rows.push(stripAccess(m));
34926
35432
  rowMarks.push({ shape: "chevron", filled: isPublic(m) });
34927
35433
  }
34928
- const boxW = fitRowsWidth(classW, rows);
35434
+ const boxW = fitRowsWidth(classW, rows, resolveTextMetrics(preset.textMetrics));
34929
35435
  const laneId = c.col !== void 0 ? `col-${c.col}` : `lane-${c.id}`;
34930
35436
  return { c, rows, rowMarks, boxW, laneId, stack: c.col !== void 0 ? c.row ?? 0 : 0 };
34931
35437
  });
@@ -34988,7 +35494,7 @@ function classDiagram(preset) {
34988
35494
  }
34989
35495
  function tree(preset) {
34990
35496
  const canvasH = 480;
34991
- const b = diagram(preset.id, { topic: preset.topic, type: "tree" });
35497
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "tree" });
34992
35498
  const treeNodes = [];
34993
35499
  const api = {
34994
35500
  node(n) {
@@ -35027,7 +35533,7 @@ function tree(preset) {
35027
35533
  function userJourney(preset) {
35028
35534
  const canvasW = preset.stepWidth ? preset.stepWidth * 2 : 720;
35029
35535
  const canvasH = 480;
35030
- const b = diagram(preset.id, { topic: preset.topic, type: "journey" });
35536
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "journey" });
35031
35537
  const steps = [];
35032
35538
  const api = {
35033
35539
  step(s) {
@@ -35067,7 +35573,7 @@ function mindMap(preset) {
35067
35573
  const canvasW = preset.branchWidth ? preset.branchWidth * 2 : 720;
35068
35574
  const canvasH = 480;
35069
35575
  const diagramType = "mind";
35070
- const b = diagram(preset.id, { topic: preset.topic, type: diagramType });
35576
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: diagramType });
35071
35577
  const branches = [];
35072
35578
  const api = {
35073
35579
  branch(br) {
@@ -35111,7 +35617,7 @@ function mindMap(preset) {
35111
35617
  function funnel(preset) {
35112
35618
  const canvasW = toGridSize(preset.stageWidth ?? 560);
35113
35619
  const canvasH = 480;
35114
- const b = diagram(preset.id, { topic: preset.topic, type: "funnel" });
35620
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "funnel" });
35115
35621
  const stages = [];
35116
35622
  const api = {
35117
35623
  stage(s) {
@@ -35149,7 +35655,7 @@ function funnel(preset) {
35149
35655
  function quadrant(preset) {
35150
35656
  const canvasW = 640;
35151
35657
  const canvasH = 480;
35152
- const b = diagram(preset.id, { topic: preset.topic, type: "quadrant" });
35658
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "quadrant" });
35153
35659
  const items = [];
35154
35660
  const api = {
35155
35661
  item(it) {
@@ -35200,7 +35706,7 @@ function chart(preset) {
35200
35706
  const canvasH = toGridSize(
35201
35707
  preset.type === "pie" || preset.type === "gauge" || preset.type === "radial" || preset.type === "stat" || preset.type === "waffle" || preset.type === "stacked-bar" ? 320 : 360
35202
35708
  );
35203
- const b = diagram(preset.id, { topic: preset.topic, type: "chart" });
35709
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "chart" });
35204
35710
  const data = [];
35205
35711
  const kindMap = {
35206
35712
  line: "chart-line",
@@ -35250,7 +35756,7 @@ function gantt(preset) {
35250
35756
  const canvasW = preset.laneWidth ? preset.laneWidth * 2 : 720;
35251
35757
  const canvasH = 360;
35252
35758
  const tone = preset.defaultTone ?? "teal";
35253
- const b = diagram(preset.id, { topic: preset.topic, type: "gantt" });
35759
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "gantt" });
35254
35760
  const tasks = [];
35255
35761
  const api = {
35256
35762
  task(t) {
@@ -35318,7 +35824,7 @@ function flowchart(preset) {
35318
35824
  const laneW = preset.laneWidth ?? 380;
35319
35825
  const tone = preset.defaultTone ?? "accent";
35320
35826
  const \u7E26\u306B\u7A4D\u3080 = (preset.direction ?? "horizontal") === "vertical";
35321
- const b = diagram(preset.id, { topic: preset.topic, type: "flowchart" });
35827
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "flowchart" });
35322
35828
  const laneToId = /* @__PURE__ */ new Map();
35323
35829
  const laneStackCount = /* @__PURE__ */ new Map();
35324
35830
  if (\u7E26\u306B\u7A4D\u3080) {
@@ -35393,7 +35899,7 @@ var NET_KIND_LABEL = {
35393
35899
  function network(preset) {
35394
35900
  const laneW = preset.laneWidth ?? 320;
35395
35901
  const tone = preset.defaultTone ?? "info";
35396
- const b = diagram(preset.id, { topic: preset.topic, type: "network" });
35902
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: "network" });
35397
35903
  const colLaneIds = /* @__PURE__ */ new Map();
35398
35904
  const phaseActivate = [];
35399
35905
  let edgeIdx = 0;
@@ -35444,7 +35950,7 @@ function stateMachine2(preset) {
35444
35950
  const laneW = boxLaneW(stateW);
35445
35951
  const tone = preset.defaultTone ?? "accent";
35446
35952
  const diagramType = "state";
35447
- const b = diagram(preset.id, { topic: preset.topic, type: diagramType });
35953
+ const b = diagram(preset.id, { topic: preset.topic, textMetrics: preset.textMetrics, type: diagramType });
35448
35954
  const stateOrder = /* @__PURE__ */ new Map();
35449
35955
  const phaseActivate = [];
35450
35956
  let transIdx = 0;
@@ -35523,6 +36029,6 @@ function slugify(s) {
35523
36029
  return s.toLowerCase().replace(/[^a-z0-9぀-ゟ゠-ヿ一-龯]+/g, "-").replace(/^-|-$/g, "");
35524
36030
  }
35525
36031
 
35526
- export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDiagramThumbnail, CdlDiagramView, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, EDGE_HEADS, EDGE_HEAD_DEFAULT, EDGE_HEAD_FILLS, EDGE_HEAD_FILL_DEFAULT, EDGE_LABEL_TEXT, EDGE_REVEALS, EDGE_REVEAL_DEFAULT, EDGE_STUB_OUT, EDGE_STYLES, ER_CARDINALITY_HEAD, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, NODE_KINDS, PERF_BUDGET_TOTAL_MS, PERF_SLOWEST_SAMPLE, RELATION_FOCUSES, RELATION_FOCUS_DEFAULT, ROW_GAP_VARIANCE_TOL, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, TARGET_LABEL_PATH_DIST, TONES, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeEventBindingKey, computeFormulaKey, computeInputSignalKey, computeScrollProgress, computeScrollTriggerKey, computeStateValues, computeViewportScale, computed, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, createInteractiveSignalsAccessor, createScrollProgressHandle, createScrollProgressSignals, diagram, drawsFigureTitle, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, hasInteractivePrimitives, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance2 as pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, relatedFocusSet, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveLabelClearanceAfterPathPasses, resolveLang, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, segmentsIntersect2 as segmentsIntersect, sequence, sequenceBoardMetrics, sequenceStepId, signal, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx, 木の札の幅 };
36032
+ export { ARROW_ANGLE_MAX_DEG, ARROW_ENDPOINT_CENTER_TOL, CHAIN_MIN_CLEARANCE, CHAIN_SHIFT_MAX_ACCUMULATED, CHAIN_SHIFT_MAX_ITER, CLASS_RELATION_LOOK, CLEARANCE_LABEL_LABEL, CLEARANCE_LANE_LABEL, CLEARANCE_NODE_LABEL, CLEARANCE_PATH_LABEL, COLUMN_GAP_VARIANCE_TOL, CdlDiagramThumbnail, CdlDiagramView, DETOUR_GAP, DETOUR_SLOT_GAP, DIST_LABEL_PATH_MAX, DIST_LABEL_PATH_MIN, EDGE_HEADS, EDGE_HEAD_DEFAULT, EDGE_HEAD_FILLS, EDGE_HEAD_FILL_DEFAULT, EDGE_LABEL_TEXT, EDGE_REVEALS, EDGE_REVEAL_DEFAULT, EDGE_STUB_OUT, EDGE_STYLES, ER_CARDINALITY_HEAD, FAN_GAP, FONT_RENDER_TOLERANCE_WORLD, FSM_ACTION_MARK, LABEL_INIT_CLEARANCE, LABEL_INIT_CLEARANCE_DOTTED_FLOW, LABEL_SIZE_TOLERANCE_WORLD, LABEL_TO_PATH_CLEARANCE, LANE_BORDER_CLEARANCE_TOL, MARKER_GLOW_RADIUS, MIN_COLUMN_ALIGNMENT_TOLERANCE, MIN_ROW_ALIGNMENT_TOLERANCE, NEAR_COLLISION_DEFAULT_MIN, NEAR_COLLISION_POLICY, NODE_FRAME_SELECTOR, NODE_KINDS, PERF_BUDGET_TOTAL_MS, PERF_SLOWEST_SAMPLE, RELATION_FOCUSES, RELATION_FOCUS_DEFAULT, ROW_GAP_VARIANCE_TOL, SEQUENCE_MESSAGE_LOOK, SPEC_CLEARANCE_POLICY, STAGE_SVG_SELECTOR, TARGET_LABEL_PATH_DIST, TONES, WCAG_AA_LARGE, WCAG_AA_NORMAL, applyDerivedValues, assertNever, attachEventHandlers, batch, bboxClearance, bboxDiffWorld, cdlAdapter, chart, classDiagram, compile, computeEventBindingKey, computeFormulaKey, computeInputSignalKey, computeScrollProgress, computeScrollTriggerKey, computeStateValues, computeViewportScale, computed, countEdgeCrossings, countOrderCrossings, createFormulaComputeds, createInputSignals, createInteractiveSignalsAccessor, createScrollProgressHandle, createScrollProgressSignals, diagram, drawsFigureTitle, effect, er, evaluate as evaluateFormula, extractIdentifiers, flow, flowchart, funnel, gantt, hasInteractivePrimitives, infrastructure, inputDefaultValue, interpolate, isLargeText, labelInitClearance, layout, layoutWithValidation, mindMap, network, orderNodes, parseFormula, pointRectEdgeDistance, pointToSegmentDistance2 as pointToSegmentDistance, predictLabelBBoxWorld, predictNodeBBoxWorld, projectEdgeLabel, projectNode, projectPathSegment, pxToWorld, quadrant, rectRectClearance, rectRectOverlapArea, relatedFocusSet, rendersRows, requiredContrastRatio, requiredNearClearance, requiredRowsHeight, requiredRowsWidth, requiredSpecClearance, resolveEdgeLabelOverlapsWithChain, resolveEdgeLabelOverlapsWithChainAndPropagate, resolveLabelClearanceAfterPathPasses, resolveLang, resolveOverlapsWithChain, resolveTarget, resolveTargetAll, resolveTextMetrics, segmentsIntersect2 as segmentsIntersect, sequence, sequenceBoardMetrics, sequenceStepId, signal, stateMachine, stateMachine2, swimlane, topology, tree, untrack, userJourney, validate, verifyAllDiagramsDom, verifyAuthorIntent, verifyAuthorIntentAll, verifyDiagramDom, visualValidate, visualValidateAll, visualValidateLaid, withDerivedValues, worldToPx, 木の札の幅 };
35527
36033
  //# sourceMappingURL=index.js.map
35528
36034
  //# sourceMappingURL=index.js.map