@mechane-ai/elements 0.46.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 (419) hide show
  1. package/README.md +590 -34
  2. package/bin/mechane-elements-catalog.mjs +104 -12
  3. package/dist/ai.js +4 -4
  4. package/dist/article-BXZr10QQ.js +1904 -0
  5. package/dist/article.js +1 -0
  6. package/dist/catalog.json +3696 -33
  7. package/dist/categorical-values-BpVq8cFj.js +107 -0
  8. package/dist/cells-xVmnQ9oQ.js +384 -0
  9. package/dist/chart-link-AE_xuxiP.js +35 -0
  10. package/dist/chart-tones-ei3BC2AL.js +27 -0
  11. package/dist/charts/cartesian.js +1 -2958
  12. package/dist/charts/cells.js +1 -0
  13. package/dist/charts/comparison.js +1 -0
  14. package/dist/charts/distribution.js +1 -781
  15. package/dist/charts/figure.js +3404 -0
  16. package/dist/charts/graph.js +1 -655
  17. package/dist/charts/hierarchy.js +1 -121
  18. package/dist/charts/image.js +1 -0
  19. package/dist/charts/matrix.js +4 -644
  20. package/dist/charts/plot.js +15 -0
  21. package/dist/charts/relationship.js +1 -0
  22. package/dist/charts/text.js +1 -0
  23. package/dist/charts/timeline.js +1 -266
  24. package/dist/charts/transforms.js +677 -0
  25. package/dist/charts/trend.js +1 -0
  26. package/dist/charts.js +8 -3
  27. package/dist/clock-DSm5lkNE.js +16 -0
  28. package/dist/collections.js +1 -2195
  29. package/dist/color-legend-CIo7DhXB.js +62 -0
  30. package/dist/dates-Cww8UR_n.js +810 -0
  31. package/dist/describe-lesson-BmREzDpt.js +175 -0
  32. package/dist/dumbbell-plot-DQdTxDeO.js +509 -0
  33. package/dist/embedding-map-CF-J-8JW.js +1929 -0
  34. package/dist/feedback.js +1 -1
  35. package/dist/figure-format-B8kRZMlo.js +36 -0
  36. package/dist/figure-frame-BJ3REgTA.js +270 -0
  37. package/dist/forms/dates.js +1 -810
  38. package/dist/forms.js +1 -1
  39. package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
  40. package/dist/image-grid-Dl2sjIMB.js +598 -0
  41. package/dist/kits/evaluation.js +431 -0
  42. package/dist/kits/interpretability.js +1033 -0
  43. package/dist/kits/operations.js +239 -0
  44. package/dist/kits/training.js +335 -0
  45. package/dist/label-place-Z0fryBZb.js +42 -0
  46. package/dist/lesson/agent.js +811 -0
  47. package/dist/lesson/spec.js +661 -0
  48. package/dist/lesson.js +5 -0
  49. package/dist/locate-Bcg3QcP4.js +11 -0
  50. package/dist/mdx.js +227 -0
  51. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
  52. package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
  53. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
  54. package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
  55. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
  56. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
  57. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
  58. package/dist/packages/charts/src/cartesian/index.d.ts +5 -5
  59. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
  60. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
  61. package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
  62. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
  63. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
  64. package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
  65. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
  66. package/dist/packages/charts/src/cartesian/time-series.d.ts +60 -36
  67. package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
  68. package/dist/packages/charts/src/categorical-values.d.ts +1 -1
  69. package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
  70. package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
  71. package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
  72. package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
  73. package/dist/packages/charts/src/cells/index.d.ts +11 -0
  74. package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
  75. package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
  76. package/dist/packages/charts/src/chart-frame.d.ts +14 -7
  77. package/dist/packages/charts/src/chart-grid.d.ts +19 -0
  78. package/dist/packages/charts/src/chart-input.d.ts +1 -9
  79. package/dist/packages/charts/src/chart-link.d.ts +56 -0
  80. package/dist/packages/charts/src/chart.d.ts +0 -8
  81. package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
  82. package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
  83. package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
  84. package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
  85. package/dist/packages/charts/src/comparison/index.d.ts +6 -0
  86. package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
  87. package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
  88. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
  89. package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
  90. package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
  91. package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
  92. package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
  93. package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
  94. package/dist/packages/charts/src/distribution/index.d.ts +11 -0
  95. package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
  96. package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
  97. package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
  98. package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
  99. package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
  100. package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
  101. package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
  102. package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
  103. package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
  104. package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
  105. package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
  106. package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
  107. package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
  108. package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
  109. package/dist/packages/charts/src/graph/index.d.ts +6 -2
  110. package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
  111. package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
  112. package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
  113. package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
  114. package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
  115. package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
  116. package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
  117. package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
  118. package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
  119. package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
  120. package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
  121. package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
  122. package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
  123. package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
  124. package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
  125. package/dist/packages/charts/src/image/image-input.d.ts +27 -0
  126. package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
  127. package/dist/packages/charts/src/image/index.d.ts +7 -0
  128. package/dist/packages/charts/src/index.d.ts +15 -1
  129. package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
  130. package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
  131. package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
  132. package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
  133. package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
  134. package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
  135. package/dist/packages/charts/src/matrix/index.d.ts +15 -3
  136. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
  137. package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
  138. package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
  139. package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
  140. package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
  141. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
  142. package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
  143. package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
  144. package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
  145. package/dist/packages/charts/src/plot/contours.d.ts +45 -0
  146. package/dist/packages/charts/src/plot/index.d.ts +49 -0
  147. package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
  148. package/dist/packages/charts/src/plot/locate.d.ts +18 -0
  149. package/dist/packages/charts/src/plot/path.d.ts +39 -0
  150. package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
  151. package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
  152. package/dist/packages/charts/src/plot/plot-marks.d.ts +128 -0
  153. package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
  154. package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
  155. package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
  156. package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
  157. package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
  158. package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
  159. package/dist/packages/charts/src/plot/scale.d.ts +48 -0
  160. package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
  161. package/dist/packages/charts/src/plot-width.d.ts +3 -2
  162. package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
  163. package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
  164. package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
  165. package/dist/packages/charts/src/relationship/index.d.ts +11 -0
  166. package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
  167. package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
  168. package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
  169. package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
  170. package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
  171. package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
  172. package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
  173. package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
  174. package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
  175. package/dist/packages/charts/src/spec/figure.d.ts +12 -0
  176. package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
  177. package/dist/packages/charts/src/spec/index.d.ts +10 -0
  178. package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
  179. package/dist/packages/charts/src/text/index.d.ts +11 -0
  180. package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
  181. package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
  182. package/dist/packages/charts/src/text/token-links.d.ts +49 -0
  183. package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
  184. package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
  185. package/dist/packages/charts/src/text/token-text.d.ts +39 -0
  186. package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
  187. package/dist/packages/charts/src/timeline/index.d.ts +3 -1
  188. package/dist/packages/charts/src/timeline/waterfall.d.ts +24 -13
  189. package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
  190. package/dist/packages/charts/src/transforms/density.d.ts +53 -0
  191. package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
  192. package/dist/packages/charts/src/transforms/index.d.ts +19 -0
  193. package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
  194. package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
  195. package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
  196. package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
  197. package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
  198. package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
  199. package/dist/packages/charts/src/transforms/values.d.ts +70 -0
  200. package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
  201. package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
  202. package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
  203. package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
  204. package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
  205. package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
  206. package/dist/packages/charts/src/trend/index.d.ts +10 -0
  207. package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
  208. package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
  209. package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
  210. package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
  211. package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
  212. package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
  213. package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
  214. package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
  215. package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
  216. package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
  217. package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
  218. package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
  219. package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
  220. package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
  221. package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
  222. package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
  223. package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
  224. package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
  225. package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
  226. package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
  227. package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
  228. package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
  229. package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
  230. package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
  231. package/dist/packages/kits/src/operations/index.d.ts +6 -0
  232. package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
  233. package/dist/packages/kits/src/training/index.d.ts +8 -0
  234. package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
  235. package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
  236. package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
  237. package/dist/packages/kits/src/training/run-state.d.ts +7 -0
  238. package/dist/packages/kits/src/training/run-table.d.ts +63 -0
  239. package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
  240. package/dist/packages/kits/src/training/runs.d.ts +34 -0
  241. package/dist/packages/teaching/src/agent/index.d.ts +11 -0
  242. package/dist/packages/teaching/src/agent/learner-trace.d.ts +84 -0
  243. package/dist/packages/teaching/src/agent/lesson-bridge.d.ts +59 -0
  244. package/dist/packages/teaching/src/agent/lesson-tour.d.ts +63 -0
  245. package/dist/packages/teaching/src/agent/tutor-tools.d.ts +86 -0
  246. package/dist/packages/teaching/src/article/article-checks.d.ts +9 -0
  247. package/dist/packages/teaching/src/article/article-context.d.ts +49 -0
  248. package/dist/packages/teaching/src/article/article-error.d.ts +12 -0
  249. package/dist/packages/teaching/src/article/article-labels.d.ts +54 -0
  250. package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +14 -0
  251. package/dist/packages/teaching/src/article/article-outline.d.ts +9 -0
  252. package/dist/packages/teaching/src/article/article.d.ts +42 -0
  253. package/dist/packages/teaching/src/article/beat-steps.d.ts +18 -0
  254. package/dist/packages/teaching/src/article/beat.d.ts +16 -0
  255. package/dist/packages/teaching/src/article/challenge.d.ts +29 -0
  256. package/dist/packages/teaching/src/article/exercise-styles.d.ts +76 -0
  257. package/dist/packages/teaching/src/article/figure.d.ts +51 -0
  258. package/dist/packages/teaching/src/article/index.d.ts +31 -0
  259. package/dist/packages/teaching/src/article/lesson-values.d.ts +5 -0
  260. package/dist/packages/teaching/src/article/linked-target.d.ts +22 -0
  261. package/dist/packages/teaching/src/article/notes.d.ts +36 -0
  262. package/dist/packages/teaching/src/article/outline-types.d.ts +73 -0
  263. package/dist/packages/teaching/src/article/predict.d.ts +58 -0
  264. package/dist/packages/teaching/src/article/progress-store.d.ts +64 -0
  265. package/dist/packages/teaching/src/article/scrolly.d.ts +26 -0
  266. package/dist/packages/teaching/src/article/term.d.ts +35 -0
  267. package/dist/packages/teaching/src/article/tex.d.ts +12 -0
  268. package/dist/packages/teaching/src/article/view-essay.d.ts +13 -0
  269. package/dist/packages/teaching/src/article/view-present.d.ts +8 -0
  270. package/dist/packages/teaching/src/article/view-sheet.d.ts +7 -0
  271. package/dist/packages/teaching/src/article/view-static.d.ts +7 -0
  272. package/dist/packages/teaching/src/article/walk.d.ts +34 -0
  273. package/dist/packages/teaching/src/lesson/bound-value.d.ts +29 -0
  274. package/dist/packages/teaching/src/lesson/define-lesson.d.ts +136 -0
  275. package/dist/packages/teaching/src/lesson/index.d.ts +24 -0
  276. package/dist/packages/teaching/src/lesson/inline-choice.d.ts +12 -0
  277. package/dist/packages/teaching/src/lesson/lesson-context.d.ts +18 -0
  278. package/dist/packages/teaching/src/lesson/lesson-error.d.ts +12 -0
  279. package/dist/packages/teaching/src/lesson/lesson-locale.d.ts +4 -0
  280. package/dist/packages/teaching/src/lesson/lesson-persistence.d.ts +17 -0
  281. package/dist/packages/teaching/src/lesson/lesson-player.d.ts +51 -0
  282. package/dist/packages/teaching/src/lesson/lesson-store.d.ts +84 -0
  283. package/dist/packages/teaching/src/lesson/lesson.d.ts +39 -0
  284. package/dist/packages/teaching/src/lesson/param-controls.d.ts +14 -0
  285. package/dist/packages/teaching/src/lesson/param.d.ts +34 -0
  286. package/dist/packages/teaching/src/lesson/playback.d.ts +42 -0
  287. package/dist/packages/teaching/src/lesson/transport.d.ts +19 -0
  288. package/dist/packages/teaching/src/lesson/use-lesson.d.ts +36 -0
  289. package/dist/packages/teaching/src/mdx/essay-components.d.ts +79 -0
  290. package/dist/packages/teaching/src/mdx/essay-markdown.d.ts +41 -0
  291. package/dist/packages/teaching/src/mdx/essay.d.ts +32 -0
  292. package/dist/packages/teaching/src/mdx/index.d.ts +9 -0
  293. package/dist/packages/teaching/src/mdx/requested-view.d.ts +6 -0
  294. package/dist/packages/teaching/src/scene/flow/flow-layout.d.ts +38 -0
  295. package/dist/packages/teaching/src/scene/flow/flow-pulse.d.ts +16 -0
  296. package/dist/packages/teaching/src/scene/flow/scene-flow.d.ts +81 -0
  297. package/dist/packages/teaching/src/scene/index.d.ts +77 -0
  298. package/dist/packages/teaching/src/scene/morph/morph-scope.d.ts +28 -0
  299. package/dist/packages/teaching/src/scene/plane/plane-hit.d.ts +22 -0
  300. package/dist/packages/teaching/src/scene/plane/plane-label.d.ts +23 -0
  301. package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +42 -0
  302. package/dist/packages/teaching/src/scene/plane/plane-math.d.ts +45 -0
  303. package/dist/packages/teaching/src/scene/plane/scene-axes.d.ts +30 -0
  304. package/dist/packages/teaching/src/scene/plane/scene-curve.d.ts +42 -0
  305. package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +59 -0
  306. package/dist/packages/teaching/src/scene/plane/scene-projection.d.ts +27 -0
  307. package/dist/packages/teaching/src/scene/plane/scene-region.d.ts +38 -0
  308. package/dist/packages/teaching/src/scene/plane/scene-rule.d.ts +35 -0
  309. package/dist/packages/teaching/src/scene/plane/scene-vector.d.ts +39 -0
  310. package/dist/packages/teaching/src/scene/scene-bracket.d.ts +24 -0
  311. package/dist/packages/teaching/src/scene/scene-callout.d.ts +26 -0
  312. package/dist/packages/teaching/src/scene/scene-context.d.ts +179 -0
  313. package/dist/packages/teaching/src/scene/scene-custom.d.ts +31 -0
  314. package/dist/packages/teaching/src/scene/scene-geometry.d.ts +181 -0
  315. package/dist/packages/teaching/src/scene/scene-group.d.ts +28 -0
  316. package/dist/packages/teaching/src/scene/scene-highlight.d.ts +19 -0
  317. package/dist/packages/teaching/src/scene/scene-layer.d.ts +16 -0
  318. package/dist/packages/teaching/src/scene/scene-node.d.ts +67 -0
  319. package/dist/packages/teaching/src/scene/scene-obstacles.d.ts +27 -0
  320. package/dist/packages/teaching/src/scene/scene-registry.d.ts +79 -0
  321. package/dist/packages/teaching/src/scene/scene-stagger.d.ts +43 -0
  322. package/dist/packages/teaching/src/scene/scene-style.d.ts +14 -0
  323. package/dist/packages/teaching/src/scene/scene-validate.d.ts +65 -0
  324. package/dist/packages/teaching/src/scene/scene-wire.d.ts +45 -0
  325. package/dist/packages/teaching/src/scene/scene.d.ts +36 -0
  326. package/dist/packages/teaching/src/scene/shapes/cell-color.d.ts +11 -0
  327. package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +69 -0
  328. package/dist/packages/teaching/src/scene/shapes/scene-card.d.ts +114 -0
  329. package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +84 -0
  330. package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +37 -0
  331. package/dist/packages/teaching/src/scene/shapes/scene-stack.d.ts +46 -0
  332. package/dist/packages/teaching/src/scene/shapes/scene-token.d.ts +63 -0
  333. package/dist/packages/teaching/src/scene/shapes/scene-tokens.d.ts +40 -0
  334. package/dist/packages/teaching/src/scene/shapes/stack-book.d.ts +35 -0
  335. package/dist/packages/teaching/src/scene/shapes/stack-layout.d.ts +63 -0
  336. package/dist/packages/teaching/src/scene/shapes/token-layout.d.ts +39 -0
  337. package/dist/packages/teaching/src/spec/advice.d.ts +23 -0
  338. package/dist/packages/teaching/src/spec/chart-names.d.ts +2 -0
  339. package/dist/packages/teaching/src/spec/describe-lesson.d.ts +85 -0
  340. package/dist/packages/teaching/src/spec/explainer-guide.d.ts +21 -0
  341. package/dist/packages/teaching/src/spec/findings.d.ts +39 -0
  342. package/dist/packages/teaching/src/spec/index.d.ts +14 -0
  343. package/dist/packages/teaching/src/spec/lesson-plan.d.ts +43 -0
  344. package/dist/packages/teaching/src/spec/validate-plan.d.ts +11 -0
  345. package/dist/packages/teaching/src/time/clock.d.ts +7 -0
  346. package/dist/packages/teaching/src/time/tween.d.ts +19 -0
  347. package/dist/packages/teaching/src/time/use-tween.d.ts +6 -0
  348. package/dist/param-CqKUTHaO.js +450 -0
  349. package/dist/path-BglsXpnO.js +59 -0
  350. package/dist/plot-axes-DJkLW4wk.js +100 -0
  351. package/dist/plot-layout-CZVSJ-le.js +912 -0
  352. package/dist/plot-marks-uozcbOIX.js +229 -0
  353. package/dist/plot-surface-CbVBvgqZ.js +51 -0
  354. package/dist/plot-width-DcqtSgzb.js +124 -0
  355. package/dist/point-layer-C-EYETAt.js +655 -0
  356. package/dist/reference-lines-BDcttOp0.js +82 -0
  357. package/dist/scale-C2xgZyZN.js +63 -0
  358. package/dist/scene-0z2gbaDE.js +4938 -0
  359. package/dist/scene.js +1 -0
  360. package/dist/slope-chart-BKVEAVCs.js +1279 -0
  361. package/dist/{src-1EHkSFS-.js → src-BD6xlvDt.js} +2 -2
  362. package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
  363. package/dist/src-DIS0YOj0.js +44 -0
  364. package/dist/src-Dcfq8vE4.js +2195 -0
  365. package/dist/styles2.css +907 -59
  366. package/dist/time-series-BgzGNOk0.js +2670 -0
  367. package/dist/token-heatmap-BrW1OsKD.js +1354 -0
  368. package/dist/token-predictions-yerq_Oet.js +1093 -0
  369. package/dist/tone-scope-DKiSw-JR.js +32 -0
  370. package/dist/transport-BJweqDPj.js +715 -0
  371. package/dist/tree-diagram-D09BRqE-.js +1629 -0
  372. package/dist/treemap-CW4WsJNL.js +472 -0
  373. package/dist/use-tween-5HZ55_9d.js +72 -0
  374. package/dist/values-963L6n1m.js +65 -0
  375. package/dist/violin-plot-DrtPZ1-T.js +1292 -0
  376. package/dist/waterfall-DYLSnGjm.js +576 -0
  377. package/package.json +78 -4
  378. package/recipes/allocation-report.tsx +15 -7
  379. package/recipes/counting-cards.tsx +656 -0
  380. package/recipes/explorable-essay.tsx +172 -0
  381. package/skills/extend-elements/SKILL.md +81 -0
  382. package/skills/plan-lesson/SKILL.md +86 -0
  383. package/skills/plan-lesson/references/plan-format.md +114 -0
  384. package/skills/plan-lesson/references/worked-plan.md +171 -0
  385. package/skills/review-elements/SKILL.md +47 -3
  386. package/skills/review-explainer/SKILL.md +97 -0
  387. package/skills/upgrade-elements/SKILL.md +3 -1
  388. package/skills/upgrade-elements/references/releases.md +249 -0
  389. package/skills/use-elements/SKILL.md +22 -14
  390. package/skills/use-elements/references/charts.md +362 -41
  391. package/skills/use-elements/references/figures.md +173 -0
  392. package/skills/use-elements/references/kits.md +180 -0
  393. package/skills/use-elements/references/teaching.md +36 -0
  394. package/skills/write-explainer/SKILL.md +112 -0
  395. package/skills/write-explainer/references/article.md +164 -0
  396. package/skills/write-explainer/references/lesson.md +148 -0
  397. package/skills/write-explainer/references/mdx.md +78 -0
  398. package/skills/write-explainer/references/scene-parts.md +273 -0
  399. package/skills/write-explainer/references/scene.md +168 -0
  400. package/skills/write-explainer/references/tutor.md +104 -0
  401. package/skills/write-explainer/references/worked-essay.md +459 -0
  402. package/templates/essay/AGENTS.md +14 -0
  403. package/templates/essay/README.md +59 -0
  404. package/templates/essay/index.html +17 -0
  405. package/templates/essay/package.template.json +21 -0
  406. package/templates/essay/plan.json +96 -0
  407. package/templates/essay/src/essay.mdx +97 -0
  408. package/templates/essay/src/figures.tsx +92 -0
  409. package/templates/essay/src/lesson.ts +83 -0
  410. package/templates/essay/src/main.tsx +53 -0
  411. package/templates/essay/src/mdx.d.ts +7 -0
  412. package/templates/essay/tsconfig.template.json +15 -0
  413. package/templates/essay/vite.config.template.txt +8 -0
  414. package/dist/categorical-values-BXi-rJuv.js +0 -74
  415. package/dist/chart-data-CIJVWCYt.js +0 -21
  416. package/dist/chart-frame-BaxKn_MB.js +0 -236
  417. package/dist/chart-input-Bm82_9Rd.js +0 -22
  418. package/dist/chart-theme-4zprJ3rW.js +0 -404
  419. package/dist/plot-width-v2c_rA20.js +0 -63
@@ -0,0 +1,11 @@
1
+ import type { LessonFinding } from './findings.ts';
2
+ /** What checking a lesson plan found. The plan is valid when no finding is an error; advice never blocks it. */
3
+ export type LessonPlanResult = {
4
+ readonly isValid: boolean;
5
+ readonly findings: ReadonlyArray<LessonFinding>;
6
+ };
7
+ /**
8
+ * Checks a lesson plan an agent drafted, before any component is written. Errors are shapes and names `defineLesson`
9
+ * would refuse; advice is teaching practice. Every finding has a path and a sentence that says what to do.
10
+ */
11
+ export declare function validateLessonPlan(input: unknown): LessonPlanResult;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Calls `listener` once per animation frame while subscribed. One loop serves every subscriber, so everything that
3
+ * moves on a page moves in step.
4
+ */
5
+ export declare const onFrame: (listener: (now: number) => void) => () => void;
6
+ /** Whether the reader asked for reduced motion. False where there is no window. */
7
+ export declare function isMotionReduced(): boolean;
@@ -0,0 +1,19 @@
1
+ /** How long a move takes. `instant` jumps, and so does every pace when the reader asked for reduced motion. */
2
+ export type Pace = 'instant' | 'fast' | 'regular' | 'slow';
3
+ /** A set of named numbers that eases toward a target on the shared clock. */
4
+ export type Tween<Key extends string> = {
5
+ /** The values on screen now. The same object is returned until a frame changes them. */
6
+ readonly get: () => Readonly<Record<Key, number>>;
7
+ /** Moves to `target` from the values on screen, so a new target in the middle of a move is smooth. */
8
+ readonly to: (target: Readonly<Record<Key, number>>, pace?: Pace) => void;
9
+ /** Jumps to `target` without animating. */
10
+ readonly jump: (target: Readonly<Record<Key, number>>) => void;
11
+ readonly subscribe: (listener: () => void) => () => void;
12
+ /** Stops any move in flight. The tween still answers `get` and can be moved again. */
13
+ readonly destroy: () => void;
14
+ };
15
+ /**
16
+ * Makes a tween that starts at `initial`. Give it a new target with `to` and read `get` on each change: authors
17
+ * describe where things are, and the tween supplies the motion between.
18
+ */
19
+ export declare function createTween<Key extends string>(initial: Readonly<Record<Key, number>>): Tween<Key>;
@@ -0,0 +1,6 @@
1
+ import type { Pace } from './tween.ts';
2
+ /**
3
+ * An animated copy of `target`. The first render shows `target`, and each later change eases to the new values on the
4
+ * shared clock, starting from whatever is on screen.
5
+ */
6
+ export declare function useTween<Key extends string>(target: Readonly<Record<Key, number>>, pace?: Pace): Readonly<Record<Key, number>>;
@@ -0,0 +1,450 @@
1
+ import { l as e, o as t } from "./src-BD6xlvDt.js";
2
+ import { r as n } from "./figure-format-B8kRZMlo.js";
3
+ import "@stylexjs/stylex";
4
+ import { createParts as r } from "@ui-sdk/react/primitive";
5
+ import { createContext as i, use as a, useEffect as o, useRef as s } from "react";
6
+ import { announce as c, bindDrag as l, createChange as u, definePrimitive as d, dragThreshold as f, isRTL as p } from "@ui-sdk/core";
7
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
+ import { Check as ee, ChevronDown as te } from "lucide-react";
9
+ import { SelectTrigger as g, SelectValue as ne } from "@ui-sdk/react/select";
10
+ import { clamp as re, fractionOf as _, scrubTo as v, stepBy as y, stepFromKey as b, stepValue as x, valueAt as S } from "@ui-sdk/core/number";
11
+ // packages/teaching/src/lesson/lesson-locale.ts
12
+ var C = i(null);
13
+ function ie() {
14
+ return a(C);
15
+ }
16
+ // packages/teaching/src/lesson/lesson-error.tsx
17
+ function w(e, t) {
18
+ throw Error(`Lesson "${e}": ${t}`);
19
+ }
20
+ function T(e) {
21
+ throw Error(`${e} must be rendered inside a <Lesson>. Wrap it in <Lesson lesson={…} locale="…">.`);
22
+ }
23
+ function E({ children: e }) {
24
+ return /* @__PURE__ */ m("span", {
25
+ role: "note",
26
+ className: "xr5kp14 x1b5ytql",
27
+ children: e
28
+ });
29
+ }
30
+ // packages/teaching/src/lesson/define-lesson.ts
31
+ function D({ name: e, param: t, value: n }) {
32
+ switch (t.kind) {
33
+ case "number": return typeof n == "number" && Number.isFinite(n) && n >= t.min && n <= t.max ? void 0 : `${e} takes a number from ${t.min} to ${t.max}, not ${String(n)}.`;
34
+ case "choice": return t.options.some((e) => e.id === n) ? void 0 : `${e} takes one of ${t.options.map((e) => e.id).join(", ")}, not ${String(n)}.`;
35
+ case "toggle": return typeof n == "boolean" ? void 0 : `${e} takes true or false, not ${String(n)}.`;
36
+ }
37
+ }
38
+ function O(e, t) {
39
+ return Number.isFinite(t.min) && Number.isFinite(t.max) && t.min < t.max ? t.step > 0 ? t.scale === "log" && t.min <= 0 ? `${e} is on a log scale, so its min must be above zero.` : void 0 : `${e} needs a step above zero.` : `${e} needs finite bounds with min below max.`;
40
+ }
41
+ function k(e, t) {
42
+ if (t.kind === "number") {
43
+ let n = O(e, t);
44
+ if (n !== void 0) return n;
45
+ }
46
+ if (t.kind === "choice") {
47
+ let n = t.options.map((e) => e.id);
48
+ if (new Set(n).size !== n.length || n.length === 0) return `${e} needs at least one option, each with its own id.`;
49
+ }
50
+ let n = D({
51
+ name: e,
52
+ param: t,
53
+ value: t.value
54
+ });
55
+ return n === void 0 ? void 0 : `the default of ${n}`;
56
+ }
57
+ function A(e) {
58
+ return e.find((t, n) => e.indexOf(t) !== n);
59
+ }
60
+ function j(e) {
61
+ let t = /* @__PURE__ */ new Set();
62
+ return {
63
+ view: new Proxy(e, { get(e, n, r) {
64
+ return typeof n == "string" && t.add(n), Reflect.get(e, n, r);
65
+ } }),
66
+ names: t
67
+ };
68
+ }
69
+ function M(e, t) {
70
+ let n = new Map(Object.entries(t));
71
+ return (e.states ?? []).flatMap((t) => Object.entries(t.values).flatMap(([r, i]) => {
72
+ let a = n.get(r), o = `state "${t.id}" of beat "${e.id}"`;
73
+ if (a === void 0) return [`${o} sets "${r}", which is not a param.`];
74
+ let s = D({
75
+ name: r,
76
+ param: a,
77
+ value: i
78
+ });
79
+ return s === void 0 ? [] : [`${o}: ${s}`];
80
+ }));
81
+ }
82
+ function N(e, t) {
83
+ let n = e.steps ?? 0, r = Number.isInteger(n) && n >= 0, i = A((e.states ?? []).map((e) => e.id));
84
+ return [
85
+ ...r ? [] : [`beat "${e.id}" needs a whole number of steps, not ${n}.`],
86
+ ...i === void 0 ? [] : [`beat "${e.id}" has two states with the id "${i}".`],
87
+ ...M(e, t)
88
+ ];
89
+ }
90
+ function P({ params: e, derivedNames: t, beats: n }) {
91
+ let r = new Set(Object.keys(e)), i = t.find((e) => r.has(e)), a = A(n.map((e) => e.id));
92
+ return [
93
+ ...Object.entries(e).flatMap(([e, t]) => k(e, t) ?? []),
94
+ ...i === void 0 ? [] : [`"${i}" is declared as both a param and a derived value.`],
95
+ ...a === void 0 ? [] : [`two beats share the id "${a}".`],
96
+ ...n.flatMap((t) => N(t, e))
97
+ ];
98
+ }
99
+ function F(e) {
100
+ let { id: t, title: n, params: r } = e, i = Object.entries(e.derived ?? {}), a = e.beats ?? [], o = Object.keys(r), s = i.map(([e]) => e), [c] = P({
101
+ params: r,
102
+ derivedNames: s,
103
+ beats: a
104
+ });
105
+ c !== void 0 && w(t, c);
106
+ let l = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, t.value])), u = Object.fromEntries(s.map((e) => [e, NaN]));
107
+ function d(e) {
108
+ let n = {
109
+ known: {
110
+ ...e,
111
+ ...u
112
+ },
113
+ results: u
114
+ }, r = new Set(o), a = i.map(([e, i]) => {
115
+ let { view: a, names: o } = j(n.known), s = i.from(a), c = [...o].find((e) => !r.has(e));
116
+ return c !== void 0 && w(t, `derived "${e}" reads "${c}", which is not a param or a derived value declared before it.`), typeof s != "number" && w(t, `derived "${e}" must return a number.`), r.add(e), n.known = {
117
+ ...n.known,
118
+ [e]: s
119
+ }, n.results = {
120
+ ...n.results,
121
+ [e]: s
122
+ }, [e, [...o]];
123
+ });
124
+ return {
125
+ results: n.results,
126
+ reads: a
127
+ };
128
+ }
129
+ let f = d(l), p = a.flatMap((e) => (e.states ?? []).map((e) => d({
130
+ ...l,
131
+ ...e.values
132
+ }).reads)), m = Object.fromEntries(s.map((e) => [e, [...new Set([f.reads, ...p].flatMap((t) => t.filter(([t]) => t === e).flatMap(([, e]) => e)))]]));
133
+ return {
134
+ id: t,
135
+ title: n,
136
+ params: r,
137
+ derived: Object.fromEntries(i.map(([e, t]) => [e, {
138
+ label: t.label,
139
+ format: t.format
140
+ }])),
141
+ beats: a,
142
+ defaults: l,
143
+ initial: {
144
+ ...l,
145
+ ...f.results
146
+ },
147
+ compute: (e) => d(e).results,
148
+ reads: m
149
+ };
150
+ }
151
+ function I(e) {
152
+ return {
153
+ nodes: [...Object.entries(e.params).map(([e, t]) => ({
154
+ name: e,
155
+ kind: "param",
156
+ label: t.label
157
+ })), ...Object.entries(e.derived).map(([e, t]) => ({
158
+ name: e,
159
+ kind: "derived",
160
+ label: t.label
161
+ }))],
162
+ edges: Object.entries(e.reads).flatMap(([e, t]) => t.map((t) => ({
163
+ from: t,
164
+ to: e
165
+ })))
166
+ };
167
+ }
168
+ // packages/teaching/src/lesson/lesson-context.ts
169
+ var L = i(null);
170
+ function R(e) {
171
+ return a(L) ?? T(e);
172
+ }
173
+ function z(e, t) {
174
+ let n = { scope: e };
175
+ for (; n.scope !== null && n.scope.lesson !== t;) n.scope = n.scope.outer;
176
+ return n.scope;
177
+ }
178
+ // packages/teaching/src/lesson/bound-value.tsx
179
+ var B = 240, V = {
180
+ step: .01,
181
+ large: .1,
182
+ small: .001
183
+ }, H = [
184
+ "ArrowLeft",
185
+ "ArrowRight",
186
+ "ArrowUp",
187
+ "ArrowDown",
188
+ "PageUp",
189
+ "PageDown",
190
+ "Home",
191
+ "End"
192
+ ];
193
+ function U({ min: e, max: t, step: n }) {
194
+ return {
195
+ min: e,
196
+ max: t,
197
+ step: n
198
+ };
199
+ }
200
+ function W(e, t) {
201
+ let n = U(t);
202
+ return v(S(re(e, 0, 1), n, t.scale ?? "linear"), n).value;
203
+ }
204
+ function G(e, t, n) {
205
+ if (t.bound !== void 0) return t.bound === "min" ? n.min : n.max;
206
+ let r = U(n), i = W(_(e, r, "log") + t.direction * V[t.size], n);
207
+ return i === e ? x(e, t.direction, r) : i;
208
+ }
209
+ var K = d({
210
+ name: "bound-value",
211
+ options: {
212
+ value: "number",
213
+ defaultValue: "number",
214
+ onValueChange: "callback",
215
+ min: "number",
216
+ max: "number",
217
+ step: "number",
218
+ scale: "string",
219
+ describe: "value"
220
+ },
221
+ controlled: ["value"],
222
+ state: (e) => ({
223
+ value: e.value ?? e.defaultValue ?? e.min,
224
+ isDragging: !1
225
+ }),
226
+ sync: (e) => e.value === void 0 ? {} : { value: e.value },
227
+ api: (e) => {
228
+ let { store: t } = e, n = u(e), r = null;
229
+ e.onDestroy(() => r?.());
230
+ function i(e, r, i) {
231
+ return e !== t.get().value && n("value", e, i === void 0 ? { reason: r } : {
232
+ reason: r,
233
+ event: i
234
+ });
235
+ }
236
+ return {
237
+ describe: (t) => e.options().describe(t),
238
+ setValue(t) {
239
+ let { min: n, max: r } = e.options(), a = Number(t);
240
+ if (!Number.isFinite(a) || a < n || a > r) throw Error(`Give a number between ${n} and ${r}.`);
241
+ return i(v(a, U(e.options())).value, "imperative");
242
+ },
243
+ keydown(n, r) {
244
+ let a = b(n, { dir: p(r) ? "rtl" : "ltr" });
245
+ if (a === null || n.defaultPrevented) return;
246
+ n.preventDefault();
247
+ let o = e.options(), { value: s } = t.get();
248
+ i(o.scale === "log" ? G(s, a, o) : y(s, a, U(o)), "step-key", n);
249
+ },
250
+ pointerdown(n, a) {
251
+ if (n.button !== 0) return;
252
+ r?.();
253
+ let o = t.get().value, s = p(a) ? -1 : 1, c = _(o, U(e.options()), e.options().scale ?? "linear"), u = 0;
254
+ r = l(a, n, {
255
+ threshold: f,
256
+ cancelOnEscape: !0,
257
+ onStart: () => {
258
+ t.set({ isDragging: !0 });
259
+ },
260
+ onMove: ({ movementX: t, event: n }) => {
261
+ u += t * s, i(W(c + u / B, e.options()), "drag", n);
262
+ },
263
+ onEnd: (e, n) => {
264
+ t.set({ isDragging: !1 }), n && i(o, "drag", e);
265
+ }
266
+ });
267
+ }
268
+ };
269
+ },
270
+ slots: (e) => ({ root: e({
271
+ role: "slider",
272
+ focus: "tab-stop",
273
+ keys: [...H],
274
+ state: (e, { api: t }) => ({
275
+ text: t.describe(e.value),
276
+ isDragging: e.isDragging
277
+ }),
278
+ attrs: (e, { api: t }) => ({
279
+ tabindex: "0",
280
+ "aria-valuenow": String(e.value),
281
+ "aria-valuetext": t.describe(e.value),
282
+ "data-dragging": e.isDragging ? "" : void 0
283
+ }),
284
+ on: {
285
+ keydown: (e, { api: t, el: n }) => {
286
+ n !== void 0 && t.keydown(e, n);
287
+ },
288
+ pointerdown: (e, { api: t, el: n }) => {
289
+ n !== void 0 && t.pointerdown(e, n);
290
+ }
291
+ }
292
+ }) }),
293
+ agent: { actions: ["setValue"] }
294
+ }), q = r(K, { root: "span" }).Root;
295
+ function J({ min: e, max: t, step: n, scale: r, value: i }) {
296
+ if (!Number.isFinite(e) || !Number.isFinite(t) || e >= t) return "BoundValue needs finite bounds with min below max.";
297
+ if (!Number.isFinite(n) || n < 0) return "BoundValue needs a step of zero or more.";
298
+ if (r === "log" && e <= 0) return "A log BoundValue needs a min above zero.";
299
+ if (i !== void 0 && !(Number.isFinite(i) && i >= e && i <= t)) return `BoundValue ${i} lies outside ${e} to ${t}.`;
300
+ }
301
+ function Y({ label: e, locale: t, format: r, ...i }) {
302
+ let a = J(i);
303
+ return a === void 0 ? /* @__PURE__ */ m(q, {
304
+ ...i,
305
+ describe: (e) => n({
306
+ value: e,
307
+ locale: t,
308
+ format: r
309
+ }),
310
+ "aria-label": e,
311
+ "aria-valuemin": i.min,
312
+ "aria-valuemax": i.max,
313
+ "aria-orientation": "horizontal",
314
+ className: "xt0psk2 x1ok0vyi xbixft xss6m8b xk4h15q xuxw1ft x7eptgl x87ps6o xx69xxh xujl8zx xi2nhp4 xewurvo x11xz5oc x1jdncgf xif5pkx x81ozek xxxv2na x13qnu6 x9v5kkp x19rmrnh x7s97pk",
315
+ render: (e, { text: t }) => /* @__PURE__ */ m("span", {
316
+ ...e,
317
+ children: t
318
+ })
319
+ }) : /* @__PURE__ */ m("span", {
320
+ className: "xr5kp14 x1b5ytql",
321
+ children: a
322
+ });
323
+ }
324
+ // packages/teaching/src/lesson/inline-choice.tsx
325
+ var ae = 14;
326
+ function oe({ param: t, value: n, isDisabled: r, onChange: i }) {
327
+ let a = t.options.map((e) => ({
328
+ value: e.id,
329
+ label: e.label
330
+ }));
331
+ return /* @__PURE__ */ h(e.Root, {
332
+ value: n,
333
+ items: a,
334
+ disabled: r,
335
+ onValueChange: (e, t) => {
336
+ e !== null && i(e, t);
337
+ },
338
+ children: [/* @__PURE__ */ h(g, {
339
+ "aria-label": t.label,
340
+ disabled: r,
341
+ className: "x3nfvp2 x1pha0wt xfko13i x1717udv x1ghz6dp xc342km x1ok0vyi xjbqb8w xbixft xjb2p0i x1qlqyl8 x15bjb6t xk4h15q xuxw1ft x1ypdohk xujl8zx xi2nhp4 xewurvo x11xz5oc x1jdncgf xif5pkx x1m8qfh3 x47ym49 x13qnu6 x9v5kkp x19rmrnh x7s97pk",
342
+ children: [/* @__PURE__ */ m(ne, {}), !r && /* @__PURE__ */ m(te, {
343
+ size: ae,
344
+ "aria-hidden": !0,
345
+ className: "xamitd3 x153jb6y"
346
+ })]
347
+ }), /* @__PURE__ */ m(e.Popup, {
348
+ align: "start",
349
+ children: /* @__PURE__ */ m(e.List, { children: a.map((t) => /* @__PURE__ */ h(e.Item, {
350
+ value: t.value,
351
+ children: [/* @__PURE__ */ m(e.ItemText, { children: t.label }), /* @__PURE__ */ m(e.ItemIndicator, { children: /* @__PURE__ */ m(ee, {
352
+ size: 16,
353
+ "aria-hidden": !0
354
+ }) })]
355
+ }, t.value)) })
356
+ })]
357
+ });
358
+ }
359
+ // packages/teaching/src/lesson/param.tsx
360
+ var se = 700, X = {
361
+ on: "on",
362
+ off: "off"
363
+ };
364
+ function Z(e, t) {
365
+ let n = new Map(Object.entries(e.lesson.params)).get(t);
366
+ return n === void 0 ? { error: `Lesson "${e.lesson.id}" has no param "${t}". Its params: ${Object.keys(e.lesson.params).join(", ")}.` } : { param: n };
367
+ }
368
+ function Q({ param: e, value: t, locale: r, labels: i }) {
369
+ switch (e.kind) {
370
+ case "number": return n({
371
+ value: typeof t == "number" ? t : null,
372
+ locale: r,
373
+ format: e.format
374
+ });
375
+ case "choice": return e.options.find((e) => e.id === t)?.label ?? String(t);
376
+ case "toggle": return t === !0 ? i.on : i.off;
377
+ }
378
+ }
379
+ function ce({ name: e }) {
380
+ let n = R("Param"), r = Z(n, e);
381
+ if ("error" in r) return /* @__PURE__ */ m(E, { children: r.error });
382
+ let { param: i } = r, a = n.state.values[e], { isReadOnly: o } = n.state;
383
+ switch (i.kind) {
384
+ case "number": return o ? /* @__PURE__ */ m("span", {
385
+ className: "xss6m8b xk4h15q xuxw1ft xbixft",
386
+ children: Q({
387
+ param: i,
388
+ value: a,
389
+ locale: n.locale,
390
+ labels: X
391
+ })
392
+ }) : /* @__PURE__ */ m(Y, {
393
+ value: typeof a == "number" ? a : i.value,
394
+ onValueChange: (t, r) => n.api.apply(e, t, r),
395
+ min: i.min,
396
+ max: i.max,
397
+ step: i.step,
398
+ scale: i.scale,
399
+ locale: n.locale,
400
+ format: i.format,
401
+ label: i.label
402
+ });
403
+ case "choice": return /* @__PURE__ */ m(oe, {
404
+ param: i,
405
+ value: typeof a == "string" ? a : i.value,
406
+ isDisabled: o,
407
+ onChange: (t, r) => n.api.apply(e, t, r)
408
+ });
409
+ case "toggle": return /* @__PURE__ */ m("span", {
410
+ className: "x3nfvp2 xxymvpz",
411
+ children: /* @__PURE__ */ m(t.Root, {
412
+ checked: a === !0,
413
+ onCheckedChange: (t, r) => n.api.apply(e, t, r),
414
+ disabled: o,
415
+ "aria-label": i.label,
416
+ children: /* @__PURE__ */ m(t.Thumb, {})
417
+ })
418
+ });
419
+ }
420
+ }
421
+ function le(e, t) {
422
+ let n = s(e);
423
+ o(() => {
424
+ if (t || n.current === e) return;
425
+ let r = globalThis.setTimeout(() => {
426
+ n.current = e, c(e);
427
+ }, se);
428
+ return () => globalThis.clearTimeout(r);
429
+ }, [e, t]);
430
+ }
431
+ function $({ name: e, labels: t }) {
432
+ let r = R("Value"), i = new Map(Object.entries(r.lesson.derived)).get(e), a = i === void 0 ? Z(r, e) : void 0, o = r.values[e], s = i === void 0 ? a !== void 0 && "param" in a ? Q({
433
+ param: a.param,
434
+ value: o,
435
+ locale: r.locale,
436
+ labels: {
437
+ ...X,
438
+ ...t
439
+ }
440
+ }) : void 0 : n({
441
+ value: typeof o == "number" ? o : null,
442
+ locale: r.locale,
443
+ format: i.format
444
+ }), c = i?.label ?? (a !== void 0 && "param" in a ? a.param.label : e);
445
+ return le(s === void 0 ? "" : `${c}: ${s}`, r.state.playing !== null), s === void 0 ? /* @__PURE__ */ m(E, { children: `Lesson "${r.lesson.id}" has no param or derived value "${e}".` }) : /* @__PURE__ */ m("span", {
446
+ className: "xss6m8b xk4h15q xuxw1ft",
447
+ children: s
448
+ });
449
+ }
450
+ export { L as a, F as c, E as d, w as f, ie as h, Y as i, I as l, C as m, $ as n, z as o, T as p, Z as r, R as s, ce as t, D as u };
@@ -0,0 +1,59 @@
1
+ function e(e) {
2
+ return String(Math.round(e * 100) / 100);
3
+ }
4
+ function t(t) {
5
+ return `${e(t.x)},${e(t.y)}`;
6
+ }
7
+ function n(e, t) {
8
+ return e.flatMap((n, r) => {
9
+ let i = e[r - 1];
10
+ return t(n) && (i === void 0 || !t(i)) ? [r] : [];
11
+ }).map((n) => {
12
+ let r = e.findIndex((e, r) => r > n && !t(e));
13
+ return e.slice(n, r === -1 ? void 0 : r);
14
+ });
15
+ }
16
+ function r(n, r) {
17
+ return n.map((i, a) => n[a - 1] === void 0 ? t(i) : r === "step" ? `H${e(i.x)}V${e(i.y)}` : `L${t(i)}`).join("");
18
+ }
19
+ function i(e) {
20
+ return n(e, (e) => e.y !== null).map((e) => e.flatMap((e) => e.y === null ? [] : [{
21
+ x: e.x,
22
+ y: e.y
23
+ }]));
24
+ }
25
+ function a(e, t = "linear") {
26
+ return i(e).filter((e) => e.length > 1).map((e) => `M${r(e, t)}`).join("");
27
+ }
28
+ function o(e) {
29
+ return i(e).flatMap((e) => e.length === 1 ? e : []);
30
+ }
31
+ function s(e) {
32
+ return n(e, (e) => e.y0 !== null && e.y1 !== null).map((e) => {
33
+ let t = e.flatMap((e) => e.y1 === null ? [] : [{
34
+ x: e.x,
35
+ y: e.y1
36
+ }]), n = e.flatMap((e) => e.y0 === null ? [] : [{
37
+ x: e.x,
38
+ y: e.y0
39
+ }]).toReversed();
40
+ return `M${r(t, "linear")}L${r(n, "linear")}Z`;
41
+ }).join("");
42
+ }
43
+ var c = .5;
44
+ function l({ x1: n, y1: r, x2: i, y2: a, axis: o, shape: s = "curve" }) {
45
+ let l = t({
46
+ x: n,
47
+ y: r
48
+ }), u = t({
49
+ x: i,
50
+ y: a
51
+ });
52
+ if (o === "y") {
53
+ let t = e(r + (a - r) * c);
54
+ return s === "elbow" ? `M${l}V${t}H${e(i)}V${e(a)}` : `M${l}C${e(n)},${t} ${e(i)},${t} ${u}`;
55
+ }
56
+ let d = e(n + (i - n) * c);
57
+ return s === "elbow" ? `M${l}H${d}V${e(a)}H${e(i)}` : `M${l}C${d},${e(r)} ${d},${e(a)} ${u}`;
58
+ }
59
+ export { l as i, o as n, a as r, s as t };
@@ -0,0 +1,100 @@
1
+ import { n as e } from "./plot-width-DcqtSgzb.js";
2
+ import * as t from "@stylexjs/stylex";
3
+ import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ // packages/charts/src/plot/plot-axes.tsx
5
+ var a = {
6
+ x: {
7
+ hasX: !0,
8
+ hasY: !1
9
+ },
10
+ y: {
11
+ hasX: !1,
12
+ hasY: !0
13
+ },
14
+ both: {
15
+ hasX: !0,
16
+ hasY: !0
17
+ },
18
+ none: {
19
+ hasX: !1,
20
+ hasY: !1
21
+ }
22
+ }, o = 7, s = 16, c = 18, l = 8, u = 4, d = 40, f = 16, p = 28, m = 14, h = "\n";
23
+ function g(e) {
24
+ return Math.max(...e.split(h).map((e) => e.length)) * o;
25
+ }
26
+ function _(e, t) {
27
+ let n = e.map((e) => ({
28
+ x: y(e, t),
29
+ half: g(e.label) / 2
30
+ }));
31
+ return Array.from({ length: Math.max(1, e.length) }, (e, t) => t + 1).find((e) => n.every((t, r) => {
32
+ let i = n[r + e];
33
+ return r % e !== 0 || i === void 0 || i.x - t.x >= t.half + i.half + s;
34
+ })) ?? 1;
35
+ }
36
+ function v(e) {
37
+ let [t = "", ...n] = e.split(h);
38
+ return {
39
+ first: t,
40
+ second: n.length === 0 ? void 0 : n.join(" ")
41
+ };
42
+ }
43
+ function y(e, t) {
44
+ let n = g(e.label) / 2;
45
+ return Math.min(Math.max(e.position, n), Math.max(n, t - n));
46
+ }
47
+ function b({ box: s, xTicks: h, yTicks: g, xTitle: b, yTitle: x, grid: S = "y" }) {
48
+ let C = _(h, s.width), { hasX: w, hasY: T } = a[S], E = (s.top + s.bottom) / 2, D = Math.floor((s.left - l - (x === void 0 ? 0 : p)) / o);
49
+ return /* @__PURE__ */ i("g", { children: [
50
+ h.map((n, a) => {
51
+ let o = v(n.label), l = y(n, s.width);
52
+ return /* @__PURE__ */ i("g", { children: [w && /* @__PURE__ */ r("line", {
53
+ x1: n.position,
54
+ x2: n.position,
55
+ y1: s.top,
56
+ y2: s.bottom,
57
+ ...t.props(e.grid)
58
+ }), a % C === 0 && /* @__PURE__ */ i("text", {
59
+ x: l,
60
+ y: s.bottom + c,
61
+ textAnchor: "middle",
62
+ ...t.props(e.label, e.tick),
63
+ children: [o.first, o.second !== void 0 && /* @__PURE__ */ r("tspan", {
64
+ x: l,
65
+ dy: m,
66
+ children: o.second
67
+ })]
68
+ })] }, n.key);
69
+ }),
70
+ g.map((a) => /* @__PURE__ */ i("g", { children: [T && /* @__PURE__ */ r("line", {
71
+ x1: s.left,
72
+ x2: s.right,
73
+ y1: a.position,
74
+ y2: a.position,
75
+ ...t.props(e.grid)
76
+ }), /* @__PURE__ */ r("text", {
77
+ x: s.left - l,
78
+ y: a.position + u,
79
+ textAnchor: "end",
80
+ ...t.props(e.label, e.tick),
81
+ children: a.label.length <= D ? a.label : /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("title", { children: a.label }), `${a.label.slice(0, Math.max(1, D - 1)).trimEnd()}…`] })
82
+ })] }, a.key)),
83
+ b !== void 0 && /* @__PURE__ */ r("text", {
84
+ x: (s.left + s.right) / 2,
85
+ y: s.bottom + d,
86
+ textAnchor: "middle",
87
+ ...t.props(e.label),
88
+ children: b
89
+ }),
90
+ x !== void 0 && /* @__PURE__ */ r("text", {
91
+ x: f,
92
+ y: E,
93
+ textAnchor: "middle",
94
+ transform: `rotate(-90 ${f} ${E})`,
95
+ ...t.props(e.label),
96
+ children: x
97
+ })
98
+ ] });
99
+ }
100
+ export { b as t };