@cardenelabs/cdl 0.40.2 → 0.40.4
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 +42 -1
- package/dist/index.cjs +33 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +33 -10
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +33 -10
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +33 -10
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/src/anim/core/timeline.ts +13 -3
- package/src/anim/core/types.ts +1 -1
- package/src/kinds/chart-gauge.tsx +56 -11
- package/src/render.tsx +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,45 @@ CDL (Chainome Diagram Language) の主要変更履歴。
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.40.4] - 2026-09-07
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **値の動きが始まった瞬間に終わって見えるのを直した** (#736)
|
|
13
|
+
|
|
14
|
+
段 (phase) の値を動かす動き (`tween`) は既定の曲線 `easeOutQuint` を通っており、
|
|
15
|
+
**動きが前半に寄りすぎていた**。 段の長さ 1.2 秒の折れ線で測ると、動きの 9 割が
|
|
16
|
+
最初の 0.449 秒で終わり、残りの 0.75 秒はほとんど止まって見える (半分に達するのが
|
|
17
|
+
段の 13.1% の時点)。 段を長くしても形は変わらず、止まって見える時間だけが伸びた。
|
|
18
|
+
|
|
19
|
+
既定を `easeOut` (`cubic-bezier(0, 0, 0.58, 1)`) にゆるめた。 半分に達するのが
|
|
20
|
+
34.2% の時点になり、段の終わりまで動き続ける。
|
|
21
|
+
|
|
22
|
+
線を引く動き (`draw`) は今までどおり曲線を通らない (#711)。 ペンの速さは一定である
|
|
23
|
+
ほど「1 つずつ現れる」 が読めるため。
|
|
24
|
+
|
|
25
|
+
曲線を差し替える口 (`TimelineOptions.easing`) は今までどおり開いている。
|
|
26
|
+
|
|
27
|
+
## [0.40.3] - 2026-09-07
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **半円ゲージの内訳の数字が隣とくっつくのを直した** (#731)
|
|
32
|
+
|
|
33
|
+
下段の内訳は件数で横に等分し、**名前だけを区画に収まるまで切り詰めて数値はそのまま**
|
|
34
|
+
置いていた。 件数が増えると数字が隣の区画へはみ出し、`10 5.4%11 5.9%` のように
|
|
35
|
+
くっついて読めなかった。 実測で件数 10 から重なり始め、12 で 10 組、24 で 43 組。
|
|
36
|
+
|
|
37
|
+
**区画の幅を中身から決める**。 数値の行が要る幅に区画どうしの間を足したものを 1 件の
|
|
38
|
+
幅とし、枠に何件置けるかを出す。 入り切らない件は次の段へ送る。 段が増えたぶん弧は
|
|
39
|
+
低くなる = 弧の高さは内訳を取り分けた残りから決めているので自動で縮む。
|
|
40
|
+
|
|
41
|
+
**数値も名前と同じ幅で切り詰める**。 1 行 1 件しか置けない細い枠では折り返せないため、
|
|
42
|
+
切り詰めだけが最後の受けになる。 色の印も区画より広いときは区画に合わせて縮む。
|
|
43
|
+
|
|
44
|
+
級を下げて 1 行に収める案は採らない = 件数 12 では級 7.7 が要り、この repo が他の図で
|
|
45
|
+
使っている下限の 9 を下回る。
|
|
46
|
+
|
|
8
47
|
## [0.40.2] - 2026-09-07
|
|
9
48
|
|
|
10
49
|
### Fixed
|
|
@@ -1823,7 +1862,9 @@ Initial OSS release.
|
|
|
1823
1862
|
使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
|
|
1824
1863
|
行き止まりになる。
|
|
1825
1864
|
|
|
1826
|
-
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.40.
|
|
1865
|
+
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.40.4...HEAD
|
|
1866
|
+
[0.40.4]: https://github.com/cardene777/cdl/compare/v0.40.3...v0.40.4
|
|
1867
|
+
[0.40.3]: https://github.com/cardene777/cdl/compare/v0.40.2...v0.40.3
|
|
1827
1868
|
[0.40.2]: https://github.com/cardene777/cdl/compare/v0.40.1...v0.40.2
|
|
1828
1869
|
[0.40.1]: https://github.com/cardene777/cdl/compare/v0.40.0...v0.40.1
|
|
1829
1870
|
[0.40.0]: https://github.com/cardene777/cdl/compare/v0.39.0...v0.40.0
|
package/dist/index.cjs
CHANGED
|
@@ -14134,7 +14134,7 @@ function cubicBezier(x1, y1, x2, y2) {
|
|
|
14134
14134
|
return sampleCurveY(solveCurveX(t));
|
|
14135
14135
|
};
|
|
14136
14136
|
}
|
|
14137
|
-
var
|
|
14137
|
+
var easeOut = cubicBezier(0, 0, 0.58, 1);
|
|
14138
14138
|
function clamp01(value) {
|
|
14139
14139
|
if (value < 0) return 0;
|
|
14140
14140
|
if (value > 1) return 1;
|
|
@@ -14179,7 +14179,7 @@ var Timeline = class {
|
|
|
14179
14179
|
throw new Error("Timeline requires at least one phase");
|
|
14180
14180
|
}
|
|
14181
14181
|
this.phases = phases;
|
|
14182
|
-
this.easing = options.easing ??
|
|
14182
|
+
this.easing = options.easing ?? easeOut;
|
|
14183
14183
|
this.loop = options.loop ?? false;
|
|
14184
14184
|
this.autoAdvanceMsOverride = options.autoAdvanceMs;
|
|
14185
14185
|
this.phaseHoldMs = options.phaseHoldMs ?? 0;
|
|
@@ -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 \
|
|
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 /
|
|
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
|
|
24980
|
-
const \
|
|
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(
|
|
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:
|
|
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 ?? "", \
|
|
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:
|
|
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
|
] });
|