@wick-charts/vue 0.6.3 → 0.7.0

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.
Files changed (67) hide show
  1. package/README.md +6 -6
  2. package/dist/BandSeries.vue.js +52 -0
  3. package/dist/BandSeries.vue2.js +4 -0
  4. package/dist/BarSeries.vue.js +15 -13
  5. package/dist/CandlestickSeries.vue.js +31 -29
  6. package/dist/ChartContainer.vue.js +75 -68
  7. package/dist/LineSeries.vue.js +19 -17
  8. package/dist/composables.js +46 -36
  9. package/dist/core/dist/animation/config.js +92 -75
  10. package/dist/core/dist/animation/viewport-engine.js +155 -96
  11. package/dist/core/dist/axis/dom-labels.js +56 -51
  12. package/dist/core/dist/chart/badge-animator.js +30 -22
  13. package/dist/core/dist/chart/edge-indicators.js +22 -21
  14. package/dist/core/dist/chart/last-value.js +33 -26
  15. package/dist/core/dist/chart/scale-guards.js +23 -5
  16. package/dist/core/dist/chart/x-guards.js +37 -0
  17. package/dist/core/dist/chart.js +1286 -842
  18. package/dist/core/dist/data/decimation.js +58 -39
  19. package/dist/core/dist/data/sync.js +37 -31
  20. package/dist/core/dist/navigator/controller.js +41 -41
  21. package/dist/core/dist/perf/perf-hud.js +3 -3
  22. package/dist/core/dist/scales/tick-tracker.js +2 -2
  23. package/dist/core/dist/scales/x-scale.js +167 -53
  24. package/dist/core/dist/scales/y-scale.js +36 -34
  25. package/dist/core/dist/series/band.js +723 -0
  26. package/dist/core/dist/series/bar.js +297 -291
  27. package/dist/core/dist/series/base-multi-layer.js +283 -237
  28. package/dist/core/dist/series/candlestick.js +32 -31
  29. package/dist/core/dist/series/heatmap.js +5 -5
  30. package/dist/core/dist/series/line-intro.js +47 -37
  31. package/dist/core/dist/series/line.js +489 -448
  32. package/dist/core/dist/series/painters/builtins.js +4 -4
  33. package/dist/core/dist/series/painters/canvas-path.js +64 -52
  34. package/dist/core/dist/series/register-builtins.js +9 -8
  35. package/dist/core/dist/snapshots.js +59 -46
  36. package/dist/core/dist/utils/point.js +10 -0
  37. package/dist/index.d.ts +552 -129
  38. package/dist/index.js +195 -191
  39. package/dist/ui/Crosshair.vue.js +51 -27
  40. package/dist/ui/InfoBar.vue.js +98 -79
  41. package/dist/ui/Marker.vue.js +14 -11
  42. package/dist/ui/Navigator.vue.js +23 -23
  43. package/dist/ui/ReferenceLine.vue.js +19 -16
  44. package/dist/ui/Tooltip.vue.js +116 -84
  45. package/dist/ui/XAxis.vue.js +48 -0
  46. package/dist/ui/XAxis.vue2.js +4 -0
  47. package/dist/ui/YAxis.vue.js +44 -28
  48. package/dist/ui/YLabel.vue.js +82 -85
  49. package/package.json +2 -2
  50. package/src/BandSeries.vue +92 -0
  51. package/src/BarSeries.vue +13 -6
  52. package/src/CandlestickSeries.vue +9 -5
  53. package/src/ChartContainer.vue +20 -0
  54. package/src/LineSeries.vue +13 -6
  55. package/src/composables.ts +23 -4
  56. package/src/index.ts +16 -1
  57. package/src/ui/Crosshair.vue +41 -1
  58. package/src/ui/InfoBar.vue +22 -2
  59. package/src/ui/Marker.vue +5 -1
  60. package/src/ui/Navigator.vue +2 -1
  61. package/src/ui/ReferenceLine.vue +5 -1
  62. package/src/ui/Tooltip.vue +43 -6
  63. package/src/ui/{TimeAxis.vue → XAxis.vue} +18 -5
  64. package/src/ui/YAxis.vue +66 -12
  65. package/src/ui/YLabel.vue +37 -18
  66. package/dist/ui/TimeAxis.vue.js +0 -44
  67. package/dist/ui/TimeAxis.vue2.js +0 -4
@@ -1,54 +1,73 @@
1
- function D(t, o) {
2
- return t.length <= o ? t : x(
1
+ function D(t, h) {
2
+ return t.length <= h ? t : v(
3
3
  t,
4
- o,
4
+ h,
5
5
  (l) => l.time,
6
6
  (l) => l.value
7
7
  );
8
8
  }
9
- function L(t, o) {
10
- if (t.length <= o) return t;
11
- const l = Math.ceil(t.length / o), c = [];
12
- for (let h = 0; h < t.length; h += l) {
13
- const s = Math.min(h + l, t.length);
14
- let r = -1 / 0, a = 1 / 0, f = 0;
15
- for (let n = h; n < s; n++)
16
- t[n].high > r && (r = t[n].high), t[n].low < a && (a = t[n].low), f += t[n].volume ?? 0;
17
- c.push({
18
- time: t[h].time,
19
- open: t[h].open,
20
- high: r,
21
- low: a,
22
- close: t[s - 1].close,
23
- volume: f
9
+ function k(t, h) {
10
+ if (t.length <= h) return t;
11
+ const l = Math.ceil(t.length / h), u = [];
12
+ for (let o = 0; o < t.length; o += l) {
13
+ const n = Math.min(o + l, t.length);
14
+ let s = -1 / 0, i = 1 / 0, c = 0;
15
+ for (let r = o; r < n; r++)
16
+ t[r].high > s && (s = t[r].high), t[r].low < i && (i = t[r].low), c += t[r].volume ?? 0;
17
+ u.push({
18
+ time: t[o].time,
19
+ open: t[o].open,
20
+ high: s,
21
+ low: i,
22
+ close: t[n - 1].close,
23
+ volume: c
24
24
  });
25
25
  }
26
- return c;
26
+ return u;
27
27
  }
28
- function x(t, o, l, c) {
29
- if (o >= t.length || o < 3) return t;
30
- const h = [t[0]], s = (t.length - 2) / (o - 2);
31
- let r = 0;
32
- for (let a = 0; a < o - 2; a++) {
33
- const f = Math.floor((a + 1) * s) + 1, n = Math.min(Math.floor((a + 2) * s) + 1, t.length - 1);
34
- let u = 0, g = 0;
35
- const M = n, p = Math.min(Math.floor((a + 3) * s) + 1, t.length), e = p - M;
36
- if (e > 0) {
37
- for (let i = M; i < p; i++)
38
- u += l(t[i]), g += c(t[i]);
39
- u /= e, g /= e;
28
+ function x(t, h) {
29
+ if (t.length <= h || h < 3) return t;
30
+ const l = t.length - 1, u = Math.ceil((t.length - 2) / (h - 2)), o = [t[0]];
31
+ for (let n = 1; n < l; n += u) {
32
+ const s = Math.min(n + u, l);
33
+ let i = 1 / 0, c = -1 / 0, r = !1;
34
+ for (let f = n; f < s; f++) {
35
+ const a = t[f];
36
+ if (!Number.isFinite(a.low) || !Number.isFinite(a.high)) {
37
+ r = !0;
38
+ break;
39
+ }
40
+ a.low < i && (i = a.low), a.high > c && (c = a.high);
40
41
  }
41
- let v = -1, m = f;
42
- const w = l(t[r]), b = c(t[r]);
43
- for (let i = f; i < n; i++) {
44
- const d = Math.abs((w - u) * (c(t[i]) - b) - (w - l(t[i])) * (g - b));
45
- d > v && (v = d, m = i);
42
+ o.push(r ? { time: t[n].time, low: Number.NaN, high: Number.NaN } : { time: t[n].time, low: i, high: c });
43
+ }
44
+ return o.push(t[l]), o;
45
+ }
46
+ function v(t, h, l, u) {
47
+ if (h >= t.length || h < 3) return t;
48
+ const o = [t[0]], n = (t.length - 2) / (h - 2);
49
+ let s = 0;
50
+ for (let i = 0; i < h - 2; i++) {
51
+ const c = Math.floor((i + 1) * n) + 1, r = Math.min(Math.floor((i + 2) * n) + 1, t.length - 1);
52
+ let f = 0, a = 0;
53
+ const M = r, p = Math.min(Math.floor((i + 3) * n) + 1, t.length), g = p - M;
54
+ if (g > 0) {
55
+ for (let e = M; e < p; e++)
56
+ f += l(t[e]), a += u(t[e]);
57
+ f /= g, a /= g;
58
+ }
59
+ let w = -1, m = c;
60
+ const N = l(t[s]), b = u(t[s]);
61
+ for (let e = c; e < r; e++) {
62
+ const d = Math.abs((N - f) * (u(t[e]) - b) - (N - l(t[e])) * (a - b));
63
+ d > w && (w = d, m = e);
46
64
  }
47
- h.push(t[m]), r = m;
65
+ o.push(t[m]), s = m;
48
66
  }
49
- return h.push(t[t.length - 1]), h;
67
+ return o.push(t[t.length - 1]), o;
50
68
  }
51
69
  export {
70
+ x as decimateBandData,
52
71
  D as decimateLineData,
53
- L as decimateOHLCData
72
+ k as decimateOHLCData
54
73
  };
@@ -1,69 +1,75 @@
1
- import { normalizeTime as s } from "../utils/time.js";
2
- const g = { len: 0, firstTime: null, lastTime: null, data: null }, d = 20;
3
- function c(t, a) {
4
- if (s(t.time) !== s(a.time)) return !1;
1
+ import { normalizeTime as y } from "../utils/time.js";
2
+ function i(t) {
3
+ return "x" in t ? t.x : y(t.time);
4
+ }
5
+ const m = { len: 0, firstTime: null, lastTime: null, data: null }, p = 20;
6
+ function g(t, a) {
7
+ if (i(t) !== i(a)) return !1;
5
8
  const r = Object.keys(t), e = Object.keys(a);
6
9
  return r.length !== e.length ? !1 : r.every((n) => n === "time" || t[n] === a[n]);
7
10
  }
8
- function y(t, a) {
11
+ function c(t, a) {
9
12
  if (!t || t.length !== a.length || t === a) return !1;
10
13
  for (let r = 0; r < a.length - 1; r++)
11
- if (t[r] !== a[r] && !c(t[r], a[r]))
14
+ if (t[r] !== a[r] && !g(t[r], a[r]))
12
15
  return !1;
13
16
  return !0;
14
17
  }
15
- function p(t, a, r) {
18
+ function T(t, a, r) {
16
19
  if (!t || t.length === 0 || r <= 0 || t.length !== a.length - r) return !1;
17
20
  for (let e = 1; e < r; e++)
18
- if (s(a[e - 1].time) >= s(a[e].time)) return !1;
19
- if (s(a[r - 1].time) >= s(t[0].time)) return !1;
21
+ if (i(a[e - 1]) >= i(a[e])) return !1;
22
+ if (i(a[r - 1]) >= i(t[0])) return !1;
20
23
  for (let e = 0; e < t.length; e++)
21
- if (!c(t[e], a[r + e])) return !1;
24
+ if (!g(t[e], a[r + e])) return !1;
22
25
  return !0;
23
26
  }
24
- function T(t) {
27
+ function A(t) {
25
28
  return typeof t == "object" && t !== null && !Array.isArray(t) && Array.isArray(t.data);
26
29
  }
27
- function A(t) {
30
+ function b(t) {
28
31
  if (!Array.isArray(t)) return [t];
29
32
  if (t.length === 0) return [{ data: [] }];
30
33
  const a = t[0];
31
- return Array.isArray(a) || T(a) ? t.map((r) => Array.isArray(r) ? { data: r } : r) : [{ data: t }];
34
+ return Array.isArray(a) || A(a) ? t.map((r) => Array.isArray(r) ? { data: r } : r) : [{ data: t }];
32
35
  }
33
- function D(t) {
34
- const { chart: a, id: r } = t, e = A(t.data), n = e.length > 1 ? e.map((l, f) => l.label ?? `Series ${f + 1}`) : [e[0].label];
36
+ function L(t) {
37
+ const { chart: a, id: r } = t, e = b(t.data), n = e.length > 1 ? e.map((l, f) => l.label ?? `Series ${f + 1}`) : [e[0].label];
35
38
  a.setSeriesLabels(r, n), a.setLayerColors(
36
39
  r,
37
40
  e.map((l) => l.color)
38
41
  );
39
- const i = [];
42
+ const s = [];
40
43
  return a.batch(() => {
41
44
  for (let l = 0; l < e.length; l++)
42
- i[l] = b({
45
+ s[l] = S({
43
46
  chart: a,
44
47
  id: r,
45
48
  data: e[l].data,
46
- prev: t.prev[l] ?? g,
49
+ prev: t.prev[l] ?? m,
47
50
  layerIndex: l
48
51
  });
49
- }), i;
52
+ }), s;
50
53
  }
51
- function b(t) {
52
- const { chart: a, id: r, data: e, prev: n, layerIndex: i } = t;
54
+ function S(t) {
55
+ const { chart: a, id: r, data: e, prev: n, layerIndex: s } = t;
53
56
  if (e.length === 0)
54
- return a.setSeriesData(r, [], i), { len: 0, firstTime: null, lastTime: null, data: [] };
57
+ return a.setSeriesData(r, [], s), { len: 0, firstTime: null, lastTime: null, data: [] };
55
58
  if (n.data === e && n.len === e.length) return n;
56
- const l = s(e[0].time), f = s(e[e.length - 1].time), h = n.firstTime !== null && n.firstTime !== l, u = e.length - n.len, m = n.lastTime !== null && n.lastTime !== f;
57
- return h && u === 0 && m ? a.batch(() => {
58
- a.appendData(r, e[e.length - 1], i), a.keepLast(r, e.length, i);
59
- }) : p(n.data, e, u) ? a.prependData(r, e.slice(0, u), i) : n.len === 0 || e.length < n.len || u > d || h ? a.setSeriesData(r, e, i) : e.length === n.len ? y(n.data, e) ? a.updateData(r, e[e.length - 1], i) : a.setSeriesData(r, e, i) : a.batch(() => {
59
+ const l = i(e[0]), f = i(e[e.length - 1]);
60
+ if (typeof l == "string")
61
+ return e.length === n.len && c(n.data, e) ? a.updateData(r, e[e.length - 1], s) : a.setSeriesData(r, e, s), { len: e.length, firstTime: l, lastTime: f, data: e };
62
+ const h = n.firstTime !== null && n.firstTime !== l, u = e.length - n.len, d = n.lastTime !== null && n.lastTime !== f;
63
+ return h && u === 0 && d ? a.batch(() => {
64
+ a.appendData(r, e[e.length - 1], s), a.keepLast(r, e.length, s);
65
+ }) : T(n.data, e, u) ? a.prependData(r, e.slice(0, u), s) : n.len === 0 || e.length < n.len || u > p || h ? a.setSeriesData(r, e, s) : e.length === n.len ? c(n.data, e) ? a.updateData(r, e[e.length - 1], s) : a.setSeriesData(r, e, s) : a.batch(() => {
60
66
  for (let o = n.len; o < e.length; o++)
61
- a.appendData(r, e[o], i);
67
+ a.appendData(r, e[o], s);
62
68
  }), { len: e.length, firstTime: l, lastTime: f, data: e };
63
69
  }
64
70
  export {
65
- g as EMPTY_SYNC_STATE,
66
- D as syncLayers,
67
- b as syncSeriesLayer,
68
- A as toLayers
71
+ m as EMPTY_SYNC_STATE,
72
+ L as syncLayers,
73
+ S as syncSeriesLayer,
74
+ b as toLayers
69
75
  };
@@ -1,9 +1,9 @@
1
1
  import { DEFAULT_LINE_ENTRY as w } from "../animation/config.js";
2
2
  import { XScale as T } from "../scales/x-scale.js";
3
- import { YScale as R } from "../scales/y-scale.js";
4
- import { decimateCandles as k, decimateLinear as C } from "./decimate.js";
3
+ import { YScale as k } from "../scales/y-scale.js";
4
+ import { decimateCandles as C, decimateLinear as R } from "./decimate.js";
5
5
  import { hitTest as b, computeSnapCenter as E, computePan as I, computeResize as $ } from "./interactions.js";
6
- import { computeWindowGeometry as M, renderBackground as L, renderMiniCandlestick as V, renderMiniBar as N, renderMiniLine as P } from "./render.js";
6
+ import { computeWindowGeometry as M, renderBackground as L, renderMiniCandlestick as N, renderMiniBar as V, renderMiniLine as P } from "./render.js";
7
7
  import { Animator as S } from "../animation/animator.js";
8
8
  import { easeOutCubic as z } from "../animation/easing.js";
9
9
  class G {
@@ -12,7 +12,7 @@ class G {
12
12
  #z;
13
13
  #e;
14
14
  #n;
15
- #d;
15
+ #u;
16
16
  #r;
17
17
  #l;
18
18
  #a;
@@ -21,9 +21,9 @@ class G {
21
21
  #v;
22
22
  // Own scales — both cover the full data span. The main chart's scales move
23
23
  // with the viewport; these don't.
24
- #u = new T();
25
- #F = new R();
26
- #A = 0;
24
+ #d = new T();
25
+ #A = new k();
26
+ #F = 0;
27
27
  #m = 0;
28
28
  #h = 1;
29
29
  #p = null;
@@ -35,7 +35,7 @@ class G {
35
35
  * `setData` (guards in-place mutation of a re-passed array); a buckets
36
36
  * mismatch (resize) recomputes per entry.
37
37
  */
38
- #R = /* @__PURE__ */ new Map();
38
+ #k = /* @__PURE__ */ new Map();
39
39
  /**
40
40
  * Eases the alpha of the trailing bar/candle/line-segment from 0 → 1 over
41
41
  * `DEFAULT_LINE_ENTRY` whenever {@link setData} reports a new last point
@@ -48,11 +48,11 @@ class G {
48
48
  #o = null;
49
49
  /** `time` of the last point we've ever seen — initialises after the first
50
50
  * `setData`/render so the first paint doesn't trigger a fade-in. */
51
- #k = null;
51
+ #C = null;
52
52
  /** Series index in `lineSeriesList(data)` that owns the newest last-time,
53
53
  * so the tail fade applies to the series that actually grew — not always
54
54
  * the last entry in the stack. -1 for candlestick (single-series). */
55
- #C = -1;
55
+ #R = -1;
56
56
  #E;
57
57
  // Active-drag state — null when idle.
58
58
  #g = null;
@@ -61,22 +61,22 @@ class G {
61
61
  #$;
62
62
  #M;
63
63
  #L;
64
- #V;
65
- #y;
66
64
  #N;
65
+ #y;
66
+ #V;
67
67
  constructor(t) {
68
68
  this.#s = t.container, this.#e = t.chart, this.#x = t.data, this.#v = t.options ?? {}, window.getComputedStyle(this.#s).position === "static" && (this.#s.style.position = "relative"), this.#t = document.createElement("canvas"), this.#t.style.position = "absolute", this.#t.style.left = "0", this.#t.style.top = "0", this.#t.style.height = "100%", this.#t.style.touchAction = "none", this.#s.appendChild(this.#t);
69
69
  const e = this.#t.getContext("2d", { alpha: !0 });
70
70
  if (!e) throw new Error("NavigatorController: failed to acquire 2D context");
71
- this.#z = e, this.#n = document.createElement("div"), this.#n.dataset.chartNavigatorOverlay = "", this.#n.style.cssText = "position:absolute;left:0;top:0;height:100%;pointer-events:none;", this.#d = document.createElement("div"), this.#d.style.cssText = "position:absolute;left:0;top:0;bottom:0;", this.#r = document.createElement("div"), this.#r.style.cssText = "position:absolute;top:0;bottom:0;", this.#l = document.createElement("div"), this.#l.style.cssText = "position:absolute;top:0;bottom:0;box-sizing:border-box;", this.#a = y(), this.#c = y(), this.#n.append(this.#d, this.#r, this.#l, this.#a, this.#c), this.#s.appendChild(this.#n), this.#I = () => this.#B(), this.#$ = () => this.#f(), this.#M = () => this.#B(), this.#e.on("viewportChange", this.#I), this.#e.on("overlayChange", this.#$), this.#e.on("tickFrame", this.#M), this.#L = (s) => this.#U(s), this.#V = (s) => this.#J(s), this.#y = (s) => this.#K(s), this.#N = () => {
71
+ this.#z = e, this.#n = document.createElement("div"), this.#n.dataset.chartNavigatorOverlay = "", this.#n.style.cssText = "position:absolute;left:0;top:0;height:100%;pointer-events:none;", this.#u = document.createElement("div"), this.#u.style.cssText = "position:absolute;left:0;top:0;bottom:0;", this.#r = document.createElement("div"), this.#r.style.cssText = "position:absolute;top:0;bottom:0;", this.#l = document.createElement("div"), this.#l.style.cssText = "position:absolute;top:0;bottom:0;box-sizing:border-box;", this.#a = y(), this.#c = y(), this.#n.append(this.#u, this.#r, this.#l, this.#a, this.#c), this.#s.appendChild(this.#n), this.#I = () => this.#B(), this.#$ = () => this.#f(), this.#M = () => this.#B(), this.#e.on("viewportChange", this.#I), this.#e.on("overlayChange", this.#$), this.#e.on("tickFrame", this.#M), this.#L = (s) => this.#U(s), this.#N = (s) => this.#J(s), this.#y = (s) => this.#K(s), this.#V = () => {
72
72
  this.#g === null && (this.#t.style.cursor = "default");
73
- }, this.#t.addEventListener("pointerdown", this.#L), this.#t.addEventListener("pointermove", this.#V), this.#t.addEventListener("pointerup", this.#y), this.#t.addEventListener("pointercancel", this.#y), this.#t.addEventListener("pointerleave", this.#N), this.#E = new ResizeObserver((s) => this.#j(s[0])), this.#E.observe(this.#s), this.#D();
73
+ }, this.#t.addEventListener("pointerdown", this.#L), this.#t.addEventListener("pointermove", this.#N), this.#t.addEventListener("pointerup", this.#y), this.#t.addEventListener("pointercancel", this.#y), this.#t.addEventListener("pointerleave", this.#V), this.#E = new ResizeObserver((s) => this.#j(s[0])), this.#E.observe(this.#s), this.#D();
74
74
  const i = this.#s.getBoundingClientRect();
75
75
  i.width > 0 && i.height > 0 && this.#W(i.width, i.height), this.#f();
76
76
  }
77
77
  setData(t) {
78
- const e = F(t), i = e?.time ?? null;
79
- if (i !== null && this.#k !== null && i !== this.#k) {
78
+ const e = A(t), i = e?.time ?? null;
79
+ if (i !== null && this.#C !== null && i !== this.#C) {
80
80
  const s = this.#o?.current ?? 0;
81
81
  this.#o = new S({
82
82
  initial: s,
@@ -85,7 +85,7 @@ class G {
85
85
  lerp: (n, h, l) => n + (h - n) * l
86
86
  }), this.#o.setTarget(1);
87
87
  }
88
- this.#k = i, this.#C = e?.seriesIndex ?? -1, this.#x = t, this.#R.clear(), this.#f();
88
+ this.#C = i, this.#R = e?.seriesIndex ?? -1, this.#x = t, this.#k.clear(), this.#f();
89
89
  }
90
90
  setOptions(t) {
91
91
  this.#v = t, this.#D(), this.#f();
@@ -100,7 +100,7 @@ class G {
100
100
  t !== void 0 && (this.#s.style.height = `${t}px`);
101
101
  }
102
102
  destroy() {
103
- this.#e.off("viewportChange", this.#I), this.#e.off("overlayChange", this.#$), this.#e.off("tickFrame", this.#M), this.#t.removeEventListener("pointerdown", this.#L), this.#t.removeEventListener("pointermove", this.#V), this.#t.removeEventListener("pointerup", this.#y), this.#t.removeEventListener("pointercancel", this.#y), this.#t.removeEventListener("pointerleave", this.#N), this.#E.disconnect(), this.#p !== null && (cancelAnimationFrame(this.#p), this.#p = null), this.#t.remove(), this.#n.remove();
103
+ this.#e.off("viewportChange", this.#I), this.#e.off("overlayChange", this.#$), this.#e.off("tickFrame", this.#M), this.#t.removeEventListener("pointerdown", this.#L), this.#t.removeEventListener("pointermove", this.#N), this.#t.removeEventListener("pointerup", this.#y), this.#t.removeEventListener("pointercancel", this.#y), this.#t.removeEventListener("pointerleave", this.#V), this.#E.disconnect(), this.#p !== null && (cancelAnimationFrame(this.#p), this.#p = null), this.#t.remove(), this.#n.remove();
104
104
  }
105
105
  /** CSS pixel height of the strip — theme default unless overridden. */
106
106
  get height() {
@@ -108,10 +108,10 @@ class G {
108
108
  }
109
109
  // --- internals ---------------------------------------------------------
110
110
  /** Effective drawing width — the navigator reserves the main chart's
111
- * `yAxisWidth` on the Y-axis side so its active zone lines up with the
112
- * plot area. */
111
+ * Y-axis columns so its active zone lines up with the plot area. */
113
112
  get #i() {
114
- return Math.max(0, this.#A - this.#e.yAxisWidth);
113
+ const t = this.#e.getAxisColumnWidth("left") + this.#e.getAxisColumnWidth("right");
114
+ return Math.max(0, this.#F - t);
115
115
  }
116
116
  #j(t) {
117
117
  if (!t) return;
@@ -119,7 +119,7 @@ class G {
119
119
  i <= 0 || s <= 0 || (this.#W(i, s), this.#f());
120
120
  }
121
121
  #W(t, e) {
122
- this.#A = t, this.#m = e, this.#h = window.devicePixelRatio || 1, this.#X();
122
+ this.#F = t, this.#m = e, this.#h = window.devicePixelRatio || 1, this.#X();
123
123
  }
124
124
  /**
125
125
  * Write canvas backing-store / CSS sizes only when they actually changed —
@@ -160,7 +160,7 @@ class G {
160
160
  * compute against primed scales even on the opening gesture. */
161
161
  #P() {
162
162
  const t = this.#b(), e = this.#Z();
163
- return this.#u.update(t, this.#i, this.#h), this.#F.update(e, this.#m, this.#h), { xRange: t, yRange: e };
163
+ return this.#d.update(t, this.#i, this.#h), this.#A.update(e, this.#m, this.#h), { xRange: t, yRange: e };
164
164
  }
165
165
  /**
166
166
  * X range for the brush window. While the user drags the brush we track the
@@ -172,7 +172,7 @@ class G {
172
172
  return this.#g !== null ? this.#e.getVisibleRange() : this.#e.getAnimationState().xRange;
173
173
  }
174
174
  #S() {
175
- return this.#P(), M(this.#u, this.#Y(), this.#b());
175
+ return this.#P(), M(this.#d, this.#Y(), this.#b());
176
176
  }
177
177
  #H() {
178
178
  const t = this.#b(), e = t.to - t.from;
@@ -186,7 +186,7 @@ class G {
186
186
  if (h === 0) return;
187
187
  let l = this.#e.getVisibleRange();
188
188
  if (n.snapToCenter) {
189
- const r = this.#u.xToTime(e), a = E({ time: r, startVisible: l, xRange: i });
189
+ const r = this.#d.xToTime(e), a = E({ time: r, startVisible: l, xRange: i });
190
190
  this.#e.setVisibleRange(a), l = a;
191
191
  }
192
192
  this.#g = {
@@ -243,8 +243,8 @@ class G {
243
243
  i.save(), i.clearRect(0, 0, s, n), i.scale(this.#h, this.#h);
244
244
  const h = {
245
245
  ctx: i,
246
- timeScale: this.#u,
247
- yScale: this.#F,
246
+ timeScale: this.#d,
247
+ yScale: this.#A,
248
248
  mediaWidth: this.#i,
249
249
  mediaHeight: this.#m,
250
250
  theme: t
@@ -254,12 +254,12 @@ class G {
254
254
  this.#o !== null && (this.#o.tick(performance.now()), l = this.#o.current, this.#o.animating ? this.#f() : this.#o = null);
255
255
  const r = Math.max(1, Math.round(this.#i)), a = this.#x;
256
256
  if (a.type === "candlestick")
257
- V(h, this.#q(a.points, r, k), l);
257
+ N(h, this.#q(a.points, r, C), l);
258
258
  else {
259
- const c = f(a), g = c.length === 1, d = this.#C >= 0 ? this.#C : c.length - 1;
260
- for (let u = 0; u < c.length; u++) {
261
- const p = this.#q(c[u], r, C), m = u === d ? l : 1;
262
- a.type === "bar" ? N(h, p, m) : P(h, p, g, m);
259
+ const c = f(a), g = c.length === 1, u = this.#R >= 0 ? this.#R : c.length - 1;
260
+ for (let d = 0; d < c.length; d++) {
261
+ const p = this.#q(c[d], r, R), m = d === u ? l : 1;
262
+ a.type === "bar" ? V(h, p, m) : P(h, p, g, m);
263
263
  }
264
264
  }
265
265
  i.restore(), this.#G(t, e);
@@ -283,20 +283,20 @@ class G {
283
283
  /** Decimate `points` into `buckets`, reusing the cached result while the
284
284
  * source array ref and bucket count are unchanged. */
285
285
  #q(t, e, i) {
286
- const s = this.#R.get(t);
286
+ const s = this.#k.get(t);
287
287
  if (s !== void 0 && s.buckets === e)
288
288
  return s.result;
289
289
  const n = i(t, e);
290
- return this.#R.set(t, { buckets: e, result: n }), n;
290
+ return this.#k.set(t, { buckets: e, result: n }), n;
291
291
  }
292
292
  #G(t, e) {
293
293
  if (e.to <= e.from) return;
294
- const i = this.#Y(), s = Math.max(e.from, Math.min(e.to, i.from)), n = Math.max(e.from, Math.min(e.to, i.to)), h = this.#u.timeToX(s), l = this.#u.timeToX(n), r = Math.min(h, l), a = Math.max(h, l), c = Math.max(1, a - r);
295
- this.#d.style.width = `${r}px`, this.#d.style.background = t.mask.fill, this.#d.style.display = r > 0 ? "block" : "none";
294
+ const i = this.#Y(), s = Math.max(e.from, Math.min(e.to, i.from)), n = Math.max(e.from, Math.min(e.to, i.to)), h = this.#d.timeToX(s), l = this.#d.timeToX(n), r = Math.min(h, l), a = Math.max(h, l), c = Math.max(1, a - r);
295
+ this.#u.style.width = `${r}px`, this.#u.style.background = t.mask.fill, this.#u.style.display = r > 0 ? "block" : "none";
296
296
  const g = Math.max(0, this.#i - (r + c));
297
297
  this.#r.style.left = `${r + c}px`, this.#r.style.width = `${g}px`, this.#r.style.background = t.mask.fill, this.#r.style.display = g > 0 ? "block" : "none", this.#l.style.left = `${r}px`, this.#l.style.width = `${c}px`, this.#l.style.background = t.window.fill, this.#l.style.border = t.window.borderWidth > 0 ? `${t.window.borderWidth}px solid ${t.window.border}` : "none";
298
- const d = t.handle.width, u = Math.max(1, d / 2), p = this.#e.getTheme().background;
299
- this.#a.style.left = `${r - d / 2}px`, this.#a.style.width = `${d}px`, this.#a.style.background = t.handle.color, this.#a.style.borderRadius = `${u}px`, this.#c.style.left = `${r + c - d / 2}px`, this.#c.style.width = `${d}px`, this.#c.style.background = t.handle.color, this.#c.style.borderRadius = `${u}px`;
298
+ const u = t.handle.width, d = Math.max(1, u / 2), p = this.#e.getTheme().background;
299
+ this.#a.style.left = `${r - u / 2}px`, this.#a.style.width = `${u}px`, this.#a.style.background = t.handle.color, this.#a.style.borderRadius = `${d}px`, this.#c.style.left = `${r + c - u / 2}px`, this.#c.style.width = `${u}px`, this.#c.style.background = t.handle.color, this.#c.style.borderRadius = `${d}px`;
300
300
  for (const m of this.#a.children)
301
301
  m.style.background = p;
302
302
  for (const m of this.#c.children)
@@ -339,7 +339,7 @@ class G {
339
339
  function f(o) {
340
340
  return "series" in o ? o.series : [o.points];
341
341
  }
342
- function F(o) {
342
+ function A(o) {
343
343
  if (o.type === "candlestick") {
344
344
  const s = o.points.length;
345
345
  return s === 0 ? null : { time: o.points[s - 1].time, seriesIndex: -1 };
@@ -358,9 +358,9 @@ function v(o, t) {
358
358
  return o === "resize-left" || o === "resize-right" ? "ew-resize" : t ? "grabbing" : "grab";
359
359
  }
360
360
  function x(o, t) {
361
- return v(A(o, t), !1);
361
+ return v(F(o, t), !1);
362
362
  }
363
- function A(o, t) {
363
+ function F(o, t) {
364
364
  return b(o, t).gesture;
365
365
  }
366
366
  function y() {
@@ -20,7 +20,7 @@ function I(i) {
20
20
  function O(i) {
21
21
  return -I(i) / 12;
22
22
  }
23
- const V = "#9aa6b6", c = "#5d6877", C = "#e8eef7", x = "#cdd6e2", y = "#3fd68f", B = "#f5c451", $ = "#f4756a", Y = "#5d6877", X = {
23
+ const B = "#9aa6b6", c = "#5d6877", C = "#e8eef7", x = "#cdd6e2", y = "#3fd68f", V = "#f5c451", $ = "#f4756a", Y = "#5d6877", X = {
24
24
  position: "absolute",
25
25
  top: "8px",
26
26
  right: "8px",
@@ -34,7 +34,7 @@ const V = "#9aa6b6", c = "#5d6877", C = "#e8eef7", x = "#cdd6e2", y = "#3fd68f",
34
34
  border: "1px solid rgba(255, 255, 255, 0.09)",
35
35
  borderRadius: "10px",
36
36
  boxShadow: "0 10px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05)",
37
- color: V,
37
+ color: B,
38
38
  font: "10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace",
39
39
  fontVariantNumeric: "tabular-nums",
40
40
  letterSpacing: "0.02em",
@@ -50,7 +50,7 @@ function G(i) {
50
50
  }`, i.head.appendChild(e);
51
51
  }
52
52
  function v(i) {
53
- return i <= H ? y : i <= F ? B : $;
53
+ return i <= H ? y : i <= F ? V : $;
54
54
  }
55
55
  function A(i) {
56
56
  return i >= 1e6 ? `${(i / 1e6).toFixed(1)}M` : i >= 1e4 ? `${(i / 1e3).toFixed(1)}k` : Math.round(i).toLocaleString("en-US");
@@ -8,7 +8,7 @@ function f(s, t) {
8
8
  if (s[e] !== t[e]) return !1;
9
9
  return !0;
10
10
  }
11
- let m = class {
11
+ class m {
12
12
  #e = [];
13
13
  #r = [];
14
14
  #t = /* @__PURE__ */ new Map();
@@ -104,7 +104,7 @@ let m = class {
104
104
  reset() {
105
105
  this.#e = [], this.#r = [], this.#t.clear(), this.#s = !1;
106
106
  }
107
- };
107
+ }
108
108
  export {
109
109
  m as AxisTickTracker
110
110
  };