@gearbox-protocol/ui-kit 4.0.0-next.63 → 4.0.0-next.64
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/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/graph/series-config.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/trading-view/constants.cjs +1 -0
- package/dist/cjs/components/trading-view/index.cjs +1 -1
- package/dist/cjs/components/trading-view/price-scale-titles.cjs +1 -0
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/graph/graph.js +257 -266
- package/dist/esm/components/graph/series-config.js +10 -1
- package/dist/esm/components/index.js +70 -68
- package/dist/esm/components/trading-view/constants.js +7 -0
- package/dist/esm/components/trading-view/index.js +4 -2
- package/dist/esm/components/trading-view/price-scale-titles.js +52 -0
- package/dist/esm/components/trading-view/trading-view.js +119 -115
- package/dist/esm/index.js +124 -122
- package/dist/globals.css +1 -1
- package/dist/types/components/graph/graph.d.ts +1 -5
- package/dist/types/components/graph/series-config.d.ts +13 -0
- package/dist/types/components/trading-view/constants.d.ts +4 -0
- package/dist/types/components/trading-view/index.d.ts +1 -0
- package/dist/types/components/trading-view/price-scale-titles.d.ts +16 -0
- package/dist/types/components/trading-view/trading-view.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { jsxs as U, jsx as
|
|
2
|
-
import { createChart as
|
|
3
|
-
import * as
|
|
4
|
-
import { useRef as K, useState as oe, useEffect as W, useLayoutEffect as
|
|
5
|
-
import { resolveCSSColor as re, generateColorsFromBase as
|
|
6
|
-
import { useIsMobile as
|
|
1
|
+
import { jsxs as U, jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import { createChart as ut, CrosshairMode as ft, LineStyle as ie, LineSeries as ht, AreaSeries as dt } from "lightweight-charts";
|
|
3
|
+
import * as we from "react";
|
|
4
|
+
import { useRef as K, useState as oe, useEffect as W, useLayoutEffect as pt } from "react";
|
|
5
|
+
import { resolveCSSColor as re, generateColorsFromBase as _e } from "./colors.js";
|
|
6
|
+
import { useIsMobile as mt } from "../../hooks/use-media-query.js";
|
|
7
7
|
import { cn as J } from "../../utils/cn.js";
|
|
8
|
-
import { AXIS_TIME_EDGE_PADDING_PX as
|
|
9
|
-
import { formatExactValue as Pe, isRatioUnit as
|
|
10
|
-
import { GraphCurrentValue as
|
|
8
|
+
import { AXIS_TIME_EDGE_PADDING_PX as gt, getDefaultOptions as He, getDefaultSeries as bt, AXIS_TICK_MARK_DENSITY as pe, getDefaultVerticalLine as St, AXIS_FONT_SIZE as vt, AXIS_EDGE_LABEL_PADDING_PX as Ke, AXIS_TOP_LABEL_PADDING_PX as Ze } from "./default-config.js";
|
|
9
|
+
import { formatExactValue as Pe, isRatioUnit as Ct, getXFormatters as qe, createAdaptiveYAxisFormatter as yt } from "./formatters.js";
|
|
10
|
+
import { GraphCurrentValue as xt } from "./graph-current-value.js";
|
|
11
11
|
import { GraphTooltip as wt } from "./graph-tooltip.js";
|
|
12
|
-
import { VertLine as
|
|
12
|
+
import { VertLine as _t } from "./plugins/vertical-line.js";
|
|
13
|
+
import { resolvePriceScaleSides as Pt } from "./series-config.js";
|
|
13
14
|
import { getSeriesColorPalette as Ye } from "./series-palette.js";
|
|
14
|
-
import { pickMinMove as
|
|
15
|
+
import { pickMinMove as Rt, niceAxisRange as Tt } from "./y-axis-scale.js";
|
|
15
16
|
function ne(e) {
|
|
16
17
|
return e.id ?? e.label;
|
|
17
18
|
}
|
|
@@ -20,7 +21,7 @@ function Nt({
|
|
|
20
21
|
width: i,
|
|
21
22
|
padLeft: c,
|
|
22
23
|
padRight: f,
|
|
23
|
-
paddingPx: h =
|
|
24
|
+
paddingPx: h = gt
|
|
24
25
|
}) {
|
|
25
26
|
if (e < 0) return null;
|
|
26
27
|
const u = (c || f) && i > 0 ? h * Math.max(e, 1) / i : 0;
|
|
@@ -29,7 +30,7 @@ function Nt({
|
|
|
29
30
|
to: f ? e + u : e
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
|
-
function
|
|
33
|
+
function Je(e, i, c) {
|
|
33
34
|
if (!c)
|
|
34
35
|
return e.values().next().value;
|
|
35
36
|
const f = e.get(c);
|
|
@@ -163,17 +164,17 @@ class Bt {
|
|
|
163
164
|
function Et(e, i, c) {
|
|
164
165
|
const f = e.labelText ?? "", h = e.value, u = h === void 0 ? "" : typeof h == "number" ? i === "$" ? `$${Pe(h, void 0, c)}` : i === "%" ? `${Pe(h, void 0, c)}%` : Pe(
|
|
165
166
|
h,
|
|
166
|
-
i !== "none" && i !== "%" && i !== "$" && !
|
|
167
|
+
i !== "none" && i !== "%" && i !== "$" && !Ct(i) ? i : void 0,
|
|
167
168
|
c
|
|
168
169
|
) : String(h);
|
|
169
170
|
return { labelText: f, valueStr: u };
|
|
170
171
|
}
|
|
171
|
-
const
|
|
172
|
+
const Qe = 4;
|
|
172
173
|
function Ft(e, i, c) {
|
|
173
174
|
const f = { left: e, transform: "translateX(-50%)" };
|
|
174
175
|
if (i <= 0 || !c || c <= 0)
|
|
175
176
|
return f;
|
|
176
|
-
const h = c / 2, u =
|
|
177
|
+
const h = c / 2, u = Qe + h, S = i - Qe - h;
|
|
177
178
|
return S < u ? { left: i / 2, transform: "translateX(-50%)" } : { left: Math.min(Math.max(e, u), S), transform: "translateX(-50%)" };
|
|
178
179
|
}
|
|
179
180
|
function zt(e, i) {
|
|
@@ -192,88 +193,86 @@ function to({
|
|
|
192
193
|
optionsOverrides: S,
|
|
193
194
|
verticalLineOptions: P,
|
|
194
195
|
priceLineOptions: D,
|
|
195
|
-
zoneOptions:
|
|
196
|
-
currentValueDecimals:
|
|
196
|
+
zoneOptions: F,
|
|
197
|
+
currentValueDecimals: se,
|
|
197
198
|
useSharedPriceScale: Z = !1,
|
|
198
|
-
dualYAxis:
|
|
199
|
-
defaultVisiblePriceScaleId:
|
|
200
|
-
|
|
201
|
-
rightPriceScaleTitle: Wt,
|
|
202
|
-
showCurrentValue: Ue = !0,
|
|
199
|
+
dualYAxis: z = !1,
|
|
200
|
+
defaultVisiblePriceScaleId: Re = "right",
|
|
201
|
+
showCurrentValue: Oe = !0,
|
|
203
202
|
graphTitle: me,
|
|
204
|
-
yScaleMin:
|
|
205
|
-
yScaleMinMultiple:
|
|
206
|
-
visibleTimeFrom:
|
|
207
|
-
disableZoom:
|
|
203
|
+
yScaleMin: Te,
|
|
204
|
+
yScaleMinMultiple: Ne,
|
|
205
|
+
visibleTimeFrom: le,
|
|
206
|
+
disableZoom: Ve = !1,
|
|
208
207
|
hideDefaultTooltip: ge = !1
|
|
209
208
|
}) {
|
|
210
|
-
const
|
|
209
|
+
const I = K(null), N = K(/* @__PURE__ */ new Map()), be = K(!1), ke = K(!0), Le = K([]), ae = K(0), B = K(null), Se = K(null), Me = K(null), R = mt(), ce = we.useMemo(() => e.flatMap((t) => t.data), [e]), Ue = we.useMemo(() => {
|
|
211
210
|
if (e.length > 0) {
|
|
212
211
|
const t = e[e.length - 1];
|
|
213
212
|
if (t.data.length > 0)
|
|
214
213
|
return t.data[t.data.length - 1];
|
|
215
214
|
}
|
|
216
|
-
}, [e]), [
|
|
217
|
-
if (!
|
|
215
|
+
}, [e]), [De, ve] = oe(() => {
|
|
216
|
+
if (!Ue) return;
|
|
218
217
|
const t = /* @__PURE__ */ new Map();
|
|
219
|
-
for (const
|
|
220
|
-
|
|
218
|
+
for (const l of e)
|
|
219
|
+
l.data.length > 0 && t.set(l.label, l.data[l.data.length - 1]);
|
|
221
220
|
return t;
|
|
222
|
-
}), [
|
|
221
|
+
}), [Ie, Q] = oe(null), [Be, Ee] = oe([]), [et, Fe] = oe(0), ze = K(/* @__PURE__ */ new Map()), [tt, ot] = oe({}), [Y, rt] = oe(0);
|
|
223
222
|
W(() => {
|
|
224
223
|
const t = () => {
|
|
225
224
|
try {
|
|
226
|
-
if (
|
|
227
|
-
const
|
|
228
|
-
|
|
225
|
+
if (B.current && Fe(B.current.clientWidth), I.current && B.current) {
|
|
226
|
+
const s = B.current.clientWidth, a = B.current.clientHeight;
|
|
227
|
+
I.current.resize(s, a);
|
|
229
228
|
try {
|
|
230
|
-
ae.current =
|
|
229
|
+
ae.current = I.current.paneSize().height;
|
|
231
230
|
} catch {
|
|
232
231
|
}
|
|
233
232
|
}
|
|
234
233
|
} catch {
|
|
235
234
|
}
|
|
236
|
-
},
|
|
237
|
-
return
|
|
238
|
-
|
|
235
|
+
}, l = B.current, r = l ? new ResizeObserver(t) : null;
|
|
236
|
+
return Me.current = r, l && r?.observe(l), () => {
|
|
237
|
+
l && r?.unobserve(l), r?.disconnect(), Me.current = null;
|
|
239
238
|
};
|
|
240
239
|
}, []), W(() => {
|
|
241
240
|
if (!Se.current || be.current) return;
|
|
242
|
-
const t =
|
|
241
|
+
const t = He(), l = re(
|
|
243
242
|
"hsl(var(--muted-foreground))",
|
|
244
243
|
"rgb(163, 163, 163)"
|
|
245
|
-
), r =
|
|
244
|
+
), r = ut(Se.current, {
|
|
246
245
|
...t,
|
|
247
246
|
leftPriceScale: {
|
|
248
247
|
...t.leftPriceScale || {},
|
|
249
248
|
visible: !1,
|
|
250
|
-
textColor:
|
|
249
|
+
textColor: l
|
|
251
250
|
},
|
|
252
251
|
rightPriceScale: {
|
|
253
252
|
...t.rightPriceScale || {},
|
|
254
|
-
visible: !
|
|
255
|
-
textColor:
|
|
253
|
+
visible: !R,
|
|
254
|
+
textColor: l
|
|
256
255
|
},
|
|
257
|
-
...
|
|
256
|
+
...R && {
|
|
258
257
|
crosshair: {
|
|
259
258
|
...t.crosshair,
|
|
260
|
-
mode:
|
|
259
|
+
mode: ft.Magnet
|
|
261
260
|
}
|
|
262
261
|
}
|
|
263
262
|
});
|
|
264
|
-
|
|
263
|
+
I.current = r, be.current = !0;
|
|
265
264
|
try {
|
|
266
265
|
ae.current = r.paneSize().height;
|
|
267
266
|
} catch {
|
|
268
267
|
ae.current = 0;
|
|
269
268
|
}
|
|
270
|
-
return
|
|
271
|
-
r.remove(),
|
|
269
|
+
return rt((s) => s + 1), () => {
|
|
270
|
+
r.remove(), I.current = null, be.current = !1, N.current.clear();
|
|
272
271
|
};
|
|
273
|
-
}, [
|
|
274
|
-
const t =
|
|
272
|
+
}, [R]), W(() => {
|
|
273
|
+
const t = I.current;
|
|
275
274
|
t && t.applyOptions(
|
|
276
|
-
|
|
275
|
+
Ve ? {
|
|
277
276
|
handleScale: {
|
|
278
277
|
mouseWheel: !1,
|
|
279
278
|
pinch: !1,
|
|
@@ -301,35 +300,31 @@ function to({
|
|
|
301
300
|
}
|
|
302
301
|
}
|
|
303
302
|
);
|
|
304
|
-
}, [
|
|
305
|
-
const t =
|
|
303
|
+
}, [Y, Ve]), W(() => {
|
|
304
|
+
const t = I.current;
|
|
306
305
|
!t || !S || t.applyOptions(S);
|
|
307
|
-
}, [
|
|
308
|
-
const t =
|
|
306
|
+
}, [Y, S]), W(() => {
|
|
307
|
+
const t = I.current;
|
|
309
308
|
if (!t || e.length === 0) return;
|
|
310
|
-
const r = e.filter((n) => n.data.length > 0).length <= 1 ?
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
), n++);
|
|
318
|
-
}
|
|
319
|
-
const p = (n, o, d) => {
|
|
320
|
-
const { formatter: L, tickmarksFormatter: k, updateVisibleRange: F } = xt(n, o, {
|
|
309
|
+
const r = e.filter((n) => n.data.length > 0).length <= 1 ? Te : Ne, s = h === "time" ? qe(h, ce) : qe(h), a = new Map(
|
|
310
|
+
Pt(e).map(({ series: n, side: o }) => [
|
|
311
|
+
n.label,
|
|
312
|
+
o
|
|
313
|
+
])
|
|
314
|
+
), p = (n, o, d) => {
|
|
315
|
+
const { formatter: L, tickmarksFormatter: k, updateVisibleRange: E } = yt(n, o, {
|
|
321
316
|
yScaleMin: r
|
|
322
317
|
});
|
|
323
|
-
return { formatter: L, tickmarksFormatter: k, updateVisibleRange:
|
|
318
|
+
return { formatter: L, tickmarksFormatter: k, updateVisibleRange: E, labels: d };
|
|
324
319
|
}, m = [];
|
|
325
|
-
if (
|
|
320
|
+
if (z)
|
|
326
321
|
for (const n of ["left", "right"]) {
|
|
327
322
|
const o = /* @__PURE__ */ new Set(), d = [];
|
|
328
323
|
let L = u;
|
|
329
324
|
for (const k of e)
|
|
330
325
|
if (k.data.length !== 0 && a.get(k.label) === n) {
|
|
331
326
|
o.size === 0 && k.yMeasureUnit && (L = k.yMeasureUnit), o.add(k.label);
|
|
332
|
-
for (const
|
|
327
|
+
for (const E of k.data) d.push(E.value);
|
|
333
328
|
}
|
|
334
329
|
o.size > 0 && m.push(p(d, L, o));
|
|
335
330
|
}
|
|
@@ -339,61 +334,58 @@ function to({
|
|
|
339
334
|
);
|
|
340
335
|
m.push(p(n, u, o));
|
|
341
336
|
}
|
|
342
|
-
|
|
337
|
+
Le.current = m;
|
|
343
338
|
const y = /* @__PURE__ */ new Map();
|
|
344
339
|
for (const n of m)
|
|
345
340
|
for (const o of n.labels)
|
|
346
341
|
y.set(o, n);
|
|
347
|
-
const x =
|
|
342
|
+
const x = He();
|
|
348
343
|
t.applyOptions({
|
|
349
344
|
localization: {
|
|
350
345
|
...x.localization || {},
|
|
351
346
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
352
347
|
timeFormatter: (n) => (
|
|
353
348
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
354
|
-
|
|
349
|
+
s.timeFormatter(parseFloat(n), void 0)
|
|
355
350
|
)
|
|
356
351
|
},
|
|
357
352
|
timeScale: {
|
|
358
353
|
...x.timeScale || {},
|
|
359
354
|
...S?.timeScale,
|
|
360
355
|
// biome-ignore lint/suspicious/noExplicitAny: External library type compatibility
|
|
361
|
-
tickMarkFormatter:
|
|
356
|
+
tickMarkFormatter: s.tickMarkFormatter,
|
|
362
357
|
minBarSpacing: 0
|
|
363
358
|
}
|
|
364
359
|
});
|
|
365
|
-
const v = !
|
|
360
|
+
const v = !z && e.length > 1 && !Z, X = z ? R : e.length > 1 && !Z || R, V = re(
|
|
366
361
|
"hsl(var(--muted-foreground))",
|
|
367
362
|
"rgb(163, 163, 163)"
|
|
368
363
|
);
|
|
369
364
|
t.applyOptions({
|
|
370
|
-
...
|
|
371
|
-
defaultVisiblePriceScaleId:
|
|
365
|
+
...z && {
|
|
366
|
+
defaultVisiblePriceScaleId: Re
|
|
372
367
|
},
|
|
373
368
|
leftPriceScale: {
|
|
374
369
|
...x.leftPriceScale || {},
|
|
375
370
|
...S?.leftPriceScale,
|
|
376
|
-
visible:
|
|
377
|
-
textColor: V
|
|
378
|
-
...I && Re && {
|
|
379
|
-
// lightweight-charts uses scale margins; title shown via localization if needed
|
|
380
|
-
}
|
|
371
|
+
visible: z && !R,
|
|
372
|
+
textColor: V
|
|
381
373
|
},
|
|
382
374
|
rightPriceScale: {
|
|
383
375
|
...x.rightPriceScale || {},
|
|
384
376
|
...S?.rightPriceScale,
|
|
385
|
-
visible:
|
|
377
|
+
visible: z ? !R : !X,
|
|
386
378
|
textColor: V
|
|
387
379
|
}
|
|
388
380
|
});
|
|
389
|
-
const
|
|
390
|
-
for (const n of
|
|
381
|
+
const O = new Set(N.current.keys()), $ = new Set(e.map(ne));
|
|
382
|
+
for (const n of O)
|
|
391
383
|
if (!$.has(n)) {
|
|
392
384
|
const o = N.current.get(n);
|
|
393
385
|
o && (t.removeSeries(o), N.current.delete(n));
|
|
394
386
|
}
|
|
395
|
-
const g =
|
|
396
|
-
let
|
|
387
|
+
const g = bt(), M = [];
|
|
388
|
+
let T = 0;
|
|
397
389
|
const G = e.find((n) => n.data.length > 0), C = /* @__PURE__ */ new Map();
|
|
398
390
|
if (D && D.length > 0)
|
|
399
391
|
for (const n of D) {
|
|
@@ -403,8 +395,8 @@ function to({
|
|
|
403
395
|
const d = C.get(o) ?? [];
|
|
404
396
|
d.push(n.price), C.set(o, d);
|
|
405
397
|
}
|
|
406
|
-
if (
|
|
407
|
-
for (const n of
|
|
398
|
+
if (F && F.length > 0)
|
|
399
|
+
for (const n of F) {
|
|
408
400
|
const o = n.seriesLabel ?? G?.label;
|
|
409
401
|
if (!o) continue;
|
|
410
402
|
const d = C.get(o) ?? [];
|
|
@@ -412,99 +404,99 @@ function to({
|
|
|
412
404
|
}
|
|
413
405
|
for (let n = 0; n < e.length; n++) {
|
|
414
406
|
const o = e[n], d = ne(o), L = Ye(n), k = o.lineColor ?? o.color ?? L.line;
|
|
415
|
-
let
|
|
407
|
+
let E, q;
|
|
416
408
|
if (o.lineColor ?? o.color)
|
|
417
409
|
if (o.topColor && o.bottomColor)
|
|
418
|
-
|
|
410
|
+
E = o.topColor, q = o.bottomColor;
|
|
419
411
|
else if (o.topColor) {
|
|
420
|
-
const b =
|
|
421
|
-
|
|
412
|
+
const b = _e(k);
|
|
413
|
+
E = o.topColor, q = b.bottomColor;
|
|
422
414
|
} else if (o.bottomColor)
|
|
423
|
-
|
|
415
|
+
E = _e(k).topColor, q = o.bottomColor;
|
|
424
416
|
else {
|
|
425
|
-
const b =
|
|
426
|
-
|
|
417
|
+
const b = _e(k);
|
|
418
|
+
E = b.topColor, q = b.bottomColor;
|
|
427
419
|
}
|
|
428
420
|
else
|
|
429
|
-
|
|
421
|
+
E = o.topColor || L.top, q = o.bottomColor || L.bottom;
|
|
430
422
|
if (o.data.length === 0) {
|
|
431
423
|
const b = N.current.get(d);
|
|
432
424
|
b && (t.removeSeries(b), N.current.delete(d));
|
|
433
425
|
continue;
|
|
434
426
|
}
|
|
435
|
-
const ue = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, he = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0,
|
|
427
|
+
const ue = o.data.length > 0 ? Math.min(...o.data.map((b) => b.value)) : 0, he = o.data.length > 0 ? Math.max(...o.data.map((b) => b.value)) : 0, nt = ue < 0, it = o.data.some((b) => b.value === 0), st = !nt && it, We = Rt(he - ue), Xe = z ? o.priceScaleId ?? (T === 0 ? "left" : "right") : Z || !v || T === 0 ? "right" : `scale-${T}`;
|
|
436
428
|
v && M.push({
|
|
437
|
-
priceScaleId:
|
|
438
|
-
seriesIndex:
|
|
429
|
+
priceScaleId: Xe || "right",
|
|
430
|
+
seriesIndex: T
|
|
439
431
|
});
|
|
440
|
-
const Ce = (Z || !v) && r !== void 0 && typeof r == "number",
|
|
441
|
-
const
|
|
442
|
-
if (
|
|
443
|
-
Ce && (
|
|
444
|
-
for (const H of
|
|
445
|
-
H <
|
|
446
|
-
const te = Ce ? r : st &&
|
|
432
|
+
const Ce = (Z || !v) && r !== void 0 && typeof r == "number", lt = C.get(o.label) ?? [], at = (b) => {
|
|
433
|
+
const w = b();
|
|
434
|
+
if (w?.priceRange) {
|
|
435
|
+
Ce && (w.priceRange.minValue = r);
|
|
436
|
+
for (const H of lt)
|
|
437
|
+
H < w.priceRange.minValue && (w.priceRange.minValue = H), H > w.priceRange.maxValue && (w.priceRange.maxValue = H);
|
|
438
|
+
const te = Ce ? r : st && w.priceRange.minValue >= 0 ? 0 : void 0, de = ae.current > 0 ? ae.current : B.current?.clientHeight ?? 0;
|
|
447
439
|
if (de > 0) {
|
|
448
|
-
const H =
|
|
449
|
-
min:
|
|
450
|
-
max:
|
|
440
|
+
const H = Tt({
|
|
441
|
+
min: w.priceRange.minValue,
|
|
442
|
+
max: w.priceRange.maxValue,
|
|
451
443
|
floor: te,
|
|
452
444
|
scaleHeightPx: de,
|
|
453
|
-
fontSizePx:
|
|
445
|
+
fontSizePx: vt,
|
|
454
446
|
tickMarkDensity: pe,
|
|
455
|
-
minMove:
|
|
456
|
-
edgePaddingPx:
|
|
457
|
-
edgePaddingTopPx:
|
|
447
|
+
minMove: We,
|
|
448
|
+
edgePaddingPx: Ke,
|
|
449
|
+
edgePaddingTopPx: Ze
|
|
458
450
|
});
|
|
459
|
-
|
|
451
|
+
w.priceRange.minValue = H.min, w.priceRange.maxValue = H.max;
|
|
460
452
|
}
|
|
461
|
-
|
|
462
|
-
above:
|
|
463
|
-
below:
|
|
453
|
+
w.margins = {
|
|
454
|
+
above: Ze,
|
|
455
|
+
below: Ke
|
|
464
456
|
};
|
|
465
457
|
}
|
|
466
|
-
return
|
|
467
|
-
},
|
|
458
|
+
return w;
|
|
459
|
+
}, $e = y.get(o.label) ?? m[0], Ge = $e.formatter, ct = $e.tickmarksFormatter, ye = {
|
|
468
460
|
lineColor: k,
|
|
469
|
-
topColor:
|
|
461
|
+
topColor: E,
|
|
470
462
|
bottomColor: q,
|
|
471
|
-
priceScaleId:
|
|
463
|
+
priceScaleId: Xe,
|
|
472
464
|
...o.seriesType === "line" && {
|
|
473
465
|
lineStyle: o.lineStyle ?? ie.Solid
|
|
474
466
|
},
|
|
475
467
|
priceFormat: {
|
|
476
468
|
type: "custom",
|
|
477
|
-
minMove:
|
|
478
|
-
formatter: Ce && typeof r == "number" ? (b) =>
|
|
469
|
+
minMove: We,
|
|
470
|
+
formatter: Ce && typeof r == "number" ? (b) => Ge(
|
|
479
471
|
b < r ? r : b
|
|
480
|
-
) :
|
|
481
|
-
tickmarksFormatter:
|
|
472
|
+
) : Ge,
|
|
473
|
+
tickmarksFormatter: ct
|
|
482
474
|
},
|
|
483
|
-
autoscaleInfoProvider:
|
|
484
|
-
},
|
|
475
|
+
autoscaleInfoProvider: at
|
|
476
|
+
}, je = o.seriesType === "line";
|
|
485
477
|
let A = N.current.get(d);
|
|
486
478
|
const ee = o.data.map((b) => ({
|
|
487
479
|
...b,
|
|
488
480
|
time: b.time
|
|
489
481
|
}));
|
|
490
|
-
if (
|
|
491
|
-
const b = Number(ee[0].time),
|
|
492
|
-
for (let xe =
|
|
482
|
+
if (le !== void 0 && ee.length > 0 && Number(ee[0].time) > le) {
|
|
483
|
+
const b = Number(ee[0].time), w = b - le, te = 86400, de = w > 180 * te ? 7 * te : w > 30 * te ? te : 6 * 3600, H = [];
|
|
484
|
+
for (let xe = le; xe < b; xe += de)
|
|
493
485
|
H.push({ time: xe });
|
|
494
486
|
ee.unshift(...H);
|
|
495
487
|
}
|
|
496
|
-
A && A.seriesType() !== (
|
|
488
|
+
A && A.seriesType() !== (je ? "Line" : "Area") && (t.removeSeries(A), N.current.delete(d), A = void 0), A ? (A.applyOptions(ye), A.setData(ee)) : (je ? A = t.addSeries(ht, {
|
|
497
489
|
...g,
|
|
498
490
|
...ye
|
|
499
|
-
}) : A = t.addSeries(
|
|
491
|
+
}) : A = t.addSeries(dt, {
|
|
500
492
|
...g,
|
|
501
493
|
...ye
|
|
502
|
-
}), A.setData(ee), N.current.set(d, A)),
|
|
494
|
+
}), A.setData(ee), N.current.set(d, A)), T++;
|
|
503
495
|
}
|
|
504
|
-
if (
|
|
496
|
+
if (z)
|
|
505
497
|
try {
|
|
506
498
|
const n = t.priceScale("left"), o = t.priceScale("right"), d = {
|
|
507
|
-
visible: !
|
|
499
|
+
visible: !R,
|
|
508
500
|
autoScale: !0,
|
|
509
501
|
scaleMargins: { top: 0, bottom: 0 },
|
|
510
502
|
alignLabels: !0,
|
|
@@ -542,7 +534,7 @@ function to({
|
|
|
542
534
|
try {
|
|
543
535
|
const n = t.priceScale("right");
|
|
544
536
|
n && n.applyOptions({
|
|
545
|
-
visible: !
|
|
537
|
+
visible: !R,
|
|
546
538
|
autoScale: !0,
|
|
547
539
|
scaleMargins: {
|
|
548
540
|
top: 0,
|
|
@@ -556,7 +548,7 @@ function to({
|
|
|
556
548
|
});
|
|
557
549
|
} catch {
|
|
558
550
|
}
|
|
559
|
-
if (r !== void 0 && !
|
|
551
|
+
if (r !== void 0 && !R && (Z || !v) && t.applyOptions({
|
|
560
552
|
handleScroll: {
|
|
561
553
|
vertTouchDrag: !1
|
|
562
554
|
}
|
|
@@ -572,7 +564,7 @@ function to({
|
|
|
572
564
|
}), L.setVisibleLogicalRange({ from: 0, to: o });
|
|
573
565
|
return;
|
|
574
566
|
}
|
|
575
|
-
const k =
|
|
567
|
+
const k = z && !R, E = z ? !R : !X, q = !k, ue = !E;
|
|
576
568
|
L.applyOptions({
|
|
577
569
|
fixLeftEdge: !q,
|
|
578
570
|
fixRightEdge: !ue
|
|
@@ -595,32 +587,31 @@ function to({
|
|
|
595
587
|
}
|
|
596
588
|
}
|
|
597
589
|
}
|
|
598
|
-
|
|
590
|
+
ke.current && (ke.current = !1), S && t.applyOptions(S);
|
|
599
591
|
const j = /* @__PURE__ */ new Map();
|
|
600
592
|
for (const n of e)
|
|
601
593
|
n.data.length > 0 && j.set(n.label, n.data[n.data.length - 1]);
|
|
602
594
|
ve(j.size > 0 ? j : void 0);
|
|
603
595
|
}, [
|
|
604
|
-
|
|
596
|
+
Y,
|
|
605
597
|
e,
|
|
606
598
|
ce,
|
|
607
599
|
h,
|
|
608
600
|
u,
|
|
609
|
-
|
|
601
|
+
R,
|
|
610
602
|
Z,
|
|
611
|
-
|
|
612
|
-
Te,
|
|
603
|
+
z,
|
|
613
604
|
Re,
|
|
605
|
+
Te,
|
|
614
606
|
Ne,
|
|
615
|
-
|
|
616
|
-
se,
|
|
607
|
+
le,
|
|
617
608
|
D,
|
|
618
|
-
|
|
609
|
+
F,
|
|
619
610
|
S
|
|
620
611
|
]), W(() => {
|
|
621
|
-
const t =
|
|
612
|
+
const t = I.current;
|
|
622
613
|
if (!t || e.length === 0) return;
|
|
623
|
-
const
|
|
614
|
+
const l = e.length === 1;
|
|
624
615
|
let r;
|
|
625
616
|
for (const a of e)
|
|
626
617
|
if (a.data.length > 0) {
|
|
@@ -628,33 +619,33 @@ function to({
|
|
|
628
619
|
break;
|
|
629
620
|
}
|
|
630
621
|
if (!r) return;
|
|
631
|
-
const
|
|
622
|
+
const s = (a) => {
|
|
632
623
|
const { time: p = r, seriesData: m, point: y } = a || {}, x = e[0], v = x ? N.current.get(ne(x)) : void 0;
|
|
633
624
|
if (!y || !p) {
|
|
634
625
|
const $ = /* @__PURE__ */ new Map();
|
|
635
626
|
for (const g of e)
|
|
636
627
|
g.data.length > 0 && $.set(g.label, g.data[g.data.length - 1]);
|
|
637
|
-
if (ve($.size > 0 ? $ : void 0),
|
|
628
|
+
if (ve($.size > 0 ? $ : void 0), l || Z || ge)
|
|
638
629
|
Q(null);
|
|
639
630
|
else if (v && r) {
|
|
640
631
|
const g = e[0];
|
|
641
632
|
if (g && g.data.length > 0) {
|
|
642
|
-
const
|
|
643
|
-
|
|
633
|
+
const T = t.timeScale().timeToCoordinate(r), G = g.data[g.data.length - 1].value, C = v.priceToCoordinate(G);
|
|
634
|
+
T !== null && C !== null && Q({ x: T, y: C });
|
|
644
635
|
}
|
|
645
636
|
}
|
|
646
637
|
return;
|
|
647
638
|
}
|
|
648
639
|
const X = /* @__PURE__ */ new Map();
|
|
649
|
-
let V,
|
|
640
|
+
let V, O = v;
|
|
650
641
|
for (let $ = 0; $ < e.length; $++) {
|
|
651
642
|
const g = e[$], M = N.current.get(ne(g));
|
|
652
643
|
if (!M) continue;
|
|
653
|
-
const
|
|
644
|
+
const T = m?.get(M), G = T && "value" in T ? T.value : void 0;
|
|
654
645
|
let C;
|
|
655
646
|
if (G !== void 0)
|
|
656
647
|
C = G;
|
|
657
|
-
else if (
|
|
648
|
+
else if (l) {
|
|
658
649
|
const j = Number(p), n = g.data.length > 0 ? Number(g.data[0].time) : Number.POSITIVE_INFINITY;
|
|
659
650
|
j < n ? C = Number.NaN : C = g.data[g.data.length - 1]?.value ?? 0;
|
|
660
651
|
} else {
|
|
@@ -662,18 +653,18 @@ function to({
|
|
|
662
653
|
if (Number(p) < j) continue;
|
|
663
654
|
C = zt(g.data, Number(p));
|
|
664
655
|
}
|
|
665
|
-
Number.isNaN(C) || (V === void 0 && (V = C,
|
|
656
|
+
Number.isNaN(C) || (V === void 0 && (V = C, O = M), X.set(g.label, { value: C, time: p }));
|
|
666
657
|
}
|
|
667
|
-
if (ve(X), V !== void 0 &&
|
|
668
|
-
const g = t.timeScale().timeToCoordinate(p), M =
|
|
658
|
+
if (ve(X), V !== void 0 && O) {
|
|
659
|
+
const g = t.timeScale().timeToCoordinate(p), M = O.priceToCoordinate(V);
|
|
669
660
|
if (g !== null && M !== null) {
|
|
670
|
-
const
|
|
671
|
-
if (
|
|
672
|
-
const G =
|
|
661
|
+
const T = B.current;
|
|
662
|
+
if (T) {
|
|
663
|
+
const G = T.querySelector(
|
|
673
664
|
".LightweightChart"
|
|
674
665
|
);
|
|
675
666
|
if (G) {
|
|
676
|
-
const C = G.getBoundingClientRect(), j =
|
|
667
|
+
const C = G.getBoundingClientRect(), j = T.getBoundingClientRect(), n = g + (C.left - j.left), o = M + (C.top - j.top);
|
|
677
668
|
Q({ x: n, y: o });
|
|
678
669
|
} else
|
|
679
670
|
Q({ x: g, y: M });
|
|
@@ -684,25 +675,25 @@ function to({
|
|
|
684
675
|
} else
|
|
685
676
|
Q(null);
|
|
686
677
|
};
|
|
687
|
-
return t.subscribeCrosshairMove(
|
|
678
|
+
return t.subscribeCrosshairMove(s), R && t.subscribeClick(s), !l && !Z && !ge && requestAnimationFrame(() => {
|
|
688
679
|
const a = e[0], p = a ? N.current.get(ne(a)) : void 0;
|
|
689
680
|
if (p && r && a.data.length > 0) {
|
|
690
681
|
const y = t.timeScale().timeToCoordinate(r), x = a.data[a.data.length - 1].value, v = p.priceToCoordinate(x);
|
|
691
682
|
y !== null && v !== null && Q({ x: y, y: v });
|
|
692
683
|
}
|
|
693
684
|
}), () => {
|
|
694
|
-
t.unsubscribeCrosshairMove(
|
|
685
|
+
t.unsubscribeCrosshairMove(s), R && t.unsubscribeClick(s);
|
|
695
686
|
};
|
|
696
|
-
}, [e, Z,
|
|
697
|
-
const t =
|
|
687
|
+
}, [e, Z, R, ge]), W(() => {
|
|
688
|
+
const t = I.current;
|
|
698
689
|
if (!t || e.length === 0) return;
|
|
699
|
-
const
|
|
700
|
-
const
|
|
701
|
-
if (
|
|
702
|
-
const a =
|
|
690
|
+
const l = t.timeScale(), r = () => {
|
|
691
|
+
const s = Le.current;
|
|
692
|
+
if (s.length === 0) return;
|
|
693
|
+
const a = l.getVisibleRange();
|
|
703
694
|
if (!a) return;
|
|
704
695
|
const p = Number(a.from), m = Number(a.to);
|
|
705
|
-
for (const y of
|
|
696
|
+
for (const y of s) {
|
|
706
697
|
const x = [];
|
|
707
698
|
for (const v of e)
|
|
708
699
|
if (y.labels.has(v.label))
|
|
@@ -713,138 +704,138 @@ function to({
|
|
|
713
704
|
x.length > 0 && y.updateVisibleRange(x);
|
|
714
705
|
}
|
|
715
706
|
};
|
|
716
|
-
return
|
|
717
|
-
|
|
707
|
+
return l.subscribeVisibleLogicalRangeChange(r), () => {
|
|
708
|
+
l.unsubscribeVisibleLogicalRangeChange(
|
|
718
709
|
r
|
|
719
710
|
);
|
|
720
711
|
};
|
|
721
712
|
}, [e]), W(() => {
|
|
722
|
-
const t =
|
|
723
|
-
if (t &&
|
|
724
|
-
const
|
|
713
|
+
const t = I.current, l = Array.from(N.current.values()), r = [];
|
|
714
|
+
if (t && l.length > 0 && P) {
|
|
715
|
+
const s = St(), a = l[0];
|
|
725
716
|
for (const p of P) {
|
|
726
717
|
const m = {
|
|
727
|
-
...
|
|
718
|
+
...s,
|
|
728
719
|
...p.options || {}
|
|
729
720
|
};
|
|
730
721
|
m.color && (m.color = re(m.color, m.color));
|
|
731
|
-
const y = new
|
|
722
|
+
const y = new _t(t, a, p.xCoordinate, m);
|
|
732
723
|
a.attachPrimitive(y), r.push(y);
|
|
733
724
|
}
|
|
734
725
|
}
|
|
735
726
|
return () => {
|
|
736
|
-
if (
|
|
737
|
-
const
|
|
727
|
+
if (l.length > 0) {
|
|
728
|
+
const s = l[0];
|
|
738
729
|
for (const a of r)
|
|
739
730
|
try {
|
|
740
|
-
|
|
731
|
+
s.detachPrimitive(a);
|
|
741
732
|
} catch {
|
|
742
733
|
}
|
|
743
734
|
}
|
|
744
735
|
};
|
|
745
|
-
}, [P, e,
|
|
746
|
-
const t = [],
|
|
736
|
+
}, [P, e, Y]), W(() => {
|
|
737
|
+
const t = [], l = [];
|
|
747
738
|
if (D && D.length > 0) {
|
|
748
739
|
const r = re(
|
|
749
740
|
"hsl(var(--destructive))",
|
|
750
741
|
"rgb(239, 68, 68)"
|
|
751
742
|
);
|
|
752
|
-
for (const
|
|
753
|
-
if (!Number.isFinite(
|
|
754
|
-
const a =
|
|
743
|
+
for (const s of D) {
|
|
744
|
+
if (!Number.isFinite(s.price)) continue;
|
|
745
|
+
const a = Je(
|
|
755
746
|
N.current,
|
|
756
747
|
e,
|
|
757
|
-
|
|
748
|
+
s.seriesLabel
|
|
758
749
|
);
|
|
759
750
|
if (!a) continue;
|
|
760
|
-
const p =
|
|
761
|
-
price:
|
|
751
|
+
const p = s.color ? re(s.color, s.color) : r, m = s.lineWidth ?? 1, y = s.lineStyle ?? ie.Dashed, x = a.createPriceLine({
|
|
752
|
+
price: s.price,
|
|
762
753
|
color: p,
|
|
763
754
|
lineWidth: m,
|
|
764
755
|
lineStyle: y,
|
|
765
|
-
axisLabelVisible:
|
|
766
|
-
title:
|
|
756
|
+
axisLabelVisible: s.axisLabelVisible ?? !0,
|
|
757
|
+
title: s.title ?? ""
|
|
767
758
|
});
|
|
768
759
|
t.push({ series: a, line: x });
|
|
769
760
|
const v = new Bt(
|
|
770
761
|
a,
|
|
771
|
-
|
|
762
|
+
s.price,
|
|
772
763
|
p,
|
|
773
764
|
m,
|
|
774
765
|
y
|
|
775
766
|
);
|
|
776
|
-
a.attachPrimitive(v),
|
|
767
|
+
a.attachPrimitive(v), l.push({ series: a, primitive: v });
|
|
777
768
|
}
|
|
778
769
|
}
|
|
779
770
|
return () => {
|
|
780
|
-
for (const { series: r, primitive:
|
|
771
|
+
for (const { series: r, primitive: s } of l)
|
|
781
772
|
try {
|
|
782
|
-
r.detachPrimitive(
|
|
773
|
+
r.detachPrimitive(s);
|
|
783
774
|
} catch {
|
|
784
775
|
}
|
|
785
|
-
for (const { series: r, line:
|
|
776
|
+
for (const { series: r, line: s } of t)
|
|
786
777
|
try {
|
|
787
|
-
r.removePriceLine(
|
|
778
|
+
r.removePriceLine(s);
|
|
788
779
|
} catch {
|
|
789
780
|
}
|
|
790
781
|
};
|
|
791
|
-
}, [D, e,
|
|
782
|
+
}, [D, e, Y]), W(() => {
|
|
792
783
|
const t = [];
|
|
793
|
-
if (
|
|
794
|
-
const
|
|
795
|
-
for (const r of
|
|
796
|
-
const
|
|
784
|
+
if (F && F.length > 0) {
|
|
785
|
+
const l = "rgba(239, 68, 68, 0.12)";
|
|
786
|
+
for (const r of F) {
|
|
787
|
+
const s = Je(
|
|
797
788
|
N.current,
|
|
798
789
|
e,
|
|
799
790
|
r.seriesLabel
|
|
800
791
|
);
|
|
801
|
-
if (!
|
|
802
|
-
const a = r.color ? re(r.color,
|
|
803
|
-
|
|
792
|
+
if (!s) continue;
|
|
793
|
+
const a = r.color ? re(r.color, l) : l, p = new Lt(
|
|
794
|
+
s,
|
|
804
795
|
r.priceTop,
|
|
805
796
|
r.priceBottom,
|
|
806
797
|
a
|
|
807
798
|
);
|
|
808
|
-
|
|
799
|
+
s.attachPrimitive(p), t.push({ series: s, zone: p });
|
|
809
800
|
}
|
|
810
801
|
}
|
|
811
802
|
return () => {
|
|
812
|
-
for (const { series:
|
|
803
|
+
for (const { series: l, zone: r } of t)
|
|
813
804
|
try {
|
|
814
|
-
|
|
805
|
+
l.detachPrimitive(r);
|
|
815
806
|
} catch {
|
|
816
807
|
}
|
|
817
808
|
};
|
|
818
|
-
}, [
|
|
819
|
-
const t =
|
|
809
|
+
}, [F, e, Y]), W(() => {
|
|
810
|
+
const t = I.current;
|
|
820
811
|
if (!t || !P?.length) {
|
|
821
|
-
|
|
812
|
+
Ee([]);
|
|
822
813
|
return;
|
|
823
814
|
}
|
|
824
|
-
const
|
|
815
|
+
const l = () => {
|
|
825
816
|
const a = t.timeScale(), p = P.map((m) => a.timeToCoordinate(m.xCoordinate) ?? null);
|
|
826
|
-
|
|
817
|
+
Ee(p), B.current && Fe(B.current.clientWidth);
|
|
827
818
|
};
|
|
828
|
-
|
|
829
|
-
const r = t.timeScale(),
|
|
830
|
-
|
|
819
|
+
l();
|
|
820
|
+
const r = t.timeScale(), s = () => {
|
|
821
|
+
l();
|
|
831
822
|
};
|
|
832
|
-
return r.subscribeVisibleLogicalRangeChange(
|
|
833
|
-
r.unsubscribeVisibleLogicalRangeChange(
|
|
823
|
+
return r.subscribeVisibleLogicalRangeChange(s), () => {
|
|
824
|
+
r.unsubscribeVisibleLogicalRangeChange(s);
|
|
834
825
|
};
|
|
835
|
-
}, [P, e,
|
|
836
|
-
|
|
837
|
-
const
|
|
826
|
+
}, [P, e, Y]), pt(() => {
|
|
827
|
+
ot((t) => {
|
|
828
|
+
const l = {};
|
|
838
829
|
let r = !1;
|
|
839
|
-
for (const [
|
|
830
|
+
for (const [s, a] of ze.current) {
|
|
840
831
|
if (!a) continue;
|
|
841
832
|
const p = a.offsetWidth;
|
|
842
|
-
s
|
|
833
|
+
l[s] = p, t[s] !== p && (r = !0);
|
|
843
834
|
}
|
|
844
|
-
return Object.keys(t).length !== Object.keys(
|
|
835
|
+
return Object.keys(t).length !== Object.keys(l).length && (r = !0), r ? l : t;
|
|
845
836
|
});
|
|
846
837
|
});
|
|
847
|
-
const fe = e.length === 1,
|
|
838
|
+
const fe = e.length === 1, Ae = we.useMemo(() => {
|
|
848
839
|
if (fe && e.length > 0) {
|
|
849
840
|
const t = e[0];
|
|
850
841
|
if (t.data.length > 0)
|
|
@@ -854,58 +845,58 @@ function to({
|
|
|
854
845
|
return /* @__PURE__ */ U(
|
|
855
846
|
"div",
|
|
856
847
|
{
|
|
857
|
-
ref:
|
|
848
|
+
ref: B,
|
|
858
849
|
className: J(
|
|
859
850
|
"relative z-[1] w-full h-full overflow-hidden p-0",
|
|
860
851
|
i
|
|
861
852
|
),
|
|
862
853
|
children: [
|
|
863
|
-
me != null && me !== !1 && fe ? /* @__PURE__ */
|
|
864
|
-
|
|
854
|
+
me != null && me !== !1 && fe ? /* @__PURE__ */ _("div", { className: "absolute top-2 left-2 right-2 z-[100] pointer-events-none", children: /* @__PURE__ */ _("div", { className: "text-xl sm:text-2xl font-semibold text-foreground whitespace-nowrap overflow-hidden text-ellipsis", children: me }) }) : Oe && fe && Ae && /* @__PURE__ */ _(
|
|
855
|
+
xt,
|
|
865
856
|
{
|
|
866
|
-
point:
|
|
857
|
+
point: Ae,
|
|
867
858
|
xMeasureUnit: h,
|
|
868
859
|
yMeasureUnit: u,
|
|
869
|
-
decimals:
|
|
860
|
+
decimals: se
|
|
870
861
|
}
|
|
871
862
|
),
|
|
872
|
-
|
|
863
|
+
De && Ie && /* @__PURE__ */ _(
|
|
873
864
|
wt,
|
|
874
865
|
{
|
|
875
|
-
points:
|
|
866
|
+
points: De,
|
|
876
867
|
xMeasureUnit: h,
|
|
877
868
|
yMeasureUnit: u,
|
|
878
869
|
series: e,
|
|
879
|
-
position:
|
|
880
|
-
containerRef:
|
|
881
|
-
decimals:
|
|
870
|
+
position: Ie,
|
|
871
|
+
containerRef: B,
|
|
872
|
+
decimals: se
|
|
882
873
|
}
|
|
883
874
|
),
|
|
884
|
-
c && /* @__PURE__ */
|
|
885
|
-
P && P.length > 0 &&
|
|
875
|
+
c && /* @__PURE__ */ _(At, { series: e, onUnselect: f }),
|
|
876
|
+
P && P.length > 0 && Be.length === P.length && /* @__PURE__ */ _(
|
|
886
877
|
"div",
|
|
887
878
|
{
|
|
888
879
|
className: "absolute inset-0 z-[5] pointer-events-none",
|
|
889
880
|
"aria-hidden": !0,
|
|
890
|
-
children: P.map((t,
|
|
891
|
-
const r =
|
|
881
|
+
children: P.map((t, l) => {
|
|
882
|
+
const r = Be[l], s = t.options ?? {};
|
|
892
883
|
if (r === null) return null;
|
|
893
884
|
const { labelText: a, valueStr: p } = Et(
|
|
894
|
-
|
|
885
|
+
s,
|
|
895
886
|
u,
|
|
896
|
-
|
|
897
|
-
), m =
|
|
887
|
+
se
|
|
888
|
+
), m = s.tooltipText ?? "";
|
|
898
889
|
if (!(a || p || m)) return null;
|
|
899
|
-
const x =
|
|
890
|
+
const x = s.labelBackgroundColor ?? s.color ?? "hsl(var(--background))", v = s.labelTextColor ?? "hsl(var(--foreground))", X = `${String(t.xCoordinate)}-${a}-${m}`, V = Ft(
|
|
900
891
|
r,
|
|
901
|
-
|
|
902
|
-
|
|
892
|
+
et,
|
|
893
|
+
tt[l]
|
|
903
894
|
);
|
|
904
895
|
return /* @__PURE__ */ U(
|
|
905
896
|
"div",
|
|
906
897
|
{
|
|
907
|
-
ref: (
|
|
908
|
-
|
|
898
|
+
ref: (O) => {
|
|
899
|
+
ze.current.set(l, O);
|
|
909
900
|
},
|
|
910
901
|
className: J(
|
|
911
902
|
"group absolute top-2 px-2 py-1 rounded text-xs font-medium whitespace-nowrap shadow-sm border border-border",
|
|
@@ -917,9 +908,9 @@ function to({
|
|
|
917
908
|
color: v
|
|
918
909
|
},
|
|
919
910
|
children: [
|
|
920
|
-
a && /* @__PURE__ */
|
|
921
|
-
p && /* @__PURE__ */
|
|
922
|
-
m && /* @__PURE__ */
|
|
911
|
+
a && /* @__PURE__ */ _("span", { className: "block", children: a }),
|
|
912
|
+
p && /* @__PURE__ */ _("span", { className: J("block", a && "mt-0.5"), children: p }),
|
|
913
|
+
m && /* @__PURE__ */ _(
|
|
923
914
|
"span",
|
|
924
915
|
{
|
|
925
916
|
className: "pointer-events-none absolute right-0 top-full z-10 mt-1 hidden w-[280px] whitespace-normal rounded border border-border bg-popover px-2.5 py-1.5 text-left leading-snug text-popover-foreground shadow-md group-hover:block",
|
|
@@ -934,7 +925,7 @@ function to({
|
|
|
934
925
|
})
|
|
935
926
|
}
|
|
936
927
|
),
|
|
937
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ _(
|
|
938
929
|
"div",
|
|
939
930
|
{
|
|
940
931
|
ref: Se,
|
|
@@ -961,17 +952,17 @@ function At({
|
|
|
961
952
|
),
|
|
962
953
|
children: [
|
|
963
954
|
e.map((u, S) => {
|
|
964
|
-
const P = Ye(S), D = (u.lineColor ?? u.color) || P.line,
|
|
955
|
+
const P = Ye(S), D = (u.lineColor ?? u.color) || P.line, F = !h && u.data.length === 0;
|
|
965
956
|
return /* @__PURE__ */ U(
|
|
966
957
|
"div",
|
|
967
958
|
{
|
|
968
959
|
className: J(
|
|
969
960
|
"flex shrink-0 items-center gap-1.5",
|
|
970
961
|
!f && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border",
|
|
971
|
-
|
|
962
|
+
F && "opacity-50"
|
|
972
963
|
),
|
|
973
964
|
children: [
|
|
974
|
-
/* @__PURE__ */
|
|
965
|
+
/* @__PURE__ */ _(
|
|
975
966
|
"div",
|
|
976
967
|
{
|
|
977
968
|
className: J(
|
|
@@ -990,16 +981,16 @@ function At({
|
|
|
990
981
|
),
|
|
991
982
|
children: [
|
|
992
983
|
u.label,
|
|
993
|
-
|
|
984
|
+
F && " (no data)"
|
|
994
985
|
]
|
|
995
986
|
}
|
|
996
987
|
),
|
|
997
|
-
c && /* @__PURE__ */
|
|
988
|
+
c && /* @__PURE__ */ _(
|
|
998
989
|
"button",
|
|
999
990
|
{
|
|
1000
991
|
type: "button",
|
|
1001
|
-
onClick: (
|
|
1002
|
-
|
|
992
|
+
onClick: (se) => {
|
|
993
|
+
se.stopPropagation(), c(u.label);
|
|
1003
994
|
},
|
|
1004
995
|
className: "ml-1 flex items-center justify-center w-4 h-4 rounded-sm hover:bg-muted transition-colors cursor-pointer",
|
|
1005
996
|
"aria-label": `Remove ${u.label}`,
|
|
@@ -1018,9 +1009,9 @@ function At({
|
|
|
1018
1009
|
className: "text-muted-foreground hover:text-foreground",
|
|
1019
1010
|
"aria-hidden": "true",
|
|
1020
1011
|
children: [
|
|
1021
|
-
/* @__PURE__ */
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ _("title", { children: "Close" }),
|
|
1013
|
+
/* @__PURE__ */ _("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1014
|
+
/* @__PURE__ */ _("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1024
1015
|
]
|
|
1025
1016
|
}
|
|
1026
1017
|
)
|
|
@@ -1039,14 +1030,14 @@ function At({
|
|
|
1039
1030
|
!f && "px-2 py-1 bg-background/80 backdrop-blur-sm rounded border border-border"
|
|
1040
1031
|
),
|
|
1041
1032
|
children: [
|
|
1042
|
-
/* @__PURE__ */
|
|
1033
|
+
/* @__PURE__ */ _(
|
|
1043
1034
|
"div",
|
|
1044
1035
|
{
|
|
1045
1036
|
className: "h-3 w-0.5 shrink-0",
|
|
1046
1037
|
style: { backgroundColor: u.color }
|
|
1047
1038
|
}
|
|
1048
1039
|
),
|
|
1049
|
-
/* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ _(
|
|
1050
1041
|
"span",
|
|
1051
1042
|
{
|
|
1052
1043
|
className: J(
|
|
@@ -1067,7 +1058,7 @@ function At({
|
|
|
1067
1058
|
export {
|
|
1068
1059
|
to as Graph,
|
|
1069
1060
|
At as GraphLegend,
|
|
1070
|
-
|
|
1061
|
+
Qe as VERTICAL_LINE_LABEL_EDGE_PADDING,
|
|
1071
1062
|
zt as getStepForwardValue,
|
|
1072
1063
|
Ft as getVerticalLineLabelStyle,
|
|
1073
1064
|
Et as getVerticalLineTooltipContent,
|