@gearbox-protocol/permissionless-ui 1.24.2 → 1.26.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/dist/cjs/components/graph/formatters.cjs +1 -1
- package/dist/cjs/components/graph/graph-view.cjs +1 -1
- package/dist/cjs/components/graph/graph.cjs +1 -1
- package/dist/cjs/components/graph/index.cjs +1 -1
- package/dist/cjs/components/index.cjs +1 -1
- package/dist/cjs/components/tab-control/tab-control.cjs +1 -1
- package/dist/cjs/components/trading-view/trading-view.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/esm/components/graph/formatters.js +101 -80
- package/dist/esm/components/graph/graph-view.js +114 -97
- package/dist/esm/components/graph/graph.js +378 -299
- package/dist/esm/components/graph/index.js +15 -14
- package/dist/esm/components/index.js +447 -446
- package/dist/esm/components/tab-control/tab-control.js +63 -72
- package/dist/esm/components/trading-view/trading-view.js +175 -107
- package/dist/esm/index.js +583 -582
- package/dist/globals.css +1 -1
- package/dist/types/components/graph/formatters.d.ts +8 -1
- package/dist/types/components/graph/graph-view.d.ts +11 -1
- package/dist/types/components/graph/graph.d.ts +35 -3
- package/dist/types/components/graph/index.d.ts +1 -1
- package/dist/types/components/graph/plugins/vertical-line.d.ts +2 -0
- package/dist/types/components/trading-view/trading-view.d.ts +30 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as f, jsxs as T, Fragment as S } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as b, useState as v, useCallback as p, useMemo as w, useEffect as N } from "react";
|
|
3
|
-
import { useNavigationAdapter as
|
|
3
|
+
import { useNavigationAdapter as C } from "../navigation-context/navigation-context.js";
|
|
4
4
|
import "@gearbox-protocol/sdk";
|
|
5
5
|
import { cn as m } from "../../utils/cn.js";
|
|
6
6
|
import "sonner";
|
|
@@ -8,26 +8,26 @@ import "luxon";
|
|
|
8
8
|
import "../../utils/z-index.js";
|
|
9
9
|
function U(n) {
|
|
10
10
|
if (!n) return null;
|
|
11
|
-
const { width: r = 0, height: s = 0 } = n?.getBoundingClientRect() || {},
|
|
12
|
-
return { width: r, height: s, left: o, top:
|
|
11
|
+
const { width: r = 0, height: s = 0 } = n?.getBoundingClientRect() || {}, a = n?.offsetTop || 0, o = n?.offsetLeft || 0;
|
|
12
|
+
return { width: r, height: s, left: o, top: a };
|
|
13
13
|
}
|
|
14
14
|
function $(n, r, s) {
|
|
15
|
-
const
|
|
15
|
+
const a = b(null), [o, u] = v(null), l = b(null), c = p((e) => {
|
|
16
16
|
u(e), l.current = e;
|
|
17
17
|
}, []);
|
|
18
18
|
return N(() => {
|
|
19
19
|
const e = s.current[n], d = () => {
|
|
20
|
-
const
|
|
21
|
-
(h || x || g ||
|
|
20
|
+
const i = U(e), h = i?.height !== l.current?.height, x = i?.width !== l.current?.width, g = i?.left !== l.current?.left, y = i?.top !== l.current?.top;
|
|
21
|
+
(h || x || g || y) && c(i);
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
a.current = d, d();
|
|
24
24
|
const t = e ? new ResizeObserver(d) : null;
|
|
25
25
|
return e && t?.observe(e), () => {
|
|
26
26
|
e && t?.unobserve(e);
|
|
27
27
|
};
|
|
28
28
|
}, [n, s, c]), N(() => {
|
|
29
29
|
const e = r ? new ResizeObserver(() => {
|
|
30
|
-
|
|
30
|
+
a.current?.();
|
|
31
31
|
}) : null;
|
|
32
32
|
return r && e?.observe(r), () => {
|
|
33
33
|
r && e?.unobserve(r);
|
|
@@ -38,7 +38,7 @@ function A({
|
|
|
38
38
|
className: n,
|
|
39
39
|
tabs: r,
|
|
40
40
|
state: s,
|
|
41
|
-
showBorder:
|
|
41
|
+
showBorder: a = !0,
|
|
42
42
|
tabItemWrapPadding: o,
|
|
43
43
|
variant: u = "auto"
|
|
44
44
|
}) {
|
|
@@ -46,70 +46,61 @@ function A({
|
|
|
46
46
|
s.id,
|
|
47
47
|
l.current,
|
|
48
48
|
c
|
|
49
|
-
), d = (t,
|
|
50
|
-
return /* @__PURE__ */ f(
|
|
49
|
+
), d = (t, i) => () => s.handleTabChange(t, i);
|
|
50
|
+
return /* @__PURE__ */ f("div", { className: m("relative w-full flex flex-col flex-wrap", n), children: /* @__PURE__ */ T(
|
|
51
51
|
"div",
|
|
52
52
|
{
|
|
53
|
+
ref: l,
|
|
53
54
|
className: m(
|
|
54
|
-
"relative w-full
|
|
55
|
-
|
|
55
|
+
"relative w-full max-w-full grow-0 shrink-0 basis-full flex items-stretch overflow-x-auto overflow-y-hidden",
|
|
56
|
+
"scrollbar-hidden",
|
|
57
|
+
a && "after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-border"
|
|
56
58
|
),
|
|
57
|
-
children:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
!t.disabled && "hover:text-foreground hover:[&>*]:text-foreground"
|
|
95
|
-
),
|
|
96
|
-
style: o ? { padding: o } : void 0,
|
|
97
|
-
children: t.item
|
|
98
|
-
},
|
|
99
|
-
`tab-item-${t.id}`
|
|
100
|
-
);
|
|
101
|
-
})
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
)
|
|
59
|
+
children: [
|
|
60
|
+
e && /* @__PURE__ */ f(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
className: "absolute left-0 h-[3px] bg-accent transition-[transform] duration-200 ease-in-out pointer-events-none bottom-[-1px]",
|
|
64
|
+
style: {
|
|
65
|
+
width: `${e.width}px`,
|
|
66
|
+
transform: `translate(${e.left}px)`
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
r.map((t, i, h) => {
|
|
71
|
+
const x = i === h.length - 1;
|
|
72
|
+
return /* @__PURE__ */ f(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
ref: (g) => {
|
|
76
|
+
c.current[t.id] = g;
|
|
77
|
+
},
|
|
78
|
+
type: "button",
|
|
79
|
+
onClick: t.disabled ? void 0 : d(t.id, i),
|
|
80
|
+
disabled: t.disabled,
|
|
81
|
+
className: m(
|
|
82
|
+
"flex items-center bg-transparent border-none shrink-0 text-foreground",
|
|
83
|
+
o ? "" : "p-0 pb-3.5",
|
|
84
|
+
u === "equal" ? "grow shrink-0 basis-[0%] justify-center min-w-0" : !x && "mr-10 max-[500px]:mr-8",
|
|
85
|
+
t.disabled && "cursor-not-allowed",
|
|
86
|
+
!t.disabled && "cursor-pointer",
|
|
87
|
+
!t.disabled && "hover:text-foreground hover:[&>*]:text-foreground"
|
|
88
|
+
),
|
|
89
|
+
style: o ? { padding: o } : void 0,
|
|
90
|
+
children: t.item
|
|
91
|
+
},
|
|
92
|
+
`tab-item-${t.id}`
|
|
93
|
+
);
|
|
94
|
+
})
|
|
95
|
+
]
|
|
105
96
|
}
|
|
106
|
-
);
|
|
97
|
+
) });
|
|
107
98
|
}
|
|
108
99
|
function B({
|
|
109
100
|
icon: n,
|
|
110
101
|
label: r,
|
|
111
102
|
selected: s,
|
|
112
|
-
textSize:
|
|
103
|
+
textSize: a = "default",
|
|
113
104
|
amount: o
|
|
114
105
|
}) {
|
|
115
106
|
return /* @__PURE__ */ T(S, { children: [
|
|
@@ -128,8 +119,8 @@ function B({
|
|
|
128
119
|
{
|
|
129
120
|
className: m(
|
|
130
121
|
"m-0 p-0 whitespace-nowrap",
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
a === "default" && "text-sm leading-[17px] font-normal",
|
|
123
|
+
a === "unset" && "text-[unset] leading-[unset] font-[unset]",
|
|
133
124
|
s ? "text-foreground" : "text-secondary-foreground"
|
|
134
125
|
),
|
|
135
126
|
children: r
|
|
@@ -139,19 +130,19 @@ function B({
|
|
|
139
130
|
] });
|
|
140
131
|
}
|
|
141
132
|
function F(n, r = 0) {
|
|
142
|
-
const [s,
|
|
143
|
-
|
|
133
|
+
const [s, a] = v(n), [o, u] = v(r), l = p((c, e) => {
|
|
134
|
+
a(c), u(e);
|
|
144
135
|
}, []);
|
|
145
136
|
return { id: s, index: o, handleTabChange: l };
|
|
146
137
|
}
|
|
147
138
|
function I(n) {
|
|
148
|
-
const { useLocation: r, useNavigate: s } =
|
|
139
|
+
const { useLocation: r, useNavigate: s } = C(), { hash: a } = r(), o = s(), u = w(
|
|
149
140
|
() => n.reduce(
|
|
150
|
-
(t,
|
|
141
|
+
(t, i, h) => (t[i.id] = { id: i.id, index: h }, t),
|
|
151
142
|
{}
|
|
152
143
|
),
|
|
153
144
|
[n]
|
|
154
|
-
), l = w(() =>
|
|
145
|
+
), l = w(() => a.slice(1).toLowerCase(), [a]), { id: c, index: e } = u[l] || {}, d = p(
|
|
155
146
|
(t) => {
|
|
156
147
|
o(`#${t}`);
|
|
157
148
|
},
|
|
@@ -168,9 +159,9 @@ function M({
|
|
|
168
159
|
pathRoot: r,
|
|
169
160
|
selectedSection: s
|
|
170
161
|
}) {
|
|
171
|
-
const { useNavigate:
|
|
162
|
+
const { useNavigate: a } = C(), o = a(), u = w(
|
|
172
163
|
() => n.reduce(
|
|
173
|
-
(d, t,
|
|
164
|
+
(d, t, i) => (d[t.id] = { id: t.id, index: i }, d),
|
|
174
165
|
{}
|
|
175
166
|
),
|
|
176
167
|
[n]
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { toast as
|
|
4
|
-
import { useIsMobile as
|
|
1
|
+
import { jsxs as y, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as v, useCallback as ee, useRef as L } from "react";
|
|
3
|
+
import { toast as te } from "sonner";
|
|
4
|
+
import { useIsMobile as oe } from "../../hooks/use-media-query.js";
|
|
5
5
|
import "@gearbox-protocol/sdk";
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as re } from "../../utils/cn.js";
|
|
7
7
|
import "luxon";
|
|
8
8
|
import "../../utils/z-index.js";
|
|
9
|
-
import { RangeButtons as
|
|
10
|
-
import { DEFAULT_SERIES_COLORS as
|
|
11
|
-
import { GraphViewWithData as
|
|
12
|
-
import { GraphDropdown as
|
|
13
|
-
const
|
|
9
|
+
import { RangeButtons as ne } from "../buttons/range-buttons/range-buttons.js";
|
|
10
|
+
import { DEFAULT_SERIES_COLORS as A, getSeriesColorPalette as ie } from "../graph/graph.js";
|
|
11
|
+
import { GraphViewWithData as le } from "../graph/graph-view.js";
|
|
12
|
+
import { GraphDropdown as se } from "./graph-dropdown.js";
|
|
13
|
+
const ce = ({ size: e = 16 }) => /* @__PURE__ */ y(
|
|
14
14
|
"svg",
|
|
15
15
|
{
|
|
16
16
|
width: e,
|
|
@@ -23,11 +23,11 @@ const U = ({ size: e = 16 }) => /* @__PURE__ */ d(
|
|
|
23
23
|
strokeLinejoin: "round",
|
|
24
24
|
"aria-label": "Expand fullscreen",
|
|
25
25
|
children: [
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ r("title", { children: "Expand fullscreen" }),
|
|
27
|
+
/* @__PURE__ */ r("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" })
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
|
-
),
|
|
30
|
+
), ue = ({ size: e = 16 }) => /* @__PURE__ */ y(
|
|
31
31
|
"svg",
|
|
32
32
|
{
|
|
33
33
|
width: e,
|
|
@@ -40,134 +40,202 @@ const U = ({ size: e = 16 }) => /* @__PURE__ */ d(
|
|
|
40
40
|
strokeLinejoin: "round",
|
|
41
41
|
"aria-label": "Exit fullscreen",
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ r("title", { children: "Exit fullscreen" }),
|
|
44
|
+
/* @__PURE__ */ r("path", { d: "M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3" })
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
|
-
);
|
|
48
|
-
function
|
|
47
|
+
), R = "permissionless-ui:tradingview-series-colors:";
|
|
48
|
+
function O(e) {
|
|
49
|
+
if (typeof window > "u" || !window.localStorage)
|
|
50
|
+
return /* @__PURE__ */ new Map();
|
|
51
|
+
try {
|
|
52
|
+
const t = window.localStorage.getItem(R + e);
|
|
53
|
+
if (!t) return /* @__PURE__ */ new Map();
|
|
54
|
+
const i = JSON.parse(t);
|
|
55
|
+
return i == null || typeof i != "object" ? /* @__PURE__ */ new Map() : new Map(
|
|
56
|
+
Object.entries(i).filter(
|
|
57
|
+
([, s]) => typeof s == "number" && s >= 0 && s < A.length
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
} catch {
|
|
61
|
+
return /* @__PURE__ */ new Map();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function ae(e, t) {
|
|
65
|
+
if (!(typeof window > "u" || !window.localStorage))
|
|
66
|
+
try {
|
|
67
|
+
window.localStorage.setItem(
|
|
68
|
+
R + e,
|
|
69
|
+
JSON.stringify(Object.fromEntries(t))
|
|
70
|
+
);
|
|
71
|
+
} catch {
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function me(e, t) {
|
|
75
|
+
if (t.size === 0) return;
|
|
76
|
+
const i = O(e);
|
|
77
|
+
for (const [s, w] of t)
|
|
78
|
+
i.set(s, w);
|
|
79
|
+
ae(e, i);
|
|
80
|
+
}
|
|
81
|
+
function Me({
|
|
49
82
|
data: e,
|
|
50
|
-
yMeasureUnit:
|
|
51
|
-
height:
|
|
52
|
-
defaultGraph:
|
|
53
|
-
onGraphSelected:
|
|
54
|
-
graphs:
|
|
55
|
-
isMultipleSelect:
|
|
56
|
-
range:
|
|
57
|
-
rangeList:
|
|
58
|
-
setRange:
|
|
59
|
-
onGraphExpanded:
|
|
60
|
-
isGraphExpanded:
|
|
61
|
-
onUnselectSeries:
|
|
62
|
-
graphsWithNoData:
|
|
63
|
-
loadingGraphs:
|
|
64
|
-
noDataMessage:
|
|
65
|
-
currentValueDecimals:
|
|
66
|
-
containerClassName:
|
|
67
|
-
useSharedPriceScale:
|
|
68
|
-
|
|
83
|
+
yMeasureUnit: t,
|
|
84
|
+
height: i = 306,
|
|
85
|
+
defaultGraph: s,
|
|
86
|
+
onGraphSelected: w,
|
|
87
|
+
graphs: S,
|
|
88
|
+
isMultipleSelect: _,
|
|
89
|
+
range: V,
|
|
90
|
+
rangeList: I,
|
|
91
|
+
setRange: z,
|
|
92
|
+
onGraphExpanded: C,
|
|
93
|
+
isGraphExpanded: B,
|
|
94
|
+
onUnselectSeries: D,
|
|
95
|
+
graphsWithNoData: F,
|
|
96
|
+
loadingGraphs: T,
|
|
97
|
+
noDataMessage: E = "No data available for this graph",
|
|
98
|
+
currentValueDecimals: W,
|
|
99
|
+
containerClassName: H,
|
|
100
|
+
useSharedPriceScale: J,
|
|
101
|
+
showCurrentValue: $,
|
|
102
|
+
yScaleMin: X,
|
|
103
|
+
yScaleMinMultiple: q,
|
|
104
|
+
seriesColorPersistenceKey: h,
|
|
105
|
+
...Q
|
|
69
106
|
}) {
|
|
70
|
-
const
|
|
71
|
-
(
|
|
72
|
-
|
|
107
|
+
const f = v(() => Array.isArray(e) ? e : e ? [e] : [], [e]), M = v(() => Array.isArray(e) && e.length > 1, [e]), N = oe(), Y = ee(
|
|
108
|
+
(b, j) => {
|
|
109
|
+
te.error(E);
|
|
73
110
|
},
|
|
74
|
-
[
|
|
75
|
-
),
|
|
76
|
-
if (
|
|
77
|
-
return Array.isArray(
|
|
78
|
-
}, [
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
111
|
+
[E]
|
|
112
|
+
), Z = v(() => {
|
|
113
|
+
if (t)
|
|
114
|
+
return Array.isArray(t) ? t[0] : t;
|
|
115
|
+
}, [t]), P = (!N && C || I.length > 0 || w && S && s) && /* @__PURE__ */ y("div", { className: "z-10 w-full flex flex-row flex-wrap sm:flex-nowrap items-center gap-2", children: [
|
|
116
|
+
/* @__PURE__ */ r("div", { children: w && S && s && /* @__PURE__ */ r(
|
|
117
|
+
se,
|
|
81
118
|
{
|
|
82
|
-
onSelected:
|
|
83
|
-
items:
|
|
84
|
-
defaultItem:
|
|
85
|
-
multiple:
|
|
86
|
-
graphsWithNoData:
|
|
87
|
-
loadingGraphs:
|
|
88
|
-
onNoDataSelected:
|
|
119
|
+
onSelected: w,
|
|
120
|
+
items: S,
|
|
121
|
+
defaultItem: s,
|
|
122
|
+
multiple: _,
|
|
123
|
+
graphsWithNoData: F,
|
|
124
|
+
loadingGraphs: T,
|
|
125
|
+
onNoDataSelected: Y
|
|
89
126
|
}
|
|
90
127
|
) }),
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */
|
|
93
|
-
!
|
|
128
|
+
/* @__PURE__ */ y("div", { className: "flex flex-row flex-nowrap justify-start sm:justify-end items-center flex-1", children: [
|
|
129
|
+
/* @__PURE__ */ r(ne, { range: V, rangeList: I, setRange: z }),
|
|
130
|
+
!N && C && /* @__PURE__ */ r(
|
|
94
131
|
"button",
|
|
95
132
|
{
|
|
96
133
|
type: "button",
|
|
97
134
|
className: "px-2.5 py-1.5 flex min-w-[44px] min-h-[26px] justify-center items-center text-xs leading-[14px] font-medium text-center rounded-md border cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring bg-muted border-muted text-muted-foreground hover:border-secondary ml-1.5",
|
|
98
|
-
onClick:
|
|
99
|
-
children:
|
|
135
|
+
onClick: C,
|
|
136
|
+
children: B ? /* @__PURE__ */ r(ue, { size: 16 }) : /* @__PURE__ */ r(ce, { size: 16 })
|
|
100
137
|
}
|
|
101
138
|
)
|
|
102
139
|
] })
|
|
103
|
-
] }),
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
140
|
+
] }), u = L(/* @__PURE__ */ new Map()), x = L(0), G = v(() => {
|
|
141
|
+
const b = Array.isArray(t) ? t : void 0;
|
|
142
|
+
if (h && f.length > 0) {
|
|
143
|
+
const l = O(h);
|
|
144
|
+
let m = -1;
|
|
145
|
+
for (const d of f) {
|
|
146
|
+
const p = d?.title || "";
|
|
147
|
+
if (!p) continue;
|
|
148
|
+
const a = l.get(p);
|
|
149
|
+
!u.current.has(p) && a !== void 0 && (u.current.set(p, a), a > m && (m = a));
|
|
150
|
+
}
|
|
151
|
+
m >= 0 && (x.current = Math.max(
|
|
152
|
+
x.current,
|
|
153
|
+
m + 1
|
|
154
|
+
));
|
|
155
|
+
}
|
|
156
|
+
const j = f.map((l, m) => {
|
|
157
|
+
const d = l?.title || `Series ${m + 1}`;
|
|
158
|
+
if (!u.current.has(d)) {
|
|
159
|
+
const o = new Set(
|
|
160
|
+
Array.from(u.current.values())
|
|
110
161
|
);
|
|
111
|
-
let
|
|
112
|
-
for (let
|
|
113
|
-
const
|
|
114
|
-
if (!
|
|
115
|
-
|
|
162
|
+
let n = x.current;
|
|
163
|
+
for (let c = 0; c < A.length; c++) {
|
|
164
|
+
const g = (x.current + c) % A.length;
|
|
165
|
+
if (!o.has(g)) {
|
|
166
|
+
n = g;
|
|
116
167
|
break;
|
|
117
168
|
}
|
|
118
169
|
}
|
|
119
|
-
|
|
170
|
+
u.current.set(d, n), x.current = n + 1;
|
|
120
171
|
}
|
|
121
|
-
const
|
|
172
|
+
const p = u.current.get(d) ?? 0, a = ie(p), U = [...l?.data || []].sort((o, n) => {
|
|
173
|
+
const c = typeof o.time == "number" ? o.time : Number(o.time), g = typeof n.time == "number" ? n.time : Number(n.time);
|
|
174
|
+
return c - g;
|
|
175
|
+
}).reduce((o, n) => {
|
|
176
|
+
const c = n.time;
|
|
177
|
+
return o.length === 0 || o[o.length - 1].time !== c ? o.push({
|
|
178
|
+
time: c,
|
|
179
|
+
value: n.value
|
|
180
|
+
}) : o[o.length - 1] = {
|
|
181
|
+
time: c,
|
|
182
|
+
value: n.value
|
|
183
|
+
}, o;
|
|
184
|
+
}, []), k = l?.lineColor ?? l?.color ?? void 0;
|
|
122
185
|
return {
|
|
123
|
-
data:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
topColor: w.top,
|
|
140
|
-
bottomColor: w.bottom
|
|
186
|
+
data: U,
|
|
187
|
+
label: d,
|
|
188
|
+
yMeasureUnit: b?.[m] ?? (Array.isArray(t) ? void 0 : t),
|
|
189
|
+
...k != null ? {
|
|
190
|
+
lineColor: k,
|
|
191
|
+
...l?.topColor != null && {
|
|
192
|
+
topColor: l.topColor
|
|
193
|
+
},
|
|
194
|
+
...l?.bottomColor != null && {
|
|
195
|
+
bottomColor: l.bottomColor
|
|
196
|
+
}
|
|
197
|
+
} : {
|
|
198
|
+
color: a.line,
|
|
199
|
+
topColor: a.top,
|
|
200
|
+
bottomColor: a.bottom
|
|
201
|
+
}
|
|
141
202
|
};
|
|
142
203
|
});
|
|
143
|
-
|
|
144
|
-
|
|
204
|
+
return h && u.current.size > 0 && me(
|
|
205
|
+
h,
|
|
206
|
+
u.current
|
|
207
|
+
), j;
|
|
208
|
+
}, [f, t, h]), K = M && f.length > 0 ? f.some((b) => !b) : !e;
|
|
209
|
+
return /* @__PURE__ */ r(
|
|
145
210
|
"div",
|
|
146
211
|
{
|
|
147
212
|
style: {
|
|
148
213
|
width: "100%",
|
|
149
|
-
height:
|
|
214
|
+
height: i ? `${i}px` : void 0
|
|
150
215
|
},
|
|
151
216
|
className: "w-full",
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
-
|
|
217
|
+
children: /* @__PURE__ */ r(
|
|
218
|
+
le,
|
|
154
219
|
{
|
|
155
|
-
series:
|
|
156
|
-
loading:
|
|
157
|
-
toolbar:
|
|
158
|
-
size:
|
|
159
|
-
containerClassName:
|
|
160
|
-
showLegend:
|
|
161
|
-
onUnselectSeries:
|
|
162
|
-
yMeasureUnit:
|
|
163
|
-
currentValueDecimals:
|
|
164
|
-
useSharedPriceScale:
|
|
165
|
-
|
|
220
|
+
series: G,
|
|
221
|
+
loading: K,
|
|
222
|
+
toolbar: P,
|
|
223
|
+
size: i ? "full" : "default",
|
|
224
|
+
containerClassName: re("h-full", H),
|
|
225
|
+
showLegend: M,
|
|
226
|
+
onUnselectSeries: D,
|
|
227
|
+
yMeasureUnit: Z,
|
|
228
|
+
currentValueDecimals: W,
|
|
229
|
+
useSharedPriceScale: J,
|
|
230
|
+
showCurrentValue: $,
|
|
231
|
+
yScaleMin: X,
|
|
232
|
+
yScaleMinMultiple: q,
|
|
233
|
+
...Q
|
|
166
234
|
}
|
|
167
235
|
)
|
|
168
236
|
}
|
|
169
237
|
);
|
|
170
238
|
}
|
|
171
239
|
export {
|
|
172
|
-
|
|
240
|
+
Me as TradingView
|
|
173
241
|
};
|