@mechane-ai/elements 0.48.0 → 0.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +40 -2
  2. package/dist/ai.js +5 -5
  3. package/dist/{article-BXZr10QQ.js → article-CRlhq9oA.js} +532 -464
  4. package/dist/article.js +1 -1
  5. package/dist/catalog.json +243 -1
  6. package/dist/{categorical-values-BpVq8cFj.js → categorical-values-BYP_R5gS.js} +13 -13
  7. package/dist/{cells-xVmnQ9oQ.js → cells-CNZE4us2.js} +2 -2
  8. package/dist/charts/cartesian.js +1 -1
  9. package/dist/charts/cells.js +1 -1
  10. package/dist/charts/comparison.js +1 -1
  11. package/dist/charts/distribution.js +1 -1
  12. package/dist/charts/figure.js +12 -12
  13. package/dist/charts/graph.js +1 -1
  14. package/dist/charts/hierarchy.js +1 -1
  15. package/dist/charts/image.js +1 -1
  16. package/dist/charts/matrix.js +1 -1
  17. package/dist/charts/plot.js +7 -7
  18. package/dist/charts/relationship.js +1 -1
  19. package/dist/charts/text.js +1 -1
  20. package/dist/charts/timeline.js +1 -1
  21. package/dist/charts/trend.js +1 -1
  22. package/dist/charts.js +7 -7
  23. package/dist/{code-block-DioAM2bZ.js → code-block-BZsY2sh3.js} +1 -1
  24. package/dist/collections.js +1 -1
  25. package/dist/content/code.js +1 -1
  26. package/dist/content/diff.js +3 -3
  27. package/dist/content/link.js +1 -1
  28. package/dist/content/markdown.js +2 -2
  29. package/dist/content/tree.js +1 -1
  30. package/dist/{content-link-NWuHp5rC.js → content-link-PnpcnTCx.js} +1 -1
  31. package/dist/content.js +1 -1
  32. package/dist/{dates-Cww8UR_n.js → dates-ckJdYF7t.js} +1 -1
  33. package/dist/{dumbbell-plot-DQdTxDeO.js → dumbbell-plot-B-Tn7ewW.js} +49 -48
  34. package/dist/{embedding-map-CF-J-8JW.js → embedding-map-Bljn-A5q.js} +533 -533
  35. package/dist/feedback.js +1 -1
  36. package/dist/figure-frame-CEijciL7.js +289 -0
  37. package/dist/forms/dates.js +1 -1
  38. package/dist/forms.js +3 -3
  39. package/dist/{image-grid-Dl2sjIMB.js → image-grid-mrG5u9oE.js} +49 -49
  40. package/dist/index.js +1 -1
  41. package/dist/kits/evaluation.js +5 -5
  42. package/dist/kits/interpretability.js +320 -302
  43. package/dist/kits/operations.js +6 -6
  44. package/dist/kits/research.js +558 -0
  45. package/dist/kits/training.js +6 -6
  46. package/dist/layout.js +205 -110
  47. package/dist/lesson/spec.js +11 -11
  48. package/dist/lesson.js +4 -4
  49. package/dist/mdx.js +6 -6
  50. package/dist/navigation.js +2 -2
  51. package/dist/packages/charts/src/cartesian/index.d.ts +1 -1
  52. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +18 -0
  53. package/dist/packages/charts/src/chart-theme.d.ts +1 -1
  54. package/dist/packages/charts/src/figure/caption-scope.d.ts +12 -0
  55. package/dist/packages/charts/src/figure/figure-frame.d.ts +2 -1
  56. package/dist/packages/charts/src/index.d.ts +2 -0
  57. package/dist/packages/charts/src/plot/plot-surface.d.ts +3 -1
  58. package/dist/packages/collections/src/index.d.ts +1 -1
  59. package/dist/packages/collections/src/metrics.d.ts +9 -1
  60. package/dist/packages/content/src/index.d.ts +2 -0
  61. package/dist/packages/content/src/text-match.d.ts +22 -0
  62. package/dist/packages/core/src/index.d.ts +1 -0
  63. package/dist/packages/core/src/surfaces.d.ts +12 -2
  64. package/dist/packages/forms/src/index.d.ts +2 -0
  65. package/dist/packages/forms/src/token-input.d.ts +24 -0
  66. package/dist/packages/kits/src/interpretability/index.d.ts +1 -1
  67. package/dist/packages/kits/src/interpretability/logit-lens.d.ts +10 -1
  68. package/dist/packages/kits/src/research/finding-card.d.ts +43 -0
  69. package/dist/packages/kits/src/research/index.d.ts +8 -0
  70. package/dist/packages/kits/src/research/milestone-path.d.ts +36 -0
  71. package/dist/packages/kits/src/research/specimen-diff.d.ts +41 -0
  72. package/dist/packages/kits/src/research/work-heartbeat.d.ts +34 -0
  73. package/dist/packages/layout/src/figure-grid.d.ts +8 -0
  74. package/dist/packages/layout/src/index.d.ts +4 -1
  75. package/dist/packages/layout/src/sidebar.d.ts +7 -0
  76. package/dist/packages/layout/src/workbench.d.ts +4 -1
  77. package/dist/packages/teaching/src/article/article-context.d.ts +2 -0
  78. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +13 -0
  79. package/dist/packages/teaching/src/article/article.d.ts +6 -1
  80. package/dist/packages/teaching/src/article/figure.d.ts +20 -3
  81. package/dist/packages/teaching/src/article/index.d.ts +1 -1
  82. package/dist/packages/teaching/src/article/view-essay.d.ts +2 -1
  83. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +4 -0
  84. package/dist/packages/teaching/src/lesson/index.d.ts +2 -2
  85. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +19 -3
  86. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +2 -0
  87. package/dist/packages/teaching/src/lesson/playback.d.ts +9 -6
  88. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +7 -2
  89. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +4 -1
  90. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +5 -6
  91. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +1 -1
  92. package/dist/packages/teaching/src/scene/scene-node.d.ts +4 -1
  93. package/dist/packages/teaching/src/scene/scene-validate.d.ts +6 -0
  94. package/dist/packages/teaching/src/scene/scene-wire.d.ts +6 -1
  95. package/dist/packages/teaching/src/scene/scene.d.ts +1 -1
  96. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +5 -1
  97. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +1 -1
  98. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +1 -1
  99. package/dist/packages/teaching/src/time/tween.d.ts +2 -0
  100. package/dist/{param-CqKUTHaO.js → param-BdqTpZER.js} +175 -108
  101. package/dist/{pierre-diff-DlvjyuJn.js → pierre-diff-aGyQK5xK.js} +1 -1
  102. package/dist/{plot-axes-DJkLW4wk.js → plot-axes-D5S9BnBa.js} +1 -1
  103. package/dist/{plot-layout-CZVSJ-le.js → plot-layout-B2xRt-_k.js} +146 -132
  104. package/dist/{plot-marks-uozcbOIX.js → plot-marks-FVsbFkUs.js} +3 -3
  105. package/dist/{plot-surface-CbVBvgqZ.js → plot-surface-0cKFwtws.js} +11 -11
  106. package/dist/{plot-width-DcqtSgzb.js → plot-width-D3hTycYX.js} +1 -1
  107. package/dist/{reference-lines-BDcttOp0.js → reference-lines-nSxcZVF5.js} +2 -2
  108. package/dist/{scene-0z2gbaDE.js → scene-BwJKueD6.js} +1228 -1126
  109. package/dist/scene.js +1 -1
  110. package/dist/{slope-chart-BKVEAVCs.js → slope-chart-CGTYbFxi.js} +182 -182
  111. package/dist/{src-CpdJlDhO.js → src-9EJskqB_.js} +73 -31
  112. package/dist/{src-Dcfq8vE4.js → src-B2rgpWap.js} +48 -14
  113. package/dist/{src-BPTDJqt0.js → src-Ci8DeY8J.js} +1 -1
  114. package/dist/{src-CGc_hjxJ.js → src-DFW49IAs.js} +143 -111
  115. package/dist/{src-BD6xlvDt.js → src-Dxs3Buo_.js} +203 -137
  116. package/dist/{src-CExIrXPC.js → src-npqwq3Sa.js} +1 -1
  117. package/dist/styles2.css +136 -17
  118. package/dist/{time-series-BgzGNOk0.js → time-series-Dh8y5ba0.js} +1018 -944
  119. package/dist/{token-heatmap-BrW1OsKD.js → token-heatmap-BTrZ3-N4.js} +86 -86
  120. package/dist/{token-predictions-yerq_Oet.js → token-predictions-CUe4junQ.js} +129 -129
  121. package/dist/{transport-BJweqDPj.js → transport-4V9rfYHN.js} +291 -246
  122. package/dist/{tree-diagram-D09BRqE-.js → tree-diagram-Dpqmo-fh.js} +118 -118
  123. package/dist/{treemap-CW4WsJNL.js → treemap-BUSaVD3m.js} +28 -28
  124. package/dist/use-tween-BsaEO862.js +10 -0
  125. package/dist/{violin-plot-DrtPZ1-T.js → violin-plot-BxaLwdRi.js} +126 -126
  126. package/dist/{waterfall-DYLSnGjm.js → waterfall-CcDMdKec.js} +43 -43
  127. package/package.json +5 -1
  128. package/recipes/counting-cards.tsx +3 -3
  129. package/skills/review-explainer/SKILL.md +2 -1
  130. package/skills/upgrade-elements/references/releases.md +61 -0
  131. package/skills/use-elements/SKILL.md +3 -1
  132. package/skills/use-elements/references/kits.md +7 -6
  133. package/skills/use-elements/references/styling.md +23 -0
  134. package/skills/use-elements/references/teaching.md +13 -0
  135. package/skills/write-explainer/references/article.md +50 -2
  136. package/skills/write-explainer/references/lesson.md +18 -9
  137. package/skills/write-explainer/references/scene-parts.md +17 -12
  138. package/skills/write-explainer/references/scene.md +25 -3
  139. package/dist/figure-frame-BJ3REgTA.js +0 -270
  140. package/dist/use-tween-5HZ55_9d.js +0 -72
@@ -1,11 +1,14 @@
1
1
  import type { ReactNode } from 'react';
2
- export declare function Workbench({ header, children, inspector, }: {
2
+ export declare function Workbench({ header, children, inspector, isResizable, inspectorInitialPercent, }: {
3
3
  readonly header?: ReactNode;
4
4
  readonly children: ReactNode;
5
5
  readonly inspector?: {
6
6
  readonly label: string;
7
7
  readonly content: ReactNode;
8
8
  } | undefined;
9
+ /** Lets desktop readers drag the divider between the main column and the inspector pane. */
10
+ readonly isResizable?: boolean;
11
+ readonly inspectorInitialPercent?: number;
9
12
  }): ReactNode;
10
13
  export declare function WorkbenchScroll({ label, children, isFlush, scrollRestorationId, }: {
11
14
  readonly label: string;
@@ -21,6 +21,8 @@ export type ChallengeRegistry = {
21
21
  export type ArticleScope = {
22
22
  readonly view: ArticleView;
23
23
  readonly title: string;
24
+ /** Whether the article and static views list the beats. False when the host's own navigation lists them. */
25
+ readonly hasContents: boolean;
24
26
  readonly lesson: AnyLesson;
25
27
  readonly locale: string;
26
28
  readonly labels: ArticleLabels;
@@ -1,3 +1,4 @@
1
+ import * as stylex from '@stylexjs/stylex';
1
2
  /**
2
3
  * The geometry every article view shares. Essay text keeps a measure of about 68 characters. From `withMargin` the text
3
4
  * gains a margin column for asides and wide figures, and from `withContents` the contents list sits beside it.
@@ -11,4 +12,16 @@ export declare const articleLayout: {
11
12
  withMargin: string;
12
13
  withContents: string;
13
14
  narrow: string;
15
+ withoutContents: string;
14
16
  };
17
+ /**
18
+ * How far from the top a sticky part of the article stops, and how much room a link target keeps above it. The essay
19
+ * view raises it to the height of its compact contents bar where that bar shows.
20
+ */
21
+ export declare const articleSticky: stylex.VarGroup<Readonly<{
22
+ top: string;
23
+ }>, symbol>;
24
+ /** Marks a framed figure, so its strips and visual can follow a report frame inside it. */
25
+ export declare const framedFigure: Readonly<{
26
+ readonly marker: stylex.StyleXClassNameFor<"marker", symbol>;
27
+ }>;
@@ -29,6 +29,11 @@ export type ArticleProps<Params extends LessonParams, Derived extends string, Be
29
29
  /** Hears each change of the reader's progress. A change an agent makes is refused before it gets here. */
30
30
  readonly onProgressChange?: ((progress: LessonProgress, details: ProgressChangeDetails) => void) | undefined;
31
31
  readonly labels?: Partial<ArticleLabels> | undefined;
32
+ /**
33
+ * Whether the article and static views show their contents list. Set it to false when the host's own navigation lists
34
+ * the beats, such as a rail that sets the beat through `lessonProps`. The text column keeps its measure.
35
+ */
36
+ readonly hasContents?: boolean | undefined;
32
37
  /** Passed to the `Lesson` the article renders: controlled values, beat and step, or address bar sync. */
33
38
  readonly lessonProps?: Omit<LessonProps<Params, Derived, Beat>, 'lesson' | 'locale' | 'storageKey' | 'children'> | undefined;
34
39
  /** The essay: `Beat`s, and around them `References` and anything else. */
@@ -39,4 +44,4 @@ export type ArticleProps<Params extends LessonParams, Derived extends string, Be
39
44
  * around them. It renders the `Lesson`, the tone scope and one link scope, and arranges the same children in four
40
45
  * views. The reader's progress is the UI SDK primitive `lesson-progress`, which counts only what the reader did.
41
46
  */
42
- export declare function Article<Params extends LessonParams, Derived extends string, Beat extends string>({ lesson, locale, title, authors, date, summary, tones, view, math, storageKey, progress, defaultProgress, onProgressChange, labels, lessonProps, children, }: ArticleProps<Params, Derived, Beat>): ReactNode;
47
+ export declare function Article<Params extends LessonParams, Derived extends string, Beat extends string>({ lesson, locale, title, authors, date, summary, tones, view, math, storageKey, progress, defaultProgress, onProgressChange, labels, hasContents, lessonProps, children, }: ArticleProps<Params, Derived, Beat>): ReactNode;
@@ -5,7 +5,24 @@ export declare const FigureCopy: import("react").Context<boolean>;
5
5
  export declare const FigureColumn: import("react").Context<boolean>;
6
6
  /** How wide a figure is: the text column, or the text and its margin on wide screens. */
7
7
  export type FigureSize = 'text' | 'wide';
8
- export type FigureProps = {
8
+ /** The frame a figure takes: given a strip it is framed, and without one `isFramed` frames the visual alone. */
9
+ export type FigureFraming = {
10
+ /** Frames a figure that has no strip, so it matches the framed figures beside it. Defaults to false. */
11
+ readonly isFramed?: boolean | undefined;
12
+ readonly header?: undefined;
13
+ readonly footer?: undefined;
14
+ } | {
15
+ /** A figure with a strip is always framed: its controls belong to the frame. */
16
+ readonly isFramed?: true | undefined;
17
+ /**
18
+ * Controls above the visual, such as a `Transport`. Given this or `footer`, the figure sits in a hairline frame
19
+ * with a strip for each, ruled off from the visual.
20
+ */
21
+ readonly header?: ReactNode;
22
+ /** Controls below the visual, such as a `ParamChoice` or a reset button, in the framed figure's bottom strip. */
23
+ readonly footer?: ReactNode;
24
+ };
25
+ export type FigureProps = FigureFraming & {
9
26
  /** The figure's id, unique in the article. It is the element id, so `#id` links land on the figure. */
10
27
  readonly id: string;
11
28
  /** What the reader should see in the figure, after its number. */
@@ -19,7 +36,7 @@ export type FigureProps = {
19
36
  readonly reads?: ReadonlyArray<string> | undefined;
20
37
  /** Wide figures, the default, reach into the margin column on wide screens. */
21
38
  readonly size?: FigureSize | undefined;
22
- /** The chart, scene or image. */
39
+ /** The chart, scene or image. A chart or scene inside keeps its title as its name and prints only the caption. */
23
40
  readonly children: ReactNode;
24
41
  };
25
42
  /**
@@ -27,7 +44,7 @@ export type FigureProps = {
27
44
  * are numbered in reading order. Give each a `description` so the static view and assistive technology can say what it
28
45
  * shows.
29
46
  */
30
- export declare function Figure({ id, caption, description, size, children }: FigureProps): ReactNode;
47
+ export declare function Figure({ id, caption, description, size, header, footer, isFramed: isFramedProp, children, }: FigureProps): ReactNode;
31
48
  export type FigureReferenceProps = {
32
49
  /** The id of the figure the reference points to. */
33
50
  readonly to: string;
@@ -12,7 +12,7 @@ export { articleChecks } from './article-checks.ts';
12
12
  export { answerSources, articleOutline } from './article-outline.ts';
13
13
  export type { BeatProps } from './beat.tsx';
14
14
  export { Beat } from './beat.tsx';
15
- export type { FigureProps, FigureReferenceProps, FigureSize, RevealProps } from './figure.tsx';
15
+ export type { FigureFraming, FigureProps, FigureReferenceProps, FigureSize, RevealProps } from './figure.tsx';
16
16
  export { Figure, FigureReference, Reveal, useRevealed } from './figure.tsx';
17
17
  export type { AsideProps, CiteProps, FootnoteProps, ReferencesProps } from './notes.tsx';
18
18
  export type { ArticleOutline, OutlineBeat, OutlineFigure, OutlinePrediction, ReferenceItem } from './outline-types.ts';
@@ -8,6 +8,7 @@ export type ViewProps = {
8
8
  };
9
9
  /**
10
10
  * The article view: a scrolling essay with a contents list that follows the reading position. Scrolling a beat into the
11
- * reading band makes it the lesson's beat, and a beat set elsewhere, such as by an agent, scrolls into view.
11
+ * reading band makes it the lesson's beat, and a beat set elsewhere, such as by an agent, scrolls into view. Below
12
+ * `withContents` the list folds into a sticky bar, which a focused element or a linked target is never left under.
12
13
  */
13
14
  export declare function EssayView({ article, header, children }: ViewProps): ReactNode;
@@ -56,6 +56,8 @@ export type LessonBeat = {
56
56
  readonly steps?: number | undefined;
57
57
  /** The states worth seeing on a beat sheet and in the static view. The first is the beat's opening state. */
58
58
  readonly states?: ReadonlyArray<LessonState> | undefined;
59
+ /** The params this beat owns, which `resetBeat` returns to their opening values. Defaults to those its states set. */
60
+ readonly params?: ReadonlyArray<string> | undefined;
59
61
  };
60
62
  /** A derived value as a lesson keeps it: its label and format. */
61
63
  export type LessonDerived = {
@@ -122,6 +124,8 @@ export declare function paramProblem({ name, param, value, }: {
122
124
  readonly param: LessonParam;
123
125
  readonly value: unknown;
124
126
  }): string | undefined;
127
+ /** The params a beat owns: the ones it declares, or else every param its states set. */
128
+ export declare function beatParams(beat: LessonBeat): ReadonlyArray<string>;
125
129
  /**
126
130
  * Declares a lesson: its params with their ranges, steps and formats, the values derived from them, and its beats as
127
131
  * plain data. Every prose value, control, figure, player and agent of the lesson reads these names. A duplicate or
@@ -6,8 +6,8 @@ export { LessonLocale, useLessonLocale } from './lesson-locale.ts';
6
6
  export type { AnyLesson, ChoiceParam, LessonBeat, LessonDefinition, LessonDerived, LessonDerivedInput, LessonGraph, LessonInput, LessonParam, LessonParams, LessonState, LessonValue, LessonValues, NumberParam, ParamValues, ToggleParam, ToggleValue, } from './define-lesson.ts';
7
7
  export { defineLesson, lessonGraph } from './define-lesson.ts';
8
8
  export type { LessonApi, LessonChangeOrigin, LessonPlaceChangeDetails, LessonPlaceChangeReason, LessonPlaceOrigin, LessonPlayingChangeDetails, LessonValuesChangeDetails, LessonValuesChangeReason, } from './lesson-store.ts';
9
- export type { LessonPlayer, LessonPlayingChangeReason, PlayOrigin, PlaybackPace } from './lesson-player.ts';
10
- export { playbackPaces } from './lesson-player.ts';
9
+ export type { LessonPlayer, LessonPlayingChangeReason, PlayOrigin, PlaybackLength, PlaybackPace, PlaybackRun, } from './lesson-player.ts';
10
+ export { playbackPaces, playbackRuns } from './lesson-player.ts';
11
11
  export type { LessonProps } from './lesson.tsx';
12
12
  export { Lesson } from './lesson.tsx';
13
13
  export type { LessonControls } from './use-lesson.ts';
@@ -8,12 +8,28 @@ export declare const playbackPaces: {
8
8
  };
9
9
  /** A player's pace, from `playbackPaces`. */
10
10
  export type PlaybackPace = keyof typeof playbackPaces;
11
+ /** How long a timed run takes from `from` to `to`, in seconds, whatever the number of steps between. */
12
+ export declare const playbackRuns: {
13
+ readonly short: 2;
14
+ readonly regular: 5;
15
+ readonly long: 10;
16
+ };
17
+ /** A timed run's length, from `playbackRuns`. */
18
+ export type PlaybackLength = keyof typeof playbackRuns;
19
+ /**
20
+ * A whole run from `from` to `to` in a set time, such as a 320-step training run that takes `long`. With `isEased` the
21
+ * value starts fast and settles, on the curve every tween uses.
22
+ */
23
+ export type PlaybackRun = {
24
+ readonly run: PlaybackLength;
25
+ readonly isEased?: boolean | undefined;
26
+ };
11
27
  /** A number param that a `Playback` drives: where it starts, where it ends and how fast it goes. */
12
28
  export type LessonPlayer = {
13
29
  readonly name: string;
14
30
  readonly from: number;
15
31
  readonly to: number;
16
- readonly pace: PlaybackPace;
32
+ readonly pace: PlaybackPace | PlaybackRun;
17
33
  readonly isLooping: boolean;
18
34
  };
19
35
  /** Why a player started or stopped: a press, the end of its run or a hidden tab, or a call. */
@@ -44,8 +60,8 @@ export type LessonPlayers = {
44
60
  readonly pause: (origin?: PlayOrigin) => void;
45
61
  };
46
62
  /**
47
- * Makes a lesson's players. A player advances its param one step at a time at its pace, stops at its end or starts over
48
- * from `from`, and stops when the tab is hidden. With reduced motion, play shows the end at once.
63
+ * Makes a lesson's players. A player advances its param a step at a time at its pace, or along a timed run. It stops at
64
+ * its end or starts over, and when the tab is hidden; with reduced motion, play shows the end at once.
49
65
  */
50
66
  export declare function createPlayers(host: PlayerHost): LessonPlayers;
51
67
  export {};
@@ -61,6 +61,8 @@ export type LessonApi = {
61
61
  readonly showState: (state: string, origin?: LessonChangeOrigin) => boolean;
62
62
  /** Puts every param back to the value the lesson opened with. */
63
63
  readonly reset: (origin?: LessonChangeOrigin) => boolean;
64
+ /** Puts the params one beat owns back to their opening values in one change, and leaves every other param alone. */
65
+ readonly resetBeat: (beat: string, origin?: LessonChangeOrigin) => boolean;
64
66
  /** Moves to a beat, at its first reveal step unless `step` says otherwise. */
65
67
  readonly setBeat: (beat: string, step?: number, origin?: LessonPlaceOrigin) => boolean;
66
68
  /** Shows the next reveal step, or the next beat at its first step. */
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { NumberParam } from './define-lesson.ts';
3
3
  import type { LessonScope } from './lesson-context.ts';
4
- import type { PlaybackPace, PlayOrigin } from './lesson-player.ts';
4
+ import type { PlaybackPace, PlaybackRun, PlayOrigin } from './lesson-player.ts';
5
5
  import type { LessonChangeOrigin } from './lesson-store.ts';
6
6
  export type PlaybackProps = {
7
7
  /** The number param the player moves. */
@@ -10,8 +10,11 @@ export type PlaybackProps = {
10
10
  readonly from?: number | undefined;
11
11
  /** Where play ends. Defaults to the param's max. */
12
12
  readonly to?: number | undefined;
13
- /** How many steps a second: `fast`, `regular` or `slow`. */
14
- readonly pace?: PlaybackPace | undefined;
13
+ /**
14
+ * How many steps a second, by name, or a timed run. A run of `long` crosses the whole range in ten seconds however
15
+ * many steps it has. Its `isEased` lets it start fast and settle.
16
+ */
17
+ readonly pace?: PlaybackPace | PlaybackRun | undefined;
15
18
  /** Starts over from `from` at the end instead of stopping there. */
16
19
  readonly isLooping?: boolean | undefined;
17
20
  };
@@ -33,9 +36,9 @@ export declare function playerRange(scope: LessonScope, name: string, param: Num
33
36
  readonly to: number;
34
37
  };
35
38
  /**
36
- * Drives a number param over time, one step at a time on the lesson's shared clock: a training step, a token index, a
37
- * temperature sweep. It renders nothing; a `Transport` or `usePlayback` plays it. It pauses when the tab is hidden or
38
- * the reader changes the value, and with reduced motion play shows the end at once.
39
+ * Drives a number param over time on the lesson's shared clock, a step at a time or as one timed run: a training step,
40
+ * a token index, a temperature sweep. It renders nothing; a `Transport` or `usePlayback` plays it. It pauses when the
41
+ * tab is hidden or the reader changes the value, and with reduced motion play shows the end at once.
39
42
  */
40
43
  export declare function Playback({ name, from, to, pace, isLooping }: PlaybackProps): ReactNode;
41
44
  /** Plays, pauses and moves the player of a number param in the nearest lesson. */
@@ -13,8 +13,13 @@ export type LessonControls<Params extends LessonParams, Derived extends string,
13
13
  readonly setMany: (values: Partial<ParamValues<Params>>, origin?: LessonChangeOrigin) => boolean;
14
14
  /** Shows a state a beat declares, by its id, in one change. Params it does not name take their opening values. */
15
15
  readonly show: (state: string, origin?: LessonChangeOrigin) => boolean;
16
- /** Puts every param back to its opening value. */
17
- readonly reset: () => boolean;
16
+ /** Puts every param of the whole lesson back to its opening value, the reader's work in every beat included. */
17
+ readonly reset: (origin?: LessonChangeOrigin) => boolean;
18
+ /**
19
+ * Puts the params one beat owns back to their opening values in one change: its `params`, or those its states set.
20
+ * Use it for a figure's reset button, so the other beats keep the reader's values.
21
+ */
22
+ readonly resetBeat: (beat: Beat, origin?: LessonChangeOrigin) => boolean;
18
23
  readonly beat: Beat | null;
19
24
  /** The reveal step inside the beat, from 0. */
20
25
  readonly step: number;
@@ -16,6 +16,8 @@ export type ScenePlaneLabels = {
16
16
  readonly pointParam: string;
17
17
  /** Added after a movable point's label in the readout. */
18
18
  readonly pointMovable: string;
19
+ /** A bound axis in a movable point's spoken value. `{name}` is the param's label and `{value}` its written value. */
20
+ readonly pointValue: string;
19
21
  /** `{id}` names the region. */
20
22
  readonly regionShape: string;
21
23
  /** `{id}` names the rule. */
@@ -34,7 +36,8 @@ export declare const planeLabels: {
34
36
  readonly pointLabel: 'The point "{id}" can be moved, so it needs a `label` for the readout.';
35
37
  readonly pointOutsideLesson: 'The point "{id}" sets lesson params, so it must be inside a Lesson.';
36
38
  readonly pointParam: 'The point "{id}" sets "{name}", which lesson "{lesson}" does not declare as a number param.';
37
- readonly pointMovable: ' Use the arrow keys to move it.';
39
+ readonly pointMovable: ' Tab to it and use the arrow keys to move it.';
40
+ readonly pointValue: '{name} {value}';
38
41
  readonly regionShape: 'The region "{id}" needs one of `between`, `above`, `below` or `points`.';
39
42
  readonly ruleAxis: 'The rule "{id}" needs `x` or `y`, and not both.';
40
43
  readonly projectionSource: 'The projection "{id}" needs `of` or `at`, and not both.';
@@ -4,7 +4,7 @@ import type { MarkEmphasis } from '../../../../charts/src/plot/index.ts';
4
4
  import type { Pace } from '../../time/tween.ts';
5
5
  import type { ScenePosition } from '../scene-geometry.ts';
6
6
  import type { ScenePlaneLabels } from './plane-labels.ts';
7
- /** Why a point moved: a pointer drag, or an arrow key. A cancelled drag reports `drag` with the starting position. */
7
+ /** Why a point moved: a pointer drag, or a key. A cancelled drag reports `drag` with the starting position. */
8
8
  export type ScenePointMoveDetails = {
9
9
  readonly reason: 'drag' | 'step-key';
10
10
  readonly event: PointerEvent | KeyboardEvent;
@@ -34,8 +34,8 @@ export type ScenePointProps = {
34
34
  /** True keeps the point and what attaches to it at full strength while the rest recede. */
35
35
  readonly isActive?: boolean | undefined;
36
36
  /**
37
- * Makes the point movable by a pointer and by the arrow keys when it is the keyboard cursor. It is told where the
38
- * reader wants the point; the point stays where `at` says until the application moves it.
37
+ * Makes the point a slider the reader drags or reaches with Tab and moves with the keys. It is told where the reader
38
+ * wants the point; the point stays where `at` says until the application moves it.
39
39
  */
40
40
  readonly onMove?: ((position: ScenePosition, details: ScenePointMoveDetails) => void) | undefined;
41
41
  /**
@@ -52,8 +52,7 @@ export type ScenePointProps = {
52
52
  readonly labels?: Partial<ScenePlaneLabels> | undefined;
53
53
  };
54
54
  /**
55
- * A point at a position in the scene, with optional text beside it. Give it `sets` or `onMove` and the reader grabs it
56
- * with a pointer, or moves it with the arrow keys while it is the keyboard cursor. It follows the pointer at once and
57
- * eases only when the application moves it.
55
+ * A point at a position in the scene, with optional text beside it. Give it `sets` or `onMove` and it is a slider: the
56
+ * reader drags it, or reaches it with Tab and moves it with the arrow keys, Home and End. It eases only when moved.
58
57
  */
59
58
  export declare function ScenePoint({ id, at, label, text, tone, emphasis, isShown, isActive, onMove, sets, snap, along, pace, labels: labelInput, }: ScenePointProps): ReactNode;
@@ -161,7 +161,7 @@ export declare function sceneMinWidth({ frames, edged, links, domain, innerHeigh
161
161
  readonly frames: ReadonlyArray<SceneFrame>;
162
162
  /** The frames the margins keep whole: `frames`, and the room drawn around some of them, such as a group's outline. */
163
163
  readonly edged: ReadonlyArray<SceneFrame>;
164
- /** The ends of each wire. Wired nodes keep room between them for the wire, its arrow and its text. */
164
+ /** The ends of each wire, with the room the wire asks for between them: its stroke, its arrow and its text. */
165
165
  readonly links: ReadonlyArray<SceneLink>;
166
166
  readonly domain: SceneDomain;
167
167
  readonly innerHeight: number;
@@ -29,7 +29,10 @@ export type SceneNodeProps = {
29
29
  readonly isShown?: boolean | undefined;
30
30
  /** True keeps the node at full strength while the parts it is not connected to recede. */
31
31
  readonly isActive?: boolean | undefined;
32
- /** 0 shows the front, 1 the back; values between are mid-flip. */
32
+ /**
33
+ * 0 shows the front, 1 the back; values between are mid-flip. Only the face toward the reader is rendered, so a
34
+ * turned-away face reaches no screen reader or agent, and its content remounts when it turns back.
35
+ */
33
36
  readonly turn?: number | undefined;
34
37
  /** 0 rests on the page, 1 is raised toward the reader: larger, with a deeper shadow. */
35
38
  readonly lift?: number | undefined;
@@ -6,6 +6,11 @@ export type SceneLabels = {
6
6
  readonly objects: string;
7
7
  /** The header of the exact-value table. */
8
8
  readonly objectColumn: string;
9
+ /**
10
+ * Ends the plot's accessible name when a press acts, with `onSelectedChange`. Name the action, such as "Press Enter
11
+ * to turn the card over."
12
+ */
13
+ readonly press: string;
9
14
  readonly missingLocale: string;
10
15
  readonly invalidBox: string;
11
16
  readonly invalidAspect: string;
@@ -28,6 +33,7 @@ export type SceneLabels = {
28
33
  export declare const sceneLabels: {
29
34
  readonly objects: 'diagram parts';
30
35
  readonly objectColumn: 'Part';
36
+ readonly press: 'Press Enter or Space to activate a part.';
31
37
  readonly missingLocale: 'This scene needs a locale. Pass `locale`, or place it inside a Lesson.';
32
38
  readonly invalidBox: 'The scene box needs two finite, increasing values on each axis.';
33
39
  readonly invalidAspect: 'The scene aspect must be a positive, finite ratio of width to height.';
@@ -27,6 +27,11 @@ export type SceneWireProps = {
27
27
  readonly tone?: ChartTone | undefined;
28
28
  /** How the wire runs between its ends. Defaults to `straight`. */
29
29
  readonly shape?: SceneWireShape | undefined;
30
+ /**
31
+ * Pixels the wire's middle bows off the line between its ends. Positive is above a wire that runs across and right of
32
+ * an upright one. A wire does not avoid other objects, so bow it around a node between its ends.
33
+ */
34
+ readonly bend?: number | undefined;
30
35
  /** Dashed for a modelled or proposed connection. */
31
36
  readonly isDashed?: boolean | undefined;
32
37
  /** Draws an arrowhead at the `to` end. Defaults to true. */
@@ -42,4 +47,4 @@ export type SceneWireProps = {
42
47
  * A connection between two scene objects that stays attached to their edges while they move. Its thickness can carry a
43
48
  * signed weight, eased when the weight changes. Give it a label to make it an item the reader can inspect.
44
49
  */
45
- export declare function SceneWire({ from, to, id, label, text, textSide, weight, tone, shape, isDashed, hasArrow, isShown, isActive, emphasis, }: SceneWireProps): ReactNode;
50
+ export declare function SceneWire({ from, to, id, label, text, textSide, weight, tone, shape, bend, isDashed, hasArrow, isShown, isActive, emphasis, }: SceneWireProps): ReactNode;
@@ -19,7 +19,7 @@ export type SceneProps = Omit<FigureProps, 'locale'> & FigureSelectionProps & {
19
19
  readonly pace?: Pace | undefined;
20
20
  /**
21
21
  * The narrowest plot in pixels; below it the plot scrolls inside the frame. Left out, it is the width at which no
22
- * two objects on the same row touch. Set it only to keep more room than the objects need.
22
+ * two objects on one row touch and each wire keeps room for its arrow and text. Set it only to keep more room.
23
23
  */
24
24
  readonly minWidth?: number | undefined;
25
25
  /** The wire weight magnitude drawn thickest. Weights must lie within plus or minus this. Defaults to 1. */
@@ -1,4 +1,4 @@
1
- import type { NumericDomain } from '../../../../charts/src/index.ts';
1
+ import type { ChartTone, NumericDomain } from '../../../../charts/src/index.ts';
2
2
  import type { HeatmapPalette } from '../../../../charts/src/matrix/index.ts';
3
3
  import type { SceneOffset } from '../scene-geometry.ts';
4
4
  /** The pixel boxes of the named cell sizes. */
@@ -30,6 +30,10 @@ export type SceneCellInput = {
30
30
  readonly value?: number | undefined;
31
31
  /** The readout sentence. Left out, the cell says its row, column and value. */
32
32
  readonly label?: string | undefined;
33
+ /** The hue of the cell's text and tint, such as a card's suit. A palette's fill still wins. */
34
+ readonly tone?: ChartTone | undefined;
35
+ /** True draws the cell gray and unfilled, such as a card already dealt. Its value and label stay. */
36
+ readonly isMuted?: boolean | undefined;
33
37
  };
34
38
  /** The numbers of a vector or a matrix: a flat list, or a list of rows. */
35
39
  export type SceneCellValues = ReadonlyArray<number | ReadonlyArray<number>>;
@@ -61,7 +61,7 @@ export type SceneCellsProps = {
61
61
  readonly size?: SceneCellSizeName | undefined;
62
62
  /** One caption per row, drawn left of the grid in a column as wide as the longest. */
63
63
  readonly rowLabels?: ReadonlyArray<string> | undefined;
64
- /** One caption per column, drawn above the grid. */
64
+ /** One caption per column, drawn above the grid. A long caption wraps, and a word wider than its column overhangs. */
65
65
  readonly columnLabels?: ReadonlyArray<string> | undefined;
66
66
  /** A row, a column, or one cell where both are given, drawn with a strong outline. Indices count from 0. */
67
67
  readonly highlight?: {
@@ -20,7 +20,7 @@ export type SceneSlotProps = {
20
20
  readonly text?: string | undefined;
21
21
  /** The readout sentence. With one, the arrow keys reach the slot; Left and Right step on to a card sitting on it. */
22
22
  readonly label?: string | undefined;
23
- /** True draws the slot as the place that matters now: a solid outline and a tint. */
23
+ /** True draws the slot as the place that matters now: a solid outline and a tint. Nothing else recedes. */
24
24
  readonly isActive?: boolean | undefined;
25
25
  /** The hue of the outline while active. Defaults to neutral. */
26
26
  readonly tone?: ChartTone | undefined;
@@ -12,6 +12,8 @@ export type Tween<Key extends string> = {
12
12
  /** Stops any move in flight. The tween still answers `get` and can be moved again. */
13
13
  readonly destroy: () => void;
14
14
  };
15
+ /** Fast at first and settling gently, the curve the motion tokens use for interface transitions. */
16
+ export declare function eased(progress: number): number;
15
17
  /**
16
18
  * Makes a tween that starts at `initial`. Give it a new target with `to` and read `get` on each change: authors
17
19
  * describe where things are, and the tween supplies the motion between.