@wick-charts/vue 0.6.0 → 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.
@@ -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
  };
@@ -1,5 +1,15 @@
1
- import { DEFAULT_MAX_VISIBLE_BARS as o, MIN_VISIBLE_BARS as n } from "./pan-zoom-math.js";
2
- function s(t) {
1
+ import { DEFAULT_MAX_VISIBLE_BARS as i, MIN_VISIBLE_BARS as r } from "./pan-zoom-math.js";
2
+ function n(t) {
3
+ return t === void 0 || !Number.isFinite(t) || t <= 0 ? 0 : t;
4
+ }
5
+ function a(t) {
6
+ return {
7
+ top: n(t?.top),
8
+ right: t?.right === void 0 ? null : n(t.right),
9
+ left: n(t?.left)
10
+ };
11
+ }
12
+ function l(t) {
3
13
  if (!t) return { monitor: null, ownsMonitor: !1, hud: null };
4
14
  if (typeof t != "object" || !("monitor" in t || "recordFrame" in t))
5
15
  throw new Error(
@@ -7,29 +17,30 @@ function s(t) {
7
17
  );
8
18
  return "recordFrame" in t ? { monitor: t, ownsMonitor: !1, hud: null } : { monitor: t.monitor, ownsMonitor: t.ownsMonitor ?? !1, hud: t.hud ?? null };
9
19
  }
10
- const r = {
20
+ const e = {
11
21
  top: 20,
12
22
  bottom: 20,
13
23
  right: { intervals: 3 },
14
24
  left: { intervals: 0 }
15
25
  };
16
- function a(t) {
26
+ function f(t) {
17
27
  return {
18
- top: t?.top ?? r.top,
19
- bottom: t?.bottom ?? r.bottom,
20
- right: t?.right ?? r.right,
21
- left: t?.left ?? r.left
28
+ top: t?.top ?? e.top,
29
+ bottom: t?.bottom ?? e.bottom,
30
+ right: t?.right ?? e.right,
31
+ left: t?.left ?? e.left
22
32
  };
23
33
  }
24
- function f(t, e) {
25
- return typeof t == "number" && typeof e == "number" ? t === e : typeof t == "object" && typeof e == "object" ? t.intervals === e.intervals : !1;
34
+ function u(t, o) {
35
+ return typeof t == "number" && typeof o == "number" ? t === o : typeof t == "object" && typeof o == "object" ? t.intervals === o.intervals : !1;
26
36
  }
27
- function l(t) {
28
- return t === void 0 ? o : Number.isFinite(t) ? Math.max(n, Math.floor(t)) : o;
37
+ function m(t) {
38
+ return t === void 0 ? i : Number.isFinite(t) ? Math.max(r, Math.floor(t)) : i;
29
39
  }
30
40
  export {
31
- f as isSameHorizontalPadding,
32
- l as resolveMaxVisibleBars,
33
- a as resolvePadding,
34
- s as resolvePerfOptions
41
+ u as isSameHorizontalPadding,
42
+ a as resolveFade,
43
+ m as resolveMaxVisibleBars,
44
+ f as resolvePadding,
45
+ l as resolvePerfOptions
35
46
  };