@mechane-ai/ui 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -13
- package/dist/ai.js +315 -0
- package/dist/assets/stylex.css +1533 -360
- package/dist/cartesian-Bwt6ZnF5.js +847 -0
- package/dist/chart-input-Bti0gyzz.js +173 -0
- package/dist/charts/cartesian.js +1 -0
- package/dist/charts/distribution.js +1 -0
- package/dist/charts/graph.js +1 -0
- package/dist/charts/matrix.js +1 -0
- package/dist/charts.js +98 -93
- package/dist/code-BJp-g4Fw.js +172 -0
- package/dist/collections.js +666 -0
- package/dist/content/code.js +1 -0
- package/dist/content/diff.js +101 -0
- package/dist/content/link.js +1 -0
- package/dist/content/tree.js +77 -0
- package/dist/content-link-52aZVX3X.js +26 -0
- package/dist/content.js +367 -0
- package/dist/distribution-CViLvcPP.js +609 -0
- package/dist/graph-DAfo72ZD.js +230 -0
- package/dist/index.js +1 -1
- package/dist/layout.js +201 -160
- package/dist/matrix-B9dybkce.js +785 -0
- package/dist/packages/ai/src/approval.d.ts +29 -0
- package/dist/packages/ai/src/conversation.d.ts +34 -0
- package/dist/packages/ai/src/index.d.ts +10 -0
- package/dist/packages/ai/src/message.d.ts +19 -0
- package/dist/packages/ai/src/prompt-input.d.ts +25 -0
- package/dist/packages/ai/src/sources.d.ts +17 -0
- package/dist/packages/charts/src/cartesian/categorical.d.ts +43 -0
- package/dist/packages/charts/src/cartesian/index.d.ts +8 -0
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +11 -0
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +54 -0
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +9 -0
- package/dist/packages/charts/src/cartesian/time-series.d.ts +29 -0
- package/dist/packages/charts/src/chart-frame.d.ts +34 -0
- package/dist/packages/charts/src/chart-input.d.ts +10 -0
- package/dist/packages/charts/src/chart-theme.d.ts +48 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +14 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +135 -0
- package/dist/packages/charts/src/distribution/ecdf.d.ts +23 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +26 -0
- package/dist/packages/charts/src/distribution/index.d.ts +8 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +24 -0
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +22 -0
- package/dist/packages/charts/src/graph/index.d.ts +2 -0
- package/dist/packages/charts/src/graph/relation-graph.d.ts +45 -0
- package/dist/packages/charts/src/index.d.ts +13 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +7 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -0
- package/dist/packages/charts/src/matrix/index.d.ts +9 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/scatter-plot.d.ts +37 -0
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +20 -0
- package/dist/packages/charts/src/plot-width.d.ts +5 -0
- package/dist/packages/collections/src/calendar.d.ts +32 -0
- package/dist/packages/collections/src/collection-controls.d.ts +41 -0
- package/dist/packages/collections/src/command.d.ts +37 -0
- package/dist/packages/collections/src/data-table.d.ts +49 -0
- package/dist/packages/collections/src/date-range-picker.d.ts +16 -0
- package/dist/packages/collections/src/index.d.ts +13 -0
- package/dist/packages/content/src/code/code-block.d.ts +22 -0
- package/dist/packages/content/src/code/index.d.ts +2 -0
- package/dist/packages/content/src/code/use-highlighted-code.d.ts +9 -0
- package/dist/packages/content/src/content-link.d.ts +8 -0
- package/dist/packages/content/src/diff/diff-source.d.ts +32 -0
- package/dist/packages/content/src/diff/diff-viewer.d.ts +3 -0
- package/dist/packages/content/src/diff/index.d.ts +2 -0
- package/dist/packages/content/src/diff/pierre-diff.d.ts +14 -0
- package/dist/packages/content/src/index.d.ts +10 -0
- package/dist/packages/content/src/json-viewer.d.ts +11 -0
- package/dist/packages/content/src/link.d.ts +2 -0
- package/dist/packages/content/src/log-viewer.d.ts +9 -0
- package/dist/packages/content/src/markdown.d.ts +7 -0
- package/dist/packages/content/src/pierre-theme.d.ts +36 -0
- package/dist/packages/content/src/stack-trace.d.ts +16 -0
- package/dist/packages/content/src/tree/file-tree-types.d.ts +12 -0
- package/dist/packages/content/src/tree/file-tree.d.ts +3 -0
- package/dist/packages/content/src/tree/index.d.ts +2 -0
- package/dist/packages/content/src/tree/pierre-tree.d.ts +3 -0
- package/dist/packages/core/src/alert-dialog.d.ts +18 -0
- package/dist/packages/core/src/combobox.d.ts +81 -0
- package/dist/{control-state.d.ts → packages/core/src/control-state.d.ts} +18 -2
- package/dist/{copy-value.d.ts → packages/core/src/copy-value.d.ts} +2 -1
- package/dist/packages/core/src/details-controls.d.ts +23 -0
- package/dist/packages/core/src/disclosure.d.ts +33 -0
- package/dist/packages/core/src/field-styles.d.ts +66 -0
- package/dist/packages/core/src/form-controls.d.ts +81 -0
- package/dist/{forms.d.ts → packages/core/src/forms.d.ts} +1 -1
- package/dist/packages/core/src/index.d.ts +32 -0
- package/dist/packages/core/src/menu.d.ts +51 -0
- package/dist/packages/core/src/navigation.d.ts +24 -0
- package/dist/packages/core/src/popover.d.ts +24 -0
- package/dist/packages/core/src/popup-styles.d.ts +84 -0
- package/dist/packages/core/src/preview.d.ts +17 -0
- package/dist/packages/core/src/progress.d.ts +10 -0
- package/dist/packages/core/src/selection-styles.d.ts +110 -0
- package/dist/packages/core/src/selection.d.ts +57 -0
- package/dist/packages/core/src/skeleton.d.ts +18 -0
- package/dist/packages/core/src/theme.d.ts +16 -0
- package/dist/packages/core/src/toast.d.ts +28 -0
- package/dist/{tokens.stylex.d.ts → packages/core/src/tokens.stylex.d.ts} +60 -0
- package/dist/packages/core/src/trace.d.ts +35 -0
- package/dist/{layout → packages/layout/src}/index.d.ts +2 -0
- package/dist/{layout → packages/layout/src}/page-toolbar.d.ts +1 -1
- package/dist/packages/layout/src/resizable.d.ts +27 -0
- package/dist/{layout → packages/layout/src}/sidebar.d.ts +1 -1
- package/dist/pierre-diff-D3m4JCu0.js +66 -0
- package/dist/pierre-theme-CPlfl-AA.js +96 -0
- package/dist/pierre-tree-BaEkz16y.js +105 -0
- package/dist/plot-width--OgdohB5.js +18 -0
- package/dist/src-E7YRJBMO.js +2821 -0
- package/dist/tokens.js +118 -64
- package/package.json +67 -10
- package/{src → packages/core/src}/tokens.stylex.ts +64 -0
- package/dist/charts/index.d.ts +0 -2
- package/dist/index.d.ts +0 -16
- package/dist/src-Czfi0YQa.js +0 -1319
- /package/dist/{charts → packages/charts/src}/waterfall.d.ts +0 -0
- /package/dist/{inspector.d.ts → packages/collections/src/inspector.d.ts} +0 -0
- /package/dist/{list-footer.d.ts → packages/collections/src/list-footer.d.ts} +0 -0
- /package/dist/{table.d.ts → packages/collections/src/table.d.ts} +0 -0
- /package/dist/{accessibility.d.ts → packages/core/src/accessibility.d.ts} +0 -0
- /package/dist/{actions.d.ts → packages/core/src/actions.d.ts} +0 -0
- /package/dist/{dialog.d.ts → packages/core/src/dialog.d.ts} +0 -0
- /package/dist/{drawer.d.ts → packages/core/src/drawer.d.ts} +0 -0
- /package/dist/{loading.d.ts → packages/core/src/loading.d.ts} +0 -0
- /package/dist/{metrics.d.ts → packages/core/src/metrics.d.ts} +0 -0
- /package/dist/{overlay-styles.d.ts → packages/core/src/overlay-styles.d.ts} +0 -0
- /package/dist/{select.d.ts → packages/core/src/select.d.ts} +0 -0
- /package/dist/{skip-link.d.ts → packages/core/src/skip-link.d.ts} +0 -0
- /package/dist/{style-composition.d.ts → packages/core/src/style-composition.d.ts} +0 -0
- /package/dist/{surfaces.d.ts → packages/core/src/surfaces.d.ts} +0 -0
- /package/dist/{tabs.d.ts → packages/core/src/tabs.d.ts} +0 -0
- /package/dist/{text.d.ts → packages/core/src/text.d.ts} +0 -0
- /package/dist/{tooltip.d.ts → packages/core/src/tooltip.d.ts} +0 -0
- /package/dist/{layout → packages/layout/src}/app-shell.d.ts +0 -0
- /package/dist/{layout → packages/layout/src}/detail-page.d.ts +0 -0
- /package/dist/{layout → packages/layout/src}/frame.stylex.d.ts +0 -0
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
import { colors as e } from "./tokens.js";
|
|
2
|
+
import { a as t, c as n, i as r, l as i, n as a, o, r as s, t as c } from "./chart-input-Bti0gyzz.js";
|
|
3
|
+
import { ot as l, x as u } from "./src-E7YRJBMO.js";
|
|
4
|
+
import { t as d } from "./plot-width--OgdohB5.js";
|
|
5
|
+
import * as f from "@stylexjs/stylex";
|
|
6
|
+
import { useId as p, useState as m } from "react";
|
|
7
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
|
+
import { scaleLinear as _ } from "@visx/scale";
|
|
9
|
+
// packages/charts/src/matrix/heatmap-scale.ts
|
|
10
|
+
var v = 100;
|
|
11
|
+
function y({ domain: e, palette: t }) {
|
|
12
|
+
return s(e) ? t === "diverging" && (e[0] >= 0 || e[1] <= 0) ? "A diverging color domain must include negative and positive values." : null : "The color domain must contain two finite, increasing endpoints.";
|
|
13
|
+
}
|
|
14
|
+
function b(e, t) {
|
|
15
|
+
return e >= t[0] && e <= t[1];
|
|
16
|
+
}
|
|
17
|
+
function x(t, { domain: n, palette: r }) {
|
|
18
|
+
if (r === "diverging") {
|
|
19
|
+
let r = t < 0 ? n[0] : n[1], a = Math.abs(t) / Math.abs(r) * v;
|
|
20
|
+
return `color-mix(in srgb, ${t < 0 ? i.negative : i.positive} ${a}%, ${e.surface})`;
|
|
21
|
+
}
|
|
22
|
+
let a = (t - n[0]) / (n[1] - n[0]) * v;
|
|
23
|
+
return `color-mix(in srgb, ${i.series1} ${a}%, ${e.surface})`;
|
|
24
|
+
}
|
|
25
|
+
// packages/charts/src/matrix/color-legend.tsx
|
|
26
|
+
var S = {
|
|
27
|
+
kUk6DE: "x98rzlu",
|
|
28
|
+
$$css: !0
|
|
29
|
+
}, C = { sample: (e) => [
|
|
30
|
+
S,
|
|
31
|
+
{
|
|
32
|
+
kWkggS: e == null ? e : "xl8spv7",
|
|
33
|
+
$$css: !0
|
|
34
|
+
},
|
|
35
|
+
{ "--x-backgroundColor": e ?? void 0 }
|
|
36
|
+
] }, w = 20;
|
|
37
|
+
function T({ label: e, domain: t, palette: n, formatValue: r }) {
|
|
38
|
+
let i = y({
|
|
39
|
+
domain: t,
|
|
40
|
+
palette: n
|
|
41
|
+
});
|
|
42
|
+
if (i !== null) return /* @__PURE__ */ h("p", {
|
|
43
|
+
role: "status",
|
|
44
|
+
className: "xrvj5dj xzwl0l2 x1jkqq1h xv9cywu xoedhln xut3y95 xam3yii",
|
|
45
|
+
children: i
|
|
46
|
+
});
|
|
47
|
+
let a = Array.from({ length: 21 }, (e, n) => t[0] + (t[1] - t[0]) * n / w);
|
|
48
|
+
return /* @__PURE__ */ g("div", {
|
|
49
|
+
"aria-label": `${e}: ${r(t[0])} to ${r(t[1])}`,
|
|
50
|
+
className: "xrvj5dj xzwl0l2 x1jkqq1h xv9cywu xoedhln xut3y95 xam3yii",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ g("span", { children: [e, n === "diverging" && ` · Neutral: ${r(0)}`] }),
|
|
53
|
+
/* @__PURE__ */ h("div", {
|
|
54
|
+
"aria-hidden": !0,
|
|
55
|
+
className: "x78zum5 xdk7pt xmkeg23 x1y0btm7 x1yww3zy",
|
|
56
|
+
children: a.map((e) => /* @__PURE__ */ h("span", { ...f.props(C.sample(x(e, {
|
|
57
|
+
domain: t,
|
|
58
|
+
palette: n
|
|
59
|
+
}))) }, e))
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ g("div", {
|
|
62
|
+
"aria-hidden": !0,
|
|
63
|
+
className: "x78zum5 x1qughib xtmze7h xss6m8b",
|
|
64
|
+
children: [/* @__PURE__ */ h("span", { children: r(t[0]) }), /* @__PURE__ */ h("span", { children: r(t[1]) })]
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// packages/charts/src/matrix/matrix.tsx
|
|
70
|
+
var E = {
|
|
71
|
+
kKwaWg: "x1e87kdn",
|
|
72
|
+
$$css: !0
|
|
73
|
+
}, D = {
|
|
74
|
+
value: {
|
|
75
|
+
k1xSpc: "x78zum5",
|
|
76
|
+
kGNEyG: "x6s0dn4",
|
|
77
|
+
kjj79g: "xl56j7k",
|
|
78
|
+
kzqmXN: "x100vrsf xbr7t2x",
|
|
79
|
+
kZKoxP: "x1vqgdyp xv0o0l7",
|
|
80
|
+
kB7OPa: "x9f619",
|
|
81
|
+
kMzoRj: "xmkeg23",
|
|
82
|
+
ksu8eU: "x1y0btm7",
|
|
83
|
+
kVAM5u: "x1yww3zy",
|
|
84
|
+
kWkggS: "x1l90twa",
|
|
85
|
+
kMwMTN: "xgl13c",
|
|
86
|
+
kmVPX3: "x1717udv",
|
|
87
|
+
kMv6JI: "xoedhln",
|
|
88
|
+
kGuDYH: "xut3y95",
|
|
89
|
+
kLWn49: "xam3yii",
|
|
90
|
+
kcqcaj: "xss6m8b",
|
|
91
|
+
$$css: !0
|
|
92
|
+
},
|
|
93
|
+
interactive: {
|
|
94
|
+
kkrTdU: "x1ypdohk",
|
|
95
|
+
kPJHz1: "xnktsf1",
|
|
96
|
+
kZs9gx: "x1m2ab5f",
|
|
97
|
+
k7shQP: "x9v5kkp",
|
|
98
|
+
kiEn40: "x1bqaal",
|
|
99
|
+
kguI0P: "xsi0z05",
|
|
100
|
+
kFU1ZQ: "xbpze6h",
|
|
101
|
+
kUjPgX: "xn6y6q8",
|
|
102
|
+
$$css: !0
|
|
103
|
+
},
|
|
104
|
+
selected: {
|
|
105
|
+
kMeerF: "xhb1w9w",
|
|
106
|
+
kjBf7l: "xnoxefp",
|
|
107
|
+
k3XXqK: "xaatb59",
|
|
108
|
+
kInvED: "x2ssjo2",
|
|
109
|
+
$$css: !0
|
|
110
|
+
},
|
|
111
|
+
measured: (e) => [E, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${e})` }],
|
|
112
|
+
missing: {
|
|
113
|
+
kMwMTN: "xv9cywu",
|
|
114
|
+
kWkggS: "x1m7rfvg",
|
|
115
|
+
ksu8eU: "xbsl7fq",
|
|
116
|
+
$$css: !0
|
|
117
|
+
},
|
|
118
|
+
masked: {
|
|
119
|
+
kMwMTN: "xv9cywu",
|
|
120
|
+
kWkggS: "x1m7rfvg",
|
|
121
|
+
$$css: !0
|
|
122
|
+
}
|
|
123
|
+
}, O = {
|
|
124
|
+
value: void 0,
|
|
125
|
+
masked: D.masked,
|
|
126
|
+
missing: D.missing
|
|
127
|
+
}, k = 4096, A = 6;
|
|
128
|
+
function j({ title: e, description: n, rows: i, columns: a, cells: s, domain: l, palette: u, valueLabel: d, formatValue: f, selection: p, emptyLabel: m }) {
|
|
129
|
+
let _ = F({
|
|
130
|
+
rows: i,
|
|
131
|
+
columns: a,
|
|
132
|
+
cells: s,
|
|
133
|
+
domain: l,
|
|
134
|
+
palette: u
|
|
135
|
+
});
|
|
136
|
+
if (_ !== null) return /* @__PURE__ */ h(c, {
|
|
137
|
+
title: e,
|
|
138
|
+
description: n,
|
|
139
|
+
message: _
|
|
140
|
+
});
|
|
141
|
+
let v = /* @__PURE__ */ new Map();
|
|
142
|
+
for (let e of s) {
|
|
143
|
+
let t = v.get(e.rowId) ?? /* @__PURE__ */ new Map();
|
|
144
|
+
t.set(e.columnId, e), v.set(e.rowId, t);
|
|
145
|
+
}
|
|
146
|
+
let y = s.find((e) => e.id === p?.selectedId), x = i.find((e) => e.id === y?.rowId), S = a.find((e) => e.id === y?.columnId), C = y === void 0 ? void 0 : `${x?.label ?? y.rowId} → ${S?.label ?? y.columnId}: ${P(y, l, f)}`;
|
|
147
|
+
return /* @__PURE__ */ h(o, {
|
|
148
|
+
title: e,
|
|
149
|
+
description: n,
|
|
150
|
+
footer: /* @__PURE__ */ g("div", {
|
|
151
|
+
className: "xrvj5dj xtmze7h",
|
|
152
|
+
children: [
|
|
153
|
+
/* @__PURE__ */ h(T, {
|
|
154
|
+
label: d,
|
|
155
|
+
domain: l,
|
|
156
|
+
palette: u,
|
|
157
|
+
formatValue: f
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ g("ul", {
|
|
160
|
+
"aria-label": "Cell states",
|
|
161
|
+
className: "x78zum5 x1a02dak xtmze7h x1ghz6dp x1717udv xe8uvvx xv9cywu xut3y95",
|
|
162
|
+
children: [
|
|
163
|
+
s.some((e) => e.kind === "masked") && /* @__PURE__ */ h("li", { children: "× Masked" }),
|
|
164
|
+
s.some((e) => e.kind === "missing") && /* @__PURE__ */ h("li", { children: "— Missing" }),
|
|
165
|
+
s.length < i.length * a.length && /* @__PURE__ */ h("li", { children: "· Not supplied" }),
|
|
166
|
+
s.some((e) => e.kind === "value" && !b(e.value, l)) && /* @__PURE__ */ h("li", { children: "! Outside domain" }),
|
|
167
|
+
s.some((e) => e.kind === "value" && f(e.value).length > A) && /* @__PURE__ */ h("li", { children: "• See exact values in View data" })
|
|
168
|
+
]
|
|
169
|
+
}),
|
|
170
|
+
p !== void 0 && /* @__PURE__ */ h("p", {
|
|
171
|
+
"aria-live": "polite",
|
|
172
|
+
className: "x1ghz6dp xgl13c x19zkttd xj0a0fe",
|
|
173
|
+
children: C ?? "Select a cell to inspect its value."
|
|
174
|
+
}),
|
|
175
|
+
i.length > 0 && a.length > 0 && /* @__PURE__ */ h(r, { children: /* @__PURE__ */ h("ul", {
|
|
176
|
+
className: "xe8uvvx x1ghz6dp x1717udv",
|
|
177
|
+
children: i.flatMap((e) => a.map((n) => {
|
|
178
|
+
let r = v.get(e.id)?.get(n.id), i = `${e.label} → ${n.label}`, a = P(r, l, f);
|
|
179
|
+
return /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g(t, {
|
|
180
|
+
label: `${i}: ${a}`,
|
|
181
|
+
selected: r !== void 0 && p?.selectedId === r.id,
|
|
182
|
+
onSelect: r === void 0 || p === void 0 ? void 0 : () => p.onSelect(r.id),
|
|
183
|
+
children: [/* @__PURE__ */ h("span", { children: i }), /* @__PURE__ */ h("span", { children: a })]
|
|
184
|
+
}) }, JSON.stringify([e.id, n.id]));
|
|
185
|
+
}))
|
|
186
|
+
}) })
|
|
187
|
+
]
|
|
188
|
+
}),
|
|
189
|
+
children: i.length === 0 || a.length === 0 ? /* @__PURE__ */ h("p", {
|
|
190
|
+
className: "x1ghz6dp xv9cywu x118kxxs x1hyyzld",
|
|
191
|
+
children: m
|
|
192
|
+
}) : /* @__PURE__ */ h("div", {
|
|
193
|
+
role: "region",
|
|
194
|
+
"aria-label": `${e} cells`,
|
|
195
|
+
tabIndex: 0,
|
|
196
|
+
className: "xysyzu8 x14eurpq xnktsf1 x1m2ab5f x9v5kkp x1bqaal",
|
|
197
|
+
children: /* @__PURE__ */ g("table", {
|
|
198
|
+
className: "x1vathgz x1jkpq5q xezivpi xoedhln",
|
|
199
|
+
children: [/* @__PURE__ */ h("thead", { children: /* @__PURE__ */ g("tr", { children: [/* @__PURE__ */ h("th", {
|
|
200
|
+
"aria-label": "Row",
|
|
201
|
+
className: "x1717udv xut3y95 xam3yii xo1l8bm xv9cywu x1yc453h xuxw1ft"
|
|
202
|
+
}), a.map((e) => /* @__PURE__ */ h("th", {
|
|
203
|
+
scope: "col",
|
|
204
|
+
title: e.label,
|
|
205
|
+
className: "x1717udv xut3y95 xam3yii xo1l8bm xv9cywu x1yc453h xuxw1ft",
|
|
206
|
+
children: /* @__PURE__ */ h("span", {
|
|
207
|
+
className: "x1lliihq x100vrsf xbr7t2x xb3r6kr xlyipyv x2b8uid xlfmwf6",
|
|
208
|
+
children: e.label
|
|
209
|
+
})
|
|
210
|
+
}, e.id))] }) }), /* @__PURE__ */ h("tbody", { children: i.map((e) => /* @__PURE__ */ g("tr", { children: [/* @__PURE__ */ h("th", {
|
|
211
|
+
scope: "row",
|
|
212
|
+
title: e.label,
|
|
213
|
+
className: "x1717udv xut3y95 xam3yii xo1l8bm xv9cywu x1yc453h xuxw1ft",
|
|
214
|
+
children: /* @__PURE__ */ h("span", {
|
|
215
|
+
className: "x1lliihq x18qnofl xb3r6kr xlyipyv x1pifqf1",
|
|
216
|
+
children: e.label
|
|
217
|
+
})
|
|
218
|
+
}), a.map((t) => {
|
|
219
|
+
let n = v.get(e.id)?.get(t.id);
|
|
220
|
+
return /* @__PURE__ */ h("td", {
|
|
221
|
+
className: "x1717udv x100vrsf xbr7t2x x2b8uid",
|
|
222
|
+
children: /* @__PURE__ */ h(M, {
|
|
223
|
+
cell: n,
|
|
224
|
+
label: `${e.label}, ${t.label}`,
|
|
225
|
+
domain: l,
|
|
226
|
+
palette: u,
|
|
227
|
+
formatValue: f,
|
|
228
|
+
selection: p
|
|
229
|
+
})
|
|
230
|
+
}, t.id);
|
|
231
|
+
})] }, e.id)) })]
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
function M({ cell: e, label: t, domain: n, palette: r, formatValue: i, selection: a }) {
|
|
237
|
+
if (e === void 0) return /* @__PURE__ */ h("span", {
|
|
238
|
+
role: "img",
|
|
239
|
+
"aria-label": `${t}: not supplied`,
|
|
240
|
+
title: `${t}: not supplied`,
|
|
241
|
+
className: "x78zum5 x6s0dn4 xl56j7k x100vrsf xbr7t2x x1vqgdyp xv0o0l7 x9f619 xmkeg23 x1yww3zy x1717udv xoedhln xut3y95 xam3yii xss6m8b xv9cywu x1m7rfvg xbsl7fq",
|
|
242
|
+
children: "·"
|
|
243
|
+
});
|
|
244
|
+
let o = e.kind === "value" && !b(e.value, n), s = P(e, n, i), c = `${t}: ${s}`, l = e.kind === "value" && !o ? x(e.value, {
|
|
245
|
+
domain: n,
|
|
246
|
+
palette: r
|
|
247
|
+
}) : void 0, u = f.props(D.value, O[e.kind], l !== void 0 && D.measured(l), o && D.missing, a?.selectedId === e.id && D.selected, a !== void 0 && D.interactive), d = N(e, s, o), p = e.kind === "value" ? /* @__PURE__ */ h("span", {
|
|
248
|
+
className: "x1l90twa x1qmz0ts",
|
|
249
|
+
children: d
|
|
250
|
+
}) : d;
|
|
251
|
+
return a === void 0 ? /* @__PURE__ */ h("span", {
|
|
252
|
+
role: "img",
|
|
253
|
+
"aria-label": c,
|
|
254
|
+
title: c,
|
|
255
|
+
...u,
|
|
256
|
+
children: p
|
|
257
|
+
}) : /* @__PURE__ */ h("button", {
|
|
258
|
+
type: "button",
|
|
259
|
+
"aria-label": c,
|
|
260
|
+
title: c,
|
|
261
|
+
"aria-pressed": a.selectedId === e.id,
|
|
262
|
+
onClick: () => a.onSelect(e.id),
|
|
263
|
+
...u,
|
|
264
|
+
children: p
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
function N(e, t, n) {
|
|
268
|
+
switch (e.kind) {
|
|
269
|
+
case "masked": return "×";
|
|
270
|
+
case "missing": return "—";
|
|
271
|
+
case "value": return n ? "!" : t.length <= A ? t : e.value === 0 ? "0" : "•";
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function P(e, t, n) {
|
|
275
|
+
if (e === void 0) return "Not supplied";
|
|
276
|
+
switch (e.kind) {
|
|
277
|
+
case "value": return `${n(e.value)}${b(e.value, t) ? "" : " (outside domain)"}`;
|
|
278
|
+
case "masked": return `Masked: ${e.reason}`;
|
|
279
|
+
case "missing": return `Missing: ${e.reason}`;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function F({ rows: e, columns: t, cells: n, domain: r, palette: i }) {
|
|
283
|
+
let o = y({
|
|
284
|
+
domain: r,
|
|
285
|
+
palette: i
|
|
286
|
+
});
|
|
287
|
+
if (o !== null) return o;
|
|
288
|
+
if (e.length * t.length > 4096 || n.length > 4096) return `This matrix exceeds the ${k}-cell render limit. Supply a smaller, labelled window.`;
|
|
289
|
+
let s = new Set(e.map((e) => e.id)), c = new Set(t.map((e) => e.id));
|
|
290
|
+
if (!a(e) || !a(t) || !a(n)) return "Matrix rows, columns, and cells must have unique identifiers.";
|
|
291
|
+
let l = /* @__PURE__ */ new Map();
|
|
292
|
+
for (let e of n) {
|
|
293
|
+
if (!s.has(e.rowId) || !c.has(e.columnId)) return "Every matrix cell must refer to a supplied row and column.";
|
|
294
|
+
if (e.kind === "value" && !Number.isFinite(e.value)) return "Measured matrix values must be finite. Use a missing cell for unavailable values.";
|
|
295
|
+
let t = l.get(e.rowId) ?? /* @__PURE__ */ new Set();
|
|
296
|
+
if (t.has(e.columnId)) return "A matrix coordinate may contain only one cell.";
|
|
297
|
+
t.add(e.columnId), l.set(e.rowId, t);
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
// packages/charts/src/matrix/token-heatmap.tsx
|
|
302
|
+
var I = {
|
|
303
|
+
token: {
|
|
304
|
+
k1xSpc: "xt0psk2",
|
|
305
|
+
kmVPX3: "x1717udv",
|
|
306
|
+
kMzoRj: "xc342km",
|
|
307
|
+
kt9PQ7: "x2x41l1",
|
|
308
|
+
kfdmCh: "x1q0q8m5",
|
|
309
|
+
kMv6JI: "xjb2p0i",
|
|
310
|
+
kGuDYH: "x1qlqyl8",
|
|
311
|
+
k63SB2: "x1pd3egz",
|
|
312
|
+
kLWn49: "x15bjb6t",
|
|
313
|
+
kMwMTN: "xgl13c",
|
|
314
|
+
kWkggS: "x1l90twa",
|
|
315
|
+
khDVqt: "xq9mrsl",
|
|
316
|
+
keMLs9: "xyh5bb9",
|
|
317
|
+
$$css: !0
|
|
318
|
+
},
|
|
319
|
+
color: (e) => [{
|
|
320
|
+
kL6WhQ: e == null ? e : "xrwkz7t",
|
|
321
|
+
$$css: !0
|
|
322
|
+
}, { "--x-borderBottomColor": e ?? void 0 }],
|
|
323
|
+
missing: {
|
|
324
|
+
kfdmCh: "xp9b3b8",
|
|
325
|
+
kL6WhQ: "x1hiteuv",
|
|
326
|
+
$$css: !0
|
|
327
|
+
},
|
|
328
|
+
interactive: {
|
|
329
|
+
kkrTdU: "x1ypdohk",
|
|
330
|
+
kLWn49: "x1hyyzld x1i9kvde",
|
|
331
|
+
kPJHz1: "xnktsf1",
|
|
332
|
+
kZs9gx: "x1m2ab5f",
|
|
333
|
+
k7shQP: "x9v5kkp",
|
|
334
|
+
kiEn40: "x13iak60",
|
|
335
|
+
kGzVvX: "x160po9z",
|
|
336
|
+
$$css: !0
|
|
337
|
+
},
|
|
338
|
+
selected: {
|
|
339
|
+
kMeerF: "xhb1w9w",
|
|
340
|
+
kjBf7l: "xnoxefp",
|
|
341
|
+
k3XXqK: "xaatb59",
|
|
342
|
+
kInvED: "x1y3gkto",
|
|
343
|
+
$$css: !0
|
|
344
|
+
}
|
|
345
|
+
}, L = 2048;
|
|
346
|
+
function R({ title: e, description: n, tokens: i, domain: a, palette: s, valueLabel: l, formatValue: u, selection: d, emptyLabel: p }) {
|
|
347
|
+
let m = z({
|
|
348
|
+
tokens: i,
|
|
349
|
+
domain: a,
|
|
350
|
+
palette: s
|
|
351
|
+
});
|
|
352
|
+
return m === null ? /* @__PURE__ */ g(o, {
|
|
353
|
+
title: e,
|
|
354
|
+
description: n,
|
|
355
|
+
footer: /* @__PURE__ */ h(T, {
|
|
356
|
+
label: l,
|
|
357
|
+
domain: a,
|
|
358
|
+
palette: s,
|
|
359
|
+
formatValue: u
|
|
360
|
+
}),
|
|
361
|
+
children: [i.length === 0 ? /* @__PURE__ */ h("p", {
|
|
362
|
+
className: "x1ghz6dp xv9cywu x118kxxs x1hyyzld",
|
|
363
|
+
children: p
|
|
364
|
+
}) : /* @__PURE__ */ h("p", {
|
|
365
|
+
"aria-label": `${e} token text`,
|
|
366
|
+
className: "x1ghz6dp xgl13c xdxxwph x118kxxs x1hyyzld x126k92a xj0a0fe",
|
|
367
|
+
children: i.map((e) => {
|
|
368
|
+
let t = e.score !== null && !b(e.score, a), n = e.score === null ? "Unavailable" : `${u(e.score)}${t ? " (outside domain)" : ""}`, r = `Token ${e.index}, ${JSON.stringify(e.text)}, ${l}: ${n}`, i = f.props(I.token, e.score === null || t ? I.missing : I.color(x(e.score, {
|
|
369
|
+
domain: a,
|
|
370
|
+
palette: s
|
|
371
|
+
})), d !== void 0 && I.interactive, d?.selectedId === e.id && I.selected);
|
|
372
|
+
return d === void 0 ? /* @__PURE__ */ h("span", {
|
|
373
|
+
title: r,
|
|
374
|
+
...i,
|
|
375
|
+
children: e.text
|
|
376
|
+
}, e.id) : /* @__PURE__ */ h("button", {
|
|
377
|
+
type: "button",
|
|
378
|
+
"aria-label": r,
|
|
379
|
+
"aria-pressed": d.selectedId === e.id,
|
|
380
|
+
onClick: () => d.onSelect(e.id),
|
|
381
|
+
...i,
|
|
382
|
+
children: e.text
|
|
383
|
+
}, e.id);
|
|
384
|
+
})
|
|
385
|
+
}), i.length > 0 && /* @__PURE__ */ h(r, {
|
|
386
|
+
label: "Token values",
|
|
387
|
+
children: /* @__PURE__ */ g("table", {
|
|
388
|
+
className: "xh8yej3 x1mwwwfo x1yc453h xut3y95 xam3yii",
|
|
389
|
+
children: [/* @__PURE__ */ h("thead", { children: /* @__PURE__ */ g("tr", { children: [
|
|
390
|
+
/* @__PURE__ */ h("th", {
|
|
391
|
+
scope: "col",
|
|
392
|
+
className: "xlfmwf6 x13hf59f xso031l x1q0q8m5 x7a6td9 x1yc453h xo1l8bm",
|
|
393
|
+
children: "Index"
|
|
394
|
+
}),
|
|
395
|
+
/* @__PURE__ */ h("th", {
|
|
396
|
+
scope: "col",
|
|
397
|
+
className: "xlfmwf6 x13hf59f xso031l x1q0q8m5 x7a6td9 x1yc453h xo1l8bm",
|
|
398
|
+
children: "Exact text"
|
|
399
|
+
}),
|
|
400
|
+
/* @__PURE__ */ h("th", {
|
|
401
|
+
scope: "col",
|
|
402
|
+
className: "xlfmwf6 x13hf59f xso031l x1q0q8m5 x7a6td9 x1yc453h xo1l8bm",
|
|
403
|
+
children: l
|
|
404
|
+
})
|
|
405
|
+
] }) }), /* @__PURE__ */ h("tbody", { children: i.map((e) => /* @__PURE__ */ g("tr", { children: [
|
|
406
|
+
/* @__PURE__ */ h("td", {
|
|
407
|
+
className: "xlfmwf6 x13hf59f xso031l x1q0q8m5 x7a6td9 x1yc453h xo1l8bm x6d1rm9",
|
|
408
|
+
children: /* @__PURE__ */ h(t, {
|
|
409
|
+
label: `Select token ${e.index}: ${JSON.stringify(e.text)}`,
|
|
410
|
+
selected: d?.selectedId === e.id,
|
|
411
|
+
onSelect: d === void 0 ? void 0 : () => d.onSelect(e.id),
|
|
412
|
+
children: e.index
|
|
413
|
+
})
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ h("td", {
|
|
416
|
+
className: "xlfmwf6 x13hf59f xso031l x1q0q8m5 x7a6td9 x1yc453h xo1l8bm xdxxwph x126k92a xj0a0fe",
|
|
417
|
+
children: JSON.stringify(e.text)
|
|
418
|
+
}),
|
|
419
|
+
/* @__PURE__ */ h("td", {
|
|
420
|
+
className: "xlfmwf6 x13hf59f xso031l x1q0q8m5 x7a6td9 x1yc453h xo1l8bm",
|
|
421
|
+
children: e.score === null ? "Unavailable" : `${u(e.score)}${b(e.score, a) ? "" : " (outside domain)"}`
|
|
422
|
+
})
|
|
423
|
+
] }, e.id)) })]
|
|
424
|
+
})
|
|
425
|
+
})]
|
|
426
|
+
}) : /* @__PURE__ */ h(c, {
|
|
427
|
+
title: e,
|
|
428
|
+
description: n,
|
|
429
|
+
message: m
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
function z({ tokens: e, domain: t, palette: n }) {
|
|
433
|
+
let r = y({
|
|
434
|
+
domain: t,
|
|
435
|
+
palette: n
|
|
436
|
+
});
|
|
437
|
+
return r === null ? e.length > 2048 ? `This token view exceeds the ${L}-token render limit. Supply a smaller, labelled window.` : !a(e) || new Set(e.map((e) => e.index)).size !== e.length ? "Tokens must have unique identifiers and supplied indices." : e.some((e) => {
|
|
438
|
+
let t = !Number.isSafeInteger(e.index) || e.index < 0, n = e.score !== null && !Number.isFinite(e.score);
|
|
439
|
+
return t || n;
|
|
440
|
+
}) ? "Token indices must be nonnegative integers and measured scores must be finite. Use null for unavailable scores." : null : r;
|
|
441
|
+
}
|
|
442
|
+
// packages/charts/src/matrix/scatter-plot.tsx
|
|
443
|
+
var B = 260, V = 56, H = 20, U = 12, W = 1e3, G = {
|
|
444
|
+
kzqmXN: "x1xc55vz",
|
|
445
|
+
kZKoxP: "xdk7pt",
|
|
446
|
+
kaIpWk: "x16rqkct",
|
|
447
|
+
$$css: !0
|
|
448
|
+
}, K = {
|
|
449
|
+
brush: {
|
|
450
|
+
kFalU9: "xx69xxh",
|
|
451
|
+
kkrTdU: "xsid9ct",
|
|
452
|
+
$$css: !0
|
|
453
|
+
},
|
|
454
|
+
target: {
|
|
455
|
+
kVAEAm: "x10l6tqk",
|
|
456
|
+
k1xSpc: "xrvj5dj",
|
|
457
|
+
kgQiWS: "x1ku5rj1",
|
|
458
|
+
kzqmXN: "x187nhsf",
|
|
459
|
+
kZKoxP: "xn3w4p2",
|
|
460
|
+
k3aq6I: "x11lhmoz",
|
|
461
|
+
kMzoRj: "xc342km",
|
|
462
|
+
kmVPX3: "x1717udv",
|
|
463
|
+
kWkggS: "xjbqb8w",
|
|
464
|
+
kkrTdU: "x1ypdohk",
|
|
465
|
+
kfzvcC: "x67bb7w",
|
|
466
|
+
kPJHz1: "xnktsf1",
|
|
467
|
+
kZs9gx: "x1m2ab5f",
|
|
468
|
+
k7shQP: "x9v5kkp",
|
|
469
|
+
kiEn40: "x175ew0f",
|
|
470
|
+
kguI0P: "xsi0z05",
|
|
471
|
+
kUjPgX: "xh5xat1",
|
|
472
|
+
kFU1ZQ: "xbpze6h",
|
|
473
|
+
kRG58y: "x1cdmj33",
|
|
474
|
+
$$css: !0
|
|
475
|
+
},
|
|
476
|
+
location: (e, t) => [{
|
|
477
|
+
kbCHJM: e == null ? e : "xgq9j65",
|
|
478
|
+
k87sOh: t == null ? t : "xjbys53",
|
|
479
|
+
$$css: !0
|
|
480
|
+
}, {
|
|
481
|
+
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
482
|
+
"--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
483
|
+
}],
|
|
484
|
+
dot: (e) => [
|
|
485
|
+
G,
|
|
486
|
+
{
|
|
487
|
+
kWkggS: e == null ? e : "xl8spv7",
|
|
488
|
+
$$css: !0
|
|
489
|
+
},
|
|
490
|
+
{ "--x-backgroundColor": e ?? void 0 }
|
|
491
|
+
],
|
|
492
|
+
selected: {
|
|
493
|
+
kMeerF: "xhb1w9w",
|
|
494
|
+
kjBf7l: "xhn9owy",
|
|
495
|
+
k3XXqK: "xaatb59",
|
|
496
|
+
kInvED: "x1ewu8gn",
|
|
497
|
+
$$css: !0
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
function q(e) {
|
|
501
|
+
let { title: n, description: a, points: s, xDomain: l, yDomain: u, xLabel: p, yLabel: m, formatX: v, formatY: y, selection: b, rangeSelection: x, emptyLabel: S } = e, { ref: C, width: w } = d(), T = X(e);
|
|
502
|
+
if (T !== null) return /* @__PURE__ */ h(c, {
|
|
503
|
+
title: n,
|
|
504
|
+
description: a,
|
|
505
|
+
message: T
|
|
506
|
+
});
|
|
507
|
+
let E = _({
|
|
508
|
+
domain: [...l],
|
|
509
|
+
range: [V, Math.max(V, w - H)]
|
|
510
|
+
}), D = _({
|
|
511
|
+
domain: [...u],
|
|
512
|
+
range: [216, U]
|
|
513
|
+
});
|
|
514
|
+
return /* @__PURE__ */ g(o, {
|
|
515
|
+
title: n,
|
|
516
|
+
description: a,
|
|
517
|
+
children: [
|
|
518
|
+
s.length === 0 ? /* @__PURE__ */ h("p", {
|
|
519
|
+
className: "x1ghz6dp xv9cywu",
|
|
520
|
+
children: S
|
|
521
|
+
}) : /* @__PURE__ */ g("div", {
|
|
522
|
+
ref: C,
|
|
523
|
+
className: "x1n2onr6 xeuugli",
|
|
524
|
+
children: [/* @__PURE__ */ h(J, {
|
|
525
|
+
width: w,
|
|
526
|
+
scaleX: E,
|
|
527
|
+
scaleY: D,
|
|
528
|
+
...e
|
|
529
|
+
}, `${l[0]}:${l[1]}:${u[0]}:${u[1]}:${w}`), b !== void 0 && /* @__PURE__ */ h("div", {
|
|
530
|
+
className: "x10l6tqk x10a8y8t x1n71m9f x47corl",
|
|
531
|
+
children: s.map((e) => /* @__PURE__ */ h("button", {
|
|
532
|
+
type: "button",
|
|
533
|
+
title: e.label,
|
|
534
|
+
"aria-label": `${e.label}, ${p}: ${v(e.x)}, ${m}: ${y(e.y)}`,
|
|
535
|
+
"aria-pressed": b.selectedId === e.id,
|
|
536
|
+
onClick: () => b.onSelect(e.id),
|
|
537
|
+
...f.props(K.target, K.location(E(e.x), D(e.y))),
|
|
538
|
+
children: /* @__PURE__ */ h("span", {
|
|
539
|
+
"aria-hidden": !0,
|
|
540
|
+
...f.props(K.dot(i[e.tone]), b.selectedId === e.id && K.selected)
|
|
541
|
+
})
|
|
542
|
+
}, e.id))
|
|
543
|
+
})]
|
|
544
|
+
}),
|
|
545
|
+
x !== void 0 && /* @__PURE__ */ h(Y, {
|
|
546
|
+
...e,
|
|
547
|
+
rangeSelection: x
|
|
548
|
+
}),
|
|
549
|
+
s.length > 0 && /* @__PURE__ */ h(r, { children: s.map((e) => /* @__PURE__ */ g(t, {
|
|
550
|
+
label: `${e.label}, ${p}: ${v(e.x)}, ${m}: ${y(e.y)}`,
|
|
551
|
+
selected: b?.selectedId === e.id,
|
|
552
|
+
onSelect: b === void 0 ? void 0 : () => b.onSelect(e.id),
|
|
553
|
+
children: [/* @__PURE__ */ h("span", { children: e.label }), /* @__PURE__ */ g("span", {
|
|
554
|
+
className: "xss6m8b xuxw1ft xv9cywu",
|
|
555
|
+
children: [
|
|
556
|
+
v(e.x),
|
|
557
|
+
" · ",
|
|
558
|
+
y(e.y)
|
|
559
|
+
]
|
|
560
|
+
})]
|
|
561
|
+
}, e.id)) })
|
|
562
|
+
]
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
function J({ width: e, scaleX: t, scaleY: r, points: a, xLabel: o, yLabel: s, formatX: c, formatY: l, selection: u, rangeSelection: d }) {
|
|
566
|
+
let _ = p(), [v, y] = m(null), b = v === null ? d?.value : {
|
|
567
|
+
x: [Math.min(v.start.x, v.end.x), Math.max(v.start.x, v.end.x)],
|
|
568
|
+
y: [Math.min(v.start.y, v.end.y), Math.max(v.start.y, v.end.y)]
|
|
569
|
+
};
|
|
570
|
+
function x(n) {
|
|
571
|
+
let i = n.currentTarget.getBoundingClientRect();
|
|
572
|
+
return {
|
|
573
|
+
x: t.copy().clamp(!0).invert((n.clientX - i.left) / i.width * e),
|
|
574
|
+
y: r.copy().clamp(!0).invert((n.clientY - i.top) / i.height * B)
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function S(t) {
|
|
578
|
+
if (d === void 0 || t.button !== 0 || t.pointerType === "touch") return;
|
|
579
|
+
let n = t.currentTarget.getBoundingClientRect(), r = (t.clientX - n.left) / n.width * e, i = (t.clientY - n.top) / n.height * B;
|
|
580
|
+
if (r < V || r > e - H || i < U || i > 216) return;
|
|
581
|
+
let a = x(t);
|
|
582
|
+
t.currentTarget.setPointerCapture(t.pointerId), y({
|
|
583
|
+
start: a,
|
|
584
|
+
end: a,
|
|
585
|
+
pointerId: t.pointerId
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
function C(e) {
|
|
589
|
+
v !== null && v.pointerId === e.pointerId && y({
|
|
590
|
+
...v,
|
|
591
|
+
end: x(e)
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
function w(e) {
|
|
595
|
+
if (v === null || v.pointerId !== e.pointerId) return;
|
|
596
|
+
let t = x(e), n = {
|
|
597
|
+
x: [Math.min(v.start.x, t.x), Math.max(v.start.x, t.x)],
|
|
598
|
+
y: [Math.min(v.start.y, t.y), Math.max(v.start.y, t.y)]
|
|
599
|
+
};
|
|
600
|
+
y(null), e.currentTarget.releasePointerCapture(e.pointerId), d?.onChange(n);
|
|
601
|
+
}
|
|
602
|
+
return /* @__PURE__ */ g("svg", {
|
|
603
|
+
width: e,
|
|
604
|
+
height: B,
|
|
605
|
+
viewBox: `0 0 ${e} ${B}`,
|
|
606
|
+
"aria-hidden": !0,
|
|
607
|
+
onPointerDown: S,
|
|
608
|
+
onPointerMove: C,
|
|
609
|
+
onPointerUp: w,
|
|
610
|
+
onPointerCancel: () => y(null),
|
|
611
|
+
onLostPointerCapture: () => y(null),
|
|
612
|
+
...f.props(n.svg, d !== void 0 && K.brush),
|
|
613
|
+
children: [
|
|
614
|
+
/* @__PURE__ */ h("defs", { children: /* @__PURE__ */ h("clipPath", {
|
|
615
|
+
id: _,
|
|
616
|
+
children: /* @__PURE__ */ h("rect", {
|
|
617
|
+
x: V,
|
|
618
|
+
y: U,
|
|
619
|
+
width: Math.max(0, e - V - H),
|
|
620
|
+
height: 204
|
|
621
|
+
})
|
|
622
|
+
}) }),
|
|
623
|
+
t.ticks(5).map((e) => /* @__PURE__ */ g("g", { children: [/* @__PURE__ */ h("line", {
|
|
624
|
+
x1: t(e),
|
|
625
|
+
x2: t(e),
|
|
626
|
+
y1: U,
|
|
627
|
+
y2: 216,
|
|
628
|
+
...f.props(n.grid)
|
|
629
|
+
}), /* @__PURE__ */ h("text", {
|
|
630
|
+
x: t(e),
|
|
631
|
+
y: 234,
|
|
632
|
+
textAnchor: "middle",
|
|
633
|
+
...f.props(n.label),
|
|
634
|
+
children: c(e)
|
|
635
|
+
})] }, e)),
|
|
636
|
+
r.ticks(4).map((t) => /* @__PURE__ */ g("g", { children: [/* @__PURE__ */ h("line", {
|
|
637
|
+
x1: V,
|
|
638
|
+
x2: e - H,
|
|
639
|
+
y1: r(t),
|
|
640
|
+
y2: r(t),
|
|
641
|
+
...f.props(n.grid)
|
|
642
|
+
}), /* @__PURE__ */ h("text", {
|
|
643
|
+
x: 48,
|
|
644
|
+
y: r(t) + 4,
|
|
645
|
+
textAnchor: "end",
|
|
646
|
+
...f.props(n.label),
|
|
647
|
+
children: l(t)
|
|
648
|
+
})] }, t)),
|
|
649
|
+
/* @__PURE__ */ h("text", {
|
|
650
|
+
x: (V + e - H) / 2,
|
|
651
|
+
y: 256,
|
|
652
|
+
textAnchor: "middle",
|
|
653
|
+
...f.props(n.label),
|
|
654
|
+
children: o
|
|
655
|
+
}),
|
|
656
|
+
/* @__PURE__ */ h("text", {
|
|
657
|
+
x: 12,
|
|
658
|
+
y: 108,
|
|
659
|
+
textAnchor: "middle",
|
|
660
|
+
transform: "rotate(-90 12 108)",
|
|
661
|
+
...f.props(n.label),
|
|
662
|
+
children: s
|
|
663
|
+
}),
|
|
664
|
+
/* @__PURE__ */ g("g", {
|
|
665
|
+
clipPath: `url(#${_})`,
|
|
666
|
+
children: [b != null && /* @__PURE__ */ h("rect", {
|
|
667
|
+
x: t(b.x[0]),
|
|
668
|
+
y: r(b.y[1]),
|
|
669
|
+
width: t(b.x[1]) - t(b.x[0]),
|
|
670
|
+
height: r(b.y[0]) - r(b.y[1]),
|
|
671
|
+
className: "x1haa5rn xv7c1pl x16jnhk7 xnpr05h x15lqr97 x47corl"
|
|
672
|
+
}), u === void 0 && a.map((e) => /* @__PURE__ */ h("circle", {
|
|
673
|
+
cx: t(e.x),
|
|
674
|
+
cy: r(e.y),
|
|
675
|
+
r: 4,
|
|
676
|
+
fill: i[e.tone]
|
|
677
|
+
}, e.id))]
|
|
678
|
+
})
|
|
679
|
+
]
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
function Y({ rangeSelection: e, xDomain: t, yDomain: n, xLabel: r, yLabel: i, formatX: a, formatY: o }) {
|
|
683
|
+
let s = e.value ?? {
|
|
684
|
+
x: t,
|
|
685
|
+
y: n
|
|
686
|
+
};
|
|
687
|
+
return /* @__PURE__ */ g("fieldset", {
|
|
688
|
+
className: "xrvj5dj xtmze7h x1dj7zaa xc342km x1717udv xeuugli",
|
|
689
|
+
children: [
|
|
690
|
+
/* @__PURE__ */ h("legend", {
|
|
691
|
+
className: "xv9cywu xut3y95 xegg4c4",
|
|
692
|
+
children: "Drag with a mouse, or adjust these bounds to select a coordinate range."
|
|
693
|
+
}),
|
|
694
|
+
/* @__PURE__ */ g(u.Root, {
|
|
695
|
+
value: s.x,
|
|
696
|
+
min: t[0],
|
|
697
|
+
max: t[1],
|
|
698
|
+
step: e.xStep,
|
|
699
|
+
locale: e.locale,
|
|
700
|
+
thumbCollisionBehavior: "none",
|
|
701
|
+
onValueChange: (t) => e.onChange({
|
|
702
|
+
x: t,
|
|
703
|
+
y: s.y
|
|
704
|
+
}),
|
|
705
|
+
children: [/* @__PURE__ */ g("div", {
|
|
706
|
+
className: "x78zum5 x1qughib xf0fr40 xv9cywu xut3y95",
|
|
707
|
+
children: [/* @__PURE__ */ h(u.Label, { children: r }), /* @__PURE__ */ g("span", { children: [
|
|
708
|
+
a(s.x[0]),
|
|
709
|
+
" – ",
|
|
710
|
+
a(s.x[1])
|
|
711
|
+
] })]
|
|
712
|
+
}), /* @__PURE__ */ h(u.Control, { children: /* @__PURE__ */ g(u.Track, { children: [
|
|
713
|
+
/* @__PURE__ */ h(u.Indicator, {}),
|
|
714
|
+
/* @__PURE__ */ h(u.Thumb, {
|
|
715
|
+
index: 0,
|
|
716
|
+
"aria-label": `${r} minimum`,
|
|
717
|
+
getAriaValueText: (e, t) => a(t)
|
|
718
|
+
}),
|
|
719
|
+
/* @__PURE__ */ h(u.Thumb, {
|
|
720
|
+
index: 1,
|
|
721
|
+
"aria-label": `${r} maximum`,
|
|
722
|
+
getAriaValueText: (e, t) => a(t)
|
|
723
|
+
})
|
|
724
|
+
] }) })]
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ g(u.Root, {
|
|
727
|
+
value: s.y,
|
|
728
|
+
min: n[0],
|
|
729
|
+
max: n[1],
|
|
730
|
+
step: e.yStep,
|
|
731
|
+
locale: e.locale,
|
|
732
|
+
thumbCollisionBehavior: "none",
|
|
733
|
+
onValueChange: (t) => e.onChange({
|
|
734
|
+
x: s.x,
|
|
735
|
+
y: t
|
|
736
|
+
}),
|
|
737
|
+
children: [/* @__PURE__ */ g("div", {
|
|
738
|
+
className: "x78zum5 x1qughib xf0fr40 xv9cywu xut3y95",
|
|
739
|
+
children: [/* @__PURE__ */ h(u.Label, { children: i }), /* @__PURE__ */ g("span", { children: [
|
|
740
|
+
o(s.y[0]),
|
|
741
|
+
" – ",
|
|
742
|
+
o(s.y[1])
|
|
743
|
+
] })]
|
|
744
|
+
}), /* @__PURE__ */ h(u.Control, { children: /* @__PURE__ */ g(u.Track, { children: [
|
|
745
|
+
/* @__PURE__ */ h(u.Indicator, {}),
|
|
746
|
+
/* @__PURE__ */ h(u.Thumb, {
|
|
747
|
+
index: 0,
|
|
748
|
+
"aria-label": `${i} minimum`,
|
|
749
|
+
getAriaValueText: (e, t) => o(t)
|
|
750
|
+
}),
|
|
751
|
+
/* @__PURE__ */ h(u.Thumb, {
|
|
752
|
+
index: 1,
|
|
753
|
+
"aria-label": `${i} maximum`,
|
|
754
|
+
getAriaValueText: (e, t) => o(t)
|
|
755
|
+
})
|
|
756
|
+
] }) })]
|
|
757
|
+
}),
|
|
758
|
+
/* @__PURE__ */ h(l, {
|
|
759
|
+
type: "button",
|
|
760
|
+
disabled: e.value === null,
|
|
761
|
+
onClick: () => e.onChange(null),
|
|
762
|
+
children: "Clear range"
|
|
763
|
+
})
|
|
764
|
+
]
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
function X({ points: e, xDomain: t, yDomain: n, rangeSelection: r }) {
|
|
768
|
+
if (!s(t) || !s(n)) return "Scatter domains must contain finite, increasing endpoints.";
|
|
769
|
+
if (e.length > 1e3) return `This plot exceeds the ${W}-point render limit. Supply a smaller, labelled sample.`;
|
|
770
|
+
if (!a(e)) return "Scatter points must have unique identifiers.";
|
|
771
|
+
if (e.some((e) => !Number.isFinite(e.x) || !Number.isFinite(e.y))) return "Scatter coordinates must be finite.";
|
|
772
|
+
if (e.some((e) => {
|
|
773
|
+
let r = e.x < t[0] || e.x > t[1], i = e.y < n[0] || e.y > n[1];
|
|
774
|
+
return r || i;
|
|
775
|
+
})) return "Scatter coordinates fall outside the declared domain. Widen the domain or supply a labelled window of points.";
|
|
776
|
+
if (r === void 0) return null;
|
|
777
|
+
let i = Number.isFinite(r.xStep) && r.xStep > 0 && r.xStep <= t[1] - t[0], o = Number.isFinite(r.yStep) && r.yStep > 0 && r.yStep <= n[1] - n[0];
|
|
778
|
+
if (!i || !o) return "Range selection steps must be finite, positive, and no larger than their domain span.";
|
|
779
|
+
let c = r.value;
|
|
780
|
+
return c === null ? null : !Z(c.x, t) || !Z(c.y, n) ? "The selected range must have finite, ordered bounds inside the declared domain." : null;
|
|
781
|
+
}
|
|
782
|
+
function Z(e, t) {
|
|
783
|
+
return !e.every(Number.isFinite) || e[0] > e[1] ? !1 : e[0] >= t[0] && e[1] <= t[1];
|
|
784
|
+
}
|
|
785
|
+
export { k as a, R as i, q as n, j as o, L as r, T as s, W as t };
|