p1-charts 0.3.0 → 0.4.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/CHANGELOG.md +26 -0
- package/README.md +58 -2
- package/dist/CategoryBarChart-KYzsjGwg.js +715 -0
- package/dist/CategoryBarChart-KYzsjGwg.js.map +1 -0
- package/dist/{ChartFrame-B1bVFM2E.js → ChartFrame-DOEsou-R.js} +2 -2
- package/dist/{ChartFrame-B1bVFM2E.js.map → ChartFrame-DOEsou-R.js.map} +1 -1
- package/dist/ChartLegend-B8ZmIG2y.js +46 -0
- package/dist/ChartLegend-B8ZmIG2y.js.map +1 -0
- package/dist/{Heatmap-CFC753mV.js → Heatmap-Bwhf305C.js} +2 -2
- package/dist/{Heatmap-CFC753mV.js.map → Heatmap-Bwhf305C.js.map} +1 -1
- package/dist/{PieLegend-CbpjaOJH.js → PieLegend-16E6W10x.js} +3 -3
- package/dist/{PieLegend-CbpjaOJH.js.map → PieLegend-16E6W10x.js.map} +1 -1
- package/dist/PolarChart-C_vPz-3K.js +489 -0
- package/dist/PolarChart-C_vPz-3K.js.map +1 -0
- package/dist/{TimeSeriesChart-BzeHEtQl.js → TimeSeriesChart-BZMLERDZ.js} +451 -451
- package/dist/{TimeSeriesChart-BzeHEtQl.js.map → TimeSeriesChart-BZMLERDZ.js.map} +1 -1
- package/dist/category.d.ts +4 -1
- package/dist/category.d.ts.map +1 -1
- package/dist/category.js +4 -3
- package/dist/charts/CategoryBarChart/index.d.ts +3 -1
- package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
- package/dist/charts/ScatterChart/index.d.ts +1 -1
- package/dist/charts/ScatterChart/index.d.ts.map +1 -1
- package/dist/components/ChartLegend/index.d.ts +13 -0
- package/dist/components/ChartLegend/index.d.ts.map +1 -0
- package/dist/{css-BtFQ2bM4.js → css-BTZA9hea.js} +2 -2
- package/dist/{css-BtFQ2bM4.js.map → css-BTZA9hea.js.map} +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -63
- package/dist/index.js.map +1 -1
- package/dist/pie.js +1 -1
- package/dist/scatter.d.ts +4 -1
- package/dist/scatter.d.ts.map +1 -1
- package/dist/scatter.js +3 -2
- package/dist/series.js +1 -1
- package/dist/standalone/p1-charts.standalone.js +13 -0
- package/dist/standalone.d.ts +27 -0
- package/dist/standalone.d.ts.map +1 -0
- package/dist/story.js +2 -2
- package/dist/theme.js +2 -2
- package/dist/{theme.utils-DgmWROoe.js → theme.utils-DF_e8LxQ.js} +118 -119
- package/dist/theme.utils-DF_e8LxQ.js.map +1 -0
- package/dist/types/category.d.ts +16 -0
- package/dist/types/category.d.ts.map +1 -1
- package/dist/types/scatter.d.ts +31 -0
- package/dist/types/scatter.d.ts.map +1 -1
- package/dist/{useChartTheme-KKtc1C4K.js → useChartTheme-D0bQ3LQq.js} +2 -2
- package/dist/{useChartTheme-KKtc1C4K.js.map → useChartTheme-D0bQ3LQq.js.map} +1 -1
- package/dist/utils/category.utils.d.ts +13 -1
- package/dist/utils/category.utils.d.ts.map +1 -1
- package/dist/utils/scatter.utils.d.ts +17 -1
- package/dist/utils/scatter.utils.d.ts.map +1 -1
- package/dist/utils/theme.utils.d.ts +1 -1
- package/dist/utils/theme.utils.d.ts.map +1 -1
- package/package.json +7 -3
- package/src/category.ts +4 -1
- package/src/charts/CategoryBarChart/index.tsx +108 -19
- package/src/charts/ScatterChart/index.tsx +73 -10
- package/src/components/ChartLegend/index.tsx +46 -0
- package/src/index.ts +5 -1
- package/src/scatter.ts +4 -1
- package/src/standalone.tsx +68 -0
- package/src/types/category.ts +16 -0
- package/src/types/scatter.ts +20 -0
- package/src/utils/category.utils.ts +89 -2
- package/src/utils/scatter.utils.ts +22 -5
- package/src/utils/theme.utils.ts +18 -15
- package/dist/CategoryBarChart-1Kn3Vozc.js +0 -580
- package/dist/CategoryBarChart-1Kn3Vozc.js.map +0 -1
- package/dist/PolarChart-hcNTWKfJ.js +0 -450
- package/dist/PolarChart-hcNTWKfJ.js.map +0 -1
- package/dist/theme.utils-DgmWROoe.js.map +0 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { a as e, c as t, h as n, i as r, m as i, n as a, o, s, t as c, u as l, v as u } from "./theme.utils-
|
|
2
|
+
import { a as e, c as t, h as n, i as r, m as i, n as a, o, s, t as c, u as l, v as u } from "./theme.utils-DF_e8LxQ.js";
|
|
3
3
|
import { n as d } from "./shared-C1pGJV4T.js";
|
|
4
4
|
import { o as f } from "./motion.utils-DFoqptDi.js";
|
|
5
|
-
import { t as p } from "./useChartTheme-
|
|
5
|
+
import { t as p } from "./useChartTheme-D0bQ3LQq.js";
|
|
6
6
|
import { t as m } from "./tooltip.utils-CXD_NapA.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { forwardRef as h, useCallback as g, useEffect as _, useImperativeHandle as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
8
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
9
|
+
import { AreaSeries as T, BaselineSeries as E, CandlestickSeries as D, ColorType as ee, CrosshairMode as O, HistogramSeries as k, LineSeries as A, LineStyle as j, createChart as te, createSeriesMarkers as ne } from "lightweight-charts";
|
|
10
10
|
//#region src/utils/timeScale.utils.ts
|
|
11
|
-
function
|
|
11
|
+
function M(e, t) {
|
|
12
12
|
let n = e.logicalToCoordinate(t), r = n === null ? null : e.coordinateToTime(n);
|
|
13
13
|
return r === null ? null : Number(r);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function N(e, t) {
|
|
16
16
|
let n = e.timeToCoordinate(t);
|
|
17
17
|
if (n !== null) return n;
|
|
18
18
|
let r = e.timeToIndex(t, !0);
|
|
19
19
|
if (r === null) return null;
|
|
20
|
-
let i = Math.max(0, r - 1), a =
|
|
20
|
+
let i = Math.max(0, r - 1), a = M(e, i), o = M(e, i + 1), s = e.logicalToCoordinate(i), c = e.logicalToCoordinate(i + 1);
|
|
21
21
|
return a === null || o === null || s === null || c === null || !(o > a) ? null : s + (t - a) / (o - a) * (c - s);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function P(e, t, n) {
|
|
24
24
|
let r = (t) => {
|
|
25
25
|
let n = e.timeToIndex(t, !0);
|
|
26
26
|
return n === null ? null : Number(n);
|
|
27
27
|
}, i = r(t), a = r(n);
|
|
28
28
|
if (i === null || a === null) return null;
|
|
29
|
-
let o =
|
|
29
|
+
let o = M(e, i), s = M(e, a);
|
|
30
30
|
if (o === null || s === null || o < t) return null;
|
|
31
31
|
let c = s < n ? a : a - 1, l = e.logicalToCoordinate(i), u = e.logicalToCoordinate(c);
|
|
32
32
|
if (c < i || l === null || u === null) return null;
|
|
@@ -35,30 +35,30 @@ function I(e, t, n) {
|
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/styles/seriesChart.ts
|
|
38
|
-
var
|
|
38
|
+
var re = { position: "relative" }, ie = {
|
|
39
39
|
position: "absolute",
|
|
40
40
|
inset: 0,
|
|
41
41
|
zIndex: 0
|
|
42
|
-
},
|
|
42
|
+
}, ae = {
|
|
43
43
|
position: "absolute",
|
|
44
44
|
top: 0,
|
|
45
45
|
left: 0,
|
|
46
46
|
display: "none",
|
|
47
47
|
opacity: .15,
|
|
48
48
|
pointerEvents: "none"
|
|
49
|
-
},
|
|
49
|
+
}, F = {
|
|
50
50
|
position: "absolute",
|
|
51
51
|
top: 0,
|
|
52
52
|
right: 0,
|
|
53
53
|
opacity: 0,
|
|
54
54
|
pointerEvents: "none"
|
|
55
|
-
},
|
|
55
|
+
}, I = {
|
|
56
56
|
position: "absolute",
|
|
57
57
|
bottom: 40,
|
|
58
58
|
left: "50%",
|
|
59
59
|
transform: "translateX(-50%)"
|
|
60
|
-
},
|
|
61
|
-
...
|
|
60
|
+
}, L = {
|
|
61
|
+
...I,
|
|
62
62
|
minHeight: 28,
|
|
63
63
|
padding: "4px 12px",
|
|
64
64
|
borderRadius: 999,
|
|
@@ -69,7 +69,7 @@ var te = { position: "relative" }, ne = {
|
|
|
69
69
|
fontSize: 12,
|
|
70
70
|
cursor: "pointer",
|
|
71
71
|
touchAction: "manipulation"
|
|
72
|
-
},
|
|
72
|
+
}, R = {
|
|
73
73
|
position: "absolute",
|
|
74
74
|
top: 8,
|
|
75
75
|
right: 8,
|
|
@@ -81,16 +81,16 @@ var te = { position: "relative" }, ne = {
|
|
|
81
81
|
padding: 0,
|
|
82
82
|
listStyle: "none",
|
|
83
83
|
pointerEvents: "none"
|
|
84
|
-
},
|
|
84
|
+
}, z = {
|
|
85
85
|
display: "flex",
|
|
86
86
|
alignItems: "center",
|
|
87
87
|
gap: 6
|
|
88
|
-
},
|
|
88
|
+
}, B = {
|
|
89
89
|
flex: "none",
|
|
90
90
|
width: 10,
|
|
91
91
|
height: 10,
|
|
92
92
|
boxSizing: "border-box"
|
|
93
|
-
},
|
|
93
|
+
}, oe = {
|
|
94
94
|
position: "absolute",
|
|
95
95
|
top: 0,
|
|
96
96
|
left: 0,
|
|
@@ -99,7 +99,7 @@ var te = { position: "relative" }, ne = {
|
|
|
99
99
|
};
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region src/hooks/useChart.ts
|
|
102
|
-
function
|
|
102
|
+
function V(e = {}) {
|
|
103
103
|
if (!e.layout) return e;
|
|
104
104
|
let { colorSpace: t, colorParsers: n, ...r } = e.layout;
|
|
105
105
|
return {
|
|
@@ -107,32 +107,32 @@ function U(e = {}) {
|
|
|
107
107
|
layout: r
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function se(e, t, n, r) {
|
|
111
111
|
let i = e.current.owner === t ? e.current.options : {}, a = u(n, i, r);
|
|
112
112
|
return a && (e.current = {
|
|
113
113
|
owner: t,
|
|
114
114
|
options: r
|
|
115
115
|
}), a;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
let [a, o] =
|
|
117
|
+
function ce(e, t, r, i) {
|
|
118
|
+
let [a, o] = x(null), [s, c] = x(0), l = b(r), u = b({
|
|
119
119
|
owner: null,
|
|
120
120
|
options: {}
|
|
121
|
-
}), d =
|
|
121
|
+
}), d = b({
|
|
122
122
|
owner: null,
|
|
123
123
|
options: {}
|
|
124
124
|
});
|
|
125
|
-
return l.current = r,
|
|
125
|
+
return l.current = r, _(() => {
|
|
126
126
|
let r = e.current;
|
|
127
127
|
if (!r) return;
|
|
128
|
-
let i = l.current?.layout, a =
|
|
128
|
+
let i = l.current?.layout, a = te(r, n({ autoSize: !0 }, { layout: {
|
|
129
129
|
colorSpace: i?.colorSpace,
|
|
130
130
|
colorParsers: i?.colorParsers
|
|
131
131
|
} })), s = a.addSeries(t);
|
|
132
132
|
return o({
|
|
133
133
|
chart: a,
|
|
134
134
|
series: s,
|
|
135
|
-
chartDefaults:
|
|
135
|
+
chartDefaults: V(n(a.options())),
|
|
136
136
|
seriesDefaults: n(s.options())
|
|
137
137
|
}), () => {
|
|
138
138
|
o(null), a.remove();
|
|
@@ -141,33 +141,33 @@ function oe(e, t, r, i) {
|
|
|
141
141
|
e,
|
|
142
142
|
t,
|
|
143
143
|
s
|
|
144
|
-
]),
|
|
144
|
+
]), _(() => {
|
|
145
145
|
if (!a) return;
|
|
146
|
-
let e =
|
|
146
|
+
let e = V(r), t = se(u, a, a.chartDefaults, e);
|
|
147
147
|
t ? a.chart.applyOptions(t) : c((e) => e + 1);
|
|
148
|
-
}, [a, r]),
|
|
148
|
+
}, [a, r]), _(() => {
|
|
149
149
|
if (!a) return;
|
|
150
|
-
let e = i ?? {}, t =
|
|
150
|
+
let e = i ?? {}, t = se(d, a, a.seriesDefaults, e);
|
|
151
151
|
t ? a.series.applyOptions(t) : c((e) => e + 1);
|
|
152
152
|
}, [a, i]), a;
|
|
153
153
|
}
|
|
154
154
|
//#endregion
|
|
155
155
|
//#region src/utils/time.utils.ts
|
|
156
|
-
var
|
|
157
|
-
function
|
|
156
|
+
var le = 1e11;
|
|
157
|
+
function H(e) {
|
|
158
158
|
let t, n;
|
|
159
159
|
if (e instanceof Date) t = e.getTime(), n = !0;
|
|
160
160
|
else if (typeof e == "string") {
|
|
161
161
|
if (t = Date.parse(e), n = !0, !Number.isFinite(t)) {
|
|
162
162
|
let r = e.trim();
|
|
163
|
-
t = r === "" ? NaN : Number(r), n = Math.abs(t) >
|
|
163
|
+
t = r === "" ? NaN : Number(r), n = Math.abs(t) > le;
|
|
164
164
|
}
|
|
165
|
-
} else t = e, n = Math.abs(t) >
|
|
165
|
+
} else t = e, n = Math.abs(t) > le;
|
|
166
166
|
return Number.isFinite(t) ? Math.floor(n ? t / 1e3 : t) : null;
|
|
167
167
|
}
|
|
168
168
|
//#endregion
|
|
169
169
|
//#region src/utils/data.utils.ts
|
|
170
|
-
function
|
|
170
|
+
function ue(e, t) {
|
|
171
171
|
let n = /* @__PURE__ */ new Map();
|
|
172
172
|
for (let r of e) {
|
|
173
173
|
let e = t.time(r);
|
|
@@ -184,7 +184,7 @@ function ce(e, t) {
|
|
|
184
184
|
indexByTime: s
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function de(e) {
|
|
188
188
|
return [
|
|
189
189
|
e.open,
|
|
190
190
|
e.high,
|
|
@@ -192,10 +192,10 @@ function le(e) {
|
|
|
192
192
|
e.close
|
|
193
193
|
].every(Number.isFinite);
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
return
|
|
197
|
-
time: (e) =>
|
|
198
|
-
valid:
|
|
195
|
+
function fe(e) {
|
|
196
|
+
return ue(e, {
|
|
197
|
+
time: (e) => H(e.time),
|
|
198
|
+
valid: de,
|
|
199
199
|
row: (e) => e,
|
|
200
200
|
data: (e, t) => {
|
|
201
201
|
let { open: n, high: r, low: i, close: a, color: o, borderColor: s, wickColor: c } = e;
|
|
@@ -212,9 +212,9 @@ function ue(e) {
|
|
|
212
212
|
}
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return
|
|
217
|
-
time: (e) =>
|
|
215
|
+
function U(e) {
|
|
216
|
+
return ue(e, {
|
|
217
|
+
time: (e) => H(e.time),
|
|
218
218
|
valid: (e) => Number.isFinite(e.value),
|
|
219
219
|
row: (e) => ({
|
|
220
220
|
time: e.time,
|
|
@@ -230,23 +230,23 @@ function G(e) {
|
|
|
230
230
|
})
|
|
231
231
|
});
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return typeof e == "number" || typeof e == "string" || e instanceof Date ?
|
|
233
|
+
function pe(e) {
|
|
234
|
+
return typeof e == "number" || typeof e == "string" || e instanceof Date ? H(e) : null;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function W(e, t) {
|
|
237
237
|
let n = 0, r = e.length - 1, i = null;
|
|
238
238
|
for (; n <= r;) {
|
|
239
|
-
let a = n + r >> 1, o =
|
|
239
|
+
let a = n + r >> 1, o = pe(e[a].time);
|
|
240
240
|
o !== null && o <= t ? (i = a, n = a + 1) : r = a - 1;
|
|
241
241
|
}
|
|
242
242
|
return i;
|
|
243
243
|
}
|
|
244
244
|
//#endregion
|
|
245
245
|
//#region src/utils/bands.utils.ts
|
|
246
|
-
var
|
|
247
|
-
function
|
|
246
|
+
var me = "rgba(128,128,128,0.15)";
|
|
247
|
+
function G(e) {
|
|
248
248
|
return e.flatMap((e) => {
|
|
249
|
-
let t =
|
|
249
|
+
let t = H(e.from), n = H(e.to);
|
|
250
250
|
return t === null || n === null || n < t ? [] : [{
|
|
251
251
|
...e,
|
|
252
252
|
start: t,
|
|
@@ -254,23 +254,23 @@ function q(e) {
|
|
|
254
254
|
}];
|
|
255
255
|
}).sort((e, t) => e.start - t.start);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function he(e) {
|
|
258
258
|
return [...new Set(e.map((e) => e.key))];
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function ge(e, t, r = {}) {
|
|
261
261
|
let a = t?.palette.categorical ?? [];
|
|
262
262
|
return Object.fromEntries(e.map((e, o) => {
|
|
263
|
-
let s = a[o % a.length], c = t && (i(s, t.bands.opacity) ?? s) ||
|
|
263
|
+
let s = a[o % a.length], c = t && (i(s, t.bands.opacity) ?? s) || me, l = r[e];
|
|
264
264
|
return [e, n({
|
|
265
265
|
fill: c,
|
|
266
266
|
label: e
|
|
267
267
|
}, t?.bands.styles?.[e], typeof l == "string" ? { fill: l } : l)];
|
|
268
268
|
}));
|
|
269
269
|
}
|
|
270
|
-
function
|
|
271
|
-
let i =
|
|
270
|
+
function _e(e, t, n, r = {}) {
|
|
271
|
+
let i = G(e).filter(({ start: e, end: n }) => e <= t && t < n).pop();
|
|
272
272
|
if (!i) return null;
|
|
273
|
-
let a =
|
|
273
|
+
let a = W(n, t), o = W(n, i.start - 1), s = a === null ? 0 : a - (o ?? -1);
|
|
274
274
|
return {
|
|
275
275
|
key: i.key,
|
|
276
276
|
label: r[i.key]?.label ?? i.key,
|
|
@@ -281,11 +281,11 @@ function he(e, t, n, r = {}) {
|
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/primitives/TimeRangePrimitive.ts
|
|
284
|
-
var
|
|
285
|
-
function
|
|
284
|
+
var K = 8;
|
|
285
|
+
function q(e, t) {
|
|
286
286
|
return e === "dashed" ? [4 * t, 3 * t] : e === "dotted" ? [t, 2 * t] : [];
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function ve(e, t, n) {
|
|
289
289
|
let { style: r } = n, { x: i, y: a, width: o, height: s } = t, c = n.color ?? r.fill, { stroke: l, hatch: u, text: d } = r;
|
|
290
290
|
if (e.save(), e.beginPath(), e.rect(i, a, o, s), e.clip(), c && (e.fillStyle = c, e.fillRect(i, a, o, s)), u && u.color) {
|
|
291
291
|
let t = Math.max(1, u.spacing ?? 6);
|
|
@@ -295,11 +295,11 @@ function ge(e, t, n) {
|
|
|
295
295
|
}
|
|
296
296
|
if (l?.color) {
|
|
297
297
|
let t = l.width ?? 1;
|
|
298
|
-
e.strokeStyle = l.color, e.lineWidth = t, e.setLineDash(
|
|
298
|
+
e.strokeStyle = l.color, e.lineWidth = t, e.setLineDash(q(l.style, t)), e.strokeRect(i + t / 2, a + t / 2, o - t, s - t), e.setLineDash([]);
|
|
299
299
|
}
|
|
300
|
-
n.label && d?.color && (e.fillStyle = d.color, e.font = `${d.weight ?? 400} ${d.size ?? 12}px ${d.family ?? "sans-serif"}`, e.textBaseline = "middle", e.fillText(n.label, i + (r.inset ??
|
|
300
|
+
n.label && d?.color && (e.fillStyle = d.color, e.font = `${d.weight ?? 400} ${d.size ?? 12}px ${d.family ?? "sans-serif"}`, e.textBaseline = "middle", e.fillText(n.label, i + (r.inset ?? K), a + s / 2)), e.restore();
|
|
301
301
|
}
|
|
302
|
-
var
|
|
302
|
+
var J = class {
|
|
303
303
|
zOrder = "normal";
|
|
304
304
|
edges = "time";
|
|
305
305
|
items = [];
|
|
@@ -314,7 +314,7 @@ var X = class {
|
|
|
314
314
|
}
|
|
315
315
|
applyOptions(e) {
|
|
316
316
|
this.zOrder = e.zOrder ?? "normal", this.edges = e.edges ?? "time", this.items = e.items.flatMap((t) => {
|
|
317
|
-
let n =
|
|
317
|
+
let n = H(t.from), r = H(t.to);
|
|
318
318
|
return n === null || r === null ? [] : [{
|
|
319
319
|
...t,
|
|
320
320
|
from: Math.min(n, r),
|
|
@@ -338,12 +338,12 @@ var X = class {
|
|
|
338
338
|
let n = t.timeScale();
|
|
339
339
|
e.useMediaCoordinateSpace(({ context: e, mediaSize: t }) => {
|
|
340
340
|
for (let r of this.items) {
|
|
341
|
-
let [i = null, a = null] = this.edges === "between-bars" ?
|
|
341
|
+
let [i = null, a = null] = this.edges === "between-bars" ? P(n, r.from, r.to) ?? [] : [N(n, r.from), N(n, r.to)];
|
|
342
342
|
if (i === null || a === null) continue;
|
|
343
343
|
let o = Math.max(0, i), s = Math.min(t.width, a);
|
|
344
344
|
if (s <= o) continue;
|
|
345
345
|
let c = Math.min(t.height, r.style.height ?? Infinity);
|
|
346
|
-
|
|
346
|
+
ve(e, {
|
|
347
347
|
x: o,
|
|
348
348
|
y: (t.height - c) / 2,
|
|
349
349
|
width: s - o,
|
|
@@ -355,12 +355,12 @@ var X = class {
|
|
|
355
355
|
};
|
|
356
356
|
//#endregion
|
|
357
357
|
//#region src/hooks/useBands.ts
|
|
358
|
-
function
|
|
359
|
-
let a =
|
|
358
|
+
function ye(e, t, n, r, i) {
|
|
359
|
+
let a = y(() => n ? G(n) : null, [n]), o = y(() => a ? ge(he(a), i, r) : {}, [
|
|
360
360
|
a,
|
|
361
361
|
i,
|
|
362
362
|
r
|
|
363
|
-
]), s =
|
|
363
|
+
]), s = y(() => a && {
|
|
364
364
|
items: a.map(({ from: e, to: t, key: n }) => ({
|
|
365
365
|
from: e,
|
|
366
366
|
to: t,
|
|
@@ -369,25 +369,25 @@ function _e(e, t, n, r, i) {
|
|
|
369
369
|
style: (e) => o[e] ?? {},
|
|
370
370
|
zOrder: "bottom",
|
|
371
371
|
edges: "between-bars"
|
|
372
|
-
}, [a, o]), c =
|
|
373
|
-
u.current = s,
|
|
372
|
+
}, [a, o]), c = b(null), l = b(null), u = b(s), d = s !== null;
|
|
373
|
+
u.current = s, _(() => {
|
|
374
374
|
let t = e?.chart.panes()[0];
|
|
375
375
|
if (!t || !u.current) return;
|
|
376
|
-
let n = new
|
|
376
|
+
let n = new J(u.current);
|
|
377
377
|
return t.attachPrimitive(n), c.current = n, l.current = u.current, () => {
|
|
378
378
|
t.detachPrimitive(n), c.current = null;
|
|
379
379
|
};
|
|
380
|
-
}, [e, d]),
|
|
380
|
+
}, [e, d]), _(() => {
|
|
381
381
|
s && c.current && l.current !== s && (c.current.applyOptions(s), l.current = s);
|
|
382
382
|
}, [s]);
|
|
383
|
-
let f =
|
|
383
|
+
let f = y(() => Object.entries(o).map(([e, t]) => ({
|
|
384
384
|
key: e,
|
|
385
385
|
label: t.label ?? e,
|
|
386
386
|
fill: t.fill ?? "",
|
|
387
387
|
legendColor: t.legendColor
|
|
388
|
-
})), [o]), p =
|
|
388
|
+
})), [o]), p = g((e) => {
|
|
389
389
|
let n = t.data[e]?.time;
|
|
390
|
-
return a && typeof n == "number" ?
|
|
390
|
+
return a && typeof n == "number" ? _e(a, n, t.data, o) : null;
|
|
391
391
|
}, [
|
|
392
392
|
a,
|
|
393
393
|
t,
|
|
@@ -400,14 +400,14 @@ function _e(e, t, n, r, i) {
|
|
|
400
400
|
}
|
|
401
401
|
//#endregion
|
|
402
402
|
//#region src/hooks/useOverlays.ts
|
|
403
|
-
function
|
|
404
|
-
let r =
|
|
405
|
-
return
|
|
403
|
+
function be(e, t = []) {
|
|
404
|
+
let r = b([]);
|
|
405
|
+
return _(() => {
|
|
406
406
|
r.current = [];
|
|
407
|
-
}, [e]),
|
|
407
|
+
}, [e]), _(() => {
|
|
408
408
|
if (!e) return;
|
|
409
409
|
let { chart: i } = e, a = r.current, o = (e) => {
|
|
410
|
-
let t = i.addSeries(
|
|
410
|
+
let t = i.addSeries(A, e);
|
|
411
411
|
return {
|
|
412
412
|
series: t,
|
|
413
413
|
defaults: n(t.options()),
|
|
@@ -420,21 +420,21 @@ function ve(e, t = []) {
|
|
|
420
420
|
let e = u(r.defaults, r.options, n);
|
|
421
421
|
e ? (r.series.applyOptions(e), r.options = n) : (i.removeSeries(r.series), r = void 0);
|
|
422
422
|
}
|
|
423
|
-
r || (a[t] = r = o(n)), r.series.setData(
|
|
423
|
+
r || (a[t] = r = o(n)), r.series.setData(U(e.data).data);
|
|
424
424
|
}), a.splice(t.length).forEach((e) => i.removeSeries(e.series));
|
|
425
425
|
}, [e, t]), r;
|
|
426
426
|
}
|
|
427
427
|
//#endregion
|
|
428
428
|
//#region src/utils/live.utils.ts
|
|
429
|
-
var
|
|
430
|
-
function
|
|
429
|
+
var xe = 2, Se = .002, Ce = .5;
|
|
430
|
+
function we(e, t) {
|
|
431
431
|
if (!e) return null;
|
|
432
432
|
let n = e.rows[e.rows.length - 1], r = t.rows[t.rows.length - 1];
|
|
433
433
|
if (!n || !r) return null;
|
|
434
|
-
let i =
|
|
434
|
+
let i = H(n.time), a = H(r.time), o = t.rows[t.rows.length - 2], s = t.rows.length === e.rows.length && a === i, c = t.rows.length === e.rows.length + 1 && o !== void 0 && H(o.time) === i;
|
|
435
435
|
return !s && !c || r.close === n.close ? null : r.close > n.close ? "up" : "down";
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function Te(e) {
|
|
438
438
|
if (typeof e != "object" || !e) return null;
|
|
439
439
|
let t = e, n = t.upColor, r = t.downColor;
|
|
440
440
|
if (typeof n == "string" && typeof r == "string") return {
|
|
@@ -452,30 +452,30 @@ function Ce(e) {
|
|
|
452
452
|
down: o
|
|
453
453
|
} : null;
|
|
454
454
|
}
|
|
455
|
-
function
|
|
456
|
-
let r = Math.exp(n *
|
|
455
|
+
function Ee(e, t, n) {
|
|
456
|
+
let r = Math.exp(n * Se);
|
|
457
457
|
if (!Number.isFinite(r)) return null;
|
|
458
458
|
let i = {
|
|
459
459
|
from: t - (t - e.from) * r,
|
|
460
460
|
to: t + (e.to - t) * r
|
|
461
461
|
};
|
|
462
|
-
return i.to - i.from <
|
|
462
|
+
return i.to - i.from < xe ? null : i;
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function De(e) {
|
|
465
465
|
let t = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY, n = e.deltaMode === 1 ? t * 16 : t;
|
|
466
466
|
return Number.isFinite(n) ? n : 0;
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function Oe(e, t) {
|
|
469
469
|
return e === null || t < 0 || e.to >= t - .5;
|
|
470
470
|
}
|
|
471
471
|
//#endregion
|
|
472
472
|
//#region src/hooks/useWheelZoom.ts
|
|
473
|
-
function
|
|
474
|
-
|
|
473
|
+
function ke(e, t, n) {
|
|
474
|
+
_(() => {
|
|
475
475
|
let r = t.current;
|
|
476
476
|
if (!e || !r || !n) return;
|
|
477
477
|
let { chart: i } = e, a = i.timeScale(), o = (e) => {
|
|
478
|
-
let t =
|
|
478
|
+
let t = De(e);
|
|
479
479
|
if (t === 0) return;
|
|
480
480
|
if (e.preventDefault(), !e.ctrlKey) {
|
|
481
481
|
let e = a.options().barSpacing;
|
|
@@ -484,7 +484,7 @@ function De(e, t, n) {
|
|
|
484
484
|
}
|
|
485
485
|
let n = r.getBoundingClientRect(), o = e.clientX - n.left - i.priceScale("left").width(), s = a.coordinateToLogical(o), c = a.getVisibleLogicalRange();
|
|
486
486
|
if (s === null || c === null) return;
|
|
487
|
-
let l =
|
|
487
|
+
let l = Ee(c, s, t);
|
|
488
488
|
l && a.setVisibleLogicalRange(l);
|
|
489
489
|
};
|
|
490
490
|
return r.addEventListener("wheel", o, { passive: !1 }), () => r.removeEventListener("wheel", o);
|
|
@@ -496,7 +496,7 @@ function De(e, t, n) {
|
|
|
496
496
|
}
|
|
497
497
|
//#endregion
|
|
498
498
|
//#region src/utils/bucket.utils.ts
|
|
499
|
-
function
|
|
499
|
+
function Ae(e, t, n, r) {
|
|
500
500
|
if (!(t > 0) || !Number.isFinite(t)) return e;
|
|
501
501
|
let i = e;
|
|
502
502
|
if (!Number.isFinite(i) || i <= 0) return e;
|
|
@@ -504,7 +504,7 @@ function Oe(e, t, n, r) {
|
|
|
504
504
|
for (; i > 1 && i / 2 * t >= n * 1.5;) i /= 2;
|
|
505
505
|
return i;
|
|
506
506
|
}
|
|
507
|
-
function
|
|
507
|
+
function je(e, t) {
|
|
508
508
|
if (!Number.isInteger(t) || t <= 0) throw Error("bucketSize must be a positive integer");
|
|
509
509
|
let n = [];
|
|
510
510
|
for (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));
|
|
@@ -512,13 +512,13 @@ function ke(e, t) {
|
|
|
512
512
|
}
|
|
513
513
|
//#endregion
|
|
514
514
|
//#region src/hooks/useAutoBucket.ts
|
|
515
|
-
var
|
|
516
|
-
function
|
|
517
|
-
return e ? e === !0 ?
|
|
515
|
+
var Me = 150, Ne = 6;
|
|
516
|
+
function Pe(e) {
|
|
517
|
+
return e ? e === !0 ? Ne : e.minBarWidth ?? Ne : null;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
520
|
-
let [r, i] =
|
|
521
|
-
return o.current = r, s.current = t.points.length,
|
|
519
|
+
function Fe(e, t, n) {
|
|
520
|
+
let [r, i] = x(1), a = Pe(n), o = b(r), s = b(t.points.length);
|
|
521
|
+
return o.current = r, s.current = t.points.length, _(() => {
|
|
522
522
|
if (!e || a === null) {
|
|
523
523
|
i(1);
|
|
524
524
|
return;
|
|
@@ -527,11 +527,11 @@ function Ne(e, t, n) {
|
|
|
527
527
|
let e = t.getVisibleLogicalRange(), n = e ? e.to - e.from : 0;
|
|
528
528
|
if (n <= 0) return;
|
|
529
529
|
let r = t.width() / (n * o.current);
|
|
530
|
-
i(
|
|
530
|
+
i(Ae(o.current, r, a, s.current));
|
|
531
531
|
}, l = () => {
|
|
532
532
|
clearTimeout(n), cancelAnimationFrame(r), n = setTimeout(() => {
|
|
533
533
|
r = requestAnimationFrame(c);
|
|
534
|
-
},
|
|
534
|
+
}, Me);
|
|
535
535
|
};
|
|
536
536
|
return t.subscribeVisibleLogicalRangeChange(l), l(), () => {
|
|
537
537
|
t.unsubscribeVisibleLogicalRangeChange(l), clearTimeout(n), cancelAnimationFrame(r);
|
|
@@ -540,14 +540,14 @@ function Ne(e, t, n) {
|
|
|
540
540
|
}
|
|
541
541
|
//#endregion
|
|
542
542
|
//#region src/hooks/useSeriesData.ts
|
|
543
|
-
function
|
|
544
|
-
let a =
|
|
543
|
+
function Ie(e, t, n, r, i) {
|
|
544
|
+
let a = y(() => n(t), [t, n]), o = Fe(e, a, i), s = y(() => o > 1 && r ? n(r(a.points, o)) : a, [
|
|
545
545
|
a,
|
|
546
546
|
o,
|
|
547
547
|
n,
|
|
548
548
|
r
|
|
549
|
-
]), c =
|
|
550
|
-
return
|
|
549
|
+
]), c = b(o);
|
|
550
|
+
return _(() => {
|
|
551
551
|
if (!e) return;
|
|
552
552
|
let t = e.chart.timeScale(), n = c.current / o, r = n === 1 ? null : t.getVisibleLogicalRange();
|
|
553
553
|
c.current = o, e.series.setData(s.data), r && t.setVisibleLogicalRange({
|
|
@@ -562,48 +562,48 @@ function Pe(e, t, n, r, i) {
|
|
|
562
562
|
}
|
|
563
563
|
//#endregion
|
|
564
564
|
//#region src/hooks/useLiveFollow.ts
|
|
565
|
-
var
|
|
565
|
+
var Le = 3e3, Re = [
|
|
566
566
|
"pointermove",
|
|
567
567
|
"pointerdown",
|
|
568
568
|
"wheel",
|
|
569
569
|
"keydown"
|
|
570
570
|
];
|
|
571
|
-
function
|
|
571
|
+
function ze(e, t) {
|
|
572
572
|
return e === null || t === null ? e === t : Math.abs(e.from - t.from) < .5 && Math.abs(e.to - t.to) < .5;
|
|
573
573
|
}
|
|
574
|
-
function
|
|
575
|
-
let [i, a] =
|
|
576
|
-
return o.current = n,
|
|
574
|
+
function Be(e, t, n, r) {
|
|
575
|
+
let [i, a] = x(!1), o = b(n);
|
|
576
|
+
return o.current = n, _(() => {
|
|
577
577
|
if (!e || !r) {
|
|
578
578
|
a(!1);
|
|
579
579
|
return;
|
|
580
580
|
}
|
|
581
|
-
let t = e.chart.timeScale(), i = () => a(!
|
|
581
|
+
let t = e.chart.timeScale(), i = () => a(!Oe(t.getVisibleLogicalRange(), n));
|
|
582
582
|
return i(), t.subscribeVisibleLogicalRangeChange(i), () => t.unsubscribeVisibleLogicalRangeChange(i);
|
|
583
583
|
}, [
|
|
584
584
|
e,
|
|
585
585
|
r,
|
|
586
586
|
n
|
|
587
|
-
]),
|
|
587
|
+
]), _(() => {
|
|
588
588
|
let n = t.current;
|
|
589
589
|
if (!e || !n || !r) return;
|
|
590
590
|
let i = e.chart.timeScale(), a, s = null, c = () => {
|
|
591
591
|
if (!s) return;
|
|
592
592
|
let { range: e, wasLive: t, shift: n } = s;
|
|
593
|
-
s = null, i.applyOptions({ shiftVisibleRangeOnNewBar: n }), t && n &&
|
|
593
|
+
s = null, i.applyOptions({ shiftVisibleRangeOnNewBar: n }), t && n && ze(e, i.getVisibleLogicalRange()) && i.scrollToRealTime();
|
|
594
594
|
}, l = () => {
|
|
595
595
|
if (!s) {
|
|
596
596
|
let e = i.getVisibleLogicalRange();
|
|
597
597
|
s = {
|
|
598
598
|
range: e,
|
|
599
|
-
wasLive:
|
|
599
|
+
wasLive: Oe(e, o.current),
|
|
600
600
|
shift: i.options().shiftVisibleRangeOnNewBar
|
|
601
601
|
}, i.applyOptions({ shiftVisibleRangeOnNewBar: !1 });
|
|
602
602
|
}
|
|
603
|
-
clearTimeout(a), a = setTimeout(c,
|
|
603
|
+
clearTimeout(a), a = setTimeout(c, Le);
|
|
604
604
|
};
|
|
605
|
-
return
|
|
606
|
-
clearTimeout(a),
|
|
605
|
+
return Re.forEach((e) => n.addEventListener(e, l, { passive: !0 })), () => {
|
|
606
|
+
clearTimeout(a), Re.forEach((e) => n.removeEventListener(e, l)), s && i.applyOptions({ shiftVisibleRangeOnNewBar: s.shift });
|
|
607
607
|
};
|
|
608
608
|
}, [
|
|
609
609
|
e,
|
|
@@ -616,20 +616,20 @@ function Re(e, t, n, r) {
|
|
|
616
616
|
}
|
|
617
617
|
//#endregion
|
|
618
618
|
//#region src/hooks/usePriceFlash.ts
|
|
619
|
-
var
|
|
620
|
-
function
|
|
621
|
-
let i =
|
|
622
|
-
|
|
619
|
+
var Ve = 600, He = 8;
|
|
620
|
+
function Ue(e, t, n, r) {
|
|
621
|
+
let i = b(null);
|
|
622
|
+
_(() => {
|
|
623
623
|
let a = i.current;
|
|
624
624
|
i.current = t;
|
|
625
|
-
let o = n.current, s =
|
|
625
|
+
let o = n.current, s = we(a, t), c = t.rows[t.rows.length - 1];
|
|
626
626
|
if (!e || !o || !r || !s || !c || typeof o.animate != "function" || f()) return;
|
|
627
627
|
let { chart: l, series: u } = e, d = requestAnimationFrame(() => {
|
|
628
|
-
let e = u.priceToCoordinate(c.close), t = l.priceScale("right").width(), n =
|
|
628
|
+
let e = u.priceToCoordinate(c.close), t = l.priceScale("right").width(), n = Te(u.options());
|
|
629
629
|
if (e === null || t === 0 || n === null) return;
|
|
630
|
-
let r = l.options().layout.fontSize +
|
|
630
|
+
let r = l.options().layout.fontSize + He;
|
|
631
631
|
o.style.width = `${t}px`, o.style.height = `${r}px`, o.style.transform = `translateY(${e - r / 2}px)`, o.style.background = s === "up" ? n.up : n.down, o.animate([{ opacity: .9 }, { opacity: 0 }], {
|
|
632
|
-
duration:
|
|
632
|
+
duration: Ve,
|
|
633
633
|
easing: "ease-out"
|
|
634
634
|
});
|
|
635
635
|
});
|
|
@@ -643,9 +643,9 @@ function Ve(e, t, n, r) {
|
|
|
643
643
|
}
|
|
644
644
|
//#endregion
|
|
645
645
|
//#region src/hooks/usePriceLines.ts
|
|
646
|
-
var
|
|
647
|
-
function
|
|
648
|
-
|
|
646
|
+
var We = [];
|
|
647
|
+
function Ge(e, t = We) {
|
|
648
|
+
_(() => {
|
|
649
649
|
if (!e) return;
|
|
650
650
|
let { series: n } = e, r = t.map((e) => n.createPriceLine(e));
|
|
651
651
|
return () => r.forEach((e) => n.removePriceLine(e));
|
|
@@ -653,9 +653,9 @@ function Ue(e, t = He) {
|
|
|
653
653
|
}
|
|
654
654
|
//#endregion
|
|
655
655
|
//#region src/hooks/useSeriesTheme.ts
|
|
656
|
-
function
|
|
656
|
+
function Ke(e, { magnet: t, magnetMode: r, ctrlWheelZoom: i, chartOptions: o, anchorLine: c, overlays: u }) {
|
|
657
657
|
return {
|
|
658
|
-
options:
|
|
658
|
+
options: y(() => n(a(e), t && { crosshair: { mode: r } }, i && {
|
|
659
659
|
handleScale: { mouseWheel: !1 },
|
|
660
660
|
handleScroll: { mouseWheel: !1 }
|
|
661
661
|
}, o), [
|
|
@@ -665,8 +665,8 @@ function We(e, { magnet: t, magnetMode: r, ctrlWheelZoom: i, chartOptions: o, an
|
|
|
665
665
|
i,
|
|
666
666
|
o
|
|
667
667
|
]),
|
|
668
|
-
themedAnchorLine:
|
|
669
|
-
themedOverlays:
|
|
668
|
+
themedAnchorLine: y(() => l(s(e, e?.anchor, void 0), c), [e, c]),
|
|
669
|
+
themedOverlays: y(() => {
|
|
670
670
|
let t = e?.line.overlays;
|
|
671
671
|
return t?.length && u ? u.map((e, r) => ({
|
|
672
672
|
...e,
|
|
@@ -677,26 +677,26 @@ function We(e, { magnet: t, magnetMode: r, ctrlWheelZoom: i, chartOptions: o, an
|
|
|
677
677
|
}
|
|
678
678
|
//#endregion
|
|
679
679
|
//#region src/utils/range.utils.ts
|
|
680
|
-
var
|
|
681
|
-
function
|
|
680
|
+
var qe = 86400;
|
|
681
|
+
function Y(e, t) {
|
|
682
682
|
let n = /* @__PURE__ */ new Date(e * 1e3), r = new Date(Date.UTC(n.getUTCFullYear(), n.getUTCMonth() - t + 1, 0));
|
|
683
683
|
return r.setUTCDate(Math.min(n.getUTCDate(), r.getUTCDate())), r.setUTCHours(n.getUTCHours(), n.getUTCMinutes(), n.getUTCSeconds()), r.getTime() / 1e3;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Je(e, t) {
|
|
686
686
|
switch (e) {
|
|
687
|
-
case "1D": return t -
|
|
688
|
-
case "1W": return t - 7 *
|
|
689
|
-
case "1M": return
|
|
690
|
-
case "3M": return
|
|
691
|
-
case "1Y": return
|
|
692
|
-
case "3Y": return
|
|
693
|
-
case "5Y": return
|
|
687
|
+
case "1D": return t - qe;
|
|
688
|
+
case "1W": return t - 7 * qe;
|
|
689
|
+
case "1M": return Y(t, 1);
|
|
690
|
+
case "3M": return Y(t, 3);
|
|
691
|
+
case "1Y": return Y(t, 12);
|
|
692
|
+
case "3Y": return Y(t, 36);
|
|
693
|
+
case "5Y": return Y(t, 60);
|
|
694
694
|
case "YTD": return Date.UTC((/* @__PURE__ */ new Date(t * 1e3)).getUTCFullYear(), 0, 1) / 1e3;
|
|
695
695
|
case "All": return null;
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
|
-
function
|
|
699
|
-
let r =
|
|
698
|
+
function Ye(e, t, n) {
|
|
699
|
+
let r = Je(n, t);
|
|
700
700
|
return r === null || r <= e ? null : {
|
|
701
701
|
from: r,
|
|
702
702
|
to: t
|
|
@@ -704,15 +704,15 @@ function qe(e, t, n) {
|
|
|
704
704
|
}
|
|
705
705
|
//#endregion
|
|
706
706
|
//#region src/hooks/useRangePreset.ts
|
|
707
|
-
function
|
|
708
|
-
let r =
|
|
709
|
-
r.current = t,
|
|
707
|
+
function Xe(e, t, n) {
|
|
708
|
+
let r = b(t), i = t.data.length > 0;
|
|
709
|
+
r.current = t, _(() => {
|
|
710
710
|
if (!e || !n || !i) return;
|
|
711
711
|
let t = r.current.rows, a = e.chart.timeScale(), o = t[0], s = t[t.length - 1];
|
|
712
712
|
if (!o || !s) return;
|
|
713
|
-
let c =
|
|
713
|
+
let c = H(o.time), l = H(s.time);
|
|
714
714
|
if (c === null || l === null) return;
|
|
715
|
-
let u =
|
|
715
|
+
let u = Ye(c, l, n);
|
|
716
716
|
if (!u) {
|
|
717
717
|
a.fitContent();
|
|
718
718
|
return;
|
|
@@ -729,10 +729,10 @@ function Je(e, t, n) {
|
|
|
729
729
|
}
|
|
730
730
|
//#endregion
|
|
731
731
|
//#region src/utils/stats.utils.ts
|
|
732
|
-
function
|
|
732
|
+
function Ze(e, t) {
|
|
733
733
|
return e === 0 ? null : (t - e) / e * 100;
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function Qe(e) {
|
|
736
736
|
let { high: t, low: n } = e[0];
|
|
737
737
|
for (let r of e) r.high > t && (t = r.high), r.low < n && (n = r.low);
|
|
738
738
|
return {
|
|
@@ -740,30 +740,30 @@ function Xe(e) {
|
|
|
740
740
|
low: n
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
|
-
function
|
|
743
|
+
function $e(e, t, n) {
|
|
744
744
|
let r = Math.max(0, Math.ceil(t)), i = Math.min(e.length - 1, Math.floor(n)), a = e[r], o = e[i];
|
|
745
745
|
return r > i || !a || !o ? null : {
|
|
746
746
|
from: a.time,
|
|
747
747
|
to: o.time,
|
|
748
748
|
open: a.open,
|
|
749
|
-
...
|
|
749
|
+
...Qe(e.slice(r, i + 1)),
|
|
750
750
|
close: o.close,
|
|
751
|
-
change:
|
|
751
|
+
change: Ze(a.open, o.close),
|
|
752
752
|
bars: i - r + 1
|
|
753
753
|
};
|
|
754
754
|
}
|
|
755
755
|
//#endregion
|
|
756
756
|
//#region src/hooks/useRangeSelect.ts
|
|
757
|
-
var
|
|
758
|
-
function
|
|
759
|
-
let [a, o] =
|
|
757
|
+
var et = 3;
|
|
758
|
+
function tt(e, t, n, r, i) {
|
|
759
|
+
let [a, o] = x(!1), s = b({
|
|
760
760
|
normalized: r,
|
|
761
761
|
options: i
|
|
762
762
|
});
|
|
763
763
|
return s.current = {
|
|
764
764
|
normalized: r,
|
|
765
765
|
options: i
|
|
766
|
-
},
|
|
766
|
+
}, _(() => {
|
|
767
767
|
let r = t.current;
|
|
768
768
|
if (!e || !r) return;
|
|
769
769
|
let { chart: i } = e, a = i.timeScale(), c = null, l = 0, u = (e) => e.clientX - r.getBoundingClientRect().left - i.priceScale("left").width(), d = () => {
|
|
@@ -777,8 +777,8 @@ function $e(e, t, n, r, i) {
|
|
|
777
777
|
e.key === "Escape" && f();
|
|
778
778
|
}, h = (e) => {
|
|
779
779
|
let t = Math.min(c ?? 0, u(e)), n = Math.max(c ?? 0, u(e));
|
|
780
|
-
if (f(), n - t <
|
|
781
|
-
let r = a.coordinateToLogical(t), i = a.coordinateToLogical(n), o = r === null || i === null ? null :
|
|
780
|
+
if (f(), n - t < et) return;
|
|
781
|
+
let r = a.coordinateToLogical(t), i = a.coordinateToLogical(n), o = r === null || i === null ? null : $e(s.current.normalized.rows, r, i);
|
|
782
782
|
o && r !== null && i !== null && (a.setVisibleLogicalRange({
|
|
783
783
|
from: r - .5,
|
|
784
784
|
to: i + .5
|
|
@@ -799,34 +799,34 @@ function $e(e, t, n, r, i) {
|
|
|
799
799
|
}
|
|
800
800
|
//#endregion
|
|
801
801
|
//#region src/utils/interaction.utils.ts
|
|
802
|
-
function
|
|
802
|
+
function nt({ points: e, rows: t }, n, r, i) {
|
|
803
803
|
let a = e[n], o = t[n];
|
|
804
804
|
if (a === void 0 || !o) return null;
|
|
805
805
|
let s = t[n - 1], c = r === null ? void 0 : t[r], l = i?.(n);
|
|
806
806
|
return {
|
|
807
807
|
point: a,
|
|
808
808
|
index: n,
|
|
809
|
-
change: s ?
|
|
809
|
+
change: s ? Ze(s.close, o.close) : null,
|
|
810
810
|
fromAnchor: c && r !== null ? {
|
|
811
|
-
change:
|
|
811
|
+
change: Ze(c.close, o.close),
|
|
812
812
|
bars: n - r
|
|
813
813
|
} : null,
|
|
814
814
|
...l && { band: l }
|
|
815
815
|
};
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function rt({ x: e, y: t, gap: n, offset: r, width: i, height: a }) {
|
|
818
818
|
let o = e > i / 2;
|
|
819
819
|
return `translate(calc(${r + e + (o ? -n : n)}px - ${o ? 100 : 0}%), calc(${t}px - ${t > a / 2 ? 100 : 0}%))`;
|
|
820
820
|
}
|
|
821
821
|
//#endregion
|
|
822
822
|
//#region src/hooks/useAnchor.ts
|
|
823
|
-
var
|
|
824
|
-
function
|
|
825
|
-
let i = n == null ? null :
|
|
826
|
-
return
|
|
823
|
+
var it = { title: "Anchor" };
|
|
824
|
+
function at(e, t, n, r = it) {
|
|
825
|
+
let i = n == null ? null : H(n), a = y(() => i === null ? null : W(t.rows, i), [t, i]), o = a === null ? null : t.rows[a]?.close ?? null;
|
|
826
|
+
return _(() => {
|
|
827
827
|
if (!e || o === null || r === !1) return;
|
|
828
828
|
let { series: t } = e, n = t.createPriceLine({
|
|
829
|
-
...
|
|
829
|
+
...it,
|
|
830
830
|
...r,
|
|
831
831
|
price: o
|
|
832
832
|
});
|
|
@@ -839,16 +839,16 @@ function rt(e, t, n, r = nt) {
|
|
|
839
839
|
}
|
|
840
840
|
//#endregion
|
|
841
841
|
//#region src/hooks/useChartEvents.ts
|
|
842
|
-
function
|
|
843
|
-
let o =
|
|
844
|
-
|
|
842
|
+
function ot(e, t, n, r, i, a) {
|
|
843
|
+
let o = b(n), s = b(a), c = b(null), l = b(!1), [u, d] = x(null);
|
|
844
|
+
_(() => {
|
|
845
845
|
o.current = n, s.current = a;
|
|
846
846
|
});
|
|
847
|
-
let f =
|
|
847
|
+
let f = g((e, t = null) => {
|
|
848
848
|
(e !== c.current || e !== null && l.current) && (c.current = e, l.current = !1, i && d(e), e === null ? o.current.onPointLeave?.() : t && o.current.onPointHover?.(t));
|
|
849
|
-
}, [i]), p =
|
|
849
|
+
}, [i]), p = g((e) => {
|
|
850
850
|
e && (o.current.onPointClick?.(e), s.current?.(e.index));
|
|
851
|
-
}, []), m =
|
|
851
|
+
}, []), m = g((n) => {
|
|
852
852
|
let i = t.data[n], a = t.rows[n];
|
|
853
853
|
if (!e || !i || !a) return null;
|
|
854
854
|
let o = e.chart.timeScale().timeToCoordinate(i.time), s = e.series.priceToCoordinate(a.close);
|
|
@@ -861,7 +861,7 @@ function it(e, t, n, r, i, a) {
|
|
|
861
861
|
t,
|
|
862
862
|
r
|
|
863
863
|
]);
|
|
864
|
-
return
|
|
864
|
+
return _(() => {
|
|
865
865
|
if (!e) return;
|
|
866
866
|
let { chart: n, series: i } = e;
|
|
867
867
|
l.current = !0;
|
|
@@ -895,17 +895,17 @@ function it(e, t, n, r, i, a) {
|
|
|
895
895
|
}
|
|
896
896
|
//#endregion
|
|
897
897
|
//#region src/hooks/useKeyboardNav.ts
|
|
898
|
-
function
|
|
899
|
-
let a =
|
|
900
|
-
|
|
898
|
+
function st(e, t, n, r, i) {
|
|
899
|
+
let a = b(i);
|
|
900
|
+
_(() => {
|
|
901
901
|
a.current = i;
|
|
902
|
-
}),
|
|
902
|
+
}), _(() => {
|
|
903
903
|
let i = t.current;
|
|
904
904
|
if (!e || !i || !r) return;
|
|
905
905
|
let { chart: o, series: s } = e, c = n.data.length - 1, l = !1, u = (e) => {
|
|
906
906
|
let t = o.timeScale(), n = t.getVisibleLogicalRange();
|
|
907
907
|
if (!n) return;
|
|
908
|
-
let r = e - .5 < n.from ? e -
|
|
908
|
+
let r = e - .5 < n.from ? e - Ce - n.from : e + .5 > n.to ? e + Ce - n.to : 0;
|
|
909
909
|
r !== 0 && t.setVisibleLogicalRange({
|
|
910
910
|
from: n.from + r,
|
|
911
911
|
to: n.to + r
|
|
@@ -959,8 +959,8 @@ function at(e, t, n, r, i) {
|
|
|
959
959
|
}
|
|
960
960
|
//#endregion
|
|
961
961
|
//#region src/hooks/useCrosshairBand.ts
|
|
962
|
-
function
|
|
963
|
-
let r =
|
|
962
|
+
function ct(e, t, n) {
|
|
963
|
+
let r = g((r) => {
|
|
964
964
|
let i = t.current;
|
|
965
965
|
if (!e || !i || !n) return;
|
|
966
966
|
let { chart: a } = e, o = r === null ? null : a.timeScale().timeToCoordinate(r);
|
|
@@ -975,7 +975,7 @@ function ot(e, t, n) {
|
|
|
975
975
|
t,
|
|
976
976
|
n
|
|
977
977
|
]);
|
|
978
|
-
return
|
|
978
|
+
return _(() => {
|
|
979
979
|
if (!e || !n) return;
|
|
980
980
|
let { chart: t } = e, i = (e) => r(e.time === void 0 || !e.point ? null : e.time);
|
|
981
981
|
return t.subscribeCrosshairMove(i), () => {
|
|
@@ -989,22 +989,22 @@ function ot(e, t, n) {
|
|
|
989
989
|
}
|
|
990
990
|
//#endregion
|
|
991
991
|
//#region src/hooks/useInteractions.ts
|
|
992
|
-
var
|
|
993
|
-
function
|
|
992
|
+
var lt = "ArrowLeft ArrowRight Home End Enter Escape Space", ut = 8;
|
|
993
|
+
function dt({ chart: e, series: t }, n, r) {
|
|
994
994
|
let i = n.data[r], a = n.rows[r];
|
|
995
995
|
if (!i || !a) return null;
|
|
996
996
|
let o = e.timeScale(), s = o.timeToCoordinate(i.time), c = t.priceToCoordinate(a.high);
|
|
997
|
-
return s === null || c === null ? null :
|
|
997
|
+
return s === null || c === null ? null : rt({
|
|
998
998
|
x: s,
|
|
999
999
|
y: c,
|
|
1000
|
-
gap: o.options().barSpacing / 2 +
|
|
1000
|
+
gap: o.options().barSpacing / 2 + ut,
|
|
1001
1001
|
offset: e.priceScale("left").width(),
|
|
1002
1002
|
...e.paneSize()
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1006
|
-
let { anchor: a, anchorLine: o, magnet: s, pinOnClick: c, keyboard: l } = i, { legend: u, tooltip: d, handlers: f, bandOf: p } = i, [m, h] =
|
|
1007
|
-
let i =
|
|
1005
|
+
function ft(e, t, n, r, i) {
|
|
1006
|
+
let { anchor: a, anchorLine: o, magnet: s, pinOnClick: c, keyboard: l } = i, { legend: u, tooltip: d, handlers: f, bandOf: p } = i, [m, h] = x(null), _ = c ? m : null, v = y(() => _ === null ? null : W(r.data, _), [r, _]), b = at(e, r, a === void 0 ? _ : a, o), S = ot(e, r, f, g((e, t, n) => {
|
|
1007
|
+
let i = nt(r, e, b, p);
|
|
1008
1008
|
return i && {
|
|
1009
1009
|
...i,
|
|
1010
1010
|
price: n,
|
|
@@ -1012,44 +1012,44 @@ function ut(e, t, n, r, i) {
|
|
|
1012
1012
|
};
|
|
1013
1013
|
}, [
|
|
1014
1014
|
r,
|
|
1015
|
-
|
|
1015
|
+
b,
|
|
1016
1016
|
p
|
|
1017
|
-
]), u || d, c ? (e) => h(e ===
|
|
1018
|
-
|
|
1019
|
-
current: () =>
|
|
1017
|
+
]), u || d, c ? (e) => h(e === v ? null : r.data[e]?.time ?? null) : void 0), C = ct(e, n, s);
|
|
1018
|
+
st(e, t, r, l, {
|
|
1019
|
+
current: () => S.hovered.current ?? v,
|
|
1020
1020
|
move: (e) => {
|
|
1021
|
-
|
|
1021
|
+
C(e === null ? null : r.data[e]?.time ?? null), S.activate(e, e === null ? null : S.eventAt(e));
|
|
1022
1022
|
},
|
|
1023
|
-
select: (e) =>
|
|
1023
|
+
select: (e) => S.select(S.eventAt(e)),
|
|
1024
1024
|
clear: () => h(null)
|
|
1025
1025
|
});
|
|
1026
|
-
let { active:
|
|
1026
|
+
let { active: w } = S, T = u ? nt(r, w ?? v ?? r.data.length - 1, b, p) : null, E = d && w !== null ? nt(r, w, b, p) : null, D = E !== null && e && w !== null ? dt(e, r, w) : null;
|
|
1027
1027
|
return {
|
|
1028
1028
|
container: l ? {
|
|
1029
1029
|
role: "application",
|
|
1030
1030
|
tabIndex: 0,
|
|
1031
|
-
"aria-keyshortcuts":
|
|
1031
|
+
"aria-keyshortcuts": lt
|
|
1032
1032
|
} : { role: "img" },
|
|
1033
|
-
legend:
|
|
1034
|
-
summary:
|
|
1035
|
-
source:
|
|
1033
|
+
legend: T === null ? null : {
|
|
1034
|
+
summary: T,
|
|
1035
|
+
source: w === null ? v === null ? "last" : "pinned" : "hover"
|
|
1036
1036
|
},
|
|
1037
|
-
tooltip:
|
|
1038
|
-
summary:
|
|
1039
|
-
transform:
|
|
1037
|
+
tooltip: E === null || D === null ? null : {
|
|
1038
|
+
summary: E,
|
|
1039
|
+
transform: D
|
|
1040
1040
|
}
|
|
1041
1041
|
};
|
|
1042
1042
|
}
|
|
1043
1043
|
//#endregion
|
|
1044
1044
|
//#region src/hooks/useVisibleStats.ts
|
|
1045
|
-
function
|
|
1046
|
-
let r =
|
|
1047
|
-
r.current = n,
|
|
1045
|
+
function pt(e, t, n) {
|
|
1046
|
+
let r = b(n), i = n !== void 0;
|
|
1047
|
+
r.current = n, _(() => {
|
|
1048
1048
|
if (!e || !i) return;
|
|
1049
1049
|
let n = e.chart.timeScale(), a = 0, o = () => {
|
|
1050
1050
|
a = 0;
|
|
1051
1051
|
let e = n.getVisibleLogicalRange();
|
|
1052
|
-
r.current?.(e ?
|
|
1052
|
+
r.current?.(e ? $e(t.rows, e.from, e.to) : null);
|
|
1053
1053
|
}, s = () => {
|
|
1054
1054
|
a ||= requestAnimationFrame(o);
|
|
1055
1055
|
};
|
|
@@ -1064,25 +1064,25 @@ function dt(e, t, n) {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
//#endregion
|
|
1066
1066
|
//#region src/components/BandLegend/index.tsx
|
|
1067
|
-
function
|
|
1067
|
+
function mt({ entries: e, render: n, theme: r, className: i, style: a }) {
|
|
1068
1068
|
if (n === null || e.length === 0) return null;
|
|
1069
|
-
if (n) return /* @__PURE__ */
|
|
1069
|
+
if (n) return /* @__PURE__ */ C(S, { children: n([...e]) });
|
|
1070
1070
|
let o = r ? `1px solid ${r.palette.border}` : "1px solid";
|
|
1071
|
-
return /* @__PURE__ */
|
|
1071
|
+
return /* @__PURE__ */ C("ul", {
|
|
1072
1072
|
"data-part": "band-legend",
|
|
1073
1073
|
className: i,
|
|
1074
1074
|
style: {
|
|
1075
|
-
...
|
|
1075
|
+
...R,
|
|
1076
1076
|
...t(r?.typography.label),
|
|
1077
1077
|
...a
|
|
1078
1078
|
},
|
|
1079
|
-
children: e.map(({ key: e, label: t, fill: n, legendColor: r }) => /* @__PURE__ */
|
|
1079
|
+
children: e.map(({ key: e, label: t, fill: n, legendColor: r }) => /* @__PURE__ */ w("li", {
|
|
1080
1080
|
"data-part": "band-legend-item",
|
|
1081
|
-
style:
|
|
1082
|
-
children: [/* @__PURE__ */
|
|
1081
|
+
style: z,
|
|
1082
|
+
children: [/* @__PURE__ */ C("span", {
|
|
1083
1083
|
"aria-hidden": "true",
|
|
1084
1084
|
style: {
|
|
1085
|
-
...
|
|
1085
|
+
...B,
|
|
1086
1086
|
background: r ?? n,
|
|
1087
1087
|
border: r ? "none" : o
|
|
1088
1088
|
}
|
|
@@ -1092,18 +1092,18 @@ function ft({ entries: e, render: n, theme: r, className: i, style: a }) {
|
|
|
1092
1092
|
}
|
|
1093
1093
|
//#endregion
|
|
1094
1094
|
//#region src/components/InteractionSlots/index.tsx
|
|
1095
|
-
var
|
|
1095
|
+
var ht = {
|
|
1096
1096
|
position: "absolute",
|
|
1097
1097
|
inset: 0,
|
|
1098
1098
|
pointerEvents: "none"
|
|
1099
1099
|
};
|
|
1100
|
-
function
|
|
1101
|
-
return /* @__PURE__ */
|
|
1102
|
-
style:
|
|
1100
|
+
function gt({ interactions: { legend: e, tooltip: t }, renderLegend: n, renderTooltip: r }) {
|
|
1101
|
+
return /* @__PURE__ */ w(S, { children: [e && n && /* @__PURE__ */ C("div", {
|
|
1102
|
+
style: ht,
|
|
1103
1103
|
"aria-live": "polite",
|
|
1104
1104
|
"aria-atomic": "true",
|
|
1105
1105
|
children: n(e)
|
|
1106
|
-
}), t && r && /* @__PURE__ */
|
|
1106
|
+
}), t && r && /* @__PURE__ */ C("div", {
|
|
1107
1107
|
style: {
|
|
1108
1108
|
...d,
|
|
1109
1109
|
transform: t.transform
|
|
@@ -1116,119 +1116,119 @@ function mt({ interactions: { legend: e, tooltip: t }, renderLegend: n, renderTo
|
|
|
1116
1116
|
}
|
|
1117
1117
|
//#endregion
|
|
1118
1118
|
//#region src/charts/SeriesChart/index.tsx
|
|
1119
|
-
function
|
|
1120
|
-
let
|
|
1121
|
-
theme:
|
|
1122
|
-
unstyled:
|
|
1123
|
-
}), { options:
|
|
1119
|
+
function _t({ data: e, definition: t, normalize: n, aggregate: r, magnetMode: a = O.MagnetOHLC, chartOptions: o, seriesOptions: s, className: c, ariaLabel: l = "Chart", liveButtonClassName: u, liveButtonLabel: d = "Jump to live", magnet: f = !0, flashLastPrice: m = !0, followLive: h = !0, ctrlWheelZoom: g = !0, renderLegend: _, renderTooltip: y, pinOnClick: x = !1, keyboard: S = !1, range: T, anchor: E, anchorLine: D, autoBucket: ee, onVisibleStatsChange: k, onPointClick: A, onPointHover: j, onPointLeave: te, overlays: ne, priceLines: M, bands: N, bandStyles: P, renderBandLegend: R, classNames: z = {}, styles: B = {}, rangeSelect: V = !0, doubleClickReset: se = !0, onRangeSelect: le, onReset: H, theme: ue, unstyled: de }, fe) {
|
|
1120
|
+
let U = b(null), pe = b(null), W = b(null), me = b(null), G = p({
|
|
1121
|
+
theme: ue,
|
|
1122
|
+
unstyled: de
|
|
1123
|
+
}), { options: he, themedAnchorLine: ge, themedOverlays: _e } = Ke(G, {
|
|
1124
1124
|
magnet: f,
|
|
1125
1125
|
magnetMode: a,
|
|
1126
1126
|
ctrlWheelZoom: g,
|
|
1127
1127
|
chartOptions: o,
|
|
1128
|
-
anchorLine:
|
|
1129
|
-
overlays:
|
|
1130
|
-
}),
|
|
1131
|
-
|
|
1132
|
-
let
|
|
1133
|
-
anchor:
|
|
1134
|
-
anchorLine:
|
|
1128
|
+
anchorLine: D,
|
|
1129
|
+
overlays: ne
|
|
1130
|
+
}), K = ce(U, t, he, s), q = Ie(K, e, n, r, ee), ve = be(K, _e), { entries: J, bandOf: xe } = ye(K, q, N, P, G);
|
|
1131
|
+
Ge(K, M), Xe(K, q, T), pt(K, q, k);
|
|
1132
|
+
let Se = ft(K, U, pe, q, {
|
|
1133
|
+
anchor: E,
|
|
1134
|
+
anchorLine: ge,
|
|
1135
1135
|
magnet: f,
|
|
1136
|
-
pinOnClick:
|
|
1137
|
-
keyboard:
|
|
1136
|
+
pinOnClick: x,
|
|
1137
|
+
keyboard: S,
|
|
1138
1138
|
legend: _ !== void 0,
|
|
1139
|
-
tooltip:
|
|
1139
|
+
tooltip: y !== void 0,
|
|
1140
1140
|
handlers: {
|
|
1141
|
-
onPointClick:
|
|
1142
|
-
onPointHover:
|
|
1143
|
-
onPointLeave:
|
|
1141
|
+
onPointClick: A,
|
|
1142
|
+
onPointHover: j,
|
|
1143
|
+
onPointLeave: te
|
|
1144
1144
|
},
|
|
1145
|
-
bandOf:
|
|
1145
|
+
bandOf: xe
|
|
1146
1146
|
});
|
|
1147
|
-
|
|
1148
|
-
let
|
|
1149
|
-
enabled:
|
|
1150
|
-
reset:
|
|
1151
|
-
onRangeSelect:
|
|
1152
|
-
onReset:
|
|
1147
|
+
Ue(K, q, W, m);
|
|
1148
|
+
let Ce = tt(K, U, me, q, {
|
|
1149
|
+
enabled: V,
|
|
1150
|
+
reset: se,
|
|
1151
|
+
onRangeSelect: le,
|
|
1152
|
+
onReset: H
|
|
1153
1153
|
});
|
|
1154
|
-
|
|
1155
|
-
let { away:
|
|
1156
|
-
return
|
|
1157
|
-
chart:
|
|
1158
|
-
series:
|
|
1154
|
+
ke(K, U, g);
|
|
1155
|
+
let { away: we, jumpToLive: Te } = Be(K, U, q.rows.length - 1, h);
|
|
1156
|
+
return v(fe, () => K ? {
|
|
1157
|
+
chart: K.chart,
|
|
1158
|
+
series: K.series,
|
|
1159
1159
|
get overlays() {
|
|
1160
|
-
return
|
|
1160
|
+
return ve.current.map((e) => e.series);
|
|
1161
1161
|
}
|
|
1162
|
-
} : null, [
|
|
1162
|
+
} : null, [K, ve]), /* @__PURE__ */ w("div", {
|
|
1163
1163
|
className: c,
|
|
1164
|
-
style:
|
|
1164
|
+
style: re,
|
|
1165
1165
|
children: [
|
|
1166
|
-
/* @__PURE__ */
|
|
1167
|
-
ref:
|
|
1168
|
-
style:
|
|
1166
|
+
/* @__PURE__ */ C("div", {
|
|
1167
|
+
ref: U,
|
|
1168
|
+
style: ie,
|
|
1169
1169
|
"aria-label": l,
|
|
1170
|
-
...
|
|
1170
|
+
...Se.container
|
|
1171
1171
|
}),
|
|
1172
|
-
/* @__PURE__ */
|
|
1173
|
-
ref:
|
|
1174
|
-
style:
|
|
1172
|
+
/* @__PURE__ */ C("div", {
|
|
1173
|
+
ref: pe,
|
|
1174
|
+
style: ae,
|
|
1175
1175
|
"aria-hidden": "true"
|
|
1176
1176
|
}),
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
entries:
|
|
1179
|
-
render:
|
|
1180
|
-
theme:
|
|
1181
|
-
className:
|
|
1182
|
-
style:
|
|
1177
|
+
/* @__PURE__ */ C(mt, {
|
|
1178
|
+
entries: J,
|
|
1179
|
+
render: R,
|
|
1180
|
+
theme: G,
|
|
1181
|
+
className: z.bandLegend,
|
|
1182
|
+
style: B.bandLegend
|
|
1183
1183
|
}),
|
|
1184
|
-
/* @__PURE__ */
|
|
1185
|
-
interactions:
|
|
1184
|
+
/* @__PURE__ */ C(gt, {
|
|
1185
|
+
interactions: Se,
|
|
1186
1186
|
renderLegend: _,
|
|
1187
|
-
renderTooltip:
|
|
1187
|
+
renderTooltip: y
|
|
1188
1188
|
}),
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
ref:
|
|
1191
|
-
style:
|
|
1189
|
+
/* @__PURE__ */ C("div", {
|
|
1190
|
+
ref: W,
|
|
1191
|
+
style: F,
|
|
1192
1192
|
"aria-hidden": "true"
|
|
1193
1193
|
}),
|
|
1194
|
-
|
|
1195
|
-
ref:
|
|
1194
|
+
Ce && /* @__PURE__ */ C("div", {
|
|
1195
|
+
ref: me,
|
|
1196
1196
|
"data-part": "range-select",
|
|
1197
|
-
className:
|
|
1197
|
+
className: z.rangeSelect,
|
|
1198
1198
|
style: {
|
|
1199
|
-
...
|
|
1200
|
-
background: i(
|
|
1201
|
-
...
|
|
1199
|
+
...oe,
|
|
1200
|
+
background: i(G?.palette.crosshair, .1),
|
|
1201
|
+
...B.rangeSelect
|
|
1202
1202
|
},
|
|
1203
1203
|
"aria-hidden": "true"
|
|
1204
1204
|
}),
|
|
1205
|
-
|
|
1205
|
+
we && /* @__PURE__ */ C("button", {
|
|
1206
1206
|
type: "button",
|
|
1207
1207
|
className: u,
|
|
1208
|
-
style: u ||
|
|
1209
|
-
onClick:
|
|
1208
|
+
style: u || de ? I : L,
|
|
1209
|
+
onClick: Te,
|
|
1210
1210
|
children: d
|
|
1211
1211
|
})
|
|
1212
1212
|
]
|
|
1213
1213
|
});
|
|
1214
1214
|
}
|
|
1215
|
-
var
|
|
1215
|
+
var X = h(_t);
|
|
1216
1216
|
//#endregion
|
|
1217
1217
|
//#region src/utils/histogram.utils.ts
|
|
1218
|
-
function
|
|
1218
|
+
function vt(e, t, n, r) {
|
|
1219
1219
|
return t === "diverging" ? e < 0 ? r.negative : r.positive : t === "threshold" && n !== void 0 && e > n ? r.over : r.bar;
|
|
1220
1220
|
}
|
|
1221
|
-
function
|
|
1221
|
+
function yt(e, t, n, r) {
|
|
1222
1222
|
return e.map((e) => {
|
|
1223
1223
|
if (e.color !== void 0) return e;
|
|
1224
|
-
let i =
|
|
1224
|
+
let i = vt(e.value, t, n, r);
|
|
1225
1225
|
return i === void 0 ? e : {
|
|
1226
1226
|
...e,
|
|
1227
1227
|
color: i
|
|
1228
1228
|
};
|
|
1229
1229
|
});
|
|
1230
1230
|
}
|
|
1231
|
-
var
|
|
1231
|
+
var bt = (e) => e(), xt = (e) => {
|
|
1232
1232
|
let t = e();
|
|
1233
1233
|
if (!t?.priceRange) return t;
|
|
1234
1234
|
let { minValue: n, maxValue: r } = t.priceRange, i = Math.max(Math.abs(n), Math.abs(r));
|
|
@@ -1240,10 +1240,10 @@ var vt = (e) => e(), yt = (e) => {
|
|
|
1240
1240
|
}
|
|
1241
1241
|
};
|
|
1242
1242
|
};
|
|
1243
|
-
function
|
|
1244
|
-
return n({ autoscaleInfoProvider: e === "diverging" ?
|
|
1243
|
+
function St(e, t) {
|
|
1244
|
+
return n({ autoscaleInfoProvider: e === "diverging" ? xt : bt }, t);
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Ct(e, t, n, r) {
|
|
1247
1247
|
let i = [];
|
|
1248
1248
|
return e === "threshold" && t !== void 0 && n !== !1 && i.push({
|
|
1249
1249
|
...n,
|
|
@@ -1256,20 +1256,20 @@ function xt(e, t, n, r) {
|
|
|
1256
1256
|
}
|
|
1257
1257
|
//#endregion
|
|
1258
1258
|
//#region src/utils/line.utils.ts
|
|
1259
|
-
function
|
|
1260
|
-
return
|
|
1259
|
+
function Z(e, t) {
|
|
1260
|
+
return je(e, t).map((e) => ({
|
|
1261
1261
|
...e[e.length - 1],
|
|
1262
1262
|
time: e[0].time
|
|
1263
1263
|
}));
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function wt(e) {
|
|
1266
1266
|
return e.map((e) => ({
|
|
1267
1267
|
time: e.time,
|
|
1268
1268
|
value: e.close,
|
|
1269
1269
|
...e.color !== void 0 && { color: e.color }
|
|
1270
1270
|
}));
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1272
|
+
function Tt(e, t, n) {
|
|
1273
1273
|
return e.data.map(({ color: r, ...i }, a) => {
|
|
1274
1274
|
let o = { ...e.points[a] }, s = { ...i };
|
|
1275
1275
|
return r !== void 0 && t.forEach((e) => s[e] = r), n.forEach((e) => {
|
|
@@ -1279,19 +1279,19 @@ function wt(e, t, n) {
|
|
|
1279
1279
|
}
|
|
1280
1280
|
//#endregion
|
|
1281
1281
|
//#region src/charts/BarChart/index.tsx
|
|
1282
|
-
var
|
|
1283
|
-
let i = p(n), { upColor: a, downColor: o, options: s } =
|
|
1282
|
+
var Et = h(function({ seriesOptions: e, ariaLabel: t = "Bar chart", ...n }, r) {
|
|
1283
|
+
let i = p(n), { upColor: a, downColor: o, options: s } = y(() => {
|
|
1284
1284
|
let { upColor: t = i?.palette.up, downColor: n = i?.palette.down, ...r } = e ?? {};
|
|
1285
1285
|
return {
|
|
1286
1286
|
upColor: t,
|
|
1287
1287
|
downColor: n,
|
|
1288
1288
|
options: r
|
|
1289
1289
|
};
|
|
1290
|
-
}, [i, e]), { base: c = 0, color: l } = s, u =
|
|
1291
|
-
let t =
|
|
1290
|
+
}, [i, e]), { base: c = 0, color: l } = s, u = g((e) => {
|
|
1291
|
+
let t = U(e);
|
|
1292
1292
|
return l !== void 0 || !a || !o ? t : {
|
|
1293
1293
|
...t,
|
|
1294
|
-
data:
|
|
1294
|
+
data: yt(t.data, "threshold", c, {
|
|
1295
1295
|
over: a,
|
|
1296
1296
|
bar: o
|
|
1297
1297
|
})
|
|
@@ -1302,25 +1302,25 @@ var Tt = T(function({ seriesOptions: e, ariaLabel: t = "Bar chart", ...n }, r) {
|
|
|
1302
1302
|
o,
|
|
1303
1303
|
l
|
|
1304
1304
|
]);
|
|
1305
|
-
return /* @__PURE__ */
|
|
1305
|
+
return /* @__PURE__ */ C(X, {
|
|
1306
1306
|
...n,
|
|
1307
1307
|
ref: r,
|
|
1308
1308
|
ariaLabel: t,
|
|
1309
1309
|
seriesOptions: s,
|
|
1310
|
-
definition:
|
|
1310
|
+
definition: k,
|
|
1311
1311
|
normalize: u,
|
|
1312
|
-
aggregate:
|
|
1313
|
-
magnetMode:
|
|
1312
|
+
aggregate: Z,
|
|
1313
|
+
magnetMode: O.Magnet
|
|
1314
1314
|
});
|
|
1315
|
-
}),
|
|
1315
|
+
}), Dt = {
|
|
1316
1316
|
line: {
|
|
1317
|
-
definition:
|
|
1317
|
+
definition: A,
|
|
1318
1318
|
label: "Line chart",
|
|
1319
1319
|
colorKeys: ["color"],
|
|
1320
1320
|
styleKeys: []
|
|
1321
1321
|
},
|
|
1322
1322
|
area: {
|
|
1323
|
-
definition:
|
|
1323
|
+
definition: T,
|
|
1324
1324
|
label: "Area chart",
|
|
1325
1325
|
colorKeys: ["lineColor"],
|
|
1326
1326
|
styleKeys: [
|
|
@@ -1330,7 +1330,7 @@ var Tt = T(function({ seriesOptions: e, ariaLabel: t = "Bar chart", ...n }, r) {
|
|
|
1330
1330
|
]
|
|
1331
1331
|
},
|
|
1332
1332
|
baseline: {
|
|
1333
|
-
definition:
|
|
1333
|
+
definition: E,
|
|
1334
1334
|
label: "Baseline chart",
|
|
1335
1335
|
colorKeys: ["topLineColor", "bottomLineColor"],
|
|
1336
1336
|
styleKeys: [
|
|
@@ -1342,8 +1342,8 @@ var Tt = T(function({ seriesOptions: e, ariaLabel: t = "Bar chart", ...n }, r) {
|
|
|
1342
1342
|
"bottomFillColor2"
|
|
1343
1343
|
]
|
|
1344
1344
|
}
|
|
1345
|
-
},
|
|
1346
|
-
let c = p(a), l =
|
|
1345
|
+
}, Ot = h(function({ variant: e = "line", seriesOptions: t, baseValue: r, ariaLabel: i = Dt[e].label, ...a }, s) {
|
|
1346
|
+
let c = p(a), l = y(() => n(o(c, e), r !== void 0 && { baseValue: {
|
|
1347
1347
|
type: "price",
|
|
1348
1348
|
price: r
|
|
1349
1349
|
} }, t), [
|
|
@@ -1351,53 +1351,53 @@ var Tt = T(function({ seriesOptions: e, ariaLabel: t = "Bar chart", ...n }, r) {
|
|
|
1351
1351
|
e,
|
|
1352
1352
|
r,
|
|
1353
1353
|
t
|
|
1354
|
-
]), u =
|
|
1355
|
-
let n =
|
|
1354
|
+
]), u = g((t) => {
|
|
1355
|
+
let n = U(t), { colorKeys: r, styleKeys: i } = Dt[e];
|
|
1356
1356
|
return {
|
|
1357
1357
|
...n,
|
|
1358
|
-
data:
|
|
1358
|
+
data: Tt(n, r, i)
|
|
1359
1359
|
};
|
|
1360
1360
|
}, [e]);
|
|
1361
|
-
return /* @__PURE__ */
|
|
1361
|
+
return /* @__PURE__ */ C(X, {
|
|
1362
1362
|
...a,
|
|
1363
1363
|
ref: s,
|
|
1364
1364
|
ariaLabel: i,
|
|
1365
1365
|
seriesOptions: l,
|
|
1366
|
-
definition:
|
|
1367
|
-
magnetMode:
|
|
1366
|
+
definition: Dt[e].definition,
|
|
1367
|
+
magnetMode: O.Magnet,
|
|
1368
1368
|
normalize: u,
|
|
1369
|
-
aggregate:
|
|
1369
|
+
aggregate: Z
|
|
1370
1370
|
});
|
|
1371
1371
|
});
|
|
1372
1372
|
//#endregion
|
|
1373
1373
|
//#region src/utils/candlestick.utils.ts
|
|
1374
|
-
function
|
|
1374
|
+
function kt(e) {
|
|
1375
1375
|
return e.close >= e.open;
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1378
|
-
return
|
|
1377
|
+
function At(e, t) {
|
|
1378
|
+
return je(e, t).map((e) => ({
|
|
1379
1379
|
time: e[0].time,
|
|
1380
1380
|
open: e[0].open,
|
|
1381
|
-
...
|
|
1381
|
+
...Qe(e),
|
|
1382
1382
|
close: e[e.length - 1].close
|
|
1383
1383
|
}));
|
|
1384
1384
|
}
|
|
1385
1385
|
//#endregion
|
|
1386
1386
|
//#region src/charts/HistogramChart/index.tsx
|
|
1387
|
-
var
|
|
1388
|
-
let m =
|
|
1387
|
+
var jt = h(function({ mode: t = "plain", threshold: r, thresholdLine: i, zeroLine: a, colors: o, seriesOptions: c, ariaLabel: u = "Histogram chart", ...d }, f) {
|
|
1388
|
+
let m = y(() => St(t, c), [t, c]), h = p(d), _ = y(() => Ct(t, r, l(s(h, h?.histogram.threshold, "dashed"), i), l(s(h, h?.histogram.zero, "solid"), a)), [
|
|
1389
1389
|
h,
|
|
1390
1390
|
t,
|
|
1391
1391
|
r,
|
|
1392
1392
|
i,
|
|
1393
1393
|
a
|
|
1394
|
-
]), { bar:
|
|
1395
|
-
let n =
|
|
1394
|
+
]), { bar: v, over: b, positive: x, negative: S } = y(() => n(e(h), o), [h, o]), w = g((e) => {
|
|
1395
|
+
let n = U(e);
|
|
1396
1396
|
return {
|
|
1397
1397
|
...n,
|
|
1398
|
-
data:
|
|
1399
|
-
bar:
|
|
1400
|
-
over:
|
|
1398
|
+
data: yt(n.data, t, r, {
|
|
1399
|
+
bar: v,
|
|
1400
|
+
over: b,
|
|
1401
1401
|
positive: x,
|
|
1402
1402
|
negative: S
|
|
1403
1403
|
})
|
|
@@ -1405,34 +1405,34 @@ var At = T(function({ mode: t = "plain", threshold: r, thresholdLine: i, zeroLin
|
|
|
1405
1405
|
}, [
|
|
1406
1406
|
t,
|
|
1407
1407
|
r,
|
|
1408
|
-
_,
|
|
1409
1408
|
v,
|
|
1409
|
+
b,
|
|
1410
1410
|
x,
|
|
1411
1411
|
S
|
|
1412
1412
|
]);
|
|
1413
|
-
return /* @__PURE__ */
|
|
1413
|
+
return /* @__PURE__ */ C(X, {
|
|
1414
1414
|
...d,
|
|
1415
1415
|
ref: f,
|
|
1416
1416
|
ariaLabel: u,
|
|
1417
1417
|
seriesOptions: m,
|
|
1418
|
-
priceLines:
|
|
1419
|
-
definition:
|
|
1420
|
-
normalize:
|
|
1421
|
-
aggregate:
|
|
1422
|
-
magnetMode:
|
|
1418
|
+
priceLines: _,
|
|
1419
|
+
definition: k,
|
|
1420
|
+
normalize: w,
|
|
1421
|
+
aggregate: Z,
|
|
1422
|
+
magnetMode: O.Magnet
|
|
1423
1423
|
});
|
|
1424
|
-
}),
|
|
1425
|
-
let a = p(r), o =
|
|
1426
|
-
return /* @__PURE__ */
|
|
1424
|
+
}), Mt = h(function({ ariaLabel: e = "Candlestick chart", seriesOptions: t, ...r }, i) {
|
|
1425
|
+
let a = p(r), o = y(() => n(c(a), t), [a, t]);
|
|
1426
|
+
return /* @__PURE__ */ C(X, {
|
|
1427
1427
|
...r,
|
|
1428
1428
|
ref: i,
|
|
1429
1429
|
ariaLabel: e,
|
|
1430
1430
|
seriesOptions: o,
|
|
1431
|
-
definition:
|
|
1432
|
-
normalize:
|
|
1433
|
-
aggregate:
|
|
1431
|
+
definition: D,
|
|
1432
|
+
normalize: fe,
|
|
1433
|
+
aggregate: At
|
|
1434
1434
|
});
|
|
1435
|
-
}),
|
|
1435
|
+
}), Nt = class {
|
|
1436
1436
|
points = [];
|
|
1437
1437
|
color = "#000000";
|
|
1438
1438
|
opacity = .16;
|
|
@@ -1470,7 +1470,7 @@ var At = T(function({ mode: t = "plain", threshold: r, thresholdLine: i, zeroLin
|
|
|
1470
1470
|
let t = this.chart, n = this.series;
|
|
1471
1471
|
if (!t || !n || this.points.length < 2) return;
|
|
1472
1472
|
let r = t.timeScale(), a = this.points.flatMap((e) => {
|
|
1473
|
-
let t =
|
|
1473
|
+
let t = N(r, e.time), i = n.priceToCoordinate(e.upper), a = n.priceToCoordinate(e.lower);
|
|
1474
1474
|
return t === null || i === null || a === null ? [] : [{
|
|
1475
1475
|
x: t,
|
|
1476
1476
|
upper: i,
|
|
@@ -1487,14 +1487,14 @@ var At = T(function({ mode: t = "plain", threshold: r, thresholdLine: i, zeroLin
|
|
|
1487
1487
|
e.closePath(), e.fillStyle = i(this.color, this.opacity) ?? this.color, e.fill();
|
|
1488
1488
|
});
|
|
1489
1489
|
}
|
|
1490
|
-
},
|
|
1490
|
+
}, Q = /* @__PURE__ */ new Set(), Pt = !1, $;
|
|
1491
1491
|
function Ft(e) {
|
|
1492
1492
|
let t = globalThis.CanvasRenderingContext2D?.prototype;
|
|
1493
|
-
return t?.roundRect ? (
|
|
1494
|
-
for (let i of
|
|
1493
|
+
return t?.roundRect ? (Q.add(e), Pt ||= ($ = t.roundRect, t.roundRect = function(e, t, n, r, i) {
|
|
1494
|
+
for (let i of Q) if (i.contains(this.canvas)) return $.call(this, e, t, n, r, 0);
|
|
1495
1495
|
return $.call(this, e, t, n, r, i);
|
|
1496
1496
|
}, !0), () => {
|
|
1497
|
-
|
|
1497
|
+
Q.delete(e), Q.size === 0 && Pt && $ && (t.roundRect = $, Pt = !1, $ = void 0);
|
|
1498
1498
|
}) : () => {};
|
|
1499
1499
|
}
|
|
1500
1500
|
//#endregion
|
|
@@ -1510,14 +1510,14 @@ function Lt(e, { height: t = 340, timeVisible: n = !1, rightOffset: r = 2, leftP
|
|
|
1510
1510
|
}, d = {
|
|
1511
1511
|
color: c.crosshair,
|
|
1512
1512
|
width: 1,
|
|
1513
|
-
style:
|
|
1513
|
+
style: j.Dashed,
|
|
1514
1514
|
labelBackgroundColor: c.crosshairLabel
|
|
1515
1515
|
};
|
|
1516
1516
|
return {
|
|
1517
1517
|
height: t,
|
|
1518
1518
|
layout: {
|
|
1519
1519
|
background: {
|
|
1520
|
-
type:
|
|
1520
|
+
type: ee.Solid,
|
|
1521
1521
|
color: "transparent"
|
|
1522
1522
|
},
|
|
1523
1523
|
textColor: c.text,
|
|
@@ -1528,15 +1528,15 @@ function Lt(e, { height: t = 340, timeVisible: n = !1, rightOffset: r = 2, leftP
|
|
|
1528
1528
|
grid: {
|
|
1529
1529
|
vertLines: {
|
|
1530
1530
|
color: c.grid,
|
|
1531
|
-
style:
|
|
1531
|
+
style: j.Solid
|
|
1532
1532
|
},
|
|
1533
1533
|
horzLines: {
|
|
1534
1534
|
color: c.grid,
|
|
1535
|
-
style:
|
|
1535
|
+
style: j.Solid
|
|
1536
1536
|
}
|
|
1537
1537
|
},
|
|
1538
1538
|
crosshair: {
|
|
1539
|
-
mode:
|
|
1539
|
+
mode: O.Normal,
|
|
1540
1540
|
vertLine: d,
|
|
1541
1541
|
horzLine: d
|
|
1542
1542
|
},
|
|
@@ -1586,7 +1586,7 @@ function Vt(e, t) {
|
|
|
1586
1586
|
//#region src/utils/timeSeries.utils.ts
|
|
1587
1587
|
function Ht(e, t) {
|
|
1588
1588
|
if (t) return Bt(e, t);
|
|
1589
|
-
let n =
|
|
1589
|
+
let n = H(e);
|
|
1590
1590
|
return n === null ? null : n;
|
|
1591
1591
|
}
|
|
1592
1592
|
function Ut(e, t) {
|
|
@@ -1629,19 +1629,19 @@ function Wt(e, t, n) {
|
|
|
1629
1629
|
return i.sort((e, t) => e.time - t.time), i;
|
|
1630
1630
|
}
|
|
1631
1631
|
function Gt(e) {
|
|
1632
|
-
let t =
|
|
1632
|
+
let t = H(e);
|
|
1633
1633
|
return t === null ? String(e) : (/* @__PURE__ */ new Date(t * 1e3)).toISOString().slice(0, 10);
|
|
1634
1634
|
}
|
|
1635
1635
|
//#endregion
|
|
1636
1636
|
//#region src/charts/TimeSeriesChart/index.tsx
|
|
1637
1637
|
var Kt = {
|
|
1638
|
-
solid:
|
|
1639
|
-
dotted:
|
|
1640
|
-
dashed:
|
|
1638
|
+
solid: j.Solid,
|
|
1639
|
+
dotted: j.Dotted,
|
|
1640
|
+
dashed: j.Dashed
|
|
1641
1641
|
}, qt = {
|
|
1642
|
-
line:
|
|
1643
|
-
area:
|
|
1644
|
-
histogram:
|
|
1642
|
+
line: A,
|
|
1643
|
+
area: T,
|
|
1644
|
+
histogram: k
|
|
1645
1645
|
}, Jt = [], Yt = [], Xt = [], Zt = [], Qt = [], $t = {
|
|
1646
1646
|
...d,
|
|
1647
1647
|
minWidth: 140,
|
|
@@ -1656,54 +1656,54 @@ function en(e) {
|
|
|
1656
1656
|
function tn(e, t, n) {
|
|
1657
1657
|
return e.color ?? n[t % Math.max(1, n.length)] ?? "#191919";
|
|
1658
1658
|
}
|
|
1659
|
-
function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, markers: c = Qt, onPointClick: l, height: u = 340, className: d, ariaLabel: f = "Time series chart", profile: h = "editorial", axis: g = "time", categories:
|
|
1660
|
-
let
|
|
1661
|
-
theme:
|
|
1662
|
-
unstyled:
|
|
1663
|
-
}), [
|
|
1664
|
-
formatTime:
|
|
1665
|
-
formatValue:
|
|
1666
|
-
extraTooltipRows:
|
|
1667
|
-
renderTooltip:
|
|
1659
|
+
function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, markers: c = Qt, onPointClick: l, height: u = 340, className: d, ariaLabel: f = "Time series chart", profile: h = "editorial", axis: g = "time", categories: v, timeVisible: y = !1, formatTime: S, formatValue: T, extraTooltipRows: E, renderTooltip: D, chartOptions: ee, theme: k, unstyled: A }) {
|
|
1660
|
+
let M = b(null), N = p({
|
|
1661
|
+
theme: k,
|
|
1662
|
+
unstyled: A
|
|
1663
|
+
}), [P, ae] = x(null), [F, I] = x(null), L = b({
|
|
1664
|
+
formatTime: S,
|
|
1665
|
+
formatValue: T,
|
|
1666
|
+
extraTooltipRows: E,
|
|
1667
|
+
renderTooltip: D,
|
|
1668
1668
|
onPointClick: l
|
|
1669
1669
|
});
|
|
1670
|
-
|
|
1671
|
-
formatTime:
|
|
1672
|
-
formatValue:
|
|
1673
|
-
extraTooltipRows:
|
|
1674
|
-
renderTooltip:
|
|
1670
|
+
L.current = {
|
|
1671
|
+
formatTime: S,
|
|
1672
|
+
formatValue: T,
|
|
1673
|
+
extraTooltipRows: E,
|
|
1674
|
+
renderTooltip: D,
|
|
1675
1675
|
onPointClick: l
|
|
1676
1676
|
};
|
|
1677
|
-
let
|
|
1678
|
-
|
|
1679
|
-
let e =
|
|
1680
|
-
if (e &&
|
|
1681
|
-
}, [
|
|
1682
|
-
let r =
|
|
1677
|
+
let R = h === "editorial", z = g === "ordinal" ? v ?? Jt : null, B = N ?? r;
|
|
1678
|
+
_(() => {
|
|
1679
|
+
let e = M.current;
|
|
1680
|
+
if (e && R) return Ft(e);
|
|
1681
|
+
}, [R]), _(() => {
|
|
1682
|
+
let r = M.current;
|
|
1683
1683
|
if (!r) return;
|
|
1684
|
-
let l =
|
|
1685
|
-
let t = typeof e == "number" ? e :
|
|
1686
|
-
return t === null ? "" :
|
|
1687
|
-
}, h =
|
|
1684
|
+
let l = B.palette, d = l.categorical, f = e.some((e) => en(e) === "left") || t.some((e) => e.priceScale === "left"), p = e.length === 0 || e.some((e) => en(e) === "right") || t.some((e) => (e.priceScale ?? "right") === "right"), m = (e) => {
|
|
1685
|
+
let t = typeof e == "number" ? e : H(e);
|
|
1686
|
+
return t === null ? "" : z ? Vt(t, z) : L.current.formatTime?.(t) ?? Gt(t);
|
|
1687
|
+
}, h = R ? Lt(B, {
|
|
1688
1688
|
height: u,
|
|
1689
|
-
timeVisible:
|
|
1689
|
+
timeVisible: y,
|
|
1690
1690
|
leftPriceScale: f,
|
|
1691
1691
|
rightPriceScale: p,
|
|
1692
1692
|
tickMarkFormatter: m,
|
|
1693
1693
|
timeFormatter: m
|
|
1694
|
-
}) : n(a(
|
|
1694
|
+
}) : n(a(B), {
|
|
1695
1695
|
height: u,
|
|
1696
|
-
crosshair: { mode:
|
|
1696
|
+
crosshair: { mode: O.Magnet },
|
|
1697
1697
|
handleScale: { mouseWheel: !1 },
|
|
1698
1698
|
handleScroll: { mouseWheel: !1 },
|
|
1699
1699
|
leftPriceScale: { visible: f },
|
|
1700
1700
|
rightPriceScale: { visible: p },
|
|
1701
1701
|
timeScale: {
|
|
1702
|
-
timeVisible:
|
|
1702
|
+
timeVisible: y,
|
|
1703
1703
|
tickMarkFormatter: m
|
|
1704
1704
|
},
|
|
1705
1705
|
localization: { timeFormatter: m }
|
|
1706
|
-
}), g =
|
|
1706
|
+
}), g = te(r, n({ autoSize: !0 }, h, ee)), _ = /* @__PURE__ */ new Map(), v = e.map((e, t) => {
|
|
1707
1707
|
let n = tn(e, t, d), r = e.kind ?? "line", a = e.lineWidth ?? (r === "line" ? 2 : 1), o = {
|
|
1708
1708
|
priceScaleId: en(e),
|
|
1709
1709
|
priceLineVisible: !1,
|
|
@@ -1724,11 +1724,11 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1724
1724
|
lineWidth: a,
|
|
1725
1725
|
lineStyle: Kt[e.lineStyle ?? "solid"],
|
|
1726
1726
|
crosshairMarkerVisible: !0
|
|
1727
|
-
}, l = g.addSeries(qt[r], s), u = Ut(e.data,
|
|
1727
|
+
}, l = g.addSeries(qt[r], s), u = Ut(e.data, z);
|
|
1728
1728
|
l.setData(u), _.set(en(e), l);
|
|
1729
1729
|
let f = c.flatMap((t) => {
|
|
1730
1730
|
if (t.seriesId !== e.id) return [];
|
|
1731
|
-
let r = Ht(t.time,
|
|
1731
|
+
let r = Ht(t.time, z);
|
|
1732
1732
|
return r === null ? [] : [{
|
|
1733
1733
|
time: r,
|
|
1734
1734
|
position: t.position ?? "inBar",
|
|
@@ -1737,7 +1737,7 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1737
1737
|
text: t.text
|
|
1738
1738
|
}];
|
|
1739
1739
|
});
|
|
1740
|
-
return f.length > 0 &&
|
|
1740
|
+
return f.length > 0 && ne(l, f), {
|
|
1741
1741
|
spec: e,
|
|
1742
1742
|
color: n,
|
|
1743
1743
|
rows: u,
|
|
@@ -1745,17 +1745,17 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1745
1745
|
};
|
|
1746
1746
|
});
|
|
1747
1747
|
for (let e of t) {
|
|
1748
|
-
let t = e.priceScale ?? "right", n = _.get(t) ??
|
|
1748
|
+
let t = e.priceScale ?? "right", n = _.get(t) ?? v[0]?.apiSeries;
|
|
1749
1749
|
if (!n) continue;
|
|
1750
1750
|
let r = e.color ?? d[0] ?? l.down;
|
|
1751
|
-
n.attachPrimitive(new
|
|
1752
|
-
points: Wt(e.upper, e.lower,
|
|
1751
|
+
n.attachPrimitive(new Nt({
|
|
1752
|
+
points: Wt(e.upper, e.lower, z),
|
|
1753
1753
|
color: r,
|
|
1754
1754
|
opacity: e.opacity
|
|
1755
1755
|
}));
|
|
1756
1756
|
}
|
|
1757
|
-
let
|
|
1758
|
-
|
|
1757
|
+
let b = v[0]?.apiSeries;
|
|
1758
|
+
b && o.length > 0 && b.attachPrimitive(new J({
|
|
1759
1759
|
items: o.map((e) => ({
|
|
1760
1760
|
from: e.from,
|
|
1761
1761
|
to: e.to,
|
|
@@ -1776,21 +1776,21 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1776
1776
|
};
|
|
1777
1777
|
}
|
|
1778
1778
|
}));
|
|
1779
|
-
let
|
|
1779
|
+
let x = /* @__PURE__ */ new Map();
|
|
1780
1780
|
for (let e of s) {
|
|
1781
|
-
let t = _.get(e.scale ?? "right") ??
|
|
1781
|
+
let t = _.get(e.scale ?? "right") ?? v[0]?.apiSeries;
|
|
1782
1782
|
if (!t || (t.createPriceLine({
|
|
1783
1783
|
price: e.value,
|
|
1784
1784
|
color: e.color ?? l.down,
|
|
1785
1785
|
lineWidth: 1,
|
|
1786
|
-
lineStyle:
|
|
1786
|
+
lineStyle: j.Dashed,
|
|
1787
1787
|
axisLabelVisible: !!e.label,
|
|
1788
1788
|
title: e.label ?? ""
|
|
1789
1789
|
}), !Number.isFinite(e.value))) continue;
|
|
1790
|
-
let n =
|
|
1791
|
-
n.push(e.value),
|
|
1790
|
+
let n = x.get(t) ?? [];
|
|
1791
|
+
n.push(e.value), x.set(t, n);
|
|
1792
1792
|
}
|
|
1793
|
-
for (let [e, t] of
|
|
1793
|
+
for (let [e, t] of x) e.applyOptions({ autoscaleInfoProvider: ((e) => {
|
|
1794
1794
|
let n = e();
|
|
1795
1795
|
return n?.priceRange ? {
|
|
1796
1796
|
...n,
|
|
@@ -1801,33 +1801,33 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1801
1801
|
} : n;
|
|
1802
1802
|
}) });
|
|
1803
1803
|
g.timeScale().fitContent();
|
|
1804
|
-
let
|
|
1804
|
+
let S = (e) => {
|
|
1805
1805
|
let t = typeof e.time == "number" ? e.time : null, n = e.point;
|
|
1806
1806
|
if (t === null || !n) {
|
|
1807
|
-
|
|
1807
|
+
I(null);
|
|
1808
1808
|
return;
|
|
1809
1809
|
}
|
|
1810
|
-
let r =
|
|
1810
|
+
let r = v.flatMap(({ spec: e, color: n, rows: r }) => {
|
|
1811
1811
|
if (e.includeInTooltip === !1) return [];
|
|
1812
1812
|
let i = r.find((e) => e.time === t);
|
|
1813
1813
|
return i ? [{
|
|
1814
1814
|
label: e.name,
|
|
1815
|
-
value:
|
|
1815
|
+
value: L.current.formatValue?.(e.id, i.value) ?? String(i.value),
|
|
1816
1816
|
color: n,
|
|
1817
1817
|
swatch: e.kind === "histogram" ? "bar" : "line"
|
|
1818
1818
|
}] : [];
|
|
1819
|
-
}), i =
|
|
1820
|
-
|
|
1819
|
+
}), i = L.current.extraTooltipRows?.(t) ?? [], a = z ? Vt(t, z) : L.current.formatTime?.(t) ?? Gt(t);
|
|
1820
|
+
I({
|
|
1821
1821
|
label: a,
|
|
1822
1822
|
rows: [...r, ...i],
|
|
1823
1823
|
x: n.x,
|
|
1824
1824
|
y: n.y,
|
|
1825
1825
|
time: t
|
|
1826
1826
|
});
|
|
1827
|
-
},
|
|
1828
|
-
let t =
|
|
1827
|
+
}, C = (e) => {
|
|
1828
|
+
let t = L.current.onPointClick, n = typeof e.time == "number" ? e.time : null;
|
|
1829
1829
|
if (!t || n === null) return;
|
|
1830
|
-
let r =
|
|
1830
|
+
let r = v.flatMap(({ spec: e, rows: t }) => {
|
|
1831
1831
|
let r = t.find((e) => e.time === n);
|
|
1832
1832
|
return r ? [{
|
|
1833
1833
|
seriesId: e.id,
|
|
@@ -1839,8 +1839,8 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1839
1839
|
points: r
|
|
1840
1840
|
});
|
|
1841
1841
|
};
|
|
1842
|
-
return g.subscribeCrosshairMove(
|
|
1843
|
-
|
|
1842
|
+
return g.subscribeCrosshairMove(S), g.subscribeClick(C), ae(g), () => {
|
|
1843
|
+
ae(null), I(null), g.unsubscribeCrosshairMove(S), g.unsubscribeClick(C), g.remove();
|
|
1844
1844
|
};
|
|
1845
1845
|
}, [
|
|
1846
1846
|
e,
|
|
@@ -1848,52 +1848,52 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1848
1848
|
o,
|
|
1849
1849
|
s,
|
|
1850
1850
|
c,
|
|
1851
|
-
|
|
1851
|
+
N,
|
|
1852
1852
|
u,
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1853
|
+
R,
|
|
1854
|
+
z,
|
|
1855
|
+
y,
|
|
1856
1856
|
ee,
|
|
1857
|
-
|
|
1858
|
-
]),
|
|
1859
|
-
chart:
|
|
1857
|
+
B
|
|
1858
|
+
]), ke(P ? {
|
|
1859
|
+
chart: P,
|
|
1860
1860
|
series: null
|
|
1861
|
-
} : null,
|
|
1862
|
-
let
|
|
1863
|
-
return /* @__PURE__ */
|
|
1861
|
+
} : null, M, !R);
|
|
1862
|
+
let oe = M.current?.getBoundingClientRect(), V = F ? m([F.x, F.y], 12, [180, 56], [oe?.width || u, oe?.height || u]) : null;
|
|
1863
|
+
return /* @__PURE__ */ w("div", {
|
|
1864
1864
|
className: d,
|
|
1865
1865
|
"data-profile": h,
|
|
1866
1866
|
"data-axis": g,
|
|
1867
1867
|
style: {
|
|
1868
|
-
...
|
|
1868
|
+
...re,
|
|
1869
1869
|
height: u
|
|
1870
1870
|
},
|
|
1871
|
-
children: [/* @__PURE__ */
|
|
1872
|
-
ref:
|
|
1873
|
-
style:
|
|
1871
|
+
children: [/* @__PURE__ */ C("div", {
|
|
1872
|
+
ref: M,
|
|
1873
|
+
style: ie,
|
|
1874
1874
|
role: "img",
|
|
1875
1875
|
"aria-label": f
|
|
1876
|
-
}),
|
|
1876
|
+
}), F && V && /* @__PURE__ */ w("div", {
|
|
1877
1877
|
"data-part": "tooltip",
|
|
1878
1878
|
style: {
|
|
1879
1879
|
...$t,
|
|
1880
|
-
left:
|
|
1881
|
-
top:
|
|
1882
|
-
background:
|
|
1883
|
-
color:
|
|
1884
|
-
border: `1px solid ${
|
|
1880
|
+
left: V[0],
|
|
1881
|
+
top: V[1],
|
|
1882
|
+
background: N?.palette.background ?? "#fff",
|
|
1883
|
+
color: N?.palette.text ?? "#191919",
|
|
1884
|
+
border: `1px solid ${N?.palette.border ?? "#2B2B43"}`
|
|
1885
1885
|
},
|
|
1886
|
-
children: [/* @__PURE__ */
|
|
1886
|
+
children: [/* @__PURE__ */ C("div", {
|
|
1887
1887
|
"data-part": "tooltip-time",
|
|
1888
|
-
children:
|
|
1889
|
-
}),
|
|
1890
|
-
time:
|
|
1891
|
-
x:
|
|
1892
|
-
y:
|
|
1893
|
-
}) :
|
|
1888
|
+
children: F.label
|
|
1889
|
+
}), L.current.renderTooltip ? L.current.renderTooltip(F.rows, {
|
|
1890
|
+
time: F.time,
|
|
1891
|
+
x: F.x,
|
|
1892
|
+
y: F.y
|
|
1893
|
+
}) : F.rows.map((e) => /* @__PURE__ */ w("div", {
|
|
1894
1894
|
"data-part": "tooltip-row",
|
|
1895
1895
|
children: [
|
|
1896
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ C("span", {
|
|
1897
1897
|
"data-part": "swatch",
|
|
1898
1898
|
"data-swatch": e.swatch,
|
|
1899
1899
|
style: {
|
|
@@ -1904,15 +1904,15 @@ function nn({ series: e, ribbons: t = Yt, ranges: o = Xt, guides: s = Zt, marker
|
|
|
1904
1904
|
background: e.color
|
|
1905
1905
|
}
|
|
1906
1906
|
}),
|
|
1907
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ C("span", { children: e.label }),
|
|
1908
1908
|
" ",
|
|
1909
|
-
/* @__PURE__ */
|
|
1909
|
+
/* @__PURE__ */ C("span", { children: e.value })
|
|
1910
1910
|
]
|
|
1911
1911
|
}, `${e.label}:${e.value}`))]
|
|
1912
1912
|
})]
|
|
1913
1913
|
});
|
|
1914
1914
|
}
|
|
1915
1915
|
//#endregion
|
|
1916
|
-
export {
|
|
1916
|
+
export { ce as C, H as S, ke as _, Mt as a, ge as b, kt as c, Z as d, wt as f, X as g, Ct as h, Nt as i, Ot as l, St as m, Lt as n, jt as o, yt as p, Ft as r, At as s, nn as t, Et as u, J as v, N as w, U as x, _e as y };
|
|
1917
1917
|
|
|
1918
|
-
//# sourceMappingURL=TimeSeriesChart-
|
|
1918
|
+
//# sourceMappingURL=TimeSeriesChart-BZMLERDZ.js.map
|