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