@mechane-ai/elements 0.47.0 → 0.48.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 +288 -5
- package/bin/mechane-elements-catalog.mjs +104 -12
- package/dist/article-BXZr10QQ.js +1904 -0
- package/dist/article.js +1 -0
- package/dist/catalog.json +1389 -75
- package/dist/{categorical-values-DdfGIowV.js → categorical-values-BpVq8cFj.js} +1 -1
- package/dist/{cells--Bd1fQFR.js → cells-xVmnQ9oQ.js} +1 -1
- 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 +3 -2
- 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 +2 -2
- package/dist/clock-DSm5lkNE.js +16 -0
- package/dist/collections.js +1 -1
- package/dist/describe-lesson-BmREzDpt.js +175 -0
- package/dist/{dumbbell-plot-B2ZTgQaI.js → dumbbell-plot-DQdTxDeO.js} +6 -5
- package/dist/{embedding-map-CGM_k6lC.js → embedding-map-CF-J-8JW.js} +5 -5
- package/dist/{figure-frame-wRkIEAwe.js → figure-frame-BJ3REgTA.js} +1 -1
- package/dist/forms.js +1 -1
- package/dist/{image-grid-CVA4SOy_.js → image-grid-Dl2sjIMB.js} +3 -3
- package/dist/kits/evaluation.js +5 -5
- package/dist/kits/interpretability.js +9 -9
- package/dist/kits/operations.js +4 -4
- package/dist/kits/training.js +4 -4
- package/dist/lesson/agent.js +811 -0
- package/dist/lesson/spec.js +661 -0
- package/dist/lesson.js +5 -0
- package/dist/mdx.js +227 -0
- package/dist/packages/charts/src/matrix/index.d.ts +1 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +7 -3
- package/dist/packages/teaching/src/agent/index.d.ts +11 -0
- package/dist/packages/teaching/src/agent/learner-trace.d.ts +84 -0
- package/dist/packages/teaching/src/agent/lesson-bridge.d.ts +59 -0
- package/dist/packages/teaching/src/agent/lesson-tour.d.ts +63 -0
- package/dist/packages/teaching/src/agent/tutor-tools.d.ts +86 -0
- package/dist/packages/teaching/src/article/article-checks.d.ts +9 -0
- package/dist/packages/teaching/src/article/article-context.d.ts +49 -0
- package/dist/packages/teaching/src/article/article-error.d.ts +12 -0
- package/dist/packages/teaching/src/article/article-labels.d.ts +54 -0
- package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +14 -0
- package/dist/packages/teaching/src/article/article-outline.d.ts +9 -0
- package/dist/packages/teaching/src/article/article.d.ts +42 -0
- package/dist/packages/teaching/src/article/beat-steps.d.ts +18 -0
- package/dist/packages/teaching/src/article/beat.d.ts +16 -0
- package/dist/packages/teaching/src/article/challenge.d.ts +29 -0
- package/dist/packages/teaching/src/article/exercise-styles.d.ts +76 -0
- package/dist/packages/teaching/src/article/figure.d.ts +51 -0
- package/dist/packages/teaching/src/article/index.d.ts +31 -0
- package/dist/packages/teaching/src/article/lesson-values.d.ts +5 -0
- package/dist/packages/teaching/src/article/notes.d.ts +36 -0
- package/dist/packages/teaching/src/article/outline-types.d.ts +73 -0
- package/dist/packages/teaching/src/article/predict.d.ts +58 -0
- package/dist/packages/teaching/src/article/progress-store.d.ts +64 -0
- package/dist/packages/teaching/src/article/scrolly.d.ts +26 -0
- package/dist/packages/{kits/src/explainers → teaching/src/article}/term.d.ts +8 -2
- package/dist/packages/teaching/src/article/tex.d.ts +12 -0
- package/dist/packages/teaching/src/article/view-essay.d.ts +13 -0
- package/dist/packages/teaching/src/article/view-present.d.ts +8 -0
- package/dist/packages/teaching/src/article/view-sheet.d.ts +7 -0
- package/dist/packages/teaching/src/article/view-static.d.ts +7 -0
- package/dist/packages/teaching/src/article/walk.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/define-lesson.d.ts +136 -0
- package/dist/packages/teaching/src/lesson/index.d.ts +24 -0
- package/dist/packages/teaching/src/lesson/inline-choice.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-context.d.ts +18 -0
- package/dist/packages/teaching/src/lesson/lesson-error.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-locale.d.ts +4 -0
- package/dist/packages/teaching/src/lesson/lesson-persistence.d.ts +17 -0
- package/dist/packages/teaching/src/lesson/lesson-player.d.ts +51 -0
- package/dist/packages/teaching/src/lesson/lesson-store.d.ts +84 -0
- package/dist/packages/teaching/src/lesson/lesson.d.ts +39 -0
- package/dist/packages/teaching/src/lesson/param-controls.d.ts +14 -0
- package/dist/packages/teaching/src/lesson/param.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/playback.d.ts +42 -0
- package/dist/packages/teaching/src/lesson/transport.d.ts +19 -0
- package/dist/packages/teaching/src/lesson/use-lesson.d.ts +36 -0
- package/dist/packages/teaching/src/mdx/essay-components.d.ts +79 -0
- package/dist/packages/teaching/src/mdx/essay-markdown.d.ts +41 -0
- package/dist/packages/teaching/src/mdx/essay.d.ts +32 -0
- package/dist/packages/teaching/src/mdx/index.d.ts +9 -0
- package/dist/packages/teaching/src/mdx/requested-view.d.ts +6 -0
- package/dist/packages/teaching/src/scene/flow/flow-layout.d.ts +38 -0
- package/dist/packages/teaching/src/scene/flow/flow-pulse.d.ts +16 -0
- package/dist/packages/teaching/src/scene/flow/scene-flow.d.ts +81 -0
- package/dist/packages/teaching/src/scene/index.d.ts +77 -0
- package/dist/packages/teaching/src/scene/morph/morph-scope.d.ts +28 -0
- package/dist/packages/teaching/src/scene/plane/plane-hit.d.ts +22 -0
- package/dist/packages/teaching/src/scene/plane/plane-label.d.ts +23 -0
- package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/plane-math.d.ts +45 -0
- package/dist/packages/teaching/src/scene/plane/scene-axes.d.ts +30 -0
- package/dist/packages/teaching/src/scene/plane/scene-curve.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +59 -0
- package/dist/packages/teaching/src/scene/plane/scene-projection.d.ts +27 -0
- package/dist/packages/teaching/src/scene/plane/scene-region.d.ts +38 -0
- package/dist/packages/teaching/src/scene/plane/scene-rule.d.ts +35 -0
- package/dist/packages/teaching/src/scene/plane/scene-vector.d.ts +39 -0
- package/dist/packages/teaching/src/scene/scene-bracket.d.ts +24 -0
- package/dist/packages/teaching/src/scene/scene-callout.d.ts +26 -0
- package/dist/packages/teaching/src/scene/scene-context.d.ts +179 -0
- package/dist/packages/teaching/src/scene/scene-custom.d.ts +31 -0
- package/dist/packages/teaching/src/scene/scene-geometry.d.ts +181 -0
- package/dist/packages/teaching/src/scene/scene-group.d.ts +28 -0
- package/dist/packages/teaching/src/scene/scene-highlight.d.ts +19 -0
- package/dist/packages/teaching/src/scene/scene-layer.d.ts +16 -0
- package/dist/packages/teaching/src/scene/scene-node.d.ts +67 -0
- package/dist/packages/teaching/src/scene/scene-obstacles.d.ts +27 -0
- package/dist/packages/teaching/src/scene/scene-registry.d.ts +79 -0
- package/dist/packages/teaching/src/scene/scene-stagger.d.ts +43 -0
- package/dist/packages/teaching/src/scene/scene-style.d.ts +14 -0
- package/dist/packages/teaching/src/scene/scene-validate.d.ts +65 -0
- package/dist/packages/teaching/src/scene/scene-wire.d.ts +45 -0
- package/dist/packages/teaching/src/scene/scene.d.ts +36 -0
- package/dist/packages/teaching/src/scene/shapes/cell-color.d.ts +11 -0
- package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +69 -0
- package/dist/packages/teaching/src/scene/shapes/scene-card.d.ts +114 -0
- package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +84 -0
- package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +37 -0
- package/dist/packages/teaching/src/scene/shapes/scene-stack.d.ts +46 -0
- package/dist/packages/teaching/src/scene/shapes/scene-token.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/scene-tokens.d.ts +40 -0
- package/dist/packages/teaching/src/scene/shapes/stack-book.d.ts +35 -0
- package/dist/packages/teaching/src/scene/shapes/stack-layout.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/token-layout.d.ts +39 -0
- package/dist/packages/teaching/src/spec/advice.d.ts +23 -0
- package/dist/packages/teaching/src/spec/chart-names.d.ts +2 -0
- package/dist/packages/teaching/src/spec/describe-lesson.d.ts +85 -0
- package/dist/packages/teaching/src/spec/explainer-guide.d.ts +21 -0
- package/dist/packages/teaching/src/spec/findings.d.ts +39 -0
- package/dist/packages/teaching/src/spec/index.d.ts +14 -0
- package/dist/packages/teaching/src/spec/lesson-plan.d.ts +43 -0
- package/dist/packages/teaching/src/spec/validate-plan.d.ts +11 -0
- package/dist/packages/teaching/src/time/clock.d.ts +7 -0
- package/dist/packages/teaching/src/time/tween.d.ts +19 -0
- package/dist/packages/teaching/src/time/use-tween.d.ts +6 -0
- package/dist/param-CqKUTHaO.js +450 -0
- package/dist/{plot-layout-BEuoOHbs.js → plot-layout-CZVSJ-le.js} +2 -1
- package/dist/{plot-marks-A64v7aTw.js → plot-marks-uozcbOIX.js} +15 -12
- package/dist/{plot-surface-CJTIqtck.js → plot-surface-CbVBvgqZ.js} +1 -1
- package/dist/{reference-lines-CWA8VeUR.js → reference-lines-BDcttOp0.js} +2 -2
- package/dist/scene-0z2gbaDE.js +4938 -0
- package/dist/scene.js +1 -0
- package/dist/{slope-chart-DT22h_ym.js → slope-chart-BKVEAVCs.js} +5 -5
- package/dist/{src-1EHkSFS-.js → src-BD6xlvDt.js} +2 -2
- package/dist/{src-D5NXRJZe.js → src-Dcfq8vE4.js} +1 -1
- package/dist/styles2.css +475 -18
- package/dist/{time-series-IB3CB93O.js → time-series-BgzGNOk0.js} +12 -10
- package/dist/{token-heatmap-C00DnoNO.js → token-heatmap-BrW1OsKD.js} +2 -2
- package/dist/{token-predictions-Cxx29iDr.js → token-predictions-yerq_Oet.js} +4 -4
- package/dist/transport-BJweqDPj.js +715 -0
- package/dist/{tree-diagram-DsckNKaW.js → tree-diagram-D09BRqE-.js} +4 -4
- package/dist/{treemap-9_DpLCW9.js → treemap-CW4WsJNL.js} +4 -4
- package/dist/use-tween-5HZ55_9d.js +72 -0
- package/dist/{violin-plot-BhPHKXsN.js → violin-plot-DrtPZ1-T.js} +5 -4
- package/dist/{waterfall-CGksuTy5.js → waterfall-DYLSnGjm.js} +4 -4
- package/package.json +26 -5
- package/recipes/counting-cards.tsx +656 -0
- package/recipes/explorable-essay.tsx +172 -0
- package/skills/extend-elements/SKILL.md +21 -0
- package/skills/plan-lesson/SKILL.md +86 -0
- package/skills/plan-lesson/references/plan-format.md +114 -0
- package/skills/plan-lesson/references/worked-plan.md +171 -0
- package/skills/review-elements/SKILL.md +4 -2
- package/skills/review-explainer/SKILL.md +97 -0
- package/skills/upgrade-elements/references/releases.md +65 -0
- package/skills/use-elements/SKILL.md +18 -16
- package/skills/use-elements/references/kits.md +2 -20
- package/skills/use-elements/references/teaching.md +36 -0
- package/skills/write-explainer/SKILL.md +112 -0
- package/skills/write-explainer/references/article.md +164 -0
- package/skills/write-explainer/references/lesson.md +148 -0
- package/skills/write-explainer/references/mdx.md +78 -0
- package/skills/write-explainer/references/scene-parts.md +273 -0
- package/skills/write-explainer/references/scene.md +168 -0
- package/skills/write-explainer/references/tutor.md +104 -0
- package/skills/write-explainer/references/worked-essay.md +459 -0
- package/templates/essay/AGENTS.md +14 -0
- package/templates/essay/README.md +59 -0
- package/templates/essay/index.html +17 -0
- package/templates/essay/package.template.json +21 -0
- package/templates/essay/plan.json +96 -0
- package/templates/essay/src/essay.mdx +97 -0
- package/templates/essay/src/figures.tsx +92 -0
- package/templates/essay/src/lesson.ts +83 -0
- package/templates/essay/src/main.tsx +53 -0
- package/templates/essay/src/mdx.d.ts +7 -0
- package/templates/essay/tsconfig.template.json +15 -0
- package/templates/essay/vite.config.template.txt +8 -0
- package/dist/kits/explainers.js +0 -452
- package/dist/packages/kits/src/explainers/figures.d.ts +0 -31
- package/dist/packages/kits/src/explainers/index.d.ts +0 -8
- package/dist/packages/kits/src/explainers/story-steps.d.ts +0 -46
- /package/dist/packages/{kits/src/explainers → teaching/src/article}/linked-target.d.ts +0 -0
- /package/dist/packages/{kits/src/explainers → teaching/src/lesson}/bound-value.d.ts +0 -0
package/dist/lesson.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { n as e, t } from "./clock-DSm5lkNE.js";
|
|
2
|
+
import { n, t as r } from "./use-tween-5HZ55_9d.js";
|
|
3
|
+
import { c as i, h as a, i as o, l as s, m as c, n as l, t as u } from "./param-CqKUTHaO.js";
|
|
4
|
+
import { a as d, c as f, i as p, l as m, n as h, o as g, r as _, s as v, t as y, u as b } from "./transport-BJweqDPj.js";
|
|
5
|
+
export { o as BoundValue, m as Lesson, c as LessonLocale, u as Param, p as ParamChoice, d as ParamSlider, g as ParamToggle, h as Playback, y as Transport, l as Value, n as createTween, i as defineLesson, t as isMotionReduced, s as lessonGraph, e as onFrame, b as playbackPaces, v as useLesson, f as useLessonContext, a as useLessonLocale, _ as usePlayback, r as useTween };
|
package/dist/mdx.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { _ as e, b as t, d as n, f as r, g as i, i as ee, l as a, m as o, n as s, p as te, r as c, t as ne, u as re, v as ie, x as ae, y as oe } from "./article-BXZr10QQ.js";
|
|
2
|
+
import { n as se, t as ce } from "./param-CqKUTHaO.js";
|
|
3
|
+
import { a as l, i as u, n as d, o as f, t as p } from "./transport-BJweqDPj.js";
|
|
4
|
+
import { C as m, F as h, G as g, H as _, I as v, J as y, L as b, M as x, N as S, P as C, U as w, W as T, X as E, Y as D, b as O, g as k, i as A, l as j, q as M, r as N, t as P, tt as F, u as I, x as L } from "./scene-0z2gbaDE.js";
|
|
5
|
+
import { t as R } from "./code-block-DioAM2bZ.js";
|
|
6
|
+
import { t as z } from "./content-link-NWuHp5rC.js";
|
|
7
|
+
import * as B from "@stylexjs/stylex";
|
|
8
|
+
import { mergeProps as V } from "@ui-sdk/react/primitive";
|
|
9
|
+
import { Children as H, isValidElement as U, useSyncExternalStore as W } from "react";
|
|
10
|
+
import { jsx as G } from "react/jsx-runtime";
|
|
11
|
+
// packages/teaching/src/mdx/essay-markdown.tsx
|
|
12
|
+
var K = {
|
|
13
|
+
headCell: {
|
|
14
|
+
k8WAf4: "xn9t2bk",
|
|
15
|
+
kg3NbH: "x1doqdfy",
|
|
16
|
+
kt9PQ7: "xso031l",
|
|
17
|
+
kfdmCh: "x1q0q8m5",
|
|
18
|
+
kL6WhQ: "xdjqune",
|
|
19
|
+
kMwMTN: "x153jb6y",
|
|
20
|
+
k63SB2: "x1b5ytql",
|
|
21
|
+
k9WMMc: "x1yc453h",
|
|
22
|
+
$$css: !0
|
|
23
|
+
},
|
|
24
|
+
cell: {
|
|
25
|
+
k8WAf4: "xn9t2bk",
|
|
26
|
+
kg3NbH: "x1doqdfy",
|
|
27
|
+
kt9PQ7: "xso031l",
|
|
28
|
+
kfdmCh: "x1q0q8m5",
|
|
29
|
+
kL6WhQ: "x1qndepd",
|
|
30
|
+
$$css: !0
|
|
31
|
+
},
|
|
32
|
+
aligned: (e) => [{
|
|
33
|
+
k9WMMc: e == null ? e : "x142shqn",
|
|
34
|
+
$$css: !0
|
|
35
|
+
}, { "--x-textAlign": e ?? void 0 }]
|
|
36
|
+
}, le = "math-inline", q = "math-display", ue = "language-";
|
|
37
|
+
function de(e) {
|
|
38
|
+
return /* @__PURE__ */ G("p", { ...V({ className: "xhff0hu" }, e) });
|
|
39
|
+
}
|
|
40
|
+
function J({ children: e, ...t }) {
|
|
41
|
+
return /* @__PURE__ */ G("h3", {
|
|
42
|
+
...V({ className: "x1tku9c6 x14yccmi x1i2cqwi x1ytb0s6 x1b5ytql x1wjjqco x1w2vvpw x37gifx" }, t),
|
|
43
|
+
children: e
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function Y({ children: e, ...t }) {
|
|
47
|
+
return /* @__PURE__ */ G("h4", {
|
|
48
|
+
...V({ className: "x433zq8 x1jfksii x1i2cqwi x1ytb0s6 xk4h15q x37gifx" }, t),
|
|
49
|
+
children: e
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function fe(e) {
|
|
53
|
+
return /* @__PURE__ */ G("ul", { ...V({ className: "xhff0hu x1sbza1b" }, e) });
|
|
54
|
+
}
|
|
55
|
+
function pe(e) {
|
|
56
|
+
return /* @__PURE__ */ G("ol", { ...V({ className: "xhff0hu x1sbza1b" }, e) });
|
|
57
|
+
}
|
|
58
|
+
function me(e) {
|
|
59
|
+
return /* @__PURE__ */ G("li", { ...V({ className: "x1v8es8e x1vblts3" }, e) });
|
|
60
|
+
}
|
|
61
|
+
function he(e) {
|
|
62
|
+
return /* @__PURE__ */ G("blockquote", { ...V({ className: "xhff0hu xrxpjvj xo02m6d xyumdvf x1t7ytsu x97x49r x153jb6y" }, e) });
|
|
63
|
+
}
|
|
64
|
+
function ge(e) {
|
|
65
|
+
return /* @__PURE__ */ G("em", { ...V({ className: "x1k4tb9n" }, e) });
|
|
66
|
+
}
|
|
67
|
+
function _e(e) {
|
|
68
|
+
return /* @__PURE__ */ G("strong", { ...V({ className: "x1b5ytql" }, e) });
|
|
69
|
+
}
|
|
70
|
+
function ve(e) {
|
|
71
|
+
return /* @__PURE__ */ G("hr", { ...V({ className: "x4ire xc342km x178xt8z x13fuv20 xhjagg4" }, e) });
|
|
72
|
+
}
|
|
73
|
+
function ye({ alt: e, ...t }) {
|
|
74
|
+
return /* @__PURE__ */ G("img", {
|
|
75
|
+
alt: e,
|
|
76
|
+
...V({ className: "x1lliihq x193iq5w xt7dq6l xhff0hu x1ok0vyi" }, t)
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function be({ href: e, title: t, children: n }) {
|
|
80
|
+
return /* @__PURE__ */ G(z, {
|
|
81
|
+
href: e,
|
|
82
|
+
title: t,
|
|
83
|
+
children: n
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function xe(e) {
|
|
87
|
+
return /* @__PURE__ */ G("div", {
|
|
88
|
+
className: "xhff0hu xw2csxc",
|
|
89
|
+
children: /* @__PURE__ */ G("table", { ...V({ className: "xh8yej3 x1mwwwfo xtqrqnz x1778rvt xss6m8b" }, e) })
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function Se(e) {
|
|
93
|
+
return /* @__PURE__ */ G("th", { ...V(B.props(K.headCell, e.align !== void 0 && K.aligned(e.align)), e) });
|
|
94
|
+
}
|
|
95
|
+
function Ce(e) {
|
|
96
|
+
return /* @__PURE__ */ G("td", { ...V(B.props(K.cell, e.align !== void 0 && K.aligned(e.align)), e) });
|
|
97
|
+
}
|
|
98
|
+
function X(e) {
|
|
99
|
+
return H.toArray(e).map((e) => typeof e == "string" ? e : "").join("");
|
|
100
|
+
}
|
|
101
|
+
function Z(e, t) {
|
|
102
|
+
return (e ?? "").split(" ").includes(t);
|
|
103
|
+
}
|
|
104
|
+
function we({ className: e, children: t, ...n }) {
|
|
105
|
+
return Z(e, le) ? /* @__PURE__ */ G(c, { children: X(t) }) : Z(e, q) ? /* @__PURE__ */ G(c, {
|
|
106
|
+
isDisplay: !0,
|
|
107
|
+
children: X(t)
|
|
108
|
+
}) : /* @__PURE__ */ G("code", {
|
|
109
|
+
...V({ className: "x10dazmo x14w6jbu x1ok0vyi x1r7kqkb xiard35 xtqrqnz" }, {
|
|
110
|
+
...n,
|
|
111
|
+
className: e
|
|
112
|
+
}),
|
|
113
|
+
children: t
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function Q({ children: e }) {
|
|
117
|
+
let t = H.toArray(e)[0];
|
|
118
|
+
if (!U(t)) return e;
|
|
119
|
+
let { className: n, children: r } = t.props;
|
|
120
|
+
if (Z(n, q)) return t;
|
|
121
|
+
let i = (n ?? "").split(" ").find((e) => e.startsWith(ue));
|
|
122
|
+
return /* @__PURE__ */ G("div", {
|
|
123
|
+
className: "xhff0hu xeuugli",
|
|
124
|
+
children: /* @__PURE__ */ G(R, {
|
|
125
|
+
code: X(r).replace(/\n$/, ""),
|
|
126
|
+
language: i?.slice(9)
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// packages/teaching/src/mdx/essay-components.ts
|
|
131
|
+
var $ = {
|
|
132
|
+
h1: J,
|
|
133
|
+
h2: J,
|
|
134
|
+
h3: Y,
|
|
135
|
+
h4: Y,
|
|
136
|
+
p: de,
|
|
137
|
+
a: be,
|
|
138
|
+
ul: fe,
|
|
139
|
+
ol: pe,
|
|
140
|
+
li: me,
|
|
141
|
+
blockquote: he,
|
|
142
|
+
code: we,
|
|
143
|
+
pre: Q,
|
|
144
|
+
table: xe,
|
|
145
|
+
th: Se,
|
|
146
|
+
td: Ce,
|
|
147
|
+
hr: ve,
|
|
148
|
+
img: ye,
|
|
149
|
+
em: ge,
|
|
150
|
+
strong: _e,
|
|
151
|
+
Beat: e,
|
|
152
|
+
Figure: r,
|
|
153
|
+
FigureReference: te,
|
|
154
|
+
Reveal: o,
|
|
155
|
+
Aside: ie,
|
|
156
|
+
Footnote: t,
|
|
157
|
+
Cite: oe,
|
|
158
|
+
TeX: c,
|
|
159
|
+
Term: s,
|
|
160
|
+
DiagramPart: ne,
|
|
161
|
+
Scrolly: a,
|
|
162
|
+
ScrollyStep: re,
|
|
163
|
+
Predict: n,
|
|
164
|
+
Challenge: i,
|
|
165
|
+
References: ae,
|
|
166
|
+
Param: ce,
|
|
167
|
+
Value: se,
|
|
168
|
+
ParamSlider: l,
|
|
169
|
+
ParamChoice: u,
|
|
170
|
+
ParamToggle: f,
|
|
171
|
+
Playback: d,
|
|
172
|
+
Transport: p,
|
|
173
|
+
Scene: F,
|
|
174
|
+
SceneNode: E,
|
|
175
|
+
SceneWire: D,
|
|
176
|
+
SceneGroup: y,
|
|
177
|
+
SceneBracket: M,
|
|
178
|
+
SceneCallout: g,
|
|
179
|
+
SceneHighlight: T,
|
|
180
|
+
SceneCustom: w,
|
|
181
|
+
SceneAxes: _,
|
|
182
|
+
SceneCurve: b,
|
|
183
|
+
ScenePoint: v,
|
|
184
|
+
SceneVector: x,
|
|
185
|
+
SceneRegion: C,
|
|
186
|
+
SceneRule: S,
|
|
187
|
+
SceneProjection: h,
|
|
188
|
+
SceneCard: m,
|
|
189
|
+
SceneStack: L,
|
|
190
|
+
SceneSlot: O,
|
|
191
|
+
SceneCells: k,
|
|
192
|
+
SceneToken: I,
|
|
193
|
+
SceneTokens: j,
|
|
194
|
+
SceneFlow: A,
|
|
195
|
+
LessonFlow: N,
|
|
196
|
+
MorphScope: P
|
|
197
|
+
}, Te = /* @__PURE__ */ new Map([
|
|
198
|
+
["article", "article"],
|
|
199
|
+
["present", "present"],
|
|
200
|
+
["static", "static"],
|
|
201
|
+
["sheet", "sheet"]
|
|
202
|
+
]);
|
|
203
|
+
function Ee() {
|
|
204
|
+
return Te.get(new URLSearchParams(globalThis.location.search).get("view") ?? "") ?? "article";
|
|
205
|
+
}
|
|
206
|
+
function De() {
|
|
207
|
+
return "article";
|
|
208
|
+
}
|
|
209
|
+
function Oe(e) {
|
|
210
|
+
return globalThis.addEventListener("popstate", e), () => globalThis.removeEventListener("popstate", e);
|
|
211
|
+
}
|
|
212
|
+
function ke() {
|
|
213
|
+
return W(Oe, Ee, De);
|
|
214
|
+
}
|
|
215
|
+
// packages/teaching/src/mdx/essay.tsx
|
|
216
|
+
function Ae({ content: e, components: t, view: n, ...r }) {
|
|
217
|
+
let i = ke();
|
|
218
|
+
return /* @__PURE__ */ G(ee, {
|
|
219
|
+
...r,
|
|
220
|
+
view: n ?? i,
|
|
221
|
+
children: e({ components: {
|
|
222
|
+
...$,
|
|
223
|
+
...t
|
|
224
|
+
} })
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
export { Ae as Essay, $ as essayComponents };
|
|
@@ -9,6 +9,7 @@ export { ConfusionMatrix, confusionMatrixLimits } from './confusion-matrix.tsx';
|
|
|
9
9
|
export type { CorrelationMatrixProps, CorrelationVariable } from './correlation-matrix.tsx';
|
|
10
10
|
export { CorrelationMatrix, correlationMatrixLimits } from './correlation-matrix.tsx';
|
|
11
11
|
export type { HeatmapPalette, HeatmapScale } from './heatmap-scale.ts';
|
|
12
|
+
export { heatmapColor } from './heatmap-scale.ts';
|
|
12
13
|
export { matrixLimits } from './matrix-figure.tsx';
|
|
13
14
|
export type { MatrixAxisItem, MatrixCell, MatrixCellRange, MatrixCellRangeDetails, MatrixCellValuesProps, MatrixCoordinate, } from './matrix-types.ts';
|
|
14
15
|
export { matrixCellId } from './matrix-types.ts';
|
|
@@ -34,9 +34,11 @@ export type DotMarkProps = MarkState & {
|
|
|
34
34
|
/** True for a value that is missing, masked or excluded: an outline with no fill. */
|
|
35
35
|
readonly isHollow?: boolean | undefined;
|
|
36
36
|
readonly emphasis?: MarkEmphasis | undefined;
|
|
37
|
+
/** The record's id, written as `data-chart-mark` so a figure outside the chart can find this mark. */
|
|
38
|
+
readonly mark?: string | undefined;
|
|
37
39
|
};
|
|
38
40
|
/** One observation at a position. */
|
|
39
|
-
export declare function DotMark({ x, y, tone, radius, isHollow, emphasis, isInspected, isSelected, }: DotMarkProps): ReactNode;
|
|
41
|
+
export declare function DotMark({ x, y, tone, radius, isHollow, emphasis, isInspected, isSelected, mark, }: DotMarkProps): ReactNode;
|
|
40
42
|
export type BarMarkProps = MarkState & {
|
|
41
43
|
readonly x: number;
|
|
42
44
|
readonly y: number;
|
|
@@ -45,9 +47,11 @@ export type BarMarkProps = MarkState & {
|
|
|
45
47
|
readonly tone: ChartTone;
|
|
46
48
|
readonly isHollow?: boolean | undefined;
|
|
47
49
|
readonly emphasis?: MarkEmphasis | undefined;
|
|
50
|
+
/** The record's id, written as `data-chart-mark` so a figure outside the chart can find this mark. */
|
|
51
|
+
readonly mark?: string | undefined;
|
|
48
52
|
};
|
|
49
53
|
/** A rectangle whose length carries an amount from a zero baseline, or whose area fills a cell. */
|
|
50
|
-
export declare function BarMark({ x, y, width, height, tone, isHollow, emphasis, isInspected, isSelected, }: BarMarkProps): ReactNode;
|
|
54
|
+
export declare function BarMark({ x, y, width, height, tone, isHollow, emphasis, isInspected, isSelected, mark, }: BarMarkProps): ReactNode;
|
|
51
55
|
/** The outline of a symbol: a shape names a kind of record, so it never relies on hue alone. */
|
|
52
56
|
export type SymbolShape = 'circle' | 'square' | 'diamond';
|
|
53
57
|
export type SymbolMarkProps = DotMarkProps & {
|
|
@@ -57,7 +61,7 @@ export type SymbolMarkProps = DotMarkProps & {
|
|
|
57
61
|
* One record drawn as a circle, a square or a diamond, such as a node whose kind the shape names. A hollow symbol is
|
|
58
62
|
* missing, masked or unexplained. Use `DotMark` when every record has the same kind.
|
|
59
63
|
*/
|
|
60
|
-
export declare function SymbolMark({ shape, x, y, tone, radius, isHollow, emphasis, isInspected, isSelected, }: SymbolMarkProps): ReactNode;
|
|
64
|
+
export declare function SymbolMark({ shape, x, y, tone, radius, isHollow, emphasis, isInspected, isSelected, mark, }: SymbolMarkProps): ReactNode;
|
|
61
65
|
export type LinkMarkProps = {
|
|
62
66
|
/** The path from `linkPath`. */
|
|
63
67
|
readonly d: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents beside a reader. Tutor tools read and move a lesson through the UI SDK agent bridge. A learner trace records
|
|
3
|
+
* what the reader did, and a tour plays a guided walk that pauses when the reader acts.
|
|
4
|
+
*/
|
|
5
|
+
export type { LearnerEvent, LearnerEventKind, LearnerRecord, LearnerTrace } from './learner-trace.ts';
|
|
6
|
+
export { LEARNER_TRACE_LIMIT, createLearnerTrace, summarizeTrace } from './learner-trace.ts';
|
|
7
|
+
export type { AnswerSources, LessonAgent, TutorChange } from './lesson-bridge.ts';
|
|
8
|
+
export type { LessonTour, LessonTourStep, TourHold, TourPlayer, TourStatus } from './lesson-tour.ts';
|
|
9
|
+
export { playTour, tourFromTrace, tourHolds, validateTour } from './lesson-tour.ts';
|
|
10
|
+
export type { ReaderPlace, TutorNotes, TutorResult, TutorSchema, TutorSchemaProperty, TutorTool, } from './tutor-tools.ts';
|
|
11
|
+
export { tutorTools } from './tutor-tools.ts';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { AnyLesson, LessonValue } from '../lesson/define-lesson.ts';
|
|
2
|
+
import type { AnswerSources, LessonAgent } from './lesson-bridge.ts';
|
|
3
|
+
/**
|
|
4
|
+
* What the reader did: moved a param, changed beat or step, started a player, committed a prediction, asked for a hint
|
|
5
|
+
* or reached a challenge.
|
|
6
|
+
*/
|
|
7
|
+
export type LearnerEventKind = 'param' | 'beat' | 'step' | 'play' | 'prediction' | 'hint' | 'challenge';
|
|
8
|
+
/** One thing the reader did, as plain JSON. Repeated moves of one control close together are one event. */
|
|
9
|
+
export type LearnerEvent = {
|
|
10
|
+
/** Milliseconds since the trace began. */
|
|
11
|
+
readonly at: number;
|
|
12
|
+
readonly kind: LearnerEventKind;
|
|
13
|
+
/** The param, `beat`, `step`, or the `Predict` or `Challenge` id. */
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** Before the change. A hint's count, a player's value at its start. */
|
|
16
|
+
readonly from: LessonValue | null;
|
|
17
|
+
/** After the change. A prediction's guess, a hint's count, a player's value where it stopped. */
|
|
18
|
+
readonly to: LessonValue | null;
|
|
19
|
+
/** A committed prediction's answer. Only a prediction the reader committed has one. */
|
|
20
|
+
readonly answer?: number | string | undefined;
|
|
21
|
+
/** Whether a committed prediction was right, within its tolerance. */
|
|
22
|
+
readonly isCorrect?: boolean | undefined;
|
|
23
|
+
/** The beat the reader was on. */
|
|
24
|
+
readonly beat: string | null;
|
|
25
|
+
/** How the reader made the change: `mouse`, `keyboard`, `touch`, `pen`, `virtual`, or `programmatic` for a play. */
|
|
26
|
+
readonly source: string;
|
|
27
|
+
readonly reason: string;
|
|
28
|
+
/** How many changes this event stands for. */
|
|
29
|
+
readonly count: number;
|
|
30
|
+
};
|
|
31
|
+
/** A learner trace as plain JSON, for a tutor prompt, a log or `tourFromTrace`. */
|
|
32
|
+
export type LearnerRecord = {
|
|
33
|
+
readonly lesson: string;
|
|
34
|
+
/** The beat the reader was on when the trace began. */
|
|
35
|
+
readonly startBeat: string | null;
|
|
36
|
+
/** Milliseconds since the trace began. */
|
|
37
|
+
readonly elapsed: number;
|
|
38
|
+
/** The most events the trace keeps; older ones are dropped first. */
|
|
39
|
+
readonly limit: number;
|
|
40
|
+
/** How many older events were dropped. */
|
|
41
|
+
readonly dropped: number;
|
|
42
|
+
readonly events: ReadonlyArray<LearnerEvent>;
|
|
43
|
+
/** Every move to a beat, by the reader or anyone else, so time on each beat is known. */
|
|
44
|
+
readonly visits: ReadonlyArray<{
|
|
45
|
+
readonly at: number;
|
|
46
|
+
readonly beat: string | null;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
/** A running record of what the reader did. */
|
|
50
|
+
export type LearnerTrace = {
|
|
51
|
+
readonly read: () => LearnerRecord;
|
|
52
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
53
|
+
/** Forgets every event and starts the clock again. */
|
|
54
|
+
readonly clear: () => void;
|
|
55
|
+
/** Stops listening. The record stays readable. */
|
|
56
|
+
readonly stop: () => void;
|
|
57
|
+
};
|
|
58
|
+
/** How many events a learner trace keeps unless told otherwise. */
|
|
59
|
+
export declare const LEARNER_TRACE_LIMIT = 400;
|
|
60
|
+
/**
|
|
61
|
+
* Records what the reader does in a lesson, in order, through the agent bridge: param, beat and step moves, players
|
|
62
|
+
* started, and the article's predictions, hints and challenges. Changes an agent makes are left out, and so are a
|
|
63
|
+
* player's own steps. It keeps the last `limit` events.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createLearnerTrace({ agent, lesson, article, limit, now, }: {
|
|
66
|
+
readonly agent: LessonAgent;
|
|
67
|
+
readonly lesson: AnyLesson;
|
|
68
|
+
/** The title of the article whose progress to read. Defaults to the lesson's title, or the page's only article. */
|
|
69
|
+
readonly article?: string | undefined;
|
|
70
|
+
readonly limit?: number | undefined;
|
|
71
|
+
/** The clock, in milliseconds. Defaults to `performance.now`. */
|
|
72
|
+
readonly now?: (() => number) | undefined;
|
|
73
|
+
}): LearnerTrace;
|
|
74
|
+
/**
|
|
75
|
+
* A few sentences of plain facts about what the reader did, for a tutor prompt: time on each beat, how each param
|
|
76
|
+
* moved, plays, predictions, hints and challenges. It interprets nothing.
|
|
77
|
+
*/
|
|
78
|
+
export declare function summarizeTrace({ record, lesson, locale, answers, }: {
|
|
79
|
+
readonly record: LearnerRecord;
|
|
80
|
+
readonly lesson: AnyLesson;
|
|
81
|
+
readonly locale: string;
|
|
82
|
+
/** Where each prediction's answer comes from, so guesses and answers are written in its format. */
|
|
83
|
+
readonly answers?: AnswerSources | undefined;
|
|
84
|
+
}): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AgentComponent, createAgent, ObservedChange } from '../../../foundations/src/agent/index.ts';
|
|
2
|
+
import type { LessonProgress } from '../article/progress-store.ts';
|
|
3
|
+
import type { AnyLesson, LessonValue } from '../lesson/define-lesson.ts';
|
|
4
|
+
/** The UI SDK agent bridge a tutor reads and acts through, as `createAgent()` returns it. */
|
|
5
|
+
export type LessonAgent = ReturnType<typeof createAgent>;
|
|
6
|
+
/** One value that changed: a param, a derived value, the beat or the reveal step. */
|
|
7
|
+
export type TutorChange = {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly from: LessonValue | null;
|
|
10
|
+
readonly to: LessonValue | null;
|
|
11
|
+
};
|
|
12
|
+
/** The lesson as the bridge reports it now: where the reader is and every value. */
|
|
13
|
+
export type LessonReading = {
|
|
14
|
+
/** The lesson's ref in the bridge, for `act` steps. */
|
|
15
|
+
readonly ref: string;
|
|
16
|
+
readonly beat: string | null;
|
|
17
|
+
readonly step: number;
|
|
18
|
+
/** The param whose player is running, or null. */
|
|
19
|
+
readonly playing: string | null;
|
|
20
|
+
/** Every param and derived value. */
|
|
21
|
+
readonly values: Readonly<Record<string, LessonValue>>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The lesson value each `Predict` takes its answer from, by the `Predict` id, as its `answerFrom` prop names it. Tutor
|
|
25
|
+
* tools withhold that value until the reader commits the prediction.
|
|
26
|
+
*/
|
|
27
|
+
export type AnswerSources = Readonly<Record<string, string>>;
|
|
28
|
+
/** The sources of changes a person makes with a pointer, a key or assistive technology. */
|
|
29
|
+
export declare const readerSources: ReadonlySet<string>;
|
|
30
|
+
/** A bridge value as a lesson value, or null when it is not one. */
|
|
31
|
+
export declare function lessonValueOf(value: unknown): LessonValue | null;
|
|
32
|
+
/** Whether a value is a plain object, the shape JSON writes with braces. */
|
|
33
|
+
export declare function isPlainObject(value: unknown): boolean;
|
|
34
|
+
/** The fields of a plain object, or an empty map for anything else. */
|
|
35
|
+
export declare function fieldMap(value: unknown): ReadonlyMap<string, unknown>;
|
|
36
|
+
/** The reader's progress a `lesson-progress` value holds, with anything it does not hold left empty. */
|
|
37
|
+
export declare function progressOf(value: unknown): LessonProgress;
|
|
38
|
+
/** Whether a snapshot entry or a change belongs to this lesson: the `lesson` primitive named by its title. */
|
|
39
|
+
export declare function isLessonEntry(entry: {
|
|
40
|
+
readonly component: string;
|
|
41
|
+
readonly label?: string;
|
|
42
|
+
}, lesson: AnyLesson): boolean;
|
|
43
|
+
/** The lesson's entry in the bridge snapshot, or undefined while it is not on the page or is read-only. */
|
|
44
|
+
export declare function lessonEntry(agent: LessonAgent, lesson: AnyLesson): AgentComponent | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* The `lesson-progress` entry of the article titled `title` in the bridge snapshot. When no entry has that title and
|
|
47
|
+
* the page has only one, it is that one.
|
|
48
|
+
*/
|
|
49
|
+
export declare function progressEntry(agent: LessonAgent, title: string): AgentComponent | undefined;
|
|
50
|
+
/** The param values a bridge value holds, over the lesson's defaults for any it lacks. */
|
|
51
|
+
export declare function paramsOf(lesson: AnyLesson, value: unknown): Readonly<Record<string, LessonValue>>;
|
|
52
|
+
/** Reads the lesson through the bridge snapshot, or undefined while the bridge cannot see it. */
|
|
53
|
+
export declare function readLesson(agent: LessonAgent, lesson: AnyLesson): LessonReading | undefined;
|
|
54
|
+
/** Every value that differs between two readings, the beat, step and player first. */
|
|
55
|
+
export declare function changesBetween(before: LessonReading, after: LessonReading): ReadonlyArray<TutorChange>;
|
|
56
|
+
/** The params that differ between the values before and after a reported lesson change. */
|
|
57
|
+
export declare function paramChanges(lesson: AnyLesson, change: ObservedChange): ReadonlyArray<TutorChange>;
|
|
58
|
+
/** Resolves after the next shared frame, once the page has drawn what an action changed. */
|
|
59
|
+
export declare function nextFrame(): Promise<void>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { AnyLesson, LessonValue } from '../lesson/define-lesson.ts';
|
|
2
|
+
import type { LessonFinding } from '../spec/findings.ts';
|
|
3
|
+
import type { LearnerRecord } from './learner-trace.ts';
|
|
4
|
+
import type { LessonAgent } from './lesson-bridge.ts';
|
|
5
|
+
/** How long a tour stays on a step, in seconds, by name. Tours name a pace and never hold raw durations. */
|
|
6
|
+
export declare const tourHolds: {
|
|
7
|
+
readonly short: 1.5;
|
|
8
|
+
readonly regular: 3;
|
|
9
|
+
readonly long: 6;
|
|
10
|
+
};
|
|
11
|
+
/** A named time a tour stays on one step. */
|
|
12
|
+
export type TourHold = keyof typeof tourHolds;
|
|
13
|
+
/** One step of a tour: where to go, what to show, what to say and how long to stay. Every field is optional. */
|
|
14
|
+
export type LessonTourStep = {
|
|
15
|
+
readonly beat?: string | undefined;
|
|
16
|
+
/** The reveal step inside the beat, from 0. */
|
|
17
|
+
readonly step?: number | undefined;
|
|
18
|
+
/** A state the beat declares, shown in one change. */
|
|
19
|
+
readonly state?: string | undefined;
|
|
20
|
+
readonly values?: Readonly<Record<string, LessonValue>> | undefined;
|
|
21
|
+
/** What the tutor says at this step, handed to `onSay`. */
|
|
22
|
+
readonly say?: string | undefined;
|
|
23
|
+
/** Defaults to `regular`. */
|
|
24
|
+
readonly hold?: TourHold | undefined;
|
|
25
|
+
};
|
|
26
|
+
/** A guided walk through a lesson as plain JSON, written by an author or recorded with `tourFromTrace`. */
|
|
27
|
+
export type LessonTour = ReadonlyArray<LessonTourStep>;
|
|
28
|
+
/** Where a playing tour is: running, paused because the reader acted, finished, stopped or failed on a step. */
|
|
29
|
+
export type TourStatus = 'playing' | 'paused' | 'done' | 'stopped' | 'failed';
|
|
30
|
+
/** A tour that is playing. */
|
|
31
|
+
export type TourPlayer = {
|
|
32
|
+
readonly status: () => TourStatus;
|
|
33
|
+
/** The step shown now, from 0, or -1 before the first. */
|
|
34
|
+
readonly index: () => number;
|
|
35
|
+
/** Why the tour failed, or null. */
|
|
36
|
+
readonly error: () => string | null;
|
|
37
|
+
readonly pause: () => void;
|
|
38
|
+
/** Goes on from the step it paused on, with that step's hold started again. */
|
|
39
|
+
readonly resume: () => void;
|
|
40
|
+
readonly stop: () => void;
|
|
41
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Plays a tour through the agent bridge on the shared clock: each step moves the lesson, says its line and holds. The
|
|
45
|
+
* tour pauses when the reader changes the lesson, and `resume` goes on.
|
|
46
|
+
*/
|
|
47
|
+
export declare function playTour({ agent, lesson, tour, onSay, }: {
|
|
48
|
+
readonly agent: LessonAgent;
|
|
49
|
+
readonly lesson: AnyLesson;
|
|
50
|
+
readonly tour: LessonTour;
|
|
51
|
+
/** Hears each step's line, with the step's index. */
|
|
52
|
+
readonly onSay?: ((say: string, index: number) => void) | undefined;
|
|
53
|
+
}): TourPlayer;
|
|
54
|
+
/**
|
|
55
|
+
* Checks a tour against its lesson before it plays: known beats, reveal steps in range, declared states, values the
|
|
56
|
+
* params take and named holds. Every finding has a path and a sentence.
|
|
57
|
+
*/
|
|
58
|
+
export declare function validateTour(tour: unknown, lesson: AnyLesson): ReadonlyArray<LessonFinding>;
|
|
59
|
+
/**
|
|
60
|
+
* Turns a recorded demonstration into a tour an author can edit: each beat move becomes a step, and the param moves
|
|
61
|
+
* after it become that step's values. Add `say` lines and change holds by hand.
|
|
62
|
+
*/
|
|
63
|
+
export declare function tourFromTrace(record: LearnerRecord): LessonTour;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { LessonProgress } from '../article/progress-store.ts';
|
|
2
|
+
import type { AnyLesson, LessonValue } from '../lesson/define-lesson.ts';
|
|
3
|
+
import type { LessonOutline } from '../spec/describe-lesson.ts';
|
|
4
|
+
import type { AnswerSources, LessonAgent, TutorChange } from './lesson-bridge.ts';
|
|
5
|
+
/** A tool input property as JSON Schema. */
|
|
6
|
+
export type TutorSchemaProperty = {
|
|
7
|
+
readonly type: string | ReadonlyArray<string>;
|
|
8
|
+
readonly description: string;
|
|
9
|
+
readonly enum?: ReadonlyArray<string> | undefined;
|
|
10
|
+
};
|
|
11
|
+
/** A tool's input as JSON Schema: an object with named properties. */
|
|
12
|
+
export type TutorSchema = {
|
|
13
|
+
readonly type: 'object';
|
|
14
|
+
readonly properties: Readonly<Record<string, TutorSchemaProperty>>;
|
|
15
|
+
readonly required: ReadonlyArray<string>;
|
|
16
|
+
};
|
|
17
|
+
/** The current beat's tutor notes. They are for the tutor and are never shown to the reader. */
|
|
18
|
+
export type TutorNotes = {
|
|
19
|
+
readonly goal: string | null;
|
|
20
|
+
readonly misconception: string | null;
|
|
21
|
+
readonly hints: ReadonlyArray<string>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Where the reader is: the beat and reveal step, every value as a number and as the reader reads it. A value a
|
|
25
|
+
* prediction the reader has not committed takes its answer from is left out.
|
|
26
|
+
*/
|
|
27
|
+
export type ReaderPlace = {
|
|
28
|
+
readonly beat: {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly title: string;
|
|
31
|
+
readonly number: number;
|
|
32
|
+
readonly of: number;
|
|
33
|
+
} | null;
|
|
34
|
+
readonly step: number;
|
|
35
|
+
/** The last reveal step of the beat. */
|
|
36
|
+
readonly steps: number;
|
|
37
|
+
/** The param whose player is running, or null. */
|
|
38
|
+
readonly playing: string | null;
|
|
39
|
+
readonly values: Readonly<Record<string, LessonValue>>;
|
|
40
|
+
/** Each value written in its declared format, as the page shows it. */
|
|
41
|
+
readonly written: Readonly<Record<string, string>>;
|
|
42
|
+
readonly notes: TutorNotes;
|
|
43
|
+
/**
|
|
44
|
+
* What the reader has done, from the article's `lesson-progress`: committed predictions with their answers, reached
|
|
45
|
+
* challenges, hints used and beats visited. Null where the page has no article.
|
|
46
|
+
*/
|
|
47
|
+
readonly progress: LessonProgress | null;
|
|
48
|
+
/** The values left out until the reader commits the prediction that takes its answer from each. */
|
|
49
|
+
readonly withheld: ReadonlyArray<string>;
|
|
50
|
+
};
|
|
51
|
+
/** What a tutor tool returns: plain JSON that says what changed, or why nothing could. */
|
|
52
|
+
export type TutorResult = {
|
|
53
|
+
readonly kind: 'ok';
|
|
54
|
+
readonly changed?: ReadonlyArray<TutorChange> | undefined;
|
|
55
|
+
readonly at?: {
|
|
56
|
+
readonly beat: string | null;
|
|
57
|
+
readonly step: number;
|
|
58
|
+
} | undefined;
|
|
59
|
+
readonly place?: ReaderPlace | undefined;
|
|
60
|
+
readonly outline?: LessonOutline | undefined;
|
|
61
|
+
readonly note?: string | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: 'error';
|
|
64
|
+
readonly message: string;
|
|
65
|
+
};
|
|
66
|
+
/** A tool a model can call: its name, what it does, its input as JSON Schema, and the function that runs it. */
|
|
67
|
+
export type TutorTool = {
|
|
68
|
+
readonly name: string;
|
|
69
|
+
readonly description: string;
|
|
70
|
+
readonly inputSchema: TutorSchema;
|
|
71
|
+
readonly run: (input?: unknown) => Promise<TutorResult>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Tools a tutor model can call beside a reader. They read the outline and where the reader is, set params, show states,
|
|
75
|
+
* move between beats, play, pause and inspect figures. Every tool acts through the UI SDK agent bridge, and none
|
|
76
|
+
* reveals a prediction's answer before the reader commits it.
|
|
77
|
+
*/
|
|
78
|
+
export declare function tutorTools({ agent, lesson, locale, article, answers, }: {
|
|
79
|
+
readonly agent: LessonAgent;
|
|
80
|
+
readonly lesson: AnyLesson;
|
|
81
|
+
readonly locale: string;
|
|
82
|
+
/** The title of the article whose progress to read. Defaults to the lesson's title, or the page's only article. */
|
|
83
|
+
readonly article?: string | undefined;
|
|
84
|
+
/** The lesson value each `Predict` takes its answer from, by its id. Tools withhold it until the reader commits. */
|
|
85
|
+
readonly answers?: AnswerSources | undefined;
|
|
86
|
+
}): ReadonlyArray<TutorTool>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AnyLesson } from '../lesson/define-lesson.ts';
|
|
2
|
+
import type { ArticleOutline } from './outline-types.ts';
|
|
3
|
+
/** One problem a beat sheet finds in an article: the beat it concerns, when there is one, and a sentence. */
|
|
4
|
+
export type ArticleFinding = {
|
|
5
|
+
readonly beat: string | null;
|
|
6
|
+
readonly message: string;
|
|
7
|
+
};
|
|
8
|
+
/** The problems a beat sheet lists: missing beats, figures or descriptions, players without controls, idle params. */
|
|
9
|
+
export declare function articleChecks(lesson: AnyLesson, outline: ArticleOutline): ReadonlyArray<ArticleFinding>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AnyLesson, LessonValue } from '../lesson/define-lesson.ts';
|
|
3
|
+
import type { ArticleLabels } from './article-labels.ts';
|
|
4
|
+
import type { ArticleOutline } from './outline-types.ts';
|
|
5
|
+
import type { LessonProgress, ProgressApi } from './progress-store.ts';
|
|
6
|
+
/** How an article arranges its children: a scrolling essay, one beat at a time, a page for print, or a beat sheet. */
|
|
7
|
+
export type ArticleView = 'article' | 'present' | 'static' | 'sheet';
|
|
8
|
+
/** Typesets TeX into React nodes. The application supplies it, such as one built on KaTeX's MathML output. */
|
|
9
|
+
export type ArticleMath = (tex: string, options: {
|
|
10
|
+
readonly isDisplay: boolean;
|
|
11
|
+
}) => ReactNode;
|
|
12
|
+
/** The challenges of an article, kept so a reader's change can be checked against each of them. */
|
|
13
|
+
export type ChallengeRegistry = {
|
|
14
|
+
readonly add: (id: string, isReached: (values: Readonly<Record<string, LessonValue>>) => boolean) => () => void;
|
|
15
|
+
readonly entries: () => ReadonlyArray<readonly [string, (values: Readonly<Record<string, LessonValue>>) => boolean]>;
|
|
16
|
+
/** The lesson's values as the reader last saw them, so a change is judged against where it started. */
|
|
17
|
+
readonly seen: () => Readonly<Record<string, LessonValue>>;
|
|
18
|
+
readonly remember: (values: Readonly<Record<string, LessonValue>>) => void;
|
|
19
|
+
};
|
|
20
|
+
/** What an `Article` shares with its parts. */
|
|
21
|
+
export type ArticleScope = {
|
|
22
|
+
readonly view: ArticleView;
|
|
23
|
+
readonly title: string;
|
|
24
|
+
readonly lesson: AnyLesson;
|
|
25
|
+
readonly locale: string;
|
|
26
|
+
readonly labels: ArticleLabels;
|
|
27
|
+
readonly math: ArticleMath | undefined;
|
|
28
|
+
readonly outline: ArticleOutline;
|
|
29
|
+
readonly progress: LessonProgress;
|
|
30
|
+
readonly progressApi: ProgressApi;
|
|
31
|
+
readonly challenges: ChallengeRegistry;
|
|
32
|
+
};
|
|
33
|
+
export declare const ArticleContext: import("react").Context<ArticleScope | null>;
|
|
34
|
+
/** The nearest article, or null outside every `Article`. */
|
|
35
|
+
export declare function useArticle(): ArticleScope | null;
|
|
36
|
+
/** The beat a part sits in, and whether the reader is on it now. */
|
|
37
|
+
export type BeatScope = {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly isCurrent: boolean;
|
|
40
|
+
/** The reveal step shown, from 0. */
|
|
41
|
+
readonly step: number;
|
|
42
|
+
/** The scrolly step the present view shows, across the beat's scrollies, or null where scrolling walks them. */
|
|
43
|
+
readonly scrolly: number | null;
|
|
44
|
+
};
|
|
45
|
+
export declare const BeatContext: import("react").Context<BeatScope | null>;
|
|
46
|
+
/** The beat around a part, or null outside every `Beat`. */
|
|
47
|
+
export declare function useBeat(): BeatScope | null;
|
|
48
|
+
/** Creates the list of challenges an article checks on each reader's change. */
|
|
49
|
+
export declare function createChallengeRegistry(initial: Readonly<Record<string, LessonValue>>): ChallengeRegistry;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
/** The lesson's inline error on a line of its own, for a part that stands between paragraphs, such as a figure. */
|
|
3
|
+
export declare function BlockError({ children }: {
|
|
4
|
+
readonly children: string;
|
|
5
|
+
}): ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* The error a part shows when it rendered but the article's outline lacks it, because the author wrapped it in a
|
|
8
|
+
* component of their own. The outline reads only the markup the author writes, so it must sit in the children.
|
|
9
|
+
*/
|
|
10
|
+
export declare function unlistedText(part: string, id: string): string;
|
|
11
|
+
/** The error a part shows outside every `Article`. */
|
|
12
|
+
export declare function outsideText(part: string): string;
|