@lilt-ui/charts 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +45 -0
- package/dist/cards/area-chart-card.d.ts +10 -1
- package/dist/cards/cartesian-card.d.ts +35 -6
- package/dist/cards/chart-card.d.ts +12 -1
- package/dist/cards/line-chart-card.d.ts +10 -1
- package/dist/{cartesian-card-BDZs0v6E.js → cartesian-card-Dcd0ZnQL.js} +2745 -2976
- package/dist/chart.d.ts +1 -1
- package/dist/finance/cards/depth-chart-card.d.ts +2 -2
- package/dist/finance.js +220 -219
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1635 -1631
- package/dist/interaction/axis-cursor.d.ts +12 -2
- package/dist/interaction/chart-sync.d.ts +11 -1
- package/dist/interaction/inspection-layer.d.ts +6 -0
- package/dist/interaction/pin-glyphs.d.ts +8 -0
- package/dist/interaction/pin-marker.d.ts +9 -1
- package/dist/model/cartesian-model.d.ts +3 -3
- package/dist/primitives/axis-segments.d.ts +23 -0
- package/dist/report-context-Cz0AYdV2.js +895 -0
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +34 -3
- package/dist/watch/board/board-state.d.ts +74 -0
- package/dist/watch/board/board-toast.d.ts +19 -0
- package/dist/watch/board/chart-board.d.ts +97 -0
- package/dist/watch/board/report-context.d.ts +3 -0
- package/dist/watch/engine/describe.d.ts +9 -0
- package/dist/watch/engine/explain.d.ts +48 -0
- package/dist/watch/engine/normal.d.ts +114 -0
- package/dist/watch/engine/robust.d.ts +7 -0
- package/dist/watch/engine/rules.d.ts +22 -0
- package/dist/watch/engine/status.d.ts +39 -0
- package/dist/watch/index.d.ts +14 -0
- package/dist/watch/normal-layer.d.ts +18 -0
- package/dist/watch.d.ts +2 -0
- package/dist/watch.js +628 -0
- package/package.json +6 -1
package/dist/finance.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as e,
|
|
2
|
+
import { A as e, D as t, J as n, M as r, _ as i, b as a, d as o, g as s, h as c, i as l, j as u, k as d, l as f, m as p, p as m, r as h, t as g, v as _, w as v, x as y, y as b, z as x } from "./cartesian-card-Dcd0ZnQL.js";
|
|
3
|
+
import { S, d as C, g as w, h as T, p as E, u as D } from "./report-context-Cz0AYdV2.js";
|
|
3
4
|
import { useEffect as O, useMemo as k, useRef as A, useState as j } from "react";
|
|
4
5
|
import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
5
6
|
//#region src/finance/candle-geometry.ts
|
|
@@ -25,46 +26,46 @@ function z(e, t, n) {
|
|
|
25
26
|
if (e.high < i || e.low > a) throw Error(`Lilt Candles on series "${t}" expects low ≤ open, close ≤ high at row ${r.sourceIndex + 1}.`);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
function B(e,
|
|
29
|
-
let
|
|
30
|
-
if (
|
|
31
|
-
let
|
|
29
|
+
function B(e, n, r, i) {
|
|
30
|
+
let a = Math.max(1, r.columnWidth), o = a / 2, s = L(e), c = L(r.y(n.high)), l = L(r.y(n.low));
|
|
31
|
+
if (i === "ohlc") {
|
|
32
|
+
let t = L(r.y(n.open)), i = L(r.y(n.close)), a = L(Math.max(2, o));
|
|
32
33
|
return {
|
|
33
34
|
body: null,
|
|
34
35
|
hollow: null,
|
|
35
|
-
stroke: `M${s},${c}V${l}M${L(e - a)},${
|
|
36
|
+
stroke: `M${s},${c}V${l}M${L(e - a)},${t}H${s}M${s},${i}H${L(e + a)}`
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
|
-
let u =
|
|
39
|
+
let u = r.y(Math.max(n.open, n.close)), d = r.y(Math.min(n.open, n.close));
|
|
39
40
|
if (d - u < 1) {
|
|
40
41
|
let e = (u + d) / 2;
|
|
41
42
|
u = e - .5, d = e + .5;
|
|
42
43
|
}
|
|
43
|
-
let f =
|
|
44
|
+
let f = i === "hollow" && n.up && a >= 3, p = f ? .5 : 0, m = t(e - o + p, u + p, Math.max(1, a - p * 2), Math.max(1, d - u - p * 2), a >= 6 ? 1.5 : 0), h = (c < u ? `M${s},${c}V${L(u)}` : "") + (l > d ? `M${s},${L(d)}V${l}` : "");
|
|
44
45
|
return {
|
|
45
46
|
body: f ? null : m,
|
|
46
47
|
hollow: f ? m : null,
|
|
47
48
|
stroke: h
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
|
-
function V(t, n, r, i, a
|
|
51
|
-
let
|
|
52
|
-
for (let { row:
|
|
53
|
-
let
|
|
54
|
-
if (!
|
|
55
|
-
let
|
|
56
|
-
f.body &&
|
|
51
|
+
function V(e, t, n, r, i, a) {
|
|
52
|
+
let o = new y(), s = new y(), c = new y();
|
|
53
|
+
for (let { row: l, cx: u } of v(e, r)) {
|
|
54
|
+
let e = R(l, t, n);
|
|
55
|
+
if (!e) continue;
|
|
56
|
+
let d = a(l, e), f = B(u, e, r, i);
|
|
57
|
+
f.body && o.add(d, f.body), f.hollow && s.add(d, f.hollow), f.stroke && c.add(d, f.stroke);
|
|
57
58
|
}
|
|
58
59
|
return {
|
|
59
|
-
bodies:
|
|
60
|
-
hollow:
|
|
61
|
-
strokes:
|
|
60
|
+
bodies: o.entries(),
|
|
61
|
+
hollow: s.entries(),
|
|
62
|
+
strokes: c.entries()
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
//#endregion
|
|
65
66
|
//#region src/finance/candles.tsx
|
|
66
67
|
function H(e, t, n) {
|
|
67
|
-
return
|
|
68
|
+
return r(e, t, n.up ? F : I);
|
|
68
69
|
}
|
|
69
70
|
function U({ paths: e, display: t }) {
|
|
70
71
|
let n = t === "ohlc" ? 1.5 : 1;
|
|
@@ -90,41 +91,41 @@ function U({ paths: e, display: t }) {
|
|
|
90
91
|
}, `hollow-${e}`))
|
|
91
92
|
] });
|
|
92
93
|
}
|
|
93
|
-
var W =
|
|
94
|
-
let
|
|
94
|
+
var W = u(function({ series: e, open: t, high: n, low: r, display: i = "candle", className: o }) {
|
|
95
|
+
let s = a("Candles", e, [
|
|
95
96
|
t,
|
|
96
97
|
n,
|
|
97
98
|
r
|
|
98
|
-
], "column"), { snapshot:
|
|
99
|
+
], "column"), { snapshot: c, descriptor: l, scales: u } = s, d = k(() => {
|
|
99
100
|
let a = {
|
|
100
101
|
open: t,
|
|
101
102
|
high: n,
|
|
102
103
|
low: r
|
|
103
104
|
};
|
|
104
|
-
return z(
|
|
105
|
+
return z(c.data.rows, e, a), V(c.data.rows, e, a, u, i, (e, t) => H(l, e, t));
|
|
105
106
|
}, [
|
|
106
|
-
|
|
107
|
+
c,
|
|
107
108
|
e,
|
|
108
109
|
t,
|
|
109
110
|
n,
|
|
110
111
|
r,
|
|
111
|
-
|
|
112
|
+
u,
|
|
112
113
|
i,
|
|
113
|
-
|
|
114
|
+
l
|
|
114
115
|
]);
|
|
115
116
|
return /* @__PURE__ */ N("g", {
|
|
116
117
|
"aria-hidden": "true",
|
|
117
|
-
className: ["lilt-chart__candles",
|
|
118
|
+
className: ["lilt-chart__candles", o].filter(Boolean).join(" "),
|
|
118
119
|
"data-series": e,
|
|
119
120
|
"data-display": i,
|
|
120
|
-
clipPath:
|
|
121
|
-
mask:
|
|
121
|
+
clipPath: s.clipPath,
|
|
122
|
+
mask: s.mask,
|
|
122
123
|
style: {
|
|
123
|
-
opacity:
|
|
124
|
-
transition:
|
|
124
|
+
opacity: s.opacity,
|
|
125
|
+
transition: s.reducedMotion ? void 0 : "opacity 160ms ease-out"
|
|
125
126
|
},
|
|
126
127
|
children: /* @__PURE__ */ N(U, {
|
|
127
|
-
paths:
|
|
128
|
+
paths: d,
|
|
128
129
|
display: i
|
|
129
130
|
})
|
|
130
131
|
});
|
|
@@ -139,22 +140,22 @@ var W = t(function({ series: e, open: t, high: n, low: r, display: i = "candle",
|
|
|
139
140
|
highlight: (e, { row: t, snapshot: n, descriptor: r }) => {
|
|
140
141
|
let i = R(t, e.series, e);
|
|
141
142
|
if (!i) return null;
|
|
142
|
-
let a = e.display ?? "candle", o =
|
|
143
|
+
let a = e.display ?? "candle", o = b(n, e.series), s = B(o.x(t.x), i, o, a), c = H(r, t, i);
|
|
143
144
|
return /* @__PURE__ */ N("g", {
|
|
144
145
|
className: "lilt-chart__candle-highlight",
|
|
145
146
|
children: /* @__PURE__ */ N(U, {
|
|
146
147
|
display: a,
|
|
147
148
|
paths: {
|
|
148
149
|
bodies: s.body ? [{
|
|
149
|
-
color:
|
|
150
|
+
color: c,
|
|
150
151
|
d: s.body
|
|
151
152
|
}] : [],
|
|
152
153
|
hollow: s.hollow ? [{
|
|
153
|
-
color:
|
|
154
|
+
color: c,
|
|
154
155
|
d: s.hollow
|
|
155
156
|
}] : [],
|
|
156
157
|
strokes: s.stroke ? [{
|
|
157
|
-
color:
|
|
158
|
+
color: c,
|
|
158
159
|
d: s.stroke
|
|
159
160
|
}] : []
|
|
160
161
|
}
|
|
@@ -164,42 +165,42 @@ var W = t(function({ series: e, open: t, high: n, low: r, display: i = "candle",
|
|
|
164
165
|
});
|
|
165
166
|
//#endregion
|
|
166
167
|
//#region src/finance/cards/pane.tsx
|
|
167
|
-
function G({ context:
|
|
168
|
-
let [
|
|
168
|
+
function G({ context: t, label: r, caption: i, readout: a, series: o, height: s, y: c, bars: l, xAxis: u = !1, children: d }) {
|
|
169
|
+
let [f, p] = j(null), h = f ?? t.data.at(-1) ?? null;
|
|
169
170
|
return /* @__PURE__ */ P("div", {
|
|
170
171
|
className: "lilt-card__pane",
|
|
171
|
-
children: [
|
|
172
|
+
children: [i ? /* @__PURE__ */ P("span", {
|
|
172
173
|
className: "lilt-card__pane-caption",
|
|
173
174
|
"aria-hidden": "true",
|
|
174
175
|
children: [/* @__PURE__ */ N("span", {
|
|
175
176
|
className: "lilt-card__pane-name",
|
|
176
|
-
children:
|
|
177
|
-
}),
|
|
178
|
-
}) : null, /* @__PURE__ */ N(
|
|
177
|
+
children: i
|
|
178
|
+
}), a && h && !t.loading ? a(h) : null]
|
|
179
|
+
}) : null, /* @__PURE__ */ N(n, {
|
|
179
180
|
className: "lilt-card__chart",
|
|
180
|
-
"aria-label":
|
|
181
|
-
data:
|
|
182
|
-
x:
|
|
183
|
-
y:
|
|
184
|
-
series:
|
|
185
|
-
controller:
|
|
186
|
-
onSelectionChange:
|
|
187
|
-
motion:
|
|
188
|
-
status:
|
|
189
|
-
children: /* @__PURE__ */ P(
|
|
190
|
-
height:
|
|
181
|
+
"aria-label": r,
|
|
182
|
+
data: t.data,
|
|
183
|
+
x: t.x,
|
|
184
|
+
y: c,
|
|
185
|
+
series: o,
|
|
186
|
+
controller: t.controller,
|
|
187
|
+
onSelectionChange: a ? (e) => p(e?.row ?? null) : void 0,
|
|
188
|
+
motion: t.motion,
|
|
189
|
+
status: t.loading ? "loading" : "ready",
|
|
190
|
+
children: /* @__PURE__ */ P(e, {
|
|
191
|
+
height: s,
|
|
191
192
|
margins: {
|
|
192
|
-
...
|
|
193
|
+
...t.margins,
|
|
193
194
|
top: 6,
|
|
194
|
-
bottom:
|
|
195
|
+
bottom: u ? 28 : 4
|
|
195
196
|
},
|
|
196
|
-
axis:
|
|
197
|
-
pill:
|
|
198
|
-
axisInset:
|
|
199
|
-
slots:
|
|
200
|
-
bars:
|
|
197
|
+
axis: t.axis,
|
|
198
|
+
pill: t.hoverStyle,
|
|
199
|
+
axisInset: t.axisInset,
|
|
200
|
+
slots: t.slots || !!l,
|
|
201
|
+
bars: l,
|
|
201
202
|
background: "none",
|
|
202
|
-
children: [
|
|
203
|
+
children: [d, u ? /* @__PURE__ */ N(m, { labels: "fit" }) : null]
|
|
203
204
|
})
|
|
204
205
|
})]
|
|
205
206
|
});
|
|
@@ -224,8 +225,8 @@ var te = {
|
|
|
224
225
|
minimumFractionDigits: 2,
|
|
225
226
|
maximumFractionDigits: 2
|
|
226
227
|
};
|
|
227
|
-
function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candle", scale:
|
|
228
|
-
let
|
|
228
|
+
function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candle", scale: c = "linear", label: l = "Price", live: u = !1, data: f, ranges: p, delta: m, valueFormat: _ = te, locale: v = "en-US", volumeHeight: y = 64, ...b }) {
|
|
229
|
+
let x = k(() => h(v, _).full, [v, JSON.stringify(_)]), S = k(() => h(v).compact, [v]), C = k(() => p?.map((t) => ({
|
|
229
230
|
...t,
|
|
230
231
|
delta: t.delta ?? q(t.data, e, r)
|
|
231
232
|
})), [
|
|
@@ -246,26 +247,26 @@ function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candl
|
|
|
246
247
|
accessor: (e) => K(e, n)
|
|
247
248
|
}
|
|
248
249
|
};
|
|
249
|
-
return /* @__PURE__ */ N(
|
|
250
|
-
...
|
|
250
|
+
return /* @__PURE__ */ N(g, {
|
|
251
|
+
...b,
|
|
251
252
|
data: f,
|
|
252
|
-
ranges:
|
|
253
|
+
ranges: C,
|
|
253
254
|
delta: m ?? (f ? q(f, e, r) : void 0),
|
|
254
|
-
valueFormat:
|
|
255
|
-
locale:
|
|
255
|
+
valueFormat: _,
|
|
256
|
+
locale: v,
|
|
256
257
|
aggregate: "last",
|
|
257
258
|
tiles: !1,
|
|
258
259
|
live: u,
|
|
259
260
|
series: [{
|
|
260
261
|
key: r,
|
|
261
|
-
label:
|
|
262
|
+
label: l,
|
|
262
263
|
color: E ? w ? F : I : void 0
|
|
263
264
|
}],
|
|
264
265
|
shape: {
|
|
265
266
|
kind: "marks",
|
|
266
|
-
id: `candles:${o}:${
|
|
267
|
+
id: `candles:${o}:${c}:${e}:${t}:${n}:${!!a}`,
|
|
267
268
|
includeZero: !1,
|
|
268
|
-
scale:
|
|
269
|
+
scale: c,
|
|
269
270
|
slots: !0,
|
|
270
271
|
xAxis: !a,
|
|
271
272
|
series: () => E ? {
|
|
@@ -276,8 +277,8 @@ function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candl
|
|
|
276
277
|
fields: D,
|
|
277
278
|
line: { showInspectionPoint: !1 }
|
|
278
279
|
},
|
|
279
|
-
describe: ee(
|
|
280
|
-
draw: (e) => e.map((e) => E ? [/* @__PURE__ */ N(
|
|
280
|
+
describe: ee(x),
|
|
281
|
+
draw: (e) => e.map((e) => E ? [/* @__PURE__ */ N(d, { series: e }, `area-${e}`), /* @__PURE__ */ N(i, { series: e }, `line-${e}`)] : /* @__PURE__ */ N(W, {
|
|
281
282
|
series: e,
|
|
282
283
|
open: "open",
|
|
283
284
|
high: "high",
|
|
@@ -287,25 +288,25 @@ function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candl
|
|
|
287
288
|
},
|
|
288
289
|
panes: a ? (e) => /* @__PURE__ */ N(G, {
|
|
289
290
|
context: e,
|
|
290
|
-
label: `${
|
|
291
|
+
label: `${b.title} volume`,
|
|
291
292
|
caption: "Volume",
|
|
292
|
-
height:
|
|
293
|
+
height: y,
|
|
293
294
|
xAxis: !0,
|
|
294
295
|
y: {
|
|
295
296
|
includeZero: !0,
|
|
296
297
|
ticks: 2,
|
|
297
|
-
format:
|
|
298
|
+
format: S
|
|
298
299
|
},
|
|
299
300
|
bars: { series: ["volume"] },
|
|
300
301
|
series: [{
|
|
301
302
|
id: "volume",
|
|
302
303
|
label: "Volume",
|
|
303
304
|
accessor: (e) => K(e, a),
|
|
304
|
-
formatValue:
|
|
305
|
+
formatValue: S,
|
|
305
306
|
colorAt: (e) => T(e) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
306
307
|
bar: { radius: 1 }
|
|
307
308
|
}],
|
|
308
|
-
children: /* @__PURE__ */ N(
|
|
309
|
+
children: /* @__PURE__ */ N(s, { series: "volume" })
|
|
309
310
|
}) : void 0
|
|
310
311
|
});
|
|
311
312
|
}
|
|
@@ -492,27 +493,27 @@ var pe = {
|
|
|
492
493
|
"var(--lilt-series-3)",
|
|
493
494
|
"var(--lilt-series-5)"
|
|
494
495
|
];
|
|
495
|
-
function he({ close: e, open: t, high: n, low:
|
|
496
|
-
let
|
|
497
|
-
if (E !== "line" && !
|
|
498
|
-
let D = JSON.stringify(
|
|
499
|
-
if (j.some((e) => e.kind === "volume") && !
|
|
500
|
-
let L = k(() =>
|
|
501
|
-
|
|
496
|
+
function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlays: l = [], panes: u = ["rsi", "macd"], label: d = "Price", scale: p = "linear", live: m = !1, data: v, ranges: y, delta: b, valueFormat: x = pe, locale: S = "en-US", paneHeight: C = 72, ...w }) {
|
|
497
|
+
let T = !!(t && n && r), E = c ?? (T ? "candle" : "line");
|
|
498
|
+
if (E !== "line" && !T) throw Error("Lilt IndicatorChartCard candles need open, high and low fields.");
|
|
499
|
+
let D = JSON.stringify(l), O = JSON.stringify(u), A = k(() => ue(l), [D]), j = k(() => de(u), [O]);
|
|
500
|
+
if (j.some((e) => e.kind === "volume") && !a) throw Error("Lilt IndicatorChartCard needs a `volume` field for a volume pane.");
|
|
501
|
+
let L = k(() => v ? fe(v, e, A, j) : void 0, [
|
|
502
|
+
v,
|
|
502
503
|
e,
|
|
503
504
|
A,
|
|
504
505
|
j
|
|
505
|
-
]), R = k(() =>
|
|
506
|
+
]), R = k(() => y?.map((n) => ({
|
|
506
507
|
...n,
|
|
507
508
|
data: fe(n.data, e, A, j),
|
|
508
509
|
delta: n.delta ?? (t ? q(n.data, t, e) : void 0)
|
|
509
510
|
})), [
|
|
510
|
-
|
|
511
|
+
y,
|
|
511
512
|
e,
|
|
512
513
|
t,
|
|
513
514
|
A,
|
|
514
515
|
j
|
|
515
|
-
]), z = k(() => S
|
|
516
|
+
]), z = k(() => h(S, x).full, [S, JSON.stringify(x)]), B = k(() => h(S, { maximumFractionDigits: 2 }).full, [S]), V = k(() => h(S).compact, [S]), H = T ? {
|
|
516
517
|
open: {
|
|
517
518
|
label: "Open",
|
|
518
519
|
accessor: (e) => Q(e, t)
|
|
@@ -523,10 +524,10 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
523
524
|
},
|
|
524
525
|
low: {
|
|
525
526
|
label: "Low",
|
|
526
|
-
accessor: (e) => Q(e,
|
|
527
|
+
accessor: (e) => Q(e, r)
|
|
527
528
|
}
|
|
528
|
-
} : void 0, U = new Map(A.map((e) => [e.id, e])), K =
|
|
529
|
-
let
|
|
529
|
+
} : void 0, U = new Map(A.map((e) => [e.id, e])), K = v?.length ? Q(v[0], e) : null, te = v?.length ? Q(v.at(-1), e) : null, ne = K === null || te === null || te >= K, J = j.at(-1)?.id, Y = (n, r) => {
|
|
530
|
+
let c = n.id === J, l = (e) => (t) => Q(t, e), u = (e, t, n) => {
|
|
530
531
|
let r = Q(e, t);
|
|
531
532
|
return /* @__PURE__ */ P("span", {
|
|
532
533
|
className: "lilt-card__pane-value",
|
|
@@ -535,14 +536,14 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
535
536
|
};
|
|
536
537
|
if (n.kind === "volume") return /* @__PURE__ */ N(G, {
|
|
537
538
|
context: r,
|
|
538
|
-
label: `${
|
|
539
|
+
label: `${w.title} volume`,
|
|
539
540
|
caption: "Volume",
|
|
540
541
|
readout: (e) => /* @__PURE__ */ N("span", {
|
|
541
542
|
className: "lilt-card__pane-value",
|
|
542
|
-
children: Q(e,
|
|
543
|
+
children: Q(e, a) === null ? "—" : V(Q(e, a))
|
|
543
544
|
}),
|
|
544
|
-
height:
|
|
545
|
-
xAxis:
|
|
545
|
+
height: C,
|
|
546
|
+
xAxis: c,
|
|
546
547
|
y: {
|
|
547
548
|
includeZero: !0,
|
|
548
549
|
ticks: 2,
|
|
@@ -552,20 +553,20 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
552
553
|
series: [{
|
|
553
554
|
id: "volume",
|
|
554
555
|
label: "Volume",
|
|
555
|
-
accessor:
|
|
556
|
+
accessor: l(a),
|
|
556
557
|
formatValue: V,
|
|
557
558
|
colorAt: (n) => (Q(n, e) ?? 0) >= (Q(n, t) ?? Q(n, e) ?? 0) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
|
|
558
559
|
bar: { radius: 1 }
|
|
559
560
|
}],
|
|
560
|
-
children: /* @__PURE__ */ N(
|
|
561
|
+
children: /* @__PURE__ */ N(s, { series: "volume" })
|
|
561
562
|
}, n.id);
|
|
562
563
|
if (n.kind === "rsi") return /* @__PURE__ */ P(G, {
|
|
563
564
|
context: r,
|
|
564
|
-
label: `${
|
|
565
|
+
label: `${w.title} RSI ${n.period}`,
|
|
565
566
|
caption: `RSI ${n.period}`,
|
|
566
|
-
readout: (e) =>
|
|
567
|
-
height:
|
|
568
|
-
xAxis:
|
|
567
|
+
readout: (e) => u(e, n.id),
|
|
568
|
+
height: C,
|
|
569
|
+
xAxis: c,
|
|
569
570
|
y: {
|
|
570
571
|
domain: [0, 100],
|
|
571
572
|
ticks: 2,
|
|
@@ -574,64 +575,64 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
574
575
|
series: [{
|
|
575
576
|
id: n.id,
|
|
576
577
|
label: `RSI ${n.period}`,
|
|
577
|
-
accessor:
|
|
578
|
+
accessor: l(n.id),
|
|
578
579
|
color: "var(--lilt-series-1)",
|
|
579
580
|
formatValue: B,
|
|
580
581
|
line: { width: 1.5 }
|
|
581
582
|
}],
|
|
582
583
|
children: [
|
|
583
|
-
/* @__PURE__ */ N(
|
|
584
|
+
/* @__PURE__ */ N(o, {
|
|
584
585
|
axis: "y",
|
|
585
586
|
from: 30,
|
|
586
587
|
to: 70,
|
|
587
588
|
color: "var(--lilt-series-1)"
|
|
588
589
|
}),
|
|
589
|
-
/* @__PURE__ */ N(
|
|
590
|
+
/* @__PURE__ */ N(f, {
|
|
590
591
|
value: 70,
|
|
591
592
|
color: "var(--lilt-muted)"
|
|
592
593
|
}),
|
|
593
|
-
/* @__PURE__ */ N(
|
|
594
|
+
/* @__PURE__ */ N(f, {
|
|
594
595
|
value: 30,
|
|
595
596
|
color: "var(--lilt-muted)"
|
|
596
597
|
}),
|
|
597
598
|
/* @__PURE__ */ N(i, { series: n.id })
|
|
598
599
|
]
|
|
599
600
|
}, n.id);
|
|
600
|
-
let
|
|
601
|
+
let d = `${n.id}Macd`, p = `${n.id}Signal`, m = `${n.id}Histogram`;
|
|
601
602
|
return /* @__PURE__ */ P(G, {
|
|
602
603
|
context: r,
|
|
603
|
-
label: `${
|
|
604
|
+
label: `${w.title} MACD`,
|
|
604
605
|
caption: `MACD ${n.fast} · ${n.slow} · ${n.signal}`,
|
|
605
|
-
readout: (e) => [
|
|
606
|
-
height:
|
|
607
|
-
xAxis:
|
|
606
|
+
readout: (e) => [u(e, d), u(e, p, "Signal")],
|
|
607
|
+
height: C,
|
|
608
|
+
xAxis: c,
|
|
608
609
|
y: {
|
|
609
610
|
includeZero: !0,
|
|
610
611
|
ticks: 2,
|
|
611
612
|
format: B
|
|
612
613
|
},
|
|
613
|
-
bars: { series: [
|
|
614
|
+
bars: { series: [m] },
|
|
614
615
|
series: [
|
|
615
616
|
{
|
|
616
|
-
id:
|
|
617
|
+
id: m,
|
|
617
618
|
label: "Histogram",
|
|
618
|
-
accessor:
|
|
619
|
+
accessor: l(m),
|
|
619
620
|
formatValue: B,
|
|
620
|
-
colorAt: (e) => (Q(e,
|
|
621
|
+
colorAt: (e) => (Q(e, m) ?? 0) >= 0 ? "color-mix(in srgb, var(--lilt-candle-up) 55%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 55%, transparent)",
|
|
621
622
|
bar: { radius: 1 }
|
|
622
623
|
},
|
|
623
624
|
{
|
|
624
|
-
id:
|
|
625
|
+
id: d,
|
|
625
626
|
label: "MACD",
|
|
626
|
-
accessor:
|
|
627
|
+
accessor: l(d),
|
|
627
628
|
color: "var(--lilt-series-4)",
|
|
628
629
|
formatValue: B,
|
|
629
630
|
line: { width: 1.5 }
|
|
630
631
|
},
|
|
631
632
|
{
|
|
632
|
-
id:
|
|
633
|
+
id: p,
|
|
633
634
|
label: "Signal",
|
|
634
|
-
accessor:
|
|
635
|
+
accessor: l(p),
|
|
635
636
|
color: "var(--lilt-series-3)",
|
|
636
637
|
formatValue: B,
|
|
637
638
|
line: {
|
|
@@ -641,27 +642,27 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
641
642
|
}
|
|
642
643
|
],
|
|
643
644
|
children: [
|
|
644
|
-
/* @__PURE__ */ N(
|
|
645
|
-
/* @__PURE__ */ N(i, { series:
|
|
646
|
-
/* @__PURE__ */ N(i, { series:
|
|
645
|
+
/* @__PURE__ */ N(s, { series: m }),
|
|
646
|
+
/* @__PURE__ */ N(i, { series: d }),
|
|
647
|
+
/* @__PURE__ */ N(i, { series: p })
|
|
647
648
|
]
|
|
648
649
|
}, n.id);
|
|
649
650
|
};
|
|
650
|
-
return /* @__PURE__ */ N(
|
|
651
|
-
...
|
|
651
|
+
return /* @__PURE__ */ N(g, {
|
|
652
|
+
...w,
|
|
652
653
|
data: L,
|
|
653
654
|
ranges: R,
|
|
654
|
-
delta:
|
|
655
|
-
valueFormat:
|
|
656
|
-
locale:
|
|
655
|
+
delta: b ?? (v && t ? q(v, t, e) : void 0),
|
|
656
|
+
valueFormat: x,
|
|
657
|
+
locale: S,
|
|
657
658
|
aggregate: "last",
|
|
658
659
|
headlineSeries: e,
|
|
659
660
|
pillSeries: e,
|
|
660
661
|
tiles: !1,
|
|
661
|
-
live:
|
|
662
|
+
live: m,
|
|
662
663
|
series: [{
|
|
663
664
|
key: e,
|
|
664
|
-
label:
|
|
665
|
+
label: d,
|
|
665
666
|
color: E === "line" ? ne ? F : I : void 0
|
|
666
667
|
}, ...A.map((e, t) => ({
|
|
667
668
|
key: e.id,
|
|
@@ -670,9 +671,9 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
670
671
|
}))],
|
|
671
672
|
shape: {
|
|
672
673
|
kind: "marks",
|
|
673
|
-
id: `indicator:${E}:${
|
|
674
|
+
id: `indicator:${E}:${p}:${t}:${n}:${r}:${D}:${O}`,
|
|
674
675
|
includeZero: !1,
|
|
675
|
-
scale:
|
|
676
|
+
scale: p,
|
|
676
677
|
slots: !0,
|
|
677
678
|
xAxis: j.length === 0,
|
|
678
679
|
series: (e) => {
|
|
@@ -699,10 +700,10 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
699
700
|
line: { width: 2 }
|
|
700
701
|
} : { fields: H };
|
|
701
702
|
},
|
|
702
|
-
describe:
|
|
703
|
+
describe: T ? ee(z) : void 0,
|
|
703
704
|
draw: (e) => e.map((e) => {
|
|
704
705
|
let t = U.get(e);
|
|
705
|
-
return t ? t.kind === "bollinger" ? [/* @__PURE__ */ N(
|
|
706
|
+
return t ? t.kind === "bollinger" ? [/* @__PURE__ */ N(_, {
|
|
706
707
|
series: e,
|
|
707
708
|
lower: "lower",
|
|
708
709
|
upper: "upper"
|
|
@@ -721,7 +722,7 @@ function he({ close: e, open: t, high: n, low: a, volume: o, display: s, overlay
|
|
|
721
722
|
//#endregion
|
|
722
723
|
//#region src/finance/cards/depth-chart-card.tsx
|
|
723
724
|
function ge({ price: e, label: t }) {
|
|
724
|
-
let { snapshot: n } =
|
|
725
|
+
let { snapshot: n } = x();
|
|
725
726
|
if (e < n.xDomain[0] || e > n.xDomain[1]) return null;
|
|
726
727
|
let r = n.xToPixel(e);
|
|
727
728
|
return /* @__PURE__ */ P("g", {
|
|
@@ -748,11 +749,11 @@ var _e = {
|
|
|
748
749
|
minimumFractionDigits: 2,
|
|
749
750
|
maximumFractionDigits: 2
|
|
750
751
|
};
|
|
751
|
-
function ve({ title:
|
|
752
|
-
let A = k(() => le(
|
|
752
|
+
function ve({ title: t, bids: r, asks: a, valueFormat: o = _e, sizeFormat: s, locale: l = "en-US", height: u = 220, axis: f = "minimal", background: g = "dots", hoverStyle: _ = "soft", surface: v, numberStyle: y, loading: b = !1, motion: x, className: S, style: O }) {
|
|
753
|
+
let A = k(() => le(r, a), [r, a]), M = JSON.stringify(o), L = JSON.stringify(s ?? null), R = k(() => h(l, o), [l, M]), z = k(() => h(l, s), [l, L]), B = k(() => h(l, {
|
|
753
754
|
style: "percent",
|
|
754
755
|
maximumFractionDigits: 3
|
|
755
|
-
}).full, [
|
|
756
|
+
}).full, [l]), [V, H] = j(null), U = k(() => [{
|
|
756
757
|
id: "bid",
|
|
757
758
|
label: "Bids",
|
|
758
759
|
accessor: (e) => e.bid,
|
|
@@ -771,45 +772,45 @@ function ve({ title: e, bids: t, asks: r, valueFormat: a = _e, sizeFormat: o, lo
|
|
|
771
772
|
line: { width: 1.5 },
|
|
772
773
|
formatValue: z.full
|
|
773
774
|
}], [z]), W = A.spread !== null && A.mid ? `${R.full(A.spread)} (${B(A.spread / A.mid)})` : "—", G = V ? V.bid ?? V.ask : null;
|
|
774
|
-
return /* @__PURE__ */ P(
|
|
775
|
-
"aria-label":
|
|
776
|
-
surface:
|
|
777
|
-
numberStyle:
|
|
778
|
-
motion:
|
|
779
|
-
className: ["lilt-card--depth",
|
|
775
|
+
return /* @__PURE__ */ P(D, {
|
|
776
|
+
"aria-label": t,
|
|
777
|
+
surface: v,
|
|
778
|
+
numberStyle: y,
|
|
779
|
+
motion: x,
|
|
780
|
+
className: ["lilt-card--depth", S].filter(Boolean).join(" "),
|
|
780
781
|
style: O,
|
|
781
782
|
children: [
|
|
782
|
-
/* @__PURE__ */ P(
|
|
783
|
+
/* @__PURE__ */ P(E, { children: [/* @__PURE__ */ N(T, { children: t }), /* @__PURE__ */ N(w, {
|
|
783
784
|
value: A.mid,
|
|
784
785
|
format: R.full,
|
|
785
|
-
loading:
|
|
786
|
-
motion:
|
|
787
|
-
children:
|
|
786
|
+
loading: b,
|
|
787
|
+
motion: x,
|
|
788
|
+
children: b ? null : V && G !== null ? /* @__PURE__ */ P(C, { children: [
|
|
788
789
|
z.full(G),
|
|
789
790
|
" ",
|
|
790
791
|
V.side === "bid" ? "bid" : "ask",
|
|
791
792
|
" depth at",
|
|
792
793
|
" ",
|
|
793
794
|
R.full(V.price)
|
|
794
|
-
] }) : /* @__PURE__ */ N(
|
|
795
|
+
] }) : /* @__PURE__ */ N(C, { children: "Mid price" })
|
|
795
796
|
})] }),
|
|
796
797
|
/* @__PURE__ */ P("dl", {
|
|
797
798
|
className: "lilt-card__stats",
|
|
798
799
|
children: [
|
|
799
|
-
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("dt", { children: "Spread" }), /* @__PURE__ */ N("dd", { children:
|
|
800
|
+
/* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("dt", { children: "Spread" }), /* @__PURE__ */ N("dd", { children: b ? "—" : W })] }),
|
|
800
801
|
/* @__PURE__ */ P("div", {
|
|
801
802
|
"data-side": "bid",
|
|
802
|
-
children: [/* @__PURE__ */ N("dt", { children: "Bid depth" }), /* @__PURE__ */ N("dd", { children:
|
|
803
|
+
children: [/* @__PURE__ */ N("dt", { children: "Bid depth" }), /* @__PURE__ */ N("dd", { children: b ? "—" : z.compact(A.bidDepth) })]
|
|
803
804
|
}),
|
|
804
805
|
/* @__PURE__ */ P("div", {
|
|
805
806
|
"data-side": "ask",
|
|
806
|
-
children: [/* @__PURE__ */ N("dt", { children: "Ask depth" }), /* @__PURE__ */ N("dd", { children:
|
|
807
|
+
children: [/* @__PURE__ */ N("dt", { children: "Ask depth" }), /* @__PURE__ */ N("dd", { children: b ? "—" : z.compact(A.askDepth) })]
|
|
807
808
|
})
|
|
808
809
|
]
|
|
809
810
|
}),
|
|
810
|
-
/* @__PURE__ */ N(
|
|
811
|
+
/* @__PURE__ */ N(n, {
|
|
811
812
|
className: "lilt-card__chart",
|
|
812
|
-
"aria-label": `${
|
|
813
|
+
"aria-label": `${t} depth by price`,
|
|
813
814
|
data: A.levels,
|
|
814
815
|
x: {
|
|
815
816
|
type: "number",
|
|
@@ -823,13 +824,13 @@ function ve({ title: e, bids: t, asks: r, valueFormat: a = _e, sizeFormat: o, lo
|
|
|
823
824
|
},
|
|
824
825
|
series: U,
|
|
825
826
|
onSelectionChange: (e) => H(e?.row ?? null),
|
|
826
|
-
motion:
|
|
827
|
-
status:
|
|
828
|
-
children: /* @__PURE__ */ P(
|
|
829
|
-
height:
|
|
830
|
-
axis:
|
|
831
|
-
background:
|
|
832
|
-
pill:
|
|
827
|
+
motion: x,
|
|
828
|
+
status: b ? "loading" : "ready",
|
|
829
|
+
children: /* @__PURE__ */ P(e, {
|
|
830
|
+
height: u,
|
|
831
|
+
axis: f,
|
|
832
|
+
background: g,
|
|
833
|
+
pill: _,
|
|
833
834
|
margins: {
|
|
834
835
|
top: 8,
|
|
835
836
|
right: 4,
|
|
@@ -837,17 +838,17 @@ function ve({ title: e, bids: t, asks: r, valueFormat: a = _e, sizeFormat: o, lo
|
|
|
837
838
|
left: 4
|
|
838
839
|
},
|
|
839
840
|
children: [
|
|
840
|
-
/* @__PURE__ */ N(
|
|
841
|
-
/* @__PURE__ */ N(
|
|
842
|
-
/* @__PURE__ */ N(
|
|
841
|
+
/* @__PURE__ */ N(c, { pattern: "lines" }),
|
|
842
|
+
/* @__PURE__ */ N(d, { series: "bid" }),
|
|
843
|
+
/* @__PURE__ */ N(d, { series: "ask" }),
|
|
843
844
|
/* @__PURE__ */ N(i, { series: "bid" }),
|
|
844
845
|
/* @__PURE__ */ N(i, { series: "ask" }),
|
|
845
846
|
A.mid === null ? null : /* @__PURE__ */ N(ge, {
|
|
846
847
|
price: A.mid,
|
|
847
848
|
label: `Mid ${R.full(A.mid)}`
|
|
848
849
|
}),
|
|
849
|
-
/* @__PURE__ */ N(
|
|
850
|
-
/* @__PURE__ */ N(
|
|
850
|
+
/* @__PURE__ */ N(m, { labels: "fit" }),
|
|
851
|
+
/* @__PURE__ */ N(p, {})
|
|
851
852
|
]
|
|
852
853
|
})
|
|
853
854
|
})
|
|
@@ -865,7 +866,7 @@ function ye(e, t, n) {
|
|
|
865
866
|
let r = e.at(-1), i = $(r, t), a = $(r, n);
|
|
866
867
|
return i !== null && a ? i / a - 1 : void 0;
|
|
867
868
|
}
|
|
868
|
-
function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale:
|
|
869
|
+
function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale: l = "en-US", ...u }) {
|
|
869
870
|
let f = o ?? s?.[0]?.data ?? [], p = k(() => s?.map((n) => ({
|
|
870
871
|
...n,
|
|
871
872
|
delta: n.delta ?? ye(n.data, e, t)
|
|
@@ -873,20 +874,20 @@ function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdown
|
|
|
873
874
|
s,
|
|
874
875
|
e,
|
|
875
876
|
t
|
|
876
|
-
]), m = k(() =>
|
|
877
|
+
]), m = k(() => h(l, {
|
|
877
878
|
style: "percent",
|
|
878
879
|
minimumFractionDigits: 1,
|
|
879
880
|
maximumFractionDigits: 1
|
|
880
|
-
}).full, [
|
|
881
|
+
}).full, [l]), _ = k(() => {
|
|
881
882
|
let t = oe(f.map((t) => $(t, e))).filter((e) => e !== null);
|
|
882
883
|
return t.length ? Math.min(...t) : null;
|
|
883
884
|
}, [f, e]);
|
|
884
|
-
return /* @__PURE__ */ N(
|
|
885
|
-
...
|
|
885
|
+
return /* @__PURE__ */ N(g, {
|
|
886
|
+
...u,
|
|
886
887
|
data: o,
|
|
887
888
|
ranges: p,
|
|
888
889
|
delta: c ?? (o ? ye(o, e, t) : void 0),
|
|
889
|
-
locale:
|
|
890
|
+
locale: l,
|
|
890
891
|
aggregate: "last",
|
|
891
892
|
headlineSeries: e,
|
|
892
893
|
pillSeries: e,
|
|
@@ -912,20 +913,20 @@ function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdown
|
|
|
912
913
|
area: { treatment: "fade" },
|
|
913
914
|
curve: "monotone"
|
|
914
915
|
},
|
|
915
|
-
draw: (e) => e.map((e) => [/* @__PURE__ */ N(
|
|
916
|
+
draw: (e) => e.map((e) => [/* @__PURE__ */ N(d, { series: e }, `area-${e}`), /* @__PURE__ */ N(i, { series: e }, e)])
|
|
916
917
|
},
|
|
917
918
|
panes: r ? (t) => {
|
|
918
919
|
let n = oe(t.data.map((t) => $(t, e))), r = new Map(t.data.map((e, t) => [e, n[t] ?? null]));
|
|
919
920
|
return /* @__PURE__ */ P(G, {
|
|
920
921
|
context: t,
|
|
921
|
-
label: `${
|
|
922
|
+
label: `${u.title} drawdown`,
|
|
922
923
|
caption: "Drawdown",
|
|
923
924
|
readout: (e) => /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("span", {
|
|
924
925
|
className: "lilt-card__pane-value",
|
|
925
926
|
children: r.get(e) == null ? "—" : m(r.get(e))
|
|
926
|
-
}),
|
|
927
|
+
}), _ === null ? null : /* @__PURE__ */ P("span", {
|
|
927
928
|
className: "lilt-card__pane-value",
|
|
928
|
-
children: ["Max ", m(
|
|
929
|
+
children: ["Max ", m(_)]
|
|
929
930
|
})] }),
|
|
930
931
|
height: a,
|
|
931
932
|
xAxis: !0,
|
|
@@ -944,7 +945,7 @@ function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdown
|
|
|
944
945
|
line: { width: 1.5 },
|
|
945
946
|
curve: "monotone"
|
|
946
947
|
}],
|
|
947
|
-
children: [/* @__PURE__ */ N(
|
|
948
|
+
children: [/* @__PURE__ */ N(d, { series: "drawdown" }), /* @__PURE__ */ N(i, { series: "drawdown" })]
|
|
948
949
|
});
|
|
949
950
|
} : void 0
|
|
950
951
|
});
|
|
@@ -973,28 +974,28 @@ var we = {
|
|
|
973
974
|
minimumFractionDigits: 2,
|
|
974
975
|
maximumFractionDigits: 2
|
|
975
976
|
};
|
|
976
|
-
function Te({ price: e, symbol: t, name: n, icon: r, display: a = "area", versus: o, data: s, ranges: c, delta: u, valueFormat:
|
|
977
|
-
let
|
|
977
|
+
function Te({ price: e, symbol: t, name: n, icon: r, display: a = "area", versus: o, data: s, ranges: c, delta: u, valueFormat: f = we, locale: p = "en-US", title: m, ..._ }) {
|
|
978
|
+
let v = !!o?.length, y = k(() => [e, ...(o ?? []).map((e) => e.key)], [e, o]), b = k(() => s ? v ? Ce(s, y) : s : void 0, [
|
|
978
979
|
s,
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
]),
|
|
980
|
+
v,
|
|
981
|
+
y
|
|
982
|
+
]), x = k(() => c?.map((t) => {
|
|
982
983
|
let n = Se(t.data, e);
|
|
983
984
|
return {
|
|
984
985
|
...t,
|
|
985
|
-
data:
|
|
986
|
+
data: v ? Ce(t.data, y) : t.data,
|
|
986
987
|
delta: t.delta ?? (n && n.first ? n.last / n.first - 1 : void 0)
|
|
987
988
|
};
|
|
988
989
|
}), [
|
|
989
990
|
c,
|
|
990
|
-
|
|
991
|
-
|
|
991
|
+
v,
|
|
992
|
+
y,
|
|
992
993
|
e
|
|
993
|
-
]),
|
|
994
|
+
]), S = Se(s ?? c?.[0]?.data ?? [], e), C = !S || S.last >= S.first, w = k(() => h(p, f).full, [p, JSON.stringify(f)]), T = k(() => h(p, {
|
|
994
995
|
style: "percent",
|
|
995
996
|
minimumFractionDigits: 1,
|
|
996
997
|
maximumFractionDigits: 1
|
|
997
|
-
}).full, [
|
|
998
|
+
}).full, [p]), E = (e) => v ? `__rebased${e}` : e, D = /* @__PURE__ */ P("span", {
|
|
998
999
|
className: "lilt-card__ticker",
|
|
999
1000
|
children: [
|
|
1000
1001
|
r ? /* @__PURE__ */ N("span", {
|
|
@@ -1003,7 +1004,7 @@ function Te({ price: e, symbol: t, name: n, icon: r, display: a = "area", versus
|
|
|
1003
1004
|
}) : null,
|
|
1004
1005
|
/* @__PURE__ */ N("span", {
|
|
1005
1006
|
className: "lilt-card__ticker-symbol",
|
|
1006
|
-
children: t ??
|
|
1007
|
+
children: t ?? m
|
|
1007
1008
|
}),
|
|
1008
1009
|
n ? /* @__PURE__ */ N("span", {
|
|
1009
1010
|
className: "lilt-card__ticker-name",
|
|
@@ -1011,46 +1012,46 @@ function Te({ price: e, symbol: t, name: n, icon: r, display: a = "area", versus
|
|
|
1011
1012
|
}) : null
|
|
1012
1013
|
]
|
|
1013
1014
|
});
|
|
1014
|
-
return /* @__PURE__ */ N(
|
|
1015
|
-
...
|
|
1016
|
-
title:
|
|
1015
|
+
return /* @__PURE__ */ N(g, {
|
|
1016
|
+
..._,
|
|
1017
|
+
title: m,
|
|
1017
1018
|
heading: D,
|
|
1018
|
-
data:
|
|
1019
|
-
ranges:
|
|
1020
|
-
delta:
|
|
1021
|
-
valueFormat:
|
|
1019
|
+
data: b,
|
|
1020
|
+
ranges: x,
|
|
1021
|
+
delta: v ? void 0 : u ?? (s && S && S.first ? S.last / S.first - 1 : void 0),
|
|
1022
|
+
valueFormat: v ? {
|
|
1022
1023
|
style: "percent",
|
|
1023
1024
|
maximumFractionDigits: 1
|
|
1024
|
-
} :
|
|
1025
|
-
formatValue:
|
|
1026
|
-
locale:
|
|
1025
|
+
} : f,
|
|
1026
|
+
formatValue: v ? (e) => l(T)(e) : void 0,
|
|
1027
|
+
locale: p,
|
|
1027
1028
|
aggregate: "last",
|
|
1028
1029
|
headlineSeries: E(e),
|
|
1029
|
-
pillSeries:
|
|
1030
|
-
tiles:
|
|
1031
|
-
restCaption:
|
|
1030
|
+
pillSeries: v ? "nearest" : E(e),
|
|
1031
|
+
tiles: v,
|
|
1032
|
+
restCaption: v ? void 0 : (t) => {
|
|
1032
1033
|
let n = Se(t, e);
|
|
1033
|
-
return n ?
|
|
1034
|
+
return n ? l(w)(n.last - n.first) : null;
|
|
1034
1035
|
},
|
|
1035
1036
|
series: [{
|
|
1036
1037
|
key: E(e),
|
|
1037
|
-
label: t ??
|
|
1038
|
-
color:
|
|
1038
|
+
label: t ?? m,
|
|
1039
|
+
color: v ? void 0 : C ? F : I
|
|
1039
1040
|
}, ...(o ?? []).map((e) => ({
|
|
1040
1041
|
...e,
|
|
1041
1042
|
key: E(e.key)
|
|
1042
1043
|
}))],
|
|
1043
1044
|
shape: {
|
|
1044
1045
|
kind: "marks",
|
|
1045
|
-
id: `price:${a}:${
|
|
1046
|
-
includeZero:
|
|
1047
|
-
series: () => a === "area" && !
|
|
1046
|
+
id: `price:${a}:${y.join()}:${v}`,
|
|
1047
|
+
includeZero: v,
|
|
1048
|
+
series: () => a === "area" && !v ? {
|
|
1048
1049
|
area: { treatment: "fade" },
|
|
1049
1050
|
curve: "monotone"
|
|
1050
1051
|
} : { curve: "monotone" },
|
|
1051
|
-
draw: (e) => e.map((e) => a === "area" && !
|
|
1052
|
+
draw: (e) => e.map((e) => a === "area" && !v ? [/* @__PURE__ */ N(d, { series: e }, `area-${e}`), /* @__PURE__ */ N(i, { series: e }, e)] : /* @__PURE__ */ N(i, { series: e }, e))
|
|
1052
1053
|
},
|
|
1053
|
-
bleed:
|
|
1054
|
+
bleed: _.bleed ?? !0
|
|
1054
1055
|
});
|
|
1055
1056
|
}
|
|
1056
1057
|
//#endregion
|
|
@@ -1083,13 +1084,13 @@ function De(e, t) {
|
|
|
1083
1084
|
function Oe({ title: e, bids: t, asks: n, depth: r = 8, valueFormat: i = {
|
|
1084
1085
|
minimumFractionDigits: 2,
|
|
1085
1086
|
maximumFractionDigits: 2
|
|
1086
|
-
}, sizeFormat: a, locale:
|
|
1087
|
-
let
|
|
1087
|
+
}, sizeFormat: a, locale: o = "en-US", flash: s = !0, surface: c, motion: l, className: u, style: d }) {
|
|
1088
|
+
let f = S(l ?? "auto"), p = JSON.stringify(i), m = JSON.stringify(a ?? null), g = k(() => h(o, i).full, [o, p]), _ = k(() => h(o, a).compact, [o, m]), v = k(() => h(o, {
|
|
1088
1089
|
style: "percent",
|
|
1089
1090
|
maximumFractionDigits: 3
|
|
1090
|
-
}).full, [
|
|
1091
|
-
value:
|
|
1092
|
-
mid: (
|
|
1091
|
+
}).full, [o]), y = k(() => Ee(t, "bid", r), [t, r]), b = k(() => Ee(n, "ask", r), [n, r]), x = De(k(() => [...b, ...y], [b, y]), s && !f), C = Math.max(1, b.at(-1)?.total ?? 0, y.at(-1)?.total ?? 0), w = y[0]?.price, T = b[0]?.price, E = w !== void 0 && T !== void 0 ? {
|
|
1092
|
+
value: T - w,
|
|
1093
|
+
mid: (T + w) / 2
|
|
1093
1094
|
} : null, O = (e) => /* @__PURE__ */ P("tr", {
|
|
1094
1095
|
className: "lilt-order-book__level",
|
|
1095
1096
|
"data-side": e.side,
|
|
@@ -1104,12 +1105,12 @@ function Oe({ title: e, bids: t, asks: n, depth: r = 8, valueFormat: i = {
|
|
|
1104
1105
|
/* @__PURE__ */ N("td", { children: _(e.total) })
|
|
1105
1106
|
]
|
|
1106
1107
|
}, `${e.side}:${e.price}`);
|
|
1107
|
-
return /* @__PURE__ */ N(
|
|
1108
|
+
return /* @__PURE__ */ N(D, {
|
|
1108
1109
|
"aria-label": e,
|
|
1109
|
-
surface:
|
|
1110
|
-
motion:
|
|
1111
|
-
className: ["lilt-card--order-book",
|
|
1112
|
-
style:
|
|
1110
|
+
surface: c,
|
|
1111
|
+
motion: l,
|
|
1112
|
+
className: ["lilt-card--order-book", u].filter(Boolean).join(" "),
|
|
1113
|
+
style: d,
|
|
1113
1114
|
children: /* @__PURE__ */ P("table", {
|
|
1114
1115
|
className: "lilt-order-book",
|
|
1115
1116
|
children: [
|
|
@@ -1138,10 +1139,10 @@ function Oe({ title: e, bids: t, asks: n, depth: r = 8, valueFormat: i = {
|
|
|
1138
1139
|
className: "lilt-order-book__spread",
|
|
1139
1140
|
children: [/* @__PURE__ */ N("th", {
|
|
1140
1141
|
scope: "row",
|
|
1141
|
-
children:
|
|
1142
|
+
children: E ? g(E.mid) : "—"
|
|
1142
1143
|
}), /* @__PURE__ */ N("td", {
|
|
1143
1144
|
colSpan: 2,
|
|
1144
|
-
children:
|
|
1145
|
+
children: E ? `Spread ${g(E.value)} · ${v(E.value / E.mid)}` : "No spread"
|
|
1145
1146
|
})]
|
|
1146
1147
|
})
|
|
1147
1148
|
}),
|