@mechane-ai/elements 0.46.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 (276) hide show
  1. package/README.md +306 -33
  2. package/dist/ai.js +4 -4
  3. package/dist/catalog.json +2382 -33
  4. package/dist/categorical-values-DdfGIowV.js +107 -0
  5. package/dist/cells--Bd1fQFR.js +384 -0
  6. package/dist/chart-link-AE_xuxiP.js +35 -0
  7. package/dist/chart-tones-ei3BC2AL.js +27 -0
  8. package/dist/charts/cartesian.js +1 -2958
  9. package/dist/charts/cells.js +1 -0
  10. package/dist/charts/comparison.js +1 -0
  11. package/dist/charts/distribution.js +1 -781
  12. package/dist/charts/figure.js +3404 -0
  13. package/dist/charts/graph.js +1 -655
  14. package/dist/charts/hierarchy.js +1 -121
  15. package/dist/charts/image.js +1 -0
  16. package/dist/charts/matrix.js +3 -644
  17. package/dist/charts/plot.js +15 -0
  18. package/dist/charts/relationship.js +1 -0
  19. package/dist/charts/text.js +1 -0
  20. package/dist/charts/timeline.js +1 -266
  21. package/dist/charts/transforms.js +677 -0
  22. package/dist/charts/trend.js +1 -0
  23. package/dist/charts.js +8 -3
  24. package/dist/collections.js +1 -2195
  25. package/dist/color-legend-CIo7DhXB.js +62 -0
  26. package/dist/dates-Cww8UR_n.js +810 -0
  27. package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
  28. package/dist/embedding-map-CGM_k6lC.js +1929 -0
  29. package/dist/feedback.js +1 -1
  30. package/dist/figure-format-B8kRZMlo.js +36 -0
  31. package/dist/figure-frame-wRkIEAwe.js +270 -0
  32. package/dist/forms/dates.js +1 -810
  33. package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
  34. package/dist/image-grid-CVA4SOy_.js +598 -0
  35. package/dist/kits/evaluation.js +431 -0
  36. package/dist/kits/explainers.js +452 -0
  37. package/dist/kits/interpretability.js +1033 -0
  38. package/dist/kits/operations.js +239 -0
  39. package/dist/kits/training.js +335 -0
  40. package/dist/label-place-Z0fryBZb.js +42 -0
  41. package/dist/locate-Bcg3QcP4.js +11 -0
  42. package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
  43. package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
  44. package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
  45. package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
  46. package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
  47. package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
  48. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
  49. package/dist/packages/charts/src/cartesian/index.d.ts +5 -5
  50. package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
  51. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
  52. package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
  53. package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
  54. package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
  55. package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
  56. package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
  57. package/dist/packages/charts/src/cartesian/time-series.d.ts +60 -36
  58. package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
  59. package/dist/packages/charts/src/categorical-values.d.ts +1 -1
  60. package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
  61. package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
  62. package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
  63. package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
  64. package/dist/packages/charts/src/cells/index.d.ts +11 -0
  65. package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
  66. package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
  67. package/dist/packages/charts/src/chart-frame.d.ts +14 -7
  68. package/dist/packages/charts/src/chart-grid.d.ts +19 -0
  69. package/dist/packages/charts/src/chart-input.d.ts +1 -9
  70. package/dist/packages/charts/src/chart-link.d.ts +56 -0
  71. package/dist/packages/charts/src/chart.d.ts +0 -8
  72. package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
  73. package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
  74. package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
  75. package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
  76. package/dist/packages/charts/src/comparison/index.d.ts +6 -0
  77. package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
  78. package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
  79. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
  80. package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
  81. package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
  82. package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
  83. package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
  84. package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
  85. package/dist/packages/charts/src/distribution/index.d.ts +11 -0
  86. package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
  87. package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
  88. package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
  89. package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
  90. package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
  91. package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
  92. package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
  93. package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
  94. package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
  95. package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
  96. package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
  97. package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
  98. package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
  99. package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
  100. package/dist/packages/charts/src/graph/index.d.ts +6 -2
  101. package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
  102. package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
  103. package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
  104. package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
  105. package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
  106. package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
  107. package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
  108. package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
  109. package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
  110. package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
  111. package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
  112. package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
  113. package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
  114. package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
  115. package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
  116. package/dist/packages/charts/src/image/image-input.d.ts +27 -0
  117. package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
  118. package/dist/packages/charts/src/image/index.d.ts +7 -0
  119. package/dist/packages/charts/src/index.d.ts +15 -1
  120. package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
  121. package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
  122. package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
  123. package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
  124. package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
  125. package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
  126. package/dist/packages/charts/src/matrix/index.d.ts +14 -3
  127. package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
  128. package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
  129. package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
  130. package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
  131. package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
  132. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
  133. package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
  134. package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
  135. package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
  136. package/dist/packages/charts/src/plot/contours.d.ts +45 -0
  137. package/dist/packages/charts/src/plot/index.d.ts +49 -0
  138. package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
  139. package/dist/packages/charts/src/plot/locate.d.ts +18 -0
  140. package/dist/packages/charts/src/plot/path.d.ts +39 -0
  141. package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
  142. package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
  143. package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
  144. package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
  145. package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
  146. package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
  147. package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
  148. package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
  149. package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
  150. package/dist/packages/charts/src/plot/scale.d.ts +48 -0
  151. package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
  152. package/dist/packages/charts/src/plot-width.d.ts +3 -2
  153. package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
  154. package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
  155. package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
  156. package/dist/packages/charts/src/relationship/index.d.ts +11 -0
  157. package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
  158. package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
  159. package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
  160. package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
  161. package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
  162. package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
  163. package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
  164. package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
  165. package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
  166. package/dist/packages/charts/src/spec/figure.d.ts +12 -0
  167. package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
  168. package/dist/packages/charts/src/spec/index.d.ts +10 -0
  169. package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
  170. package/dist/packages/charts/src/text/index.d.ts +11 -0
  171. package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
  172. package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
  173. package/dist/packages/charts/src/text/token-links.d.ts +49 -0
  174. package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
  175. package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
  176. package/dist/packages/charts/src/text/token-text.d.ts +39 -0
  177. package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
  178. package/dist/packages/charts/src/timeline/index.d.ts +3 -1
  179. package/dist/packages/charts/src/timeline/waterfall.d.ts +24 -13
  180. package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
  181. package/dist/packages/charts/src/transforms/density.d.ts +53 -0
  182. package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
  183. package/dist/packages/charts/src/transforms/index.d.ts +19 -0
  184. package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
  185. package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
  186. package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
  187. package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
  188. package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
  189. package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
  190. package/dist/packages/charts/src/transforms/values.d.ts +70 -0
  191. package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
  192. package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
  193. package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
  194. package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
  195. package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
  196. package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
  197. package/dist/packages/charts/src/trend/index.d.ts +10 -0
  198. package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
  199. package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
  200. package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
  201. package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
  202. package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
  203. package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
  204. package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
  205. package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
  206. package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
  207. package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
  208. package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
  209. package/dist/packages/kits/src/explainers/index.d.ts +8 -0
  210. package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
  211. package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
  212. package/dist/packages/kits/src/explainers/term.d.ts +29 -0
  213. package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
  214. package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
  215. package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
  216. package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
  217. package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
  218. package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
  219. package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
  220. package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
  221. package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
  222. package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
  223. package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
  224. package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
  225. package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
  226. package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
  227. package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
  228. package/dist/packages/kits/src/operations/index.d.ts +6 -0
  229. package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
  230. package/dist/packages/kits/src/training/index.d.ts +8 -0
  231. package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
  232. package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
  233. package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
  234. package/dist/packages/kits/src/training/run-state.d.ts +7 -0
  235. package/dist/packages/kits/src/training/run-table.d.ts +63 -0
  236. package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
  237. package/dist/packages/kits/src/training/runs.d.ts +34 -0
  238. package/dist/path-BglsXpnO.js +59 -0
  239. package/dist/plot-axes-DJkLW4wk.js +100 -0
  240. package/dist/plot-layout-BEuoOHbs.js +911 -0
  241. package/dist/plot-marks-A64v7aTw.js +226 -0
  242. package/dist/plot-surface-CJTIqtck.js +51 -0
  243. package/dist/plot-width-DcqtSgzb.js +124 -0
  244. package/dist/point-layer-C-EYETAt.js +655 -0
  245. package/dist/reference-lines-CWA8VeUR.js +82 -0
  246. package/dist/scale-C2xgZyZN.js +63 -0
  247. package/dist/slope-chart-DT22h_ym.js +1279 -0
  248. package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
  249. package/dist/src-D5NXRJZe.js +2195 -0
  250. package/dist/src-DIS0YOj0.js +44 -0
  251. package/dist/styles2.css +453 -62
  252. package/dist/time-series-IB3CB93O.js +2668 -0
  253. package/dist/token-heatmap-C00DnoNO.js +1354 -0
  254. package/dist/token-predictions-Cxx29iDr.js +1093 -0
  255. package/dist/tone-scope-DKiSw-JR.js +32 -0
  256. package/dist/tree-diagram-DsckNKaW.js +1629 -0
  257. package/dist/treemap-9_DpLCW9.js +472 -0
  258. package/dist/values-963L6n1m.js +65 -0
  259. package/dist/violin-plot-BhPHKXsN.js +1291 -0
  260. package/dist/waterfall-CGksuTy5.js +576 -0
  261. package/package.json +57 -4
  262. package/recipes/allocation-report.tsx +15 -7
  263. package/skills/extend-elements/SKILL.md +60 -0
  264. package/skills/review-elements/SKILL.md +43 -1
  265. package/skills/upgrade-elements/SKILL.md +3 -1
  266. package/skills/upgrade-elements/references/releases.md +184 -0
  267. package/skills/use-elements/SKILL.md +19 -13
  268. package/skills/use-elements/references/charts.md +362 -41
  269. package/skills/use-elements/references/figures.md +173 -0
  270. package/skills/use-elements/references/kits.md +198 -0
  271. package/dist/categorical-values-BXi-rJuv.js +0 -74
  272. package/dist/chart-data-CIJVWCYt.js +0 -21
  273. package/dist/chart-frame-BaxKn_MB.js +0 -236
  274. package/dist/chart-input-Bm82_9Rd.js +0 -22
  275. package/dist/chart-theme-4zprJ3rW.js +0 -404
  276. package/dist/plot-width-v2c_rA20.js +0 -63
@@ -0,0 +1,70 @@
1
+ /** Why a transform could not use its input, in a sentence the application can show or log. */
2
+ export type TransformInvalid = {
3
+ readonly kind: 'invalid';
4
+ readonly message: string;
5
+ };
6
+ /** What a transform returns when its input may be unusable: its result, or the reason it could not compute one. */
7
+ export type TransformResult<T> = ({
8
+ readonly kind: 'ok';
9
+ } & T) | TransformInvalid;
10
+ /** One observation of an ordered series. A `y` of null is a gap: the series has no value there. */
11
+ export type SeriesPoint = {
12
+ readonly x: number;
13
+ readonly y: number | null;
14
+ };
15
+ /** A point with a value: an observation a fit, a smoother or a sampler can use. */
16
+ export type ObservedPoint = {
17
+ readonly x: number;
18
+ readonly y: number;
19
+ };
20
+ /** The successful case of a transform's result, for helpers such as the `describe…` footnotes that read it. */
21
+ export type TransformOk<R> = Extract<R, {
22
+ readonly kind: 'ok';
23
+ }>;
24
+ /** The reason a transform rejected its input. */
25
+ export declare function invalid(message: string): TransformInvalid;
26
+ /** A finite number as it is, and null for a missing one. Null, NaN and infinities are missing to every transform. */
27
+ export declare function finiteOrNull(value: number | null | undefined): number | null;
28
+ /** The finite numbers of a list, in their order. Missing entries are dropped, never read as zero. */
29
+ export declare function observedValues(values: ReadonlyArray<number | null>): ReadonlyArray<number>;
30
+ /** The finite numbers of a list from smallest to largest. */
31
+ export declare function sortedValues(values: ReadonlyArray<number | null>): ReadonlyArray<number>;
32
+ /** The points of a series whose x and y are both finite, in their order. */
33
+ export declare function observedPoints(points: ReadonlyArray<SeriesPoint>): ReadonlyArray<ObservedPoint>;
34
+ export type ScanInput<T, S> = {
35
+ readonly items: ReadonlyArray<T>;
36
+ readonly initial: S;
37
+ readonly step: (state: S, item: T, index: number) => S;
38
+ };
39
+ /** Every intermediate state of a left-to-right pass over a list: the running form of a fold. */
40
+ export declare function scan<T, S>({ items, initial, step }: ScanInput<T, S>): ReadonlyArray<S>;
41
+ /** The total of a list; zero for an empty one. */
42
+ export declare function sum(values: ReadonlyArray<number>): number;
43
+ /** The arithmetic mean of a list that has at least one value. */
44
+ export declare function mean(values: ReadonlyArray<number>): number;
45
+ /** The sum of squared distances from the mean. */
46
+ export declare function squaredDeviation(values: ReadonlyArray<number>): number;
47
+ /** How often each index from 0 to `size - 1` occurs in a list. */
48
+ export declare function tally(indices: ReadonlyArray<number>, size: number): ReadonlyArray<number>;
49
+ /** True for a whole number from `low` to `high`. */
50
+ export declare function isCount(value: number, bounds: readonly [low: number, high: number]): boolean;
51
+ /** True when every id in a list is different. */
52
+ export declare function hasDistinctIds(ids: ReadonlyArray<string>): boolean;
53
+ /** The distinct values of a list in increasing order. */
54
+ export declare function distinctSorted(values: ReadonlyArray<number>): ReadonlyArray<number>;
55
+ /** A number as a footnote writes it in the reader's locale: whole in full, others to three significant digits. */
56
+ export declare function noteNumber(value: number, locale: string): string;
57
+ /** The singular and plural names of what a note counts. */
58
+ export type NoteNoun = {
59
+ readonly one: string;
60
+ readonly other: string;
61
+ };
62
+ /** A sentence that counts the entries a transform left out, or nothing when it left none out. */
63
+ export declare function leftOutNote({ count, noun, reason, locale, }: {
64
+ readonly count: number;
65
+ /** What was left out. Defaults to missing values. */
66
+ readonly noun?: NoteNoun | undefined;
67
+ /** What happened to them. Defaults to "skipped". */
68
+ readonly reason?: string | undefined;
69
+ readonly locale: string;
70
+ }): string;
@@ -0,0 +1,33 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
+ import type { FigureProps } from '../figure/figure-props.ts';
4
+ import type { PlotHeight } from '../plot/plot-layout.ts';
5
+ /** One stage the ranks are given at, such as a month or a checkpoint. */
6
+ export type BumpStage = {
7
+ readonly id: string;
8
+ readonly label: string;
9
+ };
10
+ export type BumpItem = {
11
+ readonly id: string;
12
+ readonly label: string;
13
+ /** One whole-number rank per stage, from 1 for the best. Null where the item is not ranked at that stage. */
14
+ readonly ranks: ReadonlyArray<number | null>;
15
+ readonly tone?: ChartTone | undefined;
16
+ };
17
+ export type BumpChartProps = FigureProps & {
18
+ /** The ordered stages, drawn as evenly spaced columns. */
19
+ readonly stages: ReadonlyArray<BumpStage>;
20
+ readonly items: ReadonlyArray<BumpItem>;
21
+ readonly height?: PlotHeight | undefined;
22
+ };
23
+ export declare const bumpLimits: {
24
+ readonly items: 30;
25
+ readonly stages: 24;
26
+ readonly rank: 100;
27
+ };
28
+ /**
29
+ * Rank over ordered stages, such as a model leaderboard by month. Rank 1 is at the top, each item is one line, and
30
+ * inspecting an item makes the others recede so its path stands out. The application supplies the ranks, one item per
31
+ * rank at each stage, and an item with no rank at a stage leaves a gap in its line.
32
+ */
33
+ export declare function BumpChart(props: BumpChartProps): ReactNode;
@@ -0,0 +1,38 @@
1
+ import type { ReactNode, Ref } from 'react';
2
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
+ import type { ChartLegendItem } from '../chart-frame.tsx';
4
+ import type { ChartItem } from '../chart.tsx';
5
+ import type { FigureFrameInput, FigureSelectionProps } from '../figure/figure-props.ts';
6
+ import type { PlotBox, PlotTick } from '../plot/plot-layout.ts';
7
+ /** One line across ordered columns, already placed in the plot's pixels. */
8
+ export type ColumnLine = {
9
+ readonly id: string;
10
+ readonly tone: ChartTone;
11
+ /** The vertical position at each column, or null where nothing was recorded. */
12
+ readonly ys: ReadonlyArray<number | null>;
13
+ /** The label at the first column, and the one at the last. */
14
+ readonly startLabel: string;
15
+ readonly endLabel: string;
16
+ };
17
+ export type ColumnFigureProps = FigureSelectionProps & {
18
+ readonly frame: FigureFrameInput;
19
+ readonly emptyLabel: string;
20
+ readonly plotRef: Ref<HTMLDivElement>;
21
+ readonly box: PlotBox;
22
+ /** The horizontal position of each column. */
23
+ readonly xs: ReadonlyArray<number>;
24
+ readonly xTicks: ReadonlyArray<PlotTick>;
25
+ readonly yTicks: ReadonlyArray<PlotTick>;
26
+ readonly yTitle: string;
27
+ readonly lines: ReadonlyArray<ColumnLine>;
28
+ /** What the arrow keys step through, with each one's exact values as a sentence. */
29
+ readonly items: ReadonlyArray<ChartItem>;
30
+ readonly legend: ReadonlyArray<ChartLegendItem>;
31
+ /** What the plot's lines are called in its accessible name: "items". */
32
+ readonly marks: string;
33
+ };
34
+ /**
35
+ * The shared body of the charts that join one thing's values across a few ordered columns. It draws lines and dots at
36
+ * each recorded value and names at both ends, and the others recede while one line is inspected or selected.
37
+ */
38
+ export declare function ColumnFigure({ frame, emptyLabel, plotRef, box, xs, xTicks, yTicks, yTitle, lines, items, legend, marks, selected, onSelectedChange, }: ColumnFigureProps): ReactNode;
@@ -0,0 +1,21 @@
1
+ import type { PlotBox } from '../plot/plot-layout.ts';
2
+ export type ColumnPositionsInput = {
3
+ readonly box: PlotBox;
4
+ /** The column labels under the axis, one per column, in order. */
5
+ readonly columnLabels: ReadonlyArray<string>;
6
+ /** The room the labels beside the first and last column ask for at the left and right ends of the plot. */
7
+ readonly leftGutter: number;
8
+ readonly rightGutter: number;
9
+ };
10
+ /** Evenly spaced columns, and the end gutters they leave for the labels beside the first and last column. */
11
+ export type ColumnPositions = {
12
+ readonly xs: ReadonlyArray<number>;
13
+ readonly leftGutter: number;
14
+ readonly rightGutter: number;
15
+ };
16
+ /**
17
+ * Evenly spaced columns between the gutters that hold the end labels. When the plot is too narrow for both, the gutters
18
+ * give up room in proportion to their size, up to half the plot. This keeps neighbouring column labels from touching,
19
+ * and an end label then shortens.
20
+ */
21
+ export declare function columnPositions({ box, columnLabels, leftGutter, rightGutter }: ColumnPositionsInput): ColumnPositions;
@@ -0,0 +1,69 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
+ import type { FigureProps } from '../figure/figure-props.ts';
4
+ import type { PathCurve } from '../plot/path.ts';
5
+ import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
6
+ import type { MarkStroke } from '../plot/plot-marks.tsx';
7
+ export type CurvePoint = {
8
+ readonly x: number;
9
+ /** The observed value, or null where none was recorded. The line breaks there. */
10
+ readonly y: number | null;
11
+ /** The bounds of an interval around the value, such as a spread across seeds. Supply both or neither. */
12
+ readonly lower?: number | null | undefined;
13
+ readonly upper?: number | null | undefined;
14
+ };
15
+ export type CurveSeries = {
16
+ readonly id: string;
17
+ readonly label: string;
18
+ /** Observations in increasing `x`. Series need not share their `x` values. */
19
+ readonly points: ReadonlyArray<CurvePoint>;
20
+ readonly tone?: ChartTone | undefined;
21
+ /** Dashed for a series that is modelled, not observed: a fit, a projection or a baseline. */
22
+ readonly stroke?: MarkStroke | undefined;
23
+ /** True for a series drawn in gray behind the others, as context. */
24
+ readonly isContext?: boolean | undefined;
25
+ };
26
+ /** A level a reader compares the curves against, such as a target. The application computes it. */
27
+ export type CurveReference = {
28
+ readonly id: string;
29
+ readonly label: string;
30
+ readonly y: number;
31
+ };
32
+ /** A position on the ordered variable the reader should find, such as the selected layer. Drawn as a labelled guide. */
33
+ export type CurveMarker = {
34
+ readonly x: number;
35
+ readonly label: string;
36
+ };
37
+ export type CurveChartProps = FigureProps & {
38
+ readonly series: ReadonlyArray<CurveSeries>;
39
+ /** The ordered variable: a training step, a layer, a dose, a context length. */
40
+ readonly x: PlotAxis;
41
+ readonly y: PlotAxis;
42
+ readonly references?: ReadonlyArray<CurveReference> | undefined;
43
+ /** Vertical guides at chosen `x` values, each named at the top of the plot. Values must lie inside the x domain. */
44
+ readonly markers?: ReadonlyArray<CurveMarker> | undefined;
45
+ readonly curve?: PathCurve | undefined;
46
+ /**
47
+ * Where series are named: in the legend, or beside the plot at the end of each line, spread apart so none overlap.
48
+ * Choose nowhere when one legend beside a grid of panels already names them.
49
+ */
50
+ readonly labels?: 'legend' | 'inline' | 'none' | undefined;
51
+ /**
52
+ * The series drawn at full strength, on top, while the others fade. Emphasis only. Left out, it follows the enclosing
53
+ * chart link: a term in the prose or a table row that inspects a series id highlights that series.
54
+ */
55
+ readonly highlighted?: string | null | undefined;
56
+ readonly height?: PlotHeight | undefined;
57
+ };
58
+ export declare const curveLimits: {
59
+ readonly series: 12;
60
+ readonly pointsPerSeries: 2000;
61
+ readonly references: 8;
62
+ readonly markers: 8;
63
+ };
64
+ /**
65
+ * Curves of a measure over an ordered variable that is not time: loss over training steps, accuracy over layers, an
66
+ * effect over a dose. Either axis can be linear, log or symlog, each series can carry an uncertainty band, and a
67
+ * modelled series is dashed. Use `LineChart` when the ordered variable is a timestamp.
68
+ */
69
+ export declare function CurveChart(props: CurveChartProps): ReactNode;
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
+ /**
4
+ * The pixels a column of end labels needs beside the plot: the longest label, but never more than about a third of the
5
+ * width.
6
+ */
7
+ export declare function labelGutter({ labels, width, }: {
8
+ readonly labels: ReadonlyArray<string>;
9
+ readonly width: number;
10
+ }): number;
11
+ /** How many characters fit in a gutter from `labelGutter`. */
12
+ export declare function gutterChars(gutter: number): number;
13
+ /** Shortens a label to `maxChars`, ending it with an ellipsis. The full name stays in the readout. */
14
+ export declare function truncateLabel(text: string, maxChars: number): string;
15
+ /** The room a stack of labels needs, so a plot can grow tall enough to keep every label apart. */
16
+ export declare function labelsHeight(count: number): number;
17
+ export type EndLabel = {
18
+ readonly id: string;
19
+ readonly text: string;
20
+ readonly tone: ChartTone;
21
+ /** Where the line ends, in plot pixels. The label sits there unless a neighbor needs the room. */
22
+ readonly y: number;
23
+ };
24
+ export type EndLabelsProps = {
25
+ readonly labels: ReadonlyArray<EndLabel>;
26
+ readonly x: number;
27
+ readonly anchor: 'start' | 'end';
28
+ /** The top and bottom of the room the labels may use. */
29
+ readonly top: number;
30
+ readonly bottom: number;
31
+ };
32
+ /**
33
+ * Names lines where they end. Labels keep their order and move apart just enough that none overlap, so a crowded end
34
+ * reads as a list beside its lines.
35
+ */
36
+ export declare function EndLabels({ labels, x, anchor, top, bottom }: EndLabelsProps): ReactNode;
37
+ /** The dashed edge that shows where the keyboard cursor rests on a line. It appears only while the plot has focus. */
38
+ export declare function LineCursor({ d }: {
39
+ readonly d: string;
40
+ }): ReactNode;
@@ -0,0 +1,37 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FigureProps } from '../figure/figure-props.ts';
3
+ import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
4
+ import type { NumericDomain } from '../plot/scale.ts';
5
+ export type HorizonPoint = {
6
+ readonly x: number;
7
+ readonly y: number | null;
8
+ };
9
+ export type HorizonSeries = {
10
+ readonly id: string;
11
+ readonly label: string;
12
+ /** Observations in increasing `x`. Rows share the chart's x axis, but need not share their positions. */
13
+ readonly points: ReadonlyArray<HorizonPoint>;
14
+ };
15
+ export type HorizonBands = 2 | 3 | 4;
16
+ export type HorizonChartProps = FigureProps & {
17
+ readonly series: ReadonlyArray<HorizonSeries>;
18
+ readonly x: PlotAxis;
19
+ /** The values every row folds, on one linear domain that holds zero. The domain is required, so rows compare. */
20
+ readonly value: PlotAxis & {
21
+ readonly domain: NumericDomain;
22
+ };
23
+ /** How many layers each row folds its values into. */
24
+ readonly bands: HorizonBands;
25
+ /** The height of each row: compact 16, regular 24 or tall 36 pixels. */
26
+ readonly height?: PlotHeight | undefined;
27
+ };
28
+ export declare const horizonLimits: {
29
+ readonly series: 40;
30
+ readonly pointsPerSeries: 1000;
31
+ };
32
+ /**
33
+ * Many series in little vertical space, such as per-layer activation statistics. Each series is a short row that folds
34
+ * its values into layers: every layer is a darker step of one hue above zero and of a second hue below zero. The rows
35
+ * share one x axis and one value domain so their colors compare, and the legend states where each band starts.
36
+ */
37
+ export declare function HorizonChart(props: HorizonChartProps): ReactNode;
@@ -0,0 +1,10 @@
1
+ export { BumpChart, bumpLimits } from './bump-chart.tsx';
2
+ export type { BumpChartProps, BumpItem, BumpStage } from './bump-chart.tsx';
3
+ export { CurveChart, curveLimits } from './curve-chart.tsx';
4
+ export type { CurveChartProps, CurvePoint, CurveReference, CurveSeries } from './curve-chart.tsx';
5
+ export { HorizonChart, horizonLimits } from './horizon-chart.tsx';
6
+ export type { HorizonBands, HorizonChartProps, HorizonPoint, HorizonSeries } from './horizon-chart.tsx';
7
+ export { RunsChart, runsLimits } from './runs-chart.tsx';
8
+ export type { RunPoint, RunsChartProps, RunsSummary, TrainingRun } from './runs-chart.tsx';
9
+ export { SlopeChart, slopeLimits } from './slope-chart.tsx';
10
+ export type { SlopeChartProps, SlopeCondition, SlopeItem } from './slope-chart.tsx';
@@ -0,0 +1,21 @@
1
+ import type { ChartPoint } from '../chart.tsx';
2
+ /** A vertex of a drawn line, in the plot's pixels. A null `y` is a missing value: the line breaks there. */
3
+ export type LocatedPoint = {
4
+ readonly x: number;
5
+ readonly y: number | null;
6
+ };
7
+ /** A line the pointer can inspect, by the id of the thing it draws. */
8
+ export type LocatedLine = {
9
+ readonly id: string;
10
+ readonly points: ReadonlyArray<LocatedPoint>;
11
+ };
12
+ /**
13
+ * A chart `locate` for lines: the pointer inspects the line whose drawn path is nearest, between its vertices as well
14
+ * as at them. A line is never a target where it has no value.
15
+ */
16
+ export declare function locateNearestLine({ lines, width, height, }: {
17
+ readonly lines: ReadonlyArray<LocatedLine>;
18
+ /** The size the lines were laid out in. The pointer arrives in rendered pixels and is rescaled to it. */
19
+ readonly width: number;
20
+ readonly height: number;
21
+ }): (point: ChartPoint) => string | undefined;
@@ -0,0 +1,50 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
+ import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
4
+ import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
5
+ export type RunPoint = {
6
+ readonly x: number;
7
+ /** The value recorded at this step, or null where none was. The line breaks there. */
8
+ readonly y: number | null;
9
+ };
10
+ export type TrainingRun = {
11
+ readonly id: string;
12
+ readonly label: string;
13
+ /** Records in strictly increasing `x`. Runs need not share their steps. */
14
+ readonly points: ReadonlyArray<RunPoint>;
15
+ /** The hue this run takes when it is featured, inspected or selected. */
16
+ readonly tone?: ChartTone | undefined;
17
+ };
18
+ /** A line with a band that summarizes all runs, such as their median and quartiles. The application computes it. */
19
+ export type RunsSummary = {
20
+ readonly label: string;
21
+ readonly points: ReadonlyArray<{
22
+ readonly x: number;
23
+ readonly center: number;
24
+ readonly lower: number;
25
+ readonly upper: number;
26
+ }>;
27
+ /** The summary's hue. It defaults to the sixth series hue, so it never shares a color with the gray runs. */
28
+ readonly tone?: ChartTone | undefined;
29
+ };
30
+ export type RunsChartProps = FigureProps & FigureSelectionProps & {
31
+ readonly runs: ReadonlyArray<TrainingRun>;
32
+ /** The ordered variable: a training step or a token count. */
33
+ readonly x: PlotAxis;
34
+ readonly y: PlotAxis;
35
+ /** The ids of the runs to draw in their hue with a name at the end. Every other run stays gray context. */
36
+ readonly featured: ReadonlyArray<string>;
37
+ readonly summary?: RunsSummary | undefined;
38
+ readonly height?: PlotHeight | undefined;
39
+ };
40
+ export declare const runsLimits: {
41
+ readonly runs: 200;
42
+ readonly pointsPerRun: 500;
43
+ };
44
+ /**
45
+ * Many training runs over a step axis, as thin gray lines for context, with the runs named in `featured` drawn on top
46
+ * in their hue and labeled at the end. A summary the application supplies, such as the median and quartiles across
47
+ * runs, is drawn as a line with a band. Pointing at a run, or stepping to it with the arrow keys, shows its name and
48
+ * last recorded value, and `CurveChart` suits a handful of named series.
49
+ */
50
+ export declare function RunsChart(props: RunsChartProps): ReactNode;
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
+ import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
4
+ import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
5
+ /** One condition the items are measured under, such as before and after fine-tuning. */
6
+ export type SlopeCondition = {
7
+ readonly id: string;
8
+ readonly label: string;
9
+ };
10
+ export type SlopeItem = {
11
+ readonly id: string;
12
+ readonly label: string;
13
+ /** One value per condition, in the conditions' order. Null where the item was not measured. The line breaks there. */
14
+ readonly values: ReadonlyArray<number | null>;
15
+ readonly tone?: ChartTone | undefined;
16
+ };
17
+ export type SlopeChartProps = FigureProps & FigureSelectionProps & {
18
+ /** Two to six ordered conditions, drawn as evenly spaced columns. */
19
+ readonly conditions: ReadonlyArray<SlopeCondition>;
20
+ readonly items: ReadonlyArray<SlopeItem>;
21
+ readonly value: PlotAxis;
22
+ readonly height?: PlotHeight | undefined;
23
+ };
24
+ export declare const slopeLimits: {
25
+ readonly items: 40;
26
+ readonly conditionsMin: 2;
27
+ readonly conditionsMax: 6;
28
+ };
29
+ /**
30
+ * The same things measured under two or a few ordered conditions, such as benchmark scores before and after
31
+ * fine-tuning. Each item is one line across the conditions with its value written at both ends, so a reader sees who
32
+ * rose, who fell and by how much. A missing value breaks the line and is said in the readout, and `CurveChart` fits
33
+ * better when the conditions are many or measured along a continuous variable.
34
+ */
35
+ export declare function SlopeChart(props: SlopeChartProps): ReactNode;
@@ -0,0 +1,31 @@
1
+ import type { ChartTone, ValueFormat } from '../../../charts/src/index.ts';
2
+ /** A model as every evaluation component names it. One id per model keeps its hue and linked highlight everywhere. */
3
+ export type EvaluationModel = {
4
+ readonly id: string;
5
+ /** The name a reader sees: "Atlas 13B". */
6
+ readonly label: string;
7
+ /** One short line under the name, such as the checkpoint or the release date. */
8
+ readonly detail?: string | undefined;
9
+ /** Pins the model's hue. Absent takes the next series hue in the order the models are listed. */
10
+ readonly tone?: ChartTone | undefined;
11
+ };
12
+ /** An estimate with the bounds the application computed around it, such as a 95% confidence interval. */
13
+ export type ScoreInterval = {
14
+ readonly value: number;
15
+ readonly low: number;
16
+ readonly high: number;
17
+ };
18
+ /** One measured score: a number, an estimate with its interval, or null where it was not measured. */
19
+ export type ScoreValue = number | ScoreInterval | null;
20
+ /** True for an estimate that carries its interval. */
21
+ export declare function isScoreInterval(value: ScoreValue | ReadonlyArray<number | null>): value is ScoreInterval;
22
+ /** The first id that appears twice, or undefined when every id is unique. */
23
+ export declare function repeatedId(ids: ReadonlyArray<string>): string | undefined;
24
+ /** A value format that always writes its sign, so a gain and a loss never read alike. */
25
+ export declare function signedFormat(format: ValueFormat): ValueFormat;
26
+ /**
27
+ * Points the enclosing chart link at the table row a mouse or the keyboard rests on, so the linked figures mark the
28
+ * same record. Leaving the table clears the link only while it still holds one of this table's rows. Outside a link it
29
+ * does nothing.
30
+ */
31
+ export declare function useLinkedRows(ids: ReadonlyArray<string>): (id: string | undefined) => void;
@@ -0,0 +1,8 @@
1
+ export type { EvaluationModel, ScoreInterval, ScoreValue } from './evaluation-data.ts';
2
+ export type { LeaderboardColumn, LeaderboardColumnKind, LeaderboardValue } from './leaderboard-cells.tsx';
3
+ export type { LeaderboardLabels, LeaderboardProps, LeaderboardRow } from './leaderboard.tsx';
4
+ export { Leaderboard, leaderboardLimits } from './leaderboard.tsx';
5
+ export type { ComparisonRow, ModelComparisonLabels, ModelComparisonProps } from './model-comparison.tsx';
6
+ export { ModelComparison } from './model-comparison.tsx';
7
+ export type { ModelScores, ScoreBreakdownProps } from './score-breakdown.tsx';
8
+ export { ScoreBreakdown } from './score-breakdown.tsx';
@@ -0,0 +1,62 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ValueFormat } from '../../../charts/src/index.ts';
3
+ import type { ScoreInterval } from './evaluation-data.ts';
4
+ /** How a leaderboard column draws its measure. */
5
+ export type LeaderboardColumnKind = 'score' | 'interval' | 'change' | 'trend' | 'heat';
6
+ type ColumnBase = {
7
+ readonly id: string;
8
+ /** The measure with its unit, as the header shows it: "Reasoning accuracy". */
9
+ readonly label: string;
10
+ /** How every value in the column is written. */
11
+ readonly format: ValueFormat;
12
+ /** Whether a larger value is better. It sets which value is marked best and what a rise means in a change column. */
13
+ readonly isHigherBetter: boolean;
14
+ /** The column's width in pixels. Each kind has a default that fits its graphic and text. */
15
+ readonly width?: number | undefined;
16
+ /** True to hide the column on a narrow screen. */
17
+ readonly isSecondary?: boolean | undefined;
18
+ };
19
+ /**
20
+ * One measure of the leaderboard: `score` is a bar from zero, `interval` an estimate with its interval, and `trend` a
21
+ * small line of recent values ranked by the last. The `heat` kind is a shaded number and the `change` kind a signed
22
+ * change with an arrow. Every kind but `change` draws on the column's `domain`, the same for every row.
23
+ */
24
+ export type LeaderboardColumn = (ColumnBase & {
25
+ readonly kind: 'score' | 'interval' | 'trend';
26
+ readonly domain: readonly [number, number];
27
+ }) | (ColumnBase & {
28
+ readonly kind: 'heat';
29
+ readonly domain: readonly [number, number];
30
+ /** `sequential` deepens one hue with the value; `diverging` uses two hues around zero. Defaults to sequential. */
31
+ readonly palette?: 'sequential' | 'diverging' | undefined;
32
+ }) | (ColumnBase & {
33
+ readonly kind: 'change';
34
+ });
35
+ /**
36
+ * A model's value in one column. It is a number for `score`, `heat` and `change`, an estimate with its interval for
37
+ * `interval`, the recent values in order for `trend`, or null where it was not measured.
38
+ */
39
+ export type LeaderboardValue = number | ScoreInterval | ReadonlyArray<number | null> | null;
40
+ export declare const columnWidths: {
41
+ readonly score: 160;
42
+ readonly interval: 300;
43
+ readonly change: 128;
44
+ readonly trend: 160;
45
+ readonly heat: 112;
46
+ };
47
+ /** The sentence that says why a value does not fit its column, or undefined when it does. */
48
+ export declare function valueKindProblem(column: LeaderboardColumn, value: LeaderboardValue): string | undefined;
49
+ /** The number a row is ranked by in a column: the value, the estimate, or the last recorded trend value. */
50
+ export declare function rankedValue(value: LeaderboardValue): number | null;
51
+ export type MeasureCellProps = {
52
+ readonly column: LeaderboardColumn;
53
+ readonly value: LeaderboardValue;
54
+ readonly model: string;
55
+ readonly locale: string;
56
+ readonly isBest: boolean;
57
+ /** The words a screen reader hears after the best value. */
58
+ readonly bestLabel: string;
59
+ };
60
+ /** One measure of one model, drawn by its column's kind. The best value of the column is set in bold and named. */
61
+ export declare function MeasureCell({ isBest, bestLabel, ...cell }: MeasureCellProps): ReactNode;
62
+ export {};
@@ -0,0 +1,59 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FigureProps } from '../../../charts/src/index.ts';
3
+ import type { DataTableSelectionDetails, DataTableSort, DataTableSortDetails } from '../../../collections/src/index.ts';
4
+ import type { EvaluationModel } from './evaluation-data.ts';
5
+ import type { LeaderboardColumn, LeaderboardValue } from './leaderboard-cells.tsx';
6
+ /** One model's results: its values by column id. A column left out reads as not measured. */
7
+ export type LeaderboardRow = {
8
+ /** The id of a model in `models`. */
9
+ readonly model: string;
10
+ /** The model's place as the application ranked it. Ties may share a rank. */
11
+ readonly rank?: number | undefined;
12
+ readonly values: Readonly<Record<string, LeaderboardValue>>;
13
+ };
14
+ /** The words the leaderboard shows that are not data. */
15
+ export type LeaderboardLabels = {
16
+ readonly model: string;
17
+ readonly rank: string;
18
+ /** Heard by a screen reader after the best value of a column. */
19
+ readonly best: string;
20
+ readonly bestNote: string;
21
+ readonly higherIsBetter: string;
22
+ readonly lowerIsBetter: string;
23
+ /** Starts the name of a row's checkbox: "Select Atlas 13B". */
24
+ readonly select: string;
25
+ };
26
+ export type LeaderboardProps = FigureProps & {
27
+ /**
28
+ * Every model the page shows, in the order their hues are assigned. The table keeps one tone scope over them, so a
29
+ * figure under a `ToneScope` with the same ids shows each model in the same hue.
30
+ */
31
+ readonly models: ReadonlyArray<EvaluationModel>;
32
+ readonly columns: ReadonlyArray<LeaderboardColumn>;
33
+ /** One row per model with results, in the application's order. */
34
+ readonly rows: ReadonlyArray<LeaderboardRow>;
35
+ /**
36
+ * The column the rows are ordered by. Absent keeps the order given, which is the rank order. Missing values sort
37
+ * last.
38
+ */
39
+ readonly sort?: DataTableSort | undefined;
40
+ /** Hears a press on a sortable header. Without it the headers do not sort. */
41
+ readonly onSortChange?: ((sort: DataTableSort | undefined, details: DataTableSortDetails) => void) | undefined;
42
+ /** The ids of the checked models. */
43
+ readonly selected?: ReadonlyArray<string> | undefined;
44
+ /** Hears a press on a row's checkbox. Without it the rows have no checkboxes. */
45
+ readonly onSelectedChange?: ((selected: ReadonlyArray<string>, details: DataTableSelectionDetails) => void) | undefined;
46
+ readonly labels?: Partial<LeaderboardLabels> | undefined;
47
+ };
48
+ /** The most models and measure columns a leaderboard shows. Larger input is refused. */
49
+ export declare const leaderboardLimits: {
50
+ readonly models: 100;
51
+ readonly columns: 10;
52
+ };
53
+ /**
54
+ * A ranked table of models over benchmarks, as an evaluation paper or dashboard shows it, where the application owns
55
+ * the order, the sort and the checked models. Each measure column draws its values with a table cell graphic on one
56
+ * shared scale and writes the exact value beside it. The best value of each column is set in bold and named for screen
57
+ * readers, and inside a `ChartLink`, resting on a row marks it in the linked figures.
58
+ */
59
+ export declare function Leaderboard(props: LeaderboardProps): ReactNode;