@mechane-ai/elements 0.48.0 → 0.49.1
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 +40 -2
- package/dist/ai.js +5 -5
- package/dist/{article-BXZr10QQ.js → article-CRlhq9oA.js} +532 -464
- package/dist/article.js +1 -1
- package/dist/catalog.json +243 -1
- package/dist/{categorical-values-BpVq8cFj.js → categorical-values-BYP_R5gS.js} +13 -13
- package/dist/{cells-xVmnQ9oQ.js → cells-CNZE4us2.js} +2 -2
- package/dist/charts/cartesian.js +1 -1
- package/dist/charts/cells.js +1 -1
- package/dist/charts/comparison.js +1 -1
- package/dist/charts/distribution.js +1 -1
- package/dist/charts/figure.js +12 -12
- package/dist/charts/graph.js +1 -1
- package/dist/charts/hierarchy.js +1 -1
- package/dist/charts/image.js +1 -1
- package/dist/charts/matrix.js +1 -1
- package/dist/charts/plot.js +7 -7
- package/dist/charts/relationship.js +1 -1
- package/dist/charts/text.js +1 -1
- package/dist/charts/timeline.js +1 -1
- package/dist/charts/trend.js +1 -1
- package/dist/charts.js +7 -7
- package/dist/{code-block-DioAM2bZ.js → code-block-BZsY2sh3.js} +1 -1
- package/dist/collections.js +1 -1
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +3 -3
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +1 -1
- package/dist/{content-link-NWuHp5rC.js → content-link-PnpcnTCx.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/{dates-Cww8UR_n.js → dates-ckJdYF7t.js} +1 -1
- package/dist/{dumbbell-plot-DQdTxDeO.js → dumbbell-plot-B-Tn7ewW.js} +49 -48
- package/dist/{embedding-map-CF-J-8JW.js → embedding-map-Bljn-A5q.js} +533 -533
- package/dist/feedback.js +1 -1
- package/dist/figure-frame-CEijciL7.js +289 -0
- package/dist/forms/dates.js +1 -1
- package/dist/forms.js +3 -3
- package/dist/{image-grid-Dl2sjIMB.js → image-grid-mrG5u9oE.js} +49 -49
- package/dist/index.js +1 -1
- package/dist/kits/evaluation.js +5 -5
- package/dist/kits/interpretability.js +320 -302
- package/dist/kits/operations.js +6 -6
- package/dist/kits/research.js +558 -0
- package/dist/kits/training.js +6 -6
- package/dist/layout.js +205 -110
- package/dist/lesson/spec.js +11 -11
- package/dist/lesson.js +4 -4
- package/dist/mdx.js +6 -6
- package/dist/navigation.js +2 -2
- package/dist/packages/charts/src/cartesian/index.d.ts +1 -1
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +18 -0
- package/dist/packages/charts/src/chart-theme.d.ts +1 -1
- package/dist/packages/charts/src/figure/caption-scope.d.ts +12 -0
- package/dist/packages/charts/src/figure/figure-frame.d.ts +2 -1
- package/dist/packages/charts/src/index.d.ts +2 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +3 -1
- package/dist/packages/collections/src/index.d.ts +1 -1
- package/dist/packages/collections/src/metrics.d.ts +9 -1
- package/dist/packages/content/src/index.d.ts +2 -0
- package/dist/packages/content/src/text-match.d.ts +22 -0
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/surfaces.d.ts +12 -2
- package/dist/packages/forms/src/index.d.ts +2 -0
- package/dist/packages/forms/src/token-input.d.ts +24 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +1 -1
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +10 -1
- package/dist/packages/kits/src/research/finding-card.d.ts +43 -0
- package/dist/packages/kits/src/research/index.d.ts +8 -0
- package/dist/packages/kits/src/research/milestone-path.d.ts +36 -0
- package/dist/packages/kits/src/research/specimen-diff.d.ts +41 -0
- package/dist/packages/kits/src/research/work-heartbeat.d.ts +34 -0
- package/dist/packages/layout/src/figure-grid.d.ts +8 -0
- package/dist/packages/layout/src/index.d.ts +4 -1
- package/dist/packages/layout/src/sidebar.d.ts +7 -0
- package/dist/packages/layout/src/workbench.d.ts +4 -1
- package/dist/packages/teaching/src/article/article-context.d.ts +2 -0
- package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +13 -0
- package/dist/packages/teaching/src/article/article.d.ts +6 -1
- package/dist/packages/teaching/src/article/figure.d.ts +20 -3
- package/dist/packages/teaching/src/article/index.d.ts +1 -1
- package/dist/packages/teaching/src/article/view-essay.d.ts +2 -1
- package/dist/packages/teaching/src/lesson/define-lesson.d.ts +4 -0
- package/dist/packages/teaching/src/lesson/index.d.ts +2 -2
- package/dist/packages/teaching/src/lesson/lesson-player.d.ts +19 -3
- package/dist/packages/teaching/src/lesson/lesson-store.d.ts +2 -0
- package/dist/packages/teaching/src/lesson/playback.d.ts +9 -6
- package/dist/packages/teaching/src/lesson/use-lesson.d.ts +7 -2
- package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +4 -1
- package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +5 -6
- package/dist/packages/teaching/src/scene/scene-geometry.d.ts +1 -1
- package/dist/packages/teaching/src/scene/scene-node.d.ts +4 -1
- package/dist/packages/teaching/src/scene/scene-validate.d.ts +6 -0
- package/dist/packages/teaching/src/scene/scene-wire.d.ts +6 -1
- package/dist/packages/teaching/src/scene/scene.d.ts +1 -1
- package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +5 -1
- package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +1 -1
- package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +1 -1
- package/dist/packages/teaching/src/time/tween.d.ts +2 -0
- package/dist/{param-CqKUTHaO.js → param-BdqTpZER.js} +175 -108
- package/dist/{pierre-diff-DlvjyuJn.js → pierre-diff-aGyQK5xK.js} +1 -1
- package/dist/{plot-axes-DJkLW4wk.js → plot-axes-D5S9BnBa.js} +1 -1
- package/dist/{plot-layout-CZVSJ-le.js → plot-layout-B2xRt-_k.js} +146 -132
- package/dist/{plot-marks-uozcbOIX.js → plot-marks-FVsbFkUs.js} +3 -3
- package/dist/{plot-surface-CbVBvgqZ.js → plot-surface-0cKFwtws.js} +11 -11
- package/dist/{plot-width-DcqtSgzb.js → plot-width-D3hTycYX.js} +1 -1
- package/dist/{reference-lines-BDcttOp0.js → reference-lines-nSxcZVF5.js} +2 -2
- package/dist/{scene-0z2gbaDE.js → scene-BwJKueD6.js} +1228 -1126
- package/dist/scene.js +1 -1
- package/dist/{slope-chart-BKVEAVCs.js → slope-chart-CGTYbFxi.js} +182 -182
- package/dist/{src-CpdJlDhO.js → src-9EJskqB_.js} +73 -31
- package/dist/{src-Dcfq8vE4.js → src-B2rgpWap.js} +48 -14
- package/dist/{src-BPTDJqt0.js → src-Ci8DeY8J.js} +1 -1
- package/dist/{src-CGc_hjxJ.js → src-DFW49IAs.js} +143 -111
- package/dist/{src-BD6xlvDt.js → src-Dxs3Buo_.js} +203 -137
- package/dist/{src-CExIrXPC.js → src-npqwq3Sa.js} +1 -1
- package/dist/styles2.css +136 -17
- package/dist/{time-series-BgzGNOk0.js → time-series-Dh8y5ba0.js} +1018 -944
- package/dist/{token-heatmap-BrW1OsKD.js → token-heatmap-BTrZ3-N4.js} +86 -86
- package/dist/{token-predictions-yerq_Oet.js → token-predictions-CUe4junQ.js} +129 -129
- package/dist/{transport-BJweqDPj.js → transport-4V9rfYHN.js} +291 -246
- package/dist/{tree-diagram-D09BRqE-.js → tree-diagram-Dpqmo-fh.js} +118 -118
- package/dist/{treemap-CW4WsJNL.js → treemap-BUSaVD3m.js} +28 -28
- package/dist/use-tween-BsaEO862.js +10 -0
- package/dist/{violin-plot-DrtPZ1-T.js → violin-plot-BxaLwdRi.js} +126 -126
- package/dist/{waterfall-DYLSnGjm.js → waterfall-CcDMdKec.js} +43 -43
- package/package.json +5 -1
- package/recipes/counting-cards.tsx +3 -3
- package/skills/review-explainer/SKILL.md +2 -1
- package/skills/upgrade-elements/references/releases.md +61 -0
- package/skills/use-elements/SKILL.md +3 -1
- package/skills/use-elements/references/kits.md +7 -6
- package/skills/use-elements/references/styling.md +23 -0
- package/skills/use-elements/references/teaching.md +13 -0
- package/skills/write-explainer/references/article.md +50 -2
- package/skills/write-explainer/references/lesson.md +18 -9
- package/skills/write-explainer/references/scene-parts.md +17 -12
- package/skills/write-explainer/references/scene.md +25 -3
- package/dist/figure-frame-BJ3REgTA.js +0 -270
- package/dist/use-tween-5HZ55_9d.js +0 -72
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { r as e } from "./tokens.stylex-dF5CACEJ.js";
|
|
2
2
|
import { t } from "./chart-tones-ei3BC2AL.js";
|
|
3
|
-
import { A as n,
|
|
3
|
+
import { A as n, D as r, E as i, M as a, O as o, S as s, a as c, i as l, j as u, n as d, s as f, x as p } from "./plot-layout-B2xRt-_k.js";
|
|
4
4
|
import { i as ee } from "./chart-link-AE_xuxiP.js";
|
|
5
5
|
import { r as m } from "./figure-format-B8kRZMlo.js";
|
|
6
6
|
import { a as h, i as g, o as _ } from "./scale-C2xgZyZN.js";
|
|
7
|
-
import { i as te, l as ne, n as re, r as v, t as ie } from "./figure-frame-
|
|
8
|
-
import { n as ae } from "./plot-width-
|
|
9
|
-
import { t as y } from "./plot-axes-
|
|
10
|
-
import { c as b, f as x, r as S, u as C } from "./plot-marks-
|
|
11
|
-
import { n as w, r as T, t as E } from "./plot-surface-
|
|
7
|
+
import { i as te, l as ne, n as re, r as v, t as ie } from "./figure-frame-CEijciL7.js";
|
|
8
|
+
import { n as ae } from "./plot-width-D3hTycYX.js";
|
|
9
|
+
import { t as y } from "./plot-axes-D5S9BnBa.js";
|
|
10
|
+
import { c as b, f as x, r as S, u as C } from "./plot-marks-FVsbFkUs.js";
|
|
11
|
+
import { n as w, r as T, t as E } from "./plot-surface-0cKFwtws.js";
|
|
12
12
|
import { r as D } from "./path-BglsXpnO.js";
|
|
13
13
|
import { t as O } from "./locate-Bcg3QcP4.js";
|
|
14
14
|
import * as k from "@stylexjs/stylex";
|
|
@@ -248,20 +248,20 @@ var J = {
|
|
|
248
248
|
$$css: !0
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
function ye({ examples: e, domain: t, palette:
|
|
252
|
-
let
|
|
251
|
+
function ye({ examples: e, domain: t, palette: n, context: r }) {
|
|
252
|
+
let i = F({
|
|
253
253
|
domain: t,
|
|
254
|
-
palette:
|
|
254
|
+
palette: n
|
|
255
255
|
});
|
|
256
|
-
if (
|
|
256
|
+
if (i !== void 0) return i;
|
|
257
257
|
if (e.length > J.examples) return `This chart draws at most ${J.examples} examples. Supply the leading examples.`;
|
|
258
|
-
if (!
|
|
259
|
-
if (
|
|
258
|
+
if (!a(e)) return "Examples must have unique identifiers.";
|
|
259
|
+
if (r !== void 0 && (!Number.isSafeInteger(r) || r < 0)) return "The context must be a whole number of tokens, zero or more.";
|
|
260
260
|
for (let n of e) {
|
|
261
261
|
if (n.tokens.length > J.tokensPerExample) return `Example ${n.id} has more than ${J.tokensPerExample} tokens. Supply a window around its peak.`;
|
|
262
|
-
let { peakIndex: e } = n,
|
|
263
|
-
if (
|
|
264
|
-
if (
|
|
262
|
+
let { peakIndex: e } = n, i = e !== void 0;
|
|
263
|
+
if (i && !(Number.isSafeInteger(e) && e >= 0 && e < n.tokens.length)) return `Example ${n.id} names a peak index that is not one of its token positions.`;
|
|
264
|
+
if (r !== void 0 && !i) return `Example ${n.id} has no peak index, so the chart cannot show context around it.`;
|
|
265
265
|
if (n.tokens.some((e) => e.value !== null && I(e.value, t))) return `Example ${n.id} has a value that is not finite or lies outside the color domain.`;
|
|
266
266
|
}
|
|
267
267
|
}
|
|
@@ -284,24 +284,24 @@ function be(e, t, n) {
|
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
function xe(e) {
|
|
287
|
-
let { examples: t, valueLabel:
|
|
287
|
+
let { examples: t, valueLabel: a, valueFormat: c, domain: l, palette: d, context: f, selected: p, onSelectedChange: h, ...g } = e, { emptyLabel: _ = "No examples are available.", ...y } = g, { locale: b, title: x } = y, S = oe(), C = ee();
|
|
288
288
|
if (y.status === "loading") return /* @__PURE__ */ M(te, { ...y });
|
|
289
289
|
let w = ye({
|
|
290
290
|
examples: t,
|
|
291
|
-
domain:
|
|
292
|
-
palette:
|
|
293
|
-
context:
|
|
291
|
+
domain: l,
|
|
292
|
+
palette: d,
|
|
293
|
+
context: f
|
|
294
294
|
});
|
|
295
295
|
if (w !== void 0) return /* @__PURE__ */ M(v, {
|
|
296
296
|
...y,
|
|
297
297
|
message: w
|
|
298
298
|
});
|
|
299
|
-
let T = t.map((e, t) => be(e, t,
|
|
299
|
+
let T = t.map((e, t) => be(e, t, f));
|
|
300
300
|
function E(e) {
|
|
301
301
|
return m({
|
|
302
302
|
value: e,
|
|
303
303
|
locale: b,
|
|
304
|
-
format:
|
|
304
|
+
format: c
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
function D(e) {
|
|
@@ -313,7 +313,7 @@ function xe(e) {
|
|
|
313
313
|
}
|
|
314
314
|
let O = T.flatMap((e) => e.tokens.map((t) => ({
|
|
315
315
|
id: t.id,
|
|
316
|
-
label: `${e.name}, token ${t.index} ${G(t.text)}: ${
|
|
316
|
+
label: `${e.name}, token ${t.index} ${G(t.text)}: ${a} ${E(t.value)}${t.isPeak ? " (peak)" : ""}`
|
|
317
317
|
}))), A = new Map(T.flatMap((e) => e.tokens.map((t) => [t.id, e.id]))), j = new Map(T.flatMap((e, n) => e.tokens.map((e) => {
|
|
318
318
|
let r = t[n]?.peakIndex ?? 0, i = e.index - r;
|
|
319
319
|
return [e.id, {
|
|
@@ -323,7 +323,7 @@ function xe(e) {
|
|
|
323
323
|
bottom: n * ve + 1
|
|
324
324
|
}];
|
|
325
325
|
}))), P = T.find((e) => e.id === p), ce = P?.tokens.find((e) => e.isPeak) ?? P?.tokens[0], F = T.some((e) => e.tokens.some((e) => e.value === null));
|
|
326
|
-
return /* @__PURE__ */ M(
|
|
326
|
+
return /* @__PURE__ */ M(i, {
|
|
327
327
|
...C,
|
|
328
328
|
items: O,
|
|
329
329
|
place: (e) => j.get(e),
|
|
@@ -332,24 +332,24 @@ function xe(e) {
|
|
|
332
332
|
let n = A.get(e);
|
|
333
333
|
n !== void 0 && h(n, t);
|
|
334
334
|
},
|
|
335
|
-
render: (e, { inspected:
|
|
335
|
+
render: (e, { inspected: i, cursor: f }) => /* @__PURE__ */ M(re, {
|
|
336
336
|
...y,
|
|
337
337
|
figure: e,
|
|
338
338
|
scaleLegend: t.length === 0 ? void 0 : /* @__PURE__ */ M(ge, {
|
|
339
|
-
label:
|
|
340
|
-
domain:
|
|
341
|
-
palette:
|
|
339
|
+
label: a,
|
|
340
|
+
domain: l,
|
|
341
|
+
palette: d,
|
|
342
342
|
locale: b,
|
|
343
|
-
format:
|
|
343
|
+
format: c,
|
|
344
344
|
hasMissing: F
|
|
345
345
|
}),
|
|
346
|
-
footer: t.length === 0 ? void 0 : /* @__PURE__ */ M(
|
|
346
|
+
footer: t.length === 0 ? void 0 : /* @__PURE__ */ M(s, {
|
|
347
347
|
id: S,
|
|
348
|
-
children:
|
|
348
|
+
children: n(O, i)
|
|
349
349
|
}),
|
|
350
|
-
children: t.length === 0 ? /* @__PURE__ */ M(ie, { children: _ }) : /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M(
|
|
350
|
+
children: t.length === 0 ? /* @__PURE__ */ M(ie, { children: _ }) : /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M(o, {
|
|
351
351
|
role: "group",
|
|
352
|
-
"aria-label":
|
|
352
|
+
"aria-label": u({
|
|
353
353
|
title: x,
|
|
354
354
|
marks: "tokens",
|
|
355
355
|
isSelectable: h !== void 0
|
|
@@ -376,12 +376,12 @@ function xe(e) {
|
|
|
376
376
|
className: "x153jb6y x1hz01jw xy8obcc",
|
|
377
377
|
children: `… ${D(e.hiddenBefore)} earlier tokens hidden … `
|
|
378
378
|
}),
|
|
379
|
-
e.tokens.map((e) => /* @__PURE__ */ M(
|
|
379
|
+
e.tokens.map((e) => /* @__PURE__ */ M(r, {
|
|
380
380
|
value: e.id,
|
|
381
381
|
...k.props(Y.token, e.value === null ? Y.missing : Y.shade(L(e.value, {
|
|
382
|
-
domain:
|
|
383
|
-
palette:
|
|
384
|
-
})), e.isPeak && Y.peakToken,
|
|
382
|
+
domain: l,
|
|
383
|
+
palette: d
|
|
384
|
+
})), e.isPeak && Y.peakToken, i === e.id && Y.inspected, f === e.id && ae.cursor),
|
|
385
385
|
children: /* @__PURE__ */ M(q, {
|
|
386
386
|
text: e.text,
|
|
387
387
|
shouldWrap: !1
|
|
@@ -412,7 +412,7 @@ function xe(e) {
|
|
|
412
412
|
},
|
|
413
413
|
{
|
|
414
414
|
id: "value",
|
|
415
|
-
label:
|
|
415
|
+
label: a
|
|
416
416
|
}
|
|
417
417
|
],
|
|
418
418
|
rows: T.flatMap((e) => e.tokens.map((t) => ({
|
|
@@ -484,28 +484,28 @@ var Ce = {
|
|
|
484
484
|
$$css: !0
|
|
485
485
|
}
|
|
486
486
|
};
|
|
487
|
-
function we({ columns: e, rows: t, cells:
|
|
487
|
+
function we({ columns: e, rows: t, cells: n, domain: r, palette: i }) {
|
|
488
488
|
let o = F({
|
|
489
|
-
domain:
|
|
490
|
-
palette:
|
|
489
|
+
domain: r,
|
|
490
|
+
palette: i
|
|
491
491
|
});
|
|
492
492
|
if (o !== void 0) return o;
|
|
493
493
|
let s = e.length * t.length > X.cells;
|
|
494
494
|
if (e.length > X.columns || t.length > X.rows || s) return `This grid draws at most ${X.rows} rows, ${X.columns} columns and ${X.cells} cells. Supply fewer stages or a shorter prompt.`;
|
|
495
|
-
if (!
|
|
496
|
-
let c = new Set(t.map((e) => e.id)), l = new Set(e.map((e) => e.id)), u =
|
|
495
|
+
if (!a(e) || !a(t)) return "Rows and columns must have unique identifiers.";
|
|
496
|
+
let c = new Set(t.map((e) => e.id)), l = new Set(e.map((e) => e.id)), u = n.map((e) => Se(e.rowId, e.columnId));
|
|
497
497
|
if (new Set(u).size !== u.length) return "Each row and column pair takes at most one cell.";
|
|
498
|
-
if (
|
|
499
|
-
if (
|
|
498
|
+
if (n.some((e) => !c.has(e.rowId) || !l.has(e.columnId))) return "A cell names a row or column the grid does not list.";
|
|
499
|
+
if (n.some((e) => e.value !== null && I(e.value, r))) return "A cell value is not finite or lies outside the color domain.";
|
|
500
500
|
}
|
|
501
501
|
function Te(e) {
|
|
502
|
-
let { columns: t, rows:
|
|
502
|
+
let { columns: t, rows: a, cells: c, valueLabel: l, valueFormat: d, domain: f, palette: p, selected: h, onSelectedChange: g, ..._ } = e, { emptyLabel: y = "No predictions are available.", ...b } = _, { locale: x, title: S } = b, C = oe(), w = ee();
|
|
503
503
|
if (b.status === "loading") return /* @__PURE__ */ M(te, { ...b });
|
|
504
504
|
let T = we({
|
|
505
505
|
columns: t,
|
|
506
|
-
rows:
|
|
507
|
-
cells:
|
|
508
|
-
domain:
|
|
506
|
+
rows: a,
|
|
507
|
+
cells: c,
|
|
508
|
+
domain: f,
|
|
509
509
|
palette: p
|
|
510
510
|
});
|
|
511
511
|
if (T !== void 0) return /* @__PURE__ */ M(v, {
|
|
@@ -516,10 +516,10 @@ function Te(e) {
|
|
|
516
516
|
return m({
|
|
517
517
|
value: e,
|
|
518
518
|
locale: x,
|
|
519
|
-
format:
|
|
519
|
+
format: d
|
|
520
520
|
});
|
|
521
521
|
}
|
|
522
|
-
let D = new Map(
|
|
522
|
+
let D = new Map(c.map((e) => [Se(e.rowId, e.columnId), e])), O = a.map((e) => ({
|
|
523
523
|
row: e,
|
|
524
524
|
cells: t.map((t, n) => {
|
|
525
525
|
let r = Se(e.id, t.id), i = D.get(r), a = `${e.label}, position ${n} ${G(t.token)}`;
|
|
@@ -530,40 +530,40 @@ function Te(e) {
|
|
|
530
530
|
} : {
|
|
531
531
|
id: r,
|
|
532
532
|
cell: i,
|
|
533
|
-
label: `${a}: ${i.token === null ? "prediction unavailable" : `predicts ${G(i.token)}`}, ${
|
|
533
|
+
label: `${a}: ${i.token === null ? "prediction unavailable" : `predicts ${G(i.token)}`}, ${l} ${E(i.value)}`
|
|
534
534
|
};
|
|
535
535
|
})
|
|
536
536
|
})), A = O.flatMap((e) => e.cells.map((e) => ({
|
|
537
537
|
id: e.id,
|
|
538
538
|
label: e.label
|
|
539
|
-
}))), j = O.some((e) => e.cells.some((e) => e.cell === void 0 || e.cell.value === null)), P =
|
|
540
|
-
return /* @__PURE__ */ M(
|
|
539
|
+
}))), j = O.some((e) => e.cells.some((e) => e.cell === void 0 || e.cell.value === null)), P = a.length === 0 || t.length === 0;
|
|
540
|
+
return /* @__PURE__ */ M(i, {
|
|
541
541
|
...w,
|
|
542
542
|
items: A,
|
|
543
543
|
columns: t.length,
|
|
544
544
|
selected: h,
|
|
545
545
|
onSelect: g,
|
|
546
|
-
render: (e,
|
|
546
|
+
render: (e, i) => /* @__PURE__ */ M(re, {
|
|
547
547
|
...b,
|
|
548
548
|
figure: e,
|
|
549
549
|
scaleLegend: P ? void 0 : /* @__PURE__ */ M(ge, {
|
|
550
|
-
label:
|
|
551
|
-
domain:
|
|
550
|
+
label: l,
|
|
551
|
+
domain: f,
|
|
552
552
|
palette: p,
|
|
553
553
|
locale: x,
|
|
554
|
-
format:
|
|
554
|
+
format: d,
|
|
555
555
|
hasMissing: j
|
|
556
556
|
}),
|
|
557
|
-
footer: P ? void 0 : /* @__PURE__ */ M(
|
|
557
|
+
footer: P ? void 0 : /* @__PURE__ */ M(s, {
|
|
558
558
|
id: C,
|
|
559
|
-
children:
|
|
559
|
+
children: n(A, i.inspected)
|
|
560
560
|
}),
|
|
561
561
|
children: P ? /* @__PURE__ */ M(ie, { children: y }) : /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M(_e, {
|
|
562
|
-
cursor:
|
|
562
|
+
cursor: i.cursor,
|
|
563
563
|
isBounded: !0,
|
|
564
|
-
children: /* @__PURE__ */ M(
|
|
564
|
+
children: /* @__PURE__ */ M(o, {
|
|
565
565
|
role: "group",
|
|
566
|
-
"aria-label":
|
|
566
|
+
"aria-label": u({
|
|
567
567
|
title: S,
|
|
568
568
|
marks: "cells",
|
|
569
569
|
isSelectable: g !== void 0
|
|
@@ -589,14 +589,14 @@ function Te(e) {
|
|
|
589
589
|
className: "x7wzq59 xu96u03 x11ru5tl x78zum5 x6s0dn4 x1fa0jp5 xuxw1ft x153jb6y xpvm0e4",
|
|
590
590
|
children: e.row.label
|
|
591
591
|
}, e.row.id), ...e.cells.map(({ id: e, cell: t }) => {
|
|
592
|
-
let
|
|
593
|
-
return /* @__PURE__ */ M(
|
|
592
|
+
let n = t?.value ?? null;
|
|
593
|
+
return /* @__PURE__ */ M(r, {
|
|
594
594
|
value: e,
|
|
595
|
-
"data-token-cursor":
|
|
596
|
-
...k.props(Z.cell,
|
|
597
|
-
domain:
|
|
595
|
+
"data-token-cursor": i.cursor === e ? "" : void 0,
|
|
596
|
+
...k.props(Z.cell, n === null ? Z.missing : Z.shade(L(n, {
|
|
597
|
+
domain: f,
|
|
598
598
|
palette: p
|
|
599
|
-
})),
|
|
599
|
+
})), i.selected === e && Z.selected, i.inspected === e && Z.inspected, i.cursor === e && ae.cursor),
|
|
600
600
|
children: t?.token !== void 0 && t.token !== null && /* @__PURE__ */ M(q, {
|
|
601
601
|
text: t.token,
|
|
602
602
|
shouldWrap: !1
|
|
@@ -658,22 +658,22 @@ var Q = {
|
|
|
658
658
|
$$css: !0
|
|
659
659
|
}, { "--x-opacity": e ?? void 0 }]
|
|
660
660
|
};
|
|
661
|
-
function ze({ tokens: e, links: t, domain:
|
|
662
|
-
if (!g(
|
|
661
|
+
function ze({ tokens: e, links: t, domain: n }) {
|
|
662
|
+
if (!g(n) || n[0] < 0) return "The weight domain must hold two finite, increasing values, starting at zero or above.";
|
|
663
663
|
if (e.length > Q.tokens || t.length > Q.links) return `This chart draws at most ${Q.tokens} tokens and ${Q.links} links. Supply a shorter window or the strongest links.`;
|
|
664
|
-
if (!
|
|
665
|
-
let
|
|
666
|
-
if (t.some((e) => !
|
|
667
|
-
if (
|
|
668
|
-
if (t.some((e) => h(e.weight,
|
|
664
|
+
if (!a(e)) return "Tokens must have unique identifiers.";
|
|
665
|
+
let r = new Set(e.map((e) => e.id)), i = new Set(t.map((e) => JSON.stringify([e.sourceId, e.destinationId])));
|
|
666
|
+
if (t.some((e) => !r.has(e.sourceId) || !r.has(e.destinationId))) return "A link names a token the chart does not list.";
|
|
667
|
+
if (i.size !== t.length) return "Each source and destination pair takes at most one link.";
|
|
668
|
+
if (t.some((e) => h(e.weight, n))) return "A link weight is not finite or lies outside the weight domain.";
|
|
669
669
|
}
|
|
670
670
|
function Be(e) {
|
|
671
|
-
let { tokens: t, links:
|
|
671
|
+
let { tokens: t, links: r, weightLabel: a, valueFormat: o, domain: c, direction: l, selected: d, onSelectedChange: p, ...h } = e, { emptyLabel: g = "No tokens are available.", ..._ } = h, { locale: y, title: b } = _, x = T(), S = oe(), E = ee();
|
|
672
672
|
if (_.status === "loading") return /* @__PURE__ */ M(te, { ..._ });
|
|
673
673
|
let A = ze({
|
|
674
674
|
tokens: t,
|
|
675
|
-
links:
|
|
676
|
-
domain:
|
|
675
|
+
links: r,
|
|
676
|
+
domain: c
|
|
677
677
|
});
|
|
678
678
|
if (A !== void 0) return /* @__PURE__ */ M(v, {
|
|
679
679
|
..._,
|
|
@@ -687,9 +687,9 @@ function Be(e) {
|
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
689
|
function P(e) {
|
|
690
|
-
return (e -
|
|
690
|
+
return (e - c[0]) / (c[1] - c[0]);
|
|
691
691
|
}
|
|
692
|
-
let ce = Math.max(0, ...t.map((e) => Array.from(e.text).length)), F = Math.min(Oe, Math.max(De, ce * ke + Ae)), I = t.length > 0 ? Math.max(F, x.width / t.length) : F, L = Math.max(1, I * t.length), R =
|
|
692
|
+
let ce = Math.max(0, ...t.map((e) => Array.from(e.text).length)), F = Math.min(Oe, Math.max(De, ce * ke + Ae)), I = t.length > 0 ? Math.max(F, x.width / t.length) : F, L = Math.max(1, I * t.length), R = f({
|
|
693
693
|
width: L,
|
|
694
694
|
height: 176,
|
|
695
695
|
margins: {
|
|
@@ -713,17 +713,17 @@ function Be(e) {
|
|
|
713
713
|
return `${n.join("; ")}${r > 0 ? `; and ${r} more` : ""}`;
|
|
714
714
|
}
|
|
715
715
|
let H = z.map((e) => {
|
|
716
|
-
let t =
|
|
716
|
+
let t = r.filter((t) => t.sourceId === e.id), n = r.filter((t) => t.destinationId === e.id);
|
|
717
717
|
return {
|
|
718
718
|
id: e.id,
|
|
719
|
-
label: `${G(e.text)} at position ${e.position}. Attends to, by ${
|
|
719
|
+
label: `${G(e.text)} at position ${e.position}. Attends to, by ${a}: ${V(n, "sourceId")}. Attended to by: ${V(t, "destinationId")}.`
|
|
720
720
|
};
|
|
721
721
|
}), U = z.map((e) => ({
|
|
722
722
|
id: e.id,
|
|
723
723
|
x: e.x,
|
|
724
724
|
y: 0
|
|
725
725
|
}));
|
|
726
|
-
return /* @__PURE__ */ M(
|
|
726
|
+
return /* @__PURE__ */ M(i, {
|
|
727
727
|
...E,
|
|
728
728
|
items: H,
|
|
729
729
|
locate: O({
|
|
@@ -732,19 +732,19 @@ function Be(e) {
|
|
|
732
732
|
height: R.height,
|
|
733
733
|
axis: "x"
|
|
734
734
|
}),
|
|
735
|
-
selected:
|
|
735
|
+
selected: d,
|
|
736
736
|
onSelect: p,
|
|
737
|
-
render: (e,
|
|
738
|
-
let
|
|
737
|
+
render: (e, i) => {
|
|
738
|
+
let o = i.inspected ?? i.selected;
|
|
739
739
|
return /* @__PURE__ */ M(re, {
|
|
740
740
|
..._,
|
|
741
741
|
figure: e,
|
|
742
742
|
scaleLegend: t.length === 0 ? void 0 : /* @__PURE__ */ N("div", {
|
|
743
743
|
className: "xrvj5dj xunmzkg xeuugli x153jb6y xy8obcc xas2l8k",
|
|
744
|
-
children: [/* @__PURE__ */ M("span", { children: `${Re[
|
|
744
|
+
children: [/* @__PURE__ */ M("span", { children: `${Re[l]} Width and opacity follow ${a}:` }), /* @__PURE__ */ M("div", {
|
|
745
745
|
className: "x78zum5 x1a02dak x6s0dn4 x8zbtdt x1gkm1c7 x153jb6y xy8obcc xas2l8k",
|
|
746
746
|
children: Le.map((e) => {
|
|
747
|
-
let t =
|
|
747
|
+
let t = c[0] + e * (c[1] - c[0]);
|
|
748
748
|
return /* @__PURE__ */ N("span", {
|
|
749
749
|
className: "x3nfvp2 x6s0dn4 xunmzkg xss6m8b",
|
|
750
750
|
children: [/* @__PURE__ */ M("svg", {
|
|
@@ -770,41 +770,41 @@ function Be(e) {
|
|
|
770
770
|
})
|
|
771
771
|
})]
|
|
772
772
|
}),
|
|
773
|
-
footer: t.length === 0 ? void 0 : /* @__PURE__ */ M(
|
|
773
|
+
footer: t.length === 0 ? void 0 : /* @__PURE__ */ M(s, {
|
|
774
774
|
id: S,
|
|
775
|
-
children:
|
|
775
|
+
children: n(H, o)
|
|
776
776
|
}),
|
|
777
777
|
children: t.length === 0 ? /* @__PURE__ */ M(ie, { children: g }) : /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ M("div", {
|
|
778
778
|
ref: x.ref,
|
|
779
779
|
className: "xeuugli x41o525",
|
|
780
780
|
children: /* @__PURE__ */ M(_e, {
|
|
781
|
-
cursor:
|
|
781
|
+
cursor: i.cursor,
|
|
782
782
|
children: /* @__PURE__ */ M("div", {
|
|
783
783
|
...k.props($.canvas(L)),
|
|
784
784
|
children: /* @__PURE__ */ M(w, {
|
|
785
785
|
plotRef: null,
|
|
786
786
|
box: R,
|
|
787
|
-
label:
|
|
787
|
+
label: u({
|
|
788
788
|
title: b,
|
|
789
789
|
marks: "tokens",
|
|
790
790
|
isSelectable: p !== void 0
|
|
791
791
|
}),
|
|
792
792
|
readoutId: S,
|
|
793
793
|
overlay: z.flatMap((e) => [0, R.bottom].map((t) => /* @__PURE__ */ M("span", {
|
|
794
|
-
"data-token-cursor": t === 0 &&
|
|
795
|
-
...k.props($.slot, $.chip(e.left, t, I), t === 0 &&
|
|
794
|
+
"data-token-cursor": t === 0 && i.cursor === e.id ? "" : void 0,
|
|
795
|
+
...k.props($.slot, $.chip(e.left, t, I), t === 0 && i.cursor === e.id && ae.cursor),
|
|
796
796
|
children: /* @__PURE__ */ M("span", {
|
|
797
797
|
...{
|
|
798
798
|
0: { className: "x193iq5w xb3r6kr x14w6jbu xmkeg23 x1y0btm7 x1ey3b81 x1ok0vyi xbixft x1r7kqkb xy8obcc xas2l8k" },
|
|
799
799
|
1: { className: "x193iq5w xb3r6kr x14w6jbu xmkeg23 x1y0btm7 x1ok0vyi xbixft xy8obcc xas2l8k x159tnba xpvm0e4" }
|
|
800
|
-
}[
|
|
800
|
+
}[o === e.id | 0],
|
|
801
801
|
children: /* @__PURE__ */ M(q, {
|
|
802
802
|
text: e.text,
|
|
803
803
|
shouldWrap: !1
|
|
804
804
|
})
|
|
805
805
|
})
|
|
806
806
|
}, `${e.id}-${t}`))),
|
|
807
|
-
children:
|
|
807
|
+
children: r.filter((e) => o === null || e.sourceId === o || e.destinationId === o).map((e) => {
|
|
808
808
|
let t = B.get(e.sourceId), n = B.get(e.destinationId), r = P(e.weight);
|
|
809
809
|
return t === void 0 || n === void 0 ? null : /* @__PURE__ */ M("g", {
|
|
810
810
|
...k.props($.strength(Ne + .75 * r)),
|
|
@@ -818,7 +818,7 @@ function Be(e) {
|
|
|
818
818
|
}]),
|
|
819
819
|
tone: "series1",
|
|
820
820
|
width: je + Me * r,
|
|
821
|
-
emphasis:
|
|
821
|
+
emphasis: o === null ? "receded" : "normal"
|
|
822
822
|
})
|
|
823
823
|
}, `${e.sourceId}\u0000${e.destinationId}`);
|
|
824
824
|
})
|
|
@@ -838,10 +838,10 @@ function Be(e) {
|
|
|
838
838
|
},
|
|
839
839
|
{
|
|
840
840
|
id: "weight",
|
|
841
|
-
label:
|
|
841
|
+
label: a
|
|
842
842
|
}
|
|
843
843
|
],
|
|
844
|
-
rows:
|
|
844
|
+
rows: r.map((e) => {
|
|
845
845
|
let t = B.get(e.sourceId), n = B.get(e.destinationId);
|
|
846
846
|
return {
|
|
847
847
|
id: `${e.sourceId}\u0000${e.destinationId}`,
|
|
@@ -901,18 +901,18 @@ function $e(e) {
|
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
903
|
function et(e, t) {
|
|
904
|
-
let
|
|
905
|
-
if (
|
|
904
|
+
let n = _(t);
|
|
905
|
+
if (n !== void 0) return n;
|
|
906
906
|
if (t[0] > 0 || t[1] < 0) return "The value domain must hold zero, where the bars start.";
|
|
907
907
|
if (e.length > Ve.rows) return `This chart draws at most ${Ve.rows} predictions. Supply the leading ones.`;
|
|
908
|
-
if (!
|
|
909
|
-
let
|
|
910
|
-
return
|
|
908
|
+
if (!a(e)) return "Predictions must have unique identifiers.";
|
|
909
|
+
let r = e.find((e) => [e.probability, e.baseline ?? null].some((e) => e !== null && h(e, t)));
|
|
910
|
+
return r === void 0 ? void 0 : `Prediction ${r.id} has a value that is not finite or lies outside the value domain.`;
|
|
911
911
|
}
|
|
912
912
|
function tt(e) {
|
|
913
|
-
let { predictions: t, valueLabel:
|
|
913
|
+
let { predictions: t, valueLabel: r = "Probability", valueFormat: a = Ze, domain: o, baselineLabel: f = "Baseline", selected: ee, onSelectedChange: h, ...g } = e, { emptyLabel: _ = "No predictions are available.", ...C } = g, { locale: D, title: A } = C, j = T(), P = oe();
|
|
914
914
|
if (C.status === "loading") return /* @__PURE__ */ M(te, { ...C });
|
|
915
|
-
let ce = t.flatMap((e) => [e.probability, e.baseline ?? null]), F = o ??
|
|
915
|
+
let ce = t.flatMap((e) => [e.probability, e.baseline ?? null]), F = o ?? c({
|
|
916
916
|
values: ce,
|
|
917
917
|
isZeroBased: !0
|
|
918
918
|
}), I = et(t, F);
|
|
@@ -924,14 +924,14 @@ function tt(e) {
|
|
|
924
924
|
return m({
|
|
925
925
|
value: e,
|
|
926
926
|
locale: D,
|
|
927
|
-
format:
|
|
927
|
+
format: a
|
|
928
928
|
});
|
|
929
929
|
}
|
|
930
930
|
let R = t.some((e) => e.baseline !== void 0), z = {
|
|
931
|
-
label:
|
|
931
|
+
label: r,
|
|
932
932
|
domain: F,
|
|
933
|
-
format:
|
|
934
|
-
}, B =
|
|
933
|
+
format: a
|
|
934
|
+
}, B = l({
|
|
935
935
|
width: j.width,
|
|
936
936
|
height: t.length * He + Ue,
|
|
937
937
|
direction: "rows",
|
|
@@ -946,19 +946,19 @@ function tt(e) {
|
|
|
946
946
|
valueDomain: F,
|
|
947
947
|
locale: D
|
|
948
948
|
}), { box: V, band: H } = B, U = B.value.position(0), W = t.map((e) => {
|
|
949
|
-
let t = e.isTarget === !0 ? ` (${Xe})` : "",
|
|
950
|
-
if (
|
|
949
|
+
let t = e.isTarget === !0 ? ` (${Xe})` : "", n = `${G(e.token)}${t}: ${r} ${L(e.probability)}`, { baseline: i } = e;
|
|
950
|
+
if (i === void 0) return {
|
|
951
951
|
id: e.id,
|
|
952
|
-
label:
|
|
952
|
+
label: n
|
|
953
953
|
};
|
|
954
|
-
let o =
|
|
954
|
+
let o = i === null || e.probability === null ? null : e.probability - i, s = m({
|
|
955
955
|
value: o,
|
|
956
956
|
locale: D,
|
|
957
|
-
format: $e(
|
|
957
|
+
format: $e(a)
|
|
958
958
|
});
|
|
959
959
|
return {
|
|
960
960
|
id: e.id,
|
|
961
|
-
label: `${
|
|
961
|
+
label: `${n} · ${f} ${L(i)} · Change ${s}`
|
|
962
962
|
};
|
|
963
963
|
}), le = t.flatMap((e) => {
|
|
964
964
|
let t = H.center(e.id);
|
|
@@ -974,7 +974,7 @@ function tt(e) {
|
|
|
974
974
|
height: H.step
|
|
975
975
|
};
|
|
976
976
|
}
|
|
977
|
-
return /* @__PURE__ */ M(
|
|
977
|
+
return /* @__PURE__ */ M(i, {
|
|
978
978
|
items: W,
|
|
979
979
|
arrows: "both",
|
|
980
980
|
locate: O({
|
|
@@ -985,27 +985,27 @@ function tt(e) {
|
|
|
985
985
|
}),
|
|
986
986
|
selected: ee,
|
|
987
987
|
onSelect: h,
|
|
988
|
-
render: (e, { inspected:
|
|
988
|
+
render: (e, { inspected: i, cursor: a, selected: o }) => /* @__PURE__ */ M(re, {
|
|
989
989
|
...C,
|
|
990
990
|
figure: e,
|
|
991
991
|
seriesLegend: R && t.length > 0 ? /* @__PURE__ */ M(p, { items: [{
|
|
992
992
|
id: "value",
|
|
993
|
-
label:
|
|
993
|
+
label: r,
|
|
994
994
|
tone: "series1"
|
|
995
995
|
}, {
|
|
996
996
|
id: "baseline",
|
|
997
|
-
label:
|
|
997
|
+
label: f,
|
|
998
998
|
tone: "neutral",
|
|
999
999
|
shape: "tick"
|
|
1000
1000
|
}] }) : void 0,
|
|
1001
|
-
footer: /* @__PURE__ */ M(
|
|
1001
|
+
footer: /* @__PURE__ */ M(s, {
|
|
1002
1002
|
id: P,
|
|
1003
|
-
children:
|
|
1003
|
+
children: n(W, i)
|
|
1004
1004
|
}),
|
|
1005
1005
|
children: t.length === 0 ? /* @__PURE__ */ M(ie, { children: _ }) : /* @__PURE__ */ N(se, { children: [/* @__PURE__ */ N(w, {
|
|
1006
1006
|
plotRef: j.ref,
|
|
1007
1007
|
box: V,
|
|
1008
|
-
label:
|
|
1008
|
+
label: u({
|
|
1009
1009
|
title: A,
|
|
1010
1010
|
marks: "predictions",
|
|
1011
1011
|
isSelectable: h !== void 0
|
|
@@ -1025,20 +1025,20 @@ function tt(e) {
|
|
|
1025
1025
|
})]
|
|
1026
1026
|
}, e.id)),
|
|
1027
1027
|
children: [
|
|
1028
|
-
t.filter((e) => e.id ===
|
|
1028
|
+
t.filter((e) => e.id === i || e.id === o).map((e) => /* @__PURE__ */ M("rect", {
|
|
1029
1029
|
x: V.left,
|
|
1030
1030
|
width: V.innerWidth,
|
|
1031
1031
|
...ue(e.id),
|
|
1032
1032
|
...{
|
|
1033
1033
|
0: { className: "x47corl x2wnxhi" },
|
|
1034
1034
|
1: { className: "x47corl xzmcrz1" }
|
|
1035
|
-
}[e.id ===
|
|
1035
|
+
}[e.id === o | 0]
|
|
1036
1036
|
}, e.id)),
|
|
1037
1037
|
/* @__PURE__ */ M(y, {
|
|
1038
1038
|
box: V,
|
|
1039
1039
|
xTicks: B.valueTicks,
|
|
1040
1040
|
yTicks: [],
|
|
1041
|
-
xTitle:
|
|
1041
|
+
xTitle: d(z),
|
|
1042
1042
|
grid: "x"
|
|
1043
1043
|
}),
|
|
1044
1044
|
/* @__PURE__ */ M(E, {
|
|
@@ -1051,7 +1051,7 @@ function tt(e) {
|
|
|
1051
1051
|
width: Math.abs(i - U),
|
|
1052
1052
|
height: H.bandwidth,
|
|
1053
1053
|
tone: "series1",
|
|
1054
|
-
isSelected: e.id ===
|
|
1054
|
+
isSelected: e.id === o
|
|
1055
1055
|
}), r !== null && /* @__PURE__ */ M(x, {
|
|
1056
1056
|
x1: B.value.position(r),
|
|
1057
1057
|
x2: B.value.position(r),
|
|
@@ -1069,10 +1069,10 @@ function tt(e) {
|
|
|
1069
1069
|
children: t
|
|
1070
1070
|
}, e.id);
|
|
1071
1071
|
}),
|
|
1072
|
-
|
|
1072
|
+
a !== null && /* @__PURE__ */ M("rect", {
|
|
1073
1073
|
x: V.left,
|
|
1074
1074
|
width: V.innerWidth,
|
|
1075
|
-
...ue(
|
|
1075
|
+
...ue(a),
|
|
1076
1076
|
...k.props(Qe.pointerless, Qe.cursor, ae.cursor)
|
|
1077
1077
|
})
|
|
1078
1078
|
]
|