@canplot/react 0.5.8 → 0.5.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/canplot.mjs CHANGED
@@ -17,7 +17,7 @@ const ie = (e, t, n) => Math.min(Math.max(e, t), n), kt = (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, i = X(e, n);
22
22
  if (!i)
23
23
  return null;
@@ -27,7 +27,7 @@ const ie = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
27
27
  const o = X(e, n);
28
28
  if (!o)
29
29
  return null;
30
- const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = ge(
30
+ const i = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, r = 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 r = Ve(() => {
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__ */ R(Re.Provider, { value: n, children: /* @__PURE__ */ R(De.Provider, { value: r, children: /* @__PURE__ */ R(ge.Provider, { value: e, children: t }) }) });
236
236
  }, tt = (e) => {
237
237
  const [t, n] = B({
238
238
  width: 0,
@@ -281,11 +281,11 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
281
281
  r.push({ ...a, axis: null });
282
282
  continue;
283
283
  }
284
- let g;
284
+ let v;
285
285
  if (a.origin === "x")
286
286
  switch (a.axis.position) {
287
287
  case "bottom":
288
- l -= a.axis.size * s, g = {
288
+ l -= a.axis.size * s, v = {
289
289
  x: o.x,
290
290
  y: l / s,
291
291
  width: o.width,
@@ -293,7 +293,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
293
293
  };
294
294
  break;
295
295
  case "top":
296
- p += a.axis.size * s, g = {
296
+ p += a.axis.size * s, v = {
297
297
  x: o.x,
298
298
  y: p / s - a.axis.size,
299
299
  width: o.width,
@@ -307,7 +307,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
307
307
  else
308
308
  switch (a.axis.position) {
309
309
  case "left":
310
- c += a.axis.size * s, g = {
310
+ c += a.axis.size * s, v = {
311
311
  x: c / s - a.axis.size,
312
312
  y: o.y,
313
313
  width: a.axis.size,
@@ -315,7 +315,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
315
315
  };
316
316
  break;
317
317
  case "right":
318
- u -= a.axis.size * s, g = {
318
+ u -= a.axis.size * s, v = {
319
319
  x: u / s,
320
320
  y: o.y,
321
321
  width: a.axis.size,
@@ -327,16 +327,16 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
327
327
  throw new Error("Invalid axis position for y origin");
328
328
  }
329
329
  const f = {
330
- x: g.x * s,
331
- y: g.y * s,
332
- width: g.width * s,
333
- height: g.height * s
330
+ x: v.x * s,
331
+ y: v.y * s,
332
+ width: v.width * s,
333
+ height: v.height * s
334
334
  };
335
335
  r.push({
336
336
  ...a,
337
337
  axis: {
338
338
  ...a.axis,
339
- cssRect: g,
339
+ cssRect: v,
340
340
  canvasRect: f
341
341
  }
342
342
  });
@@ -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 = q(ve), o = q(De), i = q(Re);
353
+ const s = q(ge), o = q(De), i = q(Re);
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());
@@ -374,7 +374,7 @@ 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(() => {
@@ -409,7 +409,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
409
409
  valToPos: p,
410
410
  valFits: d,
411
411
  clampXPosToChartArea: a,
412
- clampYPosToChartArea: g
412
+ clampYPosToChartArea: v
413
413
  }) => {
414
414
  l.save(), U(l, c), u !== void 0 && (l.globalAlpha = u);
415
415
  const f = [];
@@ -428,7 +428,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
428
428
  if (!d(y.y, s)) continue;
429
429
  m = x;
430
430
  } else
431
- m = g(x, "canvas");
431
+ m = v(x, "canvas");
432
432
  h === null || m === null || f.push({ x: h, y: m });
433
433
  }
434
434
  }
@@ -461,10 +461,10 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
461
461
  valToPxDistance: p,
462
462
  valToPos: d,
463
463
  clampXPosToChartArea: a,
464
- clampYPosToChartArea: g
464
+ clampYPosToChartArea: v
465
465
  }) => {
466
466
  if (e.length === 0) return;
467
- const f = g(
467
+ const f = v(
468
468
  d(0, n, "canvas"),
469
469
  "canvas"
470
470
  );
@@ -475,18 +475,18 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
475
475
  const w = d(m.x, t, "canvas");
476
476
  if (w === null)
477
477
  continue;
478
- const x = w - y / 2 + i * y, T = g(
478
+ const x = w - y / 2 + i * y, T = v(
479
479
  d(m.y, n, "canvas"),
480
480
  "canvas"
481
481
  );
482
482
  if (T === null)
483
483
  continue;
484
- const v = f - T, b = a(x, "canvas"), S = a(x + y, "canvas") - b;
484
+ const g = f - T, b = a(x, "canvas"), S = a(x + y, "canvas") - b;
485
485
  h.push({
486
486
  x: b,
487
487
  y: T,
488
488
  width: S,
489
- height: v
489
+ height: g
490
490
  });
491
491
  }
492
492
  if (l.save(), U(l, s), r !== void 0 && (l.globalAlpha = r), s?.fillStyle)
@@ -500,7 +500,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
500
500
  }
501
501
  l.restore();
502
502
  },
503
- [e, t, n, s, o, i, c]
503
+ [e, t, n, s, o, i, c, r]
504
504
  ), null), Ut = D.memo(it, F), rt = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
505
505
  e,
506
506
  ({ ctx: i, clampXPosToChartArea: r, clampYPosToChartArea: c, valToPos: u }) => {
@@ -509,11 +509,11 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
509
509
  const a = r(u(d.x, n));
510
510
  if (a === null)
511
511
  continue;
512
- const g = c(u(d.y[0], s));
513
- if (g === null)
512
+ const v = c(u(d.y[0], s));
513
+ if (v === null)
514
514
  continue;
515
515
  const f = c(u(d.y[1], s));
516
- f !== null && (l.push({ x: a, y: g }), l.unshift({ x: a, y: f }));
516
+ f !== null && (l.push({ x: a, y: v }), l.unshift({ x: a, y: f }));
517
517
  }
518
518
  const p = l[0];
519
519
  if (p) {
@@ -535,12 +535,12 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
535
535
  const d = p.at(0), a = p.at(-1);
536
536
  if (!d || !a)
537
537
  return;
538
- const g = u(l(0, o));
539
- if (g !== null) {
540
- r.save(), r.beginPath(), U(r, i), r.moveTo(d.x, g);
538
+ const v = u(l(0, o));
539
+ if (v !== null) {
540
+ r.save(), r.beginPath(), U(r, i), r.moveTo(d.x, v);
541
541
  for (const f of p)
542
542
  r.lineTo(f.x, f.y);
543
- if (r.lineTo(a.x, g), r.closePath(), r.fill(), n) {
543
+ if (r.lineTo(a.x, v), r.closePath(), r.fill(), n) {
544
544
  r.beginPath(), r.moveTo(d.x, d.y);
545
545
  for (const f of p)
546
546
  r.lineTo(f.x, f.y);
@@ -563,14 +563,14 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
563
563
  ({ ctx: c, valToPos: u, getScale: l, frame: p }) => {
564
564
  const d = l(t);
565
565
  if (!d || !d.axis || d.origin !== "x") return;
566
- const a = d.axis, g = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, f = window.devicePixelRatio || 1, y = g, h = (i ?? 6) * f, m = a.position === "top" ? g - h : g + h, w = (o ?? 12) * f;
566
+ const a = d.axis, v = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y, f = window.devicePixelRatio || 1, y = v, h = (i ?? 6) * f, m = a.position === "top" ? v - h : v + h, w = (o ?? 12) * f;
567
567
  c.save(), c.fontKerning = "auto", U(c, {
568
568
  ...n
569
569
  }), c.beginPath();
570
570
  const x = Array.isArray(r) ? r : r({ ...d, axis: a }, p);
571
571
  for (const { value: T } of x) {
572
- const v = u(T, t, "canvas");
573
- v !== null && (c.moveTo(v, y), c.lineTo(v, m));
572
+ const g = u(T, t, "canvas");
573
+ g !== null && (c.moveTo(g, y), c.lineTo(g, m));
574
574
  }
575
575
  c.stroke(), c.restore(), c.save(), U(c, {
576
576
  textBaseline: a.position === "top" ? "bottom" : "top",
@@ -580,11 +580,11 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
580
580
  // alter font size for DPR
581
581
  font: _e(s?.font ?? n?.font)
582
582
  });
583
- for (const { value: T, label: v } of x) {
583
+ for (const { value: T, label: g } of x) {
584
584
  const b = u(T, t, "canvas");
585
585
  if (b === null)
586
586
  continue;
587
- const S = v.split(`
587
+ const S = g.split(`
588
588
  `);
589
589
  for (let E = 0; E < S.length; E++)
590
590
  c.fillText(S[E], b, m + f * 2 + E * w);
@@ -605,7 +605,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
605
605
  ({ ctx: c, valToPos: u, getScale: l, frame: p }) => {
606
606
  const d = l(t);
607
607
  if (!d || !d.axis || d.origin !== "y") return;
608
- const a = d.axis, g = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, f = g, y = i ?? 6, h = a.position === "left" ? g - y : g + y, m = o ?? 12, w = Array.isArray(r) ? r : r({ ...d, axis: a }, p);
608
+ const a = d.axis, v = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x, f = v, y = i ?? 6, h = a.position === "left" ? v - y : v + y, m = o ?? 12, w = Array.isArray(r) ? r : r({ ...d, axis: a }, p);
609
609
  c.save(), c.fontKerning = "auto", U(c, { ...n }), c.beginPath();
610
610
  for (const { value: x } of w) {
611
611
  const T = u(x, t, "canvas");
@@ -620,13 +620,13 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
620
620
  font: _e(s?.font ?? n?.font)
621
621
  });
622
622
  for (const { value: x, label: T } of w) {
623
- const v = u(x, t, "canvas");
624
- if (v === null)
623
+ const g = u(x, t, "canvas");
624
+ if (g === null)
625
625
  continue;
626
626
  const b = T.split(`
627
627
  `);
628
628
  for (let S = 0; S < b.length; S++)
629
- c.fillText(` ${b[S]} `, h, v + S * m);
629
+ c.fillText(` ${b[S]} `, h, g + S * m);
630
630
  }
631
631
  c.restore();
632
632
  },
@@ -744,7 +744,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
744
744
  style: p,
745
745
  sync: d,
746
746
  innerChildren: a,
747
- children: g
747
+ children: v
748
748
  }) => {
749
749
  const f = He();
750
750
  return L("dblclick", f, (y) => {
@@ -774,12 +774,12 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
774
774
  children: a
775
775
  }
776
776
  ),
777
- g
777
+ v
778
778
  ] });
779
779
  }, ht = ({ id: e, className: t, style: n, sync: s, children: o }) => {
780
780
  const i = k(null), r = Ue().frame, c = k(r);
781
781
  c.current = r;
782
- const u = q(we), l = s?.key || u, p = k(null), d = k(null), a = k(null), g = () => {
782
+ const u = q(we), l = s?.key || u, p = k(null), d = k(null), a = k(null), v = () => {
783
783
  const h = i.current?.parentElement;
784
784
  if (h) {
785
785
  if (h.dataset.canplotroot === void 0)
@@ -791,7 +791,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
791
791
  }, f = (h, m) => {
792
792
  const w = ut(
793
793
  h,
794
- g(),
794
+ v(),
795
795
  c.current,
796
796
  s?.xViaScaleId,
797
797
  s?.yViaScaleId
@@ -808,7 +808,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
808
808
  );
809
809
  }, y = k(f);
810
810
  return y.current = f, ke(() => {
811
- const h = (v) => {
811
+ const h = (g) => {
812
812
  const b = d.current;
813
813
  b && M.spanselect.dispatchEvent(u, {
814
814
  ...b,
@@ -816,18 +816,18 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
816
816
  }), M.documentmouseup.dispatchEvent(u, {
817
817
  frame: c.current,
818
818
  keys: {
819
- ctrlKey: v.ctrlKey,
820
- altKey: v.altKey,
821
- shiftKey: v.shiftKey,
822
- metaKey: v.metaKey
819
+ ctrlKey: g.ctrlKey,
820
+ altKey: g.altKey,
821
+ shiftKey: g.shiftKey,
822
+ metaKey: g.metaKey
823
823
  }
824
824
  });
825
- }, m = (v) => {
825
+ }, m = (g) => {
826
826
  const b = {
827
- ctrlKey: v.ctrlKey,
828
- altKey: v.altKey,
829
- shiftKey: v.shiftKey,
830
- metaKey: v.metaKey
827
+ ctrlKey: g.ctrlKey,
828
+ altKey: g.altKey,
829
+ shiftKey: g.shiftKey,
830
+ metaKey: g.metaKey
831
831
  }, S = a.current;
832
832
  if (S && Object.entries(b).some(
833
833
  ([C, P]) => S.keys[C] !== P
@@ -839,13 +839,13 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
839
839
  if (E && Object.entries(b).some(
840
840
  ([C, P]) => E.keys[C] !== P
841
841
  )) {
842
- v.stopPropagation(), v.preventDefault();
842
+ g.stopPropagation(), g.preventDefault();
843
843
  const C = { ...E, keys: b };
844
844
  d.current = C, M.spanselect.dispatchEvent(u, C);
845
845
  }
846
- }, w = (v) => {
846
+ }, w = (g) => {
847
847
  y.current(
848
- v,
848
+ g,
849
849
  (b, { cssX: S, cssY: E }, C) => {
850
850
  const P = p.current;
851
851
  if (!P || !b.x || !b.y) return;
@@ -922,22 +922,22 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
922
922
  );
923
923
  }
924
924
  );
925
- }, x = (v) => {
926
- y.current(v, (b, S, E) => {
925
+ }, x = (g) => {
926
+ y.current(g, (b, S, E) => {
927
927
  const C = N(
928
928
  b,
929
929
  c.current
930
930
  );
931
931
  if (!C) return;
932
932
  if (Object.values(E).some((A) => A)) {
933
- v.preventDefault();
934
- const A = Math.abs(v.deltaY) > Math.abs(v.deltaX) ? v.deltaY : v.deltaX;
933
+ g.preventDefault();
934
+ const A = Math.abs(g.deltaY) > Math.abs(g.deltaX) ? g.deltaY : g.deltaX;
935
935
  M.pressandwheel.dispatchEvent(u, {
936
936
  pointer: C,
937
937
  frame: c.current,
938
938
  keys: E,
939
- deltaX: v.deltaX,
940
- deltaY: v.deltaY,
939
+ deltaX: g.deltaX,
940
+ deltaY: g.deltaY,
941
941
  deltaAbs: A
942
942
  });
943
943
  }
@@ -1012,12 +1012,12 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1012
1012
  },
1013
1013
  onMouseDown: (h) => {
1014
1014
  f(h, (m, { cssX: w, cssY: x }, T) => {
1015
- const v = N(
1015
+ const g = N(
1016
1016
  m,
1017
1017
  c.current
1018
1018
  );
1019
- v && (M.mousedown.dispatchEvent(u, {
1020
- pointer: v,
1019
+ g && (M.mousedown.dispatchEvent(u, {
1020
+ pointer: g,
1021
1021
  frame: c.current,
1022
1022
  keys: T
1023
1023
  }), p.current = {
@@ -1038,12 +1038,12 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1038
1038
  pointer: T,
1039
1039
  keys: x
1040
1040
  });
1041
- const v = d.current;
1041
+ const g = d.current;
1042
1042
  d.current = null;
1043
1043
  const b = p.current;
1044
- if (p.current = null, b && v) {
1044
+ if (p.current = null, b && g) {
1045
1045
  const S = {
1046
- ...v,
1046
+ ...g,
1047
1047
  keys: x,
1048
1048
  completed: !0
1049
1049
  };
@@ -1097,14 +1097,14 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1097
1097
  const p = [];
1098
1098
  let d = u;
1099
1099
  for (const a of e) {
1100
- let g = null, f = 1 / 0;
1100
+ let v = null, f = 1 / 0;
1101
1101
  for (const [m, w] of a.points.entries()) {
1102
1102
  if (!fe(r, w.x, n) || !fe(r, w.y, a.yScaleId))
1103
1103
  continue;
1104
1104
  const x = Math.abs(w.x - u);
1105
- x < f && (f = x, g = m);
1105
+ x < f && (f = x, v = m);
1106
1106
  }
1107
- const y = a.points[g ?? -1], h = ge(r, f, n, "css");
1107
+ const y = a.points[v ?? -1], h = ve(r, f, n, "css");
1108
1108
  if (!y || h === null || h > 30) {
1109
1109
  p.push({ seriesId: a.seriesId, y: null });
1110
1110
  continue;
@@ -1181,8 +1181,8 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1181
1181
  const o = Z(() => {
1182
1182
  if (!n || n.mode === "below_threshold")
1183
1183
  return null;
1184
- 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"), d = H(n.frame, c, "css"), a = H(n.frame, u, "css"), g = Math.min(l, p), f = Math.min(d, a), y = Math.abs(p - l), h = Math.abs(a - d);
1185
- return { leftPx: g, topPx: f, widthPx: y, heightPx: h };
1184
+ 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"), d = H(n.frame, c, "css"), a = H(n.frame, u, "css"), v = Math.min(l, p), f = Math.min(d, a), y = Math.abs(p - l), h = Math.abs(a - d);
1185
+ return { leftPx: v, topPx: f, widthPx: y, heightPx: h };
1186
1186
  }, [n]);
1187
1187
  return /* @__PURE__ */ R(
1188
1188
  "div",
@@ -1232,13 +1232,13 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1232
1232
  if (p === null)
1233
1233
  return [];
1234
1234
  const d = n ?? ne, a = d.find((f) => f > p) ?? d.at(-1) ?? 1;
1235
- let g = i;
1236
- if (Math.abs(g % a) > Number.EPSILON) {
1237
- const f = (a - g % a) % a;
1238
- g += f;
1235
+ let v = i;
1236
+ if (Math.abs(v % a) > Number.EPSILON) {
1237
+ const f = (a - v % a) % a;
1238
+ v += f;
1239
1239
  }
1240
- for (; g <= r && c.length < 1e3; )
1241
- c.push(g), g += a;
1240
+ for (; v <= r && c.length < 1e3; )
1241
+ c.push(v), v += a;
1242
1242
  return (t ?? mt)(c);
1243
1243
  }, mt = (e) => {
1244
1244
  const t = Math.max(0, Math.ceil(-Math.log10(e[1] - e[0])));
@@ -1246,7 +1246,7 @@ const Dt = je(({ configuration: e, children: t, style: n, ...s }, o) => {
1246
1246
  }, ne = [];
1247
1247
  for (let e = -12; e <= 12; e++)
1248
1248
  ne.push(1 * 10 ** e), ne.push(2 * 10 ** e), ne.push(5 * 10 ** e);
1249
- const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, re = 60 * be, ce = 24 * re, yt = 30 * ce, gt = 365 * ce, vt = [
1249
+ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, re = 60 * be, ce = 24 * re, yt = 30 * ce, vt = 365 * ce, gt = [
1250
1250
  // second divisors
1251
1251
  [1, "milliseconds"],
1252
1252
  [2, "milliseconds"],
@@ -1314,7 +1314,7 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, re = 60 * be, ce = 24 * re, yt = 30 *
1314
1314
  case "months":
1315
1315
  return t * yt;
1316
1316
  case "years":
1317
- return t * gt;
1317
+ return t * vt;
1318
1318
  }
1319
1319
  }, wt = (e, t) => {
1320
1320
  const n = new Date(e);
@@ -1407,26 +1407,26 @@ const Ct = (e, t, n = "UTC") => {
1407
1407
  const { min: c, max: u } = i;
1408
1408
  if (!Number.isFinite(c) || !Number.isFinite(u))
1409
1409
  return [];
1410
- const l = Math.floor(r.chartAreaCanvasPX.width / t) + 1, d = (u - c) / l, [a, g] = vt.find(
1410
+ const l = Math.floor(r.chartAreaCanvasPX.width / t) + 1, d = (u - c) / l, [a, v] = gt.find(
1411
1411
  (w) => se(w) >= d
1412
1412
  ) ?? [1, "milliseconds"];
1413
- if (!a || !g)
1413
+ if (!a || !v)
1414
1414
  return [];
1415
- const f = Ct(c, [a, g], e), y = oe(f, e), h = [f];
1415
+ const f = Ct(c, [a, v], e), y = oe(f, e), h = [f];
1416
1416
  let m;
1417
1417
  for (; !(h.length > 1e3); ) {
1418
- switch (g) {
1418
+ switch (v) {
1419
1419
  case "milliseconds":
1420
1420
  case "seconds":
1421
1421
  case "minutes":
1422
1422
  case "hours": {
1423
- m = Y(f, [h.length * a, g]);
1423
+ m = Y(f, [h.length * a, v]);
1424
1424
  break;
1425
1425
  }
1426
1426
  case "days": {
1427
1427
  const w = Y(f, [
1428
1428
  h.length * a,
1429
- g
1429
+ v
1430
1430
  ]);
1431
1431
  m = Y(w, [
1432
1432
  y - oe(w, e),
@@ -1439,7 +1439,7 @@ const Ct = (e, t, n = "UTC") => {
1439
1439
  const w = Y(
1440
1440
  Y(Y(f, [y, "hours"]), [
1441
1441
  h.length * a,
1442
- g
1442
+ v
1443
1443
  ]),
1444
1444
  [-y, "hours"]
1445
1445
  );
@@ -1479,7 +1479,7 @@ const Ct = (e, t, n = "UTC") => {
1479
1479
  return (o) => {
1480
1480
  const i = o[1] - o[0], r = i < se([1, "days"]), c = i < se([1, "minutes"]), u = i < se([1, "seconds"]);
1481
1481
  return o.map((l) => ({ value: l, label: s.formatToParts(new Date(l)) })).map((l, p, d) => {
1482
- const a = d[p - 1], g = p === 0 || K(l.label, a.label, "year"), f = p === 0 || K(l.label, a.label, "day"), y = p === 0 || K(l.label, a.label, "month"), h = p === 0 || K(l.label, a.label, "hour"), m = p === 0 || K(l.label, a.label, "timeZoneName"), w = p === 0 || K(l.label, a.label, "minute"), x = p === 0 || K(l.label, a.label, "second"), T = p === 0 || K(l.label, a.label, "fractionalSecond"), v = [];
1482
+ const a = d[p - 1], v = p === 0 || K(l.label, a.label, "year"), f = p === 0 || K(l.label, a.label, "day"), y = p === 0 || K(l.label, a.label, "month"), h = p === 0 || K(l.label, a.label, "hour"), m = p === 0 || K(l.label, a.label, "timeZoneName"), w = p === 0 || K(l.label, a.label, "minute"), x = p === 0 || K(l.label, a.label, "second"), T = p === 0 || K(l.label, a.label, "fractionalSecond"), g = [];
1483
1483
  if (r && (h || w || m || x || T)) {
1484
1484
  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;
1485
1485
  let C = "";
@@ -1489,18 +1489,18 @@ const Ct = (e, t, n = "UTC") => {
1489
1489
  )?.value;
1490
1490
  C = `:${P}` + (u ? `.${A}` : "");
1491
1491
  }
1492
- v.push(
1492
+ g.push(
1493
1493
  `${b}:${S}${C}` + (n && m ? ` ${E}` : "")
1494
1494
  );
1495
1495
  }
1496
- return (f || y) && v.push(
1496
+ return (f || y) && g.push(
1497
1497
  [
1498
1498
  l.label.find((b) => b.type === "month")?.value,
1499
1499
  f && l.label.find((b) => b.type === "day")?.value
1500
1500
  ].filter(Boolean).join(" ")
1501
- ), g && v.push(l.label.find((b) => b.type === "year")?.value), {
1501
+ ), v && g.push(l.label.find((b) => b.type === "year")?.value), {
1502
1502
  value: l.value,
1503
- label: v.filter((b) => b).join(`
1503
+ label: g.filter((b) => b).join(`
1504
1504
  `)
1505
1505
  };
1506
1506
  });
@@ -1541,6 +1541,6 @@ export {
1541
1541
  xe as useInteractionsEvent,
1542
1542
  fe as valFits,
1543
1543
  G as valToPos,
1544
- ge as valToPxDistance
1544
+ ve as valToPxDistance
1545
1545
  };
1546
1546
  //# sourceMappingURL=canplot.mjs.map