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