@lilt-ui/charts 0.9.1 → 0.10.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 +32 -0
- package/README.md +40 -10
- package/dist/cards/activity-ring-card.d.ts +7 -2
- package/dist/cards/calendar-heatmap-card.d.ts +18 -0
- package/dist/cards/cartesian-card.d.ts +9 -3
- package/dist/cards/chart-card.d.ts +7 -3
- package/dist/cards/funnel-chart-card.d.ts +9 -3
- package/dist/cards/heatmap-chart-card.d.ts +7 -2
- package/dist/cards/horizontal-bar-chart-card.d.ts +7 -2
- package/dist/cards/keys.d.ts +2 -0
- package/dist/cards/observations-card.d.ts +82 -0
- package/dist/cards/progress-card.d.ts +7 -2
- package/dist/cards/radar-chart-card.d.ts +9 -3
- package/dist/cards/radial-chart-card.d.ts +9 -3
- package/dist/cards/range-select.d.ts +28 -0
- package/dist/cards/sankey-chart-card.d.ts +7 -2
- package/dist/cards/scatter-chart-card.d.ts +9 -3
- package/dist/cards/slope-chart-card.d.ts +7 -2
- package/dist/cards/stat-card.d.ts +7 -2
- package/dist/cards/strip-chart-card.d.ts +15 -0
- package/dist/cards/timeline-chart-card.d.ts +18 -0
- package/dist/cards/treemap-chart-card.d.ts +24 -0
- package/dist/engine/keyed.d.ts +19 -0
- package/dist/engine/lifecycle.d.ts +1 -1
- package/dist/engine/sankey.d.ts +16 -0
- package/dist/finance/cards/depth-chart-card.d.ts +7 -2
- package/dist/finance/order-book.d.ts +7 -2
- package/dist/finance.js +324 -326
- package/dist/index.d.ts +11 -1
- package/dist/index.js +3258 -2144
- package/dist/marks/contract.d.ts +0 -2
- package/dist/motion/use-chart-motion.d.ts +5 -0
- package/dist/motion/use-departing.d.ts +7 -0
- package/dist/motion/use-snap-bars.d.ts +27 -0
- package/dist/{report-context-CkzH-r8B.js → report-context-UrwaoLYZ.js} +416 -238
- package/dist/{skeleton-block-CHH5SIAo.js → skeleton-block-C8gOUsxn.js} +1672 -1422
- package/dist/styles.css +1 -1
- package/dist/watch/board/board-state.d.ts +0 -2
- package/dist/watch.js +129 -127
- package/package.json +1 -1
package/dist/finance.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as e, C as t, I as n, J as r, L as i, P as a, R as o, S as s, T as c, X as l, Y as u, _ as d, _t as f, a as p, b as m, ct as h, et as g, f as _, i as v, it as y, n as b, q as x, t as S, u as C, v as w, w as T, x as E, y as D, z as O } from "./skeleton-block-
|
|
3
|
-
import {
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { min as
|
|
2
|
+
import { A as e, C as t, I as n, J as r, L as i, P as a, R as o, S as s, T as c, X as l, Y as u, _ as d, _t as f, a as p, b as m, ct as h, et as g, f as _, i as v, it as y, n as b, q as x, t as S, u as C, v as w, w as T, x as E, y as D, z as O } from "./skeleton-block-C8gOUsxn.js";
|
|
3
|
+
import { C as k, d as A, g as j, h as M, p as ee, u as N } from "./report-context-UrwaoLYZ.js";
|
|
4
|
+
import { useEffect as P, useMemo as F, useRef as I, useState as L } from "react";
|
|
5
|
+
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
6
|
+
import { min as V } from "d3-array";
|
|
7
7
|
//#region src/finance/candle-geometry.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
8
|
+
var H = "var(--lilt-candle-up)", U = "var(--lilt-candle-down)";
|
|
9
|
+
function W(e) {
|
|
10
10
|
return Math.round(e * 100) / 100;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function G(e, t, n) {
|
|
13
13
|
let r = e.fields[t], i = r?.[n.open], a = r?.[n.high], o = r?.[n.low], s = e.values[t];
|
|
14
14
|
return i == null || a == null || o == null || s == null ? null : {
|
|
15
15
|
open: i,
|
|
@@ -19,22 +19,22 @@ function W(e, t, n) {
|
|
|
19
19
|
up: s >= i
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function te(e, t, n) {
|
|
23
23
|
for (let r of e) {
|
|
24
|
-
let e =
|
|
24
|
+
let e = G(r, t, n);
|
|
25
25
|
if (!e) continue;
|
|
26
26
|
let i = Math.max(e.open, e.close), a = Math.min(e.open, e.close);
|
|
27
27
|
if (e.high < i || e.low > a) throw Error(`Lilt Candles on series "${t}" expects low ≤ open, close ≤ high at row ${r.sourceIndex + 1}.`);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
function K(e, t, n, r, i = !1) {
|
|
31
|
-
let o = Math.max(1, n.columnWidth), s = o / 2, c =
|
|
31
|
+
let o = Math.max(1, n.columnWidth), s = o / 2, c = W(e), l = W(n.y(t.high)), u = W(n.y(t.low));
|
|
32
32
|
if (r === "ohlc") {
|
|
33
|
-
let r =
|
|
33
|
+
let r = W(n.y(t.open)), i = W(n.y(t.close)), a = W(Math.max(2, s));
|
|
34
34
|
return {
|
|
35
35
|
body: null,
|
|
36
36
|
hollow: null,
|
|
37
|
-
stroke: `M${c},${l}V${u}M${
|
|
37
|
+
stroke: `M${c},${l}V${u}M${W(e - a)},${r}H${c}M${c},${i}H${W(e + a)}`,
|
|
38
38
|
side: null,
|
|
39
39
|
top: null
|
|
40
40
|
};
|
|
@@ -44,7 +44,7 @@ function K(e, t, n, r, i = !1) {
|
|
|
44
44
|
let e = (d + f) / 2;
|
|
45
45
|
d = e - .5, f = e + .5;
|
|
46
46
|
}
|
|
47
|
-
let p = r === "hollow" && t.up && o >= 3, m = p ? .5 : 0, h = i ? y(e, d, o, f - d) : null, g = h ? e - h.frontWidth / 2 : e - s, _ = a(g + m, d + m, Math.max(1, (h ? h.frontWidth : o) - m * 2), Math.max(1, f - d - m * 2), !h && o >= 6 ? 1.5 : 0), v = (l < d ? `M${c},${l}V${
|
|
47
|
+
let p = r === "hollow" && t.up && o >= 3, m = p ? .5 : 0, h = i ? y(e, d, o, f - d) : null, g = h ? e - h.frontWidth / 2 : e - s, _ = a(g + m, d + m, Math.max(1, (h ? h.frontWidth : o) - m * 2), Math.max(1, f - d - m * 2), !h && o >= 6 ? 1.5 : 0), v = (l < d ? `M${c},${l}V${W(d)}` : "") + (u > f ? `M${c},${W(f)}V${u}` : "");
|
|
48
48
|
return {
|
|
49
49
|
body: p ? null : _,
|
|
50
50
|
hollow: p ? _ : null,
|
|
@@ -56,7 +56,7 @@ function K(e, t, n, r, i = !1) {
|
|
|
56
56
|
function ne(t, n, r, i, a, o, s = !1) {
|
|
57
57
|
let l = new c(), u = new c(), d = new c(), f = new c(), p = new c();
|
|
58
58
|
for (let { row: c, cx: m } of e(t, i)) {
|
|
59
|
-
let e =
|
|
59
|
+
let e = G(c, n, r);
|
|
60
60
|
if (!e) continue;
|
|
61
61
|
let t = o(c, e), h = K(m, e, i, a, s);
|
|
62
62
|
h.side && f.add(t, h.side), h.top && p.add(t, h.top), h.body && l.add(t, h.body), h.hollow && u.add(t, h.hollow), h.stroke && d.add(t, h.stroke);
|
|
@@ -71,32 +71,32 @@ function ne(t, n, r, i, a, o, s = !1) {
|
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/finance/candles.tsx
|
|
74
|
-
function
|
|
75
|
-
return O(e, t, n.up ?
|
|
74
|
+
function q(e, t, n) {
|
|
75
|
+
return O(e, t, n.up ? H : U);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function re({ paths: e, display: t }) {
|
|
78
78
|
let n = t === "ohlc" ? 1.5 : 1;
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */
|
|
79
|
+
return /* @__PURE__ */ B(R, { children: [
|
|
80
|
+
e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */ z("path", {
|
|
81
81
|
d: r,
|
|
82
82
|
fill: "none",
|
|
83
83
|
strokeWidth: n,
|
|
84
84
|
strokeLinecap: t === "ohlc" ? "round" : "butt",
|
|
85
85
|
style: { stroke: e }
|
|
86
86
|
}, `stroke-${e}`)),
|
|
87
|
-
e.sides.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
87
|
+
e.sides.map(({ color: e, d: t }) => /* @__PURE__ */ z("path", {
|
|
88
88
|
d: t,
|
|
89
89
|
style: { fill: g(e).side }
|
|
90
90
|
}, `side-${e}`)),
|
|
91
|
-
e.tops.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
91
|
+
e.tops.map(({ color: e, d: t }) => /* @__PURE__ */ z("path", {
|
|
92
92
|
d: t,
|
|
93
93
|
style: { fill: g(e).top }
|
|
94
94
|
}, `top-${e}`)),
|
|
95
|
-
e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
95
|
+
e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */ z("path", {
|
|
96
96
|
d: t,
|
|
97
97
|
style: { fill: e }
|
|
98
98
|
}, `body-${e}`)),
|
|
99
|
-
e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
99
|
+
e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */ z("path", {
|
|
100
100
|
d: t,
|
|
101
101
|
strokeWidth: 1,
|
|
102
102
|
style: {
|
|
@@ -106,18 +106,18 @@ function ie({ paths: e, display: t }) {
|
|
|
106
106
|
}, `hollow-${e}`))
|
|
107
107
|
] });
|
|
108
108
|
}
|
|
109
|
-
var
|
|
109
|
+
var ie = o(function({ series: e, open: t, high: n, low: r, display: i = "candle", depth: a = !1, className: o }) {
|
|
110
110
|
let s = T("Candles", e, [
|
|
111
111
|
t,
|
|
112
112
|
n,
|
|
113
113
|
r
|
|
114
|
-
], "column"), { snapshot: c, descriptor: u, scales: d } = s, f =
|
|
114
|
+
], "column"), { snapshot: c, descriptor: u, scales: d } = s, f = F(() => {
|
|
115
115
|
let o = {
|
|
116
116
|
open: t,
|
|
117
117
|
high: n,
|
|
118
118
|
low: r
|
|
119
119
|
};
|
|
120
|
-
return
|
|
120
|
+
return te(c.data.rows, e, o), ne(c.data.rows, e, o, d, i, (e, t) => q(u, e, t), a);
|
|
121
121
|
}, [
|
|
122
122
|
c,
|
|
123
123
|
e,
|
|
@@ -129,7 +129,7 @@ var ae = o(function({ series: e, open: t, high: n, low: r, display: i = "candle"
|
|
|
129
129
|
u,
|
|
130
130
|
a
|
|
131
131
|
]);
|
|
132
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ B("g", {
|
|
133
133
|
"aria-hidden": "true",
|
|
134
134
|
className: ["lilt-chart__candles", o].filter(Boolean).join(" "),
|
|
135
135
|
"data-series": e,
|
|
@@ -140,7 +140,7 @@ var ae = o(function({ series: e, open: t, high: n, low: r, display: i = "candle"
|
|
|
140
140
|
opacity: s.opacity,
|
|
141
141
|
transition: s.reducedMotion ? void 0 : "opacity 160ms ease-out"
|
|
142
142
|
},
|
|
143
|
-
children: [a ? /* @__PURE__ */
|
|
143
|
+
children: [a ? /* @__PURE__ */ z(l, { clip: s.depthClip }) : null, /* @__PURE__ */ z(re, {
|
|
144
144
|
paths: f,
|
|
145
145
|
display: i
|
|
146
146
|
})]
|
|
@@ -158,26 +158,26 @@ var ae = o(function({ series: e, open: t, high: n, low: r, display: i = "candle"
|
|
|
158
158
|
close: r - (r - n) * .23,
|
|
159
159
|
up: !0
|
|
160
160
|
}, i, e.display ?? "candle", e.depth), c = g(o);
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
s.stroke ? /* @__PURE__ */
|
|
161
|
+
return /* @__PURE__ */ B(R, { children: [
|
|
162
|
+
s.stroke ? /* @__PURE__ */ z("path", {
|
|
163
163
|
d: s.stroke,
|
|
164
164
|
fill: "none",
|
|
165
165
|
stroke: o,
|
|
166
166
|
strokeWidth: 1.5
|
|
167
167
|
}) : null,
|
|
168
|
-
s.side ? /* @__PURE__ */
|
|
168
|
+
s.side ? /* @__PURE__ */ z("path", {
|
|
169
169
|
d: s.side,
|
|
170
170
|
fill: a ? o : c.side
|
|
171
171
|
}) : null,
|
|
172
|
-
s.top ? /* @__PURE__ */
|
|
172
|
+
s.top ? /* @__PURE__ */ z("path", {
|
|
173
173
|
d: s.top,
|
|
174
174
|
fill: a ? o : c.top
|
|
175
175
|
}) : null,
|
|
176
|
-
s.body ? /* @__PURE__ */
|
|
176
|
+
s.body ? /* @__PURE__ */ z("path", {
|
|
177
177
|
d: s.body,
|
|
178
178
|
fill: o
|
|
179
179
|
}) : null,
|
|
180
|
-
s.hollow ? /* @__PURE__ */
|
|
180
|
+
s.hollow ? /* @__PURE__ */ z("path", {
|
|
181
181
|
d: s.hollow,
|
|
182
182
|
fill: a ? "black" : "var(--lilt-surface)",
|
|
183
183
|
stroke: o
|
|
@@ -192,12 +192,12 @@ var ae = o(function({ series: e, open: t, high: n, low: r, display: i = "candle"
|
|
|
192
192
|
e.low
|
|
193
193
|
],
|
|
194
194
|
highlight: (e, { row: n, snapshot: r, descriptor: i }) => {
|
|
195
|
-
let a =
|
|
195
|
+
let a = G(n, e.series, e);
|
|
196
196
|
if (!a) return null;
|
|
197
|
-
let o = e.display ?? "candle", s = t(r, e.series), c = K(s.x(n.x), a, s, o, e.depth), l =
|
|
198
|
-
return /* @__PURE__ */
|
|
197
|
+
let o = e.display ?? "candle", s = t(r, e.series), c = K(s.x(n.x), a, s, o, e.depth), l = q(i, n, a);
|
|
198
|
+
return /* @__PURE__ */ z("g", {
|
|
199
199
|
className: "lilt-chart__candle-highlight",
|
|
200
|
-
children: /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ z(re, {
|
|
201
201
|
display: o,
|
|
202
202
|
paths: {
|
|
203
203
|
bodies: c.body ? [{
|
|
@@ -227,18 +227,18 @@ var ae = o(function({ series: e, open: t, high: n, low: r, display: i = "candle"
|
|
|
227
227
|
});
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/finance/cards/pane.tsx
|
|
230
|
-
function
|
|
231
|
-
let [p, m] =
|
|
232
|
-
return /* @__PURE__ */
|
|
230
|
+
function J({ context: e, label: t, caption: n, readout: r, series: a, height: o, y: s, bars: c, xAxis: l = !1, children: u }) {
|
|
231
|
+
let [p, m] = L(null), h = p ?? e.data.at(-1) ?? null;
|
|
232
|
+
return /* @__PURE__ */ B("div", {
|
|
233
233
|
className: "lilt-card__pane",
|
|
234
|
-
children: [n ? /* @__PURE__ */
|
|
234
|
+
children: [n ? /* @__PURE__ */ B("span", {
|
|
235
235
|
className: "lilt-card__pane-caption",
|
|
236
236
|
"aria-hidden": "true",
|
|
237
|
-
children: [/* @__PURE__ */
|
|
237
|
+
children: [/* @__PURE__ */ z("span", {
|
|
238
238
|
className: "lilt-card__pane-name",
|
|
239
239
|
children: n
|
|
240
240
|
}), r && h && !e.loading ? r(h) : null]
|
|
241
|
-
}) : null, /* @__PURE__ */
|
|
241
|
+
}) : null, /* @__PURE__ */ z(f, {
|
|
242
242
|
className: "lilt-card__chart",
|
|
243
243
|
"aria-label": t,
|
|
244
244
|
data: e.data,
|
|
@@ -250,7 +250,7 @@ function q({ context: e, label: t, caption: n, readout: r, series: a, height: o,
|
|
|
250
250
|
motion: e.motion,
|
|
251
251
|
status: e.loading ? "loading" : "ready",
|
|
252
252
|
loadingStyle: e.loadingStyle,
|
|
253
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ B(i, {
|
|
254
254
|
height: o,
|
|
255
255
|
margins: {
|
|
256
256
|
...e.margins,
|
|
@@ -263,59 +263,59 @@ function q({ context: e, label: t, caption: n, readout: r, series: a, height: o,
|
|
|
263
263
|
slots: e.slots || !!c,
|
|
264
264
|
bars: c,
|
|
265
265
|
background: "none",
|
|
266
|
-
children: [u, l ? /* @__PURE__ */
|
|
266
|
+
children: [u, l ? /* @__PURE__ */ z(d, { labels: "fit" }) : null]
|
|
267
267
|
})
|
|
268
268
|
})]
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
//#endregion
|
|
272
272
|
//#region src/finance/cards/candlestick-chart-card.tsx
|
|
273
|
-
function
|
|
273
|
+
function Y(e, t) {
|
|
274
274
|
let n = e[t];
|
|
275
275
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
276
276
|
}
|
|
277
|
-
function
|
|
278
|
-
let r = e.length ?
|
|
277
|
+
function X(e, t, n) {
|
|
278
|
+
let r = e.length ? Y(e[0], t) : null, i = e.length ? Y(e.at(-1), n) : null;
|
|
279
279
|
return r && i !== null ? i / r - 1 : void 0;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function ae(e) {
|
|
282
282
|
return (t) => {
|
|
283
283
|
let n = t.series[0]?.fields;
|
|
284
284
|
return !n?.length || n.some((e) => e.value === null) ? null : n.map((t) => `${t.label[0]} ${e(t.value)}`).join(" ");
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
var
|
|
287
|
+
var oe = {
|
|
288
288
|
minimumFractionDigits: 2,
|
|
289
289
|
maximumFractionDigits: 2
|
|
290
290
|
};
|
|
291
|
-
function
|
|
292
|
-
let x =
|
|
291
|
+
function se({ open: e, high: t, low: r, close: i, volume: a, display: o = "candle", depth: s = !1, scale: c = "linear", label: l = "Price", live: u = !1, data: d, ranges: f, delta: p, valueFormat: h = oe, locale: g = "en-US", volumeHeight: _ = 64, ...y }) {
|
|
292
|
+
let x = F(() => v(g, h).full, [g, JSON.stringify(h)]), S = F(() => v(g).compact, [g]), C = F(() => f?.map((t) => ({
|
|
293
293
|
...t,
|
|
294
|
-
delta: t.delta ??
|
|
294
|
+
delta: t.delta ?? X(t.data, e, i)
|
|
295
295
|
})), [
|
|
296
296
|
f,
|
|
297
297
|
e,
|
|
298
298
|
i
|
|
299
|
-
]), w = (
|
|
299
|
+
]), w = (X(d ?? f?.[0]?.data ?? [], e, i) ?? 0) >= 0, T = (t) => (Y(t, i) ?? 0) >= (Y(t, e) ?? 0), D = o === "area", O = {
|
|
300
300
|
open: {
|
|
301
301
|
label: "Open",
|
|
302
|
-
accessor: (t) =>
|
|
302
|
+
accessor: (t) => Y(t, e)
|
|
303
303
|
},
|
|
304
304
|
high: {
|
|
305
305
|
label: "High",
|
|
306
|
-
accessor: (e) =>
|
|
306
|
+
accessor: (e) => Y(e, t)
|
|
307
307
|
},
|
|
308
308
|
low: {
|
|
309
309
|
label: "Low",
|
|
310
|
-
accessor: (e) =>
|
|
310
|
+
accessor: (e) => Y(e, r)
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
|
-
return /* @__PURE__ */
|
|
313
|
+
return /* @__PURE__ */ z(b, {
|
|
314
314
|
...y,
|
|
315
315
|
depth: s,
|
|
316
316
|
data: d,
|
|
317
317
|
ranges: C,
|
|
318
|
-
delta: p ?? (d ?
|
|
318
|
+
delta: p ?? (d ? X(d, e, i) : void 0),
|
|
319
319
|
valueFormat: h,
|
|
320
320
|
locale: g,
|
|
321
321
|
aggregate: "last",
|
|
@@ -324,7 +324,7 @@ function ce({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
324
324
|
series: [{
|
|
325
325
|
key: i,
|
|
326
326
|
label: l,
|
|
327
|
-
color: D ? w ?
|
|
327
|
+
color: D ? w ? H : U : void 0
|
|
328
328
|
}],
|
|
329
329
|
shape: {
|
|
330
330
|
kind: "marks",
|
|
@@ -341,8 +341,8 @@ function ce({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
341
341
|
fields: O,
|
|
342
342
|
line: { showInspectionPoint: !1 }
|
|
343
343
|
},
|
|
344
|
-
describe:
|
|
345
|
-
draw: (e) => e.map((e) => D ? [/* @__PURE__ */
|
|
344
|
+
describe: ae(x),
|
|
345
|
+
draw: (e) => e.map((e) => D ? [/* @__PURE__ */ z(n, { series: e }, `area-${e}`), /* @__PURE__ */ z(E, { series: e }, `line-${e}`)] : /* @__PURE__ */ z(ie, {
|
|
346
346
|
series: e,
|
|
347
347
|
open: "open",
|
|
348
348
|
high: "high",
|
|
@@ -351,7 +351,7 @@ function ce({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
351
351
|
depth: s
|
|
352
352
|
}, e))
|
|
353
353
|
},
|
|
354
|
-
panes: a ? (e) => /* @__PURE__ */
|
|
354
|
+
panes: a ? (e) => /* @__PURE__ */ z(J, {
|
|
355
355
|
context: e,
|
|
356
356
|
label: `${y.title} volume`,
|
|
357
357
|
caption: "Volume",
|
|
@@ -366,39 +366,39 @@ function ce({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
366
366
|
series: [{
|
|
367
367
|
id: "volume",
|
|
368
368
|
label: "Volume",
|
|
369
|
-
accessor: (e) =>
|
|
369
|
+
accessor: (e) => Y(e, a),
|
|
370
370
|
formatValue: S,
|
|
371
371
|
colorAt: (e) => T(e) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
372
372
|
bar: { radius: 1 }
|
|
373
373
|
}],
|
|
374
|
-
children: /* @__PURE__ */
|
|
374
|
+
children: /* @__PURE__ */ z(m, { series: "volume" })
|
|
375
375
|
}) : void 0
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
378
|
//#endregion
|
|
379
379
|
//#region src/finance/indicators.ts
|
|
380
|
-
function
|
|
380
|
+
function Z(e) {
|
|
381
381
|
return typeof e == "number" && Number.isFinite(e);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function ce(e, t) {
|
|
384
384
|
if (!Number.isInteger(t) || t < 1) throw Error(`Lilt ${e} period must be a positive integer; received ${t}.`);
|
|
385
385
|
}
|
|
386
|
-
function
|
|
387
|
-
|
|
386
|
+
function le(e, t) {
|
|
387
|
+
ce("sma", t);
|
|
388
388
|
let n = [], r = 0, i = 0;
|
|
389
389
|
for (let a = 0; a < e.length; a += 1) {
|
|
390
390
|
let o = e[a];
|
|
391
|
-
|
|
391
|
+
Z(o) && (r += o, i += 1);
|
|
392
392
|
let s = a - t >= 0 ? e[a - t] : void 0;
|
|
393
|
-
a - t >= 0 &&
|
|
393
|
+
a - t >= 0 && Z(s) && (r -= s, --i), n.push(a >= t - 1 && i === t ? r / t : null);
|
|
394
394
|
}
|
|
395
395
|
return n;
|
|
396
396
|
}
|
|
397
|
-
function
|
|
398
|
-
|
|
397
|
+
function Q(e, t) {
|
|
398
|
+
ce("ema", t);
|
|
399
399
|
let n = 2 / (t + 1), r = [], i = null, a = [];
|
|
400
400
|
for (let o of e) {
|
|
401
|
-
if (!
|
|
401
|
+
if (!Z(o)) {
|
|
402
402
|
r.push(null);
|
|
403
403
|
continue;
|
|
404
404
|
}
|
|
@@ -410,11 +410,11 @@ function Z(e, t) {
|
|
|
410
410
|
}
|
|
411
411
|
return r;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
413
|
+
function ue(e, t = 14) {
|
|
414
|
+
ce("rsi", t);
|
|
415
415
|
let n = e.map(() => null), r = null, i = 0, a = 0, o = 0, s = 0, c = 0;
|
|
416
416
|
return e.forEach((e, l) => {
|
|
417
|
-
if (!
|
|
417
|
+
if (!Z(e)) return;
|
|
418
418
|
if (r === null) {
|
|
419
419
|
r = e;
|
|
420
420
|
return;
|
|
@@ -429,12 +429,12 @@ function de(e, t = 14) {
|
|
|
429
429
|
n[l] = c === 0 ? s === 0 ? 50 : 100 : 100 - 100 / (1 + s / c);
|
|
430
430
|
}), n;
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function de(e, t = 12, n = 26, r = 9) {
|
|
433
433
|
if (t >= n) throw Error("Lilt macd needs a fast period shorter than the slow period.");
|
|
434
|
-
let i =
|
|
434
|
+
let i = Q(e, t), a = Q(e, n), o = e.map((e, t) => {
|
|
435
435
|
let n = i[t], r = a[t];
|
|
436
436
|
return n === null || r === null ? null : n - r;
|
|
437
|
-
}), s =
|
|
437
|
+
}), s = Q(o, r);
|
|
438
438
|
return {
|
|
439
439
|
macd: o,
|
|
440
440
|
signal: s,
|
|
@@ -444,8 +444,8 @@ function fe(e, t = 12, n = 26, r = 9) {
|
|
|
444
444
|
})
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
let r =
|
|
447
|
+
function fe(e, t = 20, n = 2) {
|
|
448
|
+
let r = le(e, t), i = [], a = [];
|
|
449
449
|
return r.forEach((r, o) => {
|
|
450
450
|
if (r === null) {
|
|
451
451
|
i.push(null), a.push(null);
|
|
@@ -461,19 +461,19 @@ function pe(e, t = 20, n = 2) {
|
|
|
461
461
|
lower: a
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function pe(e) {
|
|
465
465
|
let t = -Infinity;
|
|
466
|
-
return e.map((e) =>
|
|
466
|
+
return e.map((e) => Z(e) ? (t = Math.max(t, e), t > 0 ? e / t - 1 : 0) : null);
|
|
467
467
|
}
|
|
468
|
-
function
|
|
469
|
-
let t = e.find(
|
|
470
|
-
return e.map((e) =>
|
|
468
|
+
function me(e) {
|
|
469
|
+
let t = e.find(Z);
|
|
470
|
+
return e.map((e) => Z(e) && t !== void 0 && t !== 0 ? e / t - 1 : null);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
for (let n of t) if (!
|
|
472
|
+
function he(e, t) {
|
|
473
|
+
for (let n of t) if (!Z(n.price) || !Z(n.size) || n.size < 0) throw Error(`Lilt order book ${e} need finite prices and non-negative sizes; received ${n.price} × ${n.size}.`);
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
|
|
475
|
+
function ge(e, t) {
|
|
476
|
+
he("bids", e), he("asks", t);
|
|
477
477
|
let n = (e) => {
|
|
478
478
|
let t = /* @__PURE__ */ new Map();
|
|
479
479
|
for (let n of e) t.set(n.price, (t.get(n.price) ?? 0) + n.size);
|
|
@@ -508,7 +508,7 @@ function _e(e, t) {
|
|
|
508
508
|
}
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region src/finance/cards/indicator-chart-card.tsx
|
|
511
|
-
function
|
|
511
|
+
function _e(e) {
|
|
512
512
|
return e.map((e, t) => {
|
|
513
513
|
let n = typeof e == "string" ? { kind: e } : e, r = "period" in n && n.period !== void 0 ? n.period : (n.kind, 20), i = "deviations" in n && n.deviations !== void 0 ? n.deviations : 2, a = n.kind === "bollinger" ? "BB" : n.kind.toUpperCase();
|
|
514
514
|
return {
|
|
@@ -520,7 +520,7 @@ function ve(e) {
|
|
|
520
520
|
};
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function ve(e) {
|
|
524
524
|
return e.map((e, t) => {
|
|
525
525
|
let n = typeof e == "string" ? { kind: e } : e;
|
|
526
526
|
return {
|
|
@@ -533,99 +533,99 @@ function ye(e) {
|
|
|
533
533
|
};
|
|
534
534
|
});
|
|
535
535
|
}
|
|
536
|
-
function
|
|
536
|
+
function $(e, t) {
|
|
537
537
|
if (!t) return null;
|
|
538
538
|
let n = e[t];
|
|
539
539
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
542
|
-
let i = e.map((e) =>
|
|
541
|
+
function ye(e, t, n, r) {
|
|
542
|
+
let i = e.map((e) => $(e, t)), a = e.map((e) => ({ ...e })), o = (e, t) => t.forEach((t, n) => a[n][e] = t);
|
|
543
543
|
for (let e of n) if (e.kind === "bollinger") {
|
|
544
|
-
let t =
|
|
544
|
+
let t = fe(i, e.period, e.deviations);
|
|
545
545
|
o(e.id, t.middle), o(`${e.id}Upper`, t.upper), o(`${e.id}Lower`, t.lower);
|
|
546
|
-
} else o(e.id, (e.kind === "sma" ?
|
|
547
|
-
for (let e of r) if (e.kind === "rsi" && o(e.id,
|
|
548
|
-
let t =
|
|
546
|
+
} else o(e.id, (e.kind === "sma" ? le : Q)(i, e.period));
|
|
547
|
+
for (let e of r) if (e.kind === "rsi" && o(e.id, ue(i, e.period)), e.kind === "macd") {
|
|
548
|
+
let t = de(i, e.fast, e.slow, e.signal);
|
|
549
549
|
o(`${e.id}Macd`, t.macd), o(`${e.id}Signal`, t.signal), o(`${e.id}Histogram`, t.histogram);
|
|
550
550
|
}
|
|
551
551
|
return a;
|
|
552
552
|
}
|
|
553
|
-
var
|
|
553
|
+
var be = {
|
|
554
554
|
minimumFractionDigits: 2,
|
|
555
555
|
maximumFractionDigits: 2
|
|
556
|
-
},
|
|
556
|
+
}, xe = [
|
|
557
557
|
"var(--lilt-series-4)",
|
|
558
558
|
"var(--lilt-series-3)",
|
|
559
559
|
"var(--lilt-series-5)"
|
|
560
560
|
];
|
|
561
|
-
function
|
|
561
|
+
function Se({ close: e, open: t, high: n, low: r, volume: i, display: a, overlays: o = [], panes: c = ["rsi", "macd"], label: l = "Price", scale: u = "linear", live: d = !1, data: f, ranges: p, delta: h, valueFormat: g = be, locale: y = "en-US", paneHeight: x = 72, ...S }) {
|
|
562
562
|
let w = !!(t && n && r), T = a ?? (w ? "candle" : "line");
|
|
563
563
|
if (T !== "line" && !w) throw Error("Lilt IndicatorChartCard candles need open, high and low fields.");
|
|
564
|
-
let D = JSON.stringify(o), O = JSON.stringify(c), k =
|
|
564
|
+
let D = JSON.stringify(o), O = JSON.stringify(c), k = F(() => _e(o), [D]), A = F(() => ve(c), [O]);
|
|
565
565
|
if (A.some((e) => e.kind === "volume") && !i) throw Error("Lilt IndicatorChartCard needs a `volume` field for a volume pane.");
|
|
566
|
-
let
|
|
566
|
+
let j = F(() => f ? ye(f, e, k, A) : void 0, [
|
|
567
567
|
f,
|
|
568
568
|
e,
|
|
569
569
|
k,
|
|
570
570
|
A
|
|
571
|
-
]),
|
|
571
|
+
]), M = F(() => p?.map((n) => ({
|
|
572
572
|
...n,
|
|
573
|
-
data:
|
|
574
|
-
delta: n.delta ?? (t ?
|
|
573
|
+
data: ye(n.data, e, k, A),
|
|
574
|
+
delta: n.delta ?? (t ? X(n.data, t, e) : void 0)
|
|
575
575
|
})), [
|
|
576
576
|
p,
|
|
577
577
|
e,
|
|
578
578
|
t,
|
|
579
579
|
k,
|
|
580
580
|
A
|
|
581
|
-
]),
|
|
581
|
+
]), ee = F(() => v(y, g).full, [y, JSON.stringify(g)]), N = F(() => v(y, { maximumFractionDigits: 2 }).full, [y]), P = F(() => v(y).compact, [y]), I = w ? {
|
|
582
582
|
open: {
|
|
583
583
|
label: "Open",
|
|
584
|
-
accessor: (e) =>
|
|
584
|
+
accessor: (e) => $(e, t)
|
|
585
585
|
},
|
|
586
586
|
high: {
|
|
587
587
|
label: "High",
|
|
588
|
-
accessor: (e) =>
|
|
588
|
+
accessor: (e) => $(e, n)
|
|
589
589
|
},
|
|
590
590
|
low: {
|
|
591
591
|
label: "Low",
|
|
592
|
-
accessor: (e) =>
|
|
592
|
+
accessor: (e) => $(e, r)
|
|
593
593
|
}
|
|
594
|
-
} : void 0,
|
|
595
|
-
let a = n.id ===
|
|
596
|
-
let r =
|
|
597
|
-
return /* @__PURE__ */
|
|
594
|
+
} : void 0, L = new Map(k.map((e) => [e.id, e])), V = f?.length ? $(f[0], e) : null, W = f?.length ? $(f.at(-1), e) : null, G = V === null || W === null || W >= V, te = A.at(-1)?.id, K = (n, r) => {
|
|
595
|
+
let a = n.id === te, o = (e) => (t) => $(t, e), s = (e, t, n) => {
|
|
596
|
+
let r = $(e, t);
|
|
597
|
+
return /* @__PURE__ */ B("span", {
|
|
598
598
|
className: "lilt-card__pane-value",
|
|
599
|
-
children: [n ? `${n} ` : "", r === null ? "—" :
|
|
599
|
+
children: [n ? `${n} ` : "", r === null ? "—" : N(r)]
|
|
600
600
|
}, t);
|
|
601
601
|
};
|
|
602
|
-
if (n.kind === "volume") return /* @__PURE__ */
|
|
602
|
+
if (n.kind === "volume") return /* @__PURE__ */ z(J, {
|
|
603
603
|
context: r,
|
|
604
604
|
label: `${S.title} volume`,
|
|
605
605
|
caption: "Volume",
|
|
606
|
-
readout: (e) => /* @__PURE__ */
|
|
606
|
+
readout: (e) => /* @__PURE__ */ z("span", {
|
|
607
607
|
className: "lilt-card__pane-value",
|
|
608
|
-
children:
|
|
608
|
+
children: $(e, i) === null ? "—" : P($(e, i))
|
|
609
609
|
}),
|
|
610
610
|
height: x,
|
|
611
611
|
xAxis: a,
|
|
612
612
|
y: {
|
|
613
613
|
includeZero: !0,
|
|
614
614
|
ticks: 2,
|
|
615
|
-
format:
|
|
615
|
+
format: P
|
|
616
616
|
},
|
|
617
617
|
bars: { series: ["volume"] },
|
|
618
618
|
series: [{
|
|
619
619
|
id: "volume",
|
|
620
620
|
label: "Volume",
|
|
621
621
|
accessor: o(i),
|
|
622
|
-
formatValue:
|
|
623
|
-
colorAt: (n) => (
|
|
622
|
+
formatValue: P,
|
|
623
|
+
colorAt: (n) => ($(n, e) ?? 0) >= ($(n, t) ?? $(n, e) ?? 0) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
624
624
|
bar: { radius: 1 }
|
|
625
625
|
}],
|
|
626
|
-
children: /* @__PURE__ */
|
|
626
|
+
children: /* @__PURE__ */ z(m, { series: "volume" })
|
|
627
627
|
}, n.id);
|
|
628
|
-
if (n.kind === "rsi") return /* @__PURE__ */
|
|
628
|
+
if (n.kind === "rsi") return /* @__PURE__ */ B(J, {
|
|
629
629
|
context: r,
|
|
630
630
|
label: `${S.title} RSI ${n.period}`,
|
|
631
631
|
caption: `RSI ${n.period}`,
|
|
@@ -642,32 +642,32 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
642
642
|
label: `RSI ${n.period}`,
|
|
643
643
|
accessor: o(n.id),
|
|
644
644
|
color: "var(--lilt-series-1)",
|
|
645
|
-
formatValue:
|
|
645
|
+
formatValue: N,
|
|
646
646
|
line: {
|
|
647
647
|
width: 1.5,
|
|
648
648
|
depth: S.depth
|
|
649
649
|
}
|
|
650
650
|
}],
|
|
651
651
|
children: [
|
|
652
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ z(_, {
|
|
653
653
|
axis: "y",
|
|
654
654
|
from: 30,
|
|
655
655
|
to: 70,
|
|
656
656
|
color: "var(--lilt-series-1)"
|
|
657
657
|
}),
|
|
658
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ z(C, {
|
|
659
659
|
value: 70,
|
|
660
660
|
color: "var(--lilt-muted)"
|
|
661
661
|
}),
|
|
662
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ z(C, {
|
|
663
663
|
value: 30,
|
|
664
664
|
color: "var(--lilt-muted)"
|
|
665
665
|
}),
|
|
666
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ z(E, { series: n.id })
|
|
667
667
|
]
|
|
668
668
|
}, n.id);
|
|
669
669
|
let c = `${n.id}Macd`, l = `${n.id}Signal`, u = `${n.id}Histogram`;
|
|
670
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ B(J, {
|
|
671
671
|
context: r,
|
|
672
672
|
label: `${S.title} MACD`,
|
|
673
673
|
caption: `MACD ${n.fast} · ${n.slow} · ${n.signal}`,
|
|
@@ -677,7 +677,7 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
677
677
|
y: {
|
|
678
678
|
includeZero: !0,
|
|
679
679
|
ticks: 2,
|
|
680
|
-
format:
|
|
680
|
+
format: N
|
|
681
681
|
},
|
|
682
682
|
bars: { series: [u] },
|
|
683
683
|
series: [
|
|
@@ -685,8 +685,8 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
685
685
|
id: u,
|
|
686
686
|
label: "Histogram",
|
|
687
687
|
accessor: o(u),
|
|
688
|
-
formatValue:
|
|
689
|
-
colorAt: (e) => (
|
|
688
|
+
formatValue: N,
|
|
689
|
+
colorAt: (e) => ($(e, u) ?? 0) >= 0 ? "color-mix(in srgb, var(--lilt-candle-up) 55%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 55%, transparent)",
|
|
690
690
|
bar: { radius: 1 }
|
|
691
691
|
},
|
|
692
692
|
{
|
|
@@ -694,7 +694,7 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
694
694
|
label: "MACD",
|
|
695
695
|
accessor: o(c),
|
|
696
696
|
color: "var(--lilt-series-4)",
|
|
697
|
-
formatValue:
|
|
697
|
+
formatValue: N,
|
|
698
698
|
line: {
|
|
699
699
|
width: 1.5,
|
|
700
700
|
depth: S.depth
|
|
@@ -705,7 +705,7 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
705
705
|
label: "Signal",
|
|
706
706
|
accessor: o(l),
|
|
707
707
|
color: "var(--lilt-series-3)",
|
|
708
|
-
formatValue:
|
|
708
|
+
formatValue: N,
|
|
709
709
|
line: {
|
|
710
710
|
width: 1.5,
|
|
711
711
|
dasharray: "3 3"
|
|
@@ -713,17 +713,17 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
713
713
|
}
|
|
714
714
|
],
|
|
715
715
|
children: [
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
/* @__PURE__ */
|
|
716
|
+
/* @__PURE__ */ z(m, { series: u }),
|
|
717
|
+
/* @__PURE__ */ z(E, { series: c }),
|
|
718
|
+
/* @__PURE__ */ z(E, { series: l })
|
|
719
719
|
]
|
|
720
720
|
}, n.id);
|
|
721
721
|
};
|
|
722
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ z(b, {
|
|
723
723
|
...S,
|
|
724
|
-
data:
|
|
725
|
-
ranges:
|
|
726
|
-
delta: h ?? (f && t ?
|
|
724
|
+
data: j,
|
|
725
|
+
ranges: M,
|
|
726
|
+
delta: h ?? (f && t ? X(f, t, e) : void 0),
|
|
727
727
|
valueFormat: g,
|
|
728
728
|
locale: y,
|
|
729
729
|
aggregate: "last",
|
|
@@ -734,11 +734,11 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
734
734
|
series: [{
|
|
735
735
|
key: e,
|
|
736
736
|
label: l,
|
|
737
|
-
color: T === "line" ?
|
|
737
|
+
color: T === "line" ? G ? H : U : void 0
|
|
738
738
|
}, ...k.map((e, t) => ({
|
|
739
739
|
key: e.id,
|
|
740
740
|
label: e.label,
|
|
741
|
-
color:
|
|
741
|
+
color: xe[t % xe.length]
|
|
742
742
|
}))],
|
|
743
743
|
shape: {
|
|
744
744
|
kind: "marks",
|
|
@@ -748,7 +748,7 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
748
748
|
slots: !0,
|
|
749
749
|
xAxis: A.length === 0,
|
|
750
750
|
series: (e) => {
|
|
751
|
-
let t =
|
|
751
|
+
let t = L.get(e);
|
|
752
752
|
return t ? {
|
|
753
753
|
curve: "monotone",
|
|
754
754
|
line: {
|
|
@@ -759,30 +759,30 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
759
759
|
...t.kind === "bollinger" ? { fields: {
|
|
760
760
|
upper: {
|
|
761
761
|
label: "Upper",
|
|
762
|
-
accessor: (e) =>
|
|
762
|
+
accessor: (e) => $(e, `${t.id}Upper`)
|
|
763
763
|
},
|
|
764
764
|
lower: {
|
|
765
765
|
label: "Lower",
|
|
766
|
-
accessor: (e) =>
|
|
766
|
+
accessor: (e) => $(e, `${t.id}Lower`)
|
|
767
767
|
}
|
|
768
768
|
} } : {}
|
|
769
769
|
} : T === "line" ? {
|
|
770
|
-
fields:
|
|
770
|
+
fields: I,
|
|
771
771
|
curve: "linear",
|
|
772
772
|
line: {
|
|
773
773
|
width: 2,
|
|
774
774
|
depth: S.depth
|
|
775
775
|
}
|
|
776
|
-
} : { fields:
|
|
776
|
+
} : { fields: I };
|
|
777
777
|
},
|
|
778
|
-
describe: w ?
|
|
778
|
+
describe: w ? ae(ee) : void 0,
|
|
779
779
|
draw: (e) => e.map((e) => {
|
|
780
|
-
let t =
|
|
781
|
-
return t ? t.kind === "bollinger" ? [/* @__PURE__ */
|
|
780
|
+
let t = L.get(e);
|
|
781
|
+
return t ? t.kind === "bollinger" ? [/* @__PURE__ */ z(s, {
|
|
782
782
|
series: e,
|
|
783
783
|
lower: "lower",
|
|
784
784
|
upper: "upper"
|
|
785
|
-
}, `band-${e}`), /* @__PURE__ */
|
|
785
|
+
}, `band-${e}`), /* @__PURE__ */ z(E, { series: e }, `line-${e}`)] : /* @__PURE__ */ z(E, { series: e }, e) : T === "line" ? /* @__PURE__ */ z(E, { series: e }, e) : /* @__PURE__ */ z(ie, {
|
|
786
786
|
series: e,
|
|
787
787
|
open: "open",
|
|
788
788
|
high: "high",
|
|
@@ -792,26 +792,26 @@ function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
792
792
|
}, e);
|
|
793
793
|
})
|
|
794
794
|
},
|
|
795
|
-
panes: A.length ? (e) => /* @__PURE__ */ R
|
|
795
|
+
panes: A.length ? (e) => /* @__PURE__ */ z(R, { children: A.map((t) => K(t, e)) }) : void 0
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
//#endregion
|
|
799
799
|
//#region src/finance/cards/depth-chart-card.tsx
|
|
800
|
-
function
|
|
800
|
+
function Ce({ price: e, label: t }) {
|
|
801
801
|
let { snapshot: n } = h();
|
|
802
802
|
if (e < n.xDomain[0] || e > n.xDomain[1]) return null;
|
|
803
803
|
let r = n.xToPixel(e);
|
|
804
|
-
return /* @__PURE__ */
|
|
804
|
+
return /* @__PURE__ */ B("g", {
|
|
805
805
|
className: "lilt-card__depth-mid",
|
|
806
806
|
"aria-hidden": "true",
|
|
807
|
-
children: [/* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ z("line", {
|
|
808
808
|
x1: r,
|
|
809
809
|
x2: r,
|
|
810
810
|
y1: n.plot.top + 18,
|
|
811
811
|
y2: n.plot.bottom,
|
|
812
812
|
strokeDasharray: "2 4",
|
|
813
813
|
vectorEffect: "non-scaling-stroke"
|
|
814
|
-
}), /* @__PURE__ */
|
|
814
|
+
}), /* @__PURE__ */ z("text", {
|
|
815
815
|
x: r,
|
|
816
816
|
y: n.plot.top + 10,
|
|
817
817
|
textAnchor: "middle",
|
|
@@ -819,153 +819,149 @@ function we({ price: e, label: t }) {
|
|
|
819
819
|
})]
|
|
820
820
|
});
|
|
821
821
|
}
|
|
822
|
-
var
|
|
822
|
+
var we = {
|
|
823
823
|
style: "currency",
|
|
824
824
|
currency: "USD",
|
|
825
825
|
minimumFractionDigits: 2,
|
|
826
826
|
maximumFractionDigits: 2
|
|
827
827
|
};
|
|
828
|
-
function
|
|
829
|
-
let
|
|
828
|
+
function Te({ title: e, header: t = !0, "aria-label": r = e || "Depth chart", bids: a, asks: o, valueFormat: s = we, sizeFormat: c, locale: l = "en-US", height: u = 220, axis: p = "minimal", background: m = "dots", hoverStyle: h = "soft", surface: g, numberStyle: _, loading: y = !1, loadingStyle: b = "shimmer", motion: x, className: S, style: C, depth: T = !1 }) {
|
|
829
|
+
let O = F(() => ge(a, o), [a, o]), k = JSON.stringify(s), P = JSON.stringify(c ?? null), I = F(() => v(l, s), [l, k]), V = F(() => v(l, c), [l, P]), W = F(() => v(l, {
|
|
830
830
|
style: "percent",
|
|
831
831
|
maximumFractionDigits: 3
|
|
832
|
-
}).full, [
|
|
832
|
+
}).full, [l]), [G, te] = L(null), K = F(() => [{
|
|
833
833
|
id: "bid",
|
|
834
834
|
label: "Bids",
|
|
835
835
|
accessor: (e) => e.bid,
|
|
836
|
-
color:
|
|
836
|
+
color: H,
|
|
837
837
|
curve: "step-before",
|
|
838
838
|
area: { treatment: "fade" },
|
|
839
839
|
line: {
|
|
840
840
|
width: 1.5,
|
|
841
|
-
depth:
|
|
841
|
+
depth: T
|
|
842
842
|
},
|
|
843
|
-
formatValue:
|
|
843
|
+
formatValue: V.full
|
|
844
844
|
}, {
|
|
845
845
|
id: "ask",
|
|
846
846
|
label: "Asks",
|
|
847
847
|
accessor: (e) => e.ask,
|
|
848
|
-
color:
|
|
848
|
+
color: U,
|
|
849
849
|
curve: "step-after",
|
|
850
850
|
area: { treatment: "fade" },
|
|
851
851
|
line: {
|
|
852
852
|
width: 1.5,
|
|
853
|
-
depth:
|
|
853
|
+
depth: T
|
|
854
854
|
},
|
|
855
|
-
formatValue:
|
|
856
|
-
}], [
|
|
857
|
-
return /* @__PURE__ */
|
|
858
|
-
"aria-label":
|
|
859
|
-
surface:
|
|
860
|
-
numberStyle:
|
|
861
|
-
motion:
|
|
862
|
-
className: ["lilt-card--depth",
|
|
863
|
-
style:
|
|
864
|
-
children: [
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
855
|
+
formatValue: V.full
|
|
856
|
+
}], [V, T]), ne = O.spread !== null && O.mid ? `${I.full(O.spread)} (${W(O.spread / O.mid)})` : "—", q = G ? G.bid ?? G.ask : null;
|
|
857
|
+
return /* @__PURE__ */ B(N, {
|
|
858
|
+
"aria-label": r,
|
|
859
|
+
surface: g,
|
|
860
|
+
numberStyle: _,
|
|
861
|
+
motion: x,
|
|
862
|
+
className: ["lilt-card--depth", S].filter(Boolean).join(" "),
|
|
863
|
+
style: C,
|
|
864
|
+
children: [t ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B(ee, { children: [e ? /* @__PURE__ */ z(M, { children: e }) : null, /* @__PURE__ */ z(j, {
|
|
865
|
+
value: O.mid,
|
|
866
|
+
format: I.full,
|
|
867
|
+
loading: y,
|
|
868
|
+
motion: x,
|
|
869
|
+
children: y ? null : G && q !== null ? /* @__PURE__ */ B(A, { children: [
|
|
870
|
+
V.full(q),
|
|
871
|
+
" ",
|
|
872
|
+
G.side === "bid" ? "bid" : "ask",
|
|
873
|
+
" depth at",
|
|
874
|
+
" ",
|
|
875
|
+
I.full(G.price)
|
|
876
|
+
] }) : /* @__PURE__ */ z(A, { children: "Mid price" })
|
|
877
|
+
})] }), /* @__PURE__ */ B("dl", {
|
|
878
|
+
className: "lilt-card__stats",
|
|
879
|
+
children: [
|
|
880
|
+
/* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("dt", { children: "Spread" }), /* @__PURE__ */ z("dd", { children: y ? "—" : ne })] }),
|
|
881
|
+
/* @__PURE__ */ B("div", {
|
|
882
|
+
"data-side": "bid",
|
|
883
|
+
children: [/* @__PURE__ */ z("dt", { children: "Bid depth" }), /* @__PURE__ */ z("dd", { children: y ? "—" : V.compact(O.bidDepth) })]
|
|
884
|
+
}),
|
|
885
|
+
/* @__PURE__ */ B("div", {
|
|
886
|
+
"data-side": "ask",
|
|
887
|
+
children: [/* @__PURE__ */ z("dt", { children: "Ask depth" }), /* @__PURE__ */ z("dd", { children: y ? "—" : V.compact(O.askDepth) })]
|
|
888
|
+
})
|
|
889
|
+
]
|
|
890
|
+
})] }) : null, /* @__PURE__ */ z(f, {
|
|
891
|
+
className: "lilt-card__chart",
|
|
892
|
+
"aria-label": `${r} depth by price`,
|
|
893
|
+
data: O.levels,
|
|
894
|
+
x: {
|
|
895
|
+
type: "number",
|
|
896
|
+
accessor: (e) => e.price,
|
|
897
|
+
format: I.full
|
|
898
|
+
},
|
|
899
|
+
y: {
|
|
900
|
+
includeZero: !0,
|
|
901
|
+
ticks: 3,
|
|
902
|
+
format: V.compact
|
|
903
|
+
},
|
|
904
|
+
series: K,
|
|
905
|
+
onSelectionChange: (e) => te(e?.row ?? null),
|
|
906
|
+
motion: x,
|
|
907
|
+
status: y ? "loading" : "ready",
|
|
908
|
+
loadingStyle: b,
|
|
909
|
+
children: /* @__PURE__ */ B(i, {
|
|
910
|
+
height: u,
|
|
911
|
+
axis: p,
|
|
912
|
+
background: m,
|
|
913
|
+
pill: h,
|
|
914
|
+
margins: {
|
|
915
|
+
top: 8,
|
|
916
|
+
right: 4,
|
|
917
|
+
bottom: 28,
|
|
918
|
+
left: 4
|
|
919
|
+
},
|
|
881
920
|
children: [
|
|
882
|
-
/* @__PURE__ */ z(
|
|
883
|
-
/* @__PURE__ */ z("
|
|
884
|
-
|
|
885
|
-
|
|
921
|
+
/* @__PURE__ */ z(D, { pattern: "lines" }),
|
|
922
|
+
/* @__PURE__ */ z(n, { series: "bid" }),
|
|
923
|
+
/* @__PURE__ */ z(n, { series: "ask" }),
|
|
924
|
+
/* @__PURE__ */ z(E, { series: "bid" }),
|
|
925
|
+
/* @__PURE__ */ z(E, { series: "ask" }),
|
|
926
|
+
O.mid === null ? null : /* @__PURE__ */ z(Ce, {
|
|
927
|
+
price: O.mid,
|
|
928
|
+
label: `Mid ${I.full(O.mid)}`
|
|
886
929
|
}),
|
|
887
|
-
/* @__PURE__ */ z("
|
|
888
|
-
|
|
889
|
-
children: [/* @__PURE__ */ R("dt", { children: "Ask depth" }), /* @__PURE__ */ R("dd", { children: g ? "—" : N.compact(C.askDepth) })]
|
|
890
|
-
})
|
|
930
|
+
/* @__PURE__ */ z(d, { labels: "fit" }),
|
|
931
|
+
/* @__PURE__ */ z(w, {})
|
|
891
932
|
]
|
|
892
|
-
}),
|
|
893
|
-
/* @__PURE__ */ R(f, {
|
|
894
|
-
className: "lilt-card__chart",
|
|
895
|
-
"aria-label": `${e} depth by price`,
|
|
896
|
-
data: C.levels,
|
|
897
|
-
x: {
|
|
898
|
-
type: "number",
|
|
899
|
-
accessor: (e) => e.price,
|
|
900
|
-
format: k.full
|
|
901
|
-
},
|
|
902
|
-
y: {
|
|
903
|
-
includeZero: !0,
|
|
904
|
-
ticks: 3,
|
|
905
|
-
format: N.compact
|
|
906
|
-
},
|
|
907
|
-
series: U,
|
|
908
|
-
onSelectionChange: (e) => B(e?.row ?? null),
|
|
909
|
-
motion: y,
|
|
910
|
-
status: g ? "loading" : "ready",
|
|
911
|
-
loadingStyle: _,
|
|
912
|
-
children: /* @__PURE__ */ z(i, {
|
|
913
|
-
height: c,
|
|
914
|
-
axis: l,
|
|
915
|
-
background: u,
|
|
916
|
-
pill: p,
|
|
917
|
-
margins: {
|
|
918
|
-
top: 8,
|
|
919
|
-
right: 4,
|
|
920
|
-
bottom: 28,
|
|
921
|
-
left: 4
|
|
922
|
-
},
|
|
923
|
-
children: [
|
|
924
|
-
/* @__PURE__ */ R(D, { pattern: "lines" }),
|
|
925
|
-
/* @__PURE__ */ R(n, { series: "bid" }),
|
|
926
|
-
/* @__PURE__ */ R(n, { series: "ask" }),
|
|
927
|
-
/* @__PURE__ */ R(E, { series: "bid" }),
|
|
928
|
-
/* @__PURE__ */ R(E, { series: "ask" }),
|
|
929
|
-
C.mid === null ? null : /* @__PURE__ */ R(we, {
|
|
930
|
-
price: C.mid,
|
|
931
|
-
label: `Mid ${k.full(C.mid)}`
|
|
932
|
-
}),
|
|
933
|
-
/* @__PURE__ */ R(d, { labels: "fit" }),
|
|
934
|
-
/* @__PURE__ */ R(w, {})
|
|
935
|
-
]
|
|
936
|
-
})
|
|
937
933
|
})
|
|
938
|
-
]
|
|
934
|
+
})]
|
|
939
935
|
});
|
|
940
936
|
}
|
|
941
937
|
//#endregion
|
|
942
938
|
//#region src/finance/cards/portfolio-chart-card.tsx
|
|
943
|
-
function
|
|
939
|
+
function Ee(e, t) {
|
|
944
940
|
if (!t) return null;
|
|
945
941
|
let n = e[t];
|
|
946
942
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
947
943
|
}
|
|
948
944
|
function De(e, t, n) {
|
|
949
|
-
let r = e.at(-1), i =
|
|
945
|
+
let r = e.at(-1), i = Ee(r, t), a = Ee(r, n);
|
|
950
946
|
return i !== null && a ? i / a - 1 : void 0;
|
|
951
947
|
}
|
|
952
948
|
function Oe({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale: l = "en-US", ...u }) {
|
|
953
|
-
let d = o ?? s?.[0]?.data ?? [], f =
|
|
949
|
+
let d = o ?? s?.[0]?.data ?? [], f = F(() => s?.map((n) => ({
|
|
954
950
|
...n,
|
|
955
951
|
delta: n.delta ?? De(n.data, e, t)
|
|
956
952
|
})), [
|
|
957
953
|
s,
|
|
958
954
|
e,
|
|
959
955
|
t
|
|
960
|
-
]), p =
|
|
956
|
+
]), p = F(() => v(l, {
|
|
961
957
|
style: "percent",
|
|
962
958
|
minimumFractionDigits: 1,
|
|
963
959
|
maximumFractionDigits: 1
|
|
964
|
-
}).full, [l]), m =
|
|
965
|
-
let t =
|
|
966
|
-
return
|
|
960
|
+
}).full, [l]), m = F(() => {
|
|
961
|
+
let t = pe(d.map((t) => Ee(t, e))).filter((e) => e !== null);
|
|
962
|
+
return V(t) ?? null;
|
|
967
963
|
}, [d, e]);
|
|
968
|
-
return /* @__PURE__ */
|
|
964
|
+
return /* @__PURE__ */ z(b, {
|
|
969
965
|
...u,
|
|
970
966
|
data: o,
|
|
971
967
|
ranges: f,
|
|
@@ -996,18 +992,18 @@ function Oe({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdown
|
|
|
996
992
|
area: { treatment: "fade" },
|
|
997
993
|
curve: "monotone"
|
|
998
994
|
},
|
|
999
|
-
draw: (e) => e.map((e) => [/* @__PURE__ */
|
|
995
|
+
draw: (e) => e.map((e) => [/* @__PURE__ */ z(n, { series: e }, `area-${e}`), /* @__PURE__ */ z(E, { series: e }, e)])
|
|
1000
996
|
},
|
|
1001
997
|
panes: i ? (t) => {
|
|
1002
|
-
let r =
|
|
1003
|
-
return /* @__PURE__ */
|
|
998
|
+
let r = pe(t.data.map((t) => Ee(t, e))), i = new Map(t.data.map((e, t) => [e, r[t] ?? null]));
|
|
999
|
+
return /* @__PURE__ */ B(J, {
|
|
1004
1000
|
context: t,
|
|
1005
1001
|
label: `${u.title} drawdown`,
|
|
1006
1002
|
caption: "Drawdown",
|
|
1007
|
-
readout: (e) => /* @__PURE__ */
|
|
1003
|
+
readout: (e) => /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ z("span", {
|
|
1008
1004
|
className: "lilt-card__pane-value",
|
|
1009
1005
|
children: i.get(e) == null ? "—" : p(i.get(e))
|
|
1010
|
-
}), m === null ? null : /* @__PURE__ */
|
|
1006
|
+
}), m === null ? null : /* @__PURE__ */ B("span", {
|
|
1011
1007
|
className: "lilt-card__pane-value",
|
|
1012
1008
|
children: ["Max ", p(m)]
|
|
1013
1009
|
})] }),
|
|
@@ -1028,7 +1024,7 @@ function Oe({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdown
|
|
|
1028
1024
|
line: { width: 1.5 },
|
|
1029
1025
|
curve: "monotone"
|
|
1030
1026
|
}],
|
|
1031
|
-
children: [/* @__PURE__ */
|
|
1027
|
+
children: [/* @__PURE__ */ z(n, { series: "drawdown" }), /* @__PURE__ */ z(E, { series: "drawdown" })]
|
|
1032
1028
|
});
|
|
1033
1029
|
} : void 0
|
|
1034
1030
|
});
|
|
@@ -1048,7 +1044,7 @@ function Ae(e, t) {
|
|
|
1048
1044
|
}
|
|
1049
1045
|
function je(e, t) {
|
|
1050
1046
|
let n = e.map((e) => ({ ...e }));
|
|
1051
|
-
for (let r of t)
|
|
1047
|
+
for (let r of t) me(e.map((e) => ke(e, r))).forEach((e, t) => n[t][`__rebased${r}`] = e);
|
|
1052
1048
|
return n;
|
|
1053
1049
|
}
|
|
1054
1050
|
var Me = {
|
|
@@ -1058,11 +1054,11 @@ var Me = {
|
|
|
1058
1054
|
maximumFractionDigits: 2
|
|
1059
1055
|
};
|
|
1060
1056
|
function Ne({ price: e, symbol: t, name: r, icon: i, display: a = "area", versus: o, data: s, ranges: c, delta: l, valueFormat: u = Me, locale: d = "en-US", title: f, ...m }) {
|
|
1061
|
-
let h = !!o?.length, g =
|
|
1057
|
+
let h = !!o?.length, g = F(() => [e, ...(o ?? []).map((e) => e.key)], [e, o]), _ = F(() => s ? h ? je(s, g) : s : void 0, [
|
|
1062
1058
|
s,
|
|
1063
1059
|
h,
|
|
1064
1060
|
g
|
|
1065
|
-
]), y =
|
|
1061
|
+
]), y = F(() => c?.map((t) => {
|
|
1066
1062
|
let n = Ae(t.data, e);
|
|
1067
1063
|
return {
|
|
1068
1064
|
...t,
|
|
@@ -1074,31 +1070,32 @@ function Ne({ price: e, symbol: t, name: r, icon: i, display: a = "area", versus
|
|
|
1074
1070
|
h,
|
|
1075
1071
|
g,
|
|
1076
1072
|
e
|
|
1077
|
-
]), x = Ae(s ?? c?.[0]?.data ?? [], e), S = !x || x.last >= x.first, C =
|
|
1073
|
+
]), x = Ae(s ?? c?.[0]?.data ?? [], e), S = !x || x.last >= x.first, C = F(() => v(d, u).full, [d, JSON.stringify(u)]), w = F(() => v(d, {
|
|
1078
1074
|
style: "percent",
|
|
1079
1075
|
minimumFractionDigits: 1,
|
|
1080
1076
|
maximumFractionDigits: 1
|
|
1081
|
-
}).full, [d]), T = (e) => h ? `__rebased${e}` : e, D = /* @__PURE__ */
|
|
1077
|
+
}).full, [d]), T = (e) => h ? `__rebased${e}` : e, D = /* @__PURE__ */ B("span", {
|
|
1082
1078
|
className: "lilt-card__ticker",
|
|
1083
1079
|
children: [
|
|
1084
|
-
i ? /* @__PURE__ */
|
|
1080
|
+
i ? /* @__PURE__ */ z("span", {
|
|
1085
1081
|
className: "lilt-card__ticker-icon",
|
|
1086
1082
|
children: i
|
|
1087
1083
|
}) : null,
|
|
1088
|
-
/* @__PURE__ */
|
|
1084
|
+
/* @__PURE__ */ z("span", {
|
|
1089
1085
|
className: "lilt-card__ticker-symbol",
|
|
1090
1086
|
children: t ?? f
|
|
1091
1087
|
}),
|
|
1092
|
-
r ? /* @__PURE__ */
|
|
1088
|
+
r ? /* @__PURE__ */ z("span", {
|
|
1093
1089
|
className: "lilt-card__ticker-name",
|
|
1094
1090
|
children: r
|
|
1095
1091
|
}) : null
|
|
1096
1092
|
]
|
|
1097
1093
|
});
|
|
1098
|
-
return /* @__PURE__ */
|
|
1094
|
+
return /* @__PURE__ */ z(b, {
|
|
1099
1095
|
...m,
|
|
1100
1096
|
title: f,
|
|
1101
|
-
|
|
1097
|
+
"aria-label": m["aria-label"] ?? f ?? t ?? r ?? "Price chart",
|
|
1098
|
+
heading: f || t || r || i ? D : void 0,
|
|
1102
1099
|
data: _,
|
|
1103
1100
|
ranges: y,
|
|
1104
1101
|
delta: h ? void 0 : l ?? (s && x && x.first ? x.last / x.first - 1 : void 0),
|
|
@@ -1119,7 +1116,7 @@ function Ne({ price: e, symbol: t, name: r, icon: i, display: a = "area", versus
|
|
|
1119
1116
|
series: [{
|
|
1120
1117
|
key: T(e),
|
|
1121
1118
|
label: t ?? f,
|
|
1122
|
-
color: h ? void 0 : S ?
|
|
1119
|
+
color: h ? void 0 : S ? H : U
|
|
1123
1120
|
}, ...(o ?? []).map((e) => ({
|
|
1124
1121
|
...e,
|
|
1125
1122
|
key: T(e.key)
|
|
@@ -1132,7 +1129,7 @@ function Ne({ price: e, symbol: t, name: r, icon: i, display: a = "area", versus
|
|
|
1132
1129
|
area: { treatment: "fade" },
|
|
1133
1130
|
curve: "monotone"
|
|
1134
1131
|
} : { curve: "monotone" },
|
|
1135
|
-
draw: (e) => e.map((e) => a === "area" && !h ? [/* @__PURE__ */
|
|
1132
|
+
draw: (e) => e.map((e) => a === "area" && !h ? [/* @__PURE__ */ z(n, { series: e }, `area-${e}`), /* @__PURE__ */ z(E, { series: e }, e)] : /* @__PURE__ */ z(E, { series: e }, e))
|
|
1136
1133
|
},
|
|
1137
1134
|
bleed: m.bleed ?? !0
|
|
1138
1135
|
});
|
|
@@ -1153,8 +1150,8 @@ function Pe(e, t, n) {
|
|
|
1153
1150
|
}));
|
|
1154
1151
|
}
|
|
1155
1152
|
function Fe(e, t) {
|
|
1156
|
-
let n =
|
|
1157
|
-
return
|
|
1153
|
+
let n = I(null), [r, i] = L(/* @__PURE__ */ new Set());
|
|
1154
|
+
return P(() => {
|
|
1158
1155
|
let r = new Map(e.map((e) => [`${e.side}:${e.price}`, e.size])), a = n.current;
|
|
1159
1156
|
if (n.current = r, !t || !a) return;
|
|
1160
1157
|
let o = new Set([...r].filter(([e, t]) => a.get(e) !== t).map(([e]) => e));
|
|
@@ -1164,102 +1161,103 @@ function Fe(e, t) {
|
|
|
1164
1161
|
return () => window.clearTimeout(s);
|
|
1165
1162
|
}, [e, t]), r;
|
|
1166
1163
|
}
|
|
1167
|
-
function Ie({ title: e,
|
|
1164
|
+
function Ie({ title: e, header: t = !0, "aria-label": n = e || "Order book", bids: i, asks: a, levels: o = 8, depth: s = !1, valueFormat: c = {
|
|
1168
1165
|
minimumFractionDigits: 2,
|
|
1169
1166
|
maximumFractionDigits: 2
|
|
1170
|
-
}, sizeFormat:
|
|
1171
|
-
let
|
|
1167
|
+
}, sizeFormat: l, locale: d = "en-US", flash: f = !0, surface: p, loading: m = !1, loadingStyle: h = "shimmer", motion: g, className: _, style: y }) {
|
|
1168
|
+
let b = k(g ?? "auto"), C = u(m, h), w = r(m, b), T = JSON.stringify(c), E = JSON.stringify(l ?? null), D = F(() => v(d, c).full, [d, T]), O = F(() => v(d, l).compact, [d, E]), A = F(() => v(d, {
|
|
1172
1169
|
style: "percent",
|
|
1173
1170
|
maximumFractionDigits: 3
|
|
1174
|
-
}).full, [
|
|
1175
|
-
value:
|
|
1176
|
-
mid: (
|
|
1177
|
-
} : null,
|
|
1171
|
+
}).full, [d]), j = F(() => Pe(i, "bid", o), [i, o]), M = F(() => Pe(a, "ask", o), [a, o]), ee = Fe(F(() => [...M, ...j], [M, j]), f && !b && !m), P = Math.max(1, M.at(-1)?.total ?? 0, j.at(-1)?.total ?? 0), I = j[0]?.price, L = M[0]?.price, R = I !== void 0 && L !== void 0 ? {
|
|
1172
|
+
value: L - I,
|
|
1173
|
+
mid: (L + I) / 2
|
|
1174
|
+
} : null, V = (e) => /* @__PURE__ */ B("tr", {
|
|
1178
1175
|
className: "lilt-order-book__level",
|
|
1179
1176
|
"data-side": e.side,
|
|
1180
1177
|
"data-flash": ee.has(`${e.side}:${e.price}`) || void 0,
|
|
1181
|
-
style: { "--lilt-depth": `${e.total /
|
|
1178
|
+
style: { "--lilt-depth": `${e.total / P * 100}%` },
|
|
1182
1179
|
children: [
|
|
1183
|
-
/* @__PURE__ */
|
|
1180
|
+
/* @__PURE__ */ B("th", {
|
|
1184
1181
|
scope: "row",
|
|
1185
|
-
children: [
|
|
1182
|
+
children: [s ? /* @__PURE__ */ z("span", {
|
|
1186
1183
|
className: "lilt-order-book__bar",
|
|
1187
1184
|
"aria-hidden": "true"
|
|
1188
|
-
}) : null,
|
|
1185
|
+
}) : null, D(e.price)]
|
|
1189
1186
|
}),
|
|
1190
|
-
/* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1187
|
+
/* @__PURE__ */ z("td", { children: O(e.size) }),
|
|
1188
|
+
/* @__PURE__ */ z("td", { children: O(e.total) })
|
|
1192
1189
|
]
|
|
1193
|
-
}, `${e.side}:${e.price}`),
|
|
1190
|
+
}, `${e.side}:${e.price}`), H = (e) => Array.from({ length: Math.max(1, Math.min(50, o)) }, (t, n) => /* @__PURE__ */ B("tr", {
|
|
1194
1191
|
className: "lilt-order-book__placeholder",
|
|
1195
1192
|
"aria-hidden": "true",
|
|
1196
1193
|
children: [
|
|
1197
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ z("td", { children: /* @__PURE__ */ z(S, {
|
|
1198
1195
|
width: `${86 - n * 4}%`,
|
|
1199
1196
|
step: n
|
|
1200
1197
|
}) }),
|
|
1201
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ z("td", { children: /* @__PURE__ */ z(S, {
|
|
1202
1199
|
width: "60%",
|
|
1203
1200
|
step: n
|
|
1204
1201
|
}) }),
|
|
1205
|
-
/* @__PURE__ */
|
|
1202
|
+
/* @__PURE__ */ z("td", { children: /* @__PURE__ */ z(S, {
|
|
1206
1203
|
width: "72%",
|
|
1207
1204
|
step: n
|
|
1208
1205
|
}) })
|
|
1209
1206
|
]
|
|
1210
1207
|
}, `${e}-${n}`));
|
|
1211
|
-
return /* @__PURE__ */
|
|
1212
|
-
"aria-label":
|
|
1213
|
-
surface:
|
|
1214
|
-
motion:
|
|
1215
|
-
className: ["lilt-card--order-book",
|
|
1216
|
-
style:
|
|
1217
|
-
children: /* @__PURE__ */
|
|
1218
|
-
leaving:
|
|
1208
|
+
return /* @__PURE__ */ z(N, {
|
|
1209
|
+
"aria-label": n,
|
|
1210
|
+
surface: p,
|
|
1211
|
+
motion: g,
|
|
1212
|
+
className: ["lilt-card--order-book", _].filter(Boolean).join(" "),
|
|
1213
|
+
style: y,
|
|
1214
|
+
children: /* @__PURE__ */ z(x, {
|
|
1215
|
+
leaving: w,
|
|
1219
1216
|
origin: "center",
|
|
1220
|
-
children: /* @__PURE__ */
|
|
1221
|
-
ref:
|
|
1222
|
-
className:
|
|
1223
|
-
"data-depth":
|
|
1224
|
-
"data-style":
|
|
1225
|
-
"data-reduced-motion":
|
|
1226
|
-
"aria-busy":
|
|
1217
|
+
children: /* @__PURE__ */ B("table", {
|
|
1218
|
+
ref: C,
|
|
1219
|
+
className: m ? "lilt-order-book lilt-skeleton" : "lilt-order-book",
|
|
1220
|
+
"data-depth": s || void 0,
|
|
1221
|
+
"data-style": m ? h : void 0,
|
|
1222
|
+
"data-reduced-motion": b || void 0,
|
|
1223
|
+
"aria-busy": m,
|
|
1224
|
+
"aria-label": n,
|
|
1227
1225
|
children: [
|
|
1228
|
-
/* @__PURE__ */
|
|
1229
|
-
/* @__PURE__ */
|
|
1230
|
-
/* @__PURE__ */
|
|
1226
|
+
t && e ? /* @__PURE__ */ z("caption", { children: e }) : null,
|
|
1227
|
+
/* @__PURE__ */ z("thead", { children: /* @__PURE__ */ B("tr", { children: [
|
|
1228
|
+
/* @__PURE__ */ z("th", {
|
|
1231
1229
|
scope: "col",
|
|
1232
1230
|
children: "Price"
|
|
1233
1231
|
}),
|
|
1234
|
-
/* @__PURE__ */
|
|
1232
|
+
/* @__PURE__ */ z("th", {
|
|
1235
1233
|
scope: "col",
|
|
1236
1234
|
children: "Size"
|
|
1237
1235
|
}),
|
|
1238
|
-
/* @__PURE__ */
|
|
1236
|
+
/* @__PURE__ */ z("th", {
|
|
1239
1237
|
scope: "col",
|
|
1240
1238
|
children: "Total"
|
|
1241
1239
|
})
|
|
1242
1240
|
] }) }),
|
|
1243
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ z("tbody", {
|
|
1244
1242
|
"aria-label": "Asks",
|
|
1245
|
-
children:
|
|
1243
|
+
children: m ? H("ask") : [...M].reverse().map(V)
|
|
1246
1244
|
}),
|
|
1247
|
-
/* @__PURE__ */
|
|
1245
|
+
/* @__PURE__ */ z("tbody", {
|
|
1248
1246
|
"aria-label": "Spread",
|
|
1249
|
-
children: /* @__PURE__ */
|
|
1247
|
+
children: /* @__PURE__ */ B("tr", {
|
|
1250
1248
|
className: "lilt-order-book__spread",
|
|
1251
|
-
children: [/* @__PURE__ */
|
|
1249
|
+
children: [/* @__PURE__ */ z("th", {
|
|
1252
1250
|
scope: "row",
|
|
1253
|
-
children:
|
|
1254
|
-
}), /* @__PURE__ */
|
|
1251
|
+
children: m ? "—" : R ? D(R.mid) : "—"
|
|
1252
|
+
}), /* @__PURE__ */ z("td", {
|
|
1255
1253
|
colSpan: 2,
|
|
1256
|
-
children:
|
|
1254
|
+
children: m ? "Loading order book" : R ? `Spread ${D(R.value)} · ${A(R.value / R.mid)}` : "No spread"
|
|
1257
1255
|
})]
|
|
1258
1256
|
})
|
|
1259
1257
|
}),
|
|
1260
|
-
/* @__PURE__ */
|
|
1258
|
+
/* @__PURE__ */ z("tbody", {
|
|
1261
1259
|
"aria-label": "Bids",
|
|
1262
|
-
children:
|
|
1260
|
+
children: m ? H("bid") : j.map(V)
|
|
1263
1261
|
})
|
|
1264
1262
|
]
|
|
1265
1263
|
})
|
|
@@ -1267,4 +1265,4 @@ function Ie({ title: e, bids: t, asks: n, levels: i = 8, depth: a = !1, valueFor
|
|
|
1267
1265
|
});
|
|
1268
1266
|
}
|
|
1269
1267
|
//#endregion
|
|
1270
|
-
export {
|
|
1268
|
+
export { ie as Candles, se as CandlestickChartCard, Te as DepthChartCard, Se as IndicatorChartCard, Ie as OrderBook, Oe as PortfolioChartCard, Ne as PriceChartCard, fe as bollinger, ge as depthLevels, pe as drawdown, Q as ema, de as macd, me as rebase, ue as rsi, le as sma };
|