@cardenelabs/cdl 0.40.2 → 0.40.3

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
@@ -5,6 +5,26 @@ CDL (Chainome Diagram Language) の主要変更履歴。
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.40.3] - 2026-09-07
9
+
10
+ ### Fixed
11
+
12
+ - **半円ゲージの内訳の数字が隣とくっつくのを直した** (#731)
13
+
14
+ 下段の内訳は件数で横に等分し、**名前だけを区画に収まるまで切り詰めて数値はそのまま**
15
+ 置いていた。 件数が増えると数字が隣の区画へはみ出し、`10 5.4%11 5.9%` のように
16
+ くっついて読めなかった。 実測で件数 10 から重なり始め、12 で 10 組、24 で 43 組。
17
+
18
+ **区画の幅を中身から決める**。 数値の行が要る幅に区画どうしの間を足したものを 1 件の
19
+ 幅とし、枠に何件置けるかを出す。 入り切らない件は次の段へ送る。 段が増えたぶん弧は
20
+ 低くなる = 弧の高さは内訳を取り分けた残りから決めているので自動で縮む。
21
+
22
+ **数値も名前と同じ幅で切り詰める**。 1 行 1 件しか置けない細い枠では折り返せないため、
23
+ 切り詰めだけが最後の受けになる。 色の印も区画より広いときは区画に合わせて縮む。
24
+
25
+ 級を下げて 1 行に収める案は採らない = 件数 12 では級 7.7 が要り、この repo が他の図で
26
+ 使っている下限の 9 を下回る。
27
+
8
28
  ## [0.40.2] - 2026-09-07
9
29
 
10
30
  ### Fixed
@@ -1823,7 +1843,8 @@ Initial OSS release.
1823
1843
  使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
1824
1844
  行き止まりになる。
1825
1845
 
1826
- [Unreleased]: https://github.com/cardene777/cdl/compare/v0.40.2...HEAD
1846
+ [Unreleased]: https://github.com/cardene777/cdl/compare/v0.40.3...HEAD
1847
+ [0.40.3]: https://github.com/cardene777/cdl/compare/v0.40.2...v0.40.3
1827
1848
  [0.40.2]: https://github.com/cardene777/cdl/compare/v0.40.1...v0.40.2
1828
1849
  [0.40.1]: https://github.com/cardene777/cdl/compare/v0.40.0...v0.40.1
1829
1850
  [0.40.0]: https://github.com/cardene777/cdl/compare/v0.39.0...v0.40.0
package/dist/index.cjs CHANGED
@@ -24888,8 +24888,18 @@ function ChartGaugeNode({
24888
24888
  const \u4F7F\u3048\u308B\u5E452 = node.w - PAD_SIDE * 2;
24889
24889
  const \u540D\u524D\u306E\u7D1A = 14;
24890
24890
  const \u6570\u5024\u306E\u7D1A = 13;
24891
- const \u5185\u8A33\u306E\u9AD8\u3055 = 56;
24891
+ const \u6BB5\u306E\u9AD8\u3055 = 56;
24892
24892
  const \u5F27\u3068\u5185\u8A33\u306E\u9593 = 16;
24893
+ const \u5370\u306E\u5E452 = 30;
24894
+ const \u533A\u753B\u306E\u9593 = 12;
24895
+ const \u5185\u8A33\u306E\u6570\u5024 = data.map((d) => `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u8868\u8A18(d.value / total)}`);
24896
+ const \u4EF6\u306B\u8981\u308B\u5E45 = Math.max(\u5370\u306E\u5E452, ...\u5185\u8A33\u306E\u6570\u5024.map((t) => textWidth(t, \u6570\u5024\u306E\u7D1A))) + \u533A\u753B\u306E\u9593;
24897
+ const \u884C\u306E\u4EF6\u6570 = Math.min(
24898
+ Math.max(1, Math.floor(\u4F7F\u3048\u308B\u5E452 / Math.max(\u4EF6\u306B\u8981\u308B\u5E45, 1))),
24899
+ Math.max(data.length, 1)
24900
+ );
24901
+ const \u5185\u8A33\u306E\u6BB5\u6570 = Math.ceil(Math.max(data.length, 1) / \u884C\u306E\u4EF6\u6570);
24902
+ const \u5185\u8A33\u306E\u9AD8\u3055 = \u6BB5\u306E\u9AD8\u3055 * \u5185\u8A33\u306E\u6BB5\u6570;
24893
24903
  const \u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055 = \u4F7F\u3048\u308B\u9AD8\u3055 - \u5185\u8A33\u306E\u9AD8\u3055 - \u5F27\u3068\u5185\u8A33\u306E\u9593;
24894
24904
  const radius = Math.max(24, Math.min(\u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055, \u4F7F\u3048\u308B\u5E452 / 2));
24895
24905
  const \u5185\u534A\u5F84 = radius * 0.62;
@@ -24918,7 +24928,7 @@ function ChartGaugeNode({
24918
24928
  );
24919
24929
  const \u5408\u8A08\u306E\u7D1A = Math.max(11, Math.round(\u7D1A\u306E\u5019\u88DC));
24920
24930
  const \u898B\u51FA\u3057\u306E\u7D1A = Math.max(9, Math.round(\u5408\u8A08\u306E\u7D1A * 0.38));
24921
- const \u5185\u8A33\u306E\u5E45 = \u4F7F\u3048\u308B\u5E452 / Math.max(data.length, 1);
24931
+ const \u5185\u8A33\u306E\u5E45 = \u4F7F\u3048\u308B\u5E452 / \u884C\u306E\u4EF6\u6570;
24922
24932
  const \u5185\u8A33\u306Ey = cy + \u5F27\u3068\u5185\u8A33\u306E\u9593;
24923
24933
  const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
24924
24934
  const \u5207\u308A\u629C\u304Did = `cdl-gauge-draw-${react.useId().replace(/[^A-Za-z0-9_-]/g, "")}`;
@@ -24976,22 +24986,35 @@ function ChartGaugeNode({
24976
24986
  }
24977
24987
  ),
24978
24988
  data.map((d, idx) => {
24979
- const x = PAD_SIDE + \u5185\u8A33\u306E\u5E45 * idx;
24980
- const \u6570\u5024 = `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u8868\u8A18(d.value / total)}`;
24989
+ const \u5217 = idx % \u884C\u306E\u4EF6\u6570;
24990
+ const \u6BB5 = Math.floor(idx / \u884C\u306E\u4EF6\u6570);
24991
+ const x = PAD_SIDE + \u5185\u8A33\u306E\u5E45 * \u5217;
24992
+ const y = \u5185\u8A33\u306Ey + \u6BB5\u306E\u9AD8\u3055 * \u6BB5;
24993
+ const \u53CE\u307E\u308B\u5E45 = \u5185\u8A33\u306E\u5E45 - \u533A\u753B\u306E\u9593;
24981
24994
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "chart-gauge-item", children: [
24982
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x, y: \u5185\u8A33\u306Ey, width: 30, height: 4, rx: 2, fill: arcColor(d.tone, idx) }),
24995
+ /* @__PURE__ */ jsxRuntime.jsx(
24996
+ "rect",
24997
+ {
24998
+ x,
24999
+ y,
25000
+ width: Math.max(4, Math.min(\u5370\u306E\u5E452, \u53CE\u307E\u308B\u5E45)),
25001
+ height: 4,
25002
+ rx: 2,
25003
+ fill: arcColor(d.tone, idx)
25004
+ }
25005
+ ),
24983
25006
  /* @__PURE__ */ jsxRuntime.jsx(
24984
25007
  "text",
24985
25008
  {
24986
25009
  x,
24987
- y: \u5185\u8A33\u306Ey + 26,
25010
+ y: y + 26,
24988
25011
  fontSize: \u540D\u524D\u306E\u7D1A,
24989
25012
  fontWeight: 700,
24990
25013
  fill: "var(--cdl-text, #1a1f2a)",
24991
- children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u5185\u8A33\u306E\u5E45 - 12, \u540D\u524D\u306E\u7D1A)
25014
+ children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u53CE\u307E\u308B\u5E45, \u540D\u524D\u306E\u7D1A)
24992
25015
  }
24993
25016
  ),
24994
- /* @__PURE__ */ jsxRuntime.jsx("text", { x, y: \u5185\u8A33\u306Ey + 46, fontSize: \u6570\u5024\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u6570\u5024 })
25017
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x, y: y + 46, fontSize: \u6570\u5024\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u5207\u308A\u8A70\u3081\u308B(\u5185\u8A33\u306E\u6570\u5024[idx] ?? "", \u53CE\u307E\u308B\u5E45, \u6570\u5024\u306E\u7D1A) })
24995
25018
  ] }, `legend-${idx}`);
24996
25019
  })
24997
25020
  ] });