@wick-charts/vue 0.4.2 → 0.5.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 (144) hide show
  1. package/README.md +5 -3
  2. package/dist/BarSeries.vue.js +44 -0
  3. package/dist/BarSeries.vue2.js +4 -0
  4. package/dist/CandlestickSeries.vue.js +45 -0
  5. package/dist/CandlestickSeries.vue2.js +4 -0
  6. package/dist/ChartContainer.vue.js +168 -0
  7. package/dist/ChartContainer.vue2.js +4 -0
  8. package/dist/LineSeries.vue.js +44 -0
  9. package/dist/LineSeries.vue2.js +4 -0
  10. package/dist/PieSeries.vue.js +34 -0
  11. package/dist/PieSeries.vue2.js +4 -0
  12. package/dist/composables.js +44 -0
  13. package/dist/context.js +25 -0
  14. package/dist/core/dist/animation/animator.js +72 -0
  15. package/dist/core/dist/animation/config.js +145 -0
  16. package/dist/core/dist/animation/easing.js +4 -0
  17. package/dist/core/dist/animation/scalar-spring.js +57 -0
  18. package/dist/core/dist/animation/spring.js +11 -0
  19. package/dist/core/dist/animation/time.js +19 -0
  20. package/dist/core/dist/animation/viewport-engine.js +174 -0
  21. package/dist/core/dist/animation/visible-range-spring.js +64 -0
  22. package/dist/core/dist/animation/y-range-hermite.js +72 -0
  23. package/dist/core/dist/animation/y-range-snap.js +31 -0
  24. package/dist/core/dist/animation/y-range-spring.js +59 -0
  25. package/dist/core/dist/axis/dom-labels.js +60 -0
  26. package/dist/core/dist/canvas-manager.js +109 -0
  27. package/dist/core/dist/chart/edge-indicators.js +26 -0
  28. package/dist/core/dist/chart/fit-to-data.js +9 -0
  29. package/dist/core/dist/chart/last-value.js +31 -0
  30. package/dist/core/dist/chart/options.js +35 -0
  31. package/dist/core/dist/chart/pan-zoom-math.js +66 -0
  32. package/dist/core/dist/chart/streaming-cadence.js +70 -0
  33. package/dist/core/dist/chart/streaming-target.js +22 -0
  34. package/dist/core/dist/chart/viewport-padding.js +6 -0
  35. package/dist/core/dist/chart/y-target.js +24 -0
  36. package/dist/core/dist/chart.js +1550 -0
  37. package/dist/core/dist/components/crosshair.js +9 -0
  38. package/dist/core/dist/components/edge-indicator.js +36 -0
  39. package/dist/core/dist/components/grid.js +22 -0
  40. package/dist/core/dist/components/marker.js +41 -0
  41. package/dist/core/dist/components/reference-line.js +48 -0
  42. package/dist/core/dist/components/time-region.js +35 -0
  43. package/dist/core/dist/data/decimation.js +54 -0
  44. package/dist/core/dist/data/store.js +76 -0
  45. package/dist/core/dist/data/sync.js +47 -0
  46. package/dist/core/dist/events.js +19 -0
  47. package/dist/core/dist/interactions/handler.js +84 -0
  48. package/dist/core/dist/interactions/pan.js +26 -0
  49. package/dist/core/dist/interactions/zoom.js +21 -0
  50. package/dist/core/dist/navigator/controller.js +374 -0
  51. package/dist/core/dist/navigator/decimate.js +44 -0
  52. package/dist/core/dist/navigator/interactions.js +28 -0
  53. package/dist/core/dist/navigator/render.js +68 -0
  54. package/dist/core/dist/perf/counting-context.js +19 -0
  55. package/dist/core/dist/perf/perf-hud.js +453 -0
  56. package/dist/core/dist/perf/perf-monitor.js +132 -0
  57. package/dist/core/dist/render-scheduler.js +31 -0
  58. package/dist/core/dist/scales/tick-tracker.js +110 -0
  59. package/dist/core/dist/scales/x-scale.js +145 -0
  60. package/dist/core/dist/scales/y-scale.js +156 -0
  61. package/dist/core/dist/series/bar.js +341 -0
  62. package/dist/core/dist/series/base-multi-layer.js +438 -0
  63. package/dist/core/dist/series/candlestick.js +481 -0
  64. package/dist/core/dist/series/definition.js +11 -0
  65. package/dist/core/dist/series/line.js +446 -0
  66. package/dist/core/dist/series/painters/builtins.js +36 -0
  67. package/dist/core/dist/series/painters/canvas-path.js +79 -0
  68. package/dist/core/dist/series/painters/resolve.js +32 -0
  69. package/dist/core/dist/series/pie.js +545 -0
  70. package/dist/core/dist/series/register-builtins.js +11 -0
  71. package/dist/core/dist/series/stack-math.js +17 -0
  72. package/dist/core/dist/snapshots.js +107 -0
  73. package/dist/core/dist/theme/create.js +176 -0
  74. package/dist/core/dist/theme/resolve.js +14 -0
  75. package/dist/core/dist/theme/themes/andromeda.js +33 -0
  76. package/dist/core/dist/theme/themes/ayu-mirage.js +33 -0
  77. package/dist/core/dist/theme/themes/catppuccin.js +33 -0
  78. package/dist/core/dist/theme/themes/dracula.js +35 -0
  79. package/dist/core/dist/theme/themes/github-light.js +34 -0
  80. package/dist/core/dist/theme/themes/gruvbox.js +33 -0
  81. package/dist/core/dist/theme/themes/handwritten.js +101 -0
  82. package/dist/core/dist/theme/themes/high-contrast.js +33 -0
  83. package/dist/core/dist/theme/themes/lavender-mist.js +33 -0
  84. package/dist/core/dist/theme/themes/light-pink.js +34 -0
  85. package/dist/core/dist/theme/themes/material-palenight.js +33 -0
  86. package/dist/core/dist/theme/themes/minimal-light.js +34 -0
  87. package/dist/core/dist/theme/themes/mint-breeze.js +33 -0
  88. package/dist/core/dist/theme/themes/monokai-pro.js +33 -0
  89. package/dist/core/dist/theme/themes/night-owl.js +35 -0
  90. package/dist/core/dist/theme/themes/one-dark-pro.js +33 -0
  91. package/dist/core/dist/theme/themes/panda.js +33 -0
  92. package/dist/core/dist/theme/themes/peach-cream.js +33 -0
  93. package/dist/core/dist/theme/themes/quiet-light.js +37 -0
  94. package/dist/core/dist/theme/themes/rose-pine-dawn.js +33 -0
  95. package/dist/core/dist/theme/themes/sand-dune.js +33 -0
  96. package/dist/core/dist/theme/themes/solarized-light.js +34 -0
  97. package/dist/core/dist/tooltip-position.js +10 -0
  98. package/dist/core/dist/utils/color.js +37 -0
  99. package/dist/core/dist/utils/format.js +29 -0
  100. package/dist/core/dist/utils/math.js +26 -0
  101. package/dist/core/dist/utils/poisoned-data-reporter.js +15 -0
  102. package/dist/core/dist/utils/time.js +41 -0
  103. package/dist/index.d.ts +834 -63
  104. package/dist/index.js +142 -8025
  105. package/dist/ui/Crosshair.vue.js +53 -0
  106. package/dist/ui/Crosshair.vue2.js +4 -0
  107. package/dist/ui/InfoBar.vue.js +143 -0
  108. package/dist/ui/InfoBar.vue2.js +4 -0
  109. package/dist/ui/Legend.vue.js +212 -0
  110. package/dist/ui/Legend.vue2.js +4 -0
  111. package/dist/ui/Marker.vue.js +47 -0
  112. package/dist/ui/Marker.vue2.js +4 -0
  113. package/dist/ui/Navigator.vue.js +58 -0
  114. package/dist/ui/Navigator.vue2.js +4 -0
  115. package/dist/ui/NumberFlow.vue.js +69 -0
  116. package/dist/ui/NumberFlow.vue2.js +4 -0
  117. package/dist/ui/PieLegend.vue.js +132 -0
  118. package/dist/ui/PieLegend.vue2.js +4 -0
  119. package/dist/ui/PieTooltip.vue.js +135 -0
  120. package/dist/ui/PieTooltip.vue2.js +4 -0
  121. package/dist/ui/ReferenceLine.vue.js +44 -0
  122. package/dist/ui/ReferenceLine.vue2.js +4 -0
  123. package/dist/ui/TimeAxis.vue.js +43 -0
  124. package/dist/ui/TimeAxis.vue2.js +4 -0
  125. package/dist/ui/TimeRegion.vue.js +41 -0
  126. package/dist/ui/TimeRegion.vue2.js +4 -0
  127. package/dist/ui/Title.vue.js +54 -0
  128. package/dist/ui/Title.vue2.js +4 -0
  129. package/dist/ui/Tooltip.vue.js +195 -0
  130. package/dist/ui/Tooltip.vue2.js +4 -0
  131. package/dist/ui/YAxis.vue.js +42 -0
  132. package/dist/ui/YAxis.vue2.js +4 -0
  133. package/dist/ui/YLabel.vue.js +105 -0
  134. package/dist/ui/YLabel.vue2.js +4 -0
  135. package/package.json +2 -2
  136. package/src/BarSeries.vue +12 -13
  137. package/src/CandlestickSeries.vue +17 -6
  138. package/src/LineSeries.vue +12 -13
  139. package/src/PieSeries.vue +2 -1
  140. package/src/index.ts +23 -0
  141. package/src/ui/Legend.vue +1 -2
  142. package/src/ui/Marker.vue +62 -0
  143. package/src/ui/ReferenceLine.vue +58 -0
  144. package/src/ui/TimeRegion.vue +54 -0
@@ -0,0 +1,9 @@
1
+ import { resolvePaddingTime as l } from "./viewport-padding.js";
2
+ function g(c) {
3
+ const { firstTime: r, lastTime: a, dataInterval: t, maxVisibleBars: p, chartWidth: o, padding: m } = c, s = p * t, n = a - r, d = n > 0 ? n : t * 10, f = l(m.right, d, t, o), h = l(m.left, d, t, o);
4
+ let i = a + f, e = r - h;
5
+ return i - e > s && (i = a + f, e = i - s), { from: e, to: i };
6
+ }
7
+ export {
8
+ g as computeFitToData
9
+ };
@@ -0,0 +1,31 @@
1
+ const a = (e) => "close" in e ? e.close : e.value;
2
+ function f(e, i, l) {
3
+ const t = i.find((c) => c.id === e);
4
+ if (!t) return null;
5
+ const n = t.renderer;
6
+ if (n.kind === "pie") return null;
7
+ const r = n.getLastDataPoint();
8
+ if (!r) return null;
9
+ const { from: u, to: o } = l;
10
+ if (r.time >= u && r.time <= o)
11
+ return { value: a(r), isLive: !0 };
12
+ const s = n.getVisibleDataPoints(u, o);
13
+ return s.length === 0 ? null : { value: a(s[s.length - 1]), isLive: !1 };
14
+ }
15
+ function d(e, i, l) {
16
+ const t = i.find((r) => r.id === e);
17
+ return t ? t.renderer.getStackedLastValue?.() || f(e, i, l) : null;
18
+ }
19
+ function g(e, i) {
20
+ const l = i.find((r) => r.id === e);
21
+ if (!l) return null;
22
+ const t = l.renderer;
23
+ if (t.kind === "pie") return null;
24
+ const n = t.getSecondLastDataPoint();
25
+ return n ? "close" in n ? n.close : n.value : null;
26
+ }
27
+ export {
28
+ f as getLastValue,
29
+ g as getPreviousClose,
30
+ d as getStackedLastValue
31
+ };
@@ -0,0 +1,35 @@
1
+ import { DEFAULT_MAX_VISIBLE_BARS as o, MIN_VISIBLE_BARS as n } from "./pan-zoom-math.js";
2
+ function s(t) {
3
+ if (!t) return { monitor: null, ownsMonitor: !1, hud: null };
4
+ if (typeof t != "object" || !("monitor" in t || "recordFrame" in t))
5
+ throw new Error(
6
+ "[wick-charts] The `perf: true` / option-object forms were replaced by config factories — pass `perf: perfHud()` for a monitor with the HUD overlay, or a `PerfMonitor` instance for HUD-less instrumentation. Importing the factory is what pulls perf code into the bundle."
7
+ );
8
+ return "recordFrame" in t ? { monitor: t, ownsMonitor: !1, hud: null } : { monitor: t.monitor, ownsMonitor: t.ownsMonitor ?? !1, hud: t.hud ?? null };
9
+ }
10
+ const r = {
11
+ top: 20,
12
+ bottom: 20,
13
+ right: { intervals: 3 },
14
+ left: { intervals: 0 }
15
+ };
16
+ function a(t) {
17
+ 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
22
+ };
23
+ }
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;
26
+ }
27
+ function l(t) {
28
+ return t === void 0 ? o : Number.isFinite(t) ? Math.max(n, Math.floor(t)) : o;
29
+ }
30
+ export {
31
+ f as isSameHorizontalPadding,
32
+ l as resolveMaxVisibleBars,
33
+ a as resolvePadding,
34
+ s as resolvePerfOptions
35
+ };
@@ -0,0 +1,66 @@
1
+ import { resolvePaddingTime as S } from "./viewport-padding.js";
2
+ const T = 200, w = 2;
3
+ function L(i) {
4
+ const { range: c, chartWidth: n, dataInterval: d, padding: r, dataStart: a, dataEnd: e } = i, t = (u) => typeof u == "object" || u === 0 || n > 0, f = a !== null && t(r.left) ? a - S(r.left, c, d, n) : null, s = e !== null && t(r.right) ? e + S(r.right, c, d, n) : null;
5
+ return { left: f, right: s };
6
+ }
7
+ function b(i) {
8
+ return 10 * i;
9
+ }
10
+ function y(i) {
11
+ const { dataInterval: c, padding: n, dataStart: d, dataEnd: r } = i;
12
+ if (d === null || r === null) return null;
13
+ const a = r - d;
14
+ if (a <= 0) return null;
15
+ const e = typeof n.left == "object" ? n.left.intervals * c : null, t = typeof n.right == "object" ? n.right.intervals * c : null;
16
+ return e !== null || t !== null ? a + (e ?? 0) + (t ?? 0) : a + c * 5;
17
+ }
18
+ function R(i) {
19
+ return i * 0.5;
20
+ }
21
+ function A(i) {
22
+ const { currentLogical: c, timeDelta: n, chartWidth: d, dataInterval: r, padding: a, dataStart: e, dataEnd: t } = i, { from: f, to: s } = c;
23
+ if (s - f <= 0)
24
+ return { newLogical: null, autoScrollOff: !1, edgeReached: null };
25
+ let u = f + n, o = s + n, g = null;
26
+ if (t !== null && u > t) {
27
+ const l = u - t;
28
+ u -= l, o -= l, g = { side: "right", overshoot: l, boundaryTime: t };
29
+ }
30
+ if (e !== null && o < e) {
31
+ const l = e - o;
32
+ u += l, o += l, g = { side: "left", overshoot: l, boundaryTime: e };
33
+ }
34
+ const p = t !== null && (typeof a.right == "object" || a.right === 0 || d > 0) ? S(a.right, o - u, r, d) : 0, m = R(r), h = t !== null && Math.abs(o - (t + p)) < m;
35
+ return {
36
+ newLogical: { from: u, to: o },
37
+ autoScrollOff: !h,
38
+ edgeReached: g
39
+ };
40
+ }
41
+ function B(i) {
42
+ const { currentLogical: c, centerTime: n, factor: d, chartWidth: r, dataInterval: a, padding: e, dataStart: t, dataEnd: f } = i, { from: s, to: u } = c, o = u - s;
43
+ if (o <= 0)
44
+ return { newLogical: null };
45
+ const g = b(a), { left: p, right: m } = L({
46
+ range: o,
47
+ chartWidth: r,
48
+ dataInterval: a,
49
+ padding: e,
50
+ dataStart: t,
51
+ dataEnd: f
52
+ }), h = p !== null && m !== null ? m - p : y({ dataInterval: a, padding: e, dataStart: t, dataEnd: f });
53
+ let l = o * d;
54
+ l < g && (l = g), d > 1 && h !== null && l > h && (l = h);
55
+ const I = (n - s) / o, v = n - I * l, E = v + l;
56
+ return { newLogical: { from: v, to: E } };
57
+ }
58
+ export {
59
+ T as DEFAULT_MAX_VISIBLE_BARS,
60
+ w as MIN_VISIBLE_BARS,
61
+ A as computePan,
62
+ L as computeSoftBounds,
63
+ B as computeZoom,
64
+ y as softMaxRange,
65
+ b as softMinRange
66
+ };
@@ -0,0 +1,70 @@
1
+ class i {
2
+ #t = 0;
3
+ #s = 0;
4
+ /** Fold a new arrival into the EMA. Pass `performance.now()` from the host. */
5
+ observe(s) {
6
+ if (this.#t > 0) {
7
+ const t = s - this.#t;
8
+ t >= 5 && t < 5e3 && (this.#s = this.#s === 0 ? t : 0.3 * t + (1 - 0.3) * this.#s);
9
+ }
10
+ this.#t = s;
11
+ }
12
+ /**
13
+ * Reset the inter-arrival tracker without dropping the EMA. The next
14
+ * `observe()` is treated as a session restart so a skipped-tick window
15
+ * (e.g. ViewportEngine gesture lock-out) doesn't poison the EMA with the
16
+ * gap-during-gesture wall-time. EMA is preserved so the post-gesture
17
+ * cadence picks up where streaming left off.
18
+ */
19
+ pause() {
20
+ this.#t = 0;
21
+ }
22
+ /**
23
+ * Seed the inter-arrival baseline to a known wall-clock time so the *next*
24
+ * `observe()` folds a real gap into the EMA. Without this, the first
25
+ * streaming append after an initial load (or a bulk replace) has no prior
26
+ * arrival to measure against: `observe` sets the baseline but folds nothing,
27
+ * the EMA stays 0, and `pickSettleMs` returns the bare `floor`. That makes
28
+ * the first X slide settle in `floor` ms — a bell curve that accelerates,
29
+ * peaks, then stops — while every later tick rides the cadence-tuned settle
30
+ * and slides continuously. The visible artifact is "stutter on the first
31
+ * point, smooth from the second". Seeding at paint time lets the first
32
+ * append pick up the producer cadence immediately.
33
+ *
34
+ * Unlike `pause()` (which clears the baseline to 0 so the next gap is
35
+ * suppressed), this SETS a fresh baseline. It never folds a sample, so
36
+ * calling it on back-to-back replaces can't poison the EMA.
37
+ */
38
+ seed(s) {
39
+ this.#t = s;
40
+ }
41
+ /**
42
+ * Pick a settle time for the X spring sized to the current cadence. The
43
+ * spring should still be mid-flight when the next data tick arrives —
44
+ * otherwise its velocity decays toward zero between ticks and the slide
45
+ * reads as a bell-curve pulse (accelerate → peak → decelerate → restart).
46
+ *
47
+ * `floor` is the user-configured baseline (typically `animations.axis.x.settle`);
48
+ * returned value is `max(floor, ema * slack)` clamped at {@link SETTLE_MS_MAX}.
49
+ * The `slack` multiplier (default 3.0) means the spring's 99 %-settle
50
+ * window is ~3 × the measured cadence — at any one tick the spring is at
51
+ * roughly the 1/3 point of its decay, with significant velocity that
52
+ * carries seamlessly into the next retarget. Lower slack (e.g., 1.2)
53
+ * leaves the spring closer to settled by the next tick and reintroduces
54
+ * the bell-curve pulse; higher slack (e.g., 5) tightens the visual lag
55
+ * but makes the slide feel laggier behind the live tail.
56
+ */
57
+ pickSettleMs(s, t = 3) {
58
+ return this.#s === 0 ? s : Math.min(5e3, Math.max(s, this.#s * t));
59
+ }
60
+ /**
61
+ * Current EMA value. Hidden behind a getter to keep state read-only.
62
+ * @internal Test-only; not part of the production API.
63
+ */
64
+ get emaMs() {
65
+ return this.#s;
66
+ }
67
+ }
68
+ export {
69
+ i as StreamingCadence
70
+ };
@@ -0,0 +1,22 @@
1
+ import { resolvePaddingTime as M } from "./viewport-padding.js";
2
+ const S = 0.5, w = 4;
3
+ function v(s) {
4
+ const { currentLogical: u, lastTime: i, prevDataEnd: c, dataInterval: t, paddingRight: d, chartWidth: a, holdUntilFilled: r } = s, { from: m, to: e } = u, l = e - m;
5
+ if (l <= 0)
6
+ return { newLogical: null, releaseHold: !1, reengageAutoScroll: !1 };
7
+ const o = M(d, l, t, a);
8
+ if (r) {
9
+ const H = t * 0.01;
10
+ if (i + o <= e + H)
11
+ return { newLogical: null, releaseHold: !1, reengageAutoScroll: !0 };
12
+ }
13
+ const f = c !== null ? e - c : o, h = Math.max(0, Math.min(o, f)), n = i + h, p = n - l, g = S * t, L = a > 0 ? w / a * l : g, A = Math.min(g, L);
14
+ return Math.abs(n - e) < A ? { newLogical: null, releaseHold: r, reengageAutoScroll: !0 } : {
15
+ newLogical: { from: p, to: n },
16
+ releaseHold: r,
17
+ reengageAutoScroll: !0
18
+ };
19
+ }
20
+ export {
21
+ v as computeStreamingTarget
22
+ };
@@ -0,0 +1,6 @@
1
+ function o(e, i, n, t) {
2
+ return typeof e == "object" ? e.intervals * n : t <= 0 ? 0 : e / t * i;
3
+ }
4
+ export {
5
+ o as resolvePaddingTime
6
+ };
@@ -0,0 +1,24 @@
1
+ function f(e, r, u) {
2
+ let o = 1 / 0, a = -1 / 0;
3
+ for (const n of r) {
4
+ if (!n.visible || n.renderer.kind === "pie") continue;
5
+ const t = n.renderer.getValueRange(e.from, e.to);
6
+ t && (t.max > a && (a = t.max), t.min < o && (o = t.min), u?.push(t.min, t.max));
7
+ }
8
+ return o === 1 / 0 || a === -1 / 0 ? null : { min: o, max: a };
9
+ }
10
+ function m(e, r, u, o, a) {
11
+ if (e === void 0 || e === "auto") return r;
12
+ if (typeof e == "number") return e;
13
+ if (typeof e == "function") return e(o);
14
+ const n = String(e).match(/^([+-]?)\s*(\d+(?:\.\d+)?)\s*%$/);
15
+ if (n) {
16
+ const t = n[1] === "-" ? -1 : 1, i = parseFloat(n[2]) / 100, s = Math.abs(u - r) || Math.abs(r) || 1;
17
+ return r + t * i * s * (a === "max" ? 1 : -1);
18
+ }
19
+ return r;
20
+ }
21
+ export {
22
+ f as computeTargetYRange,
23
+ m as resolveBound
24
+ };