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