@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/matrix.js
CHANGED
|
@@ -1,73 +1,79 @@
|
|
|
1
1
|
import { colors as e } from "../tokens.js";
|
|
2
|
-
import { n as t, r as n, t as r } from "../chart-input-
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
5
|
-
import { jsx as
|
|
2
|
+
import { n as t, r as n, t as r } from "../chart-input-CdLkFomi.js";
|
|
3
|
+
import { a as i, n as a, r as o, s, t as c } from "../chart-frame-et6f6Vhg.js";
|
|
4
|
+
import * as l from "@stylexjs/stylex";
|
|
5
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
6
|
// packages/charts/src/matrix/heatmap-scale.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
7
|
+
var f = 100;
|
|
8
|
+
function p({ domain: e, palette: t }) {
|
|
9
9
|
return n(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.";
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function m(e, t) {
|
|
12
12
|
return e >= t[0] && e <= t[1];
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function h(t, { domain: n, palette: r }) {
|
|
15
15
|
if (r === "diverging") {
|
|
16
|
-
let r = t < 0 ? n[0] : n[1], i = Math.abs(t) / Math.abs(r) *
|
|
17
|
-
return `color-mix(in srgb, ${t < 0 ?
|
|
16
|
+
let r = t < 0 ? n[0] : n[1], i = Math.abs(t) / Math.abs(r) * f;
|
|
17
|
+
return `color-mix(in srgb, ${t < 0 ? s.negative : s.positive} ${i}%, ${e.surface})`;
|
|
18
18
|
}
|
|
19
|
-
let i = (t - n[0]) / (n[1] - n[0]) *
|
|
20
|
-
return `color-mix(in srgb, ${
|
|
19
|
+
let i = (t - n[0]) / (n[1] - n[0]) * f;
|
|
20
|
+
return `color-mix(in srgb, ${s.series1} ${i}%, ${e.surface})`;
|
|
21
21
|
}
|
|
22
22
|
// packages/charts/src/matrix/color-legend.tsx
|
|
23
|
-
var
|
|
23
|
+
var g = {
|
|
24
24
|
kUk6DE: "x98rzlu",
|
|
25
25
|
$$css: !0
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, _ = { sample: (e) => [
|
|
27
|
+
g,
|
|
28
28
|
{
|
|
29
29
|
kWkggS: e == null ? e : "xl8spv7",
|
|
30
30
|
$$css: !0
|
|
31
31
|
},
|
|
32
32
|
{ "--x-backgroundColor": e ?? void 0 }
|
|
33
|
-
] },
|
|
34
|
-
function
|
|
35
|
-
let i =
|
|
33
|
+
] }, v = 20;
|
|
34
|
+
function y({ label: e, domain: t, palette: n, formatValue: r }) {
|
|
35
|
+
let i = p({
|
|
36
36
|
domain: t,
|
|
37
37
|
palette: n
|
|
38
38
|
});
|
|
39
|
-
if (i !== null) return /* @__PURE__ */
|
|
39
|
+
if (i !== null) return /* @__PURE__ */ u("p", {
|
|
40
40
|
role: "status",
|
|
41
|
-
className: "xrvj5dj xunmzkg x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k",
|
|
41
|
+
className: "xrvj5dj xunmzkg x1ghz6dp xeuugli x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k xj0a0fe",
|
|
42
42
|
children: i
|
|
43
43
|
});
|
|
44
|
-
let a = Array.from({ length: 21 }, (e, n) => t[0] + (t[1] - t[0]) * n /
|
|
45
|
-
return /* @__PURE__ */
|
|
44
|
+
let a = Array.from({ length: 21 }, (e, n) => t[0] + (t[1] - t[0]) * n / v);
|
|
45
|
+
return /* @__PURE__ */ d("div", {
|
|
46
46
|
"aria-label": `${e}: ${r(t[0])} to ${r(t[1])}`,
|
|
47
|
-
className: "xrvj5dj xunmzkg x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k",
|
|
47
|
+
className: "xrvj5dj xunmzkg x1ghz6dp xeuugli x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k xj0a0fe",
|
|
48
48
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ d("span", { children: [e, n === "diverging" && ` · Neutral: ${r(0)}`] }),
|
|
50
|
+
/* @__PURE__ */ u("div", {
|
|
51
51
|
"aria-hidden": !0,
|
|
52
52
|
className: "x78zum5 xdk7pt xmkeg23 x1y0btm7 x1ey3b81",
|
|
53
|
-
children: a.map((e) => /* @__PURE__ */
|
|
53
|
+
children: a.map((e) => /* @__PURE__ */ u("span", { ...l.props(_.sample(h(e, {
|
|
54
54
|
domain: t,
|
|
55
55
|
palette: n
|
|
56
56
|
}))) }, e))
|
|
57
57
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
58
|
+
/* @__PURE__ */ d("div", {
|
|
59
59
|
"aria-hidden": !0,
|
|
60
60
|
className: "x78zum5 x1qughib x1n8ia3y xss6m8b",
|
|
61
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ u("span", {
|
|
62
|
+
className: "xeuugli",
|
|
63
|
+
children: r(t[0])
|
|
64
|
+
}), /* @__PURE__ */ u("span", {
|
|
65
|
+
className: "xeuugli xp4054r",
|
|
66
|
+
children: r(t[1])
|
|
67
|
+
})]
|
|
62
68
|
})
|
|
63
69
|
]
|
|
64
70
|
});
|
|
65
71
|
}
|
|
66
72
|
// packages/charts/src/matrix/matrix.tsx
|
|
67
|
-
var
|
|
73
|
+
var b = {
|
|
68
74
|
kKwaWg: "x1e87kdn",
|
|
69
75
|
$$css: !0
|
|
70
|
-
},
|
|
76
|
+
}, x = {
|
|
71
77
|
value: {
|
|
72
78
|
k1xSpc: "x78zum5",
|
|
73
79
|
kGNEyG: "x6s0dn4",
|
|
@@ -83,19 +89,20 @@ var y = {
|
|
|
83
89
|
kmVPX3: "x1717udv",
|
|
84
90
|
kMv6JI: "x1hz01jw",
|
|
85
91
|
kGuDYH: "xy8obcc",
|
|
92
|
+
k63SB2: "xj57cvi",
|
|
86
93
|
kLWn49: "xas2l8k",
|
|
87
94
|
kcqcaj: "xss6m8b",
|
|
88
95
|
$$css: !0
|
|
89
96
|
},
|
|
90
97
|
interactive: {
|
|
91
98
|
kkrTdU: "x1ypdohk",
|
|
99
|
+
k3XXqK: "x1t137rt",
|
|
100
|
+
kSVDLA: "xjf78fh",
|
|
92
101
|
kPJHz1: "x13qnu6",
|
|
93
102
|
kZs9gx: "x19rmrnh",
|
|
94
103
|
k7shQP: "x9v5kkp",
|
|
95
104
|
kiEn40: "x1bqaal",
|
|
96
|
-
|
|
97
|
-
kFU1ZQ: "xzbfamy",
|
|
98
|
-
kUjPgX: "xsynfrt",
|
|
105
|
+
kaVNsj: "x1fs8giu",
|
|
99
106
|
$$css: !0
|
|
100
107
|
},
|
|
101
108
|
selected: {
|
|
@@ -105,7 +112,7 @@ var y = {
|
|
|
105
112
|
kInvED: "x2ssjo2",
|
|
106
113
|
$$css: !0
|
|
107
114
|
},
|
|
108
|
-
measured: (e) => [
|
|
115
|
+
measured: (e) => [b, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${e})` }],
|
|
109
116
|
missing: {
|
|
110
117
|
kMwMTN: "x153jb6y",
|
|
111
118
|
kWkggS: "x1r7kqkb",
|
|
@@ -117,112 +124,108 @@ var y = {
|
|
|
117
124
|
kWkggS: "x1r7kqkb",
|
|
118
125
|
$$css: !0
|
|
119
126
|
}
|
|
120
|
-
},
|
|
127
|
+
}, S = {
|
|
121
128
|
value: void 0,
|
|
122
|
-
masked:
|
|
123
|
-
missing:
|
|
124
|
-
},
|
|
125
|
-
function
|
|
126
|
-
let
|
|
129
|
+
masked: x.masked,
|
|
130
|
+
missing: x.missing
|
|
131
|
+
}, C = 4096, w = 6;
|
|
132
|
+
function T({ title: e, description: t, rows: n, columns: s, cells: l, domain: f, palette: p, valueLabel: h, formatValue: g, selection: _, emptyLabel: v }) {
|
|
133
|
+
let b = k({
|
|
127
134
|
rows: n,
|
|
128
|
-
columns:
|
|
129
|
-
cells:
|
|
130
|
-
domain:
|
|
131
|
-
palette:
|
|
135
|
+
columns: s,
|
|
136
|
+
cells: l,
|
|
137
|
+
domain: f,
|
|
138
|
+
palette: p
|
|
132
139
|
});
|
|
133
|
-
if (
|
|
140
|
+
if (b !== null) return /* @__PURE__ */ u(r, {
|
|
134
141
|
title: e,
|
|
135
142
|
description: t,
|
|
136
|
-
message:
|
|
143
|
+
message: b
|
|
137
144
|
});
|
|
138
|
-
let
|
|
139
|
-
for (let e of
|
|
140
|
-
let t =
|
|
141
|
-
t.set(e.columnId, e),
|
|
145
|
+
let x = /* @__PURE__ */ new Map();
|
|
146
|
+
for (let e of l) {
|
|
147
|
+
let t = x.get(e.rowId) ?? /* @__PURE__ */ new Map();
|
|
148
|
+
t.set(e.columnId, e), x.set(e.rowId, t);
|
|
142
149
|
}
|
|
143
|
-
let
|
|
144
|
-
return /* @__PURE__ */
|
|
150
|
+
let S = l.find((e) => e.id === _?.selectedId), C = n.find((e) => e.id === S?.rowId), T = s.find((e) => e.id === S?.columnId), D = S === void 0 ? void 0 : `${C?.label ?? S.rowId} → ${T?.label ?? S.columnId}: ${O(S, f, g)}`;
|
|
151
|
+
return /* @__PURE__ */ u(o, {
|
|
145
152
|
title: e,
|
|
146
153
|
description: t,
|
|
147
|
-
footer: /* @__PURE__ */
|
|
154
|
+
footer: /* @__PURE__ */ d("div", {
|
|
148
155
|
className: "xrvj5dj x1n8ia3y",
|
|
149
156
|
children: [
|
|
150
|
-
/* @__PURE__ */
|
|
151
|
-
label:
|
|
152
|
-
domain:
|
|
153
|
-
palette:
|
|
154
|
-
formatValue:
|
|
157
|
+
/* @__PURE__ */ u(y, {
|
|
158
|
+
label: h,
|
|
159
|
+
domain: f,
|
|
160
|
+
palette: p,
|
|
161
|
+
formatValue: g
|
|
155
162
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ d("ul", {
|
|
157
164
|
"aria-label": "Cell states",
|
|
158
165
|
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc",
|
|
159
166
|
children: [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
l.some((e) => e.kind === "masked") && /* @__PURE__ */ u("li", { children: "× Masked" }),
|
|
168
|
+
l.some((e) => e.kind === "missing") && /* @__PURE__ */ u("li", { children: "— Missing" }),
|
|
169
|
+
l.length < n.length * s.length && /* @__PURE__ */ u("li", { children: "· Not supplied" }),
|
|
170
|
+
l.some((e) => e.kind === "value" && !m(e.value, f)) && /* @__PURE__ */ u("li", { children: "! Outside domain" }),
|
|
171
|
+
l.some((e) => e.kind === "value" && g(e.value).length > w) && /* @__PURE__ */ u("li", { children: "• See exact values in View data" })
|
|
165
172
|
]
|
|
166
173
|
}),
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
className: "x1ghz6dp xbixft x16exltd xj0a0fe",
|
|
170
|
-
children: E ?? "Select a cell to inspect its value."
|
|
171
|
-
}),
|
|
172
|
-
n.length > 0 && a.length > 0 && /* @__PURE__ */ l(s, { children: /* @__PURE__ */ l("ul", {
|
|
174
|
+
_ !== void 0 && /* @__PURE__ */ u(i, { children: D ?? "Select a cell to inspect its value." }),
|
|
175
|
+
n.length > 0 && s.length > 0 && /* @__PURE__ */ u(c, { children: /* @__PURE__ */ u("ul", {
|
|
173
176
|
className: "xe8uvvx x1ghz6dp x1717udv",
|
|
174
|
-
children: n.flatMap((e) =>
|
|
175
|
-
let n =
|
|
176
|
-
return /* @__PURE__ */
|
|
177
|
-
label: `${r}: ${
|
|
178
|
-
selected: n !== void 0 &&
|
|
179
|
-
onSelect: n === void 0 ||
|
|
180
|
-
children: [/* @__PURE__ */
|
|
177
|
+
children: n.flatMap((e) => s.map((t) => {
|
|
178
|
+
let n = x.get(e.id)?.get(t.id), r = `${e.label} → ${t.label}`, i = O(n, f, g);
|
|
179
|
+
return /* @__PURE__ */ u("li", { children: /* @__PURE__ */ d(a, {
|
|
180
|
+
label: `${r}: ${i}`,
|
|
181
|
+
selected: n !== void 0 && _?.selectedId === n.id,
|
|
182
|
+
onSelect: n === void 0 || _ === void 0 ? void 0 : () => _.onSelect(n.id),
|
|
183
|
+
children: [/* @__PURE__ */ u("span", { children: r }), /* @__PURE__ */ u("span", { children: i })]
|
|
181
184
|
}) }, JSON.stringify([e.id, t.id]));
|
|
182
185
|
}))
|
|
183
186
|
}) })
|
|
184
187
|
]
|
|
185
188
|
}),
|
|
186
|
-
children: n.length === 0 ||
|
|
189
|
+
children: n.length === 0 || s.length === 0 ? /* @__PURE__ */ u("p", {
|
|
187
190
|
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
188
|
-
children:
|
|
189
|
-
}) : /* @__PURE__ */
|
|
191
|
+
children: v
|
|
192
|
+
}) : /* @__PURE__ */ u("div", {
|
|
190
193
|
role: "region",
|
|
191
194
|
"aria-label": `${e} cells`,
|
|
192
195
|
tabIndex: 0,
|
|
193
|
-
className: "xysyzu8 x14eurpq x13qnu6 x19rmrnh x9v5kkp x1bqaal",
|
|
194
|
-
children: /* @__PURE__ */
|
|
196
|
+
className: "xysyzu8 x14eurpq xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal",
|
|
197
|
+
children: /* @__PURE__ */ d("table", {
|
|
195
198
|
className: "x1vathgz x1jkpq5q xezivpi x1hz01jw",
|
|
196
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ d("tr", { children: [/* @__PURE__ */ u("th", {
|
|
197
200
|
"aria-label": "Row",
|
|
198
|
-
className: "x1717udv xy8obcc xas2l8k
|
|
199
|
-
}),
|
|
201
|
+
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft"
|
|
202
|
+
}), s.map((e) => /* @__PURE__ */ u("th", {
|
|
200
203
|
scope: "col",
|
|
201
204
|
title: e.label,
|
|
202
|
-
className: "x1717udv xy8obcc xas2l8k
|
|
203
|
-
children: /* @__PURE__ */
|
|
205
|
+
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
206
|
+
children: /* @__PURE__ */ u("span", {
|
|
204
207
|
className: "x1lliihq x100vrsf xi5vo7p xb3r6kr xlyipyv x2b8uid x1hmw7ec",
|
|
205
208
|
children: e.label
|
|
206
209
|
})
|
|
207
|
-
}, e.id))] }) }), /* @__PURE__ */
|
|
210
|
+
}, e.id))] }) }), /* @__PURE__ */ u("tbody", { children: n.map((e) => /* @__PURE__ */ d("tr", { children: [/* @__PURE__ */ u("th", {
|
|
208
211
|
scope: "row",
|
|
209
212
|
title: e.label,
|
|
210
|
-
className: "x1717udv xy8obcc xas2l8k
|
|
211
|
-
children: /* @__PURE__ */
|
|
213
|
+
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
214
|
+
children: /* @__PURE__ */ u("span", {
|
|
212
215
|
className: "x1lliihq x18qnofl xb3r6kr xlyipyv xx67isq",
|
|
213
216
|
children: e.label
|
|
214
217
|
})
|
|
215
|
-
}),
|
|
216
|
-
let n =
|
|
217
|
-
return /* @__PURE__ */
|
|
218
|
+
}), s.map((t) => {
|
|
219
|
+
let n = x.get(e.id)?.get(t.id);
|
|
220
|
+
return /* @__PURE__ */ u("td", {
|
|
218
221
|
className: "x1717udv x100vrsf xi5vo7p x2b8uid",
|
|
219
|
-
children: /* @__PURE__ */
|
|
222
|
+
children: /* @__PURE__ */ u(E, {
|
|
220
223
|
cell: n,
|
|
221
224
|
label: `${e.label}, ${t.label}`,
|
|
222
|
-
domain:
|
|
223
|
-
palette:
|
|
224
|
-
formatValue:
|
|
225
|
-
selection:
|
|
225
|
+
domain: f,
|
|
226
|
+
palette: p,
|
|
227
|
+
formatValue: g,
|
|
228
|
+
selection: _
|
|
226
229
|
})
|
|
227
230
|
}, t.id);
|
|
228
231
|
})] }, e.id)) })]
|
|
@@ -230,59 +233,59 @@ function w({ title: e, description: t, rows: n, columns: a, cells: c, domain: d,
|
|
|
230
233
|
})
|
|
231
234
|
});
|
|
232
235
|
}
|
|
233
|
-
function
|
|
234
|
-
if (e === void 0) return /* @__PURE__ */
|
|
236
|
+
function E({ cell: e, label: t, domain: n, palette: r, formatValue: i, selection: a }) {
|
|
237
|
+
if (e === void 0) return /* @__PURE__ */ u("span", {
|
|
235
238
|
role: "img",
|
|
236
239
|
"aria-label": `${t}: not supplied`,
|
|
237
240
|
title: `${t}: not supplied`,
|
|
238
|
-
className: "x78zum5 x6s0dn4 xl56j7k x100vrsf xi5vo7p x1vqgdyp x17kqdoe x9f619 xmkeg23 x1ey3b81 x1717udv x1hz01jw xy8obcc xas2l8k xss6m8b x153jb6y x1r7kqkb xbsl7fq",
|
|
241
|
+
className: "x78zum5 x6s0dn4 xl56j7k x100vrsf xi5vo7p x1vqgdyp x17kqdoe x9f619 xmkeg23 x1ey3b81 x1717udv x1hz01jw xy8obcc xj57cvi xas2l8k xss6m8b x153jb6y x1r7kqkb xbsl7fq",
|
|
239
242
|
children: "·"
|
|
240
243
|
});
|
|
241
|
-
let o = e.kind === "value" && !
|
|
244
|
+
let o = e.kind === "value" && !m(e.value, n), s = O(e, n, i), c = `${t}: ${s}`, d = e.kind === "value" && !o ? h(e.value, {
|
|
242
245
|
domain: n,
|
|
243
246
|
palette: r
|
|
244
|
-
}) : void 0, f =
|
|
247
|
+
}) : void 0, f = l.props(x.value, S[e.kind], d !== void 0 && x.measured(d), o && x.missing, a !== void 0 && x.interactive, a?.selectedId === e.id && x.selected), p = D(e, s, o), g = e.kind === "value" ? /* @__PURE__ */ u("span", {
|
|
245
248
|
className: "xpvm0e4 x1r97e56",
|
|
246
|
-
children:
|
|
247
|
-
}) :
|
|
248
|
-
return a === void 0 ? /* @__PURE__ */
|
|
249
|
+
children: p
|
|
250
|
+
}) : p;
|
|
251
|
+
return a === void 0 ? /* @__PURE__ */ u("span", {
|
|
249
252
|
role: "img",
|
|
250
|
-
"aria-label":
|
|
251
|
-
title:
|
|
253
|
+
"aria-label": c,
|
|
254
|
+
title: c,
|
|
252
255
|
...f,
|
|
253
256
|
children: g
|
|
254
|
-
}) : /* @__PURE__ */
|
|
257
|
+
}) : /* @__PURE__ */ u("button", {
|
|
255
258
|
type: "button",
|
|
256
|
-
"aria-label":
|
|
257
|
-
title:
|
|
259
|
+
"aria-label": c,
|
|
260
|
+
title: c,
|
|
258
261
|
"aria-pressed": a.selectedId === e.id,
|
|
259
262
|
onClick: () => a.onSelect(e.id),
|
|
260
263
|
...f,
|
|
261
264
|
children: g
|
|
262
265
|
});
|
|
263
266
|
}
|
|
264
|
-
function
|
|
267
|
+
function D(e, t, n) {
|
|
265
268
|
switch (e.kind) {
|
|
266
269
|
case "masked": return "×";
|
|
267
270
|
case "missing": return "—";
|
|
268
|
-
case "value": return n ? "!" : t.length <=
|
|
271
|
+
case "value": return n ? "!" : t.length <= w ? t : e.value === 0 ? "0" : "•";
|
|
269
272
|
}
|
|
270
273
|
}
|
|
271
|
-
function
|
|
274
|
+
function O(e, t, n) {
|
|
272
275
|
if (e === void 0) return "Not supplied";
|
|
273
276
|
switch (e.kind) {
|
|
274
|
-
case "value": return `${n(e.value)}${
|
|
277
|
+
case "value": return `${n(e.value)}${m(e.value, t) ? "" : " (outside domain)"}`;
|
|
275
278
|
case "masked": return `Masked: ${e.reason}`;
|
|
276
279
|
case "missing": return `Missing: ${e.reason}`;
|
|
277
280
|
}
|
|
278
281
|
}
|
|
279
|
-
function
|
|
280
|
-
let o =
|
|
282
|
+
function k({ rows: e, columns: n, cells: r, domain: i, palette: a }) {
|
|
283
|
+
let o = p({
|
|
281
284
|
domain: i,
|
|
282
285
|
palette: a
|
|
283
286
|
});
|
|
284
287
|
if (o !== null) return o;
|
|
285
|
-
if (e.length * n.length > 4096 || r.length > 4096) return `This matrix exceeds the ${
|
|
288
|
+
if (e.length * n.length > 4096 || r.length > 4096) return `This matrix exceeds the ${C}-cell render limit. Supply a smaller, labelled window.`;
|
|
286
289
|
let s = new Set(e.map((e) => e.id)), c = new Set(n.map((e) => e.id));
|
|
287
290
|
if (!t(e) || !t(n) || !t(r)) return "Matrix rows, columns, and cells must have unique identifiers.";
|
|
288
291
|
let l = /* @__PURE__ */ new Map();
|
|
@@ -296,7 +299,7 @@ function O({ rows: e, columns: n, cells: r, domain: i, palette: a }) {
|
|
|
296
299
|
return null;
|
|
297
300
|
}
|
|
298
301
|
// packages/charts/src/matrix/token-heatmap.tsx
|
|
299
|
-
var
|
|
302
|
+
var A = {
|
|
300
303
|
token: {
|
|
301
304
|
k1xSpc: "xt0psk2",
|
|
302
305
|
kmVPX3: "x1717udv",
|
|
@@ -324,12 +327,14 @@ var k = {
|
|
|
324
327
|
},
|
|
325
328
|
interactive: {
|
|
326
329
|
kkrTdU: "x1ypdohk",
|
|
330
|
+
k3XXqK: "x1t137rt",
|
|
327
331
|
kLWn49: "x1778rvt x1m5v4a8",
|
|
328
332
|
kPJHz1: "x13qnu6",
|
|
329
333
|
kZs9gx: "x19rmrnh",
|
|
330
334
|
k7shQP: "x9v5kkp",
|
|
331
335
|
kiEn40: "x13iak60",
|
|
332
336
|
kGzVvX: "xzro8vx",
|
|
337
|
+
kSReZ0: "x1ecmtor",
|
|
333
338
|
$$css: !0
|
|
334
339
|
},
|
|
335
340
|
selected: {
|
|
@@ -339,101 +344,109 @@ var k = {
|
|
|
339
344
|
kInvED: "x1y3gkto",
|
|
340
345
|
$$css: !0
|
|
341
346
|
}
|
|
342
|
-
},
|
|
343
|
-
function
|
|
344
|
-
let
|
|
347
|
+
}, j = 2048;
|
|
348
|
+
function M({ title: e, description: t, tokens: n, domain: s, palette: f, valueLabel: p, formatValue: g, selection: _, emptyLabel: v }) {
|
|
349
|
+
let b = P({
|
|
345
350
|
tokens: n,
|
|
346
|
-
domain:
|
|
347
|
-
palette:
|
|
351
|
+
domain: s,
|
|
352
|
+
palette: f
|
|
353
|
+
});
|
|
354
|
+
if (b !== null) return /* @__PURE__ */ u(r, {
|
|
355
|
+
title: e,
|
|
356
|
+
description: t,
|
|
357
|
+
message: b
|
|
348
358
|
});
|
|
349
|
-
|
|
359
|
+
let x = n.find((e) => e.id === _?.selectedId);
|
|
360
|
+
return /* @__PURE__ */ d(o, {
|
|
350
361
|
title: e,
|
|
351
362
|
description: t,
|
|
352
|
-
footer: /* @__PURE__ */
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
363
|
+
footer: /* @__PURE__ */ d("div", {
|
|
364
|
+
className: "xrvj5dj x1n8ia3y",
|
|
365
|
+
children: [/* @__PURE__ */ u(y, {
|
|
366
|
+
label: p,
|
|
367
|
+
domain: s,
|
|
368
|
+
palette: f,
|
|
369
|
+
formatValue: g
|
|
370
|
+
}), _ !== void 0 && n.length > 0 && /* @__PURE__ */ u(i, { children: x === void 0 ? "Select a token to inspect its exact text and score." : `Token ${x.index}, ${JSON.stringify(x.text)}, ${p}: ${N(x, s, g)}` })]
|
|
357
371
|
}),
|
|
358
|
-
children: [n.length === 0 ? /* @__PURE__ */
|
|
372
|
+
children: [n.length === 0 ? /* @__PURE__ */ u("p", {
|
|
359
373
|
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
360
|
-
children:
|
|
361
|
-
}) : /* @__PURE__ */
|
|
374
|
+
children: v
|
|
375
|
+
}) : /* @__PURE__ */ u("p", {
|
|
362
376
|
"aria-label": `${e} token text`,
|
|
363
377
|
className: "x1ghz6dp xbixft xiard35 xtqrqnz x1778rvt x126k92a xj0a0fe",
|
|
364
378
|
children: n.map((e) => {
|
|
365
|
-
let t = e.score !== null && !
|
|
366
|
-
domain:
|
|
367
|
-
palette:
|
|
368
|
-
})),
|
|
369
|
-
return
|
|
370
|
-
title:
|
|
371
|
-
...
|
|
379
|
+
let t = e.score !== null && !m(e.score, s), n = `Token ${e.index}, ${JSON.stringify(e.text)}, ${p}: ${N(e, s, g)}`, r = l.props(A.token, e.score === null || t ? A.missing : A.color(h(e.score, {
|
|
380
|
+
domain: s,
|
|
381
|
+
palette: f
|
|
382
|
+
})), _ !== void 0 && A.interactive, _?.selectedId === e.id && A.selected);
|
|
383
|
+
return _ === void 0 ? /* @__PURE__ */ u("span", {
|
|
384
|
+
title: n,
|
|
385
|
+
...r,
|
|
372
386
|
children: e.text
|
|
373
|
-
}, e.id) : /* @__PURE__ */
|
|
387
|
+
}, e.id) : /* @__PURE__ */ u("button", {
|
|
374
388
|
type: "button",
|
|
375
|
-
"aria-label":
|
|
376
|
-
"aria-pressed":
|
|
377
|
-
onClick: () =>
|
|
378
|
-
...
|
|
389
|
+
"aria-label": n,
|
|
390
|
+
"aria-pressed": _.selectedId === e.id,
|
|
391
|
+
onClick: () => _.onSelect(e.id),
|
|
392
|
+
...r,
|
|
379
393
|
children: e.text
|
|
380
394
|
}, e.id);
|
|
381
395
|
})
|
|
382
|
-
}), n.length > 0 && /* @__PURE__ */
|
|
396
|
+
}), n.length > 0 && /* @__PURE__ */ u(c, {
|
|
383
397
|
label: "Token values",
|
|
384
|
-
children: /* @__PURE__ */
|
|
398
|
+
children: /* @__PURE__ */ d("table", {
|
|
385
399
|
className: "xh8yej3 x1mwwwfo x1yc453h xy8obcc xas2l8k",
|
|
386
|
-
children: [/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ d("tr", { children: [
|
|
401
|
+
/* @__PURE__ */ u("th", {
|
|
388
402
|
scope: "col",
|
|
389
|
-
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h
|
|
403
|
+
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
|
|
390
404
|
children: "Index"
|
|
391
405
|
}),
|
|
392
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ u("th", {
|
|
393
407
|
scope: "col",
|
|
394
|
-
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h
|
|
408
|
+
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
|
|
395
409
|
children: "Exact text"
|
|
396
410
|
}),
|
|
397
|
-
/* @__PURE__ */
|
|
411
|
+
/* @__PURE__ */ u("th", {
|
|
398
412
|
scope: "col",
|
|
399
|
-
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h
|
|
400
|
-
children:
|
|
413
|
+
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
|
|
414
|
+
children: p
|
|
401
415
|
})
|
|
402
|
-
] }) }), /* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h
|
|
405
|
-
children: /* @__PURE__ */
|
|
416
|
+
] }) }), /* @__PURE__ */ u("tbody", { children: n.map((e) => /* @__PURE__ */ d("tr", { children: [
|
|
417
|
+
/* @__PURE__ */ u("td", {
|
|
418
|
+
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi x1df8dnd",
|
|
419
|
+
children: /* @__PURE__ */ u(a, {
|
|
406
420
|
label: `Select token ${e.index}: ${JSON.stringify(e.text)}`,
|
|
407
|
-
selected:
|
|
408
|
-
onSelect:
|
|
421
|
+
selected: _?.selectedId === e.id,
|
|
422
|
+
onSelect: _ === void 0 ? void 0 : () => _.onSelect(e.id),
|
|
409
423
|
children: e.index
|
|
410
424
|
})
|
|
411
425
|
}),
|
|
412
|
-
/* @__PURE__ */
|
|
413
|
-
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h
|
|
426
|
+
/* @__PURE__ */ u("td", {
|
|
427
|
+
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi xiard35 x126k92a xj0a0fe",
|
|
414
428
|
children: JSON.stringify(e.text)
|
|
415
429
|
}),
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h
|
|
418
|
-
children:
|
|
430
|
+
/* @__PURE__ */ u("td", {
|
|
431
|
+
className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
|
|
432
|
+
children: N(e, s, g)
|
|
419
433
|
})
|
|
420
434
|
] }, e.id)) })]
|
|
421
435
|
})
|
|
422
436
|
})]
|
|
423
|
-
}) : /* @__PURE__ */ l(r, {
|
|
424
|
-
title: e,
|
|
425
|
-
description: t,
|
|
426
|
-
message: y
|
|
427
437
|
});
|
|
428
438
|
}
|
|
429
|
-
function
|
|
430
|
-
|
|
439
|
+
function N(e, t, n) {
|
|
440
|
+
return e.score === null ? "Unavailable" : `${n(e.score)}${m(e.score, t) ? "" : " (outside domain)"}`;
|
|
441
|
+
}
|
|
442
|
+
function P({ tokens: e, domain: n, palette: r }) {
|
|
443
|
+
let i = p({
|
|
431
444
|
domain: n,
|
|
432
445
|
palette: r
|
|
433
446
|
});
|
|
434
|
-
return i === null ? e.length > 2048 ? `This token view exceeds the ${
|
|
447
|
+
return i === null ? e.length > 2048 ? `This token view exceeds the ${j}-token render limit. Supply a smaller, labelled window.` : !t(e) || new Set(e.map((e) => e.index)).size !== e.length ? "Tokens must have unique identifiers and supplied indices." : e.some((e) => {
|
|
435
448
|
let t = !Number.isSafeInteger(e.index) || e.index < 0, n = e.score !== null && !Number.isFinite(e.score);
|
|
436
449
|
return t || n;
|
|
437
450
|
}) ? "Token indices must be nonnegative integers and measured scores must be finite. Use null for unavailable scores." : null : i;
|
|
438
451
|
}
|
|
439
|
-
export {
|
|
452
|
+
export { y as ColorLegend, j as MAX_HEATMAP_TOKENS, C as MAX_MATRIX_CELLS, T as Matrix, M as TokenHeatmap };
|