@mechane-ai/elements 0.39.0 → 0.41.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 +11 -19
- package/README.md +49 -25
- package/dist/accessibility-P89UG9-r.js +25 -0
- package/dist/agent.js +1 -0
- package/dist/ai.js +50 -44
- package/dist/{categorical-values-BECG-J6R.js → categorical-values-DnGR_pQx.js} +3 -3
- package/dist/{chart-frame-CJFnI39T.js → chart-frame-BsyI1Zc8.js} +58 -57
- package/dist/{chart-input-DwAobO8Y.js → chart-input-r4S3-QCT.js} +2 -2
- package/dist/chart-navigation-D7OkLdSx.js +119 -0
- package/dist/charts/cartesian.js +560 -583
- package/dist/charts/distribution.js +218 -218
- package/dist/charts/graph.js +86 -85
- package/dist/charts/hierarchy.js +4 -4
- package/dist/charts/matrix.js +148 -147
- package/dist/charts/timeline.js +77 -76
- package/dist/charts.js +2 -2
- package/dist/code-block-C4K1sM9O.js +255 -0
- package/dist/collections.js +828 -607
- package/dist/constants.stylex-BILvnwUk.js +84 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +3 -3
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +184 -77
- package/dist/{content-link-B3ObdyZY.js → content-link-CBDqSvgP.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/control-styles-D3q_Qyxi.js +179 -0
- package/dist/csp.js +14 -1
- package/dist/feedback.js +1 -1
- package/dist/forms/dates.js +359 -245
- package/dist/forms-I-WMHTkr.js +139 -0
- package/dist/forms.js +3 -3
- package/dist/index.js +1 -1
- package/dist/layout.js +271 -241
- package/dist/navigation/commands.js +87 -76
- package/dist/{navigation-D2_sGy3C.js → navigation-CveMIuXI.js} +1 -1
- package/dist/navigation.js +2 -2
- package/dist/overlays.js +1 -1
- package/dist/packages/ai/src/message-action.d.ts +1 -1
- package/dist/packages/charts/src/chart-navigation.d.ts +18 -2
- package/dist/packages/charts/src/chart-surface.d.ts +23 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +3 -2
- package/dist/packages/collections/src/data-table.d.ts +7 -2
- package/dist/packages/collections/src/index.d.ts +4 -1
- package/dist/packages/collections/src/query-controls.d.ts +18 -0
- package/dist/packages/collections/src/table-query.d.ts +64 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +3 -8
- package/dist/packages/content/src/pierre-theme.d.ts +0 -1
- package/dist/packages/core/src/actions.d.ts +15 -13
- package/dist/packages/core/src/copy-value.d.ts +3 -2
- package/dist/packages/core/src/disclosure.d.ts +14 -11
- package/dist/packages/feedback/src/notifications.d.ts +15 -15
- package/dist/packages/feedback/src/toast.d.ts +9 -3
- package/dist/packages/forms/src/combobox.d.ts +31 -41
- package/dist/packages/forms/src/dates/event-month.d.ts +17 -0
- package/dist/packages/forms/src/dates/index.d.ts +2 -0
- package/dist/packages/forms/src/field-styles.d.ts +0 -19
- package/dist/packages/forms/src/form-controls.d.ts +26 -24
- package/dist/packages/forms/src/forms.d.ts +17 -14
- package/dist/packages/forms/src/select-control.d.ts +6 -4
- package/dist/packages/forms/src/select.d.ts +14 -18
- package/dist/packages/forms/src/selection-state.d.ts +11 -0
- package/dist/packages/forms/src/selection-styles.d.ts +3 -0
- package/dist/packages/forms/src/selection.d.ts +21 -19
- package/dist/packages/foundations/src/agent/index.d.ts +2 -0
- package/dist/packages/foundations/src/control-state.d.ts +2 -3
- package/dist/packages/foundations/src/control-styles.d.ts +19 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +3 -0
- package/dist/packages/foundations/src/style-composition.d.ts +4 -1
- package/dist/packages/layout/src/app-shell.d.ts +12 -1
- package/dist/packages/layout/src/index.d.ts +1 -1
- package/dist/packages/layout/src/navigation-rail.d.ts +15 -2
- package/dist/packages/layout/src/resizable.d.ts +2 -2
- package/dist/packages/layout/src/sidebar.d.ts +4 -3
- package/dist/packages/navigation/src/tab-styles.d.ts +1 -1
- package/dist/packages/navigation/src/tabs.d.ts +12 -10
- package/dist/packages/overlays/src/alert-dialog.d.ts +19 -13
- package/dist/packages/overlays/src/dialog.d.ts +39 -24
- package/dist/packages/overlays/src/drawer.d.ts +16 -26
- package/dist/packages/overlays/src/menu.d.ts +37 -44
- package/dist/packages/overlays/src/overlay-root.d.ts +10 -0
- package/dist/packages/overlays/src/popover.d.ts +11 -20
- package/dist/packages/overlays/src/preview.d.ts +6 -13
- package/dist/packages/overlays/src/tooltip.d.ts +12 -15
- package/dist/{pierre-diff-CaPsfQRo.js → pierre-diff-DJ3oOfPX.js} +5 -5
- package/dist/{src-DPRmO-JY.js → src-CNV1ewzb.js} +379 -407
- package/dist/{src-CSWIG_op.js → src-CQQvXi7a.js} +58 -81
- package/dist/{src-DWjAoOyd.js → src-D2OHco8V.js} +42 -41
- package/dist/src-DfOAlAd2.js +750 -0
- package/dist/src-na2DdkKI.js +561 -0
- package/dist/{src-C-Sx37kz.js → src-s3tWwnN4.js} +361 -518
- package/dist/styles.js +3 -0
- package/dist/{elements.css → styles2.css} +195 -97
- package/dist/tokens.js +3 -1
- package/dist/{tokens.stylex-CJbIDPB9.js → tokens.stylex-dF5CACEJ.js} +13 -93
- package/package.json +8 -9
- package/skills/elements-workspace/SKILL.md +12 -0
- package/dist/accessibility-C-aIZ1Yx.js +0 -15
- package/dist/chart-navigation-CBIeNtJq.js +0 -67
- package/dist/code-block-aC0Htt4N.js +0 -184
- package/dist/forms-BQQFas9g.js +0 -118
- package/dist/foundations.css +0 -7
- package/dist/packages/content/src/tree/pierre-tree.d.ts +0 -3
- package/dist/pierre-theme-BpNaWn1x.js +0 -126
- package/dist/pierre-tree-CYCRjdGG.js +0 -106
- package/dist/src-d7EAi61b.js +0 -617
- package/dist/src-nkgFDl-g.js +0 -1171
- package/dist/style-composition-uYlczSsB.js +0 -9
- package/styles.css +0 -2
package/dist/charts/matrix.js
CHANGED
|
@@ -1,69 +1,70 @@
|
|
|
1
|
-
import { c as e } from "../src-
|
|
2
|
-
import { r as t } from "../tokens.stylex-
|
|
3
|
-
import { n, r, t as i } from "../chart-input-
|
|
4
|
-
import { n as
|
|
5
|
-
import { i as
|
|
6
|
-
import * as
|
|
7
|
-
import {
|
|
1
|
+
import { c as e } from "../src-DfOAlAd2.js";
|
|
2
|
+
import { r as t } from "../tokens.stylex-dF5CACEJ.js";
|
|
3
|
+
import { n, r, t as i } from "../chart-input-r4S3-QCT.js";
|
|
4
|
+
import { a, i as o, n as s, t as c } from "../chart-navigation-D7OkLdSx.js";
|
|
5
|
+
import { i as l, n as u } from "../chart-frame-BsyI1Zc8.js";
|
|
6
|
+
import * as d from "@stylexjs/stylex";
|
|
7
|
+
import { Button as f } from "@ui-sdk/react/button";
|
|
8
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
8
9
|
// packages/charts/src/matrix/heatmap-scale.ts
|
|
9
|
-
var
|
|
10
|
-
function
|
|
10
|
+
var h = 100;
|
|
11
|
+
function g({ domain: e, palette: t }) {
|
|
11
12
|
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.";
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function _(e, t) {
|
|
14
15
|
return e >= t[0] && e <= t[1];
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function v(n, { domain: r, palette: i }) {
|
|
17
18
|
if (i === "diverging") {
|
|
18
|
-
let i = n < 0 ? r[0] : r[1], a = Math.abs(n) / Math.abs(i) *
|
|
19
|
+
let i = n < 0 ? r[0] : r[1], a = Math.abs(n) / Math.abs(i) * h;
|
|
19
20
|
return `color-mix(in srgb, ${n < 0 ? e.negative : e.positive} ${a}%, ${t.surface})`;
|
|
20
21
|
}
|
|
21
|
-
let a = (n - r[0]) / (r[1] - r[0]) *
|
|
22
|
+
let a = (n - r[0]) / (r[1] - r[0]) * h;
|
|
22
23
|
return `color-mix(in srgb, ${e.series1} ${a}%, ${t.surface})`;
|
|
23
24
|
}
|
|
24
25
|
// packages/charts/src/matrix/color-legend.tsx
|
|
25
|
-
var
|
|
26
|
+
var y = {
|
|
26
27
|
kUk6DE: "x98rzlu",
|
|
27
28
|
$$css: !0
|
|
28
|
-
},
|
|
29
|
-
|
|
29
|
+
}, b = { sample: (e) => [
|
|
30
|
+
y,
|
|
30
31
|
{
|
|
31
32
|
kWkggS: e == null ? e : "xl8spv7",
|
|
32
33
|
$$css: !0
|
|
33
34
|
},
|
|
34
35
|
{ "--x-backgroundColor": e ?? void 0 }
|
|
35
|
-
] },
|
|
36
|
-
function
|
|
37
|
-
let i =
|
|
36
|
+
] }, x = 20;
|
|
37
|
+
function S({ label: e, domain: t, palette: n, formatValue: r }) {
|
|
38
|
+
let i = g({
|
|
38
39
|
domain: t,
|
|
39
40
|
palette: n
|
|
40
41
|
});
|
|
41
|
-
if (i !== null) return /* @__PURE__ */
|
|
42
|
+
if (i !== null) return /* @__PURE__ */ p("p", {
|
|
42
43
|
role: "status",
|
|
43
44
|
className: "xrvj5dj xunmzkg x1ghz6dp xeuugli x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k xj0a0fe",
|
|
44
45
|
children: i
|
|
45
46
|
});
|
|
46
|
-
let a = Array.from({ length: 21 }, (e, n) => t[0] + (t[1] - t[0]) * n /
|
|
47
|
-
return /* @__PURE__ */
|
|
47
|
+
let a = Array.from({ length: 21 }, (e, n) => t[0] + (t[1] - t[0]) * n / x);
|
|
48
|
+
return /* @__PURE__ */ m("div", {
|
|
48
49
|
"aria-label": `${e}: ${r(t[0])} to ${r(t[1])}`,
|
|
49
50
|
className: "xrvj5dj xunmzkg x1ghz6dp xeuugli x1jkqq1h x153jb6y x1hz01jw xy8obcc xas2l8k xj0a0fe",
|
|
50
51
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ m("span", { children: [e, n === "diverging" && ` · Neutral: ${r(0)}`] }),
|
|
53
|
+
/* @__PURE__ */ p("div", {
|
|
53
54
|
"aria-hidden": !0,
|
|
54
55
|
className: "x78zum5 xdk7pt xmkeg23 x1y0btm7 x1ey3b81",
|
|
55
|
-
children: a.map((e) => /* @__PURE__ */
|
|
56
|
+
children: a.map((e) => /* @__PURE__ */ p("span", { ...d.props(b.sample(v(e, {
|
|
56
57
|
domain: t,
|
|
57
58
|
palette: n
|
|
58
59
|
}))) }, e))
|
|
59
60
|
}),
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ m("div", {
|
|
61
62
|
"aria-hidden": !0,
|
|
62
63
|
className: "x78zum5 x1qughib x1n8ia3y xss6m8b",
|
|
63
|
-
children: [/* @__PURE__ */
|
|
64
|
+
children: [/* @__PURE__ */ p("span", {
|
|
64
65
|
className: "xeuugli",
|
|
65
66
|
children: r(t[0])
|
|
66
|
-
}), /* @__PURE__ */
|
|
67
|
+
}), /* @__PURE__ */ p("span", {
|
|
67
68
|
className: "xeuugli xp4054r",
|
|
68
69
|
children: r(t[1])
|
|
69
70
|
})]
|
|
@@ -72,10 +73,10 @@ function y({ label: e, domain: t, palette: n, formatValue: r }) {
|
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
// packages/charts/src/matrix/matrix.tsx
|
|
75
|
-
var
|
|
76
|
+
var C = {
|
|
76
77
|
kKwaWg: "x1e87kdn",
|
|
77
78
|
$$css: !0
|
|
78
|
-
},
|
|
79
|
+
}, w = {
|
|
79
80
|
value: {
|
|
80
81
|
k1xSpc: "x78zum5",
|
|
81
82
|
kGNEyG: "x6s0dn4",
|
|
@@ -114,7 +115,7 @@ var b = {
|
|
|
114
115
|
kInvED: "x2ssjo2",
|
|
115
116
|
$$css: !0
|
|
116
117
|
},
|
|
117
|
-
measured: (e) => [
|
|
118
|
+
measured: (e) => [C, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${e})` }],
|
|
118
119
|
missing: {
|
|
119
120
|
kMwMTN: "x153jb6y",
|
|
120
121
|
kWkggS: "x1r7kqkb",
|
|
@@ -126,66 +127,66 @@ var b = {
|
|
|
126
127
|
kWkggS: "x1r7kqkb",
|
|
127
128
|
$$css: !0
|
|
128
129
|
}
|
|
129
|
-
},
|
|
130
|
+
}, T = {
|
|
130
131
|
value: void 0,
|
|
131
|
-
masked:
|
|
132
|
-
missing:
|
|
133
|
-
},
|
|
134
|
-
function
|
|
135
|
-
let x =
|
|
132
|
+
masked: w.masked,
|
|
133
|
+
missing: w.missing
|
|
134
|
+
}, E = 4096, D = 6;
|
|
135
|
+
function O({ title: e, report: t, description: n, rows: r, columns: o, cells: d, domain: f, palette: h, valueLabel: g, formatValue: v, selection: y, emptyLabel: b }) {
|
|
136
|
+
let x = c({
|
|
136
137
|
title: e,
|
|
137
|
-
selection:
|
|
138
|
-
items:
|
|
138
|
+
selection: y,
|
|
139
|
+
items: d.map((e) => ({
|
|
139
140
|
id: e.id,
|
|
140
|
-
label: `${r.find((t) => t.id === e.rowId)?.label ?? e.rowId} → ${
|
|
141
|
+
label: `${r.find((t) => t.id === e.rowId)?.label ?? e.rowId} → ${o.find((t) => t.id === e.columnId)?.label ?? e.columnId}: ${j(e, f, v)}`
|
|
141
142
|
}))
|
|
142
|
-
}),
|
|
143
|
+
}), C = M({
|
|
143
144
|
rows: r,
|
|
144
|
-
columns:
|
|
145
|
-
cells:
|
|
146
|
-
domain:
|
|
145
|
+
columns: o,
|
|
146
|
+
cells: d,
|
|
147
|
+
domain: f,
|
|
147
148
|
palette: h
|
|
148
149
|
});
|
|
149
|
-
if (
|
|
150
|
+
if (C !== null) return /* @__PURE__ */ p(i, {
|
|
150
151
|
title: e,
|
|
151
152
|
report: t,
|
|
152
153
|
description: n,
|
|
153
|
-
message:
|
|
154
|
+
message: C
|
|
154
155
|
});
|
|
155
|
-
let
|
|
156
|
-
for (let e of
|
|
157
|
-
let t =
|
|
158
|
-
t.set(e.columnId, e),
|
|
156
|
+
let w = /* @__PURE__ */ new Map();
|
|
157
|
+
for (let e of d) {
|
|
158
|
+
let t = w.get(e.rowId) ?? /* @__PURE__ */ new Map();
|
|
159
|
+
t.set(e.columnId, e), w.set(e.rowId, t);
|
|
159
160
|
}
|
|
160
|
-
return /* @__PURE__ */ u
|
|
161
|
+
return /* @__PURE__ */ p(u, {
|
|
161
162
|
title: e,
|
|
162
163
|
report: t,
|
|
163
164
|
description: n,
|
|
164
|
-
footer: /* @__PURE__ */
|
|
165
|
+
footer: /* @__PURE__ */ m("div", {
|
|
165
166
|
className: "xrvj5dj x1n8ia3y",
|
|
166
167
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ p(S, {
|
|
168
169
|
label: g,
|
|
169
|
-
domain:
|
|
170
|
+
domain: f,
|
|
170
171
|
palette: h,
|
|
171
|
-
formatValue:
|
|
172
|
+
formatValue: v
|
|
172
173
|
}),
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ m("ul", {
|
|
174
175
|
"aria-label": "Cell states",
|
|
175
176
|
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc",
|
|
176
177
|
children: [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
d.some((e) => e.kind === "masked") && /* @__PURE__ */ p("li", { children: "× Masked" }),
|
|
179
|
+
d.some((e) => e.kind === "missing") && /* @__PURE__ */ p("li", { children: "— Missing" }),
|
|
180
|
+
d.length < r.length * o.length && /* @__PURE__ */ p("li", { children: "· Not supplied" }),
|
|
181
|
+
d.some((e) => e.kind === "value" && !_(e.value, f)) && /* @__PURE__ */ p("li", { children: "! Outside domain" }),
|
|
182
|
+
d.some((e) => e.kind === "value" && v(e.value).length > D) && /* @__PURE__ */ p("li", { children: "• Inspect a cell for its exact value" })
|
|
182
183
|
]
|
|
183
184
|
}),
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ p(l, {
|
|
185
186
|
id: x.id,
|
|
186
187
|
children: x.label ?? "\xA0"
|
|
187
188
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ p(a, {
|
|
189
190
|
label: `${e} cells`,
|
|
190
191
|
columns: [{
|
|
191
192
|
id: "cell",
|
|
@@ -194,55 +195,55 @@ function T({ title: e, report: t, description: n, rows: r, columns: l, cells: f,
|
|
|
194
195
|
id: "value",
|
|
195
196
|
label: g
|
|
196
197
|
}],
|
|
197
|
-
rows: r.flatMap((e) =>
|
|
198
|
+
rows: r.flatMap((e) => o.map((t) => ({
|
|
198
199
|
id: JSON.stringify([e.id, t.id]),
|
|
199
|
-
values: [`${e.label} → ${t.label}`,
|
|
200
|
+
values: [`${e.label} → ${t.label}`, j(w.get(e.id)?.get(t.id), f, v)]
|
|
200
201
|
})))
|
|
201
202
|
})
|
|
202
203
|
]
|
|
203
204
|
}),
|
|
204
|
-
children: r.length === 0 ||
|
|
205
|
+
children: r.length === 0 || o.length === 0 ? /* @__PURE__ */ p("p", {
|
|
205
206
|
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
206
207
|
children: b
|
|
207
|
-
}) : /* @__PURE__ */
|
|
208
|
+
}) : /* @__PURE__ */ p(s, {
|
|
208
209
|
...x.props,
|
|
209
210
|
className: "xysyzu8 x14eurpq xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal",
|
|
210
|
-
children: /* @__PURE__ */
|
|
211
|
+
children: /* @__PURE__ */ m("table", {
|
|
211
212
|
className: "x1vathgz x1jkpq5q xezivpi x1hz01jw",
|
|
212
|
-
children: [/* @__PURE__ */
|
|
213
|
+
children: [/* @__PURE__ */ p("thead", { children: /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", {
|
|
213
214
|
"aria-label": "Row",
|
|
214
215
|
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft"
|
|
215
|
-
}),
|
|
216
|
+
}), o.map((e) => /* @__PURE__ */ p("th", {
|
|
216
217
|
scope: "col",
|
|
217
218
|
title: e.label,
|
|
218
219
|
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
219
|
-
children: /* @__PURE__ */
|
|
220
|
+
children: /* @__PURE__ */ p("span", {
|
|
220
221
|
className: "x1lliihq x100vrsf x1ff4b4a xb3r6kr xlyipyv x2b8uid x1hmw7ec",
|
|
221
222
|
children: e.label
|
|
222
223
|
})
|
|
223
|
-
}, e.id))] }) }), /* @__PURE__ */
|
|
224
|
+
}, e.id))] }) }), /* @__PURE__ */ p("tbody", { children: r.map((e) => /* @__PURE__ */ m("tr", { children: [/* @__PURE__ */ p("th", {
|
|
224
225
|
scope: "row",
|
|
225
226
|
title: e.label,
|
|
226
227
|
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
227
|
-
children: /* @__PURE__ */
|
|
228
|
+
children: /* @__PURE__ */ p("span", {
|
|
228
229
|
className: "x1lliihq x18qnofl xb3r6kr xlyipyv xx67isq",
|
|
229
230
|
children: e.label
|
|
230
231
|
})
|
|
231
|
-
}),
|
|
232
|
-
let n =
|
|
233
|
-
return /* @__PURE__ */
|
|
232
|
+
}), o.map((t) => {
|
|
233
|
+
let n = w.get(e.id)?.get(t.id);
|
|
234
|
+
return /* @__PURE__ */ p("td", {
|
|
234
235
|
onPointerEnter: () => {
|
|
235
236
|
n !== void 0 && x.inspect(n.id);
|
|
236
237
|
},
|
|
237
238
|
className: "x1717udv x100vrsf x1ff4b4a x2b8uid",
|
|
238
|
-
children: /* @__PURE__ */
|
|
239
|
+
children: /* @__PURE__ */ p(k, {
|
|
239
240
|
cell: n,
|
|
240
241
|
isInspected: x.label !== void 0 && x.activeId === n?.id,
|
|
241
242
|
label: `${e.label}, ${t.label}`,
|
|
242
|
-
domain:
|
|
243
|
+
domain: f,
|
|
243
244
|
palette: h,
|
|
244
|
-
formatValue:
|
|
245
|
-
selection:
|
|
245
|
+
formatValue: v,
|
|
246
|
+
selection: y
|
|
246
247
|
})
|
|
247
248
|
}, t.id);
|
|
248
249
|
})] }, e.id)) })]
|
|
@@ -250,60 +251,60 @@ function T({ title: e, report: t, description: n, rows: r, columns: l, cells: f,
|
|
|
250
251
|
})
|
|
251
252
|
});
|
|
252
253
|
}
|
|
253
|
-
function
|
|
254
|
-
if (e === void 0) return /* @__PURE__ */
|
|
254
|
+
function k({ cell: e, isInspected: t, label: n, domain: r, palette: i, formatValue: a, selection: o }) {
|
|
255
|
+
if (e === void 0) return /* @__PURE__ */ p("span", {
|
|
255
256
|
role: "img",
|
|
256
257
|
"aria-label": `${n}: not supplied`,
|
|
257
258
|
title: `${n}: not supplied`,
|
|
258
259
|
className: "x78zum5 x6s0dn4 xl56j7k x100vrsf x1ff4b4a x1vqgdyp x992rv9 x9f619 xmkeg23 x1ey3b81 x1717udv x1hz01jw xy8obcc xj57cvi xas2l8k xss6m8b x153jb6y x1r7kqkb xbsl7fq",
|
|
259
260
|
children: "·"
|
|
260
261
|
});
|
|
261
|
-
let s = e.kind === "value" && !
|
|
262
|
+
let s = e.kind === "value" && !_(e.value, r), c = j(e, r, a), l = `${n}: ${c}`, u = e.kind === "value" && !s ? v(e.value, {
|
|
262
263
|
domain: r,
|
|
263
264
|
palette: i
|
|
264
|
-
}) : void 0,
|
|
265
|
+
}) : void 0, m = d.props(w.value, T[e.kind], u !== void 0 && w.measured(u), s && w.missing, o !== void 0 && w.interactive, (t || o?.selectedId === e.id) && w.selected), h = A(e, c, s), g = e.kind === "value" ? /* @__PURE__ */ p("span", {
|
|
265
266
|
className: "xpvm0e4 x1r97e56",
|
|
266
|
-
children:
|
|
267
|
-
}) :
|
|
268
|
-
return o === void 0 ? /* @__PURE__ */
|
|
267
|
+
children: h
|
|
268
|
+
}) : h;
|
|
269
|
+
return o === void 0 ? /* @__PURE__ */ p("span", {
|
|
269
270
|
role: "img",
|
|
270
|
-
"aria-label":
|
|
271
|
-
title:
|
|
272
|
-
...
|
|
273
|
-
children:
|
|
274
|
-
}) : /* @__PURE__ */
|
|
271
|
+
"aria-label": l,
|
|
272
|
+
title: l,
|
|
273
|
+
...m,
|
|
274
|
+
children: g
|
|
275
|
+
}) : /* @__PURE__ */ p(f, {
|
|
275
276
|
type: "button",
|
|
276
277
|
tabIndex: -1,
|
|
277
|
-
"aria-label":
|
|
278
|
-
title:
|
|
278
|
+
"aria-label": l,
|
|
279
|
+
title: l,
|
|
279
280
|
"aria-pressed": o.selectedId === e.id,
|
|
280
281
|
onClick: () => o.onSelect(e.id),
|
|
281
|
-
...
|
|
282
|
-
children:
|
|
282
|
+
...m,
|
|
283
|
+
children: g
|
|
283
284
|
});
|
|
284
285
|
}
|
|
285
|
-
function
|
|
286
|
+
function A(e, t, n) {
|
|
286
287
|
switch (e.kind) {
|
|
287
288
|
case "masked": return "×";
|
|
288
289
|
case "missing": return "—";
|
|
289
|
-
case "value": return n ? "!" : t.length <=
|
|
290
|
+
case "value": return n ? "!" : t.length <= D ? t : e.value === 0 ? "0" : "•";
|
|
290
291
|
}
|
|
291
292
|
}
|
|
292
|
-
function
|
|
293
|
+
function j(e, t, n) {
|
|
293
294
|
if (e === void 0) return "Not supplied";
|
|
294
295
|
switch (e.kind) {
|
|
295
|
-
case "value": return `${n(e.value)}${
|
|
296
|
+
case "value": return `${n(e.value)}${_(e.value, t) ? "" : " (outside domain)"}`;
|
|
296
297
|
case "masked": return `Masked: ${e.reason}`;
|
|
297
298
|
case "missing": return `Missing: ${e.reason}`;
|
|
298
299
|
}
|
|
299
300
|
}
|
|
300
|
-
function
|
|
301
|
-
let o =
|
|
301
|
+
function M({ rows: e, columns: t, cells: r, domain: i, palette: a }) {
|
|
302
|
+
let o = g({
|
|
302
303
|
domain: i,
|
|
303
304
|
palette: a
|
|
304
305
|
});
|
|
305
306
|
if (o !== null) return o;
|
|
306
|
-
if (e.length * t.length > 4096 || r.length > 4096) return `This matrix exceeds the ${
|
|
307
|
+
if (e.length * t.length > 4096 || r.length > 4096) return `This matrix exceeds the ${E}-cell render limit. Supply a smaller, labelled window.`;
|
|
307
308
|
let s = new Set(e.map((e) => e.id)), c = new Set(t.map((e) => e.id));
|
|
308
309
|
if (!n(e) || !n(t) || !n(r)) return "Matrix rows, columns, and cells must have unique identifiers.";
|
|
309
310
|
let l = /* @__PURE__ */ new Map();
|
|
@@ -317,7 +318,7 @@ function k({ rows: e, columns: t, cells: r, domain: i, palette: a }) {
|
|
|
317
318
|
return null;
|
|
318
319
|
}
|
|
319
320
|
// packages/charts/src/matrix/token-heatmap.tsx
|
|
320
|
-
var
|
|
321
|
+
var N = {
|
|
321
322
|
token: {
|
|
322
323
|
k1xSpc: "xt0psk2",
|
|
323
324
|
kmVPX3: "x1717udv",
|
|
@@ -362,64 +363,64 @@ var A = {
|
|
|
362
363
|
kInvED: "x1y3gkto",
|
|
363
364
|
$$css: !0
|
|
364
365
|
}
|
|
365
|
-
},
|
|
366
|
-
function
|
|
367
|
-
let
|
|
366
|
+
}, P = 2048;
|
|
367
|
+
function F({ title: e, report: t, description: n, tokens: r, domain: s, palette: h, valueLabel: g, formatValue: y, selection: b, emptyLabel: x }) {
|
|
368
|
+
let C = r.map((e) => ({
|
|
368
369
|
id: e.id,
|
|
369
|
-
label: `Token ${e.index}, ${JSON.stringify(e.text)}, ${g}: ${
|
|
370
|
-
})),
|
|
370
|
+
label: `Token ${e.index}, ${JSON.stringify(e.text)}, ${g}: ${I(e, s, y)}`
|
|
371
|
+
})), w = c({
|
|
371
372
|
title: e,
|
|
372
|
-
items:
|
|
373
|
-
selection:
|
|
374
|
-
}),
|
|
373
|
+
items: C,
|
|
374
|
+
selection: b
|
|
375
|
+
}), T = L({
|
|
375
376
|
tokens: r,
|
|
376
|
-
domain:
|
|
377
|
-
palette:
|
|
377
|
+
domain: s,
|
|
378
|
+
palette: h
|
|
378
379
|
});
|
|
379
|
-
return
|
|
380
|
+
return T === null ? /* @__PURE__ */ m(u, {
|
|
380
381
|
title: e,
|
|
381
382
|
report: t,
|
|
382
383
|
description: n,
|
|
383
|
-
footer: /* @__PURE__ */
|
|
384
|
+
footer: /* @__PURE__ */ m("div", {
|
|
384
385
|
className: "xrvj5dj x1n8ia3y",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
386
|
+
children: [/* @__PURE__ */ p(S, {
|
|
386
387
|
label: g,
|
|
387
|
-
domain:
|
|
388
|
-
palette:
|
|
389
|
-
formatValue:
|
|
390
|
-
}), /* @__PURE__ */
|
|
391
|
-
id:
|
|
392
|
-
children:
|
|
388
|
+
domain: s,
|
|
389
|
+
palette: h,
|
|
390
|
+
formatValue: y
|
|
391
|
+
}), /* @__PURE__ */ p(l, {
|
|
392
|
+
id: w.id,
|
|
393
|
+
children: w.label ?? "\xA0"
|
|
393
394
|
})]
|
|
394
395
|
}),
|
|
395
|
-
children: [r.length === 0 ? /* @__PURE__ */
|
|
396
|
+
children: [r.length === 0 ? /* @__PURE__ */ p("p", {
|
|
396
397
|
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
397
|
-
children:
|
|
398
|
-
}) : /* @__PURE__ */
|
|
399
|
-
...
|
|
398
|
+
children: x
|
|
399
|
+
}) : /* @__PURE__ */ p(o, {
|
|
400
|
+
...w.props,
|
|
400
401
|
className: "x1ghz6dp xbixft xiard35 xtqrqnz x1778rvt x126k92a xj0a0fe",
|
|
401
402
|
children: r.map((e) => {
|
|
402
|
-
let t =
|
|
403
|
-
domain:
|
|
404
|
-
palette:
|
|
405
|
-
})),
|
|
406
|
-
return
|
|
403
|
+
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}: ${I(e, s, y)}`, i = d.props(N.token, e.score === null || n ? N.missing : N.color(v(e.score, {
|
|
404
|
+
domain: s,
|
|
405
|
+
palette: h
|
|
406
|
+
})), b !== void 0 && N.interactive, (b?.selectedId === e.id || t) && N.selected);
|
|
407
|
+
return b === void 0 ? /* @__PURE__ */ p("span", {
|
|
407
408
|
title: r,
|
|
408
|
-
onPointerEnter: () =>
|
|
409
|
+
onPointerEnter: () => w.inspect(e.id),
|
|
409
410
|
...i,
|
|
410
411
|
children: e.text
|
|
411
|
-
}, e.id) : /* @__PURE__ */
|
|
412
|
+
}, e.id) : /* @__PURE__ */ p(f, {
|
|
412
413
|
type: "button",
|
|
413
414
|
tabIndex: -1,
|
|
414
|
-
onPointerEnter: () =>
|
|
415
|
+
onPointerEnter: () => w.inspect(e.id),
|
|
415
416
|
"aria-label": r,
|
|
416
|
-
"aria-pressed":
|
|
417
|
-
onClick: () =>
|
|
417
|
+
"aria-pressed": b.selectedId === e.id,
|
|
418
|
+
onClick: () => b.onSelect(e.id),
|
|
418
419
|
...i,
|
|
419
420
|
children: e.text
|
|
420
421
|
}, e.id);
|
|
421
422
|
})
|
|
422
|
-
}), /* @__PURE__ */
|
|
423
|
+
}), /* @__PURE__ */ p(a, {
|
|
423
424
|
label: `${e} token values`,
|
|
424
425
|
columns: [
|
|
425
426
|
{
|
|
@@ -440,28 +441,28 @@ function M({ title: e, report: t, description: n, tokens: r, domain: f, palette:
|
|
|
440
441
|
values: [
|
|
441
442
|
String(e.index),
|
|
442
443
|
JSON.stringify(e.text),
|
|
443
|
-
|
|
444
|
+
I(e, s, y)
|
|
444
445
|
]
|
|
445
446
|
}))
|
|
446
447
|
})]
|
|
447
|
-
}) : /* @__PURE__ */
|
|
448
|
+
}) : /* @__PURE__ */ p(i, {
|
|
448
449
|
title: e,
|
|
449
450
|
report: t,
|
|
450
451
|
description: n,
|
|
451
|
-
message:
|
|
452
|
+
message: T
|
|
452
453
|
});
|
|
453
454
|
}
|
|
454
|
-
function
|
|
455
|
-
return e.score === null ? "Unavailable" : `${n(e.score)}${
|
|
455
|
+
function I(e, t, n) {
|
|
456
|
+
return e.score === null ? "Unavailable" : `${n(e.score)}${_(e.score, t) ? "" : " (outside domain)"}`;
|
|
456
457
|
}
|
|
457
|
-
function
|
|
458
|
-
let i =
|
|
458
|
+
function L({ tokens: e, domain: t, palette: r }) {
|
|
459
|
+
let i = g({
|
|
459
460
|
domain: t,
|
|
460
461
|
palette: r
|
|
461
462
|
});
|
|
462
|
-
return i === null ? e.length > 2048 ? `This token view exceeds the ${
|
|
463
|
+
return i === null ? e.length > 2048 ? `This token view exceeds the ${P}-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) => {
|
|
463
464
|
let t = !Number.isSafeInteger(e.index) || e.index < 0, n = e.score !== null && !Number.isFinite(e.score);
|
|
464
465
|
return t || n;
|
|
465
466
|
}) ? "Token indices must be nonnegative integers and measured scores must be finite. Use null for unavailable scores." : null : i;
|
|
466
467
|
}
|
|
467
|
-
export {
|
|
468
|
+
export { S as ColorLegend, P as MAX_HEATMAP_TOKENS, E as MAX_MATRIX_CELLS, O as Matrix, F as TokenHeatmap };
|