@lilt-ui/charts 0.1.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 +69 -0
- package/README.md +120 -0
- package/dist/analysis-BJRmXHOB.js +62 -0
- package/dist/cards/area-chart-card.d.ts +10 -1
- package/dist/cards/box-plot-card.d.ts +30 -0
- package/dist/cards/cartesian-card.d.ts +86 -6
- package/dist/cards/chart-card.d.ts +12 -1
- package/dist/cards/line-chart-card.d.ts +10 -1
- package/dist/cards/range-chart-card.d.ts +28 -0
- package/dist/cartesian-card-Dcd0ZnQL.js +7004 -0
- package/dist/chart-context.d.ts +18 -0
- package/dist/chart-data-CCwLQeXa.js +44 -0
- package/dist/chart.d.ts +3 -1
- package/dist/data.js +3 -2
- package/dist/engine/box.d.ts +18 -0
- package/dist/engine/domains.d.ts +2 -0
- package/dist/engine/geometry.d.ts +2 -1
- package/dist/engine/normalize.d.ts +2 -4
- package/dist/engine/ranges.d.ts +59 -0
- package/dist/finance/candle-geometry.d.ts +55 -0
- package/dist/finance/candles.d.ts +18 -0
- package/dist/finance/cards/candlestick-chart-card.d.ts +41 -0
- package/dist/finance/cards/depth-chart-card.d.ts +32 -0
- package/dist/finance/cards/indicator-chart-card.d.ts +52 -0
- package/dist/finance/cards/pane.d.ts +24 -0
- package/dist/finance/cards/portfolio-chart-card.d.ts +22 -0
- package/dist/finance/cards/price-chart-card.d.ts +27 -0
- package/dist/finance/index.d.ts +17 -0
- package/dist/finance/indicators.d.ts +65 -0
- package/dist/finance/order-book.d.ts +26 -0
- package/dist/finance.d.ts +2 -0
- package/dist/finance.js +1158 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.js +2239 -8793
- package/dist/interaction/axis-cursor.d.ts +12 -2
- package/dist/interaction/chart-sync.d.ts +11 -1
- package/dist/interaction/field-values.d.ts +12 -0
- package/dist/interaction/inspection-layer.d.ts +10 -1
- package/dist/interaction/pin-glyphs.d.ts +8 -0
- package/dist/interaction/pin-marker.d.ts +9 -1
- package/dist/marks/contract.d.ts +49 -0
- package/dist/marks/use-range-mark.d.ts +19 -0
- package/dist/model/cartesian-model.d.ts +3 -3
- package/dist/primitives/annotations.d.ts +1 -1
- package/dist/primitives/axis-segments.d.ts +23 -0
- package/dist/primitives/box-plot.d.ts +4 -0
- package/dist/primitives/error-bar.d.ts +4 -0
- package/dist/primitives/interval-band.d.ts +2 -2
- package/dist/primitives/range-bar.d.ts +4 -0
- package/dist/report-context-Cz0AYdV2.js +895 -0
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +114 -16
- 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 +16 -2
- package/dist/analysis-BLLWEKBw.js +0 -105
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
//#region src/data/chart-data.ts
|
|
2
|
-
function e(e, t) {
|
|
3
|
-
let n = t.range;
|
|
4
|
-
if (n && (!Number.isFinite(n.startX) || !Number.isFinite(n.endX))) throw Error("Range bounds must be finite.");
|
|
5
|
-
let r = n ? Math.min(n.startX, n.endX) : -Infinity, i = n ? Math.max(n.startX, n.endX) : Infinity, a = 0, o = 0, s = 0, c = Infinity, l = -Infinity, u = Infinity, d = -Infinity, f = null, p = null, m = /* @__PURE__ */ new Set();
|
|
6
|
-
for (let n of e) {
|
|
7
|
-
let e = Number(t.x(n));
|
|
8
|
-
if (!Number.isFinite(e)) throw Error("Summary positions must be finite numbers or valid dates.");
|
|
9
|
-
if (e < r || e > i) continue;
|
|
10
|
-
if (m.has(e)) throw Error("Summary positions must be unique.");
|
|
11
|
-
m.add(e);
|
|
12
|
-
let h = t.value(n);
|
|
13
|
-
if (h !== null && (typeof h != "number" || !Number.isFinite(h))) throw Error("Summary values must be finite numbers or null.");
|
|
14
|
-
if (e < u && (u = e, f = h), e > d && (d = e, p = h), h === null) {
|
|
15
|
-
o++;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
a++, s += h, c = Math.min(c, h), l = Math.max(l, h);
|
|
19
|
-
}
|
|
20
|
-
if (!Number.isFinite(s)) throw Error("Summary total exceeds the finite numeric range.");
|
|
21
|
-
return {
|
|
22
|
-
count: a,
|
|
23
|
-
missing: o,
|
|
24
|
-
total: a ? s : null,
|
|
25
|
-
mean: a ? s / a : null,
|
|
26
|
-
min: a ? c : null,
|
|
27
|
-
max: a ? l : null,
|
|
28
|
-
first: f,
|
|
29
|
-
last: p,
|
|
30
|
-
change: f === null || p === null ? null : p - f
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function t(e, t) {
|
|
34
|
-
if (!t.length) throw Error("CSV needs at least one column.");
|
|
35
|
-
let n = (e) => {
|
|
36
|
-
if (typeof e == "number" && !Number.isFinite(e)) throw Error("CSV numbers must be finite.");
|
|
37
|
-
if (e instanceof Date && !Number.isFinite(e.getTime())) throw Error("CSV dates must be valid.");
|
|
38
|
-
let t = e === null ? "" : e instanceof Date ? e.toISOString() : String(e);
|
|
39
|
-
return typeof e == "string" && /^[\s]*[=+\-@]|^[\t\r\n]/.test(t) && (t = "'" + t), /[",\r\n]/.test(t) ? `"${t.replaceAll("\"", "\"\"")}"` : t;
|
|
40
|
-
};
|
|
41
|
-
return [t.map((e) => n(e.header)).join(","), ...e.map((e) => t.map((t) => n(t.value(e))).join(","))].join("\r\n") + "\r\n";
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/engine/ranking.ts
|
|
45
|
-
function n(e, t, n) {
|
|
46
|
-
let r = /* @__PURE__ */ new Set();
|
|
47
|
-
return e.map((e, i) => {
|
|
48
|
-
let a = t.id(e), o = t.label(e), s = n(e);
|
|
49
|
-
if (typeof a != "string" || !a.trim()) throw Error(`Invalid category at row ${i + 1}: a non-empty string ID is required.`);
|
|
50
|
-
if (r.has(a)) throw Error(`Duplicate category ID "${a}".`);
|
|
51
|
-
if (typeof o != "string" || !o.trim()) throw Error(`Invalid label for category "${a}".`);
|
|
52
|
-
if (s !== null && (typeof s != "number" || !Number.isFinite(s))) throw Error(`Invalid value for category "${a}": expected a finite number or null.`);
|
|
53
|
-
return r.add(a), {
|
|
54
|
-
id: a,
|
|
55
|
-
label: o,
|
|
56
|
-
datum: e,
|
|
57
|
-
value: s
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
function r(e, t) {
|
|
62
|
-
return t === "input" ? [...e] : [...e].sort((e, n) => {
|
|
63
|
-
if (e.value === null && n.value !== null) return 1;
|
|
64
|
-
if (n.value === null && e.value !== null) return -1;
|
|
65
|
-
let r = (e.value ?? 0) - (n.value ?? 0);
|
|
66
|
-
return r ? r * (t === "descending" ? -1 : 1) : e.id < n.id ? -1 : +(e.id > n.id);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
function i(e) {
|
|
70
|
-
let t = 0, n = 0;
|
|
71
|
-
for (let r of e) r.value !== null && (t = Math.min(t, r.value), n = Math.max(n, r.value));
|
|
72
|
-
return t === n ? [0, 1] : [t, n];
|
|
73
|
-
}
|
|
74
|
-
function a(e, t) {
|
|
75
|
-
let n = (e) => (e - t[0]) / (t[1] - t[0]) * 100, r = n(0), i = e === null ? r : n(e);
|
|
76
|
-
return {
|
|
77
|
-
zero: r,
|
|
78
|
-
left: Math.min(r, i),
|
|
79
|
-
width: Math.abs(i - r)
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
//#region src/engine/analysis.ts
|
|
84
|
-
function o(e, t) {
|
|
85
|
-
if (e !== null && (!Number.isFinite(e) || e < 0)) throw Error(`${t} must be a non-negative finite number or null.`);
|
|
86
|
-
}
|
|
87
|
-
function s(e) {
|
|
88
|
-
let t = n(e.data, e.category, e.value), r = Infinity;
|
|
89
|
-
for (let e of t) if (o(e.value, `Stage ${e.id}`), e.value !== null) {
|
|
90
|
-
if (e.value > r) throw Error(`Stage ${e.id} exceeds a preceding stage; cumulative funnel counts must not increase.`);
|
|
91
|
-
r = e.value;
|
|
92
|
-
}
|
|
93
|
-
let i = t[0]?.value;
|
|
94
|
-
return t.map((e, n) => {
|
|
95
|
-
let r = t[n - 1]?.value;
|
|
96
|
-
return {
|
|
97
|
-
...e,
|
|
98
|
-
share: e.value !== null && i != null && i > 0 ? e.value / i : null,
|
|
99
|
-
conversion: e.value !== null && r != null && r > 0 ? e.value / r : null,
|
|
100
|
-
drop: e.value !== null && r != null ? r - e.value : null
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
export { i as a, a as i, n, e as o, r, t as s, s as t };
|