@wick-charts/vue 0.5.1 → 0.6.1

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 (82) hide show
  1. package/README.md +45 -6
  2. package/dist/BarSeries.vue.js +26 -20
  3. package/dist/CandlestickSeries.vue.js +30 -24
  4. package/dist/ChartContainer.vue.js +125 -72
  5. package/dist/HeatmapSeries.vue.js +40 -0
  6. package/dist/HeatmapSeries.vue2.js +4 -0
  7. package/dist/LineSeries.vue.js +26 -20
  8. package/dist/PieSeries.vue.js +24 -18
  9. package/dist/core/dist/animation/animator.js +21 -21
  10. package/dist/core/dist/animation/config.js +114 -87
  11. package/dist/core/dist/animation/easing.js +3 -1
  12. package/dist/core/dist/animation/intro-wave.js +68 -0
  13. package/dist/core/dist/axis/dom-labels.js +13 -14
  14. package/dist/core/dist/chart/badge-animator.js +56 -0
  15. package/dist/core/dist/chart/edge-indicators.js +28 -13
  16. package/dist/core/dist/chart/last-value.js +18 -17
  17. package/dist/core/dist/chart/options.js +27 -16
  18. package/dist/core/dist/chart/y-target.js +13 -12
  19. package/dist/core/dist/chart.js +868 -441
  20. package/dist/core/dist/components/annotation-chip.js +28 -0
  21. package/dist/core/dist/components/crosshair.js +8 -6
  22. package/dist/core/dist/components/edge-indicator.js +58 -26
  23. package/dist/core/dist/components/loading-indicator.js +46 -0
  24. package/dist/core/dist/components/marker.js +49 -31
  25. package/dist/core/dist/components/reference-line.js +27 -36
  26. package/dist/core/dist/components/time-region.js +30 -28
  27. package/dist/core/dist/data/store.js +38 -19
  28. package/dist/core/dist/data/sync.js +60 -38
  29. package/dist/core/dist/heatmap-tooltip.js +16 -0
  30. package/dist/core/dist/interactions/handler.js +86 -46
  31. package/dist/core/dist/perf/perf-hud.js +5 -5
  32. package/dist/core/dist/scales/x-scale.js +85 -37
  33. package/dist/core/dist/scales/y-scale.js +38 -27
  34. package/dist/core/dist/series/bar-intro.js +18 -0
  35. package/dist/core/dist/series/bar.js +337 -205
  36. package/dist/core/dist/series/base-multi-layer.js +224 -96
  37. package/dist/core/dist/series/candlestick-intro.js +57 -0
  38. package/dist/core/dist/series/candlestick.js +454 -276
  39. package/dist/core/dist/series/heatmap.js +387 -0
  40. package/dist/core/dist/series/line-intro.js +85 -0
  41. package/dist/core/dist/series/line.js +590 -282
  42. package/dist/core/dist/series/painters/builtins.js +2 -2
  43. package/dist/core/dist/series/pie.js +396 -259
  44. package/dist/core/dist/series/register-builtins.js +8 -7
  45. package/dist/core/dist/series/types.js +6 -0
  46. package/dist/core/dist/series/wave-intro.js +26 -0
  47. package/dist/core/dist/theme/create.js +69 -63
  48. package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
  49. package/dist/core/dist/theme/themes/sand-dune.js +2 -2
  50. package/dist/core/dist/utils/color.js +109 -34
  51. package/dist/core/dist/utils/deep-equal.js +18 -0
  52. package/dist/core/dist/utils/time.js +25 -19
  53. package/dist/index.d.ts +1494 -122
  54. package/dist/index.js +177 -130
  55. package/dist/ui/Crosshair.vue.js +20 -21
  56. package/dist/ui/HeatmapTooltip.vue.js +96 -0
  57. package/dist/ui/HeatmapTooltip.vue2.js +4 -0
  58. package/dist/ui/InfoBar.vue.js +46 -47
  59. package/dist/ui/Legend.vue.js +80 -79
  60. package/dist/ui/PieLegend.vue.js +5 -5
  61. package/dist/ui/PieTooltip.vue.js +77 -67
  62. package/dist/ui/Tooltip.vue.js +60 -60
  63. package/dist/ui/YAxis.vue.js +2 -2
  64. package/dist/ui/YLabel.vue.js +94 -61
  65. package/package.json +2 -2
  66. package/src/BarSeries.vue +23 -7
  67. package/src/CandlestickSeries.vue +23 -7
  68. package/src/ChartContainer.vue +250 -13
  69. package/src/HeatmapSeries.vue +69 -0
  70. package/src/LineSeries.vue +23 -7
  71. package/src/PieSeries.vue +22 -6
  72. package/src/index.ts +84 -3
  73. package/src/ui/Crosshair.vue +1 -2
  74. package/src/ui/HeatmapTooltip.vue +144 -0
  75. package/src/ui/InfoBar.vue +1 -2
  76. package/src/ui/Legend.vue +13 -0
  77. package/src/ui/Marker.vue +1 -1
  78. package/src/ui/PieTooltip.vue +10 -0
  79. package/src/ui/ReferenceLine.vue +2 -2
  80. package/src/ui/TimeRegion.vue +2 -2
  81. package/src/ui/Tooltip.vue +2 -2
  82. package/src/ui/YLabel.vue +123 -8
@@ -1,32 +1,38 @@
1
- import { defineComponent as i, ref as n, onMounted as u, onUnmounted as d, watch as r, createCommentVNode as p } from "vue";
2
- import { PieSeriesDef as m } from "./core/dist/series/pie.js";
3
- import { useChartInstance as c } from "./context.js";
4
- const h = /* @__PURE__ */ i({
1
+ import { defineComponent as o, ref as n, onMounted as u, onUnmounted as l, watch as a, createCommentVNode as d } from "vue";
2
+ import { PieSeriesDef as p } from "./core/dist/series/pie.js";
3
+ import { useChartInstance as f } from "./context.js";
4
+ const h = /* @__PURE__ */ o({
5
5
  __name: "PieSeries",
6
6
  props: {
7
7
  data: {},
8
8
  options: {},
9
- id: {}
9
+ id: {},
10
+ visible: { type: Boolean, default: !0 }
10
11
  },
11
- setup(s) {
12
- const a = s, o = c(), t = n(null);
12
+ setup(r) {
13
+ const i = r, s = f(), t = n(null);
13
14
  return u(() => {
14
- const e = o.addSeries(m, { ...a.options, id: a.id });
15
- t.value = e, a.data.length > 0 && o.setSeriesData(e, a.data);
16
- }), d(() => {
17
- t.value && o.removeSeries(t.value);
18
- }), r(
19
- () => a.data,
15
+ const e = s.addSeries(p, { ...i.options, id: i.id });
16
+ t.value = e, i.data.length > 0 && s.setSeriesData(e, i.data), s.setSeriesVisible(e, i.visible);
17
+ }), l(() => {
18
+ t.value && s.removeSeries(t.value);
19
+ }), a(
20
+ () => i.data,
20
21
  (e) => {
21
- t.value && e.length > 0 && o.setSeriesData(t.value, e);
22
+ t.value && e.length > 0 && s.setSeriesData(t.value, e);
22
23
  }
23
- ), r(
24
- () => a.options,
24
+ ), a(
25
+ () => i.options,
25
26
  (e) => {
26
- t.value && e && o.updateSeriesOptions(t.value, e);
27
+ t.value && e && s.updateSeriesOptions(t.value, e);
27
28
  },
28
29
  { deep: !0 }
29
- ), (e, f) => p("", !0);
30
+ ), a(
31
+ () => i.visible,
32
+ (e) => {
33
+ t.value && s.setSeriesVisible(t.value, e);
34
+ }
35
+ ), (e, c) => d("", !0);
30
36
  }
31
37
  });
32
38
  export {
@@ -1,8 +1,8 @@
1
1
  import { easeOutCubic as r } from "./easing.js";
2
2
  class a {
3
- #t;
4
- #h;
5
3
  #i;
4
+ #h;
5
+ #t;
6
6
  #u = 0;
7
7
  #r;
8
8
  #e;
@@ -11,21 +11,21 @@ class a {
11
11
  #c;
12
12
  #a;
13
13
  #s = !1;
14
- constructor(t) {
15
- this.#t = t.initial, this.#h = t.initial, this.#i = t.initial, this.#o = t.duration, this.#r = t.duration, this.#n = t.easing ?? r, this.#e = this.#n, this.#c = t.lerp, this.#a = t.equals ?? Object.is;
14
+ constructor(i) {
15
+ this.#i = i.initial, this.#h = i.initial, this.#t = i.initial, this.#o = i.duration, this.#r = i.duration, this.#n = i.easing ?? r, this.#e = this.#n, this.#c = i.lerp, this.#a = i.equals ?? Object.is;
16
16
  }
17
17
  get current() {
18
- return this.#t;
18
+ return this.#i;
19
19
  }
20
20
  get target() {
21
- return this.#i;
21
+ return this.#t;
22
22
  }
23
23
  get animating() {
24
24
  return this.#s;
25
25
  }
26
26
  /** Replace the target instantly; cancels any in-flight animation. */
27
- snap(t) {
28
- this.#t = t, this.#h = t, this.#i = t, this.#s = !1;
27
+ snap(i) {
28
+ this.#i = i, this.#h = i, this.#t = i, this.#s = !1;
29
29
  }
30
30
  /**
31
31
  * Set a new target. If `opts.duration` is omitted, the animator's default
@@ -43,28 +43,28 @@ class a {
43
43
  * `from` is the actual current position, the cubic ease resumes seamlessly
44
44
  * even though the curve technically restarts.
45
45
  */
46
- setTarget(t, i = {}) {
47
- const s = i.now ?? performance.now();
46
+ setTarget(i, t = {}) {
47
+ const s = t.now ?? performance.now();
48
48
  if (this.#s) {
49
- if (this.#a(t, this.#i)) return;
49
+ if (this.#a(i, this.#t)) return;
50
50
  this.tick(s);
51
- } else if (this.#a(t, this.#t))
51
+ } else if (this.#a(i, this.#i))
52
52
  return;
53
- const h = i.duration ?? this.#o;
53
+ const h = t.duration ?? this.#o;
54
54
  if (h <= 0) {
55
- this.snap(t);
55
+ this.snap(i);
56
56
  return;
57
57
  }
58
- this.#h = this.#t, this.#i = t, this.#r = h, this.#e = i.easing ?? this.#n, this.#u = s, this.#s = !0;
58
+ this.#h = this.#i, this.#t = i, this.#r = h, this.#e = t.easing ?? this.#n, this.#u = s, this.#s = !0;
59
59
  }
60
60
  /** Advance `current` toward `target`. Returns `true` while still animating. */
61
- tick(t) {
61
+ tick(i) {
62
62
  if (!this.#s) return !1;
63
- const i = t - this.#u;
64
- if (i >= this.#r)
65
- return this.#t = this.#i, this.#s = !1, !1;
66
- const s = i <= 0 ? 0 : i / this.#r;
67
- return this.#t = this.#c(this.#h, this.#i, this.#e(s)), !0;
63
+ const t = i - this.#u;
64
+ if (t >= this.#r)
65
+ return this.#i = this.#t, this.#s = !1, !1;
66
+ const s = t <= 0 ? 0 : t / this.#r;
67
+ return this.#i = this.#c(this.#h, this.#t, this.#e(s)), !0;
68
68
  }
69
69
  }
70
70
  export {
@@ -1,30 +1,31 @@
1
- import { spring as k } from "./spring.js";
2
- import { resolveAnimationTime as t } from "./time.js";
3
- import { hermite as F } from "./y-range-hermite.js";
4
- import { snap as l } from "./y-range-snap.js";
5
- const E = 250, _ = 250, S = E, U = _, D = 600, d = E, g = _, v = E, I = _, N = 250, Y = 250, x = 200, C = 150, R = 250, u = 2500, T = 500, O = 100, b = 250, K = 250, m = {
6
- line: { entryMs: 0, smoothMs: 0, pulseMs: 0 },
7
- candlestick: { entryMs: 0, smoothMs: 0 },
8
- bar: { entryMs: 0, smoothMs: 0 },
9
- pie: { entryMs: 0, updateMs: 0 }
1
+ import { spring as d } from "./spring.js";
2
+ import { resolveAnimationTime as r } from "./time.js";
3
+ import { hermite as D } from "./y-range-hermite.js";
4
+ import { snap as u } from "./y-range-snap.js";
5
+ const _ = 250, p = 250, h = 500, J = 400, F = _, S = p, k = h, g = 600, I = _, N = p, R = h, v = _, Y = p, O = h, C = 600, b = 250, x = 600, P = 300, H = 200, K = 150, G = 250, T = 2500, m = 500, B = 100, X = 250, $ = 250, A = {
6
+ line: { entryMs: 0, smoothMs: 0, pulseMs: 0, introMs: 0 },
7
+ candlestick: { entryMs: 0, smoothMs: 0, introMs: 0 },
8
+ bar: { entryMs: 0, smoothMs: 0, introMs: 0 },
9
+ pie: { entryMs: 0, updateMs: 0 },
10
+ heatmap: { entryMs: 0, updateMs: 0 }
10
11
  };
11
- function G(i) {
12
+ function w(i) {
12
13
  if (i !== null && typeof i == "object")
13
14
  return {
14
- stickyMs: t(i.max, u),
15
- stickyFloorMs: t(i.min, T)
15
+ stickyMs: r(i.max, T),
16
+ stickyFloorMs: r(i.min, m)
16
17
  };
17
18
  if (i === void 0)
18
- return { stickyMs: u, stickyFloorMs: T };
19
- const s = t(i, u);
20
- return { stickyMs: s, stickyFloorMs: s };
19
+ return { stickyMs: T, stickyFloorMs: m };
20
+ const e = r(i, T);
21
+ return { stickyMs: e, stickyFloorMs: e };
21
22
  }
22
23
  class y {
23
24
  axis;
24
25
  toggleMs;
25
26
  series;
26
- constructor(s, e, o) {
27
- this.axis = s, this.toggleMs = e, this.series = o;
27
+ constructor(e, s, t) {
28
+ this.axis = e, this.toggleMs = s, this.series = t;
28
29
  }
29
30
  /**
30
31
  * Collapse the public `animations` surface into a resolved config.
@@ -32,38 +33,38 @@ class y {
32
33
  * disables every field in that category; otherwise missing fields
33
34
  * inherit built-in defaults.
34
35
  */
35
- static resolve(s) {
36
- if (s === !1)
36
+ static resolve(e) {
37
+ if (e === !1)
37
38
  return new y(
38
39
  {
39
- y: { curve: l(), settleMs: 0, stickyMs: 0, stickyFloorMs: 0, gestureMs: 0 },
40
- x: { curve: l(), settleMs: 0, gestureMs: 0 },
40
+ y: { curve: u(), settleMs: 0, stickyMs: 0, stickyFloorMs: 0, gestureMs: 0 },
41
+ x: { curve: u(), settleMs: 0, gestureMs: 0 },
41
42
  ticksMs: 0
42
43
  },
43
44
  0,
44
- m
45
+ A
45
46
  );
46
- const e = s === !0 || s === void 0 ? void 0 : s, o = e?.axis, r = o === !1 ? !1 : o?.y, n = o === !1 ? !1 : o?.x, M = o === !1 ? !1 : o?.ticks, a = e?.toggle, c = e?.series, f = r === !1 ? {
47
- curve: l(),
47
+ 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 = s?.toggle, c = s?.series, l = M === !1 ? {
48
+ curve: u(),
48
49
  settleMs: 0,
49
50
  stickyMs: 0,
50
51
  stickyFloorMs: 0,
51
52
  gestureMs: 0
52
53
  } : {
53
- curve: r?.curve ?? F(),
54
- settleMs: t(r?.settle, R),
55
- ...G(r?.sticky),
56
- gestureMs: t(r?.gesture, O)
57
- }, h = n === !1 ? {
58
- curve: l(),
54
+ curve: M?.curve ?? D(),
55
+ settleMs: r(M?.settle, G),
56
+ ...w(M?.sticky),
57
+ gestureMs: r(M?.gesture, B)
58
+ }, E = o === !1 ? {
59
+ curve: u(),
59
60
  settleMs: 0,
60
61
  gestureMs: 0
61
62
  } : {
62
- curve: n?.curve ?? k(),
63
- settleMs: t(n?.settle, x),
64
- gestureMs: t(n?.gesture, C)
65
- }, p = M === !1 ? 0 : t(M, K), L = t(a, b), A = P(c);
66
- return new y({ y: f, x: h, ticksMs: p }, L, A);
63
+ curve: o?.curve ?? d(),
64
+ settleMs: r(o?.settle, H),
65
+ gestureMs: r(o?.gesture, K)
66
+ }, f = n === !1 ? 0 : r(n, $), L = r(a, X), U = j(c);
67
+ return new y({ y: l, x: E, ticksMs: f }, L, U);
67
68
  }
68
69
  /**
69
70
  * Per-renderer-type chart-level option payload — merged BEFORE user
@@ -72,21 +73,28 @@ class y {
72
73
  * renderer's option shape. `pulseMs` is line-only; bars / candles
73
74
  * ignore it.
74
75
  */
75
- defaults(s) {
76
- if (s === "line") {
77
- const { entryMs: r, smoothMs: n, pulseMs: M } = this.series.line;
78
- return { entryMs: r, smoothMs: n, pulseMs: M };
76
+ defaults(e) {
77
+ if (e === "line") {
78
+ const { entryMs: s, smoothMs: t, pulseMs: M, introMs: o } = this.series.line;
79
+ return { entryMs: s, smoothMs: t, pulseMs: M, introMs: o };
79
80
  }
80
- if (s === "candlestick") {
81
- const { entryMs: r, smoothMs: n } = this.series.candlestick;
82
- return { entryMs: r, smoothMs: n };
81
+ if (e === "candlestick") {
82
+ const { entryMs: s, smoothMs: t, introMs: M } = this.series.candlestick;
83
+ return { entryMs: s, smoothMs: t, introMs: M };
83
84
  }
84
- if (s === "pie") {
85
- const { entryMs: r, updateMs: n } = this.series.pie;
86
- return { entryMs: r, updateMs: n };
85
+ if (e === "pie") {
86
+ const { entryMs: s, updateMs: t } = this.series.pie;
87
+ return { entryMs: s, updateMs: t };
87
88
  }
88
- const { entryMs: e, smoothMs: o } = this.series.bar;
89
- return { entryMs: e, smoothMs: o };
89
+ if (e === "heatmap") {
90
+ const { entryMs: s, updateMs: t } = this.series.heatmap;
91
+ return { entryMs: s, updateMs: t };
92
+ }
93
+ if (e === "bar") {
94
+ const { entryMs: s, smoothMs: t, introMs: M } = this.series.bar;
95
+ return { entryMs: s, smoothMs: t, introMs: M };
96
+ }
97
+ return {};
90
98
  }
91
99
  /**
92
100
  * Chart-level forced overrides — `animations.series.<type>: false` (or
@@ -94,52 +102,71 @@ class y {
94
102
  * AFTER user options so the disable can't be undone at the per-series
95
103
  * layer.
96
104
  */
97
- overrides(s) {
98
- const e = {};
99
- if (s === "line") {
100
- const { entryMs: n, smoothMs: M, pulseMs: a } = this.series.line;
101
- return n === 0 && (e.entryMs = 0), M === 0 && (e.smoothMs = 0), a === 0 && (e.pulseMs = 0), e;
105
+ overrides(e) {
106
+ const s = {};
107
+ if (e === "line") {
108
+ const { entryMs: n, smoothMs: a, pulseMs: c, introMs: l } = this.series.line;
109
+ return n === 0 && (s.entryMs = 0), a === 0 && (s.smoothMs = 0), c === 0 && (s.pulseMs = 0), l === 0 && (s.introMs = 0), s;
110
+ }
111
+ if (e === "pie")
112
+ return this.series.pie.entryMs === 0 && (s.entryMs = 0), s;
113
+ if (e === "heatmap") {
114
+ const { entryMs: n, updateMs: a } = this.series.heatmap;
115
+ return n === 0 && (s.entryMs = 0), a === 0 && (s.updateMs = 0), s;
102
116
  }
103
- if (s === "pie") return e;
104
- const { entryMs: o, smoothMs: r } = s === "candlestick" ? this.series.candlestick : this.series.bar;
105
- return o === 0 && (e.entryMs = 0), r === 0 && (e.smoothMs = 0), e;
117
+ if (e !== "candlestick" && e !== "bar")
118
+ return s;
119
+ const { entryMs: t, smoothMs: M, introMs: o } = e === "candlestick" ? this.series.candlestick : this.series.bar;
120
+ return t === 0 && (s.entryMs = 0), M === 0 && (s.smoothMs = 0), o === 0 && (s.introMs = 0), s;
106
121
  }
107
122
  }
108
- function P(i) {
109
- if (i === !1) return m;
110
- const s = i?.line, e = i?.candlestick, o = i?.bar, r = i?.pie, n = s === !1 ? { entryMs: 0, smoothMs: 0, pulseMs: 0 } : {
111
- entryMs: t(s?.entry, S),
112
- smoothMs: t(s?.smooth, U),
113
- pulseMs: t(s?.pulse, D)
114
- }, M = e === !1 ? { entryMs: 0, smoothMs: 0 } : {
115
- entryMs: t(e?.entry, d),
116
- smoothMs: t(e?.smooth, g)
117
- }, a = o === !1 ? { entryMs: 0, smoothMs: 0 } : {
118
- entryMs: t(o?.entry, v),
119
- smoothMs: t(o?.smooth, I)
120
- }, c = r === !1 ? { entryMs: 0, updateMs: 0 } : {
121
- entryMs: t(r?.entry, N),
122
- updateMs: t(r?.update, Y)
123
+ function j(i) {
124
+ if (i === !1) return A;
125
+ 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 } : {
126
+ entryMs: r(e?.entry, F),
127
+ smoothMs: r(e?.smooth, S),
128
+ pulseMs: r(e?.pulse, g),
129
+ introMs: r(e?.intro, k)
130
+ }, a = s === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
131
+ entryMs: r(s?.entry, I),
132
+ smoothMs: r(s?.smooth, N),
133
+ introMs: r(s?.intro, R)
134
+ }, c = t === !1 ? { entryMs: 0, smoothMs: 0, introMs: 0 } : {
135
+ entryMs: r(t?.entry, v),
136
+ smoothMs: r(t?.smooth, Y),
137
+ introMs: r(t?.intro, O)
138
+ }, l = M === !1 ? { entryMs: 0, updateMs: 0 } : {
139
+ entryMs: r(M?.entry, C),
140
+ updateMs: r(M?.update, b)
141
+ }, E = o === !1 ? { entryMs: 0, updateMs: 0 } : {
142
+ entryMs: r(o?.entry, x),
143
+ updateMs: r(o?.update, P)
123
144
  };
124
- return { line: n, candlestick: M, bar: a, pie: c };
145
+ return { line: n, candlestick: a, bar: c, pie: l, heatmap: E };
125
146
  }
126
147
  export {
127
148
  y as AnimationConfig,
128
149
  v as DEFAULT_BAR_ENTRY,
129
- I as DEFAULT_BAR_SMOOTH,
130
- d as DEFAULT_CANDLESTICK_ENTRY,
131
- g as DEFAULT_CANDLESTICK_SMOOTH,
132
- S as DEFAULT_LINE_ENTRY,
133
- D as DEFAULT_LINE_PULSE,
134
- U as DEFAULT_LINE_SMOOTH,
135
- N as DEFAULT_PIE_ENTRY,
136
- Y as DEFAULT_PIE_UPDATE,
137
- K as DEFAULT_TICKS_MS,
138
- b as DEFAULT_TOGGLE_MS,
139
- C as DEFAULT_X_GESTURE_MS,
140
- x as DEFAULT_X_SETTLE_MS,
141
- O as DEFAULT_Y_GESTURE_MS,
142
- R as DEFAULT_Y_SETTLE_MS,
143
- u as DEFAULT_Y_STICKY_MAX_MS,
144
- T as DEFAULT_Y_STICKY_MIN_MS
150
+ O as DEFAULT_BAR_INTRO,
151
+ Y as DEFAULT_BAR_SMOOTH,
152
+ I as DEFAULT_CANDLESTICK_ENTRY,
153
+ R as DEFAULT_CANDLESTICK_INTRO,
154
+ N as DEFAULT_CANDLESTICK_SMOOTH,
155
+ x as DEFAULT_HEATMAP_ENTRY,
156
+ P as DEFAULT_HEATMAP_UPDATE,
157
+ J as DEFAULT_HISTORY_REVEAL,
158
+ F as DEFAULT_LINE_ENTRY,
159
+ k as DEFAULT_LINE_INTRO,
160
+ g as DEFAULT_LINE_PULSE,
161
+ S as DEFAULT_LINE_SMOOTH,
162
+ C as DEFAULT_PIE_ENTRY,
163
+ b as DEFAULT_PIE_UPDATE,
164
+ $ as DEFAULT_TICKS_MS,
165
+ X as DEFAULT_TOGGLE_MS,
166
+ K as DEFAULT_X_GESTURE_MS,
167
+ H as DEFAULT_X_SETTLE_MS,
168
+ B as DEFAULT_Y_GESTURE_MS,
169
+ G as DEFAULT_Y_SETTLE_MS,
170
+ T as DEFAULT_Y_STICKY_MAX_MS,
171
+ m as DEFAULT_Y_STICKY_MIN_MS
145
172
  };
@@ -1,4 +1,6 @@
1
- const e = (t) => 1 - (1 - t) ** 3;
1
+ const e = (a) => 1 - (1 - a) ** 3, s = (a) => a < 0.5 ? 4 * a ** 3 : 1 - (-2 * a + 2) ** 3 / 2, t = (a) => 1 + 2.30158 * (a - 1) ** 3 + 1.30158 * (a - 1) ** 2;
2
2
  export {
3
+ s as easeInOutCubic,
4
+ t as easeOutBack,
3
5
  e as easeOutCubic
4
6
  };
@@ -0,0 +1,68 @@
1
+ import { easeOutCubic as h, easeInOutCubic as n } from "./easing.js";
2
+ class l {
3
+ #s = 0;
4
+ /** `null` = armed but awaiting the first tick to stamp the start. */
5
+ #t = null;
6
+ #i = !0;
7
+ /** Clock forwarded by the renderer's `tickAnimations` — keeps test
8
+ * harnesses (which stub `performance.now`) in control of progression. */
9
+ #e = 0;
10
+ /**
11
+ * Arm the wave for the upcoming first paint. No-op (stays settled) when
12
+ * the duration is zero/negative or the user prefers reduced motion.
13
+ */
14
+ arm(t) {
15
+ if (t <= 0 || u()) {
16
+ this.#i = !0;
17
+ return;
18
+ }
19
+ this.#s = t, this.#t = null, this.#i = !1;
20
+ }
21
+ /** True while the wave still has frames to produce. */
22
+ get active() {
23
+ return !this.#i;
24
+ }
25
+ /**
26
+ * Advance the clock. Call once per render pass, before any progress
27
+ * reads. Settles the wave once the full `2 × durationMs` window elapsed.
28
+ */
29
+ tick(t) {
30
+ this.#i || (this.#e = t, this.#t === null && (this.#t = t), t - this.#t >= this.#s * 2 && (this.#i = !0));
31
+ }
32
+ /**
33
+ * Eased entrance progress in `[0, 1]` for an element at normalized
34
+ * x-position `position` (0 = left edge of the visible window, 1 = right).
35
+ */
36
+ progressAt(t) {
37
+ if (this.#i) return 1;
38
+ if (this.#t === null) return 0;
39
+ const e = s(t) * this.#s, r = s((this.#e - this.#t - e) / this.#s);
40
+ return h(r);
41
+ }
42
+ /** Eased reveal-front position in `[0, 1]` across the full wave window. */
43
+ sweep() {
44
+ if (this.#i) return 1;
45
+ if (this.#t === null) return 0;
46
+ const t = s((this.#e - this.#t) / (this.#s * 2));
47
+ return n(t);
48
+ }
49
+ /** Raw (unclamped-by-easing) linear wave progress — drives fades that need
50
+ * to key off wall-clock position, e.g. the line head-glow bell curve. */
51
+ linear() {
52
+ return this.#i ? 1 : this.#t === null ? 0 : s((this.#e - this.#t) / (this.#s * 2));
53
+ }
54
+ /** Abort the wave — everything reads settled from the next frame. Called
55
+ * when the user pans/zooms mid-intro. */
56
+ finish() {
57
+ this.#i = !0;
58
+ }
59
+ }
60
+ function s(i) {
61
+ return i <= 0 ? 0 : i >= 1 ? 1 : i;
62
+ }
63
+ function u() {
64
+ return typeof matchMedia != "function" ? !1 : matchMedia("(prefers-reduced-motion: reduce)").matches;
65
+ }
66
+ export {
67
+ l as IntroWave
68
+ };
@@ -1,15 +1,14 @@
1
- import { resolveAxisTextColor as w, resolveAxisFontSize as F } from "../theme/resolve.js";
2
- import { formatTime as $ } from "../utils/time.js";
3
- const A = 0.01;
4
- function I(g) {
1
+ import { resolveAxisTextColor as w, resolveAxisFontSize as A } from "../theme/resolve.js";
2
+ const F = 0.01;
3
+ function $(g) {
5
4
  const { chart: e, container: h, axis: r } = g, s = /* @__PURE__ */ new Map();
6
- let m = null;
7
- const y = r === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
5
+ let y = null;
6
+ const m = r === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
8
7
  function k() {
9
8
  return r === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
10
9
  }
11
10
  function p(t, o) {
12
- return r === "x" ? $(t, o) : e.yScale.formatY(t);
11
+ return r === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
13
12
  }
14
13
  function C(t, o) {
15
14
  if (r === "x") {
@@ -19,20 +18,20 @@ function I(g) {
19
18
  t.style.top = `${e.yScale.valueToY(o)}px`;
20
19
  }
21
20
  function x(t, o) {
22
- t.style.color = w(o, r), t.style.fontSize = `${F(o, r)}px`, t.style.fontFamily = o.typography.fontFamily;
21
+ t.style.color = w(o, r), t.style.fontSize = `${A(o, r)}px`, t.style.fontFamily = o.typography.fontFamily;
23
22
  }
24
23
  function T(t, o, u) {
25
24
  const n = document.createElement("span");
26
25
  return n.textContent = p(t, o), n.style.position = "absolute", n.style.userSelect = "none", x(n, u), n.style.willChange = "opacity", r === "x" ? (n.style.transform = "translateX(-50%)", n.style.whiteSpace = "nowrap") : (n.style.right = "8px", n.style.transform = "translateY(-50%)", n.style.fontVariantNumeric = "tabular-nums"), h.appendChild(n), n;
27
26
  }
28
27
  function l() {
29
- const t = e.getTheme(), o = t !== m;
30
- m = t;
28
+ const t = e.getTheme(), o = t !== y;
29
+ y = t;
31
30
  const { ticks: u, tickInterval: n } = k();
32
- y.setCurrentTicks(u);
33
- const { entries: d } = y.snapshot(), v = /* @__PURE__ */ new Set();
31
+ m.setCurrentTicks(u);
32
+ const { entries: d } = m.snapshot(), v = /* @__PURE__ */ new Set();
34
33
  for (const { value: a, opacity: f } of d) {
35
- if (f <= A) continue;
34
+ if (f <= F) continue;
36
35
  v.add(a);
37
36
  let i = s.get(a);
38
37
  if (i === void 0)
@@ -56,5 +55,5 @@ function I(g) {
56
55
  };
57
56
  }
58
57
  export {
59
- I as mountAxisLabels
58
+ $ as mountAxisLabels
60
59
  };
@@ -0,0 +1,56 @@
1
+ import { ScalarSpring as g } from "../animation/scalar-spring.js";
2
+ const r = 320, m = 0.15;
3
+ class w {
4
+ #t;
5
+ #e;
6
+ #i = !1;
7
+ constructor(i) {
8
+ this.#t = new g(i), this.#e = i;
9
+ }
10
+ frame(i) {
11
+ const { target: t, firstVisible: n, introFront: o, now: s, glide: u = !0, countUp: l = !0, reducedMotion: f = !1 } = i;
12
+ if (f || !u && !l)
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 h = n + (t - n) * o, a = l ? h : 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 };
17
+ }
18
+ if (!this.#i)
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)
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;
23
+ if (c <= 0)
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) > V && (this.#t.retarget(t, { now: s, settleMs: c }), this.#e = t);
26
+ const p = this.#t.tick(s);
27
+ return { positionValue: this.#t.current, textValue: t, opacity: 1, animating: p };
28
+ }
29
+ #s(i) {
30
+ return i >= 1 ? 1 : d(i / m);
31
+ }
32
+ }
33
+ const V = 1e-9;
34
+ function d(e) {
35
+ return e <= 0 ? 0 : e >= 1 ? 1 : e;
36
+ }
37
+ function x(e) {
38
+ return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: r } : {
39
+ glide: e.glide ?? !0,
40
+ countUp: e.countUp ?? !0,
41
+ settleMs: e.settleMs ?? r
42
+ };
43
+ }
44
+ function y() {
45
+ return typeof matchMedia != "function" ? !1 : matchMedia("(prefers-reduced-motion: reduce)").matches;
46
+ }
47
+ function U(e, i, t) {
48
+ const { from: n } = e.getVisibleRange();
49
+ return e.getStackedValueAtTime(i, n) ?? t;
50
+ }
51
+ export {
52
+ w as BadgeAnimator,
53
+ U as firstVisibleValue,
54
+ y as prefersReducedMotion,
55
+ x as resolveAnimate
56
+ };
@@ -1,26 +1,41 @@
1
- import { renderEdgeIndicator as a } from "../components/edge-indicator.js";
2
- function i(e) {
1
+ import { renderEdgeIndicator as s } from "../components/edge-indicator.js";
2
+ function d(e) {
3
3
  const o = performance.now();
4
4
  for (const t of ["left", "right"]) {
5
- const n = e.edgeStates[t];
6
- if (n === "idle" || n === "has-more") continue;
7
- const r = e.resolveBoundary(t);
8
- r !== null && a({
5
+ let r = e.edgeStates[t], n = 1;
6
+ if (r === "idle" || r === "has-more") {
7
+ const a = e.edgeExitFades[t];
8
+ if (a === null) continue;
9
+ r = "loading", n = a;
10
+ }
11
+ const l = e.resolveBoundary(t);
12
+ if (l === null) continue;
13
+ const { context: c } = e.scope;
14
+ n < 1 && (c.save(), c.globalAlpha *= n), s({
9
15
  scope: e.scope,
10
16
  timeScale: e.timeScale,
11
17
  theme: e.theme,
18
+ chartMediaWidth: e.chartMediaWidth,
12
19
  chartMediaHeight: e.chartMediaHeight,
13
- boundaryTime: r,
20
+ boundaryTime: l,
14
21
  side: t,
15
- state: n,
16
- now: o
17
- });
22
+ state: r,
23
+ now: o,
24
+ customIndicator: e.edgeIndicatorFns[t],
25
+ resolveEdgeAnchor: () => e.resolveEdgeAnchor(t, l),
26
+ resolveEdgeBarSpacing: () => e.resolveEdgeBarSpacing(),
27
+ reportPlaceholders: (a) => e.reportPlaceholders(t, a)
28
+ }), n < 1 && c.restore();
18
29
  }
19
30
  }
20
- function c(e, o, t) {
31
+ function g(e, o, t) {
21
32
  return o !== null ? o : e === "left" ? t.first ?? null : t.last ?? null;
22
33
  }
34
+ function u(e, o) {
35
+ return "close" in o ? e === "left" ? o.open : o.close : o.value;
36
+ }
23
37
  export {
24
- i as drawEdgeIndicators,
25
- c as resolveEdgeBoundary
38
+ d as drawEdgeIndicators,
39
+ u as resolveEdgeAnchorValue,
40
+ g as resolveEdgeBoundary
26
41
  };