@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/index.js CHANGED
@@ -22420,6 +22420,19 @@ function StateDiffCard({
22420
22420
  }
22421
22421
  );
22422
22422
  }
22423
+
22424
+ // src/kinds/axis-ticks.ts
22425
+ function \u76EE\u76DB\u308A\u306E\u523B\u307F(\u7BC4\u56F2, \u76EE\u5B89\u306E\u672C\u6570) {
22426
+ if (!(\u7BC4\u56F2 > 0) || false) return 0;
22427
+ const \u7C97\u3044 = \u7BC4\u56F2 / \u76EE\u5B89\u306E\u672C\u6570;
22428
+ const \u6841 = 10 ** Math.floor(Math.log10(\u7C97\u3044));
22429
+ const \u6B63\u898F = \u7C97\u3044 / \u6841;
22430
+ const \u5019\u88DC = \u6B63\u898F <= 1 ? 1 : \u6B63\u898F <= 2 ? 2 : \u6B63\u898F <= 2.5 ? 2.5 : \u6B63\u898F <= 5 ? 5 : 10;
22431
+ return \u5019\u88DC * \u6841;
22432
+ }
22433
+ var \u76EE\u76DB\u308A\u306E\u76EE\u5B89 = 4;
22434
+ var \u5024\u672D\u306E\u7D1A = 12;
22435
+ var \u8EF8\u306E\u540D\u524D\u306E\u7D1A = 11;
22423
22436
  var \u6570\u3092\u66F8\u304F = (value) => value.toLocaleString("en-US", { maximumFractionDigits: 12 });
22424
22437
  function \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values) {
22425
22438
  let rawMin = values.length > 0 ? Math.min(...values) : 0;
@@ -22429,11 +22442,7 @@ function \u6298\u308C\u7DDA\u306E\u76EE\u76DB(values) {
22429
22442
  rawMin -= room;
22430
22443
  rawMax += room;
22431
22444
  }
22432
- const roughStep = (rawMax - rawMin) / 4;
22433
- const power = 10 ** Math.floor(Math.log10(roughStep));
22434
- const fraction = roughStep / power;
22435
- const niceFraction = fraction <= 1 ? 1 : fraction <= 2 ? 2 : fraction <= 2.5 ? 2.5 : fraction <= 5 ? 5 : 10;
22436
- const step = niceFraction * power;
22445
+ const step = \u76EE\u76DB\u308A\u306E\u523B\u307F(rawMax - rawMin, \u76EE\u76DB\u308A\u306E\u76EE\u5B89);
22437
22446
  const min = Math.floor(rawMin / step) * step;
22438
22447
  const max = Math.ceil(rawMax / step) * step;
22439
22448
  const tickCount = Math.round((max - min) / step);
@@ -22540,6 +22549,7 @@ function ChartLineNode({
22540
22549
  /* @__PURE__ */ jsx(
22541
22550
  "text",
22542
22551
  {
22552
+ "data-cdl-role": "chart-line-tick",
22543
22553
  x: PAD_LEFT2 - 8,
22544
22554
  y: t.y + 4,
22545
22555
  fontSize: 11,
@@ -22617,7 +22627,7 @@ function ChartLineNode({
22617
22627
  "data-cdl-role": "chart-line-value",
22618
22628
  x: cx,
22619
22629
  y: labelY,
22620
- fontSize: 11,
22630
+ fontSize: \u5024\u672D\u306E\u7D1A,
22621
22631
  fontWeight: 600,
22622
22632
  textAnchor: "middle",
22623
22633
  fill: "var(--cdl-text, #1a1f2a)",
@@ -22675,9 +22685,10 @@ function ChartLineNode({
22675
22685
  /* @__PURE__ */ jsx(
22676
22686
  "text",
22677
22687
  {
22688
+ "data-cdl-role": "chart-line-label",
22678
22689
  x: cx,
22679
22690
  y: PAD_TOP2 + canvasH + 20,
22680
- fontSize: 12,
22691
+ fontSize: \u8EF8\u306E\u540D\u524D\u306E\u7D1A,
22681
22692
  textAnchor: "middle",
22682
22693
  fill: "var(--cdl-text-dim, #5a6270)",
22683
22694
  children: d.label
@@ -25217,6 +25228,7 @@ function ChartStatNode({
25217
25228
  const data = resolveChartData(node.chartData ?? [], stateValues);
25218
25229
  const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
25219
25230
  const \u533A\u753B = \u533A\u753B\u306E\u5272\u4ED8(node.w, node.h, data.length);
25231
+ const \u5272\u5408\u3092\u51FA\u3059 = data.length > 1;
25220
25232
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
25221
25233
  /* @__PURE__ */ jsx(
25222
25234
  "rect",
@@ -25238,83 +25250,91 @@ function ChartStatNode({
25238
25250
  const \u8272 = \u5370\u306E\u8272(d.tone, idx);
25239
25251
  const \u6570\u5024 = \u5B9F\u5024\u8868\u8A18(d.value);
25240
25252
  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);
25241
- return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A02.x} ${\u67A02.y})`, children: [
25242
- idx > 0 && /* @__PURE__ */ jsx(
25243
- "line",
25244
- {
25245
- "data-cdl-role": "chart-stat-divider",
25246
- x1: 0,
25247
- y1: \u533A\u753B.\u4F59\u767D,
25248
- x2: 0,
25249
- y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
25250
- stroke: "var(--cdl-divider, #d4d4d8)",
25251
- strokeWidth: 1
25252
- }
25253
- ),
25254
- /* @__PURE__ */ jsx(
25255
- "text",
25256
- {
25257
- "data-cdl-role": "chart-stat-label",
25258
- x: \u67A02.w / 2,
25259
- y: \u533A\u753B.\u540D\u524D\u306Ey,
25260
- fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
25261
- fontWeight: 700,
25262
- textAnchor: "middle",
25263
- fill: "var(--cdl-text-dim, #5a6270)",
25264
- children: d.label
25265
- }
25266
- ),
25267
- /* @__PURE__ */ jsx(
25268
- "text",
25269
- {
25270
- "data-cdl-role": "chart-stat-value",
25271
- "data-cdl-unresolved": d.unresolved ? "true" : void 0,
25272
- x: \u67A02.w / 2,
25273
- y: \u533A\u753B.\u6570\u5024\u306Ey,
25274
- fontSize: \u6570\u5024\u306E\u7D1A,
25275
- fontWeight: 700,
25276
- textAnchor: "middle",
25277
- fill: \u8272,
25278
- children: \u6570\u5024
25279
- }
25280
- ),
25281
- /* @__PURE__ */ jsx(
25282
- "circle",
25283
- {
25284
- "data-cdl-role": "chart-stat-track",
25285
- cx: \u67A02.w / 2,
25286
- cy: \u533A\u753B.\u5F27\u306Ey,
25287
- r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
25288
- fill: "none",
25289
- stroke: "var(--cdl-divider, #d4d4d8)",
25290
- strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
25291
- strokeOpacity: 0.5
25292
- }
25293
- ),
25294
- frac > 0 && /* @__PURE__ */ jsx(
25295
- "path",
25296
- {
25297
- "data-cdl-role": "chart-stat-arc",
25298
- d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
25299
- fill: "none",
25300
- stroke: \u8272,
25301
- strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
25302
- strokeLinecap: "round"
25303
- }
25304
- ),
25305
- /* @__PURE__ */ jsx(
25306
- "text",
25307
- {
25308
- "data-cdl-role": "chart-stat-share",
25309
- x: \u67A02.w / 2,
25310
- y: \u533A\u753B.\u5272\u5408\u306Ey,
25311
- fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
25312
- textAnchor: "middle",
25313
- fill: "var(--cdl-text-dim, #5a6270)",
25314
- children: \u5272\u5408\u8868\u8A18(frac)
25315
- }
25316
- )
25317
- ] }, `stat-${idx}`);
25253
+ return /* @__PURE__ */ jsxs(
25254
+ "g",
25255
+ {
25256
+ "data-cdl-role": "chart-stat-item",
25257
+ transform: `translate(${\u67A02.x} ${\u67A02.y})`,
25258
+ children: [
25259
+ idx > 0 && /* @__PURE__ */ jsx(
25260
+ "line",
25261
+ {
25262
+ "data-cdl-role": "chart-stat-divider",
25263
+ x1: 0,
25264
+ y1: \u533A\u753B.\u4F59\u767D,
25265
+ x2: 0,
25266
+ y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
25267
+ stroke: "var(--cdl-divider, #d4d4d8)",
25268
+ strokeWidth: 1
25269
+ }
25270
+ ),
25271
+ /* @__PURE__ */ jsx(
25272
+ "text",
25273
+ {
25274
+ "data-cdl-role": "chart-stat-label",
25275
+ x: \u67A02.w / 2,
25276
+ y: \u533A\u753B.\u540D\u524D\u306Ey,
25277
+ fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
25278
+ fontWeight: 700,
25279
+ textAnchor: "middle",
25280
+ fill: "var(--cdl-text-dim, #5a6270)",
25281
+ children: d.label
25282
+ }
25283
+ ),
25284
+ /* @__PURE__ */ jsx(
25285
+ "text",
25286
+ {
25287
+ "data-cdl-role": "chart-stat-value",
25288
+ "data-cdl-unresolved": d.unresolved ? "true" : void 0,
25289
+ x: \u67A02.w / 2,
25290
+ y: \u533A\u753B.\u6570\u5024\u306Ey,
25291
+ fontSize: \u6570\u5024\u306E\u7D1A,
25292
+ fontWeight: 700,
25293
+ textAnchor: "middle",
25294
+ fill: \u8272,
25295
+ children: \u6570\u5024
25296
+ }
25297
+ ),
25298
+ \u5272\u5408\u3092\u51FA\u3059 && /* @__PURE__ */ jsx(
25299
+ "circle",
25300
+ {
25301
+ "data-cdl-role": "chart-stat-track",
25302
+ cx: \u67A02.w / 2,
25303
+ cy: \u533A\u753B.\u5F27\u306Ey,
25304
+ r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
25305
+ fill: "none",
25306
+ stroke: "var(--cdl-divider, #d4d4d8)",
25307
+ strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
25308
+ strokeOpacity: 0.5
25309
+ }
25310
+ ),
25311
+ \u5272\u5408\u3092\u51FA\u3059 && frac > 0 && /* @__PURE__ */ jsx(
25312
+ "path",
25313
+ {
25314
+ "data-cdl-role": "chart-stat-arc",
25315
+ d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
25316
+ fill: "none",
25317
+ stroke: \u8272,
25318
+ strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
25319
+ strokeLinecap: "round"
25320
+ }
25321
+ ),
25322
+ \u5272\u5408\u3092\u51FA\u3059 && /* @__PURE__ */ jsx(
25323
+ "text",
25324
+ {
25325
+ "data-cdl-role": "chart-stat-share",
25326
+ x: \u67A02.w / 2,
25327
+ y: \u533A\u753B.\u5272\u5408\u306Ey,
25328
+ fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
25329
+ textAnchor: "middle",
25330
+ fill: "var(--cdl-text-dim, #5a6270)",
25331
+ children: \u5272\u5408\u8868\u8A18(frac)
25332
+ }
25333
+ )
25334
+ ]
25335
+ },
25336
+ `stat-${idx}`
25337
+ );
25318
25338
  })
25319
25339
  ] });
25320
25340
  }
@@ -25895,19 +25915,13 @@ function \u53CE\u3081\u308B\u7D1A2(\u540D\u524D\u305F\u3061, \u5E45, \u4E0A\u965
25895
25915
  while (\u7D1A > \u4E0B\u9650 && Math.max(...\u540D\u524D\u305F\u3061.map((n) => textWidth(n, \u7D1A))) > \u5E45) \u7D1A -= 1;
25896
25916
  return \u7D1A;
25897
25917
  }
25898
- function \u76EE\u76DB\u308A\u306E\u523B\u307F(\u6700\u5927, \u76EE\u5B89\u306E\u672C\u6570) {
25899
- if (!(\u6700\u5927 > 0) || false) return 0;
25900
- const \u7C97\u3044 = \u6700\u5927 / \u76EE\u5B89\u306E\u672C\u6570;
25901
- const \u6841 = 10 ** Math.floor(Math.log10(\u7C97\u3044));
25902
- const \u6B63\u898F = \u7C97\u3044 / \u6841;
25903
- const \u5019\u88DC = \u6B63\u898F <= 1 ? 1 : \u6B63\u898F <= 2 ? 2 : \u6B63\u898F <= 2.5 ? 2.5 : \u6B63\u898F <= 5 ? 5 : 10;
25904
- return \u5019\u88DC * \u6841;
25905
- }
25906
25918
  function \u5C0F\u6570\u306E\u6841(n) {
25907
25919
  const [\u4EEE\u6570, \u6307\u6570] = n.toExponential().split("e");
25908
25920
  const \u5C0F\u6570\u90E8 = (\u4EEE\u6570 ?? "").split(".")[1]?.length ?? 0;
25909
25921
  return Math.min(20, Math.max(0, \u5C0F\u6570\u90E8 - Number(\u6307\u6570)));
25910
25922
  }
25923
+ var \u5024\u672D\u306E\u7D1A2 = 12;
25924
+ var \u8EF8\u306E\u540D\u524D\u306E\u7D1A2 = 11;
25911
25925
  var \u6841\u3067\u4E38\u3081\u308B = (v, \u6841) => Number(v.toFixed(\u6841));
25912
25926
  function ChartBarNode({
25913
25927
  node,
@@ -25926,9 +25940,9 @@ function ChartBarNode({
25926
25940
  const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
25927
25941
  const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
25928
25942
  const vMax = data.length > 0 ? Math.max(...data.map((d) => d.value)) : 1;
25929
- const \u76EE\u76DB\u308A\u306E\u76EE\u5B89 = 4;
25943
+ const \u76EE\u76DB\u308A\u306E\u76EE\u5B892 = 4;
25930
25944
  const \u5929\u4E95\u306E\u3082\u3068 = vMax > 0 ? vMax : 1;
25931
- const \u523B\u307F = \u76EE\u76DB\u308A\u306E\u523B\u307F(\u5929\u4E95\u306E\u3082\u3068, \u76EE\u76DB\u308A\u306E\u76EE\u5B89);
25945
+ const \u523B\u307F = \u76EE\u76DB\u308A\u306E\u523B\u307F(\u5929\u4E95\u306E\u3082\u3068, \u76EE\u76DB\u308A\u306E\u76EE\u5B892);
25932
25946
  const \u523B\u307F\u306E\u6841 = \u5C0F\u6570\u306E\u6841(\u523B\u307F);
25933
25947
  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);
25934
25948
  const \u68D2\u3068\u9699\u9593\u306E\u6BD4 = 2.2;
@@ -26028,7 +26042,7 @@ function ChartBarNode({
26028
26042
  "data-cdl-role": "chart-bar-value",
26029
26043
  x: bx + barW / 2,
26030
26044
  y: \u898B\u3048\u3066\u3044\u308B\u982D - 8,
26031
- fontSize: 12,
26045
+ fontSize: \u5024\u672D\u306E\u7D1A2,
26032
26046
  fontWeight: 600,
26033
26047
  textAnchor: "middle",
26034
26048
  fill: "var(--cdl-text, #1a1f2a)",
@@ -26041,7 +26055,7 @@ function ChartBarNode({
26041
26055
  "data-cdl-role": "chart-bar-label",
26042
26056
  x: bx + barW / 2,
26043
26057
  y: PAD_TOP2 + canvasH + 18,
26044
- fontSize: 11,
26058
+ fontSize: \u8EF8\u306E\u540D\u524D\u306E\u7D1A2,
26045
26059
  textAnchor: "middle",
26046
26060
  fill: "var(--cdl-text-dim, #5a6270)",
26047
26061
  children: d.label