@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,1291 @@
|
|
|
1
|
+
import { n as e, t } from "./chart-tones-ei3BC2AL.js";
|
|
2
|
+
import { A as n, O as r, S as i, a, c as o, i as s, k as c, n as l, o as u, w as d } from "./plot-layout-BEuoOHbs.js";
|
|
3
|
+
import { i as f } from "./chart-link-AE_xuxiP.js";
|
|
4
|
+
import { a as p } from "./tone-scope-DKiSw-JR.js";
|
|
5
|
+
import { r as m } from "./figure-format-B8kRZMlo.js";
|
|
6
|
+
import { a as h, o as g } from "./scale-C2xgZyZN.js";
|
|
7
|
+
import { t as _ } from "./chart-cursor-1mFd48Jc.js";
|
|
8
|
+
import { i as v, l as y, n as b, r as x, t as S } from "./figure-frame-wRkIEAwe.js";
|
|
9
|
+
import { n as C, t as w } from "./plot-width-DcqtSgzb.js";
|
|
10
|
+
import { t as T } from "./plot-axes-DJkLW4wk.js";
|
|
11
|
+
import { a as E, f as D, l as O, r as k, s as A } from "./plot-marks-A64v7aTw.js";
|
|
12
|
+
import { n as ee, r as j, t as te } from "./plot-surface-CJTIqtck.js";
|
|
13
|
+
import { r as ne } from "./path-BglsXpnO.js";
|
|
14
|
+
import { t as M } from "./locate-Bcg3QcP4.js";
|
|
15
|
+
import * as N from "@stylexjs/stylex";
|
|
16
|
+
import { useId as re } from "react";
|
|
17
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
18
|
+
// packages/charts/src/distribution/distribution-input.ts
|
|
19
|
+
var L = {
|
|
20
|
+
bins: 200,
|
|
21
|
+
cumulativePoints: 2e3,
|
|
22
|
+
rows: 200
|
|
23
|
+
};
|
|
24
|
+
function R({ items: e, domain: t, scale: r, maxEntries: i }) {
|
|
25
|
+
let a = g(t, r);
|
|
26
|
+
if (a !== void 0) return a;
|
|
27
|
+
if (!n(e)) return "Chart records must have unique identifiers.";
|
|
28
|
+
if (e.length > i) return `This chart supports at most ${i} records. Supply an explicit data window or aggregation.`;
|
|
29
|
+
}
|
|
30
|
+
// packages/charts/src/distribution/distribution-plot.tsx
|
|
31
|
+
function ie({ frame: e, figure: t, items: n, inspected: a, plotRef: o, plot: s, x: u, y: d, isSelectable: f, emptyLabel: p, children: m, overlay: h }) {
|
|
32
|
+
let g = re(), { box: _ } = s;
|
|
33
|
+
return /* @__PURE__ */ F(b, {
|
|
34
|
+
...e,
|
|
35
|
+
figure: t,
|
|
36
|
+
footer: /* @__PURE__ */ F(i, {
|
|
37
|
+
id: g,
|
|
38
|
+
children: r(n, a)
|
|
39
|
+
}),
|
|
40
|
+
children: n.length === 0 ? /* @__PURE__ */ F(S, { children: p }) : /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ I(ee, {
|
|
41
|
+
plotRef: o,
|
|
42
|
+
box: _,
|
|
43
|
+
label: c({
|
|
44
|
+
title: e.title,
|
|
45
|
+
isSelectable: f
|
|
46
|
+
}),
|
|
47
|
+
readoutId: g,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ F(T, {
|
|
50
|
+
box: _,
|
|
51
|
+
xTicks: s.xTicks,
|
|
52
|
+
yTicks: s.yTicks,
|
|
53
|
+
xTitle: l(u),
|
|
54
|
+
yTitle: l(d)
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ F(te, {
|
|
57
|
+
box: _,
|
|
58
|
+
children: m
|
|
59
|
+
}),
|
|
60
|
+
h
|
|
61
|
+
]
|
|
62
|
+
}), /* @__PURE__ */ F(y, {
|
|
63
|
+
label: `${e.title} observations`,
|
|
64
|
+
columns: [{
|
|
65
|
+
id: "observation",
|
|
66
|
+
label: "Observation"
|
|
67
|
+
}],
|
|
68
|
+
rows: n.map((e) => ({
|
|
69
|
+
id: e.id,
|
|
70
|
+
values: [e.label]
|
|
71
|
+
}))
|
|
72
|
+
})] })
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
// packages/charts/src/distribution/ecdf.tsx
|
|
76
|
+
var ae = [0, 1], oe = 12, se = 2, ce = 4;
|
|
77
|
+
function le({ points: e, value: t, probability: n, valueDomain: r, probabilityDomain: i }) {
|
|
78
|
+
let a = R({
|
|
79
|
+
items: e,
|
|
80
|
+
domain: r,
|
|
81
|
+
scale: t.scale,
|
|
82
|
+
maxEntries: L.cumulativePoints
|
|
83
|
+
}) ?? g(i, n.scale);
|
|
84
|
+
if (a !== void 0) return a;
|
|
85
|
+
let o = e.find((t, n) => h(t.value, r) || t.value < (e[n - 1]?.value ?? -Infinity));
|
|
86
|
+
if (o !== void 0) return `Cumulative point ${o.id} is non-finite, outside the domain, or out of order.`;
|
|
87
|
+
let s = e.flatMap((e) => e.probability === null ? [] : [{
|
|
88
|
+
id: e.id,
|
|
89
|
+
share: e.probability
|
|
90
|
+
}]), c = s.find((e, t) => h(e.share, i) || h(e.share, ae) || e.share < (s[t - 1]?.share ?? 0));
|
|
91
|
+
if (c !== void 0) return `Cumulative point ${c.id} must have a probability from zero to one that does not decrease.`;
|
|
92
|
+
}
|
|
93
|
+
function ue(e) {
|
|
94
|
+
let { points: t, value: n, probability: r, tone: i = "series1", height: o = "regular", selected: s, onSelectedChange: c, ...l } = e, { emptyLabel: f = "No cumulative distribution points are available.", ...p } = l, { locale: h } = p, g = j(o);
|
|
95
|
+
if (p.status === "loading") return /* @__PURE__ */ F(v, {
|
|
96
|
+
...p,
|
|
97
|
+
height: o
|
|
98
|
+
});
|
|
99
|
+
let y = n.domain ?? a({
|
|
100
|
+
values: t.map((e) => e.value),
|
|
101
|
+
scale: n.scale
|
|
102
|
+
}), b = r.domain ?? ae, S = le({
|
|
103
|
+
points: t,
|
|
104
|
+
value: n,
|
|
105
|
+
probability: r,
|
|
106
|
+
valueDomain: y,
|
|
107
|
+
probabilityDomain: b
|
|
108
|
+
});
|
|
109
|
+
if (S !== void 0) return /* @__PURE__ */ F(x, {
|
|
110
|
+
...p,
|
|
111
|
+
message: S
|
|
112
|
+
});
|
|
113
|
+
let C = u({
|
|
114
|
+
width: g.width,
|
|
115
|
+
height: g.height,
|
|
116
|
+
x: n,
|
|
117
|
+
y: r,
|
|
118
|
+
xDomain: y,
|
|
119
|
+
yDomain: b,
|
|
120
|
+
locale: h
|
|
121
|
+
}), { box: w } = C, T = t.map((e) => ({
|
|
122
|
+
id: e.id,
|
|
123
|
+
label: `${n.label}: ${m({
|
|
124
|
+
value: e.value,
|
|
125
|
+
locale: h,
|
|
126
|
+
format: n.format
|
|
127
|
+
})}, ${r.label}: ${m({
|
|
128
|
+
value: e.probability,
|
|
129
|
+
locale: h,
|
|
130
|
+
format: r.format
|
|
131
|
+
})}`
|
|
132
|
+
})), D = t.map((e) => ({
|
|
133
|
+
x: C.x.position(e.value),
|
|
134
|
+
y: e.probability === null ? null : C.y.position(e.probability)
|
|
135
|
+
})), k = t.map((e, t) => ({
|
|
136
|
+
id: e.id,
|
|
137
|
+
x: D[t]?.x ?? 0,
|
|
138
|
+
y: 0
|
|
139
|
+
}));
|
|
140
|
+
return /* @__PURE__ */ F(d, {
|
|
141
|
+
items: T,
|
|
142
|
+
arrows: "both",
|
|
143
|
+
locate: M({
|
|
144
|
+
marks: k,
|
|
145
|
+
width: w.width,
|
|
146
|
+
height: w.height,
|
|
147
|
+
axis: "x"
|
|
148
|
+
}),
|
|
149
|
+
selected: s ?? null,
|
|
150
|
+
onSelect: c,
|
|
151
|
+
render: (e, a) => {
|
|
152
|
+
let o = t.find((e) => e.id === a.cursor);
|
|
153
|
+
return /* @__PURE__ */ F(ie, {
|
|
154
|
+
frame: p,
|
|
155
|
+
figure: e,
|
|
156
|
+
items: T,
|
|
157
|
+
inspected: a.inspected,
|
|
158
|
+
plotRef: g.ref,
|
|
159
|
+
plot: C,
|
|
160
|
+
x: n,
|
|
161
|
+
y: r,
|
|
162
|
+
isSelectable: c !== void 0,
|
|
163
|
+
emptyLabel: f,
|
|
164
|
+
overlay: /* @__PURE__ */ I(P, { children: [t.map((e) => {
|
|
165
|
+
let t = a.selected === e.id, n = a.inspected === e.id;
|
|
166
|
+
return e.probability === null ? null : /* @__PURE__ */ F(E, {
|
|
167
|
+
x: C.x.position(e.value),
|
|
168
|
+
y: C.y.position(e.probability),
|
|
169
|
+
tone: i,
|
|
170
|
+
radius: t || n ? ce : se,
|
|
171
|
+
isSelected: t,
|
|
172
|
+
isInspected: n
|
|
173
|
+
}, e.id);
|
|
174
|
+
}), o !== void 0 && /* @__PURE__ */ F(_, {
|
|
175
|
+
x: C.x.position(o.value),
|
|
176
|
+
top: w.top,
|
|
177
|
+
bottom: w.bottom,
|
|
178
|
+
width: oe
|
|
179
|
+
})] }),
|
|
180
|
+
children: /* @__PURE__ */ F(O, {
|
|
181
|
+
d: ne(D, "step"),
|
|
182
|
+
tone: i
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
// packages/charts/src/distribution/histogram.tsx
|
|
189
|
+
var de = 2, fe = .2, pe = 5;
|
|
190
|
+
function me({ bins: e, value: t, count: n, valueDomain: r, countDomain: i }) {
|
|
191
|
+
let a = R({
|
|
192
|
+
items: e,
|
|
193
|
+
domain: r,
|
|
194
|
+
scale: t.scale,
|
|
195
|
+
maxEntries: L.bins
|
|
196
|
+
}) ?? g(i, n.scale);
|
|
197
|
+
if (a !== void 0) return a;
|
|
198
|
+
if (i[0] !== 0) return "The histogram count axis must start at zero.";
|
|
199
|
+
for (let [t, n] of e.entries()) {
|
|
200
|
+
if (h(n.lowerBound, r) || h(n.upperBound, r)) return `Histogram bin ${n.id} has a non-finite bound or lies outside the declared domain.`;
|
|
201
|
+
let a = e[t - 1];
|
|
202
|
+
if (n.lowerBound >= n.upperBound || a !== void 0 && n.lowerBound < a.upperBound) return `Histogram bin ${n.id} is reversed, overlaps another bin, or is out of order.`;
|
|
203
|
+
if (n.count !== null && h(n.count, i)) return `Histogram bin ${n.id} has a count outside the declared count domain.`;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
function he(e) {
|
|
207
|
+
let { bins: t, value: n, count: r, tone: i = "series1", height: o = "regular", selected: s, onSelectedChange: c, ...l } = e, { emptyLabel: f = "No histogram bins are available.", ...p } = l, { locale: h } = p, g = j(o);
|
|
208
|
+
if (p.status === "loading") return /* @__PURE__ */ F(v, {
|
|
209
|
+
...p,
|
|
210
|
+
height: o
|
|
211
|
+
});
|
|
212
|
+
let y = t.flatMap((e) => [e.lowerBound, e.upperBound]), b = n.domain ?? a({
|
|
213
|
+
values: y,
|
|
214
|
+
scale: n.scale
|
|
215
|
+
}), S = t.map((e) => e.count), C = r.domain ?? a({
|
|
216
|
+
values: S,
|
|
217
|
+
isZeroBased: !0,
|
|
218
|
+
scale: r.scale
|
|
219
|
+
}), w = me({
|
|
220
|
+
bins: t,
|
|
221
|
+
value: n,
|
|
222
|
+
count: r,
|
|
223
|
+
valueDomain: b,
|
|
224
|
+
countDomain: C
|
|
225
|
+
});
|
|
226
|
+
if (w !== void 0) return /* @__PURE__ */ F(x, {
|
|
227
|
+
...p,
|
|
228
|
+
message: w
|
|
229
|
+
});
|
|
230
|
+
let T = u({
|
|
231
|
+
width: g.width,
|
|
232
|
+
height: g.height,
|
|
233
|
+
x: n,
|
|
234
|
+
y: r,
|
|
235
|
+
xDomain: b,
|
|
236
|
+
yDomain: C,
|
|
237
|
+
locale: h
|
|
238
|
+
}), { box: E } = T;
|
|
239
|
+
function D(e) {
|
|
240
|
+
return m({
|
|
241
|
+
value: e,
|
|
242
|
+
locale: h,
|
|
243
|
+
format: n.format
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
let O = t.map((e) => ({
|
|
247
|
+
id: e.id,
|
|
248
|
+
label: `${e.label}, ${D(e.lowerBound)} – ${D(e.upperBound)}, ${r.label}: ${m({
|
|
249
|
+
value: e.count,
|
|
250
|
+
locale: h,
|
|
251
|
+
format: r.format
|
|
252
|
+
})}`
|
|
253
|
+
}));
|
|
254
|
+
return /* @__PURE__ */ F(d, {
|
|
255
|
+
items: O,
|
|
256
|
+
arrows: "both",
|
|
257
|
+
locate: (e) => {
|
|
258
|
+
let n = T.x.valueAt(e.x / e.width * E.width);
|
|
259
|
+
return t.find((e) => n >= e.lowerBound && n <= e.upperBound)?.id;
|
|
260
|
+
},
|
|
261
|
+
selected: s ?? null,
|
|
262
|
+
onSelect: c,
|
|
263
|
+
render: (e, a) => {
|
|
264
|
+
let o = t.find((e) => e.id === a.cursor);
|
|
265
|
+
return /* @__PURE__ */ F(ie, {
|
|
266
|
+
frame: p,
|
|
267
|
+
figure: e,
|
|
268
|
+
items: O,
|
|
269
|
+
inspected: a.inspected,
|
|
270
|
+
plotRef: g.ref,
|
|
271
|
+
plot: T,
|
|
272
|
+
x: n,
|
|
273
|
+
y: r,
|
|
274
|
+
isSelectable: c !== void 0,
|
|
275
|
+
emptyLabel: f,
|
|
276
|
+
overlay: o !== void 0 && /* @__PURE__ */ F(_, {
|
|
277
|
+
x: (T.x.position(o.lowerBound) + T.x.position(o.upperBound)) / 2,
|
|
278
|
+
top: E.top,
|
|
279
|
+
bottom: E.bottom,
|
|
280
|
+
width: T.x.position(o.upperBound) - T.x.position(o.lowerBound)
|
|
281
|
+
}),
|
|
282
|
+
children: t.map((e) => {
|
|
283
|
+
let t = T.x.position(e.lowerBound), n = T.x.position(e.upperBound) - t, r = Math.min(de, n * fe), o = a.selected === e.id, s = a.inspected === e.id, c = a.selected === null || o || s, l = e.count === null ? E.bottom - pe : T.y.position(e.count);
|
|
284
|
+
return /* @__PURE__ */ F(k, {
|
|
285
|
+
x: t + r / 2,
|
|
286
|
+
y: l,
|
|
287
|
+
width: n - r,
|
|
288
|
+
height: E.bottom - l,
|
|
289
|
+
tone: i,
|
|
290
|
+
isHollow: e.count === null,
|
|
291
|
+
emphasis: c ? "normal" : "receded",
|
|
292
|
+
isSelected: o,
|
|
293
|
+
isInspected: s
|
|
294
|
+
}, e.id);
|
|
295
|
+
})
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
// packages/charts/src/distribution/group-plot-layout.ts
|
|
301
|
+
var z = .5, ge = 28, _e = 56;
|
|
302
|
+
function B({ height: e, count: t }) {
|
|
303
|
+
return Math.max(o[e], t * ge + _e);
|
|
304
|
+
}
|
|
305
|
+
function ve(e) {
|
|
306
|
+
let t = e === "columns";
|
|
307
|
+
return { point: (e, n) => t ? {
|
|
308
|
+
x: e,
|
|
309
|
+
y: n
|
|
310
|
+
} : {
|
|
311
|
+
x: n,
|
|
312
|
+
y: e
|
|
313
|
+
} };
|
|
314
|
+
}
|
|
315
|
+
function V(e, t) {
|
|
316
|
+
return {
|
|
317
|
+
x1: e.x,
|
|
318
|
+
y1: e.y,
|
|
319
|
+
x2: t.x,
|
|
320
|
+
y2: t.y
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function H(e) {
|
|
324
|
+
return `${ne(e)}Z`;
|
|
325
|
+
}
|
|
326
|
+
function U({ width: e, height: t, direction: n, groups: r, value: i, valueDomain: a, locale: o }) {
|
|
327
|
+
let c = s({
|
|
328
|
+
width: e,
|
|
329
|
+
height: t,
|
|
330
|
+
direction: n,
|
|
331
|
+
categories: r,
|
|
332
|
+
value: i,
|
|
333
|
+
valueDomain: a,
|
|
334
|
+
locale: o
|
|
335
|
+
}), { box: u, band: d } = c, f = n === "columns", p = ve(n), m = r.map((e) => ({
|
|
336
|
+
...e,
|
|
337
|
+
center: d.center(e.id) ?? 0
|
|
338
|
+
})), h = m.map((e) => ({
|
|
339
|
+
id: e.id,
|
|
340
|
+
...p.point(e.center, 0)
|
|
341
|
+
}));
|
|
342
|
+
return {
|
|
343
|
+
...f ? {
|
|
344
|
+
xTicks: c.bandTicks,
|
|
345
|
+
yTicks: c.valueTicks,
|
|
346
|
+
xTitle: void 0,
|
|
347
|
+
yTitle: l(i),
|
|
348
|
+
grid: "y"
|
|
349
|
+
} : {
|
|
350
|
+
xTicks: c.valueTicks,
|
|
351
|
+
yTicks: c.bandTicks,
|
|
352
|
+
xTitle: l(i),
|
|
353
|
+
yTitle: void 0,
|
|
354
|
+
grid: "x"
|
|
355
|
+
},
|
|
356
|
+
box: u,
|
|
357
|
+
value: c.value,
|
|
358
|
+
bandwidth: d.bandwidth,
|
|
359
|
+
placed: m,
|
|
360
|
+
orient: p,
|
|
361
|
+
locate: M({
|
|
362
|
+
marks: h,
|
|
363
|
+
width: u.width,
|
|
364
|
+
height: u.height,
|
|
365
|
+
axis: f ? "x" : "y"
|
|
366
|
+
}),
|
|
367
|
+
slot: (e) => f ? {
|
|
368
|
+
x: e - d.step * z,
|
|
369
|
+
y: u.top,
|
|
370
|
+
width: d.step,
|
|
371
|
+
height: u.innerHeight
|
|
372
|
+
} : {
|
|
373
|
+
x: u.left,
|
|
374
|
+
y: e - d.step * z,
|
|
375
|
+
width: u.innerWidth,
|
|
376
|
+
height: d.step
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
var ye = .6180339887;
|
|
381
|
+
function be(e) {
|
|
382
|
+
return e * ye % 1 - z;
|
|
383
|
+
}
|
|
384
|
+
// packages/charts/src/distribution/group-plot.tsx
|
|
385
|
+
var W = {
|
|
386
|
+
ink: {
|
|
387
|
+
kjVXCG: "x17y187c",
|
|
388
|
+
kU5bRw: "x1owpc8m",
|
|
389
|
+
kREpy8: "x13efnbd",
|
|
390
|
+
kfzvcC: "x47corl",
|
|
391
|
+
$$css: !0
|
|
392
|
+
},
|
|
393
|
+
unfilled: {
|
|
394
|
+
kDwRjp: "xbh8q5q",
|
|
395
|
+
kfzvcC: "x47corl",
|
|
396
|
+
$$css: !0
|
|
397
|
+
}
|
|
398
|
+
}, xe = {
|
|
399
|
+
soft: {
|
|
400
|
+
kVYP8I: "xbn8unt",
|
|
401
|
+
$$css: !0
|
|
402
|
+
},
|
|
403
|
+
strong: {
|
|
404
|
+
kVYP8I: "xwcy42a",
|
|
405
|
+
$$css: !0
|
|
406
|
+
}
|
|
407
|
+
}, Se = {
|
|
408
|
+
thin: {
|
|
409
|
+
kfJifR: "x1ip4yf",
|
|
410
|
+
$$css: !0
|
|
411
|
+
},
|
|
412
|
+
thick: {
|
|
413
|
+
kfJifR: "xefhp24",
|
|
414
|
+
$$css: !0
|
|
415
|
+
}
|
|
416
|
+
}, Ce = 3.5, we = 4;
|
|
417
|
+
function G(e) {
|
|
418
|
+
let t = p();
|
|
419
|
+
return e.map((e, n) => ({
|
|
420
|
+
...e,
|
|
421
|
+
tone: t({
|
|
422
|
+
id: e.id,
|
|
423
|
+
tone: e.tone,
|
|
424
|
+
index: n
|
|
425
|
+
})
|
|
426
|
+
}));
|
|
427
|
+
}
|
|
428
|
+
function K({ d: n, tone: r, fill: i, isInspected: a = !1, isSelected: o = !1 }) {
|
|
429
|
+
return /* @__PURE__ */ F("path", {
|
|
430
|
+
d: n,
|
|
431
|
+
fill: t[r],
|
|
432
|
+
stroke: e[r],
|
|
433
|
+
...N.props(C.outlined, C.emphasis, xe[i], a && C.inspected, o && C.selected)
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
function Te({ weight: e, ...t }) {
|
|
437
|
+
return /* @__PURE__ */ F("line", {
|
|
438
|
+
...t,
|
|
439
|
+
...N.props(W.ink, Se[e])
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
function Ee({ x: e, y: t }) {
|
|
443
|
+
return /* @__PURE__ */ F("circle", {
|
|
444
|
+
cx: e,
|
|
445
|
+
cy: t,
|
|
446
|
+
r: Ce,
|
|
447
|
+
className: "x1fytgo2 x17y187c xhr4kjn x13efnbd x47corl"
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
function q({ x: e, y: t, width: n, height: r }) {
|
|
451
|
+
return /* @__PURE__ */ F("rect", {
|
|
452
|
+
x: e,
|
|
453
|
+
y: t,
|
|
454
|
+
width: n,
|
|
455
|
+
height: r,
|
|
456
|
+
...N.props(W.unfilled, C.cursor)
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
function De({ x: e, y: t, radius: n }) {
|
|
460
|
+
return /* @__PURE__ */ F("circle", {
|
|
461
|
+
cx: e,
|
|
462
|
+
cy: t,
|
|
463
|
+
r: n + we,
|
|
464
|
+
...N.props(W.unfilled, C.shapeCursor)
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
function J({ frame: e, emptyLabel: t, size: n, axes: a, items: o, locate: s, place: l, marksLabel: u, note: p, marks: m, cursor: h, selected: g, onSelectedChange: _ }) {
|
|
468
|
+
let v = re(), x = f(), { box: C, xTicks: w, yTicks: E, xTitle: D, yTitle: O, grid: k } = a;
|
|
469
|
+
return /* @__PURE__ */ F(d, {
|
|
470
|
+
...x,
|
|
471
|
+
items: o,
|
|
472
|
+
locate: s,
|
|
473
|
+
place: l,
|
|
474
|
+
selected: g,
|
|
475
|
+
onSelect: _,
|
|
476
|
+
render: (a, s) => /* @__PURE__ */ F(b, {
|
|
477
|
+
...e,
|
|
478
|
+
figure: a,
|
|
479
|
+
footer: o.length === 0 ? void 0 : /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(i, {
|
|
480
|
+
id: v,
|
|
481
|
+
children: r(o, s.inspected)
|
|
482
|
+
}), p !== void 0 && /* @__PURE__ */ F("p", {
|
|
483
|
+
className: "x1ghz6dp x153jb6y xy8obcc xas2l8k xe0zcna",
|
|
484
|
+
children: p
|
|
485
|
+
})] }),
|
|
486
|
+
children: o.length === 0 ? /* @__PURE__ */ F(S, { children: t }) : /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ I(ee, {
|
|
487
|
+
plotRef: n.ref,
|
|
488
|
+
box: C,
|
|
489
|
+
label: c({
|
|
490
|
+
title: e.title,
|
|
491
|
+
marks: u,
|
|
492
|
+
isSelectable: _ !== void 0
|
|
493
|
+
}),
|
|
494
|
+
readoutId: v,
|
|
495
|
+
children: [
|
|
496
|
+
/* @__PURE__ */ F(T, {
|
|
497
|
+
box: C,
|
|
498
|
+
xTicks: w,
|
|
499
|
+
yTicks: E,
|
|
500
|
+
xTitle: D,
|
|
501
|
+
yTitle: O,
|
|
502
|
+
grid: k
|
|
503
|
+
}),
|
|
504
|
+
/* @__PURE__ */ F(te, {
|
|
505
|
+
box: C,
|
|
506
|
+
children: m(s)
|
|
507
|
+
}),
|
|
508
|
+
s.cursor !== null && h(s.cursor)
|
|
509
|
+
]
|
|
510
|
+
}), /* @__PURE__ */ F(y, {
|
|
511
|
+
label: `${e.title} ${u}`,
|
|
512
|
+
columns: [{
|
|
513
|
+
id: "observation",
|
|
514
|
+
label: "Observation"
|
|
515
|
+
}],
|
|
516
|
+
rows: o.map((e) => ({
|
|
517
|
+
id: e.id,
|
|
518
|
+
values: [e.label]
|
|
519
|
+
}))
|
|
520
|
+
})] })
|
|
521
|
+
})
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
// packages/charts/src/distribution/interval-plot.tsx
|
|
525
|
+
var Y = 5, Oe = 4;
|
|
526
|
+
function ke({ items: e, value: t, domain: n }) {
|
|
527
|
+
let r = R({
|
|
528
|
+
items: e,
|
|
529
|
+
domain: n,
|
|
530
|
+
scale: t.scale,
|
|
531
|
+
maxEntries: L.rows
|
|
532
|
+
});
|
|
533
|
+
if (r !== void 0) return r;
|
|
534
|
+
for (let t of e) {
|
|
535
|
+
if ([
|
|
536
|
+
t.lower,
|
|
537
|
+
t.estimate,
|
|
538
|
+
t.upper
|
|
539
|
+
].some((e) => e !== null && h(e, n))) return `Interval ${t.id} has a non-finite value or lies outside the declared domain.`;
|
|
540
|
+
if (t.lower !== null && t.upper !== null && t.lower > t.upper) return `Interval ${t.id} has reversed endpoints.`;
|
|
541
|
+
if (t.estimate !== null) {
|
|
542
|
+
if (t.lower !== null && t.estimate < t.lower) return `Interval ${t.id} has an estimate below its lower endpoint.`;
|
|
543
|
+
if (t.upper !== null && t.estimate > t.upper) return `Interval ${t.id} has an estimate above its upper endpoint.`;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function Ae(e) {
|
|
548
|
+
let { items: t, value: n, intervalLabel: r, height: i = "regular", selected: o, onSelectedChange: s, ...c } = e, { emptyLabel: l = "No interval estimates are available.", ...u } = c, { locale: d } = u, { ref: f, width: p } = w(), h = G(t);
|
|
549
|
+
if (u.status === "loading") return /* @__PURE__ */ F(v, {
|
|
550
|
+
...u,
|
|
551
|
+
height: i
|
|
552
|
+
});
|
|
553
|
+
let g = t.flatMap((e) => [
|
|
554
|
+
e.lower,
|
|
555
|
+
e.estimate,
|
|
556
|
+
e.upper
|
|
557
|
+
]), _ = n.domain ?? a({
|
|
558
|
+
values: g,
|
|
559
|
+
scale: n.scale
|
|
560
|
+
}), y = ke({
|
|
561
|
+
items: t,
|
|
562
|
+
value: n,
|
|
563
|
+
domain: _
|
|
564
|
+
});
|
|
565
|
+
if (y !== void 0) return /* @__PURE__ */ F(x, {
|
|
566
|
+
...u,
|
|
567
|
+
message: y
|
|
568
|
+
});
|
|
569
|
+
let b = U({
|
|
570
|
+
width: p,
|
|
571
|
+
height: B({
|
|
572
|
+
height: i,
|
|
573
|
+
count: t.length
|
|
574
|
+
}),
|
|
575
|
+
direction: "rows",
|
|
576
|
+
groups: h,
|
|
577
|
+
value: n,
|
|
578
|
+
valueDomain: _,
|
|
579
|
+
locale: d
|
|
580
|
+
}), { orient: S, placed: C } = b;
|
|
581
|
+
function T(e, t) {
|
|
582
|
+
return S.point(e, b.value.position(t));
|
|
583
|
+
}
|
|
584
|
+
function D(e) {
|
|
585
|
+
return m({
|
|
586
|
+
value: e,
|
|
587
|
+
locale: d,
|
|
588
|
+
format: n.format
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
let O = C.map((e) => {
|
|
592
|
+
let t = e.estimate === null ? "Estimate unavailable" : D(e.estimate);
|
|
593
|
+
return {
|
|
594
|
+
id: e.id,
|
|
595
|
+
label: `${e.label}, ${n.label}: ${t}, ${r}: ${D(e.lower)} – ${D(e.upper)}`
|
|
596
|
+
};
|
|
597
|
+
});
|
|
598
|
+
return /* @__PURE__ */ F(J, {
|
|
599
|
+
frame: u,
|
|
600
|
+
emptyLabel: l,
|
|
601
|
+
size: {
|
|
602
|
+
ref: f,
|
|
603
|
+
width: p,
|
|
604
|
+
height: b.box.height
|
|
605
|
+
},
|
|
606
|
+
axes: b,
|
|
607
|
+
items: O,
|
|
608
|
+
locate: b.locate,
|
|
609
|
+
marksLabel: "estimates",
|
|
610
|
+
selected: o,
|
|
611
|
+
onSelectedChange: s,
|
|
612
|
+
note: `The dot is the estimate. The line is the ${r}.`,
|
|
613
|
+
cursor: (e) => {
|
|
614
|
+
let t = C.find((t) => t.id === e);
|
|
615
|
+
return t === void 0 ? null : /* @__PURE__ */ F(q, { ...b.slot(t.center) });
|
|
616
|
+
},
|
|
617
|
+
marks: (e) => C.map((t) => {
|
|
618
|
+
let { center: n } = t, r = {
|
|
619
|
+
isInspected: e.inspected === t.id,
|
|
620
|
+
isSelected: e.selected === t.id
|
|
621
|
+
};
|
|
622
|
+
return /* @__PURE__ */ I("g", { children: [t.lower !== null && t.upper !== null && /* @__PURE__ */ I(P, { children: [
|
|
623
|
+
/* @__PURE__ */ F(A, {
|
|
624
|
+
...V(T(n, t.lower), T(n, t.upper)),
|
|
625
|
+
tone: t.tone
|
|
626
|
+
}),
|
|
627
|
+
/* @__PURE__ */ F(A, {
|
|
628
|
+
...V(T(n - Y, t.lower), T(n + Y, t.lower)),
|
|
629
|
+
tone: t.tone
|
|
630
|
+
}),
|
|
631
|
+
/* @__PURE__ */ F(A, {
|
|
632
|
+
...V(T(n - Y, t.upper), T(n + Y, t.upper)),
|
|
633
|
+
tone: t.tone
|
|
634
|
+
})
|
|
635
|
+
] }), t.estimate !== null && /* @__PURE__ */ F(E, {
|
|
636
|
+
...T(n, t.estimate),
|
|
637
|
+
tone: t.tone,
|
|
638
|
+
radius: Oe,
|
|
639
|
+
...r
|
|
640
|
+
})] }, t.id);
|
|
641
|
+
})
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
// packages/charts/src/distribution/ranked-bars.tsx
|
|
645
|
+
var je = .6, Me = 20;
|
|
646
|
+
function Ne({ items: e, value: t, domain: n }) {
|
|
647
|
+
let r = R({
|
|
648
|
+
items: e,
|
|
649
|
+
domain: n,
|
|
650
|
+
scale: t.scale,
|
|
651
|
+
maxEntries: L.rows
|
|
652
|
+
});
|
|
653
|
+
if (r !== void 0) return r;
|
|
654
|
+
if (n[0] > 0 || n[1] < 0) return "The ranked-value domain must include zero.";
|
|
655
|
+
let i = e.find((e) => e.value !== null && h(e.value, n));
|
|
656
|
+
return i === void 0 ? void 0 : `Ranked value ${i.id} is non-finite or lies outside the declared domain.`;
|
|
657
|
+
}
|
|
658
|
+
function Pe(e) {
|
|
659
|
+
let { items: t, value: n, height: r = "regular", selected: i, onSelectedChange: o, ...s } = e, { emptyLabel: c = "No ranked values are available.", ...l } = s, { locale: u } = l, { ref: d, width: f } = w(), p = G(t.map((e) => ({
|
|
660
|
+
...e,
|
|
661
|
+
label: e.rank === void 0 ? e.label : `${e.rank} · ${e.label}`
|
|
662
|
+
})));
|
|
663
|
+
if (l.status === "loading") return /* @__PURE__ */ F(v, {
|
|
664
|
+
...l,
|
|
665
|
+
height: r
|
|
666
|
+
});
|
|
667
|
+
let h = t.map((e) => e.value), g = n.domain ?? a({
|
|
668
|
+
values: h,
|
|
669
|
+
isZeroBased: !0,
|
|
670
|
+
scale: n.scale
|
|
671
|
+
}), _ = Ne({
|
|
672
|
+
items: t,
|
|
673
|
+
value: n,
|
|
674
|
+
domain: g
|
|
675
|
+
});
|
|
676
|
+
if (_ !== void 0) return /* @__PURE__ */ F(x, {
|
|
677
|
+
...l,
|
|
678
|
+
message: _
|
|
679
|
+
});
|
|
680
|
+
let y = U({
|
|
681
|
+
width: f,
|
|
682
|
+
height: B({
|
|
683
|
+
height: r,
|
|
684
|
+
count: t.length
|
|
685
|
+
}),
|
|
686
|
+
direction: "rows",
|
|
687
|
+
groups: p,
|
|
688
|
+
value: n,
|
|
689
|
+
valueDomain: g,
|
|
690
|
+
locale: u
|
|
691
|
+
}), { orient: b, placed: S } = y, C = y.value.position(0), T = Math.min(y.bandwidth * je, Me), E = S.map((e) => ({
|
|
692
|
+
id: e.id,
|
|
693
|
+
label: `${e.label}, ${n.label}: ${m({
|
|
694
|
+
value: e.value,
|
|
695
|
+
locale: u,
|
|
696
|
+
format: n.format
|
|
697
|
+
})}`
|
|
698
|
+
}));
|
|
699
|
+
return /* @__PURE__ */ F(J, {
|
|
700
|
+
frame: l,
|
|
701
|
+
emptyLabel: c,
|
|
702
|
+
size: {
|
|
703
|
+
ref: d,
|
|
704
|
+
width: f,
|
|
705
|
+
height: y.box.height
|
|
706
|
+
},
|
|
707
|
+
axes: y,
|
|
708
|
+
items: E,
|
|
709
|
+
locate: y.locate,
|
|
710
|
+
marksLabel: "ranked values",
|
|
711
|
+
selected: i,
|
|
712
|
+
onSelectedChange: o,
|
|
713
|
+
cursor: (e) => {
|
|
714
|
+
let t = S.find((t) => t.id === e);
|
|
715
|
+
return t === void 0 ? null : /* @__PURE__ */ F(q, { ...y.slot(t.center) });
|
|
716
|
+
},
|
|
717
|
+
marks: (e) => /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(D, { ...V(b.point(y.box.top, C), b.point(y.box.bottom, C)) }), S.map((t) => {
|
|
718
|
+
let n = t.value === null ? C : y.value.position(t.value), r = {
|
|
719
|
+
isInspected: e.inspected === t.id,
|
|
720
|
+
isSelected: e.selected === t.id
|
|
721
|
+
};
|
|
722
|
+
return t.value === 0 ? /* @__PURE__ */ F(D, {
|
|
723
|
+
...V(b.point(t.center - T / 2, C), b.point(t.center + T / 2, C)),
|
|
724
|
+
tone: t.tone
|
|
725
|
+
}, t.id) : t.value !== null && /* @__PURE__ */ F(k, {
|
|
726
|
+
x: Math.min(C, n),
|
|
727
|
+
y: t.center - T / 2,
|
|
728
|
+
width: Math.abs(n - C),
|
|
729
|
+
height: T,
|
|
730
|
+
tone: t.tone,
|
|
731
|
+
...r
|
|
732
|
+
}, t.id);
|
|
733
|
+
})] })
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
// packages/charts/src/distribution/group-plot-input.ts
|
|
737
|
+
var Fe = 2;
|
|
738
|
+
function X({ records: e, limit: t, noun: r, domain: i, scale: a }) {
|
|
739
|
+
let o = g(i, a);
|
|
740
|
+
if (o !== void 0) return o;
|
|
741
|
+
if (!n(e)) return `Each of the ${r} needs a unique identifier.`;
|
|
742
|
+
if (e.length > t) return `This chart draws at most ${t} ${r}.`;
|
|
743
|
+
}
|
|
744
|
+
function Ie({ id: e, density: t, domain: n, limit: r }) {
|
|
745
|
+
if (t.length < Fe) return `${e} needs at least ${Fe} density points.`;
|
|
746
|
+
if (t.length > r) return `${e} exceeds ${r} density points. Supply a coarser density.`;
|
|
747
|
+
if (!t.every((e, n) => n === 0 || e.value > (t[n - 1]?.value ?? -Infinity)) || t.some((e) => h(e.value, n))) return `${e} needs strictly increasing values inside the declared domain.`;
|
|
748
|
+
if (t.some((e) => !Number.isFinite(e.density) || e.density < 0)) return `${e} has a density that is negative or not finite.`;
|
|
749
|
+
}
|
|
750
|
+
function Le({ records: e, domain: t, limit: n }) {
|
|
751
|
+
return e.map((e) => Ie({
|
|
752
|
+
id: e.id,
|
|
753
|
+
density: e.density,
|
|
754
|
+
domain: t,
|
|
755
|
+
limit: n
|
|
756
|
+
})).find((e) => e !== void 0) ?? void 0;
|
|
757
|
+
}
|
|
758
|
+
function Z(e) {
|
|
759
|
+
return Math.max(0, ...e.flatMap((e) => e.density.map((e) => e.density)));
|
|
760
|
+
}
|
|
761
|
+
function Re(e) {
|
|
762
|
+
let t = Math.max(0, ...e.map((e) => e.density));
|
|
763
|
+
return e.find((e) => e.density === t);
|
|
764
|
+
}
|
|
765
|
+
// packages/charts/src/distribution/box-plot.tsx
|
|
766
|
+
var Q = {
|
|
767
|
+
groups: 40,
|
|
768
|
+
outliers: 200
|
|
769
|
+
}, ze = 72, Be = .5, Ve = 3;
|
|
770
|
+
function He(e) {
|
|
771
|
+
return [
|
|
772
|
+
e.low,
|
|
773
|
+
e.q1,
|
|
774
|
+
e.median,
|
|
775
|
+
e.q3,
|
|
776
|
+
e.high
|
|
777
|
+
];
|
|
778
|
+
}
|
|
779
|
+
function Ue({ groups: e, domain: t, value: n }) {
|
|
780
|
+
let r = X({
|
|
781
|
+
records: e,
|
|
782
|
+
limit: Q.groups,
|
|
783
|
+
noun: "groups",
|
|
784
|
+
domain: t,
|
|
785
|
+
scale: n.scale
|
|
786
|
+
});
|
|
787
|
+
if (r !== void 0) return r;
|
|
788
|
+
for (let n of e) {
|
|
789
|
+
let e = n.outliers ?? [], r = He(n), i = r.every((e, t) => t === 0 || e >= (r[t - 1] ?? 0));
|
|
790
|
+
if (e.length > Q.outliers) return `Group ${n.id} has more than ${Q.outliers} outliers. Supply a window or a coarser summary.`;
|
|
791
|
+
if (r.some((e) => h(e, t)) || e.some((e) => h(e, t))) return `Group ${n.id} has a value that is not finite or lies outside the declared domain.`;
|
|
792
|
+
if (!i) return `Group ${n.id} needs low ≤ q1 ≤ median ≤ q3 ≤ high.`;
|
|
793
|
+
if (e.some((e) => e >= n.low && e <= n.high)) return `Group ${n.id} has an outlier inside its whiskers. Outliers lie beyond them.`;
|
|
794
|
+
if (n.count !== void 0 && (!Number.isInteger(n.count) || n.count < 0)) return `Group ${n.id} needs a count that is a whole number from zero.`;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
function We(e) {
|
|
798
|
+
let { groups: t, value: n, direction: r = "columns", whiskerLabel: i, height: o = "regular", ...s } = e, { emptyLabel: c = "No groups are available.", ...l } = s, { locale: u } = l, d = j(o), f = G(t);
|
|
799
|
+
if (l.status === "loading") return /* @__PURE__ */ F(v, {
|
|
800
|
+
...l,
|
|
801
|
+
height: o
|
|
802
|
+
});
|
|
803
|
+
let p = n.domain ?? a({
|
|
804
|
+
values: t.flatMap((e) => [...He(e), ...e.outliers ?? []]),
|
|
805
|
+
scale: n.scale
|
|
806
|
+
}), h = Ue({
|
|
807
|
+
groups: t,
|
|
808
|
+
value: n,
|
|
809
|
+
domain: p
|
|
810
|
+
});
|
|
811
|
+
if (h !== void 0) return /* @__PURE__ */ F(x, {
|
|
812
|
+
...l,
|
|
813
|
+
message: h
|
|
814
|
+
});
|
|
815
|
+
let g = U({
|
|
816
|
+
width: d.width,
|
|
817
|
+
height: d.height,
|
|
818
|
+
direction: r,
|
|
819
|
+
groups: f,
|
|
820
|
+
value: n,
|
|
821
|
+
valueDomain: p,
|
|
822
|
+
locale: u
|
|
823
|
+
}), { orient: _, placed: y } = g, b = Math.min(g.bandwidth, ze) / 2, S = b * Be;
|
|
824
|
+
function C(e) {
|
|
825
|
+
return m({
|
|
826
|
+
value: e,
|
|
827
|
+
locale: u,
|
|
828
|
+
format: n.format
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
function w(e, t) {
|
|
832
|
+
return _.point(e, g.value.position(t));
|
|
833
|
+
}
|
|
834
|
+
let T = y.map((e) => {
|
|
835
|
+
let t = e.outliers?.length ?? 0, n = [
|
|
836
|
+
e.label,
|
|
837
|
+
`Low ${C(e.low)}`,
|
|
838
|
+
`Q1 ${C(e.q1)}`,
|
|
839
|
+
`Median ${C(e.median)}`,
|
|
840
|
+
`Q3 ${C(e.q3)}`,
|
|
841
|
+
`High ${C(e.high)}`,
|
|
842
|
+
...e.count === void 0 ? [] : [`${m({
|
|
843
|
+
value: e.count,
|
|
844
|
+
locale: u,
|
|
845
|
+
format: {}
|
|
846
|
+
})} observations`],
|
|
847
|
+
`${t} ${t === 1 ? "outlier" : "outliers"}`,
|
|
848
|
+
i
|
|
849
|
+
];
|
|
850
|
+
return {
|
|
851
|
+
id: e.id,
|
|
852
|
+
label: n.join(" · ")
|
|
853
|
+
};
|
|
854
|
+
});
|
|
855
|
+
return /* @__PURE__ */ F(J, {
|
|
856
|
+
frame: l,
|
|
857
|
+
emptyLabel: c,
|
|
858
|
+
size: d,
|
|
859
|
+
axes: g,
|
|
860
|
+
items: T,
|
|
861
|
+
locate: g.locate,
|
|
862
|
+
marksLabel: "groups",
|
|
863
|
+
note: `${i}. Hollow dots mark outliers beyond the whiskers.`,
|
|
864
|
+
cursor: (e) => {
|
|
865
|
+
let t = y.find((t) => t.id === e);
|
|
866
|
+
return t === void 0 ? null : /* @__PURE__ */ F(q, { ...g.slot(t.center) });
|
|
867
|
+
},
|
|
868
|
+
marks: (e) => y.map((t) => {
|
|
869
|
+
let { center: n } = t;
|
|
870
|
+
return /* @__PURE__ */ I("g", { children: [
|
|
871
|
+
/* @__PURE__ */ F(A, {
|
|
872
|
+
...V(w(n, t.low), w(n, t.q1)),
|
|
873
|
+
tone: t.tone
|
|
874
|
+
}),
|
|
875
|
+
/* @__PURE__ */ F(A, {
|
|
876
|
+
...V(w(n, t.q3), w(n, t.high)),
|
|
877
|
+
tone: t.tone
|
|
878
|
+
}),
|
|
879
|
+
/* @__PURE__ */ F(A, {
|
|
880
|
+
...V(w(n - S, t.low), w(n + S, t.low)),
|
|
881
|
+
tone: t.tone
|
|
882
|
+
}),
|
|
883
|
+
/* @__PURE__ */ F(A, {
|
|
884
|
+
...V(w(n - S, t.high), w(n + S, t.high)),
|
|
885
|
+
tone: t.tone
|
|
886
|
+
}),
|
|
887
|
+
/* @__PURE__ */ F(K, {
|
|
888
|
+
d: H([
|
|
889
|
+
w(n - b, t.q1),
|
|
890
|
+
w(n - b, t.q3),
|
|
891
|
+
w(n + b, t.q3),
|
|
892
|
+
w(n + b, t.q1)
|
|
893
|
+
]),
|
|
894
|
+
tone: t.tone,
|
|
895
|
+
fill: "soft",
|
|
896
|
+
isInspected: e.inspected === t.id
|
|
897
|
+
}),
|
|
898
|
+
/* @__PURE__ */ F(Te, {
|
|
899
|
+
...V(w(n - b, t.median), w(n + b, t.median)),
|
|
900
|
+
weight: "thin"
|
|
901
|
+
}),
|
|
902
|
+
[...new Set(t.outliers)].map((e) => /* @__PURE__ */ F(E, {
|
|
903
|
+
...w(n, e),
|
|
904
|
+
tone: t.tone,
|
|
905
|
+
radius: Ve,
|
|
906
|
+
isHollow: !0
|
|
907
|
+
}, `${t.id}:${e}`))
|
|
908
|
+
] }, t.id);
|
|
909
|
+
})
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
// packages/charts/src/distribution/ridgeline.tsx
|
|
913
|
+
var Ge = {
|
|
914
|
+
rows: 40,
|
|
915
|
+
densityPoints: 200
|
|
916
|
+
}, Ke = .5, qe = .5;
|
|
917
|
+
function Je(e) {
|
|
918
|
+
let { rows: t, value: n, overlap: r = Ke, densityLabel: i, height: o = "regular", ...c } = e, { emptyLabel: u = "No rows are available.", ...d } = c, { locale: f } = d, h = j(o), g = p(), _ = t.map((e) => ({
|
|
919
|
+
...e,
|
|
920
|
+
tone: g({
|
|
921
|
+
id: e.id,
|
|
922
|
+
tone: e.tone,
|
|
923
|
+
index: 0
|
|
924
|
+
})
|
|
925
|
+
}));
|
|
926
|
+
if (d.status === "loading") return /* @__PURE__ */ F(v, {
|
|
927
|
+
...d,
|
|
928
|
+
height: o
|
|
929
|
+
});
|
|
930
|
+
let y = n.domain ?? a({
|
|
931
|
+
values: t.flatMap((e) => e.density.map((e) => e.value)),
|
|
932
|
+
scale: n.scale
|
|
933
|
+
}), b = X({
|
|
934
|
+
records: t,
|
|
935
|
+
limit: Ge.rows,
|
|
936
|
+
noun: "rows",
|
|
937
|
+
domain: y,
|
|
938
|
+
scale: n.scale
|
|
939
|
+
}) ?? Le({
|
|
940
|
+
records: t,
|
|
941
|
+
domain: y,
|
|
942
|
+
limit: Ge.densityPoints
|
|
943
|
+
}) ?? Ye({
|
|
944
|
+
rows: t,
|
|
945
|
+
overlap: r
|
|
946
|
+
});
|
|
947
|
+
if (b !== void 0) return /* @__PURE__ */ F(x, {
|
|
948
|
+
...d,
|
|
949
|
+
message: b
|
|
950
|
+
});
|
|
951
|
+
let S = s({
|
|
952
|
+
width: h.width,
|
|
953
|
+
height: B({
|
|
954
|
+
height: o,
|
|
955
|
+
count: t.length
|
|
956
|
+
}),
|
|
957
|
+
direction: "rows",
|
|
958
|
+
categories: t,
|
|
959
|
+
value: n,
|
|
960
|
+
valueDomain: y,
|
|
961
|
+
locale: f,
|
|
962
|
+
padding: 0
|
|
963
|
+
}), { box: C } = S, w = C.innerHeight / (t.length + r), T = w * (1 + r) / Math.max(Z(t), Number.MIN_VALUE), E = _.map((e, t) => ({
|
|
964
|
+
...e,
|
|
965
|
+
baseline: C.top + (r + t + 1) * w
|
|
966
|
+
}));
|
|
967
|
+
function D(e) {
|
|
968
|
+
return m({
|
|
969
|
+
value: e,
|
|
970
|
+
locale: f,
|
|
971
|
+
format: n.format
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
let O = E.map((e) => {
|
|
975
|
+
let t = Re(e.density);
|
|
976
|
+
return {
|
|
977
|
+
id: e.id,
|
|
978
|
+
label: `${e.label} · Peak density at ${t === void 0 ? "unknown" : D(t.value)}`
|
|
979
|
+
};
|
|
980
|
+
});
|
|
981
|
+
return /* @__PURE__ */ F(J, {
|
|
982
|
+
frame: d,
|
|
983
|
+
emptyLabel: u,
|
|
984
|
+
size: h,
|
|
985
|
+
axes: {
|
|
986
|
+
box: C,
|
|
987
|
+
xTicks: S.valueTicks,
|
|
988
|
+
yTicks: E.map((e) => ({
|
|
989
|
+
key: e.id,
|
|
990
|
+
position: e.baseline,
|
|
991
|
+
label: e.label
|
|
992
|
+
})),
|
|
993
|
+
xTitle: l(n),
|
|
994
|
+
grid: "x"
|
|
995
|
+
},
|
|
996
|
+
items: O,
|
|
997
|
+
locate: M({
|
|
998
|
+
marks: E.map((e) => ({
|
|
999
|
+
id: e.id,
|
|
1000
|
+
x: 0,
|
|
1001
|
+
y: e.baseline - w * qe
|
|
1002
|
+
})),
|
|
1003
|
+
width: C.width,
|
|
1004
|
+
height: C.height,
|
|
1005
|
+
axis: "y"
|
|
1006
|
+
}),
|
|
1007
|
+
marksLabel: "rows",
|
|
1008
|
+
note: `Height shows ${i}. All ridges share one density scale. Later rows are drawn on top.`,
|
|
1009
|
+
cursor: (e) => {
|
|
1010
|
+
let t = E.find((t) => t.id === e);
|
|
1011
|
+
return t === void 0 ? null : /* @__PURE__ */ F(q, {
|
|
1012
|
+
x: C.left,
|
|
1013
|
+
y: t.baseline - w,
|
|
1014
|
+
width: C.innerWidth,
|
|
1015
|
+
height: w
|
|
1016
|
+
});
|
|
1017
|
+
},
|
|
1018
|
+
marks: (e) => E.map((t) => {
|
|
1019
|
+
let n = t.density[0], r = t.density.at(-1), i = t.density.map((e) => ({
|
|
1020
|
+
x: S.value.position(e.value),
|
|
1021
|
+
y: t.baseline - e.density * T
|
|
1022
|
+
}));
|
|
1023
|
+
return /* @__PURE__ */ F(K, {
|
|
1024
|
+
d: H([
|
|
1025
|
+
{
|
|
1026
|
+
x: S.value.position(n?.value ?? y[0]),
|
|
1027
|
+
y: t.baseline
|
|
1028
|
+
},
|
|
1029
|
+
...i,
|
|
1030
|
+
{
|
|
1031
|
+
x: S.value.position(r?.value ?? y[1]),
|
|
1032
|
+
y: t.baseline
|
|
1033
|
+
}
|
|
1034
|
+
]),
|
|
1035
|
+
tone: t.tone,
|
|
1036
|
+
fill: "strong",
|
|
1037
|
+
isInspected: e.inspected === t.id
|
|
1038
|
+
}, t.id);
|
|
1039
|
+
})
|
|
1040
|
+
});
|
|
1041
|
+
}
|
|
1042
|
+
function Ye({ rows: e, overlap: t }) {
|
|
1043
|
+
if (!Number.isFinite(t) || t < 0 || t > 1) return "Overlap must be a number from 0 to 1.";
|
|
1044
|
+
if (e.length > 0 && Z(e) === 0) return "Every density is zero, so no ridge has a height.";
|
|
1045
|
+
}
|
|
1046
|
+
// packages/charts/src/distribution/strip-plot.tsx
|
|
1047
|
+
var $ = {
|
|
1048
|
+
points: 2e3,
|
|
1049
|
+
groups: 24
|
|
1050
|
+
}, Xe = 3.5, Ze = .8, Qe = .45;
|
|
1051
|
+
function $e({ groups: e, points: t, summary: r, domain: i, value: a }) {
|
|
1052
|
+
let o = X({
|
|
1053
|
+
records: e,
|
|
1054
|
+
limit: $.groups,
|
|
1055
|
+
noun: "groups",
|
|
1056
|
+
domain: i,
|
|
1057
|
+
scale: a.scale
|
|
1058
|
+
});
|
|
1059
|
+
if (o !== void 0) return o;
|
|
1060
|
+
if (!n(t)) return "Each point needs a unique identifier.";
|
|
1061
|
+
if (t.length > $.points) return `This chart draws at most ${$.points} points. Supply a sample or a window.`;
|
|
1062
|
+
let s = new Set(e.map((e) => e.id)), c = t.find((e) => !s.has(e.groupId));
|
|
1063
|
+
if (c !== void 0) return `Point ${c.id} names a group, ${c.groupId}, that is not in the chart.`;
|
|
1064
|
+
if (t.some((e) => h(e.value, i))) return "A point has a value that is not finite or lies outside the declared domain.";
|
|
1065
|
+
if (Object.entries(r ?? {}).some(([e, t]) => !s.has(e) || h(t, i))) return "A summary names an unknown group or lies outside the declared domain.";
|
|
1066
|
+
}
|
|
1067
|
+
function et(e) {
|
|
1068
|
+
let { groups: t, points: n, value: r, summary: i, summaryLabel: o = "Summary", height: s = "regular", selected: c, onSelectedChange: l, ...u } = e, { emptyLabel: d = "No observations are available.", ...f } = u, { locale: p } = f, h = j(s), g = G(t);
|
|
1069
|
+
if (f.status === "loading") return /* @__PURE__ */ F(v, {
|
|
1070
|
+
...f,
|
|
1071
|
+
height: s
|
|
1072
|
+
});
|
|
1073
|
+
let _ = r.domain ?? a({
|
|
1074
|
+
values: [...n.map((e) => e.value), ...Object.values(i ?? {})],
|
|
1075
|
+
scale: r.scale
|
|
1076
|
+
}), y = $e({
|
|
1077
|
+
groups: t,
|
|
1078
|
+
points: n,
|
|
1079
|
+
summary: i,
|
|
1080
|
+
domain: _,
|
|
1081
|
+
value: r
|
|
1082
|
+
});
|
|
1083
|
+
if (y !== void 0) return /* @__PURE__ */ F(x, {
|
|
1084
|
+
...f,
|
|
1085
|
+
message: y
|
|
1086
|
+
});
|
|
1087
|
+
let b = U({
|
|
1088
|
+
width: h.width,
|
|
1089
|
+
height: h.height,
|
|
1090
|
+
direction: "columns",
|
|
1091
|
+
groups: g,
|
|
1092
|
+
value: r,
|
|
1093
|
+
valueDomain: _,
|
|
1094
|
+
locale: p
|
|
1095
|
+
}), { orient: S, placed: C } = b;
|
|
1096
|
+
function w(e) {
|
|
1097
|
+
return m({
|
|
1098
|
+
value: e,
|
|
1099
|
+
locale: p,
|
|
1100
|
+
format: r.format
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
let T = C.flatMap((e) => n.filter((t) => t.groupId === e.id).map((t, n) => ({
|
|
1104
|
+
...t,
|
|
1105
|
+
group: e,
|
|
1106
|
+
...S.point(e.center + be(n) * b.bandwidth * Ze, b.value.position(t.value))
|
|
1107
|
+
}))), D = T.map((e) => {
|
|
1108
|
+
let t = i?.[e.group.id], n = [
|
|
1109
|
+
e.label ?? e.id,
|
|
1110
|
+
e.group.label,
|
|
1111
|
+
`${r.label} ${w(e.value)}`,
|
|
1112
|
+
...t === void 0 ? [] : [`${o} for the group ${w(t)}`]
|
|
1113
|
+
];
|
|
1114
|
+
return {
|
|
1115
|
+
id: e.id,
|
|
1116
|
+
label: n.join(" · ")
|
|
1117
|
+
};
|
|
1118
|
+
}), O = new Map(T.map((e) => [e.id, {
|
|
1119
|
+
left: e.x,
|
|
1120
|
+
top: e.y,
|
|
1121
|
+
right: e.x,
|
|
1122
|
+
bottom: e.y
|
|
1123
|
+
}])), k = b.bandwidth * Qe;
|
|
1124
|
+
return /* @__PURE__ */ F(J, {
|
|
1125
|
+
frame: f,
|
|
1126
|
+
emptyLabel: d,
|
|
1127
|
+
size: h,
|
|
1128
|
+
axes: b,
|
|
1129
|
+
items: D,
|
|
1130
|
+
locate: M({
|
|
1131
|
+
marks: T,
|
|
1132
|
+
width: b.box.width,
|
|
1133
|
+
height: b.box.height
|
|
1134
|
+
}),
|
|
1135
|
+
place: (e) => O.get(e),
|
|
1136
|
+
selected: c,
|
|
1137
|
+
onSelectedChange: l,
|
|
1138
|
+
marksLabel: "points",
|
|
1139
|
+
note: i === void 0 ? "Each dot is one observation. Dots are translucent, so overlaps look darker." : `Each dot is one observation. The ink tick in each group is its ${o.toLowerCase()}.`,
|
|
1140
|
+
cursor: (e) => {
|
|
1141
|
+
let t = T.find((t) => t.id === e);
|
|
1142
|
+
return t === void 0 ? null : /* @__PURE__ */ F(De, {
|
|
1143
|
+
x: t.x,
|
|
1144
|
+
y: t.y,
|
|
1145
|
+
radius: Xe
|
|
1146
|
+
});
|
|
1147
|
+
},
|
|
1148
|
+
marks: (e) => /* @__PURE__ */ I(P, { children: [
|
|
1149
|
+
/* @__PURE__ */ F("g", {
|
|
1150
|
+
className: "x197sbye",
|
|
1151
|
+
children: T.map((e) => /* @__PURE__ */ F(E, {
|
|
1152
|
+
x: e.x,
|
|
1153
|
+
y: e.y,
|
|
1154
|
+
tone: e.group.tone,
|
|
1155
|
+
radius: Xe
|
|
1156
|
+
}, e.id))
|
|
1157
|
+
}),
|
|
1158
|
+
C.map((e) => {
|
|
1159
|
+
let t = i?.[e.id];
|
|
1160
|
+
return t === void 0 ? null : /* @__PURE__ */ F(Te, {
|
|
1161
|
+
...V(S.point(e.center - k, b.value.position(t)), S.point(e.center + k, b.value.position(t))),
|
|
1162
|
+
weight: "thin"
|
|
1163
|
+
}, e.id);
|
|
1164
|
+
}),
|
|
1165
|
+
T.filter((t) => t.id === e.inspected || t.id === e.selected).map((t) => /* @__PURE__ */ F(E, {
|
|
1166
|
+
x: t.x,
|
|
1167
|
+
y: t.y,
|
|
1168
|
+
tone: t.group.tone,
|
|
1169
|
+
radius: Xe,
|
|
1170
|
+
isInspected: t.id === e.inspected,
|
|
1171
|
+
isSelected: t.id === e.selected
|
|
1172
|
+
}, t.id))
|
|
1173
|
+
] })
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
// packages/charts/src/distribution/violin-plot.tsx
|
|
1177
|
+
var tt = {
|
|
1178
|
+
groups: 24,
|
|
1179
|
+
densityPoints: 200
|
|
1180
|
+
}, nt = 96, rt = .5;
|
|
1181
|
+
function it(e) {
|
|
1182
|
+
return [
|
|
1183
|
+
e.q1,
|
|
1184
|
+
e.median,
|
|
1185
|
+
e.q3
|
|
1186
|
+
].filter((e) => e !== void 0);
|
|
1187
|
+
}
|
|
1188
|
+
function at({ groups: e, domain: t, value: n }) {
|
|
1189
|
+
let r = X({
|
|
1190
|
+
records: e,
|
|
1191
|
+
limit: tt.groups,
|
|
1192
|
+
noun: "groups",
|
|
1193
|
+
domain: t,
|
|
1194
|
+
scale: n.scale
|
|
1195
|
+
}), i = Le({
|
|
1196
|
+
records: e,
|
|
1197
|
+
domain: t,
|
|
1198
|
+
limit: tt.densityPoints
|
|
1199
|
+
});
|
|
1200
|
+
if (r !== void 0 || i !== void 0) return r ?? i;
|
|
1201
|
+
if (e.length > 0 && Z(e) === 0) return "Every density is zero, so no violin has a width.";
|
|
1202
|
+
for (let n of e) {
|
|
1203
|
+
let e = it(n);
|
|
1204
|
+
if (n.q1 === void 0 != (n.q3 === void 0)) return `Group ${n.id} has one quartile. Supply both quartiles or neither.`;
|
|
1205
|
+
if (e.some((e) => h(e, t))) return `Group ${n.id} has a median or quartile that is not finite or lies outside the declared domain.`;
|
|
1206
|
+
if (e.some((t, n) => n > 0 && t < (e[n - 1] ?? 0))) return `Group ${n.id} needs q1 ≤ median ≤ q3.`;
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
function ot(e) {
|
|
1210
|
+
let { groups: t, value: n, densityLabel: r, height: i = "regular", ...o } = e, { emptyLabel: s = "No groups are available.", ...c } = o, { locale: l } = c, u = j(i), d = G(t);
|
|
1211
|
+
if (c.status === "loading") return /* @__PURE__ */ F(v, {
|
|
1212
|
+
...c,
|
|
1213
|
+
height: i
|
|
1214
|
+
});
|
|
1215
|
+
let f = n.domain ?? a({
|
|
1216
|
+
values: t.flatMap((e) => [...e.density.map((e) => e.value), ...it(e)]),
|
|
1217
|
+
scale: n.scale
|
|
1218
|
+
}), p = at({
|
|
1219
|
+
groups: t,
|
|
1220
|
+
value: n,
|
|
1221
|
+
domain: f
|
|
1222
|
+
});
|
|
1223
|
+
if (p !== void 0) return /* @__PURE__ */ F(x, {
|
|
1224
|
+
...c,
|
|
1225
|
+
message: p
|
|
1226
|
+
});
|
|
1227
|
+
let h = U({
|
|
1228
|
+
width: u.width,
|
|
1229
|
+
height: u.height,
|
|
1230
|
+
direction: "columns",
|
|
1231
|
+
groups: d,
|
|
1232
|
+
value: n,
|
|
1233
|
+
valueDomain: f,
|
|
1234
|
+
locale: l
|
|
1235
|
+
}), { orient: g, placed: _ } = h, y = Math.min(h.bandwidth, nt) / 2, b = Z(t);
|
|
1236
|
+
function S(e) {
|
|
1237
|
+
return m({
|
|
1238
|
+
value: e,
|
|
1239
|
+
locale: l,
|
|
1240
|
+
format: n.format
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
function C(e) {
|
|
1244
|
+
return y * e.density / b >= rt;
|
|
1245
|
+
}
|
|
1246
|
+
function w(e, t) {
|
|
1247
|
+
return g.point(e, h.value.position(t));
|
|
1248
|
+
}
|
|
1249
|
+
let T = _.map((e) => {
|
|
1250
|
+
let t = e.median === void 0 ? "Median not supplied" : `Median ${S(e.median)}`, n = e.q1 === void 0 || e.q3 === void 0 ? "Quartiles not supplied" : `Quartiles ${S(e.q1)} – ${S(e.q3)}`;
|
|
1251
|
+
return {
|
|
1252
|
+
id: e.id,
|
|
1253
|
+
label: [
|
|
1254
|
+
e.label,
|
|
1255
|
+
t,
|
|
1256
|
+
n
|
|
1257
|
+
].join(" · ")
|
|
1258
|
+
};
|
|
1259
|
+
});
|
|
1260
|
+
return /* @__PURE__ */ F(J, {
|
|
1261
|
+
frame: c,
|
|
1262
|
+
emptyLabel: s,
|
|
1263
|
+
size: u,
|
|
1264
|
+
axes: h,
|
|
1265
|
+
items: T,
|
|
1266
|
+
locate: h.locate,
|
|
1267
|
+
marksLabel: "groups",
|
|
1268
|
+
note: `Width shows ${r}. All violins share one density scale.`,
|
|
1269
|
+
cursor: (e) => {
|
|
1270
|
+
let t = _.find((t) => t.id === e);
|
|
1271
|
+
return t === void 0 ? null : /* @__PURE__ */ F(q, { ...h.slot(t.center) });
|
|
1272
|
+
},
|
|
1273
|
+
marks: (e) => _.map((t) => {
|
|
1274
|
+
let { center: n } = t, r = t.density.findIndex(C), i = t.density.findLastIndex(C), a = t.density.slice(Math.max(0, r - 1), i + 2), o = a.map((e) => w(n + y * e.density / b, e.value)), s = a.map((e) => w(n - y * e.density / b, e.value));
|
|
1275
|
+
return /* @__PURE__ */ I("g", { children: [
|
|
1276
|
+
r !== -1 && /* @__PURE__ */ F(K, {
|
|
1277
|
+
d: H([...o, ...s.toReversed()]),
|
|
1278
|
+
tone: t.tone,
|
|
1279
|
+
fill: "strong",
|
|
1280
|
+
isInspected: e.inspected === t.id
|
|
1281
|
+
}),
|
|
1282
|
+
t.q1 !== void 0 && t.q3 !== void 0 && /* @__PURE__ */ F(Te, {
|
|
1283
|
+
...V(w(n, t.q1), w(n, t.q3)),
|
|
1284
|
+
weight: "thick"
|
|
1285
|
+
}),
|
|
1286
|
+
t.median !== void 0 && /* @__PURE__ */ F(Ee, { ...w(n, t.median) })
|
|
1287
|
+
] }, t.id);
|
|
1288
|
+
})
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
export { Je as a, Q as c, he as d, ue as f, $ as i, Pe as l, tt as n, Ge as o, L as p, et as r, We as s, ot as t, Ae as u };
|