@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,31 +1,32 @@
1
- import { c as e } from "../src-DXdsMc_Z.js";
2
- import { a as t, n, r, t as i } from "../chart-frame-C0UBu4ku.js";
3
- import { n as a, r as o, t as s } from "../chart-input-Ccr2NJ6J.js";
4
- import { t as c } from "../plot-width--OgdohB5.js";
5
- import * as l from "@stylexjs/stylex";
6
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
7
- import { scaleLinear as p } from "@visx/scale";
8
- import { Bar as m } from "@visx/shape";
1
+ import { c as e } from "../src-nkgFDl-g.js";
2
+ import { n as t, t as n } from "../chart-navigation-CBIeNtJq.js";
3
+ import { i as r, n as i, t as a } from "../chart-frame-CJFnI39T.js";
4
+ import { n as o, r as s, t as c } from "../chart-input-DwAobO8Y.js";
5
+ import { n as l, t as u } from "../plot-width-BQQS-mw9.js";
6
+ import * as d from "@stylexjs/stylex";
7
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
8
+ import { scaleLinear as h } from "@visx/scale";
9
+ import { Bar as g } from "@visx/shape";
9
10
  // packages/charts/src/distribution/distribution-input.ts
10
- var h = {
11
+ var _ = {
11
12
  bins: 200,
12
13
  cumulativePoints: 2e3,
13
14
  rows: 200
14
15
  };
15
- function g({ items: e, domain: t, maxEntries: n }) {
16
- if (!o(t)) return "The chart domain must contain two finite, increasing values.";
17
- if (!a(e)) return "Chart records must have unique identifiers.";
16
+ function v({ items: e, domain: t, maxEntries: n }) {
17
+ if (!s(t)) return "The chart domain must contain two finite, increasing values.";
18
+ if (!o(e)) return "Chart records must have unique identifiers.";
18
19
  if (e.length > n) return `This chart supports at most ${n} records. Supply an explicit data window or aggregation.`;
19
20
  }
20
- function _(e, t) {
21
+ function y(e, t) {
21
22
  return !Number.isFinite(e) || e < t[0] || e > t[1];
22
23
  }
23
24
  // packages/charts/src/distribution/distribution-plot.tsx
24
- var v = { height: 160 }, y = [
25
+ var b = { height: 160 }, x = [
25
26
  0,
26
27
  .5,
27
28
  1
28
- ], b = {
29
+ ], S = {
29
30
  plot: {
30
31
  k7Eaqz: "xeuugli",
31
32
  k1xSpc: "xrvj5dj",
@@ -182,150 +183,171 @@ var v = { height: 160 }, y = [
182
183
  $$css: !0
183
184
  }
184
185
  };
185
- function x({ xDomain: e, yDomain: t, xLabel: n, yLabel: r, formatX: i, formatY: a, children: o }) {
186
- let { ref: s, width: l } = c(), u = y.map((t) => e[0] + t * (e[1] - e[0])), p = y.map((e) => t[1] - e * (t[1] - t[0]));
187
- return /* @__PURE__ */ f("div", {
186
+ function C({ navigation: e, onInspectValue: t, xDomain: n, yDomain: r, xLabel: i, yLabel: a, formatX: o, formatY: s, children: c }) {
187
+ let { ref: l, width: d } = u(), f = x.map((e) => n[0] + e * (n[1] - n[0])), h = x.map((e) => r[1] - e * (r[1] - r[0]));
188
+ return /* @__PURE__ */ m("div", {
188
189
  className: "xeuugli xrvj5dj x37z1gs x1hnptsi",
189
190
  children: [
190
- /* @__PURE__ */ f("div", {
191
+ /* @__PURE__ */ m("div", {
191
192
  className: "x1osaytk x78zum5 x1qughib x1n8ia3y",
192
- children: [/* @__PURE__ */ d("span", {
193
+ children: [/* @__PURE__ */ p("span", {
193
194
  className: "x153jb6y xy8obcc xas2l8k xj0a0fe",
194
- children: r
195
- }), /* @__PURE__ */ d("span", {
195
+ children: a
196
+ }), /* @__PURE__ */ p("span", {
196
197
  className: "x153jb6y xy8obcc xas2l8k xj0a0fe",
197
- children: n
198
+ children: i
198
199
  })]
199
200
  }),
200
- /* @__PURE__ */ d("div", {
201
+ /* @__PURE__ */ p("div", {
201
202
  "aria-hidden": !0,
202
203
  className: "x1ymw6g x78zum5 xdt5ytf x1qughib xp4054r x153jb6y xy8obcc xas2l8k xss6m8b x2aouup xj0a0fe",
203
- children: p.map((e) => /* @__PURE__ */ d("span", { children: a(e) }, e))
204
+ children: h.map((e) => /* @__PURE__ */ p("span", { children: s(e) }, e))
204
205
  }),
205
- /* @__PURE__ */ d("div", {
206
- ref: s,
206
+ /* @__PURE__ */ p("div", {
207
+ ref: l,
208
+ ...e,
207
209
  className: "xeuugli",
208
- children: /* @__PURE__ */ f("svg", {
210
+ children: /* @__PURE__ */ m("svg", {
209
211
  "aria-hidden": !0,
210
- viewBox: `0 0 ${l} ${v.height}`,
212
+ onPointerMove: (e) => {
213
+ let r = e.currentTarget.getBoundingClientRect();
214
+ t?.(n[0] + (e.clientX - r.left) / r.width * (n[1] - n[0]));
215
+ },
216
+ onPointerDown: (e) => {
217
+ let r = e.currentTarget.getBoundingClientRect();
218
+ t?.(n[0] + (e.clientX - r.left) / r.width * (n[1] - n[0]));
219
+ },
220
+ viewBox: `0 0 ${d} ${b.height}`,
211
221
  preserveAspectRatio: "none",
212
222
  className: "x1lliihq xh8yej3 x1ymw6g xb3r6kr",
213
- children: [y.map((e) => /* @__PURE__ */ d("line", {
223
+ children: [x.map((e) => /* @__PURE__ */ p("line", {
214
224
  x1: 0,
215
- x2: l,
216
- y1: v.height * e,
217
- y2: v.height * e,
225
+ x2: d,
226
+ y1: b.height * e,
227
+ y2: b.height * e,
218
228
  className: "x13hfdr1 x1ntoi03 x13efnbd"
219
- }, e)), o(l)]
229
+ }, e)), c(d)]
220
230
  })
221
231
  }),
222
- /* @__PURE__ */ d("span", {}),
223
- /* @__PURE__ */ d("div", {
232
+ /* @__PURE__ */ p("span", {}),
233
+ /* @__PURE__ */ p("div", {
224
234
  "aria-hidden": !0,
225
235
  className: "x78zum5 x1qughib x1hnptsi x153jb6y xy8obcc xas2l8k xss6m8b",
226
- children: u.map((e, t) => /* @__PURE__ */ d("span", {
236
+ children: f.map((e, t) => /* @__PURE__ */ p("span", {
227
237
  ...{
228
238
  0: { className: "x1cqoux5 xeuugli xj0a0fe" },
229
239
  2: { className: "x1cqoux5 xeuugli xj0a0fe x2b8uid" },
230
240
  1: { className: "x1cqoux5 xeuugli xj0a0fe xp4054r" },
231
241
  3: { className: "x1cqoux5 xeuugli xj0a0fe xp4054r" }
232
242
  }[(t === 1) << 1 | t === 2],
233
- children: i(e)
243
+ children: o(e)
234
244
  }, e))
235
245
  })
236
246
  ]
237
247
  });
238
248
  }
239
- function S({ domain: e, formatValue: t }) {
240
- return /* @__PURE__ */ f("div", {
249
+ function w({ domain: e, formatValue: t }) {
250
+ return /* @__PURE__ */ m("div", {
241
251
  className: "x78zum5 x1qughib x1hnptsi x153jb6y xy8obcc xas2l8k xss6m8b",
242
- children: [/* @__PURE__ */ d("span", {
252
+ children: [/* @__PURE__ */ p("span", {
243
253
  className: "x1cqoux5 xeuugli xj0a0fe",
244
254
  children: t(e[0])
245
- }), /* @__PURE__ */ d("span", {
255
+ }), /* @__PURE__ */ p("span", {
246
256
  className: "x1cqoux5 xeuugli xj0a0fe xp4054r",
247
257
  children: t(e[1])
248
258
  })]
249
259
  });
250
260
  }
251
261
  // packages/charts/src/distribution/ecdf.tsx
252
- function C({ title: a, report: o, description: c, points: m, domain: h, valueLabel: g, probabilityLabel: _, formatValue: y, formatProbability: S, tone: C = "series1", selection: T, emptyLabel: E = "No cumulative distribution points are available." }) {
253
- let D = w({
254
- points: m,
255
- domain: h
262
+ function T({ title: a, report: o, description: s, points: l, domain: u, valueLabel: g, probabilityLabel: _, formatValue: v, formatProbability: y, tone: x = "series1", selection: w, emptyLabel: T = "No cumulative distribution points are available." }) {
263
+ let D = l.map((e) => ({
264
+ id: e.id,
265
+ label: `${g}: ${v(e.value)}, ${_}: ${e.probability === null ? "Unavailable" : y(e.probability)}`
266
+ })), O = n({
267
+ title: a,
268
+ items: D,
269
+ selection: w
270
+ }), k = E({
271
+ points: l,
272
+ domain: u
256
273
  });
257
- if (D !== void 0) return /* @__PURE__ */ d(s, {
274
+ if (k !== void 0) return /* @__PURE__ */ p(c, {
258
275
  title: a,
259
276
  report: o,
260
- description: c,
261
- message: D
277
+ description: s,
278
+ message: k
262
279
  });
263
- let O = p({
280
+ let A = h({
264
281
  domain: [0, 1],
265
- range: [v.height, 0]
266
- }), k = m.find((e) => e.id === T?.selectedId);
267
- return /* @__PURE__ */ d(r, {
282
+ range: [b.height, 0]
283
+ });
284
+ return /* @__PURE__ */ p(i, {
268
285
  title: a,
269
286
  report: o,
270
- description: c,
271
- footer: T !== void 0 && m.length > 0 ? /* @__PURE__ */ d(t, { children: k === void 0 ? "Select a point in View data to inspect its probability." : `${g}: ${y(k.value)}, ${_}: ${k.probability === null ? "Unavailable" : S(k.probability)}` }) : void 0,
272
- children: m.length === 0 ? /* @__PURE__ */ d("p", {
273
- ...l.props(b.empty),
274
- children: E
275
- }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(x, {
276
- xDomain: h,
287
+ description: s,
288
+ footer: /* @__PURE__ */ p(r, {
289
+ id: O.id,
290
+ children: O.label ?? "\xA0"
291
+ }),
292
+ children: l.length === 0 ? /* @__PURE__ */ p("p", {
293
+ ...d.props(S.empty),
294
+ children: T
295
+ }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(C, {
296
+ navigation: O.props,
297
+ onInspectValue: (e) => {
298
+ let t = { point: l[0] };
299
+ for (let n of l) (t.point === void 0 || Math.abs(n.value - e) < Math.abs(t.point.value - e)) && (t.point = n);
300
+ let n = t.point;
301
+ n !== void 0 && O.inspect(n.id);
302
+ },
303
+ xDomain: u,
277
304
  yDomain: [0, 1],
278
305
  xLabel: g,
279
306
  yLabel: _,
280
- formatX: y,
281
- formatY: S,
307
+ formatX: v,
308
+ formatY: y,
282
309
  children: (t) => {
283
- let n = p({
284
- domain: [...h],
310
+ let n = h({
311
+ domain: [...u],
285
312
  range: [0, t]
286
- }), r = m.map((e, t) => {
313
+ }), r = l.map((e, t) => {
287
314
  if (e.probability === null) return "";
288
- let r = n(e.value), i = O(e.probability), a = m[t - 1];
315
+ let r = n(e.value), i = A(e.probability), a = l[t - 1];
289
316
  return a === void 0 || a.probability === null ? `M ${r} ${i}` : `H ${r} V ${i}`;
290
317
  }).join(" ");
291
- return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d("path", {
318
+ return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("path", {
292
319
  d: r,
293
320
  fill: "none",
294
- stroke: e[C],
321
+ stroke: e[x],
295
322
  strokeWidth: 2,
296
323
  vectorEffect: "non-scaling-stroke"
297
- }), m.map((t) => t.probability === null ? null : /* @__PURE__ */ d("circle", {
324
+ }), l.map((t) => t.probability === null ? null : /* @__PURE__ */ p("circle", {
325
+ onPointerEnter: () => O.inspect(t.id),
326
+ onClick: () => w?.onSelect(t.id),
298
327
  cx: n(t.value),
299
- cy: O(t.probability),
300
- r: T?.selectedId === t.id ? 4 : 2,
301
- fill: e[C]
328
+ cy: A(t.probability),
329
+ r: w?.selectedId === t.id || O.label !== void 0 && O.activeId === t.id ? 4 : 2,
330
+ fill: e[x]
302
331
  }, t.id))] });
303
332
  }
304
- }), /* @__PURE__ */ d(i, { children: /* @__PURE__ */ d("div", {
305
- ...l.props(b.values),
306
- children: m.map((e) => {
307
- let t = y(e.value), r = e.probability === null ? "Unavailable" : S(e.probability);
308
- return /* @__PURE__ */ d(n, {
309
- label: `${g}: ${t}, ${_}: ${r}`,
310
- isSelected: T?.selectedId === e.id,
311
- onSelect: T === void 0 ? void 0 : () => T.onSelect(e.id),
312
- children: /* @__PURE__ */ f("span", {
313
- ...l.props(b.value),
314
- children: [/* @__PURE__ */ d("span", { children: t }), /* @__PURE__ */ d("span", {
315
- ...l.props(b.summary),
316
- children: r
317
- })]
318
- })
319
- }, e.id);
320
- })
321
- }) })] })
333
+ }), /* @__PURE__ */ p(t, {
334
+ label: `${a} observations`,
335
+ columns: [{
336
+ id: "observation",
337
+ label: "Observation"
338
+ }],
339
+ rows: D.map((e) => ({
340
+ id: e.id,
341
+ values: [e.label]
342
+ }))
343
+ })] })
322
344
  });
323
345
  }
324
- function w({ points: e, domain: t }) {
325
- let n = g({
346
+ function E({ points: e, domain: t }) {
347
+ let n = v({
326
348
  items: e,
327
349
  domain: t,
328
- maxEntries: h.cumulativePoints
350
+ maxEntries: _.cumulativePoints
329
351
  });
330
352
  if (n !== void 0) return n;
331
353
  let r = {
@@ -333,7 +355,7 @@ function w({ points: e, domain: t }) {
333
355
  probability: 0
334
356
  };
335
357
  for (let n of e) {
336
- if (_(n.value, t) || n.value < r.value) return `Cumulative point ${n.id} is non-finite, outside the domain, or out of order.`;
358
+ if (y(n.value, t) || n.value < r.value) return `Cumulative point ${n.id} is non-finite, outside the domain, or out of order.`;
337
359
  if (n.probability !== null) {
338
360
  if (!Number.isFinite(n.probability) || n.probability < r.probability || n.probability > 1) return `Cumulative point ${n.id} must have a probability from zero to one that does not decrease.`;
339
361
  r.probability = n.probability;
@@ -342,202 +364,211 @@ function w({ points: e, domain: t }) {
342
364
  }
343
365
  }
344
366
  // packages/charts/src/distribution/histogram.tsx
345
- function T({ title: a, report: o, description: c, bins: h, domain: g, maximumCount: _, valueLabel: y, countLabel: S, formatValue: C, formatCount: w, tone: T = "series1", selection: D, emptyLabel: O = "No histogram bins are available." }) {
346
- let k = E({
347
- bins: h,
348
- domain: g,
349
- maximumCount: _
367
+ function D({ title: a, report: o, description: s, bins: u, domain: _, maximumCount: v, valueLabel: y, countLabel: x, formatValue: w, formatCount: T, tone: E = "series1", selection: D, emptyLabel: k = "No histogram bins are available." }) {
368
+ let A = u.map((e) => ({
369
+ id: e.id,
370
+ label: `${e.label}, ${w(e.lowerBound)} – ${w(e.upperBound)}, ${x}: ${e.count === null ? "Unavailable" : T(e.count)}`
371
+ })), j = n({
372
+ title: a,
373
+ items: A,
374
+ selection: D
375
+ }), M = O({
376
+ bins: u,
377
+ domain: _,
378
+ maximumCount: v
350
379
  });
351
- if (k !== void 0) return /* @__PURE__ */ d(s, {
380
+ if (M !== void 0) return /* @__PURE__ */ p(c, {
352
381
  title: a,
353
382
  report: o,
354
- description: c,
355
- message: k
383
+ description: s,
384
+ message: M
385
+ });
386
+ let N = h({
387
+ domain: [0, v],
388
+ range: [b.height, 0]
356
389
  });
357
- let A = p({
358
- domain: [0, _],
359
- range: [v.height, 0]
360
- }), j = h.find((e) => e.id === D?.selectedId);
361
- return /* @__PURE__ */ d(r, {
390
+ return /* @__PURE__ */ p(i, {
362
391
  title: a,
363
392
  report: o,
364
- description: c,
365
- footer: D !== void 0 && h.length > 0 ? /* @__PURE__ */ d(t, { children: j === void 0 ? "Select a bin in View data to inspect its count." : `${j.label}, ${C(j.lowerBound)} – ${C(j.upperBound)}, ${S}: ${j.count === null ? "Unavailable" : w(j.count)}` }) : void 0,
366
- children: h.length === 0 ? /* @__PURE__ */ d("p", {
367
- ...l.props(b.empty),
368
- children: O
369
- }) : /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(x, {
370
- xDomain: g,
371
- yDomain: [0, _],
393
+ description: s,
394
+ footer: /* @__PURE__ */ p(r, {
395
+ id: j.id,
396
+ children: j.label ?? "\xA0"
397
+ }),
398
+ children: u.length === 0 ? /* @__PURE__ */ p("p", {
399
+ ...d.props(S.empty),
400
+ children: k
401
+ }) : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(C, {
402
+ navigation: j.props,
403
+ onInspectValue: (e) => {
404
+ let t = u.find((t) => e >= t.lowerBound && e <= t.upperBound);
405
+ t !== void 0 && j.inspect(t.id);
406
+ },
407
+ xDomain: _,
408
+ yDomain: [0, v],
372
409
  xLabel: y,
373
- yLabel: S,
374
- formatX: C,
375
- formatY: w,
410
+ yLabel: x,
411
+ formatX: w,
412
+ formatY: T,
376
413
  children: (t) => {
377
- let n = p({
378
- domain: [...g],
414
+ let n = h({
415
+ domain: [..._],
379
416
  range: [0, t]
380
417
  });
381
- return h.map((t) => {
382
- let r = n(t.lowerBound), i = n(t.upperBound) - r, a = Math.min(2, i * .2), o = D?.selectedId === t.id;
383
- if (t.count === null) return /* @__PURE__ */ d(m, {
418
+ return u.map((t) => {
419
+ let r = n(t.lowerBound), i = n(t.upperBound) - r, a = Math.min(2, i * .2), o = D?.selectedId === t.id || j.label !== void 0 && j.activeId === t.id;
420
+ if (t.count === null) return /* @__PURE__ */ p(g, {
421
+ onPointerEnter: () => j.inspect(t.id),
422
+ onClick: () => D?.onSelect(t.id),
384
423
  x: r + a / 2,
385
- y: v.height - 6,
424
+ y: b.height - 6,
386
425
  width: i - a,
387
426
  height: 5,
388
- ...l.props(b.missing)
427
+ ...d.props(S.missing)
389
428
  }, t.id);
390
- let s = A(t.count);
391
- return /* @__PURE__ */ d(m, {
429
+ let s = N(t.count);
430
+ return /* @__PURE__ */ p(g, {
431
+ onPointerEnter: () => j.inspect(t.id),
432
+ onClick: () => D?.onSelect(t.id),
392
433
  x: r + a / 2,
393
434
  y: s,
394
435
  width: i - a,
395
- height: v.height - s,
396
- fill: e[T],
436
+ height: b.height - s,
437
+ fill: e[E],
438
+ ...d.props(o && l.selected),
397
439
  opacity: D?.selectedId === void 0 || o ? 1 : .45
398
440
  }, t.id);
399
441
  });
400
442
  }
401
- }), /* @__PURE__ */ d(i, { children: /* @__PURE__ */ d("div", {
402
- ...l.props(b.values),
403
- children: h.map((e) => {
404
- let t = e.count === null ? "Unavailable" : w(e.count), r = `${C(e.lowerBound)} – ${C(e.upperBound)}`;
405
- return /* @__PURE__ */ d(n, {
406
- label: `${e.label}, ${r}, ${S}: ${t}`,
407
- isSelected: D?.selectedId === e.id,
408
- onSelect: D === void 0 ? void 0 : () => D.onSelect(e.id),
409
- children: /* @__PURE__ */ f("span", {
410
- ...l.props(b.value),
411
- children: [/* @__PURE__ */ f("span", { children: [
412
- e.label,
413
- " · ",
414
- r
415
- ] }), /* @__PURE__ */ d("span", {
416
- ...l.props(b.summary),
417
- children: t
418
- })]
419
- })
420
- }, e.id);
421
- })
422
- }) })] })
443
+ }), /* @__PURE__ */ p(t, {
444
+ label: `${a} observations`,
445
+ columns: [{
446
+ id: "observation",
447
+ label: "Observation"
448
+ }],
449
+ rows: A.map((e) => ({
450
+ id: e.id,
451
+ values: [e.label]
452
+ }))
453
+ })] })
423
454
  });
424
455
  }
425
- function E({ bins: e, domain: t, maximumCount: n }) {
426
- let r = g({
456
+ function O({ bins: e, domain: t, maximumCount: n }) {
457
+ let r = v({
427
458
  items: e,
428
459
  domain: t,
429
- maxEntries: h.bins
460
+ maxEntries: _.bins
430
461
  });
431
462
  if (r !== void 0) return r;
432
463
  if (!Number.isFinite(n) || n <= 0) return "The histogram count domain must have a finite maximum greater than zero.";
433
464
  for (let [r, i] of e.entries()) {
434
- if (_(i.lowerBound, t) || _(i.upperBound, t)) return `Histogram bin ${i.id} has a non-finite bound or lies outside the declared domain.`;
465
+ if (y(i.lowerBound, t) || y(i.upperBound, t)) return `Histogram bin ${i.id} has a non-finite bound or lies outside the declared domain.`;
435
466
  let a = e[r - 1];
436
467
  if (i.lowerBound >= i.upperBound || a !== void 0 && i.lowerBound < a.upperBound) return `Histogram bin ${i.id} is reversed, overlaps another bin, or is out of order.`;
437
468
  if (i.count !== null && (!Number.isFinite(i.count) || i.count < 0 || i.count > n)) return `Histogram bin ${i.id} has a count outside the declared count domain.`;
438
469
  }
439
470
  }
440
471
  // packages/charts/src/distribution/interval-plot.tsx
441
- function D({ title: t, report: i, description: a, items: o, domain: u, valueLabel: m, intervalLabel: h, formatValue: g, selection: _, emptyLabel: v = "No interval estimates are available." }) {
442
- let { ref: y, width: x } = c(), C = O({
472
+ function k({ title: t, report: n, description: r, items: o, domain: s, valueLabel: l, intervalLabel: f, formatValue: g, selection: _, emptyLabel: v = "No interval estimates are available." }) {
473
+ let { ref: y, width: b } = u(), x = A({
443
474
  items: o,
444
- domain: u
475
+ domain: s
445
476
  });
446
- if (C !== void 0) return /* @__PURE__ */ d(s, {
477
+ if (x !== void 0) return /* @__PURE__ */ p(c, {
447
478
  title: t,
448
- report: i,
449
- description: a,
450
- message: C
479
+ report: n,
480
+ description: r,
481
+ message: x
451
482
  });
452
- let w = p({
453
- domain: [...u],
454
- range: [0, x]
483
+ let C = h({
484
+ domain: [...s],
485
+ range: [0, b]
455
486
  });
456
- return /* @__PURE__ */ d(r, {
487
+ return /* @__PURE__ */ p(i, {
457
488
  title: t,
458
- report: i,
459
- description: a,
460
- footer: `${m} · ${h}`,
461
- children: o.length === 0 ? /* @__PURE__ */ d("p", {
462
- ...l.props(b.empty),
489
+ report: n,
490
+ description: r,
491
+ footer: `${l} · ${f}`,
492
+ children: o.length === 0 ? /* @__PURE__ */ p("p", {
493
+ ...d.props(S.empty),
463
494
  children: v
464
- }) : /* @__PURE__ */ f("div", {
465
- ...l.props(b.values),
495
+ }) : /* @__PURE__ */ m("div", {
496
+ ...d.props(S.values),
466
497
  children: [o.map((t) => {
467
- let r = t.estimate === null ? "Estimate unavailable" : g(t.estimate), i = `${h}: ${t.lower === null ? "Unavailable" : g(t.lower)} – ${t.upper === null ? "Unavailable" : g(t.upper)}`, a = e[t.tone ?? "series1"];
468
- return /* @__PURE__ */ d(n, {
469
- label: `${t.label}, ${m}: ${r}, ${i}`,
498
+ let n = t.estimate === null ? "Estimate unavailable" : g(t.estimate), r = `${f}: ${t.lower === null ? "Unavailable" : g(t.lower)} – ${t.upper === null ? "Unavailable" : g(t.upper)}`, i = e[t.tone ?? "series1"];
499
+ return /* @__PURE__ */ p(a, {
500
+ label: `${t.label}, ${l}: ${n}, ${r}`,
470
501
  isSelected: _?.selectedId === t.id,
471
502
  onSelect: _ === void 0 ? void 0 : () => _.onSelect(t.id),
472
- children: /* @__PURE__ */ f("span", {
473
- ...l.props(b.row),
474
- children: [/* @__PURE__ */ f("span", {
475
- ...l.props(b.rowLabel),
503
+ children: /* @__PURE__ */ m("span", {
504
+ ...d.props(S.row),
505
+ children: [/* @__PURE__ */ m("span", {
506
+ ...d.props(S.rowLabel),
476
507
  children: [
477
- /* @__PURE__ */ d("span", { children: t.label }),
478
- /* @__PURE__ */ d("span", {
479
- ...l.props(b.rowValue),
480
- children: r
508
+ /* @__PURE__ */ p("span", { children: t.label }),
509
+ /* @__PURE__ */ p("span", {
510
+ ...d.props(S.rowValue),
511
+ children: n
481
512
  }),
482
- /* @__PURE__ */ d("span", {
483
- ...l.props(b.label),
484
- children: i
513
+ /* @__PURE__ */ p("span", {
514
+ ...d.props(S.label),
515
+ children: r
485
516
  })
486
517
  ]
487
- }), /* @__PURE__ */ f("svg", {
518
+ }), /* @__PURE__ */ m("svg", {
488
519
  "aria-hidden": !0,
489
- viewBox: `0 0 ${x} 28`,
520
+ viewBox: `0 0 ${b} 28`,
490
521
  preserveAspectRatio: "none",
491
- ...l.props(b.rowSvg),
522
+ ...d.props(S.rowSvg),
492
523
  children: [
493
- /* @__PURE__ */ d("line", {
524
+ /* @__PURE__ */ p("line", {
494
525
  x1: 0,
495
- x2: x,
526
+ x2: b,
496
527
  y1: 14,
497
528
  y2: 14,
498
- ...l.props(b.baseline)
529
+ ...d.props(S.baseline)
499
530
  }),
500
- t.lower !== null && t.upper !== null && /* @__PURE__ */ f("g", {
501
- stroke: a,
531
+ t.lower !== null && t.upper !== null && /* @__PURE__ */ m("g", {
532
+ stroke: i,
502
533
  strokeWidth: 2,
503
534
  vectorEffect: "non-scaling-stroke",
504
535
  children: [
505
- /* @__PURE__ */ d("line", {
506
- x1: w(t.lower),
507
- x2: w(t.upper),
536
+ /* @__PURE__ */ p("line", {
537
+ x1: C(t.lower),
538
+ x2: C(t.upper),
508
539
  y1: 14,
509
540
  y2: 14
510
541
  }),
511
- /* @__PURE__ */ d("line", {
512
- x1: w(t.lower),
513
- x2: w(t.lower),
542
+ /* @__PURE__ */ p("line", {
543
+ x1: C(t.lower),
544
+ x2: C(t.lower),
514
545
  y1: 9,
515
546
  y2: 19
516
547
  }),
517
- /* @__PURE__ */ d("line", {
518
- x1: w(t.upper),
519
- x2: w(t.upper),
548
+ /* @__PURE__ */ p("line", {
549
+ x1: C(t.upper),
550
+ x2: C(t.upper),
520
551
  y1: 9,
521
552
  y2: 19
522
553
  })
523
554
  ]
524
555
  }),
525
- t.estimate !== null && /* @__PURE__ */ d("circle", {
526
- cx: w(t.estimate),
556
+ t.estimate !== null && /* @__PURE__ */ p("circle", {
557
+ cx: C(t.estimate),
527
558
  cy: 14,
528
559
  r: 4,
529
- fill: a
560
+ fill: i
530
561
  })
531
562
  ]
532
563
  })]
533
564
  })
534
565
  }, t.id);
535
- }), /* @__PURE__ */ f("div", {
536
- ...l.props(b.row, b.rowAxis),
537
- children: [/* @__PURE__ */ d("span", { ...l.props(b.axisSpacer) }), /* @__PURE__ */ d("div", {
566
+ }), /* @__PURE__ */ m("div", {
567
+ ...d.props(S.row, S.rowAxis),
568
+ children: [/* @__PURE__ */ p("span", { ...d.props(S.axisSpacer) }), /* @__PURE__ */ p("div", {
538
569
  ref: y,
539
- children: /* @__PURE__ */ d(S, {
540
- domain: u,
570
+ children: /* @__PURE__ */ p(w, {
571
+ domain: s,
541
572
  formatValue: g
542
573
  })
543
574
  })]
@@ -545,11 +576,11 @@ function D({ title: t, report: i, description: a, items: o, domain: u, valueLabe
545
576
  })
546
577
  });
547
578
  }
548
- function O({ items: e, domain: t }) {
549
- let n = g({
579
+ function A({ items: e, domain: t }) {
580
+ let n = v({
550
581
  items: e,
551
582
  domain: t,
552
- maxEntries: h.rows
583
+ maxEntries: _.rows
553
584
  });
554
585
  if (n !== void 0) return n;
555
586
  for (let n of e) {
@@ -557,7 +588,7 @@ function O({ items: e, domain: t }) {
557
588
  n.lower,
558
589
  n.estimate,
559
590
  n.upper
560
- ].some((e) => e !== null && _(e, t))) return `Interval ${n.id} has a non-finite value or lies outside the declared domain.`;
591
+ ].some((e) => e !== null && y(e, t))) return `Interval ${n.id} has a non-finite value or lies outside the declared domain.`;
561
592
  if (n.lower !== null && n.upper !== null && n.lower > n.upper) return `Interval ${n.id} has reversed endpoints.`;
562
593
  if (n.estimate !== null) {
563
594
  if (n.lower !== null && n.estimate < n.lower) return `Interval ${n.id} has an estimate below its lower endpoint.`;
@@ -566,95 +597,95 @@ function O({ items: e, domain: t }) {
566
597
  }
567
598
  }
568
599
  // packages/charts/src/distribution/ranked-bars.tsx
569
- function k({ title: t, report: i, description: a, items: o, domain: u, valueLabel: h, formatValue: g, selection: _, emptyLabel: v = "No ranked values are available." }) {
570
- let { ref: y, width: x } = c(), C = A({
600
+ function j({ title: t, report: n, description: r, items: o, domain: s, valueLabel: l, formatValue: f, selection: _, emptyLabel: v = "No ranked values are available." }) {
601
+ let { ref: y, width: b } = u(), x = M({
571
602
  items: o,
572
- domain: u
603
+ domain: s
573
604
  });
574
- if (C !== void 0) return /* @__PURE__ */ d(s, {
605
+ if (x !== void 0) return /* @__PURE__ */ p(c, {
575
606
  title: t,
576
- report: i,
577
- description: a,
578
- message: C
607
+ report: n,
608
+ description: r,
609
+ message: x
579
610
  });
580
- let w = p({
581
- domain: [...u],
582
- range: [0, x]
583
- }), T = w(0);
584
- return /* @__PURE__ */ d(r, {
611
+ let C = h({
612
+ domain: [...s],
613
+ range: [0, b]
614
+ }), T = C(0);
615
+ return /* @__PURE__ */ p(i, {
585
616
  title: t,
586
- report: i,
587
- description: a,
588
- footer: h,
589
- children: o.length === 0 ? /* @__PURE__ */ d("p", {
590
- ...l.props(b.empty),
617
+ report: n,
618
+ description: r,
619
+ footer: l,
620
+ children: o.length === 0 ? /* @__PURE__ */ p("p", {
621
+ ...d.props(S.empty),
591
622
  children: v
592
- }) : /* @__PURE__ */ f("div", {
593
- ...l.props(b.values),
623
+ }) : /* @__PURE__ */ m("div", {
624
+ ...d.props(S.values),
594
625
  children: [o.map((t) => {
595
- let r = t.value === null ? "Unavailable" : g(t.value), i = t.rank === void 0 ? t.label : `${t.rank} · ${t.label}`, a = e[t.tone ?? "series1"];
596
- return /* @__PURE__ */ d(n, {
597
- label: `${i}, ${h}: ${r}`,
626
+ let n = t.value === null ? "Unavailable" : f(t.value), r = t.rank === void 0 ? t.label : `${t.rank} · ${t.label}`, i = e[t.tone ?? "series1"];
627
+ return /* @__PURE__ */ p(a, {
628
+ label: `${r}, ${l}: ${n}`,
598
629
  isSelected: _?.selectedId === t.id,
599
630
  onSelect: _ === void 0 ? void 0 : () => _.onSelect(t.id),
600
- children: /* @__PURE__ */ f("span", {
601
- ...l.props(b.row),
602
- children: [/* @__PURE__ */ f("span", {
603
- ...l.props(b.rowLabel),
604
- children: [/* @__PURE__ */ d("span", { children: i }), /* @__PURE__ */ d("span", {
605
- ...l.props(b.rowValue),
606
- children: r
631
+ children: /* @__PURE__ */ m("span", {
632
+ ...d.props(S.row),
633
+ children: [/* @__PURE__ */ m("span", {
634
+ ...d.props(S.rowLabel),
635
+ children: [/* @__PURE__ */ p("span", { children: r }), /* @__PURE__ */ p("span", {
636
+ ...d.props(S.rowValue),
637
+ children: n
607
638
  })]
608
- }), /* @__PURE__ */ f("svg", {
639
+ }), /* @__PURE__ */ m("svg", {
609
640
  "aria-hidden": !0,
610
- viewBox: `0 0 ${x} 28`,
641
+ viewBox: `0 0 ${b} 28`,
611
642
  preserveAspectRatio: "none",
612
- ...l.props(b.rowSvg),
613
- children: [/* @__PURE__ */ d("line", {
643
+ ...d.props(S.rowSvg),
644
+ children: [/* @__PURE__ */ p("line", {
614
645
  x1: T,
615
646
  x2: T,
616
647
  y1: 3,
617
648
  y2: 25,
618
- ...l.props(b.baseline)
619
- }), t.value !== null && (t.value === 0 ? /* @__PURE__ */ d("line", {
649
+ ...d.props(S.baseline)
650
+ }), t.value !== null && (t.value === 0 ? /* @__PURE__ */ p("line", {
620
651
  x1: T,
621
652
  x2: T,
622
653
  y1: 10,
623
654
  y2: 18,
624
- stroke: a,
655
+ stroke: i,
625
656
  strokeWidth: 2,
626
657
  vectorEffect: "non-scaling-stroke"
627
- }) : /* @__PURE__ */ d(m, {
628
- x: Math.min(T, w(t.value)),
658
+ }) : /* @__PURE__ */ p(g, {
659
+ x: Math.min(T, C(t.value)),
629
660
  y: 10,
630
- width: Math.abs(w(t.value) - T),
661
+ width: Math.abs(C(t.value) - T),
631
662
  height: 8,
632
- fill: a
663
+ fill: i
633
664
  }))]
634
665
  })]
635
666
  })
636
667
  }, t.id);
637
- }), /* @__PURE__ */ f("div", {
638
- ...l.props(b.row, b.rowAxis),
639
- children: [/* @__PURE__ */ d("span", { ...l.props(b.axisSpacer) }), /* @__PURE__ */ d("div", {
668
+ }), /* @__PURE__ */ m("div", {
669
+ ...d.props(S.row, S.rowAxis),
670
+ children: [/* @__PURE__ */ p("span", { ...d.props(S.axisSpacer) }), /* @__PURE__ */ p("div", {
640
671
  ref: y,
641
- children: /* @__PURE__ */ d(S, {
642
- domain: u,
643
- formatValue: g
672
+ children: /* @__PURE__ */ p(w, {
673
+ domain: s,
674
+ formatValue: f
644
675
  })
645
676
  })]
646
677
  })]
647
678
  })
648
679
  });
649
680
  }
650
- function A({ items: e, domain: t }) {
651
- let n = g({
681
+ function M({ items: e, domain: t }) {
682
+ let n = v({
652
683
  items: e,
653
684
  domain: t,
654
- maxEntries: h.rows
685
+ maxEntries: _.rows
655
686
  });
656
687
  if (n !== void 0) return n;
657
688
  if (t[0] > 0 || t[1] < 0) return "The ranked-value domain must include zero.";
658
- for (let n of e) if (n.value !== null && _(n.value, t)) return `Ranked value ${n.id} is non-finite or lies outside the declared domain.`;
689
+ for (let n of e) if (n.value !== null && y(n.value, t)) return `Ranked value ${n.id} is non-finite or lies outside the declared domain.`;
659
690
  }
660
- export { C as ECDF, T as Histogram, D as IntervalPlot, k as RankedBars };
691
+ export { T as ECDF, D as Histogram, k as IntervalPlot, j as RankedBars };