@mechane-ai/elements 0.36.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/dist/ai.js +3 -3
- package/dist/{chart-theme-Bwr9YSP1.js → categorical-values-BECG-J6R.js} +4 -54
- package/dist/{chart-frame-C0UBu4ku.js → chart-frame-CJFnI39T.js} +78 -93
- package/dist/{chart-input-Ccr2NJ6J.js → chart-input-DwAobO8Y.js} +2 -2
- package/dist/chart-navigation-CBIeNtJq.js +67 -0
- package/dist/charts/cartesian.js +631 -618
- package/dist/charts/distribution.js +298 -267
- package/dist/charts/graph.js +113 -122
- package/dist/charts/hierarchy.js +12 -12
- package/dist/charts/matrix.js +208 -200
- package/dist/charts/timeline.js +2 -2
- package/dist/charts.js +3 -3
- package/dist/{code-block-DT1TCkTC.js → code-block-aC0Htt4N.js} +33 -32
- package/dist/collections.js +597 -351
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +1 -1
- package/dist/content/markdown.js +1 -1
- package/dist/content.js +1 -1
- package/dist/elements.css +22 -2
- package/dist/feedback.js +1 -1
- package/dist/navigation/commands.js +4 -3
- package/dist/packages/charts/src/chart-data.d.ts +13 -3
- package/dist/packages/charts/src/chart-frame.d.ts +2 -5
- package/dist/packages/charts/src/chart-navigation.d.ts +19 -0
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -2
- package/dist/packages/collections/src/collection-filters.d.ts +20 -0
- package/dist/packages/collections/src/data-table.d.ts +4 -6
- package/dist/packages/collections/src/index.d.ts +4 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +30 -0
- package/dist/packages/feedback/src/index.d.ts +2 -2
- package/dist/packages/feedback/src/notifications.d.ts +35 -0
- package/dist/packages/feedback/src/toast.d.ts +1 -1
- package/dist/packages/navigation/src/commands/command.d.ts +1 -0
- package/dist/plot-width-BQQS-mw9.js +67 -0
- package/dist/{src-D9DktxEq.js → src-DWjAoOyd.js} +1 -1
- package/dist/{src-DXdsMc_Z.js → src-nkgFDl-g.js} +246 -207
- package/package.json +1 -1
- package/dist/plot-width--OgdohB5.js +0 -18
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import { c as e } from "../src-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as c } from "../
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
+
var _ = {
|
|
11
12
|
bins: 200,
|
|
12
13
|
cumulativePoints: 2e3,
|
|
13
14
|
rows: 200
|
|
14
15
|
};
|
|
15
|
-
function
|
|
16
|
-
if (!
|
|
17
|
-
if (!
|
|
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
|
|
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
|
|
25
|
+
var b = { height: 160 }, x = [
|
|
25
26
|
0,
|
|
26
27
|
.5,
|
|
27
28
|
1
|
|
28
|
-
],
|
|
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
|
|
186
|
-
let { ref:
|
|
187
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
191
|
+
/* @__PURE__ */ m("div", {
|
|
191
192
|
className: "x1osaytk x78zum5 x1qughib x1n8ia3y",
|
|
192
|
-
children: [/* @__PURE__ */
|
|
193
|
+
children: [/* @__PURE__ */ p("span", {
|
|
193
194
|
className: "x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
194
|
-
children:
|
|
195
|
-
}), /* @__PURE__ */
|
|
195
|
+
children: a
|
|
196
|
+
}), /* @__PURE__ */ p("span", {
|
|
196
197
|
className: "x153jb6y xy8obcc xas2l8k xj0a0fe",
|
|
197
|
-
children:
|
|
198
|
+
children: i
|
|
198
199
|
})]
|
|
199
200
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
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:
|
|
204
|
+
children: h.map((e) => /* @__PURE__ */ p("span", { children: s(e) }, e))
|
|
204
205
|
}),
|
|
205
|
-
/* @__PURE__ */
|
|
206
|
-
ref:
|
|
206
|
+
/* @__PURE__ */ p("div", {
|
|
207
|
+
ref: l,
|
|
208
|
+
...e,
|
|
207
209
|
className: "xeuugli",
|
|
208
|
-
children: /* @__PURE__ */
|
|
210
|
+
children: /* @__PURE__ */ m("svg", {
|
|
209
211
|
"aria-hidden": !0,
|
|
210
|
-
|
|
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: [
|
|
223
|
+
children: [x.map((e) => /* @__PURE__ */ p("line", {
|
|
214
224
|
x1: 0,
|
|
215
|
-
x2:
|
|
216
|
-
y1:
|
|
217
|
-
y2:
|
|
225
|
+
x2: d,
|
|
226
|
+
y1: b.height * e,
|
|
227
|
+
y2: b.height * e,
|
|
218
228
|
className: "x13hfdr1 x1ntoi03 x13efnbd"
|
|
219
|
-
}, e)),
|
|
229
|
+
}, e)), c(d)]
|
|
220
230
|
})
|
|
221
231
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
-
/* @__PURE__ */
|
|
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:
|
|
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:
|
|
243
|
+
children: o(e)
|
|
234
244
|
}, e))
|
|
235
245
|
})
|
|
236
246
|
]
|
|
237
247
|
});
|
|
238
248
|
}
|
|
239
|
-
function
|
|
240
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
252
|
+
children: [/* @__PURE__ */ p("span", {
|
|
243
253
|
className: "x1cqoux5 xeuugli xj0a0fe",
|
|
244
254
|
children: t(e[0])
|
|
245
|
-
}), /* @__PURE__ */
|
|
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
|
|
253
|
-
let D =
|
|
254
|
-
|
|
255
|
-
|
|
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 (
|
|
274
|
+
if (k !== void 0) return /* @__PURE__ */ p(c, {
|
|
258
275
|
title: a,
|
|
259
276
|
report: o,
|
|
260
|
-
description:
|
|
261
|
-
message:
|
|
277
|
+
description: s,
|
|
278
|
+
message: k
|
|
262
279
|
});
|
|
263
|
-
let
|
|
280
|
+
let A = h({
|
|
264
281
|
domain: [0, 1],
|
|
265
|
-
range: [
|
|
266
|
-
})
|
|
267
|
-
return /* @__PURE__ */
|
|
282
|
+
range: [b.height, 0]
|
|
283
|
+
});
|
|
284
|
+
return /* @__PURE__ */ p(i, {
|
|
268
285
|
title: a,
|
|
269
286
|
report: o,
|
|
270
|
-
description:
|
|
271
|
-
footer:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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:
|
|
281
|
-
formatY:
|
|
307
|
+
formatX: v,
|
|
308
|
+
formatY: y,
|
|
282
309
|
children: (t) => {
|
|
283
|
-
let n =
|
|
284
|
-
domain: [...
|
|
310
|
+
let n = h({
|
|
311
|
+
domain: [...u],
|
|
285
312
|
range: [0, t]
|
|
286
|
-
}), r =
|
|
313
|
+
}), r = l.map((e, t) => {
|
|
287
314
|
if (e.probability === null) return "";
|
|
288
|
-
let r = n(e.value), i =
|
|
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
|
|
318
|
+
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("path", {
|
|
292
319
|
d: r,
|
|
293
320
|
fill: "none",
|
|
294
|
-
stroke: e[
|
|
321
|
+
stroke: e[x],
|
|
295
322
|
strokeWidth: 2,
|
|
296
323
|
vectorEffect: "non-scaling-stroke"
|
|
297
|
-
}),
|
|
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:
|
|
300
|
-
r:
|
|
301
|
-
fill: e[
|
|
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__ */
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
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
|
|
325
|
-
let n =
|
|
346
|
+
function E({ points: e, domain: t }) {
|
|
347
|
+
let n = v({
|
|
326
348
|
items: e,
|
|
327
349
|
domain: t,
|
|
328
|
-
maxEntries:
|
|
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 (
|
|
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
|
|
346
|
-
let
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
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 (
|
|
380
|
+
if (M !== void 0) return /* @__PURE__ */ p(c, {
|
|
352
381
|
title: a,
|
|
353
382
|
report: o,
|
|
354
|
-
description:
|
|
355
|
-
message:
|
|
383
|
+
description: s,
|
|
384
|
+
message: M
|
|
385
|
+
});
|
|
386
|
+
let N = h({
|
|
387
|
+
domain: [0, v],
|
|
388
|
+
range: [b.height, 0]
|
|
356
389
|
});
|
|
357
|
-
|
|
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:
|
|
365
|
-
footer:
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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:
|
|
374
|
-
formatX:
|
|
375
|
-
formatY:
|
|
410
|
+
yLabel: x,
|
|
411
|
+
formatX: w,
|
|
412
|
+
formatY: T,
|
|
376
413
|
children: (t) => {
|
|
377
|
-
let n =
|
|
378
|
-
domain: [...
|
|
414
|
+
let n = h({
|
|
415
|
+
domain: [..._],
|
|
379
416
|
range: [0, t]
|
|
380
417
|
});
|
|
381
|
-
return
|
|
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__ */
|
|
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:
|
|
424
|
+
y: b.height - 6,
|
|
386
425
|
width: i - a,
|
|
387
426
|
height: 5,
|
|
388
|
-
...
|
|
427
|
+
...d.props(S.missing)
|
|
389
428
|
}, t.id);
|
|
390
|
-
let s =
|
|
391
|
-
return /* @__PURE__ */
|
|
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:
|
|
396
|
-
fill: e[
|
|
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__ */
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
|
426
|
-
let r =
|
|
456
|
+
function O({ bins: e, domain: t, maximumCount: n }) {
|
|
457
|
+
let r = v({
|
|
427
458
|
items: e,
|
|
428
459
|
domain: t,
|
|
429
|
-
maxEntries:
|
|
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 (
|
|
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
|
|
442
|
-
let { ref: y, width:
|
|
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:
|
|
475
|
+
domain: s
|
|
445
476
|
});
|
|
446
|
-
if (
|
|
477
|
+
if (x !== void 0) return /* @__PURE__ */ p(c, {
|
|
447
478
|
title: t,
|
|
448
|
-
report:
|
|
449
|
-
description:
|
|
450
|
-
message:
|
|
479
|
+
report: n,
|
|
480
|
+
description: r,
|
|
481
|
+
message: x
|
|
451
482
|
});
|
|
452
|
-
let
|
|
453
|
-
domain: [...
|
|
454
|
-
range: [0,
|
|
483
|
+
let C = h({
|
|
484
|
+
domain: [...s],
|
|
485
|
+
range: [0, b]
|
|
455
486
|
});
|
|
456
|
-
return /* @__PURE__ */
|
|
487
|
+
return /* @__PURE__ */ p(i, {
|
|
457
488
|
title: t,
|
|
458
|
-
report:
|
|
459
|
-
description:
|
|
460
|
-
footer: `${
|
|
461
|
-
children: o.length === 0 ? /* @__PURE__ */
|
|
462
|
-
...
|
|
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__ */
|
|
465
|
-
...
|
|
495
|
+
}) : /* @__PURE__ */ m("div", {
|
|
496
|
+
...d.props(S.values),
|
|
466
497
|
children: [o.map((t) => {
|
|
467
|
-
let
|
|
468
|
-
return /* @__PURE__ */
|
|
469
|
-
label: `${t.label}, ${
|
|
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__ */
|
|
473
|
-
...
|
|
474
|
-
children: [/* @__PURE__ */
|
|
475
|
-
...
|
|
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__ */
|
|
478
|
-
/* @__PURE__ */
|
|
479
|
-
...
|
|
480
|
-
children:
|
|
508
|
+
/* @__PURE__ */ p("span", { children: t.label }),
|
|
509
|
+
/* @__PURE__ */ p("span", {
|
|
510
|
+
...d.props(S.rowValue),
|
|
511
|
+
children: n
|
|
481
512
|
}),
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
...
|
|
484
|
-
children:
|
|
513
|
+
/* @__PURE__ */ p("span", {
|
|
514
|
+
...d.props(S.label),
|
|
515
|
+
children: r
|
|
485
516
|
})
|
|
486
517
|
]
|
|
487
|
-
}), /* @__PURE__ */
|
|
518
|
+
}), /* @__PURE__ */ m("svg", {
|
|
488
519
|
"aria-hidden": !0,
|
|
489
|
-
viewBox: `0 0 ${
|
|
520
|
+
viewBox: `0 0 ${b} 28`,
|
|
490
521
|
preserveAspectRatio: "none",
|
|
491
|
-
...
|
|
522
|
+
...d.props(S.rowSvg),
|
|
492
523
|
children: [
|
|
493
|
-
/* @__PURE__ */
|
|
524
|
+
/* @__PURE__ */ p("line", {
|
|
494
525
|
x1: 0,
|
|
495
|
-
x2:
|
|
526
|
+
x2: b,
|
|
496
527
|
y1: 14,
|
|
497
528
|
y2: 14,
|
|
498
|
-
...
|
|
529
|
+
...d.props(S.baseline)
|
|
499
530
|
}),
|
|
500
|
-
t.lower !== null && t.upper !== null && /* @__PURE__ */
|
|
501
|
-
stroke:
|
|
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__ */
|
|
506
|
-
x1:
|
|
507
|
-
x2:
|
|
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__ */
|
|
512
|
-
x1:
|
|
513
|
-
x2:
|
|
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__ */
|
|
518
|
-
x1:
|
|
519
|
-
x2:
|
|
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__ */
|
|
526
|
-
cx:
|
|
556
|
+
t.estimate !== null && /* @__PURE__ */ p("circle", {
|
|
557
|
+
cx: C(t.estimate),
|
|
527
558
|
cy: 14,
|
|
528
559
|
r: 4,
|
|
529
|
-
fill:
|
|
560
|
+
fill: i
|
|
530
561
|
})
|
|
531
562
|
]
|
|
532
563
|
})]
|
|
533
564
|
})
|
|
534
565
|
}, t.id);
|
|
535
|
-
}), /* @__PURE__ */
|
|
536
|
-
...
|
|
537
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
540
|
-
domain:
|
|
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
|
|
549
|
-
let n =
|
|
579
|
+
function A({ items: e, domain: t }) {
|
|
580
|
+
let n = v({
|
|
550
581
|
items: e,
|
|
551
582
|
domain: t,
|
|
552
|
-
maxEntries:
|
|
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 &&
|
|
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
|
|
570
|
-
let { ref: y, width:
|
|
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:
|
|
603
|
+
domain: s
|
|
573
604
|
});
|
|
574
|
-
if (
|
|
605
|
+
if (x !== void 0) return /* @__PURE__ */ p(c, {
|
|
575
606
|
title: t,
|
|
576
|
-
report:
|
|
577
|
-
description:
|
|
578
|
-
message:
|
|
607
|
+
report: n,
|
|
608
|
+
description: r,
|
|
609
|
+
message: x
|
|
579
610
|
});
|
|
580
|
-
let
|
|
581
|
-
domain: [...
|
|
582
|
-
range: [0,
|
|
583
|
-
}), T =
|
|
584
|
-
return /* @__PURE__ */
|
|
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:
|
|
587
|
-
description:
|
|
588
|
-
footer:
|
|
589
|
-
children: o.length === 0 ? /* @__PURE__ */
|
|
590
|
-
...
|
|
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__ */
|
|
593
|
-
...
|
|
623
|
+
}) : /* @__PURE__ */ m("div", {
|
|
624
|
+
...d.props(S.values),
|
|
594
625
|
children: [o.map((t) => {
|
|
595
|
-
let
|
|
596
|
-
return /* @__PURE__ */
|
|
597
|
-
label: `${
|
|
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__ */
|
|
601
|
-
...
|
|
602
|
-
children: [/* @__PURE__ */
|
|
603
|
-
...
|
|
604
|
-
children: [/* @__PURE__ */
|
|
605
|
-
...
|
|
606
|
-
children:
|
|
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__ */
|
|
639
|
+
}), /* @__PURE__ */ m("svg", {
|
|
609
640
|
"aria-hidden": !0,
|
|
610
|
-
viewBox: `0 0 ${
|
|
641
|
+
viewBox: `0 0 ${b} 28`,
|
|
611
642
|
preserveAspectRatio: "none",
|
|
612
|
-
...
|
|
613
|
-
children: [/* @__PURE__ */
|
|
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
|
-
...
|
|
619
|
-
}), t.value !== null && (t.value === 0 ? /* @__PURE__ */
|
|
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:
|
|
655
|
+
stroke: i,
|
|
625
656
|
strokeWidth: 2,
|
|
626
657
|
vectorEffect: "non-scaling-stroke"
|
|
627
|
-
}) : /* @__PURE__ */
|
|
628
|
-
x: Math.min(T,
|
|
658
|
+
}) : /* @__PURE__ */ p(g, {
|
|
659
|
+
x: Math.min(T, C(t.value)),
|
|
629
660
|
y: 10,
|
|
630
|
-
width: Math.abs(
|
|
661
|
+
width: Math.abs(C(t.value) - T),
|
|
631
662
|
height: 8,
|
|
632
|
-
fill:
|
|
663
|
+
fill: i
|
|
633
664
|
}))]
|
|
634
665
|
})]
|
|
635
666
|
})
|
|
636
667
|
}, t.id);
|
|
637
|
-
}), /* @__PURE__ */
|
|
638
|
-
...
|
|
639
|
-
children: [/* @__PURE__ */
|
|
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__ */
|
|
642
|
-
domain:
|
|
643
|
-
formatValue:
|
|
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
|
|
651
|
-
let n =
|
|
681
|
+
function M({ items: e, domain: t }) {
|
|
682
|
+
let n = v({
|
|
652
683
|
items: e,
|
|
653
684
|
domain: t,
|
|
654
|
-
maxEntries:
|
|
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 &&
|
|
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 {
|
|
691
|
+
export { T as ECDF, D as Histogram, k as IntervalPlot, j as RankedBars };
|