@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,677 @@
1
+ import { n as e } from "../scale-C2xgZyZN.js";
2
+ import { a as t, c as n, d as r, f as i, h as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "../values-963L6n1m.js";
3
+ // packages/charts/src/transforms/bins.ts
4
+ var g = 10, ee = 5, _ = 2, v = 1e-9, y = {
5
+ bins: 1e3,
6
+ cells: 1e3
7
+ };
8
+ function b(e) {
9
+ let t = Math.floor(Math.log10(e)), n = e / g ** t, r = [
10
+ 1,
11
+ _,
12
+ ee
13
+ ].find((e) => n <= e * 1.000000001) ?? g;
14
+ return t < 0 ? r / g ** -t : r * g ** t;
15
+ }
16
+ function x(e, t) {
17
+ let n = Math.round(1 / t);
18
+ return t < 1 && Math.abs(n * t - 1) < v ? e / n : e * t;
19
+ }
20
+ function S(e, t) {
21
+ let n = Math.floor(e[0] / t + v), r = Math.max(n + 1, Math.ceil(e[1] / t - v));
22
+ return Array.from({ length: r - n + 1 }, (e, r) => x(n + r, t));
23
+ }
24
+ function te(e, t) {
25
+ let n = e[0] ?? 0, r = (e.at(-1) ?? n) - n, i = e.length - 1, a = Math.min(i - 1, Math.max(0, Math.floor((t - n) / r * i))), o = t < (e[a] ?? t), s = a < i - 1 && t >= (e[a + 1] ?? t);
26
+ return o ? a - 1 : s ? a + 1 : a;
27
+ }
28
+ function C(e) {
29
+ return Number.isFinite(e[0]) && Number.isFinite(e[1]) && e[1] > e[0] ? void 0 : "The domain must be two finite numbers, the first below the second.";
30
+ }
31
+ function w(t, n) {
32
+ let r = e(t);
33
+ return r === void 0 ? void 0 : S(r, b((r[1] > r[0] ? r[1] - r[0] : 1) / n));
34
+ }
35
+ function T(e, t) {
36
+ let n = w(e, t), r = n?.[0], i = n?.at(-1);
37
+ return r === void 0 || i === void 0 ? void 0 : [r, i];
38
+ }
39
+ function ne(t, n) {
40
+ let { domain: r } = t;
41
+ if (r === void 0) {
42
+ let r = e(n);
43
+ return t.binWidth === void 0 ? w(n, t.binCount) ?? "There are no values to bin." : r === void 0 ? "There are no values to bin." : S(r, t.binWidth);
44
+ }
45
+ let i = t.binWidth ?? (r[1] - r[0]) / t.binCount, a = Math.round((r[1] - r[0]) / i);
46
+ return Math.abs(a * i - (r[1] - r[0])) > v * (r[1] - r[0]) ? "The domain must span a whole number of bins of the given width." : Array.from({ length: a + 1 }, (e, t) => t === a ? r[1] : r[0] + t * i);
47
+ }
48
+ function re(e) {
49
+ let t = h(e.values), n = e.values.length - t.length;
50
+ if (e.binCount !== void 0 && !(Number.isInteger(e.binCount) && e.binCount >= 1)) return o("The bin count must be a whole number of at least 1.");
51
+ if (e.binWidth !== void 0 && !(Number.isFinite(e.binWidth) && e.binWidth > 0)) return o("The bin width must be a positive number.");
52
+ let r = e.domain === void 0 ? void 0 : C(e.domain);
53
+ if (r !== void 0) return o(r);
54
+ let i = ne(e, t);
55
+ if (typeof i == "string") return o(i);
56
+ if (i.length - 1 > y.bins) return o(`Binning makes at most ${y.bins} bins. Use a wider bin or a narrower domain.`);
57
+ let s = i[0] ?? 0, c = i.at(-1) ?? s, l = t.filter((e) => e >= s && e <= c), u = a(l.map((e) => te(i, e)), i.length - 1), d = new Intl.NumberFormat(e.locale, e.format);
58
+ return {
59
+ kind: "ok",
60
+ bins: u.map((e, t) => {
61
+ let n = i[t] ?? s, r = i[t + 1] ?? c;
62
+ return {
63
+ id: `bin-${t}`,
64
+ label: `${d.format(n)}–${d.format(r)}`,
65
+ lowerBound: n,
66
+ upperBound: r,
67
+ count: e
68
+ };
69
+ }),
70
+ binWidth: (c - s) / (i.length - 1),
71
+ domain: [s, c],
72
+ skipped: n,
73
+ outside: t.length - l.length
74
+ };
75
+ }
76
+ function ie({ result: e, locale: t }) {
77
+ let r = u({
78
+ count: e.skipped,
79
+ locale: t
80
+ }), i = u({
81
+ count: e.outside,
82
+ noun: {
83
+ one: "value",
84
+ other: "values"
85
+ },
86
+ reason: "outside the domain left out",
87
+ locale: t
88
+ });
89
+ return `Counted in ${e.bins.length} bins of width ${n(e.binWidth, t)}.${r}${i}`;
90
+ }
91
+ function E(e, t, n) {
92
+ return Math.min(n - 1, Math.floor((e - t[0]) / (t[1] - t[0]) * n));
93
+ }
94
+ function ae({ x: e, y: t, columns: n, rows: r, xDomain: i, yDomain: s }) {
95
+ if (e.length !== t.length) return o("The x and y lists must have the same length.");
96
+ if (![n, r].every((e) => Number.isInteger(e) && e >= 1 && e <= y.cells)) return o(`Columns and rows must be whole numbers from 1 to ${y.cells}.`);
97
+ let c = e.flatMap((e, n) => {
98
+ let r = t[n] ?? null;
99
+ return e === null || r === null ? [] : Number.isFinite(e) && Number.isFinite(r) ? [{
100
+ x: e,
101
+ y: r
102
+ }] : [];
103
+ }), l = i ?? T(c.map((e) => e.x), n), u = s ?? T(c.map((e) => e.y), r);
104
+ if (l === void 0 || u === void 0) return o("There are no points to bin.");
105
+ let d = C(l) ?? C(u);
106
+ if (d !== void 0) return o(d);
107
+ let f = c.filter((e) => {
108
+ let t = e.x >= l[0] && e.x <= l[1], n = e.y >= u[0] && e.y <= u[1];
109
+ return t && n;
110
+ }), p = f.map((e) => E(e.y, u, r) * n + E(e.x, l, n));
111
+ return {
112
+ kind: "ok",
113
+ columns: n,
114
+ rows: r,
115
+ counts: a(p, n * r),
116
+ xDomain: l,
117
+ yDomain: u,
118
+ skipped: e.length - c.length,
119
+ outside: c.length - f.length
120
+ };
121
+ }
122
+ function oe({ result: e, locale: t }) {
123
+ let n = u({
124
+ count: e.skipped,
125
+ noun: {
126
+ one: "point with a missing value",
127
+ other: "points with missing values"
128
+ },
129
+ reason: "skipped",
130
+ locale: t
131
+ }), r = u({
132
+ count: e.outside,
133
+ noun: {
134
+ one: "point",
135
+ other: "points"
136
+ },
137
+ reason: "outside the domain left out",
138
+ locale: t
139
+ });
140
+ return `Counted in a ${e.columns} × ${e.rows} grid.${n}${r}`;
141
+ }
142
+ // packages/charts/src/transforms/quantiles.ts
143
+ var se = .5, ce = .25, le = .75, ue = 1.5;
144
+ function D(e, t) {
145
+ if (e.length === 0 || !(t >= 0 && t <= 1)) return null;
146
+ let n = (e.length - 1) * t, r = e[Math.floor(n)], i = e[Math.ceil(n)];
147
+ return r === void 0 || i === void 0 ? null : r + (n - Math.floor(n)) * (i - r);
148
+ }
149
+ function de(e, t) {
150
+ return D(i(e), t);
151
+ }
152
+ function O(e) {
153
+ let t = i(e), n = D(t, ce), r = D(t, se), a = D(t, le), s = t[0], c = t.at(-1);
154
+ return n === null || r === null || a === null || s === void 0 || c === void 0 ? o("There are no values to summarize.") : {
155
+ kind: "ok",
156
+ summary: {
157
+ min: s,
158
+ q1: n,
159
+ median: r,
160
+ q3: a,
161
+ max: c,
162
+ count: t.length
163
+ },
164
+ skipped: e.length - t.length
165
+ };
166
+ }
167
+ function k({ values: e, whisker: t }) {
168
+ let n = O(e);
169
+ if (n.kind === "invalid") return n;
170
+ let { min: r, q1: a, median: o, q3: s, max: c, count: l } = n.summary, u = t === "tukey" ? ue * (s - a) : Infinity, d = i(e), f = d.filter((e) => e >= a - u && e <= s + u);
171
+ return {
172
+ kind: "ok",
173
+ summary: {
174
+ low: f[0] ?? r,
175
+ q1: a,
176
+ median: o,
177
+ q3: s,
178
+ high: f.at(-1) ?? c,
179
+ outliers: d.filter((e) => e < a - u || e > s + u),
180
+ count: l
181
+ },
182
+ whisker: t,
183
+ skipped: n.skipped
184
+ };
185
+ }
186
+ var A = {
187
+ tukey: "Boxes show quartiles (linear interpolation); whiskers reach 1.5 × IQR (Tukey); points beyond are outliers.",
188
+ range: "Boxes show quartiles (linear interpolation); whiskers reach the smallest and largest values."
189
+ };
190
+ function j({ result: e, locale: t }) {
191
+ let n = u({
192
+ count: e.skipped,
193
+ locale: t
194
+ });
195
+ return `${A[e.whisker]}${n}`;
196
+ }
197
+ function M(e) {
198
+ let t = i(e);
199
+ return t.length === 0 ? o("There are no values to accumulate.") : {
200
+ kind: "ok",
201
+ points: t.flatMap((e, n) => t[n + 1] === e ? [] : [{
202
+ id: `value-${n}`,
203
+ value: e,
204
+ probability: (n + 1) / t.length
205
+ }]),
206
+ count: t.length,
207
+ skipped: e.length - t.length
208
+ };
209
+ }
210
+ function N({ result: e, locale: t }) {
211
+ let r = u({
212
+ count: e.skipped,
213
+ locale: t
214
+ });
215
+ return `Empirical cumulative share of ${n(e.count, t)} values.${r}`;
216
+ }
217
+ // packages/charts/src/transforms/density.ts
218
+ var P = .9, F = 1.34, I = -.2, L = .25, R = .75, z = 1 / Math.sqrt(Math.PI + Math.PI), B = 2, V = 3, H = {
219
+ pointsDefault: 128,
220
+ pointsMin: 2,
221
+ pointsMax: 2e3
222
+ };
223
+ function U(e) {
224
+ let t = i(e), n = t.length < B ? 0 : Math.sqrt(d(t) / (t.length - 1)), r = ((D(t, R) ?? 0) - (D(t, L) ?? 0)) / F, a = r > 0 ? Math.min(n, r) : n;
225
+ return a > 0 ? P * a * t.length ** I : null;
226
+ }
227
+ function fe({ values: e, points: n = H.pointsDefault, bandwidth: r, domain: a }) {
228
+ let s = i(e);
229
+ if (s.length === 0) return o("There are no values to estimate a density from.");
230
+ if (!t(n, [H.pointsMin, H.pointsMax])) return o(`The point count must be a whole number from ${H.pointsMin} to ${H.pointsMax}.`);
231
+ if (r !== void 0 && !(Number.isFinite(r) && r > 0)) return o("The bandwidth must be a positive number.");
232
+ let l = r ?? U(s);
233
+ if (l === null) return o("The values do not vary, so Silverman’s rule gives no bandwidth. Supply one.");
234
+ let u = s[0] ?? 0, d = s.at(-1) ?? 0, [f, p] = a ?? [u - V * l, d + V * l];
235
+ if (!(Number.isFinite(f) && Number.isFinite(p) && p > f)) return o("The domain must be two finite numbers, the first below the second.");
236
+ let m = z / (s.length * l);
237
+ return {
238
+ kind: "ok",
239
+ curve: Array.from({ length: n }, (e, t) => {
240
+ let r = f + (p - f) * t / (n - 1), i = s.map((e) => {
241
+ let t = (r - e) / l;
242
+ return Math.exp(-.5 * t * t);
243
+ });
244
+ return {
245
+ value: r,
246
+ density: m * c(i)
247
+ };
248
+ }),
249
+ bandwidth: l,
250
+ isRuleOfThumb: r === void 0,
251
+ count: s.length,
252
+ skipped: e.length - s.length
253
+ };
254
+ }
255
+ function pe({ result: e, locale: t }) {
256
+ let r = e.isRuleOfThumb ? " (Silverman’s rule)" : "";
257
+ return `Gaussian kernel density, bandwidth ${n(e.bandwidth, t)}${r}.${u({
258
+ count: e.skipped,
259
+ locale: t
260
+ })}`;
261
+ }
262
+ // packages/charts/src/transforms/fits.ts
263
+ var me = 2;
264
+ function W(e) {
265
+ if (e.length < me) return "A fit needs at least two points with values.";
266
+ let t = p(e.map((e) => e.x)), n = p(e.map((e) => e.y)), r = c(e.map((e) => (e.x - t) * (e.x - t)));
267
+ if (r === 0) return "A fit needs points at two or more different x values.";
268
+ let i = c(e.map((e) => (e.x - t) * (e.y - n))) / r, a = n - i * t, o = c(e.map((e) => (e.y - n) * (e.y - n))), s = c(e.map((e) => {
269
+ let t = e.y - (a + i * e.x);
270
+ return t * t;
271
+ }));
272
+ return {
273
+ slope: i,
274
+ intercept: a,
275
+ rSquared: o === 0 ? null : 1 - s / o
276
+ };
277
+ }
278
+ function he(e) {
279
+ let t = s(e), n = W(t);
280
+ return typeof n == "string" ? o(n) : {
281
+ kind: "ok",
282
+ ...n,
283
+ fitted: m(t.map((e) => e.x)).map((e) => ({
284
+ x: e,
285
+ y: n.intercept + n.slope * e
286
+ })),
287
+ count: t.length,
288
+ skipped: e.length - t.length
289
+ };
290
+ }
291
+ function G(e, t) {
292
+ return e === null ? "" : `, r² ${n(e, t)}`;
293
+ }
294
+ function ge({ result: e, locale: t }) {
295
+ return `Least-squares line, slope ${n(e.slope, t)}${G(e.rSquared, t)}.`;
296
+ }
297
+ function _e(e) {
298
+ let t = s(e), n = t.find((e) => e.x <= 0 || e.y <= 0);
299
+ if (n !== void 0) return o(`A power-law fit needs positive x and y; the point at x = ${n.x} is not.`);
300
+ let r = W(t.map((e) => ({
301
+ x: Math.log(e.x),
302
+ y: Math.log(e.y)
303
+ })));
304
+ if (typeof r == "string") return o(r);
305
+ let i = Math.exp(r.intercept);
306
+ return {
307
+ kind: "ok",
308
+ exponent: r.slope,
309
+ coefficient: i,
310
+ rSquared: r.rSquared,
311
+ fitted: m(t.map((e) => e.x)).map((e) => ({
312
+ x: e,
313
+ y: i * e ** r.slope
314
+ })),
315
+ count: t.length,
316
+ skipped: e.length - t.length
317
+ };
318
+ }
319
+ function ve({ result: e, locale: t }) {
320
+ return `Power-law fit by least squares in log-log space, exponent ${n(e.exponent, t)}${G(e.rSquared, t)}.`;
321
+ }
322
+ // packages/charts/src/transforms/matrices.ts
323
+ var ye = 2;
324
+ function K({ rowId: e, columnId: t }) {
325
+ return [e, t].join(":");
326
+ }
327
+ function be(e, t) {
328
+ return e.flatMap((e, n) => {
329
+ let r = t[n] ?? null;
330
+ return e === null || r === null ? [] : Number.isFinite(e) && Number.isFinite(r) ? [[e, r]] : [];
331
+ });
332
+ }
333
+ function xe(e) {
334
+ if (e.length < ye) return "Fewer than two shared observations";
335
+ let t = p(e.map(([e]) => e)), n = p(e.map(([, e]) => e)), r = c(e.map(([e]) => (e - t) * (e - t))), i = c(e.map(([, e]) => (e - n) * (e - n)));
336
+ if (r === 0 || i === 0) return "A column does not vary";
337
+ let a = c(e.map(([e, r]) => (e - t) * (r - n)));
338
+ return Math.max(-1, Math.min(1, a / Math.sqrt(r * i)));
339
+ }
340
+ function Se({ columns: e }) {
341
+ let t = Object.entries(e), n = t[0]?.[1].length ?? 0;
342
+ return t.length === 0 ? o("There are no columns to correlate.") : t.some(([, e]) => e.length !== n) ? o("Every column must have the same number of rows.") : {
343
+ kind: "ok",
344
+ cells: t.flatMap(([e, n]) => t.map(([t, r]) => {
345
+ let i = xe(be(n, r)), a = K({
346
+ rowId: e,
347
+ columnId: t
348
+ });
349
+ return typeof i == "string" ? {
350
+ id: a,
351
+ rowId: e,
352
+ columnId: t,
353
+ kind: "missing",
354
+ reason: i
355
+ } : {
356
+ id: a,
357
+ rowId: e,
358
+ columnId: t,
359
+ kind: "value",
360
+ value: i
361
+ };
362
+ })),
363
+ columnCount: t.length,
364
+ rowCount: n
365
+ };
366
+ }
367
+ function Ce({ result: e, locale: t }) {
368
+ return `Pearson correlation of ${n(e.columnCount, t)} columns over ${n(e.rowCount, t)} rows, pairwise-complete observations.`;
369
+ }
370
+ function we({ actual: e, predicted: t, classes: n }) {
371
+ if (e.length !== t.length) return o("The actual and predicted lists must have the same length.");
372
+ if (n.length === 0 || !f(n)) return o("The classes must be a non-empty list of distinct ids.");
373
+ let r = new Set(n), i = e.flatMap((e, n) => {
374
+ let r = t[n] ?? null;
375
+ return e === null || r === null ? [] : [{
376
+ truth: e,
377
+ guess: r
378
+ }];
379
+ }), a = i.find((e) => !r.has(e.truth) || !r.has(e.guess));
380
+ if (a !== void 0) return o(`The class ${r.has(a.truth) ? a.guess : a.truth} is not in the class list.`);
381
+ let s = Map.groupBy(i, (e) => `${e.truth}\u0000${e.guess}`);
382
+ return {
383
+ kind: "ok",
384
+ cells: n.flatMap((e) => n.map((t) => ({
385
+ id: K({
386
+ rowId: e,
387
+ columnId: t
388
+ }),
389
+ rowId: e,
390
+ columnId: t,
391
+ kind: "value",
392
+ value: s.get(`${e}\u0000${t}`)?.length ?? 0
393
+ }))),
394
+ counted: i.length,
395
+ skipped: e.length - i.length
396
+ };
397
+ }
398
+ function Te({ result: e, locale: t }) {
399
+ let r = u({
400
+ count: e.skipped,
401
+ noun: {
402
+ one: "example without a class",
403
+ other: "examples without a class"
404
+ },
405
+ reason: "skipped",
406
+ locale: t
407
+ });
408
+ return `Counts of ${n(e.counted, t)} examples by actual and predicted class.${r}`;
409
+ }
410
+ // packages/charts/src/transforms/ranks.ts
411
+ function Ee({ items: e, stages: t, order: n = "descending" }) {
412
+ if (!f(e.map((e) => e.id))) return o("Every item must have a distinct id.");
413
+ if (!f(t)) return o("Every stage must have a distinct id.");
414
+ let r = n === "descending" ? -1 : 1, i = new Map(t.map((t) => {
415
+ let n = e.flatMap((e) => {
416
+ let n = l(e.values[t]);
417
+ return n === null ? [] : [{
418
+ id: e.id,
419
+ value: n
420
+ }];
421
+ }).toSorted((e, t) => r * (e.value - t.value));
422
+ return [t, new Map(n.map((e, t) => [e.id, t + 1]))];
423
+ }));
424
+ return {
425
+ kind: "ok",
426
+ items: e.map((e) => ({
427
+ id: e.id,
428
+ ranks: t.map((t) => ({
429
+ stageId: t,
430
+ rank: i.get(t)?.get(e.id) ?? null,
431
+ value: l(e.values[t])
432
+ }))
433
+ })),
434
+ order: n,
435
+ stageCount: t.length
436
+ };
437
+ }
438
+ var De = {
439
+ descending: "highest first",
440
+ ascending: "lowest first"
441
+ };
442
+ function Oe({ result: e, locale: t }) {
443
+ return `Ranked by value at each of ${n(e.stageCount, t)} stages, ${De[e.order]}; ties keep the listed order.`;
444
+ }
445
+ // packages/charts/src/transforms/runs.ts
446
+ var ke = .5;
447
+ function Ae({ runs: e, lower: t, upper: n, minimumRuns: r = e.length }) {
448
+ if (e.length === 0) return o("There are no runs to summarize.");
449
+ if (!(t >= 0 && n <= 1 && t <= n)) return o("The band quantiles must lie from 0 to 1, lower first.");
450
+ if (!(Number.isInteger(r) && r >= 1 && r <= e.length)) return o(`The minimum number of runs must be a whole number from 1 to ${e.length}.`);
451
+ let i = e.map((e) => ({
452
+ id: e.id,
453
+ points: s(e.points)
454
+ })), a = i.find((e) => !f(e.points.map((e) => String(e.x))));
455
+ if (a !== void 0) return o(`Run ${a.id} reports the same step more than once.`);
456
+ let c = [...Map.groupBy(i.flatMap((e) => e.points), (e) => e.x).entries()].toSorted(([e], [t]) => e - t), l = c.flatMap(([e, i]) => {
457
+ let a = i.map((e) => e.y).toSorted((e, t) => e - t), o = D(a, ke), s = D(a, t), c = D(a, n), l = o !== null && s !== null && c !== null;
458
+ return a.length < r || !l ? [] : [{
459
+ x: e,
460
+ center: o,
461
+ lower: s,
462
+ upper: c
463
+ }];
464
+ });
465
+ return {
466
+ kind: "ok",
467
+ points: l,
468
+ lower: t,
469
+ upper: n,
470
+ runCount: e.length,
471
+ minimumRuns: r,
472
+ skippedSteps: c.length - l.length
473
+ };
474
+ }
475
+ function je({ result: e, locale: t }) {
476
+ let r = u({
477
+ count: e.skippedSteps,
478
+ noun: {
479
+ one: "step",
480
+ other: "steps"
481
+ },
482
+ reason: `with fewer than ${n(e.minimumRuns, t)} runs left out`,
483
+ locale: t
484
+ }), i = `${n(e.lower, t)} to ${n(e.upper, t)}`;
485
+ return `Median of ${n(e.runCount, t)} runs; band spans quantiles ${i}.${r}`;
486
+ }
487
+ // packages/charts/src/transforms/sampling.ts
488
+ var q = 3, J = 2, Y = 2147483647, Me = 48271;
489
+ function Ne(e) {
490
+ let t = e.map((e) => l(e.y) === null), n = t.flatMap((e, n) => n === 0 || e !== t[n - 1] ? [n] : []);
491
+ return n.map((r, i) => ({
492
+ start: r,
493
+ end: n[i + 1] ?? e.length,
494
+ isGap: t[r] ?? !1
495
+ }));
496
+ }
497
+ function Pe(e, t, n) {
498
+ return Math.abs((e.x - n.x) * (t.y - e.y) - (e.x - t.x) * (n.y - e.y));
499
+ }
500
+ function Fe(e, t) {
501
+ let n = (e.length - J) / (t - J);
502
+ function i(e) {
503
+ return Math.floor(e * n) + 1;
504
+ }
505
+ return [
506
+ 0,
507
+ ...r({
508
+ items: Array.from({ length: t - J }, (e, t) => t),
509
+ initial: 0,
510
+ step: (t, n) => {
511
+ let a = e.slice(i(n + 1), Math.min(i(n + J), e.length)), o = {
512
+ x: p(a.map((e) => e.x)),
513
+ y: p(a.map((e) => e.y))
514
+ }, s = e[t] ?? o, c = e.slice(i(n), i(n + 1)).map((e) => Pe(s, e, o)), l = r({
515
+ items: c,
516
+ initial: 0,
517
+ step: (e, t, n) => t > (c[e] ?? t) ? n : e
518
+ });
519
+ return i(n) + (l.at(-1) ?? 0);
520
+ }
521
+ }),
522
+ e.length - 1
523
+ ];
524
+ }
525
+ function Ie({ points: e, target: t, unit: n = "points" }) {
526
+ if (!(Number.isInteger(t) && t >= q)) return o(`The target must be a whole number of at least ${q} points.`);
527
+ if (e.some((t, n) => !Number.isFinite(t.x) || t.x < (e[n - 1]?.x ?? t.x))) return o("Every x must be a finite number, and no x may be below the one before it.");
528
+ if (e.length <= t) return {
529
+ kind: "ok",
530
+ points: e.map((e) => ({
531
+ x: e.x,
532
+ y: l(e.y)
533
+ })),
534
+ coverage: {
535
+ shown: e.length,
536
+ total: e.length,
537
+ unit: n
538
+ }
539
+ };
540
+ let r = Ne(e), i = e.filter((e) => l(e.y) !== null).length, a = Math.max(0, t - r.filter((e) => e.isGap).length), c = r.flatMap((t) => {
541
+ let n = e[t.start];
542
+ if (t.isGap) return n === void 0 ? [] : [{
543
+ x: n.x,
544
+ y: null
545
+ }];
546
+ let r = s(e.slice(t.start, t.end)), o = Math.min(r.length, Math.max(J, Math.round(a * r.length / i)));
547
+ return o >= r.length ? r : (o < q ? [0, r.length - 1] : Fe(r, o)).flatMap((e) => r.slice(e, e + 1));
548
+ });
549
+ return {
550
+ kind: "ok",
551
+ points: c,
552
+ coverage: {
553
+ shown: c.length,
554
+ total: e.length,
555
+ unit: n
556
+ }
557
+ };
558
+ }
559
+ function X({ coverage: e, locale: t, method: r }) {
560
+ let i = n(e.shown, t), a = n(e.total, t);
561
+ return e.shown === e.total ? `All ${a} ${e.unit} shown.` : `${i} of ${a} ${e.unit} shown (${r}).`;
562
+ }
563
+ function Z({ result: e, locale: t }) {
564
+ return X({
565
+ coverage: e.coverage,
566
+ locale: t,
567
+ method: "largest triangle three buckets"
568
+ });
569
+ }
570
+ function Le({ result: e, locale: t }) {
571
+ let n = e.seed === null ? "evenly spaced" : `random sample, seed ${e.seed}`;
572
+ return X({
573
+ coverage: e.coverage,
574
+ locale: t,
575
+ method: n
576
+ });
577
+ }
578
+ function Q(e, t) {
579
+ return Number.isInteger(e) && e >= 0 ? Number.isInteger(t) && t >= 1 ? void 0 : "The target must be a whole number of at least 1." : "The count must be a whole number of at least 0.";
580
+ }
581
+ function Re({ count: e, target: t, unit: n = "points" }) {
582
+ let r = Q(e, t);
583
+ if (r !== void 0) return o(r);
584
+ let i = Math.min(e, t);
585
+ return {
586
+ kind: "ok",
587
+ indices: i === e ? Array.from({ length: e }, (e, t) => t) : Array.from({ length: i }, (t, n) => i === 1 ? 0 : Math.round(n * (e - 1) / (i - 1))),
588
+ coverage: {
589
+ shown: i,
590
+ total: e,
591
+ unit: n
592
+ },
593
+ seed: null
594
+ };
595
+ }
596
+ function $({ seed: e, count: t }) {
597
+ let n = (e % Y + Y) % Y;
598
+ return r({
599
+ items: Array.from({ length: t }, (e, t) => t),
600
+ initial: n === 0 ? 1 : n,
601
+ step: (e) => e * Me % Y
602
+ }).map((e) => e / Y);
603
+ }
604
+ function ze({ count: e, target: t, seed: n, unit: r = "points" }) {
605
+ let i = Q(e, t) ?? (Number.isInteger(n) ? void 0 : "The seed must be a whole number.");
606
+ if (i !== void 0) return o(i);
607
+ let a = $({
608
+ seed: n,
609
+ count: e
610
+ }).map((e, t) => ({
611
+ index: t,
612
+ key: e
613
+ })).toSorted((e, t) => e.key === t.key ? e.index - t.index : e.key - t.key).slice(0, t).map((e) => e.index).toSorted((e, t) => e - t);
614
+ return {
615
+ kind: "ok",
616
+ indices: a,
617
+ coverage: {
618
+ shown: a.length,
619
+ total: e,
620
+ unit: r
621
+ },
622
+ seed: n
623
+ };
624
+ }
625
+ // packages/charts/src/transforms/smoothing.ts
626
+ function Be({ points: e, size: t }) {
627
+ return Number.isInteger(t) && t >= 1 ? {
628
+ kind: "ok",
629
+ points: e.map((n, r) => {
630
+ let i = h(e.slice(Math.max(0, r - t + 1), r + 1).map((e) => e.y));
631
+ return {
632
+ x: n.x,
633
+ y: l(n.y) === null ? null : p(i)
634
+ };
635
+ }),
636
+ size: t
637
+ } : o("The window size must be a whole number of at least 1 point.");
638
+ }
639
+ function Ve({ result: e, locale: t }) {
640
+ return `Trailing mean over ${n(e.size, t)} points.`;
641
+ }
642
+ function He({ points: e, weight: t }) {
643
+ if (!(t >= 0 && t < 1)) return o("The smoothing weight must be at least 0 and below 1.");
644
+ let n = r({
645
+ items: e,
646
+ initial: {
647
+ total: 0,
648
+ observed: 0,
649
+ y: null
650
+ },
651
+ step: (e, n) => {
652
+ let r = l(n.y);
653
+ if (r === null) return {
654
+ ...e,
655
+ y: null
656
+ };
657
+ let i = e.total * t + (1 - t) * r, a = e.observed + 1;
658
+ return {
659
+ total: i,
660
+ observed: a,
661
+ y: i / (1 - t ** a)
662
+ };
663
+ }
664
+ });
665
+ return {
666
+ kind: "ok",
667
+ points: e.map((e, t) => ({
668
+ x: e.x,
669
+ y: n[t]?.y ?? null
670
+ })),
671
+ weight: t
672
+ };
673
+ }
674
+ function Ue({ result: e, locale: t }) {
675
+ return `Exponential moving average, weight ${n(e.weight, t)}, debiased.`;
676
+ }
677
+ export { ae as bin2d, y as binLimits, re as binValues, k as boxSummary, we as confusionCounts, Se as correlationMatrix, H as densityLimits, oe as describeBin2d, ie as describeBins, j as describeBoxSummary, Te as describeConfusion, Ce as describeCorrelation, Z as describeDownsample, N as describeEcdf, Ue as describeExponentialSmoothing, pe as describeKernelDensity, ge as describeLinearFit, Ve as describeMovingAverage, ve as describePowerLawFit, Oe as describeRanks, je as describeRunSummary, Le as describeSample, Ie as downsample, M as ecdfPoints, He as exponentialSmoothing, O as fiveNumberSummary, fe as kernelDensity, he as linearFit, Be as movingAverage, _e as powerLawFit, de as quantile, Ee as rankSeries, ze as reservoirIndices, Re as sampleEvenly, $ as seededUniforms, U as silvermanBandwidth, Ae as summarizeRuns };
@@ -0,0 +1 @@
1
+ export { l as BumpChart, s as CurveChart, a as HorizonChart, r as RunsChart, t as SlopeChart, u as bumpLimits, c as curveLimits, o as horizonLimits, i as runsLimits, n as slopeLimits } from "../slope-chart-BKVEAVCs.js";
package/dist/charts.js CHANGED
@@ -1,3 +1,8 @@
1
- import { i as e, n as t, t as n } from "./chart-frame-BaxKn_MB.js";
2
- import { c as r, l as i } from "./src-DVHlknB6.js";
3
- export { n as ChartFrame, t as ChartLegend, e as ChartSeriesMarker, r as chartToneColors, i as chartToneOutlines };
1
+ import { n as e, t } from "./chart-tones-ei3BC2AL.js";
2
+ import { C as n, b as r, c as i, x as a } from "./plot-layout-CZVSJ-le.js";
3
+ import { r as o } from "./categorical-values-BpVq8cFj.js";
4
+ import { i as s, n as c, t as l } from "./chart-link-AE_xuxiP.js";
5
+ import { i as u, t as d } from "./tone-scope-DKiSw-JR.js";
6
+ import { t as f } from "./src-DIS0YOj0.js";
7
+ import { i as p, n as m, r as h, t as g } from "./figure-format-B8kRZMlo.js";
8
+ export { r as ChartFrame, f as ChartGrid, a as ChartLegend, l as ChartLink, n as ChartSeriesMarker, g as MISSING_VALUE_TEXT, d as ToneScope, o as categoricalLimits, t as chartToneColors, e as chartToneOutlines, m as formatTime, h as formatValue, i as plotHeights, p as tickFormat, c as useChartLinkControl, s as useLinkedInspection, u as useScopedTone };
@@ -0,0 +1,16 @@
1
+ // packages/teaching/src/time/clock.ts
2
+ function e() {
3
+ let e = /* @__PURE__ */ new Set(), t = { isRunning: !1 };
4
+ function n(r) {
5
+ for (let t of e) t(r);
6
+ e.size === 0 ? t.isRunning = !1 : requestAnimationFrame(n);
7
+ }
8
+ return (r) => (e.add(r), t.isRunning || (t.isRunning = !0, requestAnimationFrame(n)), () => {
9
+ e.delete(r);
10
+ });
11
+ }
12
+ var t = e();
13
+ function n() {
14
+ return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
15
+ }
16
+ export { t as n, n as t };