@cardenelabs/cdl 0.30.2 → 0.31.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 +63 -1
- package/dist/index.cjs +438 -278
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +438 -278
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +438 -278
- 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 +438 -278
- package/dist/react.js.map +1 -1
- package/dist/{render-CabTMeao.d.cts → render-D6wVFGfI.d.cts} +6 -0
- package/dist/{render-CabTMeao.d.ts → render-D6wVFGfI.d.ts} +6 -0
- package/package.json +1 -1
- package/src/kinds/chart-line.tsx +176 -98
- package/src/layout/edges.ts +108 -0
- package/src/render/edge-head.ts +23 -1
- package/src/render/edges.tsx +8 -14
- package/src/render/nodes.tsx +4 -1
- package/src/render/stage.tsx +100 -50
- package/src/render/template-fields.ts +4 -0
- package/src/types.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -20108,11 +20108,66 @@ function \u672B\u5C3E\u3092\u8FBA\u306B\u6CBF\u3063\u3066\u305A\u3089\u3059(e, \
|
|
|
20108
20108
|
parts.push(`L ${s.x2} ${s.y2}`);
|
|
20109
20109
|
}
|
|
20110
20110
|
const \u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C = Math.abs(\u6298\u308C1.x - last.x1) <= 0.5 && Math.abs(\u6298\u308C1.y - last.y1) <= 0.5;
|
|
20111
|
+
if (\u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C) {
|
|
20112
|
+
const \u6298\u308A\u8FD4\u3055\u306A\u3044 = \u76F4\u524D\u306E\u6298\u308C\u3054\u3068\u305A\u3089\u3059(segs, \u6A2A, d, nodes, e);
|
|
20113
|
+
if (\u6298\u308A\u8FD4\u3055\u306A\u3044) return \u6298\u308A\u8FD4\u3055\u306A\u3044;
|
|
20114
|
+
}
|
|
20111
20115
|
if (!\u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C) parts.push(`L ${round1(\u6298\u308C1.x)} ${round1(\u6298\u308C1.y)}`);
|
|
20112
20116
|
parts.push(`L ${round1(\u6298\u308C2.x)} ${round1(\u6298\u308C2.y)}`);
|
|
20113
20117
|
parts.push(`L ${round1(\u7D42\u70B9.x)} ${round1(\u7D42\u70B9.y)}`);
|
|
20114
20118
|
return parts.join(" ");
|
|
20115
20119
|
}
|
|
20120
|
+
function \u76F4\u524D\u306E\u6298\u308C\u3054\u3068\u305A\u3089\u3059(segs, \u6A2A, d, nodes, e) {
|
|
20121
|
+
const \u5E73\u884C\u304B = (s) => \u6A2A ? Math.abs(s.x2 - s.x1) < 0.5 && Math.abs(s.y2 - s.y1) > 0.5 : Math.abs(s.y2 - s.y1) < 0.5 && Math.abs(s.x2 - s.x1) > 0.5;
|
|
20122
|
+
let \u5438\u53CE = -1;
|
|
20123
|
+
for (let i = segs.length - 2; i >= 0; i -= 1) {
|
|
20124
|
+
if (\u5E73\u884C\u304B(segs[i])) {
|
|
20125
|
+
\u5438\u53CE = i;
|
|
20126
|
+
break;
|
|
20127
|
+
}
|
|
20128
|
+
}
|
|
20129
|
+
if (\u5438\u53CE < 0) return null;
|
|
20130
|
+
const \u5143\u306E\u9577\u3055 = \u6A2A ? Math.abs(segs[\u5438\u53CE].y2 - segs[\u5438\u53CE].y1) : Math.abs(segs[\u5438\u53CE].x2 - segs[\u5438\u53CE].x1);
|
|
20131
|
+
const \u5411\u304D = \u6A2A ? Math.sign(segs[\u5438\u53CE].y2 - segs[\u5438\u53CE].y1) : Math.sign(segs[\u5438\u53CE].x2 - segs[\u5438\u53CE].x1);
|
|
20132
|
+
const \u5F8C\u306E\u9577\u3055 = \u5143\u306E\u9577\u3055 + \u5411\u304D * d;
|
|
20133
|
+
if (\u5F8C\u306E\u9577\u3055 < ENDPOINT_FAN_RUNUP) return null;
|
|
20134
|
+
const \u305A\u3089\u3059 = (p) => \u6A2A ? { ...p, y: p.y + d } : { ...p, x: p.x + d };
|
|
20135
|
+
const \u65B0segs = segs.map((s, i) => {
|
|
20136
|
+
if (i <= \u5438\u53CE) return s;
|
|
20137
|
+
return {
|
|
20138
|
+
...s,
|
|
20139
|
+
x1: \u305A\u3089\u3059({ x: s.x1, y: s.y1 }).x,
|
|
20140
|
+
y1: \u305A\u3089\u3059({ x: s.x1, y: s.y1 }).y,
|
|
20141
|
+
x2: \u305A\u3089\u3059({ x: s.x2, y: s.y2 }).x,
|
|
20142
|
+
y2: \u305A\u3089\u3059({ x: s.x2, y: s.y2 }).y,
|
|
20143
|
+
...s.ctrl ? { ctrl: s.ctrl.map((c) => \u305A\u3089\u3059(c)) } : {}
|
|
20144
|
+
};
|
|
20145
|
+
});
|
|
20146
|
+
\u65B0segs[\u5438\u53CE] = {
|
|
20147
|
+
...segs[\u5438\u53CE],
|
|
20148
|
+
x2: \u6A2A ? segs[\u5438\u53CE].x2 : segs[\u5438\u53CE].x2 + d,
|
|
20149
|
+
y2: \u6A2A ? segs[\u5438\u53CE].y2 + d : segs[\u5438\u53CE].y2
|
|
20150
|
+
};
|
|
20151
|
+
if (nodes.some(
|
|
20152
|
+
(n) => n.id !== e.from && n.id !== e.to && segmentsCrossRect(
|
|
20153
|
+
\u65B0segs.slice(\u5438\u53CE).map((s) => ({ x1: s.x1, y1: s.y1, x2: s.x2, y2: s.y2 })),
|
|
20154
|
+
nodeRect(n)
|
|
20155
|
+
)
|
|
20156
|
+
)) {
|
|
20157
|
+
return null;
|
|
20158
|
+
}
|
|
20159
|
+
const head = \u65B0segs[0];
|
|
20160
|
+
const parts = [`M ${round1(head.x1)} ${round1(head.y1)}`];
|
|
20161
|
+
for (const s of \u65B0segs) {
|
|
20162
|
+
if (s.cmd === "Q") {
|
|
20163
|
+
const c = s.ctrl?.[0];
|
|
20164
|
+
parts.push(c ? `Q ${round1(c.x)} ${round1(c.y)}, ${round1(s.x2)} ${round1(s.y2)}` : `L ${round1(s.x2)} ${round1(s.y2)}`);
|
|
20165
|
+
continue;
|
|
20166
|
+
}
|
|
20167
|
+
parts.push(`L ${round1(s.x2)} ${round1(s.y2)}`);
|
|
20168
|
+
}
|
|
20169
|
+
return parts.join(" ");
|
|
20170
|
+
}
|
|
20116
20171
|
|
|
20117
20172
|
// src/layout/lanes.ts
|
|
20118
20173
|
var LANE_POSITION_EPSILON = 1e-9;
|
|
@@ -22326,8 +22381,300 @@ function StateDiffCard({
|
|
|
22326
22381
|
}
|
|
22327
22382
|
);
|
|
22328
22383
|
}
|
|
22384
|
+
var \u6570\u3092\u66F8\u304F = (value) => value.toLocaleString("en-US", { maximumFractionDigits: 12 });
|
|
22385
|
+
function \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values) {
|
|
22386
|
+
let rawMin = values.length > 0 ? Math.min(...values) : 0;
|
|
22387
|
+
let rawMax = values.length > 0 ? Math.max(...values) : 1;
|
|
22388
|
+
if (rawMin === rawMax) {
|
|
22389
|
+
const room = 10 ** Math.floor(Math.log10(Math.abs(rawMin) || 1) - 1);
|
|
22390
|
+
rawMin -= room;
|
|
22391
|
+
rawMax += room;
|
|
22392
|
+
}
|
|
22393
|
+
const roughStep = (rawMax - rawMin) / 4;
|
|
22394
|
+
const power = 10 ** Math.floor(Math.log10(roughStep));
|
|
22395
|
+
const fraction = roughStep / power;
|
|
22396
|
+
const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 2.5 ? 2.5 : fraction <= 5 ? 5 : 10;
|
|
22397
|
+
const step = niceFraction * power;
|
|
22398
|
+
const min = Math.floor(rawMin / step) * step;
|
|
22399
|
+
const max = Math.ceil(rawMax / step) * step;
|
|
22400
|
+
const tickCount = Math.round((max - min) / step);
|
|
22401
|
+
const ticks = Array.from({ length: tickCount + 1 }, (_, i) => {
|
|
22402
|
+
const value = min + step * i;
|
|
22403
|
+
return Math.abs(value) < step * 1e-12 ? 0 : value;
|
|
22404
|
+
});
|
|
22405
|
+
return { min, max, ticks };
|
|
22406
|
+
}
|
|
22407
|
+
function ChartLineNode({
|
|
22408
|
+
node,
|
|
22409
|
+
active,
|
|
22410
|
+
stateValues = {},
|
|
22411
|
+
scale: fixedScale,
|
|
22412
|
+
drawing = false,
|
|
22413
|
+
progress = 1
|
|
22414
|
+
}) {
|
|
22415
|
+
const x0 = node.cx - node.w / 2;
|
|
22416
|
+
const y0 = node.cy - node.h / 2;
|
|
22417
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
22418
|
+
const PAD_TOP2 = 36;
|
|
22419
|
+
const PAD_RIGHT2 = 40;
|
|
22420
|
+
const PAD_BOTTOM2 = 56;
|
|
22421
|
+
const PAD_LEFT2 = 72;
|
|
22422
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
22423
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
22424
|
+
const scale = fixedScale ?? \u6298\u308C\u7DDA\u306E\u76EE\u76DB(data.map((d) => d.value));
|
|
22425
|
+
const vRange = scale.max - scale.min;
|
|
22426
|
+
const LABEL_ROOM = 20;
|
|
22427
|
+
const plotTop = PAD_TOP2 + LABEL_ROOM;
|
|
22428
|
+
const plotH = Math.max(canvasH - LABEL_ROOM * 2, 1);
|
|
22429
|
+
const POINT_EDGE_ROOM = 24;
|
|
22430
|
+
const plotW = Math.max(canvasW - POINT_EDGE_ROOM * 2, 1);
|
|
22431
|
+
const xAt = (idx) => PAD_LEFT2 + POINT_EDGE_ROOM + (data.length <= 1 ? plotW / 2 : plotW * idx / (data.length - 1));
|
|
22432
|
+
const yAt = (v) => plotTop + plotH - (v - scale.min) / vRange * plotH;
|
|
22433
|
+
const plotBottom = PAD_TOP2 + canvasH;
|
|
22434
|
+
let \u7DDA\u306E\u5168\u9577 = 0;
|
|
22435
|
+
let \u524D\u306E\u70B9;
|
|
22436
|
+
const \u63CF\u753B\u70B9 = data.map((datum, idx) => {
|
|
22437
|
+
const \u4ECA\u306E\u70B9 = { datum, x: xAt(idx), y: yAt(datum.value), \u3053\u3053\u307E\u3067\u306E\u9577\u3055: 0 };
|
|
22438
|
+
if (\u524D\u306E\u70B9) {
|
|
22439
|
+
\u7DDA\u306E\u5168\u9577 += Math.hypot(\u4ECA\u306E\u70B9.x - \u524D\u306E\u70B9.x, \u4ECA\u306E\u70B9.y - \u524D\u306E\u70B9.y);
|
|
22440
|
+
}
|
|
22441
|
+
\u4ECA\u306E\u70B9.\u3053\u3053\u307E\u3067\u306E\u9577\u3055 = \u7DDA\u306E\u5168\u9577;
|
|
22442
|
+
\u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
|
|
22443
|
+
return \u4ECA\u306E\u70B9;
|
|
22444
|
+
});
|
|
22445
|
+
const points = \u63CF\u753B\u70B9.map((\u70B9) => `${\u70B9.x},${\u70B9.y}`).join(" ");
|
|
22446
|
+
const \u6BB5\u306E\u9032\u307F = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
22447
|
+
const \u7C92\u3092\u8D70\u3089\u305B\u308B = drawing && node.chartTrace === true;
|
|
22448
|
+
const \u4F38\u3073 = \u7C92\u3092\u8D70\u3089\u305B\u308B ? Math.min(1, \u6BB5\u306E\u9032\u307F / 0.5) : \u6BB5\u306E\u9032\u307F;
|
|
22449
|
+
const \u7C92\u306E\u9032\u307F = \u7C92\u3092\u8D70\u3089\u305B\u308B ? Math.min(1, Math.max(0, (\u6BB5\u306E\u9032\u307F - 0.55) / 0.45)) : \u4F38\u3073;
|
|
22450
|
+
const \u7C92\u304C\u51FA\u308B = \u7C92\u3092\u8D70\u3089\u305B\u308B && \u6BB5\u306E\u9032\u307F >= 0.55 && \u6BB5\u306E\u9032\u307F < 1;
|
|
22451
|
+
const \u5230\u7740\u7A93 = 0.12;
|
|
22452
|
+
let \u7C92\u306E\u4F4D\u7F6E;
|
|
22453
|
+
const \u6700\u521D\u306E\u70B9 = \u63CF\u753B\u70B9[0];
|
|
22454
|
+
if (\u7C92\u304C\u51FA\u308B && \u6700\u521D\u306E\u70B9) {
|
|
22455
|
+
const \u7C92\u307E\u3067\u306E\u9577\u3055 = \u7C92\u306E\u9032\u307F * \u7DDA\u306E\u5168\u9577;
|
|
22456
|
+
let \u533A\u9593\u306E\u524D = \u6700\u521D\u306E\u70B9;
|
|
22457
|
+
let \u533A\u9593\u306E\u5F8C = \u6700\u521D\u306E\u70B9;
|
|
22458
|
+
for (const \u70B9 of \u63CF\u753B\u70B9.slice(1)) {
|
|
22459
|
+
\u533A\u9593\u306E\u5F8C = \u70B9;
|
|
22460
|
+
if (\u70B9.\u3053\u3053\u307E\u3067\u306E\u9577\u3055 >= \u7C92\u307E\u3067\u306E\u9577\u3055) break;
|
|
22461
|
+
\u533A\u9593\u306E\u524D = \u70B9;
|
|
22462
|
+
}
|
|
22463
|
+
const \u533A\u9593\u306E\u59CB\u3081 = \u533A\u9593\u306E\u524D.\u3053\u3053\u307E\u3067\u306E\u9577\u3055;
|
|
22464
|
+
const \u533A\u9593\u306E\u9577\u3055 = \u533A\u9593\u306E\u5F8C.\u3053\u3053\u307E\u3067\u306E\u9577\u3055 - \u533A\u9593\u306E\u59CB\u3081;
|
|
22465
|
+
const \u533A\u9593\u306E\u9032\u307F = \u533A\u9593\u306E\u9577\u3055 === 0 ? 0 : (\u7C92\u307E\u3067\u306E\u9577\u3055 - \u533A\u9593\u306E\u59CB\u3081) / \u533A\u9593\u306E\u9577\u3055;
|
|
22466
|
+
\u7C92\u306E\u4F4D\u7F6E = {
|
|
22467
|
+
x: \u533A\u9593\u306E\u524D.x + (\u533A\u9593\u306E\u5F8C.x - \u533A\u9593\u306E\u524D.x) * \u533A\u9593\u306E\u9032\u307F,
|
|
22468
|
+
y: \u533A\u9593\u306E\u524D.y + (\u533A\u9593\u306E\u5F8C.y - \u533A\u9593\u306E\u524D.y) * \u533A\u9593\u306E\u9032\u307F
|
|
22469
|
+
};
|
|
22470
|
+
}
|
|
22471
|
+
const gridTicks = scale.ticks.map((value) => ({ y: yAt(value), value }));
|
|
22472
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
22473
|
+
gridTicks.map((t, i) => /* @__PURE__ */ jsxs("g", { children: [
|
|
22474
|
+
/* @__PURE__ */ jsx(
|
|
22475
|
+
"line",
|
|
22476
|
+
{
|
|
22477
|
+
x1: PAD_LEFT2,
|
|
22478
|
+
y1: t.y,
|
|
22479
|
+
x2: PAD_LEFT2 + canvasW,
|
|
22480
|
+
y2: t.y,
|
|
22481
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
22482
|
+
strokeWidth: 0.75,
|
|
22483
|
+
strokeDasharray: "3 3",
|
|
22484
|
+
opacity: 0.65
|
|
22485
|
+
}
|
|
22486
|
+
),
|
|
22487
|
+
/* @__PURE__ */ jsx(
|
|
22488
|
+
"text",
|
|
22489
|
+
{
|
|
22490
|
+
x: PAD_LEFT2 - 8,
|
|
22491
|
+
y: t.y + 4,
|
|
22492
|
+
fontSize: 11,
|
|
22493
|
+
textAnchor: "end",
|
|
22494
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
22495
|
+
children: \u6570\u3092\u66F8\u304F(t.value)
|
|
22496
|
+
}
|
|
22497
|
+
)
|
|
22498
|
+
] }, `grid-${i}`)),
|
|
22499
|
+
node.chartFillUnder && data.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22500
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
22501
|
+
"linearGradient",
|
|
22502
|
+
{
|
|
22503
|
+
id: `chart-line-fill-${node.id}`,
|
|
22504
|
+
gradientUnits: "userSpaceOnUse",
|
|
22505
|
+
x1: 0,
|
|
22506
|
+
y1: plotTop,
|
|
22507
|
+
x2: 0,
|
|
22508
|
+
y2: plotBottom,
|
|
22509
|
+
children: [
|
|
22510
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "var(--cdl-tone-accent, #2d6a8f)", stopOpacity: 0.22 }),
|
|
22511
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "var(--cdl-tone-accent, #2d6a8f)", stopOpacity: 0 })
|
|
22512
|
+
]
|
|
22513
|
+
}
|
|
22514
|
+
) }),
|
|
22515
|
+
/* @__PURE__ */ jsx(
|
|
22516
|
+
"path",
|
|
22517
|
+
{
|
|
22518
|
+
"data-cdl-role": "chart-line-fill-under",
|
|
22519
|
+
d: `M ${xAt(0)} ${plotBottom} L ${points.replaceAll(",", " ")} L ${xAt(data.length - 1)} ${plotBottom} Z`,
|
|
22520
|
+
fill: `url(#chart-line-fill-${node.id})`,
|
|
22521
|
+
stroke: "none"
|
|
22522
|
+
}
|
|
22523
|
+
)
|
|
22524
|
+
] }),
|
|
22525
|
+
data.length > 1 && /* @__PURE__ */ jsx(
|
|
22526
|
+
"polyline",
|
|
22527
|
+
{
|
|
22528
|
+
"data-cdl-role": "chart-line",
|
|
22529
|
+
points,
|
|
22530
|
+
fill: "none",
|
|
22531
|
+
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
22532
|
+
strokeWidth: active ? 3 : 2,
|
|
22533
|
+
strokeLinejoin: "round",
|
|
22534
|
+
strokeLinecap: "round",
|
|
22535
|
+
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
22536
|
+
}
|
|
22537
|
+
),
|
|
22538
|
+
\u7C92\u306E\u4F4D\u7F6E && /* @__PURE__ */ jsx(
|
|
22539
|
+
"circle",
|
|
22540
|
+
{
|
|
22541
|
+
"data-cdl-role": "chart-line-trace",
|
|
22542
|
+
cx: \u7C92\u306E\u4F4D\u7F6E.x,
|
|
22543
|
+
cy: \u7C92\u306E\u4F4D\u7F6E.y,
|
|
22544
|
+
r: 4.5,
|
|
22545
|
+
fill: "var(--cdl-now)"
|
|
22546
|
+
}
|
|
22547
|
+
),
|
|
22548
|
+
\u63CF\u753B\u70B9.map(({ datum: d, x: cx, y: cy, \u3053\u3053\u307E\u3067\u306E\u9577\u3055 }, idx) => {
|
|
22549
|
+
const prev = data[idx - 1]?.value;
|
|
22550
|
+
const next = data[idx + 1]?.value;
|
|
22551
|
+
const isValley = (prev === void 0 || d.value <= prev) && (next === void 0 || d.value <= next);
|
|
22552
|
+
const labelAbove = !isValley;
|
|
22553
|
+
const labelY = labelAbove ? cy - 12 : cy + 18;
|
|
22554
|
+
const \u5230\u7740\u5F8C = \u7DDA\u306E\u5168\u9577 === 0 ? \u7C92\u306E\u9032\u307F : \u7C92\u306E\u9032\u307F - \u3053\u3053\u307E\u3067\u306E\u9577\u3055 / \u7DDA\u306E\u5168\u9577;
|
|
22555
|
+
const \u51FA\u3059 = !drawing || (!\u7C92\u3092\u8D70\u3089\u305B\u308B || \u6BB5\u306E\u9032\u307F >= 0.55) && \u5230\u7740\u5F8C >= 0;
|
|
22556
|
+
const \u5149\u308B = drawing && \u51FA\u3059 && \u5230\u7740\u5F8C < \u5230\u7740\u7A93;
|
|
22557
|
+
const \u5149\u306E\u9032\u307F = \u5149\u308B ? \u5230\u7740\u5F8C / \u5230\u7740\u7A93 : 1;
|
|
22558
|
+
let \u70B9\u3068\u5024;
|
|
22559
|
+
if (\u51FA\u3059) {
|
|
22560
|
+
const \u5149\u306E\u534A\u5F84 = 6 + 16 * \u5149\u306E\u9032\u307F;
|
|
22561
|
+
const \u5024 = /* @__PURE__ */ jsx(
|
|
22562
|
+
"text",
|
|
22563
|
+
{
|
|
22564
|
+
"data-cdl-role": "chart-line-value",
|
|
22565
|
+
x: cx,
|
|
22566
|
+
y: labelY,
|
|
22567
|
+
fontSize: 11,
|
|
22568
|
+
fontWeight: 600,
|
|
22569
|
+
textAnchor: "middle",
|
|
22570
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
22571
|
+
children: \u6570\u3092\u66F8\u304F(d.value)
|
|
22572
|
+
}
|
|
22573
|
+
);
|
|
22574
|
+
\u70B9\u3068\u5024 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
22575
|
+
\u5149\u308B && // marker の `circle` を数える利用側へ混ぜず、専用 role の等径 ellipse として輪を出す。
|
|
22576
|
+
/* @__PURE__ */ jsx(
|
|
22577
|
+
"ellipse",
|
|
22578
|
+
{
|
|
22579
|
+
"data-cdl-role": "chart-line-arrival-ring",
|
|
22580
|
+
cx,
|
|
22581
|
+
cy,
|
|
22582
|
+
rx: \u5149\u306E\u534A\u5F84,
|
|
22583
|
+
ry: \u5149\u306E\u534A\u5F84,
|
|
22584
|
+
fill: "none",
|
|
22585
|
+
stroke: "var(--cdl-now)",
|
|
22586
|
+
strokeWidth: 2,
|
|
22587
|
+
opacity: 0.85 * (1 - \u5149\u306E\u9032\u307F)
|
|
22588
|
+
}
|
|
22589
|
+
),
|
|
22590
|
+
/* @__PURE__ */ jsx(
|
|
22591
|
+
"circle",
|
|
22592
|
+
{
|
|
22593
|
+
cx,
|
|
22594
|
+
cy,
|
|
22595
|
+
r: 5,
|
|
22596
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
22597
|
+
stroke: \u5149\u308B ? "var(--cdl-now)" : "var(--cdl-tone-accent, #2d6a8f)",
|
|
22598
|
+
strokeWidth: 2.5
|
|
22599
|
+
}
|
|
22600
|
+
),
|
|
22601
|
+
/* @__PURE__ */ jsx(
|
|
22602
|
+
"circle",
|
|
22603
|
+
{
|
|
22604
|
+
cx,
|
|
22605
|
+
cy,
|
|
22606
|
+
r: 2.5,
|
|
22607
|
+
fill: \u5149\u308B ? "var(--cdl-now)" : "var(--cdl-tone-accent, #2d6a8f)"
|
|
22608
|
+
}
|
|
22609
|
+
),
|
|
22610
|
+
node.chartValueRise && \u5149\u308B ? /* @__PURE__ */ jsx(
|
|
22611
|
+
"g",
|
|
22612
|
+
{
|
|
22613
|
+
"data-cdl-role": "chart-line-value-rise",
|
|
22614
|
+
transform: `translate(0 ${8 * (1 - \u5149\u306E\u9032\u307F)})`,
|
|
22615
|
+
children: \u5024
|
|
22616
|
+
}
|
|
22617
|
+
) : \u5024
|
|
22618
|
+
] });
|
|
22619
|
+
}
|
|
22620
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-unresolved": d.unresolved ? "true" : void 0, children: [
|
|
22621
|
+
\u70B9\u3068\u5024,
|
|
22622
|
+
/* @__PURE__ */ jsx(
|
|
22623
|
+
"text",
|
|
22624
|
+
{
|
|
22625
|
+
x: cx,
|
|
22626
|
+
y: PAD_TOP2 + canvasH + 20,
|
|
22627
|
+
fontSize: 12,
|
|
22628
|
+
textAnchor: "middle",
|
|
22629
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
22630
|
+
children: d.label
|
|
22631
|
+
}
|
|
22632
|
+
)
|
|
22633
|
+
] }, `pt-${idx}`);
|
|
22634
|
+
})
|
|
22635
|
+
] });
|
|
22636
|
+
}
|
|
22637
|
+
|
|
22638
|
+
// src/kinds/draw-ratio.ts
|
|
22639
|
+
var DRAW_RATIO_DEFAULT = 1;
|
|
22640
|
+
function \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio) {
|
|
22641
|
+
if (ratio === void 0) return DRAW_RATIO_DEFAULT;
|
|
22642
|
+
if (!Number.isFinite(ratio)) return DRAW_RATIO_DEFAULT;
|
|
22643
|
+
if (ratio <= 0 || ratio > 1) return DRAW_RATIO_DEFAULT;
|
|
22644
|
+
return ratio;
|
|
22645
|
+
}
|
|
22646
|
+
function \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, ratio) {
|
|
22647
|
+
const \u5272\u5408 = \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio);
|
|
22648
|
+
if (\u5272\u5408 === DRAW_RATIO_DEFAULT) return progress;
|
|
22649
|
+
if (!Number.isFinite(progress)) return progress;
|
|
22650
|
+
return Math.min(1, progress / \u5272\u5408);
|
|
22651
|
+
}
|
|
22652
|
+
|
|
22653
|
+
// src/layout/lifeline.ts
|
|
22654
|
+
function lifelineStartYs(nodes) {
|
|
22655
|
+
const topmost = /* @__PURE__ */ new Map();
|
|
22656
|
+
for (const n of nodes) {
|
|
22657
|
+
const cur = topmost.get(n.lane);
|
|
22658
|
+
if (cur === void 0 || n.cy < cur.cy) topmost.set(n.lane, n);
|
|
22659
|
+
}
|
|
22660
|
+
const starts = /* @__PURE__ */ new Map();
|
|
22661
|
+
for (const [laneId, n] of topmost) starts.set(laneId, n.cy + n.h / 2);
|
|
22662
|
+
return starts;
|
|
22663
|
+
}
|
|
22664
|
+
function uniformLifelineEndY(lanes, nodes, starts = lifelineStartYs(nodes)) {
|
|
22665
|
+
const lifelineLanes = lanes.filter((l) => l.lifeline);
|
|
22666
|
+
let deepestStart = Number.NEGATIVE_INFINITY;
|
|
22667
|
+
for (const lane of lifelineLanes) {
|
|
22668
|
+
const start = starts.get(lane.id);
|
|
22669
|
+
if (start !== void 0) deepestStart = Math.max(deepestStart, start);
|
|
22670
|
+
}
|
|
22671
|
+
const footerTops = lifelineFooterNodes(lanes, nodes).map((f) => footerShapeDrawTop(f)).filter((top) => top > deepestStart);
|
|
22672
|
+
if (footerTops.length > 0) return Math.min(...footerTops);
|
|
22673
|
+
return lifelineLanes[0] ? lifelineLanes[0].y + lifelineLanes[0].height : 0;
|
|
22674
|
+
}
|
|
22329
22675
|
|
|
22330
22676
|
// src/render/edge-head.ts
|
|
22677
|
+
var EDGE_HEAD_MUTED_MARKER_ID = "cdl-arrow-muted";
|
|
22331
22678
|
var EDGE_HEAD_SHAPE = {
|
|
22332
22679
|
// 何も描かない端。 marker 自体を出さないので `d` は読まれない
|
|
22333
22680
|
none: { d: "", w: 10, h: 10, refX: 0, filled: false },
|
|
@@ -22358,6 +22705,11 @@ function edgeHeadMarkerId(tone, head, small, fill = EDGE_HEAD_FILL_DEFAULT) {
|
|
|
22358
22705
|
const \u5857 = fill === EDGE_HEAD_FILL_DEFAULT || !EDGE_HEAD_SHAPE[head].filled ? "" : `-${fill}`;
|
|
22359
22706
|
return head === EDGE_HEAD_DEFAULT && \u5857 === "" ? `cdl-arrow-${tone}${\u5C0F}` : `cdl-arrow-${tone}-${head}${\u5857}${\u5C0F}`;
|
|
22360
22707
|
}
|
|
22708
|
+
function edgeHeadMarkerName(tone, head, small, fill) {
|
|
22709
|
+
const \u5B9F\u969B\u306E\u5F62 = head ?? EDGE_HEAD_DEFAULT;
|
|
22710
|
+
if (\u5B9F\u969B\u306E\u5F62 === "none") return void 0;
|
|
22711
|
+
return hasTone(tone) ? edgeHeadMarkerId(tone, \u5B9F\u969B\u306E\u5F62, small, fill ?? EDGE_HEAD_FILL_DEFAULT) : EDGE_HEAD_MUTED_MARKER_ID;
|
|
22712
|
+
}
|
|
22361
22713
|
function edgeHeadPaint(head, fill, color) {
|
|
22362
22714
|
const \u5F62 = EDGE_HEAD_SHAPE[head];
|
|
22363
22715
|
if (!\u5F62.filled) return { fill: "none", stroke: color, strokeWidth: 1.6 };
|
|
@@ -22386,13 +22738,8 @@ function CdlEdgeView({
|
|
|
22386
22738
|
stateValues
|
|
22387
22739
|
}) {
|
|
22388
22740
|
const color = edgeColor(edge);
|
|
22389
|
-
const
|
|
22390
|
-
|
|
22391
|
-
if (\u5F62 === "none") return void 0;
|
|
22392
|
-
return hasTone(edge.tone) ? edgeHeadMarkerId(edge.tone, \u5F62, !active, f ?? EDGE_HEAD_FILL_DEFAULT) : "cdl-arrow-muted";
|
|
22393
|
-
};
|
|
22394
|
-
const marker = \u7AEF\u306E\u540D\u524D(edge.head, edge.headFill);
|
|
22395
|
-
const tailMarker = edge.tailHead === void 0 ? void 0 : \u7AEF\u306E\u540D\u524D(edge.tailHead, edge.tailHeadFill);
|
|
22741
|
+
const marker = edgeHeadMarkerName(edge.tone, edge.head, !active, edge.headFill);
|
|
22742
|
+
const tailMarker = edge.tailHead === void 0 ? void 0 : edgeHeadMarkerName(edge.tone, edge.tailHead, !active, edge.tailHeadFill);
|
|
22396
22743
|
const style = edge.style ?? "solid";
|
|
22397
22744
|
const isDotted = style === "dotted-flow";
|
|
22398
22745
|
const isPassThrough = isDotted && Boolean(edge.dThrough);
|
|
@@ -23968,191 +24315,6 @@ function interpolateColor(template, stateValues, fallback) {
|
|
|
23968
24315
|
if (!template) return fallback;
|
|
23969
24316
|
return interpolate(template, stateValues);
|
|
23970
24317
|
}
|
|
23971
|
-
function ChartLineNode({
|
|
23972
|
-
node,
|
|
23973
|
-
active,
|
|
23974
|
-
stateValues = {},
|
|
23975
|
-
drawing = false,
|
|
23976
|
-
progress = 1
|
|
23977
|
-
}) {
|
|
23978
|
-
const x0 = node.cx - node.w / 2;
|
|
23979
|
-
const y0 = node.cy - node.h / 2;
|
|
23980
|
-
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
23981
|
-
const PAD_TOP2 = 36;
|
|
23982
|
-
const PAD_RIGHT2 = 40;
|
|
23983
|
-
const PAD_BOTTOM2 = 56;
|
|
23984
|
-
const PAD_LEFT2 = 72;
|
|
23985
|
-
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
23986
|
-
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
23987
|
-
const values = data.map((d) => d.value);
|
|
23988
|
-
const vMin = values.length > 0 ? Math.min(...values) : 0;
|
|
23989
|
-
const vMax = values.length > 0 ? Math.max(...values) : 1;
|
|
23990
|
-
const vRange = vMax - vMin || 1;
|
|
23991
|
-
const LABEL_ROOM = 20;
|
|
23992
|
-
const plotTop = PAD_TOP2 + LABEL_ROOM;
|
|
23993
|
-
const plotH = Math.max(canvasH - LABEL_ROOM * 2, 1);
|
|
23994
|
-
const xAt = (idx) => PAD_LEFT2 + (data.length <= 1 ? canvasW / 2 : canvasW * idx / (data.length - 1));
|
|
23995
|
-
const yAt = (v) => plotTop + plotH - (v - vMin) / vRange * plotH;
|
|
23996
|
-
const points = data.map((d, idx) => `${xAt(idx)},${yAt(d.value)}`).join(" ");
|
|
23997
|
-
const \u70B9\u307E\u3067\u306E\u9577\u3055 = [];
|
|
23998
|
-
let \u7DDA\u306E\u5168\u9577 = 0;
|
|
23999
|
-
let \u524D\u306E\u70B9;
|
|
24000
|
-
for (const [idx, datum] of data.entries()) {
|
|
24001
|
-
const \u4ECA\u306E\u70B9 = { x: xAt(idx), y: yAt(datum.value) };
|
|
24002
|
-
if (\u524D\u306E\u70B9) {
|
|
24003
|
-
\u7DDA\u306E\u5168\u9577 += Math.hypot(\u4ECA\u306E\u70B9.x - \u524D\u306E\u70B9.x, \u4ECA\u306E\u70B9.y - \u524D\u306E\u70B9.y);
|
|
24004
|
-
}
|
|
24005
|
-
\u70B9\u307E\u3067\u306E\u9577\u3055.push(\u7DDA\u306E\u5168\u9577);
|
|
24006
|
-
\u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
|
|
24007
|
-
}
|
|
24008
|
-
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
24009
|
-
const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => {
|
|
24010
|
-
if (!drawing) return true;
|
|
24011
|
-
if (data.length <= 1) return true;
|
|
24012
|
-
if (\u7DDA\u306E\u5168\u9577 === 0) return true;
|
|
24013
|
-
return \u4F38\u3073 >= (\u70B9\u307E\u3067\u306E\u9577\u3055[idx] ?? 0) / \u7DDA\u306E\u5168\u9577;
|
|
24014
|
-
};
|
|
24015
|
-
const gridCount = 4;
|
|
24016
|
-
const gridTicks = Array.from({ length: gridCount + 1 }, (_, i) => {
|
|
24017
|
-
const v = vMin + vRange * i / gridCount;
|
|
24018
|
-
return { y: yAt(v), value: v };
|
|
24019
|
-
});
|
|
24020
|
-
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
24021
|
-
/* @__PURE__ */ jsx(
|
|
24022
|
-
"rect",
|
|
24023
|
-
{
|
|
24024
|
-
"data-cdl-role": "node-body",
|
|
24025
|
-
x: 0,
|
|
24026
|
-
y: 0,
|
|
24027
|
-
width: node.w,
|
|
24028
|
-
height: node.h,
|
|
24029
|
-
rx: 16,
|
|
24030
|
-
fill: "var(--cdl-node-fill, #ffffff)",
|
|
24031
|
-
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
24032
|
-
strokeWidth: active ? 3 : 1.25
|
|
24033
|
-
}
|
|
24034
|
-
),
|
|
24035
|
-
gridTicks.map((t, i) => /* @__PURE__ */ jsxs("g", { children: [
|
|
24036
|
-
/* @__PURE__ */ jsx(
|
|
24037
|
-
"line",
|
|
24038
|
-
{
|
|
24039
|
-
x1: PAD_LEFT2,
|
|
24040
|
-
y1: t.y,
|
|
24041
|
-
x2: PAD_LEFT2 + canvasW,
|
|
24042
|
-
y2: t.y,
|
|
24043
|
-
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
24044
|
-
strokeWidth: 0.75,
|
|
24045
|
-
strokeDasharray: "3 3",
|
|
24046
|
-
opacity: 0.65
|
|
24047
|
-
}
|
|
24048
|
-
),
|
|
24049
|
-
/* @__PURE__ */ jsx(
|
|
24050
|
-
"text",
|
|
24051
|
-
{
|
|
24052
|
-
x: PAD_LEFT2 - 8,
|
|
24053
|
-
y: t.y + 4,
|
|
24054
|
-
fontSize: 11,
|
|
24055
|
-
textAnchor: "end",
|
|
24056
|
-
fill: "var(--cdl-text-dim, #5a6270)",
|
|
24057
|
-
children: Math.round(t.value)
|
|
24058
|
-
}
|
|
24059
|
-
)
|
|
24060
|
-
] }, `grid-${i}`)),
|
|
24061
|
-
/* @__PURE__ */ jsx(
|
|
24062
|
-
"line",
|
|
24063
|
-
{
|
|
24064
|
-
x1: PAD_LEFT2,
|
|
24065
|
-
y1: plotTop + plotH,
|
|
24066
|
-
x2: PAD_LEFT2 + canvasW,
|
|
24067
|
-
y2: plotTop + plotH,
|
|
24068
|
-
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
24069
|
-
strokeWidth: 1.25
|
|
24070
|
-
}
|
|
24071
|
-
),
|
|
24072
|
-
/* @__PURE__ */ jsx(
|
|
24073
|
-
"line",
|
|
24074
|
-
{
|
|
24075
|
-
x1: PAD_LEFT2,
|
|
24076
|
-
y1: plotTop,
|
|
24077
|
-
x2: PAD_LEFT2,
|
|
24078
|
-
y2: plotTop + plotH,
|
|
24079
|
-
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
24080
|
-
strokeWidth: 1.25
|
|
24081
|
-
}
|
|
24082
|
-
),
|
|
24083
|
-
data.length > 1 && /* @__PURE__ */ jsx(
|
|
24084
|
-
"polyline",
|
|
24085
|
-
{
|
|
24086
|
-
"data-cdl-role": "chart-line",
|
|
24087
|
-
points,
|
|
24088
|
-
fill: "none",
|
|
24089
|
-
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
24090
|
-
strokeWidth: 2.5,
|
|
24091
|
-
strokeLinejoin: "round",
|
|
24092
|
-
strokeLinecap: "round",
|
|
24093
|
-
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
24094
|
-
}
|
|
24095
|
-
),
|
|
24096
|
-
data.map((d, idx) => {
|
|
24097
|
-
const cx = xAt(idx);
|
|
24098
|
-
const cy = yAt(d.value);
|
|
24099
|
-
const prev = idx > 0 ? data[idx - 1].value : void 0;
|
|
24100
|
-
const next = idx < data.length - 1 ? data[idx + 1].value : void 0;
|
|
24101
|
-
const isValley = (prev === void 0 || d.value <= prev) && (next === void 0 || d.value <= next);
|
|
24102
|
-
const labelAbove = !isValley;
|
|
24103
|
-
const labelY = labelAbove ? cy - 12 : cy + 18;
|
|
24104
|
-
const \u51FA\u3059 = \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F(idx);
|
|
24105
|
-
return /* @__PURE__ */ jsxs("g", { "data-cdl-unresolved": d.unresolved ? "true" : void 0, children: [
|
|
24106
|
-
\u51FA\u3059 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24107
|
-
/* @__PURE__ */ jsx(
|
|
24108
|
-
"circle",
|
|
24109
|
-
{
|
|
24110
|
-
cx,
|
|
24111
|
-
cy,
|
|
24112
|
-
r: 5,
|
|
24113
|
-
fill: "var(--cdl-node-fill, #ffffff)",
|
|
24114
|
-
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
24115
|
-
strokeWidth: 2.5
|
|
24116
|
-
}
|
|
24117
|
-
),
|
|
24118
|
-
/* @__PURE__ */ jsx(
|
|
24119
|
-
"circle",
|
|
24120
|
-
{
|
|
24121
|
-
cx,
|
|
24122
|
-
cy,
|
|
24123
|
-
r: 2.5,
|
|
24124
|
-
fill: "var(--cdl-tone-accent, #2d6a8f)"
|
|
24125
|
-
}
|
|
24126
|
-
),
|
|
24127
|
-
/* @__PURE__ */ jsx(
|
|
24128
|
-
"text",
|
|
24129
|
-
{
|
|
24130
|
-
"data-cdl-role": "chart-line-value",
|
|
24131
|
-
x: cx,
|
|
24132
|
-
y: labelY,
|
|
24133
|
-
fontSize: 11,
|
|
24134
|
-
fontWeight: 600,
|
|
24135
|
-
textAnchor: "middle",
|
|
24136
|
-
fill: "var(--cdl-text, #1a1f2a)",
|
|
24137
|
-
children: d.value.toLocaleString()
|
|
24138
|
-
}
|
|
24139
|
-
)
|
|
24140
|
-
] }),
|
|
24141
|
-
/* @__PURE__ */ jsx(
|
|
24142
|
-
"text",
|
|
24143
|
-
{
|
|
24144
|
-
x: cx,
|
|
24145
|
-
y: PAD_TOP2 + canvasH + 20,
|
|
24146
|
-
fontSize: 12,
|
|
24147
|
-
textAnchor: "middle",
|
|
24148
|
-
fill: "var(--cdl-text-dim, #5a6270)",
|
|
24149
|
-
children: d.label
|
|
24150
|
-
}
|
|
24151
|
-
)
|
|
24152
|
-
] }, `pt-${idx}`);
|
|
24153
|
-
})
|
|
24154
|
-
] });
|
|
24155
|
-
}
|
|
24156
24318
|
function ChartPieNode({
|
|
24157
24319
|
node,
|
|
24158
24320
|
active,
|
|
@@ -29663,7 +29825,8 @@ function CdlNodeView({
|
|
|
29663
29825
|
drawing = false,
|
|
29664
29826
|
progress,
|
|
29665
29827
|
stateValues,
|
|
29666
|
-
currentPhaseId
|
|
29828
|
+
currentPhaseId,
|
|
29829
|
+
chartLineScale
|
|
29667
29830
|
}) {
|
|
29668
29831
|
const value = node.value ? interpolate(node.value, stateValues) : void 0;
|
|
29669
29832
|
const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues));
|
|
@@ -29719,6 +29882,7 @@ function CdlNodeView({
|
|
|
29719
29882
|
node: resolvedNode,
|
|
29720
29883
|
active,
|
|
29721
29884
|
stateValues,
|
|
29885
|
+
scale: chartLineScale,
|
|
29722
29886
|
drawing,
|
|
29723
29887
|
progress
|
|
29724
29888
|
}
|
|
@@ -29960,44 +30124,6 @@ function CdlNodeView({
|
|
|
29960
30124
|
}
|
|
29961
30125
|
);
|
|
29962
30126
|
}
|
|
29963
|
-
|
|
29964
|
-
// src/layout/lifeline.ts
|
|
29965
|
-
function lifelineStartYs(nodes) {
|
|
29966
|
-
const topmost = /* @__PURE__ */ new Map();
|
|
29967
|
-
for (const n of nodes) {
|
|
29968
|
-
const cur = topmost.get(n.lane);
|
|
29969
|
-
if (cur === void 0 || n.cy < cur.cy) topmost.set(n.lane, n);
|
|
29970
|
-
}
|
|
29971
|
-
const starts = /* @__PURE__ */ new Map();
|
|
29972
|
-
for (const [laneId, n] of topmost) starts.set(laneId, n.cy + n.h / 2);
|
|
29973
|
-
return starts;
|
|
29974
|
-
}
|
|
29975
|
-
function uniformLifelineEndY(lanes, nodes, starts = lifelineStartYs(nodes)) {
|
|
29976
|
-
const lifelineLanes = lanes.filter((l) => l.lifeline);
|
|
29977
|
-
let deepestStart = Number.NEGATIVE_INFINITY;
|
|
29978
|
-
for (const lane of lifelineLanes) {
|
|
29979
|
-
const start = starts.get(lane.id);
|
|
29980
|
-
if (start !== void 0) deepestStart = Math.max(deepestStart, start);
|
|
29981
|
-
}
|
|
29982
|
-
const footerTops = lifelineFooterNodes(lanes, nodes).map((f) => footerShapeDrawTop(f)).filter((top) => top > deepestStart);
|
|
29983
|
-
if (footerTops.length > 0) return Math.min(...footerTops);
|
|
29984
|
-
return lifelineLanes[0] ? lifelineLanes[0].y + lifelineLanes[0].height : 0;
|
|
29985
|
-
}
|
|
29986
|
-
|
|
29987
|
-
// src/kinds/draw-ratio.ts
|
|
29988
|
-
var DRAW_RATIO_DEFAULT = 1;
|
|
29989
|
-
function \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio) {
|
|
29990
|
-
if (ratio === void 0) return DRAW_RATIO_DEFAULT;
|
|
29991
|
-
if (!Number.isFinite(ratio)) return DRAW_RATIO_DEFAULT;
|
|
29992
|
-
if (ratio <= 0 || ratio > 1) return DRAW_RATIO_DEFAULT;
|
|
29993
|
-
return ratio;
|
|
29994
|
-
}
|
|
29995
|
-
function \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, ratio) {
|
|
29996
|
-
const \u5272\u5408 = \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio);
|
|
29997
|
-
if (\u5272\u5408 === DRAW_RATIO_DEFAULT) return progress;
|
|
29998
|
-
if (!Number.isFinite(progress)) return progress;
|
|
29999
|
-
return Math.min(1, progress / \u5272\u5408);
|
|
30000
|
-
}
|
|
30001
30127
|
function CdlStage({
|
|
30002
30128
|
laid,
|
|
30003
30129
|
currentPhase,
|
|
@@ -30039,6 +30165,26 @@ function CdlStage({
|
|
|
30039
30165
|
};
|
|
30040
30166
|
}, [laid.phases, currentPhase, laid.edgeReveal]);
|
|
30041
30167
|
const drawSet = new Set(currentPhase?.draw ?? []);
|
|
30168
|
+
const chartLineScales = useMemo(() => {
|
|
30169
|
+
const nodes = laid.nodes.filter((node) => node.kind === "chart-line");
|
|
30170
|
+
if (nodes.length === 0) return /* @__PURE__ */ new Map();
|
|
30171
|
+
const frames = [
|
|
30172
|
+
// phase index -1 はどの段にも入る前の初期値。
|
|
30173
|
+
computeStateValues(laid, -1, 0),
|
|
30174
|
+
...laid.phases.flatMap((_, phaseIndex) => [
|
|
30175
|
+
computeStateValues(laid, phaseIndex, 0),
|
|
30176
|
+
computeStateValues(laid, phaseIndex, 1)
|
|
30177
|
+
])
|
|
30178
|
+
];
|
|
30179
|
+
const scales = /* @__PURE__ */ new Map();
|
|
30180
|
+
for (const node of nodes) {
|
|
30181
|
+
const values = frames.flatMap(
|
|
30182
|
+
(stateValues2) => resolveChartData(node.chartData ?? [], stateValues2).map((datum) => datum.value)
|
|
30183
|
+
);
|
|
30184
|
+
scales.set(node.id, \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values));
|
|
30185
|
+
}
|
|
30186
|
+
return scales;
|
|
30187
|
+
}, [laid]);
|
|
30042
30188
|
const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
|
|
30043
30189
|
const { lifelineStarts, uniformFooterTop } = useMemo(() => {
|
|
30044
30190
|
const starts = lifelineStartYs(laid.nodes);
|
|
@@ -30047,6 +30193,63 @@ function CdlStage({
|
|
|
30047
30193
|
uniformFooterTop: uniformLifelineEndY(laid.lanes, laid.nodes, starts)
|
|
30048
30194
|
};
|
|
30049
30195
|
}, [laid]);
|
|
30196
|
+
const edgeHeadMarkers = useMemo(() => {
|
|
30197
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
30198
|
+
const add = (tone, head, fill) => {
|
|
30199
|
+
for (const small of [false, true]) {
|
|
30200
|
+
const id = edgeHeadMarkerName(tone, head, small, fill);
|
|
30201
|
+
if (id !== void 0) referenced.add(id);
|
|
30202
|
+
}
|
|
30203
|
+
};
|
|
30204
|
+
for (const edge of laid.edges) {
|
|
30205
|
+
add(edge.tone, edge.head, edge.headFill);
|
|
30206
|
+
if (edge.tailHead !== void 0) add(edge.tone, edge.tailHead, edge.tailHeadFill);
|
|
30207
|
+
}
|
|
30208
|
+
return Object.entries(TONE).flatMap(
|
|
30209
|
+
([tone, color]) => [
|
|
30210
|
+
[false, 14],
|
|
30211
|
+
[true, 10]
|
|
30212
|
+
].flatMap(
|
|
30213
|
+
([small, size]) => EDGE_HEADS.flatMap(
|
|
30214
|
+
(head) => EDGE_HEAD_FILLS.map((fill) => {
|
|
30215
|
+
const \u5F62 = EDGE_HEAD_SHAPE[head];
|
|
30216
|
+
const id = edgeHeadMarkerId(tone, head, small, fill);
|
|
30217
|
+
if (!referenced.has(id) || \u5F62.d === "") return null;
|
|
30218
|
+
if (fill !== EDGE_HEAD_FILL_DEFAULT && !\u5F62.filled) return null;
|
|
30219
|
+
const \u5857 = edgeHeadPaint(head, fill, color);
|
|
30220
|
+
return /* @__PURE__ */ jsx(
|
|
30221
|
+
"marker",
|
|
30222
|
+
{
|
|
30223
|
+
id,
|
|
30224
|
+
viewBox: `0 0 ${\u5F62.w} ${\u5F62.h}`,
|
|
30225
|
+
refX: \u5F62.refX,
|
|
30226
|
+
refY: \u5F62.h / 2,
|
|
30227
|
+
markerWidth: size * (\u5F62.scale ?? 1) * \u5F62.w / \u5F62.h,
|
|
30228
|
+
markerHeight: size * (\u5F62.scale ?? 1),
|
|
30229
|
+
markerUnits: "userSpaceOnUse",
|
|
30230
|
+
orient: "auto-start-reverse",
|
|
30231
|
+
children: /* @__PURE__ */ jsx(
|
|
30232
|
+
"path",
|
|
30233
|
+
{
|
|
30234
|
+
"data-cdl-role": "edge-arrowhead",
|
|
30235
|
+
"data-cdl-edge-head": head,
|
|
30236
|
+
"data-cdl-edge-head-fill": fill,
|
|
30237
|
+
d: \u5F62.d,
|
|
30238
|
+
fill: \u5857.fill,
|
|
30239
|
+
stroke: \u5857.stroke,
|
|
30240
|
+
strokeWidth: \u5857.strokeWidth,
|
|
30241
|
+
strokeLinecap: \u5857.strokeWidth === void 0 ? void 0 : "round",
|
|
30242
|
+
strokeLinejoin: \u5857.strokeWidth === void 0 ? void 0 : "round"
|
|
30243
|
+
}
|
|
30244
|
+
)
|
|
30245
|
+
},
|
|
30246
|
+
id
|
|
30247
|
+
);
|
|
30248
|
+
})
|
|
30249
|
+
)
|
|
30250
|
+
)
|
|
30251
|
+
);
|
|
30252
|
+
}, [laid]);
|
|
30050
30253
|
const diagramScale = laid.diagramScale ?? 1;
|
|
30051
30254
|
return /* @__PURE__ */ jsxs("div", { className: compact ? "px-3 py-3" : "px-6 py-6", style: compact ? void 0 : { minHeight: 460 }, children: [
|
|
30052
30255
|
/* @__PURE__ */ jsxs(
|
|
@@ -30065,55 +30268,11 @@ function CdlStage({
|
|
|
30065
30268
|
"data-cdl-type": laid.type,
|
|
30066
30269
|
children: [
|
|
30067
30270
|
/* @__PURE__ */ jsxs("defs", { children: [
|
|
30068
|
-
|
|
30069
|
-
([tone, color]) => [["", 14], ["-sm", 10]].flatMap(
|
|
30070
|
-
([suffix, size]) => EDGE_HEADS.flatMap(
|
|
30071
|
-
(head) => (
|
|
30072
|
-
// 塗り方は形と別の軸 (#578)。 塗らない形では 2 つが同じ名前に畳まれるので、
|
|
30073
|
-
// `edgeHeadMarkerId` が返す名前で重複を外す
|
|
30074
|
-
EDGE_HEAD_FILLS.map((fill) => {
|
|
30075
|
-
const \u5F62 = EDGE_HEAD_SHAPE[head];
|
|
30076
|
-
const id = edgeHeadMarkerId(tone, head, suffix === "-sm", fill);
|
|
30077
|
-
if (\u5F62.d === "") return null;
|
|
30078
|
-
if (fill !== EDGE_HEAD_FILL_DEFAULT && !\u5F62.filled) return null;
|
|
30079
|
-
const \u5857 = edgeHeadPaint(head, fill, color);
|
|
30080
|
-
return /* @__PURE__ */ jsx(
|
|
30081
|
-
"marker",
|
|
30082
|
-
{
|
|
30083
|
-
id,
|
|
30084
|
-
viewBox: `0 0 ${\u5F62.w} ${\u5F62.h}`,
|
|
30085
|
-
refX: \u5F62.refX,
|
|
30086
|
-
refY: \u5F62.h / 2,
|
|
30087
|
-
markerWidth: size * (\u5F62.scale ?? 1) * \u5F62.w / \u5F62.h,
|
|
30088
|
-
markerHeight: size * (\u5F62.scale ?? 1),
|
|
30089
|
-
markerUnits: "userSpaceOnUse",
|
|
30090
|
-
orient: "auto-start-reverse",
|
|
30091
|
-
children: /* @__PURE__ */ jsx(
|
|
30092
|
-
"path",
|
|
30093
|
-
{
|
|
30094
|
-
"data-cdl-role": "edge-arrowhead",
|
|
30095
|
-
"data-cdl-edge-head": head,
|
|
30096
|
-
"data-cdl-edge-head-fill": fill,
|
|
30097
|
-
d: \u5F62.d,
|
|
30098
|
-
fill: \u5857.fill,
|
|
30099
|
-
stroke: \u5857.stroke,
|
|
30100
|
-
strokeWidth: \u5857.strokeWidth,
|
|
30101
|
-
strokeLinecap: \u5857.strokeWidth === void 0 ? void 0 : "round",
|
|
30102
|
-
strokeLinejoin: \u5857.strokeWidth === void 0 ? void 0 : "round"
|
|
30103
|
-
}
|
|
30104
|
-
)
|
|
30105
|
-
},
|
|
30106
|
-
id
|
|
30107
|
-
);
|
|
30108
|
-
})
|
|
30109
|
-
)
|
|
30110
|
-
)
|
|
30111
|
-
)
|
|
30112
|
-
),
|
|
30271
|
+
edgeHeadMarkers,
|
|
30113
30272
|
/* @__PURE__ */ jsx(
|
|
30114
30273
|
"marker",
|
|
30115
30274
|
{
|
|
30116
|
-
id:
|
|
30275
|
+
id: EDGE_HEAD_MUTED_MARKER_ID,
|
|
30117
30276
|
viewBox: "0 0 10 10",
|
|
30118
30277
|
refX: "9",
|
|
30119
30278
|
refY: "5",
|
|
@@ -30220,7 +30379,8 @@ function CdlStage({
|
|
|
30220
30379
|
drawing: \u63CF\u304F,
|
|
30221
30380
|
progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
|
|
30222
30381
|
stateValues,
|
|
30223
|
-
currentPhaseId: currentPhase?.id
|
|
30382
|
+
currentPhaseId: currentPhase?.id,
|
|
30383
|
+
chartLineScale: chartLineScales.get(node.id)
|
|
30224
30384
|
}
|
|
30225
30385
|
);
|
|
30226
30386
|
return /* @__PURE__ */ jsx("g", { children: view }, node.id);
|