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