@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
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
/** One prepared estimate with its interval. A null bound or estimate stays unavailable and is not drawn. */
|
|
5
6
|
export type IntervalDatum = {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
readonly label: string;
|
|
8
9
|
readonly lower: number | null;
|
|
9
10
|
readonly estimate: number | null;
|
|
10
11
|
readonly upper: number | null;
|
|
11
|
-
readonly tone?: ChartTone;
|
|
12
|
+
readonly tone?: ChartTone | undefined;
|
|
12
13
|
};
|
|
13
|
-
export type IntervalPlotProps = {
|
|
14
|
-
readonly title: string;
|
|
15
|
-
readonly report?: ChartReport | undefined;
|
|
16
|
-
readonly description?: string;
|
|
14
|
+
export type IntervalPlotProps = FigureProps & FigureSelectionProps & {
|
|
17
15
|
readonly items: ReadonlyArray<IntervalDatum>;
|
|
18
|
-
|
|
19
|
-
readonly
|
|
16
|
+
/** The estimated quantity, with its unit. */
|
|
17
|
+
readonly value: PlotAxis;
|
|
18
|
+
/** What the interval is, as the application computed it: "95% bootstrap interval". */
|
|
20
19
|
readonly intervalLabel: string;
|
|
21
|
-
|
|
22
|
-
readonly
|
|
23
|
-
readonly emptyLabel?: string;
|
|
20
|
+
/** The room each row gets: `compact` fits a short list in a card. */
|
|
21
|
+
readonly height?: PlotHeight | undefined;
|
|
24
22
|
};
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Prepared estimates with their intervals, one row each: model accuracy with a bootstrap interval, an effect with its
|
|
25
|
+
* confidence bounds. The rows keep the supplied order, and the readout states the exact values of the row being
|
|
26
|
+
* inspected.
|
|
27
|
+
*/
|
|
28
|
+
export declare function IntervalPlot(props: IntervalPlotProps): ReactNode;
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
/** One ranked value. `rank` is the application's own ordinal, shown before the label. */
|
|
5
6
|
export type RankedBarDatum = {
|
|
6
7
|
readonly id: string;
|
|
7
8
|
readonly label: string;
|
|
8
|
-
readonly rank?: string;
|
|
9
|
+
readonly rank?: string | undefined;
|
|
9
10
|
readonly value: number | null;
|
|
10
|
-
readonly tone?: ChartTone;
|
|
11
|
+
readonly tone?: ChartTone | undefined;
|
|
11
12
|
};
|
|
12
|
-
export type RankedBarsProps = {
|
|
13
|
-
|
|
14
|
-
readonly report?: ChartReport | undefined;
|
|
15
|
-
readonly description?: string;
|
|
13
|
+
export type RankedBarsProps = FigureProps & FigureSelectionProps & {
|
|
14
|
+
/** Values in the order the application ranked them. */
|
|
16
15
|
readonly items: ReadonlyArray<RankedBarDatum>;
|
|
17
|
-
|
|
18
|
-
readonly
|
|
19
|
-
|
|
20
|
-
readonly
|
|
21
|
-
readonly emptyLabel?: string;
|
|
16
|
+
/** The ranked quantity, with its unit. Its domain includes zero, where every bar starts. */
|
|
17
|
+
readonly value: PlotAxis;
|
|
18
|
+
/** The room each row gets: `compact` fits a short ranked list in a card. */
|
|
19
|
+
readonly height?: PlotHeight | undefined;
|
|
22
20
|
};
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Signed or positive values in the application's ranking, one bar per row from zero: feature attributions, top error
|
|
23
|
+
* sources, the largest regressions. The readout states the exact value of the row being inspected, and a measured zero
|
|
24
|
+
* keeps its row.
|
|
25
|
+
*/
|
|
26
|
+
export declare function RankedBars(props: RankedBarsProps): ReactNode;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
import type { DensityPoint } from './group-plot-input.ts';
|
|
6
|
+
/** One row of the ridgeline: a group and its density curve, computed by the application. */
|
|
7
|
+
export type RidgeRow = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
/** The hue of a row the application wants to tell apart. Left out, every row shares one hue. */
|
|
11
|
+
readonly tone?: ChartTone | undefined;
|
|
12
|
+
/** The curve in increasing `value`. Densities are zero or more and share one unit across rows. */
|
|
13
|
+
readonly density: ReadonlyArray<DensityPoint>;
|
|
14
|
+
};
|
|
15
|
+
export type RidgelineProps = FigureProps & {
|
|
16
|
+
readonly rows: ReadonlyArray<RidgeRow>;
|
|
17
|
+
readonly value: PlotAxis;
|
|
18
|
+
/** How far a ridge may rise into the row above, from 0 to 1. Defaults to 0.5. */
|
|
19
|
+
readonly overlap?: number | undefined;
|
|
20
|
+
/** What the height means, with its unit: "Density (per unit activation)". */
|
|
21
|
+
readonly densityLabel: string;
|
|
22
|
+
readonly height?: PlotHeight | undefined;
|
|
23
|
+
};
|
|
24
|
+
export declare const ridgelineLimits: {
|
|
25
|
+
readonly rows: 40;
|
|
26
|
+
readonly densityPoints: 200;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Densities of many groups as overlapping ridges down the page, one shared value axis at the bottom and each row named
|
|
30
|
+
* on the left. Rows share one hue unless a row or a tone scope sets its own, later rows are drawn on top, and the
|
|
31
|
+
* application computes every density. Ridge heights share one density scale so heights compare across rows, and the
|
|
32
|
+
* plot grows taller when there are too many rows to keep each readable.
|
|
33
|
+
*/
|
|
34
|
+
export declare function Ridgeline(props: RidgelineProps): ReactNode;
|
|
@@ -0,0 +1,37 @@
|
|
|
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 StripGroup = {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly tone?: ChartTone | undefined;
|
|
9
|
+
};
|
|
10
|
+
/** One observation: a run, a prompt or a sample, in the group it belongs to. */
|
|
11
|
+
export type StripPoint = {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly groupId: string;
|
|
14
|
+
readonly value: number;
|
|
15
|
+
/** What a reader calls the observation. Defaults to its identifier. */
|
|
16
|
+
readonly label?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type StripPlotProps = FigureProps & FigureSelectionProps & {
|
|
19
|
+
readonly groups: ReadonlyArray<StripGroup>;
|
|
20
|
+
readonly points: ReadonlyArray<StripPoint>;
|
|
21
|
+
readonly value: PlotAxis;
|
|
22
|
+
/** One value per group id, such as its median or mean, drawn as an ink tick across the group. */
|
|
23
|
+
readonly summary?: Readonly<Record<string, number>> | undefined;
|
|
24
|
+
/** What the tick is: "Median". Defaults to "Summary". */
|
|
25
|
+
readonly summaryLabel?: string | undefined;
|
|
26
|
+
readonly height?: PlotHeight | undefined;
|
|
27
|
+
};
|
|
28
|
+
export declare const stripLimits: {
|
|
29
|
+
readonly points: 2000;
|
|
30
|
+
readonly groups: 24;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Every observation as a dot in its group's band, spread across the band by a fixed rule so a reload never moves one.
|
|
34
|
+
* Dots are translucent so piles read as density, and an optional ink tick per group marks a median or mean the
|
|
35
|
+
* application computed. Use it when the number of observations is small enough to show each one.
|
|
36
|
+
*/
|
|
37
|
+
export declare function StripPlot(props: StripPlotProps): ReactNode;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { PlotAxis, PlotHeight } from '../plot/plot-layout.ts';
|
|
5
|
+
import type { DensityPoint } from './group-plot-input.ts';
|
|
6
|
+
/** One group's density curve, computed by the application, with the summary marks it may show inside. */
|
|
7
|
+
export type ViolinGroup = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly label: string;
|
|
10
|
+
readonly tone?: ChartTone | undefined;
|
|
11
|
+
/** The curve in increasing `value`. Densities are zero or more and share one unit across groups. */
|
|
12
|
+
readonly density: ReadonlyArray<DensityPoint>;
|
|
13
|
+
readonly median?: number | undefined;
|
|
14
|
+
/** The quartiles bound the bar inside the violin. Supply both or neither. */
|
|
15
|
+
readonly q1?: number | undefined;
|
|
16
|
+
readonly q3?: number | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type ViolinPlotProps = FigureProps & {
|
|
19
|
+
readonly groups: ReadonlyArray<ViolinGroup>;
|
|
20
|
+
readonly value: PlotAxis;
|
|
21
|
+
/** What the width means, with its unit: "Density (per unit score)". */
|
|
22
|
+
readonly densityLabel: string;
|
|
23
|
+
readonly height?: PlotHeight | undefined;
|
|
24
|
+
};
|
|
25
|
+
export declare const violinLimits: {
|
|
26
|
+
readonly groups: 24;
|
|
27
|
+
readonly densityPoints: 200;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* One mirrored density per group, so a reader sees where values pile up and whether a distribution has more than one
|
|
31
|
+
* peak. Every violin shares one density scale, so widths compare across groups. A bar and a dot inside show the
|
|
32
|
+
* quartiles and median when the application supplies them, and the application computes the density.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ViolinPlot(props: ViolinPlotProps): ReactNode;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { NumberFormat } from '@ui-sdk/core/number';
|
|
2
|
+
/** How a figure writes a number: `Intl.NumberFormat` options in the figure's locale, or a function of the value. */
|
|
3
|
+
export type ValueFormat = NumberFormat;
|
|
4
|
+
/**
|
|
5
|
+
* How a figure writes an instant: `Intl.DateTimeFormat` options that name their time zone, or a function of the
|
|
6
|
+
* timestamp in milliseconds.
|
|
7
|
+
*/
|
|
8
|
+
export type TimeFormat = (Intl.DateTimeFormatOptions & {
|
|
9
|
+
readonly timeZone: string;
|
|
10
|
+
}) | ((timestamp: number) => string);
|
|
11
|
+
/** The text every figure shows for a value that was not recorded. A missing value is never drawn or written as zero. */
|
|
12
|
+
export declare const MISSING_VALUE_TEXT = "Unavailable";
|
|
13
|
+
export type ValueFormatInput = {
|
|
14
|
+
readonly value: number | null;
|
|
15
|
+
readonly locale: string;
|
|
16
|
+
readonly format: ValueFormat;
|
|
17
|
+
};
|
|
18
|
+
/** A value as the reader sees it in a readout, a legend or a table. */
|
|
19
|
+
export declare function formatValue({ value, locale, format }: ValueFormatInput): string;
|
|
20
|
+
/**
|
|
21
|
+
* The short form of a value format for an axis, where "1.2M" reads better than "1,200,000". A function format and a
|
|
22
|
+
* format that names its own notation stay as supplied.
|
|
23
|
+
*/
|
|
24
|
+
export declare function tickFormat(format: ValueFormat): ValueFormat;
|
|
25
|
+
export type TimeFormatInput = {
|
|
26
|
+
/** The instant in milliseconds since the epoch. */
|
|
27
|
+
readonly timestamp: number;
|
|
28
|
+
readonly locale: string;
|
|
29
|
+
readonly format: TimeFormat;
|
|
30
|
+
};
|
|
31
|
+
/** An instant as the reader sees it, in the format's declared time zone. */
|
|
32
|
+
export declare function formatTime({ timestamp, locale, format }: TimeFormatInput): string;
|
|
33
|
+
/** How far a time zone is ahead of UTC at an instant, in milliseconds, so axis ticks land on local clock steps. */
|
|
34
|
+
export declare function zoneOffset(timestamp: number, timeZone: string): number;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import type { ChartLegendItem } from '../chart-frame.tsx';
|
|
3
|
+
import type { PlotHeight } from '../plot/plot-layout.ts';
|
|
4
|
+
import type { FigureCoverage, FigureFrameInput } from './figure-props.ts';
|
|
5
|
+
/** "1,000 of 1.2 million points shown": the sentence a partial figure states beside its title. */
|
|
6
|
+
export declare function coverageText(coverage: FigureCoverage, locale: string): string;
|
|
7
|
+
export type FigureFrameProps = FigureFrameInput & {
|
|
8
|
+
/** The chart part's own props, when this figure is the root of an interactive chart. */
|
|
9
|
+
readonly figure?: ComponentProps<'figure'> | undefined;
|
|
10
|
+
/** The series a report's period summary names. */
|
|
11
|
+
readonly series?: ReadonlyArray<ChartLegendItem> | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* What the reader is inspecting, in a few words. At phone width, where the floating inspector is hidden, the heading
|
|
14
|
+
* shows it in place of the title.
|
|
15
|
+
*/
|
|
16
|
+
readonly titleDetail?: string | undefined;
|
|
17
|
+
/** The readout and any other line the chart keeps under its plot, above the footnote. */
|
|
18
|
+
readonly footer?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* The legend that names things: series, models, classes. The frame sets it above the plot, directly under the title
|
|
21
|
+
* block, with the standard gap. A chart never places such a legend among its own children.
|
|
22
|
+
*/
|
|
23
|
+
readonly seriesLegend?: ReactNode;
|
|
24
|
+
/** The legend that explains a color or size scale. The frame sets it directly below the plot. */
|
|
25
|
+
readonly scaleLegend?: ReactNode;
|
|
26
|
+
readonly children: ReactNode;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The frame every figure shares: title, description, the plot, then the readout and one footnote. The footnote names
|
|
30
|
+
* the source, how much of the data is drawn and what was done to it. A partial figure also says so beside its title.
|
|
31
|
+
*/
|
|
32
|
+
export declare function FigureFrame({ title, description, report, actions, locale, source, coverage, transforms, status, figure, series, titleDetail, footer, seriesLegend, scaleLegend, children, }: FigureFrameProps): ReactNode;
|
|
33
|
+
/** The sentence a figure shows in place of its plot when there is nothing to draw. */
|
|
34
|
+
export declare function FigureEmpty({ children }: {
|
|
35
|
+
readonly children: string;
|
|
36
|
+
}): ReactNode;
|
|
37
|
+
/** A figure whose input cannot be drawn faithfully. It states the reason and draws nothing. */
|
|
38
|
+
export declare function FigureInvalid({ message, ...frame }: FigureFrameInput & {
|
|
39
|
+
readonly message: string;
|
|
40
|
+
}): ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* A figure before its first read: the same frame and plot height as the loaded chart, so nothing moves when the data
|
|
43
|
+
* arrives. The enclosing async region owns the announcement.
|
|
44
|
+
*/
|
|
45
|
+
export declare function FigureLoading({ height, ...frame }: FigureFrameInput & {
|
|
46
|
+
readonly height?: PlotHeight | undefined;
|
|
47
|
+
}): ReactNode;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartReport, ChartSeriesReport } from '../chart-frame.tsx';
|
|
3
|
+
import type { ChartSelectDetails } from '../chart.tsx';
|
|
4
|
+
/** How much of the full data a figure draws, when it draws a sample or a window. */
|
|
5
|
+
export type FigureCoverage = {
|
|
6
|
+
readonly shown: number;
|
|
7
|
+
readonly total: number;
|
|
8
|
+
/** What is counted, in the plural: "points", "runs", "tokens". */
|
|
9
|
+
readonly unit: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Where a figure's data stands. `loading` holds the final geometry before the first read. `refreshing` keeps the drawn
|
|
13
|
+
* data while a newer read is under way.
|
|
14
|
+
*/
|
|
15
|
+
export type FigureStatus = 'ready' | 'loading' | 'refreshing';
|
|
16
|
+
/**
|
|
17
|
+
* What every figure accepts, whichever chart it is: its title, the words around the plot, the locale its numbers and
|
|
18
|
+
* dates are written in, and where its data stands.
|
|
19
|
+
*/
|
|
20
|
+
export type FigureProps = {
|
|
21
|
+
readonly title: string;
|
|
22
|
+
/** One or two sentences under the title: what is measured and how to read it. */
|
|
23
|
+
readonly description?: string | undefined;
|
|
24
|
+
/** Sets the figure in a bordered report with its own heading, metadata and summary. */
|
|
25
|
+
readonly report?: ChartReport | undefined;
|
|
26
|
+
/** Controls beside the title, such as a download or a period switch. */
|
|
27
|
+
readonly actions?: ReactNode;
|
|
28
|
+
/** The locale of every number and date in the figure. It is an input, so a server and a browser render alike. */
|
|
29
|
+
readonly locale: string;
|
|
30
|
+
/** Where the data came from, for the footnote: a dataset, a run or a query. */
|
|
31
|
+
readonly source?: string | undefined;
|
|
32
|
+
/** Set when the figure draws part of the data. The figure then says so beside its title and in its footnote. */
|
|
33
|
+
readonly coverage?: FigureCoverage | undefined;
|
|
34
|
+
/** What the application did to the data before drawing, in the reader's words: "Smoothed over 5 steps". */
|
|
35
|
+
readonly transforms?: ReadonlyArray<string> | undefined;
|
|
36
|
+
readonly status?: FigureStatus | undefined;
|
|
37
|
+
/** The sentence shown in place of the plot when there is nothing to draw. */
|
|
38
|
+
readonly emptyLabel?: string | undefined;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The record an application has selected in a figure, and its request to select another. Selection is the application's
|
|
42
|
+
* state: the figure reports a press or a key and draws what it is given.
|
|
43
|
+
*/
|
|
44
|
+
export type FigureSelectionProps = {
|
|
45
|
+
readonly selected?: string | null | undefined;
|
|
46
|
+
/** The details say why and how: a press, a key or an agent's step. */
|
|
47
|
+
readonly onSelectedChange?: ((id: string, details: ChartSelectDetails) => void) | undefined;
|
|
48
|
+
};
|
|
49
|
+
/** `FigureProps` for a chart of named series, whose report can show one period value per series. */
|
|
50
|
+
export type SeriesFigureProps = Omit<FigureProps, 'report'> & {
|
|
51
|
+
readonly report?: ChartSeriesReport | undefined;
|
|
52
|
+
};
|
|
53
|
+
/** What a chart passes on to its frame: every shared prop but the empty label, which the chart shows itself. */
|
|
54
|
+
export type FigureFrameInput = Omit<SeriesFigureProps, 'emptyLabel'>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
/** The automatic tone of the nth thing in a figure. The six series hues repeat past the sixth. */
|
|
4
|
+
export declare function automaticTone(index: number): ChartTone;
|
|
5
|
+
/**
|
|
6
|
+
* One tone per id, in supplied order. A pinned id keeps its tone and takes no automatic slot, so a remainder group in
|
|
7
|
+
* neutral never shifts the hues of the named things after it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function assignTones(ids: ReadonlyArray<string>, pinned?: Readonly<Record<string, ChartTone>>): ReadonlyMap<string, ChartTone>;
|
|
10
|
+
export type ToneScopeProps = {
|
|
11
|
+
/** Every thing the figures inside draw, such as models or runs, in the order their hues are assigned. */
|
|
12
|
+
readonly ids: ReadonlyArray<string>;
|
|
13
|
+
/** Tones the application pins by id. */
|
|
14
|
+
readonly tones?: Readonly<Record<string, ChartTone>> | undefined;
|
|
15
|
+
readonly children: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Gives each thing one hue in every figure inside. A model that is blue in a curve is blue in the bar chart and the
|
|
19
|
+
* table beside it, whatever order each figure lists its series in.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ToneScope({ ids, tones, children }: ToneScopeProps): ReactNode;
|
|
22
|
+
export type ToneInput = {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
/** The tone the caller set on this record. It wins over the scope. */
|
|
25
|
+
readonly tone?: ChartTone | undefined;
|
|
26
|
+
/** The record's place among its figure's own records, used when no scope names it. */
|
|
27
|
+
readonly index: number;
|
|
28
|
+
};
|
|
29
|
+
/** Resolves a record's tone: its own, then the enclosing scope's, then its place in the figure. */
|
|
30
|
+
export declare function useTones(): (input: ToneInput) => ChartTone;
|
|
31
|
+
/** The tone the enclosing scope gives `id`, or undefined when none names it. For prose and marks outside a figure. */
|
|
32
|
+
export declare function useScopedTone(id: string): ChartTone | undefined;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ChangeDetails } from '@ui-sdk/core';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
4
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
5
|
+
import type { AttributionDirection } from './attribution-layout.ts';
|
|
6
|
+
export type { AttributionDirection } from './attribution-layout.ts';
|
|
7
|
+
/** One layer of the model, in the order computation flows: input tokens, the layers, then the output logits. */
|
|
8
|
+
export type AttributionLayer = {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
};
|
|
12
|
+
/** What a node stands for, by shape. An error node is hollow, the part the features leave unexplained. */
|
|
13
|
+
export type AttributionNodeKind = 'token' | 'feature' | 'error' | 'output';
|
|
14
|
+
export type AttributionNode = {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly layerId: string;
|
|
17
|
+
readonly label: string;
|
|
18
|
+
/** A longer description for the readout, such as the feature's top activating contexts. */
|
|
19
|
+
readonly detail?: string | undefined;
|
|
20
|
+
/** The node's own measure, such as an activation, in `valueFormat`. Null where none was recorded. */
|
|
21
|
+
readonly value?: number | null | undefined;
|
|
22
|
+
readonly kind?: AttributionNodeKind | undefined;
|
|
23
|
+
};
|
|
24
|
+
/** A supplied, signed attribution from an earlier node to a later one. */
|
|
25
|
+
export type AttributionEdge = {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly sourceId: string;
|
|
28
|
+
readonly targetId: string;
|
|
29
|
+
readonly weight: number;
|
|
30
|
+
};
|
|
31
|
+
/** Why the pinned nodes changed: the visible Pin control, or the P key on the plot. */
|
|
32
|
+
export type AttributionPinReason = 'item-press' | 'shortcut';
|
|
33
|
+
export type AttributionPinDetails = ChangeDetails<AttributionPinReason>;
|
|
34
|
+
export type AttributionGraphProps = FigureProps & FigureSelectionProps & {
|
|
35
|
+
readonly layers: ReadonlyArray<AttributionLayer>;
|
|
36
|
+
/** Nodes in the order the application wants them within each layer. The graph never reorders them. */
|
|
37
|
+
readonly nodes: ReadonlyArray<AttributionNode>;
|
|
38
|
+
readonly edges: ReadonlyArray<AttributionEdge>;
|
|
39
|
+
/** What an edge weight measures, such as "Attribution". */
|
|
40
|
+
readonly weightLabel: string;
|
|
41
|
+
readonly weightFormat: ValueFormat;
|
|
42
|
+
/** What a node value measures, such as "Activation". Required when any node has a value. */
|
|
43
|
+
readonly valueLabel?: string | undefined;
|
|
44
|
+
readonly valueFormat?: ValueFormat | undefined;
|
|
45
|
+
/** Which way layers advance. Defaults to bottom to top, with the inputs at the bottom. */
|
|
46
|
+
readonly direction?: AttributionDirection | undefined;
|
|
47
|
+
/** The nodes a reader has pinned to build a subgraph. Leave it out and the graph keeps its own pins. */
|
|
48
|
+
readonly pinned?: ReadonlyArray<string> | undefined;
|
|
49
|
+
readonly onPinnedChange?: ((ids: ReadonlyArray<string>, details: AttributionPinDetails) => void) | undefined;
|
|
50
|
+
};
|
|
51
|
+
export declare const attributionLimits: {
|
|
52
|
+
readonly nodes: 400;
|
|
53
|
+
readonly edges: 2000;
|
|
54
|
+
readonly layers: 40;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* An attribution graph: how a model computes an output, traced through input tokens, features in each layer and the
|
|
58
|
+
* output logits, with only supplied edges drawn. Nodes sit in supplied order within each layer, and edges carry
|
|
59
|
+
* supplied signed attributions, with hue giving the sign and width the size. Inspect a node to light its inputs and
|
|
60
|
+
* outputs, and pin nodes to keep their mutual edges in view.
|
|
61
|
+
*/
|
|
62
|
+
export declare function AttributionGraph(props: AttributionGraphProps): ReactNode;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** Which way the layers advance: from the bottom up, as the field draws it, or from left to right. */
|
|
2
|
+
export type AttributionDirection = 'up' | 'right';
|
|
3
|
+
export type AttributionLayoutInput = {
|
|
4
|
+
readonly layers: ReadonlyArray<{
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
}>;
|
|
8
|
+
/** Nodes in the order the application wants them within each layer. */
|
|
9
|
+
readonly nodes: ReadonlyArray<{
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly layerId: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
}>;
|
|
14
|
+
readonly edges: ReadonlyArray<{
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly sourceId: string;
|
|
17
|
+
readonly targetId: string;
|
|
18
|
+
readonly weight: number;
|
|
19
|
+
}>;
|
|
20
|
+
readonly direction: AttributionDirection;
|
|
21
|
+
/** The width the frame gives the plot. The layout grows past it, and the plot scrolls, when nodes need more room. */
|
|
22
|
+
readonly width: number;
|
|
23
|
+
};
|
|
24
|
+
export type PlacedAttributionNode = {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly x: number;
|
|
27
|
+
readonly y: number;
|
|
28
|
+
readonly layerIndex: number;
|
|
29
|
+
};
|
|
30
|
+
/** A layer's band and where its name sits. */
|
|
31
|
+
export type PlacedAttributionLayer = {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly label: string;
|
|
34
|
+
readonly labelX: number;
|
|
35
|
+
readonly labelY: number;
|
|
36
|
+
/** The band's edges across the advance axis, for a pale stripe behind alternate layers. */
|
|
37
|
+
readonly start: number;
|
|
38
|
+
readonly end: number;
|
|
39
|
+
};
|
|
40
|
+
export type PlacedAttributionEdge = {
|
|
41
|
+
readonly id: string;
|
|
42
|
+
readonly d: string;
|
|
43
|
+
readonly width: number;
|
|
44
|
+
};
|
|
45
|
+
export type AttributionLayout = {
|
|
46
|
+
readonly width: number;
|
|
47
|
+
readonly height: number;
|
|
48
|
+
readonly layers: ReadonlyArray<PlacedAttributionLayer>;
|
|
49
|
+
readonly nodes: ReadonlyMap<string, PlacedAttributionNode>;
|
|
50
|
+
readonly edges: ReadonlyArray<PlacedAttributionEdge>;
|
|
51
|
+
/**
|
|
52
|
+
* The room each node's label has, in pixels: beside its node, toward the next node in its layer, when layers rise;
|
|
53
|
+
* above it, across its column, when they run right.
|
|
54
|
+
*/
|
|
55
|
+
readonly labelWidth: number;
|
|
56
|
+
/** The largest absolute weight, which draws the widest edge. */
|
|
57
|
+
readonly weightMax: number;
|
|
58
|
+
};
|
|
59
|
+
/** The geometry every attribution layout shares, in CSS pixels. */
|
|
60
|
+
export declare const attributionGeometry: {
|
|
61
|
+
readonly nodeRadius: 6;
|
|
62
|
+
readonly edgeWidthMin: 0.75;
|
|
63
|
+
readonly edgeWidthMax: 5;
|
|
64
|
+
readonly padding: 16;
|
|
65
|
+
readonly band: 76;
|
|
66
|
+
readonly spacingMin: 64;
|
|
67
|
+
/** The widest a node's slot grows to give its label room, before the label is cut. */
|
|
68
|
+
readonly spacingMax: 200;
|
|
69
|
+
readonly gutterMax: 140;
|
|
70
|
+
readonly gutterGap: 16;
|
|
71
|
+
readonly characterWidth: 7;
|
|
72
|
+
readonly columnMin: 120;
|
|
73
|
+
readonly rowSpacing: 40;
|
|
74
|
+
readonly header: 36;
|
|
75
|
+
readonly labelGap: 6;
|
|
76
|
+
readonly labelGapAcross: 8;
|
|
77
|
+
};
|
|
78
|
+
/** The stroke width of an edge: its absolute weight as a share of the largest one. */
|
|
79
|
+
export declare function edgeWidth({ weight, weightMax }: {
|
|
80
|
+
readonly weight: number;
|
|
81
|
+
readonly weightMax: number;
|
|
82
|
+
}): number;
|
|
83
|
+
/**
|
|
84
|
+
* Places an attribution graph: each layer is a band in supplied order, and each node sits in its layer in supplied
|
|
85
|
+
* order, centered on the busiest layer. Nothing is reordered or simulated. Edges are curves from source to target whose
|
|
86
|
+
* width follows the absolute weight.
|
|
87
|
+
*/
|
|
88
|
+
export declare function attributionLayout({ layers, nodes, edges, direction, width, }: AttributionLayoutInput): AttributionLayout;
|
|
@@ -1,26 +1,25 @@
|
|
|
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';
|
|
4
|
+
import type { PlotHeight } from '../plot/plot-layout.ts';
|
|
3
5
|
import type { FlowLink, FlowNode } from './flow-layout.ts';
|
|
4
6
|
export type { FlowLink, FlowNode } from './flow-layout.ts';
|
|
5
|
-
export type FlowDiagramProps = {
|
|
6
|
-
readonly title: string;
|
|
7
|
-
readonly description?: ReactNode;
|
|
8
|
-
readonly report?: ChartReport | undefined;
|
|
7
|
+
export type FlowDiagramProps = FigureProps & FigureSelectionProps & {
|
|
9
8
|
readonly nodes: ReadonlyArray<FlowNode>;
|
|
10
9
|
readonly links: ReadonlyArray<FlowLink>;
|
|
11
|
-
/**
|
|
12
|
-
readonly
|
|
13
|
-
/**
|
|
14
|
-
readonly
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
/** How every amount is written, for labels, inspection and exact values. */
|
|
11
|
+
readonly valueFormat: ValueFormat;
|
|
12
|
+
/** The plot height. Absent fits the busiest column. */
|
|
13
|
+
readonly height?: PlotHeight | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** The render limits. Larger input shows an explicit error; the application supplies a coarser grouping. */
|
|
16
|
+
export declare const flowLimits: {
|
|
17
|
+
readonly nodes: 64;
|
|
18
|
+
readonly links: 256;
|
|
18
19
|
};
|
|
19
|
-
export declare const MAX_FLOW_NODES = 64;
|
|
20
|
-
export declare const MAX_FLOW_LINKS = 256;
|
|
21
20
|
/**
|
|
22
21
|
* Shows how supplied amounts divide and move between stages, such as a total splitting into categories and their parts.
|
|
23
22
|
* Node height and ribbon width share one scale; columns follow the links and keep the supplied order. Use BreakdownBar
|
|
24
23
|
* for one level of parts and RelationGraph for unweighted relationships; the diagram never infers or balances a flow.
|
|
25
24
|
*/
|
|
26
|
-
export declare function FlowDiagram(
|
|
25
|
+
export declare function FlowDiagram(props: FlowDiagramProps): ReactNode;
|
|
@@ -3,7 +3,7 @@ import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
|
3
3
|
export type FlowNode = {
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly label: string;
|
|
6
|
-
/** Absent takes the next automatic series tone in node order. */
|
|
6
|
+
/** Absent takes the tone a `ToneScope` gives its id, or the next automatic series tone in node order. */
|
|
7
7
|
readonly tone?: ChartTone | undefined;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
@@ -50,6 +50,8 @@ type LayoutInput = {
|
|
|
50
50
|
readonly right: number;
|
|
51
51
|
readonly top: number;
|
|
52
52
|
readonly bottom: number;
|
|
53
|
+
/** Each node's resolved tone, from its own, its scope's or its place in `nodes`. */
|
|
54
|
+
readonly toneOf: (node: FlowNode, index: number) => ChartTone;
|
|
53
55
|
};
|
|
54
56
|
export declare const FLOW_NODE_WIDTH_PX = 12;
|
|
55
57
|
type ColumnInput = Pick<LayoutInput, 'nodes' | 'links'>;
|
|
@@ -62,7 +64,7 @@ export declare function flowColumns({ nodes, links }: ColumnInput): ReadonlyMap<
|
|
|
62
64
|
* Lays nodes out in columns by longest path and keeps their supplied order within each column. Nodes and ribbons share
|
|
63
65
|
* one scale, so every amount keeps the same length per unit.
|
|
64
66
|
*/
|
|
65
|
-
export declare function layoutFlow({ nodes, links, left, right, top, bottom }: LayoutInput): FlowLayout;
|
|
67
|
+
export declare function layoutFlow({ nodes, links, left, right, top, bottom, toneOf }: LayoutInput): FlowLayout;
|
|
66
68
|
/** A ribbon from the source's right edge to the target's left edge, with horizontal tangents at both ends. */
|
|
67
69
|
export declare function ribbonPath(placed: PlacedFlowLink): string;
|
|
68
70
|
/** The center line of a ribbon, used for unavailable and zero amounts that have no width. */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { KeyboardEventHandler, ReactNode, Ref } from 'react';
|
|
2
|
+
/** A point in a graph's own pixels, such as the node the keyboard cursor rests on. */
|
|
3
|
+
export type GraphPoint = {
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
};
|
|
7
|
+
export type GraphCanvasProps = {
|
|
8
|
+
/** The ref from `usePlotSize`, on the element whose width the layout fills. */
|
|
9
|
+
readonly plotRef: Ref<HTMLDivElement>;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
/** What the arrow keys step through, such as "nodes". */
|
|
12
|
+
readonly marks: string;
|
|
13
|
+
readonly readoutId: string;
|
|
14
|
+
readonly isSelectable: boolean;
|
|
15
|
+
/** The size the layout drew, which may be larger than the frame: the canvas then scrolls inside it. */
|
|
16
|
+
readonly width: number;
|
|
17
|
+
readonly height: number;
|
|
18
|
+
/** Where the keyboard cursor rests. While the plot has focus the canvas scrolls to keep it in view. */
|
|
19
|
+
readonly cursor: GraphPoint | undefined;
|
|
20
|
+
readonly onKeyDown?: KeyboardEventHandler<HTMLDivElement> | undefined;
|
|
21
|
+
readonly children: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The plot of a node-link figure: one Tab stop that scrolls inside the frame when the layout is larger than it, and
|
|
25
|
+
* keeps the keyboard cursor in view. It never zooms. Use it inside `Chart`, which supplies the items.
|
|
26
|
+
*/
|
|
27
|
+
export declare function GraphCanvas({ plotRef, title, marks, readoutId, isSelectable, width, height, cursor, onKeyDown, children, }: GraphCanvasProps): ReactNode;
|
|
28
|
+
/** The keyboard cursor around a node: a dashed ring, shown while the plot has keyboard focus. */
|
|
29
|
+
export declare function GraphCursor({ x, y, radius }: GraphPoint & {
|
|
30
|
+
readonly radius: number;
|
|
31
|
+
}): ReactNode;
|
|
32
|
+
/** A label shortened with an ellipsis to fit a width in pixels. The readout and data table keep the full text. */
|
|
33
|
+
export declare function fitLabel(label: string, width: number): string;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export type { FlowDiagramProps, FlowLink, FlowNode } from './flow-diagram.tsx';
|
|
2
|
-
export { FlowDiagram,
|
|
2
|
+
export { FlowDiagram, flowLimits } from './flow-diagram.tsx';
|
|
3
3
|
export type { RelationNode, RelationEdge, RelationGroup, RelationGraphProps } from './relation-graph.tsx';
|
|
4
|
-
export {
|
|
4
|
+
export { RelationGraph, relationGraphLimits } from './relation-graph.tsx';
|
|
5
|
+
export type { AttributionDirection, AttributionEdge, AttributionGraphProps, AttributionLayer, AttributionNode, AttributionNodeKind, AttributionPinDetails, AttributionPinReason, } from './attribution-graph.tsx';
|
|
6
|
+
export { AttributionGraph, attributionLimits } from './attribution-graph.tsx';
|
|
7
|
+
export type { TreeDiagramProps, TreeDirection, TreeNode } from './tree-diagram.tsx';
|
|
8
|
+
export { TreeDiagram, treeLimits } from './tree-diagram.tsx';
|