@wick-charts/vue 0.5.1 → 0.6.0
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.
- package/README.md +18 -3
- package/dist/BarSeries.vue.js +26 -20
- package/dist/CandlestickSeries.vue.js +30 -24
- package/dist/ChartContainer.vue.js +88 -65
- package/dist/HeatmapSeries.vue.js +40 -0
- package/dist/HeatmapSeries.vue2.js +4 -0
- package/dist/LineSeries.vue.js +26 -20
- package/dist/PieSeries.vue.js +24 -18
- package/dist/core/dist/animation/animator.js +21 -21
- package/dist/core/dist/animation/config.js +114 -87
- package/dist/core/dist/animation/easing.js +3 -1
- package/dist/core/dist/animation/intro-wave.js +68 -0
- package/dist/core/dist/axis/dom-labels.js +13 -14
- package/dist/core/dist/chart/badge-animator.js +56 -0
- package/dist/core/dist/chart/edge-indicators.js +28 -13
- package/dist/core/dist/chart/last-value.js +18 -17
- package/dist/core/dist/chart/y-target.js +13 -12
- package/dist/core/dist/chart.js +679 -452
- package/dist/core/dist/components/annotation-chip.js +28 -0
- package/dist/core/dist/components/edge-indicator.js +58 -26
- package/dist/core/dist/components/loading-indicator.js +46 -0
- package/dist/core/dist/components/marker.js +49 -31
- package/dist/core/dist/components/reference-line.js +27 -36
- package/dist/core/dist/components/time-region.js +30 -28
- package/dist/core/dist/data/store.js +38 -19
- package/dist/core/dist/data/sync.js +60 -38
- package/dist/core/dist/heatmap-tooltip.js +16 -0
- package/dist/core/dist/interactions/handler.js +67 -43
- package/dist/core/dist/perf/perf-hud.js +5 -5
- package/dist/core/dist/scales/x-scale.js +85 -37
- package/dist/core/dist/scales/y-scale.js +38 -27
- package/dist/core/dist/series/bar-intro.js +18 -0
- package/dist/core/dist/series/bar.js +337 -205
- package/dist/core/dist/series/base-multi-layer.js +224 -96
- package/dist/core/dist/series/candlestick-intro.js +57 -0
- package/dist/core/dist/series/candlestick.js +454 -276
- package/dist/core/dist/series/heatmap.js +387 -0
- package/dist/core/dist/series/line-intro.js +85 -0
- package/dist/core/dist/series/line.js +590 -282
- package/dist/core/dist/series/painters/builtins.js +2 -2
- package/dist/core/dist/series/pie.js +396 -259
- package/dist/core/dist/series/register-builtins.js +8 -7
- package/dist/core/dist/series/types.js +6 -0
- package/dist/core/dist/series/wave-intro.js +26 -0
- package/dist/core/dist/theme/create.js +69 -63
- package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
- package/dist/core/dist/theme/themes/sand-dune.js +2 -2
- package/dist/core/dist/utils/color.js +109 -34
- package/dist/core/dist/utils/deep-equal.js +18 -0
- package/dist/core/dist/utils/time.js +25 -19
- package/dist/index.d.ts +1405 -123
- package/dist/index.js +177 -130
- package/dist/ui/Crosshair.vue.js +20 -21
- package/dist/ui/HeatmapTooltip.vue.js +96 -0
- package/dist/ui/HeatmapTooltip.vue2.js +4 -0
- package/dist/ui/InfoBar.vue.js +46 -47
- package/dist/ui/Legend.vue.js +80 -79
- package/dist/ui/PieLegend.vue.js +5 -5
- package/dist/ui/PieTooltip.vue.js +77 -67
- package/dist/ui/Tooltip.vue.js +60 -60
- package/dist/ui/YAxis.vue.js +2 -2
- package/dist/ui/YLabel.vue.js +94 -61
- package/package.json +2 -2
- package/src/BarSeries.vue +23 -7
- package/src/CandlestickSeries.vue +23 -7
- package/src/ChartContainer.vue +134 -12
- package/src/HeatmapSeries.vue +69 -0
- package/src/LineSeries.vue +23 -7
- package/src/PieSeries.vue +22 -6
- package/src/index.ts +84 -3
- package/src/ui/Crosshair.vue +1 -2
- package/src/ui/HeatmapTooltip.vue +144 -0
- package/src/ui/InfoBar.vue +1 -2
- package/src/ui/Legend.vue +13 -0
- package/src/ui/Marker.vue +1 -1
- package/src/ui/PieTooltip.vue +10 -0
- package/src/ui/ReferenceLine.vue +2 -2
- package/src/ui/TimeRegion.vue +2 -2
- package/src/ui/Tooltip.vue +2 -2
- package/src/ui/YLabel.vue +123 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { easeOutCubic as r } from "./easing.js";
|
|
2
2
|
class a {
|
|
3
|
-
#t;
|
|
4
|
-
#h;
|
|
5
3
|
#i;
|
|
4
|
+
#h;
|
|
5
|
+
#t;
|
|
6
6
|
#u = 0;
|
|
7
7
|
#r;
|
|
8
8
|
#e;
|
|
@@ -11,21 +11,21 @@ class a {
|
|
|
11
11
|
#c;
|
|
12
12
|
#a;
|
|
13
13
|
#s = !1;
|
|
14
|
-
constructor(
|
|
15
|
-
this.#
|
|
14
|
+
constructor(i) {
|
|
15
|
+
this.#i = i.initial, this.#h = i.initial, this.#t = i.initial, this.#o = i.duration, this.#r = i.duration, this.#n = i.easing ?? r, this.#e = this.#n, this.#c = i.lerp, this.#a = i.equals ?? Object.is;
|
|
16
16
|
}
|
|
17
17
|
get current() {
|
|
18
|
-
return this.#
|
|
18
|
+
return this.#i;
|
|
19
19
|
}
|
|
20
20
|
get target() {
|
|
21
|
-
return this.#
|
|
21
|
+
return this.#t;
|
|
22
22
|
}
|
|
23
23
|
get animating() {
|
|
24
24
|
return this.#s;
|
|
25
25
|
}
|
|
26
26
|
/** Replace the target instantly; cancels any in-flight animation. */
|
|
27
|
-
snap(
|
|
28
|
-
this.#
|
|
27
|
+
snap(i) {
|
|
28
|
+
this.#i = i, this.#h = i, this.#t = i, this.#s = !1;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Set a new target. If `opts.duration` is omitted, the animator's default
|
|
@@ -43,28 +43,28 @@ class a {
|
|
|
43
43
|
* `from` is the actual current position, the cubic ease resumes seamlessly
|
|
44
44
|
* even though the curve technically restarts.
|
|
45
45
|
*/
|
|
46
|
-
setTarget(
|
|
47
|
-
const s =
|
|
46
|
+
setTarget(i, t = {}) {
|
|
47
|
+
const s = t.now ?? performance.now();
|
|
48
48
|
if (this.#s) {
|
|
49
|
-
if (this.#a(
|
|
49
|
+
if (this.#a(i, this.#t)) return;
|
|
50
50
|
this.tick(s);
|
|
51
|
-
} else if (this.#a(
|
|
51
|
+
} else if (this.#a(i, this.#i))
|
|
52
52
|
return;
|
|
53
|
-
const h =
|
|
53
|
+
const h = t.duration ?? this.#o;
|
|
54
54
|
if (h <= 0) {
|
|
55
|
-
this.snap(
|
|
55
|
+
this.snap(i);
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
this.#h = this.#
|
|
58
|
+
this.#h = this.#i, this.#t = i, this.#r = h, this.#e = t.easing ?? this.#n, this.#u = s, this.#s = !0;
|
|
59
59
|
}
|
|
60
60
|
/** Advance `current` toward `target`. Returns `true` while still animating. */
|
|
61
|
-
tick(
|
|
61
|
+
tick(i) {
|
|
62
62
|
if (!this.#s) return !1;
|
|
63
|
-
const
|
|
64
|
-
if (
|
|
65
|
-
return this.#
|
|
66
|
-
const s =
|
|
67
|
-
return this.#
|
|
63
|
+
const t = i - this.#u;
|
|
64
|
+
if (t >= this.#r)
|
|
65
|
+
return this.#i = this.#t, this.#s = !1, !1;
|
|
66
|
+
const s = t <= 0 ? 0 : t / this.#r;
|
|
67
|
+
return this.#i = this.#c(this.#h, this.#t, this.#e(s)), !0;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
export {
|
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { spring as
|
|
2
|
-
import { resolveAnimationTime as
|
|
3
|
-
import { hermite as
|
|
4
|
-
import { snap as
|
|
5
|
-
const
|
|
6
|
-
line: { entryMs: 0, smoothMs: 0, pulseMs: 0 },
|
|
7
|
-
candlestick: { entryMs: 0, smoothMs: 0 },
|
|
8
|
-
bar: { entryMs: 0, smoothMs: 0 },
|
|
9
|
-
pie: { entryMs: 0, updateMs: 0 }
|
|
1
|
+
import { spring as d } from "./spring.js";
|
|
2
|
+
import { resolveAnimationTime as r } from "./time.js";
|
|
3
|
+
import { hermite as D } from "./y-range-hermite.js";
|
|
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 = {
|
|
6
|
+
line: { entryMs: 0, smoothMs: 0, pulseMs: 0, introMs: 0 },
|
|
7
|
+
candlestick: { entryMs: 0, smoothMs: 0, introMs: 0 },
|
|
8
|
+
bar: { entryMs: 0, smoothMs: 0, introMs: 0 },
|
|
9
|
+
pie: { entryMs: 0, updateMs: 0 },
|
|
10
|
+
heatmap: { entryMs: 0, updateMs: 0 }
|
|
10
11
|
};
|
|
11
|
-
function
|
|
12
|
+
function w(i) {
|
|
12
13
|
if (i !== null && typeof i == "object")
|
|
13
14
|
return {
|
|
14
|
-
stickyMs:
|
|
15
|
-
stickyFloorMs:
|
|
15
|
+
stickyMs: r(i.max, T),
|
|
16
|
+
stickyFloorMs: r(i.min, m)
|
|
16
17
|
};
|
|
17
18
|
if (i === void 0)
|
|
18
|
-
return { stickyMs:
|
|
19
|
-
const
|
|
20
|
-
return { stickyMs:
|
|
19
|
+
return { stickyMs: T, stickyFloorMs: m };
|
|
20
|
+
const e = r(i, T);
|
|
21
|
+
return { stickyMs: e, stickyFloorMs: e };
|
|
21
22
|
}
|
|
22
23
|
class y {
|
|
23
24
|
axis;
|
|
24
25
|
toggleMs;
|
|
25
26
|
series;
|
|
26
|
-
constructor(
|
|
27
|
-
this.axis =
|
|
27
|
+
constructor(e, s, t) {
|
|
28
|
+
this.axis = e, this.toggleMs = s, this.series = t;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* Collapse the public `animations` surface into a resolved config.
|
|
@@ -32,38 +33,38 @@ class y {
|
|
|
32
33
|
* disables every field in that category; otherwise missing fields
|
|
33
34
|
* inherit built-in defaults.
|
|
34
35
|
*/
|
|
35
|
-
static resolve(
|
|
36
|
-
if (
|
|
36
|
+
static resolve(e) {
|
|
37
|
+
if (e === !1)
|
|
37
38
|
return new y(
|
|
38
39
|
{
|
|
39
|
-
y: { curve:
|
|
40
|
-
x: { curve:
|
|
40
|
+
y: { curve: u(), settleMs: 0, stickyMs: 0, stickyFloorMs: 0, gestureMs: 0 },
|
|
41
|
+
x: { curve: u(), settleMs: 0, gestureMs: 0 },
|
|
41
42
|
ticksMs: 0
|
|
42
43
|
},
|
|
43
44
|
0,
|
|
44
|
-
|
|
45
|
+
A
|
|
45
46
|
);
|
|
46
|
-
const
|
|
47
|
-
curve:
|
|
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
|
+
curve: u(),
|
|
48
49
|
settleMs: 0,
|
|
49
50
|
stickyMs: 0,
|
|
50
51
|
stickyFloorMs: 0,
|
|
51
52
|
gestureMs: 0
|
|
52
53
|
} : {
|
|
53
|
-
curve:
|
|
54
|
-
settleMs:
|
|
55
|
-
...
|
|
56
|
-
gestureMs:
|
|
57
|
-
},
|
|
58
|
-
curve:
|
|
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 ? {
|
|
59
|
+
curve: u(),
|
|
59
60
|
settleMs: 0,
|
|
60
61
|
gestureMs: 0
|
|
61
62
|
} : {
|
|
62
|
-
curve:
|
|
63
|
-
settleMs:
|
|
64
|
-
gestureMs:
|
|
65
|
-
},
|
|
66
|
-
return new y({ y:
|
|
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);
|
|
67
68
|
}
|
|
68
69
|
/**
|
|
69
70
|
* Per-renderer-type chart-level option payload — merged BEFORE user
|
|
@@ -72,21 +73,28 @@ class y {
|
|
|
72
73
|
* renderer's option shape. `pulseMs` is line-only; bars / candles
|
|
73
74
|
* ignore it.
|
|
74
75
|
*/
|
|
75
|
-
defaults(
|
|
76
|
-
if (
|
|
77
|
-
const { entryMs:
|
|
78
|
-
return { entryMs:
|
|
76
|
+
defaults(e) {
|
|
77
|
+
if (e === "line") {
|
|
78
|
+
const { entryMs: s, smoothMs: t, pulseMs: M, introMs: o } = this.series.line;
|
|
79
|
+
return { entryMs: s, smoothMs: t, pulseMs: M, introMs: o };
|
|
79
80
|
}
|
|
80
|
-
if (
|
|
81
|
-
const { entryMs:
|
|
82
|
-
return { entryMs:
|
|
81
|
+
if (e === "candlestick") {
|
|
82
|
+
const { entryMs: s, smoothMs: t, introMs: M } = this.series.candlestick;
|
|
83
|
+
return { entryMs: s, smoothMs: t, introMs: M };
|
|
83
84
|
}
|
|
84
|
-
if (
|
|
85
|
-
const { entryMs:
|
|
86
|
-
return { entryMs:
|
|
85
|
+
if (e === "pie") {
|
|
86
|
+
const { entryMs: s, updateMs: t } = this.series.pie;
|
|
87
|
+
return { entryMs: s, updateMs: t };
|
|
87
88
|
}
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
if (e === "heatmap") {
|
|
90
|
+
const { entryMs: s, updateMs: t } = this.series.heatmap;
|
|
91
|
+
return { entryMs: s, updateMs: t };
|
|
92
|
+
}
|
|
93
|
+
if (e === "bar") {
|
|
94
|
+
const { entryMs: s, smoothMs: t, introMs: M } = this.series.bar;
|
|
95
|
+
return { entryMs: s, smoothMs: t, introMs: M };
|
|
96
|
+
}
|
|
97
|
+
return {};
|
|
90
98
|
}
|
|
91
99
|
/**
|
|
92
100
|
* Chart-level forced overrides — `animations.series.<type>: false` (or
|
|
@@ -94,52 +102,71 @@ class y {
|
|
|
94
102
|
* AFTER user options so the disable can't be undone at the per-series
|
|
95
103
|
* layer.
|
|
96
104
|
*/
|
|
97
|
-
overrides(
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const { entryMs: n, smoothMs:
|
|
101
|
-
return n === 0 && (
|
|
105
|
+
overrides(e) {
|
|
106
|
+
const s = {};
|
|
107
|
+
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;
|
|
110
|
+
}
|
|
111
|
+
if (e === "pie")
|
|
112
|
+
return this.series.pie.entryMs === 0 && (s.entryMs = 0), s;
|
|
113
|
+
if (e === "heatmap") {
|
|
114
|
+
const { entryMs: n, updateMs: a } = this.series.heatmap;
|
|
115
|
+
return n === 0 && (s.entryMs = 0), a === 0 && (s.updateMs = 0), s;
|
|
102
116
|
}
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
117
|
+
if (e !== "candlestick" && e !== "bar")
|
|
118
|
+
return s;
|
|
119
|
+
const { entryMs: t, smoothMs: M, introMs: o } = e === "candlestick" ? this.series.candlestick : this.series.bar;
|
|
120
|
+
return t === 0 && (s.entryMs = 0), M === 0 && (s.smoothMs = 0), o === 0 && (s.introMs = 0), s;
|
|
106
121
|
}
|
|
107
122
|
}
|
|
108
|
-
function
|
|
109
|
-
if (i === !1) return
|
|
110
|
-
const
|
|
111
|
-
entryMs:
|
|
112
|
-
smoothMs:
|
|
113
|
-
pulseMs:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
function j(i) {
|
|
124
|
+
if (i === !1) return A;
|
|
125
|
+
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)
|
|
130
|
+
}, 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)
|
|
123
144
|
};
|
|
124
|
-
return { line: n, candlestick:
|
|
145
|
+
return { line: n, candlestick: a, bar: c, pie: l, heatmap: E };
|
|
125
146
|
}
|
|
126
147
|
export {
|
|
127
148
|
y as AnimationConfig,
|
|
128
149
|
v as DEFAULT_BAR_ENTRY,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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,
|
|
171
|
+
m as DEFAULT_Y_STICKY_MIN_MS
|
|
145
172
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
const e = (
|
|
1
|
+
const e = (a) => 1 - (1 - a) ** 3, s = (a) => a < 0.5 ? 4 * a ** 3 : 1 - (-2 * a + 2) ** 3 / 2, t = (a) => 1 + 2.30158 * (a - 1) ** 3 + 1.30158 * (a - 1) ** 2;
|
|
2
2
|
export {
|
|
3
|
+
s as easeInOutCubic,
|
|
4
|
+
t as easeOutBack,
|
|
3
5
|
e as easeOutCubic
|
|
4
6
|
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { easeOutCubic as h, easeInOutCubic as n } from "./easing.js";
|
|
2
|
+
class l {
|
|
3
|
+
#s = 0;
|
|
4
|
+
/** `null` = armed but awaiting the first tick to stamp the start. */
|
|
5
|
+
#t = null;
|
|
6
|
+
#i = !0;
|
|
7
|
+
/** Clock forwarded by the renderer's `tickAnimations` — keeps test
|
|
8
|
+
* harnesses (which stub `performance.now`) in control of progression. */
|
|
9
|
+
#e = 0;
|
|
10
|
+
/**
|
|
11
|
+
* Arm the wave for the upcoming first paint. No-op (stays settled) when
|
|
12
|
+
* the duration is zero/negative or the user prefers reduced motion.
|
|
13
|
+
*/
|
|
14
|
+
arm(t) {
|
|
15
|
+
if (t <= 0 || u()) {
|
|
16
|
+
this.#i = !0;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
this.#s = t, this.#t = null, this.#i = !1;
|
|
20
|
+
}
|
|
21
|
+
/** True while the wave still has frames to produce. */
|
|
22
|
+
get active() {
|
|
23
|
+
return !this.#i;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Advance the clock. Call once per render pass, before any progress
|
|
27
|
+
* reads. Settles the wave once the full `2 × durationMs` window elapsed.
|
|
28
|
+
*/
|
|
29
|
+
tick(t) {
|
|
30
|
+
this.#i || (this.#e = t, this.#t === null && (this.#t = t), t - this.#t >= this.#s * 2 && (this.#i = !0));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Eased entrance progress in `[0, 1]` for an element at normalized
|
|
34
|
+
* x-position `position` (0 = left edge of the visible window, 1 = right).
|
|
35
|
+
*/
|
|
36
|
+
progressAt(t) {
|
|
37
|
+
if (this.#i) return 1;
|
|
38
|
+
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);
|
|
41
|
+
}
|
|
42
|
+
/** Eased reveal-front position in `[0, 1]` across the full wave window. */
|
|
43
|
+
sweep() {
|
|
44
|
+
if (this.#i) return 1;
|
|
45
|
+
if (this.#t === null) return 0;
|
|
46
|
+
const t = s((this.#e - this.#t) / (this.#s * 2));
|
|
47
|
+
return n(t);
|
|
48
|
+
}
|
|
49
|
+
/** Raw (unclamped-by-easing) linear wave progress — drives fades that need
|
|
50
|
+
* to key off wall-clock position, e.g. the line head-glow bell curve. */
|
|
51
|
+
linear() {
|
|
52
|
+
return this.#i ? 1 : this.#t === null ? 0 : s((this.#e - this.#t) / (this.#s * 2));
|
|
53
|
+
}
|
|
54
|
+
/** Abort the wave — everything reads settled from the next frame. Called
|
|
55
|
+
* when the user pans/zooms mid-intro. */
|
|
56
|
+
finish() {
|
|
57
|
+
this.#i = !0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
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;
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
l as IntroWave
|
|
68
|
+
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { resolveAxisTextColor as w, resolveAxisFontSize as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function I(g) {
|
|
1
|
+
import { resolveAxisTextColor as w, resolveAxisFontSize as A } from "../theme/resolve.js";
|
|
2
|
+
const F = 0.01;
|
|
3
|
+
function $(g) {
|
|
5
4
|
const { chart: e, container: h, axis: r } = g, s = /* @__PURE__ */ new Map();
|
|
6
|
-
let
|
|
7
|
-
const
|
|
5
|
+
let y = null;
|
|
6
|
+
const m = r === "x" ? e.timeScale.tickTracker : e.yScale.tickTracker;
|
|
8
7
|
function k() {
|
|
9
8
|
return r === "x" ? e.timeScale.niceTickValues(e.getDataInterval()) : { ticks: e.yScale.niceTickValues(), tickInterval: 0 };
|
|
10
9
|
}
|
|
11
10
|
function p(t, o) {
|
|
12
|
-
return r === "x" ?
|
|
11
|
+
return r === "x" ? e.timeScale.formatX(t, o) : e.yScale.formatY(t);
|
|
13
12
|
}
|
|
14
13
|
function C(t, o) {
|
|
15
14
|
if (r === "x") {
|
|
@@ -19,20 +18,20 @@ function I(g) {
|
|
|
19
18
|
t.style.top = `${e.yScale.valueToY(o)}px`;
|
|
20
19
|
}
|
|
21
20
|
function x(t, o) {
|
|
22
|
-
t.style.color = w(o, r), t.style.fontSize = `${
|
|
21
|
+
t.style.color = w(o, r), t.style.fontSize = `${A(o, r)}px`, t.style.fontFamily = o.typography.fontFamily;
|
|
23
22
|
}
|
|
24
23
|
function T(t, o, u) {
|
|
25
24
|
const n = document.createElement("span");
|
|
26
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;
|
|
27
26
|
}
|
|
28
27
|
function l() {
|
|
29
|
-
const t = e.getTheme(), o = t !==
|
|
30
|
-
|
|
28
|
+
const t = e.getTheme(), o = t !== y;
|
|
29
|
+
y = t;
|
|
31
30
|
const { ticks: u, tickInterval: n } = k();
|
|
32
|
-
|
|
33
|
-
const { entries: d } =
|
|
31
|
+
m.setCurrentTicks(u);
|
|
32
|
+
const { entries: d } = m.snapshot(), v = /* @__PURE__ */ new Set();
|
|
34
33
|
for (const { value: a, opacity: f } of d) {
|
|
35
|
-
if (f <=
|
|
34
|
+
if (f <= F) continue;
|
|
36
35
|
v.add(a);
|
|
37
36
|
let i = s.get(a);
|
|
38
37
|
if (i === void 0)
|
|
@@ -56,5 +55,5 @@ function I(g) {
|
|
|
56
55
|
};
|
|
57
56
|
}
|
|
58
57
|
export {
|
|
59
|
-
|
|
58
|
+
$ as mountAxisLabels
|
|
60
59
|
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ScalarSpring as g } from "../animation/scalar-spring.js";
|
|
2
|
+
const r = 320, m = 0.15;
|
|
3
|
+
class w {
|
|
4
|
+
#t;
|
|
5
|
+
#e;
|
|
6
|
+
#i = !1;
|
|
7
|
+
constructor(i) {
|
|
8
|
+
this.#t = new g(i), this.#e = i;
|
|
9
|
+
}
|
|
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)
|
|
13
|
+
return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
14
|
+
if (o < 1) {
|
|
15
|
+
const h = n + (t - n) * o, a = l ? h : t;
|
|
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
|
+
}
|
|
18
|
+
if (!this.#i)
|
|
19
|
+
return this.#t.snap(t, { now: s }), this.#e = t, this.#i = !0, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
20
|
+
if (!u)
|
|
21
|
+
return this.#t.snap(t, { now: s }), this.#e = t, { positionValue: t, textValue: t, opacity: 1, animating: !1 };
|
|
22
|
+
const c = i.settleMs ?? r;
|
|
23
|
+
if (c <= 0)
|
|
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 };
|
|
28
|
+
}
|
|
29
|
+
#s(i) {
|
|
30
|
+
return i >= 1 ? 1 : d(i / m);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const V = 1e-9;
|
|
34
|
+
function d(e) {
|
|
35
|
+
return e <= 0 ? 0 : e >= 1 ? 1 : e;
|
|
36
|
+
}
|
|
37
|
+
function x(e) {
|
|
38
|
+
return e === !1 ? { glide: !1, countUp: !1, settleMs: 0 } : e === void 0 || e === !0 ? { glide: !0, countUp: !0, settleMs: r } : {
|
|
39
|
+
glide: e.glide ?? !0,
|
|
40
|
+
countUp: e.countUp ?? !0,
|
|
41
|
+
settleMs: e.settleMs ?? r
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function y() {
|
|
45
|
+
return typeof matchMedia != "function" ? !1 : matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
46
|
+
}
|
|
47
|
+
function U(e, i, t) {
|
|
48
|
+
const { from: n } = e.getVisibleRange();
|
|
49
|
+
return e.getStackedValueAtTime(i, n) ?? t;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
w as BadgeAnimator,
|
|
53
|
+
U as firstVisibleValue,
|
|
54
|
+
y as prefersReducedMotion,
|
|
55
|
+
x as resolveAnimate
|
|
56
|
+
};
|
|
@@ -1,26 +1,41 @@
|
|
|
1
|
-
import { renderEdgeIndicator as
|
|
2
|
-
function
|
|
1
|
+
import { renderEdgeIndicator as s } from "../components/edge-indicator.js";
|
|
2
|
+
function d(e) {
|
|
3
3
|
const o = performance.now();
|
|
4
4
|
for (const t of ["left", "right"]) {
|
|
5
|
-
|
|
6
|
-
if (
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
let r = e.edgeStates[t], n = 1;
|
|
6
|
+
if (r === "idle" || r === "has-more") {
|
|
7
|
+
const a = e.edgeExitFades[t];
|
|
8
|
+
if (a === null) continue;
|
|
9
|
+
r = "loading", n = a;
|
|
10
|
+
}
|
|
11
|
+
const l = e.resolveBoundary(t);
|
|
12
|
+
if (l === null) continue;
|
|
13
|
+
const { context: c } = e.scope;
|
|
14
|
+
n < 1 && (c.save(), c.globalAlpha *= n), s({
|
|
9
15
|
scope: e.scope,
|
|
10
16
|
timeScale: e.timeScale,
|
|
11
17
|
theme: e.theme,
|
|
18
|
+
chartMediaWidth: e.chartMediaWidth,
|
|
12
19
|
chartMediaHeight: e.chartMediaHeight,
|
|
13
|
-
boundaryTime:
|
|
20
|
+
boundaryTime: l,
|
|
14
21
|
side: t,
|
|
15
|
-
state:
|
|
16
|
-
now: o
|
|
17
|
-
|
|
22
|
+
state: r,
|
|
23
|
+
now: o,
|
|
24
|
+
customIndicator: e.edgeIndicatorFns[t],
|
|
25
|
+
resolveEdgeAnchor: () => e.resolveEdgeAnchor(t, l),
|
|
26
|
+
resolveEdgeBarSpacing: () => e.resolveEdgeBarSpacing(),
|
|
27
|
+
reportPlaceholders: (a) => e.reportPlaceholders(t, a)
|
|
28
|
+
}), n < 1 && c.restore();
|
|
18
29
|
}
|
|
19
30
|
}
|
|
20
|
-
function
|
|
31
|
+
function g(e, o, t) {
|
|
21
32
|
return o !== null ? o : e === "left" ? t.first ?? null : t.last ?? null;
|
|
22
33
|
}
|
|
34
|
+
function u(e, o) {
|
|
35
|
+
return "close" in o ? e === "left" ? o.open : o.close : o.value;
|
|
36
|
+
}
|
|
23
37
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
d as drawEdgeIndicators,
|
|
39
|
+
u as resolveEdgeAnchorValue,
|
|
40
|
+
g as resolveEdgeBoundary
|
|
26
41
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
|
+
import { isTimeSeriesRenderer as c } from "../series/types.js";
|
|
1
2
|
const a = (e) => "close" in e ? e.close : e.value;
|
|
2
|
-
function
|
|
3
|
-
const t =
|
|
3
|
+
function d(e, s, i) {
|
|
4
|
+
const t = s.find((f) => f.id === e);
|
|
4
5
|
if (!t) return null;
|
|
5
6
|
const n = t.renderer;
|
|
6
|
-
if (n
|
|
7
|
+
if (!c(n)) return null;
|
|
7
8
|
const r = n.getLastDataPoint();
|
|
8
9
|
if (!r) return null;
|
|
9
|
-
const { from: u, to: o } =
|
|
10
|
+
const { from: u, to: o } = i;
|
|
10
11
|
if (r.time >= u && r.time <= o)
|
|
11
12
|
return { value: a(r), isLive: !0 };
|
|
12
|
-
const
|
|
13
|
-
return
|
|
13
|
+
const l = n.getVisibleDataPoints(u, o);
|
|
14
|
+
return l.length === 0 ? null : { value: a(l[l.length - 1]), isLive: !1 };
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
const t =
|
|
17
|
-
return t ? t.renderer.getStackedLastValue?.() ||
|
|
16
|
+
function v(e, s, i) {
|
|
17
|
+
const t = s.find((r) => r.id === e);
|
|
18
|
+
return t ? t.renderer.getStackedLastValue?.() || d(e, s, i) : null;
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
const
|
|
21
|
-
if (!
|
|
22
|
-
const t =
|
|
23
|
-
if (t
|
|
20
|
+
function L(e, s) {
|
|
21
|
+
const i = s.find((r) => r.id === e);
|
|
22
|
+
if (!i) return null;
|
|
23
|
+
const t = i.renderer;
|
|
24
|
+
if (!c(t)) return null;
|
|
24
25
|
const n = t.getSecondLastDataPoint();
|
|
25
26
|
return n ? "close" in n ? n.close : n.value : null;
|
|
26
27
|
}
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
d as getLastValue,
|
|
30
|
+
L as getPreviousClose,
|
|
31
|
+
v as getStackedLastValue
|
|
31
32
|
};
|