@wick-charts/vue 0.8.1 → 0.8.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.
- package/dist/BandSeries.vue.js +25 -24
- package/dist/BarSeries.vue.js +27 -26
- package/dist/CandlestickSeries.vue.js +25 -24
- package/dist/HeatmapSeries.vue.js +21 -20
- package/dist/LineSeries.vue.js +24 -23
- package/dist/PieSeries.vue.js +25 -24
- package/dist/composables.js +63 -36
- package/dist/core/dist/axis/dom-labels.js +64 -53
- package/dist/core/dist/chart/options.js +1 -1
- package/dist/core/dist/chart/y-target.js +38 -32
- package/dist/core/dist/chart.js +475 -439
- package/dist/core/dist/data/decimation.js +52 -51
- package/dist/core/dist/data/store.js +38 -20
- package/dist/core/dist/data/sync.js +80 -69
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/tick-tracker.js +2 -1
- package/dist/core/dist/series/band.js +1 -1
- package/dist/core/dist/series/bar.js +240 -211
- package/dist/core/dist/series/base-multi-layer.js +267 -249
- package/dist/core/dist/series/candlestick.js +116 -116
- package/dist/core/dist/series/line.js +540 -455
- package/dist/core/dist/snapshots.js +96 -77
- package/dist/index.d.ts +22 -4
- package/dist/ui/InfoBar.vue.js +68 -68
- package/dist/ui/NumberFlow.vue.js +36 -27
- package/dist/ui/Tooltip.vue.js +127 -130
- package/package.json +2 -2
- package/src/BandSeries.vue +5 -3
- package/src/BarSeries.vue +5 -3
- package/src/CandlestickSeries.vue +5 -4
- package/src/ChartContainer.vue +1 -1
- package/src/HeatmapSeries.vue +5 -4
- package/src/LineSeries.vue +5 -3
- package/src/PieSeries.vue +6 -5
- package/src/composables.ts +64 -1
- package/src/ui/InfoBar.vue +11 -3
- package/src/ui/NumberFlow.vue +17 -3
- package/src/ui/Tooltip.vue +23 -12
|
@@ -1,124 +1,143 @@
|
|
|
1
|
-
import { isGapPoint as f, pointValue as
|
|
1
|
+
import { isGapPoint as f, pointValue as h } from "./utils/point.js";
|
|
2
|
+
import { formatDate as x } from "./utils/time.js";
|
|
2
3
|
const g = /* @__PURE__ */ new WeakMap();
|
|
3
|
-
function I(e,
|
|
4
|
-
return g.get(e)?.get(
|
|
4
|
+
function I(e, t) {
|
|
5
|
+
return g.get(e)?.get(t);
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
|
|
7
|
+
function y(e, t, o) {
|
|
8
|
+
let n = g.get(e);
|
|
9
|
+
n || (n = /* @__PURE__ */ new Map(), g.set(e, n)), n.set(t, o);
|
|
9
10
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
return e.x !== void 0 && (
|
|
11
|
+
function b(e) {
|
|
12
|
+
const t = e.low !== void 0 && e.high !== void 0 ? { time: e.time, low: e.low, high: e.high } : { time: e.time, value: e.value };
|
|
13
|
+
return e.x !== void 0 && (t.x = e.x), t;
|
|
13
14
|
}
|
|
14
|
-
function S(e,
|
|
15
|
-
if (
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
const s =
|
|
19
|
-
return
|
|
20
|
-
}),
|
|
15
|
+
function S(e, t) {
|
|
16
|
+
if (t === "none" || e.length <= 1) return e;
|
|
17
|
+
const o = [...e];
|
|
18
|
+
return o.sort((n, r) => {
|
|
19
|
+
const s = h(n.data), c = h(r.data);
|
|
20
|
+
return t === "asc" ? s - c : c - s;
|
|
21
|
+
}), o;
|
|
21
22
|
}
|
|
22
23
|
function m(e) {
|
|
23
|
-
const
|
|
24
|
+
const t = Object.freeze({ ...e.data }), o = {
|
|
24
25
|
id: e.id,
|
|
25
26
|
seriesId: e.seriesId,
|
|
26
27
|
layerIndex: e.layerIndex,
|
|
27
28
|
label: e.label,
|
|
28
|
-
data:
|
|
29
|
-
color: e.color
|
|
29
|
+
data: t,
|
|
30
|
+
color: e.color,
|
|
31
|
+
...e.share === void 0 ? {} : { share: e.share }
|
|
30
32
|
};
|
|
31
|
-
return Object.freeze(
|
|
33
|
+
return Object.freeze(o);
|
|
32
34
|
}
|
|
33
|
-
function
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
return
|
|
35
|
+
function w(e, t) {
|
|
36
|
+
const o = t.sort ?? "none", n = e.getSnapshotVersion(), r = I(e, t.cacheKey);
|
|
37
|
+
if (r && r.version === n && r.time === t.time && r.sort === o)
|
|
38
|
+
return r.data;
|
|
37
39
|
const s = [];
|
|
38
|
-
for (const
|
|
39
|
-
if (!e.isSeriesVisible(
|
|
40
|
-
if (e.getSeriesLayers(
|
|
41
|
-
const d = e.getLayerSnapshots(
|
|
40
|
+
for (const a of e.getSeriesIds()) {
|
|
41
|
+
if (!e.isSeriesVisible(a)) continue;
|
|
42
|
+
if (e.getSeriesLayers(a) !== null) {
|
|
43
|
+
const d = e.getLayerSnapshots(a, t.time);
|
|
42
44
|
if (!d) continue;
|
|
43
|
-
for (const
|
|
44
|
-
const u =
|
|
45
|
+
for (const i of d) {
|
|
46
|
+
const u = b(i);
|
|
45
47
|
f(u) || s.push(
|
|
46
48
|
m({
|
|
47
|
-
id: `${
|
|
48
|
-
seriesId:
|
|
49
|
-
layerIndex:
|
|
50
|
-
label: e.getLayerLabel(
|
|
49
|
+
id: `${a}_layer${i.layerIndex}`,
|
|
50
|
+
seriesId: a,
|
|
51
|
+
layerIndex: i.layerIndex,
|
|
52
|
+
label: e.getLayerLabel(a, i.layerIndex),
|
|
51
53
|
data: u,
|
|
52
|
-
color:
|
|
54
|
+
color: i.color,
|
|
55
|
+
share: i.share
|
|
53
56
|
})
|
|
54
57
|
);
|
|
55
58
|
}
|
|
56
59
|
continue;
|
|
57
60
|
}
|
|
58
|
-
const
|
|
59
|
-
!
|
|
61
|
+
const l = e.getDataAtTime(a, t.time);
|
|
62
|
+
!l || f(l) || s.push(
|
|
60
63
|
m({
|
|
61
|
-
id:
|
|
62
|
-
seriesId:
|
|
63
|
-
label: e.getSeriesLabel(
|
|
64
|
-
data:
|
|
65
|
-
color: e.getSeriesColor(
|
|
64
|
+
id: a,
|
|
65
|
+
seriesId: a,
|
|
66
|
+
label: e.getSeriesLabel(a),
|
|
67
|
+
data: l,
|
|
68
|
+
color: e.getSeriesColor(a) ?? "#888"
|
|
66
69
|
})
|
|
67
70
|
);
|
|
68
71
|
}
|
|
69
|
-
const
|
|
70
|
-
return
|
|
72
|
+
const c = Object.freeze(S(s, o));
|
|
73
|
+
return y(e, t.cacheKey, { version: n, time: t.time, sort: o, data: c }), c;
|
|
71
74
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
c > i || d || (i = c, s = t.data.time);
|
|
75
|
+
const v = 864e5;
|
|
76
|
+
function p(e, t) {
|
|
77
|
+
let o = e, n = Number.POSITIVE_INFINITY;
|
|
78
|
+
for (const r of t) {
|
|
79
|
+
const s = Math.abs(r.data.time - e), c = s === n && r.data.time <= o;
|
|
80
|
+
s > n || c || (n = s, o = r.data.time);
|
|
79
81
|
}
|
|
80
|
-
return
|
|
82
|
+
return o;
|
|
81
83
|
}
|
|
82
|
-
function L(e,
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
function L(e, t) {
|
|
85
|
+
const o = p(t.time, t.snapshots);
|
|
86
|
+
return e.timeScale.formatPointX(o, t.interval);
|
|
87
|
+
}
|
|
88
|
+
function T(e, t) {
|
|
89
|
+
const o = L(e, t);
|
|
90
|
+
if (e.timeScale.getType() !== "time") return o;
|
|
91
|
+
const n = p(t.time, t.snapshots), r = x(n, { locale: e.timeScale.getLocale(), timeZone: e.timeScale.getTimeZone() });
|
|
92
|
+
return t.interval >= v && e.timeScale.getFormat() === null ? r : `${r} ${o}`;
|
|
93
|
+
}
|
|
94
|
+
function O(e, t) {
|
|
95
|
+
const o = t(h(e.data));
|
|
96
|
+
return e.share === void 0 ? o : `${Number(e.share.toFixed(1))}% · ${o}`;
|
|
97
|
+
}
|
|
98
|
+
function j(e, t) {
|
|
99
|
+
const o = t.sort ?? "none", n = e.getSnapshotVersion(), r = I(e, t.cacheKey);
|
|
100
|
+
if (r && r.version === n && r.time === null && r.sort === o)
|
|
101
|
+
return r.data;
|
|
86
102
|
const s = [];
|
|
87
|
-
for (const
|
|
88
|
-
if (!e.isSeriesVisible(
|
|
89
|
-
const
|
|
90
|
-
if (
|
|
91
|
-
for (const
|
|
92
|
-
const u =
|
|
103
|
+
for (const a of e.getSeriesIds()) {
|
|
104
|
+
if (!e.isSeriesVisible(a)) continue;
|
|
105
|
+
const l = e.getLayerLastSnapshots(a);
|
|
106
|
+
if (l) {
|
|
107
|
+
for (const i of l) {
|
|
108
|
+
const u = b(i);
|
|
93
109
|
f(u) || s.push(
|
|
94
110
|
m({
|
|
95
|
-
id: `${
|
|
96
|
-
seriesId:
|
|
97
|
-
layerIndex:
|
|
98
|
-
label: e.getLayerLabel(
|
|
111
|
+
id: `${a}_layer${i.layerIndex}`,
|
|
112
|
+
seriesId: a,
|
|
113
|
+
layerIndex: i.layerIndex,
|
|
114
|
+
label: e.getLayerLabel(a, i.layerIndex),
|
|
99
115
|
data: u,
|
|
100
|
-
color:
|
|
116
|
+
color: i.color,
|
|
117
|
+
share: i.share
|
|
101
118
|
})
|
|
102
119
|
);
|
|
103
120
|
}
|
|
104
121
|
continue;
|
|
105
122
|
}
|
|
106
|
-
const d = e.getLastData(
|
|
123
|
+
const d = e.getLastData(a);
|
|
107
124
|
!d || f(d) || s.push(
|
|
108
125
|
m({
|
|
109
|
-
id:
|
|
110
|
-
seriesId:
|
|
111
|
-
label: e.getSeriesLabel(
|
|
126
|
+
id: a,
|
|
127
|
+
seriesId: a,
|
|
128
|
+
label: e.getSeriesLabel(a),
|
|
112
129
|
data: d,
|
|
113
|
-
color: e.getSeriesColor(
|
|
130
|
+
color: e.getSeriesColor(a) ?? "#888"
|
|
114
131
|
})
|
|
115
132
|
);
|
|
116
133
|
}
|
|
117
|
-
const
|
|
118
|
-
return
|
|
134
|
+
const c = Object.freeze(S(s, o));
|
|
135
|
+
return y(e, t.cacheKey, { version: n, time: null, sort: o, data: c }), c;
|
|
119
136
|
}
|
|
120
137
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
138
|
+
w as buildHoverSnapshots,
|
|
139
|
+
j as buildLastSnapshots,
|
|
140
|
+
L as formatHeaderX,
|
|
141
|
+
O as formatRowValue,
|
|
142
|
+
T as formatTooltipHeader
|
|
124
143
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -116,6 +116,7 @@ declare type __VLS_Props_13 = {
|
|
|
116
116
|
*/
|
|
117
117
|
format?: ((value: number) => string) | Intl.NumberFormatOptions;
|
|
118
118
|
locale?: string;
|
|
119
|
+
/** Per-digit spin duration in ms. A value that arrives sooner than this after the previous one snaps instead. */
|
|
119
120
|
spinDuration?: number;
|
|
120
121
|
};
|
|
121
122
|
|
|
@@ -290,7 +291,7 @@ declare type __VLS_Props_4 = {
|
|
|
290
291
|
* Viewport padding. `top`/`bottom` are in pixels. `left`/`right` accept either pixels (`50`)
|
|
291
292
|
* or data intervals (`{ intervals: 3 }`). Set to 0 for edge-to-edge sparklines. Updates are
|
|
292
293
|
* applied reactively when this prop or the measured header height changes.
|
|
293
|
-
* Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0 } }`.
|
|
294
|
+
* Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0.5 } }`.
|
|
294
295
|
*/
|
|
295
296
|
padding?: {
|
|
296
297
|
top?: number;
|
|
@@ -1728,7 +1729,7 @@ export declare interface BitmapCoordinateSpace {
|
|
|
1728
1729
|
* actually be drawing.
|
|
1729
1730
|
*
|
|
1730
1731
|
* The result is cached per `(chart, cacheKey)` slot; as long as
|
|
1731
|
-
* `chart.
|
|
1732
|
+
* `chart.getSnapshotVersion()` hasn't changed and `time`/`sort` match the
|
|
1732
1733
|
* cached call, the **same reference** is returned. This makes
|
|
1733
1734
|
* `React.memo((a, b) => a.snapshots === b.snapshots)` skip renders on
|
|
1734
1735
|
* crosshair moves that stay within one data point.
|
|
@@ -1755,7 +1756,7 @@ export declare interface BuildHoverSnapshotsArgs {
|
|
|
1755
1756
|
* at the primary layer's timestamp.
|
|
1756
1757
|
*
|
|
1757
1758
|
* Cached by `(chart, cacheKey)` + `sort`, invalidated on
|
|
1758
|
-
* `chart.
|
|
1759
|
+
* `chart.getSnapshotVersion()` bump. `time` is not an input, so the slot is
|
|
1759
1760
|
* stored with `time: null`.
|
|
1760
1761
|
*/
|
|
1761
1762
|
export declare function buildLastSnapshots(chart: ChartInstance, args: BuildLastSnapshotsArgs): readonly SeriesSnapshot[];
|
|
@@ -2082,6 +2083,13 @@ declare interface ChartEvents {
|
|
|
2082
2083
|
* tracked tick has reached its target opacity.
|
|
2083
2084
|
*/
|
|
2084
2085
|
tickFrame: () => void;
|
|
2086
|
+
/**
|
|
2087
|
+
* Fired once per main-layer frame while a series' displayed values animate
|
|
2088
|
+
* (value smoothing, entrance, layer fade, intro), and once on the frame they
|
|
2089
|
+
* settle. Snapshot readers (`InfoBar`, `Tooltip`) refresh off it, as
|
|
2090
|
+
* `buildHoverSnapshots` / `buildLastSnapshots` report those animated values.
|
|
2091
|
+
*/
|
|
2092
|
+
seriesFrame: () => void;
|
|
2085
2093
|
}
|
|
2086
2094
|
|
|
2087
2095
|
/**
|
|
@@ -2682,7 +2690,7 @@ export declare interface ChartOptions {
|
|
|
2682
2690
|
scales?: Record<string, YAxisConfig>;
|
|
2683
2691
|
/**
|
|
2684
2692
|
* Viewport padding. `top`/`bottom` are in pixels. `left`/`right` accept either pixels (`50`)
|
|
2685
|
-
* or data intervals (`{ intervals: 3 }`). Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0 } }`.
|
|
2693
|
+
* or data intervals (`{ intervals: 3 }`). Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0.5 } }`.
|
|
2686
2694
|
*/
|
|
2687
2695
|
padding?: {
|
|
2688
2696
|
top?: number;
|
|
@@ -3353,6 +3361,8 @@ export declare interface LayerSnapshot {
|
|
|
3353
3361
|
high?: number;
|
|
3354
3362
|
/** The sample's own X on a numeric or category axis. */
|
|
3355
3363
|
x?: number | string;
|
|
3364
|
+
/** On a percent stack, the row's percent of the rows listed with it. Absent elsewhere, and when they sum to 0. */
|
|
3365
|
+
share?: number;
|
|
3356
3366
|
}
|
|
3357
3367
|
|
|
3358
3368
|
export declare const Legend: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
@@ -4772,6 +4782,12 @@ export declare interface SeriesCreateEnv {
|
|
|
4772
4782
|
theme: ChartTheme;
|
|
4773
4783
|
/** Number of stacked layers requested via `layers` (`1` when omitted). */
|
|
4774
4784
|
layerCount: number;
|
|
4785
|
+
/**
|
|
4786
|
+
* First `theme.seriesColors` slot for this series' default layer colours:
|
|
4787
|
+
* the lowest run of `layerCount` slots no other series of the same type
|
|
4788
|
+
* holds, so two series don't both default to the first colour. `0` when omitted.
|
|
4789
|
+
*/
|
|
4790
|
+
paletteIndex?: number;
|
|
4775
4791
|
}
|
|
4776
4792
|
|
|
4777
4793
|
/**
|
|
@@ -4881,6 +4897,8 @@ export declare interface SeriesSnapshot {
|
|
|
4881
4897
|
readonly label?: string;
|
|
4882
4898
|
readonly data: Readonly<OHLCData> | Readonly<TimePoint> | Readonly<BandPoint>;
|
|
4883
4899
|
readonly color: string;
|
|
4900
|
+
/** On a percent stack, the layer's share of the column in percent — what the chart draws it at. */
|
|
4901
|
+
readonly share?: number;
|
|
4884
4902
|
}
|
|
4885
4903
|
|
|
4886
4904
|
/** Primary series types. Open-ended — a custom {@link SeriesDefinition} picks any string that isn't a built-in. */
|
package/dist/ui/InfoBar.vue.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { buildHoverSnapshots as
|
|
3
|
-
import { resolveCandlestickBodyColor as
|
|
4
|
-
import { formatCompact as
|
|
5
|
-
import { useCrosshairPosition as
|
|
6
|
-
import { useChartInstance as
|
|
7
|
-
const
|
|
1
|
+
import { defineComponent as T, computed as s, inject as B, ref as W, onMounted as N, onUnmounted as R, useSlots as A, unref as t, openBlock as l, createBlock as D, Teleport as M, createElementVNode as r, normalizeStyle as i, renderSlot as O, createElementBlock as u, Fragment as m, toDisplayString as p, renderList as F, createCommentVNode as L } from "vue";
|
|
2
|
+
import { buildHoverSnapshots as P, buildLastSnapshots as $, formatHeaderX as j, formatRowValue as U } from "../core/dist/snapshots.js";
|
|
3
|
+
import { resolveCandlestickBodyColor as X } from "../core/dist/theme/resolve.js";
|
|
4
|
+
import { formatCompact as q, formatPriceAdaptive as G } from "../core/dist/utils/format.js";
|
|
5
|
+
import { useCrosshairPosition as J } from "../composables.js";
|
|
6
|
+
import { useChartInstance as Q, ThemeKey as Y, InfoBarAnchorKey as Z } from "../context.js";
|
|
7
|
+
const ee = {
|
|
8
8
|
key: 0,
|
|
9
9
|
style: { display: "inline-flex", alignItems: "center", gap: "4px" }
|
|
10
|
-
},
|
|
10
|
+
}, te = {
|
|
11
11
|
key: 1,
|
|
12
12
|
style: { display: "inline-flex", alignItems: "center", gap: "3px" }
|
|
13
|
-
},
|
|
13
|
+
}, ae = {
|
|
14
14
|
key: 2,
|
|
15
15
|
style: { display: "inline-flex", alignItems: "center", gap: "3px" }
|
|
16
|
-
},
|
|
16
|
+
}, ue = /* @__PURE__ */ T({
|
|
17
17
|
__name: "InfoBar",
|
|
18
18
|
props: {
|
|
19
19
|
sort: {},
|
|
20
20
|
format: { type: Function }
|
|
21
21
|
},
|
|
22
|
-
setup(
|
|
23
|
-
const
|
|
24
|
-
() =>
|
|
25
|
-
),
|
|
22
|
+
setup(E) {
|
|
23
|
+
const k = E, C = s(() => k.sort ?? "none"), d = s(
|
|
24
|
+
() => k.format ?? ((a, _) => _ === "volume" ? q(a) : G(a))
|
|
25
|
+
), n = Q(), g = J(n), o = B(Y), x = B(Z);
|
|
26
26
|
if (!o)
|
|
27
27
|
throw new Error("<InfoBar> must be used within <ChartContainer>: missing ThemeKey.");
|
|
28
|
-
if (!
|
|
28
|
+
if (!x)
|
|
29
29
|
throw new Error("<InfoBar> must be used within <ChartContainer>: missing InfoBarAnchorKey.");
|
|
30
|
-
const h =
|
|
30
|
+
const h = W(0), y = () => {
|
|
31
31
|
h.value++;
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}),
|
|
36
|
-
|
|
33
|
+
N(() => {
|
|
34
|
+
n.on("overlayChange", y), n.on("seriesFrame", y), n.getSeriesIds().length > 0 && h.value++;
|
|
35
|
+
}), R(() => {
|
|
36
|
+
n.off("overlayChange", y), n.off("seriesFrame", y);
|
|
37
37
|
});
|
|
38
|
-
const
|
|
38
|
+
const b = s(() => {
|
|
39
39
|
h.value;
|
|
40
|
-
const a =
|
|
41
|
-
return a === null ? null :
|
|
42
|
-
}),
|
|
43
|
-
() =>
|
|
44
|
-
),
|
|
40
|
+
const a = g.value;
|
|
41
|
+
return a === null ? null : P(n, { time: a.time, sort: C.value, cacheKey: "infobar-hover" });
|
|
42
|
+
}), H = s(() => (h.value, $(n, { sort: C.value, cacheKey: "infobar-last" }))), v = s(() => b.value !== null && b.value.length > 0), c = s(
|
|
43
|
+
() => v.value ? b.value : H.value
|
|
44
|
+
), K = s(() => (h.value, n.getDataInterval())), S = s(() => c.value.length === 0 ? 0 : v.value && g.value ? g.value.time : Math.max(...c.value.map((a) => a.data.time))), V = A(), w = s(() => typeof V.default == "function");
|
|
45
45
|
function I(a) {
|
|
46
46
|
return "open" in a;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function z(a) {
|
|
49
49
|
return "high" in a && !I(a);
|
|
50
50
|
}
|
|
51
|
-
return (a, _) => t(
|
|
51
|
+
return (a, _) => t(x) && t(o) && c.value.length > 0 ? (l(), D(M, {
|
|
52
52
|
key: 0,
|
|
53
|
-
to: t(
|
|
53
|
+
to: t(x)
|
|
54
54
|
}, [
|
|
55
|
-
|
|
55
|
+
r("div", {
|
|
56
56
|
"data-tooltip-legend": "",
|
|
57
|
-
style:
|
|
57
|
+
style: i(
|
|
58
58
|
w.value ? {
|
|
59
59
|
display: "flex",
|
|
60
60
|
alignItems: "center",
|
|
@@ -62,7 +62,7 @@ const Z = {
|
|
|
62
62
|
fontSize: t(o).typography.fontSize + "px",
|
|
63
63
|
fontFamily: t(o).typography.fontFamily,
|
|
64
64
|
fontVariantNumeric: "tabular-nums",
|
|
65
|
-
opacity:
|
|
65
|
+
opacity: v.value ? 1 : 0.6,
|
|
66
66
|
transition: "opacity 0.2s ease",
|
|
67
67
|
pointerEvents: "none"
|
|
68
68
|
} : {
|
|
@@ -75,57 +75,57 @@ const Z = {
|
|
|
75
75
|
fontSize: t(o).typography.fontSize + "px",
|
|
76
76
|
fontFamily: t(o).typography.fontFamily,
|
|
77
77
|
fontVariantNumeric: "tabular-nums",
|
|
78
|
-
opacity:
|
|
78
|
+
opacity: v.value ? 1 : 0.6,
|
|
79
79
|
transition: "opacity 0.2s ease",
|
|
80
80
|
pointerEvents: "none"
|
|
81
81
|
}
|
|
82
82
|
)
|
|
83
83
|
}, [
|
|
84
|
-
w.value ?
|
|
84
|
+
w.value ? O(a.$slots, "default", {
|
|
85
85
|
key: 0,
|
|
86
86
|
snapshots: c.value,
|
|
87
87
|
time: S.value,
|
|
88
|
-
isHover:
|
|
89
|
-
}) : (
|
|
90
|
-
|
|
91
|
-
style:
|
|
92
|
-
}, p(t(j)(t(
|
|
93
|
-
(
|
|
88
|
+
isHover: v.value
|
|
89
|
+
}) : (l(), u(m, { key: 1 }, [
|
|
90
|
+
r("span", {
|
|
91
|
+
style: i({ color: t(o).axis.textColor, marginRight: "2px" })
|
|
92
|
+
}, p(t(j)(t(n), { time: S.value, snapshots: c.value, interval: K.value })), 5),
|
|
93
|
+
(l(!0), u(m, null, F(c.value, (e) => (l(), u(m, {
|
|
94
94
|
key: e.id
|
|
95
95
|
}, [
|
|
96
|
-
I(e.data) ? (
|
|
97
|
-
(
|
|
96
|
+
I(e.data) ? (l(), u("span", ee, [
|
|
97
|
+
(l(!0), u(m, null, F([
|
|
98
98
|
{ label: "O", field: "open", val: e.data.open },
|
|
99
99
|
{ label: "H", field: "high", val: e.data.high },
|
|
100
100
|
{ label: "L", field: "low", val: e.data.low },
|
|
101
101
|
{ label: "C", field: "close", val: e.data.close }
|
|
102
|
-
], (
|
|
103
|
-
key:
|
|
102
|
+
], (f) => (l(), u(m, {
|
|
103
|
+
key: f.label
|
|
104
104
|
}, [
|
|
105
|
-
|
|
106
|
-
style:
|
|
107
|
-
}, p(
|
|
108
|
-
|
|
109
|
-
style:
|
|
110
|
-
color: t(
|
|
105
|
+
r("span", {
|
|
106
|
+
style: i({ color: t(o).axis.textColor, opacity: 0.5, marginLeft: "5px" })
|
|
107
|
+
}, p(f.label), 5),
|
|
108
|
+
r("span", {
|
|
109
|
+
style: i({
|
|
110
|
+
color: t(X)(
|
|
111
111
|
e.data.close >= e.data.open ? t(o).candlestick.up.body : t(o).candlestick.down.body
|
|
112
112
|
),
|
|
113
113
|
fontWeight: 500,
|
|
114
114
|
marginLeft: "2px"
|
|
115
115
|
})
|
|
116
|
-
}, p(d.value(
|
|
116
|
+
}, p(d.value(f.val, f.field)), 5)
|
|
117
117
|
], 64))), 128)),
|
|
118
|
-
e.data.volume != null ? (
|
|
119
|
-
|
|
120
|
-
style:
|
|
118
|
+
e.data.volume != null ? (l(), u(m, { key: 0 }, [
|
|
119
|
+
r("span", {
|
|
120
|
+
style: i({ color: t(o).axis.textColor, opacity: 0.5, marginLeft: "5px" })
|
|
121
121
|
}, "V", 4),
|
|
122
|
-
|
|
123
|
-
style:
|
|
122
|
+
r("span", {
|
|
123
|
+
style: i({ color: t(o).axis.textColor, fontWeight: 500, marginLeft: "2px" })
|
|
124
124
|
}, p(d.value(e.data.volume, "volume")), 5)
|
|
125
125
|
], 64)) : L("", !0)
|
|
126
|
-
])) :
|
|
127
|
-
|
|
128
|
-
style:
|
|
126
|
+
])) : z(e.data) ? (l(), u("span", te, [
|
|
127
|
+
r("span", {
|
|
128
|
+
style: i({
|
|
129
129
|
width: "6px",
|
|
130
130
|
height: "6px",
|
|
131
131
|
borderRadius: "1px",
|
|
@@ -133,12 +133,12 @@ const Z = {
|
|
|
133
133
|
flexShrink: 0
|
|
134
134
|
})
|
|
135
135
|
}, null, 4),
|
|
136
|
-
|
|
137
|
-
style:
|
|
136
|
+
r("span", {
|
|
137
|
+
style: i({ color: e.color, fontWeight: 500 })
|
|
138
138
|
}, p(d.value(e.data.low, "low")) + " – " + p(d.value(e.data.high, "high")), 5)
|
|
139
|
-
])) : (
|
|
140
|
-
|
|
141
|
-
style:
|
|
139
|
+
])) : (l(), u("span", ae, [
|
|
140
|
+
r("span", {
|
|
141
|
+
style: i({
|
|
142
142
|
width: "6px",
|
|
143
143
|
height: "6px",
|
|
144
144
|
borderRadius: "50%",
|
|
@@ -146,9 +146,9 @@ const Z = {
|
|
|
146
146
|
flexShrink: 0
|
|
147
147
|
})
|
|
148
148
|
}, null, 4),
|
|
149
|
-
|
|
150
|
-
style:
|
|
151
|
-
}, p(d.value(
|
|
149
|
+
r("span", {
|
|
150
|
+
style: i({ color: e.color, fontWeight: 500 })
|
|
151
|
+
}, p(t(U)(e, (f) => d.value(f, "value"))), 5)
|
|
152
152
|
]))
|
|
153
153
|
], 64))), 128))
|
|
154
154
|
], 64))
|
|
@@ -157,5 +157,5 @@ const Z = {
|
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
export {
|
|
160
|
-
|
|
160
|
+
ue as default
|
|
161
161
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as k, ref as f, onMounted as N, computed as m, watch as I, openBlock as a, createElementBlock as l, Fragment as r, renderList as d, createElementVNode as y, normalizeStyle as w, toDisplayString as v } from "vue";
|
|
2
2
|
const x = { style: {
|
|
3
3
|
display: "inline-flex",
|
|
4
4
|
fontVariantNumeric: "tabular-nums",
|
|
@@ -14,7 +14,7 @@ const x = { style: {
|
|
|
14
14
|
}, F = {
|
|
15
15
|
key: 1,
|
|
16
16
|
style: { display: "inline-block" }
|
|
17
|
-
},
|
|
17
|
+
}, S = /* @__PURE__ */ k({
|
|
18
18
|
__name: "NumberFlow",
|
|
19
19
|
props: {
|
|
20
20
|
value: {},
|
|
@@ -22,48 +22,57 @@ const x = { style: {
|
|
|
22
22
|
locale: { default: "en-US" },
|
|
23
23
|
spinDuration: { default: 350 }
|
|
24
24
|
},
|
|
25
|
-
setup(
|
|
26
|
-
const
|
|
27
|
-
|
|
25
|
+
setup(h) {
|
|
26
|
+
const o = h, i = f(!1);
|
|
27
|
+
N(() => {
|
|
28
28
|
i.value = !0;
|
|
29
29
|
});
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
if (typeof
|
|
33
|
-
const n = new Intl.NumberFormat(
|
|
34
|
-
return (
|
|
35
|
-
}),
|
|
36
|
-
const
|
|
37
|
-
for (const
|
|
38
|
-
|
|
30
|
+
const u = m(() => {
|
|
31
|
+
const e = o.format;
|
|
32
|
+
if (typeof e == "function") return e;
|
|
33
|
+
const n = new Intl.NumberFormat(o.locale, typeof e == "object" ? e : void 0);
|
|
34
|
+
return (t) => n.format(t);
|
|
35
|
+
}), _ = m(() => {
|
|
36
|
+
const e = u.value(o.value), n = [];
|
|
37
|
+
for (const t of e)
|
|
38
|
+
t >= "0" && t <= "9" ? n.push({ type: "digit", value: t }) : n.push({ type: "symbol", value: t });
|
|
39
39
|
return n;
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
}), s = f(o.spinDuration);
|
|
41
|
+
let c = Number.NEGATIVE_INFINITY;
|
|
42
|
+
I(
|
|
43
|
+
() => u.value(o.value),
|
|
44
|
+
() => {
|
|
45
|
+
const e = performance.now(), n = e - c < o.spinDuration;
|
|
46
|
+
c = e, s.value = n ? 0 : o.spinDuration;
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
const b = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
50
|
+
return (e, n) => (a(), l("span", x, [
|
|
51
|
+
(a(!0), l(r, null, d(_.value, (t, g) => (a(), l(r, { key: g }, [
|
|
52
|
+
t.type === "digit" ? (a(), l("span", D, [
|
|
53
|
+
y("span", {
|
|
54
|
+
style: w({
|
|
46
55
|
display: "flex",
|
|
47
56
|
flexDirection: "column",
|
|
48
|
-
transform: "translateY(" + -parseInt(
|
|
49
|
-
transition: i.value ? "transform " +
|
|
57
|
+
transform: "translateY(" + -parseInt(t.value) * 1.2 + "em)",
|
|
58
|
+
transition: i.value && s.value > 0 ? "transform " + s.value + "ms cubic-bezier(0.16, 1, 0.3, 1)" : "none"
|
|
50
59
|
})
|
|
51
60
|
}, [
|
|
52
|
-
(
|
|
53
|
-
key:
|
|
61
|
+
(a(), l(r, null, d(b, (p) => y("span", {
|
|
62
|
+
key: p,
|
|
54
63
|
style: {
|
|
55
64
|
display: "flex",
|
|
56
65
|
alignItems: "center",
|
|
57
66
|
justifyContent: "center",
|
|
58
67
|
height: "1.2em"
|
|
59
68
|
}
|
|
60
|
-
}, p
|
|
69
|
+
}, v(p), 1)), 64))
|
|
61
70
|
], 4)
|
|
62
|
-
])) : (
|
|
71
|
+
])) : (a(), l("span", F, v(t.value), 1))
|
|
63
72
|
], 64))), 128))
|
|
64
73
|
]));
|
|
65
74
|
}
|
|
66
75
|
});
|
|
67
76
|
export {
|
|
68
|
-
|
|
77
|
+
S as default
|
|
69
78
|
};
|