@cardenelabs/cdl 0.13.1 → 0.15.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 +250 -1
- package/README.md +20 -1
- package/dist/index.cjs +2912 -1723
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -6
- package/dist/index.d.ts +25 -6
- package/dist/index.js +2911 -1724
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +1395 -230
- 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 +1395 -230
- package/dist/react.js.map +1 -1
- package/dist/{render-B5JHcUrb.d.cts → render-BS1E6Mlo.d.cts} +55 -2
- package/dist/{render-B5JHcUrb.d.ts → render-BS1E6Mlo.d.ts} +55 -2
- package/package.json +1 -1
- package/src/builder.ts +24 -0
- package/src/index.ts +2 -1
- package/src/kinds/chart-gauge.tsx +241 -0
- package/src/kinds/chart-pie.tsx +214 -53
- package/src/kinds/chart-radial.tsx +210 -0
- package/src/kinds/chart-stacked-bar.tsx +272 -0
- package/src/kinds/chart-stat.tsx +231 -0
- package/src/kinds/chart-waffle.tsx +197 -0
- package/src/kinds/draw-ratio.ts +44 -0
- package/src/kinds/dyn-shape.tsx +3 -6
- package/src/kinds/generic.tsx +18 -6
- package/src/kinds/mind-map.tsx +52 -22
- package/src/kinds/terminal-mark.tsx +96 -0
- package/src/kinds/tree.tsx +51 -21
- package/src/layout/edges.ts +30 -1
- package/src/layout/self-loop.ts +217 -0
- package/src/layout/spec.ts +81 -4
- package/src/layout/tokens.ts +15 -0
- package/src/presets.ts +33 -3
- package/src/render/edge-head.ts +45 -0
- package/src/render/edges.tsx +4 -2
- package/src/render/interactive-panel.tsx +2 -2
- package/src/render/nodes.tsx +25 -0
- package/src/render/payload-binding.ts +14 -3
- package/src/render/stage.tsx +41 -18
- package/src/render/tone.ts +52 -0
- package/src/types.ts +66 -2
- package/src/validate.ts +13 -5
- package/src/visual-validate.ts +137 -4
package/dist/react.js
CHANGED
|
@@ -569,12 +569,20 @@ var KINDS_WITHOUT_TITLE_TEXT = /* @__PURE__ */ new Set([
|
|
|
569
569
|
"chart-pie",
|
|
570
570
|
"chart-line",
|
|
571
571
|
"chart-bar",
|
|
572
|
+
"chart-gauge",
|
|
573
|
+
"chart-radial",
|
|
574
|
+
"chart-stat",
|
|
575
|
+
"chart-waffle",
|
|
576
|
+
"chart-stacked-bar",
|
|
572
577
|
"gantt-timeline",
|
|
573
578
|
"mind-map",
|
|
574
579
|
"funnel-stages",
|
|
575
580
|
"quadrant-matrix",
|
|
576
581
|
"tree-hierarchy",
|
|
577
|
-
"journey-map"
|
|
582
|
+
"journey-map",
|
|
583
|
+
// 印そのものが意味を持つ (#560)
|
|
584
|
+
"mark-start",
|
|
585
|
+
"mark-end"
|
|
578
586
|
]);
|
|
579
587
|
function rendersTitleText(kind) {
|
|
580
588
|
return !KINDS_WITHOUT_TITLE_TEXT.has(kind ?? "");
|
|
@@ -614,19 +622,36 @@ function rendersRows(kind) {
|
|
|
614
622
|
}
|
|
615
623
|
function rowBaselineY(kind, index) {
|
|
616
624
|
if (!rendersRows(kind)) return null;
|
|
617
|
-
return kind === "storage" ? ROW_TOP_STORAGE + index * ROW_PITCH_STORAGE : ROW_TOP_GENERIC + index * ROW_PITCH_GENERIC;
|
|
625
|
+
return kind === "storage" ? ROW_TOP_STORAGE + index * ROW_PITCH_STORAGE : ROW_TOP_GENERIC + genericTextShift(kind) + index * ROW_PITCH_GENERIC;
|
|
626
|
+
}
|
|
627
|
+
function genericTextShift(kind) {
|
|
628
|
+
return KINDS_SHAPE_CYLINDER.has(kind ?? "") ? GENERIC_TEXT_SHIFT_CYLINDER : 0;
|
|
629
|
+
}
|
|
630
|
+
var KINDS_SHAPE_CYLINDER = /* @__PURE__ */ new Set(["database"]);
|
|
631
|
+
var KINDS_TEXT_CENTERED = /* @__PURE__ */ new Set(["cloud", "decision"]);
|
|
632
|
+
function genericTextCentered(kind, hasRows) {
|
|
633
|
+
return !hasRows && KINDS_TEXT_CENTERED.has(kind ?? "");
|
|
634
|
+
}
|
|
635
|
+
function genericTitleBaselineY(kind, h, hasRows) {
|
|
636
|
+
return genericTextCentered(kind, hasRows) ? h / 2 + GENERIC_TITLE_CENTER_OFFSET : GENERIC_TITLE_TOP + genericTextShift(kind);
|
|
618
637
|
}
|
|
619
638
|
var ROW_TOP_STORAGE = 130;
|
|
620
639
|
var ROW_PITCH_STORAGE = 56;
|
|
621
640
|
var ROW_TOP_GENERIC = 100;
|
|
622
641
|
var ROW_PITCH_GENERIC = 28;
|
|
642
|
+
var GENERIC_TEXT_SHIFT_CYLINDER = 28;
|
|
643
|
+
var GENERIC_TITLE_TOP = 68;
|
|
644
|
+
var GENERIC_TITLE_CENTER_OFFSET = 4;
|
|
645
|
+
var GENERIC_TITLE_FONT = 20;
|
|
646
|
+
var GLYPH_CAP_RATIO = 0.72;
|
|
623
647
|
var ROW_FONT_STORAGE = 26;
|
|
624
648
|
var ROW_FONT_GENERIC = 21;
|
|
625
649
|
var STORAGE_TITLE_BASELINE = 78;
|
|
626
650
|
var STORAGE_ROW_DIVIDER_Y = Math.round(
|
|
627
|
-
(STORAGE_TITLE_BASELINE + (ROW_TOP_STORAGE - ROW_FONT_STORAGE *
|
|
651
|
+
(STORAGE_TITLE_BASELINE + (ROW_TOP_STORAGE - ROW_FONT_STORAGE * GLYPH_CAP_RATIO)) / 2
|
|
628
652
|
);
|
|
629
653
|
var ROW_GLYPH_DEPTH_RATIO = 0.4;
|
|
654
|
+
var TITLE_ROW_MIN_GAP = GENERIC_TITLE_FONT * ROW_GLYPH_DEPTH_RATIO + ROW_FONT_GENERIC * GLYPH_CAP_RATIO;
|
|
630
655
|
function rowGlyphDepth(kind) {
|
|
631
656
|
if (!rendersRows(kind)) return null;
|
|
632
657
|
const font = kind === "storage" ? ROW_FONT_STORAGE : ROW_FONT_GENERIC;
|
|
@@ -1820,6 +1845,108 @@ function applyEdgeLabelAndPathShifts(edges, labelShiftMap, edgePathShiftMap) {
|
|
|
1820
1845
|
});
|
|
1821
1846
|
}
|
|
1822
1847
|
|
|
1848
|
+
// src/layout/self-loop.ts
|
|
1849
|
+
var SELF_LOOP_OUT = 72;
|
|
1850
|
+
var SELF_LOOP_SPAN = 64;
|
|
1851
|
+
var SELF_LOOP_STAGGER = 45;
|
|
1852
|
+
var SELF_LOOP_SIDE_ORDER = ["right", "top", "left", "bottom"];
|
|
1853
|
+
var SELF_LOOP_SIDE_FALLBACK = "right";
|
|
1854
|
+
var CUBIC_APEX_RATIO = 0.75;
|
|
1855
|
+
var ENDPOINT_CENTER_MARGIN = 8;
|
|
1856
|
+
var SPAN_MIN = 8;
|
|
1857
|
+
function controlOffset(out) {
|
|
1858
|
+
return out / CUBIC_APEX_RATIO;
|
|
1859
|
+
}
|
|
1860
|
+
function sideGeometry(n, side) {
|
|
1861
|
+
switch (side) {
|
|
1862
|
+
case "right":
|
|
1863
|
+
return { x: n.cx + n.w / 2, y: n.cy, ux: 1, uy: 0 };
|
|
1864
|
+
case "left":
|
|
1865
|
+
return { x: n.cx - n.w / 2, y: n.cy, ux: -1, uy: 0 };
|
|
1866
|
+
case "top":
|
|
1867
|
+
return { x: n.cx, y: n.cy - n.h / 2, ux: 0, uy: -1 };
|
|
1868
|
+
case "bottom":
|
|
1869
|
+
return { x: n.cx, y: n.cy + n.h / 2, ux: 0, uy: 1 };
|
|
1870
|
+
}
|
|
1871
|
+
}
|
|
1872
|
+
function fitSpan(sideLength, wanted) {
|
|
1873
|
+
const \u9650\u5EA6 = sideLength - 2 * ENDPOINT_CENTER_MARGIN;
|
|
1874
|
+
return Math.max(SPAN_MIN, Math.min(wanted, \u9650\u5EA6));
|
|
1875
|
+
}
|
|
1876
|
+
function pickFreeSides(occupied, count) {
|
|
1877
|
+
const \u7A7A\u304D = SELF_LOOP_SIDE_ORDER.filter((s) => !occupied?.has(s));
|
|
1878
|
+
const \u4F7F\u3046 = \u7A7A\u304D.length > 0 ? \u7A7A\u304D : [SELF_LOOP_SIDE_FALLBACK];
|
|
1879
|
+
return Array.from({ length: count }, (_, i) => \u4F7F\u3046[i % \u4F7F\u3046.length]);
|
|
1880
|
+
}
|
|
1881
|
+
function routeSelfLoopGroup(edges, node, side) {
|
|
1882
|
+
const horizontal = side === "left" || side === "right";
|
|
1883
|
+
const g = sideGeometry(node, side);
|
|
1884
|
+
const span = fitSpan(horizontal ? node.h : node.w, SELF_LOOP_SPAN);
|
|
1885
|
+
const half = span / 2;
|
|
1886
|
+
const \u6CBF = horizontal ? { x: 0, y: 1 } : { x: 1, y: 0 };
|
|
1887
|
+
const \u6700\u5916 = controlOffset(SELF_LOOP_OUT + (edges.length - 1) * SELF_LOOP_STAGGER);
|
|
1888
|
+
const \u8A9E\u307E\u3067 = \u6700\u5916 + LABEL_TO_PATH_CLEARANCE;
|
|
1889
|
+
const \u8A9E\u5E45 = edges.map(
|
|
1890
|
+
(e) => horizontal ? labelPillH(e.sub) : computeLabelBoxW(e.label, e.sub)
|
|
1891
|
+
);
|
|
1892
|
+
const \u4F4D\u7F6E = [];
|
|
1893
|
+
let \u7A4D = 0;
|
|
1894
|
+
for (const w of \u8A9E\u5E45) {
|
|
1895
|
+
\u4F4D\u7F6E.push(\u7A4D + w / 2);
|
|
1896
|
+
\u7A4D += w + CLEARANCE_LABEL_LABEL;
|
|
1897
|
+
}
|
|
1898
|
+
const \u5168\u9577 = Math.max(0, \u7A4D - CLEARANCE_LABEL_LABEL);
|
|
1899
|
+
return edges.map((edge, index) => {
|
|
1900
|
+
const c = controlOffset(SELF_LOOP_OUT + index * SELF_LOOP_STAGGER);
|
|
1901
|
+
const x1 = g.x - \u6CBF.x * half;
|
|
1902
|
+
const y1 = g.y - \u6CBF.y * half;
|
|
1903
|
+
const x2 = g.x + \u6CBF.x * half;
|
|
1904
|
+
const y2 = g.y + \u6CBF.y * half;
|
|
1905
|
+
const \u305A\u308C = \u4F4D\u7F6E[index] - \u5168\u9577 / 2;
|
|
1906
|
+
return {
|
|
1907
|
+
...edge,
|
|
1908
|
+
d: `M ${x1} ${y1} C ${x1 + g.ux * c} ${y1 + g.uy * c} ${x2 + g.ux * c} ${y2 + g.uy * c} ${x2} ${y2}`,
|
|
1909
|
+
fromSide: side,
|
|
1910
|
+
toSide: side,
|
|
1911
|
+
labelX: g.x + g.ux * \u8A9E\u307E\u3067 + \u6CBF.x * \u305A\u308C + (edge.labelOffsetX ?? 0),
|
|
1912
|
+
labelY: g.y + g.uy * \u8A9E\u307E\u3067 + \u6CBF.y * \u305A\u308C + (edge.labelOffsetY ?? 0),
|
|
1913
|
+
labelAnchor: side === "left" ? "end" : side === "right" ? "start" : "middle"
|
|
1914
|
+
};
|
|
1915
|
+
});
|
|
1916
|
+
}
|
|
1917
|
+
function isSelfLoop(e) {
|
|
1918
|
+
return e.from === e.to;
|
|
1919
|
+
}
|
|
1920
|
+
function layoutSelfLoops(edges, nodes, occupiedBySide) {
|
|
1921
|
+
const \u5272\u5F53 = /* @__PURE__ */ new Map();
|
|
1922
|
+
for (const edge of edges) {
|
|
1923
|
+
if (edge.side) continue;
|
|
1924
|
+
const list = \u5272\u5F53.get(edge.from) ?? [];
|
|
1925
|
+
list.push("right");
|
|
1926
|
+
\u5272\u5F53.set(edge.from, list);
|
|
1927
|
+
}
|
|
1928
|
+
for (const [nodeId, list] of \u5272\u5F53) {
|
|
1929
|
+
\u5272\u5F53.set(nodeId, pickFreeSides(occupiedBySide.get(nodeId), list.length));
|
|
1930
|
+
}
|
|
1931
|
+
const \u6D88\u8CBB = /* @__PURE__ */ new Map();
|
|
1932
|
+
const \u675F = /* @__PURE__ */ new Map();
|
|
1933
|
+
for (const edge of edges) {
|
|
1934
|
+
const node = nodes.get(edge.from);
|
|
1935
|
+
if (!node) throw new Error(`cdl layout: edge "${edge.id}" \u306E from "${edge.from}" \u304C node \u306B\u7121\u3044`);
|
|
1936
|
+
let side = edge.side;
|
|
1937
|
+
if (!side) {
|
|
1938
|
+
const i = \u6D88\u8CBB.get(edge.from) ?? 0;
|
|
1939
|
+
\u6D88\u8CBB.set(edge.from, i + 1);
|
|
1940
|
+
side = \u5272\u5F53.get(edge.from)[i];
|
|
1941
|
+
}
|
|
1942
|
+
const key = `${edge.from}::${side}`;
|
|
1943
|
+
const \u65E2 = \u675F.get(key);
|
|
1944
|
+
if (\u65E2) \u65E2.edges.push(edge);
|
|
1945
|
+
else \u675F.set(key, { node, side, edges: [edge] });
|
|
1946
|
+
}
|
|
1947
|
+
return [...\u675F.values()].flatMap((b) => routeSelfLoopGroup(b.edges, b.node, b.side));
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1823
1950
|
// src/layout/tokens.ts
|
|
1824
1951
|
var TOKENS = {
|
|
1825
1952
|
// viewBox / lane margins
|
|
@@ -1865,6 +1992,16 @@ var TOKENS = {
|
|
|
1865
1992
|
"chart-line": { w: 640, h: 360 },
|
|
1866
1993
|
"chart-pie": { w: 640, h: 320 },
|
|
1867
1994
|
"chart-bar": { w: 640, h: 360 },
|
|
1995
|
+
// 上半分の弧 + 下段の内訳。 弧が浅いぶん pie より低くて済む (cdl#549)
|
|
1996
|
+
"chart-gauge": { w: 640, h: 320 },
|
|
1997
|
+
// 左に一覧 + 右に同心の弧。 件数ぶん内側へ重なるので pie と同じ高さを取る (cdl#550)
|
|
1998
|
+
"chart-radial": { w: 640, h: 320 },
|
|
1999
|
+
// 件ごとに区画を割り、名前 / 数値 / 弧 / 割合 を縦に積む。 数値を大きく組むので縦が要る (cdl#553)
|
|
2000
|
+
"chart-stat": { w: 640, h: 320 },
|
|
2001
|
+
// 左に一覧 + 右に 10x10 の格子。 格子が正方形なので pie と同じ高さで足りる (cdl#552)
|
|
2002
|
+
"chart-waffle": { w: 640, h: 320 },
|
|
2003
|
+
// 帯を最大 2 本 + 下に一覧。 縦は帯 2 本ぶんで足りる (cdl#551)
|
|
2004
|
+
"chart-stacked-bar": { w: 640, h: 320 },
|
|
1868
2005
|
// Timeline / Mind 系 (CAR-994 Phase B)
|
|
1869
2006
|
"gantt-timeline": { w: 720, h: 360 },
|
|
1870
2007
|
"mind-map": { w: 720, h: 480 },
|
|
@@ -1935,7 +2072,12 @@ var TOKENS = {
|
|
|
1935
2072
|
"shape-notary": { w: 280, h: 320 },
|
|
1936
2073
|
"shape-lawyer": { w: 280, h: 300 },
|
|
1937
2074
|
"shape-trader": { w: 300, h: 300 },
|
|
1938
|
-
"shape-customer-service": { w: 320, h: 300 }
|
|
2075
|
+
"shape-customer-service": { w: 320, h: 300 },
|
|
2076
|
+
// 流れの始まりと終わりの印 2 種 (#560) ... 正方形にして丸が縦横どちらにも歪まないようにする。
|
|
2077
|
+
// 印は箱いっぱいに描く (線が箱の縁で止まるため) ので、この値が丸の直径になる。
|
|
2078
|
+
// 箱としての最小 (80x40) より大きく、名前を持つ箱 (card 320x150) よりは明らかに小さい
|
|
2079
|
+
"mark-start": { w: 96, h: 96 },
|
|
2080
|
+
"mark-end": { w: 96, h: 96 }
|
|
1939
2081
|
},
|
|
1940
2082
|
// row gap (stack 間の vertical gap、 lane 内 / 跨ぎ共通)
|
|
1941
2083
|
// edge label が node の上 36 px に配置されるため、 boxH 68 + 36 + 余裕 = 100 必要。
|
|
@@ -2008,6 +2150,7 @@ function layoutEdges(diag, nodes, lanes = []) {
|
|
|
2008
2150
|
const lmap = new Map(lanes.map((l) => [l.id, l]));
|
|
2009
2151
|
const positionedEdges = [];
|
|
2010
2152
|
const autoEdges = [];
|
|
2153
|
+
const selfLoopEdges = [];
|
|
2011
2154
|
for (const e of diag.edges) {
|
|
2012
2155
|
if (e.posX1 !== void 0 && e.posY1 !== void 0 && e.posX2 !== void 0 && e.posY2 !== void 0) {
|
|
2013
2156
|
const from = nmap.get(e.from);
|
|
@@ -2026,6 +2169,8 @@ function layoutEdges(diag, nodes, lanes = []) {
|
|
|
2026
2169
|
labelY: midY + (e.labelOffsetY ?? 0),
|
|
2027
2170
|
labelAnchor: "middle"
|
|
2028
2171
|
});
|
|
2172
|
+
} else if (isSelfLoop(e)) {
|
|
2173
|
+
selfLoopEdges.push(e);
|
|
2029
2174
|
} else {
|
|
2030
2175
|
autoEdges.push(e);
|
|
2031
2176
|
}
|
|
@@ -2049,6 +2194,22 @@ function layoutEdges(diag, nodes, lanes = []) {
|
|
|
2049
2194
|
if (list.length <= 1) continue;
|
|
2050
2195
|
distributeBySides(list);
|
|
2051
2196
|
}
|
|
2197
|
+
const occupiedBySide = /* @__PURE__ */ new Map();
|
|
2198
|
+
const \u4F7F\u3046 = (nodeId, side) => {
|
|
2199
|
+
const s = occupiedBySide.get(nodeId) ?? /* @__PURE__ */ new Set();
|
|
2200
|
+
s.add(side);
|
|
2201
|
+
occupiedBySide.set(nodeId, s);
|
|
2202
|
+
};
|
|
2203
|
+
for (const p of prepared) {
|
|
2204
|
+
const backDetour = p.e.routing === "back-detour";
|
|
2205
|
+
\u4F7F\u3046(p.e.from, backDetour ? "top" : p.fromSide);
|
|
2206
|
+
\u4F7F\u3046(p.e.to, backDetour ? "top" : p.toSide);
|
|
2207
|
+
}
|
|
2208
|
+
for (const le of positionedEdges) {
|
|
2209
|
+
\u4F7F\u3046(le.from, le.fromSide);
|
|
2210
|
+
\u4F7F\u3046(le.to, le.toSide);
|
|
2211
|
+
}
|
|
2212
|
+
const loopEdges = layoutSelfLoops(selfLoopEdges, nmap, occupiedBySide);
|
|
2052
2213
|
const labelOffsetsByEdgeId = /* @__PURE__ */ new Map();
|
|
2053
2214
|
const parallelKey = (p) => p.e.from < p.e.to ? `${p.e.from}::${p.e.to}` : `${p.e.to}::${p.e.from}`;
|
|
2054
2215
|
const byParallel = /* @__PURE__ */ new Map();
|
|
@@ -2547,6 +2708,7 @@ function layoutEdges(diag, nodes, lanes = []) {
|
|
|
2547
2708
|
});
|
|
2548
2709
|
const laidById = /* @__PURE__ */ new Map();
|
|
2549
2710
|
for (const le of autoResults) laidById.set(le.id, le);
|
|
2711
|
+
for (const le of loopEdges) laidById.set(le.id, le);
|
|
2550
2712
|
for (const le of positionedEdges) laidById.set(le.id, le);
|
|
2551
2713
|
return diag.edges.map((e) => laidById.get(e.id)).filter((e) => e !== void 0);
|
|
2552
2714
|
}
|
|
@@ -3914,10 +4076,19 @@ var NODE_KINDS = [
|
|
|
3914
4076
|
"oracle",
|
|
3915
4077
|
"merkle-tree",
|
|
3916
4078
|
"decision",
|
|
3917
|
-
// Chart 系 (
|
|
4079
|
+
// Chart 系 (5) ... 1 node に datum 配列を持ち、 kind 内で全 datum を SVG 描画。
|
|
4080
|
+
// chart-gauge は合計を主役に置く形 (cdl#549)、 chart-radial は弧の長さで比べる形 (cdl#550)、
|
|
4081
|
+
// chart-stat は数値そのものを主役に置く形 (cdl#553)
|
|
4082
|
+
// chart-waffle は 100 個の印で割合を数えて確かめる形 (cdl#552)
|
|
3918
4083
|
"chart-pie",
|
|
3919
4084
|
"chart-line",
|
|
3920
4085
|
"chart-bar",
|
|
4086
|
+
"chart-gauge",
|
|
4087
|
+
"chart-radial",
|
|
4088
|
+
"chart-stat",
|
|
4089
|
+
// chart-stacked-bar は帯を割合で区切り時点を並べる形 (cdl#551)
|
|
4090
|
+
"chart-waffle",
|
|
4091
|
+
"chart-stacked-bar",
|
|
3921
4092
|
// Timeline / Mind 系 (2、 CAR-994 Phase B) ... 1 node に payload 配列、 SVG geometry render
|
|
3922
4093
|
"gantt-timeline",
|
|
3923
4094
|
"mind-map",
|
|
@@ -3984,8 +4155,14 @@ var NODE_KINDS = [
|
|
|
3984
4155
|
"shape-notary",
|
|
3985
4156
|
"shape-lawyer",
|
|
3986
4157
|
"shape-trader",
|
|
3987
|
-
"shape-customer-service"
|
|
4158
|
+
"shape-customer-service",
|
|
4159
|
+
// 流れの始まりと終わりの印 2 種 (#560) ... 塗った丸と輪で囲んだ丸。
|
|
4160
|
+
// 状態遷移図が使う。 印そのものが意味を持つので文字は描かない
|
|
4161
|
+
"mark-start",
|
|
4162
|
+
"mark-end"
|
|
3988
4163
|
];
|
|
4164
|
+
var EDGE_HEAD_DEFAULT = "triangle";
|
|
4165
|
+
var EDGE_HEADS = ["triangle", "diamond", "open", "crow"];
|
|
3989
4166
|
|
|
3990
4167
|
// src/formula/evaluator.ts
|
|
3991
4168
|
function evaluate(ast, ctxOrResolver) {
|
|
@@ -4993,12 +5170,6 @@ function validate(diag) {
|
|
|
4993
5170
|
\u2192 \u4FEE\u6B63\u4F8B: .node("${e.to}", { lane: "...", stack: 0, kind: "...", title: "..." }) \u3092 edge \u5BA3\u8A00\u524D\u306B\u8FFD\u52A0`
|
|
4994
5171
|
);
|
|
4995
5172
|
}
|
|
4996
|
-
if (e.from === e.to) {
|
|
4997
|
-
errors.push(
|
|
4998
|
-
`[cdl] self-loop: edge "${e.id}" \u306E from \u3068 to \u304C\u540C\u3058 node "${e.from}" \u3067\u3059 (self-loop \u306F\u73FE\u72B6\u672A\u5BFE\u5FDC)
|
|
4999
|
-
\u2192 \u5225 node \u3092\u4F5C\u3063\u3066 2 \u6BB5\u306B\u5206\u3051\u308B\u304B\u3001 \u5F8C\u7D9A PR \u306E self-loop support \u3092\u5F85\u3063\u3066\u304F\u3060\u3055\u3044`
|
|
5000
|
-
);
|
|
5001
|
-
}
|
|
5002
5173
|
}
|
|
5003
5174
|
for (const p of diag.phases) {
|
|
5004
5175
|
for (const id of p.activate) {
|
|
@@ -5018,6 +5189,17 @@ function validate(diag) {
|
|
|
5018
5189
|
);
|
|
5019
5190
|
}
|
|
5020
5191
|
}
|
|
5192
|
+
if (p.drawRatio !== void 0) {
|
|
5193
|
+
if (!Number.isFinite(p.drawRatio) || p.drawRatio <= 0 || p.drawRatio > 1) {
|
|
5194
|
+
warnings.push(
|
|
5195
|
+
`phase "${p.id}" \u306E drawRatio ${p.drawRatio} \u306F\u7BC4\u56F2\u5916 (0 \u3088\u308A\u5927\u304D\u304F 1 \u4EE5\u4E0B)\u3002 1 \u3068\u3057\u3066\u6271\u3046`
|
|
5196
|
+
);
|
|
5197
|
+
} else if ((p.draw ?? []).length === 0) {
|
|
5198
|
+
warnings.push(
|
|
5199
|
+
`phase "${p.id}" \u306F drawRatio \u3092\u6301\u3064\u304C draw \u304C\u7A7A\u3002 \u63CF\u304F\u5BFE\u8C61\u304C\u7121\u3044\u306E\u3067\u4F55\u3082\u5909\u308F\u3089\u306A\u3044`
|
|
5200
|
+
);
|
|
5201
|
+
}
|
|
5202
|
+
}
|
|
5021
5203
|
for (const t of p.tweens) {
|
|
5022
5204
|
if (!stateIds.has(t.stateId)) {
|
|
5023
5205
|
errors.push(`[cdl] unknown-ref: phase "${p.id}" tween \u5BFE\u8C61 state "${t.stateId}" \u672A\u5B9A\u7FA9`);
|
|
@@ -5273,6 +5455,18 @@ function StateDiffCard({
|
|
|
5273
5455
|
);
|
|
5274
5456
|
}
|
|
5275
5457
|
|
|
5458
|
+
// src/render/edge-head.ts
|
|
5459
|
+
var EDGE_HEAD_SHAPE = {
|
|
5460
|
+
triangle: { d: "M 0 0 L 10 5 L 0 10 z", refX: 9, filled: true },
|
|
5461
|
+
diamond: { d: "M 0 5 L 5 0 L 10 5 L 5 10 z", refX: 9, filled: true },
|
|
5462
|
+
open: { d: "M 1 0 L 9 5 L 1 10", refX: 9, filled: false },
|
|
5463
|
+
crow: { d: "M 10 0 L 0 5 M 10 5 L 0 5 M 10 10 L 0 5", refX: 10, filled: false }
|
|
5464
|
+
};
|
|
5465
|
+
function edgeHeadMarkerId(tone, head, small) {
|
|
5466
|
+
const \u5C0F = small ? "-sm" : "";
|
|
5467
|
+
return head === EDGE_HEAD_DEFAULT ? `cdl-arrow-${tone}${\u5C0F}` : `cdl-arrow-${tone}-${head}${\u5C0F}`;
|
|
5468
|
+
}
|
|
5469
|
+
|
|
5276
5470
|
// src/render/tone.ts
|
|
5277
5471
|
var TONE = {
|
|
5278
5472
|
accent: "var(--cdl-tone-accent, #2d6a8f)",
|
|
@@ -5290,6 +5484,17 @@ var TONE_HEX = {
|
|
|
5290
5484
|
warning: "#a67a2e",
|
|
5291
5485
|
info: "#5a8ec1"
|
|
5292
5486
|
};
|
|
5487
|
+
var CHART_SERIES = [
|
|
5488
|
+
"var(--cdl-chart-1, #4338ca)",
|
|
5489
|
+
"var(--cdl-chart-2, #0d9488)",
|
|
5490
|
+
"var(--cdl-chart-3, #f59e0b)",
|
|
5491
|
+
"var(--cdl-chart-4, #be185d)",
|
|
5492
|
+
"var(--cdl-chart-5, #4d7c0f)",
|
|
5493
|
+
"var(--cdl-chart-6, #0369a1)"
|
|
5494
|
+
];
|
|
5495
|
+
function chartSeriesColor(idx) {
|
|
5496
|
+
return CHART_SERIES[(idx % CHART_SERIES.length + CHART_SERIES.length) % CHART_SERIES.length];
|
|
5497
|
+
}
|
|
5293
5498
|
var TONE_FALLBACK = "#2d6a8f";
|
|
5294
5499
|
function hasTone(tone) {
|
|
5295
5500
|
return Object.hasOwn(TONE, tone);
|
|
@@ -5313,7 +5518,7 @@ function CdlEdgeView({
|
|
|
5313
5518
|
stateValues
|
|
5314
5519
|
}) {
|
|
5315
5520
|
const color = toneColor(edge.tone);
|
|
5316
|
-
const marker = hasTone(edge.tone) ?
|
|
5521
|
+
const marker = hasTone(edge.tone) ? edgeHeadMarkerId(edge.tone, edge.head ?? EDGE_HEAD_DEFAULT, !active) : "cdl-arrow-muted";
|
|
5317
5522
|
const style = edge.style ?? "solid";
|
|
5318
5523
|
const isDotted = style === "dotted-flow";
|
|
5319
5524
|
const isPassThrough = isDotted && Boolean(edge.dThrough);
|
|
@@ -6133,12 +6338,13 @@ function GenericNode({
|
|
|
6133
6338
|
);
|
|
6134
6339
|
})();
|
|
6135
6340
|
const resolvedValue = value !== void 0 ? interpolate(value, stateValues) : void 0;
|
|
6136
|
-
const
|
|
6341
|
+
const hasRows = (node.rows?.length ?? 0) > 0;
|
|
6342
|
+
const centered = genericTextCentered(node.kind, hasRows);
|
|
6137
6343
|
const textAnchor = centered ? "middle" : "start";
|
|
6138
6344
|
const textX = centered ? w / 2 : 20;
|
|
6139
|
-
const cylinderShift =
|
|
6345
|
+
const cylinderShift = genericTextShift(node.kind);
|
|
6140
6346
|
const eyebrowY = centered ? h / 2 - 26 : 32 + cylinderShift;
|
|
6141
|
-
const titleY =
|
|
6347
|
+
const titleY = genericTitleBaselineY(node.kind, h, hasRows);
|
|
6142
6348
|
const subtitleY = centered ? h / 2 + 28 : 96 + cylinderShift;
|
|
6143
6349
|
const iconX = centered ? w / 2 + 40 : w - 48;
|
|
6144
6350
|
const iconY = centered ? h / 2 - 44 : 18 + cylinderShift;
|
|
@@ -6194,6 +6400,57 @@ function GenericNode({
|
|
|
6194
6400
|
})()
|
|
6195
6401
|
] });
|
|
6196
6402
|
}
|
|
6403
|
+
var MARK_INNER_RATIO = 0.56;
|
|
6404
|
+
var RING_WIDTH_ACTIVE = 6;
|
|
6405
|
+
var RING_WIDTH_IDLE = 4;
|
|
6406
|
+
var MARK_DEFAULT = "var(--cdl-tone-accent, #2d6a8f)";
|
|
6407
|
+
function markRadius(node) {
|
|
6408
|
+
return Math.min(node.w, node.h) / 2;
|
|
6409
|
+
}
|
|
6410
|
+
function MarkStartNode({ node }) {
|
|
6411
|
+
const \u8272 = nodeAccent(node, MARK_DEFAULT);
|
|
6412
|
+
return /* @__PURE__ */ jsx("g", { transform: `translate(${node.cx - node.w / 2} ${node.cy - node.h / 2})`, children: /* @__PURE__ */ jsx(
|
|
6413
|
+
"circle",
|
|
6414
|
+
{
|
|
6415
|
+
"data-cdl-role": "node-body",
|
|
6416
|
+
"data-cdl-mark": "start",
|
|
6417
|
+
cx: node.w / 2,
|
|
6418
|
+
cy: node.h / 2,
|
|
6419
|
+
r: markRadius(node),
|
|
6420
|
+
fill: \u8272
|
|
6421
|
+
}
|
|
6422
|
+
) });
|
|
6423
|
+
}
|
|
6424
|
+
function MarkEndNode({ node, active }) {
|
|
6425
|
+
const \u8272 = nodeAccent(node, MARK_DEFAULT);
|
|
6426
|
+
const r = markRadius(node);
|
|
6427
|
+
const \u8F2A\u306E\u592A\u3055 = active ? RING_WIDTH_ACTIVE : RING_WIDTH_IDLE;
|
|
6428
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${node.cx - node.w / 2} ${node.cy - node.h / 2})`, children: [
|
|
6429
|
+
/* @__PURE__ */ jsx(
|
|
6430
|
+
"circle",
|
|
6431
|
+
{
|
|
6432
|
+
"data-cdl-role": "node-body",
|
|
6433
|
+
"data-cdl-mark": "end",
|
|
6434
|
+
cx: node.w / 2,
|
|
6435
|
+
cy: node.h / 2,
|
|
6436
|
+
r: Math.max(0, r - \u8F2A\u306E\u592A\u3055 / 2),
|
|
6437
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
6438
|
+
stroke: \u8272,
|
|
6439
|
+
strokeWidth: \u8F2A\u306E\u592A\u3055
|
|
6440
|
+
}
|
|
6441
|
+
),
|
|
6442
|
+
/* @__PURE__ */ jsx(
|
|
6443
|
+
"circle",
|
|
6444
|
+
{
|
|
6445
|
+
"data-cdl-role": "node-inner",
|
|
6446
|
+
cx: node.w / 2,
|
|
6447
|
+
cy: node.h / 2,
|
|
6448
|
+
r: Math.max(0, r * MARK_INNER_RATIO),
|
|
6449
|
+
fill: \u8272
|
|
6450
|
+
}
|
|
6451
|
+
)
|
|
6452
|
+
] });
|
|
6453
|
+
}
|
|
6197
6454
|
function useTimeTick() {
|
|
6198
6455
|
const [t, setT] = useState(() => typeof performance !== "undefined" ? performance.now() : 0);
|
|
6199
6456
|
useEffect(() => {
|
|
@@ -6311,7 +6568,7 @@ function renderRect(shape, x, y, w, h, stateValues, fillColor, strokeColor, opac
|
|
|
6311
6568
|
)
|
|
6312
6569
|
] });
|
|
6313
6570
|
}
|
|
6314
|
-
function renderCircle(shape, cx, cy, w, h, stateValues, fillColor, strokeColor, opacity
|
|
6571
|
+
function renderCircle(shape, cx, cy, w, h, stateValues, fillColor, strokeColor, opacity) {
|
|
6315
6572
|
const maxR = Math.min(w, h) / 2;
|
|
6316
6573
|
const r = shape.radius !== void 0 ? resolveNumericAttr(shape.radius, stateValues, maxR) : maxR;
|
|
6317
6574
|
const progress = shape.fillProgress !== void 0 ? Math.min(1, Math.max(0, resolveNumericAttr(shape.fillProgress, stateValues, 0))) : 1;
|
|
@@ -6332,7 +6589,7 @@ function renderCircle(shape, cx, cy, w, h, stateValues, fillColor, strokeColor,
|
|
|
6332
6589
|
)
|
|
6333
6590
|
] });
|
|
6334
6591
|
}
|
|
6335
|
-
function renderArc(shape, cx, cy, w, h, stateValues, fillColor, strokeColor, opacity
|
|
6592
|
+
function renderArc(shape, cx, cy, w, h, stateValues, fillColor, strokeColor, opacity) {
|
|
6336
6593
|
const maxR = Math.min(w, h) / 2;
|
|
6337
6594
|
const outerR = shape.outerRadius ?? maxR;
|
|
6338
6595
|
const innerR = shape.innerRadius ?? outerR * 0.7;
|
|
@@ -6432,7 +6689,7 @@ function WaveShape({
|
|
|
6432
6689
|
)
|
|
6433
6690
|
] });
|
|
6434
6691
|
}
|
|
6435
|
-
function renderPolygon(shape, cx, cy, stateValues, fillColor, strokeColor, opacity
|
|
6692
|
+
function renderPolygon(shape, cx, cy, stateValues, fillColor, strokeColor, opacity) {
|
|
6436
6693
|
const sides = Math.min(12, Math.max(3, shape.sides));
|
|
6437
6694
|
const r = shape.radius !== void 0 ? resolveNumericAttr(shape.radius, stateValues, 40) : 40;
|
|
6438
6695
|
const rotation = shape.rotation !== void 0 ? resolveNumericAttr(shape.rotation, stateValues, 0) : 0;
|
|
@@ -6512,10 +6769,14 @@ function needsResolve(raw) {
|
|
|
6512
6769
|
return typeof raw !== "number" || !Number.isFinite(raw);
|
|
6513
6770
|
}
|
|
6514
6771
|
function resolveChartData(data, values) {
|
|
6515
|
-
if (!data.some((d) => needsResolve(d.value)))
|
|
6772
|
+
if (!data.some((d) => needsResolve(d.value) || d.previous !== void 0 && needsResolve(d.previous)))
|
|
6773
|
+
return data;
|
|
6516
6774
|
return data.map((d) => {
|
|
6517
6775
|
const v = resolveBoundNumber(d.value, values, 0);
|
|
6518
|
-
|
|
6776
|
+
const \u524D = d.previous === void 0 ? void 0 : resolveBoundNumber(d.previous, values, 0);
|
|
6777
|
+
const \u89E3\u3051\u305F = v.ok && (\u524D === void 0 || \u524D.ok);
|
|
6778
|
+
const \u7D20 = { ...d, value: v.value, previous: \u524D?.value };
|
|
6779
|
+
return \u89E3\u3051\u305F ? \u7D20 : { ...\u7D20, unresolved: true };
|
|
6519
6780
|
});
|
|
6520
6781
|
}
|
|
6521
6782
|
function resolveFunnelData(stages, values) {
|
|
@@ -6646,20 +6907,20 @@ function ChartLineNode({
|
|
|
6646
6907
|
const x0 = node.cx - node.w / 2;
|
|
6647
6908
|
const y0 = node.cy - node.h / 2;
|
|
6648
6909
|
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
6649
|
-
const
|
|
6650
|
-
const
|
|
6651
|
-
const
|
|
6652
|
-
const
|
|
6653
|
-
const canvasW = node.w -
|
|
6654
|
-
const canvasH = node.h -
|
|
6910
|
+
const PAD_TOP2 = 36;
|
|
6911
|
+
const PAD_RIGHT2 = 40;
|
|
6912
|
+
const PAD_BOTTOM2 = 56;
|
|
6913
|
+
const PAD_LEFT2 = 72;
|
|
6914
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
6915
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
6655
6916
|
const values = data.map((d) => d.value);
|
|
6656
6917
|
const vMin = values.length > 0 ? Math.min(...values) : 0;
|
|
6657
6918
|
const vMax = values.length > 0 ? Math.max(...values) : 1;
|
|
6658
6919
|
const vRange = vMax - vMin || 1;
|
|
6659
6920
|
const LABEL_ROOM = 20;
|
|
6660
|
-
const plotTop =
|
|
6921
|
+
const plotTop = PAD_TOP2 + LABEL_ROOM;
|
|
6661
6922
|
const plotH = Math.max(canvasH - LABEL_ROOM * 2, 1);
|
|
6662
|
-
const xAt = (idx) =>
|
|
6923
|
+
const xAt = (idx) => PAD_LEFT2 + (data.length <= 1 ? canvasW / 2 : canvasW * idx / (data.length - 1));
|
|
6663
6924
|
const yAt = (v) => plotTop + plotH - (v - vMin) / vRange * plotH;
|
|
6664
6925
|
const points = data.map((d, idx) => `${xAt(idx)},${yAt(d.value)}`).join(" ");
|
|
6665
6926
|
const \u70B9\u307E\u3067\u306E\u9577\u3055 = [];
|
|
@@ -6704,9 +6965,9 @@ function ChartLineNode({
|
|
|
6704
6965
|
/* @__PURE__ */ jsx(
|
|
6705
6966
|
"line",
|
|
6706
6967
|
{
|
|
6707
|
-
x1:
|
|
6968
|
+
x1: PAD_LEFT2,
|
|
6708
6969
|
y1: t.y,
|
|
6709
|
-
x2:
|
|
6970
|
+
x2: PAD_LEFT2 + canvasW,
|
|
6710
6971
|
y2: t.y,
|
|
6711
6972
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
6712
6973
|
strokeWidth: 0.75,
|
|
@@ -6717,7 +6978,7 @@ function ChartLineNode({
|
|
|
6717
6978
|
/* @__PURE__ */ jsx(
|
|
6718
6979
|
"text",
|
|
6719
6980
|
{
|
|
6720
|
-
x:
|
|
6981
|
+
x: PAD_LEFT2 - 8,
|
|
6721
6982
|
y: t.y + 4,
|
|
6722
6983
|
fontSize: 11,
|
|
6723
6984
|
textAnchor: "end",
|
|
@@ -6729,9 +6990,9 @@ function ChartLineNode({
|
|
|
6729
6990
|
/* @__PURE__ */ jsx(
|
|
6730
6991
|
"line",
|
|
6731
6992
|
{
|
|
6732
|
-
x1:
|
|
6993
|
+
x1: PAD_LEFT2,
|
|
6733
6994
|
y1: plotTop + plotH,
|
|
6734
|
-
x2:
|
|
6995
|
+
x2: PAD_LEFT2 + canvasW,
|
|
6735
6996
|
y2: plotTop + plotH,
|
|
6736
6997
|
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
6737
6998
|
strokeWidth: 1.25
|
|
@@ -6740,9 +7001,9 @@ function ChartLineNode({
|
|
|
6740
7001
|
/* @__PURE__ */ jsx(
|
|
6741
7002
|
"line",
|
|
6742
7003
|
{
|
|
6743
|
-
x1:
|
|
7004
|
+
x1: PAD_LEFT2,
|
|
6744
7005
|
y1: plotTop,
|
|
6745
|
-
x2:
|
|
7006
|
+
x2: PAD_LEFT2,
|
|
6746
7007
|
y2: plotTop + plotH,
|
|
6747
7008
|
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
6748
7009
|
strokeWidth: 1.25
|
|
@@ -6810,7 +7071,7 @@ function ChartLineNode({
|
|
|
6810
7071
|
"text",
|
|
6811
7072
|
{
|
|
6812
7073
|
x: cx,
|
|
6813
|
-
y:
|
|
7074
|
+
y: PAD_TOP2 + canvasH + 20,
|
|
6814
7075
|
fontSize: 12,
|
|
6815
7076
|
textAnchor: "middle",
|
|
6816
7077
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
@@ -6833,13 +7094,29 @@ function ChartPieNode({
|
|
|
6833
7094
|
const y0 = node.cy - node.h / 2;
|
|
6834
7095
|
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
6835
7096
|
const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
|
|
6836
|
-
const
|
|
6837
|
-
const
|
|
6838
|
-
const
|
|
6839
|
-
const
|
|
6840
|
-
const
|
|
6841
|
-
const
|
|
6842
|
-
const
|
|
7097
|
+
const PAD_TOP2 = 20;
|
|
7098
|
+
const PAD_BOTTOM2 = 20;
|
|
7099
|
+
const PAD_SIDE = 20;
|
|
7100
|
+
const chartAreaH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
7101
|
+
const \u540D\u672D\u306E\u7D1A = 14;
|
|
7102
|
+
const \u6570\u5024\u306E\u7D1A = 13;
|
|
7103
|
+
const \u5F15\u304D\u51FA\u3057 = 18;
|
|
7104
|
+
const \u5B57\u307E\u3067\u306E\u9593 = 26;
|
|
7105
|
+
const \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057 = 20;
|
|
7106
|
+
const \u5272\u5408\u306E\u6587\u5B57 = data.map((d) => \u5272\u5408\u8868\u8A18(d.value / total));
|
|
7107
|
+
const \u6570\u5024\u306E\u6587\u5B57 = data.map((d, i) => `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u306E\u6587\u5B57[i]}`);
|
|
7108
|
+
const \u540D\u672D\u5E45 = Math.max(
|
|
7109
|
+
0,
|
|
7110
|
+
...data.map(
|
|
7111
|
+
(d, i) => Math.max(textWidth(d.label ?? "", \u540D\u672D\u306E\u7D1A), textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A))
|
|
7112
|
+
)
|
|
7113
|
+
);
|
|
7114
|
+
const \u7E26\u304B\u3089 = chartAreaH / 2 - \u5F15\u304D\u51FA\u3057 - \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057;
|
|
7115
|
+
const \u6A2A\u304B\u3089 = (node.w - PAD_SIDE * 2) / 2 - \u5F15\u304D\u51FA\u3057 - \u5B57\u307E\u3067\u306E\u9593 - \u540D\u672D\u5E45;
|
|
7116
|
+
const radius = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
7117
|
+
const \u5185\u534A\u5F84 = radius * 0.58;
|
|
7118
|
+
const cx = node.w / 2;
|
|
7119
|
+
const cy = PAD_TOP2 + chartAreaH / 2;
|
|
6843
7120
|
let cumAngle = -Math.PI / 2;
|
|
6844
7121
|
let cumFrac = 0;
|
|
6845
7122
|
const slices = data.map((d) => {
|
|
@@ -6854,16 +7131,19 @@ function ChartPieNode({
|
|
|
6854
7131
|
const y1 = cy + radius * Math.sin(a0);
|
|
6855
7132
|
const x2 = cx + radius * Math.cos(a1);
|
|
6856
7133
|
const y2 = cy + radius * Math.sin(a1);
|
|
7134
|
+
const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
|
|
7135
|
+
const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
|
|
7136
|
+
const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
|
|
7137
|
+
const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
|
|
6857
7138
|
const large = angle > Math.PI ? 1 : 0;
|
|
6858
|
-
const path = `M ${
|
|
6859
|
-
|
|
7139
|
+
const path = `M ${x1} ${y1} A ${radius} ${radius} 0 ${large} 1 ${x2} ${y2} L ${x3} ${y3} A ${\u5185\u534A\u5F84} ${\u5185\u534A\u5F84} 0 ${large} 0 ${x4} ${y4} Z`;
|
|
7140
|
+
const \u4E2D\u592E\u89D2 = (a0 + a1) / 2;
|
|
7141
|
+
return { d, frac, path, startFrac, \u4E2D\u592E\u89D2 };
|
|
6860
7142
|
});
|
|
6861
7143
|
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
6862
7144
|
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
7145
|
+
const \u5F71id = `cdl-pie-shadow-${instanceId}`;
|
|
6863
7146
|
const \u958B\u304D\u59CB\u3081\u305F = (startFrac) => !drawing || \u958B\u304D > startFrac;
|
|
6864
|
-
const legendX = pieAreaW + 8;
|
|
6865
|
-
const legendGap = Math.min(28, chartAreaH / Math.max(data.length, 1));
|
|
6866
|
-
const legendStartY = PAD_TOP + (chartAreaH - legendGap * data.length) / 2 + legendGap / 2;
|
|
6867
7147
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
6868
7148
|
/* @__PURE__ */ jsx(
|
|
6869
7149
|
"rect",
|
|
@@ -6879,56 +7159,90 @@ function ChartPieNode({
|
|
|
6879
7159
|
strokeWidth: active ? 3 : 1.25
|
|
6880
7160
|
}
|
|
6881
7161
|
),
|
|
6882
|
-
|
|
6883
|
-
|
|
7162
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
7163
|
+
drawing && /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }),
|
|
7164
|
+
/* @__PURE__ */ jsx("filter", { id: \u5F71id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: /* @__PURE__ */ jsx("feDropShadow", { dx: "0", dy: "6", stdDeviation: "10", floodColor: "#0b1220", floodOpacity: "0.16" }) })
|
|
7165
|
+
] }),
|
|
7166
|
+
/* @__PURE__ */ jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, filter: `url(#${\u5F71id})`, children: slices.map((s, idx) => /* @__PURE__ */ jsx(
|
|
6884
7167
|
"path",
|
|
6885
7168
|
{
|
|
6886
7169
|
"data-cdl-role": "chart-pie-slice",
|
|
6887
7170
|
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
6888
7171
|
d: s.path,
|
|
6889
7172
|
fill: sliceColor(s.d.tone, idx),
|
|
6890
|
-
fillOpacity: active ? 0.95 : 0.85,
|
|
6891
7173
|
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
6892
|
-
strokeWidth:
|
|
7174
|
+
strokeWidth: 3,
|
|
7175
|
+
strokeLinejoin: "round"
|
|
6893
7176
|
},
|
|
6894
7177
|
`slice-${idx}`
|
|
6895
7178
|
)) }),
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
7179
|
+
/* @__PURE__ */ jsx(
|
|
7180
|
+
"text",
|
|
7181
|
+
{
|
|
7182
|
+
x: cx,
|
|
7183
|
+
y: cy - 2,
|
|
7184
|
+
textAnchor: "middle",
|
|
7185
|
+
fontSize: Math.round(radius * 0.26),
|
|
7186
|
+
fontWeight: 600,
|
|
7187
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7188
|
+
children: \u5B9F\u5024\u8868\u8A18(Math.round(total))
|
|
7189
|
+
}
|
|
7190
|
+
),
|
|
7191
|
+
/* @__PURE__ */ jsx(
|
|
7192
|
+
"text",
|
|
7193
|
+
{
|
|
7194
|
+
x: cx,
|
|
7195
|
+
y: cy + Math.round(radius * 0.2),
|
|
7196
|
+
textAnchor: "middle",
|
|
7197
|
+
fontSize: Math.round(radius * 0.12),
|
|
7198
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7199
|
+
children: "\u5408\u8A08"
|
|
7200
|
+
}
|
|
7201
|
+
),
|
|
7202
|
+
slices.map((s, idx) => {
|
|
7203
|
+
if (!\u958B\u304D\u59CB\u3081\u305F(s.startFrac)) return null;
|
|
7204
|
+
const \u53F3 = Math.cos(s.\u4E2D\u592E\u89D2) >= 0;
|
|
7205
|
+
const \u7E01x = cx + radius * Math.cos(s.\u4E2D\u592E\u89D2);
|
|
7206
|
+
const \u7E01y = cy + radius * Math.sin(s.\u4E2D\u592E\u89D2);
|
|
7207
|
+
const \u6298\u308Cx = cx + (radius + \u5F15\u304D\u51FA\u3057) * Math.cos(s.\u4E2D\u592E\u89D2);
|
|
7208
|
+
const \u6298\u308Cy = cy + (radius + \u5F15\u304D\u51FA\u3057) * Math.sin(s.\u4E2D\u592E\u89D2);
|
|
7209
|
+
const \u5B57x = \u6298\u308Cx + (\u53F3 ? \u5B57\u307E\u3067\u306E\u9593 : -\u5B57\u307E\u3067\u306E\u9593);
|
|
7210
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
7211
|
+
/* @__PURE__ */ jsx(
|
|
7212
|
+
"path",
|
|
7213
|
+
{
|
|
7214
|
+
d: `M ${\u7E01x} ${\u7E01y} L ${\u6298\u308Cx} ${\u6298\u308Cy} L ${\u5B57x - (\u53F3 ? 6 : -6)} ${\u6298\u308Cy}`,
|
|
7215
|
+
fill: "none",
|
|
7216
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
7217
|
+
strokeWidth: 1
|
|
7218
|
+
}
|
|
7219
|
+
),
|
|
7220
|
+
/* @__PURE__ */ jsx("circle", { cx: \u7E01x, cy: \u7E01y, r: 3, fill: sliceColor(s.d.tone, idx) }),
|
|
7221
|
+
/* @__PURE__ */ jsx(
|
|
7222
|
+
"text",
|
|
7223
|
+
{
|
|
7224
|
+
x: \u5B57x,
|
|
7225
|
+
y: \u6298\u308Cy - 3,
|
|
7226
|
+
textAnchor: \u53F3 ? "start" : "end",
|
|
7227
|
+
fontSize: \u540D\u672D\u306E\u7D1A,
|
|
7228
|
+
fontWeight: 600,
|
|
7229
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7230
|
+
children: s.d.label
|
|
7231
|
+
}
|
|
7232
|
+
),
|
|
7233
|
+
/* @__PURE__ */ jsx(
|
|
7234
|
+
"text",
|
|
7235
|
+
{
|
|
7236
|
+
x: \u5B57x,
|
|
7237
|
+
y: \u6298\u308Cy + 15,
|
|
7238
|
+
textAnchor: \u53F3 ? "start" : "end",
|
|
7239
|
+
fontSize: \u6570\u5024\u306E\u7D1A,
|
|
7240
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7241
|
+
children: \u6570\u5024\u306E\u6587\u5B57[idx]
|
|
7242
|
+
}
|
|
7243
|
+
)
|
|
7244
|
+
] }, `callout-${idx}`);
|
|
7245
|
+
})
|
|
6932
7246
|
] });
|
|
6933
7247
|
}
|
|
6934
7248
|
function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
|
|
@@ -6940,10 +7254,741 @@ function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
|
|
|
6940
7254
|
const d = `M ${cx} ${cy} L ${cx + r * Math.cos(a0)} ${cy + r * Math.sin(a0)} A ${r} ${r} 0 ${large} 1 ${cx + r * Math.cos(a1)} ${cy + r * Math.sin(a1)} Z`;
|
|
6941
7255
|
return /* @__PURE__ */ jsx("path", { d });
|
|
6942
7256
|
}
|
|
6943
|
-
|
|
7257
|
+
function \u5B9F\u5024\u8868\u8A18(v) {
|
|
7258
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
7259
|
+
}
|
|
7260
|
+
function \u5272\u5408\u8868\u8A18(frac) {
|
|
7261
|
+
const v = Math.round(frac * 1e3) / 10;
|
|
7262
|
+
return `${Number.isInteger(v) ? v : v.toFixed(1)}%`;
|
|
7263
|
+
}
|
|
6944
7264
|
function sliceColor(tone, idx) {
|
|
6945
7265
|
if (tone) return TONE[tone];
|
|
6946
|
-
return
|
|
7266
|
+
return chartSeriesColor(idx);
|
|
7267
|
+
}
|
|
7268
|
+
function ChartGaugeNode({
|
|
7269
|
+
node,
|
|
7270
|
+
active,
|
|
7271
|
+
stateValues = {}
|
|
7272
|
+
}) {
|
|
7273
|
+
const x0 = node.cx - node.w / 2;
|
|
7274
|
+
const y0 = node.cy - node.h / 2;
|
|
7275
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
7276
|
+
const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
|
|
7277
|
+
const PAD_TOP2 = 20;
|
|
7278
|
+
const PAD_BOTTOM2 = 20;
|
|
7279
|
+
const PAD_SIDE = 20;
|
|
7280
|
+
const \u4F7F\u3048\u308B\u9AD8\u3055 = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
7281
|
+
const \u4F7F\u3048\u308B\u5E452 = node.w - PAD_SIDE * 2;
|
|
7282
|
+
const \u540D\u524D\u306E\u7D1A = 14;
|
|
7283
|
+
const \u6570\u5024\u306E\u7D1A = 13;
|
|
7284
|
+
const \u5185\u8A33\u306E\u9AD8\u3055 = 56;
|
|
7285
|
+
const \u5F27\u3068\u5185\u8A33\u306E\u9593 = 16;
|
|
7286
|
+
const \u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055 = \u4F7F\u3048\u308B\u9AD8\u3055 - \u5185\u8A33\u306E\u9AD8\u3055 - \u5F27\u3068\u5185\u8A33\u306E\u9593;
|
|
7287
|
+
const radius = Math.max(24, Math.min(\u5F27\u306B\u4F7F\u3048\u308B\u9AD8\u3055, \u4F7F\u3048\u308B\u5E452 / 2));
|
|
7288
|
+
const \u5185\u534A\u5F84 = radius * 0.62;
|
|
7289
|
+
const cx = node.w / 2;
|
|
7290
|
+
const cy = PAD_TOP2 + radius;
|
|
7291
|
+
let cumFrac = 0;
|
|
7292
|
+
const slices = data.map((d) => {
|
|
7293
|
+
const frac = d.value / total;
|
|
7294
|
+
const a0 = Math.PI + cumFrac * Math.PI;
|
|
7295
|
+
const a1 = a0 + frac * Math.PI;
|
|
7296
|
+
cumFrac += frac;
|
|
7297
|
+
const \u59161 = \u6975(cx, cy, radius, a0);
|
|
7298
|
+
const \u59162 = \u6975(cx, cy, radius, a1);
|
|
7299
|
+
const \u51852 = \u6975(cx, cy, \u5185\u534A\u5F84, a1);
|
|
7300
|
+
const \u51851 = \u6975(cx, cy, \u5185\u534A\u5F84, a0);
|
|
7301
|
+
const path = `M ${\u59161.x} ${\u59161.y} A ${radius} ${radius} 0 0 1 ${\u59162.x} ${\u59162.y} L ${\u51852.x} ${\u51852.y} A ${\u5185\u534A\u5F84} ${\u5185\u534A\u5F84} 0 0 0 ${\u51851.x} ${\u51851.y} Z`;
|
|
7302
|
+
return { d, frac, path };
|
|
7303
|
+
});
|
|
7304
|
+
const \u5408\u8A08\u306E\u6587\u5B57 = \u5B9F\u5024\u8868\u8A182(Math.round(total));
|
|
7305
|
+
const \u6A2A\u306E\u4E0A\u9650 = \u5185\u534A\u5F84 * 2 * 0.86;
|
|
7306
|
+
const \u7D1A\u306E\u5019\u88DC = Math.min(
|
|
7307
|
+
// 横 = 実際の字幅から逆算する
|
|
7308
|
+
\u6A2A\u306E\u4E0A\u9650 / Math.max(textWidth(\u5408\u8A08\u306E\u6587\u5B57, 100), 1) * 100,
|
|
7309
|
+
// 縦 = 合計 1 行 + 見出し 1 行が内側の高さに収まる比
|
|
7310
|
+
\u5185\u534A\u5F84 * 0.52
|
|
7311
|
+
);
|
|
7312
|
+
const \u5408\u8A08\u306E\u7D1A = Math.max(11, Math.round(\u7D1A\u306E\u5019\u88DC));
|
|
7313
|
+
const \u898B\u51FA\u3057\u306E\u7D1A = Math.max(9, Math.round(\u5408\u8A08\u306E\u7D1A * 0.38));
|
|
7314
|
+
const \u5185\u8A33\u306E\u5E45 = \u4F7F\u3048\u308B\u5E452 / Math.max(data.length, 1);
|
|
7315
|
+
const \u5185\u8A33\u306Ey = cy + \u5F27\u3068\u5185\u8A33\u306E\u9593;
|
|
7316
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7317
|
+
/* @__PURE__ */ jsx(
|
|
7318
|
+
"rect",
|
|
7319
|
+
{
|
|
7320
|
+
"data-cdl-role": "node-body",
|
|
7321
|
+
x: 0,
|
|
7322
|
+
y: 0,
|
|
7323
|
+
width: node.w,
|
|
7324
|
+
height: node.h,
|
|
7325
|
+
rx: 16,
|
|
7326
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7327
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
7328
|
+
strokeWidth: active ? 3 : 1.25
|
|
7329
|
+
}
|
|
7330
|
+
),
|
|
7331
|
+
slices.map((s, idx) => /* @__PURE__ */ jsx(
|
|
7332
|
+
"path",
|
|
7333
|
+
{
|
|
7334
|
+
"data-cdl-role": "chart-gauge-arc",
|
|
7335
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
7336
|
+
d: s.path,
|
|
7337
|
+
fill: arcColor(s.d.tone, idx),
|
|
7338
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
7339
|
+
strokeWidth: 3,
|
|
7340
|
+
strokeLinejoin: "round"
|
|
7341
|
+
},
|
|
7342
|
+
`arc-${idx}`
|
|
7343
|
+
)),
|
|
7344
|
+
/* @__PURE__ */ jsx(
|
|
7345
|
+
"text",
|
|
7346
|
+
{
|
|
7347
|
+
x: cx,
|
|
7348
|
+
y: cy - \u5408\u8A08\u306E\u7D1A * 0.5,
|
|
7349
|
+
textAnchor: "middle",
|
|
7350
|
+
fontSize: \u5408\u8A08\u306E\u7D1A,
|
|
7351
|
+
fontWeight: 600,
|
|
7352
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7353
|
+
children: \u5408\u8A08\u306E\u6587\u5B57
|
|
7354
|
+
}
|
|
7355
|
+
),
|
|
7356
|
+
/* @__PURE__ */ jsx(
|
|
7357
|
+
"text",
|
|
7358
|
+
{
|
|
7359
|
+
x: cx,
|
|
7360
|
+
y: cy - \u5408\u8A08\u306E\u7D1A * 0.5 + \u898B\u51FA\u3057\u306E\u7D1A * 1.5,
|
|
7361
|
+
textAnchor: "middle",
|
|
7362
|
+
fontSize: \u898B\u51FA\u3057\u306E\u7D1A,
|
|
7363
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7364
|
+
children: "\u5408\u8A08"
|
|
7365
|
+
}
|
|
7366
|
+
),
|
|
7367
|
+
data.map((d, idx) => {
|
|
7368
|
+
const x = PAD_SIDE + \u5185\u8A33\u306E\u5E45 * idx;
|
|
7369
|
+
const \u6570\u5024 = `${\u5B9F\u5024\u8868\u8A182(d.value)} ${\u5272\u5408\u8868\u8A182(d.value / total)}`;
|
|
7370
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-gauge-item", children: [
|
|
7371
|
+
/* @__PURE__ */ jsx("rect", { x, y: \u5185\u8A33\u306Ey, width: 30, height: 4, rx: 2, fill: arcColor(d.tone, idx) }),
|
|
7372
|
+
/* @__PURE__ */ jsx(
|
|
7373
|
+
"text",
|
|
7374
|
+
{
|
|
7375
|
+
x,
|
|
7376
|
+
y: \u5185\u8A33\u306Ey + 26,
|
|
7377
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
7378
|
+
fontWeight: 700,
|
|
7379
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7380
|
+
children: \u5207\u308A\u8A70\u3081\u308B(d.label ?? "", \u5185\u8A33\u306E\u5E45 - 12, \u540D\u524D\u306E\u7D1A)
|
|
7381
|
+
}
|
|
7382
|
+
),
|
|
7383
|
+
/* @__PURE__ */ jsx("text", { x, y: \u5185\u8A33\u306Ey + 46, fontSize: \u6570\u5024\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u6570\u5024 })
|
|
7384
|
+
] }, `legend-${idx}`);
|
|
7385
|
+
})
|
|
7386
|
+
] });
|
|
7387
|
+
}
|
|
7388
|
+
function \u6975(cx, cy, r, a) {
|
|
7389
|
+
return { x: cx + r * Math.cos(a), y: cy + r * Math.sin(a) };
|
|
7390
|
+
}
|
|
7391
|
+
function \u5207\u308A\u8A70\u3081\u308B(s, \u4E0A\u9650, \u7D1A) {
|
|
7392
|
+
if (\u4E0A\u9650 <= 0 || textWidth(s, \u7D1A) <= \u4E0A\u9650) return s;
|
|
7393
|
+
const \u8A18\u53F7\u5E45 = textWidth("\u2026", \u7D1A);
|
|
7394
|
+
let out = "";
|
|
7395
|
+
for (const c of s) {
|
|
7396
|
+
if (textWidth(out + c, \u7D1A) + \u8A18\u53F7\u5E45 > \u4E0A\u9650) break;
|
|
7397
|
+
out += c;
|
|
7398
|
+
}
|
|
7399
|
+
return `${out}\u2026`;
|
|
7400
|
+
}
|
|
7401
|
+
function \u5B9F\u5024\u8868\u8A182(v) {
|
|
7402
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
7403
|
+
}
|
|
7404
|
+
function \u5272\u5408\u8868\u8A182(frac) {
|
|
7405
|
+
const v = Math.round(frac * 1e3) / 10;
|
|
7406
|
+
return `${Number.isInteger(v) ? v : v.toFixed(1)}%`;
|
|
7407
|
+
}
|
|
7408
|
+
function arcColor(tone, idx) {
|
|
7409
|
+
if (tone) return TONE[tone];
|
|
7410
|
+
return chartSeriesColor(idx);
|
|
7411
|
+
}
|
|
7412
|
+
function ChartRadialNode({
|
|
7413
|
+
node,
|
|
7414
|
+
active,
|
|
7415
|
+
stateValues = {}
|
|
7416
|
+
}) {
|
|
7417
|
+
const x0 = node.cx - node.w / 2;
|
|
7418
|
+
const y0 = node.cy - node.h / 2;
|
|
7419
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
7420
|
+
const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
|
|
7421
|
+
const PAD = 20;
|
|
7422
|
+
const \u4F7F\u3048\u308B\u9AD8\u3055 = node.h - PAD * 2;
|
|
7423
|
+
const \u540D\u524D\u306E\u7D1A = 14;
|
|
7424
|
+
const \u6570\u5024\u306E\u7D1A = 13;
|
|
7425
|
+
const \u884C\u306E\u9AD8\u3055 = 42;
|
|
7426
|
+
const \u4E00\u89A7\u3068\u5F27\u306E\u9593 = 28;
|
|
7427
|
+
const \u6570\u5024\u306E\u6587\u5B57 = data.map((d) => `${\u5B9F\u5024\u8868\u8A183(d.value)} ${\u5272\u5408\u8868\u8A183(d.value / total)}`);
|
|
7428
|
+
const \u4E00\u89A7\u306E\u5E45 = \u5370\u306E\u5E45 + Math.max(
|
|
7429
|
+
0,
|
|
7430
|
+
...data.map(
|
|
7431
|
+
(d, i) => Math.max(textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A), textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A))
|
|
7432
|
+
)
|
|
7433
|
+
);
|
|
7434
|
+
const \u5F27\u306B\u4F7F\u3048\u308B\u5E45 = node.w - PAD * 2 - \u4E00\u89A7\u306E\u5E45 - \u4E00\u89A7\u3068\u5F27\u306E\u9593;
|
|
7435
|
+
const \u5916\u534A\u5F84 = Math.max(24, Math.min(\u4F7F\u3048\u308B\u9AD8\u3055 / 2, \u5F27\u306B\u4F7F\u3048\u308B\u5E45 / 2));
|
|
7436
|
+
const \u4F7F\u3048\u308B\u539A\u307F = \u5916\u534A\u5F84 * 0.7;
|
|
7437
|
+
const \u5E2F1\u672C = \u4F7F\u3048\u308B\u539A\u307F / Math.max(data.length, 1);
|
|
7438
|
+
const \u5E2F\u306E\u5E45 = \u5E2F1\u672C * 0.66;
|
|
7439
|
+
const \u5F27\u306Ecx = PAD + \u4E00\u89A7\u306E\u5E45 + \u4E00\u89A7\u3068\u5F27\u306E\u9593 + \u5916\u534A\u5F84;
|
|
7440
|
+
const cy = PAD + \u4F7F\u3048\u308B\u9AD8\u3055 / 2;
|
|
7441
|
+
const rings = data.map((d, idx) => {
|
|
7442
|
+
const frac = d.value / total;
|
|
7443
|
+
const \u4E2D\u5FC3\u534A\u5F84 = \u5916\u534A\u5F84 - \u5E2F1\u672C * idx - \u5E2F1\u672C / 2;
|
|
7444
|
+
return {
|
|
7445
|
+
d,
|
|
7446
|
+
frac,
|
|
7447
|
+
\u4E2D\u5FC3\u534A\u5F84,
|
|
7448
|
+
// 軌道は全周。 1 周ちょうどは弧で表せないので、 わずかに欠かして描く
|
|
7449
|
+
\u8ECC\u9053: \u5F27\u306E\u9053(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
|
|
7450
|
+
\u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\u9053(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, Math.min(frac, 0.9999))
|
|
7451
|
+
};
|
|
7452
|
+
});
|
|
7453
|
+
const \u4E00\u89A7\u306E\u59CB\u307E\u308A = PAD + (\u4F7F\u3048\u308B\u9AD8\u3055 - \u884C\u306E\u9AD8\u3055 * data.length) / 2 + \u884C\u306E\u9AD8\u3055 / 2;
|
|
7454
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7455
|
+
/* @__PURE__ */ jsx(
|
|
7456
|
+
"rect",
|
|
7457
|
+
{
|
|
7458
|
+
"data-cdl-role": "node-body",
|
|
7459
|
+
x: 0,
|
|
7460
|
+
y: 0,
|
|
7461
|
+
width: node.w,
|
|
7462
|
+
height: node.h,
|
|
7463
|
+
rx: 16,
|
|
7464
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7465
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
7466
|
+
strokeWidth: active ? 3 : 1.25
|
|
7467
|
+
}
|
|
7468
|
+
),
|
|
7469
|
+
rings.map((r, idx) => /* @__PURE__ */ jsx(
|
|
7470
|
+
"path",
|
|
7471
|
+
{
|
|
7472
|
+
"data-cdl-role": "chart-radial-track",
|
|
7473
|
+
d: r.\u8ECC\u9053,
|
|
7474
|
+
fill: "var(--cdl-divider, #d4d4d8)",
|
|
7475
|
+
fillOpacity: 0.28
|
|
7476
|
+
},
|
|
7477
|
+
`track-${idx}`
|
|
7478
|
+
)),
|
|
7479
|
+
rings.map(
|
|
7480
|
+
(r, idx) => r.\u53D6\u308A\u5206 === null ? null : /* @__PURE__ */ jsx(
|
|
7481
|
+
"path",
|
|
7482
|
+
{
|
|
7483
|
+
"data-cdl-role": "chart-radial-arc",
|
|
7484
|
+
"data-cdl-unresolved": r.d.unresolved ? "true" : void 0,
|
|
7485
|
+
d: r.\u53D6\u308A\u5206,
|
|
7486
|
+
fill: arcColor2(r.d.tone, idx)
|
|
7487
|
+
},
|
|
7488
|
+
`arc-${idx}`
|
|
7489
|
+
)
|
|
7490
|
+
),
|
|
7491
|
+
data.map((d, idx) => {
|
|
7492
|
+
const y = \u4E00\u89A7\u306E\u59CB\u307E\u308A + \u884C\u306E\u9AD8\u3055 * idx;
|
|
7493
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-radial-item", children: [
|
|
7494
|
+
/* @__PURE__ */ jsx("rect", { x: PAD, y: y - 11, width: 4, height: 22, rx: 2, fill: arcColor2(d.tone, idx) }),
|
|
7495
|
+
/* @__PURE__ */ jsx(
|
|
7496
|
+
"text",
|
|
7497
|
+
{
|
|
7498
|
+
x: PAD + \u5370\u306E\u5E45,
|
|
7499
|
+
y: y + 1,
|
|
7500
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
7501
|
+
fontWeight: 700,
|
|
7502
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7503
|
+
children: d.label
|
|
7504
|
+
}
|
|
7505
|
+
),
|
|
7506
|
+
/* @__PURE__ */ jsx(
|
|
7507
|
+
"text",
|
|
7508
|
+
{
|
|
7509
|
+
x: PAD + \u5370\u306E\u5E45,
|
|
7510
|
+
y: y + 20,
|
|
7511
|
+
fontSize: \u6570\u5024\u306E\u7D1A,
|
|
7512
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7513
|
+
children: \u6570\u5024\u306E\u6587\u5B57[idx]
|
|
7514
|
+
}
|
|
7515
|
+
)
|
|
7516
|
+
] }, `item-${idx}`);
|
|
7517
|
+
})
|
|
7518
|
+
] });
|
|
7519
|
+
}
|
|
7520
|
+
var \u5370\u306E\u5E45 = 18;
|
|
7521
|
+
function \u5F27\u306E\u9053(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5408) {
|
|
7522
|
+
const \u5916 = \u4E2D\u5FC3\u534A\u5F84 + \u5E45 / 2;
|
|
7523
|
+
const \u5185 = Math.max(0.5, \u4E2D\u5FC3\u534A\u5F84 - \u5E45 / 2);
|
|
7524
|
+
const a0 = -Math.PI / 2;
|
|
7525
|
+
const a1 = a0 + \u5272\u5408 * Math.PI * 2;
|
|
7526
|
+
const large = \u5272\u5408 > 0.5 ? 1 : 0;
|
|
7527
|
+
const p = (r, a) => `${cx + r * Math.cos(a)} ${cy + r * Math.sin(a)}`;
|
|
7528
|
+
return `M ${p(\u5916, a0)} A ${\u5916} ${\u5916} 0 ${large} 1 ${p(\u5916, a1)} L ${p(\u5185, a1)} A ${\u5185} ${\u5185} 0 ${large} 0 ${p(\u5185, a0)} Z`;
|
|
7529
|
+
}
|
|
7530
|
+
function \u5B9F\u5024\u8868\u8A183(v) {
|
|
7531
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
7532
|
+
}
|
|
7533
|
+
function \u5272\u5408\u8868\u8A183(frac) {
|
|
7534
|
+
const v = Math.round(frac * 1e3) / 10;
|
|
7535
|
+
return `${Number.isInteger(v) ? v : v.toFixed(1)}%`;
|
|
7536
|
+
}
|
|
7537
|
+
function arcColor2(tone, idx) {
|
|
7538
|
+
if (tone) return TONE[tone];
|
|
7539
|
+
return chartSeriesColor(idx);
|
|
7540
|
+
}
|
|
7541
|
+
function ChartStatNode({
|
|
7542
|
+
node,
|
|
7543
|
+
active,
|
|
7544
|
+
stateValues = {}
|
|
7545
|
+
}) {
|
|
7546
|
+
const x0 = node.cx - node.w / 2;
|
|
7547
|
+
const y0 = node.cy - node.h / 2;
|
|
7548
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
7549
|
+
const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
|
|
7550
|
+
const \u533A\u753B = \u533A\u753B\u306E\u5272\u4ED8(node.w, node.h, data.length);
|
|
7551
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7552
|
+
/* @__PURE__ */ jsx(
|
|
7553
|
+
"rect",
|
|
7554
|
+
{
|
|
7555
|
+
"data-cdl-role": "node-body",
|
|
7556
|
+
x: 0,
|
|
7557
|
+
y: 0,
|
|
7558
|
+
width: node.w,
|
|
7559
|
+
height: node.h,
|
|
7560
|
+
rx: 16,
|
|
7561
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7562
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
7563
|
+
strokeWidth: active ? 3 : 1.25
|
|
7564
|
+
}
|
|
7565
|
+
),
|
|
7566
|
+
data.map((d, idx) => {
|
|
7567
|
+
const \u67A0 = \u533A\u753B.\u67A0(idx);
|
|
7568
|
+
const frac = total > 0 ? d.value / total : 0;
|
|
7569
|
+
const \u8272 = \u5370\u306E\u8272(d.tone, idx);
|
|
7570
|
+
const \u6570\u5024 = \u5B9F\u5024\u8868\u8A184(d.value);
|
|
7571
|
+
const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(\u6570\u5024, \u67A0.w - \u533A\u753B.\u4F59\u767D * 2, \u533A\u753B.\u6570\u5024\u306E\u7D1A, \u533A\u753B.\u540D\u524D\u306E\u7D1A + 1);
|
|
7572
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A0.x} ${\u67A0.y})`, children: [
|
|
7573
|
+
idx > 0 && /* @__PURE__ */ jsx(
|
|
7574
|
+
"line",
|
|
7575
|
+
{
|
|
7576
|
+
"data-cdl-role": "chart-stat-divider",
|
|
7577
|
+
x1: 0,
|
|
7578
|
+
y1: \u533A\u753B.\u4F59\u767D,
|
|
7579
|
+
x2: 0,
|
|
7580
|
+
y2: \u67A0.h - \u533A\u753B.\u4F59\u767D,
|
|
7581
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
7582
|
+
strokeWidth: 1
|
|
7583
|
+
}
|
|
7584
|
+
),
|
|
7585
|
+
/* @__PURE__ */ jsx(
|
|
7586
|
+
"text",
|
|
7587
|
+
{
|
|
7588
|
+
"data-cdl-role": "chart-stat-label",
|
|
7589
|
+
x: \u67A0.w / 2,
|
|
7590
|
+
y: \u533A\u753B.\u540D\u524D\u306Ey,
|
|
7591
|
+
fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
|
|
7592
|
+
fontWeight: 700,
|
|
7593
|
+
textAnchor: "middle",
|
|
7594
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7595
|
+
children: d.label
|
|
7596
|
+
}
|
|
7597
|
+
),
|
|
7598
|
+
/* @__PURE__ */ jsx(
|
|
7599
|
+
"text",
|
|
7600
|
+
{
|
|
7601
|
+
"data-cdl-role": "chart-stat-value",
|
|
7602
|
+
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
7603
|
+
x: \u67A0.w / 2,
|
|
7604
|
+
y: \u533A\u753B.\u6570\u5024\u306Ey,
|
|
7605
|
+
fontSize: \u6570\u5024\u306E\u7D1A,
|
|
7606
|
+
fontWeight: 700,
|
|
7607
|
+
textAnchor: "middle",
|
|
7608
|
+
fill: \u8272,
|
|
7609
|
+
children: \u6570\u5024
|
|
7610
|
+
}
|
|
7611
|
+
),
|
|
7612
|
+
/* @__PURE__ */ jsx(
|
|
7613
|
+
"circle",
|
|
7614
|
+
{
|
|
7615
|
+
"data-cdl-role": "chart-stat-track",
|
|
7616
|
+
cx: \u67A0.w / 2,
|
|
7617
|
+
cy: \u533A\u753B.\u5F27\u306Ey,
|
|
7618
|
+
r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
|
|
7619
|
+
fill: "none",
|
|
7620
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
7621
|
+
strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
|
|
7622
|
+
strokeOpacity: 0.5
|
|
7623
|
+
}
|
|
7624
|
+
),
|
|
7625
|
+
frac > 0 && /* @__PURE__ */ jsx(
|
|
7626
|
+
"path",
|
|
7627
|
+
{
|
|
7628
|
+
"data-cdl-role": "chart-stat-arc",
|
|
7629
|
+
d: \u5F27\u306E\u90532(\u67A0.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
|
|
7630
|
+
fill: "none",
|
|
7631
|
+
stroke: \u8272,
|
|
7632
|
+
strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
|
|
7633
|
+
strokeLinecap: "round"
|
|
7634
|
+
}
|
|
7635
|
+
),
|
|
7636
|
+
/* @__PURE__ */ jsx(
|
|
7637
|
+
"text",
|
|
7638
|
+
{
|
|
7639
|
+
"data-cdl-role": "chart-stat-share",
|
|
7640
|
+
x: \u67A0.w / 2,
|
|
7641
|
+
y: \u533A\u753B.\u5272\u5408\u306Ey,
|
|
7642
|
+
fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
|
|
7643
|
+
textAnchor: "middle",
|
|
7644
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7645
|
+
children: \u5272\u5408\u8868\u8A184(frac)
|
|
7646
|
+
}
|
|
7647
|
+
)
|
|
7648
|
+
] }, `stat-${idx}`);
|
|
7649
|
+
})
|
|
7650
|
+
] });
|
|
7651
|
+
}
|
|
7652
|
+
function \u533A\u753B\u306E\u5272\u4ED8(w, h, \u4EF6\u6570) {
|
|
7653
|
+
const \u4F59\u767D = 20;
|
|
7654
|
+
const \u5E45 = \u4EF6\u6570 > 0 ? w / \u4EF6\u6570 : w;
|
|
7655
|
+
const \u540D\u524D\u306E\u7D1A = 14;
|
|
7656
|
+
const \u6570\u5024\u306E\u7D1A = 40;
|
|
7657
|
+
const \u5272\u5408\u306E\u7D1A = 12;
|
|
7658
|
+
const \u5F27\u306E\u534A\u5F84 = 20;
|
|
7659
|
+
const \u5F27\u306E\u592A\u3055 = 4;
|
|
7660
|
+
const \u4E2D\u8EAB\u306E\u9AD8\u3055 = \u540D\u524D\u306E\u7D1A + 12 + \u6570\u5024\u306E\u7D1A + 16 + \u5F27\u306E\u534A\u5F84 * 2 + 8 + \u5272\u5408\u306E\u7D1A;
|
|
7661
|
+
const \u4E0A\u7AEF = Math.max(\u4F59\u767D, (h - \u4E2D\u8EAB\u306E\u9AD8\u3055) / 2);
|
|
7662
|
+
const \u540D\u524D\u306Ey = \u4E0A\u7AEF + \u540D\u524D\u306E\u7D1A;
|
|
7663
|
+
const \u6570\u5024\u306Ey = \u540D\u524D\u306Ey + 12 + \u6570\u5024\u306E\u7D1A * 0.78;
|
|
7664
|
+
const \u5F27\u306Ey = \u6570\u5024\u306Ey + 16 + \u5F27\u306E\u534A\u5F84;
|
|
7665
|
+
const \u5272\u5408\u306Ey = \u5F27\u306Ey + \u5F27\u306E\u534A\u5F84 + 8 + \u5272\u5408\u306E\u7D1A;
|
|
7666
|
+
return {
|
|
7667
|
+
\u4F59\u767D,
|
|
7668
|
+
\u540D\u524D\u306E\u7D1A,
|
|
7669
|
+
\u6570\u5024\u306E\u7D1A,
|
|
7670
|
+
\u5272\u5408\u306E\u7D1A,
|
|
7671
|
+
\u5F27\u306E\u534A\u5F84,
|
|
7672
|
+
\u5F27\u306E\u592A\u3055,
|
|
7673
|
+
\u540D\u524D\u306Ey,
|
|
7674
|
+
\u6570\u5024\u306Ey,
|
|
7675
|
+
\u5F27\u306Ey,
|
|
7676
|
+
\u5272\u5408\u306Ey,
|
|
7677
|
+
\u67A0: (idx) => ({ x: \u5E45 * idx, y: 0, w: \u5E45, h })
|
|
7678
|
+
};
|
|
7679
|
+
}
|
|
7680
|
+
function \u53CE\u3081\u308B\u7D1A(\u5B57, \u4F7F\u3048\u308B\u5E452, \u521D\u671F, \u4E0B\u9650) {
|
|
7681
|
+
let \u7D1A = \u521D\u671F;
|
|
7682
|
+
while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B57, \u7D1A) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
|
|
7683
|
+
return \u7D1A;
|
|
7684
|
+
}
|
|
7685
|
+
function \u5F27\u306E\u90532(cx, cy, r, \u5272\u5408) {
|
|
7686
|
+
const a0 = -Math.PI / 2;
|
|
7687
|
+
const a1 = a0 + \u5272\u5408 * Math.PI * 2;
|
|
7688
|
+
const large = \u5272\u5408 > 0.5 ? 1 : 0;
|
|
7689
|
+
const p = (a) => `${cx + r * Math.cos(a)} ${cy + r * Math.sin(a)}`;
|
|
7690
|
+
return `M ${p(a0)} A ${r} ${r} 0 ${large} 1 ${p(a1)}`;
|
|
7691
|
+
}
|
|
7692
|
+
function \u5B9F\u5024\u8868\u8A184(v) {
|
|
7693
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
7694
|
+
}
|
|
7695
|
+
function \u5272\u5408\u8868\u8A184(frac) {
|
|
7696
|
+
const v = Math.round(frac * 1e3) / 10;
|
|
7697
|
+
return `${Number.isInteger(v) ? v : v.toFixed(1)}%`;
|
|
7698
|
+
}
|
|
7699
|
+
function \u5370\u306E\u8272(tone, idx) {
|
|
7700
|
+
if (tone) return TONE[tone];
|
|
7701
|
+
return chartSeriesColor(idx);
|
|
7702
|
+
}
|
|
7703
|
+
var WAFFLE_TOTAL = 100;
|
|
7704
|
+
var WAFFLE_COLS = 10;
|
|
7705
|
+
function \u5370\u306E\u5272\u4ED8(\u5024) {
|
|
7706
|
+
const \u5408\u8A08 = \u5024.reduce((a, v) => a + Math.max(0, v), 0);
|
|
7707
|
+
if (\u5408\u8A08 <= 0) return \u5024.map(() => 0);
|
|
7708
|
+
const \u751F = \u5024.map((v) => Math.max(0, v) / \u5408\u8A08 * WAFFLE_TOTAL);
|
|
7709
|
+
const \u914D\u5206 = \u751F.map((v) => Math.floor(v));
|
|
7710
|
+
let \u4F59\u308A = WAFFLE_TOTAL - \u914D\u5206.reduce((a, v) => a + v, 0);
|
|
7711
|
+
const \u9806 = \u751F.map((v, i) => ({ i, \u5C0F\u6570\u90E8: v - Math.floor(v) })).sort((a, b) => b.\u5C0F\u6570\u90E8 - a.\u5C0F\u6570\u90E8 || a.i - b.i);
|
|
7712
|
+
for (let k = 0; \u4F59\u308A > 0; k = (k + 1) % \u9806.length) {
|
|
7713
|
+
const i = \u9806[k].i;
|
|
7714
|
+
\u914D\u5206[i] = (\u914D\u5206[i] ?? 0) + 1;
|
|
7715
|
+
\u4F59\u308A -= 1;
|
|
7716
|
+
}
|
|
7717
|
+
return \u914D\u5206;
|
|
7718
|
+
}
|
|
7719
|
+
function ChartWaffleNode({
|
|
7720
|
+
node,
|
|
7721
|
+
active,
|
|
7722
|
+
stateValues = {}
|
|
7723
|
+
}) {
|
|
7724
|
+
const x0 = node.cx - node.w / 2;
|
|
7725
|
+
const y0 = node.cy - node.h / 2;
|
|
7726
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
7727
|
+
const \u914D\u5206 = \u5370\u306E\u5272\u4ED8(data.map((d) => d.value));
|
|
7728
|
+
const PAD = 20;
|
|
7729
|
+
const \u540D\u524D\u306E\u7D1A = 14;
|
|
7730
|
+
const \u6570\u5024\u306E\u7D1A = 13;
|
|
7731
|
+
const \u884C\u306E\u9AD8\u3055 = 40;
|
|
7732
|
+
const \u4E00\u89A7\u3068\u683C\u5B50\u306E\u9593 = 28;
|
|
7733
|
+
const \u5370\u306E\u5E452 = 18;
|
|
7734
|
+
const \u6570\u5024\u306E\u6587\u5B57 = data.map((d, i) => `${\u5B9F\u5024\u8868\u8A185(d.value)} ${\u914D\u5206[i] ?? 0}%`);
|
|
7735
|
+
const \u4E00\u89A7\u306E\u5E45 = \u5370\u306E\u5E452 + Math.max(
|
|
7736
|
+
0,
|
|
7737
|
+
...data.map(
|
|
7738
|
+
(d, i) => Math.max(textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A), textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A))
|
|
7739
|
+
)
|
|
7740
|
+
);
|
|
7741
|
+
const \u4F7F\u3048\u308B\u9AD8\u3055 = node.h - PAD * 2;
|
|
7742
|
+
const \u683C\u5B50\u306B\u4F7F\u3048\u308B\u5E45 = node.w - PAD * 2 - \u4E00\u89A7\u306E\u5E45 - \u4E00\u89A7\u3068\u683C\u5B50\u306E\u9593;
|
|
7743
|
+
const \u5347 = Math.max(4, Math.min(\u4F7F\u3048\u308B\u9AD8\u3055, \u683C\u5B50\u306B\u4F7F\u3048\u308B\u5E45) / WAFFLE_COLS);
|
|
7744
|
+
const \u5370 = \u5347 * 0.78;
|
|
7745
|
+
const \u683C\u5B50\u306E\u5DE6 = PAD + \u4E00\u89A7\u306E\u5E45 + \u4E00\u89A7\u3068\u683C\u5B50\u306E\u9593;
|
|
7746
|
+
const \u683C\u5B50\u306E\u4E0A = PAD + (\u4F7F\u3048\u308B\u9AD8\u3055 - \u5347 * WAFFLE_COLS) / 2;
|
|
7747
|
+
const \u6301\u3061\u4E3B = [];
|
|
7748
|
+
\u914D\u5206.forEach((n, idx) => {
|
|
7749
|
+
for (let k = 0; k < n; k++) \u6301\u3061\u4E3B.push(idx);
|
|
7750
|
+
});
|
|
7751
|
+
const \u4E00\u89A7\u306E\u59CB\u307E\u308A = PAD + (\u4F7F\u3048\u308B\u9AD8\u3055 - \u884C\u306E\u9AD8\u3055 * data.length) / 2 + \u884C\u306E\u9AD8\u3055 / 2;
|
|
7752
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7753
|
+
/* @__PURE__ */ jsx(
|
|
7754
|
+
"rect",
|
|
7755
|
+
{
|
|
7756
|
+
"data-cdl-role": "node-body",
|
|
7757
|
+
x: 0,
|
|
7758
|
+
y: 0,
|
|
7759
|
+
width: node.w,
|
|
7760
|
+
height: node.h,
|
|
7761
|
+
rx: 16,
|
|
7762
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7763
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
7764
|
+
strokeWidth: active ? 3 : 1.25
|
|
7765
|
+
}
|
|
7766
|
+
),
|
|
7767
|
+
Array.from({ length: WAFFLE_TOTAL }, (_, k) => {
|
|
7768
|
+
const \u884C = Math.floor(k / WAFFLE_COLS);
|
|
7769
|
+
const \u5217 = k % WAFFLE_COLS;
|
|
7770
|
+
const owner = \u6301\u3061\u4E3B[k];
|
|
7771
|
+
return /* @__PURE__ */ jsx(
|
|
7772
|
+
"rect",
|
|
7773
|
+
{
|
|
7774
|
+
"data-cdl-role": "chart-waffle-cell",
|
|
7775
|
+
"data-cdl-waffle-owner": owner === void 0 ? "" : String(owner),
|
|
7776
|
+
x: \u683C\u5B50\u306E\u5DE6 + \u5347 * \u5217 + (\u5347 - \u5370) / 2,
|
|
7777
|
+
y: \u683C\u5B50\u306E\u4E0A + \u5347 * \u884C + (\u5347 - \u5370) / 2,
|
|
7778
|
+
width: \u5370,
|
|
7779
|
+
height: \u5370,
|
|
7780
|
+
rx: 2,
|
|
7781
|
+
fill: owner === void 0 ? "var(--cdl-divider, #d4d4d8)" : \u5370\u306E\u82722(data[owner].tone, owner),
|
|
7782
|
+
fillOpacity: owner === void 0 ? 0.35 : 1
|
|
7783
|
+
},
|
|
7784
|
+
`cell-${k}`
|
|
7785
|
+
);
|
|
7786
|
+
}),
|
|
7787
|
+
data.map((d, idx) => {
|
|
7788
|
+
const y = \u4E00\u89A7\u306E\u59CB\u307E\u308A + \u884C\u306E\u9AD8\u3055 * idx;
|
|
7789
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-waffle-item", children: [
|
|
7790
|
+
/* @__PURE__ */ jsx("rect", { x: PAD, y: y - 11, width: 4, height: 22, rx: 2, fill: \u5370\u306E\u82722(d.tone, idx) }),
|
|
7791
|
+
/* @__PURE__ */ jsx(
|
|
7792
|
+
"text",
|
|
7793
|
+
{
|
|
7794
|
+
x: PAD + \u5370\u306E\u5E452,
|
|
7795
|
+
y: y + 1,
|
|
7796
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
7797
|
+
fontWeight: 700,
|
|
7798
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7799
|
+
children: d.label
|
|
7800
|
+
}
|
|
7801
|
+
),
|
|
7802
|
+
/* @__PURE__ */ jsx(
|
|
7803
|
+
"text",
|
|
7804
|
+
{
|
|
7805
|
+
"data-cdl-role": "chart-waffle-count",
|
|
7806
|
+
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
7807
|
+
x: PAD + \u5370\u306E\u5E452,
|
|
7808
|
+
y: y + 20,
|
|
7809
|
+
fontSize: \u6570\u5024\u306E\u7D1A,
|
|
7810
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7811
|
+
children: \u6570\u5024\u306E\u6587\u5B57[idx]
|
|
7812
|
+
}
|
|
7813
|
+
)
|
|
7814
|
+
] }, `item-${idx}`);
|
|
7815
|
+
})
|
|
7816
|
+
] });
|
|
7817
|
+
}
|
|
7818
|
+
function \u5B9F\u5024\u8868\u8A185(v) {
|
|
7819
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
7820
|
+
}
|
|
7821
|
+
function \u5370\u306E\u82722(tone, idx) {
|
|
7822
|
+
if (tone) return TONE[tone];
|
|
7823
|
+
return chartSeriesColor(idx);
|
|
7824
|
+
}
|
|
7825
|
+
var SLICE_MIN_W_FOR_TEXT = 44;
|
|
7826
|
+
var SLICE_MIN_W_FOR_VALUE = 84;
|
|
7827
|
+
function ChartStackedBarNode({
|
|
7828
|
+
node,
|
|
7829
|
+
active,
|
|
7830
|
+
stateValues = {}
|
|
7831
|
+
}) {
|
|
7832
|
+
const x0 = node.cx - node.w / 2;
|
|
7833
|
+
const y0 = node.cy - node.h / 2;
|
|
7834
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
7835
|
+
const \u5E2F\u305F\u3061 = \u5E2F\u306E\u4E26\u3073(data);
|
|
7836
|
+
const PAD = 24;
|
|
7837
|
+
const \u540D\u524D\u306E\u7D1A = 13;
|
|
7838
|
+
const \u533A\u753B\u306E\u7D1A = 12;
|
|
7839
|
+
const \u6642\u70B9\u306E\u7D1A = 13;
|
|
7840
|
+
const \u6642\u70B9\u306E\u5E45 = Math.max(0, ...\u5E2F\u305F\u3061.map((b) => textWidth(b.\u540D\u524D, \u6642\u70B9\u306E\u7D1A))) + (\u5E2F\u305F\u3061.length > 1 ? 16 : 0);
|
|
7841
|
+
const \u5E2F\u306E\u5DE6 = PAD + \u6642\u70B9\u306E\u5E45;
|
|
7842
|
+
const \u5E2F\u306E\u5E45 = Math.max(40, node.w - \u5E2F\u306E\u5DE6 - PAD);
|
|
7843
|
+
const \u5E2F\u306E\u9AD8\u3055 = 44;
|
|
7844
|
+
const \u5E2F\u306E\u9593 = 20;
|
|
7845
|
+
const \u4E00\u89A7\u306E\u9AD8\u3055 = 26;
|
|
7846
|
+
const \u5168\u4F53\u306E\u9AD8\u3055 = \u5E2F\u305F\u3061.length * \u5E2F\u306E\u9AD8\u3055 + (\u5E2F\u305F\u3061.length - 1) * \u5E2F\u306E\u9593 + 16 + \u4E00\u89A7\u306E\u9AD8\u3055;
|
|
7847
|
+
const \u4E0A\u7AEF = Math.max(PAD, (node.h - \u5168\u4F53\u306E\u9AD8\u3055) / 2);
|
|
7848
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
7849
|
+
/* @__PURE__ */ jsx(
|
|
7850
|
+
"rect",
|
|
7851
|
+
{
|
|
7852
|
+
"data-cdl-role": "node-body",
|
|
7853
|
+
x: 0,
|
|
7854
|
+
y: 0,
|
|
7855
|
+
width: node.w,
|
|
7856
|
+
height: node.h,
|
|
7857
|
+
rx: 16,
|
|
7858
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
7859
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
7860
|
+
strokeWidth: active ? 3 : 1.25
|
|
7861
|
+
}
|
|
7862
|
+
),
|
|
7863
|
+
\u5E2F\u305F\u3061.map((\u5E2F, \u6BB5) => {
|
|
7864
|
+
const y = \u4E0A\u7AEF + \u6BB5 * (\u5E2F\u306E\u9AD8\u3055 + \u5E2F\u306E\u9593);
|
|
7865
|
+
let \u5DE6 = \u5E2F\u306E\u5DE6;
|
|
7866
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stacked-bar-row", children: [
|
|
7867
|
+
\u5E2F\u305F\u3061.length > 1 && /* @__PURE__ */ jsx(
|
|
7868
|
+
"text",
|
|
7869
|
+
{
|
|
7870
|
+
"data-cdl-role": "chart-stacked-bar-period",
|
|
7871
|
+
x: PAD,
|
|
7872
|
+
y: y + \u5E2F\u306E\u9AD8\u3055 / 2 + 4,
|
|
7873
|
+
fontSize: \u6642\u70B9\u306E\u7D1A,
|
|
7874
|
+
fontWeight: 700,
|
|
7875
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
7876
|
+
children: \u5E2F.\u540D\u524D
|
|
7877
|
+
}
|
|
7878
|
+
),
|
|
7879
|
+
\u5E2F.\u533A\u753B.map((s, idx) => {
|
|
7880
|
+
const w = \u5E2F\u306E\u5E45 * s.\u5272\u5408;
|
|
7881
|
+
const x = \u5DE6;
|
|
7882
|
+
\u5DE6 += w;
|
|
7883
|
+
const \u8272 = \u5370\u306E\u82723(s.tone, idx);
|
|
7884
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
7885
|
+
/* @__PURE__ */ jsx(
|
|
7886
|
+
"rect",
|
|
7887
|
+
{
|
|
7888
|
+
"data-cdl-role": "chart-stacked-bar-slice",
|
|
7889
|
+
"data-cdl-unresolved": s.unresolved ? "true" : void 0,
|
|
7890
|
+
x,
|
|
7891
|
+
y,
|
|
7892
|
+
width: Math.max(0, w),
|
|
7893
|
+
height: \u5E2F\u306E\u9AD8\u3055,
|
|
7894
|
+
fill: \u8272
|
|
7895
|
+
}
|
|
7896
|
+
),
|
|
7897
|
+
w >= SLICE_MIN_W_FOR_TEXT && /* @__PURE__ */ jsx(
|
|
7898
|
+
"text",
|
|
7899
|
+
{
|
|
7900
|
+
"data-cdl-role": "chart-stacked-bar-slice-text",
|
|
7901
|
+
x: x + w / 2,
|
|
7902
|
+
y: y + \u5E2F\u306E\u9AD8\u3055 / 2 + (w >= SLICE_MIN_W_FOR_VALUE ? -2 : 4),
|
|
7903
|
+
fontSize: \u533A\u753B\u306E\u7D1A,
|
|
7904
|
+
fontWeight: 700,
|
|
7905
|
+
textAnchor: "middle",
|
|
7906
|
+
fill: "#ffffff",
|
|
7907
|
+
children: \u5272\u5408\u8868\u8A185(s.\u5272\u5408)
|
|
7908
|
+
}
|
|
7909
|
+
),
|
|
7910
|
+
w >= SLICE_MIN_W_FOR_VALUE && /* @__PURE__ */ jsx(
|
|
7911
|
+
"text",
|
|
7912
|
+
{
|
|
7913
|
+
"data-cdl-role": "chart-stacked-bar-slice-value",
|
|
7914
|
+
x: x + w / 2,
|
|
7915
|
+
y: y + \u5E2F\u306E\u9AD8\u3055 / 2 + 13,
|
|
7916
|
+
fontSize: \u533A\u753B\u306E\u7D1A - 1,
|
|
7917
|
+
textAnchor: "middle",
|
|
7918
|
+
fill: "#ffffff",
|
|
7919
|
+
fillOpacity: 0.85,
|
|
7920
|
+
children: \u5B9F\u5024\u8868\u8A186(s.\u5B9F\u5024)
|
|
7921
|
+
}
|
|
7922
|
+
)
|
|
7923
|
+
] }, `slice-${idx}`);
|
|
7924
|
+
})
|
|
7925
|
+
] }, `bar-${\u6BB5}`);
|
|
7926
|
+
}),
|
|
7927
|
+
\u4E00\u89A7\u306E\u4E26\u3073(data, \u5E2F\u306E\u5DE6, node.w - PAD, \u540D\u524D\u306E\u7D1A).map(({ d, idx, x, \u884C }) => {
|
|
7928
|
+
const y = \u4E0A\u7AEF + \u5E2F\u305F\u3061.length * (\u5E2F\u306E\u9AD8\u3055 + \u5E2F\u306E\u9593) - \u5E2F\u306E\u9593 + 16 + \u4E00\u89A7\u306E\u9AD8\u3055 / 2 + \u884C * \u4E00\u89A7\u306E\u9AD8\u3055;
|
|
7929
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stacked-bar-legend", children: [
|
|
7930
|
+
/* @__PURE__ */ jsx("rect", { x, y: y - 5, width: 10, height: 10, rx: 2, fill: \u5370\u306E\u82723(d.tone, idx) }),
|
|
7931
|
+
/* @__PURE__ */ jsx(
|
|
7932
|
+
"text",
|
|
7933
|
+
{
|
|
7934
|
+
x: x + 16,
|
|
7935
|
+
y: y + 4,
|
|
7936
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
7937
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
7938
|
+
children: d.label
|
|
7939
|
+
}
|
|
7940
|
+
)
|
|
7941
|
+
] }, `legend-${idx}`);
|
|
7942
|
+
})
|
|
7943
|
+
] });
|
|
7944
|
+
}
|
|
7945
|
+
function \u5E2F\u306E\u4E26\u3073(data) {
|
|
7946
|
+
const \u524D\u3042\u308A = data.some((d) => d.previous !== void 0);
|
|
7947
|
+
const \u4ECA = \u5E2F\u3092\u7D44\u3080("\u4ECA", data, (d) => d.value);
|
|
7948
|
+
if (!\u524D\u3042\u308A) return [\u4ECA];
|
|
7949
|
+
return [\u5E2F\u3092\u7D44\u3080("\u524D", data, (d) => d.previous ?? 0), \u4ECA];
|
|
7950
|
+
}
|
|
7951
|
+
function \u5E2F\u3092\u7D44\u3080(\u540D\u524D, data, \u53D6\u308B) {
|
|
7952
|
+
const \u5024 = data.map((d) => Math.max(0, \u53D6\u308B(d)));
|
|
7953
|
+
const \u5408\u8A08 = \u5024.reduce((a, v) => a + v, 0);
|
|
7954
|
+
return {
|
|
7955
|
+
\u540D\u524D,
|
|
7956
|
+
\u533A\u753B: data.map((d, i) => ({
|
|
7957
|
+
// 合計 0 の帯は区画を持たない (0 で割らない)。 幅 0 の区画として並べる
|
|
7958
|
+
\u5272\u5408: \u5408\u8A08 > 0 ? \u5024[i] / \u5408\u8A08 : 0,
|
|
7959
|
+
\u5B9F\u5024: \u5024[i],
|
|
7960
|
+
tone: d.tone,
|
|
7961
|
+
...d.unresolved ? { unresolved: true } : {}
|
|
7962
|
+
}))
|
|
7963
|
+
};
|
|
7964
|
+
}
|
|
7965
|
+
function \u5B9F\u5024\u8868\u8A186(v) {
|
|
7966
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
7967
|
+
}
|
|
7968
|
+
function \u5272\u5408\u8868\u8A185(frac) {
|
|
7969
|
+
const v = Math.round(frac * 1e3) / 10;
|
|
7970
|
+
return `${Number.isInteger(v) ? v : v.toFixed(1)}%`;
|
|
7971
|
+
}
|
|
7972
|
+
function \u5370\u306E\u82723(tone, idx) {
|
|
7973
|
+
if (tone) return TONE[tone];
|
|
7974
|
+
return chartSeriesColor(idx);
|
|
7975
|
+
}
|
|
7976
|
+
var \u5370\u304B\u3089\u540D\u524D\u307E\u3067 = 16;
|
|
7977
|
+
var \u4EF6\u306E\u9593 = 10;
|
|
7978
|
+
function \u4E00\u89A7\u306E\u4E26\u3073(data, \u5DE6, \u53F3\u7AEF, \u7D1A) {
|
|
7979
|
+
const out = [];
|
|
7980
|
+
let x = \u5DE6;
|
|
7981
|
+
let \u884C = 0;
|
|
7982
|
+
data.forEach((d, idx) => {
|
|
7983
|
+
const \u5E45 = \u5370\u304B\u3089\u540D\u524D\u307E\u3067 + textWidth(d.label ?? "", \u7D1A);
|
|
7984
|
+
if (x > \u5DE6 && x + \u5E45 > \u53F3\u7AEF) {
|
|
7985
|
+
\u884C += 1;
|
|
7986
|
+
x = \u5DE6;
|
|
7987
|
+
}
|
|
7988
|
+
out.push({ d, idx, x, \u884C });
|
|
7989
|
+
x += \u5E45 + \u4EF6\u306E\u9593;
|
|
7990
|
+
});
|
|
7991
|
+
return out;
|
|
6947
7992
|
}
|
|
6948
7993
|
function ChartBarNode({
|
|
6949
7994
|
node,
|
|
@@ -6955,26 +8000,26 @@ function ChartBarNode({
|
|
|
6955
8000
|
const x0 = node.cx - node.w / 2;
|
|
6956
8001
|
const y0 = node.cy - node.h / 2;
|
|
6957
8002
|
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
6958
|
-
const
|
|
6959
|
-
const
|
|
6960
|
-
const
|
|
6961
|
-
const
|
|
6962
|
-
const canvasW = node.w -
|
|
6963
|
-
const canvasH = node.h -
|
|
8003
|
+
const PAD_TOP2 = 20;
|
|
8004
|
+
const PAD_RIGHT2 = 24;
|
|
8005
|
+
const PAD_BOTTOM2 = 44;
|
|
8006
|
+
const PAD_LEFT2 = 60;
|
|
8007
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
8008
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
6964
8009
|
const vMax = data.length > 0 ? Math.max(...data.map((d) => d.value)) : 1;
|
|
6965
8010
|
const vRange = vMax || 1;
|
|
6966
8011
|
const barGap = 10;
|
|
6967
8012
|
const barCount = data.length || 1;
|
|
6968
8013
|
const barW = (canvasW - barGap * (barCount + 1)) / barCount;
|
|
6969
|
-
const yAt = (v) =>
|
|
6970
|
-
const xAt = (idx) =>
|
|
8014
|
+
const yAt = (v) => PAD_TOP2 + canvasH - v / vRange * canvasH;
|
|
8015
|
+
const xAt = (idx) => PAD_LEFT2 + barGap + idx * (barW + barGap);
|
|
6971
8016
|
const gridCount = 4;
|
|
6972
8017
|
const gridTicks = Array.from({ length: gridCount + 1 }, (_, i) => {
|
|
6973
8018
|
const v = vMax * i / gridCount;
|
|
6974
8019
|
return { y: yAt(v), value: v };
|
|
6975
8020
|
});
|
|
6976
8021
|
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
6977
|
-
const \u6A2A\u8EF8\u306Ey =
|
|
8022
|
+
const \u6A2A\u8EF8\u306Ey = PAD_TOP2 + canvasH;
|
|
6978
8023
|
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
6979
8024
|
/* @__PURE__ */ jsx(
|
|
6980
8025
|
"rect",
|
|
@@ -6994,9 +8039,9 @@ function ChartBarNode({
|
|
|
6994
8039
|
/* @__PURE__ */ jsx(
|
|
6995
8040
|
"line",
|
|
6996
8041
|
{
|
|
6997
|
-
x1:
|
|
8042
|
+
x1: PAD_LEFT2,
|
|
6998
8043
|
y1: t.y,
|
|
6999
|
-
x2:
|
|
8044
|
+
x2: PAD_LEFT2 + canvasW,
|
|
7000
8045
|
y2: t.y,
|
|
7001
8046
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
7002
8047
|
strokeWidth: 0.75,
|
|
@@ -7007,7 +8052,7 @@ function ChartBarNode({
|
|
|
7007
8052
|
/* @__PURE__ */ jsx(
|
|
7008
8053
|
"text",
|
|
7009
8054
|
{
|
|
7010
|
-
x:
|
|
8055
|
+
x: PAD_LEFT2 - 8,
|
|
7011
8056
|
y: t.y + 4,
|
|
7012
8057
|
fontSize: 11,
|
|
7013
8058
|
textAnchor: "end",
|
|
@@ -7019,10 +8064,10 @@ function ChartBarNode({
|
|
|
7019
8064
|
/* @__PURE__ */ jsx(
|
|
7020
8065
|
"line",
|
|
7021
8066
|
{
|
|
7022
|
-
x1:
|
|
7023
|
-
y1:
|
|
7024
|
-
x2:
|
|
7025
|
-
y2:
|
|
8067
|
+
x1: PAD_LEFT2,
|
|
8068
|
+
y1: PAD_TOP2 + canvasH,
|
|
8069
|
+
x2: PAD_LEFT2 + canvasW,
|
|
8070
|
+
y2: PAD_TOP2 + canvasH,
|
|
7026
8071
|
stroke: "var(--cdl-text-mute, #8a8678)",
|
|
7027
8072
|
strokeWidth: 1.25
|
|
7028
8073
|
}
|
|
@@ -7030,7 +8075,7 @@ function ChartBarNode({
|
|
|
7030
8075
|
data.map((d, idx) => {
|
|
7031
8076
|
const bx = xAt(idx);
|
|
7032
8077
|
const by = yAt(d.value);
|
|
7033
|
-
const bh =
|
|
8078
|
+
const bh = PAD_TOP2 + canvasH - by;
|
|
7034
8079
|
const \u898B\u3048\u3066\u3044\u308B\u982D = \u6A2A\u8EF8\u306Ey - (\u6A2A\u8EF8\u306Ey - by) * \u4F38\u3073;
|
|
7035
8080
|
const \u68D2 = /* @__PURE__ */ jsx(
|
|
7036
8081
|
"rect",
|
|
@@ -7063,7 +8108,7 @@ function ChartBarNode({
|
|
|
7063
8108
|
"text",
|
|
7064
8109
|
{
|
|
7065
8110
|
x: bx + barW / 2,
|
|
7066
|
-
y:
|
|
8111
|
+
y: PAD_TOP2 + canvasH + 18,
|
|
7067
8112
|
fontSize: 12,
|
|
7068
8113
|
textAnchor: "middle",
|
|
7069
8114
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
@@ -7084,12 +8129,12 @@ function GanttNode({
|
|
|
7084
8129
|
const x0 = node.cx - node.w / 2;
|
|
7085
8130
|
const y0 = node.cy - node.h / 2;
|
|
7086
8131
|
const tasks = resolveGanttData(node.ganttData ?? [], stateValues);
|
|
7087
|
-
const
|
|
7088
|
-
const
|
|
7089
|
-
const
|
|
7090
|
-
const
|
|
7091
|
-
const canvasW = node.w -
|
|
7092
|
-
const canvasH = node.h -
|
|
8132
|
+
const PAD_TOP2 = 32;
|
|
8133
|
+
const PAD_RIGHT2 = 48;
|
|
8134
|
+
const PAD_BOTTOM2 = 44;
|
|
8135
|
+
const PAD_LEFT2 = 156;
|
|
8136
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
8137
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
7093
8138
|
const rowGap = 20;
|
|
7094
8139
|
const rowCount = tasks.length || 1;
|
|
7095
8140
|
const rowH = Math.max(28, (canvasH - rowGap * (rowCount + 1)) / rowCount);
|
|
@@ -7116,8 +8161,8 @@ function GanttNode({
|
|
|
7116
8161
|
const \u76EE\u76DB\u308A\u306E\u4E0A\u9650 = 200;
|
|
7117
8162
|
const \u76EE\u76DB\u308A\u306E\u9593\u9694 = Math.max(1, Math.ceil(maxIdx / \u76EE\u76DB\u308A\u306E\u4E0A\u9650));
|
|
7118
8163
|
const \u76EE\u76DB\u308A\u306E\u672C\u6570 = Math.ceil(maxIdx / \u76EE\u76DB\u308A\u306E\u9593\u9694);
|
|
7119
|
-
const xAt = (idx) =>
|
|
7120
|
-
const yAt = (row) =>
|
|
8164
|
+
const xAt = (idx) => PAD_LEFT2 + idx * cellW;
|
|
8165
|
+
const yAt = (row) => PAD_TOP2 + rowGap + row * (rowH + rowGap);
|
|
7121
8166
|
const \u540D\u524D = { \u6574\u6570\u306E\u958B\u59CB: /* @__PURE__ */ new Map(), \u6574\u6570\u306E\u7D42\u4E86: /* @__PURE__ */ new Map(), \u7AEF\u6570\u306E\u958B\u59CB: /* @__PURE__ */ new Map(), \u7AEF\u6570\u306E\u7D42\u4E86: /* @__PURE__ */ new Map() };
|
|
7122
8167
|
const \u7F6E\u304F = (\u8868, \u4F4D\u7F6E, label) => {
|
|
7123
8168
|
if (label !== "" && Number.isFinite(\u4F4D\u7F6E) && !\u8868.has(\u4F4D\u7F6E)) \u8868.set(\u4F4D\u7F6E, label);
|
|
@@ -7162,9 +8207,9 @@ function GanttNode({
|
|
|
7162
8207
|
{
|
|
7163
8208
|
"data-cdl-role": "gantt-grid",
|
|
7164
8209
|
x1: xAt(i),
|
|
7165
|
-
y1:
|
|
8210
|
+
y1: PAD_TOP2,
|
|
7166
8211
|
x2: xAt(i),
|
|
7167
|
-
y2:
|
|
8212
|
+
y2: PAD_TOP2 + canvasH,
|
|
7168
8213
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
7169
8214
|
strokeWidth: 0.75,
|
|
7170
8215
|
strokeDasharray: "3 3",
|
|
@@ -7176,7 +8221,7 @@ function GanttNode({
|
|
|
7176
8221
|
{
|
|
7177
8222
|
"data-cdl-role": "gantt-tick",
|
|
7178
8223
|
x: xAt(i) + cellW / 2,
|
|
7179
|
-
y:
|
|
8224
|
+
y: PAD_TOP2 + canvasH + 18,
|
|
7180
8225
|
fontSize: 11,
|
|
7181
8226
|
textAnchor: "middle",
|
|
7182
8227
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
@@ -7188,9 +8233,9 @@ function GanttNode({
|
|
|
7188
8233
|
"line",
|
|
7189
8234
|
{
|
|
7190
8235
|
x1: xAt(maxIdx),
|
|
7191
|
-
y1:
|
|
8236
|
+
y1: PAD_TOP2,
|
|
7192
8237
|
x2: xAt(maxIdx),
|
|
7193
|
-
y2:
|
|
8238
|
+
y2: PAD_TOP2 + canvasH,
|
|
7194
8239
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
7195
8240
|
strokeWidth: 0.75,
|
|
7196
8241
|
opacity: 0.5
|
|
@@ -7199,7 +8244,7 @@ function GanttNode({
|
|
|
7199
8244
|
\u6574\u3048\u305F.map((t, row) => /* @__PURE__ */ jsx(
|
|
7200
8245
|
"text",
|
|
7201
8246
|
{
|
|
7202
|
-
x:
|
|
8247
|
+
x: PAD_LEFT2 - 12,
|
|
7203
8248
|
y: yAt(row) + rowH / 2 + 4,
|
|
7204
8249
|
fontSize: 12,
|
|
7205
8250
|
textAnchor: "end",
|
|
@@ -7356,6 +8401,24 @@ function \u7BB1\u306B\u7A4D\u3080(\u884C, \u7BB1\u306E\u5E45, \u7BB1\u306E\u9AD8
|
|
|
7356
8401
|
}
|
|
7357
8402
|
var MIND_TONES = ["accent", "teal", "success", "warning", "info", "error"];
|
|
7358
8403
|
var MIND_BOX_GAP = 24;
|
|
8404
|
+
var MIND_PAD = 40;
|
|
8405
|
+
function \u653E\u5C04\u306E\u4E2D\u8EAB(node, stateValues = {}) {
|
|
8406
|
+
const mindData = node.mindData ? resolveMindData(node.mindData, stateValues) : void 0;
|
|
8407
|
+
if (!mindData) return void 0;
|
|
8408
|
+
return computeMindMapLayout(
|
|
8409
|
+
mindData,
|
|
8410
|
+
node.w / 2,
|
|
8411
|
+
node.h / 2,
|
|
8412
|
+
node.w - MIND_PAD * 2,
|
|
8413
|
+
node.h - MIND_PAD * 2
|
|
8414
|
+
);
|
|
8415
|
+
}
|
|
8416
|
+
function \u653E\u5C04\u306E\u884C(n) {
|
|
8417
|
+
return [
|
|
8418
|
+
{ \u5F79\u5272: "title", text: n.title, fontSize: n.isRoot ? 15 : 13 },
|
|
8419
|
+
{ \u5F79\u5272: "subtitle", text: n.subtitle ?? "", fontSize: 9 }
|
|
8420
|
+
];
|
|
8421
|
+
}
|
|
7359
8422
|
function MindMapNode({
|
|
7360
8423
|
node,
|
|
7361
8424
|
active,
|
|
@@ -7365,14 +8428,8 @@ function MindMapNode({
|
|
|
7365
8428
|
}) {
|
|
7366
8429
|
const x0 = node.cx - node.w / 2;
|
|
7367
8430
|
const y0 = node.cy - node.h / 2;
|
|
7368
|
-
const
|
|
7369
|
-
if (!
|
|
7370
|
-
const PAD = 40;
|
|
7371
|
-
const canvasCx = node.w / 2;
|
|
7372
|
-
const canvasCy = node.h / 2;
|
|
7373
|
-
const canvasW = node.w - PAD * 2;
|
|
7374
|
-
const canvasH = node.h - PAD * 2;
|
|
7375
|
-
const layout2 = computeMindMapLayout(mindData, canvasCx, canvasCy, canvasW, canvasH);
|
|
8431
|
+
const layout2 = \u653E\u5C04\u306E\u4E2D\u8EAB(node, stateValues);
|
|
8432
|
+
if (!layout2) return /* @__PURE__ */ jsx("g", { transform: `translate(${x0} ${y0})` });
|
|
7376
8433
|
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
7377
8434
|
const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
|
|
7378
8435
|
const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
|
|
@@ -7410,16 +8467,11 @@ function MindMapNode({
|
|
|
7410
8467
|
}),
|
|
7411
8468
|
layout2.nodes.map((n) => {
|
|
7412
8469
|
if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
|
|
7413
|
-
const \
|
|
7414
|
-
|
|
7415
|
-
{ \u5F79\u5272: "title", text: n.title, fontSize: n.isRoot ? 15 : 13 },
|
|
7416
|
-
{ \u5F79\u5272: "subtitle", text: n.subtitle ?? "", fontSize: 9 }
|
|
7417
|
-
],
|
|
7418
|
-
n.w,
|
|
7419
|
-
n.h
|
|
7420
|
-
);
|
|
8470
|
+
const \u6750\u6599 = \u653E\u5C04\u306E\u884C(n);
|
|
8471
|
+
const \u884C = \u7BB1\u306B\u7A4D\u3080(\u6750\u6599, n.w, n.h);
|
|
7421
8472
|
const \u88DC\u8DB3\u3042\u308A = (n.subtitle ?? "").trim() !== "";
|
|
7422
|
-
const \
|
|
8473
|
+
const \u540D\u524D = \u6750\u6599[0];
|
|
8474
|
+
const \u53CE\u3081\u305F\u540D\u524D = \u88DC\u8DB3\u3042\u308A ? void 0 : \u5E45\u306B\u53CE\u3081\u308B(\u540D\u524D.text, \u540D\u524D.fontSize, \u4F7F\u3048\u308B\u5E45(n.w));
|
|
7423
8475
|
const \u6587\u5B57\u306E\u8272 = n.isRoot ? "var(--cdl-text-on-tone, #ffffff)" : "var(--cdl-chip-text, #1a1f2a)";
|
|
7424
8476
|
return /* @__PURE__ */ jsxs("g", { "data-cdl-unresolved": n.unresolved ? "true" : void 0, children: [
|
|
7425
8477
|
/* @__PURE__ */ jsx(
|
|
@@ -7698,13 +8750,13 @@ function FunnelNode({
|
|
|
7698
8750
|
const x0 = node.cx - node.w / 2;
|
|
7699
8751
|
const y0 = node.cy - node.h / 2;
|
|
7700
8752
|
const stages = resolveFunnelData(node.funnelData ?? [], stateValues);
|
|
7701
|
-
const
|
|
7702
|
-
const
|
|
7703
|
-
const
|
|
7704
|
-
const
|
|
8753
|
+
const PAD_TOP2 = 32;
|
|
8754
|
+
const PAD_RIGHT2 = 24;
|
|
8755
|
+
const PAD_BOTTOM2 = 32;
|
|
8756
|
+
const PAD_LEFT2 = 24;
|
|
7705
8757
|
const legendW = 160;
|
|
7706
|
-
const canvasW = node.w -
|
|
7707
|
-
const canvasH = node.h -
|
|
8758
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2 - legendW;
|
|
8759
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
7708
8760
|
const stageCount = stages.length || 1;
|
|
7709
8761
|
const gap = 4;
|
|
7710
8762
|
const stageH = (canvasH - gap * (stageCount - 1)) / stageCount;
|
|
@@ -7724,15 +8776,15 @@ function FunnelNode({
|
|
|
7724
8776
|
const \u6BB5 = stages.map((s, idx) => {
|
|
7725
8777
|
const prev = idx > 0 ? stages[idx - 1] : null;
|
|
7726
8778
|
const dropRate = prev && prev.count > 0 ? (prev.count - s.count) / prev.count * 100 : 0;
|
|
7727
|
-
const y =
|
|
8779
|
+
const y = PAD_TOP2 + idx * (stageH + gap);
|
|
7728
8780
|
const topW = widthAtStep(idx);
|
|
7729
8781
|
const bottomW = widthAtStep(idx + 1);
|
|
7730
|
-
const cx =
|
|
8782
|
+
const cx = PAD_LEFT2 + canvasW / 2;
|
|
7731
8783
|
const topX = cx - topW / 2;
|
|
7732
8784
|
const bottomX = cx - bottomW / 2;
|
|
7733
8785
|
const points = `${topX},${y} ${topX + topW},${y} ${bottomX + bottomW},${y + stageH} ${bottomX},${y + stageH}`;
|
|
7734
8786
|
const tone = toneByIndex(idx);
|
|
7735
|
-
const legendX =
|
|
8787
|
+
const legendX = PAD_LEFT2 + canvasW + 24;
|
|
7736
8788
|
return /* @__PURE__ */ jsxs("g", { children: [
|
|
7737
8789
|
/* @__PURE__ */ jsx(
|
|
7738
8790
|
"polygon",
|
|
@@ -7796,7 +8848,7 @@ function FunnelNode({
|
|
|
7796
8848
|
strokeWidth: active ? 3 : 1.25
|
|
7797
8849
|
}
|
|
7798
8850
|
),
|
|
7799
|
-
drawing && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: /* @__PURE__ */ jsx("rect", { x: 0, y: 0, width: node.w, height:
|
|
8851
|
+
drawing && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: /* @__PURE__ */ jsx("rect", { x: 0, y: 0, width: node.w, height: PAD_TOP2 + canvasH * \u4F38\u3073 }) }) }),
|
|
7800
8852
|
drawing ? /* @__PURE__ */ jsx("g", { clipPath: `url(#${\u5207\u308A\u629C\u304Did})`, children: \u6BB5 }) : \u6BB5
|
|
7801
8853
|
] });
|
|
7802
8854
|
}
|
|
@@ -7821,8 +8873,8 @@ function QuadrantNode({
|
|
|
7821
8873
|
const raw = node.quadrantData;
|
|
7822
8874
|
if (!raw) return /* @__PURE__ */ jsx("g", { transform: `translate(${x0} ${y0})` });
|
|
7823
8875
|
const data = resolveQuadrantData(raw, stateValues);
|
|
7824
|
-
const
|
|
7825
|
-
const
|
|
8876
|
+
const PAD_TOP2 = 40;
|
|
8877
|
+
const PAD_BOTTOM2 = 56;
|
|
7826
8878
|
const AXIS_LABEL_FONT = 12;
|
|
7827
8879
|
const PAD_MIN = 60;
|
|
7828
8880
|
const ITEM_FONT = 13;
|
|
@@ -7834,12 +8886,12 @@ function QuadrantNode({
|
|
|
7834
8886
|
const wantRight = axisLabelPad(data.xAxis.right) - PAD_MIN;
|
|
7835
8887
|
const wantTotal = wantLeft + wantRight;
|
|
7836
8888
|
const padScale = wantTotal > padBudget && wantTotal > 0 ? padBudget / wantTotal : 1;
|
|
7837
|
-
const
|
|
7838
|
-
const
|
|
7839
|
-
const canvasW = node.w -
|
|
7840
|
-
const canvasH = node.h -
|
|
7841
|
-
const cx =
|
|
7842
|
-
const cy =
|
|
8889
|
+
const PAD_LEFT2 = PAD_MIN + wantLeft * padScale;
|
|
8890
|
+
const PAD_RIGHT2 = PAD_MIN + wantRight * padScale;
|
|
8891
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
8892
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
8893
|
+
const cx = PAD_LEFT2 + canvasW / 2;
|
|
8894
|
+
const cy = PAD_TOP2 + canvasH / 2;
|
|
7843
8895
|
const halfW = canvasW / 2;
|
|
7844
8896
|
const halfH = canvasH / 2;
|
|
7845
8897
|
const itemsBy = {
|
|
@@ -7875,16 +8927,16 @@ function QuadrantNode({
|
|
|
7875
8927
|
strokeWidth: active ? 3 : 1.25
|
|
7876
8928
|
}
|
|
7877
8929
|
),
|
|
7878
|
-
/* @__PURE__ */ jsx("rect", { "data-cdl-role": "quadrant-bg", x:
|
|
7879
|
-
/* @__PURE__ */ jsx("rect", { "data-cdl-role": "quadrant-bg", x: cx, y:
|
|
7880
|
-
/* @__PURE__ */ jsx("rect", { "data-cdl-role": "quadrant-bg", x:
|
|
8930
|
+
/* @__PURE__ */ jsx("rect", { "data-cdl-role": "quadrant-bg", x: PAD_LEFT2, y: PAD_TOP2, width: halfW, height: halfH, ...quadrantColor.topLeft }),
|
|
8931
|
+
/* @__PURE__ */ jsx("rect", { "data-cdl-role": "quadrant-bg", x: cx, y: PAD_TOP2, width: halfW, height: halfH, ...quadrantColor.topRight }),
|
|
8932
|
+
/* @__PURE__ */ jsx("rect", { "data-cdl-role": "quadrant-bg", x: PAD_LEFT2, y: cy, width: halfW, height: halfH, ...quadrantColor.bottomLeft }),
|
|
7881
8933
|
/* @__PURE__ */ jsx("rect", { "data-cdl-role": "quadrant-bg", x: cx, y: cy, width: halfW, height: halfH, ...quadrantColor.bottomRight }),
|
|
7882
8934
|
/* @__PURE__ */ jsx(
|
|
7883
8935
|
"rect",
|
|
7884
8936
|
{
|
|
7885
8937
|
"data-cdl-role": "quadrant-canvas",
|
|
7886
|
-
x:
|
|
7887
|
-
y:
|
|
8938
|
+
x: PAD_LEFT2,
|
|
8939
|
+
y: PAD_TOP2,
|
|
7888
8940
|
width: canvasW,
|
|
7889
8941
|
height: canvasH,
|
|
7890
8942
|
fill: "none",
|
|
@@ -7893,25 +8945,25 @@ function QuadrantNode({
|
|
|
7893
8945
|
rx: 8
|
|
7894
8946
|
}
|
|
7895
8947
|
),
|
|
7896
|
-
/* @__PURE__ */ jsx("line", { x1: cx, y1:
|
|
7897
|
-
/* @__PURE__ */ jsx("line", { x1:
|
|
7898
|
-
/* @__PURE__ */ jsx("text", { x:
|
|
7899
|
-
/* @__PURE__ */ jsx("text", { x: cx + halfW / 2, y:
|
|
7900
|
-
/* @__PURE__ */ jsx("text", { x:
|
|
7901
|
-
/* @__PURE__ */ jsx("text", { x: cx + halfW / 2, y:
|
|
7902
|
-
/* @__PURE__ */ jsxs("text", { x: cx, y:
|
|
8948
|
+
/* @__PURE__ */ jsx("line", { x1: cx, y1: PAD_TOP2, x2: cx, y2: PAD_TOP2 + canvasH, stroke: "var(--cdl-text-mute, #8a8678)", strokeWidth: 1.5 }),
|
|
8949
|
+
/* @__PURE__ */ jsx("line", { x1: PAD_LEFT2, y1: cy, x2: PAD_LEFT2 + canvasW, y2: cy, stroke: "var(--cdl-text-mute, #8a8678)", strokeWidth: 1.5 }),
|
|
8950
|
+
/* @__PURE__ */ jsx("text", { x: PAD_LEFT2 + halfW / 2, y: PAD_TOP2 + 22, fontSize: 13, fontWeight: 700, textAnchor: "middle", fill: quadrantAccent.topLeft, children: data.quadrantLabels.topLeft }),
|
|
8951
|
+
/* @__PURE__ */ jsx("text", { x: cx + halfW / 2, y: PAD_TOP2 + 22, fontSize: 13, fontWeight: 700, textAnchor: "middle", fill: quadrantAccent.topRight, children: data.quadrantLabels.topRight }),
|
|
8952
|
+
/* @__PURE__ */ jsx("text", { x: PAD_LEFT2 + halfW / 2, y: PAD_TOP2 + canvasH - 12, fontSize: 13, fontWeight: 700, textAnchor: "middle", fill: quadrantAccent.bottomLeft, children: data.quadrantLabels.bottomLeft }),
|
|
8953
|
+
/* @__PURE__ */ jsx("text", { x: cx + halfW / 2, y: PAD_TOP2 + canvasH - 12, fontSize: 13, fontWeight: 700, textAnchor: "middle", fill: quadrantAccent.bottomRight, children: data.quadrantLabels.bottomRight }),
|
|
8954
|
+
/* @__PURE__ */ jsxs("text", { x: cx, y: PAD_TOP2 - 12, fontSize: 12, fontWeight: 700, textAnchor: "middle", fill: "var(--cdl-text-dim, #5a6270)", children: [
|
|
7903
8955
|
"\u2191 ",
|
|
7904
8956
|
data.yAxis.top
|
|
7905
8957
|
] }),
|
|
7906
|
-
/* @__PURE__ */ jsxs("text", { x: cx, y:
|
|
8958
|
+
/* @__PURE__ */ jsxs("text", { x: cx, y: PAD_TOP2 + canvasH + 24, fontSize: 12, fontWeight: 700, textAnchor: "middle", fill: "var(--cdl-text-dim, #5a6270)", children: [
|
|
7907
8959
|
"\u2193 ",
|
|
7908
8960
|
data.yAxis.bottom
|
|
7909
8961
|
] }),
|
|
7910
|
-
/* @__PURE__ */ jsxs("text", { x:
|
|
8962
|
+
/* @__PURE__ */ jsxs("text", { x: PAD_LEFT2 - 12, y: cy + 4, fontSize: AXIS_LABEL_FONT, fontWeight: 700, textAnchor: "end", fill: "var(--cdl-text-dim, #5a6270)", children: [
|
|
7911
8963
|
"\u2190 ",
|
|
7912
8964
|
data.xAxis.left
|
|
7913
8965
|
] }),
|
|
7914
|
-
/* @__PURE__ */ jsxs("text", { x:
|
|
8966
|
+
/* @__PURE__ */ jsxs("text", { x: PAD_LEFT2 + canvasW + 12, y: cy + 4, fontSize: AXIS_LABEL_FONT, fontWeight: 700, textAnchor: "start", fill: "var(--cdl-text-dim, #5a6270)", children: [
|
|
7915
8967
|
data.xAxis.right,
|
|
7916
8968
|
" \u2192"
|
|
7917
8969
|
] }),
|
|
@@ -7920,8 +8972,8 @@ function QuadrantNode({
|
|
|
7920
8972
|
if (items.length === 0) return null;
|
|
7921
8973
|
const isLeft = q === "topLeft" || q === "bottomLeft";
|
|
7922
8974
|
const isTop = q === "topLeft" || q === "topRight";
|
|
7923
|
-
const qxStart = (isLeft ?
|
|
7924
|
-
const qyStart = (isTop ?
|
|
8975
|
+
const qxStart = (isLeft ? PAD_LEFT2 : cx) + 18;
|
|
8976
|
+
const qyStart = (isTop ? PAD_TOP2 : cy) + 44;
|
|
7925
8977
|
const qHalfW = halfW - 36;
|
|
7926
8978
|
const \u67A0\u306E\u4F59\u5730 = qHalfW;
|
|
7927
8979
|
if (\u67A0\u306E\u4F59\u5730 <= 0) return null;
|
|
@@ -7980,6 +9032,24 @@ function \u7BB1\u306E\u6587\u5B57({
|
|
|
7980
9032
|
r.\u5F79\u5272
|
|
7981
9033
|
));
|
|
7982
9034
|
}
|
|
9035
|
+
var PAD_TOP = 40;
|
|
9036
|
+
var PAD_RIGHT = 24;
|
|
9037
|
+
var PAD_BOTTOM = 40;
|
|
9038
|
+
var PAD_LEFT = 24;
|
|
9039
|
+
function \u6728\u306E\u4E2D\u8EAB(node, stateValues = {}) {
|
|
9040
|
+
const treeNodes = resolveTreeData(node.treeData ?? [], stateValues);
|
|
9041
|
+
return computeTreeLayout(
|
|
9042
|
+
treeNodes,
|
|
9043
|
+
node.w - PAD_LEFT - PAD_RIGHT,
|
|
9044
|
+
node.h - PAD_TOP - PAD_BOTTOM
|
|
9045
|
+
);
|
|
9046
|
+
}
|
|
9047
|
+
function \u6728\u306E\u884C(n) {
|
|
9048
|
+
return [
|
|
9049
|
+
{ \u5F79\u5272: "title", text: n.title, fontSize: n.depth === 0 ? 13 : 12 },
|
|
9050
|
+
{ \u5F79\u5272: "subtitle", text: n.subtitle ?? "", fontSize: 9 }
|
|
9051
|
+
];
|
|
9052
|
+
}
|
|
7983
9053
|
function TreeNode({
|
|
7984
9054
|
node,
|
|
7985
9055
|
active,
|
|
@@ -7989,15 +9059,8 @@ function TreeNode({
|
|
|
7989
9059
|
}) {
|
|
7990
9060
|
const x0 = node.cx - node.w / 2;
|
|
7991
9061
|
const y0 = node.cy - node.h / 2;
|
|
7992
|
-
const treeNodes = resolveTreeData(node.treeData ?? [], stateValues);
|
|
7993
9062
|
const gradientId = `tree-root-grad-${node.id}`;
|
|
7994
|
-
const
|
|
7995
|
-
const PAD_RIGHT = 24;
|
|
7996
|
-
const PAD_BOTTOM = 40;
|
|
7997
|
-
const PAD_LEFT = 24;
|
|
7998
|
-
const canvasW = node.w - PAD_LEFT - PAD_RIGHT;
|
|
7999
|
-
const canvasH = node.h - PAD_TOP - PAD_BOTTOM;
|
|
8000
|
-
const layout2 = computeTreeLayout(treeNodes, canvasW, canvasH);
|
|
9063
|
+
const layout2 = \u6728\u306E\u4E2D\u8EAB(node, stateValues);
|
|
8001
9064
|
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
8002
9065
|
const \u6700\u5927\u6DF1\u3055 = layout2.nodes.reduce((m, n) => Math.max(m, n.depth), 0);
|
|
8003
9066
|
const \u7BB1\u304C\u51FA\u308B = (\u6DF1\u3055) => !drawing || \u6BB5\u306E\u4F38\u3073(\u4F38\u3073, \u6DF1\u3055, \u6700\u5927\u6DF1\u3055) >= 1;
|
|
@@ -8050,16 +9113,11 @@ function TreeNode({
|
|
|
8050
9113
|
if (!\u7BB1\u304C\u51FA\u308B(n.depth)) return null;
|
|
8051
9114
|
const accent = depthColors[Math.min(n.depth, depthColors.length - 1)] ?? depthColors[0];
|
|
8052
9115
|
const isRoot = n.depth === 0;
|
|
8053
|
-
const \
|
|
8054
|
-
|
|
8055
|
-
{ \u5F79\u5272: "title", text: n.title, fontSize: isRoot ? 13 : 12 },
|
|
8056
|
-
{ \u5F79\u5272: "subtitle", text: n.subtitle ?? "", fontSize: 9 }
|
|
8057
|
-
],
|
|
8058
|
-
n.w,
|
|
8059
|
-
n.h
|
|
8060
|
-
);
|
|
9116
|
+
const \u6750\u6599 = \u6728\u306E\u884C(n);
|
|
9117
|
+
const \u884C = \u7BB1\u306B\u7A4D\u3080(\u6750\u6599, n.w, n.h);
|
|
8061
9118
|
const \u88DC\u8DB3\u3042\u308A = (n.subtitle ?? "").trim() !== "";
|
|
8062
|
-
const \
|
|
9119
|
+
const \u540D\u524D = \u6750\u6599[0];
|
|
9120
|
+
const \u53CE\u3081\u305F\u540D\u524D = \u88DC\u8DB3\u3042\u308A ? void 0 : \u5E45\u306B\u53CE\u3081\u308B(\u540D\u524D.text, \u540D\u524D.fontSize, \u4F7F\u3048\u308B\u5E45(n.w));
|
|
8063
9121
|
return /* @__PURE__ */ jsx(
|
|
8064
9122
|
"g",
|
|
8065
9123
|
{
|
|
@@ -8265,12 +9323,12 @@ function UserJourneyNode({
|
|
|
8265
9323
|
const x0 = node.cx - node.w / 2;
|
|
8266
9324
|
const y0 = node.cy - node.h / 2;
|
|
8267
9325
|
const steps = resolveJourneyData(node.journeyData ?? [], stateValues);
|
|
8268
|
-
const
|
|
8269
|
-
const
|
|
8270
|
-
const
|
|
8271
|
-
const
|
|
8272
|
-
const canvasW = node.w -
|
|
8273
|
-
const canvasH = node.h -
|
|
9326
|
+
const PAD_TOP2 = 20;
|
|
9327
|
+
const PAD_RIGHT2 = 32;
|
|
9328
|
+
const PAD_BOTTOM2 = 108;
|
|
9329
|
+
const PAD_LEFT2 = 108;
|
|
9330
|
+
const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
|
|
9331
|
+
const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
8274
9332
|
const emotionRows = ["delighted", "happy", "neutral", "frustrated", "angry"];
|
|
8275
9333
|
const emotionScore = {
|
|
8276
9334
|
delighted: 4,
|
|
@@ -8295,8 +9353,8 @@ function UserJourneyNode({
|
|
|
8295
9353
|
};
|
|
8296
9354
|
const rowH = canvasH / 5;
|
|
8297
9355
|
const colW = canvasW / Math.max(steps.length, 1);
|
|
8298
|
-
const xAt = (idx) =>
|
|
8299
|
-
const yAt = (emotion) =>
|
|
9356
|
+
const xAt = (idx) => PAD_LEFT2 + (steps.length <= 1 ? canvasW / 2 : colW / 2 + colW * idx);
|
|
9357
|
+
const yAt = (emotion) => PAD_TOP2 + rowH / 2 + (4 - emotionScore[emotion]) * rowH;
|
|
8300
9358
|
const pts = steps.map((s, i) => ({ x: xAt(i), y: yAt(s.emotion) }));
|
|
8301
9359
|
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
8302
9360
|
const \u6BB5\u307E\u3067\u306E\u5272\u5408 = \u30D9\u30B8\u30A8\u306E\u7D2F\u7A4D\u5272\u5408(pts, (\u524D, \u5F8C) => {
|
|
@@ -8330,8 +9388,8 @@ function UserJourneyNode({
|
|
|
8330
9388
|
"rect",
|
|
8331
9389
|
{
|
|
8332
9390
|
"data-cdl-role": "journey-band",
|
|
8333
|
-
x:
|
|
8334
|
-
y:
|
|
9391
|
+
x: PAD_LEFT2,
|
|
9392
|
+
y: PAD_TOP2 + i * rowH,
|
|
8335
9393
|
width: canvasW,
|
|
8336
9394
|
height: rowH,
|
|
8337
9395
|
fill: emotionColor[e],
|
|
@@ -8341,8 +9399,8 @@ function UserJourneyNode({
|
|
|
8341
9399
|
/* @__PURE__ */ jsx(
|
|
8342
9400
|
"text",
|
|
8343
9401
|
{
|
|
8344
|
-
x:
|
|
8345
|
-
y:
|
|
9402
|
+
x: PAD_LEFT2 - 84,
|
|
9403
|
+
y: PAD_TOP2 + i * rowH + rowH / 2 + 5,
|
|
8346
9404
|
fontSize: 18,
|
|
8347
9405
|
textAnchor: "middle",
|
|
8348
9406
|
children: emotionEmoji[e]
|
|
@@ -8351,8 +9409,8 @@ function UserJourneyNode({
|
|
|
8351
9409
|
/* @__PURE__ */ jsx(
|
|
8352
9410
|
"text",
|
|
8353
9411
|
{
|
|
8354
|
-
x:
|
|
8355
|
-
y:
|
|
9412
|
+
x: PAD_LEFT2 - 14,
|
|
9413
|
+
y: PAD_TOP2 + i * rowH + rowH / 2 + 4,
|
|
8356
9414
|
fontSize: 12,
|
|
8357
9415
|
fontWeight: 600,
|
|
8358
9416
|
textAnchor: "end",
|
|
@@ -8366,9 +9424,9 @@ function UserJourneyNode({
|
|
|
8366
9424
|
{
|
|
8367
9425
|
"data-cdl-role": "node-column-divider",
|
|
8368
9426
|
x1: xAt(idx),
|
|
8369
|
-
y1:
|
|
9427
|
+
y1: PAD_TOP2,
|
|
8370
9428
|
x2: xAt(idx),
|
|
8371
|
-
y2:
|
|
9429
|
+
y2: PAD_TOP2 + canvasH,
|
|
8372
9430
|
stroke: "var(--cdl-row-divider, #7e848e)",
|
|
8373
9431
|
strokeDasharray: "4 4"
|
|
8374
9432
|
},
|
|
@@ -8432,7 +9490,7 @@ function UserJourneyNode({
|
|
|
8432
9490
|
"text",
|
|
8433
9491
|
{
|
|
8434
9492
|
x: xAt(idx),
|
|
8435
|
-
y:
|
|
9493
|
+
y: PAD_TOP2 + canvasH + 24,
|
|
8436
9494
|
fontSize: 12,
|
|
8437
9495
|
fontWeight: 700,
|
|
8438
9496
|
textAnchor: "middle",
|
|
@@ -8446,7 +9504,7 @@ function UserJourneyNode({
|
|
|
8446
9504
|
{
|
|
8447
9505
|
"data-cdl-role": "journey-chip",
|
|
8448
9506
|
x: xAt(idx) - 40,
|
|
8449
|
-
y:
|
|
9507
|
+
y: PAD_TOP2 + canvasH + 34,
|
|
8450
9508
|
width: 80,
|
|
8451
9509
|
height: 20,
|
|
8452
9510
|
rx: 10,
|
|
@@ -8461,7 +9519,7 @@ function UserJourneyNode({
|
|
|
8461
9519
|
"text",
|
|
8462
9520
|
{
|
|
8463
9521
|
x: xAt(idx),
|
|
8464
|
-
y:
|
|
9522
|
+
y: PAD_TOP2 + canvasH + 48,
|
|
8465
9523
|
fontSize: 10,
|
|
8466
9524
|
fontWeight: 600,
|
|
8467
9525
|
textAnchor: "middle",
|
|
@@ -8475,7 +9533,7 @@ function UserJourneyNode({
|
|
|
8475
9533
|
"rect",
|
|
8476
9534
|
{
|
|
8477
9535
|
x: xAt(idx) - 55,
|
|
8478
|
-
y:
|
|
9536
|
+
y: PAD_TOP2 + canvasH + 62,
|
|
8479
9537
|
width: 110,
|
|
8480
9538
|
height: 26,
|
|
8481
9539
|
rx: 13,
|
|
@@ -8488,7 +9546,7 @@ function UserJourneyNode({
|
|
|
8488
9546
|
"text",
|
|
8489
9547
|
{
|
|
8490
9548
|
x: xAt(idx),
|
|
8491
|
-
y:
|
|
9549
|
+
y: PAD_TOP2 + canvasH + 79,
|
|
8492
9550
|
fontSize: 10,
|
|
8493
9551
|
textAnchor: "middle",
|
|
8494
9552
|
fill: "var(--cdl-note-text, #7a5320)",
|
|
@@ -12481,6 +13539,16 @@ function CdlNodeView({
|
|
|
12481
13539
|
progress
|
|
12482
13540
|
}
|
|
12483
13541
|
);
|
|
13542
|
+
case "chart-gauge":
|
|
13543
|
+
return /* @__PURE__ */ jsx(ChartGaugeNode, { node: resolvedNode, active, stateValues });
|
|
13544
|
+
case "chart-stacked-bar":
|
|
13545
|
+
return /* @__PURE__ */ jsx(ChartStackedBarNode, { node: resolvedNode, active, stateValues });
|
|
13546
|
+
case "chart-waffle":
|
|
13547
|
+
return /* @__PURE__ */ jsx(ChartWaffleNode, { node: resolvedNode, active, stateValues });
|
|
13548
|
+
case "chart-stat":
|
|
13549
|
+
return /* @__PURE__ */ jsx(ChartStatNode, { node: resolvedNode, active, stateValues });
|
|
13550
|
+
case "chart-radial":
|
|
13551
|
+
return /* @__PURE__ */ jsx(ChartRadialNode, { node: resolvedNode, active, stateValues });
|
|
12484
13552
|
case "chart-bar":
|
|
12485
13553
|
return /* @__PURE__ */ jsx(
|
|
12486
13554
|
ChartBarNode,
|
|
@@ -12647,6 +13715,10 @@ function CdlNodeView({
|
|
|
12647
13715
|
return /* @__PURE__ */ jsx(ShapeTraderNode, { node: resolvedNode, active });
|
|
12648
13716
|
case "shape-customer-service":
|
|
12649
13717
|
return /* @__PURE__ */ jsx(ShapeCustomerServiceNode, { node: resolvedNode, active });
|
|
13718
|
+
case "mark-start":
|
|
13719
|
+
return /* @__PURE__ */ jsx(MarkStartNode, { node: resolvedNode, active });
|
|
13720
|
+
case "mark-end":
|
|
13721
|
+
return /* @__PURE__ */ jsx(MarkEndNode, { node: resolvedNode, active });
|
|
12650
13722
|
default:
|
|
12651
13723
|
return /* @__PURE__ */ jsx(GenericNode, { node: resolvedNode, active, value: node.value, stateValues });
|
|
12652
13724
|
}
|
|
@@ -12716,6 +13788,21 @@ function uniformLifelineEndY(lanes, nodes, starts = lifelineStartYs(nodes)) {
|
|
|
12716
13788
|
if (footerTops.length > 0) return Math.min(...footerTops);
|
|
12717
13789
|
return lifelineLanes[0] ? lifelineLanes[0].y + lifelineLanes[0].height : 0;
|
|
12718
13790
|
}
|
|
13791
|
+
|
|
13792
|
+
// src/kinds/draw-ratio.ts
|
|
13793
|
+
var DRAW_RATIO_DEFAULT = 1;
|
|
13794
|
+
function \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio) {
|
|
13795
|
+
if (ratio === void 0) return DRAW_RATIO_DEFAULT;
|
|
13796
|
+
if (!Number.isFinite(ratio)) return DRAW_RATIO_DEFAULT;
|
|
13797
|
+
if (ratio <= 0 || ratio > 1) return DRAW_RATIO_DEFAULT;
|
|
13798
|
+
return ratio;
|
|
13799
|
+
}
|
|
13800
|
+
function \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, ratio) {
|
|
13801
|
+
const \u5272\u5408 = \u63CF\u304F\u5272\u5408\u3092\u6B63\u3059(ratio);
|
|
13802
|
+
if (\u5272\u5408 === DRAW_RATIO_DEFAULT) return progress;
|
|
13803
|
+
if (!Number.isFinite(progress)) return progress;
|
|
13804
|
+
return Math.min(1, progress / \u5272\u5408);
|
|
13805
|
+
}
|
|
12719
13806
|
function CdlStage({
|
|
12720
13807
|
laid,
|
|
12721
13808
|
currentPhase,
|
|
@@ -12727,6 +13814,7 @@ function CdlStage({
|
|
|
12727
13814
|
}) {
|
|
12728
13815
|
const activeSet = new Set(currentPhase?.activate ?? []);
|
|
12729
13816
|
const drawSet = new Set(currentPhase?.draw ?? []);
|
|
13817
|
+
const \u63CF\u304F\u9032\u307F = \u63CF\u304F\u9032\u307F\u306B\u76F4\u3059(progress, currentPhase?.drawRatio);
|
|
12730
13818
|
const { lifelineStarts, uniformFooterTop } = useMemo(() => {
|
|
12731
13819
|
const starts = lifelineStartYs(laid.nodes);
|
|
12732
13820
|
return {
|
|
@@ -12751,21 +13839,38 @@ function CdlStage({
|
|
|
12751
13839
|
children: [
|
|
12752
13840
|
/* @__PURE__ */ jsxs("defs", { children: [
|
|
12753
13841
|
Object.entries(TONE).flatMap(
|
|
12754
|
-
([tone, color]) => [["", 14], ["-sm", 10]].
|
|
12755
|
-
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12765
|
-
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
13842
|
+
([tone, color]) => [["", 14], ["-sm", 10]].flatMap(
|
|
13843
|
+
([suffix, size]) => EDGE_HEADS.map((head) => {
|
|
13844
|
+
const \u5F62 = EDGE_HEAD_SHAPE[head];
|
|
13845
|
+
return /* @__PURE__ */ jsx(
|
|
13846
|
+
"marker",
|
|
13847
|
+
{
|
|
13848
|
+
id: edgeHeadMarkerId(tone, head, suffix === "-sm"),
|
|
13849
|
+
viewBox: "0 0 10 10",
|
|
13850
|
+
refX: \u5F62.refX,
|
|
13851
|
+
refY: "5",
|
|
13852
|
+
markerWidth: size,
|
|
13853
|
+
markerHeight: size,
|
|
13854
|
+
markerUnits: "userSpaceOnUse",
|
|
13855
|
+
orient: "auto-start-reverse",
|
|
13856
|
+
children: /* @__PURE__ */ jsx(
|
|
13857
|
+
"path",
|
|
13858
|
+
{
|
|
13859
|
+
"data-cdl-role": "edge-arrowhead",
|
|
13860
|
+
"data-cdl-edge-head": head,
|
|
13861
|
+
d: \u5F62.d,
|
|
13862
|
+
fill: \u5F62.filled ? color : "none",
|
|
13863
|
+
stroke: \u5F62.filled ? "none" : color,
|
|
13864
|
+
strokeWidth: \u5F62.filled ? void 0 : 1.6,
|
|
13865
|
+
strokeLinecap: \u5F62.filled ? void 0 : "round",
|
|
13866
|
+
strokeLinejoin: \u5F62.filled ? void 0 : "round"
|
|
13867
|
+
}
|
|
13868
|
+
)
|
|
13869
|
+
},
|
|
13870
|
+
`${tone}${suffix}-${head}`
|
|
13871
|
+
);
|
|
13872
|
+
})
|
|
13873
|
+
)
|
|
12769
13874
|
),
|
|
12770
13875
|
/* @__PURE__ */ jsx(
|
|
12771
13876
|
"marker",
|
|
@@ -12858,13 +13963,14 @@ function CdlStage({
|
|
|
12858
13963
|
)),
|
|
12859
13964
|
laid.edges.map((edge) => /* @__PURE__ */ jsx(CdlEdgeView, { edge, active: activeSet.has(edge.id), progress, stateValues }, edge.id)),
|
|
12860
13965
|
laid.nodes.map((node) => {
|
|
13966
|
+
const \u63CF\u304F = drawSet.has(node.id);
|
|
12861
13967
|
const view = /* @__PURE__ */ jsx(
|
|
12862
13968
|
CdlNodeView,
|
|
12863
13969
|
{
|
|
12864
13970
|
node,
|
|
12865
13971
|
active: activeSet.has(node.id),
|
|
12866
|
-
drawing:
|
|
12867
|
-
progress,
|
|
13972
|
+
drawing: \u63CF\u304F,
|
|
13973
|
+
progress: \u63CF\u304F ? \u63CF\u304F\u9032\u307F : progress,
|
|
12868
13974
|
stateValues,
|
|
12869
13975
|
currentPhaseId: currentPhase?.id
|
|
12870
13976
|
}
|
|
@@ -21677,6 +22783,11 @@ var GRID_ALIGNED_KINDS = /* @__PURE__ */ new Set([
|
|
|
21677
22783
|
"chart-pie",
|
|
21678
22784
|
"chart-line",
|
|
21679
22785
|
"chart-bar",
|
|
22786
|
+
"chart-gauge",
|
|
22787
|
+
"chart-radial",
|
|
22788
|
+
"chart-stat",
|
|
22789
|
+
"chart-waffle",
|
|
22790
|
+
"chart-stacked-bar",
|
|
21680
22791
|
"funnel-stages",
|
|
21681
22792
|
"quadrant-matrix"
|
|
21682
22793
|
]);
|
|
@@ -21752,6 +22863,7 @@ function emptyCounts() {
|
|
|
21752
22863
|
"node-inside-viewbox": 0,
|
|
21753
22864
|
"node-inside-lane": 0,
|
|
21754
22865
|
"shape-label-dropped": 0,
|
|
22866
|
+
"box-line-dropped": 0,
|
|
21755
22867
|
"edge-inside-viewbox": 0,
|
|
21756
22868
|
"lane-label-inside-viewbox": 0,
|
|
21757
22869
|
"lane-label-overlap": 0,
|
|
@@ -21765,10 +22877,17 @@ function emptyCounts() {
|
|
|
21765
22877
|
"row-gap-uniform": 0,
|
|
21766
22878
|
"column-gap-uniform": 0,
|
|
21767
22879
|
"rows-not-rendered": 0,
|
|
22880
|
+
"title-row-overlap": 0,
|
|
21768
22881
|
"malformed-input": 0,
|
|
21769
22882
|
"validation-interrupted": 0
|
|
21770
22883
|
};
|
|
21771
22884
|
}
|
|
22885
|
+
function \u7A4D\u3080\u7BB1\u3092\u96C6\u3081\u308B(n) {
|
|
22886
|
+
const \u7BB1 = (b, \u884C) => ({ \u884C, w: b.w, h: b.h });
|
|
22887
|
+
if (n.kind === "tree-hierarchy") return \u6728\u306E\u4E2D\u8EAB(n).nodes.map((b) => \u7BB1(b, \u6728\u306E\u884C(b)));
|
|
22888
|
+
if (n.kind === "mind-map") return (\u653E\u5C04\u306E\u4E2D\u8EAB(n)?.nodes ?? []).map((b) => \u7BB1(b, \u653E\u5C04\u306E\u884C(b)));
|
|
22889
|
+
return [];
|
|
22890
|
+
}
|
|
21772
22891
|
function measureStubOut(segs) {
|
|
21773
22892
|
const first = segs[0];
|
|
21774
22893
|
const dx0 = first.x2 - first.x1;
|
|
@@ -22671,6 +23790,31 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
22671
23790
|
"warn"
|
|
22672
23791
|
);
|
|
22673
23792
|
}
|
|
23793
|
+
for (const n of laid.nodes) {
|
|
23794
|
+
const \u7BB1 = \u7A4D\u3080\u7BB1\u3092\u96C6\u3081\u308B(n);
|
|
23795
|
+
if (\u7BB1.length === 0) continue;
|
|
23796
|
+
let \u5BFE\u8C61 = 0;
|
|
23797
|
+
const \u843D\u3061\u305F = [];
|
|
23798
|
+
for (const b of \u7BB1) {
|
|
23799
|
+
const \u5BA3\u8A00 = b.\u884C.slice(1).filter((r) => r.text.trim() !== "");
|
|
23800
|
+
if (\u5BA3\u8A00.length === 0) continue;
|
|
23801
|
+
\u5BFE\u8C61 += 1;
|
|
23802
|
+
const \u6B8B\u3063\u305F = new Set(\u7BB1\u306B\u7A4D\u3080(b.\u884C, b.w, b.h).map((r) => r.\u5F79\u5272));
|
|
23803
|
+
if (\u5BA3\u8A00.every((r) => \u6B8B\u3063\u305F.has(r.\u5F79\u5272))) continue;
|
|
23804
|
+
\u843D\u3061\u305F.push({ title: b.\u884C[0]?.text ?? "", h: b.h });
|
|
23805
|
+
}
|
|
23806
|
+
if (\u843D\u3061\u305F.length === 0) continue;
|
|
23807
|
+
const \u540D\u524D = \u843D\u3061\u305F.map((d) => `"${d.title}"`);
|
|
23808
|
+
const \u898B\u305B\u308B = \u540D\u524D.slice(0, 5).join(" / ");
|
|
23809
|
+
const \u6B8B\u308A = \u540D\u524D.length > 5 ? ` \u4ED6 ${\u540D\u524D.length - 5} \u4EF6` : "";
|
|
23810
|
+
const \u4F4E = Math.min(...\u843D\u3061\u305F.map((d) => d.h)).toFixed(1);
|
|
23811
|
+
const \u9AD8 = Math.max(...\u843D\u3061\u305F.map((d) => d.h)).toFixed(1);
|
|
23812
|
+
push(
|
|
23813
|
+
"box-line-dropped",
|
|
23814
|
+
`node "${n.id}" (${n.kind}) \u306F\u7BB1\u304C\u4F4E\u304F\u3001 \u66F8\u3044\u305F\u88DC\u8DB3\u304C ${\u843D\u3061\u305F.length}/${\u5BFE\u8C61} \u7BB1\u3067\u63CF\u304B\u308C\u306A\u3044 (${\u898B\u305B\u308B}${\u6B8B\u308A}\u3001 \u7BB1\u306E\u9AD8\u3055 ${\u4F4E === \u9AD8 ? \u4F4E : `${\u4F4E}\u301C${\u9AD8}`})\u3002 \u56F3\u3092\u9AD8\u304F\u3059\u308B\u304B\u6BB5\u3092\u6E1B\u3089\u3059\u304B\u3001 \u88DC\u8DB3\u3092\u6D88\u3059`,
|
|
23815
|
+
"warn"
|
|
23816
|
+
);
|
|
23817
|
+
}
|
|
22674
23818
|
for (const e of laid.edges) {
|
|
22675
23819
|
const segs = flattenPathSegments(extractPathSegments(e.d));
|
|
22676
23820
|
if (segs.length === 0) continue;
|
|
@@ -22864,6 +24008,21 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
22864
24008
|
`node "${n.id}" (kind=${n.kind ?? "\u672A\u6307\u5B9A"}) \u304C rows ${n.rows.length} \u884C\u3092\u6301\u3064\u304C\u3001 \u3053\u306E\u7A2E\u5225\u306F\u884C\u3092\u63CF\u304B\u306A\u3044 (\u66F8\u3044\u305F\u5185\u5BB9\u304C\u753B\u9762\u306B\u51FA\u306A\u3044)`
|
|
22865
24009
|
);
|
|
22866
24010
|
}
|
|
24011
|
+
for (const n of diag.nodes) {
|
|
24012
|
+
if (!n.rows || n.rows.length === 0) continue;
|
|
24013
|
+
if (!rendersRows(n.kind)) continue;
|
|
24014
|
+
if (n.kind === "storage") continue;
|
|
24015
|
+
if (typeof n.h !== "number") continue;
|
|
24016
|
+
const \u984C = genericTitleBaselineY(n.kind, n.h, true);
|
|
24017
|
+
const \u884C = rowBaselineY(n.kind, 0);
|
|
24018
|
+
if (\u884C === null) continue;
|
|
24019
|
+
const \u9593 = \u884C - \u984C;
|
|
24020
|
+
if (\u9593 >= TITLE_ROW_MIN_GAP) continue;
|
|
24021
|
+
push(
|
|
24022
|
+
"title-row-overlap",
|
|
24023
|
+
`node "${n.id}" (kind=${n.kind ?? "\u672A\u6307\u5B9A"}) \u306E\u984C baseline y=${\u984C.toFixed(0)} \u3068 1 \u884C\u76EE baseline y=${\u884C.toFixed(0)} \u306E\u9593\u304C ${\u9593.toFixed(0)} world \u3067\u3001 \u898B\u8FBC\u3080\u5B57\u5F62\u306E\u9AD8\u3055 ${TITLE_ROW_MIN_GAP.toFixed(0)} \u306B\u5C4A\u304B\u306A\u3044 (\u5B57\u304C\u91CD\u306A\u308B)`
|
|
24024
|
+
);
|
|
24025
|
+
}
|
|
22867
24026
|
const GROUP_INTERNAL_PAD = 20;
|
|
22868
24027
|
const GROUP_EXTERNAL_CLEAR = 16;
|
|
22869
24028
|
for (const lane of laid.lanes) {
|
|
@@ -23221,6 +24380,12 @@ function runAxes(laid, diag, violations, counts, push, profile, skippedAxes) {
|
|
|
23221
24380
|
`edge "${e.id}" tone "${e.tone}" \u304C TONE_COLORS \u5B9A\u7FA9\u306B\u5B58\u5728\u3057\u306A\u3044\u3001 marker "cdl-arrow-${e.tone}" dead ref`
|
|
23222
24381
|
);
|
|
23223
24382
|
}
|
|
24383
|
+
if (e.head !== void 0 && !EDGE_HEADS.includes(e.head)) {
|
|
24384
|
+
push(
|
|
24385
|
+
"marker-gradient-def-integrity",
|
|
24386
|
+
`edge "${e.id}" head "${e.head}" \u304C EDGE_HEADS \u5B9A\u7FA9\u306B\u5B58\u5728\u3057\u306A\u3044\u3001 marker "cdl-arrow-${e.tone}-${e.head}" dead ref`
|
|
24387
|
+
);
|
|
24388
|
+
}
|
|
23224
24389
|
}
|
|
23225
24390
|
const SUBPIXEL_TOL = 0.5;
|
|
23226
24391
|
function isSubpixel(v) {
|