@mechane-ai/elements 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +24 -0
- package/README.md +67 -40
- package/dist/ai.js +274 -209
- package/dist/{categorical-values-dGbaZ0tp.js → categorical-values-DLRE4EEW.js} +4 -4
- package/dist/{chart-frame-DgPdIguO.js → chart-frame-et6f6Vhg.js} +22 -14
- package/dist/{chart-input-Sac4StHN.js → chart-input-CdLkFomi.js} +2 -2
- package/dist/charts/cartesian.js +529 -450
- package/dist/charts/distribution.js +302 -261
- package/dist/charts/graph.js +137 -103
- package/dist/charts/hierarchy.js +7 -7
- package/dist/charts/matrix.js +187 -174
- package/dist/charts/timeline.js +118 -92
- package/dist/charts.js +1 -1
- package/dist/code-block-D77maJBB.js +180 -0
- package/dist/collections.js +388 -300
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +81 -63
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +115 -96
- package/dist/content/tree.js +43 -38
- package/dist/{content-link-Dd8gapwc.js → content-link-BpSZeTNK.js} +6 -2
- package/dist/content.js +169 -150
- package/dist/{assets/stylex.css → elements.css} +862 -338
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +31 -31
- package/dist/forms.js +1 -1
- package/dist/index.js +1 -1
- package/dist/layout.js +286 -187
- package/dist/navigation/commands.js +45 -42
- package/dist/{navigation-yxK3iQXo.js → navigation-D2_sGy3C.js} +2 -2
- package/dist/navigation.js +10 -10
- package/dist/overlays.js +1 -1
- package/dist/packages/ai/src/conversation.d.ts +2 -1
- package/dist/packages/ai/src/index.d.ts +4 -0
- package/dist/packages/ai/src/message-action.d.ts +10 -0
- package/dist/packages/ai/src/message-boundary.d.ts +6 -0
- package/dist/packages/ai/src/message.d.ts +2 -1
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +5 -0
- package/dist/packages/charts/src/cartesian/index.d.ts +2 -2
- package/dist/packages/charts/src/chart-frame.d.ts +3 -0
- package/dist/packages/charts/src/chart-theme.d.ts +2 -1
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +22 -2
- package/dist/packages/collections/src/collection-scroll.d.ts +2 -1
- package/dist/packages/collections/src/data-table.d.ts +6 -0
- package/dist/packages/collections/src/index.d.ts +2 -2
- package/dist/packages/collections/src/timeline.d.ts +10 -3
- package/dist/packages/content/src/diff/pierre-diff.d.ts +2 -1
- package/dist/packages/content/src/viewer-styles.d.ts +64 -0
- package/dist/packages/core/src/actions.d.ts +7 -0
- package/dist/packages/core/src/agent-avatar-glyphs.d.ts +5 -0
- package/dist/packages/core/src/agent-avatar.d.ts +17 -0
- package/dist/packages/core/src/copy-value.d.ts +2 -1
- package/dist/packages/core/src/index.d.ts +6 -2
- package/dist/packages/core/src/surfaces.d.ts +5 -0
- package/dist/packages/feedback/src/index.d.ts +4 -1
- package/dist/packages/feedback/src/toast.d.ts +5 -27
- package/dist/packages/forms/src/agent-avatar-picker.d.ts +8 -0
- package/dist/packages/forms/src/field-styles.d.ts +28 -0
- package/dist/packages/forms/src/forms.d.ts +2 -1
- package/dist/packages/forms/src/index.d.ts +2 -0
- package/dist/packages/forms/src/selection-styles.d.ts +18 -2
- package/dist/packages/foundations/src/overlay-styles.d.ts +3 -1
- package/dist/packages/foundations/src/popup-styles.d.ts +7 -0
- package/dist/packages/foundations/src/tokens.stylex.d.ts +61 -0
- package/dist/packages/layout/src/app-shell.d.ts +2 -1
- package/dist/packages/layout/src/frame.stylex.d.ts +1 -0
- package/dist/packages/layout/src/index.d.ts +2 -1
- package/dist/packages/layout/src/page-toolbar.d.ts +3 -1
- package/dist/packages/layout/src/sidebar.d.ts +7 -1
- package/dist/packages/layout/src/view-stack.d.ts +13 -0
- package/dist/packages/layout/src/workbench.d.ts +5 -2
- package/dist/packages/overlays/src/alert-dialog.d.ts +5 -2
- package/dist/packages/overlays/src/dialog.d.ts +7 -3
- package/dist/pierre-diff--zsiHCCB.js +71 -0
- package/dist/pierre-theme-D9hnHv3Z.js +126 -0
- package/dist/{pierre-tree-DdE1boiT.js → pierre-tree-BFxEuxwb.js} +3 -3
- package/dist/src-Be7NLG8c.js +1242 -0
- package/dist/src-CBspCKfO.js +969 -0
- package/dist/src-Cs0dRc4X.js +617 -0
- package/dist/src-sU9b0oZW.js +1168 -0
- package/dist/theme.js +1 -1
- package/dist/tokens.js +69 -10
- package/dist/viewer-styles-CpHqp5Qv.js +70 -0
- package/package.json +2 -1
- package/packages/foundations/src/tokens.stylex.ts +61 -0
- package/styles.css +1 -1
- package/dist/code-block-BRNdtTaP.js +0 -175
- package/dist/pierre-diff-CZdzgiYm.js +0 -66
- package/dist/pierre-theme-BpESNIsV.js +0 -96
- package/dist/popup-styles-CvtZDE2t.js +0 -135
- package/dist/src-Bc5sEhdO.js +0 -680
- package/dist/src-CfDf8TY8.js +0 -466
- package/dist/src-DV0BNk1M.js +0 -360
- package/dist/src-Eg_ytPjv.js +0 -1107
package/dist/charts/cartesian.js
CHANGED
|
@@ -1,200 +1,257 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
1
|
+
import { c as e } from "../src-CBspCKfO.js";
|
|
2
|
+
import { i as t, n, r, t as i } from "../categorical-values-DLRE4EEW.js";
|
|
3
|
+
import { a, i as o, n as s, o as c, r as l, s as u, t as d } from "../chart-frame-et6f6Vhg.js";
|
|
4
|
+
import { n as f, r as p, t as m } from "../chart-input-CdLkFomi.js";
|
|
5
|
+
import { t as h } from "../plot-width--OgdohB5.js";
|
|
6
|
+
import { E as g } from "../src-sU9b0oZW.js";
|
|
7
|
+
import { h as _ } from "../src-Be7NLG8c.js";
|
|
8
|
+
import { colors as v } from "../tokens.js";
|
|
9
|
+
import * as y from "@stylexjs/stylex";
|
|
10
|
+
import { useEffect as b, useId as x, useMemo as S, useRef as C, useState as w } from "react";
|
|
11
|
+
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
12
|
+
import { scaleBand as O, scaleLinear as k } from "@visx/scale";
|
|
13
|
+
import { AreaClosed as A, Bar as ee, LinePath as j } from "@visx/shape";
|
|
13
14
|
// packages/charts/src/cartesian/bar-chart.tsx
|
|
14
|
-
var
|
|
15
|
+
var M = { plot: {
|
|
15
16
|
kqGvvJ: "x1we84gm",
|
|
16
17
|
$$css: !0
|
|
17
|
-
} },
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
} }, N = /* @__PURE__ */ new Set(["Enter", " "]), te = 200, P = "Point, tap, or use the arrow keys to inspect values.";
|
|
19
|
+
function ne({ title: e, description: t, series: n, children: i }) {
|
|
20
|
+
let a = n.map((e, t) => ({
|
|
21
|
+
id: e.id,
|
|
22
|
+
label: e.label,
|
|
23
|
+
tone: r(e.tone, t)
|
|
24
|
+
}));
|
|
25
|
+
return /* @__PURE__ */ D(l, {
|
|
26
|
+
title: e,
|
|
27
|
+
description: t,
|
|
28
|
+
children: [/* @__PURE__ */ E(o, { items: a }), i]
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function F({ title: t = "Loading chart", description: n, series: r = [], height: i = te }) {
|
|
32
|
+
let a = I(i);
|
|
33
|
+
return a === void 0 ? /* @__PURE__ */ E("div", {
|
|
34
|
+
"aria-hidden": !0,
|
|
35
|
+
inert: !0,
|
|
36
|
+
children: /* @__PURE__ */ D(ne, {
|
|
37
|
+
title: t,
|
|
38
|
+
description: n,
|
|
39
|
+
series: r,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ E("div", {
|
|
42
|
+
...y.props(c.plot, M.plot),
|
|
43
|
+
children: /* @__PURE__ */ E(e, { height: i })
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ E("div", {
|
|
46
|
+
className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1mqbd49 xy8obcc xas2l8k xss6m8b xj0a0fe",
|
|
47
|
+
children: /* @__PURE__ */ D("span", {
|
|
48
|
+
className: "x1n2onr6 xeuugli",
|
|
49
|
+
children: [/* @__PURE__ */ E("span", {
|
|
50
|
+
className: "xlshs6z",
|
|
51
|
+
children: P
|
|
52
|
+
}), /* @__PURE__ */ E("span", {
|
|
53
|
+
className: "x10l6tqk x10a8y8t",
|
|
54
|
+
children: /* @__PURE__ */ E(e, { height: "100%" })
|
|
55
|
+
})]
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ E("div", {
|
|
59
|
+
className: "xlshs6z",
|
|
60
|
+
children: /* @__PURE__ */ E(d, { children: null })
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
}) : /* @__PURE__ */ E(m, {
|
|
65
|
+
title: t,
|
|
66
|
+
description: n,
|
|
67
|
+
message: a
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function I(e) {
|
|
71
|
+
if (!Number.isFinite(e) || e < 48) return "Chart height must be at least 48 pixels.";
|
|
72
|
+
}
|
|
73
|
+
function L({ categories: e, series: t, domain: r, mode: i }) {
|
|
74
|
+
if (e.length > n.items || t.length > n.series) return `Choose a window with at most ${n.items} categories and ${n.series} series.`;
|
|
75
|
+
if (!p(r) || r[0] > 0 || r[1] < 0) return "The bar domain must be finite, increasing, and include zero.";
|
|
76
|
+
if (!f(e) || !f(t)) return "Bar categories and series require unique identifiers.";
|
|
77
|
+
for (let n of t) {
|
|
78
|
+
if (n.values.length !== e.length) return "Every series requires one explicit value per category.";
|
|
79
|
+
for (let e of n.values) {
|
|
25
80
|
if (e !== null && (!Number.isFinite(e) || e < r[0] || e > r[1])) return "Bar values must be finite and within the supplied domain.";
|
|
26
81
|
if (i === "stacked" && (e === null || e < 0)) return "Stacked bars require present nonnegative values.";
|
|
27
82
|
}
|
|
28
83
|
}
|
|
29
|
-
if (i === "stacked" && e.some((e,
|
|
84
|
+
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.";
|
|
30
85
|
}
|
|
31
|
-
function
|
|
32
|
-
let
|
|
33
|
-
categories:
|
|
34
|
-
series:
|
|
35
|
-
domain:
|
|
36
|
-
mode:
|
|
37
|
-
}), { ref:
|
|
38
|
-
if (
|
|
86
|
+
function R({ title: e, description: t, categories: n, series: a, domain: o, mode: s = "grouped", formatValue: l, selection: f, height: p = te }) {
|
|
87
|
+
let g = L({
|
|
88
|
+
categories: n,
|
|
89
|
+
series: a,
|
|
90
|
+
domain: o,
|
|
91
|
+
mode: s
|
|
92
|
+
}) ?? I(p), { ref: _, width: v } = h(), b = x(), [S, C] = w(), A = n.findIndex((e) => e.id === S?.id), j = n[A], F = n.findIndex((e) => e.id === f?.selectedId), R = n[F], B = j ?? R, V = j === void 0 ? F : A;
|
|
93
|
+
if (g !== void 0) return /* @__PURE__ */ E(m, {
|
|
39
94
|
title: e,
|
|
40
95
|
description: t,
|
|
41
|
-
message:
|
|
96
|
+
message: g
|
|
42
97
|
});
|
|
43
|
-
let
|
|
44
|
-
domain: [...
|
|
45
|
-
range: [
|
|
46
|
-
}),
|
|
47
|
-
domain:
|
|
48
|
-
range: [
|
|
98
|
+
let H = p - 28, U = k({
|
|
99
|
+
domain: [...o],
|
|
100
|
+
range: [H, 12]
|
|
101
|
+
}), W = Math.max(52, ...U.ticks(3).map((e) => l(e).length * 7 + 12)), G = Math.max(W + 1, v - 16), K = O({
|
|
102
|
+
domain: n.map((e) => e.id),
|
|
103
|
+
range: [W, G],
|
|
49
104
|
padding: .3
|
|
50
|
-
}),
|
|
51
|
-
domain:
|
|
52
|
-
range: [0,
|
|
105
|
+
}), q = O({
|
|
106
|
+
domain: a.map((e) => e.id),
|
|
107
|
+
range: [0, K.bandwidth()],
|
|
53
108
|
padding: .08
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
function q(e) {
|
|
60
|
-
let t = e.currentTarget.getBoundingClientRect(), n = (e.clientX - t.left) / t.width * O, r = Math.floor((n - z) / V.step()), i = o[Math.max(0, Math.min(o.length - 1, r))];
|
|
61
|
-
i !== void 0 && P({
|
|
62
|
-
id: i.id,
|
|
109
|
+
}), re = Math.min(120, Math.max(40, ...n.map((e) => (e.axisLabel ?? e.label).length * 7))), J = Math.max(1, Math.ceil((re + 16) / K.step())), ie = Math.max(1, Math.floor((K.step() * J - 16) / 7));
|
|
110
|
+
function Y(e) {
|
|
111
|
+
let t = e.currentTarget.getBoundingClientRect(), r = (e.clientX - t.left) / t.width * v, i = Math.floor((r - W) / K.step()), a = n[Math.max(0, Math.min(n.length - 1, i))];
|
|
112
|
+
a !== void 0 && C({
|
|
113
|
+
id: a.id,
|
|
63
114
|
source: "pointer"
|
|
64
115
|
});
|
|
65
116
|
}
|
|
66
|
-
function
|
|
117
|
+
function ae(e) {
|
|
67
118
|
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
68
119
|
if (e.key === "Escape") {
|
|
69
|
-
e.preventDefault(), e.stopPropagation(),
|
|
120
|
+
e.preventDefault(), e.stopPropagation(), C(void 0);
|
|
70
121
|
return;
|
|
71
122
|
}
|
|
72
|
-
if (
|
|
73
|
-
|
|
123
|
+
if (N.has(e.key)) {
|
|
124
|
+
j !== void 0 && f !== void 0 && (e.preventDefault(), f.onSelect(j.id));
|
|
74
125
|
return;
|
|
75
126
|
}
|
|
76
127
|
let t = {
|
|
77
|
-
ArrowRight: Math.min(
|
|
78
|
-
ArrowLeft: Math.max(0,
|
|
128
|
+
ArrowRight: Math.min(n.length - 1, A + 1),
|
|
129
|
+
ArrowLeft: Math.max(0, A - 1),
|
|
79
130
|
Home: 0,
|
|
80
|
-
End:
|
|
81
|
-
}[e.key],
|
|
82
|
-
|
|
83
|
-
id:
|
|
131
|
+
End: n.length - 1
|
|
132
|
+
}[e.key], r = t === void 0 ? void 0 : n[t];
|
|
133
|
+
r !== void 0 && (e.preventDefault(), C({
|
|
134
|
+
id: r.id,
|
|
84
135
|
source: "keyboard"
|
|
85
136
|
}));
|
|
86
137
|
}
|
|
87
|
-
return /* @__PURE__ */
|
|
138
|
+
return /* @__PURE__ */ D(ne, {
|
|
88
139
|
title: e,
|
|
89
140
|
description: t,
|
|
141
|
+
series: a,
|
|
90
142
|
children: [
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
children: o.length === 0 || u.length === 0 ? /* @__PURE__ */ w("p", {
|
|
143
|
+
/* @__PURE__ */ E("div", {
|
|
144
|
+
ref: _,
|
|
145
|
+
...y.props(c.plot, M.plot),
|
|
146
|
+
children: n.length === 0 || a.length === 0 ? /* @__PURE__ */ E("p", {
|
|
96
147
|
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
97
148
|
children: "No categories"
|
|
98
|
-
}) : /* @__PURE__ */
|
|
149
|
+
}) : /* @__PURE__ */ D("svg", {
|
|
99
150
|
role: "img",
|
|
100
|
-
"aria-label": `${e}. Use arrow keys to inspect categories.${
|
|
101
|
-
"aria-describedby":
|
|
151
|
+
"aria-label": `${e}. Use arrow keys to inspect categories.${f === void 0 ? "" : " Press Enter to select."}`,
|
|
152
|
+
"aria-describedby": b,
|
|
102
153
|
tabIndex: 0,
|
|
103
|
-
viewBox: `0 0 ${
|
|
104
|
-
height:
|
|
105
|
-
onKeyDown:
|
|
154
|
+
viewBox: `0 0 ${v} ${p}`,
|
|
155
|
+
height: p,
|
|
156
|
+
onKeyDown: ae,
|
|
106
157
|
onPointerMove: (e) => {
|
|
107
|
-
e.pointerType === "mouse" &&
|
|
158
|
+
e.pointerType === "mouse" && Y(e);
|
|
108
159
|
},
|
|
109
|
-
onPointerDown:
|
|
160
|
+
onPointerDown: Y,
|
|
110
161
|
onPointerLeave: (e) => {
|
|
111
|
-
e.pointerType === "mouse" &&
|
|
162
|
+
e.pointerType === "mouse" && S?.source === "pointer" && C(void 0);
|
|
112
163
|
},
|
|
113
|
-
onBlur: () =>
|
|
164
|
+
onBlur: () => C(void 0),
|
|
114
165
|
onClick: () => {
|
|
115
|
-
|
|
166
|
+
j !== void 0 && f?.onSelect(j.id);
|
|
116
167
|
},
|
|
117
|
-
...
|
|
168
|
+
...y.props(c.svg, c.focus),
|
|
118
169
|
children: [
|
|
119
|
-
|
|
120
|
-
x: (
|
|
170
|
+
j !== void 0 && /* @__PURE__ */ E("rect", {
|
|
171
|
+
x: (K(j.id) ?? W) - (K.step() - K.bandwidth()) / 2,
|
|
121
172
|
y: 12,
|
|
122
|
-
width:
|
|
123
|
-
height:
|
|
173
|
+
width: K.step(),
|
|
174
|
+
height: H - 12,
|
|
124
175
|
className: "x2wnxhi"
|
|
125
176
|
}),
|
|
126
|
-
|
|
127
|
-
x1:
|
|
128
|
-
x2:
|
|
129
|
-
y1:
|
|
130
|
-
y2:
|
|
131
|
-
...
|
|
132
|
-
}), /* @__PURE__ */
|
|
133
|
-
x:
|
|
134
|
-
y:
|
|
177
|
+
U.ticks(3).map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
|
|
178
|
+
x1: W,
|
|
179
|
+
x2: G,
|
|
180
|
+
y1: U(e),
|
|
181
|
+
y2: U(e),
|
|
182
|
+
...y.props(c.grid)
|
|
183
|
+
}), /* @__PURE__ */ E("text", {
|
|
184
|
+
x: W - 8,
|
|
185
|
+
y: U(e),
|
|
135
186
|
textAnchor: "end",
|
|
136
187
|
dominantBaseline: "middle",
|
|
137
|
-
...
|
|
138
|
-
children:
|
|
188
|
+
...y.props(c.label),
|
|
189
|
+
children: l(e)
|
|
139
190
|
})] }, e)),
|
|
140
|
-
|
|
141
|
-
let
|
|
142
|
-
return /* @__PURE__ */
|
|
143
|
-
let o =
|
|
191
|
+
n.map((e, t) => {
|
|
192
|
+
let n = e.axisLabel ?? e.label;
|
|
193
|
+
return /* @__PURE__ */ D("g", { children: [a.map((n, i) => {
|
|
194
|
+
let o = n.values[t];
|
|
144
195
|
if (o == null) return null;
|
|
145
|
-
let
|
|
146
|
-
return /* @__PURE__ */
|
|
147
|
-
x: (
|
|
148
|
-
y: Math.min(
|
|
149
|
-
width:
|
|
150
|
-
height: Math.max(+(o === 0), Math.abs(
|
|
151
|
-
fill:
|
|
152
|
-
...
|
|
153
|
-
},
|
|
154
|
-
}), t %
|
|
155
|
-
x: (
|
|
156
|
-
y:
|
|
196
|
+
let l = s === "stacked" ? a.slice(0, i).reduce((e, n) => e + (n.values[t] ?? 0), 0) : 0, d = U(l), p = U(l + o), m = f?.selectedId === e.id || j?.id === e.id;
|
|
197
|
+
return /* @__PURE__ */ E(ee, {
|
|
198
|
+
x: (K(e.id) ?? W) + (s === "stacked" ? 0 : q(n.id) ?? 0),
|
|
199
|
+
y: Math.min(d, p),
|
|
200
|
+
width: s === "stacked" ? K.bandwidth() : q.bandwidth(),
|
|
201
|
+
height: Math.max(+(o === 0), Math.abs(p - d)),
|
|
202
|
+
fill: u[r(n.tone, i)],
|
|
203
|
+
...y.props(m && c.selected)
|
|
204
|
+
}, n.id);
|
|
205
|
+
}), t % J === 0 && /* @__PURE__ */ E("text", {
|
|
206
|
+
x: (K(e.id) ?? W) + K.bandwidth() / 2,
|
|
207
|
+
y: p - 4,
|
|
157
208
|
textAnchor: "middle",
|
|
158
|
-
...
|
|
159
|
-
children:
|
|
209
|
+
...y.props(c.label),
|
|
210
|
+
children: n.length > ie ? `${n.slice(0, ie - 1)}…` : n
|
|
160
211
|
})] }, e.id);
|
|
161
212
|
})
|
|
162
213
|
]
|
|
163
214
|
})
|
|
164
215
|
}),
|
|
165
|
-
|
|
166
|
-
id:
|
|
167
|
-
"aria-live":
|
|
168
|
-
className: "x78zum5 x1a02dak
|
|
169
|
-
children:
|
|
216
|
+
n.length > 0 && a.length > 0 && /* @__PURE__ */ E("div", {
|
|
217
|
+
id: b,
|
|
218
|
+
"aria-live": S?.source === "pointer" ? "off" : "polite",
|
|
219
|
+
className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1mqbd49 xy8obcc xas2l8k xss6m8b xj0a0fe",
|
|
220
|
+
children: B === void 0 ? /* @__PURE__ */ E("span", {
|
|
170
221
|
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
171
|
-
children:
|
|
172
|
-
}) : /* @__PURE__ */ T
|
|
222
|
+
children: P
|
|
223
|
+
}) : /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", { children: B.label }), a.map((e) => /* @__PURE__ */ D("span", { children: [
|
|
173
224
|
e.label,
|
|
174
225
|
":",
|
|
175
226
|
" ",
|
|
176
|
-
e.values[
|
|
227
|
+
e.values[V] === null || e.values[V] === void 0 ? "Unavailable" : l(e.values[V])
|
|
177
228
|
] }, e.id))] })
|
|
178
229
|
}),
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
items:
|
|
230
|
+
/* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(i, {
|
|
231
|
+
items: n.map((e, t) => ({
|
|
181
232
|
id: e.id,
|
|
182
233
|
label: e.label,
|
|
183
|
-
valueLabel:
|
|
234
|
+
valueLabel: z(a, t, l),
|
|
184
235
|
tone: "neutral"
|
|
185
236
|
})),
|
|
186
|
-
selection:
|
|
237
|
+
selection: f
|
|
187
238
|
}) })
|
|
188
239
|
]
|
|
189
240
|
});
|
|
190
241
|
}
|
|
242
|
+
function z(e, t, n) {
|
|
243
|
+
return e.map((e) => {
|
|
244
|
+
let r = e.values[t];
|
|
245
|
+
return `${e.label}: ${r == null ? "Unavailable" : n(r)}`;
|
|
246
|
+
}).join(" · ");
|
|
247
|
+
}
|
|
191
248
|
// packages/charts/src/cartesian/breakdown-bar.tsx
|
|
192
|
-
var
|
|
249
|
+
var B = {
|
|
193
250
|
kzqmXN: "x5lhr3w",
|
|
194
251
|
kZKoxP: "x5yr21d",
|
|
195
252
|
$$css: !0
|
|
196
|
-
},
|
|
197
|
-
|
|
253
|
+
}, V = { segment: (e, t) => [
|
|
254
|
+
B,
|
|
198
255
|
{
|
|
199
256
|
kWkggS: t == null ? t : "xl8spv7",
|
|
200
257
|
$$css: !0
|
|
@@ -204,56 +261,56 @@ var P = {
|
|
|
204
261
|
"--x-backgroundColor": t ?? void 0
|
|
205
262
|
}
|
|
206
263
|
] };
|
|
207
|
-
function
|
|
208
|
-
let d =
|
|
209
|
-
return d === void 0 ? !Number.isFinite(o) || o < 0 ||
|
|
210
|
-
title:
|
|
211
|
-
description:
|
|
264
|
+
function H({ title: e, description: n, items: a, total: o, formatValue: s, selection: c }) {
|
|
265
|
+
let d = t(a), f = a.reduce((e, t) => e + (t.value ?? 0), 0), p = 2 ** -52 * Math.max(f, o, 1) * a.length;
|
|
266
|
+
return d === void 0 ? !Number.isFinite(o) || o < 0 || f - o > p ? /* @__PURE__ */ E(m, {
|
|
267
|
+
title: e,
|
|
268
|
+
description: n,
|
|
212
269
|
message: "The total must be finite and at least the sum of recorded values."
|
|
213
|
-
}) : /* @__PURE__ */
|
|
214
|
-
title:
|
|
215
|
-
description:
|
|
216
|
-
children: a.length === 0 ? /* @__PURE__ */
|
|
270
|
+
}) : /* @__PURE__ */ E(l, {
|
|
271
|
+
title: e,
|
|
272
|
+
description: n,
|
|
273
|
+
children: a.length === 0 ? /* @__PURE__ */ E("p", {
|
|
217
274
|
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
218
275
|
children: "No values"
|
|
219
|
-
}) : /* @__PURE__ */ T
|
|
220
|
-
/* @__PURE__ */
|
|
276
|
+
}) : /* @__PURE__ */ D(T, { children: [
|
|
277
|
+
/* @__PURE__ */ E("div", {
|
|
221
278
|
"aria-hidden": !0,
|
|
222
279
|
className: "x78zum5 x170jfvy xb3r6kr x1r7kqkb xmkeg23 x1y0btm7 x1ey3b81 x1jfksii",
|
|
223
|
-
children: a.map((e, t) => e.value === null ? null : /* @__PURE__ */
|
|
280
|
+
children: a.map((e, t) => e.value === null ? null : /* @__PURE__ */ E("span", { ...y.props(V.segment(o === 0 ? 0 : e.value / o * 100, u[r(e.tone, t)])) }, e.id))
|
|
224
281
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
282
|
+
/* @__PURE__ */ E(i, {
|
|
226
283
|
items: a.map((e, t) => ({
|
|
227
284
|
id: e.id,
|
|
228
285
|
label: e.label,
|
|
229
|
-
valueLabel: e.value === null ? "Unavailable" :
|
|
230
|
-
tone:
|
|
286
|
+
valueLabel: e.value === null ? "Unavailable" : s(e.value),
|
|
287
|
+
tone: r(e.tone, t)
|
|
231
288
|
})),
|
|
232
|
-
selection:
|
|
289
|
+
selection: c
|
|
233
290
|
}),
|
|
234
|
-
o -
|
|
291
|
+
o - f > p && /* @__PURE__ */ D("p", {
|
|
235
292
|
className: "x153jb6y x1ghz6dp xy8obcc",
|
|
236
293
|
children: [
|
|
237
294
|
"Unassigned portion: ",
|
|
238
|
-
|
|
295
|
+
s(o - f),
|
|
239
296
|
" of ",
|
|
240
|
-
|
|
297
|
+
s(o)
|
|
241
298
|
]
|
|
242
299
|
})
|
|
243
300
|
] })
|
|
244
|
-
}) : /* @__PURE__ */
|
|
245
|
-
title:
|
|
246
|
-
description:
|
|
301
|
+
}) : /* @__PURE__ */ E(m, {
|
|
302
|
+
title: e,
|
|
303
|
+
description: n,
|
|
247
304
|
message: d
|
|
248
305
|
});
|
|
249
306
|
}
|
|
250
307
|
// packages/charts/src/cartesian/scatter-plot.tsx
|
|
251
|
-
var
|
|
308
|
+
var U = 260, W = 56, G = 20, K = 12, q = 1e3, re = {
|
|
252
309
|
kzqmXN: "x1xc55vz",
|
|
253
310
|
kZKoxP: "xdk7pt",
|
|
254
311
|
kaIpWk: "x16rqkct",
|
|
255
312
|
$$css: !0
|
|
256
|
-
},
|
|
313
|
+
}, J = {
|
|
257
314
|
brush: {
|
|
258
315
|
kFalU9: "xx69xxh",
|
|
259
316
|
kkrTdU: "xsid9ct",
|
|
@@ -271,14 +328,15 @@ var L = 260, R = 56, z = 20, B = 12, V = 1e3, H = {
|
|
|
271
328
|
kWkggS: "xjbqb8w",
|
|
272
329
|
kkrTdU: "x1ypdohk",
|
|
273
330
|
kfzvcC: "x67bb7w",
|
|
331
|
+
k3XXqK: "x1t137rt",
|
|
274
332
|
kPJHz1: "x13qnu6",
|
|
275
333
|
kZs9gx: "x19rmrnh",
|
|
276
334
|
k7shQP: "x9v5kkp",
|
|
277
335
|
kiEn40: "x175ew0f",
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
336
|
+
kmCx7Z: "x1e7sry0",
|
|
337
|
+
kJrEVn: "xehdg9o",
|
|
338
|
+
kLz2MD: "xp9r5ej",
|
|
339
|
+
k1CtGv: "xzgvv12",
|
|
282
340
|
$$css: !0
|
|
283
341
|
},
|
|
284
342
|
location: (e, t) => [{
|
|
@@ -290,7 +348,7 @@ var L = 260, R = 56, z = 20, B = 12, V = 1e3, H = {
|
|
|
290
348
|
"--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
291
349
|
}],
|
|
292
350
|
dot: (e) => [
|
|
293
|
-
|
|
351
|
+
re,
|
|
294
352
|
{
|
|
295
353
|
kWkggS: e == null ? e : "xl8spv7",
|
|
296
354
|
$$css: !0
|
|
@@ -305,73 +363,74 @@ var L = 260, R = 56, z = 20, B = 12, V = 1e3, H = {
|
|
|
305
363
|
$$css: !0
|
|
306
364
|
}
|
|
307
365
|
};
|
|
308
|
-
function
|
|
309
|
-
let { title: t, description: n, points: r, xDomain: i, yDomain:
|
|
310
|
-
if (
|
|
366
|
+
function ie(e) {
|
|
367
|
+
let { title: t, description: n, points: r, xDomain: i, yDomain: o, xLabel: c, yLabel: f, formatX: p, formatY: g, selection: _, rangeSelection: v, emptyLabel: b } = e, { ref: x, width: S } = h(), C = X(e);
|
|
368
|
+
if (C !== null) return /* @__PURE__ */ E(m, {
|
|
311
369
|
title: t,
|
|
312
370
|
description: n,
|
|
313
|
-
message:
|
|
371
|
+
message: C
|
|
314
372
|
});
|
|
315
|
-
let
|
|
373
|
+
let w = k({
|
|
316
374
|
domain: [...i],
|
|
317
|
-
range: [
|
|
318
|
-
}),
|
|
319
|
-
domain: [...
|
|
320
|
-
range: [216,
|
|
321
|
-
});
|
|
322
|
-
return /* @__PURE__ */
|
|
375
|
+
range: [W, Math.max(W, S - G)]
|
|
376
|
+
}), T = k({
|
|
377
|
+
domain: [...o],
|
|
378
|
+
range: [216, K]
|
|
379
|
+
}), O = r.find((e) => e.id === _?.selectedId);
|
|
380
|
+
return /* @__PURE__ */ D(l, {
|
|
323
381
|
title: t,
|
|
324
382
|
description: n,
|
|
383
|
+
footer: _ !== void 0 && r.length > 0 ? /* @__PURE__ */ E(a, { children: O === void 0 ? "Select a point to inspect its label and coordinates." : `${O.label}, ${c}: ${p(O.x)}, ${f}: ${g(O.y)}` }) : void 0,
|
|
325
384
|
children: [
|
|
326
|
-
r.length === 0 ? /* @__PURE__ */
|
|
385
|
+
r.length === 0 ? /* @__PURE__ */ E("p", {
|
|
327
386
|
className: "x1ghz6dp x153jb6y",
|
|
328
|
-
children:
|
|
329
|
-
}) : /* @__PURE__ */
|
|
330
|
-
ref:
|
|
387
|
+
children: b
|
|
388
|
+
}) : /* @__PURE__ */ D("div", {
|
|
389
|
+
ref: x,
|
|
331
390
|
className: "x1n2onr6 xeuugli",
|
|
332
|
-
children: [/* @__PURE__ */
|
|
333
|
-
width:
|
|
334
|
-
scaleX:
|
|
335
|
-
scaleY:
|
|
391
|
+
children: [/* @__PURE__ */ E(Y, {
|
|
392
|
+
width: S,
|
|
393
|
+
scaleX: w,
|
|
394
|
+
scaleY: T,
|
|
336
395
|
...e
|
|
337
|
-
}, `${i[0]}:${i[1]}:${
|
|
396
|
+
}, `${i[0]}:${i[1]}:${o[0]}:${o[1]}:${S}`), _ !== void 0 && /* @__PURE__ */ E("div", {
|
|
338
397
|
className: "x10l6tqk x10a8y8t x1n71m9f x47corl",
|
|
339
|
-
children: r.map((e) => /* @__PURE__ */
|
|
398
|
+
children: r.map((e) => /* @__PURE__ */ E("button", {
|
|
340
399
|
type: "button",
|
|
341
400
|
title: e.label,
|
|
342
|
-
"aria-label": `${e.label}, ${
|
|
343
|
-
"aria-pressed":
|
|
344
|
-
onClick: () =>
|
|
345
|
-
...
|
|
346
|
-
children: /* @__PURE__ */
|
|
401
|
+
"aria-label": `${e.label}, ${c}: ${p(e.x)}, ${f}: ${g(e.y)}`,
|
|
402
|
+
"aria-pressed": _.selectedId === e.id,
|
|
403
|
+
onClick: () => _.onSelect(e.id),
|
|
404
|
+
...y.props(J.target, J.location(w(e.x), T(e.y))),
|
|
405
|
+
children: /* @__PURE__ */ E("span", {
|
|
347
406
|
"aria-hidden": !0,
|
|
348
|
-
...
|
|
407
|
+
...y.props(J.dot(u[e.tone]), _.selectedId === e.id && J.selected)
|
|
349
408
|
})
|
|
350
409
|
}, e.id))
|
|
351
410
|
})]
|
|
352
411
|
}),
|
|
353
|
-
v !== void 0 && /* @__PURE__ */
|
|
412
|
+
v !== void 0 && /* @__PURE__ */ E(ae, {
|
|
354
413
|
...e,
|
|
355
414
|
rangeSelection: v
|
|
356
415
|
}),
|
|
357
|
-
r.length > 0 && /* @__PURE__ */
|
|
358
|
-
label: `${e.label}, ${
|
|
359
|
-
selected:
|
|
360
|
-
onSelect:
|
|
361
|
-
children: [/* @__PURE__ */
|
|
362
|
-
className: "xss6m8b
|
|
416
|
+
r.length > 0 && /* @__PURE__ */ E(d, { children: r.map((e) => /* @__PURE__ */ D(s, {
|
|
417
|
+
label: `${e.label}, ${c}: ${p(e.x)}, ${f}: ${g(e.y)}`,
|
|
418
|
+
selected: _?.selectedId === e.id,
|
|
419
|
+
onSelect: _ === void 0 ? void 0 : () => _.onSelect(e.id),
|
|
420
|
+
children: [/* @__PURE__ */ E("span", { children: e.label }), /* @__PURE__ */ D("span", {
|
|
421
|
+
className: "xeuugli xss6m8b xj0a0fe x153jb6y",
|
|
363
422
|
children: [
|
|
364
|
-
|
|
423
|
+
p(e.x),
|
|
365
424
|
" · ",
|
|
366
|
-
|
|
425
|
+
g(e.y)
|
|
367
426
|
]
|
|
368
427
|
})]
|
|
369
428
|
}, e.id)) })
|
|
370
429
|
]
|
|
371
430
|
});
|
|
372
431
|
}
|
|
373
|
-
function
|
|
374
|
-
let f =
|
|
432
|
+
function Y({ width: e, scaleX: t, scaleY: n, points: r, xLabel: i, yLabel: a, formatX: o, formatY: s, selection: l, rangeSelection: d }) {
|
|
433
|
+
let f = x(), [p, m] = w(null), h = p === null ? d?.value : {
|
|
375
434
|
x: [Math.min(p.start.x, p.end.x), Math.max(p.start.x, p.end.x)],
|
|
376
435
|
y: [Math.min(p.start.y, p.end.y), Math.max(p.start.y, p.end.y)]
|
|
377
436
|
};
|
|
@@ -379,13 +438,13 @@ function G({ width: e, scaleX: t, scaleY: n, points: r, xLabel: a, yLabel: o, fo
|
|
|
379
438
|
let i = r.currentTarget.getBoundingClientRect();
|
|
380
439
|
return {
|
|
381
440
|
x: t.copy().clamp(!0).invert((r.clientX - i.left) / i.width * e),
|
|
382
|
-
y: n.copy().clamp(!0).invert((r.clientY - i.top) / i.height *
|
|
441
|
+
y: n.copy().clamp(!0).invert((r.clientY - i.top) / i.height * U)
|
|
383
442
|
};
|
|
384
443
|
}
|
|
385
|
-
function
|
|
444
|
+
function _(t) {
|
|
386
445
|
if (d === void 0 || t.button !== 0 || t.pointerType === "touch") return;
|
|
387
|
-
let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height *
|
|
388
|
-
if (r <
|
|
446
|
+
let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height * U;
|
|
447
|
+
if (r < W || r > e - G || i < K || i > 216) return;
|
|
389
448
|
let a = g(t);
|
|
390
449
|
t.currentTarget.setPointerCapture(t.pointerId), m({
|
|
391
450
|
start: a,
|
|
@@ -393,13 +452,13 @@ function G({ width: e, scaleX: t, scaleY: n, points: r, xLabel: a, yLabel: o, fo
|
|
|
393
452
|
pointerId: t.pointerId
|
|
394
453
|
});
|
|
395
454
|
}
|
|
396
|
-
function
|
|
455
|
+
function v(e) {
|
|
397
456
|
p !== null && p.pointerId === e.pointerId && m({
|
|
398
457
|
...p,
|
|
399
458
|
end: g(e)
|
|
400
459
|
});
|
|
401
460
|
}
|
|
402
|
-
function
|
|
461
|
+
function b(e) {
|
|
403
462
|
if (p === null || p.pointerId !== e.pointerId) return;
|
|
404
463
|
let t = g(e), n = {
|
|
405
464
|
x: [Math.min(p.start.x, t.x), Math.max(p.start.x, t.x)],
|
|
@@ -407,99 +466,99 @@ function G({ width: e, scaleX: t, scaleY: n, points: r, xLabel: a, yLabel: o, fo
|
|
|
407
466
|
};
|
|
408
467
|
m(null), e.currentTarget.releasePointerCapture(e.pointerId), d?.onChange(n);
|
|
409
468
|
}
|
|
410
|
-
return /* @__PURE__ */
|
|
469
|
+
return /* @__PURE__ */ D("svg", {
|
|
411
470
|
width: e,
|
|
412
|
-
height:
|
|
413
|
-
viewBox: `0 0 ${e} ${
|
|
471
|
+
height: U,
|
|
472
|
+
viewBox: `0 0 ${e} ${U}`,
|
|
414
473
|
"aria-hidden": !0,
|
|
415
|
-
onPointerDown:
|
|
416
|
-
onPointerMove:
|
|
417
|
-
onPointerUp:
|
|
474
|
+
onPointerDown: _,
|
|
475
|
+
onPointerMove: v,
|
|
476
|
+
onPointerUp: b,
|
|
418
477
|
onPointerCancel: () => m(null),
|
|
419
478
|
onLostPointerCapture: () => m(null),
|
|
420
|
-
...
|
|
479
|
+
...y.props(c.svg, d !== void 0 && J.brush),
|
|
421
480
|
children: [
|
|
422
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ E("defs", { children: /* @__PURE__ */ E("clipPath", {
|
|
423
482
|
id: f,
|
|
424
|
-
children: /* @__PURE__ */
|
|
425
|
-
x:
|
|
426
|
-
y:
|
|
427
|
-
width: Math.max(0, e -
|
|
483
|
+
children: /* @__PURE__ */ E("rect", {
|
|
484
|
+
x: W,
|
|
485
|
+
y: K,
|
|
486
|
+
width: Math.max(0, e - W - G),
|
|
428
487
|
height: 204
|
|
429
488
|
})
|
|
430
489
|
}) }),
|
|
431
|
-
t.ticks(5).map((e) => /* @__PURE__ */
|
|
490
|
+
t.ticks(5).map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
|
|
432
491
|
x1: t(e),
|
|
433
492
|
x2: t(e),
|
|
434
|
-
y1:
|
|
493
|
+
y1: K,
|
|
435
494
|
y2: 216,
|
|
436
|
-
...
|
|
437
|
-
}), /* @__PURE__ */
|
|
495
|
+
...y.props(c.grid)
|
|
496
|
+
}), /* @__PURE__ */ E("text", {
|
|
438
497
|
x: t(e),
|
|
439
498
|
y: 234,
|
|
440
499
|
textAnchor: "middle",
|
|
441
|
-
...
|
|
442
|
-
children:
|
|
500
|
+
...y.props(c.label),
|
|
501
|
+
children: o(e)
|
|
443
502
|
})] }, e)),
|
|
444
|
-
n.ticks(4).map((t) => /* @__PURE__ */
|
|
445
|
-
x1:
|
|
446
|
-
x2: e -
|
|
503
|
+
n.ticks(4).map((t) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
|
|
504
|
+
x1: W,
|
|
505
|
+
x2: e - G,
|
|
447
506
|
y1: n(t),
|
|
448
507
|
y2: n(t),
|
|
449
|
-
...
|
|
450
|
-
}), /* @__PURE__ */
|
|
508
|
+
...y.props(c.grid)
|
|
509
|
+
}), /* @__PURE__ */ E("text", {
|
|
451
510
|
x: 48,
|
|
452
511
|
y: n(t) + 4,
|
|
453
512
|
textAnchor: "end",
|
|
454
|
-
...
|
|
455
|
-
children:
|
|
513
|
+
...y.props(c.label),
|
|
514
|
+
children: s(t)
|
|
456
515
|
})] }, t)),
|
|
457
|
-
/* @__PURE__ */
|
|
458
|
-
x: (
|
|
516
|
+
/* @__PURE__ */ E("text", {
|
|
517
|
+
x: (W + e - G) / 2,
|
|
459
518
|
y: 256,
|
|
460
519
|
textAnchor: "middle",
|
|
461
|
-
...
|
|
462
|
-
children:
|
|
520
|
+
...y.props(c.label),
|
|
521
|
+
children: i
|
|
463
522
|
}),
|
|
464
|
-
/* @__PURE__ */
|
|
523
|
+
/* @__PURE__ */ E("text", {
|
|
465
524
|
x: 12,
|
|
466
525
|
y: 108,
|
|
467
526
|
textAnchor: "middle",
|
|
468
527
|
transform: "rotate(-90 12 108)",
|
|
469
|
-
...
|
|
470
|
-
children:
|
|
528
|
+
...y.props(c.label),
|
|
529
|
+
children: a
|
|
471
530
|
}),
|
|
472
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ D("g", {
|
|
473
532
|
clipPath: `url(#${f})`,
|
|
474
|
-
children: [h != null && /* @__PURE__ */
|
|
533
|
+
children: [h != null && /* @__PURE__ */ E("rect", {
|
|
475
534
|
x: t(h.x[0]),
|
|
476
535
|
y: n(h.y[1]),
|
|
477
536
|
width: t(h.x[1]) - t(h.x[0]),
|
|
478
537
|
height: n(h.y[0]) - n(h.y[1]),
|
|
479
538
|
className: "x1e0kj8g xv7c1pl x1tg5nk6 xnpr05h x15lqr97 x47corl"
|
|
480
|
-
}),
|
|
539
|
+
}), l === void 0 && r.map((e) => /* @__PURE__ */ E("circle", {
|
|
481
540
|
cx: t(e.x),
|
|
482
541
|
cy: n(e.y),
|
|
483
542
|
r: 4,
|
|
484
|
-
fill:
|
|
543
|
+
fill: u[e.tone]
|
|
485
544
|
}, e.id))]
|
|
486
545
|
})
|
|
487
546
|
]
|
|
488
547
|
});
|
|
489
548
|
}
|
|
490
|
-
function
|
|
549
|
+
function ae({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
|
|
491
550
|
let s = e.value ?? {
|
|
492
551
|
x: t,
|
|
493
552
|
y: n
|
|
494
553
|
};
|
|
495
|
-
return /* @__PURE__ */
|
|
554
|
+
return /* @__PURE__ */ D("fieldset", {
|
|
496
555
|
className: "xrvj5dj x1n8ia3y x1xxf3xd xc342km x1717udv xeuugli",
|
|
497
556
|
children: [
|
|
498
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ E("legend", {
|
|
499
558
|
className: "x153jb6y xy8obcc x1jfksii",
|
|
500
559
|
children: "Drag with a mouse, or adjust these bounds to select a coordinate range."
|
|
501
560
|
}),
|
|
502
|
-
/* @__PURE__ */
|
|
561
|
+
/* @__PURE__ */ D(_.Root, {
|
|
503
562
|
value: s.x,
|
|
504
563
|
min: t[0],
|
|
505
564
|
max: t[1],
|
|
@@ -510,28 +569,28 @@ function K({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
|
|
|
510
569
|
x: t,
|
|
511
570
|
y: s.y
|
|
512
571
|
}),
|
|
513
|
-
children: [/* @__PURE__ */
|
|
514
|
-
className: "x78zum5 x1qughib x1hnptsi x153jb6y xy8obcc",
|
|
515
|
-
children: [/* @__PURE__ */
|
|
572
|
+
children: [/* @__PURE__ */ D("div", {
|
|
573
|
+
className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
|
|
574
|
+
children: [/* @__PURE__ */ E(_.Label, { children: r }), /* @__PURE__ */ D("span", { children: [
|
|
516
575
|
a(s.x[0]),
|
|
517
576
|
" – ",
|
|
518
577
|
a(s.x[1])
|
|
519
578
|
] })]
|
|
520
|
-
}), /* @__PURE__ */
|
|
521
|
-
/* @__PURE__ */
|
|
522
|
-
/* @__PURE__ */
|
|
579
|
+
}), /* @__PURE__ */ E(_.Control, { children: /* @__PURE__ */ D(_.Track, { children: [
|
|
580
|
+
/* @__PURE__ */ E(_.Indicator, {}),
|
|
581
|
+
/* @__PURE__ */ E(_.Thumb, {
|
|
523
582
|
index: 0,
|
|
524
583
|
"aria-label": `${r} minimum`,
|
|
525
584
|
getAriaValueText: (e, t) => a(t)
|
|
526
585
|
}),
|
|
527
|
-
/* @__PURE__ */
|
|
586
|
+
/* @__PURE__ */ E(_.Thumb, {
|
|
528
587
|
index: 1,
|
|
529
588
|
"aria-label": `${r} maximum`,
|
|
530
589
|
getAriaValueText: (e, t) => a(t)
|
|
531
590
|
})
|
|
532
591
|
] }) })]
|
|
533
592
|
}),
|
|
534
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ D(_.Root, {
|
|
535
594
|
value: s.y,
|
|
536
595
|
min: n[0],
|
|
537
596
|
max: n[1],
|
|
@@ -542,28 +601,28 @@ function K({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
|
|
|
542
601
|
x: s.x,
|
|
543
602
|
y: t
|
|
544
603
|
}),
|
|
545
|
-
children: [/* @__PURE__ */
|
|
546
|
-
className: "x78zum5 x1qughib x1hnptsi x153jb6y xy8obcc",
|
|
547
|
-
children: [/* @__PURE__ */
|
|
604
|
+
children: [/* @__PURE__ */ D("div", {
|
|
605
|
+
className: "x78zum5 x1a02dak x1qughib x1hnptsi x153jb6y xy8obcc xj0a0fe",
|
|
606
|
+
children: [/* @__PURE__ */ E(_.Label, { children: i }), /* @__PURE__ */ D("span", { children: [
|
|
548
607
|
o(s.y[0]),
|
|
549
608
|
" – ",
|
|
550
609
|
o(s.y[1])
|
|
551
610
|
] })]
|
|
552
|
-
}), /* @__PURE__ */
|
|
553
|
-
/* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
611
|
+
}), /* @__PURE__ */ E(_.Control, { children: /* @__PURE__ */ D(_.Track, { children: [
|
|
612
|
+
/* @__PURE__ */ E(_.Indicator, {}),
|
|
613
|
+
/* @__PURE__ */ E(_.Thumb, {
|
|
555
614
|
index: 0,
|
|
556
615
|
"aria-label": `${i} minimum`,
|
|
557
616
|
getAriaValueText: (e, t) => o(t)
|
|
558
617
|
}),
|
|
559
|
-
/* @__PURE__ */
|
|
618
|
+
/* @__PURE__ */ E(_.Thumb, {
|
|
560
619
|
index: 1,
|
|
561
620
|
"aria-label": `${i} maximum`,
|
|
562
621
|
getAriaValueText: (e, t) => o(t)
|
|
563
622
|
})
|
|
564
623
|
] }) })]
|
|
565
624
|
}),
|
|
566
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ E(g, {
|
|
567
626
|
type: "button",
|
|
568
627
|
disabled: e.value === null,
|
|
569
628
|
onClick: () => e.onChange(null),
|
|
@@ -572,10 +631,10 @@ function K({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, fo
|
|
|
572
631
|
]
|
|
573
632
|
});
|
|
574
633
|
}
|
|
575
|
-
function
|
|
576
|
-
if (!
|
|
577
|
-
if (e.length > 1e3) return `This plot exceeds the ${
|
|
578
|
-
if (!
|
|
634
|
+
function X({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
|
|
635
|
+
if (!p(t) || !p(n)) return "Scatter domains must contain finite, increasing endpoints.";
|
|
636
|
+
if (e.length > 1e3) return `This plot exceeds the ${q}-point render limit. Supply a smaller, labelled sample.`;
|
|
637
|
+
if (!f(e)) return "Scatter points must have unique identifiers.";
|
|
579
638
|
if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
|
|
580
639
|
if (e.some((e) => {
|
|
581
640
|
let r = e.x < t[0] || e.x > t[1], i = e.y < n[0] || e.y > n[1];
|
|
@@ -585,18 +644,18 @@ function q({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
|
|
|
585
644
|
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];
|
|
586
645
|
if (!i || !a) return "Range selection steps must be finite, positive, and no larger than their domain span.";
|
|
587
646
|
let o = r.value;
|
|
588
|
-
return o === null ? null : !
|
|
647
|
+
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;
|
|
589
648
|
}
|
|
590
|
-
function
|
|
649
|
+
function Z(e, t) {
|
|
591
650
|
return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
|
|
592
651
|
}
|
|
593
652
|
// packages/charts/src/cartesian/time-series-data.ts
|
|
594
|
-
var
|
|
653
|
+
var Q = {
|
|
595
654
|
series: 12,
|
|
596
655
|
pointsPerSeries: 2e3,
|
|
597
656
|
markers: 200,
|
|
598
657
|
panels: 12
|
|
599
|
-
},
|
|
658
|
+
}, oe = .01, $ = [
|
|
600
659
|
"series1",
|
|
601
660
|
"series2",
|
|
602
661
|
"series3",
|
|
@@ -604,13 +663,13 @@ var Y = {
|
|
|
604
663
|
"series5",
|
|
605
664
|
"series6"
|
|
606
665
|
];
|
|
607
|
-
function
|
|
666
|
+
function se({ series: e, isStacked: t, markers: n }) {
|
|
608
667
|
let r = e[0]?.points.map((e) => e.timestamp) ?? [];
|
|
609
|
-
if (e.length >
|
|
610
|
-
if (!
|
|
668
|
+
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.`;
|
|
669
|
+
if (!f(e) || !f(n)) return "Series and markers require unique identifiers.";
|
|
611
670
|
for (let n of e) {
|
|
612
671
|
if (n.points.length !== r.length) return "Every series must supply the same observation timestamps.";
|
|
613
|
-
let e =
|
|
672
|
+
let e = de({
|
|
614
673
|
points: n.points,
|
|
615
674
|
timestamps: r,
|
|
616
675
|
isStacked: t
|
|
@@ -628,7 +687,7 @@ function re({ series: e, isStacked: t, markers: n }) {
|
|
|
628
687
|
if (!Number.isFinite(a) || !Number.isFinite(o)) return "The elapsed-time and value ranges must be finite.";
|
|
629
688
|
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.";
|
|
630
689
|
}
|
|
631
|
-
function
|
|
690
|
+
function ce({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
|
|
632
691
|
return JSON.stringify([
|
|
633
692
|
n,
|
|
634
693
|
r,
|
|
@@ -648,15 +707,15 @@ function ie({ series: e, markers: t, timestampUnit: n, isStacked: r }) {
|
|
|
648
707
|
])
|
|
649
708
|
]);
|
|
650
709
|
}
|
|
651
|
-
function
|
|
710
|
+
function le(e, t, n = !1) {
|
|
652
711
|
if (e !== t) return [e, t];
|
|
653
|
-
let r = Math.max(1, Math.abs(e) *
|
|
712
|
+
let r = Math.max(1, Math.abs(e) * oe), i = n ? 0 : e - r, a = t + r;
|
|
654
713
|
return [Number.isFinite(i) ? i : e, Number.isFinite(a) ? a : t];
|
|
655
714
|
}
|
|
656
|
-
function
|
|
715
|
+
function ue(e, t) {
|
|
657
716
|
let n = e.filter((e) => e.tone === void 0);
|
|
658
717
|
return e.map((r, i) => {
|
|
659
|
-
let a = n.findIndex((e) => e.id === r.id), o = r.tone ??
|
|
718
|
+
let a = n.findIndex((e) => e.id === r.id), o = r.tone ?? $[a % $.length] ?? "series1", s = r.points.map((n, r) => {
|
|
660
719
|
let a = t ? e.slice(0, i).reduce((e, t) => e + (t.points[r]?.value ?? 0), 0) : 0;
|
|
661
720
|
return {
|
|
662
721
|
...n,
|
|
@@ -671,7 +730,7 @@ function oe(e, t) {
|
|
|
671
730
|
};
|
|
672
731
|
});
|
|
673
732
|
}
|
|
674
|
-
function
|
|
733
|
+
function de({ points: e, timestamps: t, isStacked: n }) {
|
|
675
734
|
for (let [r, i] of e.entries()) {
|
|
676
735
|
let a = e[r - 1], o = a !== void 0 && i.timestamp <= a.timestamp;
|
|
677
736
|
if (!Number.isFinite(i.timestamp) || i.timestamp !== t[r] || o) return "Observation timestamps must be finite, aligned, and strictly increasing.";
|
|
@@ -680,49 +739,49 @@ function X({ points: e, timestamps: t, isStacked: n }) {
|
|
|
680
739
|
}
|
|
681
740
|
}
|
|
682
741
|
// packages/charts/src/cartesian/time-series-line.tsx
|
|
683
|
-
function
|
|
684
|
-
return /* @__PURE__ */ T
|
|
742
|
+
function fe({ series: e, x: t, y: n, inspectedTimestamp: r, pointRadius: i = 3 }) {
|
|
743
|
+
return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(j, {
|
|
685
744
|
data: [...e.points],
|
|
686
745
|
defined: (e) => e.value !== null,
|
|
687
746
|
x: (e) => t(e.timestamp),
|
|
688
747
|
y: (e) => n((e.value ?? 0) + e.base),
|
|
689
|
-
stroke:
|
|
690
|
-
...
|
|
748
|
+
stroke: u[e.tone],
|
|
749
|
+
...y.props(c.mark)
|
|
691
750
|
}), e.points.filter((t, n) => {
|
|
692
751
|
if (t.value === null) return !1;
|
|
693
752
|
let i = e.points[n - 1]?.value === null || e.points[n + 1]?.value === null;
|
|
694
753
|
return e.points.length === 1 || i || t.timestamp === r;
|
|
695
|
-
}).map((r) => /* @__PURE__ */
|
|
754
|
+
}).map((r) => /* @__PURE__ */ E("circle", {
|
|
696
755
|
cx: t(r.timestamp),
|
|
697
756
|
cy: n((r.value ?? 0) + r.base),
|
|
698
|
-
r:
|
|
699
|
-
fill:
|
|
757
|
+
r: i,
|
|
758
|
+
fill: u[e.tone]
|
|
700
759
|
}, r.timestamp))] });
|
|
701
760
|
}
|
|
702
761
|
// packages/charts/src/cartesian/sparkline.tsx
|
|
703
|
-
function
|
|
704
|
-
let o =
|
|
762
|
+
function pe({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueDomain: a }) {
|
|
763
|
+
let o = x(), s = x(), c = me({
|
|
705
764
|
title: e,
|
|
706
765
|
summary: t,
|
|
707
766
|
unit: n,
|
|
708
767
|
series: i,
|
|
709
768
|
valueDomain: a
|
|
710
769
|
}), l = i.points.some((e) => e.value !== null);
|
|
711
|
-
if (c !== void 0 || !l) return /* @__PURE__ */
|
|
770
|
+
if (c !== void 0 || !l) return /* @__PURE__ */ E("span", {
|
|
712
771
|
role: "img",
|
|
713
|
-
"aria-label": `${e}. ${c ?? "No recorded values. Missing observations remain unavailable."}`,
|
|
772
|
+
"aria-label": `${e}. ${t} Values in ${n}; timestamps in ${r}. ${c ?? "No recorded values. Missing observations remain unavailable."}`,
|
|
714
773
|
title: c ?? "No recorded values",
|
|
715
774
|
className: "x2pejg6 x10w6t97 x2lah0s xxymvpz x3nfvp2 x6s0dn4 xl56j7k x153jb6y x1hz01jw xy8obcc",
|
|
716
775
|
children: c === void 0 ? "No data" : "Invalid trend"
|
|
717
776
|
});
|
|
718
|
-
let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f =
|
|
719
|
-
domain: [...
|
|
777
|
+
let u = i.points[0]?.timestamp ?? 0, d = i.points.at(-1)?.timestamp ?? u, f = k({
|
|
778
|
+
domain: [...le(u, d)],
|
|
720
779
|
range: [3, 125]
|
|
721
|
-
}), p =
|
|
780
|
+
}), p = k({
|
|
722
781
|
domain: [...a],
|
|
723
782
|
range: [29, 3]
|
|
724
|
-
}), m =
|
|
725
|
-
return /* @__PURE__ */
|
|
783
|
+
}), m = ue([i], !1)[0];
|
|
784
|
+
return /* @__PURE__ */ D("svg", {
|
|
726
785
|
role: "img",
|
|
727
786
|
"aria-labelledby": o,
|
|
728
787
|
"aria-describedby": s,
|
|
@@ -732,11 +791,11 @@ function ce({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
|
|
|
732
791
|
height: 32,
|
|
733
792
|
className: "x1rg5ohu x2pejg6 x10w6t97 x2lah0s xxymvpz",
|
|
734
793
|
children: [
|
|
735
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ E("title", {
|
|
736
795
|
id: o,
|
|
737
796
|
children: e
|
|
738
797
|
}),
|
|
739
|
-
/* @__PURE__ */
|
|
798
|
+
/* @__PURE__ */ D("desc", {
|
|
740
799
|
id: s,
|
|
741
800
|
children: [
|
|
742
801
|
t,
|
|
@@ -754,7 +813,7 @@ function ce({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
|
|
|
754
813
|
"."
|
|
755
814
|
]
|
|
756
815
|
}),
|
|
757
|
-
m !== void 0 && /* @__PURE__ */
|
|
816
|
+
m !== void 0 && /* @__PURE__ */ E(fe, {
|
|
758
817
|
series: m,
|
|
759
818
|
x: f,
|
|
760
819
|
y: p,
|
|
@@ -763,10 +822,10 @@ function ce({ title: e, summary: t, unit: n, timestampUnit: r, series: i, valueD
|
|
|
763
822
|
]
|
|
764
823
|
});
|
|
765
824
|
}
|
|
766
|
-
function
|
|
825
|
+
function me({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
|
|
767
826
|
if (e.trim() === "" || t.trim() === "" || n.trim() === "") return "A trend requires a title, a readable summary, and a value unit.";
|
|
768
|
-
if (!
|
|
769
|
-
let a =
|
|
827
|
+
if (!p(i)) return "The displayed value domain must have finite, increasing bounds.";
|
|
828
|
+
let a = se({
|
|
770
829
|
series: [r],
|
|
771
830
|
isStacked: !1,
|
|
772
831
|
markers: []
|
|
@@ -775,71 +834,92 @@ function Z({ title: e, summary: t, unit: n, series: r, valueDomain: i }) {
|
|
|
775
834
|
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.";
|
|
776
835
|
}
|
|
777
836
|
// packages/charts/src/cartesian/time-series.tsx
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
837
|
+
var he = {
|
|
838
|
+
plot: {
|
|
839
|
+
k7Eaqz: "xeuugli",
|
|
840
|
+
k3XXqK: "x1t137rt",
|
|
841
|
+
kInvED: "x2ssjo2",
|
|
842
|
+
kZs9gx: "x19rmrnh",
|
|
843
|
+
k7shQP: "x9v5kkp",
|
|
844
|
+
kPJHz1: "x13qnu6",
|
|
845
|
+
$$css: !0
|
|
846
|
+
},
|
|
847
|
+
timeAxis: {
|
|
848
|
+
k1xSpc: "x78zum5",
|
|
849
|
+
kjj79g: "x1qughib",
|
|
850
|
+
k1C7PZ: "x8zbtdt",
|
|
851
|
+
keoZOQ: "x1c87qhr",
|
|
852
|
+
kGuDYH: "xy8obcc",
|
|
853
|
+
kLWn49: "xas2l8k",
|
|
854
|
+
kMwMTN: "x153jb6y",
|
|
855
|
+
kcqcaj: "xss6m8b",
|
|
856
|
+
$$css: !0
|
|
857
|
+
},
|
|
858
|
+
timeAxisInset: (e, t) => [{
|
|
859
|
+
kZCmMZ: e == null ? e : "xnvo3vl",
|
|
860
|
+
kwRFfy: t == null ? t : "x120eax6",
|
|
861
|
+
$$css: !0
|
|
862
|
+
}, {
|
|
863
|
+
"--x-paddingInlineStart": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
864
|
+
"--x-paddingInlineEnd": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
865
|
+
}]
|
|
866
|
+
};
|
|
867
|
+
function ge(e) {
|
|
868
|
+
return /* @__PURE__ */ E(ye, {
|
|
789
869
|
...e,
|
|
790
870
|
kind: "line",
|
|
791
871
|
stacked: !1
|
|
792
872
|
});
|
|
793
873
|
}
|
|
794
|
-
function
|
|
795
|
-
return /* @__PURE__ */
|
|
874
|
+
function _e({ stacked: e = !1, ...t }) {
|
|
875
|
+
return /* @__PURE__ */ E(ye, {
|
|
796
876
|
...t,
|
|
797
877
|
kind: "area",
|
|
798
878
|
stacked: e
|
|
799
879
|
});
|
|
800
880
|
}
|
|
801
|
-
function
|
|
802
|
-
let n =
|
|
881
|
+
function ve({ charts: e, ...t }) {
|
|
882
|
+
let n = C(null), [r, i] = w(), a = JSON.stringify(e.map((e) => [
|
|
803
883
|
e.id,
|
|
804
884
|
e.title,
|
|
805
|
-
|
|
885
|
+
ce({
|
|
806
886
|
series: e.series,
|
|
807
887
|
markers: e.markers ?? [],
|
|
808
888
|
timestampUnit: t.timestampUnit,
|
|
809
889
|
isStacked: !1
|
|
810
890
|
})
|
|
811
891
|
])), 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);
|
|
812
|
-
if (r !== void 0 && r.signature !== a && i(void 0),
|
|
892
|
+
if (r !== void 0 && r.signature !== a && i(void 0), b(() => {
|
|
813
893
|
function e(e) {
|
|
814
894
|
e.target instanceof Node && n.current?.contains(e.target) !== !0 && i(void 0);
|
|
815
895
|
}
|
|
816
896
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
817
|
-
}, []), !s || !
|
|
897
|
+
}, []), !s || !f(e)) return /* @__PURE__ */ E(m, {
|
|
818
898
|
title: "Small multiples",
|
|
819
899
|
message: "Charts need unique identifiers and aligned observation timestamps."
|
|
820
900
|
});
|
|
821
|
-
if (e.length >
|
|
901
|
+
if (e.length > Q.panels) return /* @__PURE__ */ E(m, {
|
|
822
902
|
title: "Small multiples",
|
|
823
|
-
message: `Choose at most ${
|
|
903
|
+
message: `Choose at most ${Q.panels} panels.`
|
|
824
904
|
});
|
|
825
|
-
if (e.length === 0) return /* @__PURE__ */
|
|
905
|
+
if (e.length === 0) return /* @__PURE__ */ E(l, {
|
|
826
906
|
title: "Small multiples",
|
|
827
|
-
children: /* @__PURE__ */
|
|
907
|
+
children: /* @__PURE__ */ E("p", {
|
|
828
908
|
className: "x153jb6y",
|
|
829
909
|
children: "No charts"
|
|
830
910
|
})
|
|
831
911
|
});
|
|
832
|
-
let
|
|
912
|
+
let c = {
|
|
833
913
|
value: r?.signature === a ? r : void 0,
|
|
834
914
|
onChange: (e) => i(e === void 0 ? void 0 : {
|
|
835
915
|
...e,
|
|
836
916
|
signature: a
|
|
837
917
|
})
|
|
838
|
-
},
|
|
839
|
-
return /* @__PURE__ */
|
|
918
|
+
}, u = Math.max(52, ...e.flatMap((e) => e.series.flatMap((t) => t.points.flatMap((t) => t.value === null || !Number.isFinite(t.value) ? [] : [e.formatValue(t.value).length * 7 + 12]))));
|
|
919
|
+
return /* @__PURE__ */ E("div", {
|
|
840
920
|
ref: n,
|
|
841
921
|
className: "xrvj5dj x1j825kq",
|
|
842
|
-
children: e.map((e) => /* @__PURE__ */
|
|
922
|
+
children: e.map((e) => /* @__PURE__ */ E(ye, {
|
|
843
923
|
...t,
|
|
844
924
|
title: e.title,
|
|
845
925
|
description: e.description,
|
|
@@ -848,73 +928,74 @@ function de({ charts: e, ...t }) {
|
|
|
848
928
|
markers: e.markers,
|
|
849
929
|
kind: "line",
|
|
850
930
|
stacked: !1,
|
|
851
|
-
sharedInspection:
|
|
852
|
-
axisWidth:
|
|
931
|
+
sharedInspection: c,
|
|
932
|
+
axisWidth: u
|
|
853
933
|
}, e.id))
|
|
854
934
|
});
|
|
855
935
|
}
|
|
856
|
-
function
|
|
857
|
-
let j = !Number.isFinite(
|
|
936
|
+
function ye({ title: e, description: t, series: n, timestampUnit: r, formatTimestamp: i, formatValue: a, markers: s = [], height: f = 180, actions: p, kind: g, stacked: _, sharedInspection: O, axisWidth: ee }) {
|
|
937
|
+
let j = !Number.isFinite(f) || f < 48 ? "Chart height must be at least 48 pixels." : se({
|
|
858
938
|
series: n,
|
|
859
|
-
isStacked:
|
|
860
|
-
markers:
|
|
861
|
-
}), M =
|
|
939
|
+
isStacked: _,
|
|
940
|
+
markers: s
|
|
941
|
+
}), M = S(() => j === void 0 ? ue(n, _) : [], [
|
|
862
942
|
n,
|
|
863
|
-
|
|
943
|
+
_,
|
|
864
944
|
j
|
|
865
|
-
]), N = M[0]?.points ?? [], { ref:
|
|
945
|
+
]), N = M[0]?.points ?? [], { ref: te, width: P, element: ne } = h(), F = C(null), [I, L] = w(), R = ce({
|
|
866
946
|
series: n,
|
|
867
|
-
markers:
|
|
947
|
+
markers: s,
|
|
868
948
|
timestampUnit: r,
|
|
869
|
-
isStacked:
|
|
870
|
-
}),
|
|
871
|
-
|
|
872
|
-
let
|
|
873
|
-
if (
|
|
874
|
-
if (
|
|
949
|
+
isStacked: _
|
|
950
|
+
}), z = O === void 0 ? I?.signature === R ? I : void 0 : O.value, B = x();
|
|
951
|
+
I !== void 0 && (I.signature !== R || j !== void 0) && L(void 0);
|
|
952
|
+
let V = O !== void 0;
|
|
953
|
+
if (b(() => {
|
|
954
|
+
if (V) return;
|
|
875
955
|
function e(e) {
|
|
876
|
-
e.target instanceof Node &&
|
|
956
|
+
e.target instanceof Node && F.current?.contains(e.target) !== !0 && L(void 0);
|
|
877
957
|
}
|
|
878
958
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
879
|
-
}, [
|
|
959
|
+
}, [V]), j !== void 0) return /* @__PURE__ */ E(m, {
|
|
880
960
|
title: e,
|
|
881
961
|
description: t,
|
|
882
962
|
message: j
|
|
883
963
|
});
|
|
884
|
-
if (N.length === 0) return /* @__PURE__ */
|
|
964
|
+
if (N.length === 0) return /* @__PURE__ */ E(l, {
|
|
885
965
|
title: e,
|
|
886
966
|
description: t,
|
|
887
|
-
actions:
|
|
888
|
-
children: /* @__PURE__ */
|
|
967
|
+
actions: p,
|
|
968
|
+
children: /* @__PURE__ */ E("p", {
|
|
889
969
|
className: "x153jb6y",
|
|
890
970
|
children: "No observations"
|
|
891
971
|
})
|
|
892
972
|
});
|
|
893
|
-
let
|
|
894
|
-
domain: [...
|
|
895
|
-
range: [
|
|
896
|
-
}),
|
|
897
|
-
domain: [...
|
|
898
|
-
range: [
|
|
973
|
+
let H = f - 28, U = H + 12, W = N[0]?.timestamp ?? 0, G = N.at(-1)?.timestamp ?? W, K = M.flatMap((e) => e.points.flatMap((e) => e.value === null ? [] : [e.value + e.base])), q = g === "area" ? Math.min(0, ...K) : Math.min(...K), re = g === "area" ? Math.max(0, ...K) : Math.max(...K), J = K.length === 0 ? 0 : q, ie = K.length === 0 ? 1 : re, Y = k({
|
|
974
|
+
domain: [...le(J, ie, g === "area")],
|
|
975
|
+
range: [H, 12]
|
|
976
|
+
}), ae = Y.ticks(3), X = ee ?? Math.max(52, ...ae.map((e) => a(e).length * 7 + 12)), Z = Math.max(X + 1, P - 16), Q = k({
|
|
977
|
+
domain: [...le(W, G)],
|
|
978
|
+
range: [X, Z]
|
|
899
979
|
});
|
|
900
|
-
function
|
|
901
|
-
let t =
|
|
980
|
+
function oe(e) {
|
|
981
|
+
let t = ne?.getBoundingClientRect();
|
|
902
982
|
if (t === void 0) return;
|
|
903
983
|
let n = Q.invert(e - t.left), r = N.find((e, t) => {
|
|
904
984
|
let r = N[t + 1];
|
|
905
985
|
return r === void 0 || n <= e.timestamp + (r.timestamp - e.timestamp) / 2;
|
|
906
986
|
});
|
|
907
987
|
r !== void 0 && $({
|
|
908
|
-
signature:
|
|
988
|
+
signature: R,
|
|
909
989
|
timestamp: r.timestamp,
|
|
910
990
|
source: "pointer"
|
|
911
991
|
});
|
|
912
992
|
}
|
|
913
993
|
function $(e) {
|
|
914
|
-
|
|
994
|
+
O === void 0 ? L(e) : O.onChange(e);
|
|
915
995
|
}
|
|
916
|
-
function
|
|
917
|
-
|
|
996
|
+
function de(e) {
|
|
997
|
+
if (e.altKey || e.ctrlKey || e.metaKey) return;
|
|
998
|
+
let t = N.findIndex((e) => e.timestamp === z?.timestamp), n = {
|
|
918
999
|
ArrowRight: Math.min(N.length - 1, t + 1),
|
|
919
1000
|
ArrowLeft: Math.max(0, t - 1),
|
|
920
1001
|
Home: 0,
|
|
@@ -922,7 +1003,7 @@ function $({ title: e, description: t, series: n, timestampUnit: r, formatTimest
|
|
|
922
1003
|
};
|
|
923
1004
|
switch (e.key) {
|
|
924
1005
|
case "Escape":
|
|
925
|
-
e.preventDefault(), $(void 0);
|
|
1006
|
+
e.preventDefault(), e.stopPropagation(), $(void 0);
|
|
926
1007
|
break;
|
|
927
1008
|
case "ArrowRight":
|
|
928
1009
|
case "ArrowLeft":
|
|
@@ -931,7 +1012,7 @@ function $({ title: e, description: t, series: n, timestampUnit: r, formatTimest
|
|
|
931
1012
|
e.preventDefault();
|
|
932
1013
|
let t = N[n[e.key]];
|
|
933
1014
|
t !== void 0 && $({
|
|
934
|
-
signature:
|
|
1015
|
+
signature: R,
|
|
935
1016
|
timestamp: t.timestamp,
|
|
936
1017
|
source: "keyboard"
|
|
937
1018
|
});
|
|
@@ -939,165 +1020,163 @@ function $({ title: e, description: t, series: n, timestampUnit: r, formatTimest
|
|
|
939
1020
|
}
|
|
940
1021
|
}
|
|
941
1022
|
}
|
|
942
|
-
return /* @__PURE__ */
|
|
943
|
-
ref:
|
|
1023
|
+
return /* @__PURE__ */ E("div", {
|
|
1024
|
+
ref: F,
|
|
944
1025
|
className: "xeuugli",
|
|
945
|
-
children: /* @__PURE__ */
|
|
1026
|
+
children: /* @__PURE__ */ D(l, {
|
|
946
1027
|
title: e,
|
|
947
1028
|
description: t,
|
|
948
|
-
actions:
|
|
949
|
-
children: [/* @__PURE__ */
|
|
1029
|
+
actions: p,
|
|
1030
|
+
children: [/* @__PURE__ */ D("div", {
|
|
950
1031
|
className: "xrvj5dj x1n8ia3y",
|
|
951
1032
|
children: [
|
|
952
|
-
/* @__PURE__ */
|
|
1033
|
+
/* @__PURE__ */ E(o, { items: M.map(({ id: e, label: t, tone: n }) => ({
|
|
953
1034
|
id: e,
|
|
954
1035
|
label: t,
|
|
955
1036
|
tone: n
|
|
956
1037
|
})) }),
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
ref:
|
|
959
|
-
...
|
|
960
|
-
children: /* @__PURE__ */
|
|
1038
|
+
/* @__PURE__ */ D("div", {
|
|
1039
|
+
ref: te,
|
|
1040
|
+
...y.props(c.plot),
|
|
1041
|
+
children: [/* @__PURE__ */ D("svg", {
|
|
961
1042
|
role: "img",
|
|
962
1043
|
"aria-label": `${e}. Use arrow keys to inspect observations.`,
|
|
963
|
-
"aria-describedby":
|
|
1044
|
+
"aria-describedby": B,
|
|
964
1045
|
tabIndex: 0,
|
|
965
|
-
viewBox: `0 0 ${
|
|
966
|
-
height:
|
|
967
|
-
onKeyDown:
|
|
1046
|
+
viewBox: `0 0 ${P} ${U}`,
|
|
1047
|
+
height: U,
|
|
1048
|
+
onKeyDown: de,
|
|
968
1049
|
onPointerMove: (e) => {
|
|
969
|
-
e.pointerType === "mouse" &&
|
|
1050
|
+
e.pointerType === "mouse" && oe(e.clientX);
|
|
970
1051
|
},
|
|
971
|
-
onPointerDown: (e) =>
|
|
972
|
-
...
|
|
1052
|
+
onPointerDown: (e) => oe(e.clientX),
|
|
1053
|
+
...y.props(c.svg, he.plot),
|
|
973
1054
|
children: [
|
|
974
|
-
|
|
975
|
-
x1:
|
|
976
|
-
x2:
|
|
977
|
-
y1:
|
|
978
|
-
y2:
|
|
979
|
-
...
|
|
980
|
-
}), /* @__PURE__ */
|
|
981
|
-
x:
|
|
982
|
-
y:
|
|
1055
|
+
ae.map((e) => /* @__PURE__ */ D("g", { children: [/* @__PURE__ */ E("line", {
|
|
1056
|
+
x1: X,
|
|
1057
|
+
x2: Z,
|
|
1058
|
+
y1: Y(e),
|
|
1059
|
+
y2: Y(e),
|
|
1060
|
+
...y.props(c.grid)
|
|
1061
|
+
}), /* @__PURE__ */ E("text", {
|
|
1062
|
+
x: X - 8,
|
|
1063
|
+
y: Y(e),
|
|
983
1064
|
textAnchor: "end",
|
|
984
1065
|
dominantBaseline: "middle",
|
|
985
|
-
...
|
|
986
|
-
children:
|
|
1066
|
+
...y.props(c.label),
|
|
1067
|
+
children: a(e)
|
|
987
1068
|
})] }, e)),
|
|
988
|
-
M.map((e) => /* @__PURE__ */
|
|
1069
|
+
M.map((e) => /* @__PURE__ */ D("g", { children: [g === "area" && /* @__PURE__ */ E(A, {
|
|
989
1070
|
data: [...e.points],
|
|
990
1071
|
defined: (e) => e.value !== null,
|
|
991
1072
|
x: (e) => Q(e.timestamp),
|
|
992
|
-
y0: (e) =>
|
|
993
|
-
y1: (e) =>
|
|
994
|
-
yScale:
|
|
995
|
-
fill:
|
|
996
|
-
fillOpacity:
|
|
997
|
-
}), /* @__PURE__ */
|
|
1073
|
+
y0: (e) => Y(e.base),
|
|
1074
|
+
y1: (e) => Y((e.value ?? 0) + e.base),
|
|
1075
|
+
yScale: Y,
|
|
1076
|
+
fill: u[e.tone],
|
|
1077
|
+
fillOpacity: _ ? .65 : .15
|
|
1078
|
+
}), /* @__PURE__ */ E(fe, {
|
|
998
1079
|
series: e,
|
|
999
1080
|
x: Q,
|
|
1000
|
-
y:
|
|
1001
|
-
inspectedTimestamp:
|
|
1081
|
+
y: Y,
|
|
1082
|
+
inspectedTimestamp: z?.timestamp
|
|
1002
1083
|
})] }, e.id)),
|
|
1003
|
-
|
|
1084
|
+
s.map((e) => /* @__PURE__ */ D("g", { children: [e.kind === "time" ? /* @__PURE__ */ E("line", {
|
|
1004
1085
|
x1: Q(e.timestamp),
|
|
1005
1086
|
x2: Q(e.timestamp),
|
|
1006
1087
|
y1: 12,
|
|
1007
|
-
y2:
|
|
1088
|
+
y2: H,
|
|
1008
1089
|
className: "xhq4mlf x1ntoi03 x13efnbd"
|
|
1009
|
-
}) : /* @__PURE__ */
|
|
1090
|
+
}) : /* @__PURE__ */ E("circle", {
|
|
1010
1091
|
cx: Q(e.timestamp),
|
|
1011
|
-
cy:
|
|
1092
|
+
cy: Y(e.value + (M.find((t) => t.id === e.seriesId)?.points.find((t) => t.timestamp === e.timestamp)?.base ?? 0)),
|
|
1012
1093
|
r: 4,
|
|
1013
|
-
fill:
|
|
1014
|
-
...
|
|
1015
|
-
}), /* @__PURE__ */
|
|
1016
|
-
|
|
1017
|
-
x1: Q(
|
|
1018
|
-
x2: Q(
|
|
1094
|
+
fill: v.surface,
|
|
1095
|
+
...y.props(c.selected)
|
|
1096
|
+
}), /* @__PURE__ */ E("title", { children: e.kind === "point" ? `${e.label}: ${a(e.value)}` : e.label })] }, e.id)),
|
|
1097
|
+
z !== void 0 && /* @__PURE__ */ E("line", {
|
|
1098
|
+
x1: Q(z.timestamp),
|
|
1099
|
+
x2: Q(z.timestamp),
|
|
1019
1100
|
y1: 12,
|
|
1020
|
-
y2:
|
|
1101
|
+
y2: H,
|
|
1021
1102
|
className: "xhq4mlf x1ntoi03 x13efnbd"
|
|
1022
|
-
}),
|
|
1023
|
-
/* @__PURE__ */ w("text", {
|
|
1024
|
-
x: Z,
|
|
1025
|
-
y: m - 4,
|
|
1026
|
-
..._.props(i.label),
|
|
1027
|
-
children: o(G)
|
|
1028
|
-
}),
|
|
1029
|
-
K !== G && /* @__PURE__ */ w("text", {
|
|
1030
|
-
x: ue,
|
|
1031
|
-
y: m - 4,
|
|
1032
|
-
textAnchor: "end",
|
|
1033
|
-
..._.props(i.label),
|
|
1034
|
-
children: o(K)
|
|
1035
1103
|
})
|
|
1036
1104
|
]
|
|
1037
|
-
})
|
|
1105
|
+
}), /* @__PURE__ */ D("div", {
|
|
1106
|
+
"aria-hidden": !0,
|
|
1107
|
+
...y.props(he.timeAxis, he.timeAxisInset(X, Math.max(0, P - Z))),
|
|
1108
|
+
children: [/* @__PURE__ */ E("span", {
|
|
1109
|
+
className: "x1cqoux5 xeuugli xj0a0fe",
|
|
1110
|
+
children: i(W)
|
|
1111
|
+
}), G !== W && /* @__PURE__ */ E("span", {
|
|
1112
|
+
className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
|
|
1113
|
+
children: i(G)
|
|
1114
|
+
})]
|
|
1115
|
+
})]
|
|
1038
1116
|
}),
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
id:
|
|
1041
|
-
"aria-live":
|
|
1042
|
-
className: "x78zum5 x1a02dak x1pha0wt x8zbtdt x1gkm1c7 xy8obcc xas2l8k x1mqbd49",
|
|
1043
|
-
children:
|
|
1117
|
+
/* @__PURE__ */ E("div", {
|
|
1118
|
+
id: B,
|
|
1119
|
+
"aria-live": z?.source === "keyboard" ? "polite" : "off",
|
|
1120
|
+
className: "x78zum5 x1a02dak x1pha0wt x8zbtdt x1gkm1c7 xy8obcc xas2l8k x1mqbd49 xj0a0fe",
|
|
1121
|
+
children: z === void 0 ? /* @__PURE__ */ E("span", {
|
|
1044
1122
|
className: "x153jb6y",
|
|
1045
1123
|
children: "Point, tap, or use the arrow keys to inspect values."
|
|
1046
|
-
}) : /* @__PURE__ */ T
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
className: "x78zum5 x1a02dak
|
|
1124
|
+
}) : /* @__PURE__ */ D(T, { children: [
|
|
1125
|
+
/* @__PURE__ */ E("span", { children: i(z.timestamp) }),
|
|
1126
|
+
/* @__PURE__ */ E("dl", {
|
|
1127
|
+
className: "x78zum5 x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp xeuugli",
|
|
1050
1128
|
children: M.map((e) => {
|
|
1051
|
-
let t = e.points.find((e) => e.timestamp ===
|
|
1052
|
-
return /* @__PURE__ */
|
|
1053
|
-
className: "x78zum5 xunmzkg x1ghz6dp xss6m8b",
|
|
1054
|
-
children: [/* @__PURE__ */
|
|
1129
|
+
let t = e.points.find((e) => e.timestamp === z.timestamp);
|
|
1130
|
+
return /* @__PURE__ */ D("div", {
|
|
1131
|
+
className: "x78zum5 x1a02dak xunmzkg x1ghz6dp xeuugli xss6m8b",
|
|
1132
|
+
children: [/* @__PURE__ */ E("dt", { children: e.label }), /* @__PURE__ */ E("dd", {
|
|
1055
1133
|
className: "x1ghz6dp xbixft",
|
|
1056
|
-
children: t?.value === null || t === void 0 ? "Unavailable" :
|
|
1134
|
+
children: t?.value === null || t === void 0 ? "Unavailable" : a(t.value)
|
|
1057
1135
|
})]
|
|
1058
1136
|
}, e.id);
|
|
1059
1137
|
})
|
|
1060
1138
|
}),
|
|
1061
|
-
|
|
1139
|
+
s.filter((e) => e.timestamp === z.timestamp).map((e) => /* @__PURE__ */ E("span", { children: e.label }, e.id))
|
|
1062
1140
|
] })
|
|
1063
1141
|
}),
|
|
1064
|
-
|
|
1065
|
-
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx xy8obcc x153jb6y",
|
|
1066
|
-
children:
|
|
1067
|
-
|
|
1142
|
+
s.length > 0 && /* @__PURE__ */ E("ul", {
|
|
1143
|
+
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx xy8obcc x153jb6y xj0a0fe",
|
|
1144
|
+
children: s.map((e) => /* @__PURE__ */ D("li", { children: [
|
|
1145
|
+
i(e.timestamp),
|
|
1068
1146
|
" · ",
|
|
1069
1147
|
e.label,
|
|
1070
|
-
e.kind === "point" && ` · ${
|
|
1148
|
+
e.kind === "point" && ` · ${a(e.value)}`
|
|
1071
1149
|
] }, e.id))
|
|
1072
1150
|
})
|
|
1073
1151
|
]
|
|
1074
|
-
}), /* @__PURE__ */
|
|
1152
|
+
}), /* @__PURE__ */ E(d, { children: /* @__PURE__ */ D("table", {
|
|
1075
1153
|
className: "xh8yej3 x1mwwwfo xy8obcc x1yc453h xss6m8b",
|
|
1076
1154
|
children: [
|
|
1077
|
-
/* @__PURE__ */
|
|
1078
|
-
/* @__PURE__ */
|
|
1079
|
-
|
|
1155
|
+
/* @__PURE__ */ D("caption", { children: [e, " observations"] }),
|
|
1156
|
+
/* @__PURE__ */ E("thead", { children: /* @__PURE__ */ D("tr", { children: [/* @__PURE__ */ D("th", {
|
|
1157
|
+
scope: "col",
|
|
1158
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1080
1159
|
children: [
|
|
1081
1160
|
"Time (",
|
|
1082
1161
|
r,
|
|
1083
1162
|
")"
|
|
1084
1163
|
]
|
|
1085
|
-
}), M.map((e) => /* @__PURE__ */
|
|
1164
|
+
}), M.map((e) => /* @__PURE__ */ E("th", {
|
|
1086
1165
|
scope: "col",
|
|
1087
|
-
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd
|
|
1166
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1088
1167
|
children: e.label
|
|
1089
1168
|
}, e.id))] }) }),
|
|
1090
|
-
/* @__PURE__ */
|
|
1169
|
+
/* @__PURE__ */ E("tbody", { children: N.map((e, t) => /* @__PURE__ */ D("tr", { children: [/* @__PURE__ */ E("th", {
|
|
1091
1170
|
scope: "row",
|
|
1092
|
-
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd
|
|
1093
|
-
children:
|
|
1094
|
-
}), M.map((e) => /* @__PURE__ */
|
|
1095
|
-
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd
|
|
1096
|
-
children: e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" :
|
|
1171
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1172
|
+
children: i(e.timestamp)
|
|
1173
|
+
}), M.map((e) => /* @__PURE__ */ E("td", {
|
|
1174
|
+
className: "x69ldcm x1yc453h xso031l x1q0q8m5 x1qndepd xj57cvi",
|
|
1175
|
+
children: e.points[t]?.value === null || e.points[t]?.value === void 0 ? "Unavailable" : a(e.points[t].value)
|
|
1097
1176
|
}, e.id))] }, e.timestamp)) })
|
|
1098
1177
|
]
|
|
1099
1178
|
}) })]
|
|
1100
1179
|
})
|
|
1101
1180
|
});
|
|
1102
1181
|
}
|
|
1103
|
-
export {
|
|
1182
|
+
export { _e as AreaChart, R as BarChart, F as BarChartPlaceholder, H as BreakdownBar, ge as LineChart, q as MAX_SCATTER_POINTS, ie as ScatterPlot, ve as SmallMultiples, pe as Sparkline, Q as timeSeriesLimits };
|