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