@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
|
@@ -13,8 +13,9 @@ const lesson = defineLesson({ id, title, params, derived, beats });
|
|
|
13
13
|
`{ id, label }`) and toggle (`value`) params, each with a `label`.
|
|
14
14
|
- `derived`: `{ label, format, from }`. `from` receives the params and the derived values declared above it, typed, and
|
|
15
15
|
returns a number. Keep it pure: no randomness, no time, no fetch.
|
|
16
|
-
- `beats`: `{ id, title, goal?, misconception?, hints?, steps?, states? }`. Goals, misconceptions and hints are
|
|
17
|
-
notes; the reader never sees them. `states` are `{ id, label, values }`, where `values` set params only.
|
|
16
|
+
- `beats`: `{ id, title, goal?, misconception?, hints?, steps?, states?, params? }`. Goals, misconceptions and hints are
|
|
17
|
+
tutor notes; the reader never sees them. `states` are `{ id, label, values }`, where `values` set params only.
|
|
18
|
+
`params` names the params the beat owns, which `resetBeat` resets; left out, they are the params its states set.
|
|
18
19
|
- It throws a named `Error` for a bad definition, at module load, so a mistake fails before anything renders.
|
|
19
20
|
- The result carries `defaults`, `initial` (params and derived values at the opening), `compute(values)` and `reads`
|
|
20
21
|
(the names each derived value reads, found by running it). `lessonGraph(lesson)` gives the same as nodes and edges.
|
|
@@ -76,7 +77,8 @@ the untyped form for parts that work in any lesson.
|
|
|
76
77
|
| `set(name, value, origin?)` | Sets one param. A value outside its range or options **throws**. |
|
|
77
78
|
| `setMany(values, origin?)` | Sets several params in one change. |
|
|
78
79
|
| `show(stateId, origin?)` | Shows a declared state as the whole picture, looking in the current beat first. |
|
|
79
|
-
| `reset()`
|
|
80
|
+
| `reset(origin?)` | Every param of the whole lesson back to its opening value. |
|
|
81
|
+
| `resetBeat(beat, origin?)` | Only the params that beat owns back to their opening values, in one change. |
|
|
80
82
|
| `beat`, `step` | Where the reader is. |
|
|
81
83
|
| `goTo(beat, step?)`, `next()`, `previous()` | Move. `next` reveals the next step, then goes to the next beat. |
|
|
82
84
|
| `locale`, `lesson` | The lesson's locale and definition. |
|
|
@@ -87,20 +89,25 @@ draw states too. Elsewhere, only `show`, a `ScrollyStep` with `state` and a tuto
|
|
|
87
89
|
is the whole picture: a param it does not name takes the value the lesson opened with, so a state looks the same live,
|
|
88
90
|
on the sheet and in a tour. To change some params and keep the rest, use `setMany`.
|
|
89
91
|
|
|
92
|
+
`show` and `reset` act on the whole lesson. A Reset button under one beat's figure that calls `reset` also clears what
|
|
93
|
+
the reader set in every other beat; give it `resetBeat('that-beat')`. It reports the reason `reset`, like `reset`, and
|
|
94
|
+
stops a player that moves one of the beat's params. When a beat's states set a shared param, such as a temperature every
|
|
95
|
+
beat reads, list the beat's own params in `params` so its reset leaves the shared one alone.
|
|
96
|
+
|
|
90
97
|
A control of yours that calls `set` keeps the value on the param's step and inside its range, and passes the event's
|
|
91
98
|
details as the origin so the change reports a reader's source:
|
|
92
99
|
`set('bias', bias, { reason: details.reason, event: details.event })`. A draggable `ScenePoint` needs no handler: its
|
|
93
100
|
`sets` prop writes the params for it.
|
|
94
101
|
|
|
95
102
|
```tsx
|
|
96
|
-
/** A button that shows a declared state, and one that resets. */
|
|
103
|
+
/** A button that shows a declared state, and one that resets this beat's params. */
|
|
97
104
|
export function StateButtons(): ReactNode {
|
|
98
|
-
const { show,
|
|
105
|
+
const { show, resetBeat, beat, next } = useLesson(lesson);
|
|
99
106
|
|
|
100
107
|
return (
|
|
101
108
|
<>
|
|
102
109
|
<Button onClick={() => show('skeptic')}>Show a skeptical neuron</Button>
|
|
103
|
-
<Button onClick={() => reset
|
|
110
|
+
<Button onClick={(event) => resetBeat('bias', { reason: 'reset', event: event.nativeEvent })}>Start again</Button>
|
|
104
111
|
<Button onClick={() => next()}>{beat === 'learning' ? 'Done' : 'Next'}</Button>
|
|
105
112
|
</>
|
|
106
113
|
);
|
|
@@ -121,9 +128,11 @@ A name the lesson does not declare draws a short inline error in the danger colo
|
|
|
121
128
|
|
|
122
129
|
## Time
|
|
123
130
|
|
|
124
|
-
`<Playback name from? to? pace? isLooping? />` drives a number param
|
|
125
|
-
|
|
126
|
-
|
|
131
|
+
`<Playback name from? to? pace? isLooping? />` drives a number param on the shared clock. It renders nothing. `pace` is
|
|
132
|
+
`'fast'` (12 steps a second), `'regular'` (6) or `'slow'` (2), or a timed run: `{ run: 'short' | 'regular' | 'long' }`
|
|
133
|
+
crosses the whole range in 2, 5 or 10 seconds however many steps it has, so a 320-step training run fits in `long`. Add
|
|
134
|
+
`isEased: true` for a run that starts fast and settles, such as a blend. It pauses when the tab is hidden or the reader
|
|
135
|
+
moves the value, and with reduced motion `play` jumps to the end.
|
|
127
136
|
|
|
128
137
|
`<Transport for="name" labels? />` plays, pauses, steps and scrubs it. Every `Playback` needs a `Transport` the reader
|
|
129
138
|
can reach, or the beat sheet flags it. `usePlayback(name)` returns `{ isPlaying, play, pause, toggle, stepBy, seek }`
|
|
@@ -12,12 +12,13 @@ For a scene whose box is a coordinate plane. All positions and values are in dat
|
|
|
12
12
|
label. Leave the axes out of a diagram whose positions mean nothing.
|
|
13
13
|
- `SceneCurve`: `of` (a function of x) or `points` (`[x, y]` pairs, x increasing), `resolution`, `fillTo`, `isDashed`
|
|
14
14
|
for a modelled curve, `thickness`. A new `of` eases from the old shape.
|
|
15
|
-
- `ScenePoint`: `at`, `text`, and `sets` to make it
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
`
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
- `ScenePoint`: `at`, `text`, and `sets` to make it a slider: the reader drags it, or reaches it with Tab and moves it
|
|
16
|
+
with the arrow keys, Home and End, and it speaks each bound value in its param's format. On a point that sets `x` and
|
|
17
|
+
`y`, Left and Right move x and Up and Down move y. `sets` names the number params its position writes, as
|
|
18
|
+
`{ x: 'bias' }`; a move sets them in one change, on each param's step grid and inside its range. `along` (`'x'`, `'y'`
|
|
19
|
+
or a function of x) limits the move, and a point bound on one axis moves along it. `snap` sets the step of an axis no
|
|
20
|
+
param owns. The point stays at `at`, read from the lesson. Reach for `onMove(position, details)` only when a move is
|
|
21
|
+
not a plain param write, and set a lesson param there, never component state.
|
|
21
22
|
- `SceneVector`: `to`, `from` (defaults to the origin), `text`, `isDashed` for a step not yet taken.
|
|
22
23
|
- `SceneProjection`: `of` (a point's id) or `at`, dashed lines to both axes with the values written there.
|
|
23
24
|
- `SceneRegion`: one of `between` (two x values), `above`, `below` (a y value) or `points` (a polygon). Keep it pale.
|
|
@@ -63,14 +64,17 @@ export function ConfidenceScene(): ReactNode {
|
|
|
63
64
|
- `SceneCard`: `rank` (`'A'`, `'2'` to `'10'`, `'J'`, `'Q'`, `'K'`) with `suit` (`'heart'`, `'diamond'`, `'spade'`,
|
|
64
65
|
`'club'`) for a playing card, or `text` for a generic card. `isFaceUp` turns it over (default true), `lift` raises it,
|
|
65
66
|
`tilt` leans it, `size` is `'small'`, `'medium'` or `'large'`, and `children` go on the face, even a chart. Its tone
|
|
66
|
-
defaults to its suit's (`suitTones`), and its back stays neutral so it hides the suit. A face-down
|
|
67
|
-
"A card, face down"
|
|
67
|
+
defaults to its suit's (`suitTones`), and its back stays neutral so it hides the suit. A face-down card renders only
|
|
68
|
+
its back and reads "A card, face down", so leave out `label` and keep its `id` free of its rank and suit. To turn it
|
|
69
|
+
when pressed, give the `Scene` `selected={null}` and `onSelectedChange` (see the scene reference). Place it with `at`,
|
|
70
|
+
or list it in one `SceneStack`.
|
|
68
71
|
- `SceneStack`: `id`, `at`, `cards` (ids, bottom of a pile first), `layout` (`'pile'`, `'fan'`, `'row'`, `'column'`),
|
|
69
72
|
`gap`, `size`, `stagger`. Move a card between stacks by moving its id from one list to the other. `stagger`
|
|
70
73
|
(`'short'`, `'regular'`, `'long'`) deals in turn: cards that arrive or move in the same update start that step apart,
|
|
71
74
|
in stack order, and a lone card starts at once. Use it, not a card's `delay`, to deal. A card in two stacks, or a card
|
|
72
75
|
with no place, shows an error.
|
|
73
|
-
- `SceneSlot`: an empty bay a card is dealt to, with `text`, `size` and `isActive` for the one that matters now.
|
|
76
|
+
- `SceneSlot`: an empty bay a card is dealt to, with `text`, `size` and `isActive` for the one that matters now. A
|
|
77
|
+
slot's `isActive` only draws its outline and tint; nothing else recedes.
|
|
74
78
|
|
|
75
79
|
A deal is two lists of ids. Changing the hand moves the cards, flips them and deals them in turn, with no motion code:
|
|
76
80
|
|
|
@@ -111,9 +115,10 @@ export function HandScene(): ReactNode {
|
|
|
111
115
|
|
|
112
116
|
`SceneCells` draws a small vector or matrix: `values` (a flat list is one row; a list of lists is a matrix) or `cells`
|
|
113
117
|
(`{ id?, text?, value?, label? }` rows), `direction`, `format`, `palette` (`'sequential'` or `'diverging'`) with
|
|
114
|
-
`domain`, `rowLabels`, `columnLabels
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
`domain`, `rowLabels`, `columnLabels` (they wrap, and a long word overhangs rather than being cut), `highlight`
|
|
119
|
+
(`{ row?, column? }`) and `size`. A cell also takes `tone`, such as its suit's hue, and `isMuted` to gray one already
|
|
120
|
+
dealt. A cell's id is `${id}.${row}.${column}`, so a wire or callout can name one. Changed values ease. For a large grid
|
|
121
|
+
with axes, use the `Matrix` chart.
|
|
117
122
|
|
|
118
123
|
```tsx
|
|
119
124
|
/** The weights and the bias as cells, shaded around zero. */
|
|
@@ -112,8 +112,8 @@ export function NeuronScene(): ReactNode {
|
|
|
112
112
|
| `focus` | The camera: an id or ids to zoom to, or `null` for the whole box. |
|
|
113
113
|
| `pace` | `'instant'`, `'fast'`, `'regular'` or `'slow'`. Reduced motion always jumps. |
|
|
114
114
|
| `weightMax` | The wire weight drawn thickest. Every weight must lie within plus or minus it. Defaults to 1. |
|
|
115
|
-
| `selected`, `onSelectedChange` | Selection, as on a chart.
|
|
116
|
-
| `minWidth`, `labels` |
|
|
115
|
+
| `selected`, `onSelectedChange` | Selection, as on a chart, and presses: see Pressable objects below. |
|
|
116
|
+
| `minWidth`, `labels` | Leave `minWidth` out: the derived width is the narrowest at which the drawing is legible. |
|
|
117
117
|
|
|
118
118
|
An object placed outside the box, a weight beyond `weightMax`, or a wire to an id that does not exist shows an error in
|
|
119
119
|
the figure instead of a guess.
|
|
@@ -131,7 +131,9 @@ readout and assistive technology, and makes the object an item the arrow keys re
|
|
|
131
131
|
keeps its state as the node moves.
|
|
132
132
|
- `SceneWire`: `from`, `to`, `id` (defaults to `from>to`), `weight` (thickness by size, hue by sign), `text`, `textSide`
|
|
133
133
|
(`'auto'` above a level wire and right of an upright one, or a side), `shape` (`'straight'`, `'curve'`, `'elbow'`),
|
|
134
|
-
`isDashed` for a modelled connection, `hasArrow` (default true)
|
|
134
|
+
`isDashed` for a modelled connection, `hasArrow` (default true), and `bend`: pixels a straight wire's middle bows off
|
|
135
|
+
its line, positive above an across wire. A wire does not avoid other objects, so bend one that would cross a node
|
|
136
|
+
between its ends, or put one end on another row.
|
|
135
137
|
- `SceneGroup`: `id`, `around` (ids), `label`, `text`, `padding`. An outline that follows its members.
|
|
136
138
|
- `SceneBracket`: `of` (ids), `side` (`'top'`, `'right'`, `'bottom'`, `'left'`), `label`, `text`.
|
|
137
139
|
- `SceneCallout`: `to` (an id), `side` (`'auto'` or a side), `width`, and one sentence of prose as children.
|
|
@@ -142,6 +144,26 @@ update start one `step` apart (`'short'`, `'regular'` or `'long'`, default `'reg
|
|
|
142
144
|
that changes alone starts at once. Cards take it from their `SceneStack`. `delay` is a fixed wait on every change, in
|
|
143
145
|
milliseconds or as `{ index, step }`; it also delays a lone move, so prefer `stagger` for a deal or a cascade.
|
|
144
146
|
|
|
147
|
+
## Pressable objects
|
|
148
|
+
|
|
149
|
+
A card that turns or a node that acts when pressed needs no handler of its own. Give the `Scene` `onSelectedChange`: a
|
|
150
|
+
press on a labelled object, or Enter or Space on the keyboard cursor, calls it with that object's id. `selected={null}`
|
|
151
|
+
keeps the press an action rather than a lasting selection, and a pointer press then dims nothing. Say what the press
|
|
152
|
+
does in `labels.press`, which ends the plot's accessible name (default "Press Enter or Space to activate a part.").
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
<Scene
|
|
156
|
+
title="The first card"
|
|
157
|
+
x={[0, 2]}
|
|
158
|
+
y={[0, 1]}
|
|
159
|
+
selected={null}
|
|
160
|
+
onSelectedChange={() => set('isRevealed', !isRevealed)}
|
|
161
|
+
labels={{ press: 'Press Enter or Space to turn the card over.' }}
|
|
162
|
+
>
|
|
163
|
+
<SceneCard id="first" at={[1, 0.5]} rank="Q" suit="heart" isFaceUp={isRevealed} />
|
|
164
|
+
</Scene>
|
|
165
|
+
```
|
|
166
|
+
|
|
145
167
|
## Identity
|
|
146
168
|
|
|
147
169
|
An id names a thing, not a place. Keep it while the thing moves, turns or changes value, and change it only when the
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { r as e } from "./tokens.stylex-dF5CACEJ.js";
|
|
2
|
-
import { t } from "./accessibility-P89UG9-r.js";
|
|
3
|
-
import { t as n } from "./src-9EJskqB_.js";
|
|
4
|
-
import { d as r, m as i, u as a } from "./src-npqwq3Sa.js";
|
|
5
|
-
import { C as o, b as s, c } from "./plot-layout-Bqe4-0qZ.js";
|
|
6
|
-
import * as l from "@stylexjs/stylex";
|
|
7
|
-
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
-
import { formatNumber as f } from "@ui-sdk/core/number";
|
|
9
|
-
// packages/charts/src/chart-data.tsx
|
|
10
|
-
function p({ label: e, columns: n, rows: r }) {
|
|
11
|
-
return /* @__PURE__ */ u("div", {
|
|
12
|
-
...l.props(t.hidden),
|
|
13
|
-
children: /* @__PURE__ */ d("table", { children: [
|
|
14
|
-
/* @__PURE__ */ u("caption", { children: e }),
|
|
15
|
-
/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: n.map((e) => /* @__PURE__ */ u("th", {
|
|
16
|
-
scope: "col",
|
|
17
|
-
children: e.label
|
|
18
|
-
}, e.id)) }) }),
|
|
19
|
-
/* @__PURE__ */ u("tbody", { children: r.map((e) => /* @__PURE__ */ u("tr", { children: n.map((t, n) => n === 0 ? /* @__PURE__ */ u("th", {
|
|
20
|
-
scope: "row",
|
|
21
|
-
children: e.values[n]
|
|
22
|
-
}, t.id) : /* @__PURE__ */ u("td", { children: e.values[n] }, t.id)) }, e.id)) })
|
|
23
|
-
] })
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
// packages/charts/src/chart-inspection.tsx
|
|
27
|
-
var m = {
|
|
28
|
-
kzqmXN: "x1xc55vz",
|
|
29
|
-
kZKoxP: "xdk7pt",
|
|
30
|
-
kmuXW: "x2lah0s",
|
|
31
|
-
$$css: !0
|
|
32
|
-
}, h = {
|
|
33
|
-
swatch: (e) => [
|
|
34
|
-
m,
|
|
35
|
-
{
|
|
36
|
-
kWkggS: e == null ? e : "xl8spv7",
|
|
37
|
-
$$css: !0
|
|
38
|
-
},
|
|
39
|
-
{ "--x-backgroundColor": e ?? void 0 }
|
|
40
|
-
],
|
|
41
|
-
inspector: {
|
|
42
|
-
k1xSpc: "xrvj5dj x1boff50",
|
|
43
|
-
kOIVth: "xunmzkg",
|
|
44
|
-
kVAEAm: "x10l6tqk",
|
|
45
|
-
k87sOh: "x1ridm32",
|
|
46
|
-
kB7OPa: "x9f619",
|
|
47
|
-
kfzvcC: "x47corl",
|
|
48
|
-
kmVPX3: "x69ldcm",
|
|
49
|
-
kMzoRj: "xmkeg23",
|
|
50
|
-
ksu8eU: "x1y0btm7",
|
|
51
|
-
kVAM5u: "x1ey3b81",
|
|
52
|
-
kaIpWk: "x1ok0vyi",
|
|
53
|
-
kGVxlE: "x1ghndwu",
|
|
54
|
-
kWkggS: "xpvm0e4",
|
|
55
|
-
kMwMTN: "xbixft",
|
|
56
|
-
kGuDYH: "xy8obcc",
|
|
57
|
-
kLWn49: "xas2l8k",
|
|
58
|
-
kcqcaj: "xss6m8b",
|
|
59
|
-
kHjlTd: "xj0a0fe",
|
|
60
|
-
$$css: !0
|
|
61
|
-
},
|
|
62
|
-
summaryInspector: {
|
|
63
|
-
k1xSpc: "xrvj5dj x1xnx9c1",
|
|
64
|
-
$$css: !0
|
|
65
|
-
},
|
|
66
|
-
position: (e, t) => [{
|
|
67
|
-
kbCHJM: e == null ? e : "xgq9j65",
|
|
68
|
-
kzqmXN: t == null ? t : "x5lhr3w",
|
|
69
|
-
$$css: !0
|
|
70
|
-
}, {
|
|
71
|
-
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
72
|
-
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
73
|
-
}]
|
|
74
|
-
}, g = 4;
|
|
75
|
-
function _() {
|
|
76
|
-
return /* @__PURE__ */ u("ul", {
|
|
77
|
-
"aria-hidden": !0,
|
|
78
|
-
inert: !0,
|
|
79
|
-
className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k",
|
|
80
|
-
children: Array.from({ length: g }, (t, n) => /* @__PURE__ */ d("li", {
|
|
81
|
-
className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe x1f394nn x43dure",
|
|
82
|
-
children: [/* @__PURE__ */ u("span", { ...l.props(h.swatch(e.line)) }), /* @__PURE__ */ d("span", {
|
|
83
|
-
className: "x1cqoux5 xeuugli",
|
|
84
|
-
children: [
|
|
85
|
-
/* @__PURE__ */ u(r, {}),
|
|
86
|
-
/* @__PURE__ */ u("span", {
|
|
87
|
-
className: "x1s85apg xannxpe",
|
|
88
|
-
children: /* @__PURE__ */ u(r, {})
|
|
89
|
-
}),
|
|
90
|
-
/* @__PURE__ */ u("span", {
|
|
91
|
-
className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
|
|
92
|
-
children: /* @__PURE__ */ u(r, {})
|
|
93
|
-
})
|
|
94
|
-
]
|
|
95
|
-
})]
|
|
96
|
-
}, n))
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
function v({ title: e, detail: t }) {
|
|
100
|
-
return t === void 0 ? e : /* @__PURE__ */ d("span", {
|
|
101
|
-
"aria-label": e,
|
|
102
|
-
className: "x1lliihq xb3r6kr xlyipyv xuxw1ft",
|
|
103
|
-
children: [/* @__PURE__ */ u("span", {
|
|
104
|
-
className: "xt0psk2 x1boff50",
|
|
105
|
-
children: e
|
|
106
|
-
}), /* @__PURE__ */ u("span", {
|
|
107
|
-
className: "x1s85apg xfodcyb",
|
|
108
|
-
children: t
|
|
109
|
-
})]
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function y({ label: e, summary: t, rows: n, notes: r = [] }) {
|
|
113
|
-
if (e !== void 0) return [
|
|
114
|
-
e,
|
|
115
|
-
t,
|
|
116
|
-
...n.map((e) => `${e.label}: ${e.value}`),
|
|
117
|
-
...r
|
|
118
|
-
].filter((e) => e !== void 0).join(" · ");
|
|
119
|
-
}
|
|
120
|
-
function b({ id: e, label: t, summary: n, legend: r, layoutLegend: i, rows: a, x: s, width: c, offset: f = 16, notes: p = [], hasSeriesSummary: m = !1, hasLegend: g = !0 }) {
|
|
121
|
-
let _ = g && !m, v = Math.min(260, c), b = s > c / 2 ? s - v - f : s + f, x = Math.max(0, Math.min(c - v, b));
|
|
122
|
-
return /* @__PURE__ */ d("div", {
|
|
123
|
-
className: "xeuugli",
|
|
124
|
-
children: [
|
|
125
|
-
_ && /* @__PURE__ */ d("div", {
|
|
126
|
-
className: "xrvj5dj xeuugli",
|
|
127
|
-
children: [i !== void 0 && /* @__PURE__ */ u("ul", {
|
|
128
|
-
"aria-hidden": !0,
|
|
129
|
-
inert: !0,
|
|
130
|
-
className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc xlshs6z x47corl",
|
|
131
|
-
children: i.map((e) => /* @__PURE__ */ d("li", {
|
|
132
|
-
className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
|
|
133
|
-
children: [/* @__PURE__ */ u(o, {
|
|
134
|
-
tone: e.tone,
|
|
135
|
-
shape: e.shape
|
|
136
|
-
}), /* @__PURE__ */ d("span", {
|
|
137
|
-
className: "xeuugli",
|
|
138
|
-
children: [e.label, /* @__PURE__ */ u("span", { className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b" })]
|
|
139
|
-
})]
|
|
140
|
-
}, e.id))
|
|
141
|
-
}), /* @__PURE__ */ u("ul", {
|
|
142
|
-
"aria-label": "Legend",
|
|
143
|
-
className: "x78zum5 x1xnx9c1 xnby9oq x1a02dak x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc xas2l8k x15r89dc",
|
|
144
|
-
children: r.map((e) => /* @__PURE__ */ d("li", {
|
|
145
|
-
className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
|
|
146
|
-
children: [/* @__PURE__ */ u(o, {
|
|
147
|
-
tone: e.tone,
|
|
148
|
-
shape: e.shape
|
|
149
|
-
}), /* @__PURE__ */ d("span", {
|
|
150
|
-
className: "xeuugli",
|
|
151
|
-
children: [e.label, /* @__PURE__ */ u("span", {
|
|
152
|
-
className: "x1s85apg xannxpe x1mqbd49 xbixft xss6m8b",
|
|
153
|
-
children: t === void 0 ? "" : a.find((t) => t.id === e.id)?.value ?? "—"
|
|
154
|
-
})]
|
|
155
|
-
})]
|
|
156
|
-
}, e.id))
|
|
157
|
-
})]
|
|
158
|
-
}),
|
|
159
|
-
/* @__PURE__ */ u("span", {
|
|
160
|
-
id: e,
|
|
161
|
-
className: "x10l6tqk x1i1rx1s xjm9jq1 x1717udv xb3r6kr x1hyvwdk xuxw1ft",
|
|
162
|
-
children: y({
|
|
163
|
-
label: t,
|
|
164
|
-
summary: n,
|
|
165
|
-
rows: a,
|
|
166
|
-
notes: p
|
|
167
|
-
})
|
|
168
|
-
}),
|
|
169
|
-
t !== void 0 && /* @__PURE__ */ u("div", {
|
|
170
|
-
"aria-hidden": !0,
|
|
171
|
-
className: "x1n2onr6 xqtp20y x1vjfegm",
|
|
172
|
-
children: /* @__PURE__ */ d("div", {
|
|
173
|
-
...l.props(h.inspector, !_ && h.summaryInspector, h.position(x, v)),
|
|
174
|
-
children: [
|
|
175
|
-
/* @__PURE__ */ d("div", {
|
|
176
|
-
className: "x78zum5 x1qughib x1hnptsi xk4h15q",
|
|
177
|
-
children: [/* @__PURE__ */ u("span", { children: t }), n !== void 0 && /* @__PURE__ */ u("span", { children: n })]
|
|
178
|
-
}),
|
|
179
|
-
/* @__PURE__ */ u("dl", {
|
|
180
|
-
className: "xrvj5dj xunmzkg x1ghz6dp",
|
|
181
|
-
children: a.map((e) => /* @__PURE__ */ d("div", {
|
|
182
|
-
className: "x78zum5 x1qughib x1pha0wt x1hnptsi",
|
|
183
|
-
children: [/* @__PURE__ */ d("dt", {
|
|
184
|
-
className: "x78zum5 x1pha0wt xunmzkg xeuugli xj0a0fe",
|
|
185
|
-
children: [/* @__PURE__ */ u(o, {
|
|
186
|
-
tone: e.tone,
|
|
187
|
-
shape: e.shape
|
|
188
|
-
}), e.label]
|
|
189
|
-
}), /* @__PURE__ */ u("dd", {
|
|
190
|
-
className: "x1ghz6dp xuxw1ft",
|
|
191
|
-
children: e.value
|
|
192
|
-
})]
|
|
193
|
-
}, e.id))
|
|
194
|
-
}),
|
|
195
|
-
p.map((e) => /* @__PURE__ */ u("span", { children: e }, e))
|
|
196
|
-
]
|
|
197
|
-
})
|
|
198
|
-
})
|
|
199
|
-
]
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
// packages/charts/src/figure/figure-frame.tsx
|
|
203
|
-
var x = {
|
|
204
|
-
notation: "compact",
|
|
205
|
-
compactDisplay: "long"
|
|
206
|
-
}, S = 1e5;
|
|
207
|
-
function C(e, t) {
|
|
208
|
-
return f(e, t, e < S ? {} : x);
|
|
209
|
-
}
|
|
210
|
-
function w(e, t) {
|
|
211
|
-
return `${C(e.shown, t)} of ${C(e.total, t)} ${e.unit} shown`;
|
|
212
|
-
}
|
|
213
|
-
function T({ title: e, description: t, report: r, actions: i, locale: a, source: o, coverage: c, transforms: l = [], status: f = "ready", figure: p = {}, series: m, titleDetail: h, footer: g, seriesLegend: _, scaleLegend: y, children: b }) {
|
|
214
|
-
let x = c !== void 0 && c.shown < c.total ? w(c, a) : void 0, S = [o, ...l].filter((e) => e !== void 0), C = g !== void 0 || S.length > 0, T = /* @__PURE__ */ u(v, {
|
|
215
|
-
title: e,
|
|
216
|
-
detail: h
|
|
217
|
-
});
|
|
218
|
-
return /* @__PURE__ */ u(s, {
|
|
219
|
-
figure: {
|
|
220
|
-
...p,
|
|
221
|
-
"aria-busy": f !== "ready" || void 0
|
|
222
|
-
},
|
|
223
|
-
title: x === void 0 ? T : /* @__PURE__ */ d("span", {
|
|
224
|
-
className: "x3nfvp2 x1a02dak x1pha0wt xa2sdi0 x1gkm1c7",
|
|
225
|
-
children: [T, /* @__PURE__ */ u(n, { children: x })]
|
|
226
|
-
}),
|
|
227
|
-
description: t,
|
|
228
|
-
report: r,
|
|
229
|
-
actions: i,
|
|
230
|
-
series: m,
|
|
231
|
-
seriesLegend: _,
|
|
232
|
-
scaleLegend: y,
|
|
233
|
-
footer: C ? /* @__PURE__ */ d("div", {
|
|
234
|
-
className: "xrvj5dj xunmzkg xeuugli",
|
|
235
|
-
children: [g, S.length > 0 && /* @__PURE__ */ u("p", {
|
|
236
|
-
className: "x1ghz6dp xeuugli xj0a0fe",
|
|
237
|
-
children: S.join(" · ")
|
|
238
|
-
})]
|
|
239
|
-
}) : void 0,
|
|
240
|
-
children: b
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
function E({ children: e }) {
|
|
244
|
-
return /* @__PURE__ */ u("p", {
|
|
245
|
-
className: "x1ghz6dp x153jb6y xtqrqnz x1778rvt",
|
|
246
|
-
children: e
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
function D({ message: e, ...t }) {
|
|
250
|
-
return /* @__PURE__ */ u(T, {
|
|
251
|
-
...t,
|
|
252
|
-
status: "ready",
|
|
253
|
-
children: /* @__PURE__ */ u(i, {
|
|
254
|
-
hasError: !0,
|
|
255
|
-
children: e
|
|
256
|
-
})
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
function O({ height: e = "regular", ...t }) {
|
|
260
|
-
return /* @__PURE__ */ u("div", {
|
|
261
|
-
"aria-hidden": !0,
|
|
262
|
-
inert: !0,
|
|
263
|
-
children: /* @__PURE__ */ u(T, {
|
|
264
|
-
...t,
|
|
265
|
-
status: "loading",
|
|
266
|
-
children: /* @__PURE__ */ u(a, { height: c[e] })
|
|
267
|
-
})
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
export { w as a, y as c, O as i, p as l, T as n, b as o, D as r, _ as s, E as t };
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { n as e, t } from "./clock-DSm5lkNE.js";
|
|
2
|
-
import { useEffect as n, useState as r, useSyncExternalStore as i } from "react";
|
|
3
|
-
// packages/teaching/src/time/tween.ts
|
|
4
|
-
var a = {
|
|
5
|
-
instant: 0,
|
|
6
|
-
fast: 140,
|
|
7
|
-
regular: 320,
|
|
8
|
-
slow: 640
|
|
9
|
-
}, o = 4;
|
|
10
|
-
function s() {}
|
|
11
|
-
function c(e) {
|
|
12
|
-
return 1 - (1 - e) ** o;
|
|
13
|
-
}
|
|
14
|
-
function l(e, t) {
|
|
15
|
-
let n = new Map(Object.entries(t)), r = Object.entries(e);
|
|
16
|
-
return r.length === n.size && r.every(([e, t]) => n.get(e) === t);
|
|
17
|
-
}
|
|
18
|
-
function u(e, t, n) {
|
|
19
|
-
let r = new Map(Object.entries(e));
|
|
20
|
-
return {
|
|
21
|
-
...t,
|
|
22
|
-
...Object.fromEntries(Object.entries(t).map(([e, t]) => {
|
|
23
|
-
let i = r.get(e) ?? t;
|
|
24
|
-
return [e, i + (t - i) * n];
|
|
25
|
-
}))
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function d(n) {
|
|
29
|
-
let r = /* @__PURE__ */ new Set(), i = {
|
|
30
|
-
shown: n,
|
|
31
|
-
from: n,
|
|
32
|
-
target: n,
|
|
33
|
-
started: -1,
|
|
34
|
-
duration: 0,
|
|
35
|
-
stop: s
|
|
36
|
-
};
|
|
37
|
-
function o(e) {
|
|
38
|
-
i.shown = e;
|
|
39
|
-
for (let e of r) e();
|
|
40
|
-
}
|
|
41
|
-
function d() {
|
|
42
|
-
i.stop(), i.stop = s;
|
|
43
|
-
}
|
|
44
|
-
function f(e) {
|
|
45
|
-
d(), i.target = e, l(i.shown, e) || o(e);
|
|
46
|
-
}
|
|
47
|
-
function p(e) {
|
|
48
|
-
i.started < 0 && (i.started = e);
|
|
49
|
-
let t = Math.min(1, (e - i.started) / i.duration);
|
|
50
|
-
t >= 1 ? (d(), o(i.target)) : o(u(i.from, i.target, c(t)));
|
|
51
|
-
}
|
|
52
|
-
function m(n, r = "regular") {
|
|
53
|
-
l(i.target, n) || (a[r] === 0 || t() ? f(n) : (d(), i.from = i.shown, i.target = n, i.started = -1, i.duration = a[r], i.stop = e(p)));
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
get: () => i.shown,
|
|
57
|
-
to: m,
|
|
58
|
-
jump: f,
|
|
59
|
-
subscribe: (e) => (r.add(e), () => {
|
|
60
|
-
r.delete(e);
|
|
61
|
-
}),
|
|
62
|
-
destroy: d
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// packages/teaching/src/time/use-tween.ts
|
|
66
|
-
function f(e, t = "regular") {
|
|
67
|
-
let [a] = r(() => d(e));
|
|
68
|
-
return n(() => {
|
|
69
|
-
a.to(e, t);
|
|
70
|
-
}), n(() => a.destroy, [a]), i(a.subscribe, a.get, a.get);
|
|
71
|
-
}
|
|
72
|
-
export { d as n, f as t };
|