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