@wick-charts/vue 0.6.3 → 0.6.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.
Files changed (35) hide show
  1. package/README.md +2 -2
  2. package/dist/BandSeries.vue.js +50 -0
  3. package/dist/BandSeries.vue2.js +4 -0
  4. package/dist/ChartContainer.vue.js +16 -16
  5. package/dist/LineSeries.vue.js +2 -2
  6. package/dist/core/dist/animation/config.js +92 -75
  7. package/dist/core/dist/chart/badge-animator.js +30 -22
  8. package/dist/core/dist/chart/edge-indicators.js +22 -21
  9. package/dist/core/dist/chart/last-value.js +33 -26
  10. package/dist/core/dist/chart.js +168 -167
  11. package/dist/core/dist/data/decimation.js +58 -39
  12. package/dist/core/dist/navigator/controller.js +10 -10
  13. package/dist/core/dist/perf/perf-hud.js +6 -6
  14. package/dist/core/dist/series/band.js +670 -0
  15. package/dist/core/dist/series/bar.js +14 -14
  16. package/dist/core/dist/series/candlestick.js +31 -31
  17. package/dist/core/dist/series/heatmap.js +5 -5
  18. package/dist/core/dist/series/line-intro.js +47 -37
  19. package/dist/core/dist/series/line.js +485 -445
  20. package/dist/core/dist/series/painters/builtins.js +4 -4
  21. package/dist/core/dist/series/painters/canvas-path.js +64 -52
  22. package/dist/core/dist/series/register-builtins.js +9 -8
  23. package/dist/core/dist/snapshots.js +36 -35
  24. package/dist/core/dist/utils/point.js +10 -0
  25. package/dist/index.d.ts +255 -97
  26. package/dist/index.js +195 -191
  27. package/dist/ui/InfoBar.vue.js +100 -81
  28. package/dist/ui/Tooltip.vue.js +118 -91
  29. package/dist/ui/YLabel.vue.js +62 -69
  30. package/package.json +2 -2
  31. package/src/BandSeries.vue +87 -0
  32. package/src/index.ts +8 -0
  33. package/src/ui/InfoBar.vue +20 -1
  34. package/src/ui/Tooltip.vue +36 -2
  35. package/src/ui/YLabel.vue +2 -13
package/README.md CHANGED
@@ -11,7 +11,7 @@ High-performance timeseries charts for **React**, **Vue**, and **Svelte**. Canva
11
11
 
12
12
  ## Features
13
13
 
14
- - **Candlestick, Line, Bar, Pie, Sparkline** — all from one package
14
+ - **Candlestick, Line, Bar, Band, Pie, Sparkline** — all from one package
15
15
  - **Real-time streaming** — append/update at 60fps with coordinated animations
16
16
  - **22 built-in themes** plus `createTheme()` for custom palettes
17
17
  - **Interactive** — zoom, pan, crosshair, tooltips
@@ -55,7 +55,7 @@ Every component, prop, type, and slot context lives in the docs site:
55
55
 
56
56
  [wick-charts.eeff.io/api/chart-container/](https://wick-charts.eeff.io/api/chart-container/)
57
57
 
58
- Start there for [ChartContainer](https://wick-charts.eeff.io/api/chart-container/), then drill into the series ([Candlestick](https://wick-charts.eeff.io/api/candlestick-series/), [Line](https://wick-charts.eeff.io/api/line-series/), [Bar](https://wick-charts.eeff.io/api/bar-series/), [Pie](https://wick-charts.eeff.io/api/pie-series/), [Sparkline](https://wick-charts.eeff.io/api/sparkline/)) and overlays ([Tooltip](https://wick-charts.eeff.io/api/tooltip/), [InfoBar](https://wick-charts.eeff.io/api/info-bar/), [Crosshair](https://wick-charts.eeff.io/api/crosshair/), [Legend](https://wick-charts.eeff.io/api/legend/), [YAxis](https://wick-charts.eeff.io/api/y-axis/), [XAxis](https://wick-charts.eeff.io/api/x-axis/), [Navigator](https://wick-charts.eeff.io/api/navigator/), …).
58
+ Start there for [ChartContainer](https://wick-charts.eeff.io/api/chart-container/), then drill into the series ([Candlestick](https://wick-charts.eeff.io/api/candlestick-series/), [Line](https://wick-charts.eeff.io/api/line-series/), [Bar](https://wick-charts.eeff.io/api/bar-series/), [Band](https://wick-charts.eeff.io/api/band-series/), [Pie](https://wick-charts.eeff.io/api/pie-series/), [Sparkline](https://wick-charts.eeff.io/api/sparkline/)) and overlays ([Tooltip](https://wick-charts.eeff.io/api/tooltip/), [InfoBar](https://wick-charts.eeff.io/api/info-bar/), [Crosshair](https://wick-charts.eeff.io/api/crosshair/), [Legend](https://wick-charts.eeff.io/api/legend/), [YAxis](https://wick-charts.eeff.io/api/y-axis/), [XAxis](https://wick-charts.eeff.io/api/x-axis/), [Navigator](https://wick-charts.eeff.io/api/navigator/), …).
59
59
 
60
60
  ## No framework? Use the engine directly
61
61
 
@@ -0,0 +1,50 @@
1
+ import { defineComponent as u, ref as d, onMounted as p, onUnmounted as c, watch as n, createCommentVNode as f } from "vue";
2
+ import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as y } from "./core/dist/data/sync.js";
3
+ import { BandSeriesDef as S } from "./core/dist/series/band.js";
4
+ import { useChartInstance as _ } from "./context.js";
5
+ const E = /* @__PURE__ */ u({
6
+ __name: "BandSeries",
7
+ props: {
8
+ data: {},
9
+ options: {},
10
+ id: {},
11
+ visible: { type: Boolean, default: !0 }
12
+ },
13
+ setup(l) {
14
+ const a = l, s = _(), r = d(null);
15
+ let i = [];
16
+ function o(e, t) {
17
+ i = y({ chart: s, id: e, data: t, prev: i });
18
+ }
19
+ return p(() => {
20
+ const e = m(a.data).length, t = s.addSeries(S, {
21
+ ...a.options,
22
+ layers: e,
23
+ id: a.id
24
+ });
25
+ r.value = t, i = new Array(e).fill(v), o(t, a.data), s.setSeriesVisible(t, a.visible);
26
+ }), c(() => {
27
+ r.value && s.removeSeries(r.value);
28
+ }), n(
29
+ () => a.data,
30
+ (e) => {
31
+ const t = r.value;
32
+ t && o(t, e);
33
+ }
34
+ ), n(
35
+ () => a.options,
36
+ (e) => {
37
+ r.value && e && s.updateSeriesOptions(r.value, e);
38
+ },
39
+ { deep: !0 }
40
+ ), n(
41
+ () => a.visible,
42
+ (e) => {
43
+ r.value && s.setSeriesVisible(r.value, e);
44
+ }
45
+ ), (e, t) => f("", !0);
46
+ }
47
+ });
48
+ export {
49
+ E as default
50
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./BandSeries.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,6 +1,6 @@
1
- import { defineComponent as U, ref as d, shallowRef as D, provide as l, watch as r, computed as v, onMounted as G, nextTick as g, onUnmounted as I, openBlock as y, createElementBlock as m, normalizeStyle as q, createElementVNode as o, createCommentVNode as w, renderSlot as J } from "vue";
2
- import { ChartInstance as F } from "./core/dist/chart.js";
3
- import { deepEqual as P } from "./core/dist/utils/deep-equal.js";
1
+ import { defineComponent as U, ref as d, shallowRef as F, provide as l, watch as r, computed as v, onMounted as G, nextTick as g, onUnmounted as I, openBlock as y, createElementBlock as m, normalizeStyle as q, createElementVNode as o, createCommentVNode as w, renderSlot as J } from "vue";
2
+ import { ChartInstance as P } from "./core/dist/chart.js";
3
+ import { deepEqual as T } from "./core/dist/utils/deep-equal.js";
4
4
  import { catppuccin as Q } from "./core/dist/theme/themes/catppuccin.js";
5
5
  import { ChartKey as W, ThemeKey as X, TitleAnchorKey as Y, InfoBarAnchorKey as Z, LegendAnchorKey as ee, LegendRightAnchorKey as te, NavigatorAnchorKey as ie } from "./context.js";
6
6
  const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-height": "0" } }, oe = { style: { display: "flex", "flex-direction": "column", flex: "1", "min-width": "0", "min-height": "0" } }, ne = {
@@ -35,7 +35,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
35
35
  onCrosshairMove: {}
36
36
  },
37
37
  setup(b) {
38
- const e = b, u = d(), a = D(null), x = D(e.theme), c = e.perf, h = e.onEdgeReached, C = d(null), R = d(null), k = d(null), _ = d(null), E = d(null), B = d(null);
38
+ const e = b, u = d(), a = F(null), x = F(e.theme), c = e.perf, h = e.onEdgeReached, C = d(null), R = d(null), k = d(null), _ = d(null), E = d(null), B = d(null);
39
39
  l(W, a), l(X, x), l(Y, R), l(Z, k), l(ee, _), l(te, E), l(ie, B);
40
40
  let f = null;
41
41
  const s = d(0);
@@ -44,12 +44,12 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
44
44
  ([t, i]) => t?.setHeaderHeight(i),
45
45
  { immediate: !0 }
46
46
  );
47
- const O = v(() => e.fade === !1 ? !1 : typeof e.fade == "object" ? e.fade.top !== void 0 || e.fade.overlap !== void 0 : e.fade === !0), S = v(() => {
48
- if (!O.value) return 0;
47
+ const L = v(() => e.fade === !1 ? !1 : typeof e.fade == "object" ? e.fade.top !== void 0 || e.fade.overlap !== void 0 : e.fade === !0), S = v(() => {
48
+ if (!L.value) return 0;
49
49
  const t = typeof e.fade == "object" ? e.fade.overlap : void 0;
50
50
  return t !== void 0 ? Math.max(0, t) : s.value / 2;
51
- }), L = v(() => {
52
- if (!O.value) return 0;
51
+ }), O = v(() => {
52
+ if (!L.value) return 0;
53
53
  if (typeof e.fade == "object" && e.fade.top !== void 0) return e.fade.top;
54
54
  const t = e.headerLayout === "overlay" ? s.value : 0;
55
55
  return t > 0 ? t + z : z;
@@ -76,7 +76,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
76
76
  a.value.setFade({ top: 0, right: 0, left: 0 });
77
77
  return;
78
78
  }
79
- const t = { top: L.value };
79
+ const t = { top: O.value };
80
80
  typeof e.fade == "object" && (e.fade.right !== void 0 && (t.right = e.fade.right), e.fade.left !== void 0 && (t.left = e.fade.left)), a.value.setFade(t);
81
81
  }
82
82
  function V() {
@@ -99,7 +99,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
99
99
  G(async () => {
100
100
  if (!u.value) return;
101
101
  const t = {};
102
- e.axis && (t.axis = e.axis), e.theme && (t.theme = e.theme), e.padding && (t.padding = e.padding), e.viewport && (t.viewport = e.viewport), e.interactive !== void 0 && (t.interactive = e.interactive), e.grid !== void 0 && (t.grid = e.grid), c !== void 0 && (t.perf = c), h && (t.onEdgeReached = h), e.animations !== void 0 && (t.animations = e.animations), M(t), a.value = new F(u.value, t), H(a.value), e.onReady?.(a.value), await g(), V();
102
+ e.axis && (t.axis = e.axis), e.theme && (t.theme = e.theme), e.padding && (t.padding = e.padding), e.viewport && (t.viewport = e.viewport), e.interactive !== void 0 && (t.interactive = e.interactive), e.grid !== void 0 && (t.grid = e.grid), c !== void 0 && (t.perf = c), h && (t.onEdgeReached = h), e.animations !== void 0 && (t.animations = e.animations), M(t), a.value = new P(u.value, t), H(a.value), e.onReady?.(a.value), await g(), V();
103
103
  }), I(() => {
104
104
  f?.disconnect(), f = null, a.value?.destroy(), a.value = null;
105
105
  }), r(
@@ -128,17 +128,17 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
128
128
  r(
129
129
  () => e.animations,
130
130
  async (t) => {
131
- if (P(t, K) || (K = t, !a.value || !u.value)) return;
131
+ if (T(t, K) || (K = t, !a.value || !u.value)) return;
132
132
  a.value.destroy(), a.value = null, await g();
133
133
  const i = {};
134
- e.axis && (i.axis = e.axis), e.theme && (i.theme = e.theme), e.padding && (i.padding = e.padding), e.viewport && (i.viewport = e.viewport), e.interactive !== void 0 && (i.interactive = e.interactive), e.grid !== void 0 && (i.grid = e.grid), c !== void 0 && (i.perf = c), h && (i.onEdgeReached = h), t !== void 0 && (i.animations = t), M(i), a.value = new F(u.value, i), H(a.value), e.onReady?.(a.value);
134
+ e.axis && (i.axis = e.axis), e.theme && (i.theme = e.theme), e.padding && (i.padding = e.padding), e.viewport && (i.viewport = e.viewport), e.interactive !== void 0 && (i.interactive = e.interactive), e.grid !== void 0 && (i.grid = e.grid), c !== void 0 && (i.perf = c), h && (i.onEdgeReached = h), t !== void 0 && (i.animations = t), M(i), a.value = new P(u.value, i), H(a.value), e.onReady?.(a.value);
135
135
  }
136
136
  );
137
137
  let p;
138
138
  r(
139
139
  () => [a.value, e.visibleRange],
140
140
  async ([t, i]) => {
141
- !t || i === void 0 || p !== void 0 && p.instance === t && P(p.spec, i) || (p = { instance: t, spec: i }, await g(), t.setVisibleRange(i));
141
+ !t || i === void 0 || p !== void 0 && p.instance === t && T(p.spec, i) || (p = { instance: t, spec: i }, await g(), t.setVisibleRange(i));
142
142
  },
143
143
  { immediate: !0 }
144
144
  ), r(
@@ -150,10 +150,10 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
150
150
  j.value
151
151
  ],
152
152
  A
153
- ), r(() => [a.value, L.value, e.fade], $, { immediate: !0 });
153
+ ), r(() => [a.value, O.value, e.fade], $, { immediate: !0 });
154
154
  const N = v(() => {
155
- const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"], T = t?.background ?? "transparent";
156
- return `position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 240px; overflow: hidden; background: ${e.gradient ? `linear-gradient(to bottom, ${i} 0%, ${T} 70%, ${n} 100%)` : T}`;
155
+ const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"], D = t?.background ?? "transparent";
156
+ return `position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 240px; overflow: hidden; background: ${e.gradient ? `linear-gradient(to bottom, ${i} 0%, ${D} 70%, ${n} 100%)` : D}`;
157
157
  });
158
158
  return (t, i) => (y(), m("div", {
159
159
  style: q(N.value)
@@ -2,7 +2,7 @@ import { defineComponent as u, ref as p, onMounted as d, onUnmounted as c, watch
2
2
  import { toLayers as m, EMPTY_SYNC_STATE as v, syncLayers as y } from "./core/dist/data/sync.js";
3
3
  import { LineSeriesDef as S } from "./core/dist/series/line.js";
4
4
  import { useChartInstance as _ } from "./context.js";
5
- const V = /* @__PURE__ */ u({
5
+ const E = /* @__PURE__ */ u({
6
6
  __name: "LineSeries",
7
7
  props: {
8
8
  data: {},
@@ -46,5 +46,5 @@ const V = /* @__PURE__ */ u({
46
46
  }
47
47
  });
48
48
  export {
49
- V as default
49
+ E as default
50
50
  };
@@ -1,26 +1,27 @@
1
1
  import { spring as U } from "./spring.js";
2
2
  import { resolveAnimationTime as r } from "./time.js";
3
3
  import { hermite as S } from "./y-range-hermite.js";
4
- import { snap as u } from "./y-range-snap.js";
5
- const E = 250, p = 250, h = 500, ss = 400, k = E, g = p, I = h, N = 600, R = E, v = p, Y = h, O = E, C = p, b = h, x = 600, P = 250, H = 600, K = 300, G = 200, B = 150, X = 250, _ = 2500, m = 500, $ = 100, w = 250, j = 250, V = 400, f = {
4
+ import { snap as y } from "./y-range-snap.js";
5
+ const E = 250, _ = 250, T = 500, rs = 400, k = E, N = _, g = T, I = 600, R = E, b = _, v = T, O = E, Y = _, C = T, x = E, H = _, P = T, B = 600, K = 250, G = 600, X = 300, $ = 200, w = 150, j = 250, A = 2500, f = 500, V = 100, q = 250, z = 250, J = 400, L = {
6
6
  line: { entryMs: 0, smoothMs: 0, pulseMs: 0, introMs: 0 },
7
7
  candlestick: { entryMs: 0, smoothMs: 0, introMs: 0 },
8
8
  bar: { entryMs: 0, smoothMs: 0, introMs: 0 },
9
+ band: { entryMs: 0, smoothMs: 0, introMs: 0 },
9
10
  pie: { entryMs: 0, updateMs: 0 },
10
11
  heatmap: { entryMs: 0, updateMs: 0 }
11
12
  };
12
- function q(i) {
13
- if (i !== null && typeof i == "object")
13
+ function Q(o) {
14
+ if (o !== null && typeof o == "object")
14
15
  return {
15
- stickyMs: r(i.max, _),
16
- stickyFloorMs: r(i.min, m)
16
+ stickyMs: r(o.max, A),
17
+ stickyFloorMs: r(o.min, f)
17
18
  };
18
- if (i === void 0)
19
- return { stickyMs: _, stickyFloorMs: m };
20
- const e = r(i, _);
19
+ if (o === void 0)
20
+ return { stickyMs: A, stickyFloorMs: f };
21
+ const e = r(o, A);
21
22
  return { stickyMs: e, stickyFloorMs: e };
22
23
  }
23
- class y {
24
+ class p {
24
25
  axis;
25
26
  toggleMs;
26
27
  series;
@@ -35,37 +36,37 @@ class y {
35
36
  */
36
37
  static resolve(e) {
37
38
  if (e === !1)
38
- return new y(
39
+ return new p(
39
40
  {
40
- y: { curve: u(), settleMs: 0, stickyMs: 0, stickyFloorMs: 0, gestureMs: 0 },
41
- x: { curve: u(), settleMs: 0, gestureMs: 0 },
41
+ y: { curve: y(), settleMs: 0, stickyMs: 0, stickyFloorMs: 0, gestureMs: 0 },
42
+ x: { curve: y(), settleMs: 0, gestureMs: 0 },
42
43
  ticksMs: 0,
43
44
  gridMs: 0
44
45
  },
45
46
  0,
46
- f
47
+ L
47
48
  );
48
- const s = e === !0 || e === void 0 ? void 0 : e, t = s?.axis, M = t === !1 ? !1 : t?.y, o = t === !1 ? !1 : t?.x, n = t === !1 ? !1 : t?.ticks, a = t === !1 ? !1 : t?.grid, l = s?.toggle, c = s?.series, T = M === !1 ? {
49
- curve: u(),
49
+ const s = e === !0 || e === void 0 ? void 0 : e, t = s?.axis, M = t === !1 ? !1 : t?.y, i = t === !1 ? !1 : t?.x, n = t === !1 ? !1 : t?.ticks, a = t === !1 ? !1 : t?.grid, l = s?.toggle, u = s?.series, c = M === !1 ? {
50
+ curve: y(),
50
51
  settleMs: 0,
51
52
  stickyMs: 0,
52
53
  stickyFloorMs: 0,
53
54
  gestureMs: 0
54
55
  } : {
55
56
  curve: M?.curve ?? S(),
56
- settleMs: r(M?.settle, X),
57
- ...q(M?.sticky),
58
- gestureMs: r(M?.gesture, $)
59
- }, A = o === !1 ? {
60
- curve: u(),
57
+ settleMs: r(M?.settle, j),
58
+ ...Q(M?.sticky),
59
+ gestureMs: r(M?.gesture, V)
60
+ }, h = i === !1 ? {
61
+ curve: y(),
61
62
  settleMs: 0,
62
63
  gestureMs: 0
63
64
  } : {
64
- curve: o?.curve ?? U(),
65
- settleMs: r(o?.settle, G),
66
- gestureMs: r(o?.gesture, B)
67
- }, L = n === !1 ? 0 : r(n, j), d = a === !1 ? 0 : r(a, V), D = r(l, w), F = z(c);
68
- return new y({ y: T, x: A, ticksMs: L, gridMs: d }, D, F);
65
+ curve: i?.curve ?? U(),
66
+ settleMs: r(i?.settle, $),
67
+ gestureMs: r(i?.gesture, w)
68
+ }, m = n === !1 ? 0 : r(n, z), D = a === !1 ? 0 : r(a, J), d = r(l, q), F = W(u);
69
+ return new p({ y: c, x: h, ticksMs: m, gridMs: D }, d, F);
69
70
  }
70
71
  /**
71
72
  * Per-renderer-type chart-level option payload — merged BEFORE user
@@ -76,8 +77,8 @@ class y {
76
77
  */
77
78
  defaults(e) {
78
79
  if (e === "line") {
79
- const { entryMs: s, smoothMs: t, pulseMs: M, introMs: o } = this.series.line;
80
- return { entryMs: s, smoothMs: t, pulseMs: M, introMs: o };
80
+ const { entryMs: s, smoothMs: t, pulseMs: M, introMs: i } = this.series.line;
81
+ return { entryMs: s, smoothMs: t, pulseMs: M, introMs: i };
81
82
  }
82
83
  if (e === "candlestick") {
83
84
  const { entryMs: s, smoothMs: t, introMs: M } = this.series.candlestick;
@@ -95,6 +96,10 @@ class y {
95
96
  const { entryMs: s, smoothMs: t, introMs: M } = this.series.bar;
96
97
  return { entryMs: s, smoothMs: t, introMs: M };
97
98
  }
99
+ if (e === "band") {
100
+ const { entryMs: s, smoothMs: t, introMs: M } = this.series.band;
101
+ return { entryMs: s, smoothMs: t, introMs: M };
102
+ }
98
103
  return {};
99
104
  }
100
105
  /**
@@ -106,69 +111,81 @@ class y {
106
111
  overrides(e) {
107
112
  const s = {};
108
113
  if (e === "line") {
109
- const { entryMs: n, smoothMs: a, pulseMs: l, introMs: c } = this.series.line;
110
- return n === 0 && (s.entryMs = 0), a === 0 && (s.smoothMs = 0), l === 0 && (s.pulseMs = 0), c === 0 && (s.introMs = 0), s;
114
+ const { entryMs: a, smoothMs: l, pulseMs: u, introMs: c } = this.series.line;
115
+ return a === 0 && (s.entryMs = 0), l === 0 && (s.smoothMs = 0), u === 0 && (s.pulseMs = 0), c === 0 && (s.introMs = 0), s;
111
116
  }
112
117
  if (e === "pie")
113
118
  return this.series.pie.entryMs === 0 && (s.entryMs = 0), s;
114
119
  if (e === "heatmap") {
115
- const { entryMs: n, updateMs: a } = this.series.heatmap;
116
- return n === 0 && (s.entryMs = 0), a === 0 && (s.updateMs = 0), s;
120
+ const { entryMs: a, updateMs: l } = this.series.heatmap;
121
+ return a === 0 && (s.entryMs = 0), l === 0 && (s.updateMs = 0), s;
117
122
  }
118
- if (e !== "candlestick" && e !== "bar")
123
+ const t = this.#s(e);
124
+ if (t === null)
119
125
  return s;
120
- const { entryMs: t, smoothMs: M, introMs: o } = e === "candlestick" ? this.series.candlestick : this.series.bar;
121
- return t === 0 && (s.entryMs = 0), M === 0 && (s.smoothMs = 0), o === 0 && (s.introMs = 0), s;
126
+ const { entryMs: M, smoothMs: i, introMs: n } = t;
127
+ return M === 0 && (s.entryMs = 0), i === 0 && (s.smoothMs = 0), n === 0 && (s.introMs = 0), s;
128
+ }
129
+ /** Durations of a series type with entry / smooth / intro knobs, or `null` for any other kind. */
130
+ #s(e) {
131
+ return e === "candlestick" ? this.series.candlestick : e === "bar" ? this.series.bar : e === "band" ? this.series.band : null;
122
132
  }
123
133
  }
124
- function z(i) {
125
- if (i === !1) return f;
126
- const e = i?.line, s = i?.candlestick, t = i?.bar, M = i?.pie, o = i?.heatmap, n = e === !1 ? { entryMs: 0, smoothMs: 0, pulseMs: 0, introMs: 0 } : {
134
+ function W(o) {
135
+ if (o === !1) return L;
136
+ const e = o?.line, s = o?.candlestick, t = o?.bar, M = o?.band, i = o?.pie, n = o?.heatmap, a = e === !1 ? { entryMs: 0, smoothMs: 0, pulseMs: 0, introMs: 0 } : {
127
137
  entryMs: r(e?.entry, k),
128
- smoothMs: r(e?.smooth, g),
129
- pulseMs: r(e?.pulse, N),
130
- introMs: r(e?.intro, I)
131
- }, a = s === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
138
+ smoothMs: r(e?.smooth, N),
139
+ pulseMs: r(e?.pulse, I),
140
+ introMs: r(e?.intro, g)
141
+ }, l = s === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
132
142
  entryMs: r(s?.entry, R),
133
- smoothMs: r(s?.smooth, v),
134
- introMs: r(s?.intro, Y)
135
- }, l = t === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
143
+ smoothMs: r(s?.smooth, b),
144
+ introMs: r(s?.intro, v)
145
+ }, u = t === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
136
146
  entryMs: r(t?.entry, O),
137
- smoothMs: r(t?.smooth, C),
138
- introMs: r(t?.intro, b)
139
- }, c = M === !1 ? { entryMs: 0, updateMs: 0 } : {
147
+ smoothMs: r(t?.smooth, Y),
148
+ introMs: r(t?.intro, C)
149
+ }, c = M === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
140
150
  entryMs: r(M?.entry, x),
141
- updateMs: r(M?.update, P)
142
- }, T = o === !1 ? { entryMs: 0, updateMs: 0 } : {
143
- entryMs: r(o?.entry, H),
144
- updateMs: r(o?.update, K)
151
+ smoothMs: r(M?.smooth, H),
152
+ introMs: r(M?.intro, P)
153
+ }, h = i === !1 ? { entryMs: 0, updateMs: 0 } : {
154
+ entryMs: r(i?.entry, B),
155
+ updateMs: r(i?.update, K)
156
+ }, m = n === !1 ? { entryMs: 0, updateMs: 0 } : {
157
+ entryMs: r(n?.entry, G),
158
+ updateMs: r(n?.update, X)
145
159
  };
146
- return { line: n, candlestick: a, bar: l, pie: c, heatmap: T };
160
+ return { line: a, candlestick: l, bar: u, band: c, pie: h, heatmap: m };
147
161
  }
148
162
  export {
149
- y as AnimationConfig,
163
+ p as AnimationConfig,
164
+ x as DEFAULT_BAND_ENTRY,
165
+ P as DEFAULT_BAND_INTRO,
166
+ H as DEFAULT_BAND_SMOOTH,
150
167
  O as DEFAULT_BAR_ENTRY,
151
- b as DEFAULT_BAR_INTRO,
152
- C as DEFAULT_BAR_SMOOTH,
168
+ C as DEFAULT_BAR_INTRO,
169
+ Y as DEFAULT_BAR_SMOOTH,
153
170
  R as DEFAULT_CANDLESTICK_ENTRY,
154
- Y as DEFAULT_CANDLESTICK_INTRO,
155
- v as DEFAULT_CANDLESTICK_SMOOTH,
156
- V as DEFAULT_GRID_MS,
157
- H as DEFAULT_HEATMAP_ENTRY,
158
- K as DEFAULT_HEATMAP_UPDATE,
159
- ss as DEFAULT_HISTORY_REVEAL,
171
+ v as DEFAULT_CANDLESTICK_INTRO,
172
+ b as DEFAULT_CANDLESTICK_SMOOTH,
173
+ J as DEFAULT_GRID_MS,
174
+ G as DEFAULT_HEATMAP_ENTRY,
175
+ X as DEFAULT_HEATMAP_UPDATE,
176
+ rs as DEFAULT_HISTORY_REVEAL,
160
177
  k as DEFAULT_LINE_ENTRY,
161
- I as DEFAULT_LINE_INTRO,
162
- N as DEFAULT_LINE_PULSE,
163
- g as DEFAULT_LINE_SMOOTH,
164
- x as DEFAULT_PIE_ENTRY,
165
- P as DEFAULT_PIE_UPDATE,
166
- j as DEFAULT_TICKS_MS,
167
- w as DEFAULT_TOGGLE_MS,
168
- B as DEFAULT_X_GESTURE_MS,
169
- G as DEFAULT_X_SETTLE_MS,
170
- $ as DEFAULT_Y_GESTURE_MS,
171
- X as DEFAULT_Y_SETTLE_MS,
172
- _ as DEFAULT_Y_STICKY_MAX_MS,
173
- m as DEFAULT_Y_STICKY_MIN_MS
178
+ g as DEFAULT_LINE_INTRO,
179
+ I as DEFAULT_LINE_PULSE,
180
+ N as DEFAULT_LINE_SMOOTH,
181
+ B as DEFAULT_PIE_ENTRY,
182
+ K as DEFAULT_PIE_UPDATE,
183
+ z as DEFAULT_TICKS_MS,
184
+ q as DEFAULT_TOGGLE_MS,
185
+ w as DEFAULT_X_GESTURE_MS,
186
+ $ as DEFAULT_X_SETTLE_MS,
187
+ V as DEFAULT_Y_GESTURE_MS,
188
+ j as DEFAULT_Y_SETTLE_MS,
189
+ A as DEFAULT_Y_STICKY_MAX_MS,
190
+ f as DEFAULT_Y_STICKY_MIN_MS
174
191
  };
@@ -1,6 +1,6 @@
1
1
  import { ScalarSpring as g } from "../animation/scalar-spring.js";
2
- const r = 320, V = 0.15;
3
- class x {
2
+ const l = 320, V = 0.15;
3
+ class b {
4
4
  #t;
5
5
  #e;
6
6
  #i = !1;
@@ -8,45 +8,53 @@ class x {
8
8
  this.#t = new g(i), this.#e = i;
9
9
  }
10
10
  frame(i) {
11
- const { target: t, firstVisible: n, introFront: o, now: s, glide: u = !0, countUp: l = !0, reducedMotion: p = !1 } = i;
12
- if (p || !u && !l)
11
+ const { target: t, firstVisible: n, introFront: r, now: s, glide: a = !0, countUp: u = !0, reducedMotion: p = !1 } = i;
12
+ if (p || !a && !u)
13
13
  return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
14
- if (o < 1) {
15
- const f = n + (t - n) * o, a = l ? f : t;
16
- return this.#t.snap(a, { now: s }), this.#e = a, this.#i = !0, { positionValue: a, textValue: a, opacity: this.#s(o), animating: !0 };
14
+ if (r < 1) {
15
+ const h = n + (t - n) * r, o = u ? h : t;
16
+ return this.#t.snap(o, { now: s }), this.#e = o, this.#i = !0, { positionValue: o, textValue: o, opacity: this.#s(r), animating: !0 };
17
17
  }
18
18
  if (!this.#i)
19
19
  return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
20
- if (!u)
20
+ if (!a)
21
21
  return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
22
- const c = i.settleMs ?? r;
22
+ const c = i.settleMs ?? l;
23
23
  if (c <= 0)
24
24
  return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
25
- Math.abs(t - this.#e) > m && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
26
- const h = this.#t.tick(s);
27
- return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: h };
25
+ Math.abs(t - this.#e) > d && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
26
+ const f = this.#t.tick(s);
27
+ return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: f };
28
28
  }
29
29
  #s(i) {
30
- return i >= 1 ? 1 : d(i / V);
30
+ return i >= 1 ? 1 : y(i / V);
31
31
  }
32
32
  }
33
- const m = 1e-9;
34
- function d(e) {
33
+ const d = 1e-9;
34
+ function y(e) {
35
35
  return e <= 0 ? 0 : e >= 1 ? 1 : e;
36
36
  }
37
- function M(e) {
38
- return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: r } : {
37
+ function w(e) {
38
+ return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: l } : {
39
39
  glide: e.glide ?? !0,
40
40
  countUp: e.countUp ?? !0,
41
- settleMs: e.settleMs ?? r
41
+ settleMs: e.settleMs ?? l
42
42
  };
43
43
  }
44
- function y(e, i, t) {
44
+ function M(e, i, t) {
45
45
  const { from: n } = e.getVisibleRange();
46
46
  return e.getStackedValueAtTime(i, n) ?? t;
47
47
  }
48
+ function S(e, i) {
49
+ if (i !== void 0) return i;
50
+ const t = new Set(e.getSeriesIdsByType("band")), n = (a) => !t.has(a), r = e.getSeriesIdsByType("time", { visibleOnly: !0, singleLayerOnly: !0 }).filter(n);
51
+ if (r.length > 0) return r[0];
52
+ const s = e.getSeriesIdsByType("time", { visibleOnly: !0 }).filter(n);
53
+ return s.length > 0 ? s[0] : null;
54
+ }
48
55
  export {
49
- x as BadgeAnimator,
50
- y as firstVisibleValue,
51
- M as resolveAnimate
56
+ b as BadgeAnimator,
57
+ M as firstVisibleValue,
58
+ w as resolveAnimate,
59
+ S as resolveYLabelSeriesId
52
60
  };
@@ -1,41 +1,42 @@
1
1
  import { renderEdgeIndicator as s } from "../components/edge-indicator.js";
2
- function d(e) {
3
- const o = performance.now();
4
- for (const t of ["left", "right"]) {
5
- let r = e.edgeStates[t], n = 1;
2
+ import { pointValue as c } from "../utils/point.js";
3
+ function h(e) {
4
+ const t = performance.now();
5
+ for (const o of ["left", "right"]) {
6
+ let r = e.edgeStates[o], n = 1;
6
7
  if (r === "idle" || r === "has-more") {
7
- const a = e.edgeExitFades[t];
8
+ const a = e.edgeExitFades[o];
8
9
  if (a === null) continue;
9
10
  r = "loading", n = a;
10
11
  }
11
- const l = e.resolveBoundary(t);
12
+ const l = e.resolveBoundary(o);
12
13
  if (l === null) continue;
13
- const { context: c } = e.scope;
14
- n < 1 && (c.save(), c.globalAlpha *= n), s({
14
+ const { context: i } = e.scope;
15
+ n < 1 && (i.save(), i.globalAlpha *= n), s({
15
16
  scope: e.scope,
16
17
  timeScale: e.timeScale,
17
18
  theme: e.theme,
18
19
  chartMediaWidth: e.chartMediaWidth,
19
20
  chartMediaHeight: e.chartMediaHeight,
20
21
  boundaryTime: l,
21
- side: t,
22
+ side: o,
22
23
  state: r,
23
- now: o,
24
- customIndicator: e.edgeIndicatorFns[t],
25
- resolveEdgeAnchor: () => e.resolveEdgeAnchor(t, l),
24
+ now: t,
25
+ customIndicator: e.edgeIndicatorFns[o],
26
+ resolveEdgeAnchor: () => e.resolveEdgeAnchor(o, l),
26
27
  resolveEdgeBarSpacing: () => e.resolveEdgeBarSpacing(),
27
- reportPlaceholders: (a) => e.reportPlaceholders(t, a)
28
- }), n < 1 && c.restore();
28
+ reportPlaceholders: (a) => e.reportPlaceholders(o, a)
29
+ }), n < 1 && i.restore();
29
30
  }
30
31
  }
31
- function g(e, o, t) {
32
- return o !== null ? o : e === "left" ? t.first ?? null : t.last ?? null;
32
+ function u(e, t, o) {
33
+ return t !== null ? t : e === "left" ? o.first ?? null : o.last ?? null;
33
34
  }
34
- function u(e, o) {
35
- return "close" in o ? e === "left" ? o.open : o.close : o.value;
35
+ function f(e, t) {
36
+ return "close" in t ? e === "left" ? t.open : t.close : c(t);
36
37
  }
37
38
  export {
38
- d as drawEdgeIndicators,
39
- u as resolveEdgeAnchorValue,
40
- g as resolveEdgeBoundary
39
+ h as drawEdgeIndicators,
40
+ f as resolveEdgeAnchorValue,
41
+ u as resolveEdgeBoundary
41
42
  };
@@ -1,32 +1,39 @@
1
- import { isTimeSeriesRenderer as c } from "../series/types.js";
2
- const a = (e) => "close" in e ? e.close : e.value;
3
- function d(e, s, i) {
4
- const t = s.find((f) => f.id === e);
1
+ import { isTimeSeriesRenderer as d } from "../series/types.js";
2
+ import { isBandPoint as g, pointValue as m } from "../utils/point.js";
3
+ function o(n) {
4
+ return g(n) ? null : m(n);
5
+ }
6
+ function L(n, i, u) {
7
+ const t = i.find((l) => l.id === n);
5
8
  if (!t) return null;
6
- const n = t.renderer;
7
- if (!c(n)) return null;
8
- const r = n.getLastDataPoint();
9
- if (!r) return null;
10
- const { from: u, to: o } = i;
11
- if (r.time >= u && r.time <= o)
12
- return { value: a(r), isLive: !0 };
13
- const l = n.getVisibleDataPoints(u, o);
14
- return l.length === 0 ? null : { value: a(l[l.length - 1]), isLive: !1 };
9
+ const r = t.renderer;
10
+ if (!d(r)) return null;
11
+ const e = r.getLastDataPoint();
12
+ if (!e) return null;
13
+ const { from: a, to: c } = u;
14
+ if (e.time >= a && e.time <= c) {
15
+ const l = o(e);
16
+ return l === null ? null : { value: l, isLive: !0 };
17
+ }
18
+ const s = r.getVisibleDataPoints(a, c);
19
+ if (s.length === 0) return null;
20
+ const f = o(s[s.length - 1]);
21
+ return f === null ? null : { value: f, isLive: !1 };
15
22
  }
16
- function v(e, s, i) {
17
- const t = s.find((r) => r.id === e);
18
- return t ? t.renderer.getStackedLastValue?.() || d(e, s, i) : null;
23
+ function p(n, i, u) {
24
+ const t = i.find((e) => e.id === n);
25
+ return t ? t.renderer.getStackedLastValue?.() || L(n, i, u) : null;
19
26
  }
20
- function L(e, s) {
21
- const i = s.find((r) => r.id === e);
22
- if (!i) return null;
23
- const t = i.renderer;
24
- if (!c(t)) return null;
25
- const n = t.getSecondLastDataPoint();
26
- return n ? "close" in n ? n.close : n.value : null;
27
+ function V(n, i) {
28
+ const u = i.find((e) => e.id === n);
29
+ if (!u) return null;
30
+ const t = u.renderer;
31
+ if (!d(t)) return null;
32
+ const r = t.getSecondLastDataPoint();
33
+ return r ? o(r) : null;
27
34
  }
28
35
  export {
29
- d as getLastValue,
30
- L as getPreviousClose,
31
- v as getStackedLastValue
36
+ L as getLastValue,
37
+ V as getPreviousClose,
38
+ p as getStackedLastValue
32
39
  };