@cardenelabs/cdl 0.40.7 → 0.40.9

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
@@ -9926,6 +9926,19 @@ function StateDiffCard({
9926
9926
  }
9927
9927
  );
9928
9928
  }
9929
+
9930
+ // src/kinds/axis-ticks.ts
9931
+ function \u76EE\u76DB\u308A\u306E\u523B\u307F(\u7BC4\u56F2, \u76EE\u5B89\u306E\u672C\u6570) {
9932
+ if (!(\u7BC4\u56F2 > 0) || false) return 0;
9933
+ const \u7C97\u3044 = \u7BC4\u56F2 / \u76EE\u5B89\u306E\u672C\u6570;
9934
+ const \u6841 = 10 ** Math.floor(Math.log10(\u7C97\u3044));
9935
+ const \u6B63\u898F = \u7C97\u3044 / \u6841;
9936
+ const \u5019\u88DC = \u6B63\u898F <= 1 ? 1 : \u6B63\u898F <= 2 ? 2 : \u6B63\u898F <= 2.5 ? 2.5 : \u6B63\u898F <= 5 ? 5 : 10;
9937
+ return \u5019\u88DC * \u6841;
9938
+ }
9939
+ var \u76EE\u76DB\u308A\u306E\u76EE\u5B89 = 4;
9940
+ var \u5024\u672D\u306E\u7D1A = 12;
9941
+ var \u8EF8\u306E\u540D\u524D\u306E\u7D1A = 11;
9929
9942
  var \u6570\u3092\u66F8\u304F = (value) => value.toLocaleString("en-US", { maximumFractionDigits: 12 });
9930
9943
  function \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values) {
9931
9944
  let rawMin = values.length > 0 ? Math.min(...values) : 0;
@@ -9935,11 +9948,7 @@ function \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values) {
9935
9948
  rawMin -= room;
9936
9949
  rawMax += room;
9937
9950
  }
9938
- const roughStep = (rawMax - rawMin) / 4;
9939
- const power = 10 ** Math.floor(Math.log10(roughStep));
9940
- const fraction = roughStep / power;
9941
- const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 2.5 ? 2.5 : fraction <= 5 ? 5 : 10;
9942
- const step = niceFraction * power;
9951
+ const step = \u76EE\u76DB\u308A\u306E\u523B\u307F(rawMax - rawMin, \u76EE\u76DB\u308A\u306E\u76EE\u5B89);
9943
9952
  const min = Math.floor(rawMin / step) * step;
9944
9953
  const max = Math.ceil(rawMax / step) * step;
9945
9954
  const tickCount = Math.round((max - min) / step);
@@ -10046,6 +10055,7 @@ function ChartLineNode({
10046
10055
  /* @__PURE__ */ jsxRuntime.jsx(
10047
10056
  "text",
10048
10057
  {
10058
+ "data-cdl-role": "chart-line-tick",
10049
10059
  x: PAD_LEFT2 - 8,
10050
10060
  y: t.y + 4,
10051
10061
  fontSize: 11,
@@ -10123,7 +10133,7 @@ function ChartLineNode({
10123
10133
  "data-cdl-role": "chart-line-value",
10124
10134
  x: cx,
10125
10135
  y: labelY,
10126
- fontSize: 11,
10136
+ fontSize: \u5024\u672D\u306E\u7D1A,
10127
10137
  fontWeight: 600,
10128
10138
  textAnchor: "middle",
10129
10139
  fill: "var(--cdl-text, #1a1f2a)",
@@ -10181,9 +10191,10 @@ function ChartLineNode({
10181
10191
  /* @__PURE__ */ jsxRuntime.jsx(
10182
10192
  "text",
10183
10193
  {
10194
+ "data-cdl-role": "chart-line-label",
10184
10195
  x: cx,
10185
10196
  y: PAD_TOP2 + canvasH + 20,
10186
- fontSize: 12,
10197
+ fontSize: \u8EF8\u306E\u540D\u524D\u306E\u7D1A,
10187
10198
  textAnchor: "middle",
10188
10199
  fill: "var(--cdl-text-dim, #5a6270)",
10189
10200
  children: d.label
@@ -12720,6 +12731,7 @@ function ChartStatNode({
12720
12731
  const data = resolveChartData(node.chartData ?? [], stateValues);
12721
12732
  const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
12722
12733
  const \u533A\u753B = \u533A\u753B\u306E\u5272\u4ED8(node.w, node.h, data.length);
12734
+ const \u5272\u5408\u3092\u51FA\u3059 = data.length > 1;
12723
12735
  return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
12724
12736
  /* @__PURE__ */ jsxRuntime.jsx(
12725
12737
  "rect",
@@ -12741,83 +12753,91 @@ function ChartStatNode({
12741
12753
  const \u8272 = \u5370\u306E\u8272(d.tone, idx);
12742
12754
  const \u6570\u5024 = \u5B9F\u5024\u8868\u8A18(d.value);
12743
12755
  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);
12744
- return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A02.x} ${\u67A02.y})`, children: [
12745
- idx > 0 && /* @__PURE__ */ jsxRuntime.jsx(
12746
- "line",
12747
- {
12748
- "data-cdl-role": "chart-stat-divider",
12749
- x1: 0,
12750
- y1: \u533A\u753B.\u4F59\u767D,
12751
- x2: 0,
12752
- y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
12753
- stroke: "var(--cdl-divider, #d4d4d8)",
12754
- strokeWidth: 1
12755
- }
12756
- ),
12757
- /* @__PURE__ */ jsxRuntime.jsx(
12758
- "text",
12759
- {
12760
- "data-cdl-role": "chart-stat-label",
12761
- x: \u67A02.w / 2,
12762
- y: \u533A\u753B.\u540D\u524D\u306Ey,
12763
- fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
12764
- fontWeight: 700,
12765
- textAnchor: "middle",
12766
- fill: "var(--cdl-text-dim, #5a6270)",
12767
- children: d.label
12768
- }
12769
- ),
12770
- /* @__PURE__ */ jsxRuntime.jsx(
12771
- "text",
12772
- {
12773
- "data-cdl-role": "chart-stat-value",
12774
- "data-cdl-unresolved": d.unresolved ? "true" : void 0,
12775
- x: \u67A02.w / 2,
12776
- y: \u533A\u753B.\u6570\u5024\u306Ey,
12777
- fontSize: \u6570\u5024\u306E\u7D1A,
12778
- fontWeight: 700,
12779
- textAnchor: "middle",
12780
- fill: \u8272,
12781
- children: \u6570\u5024
12782
- }
12783
- ),
12784
- /* @__PURE__ */ jsxRuntime.jsx(
12785
- "circle",
12786
- {
12787
- "data-cdl-role": "chart-stat-track",
12788
- cx: \u67A02.w / 2,
12789
- cy: \u533A\u753B.\u5F27\u306Ey,
12790
- r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
12791
- fill: "none",
12792
- stroke: "var(--cdl-divider, #d4d4d8)",
12793
- strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
12794
- strokeOpacity: 0.5
12795
- }
12796
- ),
12797
- frac > 0 && /* @__PURE__ */ jsxRuntime.jsx(
12798
- "path",
12799
- {
12800
- "data-cdl-role": "chart-stat-arc",
12801
- d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
12802
- fill: "none",
12803
- stroke: \u8272,
12804
- strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
12805
- strokeLinecap: "round"
12806
- }
12807
- ),
12808
- /* @__PURE__ */ jsxRuntime.jsx(
12809
- "text",
12810
- {
12811
- "data-cdl-role": "chart-stat-share",
12812
- x: \u67A02.w / 2,
12813
- y: \u533A\u753B.\u5272\u5408\u306Ey,
12814
- fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
12815
- textAnchor: "middle",
12816
- fill: "var(--cdl-text-dim, #5a6270)",
12817
- children: \u5272\u5408\u8868\u8A18(frac)
12818
- }
12819
- )
12820
- ] }, `stat-${idx}`);
12756
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12757
+ "g",
12758
+ {
12759
+ "data-cdl-role": "chart-stat-item",
12760
+ transform: `translate(${\u67A02.x} ${\u67A02.y})`,
12761
+ children: [
12762
+ idx > 0 && /* @__PURE__ */ jsxRuntime.jsx(
12763
+ "line",
12764
+ {
12765
+ "data-cdl-role": "chart-stat-divider",
12766
+ x1: 0,
12767
+ y1: \u533A\u753B.\u4F59\u767D,
12768
+ x2: 0,
12769
+ y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
12770
+ stroke: "var(--cdl-divider, #d4d4d8)",
12771
+ strokeWidth: 1
12772
+ }
12773
+ ),
12774
+ /* @__PURE__ */ jsxRuntime.jsx(
12775
+ "text",
12776
+ {
12777
+ "data-cdl-role": "chart-stat-label",
12778
+ x: \u67A02.w / 2,
12779
+ y: \u533A\u753B.\u540D\u524D\u306Ey,
12780
+ fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
12781
+ fontWeight: 700,
12782
+ textAnchor: "middle",
12783
+ fill: "var(--cdl-text-dim, #5a6270)",
12784
+ children: d.label
12785
+ }
12786
+ ),
12787
+ /* @__PURE__ */ jsxRuntime.jsx(
12788
+ "text",
12789
+ {
12790
+ "data-cdl-role": "chart-stat-value",
12791
+ "data-cdl-unresolved": d.unresolved ? "true" : void 0,
12792
+ x: \u67A02.w / 2,
12793
+ y: \u533A\u753B.\u6570\u5024\u306Ey,
12794
+ fontSize: \u6570\u5024\u306E\u7D1A,
12795
+ fontWeight: 700,
12796
+ textAnchor: "middle",
12797
+ fill: \u8272,
12798
+ children: \u6570\u5024
12799
+ }
12800
+ ),
12801
+ \u5272\u5408\u3092\u51FA\u3059 && /* @__PURE__ */ jsxRuntime.jsx(
12802
+ "circle",
12803
+ {
12804
+ "data-cdl-role": "chart-stat-track",
12805
+ cx: \u67A02.w / 2,
12806
+ cy: \u533A\u753B.\u5F27\u306Ey,
12807
+ r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
12808
+ fill: "none",
12809
+ stroke: "var(--cdl-divider, #d4d4d8)",
12810
+ strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
12811
+ strokeOpacity: 0.5
12812
+ }
12813
+ ),
12814
+ \u5272\u5408\u3092\u51FA\u3059 && frac > 0 && /* @__PURE__ */ jsxRuntime.jsx(
12815
+ "path",
12816
+ {
12817
+ "data-cdl-role": "chart-stat-arc",
12818
+ d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
12819
+ fill: "none",
12820
+ stroke: \u8272,
12821
+ strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
12822
+ strokeLinecap: "round"
12823
+ }
12824
+ ),
12825
+ \u5272\u5408\u3092\u51FA\u3059 && /* @__PURE__ */ jsxRuntime.jsx(
12826
+ "text",
12827
+ {
12828
+ "data-cdl-role": "chart-stat-share",
12829
+ x: \u67A02.w / 2,
12830
+ y: \u533A\u753B.\u5272\u5408\u306Ey,
12831
+ fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
12832
+ textAnchor: "middle",
12833
+ fill: "var(--cdl-text-dim, #5a6270)",
12834
+ children: \u5272\u5408\u8868\u8A18(frac)
12835
+ }
12836
+ )
12837
+ ]
12838
+ },
12839
+ `stat-${idx}`
12840
+ );
12821
12841
  })
12822
12842
  ] });
12823
12843
  }
@@ -13398,19 +13418,13 @@ function \u53CE\u3081\u308B\u7D1A2(\u540D\u524D\u305F\u3061, \u5E45, \u4E0A\u965
13398
13418
  while (\u7D1A > \u4E0B\u9650 && Math.max(...\u540D\u524D\u305F\u3061.map((n) => textWidth(n, \u7D1A))) > \u5E45) \u7D1A -= 1;
13399
13419
  return \u7D1A;
13400
13420
  }
13401
- function \u76EE\u76DB\u308A\u306E\u523B\u307F(\u6700\u5927, \u76EE\u5B89\u306E\u672C\u6570) {
13402
- if (!(\u6700\u5927 > 0) || false) return 0;
13403
- const \u7C97\u3044 = \u6700\u5927 / \u76EE\u5B89\u306E\u672C\u6570;
13404
- const \u6841 = 10 ** Math.floor(Math.log10(\u7C97\u3044));
13405
- const \u6B63\u898F = \u7C97\u3044 / \u6841;
13406
- const \u5019\u88DC = \u6B63\u898F <= 1 ? 1 : \u6B63\u898F <= 2 ? 2 : \u6B63\u898F <= 2.5 ? 2.5 : \u6B63\u898F <= 5 ? 5 : 10;
13407
- return \u5019\u88DC * \u6841;
13408
- }
13409
13421
  function \u5C0F\u6570\u306E\u6841(n) {
13410
13422
  const [\u4EEE\u6570, \u6307\u6570] = n.toExponential().split("e");
13411
13423
  const \u5C0F\u6570\u90E8 = (\u4EEE\u6570 ?? "").split(".")[1]?.length ?? 0;
13412
13424
  return Math.min(20, Math.max(0, \u5C0F\u6570\u90E8 - Number(\u6307\u6570)));
13413
13425
  }
13426
+ var \u5024\u672D\u306E\u7D1A2 = 12;
13427
+ var \u8EF8\u306E\u540D\u524D\u306E\u7D1A2 = 11;
13414
13428
  var \u6841\u3067\u4E38\u3081\u308B = (v, \u6841) => Number(v.toFixed(\u6841));
13415
13429
  function ChartBarNode({
13416
13430
  node,
@@ -13429,9 +13443,9 @@ function ChartBarNode({
13429
13443
  const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
13430
13444
  const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
13431
13445
  const vMax = data.length > 0 ? Math.max(...data.map((d) => d.value)) : 1;
13432
- const \u76EE\u76DB\u308A\u306E\u76EE\u5B89 = 4;
13446
+ const \u76EE\u76DB\u308A\u306E\u76EE\u5B892 = 4;
13433
13447
  const \u5929\u4E95\u306E\u3082\u3068 = vMax > 0 ? vMax : 1;
13434
- const \u523B\u307F = \u76EE\u76DB\u308A\u306E\u523B\u307F(\u5929\u4E95\u306E\u3082\u3068, \u76EE\u76DB\u308A\u306E\u76EE\u5B89);
13448
+ const \u523B\u307F = \u76EE\u76DB\u308A\u306E\u523B\u307F(\u5929\u4E95\u306E\u3082\u3068, \u76EE\u76DB\u308A\u306E\u76EE\u5B892);
13435
13449
  const \u523B\u307F\u306E\u6841 = \u5C0F\u6570\u306E\u6841(\u523B\u307F);
13436
13450
  const \u5929\u4E95 = \u6841\u3067\u4E38\u3081\u308B(Math.ceil(\u5929\u4E95\u306E\u3082\u3068 / \u523B\u307F - 1e-9) * \u523B\u307F, \u523B\u307F\u306E\u6841);
13437
13451
  const \u68D2\u3068\u9699\u9593\u306E\u6BD4 = 2.2;
@@ -13531,7 +13545,7 @@ function ChartBarNode({
13531
13545
  "data-cdl-role": "chart-bar-value",
13532
13546
  x: bx + barW / 2,
13533
13547
  y: \u898B\u3048\u3066\u3044\u308B\u982D - 8,
13534
- fontSize: 12,
13548
+ fontSize: \u5024\u672D\u306E\u7D1A2,
13535
13549
  fontWeight: 600,
13536
13550
  textAnchor: "middle",
13537
13551
  fill: "var(--cdl-text, #1a1f2a)",
@@ -13544,7 +13558,7 @@ function ChartBarNode({
13544
13558
  "data-cdl-role": "chart-bar-label",
13545
13559
  x: bx + barW / 2,
13546
13560
  y: PAD_TOP2 + canvasH + 18,
13547
- fontSize: 11,
13561
+ fontSize: \u8EF8\u306E\u540D\u524D\u306E\u7D1A2,
13548
13562
  textAnchor: "middle",
13549
13563
  fill: "var(--cdl-text-dim, #5a6270)",
13550
13564
  children: d.label