@wick-charts/vue 0.6.1 → 0.6.2

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.
@@ -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
+ };
@@ -3,47 +3,47 @@ const F = 0.01;
3
3
  function $(g) {
4
4
  const { chart: e, container: h, axis: r } = g, s = /* @__PURE__ */ new Map();
5
5
  let y = null;
6
- const m = r === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
6
+ const p = r === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
7
7
  function k() {
8
8
  return r === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
9
9
  }
10
- function p(t, o) {
10
+ function m(t, o) {
11
11
  return r === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
12
12
  }
13
13
  function C(t, o) {
14
14
  if (r === "x") {
15
- t.style.left = `${e.timeScale.timeToX(o)}px`;
15
+ t.style.left = `${e.timeScale.timeToSnappedX(o)}px`;
16
16
  return;
17
17
  }
18
- t.style.top = `${e.yScale.valueToY(o)}px`;
18
+ t.style.top = `${e.yScale.valueToSnappedY(o)}px`;
19
19
  }
20
20
  function x(t, o) {
21
21
  t.style.color = w(o, r), t.style.fontSize = `${A(o, r)}px`, t.style.fontFamily = o.typography.fontFamily;
22
22
  }
23
- function T(t, o, u) {
23
+ function d(t, o, u) {
24
24
  const n = document.createElement("span");
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;
25
+ return n.textContent = m(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;
26
26
  }
27
27
  function l() {
28
28
  const t = e.getTheme(), o = t !== y;
29
29
  y = t;
30
30
  const { ticks: u, tickInterval: n } = k();
31
- m.setCurrentTicks(u);
32
- const { entries: d } = m.snapshot(), v = /* @__PURE__ */ new Set();
33
- for (const { value: a, opacity: f } of d) {
31
+ p.setCurrentTicks(u);
32
+ const { entries: T } = p.snapshot(), S = /* @__PURE__ */ new Set();
33
+ for (const { value: a, opacity: f } of T) {
34
34
  if (f <= F) continue;
35
- v.add(a);
35
+ S.add(a);
36
36
  let i = s.get(a);
37
37
  if (i === void 0)
38
- i = T(a, n, t), s.set(a, i);
38
+ i = d(a, n, t), s.set(a, i);
39
39
  else {
40
- const S = p(a, n);
41
- i.textContent !== S && (i.textContent = S), o && x(i, t);
40
+ const v = m(a, n);
41
+ i.textContent !== v && (i.textContent = v), o && x(i, t);
42
42
  }
43
43
  C(i, a), i.style.opacity = String(f);
44
44
  }
45
45
  for (const [a, f] of s)
46
- v.has(a) || (f.remove(), s.delete(a));
46
+ S.has(a) || (f.remove(), s.delete(a));
47
47
  }
48
48
  function c() {
49
49
  e.getAnimationState().animating || l();
@@ -1,6 +1,6 @@
1
1
  import { ScalarSpring as g } from "../animation/scalar-spring.js";
2
- const r = 320, m = 0.15;
3
- class w {
2
+ const r = 320, V = 0.15;
3
+ class x {
4
4
  #t;
5
5
  #e;
6
6
  #i = !1;
@@ -8,11 +8,11 @@ class w {
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: f = !1 } = i;
12
- if (f || !u && !l)
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)
13
13
  return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
14
14
  if (o < 1) {
15
- const h = n + (t - n) * o, a = l ? h : t;
15
+ const f = n + (t - n) * o, a = l ? f : t;
16
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
17
  }
18
18
  if (!this.#i)
@@ -22,35 +22,31 @@ class w {
22
22
  const c = i.settleMs ?? r;
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) > 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 };
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 };
28
28
  }
29
29
  #s(i) {
30
- return i >= 1 ? 1 : d(i / m);
30
+ return i >= 1 ? 1 : d(i / V);
31
31
  }
32
32
  }
33
- const V = 1e-9;
33
+ const m = 1e-9;
34
34
  function d(e) {
35
35
  return e <= 0 ? 0 : e >= 1 ? 1 : e;
36
36
  }
37
- function x(e) {
37
+ function M(e) {
38
38
  return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: r } : {
39
39
  glide: e.glide ?? !0,
40
40
  countUp: e.countUp ?? !0,
41
41
  settleMs: e.settleMs ?? r
42
42
  };
43
43
  }
44
- function y() {
45
- return typeof matchMedia != "function" ? !1 : matchMedia("(prefers-reduced-motion: reduce)").matches;
46
- }
47
- function U(e, i, t) {
44
+ function y(e, i, t) {
48
45
  const { from: n } = e.getVisibleRange();
49
46
  return e.getStackedValueAtTime(i, n) ?? t;
50
47
  }
51
48
  export {
52
- w as BadgeAnimator,
53
- U as firstVisibleValue,
54
- y as prefersReducedMotion,
55
- x as resolveAnimate
49
+ x as BadgeAnimator,
50
+ y as firstVisibleValue,
51
+ M as resolveAnimate
56
52
  };