@mechane-ai/elements 0.19.0 → 0.20.1

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