@mechane-ai/elements 0.23.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{categorical-values-lk7xoiOz.js → categorical-values-CPRt9uzI.js} +2 -2
- package/dist/{chart-frame-CFEDXxpC.js → chart-frame-CNr8M_b2.js} +1 -1
- package/dist/{chart-input-BrzNr3oe.js → chart-input-DDAjzy-O.js} +1 -1
- package/dist/charts/cartesian.js +764 -585
- package/dist/charts/distribution.js +2 -2
- package/dist/charts/graph.js +2 -2
- package/dist/charts/hierarchy.js +3 -3
- package/dist/charts/matrix.js +2 -2
- package/dist/charts/timeline.js +1 -1
- package/dist/charts.js +1 -1
- package/dist/elements.css +31 -9
- package/dist/layout.js +5 -8
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +3 -1
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +2 -1
- package/dist/packages/charts/src/cartesian/time-series.d.ts +3 -1
- package/dist/packages/charts/src/chart-data.d.ts +5 -0
- package/dist/packages/charts/src/chart-frame.d.ts +1 -1
- package/dist/packages/charts/src/chart-inspection.d.ts +24 -0
- package/dist/packages/charts/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/charts/cartesian.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
import { u as e } from "../src-DHYcohZP.js";
|
|
2
|
-
import { i as t, n, r, t as i } from "../categorical-values-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
2
|
+
import { i as t, n, r, t as i } from "../categorical-values-CPRt9uzI.js";
|
|
3
|
+
import { E as a } from "../src-DLReNPV9.js";
|
|
4
|
+
import { t as o } from "../use-scroll-tab-index-Dxpdh4W7.js";
|
|
5
|
+
import { s } from "../src-d7EAi61b.js";
|
|
6
|
+
import { a as c, n as l, o as u, r as d, s as f, t as p } from "../chart-frame-CNr8M_b2.js";
|
|
7
|
+
import { n as m, r as h, t as g } from "../chart-input-DDAjzy-O.js";
|
|
8
|
+
import { t as _ } from "../plot-width--OgdohB5.js";
|
|
9
|
+
import { g as v } from "../src-CQOgWIzP.js";
|
|
10
|
+
import { r as y } from "../tokens.stylex-DTHHFbyl.js";
|
|
11
|
+
import * as b from "@stylexjs/stylex";
|
|
12
|
+
import { useEffect as ee, useId as x, useMemo as te, useRef as S, useState as C } from "react";
|
|
13
|
+
import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
|
|
14
|
+
import { scaleBand as D, scaleLinear as O } from "@visx/scale";
|
|
15
|
+
import { AreaClosed as ne, Bar as k, LinePath as A } from "@visx/shape";
|
|
14
16
|
// packages/charts/src/chart-cursor.tsx
|
|
15
|
-
function
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
+
function re({ x: e, top: t, bottom: n, width: r }) {
|
|
18
|
+
return /* @__PURE__ */ E("g", {
|
|
17
19
|
"aria-hidden": !0,
|
|
18
20
|
className: "xlshs6z xgs60n x17y187c xbabvq0 x47corl",
|
|
19
|
-
children: [/* @__PURE__ */
|
|
21
|
+
children: [/* @__PURE__ */ T("line", {
|
|
20
22
|
x1: e,
|
|
21
23
|
x2: e,
|
|
22
24
|
y1: t,
|
|
23
25
|
y2: n,
|
|
24
26
|
className: "xnpr05h x1ntoi03 x13efnbd"
|
|
25
|
-
}), /* @__PURE__ */
|
|
27
|
+
}), /* @__PURE__ */ T("line", {
|
|
26
28
|
x1: e - r / 2,
|
|
27
29
|
x2: e + r / 2,
|
|
28
30
|
y1: n + 4,
|
|
@@ -31,8 +33,165 @@ function ne({ x: e, top: t, bottom: n, width: r }) {
|
|
|
31
33
|
})]
|
|
32
34
|
});
|
|
33
35
|
}
|
|
36
|
+
// packages/charts/src/chart-data.tsx
|
|
37
|
+
function ie({ title: e, children: t }) {
|
|
38
|
+
let n = o();
|
|
39
|
+
return /* @__PURE__ */ E(s.Root, { children: [/* @__PURE__ */ T(s.Trigger, {
|
|
40
|
+
render: /* @__PURE__ */ T(a, {}),
|
|
41
|
+
children: "Chart data"
|
|
42
|
+
}), /* @__PURE__ */ E(s.Portal, { children: [/* @__PURE__ */ T(s.Backdrop, {}), /* @__PURE__ */ E(s.Popup, { children: [
|
|
43
|
+
/* @__PURE__ */ T(s.Title, { children: e }),
|
|
44
|
+
/* @__PURE__ */ T("div", {
|
|
45
|
+
ref: n.ref,
|
|
46
|
+
role: "region",
|
|
47
|
+
"aria-label": "Chart values",
|
|
48
|
+
tabIndex: n.tabIndex,
|
|
49
|
+
className: "xeuugli x1phlbz0 xysyzu8 x1we84gm",
|
|
50
|
+
children: t
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ T(s.Close, {
|
|
53
|
+
render: /* @__PURE__ */ T(a, {}),
|
|
54
|
+
children: "Close"
|
|
55
|
+
})
|
|
56
|
+
] })] })] });
|
|
57
|
+
}
|
|
58
|
+
// packages/charts/src/chart-inspection.tsx
|
|
59
|
+
var ae = {
|
|
60
|
+
kzqmXN: "x1xc55vz",
|
|
61
|
+
kZKoxP: "xdk7pt",
|
|
62
|
+
kmuXW: "x2lah0s",
|
|
63
|
+
$$css: !0
|
|
64
|
+
}, j = {
|
|
65
|
+
swatch: (e) => [
|
|
66
|
+
ae,
|
|
67
|
+
{
|
|
68
|
+
kWkggS: e == null ? e : "xl8spv7",
|
|
69
|
+
$$css: !0
|
|
70
|
+
},
|
|
71
|
+
{ "--x-backgroundColor": e ?? void 0 }
|
|
72
|
+
],
|
|
73
|
+
inspector: {
|
|
74
|
+
k1xSpc: "xrvj5dj x1boff50",
|
|
75
|
+
kOIVth: "xunmzkg",
|
|
76
|
+
kVAEAm: "x10l6tqk",
|
|
77
|
+
k87sOh: "x1ridm32",
|
|
78
|
+
kB7OPa: "x9f619",
|
|
79
|
+
kfzvcC: "x47corl",
|
|
80
|
+
kmVPX3: "x69ldcm",
|
|
81
|
+
kMzoRj: "xmkeg23",
|
|
82
|
+
ksu8eU: "x1y0btm7",
|
|
83
|
+
kVAM5u: "x1ey3b81",
|
|
84
|
+
kaIpWk: "x1ok0vyi",
|
|
85
|
+
kGVxlE: "x1ghndwu",
|
|
86
|
+
kWkggS: "xpvm0e4",
|
|
87
|
+
kMwMTN: "xbixft",
|
|
88
|
+
kGuDYH: "xy8obcc",
|
|
89
|
+
kLWn49: "xas2l8k",
|
|
90
|
+
kcqcaj: "xss6m8b",
|
|
91
|
+
kHjlTd: "xj0a0fe",
|
|
92
|
+
$$css: !0
|
|
93
|
+
},
|
|
94
|
+
position: (e, t) => [{
|
|
95
|
+
kbCHJM: e == null ? e : "xgq9j65",
|
|
96
|
+
kzqmXN: t == null ? t : "x5lhr3w",
|
|
97
|
+
$$css: !0
|
|
98
|
+
}, {
|
|
99
|
+
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
100
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
101
|
+
}]
|
|
102
|
+
};
|
|
103
|
+
function M({ title: e, detail: t }) {
|
|
104
|
+
return t === void 0 ? e : /* @__PURE__ */ E("span", {
|
|
105
|
+
"aria-label": e,
|
|
106
|
+
className: "x1lliihq xb3r6kr xlyipyv xuxw1ft",
|
|
107
|
+
children: [/* @__PURE__ */ T("span", {
|
|
108
|
+
className: "xt0psk2 x1boff50",
|
|
109
|
+
children: e
|
|
110
|
+
}), /* @__PURE__ */ T("span", {
|
|
111
|
+
className: "x1s85apg xfodcyb",
|
|
112
|
+
children: t
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function oe({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: o, width: s, offset: c = 16, source: l, notes: u = [] }) {
|
|
117
|
+
let d = Math.min(260, s), p = o > s / 2 ? o - d - c : o + c, m = Math.max(0, Math.min(s - d, p)), h = t === void 0 ? [] : [
|
|
118
|
+
t,
|
|
119
|
+
n,
|
|
120
|
+
...a.map((e) => `${e.label}: ${e.value}`),
|
|
121
|
+
...u
|
|
122
|
+
].filter((e) => e !== void 0);
|
|
123
|
+
return /* @__PURE__ */ E("div", {
|
|
124
|
+
className: "xeuugli",
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ E("div", {
|
|
127
|
+
className: "xrvj5dj xeuugli",
|
|
128
|
+
children: [i !== void 0 && /* @__PURE__ */ T("ul", {
|
|
129
|
+
"aria-hidden": !0,
|
|
130
|
+
inert: !0,
|
|
131
|
+
className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc xlshs6z x47corl",
|
|
132
|
+
children: i.map((e) => /* @__PURE__ */ E("li", {
|
|
133
|
+
className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
|
|
134
|
+
children: [/* @__PURE__ */ T("span", { ...b.props(j.swatch(f[e.tone])) }), /* @__PURE__ */ E("span", {
|
|
135
|
+
className: "xeuugli",
|
|
136
|
+
children: [e.label, /* @__PURE__ */ T("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
|
|
137
|
+
})]
|
|
138
|
+
}, e.id))
|
|
139
|
+
}), /* @__PURE__ */ T("ul", {
|
|
140
|
+
"aria-label": "Legend",
|
|
141
|
+
className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc",
|
|
142
|
+
children: r.map((e) => /* @__PURE__ */ E("li", {
|
|
143
|
+
className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
|
|
144
|
+
children: [/* @__PURE__ */ T("span", {
|
|
145
|
+
"aria-hidden": !0,
|
|
146
|
+
...b.props(j.swatch(f[e.tone]))
|
|
147
|
+
}), /* @__PURE__ */ E("span", {
|
|
148
|
+
className: "xeuugli",
|
|
149
|
+
children: [e.label, /* @__PURE__ */ T("span", {
|
|
150
|
+
className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
|
|
151
|
+
children: t === void 0 ? "" : a.find((t) => t.id === e.id)?.value ?? "—"
|
|
152
|
+
})]
|
|
153
|
+
})]
|
|
154
|
+
}, e.id))
|
|
155
|
+
})]
|
|
156
|
+
}),
|
|
157
|
+
/* @__PURE__ */ T("span", {
|
|
158
|
+
id: e,
|
|
159
|
+
"aria-live": l === "keyboard" ? "polite" : "off",
|
|
160
|
+
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xb3r6kr x1hyvwdk xuxw1ft",
|
|
161
|
+
children: h.join(" · ")
|
|
162
|
+
}),
|
|
163
|
+
t !== void 0 && /* @__PURE__ */ T("div", {
|
|
164
|
+
"aria-hidden": !0,
|
|
165
|
+
className: "x1n2onr6 xqtp20y x1vjfegm",
|
|
166
|
+
children: /* @__PURE__ */ E("div", {
|
|
167
|
+
...b.props(j.inspector, j.position(m, d)),
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ E("div", {
|
|
170
|
+
className: "x78zum5 x1qughib x1hnptsi xk4h15q",
|
|
171
|
+
children: [/* @__PURE__ */ T("span", { children: t }), n !== void 0 && /* @__PURE__ */ T("span", { children: n })]
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ T("dl", {
|
|
174
|
+
className: "xrvj5dj xunmzkg x1ghz6dp",
|
|
175
|
+
children: a.map((e) => /* @__PURE__ */ E("div", {
|
|
176
|
+
className: "x78zum5 x1qughib x1pha0wt x1hnptsi",
|
|
177
|
+
children: [/* @__PURE__ */ E("dt", {
|
|
178
|
+
className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
|
|
179
|
+
children: [/* @__PURE__ */ T("span", { ...b.props(j.swatch(f[e.tone])) }), e.label]
|
|
180
|
+
}), /* @__PURE__ */ T("dd", {
|
|
181
|
+
className: "x1ghz6dp xuxw1ft",
|
|
182
|
+
children: e.value
|
|
183
|
+
})]
|
|
184
|
+
}, e.id))
|
|
185
|
+
}),
|
|
186
|
+
u.map((e) => /* @__PURE__ */ T("span", { children: e }, e))
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
34
193
|
// packages/charts/src/cartesian/bar-data.ts
|
|
35
|
-
function
|
|
194
|
+
function se({ composition: e, series: t, categoryIds: n, domain: r }) {
|
|
36
195
|
if (e === void 0) return;
|
|
37
196
|
if (e.buckets.length !== n.length) return "Composition requires one explicit bucket per category.";
|
|
38
197
|
let i = e.annotation;
|
|
@@ -50,119 +209,128 @@ function j({ composition: e, series: t, categoryIds: n, domain: r }) {
|
|
|
50
209
|
}
|
|
51
210
|
}
|
|
52
211
|
// packages/charts/src/cartesian/composition-bars.tsx
|
|
53
|
-
var
|
|
212
|
+
var N = { mark: {
|
|
54
213
|
k3nNDw: "x1hj3fc7",
|
|
55
214
|
k1ekBW: "xwcsmn1",
|
|
56
215
|
kIyJzY: "xtitasy x12w9bfk",
|
|
57
216
|
kAMwcw: "x1faw7qm",
|
|
58
217
|
$$css: !0
|
|
59
218
|
} };
|
|
60
|
-
function
|
|
61
|
-
let d = n !== void 0,
|
|
62
|
-
function
|
|
219
|
+
function ce({ bucket: e, series: t, focusedSeries: n, index: i, x: a, width: o, y: s, isHighlighted: c, highlightedSeriesId: l }) {
|
|
220
|
+
let d = n !== void 0, p = n !== void 0 && !t.some((e) => e.id === n.id) ? [...t, n] : t;
|
|
221
|
+
function m(e, t) {
|
|
63
222
|
let n = s(t), r = s(t + e);
|
|
64
223
|
return `translateY(${Math.min(n, r)}px) scaleY(${Math.max(+(e === 0), Math.abs(r - n))})`;
|
|
65
224
|
}
|
|
66
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */ E(w, { children: [e.kind !== "gap" && /* @__PURE__ */ T("rect", {
|
|
67
226
|
x: a,
|
|
68
227
|
y: 0,
|
|
69
228
|
width: o,
|
|
70
229
|
height: 1,
|
|
71
230
|
vectorEffect: "non-scaling-stroke",
|
|
72
|
-
fill:
|
|
73
|
-
...
|
|
231
|
+
fill: f.neutral,
|
|
232
|
+
...b.props(N.mark, c && u.selected),
|
|
74
233
|
style: {
|
|
75
|
-
transform:
|
|
234
|
+
transform: m(e.total, 0),
|
|
76
235
|
opacity: d ? .18 : +(e.kind === "total")
|
|
77
236
|
}
|
|
78
|
-
}),
|
|
79
|
-
let
|
|
80
|
-
if (
|
|
81
|
-
let
|
|
82
|
-
return /* @__PURE__ */
|
|
237
|
+
}), p.map((s, p) => {
|
|
238
|
+
let h = s.values[i];
|
|
239
|
+
if (h == null) return null;
|
|
240
|
+
let g = n?.id === s.id, _ = d ? 0 : t.slice(0, p).reduce((e, t) => e + (t.values[i] ?? 0), 0), v = d ? g : e.kind === "parts", y = !d && l !== void 0 && l !== s.id;
|
|
241
|
+
return /* @__PURE__ */ T("rect", {
|
|
83
242
|
x: a,
|
|
84
243
|
y: 0,
|
|
85
244
|
width: o,
|
|
86
245
|
height: 1,
|
|
87
246
|
vectorEffect: "non-scaling-stroke",
|
|
88
|
-
fill:
|
|
89
|
-
...
|
|
247
|
+
fill: f[r(s.tone, p)],
|
|
248
|
+
...b.props(N.mark, c && u.selected),
|
|
90
249
|
style: {
|
|
91
|
-
transform:
|
|
92
|
-
opacity:
|
|
250
|
+
transform: m(h, _),
|
|
251
|
+
opacity: v ? y ? .3 : 1 : 0
|
|
93
252
|
}
|
|
94
253
|
}, s.id);
|
|
95
254
|
})] });
|
|
96
255
|
}
|
|
97
256
|
// packages/charts/src/cartesian/bar-chart.tsx
|
|
98
|
-
var
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
257
|
+
var le = {
|
|
258
|
+
plot: {
|
|
259
|
+
kqGvvJ: "x1we84gm",
|
|
260
|
+
$$css: !0
|
|
261
|
+
},
|
|
262
|
+
mutedMark: {
|
|
263
|
+
kSiTet: "xuzhngd",
|
|
264
|
+
$$css: !0
|
|
265
|
+
}
|
|
266
|
+
}, ue = /* @__PURE__ */ new Set(["Enter", " "]), P = 200;
|
|
267
|
+
function de({ title: e, description: t, series: n, layoutSeries: i, children: a, inspectionId: o, label: s, detail: c, summary: l, rows: u = [], index: f = -1, formatValue: p = String, x: m = 0, width: h = 0, offset: g, source: _, data: v }) {
|
|
268
|
+
let y = n.map((e, t) => ({
|
|
269
|
+
id: e.id,
|
|
270
|
+
label: e.label,
|
|
271
|
+
tone: r(e.tone, t)
|
|
272
|
+
})), b = i?.map((e, t) => ({
|
|
104
273
|
id: e.id,
|
|
105
274
|
label: e.label,
|
|
106
275
|
tone: r(e.tone, t)
|
|
107
276
|
}));
|
|
108
|
-
return /* @__PURE__ */
|
|
109
|
-
title:
|
|
277
|
+
return /* @__PURE__ */ E(d, {
|
|
278
|
+
title: /* @__PURE__ */ T(M, {
|
|
279
|
+
title: e,
|
|
280
|
+
detail: c
|
|
281
|
+
}),
|
|
110
282
|
description: t,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
children:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
283
|
+
actions: /* @__PURE__ */ T(ie, {
|
|
284
|
+
title: e,
|
|
285
|
+
children: v
|
|
286
|
+
}),
|
|
287
|
+
children: [/* @__PURE__ */ T(oe, {
|
|
288
|
+
id: o,
|
|
289
|
+
label: s,
|
|
290
|
+
summary: l,
|
|
291
|
+
legend: y,
|
|
292
|
+
layoutLegend: b,
|
|
293
|
+
rows: u.map((e, t) => ({
|
|
294
|
+
id: e.id,
|
|
295
|
+
label: e.label,
|
|
296
|
+
tone: r(e.tone, t),
|
|
297
|
+
value: e.values[f] === null || e.values[f] === void 0 ? "Unavailable" : p(e.values[f])
|
|
298
|
+
})),
|
|
299
|
+
x: m,
|
|
300
|
+
width: h,
|
|
301
|
+
offset: g,
|
|
302
|
+
source: _
|
|
303
|
+
}), a]
|
|
118
304
|
});
|
|
119
305
|
}
|
|
120
|
-
function
|
|
121
|
-
let a =
|
|
122
|
-
return a === void 0 ? /* @__PURE__ */
|
|
306
|
+
function F({ title: t = "Loading chart", description: n, series: r = [], height: i = P }) {
|
|
307
|
+
let a = I(i), o = x();
|
|
308
|
+
return a === void 0 ? /* @__PURE__ */ T("div", {
|
|
123
309
|
"aria-hidden": !0,
|
|
124
310
|
inert: !0,
|
|
125
|
-
children: /* @__PURE__ */
|
|
311
|
+
children: /* @__PURE__ */ T(de, {
|
|
126
312
|
title: t,
|
|
127
313
|
description: n,
|
|
128
314
|
series: r,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
/* @__PURE__ */ E("div", {
|
|
135
|
-
className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1rtsecp xy8obcc xas2l8k xss6m8b xj0a0fe",
|
|
136
|
-
children: /* @__PURE__ */ D("span", {
|
|
137
|
-
className: "x1n2onr6 xeuugli",
|
|
138
|
-
children: [/* @__PURE__ */ E("span", {
|
|
139
|
-
className: "xlshs6z",
|
|
140
|
-
children: se
|
|
141
|
-
}), /* @__PURE__ */ E("span", {
|
|
142
|
-
className: "x10l6tqk x10a8y8t",
|
|
143
|
-
children: /* @__PURE__ */ E(e, { height: "100%" })
|
|
144
|
-
})]
|
|
145
|
-
})
|
|
146
|
-
}),
|
|
147
|
-
/* @__PURE__ */ E("div", {
|
|
148
|
-
className: "xlshs6z",
|
|
149
|
-
children: /* @__PURE__ */ E(d, { children: null })
|
|
150
|
-
})
|
|
151
|
-
]
|
|
315
|
+
inspectionId: o,
|
|
316
|
+
children: /* @__PURE__ */ T("div", {
|
|
317
|
+
...b.props(u.plot, le.plot),
|
|
318
|
+
children: /* @__PURE__ */ T(e, { height: i })
|
|
319
|
+
})
|
|
152
320
|
})
|
|
153
|
-
}) : /* @__PURE__ */
|
|
321
|
+
}) : /* @__PURE__ */ T(g, {
|
|
154
322
|
title: t,
|
|
155
323
|
description: n,
|
|
156
324
|
message: a
|
|
157
325
|
});
|
|
158
326
|
}
|
|
159
|
-
function
|
|
327
|
+
function I(e) {
|
|
160
328
|
if (!Number.isFinite(e) || e < 48) return "Chart height must be at least 48 pixels.";
|
|
161
329
|
}
|
|
162
|
-
function
|
|
330
|
+
function fe({ categories: e, series: t, domain: r, mode: i }) {
|
|
163
331
|
if (e.length > n.items || t.length > n.series) return `Choose a window with at most ${n.items} categories and ${n.series} series.`;
|
|
164
|
-
if (!
|
|
165
|
-
if (!
|
|
332
|
+
if (!h(r) || r[0] > 0 || r[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
|
|
333
|
+
if (!m(e) || !m(t)) return "Bar categories and series require unique identifiers.";
|
|
166
334
|
for (let n of t) {
|
|
167
335
|
if (n.values.length !== e.length) return "Every series requires one explicit value per category.";
|
|
168
336
|
for (let e of n.values) {
|
|
@@ -172,228 +340,232 @@ function ue({ categories: e, series: t, domain: r, mode: i }) {
|
|
|
172
340
|
}
|
|
173
341
|
if (i === "stacked" && e.some((e, n) => t.reduce((e, t) => e + (t.values[n] ?? 0), 0) > r[1])) return "Stacked bar totals must fit the supplied domain.";
|
|
174
342
|
}
|
|
175
|
-
var
|
|
343
|
+
var pe = {
|
|
176
344
|
"x-default-marker": "x-default-marker",
|
|
177
345
|
$$css: !0
|
|
178
346
|
};
|
|
179
|
-
function
|
|
180
|
-
let
|
|
347
|
+
function L({ title: e, description: t, categories: n, series: a, domain: o, mode: s = "grouped", formatValue: c, formatTick: l = c, highlightedSeriesId: d, selection: p, height: m = P, composition: h }) {
|
|
348
|
+
let v = h?.focusedSeries, y = x(), te = v === void 0 ? void 0 : fe({
|
|
181
349
|
categories: n,
|
|
182
|
-
series: [
|
|
350
|
+
series: [v],
|
|
183
351
|
domain: o,
|
|
184
352
|
mode: "grouped"
|
|
185
|
-
}), S =
|
|
353
|
+
}), S = fe({
|
|
186
354
|
categories: n,
|
|
187
355
|
series: a,
|
|
188
356
|
domain: o,
|
|
189
357
|
mode: s
|
|
190
|
-
}) ??
|
|
191
|
-
composition:
|
|
358
|
+
}) ?? te, w = se({
|
|
359
|
+
composition: h,
|
|
192
360
|
series: a,
|
|
193
361
|
categoryIds: n.map((e) => e.id),
|
|
194
362
|
domain: o
|
|
195
|
-
}) ??
|
|
196
|
-
id:
|
|
197
|
-
label:
|
|
363
|
+
}) ?? I(m), ne = S ?? w, A = h === void 0 ? void 0 : {
|
|
364
|
+
id: y,
|
|
365
|
+
label: h.contextLabel,
|
|
198
366
|
tone: "neutral",
|
|
199
|
-
values:
|
|
200
|
-
},
|
|
367
|
+
values: h.buckets.map((e) => e.kind === "gap" ? null : e.total)
|
|
368
|
+
}, ie = A === void 0 ? a : [
|
|
201
369
|
A,
|
|
202
370
|
...a,
|
|
203
|
-
...
|
|
204
|
-
],
|
|
205
|
-
|
|
371
|
+
...v === void 0 || a.some((e) => e.id === v.id) ? [] : [v]
|
|
372
|
+
], ae = v !== void 0 && A !== void 0 ? [v, A] : a, { ref: j, width: M, element: oe } = _(), N = x(), [F, L] = C(), [R, z] = C();
|
|
373
|
+
ee(() => {
|
|
374
|
+
function e(e) {
|
|
375
|
+
e.target instanceof Node && oe?.contains(e.target) !== !0 && L(void 0);
|
|
376
|
+
}
|
|
377
|
+
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
378
|
+
}, [oe]);
|
|
379
|
+
let B = n.findIndex((e) => e.id === F?.id), V = n[B], H = n[n.findIndex((e) => e.id === p?.selectedId)], U = n.find((e) => e.id === R) ?? H ?? n[0], W = n.findIndex((e) => e.id === U?.id), G = V, he = B, K = h?.buckets[he], q = v !== void 0 && A !== void 0 ? [v, A] : A === void 0 || K?.kind === "parts" ? a : [], J = K === void 0 ? void 0 : K.kind === "gap" ? "No reported value" : c(K.total);
|
|
380
|
+
if (ne !== void 0) return /* @__PURE__ */ T(g, {
|
|
206
381
|
title: e,
|
|
207
382
|
description: t,
|
|
208
|
-
message:
|
|
383
|
+
message: ne
|
|
209
384
|
});
|
|
210
|
-
let
|
|
385
|
+
let Y = m - 28, X = O({
|
|
211
386
|
domain: [...o],
|
|
212
|
-
range: [
|
|
213
|
-
}),
|
|
387
|
+
range: [Y, 12]
|
|
388
|
+
}), Z = Math.max(44, ...X.ticks(3).map((e) => l(e).length * 7 + 12)), Q = Math.max(Z + 1, M - 16), $ = D({
|
|
214
389
|
domain: n.map((e) => e.id),
|
|
215
|
-
range: [
|
|
390
|
+
range: [Z, Q],
|
|
216
391
|
padding: .3
|
|
217
|
-
}),
|
|
392
|
+
}), ge = D({
|
|
218
393
|
domain: a.map((e) => e.id),
|
|
219
394
|
range: [0, $.bandwidth()],
|
|
220
395
|
padding: .08
|
|
221
|
-
}),
|
|
222
|
-
function
|
|
223
|
-
let t = e.currentTarget.getBoundingClientRect(), r = (e.clientX - t.left) / t.width *
|
|
224
|
-
a !== void 0 && (e.type === "pointerdown" &&
|
|
396
|
+
}), _e = Math.min(120, Math.max(40, ...n.map((e) => (e.axisLabel ?? e.label).length * 7))), ve = Math.max(1, Math.ceil((_e + 16) / $.step())), ye = Math.max(1, Math.floor(($.step() * ve - 16) / 7));
|
|
397
|
+
function be(e) {
|
|
398
|
+
let t = e.currentTarget.getBoundingClientRect(), r = (e.clientX - t.left) / t.width * M, i = Math.floor((r - Z) / $.step()), a = n[Math.max(0, Math.min(n.length - 1, i))];
|
|
399
|
+
a !== void 0 && (e.type === "pointerdown" && z(a.id), L({
|
|
225
400
|
id: a.id,
|
|
226
401
|
source: "pointer"
|
|
227
402
|
}));
|
|
228
403
|
}
|
|
229
|
-
function
|
|
404
|
+
function xe(e) {
|
|
230
405
|
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
231
406
|
if (e.key === "Escape") {
|
|
232
|
-
e.preventDefault(), e.stopPropagation(),
|
|
407
|
+
e.preventDefault(), e.stopPropagation(), L(void 0);
|
|
233
408
|
return;
|
|
234
409
|
}
|
|
235
|
-
if (
|
|
236
|
-
|
|
410
|
+
if (ue.has(e.key)) {
|
|
411
|
+
U !== void 0 && p !== void 0 && (e.preventDefault(), p.onSelect(U.id));
|
|
237
412
|
return;
|
|
238
413
|
}
|
|
239
414
|
let t = {
|
|
240
|
-
ArrowRight: Math.min(n.length - 1,
|
|
241
|
-
ArrowLeft: Math.max(0,
|
|
415
|
+
ArrowRight: Math.min(n.length - 1, W + 1),
|
|
416
|
+
ArrowLeft: Math.max(0, W - 1),
|
|
242
417
|
Home: 0,
|
|
243
418
|
End: n.length - 1
|
|
244
419
|
}[e.key], r = t === void 0 ? void 0 : n[t];
|
|
245
|
-
r !== void 0 && (e.preventDefault(),
|
|
420
|
+
r !== void 0 && (e.preventDefault(), z(r.id), L({
|
|
246
421
|
id: r.id,
|
|
247
422
|
source: "keyboard"
|
|
248
423
|
}));
|
|
249
424
|
}
|
|
250
|
-
return /* @__PURE__ */
|
|
425
|
+
return /* @__PURE__ */ T(de, {
|
|
251
426
|
title: e,
|
|
252
427
|
description: t,
|
|
253
|
-
series:
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
selection: f
|
|
380
|
-
}) })
|
|
381
|
-
]
|
|
428
|
+
series: ae,
|
|
429
|
+
layoutSeries: a,
|
|
430
|
+
inspectionId: N,
|
|
431
|
+
label: G?.label,
|
|
432
|
+
detail: G === void 0 ? void 0 : [G.axisLabel ?? G.label, J].filter(Boolean).join(" · "),
|
|
433
|
+
summary: J,
|
|
434
|
+
rows: q,
|
|
435
|
+
index: he,
|
|
436
|
+
formatValue: c,
|
|
437
|
+
x: ($(G?.id ?? "") ?? Z) + $.bandwidth() / 2,
|
|
438
|
+
width: M,
|
|
439
|
+
offset: $.bandwidth() / 2 + 8,
|
|
440
|
+
source: F?.source,
|
|
441
|
+
data: /* @__PURE__ */ T(i, {
|
|
442
|
+
items: n.map((e, t) => ({
|
|
443
|
+
id: e.id,
|
|
444
|
+
label: e.label,
|
|
445
|
+
valueLabel: me(ie, t, c),
|
|
446
|
+
tone: "neutral"
|
|
447
|
+
})),
|
|
448
|
+
selection: p
|
|
449
|
+
}),
|
|
450
|
+
children: /* @__PURE__ */ T("div", {
|
|
451
|
+
ref: j,
|
|
452
|
+
...b.props(u.plot, le.plot),
|
|
453
|
+
children: n.length === 0 || a.length === 0 && h === void 0 ? /* @__PURE__ */ T("p", {
|
|
454
|
+
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
455
|
+
children: "No categories"
|
|
456
|
+
}) : /* @__PURE__ */ E("svg", {
|
|
457
|
+
role: "img",
|
|
458
|
+
"aria-label": `${e}. Use arrow keys to inspect categories.${p === void 0 ? "" : " Press Enter to select."}`,
|
|
459
|
+
"aria-describedby": N,
|
|
460
|
+
tabIndex: 0,
|
|
461
|
+
viewBox: `0 0 ${M} ${m}`,
|
|
462
|
+
height: m,
|
|
463
|
+
onKeyDown: xe,
|
|
464
|
+
onFocus: (e) => {
|
|
465
|
+
if (e.currentTarget.matches(":focus-visible")) {
|
|
466
|
+
let e = H ?? n[0];
|
|
467
|
+
z(e?.id), L(e === void 0 ? void 0 : {
|
|
468
|
+
id: e.id,
|
|
469
|
+
source: "keyboard"
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
onPointerMove: (e) => {
|
|
474
|
+
e.pointerType === "mouse" && be(e);
|
|
475
|
+
},
|
|
476
|
+
onPointerDown: be,
|
|
477
|
+
onPointerLeave: (e) => {
|
|
478
|
+
e.pointerType === "mouse" && F?.source === "pointer" && L(void 0);
|
|
479
|
+
},
|
|
480
|
+
onBlur: () => L(void 0),
|
|
481
|
+
onClick: () => {
|
|
482
|
+
V !== void 0 && p?.onSelect(V.id);
|
|
483
|
+
},
|
|
484
|
+
...b.props(u.svg, u.inspectable, pe),
|
|
485
|
+
children: [
|
|
486
|
+
V !== void 0 && /* @__PURE__ */ T("rect", {
|
|
487
|
+
x: ($(V.id) ?? Z) - ($.step() - $.bandwidth()) / 2,
|
|
488
|
+
y: 12,
|
|
489
|
+
width: $.step(),
|
|
490
|
+
height: Y - 12,
|
|
491
|
+
className: "x2wnxhi"
|
|
492
|
+
}),
|
|
493
|
+
X.ticks(3).map((e) => /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("line", {
|
|
494
|
+
x1: Z,
|
|
495
|
+
x2: Q,
|
|
496
|
+
y1: X(e),
|
|
497
|
+
y2: X(e),
|
|
498
|
+
...b.props(u.grid)
|
|
499
|
+
}), /* @__PURE__ */ T("text", {
|
|
500
|
+
x: Z - 8,
|
|
501
|
+
y: X(e),
|
|
502
|
+
textAnchor: "end",
|
|
503
|
+
dominantBaseline: "middle",
|
|
504
|
+
...b.props(u.label),
|
|
505
|
+
children: l(e)
|
|
506
|
+
})] }, e)),
|
|
507
|
+
h?.annotation !== void 0 && n.some((e) => e.id === h.annotation?.categoryId) && /* @__PURE__ */ T("text", {
|
|
508
|
+
x: $(h.annotation.categoryId),
|
|
509
|
+
y: Math.max(12, X(h.annotation.value) - 8),
|
|
510
|
+
...b.props(u.label),
|
|
511
|
+
children: h.annotation.label
|
|
512
|
+
}),
|
|
513
|
+
n.map((e, t) => {
|
|
514
|
+
let n = e.axisLabel ?? e.label, i = h?.buckets[t];
|
|
515
|
+
return /* @__PURE__ */ E("g", { children: [i === void 0 ? a.map((n, i) => {
|
|
516
|
+
let o = n.values[t];
|
|
517
|
+
if (o == null) return null;
|
|
518
|
+
let c = s === "stacked" ? a.slice(0, i).reduce((e, n) => e + (n.values[t] ?? 0), 0) : 0, l = X(c), m = X(c + o), h = p?.selectedId === e.id || V?.id === e.id;
|
|
519
|
+
return /* @__PURE__ */ T(k, {
|
|
520
|
+
x: ($(e.id) ?? Z) + (s === "stacked" ? 0 : ge(n.id) ?? 0),
|
|
521
|
+
y: Math.min(l, m),
|
|
522
|
+
width: s === "stacked" ? $.bandwidth() : ge.bandwidth(),
|
|
523
|
+
height: Math.max(+(o === 0), Math.abs(m - l)),
|
|
524
|
+
fill: f[r(n.tone, i)],
|
|
525
|
+
...b.props(h && u.selected, d !== void 0 && d !== n.id && le.mutedMark)
|
|
526
|
+
}, n.id);
|
|
527
|
+
}) : /* @__PURE__ */ T(ce, {
|
|
528
|
+
bucket: i,
|
|
529
|
+
series: a,
|
|
530
|
+
focusedSeries: v,
|
|
531
|
+
index: t,
|
|
532
|
+
x: $(e.id) ?? Z,
|
|
533
|
+
width: $.bandwidth(),
|
|
534
|
+
y: X,
|
|
535
|
+
isHighlighted: p?.selectedId === e.id || V?.id === e.id,
|
|
536
|
+
highlightedSeriesId: d
|
|
537
|
+
}), t % ve === 0 && /* @__PURE__ */ T("text", {
|
|
538
|
+
x: ($(e.id) ?? Z) + $.bandwidth() / 2,
|
|
539
|
+
y: m - 4,
|
|
540
|
+
textAnchor: "middle",
|
|
541
|
+
...b.props(u.label),
|
|
542
|
+
children: n.length > ye ? `${n.slice(0, ye - 1)}…` : n
|
|
543
|
+
})] }, e.id);
|
|
544
|
+
}),
|
|
545
|
+
U !== void 0 && /* @__PURE__ */ T(re, {
|
|
546
|
+
x: ($(U.id) ?? Z) + $.bandwidth() / 2,
|
|
547
|
+
top: 12,
|
|
548
|
+
bottom: Y,
|
|
549
|
+
width: Math.max(8, $.bandwidth())
|
|
550
|
+
})
|
|
551
|
+
]
|
|
552
|
+
})
|
|
553
|
+
})
|
|
382
554
|
});
|
|
383
555
|
}
|
|
384
|
-
function
|
|
556
|
+
function me(e, t, n) {
|
|
385
557
|
return e.map((e) => {
|
|
386
558
|
let r = e.values[t];
|
|
387
559
|
return `${e.label}: ${r == null ? "Unavailable" : n(r)}`;
|
|
388
560
|
}).join(" · ");
|
|
389
561
|
}
|
|
390
562
|
// packages/charts/src/cartesian/breakdown-bar.tsx
|
|
391
|
-
var
|
|
563
|
+
var R = {
|
|
392
564
|
kzqmXN: "x5lhr3w",
|
|
393
565
|
kZKoxP: "x5yr21d",
|
|
394
566
|
$$css: !0
|
|
395
|
-
},
|
|
396
|
-
|
|
567
|
+
}, z = { segment: (e, t) => [
|
|
568
|
+
R,
|
|
397
569
|
{
|
|
398
570
|
kWkggS: t == null ? t : "xl8spv7",
|
|
399
571
|
$$css: !0
|
|
@@ -403,25 +575,25 @@ var fe = {
|
|
|
403
575
|
"--x-backgroundColor": t ?? void 0
|
|
404
576
|
}
|
|
405
577
|
] };
|
|
406
|
-
function
|
|
407
|
-
let
|
|
408
|
-
return
|
|
578
|
+
function B({ title: e, description: n, items: a, total: o, formatValue: s, selection: c }) {
|
|
579
|
+
let l = t(a), u = a.reduce((e, t) => e + (t.value ?? 0), 0), p = 2 ** -52 * Math.max(u, o, 1) * a.length;
|
|
580
|
+
return l === void 0 ? !Number.isFinite(o) || o < 0 || u - o > p ? /* @__PURE__ */ T(g, {
|
|
409
581
|
title: e,
|
|
410
582
|
description: n,
|
|
411
583
|
message: "The total must be finite and at least the sum of recorded values."
|
|
412
|
-
}) : /* @__PURE__ */
|
|
584
|
+
}) : /* @__PURE__ */ T(d, {
|
|
413
585
|
title: e,
|
|
414
586
|
description: n,
|
|
415
|
-
children: a.length === 0 ? /* @__PURE__ */
|
|
587
|
+
children: a.length === 0 ? /* @__PURE__ */ T("p", {
|
|
416
588
|
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
417
589
|
children: "No values"
|
|
418
|
-
}) : /* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
590
|
+
}) : /* @__PURE__ */ E(w, { children: [
|
|
591
|
+
/* @__PURE__ */ T("div", {
|
|
420
592
|
"aria-hidden": !0,
|
|
421
593
|
className: "x78zum5 x170jfvy xb3r6kr x1r7kqkb xmkeg23 x1y0btm7 x1ey3b81 x1jfksii",
|
|
422
|
-
children: a.map((e, t) => e.value === null ? null : /* @__PURE__ */
|
|
594
|
+
children: a.map((e, t) => e.value === null ? null : /* @__PURE__ */ T("span", { ...b.props(z.segment(o === 0 ? 0 : e.value / o * 100, f[r(e.tone, t)])) }, e.id))
|
|
423
595
|
}),
|
|
424
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ T(i, {
|
|
425
597
|
items: a.map((e, t) => ({
|
|
426
598
|
id: e.id,
|
|
427
599
|
label: e.label,
|
|
@@ -430,29 +602,29 @@ function L({ title: e, description: n, items: a, total: o, formatValue: s, selec
|
|
|
430
602
|
})),
|
|
431
603
|
selection: c
|
|
432
604
|
}),
|
|
433
|
-
o -
|
|
605
|
+
o - u > p && /* @__PURE__ */ E("p", {
|
|
434
606
|
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
435
607
|
children: [
|
|
436
608
|
"Unassigned portion: ",
|
|
437
|
-
s(o -
|
|
609
|
+
s(o - u),
|
|
438
610
|
" of ",
|
|
439
611
|
s(o)
|
|
440
612
|
]
|
|
441
613
|
})
|
|
442
614
|
] })
|
|
443
|
-
}) : /* @__PURE__ */
|
|
615
|
+
}) : /* @__PURE__ */ T(g, {
|
|
444
616
|
title: e,
|
|
445
617
|
description: n,
|
|
446
|
-
message:
|
|
618
|
+
message: l
|
|
447
619
|
});
|
|
448
620
|
}
|
|
449
621
|
// packages/charts/src/cartesian/scatter-plot.tsx
|
|
450
|
-
var
|
|
622
|
+
var V = 260, H = 56, U = 20, W = 12, G = 1e3, he = {
|
|
451
623
|
kzqmXN: "x1xc55vz",
|
|
452
624
|
kZKoxP: "xdk7pt",
|
|
453
625
|
kaIpWk: "x16rqkct",
|
|
454
626
|
$$css: !0
|
|
455
|
-
},
|
|
627
|
+
}, K = {
|
|
456
628
|
brush: {
|
|
457
629
|
kFalU9: "xx69xxh",
|
|
458
630
|
kkrTdU: "xsid9ct",
|
|
@@ -490,7 +662,7 @@ var R = 260, z = 56, B = 20, V = 12, H = 1e3, U = {
|
|
|
490
662
|
"--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
491
663
|
}],
|
|
492
664
|
dot: (e) => [
|
|
493
|
-
|
|
665
|
+
he,
|
|
494
666
|
{
|
|
495
667
|
kWkggS: e == null ? e : "xl8spv7",
|
|
496
668
|
$$css: !0
|
|
@@ -505,74 +677,74 @@ var R = 260, z = 56, B = 20, V = 12, H = 1e3, U = {
|
|
|
505
677
|
$$css: !0
|
|
506
678
|
}
|
|
507
679
|
};
|
|
508
|
-
function
|
|
509
|
-
let { title: t, description: n, points: r, xDomain: i, yDomain:
|
|
510
|
-
if (
|
|
680
|
+
function q(e) {
|
|
681
|
+
let { title: t, description: n, points: r, xDomain: i, yDomain: a, xLabel: o, yLabel: s, formatX: u, formatY: m, selection: h, rangeSelection: v, emptyLabel: y } = e, { ref: ee, width: x } = _(), te = X(e);
|
|
682
|
+
if (te !== null) return /* @__PURE__ */ T(g, {
|
|
511
683
|
title: t,
|
|
512
684
|
description: n,
|
|
513
|
-
message:
|
|
685
|
+
message: te
|
|
514
686
|
});
|
|
515
|
-
let
|
|
687
|
+
let S = O({
|
|
516
688
|
domain: [...i],
|
|
517
|
-
range: [
|
|
518
|
-
}),
|
|
519
|
-
domain: [...
|
|
520
|
-
range: [216,
|
|
521
|
-
}),
|
|
522
|
-
return /* @__PURE__ */
|
|
689
|
+
range: [H, Math.max(H, x - U)]
|
|
690
|
+
}), C = O({
|
|
691
|
+
domain: [...a],
|
|
692
|
+
range: [216, W]
|
|
693
|
+
}), w = r.find((e) => e.id === h?.selectedId);
|
|
694
|
+
return /* @__PURE__ */ E(d, {
|
|
523
695
|
title: t,
|
|
524
696
|
description: n,
|
|
525
|
-
footer:
|
|
697
|
+
footer: h !== void 0 && r.length > 0 ? /* @__PURE__ */ T(c, { children: w === void 0 ? "Select a point to inspect its label and coordinates." : `${w.label}, ${o}: ${u(w.x)}, ${s}: ${m(w.y)}` }) : void 0,
|
|
526
698
|
children: [
|
|
527
|
-
r.length === 0 ? /* @__PURE__ */
|
|
699
|
+
r.length === 0 ? /* @__PURE__ */ T("p", {
|
|
528
700
|
className: "x1ghz6dp x153jb6y",
|
|
529
|
-
children:
|
|
530
|
-
}) : /* @__PURE__ */
|
|
531
|
-
ref:
|
|
701
|
+
children: y
|
|
702
|
+
}) : /* @__PURE__ */ E("div", {
|
|
703
|
+
ref: ee,
|
|
532
704
|
className: "x1n2onr6 xeuugli",
|
|
533
|
-
children: [/* @__PURE__ */
|
|
534
|
-
width:
|
|
535
|
-
scaleX:
|
|
536
|
-
scaleY:
|
|
705
|
+
children: [/* @__PURE__ */ T(J, {
|
|
706
|
+
width: x,
|
|
707
|
+
scaleX: S,
|
|
708
|
+
scaleY: C,
|
|
537
709
|
...e
|
|
538
|
-
}, `${i[0]}:${i[1]}:${
|
|
710
|
+
}, `${i[0]}:${i[1]}:${a[0]}:${a[1]}:${x}`), h !== void 0 && /* @__PURE__ */ T("div", {
|
|
539
711
|
className: "x10l6tqk x10a8y8t x1n71m9f x47corl",
|
|
540
|
-
children: r.map((e) => /* @__PURE__ */
|
|
712
|
+
children: r.map((e) => /* @__PURE__ */ T("button", {
|
|
541
713
|
type: "button",
|
|
542
714
|
title: e.label,
|
|
543
|
-
"aria-label": `${e.label}, ${
|
|
544
|
-
"aria-pressed":
|
|
545
|
-
onClick: () =>
|
|
546
|
-
...
|
|
547
|
-
children: /* @__PURE__ */
|
|
715
|
+
"aria-label": `${e.label}, ${o}: ${u(e.x)}, ${s}: ${m(e.y)}`,
|
|
716
|
+
"aria-pressed": h.selectedId === e.id,
|
|
717
|
+
onClick: () => h.onSelect(e.id),
|
|
718
|
+
...b.props(K.target, K.location(S(e.x), C(e.y))),
|
|
719
|
+
children: /* @__PURE__ */ T("span", {
|
|
548
720
|
"aria-hidden": !0,
|
|
549
|
-
...
|
|
721
|
+
...b.props(K.dot(f[e.tone]), h.selectedId === e.id && K.selected)
|
|
550
722
|
})
|
|
551
723
|
}, e.id))
|
|
552
724
|
})]
|
|
553
725
|
}),
|
|
554
|
-
v !== void 0 && /* @__PURE__ */
|
|
726
|
+
v !== void 0 && /* @__PURE__ */ T(Y, {
|
|
555
727
|
...e,
|
|
556
728
|
rangeSelection: v
|
|
557
729
|
}),
|
|
558
|
-
r.length > 0 && /* @__PURE__ */
|
|
559
|
-
label: `${e.label}, ${
|
|
560
|
-
isSelected:
|
|
561
|
-
onSelect:
|
|
562
|
-
children: [/* @__PURE__ */
|
|
730
|
+
r.length > 0 && /* @__PURE__ */ T(p, { children: r.map((e) => /* @__PURE__ */ E(l, {
|
|
731
|
+
label: `${e.label}, ${o}: ${u(e.x)}, ${s}: ${m(e.y)}`,
|
|
732
|
+
isSelected: h?.selectedId === e.id,
|
|
733
|
+
onSelect: h === void 0 ? void 0 : () => h.onSelect(e.id),
|
|
734
|
+
children: [/* @__PURE__ */ T("span", { children: e.label }), /* @__PURE__ */ E("span", {
|
|
563
735
|
className: "xeuugli xss6m8b xj0a0fe x153jb6y",
|
|
564
736
|
children: [
|
|
565
|
-
|
|
737
|
+
u(e.x),
|
|
566
738
|
" · ",
|
|
567
|
-
|
|
739
|
+
m(e.y)
|
|
568
740
|
]
|
|
569
741
|
})]
|
|
570
742
|
}, e.id)) })
|
|
571
743
|
]
|
|
572
744
|
});
|
|
573
745
|
}
|
|
574
|
-
function
|
|
575
|
-
let
|
|
746
|
+
function J({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, formatX: o, formatY: s, selection: c, rangeSelection: l }) {
|
|
747
|
+
let d = x(), [p, m] = C(null), h = p === null ? l?.value : {
|
|
576
748
|
x: [Math.min(p.start.x, p.end.x), Math.max(p.start.x, p.end.x)],
|
|
577
749
|
y: [Math.min(p.start.y, p.end.y), Math.max(p.start.y, p.end.y)]
|
|
578
750
|
};
|
|
@@ -580,13 +752,13 @@ function K({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, fo
|
|
|
580
752
|
let i = r.currentTarget.getBoundingClientRect();
|
|
581
753
|
return {
|
|
582
754
|
x: t.copy().clamp(!0).invert((r.clientX - i.left) / i.width * e),
|
|
583
|
-
y: n.copy().clamp(!0).invert((r.clientY - i.top) / i.height *
|
|
755
|
+
y: n.copy().clamp(!0).invert((r.clientY - i.top) / i.height * V)
|
|
584
756
|
};
|
|
585
757
|
}
|
|
586
758
|
function _(t) {
|
|
587
|
-
if (
|
|
588
|
-
let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height *
|
|
589
|
-
if (r <
|
|
759
|
+
if (l === void 0 || t.button !== 0 || t.pointerType === "touch") return;
|
|
760
|
+
let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height * V;
|
|
761
|
+
if (r < H || r > e - U || i < W || i > 216) return;
|
|
590
762
|
let a = g(t);
|
|
591
763
|
t.currentTarget.setPointerCapture(t.pointerId), m({
|
|
592
764
|
start: a,
|
|
@@ -600,108 +772,108 @@ function K({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, fo
|
|
|
600
772
|
end: g(e)
|
|
601
773
|
});
|
|
602
774
|
}
|
|
603
|
-
function
|
|
775
|
+
function y(e) {
|
|
604
776
|
if (p === null || p.pointerId !== e.pointerId) return;
|
|
605
777
|
let t = g(e), n = {
|
|
606
778
|
x: [Math.min(p.start.x, t.x), Math.max(p.start.x, t.x)],
|
|
607
779
|
y: [Math.min(p.start.y, t.y), Math.max(p.start.y, t.y)]
|
|
608
780
|
};
|
|
609
|
-
m(null), e.currentTarget.releasePointerCapture(e.pointerId),
|
|
781
|
+
m(null), e.currentTarget.releasePointerCapture(e.pointerId), l?.onChange(n);
|
|
610
782
|
}
|
|
611
|
-
return /* @__PURE__ */
|
|
783
|
+
return /* @__PURE__ */ E("svg", {
|
|
612
784
|
width: e,
|
|
613
|
-
height:
|
|
614
|
-
viewBox: `0 0 ${e} ${
|
|
785
|
+
height: V,
|
|
786
|
+
viewBox: `0 0 ${e} ${V}`,
|
|
615
787
|
"aria-hidden": !0,
|
|
616
788
|
onPointerDown: _,
|
|
617
789
|
onPointerMove: v,
|
|
618
|
-
onPointerUp:
|
|
790
|
+
onPointerUp: y,
|
|
619
791
|
onPointerCancel: () => m(null),
|
|
620
792
|
onLostPointerCapture: () => m(null),
|
|
621
|
-
...
|
|
793
|
+
...b.props(u.svg, l !== void 0 && K.brush),
|
|
622
794
|
children: [
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
id:
|
|
625
|
-
children: /* @__PURE__ */
|
|
626
|
-
x:
|
|
627
|
-
y:
|
|
628
|
-
width: Math.max(0, e -
|
|
795
|
+
/* @__PURE__ */ T("defs", { children: /* @__PURE__ */ T("clipPath", {
|
|
796
|
+
id: d,
|
|
797
|
+
children: /* @__PURE__ */ T("rect", {
|
|
798
|
+
x: H,
|
|
799
|
+
y: W,
|
|
800
|
+
width: Math.max(0, e - H - U),
|
|
629
801
|
height: 204
|
|
630
802
|
})
|
|
631
803
|
}) }),
|
|
632
|
-
t.ticks(5).map((e) => /* @__PURE__ */
|
|
804
|
+
t.ticks(5).map((e) => /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("line", {
|
|
633
805
|
x1: t(e),
|
|
634
806
|
x2: t(e),
|
|
635
|
-
y1:
|
|
807
|
+
y1: W,
|
|
636
808
|
y2: 216,
|
|
637
|
-
...
|
|
638
|
-
}), /* @__PURE__ */
|
|
809
|
+
...b.props(u.grid)
|
|
810
|
+
}), /* @__PURE__ */ T("text", {
|
|
639
811
|
x: t(e),
|
|
640
812
|
y: 234,
|
|
641
813
|
textAnchor: "middle",
|
|
642
|
-
...
|
|
814
|
+
...b.props(u.label),
|
|
643
815
|
children: o(e)
|
|
644
816
|
})] }, e)),
|
|
645
|
-
n.ticks(4).map((t) => /* @__PURE__ */
|
|
646
|
-
x1:
|
|
647
|
-
x2: e -
|
|
817
|
+
n.ticks(4).map((t) => /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("line", {
|
|
818
|
+
x1: H,
|
|
819
|
+
x2: e - U,
|
|
648
820
|
y1: n(t),
|
|
649
821
|
y2: n(t),
|
|
650
|
-
...
|
|
651
|
-
}), /* @__PURE__ */
|
|
822
|
+
...b.props(u.grid)
|
|
823
|
+
}), /* @__PURE__ */ T("text", {
|
|
652
824
|
x: 48,
|
|
653
825
|
y: n(t) + 4,
|
|
654
826
|
textAnchor: "end",
|
|
655
|
-
...
|
|
827
|
+
...b.props(u.label),
|
|
656
828
|
children: s(t)
|
|
657
829
|
})] }, t)),
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
x: (
|
|
830
|
+
/* @__PURE__ */ T("text", {
|
|
831
|
+
x: (H + e - U) / 2,
|
|
660
832
|
y: 256,
|
|
661
833
|
textAnchor: "middle",
|
|
662
|
-
...
|
|
834
|
+
...b.props(u.label),
|
|
663
835
|
children: i
|
|
664
836
|
}),
|
|
665
|
-
/* @__PURE__ */
|
|
837
|
+
/* @__PURE__ */ T("text", {
|
|
666
838
|
x: 12,
|
|
667
839
|
y: 108,
|
|
668
840
|
textAnchor: "middle",
|
|
669
841
|
transform: "rotate(-90 12 108)",
|
|
670
|
-
...
|
|
842
|
+
...b.props(u.label),
|
|
671
843
|
children: a
|
|
672
844
|
}),
|
|
673
|
-
/* @__PURE__ */
|
|
674
|
-
clipPath: `url(#${
|
|
675
|
-
children: [h != null && /* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ E("g", {
|
|
846
|
+
clipPath: `url(#${d})`,
|
|
847
|
+
children: [h != null && /* @__PURE__ */ T("rect", {
|
|
676
848
|
x: t(h.x[0]),
|
|
677
849
|
y: n(h.y[1]),
|
|
678
850
|
width: t(h.x[1]) - t(h.x[0]),
|
|
679
851
|
height: n(h.y[0]) - n(h.y[1]),
|
|
680
852
|
className: "x1e0kj8g xv7c1pl x1tg5nk6 xnpr05h x15lqr97 x47corl"
|
|
681
|
-
}),
|
|
853
|
+
}), c === void 0 && r.map((e) => /* @__PURE__ */ T("circle", {
|
|
682
854
|
cx: t(e.x),
|
|
683
855
|
cy: n(e.y),
|
|
684
856
|
r: 4,
|
|
685
|
-
fill:
|
|
857
|
+
fill: f[e.tone]
|
|
686
858
|
}, e.id))]
|
|
687
859
|
})
|
|
688
860
|
]
|
|
689
861
|
});
|
|
690
862
|
}
|
|
691
|
-
function
|
|
692
|
-
let
|
|
863
|
+
function Y({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: o, formatY: s }) {
|
|
864
|
+
let c = e.value ?? {
|
|
693
865
|
x: t,
|
|
694
866
|
y: n
|
|
695
867
|
};
|
|
696
|
-
return /* @__PURE__ */
|
|
868
|
+
return /* @__PURE__ */ E("fieldset", {
|
|
697
869
|
className: "xrvj5dj x1n8ia3y x1xxf3xd xc342km x1717udv xeuugli",
|
|
698
870
|
children: [
|
|
699
|
-
/* @__PURE__ */
|
|
871
|
+
/* @__PURE__ */ T("legend", {
|
|
700
872
|
className: "x153jb6y xy8obcc x1jfksii",
|
|
701
873
|
children: "Drag with a mouse, or adjust these bounds to select a coordinate range."
|
|
702
874
|
}),
|
|
703
|
-
/* @__PURE__ */
|
|
704
|
-
value:
|
|
875
|
+
/* @__PURE__ */ E(v.Root, {
|
|
876
|
+
value: c.x,
|
|
705
877
|
min: t[0],
|
|
706
878
|
max: t[1],
|
|
707
879
|
step: e.xStep,
|
|
@@ -709,62 +881,62 @@ function q({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
|
|
|
709
881
|
thumbCollisionBehavior: "none",
|
|
710
882
|
onValueChange: (t) => e.onChange({
|
|
711
883
|
x: t,
|
|
712
|
-
y:
|
|
884
|
+
y: c.y
|
|
713
885
|
}),
|
|
714
|
-
children: [/* @__PURE__ */
|
|
886
|
+
children: [/* @__PURE__ */ E("div", {
|
|
715
887
|
className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
|
|
716
|
-
children: [/* @__PURE__ */
|
|
717
|
-
|
|
888
|
+
children: [/* @__PURE__ */ T(v.Label, { children: r }), /* @__PURE__ */ E("span", { children: [
|
|
889
|
+
o(c.x[0]),
|
|
718
890
|
" – ",
|
|
719
|
-
|
|
891
|
+
o(c.x[1])
|
|
720
892
|
] })]
|
|
721
|
-
}), /* @__PURE__ */
|
|
722
|
-
/* @__PURE__ */
|
|
723
|
-
/* @__PURE__ */
|
|
893
|
+
}), /* @__PURE__ */ T(v.Control, { children: /* @__PURE__ */ E(v.Track, { children: [
|
|
894
|
+
/* @__PURE__ */ T(v.Indicator, {}),
|
|
895
|
+
/* @__PURE__ */ T(v.Thumb, {
|
|
724
896
|
index: 0,
|
|
725
897
|
"aria-label": `${r} minimum`,
|
|
726
|
-
getAriaValueText: (e, t) =>
|
|
898
|
+
getAriaValueText: (e, t) => o(t)
|
|
727
899
|
}),
|
|
728
|
-
/* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ T(v.Thumb, {
|
|
729
901
|
index: 1,
|
|
730
902
|
"aria-label": `${r} maximum`,
|
|
731
|
-
getAriaValueText: (e, t) =>
|
|
903
|
+
getAriaValueText: (e, t) => o(t)
|
|
732
904
|
})
|
|
733
905
|
] }) })]
|
|
734
906
|
}),
|
|
735
|
-
/* @__PURE__ */
|
|
736
|
-
value:
|
|
907
|
+
/* @__PURE__ */ E(v.Root, {
|
|
908
|
+
value: c.y,
|
|
737
909
|
min: n[0],
|
|
738
910
|
max: n[1],
|
|
739
911
|
step: e.yStep,
|
|
740
912
|
locale: e.locale,
|
|
741
913
|
thumbCollisionBehavior: "none",
|
|
742
914
|
onValueChange: (t) => e.onChange({
|
|
743
|
-
x:
|
|
915
|
+
x: c.x,
|
|
744
916
|
y: t
|
|
745
917
|
}),
|
|
746
|
-
children: [/* @__PURE__ */
|
|
918
|
+
children: [/* @__PURE__ */ E("div", {
|
|
747
919
|
className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
|
|
748
|
-
children: [/* @__PURE__ */
|
|
749
|
-
|
|
920
|
+
children: [/* @__PURE__ */ T(v.Label, { children: i }), /* @__PURE__ */ E("span", { children: [
|
|
921
|
+
s(c.y[0]),
|
|
750
922
|
" – ",
|
|
751
|
-
|
|
923
|
+
s(c.y[1])
|
|
752
924
|
] })]
|
|
753
|
-
}), /* @__PURE__ */
|
|
754
|
-
/* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
925
|
+
}), /* @__PURE__ */ T(v.Control, { children: /* @__PURE__ */ E(v.Track, { children: [
|
|
926
|
+
/* @__PURE__ */ T(v.Indicator, {}),
|
|
927
|
+
/* @__PURE__ */ T(v.Thumb, {
|
|
756
928
|
index: 0,
|
|
757
929
|
"aria-label": `${i} minimum`,
|
|
758
|
-
getAriaValueText: (e, t) =>
|
|
930
|
+
getAriaValueText: (e, t) => s(t)
|
|
759
931
|
}),
|
|
760
|
-
/* @__PURE__ */
|
|
932
|
+
/* @__PURE__ */ T(v.Thumb, {
|
|
761
933
|
index: 1,
|
|
762
934
|
"aria-label": `${i} maximum`,
|
|
763
|
-
getAriaValueText: (e, t) =>
|
|
935
|
+
getAriaValueText: (e, t) => s(t)
|
|
764
936
|
})
|
|
765
937
|
] }) })]
|
|
766
938
|
}),
|
|
767
|
-
/* @__PURE__ */
|
|
939
|
+
/* @__PURE__ */ T(a, {
|
|
768
940
|
type: "button",
|
|
769
941
|
disabled: e.value === null,
|
|
770
942
|
onClick: () => e.onChange(null),
|
|
@@ -773,10 +945,10 @@ function q({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
|
|
|
773
945
|
]
|
|
774
946
|
});
|
|
775
947
|
}
|
|
776
|
-
function
|
|
777
|
-
if (!
|
|
778
|
-
if (e.length > 1e3) return `This plot exceeds the ${
|
|
779
|
-
if (!
|
|
948
|
+
function X({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
|
|
949
|
+
if (!h(t) || !h(n)) return "Scatter domains must contain finite, increasing endpoints.";
|
|
950
|
+
if (e.length > 1e3) return `This plot exceeds the ${G}-point render limit. Supply a smaller, labelled sample.`;
|
|
951
|
+
if (!m(e)) return "Scatter points must have unique identifiers.";
|
|
780
952
|
if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
|
|
781
953
|
if (e.some((e) => {
|
|
782
954
|
let r = e.x < t[0] || e.x > t[1], i = e.y < n[0] || e.y > n[1];
|
|
@@ -786,18 +958,18 @@ function J({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
|
|
|
786
958
|
let i = Number.isFinite(r.xStep) && r.xStep > 0 && r.xStep <= t[1] - t[0], a = Number.isFinite(r.yStep) && r.yStep > 0 && r.yStep <= n[1] - n[0];
|
|
787
959
|
if (!i || !a) return "Range selection steps must be finite, positive, and no larger than their domain span.";
|
|
788
960
|
let o = r.value;
|
|
789
|
-
return o === null ? null : !
|
|
961
|
+
return o === null ? null : !Z(o.x, t) || !Z(o.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
|
|
790
962
|
}
|
|
791
|
-
function
|
|
963
|
+
function Z(e, t) {
|
|
792
964
|
return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
|
|
793
965
|
}
|
|
794
966
|
// packages/charts/src/cartesian/time-series-data.ts
|
|
795
|
-
var
|
|
967
|
+
var Q = {
|
|
796
968
|
series: 12,
|
|
797
969
|
pointsPerSeries: 2e3,
|
|
798
970
|
markers: 200,
|
|
799
971
|
panels: 12
|
|
800
|
-
},
|
|
972
|
+
}, $ = .01, ge = [
|
|
801
973
|
"series1",
|
|
802
974
|
"series2",
|
|
803
975
|
"series3",
|
|
@@ -805,13 +977,13 @@ var X = {
|
|
|
805
977
|
"series5",
|
|
806
978
|
"series6"
|
|
807
979
|
];
|
|
808
|
-
function
|
|
980
|
+
function _e({ series: e, isStacked: t, markers: n }) {
|
|
809
981
|
let r = e[0]?.points.map((e) => e.timestamp) ?? [];
|
|
810
|
-
if (e.length >
|
|
811
|
-
if (!
|
|
982
|
+
if (e.length > Q.series || r.length > Q.pointsPerSeries || n.length > Q.markers) return `Choose a window with at most ${Q.series} series, ${Q.pointsPerSeries} observations per series, and ${Q.markers} markers.`;
|
|
983
|
+
if (!m(e) || !m(n)) return "Series and markers require unique identifiers.";
|
|
812
984
|
for (let n of e) {
|
|
813
985
|
if (n.points.length !== r.length) return "Every series must supply the same observation timestamps.";
|
|
814
|
-
let e =
|
|
986
|
+
let e = xe({
|
|
815
987
|
points: n.points,
|
|
816
988
|
timestamps: r,
|
|
817
989
|
isStacked: t
|
|
@@ -829,7 +1001,7 @@ function pe({ series: e, isStacked: t, markers: n }) {
|
|
|
829
1001
|
if (!Number.isFinite(a) || !Number.isFinite(o)) return "The elapsed-time and value ranges must be finite.";
|
|
830
1002
|
if (t && r.some((t, n) => !Number.isFinite(e.reduce((e, t) => e + (t.points[n]?.value ?? 0), 0)))) return "Stacked observation totals must be finite.";
|
|
831
1003
|
}
|
|
832
|
-
function
|
|
1004
|
+
function ve({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
|
|
833
1005
|
return JSON.stringify([
|
|
834
1006
|
n,
|
|
835
1007
|
r,
|
|
@@ -849,15 +1021,15 @@ function $({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
|
|
|
849
1021
|
])
|
|
850
1022
|
]);
|
|
851
1023
|
}
|
|
852
|
-
function
|
|
1024
|
+
function ye(e, t, n = !1) {
|
|
853
1025
|
if (e !== t) return [e, t];
|
|
854
|
-
let r = Math.max(1, Math.abs(e) *
|
|
1026
|
+
let r = Math.max(1, Math.abs(e) * $), i = n ? 0 : e - r, a = t + r;
|
|
855
1027
|
return [Number.isFinite(i) ? i : e, Number.isFinite(a) ? a : t];
|
|
856
1028
|
}
|
|
857
|
-
function
|
|
1029
|
+
function be(e, t) {
|
|
858
1030
|
let n = e.filter((e) => e.tone === void 0);
|
|
859
1031
|
return e.map((r, i) => {
|
|
860
|
-
let a = n.findIndex((e) => e.id === r.id), o = r.tone ??
|
|
1032
|
+
let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? ge[a % ge.length] ?? "series1", s = r.points.map((n, r) => {
|
|
861
1033
|
let a = t ? e.slice(0, i).reduce((e, t) => e + (t.points[r]?.value ?? 0), 0) : 0;
|
|
862
1034
|
return {
|
|
863
1035
|
...n,
|
|
@@ -872,7 +1044,7 @@ function he(e, t) {
|
|
|
872
1044
|
};
|
|
873
1045
|
});
|
|
874
1046
|
}
|
|
875
|
-
function
|
|
1047
|
+
function xe({ points: e, timestamps: t, isStacked: n }) {
|
|
876
1048
|
for (let [r, i] of e.entries()) {
|
|
877
1049
|
let a = e[r - 1], o = a !== void 0 && i.timestamp <= a.timestamp;
|
|
878
1050
|
if (!Number.isFinite(i.timestamp) || i.timestamp !== t[r] || o) return "Observation timestamps must be finite, aligned, and strictly increasing.";
|
|
@@ -881,49 +1053,49 @@ function ge({ points: e, timestamps: t, isStacked: n }) {
|
|
|
881
1053
|
}
|
|
882
1054
|
}
|
|
883
1055
|
// packages/charts/src/cartesian/time-series-line.tsx
|
|
884
|
-
function
|
|
885
|
-
return /* @__PURE__ */
|
|
1056
|
+
function Se({ series: e, x: t, y: n, inspectedTimestamp: r, pointRadius: i = 3 }) {
|
|
1057
|
+
return /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(A, {
|
|
886
1058
|
data: [...e.points],
|
|
887
1059
|
defined: (e) => e.value !== null,
|
|
888
1060
|
x: (e) => t(e.timestamp),
|
|
889
1061
|
y: (e) => n((e.value ?? 0) + e.base),
|
|
890
|
-
stroke:
|
|
891
|
-
...
|
|
1062
|
+
stroke: f[e.tone],
|
|
1063
|
+
...b.props(u.mark)
|
|
892
1064
|
}), e.points.filter((t, n) => {
|
|
893
1065
|
if (t.value === null) return !1;
|
|
894
1066
|
let i = e.points[n - 1]?.value === null || e.points[n + 1]?.value === null;
|
|
895
1067
|
return e.points.length === 1 || i || t.timestamp === r;
|
|
896
|
-
}).map((r) => /* @__PURE__ */
|
|
1068
|
+
}).map((r) => /* @__PURE__ */ T("circle", {
|
|
897
1069
|
cx: t(r.timestamp),
|
|
898
1070
|
cy: n((r.value ?? 0) + r.base),
|
|
899
1071
|
r: i,
|
|
900
|
-
fill:
|
|
1072
|
+
fill: f[e.tone]
|
|
901
1073
|
}, r.timestamp))] });
|
|
902
1074
|
}
|
|
903
1075
|
// packages/charts/src/cartesian/sparkline.tsx
|
|
904
|
-
function
|
|
905
|
-
let o = x(), s = x(), c =
|
|
1076
|
+
function Ce({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
|
|
1077
|
+
let o = x(), s = x(), c = we({
|
|
906
1078
|
title: e,
|
|
907
1079
|
summary: t,
|
|
908
1080
|
unit: n,
|
|
909
1081
|
series: i,
|
|
910
1082
|
valueDomain: a
|
|
911
1083
|
}), l = i.points.some((e) => e.value !== null);
|
|
912
|
-
if (c !== void 0 || !l) return /* @__PURE__ */
|
|
1084
|
+
if (c !== void 0 || !l) return /* @__PURE__ */ T("span", {
|
|
913
1085
|
role: "img",
|
|
914
1086
|
"aria-label": `${e}. ${t} Values in ${n}; timestamps in ${r}. ${c ?? "No recorded values. Missing observations remain unavailable."}`,
|
|
915
1087
|
title: c ?? "No recorded values",
|
|
916
1088
|
className: "x2pejg6 x10w6t97 x2lah0s xxymvpz x3nfvp2 x6s0dn4 xl56j7k x153jb6y x1hz01jw xy8obcc",
|
|
917
1089
|
children: c === void 0 ? "No data" : "Invalid trend"
|
|
918
1090
|
});
|
|
919
|
-
let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f =
|
|
920
|
-
domain: [...
|
|
1091
|
+
let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f = O({
|
|
1092
|
+
domain: [...ye(u, d)],
|
|
921
1093
|
range: [3, 125]
|
|
922
|
-
}), p =
|
|
1094
|
+
}), p = O({
|
|
923
1095
|
domain: [...a],
|
|
924
1096
|
range: [29, 3]
|
|
925
|
-
}), m =
|
|
926
|
-
return /* @__PURE__ */
|
|
1097
|
+
}), m = be([i], !1)[0];
|
|
1098
|
+
return /* @__PURE__ */ E("svg", {
|
|
927
1099
|
role: "img",
|
|
928
1100
|
"aria-labelledby": o,
|
|
929
1101
|
"aria-describedby": s,
|
|
@@ -933,11 +1105,11 @@ function ve({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
|
|
|
933
1105
|
height: 32,
|
|
934
1106
|
className: "x1rg5ohu x2pejg6 x10w6t97 x2lah0s xxymvpz",
|
|
935
1107
|
children: [
|
|
936
|
-
/* @__PURE__ */
|
|
1108
|
+
/* @__PURE__ */ T("title", {
|
|
937
1109
|
id: o,
|
|
938
1110
|
children: e
|
|
939
1111
|
}),
|
|
940
|
-
/* @__PURE__ */
|
|
1112
|
+
/* @__PURE__ */ E("desc", {
|
|
941
1113
|
id: s,
|
|
942
1114
|
children: [
|
|
943
1115
|
t,
|
|
@@ -955,7 +1127,7 @@ function ve({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
|
|
|
955
1127
|
"."
|
|
956
1128
|
]
|
|
957
1129
|
}),
|
|
958
|
-
m !== void 0 && /* @__PURE__ */
|
|
1130
|
+
m !== void 0 && /* @__PURE__ */ T(Se, {
|
|
959
1131
|
series: m,
|
|
960
1132
|
x: f,
|
|
961
1133
|
y: p,
|
|
@@ -964,10 +1136,10 @@ function ve({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
|
|
|
964
1136
|
]
|
|
965
1137
|
});
|
|
966
1138
|
}
|
|
967
|
-
function
|
|
1139
|
+
function we({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
|
|
968
1140
|
if (e.trim() === "" || t.trim() === "" || n.trim() === "") return "A trend requires a title, a readable summary, and a value unit.";
|
|
969
|
-
if (!
|
|
970
|
-
let a =
|
|
1141
|
+
if (!h(i)) return "The displayed value domain must have finite, increasing bounds.";
|
|
1142
|
+
let a = _e({
|
|
971
1143
|
series: [r],
|
|
972
1144
|
isStacked: !1,
|
|
973
1145
|
markers: []
|
|
@@ -976,7 +1148,7 @@ function ye({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
|
|
|
976
1148
|
if (r.points.some((e) => e.value !== null && (e.value < i[0] || e.value > i[1]))) return "Every recorded value must be inside the declared value domain.";
|
|
977
1149
|
}
|
|
978
1150
|
// packages/charts/src/cartesian/time-series.tsx
|
|
979
|
-
var
|
|
1151
|
+
var Te = {
|
|
980
1152
|
timeAxis: {
|
|
981
1153
|
k1xSpc: "x78zum5",
|
|
982
1154
|
kjj79g: "x1qughib",
|
|
@@ -997,47 +1169,47 @@ var be = {
|
|
|
997
1169
|
"--x-paddingInlineEnd": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
998
1170
|
}]
|
|
999
1171
|
};
|
|
1000
|
-
function
|
|
1001
|
-
return /* @__PURE__ */
|
|
1172
|
+
function Ee(e) {
|
|
1173
|
+
return /* @__PURE__ */ T(Ae, {
|
|
1002
1174
|
...e,
|
|
1003
1175
|
kind: "line",
|
|
1004
1176
|
isStacked: !1
|
|
1005
1177
|
});
|
|
1006
1178
|
}
|
|
1007
|
-
function
|
|
1008
|
-
return /* @__PURE__ */
|
|
1179
|
+
function De({ isStacked: e = !1, ...t }) {
|
|
1180
|
+
return /* @__PURE__ */ T(Ae, {
|
|
1009
1181
|
...t,
|
|
1010
1182
|
kind: "area",
|
|
1011
1183
|
isStacked: e
|
|
1012
1184
|
});
|
|
1013
1185
|
}
|
|
1014
|
-
function
|
|
1015
|
-
let n =
|
|
1186
|
+
function Oe({ charts: e, ...t }) {
|
|
1187
|
+
let n = S(null), [r, i] = C(), a = JSON.stringify(e.map((e) => [
|
|
1016
1188
|
e.id,
|
|
1017
1189
|
e.title,
|
|
1018
|
-
|
|
1190
|
+
ve({
|
|
1019
1191
|
series: e.series,
|
|
1020
1192
|
markers: e.markers ?? [],
|
|
1021
1193
|
timestampUnit: t.timestampUnit,
|
|
1022
1194
|
isStacked: !1
|
|
1023
1195
|
})
|
|
1024
1196
|
])), o = JSON.stringify(e[0]?.series[0]?.points.map((e) => e.timestamp) ?? []), s = e.every((e) => JSON.stringify(e.series[0]?.points.map((e) => e.timestamp) ?? []) === o);
|
|
1025
|
-
if (r !== void 0 && r.signature !== a && i(void 0),
|
|
1197
|
+
if (r !== void 0 && r.signature !== a && i(void 0), ee(() => {
|
|
1026
1198
|
function e(e) {
|
|
1027
1199
|
e.target instanceof Node && n.current?.contains(e.target) !== !0 && i(void 0);
|
|
1028
1200
|
}
|
|
1029
1201
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
1030
|
-
}, []), !s || !
|
|
1202
|
+
}, []), !s || !m(e)) return /* @__PURE__ */ T(g, {
|
|
1031
1203
|
title: "Small multiples",
|
|
1032
1204
|
message: "Charts need unique identifiers and aligned observation timestamps."
|
|
1033
1205
|
});
|
|
1034
|
-
if (e.length >
|
|
1206
|
+
if (e.length > Q.panels) return /* @__PURE__ */ T(g, {
|
|
1035
1207
|
title: "Small multiples",
|
|
1036
|
-
message: `Choose at most ${
|
|
1208
|
+
message: `Choose at most ${Q.panels} panels.`
|
|
1037
1209
|
});
|
|
1038
|
-
if (e.length === 0) return /* @__PURE__ */
|
|
1210
|
+
if (e.length === 0) return /* @__PURE__ */ T(d, {
|
|
1039
1211
|
title: "Small multiples",
|
|
1040
|
-
children: /* @__PURE__ */
|
|
1212
|
+
children: /* @__PURE__ */ T("p", {
|
|
1041
1213
|
className: "x153jb6y",
|
|
1042
1214
|
children: "No charts"
|
|
1043
1215
|
})
|
|
@@ -1048,108 +1220,109 @@ function Ce({ charts: e, ...t }) {
|
|
|
1048
1220
|
...e,
|
|
1049
1221
|
signature: a
|
|
1050
1222
|
})
|
|
1051
|
-
},
|
|
1052
|
-
return /* @__PURE__ */
|
|
1223
|
+
}, l = Math.max(52, ...e.flatMap((e) => e.series.flatMap((t) => t.points.flatMap((t) => t.value === null || !Number.isFinite(t.value) ? [] : [(e.formatTick ?? e.formatValue)(t.value).length * 7 + 12]))));
|
|
1224
|
+
return /* @__PURE__ */ T("div", {
|
|
1053
1225
|
ref: n,
|
|
1054
1226
|
className: "xrvj5dj x1j825kq",
|
|
1055
|
-
children: e.map((e) => /* @__PURE__ */
|
|
1227
|
+
children: e.map((e) => /* @__PURE__ */ T(Ae, {
|
|
1056
1228
|
...t,
|
|
1057
1229
|
title: e.title,
|
|
1058
1230
|
description: e.description,
|
|
1059
1231
|
series: e.series,
|
|
1060
1232
|
formatValue: e.formatValue,
|
|
1233
|
+
formatTick: e.formatTick,
|
|
1061
1234
|
markers: e.markers,
|
|
1062
1235
|
kind: "line",
|
|
1063
1236
|
isStacked: !1,
|
|
1064
1237
|
sharedInspection: c,
|
|
1065
|
-
axisWidth:
|
|
1238
|
+
axisWidth: l
|
|
1066
1239
|
}, e.id))
|
|
1067
1240
|
});
|
|
1068
1241
|
}
|
|
1069
|
-
var
|
|
1242
|
+
var ke = {
|
|
1070
1243
|
"x-default-marker": "x-default-marker",
|
|
1071
1244
|
$$css: !0
|
|
1072
1245
|
};
|
|
1073
|
-
function
|
|
1074
|
-
let
|
|
1246
|
+
function Ae({ title: e, description: t, series: n, timestampUnit: r, formatTimestamp: i, formatValue: a, formatTick: o = a, markers: s = [], height: c = 180, actions: l, kind: p, isStacked: m, sharedInspection: h, axisWidth: v }) {
|
|
1247
|
+
let D = !Number.isFinite(c) || c < 48 ? "Chart height must be at least 48 pixels." : _e({
|
|
1075
1248
|
series: n,
|
|
1076
|
-
isStacked:
|
|
1249
|
+
isStacked: m,
|
|
1077
1250
|
markers: s
|
|
1078
|
-
}),
|
|
1251
|
+
}), k = te(() => D === void 0 ? be(n, m) : [], [
|
|
1079
1252
|
n,
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
]),
|
|
1253
|
+
m,
|
|
1254
|
+
D
|
|
1255
|
+
]), A = k[0]?.points ?? [], { ref: ae, width: j, element: se } = _(), N = S(null), [ce, le] = C(), ue = A.find((e) => e.timestamp === ce) ?? A[0], [P, de] = C(), F = ve({
|
|
1083
1256
|
series: n,
|
|
1084
1257
|
markers: s,
|
|
1085
1258
|
timestampUnit: r,
|
|
1086
|
-
isStacked:
|
|
1087
|
-
}),
|
|
1088
|
-
|
|
1089
|
-
let
|
|
1090
|
-
if (
|
|
1091
|
-
if (
|
|
1259
|
+
isStacked: m
|
|
1260
|
+
}), I = h === void 0 ? P?.signature === F ? P : void 0 : h.value, fe = x();
|
|
1261
|
+
P !== void 0 && (P.signature !== F || D !== void 0) && de(void 0);
|
|
1262
|
+
let pe = h !== void 0;
|
|
1263
|
+
if (ee(() => {
|
|
1264
|
+
if (pe) return;
|
|
1092
1265
|
function e(e) {
|
|
1093
|
-
e.target instanceof Node &&
|
|
1266
|
+
e.target instanceof Node && N.current?.contains(e.target) !== !0 && de(void 0);
|
|
1094
1267
|
}
|
|
1095
1268
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
1096
|
-
}, [
|
|
1269
|
+
}, [pe]), D !== void 0) return /* @__PURE__ */ T(g, {
|
|
1097
1270
|
title: e,
|
|
1098
1271
|
description: t,
|
|
1099
|
-
message:
|
|
1272
|
+
message: D
|
|
1100
1273
|
});
|
|
1101
|
-
if (
|
|
1274
|
+
if (A.length === 0) return /* @__PURE__ */ T(d, {
|
|
1102
1275
|
title: e,
|
|
1103
1276
|
description: t,
|
|
1104
|
-
actions:
|
|
1105
|
-
children: /* @__PURE__ */
|
|
1277
|
+
actions: l,
|
|
1278
|
+
children: /* @__PURE__ */ T("p", {
|
|
1106
1279
|
className: "x153jb6y",
|
|
1107
1280
|
children: "No observations"
|
|
1108
1281
|
})
|
|
1109
1282
|
});
|
|
1110
|
-
let
|
|
1111
|
-
domain: [...
|
|
1112
|
-
range: [
|
|
1113
|
-
}),
|
|
1114
|
-
domain: [...
|
|
1115
|
-
range: [
|
|
1283
|
+
let L = c - 28, me = L + 12, R = A[0]?.timestamp ?? 0, z = A.at(-1)?.timestamp ?? R, B = k.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), V = p === "area" ? Math.min(0, ...B) : Math.min(...B), H = p === "area" ? Math.max(0, ...B) : Math.max(...B), U = B.length === 0 ? 0 : V, W = B.length === 0 ? 1 : H, G = O({
|
|
1284
|
+
domain: [...ye(U, W, p === "area")],
|
|
1285
|
+
range: [L, 12]
|
|
1286
|
+
}), he = G.ticks(3), K = v ?? Math.max(44, ...he.map((e) => o(e).length * 7 + 12)), q = Math.max(K + 1, j - 16), J = O({
|
|
1287
|
+
domain: [...ye(R, z)],
|
|
1288
|
+
range: [K, q]
|
|
1116
1289
|
});
|
|
1117
|
-
function
|
|
1118
|
-
let t =
|
|
1290
|
+
function Y(e) {
|
|
1291
|
+
let t = se?.getBoundingClientRect();
|
|
1119
1292
|
if (t === void 0) return;
|
|
1120
|
-
let n =
|
|
1121
|
-
let r =
|
|
1293
|
+
let n = J.invert(e - t.left), r = A.find((e, t) => {
|
|
1294
|
+
let r = A[t + 1];
|
|
1122
1295
|
return r === void 0 || n <= e.timestamp + (r.timestamp - e.timestamp) / 2;
|
|
1123
1296
|
});
|
|
1124
|
-
r !== void 0 &&
|
|
1125
|
-
signature:
|
|
1297
|
+
r !== void 0 && X({
|
|
1298
|
+
signature: F,
|
|
1126
1299
|
timestamp: r.timestamp,
|
|
1127
1300
|
source: "pointer"
|
|
1128
1301
|
});
|
|
1129
1302
|
}
|
|
1130
|
-
function
|
|
1131
|
-
|
|
1303
|
+
function X(e) {
|
|
1304
|
+
h === void 0 ? de(e) : h.onChange(e);
|
|
1132
1305
|
}
|
|
1133
|
-
function
|
|
1306
|
+
function Z(e) {
|
|
1134
1307
|
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
1135
|
-
let t =
|
|
1136
|
-
ArrowRight: Math.min(
|
|
1308
|
+
let t = A.findIndex((e) => e.timestamp === ue?.timestamp), n = {
|
|
1309
|
+
ArrowRight: Math.min(A.length - 1, t + 1),
|
|
1137
1310
|
ArrowLeft: Math.max(0, t - 1),
|
|
1138
1311
|
Home: 0,
|
|
1139
|
-
End:
|
|
1312
|
+
End: A.length - 1
|
|
1140
1313
|
};
|
|
1141
1314
|
switch (e.key) {
|
|
1142
1315
|
case "Escape":
|
|
1143
|
-
e.preventDefault(), e.stopPropagation(),
|
|
1316
|
+
e.preventDefault(), e.stopPropagation(), X(void 0);
|
|
1144
1317
|
break;
|
|
1145
1318
|
case "ArrowRight":
|
|
1146
1319
|
case "ArrowLeft":
|
|
1147
1320
|
case "Home":
|
|
1148
1321
|
case "End": {
|
|
1149
1322
|
e.preventDefault();
|
|
1150
|
-
let t =
|
|
1151
|
-
t !== void 0 && (
|
|
1152
|
-
signature:
|
|
1323
|
+
let t = A[n[e.key]];
|
|
1324
|
+
t !== void 0 && (le(t.timestamp), X({
|
|
1325
|
+
signature: F,
|
|
1153
1326
|
timestamp: t.timestamp,
|
|
1154
1327
|
source: "keyboard"
|
|
1155
1328
|
}));
|
|
@@ -1157,144 +1330,176 @@ function Te({ title: e, description: t, series: n, timestampUnit: r, formatTimes
|
|
|
1157
1330
|
}
|
|
1158
1331
|
}
|
|
1159
1332
|
}
|
|
1160
|
-
return /* @__PURE__ */
|
|
1161
|
-
ref:
|
|
1333
|
+
return /* @__PURE__ */ T("div", {
|
|
1334
|
+
ref: N,
|
|
1162
1335
|
className: "xeuugli",
|
|
1163
|
-
children: /* @__PURE__ */
|
|
1164
|
-
title:
|
|
1336
|
+
children: /* @__PURE__ */ T(d, {
|
|
1337
|
+
title: /* @__PURE__ */ T(M, {
|
|
1338
|
+
title: e,
|
|
1339
|
+
detail: I === void 0 ? void 0 : i(I.timestamp)
|
|
1340
|
+
}),
|
|
1165
1341
|
description: t,
|
|
1166
|
-
actions:
|
|
1167
|
-
|
|
1342
|
+
actions: /* @__PURE__ */ E(w, { children: [
|
|
1343
|
+
l,
|
|
1344
|
+
" ",
|
|
1345
|
+
/* @__PURE__ */ T(ie, {
|
|
1346
|
+
title: e,
|
|
1347
|
+
children: /* @__PURE__ */ E("table", {
|
|
1348
|
+
className: "xh8yej3 x1mwwwfo xy8obcc x1yc453h xss6m8b",
|
|
1349
|
+
children: [
|
|
1350
|
+
/* @__PURE__ */ E("caption", { children: [e, " observations"] }),
|
|
1351
|
+
/* @__PURE__ */ T("thead", { children: /* @__PURE__ */ E("tr", { children: [/* @__PURE__ */ E("th", {
|
|
1352
|
+
scope: "col",
|
|
1353
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1354
|
+
children: [
|
|
1355
|
+
"Time (",
|
|
1356
|
+
r,
|
|
1357
|
+
")"
|
|
1358
|
+
]
|
|
1359
|
+
}), k.map((e) => /* @__PURE__ */ T("th", {
|
|
1360
|
+
scope: "col",
|
|
1361
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1362
|
+
children: e.label
|
|
1363
|
+
}, e.id))] }) }),
|
|
1364
|
+
/* @__PURE__ */ T("tbody", { children: A.map((e, t) => /* @__PURE__ */ E("tr", { children: [/* @__PURE__ */ T("th", {
|
|
1365
|
+
scope: "row",
|
|
1366
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1367
|
+
children: i(e.timestamp)
|
|
1368
|
+
}), k.map((e) => /* @__PURE__ */ T("td", {
|
|
1369
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1370
|
+
children: e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : a(e.points[t].value)
|
|
1371
|
+
}, e.id))] }, e.timestamp)) })
|
|
1372
|
+
]
|
|
1373
|
+
})
|
|
1374
|
+
})
|
|
1375
|
+
] }),
|
|
1376
|
+
children: /* @__PURE__ */ E("div", {
|
|
1168
1377
|
className: "xrvj5dj x1n8ia3y",
|
|
1169
1378
|
children: [
|
|
1170
|
-
/* @__PURE__ */
|
|
1171
|
-
id:
|
|
1172
|
-
label:
|
|
1173
|
-
tone: n
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1379
|
+
/* @__PURE__ */ T(oe, {
|
|
1380
|
+
id: fe,
|
|
1381
|
+
label: I === void 0 ? void 0 : i(I.timestamp),
|
|
1382
|
+
legend: k.map(({ id: e, label: t, tone: n }) => ({
|
|
1383
|
+
id: e,
|
|
1384
|
+
label: t,
|
|
1385
|
+
tone: n
|
|
1386
|
+
})),
|
|
1387
|
+
rows: k.map((e) => {
|
|
1388
|
+
let t = e.points.find((e) => e.timestamp === I?.timestamp);
|
|
1389
|
+
return {
|
|
1390
|
+
id: e.id,
|
|
1391
|
+
label: e.label,
|
|
1392
|
+
tone: e.tone,
|
|
1393
|
+
value: t?.value === null || t === void 0 ? "Unavailable" : a(t.value)
|
|
1394
|
+
};
|
|
1395
|
+
}),
|
|
1396
|
+
x: J(I?.timestamp ?? R),
|
|
1397
|
+
width: j,
|
|
1398
|
+
source: I?.source,
|
|
1399
|
+
notes: s.filter((e) => e.timestamp === I?.timestamp).map((e) => e.label)
|
|
1400
|
+
}),
|
|
1401
|
+
/* @__PURE__ */ E("div", {
|
|
1402
|
+
ref: ae,
|
|
1403
|
+
...b.props(u.plot),
|
|
1404
|
+
children: [/* @__PURE__ */ E("svg", {
|
|
1179
1405
|
role: "img",
|
|
1180
1406
|
"aria-label": `${e}. Use arrow keys to inspect observations.`,
|
|
1181
|
-
"aria-describedby":
|
|
1407
|
+
"aria-describedby": fe,
|
|
1182
1408
|
tabIndex: 0,
|
|
1183
|
-
viewBox: `0 0 ${
|
|
1184
|
-
height:
|
|
1185
|
-
onKeyDown:
|
|
1409
|
+
viewBox: `0 0 ${j} ${me}`,
|
|
1410
|
+
height: me,
|
|
1411
|
+
onKeyDown: Z,
|
|
1186
1412
|
onFocus: (e) => {
|
|
1187
1413
|
if (e.currentTarget.matches(":focus-visible")) {
|
|
1188
|
-
let e =
|
|
1189
|
-
|
|
1190
|
-
signature:
|
|
1414
|
+
let e = I?.timestamp ?? R;
|
|
1415
|
+
le(e), X({
|
|
1416
|
+
signature: F,
|
|
1191
1417
|
timestamp: e,
|
|
1192
1418
|
source: "keyboard"
|
|
1193
1419
|
});
|
|
1194
1420
|
}
|
|
1195
1421
|
},
|
|
1196
1422
|
onPointerMove: (e) => {
|
|
1197
|
-
e.pointerType === "mouse" &&
|
|
1423
|
+
e.pointerType === "mouse" && Y(e.clientX);
|
|
1424
|
+
},
|
|
1425
|
+
onPointerDown: (e) => Y(e.clientX),
|
|
1426
|
+
onPointerLeave: (e) => {
|
|
1427
|
+
e.pointerType === "mouse" && I?.source === "pointer" && X(void 0);
|
|
1198
1428
|
},
|
|
1199
|
-
|
|
1200
|
-
...
|
|
1429
|
+
onBlur: () => X(void 0),
|
|
1430
|
+
...b.props(u.svg, u.inspectable, ke),
|
|
1201
1431
|
children: [
|
|
1202
|
-
|
|
1203
|
-
x1:
|
|
1204
|
-
x2:
|
|
1432
|
+
he.map((e) => /* @__PURE__ */ E("g", { children: [/* @__PURE__ */ T("line", {
|
|
1433
|
+
x1: K,
|
|
1434
|
+
x2: q,
|
|
1205
1435
|
y1: G(e),
|
|
1206
1436
|
y2: G(e),
|
|
1207
|
-
...
|
|
1208
|
-
}), /* @__PURE__ */
|
|
1209
|
-
x:
|
|
1437
|
+
...b.props(u.grid)
|
|
1438
|
+
}), /* @__PURE__ */ T("text", {
|
|
1439
|
+
x: K - 8,
|
|
1210
1440
|
y: G(e),
|
|
1211
1441
|
textAnchor: "end",
|
|
1212
1442
|
dominantBaseline: "middle",
|
|
1213
|
-
...
|
|
1214
|
-
children:
|
|
1443
|
+
...b.props(u.label),
|
|
1444
|
+
children: o(e)
|
|
1215
1445
|
})] }, e)),
|
|
1216
|
-
|
|
1446
|
+
k.map((e) => /* @__PURE__ */ E("g", { children: [p === "area" && /* @__PURE__ */ T(ne, {
|
|
1217
1447
|
data: [...e.points],
|
|
1218
1448
|
defined: (e) => e.value !== null,
|
|
1219
|
-
x: (e) =>
|
|
1449
|
+
x: (e) => J(e.timestamp),
|
|
1220
1450
|
y0: (e) => G(e.base),
|
|
1221
1451
|
y1: (e) => G((e.value ?? 0) + e.base),
|
|
1222
1452
|
yScale: G,
|
|
1223
|
-
fill:
|
|
1224
|
-
fillOpacity:
|
|
1225
|
-
}), /* @__PURE__ */
|
|
1453
|
+
fill: f[e.tone],
|
|
1454
|
+
fillOpacity: m ? .65 : .15
|
|
1455
|
+
}), /* @__PURE__ */ T(Se, {
|
|
1226
1456
|
series: e,
|
|
1227
|
-
x:
|
|
1457
|
+
x: J,
|
|
1228
1458
|
y: G,
|
|
1229
|
-
inspectedTimestamp:
|
|
1459
|
+
inspectedTimestamp: I?.timestamp
|
|
1230
1460
|
})] }, e.id)),
|
|
1231
|
-
s.map((e) => /* @__PURE__ */
|
|
1232
|
-
x1:
|
|
1233
|
-
x2:
|
|
1461
|
+
s.map((e) => /* @__PURE__ */ E("g", { children: [e.kind === "time" ? /* @__PURE__ */ T("line", {
|
|
1462
|
+
x1: J(e.timestamp),
|
|
1463
|
+
x2: J(e.timestamp),
|
|
1234
1464
|
y1: 12,
|
|
1235
|
-
y2:
|
|
1465
|
+
y2: L,
|
|
1236
1466
|
className: "xhq4mlf x1ntoi03 x13efnbd"
|
|
1237
|
-
}) : /* @__PURE__ */
|
|
1238
|
-
cx:
|
|
1239
|
-
cy: G(e.value + (
|
|
1467
|
+
}) : /* @__PURE__ */ T("circle", {
|
|
1468
|
+
cx: J(e.timestamp),
|
|
1469
|
+
cy: G(e.value + (k.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
|
|
1240
1470
|
r: 4,
|
|
1241
|
-
fill:
|
|
1242
|
-
...
|
|
1243
|
-
}), /* @__PURE__ */
|
|
1244
|
-
|
|
1245
|
-
x1:
|
|
1246
|
-
x2:
|
|
1471
|
+
fill: y.surface,
|
|
1472
|
+
...b.props(u.selected)
|
|
1473
|
+
}), /* @__PURE__ */ T("title", { children: e.kind === "point" ? `${e.label}: ${a(e.value)}` : e.label })] }, e.id)),
|
|
1474
|
+
I !== void 0 && /* @__PURE__ */ T("line", {
|
|
1475
|
+
x1: J(I.timestamp),
|
|
1476
|
+
x2: J(I.timestamp),
|
|
1247
1477
|
y1: 12,
|
|
1248
|
-
y2:
|
|
1478
|
+
y2: L,
|
|
1249
1479
|
className: "xhq4mlf x1ntoi03 x13efnbd"
|
|
1250
1480
|
}),
|
|
1251
|
-
|
|
1252
|
-
x:
|
|
1481
|
+
ue !== void 0 && /* @__PURE__ */ T(re, {
|
|
1482
|
+
x: J(ue.timestamp),
|
|
1253
1483
|
top: 12,
|
|
1254
|
-
bottom:
|
|
1255
|
-
width: Math.min(16, (
|
|
1484
|
+
bottom: L,
|
|
1485
|
+
width: Math.min(16, (q - K) / 2)
|
|
1256
1486
|
})
|
|
1257
1487
|
]
|
|
1258
|
-
}), /* @__PURE__ */
|
|
1488
|
+
}), /* @__PURE__ */ E("div", {
|
|
1259
1489
|
"aria-hidden": !0,
|
|
1260
|
-
...
|
|
1261
|
-
children: [/* @__PURE__ */
|
|
1490
|
+
...b.props(Te.timeAxis, Te.timeAxisInset(K, Math.max(0, j - q))),
|
|
1491
|
+
children: [/* @__PURE__ */ T("span", {
|
|
1262
1492
|
className: "x1cqoux5 xeuugli xj0a0fe",
|
|
1263
1493
|
children: i(R)
|
|
1264
|
-
}), z !== R && /* @__PURE__ */
|
|
1494
|
+
}), z !== R && /* @__PURE__ */ T("span", {
|
|
1265
1495
|
className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
|
|
1266
1496
|
children: i(z)
|
|
1267
1497
|
})]
|
|
1268
1498
|
})]
|
|
1269
1499
|
}),
|
|
1270
|
-
/* @__PURE__ */
|
|
1271
|
-
id: de,
|
|
1272
|
-
"aria-live": F?.source === "keyboard" ? "polite" : "off",
|
|
1273
|
-
className: "x78zum5 x1a02dak x1pha0wt x8zbtdt x1gkm1c7 xy8obcc xas2l8k x1mqbd49 xj0a0fe",
|
|
1274
|
-
children: F === void 0 ? /* @__PURE__ */ E("span", {
|
|
1275
|
-
className: "x153jb6y",
|
|
1276
|
-
children: "Point, tap, or use the arrow keys to inspect values."
|
|
1277
|
-
}) : /* @__PURE__ */ D(T, { children: [
|
|
1278
|
-
/* @__PURE__ */ E("span", { children: i(F.timestamp) }),
|
|
1279
|
-
/* @__PURE__ */ E("dl", {
|
|
1280
|
-
className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp xeuugli",
|
|
1281
|
-
children: j.map((e) => {
|
|
1282
|
-
let t = e.points.find((e) => e.timestamp === F.timestamp);
|
|
1283
|
-
return /* @__PURE__ */ D("div", {
|
|
1284
|
-
className: "x78zum5 x1a02dak xunmzkg x1ghz6dp xeuugli xss6m8b",
|
|
1285
|
-
children: [/* @__PURE__ */ E("dt", { children: e.label }), /* @__PURE__ */ E("dd", {
|
|
1286
|
-
className: "x1ghz6dp xbixft",
|
|
1287
|
-
children: t?.value === null || t === void 0 ? "Unavailable" : a(t.value)
|
|
1288
|
-
})]
|
|
1289
|
-
}, e.id);
|
|
1290
|
-
})
|
|
1291
|
-
}),
|
|
1292
|
-
s.filter((e) => e.timestamp === F.timestamp).map((e) => /* @__PURE__ */ E("span", { children: e.label }, e.id))
|
|
1293
|
-
] })
|
|
1294
|
-
}),
|
|
1295
|
-
s.length > 0 && /* @__PURE__ */ E("ul", {
|
|
1500
|
+
s.length > 0 && /* @__PURE__ */ T("ul", {
|
|
1296
1501
|
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx xy8obcc x153jb6y xj0a0fe",
|
|
1297
|
-
children: s.map((e) => /* @__PURE__ */
|
|
1502
|
+
children: s.map((e) => /* @__PURE__ */ E("li", { children: [
|
|
1298
1503
|
i(e.timestamp),
|
|
1299
1504
|
" · ",
|
|
1300
1505
|
e.label,
|
|
@@ -1302,34 +1507,8 @@ function Te({ title: e, description: t, series: n, timestampUnit: r, formatTimes
|
|
|
1302
1507
|
] }, e.id))
|
|
1303
1508
|
})
|
|
1304
1509
|
]
|
|
1305
|
-
})
|
|
1306
|
-
className: "xh8yej3 x1mwwwfo xy8obcc x1yc453h xss6m8b",
|
|
1307
|
-
children: [
|
|
1308
|
-
/* @__PURE__ */ D("caption", { children: [e, " observations"] }),
|
|
1309
|
-
/* @__PURE__ */ E("thead", { children: /* @__PURE__ */ D("tr", { children: [/* @__PURE__ */ D("th", {
|
|
1310
|
-
scope: "col",
|
|
1311
|
-
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1312
|
-
children: [
|
|
1313
|
-
"Time (",
|
|
1314
|
-
r,
|
|
1315
|
-
")"
|
|
1316
|
-
]
|
|
1317
|
-
}), j.map((e) => /* @__PURE__ */ E("th", {
|
|
1318
|
-
scope: "col",
|
|
1319
|
-
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1320
|
-
children: e.label
|
|
1321
|
-
}, e.id))] }) }),
|
|
1322
|
-
/* @__PURE__ */ E("tbody", { children: M.map((e, t) => /* @__PURE__ */ D("tr", { children: [/* @__PURE__ */ E("th", {
|
|
1323
|
-
scope: "row",
|
|
1324
|
-
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1325
|
-
children: i(e.timestamp)
|
|
1326
|
-
}), j.map((e) => /* @__PURE__ */ E("td", {
|
|
1327
|
-
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1328
|
-
children: e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : a(e.points[t].value)
|
|
1329
|
-
}, e.id))] }, e.timestamp)) })
|
|
1330
|
-
]
|
|
1331
|
-
}) })]
|
|
1510
|
+
})
|
|
1332
1511
|
})
|
|
1333
1512
|
});
|
|
1334
1513
|
}
|
|
1335
|
-
export {
|
|
1514
|
+
export { De as AreaChart, L as BarChart, F as BarChartPlaceholder, B as BreakdownBar, Ee as LineChart, G as MAX_SCATTER_POINTS, q as ScatterPlot, Oe as SmallMultiples, Ce as Sparkline, Q as timeSeriesLimits };
|