@cardenelabs/cdl 0.40.10 → 0.40.11

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
@@ -12460,18 +12460,35 @@ function ChartGaugeNode({
12460
12460
  const \u5185\u534A\u5F84 = radius * 0.62;
12461
12461
  const cx = node.w / 2;
12462
12462
  const cy = PAD_TOP2 + radius;
12463
+ const \u524D\u3042\u308A = \u51FA\u3059\u4EF6\u305F\u3061.some((d) => d.previous !== void 0);
12464
+ const \u524D\u306E\u5024 = \u51FA\u3059\u4EF6\u305F\u3061.map((d) => Math.max(0, d.previous ?? 0));
12465
+ const \u524D\u306E\u5408\u8A08 = \u524D\u306E\u5024.reduce((acc, v) => acc + v, 0);
12466
+ const \u5E2F = radius - \u5185\u534A\u5F84;
12467
+ const \u4ECA\u306E\u5185\u534A\u5F84 = \u524D\u3042\u308A ? \u5185\u534A\u5F84 + \u5E2F * 0.42 : \u5185\u534A\u5F84;
12468
+ const \u524D\u306E\u5185\u534A\u5F84 = \u5185\u534A\u5F84;
12469
+ const \u524D\u306E\u5916\u534A\u5F84 = \u5185\u534A\u5F84 + \u5E2F * 0.32;
12470
+ const \u6247\u306E\u9053 = (a0, a1, \u5185, \u5916) => {
12471
+ const \u59161 = \u6975(cx, cy, \u5916, a0);
12472
+ const \u59162 = \u6975(cx, cy, \u5916, a1);
12473
+ const \u51852 = \u6975(cx, cy, \u5185, a1);
12474
+ const \u51851 = \u6975(cx, cy, \u5185, a0);
12475
+ return `M ${\u59161.x} ${\u59161.y} A ${\u5916} ${\u5916} 0 0 1 ${\u59162.x} ${\u59162.y} L ${\u51852.x} ${\u51852.y} A ${\u5185} ${\u5185} 0 0 0 ${\u51851.x} ${\u51851.y} Z`;
12476
+ };
12463
12477
  let cumFrac = 0;
12464
12478
  const slices = \u51FA\u3059\u4EF6\u305F\u3061.map((d) => {
12465
12479
  const frac = d.value / total;
12466
12480
  const a0 = Math.PI + cumFrac * Math.PI;
12467
12481
  const a1 = a0 + frac * Math.PI;
12468
12482
  cumFrac += frac;
12469
- const \u59161 = \u6975(cx, cy, radius, a0);
12470
- const \u59162 = \u6975(cx, cy, radius, a1);
12471
- const \u51852 = \u6975(cx, cy, \u5185\u534A\u5F84, a1);
12472
- const \u51851 = \u6975(cx, cy, \u5185\u534A\u5F84, a0);
12473
- const path = `M ${\u59161.x} ${\u59161.y} A ${radius} ${radius} 0 0 1 ${\u59162.x} ${\u59162.y} L ${\u51852.x} ${\u51852.y} A ${\u5185\u534A\u5F84} ${\u5185\u534A\u5F84} 0 0 0 ${\u51851.x} ${\u51851.y} Z`;
12474
- return { d, frac, path };
12483
+ return { d, frac, path: \u6247\u306E\u9053(a0, a1, \u4ECA\u306E\u5185\u534A\u5F84, radius) };
12484
+ });
12485
+ let \u524D\u306Ecum = 0;
12486
+ const \u524D\u306E\u6247\u305F\u3061 = \u51FA\u3059\u4EF6\u305F\u3061.map((d, idx) => {
12487
+ const frac = \u524D\u306E\u5408\u8A08 > 0 ? (\u524D\u306E\u5024[idx] ?? 0) / \u524D\u306E\u5408\u8A08 : 0;
12488
+ const a0 = Math.PI + \u524D\u306Ecum * Math.PI;
12489
+ const a1 = a0 + frac * Math.PI;
12490
+ \u524D\u306Ecum += frac;
12491
+ return { d, frac, path: \u6247\u306E\u9053(a0, a1, \u524D\u306E\u5185\u534A\u5F84, \u524D\u306E\u5916\u534A\u5F84) };
12475
12492
  });
12476
12493
  const \u5408\u8A08\u306E\u6587\u5B57 = \u5B9F\u5024\u8868\u8A18(Math.round(total));
12477
12494
  const \u5358\u4F4D\u5E45 = Math.max(textWidth(\u5408\u8A08\u306E\u6587\u5B57, 100), 1) / 100;
@@ -12500,6 +12517,20 @@ function ChartGaugeNode({
12500
12517
  },
12501
12518
  `arc-${idx}`
12502
12519
  ));
12520
+ const \u524D\u306E\u5F27\u305F\u3061 = \u524D\u3042\u308A ? \u524D\u306E\u6247\u305F\u3061.map((s, idx) => /* @__PURE__ */ jsx(
12521
+ "path",
12522
+ {
12523
+ "data-cdl-role": "chart-gauge-previous",
12524
+ "data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
12525
+ d: s.path,
12526
+ fill: arcColor(s.d.tone, idx),
12527
+ fillOpacity: 0.45,
12528
+ stroke: "var(--cdl-node-fill, #ffffff)",
12529
+ strokeWidth: 1.5,
12530
+ strokeLinejoin: "round"
12531
+ },
12532
+ `prev-arc-${idx}`
12533
+ )) : null;
12503
12534
  return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
12504
12535
  /* @__PURE__ */ jsx(
12505
12536
  "rect",
@@ -12516,7 +12547,13 @@ function ChartGaugeNode({
12516
12547
  }
12517
12548
  ),
12518
12549
  drawing && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u4F38\u3073, Math.PI, Math.PI) }) }),
12519
- drawing ? /* @__PURE__ */ jsx("g", { clipPath: `url(#${\u5207\u308A\u629C\u304Did})`, children: \u5F27\u305F\u3061 }) : \u5F27\u305F\u3061,
12550
+ drawing ? /* @__PURE__ */ jsxs("g", { clipPath: `url(#${\u5207\u308A\u629C\u304Did})`, children: [
12551
+ \u524D\u306E\u5F27\u305F\u3061,
12552
+ \u5F27\u305F\u3061
12553
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
12554
+ \u524D\u306E\u5F27\u305F\u3061,
12555
+ \u5F27\u305F\u3061
12556
+ ] }),
12520
12557
  /* @__PURE__ */ jsx(
12521
12558
  "text",
12522
12559
  {
@@ -12625,9 +12662,11 @@ function ChartRadialNode({
12625
12662
  const rings = data.map((d, idx) => {
12626
12663
  const frac = d.value / total;
12627
12664
  const \u4E2D\u5FC3\u534A\u5F84 = \u5916\u534A\u5F84 - \u5E2F1\u672C * idx - \u5E2F1\u672C / 2;
12665
+ const \u524D\u306E\u5272\u5408 = d.previous === void 0 ? null : Math.max(0, d.previous) / total;
12628
12666
  return {
12629
12667
  d,
12630
12668
  frac,
12669
+ \u524D\u306E\u5272\u5408,
12631
12670
  \u4E2D\u5FC3\u534A\u5F84,
12632
12671
  // 軌道は全周。 1 周ちょうどは弧で表せないので、 わずかに欠かして描く
12633
12672
  \u8ECC\u9053: \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
@@ -12676,6 +12715,20 @@ function ChartRadialNode({
12676
12715
  )),
12677
12716
  drawing && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(\u5F27\u306Ecx, cy, \u5916\u534A\u5F84 + \u5E2F\u306E\u5E45, \u958B\u304D) }) }),
12678
12717
  drawing ? /* @__PURE__ */ jsx("g", { clipPath: `url(#${\u5207\u308A\u629C\u304Did})`, children: \u53D6\u308A\u5206\u305F\u3061 }) : \u53D6\u308A\u5206\u305F\u3061,
12718
+ rings.map(
12719
+ (r, idx) => r.\u524D\u306E\u5272\u5408 === null ? null : /* @__PURE__ */ jsx(
12720
+ "line",
12721
+ {
12722
+ "data-cdl-role": "chart-radial-previous",
12723
+ "data-cdl-unresolved": r.d.unresolved ? "true" : void 0,
12724
+ ...\u5E2F\u3092\u6A2A\u5207\u308B\u5370(\u5F27\u306Ecx, cy, r.\u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, Math.min(r.\u524D\u306E\u5272\u5408, 0.9999)),
12725
+ stroke: "var(--cdl-text-mute, #8a8678)",
12726
+ strokeWidth: 2,
12727
+ strokeLinecap: "round"
12728
+ },
12729
+ `prev-${idx}`
12730
+ )
12731
+ ),
12679
12732
  data.map((d, idx) => {
12680
12733
  const y = \u4E00\u89A7\u306E\u59CB\u307E\u308A + \u884C\u306E\u9AD8\u3055 * idx;
12681
12734
  return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-radial-item", children: [
@@ -12715,6 +12768,18 @@ function \u5F27\u306E\u90532(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5
12715
12768
  const p = (r, a) => `${cx + r * Math.cos(a)} ${cy + r * Math.sin(a)}`;
12716
12769
  return `M ${p(\u5916, a0)} A ${\u5916} ${\u5916} 0 ${large} 1 ${p(\u5916, a1)} L ${p(\u5185, a1)} A ${\u5185} ${\u5185} 0 ${large} 0 ${p(\u5185, a0)} Z`;
12717
12770
  }
12771
+ function \u5E2F\u3092\u6A2A\u5207\u308B\u5370(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5408) {
12772
+ const \u306F\u307F\u51FA\u3057 = Math.min(\u5E45 * 0.3, 5);
12773
+ const \u5916 = \u4E2D\u5FC3\u534A\u5F84 + \u5E45 / 2 + \u306F\u307F\u51FA\u3057;
12774
+ const \u5185 = Math.max(0.5, \u4E2D\u5FC3\u534A\u5F84 - \u5E45 / 2 - \u306F\u307F\u51FA\u3057);
12775
+ const a = -Math.PI / 2 + \u5272\u5408 * Math.PI * 2;
12776
+ return {
12777
+ x1: cx + \u5185 * Math.cos(a),
12778
+ y1: cy + \u5185 * Math.sin(a),
12779
+ x2: cx + \u5916 * Math.cos(a),
12780
+ y2: cy + \u5916 * Math.sin(a)
12781
+ };
12782
+ }
12718
12783
  function arcColor2(tone, idx) {
12719
12784
  if (tone) return TONE[tone];
12720
12785
  return chartSeriesColor(idx);
@@ -13465,8 +13530,9 @@ function ChartBarNode({
13465
13530
  const canvasW = node.w - PAD_LEFT2 - PAD_RIGHT2;
13466
13531
  const canvasH = node.h - PAD_TOP2 - PAD_BOTTOM2;
13467
13532
  const vMax = data.length > 0 ? Math.max(...data.map((d) => d.value)) : 1;
13533
+ const \u8EF8\u306E\u3082\u3068 = data.length > 0 ? Math.max(vMax, ...data.map((d) => d.previous ?? 0)) : vMax;
13468
13534
  const \u76EE\u76DB\u308A\u306E\u76EE\u5B892 = 4;
13469
- const \u5929\u4E95\u306E\u3082\u3068 = vMax > 0 ? vMax : 1;
13535
+ const \u5929\u4E95\u306E\u3082\u3068 = \u8EF8\u306E\u3082\u3068 > 0 ? \u8EF8\u306E\u3082\u3068 : 1;
13470
13536
  const \u523B\u307F = \u76EE\u76DB\u308A\u306E\u523B\u307F(\u5929\u4E95\u306E\u3082\u3068, \u76EE\u76DB\u308A\u306E\u76EE\u5B892);
13471
13537
  const \u523B\u307F\u306E\u6841 = \u5C0F\u6570\u306E\u6841(\u523B\u307F);
13472
13538
  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);
@@ -13559,8 +13625,24 @@ function ChartBarNode({
13559
13625
  fillOpacity: \u6FC3\u3055(d.value)
13560
13626
  }
13561
13627
  );
13628
+ const \u5370\u306E\u306F\u307F\u51FA\u3057 = Math.min(barW * 0.18, 8);
13629
+ const \u524D\u306E\u5370 = d.previous === void 0 ? null : /* @__PURE__ */ jsx(
13630
+ "line",
13631
+ {
13632
+ "data-cdl-role": "chart-bar-previous",
13633
+ "data-cdl-unresolved": d.unresolved ? "true" : void 0,
13634
+ x1: bx - \u5370\u306E\u306F\u307F\u51FA\u3057,
13635
+ y1: yAt(Math.max(0, d.previous)),
13636
+ x2: bx + barW + \u5370\u306E\u306F\u307F\u51FA\u3057,
13637
+ y2: yAt(Math.max(0, d.previous)),
13638
+ stroke: "var(--cdl-text-mute, #8a8678)",
13639
+ strokeWidth: 1.5,
13640
+ strokeDasharray: "5 3"
13641
+ }
13642
+ );
13562
13643
  return /* @__PURE__ */ jsxs("g", { children: [
13563
13644
  drawing ? /* @__PURE__ */ jsx("g", { transform: `translate(0 ${\u6A2A\u8EF8\u306Ey}) scale(1 ${\u4F38\u3073}) translate(0 ${-\u6A2A\u8EF8\u306Ey})`, children: \u68D2 }) : \u68D2,
13645
+ \u524D\u306E\u5370,
13564
13646
  /* @__PURE__ */ jsx(
13565
13647
  "text",
13566
13648
  {