@wick-charts/vue 0.6.1 → 0.6.3

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 (52) hide show
  1. package/dist/ChartContainer.vue.js +43 -37
  2. package/dist/LineSeries.vue.js +2 -2
  3. package/dist/composables.js +39 -26
  4. package/dist/core/dist/animation/config.js +66 -64
  5. package/dist/core/dist/animation/intro-wave.js +19 -21
  6. package/dist/core/dist/animation/reduced-motion.js +6 -0
  7. package/dist/core/dist/axis/dom-labels.js +58 -45
  8. package/dist/core/dist/chart/badge-animator.js +15 -19
  9. package/dist/core/dist/chart/options.js +5 -5
  10. package/dist/core/dist/chart/scale-guards.js +26 -0
  11. package/dist/core/dist/chart/y-target.js +46 -19
  12. package/dist/core/dist/chart.js +752 -570
  13. package/dist/core/dist/components/crosshair.js +8 -8
  14. package/dist/core/dist/components/grid.js +28 -15
  15. package/dist/core/dist/components/marker.js +28 -28
  16. package/dist/core/dist/components/reference-line.js +16 -16
  17. package/dist/core/dist/interactions/handler.js +3 -2
  18. package/dist/core/dist/interactions/zoom.js +6 -5
  19. package/dist/core/dist/navigator/controller.js +43 -40
  20. package/dist/core/dist/perf/perf-hud.js +3 -3
  21. package/dist/core/dist/scales/log-scale.js +76 -0
  22. package/dist/core/dist/scales/tick-tracker.js +2 -2
  23. package/dist/core/dist/scales/x-scale.js +47 -32
  24. package/dist/core/dist/scales/y-scale.js +155 -38
  25. package/dist/core/dist/series/bar-intro.js +11 -11
  26. package/dist/core/dist/series/bar.js +299 -249
  27. package/dist/core/dist/series/base-multi-layer.js +100 -76
  28. package/dist/core/dist/series/candlestick.js +252 -249
  29. package/dist/core/dist/series/heatmap.js +16 -16
  30. package/dist/core/dist/series/line-intro.js +18 -18
  31. package/dist/core/dist/series/line.js +522 -424
  32. package/dist/core/dist/series/scale-stack.js +25 -0
  33. package/dist/core/dist/tooltip-position.js +5 -5
  34. package/dist/core/dist/utils/pixel-grid.js +10 -0
  35. package/dist/index.d.ts +279 -32
  36. package/dist/index.js +59 -57
  37. package/dist/ui/Crosshair.vue.js +14 -14
  38. package/dist/ui/HeatmapTooltip.vue.js +6 -6
  39. package/dist/ui/PieTooltip.vue.js +4 -4
  40. package/dist/ui/TimeAxis.vue.js +23 -22
  41. package/dist/ui/Tooltip.vue.js +71 -69
  42. package/dist/ui/YAxis.vue.js +25 -24
  43. package/dist/ui/YLabel.vue.js +50 -49
  44. package/package.json +2 -2
  45. package/src/ChartContainer.vue +20 -8
  46. package/src/composables.ts +35 -1
  47. package/src/index.ts +5 -0
  48. package/src/ui/Crosshair.vue +2 -2
  49. package/src/ui/TimeAxis.vue +7 -4
  50. package/src/ui/Tooltip.vue +4 -1
  51. package/src/ui/YAxis.vue +5 -3
  52. package/src/ui/YLabel.vue +3 -3
@@ -1,6 +1,6 @@
1
- import { defineComponent as U, ref as r, shallowRef as P, provide as l, computed as v, onMounted as G, nextTick as g, onUnmounted as I, watch as d, openBlock as y, createElementBlock as m, normalizeStyle as q, createElementVNode as o, createCommentVNode as w, renderSlot as J } from "vue";
2
- import { ChartInstance as T } from "./core/dist/chart.js";
3
- import { deepEqual as z } from "./core/dist/utils/deep-equal.js";
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";
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 = {
@@ -11,7 +11,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
11
11
  key: 1,
12
12
  "data-chart-series-overlay": "",
13
13
  style: { position: "absolute", inset: "0", "pointer-events": "none", "z-index": "3" }
14
- }, H = 24, ce = /* @__PURE__ */ U({
14
+ }, z = 24, ce = /* @__PURE__ */ U({
15
15
  __name: "ChartContainer",
16
16
  props: {
17
17
  theme: { default: () => Q.theme },
@@ -19,7 +19,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
19
19
  padding: {},
20
20
  viewport: {},
21
21
  visibleRange: {},
22
- gradient: { type: Boolean, default: !0 },
22
+ gradient: { type: Boolean, default: !1 },
23
23
  interactive: { type: Boolean, default: !0 },
24
24
  grid: {},
25
25
  fade: { type: [Boolean, Object], default: void 0 },
@@ -35,24 +35,30 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
35
35
  onCrosshairMove: {}
36
36
  },
37
37
  setup(b) {
38
- const e = b, s = r(), a = P(null), x = P(e.theme), c = e.perf, p = e.onEdgeReached, C = r(null), R = r(null), k = r(null), _ = r(null), E = r(null), B = r(null);
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);
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
- const u = r(0), 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(() => {
41
+ const s = d(0);
42
+ r(
43
+ () => [a.value, e.headerLayout === "overlay" ? s.value : 0],
44
+ ([t, i]) => t?.setHeaderHeight(i),
45
+ { immediate: !0 }
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(() => {
42
48
  if (!O.value) return 0;
43
49
  const t = typeof e.fade == "object" ? e.fade.overlap : void 0;
44
- return t !== void 0 ? Math.max(0, t) : u.value / 2;
45
- }), j = v(() => {
50
+ return t !== void 0 ? Math.max(0, t) : s.value / 2;
51
+ }), L = v(() => {
46
52
  if (!O.value) return 0;
47
53
  if (typeof e.fade == "object" && e.fade.top !== void 0) return e.fade.top;
48
- const t = e.headerLayout === "overlay" ? u.value : 0;
49
- return t > 0 ? t + H : H;
50
- }), L = v(
51
- () => e.headerLayout === "overlay" ? Math.max(0, u.value - S.value) : 0
54
+ const t = e.headerLayout === "overlay" ? s.value : 0;
55
+ return t > 0 ? t + z : z;
56
+ }), j = v(
57
+ () => e.headerLayout === "overlay" ? Math.max(0, s.value - S.value) : 0
52
58
  );
53
59
  function A() {
54
60
  if (!a.value) return;
55
- const i = { top: (e.padding?.top ?? 20) + L.value };
61
+ const i = { top: (e.padding?.top ?? 20) + j.value };
56
62
  e.padding?.bottom !== void 0 && (i.bottom = e.padding.bottom), e.padding?.right !== void 0 && (i.right = e.padding.right), e.padding?.left !== void 0 && (i.left = e.padding.left), a.value.setPadding(i);
57
63
  }
58
64
  function M(t) {
@@ -70,84 +76,84 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
70
76
  a.value.setFade({ top: 0, right: 0, left: 0 });
71
77
  return;
72
78
  }
73
- const t = { top: j.value };
79
+ const t = { top: L.value };
74
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);
75
81
  }
76
82
  function V() {
77
83
  f?.disconnect(), f = null;
78
84
  const t = e.headerLayout === "overlay" ? C.value : null;
79
85
  if (!t) {
80
- u.value = 0, A();
86
+ s.value = 0, A();
81
87
  return;
82
88
  }
83
89
  const i = () => {
84
- u.value = t.getBoundingClientRect().height, A();
90
+ s.value = t.getBoundingClientRect().height, A();
85
91
  };
86
92
  i(), f = new ResizeObserver(i), f.observe(t);
87
93
  }
88
- function K(t) {
94
+ function H(t) {
89
95
  t.on("pointClick", (n) => e.onPointClick?.(n)), t.on("pointDoubleClick", (n) => e.onPointDoubleClick?.(n)), t.on("seriesHover", (n) => e.onSeriesHover?.(n)), t.on("crosshairMove", (n) => e.onCrosshairMove?.(n));
90
96
  const i = () => e.onVisibleRangeChange?.(t.getVisibleRange());
91
97
  t.on("viewportChange", i), t.on("dataUpdate", i), t.on("seriesChange", i);
92
98
  }
93
99
  G(async () => {
94
- if (!s.value) return;
100
+ if (!u.value) return;
95
101
  const t = {};
96
- 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), p && (t.onEdgeReached = p), e.animations !== void 0 && (t.animations = e.animations), M(t), a.value = new T(s.value, t), K(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 F(u.value, t), H(a.value), e.onReady?.(a.value), await g(), V();
97
103
  }), I(() => {
98
104
  f?.disconnect(), f = null, a.value?.destroy(), a.value = null;
99
- }), d(
105
+ }), r(
100
106
  () => e.headerLayout,
101
107
  async () => {
102
108
  a.value && (await g(), V());
103
109
  }
104
- ), d(
110
+ ), r(
105
111
  () => e.theme,
106
112
  (t) => {
107
113
  a.value && t && (a.value.setTheme(t), x.value = t);
108
114
  }
109
- ), d(
115
+ ), r(
110
116
  () => e.axis,
111
117
  (t) => {
112
118
  a.value && t && a.value.setAxis(t);
113
119
  },
114
120
  { deep: !0 }
115
- ), d(
121
+ ), r(
116
122
  () => e.grid?.visible,
117
123
  () => {
118
124
  a.value && e.grid !== void 0 && a.value.setGrid(e.grid);
119
125
  }
120
126
  );
121
- let D = e.animations;
122
- d(
127
+ let K = e.animations;
128
+ r(
123
129
  () => e.animations,
124
130
  async (t) => {
125
- if (z(t, D) || (D = t, !a.value || !s.value)) return;
131
+ if (P(t, K) || (K = t, !a.value || !u.value)) return;
126
132
  a.value.destroy(), a.value = null, await g();
127
133
  const i = {};
128
- 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), p && (i.onEdgeReached = p), t !== void 0 && (i.animations = t), M(i), a.value = new T(s.value, i), K(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 F(u.value, i), H(a.value), e.onReady?.(a.value);
129
135
  }
130
136
  );
131
- let h;
132
- d(
137
+ let p;
138
+ r(
133
139
  () => [a.value, e.visibleRange],
134
140
  async ([t, i]) => {
135
- !t || i === void 0 || h !== void 0 && h.instance === t && z(h.spec, i) || (h = { instance: t, spec: i }, await g(), t.setVisibleRange(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));
136
142
  },
137
143
  { immediate: !0 }
138
- ), d(
144
+ ), r(
139
145
  () => [
140
146
  e.padding?.top,
141
147
  e.padding?.bottom,
142
148
  typeof e.padding?.right == "object" ? e.padding.right.intervals : e.padding?.right,
143
149
  typeof e.padding?.left == "object" ? e.padding.left.intervals : e.padding?.left,
144
- L.value
150
+ j.value
145
151
  ],
146
152
  A
147
- ), d(() => [a.value, j.value, e.fade], $, { immediate: !0 });
153
+ ), r(() => [a.value, L.value, e.fade], $, { immediate: !0 });
148
154
  const N = v(() => {
149
- const t = x.value, [i, n] = t?.chartGradient ?? ["transparent", "transparent"], F = t?.background ?? "transparent";
150
- 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%, ${F} 70%, ${n} 100%)` : F}`;
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}`;
151
157
  });
152
158
  return (t, i) => (y(), m("div", {
153
159
  style: q(N.value)
@@ -168,7 +174,7 @@ const ae = { style: { display: "flex", "flex-direction": "row", flex: "1", "min-
168
174
  ])) : w("", !0),
169
175
  o("div", {
170
176
  ref_key: "containerRef",
171
- ref: s,
177
+ ref: u,
172
178
  style: { position: "relative", flex: "1", "min-width": "0", "min-height": "0", overflow: "hidden" }
173
179
  }, [
174
180
  b.headerLayout === "overlay" ? (y(), m("div", {
@@ -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 E = /* @__PURE__ */ u({
5
+ const V = /* @__PURE__ */ u({
6
6
  __name: "LineSeries",
7
7
  props: {
8
8
  data: {},
@@ -46,5 +46,5 @@ const E = /* @__PURE__ */ u({
46
46
  }
47
47
  });
48
48
  export {
49
- E as default
49
+ V as default
50
50
  };
@@ -1,44 +1,57 @@
1
- import { ref as a, onMounted as u, onUnmounted as i } from "vue";
2
- function f(e) {
3
- const o = a(e.getVisibleRange()), n = () => {
1
+ import { ref as u, onMounted as a, onUnmounted as l } from "vue";
2
+ function x(e) {
3
+ const o = u(e.getVisibleRange()), n = () => {
4
4
  o.value = e.getVisibleRange();
5
5
  };
6
- return u(() => e.on("viewportChange", n)), i(() => e.off("viewportChange", n)), o;
6
+ return a(() => e.on("viewportChange", n)), l(() => e.off("viewportChange", n)), o;
7
7
  }
8
- function p(e) {
9
- const o = a(e.getYRange()), n = () => {
8
+ function d(e) {
9
+ const o = u(e.getYRange()), n = () => {
10
10
  o.value = e.getYRange();
11
11
  };
12
- return u(() => e.on("viewportChange", n)), i(() => e.off("viewportChange", n)), o;
12
+ return a(() => e.on("viewportChange", n)), l(() => e.off("viewportChange", n)), o;
13
+ }
14
+ function r(e) {
15
+ return { yAxisPosition: e.yAxisPosition, yAxisWidth: e.yAxisWidth, xAxisHeight: e.xAxisHeight };
16
+ }
17
+ function p(e) {
18
+ const o = u(r(e)), n = () => {
19
+ const i = r(e), s = o.value;
20
+ s.yAxisPosition === i.yAxisPosition && s.yAxisWidth === i.yAxisWidth && s.xAxisHeight === i.xAxisHeight || (o.value = i);
21
+ };
22
+ return a(() => {
23
+ n(), e.on("viewportChange", n);
24
+ }), l(() => e.off("viewportChange", n)), o;
13
25
  }
14
- function d(e, o) {
15
- let n = e.getLastValue(o), t = n ? e.yScale.valueToY(n.value) : null;
16
- const v = a(n), l = () => {
17
- const s = e.getLastValue(o), g = s ? e.yScale.valueToY(s.value) : null;
18
- n?.value === s?.value && n?.isLive === s?.isLive && t === g || (n = s, t = g, v.value = s);
26
+ function A(e, o) {
27
+ let n = e.getLastValue(o), i = n ? e.yScale.valueToY(n.value) : null;
28
+ const s = u(n), g = () => {
29
+ const t = e.getLastValue(o), v = t ? e.yScale.valueToY(t.value) : null;
30
+ n?.value === t?.value && n?.isLive === t?.isLive && i === v || (n = t, i = v, s.value = t);
19
31
  };
20
- return u(() => {
21
- e.on("dataUpdate", l), e.on("viewportChange", l);
22
- }), i(() => {
23
- e.off("dataUpdate", l), e.off("viewportChange", l);
24
- }), v;
32
+ return a(() => {
33
+ e.on("dataUpdate", g), e.on("viewportChange", g);
34
+ }), l(() => {
35
+ e.off("dataUpdate", g), e.off("viewportChange", g);
36
+ }), s;
25
37
  }
26
38
  function C(e, o) {
27
- const n = a(e.getPreviousClose(o)), t = () => {
39
+ const n = u(e.getPreviousClose(o)), i = () => {
28
40
  n.value = e.getPreviousClose(o);
29
41
  };
30
- return u(() => e.on("dataUpdate", t)), i(() => e.off("dataUpdate", t)), n;
42
+ return a(() => e.on("dataUpdate", i)), l(() => e.off("dataUpdate", i)), n;
31
43
  }
32
- function Y(e) {
33
- const o = a(e.getCrosshairPosition()), n = () => {
44
+ function y(e) {
45
+ const o = u(e.getCrosshairPosition()), n = () => {
34
46
  o.value = e.getCrosshairPosition();
35
47
  };
36
- return u(() => e.on("crosshairMove", n)), i(() => e.off("crosshairMove", n)), o;
48
+ return a(() => e.on("crosshairMove", n)), l(() => e.off("crosshairMove", n)), o;
37
49
  }
38
50
  export {
39
- Y as useCrosshairPosition,
40
- d as useLastYValue,
51
+ p as useAxisLayout,
52
+ y as useCrosshairPosition,
53
+ A as useLastYValue,
41
54
  C as usePreviousClose,
42
- f as useVisibleRange,
43
- p as useYRange
55
+ x as useVisibleRange,
56
+ d as useYRange
44
57
  };
@@ -1,23 +1,23 @@
1
- import { spring as d } from "./spring.js";
1
+ import { spring as U } from "./spring.js";
2
2
  import { resolveAnimationTime as r } from "./time.js";
3
- import { hermite as D } from "./y-range-hermite.js";
3
+ import { hermite as S } from "./y-range-hermite.js";
4
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 = {
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 = {
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
9
  pie: { entryMs: 0, updateMs: 0 },
10
10
  heatmap: { entryMs: 0, updateMs: 0 }
11
11
  };
12
- function w(i) {
12
+ function q(i) {
13
13
  if (i !== null && typeof i == "object")
14
14
  return {
15
- stickyMs: r(i.max, T),
15
+ stickyMs: r(i.max, _),
16
16
  stickyFloorMs: r(i.min, m)
17
17
  };
18
18
  if (i === void 0)
19
- return { stickyMs: T, stickyFloorMs: m };
20
- const e = r(i, T);
19
+ return { stickyMs: _, stickyFloorMs: m };
20
+ const e = r(i, _);
21
21
  return { stickyMs: e, stickyFloorMs: e };
22
22
  }
23
23
  class y {
@@ -39,32 +39,33 @@ class y {
39
39
  {
40
40
  y: { curve: u(), settleMs: 0, stickyMs: 0, stickyFloorMs: 0, gestureMs: 0 },
41
41
  x: { curve: u(), settleMs: 0, gestureMs: 0 },
42
- ticksMs: 0
42
+ ticksMs: 0,
43
+ gridMs: 0
43
44
  },
44
45
  0,
45
- A
46
+ f
46
47
  );
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
+ 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 ? {
48
49
  curve: u(),
49
50
  settleMs: 0,
50
51
  stickyMs: 0,
51
52
  stickyFloorMs: 0,
52
53
  gestureMs: 0
53
54
  } : {
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 ? {
55
+ curve: M?.curve ?? S(),
56
+ settleMs: r(M?.settle, X),
57
+ ...q(M?.sticky),
58
+ gestureMs: r(M?.gesture, $)
59
+ }, A = o === !1 ? {
59
60
  curve: u(),
60
61
  settleMs: 0,
61
62
  gestureMs: 0
62
63
  } : {
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);
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);
68
69
  }
69
70
  /**
70
71
  * Per-renderer-type chart-level option payload — merged BEFORE user
@@ -105,8 +106,8 @@ class y {
105
106
  overrides(e) {
106
107
  const s = {};
107
108
  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;
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;
110
111
  }
111
112
  if (e === "pie")
112
113
  return this.series.pie.entryMs === 0 && (s.entryMs = 0), s;
@@ -120,53 +121,54 @@ class y {
120
121
  return t === 0 && (s.entryMs = 0), M === 0 && (s.smoothMs = 0), o === 0 && (s.introMs = 0), s;
121
122
  }
122
123
  }
123
- function j(i) {
124
- if (i === !1) return A;
124
+ function z(i) {
125
+ if (i === !1) return f;
125
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 } : {
126
- entryMs: r(e?.entry, F),
127
- smoothMs: r(e?.smooth, S),
128
- pulseMs: r(e?.pulse, g),
129
- introMs: r(e?.intro, k)
127
+ entryMs: r(e?.entry, k),
128
+ smoothMs: r(e?.smooth, g),
129
+ pulseMs: r(e?.pulse, N),
130
+ introMs: r(e?.intro, I)
130
131
  }, 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)
132
+ 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 } : {
136
+ 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 } : {
140
+ 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)
144
145
  };
145
- return { line: n, candlestick: a, bar: c, pie: l, heatmap: E };
146
+ return { line: n, candlestick: a, bar: l, pie: c, heatmap: T };
146
147
  }
147
148
  export {
148
149
  y as AnimationConfig,
149
- v as DEFAULT_BAR_ENTRY,
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,
150
+ O as DEFAULT_BAR_ENTRY,
151
+ b as DEFAULT_BAR_INTRO,
152
+ C as DEFAULT_BAR_SMOOTH,
153
+ 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,
160
+ 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,
171
173
  m as DEFAULT_Y_STICKY_MIN_MS
172
174
  };
@@ -1,68 +1,66 @@
1
1
  import { easeOutCubic as h, easeInOutCubic as n } from "./easing.js";
2
- class l {
3
- #s = 0;
2
+ import { prefersReducedMotion as u } from "./reduced-motion.js";
3
+ class o {
4
+ #i = 0;
4
5
  /** `null` = armed but awaiting the first tick to stamp the start. */
5
6
  #t = null;
6
- #i = !0;
7
+ #s = !0;
7
8
  /** Clock forwarded by the renderer's `tickAnimations` — keeps test
8
9
  * harnesses (which stub `performance.now`) in control of progression. */
9
- #e = 0;
10
+ #r = 0;
10
11
  /**
11
12
  * Arm the wave for the upcoming first paint. No-op (stays settled) when
12
13
  * the duration is zero/negative or the user prefers reduced motion.
13
14
  */
14
15
  arm(t) {
15
16
  if (t <= 0 || u()) {
16
- this.#i = !0;
17
+ this.#s = !0;
17
18
  return;
18
19
  }
19
- this.#s = t, this.#t = null, this.#i = !1;
20
+ this.#i = t, this.#t = null, this.#s = !1;
20
21
  }
21
22
  /** True while the wave still has frames to produce. */
22
23
  get active() {
23
- return !this.#i;
24
+ return !this.#s;
24
25
  }
25
26
  /**
26
27
  * Advance the clock. Call once per render pass, before any progress
27
28
  * reads. Settles the wave once the full `2 × durationMs` window elapsed.
28
29
  */
29
30
  tick(t) {
30
- this.#i || (this.#e = t, this.#t === null && (this.#t = t), t - this.#t >= this.#s * 2 && (this.#i = !0));
31
+ this.#s || (this.#r = t, this.#t === null && (this.#t = t), t - this.#t >= this.#i * 2 && (this.#s = !0));
31
32
  }
32
33
  /**
33
34
  * Eased entrance progress in `[0, 1]` for an element at normalized
34
35
  * x-position `position` (0 = left edge of the visible window, 1 = right).
35
36
  */
36
37
  progressAt(t) {
37
- if (this.#i) return 1;
38
+ if (this.#s) return 1;
38
39
  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);
40
+ const r = i(t) * this.#i, e = i((this.#r - this.#t - r) / this.#i);
41
+ return h(e);
41
42
  }
42
43
  /** Eased reveal-front position in `[0, 1]` across the full wave window. */
43
44
  sweep() {
44
- if (this.#i) return 1;
45
+ if (this.#s) return 1;
45
46
  if (this.#t === null) return 0;
46
- const t = s((this.#e - this.#t) / (this.#s * 2));
47
+ const t = i((this.#r - this.#t) / (this.#i * 2));
47
48
  return n(t);
48
49
  }
49
50
  /** Raw (unclamped-by-easing) linear wave progress — drives fades that need
50
51
  * to key off wall-clock position, e.g. the line head-glow bell curve. */
51
52
  linear() {
52
- return this.#i ? 1 : this.#t === null ? 0 : s((this.#e - this.#t) / (this.#s * 2));
53
+ return this.#s ? 1 : this.#t === null ? 0 : i((this.#r - this.#t) / (this.#i * 2));
53
54
  }
54
55
  /** Abort the wave — everything reads settled from the next frame. Called
55
56
  * when the user pans/zooms mid-intro. */
56
57
  finish() {
57
- this.#i = !0;
58
+ this.#s = !0;
58
59
  }
59
60
  }
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;
61
+ function i(s) {
62
+ return s <= 0 ? 0 : s >= 1 ? 1 : s;
65
63
  }
66
64
  export {
67
- l as IntroWave
65
+ o as IntroWave
68
66
  };
@@ -0,0 +1,6 @@
1
+ function e() {
2
+ return typeof matchMedia != "function" ? !1 : matchMedia("(prefers-reduced-motion: reduce)").matches;
3
+ }
4
+ export {
5
+ e as prefersReducedMotion
6
+ };