@cardenelabs/cdl 0.12.0 → 0.12.1

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,24 @@ CDL (Chainome Diagram Language) の主要変更履歴。
7
7
 
8
8
  予定 ... feedback を反映した patch / minor。
9
9
 
10
+ ## [0.12.1] - 2026-08-22
11
+
12
+ ### Fixed
13
+
14
+ - **放射と木の箱で、名前が枠を超えて描かれるのを直した** (#526)
15
+
16
+ 補足 (`subtitle`) が無い箱は行を積む処理を通らず、名前をそのまま描いていた。 その経路
17
+ だけが幅を見ておらず、長い名前が箱の外へ出て枝の線と重なる (実測 = 中心の箱で文字
18
+ 163px に対し箱 120px)。
19
+
20
+ 補足の有無に関わらず箱の幅に収める。 収まらない分は末尾に `…` を付けて切る = 切られた
21
+ ことが読み手に見える。
22
+
23
+ **箱の幅は変えない**。 配置の計算が箱幅から出ているため、広げると枝どうしの重なりと
24
+ canvas 超えの確認が要る。
25
+
26
+ 同じ形は木 (`tree`) にも 2 箇所あり、併せて直した。
27
+
10
28
  ## [0.12.0] - 2026-08-21
11
29
 
12
30
  ### Added
@@ -498,7 +516,8 @@ Initial OSS release.
498
516
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
499
517
  行き止まりになる。
500
518
 
501
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.12.0...HEAD
519
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.12.1...HEAD
520
+ [0.12.1]: https://github.com/cardene777/cdl/compare/v0.12.0...v0.12.1
502
521
  [0.12.0]: https://github.com/cardene777/cdl/compare/v0.11.0...v0.12.0
503
522
  [0.11.0]: https://github.com/cardene777/cdl/compare/v0.10.0...v0.11.0
504
523
  [0.10.0]: https://github.com/cardene777/cdl/compare/v0.9.0...v0.10.0
package/dist/index.cjs CHANGED
@@ -22000,17 +22000,20 @@ var \u884C\u9001\u308A\u306E\u6BD4 = 1.15;
22000
22000
  var \u5B57\u306E\u9AD8\u3055\u306E\u6BD4 = 0.72;
22001
22001
  var \u4E0A\u4E0B\u306E\u4F59\u767D = 2;
22002
22002
  var \u5DE6\u53F3\u306E\u4F59\u767D = 8;
22003
- function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E45, \u6E2C\u308B = textWidth) {
22004
- if (\u4F7F\u3048\u308B\u5E45 <= 0) return "";
22005
- if (\u6E2C\u308B(text, fontSize) <= \u4F7F\u3048\u308B\u5E45) return text;
22003
+ function \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45) {
22004
+ return \u7BB1\u306E\u5E45 - \u5DE6\u53F3\u306E\u4F59\u767D * 2;
22005
+ }
22006
+ function \u5E45\u3067\u5207\u308B(text, fontSize, \u4F7F\u3048\u308B\u5E452, \u6E2C\u308B = textWidth) {
22007
+ if (\u4F7F\u3048\u308B\u5E452 <= 0) return "";
22008
+ if (\u6E2C\u308B(text, fontSize) <= \u4F7F\u3048\u308B\u5E452) return text;
22006
22009
  const \u7701\u7565 = "\u2026";
22007
22010
  const \u7701\u7565\u306E\u5E45 = \u6E2C\u308B(\u7701\u7565, fontSize);
22008
- if (\u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E45) return "";
22011
+ if (\u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E452) return "";
22009
22012
  let \u51FA = "";
22010
22013
  let \u5E45 = 0;
22011
22014
  for (const c of \u66F8\u8A18\u7D20\u306B\u5206\u3051\u308B(text)) {
22012
22015
  const \u5B57\u306E\u5E452 = \u6E2C\u308B(c, fontSize);
22013
- if (\u5E45 + \u5B57\u306E\u5E452 + \u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E45) break;
22016
+ if (\u5E45 + \u5B57\u306E\u5E452 + \u7701\u7565\u306E\u5E45 > \u4F7F\u3048\u308B\u5E452) break;
22014
22017
  \u5E45 += \u5B57\u306E\u5E452;
22015
22018
  \u51FA += c;
22016
22019
  }
@@ -22028,13 +22031,13 @@ function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8
22028
22031
  const \u9AD8\u3055 = (rs) => rs.reduce((a, r) => a + r.fontSize * \u884C\u9001\u308A\u306E\u6BD4, 0);
22029
22032
  const \u6B8B\u3059 = [...\u5019\u88DC];
22030
22033
  while (\u6B8B\u3059.length > 1 && \u9AD8\u3055(\u6B8B\u3059) > \u4F7F\u3048\u308B\u9AD8\u3055) \u6B8B\u3059.pop();
22031
- const \u4F7F\u3048\u308B\u5E45 = \u7BB1\u306E\u5E45 - \u5DE6\u53F3\u306E\u4F59\u767D * 2;
22034
+ const \u5E45 = \u4F7F\u3048\u308B\u5E45(\u7BB1\u306E\u5E45);
22032
22035
  const \u7DCF\u9AD8 = \u9AD8\u3055(\u6B8B\u3059);
22033
22036
  let \u7A4D\u307F = -\u7DCF\u9AD8 / 2;
22034
22037
  return \u6B8B\u3059.map((r) => {
22035
22038
  const dy = \u7A4D\u307F + (\u884C\u9001\u308A\u306E\u6BD4 + \u5B57\u306E\u9AD8\u3055\u306E\u6BD4) / 2 * r.fontSize;
22036
22039
  \u7A4D\u307F += r.fontSize * \u884C\u9001\u308A\u306E\u6BD4;
22037
- return { ...r, text: \u5E45\u3067\u5207\u308B(r.text, r.fontSize, \u4F7F\u3048\u308B\u5E45), dy };
22040
+ return { ...r, text: \u5E45\u3067\u5207\u308B(r.text, r.fontSize, \u5E45), dy };
22038
22041
  });
22039
22042
  }
22040
22043
  var MIND_TONES = ["accent", "teal", "success", "warning", "info", "error"];
@@ -22131,17 +22134,22 @@ function MindMapNode({
22131
22134
  children: r.text
22132
22135
  },
22133
22136
  r.\u5F79\u5272
22134
- )) : /* @__PURE__ */ jsxRuntime.jsx(
22135
- "text",
22136
- {
22137
- x: n.x,
22138
- y: n.y + 5,
22139
- fontSize: n.isRoot ? 15 : 13,
22140
- fontWeight: n.isRoot ? 700 : 600,
22141
- textAnchor: "middle",
22142
- fill: \u6587\u5B57\u306E\u8272,
22143
- children: n.title
22144
- }
22137
+ )) : (
22138
+ // 補足が無くても **幅に収める** (#526)。 `箱に積む` を通らないこの経路だけが
22139
+ // 幅を見ておらず、長い名前がそのまま箱の外へ出て枝の線と重なっていた
22140
+ // (実測 = 中心の箱で文字 163px に対し箱 120px)
22141
+ /* @__PURE__ */ jsxRuntime.jsx(
22142
+ "text",
22143
+ {
22144
+ x: n.x,
22145
+ y: n.y + 5,
22146
+ fontSize: n.isRoot ? 15 : 13,
22147
+ fontWeight: n.isRoot ? 700 : 600,
22148
+ textAnchor: "middle",
22149
+ fill: \u6587\u5B57\u306E\u8272,
22150
+ children: \u5E45\u3067\u5207\u308B(n.title, n.isRoot ? 15 : 13, \u4F7F\u3048\u308B\u5E45(n.w))
22151
+ }
22152
+ )
22145
22153
  )
22146
22154
  ] }, `n-${n.id}`);
22147
22155
  })
@@ -22757,17 +22765,21 @@ function TreeNode({
22757
22765
  \u7BB1\u306E\u9AD8\u3055: n.h,
22758
22766
  fill: "var(--cdl-text-on-tone, #ffffff)",
22759
22767
  \u540D\u524D\u306E\u592A\u3055: 700
22760
- }) : /* @__PURE__ */ jsxRuntime.jsx(
22761
- "text",
22762
- {
22763
- x: n.w / 2,
22764
- y: n.h / 2 + 5,
22765
- fontSize: 13,
22766
- fontWeight: 700,
22767
- textAnchor: "middle",
22768
- fill: "var(--cdl-text-on-tone, #ffffff)",
22769
- children: n.title
22770
- }
22768
+ }) : (
22769
+ // 補足が無くても幅に収める (#526)。 `箱の文字` を通らないこの経路だけが
22770
+ // 幅を見ておらず、長い名前が箱の外へ出ていた
22771
+ /* @__PURE__ */ jsxRuntime.jsx(
22772
+ "text",
22773
+ {
22774
+ x: n.w / 2,
22775
+ y: n.h / 2 + 5,
22776
+ fontSize: 13,
22777
+ fontWeight: 700,
22778
+ textAnchor: "middle",
22779
+ fill: "var(--cdl-text-on-tone, #ffffff)",
22780
+ children: \u5E45\u3067\u5207\u308B(n.title, 13, \u4F7F\u3048\u308B\u5E45(n.w))
22781
+ }
22782
+ )
22771
22783
  )
22772
22784
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
22773
22785
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -22800,7 +22812,7 @@ function TreeNode({
22800
22812
  fontWeight: 600,
22801
22813
  textAnchor: "middle",
22802
22814
  fill: "var(--cdl-chip-text, #1a1f2a)",
22803
- children: n.title
22815
+ children: \u5E45\u3067\u5207\u308B(n.title, 12, \u4F7F\u3048\u308B\u5E45(n.w))
22804
22816
  }
22805
22817
  )
22806
22818
  ] })