@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,1354 @@
|
|
|
1
|
+
import { r as e } from "./tokens.stylex-dF5CACEJ.js";
|
|
2
|
+
import { d as t, l as n, s as r } from "./dates-Cww8UR_n.js";
|
|
3
|
+
import { A as i, D as a, E as o, O as s, S as c, T as l, a as u, k as d, w as f } from "./plot-layout-CZVSJ-le.js";
|
|
4
|
+
import { i as p } from "./chart-link-AE_xuxiP.js";
|
|
5
|
+
import { n as m, r as h } from "./figure-format-B8kRZMlo.js";
|
|
6
|
+
import { i as g, l as _, n as ee, r as te, t as ne } from "./figure-frame-BJ3REgTA.js";
|
|
7
|
+
import { n as v, t as re } from "./plot-width-DcqtSgzb.js";
|
|
8
|
+
import { n as y, r as b, t as ie } from "./heatmap-scale-Zte6Ya-g.js";
|
|
9
|
+
import { t as ae } from "./color-legend-CIo7DhXB.js";
|
|
10
|
+
import { m as x } from "./values-963L6n1m.js";
|
|
11
|
+
import * as S from "@stylexjs/stylex";
|
|
12
|
+
import { useId as oe, useRef as se } from "react";
|
|
13
|
+
import { announce as ce, cellsToText as C, isRTL as le } from "@ui-sdk/core";
|
|
14
|
+
import { Fragment as ue, jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
15
|
+
// packages/charts/src/matrix/matrix-cells.ts
|
|
16
|
+
var E = {
|
|
17
|
+
digitPx: 7,
|
|
18
|
+
insetPx: 5,
|
|
19
|
+
sides: 2,
|
|
20
|
+
percent: 100
|
|
21
|
+
};
|
|
22
|
+
function de(e) {
|
|
23
|
+
return Math.floor((e - E.insetPx * E.sides) / E.digitPx);
|
|
24
|
+
}
|
|
25
|
+
function fe({ value: e, locale: t, format: n, capacity: r }) {
|
|
26
|
+
let i = typeof n != "function" && n.style === "percent" ? e * E.percent : e;
|
|
27
|
+
return (typeof n == "function" || !(typeof n != "function" && (e === 0 || Math.abs(i) >= 1)) ? [n] : [
|
|
28
|
+
n,
|
|
29
|
+
{
|
|
30
|
+
...n,
|
|
31
|
+
minimumFractionDigits: 0,
|
|
32
|
+
maximumFractionDigits: 0
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
...n,
|
|
36
|
+
notation: "compact",
|
|
37
|
+
minimumFractionDigits: 0,
|
|
38
|
+
maximumFractionDigits: 1
|
|
39
|
+
}
|
|
40
|
+
]).map((n) => h({
|
|
41
|
+
value: e,
|
|
42
|
+
locale: t,
|
|
43
|
+
format: n
|
|
44
|
+
})).find((e) => e.length <= r);
|
|
45
|
+
}
|
|
46
|
+
function pe(e, t, n) {
|
|
47
|
+
switch (e.kind) {
|
|
48
|
+
case "masked": return "×";
|
|
49
|
+
case "missing": return "—";
|
|
50
|
+
case "value": return n ? "!" : t ?? (e.value === 0 ? "0" : "•");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function me({ cell: e, domain: t, locale: n, format: r }) {
|
|
54
|
+
if (e === void 0) return "Not supplied";
|
|
55
|
+
switch (e.kind) {
|
|
56
|
+
case "value": return `${h({
|
|
57
|
+
value: e.value,
|
|
58
|
+
locale: n,
|
|
59
|
+
format: r
|
|
60
|
+
})}${b(e.value, t) ? "" : " (outside domain)"}`;
|
|
61
|
+
case "masked": return `Masked: ${e.reason}`;
|
|
62
|
+
case "missing": return `Missing: ${e.reason}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// packages/charts/src/matrix/matrix-mark.tsx
|
|
66
|
+
var D = {
|
|
67
|
+
interactive: {
|
|
68
|
+
kkrTdU: "x1ypdohk",
|
|
69
|
+
k3XXqK: "x1t137rt",
|
|
70
|
+
kSVDLA: "xjf78fh",
|
|
71
|
+
kPJHz1: "x13qnu6",
|
|
72
|
+
kZs9gx: "x19rmrnh",
|
|
73
|
+
k7shQP: "x9v5kkp",
|
|
74
|
+
kiEn40: "x1bqaal",
|
|
75
|
+
kaVNsj: "x1box67k",
|
|
76
|
+
$$css: !0
|
|
77
|
+
},
|
|
78
|
+
marked: {
|
|
79
|
+
kMeerF: "x12ei19c",
|
|
80
|
+
kjBf7l: "xx9gdjd",
|
|
81
|
+
k3XXqK: "xaatb59",
|
|
82
|
+
kInvED: "x2ssjo2",
|
|
83
|
+
$$css: !0
|
|
84
|
+
},
|
|
85
|
+
edges: (e) => [{
|
|
86
|
+
kGVxlE: e == null ? e : "x1iotiob",
|
|
87
|
+
$$css: !0
|
|
88
|
+
}, { "--x-boxShadow": e ?? void 0 }]
|
|
89
|
+
};
|
|
90
|
+
function he({ view: e, isSelectable: t, appearance: n, children: r }) {
|
|
91
|
+
let i = e.isInspected || e.isSelected, a = t && e.cell !== void 0;
|
|
92
|
+
return /* @__PURE__ */ w(l, {
|
|
93
|
+
value: e.id,
|
|
94
|
+
"data-matrix-row": e.row.id,
|
|
95
|
+
"data-matrix-column": e.column.id,
|
|
96
|
+
render: a ? /* @__PURE__ */ w("button", {
|
|
97
|
+
type: "button",
|
|
98
|
+
tabIndex: -1,
|
|
99
|
+
"aria-pressed": e.isSelected
|
|
100
|
+
}) : /* @__PURE__ */ w("span", { role: "img" }),
|
|
101
|
+
"aria-label": e.label,
|
|
102
|
+
title: e.label,
|
|
103
|
+
...S.props(...n, a && D.interactive, e.edges !== void 0 && D.edges(e.edges), i && D.marked, !i && e.isCursor && v.cursor),
|
|
104
|
+
children: r
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
// packages/charts/src/matrix/matrix-range.ts
|
|
108
|
+
function O(e, t) {
|
|
109
|
+
return e.findIndex((e) => e.id === t);
|
|
110
|
+
}
|
|
111
|
+
function ge(e, { rows: t, columns: n }) {
|
|
112
|
+
if (e !== null) return [e.anchor, e.end].every((e) => O(t, e.rowId) >= 0 && O(n, e.columnId) >= 0) ? void 0 : "The cell range must refer to a supplied row and column at both corners.";
|
|
113
|
+
}
|
|
114
|
+
function _e(e, { rows: t, columns: n }) {
|
|
115
|
+
let r = O(t, e.anchor.rowId), i = O(t, e.end.rowId), a = O(n, e.anchor.columnId), o = O(n, e.end.columnId);
|
|
116
|
+
return {
|
|
117
|
+
top: Math.min(r, i),
|
|
118
|
+
bottom: Math.max(r, i),
|
|
119
|
+
left: Math.min(a, o),
|
|
120
|
+
right: Math.max(a, o)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function ve(e, t, n) {
|
|
124
|
+
let r = t >= e.top && t <= e.bottom, i = n >= e.left && n <= e.right;
|
|
125
|
+
return r && i;
|
|
126
|
+
}
|
|
127
|
+
var k = {
|
|
128
|
+
ArrowUp: -1,
|
|
129
|
+
ArrowDown: 1
|
|
130
|
+
}, ye = {
|
|
131
|
+
ArrowLeft: -1,
|
|
132
|
+
ArrowRight: 1
|
|
133
|
+
};
|
|
134
|
+
function be({ key: e, range: t, from: n, isReversed: r, rows: i, columns: a }) {
|
|
135
|
+
let o = t?.anchor ?? n, s = t?.end ?? n, c = O(i, s.rowId), l = O(a, s.columnId), u = a.length - 1, d = r ? -1 : 1, f = {
|
|
136
|
+
Home: 0,
|
|
137
|
+
End: u
|
|
138
|
+
}, p = ye[e], m = k[e] ?? 0, h = f[e] ?? (p === void 0 ? void 0 : l + p * d);
|
|
139
|
+
if (h === void 0 && k[e] === void 0) return;
|
|
140
|
+
let g = i[Math.max(0, Math.min(i.length - 1, c + m))], _ = a[Math.max(0, Math.min(u, h ?? l))];
|
|
141
|
+
if (g !== void 0 && _ !== void 0) return {
|
|
142
|
+
anchor: o,
|
|
143
|
+
end: {
|
|
144
|
+
rowId: g.id,
|
|
145
|
+
columnId: _.id
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
function xe({ rows: e, columns: t }) {
|
|
150
|
+
let [n, r, i, a] = [
|
|
151
|
+
e[0],
|
|
152
|
+
e.at(-1),
|
|
153
|
+
t[0],
|
|
154
|
+
t.at(-1)
|
|
155
|
+
];
|
|
156
|
+
if (n !== void 0 && r !== void 0 && i !== void 0 && a !== void 0) return {
|
|
157
|
+
anchor: {
|
|
158
|
+
rowId: n.id,
|
|
159
|
+
columnId: i.id
|
|
160
|
+
},
|
|
161
|
+
end: {
|
|
162
|
+
rowId: r.id,
|
|
163
|
+
columnId: a.id
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function Se({ bounds: e, rows: t, columns: n, read: r }) {
|
|
168
|
+
let i = t.slice(e.top, e.bottom + 1).map((t) => n.slice(e.left, e.right + 1).map((e) => r({
|
|
169
|
+
rowId: t.id,
|
|
170
|
+
columnId: e.id
|
|
171
|
+
})));
|
|
172
|
+
return C(i.map((e) => [...e]));
|
|
173
|
+
}
|
|
174
|
+
function A({ items: e, from: t, to: n, noun: r }) {
|
|
175
|
+
let i = e[t]?.label ?? "", a = e[n]?.label ?? "";
|
|
176
|
+
return t === n ? `${r} ${i}` : `${r}s ${i} to ${a}`;
|
|
177
|
+
}
|
|
178
|
+
function Ce({ bounds: e, rows: t, columns: n, count: r, rowNoun: i = "row", columnNoun: a = "column" }) {
|
|
179
|
+
return `${r === 1 ? "1 cell" : `${r} cells`} selected: ${A({
|
|
180
|
+
items: t,
|
|
181
|
+
from: e.top,
|
|
182
|
+
to: e.bottom,
|
|
183
|
+
noun: i
|
|
184
|
+
})}, ${A({
|
|
185
|
+
items: n,
|
|
186
|
+
from: e.left,
|
|
187
|
+
to: e.right,
|
|
188
|
+
noun: a
|
|
189
|
+
})}`;
|
|
190
|
+
}
|
|
191
|
+
// packages/charts/src/matrix/matrix-strip.tsx
|
|
192
|
+
var we = {
|
|
193
|
+
k1xSpc: "xrvj5dj",
|
|
194
|
+
kumcoG: "xqketvx",
|
|
195
|
+
k1C7PZ: "xuwhhnn",
|
|
196
|
+
khm7nJ: "x1hm1d26",
|
|
197
|
+
kGNEyG: "x6s0dn4",
|
|
198
|
+
k7Eaqz: "xeuugli",
|
|
199
|
+
kMv6JI: "x1hz01jw",
|
|
200
|
+
$$css: !0
|
|
201
|
+
}, Te = {
|
|
202
|
+
kKwaWg: "x1e87kdn",
|
|
203
|
+
$$css: !0
|
|
204
|
+
}, j = {
|
|
205
|
+
grid: (e) => [we, { "--x-gridTemplateColumns": `minmax(48px, max-content) repeat(${e}, minmax(14px, 1fr))` == null ? void 0 : `minmax(48px, max-content) repeat(${e}, minmax(14px, 1fr))` }],
|
|
206
|
+
header: {
|
|
207
|
+
k7Eaqz: "xeuugli",
|
|
208
|
+
khDVqt: "xuxw1ft",
|
|
209
|
+
kMwMTN: "x153jb6y",
|
|
210
|
+
kGuDYH: "xy8obcc",
|
|
211
|
+
kLWn49: "xas2l8k",
|
|
212
|
+
$$css: !0
|
|
213
|
+
},
|
|
214
|
+
rowLabel: {
|
|
215
|
+
ks0D6T: "x18qnofl",
|
|
216
|
+
kVQacm: "xb3r6kr",
|
|
217
|
+
kg5iWk: "xlyipyv",
|
|
218
|
+
khDVqt: "xuxw1ft",
|
|
219
|
+
kwRFfy: "x1fa0jp5",
|
|
220
|
+
kMwMTN: "xbixft",
|
|
221
|
+
kGuDYH: "xy8obcc",
|
|
222
|
+
kLWn49: "xas2l8k",
|
|
223
|
+
$$css: !0
|
|
224
|
+
},
|
|
225
|
+
cell: {
|
|
226
|
+
k1xSpc: "x78zum5",
|
|
227
|
+
kGNEyG: "x6s0dn4",
|
|
228
|
+
kjj79g: "xl56j7k",
|
|
229
|
+
kB7OPa: "x9f619",
|
|
230
|
+
kzqmXN: "xh8yej3",
|
|
231
|
+
kZKoxP: "x17rw0jw x1ilzfib",
|
|
232
|
+
kogj98: "x1ghz6dp",
|
|
233
|
+
kmVPX3: "x1717udv",
|
|
234
|
+
kMzoRj: "xmkeg23",
|
|
235
|
+
ksu8eU: "x1y0btm7",
|
|
236
|
+
kVAM5u: "x1ey3b81",
|
|
237
|
+
kWkggS: "xpvm0e4",
|
|
238
|
+
kMwMTN: "x153jb6y",
|
|
239
|
+
kMv6JI: "x1hz01jw",
|
|
240
|
+
kGuDYH: "xy8obcc",
|
|
241
|
+
kLWn49: "xo5v014",
|
|
242
|
+
$$css: !0
|
|
243
|
+
},
|
|
244
|
+
measured: (e) => [Te, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${e})` }],
|
|
245
|
+
empty: {
|
|
246
|
+
kWkggS: "x1r7kqkb",
|
|
247
|
+
$$css: !0
|
|
248
|
+
},
|
|
249
|
+
dashed: {
|
|
250
|
+
ksu8eU: "xbsl7fq",
|
|
251
|
+
kVAM5u: "xqrc7c3",
|
|
252
|
+
kWkggS: "x1r7kqkb",
|
|
253
|
+
$$css: !0
|
|
254
|
+
},
|
|
255
|
+
outlined: {
|
|
256
|
+
kVAM5u: "x159tnba",
|
|
257
|
+
$$css: !0
|
|
258
|
+
}
|
|
259
|
+
}, Ee = {
|
|
260
|
+
clip: {
|
|
261
|
+
kVQacm: "xb3r6kr",
|
|
262
|
+
kg5iWk: "xbrixnn",
|
|
263
|
+
k9WMMc: "x2b8uid",
|
|
264
|
+
$$css: !0
|
|
265
|
+
},
|
|
266
|
+
overflow: {
|
|
267
|
+
kVQacm: "x1rea2x4",
|
|
268
|
+
k9WMMc: "x1yc453h",
|
|
269
|
+
$$css: !0
|
|
270
|
+
}
|
|
271
|
+
}, M = {
|
|
272
|
+
text: { $$css: !0 },
|
|
273
|
+
mono: {
|
|
274
|
+
kMv6JI: "xiard35",
|
|
275
|
+
khDVqt: "x1sdyfia",
|
|
276
|
+
$$css: !0
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
function N(e) {
|
|
280
|
+
let t = e.cell === void 0 || e.cell.kind === "masked" ? j.empty : j.dashed;
|
|
281
|
+
return [
|
|
282
|
+
j.cell,
|
|
283
|
+
e.fill === void 0 ? t : j.measured(e.fill),
|
|
284
|
+
e.marking === "outlined" && j.outlined
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
function P(e) {
|
|
288
|
+
return e.cell?.kind === "value" && !e.isOutside ? "" : e.glyph;
|
|
289
|
+
}
|
|
290
|
+
function De({ rows: e, columns: t, rowTitle: n, columnTitle: r, font: i, headers: a, viewAt: o, isSelectable: s }) {
|
|
291
|
+
return /* @__PURE__ */ T("div", {
|
|
292
|
+
...S.props(j.grid(t.length)),
|
|
293
|
+
children: [
|
|
294
|
+
r !== void 0 && /* @__PURE__ */ T(ue, { children: [/* @__PURE__ */ w("span", { "aria-hidden": !0 }), /* @__PURE__ */ w("span", {
|
|
295
|
+
"aria-hidden": !0,
|
|
296
|
+
className: "xeuugli xuxw1ft xy8obcc xas2l8k xbixft xk4h15q x17d9j0x",
|
|
297
|
+
children: r
|
|
298
|
+
})] }),
|
|
299
|
+
/* @__PURE__ */ w("span", {
|
|
300
|
+
"aria-hidden": !0,
|
|
301
|
+
className: "xeuugli xuxw1ft xy8obcc xas2l8k xbixft xk4h15q",
|
|
302
|
+
children: n
|
|
303
|
+
}),
|
|
304
|
+
t.map((e) => /* @__PURE__ */ w("span", {
|
|
305
|
+
"aria-hidden": !0,
|
|
306
|
+
title: e.label,
|
|
307
|
+
...S.props(j.header, Ee[a], M[i]),
|
|
308
|
+
children: e.axisLabel ?? e.label
|
|
309
|
+
}, e.id)),
|
|
310
|
+
e.map((e) => /* @__PURE__ */ T("div", {
|
|
311
|
+
className: "xjp7ctv",
|
|
312
|
+
children: [/* @__PURE__ */ w("span", {
|
|
313
|
+
"aria-hidden": !0,
|
|
314
|
+
title: e.label,
|
|
315
|
+
...S.props(j.rowLabel, M[i]),
|
|
316
|
+
children: e.label
|
|
317
|
+
}), t.map((t) => {
|
|
318
|
+
let n = o(e.id, t.id);
|
|
319
|
+
return n === void 0 ? /* @__PURE__ */ w("span", {
|
|
320
|
+
"aria-hidden": !0,
|
|
321
|
+
className: "xqtp20y"
|
|
322
|
+
}, t.id) : /* @__PURE__ */ w(he, {
|
|
323
|
+
view: n,
|
|
324
|
+
isSelectable: s,
|
|
325
|
+
appearance: N(n),
|
|
326
|
+
children: P(n)
|
|
327
|
+
}, t.id);
|
|
328
|
+
})]
|
|
329
|
+
}, e.id))
|
|
330
|
+
]
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
// packages/charts/src/matrix/matrix-types.ts
|
|
334
|
+
function F(e, t) {
|
|
335
|
+
return JSON.stringify([e, t]);
|
|
336
|
+
}
|
|
337
|
+
// packages/charts/src/matrix/matrix-figure.tsx
|
|
338
|
+
var I = { cells: 4096 }, L = 2, Oe = 2, ke = 7.5, Ae = 160, je = 12, Me = 8, R = 2, Ne = {
|
|
339
|
+
shown: {
|
|
340
|
+
min: 40,
|
|
341
|
+
max: 56
|
|
342
|
+
},
|
|
343
|
+
hidden: {
|
|
344
|
+
min: 16,
|
|
345
|
+
max: 36
|
|
346
|
+
}
|
|
347
|
+
}, Pe = {
|
|
348
|
+
kKwaWg: "x1e87kdn",
|
|
349
|
+
$$css: !0
|
|
350
|
+
}, z = {
|
|
351
|
+
axisText: {
|
|
352
|
+
k1xSpc: "x104kibb",
|
|
353
|
+
kVQacm: "xb3r6kr",
|
|
354
|
+
kgKLqz: "x1ua5tub",
|
|
355
|
+
kJFfOR: "x1h7i4cw",
|
|
356
|
+
khDVqt: "xeaf4i8",
|
|
357
|
+
k9WMMc: "x2b8uid",
|
|
358
|
+
k8WAf4: "x1hmw7ec",
|
|
359
|
+
$$css: !0
|
|
360
|
+
},
|
|
361
|
+
rotated: {
|
|
362
|
+
k1xSpc: "x1rg5ohu",
|
|
363
|
+
kskxy: "x1mu601j",
|
|
364
|
+
kVQacm: "xb3r6kr",
|
|
365
|
+
kg5iWk: "xlyipyv",
|
|
366
|
+
kW8zPn: "x98t3bc",
|
|
367
|
+
k3aq6I: "x19jd1h0",
|
|
368
|
+
kg3NbH: "x14w6jbu",
|
|
369
|
+
$$css: !0
|
|
370
|
+
},
|
|
371
|
+
rowText: {
|
|
372
|
+
k1xSpc: "x1lliihq",
|
|
373
|
+
ks0D6T: "x18qnofl",
|
|
374
|
+
kVQacm: "xb3r6kr",
|
|
375
|
+
kg5iWk: "xlyipyv",
|
|
376
|
+
kwRFfy: "xx67isq",
|
|
377
|
+
$$css: !0
|
|
378
|
+
},
|
|
379
|
+
cell: {
|
|
380
|
+
kmVPX3: "x1717udv",
|
|
381
|
+
k9WMMc: "x2b8uid",
|
|
382
|
+
$$css: !0
|
|
383
|
+
},
|
|
384
|
+
width: (e) => [{
|
|
385
|
+
kzqmXN: e == null ? e : "x5lhr3w",
|
|
386
|
+
$$css: !0
|
|
387
|
+
}, { "--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }],
|
|
388
|
+
square: (e) => [{
|
|
389
|
+
kzqmXN: e == null ? e : "x5lhr3w",
|
|
390
|
+
kZKoxP: e == null ? e : "x16ye13r",
|
|
391
|
+
$$css: !0
|
|
392
|
+
}, {
|
|
393
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
394
|
+
"--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e)
|
|
395
|
+
}],
|
|
396
|
+
value: {
|
|
397
|
+
k1xSpc: "x78zum5",
|
|
398
|
+
kGNEyG: "x6s0dn4",
|
|
399
|
+
kjj79g: "xl56j7k",
|
|
400
|
+
kB7OPa: "x9f619",
|
|
401
|
+
kMzoRj: "xmkeg23",
|
|
402
|
+
ksu8eU: "x1y0btm7",
|
|
403
|
+
kVAM5u: "x1ey3b81",
|
|
404
|
+
kWkggS: "xpvm0e4",
|
|
405
|
+
kMwMTN: "xbixft",
|
|
406
|
+
kmVPX3: "x1717udv",
|
|
407
|
+
kMv6JI: "x1hz01jw",
|
|
408
|
+
kGuDYH: "xy8obcc",
|
|
409
|
+
k63SB2: "xj57cvi",
|
|
410
|
+
kLWn49: "xas2l8k",
|
|
411
|
+
kcqcaj: "xss6m8b",
|
|
412
|
+
$$css: !0
|
|
413
|
+
},
|
|
414
|
+
measured: (e) => [Pe, { "--x-backgroundImage": `linear-gradient(${e}, ${e})` == null ? void 0 : `linear-gradient(${e}, ${e})` }],
|
|
415
|
+
missing: {
|
|
416
|
+
kMwMTN: "x153jb6y",
|
|
417
|
+
kWkggS: "x1r7kqkb",
|
|
418
|
+
ksu8eU: "xbsl7fq",
|
|
419
|
+
$$css: !0
|
|
420
|
+
},
|
|
421
|
+
masked: {
|
|
422
|
+
kMwMTN: "x153jb6y",
|
|
423
|
+
kWkggS: "x1r7kqkb",
|
|
424
|
+
$$css: !0
|
|
425
|
+
},
|
|
426
|
+
outlined: {
|
|
427
|
+
kMzoRj: "xdh2fpr",
|
|
428
|
+
kVAM5u: "x159tnba",
|
|
429
|
+
$$css: !0
|
|
430
|
+
},
|
|
431
|
+
context: {
|
|
432
|
+
kMwMTN: "x153jb6y",
|
|
433
|
+
$$css: !0
|
|
434
|
+
}
|
|
435
|
+
}, Fe = {
|
|
436
|
+
shown: {
|
|
437
|
+
k7Eaqz: "x1gjsuxi",
|
|
438
|
+
kAzted: "x17oiadl",
|
|
439
|
+
$$css: !0
|
|
440
|
+
},
|
|
441
|
+
hidden: { $$css: !0 }
|
|
442
|
+
}, Ie = {
|
|
443
|
+
text: { $$css: !0 },
|
|
444
|
+
mono: {
|
|
445
|
+
kMv6JI: "xiard35",
|
|
446
|
+
khDVqt: "x1sdyfia",
|
|
447
|
+
$$css: !0
|
|
448
|
+
}
|
|
449
|
+
}, Le = {
|
|
450
|
+
value: void 0,
|
|
451
|
+
masked: z.masked,
|
|
452
|
+
missing: z.missing
|
|
453
|
+
}, Re = 28, ze = /* @__PURE__ */ new Set([
|
|
454
|
+
"ArrowLeft",
|
|
455
|
+
"ArrowRight",
|
|
456
|
+
"ArrowUp",
|
|
457
|
+
"ArrowDown",
|
|
458
|
+
"Home",
|
|
459
|
+
"End"
|
|
460
|
+
]);
|
|
461
|
+
function Be(t, n, r) {
|
|
462
|
+
if (t === void 0 || !ve(t, n, r)) return;
|
|
463
|
+
let i = e.ink, a = [
|
|
464
|
+
n === t.top ? `inset 0 ${L}px 0 0 ${i}` : void 0,
|
|
465
|
+
n === t.bottom ? `inset 0 -${L}px 0 0 ${i}` : void 0,
|
|
466
|
+
r === t.left ? `inset ${L}px 0 0 0 ${i}` : void 0,
|
|
467
|
+
r === t.right ? `inset -${L}px 0 0 0 ${i}` : void 0
|
|
468
|
+
].filter((e) => e !== void 0);
|
|
469
|
+
return a.length === 0 ? void 0 : a.join(", ");
|
|
470
|
+
}
|
|
471
|
+
function Ve(e, { lineCharacters: t, font: n }) {
|
|
472
|
+
let r = Array.from(e).length;
|
|
473
|
+
if (n === "mono" || r <= t) return r <= t;
|
|
474
|
+
let i = e.split(/(?<=[\s-])/u);
|
|
475
|
+
return r <= t * R && i.every((e) => Array.from(e).length <= t);
|
|
476
|
+
}
|
|
477
|
+
function He({ rows: e, columns: t, cells: n, domain: r, palette: a }) {
|
|
478
|
+
let o = y({
|
|
479
|
+
domain: r,
|
|
480
|
+
palette: a
|
|
481
|
+
});
|
|
482
|
+
if (o !== null) return o;
|
|
483
|
+
if (e.length * t.length > I.cells || n.length > I.cells) return `This matrix exceeds the ${I.cells}-cell render limit. Supply a smaller, labelled window.`;
|
|
484
|
+
if (!i(e) || !i(t) || !i(n)) return "Matrix rows, columns, and cells must have unique identifiers.";
|
|
485
|
+
let s = new Set(e.map((e) => e.id)), c = new Set(t.map((e) => e.id));
|
|
486
|
+
return n.some((e) => !s.has(e.rowId) || !c.has(e.columnId)) ? "Every matrix cell must refer to a supplied row and column." : n.some((e) => e.kind === "value" && !Number.isFinite(e.value)) ? "Measured matrix values must be finite. Use a missing cell for unavailable values." : new Set(n.map((e) => F(e.rowId, e.columnId))).size === n.length ? void 0 : "A matrix coordinate may contain only one cell.";
|
|
487
|
+
}
|
|
488
|
+
function Ue(e) {
|
|
489
|
+
return e?.kind === "value" ? String(e.value) : "";
|
|
490
|
+
}
|
|
491
|
+
function B(t) {
|
|
492
|
+
let { emptyLabel: n, rows: r, columns: i, cells: a, domain: l, palette: u, valueFormat: m, glyphFormat: h = m, valueLabel: v, variant: y, rowTitle: x, columnTitle: C, rowNoun: ue, columnNoun: E, axisFont: D = "text", headers: O = "clip", cellValues: k = "shown", marking: ye, cellLabel: A = (e, t) => `${e.label} → ${t.label}`, valueText: we, copyText: Te = Ue, notes: j = [], problem: Ee, selected: M, onSelectedChange: N, cellRange: P = null, onCellRangeChange: I, ...L } = t, { locale: R, title: Pe } = L, B = oe(), V = se(null), H = re(), We = p();
|
|
493
|
+
if (L.status === "loading") return /* @__PURE__ */ w(g, { ...L });
|
|
494
|
+
let U = Ee ?? He({
|
|
495
|
+
rows: r,
|
|
496
|
+
columns: i,
|
|
497
|
+
cells: a,
|
|
498
|
+
domain: l,
|
|
499
|
+
palette: u
|
|
500
|
+
}) ?? ge(P, {
|
|
501
|
+
rows: r,
|
|
502
|
+
columns: i
|
|
503
|
+
});
|
|
504
|
+
if (U !== void 0) return /* @__PURE__ */ w(te, {
|
|
505
|
+
...L,
|
|
506
|
+
message: U
|
|
507
|
+
});
|
|
508
|
+
let W = y === "strip", Ge = new Map(a.map((e) => [F(e.rowId, e.columnId), e]));
|
|
509
|
+
function G(e, t) {
|
|
510
|
+
return Ge.get(F(e, t));
|
|
511
|
+
}
|
|
512
|
+
function Ke(e) {
|
|
513
|
+
return we?.(e) ?? me({
|
|
514
|
+
cell: e,
|
|
515
|
+
domain: l,
|
|
516
|
+
locale: R,
|
|
517
|
+
format: m
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
let qe = Math.max(Array.from(x ?? "").length, ...r.map((e) => Array.from(e.label).length)), K = Math.min(Ae, qe * ke) + je, Je = Ne[k], q = H.width - K - Oe * (i.length + 2), J = Math.min(Je.max, Math.max(Je.min, Math.floor(q / Math.max(1, i.length)))), Ye = Math.floor((J - Me) / ke), Xe = i.some((e) => !Ve(e.label, {
|
|
521
|
+
lineCharacters: Ye,
|
|
522
|
+
font: D
|
|
523
|
+
})), Ze = de(J), Y = r.flatMap((e, t) => i.flatMap((n, r) => {
|
|
524
|
+
let i = ye?.(e, n);
|
|
525
|
+
if (i === "hidden") return [];
|
|
526
|
+
let a = G(e.id, n.id), o = a?.id ?? F(e.id, n.id), s = a?.kind === "value" && !b(a.value, l), c = a?.kind === "value" && k === "shown" ? fe({
|
|
527
|
+
value: a.value,
|
|
528
|
+
locale: R,
|
|
529
|
+
format: h,
|
|
530
|
+
capacity: Ze
|
|
531
|
+
}) : "", u = a === void 0 ? "·" : pe(a, c, s);
|
|
532
|
+
return [{
|
|
533
|
+
id: o,
|
|
534
|
+
row: e,
|
|
535
|
+
column: n,
|
|
536
|
+
rowIndex: t,
|
|
537
|
+
columnIndex: r,
|
|
538
|
+
cell: a,
|
|
539
|
+
mark: i,
|
|
540
|
+
label: `${A(e, n)}: ${Ke(a)}`,
|
|
541
|
+
isOutside: s,
|
|
542
|
+
glyph: u
|
|
543
|
+
}];
|
|
544
|
+
})), X = Y.length < r.length * i.length, Qe = Y.filter((e) => W || e.cell !== void 0).map(({ id: e, label: t }) => ({
|
|
545
|
+
id: e,
|
|
546
|
+
label: t
|
|
547
|
+
})), $e = new Map(Y.map((e) => [e.id, e])), Z = P === null ? void 0 : _e(P, {
|
|
548
|
+
rows: r,
|
|
549
|
+
columns: i
|
|
550
|
+
}), et = I !== void 0, tt = Z === void 0 ? void 0 : Ce({
|
|
551
|
+
bounds: Z,
|
|
552
|
+
rows: r,
|
|
553
|
+
columns: i,
|
|
554
|
+
rowNoun: ue,
|
|
555
|
+
columnNoun: E,
|
|
556
|
+
count: Y.filter((e) => ve(Z, e.rowIndex, e.columnIndex)).length
|
|
557
|
+
});
|
|
558
|
+
function Q(e, t, n) {
|
|
559
|
+
if (I?.(e, {
|
|
560
|
+
reason: t,
|
|
561
|
+
event: n
|
|
562
|
+
}), e !== null && t === "list-navigation") {
|
|
563
|
+
let t = _e(e, {
|
|
564
|
+
rows: r,
|
|
565
|
+
columns: i
|
|
566
|
+
}), n = Y.filter((e) => ve(t, e.rowIndex, e.columnIndex)).length;
|
|
567
|
+
ce(Ce({
|
|
568
|
+
bounds: t,
|
|
569
|
+
rows: r,
|
|
570
|
+
columns: i,
|
|
571
|
+
rowNoun: ue,
|
|
572
|
+
columnNoun: E,
|
|
573
|
+
count: n
|
|
574
|
+
}));
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
function nt(e) {
|
|
578
|
+
let t = e === null ? void 0 : $e.get(e);
|
|
579
|
+
return t === void 0 ? void 0 : {
|
|
580
|
+
rowId: t.row.id,
|
|
581
|
+
columnId: t.column.id
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
function rt(e) {
|
|
585
|
+
let t = e instanceof Element ? e.closest("[data-matrix-row]") : null, { matrixRow: n, matrixColumn: r } = t instanceof HTMLElement ? t.dataset : {};
|
|
586
|
+
return n === void 0 || r === void 0 ? void 0 : {
|
|
587
|
+
rowId: n,
|
|
588
|
+
columnId: r
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
function it(e, t) {
|
|
592
|
+
let n = e.ctrlKey || e.metaKey;
|
|
593
|
+
if (n && e.key === "a") {
|
|
594
|
+
let t = xe({
|
|
595
|
+
rows: r,
|
|
596
|
+
columns: i
|
|
597
|
+
});
|
|
598
|
+
t !== void 0 && (e.preventDefault(), Q(t, "list-navigation", e.nativeEvent));
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
if (e.key === "Escape" || !e.shiftKey && ze.has(e.key)) {
|
|
602
|
+
P !== null && Q(null, "list-navigation", e.nativeEvent);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
let a = nt(t);
|
|
606
|
+
if (!e.shiftKey || n || e.altKey || a === void 0) return;
|
|
607
|
+
let o = be({
|
|
608
|
+
key: e.key,
|
|
609
|
+
range: P,
|
|
610
|
+
from: a,
|
|
611
|
+
isReversed: le(e.currentTarget),
|
|
612
|
+
rows: r,
|
|
613
|
+
columns: i
|
|
614
|
+
});
|
|
615
|
+
o !== void 0 && (e.preventDefault(), Q(o, "list-navigation", e.nativeEvent));
|
|
616
|
+
}
|
|
617
|
+
function at(e, t) {
|
|
618
|
+
let n = rt(e.target);
|
|
619
|
+
n !== void 0 && (e.shiftKey ? Q({
|
|
620
|
+
anchor: P?.anchor ?? nt(t) ?? n,
|
|
621
|
+
end: n
|
|
622
|
+
}, "item-press", e.nativeEvent) : (V.current = n, P !== null && Q(null, "item-press", e.nativeEvent)));
|
|
623
|
+
}
|
|
624
|
+
function ot(e) {
|
|
625
|
+
let t = V.current, n = rt(e.target);
|
|
626
|
+
if (t === null || n === void 0 || e.buttons !== 1) return;
|
|
627
|
+
let r = P?.end.rowId === n.rowId && P.end.columnId === n.columnId, i = P === null && t.rowId === n.rowId && t.columnId === n.columnId;
|
|
628
|
+
!r && !i && Q({
|
|
629
|
+
anchor: t,
|
|
630
|
+
end: n
|
|
631
|
+
}, "drag", e.nativeEvent);
|
|
632
|
+
}
|
|
633
|
+
function st(e, t) {
|
|
634
|
+
let n = nt(t), a = P ?? (n === void 0 ? void 0 : {
|
|
635
|
+
anchor: n,
|
|
636
|
+
end: n
|
|
637
|
+
});
|
|
638
|
+
if (a === void 0) return;
|
|
639
|
+
let o = Se({
|
|
640
|
+
bounds: _e(a, {
|
|
641
|
+
rows: r,
|
|
642
|
+
columns: i
|
|
643
|
+
}),
|
|
644
|
+
rows: r,
|
|
645
|
+
columns: i,
|
|
646
|
+
read: ({ rowId: e, columnId: t }) => $e.has(G(e, t)?.id ?? F(e, t)) ? Te(G(e, t)) : ""
|
|
647
|
+
});
|
|
648
|
+
e.preventDefault(), e.clipboardData.setData("text/plain", o);
|
|
649
|
+
}
|
|
650
|
+
function ct(t) {
|
|
651
|
+
return new Map(Y.map((n) => {
|
|
652
|
+
let { cell: r, isOutside: i } = n, a = n.mark === "context" ? `color-mix(in srgb, ${e.muted} ${Re}%, ${e.surface})` : r?.kind === "value" && !i ? ie(r.value, {
|
|
653
|
+
domain: l,
|
|
654
|
+
palette: u
|
|
655
|
+
}) : void 0;
|
|
656
|
+
return [F(n.row.id, n.column.id), {
|
|
657
|
+
id: n.id,
|
|
658
|
+
row: n.row,
|
|
659
|
+
column: n.column,
|
|
660
|
+
cell: r,
|
|
661
|
+
label: n.label,
|
|
662
|
+
glyph: n.glyph,
|
|
663
|
+
fill: a,
|
|
664
|
+
isOutside: i,
|
|
665
|
+
marking: n.mark,
|
|
666
|
+
edges: Be(Z, n.rowIndex, n.columnIndex),
|
|
667
|
+
isSelected: r !== void 0 && M === r.id,
|
|
668
|
+
isInspected: t.inspected === n.id,
|
|
669
|
+
isCursor: t.cursor === n.id
|
|
670
|
+
}];
|
|
671
|
+
}));
|
|
672
|
+
}
|
|
673
|
+
let lt = r.length === 0 || i.length === 0, $ = d({
|
|
674
|
+
title: Pe,
|
|
675
|
+
isSelectable: N !== void 0
|
|
676
|
+
}), ut = Y.some((e) => e.glyph === "•"), dt = W || k === "hidden", ft = [
|
|
677
|
+
a.some((e) => e.kind === "masked") ? "× Masked" : void 0,
|
|
678
|
+
a.some((e) => e.kind === "missing") ? "— Missing" : void 0,
|
|
679
|
+
Y.some((e) => e.cell === void 0) ? "· Not supplied" : void 0,
|
|
680
|
+
a.some((e) => e.kind === "value" && !b(e.value, l)) ? "! Outside domain" : void 0,
|
|
681
|
+
dt ? "Inspect a cell for its exact value" : void 0,
|
|
682
|
+
!dt && ut ? "• Inspect a cell for its exact value" : void 0,
|
|
683
|
+
...j,
|
|
684
|
+
et ? "Shift with the arrow keys or a drag marks a block to copy" : void 0
|
|
685
|
+
].filter((e) => e !== void 0);
|
|
686
|
+
return /* @__PURE__ */ w(f, {
|
|
687
|
+
...We,
|
|
688
|
+
items: Qe,
|
|
689
|
+
columns: W && !X ? i.length : void 0,
|
|
690
|
+
place: W && !X ? void 0 : (e) => {
|
|
691
|
+
let t = $e.get(e);
|
|
692
|
+
return t === void 0 ? void 0 : {
|
|
693
|
+
left: t.columnIndex,
|
|
694
|
+
top: t.rowIndex,
|
|
695
|
+
right: t.columnIndex + 1,
|
|
696
|
+
bottom: t.rowIndex + 1
|
|
697
|
+
};
|
|
698
|
+
},
|
|
699
|
+
selected: M ?? null,
|
|
700
|
+
onSelect: N === void 0 ? void 0 : (e, t) => {
|
|
701
|
+
a.some((t) => t.id === e) && N(e, t);
|
|
702
|
+
},
|
|
703
|
+
render: (e, t) => {
|
|
704
|
+
let a = ct(t), d = {
|
|
705
|
+
onCopy: (e) => st(e, t.cursor),
|
|
706
|
+
...et ? {
|
|
707
|
+
onKeyDownCapture: (e) => it(e, t.cursor),
|
|
708
|
+
onPointerDown: (e) => at(e, t.cursor),
|
|
709
|
+
onPointerMove: ot,
|
|
710
|
+
onPointerUp: () => {
|
|
711
|
+
V.current = null;
|
|
712
|
+
}
|
|
713
|
+
} : {}
|
|
714
|
+
};
|
|
715
|
+
return /* @__PURE__ */ w(ee, {
|
|
716
|
+
...L,
|
|
717
|
+
figure: e,
|
|
718
|
+
scaleLegend: lt ? void 0 : /* @__PURE__ */ w(ae, {
|
|
719
|
+
label: v,
|
|
720
|
+
domain: l,
|
|
721
|
+
palette: u,
|
|
722
|
+
valueFormat: m,
|
|
723
|
+
locale: R
|
|
724
|
+
}),
|
|
725
|
+
footer: lt ? void 0 : /* @__PURE__ */ T("div", {
|
|
726
|
+
className: "xrvj5dj x1n8ia3y",
|
|
727
|
+
children: [
|
|
728
|
+
ft.length > 0 && /* @__PURE__ */ w("ul", {
|
|
729
|
+
"aria-label": "Cell states",
|
|
730
|
+
className: "x78zum5 x1a02dak x1n8ia3y x1ghz6dp x1717udv xe8uvvx x153jb6y xy8obcc",
|
|
731
|
+
children: ft.map((e) => /* @__PURE__ */ w("li", { children: e }, e))
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ w(c, {
|
|
734
|
+
id: B,
|
|
735
|
+
children: tt ?? s(Qe, t.inspected)
|
|
736
|
+
}),
|
|
737
|
+
/* @__PURE__ */ w(_, {
|
|
738
|
+
label: `${Pe} cells`,
|
|
739
|
+
columns: [{
|
|
740
|
+
id: "cell",
|
|
741
|
+
label: "Cell"
|
|
742
|
+
}, {
|
|
743
|
+
id: "value",
|
|
744
|
+
label: v
|
|
745
|
+
}],
|
|
746
|
+
rows: Y.map((e) => ({
|
|
747
|
+
id: F(e.row.id, e.column.id),
|
|
748
|
+
values: [A(e.row, e.column), Ke(e.cell)]
|
|
749
|
+
}))
|
|
750
|
+
})
|
|
751
|
+
]
|
|
752
|
+
}),
|
|
753
|
+
children: lt ? /* @__PURE__ */ w(ne, { children: n }) : /* @__PURE__ */ w("div", {
|
|
754
|
+
ref: H.ref,
|
|
755
|
+
className: "xeuugli",
|
|
756
|
+
children: /* @__PURE__ */ w(o, {
|
|
757
|
+
role: "group",
|
|
758
|
+
"aria-label": $,
|
|
759
|
+
"aria-describedby": B,
|
|
760
|
+
...d,
|
|
761
|
+
...{
|
|
762
|
+
0: { className: "xysyzu8 x159tps6 xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x-default-marker" },
|
|
763
|
+
1: { className: "xysyzu8 x159tps6 xeuugli x1t137rt x13qnu6 x19rmrnh x9v5kkp x1bqaal x10dazmo x-default-marker" }
|
|
764
|
+
}[!!W | 0],
|
|
765
|
+
children: W ? /* @__PURE__ */ w(De, {
|
|
766
|
+
rows: r,
|
|
767
|
+
columns: i,
|
|
768
|
+
rowTitle: x,
|
|
769
|
+
columnTitle: C,
|
|
770
|
+
font: D,
|
|
771
|
+
headers: O,
|
|
772
|
+
viewAt: (e, t) => a.get(F(e, t)),
|
|
773
|
+
isSelectable: N !== void 0
|
|
774
|
+
}) : /* @__PURE__ */ T("table", {
|
|
775
|
+
className: "x1vathgz x1jkpq5q xezivpi x1hz01jw",
|
|
776
|
+
children: [/* @__PURE__ */ T("thead", { children: [C !== void 0 && /* @__PURE__ */ T("tr", { children: [/* @__PURE__ */ w("td", {}), /* @__PURE__ */ w("th", {
|
|
777
|
+
colSpan: i.length,
|
|
778
|
+
scope: "colgroup",
|
|
779
|
+
className: "x1717udv xy8obcc xas2l8k x1yc453h xuxw1ft xbixft xk4h15q xngumbj",
|
|
780
|
+
children: C
|
|
781
|
+
})] }), /* @__PURE__ */ T("tr", { children: [/* @__PURE__ */ w("th", {
|
|
782
|
+
className: "x1717udv xy8obcc xas2l8k x1yc453h xuxw1ft xbixft xk4h15q xngumbj",
|
|
783
|
+
children: x
|
|
784
|
+
}), i.map((e) => /* @__PURE__ */ w("th", {
|
|
785
|
+
scope: "col",
|
|
786
|
+
title: e.label,
|
|
787
|
+
...{
|
|
788
|
+
0: { className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft x3ajldb" },
|
|
789
|
+
1: { className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y xuxw1ft x3ajldb x2b8uid" }
|
|
790
|
+
}[!!Xe | 0],
|
|
791
|
+
children: /* @__PURE__ */ w("span", {
|
|
792
|
+
...S.props(Xe ? z.rotated : [z.axisText, z.width(J)], Ie[D]),
|
|
793
|
+
children: e.label
|
|
794
|
+
})
|
|
795
|
+
}, e.id))] })] }), /* @__PURE__ */ w("tbody", { children: r.map((e) => /* @__PURE__ */ T("tr", { children: [/* @__PURE__ */ w("th", {
|
|
796
|
+
scope: "row",
|
|
797
|
+
title: e.label,
|
|
798
|
+
className: "x1717udv xy8obcc xas2l8k xj57cvi x153jb6y x1yc453h xuxw1ft",
|
|
799
|
+
children: /* @__PURE__ */ w("span", {
|
|
800
|
+
...S.props(z.rowText, Ie[D]),
|
|
801
|
+
children: e.label
|
|
802
|
+
})
|
|
803
|
+
}), i.map((t) => {
|
|
804
|
+
let n = a.get(F(e.id, t.id));
|
|
805
|
+
return /* @__PURE__ */ w("td", {
|
|
806
|
+
...S.props(z.cell, z.width(J)),
|
|
807
|
+
children: n === void 0 ? null : /* @__PURE__ */ w(he, {
|
|
808
|
+
view: n,
|
|
809
|
+
isSelectable: N !== void 0,
|
|
810
|
+
appearance: [
|
|
811
|
+
z.value,
|
|
812
|
+
z.square(J),
|
|
813
|
+
Fe[k],
|
|
814
|
+
n.cell === void 0 ? z.missing : Le[n.cell.kind],
|
|
815
|
+
n.fill !== void 0 && z.measured(n.fill),
|
|
816
|
+
n.isOutside && z.missing,
|
|
817
|
+
n.marking === "outlined" && z.outlined,
|
|
818
|
+
n.marking === "context" && z.context
|
|
819
|
+
],
|
|
820
|
+
children: n.cell?.kind === "value" ? /* @__PURE__ */ w("span", {
|
|
821
|
+
className: "xpvm0e4 x1r97e56",
|
|
822
|
+
children: n.glyph
|
|
823
|
+
}) : n.glyph
|
|
824
|
+
})
|
|
825
|
+
}, t.id);
|
|
826
|
+
})] }, e.id)) })]
|
|
827
|
+
})
|
|
828
|
+
})
|
|
829
|
+
})
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
// packages/charts/src/matrix/matrix-presets.ts
|
|
835
|
+
function V({ rows: e, columns: t, values: n, noun: r, limit: a }) {
|
|
836
|
+
return e.length > a || t.length > a ? `This matrix draws at most ${a} ${r} on each side. Supply a smaller, labelled window.` : !i(e) || !i(t) ? `Matrix ${r} must have unique identifiers.` : n.length === e.length && n.every((e) => e.length === t.length) ? void 0 : `Supply one line of values per row and one value per column, for every ${r}.`;
|
|
837
|
+
}
|
|
838
|
+
function H(e, t, n) {
|
|
839
|
+
return e[t]?.[n] ?? null;
|
|
840
|
+
}
|
|
841
|
+
function We(e) {
|
|
842
|
+
return e.replaceAll(" ", "␣").replaceAll("\n", "⏎").replaceAll(" ", "⇥");
|
|
843
|
+
}
|
|
844
|
+
// packages/charts/src/matrix/attention-matrix.tsx
|
|
845
|
+
var U = { tokens: 64 }, W = "␣ space · ⏎ newline · ⇥ tab", Ge = {
|
|
846
|
+
minimumFractionDigits: 2,
|
|
847
|
+
maximumFractionDigits: 2
|
|
848
|
+
};
|
|
849
|
+
function G(e) {
|
|
850
|
+
return `${e.index} ${JSON.stringify(e.text)}`;
|
|
851
|
+
}
|
|
852
|
+
function Ke({ sources: e, destinations: t, weights: n, mask: r }) {
|
|
853
|
+
return [...e, ...t].some((e) => !Number.isSafeInteger(e.index) || e.index < 0) ? "Token positions must be whole numbers of zero or more." : [e, t].every((e) => new Set(e.map((e) => e.index)).size === e.length && i(e)) ? n.flat().some((e) => e !== null && !(e >= 0 && e <= 1)) ? "Attention weights must lie between 0 and 1. Use null for a weight that was not recorded." : r === "causal" && t.some((t, r) => e.some((e, i) => e.index > t.index && H(n, r, i) !== null)) ? "A pair under the causal mask must have a null weight, so masked never reads as zero." : void 0 : "Tokens on each side must have unique identifiers and positions.";
|
|
854
|
+
}
|
|
855
|
+
function qe(e) {
|
|
856
|
+
let { sources: t, destinations: n, weights: r, mask: i = "none", valueLabel: a = "Attention weight", valueFormat: o = Ge, emptyLabel: s = "No tokens were supplied.", ...c } = e, l = n.map((e) => ({
|
|
857
|
+
id: e.id,
|
|
858
|
+
label: We(e.text)
|
|
859
|
+
})), u = t.map((e) => ({
|
|
860
|
+
id: e.id,
|
|
861
|
+
label: We(e.text)
|
|
862
|
+
})), d = new Map(t.map((e) => [e.id, e])), f = new Map(n.map((e) => [e.id, e])), p = V({
|
|
863
|
+
rows: l,
|
|
864
|
+
columns: u,
|
|
865
|
+
values: r,
|
|
866
|
+
noun: "tokens",
|
|
867
|
+
limit: U.tokens
|
|
868
|
+
}) ?? Ke({
|
|
869
|
+
sources: t,
|
|
870
|
+
destinations: n,
|
|
871
|
+
weights: r,
|
|
872
|
+
mask: i
|
|
873
|
+
}), m = n.flatMap((e, n) => t.map((t, a) => {
|
|
874
|
+
let o = H(r, n, a), s = {
|
|
875
|
+
id: F(e.id, t.id),
|
|
876
|
+
rowId: e.id,
|
|
877
|
+
columnId: t.id
|
|
878
|
+
};
|
|
879
|
+
return i === "causal" && t.index > e.index ? {
|
|
880
|
+
...s,
|
|
881
|
+
kind: "masked",
|
|
882
|
+
reason: "Causal mask: the source comes after the destination"
|
|
883
|
+
} : o === null ? {
|
|
884
|
+
...s,
|
|
885
|
+
kind: "missing",
|
|
886
|
+
reason: "Not recorded"
|
|
887
|
+
} : {
|
|
888
|
+
...s,
|
|
889
|
+
kind: "value",
|
|
890
|
+
value: o
|
|
891
|
+
};
|
|
892
|
+
}));
|
|
893
|
+
function h(e, t) {
|
|
894
|
+
let n = f.get(e.id), r = d.get(t.id);
|
|
895
|
+
return r === void 0 || n === void 0 ? `${e.id} → ${t.id}` : `Destination ${G(n)} attends to source ${G(r)}`;
|
|
896
|
+
}
|
|
897
|
+
return /* @__PURE__ */ w(B, {
|
|
898
|
+
...c,
|
|
899
|
+
emptyLabel: s,
|
|
900
|
+
problem: p,
|
|
901
|
+
rows: l,
|
|
902
|
+
columns: u,
|
|
903
|
+
cells: m,
|
|
904
|
+
domain: [0, 1],
|
|
905
|
+
palette: "sequential",
|
|
906
|
+
valueFormat: o,
|
|
907
|
+
valueLabel: a,
|
|
908
|
+
variant: "values",
|
|
909
|
+
rowTitle: "Destination",
|
|
910
|
+
columnTitle: "Source",
|
|
911
|
+
rowNoun: "destination",
|
|
912
|
+
columnNoun: "source",
|
|
913
|
+
axisFont: "mono",
|
|
914
|
+
cellLabel: h,
|
|
915
|
+
notes: [...t, ...n].some((e) => /\s/u.test(e.text)) ? [W] : []
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
// packages/charts/src/matrix/calendar-heatmap.tsx
|
|
919
|
+
var K = { days: 1096 }, Je = [
|
|
920
|
+
"sunday",
|
|
921
|
+
"monday",
|
|
922
|
+
"tuesday",
|
|
923
|
+
"wednesday",
|
|
924
|
+
"thursday",
|
|
925
|
+
"friday",
|
|
926
|
+
"saturday"
|
|
927
|
+
], q = 7, J = 864e5, Ye = "UTC", Xe = {
|
|
928
|
+
weekday: "short",
|
|
929
|
+
timeZone: Ye
|
|
930
|
+
}, Ze = {
|
|
931
|
+
month: "short",
|
|
932
|
+
timeZone: Ye
|
|
933
|
+
}, Y = {
|
|
934
|
+
weekday: "short",
|
|
935
|
+
year: "numeric",
|
|
936
|
+
month: "short",
|
|
937
|
+
day: "numeric",
|
|
938
|
+
timeZone: Ye
|
|
939
|
+
};
|
|
940
|
+
function X(e) {
|
|
941
|
+
return Date.UTC(e.year, e.month - 1, e.day) / J;
|
|
942
|
+
}
|
|
943
|
+
function Qe(e) {
|
|
944
|
+
return ((X(e) + 4) % q + q) % q;
|
|
945
|
+
}
|
|
946
|
+
function $e({ from: e, to: n, weekStartsOn: i, locale: a }) {
|
|
947
|
+
let o = Je.indexOf(i), s = (Qe(e) - o + q) % q, c = r(e, -s), l = Math.ceil((X(n) - X(c) + 1) / q);
|
|
948
|
+
function u(e) {
|
|
949
|
+
return X(e) * J;
|
|
950
|
+
}
|
|
951
|
+
let d = Array.from({ length: q }, (e, t) => {
|
|
952
|
+
let n = r(c, t);
|
|
953
|
+
return {
|
|
954
|
+
id: Je[(o + t) % q] ?? i,
|
|
955
|
+
label: m({
|
|
956
|
+
timestamp: u(n),
|
|
957
|
+
locale: a,
|
|
958
|
+
format: Xe
|
|
959
|
+
})
|
|
960
|
+
};
|
|
961
|
+
}), f = Array.from({ length: l }, (i, o) => {
|
|
962
|
+
let s = r(c, o * q), l = Array.from({ length: q }, (e, t) => r(s, t)).filter((t) => X(t) >= X(e) && X(t) <= X(n)), d = l.find((e) => e.day === 1) ?? (o === 0 ? l[0] : void 0);
|
|
963
|
+
return {
|
|
964
|
+
id: t(s),
|
|
965
|
+
label: `Week of ${m({
|
|
966
|
+
timestamp: u(l[0] ?? s),
|
|
967
|
+
locale: a,
|
|
968
|
+
format: Y
|
|
969
|
+
})}`,
|
|
970
|
+
axisLabel: d === void 0 ? "" : m({
|
|
971
|
+
timestamp: u(d),
|
|
972
|
+
locale: a,
|
|
973
|
+
format: Ze
|
|
974
|
+
})
|
|
975
|
+
};
|
|
976
|
+
}), p = X(n) - X(e) + 1;
|
|
977
|
+
return {
|
|
978
|
+
rows: d,
|
|
979
|
+
columns: f,
|
|
980
|
+
dates: Array.from({ length: p }, (n, i) => {
|
|
981
|
+
let a = r(e, i), o = i + s;
|
|
982
|
+
return {
|
|
983
|
+
date: t(a),
|
|
984
|
+
rowId: d[o % q]?.id ?? "",
|
|
985
|
+
columnId: f[Math.floor(o / q)]?.id ?? ""
|
|
986
|
+
};
|
|
987
|
+
})
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
function Z({ days: e, from: t, to: r }) {
|
|
991
|
+
return t === void 0 || r === void 0 || X(r) < X(t) ? "The range needs two valid dates as YYYY-MM-DD, the first on or before the last." : X(r) - X(t) + 1 > K.days ? `This calendar draws at most ${K.days} days. Supply a shorter range.` : e.map((e) => n(e.date)).some((e) => e === void 0 || X(e) < X(t) || X(e) > X(r)) ? "Every day must be a valid YYYY-MM-DD date inside the range." : new Set(e.map((e) => e.date)).size === e.length ? e.some((e) => e.value !== null && !Number.isFinite(e.value)) ? "Day values must be finite. Use null for a day without a value." : void 0 : "Each date may appear only once.";
|
|
992
|
+
}
|
|
993
|
+
function et(e) {
|
|
994
|
+
let { days: t, range: r, weekStartsOn: i, valueLabel: a, valueFormat: o, domain: s, emptyLabel: c = "No days were supplied.", ...l } = e, { locale: d } = l, f = n(r.from), p = n(r.to), h = Z({
|
|
995
|
+
days: t,
|
|
996
|
+
from: f,
|
|
997
|
+
to: p
|
|
998
|
+
}), g = h === void 0 && t.length > 0 && f !== void 0 && p !== void 0 ? $e({
|
|
999
|
+
from: f,
|
|
1000
|
+
to: p,
|
|
1001
|
+
weekStartsOn: i,
|
|
1002
|
+
locale: d
|
|
1003
|
+
}) : {
|
|
1004
|
+
rows: [],
|
|
1005
|
+
columns: [],
|
|
1006
|
+
dates: []
|
|
1007
|
+
}, _ = new Map(t.map((e) => [e.date, e.value])), ee = new Map(g.dates.map((e) => [`${e.rowId} ${e.columnId}`, e.date])), te = g.dates.map(({ date: e, rowId: t, columnId: n }) => {
|
|
1008
|
+
let r = _.get(e) ?? null;
|
|
1009
|
+
return r === null ? {
|
|
1010
|
+
id: e,
|
|
1011
|
+
rowId: t,
|
|
1012
|
+
columnId: n,
|
|
1013
|
+
kind: "missing",
|
|
1014
|
+
reason: "No value recorded"
|
|
1015
|
+
} : {
|
|
1016
|
+
id: e,
|
|
1017
|
+
rowId: t,
|
|
1018
|
+
columnId: n,
|
|
1019
|
+
kind: "value",
|
|
1020
|
+
value: r
|
|
1021
|
+
};
|
|
1022
|
+
});
|
|
1023
|
+
function ne(e, t) {
|
|
1024
|
+
return ee.get(`${e.id} ${t.id}`);
|
|
1025
|
+
}
|
|
1026
|
+
function v(e, t) {
|
|
1027
|
+
let r = n(ne(e, t) ?? "");
|
|
1028
|
+
return r === void 0 ? `${e.label}, ${t.label}` : m({
|
|
1029
|
+
timestamp: X(r) * J,
|
|
1030
|
+
locale: d,
|
|
1031
|
+
format: Y
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
return /* @__PURE__ */ w(B, {
|
|
1035
|
+
...l,
|
|
1036
|
+
emptyLabel: c,
|
|
1037
|
+
problem: h,
|
|
1038
|
+
rows: g.rows,
|
|
1039
|
+
columns: g.columns,
|
|
1040
|
+
cells: te,
|
|
1041
|
+
domain: s ?? u({
|
|
1042
|
+
values: t.map((e) => e.value),
|
|
1043
|
+
isZeroBased: !0
|
|
1044
|
+
}),
|
|
1045
|
+
palette: "sequential",
|
|
1046
|
+
valueFormat: o,
|
|
1047
|
+
valueLabel: a,
|
|
1048
|
+
variant: "strip",
|
|
1049
|
+
headers: "overflow",
|
|
1050
|
+
rowNoun: "weekday",
|
|
1051
|
+
columnNoun: "week",
|
|
1052
|
+
marking: (e, t) => ne(e, t) === void 0 ? "hidden" : void 0,
|
|
1053
|
+
cellLabel: v
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
// packages/charts/src/matrix/confusion-matrix.tsx
|
|
1057
|
+
var tt = { classes: 64 }, Q = { maximumFractionDigits: 0 }, nt = {
|
|
1058
|
+
style: "percent",
|
|
1059
|
+
maximumFractionDigits: 1
|
|
1060
|
+
};
|
|
1061
|
+
function rt(e) {
|
|
1062
|
+
return e.every((e) => e.every((e) => Number.isSafeInteger(e) && e >= 0)) ? void 0 : "Confusion counts must be whole numbers of zero or more.";
|
|
1063
|
+
}
|
|
1064
|
+
function it(e) {
|
|
1065
|
+
let { classes: t, counts: n, normalize: r = "none", valueLabel: i = "Examples", valueFormat: a = Q, shareFormat: o = nt, emptyLabel: s = "No classes were supplied.", ...c } = e, { locale: l } = c, u = r === "row", d = V({
|
|
1066
|
+
rows: t,
|
|
1067
|
+
columns: t,
|
|
1068
|
+
values: n,
|
|
1069
|
+
noun: "classes",
|
|
1070
|
+
limit: tt.classes
|
|
1071
|
+
}) ?? rt(n), f = t.map((e, t) => x(n[t] ?? [])), p = t.flatMap((e, r) => t.map((t, i) => {
|
|
1072
|
+
let a = H(n, r, i) ?? 0, o = f[r] ?? 0, s = F(e.id, t.id), c = o === 0 ? null : a / o;
|
|
1073
|
+
return {
|
|
1074
|
+
cell: u && c === null ? {
|
|
1075
|
+
id: s,
|
|
1076
|
+
rowId: e.id,
|
|
1077
|
+
columnId: t.id,
|
|
1078
|
+
kind: "missing",
|
|
1079
|
+
reason: `No examples of actual ${e.label}`
|
|
1080
|
+
} : {
|
|
1081
|
+
id: s,
|
|
1082
|
+
rowId: e.id,
|
|
1083
|
+
columnId: t.id,
|
|
1084
|
+
kind: "value",
|
|
1085
|
+
value: u ? c ?? 0 : a
|
|
1086
|
+
},
|
|
1087
|
+
count: a,
|
|
1088
|
+
share: c,
|
|
1089
|
+
actual: e
|
|
1090
|
+
};
|
|
1091
|
+
})), m = new Map(p.map((e) => [e.cell.id, e])), g = Math.max(1, ...p.map((e) => e.count));
|
|
1092
|
+
function _(e) {
|
|
1093
|
+
let t = e === void 0 ? void 0 : m.get(e.id);
|
|
1094
|
+
if (t === void 0) return "Not supplied";
|
|
1095
|
+
let n = h({
|
|
1096
|
+
value: t.count,
|
|
1097
|
+
locale: l,
|
|
1098
|
+
format: a
|
|
1099
|
+
}), r = h({
|
|
1100
|
+
value: t.share,
|
|
1101
|
+
locale: l,
|
|
1102
|
+
format: o
|
|
1103
|
+
});
|
|
1104
|
+
return t.share === null ? n : `${n} (${r} of actual ${t.actual.label})`;
|
|
1105
|
+
}
|
|
1106
|
+
return /* @__PURE__ */ w(B, {
|
|
1107
|
+
...c,
|
|
1108
|
+
emptyLabel: s,
|
|
1109
|
+
problem: d,
|
|
1110
|
+
rows: t,
|
|
1111
|
+
columns: t,
|
|
1112
|
+
cells: p.map((e) => e.cell),
|
|
1113
|
+
domain: u ? [0, 1] : [0, g],
|
|
1114
|
+
palette: "sequential",
|
|
1115
|
+
valueFormat: u ? o : a,
|
|
1116
|
+
valueLabel: u ? `Share of the actual class: ${i.toLowerCase()} in a row divided by the row total` : i,
|
|
1117
|
+
variant: "values",
|
|
1118
|
+
rowTitle: "Actual",
|
|
1119
|
+
columnTitle: "Predicted",
|
|
1120
|
+
rowNoun: "actual class",
|
|
1121
|
+
columnNoun: "predicted class",
|
|
1122
|
+
marking: (e, t) => e.id === t.id ? "outlined" : void 0,
|
|
1123
|
+
cellLabel: (e, t) => `Actual ${e.label}, predicted ${t.label}`,
|
|
1124
|
+
valueText: _,
|
|
1125
|
+
copyText: (e) => e === void 0 ? "" : String(m.get(e.id)?.count ?? ""),
|
|
1126
|
+
notes: ["Outlined: actual and predicted agree"]
|
|
1127
|
+
});
|
|
1128
|
+
}
|
|
1129
|
+
// packages/charts/src/matrix/correlation-matrix.tsx
|
|
1130
|
+
var at = { variables: 64 }, ot = {
|
|
1131
|
+
minimumFractionDigits: 2,
|
|
1132
|
+
maximumFractionDigits: 2
|
|
1133
|
+
};
|
|
1134
|
+
function st(e) {
|
|
1135
|
+
return e.flat().some((e) => e !== null && !(e >= -1 && e <= 1)) ? "Correlation coefficients must lie between -1 and 1. Use null for a pair that was not computed." : e.every((t, n) => t.every((t, r) => t === H(e, r, n))) ? void 0 : "A correlation matrix must be symmetric: each pair needs the same value both ways.";
|
|
1136
|
+
}
|
|
1137
|
+
function ct(e) {
|
|
1138
|
+
let { variables: t, coefficients: n, triangle: r = "full", valueLabel: i = "Correlation coefficient", valueFormat: a = ot, emptyLabel: o = "No variables were supplied.", ...s } = e, c = V({
|
|
1139
|
+
rows: t,
|
|
1140
|
+
columns: t,
|
|
1141
|
+
values: n,
|
|
1142
|
+
noun: "variables",
|
|
1143
|
+
limit: at.variables
|
|
1144
|
+
}) ?? st(n), l = new Map(t.map((e, t) => [e.id, t])), u = t.flatMap((e, r) => t.map((t, i) => {
|
|
1145
|
+
let a = H(n, r, i), o = {
|
|
1146
|
+
id: F(e.id, t.id),
|
|
1147
|
+
rowId: e.id,
|
|
1148
|
+
columnId: t.id
|
|
1149
|
+
};
|
|
1150
|
+
return a === null ? {
|
|
1151
|
+
...o,
|
|
1152
|
+
kind: "missing",
|
|
1153
|
+
reason: "Not computed"
|
|
1154
|
+
} : {
|
|
1155
|
+
...o,
|
|
1156
|
+
kind: "value",
|
|
1157
|
+
value: a
|
|
1158
|
+
};
|
|
1159
|
+
}));
|
|
1160
|
+
function d(e, t) {
|
|
1161
|
+
let n = l.get(e.id) ?? 0, i = l.get(t.id) ?? 0;
|
|
1162
|
+
return n === i ? "context" : r === "lower" && i > n ? "hidden" : void 0;
|
|
1163
|
+
}
|
|
1164
|
+
return /* @__PURE__ */ w(B, {
|
|
1165
|
+
...s,
|
|
1166
|
+
emptyLabel: o,
|
|
1167
|
+
problem: c,
|
|
1168
|
+
rows: t,
|
|
1169
|
+
columns: t,
|
|
1170
|
+
cells: u,
|
|
1171
|
+
domain: [-1, 1],
|
|
1172
|
+
palette: "diverging",
|
|
1173
|
+
valueFormat: a,
|
|
1174
|
+
valueLabel: i,
|
|
1175
|
+
variant: "values",
|
|
1176
|
+
marking: d,
|
|
1177
|
+
cellLabel: (e, t) => `${e.label} and ${t.label}`,
|
|
1178
|
+
notes: ["Gray diagonal: each variable with itself"]
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
// packages/charts/src/matrix/matrix.tsx
|
|
1182
|
+
function lt({ variant: e = "values", emptyLabel: t = "No matrix values were supplied.", ...n }) {
|
|
1183
|
+
return /* @__PURE__ */ w(B, {
|
|
1184
|
+
...n,
|
|
1185
|
+
variant: e,
|
|
1186
|
+
emptyLabel: t
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
// packages/charts/src/matrix/token-heatmap.tsx
|
|
1190
|
+
var $ = {
|
|
1191
|
+
token: {
|
|
1192
|
+
k1xSpc: "xt0psk2",
|
|
1193
|
+
kmVPX3: "x1717udv",
|
|
1194
|
+
kMzoRj: "xc342km",
|
|
1195
|
+
kt9PQ7: "x2x41l1",
|
|
1196
|
+
kfdmCh: "x1q0q8m5",
|
|
1197
|
+
kMv6JI: "xjb2p0i",
|
|
1198
|
+
kGuDYH: "x1qlqyl8",
|
|
1199
|
+
k63SB2: "x1pd3egz",
|
|
1200
|
+
kLWn49: "x15bjb6t",
|
|
1201
|
+
kMwMTN: "xbixft",
|
|
1202
|
+
kWkggS: "xpvm0e4",
|
|
1203
|
+
khDVqt: "xq9mrsl",
|
|
1204
|
+
keMLs9: "xyh5bb9",
|
|
1205
|
+
$$css: !0
|
|
1206
|
+
},
|
|
1207
|
+
color: (e) => [{
|
|
1208
|
+
kL6WhQ: e == null ? e : "xrwkz7t",
|
|
1209
|
+
$$css: !0
|
|
1210
|
+
}, { "--x-borderBottomColor": e ?? void 0 }],
|
|
1211
|
+
missing: {
|
|
1212
|
+
kfdmCh: "xp9b3b8",
|
|
1213
|
+
kL6WhQ: "x19u7erb",
|
|
1214
|
+
$$css: !0
|
|
1215
|
+
},
|
|
1216
|
+
interactive: {
|
|
1217
|
+
kkrTdU: "x1ypdohk",
|
|
1218
|
+
k3XXqK: "x1t137rt",
|
|
1219
|
+
kLWn49: "x1778rvt xwpstqy",
|
|
1220
|
+
kPJHz1: "x13qnu6",
|
|
1221
|
+
kZs9gx: "x19rmrnh",
|
|
1222
|
+
k7shQP: "x9v5kkp",
|
|
1223
|
+
kiEn40: "x13iak60",
|
|
1224
|
+
kGzVvX: "xif5pkx",
|
|
1225
|
+
kSReZ0: "x1ecmtor",
|
|
1226
|
+
$$css: !0
|
|
1227
|
+
},
|
|
1228
|
+
selected: {
|
|
1229
|
+
kMeerF: "x12ei19c",
|
|
1230
|
+
kjBf7l: "xx9gdjd",
|
|
1231
|
+
k3XXqK: "xaatb59",
|
|
1232
|
+
kInvED: "x1y3gkto",
|
|
1233
|
+
$$css: !0
|
|
1234
|
+
}
|
|
1235
|
+
}, ut = { tokens: 2048 };
|
|
1236
|
+
function dt(e) {
|
|
1237
|
+
let { tokens: t, domain: n, palette: r, valueLabel: i, valueFormat: o, selected: u, onSelectedChange: m, ...h } = e, { emptyLabel: re = "No tokens were supplied.", ...y } = h, { locale: x, title: se } = y;
|
|
1238
|
+
function ce(e) {
|
|
1239
|
+
return ft({
|
|
1240
|
+
token: e,
|
|
1241
|
+
domain: n,
|
|
1242
|
+
locale: x,
|
|
1243
|
+
format: o
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
let C = t.map((e) => ({
|
|
1247
|
+
id: e.id,
|
|
1248
|
+
label: `Token ${e.index}, ${JSON.stringify(e.text)}, ${i}: ${ce(e)}`
|
|
1249
|
+
})), le = oe(), ue = p();
|
|
1250
|
+
if (y.status === "loading") return /* @__PURE__ */ w(g, {
|
|
1251
|
+
...y,
|
|
1252
|
+
height: "compact"
|
|
1253
|
+
});
|
|
1254
|
+
let E = pt({
|
|
1255
|
+
tokens: t,
|
|
1256
|
+
domain: n,
|
|
1257
|
+
palette: r
|
|
1258
|
+
});
|
|
1259
|
+
return E === null ? /* @__PURE__ */ w(f, {
|
|
1260
|
+
...ue,
|
|
1261
|
+
items: C,
|
|
1262
|
+
arrows: "both",
|
|
1263
|
+
selected: u ?? null,
|
|
1264
|
+
onSelect: m,
|
|
1265
|
+
render: (e, { inspected: f, cursor: p }) => /* @__PURE__ */ T(ee, {
|
|
1266
|
+
...y,
|
|
1267
|
+
figure: e,
|
|
1268
|
+
scaleLegend: /* @__PURE__ */ w(ae, {
|
|
1269
|
+
label: i,
|
|
1270
|
+
domain: n,
|
|
1271
|
+
palette: r,
|
|
1272
|
+
valueFormat: o,
|
|
1273
|
+
locale: x
|
|
1274
|
+
}),
|
|
1275
|
+
footer: /* @__PURE__ */ w(c, {
|
|
1276
|
+
id: le,
|
|
1277
|
+
children: s(C, f)
|
|
1278
|
+
}),
|
|
1279
|
+
children: [t.length === 0 ? /* @__PURE__ */ w(ne, { children: re }) : /* @__PURE__ */ w(a, {
|
|
1280
|
+
role: "group",
|
|
1281
|
+
"aria-label": d({
|
|
1282
|
+
title: se,
|
|
1283
|
+
isSelectable: m !== void 0
|
|
1284
|
+
}),
|
|
1285
|
+
"aria-describedby": le,
|
|
1286
|
+
className: "x1ghz6dp xbixft xiard35 xtqrqnz x1778rvt x126k92a xj0a0fe x-default-marker",
|
|
1287
|
+
children: t.map((e, t) => {
|
|
1288
|
+
let i = u === e.id, a = i || f === e.id, o = e.score !== null && !b(e.score, n), s = C[t]?.label;
|
|
1289
|
+
return /* @__PURE__ */ w(l, {
|
|
1290
|
+
value: e.id,
|
|
1291
|
+
render: m === void 0 ? /* @__PURE__ */ w("span", {}) : /* @__PURE__ */ w("button", {
|
|
1292
|
+
type: "button",
|
|
1293
|
+
tabIndex: -1,
|
|
1294
|
+
"aria-label": s,
|
|
1295
|
+
"aria-pressed": i
|
|
1296
|
+
}),
|
|
1297
|
+
title: m === void 0 ? s : void 0,
|
|
1298
|
+
...S.props($.token, e.score === null || o ? $.missing : $.color(ie(e.score, {
|
|
1299
|
+
domain: n,
|
|
1300
|
+
palette: r
|
|
1301
|
+
})), m !== void 0 && $.interactive, a && $.selected, !a && p === e.id && v.cursor),
|
|
1302
|
+
children: e.text
|
|
1303
|
+
}, e.id);
|
|
1304
|
+
})
|
|
1305
|
+
}), /* @__PURE__ */ w(_, {
|
|
1306
|
+
label: `${se} token values`,
|
|
1307
|
+
columns: [
|
|
1308
|
+
{
|
|
1309
|
+
id: "index",
|
|
1310
|
+
label: "Index"
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
id: "text",
|
|
1314
|
+
label: "Exact text"
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
id: "value",
|
|
1318
|
+
label: i
|
|
1319
|
+
}
|
|
1320
|
+
],
|
|
1321
|
+
rows: t.map((e) => ({
|
|
1322
|
+
id: e.id,
|
|
1323
|
+
values: [
|
|
1324
|
+
String(e.index),
|
|
1325
|
+
JSON.stringify(e.text),
|
|
1326
|
+
ce(e)
|
|
1327
|
+
]
|
|
1328
|
+
}))
|
|
1329
|
+
})]
|
|
1330
|
+
})
|
|
1331
|
+
}) : /* @__PURE__ */ w(te, {
|
|
1332
|
+
...y,
|
|
1333
|
+
message: E
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
function ft({ token: e, domain: t, locale: n, format: r }) {
|
|
1337
|
+
let i = h({
|
|
1338
|
+
value: e.score,
|
|
1339
|
+
locale: n,
|
|
1340
|
+
format: r
|
|
1341
|
+
});
|
|
1342
|
+
return e.score === null || b(e.score, t) ? i : `${i} (outside domain)`;
|
|
1343
|
+
}
|
|
1344
|
+
function pt({ tokens: e, domain: t, palette: n }) {
|
|
1345
|
+
let r = y({
|
|
1346
|
+
domain: t,
|
|
1347
|
+
palette: n
|
|
1348
|
+
});
|
|
1349
|
+
return r === null ? e.length > ut.tokens ? `This token view exceeds the ${ut.tokens}-token render limit. Supply a smaller, labelled window.` : !i(e) || new Set(e.map((e) => e.index)).size !== e.length ? "Tokens must have unique identifiers and supplied indices." : e.some((e) => {
|
|
1350
|
+
let t = !Number.isSafeInteger(e.index) || e.index < 0, n = e.score !== null && !Number.isFinite(e.score);
|
|
1351
|
+
return t || n;
|
|
1352
|
+
}) ? "Token indices must be nonnegative integers and measured scores must be finite. Use null for unavailable scores." : null : r;
|
|
1353
|
+
}
|
|
1354
|
+
export { at as a, et as c, U as d, I as f, ct as i, K as l, ut as n, it as o, F as p, lt as r, tt as s, dt as t, qe as u };
|