@lilt-ui/charts 0.9.2 → 0.11.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 +22 -0
- package/README.md +36 -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 +10 -2
- package/dist/cards/chart-card.d.ts +4 -1
- package/dist/cards/funnel-chart-card.d.ts +7 -2
- 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 +87 -0
- package/dist/cards/radar-chart-card.d.ts +7 -2
- package/dist/cards/radial-chart-card.d.ts +7 -2
- 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 +7 -2
- 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/chart.d.ts +1 -1
- 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 +334 -327
- package/dist/index.d.ts +14 -2
- package/dist/index.js +3336 -2217
- package/dist/lifecycle/chart-empty.d.ts +29 -0
- 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-CVNzZBRd.js → report-context-UrwaoLYZ.js} +408 -231
- package/dist/{skeleton-block-Ha7mwDOY.js → skeleton-block-CPaKI7op.js} +2188 -1813
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +14 -0
- package/dist/watch/board/board-state.d.ts +0 -2
- package/dist/watch.js +129 -127
- package/package.json +11 -10
package/dist/finance.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useEffect as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { min as
|
|
2
|
+
import { $ as e, A as t, C as n, I as r, J as i, L as a, P as o, Q as s, R as c, S as l, T as u, X as d, Z as f, _ as p, a as m, b as h, bt as g, dt as _, f as v, i as y, n as b, rt as x, st as S, t as C, u as w, v as T, w as E, x as D, y as O, z as k } from "./skeleton-block-CPaKI7op.js";
|
|
3
|
+
import { C as A, d as j, g as ee, h as M, p as N, u as P } from "./report-context-UrwaoLYZ.js";
|
|
4
|
+
import { useEffect as F, useMemo as I, useRef as L, useState as R } from "react";
|
|
5
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
6
|
+
import { min as H } from "d3-array";
|
|
7
7
|
//#region src/finance/candle-geometry.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
8
|
+
var U = "var(--lilt-candle-up)", W = "var(--lilt-candle-down)";
|
|
9
|
+
function G(e) {
|
|
10
10
|
return Math.round(e * 100) / 100;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function K(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,
|
|
@@ -21,20 +21,20 @@ function G(e, t, n) {
|
|
|
21
21
|
}
|
|
22
22
|
function te(e, t, n) {
|
|
23
23
|
for (let r of e) {
|
|
24
|
-
let e =
|
|
24
|
+
let e = K(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
|
-
function
|
|
31
|
-
let
|
|
30
|
+
function ne(e, t, n, r, i = !1) {
|
|
31
|
+
let a = Math.max(1, n.columnWidth), s = a / 2, c = G(e), l = G(n.y(t.high)), u = G(n.y(t.low));
|
|
32
32
|
if (r === "ohlc") {
|
|
33
|
-
let r =
|
|
33
|
+
let r = G(n.y(t.open)), i = G(n.y(t.close)), a = G(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${G(e - a)},${r}H${c}M${c},${i}H${G(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 &&
|
|
47
|
+
let p = r === "hollow" && t.up && a >= 3, m = p ? .5 : 0, h = i ? S(e, d, a, f - d) : null, g = h ? e - h.frontWidth / 2 : e - s, _ = o(g + m, d + m, Math.max(1, (h ? h.frontWidth : a) - m * 2), Math.max(1, f - d - m * 2), !h && a >= 6 ? 1.5 : 0), v = (l < d ? `M${c},${l}V${G(d)}` : "") + (u > f ? `M${c},${G(f)}V${u}` : "");
|
|
48
48
|
return {
|
|
49
49
|
body: p ? null : _,
|
|
50
50
|
hollow: p ? _ : null,
|
|
@@ -53,17 +53,17 @@ function K(e, t, n, r, i = !1) {
|
|
|
53
53
|
top: h?.top ?? null
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
let
|
|
58
|
-
for (let { row:
|
|
59
|
-
let e =
|
|
56
|
+
function re(e, n, r, i, a, o, s = !1) {
|
|
57
|
+
let c = new u(), l = new u(), d = new u(), f = new u(), p = new u();
|
|
58
|
+
for (let { row: u, cx: m } of t(e, i)) {
|
|
59
|
+
let e = K(u, n, r);
|
|
60
60
|
if (!e) continue;
|
|
61
|
-
let t = o(
|
|
62
|
-
h.side && f.add(t, h.side), h.top && p.add(t, h.top), h.body &&
|
|
61
|
+
let t = o(u, e), h = ne(m, e, i, a, s);
|
|
62
|
+
h.side && f.add(t, h.side), h.top && p.add(t, h.top), h.body && c.add(t, h.body), h.hollow && l.add(t, h.hollow), h.stroke && d.add(t, h.stroke);
|
|
63
63
|
}
|
|
64
64
|
return {
|
|
65
|
-
bodies:
|
|
66
|
-
hollow:
|
|
65
|
+
bodies: c.entries(),
|
|
66
|
+
hollow: l.entries(),
|
|
67
67
|
strokes: d.entries(),
|
|
68
68
|
sides: f.entries(),
|
|
69
69
|
tops: p.entries()
|
|
@@ -72,31 +72,31 @@ function ne(t, n, r, i, a, o, s = !1) {
|
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/finance/candles.tsx
|
|
74
74
|
function q(e, t, n) {
|
|
75
|
-
return
|
|
75
|
+
return k(e, t, n.up ? U : W);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function ie({ 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__ */ V(z, { children: [
|
|
80
|
+
e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */ B("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__ */ B("path", {
|
|
88
88
|
d: t,
|
|
89
|
-
style: { fill:
|
|
89
|
+
style: { fill: x(e).side }
|
|
90
90
|
}, `side-${e}`)),
|
|
91
|
-
e.tops.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
91
|
+
e.tops.map(({ color: e, d: t }) => /* @__PURE__ */ B("path", {
|
|
92
92
|
d: t,
|
|
93
|
-
style: { fill:
|
|
93
|
+
style: { fill: x(e).top }
|
|
94
94
|
}, `top-${e}`)),
|
|
95
|
-
e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */
|
|
95
|
+
e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */ B("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__ */ B("path", {
|
|
100
100
|
d: t,
|
|
101
101
|
strokeWidth: 1,
|
|
102
102
|
style: {
|
|
@@ -106,43 +106,43 @@ function re({ paths: e, display: t }) {
|
|
|
106
106
|
}, `hollow-${e}`))
|
|
107
107
|
] });
|
|
108
108
|
}
|
|
109
|
-
var
|
|
110
|
-
let
|
|
111
|
-
t,
|
|
109
|
+
var ae = c(function({ series: t, open: n, high: r, low: i, display: a = "candle", depth: o = !1, className: s }) {
|
|
110
|
+
let c = E("Candles", t, [
|
|
112
111
|
n,
|
|
113
|
-
r
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
r,
|
|
113
|
+
i
|
|
114
|
+
], "column"), { snapshot: l, descriptor: u, scales: d } = c, f = I(() => {
|
|
115
|
+
let e = {
|
|
116
|
+
open: n,
|
|
117
|
+
high: r,
|
|
118
|
+
low: i
|
|
119
119
|
};
|
|
120
|
-
return te(
|
|
120
|
+
return te(l.data.rows, t, e), re(l.data.rows, t, e, d, a, (e, t) => q(u, e, t), o);
|
|
121
121
|
}, [
|
|
122
|
-
|
|
123
|
-
e,
|
|
122
|
+
l,
|
|
124
123
|
t,
|
|
125
124
|
n,
|
|
126
125
|
r,
|
|
127
|
-
d,
|
|
128
126
|
i,
|
|
127
|
+
d,
|
|
128
|
+
a,
|
|
129
129
|
u,
|
|
130
|
-
|
|
130
|
+
o
|
|
131
131
|
]);
|
|
132
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ V("g", {
|
|
133
133
|
"aria-hidden": "true",
|
|
134
|
-
className: ["lilt-chart__candles",
|
|
135
|
-
"data-series":
|
|
136
|
-
"data-display":
|
|
137
|
-
clipPath:
|
|
138
|
-
mask:
|
|
134
|
+
className: ["lilt-chart__candles", s].filter(Boolean).join(" "),
|
|
135
|
+
"data-series": t,
|
|
136
|
+
"data-display": a,
|
|
137
|
+
clipPath: o ? `url(#${c.depthClip.id})` : c.clipPath,
|
|
138
|
+
mask: c.mask,
|
|
139
139
|
style: {
|
|
140
|
-
opacity:
|
|
141
|
-
transition:
|
|
140
|
+
opacity: c.opacity,
|
|
141
|
+
transition: c.reducedMotion ? void 0 : "opacity 160ms ease-out"
|
|
142
142
|
},
|
|
143
|
-
children: [
|
|
143
|
+
children: [o ? /* @__PURE__ */ B(e, { clip: c.depthClip }) : null, /* @__PURE__ */ B(ie, {
|
|
144
144
|
paths: f,
|
|
145
|
-
display:
|
|
145
|
+
display: a
|
|
146
146
|
})]
|
|
147
147
|
});
|
|
148
148
|
}, {
|
|
@@ -151,33 +151,33 @@ var ie = o(function({ series: e, open: t, high: n, low: r, display: i = "candle"
|
|
|
151
151
|
kind: e.display === "ohlc" ? "ohlc" : "candle",
|
|
152
152
|
depth: e.depth && e.display !== "ohlc",
|
|
153
153
|
render: ({ cx: t, low: n, high: r, scales: i, mask: a }) => {
|
|
154
|
-
let o = a ? "white" : "color-mix(in srgb, var(--lilt-skeleton) 64%, var(--lilt-surface))", s =
|
|
154
|
+
let o = a ? "white" : "color-mix(in srgb, var(--lilt-skeleton) 64%, var(--lilt-surface))", s = ne(t, {
|
|
155
155
|
low: n,
|
|
156
156
|
high: r,
|
|
157
157
|
open: n + (r - n) * .28,
|
|
158
158
|
close: r - (r - n) * .23,
|
|
159
159
|
up: !0
|
|
160
|
-
}, i, e.display ?? "candle", e.depth), c =
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
s.stroke ? /* @__PURE__ */
|
|
160
|
+
}, i, e.display ?? "candle", e.depth), c = x(o);
|
|
161
|
+
return /* @__PURE__ */ V(z, { children: [
|
|
162
|
+
s.stroke ? /* @__PURE__ */ B("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__ */ B("path", {
|
|
169
169
|
d: s.side,
|
|
170
170
|
fill: a ? o : c.side
|
|
171
171
|
}) : null,
|
|
172
|
-
s.top ? /* @__PURE__ */
|
|
172
|
+
s.top ? /* @__PURE__ */ B("path", {
|
|
173
173
|
d: s.top,
|
|
174
174
|
fill: a ? o : c.top
|
|
175
175
|
}) : null,
|
|
176
|
-
s.body ? /* @__PURE__ */
|
|
176
|
+
s.body ? /* @__PURE__ */ B("path", {
|
|
177
177
|
d: s.body,
|
|
178
178
|
fill: o
|
|
179
179
|
}) : null,
|
|
180
|
-
s.hollow ? /* @__PURE__ */
|
|
180
|
+
s.hollow ? /* @__PURE__ */ B("path", {
|
|
181
181
|
d: s.hollow,
|
|
182
182
|
fill: a ? "black" : "var(--lilt-surface)",
|
|
183
183
|
stroke: o
|
|
@@ -191,13 +191,13 @@ var ie = o(function({ series: e, open: t, high: n, low: r, display: i = "candle"
|
|
|
191
191
|
e.high,
|
|
192
192
|
e.low
|
|
193
193
|
],
|
|
194
|
-
highlight: (e, { row:
|
|
195
|
-
let a =
|
|
194
|
+
highlight: (e, { row: t, snapshot: r, descriptor: i }) => {
|
|
195
|
+
let a = K(t, e.series, e);
|
|
196
196
|
if (!a) return null;
|
|
197
|
-
let o = e.display ?? "candle", s =
|
|
198
|
-
return /* @__PURE__ */
|
|
197
|
+
let o = e.display ?? "candle", s = n(r, e.series), c = ne(s.x(t.x), a, s, o, e.depth), l = q(i, t, a);
|
|
198
|
+
return /* @__PURE__ */ B("g", {
|
|
199
199
|
className: "lilt-chart__candle-highlight",
|
|
200
|
-
children: /* @__PURE__ */
|
|
200
|
+
children: /* @__PURE__ */ B(ie, {
|
|
201
201
|
display: o,
|
|
202
202
|
paths: {
|
|
203
203
|
bodies: c.body ? [{
|
|
@@ -227,30 +227,30 @@ var ie = 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 J({ context: e, label: t, caption: n, readout: r, series:
|
|
231
|
-
let [
|
|
232
|
-
return /* @__PURE__ */
|
|
230
|
+
function J({ context: e, label: t, caption: n, readout: r, series: i, height: o, y: s, bars: c, xAxis: l = !1, children: u }) {
|
|
231
|
+
let [d, f] = R(null), m = d ?? e.data.at(-1) ?? null;
|
|
232
|
+
return /* @__PURE__ */ V("div", {
|
|
233
233
|
className: "lilt-card__pane",
|
|
234
|
-
children: [n ? /* @__PURE__ */
|
|
234
|
+
children: [n ? /* @__PURE__ */ V("span", {
|
|
235
235
|
className: "lilt-card__pane-caption",
|
|
236
236
|
"aria-hidden": "true",
|
|
237
|
-
children: [/* @__PURE__ */
|
|
237
|
+
children: [/* @__PURE__ */ B("span", {
|
|
238
238
|
className: "lilt-card__pane-name",
|
|
239
239
|
children: n
|
|
240
|
-
}), r &&
|
|
241
|
-
}) : null, /* @__PURE__ */
|
|
240
|
+
}), r && m && !e.loading ? r(m) : null]
|
|
241
|
+
}) : null, /* @__PURE__ */ B(g, {
|
|
242
242
|
className: "lilt-card__chart",
|
|
243
243
|
"aria-label": t,
|
|
244
244
|
data: e.data,
|
|
245
245
|
x: e.x,
|
|
246
246
|
y: s,
|
|
247
|
-
series:
|
|
247
|
+
series: i,
|
|
248
248
|
controller: e.controller,
|
|
249
|
-
onSelectionChange: r ? (e) =>
|
|
249
|
+
onSelectionChange: r ? (e) => f(e?.row ?? null) : void 0,
|
|
250
250
|
motion: e.motion,
|
|
251
251
|
status: e.loading ? "loading" : "ready",
|
|
252
252
|
loadingStyle: e.loadingStyle,
|
|
253
|
-
children: /* @__PURE__ */
|
|
253
|
+
children: /* @__PURE__ */ V(a, {
|
|
254
254
|
height: o,
|
|
255
255
|
margins: {
|
|
256
256
|
...e.margins,
|
|
@@ -263,7 +263,7 @@ function J({ 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__ */ B(p, { labels: "fit" }) : null]
|
|
267
267
|
})
|
|
268
268
|
})]
|
|
269
269
|
});
|
|
@@ -278,25 +278,25 @@ function X(e, t, n) {
|
|
|
278
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 oe(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 se = {
|
|
288
288
|
minimumFractionDigits: 2,
|
|
289
289
|
maximumFractionDigits: 2
|
|
290
290
|
};
|
|
291
|
-
function
|
|
292
|
-
let x =
|
|
291
|
+
function ce({ open: e, high: t, low: n, 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: m = se, locale: g = "en-US", volumeHeight: _ = 64, ...v }) {
|
|
292
|
+
let x = I(() => y(g, m).full, [g, JSON.stringify(m)]), S = I(() => y(g).compact, [g]), C = I(() => f?.map((t) => ({
|
|
293
293
|
...t,
|
|
294
294
|
delta: t.delta ?? X(t.data, e, i)
|
|
295
295
|
})), [
|
|
296
296
|
f,
|
|
297
297
|
e,
|
|
298
298
|
i
|
|
299
|
-
]), w = (X(d ?? f?.[0]?.data ?? [], e, i) ?? 0) >= 0, T = (t) => (Y(t, i) ?? 0) >= (Y(t, e) ?? 0),
|
|
299
|
+
]), w = (X(d ?? f?.[0]?.data ?? [], e, i) ?? 0) >= 0, T = (t) => (Y(t, i) ?? 0) >= (Y(t, e) ?? 0), E = o === "area", O = {
|
|
300
300
|
open: {
|
|
301
301
|
label: "Open",
|
|
302
302
|
accessor: (t) => Y(t, e)
|
|
@@ -307,16 +307,16 @@ function se({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
307
307
|
},
|
|
308
308
|
low: {
|
|
309
309
|
label: "Low",
|
|
310
|
-
accessor: (e) => Y(e,
|
|
310
|
+
accessor: (e) => Y(e, n)
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
|
-
return /* @__PURE__ */
|
|
314
|
-
...
|
|
313
|
+
return /* @__PURE__ */ B(b, {
|
|
314
|
+
...v,
|
|
315
315
|
depth: s,
|
|
316
316
|
data: d,
|
|
317
317
|
ranges: C,
|
|
318
318
|
delta: p ?? (d ? X(d, e, i) : void 0),
|
|
319
|
-
valueFormat:
|
|
319
|
+
valueFormat: m,
|
|
320
320
|
locale: g,
|
|
321
321
|
aggregate: "last",
|
|
322
322
|
tiles: !1,
|
|
@@ -324,16 +324,16 @@ function se({ 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:
|
|
327
|
+
color: E ? w ? U : W : void 0
|
|
328
328
|
}],
|
|
329
329
|
shape: {
|
|
330
330
|
kind: "marks",
|
|
331
|
-
id: `candles:${o}:${s}:${c}:${e}:${t}:${
|
|
331
|
+
id: `candles:${o}:${s}:${c}:${e}:${t}:${n}:${!!a}`,
|
|
332
332
|
includeZero: !1,
|
|
333
333
|
scale: c,
|
|
334
334
|
slots: !0,
|
|
335
335
|
xAxis: !a,
|
|
336
|
-
series: () =>
|
|
336
|
+
series: () => E ? {
|
|
337
337
|
fields: O,
|
|
338
338
|
area: { treatment: "fade" },
|
|
339
339
|
curve: "linear"
|
|
@@ -341,8 +341,8 @@ function se({ 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) =>
|
|
344
|
+
describe: oe(x),
|
|
345
|
+
draw: (e) => e.map((e) => E ? [/* @__PURE__ */ B(r, { series: e }, `area-${e}`), /* @__PURE__ */ B(D, { series: e }, `line-${e}`)] : /* @__PURE__ */ B(ae, {
|
|
346
346
|
series: e,
|
|
347
347
|
open: "open",
|
|
348
348
|
high: "high",
|
|
@@ -351,9 +351,9 @@ function se({ 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__ */ B(J, {
|
|
355
355
|
context: e,
|
|
356
|
-
label: `${
|
|
356
|
+
label: `${v.title} volume`,
|
|
357
357
|
caption: "Volume",
|
|
358
358
|
height: _,
|
|
359
359
|
xAxis: !0,
|
|
@@ -371,7 +371,7 @@ function se({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
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__ */ B(h, { series: "volume" })
|
|
375
375
|
}) : void 0
|
|
376
376
|
});
|
|
377
377
|
}
|
|
@@ -380,11 +380,11 @@ function se({ open: e, high: t, low: r, close: i, volume: a, display: o = "candl
|
|
|
380
380
|
function Z(e) {
|
|
381
381
|
return typeof e == "number" && Number.isFinite(e);
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function le(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 ue(e, t) {
|
|
387
|
+
le("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];
|
|
@@ -395,7 +395,7 @@ function le(e, t) {
|
|
|
395
395
|
return n;
|
|
396
396
|
}
|
|
397
397
|
function Q(e, t) {
|
|
398
|
-
|
|
398
|
+
le("ema", t);
|
|
399
399
|
let n = 2 / (t + 1), r = [], i = null, a = [];
|
|
400
400
|
for (let o of e) {
|
|
401
401
|
if (!Z(o)) {
|
|
@@ -410,8 +410,8 @@ function Q(e, t) {
|
|
|
410
410
|
}
|
|
411
411
|
return r;
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
|
|
413
|
+
function de(e, t = 14) {
|
|
414
|
+
le("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
417
|
if (!Z(e)) return;
|
|
@@ -429,7 +429,7 @@ function ue(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 fe(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
434
|
let i = Q(e, t), a = Q(e, n), o = e.map((e, t) => {
|
|
435
435
|
let n = i[t], r = a[t];
|
|
@@ -444,8 +444,8 @@ function de(e, t = 12, n = 26, r = 9) {
|
|
|
444
444
|
})
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
-
function
|
|
448
|
-
let r =
|
|
447
|
+
function pe(e, t = 20, n = 2) {
|
|
448
|
+
let r = ue(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 fe(e, t = 20, n = 2) {
|
|
|
461
461
|
lower: a
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
|
-
function
|
|
464
|
+
function me(e) {
|
|
465
465
|
let t = -Infinity;
|
|
466
466
|
return e.map((e) => Z(e) ? (t = Math.max(t, e), t > 0 ? e / t - 1 : 0) : null);
|
|
467
467
|
}
|
|
468
|
-
function
|
|
468
|
+
function he(e) {
|
|
469
469
|
let t = e.find(Z);
|
|
470
470
|
return e.map((e) => Z(e) && t !== void 0 && t !== 0 ? e / t - 1 : null);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function ge(e, t) {
|
|
473
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 _e(e, t) {
|
|
476
|
+
ge("bids", e), ge("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 ge(e, t) {
|
|
|
508
508
|
}
|
|
509
509
|
//#endregion
|
|
510
510
|
//#region src/finance/cards/indicator-chart-card.tsx
|
|
511
|
-
function
|
|
511
|
+
function ve(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 _e(e) {
|
|
|
520
520
|
};
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
|
-
function
|
|
523
|
+
function ye(e) {
|
|
524
524
|
return e.map((e, t) => {
|
|
525
525
|
let n = typeof e == "string" ? { kind: e } : e;
|
|
526
526
|
return {
|
|
@@ -538,39 +538,39 @@ function $(e, t) {
|
|
|
538
538
|
let n = e[t];
|
|
539
539
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function be(e, t, n, r) {
|
|
542
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 = pe(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" ? ue : Q)(i, e.period));
|
|
547
|
+
for (let e of r) if (e.kind === "rsi" && o(e.id, de(i, e.period)), e.kind === "macd") {
|
|
548
|
+
let t = fe(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 xe = {
|
|
554
554
|
minimumFractionDigits: 2,
|
|
555
555
|
maximumFractionDigits: 2
|
|
556
|
-
},
|
|
556
|
+
}, Se = [
|
|
557
557
|
"var(--lilt-series-4)",
|
|
558
558
|
"var(--lilt-series-3)",
|
|
559
559
|
"var(--lilt-series-5)"
|
|
560
560
|
];
|
|
561
|
-
function
|
|
562
|
-
let
|
|
563
|
-
if (T !== "line" && !
|
|
564
|
-
let
|
|
561
|
+
function Ce({ close: e, open: t, high: n, low: r, volume: i, display: a, overlays: o = [], panes: s = ["rsi", "macd"], label: c = "Price", scale: u = "linear", live: d = !1, data: f, ranges: p, delta: m, valueFormat: g = xe, locale: _ = "en-US", paneHeight: x = 72, ...S }) {
|
|
562
|
+
let C = !!(t && n && r), T = a ?? (C ? "candle" : "line");
|
|
563
|
+
if (T !== "line" && !C) throw Error("Lilt IndicatorChartCard candles need open, high and low fields.");
|
|
564
|
+
let E = JSON.stringify(o), O = JSON.stringify(s), k = I(() => ve(o), [E]), A = I(() => ye(s), [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 j =
|
|
566
|
+
let j = I(() => f ? be(f, e, k, A) : void 0, [
|
|
567
567
|
f,
|
|
568
568
|
e,
|
|
569
569
|
k,
|
|
570
570
|
A
|
|
571
|
-
]),
|
|
571
|
+
]), ee = I(() => p?.map((n) => ({
|
|
572
572
|
...n,
|
|
573
|
-
data:
|
|
573
|
+
data: be(n.data, e, k, A),
|
|
574
574
|
delta: n.delta ?? (t ? X(n.data, t, e) : void 0)
|
|
575
575
|
})), [
|
|
576
576
|
p,
|
|
@@ -578,7 +578,7 @@ function Se({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
578
578
|
t,
|
|
579
579
|
k,
|
|
580
580
|
A
|
|
581
|
-
]),
|
|
581
|
+
]), M = I(() => y(_, g).full, [_, JSON.stringify(g)]), N = I(() => y(_, { maximumFractionDigits: 2 }).full, [_]), P = I(() => y(_).compact, [_]), F = C ? {
|
|
582
582
|
open: {
|
|
583
583
|
label: "Open",
|
|
584
584
|
accessor: (e) => $(e, t)
|
|
@@ -591,19 +591,19 @@ function Se({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
591
591
|
label: "Low",
|
|
592
592
|
accessor: (e) => $(e, r)
|
|
593
593
|
}
|
|
594
|
-
} : void 0, L = new Map(k.map((e) => [e.id, e])),
|
|
595
|
-
let a = n.id ===
|
|
594
|
+
} : void 0, L = new Map(k.map((e) => [e.id, e])), R = f?.length ? $(f[0], e) : null, H = f?.length ? $(f.at(-1), e) : null, G = R === null || H === null || H >= R, K = A.at(-1)?.id, te = (n, r) => {
|
|
595
|
+
let a = n.id === K, o = (e) => (t) => $(t, e), s = (e, t, n) => {
|
|
596
596
|
let r = $(e, t);
|
|
597
|
-
return /* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ V("span", {
|
|
598
598
|
className: "lilt-card__pane-value",
|
|
599
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__ */ B(J, {
|
|
603
603
|
context: r,
|
|
604
604
|
label: `${S.title} volume`,
|
|
605
605
|
caption: "Volume",
|
|
606
|
-
readout: (e) => /* @__PURE__ */
|
|
606
|
+
readout: (e) => /* @__PURE__ */ B("span", {
|
|
607
607
|
className: "lilt-card__pane-value",
|
|
608
608
|
children: $(e, i) === null ? "—" : P($(e, i))
|
|
609
609
|
}),
|
|
@@ -623,9 +623,9 @@ function Se({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
623
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__ */ B(h, { series: "volume" })
|
|
627
627
|
}, n.id);
|
|
628
|
-
if (n.kind === "rsi") return /* @__PURE__ */
|
|
628
|
+
if (n.kind === "rsi") return /* @__PURE__ */ V(J, {
|
|
629
629
|
context: r,
|
|
630
630
|
label: `${S.title} RSI ${n.period}`,
|
|
631
631
|
caption: `RSI ${n.period}`,
|
|
@@ -649,25 +649,25 @@ function Se({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
649
649
|
}
|
|
650
650
|
}],
|
|
651
651
|
children: [
|
|
652
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ B(v, {
|
|
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__ */ B(w, {
|
|
659
659
|
value: 70,
|
|
660
660
|
color: "var(--lilt-muted)"
|
|
661
661
|
}),
|
|
662
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ B(w, {
|
|
663
663
|
value: 30,
|
|
664
664
|
color: "var(--lilt-muted)"
|
|
665
665
|
}),
|
|
666
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ B(D, { 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__ */ V(J, {
|
|
671
671
|
context: r,
|
|
672
672
|
label: `${S.title} MACD`,
|
|
673
673
|
caption: `MACD ${n.fast} · ${n.slow} · ${n.signal}`,
|
|
@@ -713,19 +713,19 @@ function Se({ 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__ */ B(h, { series: u }),
|
|
717
|
+
/* @__PURE__ */ B(D, { series: c }),
|
|
718
|
+
/* @__PURE__ */ B(D, { series: l })
|
|
719
719
|
]
|
|
720
720
|
}, n.id);
|
|
721
721
|
};
|
|
722
|
-
return /* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ B(b, {
|
|
723
723
|
...S,
|
|
724
724
|
data: j,
|
|
725
|
-
ranges:
|
|
726
|
-
delta:
|
|
725
|
+
ranges: ee,
|
|
726
|
+
delta: m ?? (f && t ? X(f, t, e) : void 0),
|
|
727
727
|
valueFormat: g,
|
|
728
|
-
locale:
|
|
728
|
+
locale: _,
|
|
729
729
|
aggregate: "last",
|
|
730
730
|
headlineSeries: e,
|
|
731
731
|
pillSeries: e,
|
|
@@ -733,16 +733,16 @@ function Se({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
733
733
|
live: d,
|
|
734
734
|
series: [{
|
|
735
735
|
key: e,
|
|
736
|
-
label:
|
|
737
|
-
color: T === "line" ? G ?
|
|
736
|
+
label: c,
|
|
737
|
+
color: T === "line" ? G ? U : W : void 0
|
|
738
738
|
}, ...k.map((e, t) => ({
|
|
739
739
|
key: e.id,
|
|
740
740
|
label: e.label,
|
|
741
|
-
color:
|
|
741
|
+
color: Se[t % Se.length]
|
|
742
742
|
}))],
|
|
743
743
|
shape: {
|
|
744
744
|
kind: "marks",
|
|
745
|
-
id: `indicator:${T}:${u}:${t}:${n}:${r}:${
|
|
745
|
+
id: `indicator:${T}:${u}:${t}:${n}:${r}:${E}:${O}`,
|
|
746
746
|
includeZero: !1,
|
|
747
747
|
scale: u,
|
|
748
748
|
slots: !0,
|
|
@@ -767,22 +767,22 @@ function Se({ close: e, open: t, high: n, low: r, volume: i, display: a, overlay
|
|
|
767
767
|
}
|
|
768
768
|
} } : {}
|
|
769
769
|
} : T === "line" ? {
|
|
770
|
-
fields:
|
|
770
|
+
fields: F,
|
|
771
771
|
curve: "linear",
|
|
772
772
|
line: {
|
|
773
773
|
width: 2,
|
|
774
774
|
depth: S.depth
|
|
775
775
|
}
|
|
776
|
-
} : { fields:
|
|
776
|
+
} : { fields: F };
|
|
777
777
|
},
|
|
778
|
-
describe:
|
|
778
|
+
describe: C ? oe(M) : void 0,
|
|
779
779
|
draw: (e) => e.map((e) => {
|
|
780
780
|
let t = L.get(e);
|
|
781
|
-
return t ? t.kind === "bollinger" ? [/* @__PURE__ */
|
|
781
|
+
return t ? t.kind === "bollinger" ? [/* @__PURE__ */ B(l, {
|
|
782
782
|
series: e,
|
|
783
783
|
lower: "lower",
|
|
784
784
|
upper: "upper"
|
|
785
|
-
}, `band-${e}`), /* @__PURE__ */
|
|
785
|
+
}, `band-${e}`), /* @__PURE__ */ B(D, { series: e }, `line-${e}`)] : /* @__PURE__ */ B(D, { series: e }, e) : T === "line" ? /* @__PURE__ */ B(D, { series: e }, e) : /* @__PURE__ */ B(ae, {
|
|
786
786
|
series: e,
|
|
787
787
|
open: "open",
|
|
788
788
|
high: "high",
|
|
@@ -792,26 +792,26 @@ function Se({ 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__ */ z
|
|
795
|
+
panes: A.length ? (e) => /* @__PURE__ */ B(z, { children: A.map((t) => te(t, e)) }) : void 0
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
//#endregion
|
|
799
799
|
//#region src/finance/cards/depth-chart-card.tsx
|
|
800
|
-
function
|
|
801
|
-
let { snapshot: n } =
|
|
800
|
+
function we({ price: e, label: t }) {
|
|
801
|
+
let { snapshot: n } = _();
|
|
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__ */ V("g", {
|
|
805
805
|
className: "lilt-card__depth-mid",
|
|
806
806
|
"aria-hidden": "true",
|
|
807
|
-
children: [/* @__PURE__ */
|
|
807
|
+
children: [/* @__PURE__ */ B("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__ */ B("text", {
|
|
815
815
|
x: r,
|
|
816
816
|
y: n.plot.top + 10,
|
|
817
817
|
textAnchor: "middle",
|
|
@@ -819,98 +819,99 @@ function Ce({ price: e, label: t }) {
|
|
|
819
819
|
})]
|
|
820
820
|
});
|
|
821
821
|
}
|
|
822
|
-
var
|
|
822
|
+
var Te = {
|
|
823
823
|
style: "currency",
|
|
824
824
|
currency: "USD",
|
|
825
825
|
minimumFractionDigits: 2,
|
|
826
826
|
maximumFractionDigits: 2
|
|
827
827
|
};
|
|
828
|
-
function
|
|
829
|
-
let
|
|
828
|
+
function Ee({ title: e, header: t = !0, "aria-label": n = e || "Depth chart", bids: i, asks: o, valueFormat: s = Te, sizeFormat: c, locale: l = "en-US", height: u = 220, axis: d = "minimal", background: f = "dots", hoverStyle: m = "soft", surface: h, numberStyle: _, loading: v = !1, loadingStyle: b = "shimmer", empty: x = "dots", motion: S, className: C, style: w, depth: E = !1 }) {
|
|
829
|
+
let k = I(() => _e(i, o), [i, o]), A = JSON.stringify(s), F = JSON.stringify(c ?? null), L = I(() => y(l, s), [l, A]), H = I(() => y(l, c), [l, F]), G = I(() => y(l, {
|
|
830
830
|
style: "percent",
|
|
831
831
|
maximumFractionDigits: 3
|
|
832
|
-
}).full, [l]), [
|
|
832
|
+
}).full, [l]), [K, te] = R(null), ne = I(() => [{
|
|
833
833
|
id: "bid",
|
|
834
834
|
label: "Bids",
|
|
835
835
|
accessor: (e) => e.bid,
|
|
836
|
-
color:
|
|
836
|
+
color: U,
|
|
837
837
|
curve: "step-before",
|
|
838
838
|
area: { treatment: "fade" },
|
|
839
839
|
line: {
|
|
840
840
|
width: 1.5,
|
|
841
|
-
depth:
|
|
841
|
+
depth: E
|
|
842
842
|
},
|
|
843
|
-
formatValue:
|
|
843
|
+
formatValue: H.full
|
|
844
844
|
}, {
|
|
845
845
|
id: "ask",
|
|
846
846
|
label: "Asks",
|
|
847
847
|
accessor: (e) => e.ask,
|
|
848
|
-
color:
|
|
848
|
+
color: W,
|
|
849
849
|
curve: "step-after",
|
|
850
850
|
area: { treatment: "fade" },
|
|
851
851
|
line: {
|
|
852
852
|
width: 1.5,
|
|
853
|
-
depth:
|
|
853
|
+
depth: E
|
|
854
854
|
},
|
|
855
|
-
formatValue:
|
|
856
|
-
}], [
|
|
857
|
-
return /* @__PURE__ */
|
|
858
|
-
"aria-label":
|
|
859
|
-
surface:
|
|
855
|
+
formatValue: H.full
|
|
856
|
+
}], [H, E]), re = k.spread !== null && k.mid ? `${L.full(k.spread)} (${G(k.spread / k.mid)})` : "—", q = K ? K.bid ?? K.ask : null;
|
|
857
|
+
return /* @__PURE__ */ V(P, {
|
|
858
|
+
"aria-label": n,
|
|
859
|
+
surface: h,
|
|
860
860
|
numberStyle: _,
|
|
861
|
-
motion:
|
|
862
|
-
className: ["lilt-card--depth",
|
|
863
|
-
style:
|
|
864
|
-
children: [t ? /* @__PURE__ */
|
|
865
|
-
value:
|
|
866
|
-
format:
|
|
867
|
-
loading:
|
|
868
|
-
motion:
|
|
869
|
-
children:
|
|
870
|
-
|
|
861
|
+
motion: S,
|
|
862
|
+
className: ["lilt-card--depth", C].filter(Boolean).join(" "),
|
|
863
|
+
style: w,
|
|
864
|
+
children: [t ? /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ V(N, { children: [e ? /* @__PURE__ */ B(M, { children: e }) : null, /* @__PURE__ */ B(ee, {
|
|
865
|
+
value: k.mid,
|
|
866
|
+
format: L.full,
|
|
867
|
+
loading: v,
|
|
868
|
+
motion: S,
|
|
869
|
+
children: v ? null : K && q !== null ? /* @__PURE__ */ V(j, { children: [
|
|
870
|
+
H.full(q),
|
|
871
871
|
" ",
|
|
872
|
-
|
|
872
|
+
K.side === "bid" ? "bid" : "ask",
|
|
873
873
|
" depth at",
|
|
874
874
|
" ",
|
|
875
|
-
|
|
876
|
-
] }) : /* @__PURE__ */
|
|
877
|
-
})] }), /* @__PURE__ */
|
|
875
|
+
L.full(K.price)
|
|
876
|
+
] }) : /* @__PURE__ */ B(j, { children: "Mid price" })
|
|
877
|
+
})] }), /* @__PURE__ */ V("dl", {
|
|
878
878
|
className: "lilt-card__stats",
|
|
879
879
|
children: [
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ V("div", { children: [/* @__PURE__ */ B("dt", { children: "Spread" }), /* @__PURE__ */ B("dd", { children: v ? "—" : re })] }),
|
|
881
|
+
/* @__PURE__ */ V("div", {
|
|
882
882
|
"data-side": "bid",
|
|
883
|
-
children: [/* @__PURE__ */
|
|
883
|
+
children: [/* @__PURE__ */ B("dt", { children: "Bid depth" }), /* @__PURE__ */ B("dd", { children: v ? "—" : H.compact(k.bidDepth) })]
|
|
884
884
|
}),
|
|
885
|
-
/* @__PURE__ */
|
|
885
|
+
/* @__PURE__ */ V("div", {
|
|
886
886
|
"data-side": "ask",
|
|
887
|
-
children: [/* @__PURE__ */
|
|
887
|
+
children: [/* @__PURE__ */ B("dt", { children: "Ask depth" }), /* @__PURE__ */ B("dd", { children: v ? "—" : H.compact(k.askDepth) })]
|
|
888
888
|
})
|
|
889
889
|
]
|
|
890
|
-
})] }) : null, /* @__PURE__ */
|
|
890
|
+
})] }) : null, /* @__PURE__ */ B(g, {
|
|
891
891
|
className: "lilt-card__chart",
|
|
892
|
-
"aria-label": `${
|
|
893
|
-
data:
|
|
892
|
+
"aria-label": `${n} depth by price`,
|
|
893
|
+
data: k.levels,
|
|
894
894
|
x: {
|
|
895
895
|
type: "number",
|
|
896
896
|
accessor: (e) => e.price,
|
|
897
|
-
format:
|
|
897
|
+
format: L.full
|
|
898
898
|
},
|
|
899
899
|
y: {
|
|
900
900
|
includeZero: !0,
|
|
901
901
|
ticks: 3,
|
|
902
|
-
format:
|
|
902
|
+
format: H.compact
|
|
903
903
|
},
|
|
904
|
-
series:
|
|
904
|
+
series: ne,
|
|
905
905
|
onSelectionChange: (e) => te(e?.row ?? null),
|
|
906
|
-
motion:
|
|
907
|
-
status:
|
|
906
|
+
motion: S,
|
|
907
|
+
status: v ? "loading" : "ready",
|
|
908
908
|
loadingStyle: b,
|
|
909
|
-
|
|
909
|
+
empty: x,
|
|
910
|
+
children: /* @__PURE__ */ V(a, {
|
|
910
911
|
height: u,
|
|
911
|
-
axis:
|
|
912
|
-
background:
|
|
913
|
-
pill:
|
|
912
|
+
axis: d,
|
|
913
|
+
background: f,
|
|
914
|
+
pill: m,
|
|
914
915
|
margins: {
|
|
915
916
|
top: 8,
|
|
916
917
|
right: 4,
|
|
@@ -918,17 +919,17 @@ function Te({ title: e, header: t = !0, "aria-label": r = e || "Depth chart", bi
|
|
|
918
919
|
left: 4
|
|
919
920
|
},
|
|
920
921
|
children: [
|
|
921
|
-
/* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
923
|
-
/* @__PURE__ */
|
|
924
|
-
/* @__PURE__ */
|
|
925
|
-
/* @__PURE__ */
|
|
926
|
-
|
|
927
|
-
price:
|
|
928
|
-
label: `Mid ${
|
|
922
|
+
/* @__PURE__ */ B(O, { pattern: "lines" }),
|
|
923
|
+
/* @__PURE__ */ B(r, { series: "bid" }),
|
|
924
|
+
/* @__PURE__ */ B(r, { series: "ask" }),
|
|
925
|
+
/* @__PURE__ */ B(D, { series: "bid" }),
|
|
926
|
+
/* @__PURE__ */ B(D, { series: "ask" }),
|
|
927
|
+
k.mid === null ? null : /* @__PURE__ */ B(we, {
|
|
928
|
+
price: k.mid,
|
|
929
|
+
label: `Mid ${L.full(k.mid)}`
|
|
929
930
|
}),
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ B(p, { labels: "fit" }),
|
|
932
|
+
/* @__PURE__ */ B(T, {})
|
|
932
933
|
]
|
|
933
934
|
})
|
|
934
935
|
})]
|
|
@@ -936,36 +937,36 @@ function Te({ title: e, header: t = !0, "aria-label": r = e || "Depth chart", bi
|
|
|
936
937
|
}
|
|
937
938
|
//#endregion
|
|
938
939
|
//#region src/finance/cards/portfolio-chart-card.tsx
|
|
939
|
-
function
|
|
940
|
+
function De(e, t) {
|
|
940
941
|
if (!t) return null;
|
|
941
942
|
let n = e[t];
|
|
942
943
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
943
944
|
}
|
|
944
|
-
function
|
|
945
|
-
let r = e.at(-1), i =
|
|
945
|
+
function Oe(e, t, n) {
|
|
946
|
+
let r = e.at(-1), i = De(r, t), a = De(r, n);
|
|
946
947
|
return i !== null && a ? i / a - 1 : void 0;
|
|
947
948
|
}
|
|
948
|
-
function
|
|
949
|
-
let d = o ?? s?.[0]?.data ?? [], f =
|
|
949
|
+
function ke({ value: e, basis: t, label: n = "Value", drawdown: i = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale: l = "en-US", ...u }) {
|
|
950
|
+
let d = o ?? s?.[0]?.data ?? [], f = I(() => s?.map((n) => ({
|
|
950
951
|
...n,
|
|
951
|
-
delta: n.delta ??
|
|
952
|
+
delta: n.delta ?? Oe(n.data, e, t)
|
|
952
953
|
})), [
|
|
953
954
|
s,
|
|
954
955
|
e,
|
|
955
956
|
t
|
|
956
|
-
]), p =
|
|
957
|
+
]), p = I(() => y(l, {
|
|
957
958
|
style: "percent",
|
|
958
959
|
minimumFractionDigits: 1,
|
|
959
960
|
maximumFractionDigits: 1
|
|
960
|
-
}).full, [l]), m =
|
|
961
|
-
let t =
|
|
962
|
-
return
|
|
961
|
+
}).full, [l]), m = I(() => {
|
|
962
|
+
let t = me(d.map((t) => De(t, e))).filter((e) => e !== null);
|
|
963
|
+
return H(t) ?? null;
|
|
963
964
|
}, [d, e]);
|
|
964
|
-
return /* @__PURE__ */
|
|
965
|
+
return /* @__PURE__ */ B(b, {
|
|
965
966
|
...u,
|
|
966
967
|
data: o,
|
|
967
968
|
ranges: f,
|
|
968
|
-
delta: c ?? (o ?
|
|
969
|
+
delta: c ?? (o ? Oe(o, e, t) : void 0),
|
|
969
970
|
locale: l,
|
|
970
971
|
aggregate: "last",
|
|
971
972
|
headlineSeries: e,
|
|
@@ -974,7 +975,7 @@ function Oe({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdown
|
|
|
974
975
|
restCaption: t ? () => "over basis" : void 0,
|
|
975
976
|
series: [{
|
|
976
977
|
key: e,
|
|
977
|
-
label:
|
|
978
|
+
label: n
|
|
978
979
|
}, ...t ? [{
|
|
979
980
|
key: t,
|
|
980
981
|
label: "Basis",
|
|
@@ -992,18 +993,18 @@ function Oe({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdown
|
|
|
992
993
|
area: { treatment: "fade" },
|
|
993
994
|
curve: "monotone"
|
|
994
995
|
},
|
|
995
|
-
draw: (e) => e.map((e) => [/* @__PURE__ */
|
|
996
|
+
draw: (e) => e.map((e) => [/* @__PURE__ */ B(r, { series: e }, `area-${e}`), /* @__PURE__ */ B(D, { series: e }, e)])
|
|
996
997
|
},
|
|
997
998
|
panes: i ? (t) => {
|
|
998
|
-
let
|
|
999
|
-
return /* @__PURE__ */
|
|
999
|
+
let n = me(t.data.map((t) => De(t, e))), i = new Map(t.data.map((e, t) => [e, n[t] ?? null]));
|
|
1000
|
+
return /* @__PURE__ */ V(J, {
|
|
1000
1001
|
context: t,
|
|
1001
1002
|
label: `${u.title} drawdown`,
|
|
1002
1003
|
caption: "Drawdown",
|
|
1003
|
-
readout: (e) => /* @__PURE__ */
|
|
1004
|
+
readout: (e) => /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("span", {
|
|
1004
1005
|
className: "lilt-card__pane-value",
|
|
1005
1006
|
children: i.get(e) == null ? "—" : p(i.get(e))
|
|
1006
|
-
}), m === null ? null : /* @__PURE__ */
|
|
1007
|
+
}), m === null ? null : /* @__PURE__ */ V("span", {
|
|
1007
1008
|
className: "lilt-card__pane-value",
|
|
1008
1009
|
children: ["Max ", p(m)]
|
|
1009
1010
|
})] }),
|
|
@@ -1024,45 +1025,45 @@ function Oe({ value: e, basis: t, label: r = "Value", drawdown: i = !0, drawdown
|
|
|
1024
1025
|
line: { width: 1.5 },
|
|
1025
1026
|
curve: "monotone"
|
|
1026
1027
|
}],
|
|
1027
|
-
children: [/* @__PURE__ */
|
|
1028
|
+
children: [/* @__PURE__ */ B(r, { series: "drawdown" }), /* @__PURE__ */ B(D, { series: "drawdown" })]
|
|
1028
1029
|
});
|
|
1029
1030
|
} : void 0
|
|
1030
1031
|
});
|
|
1031
1032
|
}
|
|
1032
1033
|
//#endregion
|
|
1033
1034
|
//#region src/finance/cards/price-chart-card.tsx
|
|
1034
|
-
function
|
|
1035
|
+
function Ae(e, t) {
|
|
1035
1036
|
let n = e[t];
|
|
1036
1037
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
1037
1038
|
}
|
|
1038
|
-
function
|
|
1039
|
-
let n = e.map((e) =>
|
|
1039
|
+
function je(e, t) {
|
|
1040
|
+
let n = e.map((e) => Ae(e, t)).filter((e) => e !== null);
|
|
1040
1041
|
return n.length > 1 ? {
|
|
1041
1042
|
first: n[0],
|
|
1042
1043
|
last: n.at(-1)
|
|
1043
1044
|
} : null;
|
|
1044
1045
|
}
|
|
1045
|
-
function
|
|
1046
|
+
function Me(e, t) {
|
|
1046
1047
|
let n = e.map((e) => ({ ...e }));
|
|
1047
|
-
for (let r of t)
|
|
1048
|
+
for (let r of t) he(e.map((e) => Ae(e, r))).forEach((e, t) => n[t][`__rebased${r}`] = e);
|
|
1048
1049
|
return n;
|
|
1049
1050
|
}
|
|
1050
|
-
var
|
|
1051
|
+
var Ne = {
|
|
1051
1052
|
style: "currency",
|
|
1052
1053
|
currency: "USD",
|
|
1053
1054
|
minimumFractionDigits: 2,
|
|
1054
1055
|
maximumFractionDigits: 2
|
|
1055
1056
|
};
|
|
1056
|
-
function
|
|
1057
|
-
let h = !!o?.length, g =
|
|
1057
|
+
function Pe({ price: e, symbol: t, name: n, icon: i, display: a = "area", versus: o, data: s, ranges: c, delta: l, valueFormat: u = Ne, locale: d = "en-US", title: f, ...p }) {
|
|
1058
|
+
let h = !!o?.length, g = I(() => [e, ...(o ?? []).map((e) => e.key)], [e, o]), _ = I(() => s ? h ? Me(s, g) : s : void 0, [
|
|
1058
1059
|
s,
|
|
1059
1060
|
h,
|
|
1060
1061
|
g
|
|
1061
|
-
]),
|
|
1062
|
-
let n =
|
|
1062
|
+
]), v = I(() => c?.map((t) => {
|
|
1063
|
+
let n = je(t.data, e);
|
|
1063
1064
|
return {
|
|
1064
1065
|
...t,
|
|
1065
|
-
data: h ?
|
|
1066
|
+
data: h ? Me(t.data, g) : t.data,
|
|
1066
1067
|
delta: t.delta ?? (n && n.first ? n.last / n.first - 1 : void 0)
|
|
1067
1068
|
};
|
|
1068
1069
|
}), [
|
|
@@ -1070,53 +1071,53 @@ function Ne({ price: e, symbol: t, name: r, icon: i, display: a = "area", versus
|
|
|
1070
1071
|
h,
|
|
1071
1072
|
g,
|
|
1072
1073
|
e
|
|
1073
|
-
]), x =
|
|
1074
|
+
]), x = je(s ?? c?.[0]?.data ?? [], e), S = !x || x.last >= x.first, C = I(() => y(d, u).full, [d, JSON.stringify(u)]), w = I(() => y(d, {
|
|
1074
1075
|
style: "percent",
|
|
1075
1076
|
minimumFractionDigits: 1,
|
|
1076
1077
|
maximumFractionDigits: 1
|
|
1077
|
-
}).full, [d]), T = (e) => h ? `__rebased${e}` : e,
|
|
1078
|
+
}).full, [d]), T = (e) => h ? `__rebased${e}` : e, E = /* @__PURE__ */ V("span", {
|
|
1078
1079
|
className: "lilt-card__ticker",
|
|
1079
1080
|
children: [
|
|
1080
|
-
i ? /* @__PURE__ */
|
|
1081
|
+
i ? /* @__PURE__ */ B("span", {
|
|
1081
1082
|
className: "lilt-card__ticker-icon",
|
|
1082
1083
|
children: i
|
|
1083
1084
|
}) : null,
|
|
1084
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ B("span", {
|
|
1085
1086
|
className: "lilt-card__ticker-symbol",
|
|
1086
1087
|
children: t ?? f
|
|
1087
1088
|
}),
|
|
1088
|
-
|
|
1089
|
+
n ? /* @__PURE__ */ B("span", {
|
|
1089
1090
|
className: "lilt-card__ticker-name",
|
|
1090
|
-
children:
|
|
1091
|
+
children: n
|
|
1091
1092
|
}) : null
|
|
1092
1093
|
]
|
|
1093
1094
|
});
|
|
1094
|
-
return /* @__PURE__ */
|
|
1095
|
-
...
|
|
1095
|
+
return /* @__PURE__ */ B(b, {
|
|
1096
|
+
...p,
|
|
1096
1097
|
title: f,
|
|
1097
|
-
"aria-label":
|
|
1098
|
-
heading: f || t ||
|
|
1098
|
+
"aria-label": p["aria-label"] ?? f ?? t ?? n ?? "Price chart",
|
|
1099
|
+
heading: f || t || n || i ? E : void 0,
|
|
1099
1100
|
data: _,
|
|
1100
|
-
ranges:
|
|
1101
|
+
ranges: v,
|
|
1101
1102
|
delta: h ? void 0 : l ?? (s && x && x.first ? x.last / x.first - 1 : void 0),
|
|
1102
1103
|
valueFormat: h ? {
|
|
1103
1104
|
style: "percent",
|
|
1104
1105
|
maximumFractionDigits: 1
|
|
1105
1106
|
} : u,
|
|
1106
|
-
formatValue: h ? (e) =>
|
|
1107
|
+
formatValue: h ? (e) => m(w)(e) : void 0,
|
|
1107
1108
|
locale: d,
|
|
1108
1109
|
aggregate: "last",
|
|
1109
1110
|
headlineSeries: T(e),
|
|
1110
1111
|
pillSeries: h ? "nearest" : T(e),
|
|
1111
1112
|
tiles: h,
|
|
1112
1113
|
restCaption: h ? void 0 : (t) => {
|
|
1113
|
-
let n =
|
|
1114
|
-
return n ?
|
|
1114
|
+
let n = je(t, e);
|
|
1115
|
+
return n ? m(C)(n.last - n.first) : null;
|
|
1115
1116
|
},
|
|
1116
1117
|
series: [{
|
|
1117
1118
|
key: T(e),
|
|
1118
1119
|
label: t ?? f,
|
|
1119
|
-
color: h ? void 0 : S ?
|
|
1120
|
+
color: h ? void 0 : S ? U : W
|
|
1120
1121
|
}, ...(o ?? []).map((e) => ({
|
|
1121
1122
|
...e,
|
|
1122
1123
|
key: T(e.key)
|
|
@@ -1129,14 +1130,14 @@ function Ne({ price: e, symbol: t, name: r, icon: i, display: a = "area", versus
|
|
|
1129
1130
|
area: { treatment: "fade" },
|
|
1130
1131
|
curve: "monotone"
|
|
1131
1132
|
} : { curve: "monotone" },
|
|
1132
|
-
draw: (e) => e.map((e) => a === "area" && !h ? [/* @__PURE__ */
|
|
1133
|
+
draw: (e) => e.map((e) => a === "area" && !h ? [/* @__PURE__ */ B(r, { series: e }, `area-${e}`), /* @__PURE__ */ B(D, { series: e }, e)] : /* @__PURE__ */ B(D, { series: e }, e))
|
|
1133
1134
|
},
|
|
1134
|
-
bleed:
|
|
1135
|
+
bleed: p.bleed ?? !0
|
|
1135
1136
|
});
|
|
1136
1137
|
}
|
|
1137
1138
|
//#endregion
|
|
1138
1139
|
//#region src/finance/order-book.tsx
|
|
1139
|
-
function
|
|
1140
|
+
function Fe(e, t, n) {
|
|
1140
1141
|
let r = /* @__PURE__ */ new Map();
|
|
1141
1142
|
for (let t of e) Number.isFinite(t.price) && Number.isFinite(t.size) && t.size > 0 && r.set(t.price, (r.get(t.price) ?? 0) + t.size);
|
|
1142
1143
|
let i = [...r].map(([e, t]) => ({
|
|
@@ -1149,9 +1150,9 @@ function Pe(e, t, n) {
|
|
|
1149
1150
|
side: t
|
|
1150
1151
|
}));
|
|
1151
1152
|
}
|
|
1152
|
-
function
|
|
1153
|
-
let n =
|
|
1154
|
-
return
|
|
1153
|
+
function Ie(e, t) {
|
|
1154
|
+
let n = L(null), [r, i] = R(/* @__PURE__ */ new Set());
|
|
1155
|
+
return F(() => {
|
|
1155
1156
|
let r = new Map(e.map((e) => [`${e.side}:${e.price}`, e.size])), a = n.current;
|
|
1156
1157
|
if (n.current = r, !t || !a) return;
|
|
1157
1158
|
let o = new Set([...r].filter(([e, t]) => a.get(e) !== t).map(([e]) => e));
|
|
@@ -1161,108 +1162,114 @@ function Fe(e, t) {
|
|
|
1161
1162
|
return () => window.clearTimeout(s);
|
|
1162
1163
|
}, [e, t]), r;
|
|
1163
1164
|
}
|
|
1164
|
-
function
|
|
1165
|
+
function Le({ title: e, header: t = !0, "aria-label": n = e || "Order book", bids: r, asks: a, levels: o = 8, depth: c = !1, valueFormat: l = {
|
|
1165
1166
|
minimumFractionDigits: 2,
|
|
1166
1167
|
maximumFractionDigits: 2
|
|
1167
|
-
}, sizeFormat:
|
|
1168
|
-
let
|
|
1168
|
+
}, sizeFormat: u, locale: p = "en-US", flash: m = !0, surface: h, loading: g = !1, loadingStyle: _ = "shimmer", empty: v = "dots", motion: b, className: x, style: S }) {
|
|
1169
|
+
let w = A(b ?? "auto"), T = s(g, _), E = f(g, w), D = JSON.stringify(l), O = JSON.stringify(u ?? null), k = I(() => y(p, l).full, [p, D]), j = I(() => y(p, u).compact, [p, O]), ee = I(() => y(p, {
|
|
1169
1170
|
style: "percent",
|
|
1170
1171
|
maximumFractionDigits: 3
|
|
1171
|
-
}).full, [
|
|
1172
|
-
value:
|
|
1173
|
-
mid: (
|
|
1174
|
-
} : null,
|
|
1172
|
+
}).full, [p]), M = I(() => Fe(r, "bid", o), [r, o]), N = I(() => Fe(a, "ask", o), [a, o]), F = !g && N.length === 0 && M.length === 0, L = Ie(I(() => [...N, ...M], [N, M]), m && !w && !g), R = Math.max(1, N.at(-1)?.total ?? 0, M.at(-1)?.total ?? 0), H = M[0]?.price, U = N[0]?.price, W = H !== void 0 && U !== void 0 ? {
|
|
1173
|
+
value: U - H,
|
|
1174
|
+
mid: (U + H) / 2
|
|
1175
|
+
} : null, G = (e) => /* @__PURE__ */ V("tr", {
|
|
1175
1176
|
className: "lilt-order-book__level",
|
|
1176
1177
|
"data-side": e.side,
|
|
1177
|
-
"data-flash":
|
|
1178
|
-
style: { "--lilt-depth": `${e.total /
|
|
1178
|
+
"data-flash": L.has(`${e.side}:${e.price}`) || void 0,
|
|
1179
|
+
style: { "--lilt-depth": `${e.total / R * 100}%` },
|
|
1179
1180
|
children: [
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ V("th", {
|
|
1181
1182
|
scope: "row",
|
|
1182
|
-
children: [
|
|
1183
|
+
children: [c ? /* @__PURE__ */ B("span", {
|
|
1183
1184
|
className: "lilt-order-book__bar",
|
|
1184
1185
|
"aria-hidden": "true"
|
|
1185
|
-
}) : null,
|
|
1186
|
+
}) : null, k(e.price)]
|
|
1186
1187
|
}),
|
|
1187
|
-
/* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ B("td", { children: j(e.size) }),
|
|
1189
|
+
/* @__PURE__ */ B("td", { children: j(e.total) })
|
|
1189
1190
|
]
|
|
1190
|
-
}, `${e.side}:${e.price}`),
|
|
1191
|
+
}, `${e.side}:${e.price}`), K = (e) => Array.from({ length: Math.max(1, Math.min(50, o)) }, (t, n) => /* @__PURE__ */ V("tr", {
|
|
1191
1192
|
className: "lilt-order-book__placeholder",
|
|
1192
1193
|
"aria-hidden": "true",
|
|
1193
1194
|
children: [
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
+
/* @__PURE__ */ B("td", { children: /* @__PURE__ */ B(C, {
|
|
1195
1196
|
width: `${86 - n * 4}%`,
|
|
1196
1197
|
step: n
|
|
1197
1198
|
}) }),
|
|
1198
|
-
/* @__PURE__ */
|
|
1199
|
+
/* @__PURE__ */ B("td", { children: /* @__PURE__ */ B(C, {
|
|
1199
1200
|
width: "60%",
|
|
1200
1201
|
step: n
|
|
1201
1202
|
}) }),
|
|
1202
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ B("td", { children: /* @__PURE__ */ B(C, {
|
|
1203
1204
|
width: "72%",
|
|
1204
1205
|
step: n
|
|
1205
1206
|
}) })
|
|
1206
1207
|
]
|
|
1207
1208
|
}, `${e}-${n}`));
|
|
1208
|
-
return /* @__PURE__ */
|
|
1209
|
+
return /* @__PURE__ */ V(P, {
|
|
1209
1210
|
"aria-label": n,
|
|
1210
|
-
surface:
|
|
1211
|
-
motion:
|
|
1212
|
-
className: ["lilt-card--order-book",
|
|
1213
|
-
style:
|
|
1214
|
-
children: /* @__PURE__ */
|
|
1215
|
-
leaving:
|
|
1211
|
+
surface: h,
|
|
1212
|
+
motion: b,
|
|
1213
|
+
className: ["lilt-card--order-book", x].filter(Boolean).join(" "),
|
|
1214
|
+
style: S,
|
|
1215
|
+
children: [/* @__PURE__ */ B(d, {
|
|
1216
|
+
leaving: E,
|
|
1216
1217
|
origin: "center",
|
|
1217
|
-
children: /* @__PURE__ */
|
|
1218
|
-
ref:
|
|
1219
|
-
className:
|
|
1220
|
-
"data-depth":
|
|
1221
|
-
"data-style":
|
|
1222
|
-
"data-reduced-motion":
|
|
1223
|
-
"aria-busy":
|
|
1218
|
+
children: /* @__PURE__ */ V("table", {
|
|
1219
|
+
ref: T,
|
|
1220
|
+
className: g ? "lilt-order-book lilt-skeleton" : "lilt-order-book",
|
|
1221
|
+
"data-depth": c || void 0,
|
|
1222
|
+
"data-style": g ? _ : void 0,
|
|
1223
|
+
"data-reduced-motion": w || void 0,
|
|
1224
|
+
"aria-busy": g,
|
|
1224
1225
|
"aria-label": n,
|
|
1225
1226
|
children: [
|
|
1226
|
-
t && e ? /* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
/* @__PURE__ */
|
|
1227
|
+
t && e ? /* @__PURE__ */ B("caption", { children: e }) : null,
|
|
1228
|
+
/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ V("tr", { children: [
|
|
1229
|
+
/* @__PURE__ */ B("th", {
|
|
1229
1230
|
scope: "col",
|
|
1230
1231
|
children: "Price"
|
|
1231
1232
|
}),
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ B("th", {
|
|
1233
1234
|
scope: "col",
|
|
1234
1235
|
children: "Size"
|
|
1235
1236
|
}),
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ B("th", {
|
|
1237
1238
|
scope: "col",
|
|
1238
1239
|
children: "Total"
|
|
1239
1240
|
})
|
|
1240
1241
|
] }) }),
|
|
1241
|
-
/* @__PURE__ */ z
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1242
|
+
F ? null : /* @__PURE__ */ V(z, { children: [
|
|
1243
|
+
/* @__PURE__ */ B("tbody", {
|
|
1244
|
+
"aria-label": "Asks",
|
|
1245
|
+
children: g ? K("ask") : [...N].reverse().map(G)
|
|
1246
|
+
}),
|
|
1247
|
+
/* @__PURE__ */ B("tbody", {
|
|
1248
|
+
"aria-label": "Spread",
|
|
1249
|
+
children: /* @__PURE__ */ V("tr", {
|
|
1250
|
+
className: "lilt-order-book__spread",
|
|
1251
|
+
children: [/* @__PURE__ */ B("th", {
|
|
1252
|
+
scope: "row",
|
|
1253
|
+
children: g ? "—" : W ? k(W.mid) : "—"
|
|
1254
|
+
}), /* @__PURE__ */ B("td", {
|
|
1255
|
+
colSpan: 2,
|
|
1256
|
+
children: g ? "Loading order book" : W ? `Spread ${k(W.value)} · ${ee(W.value / W.mid)}` : "No spread"
|
|
1257
|
+
})]
|
|
1258
|
+
})
|
|
1259
|
+
}),
|
|
1260
|
+
/* @__PURE__ */ B("tbody", {
|
|
1261
|
+
"aria-label": "Bids",
|
|
1262
|
+
children: g ? K("bid") : M.map(G)
|
|
1256
1263
|
})
|
|
1257
|
-
})
|
|
1258
|
-
/* @__PURE__ */ z("tbody", {
|
|
1259
|
-
"aria-label": "Bids",
|
|
1260
|
-
children: m ? H("bid") : j.map(V)
|
|
1261
|
-
})
|
|
1264
|
+
] })
|
|
1262
1265
|
]
|
|
1263
1266
|
})
|
|
1264
|
-
})
|
|
1267
|
+
}), F ? /* @__PURE__ */ B(i, {
|
|
1268
|
+
block: !0,
|
|
1269
|
+
state: v,
|
|
1270
|
+
shape: "rows"
|
|
1271
|
+
}) : null]
|
|
1265
1272
|
});
|
|
1266
1273
|
}
|
|
1267
1274
|
//#endregion
|
|
1268
|
-
export {
|
|
1275
|
+
export { ae as Candles, ce as CandlestickChartCard, Ee as DepthChartCard, Ce as IndicatorChartCard, Le as OrderBook, ke as PortfolioChartCard, Pe as PriceChartCard, pe as bollinger, _e as depthLevels, me as drawdown, Q as ema, fe as macd, he as rebase, de as rsi, ue as sma };
|