@cardenelabs/cdl 0.31.0 → 0.32.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/dist/react.cjs CHANGED
@@ -4908,10 +4908,10 @@ function countEdgeCrossings(edges, warnAt = 3) {
4908
4908
  if (isNearAny(p, a.ends, SAME_POINT_TOL) || isNearAny(p, b.ends, SAME_POINT_TOL))
4909
4909
  continue;
4910
4910
  if (\u5171\u6709\u5074.length > 0) {
4911
- const \u67A0 = Math.min(MAX_CHECKS - checks, MAX_CHECKS_PER_PAIR - pairChecks);
4912
- const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \u67A0) };
4911
+ const \u67A02 = Math.min(MAX_CHECKS - checks, MAX_CHECKS_PER_PAIR - pairChecks);
4912
+ const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \u67A02) };
4913
4913
  const \u5224\u5B9A = mergesTowardShared(a.flat, b.flat, p, \u5171\u6709\u5074, MERGE_TOL, \u4E88\u7B97);
4914
- const \u4F7F\u3063\u305F = Math.max(0, \u67A0) - \u4E88\u7B97.\u6B8B\u308A;
4914
+ const \u4F7F\u3063\u305F = Math.max(0, \u67A02) - \u4E88\u7B97.\u6B8B\u308A;
4915
4915
  checks += \u4F7F\u3063\u305F;
4916
4916
  pairChecks += \u4F7F\u3063\u305F;
4917
4917
  if (\u5224\u5B9A === "merged") continue;
@@ -9976,6 +9976,20 @@ function ChartLineNode({
9976
9976
  }
9977
9977
  const gridTicks = scale.ticks.map((value) => ({ y: yAt(value), value }));
9978
9978
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
9979
+ /* @__PURE__ */ jsxRuntime.jsx(
9980
+ "rect",
9981
+ {
9982
+ "data-cdl-role": "node-body",
9983
+ x: 0,
9984
+ y: 0,
9985
+ width: node.w,
9986
+ height: node.h,
9987
+ rx: 16,
9988
+ fill: "var(--cdl-node-fill, #ffffff)",
9989
+ stroke: "var(--cdl-divider, #d4d4d8)",
9990
+ strokeWidth: active ? 1.5 : 1
9991
+ }
9992
+ ),
9979
9993
  gridTicks.map((t, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
9980
9994
  /* @__PURE__ */ jsxRuntime.jsx(
9981
9995
  "line",
@@ -11830,52 +11844,52 @@ function ChartPieNode({
11830
11844
  const y0 = node.cy - node.h / 2;
11831
11845
  const data = resolveChartData(node.chartData ?? [], stateValues);
11832
11846
  const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
11847
+ const \u524D\u3042\u308A = data.some((d) => d.previous !== void 0);
11848
+ const \u4ECA\u306E\u5024 = data.map((d) => Math.max(0, d.value));
11849
+ const \u524D\u306E\u5024 = data.map((d) => Math.max(0, d.previous ?? 0));
11850
+ const \u4ECA\u306E\u5408\u8A08 = \u4ECA\u306E\u5024.reduce((acc, value) => acc + value, 0);
11851
+ const \u524D\u306E\u5408\u8A08 = \u524D\u306E\u5024.reduce((acc, value) => acc + value, 0);
11852
+ const \u4ECA\u306E\u5272\u5408 = \u524D\u3042\u308A ? \u4ECA\u306E\u5024.map((value) => \u4ECA\u306E\u5408\u8A08 > 0 ? value / \u4ECA\u306E\u5408\u8A08 : 0) : data.map((d) => d.value / total);
11853
+ const \u524D\u306E\u5272\u5408 = \u524D\u306E\u5024.map((value) => \u524D\u306E\u5408\u8A08 > 0 ? value / \u524D\u306E\u5408\u8A08 : 0);
11854
+ const \u5F62 = node.chartPieForm === "arcs" || node.chartPieForm === "table" ? node.chartPieForm : "ring";
11833
11855
  const PAD_TOP2 = 20;
11834
11856
  const PAD_BOTTOM2 = 20;
11835
11857
  const PAD_SIDE = 20;
11836
11858
  const chartAreaH = node.h - PAD_TOP2 - PAD_BOTTOM2;
11837
- const \u540D\u672D\u306E\u7D1A = 14;
11838
- const \u6570\u5024\u306E\u7D1A = 13;
11859
+ const \u5272\u5408\u306E\u7D1A = 19;
11860
+ const \u540D\u524D\u306E\u7D1A = 12;
11839
11861
  const \u5F15\u304D\u51FA\u3057 = 18;
11840
11862
  const \u5B57\u307E\u3067\u306E\u9593 = 26;
11841
11863
  const \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057 = 20;
11842
- const \u5272\u5408\u306E\u6587\u5B57 = data.map((d) => \u5272\u5408\u8868\u8A18(d.value / total));
11843
- const \u6570\u5024\u306E\u6587\u5B57 = data.map((d, i) => `${\u5B9F\u5024\u8868\u8A18(d.value)} ${\u5272\u5408\u306E\u6587\u5B57[i]}`);
11864
+ const \u5272\u5408\u306E\u6587\u5B57 = \u4ECA\u306E\u5272\u5408.map(\u5272\u5408\u8868\u8A18);
11865
+ const \u540D\u524D\u306E\u6587\u5B57 = data.map((d, i) => {
11866
+ const \u540D = d.label ?? "";
11867
+ if (\u524D\u3042\u308A) return `${\u540D} ${\u5B9F\u5024\u8868\u8A18(\u524D\u306E\u5024[i])} \u2192 ${\u5B9F\u5024\u8868\u8A18(\u4ECA\u306E\u5024[i])}`;
11868
+ return `${\u5B9F\u5024\u8868\u8A18(d.value)}%` === \u5272\u5408\u306E\u6587\u5B57[i] ? \u540D : `${\u540D} ${\u5B9F\u5024\u8868\u8A18(d.value)}`;
11869
+ });
11870
+ if (\u5F62 !== "ring") {
11871
+ const \u5171\u901A = { node, active, data, \u5272\u5408: \u4ECA\u306E\u5272\u5408, x0, y0, drawing, progress, instanceId };
11872
+ return \u5F62 === "arcs" ? \u5F27\u306E\u5F62(\u5171\u901A) : \u8868\u306E\u5F62(\u5171\u901A);
11873
+ }
11844
11874
  const \u540D\u672D\u5E45 = Math.max(
11845
11875
  0,
11846
11876
  ...data.map(
11847
- (d, i) => Math.max(textWidth(d.label ?? "", \u540D\u672D\u306E\u7D1A), textWidth(\u6570\u5024\u306E\u6587\u5B57[i] ?? "", \u6570\u5024\u306E\u7D1A))
11877
+ (_d, i) => Math.max(
11878
+ textWidth(\u5272\u5408\u306E\u6587\u5B57[i] ?? "", \u5272\u5408\u306E\u7D1A),
11879
+ textWidth(\u540D\u524D\u306E\u6587\u5B57[i] ?? "", \u540D\u524D\u306E\u7D1A)
11880
+ )
11848
11881
  )
11849
11882
  );
11850
11883
  const \u7E26\u304B\u3089 = chartAreaH / 2 - \u5F15\u304D\u51FA\u3057 - \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057;
11851
11884
  const \u6A2A\u304B\u3089 = (node.w - PAD_SIDE * 2) / 2 - \u5F15\u304D\u51FA\u3057 - \u5B57\u307E\u3067\u306E\u9593 - \u540D\u672D\u5E45;
11852
11885
  const radius = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
11853
- const \u5185\u534A\u5F84 = radius * 0.58;
11886
+ const \u5916\u306E\u5185\u534A\u5F84 = radius * (\u524D\u3042\u308A ? 0.75 : 0.58);
11887
+ const \u524D\u306E\u5916\u534A\u5F84 = radius * 0.67;
11888
+ const \u524D\u306E\u5185\u534A\u5F84 = radius * 0.42;
11854
11889
  const cx = node.w / 2;
11855
11890
  const cy = PAD_TOP2 + chartAreaH / 2;
11856
- let cumAngle = -Math.PI / 2;
11857
- let cumFrac = 0;
11858
- const slices = data.map((d) => {
11859
- const frac = d.value / total;
11860
- const angle = frac * Math.PI * 2;
11861
- const a0 = cumAngle;
11862
- const a1 = cumAngle + angle;
11863
- cumAngle = a1;
11864
- const startFrac = cumFrac;
11865
- cumFrac += frac;
11866
- const x1 = cx + radius * Math.cos(a0);
11867
- const y1 = cy + radius * Math.sin(a0);
11868
- const x2 = cx + radius * Math.cos(a1);
11869
- const y2 = cy + radius * Math.sin(a1);
11870
- const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
11871
- const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
11872
- const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
11873
- const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
11874
- const large = angle > Math.PI ? 1 : 0;
11875
- 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`;
11876
- const \u4E2D\u592E\u89D2 = (a0 + a1) / 2;
11877
- return { d, frac, path, startFrac, \u4E2D\u592E\u89D2 };
11878
- });
11891
+ const \u524D\u306Eslices = \u524D\u3042\u308A ? \u8F2A\u3092\u7D44\u3080(data, cx, cy, \u524D\u306E\u5916\u534A\u5F84, \u524D\u306E\u5185\u534A\u5F84, \u524D\u306E\u5272\u5408) : [];
11892
+ const slices = \u8F2A\u3092\u7D44\u3080(data, cx, cy, radius, \u5916\u306E\u5185\u534A\u5F84, \u4ECA\u306E\u5272\u5408);
11879
11893
  const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
11880
11894
  const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
11881
11895
  const \u5F71id = `cdl-pie-shadow-${instanceId}`;
@@ -11899,19 +11913,34 @@ function ChartPieNode({
11899
11913
  drawing && /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }),
11900
11914
  /* @__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" }) })
11901
11915
  ] }),
11902
- /* @__PURE__ */ jsxRuntime.jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, filter: `url(#${\u5F71id})`, children: slices.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
11903
- "path",
11904
- {
11905
- "data-cdl-role": "chart-pie-slice",
11906
- "data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
11907
- d: s.path,
11908
- fill: sliceColor(s.d.tone, idx),
11909
- stroke: "var(--cdl-node-fill, #ffffff)",
11910
- strokeWidth: 3,
11911
- strokeLinejoin: "round"
11912
- },
11913
- `slice-${idx}`
11914
- )) }),
11916
+ /* @__PURE__ */ jsxRuntime.jsxs("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, filter: `url(#${\u5F71id})`, children: [
11917
+ \u524D\u306Eslices.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
11918
+ "path",
11919
+ {
11920
+ "data-cdl-role": "chart-pie-slice-previous",
11921
+ "data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
11922
+ d: s.path,
11923
+ fill: sliceColor(s.d.tone, idx),
11924
+ stroke: "var(--cdl-node-fill, #ffffff)",
11925
+ strokeWidth: 3,
11926
+ strokeLinejoin: "round"
11927
+ },
11928
+ `slice-previous-${idx}`
11929
+ )),
11930
+ slices.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
11931
+ "path",
11932
+ {
11933
+ "data-cdl-role": "chart-pie-slice",
11934
+ "data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
11935
+ d: s.path,
11936
+ fill: sliceColor(s.d.tone, idx),
11937
+ stroke: "var(--cdl-node-fill, #ffffff)",
11938
+ strokeWidth: 3,
11939
+ strokeLinejoin: "round"
11940
+ },
11941
+ `slice-${idx}`
11942
+ ))
11943
+ ] }),
11915
11944
  /* @__PURE__ */ jsxRuntime.jsx(
11916
11945
  "text",
11917
11946
  {
@@ -11921,7 +11950,7 @@ function ChartPieNode({
11921
11950
  fontSize: Math.round(radius * 0.26),
11922
11951
  fontWeight: 600,
11923
11952
  fill: "var(--cdl-text, #1a1f2a)",
11924
- children: \u5B9F\u5024\u8868\u8A18(Math.round(total))
11953
+ children: \u5B9F\u5024\u8868\u8A18(Math.round(\u524D\u3042\u308A ? \u4ECA\u306E\u5408\u8A08 : total))
11925
11954
  }
11926
11955
  ),
11927
11956
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11958,12 +11987,12 @@ function ChartPieNode({
11958
11987
  "text",
11959
11988
  {
11960
11989
  x: \u5B57x,
11961
- y: \u6298\u308Cy - 3,
11990
+ y: \u6298\u308Cy - 1,
11962
11991
  textAnchor: \u53F3 ? "start" : "end",
11963
- fontSize: \u540D\u672D\u306E\u7D1A,
11992
+ fontSize: \u5272\u5408\u306E\u7D1A,
11964
11993
  fontWeight: 600,
11965
11994
  fill: "var(--cdl-text, #1a1f2a)",
11966
- children: s.d.label
11995
+ children: \u5272\u5408\u306E\u6587\u5B57[idx]
11967
11996
  }
11968
11997
  ),
11969
11998
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -11972,15 +12001,275 @@ function ChartPieNode({
11972
12001
  x: \u5B57x,
11973
12002
  y: \u6298\u308Cy + 15,
11974
12003
  textAnchor: \u53F3 ? "start" : "end",
11975
- fontSize: \u6570\u5024\u306E\u7D1A,
12004
+ fontSize: \u540D\u524D\u306E\u7D1A,
11976
12005
  fill: "var(--cdl-text-dim, #5a6270)",
11977
- children: \u6570\u5024\u306E\u6587\u5B57[idx]
12006
+ children: \u540D\u524D\u306E\u6587\u5B57[idx]
11978
12007
  }
11979
12008
  )
11980
12009
  ] }, `callout-${idx}`);
11981
12010
  })
11982
12011
  ] });
11983
12012
  }
12013
+ function \u8F2A\u3092\u7D44\u3080(data, cx, cy, \u5916\u534A\u5F84, \u5185\u534A\u5F84, \u5272\u5408) {
12014
+ let cumAngle = -Math.PI / 2;
12015
+ let cumFrac = 0;
12016
+ return data.map((d, idx) => {
12017
+ const frac = \u5272\u5408[idx] ?? 0;
12018
+ const angle = frac * Math.PI * 2;
12019
+ const a0 = cumAngle;
12020
+ const a1 = cumAngle + angle;
12021
+ cumAngle = a1;
12022
+ const startFrac = cumFrac;
12023
+ cumFrac += frac;
12024
+ const x1 = cx + \u5916\u534A\u5F84 * Math.cos(a0);
12025
+ const y1 = cy + \u5916\u534A\u5F84 * Math.sin(a0);
12026
+ const x2 = cx + \u5916\u534A\u5F84 * Math.cos(a1);
12027
+ const y2 = cy + \u5916\u534A\u5F84 * Math.sin(a1);
12028
+ const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
12029
+ const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
12030
+ const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
12031
+ const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
12032
+ const large = angle > Math.PI ? 1 : 0;
12033
+ const path = `M ${x1} ${y1} A ${\u5916\u534A\u5F84} ${\u5916\u534A\u5F84} 0 ${large} 1 ${x2} ${y2} L ${x3} ${y3} A ${\u5185\u534A\u5F84} ${\u5185\u534A\u5F84} 0 ${large} 0 ${x4} ${y4} Z`;
12034
+ return { d, frac, path, startFrac, \u4E2D\u592E\u89D2: (a0 + a1) / 2 };
12035
+ });
12036
+ }
12037
+ function \u67A0(node, active) {
12038
+ return /* @__PURE__ */ jsxRuntime.jsx(
12039
+ "rect",
12040
+ {
12041
+ "data-cdl-role": "node-body",
12042
+ x: 0,
12043
+ y: 0,
12044
+ width: node.w,
12045
+ height: node.h,
12046
+ rx: 16,
12047
+ fill: "var(--cdl-node-fill, #ffffff)",
12048
+ stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
12049
+ strokeWidth: active ? 3 : 1.25
12050
+ }
12051
+ );
12052
+ }
12053
+ function \u5F27\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress }) {
12054
+ const PAD = 20;
12055
+ const \u540D\u524D\u306E\u7D1A = 14;
12056
+ const \u5272\u5408\u306E\u7D1A = 24;
12057
+ const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
12058
+ const \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 = 24;
12059
+ const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
12060
+ const \u4E00\u89A7\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A))) + \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 + Math.max(0, ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A)));
12061
+ const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
12062
+ const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u4E00\u89A7\u5E45 - 28) / 2;
12063
+ const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
12064
+ const cx = PAD + R;
12065
+ const cy = node.h / 2;
12066
+ const \u7A74 = R * 0.34;
12067
+ const \u523B\u307F = (R - \u7A74) / Math.max(1, data.length);
12068
+ const \u592A\u3055 = Math.max(3, \u523B\u307F * 0.6);
12069
+ const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
12070
+ const \u4E00\u89A7\u5DE6 = node.w - PAD - \u4E00\u89A7\u5E45;
12071
+ const \u884C\u306E\u9593 = Math.min(56, (node.h - PAD * 2) / Math.max(1, data.length));
12072
+ const \u4E00\u89A7\u4E0A = node.h / 2 - \u884C\u306E\u9593 * (data.length - 1) / 2;
12073
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
12074
+ \u67A0(node, active),
12075
+ data.map((d, idx) => {
12076
+ const r = R - \u592A\u3055 / 2 - idx * \u523B\u307F;
12077
+ if (r <= \u592A\u3055 / 2) return null;
12078
+ const \u53D6\u308A\u5206 = (\u5272\u5408[idx] ?? 0) * (drawing ? \u958B\u304D : 1);
12079
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
12080
+ /* @__PURE__ */ jsxRuntime.jsx(
12081
+ "circle",
12082
+ {
12083
+ "data-cdl-role": "chart-pie-arc-track",
12084
+ cx,
12085
+ cy,
12086
+ r,
12087
+ fill: "none",
12088
+ stroke: "var(--cdl-divider, #d4d4d8)",
12089
+ strokeWidth: \u592A\u3055
12090
+ }
12091
+ ),
12092
+ /* @__PURE__ */ jsxRuntime.jsx(
12093
+ "path",
12094
+ {
12095
+ "data-cdl-role": "chart-pie-arc",
12096
+ "data-cdl-unresolved": d.unresolved ? "true" : void 0,
12097
+ d: \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206),
12098
+ fill: "none",
12099
+ stroke: sliceColor(d.tone, idx),
12100
+ strokeWidth: \u592A\u3055,
12101
+ strokeLinecap: "round"
12102
+ }
12103
+ )
12104
+ ] }, `arc-${idx}`);
12105
+ }),
12106
+ data.map((d, idx) => {
12107
+ const y = \u4E00\u89A7\u4E0A + \u884C\u306E\u9593 * idx;
12108
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
12109
+ /* @__PURE__ */ jsxRuntime.jsx(
12110
+ "rect",
12111
+ {
12112
+ x: \u4E00\u89A7\u5DE6,
12113
+ y: y - 9,
12114
+ width: 10,
12115
+ height: 10,
12116
+ rx: 2,
12117
+ fill: sliceColor(d.tone, idx)
12118
+ }
12119
+ ),
12120
+ /* @__PURE__ */ jsxRuntime.jsx(
12121
+ "text",
12122
+ {
12123
+ x: \u4E00\u89A7\u5DE6 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672,
12124
+ y,
12125
+ fontSize: \u540D\u524D\u306E\u7D1A,
12126
+ fill: "var(--cdl-text, #1a1f2a)",
12127
+ children: d.label
12128
+ }
12129
+ ),
12130
+ /* @__PURE__ */ jsxRuntime.jsx(
12131
+ "text",
12132
+ {
12133
+ x: node.w - PAD,
12134
+ y: y + 4,
12135
+ textAnchor: "end",
12136
+ fontSize: \u5272\u5408\u306E\u7D1A,
12137
+ fontWeight: 600,
12138
+ fill: "var(--cdl-text, #1a1f2a)",
12139
+ children: \u5272\u5408\u306E\u6587\u5B57[idx]
12140
+ }
12141
+ )
12142
+ ] }, `row-${idx}`);
12143
+ })
12144
+ ] });
12145
+ }
12146
+ function \u8868\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress, instanceId }) {
12147
+ const PAD = 20;
12148
+ const \u898B\u51FA\u3057\u306E\u7D1A = 11;
12149
+ const \u540D\u524D\u306E\u7D1A = 15;
12150
+ const \u5272\u5408\u306E\u7D1A = 17;
12151
+ const \u5B9F\u6570\u306E\u7D1A = 15;
12152
+ const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
12153
+ const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
12154
+ const \u5B9F\u6570\u306E\u6587\u5B57 = data.map((d) => \u5B9F\u5024\u8868\u8A18(d.value));
12155
+ const \u540D\u524D\u5E45 = Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A)));
12156
+ const \u5272\u5408\u5E45 = Math.max(textWidth("\u5272\u5408", \u898B\u51FA\u3057\u306E\u7D1A), ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A)));
12157
+ const \u5B9F\u6570\u5E45 = Math.max(textWidth("\u5024", \u898B\u51FA\u3057\u306E\u7D1A), ...\u5B9F\u6570\u306E\u6587\u5B57.map((t) => textWidth(t, \u5B9F\u6570\u306E\u7D1A)));
12158
+ const \u8868\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + \u540D\u524D\u5E45 + 28 + \u5272\u5408\u5E45 + 24 + \u5B9F\u6570\u5E45;
12159
+ const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
12160
+ const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u8868\u5E45 - 28) / 2;
12161
+ const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
12162
+ const \u5185\u534A\u5F84 = R * 0.58;
12163
+ const cx = PAD + R;
12164
+ const cy = node.h / 2;
12165
+ const \u8868\u5DE6 = node.w - PAD - \u8868\u5E45;
12166
+ const \u53F3\u7AEF = node.w - PAD;
12167
+ const \u5272\u5408\u53F3 = \u53F3\u7AEF - \u5B9F\u6570\u5E45 - 24;
12168
+ const \u884C\u306E\u9593 = Math.min(52, (node.h - PAD * 2 - 40) / Math.max(1, data.length));
12169
+ const \u898B\u51FA\u3057\u306Ey = node.h / 2 - \u884C\u306E\u9593 * data.length / 2 - 14;
12170
+ const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
12171
+ const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
12172
+ const \u958B\u304D\u59CB\u3081\u305F = (\u59CB\u307E\u308A) => !drawing || \u958B\u304D > \u59CB\u307E\u308A;
12173
+ let \u89D2 = -Math.PI / 2;
12174
+ let \u7D2F\u8A08 = 0;
12175
+ const \u6247\u305F\u3061 = data.map((d, idx) => {
12176
+ const frac = \u5272\u5408[idx] ?? 0;
12177
+ const a0 = \u89D2;
12178
+ const a1 = \u89D2 + frac * Math.PI * 2;
12179
+ \u89D2 = a1;
12180
+ const \u59CB\u307E\u308A = \u7D2F\u8A08;
12181
+ \u7D2F\u8A08 += frac;
12182
+ return { d, idx, \u59CB\u307E\u308A, path: \u8F2A\u306E\u9053(cx, cy, R, \u5185\u534A\u5F84, a0, a1) };
12183
+ });
12184
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
12185
+ \u67A0(node, active),
12186
+ drawing && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, R + 2, \u958B\u304D) }) }),
12187
+ /* @__PURE__ */ jsxRuntime.jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, children: \u6247\u305F\u3061.map((s) => /* @__PURE__ */ jsxRuntime.jsx(
12188
+ "path",
12189
+ {
12190
+ "data-cdl-role": "chart-pie-slice",
12191
+ "data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
12192
+ d: s.path,
12193
+ fill: sliceColor(s.d.tone, s.idx),
12194
+ stroke: "var(--cdl-node-fill, #ffffff)",
12195
+ strokeWidth: 3,
12196
+ strokeLinejoin: "round"
12197
+ },
12198
+ `slice-${s.idx}`
12199
+ )) }),
12200
+ /* @__PURE__ */ jsxRuntime.jsx(
12201
+ "text",
12202
+ {
12203
+ x: cx,
12204
+ y: cy - 2,
12205
+ textAnchor: "middle",
12206
+ fontSize: Math.round(R * 0.26),
12207
+ fontWeight: 600,
12208
+ fill: "var(--cdl-text, #1a1f2a)",
12209
+ children: \u5B9F\u5024\u8868\u8A18(Math.round(data.reduce((acc, d) => acc + d.value, 0)))
12210
+ }
12211
+ ),
12212
+ /* @__PURE__ */ jsxRuntime.jsx(
12213
+ "text",
12214
+ {
12215
+ x: cx,
12216
+ y: cy + Math.round(R * 0.2),
12217
+ textAnchor: "middle",
12218
+ fontSize: Math.round(R * 0.12),
12219
+ fill: "var(--cdl-text-dim, #5a6270)",
12220
+ children: "\u5408\u8A08"
12221
+ }
12222
+ ),
12223
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: \u8868\u5DE6, y: \u898B\u51FA\u3057\u306Ey, fontSize: \u898B\u51FA\u3057\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: "\u5185\u8A33" }),
12224
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: \u5272\u5408\u53F3, y: \u898B\u51FA\u3057\u306Ey, textAnchor: "end", fontSize: \u898B\u51FA\u3057\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: "\u5272\u5408" }),
12225
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: \u53F3\u7AEF, y: \u898B\u51FA\u3057\u306Ey, textAnchor: "end", fontSize: \u898B\u51FA\u3057\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: "\u5024" }),
12226
+ /* @__PURE__ */ jsxRuntime.jsx(
12227
+ "line",
12228
+ {
12229
+ "data-cdl-role": "chart-pie-table-rule",
12230
+ x1: \u8868\u5DE6,
12231
+ y1: \u898B\u51FA\u3057\u306Ey + 10,
12232
+ x2: \u53F3\u7AEF,
12233
+ y2: \u898B\u51FA\u3057\u306Ey + 10,
12234
+ stroke: "var(--cdl-text, #1a1f2a)",
12235
+ strokeWidth: 1.2
12236
+ }
12237
+ ),
12238
+ \u6247\u305F\u3061.map((s) => {
12239
+ if (!\u958B\u304D\u59CB\u3081\u305F(s.\u59CB\u307E\u308A)) return null;
12240
+ const y = \u898B\u51FA\u3057\u306Ey + 40 + \u884C\u306E\u9593 * s.idx;
12241
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
12242
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: \u8868\u5DE6, y: y - 10, width: 10, height: 10, rx: 2, fill: sliceColor(s.d.tone, s.idx) }),
12243
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: \u8868\u5DE6 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672, y, fontSize: \u540D\u524D\u306E\u7D1A, fill: "var(--cdl-text, #1a1f2a)", children: s.d.label }),
12244
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: \u5272\u5408\u53F3, y, textAnchor: "end", fontSize: \u5272\u5408\u306E\u7D1A, fontWeight: 600, fill: "var(--cdl-text, #1a1f2a)", children: \u5272\u5408\u306E\u6587\u5B57[s.idx] }),
12245
+ /* @__PURE__ */ jsxRuntime.jsx("text", { x: \u53F3\u7AEF, y, textAnchor: "end", fontSize: \u5B9F\u6570\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u5B9F\u6570\u306E\u6587\u5B57[s.idx] }),
12246
+ /* @__PURE__ */ jsxRuntime.jsx(
12247
+ "line",
12248
+ {
12249
+ "data-cdl-role": "chart-pie-table-rule",
12250
+ x1: \u8868\u5DE6,
12251
+ y1: y + 16,
12252
+ x2: \u53F3\u7AEF,
12253
+ y2: y + 16,
12254
+ stroke: "var(--cdl-divider, #d4d4d8)",
12255
+ strokeWidth: 1
12256
+ }
12257
+ )
12258
+ ] }, `row-${s.idx}`);
12259
+ })
12260
+ ] });
12261
+ }
12262
+ function \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206) {
12263
+ const \u5B9F\u52B9 = Math.max(0, Math.min(0.9999, \u53D6\u308A\u5206));
12264
+ const a0 = -Math.PI / 2;
12265
+ const a1 = a0 + \u5B9F\u52B9 * Math.PI * 2;
12266
+ const large = \u5B9F\u52B9 > 0.5 ? 1 : 0;
12267
+ return `M ${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)}`;
12268
+ }
12269
+ function \u8F2A\u306E\u9053(cx, cy, R, r, a0, a1) {
12270
+ const large = a1 - a0 > Math.PI ? 1 : 0;
12271
+ return `M ${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)} L ${cx + r * Math.cos(a1)} ${cy + r * Math.sin(a1)} A ${r} ${r} 0 ${large} 0 ${cx + r * Math.cos(a0)} ${cy + r * Math.sin(a0)} Z`;
12272
+ }
11984
12273
  function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
11985
12274
  if (\u958B\u304D <= 0) return null;
11986
12275
  if (\u958B\u304D >= 1) return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r });
@@ -12182,8 +12471,8 @@ function ChartRadialNode({
12182
12471
  frac,
12183
12472
  \u4E2D\u5FC3\u534A\u5F84,
12184
12473
  // 軌道は全周。 1 周ちょうどは弧で表せないので、 わずかに欠かして描く
12185
- \u8ECC\u9053: \u5F27\u306E\u9053(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
12186
- \u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\u9053(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, Math.min(frac, 0.9999))
12474
+ \u8ECC\u9053: \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
12475
+ \u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, Math.min(frac, 0.9999))
12187
12476
  };
12188
12477
  });
12189
12478
  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;
@@ -12254,7 +12543,7 @@ function ChartRadialNode({
12254
12543
  ] });
12255
12544
  }
12256
12545
  var \u5370\u306E\u5E45 = 18;
12257
- function \u5F27\u306E\u9053(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5408) {
12546
+ function \u5F27\u306E\u90532(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5408) {
12258
12547
  const \u5916 = \u4E2D\u5FC3\u534A\u5F84 + \u5E45 / 2;
12259
12548
  const \u5185 = Math.max(0.5, \u4E2D\u5FC3\u534A\u5F84 - \u5E45 / 2);
12260
12549
  const a0 = -Math.PI / 2;
@@ -12300,12 +12589,12 @@ function ChartStatNode({
12300
12589
  }
12301
12590
  ),
12302
12591
  data.map((d, idx) => {
12303
- const \u67A0 = \u533A\u753B.\u67A0(idx);
12592
+ const \u67A02 = \u533A\u753B.\u67A0(idx);
12304
12593
  const frac = total > 0 ? d.value / total : 0;
12305
12594
  const \u8272 = \u5370\u306E\u8272(d.tone, idx);
12306
12595
  const \u6570\u5024 = \u5B9F\u5024\u8868\u8A184(d.value);
12307
- 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);
12308
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A0.x} ${\u67A0.y})`, children: [
12596
+ const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(\u6570\u5024, \u67A02.w - \u533A\u753B.\u4F59\u767D * 2, \u533A\u753B.\u6570\u5024\u306E\u7D1A, \u533A\u753B.\u540D\u524D\u306E\u7D1A + 1);
12597
+ return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A02.x} ${\u67A02.y})`, children: [
12309
12598
  idx > 0 && /* @__PURE__ */ jsxRuntime.jsx(
12310
12599
  "line",
12311
12600
  {
@@ -12313,7 +12602,7 @@ function ChartStatNode({
12313
12602
  x1: 0,
12314
12603
  y1: \u533A\u753B.\u4F59\u767D,
12315
12604
  x2: 0,
12316
- y2: \u67A0.h - \u533A\u753B.\u4F59\u767D,
12605
+ y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
12317
12606
  stroke: "var(--cdl-divider, #d4d4d8)",
12318
12607
  strokeWidth: 1
12319
12608
  }
@@ -12322,7 +12611,7 @@ function ChartStatNode({
12322
12611
  "text",
12323
12612
  {
12324
12613
  "data-cdl-role": "chart-stat-label",
12325
- x: \u67A0.w / 2,
12614
+ x: \u67A02.w / 2,
12326
12615
  y: \u533A\u753B.\u540D\u524D\u306Ey,
12327
12616
  fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
12328
12617
  fontWeight: 700,
@@ -12336,7 +12625,7 @@ function ChartStatNode({
12336
12625
  {
12337
12626
  "data-cdl-role": "chart-stat-value",
12338
12627
  "data-cdl-unresolved": d.unresolved ? "true" : void 0,
12339
- x: \u67A0.w / 2,
12628
+ x: \u67A02.w / 2,
12340
12629
  y: \u533A\u753B.\u6570\u5024\u306Ey,
12341
12630
  fontSize: \u6570\u5024\u306E\u7D1A,
12342
12631
  fontWeight: 700,
@@ -12349,7 +12638,7 @@ function ChartStatNode({
12349
12638
  "circle",
12350
12639
  {
12351
12640
  "data-cdl-role": "chart-stat-track",
12352
- cx: \u67A0.w / 2,
12641
+ cx: \u67A02.w / 2,
12353
12642
  cy: \u533A\u753B.\u5F27\u306Ey,
12354
12643
  r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
12355
12644
  fill: "none",
@@ -12362,7 +12651,7 @@ function ChartStatNode({
12362
12651
  "path",
12363
12652
  {
12364
12653
  "data-cdl-role": "chart-stat-arc",
12365
- d: \u5F27\u306E\u90532(\u67A0.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
12654
+ d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
12366
12655
  fill: "none",
12367
12656
  stroke: \u8272,
12368
12657
  strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
@@ -12373,7 +12662,7 @@ function ChartStatNode({
12373
12662
  "text",
12374
12663
  {
12375
12664
  "data-cdl-role": "chart-stat-share",
12376
- x: \u67A0.w / 2,
12665
+ x: \u67A02.w / 2,
12377
12666
  y: \u533A\u753B.\u5272\u5408\u306Ey,
12378
12667
  fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
12379
12668
  textAnchor: "middle",
@@ -12418,7 +12707,7 @@ function \u53CE\u3081\u308B\u7D1A(\u5B57, \u4F7F\u3048\u308B\u5E452, \u521D\u671
12418
12707
  while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B57, \u7D1A) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
12419
12708
  return \u7D1A;
12420
12709
  }
12421
- function \u5F27\u306E\u90532(cx, cy, r, \u5272\u5408) {
12710
+ function \u5F27\u306E\u90533(cx, cy, r, \u5272\u5408) {
12422
12711
  const a0 = -Math.PI / 2;
12423
12712
  const a1 = a0 + \u5272\u5408 * Math.PI * 2;
12424
12713
  const large = \u5272\u5408 > 0.5 ? 1 : 0;