@canplot/react 0.5.10 → 0.5.12

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/canplot.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  var Be = Object.defineProperty;
2
2
  var ze = (e, t, n) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var K = (e, t, n) => ze(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { jsxs as pe, jsx as R, Fragment as Ne } from "react/jsx-runtime";
5
- import D, { version as $e, createContext as ye, forwardRef as je, useRef as k, useState as B, useMemo as Q, useLayoutEffect as $, useCallback as He, useContext as G, useEffect as ke, useId as Ve } from "react";
6
- const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n) => t + (n ?? 0), 0), Rt = (e, t) => {
4
+ import { jsxs as pe, jsx as A, Fragment as Ne } from "react/jsx-runtime";
5
+ import R, { version as $e, createContext as ye, forwardRef as je, useRef as k, useState as B, useMemo as Q, useLayoutEffect as $, useCallback as He, useContext as G, useEffect as ke, useId as Ve } from "react";
6
+ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n) => t + (n ?? 0), 0), At = (e, t) => {
7
7
  let n = 0;
8
8
  for (let s = 0; s < e.length; s++)
9
9
  Math.abs(e[s] - t) < Math.abs(e[n] - t) && (n = s);
@@ -14,7 +14,7 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
14
14
  return null;
15
15
  const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = (o.origin === "x" ? i.width : i.height) / (o.max - o.min);
16
16
  return t / r;
17
- }, F = (e, t) => e.scales.find((n) => n.id === t) ?? null, U = (e, t) => {
17
+ }, F = (e, t) => e.scales.find((n) => n.id === t) ?? null, _ = (e, t) => {
18
18
  const n = window.devicePixelRatio || 1;
19
19
  e.lineCap = t?.lineCap ?? "butt", e.lineDashOffset = n * (t?.lineDashOffset ?? 0), e.lineJoin = t?.lineJoin ?? "miter", e.lineWidth = n * (t?.lineWidth ?? 1), e.miterLimit = n * (t?.miterLimit ?? 10), e.strokeStyle = t?.strokeStyle ?? "black", e.fillStyle = t?.fillStyle ?? e.strokeStyle, e.font = t?.font ?? `${10 * n}px sans-serif`, e.textAlign = t?.textAlign ?? "start", e.direction = t?.direction ?? "inherit", e.textBaseline = t?.textBaseline ?? "alphabetic", e.fontKerning = t?.fontKerning ?? "auto";
20
20
  }, ge = (e, t, n, s) => {
@@ -81,7 +81,7 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
81
81
  const { ctx: t, scales: n } = e;
82
82
  for (const s of n) {
83
83
  if (!s.axis) continue;
84
- t.save(), U(t, {
84
+ t.save(), _(t, {
85
85
  strokeStyle: "black",
86
86
  fillStyle: "black",
87
87
  lineWidth: 1,
@@ -125,7 +125,7 @@ function me(e, t) {
125
125
  e && (e.current = t);
126
126
  }
127
127
  var Ze = parseInt($e.split(".")[0], 10) >= 19 ? Je : Ge;
128
- const Re = ye({
128
+ const Ae = ye({
129
129
  listeners: [],
130
130
  subscribe: () => () => {
131
131
  },
@@ -140,7 +140,7 @@ const Re = ye({
140
140
  for (const [, s] of e)
141
141
  s();
142
142
  } };
143
- }, ve = ye(null), De = ye(() => {
143
+ }, ve = ye(null), Re = ye(() => {
144
144
  }), Ie = {
145
145
  TOP: 400,
146
146
  MIDDLE: 300,
@@ -169,7 +169,7 @@ class Le {
169
169
  return this.frame.ctx;
170
170
  }
171
171
  }
172
- const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
172
+ const Rt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
173
173
  const i = k(null), r = k(null), c = tt(r), [u, l] = B(null), p = Q(
174
174
  () => nt(e, c, u),
175
175
  [e, c, u]
@@ -190,7 +190,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
190
190
  "data-canplotroot": !0,
191
191
  ...s,
192
192
  children: [
193
- /* @__PURE__ */ R(
193
+ /* @__PURE__ */ A(
194
194
  "canvas",
195
195
  {
196
196
  ref: i,
@@ -204,7 +204,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
204
204
  }
205
205
  }
206
206
  ),
207
- p && /* @__PURE__ */ R(et, { frame: p, children: t })
207
+ p && /* @__PURE__ */ A(et, { frame: p, children: t })
208
208
  ]
209
209
  }
210
210
  );
@@ -232,7 +232,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
232
232
  const r = He(() => {
233
233
  o((c) => c + 1);
234
234
  }, [o]);
235
- return /* @__PURE__ */ R(Re.Provider, { value: n, children: /* @__PURE__ */ R(De.Provider, { value: r, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
235
+ return /* @__PURE__ */ A(Ae.Provider, { value: n, children: /* @__PURE__ */ A(Re.Provider, { value: r, children: /* @__PURE__ */ A(ve.Provider, { value: e, children: t }) }) });
236
236
  }, tt = (e) => {
237
237
  const [t, n] = B({
238
238
  width: 0,
@@ -350,7 +350,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
350
350
  chartAreaCanvasPX: i
351
351
  };
352
352
  }, j = (e, t, n) => {
353
- const s = G(ve), o = G(De), i = G(Re);
353
+ const s = G(ve), o = G(Re), i = G(Ae);
354
354
  if (!s || !o)
355
355
  throw new Error("useFrame must be used within a CanPlot component");
356
356
  const [r] = B(() => new Le());
@@ -384,15 +384,17 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
384
384
  }, st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o, globalAlpha: i }) => (j(
385
385
  e,
386
386
  ({ ctx: r, clampXPosToChartArea: c, clampYPosToChartArea: u, valToPos: l }) => {
387
- r.save(), r.beginPath(), U(r, o), i !== void 0 && (r.globalAlpha = i);
388
- for (const p of t) {
389
- const f = c(l(p.x, n, "canvas")), a = u(l(p.y, s, "canvas"));
390
- f === null || a === null || r.lineTo(f, a);
387
+ r.save(), r.beginPath(), _(r, o);
388
+ const p = r.getLineDash();
389
+ o?.lineDash && r.setLineDash(o.lineDash), i !== void 0 && (r.globalAlpha = i);
390
+ for (const f of t) {
391
+ const a = c(l(f.x, n, "canvas")), g = u(l(f.y, s, "canvas"));
392
+ a === null || g === null || r.lineTo(a, g);
391
393
  }
392
- r.stroke(), r.restore();
394
+ r.stroke(), p && r.setLineDash(p), r.restore();
393
395
  },
394
396
  [t, n, s, o, i]
395
- ), null), It = D.memo(st, O), ot = ({
397
+ ), null), It = R.memo(st, O), ot = ({
396
398
  layer: e = "MIDDLE",
397
399
  data: t,
398
400
  xScaleId: n,
@@ -411,7 +413,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
411
413
  clampXPosToChartArea: a,
412
414
  clampYPosToChartArea: g
413
415
  }) => {
414
- l.save(), U(l, c), u !== void 0 && (l.globalAlpha = u);
416
+ l.save(), _(l, c), u !== void 0 && (l.globalAlpha = u);
415
417
  const d = [];
416
418
  for (const y of t) {
417
419
  let h = null, m = null;
@@ -444,7 +446,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
444
446
  l.restore();
445
447
  },
446
448
  [t, n, s, r, c, u]
447
- ), null), Lt = D.memo(ot, O), it = ({
449
+ ), null), Lt = R.memo(ot, O), it = ({
448
450
  data: e,
449
451
  xScaleId: t,
450
452
  yScaleId: n,
@@ -489,7 +491,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
489
491
  height: w
490
492
  });
491
493
  }
492
- if (l.save(), U(l, s), r !== void 0 && (l.globalAlpha = r), s?.fillStyle)
494
+ if (l.save(), _(l, s), r !== void 0 && (l.globalAlpha = r), s?.fillStyle)
493
495
  for (const m of h)
494
496
  l.beginPath(), c ? l.roundRect(m.x, m.y, m.width, m.height, c) : l.rect(m.x, m.y, m.width, m.height), l.fill();
495
497
  if (s?.strokeStyle) {
@@ -501,7 +503,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
501
503
  l.restore();
502
504
  },
503
505
  [e, t, n, s, o, i, c, r]
504
- ), null), Ut = D.memo(it, O), rt = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
506
+ ), null), Ut = R.memo(it, O), rt = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
505
507
  e,
506
508
  ({ ctx: i, clampXPosToChartArea: r, clampYPosToChartArea: c, valToPos: u }) => {
507
509
  const l = [];
@@ -517,14 +519,14 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
517
519
  }
518
520
  const p = l[0];
519
521
  if (p) {
520
- i.save(), i.beginPath(), U(i, o), i.moveTo(p.x, p.y);
522
+ i.save(), i.beginPath(), _(i, o), i.moveTo(p.x, p.y);
521
523
  for (const f of l)
522
524
  i.lineTo(f.x, f.y);
523
525
  i.closePath(), i.fill(), i.restore();
524
526
  }
525
527
  },
526
528
  [t, n, s, o]
527
- ), null), _t = D.memo(rt, O), ct = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: i }) => (j(
529
+ ), null), _t = R.memo(rt, O), ct = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: i }) => (j(
528
530
  e,
529
531
  ({ ctx: r, clampXPosToChartArea: c, clampYPosToChartArea: u, valToPos: l }) => {
530
532
  const p = [];
@@ -537,7 +539,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
537
539
  return;
538
540
  const g = u(l(0, o));
539
541
  if (g !== null) {
540
- r.save(), r.beginPath(), U(r, i), r.moveTo(f.x, g);
542
+ r.save(), r.beginPath(), _(r, i), r.moveTo(f.x, g);
541
543
  for (const d of p)
542
544
  r.lineTo(d.x, d.y);
543
545
  if (r.lineTo(a.x, g), r.closePath(), r.fill(), n) {
@@ -550,7 +552,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
550
552
  }
551
553
  },
552
554
  [t, n, s, o, i]
553
- ), null), Xt = D.memo(ct, O), at = ({
555
+ ), null), Xt = R.memo(ct, O), at = ({
554
556
  layer: e = "BOTTOM",
555
557
  scaleId: t,
556
558
  tickStyle: n,
@@ -564,7 +566,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
564
566
  const f = l(t);
565
567
  if (!f || !f.axis || f.origin !== "x") return;
566
568
  const a = f.axis, g = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, d = window.devicePixelRatio || 1, y = g, h = (i ?? 6) * d, m = a.position === "top" ? g - h : g + h, v = (o ?? 12) * d;
567
- c.save(), c.fontKerning = "auto", U(c, {
569
+ c.save(), c.fontKerning = "auto", _(c, {
568
570
  ...n
569
571
  }), c.beginPath();
570
572
  const x = Array.isArray(r) ? r : r({ ...f, axis: a }, p);
@@ -572,7 +574,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
572
574
  const w = u(T, t, "canvas");
573
575
  w !== null && (c.moveTo(w, y), c.lineTo(w, m));
574
576
  }
575
- c.stroke(), c.restore(), c.save(), U(c, {
577
+ c.stroke(), c.restore(), c.save(), _(c, {
576
578
  textBaseline: a.position === "top" ? "bottom" : "top",
577
579
  textAlign: "center",
578
580
  ...n,
@@ -592,7 +594,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
592
594
  c.restore();
593
595
  },
594
596
  [r, t, n, s]
595
- ), null), Ft = D.memo(at, O), lt = ({
597
+ ), null), Ft = R.memo(at, O), lt = ({
596
598
  layer: e = "BOTTOM",
597
599
  scaleId: t,
598
600
  tickStyle: n,
@@ -606,12 +608,12 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
606
608
  const f = l(t);
607
609
  if (!f || !f.axis || f.origin !== "y") return;
608
610
  const a = f.axis, g = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, d = g, y = i ?? 6, h = a.position === "left" ? g - y : g + y, m = o ?? 12, v = Array.isArray(r) ? r : r({ ...f, axis: a }, p);
609
- c.save(), c.fontKerning = "auto", U(c, { ...n }), c.beginPath();
611
+ c.save(), c.fontKerning = "auto", _(c, { ...n }), c.beginPath();
610
612
  for (const { value: x } of v) {
611
613
  const T = u(x, t, "canvas");
612
614
  T !== null && (c.moveTo(d, T), c.lineTo(h, T));
613
615
  }
614
- c.stroke(), c.restore(), c.save(), U(c, {
616
+ c.stroke(), c.restore(), c.save(), _(c, {
615
617
  textBaseline: "middle",
616
618
  textAlign: a.position === "left" ? "right" : "left",
617
619
  ...n,
@@ -631,7 +633,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
631
633
  c.restore();
632
634
  },
633
635
  [r, t, n, s]
634
- ), null), Ot = D.memo(lt, O), _e = (e) => {
636
+ ), null), Ot = R.memo(lt, O), _e = (e) => {
635
637
  if (e)
636
638
  try {
637
639
  return e.replace(/(\d+)px/, (t, n) => `${parseInt(n) * window.devicePixelRatio || 1}px`);
@@ -665,15 +667,15 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
665
667
  pressandwheel: I(),
666
668
  sync_move: I()
667
669
  }, L = (e, t, n) => {
668
- const s = D.useRef(n);
669
- s.current = n, D.useEffect(() => M[e].addEventListener(
670
+ const s = R.useRef(n);
671
+ s.current = n, R.useEffect(() => M[e].addEventListener(
670
672
  t,
671
673
  (i, r) => {
672
674
  s.current(r, i);
673
675
  }
674
676
  ), [t, e, s]);
675
- }, we = D.createContext(""), xe = (e, t) => {
676
- const n = D.useContext(we);
677
+ }, we = R.createContext(""), xe = (e, t) => {
678
+ const n = R.useContext(we);
677
679
  return L(e, n, t);
678
680
  }, ut = (e, t, n, s, o) => {
679
681
  if (!t) return;
@@ -764,7 +766,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
764
766
  }), L("contextmenu", d, (y) => {
765
767
  u?.(y);
766
768
  }), /* @__PURE__ */ pe(we.Provider, { value: d, children: [
767
- /* @__PURE__ */ R(
769
+ /* @__PURE__ */ A(
768
770
  ht,
769
771
  {
770
772
  id: e,
@@ -849,9 +851,9 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
849
851
  (b, { cssX: S, cssY: E }, C) => {
850
852
  const P = p.current;
851
853
  if (!P || !b.x || !b.y) return;
852
- const A = c.current, z = P.xRangeCss.start, ae = S, le = P.yRangeCss.start, ue = E, ee = F(A, b.x.scaleId);
854
+ const D = c.current, z = P.xRangeCss.start, ae = S, le = P.yRangeCss.start, ue = E, ee = F(D, b.x.scaleId);
853
855
  if (!ee) return;
854
- const te = F(A, b.y.scaleId);
856
+ const te = F(D, b.y.scaleId);
855
857
  if (!te) return;
856
858
  p.current = {
857
859
  xRangeCss: { start: z, end: ae },
@@ -861,28 +863,28 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
861
863
  const he = Math.abs(le - ue), fe = Math.abs(z - ae);
862
864
  he < 10 && fe < 10 ? q = "below_threshold" : he > 30 && fe > 30 ? q = "box" : he > fe ? q = "y" : q = "x";
863
865
  const Te = X(
864
- A,
866
+ D,
865
867
  V(c.current, z, "css"),
866
868
  ee.id,
867
869
  "css"
868
870
  );
869
871
  if (Te === null) return;
870
872
  const Se = X(
871
- A,
873
+ D,
872
874
  V(c.current, ae, "css"),
873
875
  ee.id,
874
876
  "css"
875
877
  );
876
878
  if (Se === null) return;
877
879
  const Ce = X(
878
- A,
880
+ D,
879
881
  W(c.current, le, "css"),
880
882
  te.id,
881
883
  "css"
882
884
  );
883
885
  if (Ce === null) return;
884
886
  const Pe = X(
885
- A,
887
+ D,
886
888
  W(c.current, ue, "css"),
887
889
  te.id,
888
890
  "css"
@@ -929,16 +931,16 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
929
931
  c.current
930
932
  );
931
933
  if (!C) return;
932
- if (Object.values(E).some((A) => A)) {
934
+ if (Object.values(E).some((D) => D)) {
933
935
  w.preventDefault();
934
- const A = Math.abs(w.deltaY) > Math.abs(w.deltaX) ? w.deltaY : w.deltaX;
936
+ const D = Math.abs(w.deltaY) > Math.abs(w.deltaX) ? w.deltaY : w.deltaX;
935
937
  M.pressandwheel.dispatchEvent(u, {
936
938
  pointer: C,
937
939
  frame: c.current,
938
940
  keys: E,
939
941
  deltaX: w.deltaX,
940
942
  deltaY: w.deltaY,
941
- deltaAbs: A
943
+ deltaAbs: D
942
944
  });
943
945
  }
944
946
  });
@@ -961,7 +963,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
961
963
  keys: h.keys,
962
964
  source: h.originInteractionsId === u ? "own" : "sync"
963
965
  });
964
- }), /* @__PURE__ */ R(
966
+ }), /* @__PURE__ */ A(
965
967
  "div",
966
968
  {
967
969
  ref: i,
@@ -1129,7 +1131,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1129
1131
  return null;
1130
1132
  const { frame: r, pointer: c } = o, u = c?.cssX ?? null, l = c?.cssY ?? null, p = u ? V(r, u, "css") : 0, f = l ? W(r, l, "css") : 0;
1131
1133
  return /* @__PURE__ */ pe(Ne, { children: [
1132
- /* @__PURE__ */ R(
1134
+ /* @__PURE__ */ A(
1133
1135
  "div",
1134
1136
  {
1135
1137
  "data-show": !!c,
@@ -1150,7 +1152,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1150
1152
  }
1151
1153
  }
1152
1154
  ),
1153
- /* @__PURE__ */ R(
1155
+ /* @__PURE__ */ A(
1154
1156
  "div",
1155
1157
  {
1156
1158
  className: s?.(o),
@@ -1184,7 +1186,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1184
1186
  const i = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0, r = n.mode === "y" ? 1 / 0 : n.x.css?.to ?? 1 / 0, c = n.mode === "x" ? -1 / 0 : n.y.css?.from ?? -1 / 0, u = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, l = V(n.frame, i, "css"), p = V(n.frame, r, "css"), f = W(n.frame, c, "css"), a = W(n.frame, u, "css"), g = Math.min(l, p), d = Math.min(f, a), y = Math.abs(p - l), h = Math.abs(a - f);
1185
1187
  return { leftPx: g, topPx: d, widthPx: y, heightPx: h };
1186
1188
  }, [n]);
1187
- return /* @__PURE__ */ R(
1189
+ return /* @__PURE__ */ A(
1188
1190
  "div",
1189
1191
  {
1190
1192
  className: n ? e?.(n) : void 0,
@@ -1202,7 +1204,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1202
1204
  );
1203
1205
  }, Nt = ({ style: e, children: t, scaleId: n, ...s }) => {
1204
1206
  const o = Ue().getScale(n)?.axis;
1205
- return o ? /* @__PURE__ */ R(
1207
+ return o ? /* @__PURE__ */ A(
1206
1208
  "div",
1207
1209
  {
1208
1210
  style: {
@@ -1331,10 +1333,10 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, J = 60 * be, ce = 24 * J, yt = 30 * c
1331
1333
  }, St = (e, t) => {
1332
1334
  const n = new Date(e);
1333
1335
  return n.setUTCDate(n.getUTCDate() + t), n.getTime();
1334
- }, Ae = (e, t) => {
1336
+ }, De = (e, t) => {
1335
1337
  const n = new Date(e);
1336
1338
  return n.setUTCMonth(n.getUTCMonth() + t), n.getTime();
1337
- }, _ = (e, t) => {
1339
+ }, U = (e, t) => {
1338
1340
  const [n, s] = t;
1339
1341
  switch (s) {
1340
1342
  case "milliseconds":
@@ -1348,9 +1350,9 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, J = 60 * be, ce = 24 * J, yt = 30 * c
1348
1350
  case "days":
1349
1351
  return St(e, n);
1350
1352
  case "months":
1351
- return Ae(e, n);
1353
+ return De(e, n);
1352
1354
  case "years":
1353
- return Ae(e, n * 12);
1355
+ return De(e, n * 12);
1354
1356
  }
1355
1357
  };
1356
1358
  function H(e, t) {
@@ -1394,10 +1396,16 @@ const Ct = (e, t, n = "UTC") => {
1394
1396
  );
1395
1397
  break;
1396
1398
  }
1397
- case "days":
1399
+ case "days": {
1400
+ for (r(), i.setUTCDate(
1401
+ 1
1402
+ ); i.getTime() < e; )
1403
+ i = new Date(U(i, [s, o]));
1404
+ break;
1405
+ }
1398
1406
  case "months":
1399
1407
  case "years":
1400
- o === "months" ? i.setUTCDate(1) : o === "years" && i.setUTCMonth(0, 1), r(), i.getTime() < e && (i = new Date(_(i, [1, o])));
1408
+ o === "months" ? i.setUTCDate(1) : o === "years" && i.setUTCMonth(0, 1), r(), i.getTime() < e && (i = new Date(U(i, [1, o])));
1401
1409
  break;
1402
1410
  }
1403
1411
  return i.getTime();
@@ -1416,9 +1424,7 @@ const Ct = (e, t, n = "UTC") => {
1416
1424
  ) ?? [1, "milliseconds"];
1417
1425
  if (!a || !g)
1418
1426
  return [];
1419
- const d = Ct(c, [a, g], e), y = H(d, e);
1420
- console.log(y, new Date(d));
1421
- const h = [d];
1427
+ const d = Ct(c, [a, g], e), y = H(d, e), h = [d];
1422
1428
  let m;
1423
1429
  for (; ; ) {
1424
1430
  if (h.length > 100)
@@ -1428,22 +1434,22 @@ const Ct = (e, t, n = "UTC") => {
1428
1434
  case "seconds":
1429
1435
  case "minutes":
1430
1436
  case "hours": {
1431
- const v = _(d, [
1437
+ const v = U(d, [
1432
1438
  h.length * a,
1433
1439
  g
1434
1440
  ]);
1435
- m = _(v, [
1441
+ m = U(v, [
1436
1442
  y - H(v, e),
1437
1443
  "hours"
1438
1444
  ]);
1439
1445
  break;
1440
1446
  }
1441
1447
  case "days": {
1442
- const v = _(d, [
1448
+ const v = U(d, [
1443
1449
  h.length * a,
1444
1450
  g
1445
1451
  ]);
1446
- m = _(v, [
1452
+ m = U(v, [
1447
1453
  y - H(v, e),
1448
1454
  "hours"
1449
1455
  ]);
@@ -1451,14 +1457,14 @@ const Ct = (e, t, n = "UTC") => {
1451
1457
  }
1452
1458
  case "months":
1453
1459
  case "years": {
1454
- const v = _(
1455
- _(_(d, [y, "hours"]), [
1460
+ const v = U(
1461
+ U(U(d, [y, "hours"]), [
1456
1462
  h.length * a,
1457
1463
  g
1458
1464
  ]),
1459
1465
  [-y, "hours"]
1460
1466
  );
1461
- m = _(v, [
1467
+ m = U(v, [
1462
1468
  y - H(v, e),
1463
1469
  "hours"
1464
1470
  ]);
@@ -1499,10 +1505,10 @@ const Ct = (e, t, n = "UTC") => {
1499
1505
  const b = l.label.find((P) => P.type === "hour")?.value, S = l.label.find((P) => P.type === "minute")?.value, E = l.label.find((P) => P.type === "timeZoneName")?.value;
1500
1506
  let C = "";
1501
1507
  if (c) {
1502
- const P = l.label.find((z) => z.type === "second")?.value, A = l.label.find(
1508
+ const P = l.label.find((z) => z.type === "second")?.value, D = l.label.find(
1503
1509
  (z) => z.type === "fractionalSecond"
1504
1510
  )?.value;
1505
- C = `:${P}` + (u ? `.${A}` : "");
1511
+ C = `:${P}` + (u ? `.${D}` : "");
1506
1512
  }
1507
1513
  w.push(
1508
1514
  `${b}:${S}${C}` + (n && m ? ` ${E}` : "")
@@ -1526,7 +1532,7 @@ export {
1526
1532
  Nt as AxisOverlay,
1527
1533
  Ut as BarPlot,
1528
1534
  Ie as CANPLOT_LAYER,
1529
- Dt as CanPlot,
1535
+ Rt as CanPlot,
1530
1536
  Kt as ChartAreaInteractions,
1531
1537
  Bt as Crosshair,
1532
1538
  Le as FrameDrawer,
@@ -1537,13 +1543,13 @@ export {
1537
1543
  Yt as TooltipsX,
1538
1544
  Ft as XTicks,
1539
1545
  Ot as YTicks,
1540
- U as applyStyles,
1546
+ _ as applyStyles,
1541
1547
  re as clamp,
1542
1548
  V as clampXPosToChartArea,
1543
1549
  W as clampYPosToChartArea,
1544
1550
  O as deepEqual,
1545
1551
  mt as defaultNumericalTicksFormatter,
1546
- Rt as findClosestIndex,
1552
+ At as findClosestIndex,
1547
1553
  F as getScale,
1548
1554
  $t as makeLinearTicks,
1549
1555
  Pt as makeTimeTickFormat,