@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,63 +1,126 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as e, m as t } from "./src-Dxs3Buo_.js";
|
|
2
2
|
import { r as n } from "./figure-format-B8kRZMlo.js";
|
|
3
|
+
import { n as r, t as i } from "./clock-DSm5lkNE.js";
|
|
3
4
|
import "@stylexjs/stylex";
|
|
4
|
-
import { createParts as
|
|
5
|
-
import { createContext as
|
|
6
|
-
import { announce as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { Check as
|
|
9
|
-
import { SelectTrigger as
|
|
10
|
-
import { clamp as
|
|
5
|
+
import { createParts as a } from "@ui-sdk/react/primitive";
|
|
6
|
+
import { createContext as o, use as s, useEffect as c, useRef as l } from "react";
|
|
7
|
+
import { announce as u, bindDrag as d, createChange as f, definePrimitive as p, dragThreshold as m, isRTL as h } from "@ui-sdk/core";
|
|
8
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
9
|
+
import { Check as v, ChevronDown as y } from "lucide-react";
|
|
10
|
+
import { SelectTrigger as ee, SelectValue as te } from "@ui-sdk/react/select";
|
|
11
|
+
import { clamp as b, fractionOf as x, scrubTo as S, stepBy as ne, stepFromKey as re, stepValue as C, valueAt as w } from "@ui-sdk/core/number";
|
|
12
|
+
// packages/teaching/src/time/tween.ts
|
|
13
|
+
var T = {
|
|
14
|
+
instant: 0,
|
|
15
|
+
fast: 140,
|
|
16
|
+
regular: 320,
|
|
17
|
+
slow: 640
|
|
18
|
+
}, ie = 4;
|
|
19
|
+
function E() {}
|
|
20
|
+
function D(e) {
|
|
21
|
+
return 1 - (1 - e) ** ie;
|
|
22
|
+
}
|
|
23
|
+
function O(e, t) {
|
|
24
|
+
let n = new Map(Object.entries(t)), r = Object.entries(e);
|
|
25
|
+
return r.length === n.size && r.every(([e, t]) => n.get(e) === t);
|
|
26
|
+
}
|
|
27
|
+
function k(e, t, n) {
|
|
28
|
+
let r = new Map(Object.entries(e));
|
|
29
|
+
return {
|
|
30
|
+
...t,
|
|
31
|
+
...Object.fromEntries(Object.entries(t).map(([e, t]) => {
|
|
32
|
+
let i = r.get(e) ?? t;
|
|
33
|
+
return [e, i + (t - i) * n];
|
|
34
|
+
}))
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function ae(e) {
|
|
38
|
+
let t = /* @__PURE__ */ new Set(), n = {
|
|
39
|
+
shown: e,
|
|
40
|
+
from: e,
|
|
41
|
+
target: e,
|
|
42
|
+
started: -1,
|
|
43
|
+
duration: 0,
|
|
44
|
+
stop: E
|
|
45
|
+
};
|
|
46
|
+
function a(e) {
|
|
47
|
+
n.shown = e;
|
|
48
|
+
for (let e of t) e();
|
|
49
|
+
}
|
|
50
|
+
function o() {
|
|
51
|
+
n.stop(), n.stop = E;
|
|
52
|
+
}
|
|
53
|
+
function s(e) {
|
|
54
|
+
o(), n.target = e, O(n.shown, e) || a(e);
|
|
55
|
+
}
|
|
56
|
+
function c(e) {
|
|
57
|
+
n.started < 0 && (n.started = e);
|
|
58
|
+
let t = Math.min(1, (e - n.started) / n.duration);
|
|
59
|
+
t >= 1 ? (o(), a(n.target)) : a(k(n.from, n.target, D(t)));
|
|
60
|
+
}
|
|
61
|
+
function l(e, t = "regular") {
|
|
62
|
+
O(n.target, e) || (T[t] === 0 || i() ? s(e) : (o(), n.from = n.shown, n.target = e, n.started = -1, n.duration = T[t], n.stop = r(c)));
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
get: () => n.shown,
|
|
66
|
+
to: l,
|
|
67
|
+
jump: s,
|
|
68
|
+
subscribe: (e) => (t.add(e), () => {
|
|
69
|
+
t.delete(e);
|
|
70
|
+
}),
|
|
71
|
+
destroy: o
|
|
72
|
+
};
|
|
73
|
+
}
|
|
11
74
|
// packages/teaching/src/lesson/lesson-locale.ts
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
return
|
|
75
|
+
var A = o(null);
|
|
76
|
+
function oe() {
|
|
77
|
+
return s(A);
|
|
15
78
|
}
|
|
16
79
|
// packages/teaching/src/lesson/lesson-error.tsx
|
|
17
|
-
function
|
|
80
|
+
function j(e, t) {
|
|
18
81
|
throw Error(`Lesson "${e}": ${t}`);
|
|
19
82
|
}
|
|
20
|
-
function
|
|
83
|
+
function M(e) {
|
|
21
84
|
throw Error(`${e} must be rendered inside a <Lesson>. Wrap it in <Lesson lesson={…} locale="…">.`);
|
|
22
85
|
}
|
|
23
|
-
function
|
|
24
|
-
return /* @__PURE__ */
|
|
86
|
+
function N({ children: e }) {
|
|
87
|
+
return /* @__PURE__ */ g("span", {
|
|
25
88
|
role: "note",
|
|
26
89
|
className: "xr5kp14 x1b5ytql",
|
|
27
90
|
children: e
|
|
28
91
|
});
|
|
29
92
|
}
|
|
30
93
|
// packages/teaching/src/lesson/define-lesson.ts
|
|
31
|
-
function
|
|
94
|
+
function P({ name: e, param: t, value: n }) {
|
|
32
95
|
switch (t.kind) {
|
|
33
96
|
case "number": return typeof n == "number" && Number.isFinite(n) && n >= t.min && n <= t.max ? void 0 : `${e} takes a number from ${t.min} to ${t.max}, not ${String(n)}.`;
|
|
34
97
|
case "choice": return t.options.some((e) => e.id === n) ? void 0 : `${e} takes one of ${t.options.map((e) => e.id).join(", ")}, not ${String(n)}.`;
|
|
35
98
|
case "toggle": return typeof n == "boolean" ? void 0 : `${e} takes true or false, not ${String(n)}.`;
|
|
36
99
|
}
|
|
37
100
|
}
|
|
38
|
-
function
|
|
101
|
+
function F(e, t) {
|
|
39
102
|
return Number.isFinite(t.min) && Number.isFinite(t.max) && t.min < t.max ? t.step > 0 ? t.scale === "log" && t.min <= 0 ? `${e} is on a log scale, so its min must be above zero.` : void 0 : `${e} needs a step above zero.` : `${e} needs finite bounds with min below max.`;
|
|
40
103
|
}
|
|
41
|
-
function
|
|
104
|
+
function I(e, t) {
|
|
42
105
|
if (t.kind === "number") {
|
|
43
|
-
let n =
|
|
106
|
+
let n = F(e, t);
|
|
44
107
|
if (n !== void 0) return n;
|
|
45
108
|
}
|
|
46
109
|
if (t.kind === "choice") {
|
|
47
110
|
let n = t.options.map((e) => e.id);
|
|
48
111
|
if (new Set(n).size !== n.length || n.length === 0) return `${e} needs at least one option, each with its own id.`;
|
|
49
112
|
}
|
|
50
|
-
let n =
|
|
113
|
+
let n = P({
|
|
51
114
|
name: e,
|
|
52
115
|
param: t,
|
|
53
116
|
value: t.value
|
|
54
117
|
});
|
|
55
118
|
return n === void 0 ? void 0 : `the default of ${n}`;
|
|
56
119
|
}
|
|
57
|
-
function
|
|
120
|
+
function L(e) {
|
|
58
121
|
return e.find((t, n) => e.indexOf(t) !== n);
|
|
59
122
|
}
|
|
60
|
-
function
|
|
123
|
+
function R(e) {
|
|
61
124
|
let t = /* @__PURE__ */ new Set();
|
|
62
125
|
return {
|
|
63
126
|
view: new Proxy(e, { get(e, n, r) {
|
|
@@ -66,12 +129,12 @@ function j(e) {
|
|
|
66
129
|
names: t
|
|
67
130
|
};
|
|
68
131
|
}
|
|
69
|
-
function
|
|
132
|
+
function z(e, t) {
|
|
70
133
|
let n = new Map(Object.entries(t));
|
|
71
134
|
return (e.states ?? []).flatMap((t) => Object.entries(t.values).flatMap(([r, i]) => {
|
|
72
135
|
let a = n.get(r), o = `state "${t.id}" of beat "${e.id}"`;
|
|
73
136
|
if (a === void 0) return [`${o} sets "${r}", which is not a param.`];
|
|
74
|
-
let s =
|
|
137
|
+
let s = P({
|
|
75
138
|
name: r,
|
|
76
139
|
param: a,
|
|
77
140
|
value: i
|
|
@@ -79,30 +142,34 @@ function M(e, t) {
|
|
|
79
142
|
return s === void 0 ? [] : [`${o}: ${s}`];
|
|
80
143
|
}));
|
|
81
144
|
}
|
|
82
|
-
function
|
|
83
|
-
let n = e.steps ?? 0, r = Number.isInteger(n) && n >= 0, i =
|
|
145
|
+
function B(e, t) {
|
|
146
|
+
let n = e.steps ?? 0, r = Number.isInteger(n) && n >= 0, i = L((e.states ?? []).map((e) => e.id)), a = (e.params ?? []).find((e) => !Object.hasOwn(t, e));
|
|
84
147
|
return [
|
|
85
148
|
...r ? [] : [`beat "${e.id}" needs a whole number of steps, not ${n}.`],
|
|
86
149
|
...i === void 0 ? [] : [`beat "${e.id}" has two states with the id "${i}".`],
|
|
87
|
-
...
|
|
150
|
+
...a === void 0 ? [] : [`beat "${e.id}" owns "${a}", which is not a param.`],
|
|
151
|
+
...z(e, t)
|
|
88
152
|
];
|
|
89
153
|
}
|
|
90
|
-
function
|
|
91
|
-
|
|
154
|
+
function V(e) {
|
|
155
|
+
return e.params ?? [...new Set((e.states ?? []).flatMap((e) => Object.keys(e.values)))];
|
|
156
|
+
}
|
|
157
|
+
function H({ params: e, derivedNames: t, beats: n }) {
|
|
158
|
+
let r = new Set(Object.keys(e)), i = t.find((e) => r.has(e)), a = L(n.map((e) => e.id));
|
|
92
159
|
return [
|
|
93
|
-
...Object.entries(e).flatMap(([e, t]) =>
|
|
160
|
+
...Object.entries(e).flatMap(([e, t]) => I(e, t) ?? []),
|
|
94
161
|
...i === void 0 ? [] : [`"${i}" is declared as both a param and a derived value.`],
|
|
95
162
|
...a === void 0 ? [] : [`two beats share the id "${a}".`],
|
|
96
|
-
...n.flatMap((t) =>
|
|
163
|
+
...n.flatMap((t) => B(t, e))
|
|
97
164
|
];
|
|
98
165
|
}
|
|
99
|
-
function
|
|
100
|
-
let { id: t, title: n, params: r } = e, i = Object.entries(e.derived ?? {}), a = e.beats ?? [], o = Object.keys(r), s = i.map(([e]) => e), [c] =
|
|
166
|
+
function U(e) {
|
|
167
|
+
let { id: t, title: n, params: r } = e, i = Object.entries(e.derived ?? {}), a = e.beats ?? [], o = Object.keys(r), s = i.map(([e]) => e), [c] = H({
|
|
101
168
|
params: r,
|
|
102
169
|
derivedNames: s,
|
|
103
170
|
beats: a
|
|
104
171
|
});
|
|
105
|
-
c !== void 0 &&
|
|
172
|
+
c !== void 0 && j(t, c);
|
|
106
173
|
let l = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, t.value])), u = Object.fromEntries(s.map((e) => [e, NaN]));
|
|
107
174
|
function d(e) {
|
|
108
175
|
let n = {
|
|
@@ -112,8 +179,8 @@ function F(e) {
|
|
|
112
179
|
},
|
|
113
180
|
results: u
|
|
114
181
|
}, r = new Set(o), a = i.map(([e, i]) => {
|
|
115
|
-
let { view: a, names: o } =
|
|
116
|
-
return c !== void 0 &&
|
|
182
|
+
let { view: a, names: o } = R(n.known), s = i.from(a), c = [...o].find((e) => !r.has(e));
|
|
183
|
+
return c !== void 0 && j(t, `derived "${e}" reads "${c}", which is not a param or a derived value declared before it.`), typeof s != "number" && j(t, `derived "${e}" must return a number.`), r.add(e), n.known = {
|
|
117
184
|
...n.known,
|
|
118
185
|
[e]: s
|
|
119
186
|
}, n.results = {
|
|
@@ -148,7 +215,7 @@ function F(e) {
|
|
|
148
215
|
reads: m
|
|
149
216
|
};
|
|
150
217
|
}
|
|
151
|
-
function
|
|
218
|
+
function W(e) {
|
|
152
219
|
return {
|
|
153
220
|
nodes: [...Object.entries(e.params).map(([e, t]) => ({
|
|
154
221
|
name: e,
|
|
@@ -166,21 +233,21 @@ function I(e) {
|
|
|
166
233
|
};
|
|
167
234
|
}
|
|
168
235
|
// packages/teaching/src/lesson/lesson-context.ts
|
|
169
|
-
var
|
|
170
|
-
function
|
|
171
|
-
return
|
|
236
|
+
var G = o(null);
|
|
237
|
+
function K(e) {
|
|
238
|
+
return s(G) ?? M(e);
|
|
172
239
|
}
|
|
173
|
-
function
|
|
240
|
+
function q(e, t) {
|
|
174
241
|
let n = { scope: e };
|
|
175
242
|
for (; n.scope !== null && n.scope.lesson !== t;) n.scope = n.scope.outer;
|
|
176
243
|
return n.scope;
|
|
177
244
|
}
|
|
178
245
|
// packages/teaching/src/lesson/bound-value.tsx
|
|
179
|
-
var
|
|
246
|
+
var se = 240, ce = {
|
|
180
247
|
step: .01,
|
|
181
248
|
large: .1,
|
|
182
249
|
small: .001
|
|
183
|
-
},
|
|
250
|
+
}, le = [
|
|
184
251
|
"ArrowLeft",
|
|
185
252
|
"ArrowRight",
|
|
186
253
|
"ArrowUp",
|
|
@@ -190,23 +257,23 @@ var B = 240, V = {
|
|
|
190
257
|
"Home",
|
|
191
258
|
"End"
|
|
192
259
|
];
|
|
193
|
-
function
|
|
260
|
+
function J({ min: e, max: t, step: n }) {
|
|
194
261
|
return {
|
|
195
262
|
min: e,
|
|
196
263
|
max: t,
|
|
197
264
|
step: n
|
|
198
265
|
};
|
|
199
266
|
}
|
|
200
|
-
function
|
|
201
|
-
let n =
|
|
202
|
-
return
|
|
267
|
+
function Y(e, t) {
|
|
268
|
+
let n = J(t);
|
|
269
|
+
return S(w(b(e, 0, 1), n, t.scale ?? "linear"), n).value;
|
|
203
270
|
}
|
|
204
|
-
function
|
|
271
|
+
function ue(e, t, n) {
|
|
205
272
|
if (t.bound !== void 0) return t.bound === "min" ? n.min : n.max;
|
|
206
|
-
let r =
|
|
207
|
-
return i === e ?
|
|
273
|
+
let r = J(n), i = Y(x(e, r, "log") + t.direction * ce[t.size], n);
|
|
274
|
+
return i === e ? C(e, t.direction, r) : i;
|
|
208
275
|
}
|
|
209
|
-
var
|
|
276
|
+
var de = p({
|
|
210
277
|
name: "bound-value",
|
|
211
278
|
options: {
|
|
212
279
|
value: "number",
|
|
@@ -225,7 +292,7 @@ var K = d({
|
|
|
225
292
|
}),
|
|
226
293
|
sync: (e) => e.value === void 0 ? {} : { value: e.value },
|
|
227
294
|
api: (e) => {
|
|
228
|
-
let { store: t } = e, n =
|
|
295
|
+
let { store: t } = e, n = f(e), r = null;
|
|
229
296
|
e.onDestroy(() => r?.());
|
|
230
297
|
function i(e, r, i) {
|
|
231
298
|
return e !== t.get().value && n("value", e, i === void 0 ? { reason: r } : {
|
|
@@ -238,27 +305,27 @@ var K = d({
|
|
|
238
305
|
setValue(t) {
|
|
239
306
|
let { min: n, max: r } = e.options(), a = Number(t);
|
|
240
307
|
if (!Number.isFinite(a) || a < n || a > r) throw Error(`Give a number between ${n} and ${r}.`);
|
|
241
|
-
return i(
|
|
308
|
+
return i(S(a, J(e.options())).value, "imperative");
|
|
242
309
|
},
|
|
243
310
|
keydown(n, r) {
|
|
244
|
-
let a =
|
|
311
|
+
let a = re(n, { dir: h(r) ? "rtl" : "ltr" });
|
|
245
312
|
if (a === null || n.defaultPrevented) return;
|
|
246
313
|
n.preventDefault();
|
|
247
314
|
let o = e.options(), { value: s } = t.get();
|
|
248
|
-
i(o.scale === "log" ?
|
|
315
|
+
i(o.scale === "log" ? ue(s, a, o) : ne(s, a, J(o)), "step-key", n);
|
|
249
316
|
},
|
|
250
317
|
pointerdown(n, a) {
|
|
251
318
|
if (n.button !== 0) return;
|
|
252
319
|
r?.();
|
|
253
|
-
let o = t.get().value, s =
|
|
254
|
-
r =
|
|
255
|
-
threshold:
|
|
320
|
+
let o = t.get().value, s = h(a) ? -1 : 1, c = x(o, J(e.options()), e.options().scale ?? "linear"), l = 0;
|
|
321
|
+
r = d(a, n, {
|
|
322
|
+
threshold: m,
|
|
256
323
|
cancelOnEscape: !0,
|
|
257
324
|
onStart: () => {
|
|
258
325
|
t.set({ isDragging: !0 });
|
|
259
326
|
},
|
|
260
327
|
onMove: ({ movementX: t, event: n }) => {
|
|
261
|
-
|
|
328
|
+
l += t * s, i(Y(c + l / se, e.options()), "drag", n);
|
|
262
329
|
},
|
|
263
330
|
onEnd: (e, n) => {
|
|
264
331
|
t.set({ isDragging: !1 }), n && i(o, "drag", e);
|
|
@@ -270,7 +337,7 @@ var K = d({
|
|
|
270
337
|
slots: (e) => ({ root: e({
|
|
271
338
|
role: "slider",
|
|
272
339
|
focus: "tab-stop",
|
|
273
|
-
keys: [...
|
|
340
|
+
keys: [...le],
|
|
274
341
|
state: (e, { api: t }) => ({
|
|
275
342
|
text: t.describe(e.value),
|
|
276
343
|
isDragging: e.isDragging
|
|
@@ -291,16 +358,16 @@ var K = d({
|
|
|
291
358
|
}
|
|
292
359
|
}) }),
|
|
293
360
|
agent: { actions: ["setValue"] }
|
|
294
|
-
}),
|
|
295
|
-
function
|
|
361
|
+
}), fe = a(de, { root: "span" }).Root;
|
|
362
|
+
function pe({ min: e, max: t, step: n, scale: r, value: i }) {
|
|
296
363
|
if (!Number.isFinite(e) || !Number.isFinite(t) || e >= t) return "BoundValue needs finite bounds with min below max.";
|
|
297
364
|
if (!Number.isFinite(n) || n < 0) return "BoundValue needs a step of zero or more.";
|
|
298
365
|
if (r === "log" && e <= 0) return "A log BoundValue needs a min above zero.";
|
|
299
366
|
if (i !== void 0 && !(Number.isFinite(i) && i >= e && i <= t)) return `BoundValue ${i} lies outside ${e} to ${t}.`;
|
|
300
367
|
}
|
|
301
|
-
function
|
|
302
|
-
let a =
|
|
303
|
-
return a === void 0 ? /* @__PURE__ */
|
|
368
|
+
function X({ label: e, locale: t, format: r, ...i }) {
|
|
369
|
+
let a = pe(i);
|
|
370
|
+
return a === void 0 ? /* @__PURE__ */ g(fe, {
|
|
304
371
|
...i,
|
|
305
372
|
describe: (e) => n({
|
|
306
373
|
value: e,
|
|
@@ -312,60 +379,60 @@ function Y({ label: e, locale: t, format: r, ...i }) {
|
|
|
312
379
|
"aria-valuemax": i.max,
|
|
313
380
|
"aria-orientation": "horizontal",
|
|
314
381
|
className: "xt0psk2 x1ok0vyi xbixft xss6m8b xk4h15q xuxw1ft x7eptgl x87ps6o xx69xxh xujl8zx xi2nhp4 xewurvo x11xz5oc x1jdncgf xif5pkx x81ozek xxxv2na x13qnu6 x9v5kkp x19rmrnh x7s97pk",
|
|
315
|
-
render: (e, { text: t }) => /* @__PURE__ */
|
|
382
|
+
render: (e, { text: t }) => /* @__PURE__ */ g("span", {
|
|
316
383
|
...e,
|
|
317
384
|
children: t
|
|
318
385
|
})
|
|
319
|
-
}) : /* @__PURE__ */
|
|
386
|
+
}) : /* @__PURE__ */ g("span", {
|
|
320
387
|
className: "xr5kp14 x1b5ytql",
|
|
321
388
|
children: a
|
|
322
389
|
});
|
|
323
390
|
}
|
|
324
391
|
// packages/teaching/src/lesson/inline-choice.tsx
|
|
325
|
-
var
|
|
326
|
-
function
|
|
327
|
-
let a =
|
|
392
|
+
var me = 14;
|
|
393
|
+
function he({ param: e, value: n, isDisabled: r, onChange: i }) {
|
|
394
|
+
let a = e.options.map((e) => ({
|
|
328
395
|
value: e.id,
|
|
329
396
|
label: e.label
|
|
330
397
|
}));
|
|
331
|
-
return /* @__PURE__ */
|
|
398
|
+
return /* @__PURE__ */ _(t.Root, {
|
|
332
399
|
value: n,
|
|
333
400
|
items: a,
|
|
334
401
|
disabled: r,
|
|
335
402
|
onValueChange: (e, t) => {
|
|
336
403
|
e !== null && i(e, t);
|
|
337
404
|
},
|
|
338
|
-
children: [/* @__PURE__ */
|
|
339
|
-
"aria-label":
|
|
405
|
+
children: [/* @__PURE__ */ _(ee, {
|
|
406
|
+
"aria-label": e.label,
|
|
340
407
|
disabled: r,
|
|
341
408
|
className: "x3nfvp2 x1pha0wt xfko13i x1717udv x1ghz6dp xc342km x1ok0vyi xjbqb8w xbixft xjb2p0i x1qlqyl8 x15bjb6t xk4h15q xuxw1ft x1ypdohk xujl8zx xi2nhp4 xewurvo x11xz5oc x1jdncgf xif5pkx x1m8qfh3 x47ym49 x13qnu6 x9v5kkp x19rmrnh x7s97pk",
|
|
342
|
-
children: [/* @__PURE__ */
|
|
343
|
-
size:
|
|
409
|
+
children: [/* @__PURE__ */ g(te, {}), !r && /* @__PURE__ */ g(y, {
|
|
410
|
+
size: me,
|
|
344
411
|
"aria-hidden": !0,
|
|
345
412
|
className: "xamitd3 x153jb6y"
|
|
346
413
|
})]
|
|
347
|
-
}), /* @__PURE__ */
|
|
414
|
+
}), /* @__PURE__ */ g(t.Popup, {
|
|
348
415
|
align: "start",
|
|
349
|
-
children: /* @__PURE__ */
|
|
350
|
-
value:
|
|
351
|
-
children: [/* @__PURE__ */
|
|
416
|
+
children: /* @__PURE__ */ g(t.List, { children: a.map((e) => /* @__PURE__ */ _(t.Item, {
|
|
417
|
+
value: e.value,
|
|
418
|
+
children: [/* @__PURE__ */ g(t.ItemText, { children: e.label }), /* @__PURE__ */ g(t.ItemIndicator, { children: /* @__PURE__ */ g(v, {
|
|
352
419
|
size: 16,
|
|
353
420
|
"aria-hidden": !0
|
|
354
421
|
}) })]
|
|
355
|
-
},
|
|
422
|
+
}, e.value)) })
|
|
356
423
|
})]
|
|
357
424
|
});
|
|
358
425
|
}
|
|
359
426
|
// packages/teaching/src/lesson/param.tsx
|
|
360
|
-
var
|
|
427
|
+
var ge = 700, Z = {
|
|
361
428
|
on: "on",
|
|
362
429
|
off: "off"
|
|
363
430
|
};
|
|
364
|
-
function
|
|
431
|
+
function Q(e, t) {
|
|
365
432
|
let n = new Map(Object.entries(e.lesson.params)).get(t);
|
|
366
433
|
return n === void 0 ? { error: `Lesson "${e.lesson.id}" has no param "${t}". Its params: ${Object.keys(e.lesson.params).join(", ")}.` } : { param: n };
|
|
367
434
|
}
|
|
368
|
-
function
|
|
435
|
+
function $({ param: e, value: t, locale: r, labels: i }) {
|
|
369
436
|
switch (e.kind) {
|
|
370
437
|
case "number": return n({
|
|
371
438
|
value: typeof t == "number" ? t : null,
|
|
@@ -376,22 +443,22 @@ function Q({ param: e, value: t, locale: r, labels: i }) {
|
|
|
376
443
|
case "toggle": return t === !0 ? i.on : i.off;
|
|
377
444
|
}
|
|
378
445
|
}
|
|
379
|
-
function
|
|
380
|
-
let n =
|
|
381
|
-
if ("error" in r) return /* @__PURE__ */
|
|
382
|
-
let { param: i } = r, a = n.state.values[
|
|
446
|
+
function _e({ name: t }) {
|
|
447
|
+
let n = K("Param"), r = Q(n, t);
|
|
448
|
+
if ("error" in r) return /* @__PURE__ */ g(N, { children: r.error });
|
|
449
|
+
let { param: i } = r, a = n.state.values[t], { isReadOnly: o } = n.state;
|
|
383
450
|
switch (i.kind) {
|
|
384
|
-
case "number": return o ? /* @__PURE__ */
|
|
451
|
+
case "number": return o ? /* @__PURE__ */ g("span", {
|
|
385
452
|
className: "xss6m8b xk4h15q xuxw1ft xbixft",
|
|
386
|
-
children:
|
|
453
|
+
children: $({
|
|
387
454
|
param: i,
|
|
388
455
|
value: a,
|
|
389
456
|
locale: n.locale,
|
|
390
|
-
labels:
|
|
457
|
+
labels: Z
|
|
391
458
|
})
|
|
392
|
-
}) : /* @__PURE__ */
|
|
459
|
+
}) : /* @__PURE__ */ g(X, {
|
|
393
460
|
value: typeof a == "number" ? a : i.value,
|
|
394
|
-
onValueChange: (
|
|
461
|
+
onValueChange: (e, r) => n.api.apply(t, e, r),
|
|
395
462
|
min: i.min,
|
|
396
463
|
max: i.max,
|
|
397
464
|
step: i.step,
|
|
@@ -400,41 +467,41 @@ function ce({ name: e }) {
|
|
|
400
467
|
format: i.format,
|
|
401
468
|
label: i.label
|
|
402
469
|
});
|
|
403
|
-
case "choice": return /* @__PURE__ */
|
|
470
|
+
case "choice": return /* @__PURE__ */ g(he, {
|
|
404
471
|
param: i,
|
|
405
472
|
value: typeof a == "string" ? a : i.value,
|
|
406
473
|
isDisabled: o,
|
|
407
|
-
onChange: (
|
|
474
|
+
onChange: (e, r) => n.api.apply(t, e, r)
|
|
408
475
|
});
|
|
409
|
-
case "toggle": return /* @__PURE__ */
|
|
476
|
+
case "toggle": return /* @__PURE__ */ g("span", {
|
|
410
477
|
className: "x3nfvp2 xxymvpz",
|
|
411
|
-
children: /* @__PURE__ */
|
|
478
|
+
children: /* @__PURE__ */ g(e.Root, {
|
|
412
479
|
checked: a === !0,
|
|
413
|
-
onCheckedChange: (
|
|
480
|
+
onCheckedChange: (e, r) => n.api.apply(t, e, r),
|
|
414
481
|
disabled: o,
|
|
415
482
|
"aria-label": i.label,
|
|
416
|
-
children: /* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ g(e.Thumb, {})
|
|
417
484
|
})
|
|
418
485
|
});
|
|
419
486
|
}
|
|
420
487
|
}
|
|
421
|
-
function
|
|
422
|
-
let n =
|
|
423
|
-
|
|
488
|
+
function ve(e, t) {
|
|
489
|
+
let n = l(e);
|
|
490
|
+
c(() => {
|
|
424
491
|
if (t || n.current === e) return;
|
|
425
492
|
let r = globalThis.setTimeout(() => {
|
|
426
|
-
n.current = e,
|
|
427
|
-
},
|
|
493
|
+
n.current = e, u(e);
|
|
494
|
+
}, ge);
|
|
428
495
|
return () => globalThis.clearTimeout(r);
|
|
429
496
|
}, [e, t]);
|
|
430
497
|
}
|
|
431
|
-
function
|
|
432
|
-
let r =
|
|
498
|
+
function ye({ name: e, labels: t }) {
|
|
499
|
+
let r = K("Value"), i = new Map(Object.entries(r.lesson.derived)).get(e), a = i === void 0 ? Q(r, e) : void 0, o = r.values[e], s = i === void 0 ? a !== void 0 && "param" in a ? $({
|
|
433
500
|
param: a.param,
|
|
434
501
|
value: o,
|
|
435
502
|
locale: r.locale,
|
|
436
503
|
labels: {
|
|
437
|
-
...
|
|
504
|
+
...Z,
|
|
438
505
|
...t
|
|
439
506
|
}
|
|
440
507
|
}) : void 0 : n({
|
|
@@ -442,9 +509,9 @@ function $({ name: e, labels: t }) {
|
|
|
442
509
|
locale: r.locale,
|
|
443
510
|
format: i.format
|
|
444
511
|
}), c = i?.label ?? (a !== void 0 && "param" in a ? a.param.label : e);
|
|
445
|
-
return
|
|
512
|
+
return ve(s === void 0 ? "" : `${c}: ${s}`, r.state.playing !== null), s === void 0 ? /* @__PURE__ */ g(N, { children: `Lesson "${r.lesson.id}" has no param or derived value "${e}".` }) : /* @__PURE__ */ g("span", {
|
|
446
513
|
className: "xss6m8b xk4h15q xuxw1ft",
|
|
447
514
|
children: s
|
|
448
515
|
});
|
|
449
516
|
}
|
|
450
|
-
export {
|
|
517
|
+
export { ae as _, G as a, V as c, P as d, N as f, oe as g, A as h, X as i, U as l, M as m, ye as n, q as o, j as p, Q as r, K as s, _e as t, W as u, D as v };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./use-scroll-tab-index-Dxpdh4W7.js";
|
|
2
|
-
import { n as t, r as n } from "./code-block-
|
|
2
|
+
import { n as t, r as n } from "./code-block-BZsY2sh3.js";
|
|
3
3
|
import { t as r } from "./viewer-styles-DsFYri4K.js";
|
|
4
4
|
import * as i from "@stylexjs/stylex";
|
|
5
5
|
import { useCallback as a, useState as o } from "react";
|