@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/react.cjs
CHANGED
|
@@ -8828,11 +8828,66 @@ function \u672B\u5C3E\u3092\u8FBA\u306B\u6CBF\u3063\u3066\u305A\u3089\u3059(e, \
|
|
|
8828
8828
|
parts.push(`L ${s.x2} ${s.y2}`);
|
|
8829
8829
|
}
|
|
8830
8830
|
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;
|
|
8831
|
+
if (\u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C) {
|
|
8832
|
+
const \u6298\u308A\u8FD4\u3055\u306A\u3044 = \u76F4\u524D\u306E\u6298\u308C\u3054\u3068\u305A\u3089\u3059(segs, \u6A2A, d, nodes, e);
|
|
8833
|
+
if (\u6298\u308A\u8FD4\u3055\u306A\u3044) return \u6298\u308A\u8FD4\u3055\u306A\u3044;
|
|
8834
|
+
}
|
|
8831
8835
|
if (!\u6298\u308C1\u306F\u76F4\u524D\u306E\u6298\u308C) parts.push(`L ${round1(\u6298\u308C1.x)} ${round1(\u6298\u308C1.y)}`);
|
|
8832
8836
|
parts.push(`L ${round1(\u6298\u308C2.x)} ${round1(\u6298\u308C2.y)}`);
|
|
8833
8837
|
parts.push(`L ${round1(\u7D42\u70B9.x)} ${round1(\u7D42\u70B9.y)}`);
|
|
8834
8838
|
return parts.join(" ");
|
|
8835
8839
|
}
|
|
8840
|
+
function \u76F4\u524D\u306E\u6298\u308C\u3054\u3068\u305A\u3089\u3059(segs, \u6A2A, d, nodes, e) {
|
|
8841
|
+
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;
|
|
8842
|
+
let \u5438\u53CE = -1;
|
|
8843
|
+
for (let i = segs.length - 2; i >= 0; i -= 1) {
|
|
8844
|
+
if (\u5E73\u884C\u304B(segs[i])) {
|
|
8845
|
+
\u5438\u53CE = i;
|
|
8846
|
+
break;
|
|
8847
|
+
}
|
|
8848
|
+
}
|
|
8849
|
+
if (\u5438\u53CE < 0) return null;
|
|
8850
|
+
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);
|
|
8851
|
+
const \u5411\u304D = \u6A2A ? Math.sign(segs[\u5438\u53CE].y2 - segs[\u5438\u53CE].y1) : Math.sign(segs[\u5438\u53CE].x2 - segs[\u5438\u53CE].x1);
|
|
8852
|
+
const \u5F8C\u306E\u9577\u3055 = \u5143\u306E\u9577\u3055 + \u5411\u304D * d;
|
|
8853
|
+
if (\u5F8C\u306E\u9577\u3055 < ENDPOINT_FAN_RUNUP) return null;
|
|
8854
|
+
const \u305A\u3089\u3059 = (p) => \u6A2A ? { ...p, y: p.y + d } : { ...p, x: p.x + d };
|
|
8855
|
+
const \u65B0segs = segs.map((s, i) => {
|
|
8856
|
+
if (i <= \u5438\u53CE) return s;
|
|
8857
|
+
return {
|
|
8858
|
+
...s,
|
|
8859
|
+
x1: \u305A\u3089\u3059({ x: s.x1, y: s.y1 }).x,
|
|
8860
|
+
y1: \u305A\u3089\u3059({ x: s.x1, y: s.y1 }).y,
|
|
8861
|
+
x2: \u305A\u3089\u3059({ x: s.x2, y: s.y2 }).x,
|
|
8862
|
+
y2: \u305A\u3089\u3059({ x: s.x2, y: s.y2 }).y,
|
|
8863
|
+
...s.ctrl ? { ctrl: s.ctrl.map((c) => \u305A\u3089\u3059(c)) } : {}
|
|
8864
|
+
};
|
|
8865
|
+
});
|
|
8866
|
+
\u65B0segs[\u5438\u53CE] = {
|
|
8867
|
+
...segs[\u5438\u53CE],
|
|
8868
|
+
x2: \u6A2A ? segs[\u5438\u53CE].x2 : segs[\u5438\u53CE].x2 + d,
|
|
8869
|
+
y2: \u6A2A ? segs[\u5438\u53CE].y2 + d : segs[\u5438\u53CE].y2
|
|
8870
|
+
};
|
|
8871
|
+
if (nodes.some(
|
|
8872
|
+
(n) => n.id !== e.from && n.id !== e.to && segmentsCrossRect(
|
|
8873
|
+
\u65B0segs.slice(\u5438\u53CE).map((s) => ({ x1: s.x1, y1: s.y1, x2: s.x2, y2: s.y2 })),
|
|
8874
|
+
nodeRect(n)
|
|
8875
|
+
)
|
|
8876
|
+
)) {
|
|
8877
|
+
return null;
|
|
8878
|
+
}
|
|
8879
|
+
const head = \u65B0segs[0];
|
|
8880
|
+
const parts = [`M ${round1(head.x1)} ${round1(head.y1)}`];
|
|
8881
|
+
for (const s of \u65B0segs) {
|
|
8882
|
+
if (s.cmd === "Q") {
|
|
8883
|
+
const c = s.ctrl?.[0];
|
|
8884
|
+
parts.push(c ? `Q ${round1(c.x)} ${round1(c.y)}, ${round1(s.x2)} ${round1(s.y2)}` : `L ${round1(s.x2)} ${round1(s.y2)}`);
|
|
8885
|
+
continue;
|
|
8886
|
+
}
|
|
8887
|
+
parts.push(`L ${round1(s.x2)} ${round1(s.y2)}`);
|
|
8888
|
+
}
|
|
8889
|
+
return parts.join(" ");
|
|
8890
|
+
}
|
|
8836
8891
|
|
|
8837
8892
|
// src/layout/lanes.ts
|
|
8838
8893
|
var LANE_POSITION_EPSILON = 1e-9;
|
|
@@ -9832,8 +9887,300 @@ function StateDiffCard({
|
|
|
9832
9887
|
}
|
|
9833
9888
|
);
|
|
9834
9889
|
}
|
|
9890
|
+
var \u6570\u3092\u66F8\u304F = (value) => value.toLocaleString("en-US", { maximumFractionDigits: 12 });
|
|
9891
|
+
function \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values) {
|
|
9892
|
+
let rawMin = values.length > 0 ? Math.min(...values) : 0;
|
|
9893
|
+
let rawMax = values.length > 0 ? Math.max(...values) : 1;
|
|
9894
|
+
if (rawMin === rawMax) {
|
|
9895
|
+
const room = 10 ** Math.floor(Math.log10(Math.abs(rawMin) || 1) - 1);
|
|
9896
|
+
rawMin -= room;
|
|
9897
|
+
rawMax += room;
|
|
9898
|
+
}
|
|
9899
|
+
const roughStep = (rawMax - rawMin) / 4;
|
|
9900
|
+
const power = 10 ** Math.floor(Math.log10(roughStep));
|
|
9901
|
+
const fraction = roughStep / power;
|
|
9902
|
+
const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 2.5 ? 2.5 : fraction <= 5 ? 5 : 10;
|
|
9903
|
+
const step = niceFraction * power;
|
|
9904
|
+
const min = Math.floor(rawMin / step) * step;
|
|
9905
|
+
const max = Math.ceil(rawMax / step) * step;
|
|
9906
|
+
const tickCount = Math.round((max - min) / step);
|
|
9907
|
+
const ticks = Array.from({ length: tickCount + 1 }, (_, i) => {
|
|
9908
|
+
const value = min + step * i;
|
|
9909
|
+
return Math.abs(value) < step * 1e-12 ? 0 : value;
|
|
9910
|
+
});
|
|
9911
|
+
return { min, max, ticks };
|
|
9912
|
+
}
|
|
9913
|
+
function ChartLineNode({
|
|
9914
|
+
node,
|
|
9915
|
+
active,
|
|
9916
|
+
stateValues = {},
|
|
9917
|
+
scale: fixedScale,
|
|
9918
|
+
drawing = false,
|
|
9919
|
+
progress = 1
|
|
9920
|
+
}) {
|
|
9921
|
+
const x0 = node.cx - node.w / 2;
|
|
9922
|
+
const y0 = node.cy - node.h / 2;
|
|
9923
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
9924
|
+
const PAD_TOP2 = 36;
|
|
9925
|
+
const PAD_RIGHT2 = 40;
|
|
9926
|
+
const PAD_BOTTOM2 = 56;
|
|
9927
|
+
const PAD_LEFT2 = 72;
|
|
9928
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
9929
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
9930
|
+
const scale = fixedScale ?? \u6298\u308C\u7DDA\u306E\u76EE\u76DB(data.map((d) => d.value));
|
|
9931
|
+
const vRange = scale.max - scale.min;
|
|
9932
|
+
const LABEL_ROOM = 20;
|
|
9933
|
+
const plotTop = PAD_TOP2 + LABEL_ROOM;
|
|
9934
|
+
const plotH = Math.max(canvasH - LABEL_ROOM * 2, 1);
|
|
9935
|
+
const POINT_EDGE_ROOM = 24;
|
|
9936
|
+
const plotW = Math.max(canvasW - POINT_EDGE_ROOM * 2, 1);
|
|
9937
|
+
const xAt = (idx) => PAD_LEFT2 + POINT_EDGE_ROOM + (data.length <= 1 ? plotW / 2 : plotW * idx / (data.length - 1));
|
|
9938
|
+
const yAt = (v) => plotTop + plotH - (v - scale.min) / vRange * plotH;
|
|
9939
|
+
const plotBottom = PAD_TOP2 + canvasH;
|
|
9940
|
+
let \u7DDA\u306E\u5168\u9577 = 0;
|
|
9941
|
+
let \u524D\u306E\u70B9;
|
|
9942
|
+
const \u63CF\u753B\u70B9 = data.map((datum, idx) => {
|
|
9943
|
+
const \u4ECA\u306E\u70B9 = { datum, x: xAt(idx), y: yAt(datum.value), \u3053\u3053\u307E\u3067\u306E\u9577\u3055: 0 };
|
|
9944
|
+
if (\u524D\u306E\u70B9) {
|
|
9945
|
+
\u7DDA\u306E\u5168\u9577 += Math.hypot(\u4ECA\u306E\u70B9.x - \u524D\u306E\u70B9.x, \u4ECA\u306E\u70B9.y - \u524D\u306E\u70B9.y);
|
|
9946
|
+
}
|
|
9947
|
+
\u4ECA\u306E\u70B9.\u3053\u3053\u307E\u3067\u306E\u9577\u3055 = \u7DDA\u306E\u5168\u9577;
|
|
9948
|
+
\u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
|
|
9949
|
+
return \u4ECA\u306E\u70B9;
|
|
9950
|
+
});
|
|
9951
|
+
const points = \u63CF\u753B\u70B9.map((\u70B9) => `${\u70B9.x},${\u70B9.y}`).join(" ");
|
|
9952
|
+
const \u6BB5\u306E\u9032\u307F = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
9953
|
+
const \u7C92\u3092\u8D70\u3089\u305B\u308B = drawing && node.chartTrace === true;
|
|
9954
|
+
const \u4F38\u3073 = \u7C92\u3092\u8D70\u3089\u305B\u308B ? Math.min(1, \u6BB5\u306E\u9032\u307F / 0.5) : \u6BB5\u306E\u9032\u307F;
|
|
9955
|
+
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;
|
|
9956
|
+
const \u7C92\u304C\u51FA\u308B = \u7C92\u3092\u8D70\u3089\u305B\u308B && \u6BB5\u306E\u9032\u307F >= 0.55 && \u6BB5\u306E\u9032\u307F < 1;
|
|
9957
|
+
const \u5230\u7740\u7A93 = 0.12;
|
|
9958
|
+
let \u7C92\u306E\u4F4D\u7F6E;
|
|
9959
|
+
const \u6700\u521D\u306E\u70B9 = \u63CF\u753B\u70B9[0];
|
|
9960
|
+
if (\u7C92\u304C\u51FA\u308B && \u6700\u521D\u306E\u70B9) {
|
|
9961
|
+
const \u7C92\u307E\u3067\u306E\u9577\u3055 = \u7C92\u306E\u9032\u307F * \u7DDA\u306E\u5168\u9577;
|
|
9962
|
+
let \u533A\u9593\u306E\u524D = \u6700\u521D\u306E\u70B9;
|
|
9963
|
+
let \u533A\u9593\u306E\u5F8C = \u6700\u521D\u306E\u70B9;
|
|
9964
|
+
for (const \u70B9 of \u63CF\u753B\u70B9.slice(1)) {
|
|
9965
|
+
\u533A\u9593\u306E\u5F8C = \u70B9;
|
|
9966
|
+
if (\u70B9.\u3053\u3053\u307E\u3067\u306E\u9577\u3055 >= \u7C92\u307E\u3067\u306E\u9577\u3055) break;
|
|
9967
|
+
\u533A\u9593\u306E\u524D = \u70B9;
|
|
9968
|
+
}
|
|
9969
|
+
const \u533A\u9593\u306E\u59CB\u3081 = \u533A\u9593\u306E\u524D.\u3053\u3053\u307E\u3067\u306E\u9577\u3055;
|
|
9970
|
+
const \u533A\u9593\u306E\u9577\u3055 = \u533A\u9593\u306E\u5F8C.\u3053\u3053\u307E\u3067\u306E\u9577\u3055 - \u533A\u9593\u306E\u59CB\u3081;
|
|
9971
|
+
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;
|
|
9972
|
+
\u7C92\u306E\u4F4D\u7F6E = {
|
|
9973
|
+
x: \u533A\u9593\u306E\u524D.x + (\u533A\u9593\u306E\u5F8C.x - \u533A\u9593\u306E\u524D.x) * \u533A\u9593\u306E\u9032\u307F,
|
|
9974
|
+
y: \u533A\u9593\u306E\u524D.y + (\u533A\u9593\u306E\u5F8C.y - \u533A\u9593\u306E\u524D.y) * \u533A\u9593\u306E\u9032\u307F
|
|
9975
|
+
};
|
|
9976
|
+
}
|
|
9977
|
+
const gridTicks = scale.ticks.map((value) => ({ y: yAt(value), value }));
|
|
9978
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
9979
|
+
gridTicks.map((t, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
9980
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9981
|
+
"line",
|
|
9982
|
+
{
|
|
9983
|
+
x1: PAD_LEFT2,
|
|
9984
|
+
y1: t.y,
|
|
9985
|
+
x2: PAD_LEFT2 + canvasW,
|
|
9986
|
+
y2: t.y,
|
|
9987
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
9988
|
+
strokeWidth: 0.75,
|
|
9989
|
+
strokeDasharray: "3 3",
|
|
9990
|
+
opacity: 0.65
|
|
9991
|
+
}
|
|
9992
|
+
),
|
|
9993
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9994
|
+
"text",
|
|
9995
|
+
{
|
|
9996
|
+
x: PAD_LEFT2 - 8,
|
|
9997
|
+
y: t.y + 4,
|
|
9998
|
+
fontSize: 11,
|
|
9999
|
+
textAnchor: "end",
|
|
10000
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
10001
|
+
children: \u6570\u3092\u66F8\u304F(t.value)
|
|
10002
|
+
}
|
|
10003
|
+
)
|
|
10004
|
+
] }, `grid-${i}`)),
|
|
10005
|
+
node.chartFillUnder && data.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10006
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10007
|
+
"linearGradient",
|
|
10008
|
+
{
|
|
10009
|
+
id: `chart-line-fill-${node.id}`,
|
|
10010
|
+
gradientUnits: "userSpaceOnUse",
|
|
10011
|
+
x1: 0,
|
|
10012
|
+
y1: plotTop,
|
|
10013
|
+
x2: 0,
|
|
10014
|
+
y2: plotBottom,
|
|
10015
|
+
children: [
|
|
10016
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "var(--cdl-tone-accent, #2d6a8f)", stopOpacity: 0.22 }),
|
|
10017
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "var(--cdl-tone-accent, #2d6a8f)", stopOpacity: 0 })
|
|
10018
|
+
]
|
|
10019
|
+
}
|
|
10020
|
+
) }),
|
|
10021
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10022
|
+
"path",
|
|
10023
|
+
{
|
|
10024
|
+
"data-cdl-role": "chart-line-fill-under",
|
|
10025
|
+
d: `M ${xAt(0)} ${plotBottom} L ${points.replaceAll(",", " ")} L ${xAt(data.length - 1)} ${plotBottom} Z`,
|
|
10026
|
+
fill: `url(#chart-line-fill-${node.id})`,
|
|
10027
|
+
stroke: "none"
|
|
10028
|
+
}
|
|
10029
|
+
)
|
|
10030
|
+
] }),
|
|
10031
|
+
data.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10032
|
+
"polyline",
|
|
10033
|
+
{
|
|
10034
|
+
"data-cdl-role": "chart-line",
|
|
10035
|
+
points,
|
|
10036
|
+
fill: "none",
|
|
10037
|
+
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
10038
|
+
strokeWidth: active ? 3 : 2,
|
|
10039
|
+
strokeLinejoin: "round",
|
|
10040
|
+
strokeLinecap: "round",
|
|
10041
|
+
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
10042
|
+
}
|
|
10043
|
+
),
|
|
10044
|
+
\u7C92\u306E\u4F4D\u7F6E && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10045
|
+
"circle",
|
|
10046
|
+
{
|
|
10047
|
+
"data-cdl-role": "chart-line-trace",
|
|
10048
|
+
cx: \u7C92\u306E\u4F4D\u7F6E.x,
|
|
10049
|
+
cy: \u7C92\u306E\u4F4D\u7F6E.y,
|
|
10050
|
+
r: 4.5,
|
|
10051
|
+
fill: "var(--cdl-now)"
|
|
10052
|
+
}
|
|
10053
|
+
),
|
|
10054
|
+
\u63CF\u753B\u70B9.map(({ datum: d, x: cx, y: cy, \u3053\u3053\u307E\u3067\u306E\u9577\u3055 }, idx) => {
|
|
10055
|
+
const prev = data[idx - 1]?.value;
|
|
10056
|
+
const next = data[idx + 1]?.value;
|
|
10057
|
+
const isValley = (prev === void 0 || d.value <= prev) && (next === void 0 || d.value <= next);
|
|
10058
|
+
const labelAbove = !isValley;
|
|
10059
|
+
const labelY = labelAbove ? cy - 12 : cy + 18;
|
|
10060
|
+
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;
|
|
10061
|
+
const \u51FA\u3059 = !drawing || (!\u7C92\u3092\u8D70\u3089\u305B\u308B || \u6BB5\u306E\u9032\u307F >= 0.55) && \u5230\u7740\u5F8C >= 0;
|
|
10062
|
+
const \u5149\u308B = drawing && \u51FA\u3059 && \u5230\u7740\u5F8C < \u5230\u7740\u7A93;
|
|
10063
|
+
const \u5149\u306E\u9032\u307F = \u5149\u308B ? \u5230\u7740\u5F8C / \u5230\u7740\u7A93 : 1;
|
|
10064
|
+
let \u70B9\u3068\u5024;
|
|
10065
|
+
if (\u51FA\u3059) {
|
|
10066
|
+
const \u5149\u306E\u534A\u5F84 = 6 + 16 * \u5149\u306E\u9032\u307F;
|
|
10067
|
+
const \u5024 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
10068
|
+
"text",
|
|
10069
|
+
{
|
|
10070
|
+
"data-cdl-role": "chart-line-value",
|
|
10071
|
+
x: cx,
|
|
10072
|
+
y: labelY,
|
|
10073
|
+
fontSize: 11,
|
|
10074
|
+
fontWeight: 600,
|
|
10075
|
+
textAnchor: "middle",
|
|
10076
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
10077
|
+
children: \u6570\u3092\u66F8\u304F(d.value)
|
|
10078
|
+
}
|
|
10079
|
+
);
|
|
10080
|
+
\u70B9\u3068\u5024 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10081
|
+
\u5149\u308B && // marker の `circle` を数える利用側へ混ぜず、専用 role の等径 ellipse として輪を出す。
|
|
10082
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10083
|
+
"ellipse",
|
|
10084
|
+
{
|
|
10085
|
+
"data-cdl-role": "chart-line-arrival-ring",
|
|
10086
|
+
cx,
|
|
10087
|
+
cy,
|
|
10088
|
+
rx: \u5149\u306E\u534A\u5F84,
|
|
10089
|
+
ry: \u5149\u306E\u534A\u5F84,
|
|
10090
|
+
fill: "none",
|
|
10091
|
+
stroke: "var(--cdl-now)",
|
|
10092
|
+
strokeWidth: 2,
|
|
10093
|
+
opacity: 0.85 * (1 - \u5149\u306E\u9032\u307F)
|
|
10094
|
+
}
|
|
10095
|
+
),
|
|
10096
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10097
|
+
"circle",
|
|
10098
|
+
{
|
|
10099
|
+
cx,
|
|
10100
|
+
cy,
|
|
10101
|
+
r: 5,
|
|
10102
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
10103
|
+
stroke: \u5149\u308B ? "var(--cdl-now)" : "var(--cdl-tone-accent, #2d6a8f)",
|
|
10104
|
+
strokeWidth: 2.5
|
|
10105
|
+
}
|
|
10106
|
+
),
|
|
10107
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10108
|
+
"circle",
|
|
10109
|
+
{
|
|
10110
|
+
cx,
|
|
10111
|
+
cy,
|
|
10112
|
+
r: 2.5,
|
|
10113
|
+
fill: \u5149\u308B ? "var(--cdl-now)" : "var(--cdl-tone-accent, #2d6a8f)"
|
|
10114
|
+
}
|
|
10115
|
+
),
|
|
10116
|
+
node.chartValueRise && \u5149\u308B ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10117
|
+
"g",
|
|
10118
|
+
{
|
|
10119
|
+
"data-cdl-role": "chart-line-value-rise",
|
|
10120
|
+
transform: `translate(0 ${8 * (1 - \u5149\u306E\u9032\u307F)})`,
|
|
10121
|
+
children: \u5024
|
|
10122
|
+
}
|
|
10123
|
+
) : \u5024
|
|
10124
|
+
] });
|
|
10125
|
+
}
|
|
10126
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-unresolved": d.unresolved ? "true" : void 0, children: [
|
|
10127
|
+
\u70B9\u3068\u5024,
|
|
10128
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10129
|
+
"text",
|
|
10130
|
+
{
|
|
10131
|
+
x: cx,
|
|
10132
|
+
y: PAD_TOP2 + canvasH + 20,
|
|
10133
|
+
fontSize: 12,
|
|
10134
|
+
textAnchor: "middle",
|
|
10135
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
10136
|
+
children: d.label
|
|
10137
|
+
}
|
|
10138
|
+
)
|
|
10139
|
+
] }, `pt-${idx}`);
|
|
10140
|
+
})
|
|
10141
|
+
] });
|
|
10142
|
+
}
|
|
10143
|
+
|
|
10144
|
+
// src/kinds/draw-ratio.ts
|
|
10145
|
+
var DRAW_RATIO_DEFAULT = 1;
|
|
10146
|
+
function \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio) {
|
|
10147
|
+
if (ratio === void 0) return DRAW_RATIO_DEFAULT;
|
|
10148
|
+
if (!Number.isFinite(ratio)) return DRAW_RATIO_DEFAULT;
|
|
10149
|
+
if (ratio <= 0 || ratio > 1) return DRAW_RATIO_DEFAULT;
|
|
10150
|
+
return ratio;
|
|
10151
|
+
}
|
|
10152
|
+
function \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, ratio) {
|
|
10153
|
+
const \u5272\u5408 = \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio);
|
|
10154
|
+
if (\u5272\u5408 === DRAW_RATIO_DEFAULT) return progress;
|
|
10155
|
+
if (!Number.isFinite(progress)) return progress;
|
|
10156
|
+
return Math.min(1, progress / \u5272\u5408);
|
|
10157
|
+
}
|
|
10158
|
+
|
|
10159
|
+
// src/layout/lifeline.ts
|
|
10160
|
+
function lifelineStartYs(nodes) {
|
|
10161
|
+
const topmost = /* @__PURE__ */ new Map();
|
|
10162
|
+
for (const n of nodes) {
|
|
10163
|
+
const cur = topmost.get(n.lane);
|
|
10164
|
+
if (cur === void 0 || n.cy < cur.cy) topmost.set(n.lane, n);
|
|
10165
|
+
}
|
|
10166
|
+
const starts = /* @__PURE__ */ new Map();
|
|
10167
|
+
for (const [laneId, n] of topmost) starts.set(laneId, n.cy + n.h / 2);
|
|
10168
|
+
return starts;
|
|
10169
|
+
}
|
|
10170
|
+
function uniformLifelineEndY(lanes, nodes, starts = lifelineStartYs(nodes)) {
|
|
10171
|
+
const lifelineLanes = lanes.filter((l) => l.lifeline);
|
|
10172
|
+
let deepestStart = Number.NEGATIVE_INFINITY;
|
|
10173
|
+
for (const lane of lifelineLanes) {
|
|
10174
|
+
const start = starts.get(lane.id);
|
|
10175
|
+
if (start !== void 0) deepestStart = Math.max(deepestStart, start);
|
|
10176
|
+
}
|
|
10177
|
+
const footerTops = lifelineFooterNodes(lanes, nodes).map((f) => footerShapeDrawTop(f)).filter((top) => top > deepestStart);
|
|
10178
|
+
if (footerTops.length > 0) return Math.min(...footerTops);
|
|
10179
|
+
return lifelineLanes[0] ? lifelineLanes[0].y + lifelineLanes[0].height : 0;
|
|
10180
|
+
}
|
|
9835
10181
|
|
|
9836
10182
|
// src/render/edge-head.ts
|
|
10183
|
+
var EDGE_HEAD_MUTED_MARKER_ID = "cdl-arrow-muted";
|
|
9837
10184
|
var EDGE_HEAD_SHAPE = {
|
|
9838
10185
|
// 何も描かない端。 marker 自体を出さないので `d` は読まれない
|
|
9839
10186
|
none: { d: "", w: 10, h: 10, refX: 0, filled: false },
|
|
@@ -9864,6 +10211,11 @@ function edgeHeadMarkerId(tone, head, small, fill = EDGE_HEAD_FILL_DEFAULT) {
|
|
|
9864
10211
|
const \u5857 = fill === EDGE_HEAD_FILL_DEFAULT || !EDGE_HEAD_SHAPE[head].filled ? "" : `-${fill}`;
|
|
9865
10212
|
return head === EDGE_HEAD_DEFAULT && \u5857 === "" ? `cdl-arrow-${tone}${\u5C0F}` : `cdl-arrow-${tone}-${head}${\u5857}${\u5C0F}`;
|
|
9866
10213
|
}
|
|
10214
|
+
function edgeHeadMarkerName(tone, head, small, fill) {
|
|
10215
|
+
const \u5B9F\u969B\u306E\u5F62 = head ?? EDGE_HEAD_DEFAULT;
|
|
10216
|
+
if (\u5B9F\u969B\u306E\u5F62 === "none") return void 0;
|
|
10217
|
+
return hasTone(tone) ? edgeHeadMarkerId(tone, \u5B9F\u969B\u306E\u5F62, small, fill ?? EDGE_HEAD_FILL_DEFAULT) : EDGE_HEAD_MUTED_MARKER_ID;
|
|
10218
|
+
}
|
|
9867
10219
|
function edgeHeadPaint(head, fill, color) {
|
|
9868
10220
|
const \u5F62 = EDGE_HEAD_SHAPE[head];
|
|
9869
10221
|
if (!\u5F62.filled) return { fill: "none", stroke: color, strokeWidth: 1.6 };
|
|
@@ -9892,13 +10244,8 @@ function CdlEdgeView({
|
|
|
9892
10244
|
stateValues
|
|
9893
10245
|
}) {
|
|
9894
10246
|
const color = edgeColor(edge);
|
|
9895
|
-
const
|
|
9896
|
-
|
|
9897
|
-
if (\u5F62 === "none") return void 0;
|
|
9898
|
-
return hasTone(edge.tone) ? edgeHeadMarkerId(edge.tone, \u5F62, !active, f ?? EDGE_HEAD_FILL_DEFAULT) : "cdl-arrow-muted";
|
|
9899
|
-
};
|
|
9900
|
-
const marker = \u7AEF\u306E\u540D\u524D(edge.head, edge.headFill);
|
|
9901
|
-
const tailMarker = edge.tailHead === void 0 ? void 0 : \u7AEF\u306E\u540D\u524D(edge.tailHead, edge.tailHeadFill);
|
|
10247
|
+
const marker = edgeHeadMarkerName(edge.tone, edge.head, !active, edge.headFill);
|
|
10248
|
+
const tailMarker = edge.tailHead === void 0 ? void 0 : edgeHeadMarkerName(edge.tone, edge.tailHead, !active, edge.tailHeadFill);
|
|
9902
10249
|
const style = edge.style ?? "solid";
|
|
9903
10250
|
const isDotted = style === "dotted-flow";
|
|
9904
10251
|
const isPassThrough = isDotted && Boolean(edge.dThrough);
|
|
@@ -11471,191 +11818,6 @@ function interpolateColor(template, stateValues, fallback) {
|
|
|
11471
11818
|
if (!template) return fallback;
|
|
11472
11819
|
return interpolate(template, stateValues);
|
|
11473
11820
|
}
|
|
11474
|
-
function ChartLineNode({
|
|
11475
|
-
node,
|
|
11476
|
-
active,
|
|
11477
|
-
stateValues = {},
|
|
11478
|
-
drawing = false,
|
|
11479
|
-
progress = 1
|
|
11480
|
-
}) {
|
|
11481
|
-
const x0 = node.cx - node.w / 2;
|
|
11482
|
-
const y0 = node.cy - node.h / 2;
|
|
11483
|
-
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
11484
|
-
const PAD_TOP2 = 36;
|
|
11485
|
-
const PAD_RIGHT2 = 40;
|
|
11486
|
-
const PAD_BOTTOM2 = 56;
|
|
11487
|
-
const PAD_LEFT2 = 72;
|
|
11488
|
-
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
11489
|
-
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
11490
|
-
const values = data.map((d) => d.value);
|
|
11491
|
-
const vMin = values.length > 0 ? Math.min(...values) : 0;
|
|
11492
|
-
const vMax = values.length > 0 ? Math.max(...values) : 1;
|
|
11493
|
-
const vRange = vMax - vMin || 1;
|
|
11494
|
-
const LABEL_ROOM = 20;
|
|
11495
|
-
const plotTop = PAD_TOP2 + LABEL_ROOM;
|
|
11496
|
-
const plotH = Math.max(canvasH - LABEL_ROOM * 2, 1);
|
|
11497
|
-
const xAt = (idx) => PAD_LEFT2 + (data.length <= 1 ? canvasW / 2 : canvasW * idx / (data.length - 1));
|
|
11498
|
-
const yAt = (v) => plotTop + plotH - (v - vMin) / vRange * plotH;
|
|
11499
|
-
const points = data.map((d, idx) => `${xAt(idx)},${yAt(d.value)}`).join(" ");
|
|
11500
|
-
const \u70B9\u307E\u3067\u306E\u9577\u3055 = [];
|
|
11501
|
-
let \u7DDA\u306E\u5168\u9577 = 0;
|
|
11502
|
-
let \u524D\u306E\u70B9;
|
|
11503
|
-
for (const [idx, datum] of data.entries()) {
|
|
11504
|
-
const \u4ECA\u306E\u70B9 = { x: xAt(idx), y: yAt(datum.value) };
|
|
11505
|
-
if (\u524D\u306E\u70B9) {
|
|
11506
|
-
\u7DDA\u306E\u5168\u9577 += Math.hypot(\u4ECA\u306E\u70B9.x - \u524D\u306E\u70B9.x, \u4ECA\u306E\u70B9.y - \u524D\u306E\u70B9.y);
|
|
11507
|
-
}
|
|
11508
|
-
\u70B9\u307E\u3067\u306E\u9577\u3055.push(\u7DDA\u306E\u5168\u9577);
|
|
11509
|
-
\u524D\u306E\u70B9 = \u4ECA\u306E\u70B9;
|
|
11510
|
-
}
|
|
11511
|
-
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
11512
|
-
const \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F = (idx) => {
|
|
11513
|
-
if (!drawing) return true;
|
|
11514
|
-
if (data.length <= 1) return true;
|
|
11515
|
-
if (\u7DDA\u306E\u5168\u9577 === 0) return true;
|
|
11516
|
-
return \u4F38\u3073 >= (\u70B9\u307E\u3067\u306E\u9577\u3055[idx] ?? 0) / \u7DDA\u306E\u5168\u9577;
|
|
11517
|
-
};
|
|
11518
|
-
const gridCount = 4;
|
|
11519
|
-
const gridTicks = Array.from({ length: gridCount + 1 }, (_, i) => {
|
|
11520
|
-
const v = vMin + vRange * i / gridCount;
|
|
11521
|
-
return { y: yAt(v), value: v };
|
|
11522
|
-
});
|
|
11523
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
11524
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11525
|
-
"rect",
|
|
11526
|
-
{
|
|
11527
|
-
"data-cdl-role": "node-body",
|
|
11528
|
-
x: 0,
|
|
11529
|
-
y: 0,
|
|
11530
|
-
width: node.w,
|
|
11531
|
-
height: node.h,
|
|
11532
|
-
rx: 16,
|
|
11533
|
-
fill: "var(--cdl-node-fill, #ffffff)",
|
|
11534
|
-
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
11535
|
-
strokeWidth: active ? 3 : 1.25
|
|
11536
|
-
}
|
|
11537
|
-
),
|
|
11538
|
-
gridTicks.map((t, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
11539
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11540
|
-
"line",
|
|
11541
|
-
{
|
|
11542
|
-
x1: PAD_LEFT2,
|
|
11543
|
-
y1: t.y,
|
|
11544
|
-
x2: PAD_LEFT2 + canvasW,
|
|
11545
|
-
y2: t.y,
|
|
11546
|
-
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
11547
|
-
strokeWidth: 0.75,
|
|
11548
|
-
strokeDasharray: "3 3",
|
|
11549
|
-
opacity: 0.65
|
|
11550
|
-
}
|
|
11551
|
-
),
|
|
11552
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11553
|
-
"text",
|
|
11554
|
-
{
|
|
11555
|
-
x: PAD_LEFT2 - 8,
|
|
11556
|
-
y: t.y + 4,
|
|
11557
|
-
fontSize: 11,
|
|
11558
|
-
textAnchor: "end",
|
|
11559
|
-
fill: "var(--cdl-text-dim, #5a6270)",
|
|
11560
|
-
children: Math.round(t.value)
|
|
11561
|
-
}
|
|
11562
|
-
)
|
|
11563
|
-
] }, `grid-${i}`)),
|
|
11564
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11565
|
-
"line",
|
|
11566
|
-
{
|
|
11567
|
-
x1: PAD_LEFT2,
|
|
11568
|
-
y1: plotTop + plotH,
|
|
11569
|
-
x2: PAD_LEFT2 + canvasW,
|
|
11570
|
-
y2: plotTop + plotH,
|
|
11571
|
-
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
11572
|
-
strokeWidth: 1.25
|
|
11573
|
-
}
|
|
11574
|
-
),
|
|
11575
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11576
|
-
"line",
|
|
11577
|
-
{
|
|
11578
|
-
x1: PAD_LEFT2,
|
|
11579
|
-
y1: plotTop,
|
|
11580
|
-
x2: PAD_LEFT2,
|
|
11581
|
-
y2: plotTop + plotH,
|
|
11582
|
-
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
11583
|
-
strokeWidth: 1.25
|
|
11584
|
-
}
|
|
11585
|
-
),
|
|
11586
|
-
data.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11587
|
-
"polyline",
|
|
11588
|
-
{
|
|
11589
|
-
"data-cdl-role": "chart-line",
|
|
11590
|
-
points,
|
|
11591
|
-
fill: "none",
|
|
11592
|
-
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
11593
|
-
strokeWidth: 2.5,
|
|
11594
|
-
strokeLinejoin: "round",
|
|
11595
|
-
strokeLinecap: "round",
|
|
11596
|
-
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
11597
|
-
}
|
|
11598
|
-
),
|
|
11599
|
-
data.map((d, idx) => {
|
|
11600
|
-
const cx = xAt(idx);
|
|
11601
|
-
const cy = yAt(d.value);
|
|
11602
|
-
const prev = idx > 0 ? data[idx - 1].value : void 0;
|
|
11603
|
-
const next = idx < data.length - 1 ? data[idx + 1].value : void 0;
|
|
11604
|
-
const isValley = (prev === void 0 || d.value <= prev) && (next === void 0 || d.value <= next);
|
|
11605
|
-
const labelAbove = !isValley;
|
|
11606
|
-
const labelY = labelAbove ? cy - 12 : cy + 18;
|
|
11607
|
-
const \u51FA\u3059 = \u7DDA\u306E\u5148\u304C\u5C4A\u3044\u305F(idx);
|
|
11608
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-unresolved": d.unresolved ? "true" : void 0, children: [
|
|
11609
|
-
\u51FA\u3059 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11610
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11611
|
-
"circle",
|
|
11612
|
-
{
|
|
11613
|
-
cx,
|
|
11614
|
-
cy,
|
|
11615
|
-
r: 5,
|
|
11616
|
-
fill: "var(--cdl-node-fill, #ffffff)",
|
|
11617
|
-
stroke: "var(--cdl-tone-accent, #2d6a8f)",
|
|
11618
|
-
strokeWidth: 2.5
|
|
11619
|
-
}
|
|
11620
|
-
),
|
|
11621
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11622
|
-
"circle",
|
|
11623
|
-
{
|
|
11624
|
-
cx,
|
|
11625
|
-
cy,
|
|
11626
|
-
r: 2.5,
|
|
11627
|
-
fill: "var(--cdl-tone-accent, #2d6a8f)"
|
|
11628
|
-
}
|
|
11629
|
-
),
|
|
11630
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11631
|
-
"text",
|
|
11632
|
-
{
|
|
11633
|
-
"data-cdl-role": "chart-line-value",
|
|
11634
|
-
x: cx,
|
|
11635
|
-
y: labelY,
|
|
11636
|
-
fontSize: 11,
|
|
11637
|
-
fontWeight: 600,
|
|
11638
|
-
textAnchor: "middle",
|
|
11639
|
-
fill: "var(--cdl-text, #1a1f2a)",
|
|
11640
|
-
children: d.value.toLocaleString()
|
|
11641
|
-
}
|
|
11642
|
-
)
|
|
11643
|
-
] }),
|
|
11644
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11645
|
-
"text",
|
|
11646
|
-
{
|
|
11647
|
-
x: cx,
|
|
11648
|
-
y: PAD_TOP2 + canvasH + 20,
|
|
11649
|
-
fontSize: 12,
|
|
11650
|
-
textAnchor: "middle",
|
|
11651
|
-
fill: "var(--cdl-text-dim, #5a6270)",
|
|
11652
|
-
children: d.label
|
|
11653
|
-
}
|
|
11654
|
-
)
|
|
11655
|
-
] }, `pt-${idx}`);
|
|
11656
|
-
})
|
|
11657
|
-
] });
|
|
11658
|
-
}
|
|
11659
11821
|
function ChartPieNode({
|
|
11660
11822
|
node,
|
|
11661
11823
|
active,
|
|
@@ -17166,7 +17328,8 @@ function CdlNodeView({
|
|
|
17166
17328
|
drawing = false,
|
|
17167
17329
|
progress,
|
|
17168
17330
|
stateValues,
|
|
17169
|
-
currentPhaseId
|
|
17331
|
+
currentPhaseId,
|
|
17332
|
+
chartLineScale
|
|
17170
17333
|
}) {
|
|
17171
17334
|
const value = node.value ? interpolate(node.value, stateValues) : void 0;
|
|
17172
17335
|
const rows = (node.rows ?? []).map((r) => interpolate(r, stateValues));
|
|
@@ -17222,6 +17385,7 @@ function CdlNodeView({
|
|
|
17222
17385
|
node: resolvedNode,
|
|
17223
17386
|
active,
|
|
17224
17387
|
stateValues,
|
|
17388
|
+
scale: chartLineScale,
|
|
17225
17389
|
drawing,
|
|
17226
17390
|
progress
|
|
17227
17391
|
}
|
|
@@ -17463,44 +17627,6 @@ function CdlNodeView({
|
|
|
17463
17627
|
}
|
|
17464
17628
|
);
|
|
17465
17629
|
}
|
|
17466
|
-
|
|
17467
|
-
// src/layout/lifeline.ts
|
|
17468
|
-
function lifelineStartYs(nodes) {
|
|
17469
|
-
const topmost = /* @__PURE__ */ new Map();
|
|
17470
|
-
for (const n of nodes) {
|
|
17471
|
-
const cur = topmost.get(n.lane);
|
|
17472
|
-
if (cur === void 0 || n.cy < cur.cy) topmost.set(n.lane, n);
|
|
17473
|
-
}
|
|
17474
|
-
const starts = /* @__PURE__ */ new Map();
|
|
17475
|
-
for (const [laneId, n] of topmost) starts.set(laneId, n.cy + n.h / 2);
|
|
17476
|
-
return starts;
|
|
17477
|
-
}
|
|
17478
|
-
function uniformLifelineEndY(lanes, nodes, starts = lifelineStartYs(nodes)) {
|
|
17479
|
-
const lifelineLanes = lanes.filter((l) => l.lifeline);
|
|
17480
|
-
let deepestStart = Number.NEGATIVE_INFINITY;
|
|
17481
|
-
for (const lane of lifelineLanes) {
|
|
17482
|
-
const start = starts.get(lane.id);
|
|
17483
|
-
if (start !== void 0) deepestStart = Math.max(deepestStart, start);
|
|
17484
|
-
}
|
|
17485
|
-
const footerTops = lifelineFooterNodes(lanes, nodes).map((f) => footerShapeDrawTop(f)).filter((top) => top > deepestStart);
|
|
17486
|
-
if (footerTops.length > 0) return Math.min(...footerTops);
|
|
17487
|
-
return lifelineLanes[0] ? lifelineLanes[0].y + lifelineLanes[0].height : 0;
|
|
17488
|
-
}
|
|
17489
|
-
|
|
17490
|
-
// src/kinds/draw-ratio.ts
|
|
17491
|
-
var DRAW_RATIO_DEFAULT = 1;
|
|
17492
|
-
function \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio) {
|
|
17493
|
-
if (ratio === void 0) return DRAW_RATIO_DEFAULT;
|
|
17494
|
-
if (!Number.isFinite(ratio)) return DRAW_RATIO_DEFAULT;
|
|
17495
|
-
if (ratio <= 0 || ratio > 1) return DRAW_RATIO_DEFAULT;
|
|
17496
|
-
return ratio;
|
|
17497
|
-
}
|
|
17498
|
-
function \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, ratio) {
|
|
17499
|
-
const \u5272\u5408 = \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio);
|
|
17500
|
-
if (\u5272\u5408 === DRAW_RATIO_DEFAULT) return progress;
|
|
17501
|
-
if (!Number.isFinite(progress)) return progress;
|
|
17502
|
-
return Math.min(1, progress / \u5272\u5408);
|
|
17503
|
-
}
|
|
17504
17630
|
function CdlStage({
|
|
17505
17631
|
laid,
|
|
17506
17632
|
currentPhase,
|
|
@@ -17542,6 +17668,26 @@ function CdlStage({
|
|
|
17542
17668
|
};
|
|
17543
17669
|
}, [laid.phases, currentPhase, laid.edgeReveal]);
|
|
17544
17670
|
const drawSet = new Set(currentPhase?.draw ?? []);
|
|
17671
|
+
const chartLineScales = react.useMemo(() => {
|
|
17672
|
+
const nodes = laid.nodes.filter((node) => node.kind === "chart-line");
|
|
17673
|
+
if (nodes.length === 0) return /* @__PURE__ */ new Map();
|
|
17674
|
+
const frames = [
|
|
17675
|
+
// phase index -1 はどの段にも入る前の初期値。
|
|
17676
|
+
computeStateValues(laid, -1, 0),
|
|
17677
|
+
...laid.phases.flatMap((_, phaseIndex) => [
|
|
17678
|
+
computeStateValues(laid, phaseIndex, 0),
|
|
17679
|
+
computeStateValues(laid, phaseIndex, 1)
|
|
17680
|
+
])
|
|
17681
|
+
];
|
|
17682
|
+
const scales = /* @__PURE__ */ new Map();
|
|
17683
|
+
for (const node of nodes) {
|
|
17684
|
+
const values = frames.flatMap(
|
|
17685
|
+
(stateValues2) => resolveChartData(node.chartData ?? [], stateValues2).map((datum) => datum.value)
|
|
17686
|
+
);
|
|
17687
|
+
scales.set(node.id, \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values));
|
|
17688
|
+
}
|
|
17689
|
+
return scales;
|
|
17690
|
+
}, [laid]);
|
|
17545
17691
|
const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
|
|
17546
17692
|
const { lifelineStarts, uniformFooterTop } = react.useMemo(() => {
|
|
17547
17693
|
const starts = lifelineStartYs(laid.nodes);
|
|
@@ -17550,6 +17696,63 @@ function CdlStage({
|
|
|
17550
17696
|
uniformFooterTop: uniformLifelineEndY(laid.lanes, laid.nodes, starts)
|
|
17551
17697
|
};
|
|
17552
17698
|
}, [laid]);
|
|
17699
|
+
const edgeHeadMarkers = react.useMemo(() => {
|
|
17700
|
+
const referenced = /* @__PURE__ */ new Set();
|
|
17701
|
+
const add = (tone, head, fill) => {
|
|
17702
|
+
for (const small of [false, true]) {
|
|
17703
|
+
const id = edgeHeadMarkerName(tone, head, small, fill);
|
|
17704
|
+
if (id !== void 0) referenced.add(id);
|
|
17705
|
+
}
|
|
17706
|
+
};
|
|
17707
|
+
for (const edge of laid.edges) {
|
|
17708
|
+
add(edge.tone, edge.head, edge.headFill);
|
|
17709
|
+
if (edge.tailHead !== void 0) add(edge.tone, edge.tailHead, edge.tailHeadFill);
|
|
17710
|
+
}
|
|
17711
|
+
return Object.entries(TONE).flatMap(
|
|
17712
|
+
([tone, color]) => [
|
|
17713
|
+
[false, 14],
|
|
17714
|
+
[true, 10]
|
|
17715
|
+
].flatMap(
|
|
17716
|
+
([small, size]) => EDGE_HEADS.flatMap(
|
|
17717
|
+
(head) => EDGE_HEAD_FILLS.map((fill) => {
|
|
17718
|
+
const \u5F62 = EDGE_HEAD_SHAPE[head];
|
|
17719
|
+
const id = edgeHeadMarkerId(tone, head, small, fill);
|
|
17720
|
+
if (!referenced.has(id) || \u5F62.d === "") return null;
|
|
17721
|
+
if (fill !== EDGE_HEAD_FILL_DEFAULT && !\u5F62.filled) return null;
|
|
17722
|
+
const \u5857 = edgeHeadPaint(head, fill, color);
|
|
17723
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17724
|
+
"marker",
|
|
17725
|
+
{
|
|
17726
|
+
id,
|
|
17727
|
+
viewBox: `0 0 ${\u5F62.w} ${\u5F62.h}`,
|
|
17728
|
+
refX: \u5F62.refX,
|
|
17729
|
+
refY: \u5F62.h / 2,
|
|
17730
|
+
markerWidth: size * (\u5F62.scale ?? 1) * \u5F62.w / \u5F62.h,
|
|
17731
|
+
markerHeight: size * (\u5F62.scale ?? 1),
|
|
17732
|
+
markerUnits: "userSpaceOnUse",
|
|
17733
|
+
orient: "auto-start-reverse",
|
|
17734
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17735
|
+
"path",
|
|
17736
|
+
{
|
|
17737
|
+
"data-cdl-role": "edge-arrowhead",
|
|
17738
|
+
"data-cdl-edge-head": head,
|
|
17739
|
+
"data-cdl-edge-head-fill": fill,
|
|
17740
|
+
d: \u5F62.d,
|
|
17741
|
+
fill: \u5857.fill,
|
|
17742
|
+
stroke: \u5857.stroke,
|
|
17743
|
+
strokeWidth: \u5857.strokeWidth,
|
|
17744
|
+
strokeLinecap: \u5857.strokeWidth === void 0 ? void 0 : "round",
|
|
17745
|
+
strokeLinejoin: \u5857.strokeWidth === void 0 ? void 0 : "round"
|
|
17746
|
+
}
|
|
17747
|
+
)
|
|
17748
|
+
},
|
|
17749
|
+
id
|
|
17750
|
+
);
|
|
17751
|
+
})
|
|
17752
|
+
)
|
|
17753
|
+
)
|
|
17754
|
+
);
|
|
17755
|
+
}, [laid]);
|
|
17553
17756
|
const diagramScale = laid.diagramScale ?? 1;
|
|
17554
17757
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: compact ? "px-3 py-3" : "px-6 py-6", style: compact ? void 0 : { minHeight: 460 }, children: [
|
|
17555
17758
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -17568,55 +17771,11 @@ function CdlStage({
|
|
|
17568
17771
|
"data-cdl-type": laid.type,
|
|
17569
17772
|
children: [
|
|
17570
17773
|
/* @__PURE__ */ jsxRuntime.jsxs("defs", { children: [
|
|
17571
|
-
|
|
17572
|
-
([tone, color]) => [["", 14], ["-sm", 10]].flatMap(
|
|
17573
|
-
([suffix, size]) => EDGE_HEADS.flatMap(
|
|
17574
|
-
(head) => (
|
|
17575
|
-
// 塗り方は形と別の軸 (#578)。 塗らない形では 2 つが同じ名前に畳まれるので、
|
|
17576
|
-
// `edgeHeadMarkerId` が返す名前で重複を外す
|
|
17577
|
-
EDGE_HEAD_FILLS.map((fill) => {
|
|
17578
|
-
const \u5F62 = EDGE_HEAD_SHAPE[head];
|
|
17579
|
-
const id = edgeHeadMarkerId(tone, head, suffix === "-sm", fill);
|
|
17580
|
-
if (\u5F62.d === "") return null;
|
|
17581
|
-
if (fill !== EDGE_HEAD_FILL_DEFAULT && !\u5F62.filled) return null;
|
|
17582
|
-
const \u5857 = edgeHeadPaint(head, fill, color);
|
|
17583
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
17584
|
-
"marker",
|
|
17585
|
-
{
|
|
17586
|
-
id,
|
|
17587
|
-
viewBox: `0 0 ${\u5F62.w} ${\u5F62.h}`,
|
|
17588
|
-
refX: \u5F62.refX,
|
|
17589
|
-
refY: \u5F62.h / 2,
|
|
17590
|
-
markerWidth: size * (\u5F62.scale ?? 1) * \u5F62.w / \u5F62.h,
|
|
17591
|
-
markerHeight: size * (\u5F62.scale ?? 1),
|
|
17592
|
-
markerUnits: "userSpaceOnUse",
|
|
17593
|
-
orient: "auto-start-reverse",
|
|
17594
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17595
|
-
"path",
|
|
17596
|
-
{
|
|
17597
|
-
"data-cdl-role": "edge-arrowhead",
|
|
17598
|
-
"data-cdl-edge-head": head,
|
|
17599
|
-
"data-cdl-edge-head-fill": fill,
|
|
17600
|
-
d: \u5F62.d,
|
|
17601
|
-
fill: \u5857.fill,
|
|
17602
|
-
stroke: \u5857.stroke,
|
|
17603
|
-
strokeWidth: \u5857.strokeWidth,
|
|
17604
|
-
strokeLinecap: \u5857.strokeWidth === void 0 ? void 0 : "round",
|
|
17605
|
-
strokeLinejoin: \u5857.strokeWidth === void 0 ? void 0 : "round"
|
|
17606
|
-
}
|
|
17607
|
-
)
|
|
17608
|
-
},
|
|
17609
|
-
id
|
|
17610
|
-
);
|
|
17611
|
-
})
|
|
17612
|
-
)
|
|
17613
|
-
)
|
|
17614
|
-
)
|
|
17615
|
-
),
|
|
17774
|
+
edgeHeadMarkers,
|
|
17616
17775
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17617
17776
|
"marker",
|
|
17618
17777
|
{
|
|
17619
|
-
id:
|
|
17778
|
+
id: EDGE_HEAD_MUTED_MARKER_ID,
|
|
17620
17779
|
viewBox: "0 0 10 10",
|
|
17621
17780
|
refX: "9",
|
|
17622
17781
|
refY: "5",
|
|
@@ -17723,7 +17882,8 @@ function CdlStage({
|
|
|
17723
17882
|
drawing: \u63CF\u304F,
|
|
17724
17883
|
progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
|
|
17725
17884
|
stateValues,
|
|
17726
|
-
currentPhaseId: currentPhase?.id
|
|
17885
|
+
currentPhaseId: currentPhase?.id,
|
|
17886
|
+
chartLineScale: chartLineScales.get(node.id)
|
|
17727
17887
|
}
|
|
17728
17888
|
);
|
|
17729
17889
|
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: view }, node.id);
|