@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,15 +1,15 @@
|
|
|
1
1
|
import { c as e } from "./src-9EJskqB_.js";
|
|
2
|
-
import { A as t,
|
|
2
|
+
import { A as t, E as n, M as r, S as i, f as a, j as o, l as s, s as c } from "./plot-layout-B2xRt-_k.js";
|
|
3
3
|
import { i as l } from "./chart-link-AE_xuxiP.js";
|
|
4
4
|
import { a as u } from "./tone-scope-DKiSw-JR.js";
|
|
5
5
|
import { n as d, r as f } from "./figure-format-B8kRZMlo.js";
|
|
6
6
|
import { a as p, o as m, r as ee } from "./scale-C2xgZyZN.js";
|
|
7
7
|
import { t as h } from "./chart-cursor-1mFd48Jc.js";
|
|
8
|
-
import { i as g, l as te, n as ne, r as re, t as _ } from "./figure-frame-
|
|
8
|
+
import { i as g, l as te, n as ne, r as re, t as _ } from "./figure-frame-koVKcXph.js";
|
|
9
9
|
import { n as ie } from "./plot-width-D3hTycYX.js";
|
|
10
10
|
import { t as v } from "./plot-axes-D5S9BnBa.js";
|
|
11
11
|
import { a as y, c as ae, f as oe, r as se } from "./plot-marks-FVsbFkUs.js";
|
|
12
|
-
import { n as ce, r as le, t as ue } from "./plot-surface-
|
|
12
|
+
import { n as ce, r as le, t as ue } from "./plot-surface-0cKFwtws.js";
|
|
13
13
|
import { t as de } from "./locate-Bcg3QcP4.js";
|
|
14
14
|
import * as fe from "@stylexjs/stylex";
|
|
15
15
|
import { useId as pe } from "react";
|
|
@@ -42,7 +42,7 @@ var D = {
|
|
|
42
42
|
$$css: !0
|
|
43
43
|
} };
|
|
44
44
|
function z(e) {
|
|
45
|
-
return
|
|
45
|
+
return s({
|
|
46
46
|
width: Infinity,
|
|
47
47
|
valueLabels: e,
|
|
48
48
|
hasXTitle: !0,
|
|
@@ -62,28 +62,28 @@ function Ee(e, t) {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
function De({ lanes: e, events:
|
|
65
|
+
function De({ lanes: e, events: t, markers: n, domain: i, zone: a }) {
|
|
66
66
|
let o = m(i);
|
|
67
67
|
if (o !== void 0) return o;
|
|
68
68
|
if (a === void 0) return "A function time format needs a timeZone beside it, so the axis ticks fall on that zone.";
|
|
69
|
-
if (e.length > D.lanes ||
|
|
70
|
-
if (!
|
|
71
|
-
let s = new Set(e.map((e) => e.id)), c =
|
|
69
|
+
if (e.length > D.lanes || t.length > D.events) return `This strip draws at most ${D.lanes} lanes and ${D.events} events. Supply a shorter window.`;
|
|
70
|
+
if (!r(e) || !r(t) || !r(n)) return "Lanes, events and markers must each have unique identifiers.";
|
|
71
|
+
let s = new Set(e.map((e) => e.id)), c = t.find((e) => !s.has(e.laneId));
|
|
72
72
|
if (c !== void 0) return `Event ${c.id} names lane ${c.laneId}, which is not supplied.`;
|
|
73
|
-
let l =
|
|
73
|
+
let l = t.find((e) => {
|
|
74
74
|
let t = e.end !== void 0 && (p(e.end, i) || e.end <= e.start);
|
|
75
75
|
return p(e.start, i) || t;
|
|
76
76
|
});
|
|
77
|
-
return l === void 0 ?
|
|
77
|
+
return l === void 0 ? n.some((e) => p(e.at, i)) ? "A marker lies outside the domain." : void 0 : `Event ${l.id} must start inside the domain and, when it has an end, end after its start inside the domain.`;
|
|
78
78
|
}
|
|
79
79
|
function B(e) {
|
|
80
|
-
let { lanes:
|
|
80
|
+
let { lanes: r, events: f, domain: p, markers: m = [], gutterWidth: S, timeFormat: C, timeZone: ge, selected: w, onSelectedChange: T, ..._e } = e, { emptyLabel: E = "No events in this window.", ...D } = _e, { locale: P, title: F } = D, I = le("compact"), L = pe(), R = u(), we = l();
|
|
81
81
|
if (D.status === "loading") return /* @__PURE__ */ b(g, {
|
|
82
82
|
...D,
|
|
83
83
|
height: "compact"
|
|
84
84
|
});
|
|
85
85
|
let z = typeof C == "function" ? ge : C.timeZone, B = De({
|
|
86
|
-
lanes:
|
|
86
|
+
lanes: r,
|
|
87
87
|
events: f,
|
|
88
88
|
markers: m,
|
|
89
89
|
domain: p,
|
|
@@ -100,9 +100,9 @@ function B(e) {
|
|
|
100
100
|
format: C
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
let H =
|
|
103
|
+
let H = s({
|
|
104
104
|
width: I.width,
|
|
105
|
-
valueLabels:
|
|
105
|
+
valueLabels: r.map((e) => e.label),
|
|
106
106
|
hasXTitle: !0,
|
|
107
107
|
hasYTitle: !1
|
|
108
108
|
}), U = S === void 0 ? H : {
|
|
@@ -131,17 +131,17 @@ function B(e) {
|
|
|
131
131
|
track: e.laneId,
|
|
132
132
|
start: e.end === void 0 ? e.start - Y * N : e.start,
|
|
133
133
|
end: e.end === void 0 ? e.start + Y * N : Math.max(e.end, e.start + ke)
|
|
134
|
-
}))), je =
|
|
134
|
+
}))), je = r.map((e) => Math.max(1, ...f.flatMap((t) => t.laneId === e.id ? [(Ae.get(t.id)?.lane ?? 0) + 1] : []))), Me = r.flatMap((e, t) => Array.from({ length: je[t] ?? 1 }, (t, n) => ({
|
|
135
135
|
laneId: e.id,
|
|
136
136
|
row: n
|
|
137
|
-
}))), Ne = J + Me.length * O +
|
|
137
|
+
}))), Ne = J + Me.length * O + r.length * k * 2 + U.bottom, X = c({
|
|
138
138
|
width: I.width,
|
|
139
139
|
height: Ne,
|
|
140
140
|
margins: {
|
|
141
141
|
...U,
|
|
142
142
|
top: J
|
|
143
143
|
}
|
|
144
|
-
}), Z =
|
|
144
|
+
}), Z = r.map((e, t) => {
|
|
145
145
|
let n = Me.findIndex((t) => t.laneId === e.id), r = X.top + t * k * 2 + n * O;
|
|
146
146
|
return {
|
|
147
147
|
lane: e,
|
|
@@ -149,7 +149,7 @@ function B(e) {
|
|
|
149
149
|
start: r,
|
|
150
150
|
end: r + (je[t] ?? 1) * O + 12
|
|
151
151
|
};
|
|
152
|
-
}), Pe =
|
|
152
|
+
}), Pe = a({
|
|
153
153
|
domain: p,
|
|
154
154
|
length: X.innerWidth,
|
|
155
155
|
timeFormat: C,
|
|
@@ -166,15 +166,15 @@ function B(e) {
|
|
|
166
166
|
})), Q = f.map((e, t) => ({
|
|
167
167
|
event: e,
|
|
168
168
|
index: t
|
|
169
|
-
})).toSorted((e, t) => e.event.start === t.event.start ? e.index - t.index : e.event.start - t.event.start).map((e) => e.event).map((e,
|
|
170
|
-
let
|
|
169
|
+
})).toSorted((e, t) => e.event.start === t.event.start ? e.index - t.index : e.event.start - t.event.start).map((e) => e.event).map((e, t) => {
|
|
170
|
+
let n = Z.find((t) => t.lane.id === e.laneId), i = n?.index ?? 0, a = r[i], o = Ae.get(e.id)?.lane ?? 0, s = (n?.start ?? X.top) + k + (o + N) * O, c = G.position(e.start), l = e.end === void 0 ? c : Math.max(c + ye, G.position(e.end)), u = e.tone ?? R({
|
|
171
171
|
id: e.laneId,
|
|
172
172
|
tone: a?.tone,
|
|
173
173
|
index: i
|
|
174
174
|
});
|
|
175
175
|
return {
|
|
176
176
|
event: e,
|
|
177
|
-
rank:
|
|
177
|
+
rank: t,
|
|
178
178
|
laneIndex: i,
|
|
179
179
|
laneLabel: a?.label ?? e.laneId,
|
|
180
180
|
x1: c,
|
|
@@ -193,7 +193,7 @@ function B(e) {
|
|
|
193
193
|
e.detail
|
|
194
194
|
].filter((e) => e !== void 0).join(" · ")
|
|
195
195
|
};
|
|
196
|
-
}), Le = 1 / (
|
|
196
|
+
}), Le = 1 / (r.length * 2 + 1), Re = de({
|
|
197
197
|
marks: Q.map((e) => ({
|
|
198
198
|
id: e.event.id,
|
|
199
199
|
x: (e.x1 + e.x2) * N,
|
|
@@ -206,7 +206,7 @@ function B(e) {
|
|
|
206
206
|
let t = e.x / e.width * X.width, n = e.y / e.height * X.height;
|
|
207
207
|
return Q.findLast((e) => t >= e.x1 - A - xe && t <= e.x2 + A + xe && Math.abs(n - e.y) <= O * N)?.event.id ?? Re(e);
|
|
208
208
|
}
|
|
209
|
-
return /* @__PURE__ */ b(
|
|
209
|
+
return /* @__PURE__ */ b(n, {
|
|
210
210
|
...we,
|
|
211
211
|
items: $,
|
|
212
212
|
place: (e) => {
|
|
@@ -221,19 +221,19 @@ function B(e) {
|
|
|
221
221
|
locate: ze,
|
|
222
222
|
selected: w ?? null,
|
|
223
223
|
onSelect: T,
|
|
224
|
-
render: (e, { inspected:
|
|
225
|
-
let
|
|
224
|
+
render: (e, { inspected: n, cursor: r }) => {
|
|
225
|
+
let a = Q.find((e) => e.event.id === r);
|
|
226
226
|
return /* @__PURE__ */ b(ne, {
|
|
227
227
|
...D,
|
|
228
228
|
figure: e,
|
|
229
|
-
footer: f.length === 0 ? void 0 : /* @__PURE__ */ b(
|
|
229
|
+
footer: f.length === 0 ? void 0 : /* @__PURE__ */ b(i, {
|
|
230
230
|
id: L,
|
|
231
|
-
children:
|
|
231
|
+
children: t($, n)
|
|
232
232
|
}),
|
|
233
233
|
children: f.length === 0 ? /* @__PURE__ */ b(_, { children: E }) : /* @__PURE__ */ x(he, { children: [/* @__PURE__ */ x(ce, {
|
|
234
234
|
plotRef: I.ref,
|
|
235
235
|
box: X,
|
|
236
|
-
label:
|
|
236
|
+
label: o({
|
|
237
237
|
title: F,
|
|
238
238
|
marks: "events",
|
|
239
239
|
isSelectable: T !== void 0
|
|
@@ -261,7 +261,7 @@ function B(e) {
|
|
|
261
261
|
y: e.y,
|
|
262
262
|
radius: A,
|
|
263
263
|
tone: e.tone,
|
|
264
|
-
isInspected:
|
|
264
|
+
isInspected: n === e.event.id,
|
|
265
265
|
isSelected: w === e.event.id
|
|
266
266
|
}, e.event.id) : /* @__PURE__ */ b(se, {
|
|
267
267
|
x: e.x1,
|
|
@@ -269,7 +269,7 @@ function B(e) {
|
|
|
269
269
|
width: e.x2 - e.x1,
|
|
270
270
|
height: ve,
|
|
271
271
|
tone: e.tone,
|
|
272
|
-
isInspected:
|
|
272
|
+
isInspected: n === e.event.id,
|
|
273
273
|
isSelected: w === e.event.id
|
|
274
274
|
}, e.event.id))
|
|
275
275
|
}),
|
|
@@ -288,8 +288,8 @@ function B(e) {
|
|
|
288
288
|
children: n
|
|
289
289
|
})] }, e.id);
|
|
290
290
|
}),
|
|
291
|
-
|
|
292
|
-
x: (
|
|
291
|
+
a !== void 0 && /* @__PURE__ */ b(h, {
|
|
292
|
+
x: (a.x1 + a.x2) * N,
|
|
293
293
|
top: X.top,
|
|
294
294
|
bottom: X.bottom,
|
|
295
295
|
width: Ce
|
|
@@ -489,16 +489,16 @@ function K({ items: t, start: n, end: r, rowLabel: i, summaryLabel: a, emptyLabe
|
|
|
489
489
|
children: oe
|
|
490
490
|
});
|
|
491
491
|
}
|
|
492
|
-
function q({ items: e, start:
|
|
493
|
-
if (!Number.isFinite(
|
|
494
|
-
if (!
|
|
495
|
-
for (let
|
|
496
|
-
let e =
|
|
492
|
+
function q({ items: e, start: t, end: n }) {
|
|
493
|
+
if (!Number.isFinite(t) || !Number.isFinite(n) || !Number.isFinite(n - t) || n < t) return "The timing domain must have finite, ordered endpoints.";
|
|
494
|
+
if (!r(e)) return "Timing records must have unique identifiers.";
|
|
495
|
+
for (let r of e) {
|
|
496
|
+
let e = r.geometry;
|
|
497
497
|
if (e.kind === "interval") {
|
|
498
498
|
if (!Number.isFinite(e.start) || !Number.isFinite(e.end) || e.end < e.start) return "Timing intervals must have finite, ordered endpoints.";
|
|
499
|
-
if (e.start <
|
|
499
|
+
if (e.start < t || e.end > n) return "Timing intervals must fit inside the supplied domain.";
|
|
500
500
|
}
|
|
501
|
-
if (e.kind === "point" && (!Number.isFinite(e.at) || e.at <
|
|
501
|
+
if (e.kind === "point" && (!Number.isFinite(e.at) || e.at < t || e.at > n)) return "Timing points must be finite and fit inside the supplied domain.";
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
504
|
function Oe({ geometry: e, scale: t }) {
|
package/package.json
CHANGED
|
@@ -592,9 +592,9 @@ export const countingEssay = (
|
|
|
592
592
|
caption="The dealt cards, on the table or counted by suit."
|
|
593
593
|
description="The deal scene, or a stacked bar chart with one bar per suit, where each dealt card becomes one segment of its suit's bar."
|
|
594
594
|
reads={['dealt']}
|
|
595
|
+
footer={<ParamChoice name="arrangement" />}
|
|
595
596
|
>
|
|
596
597
|
<CountedCards />
|
|
597
|
-
<ParamChoice name="arrangement" />
|
|
598
598
|
</Figure>
|
|
599
599
|
</Beat>
|
|
600
600
|
<Beat id="practice">
|
|
@@ -602,14 +602,14 @@ export const countingEssay = (
|
|
|
602
602
|
Play the deal with the weight at <Param name="trust" />. At card <Value name="dealt" /> the model gives the next
|
|
603
603
|
suit <Value name="chance" />, a surprise of <Value name="surprise" />.
|
|
604
604
|
</p>
|
|
605
|
+
<Playback name="dealt" pace="slow" />
|
|
605
606
|
<Figure
|
|
606
607
|
id="deal-run"
|
|
607
608
|
caption="The deal played card by card, and the model’s surprise at each card."
|
|
608
609
|
description="Play controls, the deal scene and a curve of the model's surprise at each of the twelve cards, against a flat line at two bits for an even guess."
|
|
609
610
|
reads={['dealt', 'trust']}
|
|
611
|
+
header={<Transport for="dealt" />}
|
|
610
612
|
>
|
|
611
|
-
<Playback name="dealt" pace="slow" />
|
|
612
|
-
<Transport for="dealt" />
|
|
613
613
|
<DealScene />
|
|
614
614
|
<SurpriseCurve />
|
|
615
615
|
</Figure>
|
|
@@ -116,5 +116,19 @@ and its readout.
|
|
|
116
116
|
overlap, the readout stays in view, and the plot does not scroll the page sideways.
|
|
117
117
|
- **No statistic in the chart.** The app computed every quantile, density, bin and fit, with a named transform.
|
|
118
118
|
|
|
119
|
+
## 9. Editorial restraint & layout defaults
|
|
120
|
+
|
|
121
|
+
- **Zero floating clutter on hover.** Hovering table rows must not pop tooltips over adjacent rows, and hovering charts
|
|
122
|
+
must use inline readouts that never obscure curves or clip at container edges.
|
|
123
|
+
- **Aligned gutters.** Every section heading aligns vertically with its body content (`PageSection` insets `summary` and
|
|
124
|
+
`children` automatically; `breakdown` and `CollectionPage` tables span full width edge-to-edge).
|
|
125
|
+
- **Zero card bloat.** Metrics use flat `MetricGrid`, lists use full-width `CollectionPage` / `DataTable`, and
|
|
126
|
+
documentation renders flat—not inside stacked bordered `Panel` cards.
|
|
127
|
+
- **Zero instructional slop.** Remove chart `description` text that explains how to hover/click or repeats the
|
|
128
|
+
title/legend/axes. Keep Overview focused on one glanceable metric strip and one primary visual.
|
|
129
|
+
- **Pinned shell & area-forking rail.** Scrolling `<main>` keeps the rail and sidebar fixed; rail icons fork top-level
|
|
130
|
+
areas rather than duplicating sidebar links; theme/environment controls live behind `railFooter` Settings with zero
|
|
131
|
+
`Sync` / `Refresh` clutter.
|
|
132
|
+
|
|
119
133
|
Not covered by this review: a real screen reader, a physical touch device and right-to-left text. Say so in the report
|
|
120
134
|
unless you ran them.
|
|
@@ -52,7 +52,8 @@ In order of what matters most to a learner:
|
|
|
52
52
|
11. **Narrow width.** At 360 pixels the prose and controls fit, and a scene scrolls inside its own frame rather than the
|
|
53
53
|
page.
|
|
54
54
|
12. **Keyboard.** Every `Param` takes arrow keys; each scene and chart is one Tab stop whose arrow keys reach every
|
|
55
|
-
labelled object; a draggable `ScenePoint`
|
|
55
|
+
labelled object; a draggable `ScenePoint` is its own Tab stop, a slider the arrow keys move; a pressable card turns
|
|
56
|
+
on Enter or Space; in the present view Right, Space and Left move.
|
|
56
57
|
|
|
57
58
|
## 3. Read the code once
|
|
58
59
|
|
|
@@ -2,6 +2,67 @@
|
|
|
2
2
|
|
|
3
3
|
Newest first. Each section lists what an application must change, then what it may adopt.
|
|
4
4
|
|
|
5
|
+
## 0.49.1
|
|
6
|
+
|
|
7
|
+
Fixes from the first essay ported onto the teaching layers. No import changes. An essay written for 0.48 type checks
|
|
8
|
+
unchanged; it prints less and behaves differently in the places below.
|
|
9
|
+
|
|
10
|
+
### Behavior to check
|
|
11
|
+
|
|
12
|
+
- **A chart or scene inside an article `Figure` no longer prints its title or description.** The `Figure` caption names
|
|
13
|
+
the figure, and the chart's `title` stays its accessible name. Remove any caption you shortened to avoid the
|
|
14
|
+
repetition, and move words a reader needs from a chart `description` into the caption or the prose.
|
|
15
|
+
- **A turned-away face is not rendered.** A `SceneNode` or `SceneCard` draws only the face toward the reader, so a
|
|
16
|
+
face-down card has no rank or suit in its text or its accessible name. A face with rich content remounts after a turn.
|
|
17
|
+
A card's `id` still reaches the page: keep it free of the rank and suit when the card may be face down.
|
|
18
|
+
- **`ScenePoint` with `sets` or `onMove` is a slider.** It is its own Tab stop with `role="slider"`, moves on the step
|
|
19
|
+
grid with the arrow keys, takes ten steps with Shift or Page Up and Page Down, and goes to the ends with Home and End.
|
|
20
|
+
It no longer moves while it is the plot's arrow-key cursor.
|
|
21
|
+
- **Scenes are narrower before they scroll.** A wire now asks for the room its stroke, text and arrow need, not a fixed
|
|
22
|
+
64 px. Remove a `minWidth` you set to stop a small diagram scrolling on a phone.
|
|
23
|
+
- **`SceneSlot` `isActive` only marks the slot.** Other objects no longer recede.
|
|
24
|
+
- **A pointer press that acts leaves nothing dimmed.** In a `Scene` with `onSelectedChange`, pressing an object with a
|
|
25
|
+
pointer no longer fades the others. The arrow-key cursor keeps its emphasis.
|
|
26
|
+
- **`SceneCells` column labels wrap** above their column and a long word overhangs instead of being cut.
|
|
27
|
+
- **The essay's text column keeps its measure** at wide widths. A beat's paragraphs were up to 93 characters wide and
|
|
28
|
+
are 68 again.
|
|
29
|
+
- **`Transport` and `ParamSlider` grow** to fill a flex row. A `ParamSlider` wraps below 12rem of room.
|
|
30
|
+
- **No scene text is under 12 px.** Small card corners and token captions were 11 px.
|
|
31
|
+
|
|
32
|
+
### Adopt
|
|
33
|
+
|
|
34
|
+
- **`Article` `hasContents={false}`** leaves the contents list out at every width, for a host with its own navigation.
|
|
35
|
+
Control the beat through `lessonProps`.
|
|
36
|
+
- **Framed figures.** The article `Figure` takes `header` and `footer` strips for a figure's own controls and draws one
|
|
37
|
+
hairline frame around the strips and the visual. `isFramed` frames a figure that has no controls. The strips are inert
|
|
38
|
+
in the static view and the sheet.
|
|
39
|
+
- **`resetBeat`.** `useLesson(lesson).resetBeat(beat)` returns one beat's params to their opening values in one change.
|
|
40
|
+
A beat owns the params its states name, or the ones listed in its new `params` field. `reset()` and `show()` still act
|
|
41
|
+
on the whole lesson.
|
|
42
|
+
- **Timed and eased playback.** `Playback` `pace` also takes `{ run: 'short' | 'regular' | 'long', isEased? }`: the
|
|
43
|
+
whole range plays in 2, 5 or 10 seconds on the shared clock, with an ease-out when asked.
|
|
44
|
+
- **Pressable scene parts.** `Scene` `onSelectedChange` with `selected={null}` makes a press an action, such as turning
|
|
45
|
+
a card over. The new `labels.press` says what a press does in the plot's accessible name.
|
|
46
|
+
- **`SceneWire` `bend`** bows a wire off its line by a signed number of pixels, to pass a node that sits between its
|
|
47
|
+
ends.
|
|
48
|
+
- **`SceneCells` cell `tone` and `isMuted`** color one cell with a chart tone or gray it out.
|
|
49
|
+
- **`CaptionScope` and `useIsCaptioned`** from `/charts` are what the article `Figure` uses. A custom captioned
|
|
50
|
+
container wraps its charts in `CaptionScope` to get the same rule.
|
|
51
|
+
|
|
52
|
+
## 0.49
|
|
53
|
+
|
|
54
|
+
A research kit with the form, text and layout parts it needed. Nothing to change.
|
|
55
|
+
|
|
56
|
+
### Adopt
|
|
57
|
+
|
|
58
|
+
- **A research kit.** `/kits/research` has `FindingCard`, `MilestonePath`, `SpecimenDiff` and `WorkHeartbeat`, for
|
|
59
|
+
tracking research milestones, paired specimen diffs, work reports and findings.
|
|
60
|
+
- **`TokenInput`** from `/forms`, with `fromText`, `toText`, `toLabel` and `defaultCodec`.
|
|
61
|
+
- **`TextMatch`** from `/content`, with `matchRanges`, `matchSegments` and `fuzzyScore`.
|
|
62
|
+
- **`FigureGrid` and `SidebarBrand`** from `/layout`.
|
|
63
|
+
- **Types:** `PanelProps` from the root entry, `MetricChange` from `/collections`, `ScatterDiagonal` from
|
|
64
|
+
`/charts/cartesian` and `LensLayerGroup` from `/kits/interpretability`.
|
|
65
|
+
|
|
5
66
|
## 0.48
|
|
6
67
|
|
|
7
68
|
Elements has a teaching family: lessons, diagrams with identity, explorable essays and tutor tools. It adds six entries
|
|
@@ -31,7 +31,9 @@ callbacks. Do not guess a prop from another library. The same index is at `@mech
|
|
|
31
31
|
|
|
32
32
|
- Import `@mechane-ai/elements/styles.css` once at the app entry. Ordinary React apps need no StyleX compiler.
|
|
33
33
|
- Spread `themeProps.light` or `themeProps.dark` from `/theme` onto the document root, so portaled menus and dialogs
|
|
34
|
-
inherit the theme. The app stores the preference.
|
|
34
|
+
inherit the theme. The app stores the preference. The spread is a `className`: a later `className` on the same element
|
|
35
|
+
replaces it silently, so give the theme its own element or join the class names (see
|
|
36
|
+
[styling](references/styling.md)).
|
|
35
37
|
- Mount one `Toaster` from `/feedback` at the root when the app reports outcomes with `toast`.
|
|
36
38
|
- Supply the app's own reset and fonts. See [styling](references/styling.md) for layers, tokens and a nonce policy.
|
|
37
39
|
|
|
@@ -50,22 +52,24 @@ persistence and every asynchronous operation.
|
|
|
50
52
|
|
|
51
53
|
## Pick the component
|
|
52
54
|
|
|
53
|
-
| The page needs | Use
|
|
54
|
-
| ------------------------------------------------- |
|
|
55
|
-
| An app frame, a page, sections, a record page | `AppShell`, `PageLayout`, `PageSection`, `RecordPage`
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
|
|
|
59
|
-
|
|
|
60
|
-
| A
|
|
61
|
-
| A
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
| A
|
|
67
|
-
|
|
|
68
|
-
| A
|
|
55
|
+
| The page needs | Use | Read |
|
|
56
|
+
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
57
|
+
| An app frame, a page, sections, a record page | `AppShell`, `PageLayout`, `PageSection`, `RecordPage` | [workspace](references/workspace.md) |
|
|
58
|
+
| A searchable, filterable full-width table page | `CollectionPage` (wires top-bar search, filters, chips, shortcuts & optional inspector) | [workspace](references/workspace.md) |
|
|
59
|
+
| Records compared across columns, search, filters | `DataTable` with a `query` | [collections](references/collections.md) |
|
|
60
|
+
| A selected record's fields beside its list | `Inspector`, `Details` | [collections](references/collections.md) |
|
|
61
|
+
| Fields, choices, dates, files, a save | `Field`, the `/forms` controls, `FormActions`, `ConfirmButton` | [forms](references/forms.md) |
|
|
62
|
+
| A trend, comparison, distribution or relationship | One chart from a `/charts/*` entry | [charts](references/charts.md) |
|
|
63
|
+
| A figure an agent or a server writes as JSON | `Figure`, `validateFigureSpec`, `describeFigure` and `chartGuide` from `/charts/figure` | [figures](references/figures.md) |
|
|
64
|
+
| A run, evaluation, research, service or feature | A kit from `/kits/training`, `/kits/evaluation`, `/kits/research`, `/kits/operations`, `/kits/interpretability` | [kits](references/kits.md) |
|
|
65
|
+
| Page focus, zero-card layout, anti-slop copy | Flat `MetricGrid`, hairline sections, `CollectionPage`, concise titles | [editorial restraint](references/editorial-restraint.md) |
|
|
66
|
+
| An explorable essay, a lesson, a moving diagram | `/lesson`, `/scene`, `/article` and `/mdx`, planned with `/lesson/spec` | [teaching](references/teaching.md) |
|
|
67
|
+
| A first read, a refresh, an empty or failed read | `AsyncRegion`, `LoadingScope`, `EmptyState`, `Notice` | [reports](references/reports.md) |
|
|
68
|
+
| A command menu, a decision, an anchored panel | `Menu`, `AlertDialog`, `Dialog`, `Drawer`, `Popover`, `Tooltip` | the catalog |
|
|
69
|
+
| Route destinations or panels inside one view | `PageNavigation` for links, `Tabs` or `ContentTabs` for panels | [workspace](references/workspace.md) |
|
|
70
|
+
| A transcript, a prompt, tool activity, approvals | `Conversation`, `Message`, `PromptInput`, `Approval` | [conversations](references/conversations.md) |
|
|
71
|
+
| Markdown, source, a diff, a file tree, a log | `/content/markdown`, `/content/code`, `/content/diff`, `/content/tree`, `/content` | the catalog |
|
|
72
|
+
| A model or browser agent that reads and acts | `createAgent` and `registerTools` from `/agent` | [agent access](references/agent.md) |
|
|
69
73
|
|
|
70
74
|
## Start from a recipe
|
|
71
75
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Editorial restraint & Lego-block defaults
|
|
2
|
+
|
|
3
|
+
Elements apps are calm, hairline-divided analytical workspaces—not card grids or prose-heavy dashboards.
|
|
4
|
+
|
|
5
|
+
## One page, one question
|
|
6
|
+
|
|
7
|
+
- Give every route a single job.
|
|
8
|
+
- **Overview** answers _"Where do things stand?"_ with one flat `MetricGrid` and one primary visual (fitting cleanly on
|
|
9
|
+
a single desktop viewport). Move deep attribution charts, comparison tables, and logs onto dedicated routes or
|
|
10
|
+
`PageLayout.navigation` tabs.
|
|
11
|
+
- Prefer smaller, click-through pages and right-hand `Workbench` / `Drawer` inspectors over vertical stacks of four or
|
|
12
|
+
more charts.
|
|
13
|
+
|
|
14
|
+
## Zero-card default
|
|
15
|
+
|
|
16
|
+
- Place `MetricGrid`, charts, and Markdown directly inside `PageSection` (which supplies the standard gutter
|
|
17
|
+
automatically).
|
|
18
|
+
- Place tabular lists edge-to-edge using `CollectionPage` or `PageSection.breakdown`.
|
|
19
|
+
- Do **not** wrap metric strips, tables, list items, or documentation in bordered `Panel` cards. Hairline dividers and
|
|
20
|
+
consistent gutters already separate sections cleanly.
|
|
21
|
+
|
|
22
|
+
## Zero-slop copy budget
|
|
23
|
+
|
|
24
|
+
- Omit chart `description` unless it communicates non-obvious data provenance (sample window, split, or filter). Never
|
|
25
|
+
write UI instructions (`"Hover to inspect..."`, `"Click any cell..."`, `"Check rows to filter"`) or restate what the
|
|
26
|
+
title, axes, and legend already show (`"Dashed curve marks..."`, `"Higher is better..."`).
|
|
27
|
+
- Keep table rows scannable: concise single-line primary labels, short badge tokens, and tabular numbers. Put long prose
|
|
28
|
+
and raw metadata in the click-through inspector pane or drawer.
|
|
29
|
+
- Never show raw backend slugs (`w5_v3_d1536_t115...`) in primary labels; map them to short human labels and keep the
|
|
30
|
+
raw identifier in the inspector with `CopyValue`.
|
|
31
|
+
|
|
32
|
+
## Shell & collection Lego blocks
|
|
33
|
+
|
|
34
|
+
- **Area-forking rail:** Put top-level areas in `AppShell.rail` and Settings/account controls in `AppShell.railFooter`.
|
|
35
|
+
Swap `AppShell.sidebar` to show only the active area's pages—never duplicate every page on both the rail and sidebar.
|
|
36
|
+
- **No sync/status clutter:** Use silent background polling for live telemetry; omit manual `Sync` / `Refresh` buttons
|
|
37
|
+
and footer timestamp pills from primary pages. Keep theme and environment controls under Settings.
|
|
38
|
+
- **Use `CollectionPage` for tables:** One component gives you `PageLayout`, top-bar `Find in view` & `Filters` (`/` and
|
|
39
|
+
`⌘F`), `CollectionToolbar` filter chips, full-width `DataTable`, and an optional resizable `Workbench` inspector.
|
|
40
|
+
Never hand-wire search inputs or filter dropdowns in the page body.
|
|
@@ -18,6 +18,29 @@ export function Document({ isDark, children }: { readonly isDark: boolean; reado
|
|
|
18
18
|
Apply the theme to the document root so portaled menus, dialogs and tooltips inherit it. The application stores the
|
|
19
19
|
preference; there is no theme provider. A themed wrapper suits an isolated preview only.
|
|
20
20
|
|
|
21
|
+
`themeProps.dark` is a `className` and a `style`. Spread with your own styles, the later `className` wins and the theme
|
|
22
|
+
is lost without an error: `{...themeProps.dark} {...stylex.props(styles.root)}` leaves the page half dark. Put the theme
|
|
23
|
+
on an element of its own, or join both class names and styles:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { themeProps } from '@mechane-ai/elements/theme';
|
|
27
|
+
import * as stylex from '@stylexjs/stylex';
|
|
28
|
+
import type { ReactNode } from 'react';
|
|
29
|
+
|
|
30
|
+
const styles = stylex.create({ root: { minHeight: '100dvh' } });
|
|
31
|
+
|
|
32
|
+
export function ThemedRoot({ isDark, children }: { readonly isDark: boolean; readonly children: ReactNode }) {
|
|
33
|
+
const theme = themeProps[isDark ? 'dark' : 'light'];
|
|
34
|
+
const own = stylex.props(styles.root);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className={`${theme.className ?? ''} ${own.className ?? ''}`} style={{ ...theme.style, ...own.style }}>
|
|
38
|
+
{children}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
21
44
|
## Appearance comes from the components
|
|
22
45
|
|
|
23
46
|
- Choose a named `variant`, `tone` or `density`. There is no size, padding or radius prop.
|
|
@@ -16,6 +16,19 @@ The ideas, in one breath: one lesson store holds every value the reader, the app
|
|
|
16
16
|
object with a stable id eases to its new props by itself, so you describe states and never write an animation; an
|
|
17
17
|
article renders the same beats as a scrolling essay, a presentation, a static page and a beat sheet.
|
|
18
18
|
|
|
19
|
+
## Four things a port gets wrong
|
|
20
|
+
|
|
21
|
+
- `show` and `reset` act on the whole lesson. A figure's Reset button calls `resetBeat(beat)`, which returns only the
|
|
22
|
+
params that beat owns (its `params`, or those its states set) to their opening values.
|
|
23
|
+
- A host whose own rail lists the beats holds the beat through `Article`'s `lessonProps` (`beat` and `onBeatChange`) and
|
|
24
|
+
sets `hasContents={false}`, so the page has one contents list.
|
|
25
|
+
- A figure's controls go in the article `Figure`'s `header` or `footer`, which frame it. A chart or scene inside keeps
|
|
26
|
+
its title only as its accessible name; the caption is printed, so do not repeat the beat heading in it.
|
|
27
|
+
- A card that turns, or a node that acts, when pressed needs no click handler of its own: give the `Scene`
|
|
28
|
+
`selected={null}` and `onSelectedChange={(id) => ...}`. A press, or Enter or Space on the keyboard cursor, calls it
|
|
29
|
+
with the labelled object's id. A face-down `SceneCard` renders only its back, so keep its id free of its rank and
|
|
30
|
+
suit.
|
|
31
|
+
|
|
19
32
|
## When to switch skills
|
|
20
33
|
|
|
21
34
|
- Asked to explain a topic, a paper or a result interactively: follow the `plan-lesson` skill before writing a
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
# Workspace layout
|
|
2
2
|
|
|
3
|
-
Mount one `AppShell` around the
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Mount one `AppShell` around the router outlet. `AppShell` locks the viewport at `100dvh` with an independent scrolling
|
|
4
|
+
`<main>` column so the rail and sidebar stay pinned without custom CSS. Put top-level areas in `rail`, swap `sidebar` to
|
|
5
|
+
show only the active area's pages, and put Settings/account controls in `railFooter`. On a phone use the shell's drawer
|
|
6
|
+
and its navigation callback.
|
|
6
7
|
|
|
7
|
-
Use `
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
Use `PageSection` for report sections: both `summary` and `children` receive the standard inset gutter automatically
|
|
9
|
+
(without double-padding if wrapped in `PageContent`), while `breakdown` renders edge-to-edge full width for a
|
|
10
|
+
`DataTable`. Use `DetailPage isWide` for a wide standalone working surface (it keeps the standard inset gutter by
|
|
11
|
+
default; pass `isBleed` only for an intentional zero-gutter canvas). Constrain prose and individual forms locally. Keep
|
|
12
|
+
a wide plot's horizontal scroll inside its figure. At a wide desktop viewport, compare the right edge of a report header
|
|
13
|
+
with its table and the edge of the pane.
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
Use `CollectionPage` from `/kits/research` for full-width searchable/filterable table pages. It wires `PageLayout`,
|
|
16
|
+
top-bar search & filter controls (`/` and `⌘F`), `CollectionToolbar` filter chips, full-width `DataTable`, and an
|
|
17
|
+
optional resizable `Workbench` inspector in one component. Never put inline search inputs or filter dropdowns in the
|
|
18
|
+
page body.
|
|
13
19
|
|
|
14
20
|
Use `SegmentedControl` from `/forms` to switch between a few views; one item is always checked. Use `ToggleGroup` for
|
|
15
21
|
independent pressed choices. Both size to their content. Put either beside an Elements field and select, compare their
|
|
@@ -15,6 +15,7 @@ arranges the same children four ways. It renders the `Lesson`, a `ChartLink` and
|
|
|
15
15
|
| `storageKey` | Keeps the values and the reader's progress across visits. |
|
|
16
16
|
| `progress`, `defaultProgress`, `onProgressChange` | The reader's predictions, challenges, hints and visits, if the application holds them. |
|
|
17
17
|
| `lessonProps` | Passed to the `Lesson`: controlled values, beat and step, `shouldSyncUrl`. |
|
|
18
|
+
| `hasContents` | `false` leaves the contents list out, when the host's own navigation lists the beats. |
|
|
18
19
|
| `labels` | The article's own words, with English defaults. |
|
|
19
20
|
|
|
20
21
|
## Markup the article reads
|
|
@@ -34,7 +35,16 @@ components to look inside them. So:
|
|
|
34
35
|
|
|
35
36
|
- `Beat`: `id` and children. Its title, tutor notes, reveal steps and states come from the lesson.
|
|
36
37
|
- `Figure`: `id` (unique, and different from every beat id), `caption`, `description` (the figure in words, printed in
|
|
37
|
-
the static view), `reads`, `size` (`'wide'`, the default, reaches into the margin; `'text'` keeps the column)
|
|
38
|
+
the static view), `reads`, `size` (`'wide'`, the default, reaches into the margin; `'text'` keeps the column), and
|
|
39
|
+
`header` and `footer` for the figure's controls. Either one sets the figure in a hairline frame with a strip above or
|
|
40
|
+
below the visual; put a `Transport` in `header` and a `ParamChoice` or a reset button in `footer`, never loose under
|
|
41
|
+
the figure. `isFramed` frames a figure with no controls; if one figure in an essay is framed, frame them all. A figure
|
|
42
|
+
with a strip is always framed, and `isFramed={false}` with one is an authoring error. The static view and the sheet
|
|
43
|
+
keep the strips but make them inert. A chart with a `report` frame inside keeps its own border, and the figure draws
|
|
44
|
+
no second one.
|
|
45
|
+
- A chart or scene inside a `Figure` keeps its `title` as its accessible name but prints neither the title nor its
|
|
46
|
+
description: the caption is what the reader sees. So never repeat the beat heading in the caption or the title. The
|
|
47
|
+
beat heading names the idea, the caption says what to look at, and the title names the drawing for a screen reader.
|
|
38
48
|
- `FigureReference`: `to`, a figure id. Writes "Figure 2" as a link. Never write a figure number by hand.
|
|
39
49
|
- `Reveal`: `at`, a reveal step from 0 up to the beat's declared `steps`. It hides content only in the present view; the
|
|
40
50
|
other views show everything. `useRevealed(at)` gives the same answer to a figure that reveals its own parts: true in
|
|
@@ -134,6 +144,44 @@ export function BiasArticle({ view, math }: { readonly view: ArticleView; readon
|
|
|
134
144
|
}
|
|
135
145
|
```
|
|
136
146
|
|
|
147
|
+
## A host that holds the beat
|
|
148
|
+
|
|
149
|
+
An application whose own navigation lists the beats, such as a rail in an `AppShell`, holds the beat and passes it in
|
|
150
|
+
through `lessonProps`. Give `Article` `hasContents={false}` so the reader sees one list, not two. The text keeps its
|
|
151
|
+
measure.
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import { Article } from '@mechane-ai/elements/article';
|
|
155
|
+
import type { ReactNode } from 'react';
|
|
156
|
+
import { lesson } from './lesson.ts';
|
|
157
|
+
|
|
158
|
+
type BeatId = (typeof lesson.beats)[number]['id'];
|
|
159
|
+
|
|
160
|
+
export function HostedEssay({
|
|
161
|
+
beat,
|
|
162
|
+
onBeat,
|
|
163
|
+
children,
|
|
164
|
+
}: {
|
|
165
|
+
readonly beat: BeatId;
|
|
166
|
+
readonly onBeat: (beat: BeatId) => void;
|
|
167
|
+
readonly children: ReactNode;
|
|
168
|
+
}): ReactNode {
|
|
169
|
+
return (
|
|
170
|
+
<Article
|
|
171
|
+
lesson={lesson}
|
|
172
|
+
locale="en-US"
|
|
173
|
+
title="A neuron is a weighted vote"
|
|
174
|
+
hasContents={false}
|
|
175
|
+
lessonProps={{ beat, onBeatChange: (next) => next !== null && onBeat(next) }}
|
|
176
|
+
>
|
|
177
|
+
{children}
|
|
178
|
+
</Article>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Scrolling a beat into view reports it through `onBeatChange`, and a beat the host sets scrolls into view.
|
|
184
|
+
|
|
137
185
|
## The four views
|
|
138
186
|
|
|
139
187
|
The same children, arranged four ways. In the essay starter, `?view=present`, `?view=static` and `?view=sheet` choose
|
|
@@ -141,7 +189,7 @@ one.
|
|
|
141
189
|
|
|
142
190
|
| View | What it is |
|
|
143
191
|
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
144
|
-
| `article` | The scrolling essay, with a contents list that follows the reading position and sets the lesson's beat.
|
|
192
|
+
| `article` | The scrolling essay, with a contents list that follows the reading position and sets the lesson's beat. Below 1,120 px the list folds into a sticky bar, which never covers a focused control or a linked target. |
|
|
145
193
|
| `present` | One beat at a time, opened at its first declared state each time the presenter reaches it. Right or Space runs `next` (the next reveal step, then the next beat); Left goes back. A `Scrolly` shows its figure beside its steps, which are walked before the reveal steps. |
|
|
146
194
|
| `static` | Every beat open at its first state, every reveal shown, each figure followed by its description, no motion. |
|
|
147
195
|
| `sheet` | Every beat at each of its states, read-only and scaled to fit its cell, with its tutor notes, then "Checks". |
|