@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.
- package/README.md +306 -33
- package/dist/ai.js +4 -4
- package/dist/catalog.json +2382 -33
- package/dist/categorical-values-DdfGIowV.js +107 -0
- package/dist/cells--Bd1fQFR.js +384 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2958
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -781
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -655
- package/dist/charts/hierarchy.js +1 -121
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +3 -644
- package/dist/charts/plot.js +15 -0
- package/dist/charts/relationship.js +1 -0
- package/dist/charts/text.js +1 -0
- package/dist/charts/timeline.js +1 -266
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/collections.js +1 -2195
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
- package/dist/embedding-map-CGM_k6lC.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-wRkIEAwe.js +270 -0
- package/dist/forms/dates.js +1 -810
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-CVA4SOy_.js +598 -0
- package/dist/kits/evaluation.js +431 -0
- package/dist/kits/explainers.js +452 -0
- package/dist/kits/interpretability.js +1033 -0
- package/dist/kits/operations.js +239 -0
- package/dist/kits/training.js +335 -0
- package/dist/label-place-Z0fryBZb.js +42 -0
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
- package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
- package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
- package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
- package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
- package/dist/packages/charts/src/cartesian/index.d.ts +5 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
- package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
- package/dist/packages/charts/src/cartesian/time-series.d.ts +60 -36
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +1 -1
- package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
- package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
- package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
- package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
- package/dist/packages/charts/src/cells/index.d.ts +11 -0
- package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
- package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
- package/dist/packages/charts/src/chart-frame.d.ts +14 -7
- package/dist/packages/charts/src/chart-grid.d.ts +19 -0
- package/dist/packages/charts/src/chart-input.d.ts +1 -9
- package/dist/packages/charts/src/chart-link.d.ts +56 -0
- package/dist/packages/charts/src/chart.d.ts +0 -8
- package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
- package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
- package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
- package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
- package/dist/packages/charts/src/comparison/index.d.ts +6 -0
- package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
- package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
- package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
- package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
- package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
- package/dist/packages/charts/src/distribution/index.d.ts +11 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
- package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
- package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
- package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
- package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
- package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
- package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
- package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
- package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
- package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
- package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
- package/dist/packages/charts/src/graph/index.d.ts +6 -2
- package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
- package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
- package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
- package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
- package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
- package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
- package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
- package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
- package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
- package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
- package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
- package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
- package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
- package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
- package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
- package/dist/packages/charts/src/image/image-input.d.ts +27 -0
- package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
- package/dist/packages/charts/src/image/index.d.ts +7 -0
- package/dist/packages/charts/src/index.d.ts +15 -1
- package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
- package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
- package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
- package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
- package/dist/packages/charts/src/matrix/index.d.ts +14 -3
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
- package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
- package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
- package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
- package/dist/packages/charts/src/plot/contours.d.ts +45 -0
- package/dist/packages/charts/src/plot/index.d.ts +49 -0
- package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
- package/dist/packages/charts/src/plot/locate.d.ts +18 -0
- package/dist/packages/charts/src/plot/path.d.ts +39 -0
- package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
- package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
- package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
- package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
- package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
- package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
- package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
- package/dist/packages/charts/src/plot/scale.d.ts +48 -0
- package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
- package/dist/packages/charts/src/plot-width.d.ts +3 -2
- package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
- package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
- package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
- package/dist/packages/charts/src/relationship/index.d.ts +11 -0
- package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
- package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
- package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
- package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
- package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
- package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
- package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
- package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
- package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
- package/dist/packages/charts/src/spec/figure.d.ts +12 -0
- package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
- package/dist/packages/charts/src/spec/index.d.ts +10 -0
- package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
- package/dist/packages/charts/src/text/index.d.ts +11 -0
- package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
- package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
- package/dist/packages/charts/src/text/token-links.d.ts +49 -0
- package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
- package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
- package/dist/packages/charts/src/text/token-text.d.ts +39 -0
- package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
- package/dist/packages/charts/src/timeline/index.d.ts +3 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +24 -13
- package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
- package/dist/packages/charts/src/transforms/density.d.ts +53 -0
- package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
- package/dist/packages/charts/src/transforms/index.d.ts +19 -0
- package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
- package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
- package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
- package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
- package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
- package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
- package/dist/packages/charts/src/transforms/values.d.ts +70 -0
- package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
- package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
- package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
- package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
- package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
- package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
- package/dist/packages/charts/src/trend/index.d.ts +10 -0
- package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
- package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
- package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
- package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
- package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
- package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
- package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
- package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
- package/dist/packages/kits/src/explainers/index.d.ts +8 -0
- package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
- package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
- package/dist/packages/kits/src/explainers/term.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
- package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
- package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
- package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
- package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
- package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
- package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
- package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
- package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
- package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
- package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
- package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
- package/dist/packages/kits/src/operations/index.d.ts +6 -0
- package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
- package/dist/packages/kits/src/training/index.d.ts +8 -0
- package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
- package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
- package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
- package/dist/packages/kits/src/training/run-state.d.ts +7 -0
- package/dist/packages/kits/src/training/run-table.d.ts +63 -0
- package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
- package/dist/packages/kits/src/training/runs.d.ts +34 -0
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-BEuoOHbs.js +911 -0
- package/dist/plot-marks-A64v7aTw.js +226 -0
- package/dist/plot-surface-CJTIqtck.js +51 -0
- package/dist/plot-width-DcqtSgzb.js +124 -0
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-CWA8VeUR.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/slope-chart-DT22h_ym.js +1279 -0
- package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
- package/dist/src-D5NXRJZe.js +2195 -0
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/styles2.css +453 -62
- package/dist/time-series-IB3CB93O.js +2668 -0
- package/dist/token-heatmap-C00DnoNO.js +1354 -0
- package/dist/token-predictions-Cxx29iDr.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/tree-diagram-DsckNKaW.js +1629 -0
- package/dist/treemap-9_DpLCW9.js +472 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-BhPHKXsN.js +1291 -0
- package/dist/waterfall-CGksuTy5.js +576 -0
- package/package.json +57 -4
- package/recipes/allocation-report.tsx +15 -7
- package/skills/extend-elements/SKILL.md +60 -0
- package/skills/review-elements/SKILL.md +43 -1
- package/skills/upgrade-elements/SKILL.md +3 -1
- package/skills/upgrade-elements/references/releases.md +184 -0
- package/skills/use-elements/SKILL.md +19 -13
- package/skills/use-elements/references/charts.md +362 -41
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/kits.md +198 -0
- package/dist/categorical-values-BXi-rJuv.js +0 -74
- package/dist/chart-data-CIJVWCYt.js +0 -21
- package/dist/chart-frame-BaxKn_MB.js +0 -236
- package/dist/chart-input-Bm82_9Rd.js +0 -22
- package/dist/chart-theme-4zprJ3rW.js +0 -404
- package/dist/plot-width-v2c_rA20.js +0 -63
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
4
|
+
import type { MatrixPresetProps } from './matrix-presets.ts';
|
|
5
|
+
/** A day of the week, for the row a week starts on. */
|
|
6
|
+
export type CalendarWeekday = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday';
|
|
7
|
+
/** One day's value. A day in the range with no entry, or with a null value, draws hollow as missing. */
|
|
8
|
+
export type CalendarDay = {
|
|
9
|
+
/** The civil date, as `YYYY-MM-DD`. It is also the cell's id for selection. */
|
|
10
|
+
readonly date: string;
|
|
11
|
+
readonly value: number | null;
|
|
12
|
+
};
|
|
13
|
+
export type CalendarHeatmapProps = MatrixPresetProps & {
|
|
14
|
+
readonly days: ReadonlyArray<CalendarDay>;
|
|
15
|
+
/** The first and last civil dates drawn, inclusive, as `YYYY-MM-DD`. */
|
|
16
|
+
readonly range: {
|
|
17
|
+
readonly from: string;
|
|
18
|
+
readonly to: string;
|
|
19
|
+
};
|
|
20
|
+
/** The weekday in the top row, as the reader's calendar starts its weeks. */
|
|
21
|
+
readonly weekStartsOn: CalendarWeekday;
|
|
22
|
+
/** What one day's value is, with its unit: "Evaluation runs". */
|
|
23
|
+
readonly valueLabel: string;
|
|
24
|
+
readonly valueFormat: ValueFormat;
|
|
25
|
+
/** The color domain. Absent spans zero to the largest value. */
|
|
26
|
+
readonly domain?: NumericDomain | undefined;
|
|
27
|
+
};
|
|
28
|
+
/** The longest range: three years of days. */
|
|
29
|
+
export declare const calendarHeatmapLimits: {
|
|
30
|
+
readonly days: 1096;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* One supplied value per civil date over a range, with weeks as columns, weekdays as rows and the months named above:
|
|
34
|
+
* daily evaluation runs, incidents, training jobs. Lightness of one hue shows the value; a day with no value is hollow.
|
|
35
|
+
* Dates are `YYYY-MM-DD` strings, and the week start is an input, so the chart reads no clock and no time zone.
|
|
36
|
+
*/
|
|
37
|
+
export declare function CalendarHeatmap(props: CalendarHeatmapProps): ReactNode;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
2
3
|
import type { HeatmapScale } from './heatmap-scale.ts';
|
|
3
4
|
export type ColorLegendProps = HeatmapScale & {
|
|
5
|
+
/** What the color measures, with its unit and any normalization: "Share of actual class (row-normalized)". */
|
|
4
6
|
readonly label: string;
|
|
5
|
-
readonly
|
|
7
|
+
readonly valueFormat: ValueFormat;
|
|
8
|
+
readonly locale: string;
|
|
6
9
|
};
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The key to a heatmap's colors: what they measure, the domain's two ends and, for a diverging palette, the neutral
|
|
12
|
+
* zero. Matrix and TokenHeatmap draw one; place one beside a custom heatmap that uses the same scale.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ColorLegend({ label, domain, palette, valueFormat, locale }: ColorLegendProps): ReactNode;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { MatrixPresetProps } from './matrix-presets.ts';
|
|
4
|
+
import type { MatrixCellValuesProps } from './matrix-types.ts';
|
|
5
|
+
/** A class a classifier can predict. */
|
|
6
|
+
export type ConfusionClass = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
};
|
|
10
|
+
export type ConfusionMatrixProps = MatrixPresetProps & MatrixCellValuesProps & {
|
|
11
|
+
/** The classes, in the order both axes list them. */
|
|
12
|
+
readonly classes: ReadonlyArray<ConfusionClass>;
|
|
13
|
+
/** Example counts: one line per actual class, one count per predicted class, both in `classes` order. */
|
|
14
|
+
readonly counts: ReadonlyArray<ReadonlyArray<number>>;
|
|
15
|
+
/**
|
|
16
|
+
* A value of `none` colors each cell by its count. A value of `row` colors it by its share of the actual class, the
|
|
17
|
+
* row's count divided by the row's total, and says so in the legend. Absent means none.
|
|
18
|
+
*/
|
|
19
|
+
readonly normalize?: 'none' | 'row' | undefined;
|
|
20
|
+
/** What one count is: "Examples", "Images". Absent means examples. */
|
|
21
|
+
readonly valueLabel?: string | undefined;
|
|
22
|
+
/** How a count is written. Absent writes whole numbers. */
|
|
23
|
+
readonly valueFormat?: ValueFormat | undefined;
|
|
24
|
+
/** How a share of the actual class is written. Absent writes a percentage with one decimal. */
|
|
25
|
+
readonly shareFormat?: ValueFormat | undefined;
|
|
26
|
+
};
|
|
27
|
+
/** The largest number of classes. Each side of the matrix holds every class. */
|
|
28
|
+
export declare const confusionMatrixLimits: {
|
|
29
|
+
readonly classes: 64;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A classifier's counts of actual against predicted class: rows are the actual class, columns the predicted one, and
|
|
33
|
+
* the outlined diagonal holds the correct predictions. Lightness shows the count, or each count's share of its actual
|
|
34
|
+
* class with `normalize="row"`. The application supplies the counts; the chart only divides a row by its own total.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ConfusionMatrix(props: ConfusionMatrixProps): ReactNode;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { MatrixPresetProps } from './matrix-presets.ts';
|
|
4
|
+
import type { MatrixCellValuesProps } from './matrix-types.ts';
|
|
5
|
+
/** A variable whose pairwise correlations the matrix shows. */
|
|
6
|
+
export type CorrelationVariable = {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
};
|
|
10
|
+
export type CorrelationMatrixProps = MatrixPresetProps & MatrixCellValuesProps & {
|
|
11
|
+
/** The variables, in the order both axes list them. */
|
|
12
|
+
readonly variables: ReadonlyArray<CorrelationVariable>;
|
|
13
|
+
/**
|
|
14
|
+
* Supplied coefficients in [-1, 1]: one line per variable, one value per variable, in `variables` order. The table
|
|
15
|
+
* must be symmetric. Null marks a pair that was not computed.
|
|
16
|
+
*/
|
|
17
|
+
readonly coefficients: ReadonlyArray<ReadonlyArray<number | null>>;
|
|
18
|
+
/** `lower` draws each pair once, below the diagonal. Absent means full. */
|
|
19
|
+
readonly triangle?: 'full' | 'lower' | undefined;
|
|
20
|
+
/** What the coefficient is: "Pearson correlation", "Spearman rank correlation". */
|
|
21
|
+
readonly valueLabel?: string | undefined;
|
|
22
|
+
/** How a coefficient is written. Absent writes two decimals. */
|
|
23
|
+
readonly valueFormat?: ValueFormat | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** The largest number of variables. */
|
|
26
|
+
export declare const correlationMatrixLimits: {
|
|
27
|
+
readonly variables: 64;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Supplied correlation coefficients between variables, such as features, probes or metrics, on a diverging palette
|
|
31
|
+
* fixed at -1 to 1 with zero neutral. The diagonal is drawn in gray as context, and `triangle="lower"` shows each pair
|
|
32
|
+
* once. Asymmetric or out-of-range input is refused; the application computes the coefficients.
|
|
33
|
+
*/
|
|
34
|
+
export declare function CorrelationMatrix(props: CorrelationMatrixProps): ReactNode;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
2
|
+
/** Sequential lightness of one hue for a magnitude, or two hues around a neutral zero for a signed value. */
|
|
1
3
|
export type HeatmapPalette = 'sequential' | 'diverging';
|
|
4
|
+
/** The color domain of a heatmap and how its values map to color. Values outside the domain draw no color. */
|
|
2
5
|
export type HeatmapScale = {
|
|
3
|
-
readonly domain:
|
|
6
|
+
readonly domain: NumericDomain;
|
|
4
7
|
readonly palette: HeatmapPalette;
|
|
5
8
|
};
|
|
9
|
+
/** Why a color scale cannot be drawn, or null when it can. */
|
|
6
10
|
export declare function heatmapScaleProblem({ domain, palette }: HeatmapScale): string | null;
|
|
7
|
-
|
|
11
|
+
/** Whether a value lies inside the color domain, endpoints included. */
|
|
12
|
+
export declare function isHeatmapValueInDomain(value: number, domain: NumericDomain): boolean;
|
|
13
|
+
/** The fill of a value inside the domain: more of the hue for a larger magnitude. */
|
|
8
14
|
export declare function heatmapColor(value: number, { domain, palette }: HeatmapScale): string;
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
export type { AttentionMatrixProps, AttentionToken } from './attention-matrix.tsx';
|
|
2
|
+
export { AttentionMatrix, attentionMatrixLimits } from './attention-matrix.tsx';
|
|
3
|
+
export type { CalendarDay, CalendarHeatmapProps, CalendarWeekday } from './calendar-heatmap.tsx';
|
|
4
|
+
export { CalendarHeatmap, calendarHeatmapLimits } from './calendar-heatmap.tsx';
|
|
1
5
|
export type { ColorLegendProps } from './color-legend.tsx';
|
|
2
6
|
export { ColorLegend } from './color-legend.tsx';
|
|
7
|
+
export type { ConfusionClass, ConfusionMatrixProps } from './confusion-matrix.tsx';
|
|
8
|
+
export { ConfusionMatrix, confusionMatrixLimits } from './confusion-matrix.tsx';
|
|
9
|
+
export type { CorrelationMatrixProps, CorrelationVariable } from './correlation-matrix.tsx';
|
|
10
|
+
export { CorrelationMatrix, correlationMatrixLimits } from './correlation-matrix.tsx';
|
|
3
11
|
export type { HeatmapPalette, HeatmapScale } from './heatmap-scale.ts';
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
12
|
+
export { matrixLimits } from './matrix-figure.tsx';
|
|
13
|
+
export type { MatrixAxisItem, MatrixCell, MatrixCellRange, MatrixCellRangeDetails, MatrixCellValuesProps, MatrixCoordinate, } from './matrix-types.ts';
|
|
14
|
+
export { matrixCellId } from './matrix-types.ts';
|
|
15
|
+
export type { MatrixProps } from './matrix.tsx';
|
|
16
|
+
export { Matrix } from './matrix.tsx';
|
|
6
17
|
export type { HeatmapToken, TokenHeatmapProps } from './token-heatmap.tsx';
|
|
7
|
-
export {
|
|
18
|
+
export { TokenHeatmap, tokenHeatmapLimits } from './token-heatmap.tsx';
|
|
@@ -1,4 +1,28 @@
|
|
|
1
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
2
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
1
3
|
import type { MatrixCell } from './matrix-types.ts';
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export
|
|
4
|
+
/** How many characters of a value fit inside a square cell of this size without touching its border. */
|
|
5
|
+
export declare function cellTextCapacity(size: number): number;
|
|
6
|
+
export type CellTextInput = {
|
|
7
|
+
readonly value: number;
|
|
8
|
+
readonly locale: string;
|
|
9
|
+
readonly format: ValueFormat;
|
|
10
|
+
/** The most characters the cell holds, from `cellTextCapacity`. */
|
|
11
|
+
readonly capacity: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The text a square cell writes for its value: the supplied format when it fits, else the value rounded to whole units,
|
|
15
|
+
* else in compact notation. Rounding is skipped where it would write a nonzero value as zero. Undefined means no form
|
|
16
|
+
* fits, and the cell shows a dot while the readout keeps the exact value.
|
|
17
|
+
*/
|
|
18
|
+
export declare function cellValueText({ value, locale, format, capacity }: CellTextInput): string | undefined;
|
|
19
|
+
/** What a square cell writes inside itself: its value text, or the glyph for its state. */
|
|
20
|
+
export declare function matrixCellGlyph(cell: MatrixCell, text: string | undefined, isOutsideDomain: boolean): string;
|
|
21
|
+
export type MatrixValueTextInput = {
|
|
22
|
+
readonly cell: MatrixCell | undefined;
|
|
23
|
+
readonly domain: NumericDomain;
|
|
24
|
+
readonly locale: string;
|
|
25
|
+
readonly format: ValueFormat;
|
|
26
|
+
};
|
|
27
|
+
/** A cell's exact value, or its state and reason, as a reader sees it in the readout and the exact-value table. */
|
|
28
|
+
export declare function matrixValueText({ cell, domain, locale, format }: MatrixValueTextInput): string;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { FigureFrameInput, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { HeatmapScale } from './heatmap-scale.ts';
|
|
5
|
+
import type { MatrixMarking } from './matrix-mark.tsx';
|
|
6
|
+
import type { MatrixAxisItem, MatrixCell, MatrixCellRangeProps, MatrixCellValuesProps } from './matrix-types.ts';
|
|
7
|
+
/** The render limit every matrix shares. Larger input shows an explicit error; the application supplies a window. */
|
|
8
|
+
export declare const matrixLimits: {
|
|
9
|
+
readonly cells: 4096;
|
|
10
|
+
};
|
|
11
|
+
export type MatrixFigureProps = FigureFrameInput & FigureSelectionProps & MatrixCellRangeProps & MatrixCellValuesProps & HeatmapScale & {
|
|
12
|
+
readonly emptyLabel: string;
|
|
13
|
+
readonly rows: ReadonlyArray<MatrixAxisItem>;
|
|
14
|
+
readonly columns: ReadonlyArray<MatrixAxisItem>;
|
|
15
|
+
readonly cells: ReadonlyArray<MatrixCell>;
|
|
16
|
+
/** The exact value format for readouts and the exact-value table. */
|
|
17
|
+
readonly valueFormat: ValueFormat;
|
|
18
|
+
/** What a cell writes inside itself, when it differs from the exact value, such as a share of its row. */
|
|
19
|
+
readonly glyphFormat?: ValueFormat | undefined;
|
|
20
|
+
/** What the color measures, for the legend and the table. */
|
|
21
|
+
readonly valueLabel: string;
|
|
22
|
+
readonly variant: 'values' | 'strip';
|
|
23
|
+
/** What rows and columns stand for, shown at the corner and above the columns: "Actual", "Predicted". */
|
|
24
|
+
readonly rowTitle?: string | undefined;
|
|
25
|
+
readonly columnTitle?: string | undefined;
|
|
26
|
+
/** The nouns a range summary uses for a row and a column. */
|
|
27
|
+
readonly rowNoun?: string | undefined;
|
|
28
|
+
readonly columnNoun?: string | undefined;
|
|
29
|
+
/** Token text and other literals read best in the mono face. */
|
|
30
|
+
readonly axisFont?: 'text' | 'mono' | undefined;
|
|
31
|
+
/** Strip headers clip to their column, or run past it for sparse labels such as months over weeks. */
|
|
32
|
+
readonly headers?: 'clip' | 'overflow' | undefined;
|
|
33
|
+
readonly marking?: ((row: MatrixAxisItem, column: MatrixAxisItem) => MatrixMarking | undefined) | undefined;
|
|
34
|
+
/** The coordinate part of a cell's sentence. Absent writes "row → column". */
|
|
35
|
+
readonly cellLabel?: ((row: MatrixAxisItem, column: MatrixAxisItem) => string) | undefined;
|
|
36
|
+
/** A cell's exact value text. Absent writes the value in the value format, or the cell's state. */
|
|
37
|
+
readonly valueText?: ((cell: MatrixCell | undefined) => string) | undefined;
|
|
38
|
+
/** A cell's copied text. Absent copies the supplied number exactly, and nothing for a cell without one. */
|
|
39
|
+
readonly copyText?: ((cell: MatrixCell | undefined) => string) | undefined;
|
|
40
|
+
/** More lines for the key under the plot, such as "Outlined: correct predictions". */
|
|
41
|
+
readonly notes?: ReadonlyArray<string> | undefined;
|
|
42
|
+
/** The preset's own reason to refuse its input, checked before the shared rules. */
|
|
43
|
+
readonly problem?: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The drawing every matrix shares: headers, cells, the keyboard and pointer inspection, the controlled selection and
|
|
47
|
+
* cell range, copying, the legend, the readout and the exact-value table. Matrix and its presets set what each cell
|
|
48
|
+
* means; this draws it.
|
|
49
|
+
*/
|
|
50
|
+
export declare function MatrixFigure(props: MatrixFigureProps): ReactNode;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as stylex from '@stylexjs/stylex';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { MatrixAxisItem, MatrixCell } from './matrix-types.ts';
|
|
4
|
+
/** How a preset marks a coordinate: left blank, outlined (a confusion diagonal), or drawn in gray as context. */
|
|
5
|
+
export type MatrixMarking = 'hidden' | 'outlined' | 'context';
|
|
6
|
+
/** One drawn coordinate as both matrix drawings read it. */
|
|
7
|
+
export type MatrixCellView = {
|
|
8
|
+
/** The chart item id: the supplied cell's id, or the coordinate's id where no cell was supplied. */
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly row: MatrixAxisItem;
|
|
11
|
+
readonly column: MatrixAxisItem;
|
|
12
|
+
readonly cell: MatrixCell | undefined;
|
|
13
|
+
/** The full sentence: coordinate and exact value. */
|
|
14
|
+
readonly label: string;
|
|
15
|
+
/** The square cell's text: its short value or its state glyph. */
|
|
16
|
+
readonly glyph: string;
|
|
17
|
+
readonly fill: string | undefined;
|
|
18
|
+
readonly isOutside: boolean;
|
|
19
|
+
readonly marking: MatrixMarking | undefined;
|
|
20
|
+
/** The range's outer edges this cell draws, as an inset shadow. */
|
|
21
|
+
readonly edges: string | undefined;
|
|
22
|
+
readonly isSelected: boolean;
|
|
23
|
+
readonly isInspected: boolean;
|
|
24
|
+
readonly isCursor: boolean;
|
|
25
|
+
};
|
|
26
|
+
export type MatrixMarkProps = {
|
|
27
|
+
readonly view: MatrixCellView;
|
|
28
|
+
/** True when the application takes selection requests: a supplied cell is then a button. */
|
|
29
|
+
readonly isSelectable: boolean;
|
|
30
|
+
readonly appearance: ReadonlyArray<stylex.StyleXStyles | false | undefined>;
|
|
31
|
+
readonly children?: ReactNode;
|
|
32
|
+
};
|
|
33
|
+
/** One inspectable matrix cell with its range edges, selection and keyboard cursor, in either drawing. */
|
|
34
|
+
export declare function MatrixMark({ view, isSelectable, appearance, children }: MatrixMarkProps): ReactNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
2
|
+
import type { MatrixAxisItem, MatrixCellRangeProps } from './matrix-types.ts';
|
|
3
|
+
/** What every matrix preset accepts besides its own data: the figure, the selected cell and the cell range. */
|
|
4
|
+
export type MatrixPresetProps = FigureProps & FigureSelectionProps & MatrixCellRangeProps;
|
|
5
|
+
export type DenseInput = {
|
|
6
|
+
readonly rows: ReadonlyArray<MatrixAxisItem>;
|
|
7
|
+
readonly columns: ReadonlyArray<MatrixAxisItem>;
|
|
8
|
+
/** One line per row, one value per column. */
|
|
9
|
+
readonly values: ReadonlyArray<ReadonlyArray<number | null>>;
|
|
10
|
+
/** What rows and columns are called in the messages: "classes", "variables". */
|
|
11
|
+
readonly noun: string;
|
|
12
|
+
/** The largest number of rows or columns the preset draws. */
|
|
13
|
+
readonly limit: number;
|
|
14
|
+
};
|
|
15
|
+
/** Why a row-by-column table of values cannot be drawn: too large, duplicate identities or a ragged shape. */
|
|
16
|
+
export declare function denseProblem({ rows, columns, values, noun, limit }: DenseInput): string | undefined;
|
|
17
|
+
/** The value at a row and column of a dense table, or null where the line holds none. */
|
|
18
|
+
export declare function denseValue(values: DenseInput['values'], row: number, column: number): number | null;
|
|
19
|
+
/** Token text with each space, newline and tab drawn as a visible symbol, for a header. Readouts quote exact text. */
|
|
20
|
+
export declare function visibleText(text: string): string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { CellBounds } from '@ui-sdk/core';
|
|
2
|
+
import type { MatrixAxisItem, MatrixCellRange, MatrixCoordinate } from './matrix-types.ts';
|
|
3
|
+
/** The rows and columns a range is measured against, in drawn order. */
|
|
4
|
+
export type RangeAxes = {
|
|
5
|
+
readonly rows: ReadonlyArray<MatrixAxisItem>;
|
|
6
|
+
readonly columns: ReadonlyArray<MatrixAxisItem>;
|
|
7
|
+
};
|
|
8
|
+
/** Why a supplied range cannot be drawn, or undefined when every corner names a supplied row and column. */
|
|
9
|
+
export declare function rangeProblem(range: MatrixCellRange | null, { rows, columns }: RangeAxes): string | undefined;
|
|
10
|
+
/** The inclusive rows and columns a range covers, from zero. */
|
|
11
|
+
export declare function rangeBounds(range: MatrixCellRange, { rows, columns }: RangeAxes): CellBounds;
|
|
12
|
+
/** Whether a coordinate lies inside the bounds. */
|
|
13
|
+
export declare function isInBounds(bounds: CellBounds, row: number, column: number): boolean;
|
|
14
|
+
export type RangeKeyInput = RangeAxes & {
|
|
15
|
+
readonly key: string;
|
|
16
|
+
readonly range: MatrixCellRange | null;
|
|
17
|
+
/** The keyboard cursor, where a new range starts. */
|
|
18
|
+
readonly from: MatrixCoordinate;
|
|
19
|
+
/** True in right-to-left text, where Left and Right swap. */
|
|
20
|
+
readonly isReversed: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The range after Shift with a key: an arrow grows or shrinks it by one cell from its far corner, Home and End take it
|
|
24
|
+
* to the row's ends. Undefined for any other key. The far corner stops at the matrix's edges.
|
|
25
|
+
*/
|
|
26
|
+
export declare function extendRange({ key, range, from, isReversed, rows, columns, }: RangeKeyInput): MatrixCellRange | undefined;
|
|
27
|
+
/** The range that covers every row and column. */
|
|
28
|
+
export declare function wholeRange({ rows, columns }: RangeAxes): MatrixCellRange | undefined;
|
|
29
|
+
export type RangeTextInput = RangeAxes & {
|
|
30
|
+
readonly bounds: CellBounds;
|
|
31
|
+
/** A cell's exact value as copied text: empty for a cell with no value. */
|
|
32
|
+
readonly read: (coordinate: MatrixCoordinate) => string;
|
|
33
|
+
};
|
|
34
|
+
/** The range's exact values as tab-separated text, one line per row, ready to paste into a spreadsheet. */
|
|
35
|
+
export declare function rangeText({ bounds, rows, columns, read }: RangeTextInput): string;
|
|
36
|
+
export type RangeSummaryInput = RangeAxes & {
|
|
37
|
+
readonly bounds: CellBounds;
|
|
38
|
+
/** How many drawn cells the range holds. */
|
|
39
|
+
readonly count: number;
|
|
40
|
+
/** What a row and a column are called in this matrix: "actual class", "predicted class". */
|
|
41
|
+
readonly rowNoun?: string | undefined;
|
|
42
|
+
readonly columnNoun?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
/** The range as a reader hears it: "6 cells selected: rows Cat to Dog, columns Bird to Fish". */
|
|
45
|
+
export declare function rangeSummary({ bounds, rows, columns, count, rowNoun, columnNoun, }: RangeSummaryInput): string;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
import type { MatrixAxisItem, MatrixCell } from './matrix-types.ts';
|
|
6
|
-
type StripProps = HeatmapScale & {
|
|
2
|
+
import type { MatrixCellView } from './matrix-mark.tsx';
|
|
3
|
+
import type { MatrixAxisItem } from './matrix-types.ts';
|
|
4
|
+
export type MatrixStripProps = {
|
|
7
5
|
readonly rows: ReadonlyArray<MatrixAxisItem>;
|
|
8
6
|
readonly columns: ReadonlyArray<MatrixAxisItem>;
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly
|
|
12
|
-
readonly
|
|
13
|
-
|
|
7
|
+
readonly rowTitle?: string | undefined;
|
|
8
|
+
readonly columnTitle?: string | undefined;
|
|
9
|
+
readonly font: 'text' | 'mono';
|
|
10
|
+
readonly headers: 'clip' | 'overflow';
|
|
11
|
+
/** The drawn cell at a coordinate, or undefined where the matrix leaves a blank. */
|
|
12
|
+
readonly viewAt: (rowId: string, columnId: string) => MatrixCellView | undefined;
|
|
13
|
+
readonly isSelectable: boolean;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* Draws a matrix as compact intensity rows that fill the available width, such as months across categories
|
|
17
|
-
*
|
|
16
|
+
* Draws a matrix as compact intensity rows that fill the available width, such as months across categories or weeks
|
|
17
|
+
* across weekdays.
|
|
18
18
|
*/
|
|
19
|
-
export declare function MatrixStrip({ rows, columns,
|
|
20
|
-
export {};
|
|
19
|
+
export declare function MatrixStrip({ rows, columns, rowTitle, columnTitle, font, headers, viewAt, isSelectable, }: MatrixStripProps): ReactNode;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CellRangeReason } from '@ui-sdk/core';
|
|
2
|
+
/** A row or a column of a matrix, with the identity selection and linked views use. */
|
|
1
3
|
export type MatrixAxisItem = {
|
|
2
4
|
readonly id: string;
|
|
3
5
|
/** The full name used in headers, inspection and exact values. */
|
|
@@ -5,6 +7,10 @@ export type MatrixAxisItem = {
|
|
|
5
7
|
/** A concise header, such as "J" for January, that a compact strip shows. Absent uses the label. */
|
|
6
8
|
readonly axisLabel?: string | undefined;
|
|
7
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* One supplied coordinate: a measured value, a value masked by the analysis (such as a future token), or a value that
|
|
12
|
+
* was not recorded. Masked and missing cells name their reason, and neither is ever drawn as zero.
|
|
13
|
+
*/
|
|
8
14
|
export type MatrixCell = {
|
|
9
15
|
readonly id: string;
|
|
10
16
|
readonly rowId: string;
|
|
@@ -19,3 +25,37 @@ export type MatrixCell = {
|
|
|
19
25
|
readonly kind: 'missing';
|
|
20
26
|
readonly reason: string;
|
|
21
27
|
});
|
|
28
|
+
/** A coordinate of a matrix, by its row and column identities. */
|
|
29
|
+
export type MatrixCoordinate = {
|
|
30
|
+
readonly rowId: string;
|
|
31
|
+
readonly columnId: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* A rectangular block of cells the reader marked for copying or comparison: from the cell it started at to the cell it
|
|
35
|
+
* reaches, inclusive. It is application state, held by identity so it survives a reorder of rows or columns.
|
|
36
|
+
*/
|
|
37
|
+
export type MatrixCellRange = {
|
|
38
|
+
readonly anchor: MatrixCoordinate;
|
|
39
|
+
readonly end: MatrixCoordinate;
|
|
40
|
+
};
|
|
41
|
+
/** Why the range changed: Shift with an arrow key, a Shift press on a cell, a drag across cells, or Escape. */
|
|
42
|
+
export type MatrixCellRangeDetails = {
|
|
43
|
+
readonly reason: CellRangeReason;
|
|
44
|
+
readonly event?: Event | undefined;
|
|
45
|
+
};
|
|
46
|
+
/** The application's cell range and its request to change it. Without the callback, the matrix offers no range. */
|
|
47
|
+
export type MatrixCellRangeProps = {
|
|
48
|
+
readonly cellRange?: MatrixCellRange | null | undefined;
|
|
49
|
+
readonly onCellRangeChange?: ((range: MatrixCellRange | null, details: MatrixCellRangeDetails) => void) | undefined;
|
|
50
|
+
};
|
|
51
|
+
/** Whether square cells write their values, for one large matrix or many small ones. */
|
|
52
|
+
export type MatrixCellValuesProps = {
|
|
53
|
+
/**
|
|
54
|
+
* A `shown` value writes each cell's value inside it, in a shorter form when the cell is small. A `hidden` value
|
|
55
|
+
* draws color only, with smaller cells, for small multiples such as one panel per attention head. The readout and the
|
|
56
|
+
* exact-value table still give every value, and absent means shown.
|
|
57
|
+
*/
|
|
58
|
+
readonly cellValues?: 'shown' | 'hidden' | undefined;
|
|
59
|
+
};
|
|
60
|
+
/** The identity a preset gives the cell at a coordinate, for `selected` and `onSelectedChange`. */
|
|
61
|
+
export declare function matrixCellId(rowId: string, columnId: string): string;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
3
4
|
import type { HeatmapScale } from './heatmap-scale.ts';
|
|
4
|
-
import type { MatrixAxisItem, MatrixCell } from './matrix-types.ts';
|
|
5
|
+
import type { MatrixAxisItem, MatrixCell, MatrixCellRangeProps, MatrixCellValuesProps } from './matrix-types.ts';
|
|
5
6
|
export type { MatrixAxisItem, MatrixCell } from './matrix-types.ts';
|
|
6
|
-
export type MatrixProps = HeatmapScale & {
|
|
7
|
-
readonly title: string;
|
|
8
|
-
readonly report?: ChartReport | undefined;
|
|
9
|
-
readonly description: string;
|
|
7
|
+
export type MatrixProps = FigureProps & FigureSelectionProps & MatrixCellRangeProps & MatrixCellValuesProps & HeatmapScale & {
|
|
10
8
|
readonly rows: ReadonlyArray<MatrixAxisItem>;
|
|
11
9
|
readonly columns: ReadonlyArray<MatrixAxisItem>;
|
|
12
10
|
readonly cells: ReadonlyArray<MatrixCell>;
|
|
11
|
+
/** What the color measures, with its unit and any normalization the application applied. */
|
|
13
12
|
readonly valueLabel: string;
|
|
14
|
-
readonly
|
|
15
|
-
readonly selection?: ChartSelection;
|
|
16
|
-
readonly emptyLabel: string;
|
|
13
|
+
readonly valueFormat: ValueFormat;
|
|
17
14
|
/**
|
|
18
15
|
* The values variant draws square cells with short values for exact comparison. The strip variant draws compact
|
|
19
16
|
* intensity rows that fill the width, such as months across categories. Absent means values.
|
|
20
17
|
*/
|
|
21
18
|
readonly variant?: 'values' | 'strip' | undefined;
|
|
22
19
|
};
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Supplied values at explicit row and column identities, colored on a declared domain: attention weights, a metric by
|
|
22
|
+
* model and benchmark, monthly shares by category. A reader steps through cells with the arrow keys, marks a block with
|
|
23
|
+
* Shift and the arrows or a drag, and copies it as tab-separated exact values. Masked, missing and out-of-domain cells
|
|
24
|
+
* stay distinct from zero, and a preset such as ConfusionMatrix suits a matrix with a fixed meaning.
|
|
25
|
+
*/
|
|
26
|
+
export declare function Matrix({ variant, emptyLabel, ...props }: MatrixProps): ReactNode;
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
3
4
|
import type { HeatmapScale } from './heatmap-scale.ts';
|
|
5
|
+
/** One token of a supplied text window, with its index in the full sequence and its score. */
|
|
4
6
|
export type HeatmapToken = {
|
|
5
7
|
readonly id: string;
|
|
6
8
|
readonly index: number;
|
|
7
9
|
readonly text: string;
|
|
10
|
+
/** The score, or null where none was computed. Null draws a dotted underline, never zero. */
|
|
8
11
|
readonly score: number | null;
|
|
9
12
|
};
|
|
10
|
-
export type TokenHeatmapProps = HeatmapScale & {
|
|
11
|
-
readonly title: string;
|
|
12
|
-
readonly report?: ChartReport | undefined;
|
|
13
|
-
readonly description: string;
|
|
13
|
+
export type TokenHeatmapProps = FigureProps & FigureSelectionProps & HeatmapScale & {
|
|
14
14
|
readonly tokens: ReadonlyArray<HeatmapToken>;
|
|
15
|
+
/** What the score measures, with its unit. */
|
|
15
16
|
readonly valueLabel: string;
|
|
16
|
-
readonly
|
|
17
|
-
readonly selection?: ChartSelection;
|
|
18
|
-
readonly emptyLabel: string;
|
|
17
|
+
readonly valueFormat: ValueFormat;
|
|
19
18
|
};
|
|
20
|
-
|
|
21
|
-
export declare
|
|
19
|
+
/** The render limit. A longer window shows an explicit error; the application supplies a labelled window. */
|
|
20
|
+
export declare const tokenHeatmapLimits: {
|
|
21
|
+
readonly tokens: 2048;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A text window with each token's score as a colored underline: attributions, surprisal, probe outputs. The text stays
|
|
25
|
+
* exact, whitespace included, and each token keeps its supplied index. Scores come from the application.
|
|
26
|
+
*/
|
|
27
|
+
export declare function TokenHeatmap(props: TokenHeatmapProps): ReactNode;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A surface sampled on a regular grid. `values` holds `columns * rows` samples, row by row. Each row starts at its left
|
|
3
|
+
* edge and the first row is the bottom edge, so a row index grows upward like a value on a y axis.
|
|
4
|
+
*/
|
|
5
|
+
export type ContourGrid = {
|
|
6
|
+
readonly columns: number;
|
|
7
|
+
readonly rows: number;
|
|
8
|
+
readonly values: ReadonlyArray<number>;
|
|
9
|
+
};
|
|
10
|
+
/** A place on the grid in sample units: whole numbers are samples, fractions lie between them. */
|
|
11
|
+
export type GridPoint = {
|
|
12
|
+
readonly column: number;
|
|
13
|
+
readonly row: number;
|
|
14
|
+
};
|
|
15
|
+
/** One piece of a level line, between two points on the edges of one grid cell. */
|
|
16
|
+
export type ContourSegment = {
|
|
17
|
+
readonly from: GridPoint;
|
|
18
|
+
readonly to: GridPoint;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The line where a sampled surface crosses a level, by marching squares. Each grid cell with samples on both sides of
|
|
22
|
+
* the level contributes one or two straight pieces, placed along its edges by linear interpolation between the two
|
|
23
|
+
* samples. A saddle cell is resolved by the average of its four samples, and a sample equal to the level counts as
|
|
24
|
+
* above.
|
|
25
|
+
*/
|
|
26
|
+
export declare function contourSegments({ grid, level, }: {
|
|
27
|
+
readonly grid: ContourGrid;
|
|
28
|
+
readonly level: number;
|
|
29
|
+
}): ReadonlyArray<ContourSegment>;
|
|
30
|
+
/**
|
|
31
|
+
* The surface at a place between samples, by linear interpolation along the grid's rows and columns. It is undefined
|
|
32
|
+
* outside the grid.
|
|
33
|
+
*/
|
|
34
|
+
export declare function sampleGrid({ grid, point, }: {
|
|
35
|
+
readonly grid: ContourGrid;
|
|
36
|
+
readonly point: GridPoint;
|
|
37
|
+
}): number | undefined;
|
|
38
|
+
/** The SVG path of level-line pieces, each drawn from its own start, after `position` places grid points in pixels. */
|
|
39
|
+
export declare function segmentsPath({ segments, position, }: {
|
|
40
|
+
readonly segments: ReadonlyArray<ContourSegment>;
|
|
41
|
+
readonly position: (point: GridPoint) => {
|
|
42
|
+
readonly x: number;
|
|
43
|
+
readonly y: number;
|
|
44
|
+
};
|
|
45
|
+
}): string;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The plot kernel is what every chart in Elements is built from, and the way to build a chart the library lacks. Such a
|
|
3
|
+
* chart shares the axes, marks, readout, keyboard cursor, states and tones of the others. `CurveChart` in
|
|
4
|
+
* `charts/trend` is the reference for how the parts fit together.
|
|
5
|
+
*/
|
|
6
|
+
export type { ChartDataProps, ChartDataRow } from '../chart-data.tsx';
|
|
7
|
+
export { ChartData } from '../chart-data.tsx';
|
|
8
|
+
export { ChartCursor } from '../chart-cursor.tsx';
|
|
9
|
+
export { ChartReadout } from '../chart-frame.tsx';
|
|
10
|
+
export { hasUniqueIds } from '../chart-input.ts';
|
|
11
|
+
export type { ChartInspectionRow } from '../chart-inspection.tsx';
|
|
12
|
+
export { ChartInspection } from '../chart-inspection.tsx';
|
|
13
|
+
export { chartStyles } from '../chart-theme.ts';
|
|
14
|
+
export type { ChartInspectDetails, ChartInspectReason, ChartItem, ChartOptions, ChartPoint, ChartView, } from '../chart.tsx';
|
|
15
|
+
export { Chart, ChartMark, ChartPlot, inspectedLabel, plotLabel } from '../chart.tsx';
|
|
16
|
+
export type { FigureFrameProps } from '../figure/figure-frame.tsx';
|
|
17
|
+
export { FigureEmpty, FigureFrame, FigureInvalid, FigureLoading, coverageText } from '../figure/figure-frame.tsx';
|
|
18
|
+
export type { FigureFrameInput } from '../figure/figure-props.ts';
|
|
19
|
+
export type { ToneInput } from '../figure/tone-scope.tsx';
|
|
20
|
+
export { assignTones, automaticTone, useTones } from '../figure/tone-scope.tsx';
|
|
21
|
+
export { zoneOffset } from '../figure/figure-format.ts';
|
|
22
|
+
export type { ContourGrid, ContourSegment, GridPoint } from './contours.ts';
|
|
23
|
+
export { contourSegments, sampleGrid, segmentsPath } from './contours.ts';
|
|
24
|
+
export type { LabelBox, LabelObstacle, LabelSpot } from './label-place.ts';
|
|
25
|
+
export { freeLabelSpot, labelBox } from './label-place.ts';
|
|
26
|
+
export type { MarkPosition } from './locate.ts';
|
|
27
|
+
export { locateNearest } from './locate.ts';
|
|
28
|
+
export type { AreaPoint, LinkPathInput, LinkShape, PathCurve, PathPoint } from './path.ts';
|
|
29
|
+
export { areaPath, isolatedPoints, linePath, linkPath } from './path.ts';
|
|
30
|
+
export type { PlotAxesProps, PlotGrid } from './plot-axes.tsx';
|
|
31
|
+
export { PlotAxes } from './plot-axes.tsx';
|
|
32
|
+
export type { AxisTicks, AxisTicksInput, CategoryPlotLayout, FitDomainInput, NumericPlotLayout, PlotBox, PlotCategory, PlotMargins, PlotTick, TimeAxisTicksInput, TimePlotInput, ValueGutterInput, } from './plot-layout.ts';
|
|
33
|
+
export { axisTicks, axisTitle, bandTicks, categoryPlot, fitDomain, numericPlot, plotBox, plotMargins, tickTexts, ticksMinimum, timeAxisTicks, timePlot, valueGutter, } from './plot-layout.ts';
|
|
34
|
+
export type { AreaMarkProps, BarMarkProps, DotMarkProps, LabelMarkProps, LineMarkProps, LinkMarkProps, MarkEmphasis, MarkState, MarkStroke, Segment, SymbolMarkProps, SymbolShape, } from './plot-marks.tsx';
|
|
35
|
+
export { AreaMark, BandMark, BarMark, ConnectorMark, DotMark, GuideMark, IntervalMark, LabelMark, LineMark, LinkMark, RingMark, RuleMark, SymbolMark, } from './plot-marks.tsx';
|
|
36
|
+
export type { PlotSurfaceProps } from './plot-surface.tsx';
|
|
37
|
+
export { PlotClip, PlotSurface, usePlotSize } from './plot-surface.tsx';
|
|
38
|
+
export type { DensityLayerProps } from './render/density-layer.tsx';
|
|
39
|
+
export { DensityLayer } from './render/density-layer.tsx';
|
|
40
|
+
export type { DataRect, HitIndex, HitQuery, PointColumns } from './render/hit-index.ts';
|
|
41
|
+
export { countInside, hitIndex } from './render/hit-index.ts';
|
|
42
|
+
export type { PlotView, PlotViewDetails, PlotViewportOptions, PlotViewportRootProps } from './render/plot-viewport.tsx';
|
|
43
|
+
export { PlotViewportRoot, PlotViewportSurface, WHOLE_VIEW, visibleDomains } from './render/plot-viewport.tsx';
|
|
44
|
+
export type { PointAxis, PointDraw, PointLayerProps, PointRenderer } from './render/point-layer.tsx';
|
|
45
|
+
export { PointLayer } from './render/point-layer.tsx';
|
|
46
|
+
export type { BandScale, BandScaleInput, ContinuousScale, ContinuousScaleInput } from './scale.ts';
|
|
47
|
+
export { bandScale, columnExtent, continuousScale, isFiniteDomain, outsideDomain, scaleDomainError } from './scale.ts';
|
|
48
|
+
export type { TickInput, TimeTickInput } from './ticks.ts';
|
|
49
|
+
export { linearTicks, logTicks, scaleTicks, symlogTicks, timeTicks } from './ticks.ts';
|