@canplot/react 0.5.2 → 0.5.4
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.cjs +4 -4
- package/dist/canplot.cjs.map +1 -1
- package/dist/canplot.mjs +192 -179
- package/dist/canplot.mjs.map +1 -1
- package/dist/frameContext.d.ts.map +1 -1
- package/dist/tickUtils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/canplot.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsxs as pe, jsx as R, Fragment as
|
|
5
|
-
import D, { version as
|
|
6
|
-
const re = (e, t, n) => Math.min(Math.max(e, t), n),
|
|
1
|
+
var Be = Object.defineProperty;
|
|
2
|
+
var ze = (e, t, n) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var O = (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 A, useState as B, useMemo as Z, useLayoutEffect as $, useCallback as Ve, useContext as q, useEffect as Ae, useId as He } from "react";
|
|
6
|
+
const re = (e, t, n) => Math.min(Math.max(e, t), n), At = (e) => e.reduce((t, n) => t + (n ?? 0), 0), Rt = (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);
|
|
@@ -63,19 +63,19 @@ const re = (e, t, n) => Math.min(Math.max(e, t), n), kt = (e) => e.reduce((t, n)
|
|
|
63
63
|
return null;
|
|
64
64
|
const r = s === "canvas" ? e.chartAreaCanvasPX : e.chartAreaCSS, i = o.origin === "x" ? (t - r.x) / r.width : (r.height - t + r.y) / r.height;
|
|
65
65
|
return o.min + i * (o.max - o.min);
|
|
66
|
-
},
|
|
66
|
+
}, F = (e, t) => {
|
|
67
67
|
if (e === t) return !0;
|
|
68
68
|
if (e == null || t == null || typeof e != typeof t || typeof e != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
69
69
|
if (Array.isArray(e) && Array.isArray(t)) {
|
|
70
70
|
if (e.length !== t.length) return !1;
|
|
71
71
|
for (let o = 0; o < e.length; o++)
|
|
72
|
-
if (!
|
|
72
|
+
if (!F(e[o], t[o])) return !1;
|
|
73
73
|
return !0;
|
|
74
74
|
}
|
|
75
75
|
const n = Object.keys(e), s = Object.keys(t);
|
|
76
76
|
if (n.length !== s.length) return !1;
|
|
77
77
|
for (const o of n)
|
|
78
|
-
if (!Object.prototype.hasOwnProperty.call(t, o) || !
|
|
78
|
+
if (!Object.prototype.hasOwnProperty.call(t, o) || !F(e[o], t[o])) return !1;
|
|
79
79
|
return !0;
|
|
80
80
|
}, qe = (e) => {
|
|
81
81
|
const { ctx: t, scales: n } = e;
|
|
@@ -124,8 +124,8 @@ function me(e, t) {
|
|
|
124
124
|
return e(t);
|
|
125
125
|
e && (e.current = t);
|
|
126
126
|
}
|
|
127
|
-
var Je = parseInt(
|
|
128
|
-
const
|
|
127
|
+
var Je = parseInt($e.split(".")[0], 10) >= 19 ? Ze : Ge;
|
|
128
|
+
const Re = ye({
|
|
129
129
|
listeners: [],
|
|
130
130
|
subscribe: () => () => {
|
|
131
131
|
},
|
|
@@ -140,22 +140,22 @@ const ke = ye({
|
|
|
140
140
|
for (const [, s] of e)
|
|
141
141
|
s();
|
|
142
142
|
} };
|
|
143
|
-
}, ve = ye(null),
|
|
144
|
-
}),
|
|
143
|
+
}, ve = ye(null), De = ye(() => {
|
|
144
|
+
}), Ie = {
|
|
145
145
|
TOP: 400,
|
|
146
146
|
MIDDLE: 300,
|
|
147
147
|
BOTTOM: 200,
|
|
148
148
|
BACKGROUND: 100
|
|
149
149
|
};
|
|
150
|
-
class
|
|
150
|
+
class Le {
|
|
151
151
|
constructor() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
152
|
+
O(this, "_frame", null);
|
|
153
|
+
O(this, "clampXPosToChartArea", (t, n = "canvas") => V(this.frame, t, n));
|
|
154
|
+
O(this, "clampYPosToChartArea", (t, n = "canvas") => H(this.frame, t, n));
|
|
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));
|
|
157
|
+
O(this, "valFits", (t, n) => fe(this.frame, t, n));
|
|
158
|
+
O(this, "getScale", (t) => X(this.frame, t));
|
|
159
159
|
}
|
|
160
160
|
_updateFrame(t) {
|
|
161
161
|
this._frame = t;
|
|
@@ -169,8 +169,8 @@ class Ie {
|
|
|
169
169
|
return this.frame.ctx;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
const Dt =
|
|
173
|
-
const r =
|
|
172
|
+
const Dt = je(({ configuration: e, children: t, style: n, className: s }, o) => {
|
|
173
|
+
const r = A(null), i = A(null), c = tt(i), [l, u] = B(null), f = Z(
|
|
174
174
|
() => nt(e, c, l),
|
|
175
175
|
[e, c, l]
|
|
176
176
|
);
|
|
@@ -216,11 +216,11 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
216
216
|
$(() => {
|
|
217
217
|
e?.ctx.clearRect(0, 0, e.ctx.canvas.width, e.ctx.canvas.height);
|
|
218
218
|
}, [e, s]);
|
|
219
|
-
const r =
|
|
219
|
+
const r = A(null);
|
|
220
220
|
r.current = e, $(() => {
|
|
221
221
|
n.subscribe(() => {
|
|
222
222
|
r.current && qe(r.current);
|
|
223
|
-
},
|
|
223
|
+
}, Ie.BOTTOM);
|
|
224
224
|
}, [n]), $(() => {
|
|
225
225
|
let c = null;
|
|
226
226
|
return c = window.requestAnimationFrame(() => {
|
|
@@ -229,10 +229,10 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
229
229
|
c && cancelAnimationFrame(c);
|
|
230
230
|
};
|
|
231
231
|
}, [s, e, n]);
|
|
232
|
-
const i =
|
|
232
|
+
const i = Ve(() => {
|
|
233
233
|
o((c) => c + 1);
|
|
234
234
|
}, [o]);
|
|
235
|
-
return /* @__PURE__ */ R(
|
|
235
|
+
return /* @__PURE__ */ R(Re.Provider, { value: n, children: /* @__PURE__ */ R(De.Provider, { value: i, children: /* @__PURE__ */ R(ve.Provider, { value: e, children: t }) }) });
|
|
236
236
|
}, tt = (e) => {
|
|
237
237
|
const [t, n] = B({
|
|
238
238
|
width: 0,
|
|
@@ -326,7 +326,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
326
326
|
case "bottom":
|
|
327
327
|
throw new Error("Invalid axis position for y origin");
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const d = {
|
|
330
330
|
x: p.x * s,
|
|
331
331
|
y: p.y * s,
|
|
332
332
|
width: p.width * s,
|
|
@@ -337,7 +337,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
337
337
|
axis: {
|
|
338
338
|
...a.axis,
|
|
339
339
|
cssRect: p,
|
|
340
|
-
canvasRect:
|
|
340
|
+
canvasRect: d
|
|
341
341
|
}
|
|
342
342
|
});
|
|
343
343
|
}
|
|
@@ -350,28 +350,35 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
350
350
|
chartAreaCanvasPX: r
|
|
351
351
|
};
|
|
352
352
|
}, j = (e, t, n) => {
|
|
353
|
-
const s = q(ve), o = q(
|
|
353
|
+
const s = q(ve), 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
|
-
const [i] = B(() => new
|
|
356
|
+
const [i] = B(() => new Le());
|
|
357
357
|
i._updateFrame(s);
|
|
358
|
-
const c =
|
|
358
|
+
const c = A(i);
|
|
359
359
|
c.current = i;
|
|
360
|
-
const l =
|
|
361
|
-
l.current = t, $(() =>
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
360
|
+
const l = A(t);
|
|
361
|
+
l.current = t, $(() => {
|
|
362
|
+
const u = r.subscribe(
|
|
363
|
+
() => {
|
|
364
|
+
l.current(i);
|
|
365
|
+
},
|
|
366
|
+
typeof e == "number" ? e : Ie[e]
|
|
367
|
+
);
|
|
368
|
+
return () => {
|
|
369
|
+
u();
|
|
370
|
+
};
|
|
371
|
+
}, [r, e, i]), $(() => {
|
|
372
|
+
o();
|
|
373
|
+
}, [o, ...n]), Ae(() => () => {
|
|
367
374
|
o();
|
|
368
|
-
}, [o
|
|
369
|
-
},
|
|
375
|
+
}, [o]);
|
|
376
|
+
}, Ue = () => {
|
|
370
377
|
const e = q(ve);
|
|
371
378
|
if (!e)
|
|
372
379
|
throw new Error("useFrame must be used within a CanPlot component");
|
|
373
380
|
return Z(() => {
|
|
374
|
-
const t = new
|
|
381
|
+
const t = new Le();
|
|
375
382
|
return t._updateFrame(e), t;
|
|
376
383
|
}, [e]);
|
|
377
384
|
}, st = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
|
|
@@ -385,7 +392,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
385
392
|
r.stroke(), r.restore();
|
|
386
393
|
},
|
|
387
394
|
[t, n, s, o]
|
|
388
|
-
), null), It = D.memo(st,
|
|
395
|
+
), null), It = D.memo(st, F), ot = ({
|
|
389
396
|
layer: e = "MIDDLE",
|
|
390
397
|
data: t,
|
|
391
398
|
xScaleId: n,
|
|
@@ -405,20 +412,20 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
405
412
|
clampYPosToChartArea: p
|
|
406
413
|
}) => {
|
|
407
414
|
u.save(), u.beginPath();
|
|
408
|
-
const
|
|
415
|
+
const d = new Path2D();
|
|
409
416
|
U(u, c), l !== void 0 && (u.globalAlpha = l);
|
|
410
417
|
for (const y of t) {
|
|
411
|
-
let
|
|
418
|
+
let h, g;
|
|
412
419
|
switch (o) {
|
|
413
420
|
case "clip":
|
|
414
421
|
if (!m(y.x, n))
|
|
415
422
|
continue;
|
|
416
|
-
|
|
423
|
+
h = f(y.x, n);
|
|
417
424
|
break;
|
|
418
425
|
case "clamp": {
|
|
419
426
|
if (f(y.x, n) === null)
|
|
420
427
|
continue;
|
|
421
|
-
|
|
428
|
+
h = a(f(y.x, n), "canvas");
|
|
422
429
|
break;
|
|
423
430
|
}
|
|
424
431
|
}
|
|
@@ -432,12 +439,12 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
432
439
|
g = p(f(y.y, s), "canvas");
|
|
433
440
|
break;
|
|
434
441
|
}
|
|
435
|
-
|
|
442
|
+
h === null || g === null || (d.moveTo(h + i, g), d.arc(h, g, i, 0, Math.PI * 2));
|
|
436
443
|
}
|
|
437
|
-
u.fill(
|
|
444
|
+
u.fill(d), u.stroke(d), u.restore();
|
|
438
445
|
},
|
|
439
446
|
[t, n, s, i, c, l]
|
|
440
|
-
), null), Lt = D.memo(ot,
|
|
447
|
+
), null), Lt = D.memo(ot, F), rt = ({
|
|
441
448
|
data: e,
|
|
442
449
|
xScaleId: t,
|
|
443
450
|
yScaleId: n,
|
|
@@ -459,23 +466,23 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
459
466
|
l.save(), U(l, s);
|
|
460
467
|
const p = u(o, t) ?? 0;
|
|
461
468
|
l.beginPath();
|
|
462
|
-
for (const
|
|
463
|
-
const y = f(
|
|
469
|
+
for (const d of e) {
|
|
470
|
+
const y = f(d.x, t);
|
|
464
471
|
if (y === null)
|
|
465
472
|
continue;
|
|
466
|
-
const
|
|
473
|
+
const h = y - p / 2 + r * p, g = a(
|
|
467
474
|
f(0, n, "canvas"),
|
|
468
475
|
"canvas"
|
|
469
476
|
);
|
|
470
477
|
if (g === null)
|
|
471
478
|
continue;
|
|
472
479
|
const w = a(
|
|
473
|
-
f(
|
|
480
|
+
f(d.y, n, "canvas"),
|
|
474
481
|
"canvas"
|
|
475
482
|
);
|
|
476
483
|
if (w === null)
|
|
477
484
|
continue;
|
|
478
|
-
const x = g - w, b = m(
|
|
485
|
+
const x = g - w, b = m(h, "canvas"), v = m(h + p, "canvas") - b;
|
|
479
486
|
i ? l.roundRect(
|
|
480
487
|
b,
|
|
481
488
|
w,
|
|
@@ -487,7 +494,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
487
494
|
l.closePath(), l.fill(), s?.strokeStyle && l.stroke(), l.restore();
|
|
488
495
|
},
|
|
489
496
|
[e, t, n, s, o, r, i]
|
|
490
|
-
), null), Ut = D.memo(rt,
|
|
497
|
+
), null), Ut = D.memo(rt, F), it = ({ layer: e = "MIDDLE", data: t, xScaleId: n, yScaleId: s, style: o }) => (j(
|
|
491
498
|
e,
|
|
492
499
|
({ ctx: r, clampXPosToChartArea: i, clampYPosToChartArea: c, valToPos: l }) => {
|
|
493
500
|
const u = [];
|
|
@@ -498,8 +505,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
498
505
|
const p = c(l(m.y[0], s));
|
|
499
506
|
if (p === null)
|
|
500
507
|
continue;
|
|
501
|
-
const
|
|
502
|
-
|
|
508
|
+
const d = c(l(m.y[1], s));
|
|
509
|
+
d !== null && (u.push({ x: a, y: p }), u.unshift({ x: a, y: d }));
|
|
503
510
|
}
|
|
504
511
|
const f = u[0];
|
|
505
512
|
if (f) {
|
|
@@ -510,13 +517,13 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
510
517
|
}
|
|
511
518
|
},
|
|
512
519
|
[t, n, s, o]
|
|
513
|
-
), null), _t = D.memo(it,
|
|
520
|
+
), null), _t = D.memo(it, F), ct = ({ layer: e = "MIDDLE", data: t, stroked: n, xScaleId: s, yScaleId: o, style: r }) => (j(
|
|
514
521
|
e,
|
|
515
522
|
({ ctx: i, clampXPosToChartArea: c, clampYPosToChartArea: l, valToPos: u }) => {
|
|
516
523
|
const f = [];
|
|
517
|
-
for (const
|
|
518
|
-
const y = c(u(
|
|
519
|
-
y === null ||
|
|
524
|
+
for (const d of t) {
|
|
525
|
+
const y = c(u(d.x, s)), h = l(u(d.y, o));
|
|
526
|
+
y === null || h === null || f.push({ x: y, y: h });
|
|
520
527
|
}
|
|
521
528
|
const m = f.at(0), a = f.at(-1);
|
|
522
529
|
if (!m || !a)
|
|
@@ -524,19 +531,19 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
524
531
|
const p = l(u(0, o));
|
|
525
532
|
if (p !== null) {
|
|
526
533
|
i.save(), i.beginPath(), U(i, r), i.moveTo(m.x, p);
|
|
527
|
-
for (const
|
|
528
|
-
i.lineTo(
|
|
534
|
+
for (const d of f)
|
|
535
|
+
i.lineTo(d.x, d.y);
|
|
529
536
|
if (i.lineTo(a.x, p), i.closePath(), i.fill(), n) {
|
|
530
537
|
i.beginPath(), i.moveTo(m.x, m.y);
|
|
531
|
-
for (const
|
|
532
|
-
i.lineTo(
|
|
538
|
+
for (const d of f)
|
|
539
|
+
i.lineTo(d.x, d.y);
|
|
533
540
|
i.stroke();
|
|
534
541
|
}
|
|
535
542
|
i.restore();
|
|
536
543
|
}
|
|
537
544
|
},
|
|
538
545
|
[t, n, s, o, r]
|
|
539
|
-
), null), Xt = D.memo(ct,
|
|
546
|
+
), null), Xt = D.memo(ct, F), at = ({
|
|
540
547
|
layer: e = "BOTTOM",
|
|
541
548
|
scaleId: t,
|
|
542
549
|
tickStyle: n,
|
|
@@ -549,7 +556,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
549
556
|
({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
|
|
550
557
|
const m = u(t);
|
|
551
558
|
if (!m || !m.axis || m.origin !== "x") return;
|
|
552
|
-
const a = m.axis, p = a.position === "top" ? a.canvasRect.y + a.canvasRect.height : a.canvasRect.y,
|
|
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;
|
|
553
560
|
c.save(), c.fontKerning = "auto", U(c, {
|
|
554
561
|
...n
|
|
555
562
|
}), c.beginPath();
|
|
@@ -564,7 +571,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
564
571
|
...n,
|
|
565
572
|
...s,
|
|
566
573
|
// alter font size for DPR
|
|
567
|
-
font:
|
|
574
|
+
font: _e(s?.font ?? n?.font)
|
|
568
575
|
});
|
|
569
576
|
for (const { value: b, label: v } of x) {
|
|
570
577
|
const T = l(b, t, "canvas");
|
|
@@ -573,12 +580,12 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
573
580
|
const C = v.split(`
|
|
574
581
|
`);
|
|
575
582
|
for (let E = 0; E < C.length; E++)
|
|
576
|
-
c.fillText(C[E], T, g +
|
|
583
|
+
c.fillText(C[E], T, g + d * 2 + E * w);
|
|
577
584
|
}
|
|
578
585
|
c.restore();
|
|
579
586
|
},
|
|
580
587
|
[i, t, n, s]
|
|
581
|
-
), null),
|
|
588
|
+
), null), Ft = D.memo(at, F), lt = ({
|
|
582
589
|
layer: e = "BOTTOM",
|
|
583
590
|
scaleId: t,
|
|
584
591
|
tickStyle: n,
|
|
@@ -591,11 +598,11 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
591
598
|
({ ctx: c, valToPos: l, getScale: u, frame: f }) => {
|
|
592
599
|
const m = u(t);
|
|
593
600
|
if (!m || !m.axis || m.origin !== "y") return;
|
|
594
|
-
const a = m.axis, p = a.position === "left" ? a.canvasRect.x + a.canvasRect.width : a.canvasRect.x,
|
|
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);
|
|
595
602
|
c.save(), c.fontKerning = "auto", U(c, { ...n }), c.beginPath();
|
|
596
603
|
for (const { value: x } of w) {
|
|
597
604
|
const b = l(x, t, "canvas");
|
|
598
|
-
b !== null && (c.moveTo(
|
|
605
|
+
b !== null && (c.moveTo(d, b), c.lineTo(h, b));
|
|
599
606
|
}
|
|
600
607
|
c.stroke(), c.restore(), c.save(), U(c, {
|
|
601
608
|
textBaseline: "middle",
|
|
@@ -603,7 +610,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
603
610
|
...n,
|
|
604
611
|
...s,
|
|
605
612
|
// alter font size for DPR
|
|
606
|
-
font:
|
|
613
|
+
font: _e(s?.font ?? n?.font)
|
|
607
614
|
});
|
|
608
615
|
for (const { value: x, label: b } of w) {
|
|
609
616
|
const v = l(x, t, "canvas");
|
|
@@ -612,12 +619,12 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
612
619
|
const T = b.split(`
|
|
613
620
|
`);
|
|
614
621
|
for (let C = 0; C < T.length; C++)
|
|
615
|
-
c.fillText(` ${T[C]} `,
|
|
622
|
+
c.fillText(` ${T[C]} `, h, v + C * g);
|
|
616
623
|
}
|
|
617
624
|
c.restore();
|
|
618
625
|
},
|
|
619
626
|
[i, t, n, s]
|
|
620
|
-
), null),
|
|
627
|
+
), null), Ot = D.memo(lt, F), _e = (e) => {
|
|
621
628
|
if (e)
|
|
622
629
|
try {
|
|
623
630
|
return e.replace(/(\d+)px/, (t, n) => `${parseInt(n) * window.devicePixelRatio || 1}px`);
|
|
@@ -732,24 +739,24 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
732
739
|
innerChildren: a,
|
|
733
740
|
children: p
|
|
734
741
|
}) => {
|
|
735
|
-
const
|
|
736
|
-
return L("dblclick",
|
|
742
|
+
const d = He();
|
|
743
|
+
return L("dblclick", d, (y) => {
|
|
737
744
|
n?.(y);
|
|
738
|
-
}), L("click",
|
|
745
|
+
}), L("click", d, (y) => {
|
|
739
746
|
t?.(y);
|
|
740
|
-
}), L("move",
|
|
747
|
+
}), L("move", d, (y) => {
|
|
741
748
|
s?.(y);
|
|
742
|
-
}), L("mousedown",
|
|
749
|
+
}), L("mousedown", d, (y) => {
|
|
743
750
|
o?.(y);
|
|
744
|
-
}), L("mouseup",
|
|
751
|
+
}), L("mouseup", d, (y) => {
|
|
745
752
|
r?.(y);
|
|
746
|
-
}), L("documentmouseup",
|
|
753
|
+
}), L("documentmouseup", d, (y) => {
|
|
747
754
|
i?.(y);
|
|
748
|
-
}), L("spanselect",
|
|
755
|
+
}), L("spanselect", d, (y) => {
|
|
749
756
|
c?.(y);
|
|
750
|
-
}), L("contextmenu",
|
|
757
|
+
}), L("contextmenu", d, (y) => {
|
|
751
758
|
l?.(y);
|
|
752
|
-
}), /* @__PURE__ */ pe(we.Provider, { value:
|
|
759
|
+
}), /* @__PURE__ */ pe(we.Provider, { value: d, children: [
|
|
753
760
|
/* @__PURE__ */ R(
|
|
754
761
|
ht,
|
|
755
762
|
{
|
|
@@ -763,20 +770,20 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
763
770
|
p
|
|
764
771
|
] });
|
|
765
772
|
}, ht = ({ id: e, className: t, style: n, sync: s, children: o }) => {
|
|
766
|
-
const r =
|
|
773
|
+
const r = A(null), i = Ue().frame, c = A(i);
|
|
767
774
|
c.current = i;
|
|
768
|
-
const l = q(we), u = s?.key || l, f =
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
if (
|
|
775
|
+
const l = q(we), u = s?.key || l, f = A(null), m = A(null), a = A(null), p = () => {
|
|
776
|
+
const h = r.current?.parentElement;
|
|
777
|
+
if (h) {
|
|
778
|
+
if (h.dataset.canplotroot === void 0)
|
|
772
779
|
throw new Error(
|
|
773
780
|
"ChartAreaInteractions must be used within a CanPlot component"
|
|
774
781
|
);
|
|
775
|
-
return
|
|
782
|
+
return h.getBoundingClientRect();
|
|
776
783
|
}
|
|
777
|
-
},
|
|
784
|
+
}, d = (h, g) => {
|
|
778
785
|
const w = ut(
|
|
779
|
-
|
|
786
|
+
h,
|
|
780
787
|
p(),
|
|
781
788
|
c.current,
|
|
782
789
|
s?.xViaScaleId,
|
|
@@ -786,15 +793,15 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
786
793
|
w.pointerSyncPosition,
|
|
787
794
|
{ cssX: w.cssX, cssY: w.cssY },
|
|
788
795
|
{
|
|
789
|
-
ctrlKey:
|
|
790
|
-
altKey:
|
|
791
|
-
shiftKey:
|
|
792
|
-
metaKey:
|
|
796
|
+
ctrlKey: h.ctrlKey,
|
|
797
|
+
altKey: h.altKey,
|
|
798
|
+
shiftKey: h.shiftKey,
|
|
799
|
+
metaKey: h.metaKey
|
|
793
800
|
}
|
|
794
801
|
);
|
|
795
|
-
}, y =
|
|
796
|
-
return y.current =
|
|
797
|
-
const
|
|
802
|
+
}, y = A(d);
|
|
803
|
+
return y.current = d, Ae(() => {
|
|
804
|
+
const h = (v) => {
|
|
798
805
|
const T = m.current;
|
|
799
806
|
T && M.spanselect.dispatchEvent(l, {
|
|
800
807
|
...T,
|
|
@@ -835,9 +842,9 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
835
842
|
(T, { cssX: C, cssY: E }, S) => {
|
|
836
843
|
const P = f.current;
|
|
837
844
|
if (!P || !T.x || !T.y) return;
|
|
838
|
-
const
|
|
845
|
+
const k = c.current, z = P.xRangeCss.start, ae = C, le = P.yRangeCss.start, ue = E, J = X(k, T.x.scaleId);
|
|
839
846
|
if (!J) return;
|
|
840
|
-
const Q = X(
|
|
847
|
+
const Q = X(k, T.y.scaleId);
|
|
841
848
|
if (!Q) return;
|
|
842
849
|
f.current = {
|
|
843
850
|
xRangeCss: { start: z, end: ae },
|
|
@@ -847,28 +854,28 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
847
854
|
const he = Math.abs(le - ue), de = Math.abs(z - ae);
|
|
848
855
|
he < 10 && de < 10 ? W = "below_threshold" : he > 30 && de > 30 ? W = "box" : he > de ? W = "y" : W = "x";
|
|
849
856
|
const Te = _(
|
|
850
|
-
|
|
857
|
+
k,
|
|
851
858
|
V(c.current, z, "css"),
|
|
852
859
|
J.id,
|
|
853
860
|
"css"
|
|
854
861
|
);
|
|
855
862
|
if (Te === null) return;
|
|
856
863
|
const Ce = _(
|
|
857
|
-
|
|
864
|
+
k,
|
|
858
865
|
V(c.current, ae, "css"),
|
|
859
866
|
J.id,
|
|
860
867
|
"css"
|
|
861
868
|
);
|
|
862
869
|
if (Ce === null) return;
|
|
863
870
|
const Se = _(
|
|
864
|
-
|
|
871
|
+
k,
|
|
865
872
|
H(c.current, le, "css"),
|
|
866
873
|
Q.id,
|
|
867
874
|
"css"
|
|
868
875
|
);
|
|
869
876
|
if (Se === null) return;
|
|
870
877
|
const Pe = _(
|
|
871
|
-
|
|
878
|
+
k,
|
|
872
879
|
H(c.current, ue, "css"),
|
|
873
880
|
Q.id,
|
|
874
881
|
"css"
|
|
@@ -882,7 +889,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
882
889
|
"y",
|
|
883
890
|
{ scaleId: Q.id, from: Se, to: Pe },
|
|
884
891
|
c.current
|
|
885
|
-
),
|
|
892
|
+
), Ke = ee?.scaled, Ye = te?.scaled, Me = {
|
|
886
893
|
mode: W,
|
|
887
894
|
frame: c.current,
|
|
888
895
|
completed: !1,
|
|
@@ -891,14 +898,14 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
891
898
|
from: ee.fromCSS,
|
|
892
899
|
to: ee.toCSS
|
|
893
900
|
} : void 0,
|
|
894
|
-
scaled:
|
|
901
|
+
scaled: Ke ?? []
|
|
895
902
|
},
|
|
896
903
|
y: {
|
|
897
904
|
css: te ? {
|
|
898
905
|
from: te.fromCSS,
|
|
899
906
|
to: te.toCSS
|
|
900
907
|
} : void 0,
|
|
901
|
-
scaled:
|
|
908
|
+
scaled: Ye ?? []
|
|
902
909
|
},
|
|
903
910
|
keys: S
|
|
904
911
|
};
|
|
@@ -915,37 +922,37 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
915
922
|
c.current
|
|
916
923
|
);
|
|
917
924
|
if (!S) return;
|
|
918
|
-
if (Object.values(E).some((
|
|
925
|
+
if (Object.values(E).some((k) => k)) {
|
|
919
926
|
v.preventDefault();
|
|
920
|
-
const
|
|
927
|
+
const k = Math.abs(v.deltaY) > Math.abs(v.deltaX) ? v.deltaY : v.deltaX;
|
|
921
928
|
M.pressandwheel.dispatchEvent(l, {
|
|
922
929
|
pointer: S,
|
|
923
930
|
frame: c.current,
|
|
924
931
|
keys: E,
|
|
925
932
|
deltaX: v.deltaX,
|
|
926
933
|
deltaY: v.deltaY,
|
|
927
|
-
deltaAbs:
|
|
934
|
+
deltaAbs: k
|
|
928
935
|
});
|
|
929
936
|
}
|
|
930
937
|
});
|
|
931
938
|
};
|
|
932
|
-
document.addEventListener("mouseup",
|
|
939
|
+
document.addEventListener("mouseup", h), document.addEventListener("keydown", g), document.addEventListener("keyup", g), document.addEventListener("mousemove", w);
|
|
933
940
|
const b = r.current;
|
|
934
941
|
return b?.addEventListener("wheel", x, {
|
|
935
942
|
passive: !1
|
|
936
943
|
}), () => {
|
|
937
|
-
document.removeEventListener("mouseup",
|
|
944
|
+
document.removeEventListener("mouseup", h), document.removeEventListener("keydown", g), document.removeEventListener("keyup", g), document.removeEventListener("mousemove", w), b?.removeEventListener("wheel", x);
|
|
938
945
|
};
|
|
939
|
-
}, [c, l, u, y]), L("sync_move", u, (
|
|
940
|
-
const g =
|
|
941
|
-
|
|
946
|
+
}, [c, l, u, y]), L("sync_move", u, (h) => {
|
|
947
|
+
const g = h.positions ? N(
|
|
948
|
+
h.positions,
|
|
942
949
|
c.current
|
|
943
950
|
) : null;
|
|
944
|
-
a.current =
|
|
951
|
+
a.current = h, M.move.dispatchEvent(l, {
|
|
945
952
|
frame: c.current,
|
|
946
953
|
pointer: g ?? null,
|
|
947
|
-
keys:
|
|
948
|
-
source:
|
|
954
|
+
keys: h.keys,
|
|
955
|
+
source: h.originInteractionsId === l ? "own" : "sync"
|
|
949
956
|
});
|
|
950
957
|
}), /* @__PURE__ */ R(
|
|
951
958
|
"div",
|
|
@@ -962,11 +969,11 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
962
969
|
zIndex: 25,
|
|
963
970
|
...n
|
|
964
971
|
},
|
|
965
|
-
onDragStart: (
|
|
966
|
-
|
|
972
|
+
onDragStart: (h) => {
|
|
973
|
+
h.preventDefault();
|
|
967
974
|
},
|
|
968
|
-
onClick: (
|
|
969
|
-
h
|
|
975
|
+
onClick: (h) => {
|
|
976
|
+
d(h, (g, w, x) => {
|
|
970
977
|
const b = N(
|
|
971
978
|
g,
|
|
972
979
|
c.current
|
|
@@ -978,8 +985,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
978
985
|
});
|
|
979
986
|
});
|
|
980
987
|
},
|
|
981
|
-
onMouseLeave: (
|
|
982
|
-
h
|
|
988
|
+
onMouseLeave: (h) => {
|
|
989
|
+
d(h, (g, w, x) => {
|
|
983
990
|
M.sync_move.dispatchEvent(u, {
|
|
984
991
|
positions: null,
|
|
985
992
|
keys: x,
|
|
@@ -987,8 +994,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
987
994
|
});
|
|
988
995
|
});
|
|
989
996
|
},
|
|
990
|
-
onMouseMove: (
|
|
991
|
-
h
|
|
997
|
+
onMouseMove: (h) => {
|
|
998
|
+
d(h, (g, w, x) => {
|
|
992
999
|
M.sync_move.dispatchEvent(u, {
|
|
993
1000
|
positions: g,
|
|
994
1001
|
keys: x,
|
|
@@ -996,8 +1003,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
996
1003
|
});
|
|
997
1004
|
});
|
|
998
1005
|
},
|
|
999
|
-
onMouseDown: (
|
|
1000
|
-
h
|
|
1006
|
+
onMouseDown: (h) => {
|
|
1007
|
+
d(h, (g, { cssX: w, cssY: x }, b) => {
|
|
1001
1008
|
const v = N(
|
|
1002
1009
|
g,
|
|
1003
1010
|
c.current
|
|
@@ -1012,8 +1019,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1012
1019
|
});
|
|
1013
1020
|
});
|
|
1014
1021
|
},
|
|
1015
|
-
onMouseUp: (
|
|
1016
|
-
h
|
|
1022
|
+
onMouseUp: (h) => {
|
|
1023
|
+
d(h, (g, w, x) => {
|
|
1017
1024
|
const b = N(
|
|
1018
1025
|
g,
|
|
1019
1026
|
c.current
|
|
@@ -1040,8 +1047,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1040
1047
|
}
|
|
1041
1048
|
});
|
|
1042
1049
|
},
|
|
1043
|
-
onContextMenu: (
|
|
1044
|
-
|
|
1050
|
+
onContextMenu: (h) => {
|
|
1051
|
+
h.preventDefault(), d(h, (g, w, x) => {
|
|
1045
1052
|
const b = N(
|
|
1046
1053
|
g,
|
|
1047
1054
|
c.current
|
|
@@ -1053,8 +1060,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1053
1060
|
});
|
|
1054
1061
|
});
|
|
1055
1062
|
},
|
|
1056
|
-
onDoubleClick: (
|
|
1057
|
-
h
|
|
1063
|
+
onDoubleClick: (h) => {
|
|
1064
|
+
d(h, (g, w, x) => {
|
|
1058
1065
|
const b = N(
|
|
1059
1066
|
g,
|
|
1060
1067
|
c.current
|
|
@@ -1083,15 +1090,15 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1083
1090
|
const f = [];
|
|
1084
1091
|
let m = l;
|
|
1085
1092
|
for (const a of e) {
|
|
1086
|
-
let p = null,
|
|
1093
|
+
let p = null, d = 1 / 0;
|
|
1087
1094
|
for (const [g, w] of a.points.entries()) {
|
|
1088
1095
|
if (!fe(i, w.x, n) || !fe(i, w.y, a.yScaleId))
|
|
1089
1096
|
continue;
|
|
1090
1097
|
const x = Math.abs(w.x - l);
|
|
1091
|
-
x <
|
|
1098
|
+
x < d && (d = x, p = g);
|
|
1092
1099
|
}
|
|
1093
|
-
const y = a.points[p ?? -1],
|
|
1094
|
-
if (!y ||
|
|
1100
|
+
const y = a.points[p ?? -1], h = ge(i, d, n, "css");
|
|
1101
|
+
if (!y || h === null || h > 30) {
|
|
1095
1102
|
f.push({ seriesId: a.seriesId, y: null });
|
|
1096
1103
|
continue;
|
|
1097
1104
|
}
|
|
@@ -1114,7 +1121,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1114
1121
|
}), !o)
|
|
1115
1122
|
return null;
|
|
1116
1123
|
const { frame: i, pointer: c } = o, l = c?.cssX ?? null, u = c?.cssY ?? null, f = l ? V(i, l, "css") : 0, m = u ? H(i, u, "css") : 0;
|
|
1117
|
-
return /* @__PURE__ */ pe(
|
|
1124
|
+
return /* @__PURE__ */ pe(Ne, { children: [
|
|
1118
1125
|
/* @__PURE__ */ R(
|
|
1119
1126
|
"div",
|
|
1120
1127
|
{
|
|
@@ -1167,8 +1174,8 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1167
1174
|
const o = Z(() => {
|
|
1168
1175
|
if (!n || n.mode === "below_threshold")
|
|
1169
1176
|
return null;
|
|
1170
|
-
const r = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0, i = n.mode === "y" ? 1 / 0 : n.x.css?.to ?? 1 / 0, c = n.mode === "x" ? -1 / 0 : n.y.css?.from ?? -1 / 0, l = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, u = V(n.frame, r, "css"), f = V(n.frame, i, "css"), m = H(n.frame, c, "css"), a = H(n.frame, l, "css"), p = Math.min(u, f),
|
|
1171
|
-
return { leftPx: p, topPx:
|
|
1177
|
+
const r = n.mode === "y" ? -1 / 0 : n.x.css?.from ?? -1 / 0, i = n.mode === "y" ? 1 / 0 : n.x.css?.to ?? 1 / 0, c = n.mode === "x" ? -1 / 0 : n.y.css?.from ?? -1 / 0, l = n.mode === "x" ? 1 / 0 : n.y.css?.to ?? 1 / 0, u = V(n.frame, r, "css"), f = V(n.frame, i, "css"), m = H(n.frame, c, "css"), a = H(n.frame, l, "css"), p = Math.min(u, f), d = Math.min(m, a), y = Math.abs(f - u), h = Math.abs(a - m);
|
|
1178
|
+
return { leftPx: p, topPx: d, widthPx: y, heightPx: h };
|
|
1172
1179
|
}, [n]);
|
|
1173
1180
|
return /* @__PURE__ */ R(
|
|
1174
1181
|
"div",
|
|
@@ -1187,7 +1194,7 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1187
1194
|
}
|
|
1188
1195
|
);
|
|
1189
1196
|
}, Nt = ({ style: e, children: t, scaleId: n, ...s }) => {
|
|
1190
|
-
const o =
|
|
1197
|
+
const o = Ue().getScale(n)?.axis;
|
|
1191
1198
|
return o ? /* @__PURE__ */ R(
|
|
1192
1199
|
"div",
|
|
1193
1200
|
{
|
|
@@ -1204,12 +1211,12 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1204
1211
|
children: t
|
|
1205
1212
|
}
|
|
1206
1213
|
) : null;
|
|
1207
|
-
},
|
|
1214
|
+
}, Xe = 60, dt = 30, Fe = "UTC", ft = "en-GB", $t = ({
|
|
1208
1215
|
space: e,
|
|
1209
1216
|
formatter: t,
|
|
1210
1217
|
acceptableIncrements: n
|
|
1211
1218
|
} = {}) => (s, o) => {
|
|
1212
|
-
const { min: r, max: i } = s, c = [], l = window.devicePixelRatio || 1, u = (e ?? (s.origin === "x" ?
|
|
1219
|
+
const { min: r, max: i } = s, c = [], l = window.devicePixelRatio || 1, u = (e ?? (s.origin === "x" ? Xe : dt)) * l, f = We(
|
|
1213
1220
|
o,
|
|
1214
1221
|
u,
|
|
1215
1222
|
s.id,
|
|
@@ -1217,11 +1224,11 @@ const Dt = $e(({ configuration: e, children: t, style: n, className: s }, o) =>
|
|
|
1217
1224
|
);
|
|
1218
1225
|
if (f === null)
|
|
1219
1226
|
return [];
|
|
1220
|
-
const m = n ?? ne, a = m.find((
|
|
1227
|
+
const m = n ?? ne, a = m.find((d) => d > f) ?? m.at(-1) ?? 1;
|
|
1221
1228
|
let p = r;
|
|
1222
1229
|
if (Math.abs(p % a) > Number.EPSILON) {
|
|
1223
|
-
const
|
|
1224
|
-
p +=
|
|
1230
|
+
const d = (a - p % a) % a;
|
|
1231
|
+
p += d;
|
|
1225
1232
|
}
|
|
1226
1233
|
for (; p <= i && c.length < 1e3; )
|
|
1227
1234
|
c.push(p), p += a;
|
|
@@ -1317,7 +1324,7 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 *
|
|
|
1317
1324
|
}, Ct = (e, t) => {
|
|
1318
1325
|
const n = new Date(e);
|
|
1319
1326
|
return n.setUTCDate(n.getUTCDate() + t), n.getTime();
|
|
1320
|
-
},
|
|
1327
|
+
}, ke = (e, t) => {
|
|
1321
1328
|
const n = new Date(e);
|
|
1322
1329
|
return n.setUTCMonth(n.getUTCMonth() + t), n.getTime();
|
|
1323
1330
|
}, Y = (e, t) => {
|
|
@@ -1334,9 +1341,9 @@ const pt = 1, Oe = 1e3 * pt, be = 60 * Oe, ie = 60 * be, ce = 24 * ie, yt = 30 *
|
|
|
1334
1341
|
case "days":
|
|
1335
1342
|
return Ct(e, n);
|
|
1336
1343
|
case "months":
|
|
1337
|
-
return
|
|
1344
|
+
return ke(e, n);
|
|
1338
1345
|
case "years":
|
|
1339
|
-
return
|
|
1346
|
+
return ke(e, n * 12);
|
|
1340
1347
|
}
|
|
1341
1348
|
};
|
|
1342
1349
|
function oe(e, t) {
|
|
@@ -1384,28 +1391,34 @@ const St = (e, t, n = "UTC") => {
|
|
|
1384
1391
|
}
|
|
1385
1392
|
return r.getTime();
|
|
1386
1393
|
}, jt = ({
|
|
1387
|
-
timeZone: e =
|
|
1388
|
-
space: t =
|
|
1394
|
+
timeZone: e = Fe,
|
|
1395
|
+
space: t = Xe,
|
|
1389
1396
|
formatter: n,
|
|
1390
1397
|
locale: s,
|
|
1391
1398
|
showTimezone: o
|
|
1392
1399
|
} = {}) => (r, i) => {
|
|
1393
|
-
const { min: c, max: l } = r
|
|
1400
|
+
const { min: c, max: l } = r;
|
|
1401
|
+
if (!Number.isFinite(c) || !Number.isFinite(l))
|
|
1402
|
+
return [];
|
|
1403
|
+
const u = Math.floor(i.chartAreaCanvasPX.width / t) + 1, m = (l - c) / u, [a, p] = vt.find(
|
|
1394
1404
|
(w) => se(w) >= m
|
|
1395
|
-
) ?? [1, "milliseconds"]
|
|
1405
|
+
) ?? [1, "milliseconds"];
|
|
1406
|
+
if (!a || !p)
|
|
1407
|
+
return [];
|
|
1408
|
+
const d = St(c, [a, p], e), y = oe(d, e), h = [d];
|
|
1396
1409
|
let g;
|
|
1397
|
-
for (; ; ) {
|
|
1410
|
+
for (; !(h.length > 1e3); ) {
|
|
1398
1411
|
switch (p) {
|
|
1399
1412
|
case "milliseconds":
|
|
1400
1413
|
case "seconds":
|
|
1401
1414
|
case "minutes":
|
|
1402
1415
|
case "hours": {
|
|
1403
|
-
g = Y(
|
|
1416
|
+
g = Y(d, [h.length * a, p]);
|
|
1404
1417
|
break;
|
|
1405
1418
|
}
|
|
1406
1419
|
case "days": {
|
|
1407
|
-
const w = Y(
|
|
1408
|
-
|
|
1420
|
+
const w = Y(d, [
|
|
1421
|
+
h.length * a,
|
|
1409
1422
|
p
|
|
1410
1423
|
]);
|
|
1411
1424
|
g = Y(w, [
|
|
@@ -1417,8 +1430,8 @@ const St = (e, t, n = "UTC") => {
|
|
|
1417
1430
|
case "months":
|
|
1418
1431
|
case "years": {
|
|
1419
1432
|
const w = Y(
|
|
1420
|
-
Y(Y(
|
|
1421
|
-
|
|
1433
|
+
Y(Y(d, [y, "hours"]), [
|
|
1434
|
+
h.length * a,
|
|
1422
1435
|
p
|
|
1423
1436
|
]),
|
|
1424
1437
|
[-y, "hours"]
|
|
@@ -1432,15 +1445,15 @@ const St = (e, t, n = "UTC") => {
|
|
|
1432
1445
|
}
|
|
1433
1446
|
if (g > l)
|
|
1434
1447
|
break;
|
|
1435
|
-
|
|
1448
|
+
h.push(g);
|
|
1436
1449
|
}
|
|
1437
1450
|
return (n ?? Pt({
|
|
1438
1451
|
locale: s,
|
|
1439
1452
|
showTimezone: o,
|
|
1440
1453
|
timeZone: e
|
|
1441
|
-
}))(
|
|
1454
|
+
}))(h);
|
|
1442
1455
|
}, K = (e, t, n) => e.find((s) => s.type === n)?.value !== t.find((s) => s.type === n)?.value, Pt = ({
|
|
1443
|
-
timeZone: e =
|
|
1456
|
+
timeZone: e = Fe,
|
|
1444
1457
|
locale: t = ft,
|
|
1445
1458
|
showTimezone: n = !0
|
|
1446
1459
|
}) => {
|
|
@@ -1459,24 +1472,24 @@ const St = (e, t, n = "UTC") => {
|
|
|
1459
1472
|
return (o) => {
|
|
1460
1473
|
const r = o[1] - o[0], i = r < se([1, "days"]), c = r < se([1, "minutes"]), l = r < se([1, "seconds"]);
|
|
1461
1474
|
return o.map((u) => ({ value: u, label: s.formatToParts(new Date(u)) })).map((u, f, m) => {
|
|
1462
|
-
const a = m[f - 1], p = f === 0 || K(u.label, a.label, "year"),
|
|
1463
|
-
if (i && (
|
|
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)) {
|
|
1464
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;
|
|
1465
1478
|
let S = "";
|
|
1466
1479
|
if (c) {
|
|
1467
|
-
const P = u.label.find((z) => z.type === "second")?.value,
|
|
1480
|
+
const P = u.label.find((z) => z.type === "second")?.value, k = u.label.find(
|
|
1468
1481
|
(z) => z.type === "fractionalSecond"
|
|
1469
1482
|
)?.value;
|
|
1470
|
-
S = `:${P}` + (l ? `.${
|
|
1483
|
+
S = `:${P}` + (l ? `.${k}` : "");
|
|
1471
1484
|
}
|
|
1472
1485
|
v.push(
|
|
1473
1486
|
`${T}:${C}${S}` + (n && g ? ` ${E}` : "")
|
|
1474
1487
|
);
|
|
1475
1488
|
}
|
|
1476
|
-
return (
|
|
1489
|
+
return (d || y) && v.push(
|
|
1477
1490
|
[
|
|
1478
1491
|
u.label.find((T) => T.type === "month")?.value,
|
|
1479
|
-
|
|
1492
|
+
d && u.label.find((T) => T.type === "day")?.value
|
|
1480
1493
|
].filter(Boolean).join(" ")
|
|
1481
1494
|
), p && v.push(u.label.find((T) => T.type === "year")?.value), {
|
|
1482
1495
|
value: u.value,
|
|
@@ -1490,23 +1503,23 @@ export {
|
|
|
1490
1503
|
_t as AreaPlot,
|
|
1491
1504
|
Nt as AxisOverlay,
|
|
1492
1505
|
Ut as BarPlot,
|
|
1493
|
-
|
|
1506
|
+
Ie as CANPLOT_LAYER,
|
|
1494
1507
|
Dt as CanPlot,
|
|
1495
1508
|
Kt as ChartAreaInteractions,
|
|
1496
1509
|
Bt as Crosshair,
|
|
1497
|
-
|
|
1510
|
+
Le as FrameDrawer,
|
|
1498
1511
|
It as LinePlot,
|
|
1499
1512
|
Lt as ScatterPlot,
|
|
1500
1513
|
zt as SelectBox,
|
|
1501
1514
|
Xt as SparklinePlot,
|
|
1502
1515
|
Yt as TooltipsX,
|
|
1503
|
-
|
|
1504
|
-
|
|
1516
|
+
Ft as XTicks,
|
|
1517
|
+
Ot as YTicks,
|
|
1505
1518
|
U as applyStyles,
|
|
1506
1519
|
re as clamp,
|
|
1507
1520
|
V as clampXPosToChartArea,
|
|
1508
1521
|
H as clampYPosToChartArea,
|
|
1509
|
-
|
|
1522
|
+
F as deepEqual,
|
|
1510
1523
|
mt as defaultNumericalTicksFormatter,
|
|
1511
1524
|
Rt as findClosestIndex,
|
|
1512
1525
|
X as getScale,
|
|
@@ -1515,9 +1528,9 @@ export {
|
|
|
1515
1528
|
jt as makeTimeTicks,
|
|
1516
1529
|
_ as posToVal,
|
|
1517
1530
|
We as pxToValDistance,
|
|
1518
|
-
|
|
1531
|
+
At as sum,
|
|
1519
1532
|
j as useDrawEffect,
|
|
1520
|
-
|
|
1533
|
+
Ue as useFrameState,
|
|
1521
1534
|
xe as useInteractionsEvent,
|
|
1522
1535
|
fe as valFits,
|
|
1523
1536
|
G as valToPos,
|