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