@mechane-ai/elements 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +288 -5
  2. package/bin/mechane-elements-catalog.mjs +104 -12
  3. package/dist/article-BXZr10QQ.js +1904 -0
  4. package/dist/article.js +1 -0
  5. package/dist/catalog.json +1389 -75
  6. package/dist/{categorical-values-DdfGIowV.js → categorical-values-BpVq8cFj.js} +1 -1
  7. package/dist/{cells--Bd1fQFR.js → cells-xVmnQ9oQ.js} +1 -1
  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 +3 -2
  17. package/dist/charts/plot.js +4 -4
  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 +2 -2
  23. package/dist/clock-DSm5lkNE.js +16 -0
  24. package/dist/collections.js +1 -1
  25. package/dist/describe-lesson-BmREzDpt.js +175 -0
  26. package/dist/{dumbbell-plot-B2ZTgQaI.js → dumbbell-plot-DQdTxDeO.js} +6 -5
  27. package/dist/{embedding-map-CGM_k6lC.js → embedding-map-CF-J-8JW.js} +5 -5
  28. package/dist/{figure-frame-wRkIEAwe.js → figure-frame-BJ3REgTA.js} +1 -1
  29. package/dist/forms.js +1 -1
  30. package/dist/{image-grid-CVA4SOy_.js → image-grid-Dl2sjIMB.js} +3 -3
  31. package/dist/kits/evaluation.js +5 -5
  32. package/dist/kits/interpretability.js +9 -9
  33. package/dist/kits/operations.js +4 -4
  34. package/dist/kits/training.js +4 -4
  35. package/dist/lesson/agent.js +811 -0
  36. package/dist/lesson/spec.js +661 -0
  37. package/dist/lesson.js +5 -0
  38. package/dist/mdx.js +227 -0
  39. package/dist/packages/charts/src/matrix/index.d.ts +1 -0
  40. package/dist/packages/charts/src/plot/plot-marks.d.ts +7 -3
  41. package/dist/packages/teaching/src/agent/index.d.ts +11 -0
  42. package/dist/packages/teaching/src/agent/learner-trace.d.ts +84 -0
  43. package/dist/packages/teaching/src/agent/lesson-bridge.d.ts +59 -0
  44. package/dist/packages/teaching/src/agent/lesson-tour.d.ts +63 -0
  45. package/dist/packages/teaching/src/agent/tutor-tools.d.ts +86 -0
  46. package/dist/packages/teaching/src/article/article-checks.d.ts +9 -0
  47. package/dist/packages/teaching/src/article/article-context.d.ts +49 -0
  48. package/dist/packages/teaching/src/article/article-error.d.ts +12 -0
  49. package/dist/packages/teaching/src/article/article-labels.d.ts +54 -0
  50. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +14 -0
  51. package/dist/packages/teaching/src/article/article-outline.d.ts +9 -0
  52. package/dist/packages/teaching/src/article/article.d.ts +42 -0
  53. package/dist/packages/teaching/src/article/beat-steps.d.ts +18 -0
  54. package/dist/packages/teaching/src/article/beat.d.ts +16 -0
  55. package/dist/packages/teaching/src/article/challenge.d.ts +29 -0
  56. package/dist/packages/teaching/src/article/exercise-styles.d.ts +76 -0
  57. package/dist/packages/teaching/src/article/figure.d.ts +51 -0
  58. package/dist/packages/teaching/src/article/index.d.ts +31 -0
  59. package/dist/packages/teaching/src/article/lesson-values.d.ts +5 -0
  60. package/dist/packages/teaching/src/article/notes.d.ts +36 -0
  61. package/dist/packages/teaching/src/article/outline-types.d.ts +73 -0
  62. package/dist/packages/teaching/src/article/predict.d.ts +58 -0
  63. package/dist/packages/teaching/src/article/progress-store.d.ts +64 -0
  64. package/dist/packages/teaching/src/article/scrolly.d.ts +26 -0
  65. package/dist/packages/{kits/src/explainers → teaching/src/article}/term.d.ts +8 -2
  66. package/dist/packages/teaching/src/article/tex.d.ts +12 -0
  67. package/dist/packages/teaching/src/article/view-essay.d.ts +13 -0
  68. package/dist/packages/teaching/src/article/view-present.d.ts +8 -0
  69. package/dist/packages/teaching/src/article/view-sheet.d.ts +7 -0
  70. package/dist/packages/teaching/src/article/view-static.d.ts +7 -0
  71. package/dist/packages/teaching/src/article/walk.d.ts +34 -0
  72. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +136 -0
  73. package/dist/packages/teaching/src/lesson/index.d.ts +24 -0
  74. package/dist/packages/teaching/src/lesson/inline-choice.d.ts +12 -0
  75. package/dist/packages/teaching/src/lesson/lesson-context.d.ts +18 -0
  76. package/dist/packages/teaching/src/lesson/lesson-error.d.ts +12 -0
  77. package/dist/packages/teaching/src/lesson/lesson-locale.d.ts +4 -0
  78. package/dist/packages/teaching/src/lesson/lesson-persistence.d.ts +17 -0
  79. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +51 -0
  80. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +84 -0
  81. package/dist/packages/teaching/src/lesson/lesson.d.ts +39 -0
  82. package/dist/packages/teaching/src/lesson/param-controls.d.ts +14 -0
  83. package/dist/packages/teaching/src/lesson/param.d.ts +34 -0
  84. package/dist/packages/teaching/src/lesson/playback.d.ts +42 -0
  85. package/dist/packages/teaching/src/lesson/transport.d.ts +19 -0
  86. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +36 -0
  87. package/dist/packages/teaching/src/mdx/essay-components.d.ts +79 -0
  88. package/dist/packages/teaching/src/mdx/essay-markdown.d.ts +41 -0
  89. package/dist/packages/teaching/src/mdx/essay.d.ts +32 -0
  90. package/dist/packages/teaching/src/mdx/index.d.ts +9 -0
  91. package/dist/packages/teaching/src/mdx/requested-view.d.ts +6 -0
  92. package/dist/packages/teaching/src/scene/flow/flow-layout.d.ts +38 -0
  93. package/dist/packages/teaching/src/scene/flow/flow-pulse.d.ts +16 -0
  94. package/dist/packages/teaching/src/scene/flow/scene-flow.d.ts +81 -0
  95. package/dist/packages/teaching/src/scene/index.d.ts +77 -0
  96. package/dist/packages/teaching/src/scene/morph/morph-scope.d.ts +28 -0
  97. package/dist/packages/teaching/src/scene/plane/plane-hit.d.ts +22 -0
  98. package/dist/packages/teaching/src/scene/plane/plane-label.d.ts +23 -0
  99. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +42 -0
  100. package/dist/packages/teaching/src/scene/plane/plane-math.d.ts +45 -0
  101. package/dist/packages/teaching/src/scene/plane/scene-axes.d.ts +30 -0
  102. package/dist/packages/teaching/src/scene/plane/scene-curve.d.ts +42 -0
  103. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +59 -0
  104. package/dist/packages/teaching/src/scene/plane/scene-projection.d.ts +27 -0
  105. package/dist/packages/teaching/src/scene/plane/scene-region.d.ts +38 -0
  106. package/dist/packages/teaching/src/scene/plane/scene-rule.d.ts +35 -0
  107. package/dist/packages/teaching/src/scene/plane/scene-vector.d.ts +39 -0
  108. package/dist/packages/teaching/src/scene/scene-bracket.d.ts +24 -0
  109. package/dist/packages/teaching/src/scene/scene-callout.d.ts +26 -0
  110. package/dist/packages/teaching/src/scene/scene-context.d.ts +179 -0
  111. package/dist/packages/teaching/src/scene/scene-custom.d.ts +31 -0
  112. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +181 -0
  113. package/dist/packages/teaching/src/scene/scene-group.d.ts +28 -0
  114. package/dist/packages/teaching/src/scene/scene-highlight.d.ts +19 -0
  115. package/dist/packages/teaching/src/scene/scene-layer.d.ts +16 -0
  116. package/dist/packages/teaching/src/scene/scene-node.d.ts +67 -0
  117. package/dist/packages/teaching/src/scene/scene-obstacles.d.ts +27 -0
  118. package/dist/packages/teaching/src/scene/scene-registry.d.ts +79 -0
  119. package/dist/packages/teaching/src/scene/scene-stagger.d.ts +43 -0
  120. package/dist/packages/teaching/src/scene/scene-style.d.ts +14 -0
  121. package/dist/packages/teaching/src/scene/scene-validate.d.ts +65 -0
  122. package/dist/packages/teaching/src/scene/scene-wire.d.ts +45 -0
  123. package/dist/packages/teaching/src/scene/scene.d.ts +36 -0
  124. package/dist/packages/teaching/src/scene/shapes/cell-color.d.ts +11 -0
  125. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +69 -0
  126. package/dist/packages/teaching/src/scene/shapes/scene-card.d.ts +114 -0
  127. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +84 -0
  128. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +37 -0
  129. package/dist/packages/teaching/src/scene/shapes/scene-stack.d.ts +46 -0
  130. package/dist/packages/teaching/src/scene/shapes/scene-token.d.ts +63 -0
  131. package/dist/packages/teaching/src/scene/shapes/scene-tokens.d.ts +40 -0
  132. package/dist/packages/teaching/src/scene/shapes/stack-book.d.ts +35 -0
  133. package/dist/packages/teaching/src/scene/shapes/stack-layout.d.ts +63 -0
  134. package/dist/packages/teaching/src/scene/shapes/token-layout.d.ts +39 -0
  135. package/dist/packages/teaching/src/spec/advice.d.ts +23 -0
  136. package/dist/packages/teaching/src/spec/chart-names.d.ts +2 -0
  137. package/dist/packages/teaching/src/spec/describe-lesson.d.ts +85 -0
  138. package/dist/packages/teaching/src/spec/explainer-guide.d.ts +21 -0
  139. package/dist/packages/teaching/src/spec/findings.d.ts +39 -0
  140. package/dist/packages/teaching/src/spec/index.d.ts +14 -0
  141. package/dist/packages/teaching/src/spec/lesson-plan.d.ts +43 -0
  142. package/dist/packages/teaching/src/spec/validate-plan.d.ts +11 -0
  143. package/dist/packages/teaching/src/time/clock.d.ts +7 -0
  144. package/dist/packages/teaching/src/time/tween.d.ts +19 -0
  145. package/dist/packages/teaching/src/time/use-tween.d.ts +6 -0
  146. package/dist/param-CqKUTHaO.js +450 -0
  147. package/dist/{plot-layout-BEuoOHbs.js → plot-layout-CZVSJ-le.js} +2 -1
  148. package/dist/{plot-marks-A64v7aTw.js → plot-marks-uozcbOIX.js} +15 -12
  149. package/dist/{plot-surface-CJTIqtck.js → plot-surface-CbVBvgqZ.js} +1 -1
  150. package/dist/{reference-lines-CWA8VeUR.js → reference-lines-BDcttOp0.js} +2 -2
  151. package/dist/scene-0z2gbaDE.js +4938 -0
  152. package/dist/scene.js +1 -0
  153. package/dist/{slope-chart-DT22h_ym.js → slope-chart-BKVEAVCs.js} +5 -5
  154. package/dist/{src-1EHkSFS-.js → src-BD6xlvDt.js} +2 -2
  155. package/dist/{src-D5NXRJZe.js → src-Dcfq8vE4.js} +1 -1
  156. package/dist/styles2.css +475 -18
  157. package/dist/{time-series-IB3CB93O.js → time-series-BgzGNOk0.js} +12 -10
  158. package/dist/{token-heatmap-C00DnoNO.js → token-heatmap-BrW1OsKD.js} +2 -2
  159. package/dist/{token-predictions-Cxx29iDr.js → token-predictions-yerq_Oet.js} +4 -4
  160. package/dist/transport-BJweqDPj.js +715 -0
  161. package/dist/{tree-diagram-DsckNKaW.js → tree-diagram-D09BRqE-.js} +4 -4
  162. package/dist/{treemap-9_DpLCW9.js → treemap-CW4WsJNL.js} +4 -4
  163. package/dist/use-tween-5HZ55_9d.js +72 -0
  164. package/dist/{violin-plot-BhPHKXsN.js → violin-plot-DrtPZ1-T.js} +5 -4
  165. package/dist/{waterfall-CGksuTy5.js → waterfall-DYLSnGjm.js} +4 -4
  166. package/package.json +26 -5
  167. package/recipes/counting-cards.tsx +656 -0
  168. package/recipes/explorable-essay.tsx +172 -0
  169. package/skills/extend-elements/SKILL.md +21 -0
  170. package/skills/plan-lesson/SKILL.md +86 -0
  171. package/skills/plan-lesson/references/plan-format.md +114 -0
  172. package/skills/plan-lesson/references/worked-plan.md +171 -0
  173. package/skills/review-elements/SKILL.md +4 -2
  174. package/skills/review-explainer/SKILL.md +97 -0
  175. package/skills/upgrade-elements/references/releases.md +65 -0
  176. package/skills/use-elements/SKILL.md +18 -16
  177. package/skills/use-elements/references/kits.md +2 -20
  178. package/skills/use-elements/references/teaching.md +36 -0
  179. package/skills/write-explainer/SKILL.md +112 -0
  180. package/skills/write-explainer/references/article.md +164 -0
  181. package/skills/write-explainer/references/lesson.md +148 -0
  182. package/skills/write-explainer/references/mdx.md +78 -0
  183. package/skills/write-explainer/references/scene-parts.md +273 -0
  184. package/skills/write-explainer/references/scene.md +168 -0
  185. package/skills/write-explainer/references/tutor.md +104 -0
  186. package/skills/write-explainer/references/worked-essay.md +459 -0
  187. package/templates/essay/AGENTS.md +14 -0
  188. package/templates/essay/README.md +59 -0
  189. package/templates/essay/index.html +17 -0
  190. package/templates/essay/package.template.json +21 -0
  191. package/templates/essay/plan.json +96 -0
  192. package/templates/essay/src/essay.mdx +97 -0
  193. package/templates/essay/src/figures.tsx +92 -0
  194. package/templates/essay/src/lesson.ts +83 -0
  195. package/templates/essay/src/main.tsx +53 -0
  196. package/templates/essay/src/mdx.d.ts +7 -0
  197. package/templates/essay/tsconfig.template.json +15 -0
  198. package/templates/essay/vite.config.template.txt +8 -0
  199. package/dist/kits/explainers.js +0 -452
  200. package/dist/packages/kits/src/explainers/figures.d.ts +0 -31
  201. package/dist/packages/kits/src/explainers/index.d.ts +0 -8
  202. package/dist/packages/kits/src/explainers/story-steps.d.ts +0 -46
  203. /package/dist/packages/{kits/src/explainers → teaching/src/article}/linked-target.d.ts +0 -0
  204. /package/dist/packages/{kits/src/explainers → teaching/src/lesson}/bound-value.d.ts +0 -0
@@ -0,0 +1,181 @@
1
+ import type { NumericDomain } from '../../../charts/src/index.ts';
2
+ import type { PlotMargins } from '../../../charts/src/plot/index.ts';
3
+ /** The outline of a node: a box, a pill, a circle, or text with no outline. Wires attach at this outline. */
4
+ export type SceneShape = 'box' | 'pill' | 'circle' | 'plain';
5
+ /** A named node size. Each is a fixed pixel box that fits a short label, so layout never depends on measuring. */
6
+ export type SceneSizeName = 'small' | 'medium' | 'large';
7
+ /** A node size by name, or an exact box in CSS pixels. */
8
+ export type SceneSize = SceneSizeName | {
9
+ readonly width: number;
10
+ readonly height: number;
11
+ };
12
+ /** A position in the scene's data units, as `[x, y]`. */
13
+ export type ScenePosition = readonly [across: number, up: number];
14
+ /** A position in data units, with named parts. */
15
+ export type SceneDataPoint = {
16
+ readonly x: number;
17
+ readonly y: number;
18
+ };
19
+ /** A data box in data units on each axis. */
20
+ type SceneDomain = {
21
+ readonly x: NumericDomain;
22
+ readonly y: NumericDomain;
23
+ };
24
+ /** A shift in CSS pixels from a data position: across to the right, then down. */
25
+ export type SceneOffset = readonly [across: number, down: number];
26
+ /**
27
+ * Where an object sits: its center in data units, an optional shift in pixels from there, and its size in pixels. A
28
+ * part that lays objects out in pixels, such as a pile of cards, shifts each from one data position.
29
+ */
30
+ export type SceneFrame = {
31
+ readonly x: number;
32
+ readonly y: number;
33
+ readonly width: number;
34
+ readonly height: number;
35
+ readonly offset?: SceneOffset | undefined;
36
+ /**
37
+ * What the object draws outside its box, in pixels per side, such as a caption or row labels. The scene makes room
38
+ * for it, and wires still meet the box.
39
+ */
40
+ readonly outset?: SceneMargins | undefined;
41
+ };
42
+ /** The room an object needs outside the data box, in pixels per side, such as the tick labels of an axis. */
43
+ export type SceneMargins = Partial<PlotMargins>;
44
+ /** A rectangle in the plot's CSS pixels, measured from its top left corner. */
45
+ export type SceneRect = {
46
+ readonly left: number;
47
+ readonly top: number;
48
+ readonly right: number;
49
+ readonly bottom: number;
50
+ };
51
+ /** A point in the plot's CSS pixels. */
52
+ export type ScenePixel = {
53
+ readonly x: number;
54
+ readonly y: number;
55
+ };
56
+ /** The part of the data box the camera shows. */
57
+ export type SceneView = {
58
+ readonly x0: number;
59
+ readonly x1: number;
60
+ readonly y0: number;
61
+ readonly y1: number;
62
+ };
63
+ /** The pixel boxes of the named node sizes for every shape but the circle. */
64
+ export declare const sceneNodeSizes: {
65
+ readonly small: {
66
+ readonly width: 64;
67
+ readonly height: 28;
68
+ };
69
+ readonly medium: {
70
+ readonly width: 120;
71
+ readonly height: 40;
72
+ };
73
+ readonly large: {
74
+ readonly width: 184;
75
+ readonly height: 64;
76
+ };
77
+ };
78
+ /** The diameters of the named circle sizes, in CSS pixels. */
79
+ export declare const sceneCircleSizes: {
80
+ readonly small: 32;
81
+ readonly medium: 48;
82
+ readonly large: 72;
83
+ };
84
+ /** The pixel box of a node of this size and shape. */
85
+ export declare function nodeBox(size: SceneSize, shape: SceneShape): {
86
+ readonly width: number;
87
+ readonly height: number;
88
+ };
89
+ /** The center of a rectangle. */
90
+ export declare function rectCenter(rect: SceneRect): ScenePixel;
91
+ /** The smallest rectangle around all of `rects`, or undefined when there are none. */
92
+ export declare function unionRect(rects: ReadonlyArray<SceneRect>): SceneRect | undefined;
93
+ /** A rectangle grown by `padding` pixels on every side. */
94
+ export declare function padRect(rect: SceneRect, padding: number): SceneRect;
95
+ /** Whether two rectangles share any area. */
96
+ export declare function rectsOverlap(first: SceneRect, second: SceneRect): boolean;
97
+ /** The area two rectangles share, in square pixels. */
98
+ export declare function sharedArea(first: SceneRect, second: SceneRect): number;
99
+ /** How long the part of the segment from `from` to `to` that lies inside `rect` is, in pixels. */
100
+ export declare function segmentInside({ rect, from, to, }: {
101
+ readonly rect: SceneRect;
102
+ readonly from: ScenePixel;
103
+ readonly to: ScenePixel;
104
+ }): number;
105
+ type EdgeInput = {
106
+ readonly rect: SceneRect;
107
+ readonly shape: SceneShape;
108
+ /** The point the edge faces, such as the other end of a wire. */
109
+ readonly toward: ScenePixel;
110
+ };
111
+ /**
112
+ * Where a line from the center of a node toward `toward` crosses the node's outline. Wires end there, so they meet the
113
+ * edge of a box, pill or circle and never its middle.
114
+ */
115
+ export declare function edgePoint({ rect, shape, toward }: EdgeInput): ScenePixel;
116
+ /** The midpoint of the side of a node that faces along an axis, where a curved or elbowed wire leaves it. */
117
+ export declare function sidePoint({ rect, axis, sign, }: {
118
+ readonly rect: SceneRect;
119
+ readonly axis: 'x' | 'y';
120
+ /** 1 for the right or bottom side, -1 for the left or top side. */
121
+ readonly sign: number;
122
+ }): ScenePixel;
123
+ type CameraInput = {
124
+ /** The whole data box. */
125
+ readonly domain: SceneDomain;
126
+ /** The drawing area in pixels. */
127
+ readonly width: number;
128
+ readonly height: number;
129
+ /** The frames the camera must show. Empty shows the whole box. */
130
+ readonly frames: ReadonlyArray<SceneFrame>;
131
+ /** The room left around the framed objects, in pixels. */
132
+ readonly padding: number;
133
+ };
134
+ /**
135
+ * The part of the data box that shows `frames` as large as it can with `padding` around them, keeping the box's aspect
136
+ * ratio and staying inside it. It zooms in at most eight times.
137
+ */
138
+ export declare function cameraView({ domain, width, height, frames, padding }: CameraInput): SceneView;
139
+ /** A pair of objects a wire joins, with the pixels the wire keeps between them. */
140
+ type SceneLink = {
141
+ readonly from: SceneFrame;
142
+ readonly to: SceneFrame;
143
+ readonly room: number | undefined;
144
+ };
145
+ /**
146
+ * The margins around the data box of a plot `width` by `height` pixels. Each side keeps whole the frames that reach
147
+ * past it and holds the largest room any of `reserved` asks for there.
148
+ */
149
+ export declare function sceneMargins({ frames, reserved, domain, width, height, }: {
150
+ readonly frames: ReadonlyArray<SceneFrame>;
151
+ readonly reserved: ReadonlyArray<SceneMargins>;
152
+ readonly domain: SceneDomain;
153
+ readonly width: number;
154
+ readonly height: number;
155
+ }): PlotMargins;
156
+ /**
157
+ * The plot width below which two frames on the same row would touch, or two wired frames would leave no room for the
158
+ * wire. Rows are pixel bands, because the plot height is fixed. The result is capped at 2400 pixels.
159
+ */
160
+ export declare function sceneMinWidth({ frames, edged, links, domain, innerHeight, reserved, }: {
161
+ readonly frames: ReadonlyArray<SceneFrame>;
162
+ /** The frames the margins keep whole: `frames`, and the room drawn around some of them, such as a group's outline. */
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. */
165
+ readonly links: ReadonlyArray<SceneLink>;
166
+ readonly domain: SceneDomain;
167
+ readonly innerHeight: number;
168
+ readonly reserved: ReadonlyArray<SceneMargins>;
169
+ }): number;
170
+ /** One item the arrow keys reach, where it sits now, with the stacking order that orders items sharing a place. */
171
+ export type SceneKeyboardItem = {
172
+ readonly id: string;
173
+ readonly rect: SceneRect;
174
+ readonly order: number;
175
+ };
176
+ /**
177
+ * Where the arrow keys find each item. Items whose centers lie a few pixels from an earlier one, such as piled cards,
178
+ * line up on a short row through its center in stacking order. Left and Right then step through them.
179
+ */
180
+ export declare function keyboardPlaces(items: ReadonlyArray<SceneKeyboardItem>): ReadonlyMap<string, SceneRect>;
181
+ export {};
@@ -0,0 +1,28 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../charts/src/index.ts';
3
+ import type { MarkEmphasis } from '../../../charts/src/plot/index.ts';
4
+ export type SceneGroupProps = {
5
+ /** Stable across states: the outline with this id eases to its new members. */
6
+ readonly id: string;
7
+ /** The readout sentence and, unless `text` is set, the name drawn on the outline. */
8
+ readonly label?: string | undefined;
9
+ /** A shorter name to draw, when the label is a full sentence. */
10
+ readonly text?: string | undefined;
11
+ /** The ids of the objects the outline surrounds. It follows them as they move. */
12
+ readonly around: ReadonlyArray<string>;
13
+ /** A hue for the outline, when it should match a thing the prose names. Left out, it is drawn in ink. */
14
+ readonly tone?: ChartTone | undefined;
15
+ /** The room between the members and the outline, in pixels. Defaults to 10. */
16
+ readonly padding?: number | undefined;
17
+ /** False fades the outline out and takes it out of the keyboard order. */
18
+ readonly isShown?: boolean | undefined;
19
+ /** True keeps the outline and its members at full strength while the rest recede. */
20
+ readonly isActive?: boolean | undefined;
21
+ /** `context` draws the outline gray; the others yield to inspection. */
22
+ readonly emphasis?: MarkEmphasis | undefined;
23
+ };
24
+ /**
25
+ * A labelled outline around a set of scene objects, such as a layer of a network. It follows its members as they move
26
+ * and resize. Give it a label to make it an item; focusing the camera on its id frames its members.
27
+ */
28
+ export declare function SceneGroup({ id, label, text, around, tone, padding, isShown, isActive, emphasis, }: SceneGroupProps): ReactNode;
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../charts/src/index.ts';
3
+ export type SceneHighlightProps = {
4
+ /** The id or ids to draw attention to. The objects themselves are not changed. */
5
+ readonly of: string | ReadonlyArray<string>;
6
+ /** Defaults to `highlight:` and the ids. */
7
+ readonly id?: string | undefined;
8
+ /** A hue for the halo, when it should match a thing the prose names. Left out, the halo is drawn in ink. */
9
+ readonly tone?: ChartTone | undefined;
10
+ /** The halo's reach beyond each object, in pixels. Defaults to 6. */
11
+ readonly padding?: number | undefined;
12
+ /** False fades the halo out. Toggle it to point at the objects the prose names. */
13
+ readonly isShown?: boolean | undefined;
14
+ };
15
+ /**
16
+ * A halo behind scene objects that draws the reader's eye without changing them: the node a sentence is about, or the
17
+ * path a value takes. It follows its objects and fades in and out with `isShown`.
18
+ */
19
+ export declare function SceneHighlight({ of, id, tone, padding, isShown }: SceneHighlightProps): ReactNode;
@@ -0,0 +1,16 @@
1
+ import type { ReactNode } from 'react';
2
+ /** SVG layers under the nodes, back to front: outlines and halos, wires, then brackets, leaders and custom marks. */
3
+ export type SceneLayerName = 'back' | 'wires' | 'front';
4
+ /**
5
+ * Draws SVG for the parts that draw lines and outlines into one of the scene's layers, under the HTML nodes, in plot
6
+ * pixels. Before the scene mounts, as on the server, it draws in its own SVG element, so the first markup holds every
7
+ * wire and curve. It draws nothing outside a scene.
8
+ */
9
+ export declare function SceneLayer({ layer, children, }: {
10
+ readonly layer?: SceneLayerName | undefined;
11
+ readonly children: ReactNode;
12
+ }): ReactNode;
13
+ /** The inline error a scene part shows when it is rendered outside any `Scene`. */
14
+ export declare function SceneOutside({ part }: {
15
+ readonly part: string;
16
+ }): ReactNode;
@@ -0,0 +1,67 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../charts/src/index.ts';
3
+ import type { MarkEmphasis } from '../../../charts/src/plot/index.ts';
4
+ import type { Pace } from '../time/tween.ts';
5
+ import type { SceneOffset, ScenePosition, SceneShape, SceneSize } from './scene-geometry.ts';
6
+ import type { SceneDelay, SceneStaggerPlace } from './scene-stagger.ts';
7
+ export type SceneNodeProps = {
8
+ /** Stable across states: the node with this id eases to its new props. */
9
+ readonly id: string;
10
+ /** The node's center, in the scene's data units. */
11
+ readonly at: ScenePosition;
12
+ /** A shift from `at` in pixels, across then down, for a node placed beside another rather than in data units. */
13
+ readonly offset?: SceneOffset | undefined;
14
+ /** The full sentence for the readout and assistive technology. With one, the arrow keys reach the node. */
15
+ readonly label?: string | undefined;
16
+ /** What the node shows. Cut with an ellipsis when it does not fit; the label keeps the full text. */
17
+ readonly text?: string | undefined;
18
+ /** True for token text, code or an id: drawn in monospace. Names use the body face. */
19
+ readonly isCode?: boolean | undefined;
20
+ /** A named size or a pixel box. Defaults to `medium`. */
21
+ readonly size?: SceneSize | undefined;
22
+ /** The outline: `box`, `pill`, `circle` or `plain` text. Defaults to `box`; wires meet it at its edge. */
23
+ readonly shape?: SceneShape | undefined;
24
+ /** The hue that names the thing. Left out, the tone scope's tone for the id, or neutral. */
25
+ readonly tone?: ChartTone | undefined;
26
+ /** `context` draws the node gray; the others yield to inspection. */
27
+ readonly emphasis?: MarkEmphasis | undefined;
28
+ /** False fades the node out and takes it out of the keyboard order. Its content keeps its state. */
29
+ readonly isShown?: boolean | undefined;
30
+ /** True keeps the node at full strength while the parts it is not connected to recede. */
31
+ readonly isActive?: boolean | undefined;
32
+ /** 0 shows the front, 1 the back; values between are mid-flip. */
33
+ readonly turn?: number | undefined;
34
+ /** 0 rests on the page, 1 is raised toward the reader: larger, with a deeper shadow. */
35
+ readonly lift?: number | undefined;
36
+ /** Degrees of tilt around the horizontal axis; positive leans the top away. */
37
+ readonly tilt?: number | undefined;
38
+ /** Degrees of turn in the page around the node's center; positive turns clockwise, as one card of a fan. */
39
+ readonly rotate?: number | undefined;
40
+ /** The stacking order: higher draws above. A lifted node draws above every resting one. Defaults to 0. */
41
+ readonly order?: number | undefined;
42
+ /** How long every change waits before the node moves. Defaults to 0. */
43
+ readonly delay?: SceneDelay | undefined;
44
+ /**
45
+ * The node's place in a stagger group. Nodes of one group that change in the same update start one step apart in
46
+ * `index` order, and a node that changes alone starts at once.
47
+ */
48
+ readonly stagger?: SceneStaggerPlace | undefined;
49
+ /** Overrides the scene's pace for this node. */
50
+ readonly pace?: Pace | undefined;
51
+ /**
52
+ * True draws the node without making room for it: the scene's margins and derived minimum width leave it out. Use it
53
+ * for a node another part makes room for, as a stack does for its cards.
54
+ */
55
+ readonly isFloating?: boolean | undefined;
56
+ /** The other face, shown as the node turns. */
57
+ readonly back?: ReactNode;
58
+ /** The hue of the back face. Left out, the node's own; a playing card passes neutral so its back hides the suit. */
59
+ readonly backTone?: ChartTone | undefined;
60
+ /** Rich content under the text, such as a compact chart. It keeps its state while the node moves or resizes. */
61
+ readonly children?: ReactNode;
62
+ };
63
+ /**
64
+ * A labelled box, pill or circle at a position in the scene, with optional rich content and a back face. Change its
65
+ * props and it eases there: it moves, resizes, turns, lifts, tilts and rotates. Wires attach to its edge.
66
+ */
67
+ export declare function SceneNode({ id, at, offset, label, text, isCode, size, shape, tone, emphasis, isShown, isActive, turn, lift, tilt, rotate, order, delay, stagger, pace, isFloating, back, backTone, children, }: SceneNodeProps): ReactNode;
@@ -0,0 +1,27 @@
1
+ import type { LabelObstacle, LabelSpot } from '../../../charts/src/plot/index.ts';
2
+ import type { SceneDataPoint, ScenePixel, SceneRect } from './scene-geometry.ts';
3
+ /** Tells the scene's labels where this line runs, so none sits on it. Call it from a part that draws a line or dot. */
4
+ export declare function useObstacle({ id, line }: {
5
+ readonly id: string;
6
+ readonly line: ReadonlyArray<SceneDataPoint>;
7
+ }): void;
8
+ /**
9
+ * The lines other parts registered, in plot pixels as the camera shows them now, leaving out those of `owner`. A part's
10
+ * text and a callout keep clear of them.
11
+ */
12
+ export declare function useObstacleLines(owner: string | undefined): ReadonlyArray<ReadonlyArray<ScenePixel>>;
13
+ /** The boxes of the text placed before this claim, which it keeps clear of. A claim's place is its first render. */
14
+ export declare function useTakenBoxes(id: string): ReadonlyArray<SceneRect>;
15
+ /** Claims `box` for this text, so the labels and callouts placed after it keep clear of it. Null claims nothing. */
16
+ export declare function useClaimedBox(id: string, box: SceneRect | null): void;
17
+ /** Where a part's text goes, and the claim that keeps later labels off it. */
18
+ export declare function usePlacedLabel({ id, owner, spots, lines, }: {
19
+ /** Names this label among all the scene's labels. */
20
+ readonly id: string;
21
+ /** The id of the part the text belongs to. Its own registered lines are not avoided. */
22
+ readonly owner: string;
23
+ /** Where the text may go, in order of preference. */
24
+ readonly spots: ReadonlyArray<LabelSpot>;
25
+ /** Extra lines to keep clear of, in plot pixels. */
26
+ readonly lines: ReadonlyArray<ReadonlyArray<LabelObstacle>>;
27
+ }): LabelSpot | undefined;
@@ -0,0 +1,79 @@
1
+ import type { SceneFrame, SceneMargins, SceneShape } from './scene-geometry.ts';
2
+ /**
3
+ * The eased numbers every scene object has: its center in data units, its pixel shift from there (`dx` across, `dy`
4
+ * down), its pixel size, and how visible it is.
5
+ */
6
+ export type SceneFrameKey = 'x' | 'y' | 'dx' | 'dy' | 'width' | 'height' | 'opacity';
7
+ /** One object's geometry as it is on screen in this frame. */
8
+ export type SceneFrameValues = Readonly<Record<SceneFrameKey, number>>;
9
+ /** Read access to one object's animated geometry, for the parts that follow it, such as wires and groups. */
10
+ export type SceneTrack = {
11
+ /** The geometry on screen now. The same object is returned until a frame changes it. */
12
+ readonly get: () => SceneFrameValues;
13
+ readonly subscribe: (listener: () => void) => () => void;
14
+ };
15
+ /** What the scene knows about one registered object. It changes when the object's props do, never per frame. */
16
+ export type SceneMember = {
17
+ readonly id: string;
18
+ /** The part that registered it, such as `node` or `wire`. Later parts add their own kinds. */
19
+ readonly kind: string;
20
+ /** The readout sentence. An object with a label is an item the reader steps through with the arrow keys. */
21
+ readonly label: string | undefined;
22
+ readonly shape: SceneShape;
23
+ /** The target frame, or undefined for an object placed by others, such as a wire between two nodes. */
24
+ readonly frame: SceneFrame | undefined;
25
+ /** True when the frame only draws: the scene's margins and derived minimum width leave it out. */
26
+ readonly isFloating: boolean;
27
+ /** The room the object needs outside the data box, such as an axis's tick labels. */
28
+ readonly margins: SceneMargins | undefined;
29
+ /** The stacking order: higher draws above, and comes later among the keyboard items that share one place. */
30
+ readonly order: number;
31
+ /** The ids this object attaches to: a wire's ends, a group's members, a callout's target. Each must exist. */
32
+ readonly attaches: ReadonlyArray<string>;
33
+ /** The pixels an object that joins two others keeps between them, such as a wire's room for its text. */
34
+ readonly room: number | undefined;
35
+ /** What the object draws around the objects it attaches to, such as a group's outline and name. */
36
+ readonly surround: SceneMargins | undefined;
37
+ readonly isShown: boolean;
38
+ readonly isActive: boolean;
39
+ /** Why the object's own input cannot be drawn, in a sentence naming it. The scene shows it as invalid. */
40
+ readonly problem: string | undefined;
41
+ readonly track: SceneTrack;
42
+ };
43
+ /** Every registered object in registration order, and the ids that more than one object claimed. */
44
+ export type SceneMembers = {
45
+ readonly list: ReadonlyArray<SceneMember>;
46
+ readonly duplicates: ReadonlyArray<string>;
47
+ };
48
+ /**
49
+ * The shared record of a scene's objects. Parts register through `useSceneObject`; a part that follows others, such as
50
+ * a wire, looks them up with `member` and subscribes to their `track`.
51
+ */
52
+ export type SceneRegistry = {
53
+ readonly members: () => SceneMembers;
54
+ /** Hears every change to the membership: an object added, removed, or given new props. */
55
+ readonly subscribe: (listener: () => void) => () => void;
56
+ readonly member: (id: string) => SceneMember | undefined;
57
+ /** Adds or updates `member` for `owner`. A second owner of the same id is recorded as a duplicate. */
58
+ readonly upsert: (owner: object, member: SceneMember) => void;
59
+ readonly remove: (owner: object, id: string) => void;
60
+ /** Whether the scene has painted once. Objects registered later fade in. */
61
+ readonly isPainted: () => boolean;
62
+ readonly markPainted: () => void;
63
+ /**
64
+ * Records an object during the scene's first render, before any is registered, so `member` finds it for the parts
65
+ * rendered after it. That is how the server draws wires and groups at their target geometry.
66
+ */
67
+ readonly draft: (member: SceneMember) => void;
68
+ /** Whether the scene is still in its first render, so `member` answers from the drafts. */
69
+ readonly isDrafting: () => boolean;
70
+ /** Forgets the drafts once the scene has mounted and its objects are registered. */
71
+ readonly endDrafts: () => void;
72
+ };
73
+ /** Makes an empty registry. `Scene` makes one for itself; a part outside any scene gets a detached one. */
74
+ export declare function createSceneRegistry(): SceneRegistry;
75
+ /**
76
+ * Makes a store that each scene keeps for one kind of part, such as the stacks cards read their places from. The
77
+ * returned function gives a scene's store, made on first use and kept while the scene's registry lives.
78
+ */
79
+ export declare function sceneStore<Store extends object>(create: () => Store): (registry: SceneRegistry) => Store;
@@ -0,0 +1,43 @@
1
+ /** The steps of a stagger by name, in milliseconds. */
2
+ export declare const sceneStaggers: {
3
+ readonly short: 60;
4
+ readonly regular: 120;
5
+ readonly long: 240;
6
+ };
7
+ /** A named stagger step. */
8
+ export type SceneStagger = keyof typeof sceneStaggers;
9
+ /**
10
+ * How long a change waits on the shared clock before the object starts to move: milliseconds, or a place in a stagger,
11
+ * where `{ index: 2, step: 'regular' }` waits two regular steps. Reduced motion and the `instant` pace never wait.
12
+ */
13
+ export type SceneDelay = number | {
14
+ readonly index: number;
15
+ readonly step?: SceneStagger | undefined;
16
+ };
17
+ /**
18
+ * An object's place in a stagger group. When several members of one group change in the same update, they start one
19
+ * step apart in `index` order; a member that changes alone starts at once.
20
+ */
21
+ export type SceneStaggerPlace = {
22
+ /** Names the group. A stack's cards use the stack's id. */
23
+ readonly group: string;
24
+ /** The place in the group's order: lower starts first. */
25
+ readonly index: number;
26
+ /** The wait between two members that start one after another. Defaults to `regular`. */
27
+ readonly step?: SceneStagger | undefined;
28
+ };
29
+ /** The milliseconds a delay waits. */
30
+ export declare function delayOf(delay: SceneDelay): number;
31
+ type Entry = {
32
+ readonly place: SceneStaggerPlace;
33
+ /** Starts the member's move after `wait` milliseconds of stagger. */
34
+ readonly begin: (wait: number) => void;
35
+ };
36
+ /** The members of each group that changed in the update being committed, started together once it is committed. */
37
+ type Staggers = {
38
+ /** Adds a changed member to this update's batch of its group. Returns the function that takes it out again. */
39
+ readonly join: (entry: Entry) => () => void;
40
+ };
41
+ /** The stagger batches of a scene. Every member's layout effect in one commit runs before the batch starts. */
42
+ export declare const staggersOf: (registry: import("./scene-registry.ts").SceneRegistry) => Staggers;
43
+ export {};
@@ -0,0 +1,14 @@
1
+ import * as stylex from '@stylexjs/stylex';
2
+ /** The gray of an object drawn as context, which stays visible on a dark surface. */
3
+ export declare const sceneContextColor: string;
4
+ /** Which of the scene's inspection marks an object shows now. */
5
+ export type SceneOutlineState = {
6
+ readonly isInspected: boolean;
7
+ readonly isSelected: boolean;
8
+ readonly isCursor: boolean;
9
+ };
10
+ /**
11
+ * The outlines an object drawn in HTML shows for inspection: thin while inspected, thick while selected, and a dashed
12
+ * ring while the keyboard cursor rests on it. Every HTML part draws them alike, so a card reads like a node.
13
+ */
14
+ export declare function sceneOutlines({ isInspected, isSelected, isCursor, }: SceneOutlineState): ReadonlyArray<stylex.StyleXStyles | false>;
@@ -0,0 +1,65 @@
1
+ import type { NumericDomain } from '../../../charts/src/index.ts';
2
+ import type { SceneMembers } from './scene-registry.ts';
3
+ /** The words a scene shows that are not the author's content. Placeholders in braces are filled in. */
4
+ export type SceneLabels = {
5
+ /** What the arrow keys step through, for the plot's accessible name. */
6
+ readonly objects: string;
7
+ /** The header of the exact-value table. */
8
+ readonly objectColumn: string;
9
+ readonly missingLocale: string;
10
+ readonly invalidBox: string;
11
+ readonly invalidAspect: string;
12
+ /** `{limit}` is the most objects a scene draws. */
13
+ readonly tooMany: string;
14
+ /** `{id}` is the shared id. */
15
+ readonly duplicateId: string;
16
+ /** `{kind}` and `{id}` name the object, `{target}` the id it names. */
17
+ readonly unknownId: string;
18
+ /** `{kind}` and `{id}` name the object. */
19
+ readonly outsideBox: string;
20
+ /** `{id}` is the id the focus names. */
21
+ readonly unknownFocus: string;
22
+ /** `{id}` names the wire, `{weight}` its weight and `{limit}` the scene's `weightMax`. */
23
+ readonly weightOutside: string;
24
+ /** `{part}` names a part rendered outside any scene. */
25
+ readonly outside: string;
26
+ };
27
+ /** The plain English defaults of `SceneLabels`. */
28
+ export declare const sceneLabels: {
29
+ readonly objects: 'diagram parts';
30
+ readonly objectColumn: 'Part';
31
+ readonly missingLocale: 'This scene needs a locale. Pass `locale`, or place it inside a Lesson.';
32
+ readonly invalidBox: 'The scene box needs two finite, increasing values on each axis.';
33
+ readonly invalidAspect: 'The scene aspect must be a positive, finite ratio of width to height.';
34
+ readonly tooMany: 'This scene draws at most {limit} objects. Show fewer, or group them.';
35
+ readonly duplicateId: 'Two scene objects share the id "{id}". Give each its own id.';
36
+ readonly unknownId: 'The {kind} "{id}" attaches to "{target}", which no object in this scene has.';
37
+ readonly outsideBox: 'The {kind} "{id}" sits outside the scene box.';
38
+ readonly unknownFocus: 'The focus names "{id}", which no object in this scene has.';
39
+ readonly weightOutside: 'The wire "{id}" has weight {weight}, outside the scene\'s weight limit of plus or minus {limit}.';
40
+ readonly outside: '{part} must be inside a Scene.';
41
+ };
42
+ /** The most objects one scene draws. Larger input shows an error; the author groups or splits the diagram. */
43
+ export declare const sceneLimits: {
44
+ readonly objects: 1200;
45
+ };
46
+ /** A label with its `{name}` placeholders filled in. */
47
+ export declare function fillLabel(template: string, values: Readonly<Record<string, string>>): string;
48
+ type Box = {
49
+ readonly x: NumericDomain;
50
+ readonly y: NumericDomain;
51
+ };
52
+ /** Why the scene's own props cannot be drawn, or undefined when they can. */
53
+ export declare function sceneBoxError({ box, aspect, labels, }: {
54
+ readonly box: Box;
55
+ readonly aspect: number | undefined;
56
+ readonly labels: SceneLabels;
57
+ }): string | undefined;
58
+ /** The first problem among the registered objects, as a sentence naming the object, or undefined. */
59
+ export declare function membersError({ members, focus, box, labels, }: {
60
+ readonly members: SceneMembers;
61
+ readonly focus: ReadonlyArray<string>;
62
+ readonly box: Box;
63
+ readonly labels: SceneLabels;
64
+ }): string | undefined;
65
+ export {};
@@ -0,0 +1,45 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../charts/src/index.ts';
3
+ import type { MarkEmphasis } from '../../../charts/src/plot/index.ts';
4
+ /** How a wire runs: straight between edges, or a curve or elbow leaving the sides that face each other. */
5
+ export type SceneWireShape = 'straight' | 'curve' | 'elbow';
6
+ /**
7
+ * The side of the wire its text sits on. `auto` puts it above a wire that runs across and right of one that runs up or
8
+ * down. A side along the wire, such as `left` of a level wire, falls back to `auto`.
9
+ */
10
+ export type SceneWireTextSide = 'auto' | 'top' | 'right' | 'bottom' | 'left';
11
+ export type SceneWireProps = {
12
+ /** The id of the object the wire leaves. */
13
+ readonly from: string;
14
+ /** The id of the object the wire reaches. */
15
+ readonly to: string;
16
+ /** Defaults to `from>to`. */
17
+ readonly id?: string | undefined;
18
+ /** The readout sentence. With one, the arrow keys reach the wire. */
19
+ readonly label?: string | undefined;
20
+ /** Short text drawn beside the wire's middle, never on its stroke, such as its weight. */
21
+ readonly text?: string | undefined;
22
+ /** The side of the wire the text sits on. Defaults to `auto`. */
23
+ readonly textSide?: SceneWireTextSide | undefined;
24
+ /** A signed weight: thickness shows its size and, without a tone, hue its sign. */
25
+ readonly weight?: number | undefined;
26
+ /** The hue that names the connection. Left out, the weight's sign or neutral ink. */
27
+ readonly tone?: ChartTone | undefined;
28
+ /** How the wire runs between its ends. Defaults to `straight`. */
29
+ readonly shape?: SceneWireShape | undefined;
30
+ /** Dashed for a modelled or proposed connection. */
31
+ readonly isDashed?: boolean | undefined;
32
+ /** Draws an arrowhead at the `to` end. Defaults to true. */
33
+ readonly hasArrow?: boolean | undefined;
34
+ /** False fades the wire out and takes it out of the keyboard order. */
35
+ readonly isShown?: boolean | undefined;
36
+ /** True keeps the wire and its ends at full strength while the rest recede. */
37
+ readonly isActive?: boolean | undefined;
38
+ /** `context` draws the wire gray; the others yield to inspection. */
39
+ readonly emphasis?: MarkEmphasis | undefined;
40
+ };
41
+ /**
42
+ * A connection between two scene objects that stays attached to their edges while they move. Its thickness can carry a
43
+ * signed weight, eased when the weight changes. Give it a label to make it an item the reader can inspect.
44
+ */
45
+ export declare function SceneWire({ from, to, id, label, text, textSide, weight, tone, shape, isDashed, hasArrow, isShown, isActive, emphasis, }: SceneWireProps): ReactNode;
@@ -0,0 +1,36 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FigureProps, FigureSelectionProps, NumericDomain, PlotHeight } from '../../../charts/src/index.ts';
3
+ import type { Pace } from '../time/tween.ts';
4
+ import type { SceneLabels } from './scene-validate.ts';
5
+ export type SceneProps = Omit<FigureProps, 'locale'> & FigureSelectionProps & {
6
+ /** The locale of every number in the figure. Left out, the nearest `Lesson`'s locale is used. */
7
+ readonly locale?: string | undefined;
8
+ /** The data box's horizontal extent. Object positions are in these units. */
9
+ readonly x: NumericDomain;
10
+ /** The data box's vertical extent. y grows upward, as on a chart. */
11
+ readonly y: NumericDomain;
12
+ /** The plot height by name. Ignored when `aspect` is set. */
13
+ readonly height?: PlotHeight | undefined;
14
+ /** The plot's width divided by its height, for a scene that keeps its proportions as it narrows. */
15
+ readonly aspect?: number | undefined;
16
+ /** The camera: the ids to zoom to, with room around them. Null or absent shows the whole box. */
17
+ readonly focus?: string | ReadonlyArray<string> | null | undefined;
18
+ /** How fast changes ease. Reduced motion always jumps. */
19
+ readonly pace?: Pace | undefined;
20
+ /**
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.
23
+ */
24
+ readonly minWidth?: number | undefined;
25
+ /** The wire weight magnitude drawn thickest. Weights must lie within plus or minus this. Defaults to 1. */
26
+ readonly weightMax?: number | undefined;
27
+ readonly labels?: Partial<SceneLabels> | undefined;
28
+ /** The scene parts: `SceneNode`, `SceneWire`, `SceneGroup` and the rest, or components that render them. */
29
+ readonly children?: ReactNode;
30
+ };
31
+ /**
32
+ * A diagram with identity: nodes, wires, groups and notes placed in a data box, which move by themselves when their
33
+ * props change. Authors describe each state; the scene eases between them, and a reader steps through labelled parts
34
+ * with the arrow keys as in any chart. Use it for computation graphs, networks and other explanatory diagrams.
35
+ */
36
+ export declare function Scene(props: SceneProps): ReactNode;
@@ -0,0 +1,11 @@
1
+ import type { NumericDomain } from '../../../../charts/src/index.ts';
2
+ import type { HeatmapPalette } from '../../../../charts/src/matrix/index.ts';
3
+ /**
4
+ * The fill of a cell, from the heatmap charts' own scale: lightness of one hue for a magnitude, or two hues around zero
5
+ * for a signed value. A grid with no palette, a value outside the domain, or a cell with no value gets no fill.
6
+ */
7
+ export declare function cellFill({ value, palette, domain, }: {
8
+ readonly value: number | undefined;
9
+ readonly palette: HeatmapPalette | undefined;
10
+ readonly domain: NumericDomain;
11
+ }): string | undefined;