@cardenelabs/cdl 0.9.0 → 0.11.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.
- package/CHANGELOG.md +65 -1
- package/SPEC.md +22 -1
- package/dist/index.cjs +162 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +163 -65
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +155 -63
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +156 -64
- package/dist/react.js.map +1 -1
- package/dist/{render-hmFRAabt.d.cts → render-DwH8v5Mb.d.cts} +21 -0
- package/dist/{render-hmFRAabt.d.ts → render-DwH8v5Mb.d.ts} +21 -0
- package/package.json +1 -1
- package/src/builder.ts +13 -1
- package/src/kinds/chart-bar.tsx +49 -12
- package/src/kinds/chart-line.tsx +94 -25
- package/src/kinds/chart-pie.tsx +80 -15
- package/src/render/nodes.tsx +33 -3
- package/src/render/stage.tsx +4 -0
- package/src/types.ts +21 -0
- package/src/validate.ts +34 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,68 @@ CDL (Chainome Diagram Language) の主要変更履歴。
|
|
|
7
7
|
|
|
8
8
|
予定 ... feedback を反映した patch / minor。
|
|
9
9
|
|
|
10
|
+
## [0.11.0] - 2026-08-21
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **棒と扇も段の進みでそれぞれの起点から描けるようにした** (#517)
|
|
15
|
+
|
|
16
|
+
段の `draw` は `0.10.0` で入ったが `chart-line` だけが対応していた。 対象を 3 種に広げ、
|
|
17
|
+
棒は横軸から上へ伸び、扇は 12 時から時計回りに開くようにした。 数字は棒の頭に付いて動き、
|
|
18
|
+
凡例はその扇が開き始めた時に出る。
|
|
19
|
+
|
|
20
|
+
**形を表す属性は触らない**。 折れ線が `points` を触らず dash で伸ばしたのと同じ制約で、
|
|
21
|
+
棒は足元を動かさない点にした倍率で包み、円は扇形の切り抜きで見える範囲だけを変える。
|
|
22
|
+
`rect` の `height` / `y` と `path` の `d` は進みに関わらず実値のまま = 図形の寸法から値を
|
|
23
|
+
測る利用側が、進みの途中で別の値を読まない。
|
|
24
|
+
|
|
25
|
+
対応種別の一覧を `validate.ts` の `DRAW_KINDS` が持ち、書けない種別を指した時の知らせも
|
|
26
|
+
そこから組み立てる。
|
|
27
|
+
|
|
28
|
+
## [0.10.0] - 2026-08-21
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- **段の進みで折れ線を左の起点から伸ばせるようにした** (#513)
|
|
33
|
+
|
|
34
|
+
段 (`CdlPhase`) に `draw` を足した。 `activate` と同じ形で node id を並べると、その node が
|
|
35
|
+
段の進み (0 → 1) に合わせて描かれる。 最初の対象は折れ線 (`chart-line`) で、線が左端から
|
|
36
|
+
右へ伸び、点と値の数字は線の先が自分の位置に届いた時に現れる。 軸 / 格子 / 横軸の名前は
|
|
37
|
+
最初から出る。
|
|
38
|
+
|
|
39
|
+
伸ばすのは dash (`pathLength` / `strokeDasharray` / `strokeDashoffset`) で、`points` は進みに
|
|
40
|
+
関わらず全点を持つ。 点を削る形にすると、利用側が数えている点の数が進みの途中で変わる。
|
|
41
|
+
|
|
42
|
+
引き金に `activate` を使わないのは、1 箱で図全体を描く種別では焦点がその箱に解決されるため。
|
|
43
|
+
連続する段で光り続ける図が実在し、「光っていたら描く」 にすると値が動くだけの段でも線を
|
|
44
|
+
引き直すことになる。
|
|
45
|
+
|
|
46
|
+
組立て API は `PhaseBuilder.draw(...ids)`。 `draw` を書かない図は従来どおり全長で描き、
|
|
47
|
+
DOM に属性も 1 つも増えない。
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- **候補が node の時に「定義済 lane」 と知らせるのをやめた** (#513)
|
|
52
|
+
|
|
53
|
+
近い候補が無い時に出る一覧の文言が `lane` 固定で、探す先を間違える案内になっていた。
|
|
54
|
+
`suggest` に候補の種別を渡せるようにし、node を候補にする 3 箇所 (`draw` / edge の `from` /
|
|
55
|
+
edge の `to`) を揃えた。
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- **repo 内の agent worktree を eslint の対象から外した** (#507)
|
|
60
|
+
|
|
61
|
+
指摘の 6 割が worktree の複製から出ており、実体を直しても消えなかった。
|
|
62
|
+
|
|
63
|
+
- **README と CONTRIBUTING の記述を実態に合わせた** (#505)
|
|
64
|
+
|
|
65
|
+
存在しない playground と command を前提にした記述が残っていた。
|
|
66
|
+
|
|
67
|
+
- **skip されていた検査 2 件を解除した** (#510 / #511)
|
|
68
|
+
|
|
69
|
+
どちらも routing の不具合ではなく、検査の前提が誤っていた。 実装は 1 行も変えていない。
|
|
70
|
+
併せて、行き先として書かれていた実在しない Issue 番号を実在するものに付け替えた。
|
|
71
|
+
|
|
10
72
|
## [0.9.0] - 2026-08-20
|
|
11
73
|
|
|
12
74
|
`0.8.0` は tag を打った後 npm に公開されないまま 17 commit が載った。 同じ番号で公開すると
|
|
@@ -392,7 +454,9 @@ Initial OSS release.
|
|
|
392
454
|
使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
|
|
393
455
|
行き止まりになる。
|
|
394
456
|
|
|
395
|
-
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.
|
|
457
|
+
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.11.0...HEAD
|
|
458
|
+
[0.11.0]: https://github.com/cardene777/cdl/compare/v0.10.0...v0.11.0
|
|
459
|
+
[0.10.0]: https://github.com/cardene777/cdl/compare/v0.9.0...v0.10.0
|
|
396
460
|
[0.9.0]: https://github.com/cardene777/cdl/compare/v0.8.0...v0.9.0
|
|
397
461
|
[0.8.0]: https://github.com/cardene777/cdl/compare/v0.7.0...v0.8.0
|
|
398
462
|
[0.7.0]: https://github.com/cardene777/cdl/compare/v0.6.1...v0.7.0
|
package/SPEC.md
CHANGED
|
@@ -123,11 +123,32 @@ diagram.phase(id, {
|
|
|
123
123
|
body: string, // 説明文 (日本語、 header に表示)
|
|
124
124
|
}, builder => builder
|
|
125
125
|
.activate(...ids) // active な node / edge id を列挙
|
|
126
|
+
.draw(...ids) // この phase で左の起点から描き始める node id を列挙
|
|
126
127
|
.tween(stateId, from, to) // state を線形補間
|
|
127
128
|
.badge(text) // BalanceDiffCard 等の status badge 文字列
|
|
128
129
|
);
|
|
129
130
|
```
|
|
130
131
|
|
|
132
|
+
`draw` は `activate` と別集合で持つ。 1 箱で図全体を描く種別では焦点がその箱に解決される
|
|
133
|
+
ため、 連続する phase で光り続ける図が実在し、 光っているかを引き金にすると値が動くだけの
|
|
134
|
+
phase でも線を引き直すことになる。
|
|
135
|
+
|
|
136
|
+
対象の node は phase の進み (0→1) に合わせて描かれる。 起点は種別ごとに違う。
|
|
137
|
+
|
|
138
|
+
| kind | 起点 | 動き | 添える値 |
|
|
139
|
+
|---|---|---|---|
|
|
140
|
+
| `chart-line` | 左端 | 線が右へ伸びる | 点と数字は線の先が届いた時 |
|
|
141
|
+
| `chart-bar` | 横軸 | 棒が上へ伸びる | 数字は棒の頭に付いて動く |
|
|
142
|
+
| `chart-pie` | 12 時 | 扇が時計回りに開く | 凡例はその扇が開き始めた時 |
|
|
143
|
+
|
|
144
|
+
対応種別の一覧は `validate.ts` の `DRAW_KINDS` が持ち、 知らせの文面もそこから組み立てる。
|
|
145
|
+
|
|
146
|
+
**形を表す属性は触らない**。 折れ線は `points` を、 棒は `rect` の `height` / `y` を、
|
|
147
|
+
円は `path` の `d` を進みに関わらず実値のまま保ち、 見える範囲だけを変える (dash / 倍率 /
|
|
148
|
+
切り抜き)。 図形の寸法から値を測る利用側が、 進みの途中で別の値を読まないようにするため。
|
|
149
|
+
|
|
150
|
+
`draw` を書かない図は従来どおり全体を描き、 DOM に属性も要素も足さない。
|
|
151
|
+
|
|
131
152
|
phase が定義されると自動的に。
|
|
132
153
|
- 全 phase が timeline 化 (autoplay + loop)
|
|
133
154
|
- 各 phase の active set 以外は inactive 化 (灰 dashed)
|
|
@@ -351,7 +372,7 @@ export const erc20Transfer = diagram("erc20-transfer", { topic: "ERC-20 Transfer
|
|
|
351
372
|
| arrow | edge の from/to が存在、 同 from/to ペアが side hint なく被る |
|
|
352
373
|
| label | label / sublabel 文字数で box が lane 幅を超える |
|
|
353
374
|
| japanese-only | title / eyebrow / subtitle / label に uppercase 英単語 (FUNCTION/STORAGE/...) |
|
|
354
|
-
| phase-isolation | phase の activate id が存在する node/edge を指す |
|
|
375
|
+
| phase-isolation | phase の activate id が存在する node/edge を指す、 draw id が存在する node を指す |
|
|
355
376
|
| neumorphism | tone が定義された 4 色から外れる |
|
|
356
377
|
|
|
357
378
|
build error / warn を投げ、 著者は cdl 段階で修正できる (screenshot 取る前に)。
|
package/dist/index.cjs
CHANGED
|
@@ -9363,6 +9363,10 @@ function makePhaseBuilder(acc) {
|
|
|
9363
9363
|
acc.activate.push(...ids);
|
|
9364
9364
|
return api;
|
|
9365
9365
|
},
|
|
9366
|
+
draw(...ids) {
|
|
9367
|
+
acc.draw.push(...ids);
|
|
9368
|
+
return api;
|
|
9369
|
+
},
|
|
9366
9370
|
tween(stateId, from, to) {
|
|
9367
9371
|
acc.tweens.push({ stateId, from, to });
|
|
9368
9372
|
return api;
|
|
@@ -11442,7 +11446,7 @@ function diagram(id, options) {
|
|
|
11442
11446
|
}
|
|
11443
11447
|
},
|
|
11444
11448
|
phase(phaseId, opts, build) {
|
|
11445
|
-
const acc = { activate: [], tweens: [], sets: [] };
|
|
11449
|
+
const acc = { activate: [], draw: [], tweens: [], sets: [] };
|
|
11446
11450
|
build(makePhaseBuilder(acc));
|
|
11447
11451
|
phases.push({
|
|
11448
11452
|
id: phaseId,
|
|
@@ -11450,6 +11454,8 @@ function diagram(id, options) {
|
|
|
11450
11454
|
title: opts.title,
|
|
11451
11455
|
body: opts.body,
|
|
11452
11456
|
activate: acc.activate,
|
|
11457
|
+
// 空なら欄ごと置かない。 置くと `draw` を使わない図の JSON の形が変わる
|
|
11458
|
+
...acc.draw.length > 0 ? { draw: acc.draw } : {},
|
|
11453
11459
|
tweens: acc.tweens,
|
|
11454
11460
|
sets: acc.sets,
|
|
11455
11461
|
badge: acc.badge
|
|
@@ -15858,6 +15864,7 @@ function nodeTemplateTexts(node) {
|
|
|
15858
15864
|
|
|
15859
15865
|
// src/validate.ts
|
|
15860
15866
|
var TONES2 = new Set(TONES);
|
|
15867
|
+
var DRAW_KINDS = /* @__PURE__ */ new Set(["chart-line", "chart-bar", "chart-pie"]);
|
|
15861
15868
|
var KINDS = new Set(NODE_KINDS);
|
|
15862
15869
|
var ENG_BANNED = /\b(FUNCTION|STORAGE|EVENT LOG|BALANCES MAPPING|READ|WRITE|EMIT|CALL)\b/;
|
|
15863
15870
|
function validate(diag) {
|
|
@@ -15921,7 +15928,7 @@ function validate(diag) {
|
|
|
15921
15928
|
...(diag.formulas ?? []).map((f) => f.id),
|
|
15922
15929
|
...(diag.scrollTriggers ?? []).map((t) => t.id)
|
|
15923
15930
|
]);
|
|
15924
|
-
const suggest = (target, candidates) => {
|
|
15931
|
+
const suggest = (target, candidates, candidateKind = "lane") => {
|
|
15925
15932
|
const list = [...candidates];
|
|
15926
15933
|
if (list.length === 0) return "";
|
|
15927
15934
|
let best = "";
|
|
@@ -15933,7 +15940,7 @@ function validate(diag) {
|
|
|
15933
15940
|
best = c;
|
|
15934
15941
|
}
|
|
15935
15942
|
}
|
|
15936
|
-
return bestD <= 2 ? ` (\u3082\u3057\u304B\u3057\u3066 "${best}"?)` : ` (\u5B9A\u7FA9\u6E08
|
|
15943
|
+
return bestD <= 2 ? ` (\u3082\u3057\u304B\u3057\u3066 "${best}"?)` : ` (\u5B9A\u7FA9\u6E08 ${candidateKind}: ${list.slice(0, 5).join(", ")}${list.length > 5 ? "..." : ""})`;
|
|
15937
15944
|
};
|
|
15938
15945
|
for (const n of diag.nodes) {
|
|
15939
15946
|
if (!laneIds.has(n.lane)) {
|
|
@@ -15946,13 +15953,13 @@ function validate(diag) {
|
|
|
15946
15953
|
for (const e of diag.edges) {
|
|
15947
15954
|
if (!nodeIds.has(e.from)) {
|
|
15948
15955
|
errors.push(
|
|
15949
|
-
`[cdl] unknown-ref: edge "${e.id}" \u306E from "${e.from}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.from, nodeIds)}
|
|
15956
|
+
`[cdl] unknown-ref: edge "${e.id}" \u306E from "${e.from}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.from, nodeIds, "node")}
|
|
15950
15957
|
\u2192 \u4FEE\u6B63\u4F8B: .node("${e.from}", { lane: "...", stack: 0, kind: "actor", title: "..." }) \u3092 edge \u5BA3\u8A00\u524D\u306B\u8FFD\u52A0`
|
|
15951
15958
|
);
|
|
15952
15959
|
}
|
|
15953
15960
|
if (!nodeIds.has(e.to)) {
|
|
15954
15961
|
errors.push(
|
|
15955
|
-
`[cdl] unknown-ref: edge "${e.id}" \u306E to "${e.to}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.to, nodeIds)}
|
|
15962
|
+
`[cdl] unknown-ref: edge "${e.id}" \u306E to "${e.to}" \u304C node \u306B\u5B58\u5728\u3057\u307E\u305B\u3093${suggest(e.to, nodeIds, "node")}
|
|
15956
15963
|
\u2192 \u4FEE\u6B63\u4F8B: .node("${e.to}", { lane: "...", stack: 0, kind: "...", title: "..." }) \u3092 edge \u5BA3\u8A00\u524D\u306B\u8FFD\u52A0`
|
|
15957
15964
|
);
|
|
15958
15965
|
}
|
|
@@ -15969,6 +15976,18 @@ function validate(diag) {
|
|
|
15969
15976
|
errors.push(`[cdl] unknown-ref: phase "${p.id}" \u306E activate "${id}" \u306F node \u3067\u3082 edge \u3067\u3082\u306A\u3044 (typo \u306E\u53EF\u80FD\u6027)`);
|
|
15970
15977
|
}
|
|
15971
15978
|
}
|
|
15979
|
+
for (const id of p.draw ?? []) {
|
|
15980
|
+
if (!nodeIds.has(id)) {
|
|
15981
|
+
errors.push(`[cdl] unknown-ref: phase "${p.id}" \u306E draw "${id}" \u306F node \u3067\u306F\u306A\u3044 (typo \u306E\u53EF\u80FD\u6027)${suggest(id, nodeIds, "node")}`);
|
|
15982
|
+
continue;
|
|
15983
|
+
}
|
|
15984
|
+
const kind = diag.nodes.find((n) => n.id === id)?.kind;
|
|
15985
|
+
if (!DRAW_KINDS.has(String(kind))) {
|
|
15986
|
+
warnings.push(
|
|
15987
|
+
`phase "${p.id}" \u306E draw "${id}" \u306F kind "${kind}" \u3067\u3001 \u8D77\u70B9\u304B\u3089\u63CF\u304F\u52D5\u304D\u3092\u6301\u305F\u306A\u3044 (\u5BFE\u8C61\u306F ${[...DRAW_KINDS].join(" / ")})`
|
|
15988
|
+
);
|
|
15989
|
+
}
|
|
15990
|
+
}
|
|
15972
15991
|
for (const t of p.tweens) {
|
|
15973
15992
|
if (!stateIds.has(t.stateId)) {
|
|
15974
15993
|
errors.push(`[cdl] unknown-ref: phase "${p.id}" tween \u5BFE\u8C61 state "${t.stateId}" \u672A\u5B9A\u7FA9`);
|
|
@@ -21266,7 +21285,9 @@ function resolveMindData(data, values) {
|
|
|
21266
21285
|
function ChartLineNode({
|
|
21267
21286
|
node,
|
|
21268
21287
|
active,
|
|
21269
|
-
stateValues = {}
|
|
21288
|
+
stateValues = {},
|
|
21289
|
+
drawing = false,
|
|
21290
|
+
progress = 1
|
|
21270
21291
|
}) {
|
|
21271
21292
|
const x0 = node.cx - node.w / 2;
|
|
21272
21293
|
const y0 = node.cy - node.h / 2;
|
|
@@ -21287,6 +21308,24 @@ function ChartLineNode({
|
|
|
21287
21308
|
const xAt = (idx) => PAD_LEFT + (data.length <= 1 ? canvasW / 2 : canvasW * idx / (data.length - 1));
|
|
21288
21309
|
const yAt = (v) => plotTop + plotH - (v - vMin) / vRange * plotH;
|
|
21289
21310
|
const points = data.map((d, idx) => `${xAt(idx)},${yAt(d.value)}`).join(" ");
|
|
21311
|
+
const \u70B9\u307E\u3067\u306E\u9577\u3055 = [];
|
|
21312
|
+
let \u7DDA\u306E\u5168\u9577 = 0;
|
|
21313
|
+
let \u524D\u306E\u70B9;
|
|
21314
|
+
for (const [idx, datum] of data.entries()) {
|
|
21315
|
+
const \u4ECA\u306E\u70B9 = { x: xAt(idx), y: yAt(datum.value) };
|
|
21316
|
+
if (\u524D\u306E\u70B9) {
|
|
21317
|
+
\u7DDA\u306E\u5168\u9577 += Math.hypot(\u4ECA\u306E\u70B9.x - \u524D\u306E\u70B9.x, \u4ECA\u306E\u70B9.y - \u524D\u306E\u70B9.y);
|
|
21318
|
+
}
|
|
21319
|
+
\u70B9\u307E\u3067\u306E\u9577\u3055.push(\u7DDA\u306E\u5168\u9577);
|
|
21320
|
+
\u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
|
|
21321
|
+
}
|
|
21322
|
+
const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
|
|
21323
|
+
const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => {
|
|
21324
|
+
if (!drawing) return true;
|
|
21325
|
+
if (data.length <= 1) return true;
|
|
21326
|
+
if (\u7DDA\u306E\u5168\u9577 === 0) return true;
|
|
21327
|
+
return \u4F38\u3073 >= (\u70B9\u307E\u3067\u306E\u9577\u3055[idx] ?? 0) / \u7DDA\u306E\u5168\u9577;
|
|
21328
|
+
};
|
|
21290
21329
|
const gridCount = 4;
|
|
21291
21330
|
const gridTicks = Array.from({ length: gridCount + 1 }, (_, i) => {
|
|
21292
21331
|
const v = vMin + vRange * i / gridCount;
|
|
@@ -21364,7 +21403,8 @@ function ChartLineNode({
|
|
|
21364
21403
|
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
21365
21404
|
strokeWidth: 2.5,
|
|
21366
21405
|
strokeLinejoin: "round",
|
|
21367
|
-
strokeLinecap: "round"
|
|
21406
|
+
strokeLinecap: "round",
|
|
21407
|
+
...drawing ? { pathLength: 1, strokeDasharray: 1, strokeDashoffset: 1 - \u4F38\u3073 } : {}
|
|
21368
21408
|
}
|
|
21369
21409
|
),
|
|
21370
21410
|
data.map((d, idx) => {
|
|
@@ -21375,40 +21415,43 @@ function ChartLineNode({
|
|
|
21375
21415
|
const isValley = (prev === void 0 || d.value <= prev) && (next === void 0 || d.value <= next);
|
|
21376
21416
|
const labelAbove = !isValley;
|
|
21377
21417
|
const labelY = labelAbove ? cy - 12 : cy + 18;
|
|
21418
|
+
const \u51FA\u3059 = \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F(idx);
|
|
21378
21419
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-unresolved": d.unresolved ? "true" : void 0, children: [
|
|
21379
|
-
/* @__PURE__ */ jsxRuntime.
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21384
|
-
|
|
21385
|
-
|
|
21386
|
-
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
|
|
21391
|
-
|
|
21392
|
-
|
|
21393
|
-
|
|
21394
|
-
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
21398
|
-
|
|
21399
|
-
|
|
21400
|
-
|
|
21401
|
-
|
|
21402
|
-
|
|
21403
|
-
|
|
21404
|
-
|
|
21405
|
-
|
|
21406
|
-
|
|
21407
|
-
|
|
21408
|
-
|
|
21409
|
-
|
|
21410
|
-
|
|
21411
|
-
|
|
21420
|
+
\u51FA\u3059 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
21421
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21422
|
+
"circle",
|
|
21423
|
+
{
|
|
21424
|
+
cx,
|
|
21425
|
+
cy,
|
|
21426
|
+
r: 5,
|
|
21427
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
21428
|
+
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
21429
|
+
strokeWidth: 2.5
|
|
21430
|
+
}
|
|
21431
|
+
),
|
|
21432
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21433
|
+
"circle",
|
|
21434
|
+
{
|
|
21435
|
+
cx,
|
|
21436
|
+
cy,
|
|
21437
|
+
r: 2.5,
|
|
21438
|
+
fill: "var(--cdl-tone-accent, #2d6a8f)"
|
|
21439
|
+
}
|
|
21440
|
+
),
|
|
21441
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21442
|
+
"text",
|
|
21443
|
+
{
|
|
21444
|
+
"data-cdl-role": "chart-line-value",
|
|
21445
|
+
x: cx,
|
|
21446
|
+
y: labelY,
|
|
21447
|
+
fontSize: 11,
|
|
21448
|
+
fontWeight: 600,
|
|
21449
|
+
textAnchor: "middle",
|
|
21450
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
21451
|
+
children: d.value.toLocaleString()
|
|
21452
|
+
}
|
|
21453
|
+
)
|
|
21454
|
+
] }),
|
|
21412
21455
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21413
21456
|
"text",
|
|
21414
21457
|
{
|
|
@@ -21427,8 +21470,11 @@ function ChartLineNode({
|
|
|
21427
21470
|
function ChartPieNode({
|
|
21428
21471
|
node,
|
|
21429
21472
|
active,
|
|
21430
|
-
stateValues = {}
|
|
21473
|
+
stateValues = {},
|
|
21474
|
+
drawing = false,
|
|
21475
|
+
progress = 1
|
|
21431
21476
|
}) {
|
|
21477
|
+
const instanceId = react.useId().replace(/[^A-Za-z0-9_-]/g, "");
|
|
21432
21478
|
const x0 = node.cx - node.w / 2;
|
|
21433
21479
|
const y0 = node.cy - node.h / 2;
|
|
21434
21480
|
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
@@ -21441,20 +21487,26 @@ function ChartPieNode({
|
|
|
21441
21487
|
const cx = pieAreaW / 2;
|
|
21442
21488
|
const cy = PAD_TOP + chartAreaH / 2;
|
|
21443
21489
|
let cumAngle = -Math.PI / 2;
|
|
21490
|
+
let cumFrac = 0;
|
|
21444
21491
|
const slices = data.map((d) => {
|
|
21445
21492
|
const frac = d.value / total;
|
|
21446
21493
|
const angle = frac * Math.PI * 2;
|
|
21447
21494
|
const a0 = cumAngle;
|
|
21448
21495
|
const a1 = cumAngle + angle;
|
|
21449
21496
|
cumAngle = a1;
|
|
21497
|
+
const startFrac = cumFrac;
|
|
21498
|
+
cumFrac += frac;
|
|
21450
21499
|
const x1 = cx + radius * Math.cos(a0);
|
|
21451
21500
|
const y1 = cy + radius * Math.sin(a0);
|
|
21452
21501
|
const x2 = cx + radius * Math.cos(a1);
|
|
21453
21502
|
const y2 = cy + radius * Math.sin(a1);
|
|
21454
21503
|
const large = angle > Math.PI ? 1 : 0;
|
|
21455
21504
|
const path = `M ${cx} ${cy} L ${x1} ${y1} A ${radius} ${radius} 0 ${large} 1 ${x2} ${y2} Z`;
|
|
21456
|
-
return { d, frac, path };
|
|
21505
|
+
return { d, frac, path, startFrac };
|
|
21457
21506
|
});
|
|
21507
|
+
const \u958B\u304D = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
|
|
21508
|
+
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
21509
|
+
const \u958B\u304D\u59CB\u3081\u305F = (startFrac) => !drawing || \u958B\u304D > startFrac;
|
|
21458
21510
|
const legendX = pieAreaW + 8;
|
|
21459
21511
|
const legendGap = Math.min(28, chartAreaH / Math.max(data.length, 1));
|
|
21460
21512
|
const legendStartY = PAD_TOP + (chartAreaH - legendGap * data.length) / 2 + legendGap / 2;
|
|
@@ -21473,7 +21525,8 @@ function ChartPieNode({
|
|
|
21473
21525
|
strokeWidth: active ? 3 : 1.25
|
|
21474
21526
|
}
|
|
21475
21527
|
),
|
|
21476
|
-
|
|
21528
|
+
drawing && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }) }),
|
|
21529
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, children: slices.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
21477
21530
|
"path",
|
|
21478
21531
|
{
|
|
21479
21532
|
"data-cdl-role": "chart-pie-slice",
|
|
@@ -21485,8 +21538,8 @@ function ChartPieNode({
|
|
|
21485
21538
|
strokeWidth: 1.5
|
|
21486
21539
|
},
|
|
21487
21540
|
`slice-${idx}`
|
|
21488
|
-
)),
|
|
21489
|
-
slices.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${legendX} ${legendStartY + idx * legendGap})`, children: [
|
|
21541
|
+
)) }),
|
|
21542
|
+
slices.map((s, idx) => !\u958B\u304D\u59CB\u3081\u305F(s.startFrac) ? null : /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${legendX} ${legendStartY + idx * legendGap})`, children: [
|
|
21490
21543
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21491
21544
|
"rect",
|
|
21492
21545
|
{
|
|
@@ -21524,6 +21577,15 @@ function ChartPieNode({
|
|
|
21524
21577
|
] }, `legend-${idx}`))
|
|
21525
21578
|
] });
|
|
21526
21579
|
}
|
|
21580
|
+
function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
|
|
21581
|
+
if (\u958B\u304D <= 0) return null;
|
|
21582
|
+
if (\u958B\u304D >= 1) return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r });
|
|
21583
|
+
const a0 = -Math.PI / 2;
|
|
21584
|
+
const a1 = a0 + \u958B\u304D * Math.PI * 2;
|
|
21585
|
+
const large = \u958B\u304D > 0.5 ? 1 : 0;
|
|
21586
|
+
const d = `M ${cx} ${cy} L ${cx + r * Math.cos(a0)} ${cy + r * Math.sin(a0)} A ${r} ${r} 0 ${large} 1 ${cx + r * Math.cos(a1)} ${cy + r * Math.sin(a1)} Z`;
|
|
21587
|
+
return /* @__PURE__ */ jsxRuntime.jsx("path", { d });
|
|
21588
|
+
}
|
|
21527
21589
|
var FALLBACK_ORDER = ["accent", "teal", "warning", "success", "info", "error"];
|
|
21528
21590
|
function sliceColor(tone, idx) {
|
|
21529
21591
|
if (tone) return TONE[tone];
|
|
@@ -21532,7 +21594,9 @@ function sliceColor(tone, idx) {
|
|
|
21532
21594
|
function ChartBarNode({
|
|
21533
21595
|
node,
|
|
21534
21596
|
active,
|
|
21535
|
-
stateValues = {}
|
|
21597
|
+
stateValues = {},
|
|
21598
|
+
drawing = false,
|
|
21599
|
+
progress = 1
|
|
21536
21600
|
}) {
|
|
21537
21601
|
const x0 = node.cx - node.w / 2;
|
|
21538
21602
|
const y0 = node.cy - node.h / 2;
|
|
@@ -21555,6 +21619,8 @@ function ChartBarNode({
|
|
|
21555
21619
|
const v = vMax * i / gridCount;
|
|
21556
21620
|
return { y: yAt(v), value: v };
|
|
21557
21621
|
});
|
|
21622
|
+
const \u4F38\u3073 = drawing ? Math.min(1, Math.max(0, Number.isFinite(progress) ? progress : 1)) : 1;
|
|
21623
|
+
const \u6A2A\u8EF8\u306Ey = PAD_TOP + canvasH;
|
|
21558
21624
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
21559
21625
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21560
21626
|
"rect",
|
|
@@ -21611,26 +21677,28 @@ function ChartBarNode({
|
|
|
21611
21677
|
const bx = xAt(idx);
|
|
21612
21678
|
const by = yAt(d.value);
|
|
21613
21679
|
const bh = PAD_TOP + canvasH - by;
|
|
21680
|
+
const \u898B\u3048\u3066\u3044\u308B\u982D = \u6A2A\u8EF8\u306Ey - (\u6A2A\u8EF8\u306Ey - by) * \u4F38\u3073;
|
|
21681
|
+
const \u68D2 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
21682
|
+
"rect",
|
|
21683
|
+
{
|
|
21684
|
+
"data-cdl-role": "chart-bar",
|
|
21685
|
+
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
21686
|
+
x: bx,
|
|
21687
|
+
y: by,
|
|
21688
|
+
width: barW,
|
|
21689
|
+
height: bh,
|
|
21690
|
+
rx: 2,
|
|
21691
|
+
fill: "var(--cdl-tone-accent, #2d6a8f)",
|
|
21692
|
+
fillOpacity: 0.9
|
|
21693
|
+
}
|
|
21694
|
+
);
|
|
21614
21695
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
21615
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21616
|
-
"rect",
|
|
21617
|
-
{
|
|
21618
|
-
"data-cdl-role": "chart-bar",
|
|
21619
|
-
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
21620
|
-
x: bx,
|
|
21621
|
-
y: by,
|
|
21622
|
-
width: barW,
|
|
21623
|
-
height: bh,
|
|
21624
|
-
rx: 2,
|
|
21625
|
-
fill: "var(--cdl-tone-accent, #2d6a8f)",
|
|
21626
|
-
fillOpacity: 0.9
|
|
21627
|
-
}
|
|
21628
|
-
),
|
|
21696
|
+
drawing ? /* @__PURE__ */ jsxRuntime.jsx("g", { transform: `translate(0 ${\u6A2A\u8EF8\u306Ey}) scale(1 ${\u4F38\u3073}) translate(0 ${-\u6A2A\u8EF8\u306Ey})`, children: \u68D2 }) : \u68D2,
|
|
21629
21697
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21630
21698
|
"text",
|
|
21631
21699
|
{
|
|
21632
21700
|
x: bx + barW / 2,
|
|
21633
|
-
y:
|
|
21701
|
+
y: \u898B\u3048\u3066\u3044\u308B\u982D - 6,
|
|
21634
21702
|
fontSize: 11,
|
|
21635
21703
|
textAnchor: "middle",
|
|
21636
21704
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
@@ -26703,6 +26771,7 @@ function ShapeCustomerServiceNode({ node, active }) {
|
|
|
26703
26771
|
function CdlNodeView({
|
|
26704
26772
|
node,
|
|
26705
26773
|
active,
|
|
26774
|
+
drawing = false,
|
|
26706
26775
|
progress,
|
|
26707
26776
|
stateValues,
|
|
26708
26777
|
currentPhaseId
|
|
@@ -26752,11 +26821,38 @@ function CdlNodeView({
|
|
|
26752
26821
|
// 数と語を取る 7 種に対し、mind-map / tree-hierarchy は **名前だけ** を取る (#467)。
|
|
26753
26822
|
// 親子の繋がりと、描かれない欄 (補足) は解決しない。
|
|
26754
26823
|
case "chart-line":
|
|
26755
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26824
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26825
|
+
ChartLineNode,
|
|
26826
|
+
{
|
|
26827
|
+
node: resolvedNode,
|
|
26828
|
+
active,
|
|
26829
|
+
stateValues,
|
|
26830
|
+
drawing,
|
|
26831
|
+
progress
|
|
26832
|
+
}
|
|
26833
|
+
);
|
|
26756
26834
|
case "chart-pie":
|
|
26757
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26835
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26836
|
+
ChartPieNode,
|
|
26837
|
+
{
|
|
26838
|
+
node: resolvedNode,
|
|
26839
|
+
active,
|
|
26840
|
+
stateValues,
|
|
26841
|
+
drawing,
|
|
26842
|
+
progress
|
|
26843
|
+
}
|
|
26844
|
+
);
|
|
26758
26845
|
case "chart-bar":
|
|
26759
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26846
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
26847
|
+
ChartBarNode,
|
|
26848
|
+
{
|
|
26849
|
+
node: resolvedNode,
|
|
26850
|
+
active,
|
|
26851
|
+
stateValues,
|
|
26852
|
+
drawing,
|
|
26853
|
+
progress
|
|
26854
|
+
}
|
|
26855
|
+
);
|
|
26760
26856
|
case "gantt-timeline":
|
|
26761
26857
|
return /* @__PURE__ */ jsxRuntime.jsx(GanttNode, { node: resolvedNode, active, stateValues });
|
|
26762
26858
|
case "mind-map":
|
|
@@ -26946,6 +27042,7 @@ function CdlStage({
|
|
|
26946
27042
|
svgRef
|
|
26947
27043
|
}) {
|
|
26948
27044
|
const activeSet = new Set(currentPhase?.activate ?? []);
|
|
27045
|
+
const drawSet = new Set(currentPhase?.draw ?? []);
|
|
26949
27046
|
const { lifelineStarts, uniformFooterTop } = react.useMemo(() => {
|
|
26950
27047
|
const starts = lifelineStartYs(laid.nodes);
|
|
26951
27048
|
return {
|
|
@@ -27082,6 +27179,7 @@ function CdlStage({
|
|
|
27082
27179
|
{
|
|
27083
27180
|
node,
|
|
27084
27181
|
active: activeSet.has(node.id),
|
|
27182
|
+
drawing: drawSet.has(node.id),
|
|
27085
27183
|
progress,
|
|
27086
27184
|
stateValues,
|
|
27087
27185
|
currentPhaseId: currentPhase?.id
|