@mechane-ai/elements 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -2
- package/dist/{article-yyNPg6VU.js → article-CRlhq9oA.js} +531 -463
- package/dist/article.js +1 -1
- package/dist/catalog.json +37 -1
- package/dist/{categorical-values-DCznViFp.js → categorical-values-BYP_R5gS.js} +13 -13
- package/dist/charts/cartesian.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 +4 -4
- 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/collections.js +1 -1
- package/dist/{dumbbell-plot-CMv9llfd.js → dumbbell-plot-BC8d_IJy.js} +45 -45
- package/dist/{embedding-map-DC-lgzCq.js → embedding-map-Bj8krO-d.js} +528 -528
- package/dist/figure-frame-koVKcXph.js +323 -0
- package/dist/{image-grid-DHqtj_zs.js → image-grid-CLhol2jy.js} +47 -47
- package/dist/kits/evaluation.js +50 -48
- package/dist/kits/interpretability.js +7 -7
- package/dist/kits/operations.js +4 -4
- package/dist/kits/research.js +346 -264
- package/dist/kits/training.js +3 -3
- package/dist/layout.js +1 -1075
- package/dist/lesson/spec.js +11 -11
- package/dist/lesson.js +4 -4
- package/dist/mdx.js +4 -4
- package/dist/packages/charts/src/chart-inspection.d.ts +4 -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/collections/src/data-table-trigger.d.ts +2 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +2 -0
- package/dist/packages/kits/src/research/collection-page.d.ts +46 -0
- package/dist/packages/kits/src/research/index.d.ts +2 -0
- package/dist/packages/kits/src/research/milestone-path.d.ts +1 -2
- package/dist/packages/kits/src/research/work-heartbeat.d.ts +4 -3
- package/dist/packages/layout/src/detail-page.d.ts +3 -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-BE3VMSkH.js → param-BdqTpZER.js} +166 -99
- package/dist/{plot-layout-Bqe4-0qZ.js → plot-layout-B2xRt-_k.js} +144 -130
- package/dist/{plot-surface-DON6WUmk.js → plot-surface-0cKFwtws.js} +1 -1
- package/dist/{reference-lines-hjuD1rRZ.js → reference-lines-nSxcZVF5.js} +1 -1
- package/dist/{scene-BP0Ue0R5.js → scene-4ePpWdmE.js} +1227 -1125
- package/dist/scene.js +1 -1
- package/dist/{slope-chart-C8eeSgL4.js → slope-chart-DWZIYDty.js} +179 -179
- package/dist/{src-B2rgpWap.js → src-DNclWY4V.js} +1 -1
- package/dist/src-DhWMspwr.js +1085 -0
- package/dist/styles2.css +77 -14
- package/dist/{time-series-BL933QyA.js → time-series-CsngFxr1.js} +952 -948
- package/dist/{token-heatmap-BB65awva.js → token-heatmap-BQLIxPky.js} +84 -84
- package/dist/{token-predictions-Pa8eUGan.js → token-predictions-C3B5L-eO.js} +126 -126
- package/dist/{transport-DzyxVXbL.js → transport-4V9rfYHN.js} +278 -233
- package/dist/{tree-diagram-DJhKBiia.js → tree-diagram-Dau9jeXS.js} +115 -115
- package/dist/{treemap-CxxgABUg.js → treemap-DWrMQndu.js} +27 -27
- package/dist/use-tween-BsaEO862.js +10 -0
- package/dist/{violin-plot-CoAEF_7Z.js → violin-plot-D05ODcyc.js} +123 -123
- package/dist/{waterfall-DdoEXEkT.js → waterfall-BkLLv2Lm.js} +39 -39
- package/package.json +1 -1
- package/recipes/counting-cards.tsx +3 -3
- package/skills/review-elements/SKILL.md +14 -0
- package/skills/review-explainer/SKILL.md +2 -1
- package/skills/upgrade-elements/references/releases.md +61 -0
- package/skills/use-elements/SKILL.md +21 -17
- package/skills/use-elements/references/editorial-restraint.md +40 -0
- package/skills/use-elements/references/styling.md +23 -0
- package/skills/use-elements/references/teaching.md +13 -0
- package/skills/use-elements/references/workspace.md +14 -8
- 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-BjFzbl3m.js +0 -270
- package/dist/use-tween-5HZ55_9d.js +0 -72
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { r as e } from "./tokens.stylex-dF5CACEJ.js";
|
|
2
2
|
import { d as t, l as n, s as r } from "./dates-ckJdYF7t.js";
|
|
3
|
-
import { A as i, D as a, E as o,
|
|
3
|
+
import { A as i, D as a, E as o, M as s, O as c, S as l, a as u, j as d, k as f } from "./plot-layout-B2xRt-_k.js";
|
|
4
4
|
import { i as p } from "./chart-link-AE_xuxiP.js";
|
|
5
5
|
import { n as m, r as h } from "./figure-format-B8kRZMlo.js";
|
|
6
|
-
import { i as g, l as _, n as ee, r as te, t as ne } from "./figure-frame-
|
|
6
|
+
import { i as g, l as _, n as ee, r as te, t as ne } from "./figure-frame-koVKcXph.js";
|
|
7
7
|
import { n as v, t as re } from "./plot-width-D3hTycYX.js";
|
|
8
8
|
import { n as y, r as b, t as ie } from "./heatmap-scale-Zte6Ya-g.js";
|
|
9
9
|
import { t as ae } from "./color-legend-CIo7DhXB.js";
|
|
@@ -88,19 +88,19 @@ var D = {
|
|
|
88
88
|
}, { "--x-boxShadow": e ?? void 0 }]
|
|
89
89
|
};
|
|
90
90
|
function he({ view: e, isSelectable: t, appearance: n, children: r }) {
|
|
91
|
-
let i = e.isInspected || e.isSelected,
|
|
92
|
-
return /* @__PURE__ */ w(
|
|
91
|
+
let i = e.isInspected || e.isSelected, o = t && e.cell !== void 0;
|
|
92
|
+
return /* @__PURE__ */ w(a, {
|
|
93
93
|
value: e.id,
|
|
94
94
|
"data-matrix-row": e.row.id,
|
|
95
95
|
"data-matrix-column": e.column.id,
|
|
96
|
-
render:
|
|
96
|
+
render: o ? /* @__PURE__ */ w("button", {
|
|
97
97
|
type: "button",
|
|
98
98
|
tabIndex: -1,
|
|
99
99
|
"aria-pressed": e.isSelected
|
|
100
100
|
}) : /* @__PURE__ */ w("span", { role: "img" }),
|
|
101
101
|
"aria-label": e.label,
|
|
102
102
|
title: e.label,
|
|
103
|
-
...S.props(...n,
|
|
103
|
+
...S.props(...n, o && D.interactive, e.edges !== void 0 && D.edges(e.edges), i && D.marked, !i && e.isCursor && v.cursor),
|
|
104
104
|
children: r
|
|
105
105
|
});
|
|
106
106
|
}
|
|
@@ -474,61 +474,61 @@ function Ve(e, { lineCharacters: t, font: n }) {
|
|
|
474
474
|
let i = e.split(/(?<=[\s-])/u);
|
|
475
475
|
return r <= t * R && i.every((e) => Array.from(e).length <= t);
|
|
476
476
|
}
|
|
477
|
-
function He({ rows: e, columns: t, cells: n, domain: r, palette:
|
|
478
|
-
let
|
|
477
|
+
function He({ rows: e, columns: t, cells: n, domain: r, palette: i }) {
|
|
478
|
+
let a = y({
|
|
479
479
|
domain: r,
|
|
480
|
-
palette:
|
|
480
|
+
palette: i
|
|
481
481
|
});
|
|
482
|
-
if (
|
|
482
|
+
if (a !== null) return a;
|
|
483
483
|
if (e.length * t.length > I.cells || n.length > I.cells) return `This matrix exceeds the ${I.cells}-cell render limit. Supply a smaller, labelled window.`;
|
|
484
|
-
if (!
|
|
485
|
-
let
|
|
486
|
-
return n.some((e) => !
|
|
484
|
+
if (!s(e) || !s(t) || !s(n)) return "Matrix rows, columns, and cells must have unique identifiers.";
|
|
485
|
+
let o = new Set(e.map((e) => e.id)), c = new Set(t.map((e) => e.id));
|
|
486
|
+
return n.some((e) => !o.has(e.rowId) || !c.has(e.columnId)) ? "Every matrix cell must refer to a supplied row and column." : n.some((e) => e.kind === "value" && !Number.isFinite(e.value)) ? "Measured matrix values must be finite. Use a missing cell for unavailable values." : new Set(n.map((e) => F(e.rowId, e.columnId))).size === n.length ? void 0 : "A matrix coordinate may contain only one cell.";
|
|
487
487
|
}
|
|
488
488
|
function Ue(e) {
|
|
489
489
|
return e?.kind === "value" ? String(e.value) : "";
|
|
490
490
|
}
|
|
491
491
|
function B(t) {
|
|
492
|
-
let { emptyLabel: n, rows: r, columns:
|
|
492
|
+
let { emptyLabel: n, rows: r, columns: a, cells: s, domain: u, palette: f, valueFormat: m, glyphFormat: h = m, valueLabel: v, variant: y, rowTitle: x, columnTitle: C, rowNoun: ue, columnNoun: E, axisFont: D = "text", headers: O = "clip", cellValues: k = "shown", marking: ye, cellLabel: A = (e, t) => `${e.label} → ${t.label}`, valueText: we, copyText: Te = Ue, notes: j = [], problem: Ee, selected: M, onSelectedChange: N, cellRange: P = null, onCellRangeChange: I, ...L } = t, { locale: R, title: Pe } = L, B = oe(), V = se(null), H = re(), We = p();
|
|
493
493
|
if (L.status === "loading") return /* @__PURE__ */ w(g, { ...L });
|
|
494
494
|
let U = Ee ?? He({
|
|
495
495
|
rows: r,
|
|
496
|
-
columns:
|
|
497
|
-
cells:
|
|
498
|
-
domain:
|
|
499
|
-
palette:
|
|
496
|
+
columns: a,
|
|
497
|
+
cells: s,
|
|
498
|
+
domain: u,
|
|
499
|
+
palette: f
|
|
500
500
|
}) ?? ge(P, {
|
|
501
501
|
rows: r,
|
|
502
|
-
columns:
|
|
502
|
+
columns: a
|
|
503
503
|
});
|
|
504
504
|
if (U !== void 0) return /* @__PURE__ */ w(te, {
|
|
505
505
|
...L,
|
|
506
506
|
message: U
|
|
507
507
|
});
|
|
508
|
-
let W = y === "strip", Ge = new Map(
|
|
508
|
+
let W = y === "strip", Ge = new Map(s.map((e) => [F(e.rowId, e.columnId), e]));
|
|
509
509
|
function G(e, t) {
|
|
510
510
|
return Ge.get(F(e, t));
|
|
511
511
|
}
|
|
512
512
|
function Ke(e) {
|
|
513
513
|
return we?.(e) ?? me({
|
|
514
514
|
cell: e,
|
|
515
|
-
domain:
|
|
515
|
+
domain: u,
|
|
516
516
|
locale: R,
|
|
517
517
|
format: m
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
|
-
let qe = Math.max(Array.from(x ?? "").length, ...r.map((e) => Array.from(e.label).length)), K = Math.min(Ae, qe * ke) + je, Je = Ne[k], q = H.width - K - Oe * (
|
|
520
|
+
let qe = Math.max(Array.from(x ?? "").length, ...r.map((e) => Array.from(e.label).length)), K = Math.min(Ae, qe * ke) + je, Je = Ne[k], q = H.width - K - Oe * (a.length + 2), J = Math.min(Je.max, Math.max(Je.min, Math.floor(q / Math.max(1, a.length)))), Ye = Math.floor((J - Me) / ke), Xe = a.some((e) => !Ve(e.label, {
|
|
521
521
|
lineCharacters: Ye,
|
|
522
522
|
font: D
|
|
523
|
-
})), Ze = de(J), Y = r.flatMap((e, t) =>
|
|
523
|
+
})), Ze = de(J), Y = r.flatMap((e, t) => a.flatMap((n, r) => {
|
|
524
524
|
let i = ye?.(e, n);
|
|
525
525
|
if (i === "hidden") return [];
|
|
526
|
-
let a = G(e.id, n.id), o = a?.id ?? F(e.id, n.id), s = a?.kind === "value" && !b(a.value,
|
|
526
|
+
let a = G(e.id, n.id), o = a?.id ?? F(e.id, n.id), s = a?.kind === "value" && !b(a.value, u), c = a?.kind === "value" && k === "shown" ? fe({
|
|
527
527
|
value: a.value,
|
|
528
528
|
locale: R,
|
|
529
529
|
format: h,
|
|
530
530
|
capacity: Ze
|
|
531
|
-
}) : "",
|
|
531
|
+
}) : "", l = a === void 0 ? "·" : pe(a, c, s);
|
|
532
532
|
return [{
|
|
533
533
|
id: o,
|
|
534
534
|
row: e,
|
|
@@ -539,18 +539,18 @@ function B(t) {
|
|
|
539
539
|
mark: i,
|
|
540
540
|
label: `${A(e, n)}: ${Ke(a)}`,
|
|
541
541
|
isOutside: s,
|
|
542
|
-
glyph:
|
|
542
|
+
glyph: l
|
|
543
543
|
}];
|
|
544
|
-
})), X = Y.length < r.length *
|
|
544
|
+
})), X = Y.length < r.length * a.length, Qe = Y.filter((e) => W || e.cell !== void 0).map(({ id: e, label: t }) => ({
|
|
545
545
|
id: e,
|
|
546
546
|
label: t
|
|
547
547
|
})), $e = new Map(Y.map((e) => [e.id, e])), Z = P === null ? void 0 : _e(P, {
|
|
548
548
|
rows: r,
|
|
549
|
-
columns:
|
|
549
|
+
columns: a
|
|
550
550
|
}), et = I !== void 0, tt = Z === void 0 ? void 0 : Ce({
|
|
551
551
|
bounds: Z,
|
|
552
552
|
rows: r,
|
|
553
|
-
columns:
|
|
553
|
+
columns: a,
|
|
554
554
|
rowNoun: ue,
|
|
555
555
|
columnNoun: E,
|
|
556
556
|
count: Y.filter((e) => ve(Z, e.rowIndex, e.columnIndex)).length
|
|
@@ -562,12 +562,12 @@ function B(t) {
|
|
|
562
562
|
}), e !== null && t === "list-navigation") {
|
|
563
563
|
let t = _e(e, {
|
|
564
564
|
rows: r,
|
|
565
|
-
columns:
|
|
565
|
+
columns: a
|
|
566
566
|
}), n = Y.filter((e) => ve(t, e.rowIndex, e.columnIndex)).length;
|
|
567
567
|
ce(Ce({
|
|
568
568
|
bounds: t,
|
|
569
569
|
rows: r,
|
|
570
|
-
columns:
|
|
570
|
+
columns: a,
|
|
571
571
|
rowNoun: ue,
|
|
572
572
|
columnNoun: E,
|
|
573
573
|
count: n
|
|
@@ -593,7 +593,7 @@ function B(t) {
|
|
|
593
593
|
if (n && e.key === "a") {
|
|
594
594
|
let t = xe({
|
|
595
595
|
rows: r,
|
|
596
|
-
columns:
|
|
596
|
+
columns: a
|
|
597
597
|
});
|
|
598
598
|
t !== void 0 && (e.preventDefault(), Q(t, "list-navigation", e.nativeEvent));
|
|
599
599
|
return;
|
|
@@ -602,15 +602,15 @@ function B(t) {
|
|
|
602
602
|
P !== null && Q(null, "list-navigation", e.nativeEvent);
|
|
603
603
|
return;
|
|
604
604
|
}
|
|
605
|
-
let
|
|
606
|
-
if (!e.shiftKey || n || e.altKey ||
|
|
605
|
+
let i = nt(t);
|
|
606
|
+
if (!e.shiftKey || n || e.altKey || i === void 0) return;
|
|
607
607
|
let o = be({
|
|
608
608
|
key: e.key,
|
|
609
609
|
range: P,
|
|
610
|
-
from:
|
|
610
|
+
from: i,
|
|
611
611
|
isReversed: le(e.currentTarget),
|
|
612
612
|
rows: r,
|
|
613
|
-
columns:
|
|
613
|
+
columns: a
|
|
614
614
|
});
|
|
615
615
|
o !== void 0 && (e.preventDefault(), Q(o, "list-navigation", e.nativeEvent));
|
|
616
616
|
}
|
|
@@ -631,18 +631,18 @@ function B(t) {
|
|
|
631
631
|
}, "drag", e.nativeEvent);
|
|
632
632
|
}
|
|
633
633
|
function st(e, t) {
|
|
634
|
-
let n = nt(t),
|
|
634
|
+
let n = nt(t), i = P ?? (n === void 0 ? void 0 : {
|
|
635
635
|
anchor: n,
|
|
636
636
|
end: n
|
|
637
637
|
});
|
|
638
|
-
if (
|
|
638
|
+
if (i === void 0) return;
|
|
639
639
|
let o = Se({
|
|
640
|
-
bounds: _e(
|
|
640
|
+
bounds: _e(i, {
|
|
641
641
|
rows: r,
|
|
642
|
-
columns:
|
|
642
|
+
columns: a
|
|
643
643
|
}),
|
|
644
644
|
rows: r,
|
|
645
|
-
columns:
|
|
645
|
+
columns: a,
|
|
646
646
|
read: ({ rowId: e, columnId: t }) => $e.has(G(e, t)?.id ?? F(e, t)) ? Te(G(e, t)) : ""
|
|
647
647
|
});
|
|
648
648
|
e.preventDefault(), e.clipboardData.setData("text/plain", o);
|
|
@@ -650,8 +650,8 @@ function B(t) {
|
|
|
650
650
|
function ct(t) {
|
|
651
651
|
return new Map(Y.map((n) => {
|
|
652
652
|
let { cell: r, isOutside: i } = n, a = n.mark === "context" ? `color-mix(in srgb, ${e.muted} ${Re}%, ${e.surface})` : r?.kind === "value" && !i ? ie(r.value, {
|
|
653
|
-
domain:
|
|
654
|
-
palette:
|
|
653
|
+
domain: u,
|
|
654
|
+
palette: f
|
|
655
655
|
}) : void 0;
|
|
656
656
|
return [F(n.row.id, n.column.id), {
|
|
657
657
|
id: n.id,
|
|
@@ -670,23 +670,23 @@ function B(t) {
|
|
|
670
670
|
}];
|
|
671
671
|
}));
|
|
672
672
|
}
|
|
673
|
-
let lt = r.length === 0 ||
|
|
673
|
+
let lt = r.length === 0 || a.length === 0, $ = d({
|
|
674
674
|
title: Pe,
|
|
675
675
|
isSelectable: N !== void 0
|
|
676
676
|
}), ut = Y.some((e) => e.glyph === "•"), dt = W || k === "hidden", ft = [
|
|
677
|
-
|
|
678
|
-
|
|
677
|
+
s.some((e) => e.kind === "masked") ? "× Masked" : void 0,
|
|
678
|
+
s.some((e) => e.kind === "missing") ? "— Missing" : void 0,
|
|
679
679
|
Y.some((e) => e.cell === void 0) ? "· Not supplied" : void 0,
|
|
680
|
-
|
|
680
|
+
s.some((e) => e.kind === "value" && !b(e.value, u)) ? "! Outside domain" : void 0,
|
|
681
681
|
dt ? "Inspect a cell for its exact value" : void 0,
|
|
682
682
|
!dt && ut ? "• Inspect a cell for its exact value" : void 0,
|
|
683
683
|
...j,
|
|
684
684
|
et ? "Shift with the arrow keys or a drag marks a block to copy" : void 0
|
|
685
685
|
].filter((e) => e !== void 0);
|
|
686
|
-
return /* @__PURE__ */ w(
|
|
686
|
+
return /* @__PURE__ */ w(o, {
|
|
687
687
|
...We,
|
|
688
688
|
items: Qe,
|
|
689
|
-
columns: W && !X ?
|
|
689
|
+
columns: W && !X ? a.length : void 0,
|
|
690
690
|
place: W && !X ? void 0 : (e) => {
|
|
691
691
|
let t = $e.get(e);
|
|
692
692
|
return t === void 0 ? void 0 : {
|
|
@@ -698,10 +698,10 @@ function B(t) {
|
|
|
698
698
|
},
|
|
699
699
|
selected: M ?? null,
|
|
700
700
|
onSelect: N === void 0 ? void 0 : (e, t) => {
|
|
701
|
-
|
|
701
|
+
s.some((t) => t.id === e) && N(e, t);
|
|
702
702
|
},
|
|
703
703
|
render: (e, t) => {
|
|
704
|
-
let
|
|
704
|
+
let o = ct(t), s = {
|
|
705
705
|
onCopy: (e) => st(e, t.cursor),
|
|
706
706
|
...et ? {
|
|
707
707
|
onKeyDownCapture: (e) => it(e, t.cursor),
|
|
@@ -717,8 +717,8 @@ function B(t) {
|
|
|
717
717
|
figure: e,
|
|
718
718
|
scaleLegend: lt ? void 0 : /* @__PURE__ */ w(ae, {
|
|
719
719
|
label: v,
|
|
720
|
-
domain:
|
|
721
|
-
palette:
|
|
720
|
+
domain: u,
|
|
721
|
+
palette: f,
|
|
722
722
|
valueFormat: m,
|
|
723
723
|
locale: R
|
|
724
724
|
}),
|
|
@@ -730,9 +730,9 @@ function B(t) {
|
|
|
730
730
|
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc",
|
|
731
731
|
children: ft.map((e) => /* @__PURE__ */ w("li", { children: e }, e))
|
|
732
732
|
}),
|
|
733
|
-
/* @__PURE__ */ w(
|
|
733
|
+
/* @__PURE__ */ w(l, {
|
|
734
734
|
id: B,
|
|
735
|
-
children: tt ??
|
|
735
|
+
children: tt ?? i(Qe, t.inspected)
|
|
736
736
|
}),
|
|
737
737
|
/* @__PURE__ */ w(_, {
|
|
738
738
|
label: `${Pe} cells`,
|
|
@@ -753,35 +753,35 @@ function B(t) {
|
|
|
753
753
|
children: lt ? /* @__PURE__ */ w(ne, { children: n }) : /* @__PURE__ */ w("div", {
|
|
754
754
|
ref: H.ref,
|
|
755
755
|
className: "xeuugli",
|
|
756
|
-
children: /* @__PURE__ */ w(
|
|
756
|
+
children: /* @__PURE__ */ w(c, {
|
|
757
757
|
role: "group",
|
|
758
758
|
"aria-label": $,
|
|
759
759
|
"aria-describedby": B,
|
|
760
|
-
...
|
|
760
|
+
...s,
|
|
761
761
|
...{
|
|
762
762
|
0: { className: "xysyzu8 x159tps6 xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x-default-marker" },
|
|
763
763
|
1: { className: "xysyzu8 x159tps6 xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x10dazmo x-default-marker" }
|
|
764
764
|
}[!!W | 0],
|
|
765
765
|
children: W ? /* @__PURE__ */ w(De, {
|
|
766
766
|
rows: r,
|
|
767
|
-
columns:
|
|
767
|
+
columns: a,
|
|
768
768
|
rowTitle: x,
|
|
769
769
|
columnTitle: C,
|
|
770
770
|
font: D,
|
|
771
771
|
headers: O,
|
|
772
|
-
viewAt: (e, t) =>
|
|
772
|
+
viewAt: (e, t) => o.get(F(e, t)),
|
|
773
773
|
isSelectable: N !== void 0
|
|
774
774
|
}) : /* @__PURE__ */ T("table", {
|
|
775
775
|
className: "x1vathgz x1jkpq5q xezivpi x1hz01jw",
|
|
776
776
|
children: [/* @__PURE__ */ T("thead", { children: [C !== void 0 && /* @__PURE__ */ T("tr", { children: [/* @__PURE__ */ w("td", {}), /* @__PURE__ */ w("th", {
|
|
777
|
-
colSpan:
|
|
777
|
+
colSpan: a.length,
|
|
778
778
|
scope: "colgroup",
|
|
779
779
|
className: "x1717udv xy8obcc xas2l8k x1yc453h xuxw1ft xbixft xk4h15q xngumbj",
|
|
780
780
|
children: C
|
|
781
781
|
})] }), /* @__PURE__ */ T("tr", { children: [/* @__PURE__ */ w("th", {
|
|
782
782
|
className: "x1717udv xy8obcc xas2l8k x1yc453h xuxw1ft xbixft xk4h15q xngumbj",
|
|
783
783
|
children: x
|
|
784
|
-
}),
|
|
784
|
+
}), a.map((e) => /* @__PURE__ */ w("th", {
|
|
785
785
|
scope: "col",
|
|
786
786
|
title: e.label,
|
|
787
787
|
...{
|
|
@@ -800,8 +800,8 @@ function B(t) {
|
|
|
800
800
|
...S.props(z.rowText, Ie[D]),
|
|
801
801
|
children: e.label
|
|
802
802
|
})
|
|
803
|
-
}),
|
|
804
|
-
let n =
|
|
803
|
+
}), a.map((t) => {
|
|
804
|
+
let n = o.get(F(e.id, t.id));
|
|
805
805
|
return /* @__PURE__ */ w("td", {
|
|
806
806
|
...S.props(z.cell, z.width(J)),
|
|
807
807
|
children: n === void 0 ? null : /* @__PURE__ */ w(he, {
|
|
@@ -832,8 +832,8 @@ function B(t) {
|
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
// packages/charts/src/matrix/matrix-presets.ts
|
|
835
|
-
function V({ rows: e, columns: t, values: n, noun: r, limit:
|
|
836
|
-
return e.length >
|
|
835
|
+
function V({ rows: e, columns: t, values: n, noun: r, limit: i }) {
|
|
836
|
+
return e.length > i || t.length > i ? `This matrix draws at most ${i} ${r} on each side. Supply a smaller, labelled window.` : !s(e) || !s(t) ? `Matrix ${r} must have unique identifiers.` : n.length === e.length && n.every((e) => e.length === t.length) ? void 0 : `Supply one line of values per row and one value per column, for every ${r}.`;
|
|
837
837
|
}
|
|
838
838
|
function H(e, t, n) {
|
|
839
839
|
return e[t]?.[n] ?? null;
|
|
@@ -850,7 +850,7 @@ function G(e) {
|
|
|
850
850
|
return `${e.index} ${JSON.stringify(e.text)}`;
|
|
851
851
|
}
|
|
852
852
|
function Ke({ sources: e, destinations: t, weights: n, mask: r }) {
|
|
853
|
-
return [...e, ...t].some((e) => !Number.isSafeInteger(e.index) || e.index < 0) ? "Token positions must be whole numbers of zero or more." : [e, t].every((e) => new Set(e.map((e) => e.index)).size === e.length &&
|
|
853
|
+
return [...e, ...t].some((e) => !Number.isSafeInteger(e.index) || e.index < 0) ? "Token positions must be whole numbers of zero or more." : [e, t].every((e) => new Set(e.map((e) => e.index)).size === e.length && s(e)) ? n.flat().some((e) => e !== null && !(e >= 0 && e <= 1)) ? "Attention weights must lie between 0 and 1. Use null for a weight that was not recorded." : r === "causal" && t.some((t, r) => e.some((e, i) => e.index > t.index && H(n, r, i) !== null)) ? "A pair under the causal mask must have a null weight, so masked never reads as zero." : void 0 : "Tokens on each side must have unique identifiers and positions.";
|
|
854
854
|
}
|
|
855
855
|
function qe(e) {
|
|
856
856
|
let { sources: t, destinations: n, weights: r, mask: i = "none", valueLabel: a = "Attention weight", valueFormat: o = Ge, emptyLabel: s = "No tokens were supplied.", ...c } = e, l = n.map((e) => ({
|
|
@@ -1234,18 +1234,18 @@ var $ = {
|
|
|
1234
1234
|
}
|
|
1235
1235
|
}, ut = { tokens: 2048 };
|
|
1236
1236
|
function dt(e) {
|
|
1237
|
-
let { tokens: t, domain: n, palette: r, valueLabel:
|
|
1237
|
+
let { tokens: t, domain: n, palette: r, valueLabel: s, valueFormat: c, selected: u, onSelectedChange: m, ...h } = e, { emptyLabel: re = "No tokens were supplied.", ...y } = h, { locale: x, title: se } = y;
|
|
1238
1238
|
function ce(e) {
|
|
1239
1239
|
return ft({
|
|
1240
1240
|
token: e,
|
|
1241
1241
|
domain: n,
|
|
1242
1242
|
locale: x,
|
|
1243
|
-
format:
|
|
1243
|
+
format: c
|
|
1244
1244
|
});
|
|
1245
1245
|
}
|
|
1246
1246
|
let C = t.map((e) => ({
|
|
1247
1247
|
id: e.id,
|
|
1248
|
-
label: `Token ${e.index}, ${JSON.stringify(e.text)}, ${
|
|
1248
|
+
label: `Token ${e.index}, ${JSON.stringify(e.text)}, ${s}: ${ce(e)}`
|
|
1249
1249
|
})), le = oe(), ue = p();
|
|
1250
1250
|
if (y.status === "loading") return /* @__PURE__ */ w(g, {
|
|
1251
1251
|
...y,
|
|
@@ -1256,27 +1256,27 @@ function dt(e) {
|
|
|
1256
1256
|
domain: n,
|
|
1257
1257
|
palette: r
|
|
1258
1258
|
});
|
|
1259
|
-
return E === null ? /* @__PURE__ */ w(
|
|
1259
|
+
return E === null ? /* @__PURE__ */ w(o, {
|
|
1260
1260
|
...ue,
|
|
1261
1261
|
items: C,
|
|
1262
1262
|
arrows: "both",
|
|
1263
1263
|
selected: u ?? null,
|
|
1264
1264
|
onSelect: m,
|
|
1265
|
-
render: (e, { inspected:
|
|
1265
|
+
render: (e, { inspected: o, cursor: p }) => /* @__PURE__ */ T(ee, {
|
|
1266
1266
|
...y,
|
|
1267
1267
|
figure: e,
|
|
1268
1268
|
scaleLegend: /* @__PURE__ */ w(ae, {
|
|
1269
|
-
label:
|
|
1269
|
+
label: s,
|
|
1270
1270
|
domain: n,
|
|
1271
1271
|
palette: r,
|
|
1272
|
-
valueFormat:
|
|
1272
|
+
valueFormat: c,
|
|
1273
1273
|
locale: x
|
|
1274
1274
|
}),
|
|
1275
|
-
footer: /* @__PURE__ */ w(
|
|
1275
|
+
footer: /* @__PURE__ */ w(l, {
|
|
1276
1276
|
id: le,
|
|
1277
|
-
children:
|
|
1277
|
+
children: i(C, o)
|
|
1278
1278
|
}),
|
|
1279
|
-
children: [t.length === 0 ? /* @__PURE__ */ w(ne, { children: re }) : /* @__PURE__ */ w(
|
|
1279
|
+
children: [t.length === 0 ? /* @__PURE__ */ w(ne, { children: re }) : /* @__PURE__ */ w(f, {
|
|
1280
1280
|
role: "group",
|
|
1281
1281
|
"aria-label": d({
|
|
1282
1282
|
title: se,
|
|
@@ -1285,20 +1285,20 @@ function dt(e) {
|
|
|
1285
1285
|
"aria-describedby": le,
|
|
1286
1286
|
className: "x1ghz6dp xbixft xiard35 xtqrqnz x1778rvt x126k92a xj0a0fe x-default-marker",
|
|
1287
1287
|
children: t.map((e, t) => {
|
|
1288
|
-
let i = u === e.id,
|
|
1289
|
-
return /* @__PURE__ */ w(
|
|
1288
|
+
let i = u === e.id, s = i || o === e.id, c = e.score !== null && !b(e.score, n), l = C[t]?.label;
|
|
1289
|
+
return /* @__PURE__ */ w(a, {
|
|
1290
1290
|
value: e.id,
|
|
1291
1291
|
render: m === void 0 ? /* @__PURE__ */ w("span", {}) : /* @__PURE__ */ w("button", {
|
|
1292
1292
|
type: "button",
|
|
1293
1293
|
tabIndex: -1,
|
|
1294
|
-
"aria-label":
|
|
1294
|
+
"aria-label": l,
|
|
1295
1295
|
"aria-pressed": i
|
|
1296
1296
|
}),
|
|
1297
|
-
title: m === void 0 ?
|
|
1298
|
-
...S.props($.token, e.score === null ||
|
|
1297
|
+
title: m === void 0 ? l : void 0,
|
|
1298
|
+
...S.props($.token, e.score === null || c ? $.missing : $.color(ie(e.score, {
|
|
1299
1299
|
domain: n,
|
|
1300
1300
|
palette: r
|
|
1301
|
-
})), m !== void 0 && $.interactive,
|
|
1301
|
+
})), m !== void 0 && $.interactive, s && $.selected, !s && p === e.id && v.cursor),
|
|
1302
1302
|
children: e.text
|
|
1303
1303
|
}, e.id);
|
|
1304
1304
|
})
|
|
@@ -1315,7 +1315,7 @@ function dt(e) {
|
|
|
1315
1315
|
},
|
|
1316
1316
|
{
|
|
1317
1317
|
id: "value",
|
|
1318
|
-
label:
|
|
1318
|
+
label: s
|
|
1319
1319
|
}
|
|
1320
1320
|
],
|
|
1321
1321
|
rows: t.map((e) => ({
|
|
@@ -1346,7 +1346,7 @@ function pt({ tokens: e, domain: t, palette: n }) {
|
|
|
1346
1346
|
domain: t,
|
|
1347
1347
|
palette: n
|
|
1348
1348
|
});
|
|
1349
|
-
return r === null ? e.length > ut.tokens ? `This token view exceeds the ${ut.tokens}-token render limit. Supply a smaller, labelled window.` : !
|
|
1349
|
+
return r === null ? e.length > ut.tokens ? `This token view exceeds the ${ut.tokens}-token render limit. Supply a smaller, labelled window.` : !s(e) || new Set(e.map((e) => e.index)).size !== e.length ? "Tokens must have unique identifiers and supplied indices." : e.some((e) => {
|
|
1350
1350
|
let t = !Number.isSafeInteger(e.index) || e.index < 0, n = e.score !== null && !Number.isFinite(e.score);
|
|
1351
1351
|
return t || n;
|
|
1352
1352
|
}) ? "Token indices must be nonnegative integers and measured scores must be finite. Use null for unavailable scores." : null : r;
|