@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.
@@ -6,10 +6,10 @@ import { ScalarSpring as V } from "../animation/scalar-spring.js";
6
6
  import { decimateOHLCData as at } from "../data/decimation.js";
7
7
  import { TimeSeriesStore as rt } from "../data/store.js";
8
8
  import { resolveCandlestickBodyColor as I } from "../theme/resolve.js";
9
- import { hexToRgba as K, mixColors as Q } from "../utils/color.js";
10
- import { clamp as _, lerp as $ } from "../utils/math.js";
9
+ import { hexToRgba as K, mixColors as G } from "../utils/color.js";
10
+ import { clamp as _, lerp as z } from "../utils/math.js";
11
11
  import { isPoisonedNumber as N, reportPoisonedData as ht } from "../utils/poisoned-data-reporter.js";
12
- import { normalizeOHLCArray as G, normalizeTime as J } from "../utils/time.js";
12
+ import { normalizeOHLCArray as J, normalizeTime as Q } from "../utils/time.js";
13
13
  import { candleUnfoldIntro as lt } from "./candlestick-intro.js";
14
14
  import { fillRoundedRect as Z } from "./painters/canvas-path.js";
15
15
  import { resolveCandlePainter as mt } from "./painters/resolve.js";
@@ -137,19 +137,19 @@ class xt {
137
137
  // --- SeriesRenderer interface implementation ------------------------------
138
138
  setData(t) {
139
139
  const i = this.store.length > 0;
140
- this.store.setData(G(t ?? [])), !i && this.store.length > 0 && this.introWave.arm(this.options.introMs);
140
+ this.store.setData(J(t ?? [])), !i && this.store.length > 0 && this.introWave.arm(this.options.introMs);
141
141
  const e = this.store.last();
142
142
  this.displayedLast = e ?? null, this.#t = null, this.entries.clear(), this.#i = null, this.#o.finish(), this.#a = null, this.#m = null;
143
143
  }
144
144
  appendPoint(t) {
145
- const i = t, e = J(i.time), o = { ...i, time: e };
145
+ const i = t, e = Q(i.time), o = { ...i, time: e };
146
146
  this.store.append(o), this.displayedLast = o, this.#t = null;
147
147
  const a = this.options.entryMs;
148
148
  this.isEntryEnabled() && a > 0 && this.entries.set(e, { startTime: performance.now() });
149
149
  }
150
150
  prependPoints(t) {
151
151
  if (t.length === 0) return;
152
- const i = G(t), e = this.store.first()?.time;
152
+ const i = J(t), e = this.store.first()?.time;
153
153
  this.store.prepend(i), this.#u(i[0].time, e);
154
154
  }
155
155
  /**
@@ -172,7 +172,7 @@ class xt {
172
172
  i !== void 0 && (this.#m = { bars: t, anchorTime: i });
173
173
  }
174
174
  updateLastPoint(t) {
175
- const i = t, e = J(i.time), o = { ...i, time: e };
175
+ const i = t, e = Q(i.time), o = { ...i, time: e };
176
176
  this.store.updateLast(o);
177
177
  const a = this.options.smoothMs;
178
178
  if (a <= 0) {
@@ -342,8 +342,8 @@ class xt {
342
342
  for (const x of m) {
343
343
  const P = this.entries.get(x.time);
344
344
  if (P === void 0 || r <= 0) continue;
345
- const k = l - P.startTime, z = Math.min(1, Math.max(0, k / r));
346
- z >= 1 || (W === null && (W = /* @__PURE__ */ new Map()), W.set(x.time, nt(z)));
345
+ const k = l - P.startTime, $ = Math.min(1, Math.max(0, k / r));
346
+ $ >= 1 || (W === null && (W = /* @__PURE__ */ new Map()), W.set(x.time, nt($)));
347
347
  }
348
348
  }
349
349
  const X = e.barWidthBitmap(a), f = Math.round(30 * u), M = m.length <= 2 ? Math.min(f, X) : X, d = Math.max(1, Math.round(u));
@@ -440,8 +440,8 @@ class xt {
440
440
  const e = t.unfold ?? 1, o = t.offsetY ?? 0;
441
441
  return {
442
442
  x: i.x + (t.offsetX ?? 0),
443
- topY: (t.topY ?? $(i.anchorY, i.topY, e)) + o,
444
- bottomY: (t.bottomY ?? $(i.anchorY, i.bottomY, e)) + o,
443
+ topY: (t.topY ?? z(i.anchorY, i.topY, e)) + o,
444
+ bottomY: (t.bottomY ?? z(i.anchorY, i.bottomY, e)) + o,
445
445
  alpha: t.alpha ?? 1,
446
446
  tint: t.tint
447
447
  };
@@ -558,7 +558,7 @@ class xt {
558
558
  t.fillRect(T, R, u, v - R);
559
559
  continue;
560
560
  }
561
- t.save(), t.globalAlpha = n.alpha, g > 0 && (t.fillStyle = Q(m, W, g)), t.fillRect(n.x, n.topY, u, Math.max(1, n.bottomY - n.topY)), t.restore();
561
+ t.save(), t.globalAlpha = n.alpha, g > 0 && (t.fillStyle = G(m, W, g)), t.fillRect(n.x, n.topY, u, Math.max(1, n.bottomY - n.topY)), t.restore();
562
562
  }
563
563
  const X = Array.isArray(y);
564
564
  for (const f of i) {
@@ -587,15 +587,15 @@ class xt {
587
587
  C !== null && (n = C.x, p = C.topY, g = C.bottomY, L *= C.alpha, E = C.tint ?? 0, B = !0);
588
588
  const D = B ? Math.max(1, g - p) : A;
589
589
  B && t.save();
590
- const r = Array.isArray(y) ? y[0] : y, l = E > 0 ? Q(r, W, E) : r, x = X && D > 2 && E <= 0, P = x ? this.#d(t, y, D) : l;
590
+ const r = Array.isArray(y) ? y[0] : y, l = E > 0 ? G(r, W, E) : r, x = X && D > 2 && E <= 0, P = x ? this.#d(t, y, D) : l;
591
591
  t.fillStyle = P, B && (t.globalAlpha = L), x && t.translate(0, p);
592
- const k = x ? 0 : p, z = _(w.radius, 0, Math.min(s, D) / 2);
593
- z < 1 && !this.options.candlePainter ? t.fillRect(n, k, s, D) : w.painter(w.env, {
592
+ const k = x ? 0 : p, $ = _(w.radius, 0, Math.min(s, D) / 2);
593
+ $ < 1 && !this.options.candlePainter ? t.fillRect(n, k, s, D) : w.painter(w.env, {
594
594
  geom: { x: n, y: k, width: s, height: D },
595
595
  fillStyle: P,
596
596
  color: l,
597
597
  corners: ft,
598
- radius: z,
598
+ radius: $,
599
599
  progress: M,
600
600
  isBullish: f.close >= f.open
601
601
  }), x && t.translate(0, -p), B && t.restore();
@@ -625,8 +625,8 @@ function F(h, t, i) {
625
625
  case "unfold":
626
626
  return {
627
627
  x: i.x,
628
- topY: $(i.anchorY, i.topY, h),
629
- bottomY: $(i.anchorY, i.bottomY, h),
628
+ topY: z(i.anchorY, i.topY, h),
629
+ bottomY: z(i.anchorY, i.bottomY, h),
630
630
  alpha: 1
631
631
  };
632
632
  case "slide":
@@ -639,8 +639,8 @@ function F(h, t, i) {
639
639
  case "fade-unfold":
640
640
  return {
641
641
  x: i.x,
642
- topY: $(i.anchorY, i.topY, h),
643
- bottomY: $(i.anchorY, i.bottomY, h),
642
+ topY: z(i.anchorY, i.topY, h),
643
+ bottomY: z(i.anchorY, i.bottomY, h),
644
644
  alpha: h
645
645
  };
646
646
  }
@@ -5,7 +5,7 @@ import { sampleRamp as Y, deriveHeatmapRamp as st, mixColors as et, isLightColor
5
5
  import { formatCompact as ot } from "../utils/format.js";
6
6
  import { clamp as v, smoothToward as z } from "../utils/math.js";
7
7
  import { fillRoundedRect as nt } from "./painters/canvas-path.js";
8
- const E = {
8
+ const P = {
9
9
  fontSize: 10
10
10
  };
11
11
  function ht(r, s) {
@@ -20,9 +20,9 @@ const lt = {
20
20
  updateMs: Q
21
21
  };
22
22
  function rt(r) {
23
- return r === void 0 || r === !1 ? !1 : r === !0 ? E : { ...E, ...r };
23
+ return r === void 0 || r === !1 ? !1 : r === !0 ? P : { ...P, ...r };
24
24
  }
25
- function P(r, s) {
25
+ function E(r, s) {
26
26
  const t = {
27
27
  ...r,
28
28
  ...s,
@@ -90,14 +90,14 @@ class ct {
90
90
  */
91
91
  #g;
92
92
  /** Data extent cached by {@link #rebuildGrid} — see {@link #domain}. */
93
- #b = { min: 0, max: 1 };
93
+ #M = { min: 0, max: 1 };
94
94
  constructor(s, t) {
95
- this.#t = P(lt, s ?? {}), this.#r = this.#t.entryMs === 0, this.#g = t ?? null;
95
+ this.#t = E(lt, s ?? {}), this.#r = this.#t.entryMs === 0, this.#g = t ?? null;
96
96
  }
97
97
  // --- Data ingest -----------------------------------------------------------
98
98
  setData(s) {
99
99
  const t = this.#x(), e = this.#s.length > 0;
100
- if (this.#c = s ?? [], this.#M(), e && this.#x() === t) {
100
+ if (this.#c = s ?? [], this.#b(), e && this.#x() === t) {
101
101
  for (const o of this.#s)
102
102
  this.#n.has(o.key) || this.#n.set(o.key, o.value);
103
103
  this.#u = this.#t.updateMs > 0;
@@ -118,7 +118,7 @@ class ct {
118
118
  }
119
119
  updateOptions(s) {
120
120
  const t = this.#t.columns, e = this.#t.rows;
121
- this.#t = P(this.#t, s ?? {}), (this.#t.columns !== t || this.#t.rows !== e) && this.#M(), this.#t.entryMs === 0 && (this.#r = !0), this.#t.updateMs === 0 && (this.#u = !1), this.#o = null;
121
+ this.#t = E(this.#t, s ?? {}), (this.#t.columns !== t || this.#t.rows !== e) && this.#b(), this.#t.entryMs === 0 && (this.#r = !0), this.#t.updateMs === 0 && (this.#u = !1), this.#o = null;
122
122
  }
123
123
  // --- Layer model (single-layer no-ops, mirroring pie) ----------------------
124
124
  getLayerCount() {
@@ -210,7 +210,7 @@ class ct {
210
210
  * and place every datum. On duplicate (x, y) coordinates the last datum
211
211
  * wins — matching "latest sample replaces" streaming intuition.
212
212
  */
213
- #M() {
213
+ #b() {
214
214
  const s = this.#x(), t = this.#t.columns ? [...this.#t.columns] : [], e = this.#t.rows ? [...this.#t.rows] : [], o = new Map(t.map((i, n) => [i, n])), h = new Map(e.map((i, n) => [i, n]));
215
215
  for (const i of this.#c)
216
216
  !this.#t.columns && !o.has(i.x) && (o.set(i.x, t.length), t.push(i.x)), !this.#t.rows && !h.has(i.y) && (h.set(i.y, e.length), e.push(i.y));
@@ -229,7 +229,7 @@ class ct {
229
229
  };
230
230
  u >= 0 ? this.#s[u] = c : (this.#h[a] = this.#s.length, this.#s.push(c));
231
231
  }
232
- this.#x() !== s && (this.#l = new Array(this.#h.length).fill(0), this.#a = -1), this.#b = this.#w();
232
+ this.#x() !== s && (this.#l = new Array(this.#h.length).fill(0), this.#a = -1), this.#M = this.#w();
233
233
  }
234
234
  /**
235
235
  * Scan the placed cells for the finite-value extent. Called once per
@@ -249,7 +249,7 @@ class ct {
249
249
  }
250
250
  /** Value domain: explicit option bounds win, else the cached data extent. */
251
251
  #d() {
252
- const { min: s, max: t } = this.#b;
252
+ const { min: s, max: t } = this.#M;
253
253
  return {
254
254
  min: this.#t.min ?? s,
255
255
  max: this.#t.max ?? Math.max(t, this.#t.min ?? s)
@@ -264,7 +264,7 @@ class ct {
264
264
  if (this.#s.length === 0) return;
265
265
  const { scope: t, theme: e, padding: o } = s, { context: h, bitmapSize: i, horizontalPixelRatio: n, verticalPixelRatio: l } = t, a = performance.now(), u = this.#p ? Math.min(0.05, (a - this.#p) / 1e3) : 0;
266
266
  this.#p = a, this.#m === 0 && (this.#m = a), this.#H(u), this.#L(u);
267
- const { min: c, max: f } = this.#d(), M = f - c, X = this.#y(e), H = Z(e), L = `${H * n}px ${e.typography.fontFamily}`, T = this.#t.axisLabels ? this.#T({ context: h, font: L, fontSize: H, hpr: n, vpr: l }) : { left: 0, bottom: 0 }, m = O({
267
+ const { min: c, max: f } = this.#d(), b = f - c, X = this.#y(e), H = Z(e), L = `${H * n}px ${e.typography.fontFamily}`, T = this.#t.axisLabels ? this.#T({ context: h, font: L, fontSize: H, hpr: n, vpr: l }) : { left: 0, bottom: 0 }, m = O({
268
268
  bitmapWidth: i.width,
269
269
  bitmapHeight: i.height,
270
270
  padTop: o.top * l,
@@ -287,12 +287,12 @@ class ct {
287
287
  const K = (p.col + p.row) / U * x, D = v((a - this.#m - K) / x, 0, 1);
288
288
  if (D < 1 && ($ = !1), y = J(D), y <= 0) continue;
289
289
  }
290
- const w = this.#n.get(p.key) ?? p.value, j = Number.isFinite(w) && M > 0 ? v((w - c) / M, 0, 1) : 0;
291
- let b = p.color ?? Y(X, j);
290
+ const w = this.#n.get(p.key) ?? p.value, j = Number.isFinite(w) && b > 0 ? v((w - c) / b, 0, 1) : 0;
291
+ let M = p.color ?? Y(X, j);
292
292
  const G = p.row * this.#e.length + p.col, g = this.#l[G] ?? 0;
293
- g > 0.01 && (b = et(b, e.tooltip.textColor, 0.1 * g), h.shadowColor = "rgba(0, 0, 0, 0.3)", h.shadowBlur = 12 * n * g, h.shadowOffsetY = 3 * l * g);
293
+ g > 0.01 && (M = et(M, e.tooltip.textColor, 0.1 * g), h.shadowColor = "rgba(0, 0, 0, 0.3)", h.shadowBlur = 12 * n * g, h.shadowOffsetY = 3 * l * g);
294
294
  const S = Math.max(0, m.slotW - N), W = Math.max(0, m.slotH - _), F = (0.82 + 0.18 * y) * (1 + 0.04 * g), R = S * F, B = W * F, C = m.originX + p.col * m.slotW + m.slotW / 2, k = m.originY + p.row * m.slotH + m.slotH / 2;
295
- h.globalAlpha = A * y, h.fillStyle = b, nt(h, {
295
+ h.globalAlpha = A * y, h.fillStyle = M, nt(h, {
296
296
  x: C - R / 2,
297
297
  y: k - B / 2,
298
298
  width: R,
@@ -301,7 +301,7 @@ class ct {
301
301
  corners: { tl: !0, tr: !0, br: !0, bl: !0 }
302
302
  }), g > 0.01 && (h.shadowColor = "transparent", h.shadowBlur = 0, h.shadowOffsetY = 0), d && this.#A({
303
303
  context: h,
304
- cell: { fill: b, displayed: w, cx: C, cy: k, innerW: S, innerH: W, span: M },
304
+ cell: { fill: M, displayed: w, cx: C, cy: k, innerW: S, innerH: W, span: b },
305
305
  labels: d,
306
306
  font: V,
307
307
  hpr: n