@mechane-ai/elements 0.45.0 → 0.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +353 -50
- package/bin/mechane-elements-catalog.mjs +42 -4
- package/dist/ai.js +268 -202
- package/dist/catalog.json +2480 -71
- package/dist/categorical-values-DdfGIowV.js +107 -0
- package/dist/cells--Bd1fQFR.js +384 -0
- package/dist/chart-cursor-1mFd48Jc.js +23 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2792
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -709
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -641
- package/dist/charts/hierarchy.js +1 -112
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +3 -637
- 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 -233
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
- package/dist/collections.js +1 -1735
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/content/code.js +1 -1
- package/dist/content/diff.js +67 -66
- package/dist/content/link.js +1 -1
- package/dist/content/markdown.js +2 -2
- package/dist/content/tree.js +2 -2
- package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
- package/dist/content.js +1 -1
- package/dist/csp.js +6 -11
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
- package/dist/embedding-map-CGM_k6lC.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-wRkIEAwe.js +270 -0
- package/dist/forms/dates.js +1 -750
- package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
- package/dist/forms.js +3 -3
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-CVA4SOy_.js +598 -0
- package/dist/index.js +1 -1
- package/dist/kits/evaluation.js +431 -0
- package/dist/kits/explainers.js +452 -0
- package/dist/kits/interpretability.js +1033 -0
- package/dist/kits/operations.js +239 -0
- package/dist/kits/training.js +335 -0
- package/dist/label-place-Z0fryBZb.js +42 -0
- package/dist/layout.js +207 -207
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/navigation.js +4 -3
- package/dist/packages/ai/src/conversation.d.ts +2 -0
- package/dist/packages/ai/src/prompt-input.d.ts +7 -2
- 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 +6 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +37 -26
- 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 +61 -27
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +15 -10
- 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 +17 -12
- 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-inspection.d.ts +1 -2
- package/dist/packages/charts/src/chart-link.d.ts +56 -0
- package/dist/packages/charts/src/chart-range.d.ts +33 -0
- package/dist/packages/charts/src/chart-rows.d.ts +20 -0
- package/dist/packages/charts/src/chart-theme.d.ts +17 -0
- package/dist/packages/charts/src/chart.d.ts +73 -0
- 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 +16 -1
- package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
- package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
- package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
- package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
- package/dist/packages/charts/src/matrix/index.d.ts +14 -3
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
- package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
- package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
- package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
- package/dist/packages/charts/src/plot/contours.d.ts +45 -0
- package/dist/packages/charts/src/plot/index.d.ts +49 -0
- package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
- package/dist/packages/charts/src/plot/locate.d.ts +18 -0
- package/dist/packages/charts/src/plot/path.d.ts +39 -0
- package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
- package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
- package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
- package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
- package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
- package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
- package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
- package/dist/packages/charts/src/plot/scale.d.ts +48 -0
- package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
- package/dist/packages/charts/src/plot-width.d.ts +3 -3
- 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 +29 -14
- 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/collections/src/collection-controls.d.ts +5 -1
- package/dist/packages/collections/src/collection-filters.d.ts +4 -1
- package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
- package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
- package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
- package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
- package/dist/packages/collections/src/data-table-text.d.ts +13 -0
- package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
- package/dist/packages/collections/src/data-table.d.ts +3 -85
- package/dist/packages/collections/src/index.d.ts +11 -6
- package/dist/packages/collections/src/query-controls.d.ts +6 -2
- package/dist/packages/collections/src/table-results.d.ts +47 -13
- package/dist/packages/collections/src/timeline.d.ts +1 -0
- package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
- package/dist/packages/collections/src/use-table-window.d.ts +25 -0
- package/dist/packages/content/src/viewer.d.ts +8 -0
- package/dist/packages/core/src/disclosure.d.ts +9 -1
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/packages/core/src/route-link.d.ts +11 -0
- package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
- package/dist/packages/forms/src/file-picker.d.ts +15 -0
- package/dist/packages/forms/src/form-controls.d.ts +1 -6
- package/dist/packages/forms/src/forms.d.ts +4 -1
- package/dist/packages/forms/src/index.d.ts +4 -2
- package/dist/packages/forms/src/selection.d.ts +14 -0
- package/dist/packages/foundations/src/csp/index.d.ts +1 -1
- package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
- package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
- package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
- package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
- package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
- package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
- package/dist/packages/kits/src/explainers/index.d.ts +8 -0
- package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
- package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
- package/dist/packages/kits/src/explainers/term.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
- package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
- package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
- package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
- package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
- package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
- package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
- package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
- package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
- package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
- package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
- package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
- package/dist/packages/kits/src/operations/index.d.ts +6 -0
- package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
- package/dist/packages/kits/src/training/index.d.ts +8 -0
- package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
- package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
- package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
- package/dist/packages/kits/src/training/run-state.d.ts +7 -0
- package/dist/packages/kits/src/training/run-table.d.ts +63 -0
- package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
- package/dist/packages/kits/src/training/runs.d.ts +34 -0
- package/dist/packages/navigation/src/index.d.ts +1 -1
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-BEuoOHbs.js +911 -0
- package/dist/plot-marks-A64v7aTw.js +226 -0
- package/dist/plot-surface-CJTIqtck.js +51 -0
- package/dist/{plot-width-CIqBiHcd.js → plot-width-DcqtSgzb.js} +22 -3
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-CWA8VeUR.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/slope-chart-DT22h_ym.js +1279 -0
- package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
- package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
- package/dist/{src-Dcs3SZ9V.js → src-CExIrXPC.js} +170 -194
- package/dist/src-CGc_hjxJ.js +409 -0
- package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
- package/dist/src-D5NXRJZe.js +2195 -0
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/styles2.css +574 -161
- package/dist/time-series-IB3CB93O.js +2668 -0
- package/dist/token-heatmap-C00DnoNO.js +1354 -0
- package/dist/token-predictions-Cxx29iDr.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/tree-diagram-DsckNKaW.js +1629 -0
- package/dist/treemap-9_DpLCW9.js +472 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-BhPHKXsN.js +1291 -0
- package/dist/waterfall-CGksuTy5.js +576 -0
- package/package.json +57 -7
- package/recipes/allocation-report.tsx +15 -7
- package/skills/extend-elements/SKILL.md +134 -0
- package/skills/review-elements/SKILL.md +118 -0
- package/skills/upgrade-elements/SKILL.md +36 -0
- package/skills/upgrade-elements/references/releases.md +242 -0
- package/skills/use-elements/SKILL.md +70 -13
- package/skills/use-elements/references/agent.md +57 -0
- package/skills/use-elements/references/charts.md +384 -0
- package/skills/use-elements/references/collections.md +89 -0
- package/skills/use-elements/references/conversations.md +47 -0
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/forms.md +81 -0
- package/skills/use-elements/references/kits.md +198 -0
- package/skills/use-elements/references/styling.md +70 -0
- package/skills/use-elements/references/workspace.md +3 -3
- package/dist/categorical-values-DZLGQVW1.js +0 -63
- package/dist/chart-frame-Ztktqs1b.js +0 -255
- package/dist/chart-input-BO3BqlFO.js +0 -22
- package/dist/chart-navigation-BAbb5PV9.js +0 -154
- package/dist/header-styles-COxCYFZx.js +0 -90
- package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
- package/dist/packages/charts/src/chart-surface.d.ts +0 -27
- package/dist/packages/navigation/src/route-link.d.ts +0 -2
- package/dist/src-Bk7M67zy.js +0 -396
|
@@ -0,0 +1,1929 @@
|
|
|
1
|
+
import { r as e } from "./tokens.stylex-dF5CACEJ.js";
|
|
2
|
+
import { k as t } from "./src-CpdJlDhO.js";
|
|
3
|
+
import { h as n, p as r } from "./src-1EHkSFS-.js";
|
|
4
|
+
import { t as i } from "./forms-CEbwzlRR.js";
|
|
5
|
+
import { t as a } from "./chart-tones-ei3BC2AL.js";
|
|
6
|
+
import { A as o, O as s, S as c, T as l, a as u, c as d, k as ee, l as f, n as te, o as p, s as m, t as h, w as ne, x as re } from "./plot-layout-BEuoOHbs.js";
|
|
7
|
+
import { i as g } from "./chart-link-AE_xuxiP.js";
|
|
8
|
+
import { a as _ } from "./tone-scope-DKiSw-JR.js";
|
|
9
|
+
import { r as v } from "./figure-format-B8kRZMlo.js";
|
|
10
|
+
import { a as y, n as b, o as x, r as S } from "./scale-C2xgZyZN.js";
|
|
11
|
+
import { i as ie, l as ae, n as oe, r as se, t as ce } from "./figure-frame-wRkIEAwe.js";
|
|
12
|
+
import { n as C } from "./plot-width-DcqtSgzb.js";
|
|
13
|
+
import { t as le } from "./plot-axes-DJkLW4wk.js";
|
|
14
|
+
import { a as w, c as ue, l as T } from "./plot-marks-A64v7aTw.js";
|
|
15
|
+
import { n as de, r as fe, t as pe } from "./plot-surface-CJTIqtck.js";
|
|
16
|
+
import { n as E, r as D } from "./path-BglsXpnO.js";
|
|
17
|
+
import { t as O } from "./color-legend-CIo7DhXB.js";
|
|
18
|
+
import { a as k, c as A, d as j, i as M, l as me, n as N, o as P, r as he, s as F, t as I, u as L } from "./point-layer-C-EYETAt.js";
|
|
19
|
+
import * as R from "@stylexjs/stylex";
|
|
20
|
+
import { useEffect as z, useId as ge, useMemo as B, useRef as _e, useState as V } from "react";
|
|
21
|
+
import { bindDrag as ve, dispatch as ye, dragThreshold as be } from "@ui-sdk/core";
|
|
22
|
+
import { Fragment as xe, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
23
|
+
// packages/charts/src/relationship/level-legend.tsx
|
|
24
|
+
var W = {
|
|
25
|
+
k1xSpc: "x1rg5ohu",
|
|
26
|
+
kzqmXN: "x1kky2od",
|
|
27
|
+
kZKoxP: "xuoj239",
|
|
28
|
+
kaIpWk: "x1ok0vyi",
|
|
29
|
+
$$css: !0
|
|
30
|
+
}, Se = { swatch: (e) => [
|
|
31
|
+
W,
|
|
32
|
+
{
|
|
33
|
+
kWkggS: e == null ? e : "xl8spv7",
|
|
34
|
+
$$css: !0
|
|
35
|
+
},
|
|
36
|
+
{ "--x-backgroundColor": e ?? void 0 }
|
|
37
|
+
] };
|
|
38
|
+
function Ce({ label: e, entries: t }) {
|
|
39
|
+
return /* @__PURE__ */ H("ul", {
|
|
40
|
+
"aria-label": e,
|
|
41
|
+
className: "x78zum5 x1a02dak x6s0dn4 x8zbtdt x1gkm1c7 x1ghz6dp x1717udv xe8uvvx x153jb6y x1hz01jw xy8obcc xas2l8k xss6m8b",
|
|
42
|
+
children: t.map((e) => /* @__PURE__ */ U("li", {
|
|
43
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg",
|
|
44
|
+
children: [/* @__PURE__ */ H("span", {
|
|
45
|
+
"aria-hidden": !0,
|
|
46
|
+
...R.props(Se.swatch(e.color))
|
|
47
|
+
}), e.text]
|
|
48
|
+
}, e.id))
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
// packages/charts/src/relationship/contour-plot.tsx
|
|
52
|
+
var G = {
|
|
53
|
+
columns: 128,
|
|
54
|
+
rows: 128,
|
|
55
|
+
levels: 16,
|
|
56
|
+
paths: 6,
|
|
57
|
+
pointsPerPath: 2e3,
|
|
58
|
+
markers: 12
|
|
59
|
+
}, we = 2, Te = "level:", Ee = 4, De = 45, K = 5, q = 14, J = 3.5, Y = 6, Oe = 9, ke = .5, Ae = 12, je = 4, X = 7, Z = 4;
|
|
60
|
+
function Q({ x: e, y: t, text: n }) {
|
|
61
|
+
let r = n.length * X / 2 + Z;
|
|
62
|
+
return {
|
|
63
|
+
x0: e - r,
|
|
64
|
+
x1: e + r,
|
|
65
|
+
y0: t - Ae - Z,
|
|
66
|
+
y1: t + je + Z
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function Me(e, t) {
|
|
70
|
+
let n = e.x0 < t.x1 && t.x0 < e.x1, r = e.y0 < t.y1 && t.y0 < e.y1;
|
|
71
|
+
return n && r;
|
|
72
|
+
}
|
|
73
|
+
var Ne = {
|
|
74
|
+
kDwRjp: "xbh8q5q",
|
|
75
|
+
$$css: !0
|
|
76
|
+
}, Pe = {
|
|
77
|
+
level: (e) => [
|
|
78
|
+
Ne,
|
|
79
|
+
{
|
|
80
|
+
kjVXCG: e == null ? e : "x6mkzkt",
|
|
81
|
+
$$css: !0
|
|
82
|
+
},
|
|
83
|
+
{ "--x-stroke": e ?? void 0 }
|
|
84
|
+
],
|
|
85
|
+
focused: {
|
|
86
|
+
kjVXCG: "x17y187c",
|
|
87
|
+
kfJifR: "x1ip4yf",
|
|
88
|
+
$$css: !0
|
|
89
|
+
},
|
|
90
|
+
cursor: {
|
|
91
|
+
kDwRjp: "xbh8q5q",
|
|
92
|
+
$$css: !0
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
function Fe({ index: t, count: n }) {
|
|
96
|
+
let r = De + 55 * (n > 1 ? t / (n - 1) : 1);
|
|
97
|
+
return `color-mix(in srgb, ${a.series1} ${r}%, ${e.surface})`;
|
|
98
|
+
}
|
|
99
|
+
function Ie({ grid: e, levels: t, paths: n, markers: r, xDomain: i, yDomain: a, x: o, y: s }) {
|
|
100
|
+
let c = x(e.xDomain) ?? x(e.yDomain) ?? x(i, o.scale) ?? x(a, s.scale);
|
|
101
|
+
if (c !== void 0) return c;
|
|
102
|
+
if (!(Number.isInteger(e.columns) && Number.isInteger(e.rows)) || e.columns < we || e.rows < we) return `The grid needs at least ${we} columns and ${we} rows.`;
|
|
103
|
+
if (e.columns > G.columns || e.rows > G.rows) return `This chart draws a grid of at most ${G.columns} by ${G.rows} samples. Supply a coarser sample.`;
|
|
104
|
+
if (e.values.length !== e.columns * e.rows || e.values.some((e) => !Number.isFinite(e))) return "The grid needs one finite value for each of its columns and rows.";
|
|
105
|
+
if (t.length === 0 || t.length > G.levels) return `This chart draws 1 to ${G.levels} levels.`;
|
|
106
|
+
if (!t.every((e, n) => {
|
|
107
|
+
let r = n === 0 || e > (t[n - 1] ?? 0);
|
|
108
|
+
return Number.isFinite(e) && r;
|
|
109
|
+
})) return "Levels must be finite values in increasing order.";
|
|
110
|
+
if (n.length > G.paths || r.length > G.markers) return `This chart draws at most ${G.paths} paths and ${G.markers} markers.`;
|
|
111
|
+
let l = [...n, ...r].map((e) => e.id);
|
|
112
|
+
if (new Set(l).size !== l.length || l.some((e) => e.startsWith(Te))) return `Paths and markers need unique identifiers that do not start with "${Te}".`;
|
|
113
|
+
let u = [...n.flatMap((e) => e.points), ...r];
|
|
114
|
+
if (n.some((e) => e.points.length > G.pointsPerPath)) return `A path exceeds ${G.pointsPerPath} points. Supply a coarser sample.`;
|
|
115
|
+
if (u.some((e) => y(e.x, i) || y(e.y, a))) return "A path or marker lies outside the declared domain.";
|
|
116
|
+
}
|
|
117
|
+
function Le(e) {
|
|
118
|
+
let { grid: t, levels: n, x: r, y: i, value: a, path: o = [], markers: l = [], height: u = "tall", selected: d, onSelectedChange: f, ...m } = e, { emptyLabel: h = "No surface is available.", ...g } = m, { locale: y, title: b } = g, x = fe(u), S = ge(), E = _();
|
|
119
|
+
if (g.status === "loading") return /* @__PURE__ */ H(ie, {
|
|
120
|
+
...g,
|
|
121
|
+
height: u
|
|
122
|
+
});
|
|
123
|
+
let O = r.domain ?? t.xDomain, k = i.domain ?? t.yDomain, A = t.values.length === 0, M = A ? void 0 : Ie({
|
|
124
|
+
grid: t,
|
|
125
|
+
levels: n,
|
|
126
|
+
paths: o,
|
|
127
|
+
markers: l,
|
|
128
|
+
xDomain: O,
|
|
129
|
+
yDomain: k,
|
|
130
|
+
x: r,
|
|
131
|
+
y: i
|
|
132
|
+
});
|
|
133
|
+
if (M !== void 0) return /* @__PURE__ */ H(se, {
|
|
134
|
+
...g,
|
|
135
|
+
message: M
|
|
136
|
+
});
|
|
137
|
+
let N = p({
|
|
138
|
+
width: x.width,
|
|
139
|
+
height: x.height,
|
|
140
|
+
x: r,
|
|
141
|
+
y: i,
|
|
142
|
+
xDomain: O,
|
|
143
|
+
yDomain: k,
|
|
144
|
+
locale: y
|
|
145
|
+
}), { box: P } = N, he = t.xDomain[1] - t.xDomain[0], F = t.yDomain[1] - t.yDomain[0];
|
|
146
|
+
function I(e) {
|
|
147
|
+
return {
|
|
148
|
+
x: N.x.position(t.xDomain[0] + e.column / (t.columns - 1) * he),
|
|
149
|
+
y: N.y.position(t.yDomain[0] + e.row / (t.rows - 1) * F)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function z(e) {
|
|
153
|
+
return v({
|
|
154
|
+
value: e,
|
|
155
|
+
locale: y,
|
|
156
|
+
format: a.format
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function B(e) {
|
|
160
|
+
return L({
|
|
161
|
+
grid: t,
|
|
162
|
+
point: {
|
|
163
|
+
column: (e.x - t.xDomain[0]) / he * (t.columns - 1),
|
|
164
|
+
row: (e.y - t.yDomain[0]) / F * (t.rows - 1)
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function _e(e) {
|
|
169
|
+
let t = n.findIndex((t) => t > (e ?? NaN)), r = n[0], i = n.at(-1);
|
|
170
|
+
return e === void 0 || r === void 0 || i === void 0 ? "outside the sampled surface" : t === 0 ? `below the lowest level, ${z(r)}` : t === -1 ? `at or above the highest level, ${z(i)}` : `between level ${z(n[t - 1] ?? r)} and level ${z(n[t] ?? i)}`;
|
|
171
|
+
}
|
|
172
|
+
let V = n.map((e, r) => {
|
|
173
|
+
let i = me({
|
|
174
|
+
grid: t,
|
|
175
|
+
level: e
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
id: `${Te}${r}`,
|
|
179
|
+
level: e,
|
|
180
|
+
color: Fe({
|
|
181
|
+
index: r,
|
|
182
|
+
count: n.length
|
|
183
|
+
}),
|
|
184
|
+
d: j({
|
|
185
|
+
segments: i,
|
|
186
|
+
position: I
|
|
187
|
+
}),
|
|
188
|
+
midpoints: i.map((e) => {
|
|
189
|
+
let t = I(e.from), n = I(e.to);
|
|
190
|
+
return {
|
|
191
|
+
x: (t.x + n.x) * ke,
|
|
192
|
+
y: (t.y + n.y) * ke
|
|
193
|
+
};
|
|
194
|
+
})
|
|
195
|
+
};
|
|
196
|
+
}), ve = (P.left + P.right) * ke, ye = (P.top + P.bottom) * ke, be = o.map((e, t) => ({
|
|
197
|
+
...e,
|
|
198
|
+
tone: E({
|
|
199
|
+
id: e.id,
|
|
200
|
+
index: t + 1
|
|
201
|
+
}),
|
|
202
|
+
positions: e.points.map((e) => ({
|
|
203
|
+
x: N.x.position(e.x),
|
|
204
|
+
y: N.y.position(e.y)
|
|
205
|
+
}))
|
|
206
|
+
})), W = l.map((e, t) => ({
|
|
207
|
+
...e,
|
|
208
|
+
tone: E({
|
|
209
|
+
id: e.id,
|
|
210
|
+
index: be.length + t + 1
|
|
211
|
+
}),
|
|
212
|
+
px: N.x.position(e.x),
|
|
213
|
+
py: N.y.position(e.y)
|
|
214
|
+
})), Se = Math.ceil(n.length / Ee), G = {
|
|
215
|
+
x0: P.left,
|
|
216
|
+
y0: P.top,
|
|
217
|
+
x1: P.right,
|
|
218
|
+
y1: P.bottom
|
|
219
|
+
}, we = W.flatMap((e) => [Q({
|
|
220
|
+
x: e.px,
|
|
221
|
+
y: e.py - K - Y,
|
|
222
|
+
text: e.label
|
|
223
|
+
}), {
|
|
224
|
+
x0: e.px - K - Z,
|
|
225
|
+
x1: e.px + K + Z,
|
|
226
|
+
y0: e.py - K - Z,
|
|
227
|
+
y1: e.py + K + Z
|
|
228
|
+
}]);
|
|
229
|
+
function* De() {
|
|
230
|
+
let e = { taken: we };
|
|
231
|
+
for (let t of V.filter((e, t) => t % Se === 0)) {
|
|
232
|
+
let n = z(t.level), r = t.midpoints.toSorted((e, t) => (e.x - ve) ** 2 + (e.y - ye) ** 2 - ((t.x - ve) ** 2 + (t.y - ye) ** 2)).map((e) => ({
|
|
233
|
+
id: t.id,
|
|
234
|
+
text: n,
|
|
235
|
+
x: e.x,
|
|
236
|
+
y: e.y - Y
|
|
237
|
+
})).find((t) => {
|
|
238
|
+
let n = Q(t), r = n.x0 >= G.x0 && n.x1 <= G.x1, i = n.y0 >= G.y0 && n.y1 <= G.y1;
|
|
239
|
+
return r && i && !e.taken.some((e) => Me(n, e));
|
|
240
|
+
});
|
|
241
|
+
r !== void 0 && (e.taken = [...e.taken, Q(r)], yield r);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
let Ae = Array.from(De()), je = [...V.map((e) => ({
|
|
245
|
+
id: e.id,
|
|
246
|
+
label: `${a.label} level ${z(e.level)}`
|
|
247
|
+
})), ...W.map((e) => ({
|
|
248
|
+
id: e.id,
|
|
249
|
+
label: [
|
|
250
|
+
e.label,
|
|
251
|
+
`${r.label}: ${v({
|
|
252
|
+
value: e.x,
|
|
253
|
+
locale: y,
|
|
254
|
+
format: r.format
|
|
255
|
+
})}`,
|
|
256
|
+
`${i.label}: ${v({
|
|
257
|
+
value: e.y,
|
|
258
|
+
locale: y,
|
|
259
|
+
format: i.format
|
|
260
|
+
})}`,
|
|
261
|
+
`${a.label} is ${_e(B(e))}`
|
|
262
|
+
].join(" · ")
|
|
263
|
+
}))];
|
|
264
|
+
function X(e) {
|
|
265
|
+
let t = e.x / e.width * P.width, n = e.y / e.height * P.height, r = W.map((e) => ({
|
|
266
|
+
id: e.id,
|
|
267
|
+
distance: Math.hypot(e.px - t, e.py - n)
|
|
268
|
+
})).filter((e) => e.distance <= q).toSorted((e, t) => e.distance - t.distance)[0];
|
|
269
|
+
if (r !== void 0) return r.id;
|
|
270
|
+
let i = B({
|
|
271
|
+
x: N.x.valueAt(t),
|
|
272
|
+
y: N.y.valueAt(n)
|
|
273
|
+
});
|
|
274
|
+
return V.map((e) => ({
|
|
275
|
+
id: e.id,
|
|
276
|
+
distance: Math.abs(e.level - (i ?? NaN))
|
|
277
|
+
})).filter((e) => !Number.isNaN(e.distance)).toSorted((e, t) => e.distance - t.distance)[0]?.id;
|
|
278
|
+
}
|
|
279
|
+
let Ne = be.map((e) => ({
|
|
280
|
+
id: e.id,
|
|
281
|
+
label: e.label,
|
|
282
|
+
tone: e.tone,
|
|
283
|
+
shape: "line"
|
|
284
|
+
}));
|
|
285
|
+
return /* @__PURE__ */ H(ne, {
|
|
286
|
+
items: je,
|
|
287
|
+
locate: X,
|
|
288
|
+
selected: d,
|
|
289
|
+
onSelect: f,
|
|
290
|
+
render: (e, { inspected: t, selected: n, cursor: o }) => {
|
|
291
|
+
let l = V.filter((e) => e.id === t || e.id === n), u = V.find((e) => e.id === o), d = W.find((e) => e.id === o);
|
|
292
|
+
return /* @__PURE__ */ H(oe, {
|
|
293
|
+
...g,
|
|
294
|
+
figure: e,
|
|
295
|
+
series: Ne,
|
|
296
|
+
seriesLegend: Ne.length > 0 ? /* @__PURE__ */ H(re, { items: Ne }) : void 0,
|
|
297
|
+
scaleLegend: A ? void 0 : /* @__PURE__ */ H(Ce, {
|
|
298
|
+
label: `${a.label} levels`,
|
|
299
|
+
entries: V.map((e) => ({
|
|
300
|
+
id: e.id,
|
|
301
|
+
text: z(e.level),
|
|
302
|
+
color: e.color
|
|
303
|
+
}))
|
|
304
|
+
}),
|
|
305
|
+
footer: A ? void 0 : /* @__PURE__ */ H(c, {
|
|
306
|
+
id: S,
|
|
307
|
+
children: s(je, t ?? n)
|
|
308
|
+
}),
|
|
309
|
+
children: A ? /* @__PURE__ */ H(ce, { children: h }) : /* @__PURE__ */ U(xe, { children: [/* @__PURE__ */ U(de, {
|
|
310
|
+
plotRef: x.ref,
|
|
311
|
+
box: P,
|
|
312
|
+
label: ee({
|
|
313
|
+
title: b,
|
|
314
|
+
marks: "levels and markers",
|
|
315
|
+
isSelectable: f !== void 0
|
|
316
|
+
}),
|
|
317
|
+
readoutId: S,
|
|
318
|
+
children: [
|
|
319
|
+
/* @__PURE__ */ H(le, {
|
|
320
|
+
box: P,
|
|
321
|
+
xTicks: N.xTicks,
|
|
322
|
+
yTicks: N.yTicks,
|
|
323
|
+
xTitle: te(r),
|
|
324
|
+
yTitle: te(i),
|
|
325
|
+
grid: "none"
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ U(pe, {
|
|
328
|
+
box: P,
|
|
329
|
+
children: [
|
|
330
|
+
V.map((e) => /* @__PURE__ */ H("path", {
|
|
331
|
+
d: e.d,
|
|
332
|
+
...R.props(C.mark, C.emphasis, Pe.level(e.color))
|
|
333
|
+
}, e.id)),
|
|
334
|
+
l.map((e) => /* @__PURE__ */ H("path", {
|
|
335
|
+
d: e.d,
|
|
336
|
+
...R.props(C.mark, Pe.level(e.color), Pe.focused)
|
|
337
|
+
}, e.id)),
|
|
338
|
+
u !== void 0 && /* @__PURE__ */ H("path", {
|
|
339
|
+
d: u.d,
|
|
340
|
+
...R.props(C.shapeCursor, Pe.cursor)
|
|
341
|
+
}),
|
|
342
|
+
be.map((e) => /* @__PURE__ */ U("g", { children: [
|
|
343
|
+
/* @__PURE__ */ H(T, {
|
|
344
|
+
d: D(e.positions),
|
|
345
|
+
tone: e.tone
|
|
346
|
+
}),
|
|
347
|
+
e.positions.slice(0, 1).map((t) => /* @__PURE__ */ H(w, {
|
|
348
|
+
x: t.x,
|
|
349
|
+
y: t.y,
|
|
350
|
+
tone: e.tone,
|
|
351
|
+
radius: J,
|
|
352
|
+
isHollow: !0
|
|
353
|
+
}, "start")),
|
|
354
|
+
e.positions.slice(-1).map((t) => /* @__PURE__ */ H(w, {
|
|
355
|
+
x: t.x,
|
|
356
|
+
y: t.y,
|
|
357
|
+
tone: e.tone,
|
|
358
|
+
radius: J
|
|
359
|
+
}, "end"))
|
|
360
|
+
] }, e.id)),
|
|
361
|
+
W.map((e) => /* @__PURE__ */ H(w, {
|
|
362
|
+
x: e.px,
|
|
363
|
+
y: e.py,
|
|
364
|
+
tone: e.tone,
|
|
365
|
+
radius: K,
|
|
366
|
+
isInspected: e.id === t,
|
|
367
|
+
isSelected: e.id === n
|
|
368
|
+
}, e.id)),
|
|
369
|
+
d !== void 0 && /* @__PURE__ */ H("circle", {
|
|
370
|
+
cx: d.px,
|
|
371
|
+
cy: d.py,
|
|
372
|
+
r: Oe,
|
|
373
|
+
...R.props(C.shapeCursor, Pe.cursor)
|
|
374
|
+
})
|
|
375
|
+
]
|
|
376
|
+
}),
|
|
377
|
+
Ae.map((e) => /* @__PURE__ */ H(ue, {
|
|
378
|
+
x: e.x,
|
|
379
|
+
y: e.y,
|
|
380
|
+
anchor: "middle",
|
|
381
|
+
children: e.text
|
|
382
|
+
}, e.id)),
|
|
383
|
+
W.map((e) => /* @__PURE__ */ H(ue, {
|
|
384
|
+
x: e.px,
|
|
385
|
+
y: e.py - K - Y,
|
|
386
|
+
anchor: "middle",
|
|
387
|
+
tone: e.tone,
|
|
388
|
+
children: e.label
|
|
389
|
+
}, e.id))
|
|
390
|
+
]
|
|
391
|
+
}), /* @__PURE__ */ H(ae, {
|
|
392
|
+
label: `${b} levels and markers`,
|
|
393
|
+
columns: [{
|
|
394
|
+
id: "item",
|
|
395
|
+
label: "Level or marker"
|
|
396
|
+
}],
|
|
397
|
+
rows: je.map((e) => ({
|
|
398
|
+
id: e.id,
|
|
399
|
+
values: [e.label]
|
|
400
|
+
}))
|
|
401
|
+
})] })
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
// packages/charts/src/relationship/measures.ts
|
|
407
|
+
var Re = 2;
|
|
408
|
+
function ze(e, t) {
|
|
409
|
+
return e.values[t.id] ?? null;
|
|
410
|
+
}
|
|
411
|
+
function Be({ dimensions: e, rows: t }) {
|
|
412
|
+
return e.map((e) => ({
|
|
413
|
+
...e,
|
|
414
|
+
domain: e.domain ?? u({
|
|
415
|
+
values: t.map((t) => ze(t, e)),
|
|
416
|
+
scale: e.scale
|
|
417
|
+
})
|
|
418
|
+
}));
|
|
419
|
+
}
|
|
420
|
+
function Ve({ axes: e, rows: t, groups: n, limits: r }) {
|
|
421
|
+
if (e.length < Re || e.length > r.dimensions) return `This chart needs ${Re} to ${r.dimensions} dimensions.`;
|
|
422
|
+
if (t.length > r.rows) return `This chart draws at most ${r.rows} rows. Supply a sample or a smaller set.`;
|
|
423
|
+
if (!o(e) || !o(t) || !o(n)) return "Dimensions, rows and groups must have unique identifiers.";
|
|
424
|
+
let i = e.map((e) => x(e.domain, e.scale)).find((e) => e !== void 0);
|
|
425
|
+
if (i !== void 0) return i;
|
|
426
|
+
let a = new Set(n.map((e) => e.id)), s = t.find((e) => e.group !== void 0 && !a.has(e.group));
|
|
427
|
+
if (s !== void 0) return `Row ${s.id} names a group that was not supplied.`;
|
|
428
|
+
let c = t.flatMap((t) => e.map((e) => ({
|
|
429
|
+
row: t,
|
|
430
|
+
axis: e,
|
|
431
|
+
value: ze(t, e)
|
|
432
|
+
}))).find(({ axis: e, value: t }) => t !== null && y(t, e.domain));
|
|
433
|
+
if (c !== void 0) return `Row ${c.row.id} has a ${c.axis.label} value that is not finite or lies outside the declared domain.`;
|
|
434
|
+
}
|
|
435
|
+
function He({ row: e, axes: t, locale: n, groupLabel: r, consequence: i }) {
|
|
436
|
+
let a = t.map((t) => `${t.label}: ${v({
|
|
437
|
+
value: ze(e, t),
|
|
438
|
+
locale: n,
|
|
439
|
+
format: t.format
|
|
440
|
+
})}`), o = t.filter((t) => ze(e, t) === null).map((e) => e.label), s = o.length === 0 ? [] : [`No value for ${o.join(", ")}: ${i}`];
|
|
441
|
+
return [
|
|
442
|
+
r === void 0 ? e.label : `${e.label} (${r})`,
|
|
443
|
+
...a,
|
|
444
|
+
...s
|
|
445
|
+
].join(" · ");
|
|
446
|
+
}
|
|
447
|
+
function Ue({ rows: e, axes: t, locale: n, groupLabel: r, consequence: i }) {
|
|
448
|
+
return e.map((e) => ({
|
|
449
|
+
id: e.id,
|
|
450
|
+
label: He({
|
|
451
|
+
row: e,
|
|
452
|
+
axes: t,
|
|
453
|
+
locale: n,
|
|
454
|
+
groupLabel: r(e),
|
|
455
|
+
consequence: i
|
|
456
|
+
})
|
|
457
|
+
}));
|
|
458
|
+
}
|
|
459
|
+
function We({ rows: e, axes: t, locale: n }) {
|
|
460
|
+
return {
|
|
461
|
+
columns: [{
|
|
462
|
+
id: "row",
|
|
463
|
+
label: "Row"
|
|
464
|
+
}, ...t.map((e) => ({
|
|
465
|
+
id: e.id,
|
|
466
|
+
label: e.label
|
|
467
|
+
}))],
|
|
468
|
+
rows: e.map((e) => ({
|
|
469
|
+
id: e.id,
|
|
470
|
+
values: [e.label, ...t.map((t) => v({
|
|
471
|
+
value: ze(e, t),
|
|
472
|
+
locale: n,
|
|
473
|
+
format: t.format
|
|
474
|
+
}))]
|
|
475
|
+
}))
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function Ge(e) {
|
|
479
|
+
let t = _(), n = e.map((e, n) => ({
|
|
480
|
+
id: e.id,
|
|
481
|
+
label: e.label,
|
|
482
|
+
tone: t({
|
|
483
|
+
id: e.id,
|
|
484
|
+
tone: e.tone,
|
|
485
|
+
index: n
|
|
486
|
+
})
|
|
487
|
+
})), r = e.length === 0 ? "series1" : "neutral";
|
|
488
|
+
return {
|
|
489
|
+
toneOf: (e) => n.find((t) => t.id === e.group)?.tone ?? r,
|
|
490
|
+
groupLabel: (e) => n.find((t) => t.id === e.group)?.label,
|
|
491
|
+
legend: n
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
// packages/charts/src/relationship/range-controls.tsx
|
|
495
|
+
var Ke = 1e3;
|
|
496
|
+
function qe({ axes: e, ranges: a, locale: o, matching: s, total: c, onChange: l }) {
|
|
497
|
+
let u = Object.keys(a).length > 0;
|
|
498
|
+
return /* @__PURE__ */ U("details", {
|
|
499
|
+
className: "xrvj5dj x1n8ia3y xeuugli xbixft x1hz01jw xtqrqnz x1778rvt",
|
|
500
|
+
children: [/* @__PURE__ */ U("summary", {
|
|
501
|
+
className: "x1ypdohk xss6m8b",
|
|
502
|
+
children: [
|
|
503
|
+
"Axis ranges · ",
|
|
504
|
+
s,
|
|
505
|
+
" of ",
|
|
506
|
+
c,
|
|
507
|
+
" rows in range"
|
|
508
|
+
]
|
|
509
|
+
}), /* @__PURE__ */ U("div", {
|
|
510
|
+
className: "xrvj5dj x1n8ia3y x1xxf3xd",
|
|
511
|
+
children: [/* @__PURE__ */ H("div", { children: /* @__PURE__ */ H(t, {
|
|
512
|
+
density: "compact",
|
|
513
|
+
disabled: !u,
|
|
514
|
+
onClick: () => l({}, "clear-press"),
|
|
515
|
+
children: "Clear ranges"
|
|
516
|
+
}) }), /* @__PURE__ */ H("div", {
|
|
517
|
+
className: "xrvj5dj xrhm57f x1n8ia3y",
|
|
518
|
+
children: e.map((e) => {
|
|
519
|
+
let [t, s] = a[e.id] ?? e.domain, c = typeof e.format == "function" ? {} : { format: e.format }, u = (e.domain[1] - e.domain[0]) / Ke, d = `${v({
|
|
520
|
+
value: e.domain[0],
|
|
521
|
+
locale: o,
|
|
522
|
+
format: e.format
|
|
523
|
+
})} to ${v({
|
|
524
|
+
value: e.domain[1],
|
|
525
|
+
locale: o,
|
|
526
|
+
format: e.format
|
|
527
|
+
})}`;
|
|
528
|
+
return /* @__PURE__ */ U(r.Root, { children: [
|
|
529
|
+
/* @__PURE__ */ H(r.Legend, { children: e.label }),
|
|
530
|
+
/* @__PURE__ */ U("div", {
|
|
531
|
+
className: "xrvj5dj x1o61qjw x1hnptsi",
|
|
532
|
+
children: [/* @__PURE__ */ U(i.Root, { children: [/* @__PURE__ */ H(i.Label, { children: "Minimum" }), /* @__PURE__ */ H(n.Root, {
|
|
533
|
+
density: "compact",
|
|
534
|
+
locale: o,
|
|
535
|
+
...c,
|
|
536
|
+
value: t,
|
|
537
|
+
min: e.domain[0],
|
|
538
|
+
max: s,
|
|
539
|
+
step: u,
|
|
540
|
+
onValueChange: (t) => {
|
|
541
|
+
t !== null && l({
|
|
542
|
+
...a,
|
|
543
|
+
[e.id]: [t, s]
|
|
544
|
+
}, "input");
|
|
545
|
+
},
|
|
546
|
+
children: /* @__PURE__ */ H(n.Group, { children: /* @__PURE__ */ H(n.Input, {}) })
|
|
547
|
+
})] }), /* @__PURE__ */ U(i.Root, { children: [/* @__PURE__ */ H(i.Label, { children: "Maximum" }), /* @__PURE__ */ H(n.Root, {
|
|
548
|
+
density: "compact",
|
|
549
|
+
locale: o,
|
|
550
|
+
...c,
|
|
551
|
+
value: s,
|
|
552
|
+
min: t,
|
|
553
|
+
max: e.domain[1],
|
|
554
|
+
step: u,
|
|
555
|
+
onValueChange: (n) => {
|
|
556
|
+
n !== null && l({
|
|
557
|
+
...a,
|
|
558
|
+
[e.id]: [t, n]
|
|
559
|
+
}, "input");
|
|
560
|
+
},
|
|
561
|
+
children: /* @__PURE__ */ H(n.Group, { children: /* @__PURE__ */ H(n.Input, {}) })
|
|
562
|
+
})] })]
|
|
563
|
+
}),
|
|
564
|
+
/* @__PURE__ */ U("p", {
|
|
565
|
+
className: "x1ghz6dp x153jb6y xy8obcc",
|
|
566
|
+
children: ["Domain ", d]
|
|
567
|
+
})
|
|
568
|
+
] }, e.id);
|
|
569
|
+
})
|
|
570
|
+
})]
|
|
571
|
+
})]
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
// packages/charts/src/relationship/parallel-coordinates.tsx
|
|
575
|
+
var Je = {
|
|
576
|
+
dimensions: 12,
|
|
577
|
+
rows: 500
|
|
578
|
+
}, Ye = {
|
|
579
|
+
ink: {
|
|
580
|
+
kjVXCG: "x17y187c",
|
|
581
|
+
kfJifR: "x1ip4yf",
|
|
582
|
+
kDwRjp: "xbh8q5q",
|
|
583
|
+
$$css: !0
|
|
584
|
+
},
|
|
585
|
+
selected: {
|
|
586
|
+
kfJifR: "xvlca1e",
|
|
587
|
+
$$css: !0
|
|
588
|
+
}
|
|
589
|
+
}, Xe = 7, Ze = 16, Qe = 140, $e = 24, et = 32, tt = 18, nt = 140, rt = 16, it = 72, at = 8, ot = 40, st = .64, ct = .77, lt = .3, ut = 4, dt = 8, ft = 4, pt = 48, mt = 10, ht = 10, gt = .5, _t = 3, vt = 2, yt = 18;
|
|
590
|
+
function* bt({ ticks: e, scale: t }) {
|
|
591
|
+
let n = { last: -Infinity };
|
|
592
|
+
for (let r of e) {
|
|
593
|
+
let e = t.position(r.value);
|
|
594
|
+
Math.abs(e - n.last) >= yt && (n.last = e, yield r);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
function xt({ ranges: e, axes: t }) {
|
|
598
|
+
let n = Object.entries(e), r = n.find(([e]) => !t.some((t) => t.id === e));
|
|
599
|
+
if (r !== void 0) return `A range names the dimension ${r[0]}, which was not supplied.`;
|
|
600
|
+
let i = n.find(([e, n]) => {
|
|
601
|
+
let r = t.find((t) => t.id === e)?.domain, i = n[0] > n[1], a = r !== void 0 && (y(n[0], r) || y(n[1], r));
|
|
602
|
+
return i || a;
|
|
603
|
+
});
|
|
604
|
+
return i === void 0 ? void 0 : `The range on ${i[0]} is not finite, is reversed or lies outside its domain.`;
|
|
605
|
+
}
|
|
606
|
+
function St({ row: e, axes: t, ranges: n }) {
|
|
607
|
+
return t.every((t) => {
|
|
608
|
+
let r = n[t.id], i = ze(e, t);
|
|
609
|
+
return r === void 0 || i !== null && i >= r[0] && i <= r[1];
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
function Ct(e) {
|
|
613
|
+
let { dimensions: t, rows: n, groups: r = [], ranges: i = {}, onRangesChange: a, height: o = "regular", selected: l, onSelectedChange: u, ...d } = e, { emptyLabel: te = "No rows are available.", ...p } = d, { locale: _, title: v } = p, y = fe(o), b = ge(), x = g(), { toneOf: le, groupLabel: ue, legend: O } = Ge(r), [k, A] = V(null), j = _e(null);
|
|
614
|
+
if (z(() => () => j.current?.(), []), p.status === "loading") return /* @__PURE__ */ H(ie, {
|
|
615
|
+
...p,
|
|
616
|
+
height: o
|
|
617
|
+
});
|
|
618
|
+
let M = Be({
|
|
619
|
+
dimensions: t,
|
|
620
|
+
rows: n
|
|
621
|
+
}), me = Ve({
|
|
622
|
+
axes: M,
|
|
623
|
+
rows: n,
|
|
624
|
+
groups: r,
|
|
625
|
+
limits: Je
|
|
626
|
+
}) ?? xt({
|
|
627
|
+
ranges: i,
|
|
628
|
+
axes: M
|
|
629
|
+
});
|
|
630
|
+
if (me !== void 0) return /* @__PURE__ */ H(se, {
|
|
631
|
+
...p,
|
|
632
|
+
message: me
|
|
633
|
+
});
|
|
634
|
+
let N = k === null ? i : {
|
|
635
|
+
...i,
|
|
636
|
+
[k.id]: k.range
|
|
637
|
+
}, P = M.length, he = (y.width - Qe) / (P - 1), F = he >= it, I = M.map((e) => {
|
|
638
|
+
let { values: t, labels: n } = h({
|
|
639
|
+
axis: e,
|
|
640
|
+
domain: e.domain,
|
|
641
|
+
length: y.height,
|
|
642
|
+
spacing: pt,
|
|
643
|
+
locale: _,
|
|
644
|
+
hasTitle: !0
|
|
645
|
+
});
|
|
646
|
+
return t.map((e, t) => ({
|
|
647
|
+
value: e,
|
|
648
|
+
label: n[t] ?? ""
|
|
649
|
+
}));
|
|
650
|
+
}), L = F ? f({
|
|
651
|
+
width: y.width,
|
|
652
|
+
valueLabels: I.flatMap((e) => e.map((e) => e.label)),
|
|
653
|
+
hasXTitle: !1,
|
|
654
|
+
hasYTitle: !1
|
|
655
|
+
}).left : Ze, B = M.some((e) => e.label.length * Xe > he - at), W = Math.max(0, ...M.map((e) => e.label.length)), Se = B ? Math.ceil(W * Xe * st) : 0, Ce = B ? 0 : M[0]?.label.length ?? 0, G = M[P - 1]?.label.length ?? 0, we = B ? G * ct : G * gt, Te = Math.max(L, Math.ceil(Ce * Xe * gt)), Ee = Math.max($e, Math.min(y.width * lt, Math.ceil(we * Xe))), De = Math.min(nt, et + Se), K = m({
|
|
656
|
+
width: y.width,
|
|
657
|
+
height: y.height + De - et,
|
|
658
|
+
margins: {
|
|
659
|
+
top: De,
|
|
660
|
+
right: Ee,
|
|
661
|
+
bottom: rt,
|
|
662
|
+
left: Te
|
|
663
|
+
}
|
|
664
|
+
}), q = K.innerWidth / (P - 1), J = M.map((e, t) => {
|
|
665
|
+
let n = S({
|
|
666
|
+
type: e.scale,
|
|
667
|
+
domain: e.domain,
|
|
668
|
+
range: [K.bottom, K.top]
|
|
669
|
+
});
|
|
670
|
+
return {
|
|
671
|
+
axis: e,
|
|
672
|
+
x: K.left + t * q,
|
|
673
|
+
scale: n,
|
|
674
|
+
ticks: Array.from(bt({
|
|
675
|
+
ticks: I[t] ?? [],
|
|
676
|
+
scale: n
|
|
677
|
+
}))
|
|
678
|
+
};
|
|
679
|
+
}), Y = n.map((e) => {
|
|
680
|
+
let t = J.map((t) => {
|
|
681
|
+
let n = ze(e, t.axis);
|
|
682
|
+
return n === null ? null : t.scale.position(n);
|
|
683
|
+
}), n = J.map((e, n) => ({
|
|
684
|
+
x: e.x,
|
|
685
|
+
y: t[n] ?? null
|
|
686
|
+
}));
|
|
687
|
+
return {
|
|
688
|
+
row: e,
|
|
689
|
+
ys: t,
|
|
690
|
+
d: D(n),
|
|
691
|
+
dots: E(n),
|
|
692
|
+
isMatch: St({
|
|
693
|
+
row: e,
|
|
694
|
+
axes: M,
|
|
695
|
+
ranges: N
|
|
696
|
+
})
|
|
697
|
+
};
|
|
698
|
+
}), Oe = Ue({
|
|
699
|
+
rows: n,
|
|
700
|
+
axes: M,
|
|
701
|
+
locale: _,
|
|
702
|
+
groupLabel: ue,
|
|
703
|
+
consequence: "the line breaks at those axes."
|
|
704
|
+
}), ke = Y.filter((e) => e.isMatch);
|
|
705
|
+
function Ae({ next: e, reason: t, event: n }) {
|
|
706
|
+
ye({ options: () => ({ onRangesChange: a }) }, "onRangesChange", e, n === void 0 ? { reason: t } : {
|
|
707
|
+
reason: t,
|
|
708
|
+
event: n
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
function je(e) {
|
|
712
|
+
let t = e.x / e.width * K.width, n = e.y / e.height * K.height, r = Math.min(P - 1, Math.max(0, (t - K.left) / q)), i = Math.min(P - 2, Math.floor(r)), a = r - i;
|
|
713
|
+
return (ke.length > 0 ? ke : Y).flatMap((e) => {
|
|
714
|
+
let t = e.ys[i] ?? null, r = e.ys[i + 1] ?? null, o = t !== null && r !== null ? t + (r - t) * a : a < gt ? t : r;
|
|
715
|
+
return o === null ? [] : [{
|
|
716
|
+
id: e.row.id,
|
|
717
|
+
distance: Math.abs(o - n)
|
|
718
|
+
}];
|
|
719
|
+
}).toSorted((e, t) => e.distance - t.distance)[0]?.id;
|
|
720
|
+
}
|
|
721
|
+
function X(e) {
|
|
722
|
+
let t = e.button === 0 && e.pointerType !== "touch", n = e.currentTarget, r = n.parentElement;
|
|
723
|
+
if (a === void 0 || j.current !== null || !t || r === null) return;
|
|
724
|
+
let o = n.getBoundingClientRect(), s = (e.clientX - o.left) / o.width * K.width, c = J.find((e) => Math.abs(e.x - s) <= mt);
|
|
725
|
+
if (c === void 0) return;
|
|
726
|
+
function l(e) {
|
|
727
|
+
let t = (e - o.top) / o.height * K.height;
|
|
728
|
+
return c?.scale.valueAt(Math.min(K.bottom, Math.max(K.top, t))) ?? 0;
|
|
729
|
+
}
|
|
730
|
+
let u = l(e.clientY), d = { hasMoved: !1 };
|
|
731
|
+
function ee(e) {
|
|
732
|
+
let t = l(e);
|
|
733
|
+
return [Math.min(u, t), Math.max(u, t)];
|
|
734
|
+
}
|
|
735
|
+
j.current = ve(r, e.nativeEvent, {
|
|
736
|
+
threshold: be,
|
|
737
|
+
cancelOnEscape: !0,
|
|
738
|
+
onMove: ({ y: e }) => {
|
|
739
|
+
d.hasMoved = !0, A({
|
|
740
|
+
id: c.axis.id,
|
|
741
|
+
range: ee(e)
|
|
742
|
+
});
|
|
743
|
+
},
|
|
744
|
+
onEnd: (e, t) => {
|
|
745
|
+
j.current = null, A(null);
|
|
746
|
+
let n = ee(e.clientY);
|
|
747
|
+
!t && d.hasMoved && n[0] < n[1] && Ae({
|
|
748
|
+
next: {
|
|
749
|
+
...i,
|
|
750
|
+
[c.axis.id]: n
|
|
751
|
+
},
|
|
752
|
+
reason: "drag",
|
|
753
|
+
event: e
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
return /* @__PURE__ */ H(ne, {
|
|
759
|
+
...x,
|
|
760
|
+
items: Oe,
|
|
761
|
+
locate: je,
|
|
762
|
+
selected: l,
|
|
763
|
+
onSelect: u,
|
|
764
|
+
render: (e, { inspected: t, selected: r, cursor: i }) => {
|
|
765
|
+
let o = Y.find((e) => e.row.id === t), l = Y.find((e) => e.row.id === r), d = Y.find((e) => e.row.id === i), f = t === null ? "normal" : "receded";
|
|
766
|
+
return /* @__PURE__ */ H(oe, {
|
|
767
|
+
...p,
|
|
768
|
+
figure: e,
|
|
769
|
+
series: O,
|
|
770
|
+
seriesLegend: O.length > 0 ? /* @__PURE__ */ H(re, { items: O }) : void 0,
|
|
771
|
+
footer: n.length === 0 ? void 0 : /* @__PURE__ */ U(xe, { children: [/* @__PURE__ */ H(c, {
|
|
772
|
+
id: b,
|
|
773
|
+
children: s(Oe, t ?? r)
|
|
774
|
+
}), /* @__PURE__ */ H(qe, {
|
|
775
|
+
axes: M,
|
|
776
|
+
ranges: N,
|
|
777
|
+
locale: _,
|
|
778
|
+
matching: ke.length,
|
|
779
|
+
total: n.length,
|
|
780
|
+
onChange: (e, t) => Ae({
|
|
781
|
+
next: e,
|
|
782
|
+
reason: t
|
|
783
|
+
})
|
|
784
|
+
})] }),
|
|
785
|
+
children: n.length === 0 ? /* @__PURE__ */ H(ce, { children: te }) : /* @__PURE__ */ U(xe, { children: [/* @__PURE__ */ U(de, {
|
|
786
|
+
plotRef: y.ref,
|
|
787
|
+
box: K,
|
|
788
|
+
label: ee({
|
|
789
|
+
title: v,
|
|
790
|
+
marks: "rows",
|
|
791
|
+
isSelectable: u !== void 0
|
|
792
|
+
}),
|
|
793
|
+
readoutId: b,
|
|
794
|
+
onPointerDown: X,
|
|
795
|
+
children: [
|
|
796
|
+
J.map((e) => /* @__PURE__ */ U("g", { children: [/* @__PURE__ */ H("line", {
|
|
797
|
+
x1: e.x,
|
|
798
|
+
x2: e.x,
|
|
799
|
+
y1: K.top,
|
|
800
|
+
y2: K.bottom,
|
|
801
|
+
...R.props(C.axis)
|
|
802
|
+
}), e.ticks.map((t) => /* @__PURE__ */ H("line", {
|
|
803
|
+
x1: e.x - ut,
|
|
804
|
+
x2: e.x,
|
|
805
|
+
y1: e.scale.position(t.value),
|
|
806
|
+
y2: e.scale.position(t.value),
|
|
807
|
+
...R.props(C.axis)
|
|
808
|
+
}, t.value))] }, e.axis.id)),
|
|
809
|
+
/* @__PURE__ */ U(pe, {
|
|
810
|
+
box: K,
|
|
811
|
+
children: [
|
|
812
|
+
Y.toSorted((e, t) => Number(e.isMatch) - Number(t.isMatch)).map((e) => /* @__PURE__ */ U("g", { children: [/* @__PURE__ */ H(T, {
|
|
813
|
+
d: e.d,
|
|
814
|
+
tone: le(e.row),
|
|
815
|
+
emphasis: e.isMatch ? f : "context"
|
|
816
|
+
}), e.dots.map((t) => /* @__PURE__ */ H(w, {
|
|
817
|
+
x: t.x,
|
|
818
|
+
y: t.y,
|
|
819
|
+
tone: le(e.row),
|
|
820
|
+
radius: vt,
|
|
821
|
+
emphasis: e.isMatch ? f : "context"
|
|
822
|
+
}, t.x))] }, e.row.id)),
|
|
823
|
+
[l, o].map((e) => e === void 0 ? null : /* @__PURE__ */ H("path", {
|
|
824
|
+
d: e.d,
|
|
825
|
+
...R.props(C.mark, Ye.ink, e !== o && Ye.selected)
|
|
826
|
+
}, e.row.id)),
|
|
827
|
+
o?.ys.map((e, t) => e === null ? null : /* @__PURE__ */ H(w, {
|
|
828
|
+
x: J[t]?.x ?? 0,
|
|
829
|
+
y: e,
|
|
830
|
+
tone: le(o.row),
|
|
831
|
+
radius: _t,
|
|
832
|
+
isInspected: !0
|
|
833
|
+
}, J[t]?.axis.id)),
|
|
834
|
+
d !== void 0 && /* @__PURE__ */ H("path", {
|
|
835
|
+
d: d.d,
|
|
836
|
+
fill: "none",
|
|
837
|
+
...R.props(C.shapeCursor)
|
|
838
|
+
})
|
|
839
|
+
]
|
|
840
|
+
}),
|
|
841
|
+
J.map((e) => /* @__PURE__ */ U("g", { children: [F && e.ticks.map((t) => /* @__PURE__ */ H("text", {
|
|
842
|
+
x: e.x - dt,
|
|
843
|
+
y: e.scale.position(t.value) + ft,
|
|
844
|
+
textAnchor: "end",
|
|
845
|
+
...R.props(C.label, C.tick, C.haloLabel),
|
|
846
|
+
children: t.label
|
|
847
|
+
}, t.value)), /* @__PURE__ */ H("text", {
|
|
848
|
+
x: e.x,
|
|
849
|
+
y: K.top - tt,
|
|
850
|
+
textAnchor: B ? "start" : "middle",
|
|
851
|
+
transform: B ? `rotate(-${ot} ${e.x} ${K.top - tt})` : void 0,
|
|
852
|
+
...R.props(C.label, C.strongLabel),
|
|
853
|
+
children: e.axis.label
|
|
854
|
+
})] }, e.axis.id)),
|
|
855
|
+
J.map((e) => {
|
|
856
|
+
let t = N[e.axis.id];
|
|
857
|
+
return /* @__PURE__ */ U("g", { children: [t !== void 0 && /* @__PURE__ */ H("rect", {
|
|
858
|
+
x: e.x - ht / 2,
|
|
859
|
+
y: e.scale.position(t[1]),
|
|
860
|
+
width: ht,
|
|
861
|
+
height: e.scale.position(t[0]) - e.scale.position(t[1]),
|
|
862
|
+
className: "xlrhuyr x11l25vo x17y187c xnpr05h x13efnbd x47corl"
|
|
863
|
+
}), a !== void 0 && /* @__PURE__ */ H("rect", {
|
|
864
|
+
x: e.x - mt,
|
|
865
|
+
y: K.top,
|
|
866
|
+
width: 20,
|
|
867
|
+
height: K.innerHeight,
|
|
868
|
+
className: "xy6m8k3 x1e5i8e3"
|
|
869
|
+
})] }, e.axis.id);
|
|
870
|
+
})
|
|
871
|
+
]
|
|
872
|
+
}), /* @__PURE__ */ H(ae, {
|
|
873
|
+
label: `${v} rows`,
|
|
874
|
+
...We({
|
|
875
|
+
rows: n,
|
|
876
|
+
axes: M,
|
|
877
|
+
locale: _
|
|
878
|
+
})
|
|
879
|
+
})] })
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
// packages/charts/src/relationship/scatter-matrix.tsx
|
|
885
|
+
var wt = {
|
|
886
|
+
dimensions: 6,
|
|
887
|
+
rows: 500
|
|
888
|
+
}, Tt = 18, Et = 6, Dt = 110, Ot = 120, kt = 88, At = 7, jt = 8, Mt = 64, Nt = 6, Pt = .7, Ft = 60, It = 2.5, Lt = 4.5, Rt = 8, zt = 8, Bt = 16, Vt = 4, Ht = {
|
|
889
|
+
frame: {
|
|
890
|
+
kDwRjp: "xbh8q5q",
|
|
891
|
+
$$css: !0
|
|
892
|
+
},
|
|
893
|
+
scrolled: (e) => [{
|
|
894
|
+
k7Eaqz: e == null ? e : "xkj4a21",
|
|
895
|
+
$$css: !0
|
|
896
|
+
}, { "--x-minWidth": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e) }]
|
|
897
|
+
};
|
|
898
|
+
function Ut(e) {
|
|
899
|
+
let { dimensions: t, rows: n, groups: r = [], height: i = "regular", selected: a, onSelectedChange: o, ...l } = e, { emptyLabel: u = "No rows are available.", ...p } = l, { locale: _, title: y } = p, b = fe(i), x = ge(), le = g(), { toneOf: ue, groupLabel: T, legend: pe } = Ge(r);
|
|
900
|
+
if (p.status === "loading") return /* @__PURE__ */ H(ie, {
|
|
901
|
+
...p,
|
|
902
|
+
height: i
|
|
903
|
+
});
|
|
904
|
+
let E = Be({
|
|
905
|
+
dimensions: t,
|
|
906
|
+
rows: n
|
|
907
|
+
}), D = Ve({
|
|
908
|
+
axes: E,
|
|
909
|
+
rows: n,
|
|
910
|
+
groups: r,
|
|
911
|
+
limits: wt
|
|
912
|
+
});
|
|
913
|
+
if (D !== void 0) return /* @__PURE__ */ H(se, {
|
|
914
|
+
...p,
|
|
915
|
+
message: D
|
|
916
|
+
});
|
|
917
|
+
let O = (b.width - Mt) / E.length < Dt, k = O ? Et : Tt, A = E.map((e) => {
|
|
918
|
+
let { values: t, labels: n } = h({
|
|
919
|
+
axis: e,
|
|
920
|
+
domain: e.domain,
|
|
921
|
+
length: b.width / E.length,
|
|
922
|
+
spacing: O ? Ot : Ft,
|
|
923
|
+
locale: _,
|
|
924
|
+
hasTitle: !0
|
|
925
|
+
});
|
|
926
|
+
return t.map((e, t) => ({
|
|
927
|
+
value: e,
|
|
928
|
+
label: n[t] ?? ""
|
|
929
|
+
}));
|
|
930
|
+
}), j = f({
|
|
931
|
+
width: b.width,
|
|
932
|
+
valueLabels: A.flatMap((e) => e.map((e) => e.label)),
|
|
933
|
+
hasXTitle: !1,
|
|
934
|
+
hasYTitle: !1
|
|
935
|
+
}), M = kt + k, me = j.left + j.right + M * E.length, N = Math.max(M, Math.min((b.width - j.left - j.right) / E.length, d[i] * Pt)), P = N - k, he = j.top + N * E.length - k, F = m({
|
|
936
|
+
width: b.width,
|
|
937
|
+
height: he + j.bottom,
|
|
938
|
+
margins: j
|
|
939
|
+
}), I = E.map((e, t) => {
|
|
940
|
+
let n = j.left + t * N, r = j.top + t * N, i = S({
|
|
941
|
+
type: e.scale,
|
|
942
|
+
domain: e.domain,
|
|
943
|
+
range: [n + Nt, n + P - Nt]
|
|
944
|
+
}), a = A[t] ?? [], o = Math.max(0, ...a.map((e) => e.label.length)) * At, s = Math.min(...a.slice(1).map((e, t) => Math.abs(i.position(e.value) - i.position(a[t]?.value ?? 0)))), c = Math.max(1, Math.ceil((o + jt) / s));
|
|
945
|
+
return {
|
|
946
|
+
axis: e,
|
|
947
|
+
left: n,
|
|
948
|
+
top: r,
|
|
949
|
+
ticks: a.filter((e, t) => t % c === 0),
|
|
950
|
+
xTicks: a.filter((e, t) => t % c === 0).filter((e) => Math.abs(i.position(e.value) - n - P / 2) + e.label.length * At / 2 <= (P + k) / 2),
|
|
951
|
+
xScale: i,
|
|
952
|
+
yScale: S({
|
|
953
|
+
type: e.scale,
|
|
954
|
+
domain: e.domain,
|
|
955
|
+
range: [r + P - Nt, r + Nt]
|
|
956
|
+
})
|
|
957
|
+
};
|
|
958
|
+
}), L = I.flatMap((e, t) => I.slice(0, t).map((t) => ({
|
|
959
|
+
id: `${e.axis.id}:${t.axis.id}`,
|
|
960
|
+
xAxis: t.axis,
|
|
961
|
+
yAxis: e.axis,
|
|
962
|
+
xScale: t.xScale,
|
|
963
|
+
yScale: e.yScale,
|
|
964
|
+
left: t.left,
|
|
965
|
+
top: e.top
|
|
966
|
+
})));
|
|
967
|
+
function z(e, t) {
|
|
968
|
+
let n = ze(t, e.xAxis), r = ze(t, e.yAxis);
|
|
969
|
+
return n === null || r === null ? void 0 : {
|
|
970
|
+
x: e.xScale.position(n),
|
|
971
|
+
y: e.yScale.position(r)
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
function B(e, t) {
|
|
975
|
+
return v({
|
|
976
|
+
value: t,
|
|
977
|
+
locale: _,
|
|
978
|
+
format: e.format
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
let _e = Ue({
|
|
982
|
+
rows: n,
|
|
983
|
+
axes: E,
|
|
984
|
+
locale: _,
|
|
985
|
+
groupLabel: T,
|
|
986
|
+
consequence: "the row is not drawn in the panels that use them."
|
|
987
|
+
});
|
|
988
|
+
function V(e) {
|
|
989
|
+
let t = e.x / e.width * F.width, r = e.y / e.height * F.height, i = Math.floor((t - j.left) / N), a = Math.floor((r - j.top) / N), o = L.find((e) => e.id === `${E[a]?.id}:${E[i]?.id}`);
|
|
990
|
+
return n.flatMap((e) => {
|
|
991
|
+
let n = o === void 0 ? void 0 : z(o, e);
|
|
992
|
+
return n === void 0 ? [] : [{
|
|
993
|
+
id: e.id,
|
|
994
|
+
distance: (n.x - t) ** 2 + (n.y - r) ** 2
|
|
995
|
+
}];
|
|
996
|
+
}).toSorted((e, t) => e.distance - t.distance)[0]?.id;
|
|
997
|
+
}
|
|
998
|
+
return /* @__PURE__ */ H(ne, {
|
|
999
|
+
...le,
|
|
1000
|
+
items: _e,
|
|
1001
|
+
locate: V,
|
|
1002
|
+
selected: a,
|
|
1003
|
+
onSelect: o,
|
|
1004
|
+
render: (e, { inspected: t, selected: r, cursor: i }) => {
|
|
1005
|
+
let a = n.filter((e) => e.id === t || e.id === r), l = n.find((e) => e.id === i);
|
|
1006
|
+
return /* @__PURE__ */ H(oe, {
|
|
1007
|
+
...p,
|
|
1008
|
+
figure: e,
|
|
1009
|
+
series: pe,
|
|
1010
|
+
seriesLegend: pe.length > 0 ? /* @__PURE__ */ H(re, { items: pe }) : void 0,
|
|
1011
|
+
footer: n.length === 0 ? void 0 : /* @__PURE__ */ H(c, {
|
|
1012
|
+
id: x,
|
|
1013
|
+
children: s(_e, t ?? r)
|
|
1014
|
+
}),
|
|
1015
|
+
children: n.length === 0 ? /* @__PURE__ */ H(ce, { children: u }) : /* @__PURE__ */ U(xe, { children: [/* @__PURE__ */ H("div", {
|
|
1016
|
+
className: "xw2csxc xeuugli",
|
|
1017
|
+
children: /* @__PURE__ */ H("div", {
|
|
1018
|
+
...R.props(Ht.scrolled(me)),
|
|
1019
|
+
children: /* @__PURE__ */ U(de, {
|
|
1020
|
+
plotRef: b.ref,
|
|
1021
|
+
box: F,
|
|
1022
|
+
label: ee({
|
|
1023
|
+
title: y,
|
|
1024
|
+
marks: "rows",
|
|
1025
|
+
isSelectable: o !== void 0
|
|
1026
|
+
}),
|
|
1027
|
+
readoutId: x,
|
|
1028
|
+
children: [I.map((e, t) => /* @__PURE__ */ U("g", { children: [
|
|
1029
|
+
/* @__PURE__ */ H("foreignObject", {
|
|
1030
|
+
x: e.left,
|
|
1031
|
+
y: e.top,
|
|
1032
|
+
width: P,
|
|
1033
|
+
height: P,
|
|
1034
|
+
children: /* @__PURE__ */ U("div", {
|
|
1035
|
+
...{
|
|
1036
|
+
0: { className: "xrvj5dj xc26acl xunmzkg x9f619 x5yr21d x1s01oa9 xb3r6kr xbixft x1hz01jw xy8obcc xas2l8k xj0a0fe" },
|
|
1037
|
+
1: { className: "xrvj5dj x9f619 x5yr21d xb3r6kr xbixft x1hz01jw xy8obcc xas2l8k xj0a0fe x10ukxgv xxhr3t x1717udv" }
|
|
1038
|
+
}[!!O | 0],
|
|
1039
|
+
children: [/* @__PURE__ */ H("span", {
|
|
1040
|
+
...{
|
|
1041
|
+
0: { className: "x1b5ytql" },
|
|
1042
|
+
1: { className: "x1b5ytql x104kibb x1ua5tub xnajbk2 xb3r6kr" }
|
|
1043
|
+
}[!!O | 0],
|
|
1044
|
+
children: te(e.axis)
|
|
1045
|
+
}), /* @__PURE__ */ U("span", {
|
|
1046
|
+
className: "x153jb6y xss6m8b",
|
|
1047
|
+
children: [
|
|
1048
|
+
B(e.axis, e.axis.domain[0]),
|
|
1049
|
+
" –",
|
|
1050
|
+
" ",
|
|
1051
|
+
B(e.axis, e.axis.domain[1])
|
|
1052
|
+
]
|
|
1053
|
+
})]
|
|
1054
|
+
})
|
|
1055
|
+
}),
|
|
1056
|
+
t < I.length - 1 && e.xTicks.map((t) => /* @__PURE__ */ H("text", {
|
|
1057
|
+
x: e.xScale.position(t.value),
|
|
1058
|
+
y: he + Bt,
|
|
1059
|
+
textAnchor: "middle",
|
|
1060
|
+
...R.props(C.label, C.tick),
|
|
1061
|
+
children: t.label
|
|
1062
|
+
}, t.value)),
|
|
1063
|
+
t > 0 && e.ticks.map((t) => /* @__PURE__ */ H("text", {
|
|
1064
|
+
x: j.left - zt,
|
|
1065
|
+
y: e.yScale.position(t.value) + Vt,
|
|
1066
|
+
textAnchor: "end",
|
|
1067
|
+
...R.props(C.label, C.tick),
|
|
1068
|
+
children: t.label
|
|
1069
|
+
}, t.value))
|
|
1070
|
+
] }, e.axis.id)), L.map((e) => /* @__PURE__ */ U("g", { children: [
|
|
1071
|
+
/* @__PURE__ */ H("rect", {
|
|
1072
|
+
x: e.left,
|
|
1073
|
+
y: e.top,
|
|
1074
|
+
width: P,
|
|
1075
|
+
height: P,
|
|
1076
|
+
...R.props(C.grid, Ht.frame)
|
|
1077
|
+
}),
|
|
1078
|
+
n.map((t) => {
|
|
1079
|
+
let n = z(e, t);
|
|
1080
|
+
return n === void 0 ? null : /* @__PURE__ */ H(w, {
|
|
1081
|
+
x: n.x,
|
|
1082
|
+
y: n.y,
|
|
1083
|
+
tone: ue(t),
|
|
1084
|
+
radius: It,
|
|
1085
|
+
emphasis: ue(t) === "neutral" ? "context" : "normal"
|
|
1086
|
+
}, t.id);
|
|
1087
|
+
}),
|
|
1088
|
+
a.map((n) => {
|
|
1089
|
+
let i = z(e, n);
|
|
1090
|
+
return i === void 0 ? null : /* @__PURE__ */ H(w, {
|
|
1091
|
+
x: i.x,
|
|
1092
|
+
y: i.y,
|
|
1093
|
+
tone: ue(n),
|
|
1094
|
+
radius: Lt,
|
|
1095
|
+
isInspected: n.id === t,
|
|
1096
|
+
isSelected: n.id === r
|
|
1097
|
+
}, n.id);
|
|
1098
|
+
}),
|
|
1099
|
+
l !== void 0 && z(e, l) !== void 0 && /* @__PURE__ */ H("circle", {
|
|
1100
|
+
cx: z(e, l)?.x,
|
|
1101
|
+
cy: z(e, l)?.y,
|
|
1102
|
+
r: Rt,
|
|
1103
|
+
fill: "none",
|
|
1104
|
+
...R.props(C.shapeCursor)
|
|
1105
|
+
})
|
|
1106
|
+
] }, e.id))]
|
|
1107
|
+
})
|
|
1108
|
+
})
|
|
1109
|
+
}), /* @__PURE__ */ H(ae, {
|
|
1110
|
+
label: `${y} rows`,
|
|
1111
|
+
...We({
|
|
1112
|
+
rows: n,
|
|
1113
|
+
axes: E,
|
|
1114
|
+
locale: _
|
|
1115
|
+
})
|
|
1116
|
+
})] })
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
// packages/charts/src/relationship/density-map.tsx
|
|
1122
|
+
var Wt = {
|
|
1123
|
+
columns: 512,
|
|
1124
|
+
rows: 512,
|
|
1125
|
+
cellItems: 1024
|
|
1126
|
+
}, Gt = { outline: {
|
|
1127
|
+
kDwRjp: "xbh8q5q",
|
|
1128
|
+
kfzvcC: "x47corl",
|
|
1129
|
+
$$css: !0
|
|
1130
|
+
} };
|
|
1131
|
+
function Kt({ counts: e, columns: t, rows: n }) {
|
|
1132
|
+
let r = Math.max(1, t), i = e.flatMap((e, t) => {
|
|
1133
|
+
let n = t % r, i = Math.floor(t / r);
|
|
1134
|
+
return e > 0 ? [{
|
|
1135
|
+
id: `${n}:${i}`,
|
|
1136
|
+
column: n,
|
|
1137
|
+
row: i,
|
|
1138
|
+
count: e
|
|
1139
|
+
}] : [];
|
|
1140
|
+
}), a = new Float64Array(Math.max(0, n)), o = Array.from({ length: Math.max(0, n) }, () => void 0);
|
|
1141
|
+
for (let e of i) a[e.row] = (a[e.row] ?? 0) + e.count, e.count > (o[e.row]?.count ?? 0) && (o[e.row] = e);
|
|
1142
|
+
return {
|
|
1143
|
+
filled: i,
|
|
1144
|
+
rows: Array.from(a, (e, t) => ({
|
|
1145
|
+
row: t,
|
|
1146
|
+
total: e,
|
|
1147
|
+
peak: o[t]
|
|
1148
|
+
})),
|
|
1149
|
+
maximum: b(e)?.[1] ?? 0
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
function qt(e, t) {
|
|
1153
|
+
return e.domain === void 0 || e.domain[0] === t[0] && e.domain[1] === t[1];
|
|
1154
|
+
}
|
|
1155
|
+
function Jt({ histogram: e, x: t, y: n }) {
|
|
1156
|
+
let { columns: r, rows: i, counts: a, xDomain: o, yDomain: s } = e, c = x(o, t.scale) ?? x(s, n.scale);
|
|
1157
|
+
if (c !== void 0) return c;
|
|
1158
|
+
if (!qt(t, o) || !qt(n, s)) return "An axis domain must match the histogram's domain. Leave the axis domain out to use it.";
|
|
1159
|
+
if (![r, i].every((e) => Number.isInteger(e) && e > 0) || r > Wt.columns || i > Wt.rows) return `A density map needs whole numbers of columns and rows, at most ${Wt.columns} by ${Wt.rows}.`;
|
|
1160
|
+
if (a.length !== r * i) return `The histogram needs ${r * i} counts, one per cell; it has ${a.length}.`;
|
|
1161
|
+
if (a.some((e) => !Number.isFinite(e) || e < 0)) return "Every count must be a finite value of zero or more.";
|
|
1162
|
+
}
|
|
1163
|
+
function Yt(e) {
|
|
1164
|
+
let { histogram: t, x: n, y: r, count: i, height: a = "tall", ...o } = e, { emptyLabel: l = "No counts are available.", ...u } = o, { locale: d, title: f } = u, { columns: m, rows: h, counts: re, xDomain: g, yDomain: _ } = t, y = fe(a), b = ge(), x = B(() => Kt({
|
|
1165
|
+
counts: re,
|
|
1166
|
+
columns: m,
|
|
1167
|
+
rows: h
|
|
1168
|
+
}), [
|
|
1169
|
+
re,
|
|
1170
|
+
m,
|
|
1171
|
+
h
|
|
1172
|
+
]);
|
|
1173
|
+
if (u.status === "loading") return /* @__PURE__ */ H(ie, {
|
|
1174
|
+
...u,
|
|
1175
|
+
height: a
|
|
1176
|
+
});
|
|
1177
|
+
let w = Jt({
|
|
1178
|
+
histogram: t,
|
|
1179
|
+
x: n,
|
|
1180
|
+
y: r
|
|
1181
|
+
});
|
|
1182
|
+
if (w !== void 0) return /* @__PURE__ */ H(se, {
|
|
1183
|
+
...u,
|
|
1184
|
+
message: w
|
|
1185
|
+
});
|
|
1186
|
+
let ue = p({
|
|
1187
|
+
width: y.width,
|
|
1188
|
+
height: y.height,
|
|
1189
|
+
x: n,
|
|
1190
|
+
y: r,
|
|
1191
|
+
xDomain: g,
|
|
1192
|
+
yDomain: _,
|
|
1193
|
+
locale: d
|
|
1194
|
+
}), { box: T } = ue, { filled: E, maximum: D } = x, k = S({
|
|
1195
|
+
type: n.scale,
|
|
1196
|
+
domain: g,
|
|
1197
|
+
range: [0, m]
|
|
1198
|
+
}), j = S({
|
|
1199
|
+
type: r.scale,
|
|
1200
|
+
domain: _,
|
|
1201
|
+
range: [0, h]
|
|
1202
|
+
}), M = T.innerWidth / m, me = T.innerHeight / h, N = E.length <= Wt.cellItems;
|
|
1203
|
+
function P(e) {
|
|
1204
|
+
return v({
|
|
1205
|
+
value: e,
|
|
1206
|
+
locale: d,
|
|
1207
|
+
format: i.format
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
function he(e) {
|
|
1211
|
+
let t = v({
|
|
1212
|
+
value: k.valueAt(e),
|
|
1213
|
+
locale: d,
|
|
1214
|
+
format: n.format
|
|
1215
|
+
}), r = v({
|
|
1216
|
+
value: k.valueAt(e + 1),
|
|
1217
|
+
locale: d,
|
|
1218
|
+
format: n.format
|
|
1219
|
+
});
|
|
1220
|
+
return `${n.label} ${t} – ${r}`;
|
|
1221
|
+
}
|
|
1222
|
+
function F(e) {
|
|
1223
|
+
let t = v({
|
|
1224
|
+
value: j.valueAt(e),
|
|
1225
|
+
locale: d,
|
|
1226
|
+
format: r.format
|
|
1227
|
+
}), n = v({
|
|
1228
|
+
value: j.valueAt(e + 1),
|
|
1229
|
+
locale: d,
|
|
1230
|
+
format: r.format
|
|
1231
|
+
});
|
|
1232
|
+
return `${r.label} ${t} – ${n}`;
|
|
1233
|
+
}
|
|
1234
|
+
let I = x.rows.flatMap((e) => e.peak === void 0 ? [] : [{
|
|
1235
|
+
id: `row:${e.row}`,
|
|
1236
|
+
row: e.row,
|
|
1237
|
+
label: `${F(e.row)}: ${i.label} ${P(e.total)} in all, at most ${P(e.peak.count)} at ${he(e.peak.column)}`
|
|
1238
|
+
}]), L = N ? E.map((e) => ({
|
|
1239
|
+
id: e.id,
|
|
1240
|
+
label: `${he(e.column)}, ${F(e.row)}: ${i.label} ${P(e.count)}`
|
|
1241
|
+
})) : I.map((e) => ({
|
|
1242
|
+
id: e.id,
|
|
1243
|
+
label: e.label
|
|
1244
|
+
})), z = new Map(E.map((e) => [e.id, e])), _e = new Map(I.map((e) => [e.id, e.row]));
|
|
1245
|
+
function V(e) {
|
|
1246
|
+
let t = Math.floor((e.x / e.width * T.width - T.left) / T.innerWidth * m), n = h - 1 - Math.floor((e.y / e.height * T.height - T.top) / T.innerHeight * h);
|
|
1247
|
+
if (t >= 0 && t < m && n >= 0 && n < h) return N ? `${t}:${n}` : `row:${n}`;
|
|
1248
|
+
}
|
|
1249
|
+
function ve(e) {
|
|
1250
|
+
let t = e === null ? void 0 : z.get(e), n = e === null ? void 0 : _e.get(e);
|
|
1251
|
+
return t === void 0 ? n === void 0 ? void 0 : {
|
|
1252
|
+
x: T.left,
|
|
1253
|
+
y: T.bottom - (n + 1) * me,
|
|
1254
|
+
width: T.innerWidth
|
|
1255
|
+
} : {
|
|
1256
|
+
x: T.left + t.column * M,
|
|
1257
|
+
y: T.bottom - (t.row + 1) * me,
|
|
1258
|
+
width: M
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
return /* @__PURE__ */ H(ne, {
|
|
1262
|
+
items: L,
|
|
1263
|
+
locate: V,
|
|
1264
|
+
place: N ? (e) => {
|
|
1265
|
+
let t = z.get(e);
|
|
1266
|
+
return t === void 0 ? void 0 : {
|
|
1267
|
+
left: t.column,
|
|
1268
|
+
right: t.column + 1,
|
|
1269
|
+
top: h - t.row - 1,
|
|
1270
|
+
bottom: h - t.row
|
|
1271
|
+
};
|
|
1272
|
+
} : void 0,
|
|
1273
|
+
arrows: "both",
|
|
1274
|
+
render: (e, { inspected: t, cursor: a }) => {
|
|
1275
|
+
let o = ve(t), p = ve(a);
|
|
1276
|
+
return /* @__PURE__ */ H(oe, {
|
|
1277
|
+
...u,
|
|
1278
|
+
figure: e,
|
|
1279
|
+
scaleLegend: E.length === 0 ? void 0 : /* @__PURE__ */ H(O, {
|
|
1280
|
+
label: i.label,
|
|
1281
|
+
domain: [0, D],
|
|
1282
|
+
palette: "sequential",
|
|
1283
|
+
valueFormat: i.format,
|
|
1284
|
+
locale: d
|
|
1285
|
+
}),
|
|
1286
|
+
footer: E.length === 0 ? void 0 : /* @__PURE__ */ H(c, {
|
|
1287
|
+
id: b,
|
|
1288
|
+
children: s(L, t)
|
|
1289
|
+
}),
|
|
1290
|
+
children: E.length === 0 ? /* @__PURE__ */ H(ce, { children: l }) : /* @__PURE__ */ U(xe, { children: [/* @__PURE__ */ H(de, {
|
|
1291
|
+
plotRef: y.ref,
|
|
1292
|
+
box: T,
|
|
1293
|
+
label: ee({
|
|
1294
|
+
title: f,
|
|
1295
|
+
marks: N ? "cells" : "rows",
|
|
1296
|
+
isSelectable: !1
|
|
1297
|
+
}),
|
|
1298
|
+
readoutId: b,
|
|
1299
|
+
overlay: /* @__PURE__ */ U(xe, { children: [/* @__PURE__ */ H(A, {
|
|
1300
|
+
box: T,
|
|
1301
|
+
columns: m,
|
|
1302
|
+
rows: h,
|
|
1303
|
+
counts: re,
|
|
1304
|
+
maximum: D
|
|
1305
|
+
}), /* @__PURE__ */ H("svg", {
|
|
1306
|
+
"aria-hidden": !0,
|
|
1307
|
+
width: T.width,
|
|
1308
|
+
height: T.height,
|
|
1309
|
+
viewBox: `0 0 ${T.width} ${T.height}`,
|
|
1310
|
+
...R.props(C.svg),
|
|
1311
|
+
children: /* @__PURE__ */ U(pe, {
|
|
1312
|
+
box: T,
|
|
1313
|
+
children: [o !== void 0 && /* @__PURE__ */ H("rect", {
|
|
1314
|
+
x: o.x,
|
|
1315
|
+
y: o.y,
|
|
1316
|
+
width: o.width,
|
|
1317
|
+
height: me,
|
|
1318
|
+
...R.props(Gt.outline, C.selected)
|
|
1319
|
+
}), p !== void 0 && /* @__PURE__ */ H("rect", {
|
|
1320
|
+
x: p.x,
|
|
1321
|
+
y: p.y,
|
|
1322
|
+
width: p.width,
|
|
1323
|
+
height: me,
|
|
1324
|
+
...R.props(Gt.outline, C.shapeCursor)
|
|
1325
|
+
})]
|
|
1326
|
+
})
|
|
1327
|
+
})] }),
|
|
1328
|
+
children: /* @__PURE__ */ H(le, {
|
|
1329
|
+
box: T,
|
|
1330
|
+
xTicks: ue.xTicks,
|
|
1331
|
+
yTicks: ue.yTicks,
|
|
1332
|
+
xTitle: te(n),
|
|
1333
|
+
yTitle: te(r),
|
|
1334
|
+
grid: "none"
|
|
1335
|
+
})
|
|
1336
|
+
}), /* @__PURE__ */ H(ae, {
|
|
1337
|
+
label: `${f} ${N ? "cells" : "rows"}`,
|
|
1338
|
+
columns: [{
|
|
1339
|
+
id: "item",
|
|
1340
|
+
label: N ? "Cell" : "Row"
|
|
1341
|
+
}],
|
|
1342
|
+
rows: L.map((e) => ({
|
|
1343
|
+
id: e.id,
|
|
1344
|
+
values: [e.label]
|
|
1345
|
+
}))
|
|
1346
|
+
})] })
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
// packages/charts/src/relationship/embedding-map.tsx
|
|
1352
|
+
var $ = {
|
|
1353
|
+
canvasPoints: 1e5,
|
|
1354
|
+
webglPoints: 1e6,
|
|
1355
|
+
groups: 12,
|
|
1356
|
+
landmarks: 200
|
|
1357
|
+
}, Xt = 10, Zt = 3, Qt = 6, $t = 14, en = 4, tn = 7, nn = 4, rn = {
|
|
1358
|
+
points: 1e5,
|
|
1359
|
+
radius: 1,
|
|
1360
|
+
opacity: .4
|
|
1361
|
+
}, an = {
|
|
1362
|
+
points: 1e4,
|
|
1363
|
+
radius: 1.5,
|
|
1364
|
+
opacity: .55
|
|
1365
|
+
}, on = {
|
|
1366
|
+
radius: 2.5,
|
|
1367
|
+
opacity: .8
|
|
1368
|
+
}, sn = { maximumFractionDigits: 0 }, cn = {
|
|
1369
|
+
style: "percent",
|
|
1370
|
+
maximumFractionDigits: 1
|
|
1371
|
+
}, ln = {
|
|
1372
|
+
kVAEAm: "x10l6tqk",
|
|
1373
|
+
kfzvcC: "x67bb7w",
|
|
1374
|
+
$$css: !0
|
|
1375
|
+
}, un = {
|
|
1376
|
+
surface: (e, t) => [
|
|
1377
|
+
ln,
|
|
1378
|
+
{
|
|
1379
|
+
kbCHJM: e == null ? e : "xgq9j65",
|
|
1380
|
+
k87sOh: t == null ? t : "xjbys53",
|
|
1381
|
+
$$css: !0
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
"--x-left": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
1385
|
+
"--x-top": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
1386
|
+
}
|
|
1387
|
+
],
|
|
1388
|
+
size: (e, t) => [{
|
|
1389
|
+
kzqmXN: e == null ? e : "x5lhr3w",
|
|
1390
|
+
kZKoxP: t == null ? t : "x16ye13r",
|
|
1391
|
+
$$css: !0
|
|
1392
|
+
}, {
|
|
1393
|
+
"--x-width": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(e),
|
|
1394
|
+
"--x-height": ((e) => typeof e == "number" ? e + "px" : e ?? void 0)(t)
|
|
1395
|
+
}],
|
|
1396
|
+
explore: {
|
|
1397
|
+
kFalU9: "x5ve5x3",
|
|
1398
|
+
kkrTdU: "x1jm3nie",
|
|
1399
|
+
$$css: !0
|
|
1400
|
+
},
|
|
1401
|
+
brush: {
|
|
1402
|
+
kFalU9: "xx69xxh",
|
|
1403
|
+
kkrTdU: "xsid9ct",
|
|
1404
|
+
$$css: !0
|
|
1405
|
+
},
|
|
1406
|
+
inspect: {
|
|
1407
|
+
kFalU9: "xx69xxh",
|
|
1408
|
+
$$css: !0
|
|
1409
|
+
},
|
|
1410
|
+
cursorBox: {
|
|
1411
|
+
kDwRjp: "xbh8q5q",
|
|
1412
|
+
$$css: !0
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
function dn(e, t) {
|
|
1416
|
+
let n = e.x.length, r = {
|
|
1417
|
+
xExtent: void 0,
|
|
1418
|
+
yExtent: void 0,
|
|
1419
|
+
counts: [],
|
|
1420
|
+
extents: [],
|
|
1421
|
+
index: void 0
|
|
1422
|
+
};
|
|
1423
|
+
if (e.y.length !== n || e.group.length !== n) return {
|
|
1424
|
+
...r,
|
|
1425
|
+
error: "The x, y and group columns must have one value per item."
|
|
1426
|
+
};
|
|
1427
|
+
if (n > $.webglPoints) return {
|
|
1428
|
+
...r,
|
|
1429
|
+
error: `This map draws at most ${$.webglPoints} items. Supply a sample and declare its coverage.`
|
|
1430
|
+
};
|
|
1431
|
+
if (e.ids !== void 0 && (e.ids.length !== n || new Set(e.ids).size !== n)) return {
|
|
1432
|
+
...r,
|
|
1433
|
+
error: "Item ids must name every item once."
|
|
1434
|
+
};
|
|
1435
|
+
let i = Float64Array.from({ length: t * 4 }, (e, t) => t % 2 == 0 ? Infinity : -Infinity), a = new Int32Array(t), o = { index: -1 };
|
|
1436
|
+
for (let [n, r] of e.group.entries()) {
|
|
1437
|
+
let s = e.x[n] ?? NaN, c = e.y[n] ?? NaN;
|
|
1438
|
+
if (!(Number.isInteger(r) && r >= 0 && r < t) || !Number.isFinite(s) || !Number.isFinite(c)) {
|
|
1439
|
+
o.index = n;
|
|
1440
|
+
break;
|
|
1441
|
+
}
|
|
1442
|
+
a[r] = (a[r] ?? 0) + 1, i[r * 4] = Math.min(i[r * 4] ?? s, s), i[r * 4 + 1] = Math.max(i[r * 4 + 1] ?? s, s), i[r * 4 + 2] = Math.min(i[r * 4 + 2] ?? c, c), i[r * 4 + 3] = Math.max(i[r * 4 + 3] ?? c, c);
|
|
1443
|
+
}
|
|
1444
|
+
if (o.index >= 0) return {
|
|
1445
|
+
...r,
|
|
1446
|
+
error: `Item ${e.ids?.[o.index] ?? o.index} needs finite coordinates and a group index between 0 and ${t - 1}.`
|
|
1447
|
+
};
|
|
1448
|
+
let s = b(e.x), c = b(e.y), l = Array.from(a, (e, t) => e === 0 ? void 0 : {
|
|
1449
|
+
x: [i[t * 4] ?? 0, i[t * 4 + 1] ?? 0],
|
|
1450
|
+
y: [i[t * 4 + 2] ?? 0, i[t * 4 + 3] ?? 0]
|
|
1451
|
+
}), u = s === void 0 || c === void 0 ? void 0 : F({
|
|
1452
|
+
points: e,
|
|
1453
|
+
domain: {
|
|
1454
|
+
x: fn(s),
|
|
1455
|
+
y: fn(c)
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
return {
|
|
1459
|
+
error: void 0,
|
|
1460
|
+
xExtent: s,
|
|
1461
|
+
yExtent: c,
|
|
1462
|
+
counts: Array.from(a),
|
|
1463
|
+
extents: l,
|
|
1464
|
+
index: u
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
function fn(e) {
|
|
1468
|
+
return e[0] === e[1] ? [e[0] - 1, e[1] + 1] : e;
|
|
1469
|
+
}
|
|
1470
|
+
function pn(e, t) {
|
|
1471
|
+
let n = e.x[0] <= e.x[1] && e.y[0] <= e.y[1], r = !y(e.x[0], t.x) && !y(e.x[1], t.x), i = !y(e.y[0], t.y) && !y(e.y[1], t.y);
|
|
1472
|
+
return n && r && i;
|
|
1473
|
+
}
|
|
1474
|
+
function mn({ summary: e, groups: t, landmarks: n, x: r, y: i, domain: a, range: s, renderer: c, count: l }) {
|
|
1475
|
+
let u = (r.scale ?? "linear") === "linear", d = (i.scale ?? "linear") === "linear";
|
|
1476
|
+
if (!u || !d) return "An embedding map draws projected coordinates on linear axes.";
|
|
1477
|
+
let ee = x(a.x) ?? x(a.y);
|
|
1478
|
+
if (ee !== void 0) return ee;
|
|
1479
|
+
if (t.length > $.groups || n.length > $.landmarks) return `This map draws at most ${$.groups} groups and ${$.landmarks} landmarks.`;
|
|
1480
|
+
if (!o([...t, ...n])) return "Groups and landmarks must have unique identifiers, distinct from each other.";
|
|
1481
|
+
if (c === "canvas" && l > $.canvasPoints) return `Canvas draws at most ${$.canvasPoints} items. Use the WebGL or automatic renderer.`;
|
|
1482
|
+
if (e.error !== void 0) return e.error;
|
|
1483
|
+
let { xExtent: f, yExtent: te } = e;
|
|
1484
|
+
if (f !== void 0 && te !== void 0 && !pn({
|
|
1485
|
+
x: f,
|
|
1486
|
+
y: te
|
|
1487
|
+
}, a)) return "An item lies outside the declared domain.";
|
|
1488
|
+
if (n.some((e) => !pn({
|
|
1489
|
+
x: [e.x, e.x],
|
|
1490
|
+
y: [e.y, e.y]
|
|
1491
|
+
}, a))) return "A landmark needs finite coordinates inside the declared domain.";
|
|
1492
|
+
if (s !== null && !pn(s, a)) return "The range needs finite, ordered bounds inside the declared domain.";
|
|
1493
|
+
}
|
|
1494
|
+
function hn(e) {
|
|
1495
|
+
return e > rn.points ? rn : e > an.points ? an : on;
|
|
1496
|
+
}
|
|
1497
|
+
function gn({ landmarks: e, plot: t, first: n }) {
|
|
1498
|
+
let { box: r } = t, i = e.map((e) => ({
|
|
1499
|
+
...e,
|
|
1500
|
+
left: t.x.position(e.x),
|
|
1501
|
+
top: t.y.position(e.y),
|
|
1502
|
+
width: e.label.length * tn
|
|
1503
|
+
})).filter((e) => e.left >= r.left && e.left <= r.right).filter((e) => e.top >= r.top && e.top <= r.bottom).toSorted((e, t) => Number(n.includes(t.id)) - Number(n.includes(e.id))), a = [];
|
|
1504
|
+
return i.map((e) => {
|
|
1505
|
+
let t = {
|
|
1506
|
+
left: e.left + Qt,
|
|
1507
|
+
right: e.left + Qt + e.width,
|
|
1508
|
+
top: e.top
|
|
1509
|
+
}, n = t.right <= r.right, i = a.every((e) => t.right < e.left || t.left > e.right || Math.abs(t.top - e.top) > $t);
|
|
1510
|
+
return n && i && a.push(t), {
|
|
1511
|
+
...e,
|
|
1512
|
+
hasLabel: n && i
|
|
1513
|
+
};
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
function _n(e) {
|
|
1517
|
+
let { points: n, groups: r, x: i, y: a, landmarks: o = [], renderer: d = "auto", range: f = null, onRangeChange: m, isExplorable: h = !1, height: y = "tall", selected: b, onSelectedChange: x, ...S } = e, { emptyLabel: T = "No items are available.", ...E } = S, { locale: D, title: O } = E, A = fe(y), j = ge(), me = _(), F = g(), [L, be] = V(M), [W, Se] = V(null), [Ce, G] = V(null), [we, Te] = V(null), Ee = _e(null), De = B(() => dn({
|
|
1518
|
+
ids: n.ids,
|
|
1519
|
+
x: n.x,
|
|
1520
|
+
y: n.y,
|
|
1521
|
+
group: n.group
|
|
1522
|
+
}, r.length), [
|
|
1523
|
+
n.ids,
|
|
1524
|
+
n.x,
|
|
1525
|
+
n.y,
|
|
1526
|
+
n.group,
|
|
1527
|
+
r.length
|
|
1528
|
+
]), K = B(() => f === null ? 0 : P({
|
|
1529
|
+
x: n.x,
|
|
1530
|
+
y: n.y,
|
|
1531
|
+
group: n.group
|
|
1532
|
+
}, f), [
|
|
1533
|
+
n.x,
|
|
1534
|
+
n.y,
|
|
1535
|
+
n.group,
|
|
1536
|
+
f
|
|
1537
|
+
]);
|
|
1538
|
+
if (z(() => () => Ee.current?.(), []), E.status === "loading") return /* @__PURE__ */ H(ie, {
|
|
1539
|
+
...E,
|
|
1540
|
+
height: y
|
|
1541
|
+
});
|
|
1542
|
+
let q = n.x.length, J = i.domain ?? u({ values: De.xExtent ?? [] }), Y = a.domain ?? u({ values: De.yExtent ?? [] }), Oe = {
|
|
1543
|
+
x: J,
|
|
1544
|
+
y: Y
|
|
1545
|
+
}, ke = mn({
|
|
1546
|
+
summary: De,
|
|
1547
|
+
groups: r,
|
|
1548
|
+
landmarks: o,
|
|
1549
|
+
x: i,
|
|
1550
|
+
y: a,
|
|
1551
|
+
domain: Oe,
|
|
1552
|
+
range: f,
|
|
1553
|
+
renderer: d,
|
|
1554
|
+
count: q
|
|
1555
|
+
});
|
|
1556
|
+
if (ke !== void 0) return /* @__PURE__ */ H(se, {
|
|
1557
|
+
...E,
|
|
1558
|
+
message: ke
|
|
1559
|
+
});
|
|
1560
|
+
let Ae = {
|
|
1561
|
+
width: A.width,
|
|
1562
|
+
height: A.height,
|
|
1563
|
+
x: i,
|
|
1564
|
+
y: a,
|
|
1565
|
+
locale: D
|
|
1566
|
+
}, je = p({
|
|
1567
|
+
...Ae,
|
|
1568
|
+
xDomain: J,
|
|
1569
|
+
yDomain: Y
|
|
1570
|
+
}), X = h ? k({
|
|
1571
|
+
view: L,
|
|
1572
|
+
box: je.box,
|
|
1573
|
+
x: je.x,
|
|
1574
|
+
y: je.y
|
|
1575
|
+
}) : Oe, Z = h ? p({
|
|
1576
|
+
...Ae,
|
|
1577
|
+
xDomain: X.x,
|
|
1578
|
+
yDomain: X.y
|
|
1579
|
+
}) : je, { box: Q } = Z, Me = L.zoom === 1 && L.x === 0 && L.y === 0, Ne = r.map((e, t) => ({
|
|
1580
|
+
...e,
|
|
1581
|
+
tone: me({
|
|
1582
|
+
id: e.id,
|
|
1583
|
+
tone: e.tone,
|
|
1584
|
+
index: t
|
|
1585
|
+
})
|
|
1586
|
+
})), Pe = d === "auto" ? q > $.canvasPoints ? "webgl" : "canvas" : d, Fe = hn(q);
|
|
1587
|
+
function Ie(e) {
|
|
1588
|
+
return v({
|
|
1589
|
+
value: e,
|
|
1590
|
+
locale: D,
|
|
1591
|
+
format: i.format
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
function Le(e) {
|
|
1595
|
+
return v({
|
|
1596
|
+
value: e,
|
|
1597
|
+
locale: D,
|
|
1598
|
+
format: a.format
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
function Re(e, t) {
|
|
1602
|
+
return `${i.label} ${Ie(e)}, ${a.label} ${Le(t)}`;
|
|
1603
|
+
}
|
|
1604
|
+
function ze(e, t) {
|
|
1605
|
+
let n = v({
|
|
1606
|
+
value: t,
|
|
1607
|
+
locale: D,
|
|
1608
|
+
format: sn
|
|
1609
|
+
});
|
|
1610
|
+
return `${i.label} ${Ie(e.x[0])} – ${Ie(e.x[1])}, ${a.label} ${Le(e.y[0])} – ${Le(e.y[1])}: ${n} items`;
|
|
1611
|
+
}
|
|
1612
|
+
let Be = Ne.map((e, t) => {
|
|
1613
|
+
let n = De.counts[t] ?? 0, r = v({
|
|
1614
|
+
value: n,
|
|
1615
|
+
locale: D,
|
|
1616
|
+
format: sn
|
|
1617
|
+
}), i = v({
|
|
1618
|
+
value: q === 0 ? 0 : n / q,
|
|
1619
|
+
locale: D,
|
|
1620
|
+
format: cn
|
|
1621
|
+
});
|
|
1622
|
+
return {
|
|
1623
|
+
...e,
|
|
1624
|
+
index: t,
|
|
1625
|
+
items: n,
|
|
1626
|
+
text: `${e.label}: ${r} items, ${i} of the map`
|
|
1627
|
+
};
|
|
1628
|
+
}), Ve = [...Be.map((e) => ({
|
|
1629
|
+
id: e.id,
|
|
1630
|
+
label: e.text
|
|
1631
|
+
})), ...o.map((e) => ({
|
|
1632
|
+
id: e.id,
|
|
1633
|
+
label: `${e.label}: ${Re(e.x, e.y)}`
|
|
1634
|
+
}))], He = Ne.map((e) => ({
|
|
1635
|
+
id: e.id,
|
|
1636
|
+
label: e.label,
|
|
1637
|
+
tone: e.tone
|
|
1638
|
+
})), Ue = new Set(o.map((e) => e.id)), We = Math.abs((Q.right - Q.left) / (X.x[1] - X.x[0])), Ge = Math.abs((Q.bottom - Q.top) / (X.y[1] - X.y[0]));
|
|
1639
|
+
function Ke(e) {
|
|
1640
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
1641
|
+
return {
|
|
1642
|
+
x: Z.x.valueAt(Q.left + Math.max(0, Math.min(Q.innerWidth, e.clientX - t.left))),
|
|
1643
|
+
y: Z.y.valueAt(Q.top + Math.max(0, Math.min(Q.innerHeight, e.clientY - t.top)))
|
|
1644
|
+
};
|
|
1645
|
+
}
|
|
1646
|
+
function qe(e) {
|
|
1647
|
+
let t = Ke(e), n = {
|
|
1648
|
+
x: t.x,
|
|
1649
|
+
y: t.y,
|
|
1650
|
+
radiusX: Xt / We,
|
|
1651
|
+
radiusY: Xt / Ge
|
|
1652
|
+
};
|
|
1653
|
+
Se(De.index?.nearest(n) ?? null);
|
|
1654
|
+
}
|
|
1655
|
+
function Je(e) {
|
|
1656
|
+
let t = !h || e.shiftKey, r = e.button === 0 && e.pointerType !== "touch" && t;
|
|
1657
|
+
if (e.pointerType === "touch" && !h && qe(e), m === void 0 || Ee.current !== null || !r) return;
|
|
1658
|
+
let i = e.currentTarget, a = Ke(e);
|
|
1659
|
+
function o(e) {
|
|
1660
|
+
return {
|
|
1661
|
+
x: [Math.min(a.x, e.x), Math.max(a.x, e.x)],
|
|
1662
|
+
y: [Math.min(a.y, e.y), Math.max(a.y, e.y)]
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
function s(e, t) {
|
|
1666
|
+
let n = i.getBoundingClientRect();
|
|
1667
|
+
return {
|
|
1668
|
+
x: Z.x.valueAt(Q.left + Math.max(0, Math.min(Q.innerWidth, e - n.left))),
|
|
1669
|
+
y: Z.y.valueAt(Q.top + Math.max(0, Math.min(Q.innerHeight, t - n.top)))
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
G(o(a)), Ee.current = ve(i, e.nativeEvent, {
|
|
1673
|
+
cancelOnEscape: !0,
|
|
1674
|
+
onMove: (e) => G(o(s(e.x, e.y))),
|
|
1675
|
+
onEnd: (e, t) => {
|
|
1676
|
+
Ee.current = null, G(null);
|
|
1677
|
+
let r = o(s(e.clientX, e.clientY));
|
|
1678
|
+
t || r.x[0] === r.x[1] || r.y[0] === r.y[1] || ye({ options: () => ({ onRangeChange: m }) }, "onRangeChange", r, {
|
|
1679
|
+
reason: "drag",
|
|
1680
|
+
event: e,
|
|
1681
|
+
count: P(n, r)
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1686
|
+
function Ye(e, t, r) {
|
|
1687
|
+
ye({ options: () => ({ onRangeChange: m }) }, "onRangeChange", e, {
|
|
1688
|
+
reason: t,
|
|
1689
|
+
event: r,
|
|
1690
|
+
count: e === null ? 0 : P(n, e)
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1693
|
+
function Xe(e) {
|
|
1694
|
+
let t = Ne[n.group[e] ?? 0];
|
|
1695
|
+
return `${n.ids?.[e] ?? `Item ${v({
|
|
1696
|
+
value: e + 1,
|
|
1697
|
+
locale: D,
|
|
1698
|
+
format: sn
|
|
1699
|
+
})}`} · ${t?.label ?? ""} · ${Re(n.x[e] ?? 0, n.y[e] ?? 0)}`;
|
|
1700
|
+
}
|
|
1701
|
+
function Ze(e, t) {
|
|
1702
|
+
if (t.find((t) => t.id === e) === void 0) return De.extents[r.findIndex((t) => t.id === e)];
|
|
1703
|
+
}
|
|
1704
|
+
let Qe = Ce ?? f;
|
|
1705
|
+
return /* @__PURE__ */ H(ne, {
|
|
1706
|
+
...F,
|
|
1707
|
+
items: Ve,
|
|
1708
|
+
arrows: "both",
|
|
1709
|
+
selected: b,
|
|
1710
|
+
onSelect: (e, t) => {
|
|
1711
|
+
Ue.has(e) && x?.(e, t);
|
|
1712
|
+
},
|
|
1713
|
+
render: (e, { inspected: u, cursor: d }) => {
|
|
1714
|
+
let p = r.findIndex((e) => e.id === u), ne = gn({
|
|
1715
|
+
landmarks: o,
|
|
1716
|
+
plot: Z,
|
|
1717
|
+
first: [
|
|
1718
|
+
b ?? null,
|
|
1719
|
+
u,
|
|
1720
|
+
d
|
|
1721
|
+
]
|
|
1722
|
+
}), g = ne.find((e) => e.id === d), _ = Ze(d, ne), y = W === null ? s(Ve, u) : Xe(W), S = W === null ? void 0 : Ne[n.group[W] ?? 0];
|
|
1723
|
+
return /* @__PURE__ */ H(oe, {
|
|
1724
|
+
...E,
|
|
1725
|
+
figure: e,
|
|
1726
|
+
series: He,
|
|
1727
|
+
seriesLegend: /* @__PURE__ */ H(re, {
|
|
1728
|
+
items: He,
|
|
1729
|
+
label: `${O} groups`
|
|
1730
|
+
}),
|
|
1731
|
+
footer: q === 0 ? void 0 : /* @__PURE__ */ U(xe, { children: [/* @__PURE__ */ H(c, {
|
|
1732
|
+
id: j,
|
|
1733
|
+
children: y
|
|
1734
|
+
}), we !== null && we !== Pe && /* @__PURE__ */ H("p", { children: "WebGL is unavailable in this browser, so the map draws with canvas 2D and responds more slowly." })] }),
|
|
1735
|
+
children: q === 0 ? /* @__PURE__ */ H(ce, { children: T }) : /* @__PURE__ */ U(xe, { children: [
|
|
1736
|
+
/* @__PURE__ */ U(N, {
|
|
1737
|
+
view: L,
|
|
1738
|
+
onViewChange: be,
|
|
1739
|
+
isEnabled: h,
|
|
1740
|
+
onKeyDown: () => Se(null),
|
|
1741
|
+
children: [/* @__PURE__ */ H(de, {
|
|
1742
|
+
plotRef: A.ref,
|
|
1743
|
+
box: Q,
|
|
1744
|
+
label: ee({
|
|
1745
|
+
title: O,
|
|
1746
|
+
marks: "groups and landmarks",
|
|
1747
|
+
isSelectable: x !== void 0 && o.length > 0
|
|
1748
|
+
}),
|
|
1749
|
+
readoutId: j,
|
|
1750
|
+
overlay: /* @__PURE__ */ U(xe, { children: [
|
|
1751
|
+
/* @__PURE__ */ H(I, {
|
|
1752
|
+
box: Q,
|
|
1753
|
+
points: n,
|
|
1754
|
+
x: Z.x,
|
|
1755
|
+
y: Z.y,
|
|
1756
|
+
tones: Ne.map((e) => e.tone),
|
|
1757
|
+
highlight: p === -1 ? null : p,
|
|
1758
|
+
radius: Fe.radius,
|
|
1759
|
+
opacity: Fe.opacity,
|
|
1760
|
+
renderer: Pe,
|
|
1761
|
+
onDraw: (e) => Te(e.renderer)
|
|
1762
|
+
}),
|
|
1763
|
+
/* @__PURE__ */ H(he, {
|
|
1764
|
+
onPointerMove: (e) => e.pointerType === "mouse" && qe(e),
|
|
1765
|
+
onPointerLeave: () => Se(null),
|
|
1766
|
+
onPointerDown: Je,
|
|
1767
|
+
...R.props(un.surface(Q.left, Q.top), un.size(Q.innerWidth, Q.innerHeight), h ? un.explore : m === void 0 ? un.inspect : un.brush)
|
|
1768
|
+
}),
|
|
1769
|
+
/* @__PURE__ */ U("svg", {
|
|
1770
|
+
"aria-hidden": !0,
|
|
1771
|
+
width: Q.width,
|
|
1772
|
+
height: Q.height,
|
|
1773
|
+
viewBox: `0 0 ${Q.width} ${Q.height}`,
|
|
1774
|
+
className: "x10l6tqk x13vifvy xu96u03 x1rea2x4 x47corl",
|
|
1775
|
+
children: [
|
|
1776
|
+
/* @__PURE__ */ U(pe, {
|
|
1777
|
+
box: Q,
|
|
1778
|
+
children: [
|
|
1779
|
+
Qe !== null && /* @__PURE__ */ H("rect", {
|
|
1780
|
+
x: Z.x.position(Qe.x[0]),
|
|
1781
|
+
y: Z.y.position(Qe.y[1]),
|
|
1782
|
+
width: Z.x.position(Qe.x[1]) - Z.x.position(Qe.x[0]),
|
|
1783
|
+
height: Z.y.position(Qe.y[0]) - Z.y.position(Qe.y[1]),
|
|
1784
|
+
className: "x1e0kj8g xv7c1pl x1tg5nk6 xnpr05h x15lqr97 x13efnbd"
|
|
1785
|
+
}),
|
|
1786
|
+
_ !== void 0 && /* @__PURE__ */ H("rect", {
|
|
1787
|
+
x: Z.x.position(_.x[0]) - nn,
|
|
1788
|
+
y: Z.y.position(_.y[1]) - nn,
|
|
1789
|
+
width: Z.x.position(_.x[1]) - Z.x.position(_.x[0]) + 8,
|
|
1790
|
+
height: Z.y.position(_.y[0]) - Z.y.position(_.y[1]) + 8,
|
|
1791
|
+
...R.props(un.cursorBox, C.shapeCursor)
|
|
1792
|
+
}),
|
|
1793
|
+
W !== null && S !== void 0 && /* @__PURE__ */ H(w, {
|
|
1794
|
+
x: Z.x.position(n.x[W] ?? 0),
|
|
1795
|
+
y: Z.y.position(n.y[W] ?? 0),
|
|
1796
|
+
tone: S.tone,
|
|
1797
|
+
isInspected: !0
|
|
1798
|
+
})
|
|
1799
|
+
]
|
|
1800
|
+
}),
|
|
1801
|
+
ne.map((e) => /* @__PURE__ */ U(l, {
|
|
1802
|
+
value: e.id,
|
|
1803
|
+
render: /* @__PURE__ */ H("g", {}),
|
|
1804
|
+
className: "x67bb7w x1ypdohk",
|
|
1805
|
+
children: [/* @__PURE__ */ H(w, {
|
|
1806
|
+
x: e.left,
|
|
1807
|
+
y: e.top,
|
|
1808
|
+
tone: "neutral",
|
|
1809
|
+
radius: Zt,
|
|
1810
|
+
isInspected: e.id === u,
|
|
1811
|
+
isSelected: e.id === b
|
|
1812
|
+
}), e.hasLabel && /* @__PURE__ */ H(ue, {
|
|
1813
|
+
x: e.left + Qt,
|
|
1814
|
+
y: e.top + en,
|
|
1815
|
+
children: e.label
|
|
1816
|
+
})]
|
|
1817
|
+
}, e.id)),
|
|
1818
|
+
g !== void 0 && /* @__PURE__ */ H("rect", {
|
|
1819
|
+
x: g.left - Zt - nn,
|
|
1820
|
+
y: g.top - $t / 2 - nn / 2,
|
|
1821
|
+
width: (g.hasLabel ? g.width + Qt : 0) + 14,
|
|
1822
|
+
height: 18,
|
|
1823
|
+
...R.props(un.cursorBox, C.shapeCursor)
|
|
1824
|
+
})
|
|
1825
|
+
]
|
|
1826
|
+
})
|
|
1827
|
+
] }),
|
|
1828
|
+
children: /* @__PURE__ */ H(le, {
|
|
1829
|
+
box: Q,
|
|
1830
|
+
xTicks: Z.xTicks,
|
|
1831
|
+
yTicks: Z.yTicks,
|
|
1832
|
+
xTitle: te(i),
|
|
1833
|
+
yTitle: te(a),
|
|
1834
|
+
grid: "both"
|
|
1835
|
+
})
|
|
1836
|
+
}), h && /* @__PURE__ */ U("div", {
|
|
1837
|
+
className: "x78zum5 x1a02dak x1pha0wt x8zbtdt x1gkm1c7 xeuugli xyrmp21 x153jb6y xy8obcc xas2l8k xss6m8b",
|
|
1838
|
+
children: [/* @__PURE__ */ U("span", { children: ["Drag to pan. Pinch, or hold Control or Command and scroll, to zoom.", m === void 0 ? "" : " Hold Shift and drag to select an area."] }), /* @__PURE__ */ H(t, {
|
|
1839
|
+
density: "compact",
|
|
1840
|
+
disabled: Me,
|
|
1841
|
+
onClick: () => be(M),
|
|
1842
|
+
children: "Reset view"
|
|
1843
|
+
})]
|
|
1844
|
+
})]
|
|
1845
|
+
}),
|
|
1846
|
+
m !== void 0 && /* @__PURE__ */ U("div", {
|
|
1847
|
+
className: "x78zum5 x1a02dak x1pha0wt x8zbtdt x1gkm1c7 xeuugli xyrmp21 x153jb6y xy8obcc xas2l8k xss6m8b",
|
|
1848
|
+
children: [
|
|
1849
|
+
/* @__PURE__ */ H("span", { children: f === null ? h ? "No area selected." : "Drag on the map to select an area." : `Selected area: ${ze(f, K)}` }),
|
|
1850
|
+
h && /* @__PURE__ */ H(t, {
|
|
1851
|
+
density: "compact",
|
|
1852
|
+
onClick: (e) => Ye({
|
|
1853
|
+
x: X.x,
|
|
1854
|
+
y: X.y
|
|
1855
|
+
}, "trigger-press", e.nativeEvent),
|
|
1856
|
+
children: "Select visible area"
|
|
1857
|
+
}),
|
|
1858
|
+
/* @__PURE__ */ H(t, {
|
|
1859
|
+
density: "compact",
|
|
1860
|
+
disabled: f === null,
|
|
1861
|
+
onClick: (e) => Ye(null, "clear-press", e.nativeEvent),
|
|
1862
|
+
children: "Clear range"
|
|
1863
|
+
})
|
|
1864
|
+
]
|
|
1865
|
+
}),
|
|
1866
|
+
/* @__PURE__ */ H(ae, {
|
|
1867
|
+
label: `${O} groups`,
|
|
1868
|
+
columns: [
|
|
1869
|
+
{
|
|
1870
|
+
id: "group",
|
|
1871
|
+
label: "Group"
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
id: "items",
|
|
1875
|
+
label: "Items"
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
id: "share",
|
|
1879
|
+
label: "Share"
|
|
1880
|
+
}
|
|
1881
|
+
],
|
|
1882
|
+
rows: Be.map((e) => ({
|
|
1883
|
+
id: e.id,
|
|
1884
|
+
values: [
|
|
1885
|
+
e.label,
|
|
1886
|
+
v({
|
|
1887
|
+
value: e.items,
|
|
1888
|
+
locale: D,
|
|
1889
|
+
format: sn
|
|
1890
|
+
}),
|
|
1891
|
+
v({
|
|
1892
|
+
value: q === 0 ? 0 : e.items / q,
|
|
1893
|
+
locale: D,
|
|
1894
|
+
format: cn
|
|
1895
|
+
})
|
|
1896
|
+
]
|
|
1897
|
+
}))
|
|
1898
|
+
}),
|
|
1899
|
+
o.length > 0 && /* @__PURE__ */ H(ae, {
|
|
1900
|
+
label: `${O} landmarks`,
|
|
1901
|
+
columns: [
|
|
1902
|
+
{
|
|
1903
|
+
id: "landmark",
|
|
1904
|
+
label: "Landmark"
|
|
1905
|
+
},
|
|
1906
|
+
{
|
|
1907
|
+
id: "x",
|
|
1908
|
+
label: i.label
|
|
1909
|
+
},
|
|
1910
|
+
{
|
|
1911
|
+
id: "y",
|
|
1912
|
+
label: a.label
|
|
1913
|
+
}
|
|
1914
|
+
],
|
|
1915
|
+
rows: o.map((e) => ({
|
|
1916
|
+
id: e.id,
|
|
1917
|
+
values: [
|
|
1918
|
+
e.label,
|
|
1919
|
+
Ie(e.x),
|
|
1920
|
+
Le(e.y)
|
|
1921
|
+
]
|
|
1922
|
+
}))
|
|
1923
|
+
})
|
|
1924
|
+
] })
|
|
1925
|
+
});
|
|
1926
|
+
}
|
|
1927
|
+
});
|
|
1928
|
+
}
|
|
1929
|
+
export { Ut as a, Je as c, Wt as i, Le as l, $ as n, wt as o, Yt as r, Ct as s, _n as t, G as u };
|