@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,32 @@
1
+ import type { PointerEventHandler, ReactNode, Ref } from 'react';
2
+ import type { PlotBox, PlotHeight } from './plot-layout.ts';
3
+ /** Measures a plot: the width its container gives it and the named height its figure chose. */
4
+ export declare function usePlotSize(height?: PlotHeight): {
5
+ readonly ref: Ref<HTMLDivElement>;
6
+ readonly width: number;
7
+ readonly height: number;
8
+ };
9
+ export type PlotSurfaceProps = {
10
+ /** The ref from `usePlotSize`. */
11
+ readonly plotRef: Ref<HTMLDivElement>;
12
+ readonly box: PlotBox;
13
+ /** The plot's accessible name. Build it with `plotLabel`, so every chart explains its keys the same way. */
14
+ readonly label: string;
15
+ /** The id of the readout that states the inspected mark's exact values. */
16
+ readonly readoutId: string;
17
+ /** The SVG marks, axes and guides. */
18
+ readonly children: ReactNode;
19
+ /** HTML drawn over the marks in the same pixel space, such as a canvas layer or point targets. */
20
+ readonly overlay?: ReactNode;
21
+ readonly onPointerDown?: PointerEventHandler<SVGSVGElement> | undefined;
22
+ };
23
+ /**
24
+ * The plot of a chart: one Tab stop that owns the keyboard cursor, pointer inspection and dismissal for the marks drawn
25
+ * inside it. Use it inside `Chart`, which supplies the items.
26
+ */
27
+ export declare function PlotSurface({ plotRef, box, label, readoutId, children, overlay, onPointerDown, }: PlotSurfaceProps): ReactNode;
28
+ /** Keeps marks inside the axes. Wrap the marks, never the axes or the labels beside them. */
29
+ export declare function PlotClip({ box, children }: {
30
+ readonly box: PlotBox;
31
+ readonly children: ReactNode;
32
+ }): ReactNode;
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { PlotBox } from '../plot-layout.ts';
3
+ export type DensityLayerProps = {
4
+ /** The plot the layer covers. The grid fills its drawing area, inside the axes. */
5
+ readonly box: PlotBox;
6
+ readonly columns: number;
7
+ readonly rows: number;
8
+ /** One value per cell, row by row. Row 0 is the bottom row and column 0 the leftmost. */
9
+ readonly counts: ReadonlyArray<number>;
10
+ /** The value drawn with the full hue. Zero draws nothing; values between draw lighter shades of the same hue. */
11
+ readonly maximum: number;
12
+ };
13
+ /**
14
+ * A grid of cell values drawn on one canvas as the lightness of one hue, for a 2D histogram such as `DensityMap`. It
15
+ * draws a 512 by 512 grid in one image copy, matches the matrix heatmap's sequential colors, and follows the theme.
16
+ */
17
+ export declare function DensityLayer({ box, columns, rows, counts, maximum }: DensityLayerProps): ReactNode;
@@ -0,0 +1,37 @@
1
+ import type { NumericDomain } from '../scale.ts';
2
+ /**
3
+ * Many points as plain columns: the nth point sits at `x[n]`, `y[n]` in data units and belongs to the group at index
4
+ * `group[n]`. Columns keep a million points cheap to hold, send and draw.
5
+ */
6
+ export type PointColumns = {
7
+ readonly x: ReadonlyArray<number>;
8
+ readonly y: ReadonlyArray<number>;
9
+ readonly group: ReadonlyArray<number>;
10
+ };
11
+ /** A rectangle in data units. */
12
+ export type DataRect = {
13
+ readonly x: NumericDomain;
14
+ readonly y: NumericDomain;
15
+ };
16
+ /** Where to look for a point: a position in data units and how far to look along each axis, also in data units. */
17
+ export type HitQuery = {
18
+ readonly x: number;
19
+ readonly y: number;
20
+ readonly radiusX: number;
21
+ readonly radiusY: number;
22
+ };
23
+ /** Finds the point nearest a position, such as the one under a pointer, without visiting every point. */
24
+ export type HitIndex = {
25
+ /** The index of the nearest point inside the query's ellipse, or undefined when none lies there. */
26
+ readonly nearest: (query: HitQuery) => number | undefined;
27
+ };
28
+ /**
29
+ * A uniform grid over the points' domain. Building it visits each point twice; a query visits only the points in the
30
+ * cells its ellipse touches. Rebuild it when the points change, not when the view pans or zooms.
31
+ */
32
+ export declare function hitIndex({ points, domain }: {
33
+ readonly points: PointColumns;
34
+ readonly domain: DataRect;
35
+ }): HitIndex;
36
+ /** How many points lie inside a rectangle, edges included. */
37
+ export declare function countInside(points: PointColumns, rect: DataRect): number;
@@ -0,0 +1,39 @@
1
+ import type { ChangeDetails, Viewport, ViewportReason } from '@ui-sdk/core';
2
+ import type { PartProps } from '@ui-sdk/react/primitive';
3
+ import type { ReactNode } from 'react';
4
+ import type { PlotBox } from '../plot-layout.ts';
5
+ import type { ContinuousScale, NumericDomain } from '../scale.ts';
6
+ /** Where an explored plot looks: its pan in CSS pixels and its zoom, where 1 shows the whole domain. */
7
+ export type PlotView = Viewport;
8
+ /** Why the view moved: a drag, a pinch, a modifier and scroll, a zoom key, the reset button or an agent's call. */
9
+ export type PlotViewDetails = ChangeDetails<ViewportReason>;
10
+ export type PlotViewportOptions = {
11
+ /** The view now. The application or the chart holds it and passes back what `onViewChange` asks for. */
12
+ readonly view: PlotView;
13
+ readonly onViewChange: (view: PlotView, details: PlotViewDetails) => void;
14
+ /** False leaves every gesture to the page and the chart: scrolling scrolls, dragging draws. */
15
+ readonly isEnabled: boolean;
16
+ /** How far the view zooms in. It never zooms out past the whole domain. */
17
+ readonly maxZoom?: number | undefined;
18
+ };
19
+ /** The view that shows the whole domain. */
20
+ export declare const WHOLE_VIEW: Readonly<PlotView>;
21
+ export type PlotViewportRootProps = PlotViewportOptions & Omit<PartProps<'div'>, 'id'>;
22
+ /**
23
+ * Pans and zooms a plot with the UI SDK viewport. A drag pans, a pinch or Control or Command with a scroll zooms, and
24
+ * `+`, `−` and `0` zoom from the keyboard while the plot has focus. Wrap the plot in it and put `PlotViewportSurface`
25
+ * over the drawing area, and the caller holds `view` so a reset button sets it back to `WHOLE_VIEW`.
26
+ */
27
+ export declare function PlotViewportRoot({ view, onViewChange, isEnabled, maxZoom, ...props }: PlotViewportRootProps): ReactNode;
28
+ /** The area that takes the pan and zoom gestures: the plot's drawing area, inside its axes. */
29
+ export declare function PlotViewportSurface(props: Omit<PartProps<'div'>, 'id'>): ReactNode;
30
+ /** The part of each axis's domain an explored plot shows, from the scales that show the whole domain. */
31
+ export declare function visibleDomains({ view, box, x, y, }: {
32
+ readonly view: PlotView;
33
+ readonly box: PlotBox;
34
+ readonly x: ContinuousScale;
35
+ readonly y: ContinuousScale;
36
+ }): {
37
+ readonly x: NumericDomain;
38
+ readonly y: NumericDomain;
39
+ };
@@ -0,0 +1,41 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../../foundations/src/chart-tones.ts';
3
+ import type { PlotBox } from '../plot-layout.ts';
4
+ import type { ContinuousScale } from '../scale.ts';
5
+ import type { PointColumns } from './hit-index.ts';
6
+ /** How a point layer draws: canvas 2D for up to about a hundred thousand points, WebGL for up to about a million. */
7
+ export type PointRenderer = 'canvas' | 'webgl';
8
+ /** Where data values land on one axis: its domain and the CSS pixels it spans. A point layer maps both linearly. */
9
+ export type PointAxis = Pick<ContinuousScale, 'domain' | 'range'>;
10
+ /** What one finished draw reports: the renderer that drew, which is canvas when WebGL is unavailable, and its cost. */
11
+ export type PointDraw = {
12
+ readonly renderer: PointRenderer;
13
+ /** Main-thread time spent issuing the draw, in milliseconds. */
14
+ readonly milliseconds: number;
15
+ readonly points: number;
16
+ };
17
+ export type PointLayerProps = {
18
+ /** The plot the layer covers. Points draw inside its axes only. */
19
+ readonly box: PlotBox;
20
+ /** The points in data units, with each point's group as an index into `tones`. */
21
+ readonly points: PointColumns;
22
+ readonly x: PointAxis;
23
+ readonly y: PointAxis;
24
+ /** One tone per group, at most 16. */
25
+ readonly tones: ReadonlyArray<ChartTone>;
26
+ /** A group drawn in its hue on top, while every other group recedes to gray context. */
27
+ readonly highlight?: number | null | undefined;
28
+ /** The radius of each point, in CSS pixels. */
29
+ readonly radius?: number | undefined;
30
+ /** The opacity of each point, from 0 to 1, so dense regions read darker than sparse ones. */
31
+ readonly opacity?: number | undefined;
32
+ readonly renderer: PointRenderer;
33
+ /** Hears each finished draw, including which renderer drew it, so the chart can say when WebGL was unavailable. */
34
+ readonly onDraw?: ((draw: PointDraw) => void) | undefined;
35
+ };
36
+ /**
37
+ * Many points drawn on a canvas over a plot: up to about a hundred thousand with canvas 2D, up to about a million with
38
+ * WebGL in one draw call. Put it in `PlotSurface`'s `overlay`, beside the SVG axes. Its colors follow the theme, and
39
+ * when WebGL is unavailable it draws with canvas and says so through `onDraw`.
40
+ */
41
+ export declare function PointLayer(props: PointLayerProps): ReactNode;
@@ -0,0 +1,15 @@
1
+ /** A color as a canvas draws it: red, green, blue and alpha, each from 0 to 255. */
2
+ export type DrawColor = readonly [red: number, green: number, blue: number, alpha: number];
3
+ /**
4
+ * The concrete colors of theme colors, such as `chartToneColors[tone]`, where `element` sits in the page. A canvas
5
+ * cannot read CSS custom properties, so a layer resolves its colors here before each draw.
6
+ */
7
+ export declare function resolveColors(element: HTMLElement, colors: ReadonlyArray<string>): ReadonlyArray<DrawColor>;
8
+ /** A color with its channels from 0 to 1, as a shader takes it. */
9
+ export declare function unitColor([red, green, blue, alpha]: DrawColor): DrawColor;
10
+ /**
11
+ * A number that changes whenever the colors or the pixel density under `element` may have changed. The causes are a
12
+ * theme class on an ancestor, the system color scheme, or the window moving to a screen with another pixel ratio. A
13
+ * canvas layer redraws when it changes.
14
+ */
15
+ export declare function useDrawRevision(element: HTMLElement | null): number;
@@ -0,0 +1,48 @@
1
+ export type NumericDomain = readonly [minimum: number, maximum: number];
2
+ /**
3
+ * How values spread along an axis: evenly, by ratio, or by ratio on both sides of zero. A log axis needs a positive
4
+ * domain. A symlog axis is linear within one unit of zero, so it can hold zero and signed values.
5
+ */
6
+ export type ScaleType = 'linear' | 'log' | 'symlog';
7
+ export type ContinuousScale = {
8
+ readonly type: ScaleType;
9
+ readonly domain: NumericDomain;
10
+ readonly range: readonly [number, number];
11
+ /** Where a value sits. One outside the domain sits at the nearest end. Charts reject such input before drawing. */
12
+ readonly position: (value: number) => number;
13
+ /** The value at a position, such as the one under a pointer. */
14
+ readonly valueAt: (position: number) => number;
15
+ };
16
+ export type BandScale = {
17
+ readonly ids: ReadonlyArray<string>;
18
+ /** The distance from one band's start to the next. */
19
+ readonly step: number;
20
+ readonly bandwidth: number;
21
+ /** Where an id's band starts, or undefined for an id the scale does not hold. */
22
+ readonly start: (id: string) => number | undefined;
23
+ readonly center: (id: string) => number | undefined;
24
+ /** The id whose step holds a position, such as the one under a pointer. Positions outside the range take an end. */
25
+ readonly idAt: (position: number) => string | undefined;
26
+ };
27
+ export declare function isFiniteDomain(domain: NumericDomain): boolean;
28
+ /** Why a domain cannot carry a scale type, or undefined when it can. */
29
+ export declare function scaleDomainError(domain: NumericDomain, type?: ScaleType): string | undefined;
30
+ export declare function outsideDomain(value: number, domain: NumericDomain): boolean;
31
+ export type ContinuousScaleInput = {
32
+ readonly type?: ScaleType | undefined;
33
+ readonly domain: NumericDomain;
34
+ /** The positions of the domain's two ends. Pass them reversed for an axis that grows upward on screen. */
35
+ readonly range: readonly [number, number];
36
+ };
37
+ /** A scale for measured values, on the UI SDK number helpers that sliders and meters place their values with. */
38
+ export declare function continuousScale({ type, domain, range }: ContinuousScaleInput): ContinuousScale;
39
+ export type BandScaleInput = {
40
+ readonly ids: ReadonlyArray<string>;
41
+ readonly range: readonly [number, number];
42
+ /** The share of each step left empty between bands and at both ends, from 0 to 1. */
43
+ readonly padding?: number | undefined;
44
+ };
45
+ /** A scale for named categories in supplied order: each takes an equal band, with the same gap at both ends. */
46
+ export declare function bandScale({ ids, range, padding }: BandScaleInput): BandScale;
47
+ /** The smallest and largest value of a column, or undefined for an empty column. It reads a million values safely. */
48
+ export declare function columnExtent(values: ReadonlyArray<number>): NumericDomain | undefined;
@@ -0,0 +1,34 @@
1
+ import type { NumericDomain, ScaleType } from './scale.ts';
2
+ /**
3
+ * Round values between two bounds, about `count` of them, on steps of 1, 2 or 5 times a power of ten. The bounds
4
+ * themselves appear only when they are round.
5
+ */
6
+ export declare function linearTicks(domain: NumericDomain, count: number): ReadonlyArray<number>;
7
+ /**
8
+ * The powers of ten inside a positive domain, about `count` of them. A domain that holds fewer than three powers also
9
+ * gets their 2 and 5 multiples, so a short log axis still shows enough ticks to read.
10
+ */
11
+ export declare function logTicks(domain: NumericDomain, count: number): ReadonlyArray<number>;
12
+ /** Zero and the powers of ten on each side of it that a signed domain holds. */
13
+ export declare function symlogTicks(domain: NumericDomain, count: number): ReadonlyArray<number>;
14
+ export type TickInput = {
15
+ readonly domain: NumericDomain;
16
+ readonly type?: ScaleType | undefined;
17
+ /** About how many ticks to return. The round steps decide the exact number. */
18
+ readonly count: number;
19
+ };
20
+ /** Tick values for a measured axis of any scale type. */
21
+ export declare function scaleTicks({ domain, type, count }: TickInput): ReadonlyArray<number>;
22
+ export type TimeTickInput = {
23
+ /** The first and last instant, in milliseconds since the epoch. */
24
+ readonly domain: NumericDomain;
25
+ readonly count: number;
26
+ /** How far the reader's time zone is ahead of UTC at the domain's start, in milliseconds. */
27
+ readonly zoneOffset: number;
28
+ };
29
+ /**
30
+ * Instants on round clock steps in the reader's zone: seconds, minutes, hours or days. Spans of months and years fall
31
+ * on multiples of 30, 90 or 365 days from the first local midnight, which a date format labels by its day. Spans of
32
+ * decades step by two, five or ten such years.
33
+ */
34
+ export declare function timeTicks({ domain, count, zoneOffset }: TimeTickInput): ReadonlyArray<number>;
@@ -1,4 +1,5 @@
1
+ /** The width a plot's container gives it, measured as it resizes. Attach `ref` to the element that sets the width. */
1
2
  export declare function usePlotWidth(): {
2
- ref: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
3
- width: number;
3
+ readonly ref: (element: HTMLDivElement | null) => void;
4
+ readonly width: number;
4
5
  };
@@ -0,0 +1,61 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ValueFormat } from '../figure/figure-format.ts';
3
+ import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
4
+ import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
5
+ import type { NumericDomain } from '../plot/scale.ts';
6
+ /** A surface the application sampled on a regular grid. Row 0 is at the start of `yDomain`, the bottom of the plot. */
7
+ export type ContourGridInput = {
8
+ readonly columns: number;
9
+ readonly rows: number;
10
+ /** `columns * rows` finite samples, row by row, each row from the start of `xDomain` to its end. */
11
+ readonly values: ReadonlyArray<number>;
12
+ /** The x values of the first and last column. */
13
+ readonly xDomain: NumericDomain;
14
+ /** The y values of the first and last row. */
15
+ readonly yDomain: NumericDomain;
16
+ };
17
+ /** A route drawn over the surface, such as the steps an optimizer took. */
18
+ export type ContourPath = {
19
+ readonly id: string;
20
+ readonly label: string;
21
+ readonly points: ReadonlyArray<{
22
+ readonly x: number;
23
+ readonly y: number;
24
+ }>;
25
+ };
26
+ /** A place the reader should find, such as a minimum or a starting point. */
27
+ export type ContourMarker = {
28
+ readonly id: string;
29
+ readonly label: string;
30
+ readonly x: number;
31
+ readonly y: number;
32
+ };
33
+ export type ContourPlotProps = FigureProps & FigureSelectionProps & {
34
+ readonly grid: ContourGridInput;
35
+ /** The values to draw a line at, in increasing order. The application chooses them. */
36
+ readonly levels: ReadonlyArray<number>;
37
+ readonly x: PlotAxis;
38
+ readonly y: PlotAxis;
39
+ /** What the surface measures, such as a loss, and how its levels are written. */
40
+ readonly value: {
41
+ readonly label: string;
42
+ readonly format: ValueFormat;
43
+ };
44
+ readonly path?: ReadonlyArray<ContourPath> | undefined;
45
+ readonly markers?: ReadonlyArray<ContourMarker> | undefined;
46
+ readonly height?: PlotHeight | undefined;
47
+ };
48
+ export declare const contourLimits: {
49
+ readonly columns: 128;
50
+ readonly rows: 128;
51
+ readonly levels: 16;
52
+ readonly paths: 6;
53
+ readonly pointsPerPath: 2000;
54
+ readonly markers: 12;
55
+ };
56
+ /**
57
+ * Level lines of a surface the application sampled on a grid, such as a loss landscape. Each level is one line whose
58
+ * shade steps with its value, and a path or markers can be drawn over it. Use it to show where a measure is high or low
59
+ * across two inputs, with the grid, the levels and any path supplied by the application.
60
+ */
61
+ export declare function ContourPlot(props: ContourPlotProps): ReactNode;
@@ -0,0 +1,45 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ValueFormat } from '../figure/figure-format.ts';
3
+ import type { FigureProps } from '../figure/figure-props.ts';
4
+ import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
5
+ import type { NumericDomain } from '../plot/scale.ts';
6
+ /**
7
+ * A 2D histogram the application has binned: `columns` by `rows` cells over two domains, with one count per cell, row
8
+ * by row. Row 0 holds the lowest `y` values and column 0 the lowest `x` values. Cells divide each axis evenly in the
9
+ * axis's scale, and the `bin2d` transform returns this shape.
10
+ */
11
+ export type DensityHistogram = {
12
+ readonly columns: number;
13
+ readonly rows: number;
14
+ readonly counts: ReadonlyArray<number>;
15
+ readonly xDomain: NumericDomain;
16
+ readonly yDomain: NumericDomain;
17
+ };
18
+ export type DensityMapProps = FigureProps & {
19
+ readonly histogram: DensityHistogram;
20
+ /** The axes the histogram was binned on. Leave their domains out: the histogram's own domains are the axes. */
21
+ readonly x: PlotAxis;
22
+ readonly y: PlotAxis;
23
+ /** What each cell counts, with its unit, and how to write it: "Tokens". */
24
+ readonly count: {
25
+ readonly label: string;
26
+ readonly format: ValueFormat;
27
+ };
28
+ readonly height?: PlotHeight | undefined;
29
+ };
30
+ /**
31
+ * The largest histogram the map draws, and how many non-empty cells a reader steps through one by one. Beyond that
32
+ * many, the arrow keys step through rows instead.
33
+ */
34
+ export declare const densityLimits: {
35
+ readonly columns: 512;
36
+ readonly rows: 512;
37
+ readonly cellItems: 1024;
38
+ };
39
+ /**
40
+ * A 2D histogram as a grid of cells, darker where more items fall: where activations cluster across two features, how
41
+ * latency spreads against payload size. The application bins the data, and the map draws up to 512 by 512 cells on
42
+ * canvas. It names the exact count of the cell under the pointer or the keyboard cursor and keys its shades in a
43
+ * legend.
44
+ */
45
+ export declare function DensityMap(props: DensityMapProps): ReactNode;
@@ -0,0 +1,75 @@
1
+ import type { ChangeDetails } from '@ui-sdk/core';
2
+ import type { ReactNode } from 'react';
3
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
4
+ import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
5
+ import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
6
+ import type { DataRect } from '../plot/render/hit-index.ts';
7
+ import type { PointRenderer } from '../plot/render/point-layer.tsx';
8
+ /**
9
+ * The items of a map as plain columns, already projected by the application. The nth item sits at `x[n]`, `y[n]` and
10
+ * belongs to the group at index `group[n]`. The `ids` column names each item for the readout, or leave it out to number
11
+ * them.
12
+ */
13
+ export type EmbeddingPoints = {
14
+ readonly ids?: ReadonlyArray<string> | undefined;
15
+ readonly x: ReadonlyArray<number>;
16
+ readonly y: ReadonlyArray<number>;
17
+ readonly group: ReadonlyArray<number>;
18
+ };
19
+ /** A group of items, such as a cluster, a class or a source. Its hue marks its items and its legend entry. */
20
+ export type EmbeddingGroup = {
21
+ readonly id: string;
22
+ readonly label: string;
23
+ readonly tone?: ChartTone | undefined;
24
+ };
25
+ /** A named place on the map, drawn as a label: a cluster name, a probe or the item a reader is studying. */
26
+ export type EmbeddingLandmark = {
27
+ readonly id: string;
28
+ readonly label: string;
29
+ readonly x: number;
30
+ readonly y: number;
31
+ };
32
+ /**
33
+ * How the map draws its items. `auto` uses canvas 2D up to `embeddingLimits.canvasPoints` and WebGL beyond. Without
34
+ * WebGL the map draws with canvas 2D, a frame at a time, and says so.
35
+ */
36
+ export type EmbeddingRenderer = 'auto' | PointRenderer;
37
+ /** A rectangle on the map in data units, such as the area a reader drew. */
38
+ export type EmbeddingRange = DataRect;
39
+ /** Why the range changed, and how many items lie inside the requested range. */
40
+ export type EmbeddingRangeDetails = ChangeDetails<'drag' | 'clear-press' | 'trigger-press'> & {
41
+ readonly count: number;
42
+ };
43
+ export type EmbeddingMapProps = FigureProps & FigureSelectionProps & {
44
+ readonly points: EmbeddingPoints;
45
+ readonly groups: ReadonlyArray<EmbeddingGroup>;
46
+ /** The projection's axes. Both are linear; leave the domains out to fit the items. */
47
+ readonly x: PlotAxis;
48
+ readonly y: PlotAxis;
49
+ readonly landmarks?: ReadonlyArray<EmbeddingLandmark> | undefined;
50
+ readonly renderer?: EmbeddingRenderer | undefined;
51
+ /** The rectangle the reader drew, or null. Supply `onRangeChange` to let a drag draw one. */
52
+ readonly range?: EmbeddingRange | null | undefined;
53
+ readonly onRangeChange?: ((range: EmbeddingRange | null, details: EmbeddingRangeDetails) => void) | undefined;
54
+ /**
55
+ * Lets the reader pan and zoom: a drag pans, and a pinch or Control or Command with a scroll zooms. The keys `+`,
56
+ * `−` and `0` zoom from the keyboard, and Shift with a drag draws the range. A plain scroll always scrolls the
57
+ * page.
58
+ */
59
+ readonly isExplorable?: boolean | undefined;
60
+ readonly height?: PlotHeight | undefined;
61
+ };
62
+ /** The largest map each renderer draws, from draw times measured in headless Chromium. */
63
+ export declare const embeddingLimits: {
64
+ readonly canvasPoints: 100000;
65
+ readonly webglPoints: 1000000;
66
+ readonly groups: 12;
67
+ readonly landmarks: 200;
68
+ };
69
+ /**
70
+ * A map of up to a million points colored by group, already placed in two dimensions by the application, such as a UMAP
71
+ * of activations or embeddings. Readers step through the groups and named landmarks with the arrow keys, point at any
72
+ * item to read it, and draw a rectangle to count the items inside. Pass `coverage` when the points are a sample, and
73
+ * set `isExplorable` to let readers pan and zoom.
74
+ */
75
+ export declare function EmbeddingMap(props: EmbeddingMapProps): ReactNode;
@@ -0,0 +1,11 @@
1
+ export type { ContourGridInput, ContourMarker, ContourPath, ContourPlotProps } from './contour-plot.tsx';
2
+ export { ContourPlot, contourLimits } from './contour-plot.tsx';
3
+ export type { MeasureDimension, MeasureGroup, MeasureRow } from './measures.ts';
4
+ export type { AxisRangeReason, AxisRanges, ParallelCoordinatesProps } from './parallel-coordinates.tsx';
5
+ export { ParallelCoordinates, parallelLimits } from './parallel-coordinates.tsx';
6
+ export type { ScatterMatrixProps } from './scatter-matrix.tsx';
7
+ export { ScatterMatrix, scatterMatrixLimits } from './scatter-matrix.tsx';
8
+ export type { DensityHistogram, DensityMapProps } from './density-map.tsx';
9
+ export { DensityMap, densityLimits } from './density-map.tsx';
10
+ export type { EmbeddingGroup, EmbeddingLandmark, EmbeddingMapProps, EmbeddingPoints, EmbeddingRange, EmbeddingRangeDetails, EmbeddingRenderer, } from './embedding-map.tsx';
11
+ export { EmbeddingMap, embeddingLimits } from './embedding-map.tsx';
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ export type LevelLegendEntry = {
3
+ readonly id: string;
4
+ readonly text: string;
5
+ readonly color: string;
6
+ };
7
+ /** The values of the level lines, each beside a sample of its line, from the lowest level to the highest. */
8
+ export declare function LevelLegend({ label, entries, }: {
9
+ readonly label: string;
10
+ readonly entries: ReadonlyArray<LevelLegendEntry>;
11
+ }): ReactNode;
@@ -0,0 +1,85 @@
1
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
2
+ import type { ChartLegendItem } from '../chart-frame.tsx';
3
+ import type { ValueFormat } from '../figure/figure-format.ts';
4
+ import type { NumericDomain, ScaleType } from '../plot/scale.ts';
5
+ /** One measure the rows of a multi-measure chart are compared on. */
6
+ export type MeasureDimension = {
7
+ readonly id: string;
8
+ /** The measure's name with its unit: "Latency (ms)". */
9
+ readonly label: string;
10
+ readonly format: ValueFormat;
11
+ /** The values the measure spans. Leave it out to fit the supplied values on round bounds. */
12
+ readonly domain?: NumericDomain | undefined;
13
+ readonly scale?: ScaleType | undefined;
14
+ };
15
+ /** One thing measured, such as a model or a run, with a value for each measure. A null value was not recorded. */
16
+ export type MeasureRow = {
17
+ readonly id: string;
18
+ readonly label: string;
19
+ /** The id of the group the row belongs to. Groups give rows their hue. */
20
+ readonly group?: string | undefined;
21
+ readonly values: Readonly<Record<string, number | null>>;
22
+ };
23
+ /** A named set of rows. Its hue names the set in every mark and in the legend. */
24
+ export type MeasureGroup = {
25
+ readonly id: string;
26
+ readonly label: string;
27
+ readonly tone?: ChartTone | undefined;
28
+ };
29
+ /** A measure with the domain the chart resolved for it. */
30
+ export type MeasureAxis = MeasureDimension & {
31
+ readonly domain: NumericDomain;
32
+ };
33
+ export type MeasureLimits = {
34
+ readonly dimensions: number;
35
+ readonly rows: number;
36
+ };
37
+ /** The value a row holds for a measure, or null where none was recorded. */
38
+ export declare function measureValue(row: MeasureRow, dimension: Pick<MeasureDimension, 'id'>): number | null;
39
+ /** Gives every measure its domain: the declared one, or one fitted to the rows' values. */
40
+ export declare function resolveMeasureAxes({ dimensions, rows, }: {
41
+ readonly dimensions: ReadonlyArray<MeasureDimension>;
42
+ readonly rows: ReadonlyArray<MeasureRow>;
43
+ }): ReadonlyArray<MeasureAxis>;
44
+ /** The first reason rows cannot be drawn on these measures, or undefined. Nothing is clamped, dropped or reordered. */
45
+ export declare function measureInputError({ axes, rows, groups, limits, }: {
46
+ readonly axes: ReadonlyArray<MeasureAxis>;
47
+ readonly rows: ReadonlyArray<MeasureRow>;
48
+ readonly groups: ReadonlyArray<MeasureGroup>;
49
+ readonly limits: MeasureLimits;
50
+ }): string | undefined;
51
+ /** One chart item per row, in supplied order: its id and the sentence of its exact values. */
52
+ export declare function measureItems({ rows, axes, locale, groupLabel, consequence, }: {
53
+ readonly rows: ReadonlyArray<MeasureRow>;
54
+ readonly axes: ReadonlyArray<MeasureAxis>;
55
+ readonly locale: string;
56
+ readonly groupLabel: (row: MeasureRow) => string | undefined;
57
+ readonly consequence: string;
58
+ }): ReadonlyArray<{
59
+ readonly id: string;
60
+ readonly label: string;
61
+ }>;
62
+ /** The columns and rows of the hidden table that gives a screen reader every exact value. */
63
+ export declare function measureTable({ rows, axes, locale, }: {
64
+ readonly rows: ReadonlyArray<MeasureRow>;
65
+ readonly axes: ReadonlyArray<MeasureAxis>;
66
+ readonly locale: string;
67
+ }): {
68
+ readonly columns: ReadonlyArray<{
69
+ readonly id: string;
70
+ readonly label: string;
71
+ }>;
72
+ readonly rows: ReadonlyArray<{
73
+ readonly id: string;
74
+ readonly values: ReadonlyArray<string>;
75
+ }>;
76
+ };
77
+ /**
78
+ * The hue of each row and the legend that names them. Rows take their group's hue; with groups supplied, a row without
79
+ * one is gray, and with none every row shares the first hue.
80
+ */
81
+ export declare function useMeasureTones(groups: ReadonlyArray<MeasureGroup>): {
82
+ readonly toneOf: (row: MeasureRow) => ChartTone;
83
+ readonly groupLabel: (row: MeasureRow) => string | undefined;
84
+ readonly legend: ReadonlyArray<ChartLegendItem>;
85
+ };
@@ -0,0 +1,30 @@
1
+ import type { ChangeDetails } from '@ui-sdk/core';
2
+ import type { ReactNode } from 'react';
3
+ import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
4
+ import type { PlotHeight } from '../plot/plot-layout.ts';
5
+ import type { MeasureDimension, MeasureGroup, MeasureRow } from './measures.ts';
6
+ import type { AxisRangeReason, AxisRanges } from './range-controls.tsx';
7
+ export type { AxisRangeReason, AxisRanges } from './range-controls.tsx';
8
+ export type ParallelCoordinatesProps = FigureProps & FigureSelectionProps & {
9
+ /** The measures, two to twelve, left to right. Each gets its own vertical axis, domain, scale and ticks. */
10
+ readonly dimensions: ReadonlyArray<MeasureDimension>;
11
+ /** The things measured. Each is one polyline. A missing value breaks the line at that axis. */
12
+ readonly rows: ReadonlyArray<MeasureRow>;
13
+ /** Names the sets rows belong to. Each group takes a hue. Without groups every row shares one. */
14
+ readonly groups?: ReadonlyArray<MeasureGroup> | undefined;
15
+ /** The value range kept on each axis. Rows outside any range are drawn as gray context. */
16
+ readonly ranges?: AxisRanges | undefined;
17
+ /** Asks the application to keep a range. Without it the ranges can be shown but not changed. */
18
+ readonly onRangesChange?: ((ranges: AxisRanges, details: ChangeDetails<AxisRangeReason>) => void) | undefined;
19
+ readonly height?: PlotHeight | undefined;
20
+ };
21
+ export declare const parallelLimits: {
22
+ readonly dimensions: 12;
23
+ readonly rows: 500;
24
+ };
25
+ /**
26
+ * Many measures per item on parallel vertical axes, one line per row: the way to read a hyperparameter sweep. Drag on
27
+ * an axis, or type bounds under the plot, to keep a range; rows outside every range turn gray. Use it to find which
28
+ * settings go with a good result, with the ranges and any selected row held by the application.
29
+ */
30
+ export declare function ParallelCoordinates(props: ParallelCoordinatesProps): ReactNode;
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { MeasureAxis } from './measures.ts';
3
+ /** The value range kept on each axis, by dimension id. An axis with no entry keeps every value. */
4
+ export type AxisRanges = Readonly<Record<string, readonly [number, number]>>;
5
+ /** Why the ranges changed: a drag on an axis, a typed bound, or the clear button. */
6
+ export type AxisRangeReason = 'drag' | 'input' | 'clear-press';
7
+ export type RangeControlsProps = {
8
+ readonly axes: ReadonlyArray<MeasureAxis>;
9
+ readonly ranges: AxisRanges;
10
+ readonly locale: string;
11
+ /** How many rows lie inside every range. */
12
+ readonly matching: number;
13
+ readonly total: number;
14
+ readonly onChange: (ranges: AxisRanges, reason: AxisRangeReason) => void;
15
+ };
16
+ /**
17
+ * The same axis ranges a drag sets, as number inputs under the plot, for a keyboard, a touch screen or an agent. Each
18
+ * axis takes a minimum and a maximum inside its domain, and one button clears every range.
19
+ */
20
+ export declare function RangeControls({ axes, ranges, locale, matching, total, onChange }: RangeControlsProps): ReactNode;
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
3
+ import type { PlotHeight } from '../plot/plot-layout.ts';
4
+ import type { MeasureDimension, MeasureGroup, MeasureRow } from './measures.ts';
5
+ export type ScatterMatrixProps = FigureProps & FigureSelectionProps & {
6
+ /** The measures to compare, two to six. Every pair of them gets a panel. */
7
+ readonly dimensions: ReadonlyArray<MeasureDimension>;
8
+ /** The things measured, one dot per panel each. A row missing a value is left out of the panels that need it. */
9
+ readonly rows: ReadonlyArray<MeasureRow>;
10
+ /** Names the sets rows belong to. Each group takes a hue. */
11
+ readonly groups?: ReadonlyArray<MeasureGroup> | undefined;
12
+ /** The height of the largest panel. The matrix keeps its panels square and fits them to the width. */
13
+ readonly height?: PlotHeight | undefined;
14
+ };
15
+ export declare const scatterMatrixLimits: {
16
+ readonly dimensions: 6;
17
+ readonly rows: 500;
18
+ };
19
+ /** Every pair of a few measures as small scatter panels, the way a reader scans for what moves together. */
20
+ export declare function ScatterMatrix(props: ScatterMatrixProps): ReactNode;