@mechane-ai/elements 0.45.0 → 0.47.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 (340) hide show
  1. package/README.md +353 -50
  2. package/bin/mechane-elements-catalog.mjs +42 -4
  3. package/dist/ai.js +268 -202
  4. package/dist/catalog.json +2480 -71
  5. package/dist/categorical-values-DdfGIowV.js +107 -0
  6. package/dist/cells--Bd1fQFR.js +384 -0
  7. package/dist/chart-cursor-1mFd48Jc.js +23 -0
  8. package/dist/chart-link-AE_xuxiP.js +35 -0
  9. package/dist/chart-tones-ei3BC2AL.js +27 -0
  10. package/dist/charts/cartesian.js +1 -2792
  11. package/dist/charts/cells.js +1 -0
  12. package/dist/charts/comparison.js +1 -0
  13. package/dist/charts/distribution.js +1 -709
  14. package/dist/charts/figure.js +3404 -0
  15. package/dist/charts/graph.js +1 -641
  16. package/dist/charts/hierarchy.js +1 -112
  17. package/dist/charts/image.js +1 -0
  18. package/dist/charts/matrix.js +3 -637
  19. package/dist/charts/plot.js +15 -0
  20. package/dist/charts/relationship.js +1 -0
  21. package/dist/charts/text.js +1 -0
  22. package/dist/charts/timeline.js +1 -233
  23. package/dist/charts/transforms.js +677 -0
  24. package/dist/charts/trend.js +1 -0
  25. package/dist/charts.js +8 -3
  26. package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
  27. package/dist/collections.js +1 -1735
  28. package/dist/color-legend-CIo7DhXB.js +62 -0
  29. package/dist/content/code.js +1 -1
  30. package/dist/content/diff.js +67 -66
  31. package/dist/content/link.js +1 -1
  32. package/dist/content/markdown.js +2 -2
  33. package/dist/content/tree.js +2 -2
  34. package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
  35. package/dist/content.js +1 -1
  36. package/dist/csp.js +6 -11
  37. package/dist/dates-Cww8UR_n.js +810 -0
  38. package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
  39. package/dist/embedding-map-CGM_k6lC.js +1929 -0
  40. package/dist/feedback.js +1 -1
  41. package/dist/figure-format-B8kRZMlo.js +36 -0
  42. package/dist/figure-frame-wRkIEAwe.js +270 -0
  43. package/dist/forms/dates.js +1 -750
  44. package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
  45. package/dist/forms.js +3 -3
  46. package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
  47. package/dist/image-grid-CVA4SOy_.js +598 -0
  48. package/dist/index.js +1 -1
  49. package/dist/kits/evaluation.js +431 -0
  50. package/dist/kits/explainers.js +452 -0
  51. package/dist/kits/interpretability.js +1033 -0
  52. package/dist/kits/operations.js +239 -0
  53. package/dist/kits/training.js +335 -0
  54. package/dist/label-place-Z0fryBZb.js +42 -0
  55. package/dist/layout.js +207 -207
  56. package/dist/locate-Bcg3QcP4.js +11 -0
  57. package/dist/navigation.js +4 -3
  58. package/dist/packages/ai/src/conversation.d.ts +2 -0
  59. package/dist/packages/ai/src/prompt-input.d.ts +7 -2
  60. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
  61. package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
  62. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
  63. package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
  64. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
  65. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
  66. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
  67. package/dist/packages/charts/src/cartesian/index.d.ts +6 -5
  68. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
  69. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +37 -26
  70. package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
  71. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
  72. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
  73. package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
  74. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
  75. package/dist/packages/charts/src/cartesian/time-series.d.ts +61 -27
  76. package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
  77. package/dist/packages/charts/src/categorical-values.d.ts +15 -10
  78. package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
  79. package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
  80. package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
  81. package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
  82. package/dist/packages/charts/src/cells/index.d.ts +11 -0
  83. package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
  84. package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
  85. package/dist/packages/charts/src/chart-frame.d.ts +17 -12
  86. package/dist/packages/charts/src/chart-grid.d.ts +19 -0
  87. package/dist/packages/charts/src/chart-input.d.ts +1 -9
  88. package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
  89. package/dist/packages/charts/src/chart-link.d.ts +56 -0
  90. package/dist/packages/charts/src/chart-range.d.ts +33 -0
  91. package/dist/packages/charts/src/chart-rows.d.ts +20 -0
  92. package/dist/packages/charts/src/chart-theme.d.ts +17 -0
  93. package/dist/packages/charts/src/chart.d.ts +73 -0
  94. package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
  95. package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
  96. package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
  97. package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
  98. package/dist/packages/charts/src/comparison/index.d.ts +6 -0
  99. package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
  100. package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
  101. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
  102. package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
  103. package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
  104. package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
  105. package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
  106. package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
  107. package/dist/packages/charts/src/distribution/index.d.ts +11 -0
  108. package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
  109. package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
  110. package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
  111. package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
  112. package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
  113. package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
  114. package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
  115. package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
  116. package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
  117. package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
  118. package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
  119. package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
  120. package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
  121. package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
  122. package/dist/packages/charts/src/graph/index.d.ts +6 -2
  123. package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
  124. package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
  125. package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
  126. package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
  127. package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
  128. package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
  129. package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
  130. package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
  131. package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
  132. package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
  133. package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
  134. package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
  135. package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
  136. package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
  137. package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
  138. package/dist/packages/charts/src/image/image-input.d.ts +27 -0
  139. package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
  140. package/dist/packages/charts/src/image/index.d.ts +7 -0
  141. package/dist/packages/charts/src/index.d.ts +16 -1
  142. package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
  143. package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
  144. package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
  145. package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
  146. package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
  147. package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
  148. package/dist/packages/charts/src/matrix/index.d.ts +14 -3
  149. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
  150. package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
  151. package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
  152. package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
  153. package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
  154. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
  155. package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
  156. package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
  157. package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
  158. package/dist/packages/charts/src/plot/contours.d.ts +45 -0
  159. package/dist/packages/charts/src/plot/index.d.ts +49 -0
  160. package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
  161. package/dist/packages/charts/src/plot/locate.d.ts +18 -0
  162. package/dist/packages/charts/src/plot/path.d.ts +39 -0
  163. package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
  164. package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
  165. package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
  166. package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
  167. package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
  168. package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
  169. package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
  170. package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
  171. package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
  172. package/dist/packages/charts/src/plot/scale.d.ts +48 -0
  173. package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
  174. package/dist/packages/charts/src/plot-width.d.ts +3 -3
  175. package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
  176. package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
  177. package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
  178. package/dist/packages/charts/src/relationship/index.d.ts +11 -0
  179. package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
  180. package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
  181. package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
  182. package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
  183. package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
  184. package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
  185. package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
  186. package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
  187. package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
  188. package/dist/packages/charts/src/spec/figure.d.ts +12 -0
  189. package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
  190. package/dist/packages/charts/src/spec/index.d.ts +10 -0
  191. package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
  192. package/dist/packages/charts/src/text/index.d.ts +11 -0
  193. package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
  194. package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
  195. package/dist/packages/charts/src/text/token-links.d.ts +49 -0
  196. package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
  197. package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
  198. package/dist/packages/charts/src/text/token-text.d.ts +39 -0
  199. package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
  200. package/dist/packages/charts/src/timeline/index.d.ts +3 -1
  201. package/dist/packages/charts/src/timeline/waterfall.d.ts +29 -14
  202. package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
  203. package/dist/packages/charts/src/transforms/density.d.ts +53 -0
  204. package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
  205. package/dist/packages/charts/src/transforms/index.d.ts +19 -0
  206. package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
  207. package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
  208. package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
  209. package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
  210. package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
  211. package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
  212. package/dist/packages/charts/src/transforms/values.d.ts +70 -0
  213. package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
  214. package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
  215. package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
  216. package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
  217. package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
  218. package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
  219. package/dist/packages/charts/src/trend/index.d.ts +10 -0
  220. package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
  221. package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
  222. package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
  223. package/dist/packages/collections/src/collection-controls.d.ts +5 -1
  224. package/dist/packages/collections/src/collection-filters.d.ts +4 -1
  225. package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
  226. package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
  227. package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
  228. package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
  229. package/dist/packages/collections/src/data-table-text.d.ts +13 -0
  230. package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
  231. package/dist/packages/collections/src/data-table.d.ts +3 -85
  232. package/dist/packages/collections/src/index.d.ts +11 -6
  233. package/dist/packages/collections/src/query-controls.d.ts +6 -2
  234. package/dist/packages/collections/src/table-results.d.ts +47 -13
  235. package/dist/packages/collections/src/timeline.d.ts +1 -0
  236. package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
  237. package/dist/packages/collections/src/use-table-window.d.ts +25 -0
  238. package/dist/packages/content/src/viewer.d.ts +8 -0
  239. package/dist/packages/core/src/disclosure.d.ts +9 -1
  240. package/dist/packages/core/src/index.d.ts +1 -0
  241. package/dist/packages/core/src/route-link.d.ts +11 -0
  242. package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
  243. package/dist/packages/forms/src/file-picker.d.ts +15 -0
  244. package/dist/packages/forms/src/form-controls.d.ts +1 -6
  245. package/dist/packages/forms/src/forms.d.ts +4 -1
  246. package/dist/packages/forms/src/index.d.ts +4 -2
  247. package/dist/packages/forms/src/selection.d.ts +14 -0
  248. package/dist/packages/foundations/src/csp/index.d.ts +1 -1
  249. package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
  250. package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
  251. package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
  252. package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
  253. package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
  254. package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
  255. package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
  256. package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
  257. package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
  258. package/dist/packages/kits/src/explainers/index.d.ts +8 -0
  259. package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
  260. package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
  261. package/dist/packages/kits/src/explainers/term.d.ts +29 -0
  262. package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
  263. package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
  264. package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
  265. package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
  266. package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
  267. package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
  268. package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
  269. package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
  270. package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
  271. package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
  272. package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
  273. package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
  274. package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
  275. package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
  276. package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
  277. package/dist/packages/kits/src/operations/index.d.ts +6 -0
  278. package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
  279. package/dist/packages/kits/src/training/index.d.ts +8 -0
  280. package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
  281. package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
  282. package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
  283. package/dist/packages/kits/src/training/run-state.d.ts +7 -0
  284. package/dist/packages/kits/src/training/run-table.d.ts +63 -0
  285. package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
  286. package/dist/packages/kits/src/training/runs.d.ts +34 -0
  287. package/dist/packages/navigation/src/index.d.ts +1 -1
  288. package/dist/path-BglsXpnO.js +59 -0
  289. package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
  290. package/dist/plot-axes-DJkLW4wk.js +100 -0
  291. package/dist/plot-layout-BEuoOHbs.js +911 -0
  292. package/dist/plot-marks-A64v7aTw.js +226 -0
  293. package/dist/plot-surface-CJTIqtck.js +51 -0
  294. package/dist/{plot-width-CIqBiHcd.js → plot-width-DcqtSgzb.js} +22 -3
  295. package/dist/point-layer-C-EYETAt.js +655 -0
  296. package/dist/reference-lines-CWA8VeUR.js +82 -0
  297. package/dist/scale-C2xgZyZN.js +63 -0
  298. package/dist/slope-chart-DT22h_ym.js +1279 -0
  299. package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
  300. package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
  301. package/dist/{src-Dcs3SZ9V.js → src-CExIrXPC.js} +170 -194
  302. package/dist/src-CGc_hjxJ.js +409 -0
  303. package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
  304. package/dist/src-D5NXRJZe.js +2195 -0
  305. package/dist/src-DIS0YOj0.js +44 -0
  306. package/dist/styles2.css +574 -161
  307. package/dist/time-series-IB3CB93O.js +2668 -0
  308. package/dist/token-heatmap-C00DnoNO.js +1354 -0
  309. package/dist/token-predictions-Cxx29iDr.js +1093 -0
  310. package/dist/tone-scope-DKiSw-JR.js +32 -0
  311. package/dist/tree-diagram-DsckNKaW.js +1629 -0
  312. package/dist/treemap-9_DpLCW9.js +472 -0
  313. package/dist/values-963L6n1m.js +65 -0
  314. package/dist/violin-plot-BhPHKXsN.js +1291 -0
  315. package/dist/waterfall-CGksuTy5.js +576 -0
  316. package/package.json +57 -7
  317. package/recipes/allocation-report.tsx +15 -7
  318. package/skills/extend-elements/SKILL.md +134 -0
  319. package/skills/review-elements/SKILL.md +118 -0
  320. package/skills/upgrade-elements/SKILL.md +36 -0
  321. package/skills/upgrade-elements/references/releases.md +242 -0
  322. package/skills/use-elements/SKILL.md +70 -13
  323. package/skills/use-elements/references/agent.md +57 -0
  324. package/skills/use-elements/references/charts.md +384 -0
  325. package/skills/use-elements/references/collections.md +89 -0
  326. package/skills/use-elements/references/conversations.md +47 -0
  327. package/skills/use-elements/references/figures.md +173 -0
  328. package/skills/use-elements/references/forms.md +81 -0
  329. package/skills/use-elements/references/kits.md +198 -0
  330. package/skills/use-elements/references/styling.md +70 -0
  331. package/skills/use-elements/references/workspace.md +3 -3
  332. package/dist/categorical-values-DZLGQVW1.js +0 -63
  333. package/dist/chart-frame-Ztktqs1b.js +0 -255
  334. package/dist/chart-input-BO3BqlFO.js +0 -22
  335. package/dist/chart-navigation-BAbb5PV9.js +0 -154
  336. package/dist/header-styles-COxCYFZx.js +0 -90
  337. package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
  338. package/dist/packages/charts/src/chart-surface.d.ts +0 -27
  339. package/dist/packages/navigation/src/route-link.d.ts +0 -2
  340. package/dist/src-Bk7M67zy.js +0 -396
@@ -0,0 +1,89 @@
1
+ # Tables and collections
2
+
3
+ Import from `@mechane-ai/elements/collections`. The components render supplied records and report intent. The
4
+ application owns requests, URL state, permissions and saved preferences.
5
+
6
+ ## Declare the query
7
+
8
+ Every `DataTable` takes a stable `getRowId`, a `caption`, an `empty` state and a `query`.
9
+
10
+ | Query mode | Use it when |
11
+ | ------------ | ------------------------------------------------------------------------------------------------------- |
12
+ | `local` | The app holds every row. Supply a search accessor and filter dimensions; the table filters and windows. |
13
+ | `controlled` | A server pages the rows. Supply search and filter values with callbacks, and reset the page on change. |
14
+ | `frame` | A shared header already holds the controls. Declare them once with `TableQueryFrame`. |
15
+ | `static` | The table is a fixed reference. Give a concrete `reason`. |
16
+
17
+ ```tsx
18
+ <DataTable
19
+ caption="Projects"
20
+ columns={columns}
21
+ rows={projects}
22
+ getRowId={(project) => project.id}
23
+ empty="No projects."
24
+ query={{
25
+ mode: 'local',
26
+ search: (project) => project.name,
27
+ filters: [{ id: 'status', label: 'Status', value: (project) => project.status }],
28
+ }}
29
+ />
30
+ ```
31
+
32
+ To leave out only search or only filters, replace that capability with `{ reason: '…' }`. For a paged source, apply
33
+ search, filters and sort to the whole result before the server takes a page, with a unique key as the last sort field.
34
+
35
+ ## Columns
36
+
37
+ Each column declares a `role`: `primary`, `text`, `status`, `number`, `timestamp` or `actions`. The role owns alignment
38
+ and minimum width, and the primary column takes the remaining space. Check the array with `satisfies`:
39
+
40
+ ```tsx
41
+ const columns = [
42
+ { id: 'name', label: 'Name', role: 'primary', cell: (item: Item) => item.name },
43
+ ] satisfies ReadonlyArray<DataTableColumn<Item>>;
44
+ ```
45
+
46
+ An explicit type annotation widens the columns and then requires the controlled sort props. A column with
47
+ `canSort: true` needs the `sort` and `onSortChange` pair, and the app sorts the rows.
48
+
49
+ - Rows are 48px and text truncates. Set `rowSizing="content"` for records that need several lines.
50
+ - Use `DataTableText` for a primary string with an optional second line.
51
+ - Mark a column `isSecondary` to hide it at the compact breakpoint.
52
+ - The table owns its cell insets. Keep a full-width table outside `PageContent`, or use `PageSection`'s `breakdown`.
53
+
54
+ ## Opening, selecting and paging
55
+
56
+ - `rowAction` makes a record inspectable. Supply `href` for a real link, or a callback for a local action. Other cell
57
+ controls keep their own actions. `activeRowId` marks the inspected record without changing selection.
58
+ - Selection needs `selectedIds`, `onSelectionChange` and a label for each row's checkbox. Shift and a click select a
59
+ range, and the header checkbox selects every supplied row.
60
+ - `CollectionPagination` takes the position text and explicit previous and next availability. Never infer another page
61
+ from the row count.
62
+ - `window` limits the mounted rows of a long page. It does not fetch. Use `CollectionEnd` for loading more, with its
63
+ ready, loading, retry and complete states.
64
+ - Pass `resultStatus` while a read is pending or failed, and keep the previous rows on screen.
65
+
66
+ ## The control row
67
+
68
+ A local or controlled query renders its own search and filters. For a custom header, call `useCollectionControls` with
69
+ the current values and callbacks. It returns `actions`, `chips`, `onKeyDown` and `openSearch`. Put the actions in the
70
+ page or section header and the chips below them in a `CollectionToolbar`.
71
+
72
+ The control row is one toolbar. Tab enters it once, and the arrow keys move between chips, find, filters and display
73
+ options. The search field releases the arrows only from the end of its text. Do not add a second Tab stop or a custom
74
+ key handler around it.
75
+
76
+ ## What the keyboard does
77
+
78
+ - The row actions of a table share one Tab stop. Arrow keys move by a row, Page Up and Page Down by ten, and Home and
79
+ End reach the first and last supplied row.
80
+ - `Timeline` events share one Tab stop, and arrow keys move between them. Links inside an event keep their own stops.
81
+ - Register a shortcut with `useCommandShortcuts` from `/navigation/commands`, beside the action's owner, with an
82
+ explicit `isEnabled`. `CommandPalette` lists the same action records and registers nothing by mounting.
83
+
84
+ ## A selected record
85
+
86
+ `Inspector` puts a list in `master` and the selected record in `detail`, side by side when there is room and stacked in
87
+ a narrow container. Change `revealKey` when the selection changes so a stacked detail scrolls into view. `Details`
88
+ renders labeled fields. `Metric` and `MetricGrid` summarize a record or a period; pass `isLoading` to reserve their
89
+ space. `Timestamp` takes an ISO datetime and a label the app formatted with an explicit locale and time zone.
@@ -0,0 +1,47 @@
1
+ # Conversations and agent activity
2
+
3
+ Import from `@mechane-ai/elements/ai`. These parts render supplied records. They do not call a model, start a run, store
4
+ messages or decide permissions.
5
+
6
+ ## The transcript
7
+
8
+ Compose `Conversation.Root`, `Viewport`, `Content` and one `Item` per message, with `JumpToLatest` inside the root.
9
+
10
+ - Give the viewport a label and each item a stable `messageId`. Key the root by conversation identity.
11
+ - A parent with a bounded height makes the transcript scroll. Without one it grows in page flow.
12
+ - A live conversation follows new content while the reader is at the end, and stops when they scroll up. Do not add a
13
+ scroll effect of your own.
14
+ - Mark the user's just-sent item with `shouldRevealOnAppend`, and keep its ID through acknowledgement.
15
+ - Use `initialPosition="start"` and `shouldFollow={false}` for a historical page.
16
+ - Pass `isStreaming` to `Content` while a reply is incomplete, and to the one `Markdown` message that is streaming.
17
+
18
+ `Message` takes an author, metadata, content, attachments and actions. Use `variant="chat"` for a compact chat with
19
+ end-aligned user messages. Render text with `Markdown` from `/content/markdown`. `MessageAction` is a named icon button
20
+ that shows on hover and focus. `ReplyIndicator` shows a supplied waiting label; remove it when real output arrives.
21
+
22
+ ## The prompt
23
+
24
+ `PromptInput` takes `value`, `onValueChange` and `onSubmit`. The app owns the draft, the request identity, the result
25
+ and any retry. The component never clears the text, so a failed send keeps its draft.
26
+
27
+ - Enter adds a line by default. `enterBehavior="submit"` submits, and Shift and Enter adds a line. Command or Control
28
+ with Enter always submits.
29
+ - Pass `history`, oldest first, for Arrow Up recall on the first line.
30
+ - Supplying `onStop` shows Stop in place of Send.
31
+ - Use `isCompact` for a composer pinned below a conversation.
32
+ - Model choice, suggestions and attachments go in the `controls` and `attachments` slots.
33
+
34
+ ## Activity, approvals and sources
35
+
36
+ | To show | Use |
37
+ | ----------------------------------- | ------------------------------------------------------------------ |
38
+ | A recorded shell command and output | `CommandActivity` |
39
+ | Ordered recorded steps, nested runs | `Trace` from `/content` |
40
+ | Tool input and output | `JsonViewer`, `CodeBlock`, `LogViewer`, `StackTrace` |
41
+ | A decision a person must make | `Approval` with an identified request |
42
+ | Where an answer came from | `Sources` and `InlineCitation` |
43
+ | A file change | `DiffViewer` from `/content/diff`, `FileTree` from `/content/tree` |
44
+ | Context use | `Meter` from `/feedback`, with `null` for unknown |
45
+
46
+ An `Approval` reports intent. Show it as settled only after the application acknowledges the outcome. A supplied summary
47
+ is not a model's hidden reasoning, and a recorded command is not a live terminal. Label them as what they are.
@@ -0,0 +1,173 @@
1
+ # Figures as JSON
2
+
3
+ A figure spec names one chart and its props as plain JSON. An agent or a server writes it, `validateFigureSpec` checks
4
+ it and `Figure` draws it. Use it when the figure comes from data that is not code: a model's answer, a saved report or
5
+ an API response.
6
+
7
+ ```tsx
8
+ import {
9
+ Figure,
10
+ chartGuide,
11
+ describeFigure,
12
+ figureCharts,
13
+ validateFigureSpec,
14
+ } from '@mechane-ai/elements/charts/figure';
15
+ import type { FigureSpec } from '@mechane-ai/elements/charts/figure';
16
+ ```
17
+
18
+ | Export | What it is |
19
+ | -------------------- | ---------------------------------------------------------------------------------------------------- |
20
+ | `FigureSpec` | The spec type: a union with one member per registered chart. `FigureSpecOf<'Histogram'>` is one. |
21
+ | `validateFigureSpec` | Checks the structure of any input. Returns `{ kind: 'ok', spec }` or `{ kind: 'invalid', message }`. |
22
+ | `Figure` | Draws a spec. It takes `selected`, `onSelectedChange` and `status` beside it. |
23
+ | `describeFigure` | Returns the figure as short plain text. |
24
+ | `figureCharts` | `{ chart, family }` for each of the 50 registered charts. |
25
+ | `chartGuide` | One entry per registered chart: `question`, `use`, `avoid`, `family` and a valid `example` spec. |
26
+
27
+ ## The shape
28
+
29
+ A `FigureSpec` is `{ chart, props }`. The type is a union with one member for each registered chart, so
30
+ `chart: 'Histogram'` goes with the props of `Histogram`, and a TypeScript caller gets the right props for the name.
31
+
32
+ - `chart` is the exact name of a registered chart, such as `"Histogram"`. The charts and what each answers are in
33
+ [charts](charts.md), and in `chartGuide`.
34
+ - `props` are that chart's props, minus what JSON cannot carry: callbacks (`on...`), React slots such as `actions` and a
35
+ function format. Read the chart's declaration file for its props.
36
+ - Every spec needs `title` and `locale` in `props`, plus the props the chart cannot draw without.
37
+ - A format is an `Intl` options object. A `TimeFormat` names its `timeZone`.
38
+ - `ColorLegend`, the table cells, the placeholders and the kits are not registered, so a spec cannot name them.
39
+
40
+ ## Start from the guide
41
+
42
+ `chartGuide` is the same guidance as the chooser in [charts](charts.md), as data. Read it to pick a chart and to start
43
+ from a spec that is known to be valid.
44
+
45
+ ```ts
46
+ const entry = chartGuide.find((item) => item.chart === 'DumbbellPlot');
47
+
48
+ // entry?.question: "How much did each row change between two measurements?"
49
+ // entry?.use, entry?.avoid, entry?.family
50
+ // entry?.example is a FigureSpec to copy and change.
51
+ ```
52
+
53
+ ## Write one
54
+
55
+ ```json
56
+ {
57
+ "chart": "Histogram",
58
+ "props": {
59
+ "title": "Request latency",
60
+ "description": "Synthetic requests over one hour, in 25 ms bins.",
61
+ "locale": "en-US",
62
+ "source": "Synthetic trace",
63
+ "transforms": ["Binned at 25 ms"],
64
+ "value": { "label": "Latency (ms)", "format": { "maximumFractionDigits": 0 } },
65
+ "count": { "label": "Requests", "format": { "maximumFractionDigits": 0 } },
66
+ "bins": [
67
+ { "id": "b0", "label": "0 to 25 ms", "lowerBound": 0, "upperBound": 25, "count": 120 },
68
+ { "id": "b1", "label": "25 to 50 ms", "lowerBound": 25, "upperBound": 50, "count": 340 },
69
+ { "id": "b2", "label": "50 to 75 ms", "lowerBound": 50, "upperBound": 75, "count": 180 },
70
+ { "id": "b3", "label": "75 to 100 ms", "lowerBound": 75, "upperBound": 100, "count": null }
71
+ ]
72
+ }
73
+ }
74
+ ```
75
+
76
+ The last bin has `"count": null`. The chart draws it hollow, not as zero.
77
+
78
+ ## Check and draw it
79
+
80
+ ```tsx
81
+ import { Notice } from '@mechane-ai/elements/feedback';
82
+ import { useState } from 'react';
83
+
84
+ function AgentFigure({ input }: { readonly input: unknown }) {
85
+ const [selected, setSelected] = useState<string | null>(null);
86
+ const result = validateFigureSpec(input);
87
+
88
+ if (result.kind === 'invalid') {
89
+ return <Notice hasError>{result.message}</Notice>;
90
+ }
91
+
92
+ return <Figure spec={result.spec} selected={selected} onSelectedChange={(id) => setSelected(id)} />;
93
+ }
94
+ ```
95
+
96
+ `validateFigureSpec(input)` takes `unknown`, so it accepts parsed JSON. The check is structural and never throws. It
97
+ confirms:
98
+
99
+ - the input is an object with a `chart` string that is registered;
100
+ - `props` is an object holding every required prop of the chart, each with the right JSON kind;
101
+ - no value anywhere in `props` is a function;
102
+ - `locale`, when present, is a non-empty string.
103
+
104
+ It does not check the deeper values. Each chart checks its own values and shows an invalid figure with the reason. A
105
+ chart name that is not registered gets up to three close names:
106
+
107
+ ```ts
108
+ validateFigureSpec({ chart: 'Histogramm', props: { title: 'Request latency', locale: 'en-US' } });
109
+ // { kind: 'invalid', message: '"Histogramm" is not a registered chart. Did you mean Histogram?' }
110
+
111
+ validateFigureSpec({ chart: 'Bar', props: {} });
112
+ // { kind: 'invalid', message: '"Bar" is not a registered chart. Did you mean BarChart, BreakdownBar, RankedBars?' }
113
+ ```
114
+
115
+ Other messages state the first problem found:
116
+
117
+ | Input | `message` |
118
+ | ------------------------------- | ------------------------------------------------------------------------------------------------------- |
119
+ | A `Histogram` with no `bins` | ``Histogram needs the prop `bins` (an array).`` |
120
+ | A `Histogram` with `count: 5` | ``Histogram needs `count` as an object, not a number.`` |
121
+ | A `Histogram` with `locale: ''` | ``Histogram needs `locale` as a non-empty string, such as "en-US".`` |
122
+ | A function inside `props` | `A figure spec is plain JSON, and its props hold a function. Pass callbacks to Figure beside the spec.` |
123
+ | A string, an array or `null` | ``A figure spec is an object with `chart` and `props`.`` |
124
+
125
+ `Figure` takes `spec: unknown` and these props beside it:
126
+
127
+ - `selected` and `onSelectedChange(id, details)` reach only the charts that take a selection. A press or Enter on a
128
+ record calls `onSelectedChange`. Leave both out for a read-only figure. A `Waterfall` drawn without a callback still
129
+ draws, and a press does nothing.
130
+ - `status` is `'ready'`, `'loading'` or `'refreshing'`, and replaces the spec's own `status` while newer data loads.
131
+
132
+ `Figure` runs `validateFigureSpec` itself. For a bad spec it draws the shared invalid figure, with the spec's `title`
133
+ and `locale` when they are strings, and the reason as its message. It never throws. Call `validateFigureSpec` first when
134
+ you want the message elsewhere, as above.
135
+
136
+ ## Read it back as text
137
+
138
+ `describeFigure(spec)` returns a short plain-text account of a figure for a place that cannot draw it, such as a chat
139
+ transcript, a log or an agent reading its result back. It names the chart and its title, then the description, how much
140
+ of the data is drawn when `coverage` is set, the source, the transforms and how many records the spec holds. It does not
141
+ restate the values.
142
+
143
+ ```ts
144
+ const text: string = describeFigure(result.spec);
145
+ ```
146
+
147
+ For the spec above, `describeFigure` returns:
148
+
149
+ ```text
150
+ A histogram, "Request latency", with 4 bins. Synthetic requests over one hour, in 25 ms bins. Source: Synthetic trace. Transforms: Binned at 25 ms.
151
+ ```
152
+
153
+ With `"coverage": { "shown": 640, "total": 1200, "unit": "requests" }` added to `props`, it adds a sentence after the
154
+ description:
155
+
156
+ ```text
157
+ A histogram, "Request latency", with 4 bins. Synthetic requests over one hour, in 25 ms bins. 640 of 1,200 requests shown. Source: Synthetic trace. Transforms: Binned at 25 ms.
158
+ ```
159
+
160
+ These two texts came from running `describeFigure` on those specs.
161
+
162
+ ## Rules for an agent that writes a spec
163
+
164
+ - Pick the chart from the question, with the chooser in [charts](charts.md) or `chartGuide`. Do not invent a chart name.
165
+ - Start from the chart's `example` in the guide when you can. It is a valid spec.
166
+ - Write only props the chart declares. Do not add a function, a color, a pixel height or a formatter.
167
+ - Use a declared format and a `locale`. Put the unit in the axis `label`. Write a time format as options with a
168
+ `timeZone`, never as a function.
169
+ - Write a missing value as `null`. Never write it as zero.
170
+ - Put prepared values in the spec. Name each step you applied in `transforms` and the data's origin in `source`.
171
+ - Set `coverage` when the spec holds a sample or a window.
172
+ - Read the figure back after drawing it. The readout, the exact-value table and the invalid message state what was
173
+ drawn.
@@ -0,0 +1,81 @@
1
+ # Forms
2
+
3
+ Import controls from `@mechane-ai/elements/forms` and date controls from `/forms/dates`. The application supplies
4
+ values, labels, validation, permissions and the save.
5
+
6
+ ## Choose the control
7
+
8
+ | The reader | Use |
9
+ | ------------------------------------------------- | ------------------------------------------------------------------ |
10
+ | Types a line or several lines | `Input`, `Textarea` |
11
+ | Types a number with steps, or drags a bound | `NumberField`, `Slider`, both with a `locale` |
12
+ | Ticks a choice that a later save submits | `Checkbox` |
13
+ | Turns on a setting that applies at once | `Switch` |
14
+ | Picks one value in a form | `RadioGroup` |
15
+ | Switches between a few views, one always checked | `SegmentedControl` |
16
+ | Presses independent options, such as formatting | `ToggleGroup` |
17
+ | Picks one of several labeled strings | `SelectControl` |
18
+ | Needs rich options, object values or many choices | compound `Select` |
19
+ | Searches a finite or remote set of options | `Combobox` |
20
+ | Chooses, drops or pastes files | `FilePicker` |
21
+ | Picks a date, a day range, a month or months | `DatePicker`, `DateRangePicker`, `MonthPicker`, `MonthRangePicker` |
22
+
23
+ ```tsx
24
+ <SegmentedControl.Root value={view} onValueChange={setView} aria-label="View">
25
+ <SegmentedControl.Item value="table">Table</SegmentedControl.Item>
26
+ <SegmentedControl.Item value="chart">Chart</SegmentedControl.Item>
27
+ </SegmentedControl.Root>
28
+ ```
29
+
30
+ Use `Menu` from `/overlays` for commands and immediate choices, not for a form value.
31
+
32
+ ## Label and validate
33
+
34
+ `Field.Root` associates `Field.Label`, `Field.Description` and `Field.Error` with its control. Validation text stays
35
+ beside its field. Use `Fieldset` to name a group of fields, and `InputGroup` for a prefix, suffix or action beside an
36
+ `Input`.
37
+
38
+ ```tsx
39
+ <Field.Root name="reason" invalid={isInvalid}>
40
+ <Field.Label>Reason</Field.Label>
41
+ <Input required value={reason} onValueChange={setReason} />
42
+ <Field.Error match={isInvalid}>Enter a reason.</Field.Error>
43
+ </Field.Root>
44
+ ```
45
+
46
+ - `Input` and `Textarea` report edits through `onValueChange`, from a person or an agent.
47
+ - Set `isSensitive` on `Field.Root` for credentials and private drafts. The value, label and validation then stay out of
48
+ what an agent can read. Password inputs do this already.
49
+ - A disabled control is unavailable. A read-only value stays selectable.
50
+
51
+ ## Save
52
+
53
+ Put the submit row in `FormActions`. Pass `isPending` to the button while the request runs; it keeps focus and prevents
54
+ a second activation. Show the outcome with `FormStatus` in its pending, error or success state.
55
+
56
+ For a change that is hard to undo, use `ConfirmButton` with a `confirmation` sentence that names the record, usually
57
+ inside an `AlertDialog`. Keep the safe action first, keep the dialog open with an inline error until the server
58
+ acknowledges success, and keep the draft when the save fails. The **Consequential form** recipe shows the whole flow.
59
+
60
+ ## Files
61
+
62
+ `FilePicker` takes `accept`, `multiple`, `maxFiles`, `maxSize` and `minSize`, and reports
63
+ `onValueChange(files, details)`. It lists the chosen files and says why one was refused. It never uploads or reads a
64
+ file. The application owns storage and progress, and the server still enforces every limit. State the formats and limits
65
+ in `Field.Description`.
66
+
67
+ ## Dates
68
+
69
+ Dates are civil values, `{ year, month, day }` with one-based months. Supply the locale, time zone, today, bounds and
70
+ presets explicitly; a picker reads no clock. The app converts an inclusive range to its API's timestamps.
71
+
72
+ - The day pickers take a typed date, one field per unit. Digits fill a unit and the arrow keys step it.
73
+ - A picker keeps a draft in its popup. Apply commits one complete value. Escape and Cancel discard it.
74
+ - Use `isClearable={false}` for a required reporting period, and `validateRange` to refuse an unsupported interval.
75
+ - `parseCalendarDate`, `serializeCalendarDate`, `addCalendarDays` and their month forms convert and step values.
76
+ - `Calendar` is an inline calendar with immediate selection. `EventMonth` is a month grid of the app's own events.
77
+
78
+ ## Settings pages
79
+
80
+ `SettingsSection` groups settings and `SettingsRow` binds a real `controlId` to its label and description. Settings that
81
+ apply at once use `Switch` or a select. Settings saved together use a form with `FormActions`.
@@ -0,0 +1,198 @@
1
+ # Kits
2
+
3
+ A kit is a small set of domain components built from the chart families. A kit chooses which figures answer a domain
4
+ question, arranges them, shares one tone scope and one linked inspection between them, and writes the words. It adds no
5
+ marks, colors or axes.
6
+
7
+ Import a kit from `@mechane-ai/elements/kits/<kit>`. Every component of the training, operations, evaluation and
8
+ interpretability kits:
9
+
10
+ - takes `locale` and declared formats, never pre-formatted numbers;
11
+ - takes the state it shows as a value with a change callback, such as `selected` with `onSelectedChange`;
12
+ - takes its visible words as `labels`, a partial object with English defaults;
13
+ - handles `status`, empty and invalid input, and refuses bad input with a sentence;
14
+ - computes nothing. The application supplies means, intervals, ranks and deltas, or calls
15
+ `@mechane-ai/elements/charts/transforms` first. A list may sort and filter the rows it is given.
16
+
17
+ The explainers kit takes content slots, not data, and its pieces take only what they need. The rules are
18
+ [contract 141](https://github.com/mechane-ai/mechane/blob/main/workspaces/core/.contracts/141-ui-domain-kits/CONTRACT.md).
19
+
20
+ | Kit | Entry | Use it for |
21
+ | ---------------- | ------------------------ | -------------------------------------------------------------------------- |
22
+ | Explainers | `/kits/explainers` | A long page whose prose, figures and diagrams point at each other. |
23
+ | Training | `/kits/training` | Watching and comparing training runs. |
24
+ | Operations | `/kits/operations` | The health, budgets and events of a service. |
25
+ | Evaluation | `/kits/evaluation` | Ranking and comparing models on benchmarks. |
26
+ | Interpretability | `/kits/interpretability` | Reading learned features, attribution, attention, logit lens and steering. |
27
+
28
+ ## Explainers
29
+
30
+ For a paper-like page. Give every thing one id and every figure one `id` in the explainer's list.
31
+
32
+ - `Explainer` takes `figures`, the ids of every numbered figure in reading order, and the article as `children`.
33
+ - `NumberedFigure` takes `id`, `caption` and a chart or diagram as `children`. It shows "Figure 2".
34
+ - `FigureReference` takes `to`, a figure id, and writes "Figure 2" as a link.
35
+ - `Term` takes `inspects`, an id the figures use, and words. Hovering or focusing it highlights that record in every
36
+ `ChartLink` figure.
37
+ - `DiagramPart` takes `inspects`, a `label` and SVG shapes, so a hand-drawn diagram links to the figures both ways.
38
+ - `BoundValue` is a number in a sentence the reader changes in place. It takes `value` with `onValueChange` or
39
+ `defaultValue`, `min`, `max`, `step`, optional `scale` (`'linear'` or `'log'`), `locale`, `format` and `label`.
40
+ - `StorySteps` walks through `steps` (`id`, `title`, `body`, optional `inspected`) beside the figures it takes as
41
+ `children`. It takes `step` with `onStepChange` or `defaultStep`, a `label` that names the walk, and `labels` for the
42
+ words of its controls. Each step points the linked figures at its `inspected` record.
43
+
44
+ The application supplies the prose, the figures and the ids. Put a `ChartLink` and a `ToneScope` around the article.
45
+
46
+ ## Training
47
+
48
+ For runs of one experiment. A run keeps one id and one hue in the dashboard, the table and every chart.
49
+
50
+ - `RunDashboard` draws one `CurveChart` panel per metric with one step cursor. It takes `runs`, `metrics`, `series`
51
+ (metric id, then run id, then points in increasing step), a step axis `x`, `selected` with `onSelectedChange`, and
52
+ `hidden` with `onHiddenChange`.
53
+ - `RunTable` is the table and the legend. It takes `title`, `runs`, `columns` for settings, `metrics` as `bar` or
54
+ `spark` columns, `selected`, `hidden`, `sort` with `onSortChange` and `showOnlyDifferences`. Pressing a row asks to
55
+ focus the run, or to clear the focus when it is already focused, so `onSelectedChange` receives an id or `null`.
56
+ - `RunsOverview` shows a whole sweep as gray lines with one highlighted run and a median band. Use it when there are
57
+ more runs than hues. It takes `runs`, `x`, `y`, `summary` and `summaryText`.
58
+
59
+ A `RunRecord` is `{ id, label, state, detail?, tone? }`, with `state` one of `running`, `finished`, `failed` or
60
+ `stopped`. `runLimits.runs` is 12. The application supplies the prepared curves, smoothed or not, the settings per run
61
+ and the final results. It holds selection, hiding and sorting.
62
+
63
+ ## Operations
64
+
65
+ For a service in production.
66
+
67
+ - `ServiceHealth` shows the service state in words, headline tiles with a trend, and time-series panels on one shared
68
+ time axis. It takes `service`, `indicators`, `charts`, `timestampUnit`, `timeFormat` and `locale`. Give a chart series
69
+ the same `id` as its indicator and the two share a hue.
70
+ - `BudgetBoard` shows objectives and budgets as bars against targets. It takes `groups` of rows that share a unit, each
71
+ with a `value` axis, and `selected` with `onSelectedChange`.
72
+ - `IncidentTimeline` shows deploys, alerts and incidents in three lanes over a `window`. It takes `events`, a
73
+ `timeFormat` that names its time zone, and `selected` with `onSelectedChange`.
74
+
75
+ The application judges every state and writes its words. Nothing here works out health from a number or a color.
76
+
77
+ ## Evaluation
78
+
79
+ For models compared on benchmarks. Every model has one id, `EvaluationModel` `{ id, label, detail?, tone? }`.
80
+
81
+ - `Leaderboard` is a ranked table of models over measure columns. A column has a `kind` of `score`, `interval`,
82
+ `change`, `trend` or `heat`, a `format`, `isHigherBetter` and, except for `change`, a shared `domain`. It takes
83
+ `models`, `columns`, `rows`, `sort` with `onSortChange` and `selected` with `onSelectedChange`. Here `selected` is the
84
+ list of checked model ids, and the rows have no checkboxes without the callback. `leaderboardLimits` is 100 models and
85
+ 10 columns.
86
+ - `ScoreBreakdown` shows one benchmark by category with a dot per model and an optional interval. It takes `models`,
87
+ `categories`, `scores`, `value` and `selected`.
88
+ - `ModelComparison` shows two models head to head: a dumbbell per benchmark and a table of differences. It takes `a`,
89
+ `b`, `rows`, `value`, `isHigherBetter` and `differenceFormat`. Each difference is B minus A.
90
+
91
+ A score is a number, an estimate with its interval `{ value, low, high }`, or `null` where it was not measured. The
92
+ application supplies the ranks, intervals, differences and tests. Resting on a leaderboard row marks that model in the
93
+ linked figures.
94
+
95
+ ## Interpretability
96
+
97
+ For reading what a model learned and how it computes an answer. A feature, such as a sparse autoencoder latent, keeps
98
+ one id in the list, the card, the map and the attribution graph, so resting on it in one place lights it in the others.
99
+ A kit that holds several figures shares one tone scope and one chart link. The application supplies every activation,
100
+ attribution, attention weight and decoded layer. No component runs a model. A `FeatureSummary` is
101
+ `{ id, label, source?, explanation?, frequency? }`, and `featureLimits` is 5000 features and 8 search matches. Each
102
+ change callback receives `details` with a `reason` of `press`, `input` or `imperative`.
103
+
104
+ - `FeatureCard` answers "what is this feature?": its name, id and explanation, how often it fires, the contexts that
105
+ activate it most, and the output tokens it promotes and suppresses. It takes `feature` and, each optional, `density`
106
+ (`bins`, a `value` axis and a `count` axis), `examples` (`examples`, a `domain`, `valueFormat`, optional `palette` and
107
+ `context`) and `logits` (`tokens` of `{ id, token, value }` and a `value` axis). It leaves out what is absent. Use
108
+ `size="compact"` in grids and side panels, `actions` for controls beside the name, and `frequencyFormat` for the
109
+ share. It owns no state.
110
+ - `FeatureList` answers "which features exist, and which one should I open?" as a sortable, searchable table. Each row
111
+ is a `FeatureSummary` with optional `maxActivation` and a `profile`, one value per layer. It takes `title`,
112
+ `features`, `frequencyDomain` (starts at zero), `frequencyFormat`, `activationFormat` and optional `profileDomain`.
113
+ The application holds `selected` with `onSelectedChange`, `query` with `onQueryChange` and `sort` with `onSortChange`.
114
+ It filters and sorts the rows it is given, and refuses duplicate ids.
115
+ - `AttributionWorkbench` answers "which features carry the answer from the prompt to the output?" It is an
116
+ `AttributionGraph` beside a panel for the node in focus. It takes the graph's props (`title`, `locale`, `layers`,
117
+ `nodes`, `edges`, `weightLabel`, `weightFormat`, and optional `valueLabel`, `valueFormat` and `direction`) and
118
+ `details`, a `FeatureCardData` per node id. The application holds `selected` with `onSelectedChange` and `pinned` with
119
+ `onPinnedChange`. Pointing at a node shows its card, pressing keeps it, and pinning builds a subgraph. A key of
120
+ `details` that is not a node is refused.
121
+ - `AttentionHeadGrid` answers "what does each head look at?" One attention pattern per head over the same tokens and the
122
+ same 0 to 1 scale, with the selected head enlarged beside the lines from each token. It takes `title`, `tokens`,
123
+ `heads` (`id`, `label`, optional `description`, `weights` with null for a masked pair), `mask` of `none` or `causal`,
124
+ and `minPanelWidth`. The application holds `selected` (the enlarged head) with `onSelectedChange` and `pair`, the
125
+ token pair every head marks, with `onPairChange`. Its id is `matrixCellId(destination, source)`: the token that
126
+ attends, then the token attended to. Left out, `pair` is kept by the grid. It draws at most 32 heads
127
+ (`attentionHeadLimits`). Weights show where a head reads from, not what it computes.
128
+ - `LogitLens` answers "at which layer does the answer form?" A grid of the model's top next-token guess at every layer
129
+ and prompt position, shaded by probability, and a curve of chosen tokens by layer for the selected position. It takes
130
+ `title`, `columns` (the prompt tokens), `layers` (`id`, `label`, `depth`), `cells` (the top prediction and probability
131
+ per layer and position), optional `tracks` (`id`, `columnId`, `token` and one probability per layer) and
132
+ `valueFormat`. The application holds `selected`, a cell id from `tokenGridCellId(layerId, columnId)`, with
133
+ `onSelectedChange`, and decodes every layer.
134
+ - `EmbeddingAtlas` answers "where is a feature on the map, and what is it?" An `EmbeddingMap` with a search box, a list
135
+ of matches and a card for the open feature. It takes the map's props (`title`, `points`, `groups`, `x`, `y` and the
136
+ others), `landmarks` (`id`, `x`, `y`) and `details`, a `FeatureCardData` per landmark id. The application holds
137
+ `query` with `onQueryChange` and `selected` with `onSelectedChange`, and projects the points. A landmark with no
138
+ details is refused.
139
+ - `SteeringPanel` answers "what does the model do when I change a feature's strength?" A slider per feature beside
140
+ next-token predictions, with a tick for each token before steering, and optionally the text before and after. It takes
141
+ `title`, `features` (`id`, `label`, `min`, `max`, `step`, optional `neutral` and `description`), `values` by feature
142
+ id, `predictions` (each with a `baseline`), and optional `prompt`, `completions` (`baseline`, `steered`) and
143
+ `strengthFormat`. The application holds `values` with `onValuesChange`, which Reset also calls with every neutral
144
+ strength, and generates the outputs for the current setting.
145
+
146
+ ```tsx
147
+ import { FeatureCard, FeatureList } from '@mechane-ai/elements/kits/interpretability';
148
+
149
+ <FeatureList
150
+ title="Layer 20 features"
151
+ locale="en-US"
152
+ features={[
153
+ { id: 'f-1', label: 'Golden Gate Bridge', frequency: 0.0004, maxActivation: 9.2 },
154
+ { id: 'f-2', label: 'Suspension bridges', frequency: 0.0011, maxActivation: 6.8 },
155
+ ]}
156
+ frequencyDomain={[0, 0.002]}
157
+ frequencyFormat={{ style: 'percent', maximumFractionDigits: 2 }}
158
+ activationFormat={{ maximumFractionDigits: 1 }}
159
+ selected={openFeature}
160
+ onSelectedChange={(id) => setOpenFeature(id)}
161
+ />;
162
+
163
+ <FeatureCard locale="en-US" size="compact" feature={{ id: 'f-1', label: 'Golden Gate Bridge', frequency: 0.0004 }} />;
164
+ ```
165
+
166
+ ## Put a kit on a page
167
+
168
+ The dashboard and the table each keep a tone scope over `runs`, so a run has one hue in both. The application holds
169
+ selection and hiding and passes them to both.
170
+
171
+ ```tsx
172
+ import { RunDashboard, RunTable } from '@mechane-ai/elements/kits/training';
173
+
174
+ <>
175
+ <RunDashboard
176
+ title="Validation"
177
+ locale="en-US"
178
+ runs={runs}
179
+ metrics={metrics}
180
+ series={series}
181
+ x={{ label: 'Training step', format: { maximumFractionDigits: 0 } }}
182
+ selected={selected}
183
+ onSelectedChange={(id) => setSelected(id)}
184
+ hidden={hidden}
185
+ onHiddenChange={(ids) => setHidden(ids)}
186
+ hasLegend={false}
187
+ />
188
+ <RunTable
189
+ title="Runs"
190
+ locale="en-US"
191
+ runs={runs}
192
+ selected={selected}
193
+ onSelectedChange={(id) => setSelected(id)}
194
+ hidden={hidden}
195
+ onHiddenChange={(ids) => setHidden(ids)}
196
+ />
197
+ </>;
198
+ ```