@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.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;
@@ -9974,6 +9974,20 @@ function ChartLineNode({
9974
9974
  }
9975
9975
  const gridTicks = scale.ticks.map((value) => ({ y: yAt(value), value }));
9976
9976
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
9977
+ /* @__PURE__ */ jsx(
9978
+ "rect",
9979
+ {
9980
+ "data-cdl-role": "node-body",
9981
+ x: 0,
9982
+ y: 0,
9983
+ width: node.w,
9984
+ height: node.h,
9985
+ rx: 16,
9986
+ fill: "var(--cdl-node-fill, #ffffff)",
9987
+ stroke: "var(--cdl-divider, #d4d4d8)",
9988
+ strokeWidth: active ? 1.5 : 1
9989
+ }
9990
+ ),
9977
9991
  gridTicks.map((t, i) => /* @__PURE__ */ jsxs("g", { children: [
9978
9992
  /* @__PURE__ */ jsx(
9979
9993
  "line",
@@ -11828,52 +11842,52 @@ function ChartPieNode({
11828
11842
  const y0 = node.cy - node.h / 2;
11829
11843
  const data = resolveChartData(node.chartData ?? [], stateValues);
11830
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";
11831
11853
  const PAD_TOP2 = 20;
11832
11854
  const PAD_BOTTOM2 = 20;
11833
11855
  const PAD_SIDE = 20;
11834
11856
  const chartAreaH = node.h - PAD_TOP2 - PAD_BOTTOM2;
11835
- const \u540D\u672D\u306E\u7D1A = 14;
11836
- const \u6570\u5024\u306E\u7D1A = 13;
11857
+ const \u5272\u5408\u306E\u7D1A = 19;
11858
+ const \u540D\u524D\u306E\u7D1A = 12;
11837
11859
  const \u5F15\u304D\u51FA\u3057 = 18;
11838
11860
  const \u5B57\u307E\u3067\u306E\u9593 = 26;
11839
11861
  const \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057 = 20;
11840
- const \u5272\u5408\u306E\u6587\u5B57 = data.map((d) => \u5272\u5408\u8868\u8A18(d.value / total));
11841
- 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
+ }
11842
11872
  const \u540D\u672D\u5E45 = Math.max(
11843
11873
  0,
11844
11874
  ...data.map(
11845
- (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
+ )
11846
11879
  )
11847
11880
  );
11848
11881
  const \u7E26\u304B\u3089 = chartAreaH / 2 - \u5F15\u304D\u51FA\u3057 - \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057;
11849
11882
  const \u6A2A\u304B\u3089 = (node.w - PAD_SIDE * 2) / 2 - \u5F15\u304D\u51FA\u3057 - \u5B57\u307E\u3067\u306E\u9593 - \u540D\u672D\u5E45;
11850
11883
  const radius = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
11851
- 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;
11852
11887
  const cx = node.w / 2;
11853
11888
  const cy = PAD_TOP2 + chartAreaH / 2;
11854
- let cumAngle = -Math.PI / 2;
11855
- let cumFrac = 0;
11856
- const slices = data.map((d) => {
11857
- const frac = d.value / total;
11858
- const angle = frac * Math.PI * 2;
11859
- const a0 = cumAngle;
11860
- const a1 = cumAngle + angle;
11861
- cumAngle = a1;
11862
- const startFrac = cumFrac;
11863
- cumFrac += frac;
11864
- const x1 = cx + radius * Math.cos(a0);
11865
- const y1 = cy + radius * Math.sin(a0);
11866
- const x2 = cx + radius * Math.cos(a1);
11867
- const y2 = cy + radius * Math.sin(a1);
11868
- const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
11869
- const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
11870
- const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
11871
- const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
11872
- const large = angle > Math.PI ? 1 : 0;
11873
- 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`;
11874
- const \u4E2D\u592E\u89D2 = (a0 + a1) / 2;
11875
- return { d, frac, path, startFrac, \u4E2D\u592E\u89D2 };
11876
- });
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);
11877
11891
  const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
11878
11892
  const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
11879
11893
  const \u5F71id = `cdl-pie-shadow-${instanceId}`;
@@ -11897,19 +11911,34 @@ function ChartPieNode({
11897
11911
  drawing && /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }),
11898
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" }) })
11899
11913
  ] }),
11900
- /* @__PURE__ */ jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, filter: `url(#${\u5F71id})`, children: slices.map((s, idx) => /* @__PURE__ */ jsx(
11901
- "path",
11902
- {
11903
- "data-cdl-role": "chart-pie-slice",
11904
- "data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
11905
- d: s.path,
11906
- fill: sliceColor(s.d.tone, idx),
11907
- stroke: "var(--cdl-node-fill, #ffffff)",
11908
- strokeWidth: 3,
11909
- strokeLinejoin: "round"
11910
- },
11911
- `slice-${idx}`
11912
- )) }),
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
+ ] }),
11913
11942
  /* @__PURE__ */ jsx(
11914
11943
  "text",
11915
11944
  {
@@ -11919,7 +11948,7 @@ function ChartPieNode({
11919
11948
  fontSize: Math.round(radius * 0.26),
11920
11949
  fontWeight: 600,
11921
11950
  fill: "var(--cdl-text, #1a1f2a)",
11922
- children: \u5B9F\u5024\u8868\u8A18(Math.round(total))
11951
+ children: \u5B9F\u5024\u8868\u8A18(Math.round(\u524D\u3042\u308A ? \u4ECA\u306E\u5408\u8A08 : total))
11923
11952
  }
11924
11953
  ),
11925
11954
  /* @__PURE__ */ jsx(
@@ -11956,12 +11985,12 @@ function ChartPieNode({
11956
11985
  "text",
11957
11986
  {
11958
11987
  x: \u5B57x,
11959
- y: \u6298\u308Cy - 3,
11988
+ y: \u6298\u308Cy - 1,
11960
11989
  textAnchor: \u53F3 ? "start" : "end",
11961
- fontSize: \u540D\u672D\u306E\u7D1A,
11990
+ fontSize: \u5272\u5408\u306E\u7D1A,
11962
11991
  fontWeight: 600,
11963
11992
  fill: "var(--cdl-text, #1a1f2a)",
11964
- children: s.d.label
11993
+ children: \u5272\u5408\u306E\u6587\u5B57[idx]
11965
11994
  }
11966
11995
  ),
11967
11996
  /* @__PURE__ */ jsx(
@@ -11970,15 +11999,275 @@ function ChartPieNode({
11970
11999
  x: \u5B57x,
11971
12000
  y: \u6298\u308Cy + 15,
11972
12001
  textAnchor: \u53F3 ? "start" : "end",
11973
- fontSize: \u6570\u5024\u306E\u7D1A,
12002
+ fontSize: \u540D\u524D\u306E\u7D1A,
11974
12003
  fill: "var(--cdl-text-dim, #5a6270)",
11975
- children: \u6570\u5024\u306E\u6587\u5B57[idx]
12004
+ children: \u540D\u524D\u306E\u6587\u5B57[idx]
11976
12005
  }
11977
12006
  )
11978
12007
  ] }, `callout-${idx}`);
11979
12008
  })
11980
12009
  ] });
11981
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
+ }
11982
12271
  function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
11983
12272
  if (\u958B\u304D <= 0) return null;
11984
12273
  if (\u958B\u304D >= 1) return /* @__PURE__ */ jsx("circle", { cx, cy, r });
@@ -12180,8 +12469,8 @@ function ChartRadialNode({
12180
12469
  frac,
12181
12470
  \u4E2D\u5FC3\u534A\u5F84,
12182
12471
  // 軌道は全周。 1 周ちょうどは弧で表せないので、 わずかに欠かして描く
12183
- \u8ECC\u9053: \u5F27\u306E\u9053(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
12184
- \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))
12185
12474
  };
12186
12475
  });
12187
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;
@@ -12252,7 +12541,7 @@ function ChartRadialNode({
12252
12541
  ] });
12253
12542
  }
12254
12543
  var \u5370\u306E\u5E45 = 18;
12255
- 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) {
12256
12545
  const \u5916 = \u4E2D\u5FC3\u534A\u5F84 + \u5E45 / 2;
12257
12546
  const \u5185 = Math.max(0.5, \u4E2D\u5FC3\u534A\u5F84 - \u5E45 / 2);
12258
12547
  const a0 = -Math.PI / 2;
@@ -12298,12 +12587,12 @@ function ChartStatNode({
12298
12587
  }
12299
12588
  ),
12300
12589
  data.map((d, idx) => {
12301
- const \u67A0 = \u533A\u753B.\u67A0(idx);
12590
+ const \u67A02 = \u533A\u753B.\u67A0(idx);
12302
12591
  const frac = total > 0 ? d.value / total : 0;
12303
12592
  const \u8272 = \u5370\u306E\u8272(d.tone, idx);
12304
12593
  const \u6570\u5024 = \u5B9F\u5024\u8868\u8A184(d.value);
12305
- 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);
12306
- 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: [
12307
12596
  idx > 0 && /* @__PURE__ */ jsx(
12308
12597
  "line",
12309
12598
  {
@@ -12311,7 +12600,7 @@ function ChartStatNode({
12311
12600
  x1: 0,
12312
12601
  y1: \u533A\u753B.\u4F59\u767D,
12313
12602
  x2: 0,
12314
- y2: \u67A0.h - \u533A\u753B.\u4F59\u767D,
12603
+ y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
12315
12604
  stroke: "var(--cdl-divider, #d4d4d8)",
12316
12605
  strokeWidth: 1
12317
12606
  }
@@ -12320,7 +12609,7 @@ function ChartStatNode({
12320
12609
  "text",
12321
12610
  {
12322
12611
  "data-cdl-role": "chart-stat-label",
12323
- x: \u67A0.w / 2,
12612
+ x: \u67A02.w / 2,
12324
12613
  y: \u533A\u753B.\u540D\u524D\u306Ey,
12325
12614
  fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
12326
12615
  fontWeight: 700,
@@ -12334,7 +12623,7 @@ function ChartStatNode({
12334
12623
  {
12335
12624
  "data-cdl-role": "chart-stat-value",
12336
12625
  "data-cdl-unresolved": d.unresolved ? "true" : void 0,
12337
- x: \u67A0.w / 2,
12626
+ x: \u67A02.w / 2,
12338
12627
  y: \u533A\u753B.\u6570\u5024\u306Ey,
12339
12628
  fontSize: \u6570\u5024\u306E\u7D1A,
12340
12629
  fontWeight: 700,
@@ -12347,7 +12636,7 @@ function ChartStatNode({
12347
12636
  "circle",
12348
12637
  {
12349
12638
  "data-cdl-role": "chart-stat-track",
12350
- cx: \u67A0.w / 2,
12639
+ cx: \u67A02.w / 2,
12351
12640
  cy: \u533A\u753B.\u5F27\u306Ey,
12352
12641
  r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
12353
12642
  fill: "none",
@@ -12360,7 +12649,7 @@ function ChartStatNode({
12360
12649
  "path",
12361
12650
  {
12362
12651
  "data-cdl-role": "chart-stat-arc",
12363
- 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)),
12364
12653
  fill: "none",
12365
12654
  stroke: \u8272,
12366
12655
  strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
@@ -12371,7 +12660,7 @@ function ChartStatNode({
12371
12660
  "text",
12372
12661
  {
12373
12662
  "data-cdl-role": "chart-stat-share",
12374
- x: \u67A0.w / 2,
12663
+ x: \u67A02.w / 2,
12375
12664
  y: \u533A\u753B.\u5272\u5408\u306Ey,
12376
12665
  fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
12377
12666
  textAnchor: "middle",
@@ -12416,7 +12705,7 @@ function \u53CE\u3081\u308B\u7D1A(\u5B57, \u4F7F\u3048\u308B\u5E452, \u521D\u671
12416
12705
  while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B57, \u7D1A) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
12417
12706
  return \u7D1A;
12418
12707
  }
12419
- function \u5F27\u306E\u90532(cx, cy, r, \u5272\u5408) {
12708
+ function \u5F27\u306E\u90533(cx, cy, r, \u5272\u5408) {
12420
12709
  const a0 = -Math.PI / 2;
12421
12710
  const a1 = a0 + \u5272\u5408 * Math.PI * 2;
12422
12711
  const large = \u5272\u5408 > 0.5 ? 1 : 0;