@mechane-ai/elements 0.46.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +590 -34
- package/bin/mechane-elements-catalog.mjs +104 -12
- package/dist/ai.js +4 -4
- package/dist/article-BXZr10QQ.js +1904 -0
- package/dist/article.js +1 -0
- package/dist/catalog.json +3696 -33
- package/dist/categorical-values-BpVq8cFj.js +107 -0
- package/dist/cells-xVmnQ9oQ.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 +4 -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/clock-DSm5lkNE.js +16 -0
- package/dist/collections.js +1 -2195
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/describe-lesson-BmREzDpt.js +175 -0
- package/dist/dumbbell-plot-DQdTxDeO.js +509 -0
- package/dist/embedding-map-CF-J-8JW.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-BJ3REgTA.js +270 -0
- package/dist/forms/dates.js +1 -810
- package/dist/forms.js +1 -1
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-Dl2sjIMB.js +598 -0
- package/dist/kits/evaluation.js +431 -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/lesson/agent.js +811 -0
- package/dist/lesson/spec.js +661 -0
- package/dist/lesson.js +5 -0
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/mdx.js +227 -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 +15 -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 +128 -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/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/packages/teaching/src/agent/index.d.ts +11 -0
- package/dist/packages/teaching/src/agent/learner-trace.d.ts +84 -0
- package/dist/packages/teaching/src/agent/lesson-bridge.d.ts +59 -0
- package/dist/packages/teaching/src/agent/lesson-tour.d.ts +63 -0
- package/dist/packages/teaching/src/agent/tutor-tools.d.ts +86 -0
- package/dist/packages/teaching/src/article/article-checks.d.ts +9 -0
- package/dist/packages/teaching/src/article/article-context.d.ts +49 -0
- package/dist/packages/teaching/src/article/article-error.d.ts +12 -0
- package/dist/packages/teaching/src/article/article-labels.d.ts +54 -0
- package/dist/packages/teaching/src/article/article-layout.stylex.d.ts +14 -0
- package/dist/packages/teaching/src/article/article-outline.d.ts +9 -0
- package/dist/packages/teaching/src/article/article.d.ts +42 -0
- package/dist/packages/teaching/src/article/beat-steps.d.ts +18 -0
- package/dist/packages/teaching/src/article/beat.d.ts +16 -0
- package/dist/packages/teaching/src/article/challenge.d.ts +29 -0
- package/dist/packages/teaching/src/article/exercise-styles.d.ts +76 -0
- package/dist/packages/teaching/src/article/figure.d.ts +51 -0
- package/dist/packages/teaching/src/article/index.d.ts +31 -0
- package/dist/packages/teaching/src/article/lesson-values.d.ts +5 -0
- package/dist/packages/teaching/src/article/linked-target.d.ts +22 -0
- package/dist/packages/teaching/src/article/notes.d.ts +36 -0
- package/dist/packages/teaching/src/article/outline-types.d.ts +73 -0
- package/dist/packages/teaching/src/article/predict.d.ts +58 -0
- package/dist/packages/teaching/src/article/progress-store.d.ts +64 -0
- package/dist/packages/teaching/src/article/scrolly.d.ts +26 -0
- package/dist/packages/teaching/src/article/term.d.ts +35 -0
- package/dist/packages/teaching/src/article/tex.d.ts +12 -0
- package/dist/packages/teaching/src/article/view-essay.d.ts +13 -0
- package/dist/packages/teaching/src/article/view-present.d.ts +8 -0
- package/dist/packages/teaching/src/article/view-sheet.d.ts +7 -0
- package/dist/packages/teaching/src/article/view-static.d.ts +7 -0
- package/dist/packages/teaching/src/article/walk.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/bound-value.d.ts +29 -0
- package/dist/packages/teaching/src/lesson/define-lesson.d.ts +136 -0
- package/dist/packages/teaching/src/lesson/index.d.ts +24 -0
- package/dist/packages/teaching/src/lesson/inline-choice.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-context.d.ts +18 -0
- package/dist/packages/teaching/src/lesson/lesson-error.d.ts +12 -0
- package/dist/packages/teaching/src/lesson/lesson-locale.d.ts +4 -0
- package/dist/packages/teaching/src/lesson/lesson-persistence.d.ts +17 -0
- package/dist/packages/teaching/src/lesson/lesson-player.d.ts +51 -0
- package/dist/packages/teaching/src/lesson/lesson-store.d.ts +84 -0
- package/dist/packages/teaching/src/lesson/lesson.d.ts +39 -0
- package/dist/packages/teaching/src/lesson/param-controls.d.ts +14 -0
- package/dist/packages/teaching/src/lesson/param.d.ts +34 -0
- package/dist/packages/teaching/src/lesson/playback.d.ts +42 -0
- package/dist/packages/teaching/src/lesson/transport.d.ts +19 -0
- package/dist/packages/teaching/src/lesson/use-lesson.d.ts +36 -0
- package/dist/packages/teaching/src/mdx/essay-components.d.ts +79 -0
- package/dist/packages/teaching/src/mdx/essay-markdown.d.ts +41 -0
- package/dist/packages/teaching/src/mdx/essay.d.ts +32 -0
- package/dist/packages/teaching/src/mdx/index.d.ts +9 -0
- package/dist/packages/teaching/src/mdx/requested-view.d.ts +6 -0
- package/dist/packages/teaching/src/scene/flow/flow-layout.d.ts +38 -0
- package/dist/packages/teaching/src/scene/flow/flow-pulse.d.ts +16 -0
- package/dist/packages/teaching/src/scene/flow/scene-flow.d.ts +81 -0
- package/dist/packages/teaching/src/scene/index.d.ts +77 -0
- package/dist/packages/teaching/src/scene/morph/morph-scope.d.ts +28 -0
- package/dist/packages/teaching/src/scene/plane/plane-hit.d.ts +22 -0
- package/dist/packages/teaching/src/scene/plane/plane-label.d.ts +23 -0
- package/dist/packages/teaching/src/scene/plane/plane-labels.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/plane-math.d.ts +45 -0
- package/dist/packages/teaching/src/scene/plane/scene-axes.d.ts +30 -0
- package/dist/packages/teaching/src/scene/plane/scene-curve.d.ts +42 -0
- package/dist/packages/teaching/src/scene/plane/scene-point.d.ts +59 -0
- package/dist/packages/teaching/src/scene/plane/scene-projection.d.ts +27 -0
- package/dist/packages/teaching/src/scene/plane/scene-region.d.ts +38 -0
- package/dist/packages/teaching/src/scene/plane/scene-rule.d.ts +35 -0
- package/dist/packages/teaching/src/scene/plane/scene-vector.d.ts +39 -0
- package/dist/packages/teaching/src/scene/scene-bracket.d.ts +24 -0
- package/dist/packages/teaching/src/scene/scene-callout.d.ts +26 -0
- package/dist/packages/teaching/src/scene/scene-context.d.ts +179 -0
- package/dist/packages/teaching/src/scene/scene-custom.d.ts +31 -0
- package/dist/packages/teaching/src/scene/scene-geometry.d.ts +181 -0
- package/dist/packages/teaching/src/scene/scene-group.d.ts +28 -0
- package/dist/packages/teaching/src/scene/scene-highlight.d.ts +19 -0
- package/dist/packages/teaching/src/scene/scene-layer.d.ts +16 -0
- package/dist/packages/teaching/src/scene/scene-node.d.ts +67 -0
- package/dist/packages/teaching/src/scene/scene-obstacles.d.ts +27 -0
- package/dist/packages/teaching/src/scene/scene-registry.d.ts +79 -0
- package/dist/packages/teaching/src/scene/scene-stagger.d.ts +43 -0
- package/dist/packages/teaching/src/scene/scene-style.d.ts +14 -0
- package/dist/packages/teaching/src/scene/scene-validate.d.ts +65 -0
- package/dist/packages/teaching/src/scene/scene-wire.d.ts +45 -0
- package/dist/packages/teaching/src/scene/scene.d.ts +36 -0
- package/dist/packages/teaching/src/scene/shapes/cell-color.d.ts +11 -0
- package/dist/packages/teaching/src/scene/shapes/cell-grid.d.ts +69 -0
- package/dist/packages/teaching/src/scene/shapes/scene-card.d.ts +114 -0
- package/dist/packages/teaching/src/scene/shapes/scene-cells.d.ts +84 -0
- package/dist/packages/teaching/src/scene/shapes/scene-slot.d.ts +37 -0
- package/dist/packages/teaching/src/scene/shapes/scene-stack.d.ts +46 -0
- package/dist/packages/teaching/src/scene/shapes/scene-token.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/scene-tokens.d.ts +40 -0
- package/dist/packages/teaching/src/scene/shapes/stack-book.d.ts +35 -0
- package/dist/packages/teaching/src/scene/shapes/stack-layout.d.ts +63 -0
- package/dist/packages/teaching/src/scene/shapes/token-layout.d.ts +39 -0
- package/dist/packages/teaching/src/spec/advice.d.ts +23 -0
- package/dist/packages/teaching/src/spec/chart-names.d.ts +2 -0
- package/dist/packages/teaching/src/spec/describe-lesson.d.ts +85 -0
- package/dist/packages/teaching/src/spec/explainer-guide.d.ts +21 -0
- package/dist/packages/teaching/src/spec/findings.d.ts +39 -0
- package/dist/packages/teaching/src/spec/index.d.ts +14 -0
- package/dist/packages/teaching/src/spec/lesson-plan.d.ts +43 -0
- package/dist/packages/teaching/src/spec/validate-plan.d.ts +11 -0
- package/dist/packages/teaching/src/time/clock.d.ts +7 -0
- package/dist/packages/teaching/src/time/tween.d.ts +19 -0
- package/dist/packages/teaching/src/time/use-tween.d.ts +6 -0
- package/dist/param-CqKUTHaO.js +450 -0
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-CZVSJ-le.js +912 -0
- package/dist/plot-marks-uozcbOIX.js +229 -0
- package/dist/plot-surface-CbVBvgqZ.js +51 -0
- package/dist/plot-width-DcqtSgzb.js +124 -0
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-BDcttOp0.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/scene-0z2gbaDE.js +4938 -0
- package/dist/scene.js +1 -0
- package/dist/slope-chart-BKVEAVCs.js +1279 -0
- package/dist/{src-1EHkSFS-.js → src-BD6xlvDt.js} +2 -2
- package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/src-Dcfq8vE4.js +2195 -0
- package/dist/styles2.css +907 -59
- package/dist/time-series-BgzGNOk0.js +2670 -0
- package/dist/token-heatmap-BrW1OsKD.js +1354 -0
- package/dist/token-predictions-yerq_Oet.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/transport-BJweqDPj.js +715 -0
- package/dist/tree-diagram-D09BRqE-.js +1629 -0
- package/dist/treemap-CW4WsJNL.js +472 -0
- package/dist/use-tween-5HZ55_9d.js +72 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-DrtPZ1-T.js +1292 -0
- package/dist/waterfall-DYLSnGjm.js +576 -0
- package/package.json +78 -4
- package/recipes/allocation-report.tsx +15 -7
- package/recipes/counting-cards.tsx +656 -0
- package/recipes/explorable-essay.tsx +172 -0
- package/skills/extend-elements/SKILL.md +81 -0
- package/skills/plan-lesson/SKILL.md +86 -0
- package/skills/plan-lesson/references/plan-format.md +114 -0
- package/skills/plan-lesson/references/worked-plan.md +171 -0
- package/skills/review-elements/SKILL.md +47 -3
- package/skills/review-explainer/SKILL.md +97 -0
- package/skills/upgrade-elements/SKILL.md +3 -1
- package/skills/upgrade-elements/references/releases.md +249 -0
- package/skills/use-elements/SKILL.md +22 -14
- 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 +180 -0
- package/skills/use-elements/references/teaching.md +36 -0
- package/skills/write-explainer/SKILL.md +112 -0
- package/skills/write-explainer/references/article.md +164 -0
- package/skills/write-explainer/references/lesson.md +148 -0
- package/skills/write-explainer/references/mdx.md +78 -0
- package/skills/write-explainer/references/scene-parts.md +273 -0
- package/skills/write-explainer/references/scene.md +168 -0
- package/skills/write-explainer/references/tutor.md +104 -0
- package/skills/write-explainer/references/worked-essay.md +459 -0
- package/templates/essay/AGENTS.md +14 -0
- package/templates/essay/README.md +59 -0
- package/templates/essay/index.html +17 -0
- package/templates/essay/package.template.json +21 -0
- package/templates/essay/plan.json +96 -0
- package/templates/essay/src/essay.mdx +97 -0
- package/templates/essay/src/figures.tsx +92 -0
- package/templates/essay/src/lesson.ts +83 -0
- package/templates/essay/src/main.tsx +53 -0
- package/templates/essay/src/mdx.d.ts +7 -0
- package/templates/essay/tsconfig.template.json +15 -0
- package/templates/essay/vite.config.template.txt +8 -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,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';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
/** A node at a supplied position, in the graph's own coordinates. Position never implies a relationship. */
|
|
4
5
|
export type RelationNode = {
|
|
5
6
|
readonly id: string;
|
|
6
7
|
readonly label: string;
|
|
@@ -9,8 +10,10 @@ export type RelationNode = {
|
|
|
9
10
|
readonly y: number;
|
|
10
11
|
readonly width: number;
|
|
11
12
|
readonly height: number;
|
|
12
|
-
|
|
13
|
+
/** Absent takes the next automatic series tone in node order, or the tone a `ToneScope` gives its id. */
|
|
14
|
+
readonly tone?: ChartTone | undefined;
|
|
13
15
|
};
|
|
16
|
+
/** A supplied relationship between two nodes. The graph draws only these, never one inferred from position. */
|
|
14
17
|
export type RelationEdge = {
|
|
15
18
|
readonly id: string;
|
|
16
19
|
readonly sourceId: string;
|
|
@@ -18,6 +21,7 @@ export type RelationEdge = {
|
|
|
18
21
|
readonly label: string;
|
|
19
22
|
readonly direction: 'directed' | 'undirected';
|
|
20
23
|
};
|
|
24
|
+
/** A labelled box around supplied nodes, such as a module or a cluster. */
|
|
21
25
|
export type RelationGroup = {
|
|
22
26
|
readonly id: string;
|
|
23
27
|
readonly label: string;
|
|
@@ -27,20 +31,27 @@ export type RelationGroup = {
|
|
|
27
31
|
readonly height: number;
|
|
28
32
|
readonly nodeIds: ReadonlyArray<string>;
|
|
29
33
|
};
|
|
30
|
-
export type RelationGraphProps = {
|
|
31
|
-
readonly title: string;
|
|
32
|
-
readonly report?: ChartReport | undefined;
|
|
33
|
-
readonly description: string;
|
|
34
|
+
export type RelationGraphProps = FigureProps & FigureSelectionProps & {
|
|
34
35
|
readonly nodes: ReadonlyArray<RelationNode>;
|
|
35
36
|
readonly edges: ReadonlyArray<RelationEdge>;
|
|
36
37
|
readonly groups?: ReadonlyArray<RelationGroup> | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The coordinate extent of the supplied positions, in pixels. The graph stretches or narrows across to fill its
|
|
40
|
+
* space, keeping text at its size. Every node stays at least 80 pixels wide, or its supplied width when that is
|
|
41
|
+
* less, and below that the graph scrolls inside its frame.
|
|
42
|
+
*/
|
|
37
43
|
readonly width: number;
|
|
38
44
|
readonly height: number;
|
|
39
|
-
readonly selection?: ChartSelection | undefined;
|
|
40
|
-
readonly emptyLabel: string;
|
|
41
45
|
};
|
|
42
|
-
|
|
43
|
-
export declare const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
/** The render limits, and the largest coordinate extent, in pixels. Larger input shows an explicit error. */
|
|
47
|
+
export declare const relationGraphLimits: {
|
|
48
|
+
readonly nodes: 256;
|
|
49
|
+
readonly edges: 1024;
|
|
50
|
+
readonly groups: 256;
|
|
51
|
+
readonly dimension: 8192;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Supplied nodes at supplied positions with the supplied relationships between them: a dependency graph, a pipeline, a
|
|
55
|
+
* module map. Position and proximity never imply an edge. Use FlowDiagram when the relationships carry amounts.
|
|
56
|
+
*/
|
|
57
|
+
export declare function RelationGraph(props: RelationGraphProps): ReactNode;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
import type { ChartLegendItem } from '../chart-frame.tsx';
|
|
4
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
5
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
6
|
+
import type { LinkShape } from '../plot/path.ts';
|
|
7
|
+
import type { TreeDirection } from './tree-layout.ts';
|
|
8
|
+
export type { TreeDirection } from './tree-layout.ts';
|
|
9
|
+
export type TreeNode = {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
/** The parent's id, or null for the one root. */
|
|
12
|
+
readonly parentId: string | null;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly detail?: string | undefined;
|
|
15
|
+
/** The node's measure in `valueFormat`, such as a sample count or a split's impurity. Null if none was recorded. */
|
|
16
|
+
readonly value?: number | null | undefined;
|
|
17
|
+
/** A hue for a class or a group, named in `toneLegend`. Absent draws the node in neutral ink. */
|
|
18
|
+
readonly tone?: ChartTone | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type TreeDiagramProps = FigureProps & FigureSelectionProps & {
|
|
21
|
+
/** Every node once, children after or before their parent, siblings in the order they should be drawn. */
|
|
22
|
+
readonly nodes: ReadonlyArray<TreeNode>;
|
|
23
|
+
readonly direction?: TreeDirection | undefined;
|
|
24
|
+
/** Right-angled elbows, the default, or smooth curves. */
|
|
25
|
+
readonly link?: LinkShape | undefined;
|
|
26
|
+
/** What a node value measures, such as "Samples". Required when any node has a value. */
|
|
27
|
+
readonly valueLabel?: string | undefined;
|
|
28
|
+
readonly valueFormat?: ValueFormat | undefined;
|
|
29
|
+
/** What each node tone means, when nodes carry tones. */
|
|
30
|
+
readonly toneLegend?: ReadonlyArray<ChartLegendItem> | undefined;
|
|
31
|
+
};
|
|
32
|
+
export declare const treeLimits: {
|
|
33
|
+
readonly nodes: 300;
|
|
34
|
+
readonly depth: 12;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A hierarchy drawn as a node-link tree: a decision tree, a module tree or a cut of a cluster dendrogram. Depth runs
|
|
38
|
+
* along one axis and leaves sit evenly in supplied order along the other, and inspecting a node gives its path from the
|
|
39
|
+
* root and its value. The application supplies the flat nodes with their parents, and the tree never reorders them.
|
|
40
|
+
*/
|
|
41
|
+
export declare function TreeDiagram(props: TreeDiagramProps): ReactNode;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { LinkShape } from '../plot/path.ts';
|
|
2
|
+
/** Which way depth runs: from the root at the left to leaves at the right, or from the root at the top down. */
|
|
3
|
+
export type TreeDirection = 'right' | 'down';
|
|
4
|
+
/** A node of a flat hierarchy: its parent's id, or null for the root. */
|
|
5
|
+
export type TreeLayoutNode = {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly parentId: string | null;
|
|
8
|
+
readonly label: string;
|
|
9
|
+
};
|
|
10
|
+
/** A valid hierarchy: its root, each node's children in supplied order, and every node in depth-first order. */
|
|
11
|
+
export type TreeStructure = {
|
|
12
|
+
readonly isValid: true;
|
|
13
|
+
readonly root: string;
|
|
14
|
+
readonly children: ReadonlyMap<string, ReadonlyArray<string>>;
|
|
15
|
+
/** Every node, parents before their children, siblings in supplied order, with its distance from the root. */
|
|
16
|
+
readonly order: ReadonlyArray<{
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly depth: number;
|
|
19
|
+
/** The ids from the root down to this node. */
|
|
20
|
+
readonly lineage: ReadonlyArray<string>;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
/** Why supplied nodes do not form one tree. */
|
|
24
|
+
export type TreeProblem = {
|
|
25
|
+
readonly isValid: false;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Reads a flat list of nodes as one tree, or says why it is not one: a missing or second root, a parent that is not
|
|
30
|
+
* supplied, or a cycle. Nothing is repaired or dropped.
|
|
31
|
+
*/
|
|
32
|
+
export declare function treeStructure(nodes: ReadonlyArray<TreeLayoutNode>): TreeStructure | TreeProblem;
|
|
33
|
+
export type PlacedTreeNode = {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly x: number;
|
|
36
|
+
readonly y: number;
|
|
37
|
+
readonly depth: number;
|
|
38
|
+
readonly isLeaf: boolean;
|
|
39
|
+
/** The room the node's label has, in pixels. */
|
|
40
|
+
readonly labelWidth: number;
|
|
41
|
+
/** Where the links to the node's children start along depth: past its label in a tree that grows right. */
|
|
42
|
+
readonly trunk: number;
|
|
43
|
+
};
|
|
44
|
+
export type PlacedTreeLink = {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
readonly parentId: string;
|
|
47
|
+
readonly d: string;
|
|
48
|
+
};
|
|
49
|
+
export type TreeLayout = {
|
|
50
|
+
readonly width: number;
|
|
51
|
+
readonly height: number;
|
|
52
|
+
readonly nodes: ReadonlyMap<string, PlacedTreeNode>;
|
|
53
|
+
/** One link per node but the root, keyed by the child's id. */
|
|
54
|
+
readonly links: ReadonlyArray<PlacedTreeLink>;
|
|
55
|
+
/** Where leaf labels sit: beside a leaf at the right, below a leaf when they fit across, or turned to read down. */
|
|
56
|
+
readonly leafLabels: TreeLeafLabels;
|
|
57
|
+
};
|
|
58
|
+
export type TreeLeafLabels = 'beside' | 'below' | 'turned';
|
|
59
|
+
export type TreeLayoutInput = {
|
|
60
|
+
readonly structure: TreeStructure;
|
|
61
|
+
readonly nodes: ReadonlyArray<TreeLayoutNode>;
|
|
62
|
+
readonly direction: TreeDirection;
|
|
63
|
+
readonly link: LinkShape;
|
|
64
|
+
/** The width the frame gives the plot. The layout grows past it, and the plot scrolls, when leaves need more room. */
|
|
65
|
+
readonly width: number;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A tidy tree: depth sets one axis, leaves are spaced evenly in supplied order along the other, and each parent sits at
|
|
69
|
+
* the middle of its first and last child. Links run from parent to child as curves or elbows.
|
|
70
|
+
*/
|
|
71
|
+
export declare function treeLayout({ structure, nodes, direction, link, width }: TreeLayoutInput): TreeLayout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
import type { AreaCell } from './treemap-layout.ts';
|
|
4
|
+
export type AreaMarkProps = {
|
|
5
|
+
readonly cell: AreaCell;
|
|
6
|
+
readonly tone: ChartTone;
|
|
7
|
+
readonly label: string;
|
|
8
|
+
/** The exact value, drawn under the label when the area has room. */
|
|
9
|
+
readonly valueLabel: string;
|
|
10
|
+
/** The narrowest area that names itself. Narrower areas stay unlabeled; the readout and table still name them. */
|
|
11
|
+
readonly labelWidth: number;
|
|
12
|
+
readonly isInspected?: boolean | undefined;
|
|
13
|
+
readonly isSelected?: boolean | undefined;
|
|
14
|
+
readonly isCursor?: boolean | undefined;
|
|
15
|
+
};
|
|
16
|
+
/** One area of a hierarchy chart: a pale fill in its tone, a surface edge, and its name and value where they fit. */
|
|
17
|
+
export declare function AreaMark({ cell, tone, label, valueLabel, labelWidth, isInspected, isSelected, isCursor, }: AreaMarkProps): ReactNode;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
|
|
3
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
4
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
5
|
+
import type { PlotHeight } from '../plot/plot-layout.ts';
|
|
6
|
+
/** One node of a hierarchy, listed flat. The root has a null parent. */
|
|
7
|
+
export type IcicleNode = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly parentId: string | null;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
/**
|
|
12
|
+
* The application's total for this node, including its descendants, or null where none was recorded. A parent may
|
|
13
|
+
* exceed the sum of its children; the rest of its width stays empty. A node without a value, and everything under it,
|
|
14
|
+
* has no area.
|
|
15
|
+
*/
|
|
16
|
+
readonly value: number | null;
|
|
17
|
+
/** The node's hue. Absent, each child of the root takes the next series hue and its descendants share it. */
|
|
18
|
+
readonly tone?: ChartTone | undefined;
|
|
19
|
+
};
|
|
20
|
+
export type IcicleProps = FigureProps & FigureSelectionProps & {
|
|
21
|
+
readonly nodes: ReadonlyArray<IcicleNode>;
|
|
22
|
+
readonly valueFormat: ValueFormat;
|
|
23
|
+
readonly height?: PlotHeight | undefined;
|
|
24
|
+
};
|
|
25
|
+
/** The most nodes and levels below the root one icicle draws. Supply a coarser hierarchy for more. */
|
|
26
|
+
export declare const icicleLimits: {
|
|
27
|
+
readonly nodes: 500;
|
|
28
|
+
readonly depth: 8;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A hierarchy as stacked horizontal bands, one row per level, where each node's width is its share of its parent:
|
|
32
|
+
* parameters by module, or time by stage. The application supplies every node's total; a parent larger than its
|
|
33
|
+
* children leaves the rest empty, and the chart never infers a value.
|
|
34
|
+
*/
|
|
35
|
+
export declare function Icicle({ nodes, valueFormat, selected, onSelectedChange, height, ...figure }: IcicleProps): ReactNode;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AreaCell } from './treemap-layout.ts';
|
|
2
|
+
/** One node of a hierarchy to place. Its value is the application's own total for the node and its descendants. */
|
|
3
|
+
export type PartitionInput = {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly parentId: string | null;
|
|
6
|
+
readonly value: number;
|
|
7
|
+
};
|
|
8
|
+
/** A placed node: its rectangle and how deep it sits below the root, which is depth 0. */
|
|
9
|
+
export type PartitionCell = AreaCell & {
|
|
10
|
+
readonly depth: number;
|
|
11
|
+
};
|
|
12
|
+
export type PartitionLayoutInput = {
|
|
13
|
+
/** One root with a null parent, and parents before or after their children in any order. */
|
|
14
|
+
readonly nodes: ReadonlyArray<PartitionInput>;
|
|
15
|
+
readonly width: number;
|
|
16
|
+
readonly height: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* An icicle partition, as a pure function with no DOM access: the root spans the full width of the top row. Each child
|
|
20
|
+
* takes a share of its parent's width in proportion to its value, in supplied order, one row further down. A parent
|
|
21
|
+
* whose value exceeds its children's sum keeps the rest of its width empty, so nothing is inferred.
|
|
22
|
+
*/
|
|
23
|
+
export declare function partitionLayout({ nodes, width, height }: PartitionLayoutInput): ReadonlyArray<PartitionCell>;
|
|
24
|
+
/** The cell under a position, such as the pointer, or undefined over empty space. */
|
|
25
|
+
export declare function cellAt(cells: ReadonlyArray<AreaCell>, x: number, y: number): AreaCell | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** One sized record to place: its id and a positive amount. */
|
|
2
|
+
export type AreaInput = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly value: number;
|
|
5
|
+
};
|
|
6
|
+
/** A placed rectangle, from its top left corner (`x0`, `y0`) to its bottom right corner (`x1`, `y1`). */
|
|
7
|
+
export type AreaCell = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly x0: number;
|
|
10
|
+
readonly y0: number;
|
|
11
|
+
readonly x1: number;
|
|
12
|
+
readonly y1: number;
|
|
13
|
+
};
|
|
14
|
+
export type TreemapLayoutInput = {
|
|
15
|
+
/** The records in supplied order. Each needs a positive value; leave out zero and missing ones. */
|
|
16
|
+
readonly items: ReadonlyArray<AreaInput>;
|
|
17
|
+
readonly width: number;
|
|
18
|
+
readonly height: number;
|
|
19
|
+
/** The gap between neighboring rectangles, in pixels. Rectangles at the edge touch it. */
|
|
20
|
+
readonly gap?: number | undefined;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A squarified treemap: rectangles whose areas are proportional to their values and whose shapes stay close to square,
|
|
24
|
+
* laid out in supplied order without sorting. A pure function, so a server and a browser place alike.
|
|
25
|
+
*/
|
|
26
|
+
export declare function treemapLayout({ items, width, height, gap }: TreemapLayoutInput): ReadonlyArray<AreaCell>;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { BreakdownItem } from '../categorical-values.tsx';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly description?: string | undefined;
|
|
3
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
4
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
5
|
+
import type { PlotHeight } from '../plot/plot-layout.ts';
|
|
6
|
+
export type TreemapProps = FigureProps & FigureSelectionProps & {
|
|
8
7
|
readonly items: ReadonlyArray<BreakdownItem>;
|
|
9
|
-
readonly
|
|
10
|
-
readonly
|
|
11
|
-
readonly height?: number | undefined;
|
|
8
|
+
readonly valueFormat: ValueFormat;
|
|
9
|
+
readonly height?: PlotHeight | undefined;
|
|
12
10
|
};
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Supplied nonnegative categories as areas proportional to their recorded values, with a row per category below.
|
|
13
|
+
* Missing and zero values have no area. Use BreakdownBar when a declared total and an unassigned portion matter.
|
|
14
|
+
*/
|
|
15
|
+
export declare function Treemap({ items, valueFormat, selected, onSelectedChange, height: plotHeight, ...figure }: TreemapProps): ReactNode;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AttributionScale } from './attribution-ramp.ts';
|
|
3
|
+
export type AttributionLegendProps = AttributionScale & {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
/** The lowest value, the highest value and, on a diverging scale, zero, already written in the figure's locale. */
|
|
6
|
+
readonly ends: {
|
|
7
|
+
readonly low: string;
|
|
8
|
+
readonly high: string;
|
|
9
|
+
readonly zero: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** The color key of an overlay: what the values are, a bar from low to high, and the numbers at its ends. */
|
|
13
|
+
export declare function AttributionLegend({ label, ends, ...scale }: AttributionLegendProps): ReactNode;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { Slider } from '../../../forms/src/index.ts';
|
|
3
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
4
|
+
import type { FigureProps } from '../figure/figure-props.ts';
|
|
5
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
6
|
+
import type { AttributionPalette } from './attribution-ramp.ts';
|
|
7
|
+
/** The picture under the overlay. Its size sets the shape of the figure. */
|
|
8
|
+
export type AttributionImage = {
|
|
9
|
+
readonly src: string;
|
|
10
|
+
/** What the picture shows. Assistive technology reads it with the figure. */
|
|
11
|
+
readonly alt: string;
|
|
12
|
+
/** The picture's size in pixels. Only their ratio is used. */
|
|
13
|
+
readonly width: number;
|
|
14
|
+
readonly height: number;
|
|
15
|
+
};
|
|
16
|
+
/** Values on a grid of `columns` by `rows`, listed row by row from the top left. A null value is an empty cell. */
|
|
17
|
+
export type AttributionGrid = {
|
|
18
|
+
readonly columns: number;
|
|
19
|
+
readonly rows: number;
|
|
20
|
+
readonly values: ReadonlyArray<number | null>;
|
|
21
|
+
};
|
|
22
|
+
type SliderDetails = Parameters<NonNullable<ComponentProps<typeof Slider.Root<number>>['onValueChange']>>[1];
|
|
23
|
+
/** Why the overlay strength changed: a press on the slider track, a drag or a key. */
|
|
24
|
+
export type AttributionOpacityDetails = SliderDetails;
|
|
25
|
+
export type AttributionOverlayProps = FigureProps & {
|
|
26
|
+
readonly image: AttributionImage;
|
|
27
|
+
readonly grid: AttributionGrid;
|
|
28
|
+
/** What the values measure, such as "Saliency". It names the legend. */
|
|
29
|
+
readonly valueLabel: string;
|
|
30
|
+
readonly valueFormat: ValueFormat;
|
|
31
|
+
/** The values the colors span. Every value must lie inside it. */
|
|
32
|
+
readonly domain: NumericDomain;
|
|
33
|
+
/** `sequential` for values from low to high. `diverging` for signed values, with zero as the neutral. */
|
|
34
|
+
readonly palette: AttributionPalette;
|
|
35
|
+
/** How strongly the overlay covers the picture, from 0 to 1. It never encodes a value. */
|
|
36
|
+
readonly opacity?: number | undefined;
|
|
37
|
+
/** Hears the reader's change of overlay strength. Without it, the figure keeps the strength itself. */
|
|
38
|
+
readonly onOpacityChange?: ((opacity: number, details: AttributionOpacityDetails) => void) | undefined;
|
|
39
|
+
};
|
|
40
|
+
export declare const attributionOverlayLimits: {
|
|
41
|
+
readonly columns: 64;
|
|
42
|
+
readonly rows: 64;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A picture with a grid of values laid over it, such as a saliency or attention map over image patches. Each cell is
|
|
46
|
+
* colored by its value, and the reader sets how strongly the overlay covers the picture. A cell with no value is
|
|
47
|
+
* hollow, and the application supplies the picture, the values and the color domain.
|
|
48
|
+
*/
|
|
49
|
+
export declare function AttributionOverlay(props: AttributionOverlayProps): ReactNode;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NumericDomain } from '../plot/scale.ts';
|
|
2
|
+
/**
|
|
3
|
+
* How values become color on an overlay. A `sequential` palette is one hue, from the surface color at the low end to
|
|
4
|
+
* the full hue at the high end. A `diverging` palette is two hues around a neutral zero, for values that carry a sign.
|
|
5
|
+
*/
|
|
6
|
+
export type AttributionPalette = 'sequential' | 'diverging';
|
|
7
|
+
export type AttributionScale = {
|
|
8
|
+
readonly domain: NumericDomain;
|
|
9
|
+
readonly palette: AttributionPalette;
|
|
10
|
+
};
|
|
11
|
+
/** Why the scale cannot color its values, or undefined when it can. A diverging scale must span zero. */
|
|
12
|
+
export declare function attributionScaleError({ domain, palette }: AttributionScale): string | undefined;
|
|
13
|
+
/** The color of one value: its hue is the sign, its lightness is the size. */
|
|
14
|
+
export declare function attributionColor(value: number, { domain, palette }: AttributionScale): string;
|
|
15
|
+
/** A CSS gradient from the low end of the scale to the high end, for the legend. */
|
|
16
|
+
export declare function attributionGradient(scale: AttributionScale): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ValueFormat } from '../figure/figure-format.ts';
|
|
3
|
+
import type { FigureProps, FigureSelectionProps } from '../figure/figure-props.ts';
|
|
4
|
+
import type { ImageRecord } from './image-input.ts';
|
|
5
|
+
/** One thumbnail and the position the application gave it. Positions count from 0 at the top left. */
|
|
6
|
+
export type ImageAtlasCell = ImageRecord & {
|
|
7
|
+
/** The column, from 0 at the left to `columns - 1`. */
|
|
8
|
+
readonly column: number;
|
|
9
|
+
/** The row, from 0 at the top to `rows - 1`. */
|
|
10
|
+
readonly row: number;
|
|
11
|
+
};
|
|
12
|
+
export type ImageAtlasProps = FigureProps & FigureSelectionProps & {
|
|
13
|
+
/** How many columns the layout has. Cells are square and the columns fill the width. */
|
|
14
|
+
readonly columns: number;
|
|
15
|
+
readonly rows: number;
|
|
16
|
+
/** The thumbnails. Positions without a cell stay empty. Two cells may not share a position. */
|
|
17
|
+
readonly cells: ReadonlyArray<ImageAtlasCell>;
|
|
18
|
+
/**
|
|
19
|
+
* Names what the left to right direction of the layout stands for, such as "First component". The positions are
|
|
20
|
+
* layout coordinates the application chose, not measured axes, so the figure draws no ticks or scale.
|
|
21
|
+
*/
|
|
22
|
+
readonly xLabel?: string | undefined;
|
|
23
|
+
/** Names what the top to bottom direction of the layout stands for. Layout coordinates, like `xLabel`. */
|
|
24
|
+
readonly yLabel?: string | undefined;
|
|
25
|
+
/** What each cell's value measures, such as "Activation". It names the value in the readout. */
|
|
26
|
+
readonly valueLabel?: string | undefined;
|
|
27
|
+
readonly valueFormat?: ValueFormat | undefined;
|
|
28
|
+
};
|
|
29
|
+
export declare const imageAtlasLimits: {
|
|
30
|
+
readonly cells: 1024;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Thumbnails placed on a grid the application laid out, such as an activation atlas, in square cells that fill the
|
|
34
|
+
* width and leave empty positions empty. Hovering or stepping to a cell shows its label, position and value below, and
|
|
35
|
+
* enlarges nothing. The application supplies every position.
|
|
36
|
+
*/
|
|
37
|
+
export declare function ImageAtlas(props: ImageAtlasProps): ReactNode;
|