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