@canplot/react 0.5.5 → 0.5.7

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
@@ -17,7 +17,7 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), At = (e) => e.reduce((t, n)
17
17
  }, X = (e, t) => e.scales.find((n) => n.id === t) ?? null, U = (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
- }, ge = (e, t, n, s) => {
20
+ }, ve = (e, t, n, s) => {
21
21
  const o = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = X(e, n);
22
22
  if (!r)
23
23
  return null;
@@ -27,7 +27,7 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), At = (e) => e.reduce((t, n)
27
27
  const o = X(e, n);
28
28
  if (!o)
29
29
  return null;
30
- const r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = ge(
30
+ const r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = ve(
31
31
  e,
32
32
  t - o.min,
33
33
  n,
@@ -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
+ }, ge = ye(null), De = ye(() => {
144
144
  }), Ie = {
145
145
  TOP: 400,
146
146
  MIDDLE: 300,
@@ -153,7 +153,7 @@ class Le {
153
153
  O(this, "clampXPosToChartArea", (t, n = "canvas") => V(this.frame, t, n));
154
154
  O(this, "clampYPosToChartArea", (t, n = "canvas") => H(this.frame, t, n));
155
155
  O(this, "valToPos", (t, n, s = "canvas") => G(this.frame, t, n, s));
156
- O(this, "valToPxDistance", (t, n, s = "canvas") => ge(this.frame, t, n, s));
156
+ O(this, "valToPxDistance", (t, n, s = "canvas") => ve(this.frame, t, n, s));
157
157
  O(this, "valFits", (t, n) => fe(this.frame, t, n));
158
158
  O(this, "getScale", (t) => X(this.frame, t));
159
159
  }
@@ -232,7 +232,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
232
232
  const i = Ve(() => {
233
233
  o((c) => c + 1);
234
234
  }, [o]);
235
- return /* @__PURE__ */ R(Re.Provider, { value: n, children: /* @__PURE__ */ R(De.Provider, { value: i, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
235
+ return /* @__PURE__ */ R(Re.Provider, { value: n, children: /* @__PURE__ */ R(De.Provider, { value: i, children: /* @__PURE__ */ R(ge.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: r
351
351
  };
352
352
  }, j = (e, t, n) => {
353
- const s = q(ve), o = q(De), r = q(Re);
353
+ const s = q(ge), o = q(De), r = q(Re);
354
354
  if (!s || !o)
355
355
  throw new Error("useFrame must be used within a CanPlot component");
356
356
  const [i] = B(() => new Le());
@@ -374,24 +374,24 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
374
374
  o();
375
375
  }, [o]);
376
376
  }, Ue = () => {
377
- const e = q(ve);
377
+ const e = q(ge);
378
378
  if (!e)
379
379
  throw new Error("useFrame must be used within a CanPlot component");
380
380
  return Z(() => {
381
381
  const t = new Le();
382
382
  return t._updateFrame(e), t;
383
383
  }, [e]);
384
- }, st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
384
+ }, st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o, globalAlpha: r }) => (j(
385
385
  e,
386
- ({ ctx: r, clampXPosToChartArea: i, clampYPosToChartArea: c, valToPos: l }) => {
387
- r.save(), r.beginPath(), U(r, o);
388
- for (const u of t) {
389
- const f = i(l(u.x, n, "canvas")), m = c(l(u.y, s, "canvas"));
390
- f === null || m === null || r.lineTo(f, m);
386
+ ({ ctx: i, clampXPosToChartArea: c, clampYPosToChartArea: l, valToPos: u }) => {
387
+ i.save(), i.beginPath(), U(i, o), r !== void 0 && (i.globalAlpha = r);
388
+ for (const f of t) {
389
+ const m = c(u(f.x, n, "canvas")), a = l(u(f.y, s, "canvas"));
390
+ m === null || a === null || i.lineTo(m, a);
391
391
  }
392
- r.stroke(), r.restore();
392
+ i.stroke(), i.restore();
393
393
  },
394
- [t, n, s, o]
394
+ [t, n, s, o, r]
395
395
  ), null), It = D.memo(st, F), ot = ({
396
396
  layer: e = "MIDDLE",
397
397
  data: t,
@@ -415,7 +415,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
415
415
  const d = new Path2D();
416
416
  U(u, c), l !== void 0 && (u.globalAlpha = l);
417
417
  for (const y of t) {
418
- let h, g;
418
+ let h, v;
419
419
  switch (o) {
420
420
  case "clip":
421
421
  if (!m(y.x, n))
@@ -433,13 +433,13 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
433
433
  case "clip":
434
434
  if (!m(y.y, s))
435
435
  continue;
436
- g = f(y.y, s);
436
+ v = f(y.y, s);
437
437
  break;
438
438
  case "clamp":
439
- g = p(f(y.y, s), "canvas");
439
+ v = p(f(y.y, s), "canvas");
440
440
  break;
441
441
  }
442
- h === null || g === null || (d.moveTo(h + i, g), d.arc(h, g, i, 0, Math.PI * 2));
442
+ h === null || v === null || (d.moveTo(h + i, v), d.arc(h, v, i, 0, Math.PI * 2));
443
443
  }
444
444
  u.fill(d), u.stroke(d), u.restore();
445
445
  },
@@ -470,11 +470,11 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
470
470
  const y = f(d.x, t);
471
471
  if (y === null)
472
472
  continue;
473
- const h = y - p / 2 + r * p, g = a(
473
+ const h = y - p / 2 + r * p, v = a(
474
474
  f(0, n, "canvas"),
475
475
  "canvas"
476
476
  );
477
- if (g === null)
477
+ if (v === null)
478
478
  continue;
479
479
  const w = a(
480
480
  f(d.y, n, "canvas"),
@@ -482,14 +482,14 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
482
482
  );
483
483
  if (w === null)
484
484
  continue;
485
- const x = g - w, b = m(h, "canvas"), v = m(h + p, "canvas") - b;
485
+ const x = v - w, b = m(h, "canvas"), g = m(h + p, "canvas") - b;
486
486
  i ? l.roundRect(
487
487
  b,
488
488
  w,
489
- v,
489
+ g,
490
490
  x,
491
491
  i
492
- ) : l.rect(b, w, v, x);
492
+ ) : l.rect(b, w, g, x);
493
493
  }
494
494
  l.closePath(), l.fill(), s?.strokeStyle && l.stroke(), l.restore();
495
495
  },
@@ -556,14 +556,14 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
556
556
  ({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
557
557
  const m = u(t);
558
558
  if (!m || !m.axis || m.origin !== "x") return;
559
- const a = m.axis, p = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, d = window.devicePixelRatio || 1, y = p, h = (r ?? 6) * d, g = a.position === "top" ? p - h : p + h, w = (o ?? 12) * d;
559
+ const a = m.axis, p = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, d = window.devicePixelRatio || 1, y = p, h = (r ?? 6) * d, v = a.position === "top" ? p - h : p + h, w = (o ?? 12) * d;
560
560
  c.save(), c.fontKerning = "auto", U(c, {
561
561
  ...n
562
562
  }), c.beginPath();
563
563
  const x = Array.isArray(i) ? i : i({ ...m, axis: a }, f);
564
564
  for (const { value: b } of x) {
565
- const v = l(b, t, "canvas");
566
- v !== null && (c.moveTo(v, y), c.lineTo(v, g));
565
+ const g = l(b, t, "canvas");
566
+ g !== null && (c.moveTo(g, y), c.lineTo(g, v));
567
567
  }
568
568
  c.stroke(), c.restore(), c.save(), U(c, {
569
569
  textBaseline: a.position === "top" ? "bottom" : "top",
@@ -573,14 +573,14 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
573
573
  // alter font size for DPR
574
574
  font: _e(s?.font ?? n?.font)
575
575
  });
576
- for (const { value: b, label: v } of x) {
576
+ for (const { value: b, label: g } of x) {
577
577
  const T = l(b, t, "canvas");
578
578
  if (T === null)
579
579
  continue;
580
- const C = v.split(`
580
+ const C = g.split(`
581
581
  `);
582
582
  for (let E = 0; E < C.length; E++)
583
- c.fillText(C[E], T, g + d * 2 + E * w);
583
+ c.fillText(C[E], T, v + d * 2 + E * w);
584
584
  }
585
585
  c.restore();
586
586
  },
@@ -598,7 +598,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
598
598
  ({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
599
599
  const m = u(t);
600
600
  if (!m || !m.axis || m.origin !== "y") return;
601
- const a = m.axis, p = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, d = p, y = r ?? 6, h = a.position === "left" ? p - y : p + y, g = o ?? 12, w = Array.isArray(i) ? i : i({ ...m, axis: a }, f);
601
+ const a = m.axis, p = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, d = p, y = r ?? 6, h = a.position === "left" ? p - y : p + y, v = o ?? 12, w = Array.isArray(i) ? i : i({ ...m, axis: a }, f);
602
602
  c.save(), c.fontKerning = "auto", U(c, { ...n }), c.beginPath();
603
603
  for (const { value: x } of w) {
604
604
  const b = l(x, t, "canvas");
@@ -613,13 +613,13 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
613
613
  font: _e(s?.font ?? n?.font)
614
614
  });
615
615
  for (const { value: x, label: b } of w) {
616
- const v = l(x, t, "canvas");
617
- if (v === null)
616
+ const g = l(x, t, "canvas");
617
+ if (g === null)
618
618
  continue;
619
619
  const T = b.split(`
620
620
  `);
621
621
  for (let C = 0; C < T.length; C++)
622
- c.fillText(` ${T[C]} `, h, v + C * g);
622
+ c.fillText(` ${T[C]} `, h, g + C * v);
623
623
  }
624
624
  c.restore();
625
625
  },
@@ -781,7 +781,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
781
781
  );
782
782
  return h.getBoundingClientRect();
783
783
  }
784
- }, d = (h, g) => {
784
+ }, d = (h, v) => {
785
785
  const w = ut(
786
786
  h,
787
787
  p(),
@@ -789,7 +789,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
789
789
  s?.xViaScaleId,
790
790
  s?.yViaScaleId
791
791
  );
792
- w && g(
792
+ w && v(
793
793
  w.pointerSyncPosition,
794
794
  { cssX: w.cssX, cssY: w.cssY },
795
795
  {
@@ -801,7 +801,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
801
801
  );
802
802
  }, y = A(d);
803
803
  return y.current = d, Ae(() => {
804
- const h = (v) => {
804
+ const h = (g) => {
805
805
  const T = m.current;
806
806
  T && M.spanselect.dispatchEvent(l, {
807
807
  ...T,
@@ -809,18 +809,18 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
809
809
  }), M.documentmouseup.dispatchEvent(l, {
810
810
  frame: c.current,
811
811
  keys: {
812
- ctrlKey: v.ctrlKey,
813
- altKey: v.altKey,
814
- shiftKey: v.shiftKey,
815
- metaKey: v.metaKey
812
+ ctrlKey: g.ctrlKey,
813
+ altKey: g.altKey,
814
+ shiftKey: g.shiftKey,
815
+ metaKey: g.metaKey
816
816
  }
817
817
  });
818
- }, g = (v) => {
818
+ }, v = (g) => {
819
819
  const T = {
820
- ctrlKey: v.ctrlKey,
821
- altKey: v.altKey,
822
- shiftKey: v.shiftKey,
823
- metaKey: v.metaKey
820
+ ctrlKey: g.ctrlKey,
821
+ altKey: g.altKey,
822
+ shiftKey: g.shiftKey,
823
+ metaKey: g.metaKey
824
824
  }, C = a.current;
825
825
  if (C && Object.entries(T).some(
826
826
  ([S, P]) => C.keys[S] !== P
@@ -832,13 +832,13 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
832
832
  if (E && Object.entries(T).some(
833
833
  ([S, P]) => E.keys[S] !== P
834
834
  )) {
835
- v.stopPropagation(), v.preventDefault();
835
+ g.stopPropagation(), g.preventDefault();
836
836
  const S = { ...E, keys: T };
837
837
  m.current = S, M.spanselect.dispatchEvent(l, S);
838
838
  }
839
- }, w = (v) => {
839
+ }, w = (g) => {
840
840
  y.current(
841
- v,
841
+ g,
842
842
  (T, { cssX: C, cssY: E }, S) => {
843
843
  const P = f.current;
844
844
  if (!P || !T.x || !T.y) return;
@@ -915,42 +915,42 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
915
915
  );
916
916
  }
917
917
  );
918
- }, x = (v) => {
919
- y.current(v, (T, C, E) => {
918
+ }, x = (g) => {
919
+ y.current(g, (T, C, E) => {
920
920
  const S = N(
921
921
  T,
922
922
  c.current
923
923
  );
924
924
  if (!S) return;
925
925
  if (Object.values(E).some((k) => k)) {
926
- v.preventDefault();
927
- const k = Math.abs(v.deltaY) > Math.abs(v.deltaX) ? v.deltaY : v.deltaX;
926
+ g.preventDefault();
927
+ const k = Math.abs(g.deltaY) > Math.abs(g.deltaX) ? g.deltaY : g.deltaX;
928
928
  M.pressandwheel.dispatchEvent(l, {
929
929
  pointer: S,
930
930
  frame: c.current,
931
931
  keys: E,
932
- deltaX: v.deltaX,
933
- deltaY: v.deltaY,
932
+ deltaX: g.deltaX,
933
+ deltaY: g.deltaY,
934
934
  deltaAbs: k
935
935
  });
936
936
  }
937
937
  });
938
938
  };
939
- document.addEventListener("mouseup", h), document.addEventListener("keydown", g), document.addEventListener("keyup", g), document.addEventListener("mousemove", w);
939
+ document.addEventListener("mouseup", h), document.addEventListener("keydown", v), document.addEventListener("keyup", v), document.addEventListener("mousemove", w);
940
940
  const b = r.current;
941
941
  return b?.addEventListener("wheel", x, {
942
942
  passive: !1
943
943
  }), () => {
944
- document.removeEventListener("mouseup", h), document.removeEventListener("keydown", g), document.removeEventListener("keyup", g), document.removeEventListener("mousemove", w), b?.removeEventListener("wheel", x);
944
+ document.removeEventListener("mouseup", h), document.removeEventListener("keydown", v), document.removeEventListener("keyup", v), document.removeEventListener("mousemove", w), b?.removeEventListener("wheel", x);
945
945
  };
946
946
  }, [c, l, u, y]), L("sync_move", u, (h) => {
947
- const g = h.positions ? N(
947
+ const v = h.positions ? N(
948
948
  h.positions,
949
949
  c.current
950
950
  ) : null;
951
951
  a.current = h, M.move.dispatchEvent(l, {
952
952
  frame: c.current,
953
- pointer: g ?? null,
953
+ pointer: v ?? null,
954
954
  keys: h.keys,
955
955
  source: h.originInteractionsId === l ? "own" : "sync"
956
956
  });
@@ -973,9 +973,9 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
973
973
  h.preventDefault();
974
974
  },
975
975
  onClick: (h) => {
976
- d(h, (g, w, x) => {
976
+ d(h, (v, w, x) => {
977
977
  const b = N(
978
- g,
978
+ v,
979
979
  c.current
980
980
  );
981
981
  b && M.click.dispatchEvent(l, {
@@ -986,7 +986,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
986
986
  });
987
987
  },
988
988
  onMouseLeave: (h) => {
989
- d(h, (g, w, x) => {
989
+ d(h, (v, w, x) => {
990
990
  M.sync_move.dispatchEvent(u, {
991
991
  positions: null,
992
992
  keys: x,
@@ -995,22 +995,22 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
995
995
  });
996
996
  },
997
997
  onMouseMove: (h) => {
998
- d(h, (g, w, x) => {
998
+ d(h, (v, w, x) => {
999
999
  M.sync_move.dispatchEvent(u, {
1000
- positions: g,
1000
+ positions: v,
1001
1001
  keys: x,
1002
1002
  originInteractionsId: l
1003
1003
  });
1004
1004
  });
1005
1005
  },
1006
1006
  onMouseDown: (h) => {
1007
- d(h, (g, { cssX: w, cssY: x }, b) => {
1008
- const v = N(
1009
- g,
1007
+ d(h, (v, { cssX: w, cssY: x }, b) => {
1008
+ const g = N(
1009
+ v,
1010
1010
  c.current
1011
1011
  );
1012
- v && (M.mousedown.dispatchEvent(l, {
1013
- pointer: v,
1012
+ g && (M.mousedown.dispatchEvent(l, {
1013
+ pointer: g,
1014
1014
  frame: c.current,
1015
1015
  keys: b
1016
1016
  }), f.current = {
@@ -1020,9 +1020,9 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1020
1020
  });
1021
1021
  },
1022
1022
  onMouseUp: (h) => {
1023
- d(h, (g, w, x) => {
1023
+ d(h, (v, w, x) => {
1024
1024
  const b = N(
1025
- g,
1025
+ v,
1026
1026
  c.current
1027
1027
  );
1028
1028
  if (!b) return;
@@ -1031,12 +1031,12 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1031
1031
  pointer: b,
1032
1032
  keys: x
1033
1033
  });
1034
- const v = m.current;
1034
+ const g = m.current;
1035
1035
  m.current = null;
1036
1036
  const T = f.current;
1037
- if (f.current = null, T && v) {
1037
+ if (f.current = null, T && g) {
1038
1038
  const C = {
1039
- ...v,
1039
+ ...g,
1040
1040
  keys: x,
1041
1041
  completed: !0
1042
1042
  };
@@ -1048,9 +1048,9 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1048
1048
  });
1049
1049
  },
1050
1050
  onContextMenu: (h) => {
1051
- h.preventDefault(), d(h, (g, w, x) => {
1051
+ h.preventDefault(), d(h, (v, w, x) => {
1052
1052
  const b = N(
1053
- g,
1053
+ v,
1054
1054
  c.current
1055
1055
  );
1056
1056
  b && M.contextmenu.dispatchEvent(l, {
@@ -1061,9 +1061,9 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1061
1061
  });
1062
1062
  },
1063
1063
  onDoubleClick: (h) => {
1064
- d(h, (g, w, x) => {
1064
+ d(h, (v, w, x) => {
1065
1065
  const b = N(
1066
- g,
1066
+ v,
1067
1067
  c.current
1068
1068
  );
1069
1069
  b && M.dblclick.dispatchEvent(l, {
@@ -1091,13 +1091,13 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1091
1091
  let m = l;
1092
1092
  for (const a of e) {
1093
1093
  let p = null, d = 1 / 0;
1094
- for (const [g, w] of a.points.entries()) {
1094
+ for (const [v, w] of a.points.entries()) {
1095
1095
  if (!fe(i, w.x, n) || !fe(i, w.y, a.yScaleId))
1096
1096
  continue;
1097
1097
  const x = Math.abs(w.x - l);
1098
- x < d && (d = x, p = g);
1098
+ x < d && (d = x, p = v);
1099
1099
  }
1100
- const y = a.points[p ?? -1], h = ge(i, d, n, "css");
1100
+ const y = a.points[p ?? -1], h = ve(i, d, n, "css");
1101
1101
  if (!y || h === null || h > 30) {
1102
1102
  f.push({ seriesId: a.seriesId, y: null });
1103
1103
  continue;
@@ -1239,7 +1239,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1239
1239
  }, ne = [];
1240
1240
  for (let e = -12; e <= 12; e++)
1241
1241
  ne.push(1 * 10 ** e), ne.push(2 * 10 ** e), ne.push(5 * 10 ** e);
1242
- const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 * ce, gt = 365 * ce, vt = [
1242
+ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 * ce, vt = 365 * ce, gt = [
1243
1243
  // second divisors
1244
1244
  [1, "milliseconds"],
1245
1245
  [2, "milliseconds"],
@@ -1307,7 +1307,7 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 *
1307
1307
  case "months":
1308
1308
  return t * yt;
1309
1309
  case "years":
1310
- return t * gt;
1310
+ return t * vt;
1311
1311
  }
1312
1312
  }, wt = (e, t) => {
1313
1313
  const n = new Date(e);
@@ -1400,20 +1400,20 @@ const St = (e, t, n = "UTC") => {
1400
1400
  const { min: c, max: l } = r;
1401
1401
  if (!Number.isFinite(c) || !Number.isFinite(l))
1402
1402
  return [];
1403
- const u = Math.floor(i.chartAreaCanvasPX.width / t) + 1, m = (l - c) / u, [a, p] = vt.find(
1403
+ const u = Math.floor(i.chartAreaCanvasPX.width / t) + 1, m = (l - c) / u, [a, p] = gt.find(
1404
1404
  (w) => se(w) >= m
1405
1405
  ) ?? [1, "milliseconds"];
1406
1406
  if (!a || !p)
1407
1407
  return [];
1408
1408
  const d = St(c, [a, p], e), y = oe(d, e), h = [d];
1409
- let g;
1409
+ let v;
1410
1410
  for (; !(h.length > 1e3); ) {
1411
1411
  switch (p) {
1412
1412
  case "milliseconds":
1413
1413
  case "seconds":
1414
1414
  case "minutes":
1415
1415
  case "hours": {
1416
- g = Y(d, [h.length * a, p]);
1416
+ v = Y(d, [h.length * a, p]);
1417
1417
  break;
1418
1418
  }
1419
1419
  case "days": {
@@ -1421,7 +1421,7 @@ const St = (e, t, n = "UTC") => {
1421
1421
  h.length * a,
1422
1422
  p
1423
1423
  ]);
1424
- g = Y(w, [
1424
+ v = Y(w, [
1425
1425
  y - oe(w, e),
1426
1426
  "hours"
1427
1427
  ]);
@@ -1436,16 +1436,16 @@ const St = (e, t, n = "UTC") => {
1436
1436
  ]),
1437
1437
  [-y, "hours"]
1438
1438
  );
1439
- g = Y(w, [
1439
+ v = Y(w, [
1440
1440
  y - oe(w, e),
1441
1441
  "hours"
1442
1442
  ]);
1443
1443
  break;
1444
1444
  }
1445
1445
  }
1446
- if (g > l)
1446
+ if (v > l)
1447
1447
  break;
1448
- h.push(g);
1448
+ h.push(v);
1449
1449
  }
1450
1450
  return (n ?? Pt({
1451
1451
  locale: s,
@@ -1472,8 +1472,8 @@ const St = (e, t, n = "UTC") => {
1472
1472
  return (o) => {
1473
1473
  const r = o[1] - o[0], i = r < se([1, "days"]), c = r < se([1, "minutes"]), l = r < se([1, "seconds"]);
1474
1474
  return o.map((u) => ({ value: u, label: s.formatToParts(new Date(u)) })).map((u, f, m) => {
1475
- const a = m[f - 1], p = f === 0 || K(u.label, a.label, "year"), d = f === 0 || K(u.label, a.label, "day"), y = f === 0 || K(u.label, a.label, "month"), h = f === 0 || K(u.label, a.label, "hour"), g = f === 0 || K(u.label, a.label, "timeZoneName"), w = f === 0 || K(u.label, a.label, "minute"), x = f === 0 || K(u.label, a.label, "second"), b = f === 0 || K(u.label, a.label, "fractionalSecond"), v = [];
1476
- if (i && (h || w || g || x || b)) {
1475
+ const a = m[f - 1], p = f === 0 || K(u.label, a.label, "year"), d = f === 0 || K(u.label, a.label, "day"), y = f === 0 || K(u.label, a.label, "month"), h = f === 0 || K(u.label, a.label, "hour"), v = f === 0 || K(u.label, a.label, "timeZoneName"), w = f === 0 || K(u.label, a.label, "minute"), x = f === 0 || K(u.label, a.label, "second"), b = f === 0 || K(u.label, a.label, "fractionalSecond"), g = [];
1476
+ if (i && (h || w || v || x || b)) {
1477
1477
  const T = u.label.find((P) => P.type === "hour")?.value, C = u.label.find((P) => P.type === "minute")?.value, E = u.label.find((P) => P.type === "timeZoneName")?.value;
1478
1478
  let S = "";
1479
1479
  if (c) {
@@ -1482,18 +1482,18 @@ const St = (e, t, n = "UTC") => {
1482
1482
  )?.value;
1483
1483
  S = `:${P}` + (l ? `.${k}` : "");
1484
1484
  }
1485
- v.push(
1486
- `${T}:${C}${S}` + (n && g ? ` ${E}` : "")
1485
+ g.push(
1486
+ `${T}:${C}${S}` + (n && v ? ` ${E}` : "")
1487
1487
  );
1488
1488
  }
1489
- return (d || y) && v.push(
1489
+ return (d || y) && g.push(
1490
1490
  [
1491
1491
  u.label.find((T) => T.type === "month")?.value,
1492
1492
  d && u.label.find((T) => T.type === "day")?.value
1493
1493
  ].filter(Boolean).join(" ")
1494
- ), p && v.push(u.label.find((T) => T.type === "year")?.value), {
1494
+ ), p && g.push(u.label.find((T) => T.type === "year")?.value), {
1495
1495
  value: u.value,
1496
- label: v.filter((T) => T).join(`
1496
+ label: g.filter((T) => T).join(`
1497
1497
  `)
1498
1498
  };
1499
1499
  });
@@ -1534,6 +1534,6 @@ export {
1534
1534
  xe as useInteractionsEvent,
1535
1535
  fe as valFits,
1536
1536
  G as valToPos,
1537
- ge as valToPxDistance
1537
+ ve as valToPxDistance
1538
1538
  };
1539
1539
  //# sourceMappingURL=canplot.mjs.map