@mechane-ai/elements 0.45.0 → 0.46.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 +48 -18
- package/bin/mechane-elements-catalog.mjs +42 -4
- package/dist/ai.js +268 -202
- package/dist/catalog.json +91 -31
- package/dist/categorical-values-BXi-rJuv.js +74 -0
- package/dist/chart-cursor-1mFd48Jc.js +23 -0
- package/dist/chart-data-CIJVWCYt.js +21 -0
- package/dist/{chart-frame-Ztktqs1b.js → chart-frame-BaxKn_MB.js} +22 -41
- package/dist/{chart-input-BO3BqlFO.js → chart-input-Bm82_9Rd.js} +2 -2
- package/dist/chart-theme-4zprJ3rW.js +404 -0
- package/dist/charts/cartesian.js +1598 -1432
- package/dist/charts/distribution.js +476 -404
- package/dist/charts/graph.js +363 -349
- package/dist/charts/hierarchy.js +103 -94
- package/dist/charts/matrix.js +340 -333
- package/dist/charts/timeline.js +167 -134
- package/dist/charts.js +3 -3
- package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
- package/dist/collections.js +1648 -1188
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +67 -66
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/csp.js +6 -11
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +274 -214
- package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
- package/dist/forms.js +3 -3
- package/dist/index.js +1 -1
- package/dist/layout.js +207 -207
- package/dist/navigation.js +4 -3
- package/dist/packages/ai/src/conversation.d.ts +2 -0
- package/dist/packages/ai/src/prompt-input.d.ts +7 -2
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/index.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +8 -2
- package/dist/packages/charts/src/cartesian/time-series.d.ts +11 -1
- package/dist/packages/charts/src/categorical-values.d.ts +14 -9
- package/dist/packages/charts/src/chart-frame.d.ts +7 -9
- package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
- package/dist/packages/charts/src/chart-range.d.ts +33 -0
- package/dist/packages/charts/src/chart-rows.d.ts +20 -0
- package/dist/packages/charts/src/chart-theme.d.ts +17 -0
- package/dist/packages/charts/src/chart.d.ts +81 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -4
- package/dist/packages/charts/src/index.d.ts +1 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +3 -3
- package/dist/packages/charts/src/plot-width.d.ts +0 -1
- package/dist/packages/charts/src/timeline/index.d.ts +1 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +6 -2
- package/dist/packages/collections/src/collection-controls.d.ts +5 -1
- package/dist/packages/collections/src/collection-filters.d.ts +4 -1
- package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
- package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
- package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
- package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
- package/dist/packages/collections/src/data-table-text.d.ts +13 -0
- package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
- package/dist/packages/collections/src/data-table.d.ts +3 -85
- package/dist/packages/collections/src/index.d.ts +11 -6
- package/dist/packages/collections/src/query-controls.d.ts +6 -2
- package/dist/packages/collections/src/table-results.d.ts +47 -13
- package/dist/packages/collections/src/timeline.d.ts +1 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
- package/dist/packages/collections/src/use-table-window.d.ts +25 -0
- package/dist/packages/content/src/viewer.d.ts +8 -0
- package/dist/packages/core/src/disclosure.d.ts +9 -1
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/route-link.d.ts +11 -0
- package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
- package/dist/packages/forms/src/file-picker.d.ts +15 -0
- package/dist/packages/forms/src/form-controls.d.ts +1 -6
- package/dist/packages/forms/src/forms.d.ts +4 -1
- package/dist/packages/forms/src/index.d.ts +4 -2
- package/dist/packages/forms/src/selection.d.ts +14 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
- package/dist/packages/navigation/src/index.d.ts +1 -1
- package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
- package/dist/plot-width-v2c_rA20.js +63 -0
- package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
- package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
- package/dist/src-CGc_hjxJ.js +409 -0
- package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
- package/dist/{src-Dcs3SZ9V.js → src-DVHlknB6.js} +1 -1
- package/dist/styles2.css +136 -114
- package/package.json +1 -4
- package/skills/extend-elements/SKILL.md +74 -0
- package/skills/review-elements/SKILL.md +76 -0
- package/skills/upgrade-elements/SKILL.md +34 -0
- package/skills/upgrade-elements/references/releases.md +58 -0
- package/skills/use-elements/SKILL.md +64 -13
- package/skills/use-elements/references/agent.md +57 -0
- package/skills/use-elements/references/charts.md +63 -0
- package/skills/use-elements/references/collections.md +89 -0
- package/skills/use-elements/references/conversations.md +47 -0
- package/skills/use-elements/references/forms.md +81 -0
- package/skills/use-elements/references/styling.md +70 -0
- package/skills/use-elements/references/workspace.md +3 -3
- package/dist/categorical-values-DZLGQVW1.js +0 -63
- package/dist/chart-navigation-BAbb5PV9.js +0 -154
- package/dist/header-styles-COxCYFZx.js +0 -90
- package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
- package/dist/packages/charts/src/chart-surface.d.ts +0 -27
- package/dist/packages/navigation/src/route-link.d.ts +0 -2
- package/dist/plot-width-CIqBiHcd.js +0 -105
- package/dist/src-Bk7M67zy.js +0 -396
package/dist/charts/matrix.js
CHANGED
|
@@ -1,70 +1,71 @@
|
|
|
1
|
-
import { c as e } from "../src-
|
|
1
|
+
import { c as e } from "../src-DVHlknB6.js";
|
|
2
2
|
import { r as t } from "../tokens.stylex-dF5CACEJ.js";
|
|
3
|
-
import { n, r, t as i } from "../chart-input-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
3
|
+
import { n, r, t as i } from "../chart-input-Bm82_9Rd.js";
|
|
4
|
+
import { t as a } from "../chart-data-CIJVWCYt.js";
|
|
5
|
+
import { r as o, t as s } from "../chart-frame-BaxKn_MB.js";
|
|
6
|
+
import { i as c, l, n as u, o as d, r as f, s as p, t as m } from "../chart-theme-4zprJ3rW.js";
|
|
7
|
+
import * as h from "@stylexjs/stylex";
|
|
8
|
+
import { useId as g } from "react";
|
|
9
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
9
10
|
// packages/charts/src/matrix/heatmap-scale.ts
|
|
10
|
-
var
|
|
11
|
-
function
|
|
11
|
+
var y = 100;
|
|
12
|
+
function b({ domain: e, palette: t }) {
|
|
12
13
|
return r(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
|
}
|
|
14
|
-
function
|
|
15
|
+
function x(e, t) {
|
|
15
16
|
return e >= t[0] && e <= t[1];
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function S(n, { domain: r, palette: i }) {
|
|
18
19
|
if (i === "diverging") {
|
|
19
|
-
let i = n < 0 ? r[0] : r[1], a = Math.abs(n) / Math.abs(i) *
|
|
20
|
+
let i = n < 0 ? r[0] : r[1], a = Math.abs(n) / Math.abs(i) * y;
|
|
20
21
|
return `color-mix(in srgb, ${n < 0 ? e.negative : e.positive} ${a}%, ${t.surface})`;
|
|
21
22
|
}
|
|
22
|
-
let a = (n - r[0]) / (r[1] - r[0]) *
|
|
23
|
+
let a = (n - r[0]) / (r[1] - r[0]) * y;
|
|
23
24
|
return `color-mix(in srgb, ${e.series1} ${a}%, ${t.surface})`;
|
|
24
25
|
}
|
|
25
26
|
// packages/charts/src/matrix/color-legend.tsx
|
|
26
|
-
var
|
|
27
|
+
var C = {
|
|
27
28
|
kUk6DE: "x98rzlu",
|
|
28
29
|
$$css: !0
|
|
29
|
-
},
|
|
30
|
-
|
|
30
|
+
}, w = { sample: (e) => [
|
|
31
|
+
C,
|
|
31
32
|
{
|
|
32
33
|
kWkggS: e == null ? e : "xl8spv7",
|
|
33
34
|
$$css: !0
|
|
34
35
|
},
|
|
35
36
|
{ "--x-backgroundColor": e ?? void 0 }
|
|
36
|
-
] },
|
|
37
|
-
function
|
|
38
|
-
let i =
|
|
37
|
+
] }, T = 20;
|
|
38
|
+
function E({ label: e, domain: t, palette: n, formatValue: r }) {
|
|
39
|
+
let i = b({
|
|
39
40
|
domain: t,
|
|
40
41
|
palette: n
|
|
41
42
|
});
|
|
42
|
-
if (i !== null) return /* @__PURE__ */
|
|
43
|
+
if (i !== null) return /* @__PURE__ */ _("p", {
|
|
43
44
|
role: "status",
|
|
44
45
|
className: "xrvj5dj xunmzkg x1ghz6dp xeuugli x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k xj0a0fe",
|
|
45
46
|
children: i
|
|
46
47
|
});
|
|
47
|
-
let a = Array.from({ length: 21 }, (e, n) => t[0] + (t[1] - t[0]) * n /
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
let a = Array.from({ length: 21 }, (e, n) => t[0] + (t[1] - t[0]) * n / T);
|
|
49
|
+
return /* @__PURE__ */ v("div", {
|
|
49
50
|
"aria-label": `${e}: ${r(t[0])} to ${r(t[1])}`,
|
|
50
51
|
className: "xrvj5dj xunmzkg x1ghz6dp xeuugli x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k xj0a0fe",
|
|
51
52
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ v("span", { children: [e, n === "diverging" && ` · Neutral: ${r(0)}`] }),
|
|
54
|
+
/* @__PURE__ */ _("div", {
|
|
54
55
|
"aria-hidden": !0,
|
|
55
56
|
className: "x78zum5 xdk7pt xmkeg23 x1y0btm7 x1ey3b81",
|
|
56
|
-
children: a.map((e) => /* @__PURE__ */
|
|
57
|
+
children: a.map((e) => /* @__PURE__ */ _("span", { ...h.props(w.sample(S(e, {
|
|
57
58
|
domain: t,
|
|
58
59
|
palette: n
|
|
59
60
|
}))) }, e))
|
|
60
61
|
}),
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ v("div", {
|
|
62
63
|
"aria-hidden": !0,
|
|
63
64
|
className: "x78zum5 x1qughib x1n8ia3y xss6m8b",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
65
|
+
children: [/* @__PURE__ */ _("span", {
|
|
65
66
|
className: "xeuugli",
|
|
66
67
|
children: r(t[0])
|
|
67
|
-
}), /* @__PURE__ */
|
|
68
|
+
}), /* @__PURE__ */ _("span", {
|
|
68
69
|
className: "xeuugli xp4054r",
|
|
69
70
|
children: r(t[1])
|
|
70
71
|
})]
|
|
@@ -72,23 +73,23 @@ function S({ label: e, domain: t, palette: n, formatValue: r }) {
|
|
|
72
73
|
]
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function D(e, t, n) {
|
|
76
77
|
switch (e.kind) {
|
|
77
78
|
case "masked": return "×";
|
|
78
79
|
case "missing": return "—";
|
|
79
80
|
case "value": return n ? "!" : t.length <= 6 ? t : e.value === 0 ? "0" : "•";
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function O(e, t, n) {
|
|
83
84
|
if (e === void 0) return "Not supplied";
|
|
84
85
|
switch (e.kind) {
|
|
85
|
-
case "value": return `${n(e.value)}${
|
|
86
|
+
case "value": return `${n(e.value)}${x(e.value, t) ? "" : " (outside domain)"}`;
|
|
86
87
|
case "masked": return `Masked: ${e.reason}`;
|
|
87
88
|
case "missing": return `Missing: ${e.reason}`;
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
// packages/charts/src/matrix/matrix-strip.tsx
|
|
91
|
-
var
|
|
92
|
+
var k = {
|
|
92
93
|
k1xSpc: "xrvj5dj",
|
|
93
94
|
kumcoG: "xqketvx",
|
|
94
95
|
k1C7PZ: "xuwhhnn",
|
|
@@ -97,11 +98,11 @@ var T = {
|
|
|
97
98
|
k7Eaqz: "xeuugli",
|
|
98
99
|
kMv6JI: "x1hz01jw",
|
|
99
100
|
$$css: !0
|
|
100
|
-
},
|
|
101
|
+
}, A = {
|
|
101
102
|
kKwaWg: "x1e87kdn",
|
|
102
103
|
$$css: !0
|
|
103
|
-
},
|
|
104
|
-
grid: (e) => [
|
|
104
|
+
}, j = {
|
|
105
|
+
grid: (e) => [k, { "--x-gridTemplateColumns": `minmax(48px, max-content) repeat(${e}, minmax(14px, 1fr))` == null ? void 0 : `minmax(48px, max-content) repeat(${e}, minmax(14px, 1fr))` }],
|
|
105
106
|
cell: {
|
|
106
107
|
k1xSpc: "x78zum5",
|
|
107
108
|
kGNEyG: "x6s0dn4",
|
|
@@ -121,7 +122,7 @@ var T = {
|
|
|
121
122
|
kLWn49: "xo5v014",
|
|
122
123
|
$$css: !0
|
|
123
124
|
},
|
|
124
|
-
measured: (e) => [
|
|
125
|
+
measured: (e) => [A, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${e})` }],
|
|
125
126
|
empty: {
|
|
126
127
|
kWkggS: "x1r7kqkb",
|
|
127
128
|
$$css: !0
|
|
@@ -153,65 +154,59 @@ var T = {
|
|
|
153
154
|
$$css: !0
|
|
154
155
|
}
|
|
155
156
|
};
|
|
156
|
-
function
|
|
157
|
-
if (e === void 0) return [
|
|
157
|
+
function M({ cell: e, domain: t, palette: n }) {
|
|
158
|
+
if (e === void 0) return [j.empty];
|
|
158
159
|
switch (e.kind) {
|
|
159
|
-
case "masked": return [
|
|
160
|
-
case "missing": return [
|
|
161
|
-
case "value": return
|
|
160
|
+
case "masked": return [j.empty];
|
|
161
|
+
case "missing": return [j.dashed];
|
|
162
|
+
case "value": return x(e.value, t) ? [j.measured(S(e.value, {
|
|
162
163
|
domain: t,
|
|
163
164
|
palette: n
|
|
164
|
-
}))] : [
|
|
165
|
+
}))] : [j.dashed];
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
|
-
function
|
|
168
|
-
return e === void 0 ? "·" : e.kind === "value" &&
|
|
168
|
+
function N({ cell: e, text: t, domain: n }) {
|
|
169
|
+
return e === void 0 ? "·" : e.kind === "value" && x(e.value, n) ? "" : D(e, t, e.kind === "value");
|
|
169
170
|
}
|
|
170
|
-
function
|
|
171
|
-
return /* @__PURE__ */
|
|
172
|
-
...
|
|
171
|
+
function P({ rows: e, columns: t, cellAt: n, coordinateId: r, view: i, domain: a, palette: o, formatValue: s, selection: c }) {
|
|
172
|
+
return /* @__PURE__ */ v("div", {
|
|
173
|
+
...h.props(j.grid(t.length)),
|
|
173
174
|
children: [
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
t.map((e) => /* @__PURE__ */
|
|
175
|
+
/* @__PURE__ */ _("span", { "aria-hidden": !0 }),
|
|
176
|
+
t.map((e) => /* @__PURE__ */ _("span", {
|
|
176
177
|
"aria-hidden": !0,
|
|
177
178
|
title: e.label,
|
|
178
179
|
className: "xeuugli xb3r6kr xbrixnn xuxw1ft x2b8uid x153jb6y xy8obcc xas2l8k",
|
|
179
180
|
children: e.axisLabel ?? e.label
|
|
180
181
|
}, e.id)),
|
|
181
|
-
e.map((e) => /* @__PURE__ */
|
|
182
|
+
e.map((e) => /* @__PURE__ */ v("div", {
|
|
182
183
|
className: "xjp7ctv",
|
|
183
|
-
children: [/* @__PURE__ */
|
|
184
|
+
children: [/* @__PURE__ */ _("span", {
|
|
184
185
|
"aria-hidden": !0,
|
|
185
186
|
title: e.label,
|
|
186
187
|
className: "x18qnofl xb3r6kr xlyipyv xuxw1ft x1fa0jp5 xbixft xy8obcc xas2l8k",
|
|
187
188
|
children: e.label
|
|
188
189
|
}), t.map((t) => {
|
|
189
|
-
let
|
|
190
|
-
cell:
|
|
191
|
-
domain:
|
|
192
|
-
palette:
|
|
193
|
-
}),
|
|
194
|
-
cell:
|
|
195
|
-
text:
|
|
196
|
-
domain:
|
|
190
|
+
let l = n(e.id, t.id), u = l?.id ?? r(e.id, t.id), d = O(l, a, s), p = `${e.label}, ${t.label}: ${d}`, g = l !== void 0 && c?.selectedId === l.id, v = !g && i.inspected !== u && i.cursor === u, y = h.props(j.cell, ...M({
|
|
191
|
+
cell: l,
|
|
192
|
+
domain: a,
|
|
193
|
+
palette: o
|
|
194
|
+
}), c !== void 0 && l !== void 0 && j.interactive, i.inspected === u && j.inspected, g && j.selected, v && m.cursor), b = N({
|
|
195
|
+
cell: l,
|
|
196
|
+
text: d,
|
|
197
|
+
domain: a
|
|
197
198
|
});
|
|
198
|
-
return
|
|
199
|
-
|
|
200
|
-
"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
title: g,
|
|
210
|
-
"aria-pressed": _,
|
|
211
|
-
onPointerEnter: () => a(m),
|
|
212
|
-
onClick: () => l.onSelect(u.id),
|
|
213
|
-
...v,
|
|
214
|
-
children: y
|
|
199
|
+
return /* @__PURE__ */ _(f, {
|
|
200
|
+
value: u,
|
|
201
|
+
render: c === void 0 || l === void 0 ? /* @__PURE__ */ _("span", { role: "img" }) : /* @__PURE__ */ _("button", {
|
|
202
|
+
type: "button",
|
|
203
|
+
tabIndex: -1,
|
|
204
|
+
"aria-pressed": g
|
|
205
|
+
}),
|
|
206
|
+
"aria-label": p,
|
|
207
|
+
title: p,
|
|
208
|
+
...y,
|
|
209
|
+
children: b
|
|
215
210
|
}, t.id);
|
|
216
211
|
})]
|
|
217
212
|
}, e.id))
|
|
@@ -219,10 +214,10 @@ function A({ rows: e, columns: t, cellAt: n, coordinateId: r, inspectedId: i, on
|
|
|
219
214
|
});
|
|
220
215
|
}
|
|
221
216
|
// packages/charts/src/matrix/matrix.tsx
|
|
222
|
-
var
|
|
217
|
+
var F = {
|
|
223
218
|
kKwaWg: "x1e87kdn",
|
|
224
219
|
$$css: !0
|
|
225
|
-
},
|
|
220
|
+
}, I = {
|
|
226
221
|
value: {
|
|
227
222
|
k1xSpc: "x78zum5",
|
|
228
223
|
kGNEyG: "x6s0dn4",
|
|
@@ -261,7 +256,7 @@ var j = {
|
|
|
261
256
|
kInvED: "x2ssjo2",
|
|
262
257
|
$$css: !0
|
|
263
258
|
},
|
|
264
|
-
measured: (e) => [
|
|
259
|
+
measured: (e) => [F, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${e})` }],
|
|
265
260
|
missing: {
|
|
266
261
|
kMwMTN: "x153jb6y",
|
|
267
262
|
kWkggS: "x1r7kqkb",
|
|
@@ -274,206 +269,213 @@ var j = {
|
|
|
274
269
|
$$css: !0
|
|
275
270
|
}
|
|
276
271
|
};
|
|
277
|
-
function
|
|
272
|
+
function L(e, t) {
|
|
278
273
|
return JSON.stringify([e, t]);
|
|
279
274
|
}
|
|
280
|
-
var
|
|
275
|
+
var R = {
|
|
281
276
|
value: void 0,
|
|
282
|
-
masked:
|
|
283
|
-
missing:
|
|
284
|
-
},
|
|
285
|
-
function
|
|
286
|
-
let
|
|
287
|
-
function
|
|
288
|
-
return
|
|
277
|
+
masked: I.masked,
|
|
278
|
+
missing: I.missing
|
|
279
|
+
}, z = 4096;
|
|
280
|
+
function B({ title: e, report: t, description: n, rows: r, columns: d, cells: f, domain: m, palette: h, valueLabel: y, formatValue: b, selection: S, emptyLabel: C, variant: w = "values" }) {
|
|
281
|
+
let T = w === "strip";
|
|
282
|
+
function D(e, t) {
|
|
283
|
+
return f.find((n) => n.rowId === e && n.columnId === t);
|
|
289
284
|
}
|
|
290
|
-
let
|
|
291
|
-
let n =
|
|
285
|
+
let k = new Map(r.map((e) => [e.id, e.label])), A = new Map(d.map((e) => [e.id, e.label])), j = T ? r.flatMap((e) => d.map((t) => {
|
|
286
|
+
let n = D(e.id, t.id);
|
|
292
287
|
return {
|
|
293
|
-
id: n?.id ??
|
|
294
|
-
label: `${e.label} → ${t.label}: ${
|
|
288
|
+
id: n?.id ?? L(e.id, t.id),
|
|
289
|
+
label: `${e.label} → ${t.label}: ${O(n, m, b)}`
|
|
295
290
|
};
|
|
296
|
-
}))
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
onSelect: O
|
|
301
|
-
} : y,
|
|
302
|
-
columnCount: C ? o.length : void 0,
|
|
303
|
-
items: C ? E : d.map((e) => ({
|
|
304
|
-
id: e.id,
|
|
305
|
-
label: `${r.find((t) => t.id === e.rowId)?.label ?? e.rowId} → ${o.find((t) => t.id === e.columnId)?.label ?? e.columnId}: ${w(e, f, v)}`
|
|
306
|
-
}))
|
|
307
|
-
});
|
|
308
|
-
function O(e) {
|
|
309
|
-
d.some((t) => t.id === e) && y?.onSelect(e);
|
|
310
|
-
}
|
|
311
|
-
let k = R({
|
|
291
|
+
})) : f.map((e) => ({
|
|
292
|
+
id: e.id,
|
|
293
|
+
label: `${k.get(e.rowId) ?? e.rowId} → ${A.get(e.columnId) ?? e.columnId}: ${O(e, m, b)}`
|
|
294
|
+
})), M = g(), N = H({
|
|
312
295
|
rows: r,
|
|
313
|
-
columns:
|
|
314
|
-
cells:
|
|
315
|
-
domain:
|
|
296
|
+
columns: d,
|
|
297
|
+
cells: f,
|
|
298
|
+
domain: m,
|
|
316
299
|
palette: h
|
|
317
300
|
});
|
|
318
|
-
if (
|
|
301
|
+
if (N !== null) return /* @__PURE__ */ _(i, {
|
|
319
302
|
title: e,
|
|
320
303
|
report: t,
|
|
321
304
|
description: n,
|
|
322
|
-
message:
|
|
305
|
+
message: N
|
|
323
306
|
});
|
|
324
|
-
let
|
|
325
|
-
for (let e of
|
|
326
|
-
let t =
|
|
327
|
-
t.set(e.columnId, e),
|
|
307
|
+
let F = /* @__PURE__ */ new Map();
|
|
308
|
+
for (let e of f) {
|
|
309
|
+
let t = F.get(e.rowId) ?? /* @__PURE__ */ new Map();
|
|
310
|
+
t.set(e.columnId, e), F.set(e.rowId, t);
|
|
328
311
|
}
|
|
329
|
-
|
|
312
|
+
let I = new Map(r.map((e, t) => [e.id, t])), R = new Map(d.map((e, t) => [e.id, t])), z = new Map(f.map((e) => {
|
|
313
|
+
let t = R.get(e.columnId) ?? 0, n = I.get(e.rowId) ?? 0;
|
|
314
|
+
return [e.id, {
|
|
315
|
+
left: t,
|
|
316
|
+
top: n,
|
|
317
|
+
right: t + 1,
|
|
318
|
+
bottom: n + 1
|
|
319
|
+
}];
|
|
320
|
+
})), B = l({
|
|
330
321
|
title: e,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
322
|
+
isSelectable: S !== void 0
|
|
323
|
+
});
|
|
324
|
+
return /* @__PURE__ */ _(u, {
|
|
325
|
+
items: j,
|
|
326
|
+
columns: T ? d.length : void 0,
|
|
327
|
+
place: T ? void 0 : (e) => z.get(e),
|
|
328
|
+
selected: S?.selectedId ?? null,
|
|
329
|
+
onSelect: S === void 0 ? void 0 : (e, t) => {
|
|
330
|
+
f.some((t) => t.id === e) && S.onSelect(e, t);
|
|
331
|
+
},
|
|
332
|
+
render: (i, l) => /* @__PURE__ */ _(s, {
|
|
333
|
+
figure: i,
|
|
334
|
+
title: e,
|
|
335
|
+
report: t,
|
|
336
|
+
description: n,
|
|
337
|
+
footer: /* @__PURE__ */ v("div", {
|
|
338
|
+
className: "xrvj5dj x1n8ia3y",
|
|
339
|
+
children: [
|
|
340
|
+
/* @__PURE__ */ _(E, {
|
|
341
|
+
label: y,
|
|
342
|
+
domain: m,
|
|
343
|
+
palette: h,
|
|
344
|
+
formatValue: b
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ v("ul", {
|
|
347
|
+
"aria-label": "Cell states",
|
|
348
|
+
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc",
|
|
349
|
+
children: [
|
|
350
|
+
f.some((e) => e.kind === "masked") && /* @__PURE__ */ _("li", { children: "× Masked" }),
|
|
351
|
+
f.some((e) => e.kind === "missing") && /* @__PURE__ */ _("li", { children: "— Missing" }),
|
|
352
|
+
f.length < r.length * d.length && /* @__PURE__ */ _("li", { children: "· Not supplied" }),
|
|
353
|
+
f.some((e) => e.kind === "value" && !x(e.value, m)) && /* @__PURE__ */ _("li", { children: "! Outside domain" }),
|
|
354
|
+
T && /* @__PURE__ */ _("li", { children: "Inspect a cell for its exact value" }),
|
|
355
|
+
!T && f.some((e) => e.kind === "value" && b(e.value).length > 6) && /* @__PURE__ */ _("li", { children: "• Inspect a cell for its exact value" })
|
|
356
|
+
]
|
|
357
|
+
}),
|
|
358
|
+
/* @__PURE__ */ _(o, {
|
|
359
|
+
id: M,
|
|
360
|
+
children: p(j, l.inspected)
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ _(a, {
|
|
363
|
+
label: `${e} cells`,
|
|
364
|
+
columns: [{
|
|
365
|
+
id: "cell",
|
|
366
|
+
label: "Cell"
|
|
367
|
+
}, {
|
|
368
|
+
id: "value",
|
|
369
|
+
label: y
|
|
370
|
+
}],
|
|
371
|
+
rows: r.flatMap((e) => d.map((t) => ({
|
|
372
|
+
id: JSON.stringify([e.id, t.id]),
|
|
373
|
+
values: [`${e.label} → ${t.label}`, O(F.get(e.id)?.get(t.id), m, b)]
|
|
374
|
+
})))
|
|
375
|
+
})
|
|
376
|
+
]
|
|
377
|
+
}),
|
|
378
|
+
children: r.length === 0 || d.length === 0 ? /* @__PURE__ */ _("p", {
|
|
379
|
+
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
380
|
+
children: C
|
|
381
|
+
}) : T ? /* @__PURE__ */ _(c, {
|
|
382
|
+
role: "group",
|
|
383
|
+
"aria-label": B,
|
|
384
|
+
"aria-describedby": M,
|
|
385
|
+
className: "xysyzu8 x14eurpq xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x10dazmo x-default-marker",
|
|
386
|
+
children: /* @__PURE__ */ _(P, {
|
|
387
|
+
rows: r,
|
|
388
|
+
columns: d,
|
|
389
|
+
cellAt: (e, t) => F.get(e)?.get(t),
|
|
390
|
+
coordinateId: L,
|
|
391
|
+
view: l,
|
|
392
|
+
domain: m,
|
|
339
393
|
palette: h,
|
|
340
|
-
formatValue:
|
|
341
|
-
|
|
342
|
-
/* @__PURE__ */ m("ul", {
|
|
343
|
-
"aria-label": "Cell states",
|
|
344
|
-
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc",
|
|
345
|
-
children: [
|
|
346
|
-
d.some((e) => e.kind === "masked") && /* @__PURE__ */ p("li", { children: "× Masked" }),
|
|
347
|
-
d.some((e) => e.kind === "missing") && /* @__PURE__ */ p("li", { children: "— Missing" }),
|
|
348
|
-
d.length < r.length * o.length && /* @__PURE__ */ p("li", { children: "· Not supplied" }),
|
|
349
|
-
d.some((e) => e.kind === "value" && !_(e.value, f)) && /* @__PURE__ */ p("li", { children: "! Outside domain" }),
|
|
350
|
-
C && /* @__PURE__ */ p("li", { children: "Inspect a cell for its exact value" }),
|
|
351
|
-
!C && d.some((e) => e.kind === "value" && v(e.value).length > 6) && /* @__PURE__ */ p("li", { children: "• Inspect a cell for its exact value" })
|
|
352
|
-
]
|
|
353
|
-
}),
|
|
354
|
-
/* @__PURE__ */ p(l, {
|
|
355
|
-
id: D.id,
|
|
356
|
-
children: D.label ?? "\xA0"
|
|
357
|
-
}),
|
|
358
|
-
/* @__PURE__ */ p(a, {
|
|
359
|
-
label: `${e} cells`,
|
|
360
|
-
columns: [{
|
|
361
|
-
id: "cell",
|
|
362
|
-
label: "Cell"
|
|
363
|
-
}, {
|
|
364
|
-
id: "value",
|
|
365
|
-
label: g
|
|
366
|
-
}],
|
|
367
|
-
rows: r.flatMap((e) => o.map((t) => ({
|
|
368
|
-
id: JSON.stringify([e.id, t.id]),
|
|
369
|
-
values: [`${e.label} → ${t.label}`, w(j.get(e.id)?.get(t.id), f, v)]
|
|
370
|
-
})))
|
|
394
|
+
formatValue: b,
|
|
395
|
+
selection: S
|
|
371
396
|
})
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
formatValue: v,
|
|
390
|
-
selection: y
|
|
391
|
-
})
|
|
392
|
-
}) : /* @__PURE__ */ p(s, {
|
|
393
|
-
...D.props,
|
|
394
|
-
className: "xysyzu8 x14eurpq xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal",
|
|
395
|
-
children: /* @__PURE__ */ m("table", {
|
|
396
|
-
className: "x1vathgz x1jkpq5q xezivpi x1hz01jw",
|
|
397
|
-
children: [/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", {
|
|
398
|
-
"aria-label": "Row",
|
|
399
|
-
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft"
|
|
400
|
-
}), o.map((e) => /* @__PURE__ */ p("th", {
|
|
401
|
-
scope: "col",
|
|
402
|
-
title: e.label,
|
|
403
|
-
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
404
|
-
children: /* @__PURE__ */ p("span", {
|
|
405
|
-
className: "x1lliihq x100vrsf x1ff4b4a xb3r6kr xlyipyv x2b8uid x1hmw7ec",
|
|
406
|
-
children: e.label
|
|
407
|
-
})
|
|
408
|
-
}, e.id))] }) }), /* @__PURE__ */ p("tbody", { children: r.map((e) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", {
|
|
409
|
-
scope: "row",
|
|
410
|
-
title: e.label,
|
|
411
|
-
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
412
|
-
children: /* @__PURE__ */ p("span", {
|
|
413
|
-
className: "x1lliihq x18qnofl xb3r6kr xlyipyv xx67isq",
|
|
414
|
-
children: e.label
|
|
415
|
-
})
|
|
416
|
-
}), o.map((t) => {
|
|
417
|
-
let n = j.get(e.id)?.get(t.id);
|
|
418
|
-
return /* @__PURE__ */ p("td", {
|
|
419
|
-
onPointerEnter: () => {
|
|
420
|
-
n !== void 0 && D.inspect(n.id);
|
|
421
|
-
},
|
|
422
|
-
className: "x1717udv x100vrsf x1ff4b4a x2b8uid",
|
|
423
|
-
children: /* @__PURE__ */ p(L, {
|
|
424
|
-
cell: n,
|
|
425
|
-
isInspected: D.label !== void 0 && D.activeId === n?.id,
|
|
426
|
-
label: `${e.label}, ${t.label}`,
|
|
427
|
-
domain: f,
|
|
428
|
-
palette: h,
|
|
429
|
-
formatValue: v,
|
|
430
|
-
selection: y
|
|
397
|
+
}) : /* @__PURE__ */ _(c, {
|
|
398
|
+
role: "group",
|
|
399
|
+
"aria-label": B,
|
|
400
|
+
"aria-describedby": M,
|
|
401
|
+
className: "xysyzu8 x14eurpq xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x-default-marker",
|
|
402
|
+
children: /* @__PURE__ */ v("table", {
|
|
403
|
+
className: "x1vathgz x1jkpq5q xezivpi x1hz01jw",
|
|
404
|
+
children: [/* @__PURE__ */ _("thead", { children: /* @__PURE__ */ v("tr", { children: [/* @__PURE__ */ _("th", {
|
|
405
|
+
"aria-label": "Row",
|
|
406
|
+
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft"
|
|
407
|
+
}), d.map((e) => /* @__PURE__ */ _("th", {
|
|
408
|
+
scope: "col",
|
|
409
|
+
title: e.label,
|
|
410
|
+
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
411
|
+
children: /* @__PURE__ */ _("span", {
|
|
412
|
+
className: "x1lliihq x100vrsf x1ff4b4a xb3r6kr xlyipyv x2b8uid x1hmw7ec",
|
|
413
|
+
children: e.label
|
|
431
414
|
})
|
|
432
|
-
},
|
|
433
|
-
|
|
415
|
+
}, e.id))] }) }), /* @__PURE__ */ _("tbody", { children: r.map((e) => /* @__PURE__ */ v("tr", { children: [/* @__PURE__ */ _("th", {
|
|
416
|
+
scope: "row",
|
|
417
|
+
title: e.label,
|
|
418
|
+
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
419
|
+
children: /* @__PURE__ */ _("span", {
|
|
420
|
+
className: "x1lliihq x18qnofl xb3r6kr xlyipyv xx67isq",
|
|
421
|
+
children: e.label
|
|
422
|
+
})
|
|
423
|
+
}), d.map((t) => {
|
|
424
|
+
let n = F.get(e.id)?.get(t.id);
|
|
425
|
+
return /* @__PURE__ */ _("td", {
|
|
426
|
+
className: "x1717udv x100vrsf x1ff4b4a x2b8uid",
|
|
427
|
+
children: /* @__PURE__ */ _(V, {
|
|
428
|
+
cell: n,
|
|
429
|
+
isInspected: l.inspected === n?.id,
|
|
430
|
+
isCursor: l.cursor === n?.id,
|
|
431
|
+
label: `${e.label}, ${t.label}`,
|
|
432
|
+
domain: m,
|
|
433
|
+
palette: h,
|
|
434
|
+
formatValue: b,
|
|
435
|
+
selection: S
|
|
436
|
+
})
|
|
437
|
+
}, t.id);
|
|
438
|
+
})] }, e.id)) })]
|
|
439
|
+
})
|
|
434
440
|
})
|
|
435
441
|
})
|
|
436
442
|
});
|
|
437
443
|
}
|
|
438
|
-
function
|
|
439
|
-
if (e === void 0) return /* @__PURE__ */
|
|
444
|
+
function V({ cell: e, isInspected: t, isCursor: n, label: r, domain: i, palette: a, formatValue: o, selection: s }) {
|
|
445
|
+
if (e === void 0) return /* @__PURE__ */ _("span", {
|
|
440
446
|
role: "img",
|
|
441
|
-
"aria-label": `${
|
|
442
|
-
title: `${
|
|
447
|
+
"aria-label": `${r}: not supplied`,
|
|
448
|
+
title: `${r}: not supplied`,
|
|
443
449
|
className: "x78zum5 x6s0dn4 xl56j7k x100vrsf x1ff4b4a x1vqgdyp x992rv9 x9f619 xmkeg23 x1ey3b81 x1717udv x1hz01jw xy8obcc xj57cvi xas2l8k xss6m8b x153jb6y x1r7kqkb xbsl7fq",
|
|
444
450
|
children: "·"
|
|
445
451
|
});
|
|
446
|
-
let
|
|
447
|
-
domain:
|
|
448
|
-
palette:
|
|
449
|
-
}) : void 0,
|
|
452
|
+
let c = e.kind === "value" && !x(e.value, i), l = O(e, i, o), u = `${r}: ${l}`, d = e.kind === "value" && !c ? S(e.value, {
|
|
453
|
+
domain: i,
|
|
454
|
+
palette: a
|
|
455
|
+
}) : void 0, p = t || s?.selectedId === e.id, g = h.props(I.value, R[e.kind], d !== void 0 && I.measured(d), c && I.missing, s !== void 0 && I.interactive, p && I.selected, !p && n && m.cursor), v = D(e, l, c), y = e.kind === "value" ? /* @__PURE__ */ _("span", {
|
|
450
456
|
className: "xpvm0e4 x1r97e56",
|
|
451
|
-
children:
|
|
452
|
-
}) :
|
|
453
|
-
return
|
|
454
|
-
|
|
455
|
-
"
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
"aria-pressed": o.selectedId === e.id,
|
|
465
|
-
onClick: () => o.onSelect(e.id),
|
|
466
|
-
...m,
|
|
467
|
-
children: g
|
|
457
|
+
children: v
|
|
458
|
+
}) : v;
|
|
459
|
+
return /* @__PURE__ */ _(f, {
|
|
460
|
+
value: e.id,
|
|
461
|
+
render: s === void 0 ? /* @__PURE__ */ _("span", { role: "img" }) : /* @__PURE__ */ _("button", {
|
|
462
|
+
type: "button",
|
|
463
|
+
tabIndex: -1,
|
|
464
|
+
"aria-pressed": s.selectedId === e.id
|
|
465
|
+
}),
|
|
466
|
+
"aria-label": u,
|
|
467
|
+
title: u,
|
|
468
|
+
...g,
|
|
469
|
+
children: y
|
|
468
470
|
});
|
|
469
471
|
}
|
|
470
|
-
function
|
|
471
|
-
let o =
|
|
472
|
+
function H({ rows: e, columns: t, cells: r, domain: i, palette: a }) {
|
|
473
|
+
let o = b({
|
|
472
474
|
domain: i,
|
|
473
475
|
palette: a
|
|
474
476
|
});
|
|
475
477
|
if (o !== null) return o;
|
|
476
|
-
if (e.length * t.length > 4096 || r.length > 4096) return `This matrix exceeds the ${
|
|
478
|
+
if (e.length * t.length > 4096 || r.length > 4096) return `This matrix exceeds the ${z}-cell render limit. Supply a smaller, labelled window.`;
|
|
477
479
|
let s = new Set(e.map((e) => e.id)), c = new Set(t.map((e) => e.id));
|
|
478
480
|
if (!n(e) || !n(t) || !n(r)) return "Matrix rows, columns, and cells must have unique identifiers.";
|
|
479
481
|
let l = /* @__PURE__ */ new Map();
|
|
@@ -487,7 +489,7 @@ function R({ rows: e, columns: t, cells: r, domain: i, palette: a }) {
|
|
|
487
489
|
return null;
|
|
488
490
|
}
|
|
489
491
|
// packages/charts/src/matrix/token-heatmap.tsx
|
|
490
|
-
var
|
|
492
|
+
var U = {
|
|
491
493
|
token: {
|
|
492
494
|
k1xSpc: "xt0psk2",
|
|
493
495
|
kmVPX3: "x1717udv",
|
|
@@ -532,106 +534,111 @@ var z = {
|
|
|
532
534
|
kInvED: "x1y3gkto",
|
|
533
535
|
$$css: !0
|
|
534
536
|
}
|
|
535
|
-
},
|
|
536
|
-
function
|
|
537
|
-
let
|
|
537
|
+
}, W = 2048;
|
|
538
|
+
function G({ title: e, report: t, description: n, tokens: r, domain: c, palette: y, valueLabel: b, formatValue: C, selection: w, emptyLabel: T }) {
|
|
539
|
+
let D = r.map((e) => ({
|
|
538
540
|
id: e.id,
|
|
539
|
-
label: `Token ${e.index}, ${JSON.stringify(e.text)}, ${
|
|
540
|
-
})),
|
|
541
|
-
title: e,
|
|
542
|
-
items: C,
|
|
543
|
-
selection: b
|
|
544
|
-
}), T = U({
|
|
541
|
+
label: `Token ${e.index}, ${JSON.stringify(e.text)}, ${b}: ${K(e, c, C)}`
|
|
542
|
+
})), O = g(), k = q({
|
|
545
543
|
tokens: r,
|
|
546
|
-
domain:
|
|
547
|
-
palette:
|
|
544
|
+
domain: c,
|
|
545
|
+
palette: y
|
|
548
546
|
});
|
|
549
|
-
return
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
547
|
+
return k === null ? /* @__PURE__ */ _(u, {
|
|
548
|
+
items: D,
|
|
549
|
+
arrows: "both",
|
|
550
|
+
selected: w?.selectedId ?? null,
|
|
551
|
+
onSelect: w?.onSelect,
|
|
552
|
+
render: (i, { inspected: u, cursor: g }) => /* @__PURE__ */ v(s, {
|
|
553
|
+
figure: i,
|
|
554
|
+
title: e,
|
|
555
|
+
report: t,
|
|
556
|
+
description: n,
|
|
557
|
+
footer: /* @__PURE__ */ v("div", {
|
|
558
|
+
className: "xrvj5dj x1n8ia3y",
|
|
559
|
+
children: [/* @__PURE__ */ _(E, {
|
|
560
|
+
label: b,
|
|
561
|
+
domain: c,
|
|
562
|
+
palette: y,
|
|
563
|
+
formatValue: C
|
|
564
|
+
}), /* @__PURE__ */ _(o, {
|
|
565
|
+
id: O,
|
|
566
|
+
children: p(D, u)
|
|
567
|
+
})]
|
|
568
|
+
}),
|
|
569
|
+
children: [r.length === 0 ? /* @__PURE__ */ _("p", {
|
|
570
|
+
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
571
|
+
children: T
|
|
572
|
+
}) : /* @__PURE__ */ _(d, {
|
|
573
|
+
role: "group",
|
|
574
|
+
"aria-label": l({
|
|
575
|
+
title: e,
|
|
576
|
+
isSelectable: w !== void 0
|
|
577
|
+
}),
|
|
578
|
+
"aria-describedby": O,
|
|
579
|
+
className: "x1ghz6dp xbixft xiard35 xtqrqnz x1778rvt x126k92a xj0a0fe x-default-marker",
|
|
580
|
+
children: r.map((e, t) => {
|
|
581
|
+
let n = w?.selectedId === e.id || u === e.id, r = e.score !== null && !x(e.score, c), i = D[t]?.label;
|
|
582
|
+
return /* @__PURE__ */ _(f, {
|
|
583
|
+
value: e.id,
|
|
584
|
+
render: w === void 0 ? /* @__PURE__ */ _("span", {}) : /* @__PURE__ */ _("button", {
|
|
585
|
+
type: "button",
|
|
586
|
+
tabIndex: -1,
|
|
587
|
+
"aria-label": i,
|
|
588
|
+
"aria-pressed": w.selectedId === e.id
|
|
589
|
+
}),
|
|
590
|
+
title: w === void 0 ? i : void 0,
|
|
591
|
+
...h.props(U.token, e.score === null || r ? U.missing : U.color(S(e.score, {
|
|
592
|
+
domain: c,
|
|
593
|
+
palette: y
|
|
594
|
+
})), w !== void 0 && U.interactive, n && U.selected, !n && g === e.id && m.cursor),
|
|
595
|
+
children: e.text
|
|
596
|
+
}, e.id);
|
|
597
|
+
})
|
|
598
|
+
}), /* @__PURE__ */ _(a, {
|
|
599
|
+
label: `${e} token values`,
|
|
600
|
+
columns: [
|
|
601
|
+
{
|
|
602
|
+
id: "index",
|
|
603
|
+
label: "Index"
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
id: "text",
|
|
607
|
+
label: "Exact text"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
id: "value",
|
|
611
|
+
label: b
|
|
612
|
+
}
|
|
613
|
+
],
|
|
614
|
+
rows: r.map((e) => ({
|
|
615
|
+
id: e.id,
|
|
616
|
+
values: [
|
|
617
|
+
String(e.index),
|
|
618
|
+
JSON.stringify(e.text),
|
|
619
|
+
K(e, c, C)
|
|
620
|
+
]
|
|
621
|
+
}))
|
|
563
622
|
})]
|
|
564
|
-
})
|
|
565
|
-
|
|
566
|
-
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
567
|
-
children: x
|
|
568
|
-
}) : /* @__PURE__ */ p(o, {
|
|
569
|
-
...w.props,
|
|
570
|
-
className: "x1ghz6dp xbixft xiard35 xtqrqnz x1778rvt x126k92a xj0a0fe",
|
|
571
|
-
children: r.map((e) => {
|
|
572
|
-
let t = w.label !== void 0 && w.activeId === e.id, n = e.score !== null && !_(e.score, s), r = `Token ${e.index}, ${JSON.stringify(e.text)}, ${g}: ${H(e, s, y)}`, i = d.props(z.token, e.score === null || n ? z.missing : z.color(v(e.score, {
|
|
573
|
-
domain: s,
|
|
574
|
-
palette: h
|
|
575
|
-
})), b !== void 0 && z.interactive, (b?.selectedId === e.id || t) && z.selected);
|
|
576
|
-
return b === void 0 ? /* @__PURE__ */ p("span", {
|
|
577
|
-
title: r,
|
|
578
|
-
onPointerEnter: () => w.inspect(e.id),
|
|
579
|
-
...i,
|
|
580
|
-
children: e.text
|
|
581
|
-
}, e.id) : /* @__PURE__ */ p(f, {
|
|
582
|
-
type: "button",
|
|
583
|
-
tabIndex: -1,
|
|
584
|
-
onPointerEnter: () => w.inspect(e.id),
|
|
585
|
-
"aria-label": r,
|
|
586
|
-
"aria-pressed": b.selectedId === e.id,
|
|
587
|
-
onClick: () => b.onSelect(e.id),
|
|
588
|
-
...i,
|
|
589
|
-
children: e.text
|
|
590
|
-
}, e.id);
|
|
591
|
-
})
|
|
592
|
-
}), /* @__PURE__ */ p(a, {
|
|
593
|
-
label: `${e} token values`,
|
|
594
|
-
columns: [
|
|
595
|
-
{
|
|
596
|
-
id: "index",
|
|
597
|
-
label: "Index"
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
id: "text",
|
|
601
|
-
label: "Exact text"
|
|
602
|
-
},
|
|
603
|
-
{
|
|
604
|
-
id: "value",
|
|
605
|
-
label: g
|
|
606
|
-
}
|
|
607
|
-
],
|
|
608
|
-
rows: r.map((e) => ({
|
|
609
|
-
id: e.id,
|
|
610
|
-
values: [
|
|
611
|
-
String(e.index),
|
|
612
|
-
JSON.stringify(e.text),
|
|
613
|
-
H(e, s, y)
|
|
614
|
-
]
|
|
615
|
-
}))
|
|
616
|
-
})]
|
|
617
|
-
}) : /* @__PURE__ */ p(i, {
|
|
623
|
+
})
|
|
624
|
+
}) : /* @__PURE__ */ _(i, {
|
|
618
625
|
title: e,
|
|
619
626
|
report: t,
|
|
620
627
|
description: n,
|
|
621
|
-
message:
|
|
628
|
+
message: k
|
|
622
629
|
});
|
|
623
630
|
}
|
|
624
|
-
function
|
|
625
|
-
return e.score === null ? "Unavailable" : `${n(e.score)}${
|
|
631
|
+
function K(e, t, n) {
|
|
632
|
+
return e.score === null ? "Unavailable" : `${n(e.score)}${x(e.score, t) ? "" : " (outside domain)"}`;
|
|
626
633
|
}
|
|
627
|
-
function
|
|
628
|
-
let i =
|
|
634
|
+
function q({ tokens: e, domain: t, palette: r }) {
|
|
635
|
+
let i = b({
|
|
629
636
|
domain: t,
|
|
630
637
|
palette: r
|
|
631
638
|
});
|
|
632
|
-
return i === null ? e.length > 2048 ? `This token view exceeds the ${
|
|
639
|
+
return i === null ? e.length > 2048 ? `This token view exceeds the ${W}-token render limit. Supply a smaller, labelled window.` : !n(e) || new Set(e.map((e) => e.index)).size !== e.length ? "Tokens must have unique identifiers and supplied indices." : e.some((e) => {
|
|
633
640
|
let t = !Number.isSafeInteger(e.index) || e.index < 0, n = e.score !== null && !Number.isFinite(e.score);
|
|
634
641
|
return t || n;
|
|
635
642
|
}) ? "Token indices must be nonnegative integers and measured scores must be finite. Use null for unavailable scores." : null : i;
|
|
636
643
|
}
|
|
637
|
-
export {
|
|
644
|
+
export { E as ColorLegend, W as MAX_HEATMAP_TOKENS, z as MAX_MATRIX_CELLS, B as Matrix, G as TokenHeatmap };
|