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