@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.
Files changed (39) hide show
  1. package/README.md +8 -6
  2. package/dist/ai.js +3 -3
  3. package/dist/{chart-theme-Bwr9YSP1.js → categorical-values-BECG-J6R.js} +4 -54
  4. package/dist/{chart-frame-C0UBu4ku.js → chart-frame-CJFnI39T.js} +78 -93
  5. package/dist/{chart-input-Ccr2NJ6J.js → chart-input-DwAobO8Y.js} +2 -2
  6. package/dist/chart-navigation-CBIeNtJq.js +67 -0
  7. package/dist/charts/cartesian.js +631 -618
  8. package/dist/charts/distribution.js +298 -267
  9. package/dist/charts/graph.js +113 -122
  10. package/dist/charts/hierarchy.js +12 -12
  11. package/dist/charts/matrix.js +208 -200
  12. package/dist/charts/timeline.js +2 -2
  13. package/dist/charts.js +3 -3
  14. package/dist/{code-block-DT1TCkTC.js → code-block-aC0Htt4N.js} +33 -32
  15. package/dist/collections.js +597 -351
  16. package/dist/content/code.js +1 -1
  17. package/dist/content/diff.js +1 -1
  18. package/dist/content/markdown.js +1 -1
  19. package/dist/content.js +1 -1
  20. package/dist/elements.css +22 -2
  21. package/dist/feedback.js +1 -1
  22. package/dist/navigation/commands.js +4 -3
  23. package/dist/packages/charts/src/chart-data.d.ts +13 -3
  24. package/dist/packages/charts/src/chart-frame.d.ts +2 -5
  25. package/dist/packages/charts/src/chart-navigation.d.ts +19 -0
  26. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -2
  27. package/dist/packages/collections/src/collection-filters.d.ts +20 -0
  28. package/dist/packages/collections/src/data-table.d.ts +4 -6
  29. package/dist/packages/collections/src/index.d.ts +4 -0
  30. package/dist/packages/collections/src/use-collection-controls.d.ts +30 -0
  31. package/dist/packages/feedback/src/index.d.ts +2 -2
  32. package/dist/packages/feedback/src/notifications.d.ts +35 -0
  33. package/dist/packages/feedback/src/toast.d.ts +1 -1
  34. package/dist/packages/navigation/src/commands/command.d.ts +1 -0
  35. package/dist/plot-width-BQQS-mw9.js +67 -0
  36. package/dist/{src-D9DktxEq.js → src-DWjAoOyd.js} +1 -1
  37. package/dist/{src-DXdsMc_Z.js → src-nkgFDl-g.js} +246 -207
  38. package/package.json +1 -1
  39. package/dist/plot-width--OgdohB5.js +0 -18
@@ -1,69 +1,69 @@
1
- import { c as e } from "../src-DXdsMc_Z.js";
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-Ccr2NJ6J.js";
4
- import { t as a } from "../use-scroll-tab-index-Dxpdh4W7.js";
5
- import { a as o, n as s, r as c, t as l } from "../chart-frame-C0UBu4ku.js";
6
- import * as u from "@stylexjs/stylex";
7
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
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 p = 100;
10
- function m({ domain: e, palette: t }) {
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 h(e, t) {
13
+ function m(e, t) {
14
14
  return e >= t[0] && e <= t[1];
15
15
  }
16
- function g(n, { domain: r, palette: i }) {
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) * p;
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]) * p;
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
- }, v = { sample: (e) => [
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
- ] }, y = 20;
36
- function b({ label: e, domain: t, palette: n, formatValue: r }) {
37
- let i = m({
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__ */ d("p", {
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 / y);
47
- return /* @__PURE__ */ f("div", {
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__ */ f("span", { children: [e, n === "diverging" && ` · Neutral: ${r(0)}`] }),
52
- /* @__PURE__ */ d("div", {
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__ */ d("span", { ...u.props(v.sample(g(e, {
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__ */ f("div", {
60
+ /* @__PURE__ */ d("div", {
61
61
  "aria-hidden": !0,
62
62
  className: "x78zum5 x1qughib x1n8ia3y xss6m8b",
63
- children: [/* @__PURE__ */ d("span", {
63
+ children: [/* @__PURE__ */ u("span", {
64
64
  className: "xeuugli",
65
65
  children: r(t[0])
66
- }), /* @__PURE__ */ d("span", {
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 x = {
75
+ var b = {
76
76
  kKwaWg: "x1e87kdn",
77
77
  $$css: !0
78
- }, S = {
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) => [x, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${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
- }, C = {
129
+ }, S = {
130
130
  value: void 0,
131
- masked: S.masked,
132
- missing: S.missing
133
- }, w = 4096, T = 6;
134
- function E({ title: e, report: t, description: n, rows: r, columns: u, cells: p, domain: m, palette: g, valueLabel: _, formatValue: v, selection: y, emptyLabel: x }) {
135
- let S = a(), C = A({
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: u,
138
- cells: p,
139
- domain: m,
140
- palette: g
144
+ columns: l,
145
+ cells: f,
146
+ domain: p,
147
+ palette: h
141
148
  });
142
- if (C !== null) return /* @__PURE__ */ d(i, {
149
+ if (S !== null) return /* @__PURE__ */ u(i, {
143
150
  title: e,
144
151
  report: t,
145
152
  description: n,
146
- message: C
153
+ message: S
147
154
  });
148
- let w = /* @__PURE__ */ new Map();
149
- for (let e of p) {
150
- let t = w.get(e.rowId) ?? /* @__PURE__ */ new Map();
151
- t.set(e.columnId, e), w.set(e.rowId, t);
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
- let E = p.find((e) => e.id === y?.selectedId), O = r.find((e) => e.id === E?.rowId), j = u.find((e) => e.id === E?.columnId), M = E === void 0 ? void 0 : `${O?.label ?? E.rowId} → ${j?.label ?? E.columnId}: ${k(E, m, v)}`;
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__ */ f("div", {
164
+ footer: /* @__PURE__ */ d("div", {
159
165
  className: "xrvj5dj x1n8ia3y",
160
166
  children: [
161
- /* @__PURE__ */ d(b, {
162
- label: _,
163
- domain: m,
164
- palette: g,
165
- formatValue: v
167
+ /* @__PURE__ */ u(y, {
168
+ label: g,
169
+ domain: p,
170
+ palette: h,
171
+ formatValue: _
166
172
  }),
167
- /* @__PURE__ */ f("ul", {
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
- p.some((e) => e.kind === "masked") && /* @__PURE__ */ d("li", { children: "× Masked" }),
172
- p.some((e) => e.kind === "missing") && /* @__PURE__ */ d("li", { children: "— Missing" }),
173
- p.length < r.length * u.length && /* @__PURE__ */ d("li", { children: "· Not supplied" }),
174
- p.some((e) => e.kind === "value" && !h(e.value, m)) && /* @__PURE__ */ d("li", { children: "! Outside domain" }),
175
- p.some((e) => e.kind === "value" && v(e.value).length > T) && /* @__PURE__ */ d("li", { children: "• See exact values in View data" })
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
- y !== void 0 && /* @__PURE__ */ d(o, { children: M ?? "Select a cell to inspect its value." }),
179
- r.length > 0 && u.length > 0 && /* @__PURE__ */ d(l, { children: /* @__PURE__ */ d("ul", {
180
- className: "xe8uvvx x1ghz6dp x1717udv",
181
- children: r.flatMap((e) => u.map((t) => {
182
- let n = w.get(e.id)?.get(t.id), r = `${e.label} → ${t.label}`, i = k(n, m, v);
183
- return /* @__PURE__ */ d("li", { children: /* @__PURE__ */ f(s, {
184
- label: `${r}: ${i}`,
185
- isSelected: n !== void 0 && y?.selectedId === n.id,
186
- onSelect: n === void 0 || y === void 0 ? void 0 : () => y.onSelect(n.id),
187
- children: [/* @__PURE__ */ d("span", { children: r }), /* @__PURE__ */ d("span", { children: i })]
188
- }) }, JSON.stringify([e.id, t.id]));
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 || u.length === 0 ? /* @__PURE__ */ d("p", {
204
+ children: r.length === 0 || l.length === 0 ? /* @__PURE__ */ u("p", {
194
205
  className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
195
- children: x
196
- }) : /* @__PURE__ */ d("div", {
197
- ref: S.ref,
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__ */ f("table", {
210
+ children: /* @__PURE__ */ d("table", {
203
211
  className: "x1vathgz x1jkpq5q xezivpi x1hz01jw",
204
- children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("th", {
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
- }), u.map((e) => /* @__PURE__ */ d("th", {
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__ */ d("span", {
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__ */ d("tbody", { children: r.map((e) => /* @__PURE__ */ f("tr", { children: [/* @__PURE__ */ d("th", {
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__ */ d("span", {
227
+ children: /* @__PURE__ */ u("span", {
220
228
  className: "x1lliihq x18qnofl xb3r6kr xlyipyv xx67isq",
221
229
  children: e.label
222
230
  })
223
- }), u.map((t) => {
224
- let n = w.get(e.id)?.get(t.id);
225
- return /* @__PURE__ */ d("td", {
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__ */ d(D, {
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: m,
231
- palette: g,
232
- formatValue: v,
233
- selection: y
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 D({ cell: e, label: t, domain: n, palette: r, formatValue: i, selection: a }) {
242
- if (e === void 0) return /* @__PURE__ */ d("span", {
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": `${t}: not supplied`,
245
- title: `${t}: not supplied`,
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 o = e.kind === "value" && !h(e.value, n), s = k(e, n, i), c = `${t}: ${s}`, l = e.kind === "value" && !o ? g(e.value, {
250
- domain: n,
251
- palette: r
252
- }) : void 0, f = u.props(S.value, C[e.kind], l !== void 0 && S.measured(l), o && S.missing, a !== void 0 && S.interactive, a?.selectedId === e.id && S.selected), p = O(e, s, o), m = e.kind === "value" ? /* @__PURE__ */ d("span", {
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: p
255
- }) : p;
256
- return a === void 0 ? /* @__PURE__ */ d("span", {
266
+ children: g
267
+ }) : g;
268
+ return o === void 0 ? /* @__PURE__ */ u("span", {
257
269
  role: "img",
258
- "aria-label": c,
259
- title: c,
260
- ...f,
261
- children: m
262
- }) : /* @__PURE__ */ d("button", {
270
+ "aria-label": d,
271
+ title: d,
272
+ ...p,
273
+ children: _
274
+ }) : /* @__PURE__ */ u("button", {
263
275
  type: "button",
264
- "aria-label": c,
265
- title: c,
266
- "aria-pressed": a.selectedId === e.id,
267
- onClick: () => a.onSelect(e.id),
268
- ...f,
269
- children: m
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 O(e, t, n) {
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 <= T ? t : e.value === 0 ? "0" : "•";
289
+ case "value": return n ? "!" : t.length <= w ? t : e.value === 0 ? "0" : "•";
277
290
  }
278
291
  }
279
- function k(e, t, n) {
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)}${h(e.value, t) ? "" : " (outside domain)"}`;
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 A({ rows: e, columns: t, cells: r, domain: i, palette: a }) {
288
- let o = m({
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 ${w}-cell render limit. Supply a smaller, labelled window.`;
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 j = {
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
- }, M = 2048;
353
- function N({ title: e, report: t, description: n, tokens: r, domain: a, palette: p, valueLabel: m, formatValue: _, selection: v, emptyLabel: y }) {
354
- let x = F({
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: a,
376
+ domain: f,
357
377
  palette: p
358
378
  });
359
- if (x !== null) return /* @__PURE__ */ d(i, {
379
+ return C === null ? /* @__PURE__ */ d(c, {
360
380
  title: e,
361
381
  report: t,
362
382
  description: n,
363
- message: x
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__ */ d(b, {
373
- label: m,
374
- domain: a,
385
+ children: [/* @__PURE__ */ u(y, {
386
+ label: g,
387
+ domain: f,
375
388
  palette: p,
376
389
  formatValue: _
377
- }), v !== void 0 && r.length > 0 && /* @__PURE__ */ d(o, { children: S === void 0 ? "Select a token to inspect its exact text and score." : `Token ${S.index}, ${JSON.stringify(S.text)}, ${m}: ${P(S, a, _)}` })]
390
+ }), /* @__PURE__ */ u(s, {
391
+ id: S.id,
392
+ children: S.label ?? "\xA0"
393
+ })]
378
394
  }),
379
- children: [r.length === 0 ? /* @__PURE__ */ d("p", {
395
+ children: [r.length === 0 ? /* @__PURE__ */ u("p", {
380
396
  className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
381
- children: y
382
- }) : /* @__PURE__ */ d("p", {
383
- "aria-label": `${e} token text`,
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 && !h(e.score, a), n = `Token ${e.index}, ${JSON.stringify(e.text)}, ${m}: ${P(e, a, _)}`, r = u.props(j.token, e.score === null || t ? j.missing : j.color(g(e.score, {
387
- domain: a,
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 && j.interactive, v?.selectedId === e.id && j.selected);
390
- return v === void 0 ? /* @__PURE__ */ d("span", {
391
- title: n,
392
- ...r,
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__ */ d("button", {
411
+ }, e.id) : /* @__PURE__ */ u("button", {
395
412
  type: "button",
396
- "aria-label": n,
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
- ...r,
418
+ ...i,
400
419
  children: e.text
401
420
  }, e.id);
402
421
  })
403
- }), r.length > 0 && /* @__PURE__ */ d(l, {
404
- label: "Token values",
405
- children: /* @__PURE__ */ f("table", {
406
- className: "xh8yej3 x1mwwwfo x1yc453h xy8obcc xas2l8k",
407
- children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ f("tr", { children: [
408
- /* @__PURE__ */ d("th", {
409
- scope: "col",
410
- className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
411
- children: "Index"
412
- }),
413
- /* @__PURE__ */ d("th", {
414
- scope: "col",
415
- className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
416
- children: "Exact text"
417
- }),
418
- /* @__PURE__ */ d("th", {
419
- scope: "col",
420
- className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi",
421
- children: m
422
- })
423
- ] }) }), /* @__PURE__ */ d("tbody", { children: r.map((e) => /* @__PURE__ */ f("tr", { children: [
424
- /* @__PURE__ */ d("td", {
425
- className: "x1hmw7ec x5g2kb4 xso031l x1q0q8m5 x1qndepd x1yc453h xj57cvi x1df8dnd",
426
- children: /* @__PURE__ */ d(s, {
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 P(e, t, n) {
447
- return e.score === null ? "Unavailable" : `${n(e.score)}${h(e.score, t) ? "" : " (outside domain)"}`;
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 F({ tokens: e, domain: t, palette: r }) {
450
- let i = m({
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 ${M}-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) => {
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 { b as ColorLegend, M as MAX_HEATMAP_TOKENS, w as MAX_MATRIX_CELLS, E as Matrix, N as TokenHeatmap };
467
+ export { y as ColorLegend, j as MAX_HEATMAP_TOKENS, C as MAX_MATRIX_CELLS, T as Matrix, M as TokenHeatmap };
@@ -1,6 +1,6 @@
1
1
  import { c as e } from "../src-C-Sx37kz.js";
2
- import { r as t } from "../chart-frame-C0UBu4ku.js";
3
- import { n, t as r } from "../chart-input-Ccr2NJ6J.js";
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 { i as e, o as t, r as n } from "./chart-frame-C0UBu4ku.js";
2
- import { c as r } from "./src-DXdsMc_Z.js";
3
- export { n as ChartFrame, e as ChartLegend, t as ChartSeriesMarker, r as chartToneColors };
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 };