@ggts-sh/svelte 0.43.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/LICENSE +21 -0
- package/README.md +97 -0
- package/bin/ggts-codemod.js +47 -0
- package/dist/GGPlot.svelte +491 -0
- package/dist/GGPlot.svelte.d.ts +67 -0
- package/dist/a11y/CanvasA11y.svelte +115 -0
- package/dist/a11y/CanvasA11y.svelte.d.ts +15 -0
- package/dist/a11y/canvas-a11y.d.ts +1 -0
- package/dist/a11y/canvas-a11y.js +2 -0
- package/dist/assembly/assemble.d.ts +1 -0
- package/dist/assembly/assemble.js +1 -0
- package/dist/assembly/labels.d.ts +43 -0
- package/dist/assembly/labels.js +126 -0
- package/dist/assembly/layout.d.ts +158 -0
- package/dist/assembly/layout.js +175 -0
- package/dist/chrome/StatusChrome.svelte +125 -0
- package/dist/chrome/StatusChrome.svelte.d.ts +16 -0
- package/dist/chrome/ToolRail.svelte +293 -0
- package/dist/chrome/ToolRail.svelte.d.ts +26 -0
- package/dist/chrome/chrome-state.svelte.d.ts +63 -0
- package/dist/chrome/chrome-state.svelte.js +158 -0
- package/dist/chrome/theme-css.d.ts +16 -0
- package/dist/chrome/theme-css.js +16 -0
- package/dist/codemod/cli.d.ts +16 -0
- package/dist/codemod/cli.js +150 -0
- package/dist/codemod/edits.d.ts +28 -0
- package/dist/codemod/edits.js +36 -0
- package/dist/codemod/index.d.ts +10 -0
- package/dist/codemod/index.js +10 -0
- package/dist/codemod/migrate-plot-props-rewrite.d.ts +86 -0
- package/dist/codemod/migrate-plot-props-rewrite.js +228 -0
- package/dist/codemod/migrate-plot-props.d.ts +38 -0
- package/dist/codemod/migrate-plot-props.js +159 -0
- package/dist/coord/Coord.svelte +21 -0
- package/dist/coord/Coord.svelte.d.ts +16 -0
- package/dist/coord/CoordCartesian.svelte +11 -0
- package/dist/coord/CoordCartesian.svelte.d.ts +18 -0
- package/dist/coord/CoordFixed.svelte +17 -0
- package/dist/coord/CoordFixed.svelte.d.ts +10 -0
- package/dist/coord/CoordFlip.svelte +11 -0
- package/dist/coord/CoordFlip.svelte.d.ts +18 -0
- package/dist/coord/CoordPolar.svelte +16 -0
- package/dist/coord/CoordPolar.svelte.d.ts +9 -0
- package/dist/coord/CoordRadial.svelte +16 -0
- package/dist/coord/CoordRadial.svelte.d.ts +9 -0
- package/dist/coord/CoordSf.svelte +16 -0
- package/dist/coord/CoordSf.svelte.d.ts +9 -0
- package/dist/coord/CoordTransform.svelte +16 -0
- package/dist/coord/CoordTransform.svelte.d.ts +9 -0
- package/dist/data/index.d.ts +1 -0
- package/dist/data/index.js +2 -0
- package/dist/diagnostics/composition.d.ts +112 -0
- package/dist/diagnostics/composition.js +203 -0
- package/dist/diagnostics/deprecation.d.ts +58 -0
- package/dist/diagnostics/deprecation.js +27 -0
- package/dist/diagnostics/plot-engine-diagnostics.svelte.d.ts +44 -0
- package/dist/diagnostics/plot-engine-diagnostics.svelte.js +193 -0
- package/dist/facet/Facet.svelte +23 -0
- package/dist/facet/Facet.svelte.d.ts +16 -0
- package/dist/facet/FacetGrid.svelte +32 -0
- package/dist/facet/FacetGrid.svelte.d.ts +16 -0
- package/dist/facet/FacetWrap.svelte +32 -0
- package/dist/facet/FacetWrap.svelte.d.ts +16 -0
- package/dist/fonts/RobotoCondensed-Bold.ttf +0 -0
- package/dist/fonts/RobotoCondensed-Light.ttf +0 -0
- package/dist/fonts/RobotoCondensed-Regular.ttf +0 -0
- package/dist/fonts/THIRD_PARTY_NOTICES.txt +416 -0
- package/dist/geoms/GeomAbline.svelte +25 -0
- package/dist/geoms/GeomAbline.svelte.d.ts +7 -0
- package/dist/geoms/GeomArea.svelte +12 -0
- package/dist/geoms/GeomArea.svelte.d.ts +7 -0
- package/dist/geoms/GeomBar.svelte +12 -0
- package/dist/geoms/GeomBar.svelte.d.ts +7 -0
- package/dist/geoms/GeomBin2d.svelte +21 -0
- package/dist/geoms/GeomBin2d.svelte.d.ts +7 -0
- package/dist/geoms/GeomBlank.svelte +12 -0
- package/dist/geoms/GeomBlank.svelte.d.ts +7 -0
- package/dist/geoms/GeomBoxplot.svelte +25 -0
- package/dist/geoms/GeomBoxplot.svelte.d.ts +7 -0
- package/dist/geoms/GeomCol.svelte +12 -0
- package/dist/geoms/GeomCol.svelte.d.ts +7 -0
- package/dist/geoms/GeomContour.svelte +25 -0
- package/dist/geoms/GeomContour.svelte.d.ts +7 -0
- package/dist/geoms/GeomCount.svelte +12 -0
- package/dist/geoms/GeomCount.svelte.d.ts +7 -0
- package/dist/geoms/GeomCrossbar.svelte +25 -0
- package/dist/geoms/GeomCrossbar.svelte.d.ts +7 -0
- package/dist/geoms/GeomCurve.svelte +21 -0
- package/dist/geoms/GeomCurve.svelte.d.ts +7 -0
- package/dist/geoms/GeomDensity.svelte +25 -0
- package/dist/geoms/GeomDensity.svelte.d.ts +7 -0
- package/dist/geoms/GeomDensity2d.svelte +25 -0
- package/dist/geoms/GeomDensity2d.svelte.d.ts +7 -0
- package/dist/geoms/GeomDensity2dFilled.svelte +25 -0
- package/dist/geoms/GeomDensity2dFilled.svelte.d.ts +7 -0
- package/dist/geoms/GeomDotplot.svelte +25 -0
- package/dist/geoms/GeomDotplot.svelte.d.ts +7 -0
- package/dist/geoms/GeomErrorbar.svelte +25 -0
- package/dist/geoms/GeomErrorbar.svelte.d.ts +7 -0
- package/dist/geoms/GeomFreqpoly.svelte +25 -0
- package/dist/geoms/GeomFreqpoly.svelte.d.ts +7 -0
- package/dist/geoms/GeomFunction.svelte +25 -0
- package/dist/geoms/GeomFunction.svelte.d.ts +7 -0
- package/dist/geoms/GeomHex.svelte +21 -0
- package/dist/geoms/GeomHex.svelte.d.ts +7 -0
- package/dist/geoms/GeomHistogram.svelte +25 -0
- package/dist/geoms/GeomHistogram.svelte.d.ts +7 -0
- package/dist/geoms/GeomHline.svelte +12 -0
- package/dist/geoms/GeomHline.svelte.d.ts +7 -0
- package/dist/geoms/GeomJitter.svelte +35 -0
- package/dist/geoms/GeomJitter.svelte.d.ts +13 -0
- package/dist/geoms/GeomLabel.svelte +12 -0
- package/dist/geoms/GeomLabel.svelte.d.ts +7 -0
- package/dist/geoms/GeomLine.svelte +12 -0
- package/dist/geoms/GeomLine.svelte.d.ts +7 -0
- package/dist/geoms/GeomLinerange.svelte +25 -0
- package/dist/geoms/GeomLinerange.svelte.d.ts +7 -0
- package/dist/geoms/GeomMap.svelte +21 -0
- package/dist/geoms/GeomMap.svelte.d.ts +7 -0
- package/dist/geoms/GeomPath.svelte +12 -0
- package/dist/geoms/GeomPath.svelte.d.ts +7 -0
- package/dist/geoms/GeomPoint.svelte +12 -0
- package/dist/geoms/GeomPoint.svelte.d.ts +7 -0
- package/dist/geoms/GeomPointrange.svelte +25 -0
- package/dist/geoms/GeomPointrange.svelte.d.ts +7 -0
- package/dist/geoms/GeomPolygon.svelte +25 -0
- package/dist/geoms/GeomPolygon.svelte.d.ts +7 -0
- package/dist/geoms/GeomQq.svelte +21 -0
- package/dist/geoms/GeomQq.svelte.d.ts +7 -0
- package/dist/geoms/GeomQqLine.svelte +25 -0
- package/dist/geoms/GeomQqLine.svelte.d.ts +7 -0
- package/dist/geoms/GeomQuantile.svelte +25 -0
- package/dist/geoms/GeomQuantile.svelte.d.ts +7 -0
- package/dist/geoms/GeomRaster.svelte +25 -0
- package/dist/geoms/GeomRaster.svelte.d.ts +7 -0
- package/dist/geoms/GeomRect.svelte +12 -0
- package/dist/geoms/GeomRect.svelte.d.ts +7 -0
- package/dist/geoms/GeomRibbon.svelte +16 -0
- package/dist/geoms/GeomRibbon.svelte.d.ts +7 -0
- package/dist/geoms/GeomRug.svelte +21 -0
- package/dist/geoms/GeomRug.svelte.d.ts +7 -0
- package/dist/geoms/GeomRule.svelte +12 -0
- package/dist/geoms/GeomRule.svelte.d.ts +7 -0
- package/dist/geoms/GeomSegment.svelte +16 -0
- package/dist/geoms/GeomSegment.svelte.d.ts +7 -0
- package/dist/geoms/GeomSf.svelte +21 -0
- package/dist/geoms/GeomSf.svelte.d.ts +7 -0
- package/dist/geoms/GeomSfLabel.svelte +25 -0
- package/dist/geoms/GeomSfLabel.svelte.d.ts +7 -0
- package/dist/geoms/GeomSfText.svelte +25 -0
- package/dist/geoms/GeomSfText.svelte.d.ts +7 -0
- package/dist/geoms/GeomSmooth.svelte +25 -0
- package/dist/geoms/GeomSmooth.svelte.d.ts +7 -0
- package/dist/geoms/GeomSpoke.svelte +21 -0
- package/dist/geoms/GeomSpoke.svelte.d.ts +7 -0
- package/dist/geoms/GeomStep.svelte +12 -0
- package/dist/geoms/GeomStep.svelte.d.ts +7 -0
- package/dist/geoms/GeomText.svelte +12 -0
- package/dist/geoms/GeomText.svelte.d.ts +7 -0
- package/dist/geoms/GeomTile.svelte +21 -0
- package/dist/geoms/GeomTile.svelte.d.ts +7 -0
- package/dist/geoms/GeomViolin.svelte +25 -0
- package/dist/geoms/GeomViolin.svelte.d.ts +7 -0
- package/dist/geoms/GeomVline.svelte +12 -0
- package/dist/geoms/GeomVline.svelte.d.ts +7 -0
- package/dist/geoms/factory.svelte.d.ts +41 -0
- package/dist/geoms/factory.svelte.js +60 -0
- package/dist/geoms/registry.svelte.d.ts +71 -0
- package/dist/geoms/registry.svelte.js +177 -0
- package/dist/guides/GuideAxis.svelte +20 -0
- package/dist/guides/GuideAxis.svelte.d.ts +14 -0
- package/dist/guides/GuideColorbar.svelte +22 -0
- package/dist/guides/GuideColorbar.svelte.d.ts +13 -0
- package/dist/guides/GuideColorsteps.svelte +22 -0
- package/dist/guides/GuideColorsteps.svelte.d.ts +13 -0
- package/dist/guides/GuideLegend.svelte +90 -0
- package/dist/guides/GuideLegend.svelte.d.ts +37 -0
- package/dist/guides/GuideNone.svelte +19 -0
- package/dist/guides/GuideNone.svelte.d.ts +7 -0
- package/dist/guides/Guides.svelte +14 -0
- package/dist/guides/Guides.svelte.d.ts +13 -0
- package/dist/guides/factory.svelte.d.ts +36 -0
- package/dist/guides/factory.svelte.js +15 -0
- package/dist/index.d.ts +418 -0
- package/dist/index.js +376 -0
- package/dist/inspection/Inspect.svelte +71 -0
- package/dist/inspection/Inspect.svelte.d.ts +36 -0
- package/dist/inspection/Tooltip.svelte +439 -0
- package/dist/inspection/Tooltip.svelte.d.ts +32 -0
- package/dist/inspection/apply.d.ts +120 -0
- package/dist/inspection/apply.js +99 -0
- package/dist/inspection/coordinator.d.ts +51 -0
- package/dist/inspection/coordinator.js +354 -0
- package/dist/inspection/display-members.d.ts +1 -0
- package/dist/inspection/display-members.js +2 -0
- package/dist/inspection/frame.d.ts +90 -0
- package/dist/inspection/frame.js +76 -0
- package/dist/inspection/group-total.d.ts +1 -0
- package/dist/inspection/group-total.js +2 -0
- package/dist/inspection/inspect-guide-axes.d.ts +10 -0
- package/dist/inspection/inspect-guide-axes.js +24 -0
- package/dist/inspection/inspection-reconcile.svelte.d.ts +37 -0
- package/dist/inspection/inspection-reconcile.svelte.js +33 -0
- package/dist/inspection/inspection-state.svelte.d.ts +86 -0
- package/dist/inspection/inspection-state.svelte.js +347 -0
- package/dist/inspection/inspection-traversal.svelte.d.ts +29 -0
- package/dist/inspection/inspection-traversal.svelte.js +52 -0
- package/dist/inspection/pointer-inspect.d.ts +74 -0
- package/dist/inspection/pointer-inspect.js +158 -0
- package/dist/inspection/resolver.d.ts +3 -0
- package/dist/inspection/resolver.js +4 -0
- package/dist/inspection/teardown.d.ts +199 -0
- package/dist/inspection/teardown.js +181 -0
- package/dist/inspection/tooltip-chrome.d.ts +19 -0
- package/dist/inspection/tooltip-chrome.js +17 -0
- package/dist/inspection/tooltip-motion.d.ts +25 -0
- package/dist/inspection/tooltip-motion.js +32 -0
- package/dist/inspection/tooltip-presence.svelte.d.ts +49 -0
- package/dist/inspection/tooltip-presence.svelte.js +110 -0
- package/dist/inspection/tooltip-total.d.ts +1 -0
- package/dist/inspection/tooltip-total.js +2 -0
- package/dist/interaction/capability-resolution.svelte.d.ts +42 -0
- package/dist/interaction/capability-resolution.svelte.js +40 -0
- package/dist/interaction/capability.d.ts +129 -0
- package/dist/interaction/capability.js +134 -0
- package/dist/interaction/controller.svelte.d.ts +4 -0
- package/dist/interaction/controller.svelte.js +43 -0
- package/dist/interaction/inspect-geom-advisories.d.ts +10 -0
- package/dist/interaction/inspect-geom-advisories.js +10 -0
- package/dist/interaction/interaction-context.svelte.d.ts +57 -0
- package/dist/interaction/interaction-context.svelte.js +4 -0
- package/dist/interaction/interaction-diagnostics.d.ts +11 -0
- package/dist/interaction/interaction-diagnostics.js +173 -0
- package/dist/interaction/interaction-states.svelte.d.ts +84 -0
- package/dist/interaction/interaction-states.svelte.js +55 -0
- package/dist/interaction/interaction.d.ts +304 -0
- package/dist/interaction/interaction.js +7 -0
- package/dist/interaction/normalize-interaction-config.d.ts +9 -0
- package/dist/interaction/normalize-interaction-config.js +112 -0
- package/dist/interaction/reducer.d.ts +97 -0
- package/dist/interaction/reducer.js +117 -0
- package/dist/interaction/resolve-inspect-capability.d.ts +40 -0
- package/dist/interaction/resolve-inspect-capability.js +50 -0
- package/dist/interaction/scoped-store.svelte.d.ts +73 -0
- package/dist/interaction/scoped-store.svelte.js +93 -0
- package/dist/interaction/target.d.ts +91 -0
- package/dist/interaction/target.js +68 -0
- package/dist/interaction/transition-owner.d.ts +19 -0
- package/dist/interaction/transition-owner.js +10 -0
- package/dist/interaction/wiring-advisories.d.ts +33 -0
- package/dist/interaction/wiring-advisories.js +46 -0
- package/dist/interval/BoundsEditor.svelte +332 -0
- package/dist/interval/BoundsEditor.svelte.d.ts +10 -0
- package/dist/interval/bounds-editor.d.ts +1 -0
- package/dist/interval/bounds-editor.js +2 -0
- package/dist/interval/consumption.d.ts +1 -0
- package/dist/interval/consumption.js +2 -0
- package/dist/interval/interval-bounds-state.svelte.d.ts +53 -0
- package/dist/interval/interval-bounds-state.svelte.js +117 -0
- package/dist/interval/interval-state-helpers.d.ts +10 -0
- package/dist/interval/interval-state-helpers.js +34 -0
- package/dist/interval/interval-state.svelte.d.ts +60 -0
- package/dist/interval/interval-state.svelte.js +360 -0
- package/dist/interval/interval.d.ts +1 -0
- package/dist/interval/interval.js +2 -0
- package/dist/interval/precise-bounds.d.ts +1 -0
- package/dist/interval/precise-bounds.js +2 -0
- package/dist/interval/query.d.ts +1 -0
- package/dist/interval/query.js +2 -0
- package/dist/labs/Labs.svelte +29 -0
- package/dist/labs/Labs.svelte.d.ts +16 -0
- package/dist/layers/fold.d.ts +2 -0
- package/dist/layers/fold.js +1 -0
- package/dist/layers/grammar-families.d.ts +2 -0
- package/dist/layers/grammar-families.js +1 -0
- package/dist/layers/plot-layer-contract.d.ts +1 -0
- package/dist/layers/plot-layer-contract.js +29 -0
- package/dist/layers/plot-layer.svelte.d.ts +42 -0
- package/dist/layers/plot-layer.svelte.js +34 -0
- package/dist/layers/types.d.ts +2 -0
- package/dist/layers/types.js +1 -0
- package/dist/legend/Legend.svelte +24 -0
- package/dist/legend/Legend.svelte.d.ts +5 -0
- package/dist/legend/LegendFilters.svelte +196 -0
- package/dist/legend/LegendFilters.svelte.d.ts +8 -0
- package/dist/legend/LegendTargets.svelte +393 -0
- package/dist/legend/LegendTargets.svelte.d.ts +31 -0
- package/dist/legend/entry-key-index.d.ts +1 -0
- package/dist/legend/entry-key-index.js +2 -0
- package/dist/legend/entry-key-index.svelte.d.ts +34 -0
- package/dist/legend/entry-key-index.svelte.js +35 -0
- package/dist/legend/filter-state.svelte.d.ts +66 -0
- package/dist/legend/filter-state.svelte.js +284 -0
- package/dist/legend/filter.d.ts +1 -0
- package/dist/legend/filter.js +2 -0
- package/dist/legend/focus-emphasis.d.ts +72 -0
- package/dist/legend/focus-emphasis.js +91 -0
- package/dist/legend/focus-plans.d.ts +89 -0
- package/dist/legend/focus-plans.js +72 -0
- package/dist/legend/focus-reconcile.svelte.d.ts +53 -0
- package/dist/legend/focus-reconcile.svelte.js +113 -0
- package/dist/legend/focus-state.svelte.d.ts +73 -0
- package/dist/legend/focus-state.svelte.js +338 -0
- package/dist/legend/focus.d.ts +1 -0
- package/dist/legend/focus.js +2 -0
- package/dist/legend/resolve-legend-capability.d.ts +52 -0
- package/dist/legend/resolve-legend-capability.js +68 -0
- package/dist/legend/resolve-legend-filter.d.ts +65 -0
- package/dist/legend/resolve-legend-filter.js +54 -0
- package/dist/legend/resolve-legend-focus.d.ts +58 -0
- package/dist/legend/resolve-legend-focus.js +36 -0
- package/dist/legend/surface.d.ts +190 -0
- package/dist/legend/surface.js +158 -0
- package/dist/plot-engine-deriveds.svelte.d.ts +75 -0
- package/dist/plot-engine-deriveds.svelte.js +166 -0
- package/dist/plot-engine.svelte.d.ts +116 -0
- package/dist/plot-engine.svelte.js +316 -0
- package/dist/plot-props.d.ts +144 -0
- package/dist/plot-props.js +81 -0
- package/dist/runtime/announcer.svelte.d.ts +17 -0
- package/dist/runtime/announcer.svelte.js +28 -0
- package/dist/runtime/paint.d.ts +38 -0
- package/dist/runtime/paint.js +45 -0
- package/dist/runtime/resolve-datum-key.d.ts +53 -0
- package/dist/runtime/resolve-datum-key.js +73 -0
- package/dist/runtime/runtime.svelte.d.ts +37 -0
- package/dist/runtime/runtime.svelte.js +233 -0
- package/dist/runtime/semantic-candidate-projection.svelte.d.ts +29 -0
- package/dist/runtime/semantic-candidate-projection.svelte.js +137 -0
- package/dist/runtime/semantic-data-identity.d.ts +64 -0
- package/dist/runtime/semantic-data-identity.js +153 -0
- package/dist/runtime/semantic-keys-projection.d.ts +22 -0
- package/dist/runtime/semantic-keys-projection.js +40 -0
- package/dist/runtime/semantic-keys-resolve.d.ts +69 -0
- package/dist/runtime/semantic-keys-resolve.js +122 -0
- package/dist/runtime/semantic-keys.svelte.d.ts +30 -0
- package/dist/runtime/semantic-keys.svelte.js +69 -0
- package/dist/runtime/semantic-source-identity.d.ts +9 -0
- package/dist/runtime/semantic-source-identity.js +16 -0
- package/dist/scale/Scale.svelte +26 -0
- package/dist/scale/Scale.svelte.d.ts +21 -0
- package/dist/scale/ScaleAlphaBinned.svelte +14 -0
- package/dist/scale/ScaleAlphaBinned.svelte.d.ts +4 -0
- package/dist/scale/ScaleAlphaContinuous.svelte +14 -0
- package/dist/scale/ScaleAlphaContinuous.svelte.d.ts +4 -0
- package/dist/scale/ScaleAlphaDate.svelte +15 -0
- package/dist/scale/ScaleAlphaDate.svelte.d.ts +5 -0
- package/dist/scale/ScaleAlphaDatetime.svelte +15 -0
- package/dist/scale/ScaleAlphaDatetime.svelte.d.ts +5 -0
- package/dist/scale/ScaleAlphaDiscrete.svelte +14 -0
- package/dist/scale/ScaleAlphaDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleAlphaIdentity.svelte +14 -0
- package/dist/scale/ScaleAlphaIdentity.svelte.d.ts +4 -0
- package/dist/scale/ScaleAlphaManual.svelte +14 -0
- package/dist/scale/ScaleAlphaManual.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorBinned.svelte +14 -0
- package/dist/scale/ScaleColorBinned.svelte.d.ts +3 -0
- package/dist/scale/ScaleColorBrewer.svelte +14 -0
- package/dist/scale/ScaleColorBrewer.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorContinuous.svelte +14 -0
- package/dist/scale/ScaleColorContinuous.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorDate.svelte +15 -0
- package/dist/scale/ScaleColorDate.svelte.d.ts +5 -0
- package/dist/scale/ScaleColorDatetime.svelte +15 -0
- package/dist/scale/ScaleColorDatetime.svelte.d.ts +5 -0
- package/dist/scale/ScaleColorDiscrete.svelte +14 -0
- package/dist/scale/ScaleColorDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorDistiller.svelte +14 -0
- package/dist/scale/ScaleColorDistiller.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorFermenter.svelte +14 -0
- package/dist/scale/ScaleColorFermenter.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorGradient.svelte +11 -0
- package/dist/scale/ScaleColorGradient.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorGradient2.svelte +14 -0
- package/dist/scale/ScaleColorGradient2.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorGradientn.svelte +14 -0
- package/dist/scale/ScaleColorGradientn.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorGrey.svelte +11 -0
- package/dist/scale/ScaleColorGrey.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorHue.svelte +11 -0
- package/dist/scale/ScaleColorHue.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorIdentity.svelte +14 -0
- package/dist/scale/ScaleColorIdentity.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorLog10.svelte +14 -0
- package/dist/scale/ScaleColorLog10.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorManual.svelte +14 -0
- package/dist/scale/ScaleColorManual.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorOrdinal.svelte +14 -0
- package/dist/scale/ScaleColorOrdinal.svelte.d.ts +3 -0
- package/dist/scale/ScaleColorSqrt.svelte +14 -0
- package/dist/scale/ScaleColorSqrt.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorSteps.svelte +11 -0
- package/dist/scale/ScaleColorSteps.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorSteps2.svelte +11 -0
- package/dist/scale/ScaleColorSteps2.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorStepsn.svelte +11 -0
- package/dist/scale/ScaleColorStepsn.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorViridisB.svelte +11 -0
- package/dist/scale/ScaleColorViridisB.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorViridisC.svelte +11 -0
- package/dist/scale/ScaleColorViridisC.svelte.d.ts +4 -0
- package/dist/scale/ScaleColorViridisD.svelte +11 -0
- package/dist/scale/ScaleColorViridisD.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillBinned.svelte +11 -0
- package/dist/scale/ScaleFillBinned.svelte.d.ts +3 -0
- package/dist/scale/ScaleFillBrewer.svelte +11 -0
- package/dist/scale/ScaleFillBrewer.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillContinuous.svelte +14 -0
- package/dist/scale/ScaleFillContinuous.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillDate.svelte +12 -0
- package/dist/scale/ScaleFillDate.svelte.d.ts +5 -0
- package/dist/scale/ScaleFillDatetime.svelte +15 -0
- package/dist/scale/ScaleFillDatetime.svelte.d.ts +5 -0
- package/dist/scale/ScaleFillDiscrete.svelte +14 -0
- package/dist/scale/ScaleFillDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillDistiller.svelte +14 -0
- package/dist/scale/ScaleFillDistiller.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillFermenter.svelte +14 -0
- package/dist/scale/ScaleFillFermenter.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillGradient.svelte +11 -0
- package/dist/scale/ScaleFillGradient.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillGradient2.svelte +14 -0
- package/dist/scale/ScaleFillGradient2.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillGradientn.svelte +14 -0
- package/dist/scale/ScaleFillGradientn.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillGrey.svelte +11 -0
- package/dist/scale/ScaleFillGrey.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillHue.svelte +11 -0
- package/dist/scale/ScaleFillHue.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillIdentity.svelte +14 -0
- package/dist/scale/ScaleFillIdentity.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillLog10.svelte +14 -0
- package/dist/scale/ScaleFillLog10.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillManual.svelte +11 -0
- package/dist/scale/ScaleFillManual.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillOrdinal.svelte +14 -0
- package/dist/scale/ScaleFillOrdinal.svelte.d.ts +3 -0
- package/dist/scale/ScaleFillSqrt.svelte +14 -0
- package/dist/scale/ScaleFillSqrt.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillSteps.svelte +11 -0
- package/dist/scale/ScaleFillSteps.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillSteps2.svelte +11 -0
- package/dist/scale/ScaleFillSteps2.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillStepsn.svelte +11 -0
- package/dist/scale/ScaleFillStepsn.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillViridisB.svelte +11 -0
- package/dist/scale/ScaleFillViridisB.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillViridisC.svelte +11 -0
- package/dist/scale/ScaleFillViridisC.svelte.d.ts +4 -0
- package/dist/scale/ScaleFillViridisD.svelte +11 -0
- package/dist/scale/ScaleFillViridisD.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinetypeBinned.svelte +15 -0
- package/dist/scale/ScaleLinetypeBinned.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinetypeDiscrete.svelte +15 -0
- package/dist/scale/ScaleLinetypeDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinetypeIdentity.svelte +15 -0
- package/dist/scale/ScaleLinetypeIdentity.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinetypeManual.svelte +15 -0
- package/dist/scale/ScaleLinetypeManual.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinewidthBinned.svelte +14 -0
- package/dist/scale/ScaleLinewidthBinned.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinewidthContinuous.svelte +14 -0
- package/dist/scale/ScaleLinewidthContinuous.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinewidthDate.svelte +15 -0
- package/dist/scale/ScaleLinewidthDate.svelte.d.ts +5 -0
- package/dist/scale/ScaleLinewidthDatetime.svelte +15 -0
- package/dist/scale/ScaleLinewidthDatetime.svelte.d.ts +5 -0
- package/dist/scale/ScaleLinewidthDiscrete.svelte +14 -0
- package/dist/scale/ScaleLinewidthDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinewidthIdentity.svelte +14 -0
- package/dist/scale/ScaleLinewidthIdentity.svelte.d.ts +4 -0
- package/dist/scale/ScaleLinewidthManual.svelte +14 -0
- package/dist/scale/ScaleLinewidthManual.svelte.d.ts +4 -0
- package/dist/scale/ScaleRadius.svelte +11 -0
- package/dist/scale/ScaleRadius.svelte.d.ts +4 -0
- package/dist/scale/ScaleShapeBinned.svelte +15 -0
- package/dist/scale/ScaleShapeBinned.svelte.d.ts +4 -0
- package/dist/scale/ScaleShapeDiscrete.svelte +15 -0
- package/dist/scale/ScaleShapeDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleShapeIdentity.svelte +15 -0
- package/dist/scale/ScaleShapeIdentity.svelte.d.ts +4 -0
- package/dist/scale/ScaleShapeManual.svelte +15 -0
- package/dist/scale/ScaleShapeManual.svelte.d.ts +4 -0
- package/dist/scale/ScaleSizeArea.svelte +11 -0
- package/dist/scale/ScaleSizeArea.svelte.d.ts +4 -0
- package/dist/scale/ScaleSizeBinned.svelte +14 -0
- package/dist/scale/ScaleSizeBinned.svelte.d.ts +4 -0
- package/dist/scale/ScaleSizeBinnedArea.svelte +14 -0
- package/dist/scale/ScaleSizeBinnedArea.svelte.d.ts +4 -0
- package/dist/scale/ScaleSizeContinuous.svelte +14 -0
- package/dist/scale/ScaleSizeContinuous.svelte.d.ts +4 -0
- package/dist/scale/ScaleSizeDate.svelte +15 -0
- package/dist/scale/ScaleSizeDate.svelte.d.ts +5 -0
- package/dist/scale/ScaleSizeDatetime.svelte +15 -0
- package/dist/scale/ScaleSizeDatetime.svelte.d.ts +5 -0
- package/dist/scale/ScaleSizeDiscrete.svelte +14 -0
- package/dist/scale/ScaleSizeDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleSizeIdentity.svelte +14 -0
- package/dist/scale/ScaleSizeIdentity.svelte.d.ts +4 -0
- package/dist/scale/ScaleSizeManual.svelte +14 -0
- package/dist/scale/ScaleSizeManual.svelte.d.ts +4 -0
- package/dist/scale/ScaleXBinned.svelte +14 -0
- package/dist/scale/ScaleXBinned.svelte.d.ts +4 -0
- package/dist/scale/ScaleXContinuous.svelte +14 -0
- package/dist/scale/ScaleXContinuous.svelte.d.ts +4 -0
- package/dist/scale/ScaleXDate.svelte +12 -0
- package/dist/scale/ScaleXDate.svelte.d.ts +5 -0
- package/dist/scale/ScaleXDatetime.svelte +12 -0
- package/dist/scale/ScaleXDatetime.svelte.d.ts +5 -0
- package/dist/scale/ScaleXDiscrete.svelte +14 -0
- package/dist/scale/ScaleXDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleXLog10.svelte +14 -0
- package/dist/scale/ScaleXLog10.svelte.d.ts +4 -0
- package/dist/scale/ScaleXMonthDay.svelte +12 -0
- package/dist/scale/ScaleXMonthDay.svelte.d.ts +5 -0
- package/dist/scale/ScaleXReverse.svelte +15 -0
- package/dist/scale/ScaleXReverse.svelte.d.ts +4 -0
- package/dist/scale/ScaleXSqrt.svelte +14 -0
- package/dist/scale/ScaleXSqrt.svelte.d.ts +4 -0
- package/dist/scale/ScaleXTime.svelte +12 -0
- package/dist/scale/ScaleXTime.svelte.d.ts +5 -0
- package/dist/scale/ScaleYBinned.svelte +14 -0
- package/dist/scale/ScaleYBinned.svelte.d.ts +4 -0
- package/dist/scale/ScaleYContinuous.svelte +14 -0
- package/dist/scale/ScaleYContinuous.svelte.d.ts +4 -0
- package/dist/scale/ScaleYDate.svelte +12 -0
- package/dist/scale/ScaleYDate.svelte.d.ts +5 -0
- package/dist/scale/ScaleYDatetime.svelte +12 -0
- package/dist/scale/ScaleYDatetime.svelte.d.ts +5 -0
- package/dist/scale/ScaleYDiscrete.svelte +14 -0
- package/dist/scale/ScaleYDiscrete.svelte.d.ts +4 -0
- package/dist/scale/ScaleYLog10.svelte +14 -0
- package/dist/scale/ScaleYLog10.svelte.d.ts +4 -0
- package/dist/scale/ScaleYMonthDay.svelte +12 -0
- package/dist/scale/ScaleYMonthDay.svelte.d.ts +5 -0
- package/dist/scale/ScaleYReverse.svelte +15 -0
- package/dist/scale/ScaleYReverse.svelte.d.ts +4 -0
- package/dist/scale/ScaleYSqrt.svelte +14 -0
- package/dist/scale/ScaleYSqrt.svelte.d.ts +4 -0
- package/dist/scale/ScaleYTime.svelte +12 -0
- package/dist/scale/ScaleYTime.svelte.d.ts +5 -0
- package/dist/scene/Axis.svelte +159 -0
- package/dist/scene/Axis.svelte.d.ts +12 -0
- package/dist/scene/Batch.svelte +252 -0
- package/dist/scene/Batch.svelte.d.ts +23 -0
- package/dist/scene/InteractionOverlay.svelte +402 -0
- package/dist/scene/InteractionOverlay.svelte.d.ts +44 -0
- package/dist/scene/Legend.svelte +278 -0
- package/dist/scene/Legend.svelte.d.ts +8 -0
- package/dist/scene/MarkStrata.svelte +129 -0
- package/dist/scene/MarkStrata.svelte.d.ts +15 -0
- package/dist/scene/SceneOverlays.svelte +118 -0
- package/dist/scene/SceneOverlays.svelte.d.ts +49 -0
- package/dist/scene/SceneView.svelte +478 -0
- package/dist/scene/SceneView.svelte.d.ts +32 -0
- package/dist/scene/batch-presentation.svelte.d.ts +111 -0
- package/dist/scene/batch-presentation.svelte.js +207 -0
- package/dist/scene/geometry.d.ts +2 -0
- package/dist/scene/geometry.js +3 -0
- package/dist/scene/stratum-paint.d.ts +25 -0
- package/dist/scene/stratum-paint.js +40 -0
- package/dist/selection/selection-state.svelte.d.ts +23 -0
- package/dist/selection/selection-state.svelte.js +73 -0
- package/dist/selection/selection.d.ts +1 -0
- package/dist/selection/selection.js +2 -0
- package/dist/surface/CaptureSurface.svelte +109 -0
- package/dist/surface/CaptureSurface.svelte.d.ts +27 -0
- package/dist/surface/area-brush.d.ts +48 -0
- package/dist/surface/area-brush.js +44 -0
- package/dist/surface/brush-finish.d.ts +49 -0
- package/dist/surface/brush-finish.js +44 -0
- package/dist/surface/keyboard.d.ts +97 -0
- package/dist/surface/keyboard.js +105 -0
- package/dist/surface/pointer.d.ts +241 -0
- package/dist/surface/pointer.js +179 -0
- package/dist/surface/surface-description.d.ts +10 -0
- package/dist/surface/surface-description.js +11 -0
- package/dist/surface/surface-handlers.svelte.d.ts +53 -0
- package/dist/surface/surface-handlers.svelte.js +418 -0
- package/dist/surface/surface-state.svelte.d.ts +90 -0
- package/dist/surface/surface-state.svelte.js +161 -0
- package/dist/theme/Theme.svelte +27 -0
- package/dist/theme/Theme.svelte.d.ts +23 -0
- package/dist/theme/ThemeBase.svelte +13 -0
- package/dist/theme/ThemeBase.svelte.d.ts +8 -0
- package/dist/theme/ThemeBw.svelte +13 -0
- package/dist/theme/ThemeBw.svelte.d.ts +8 -0
- package/dist/theme/ThemeClassic.svelte +13 -0
- package/dist/theme/ThemeClassic.svelte.d.ts +8 -0
- package/dist/theme/ThemeClean.svelte +13 -0
- package/dist/theme/ThemeClean.svelte.d.ts +8 -0
- package/dist/theme/ThemeDark.svelte +13 -0
- package/dist/theme/ThemeDark.svelte.d.ts +8 -0
- package/dist/theme/ThemeDefault.svelte +13 -0
- package/dist/theme/ThemeDefault.svelte.d.ts +8 -0
- package/dist/theme/ThemeEconomist.svelte +13 -0
- package/dist/theme/ThemeEconomist.svelte.d.ts +8 -0
- package/dist/theme/ThemeEconomistwhite.svelte +13 -0
- package/dist/theme/ThemeEconomistwhite.svelte.d.ts +8 -0
- package/dist/theme/ThemeFew.svelte +13 -0
- package/dist/theme/ThemeFew.svelte.d.ts +8 -0
- package/dist/theme/ThemeFivethirtyeight.svelte +14 -0
- package/dist/theme/ThemeFivethirtyeight.svelte.d.ts +9 -0
- package/dist/theme/ThemeGgplot2.svelte +13 -0
- package/dist/theme/ThemeGgplot2.svelte.d.ts +8 -0
- package/dist/theme/ThemeGray.svelte +13 -0
- package/dist/theme/ThemeGray.svelte.d.ts +8 -0
- package/dist/theme/ThemeGrey.svelte +13 -0
- package/dist/theme/ThemeGrey.svelte.d.ts +8 -0
- package/dist/theme/ThemeHc.svelte +13 -0
- package/dist/theme/ThemeHc.svelte.d.ts +8 -0
- package/dist/theme/ThemeHcdark.svelte +13 -0
- package/dist/theme/ThemeHcdark.svelte.d.ts +8 -0
- package/dist/theme/ThemeHrbr.svelte +13 -0
- package/dist/theme/ThemeHrbr.svelte.d.ts +8 -0
- package/dist/theme/ThemeIgray.svelte +13 -0
- package/dist/theme/ThemeIgray.svelte.d.ts +8 -0
- package/dist/theme/ThemeLight.svelte +13 -0
- package/dist/theme/ThemeLight.svelte.d.ts +8 -0
- package/dist/theme/ThemeLinedraw.svelte +13 -0
- package/dist/theme/ThemeLinedraw.svelte.d.ts +8 -0
- package/dist/theme/ThemeMap.svelte +13 -0
- package/dist/theme/ThemeMap.svelte.d.ts +8 -0
- package/dist/theme/ThemeMinimal.svelte +13 -0
- package/dist/theme/ThemeMinimal.svelte.d.ts +8 -0
- package/dist/theme/ThemePander.svelte +13 -0
- package/dist/theme/ThemePander.svelte.d.ts +8 -0
- package/dist/theme/ThemeSolarized.svelte +13 -0
- package/dist/theme/ThemeSolarized.svelte.d.ts +8 -0
- package/dist/theme/ThemeSolarized2.svelte +13 -0
- package/dist/theme/ThemeSolarized2.svelte.d.ts +8 -0
- package/dist/theme/ThemeSolarized2dark.svelte +13 -0
- package/dist/theme/ThemeSolarized2dark.svelte.d.ts +8 -0
- package/dist/theme/ThemeSolarizeddark.svelte +14 -0
- package/dist/theme/ThemeSolarizeddark.svelte.d.ts +9 -0
- package/dist/theme/ThemeSolid.svelte +13 -0
- package/dist/theme/ThemeSolid.svelte.d.ts +8 -0
- package/dist/theme/ThemeStata.svelte +13 -0
- package/dist/theme/ThemeStata.svelte.d.ts +8 -0
- package/dist/theme/ThemeStatas1color.svelte +13 -0
- package/dist/theme/ThemeStatas1color.svelte.d.ts +8 -0
- package/dist/theme/ThemeTest.svelte +14 -0
- package/dist/theme/ThemeTest.svelte.d.ts +9 -0
- package/dist/theme/ThemeTufte.svelte +13 -0
- package/dist/theme/ThemeTufte.svelte.d.ts +8 -0
- package/dist/theme/ThemeVoid.svelte +14 -0
- package/dist/theme/ThemeVoid.svelte.d.ts +9 -0
- package/dist/theme/ThemeWsj.svelte +13 -0
- package/dist/theme/ThemeWsj.svelte.d.ts +8 -0
- package/dist/theme/factory.svelte.d.ts +36 -0
- package/dist/theme/factory.svelte.js +100 -0
- package/dist/zoom/zoom-state.svelte.d.ts +44 -0
- package/dist/zoom/zoom-state.svelte.js +121 -0
- package/dist/zoom/zoom.d.ts +1 -0
- package/dist/zoom/zoom.js +2 -0
- package/package.json +83 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { samePropertyKeySet, } from "./focus.js";
|
|
2
|
+
import { reconcileLegendPreview } from "./focus-emphasis.js";
|
|
3
|
+
import { planLegendCommittedReconcile, planLegendFocusDisabledClear, planLegendRovingFocusSync, } from "./focus-plans.js";
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Effect registration
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
/**
|
|
8
|
+
* Register the four reconcile effects. Called synchronously from
|
|
9
|
+
* `installHostDerivedEffects` while the component initializes — never from a
|
|
10
|
+
* callback or after init.
|
|
11
|
+
*/
|
|
12
|
+
export function installLegendFocusReconcileEffects(ports) {
|
|
13
|
+
$effect.pre(() => {
|
|
14
|
+
const count = ports.entries().length;
|
|
15
|
+
const active = document.activeElement;
|
|
16
|
+
// Number(dataset.index) may be NaN — pure plan maps non-finite → 0.
|
|
17
|
+
const focusedIndex = active instanceof HTMLElement &&
|
|
18
|
+
active.matches("[data-gg-legend-target]") &&
|
|
19
|
+
(ports.root()?.contains(active) ?? false)
|
|
20
|
+
? Number(active.dataset["index"])
|
|
21
|
+
: null;
|
|
22
|
+
const currentRoving = ports.rovingIndex();
|
|
23
|
+
const plan = planLegendRovingFocusSync({
|
|
24
|
+
currentRoving,
|
|
25
|
+
entryCount: count,
|
|
26
|
+
focusedIndex,
|
|
27
|
+
});
|
|
28
|
+
if (plan.nextIndex !== currentRoving)
|
|
29
|
+
ports.setRovingIndex(plan.nextIndex);
|
|
30
|
+
if (plan.type !== "refocus")
|
|
31
|
+
return;
|
|
32
|
+
const returnIndex = plan.returnIndex;
|
|
33
|
+
queueMicrotask(() => {
|
|
34
|
+
ports
|
|
35
|
+
.root()
|
|
36
|
+
?.querySelector(`[data-gg-legend-target][data-index="${String(returnIndex)}"]`)
|
|
37
|
+
?.focus();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
$effect(() => {
|
|
41
|
+
const usesLocalEmphasis = ports.interaction() === undefined;
|
|
42
|
+
const plan = planLegendCommittedReconcile({
|
|
43
|
+
committed: ports.committed(),
|
|
44
|
+
entries: ports.entries(),
|
|
45
|
+
keyIndex: ports.entryKeys().legendEntryKeyIndex,
|
|
46
|
+
usesLocalEmphasis,
|
|
47
|
+
// Only consulted when usesLocalEmphasis; store value is the local shadow.
|
|
48
|
+
localEmphasisCount: usesLocalEmphasis ? ports.emphasisKeys.value.length : 0,
|
|
49
|
+
});
|
|
50
|
+
switch (plan.type) {
|
|
51
|
+
case "noop":
|
|
52
|
+
return;
|
|
53
|
+
case "clear-committed":
|
|
54
|
+
ports.setCommitted(null);
|
|
55
|
+
break;
|
|
56
|
+
case "clear-committed-local-emit":
|
|
57
|
+
ports.setCommitted(null);
|
|
58
|
+
ports.emphasisKeys.clear("programmatic");
|
|
59
|
+
ports.emitLegendFocus({
|
|
60
|
+
type: "legend-focus",
|
|
61
|
+
phase: "clear",
|
|
62
|
+
source: "programmatic",
|
|
63
|
+
});
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
// Reconcile transient preview when data/domain reshuffles entry membership.
|
|
68
|
+
$effect(() => {
|
|
69
|
+
const preview = ports.preview();
|
|
70
|
+
if (preview === null)
|
|
71
|
+
return;
|
|
72
|
+
const next = reconcileLegendPreview({
|
|
73
|
+
preview: { identity: preview.action.identity, keys: preview.keys },
|
|
74
|
+
entries: ports.entries(),
|
|
75
|
+
keyIndex: ports.entryKeys().legendEntryKeyIndex,
|
|
76
|
+
});
|
|
77
|
+
if (next === null) {
|
|
78
|
+
ports.previewLegend(null);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (samePropertyKeySet(next.keys, preview.keys))
|
|
82
|
+
return;
|
|
83
|
+
ports.setPreview({
|
|
84
|
+
action: { ...preview.action, identity: next.identity },
|
|
85
|
+
keys: next.keys,
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
// Drop chart-local emphasis when legend focus is turned off at runtime.
|
|
89
|
+
// Shared controller emphasis is intentionally retained (clear-host only).
|
|
90
|
+
$effect(() => {
|
|
91
|
+
const usesLocalEmphasis = ports.interaction() === undefined;
|
|
92
|
+
const plan = planLegendFocusDisabledClear({
|
|
93
|
+
legendFocusEnabled: ports.legendFocusEnabled(),
|
|
94
|
+
hasPreview: ports.preview() !== null,
|
|
95
|
+
hasCommitted: ports.committed() !== null,
|
|
96
|
+
hasLocalEmphasis: usesLocalEmphasis && ports.emphasisKeys.value.length > 0,
|
|
97
|
+
usesLocalEmphasis,
|
|
98
|
+
});
|
|
99
|
+
switch (plan.type) {
|
|
100
|
+
case "noop":
|
|
101
|
+
return;
|
|
102
|
+
case "clear-host":
|
|
103
|
+
ports.setPreview(null);
|
|
104
|
+
ports.setCommitted(null);
|
|
105
|
+
break;
|
|
106
|
+
case "clear-host-local":
|
|
107
|
+
ports.setPreview(null);
|
|
108
|
+
ports.setCommitted(null);
|
|
109
|
+
ports.emphasisKeys.clear("programmatic");
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legend-focus controller extracted from GGPlot for S3.
|
|
3
|
+
*
|
|
4
|
+
* Owns chart-local emphasis, preview/commit state, roving/touch suppress
|
|
5
|
+
* flags, and interaction handlers. The four host-derived reconcile effects
|
|
6
|
+
* live in focus-reconcile.svelte.ts, registered synchronously by
|
|
7
|
+
* installHostDerivedEffects. Construction-time
|
|
8
|
+
* deriveds must NOT read model/entryKeys/entries (construction-order DAG).
|
|
9
|
+
* Those are methods/effects registered after the host declares the later
|
|
10
|
+
* bindings.
|
|
11
|
+
*/
|
|
12
|
+
import type { CellValue, RenderModel } from "@ggts-sh/core";
|
|
13
|
+
import type { PlotInteractionController } from "../interaction/controller.svelte.js";
|
|
14
|
+
import type { LegendFocusEvent, PlotInteractionEvent, PlotInteractionScope } from "../interaction/interaction.js";
|
|
15
|
+
import type { InteractiveLegendEntry, LegendEntryIdentity } from "./focus.js";
|
|
16
|
+
import type { LegendEntryKeyAccess } from "./entry-key-index.svelte.js";
|
|
17
|
+
export type LegendFocusStateDeps = {
|
|
18
|
+
interaction: () => PlotInteractionController | undefined;
|
|
19
|
+
resolvedInteractionScope: () => PlotInteractionScope;
|
|
20
|
+
legendFocusEnabled: () => boolean;
|
|
21
|
+
/** Narrow reactive getter over `interactionConfig.legendFocus?.preview`. */
|
|
22
|
+
legendFocusPreviewEnabled: () => boolean;
|
|
23
|
+
root: () => HTMLDivElement | null;
|
|
24
|
+
/**
|
|
25
|
+
* Legend entry → semantic-key access. Accessed only inside methods /
|
|
26
|
+
* effects / handlers (declared after the factory in the host).
|
|
27
|
+
*/
|
|
28
|
+
entryKeys: () => LegendEntryKeyAccess;
|
|
29
|
+
/**
|
|
30
|
+
* Component-side interactive entries derived. Read only in effects/handlers.
|
|
31
|
+
*/
|
|
32
|
+
entries: () => readonly InteractiveLegendEntry[];
|
|
33
|
+
/**
|
|
34
|
+
* Host's cached `effectiveLegendPressed` derived (computeLegendPressed over
|
|
35
|
+
* the current model). Called only from commit handlers — never at
|
|
36
|
+
* construction — so it may close over a later-declared host binding.
|
|
37
|
+
*/
|
|
38
|
+
pressed: () => LegendEntryIdentity | null;
|
|
39
|
+
onlegendfocus: () => ((event: LegendFocusEvent) => void) | undefined;
|
|
40
|
+
oninteraction: () => ((event: PlotInteractionEvent<Record<string, CellValue>>) => void) | undefined;
|
|
41
|
+
/** Stable announce sink (not a getter). */
|
|
42
|
+
announce: (message: string) => void;
|
|
43
|
+
};
|
|
44
|
+
export type LegendFocusState = {
|
|
45
|
+
readonly effectiveEmphasisKeys: readonly PropertyKey[];
|
|
46
|
+
readonly previewIdentity: LegendEntryIdentity | null;
|
|
47
|
+
readonly rovingIndex: number;
|
|
48
|
+
computeInteractiveEntries(model: RenderModel | null): InteractiveLegendEntry[];
|
|
49
|
+
computeLegendPressed(model: RenderModel | null): LegendEntryIdentity | null;
|
|
50
|
+
onPreviewIndex(index: number): void;
|
|
51
|
+
onPreviewClear(): void;
|
|
52
|
+
onLegendFocus(index: number): void;
|
|
53
|
+
onLegendKeydown(event: KeyboardEvent, index: number): void;
|
|
54
|
+
onLegendPointerDown(event: PointerEvent, index: number): void;
|
|
55
|
+
onLegendPointerUp(event: PointerEvent, index: number): void;
|
|
56
|
+
onLegendClick(event: MouseEvent, index: number): void;
|
|
57
|
+
onLegendBlur(event: FocusEvent): void;
|
|
58
|
+
clearLegendFromControl(event: MouseEvent): void;
|
|
59
|
+
setTouchIndexCleared(): void;
|
|
60
|
+
setClearPointerType(type: string | null): void;
|
|
61
|
+
/**
|
|
62
|
+
* Install reconcile effects after host `$derived` entry lists exist.
|
|
63
|
+
* Irreducible late hook: entries/pressed close over host-held deriveds that
|
|
64
|
+
* require this factory's compute* methods (#627 — not a sibling-controller cycle).
|
|
65
|
+
*/
|
|
66
|
+
installHostDerivedEffects(): void;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Create the legend-focus controller. Construction registers
|
|
70
|
+
* `effectiveEmphasisKeys`. Call `installHostDerivedEffects` after the host
|
|
71
|
+
* declares entry/pressed deriveds that this factory's compute* methods feed.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createLegendFocusState(deps: LegendFocusStateDeps): LegendFocusState;
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { createScopedStore } from "../interaction/scoped-store.svelte.js";
|
|
2
|
+
import { legendFocusAnnouncement } from "../assembly/labels.js";
|
|
3
|
+
import { buildInteractiveLegendEntries, moveLegendRovingIndex, samePropertyKeySet, } from "./focus.js";
|
|
4
|
+
import { findLegendPressedIdentity, resolveLegendEmphasisKeys, resolveLegendPreviewKeysDecision, } from "./focus-emphasis.js";
|
|
5
|
+
import { installLegendFocusReconcileEffects, } from "./focus-reconcile.svelte.js";
|
|
6
|
+
import { resolveLegendClearControlSource, resolveLegendClickAction, resolveLegendCommitAction, resolveLegendKeyAction, resolveLegendPointerUpAction, resolveLegendPreviewDismissAction, shouldClearLegendPreviewOnBlur, shouldEmitLegendFocusClear, } from "./surface.js";
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Factory
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* Create the legend-focus controller. Construction registers
|
|
12
|
+
* `effectiveEmphasisKeys`. Call `installHostDerivedEffects` after the host
|
|
13
|
+
* declares entry/pressed deriveds that this factory's compute* methods feed.
|
|
14
|
+
*/
|
|
15
|
+
export function createLegendFocusState(deps) {
|
|
16
|
+
const emphasisKeys = createScopedStore({
|
|
17
|
+
initial: [],
|
|
18
|
+
controller: deps.interaction,
|
|
19
|
+
scope: deps.resolvedInteractionScope,
|
|
20
|
+
read: (controller, scope) => controller.emphasized(scope),
|
|
21
|
+
write: (controller, next, scope, source) => {
|
|
22
|
+
const transition = controller.setEmphasis(next, { scope, source });
|
|
23
|
+
if (transition === null)
|
|
24
|
+
return null;
|
|
25
|
+
return {
|
|
26
|
+
value: transition.snapshot.emphases.find((emphasis) => emphasis.scope === scope.keys)?.keys ??
|
|
27
|
+
[],
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
clearShared: (controller, scope, source) => controller.clearEmphasis({ scope, source }) !== null,
|
|
31
|
+
same: samePropertyKeySet,
|
|
32
|
+
});
|
|
33
|
+
let legendPreview = $state(null);
|
|
34
|
+
let legendCommitted = $state(null);
|
|
35
|
+
let legendRovingIndex = $state(0);
|
|
36
|
+
let legendTouchIndex = -1;
|
|
37
|
+
let legendClearPointerType = null;
|
|
38
|
+
let suppressLegendClick = false;
|
|
39
|
+
let suppressLegendFocusPreview = false;
|
|
40
|
+
const effectiveEmphasisKeys = $derived.by(() => {
|
|
41
|
+
const baseKeys = emphasisKeys.value;
|
|
42
|
+
return resolveLegendEmphasisKeys({
|
|
43
|
+
legendFocusEnabled: deps.legendFocusEnabled(),
|
|
44
|
+
previewKeys: legendPreview?.keys ?? null,
|
|
45
|
+
// Shared: baseKeys are controller-backed. Local: baseKeys fill localKeys.
|
|
46
|
+
controllerKeys: deps.interaction() === undefined ? null : baseKeys,
|
|
47
|
+
localKeys: baseKeys,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
function emitLegendFocus(event) {
|
|
51
|
+
deps.announce(legendFocusAnnouncement(event));
|
|
52
|
+
deps.onlegendfocus()?.(event);
|
|
53
|
+
deps.oninteraction()?.(event);
|
|
54
|
+
}
|
|
55
|
+
function previewLegend(action) {
|
|
56
|
+
if (action === null) {
|
|
57
|
+
// Decision table is pure (legend/surface); host owns emit + mutation.
|
|
58
|
+
// Emit gate uses committed emphasis, not effectiveEmphasisKeys (preview).
|
|
59
|
+
// Pure table maps preview source → InteractionSource on non-none actions.
|
|
60
|
+
const dismiss = resolveLegendPreviewDismissAction({
|
|
61
|
+
previewSource: legendPreview?.action.source ?? null,
|
|
62
|
+
committedEmphasisEmpty: emphasisKeys.value.length === 0,
|
|
63
|
+
});
|
|
64
|
+
if (dismiss.type === "none")
|
|
65
|
+
return;
|
|
66
|
+
legendPreview = null;
|
|
67
|
+
if (dismiss.type === "clear-and-emit")
|
|
68
|
+
emitLegendFocus({
|
|
69
|
+
type: "legend-focus",
|
|
70
|
+
phase: "clear",
|
|
71
|
+
source: dismiss.source,
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const decision = resolveLegendPreviewKeysDecision({
|
|
76
|
+
keys: deps.entryKeys().keysForLegend(action),
|
|
77
|
+
entrySource: action.source,
|
|
78
|
+
});
|
|
79
|
+
if (decision.type === "clear") {
|
|
80
|
+
// Empty domain entry: do not leave the previous entry's preview active.
|
|
81
|
+
previewLegend(null);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
legendPreview = { action, keys: decision.keys };
|
|
85
|
+
emitLegendFocus({
|
|
86
|
+
type: "legend-focus",
|
|
87
|
+
phase: "change",
|
|
88
|
+
state: "transient",
|
|
89
|
+
source: decision.source,
|
|
90
|
+
scale: action.identity.scale,
|
|
91
|
+
value: action.entry.value,
|
|
92
|
+
label: action.entry.label,
|
|
93
|
+
keys: decision.keys,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function clearLegendFocus(source) {
|
|
97
|
+
const emitClear = shouldEmitLegendFocusClear({
|
|
98
|
+
hasPreview: legendPreview !== null,
|
|
99
|
+
hasCommitted: legendCommitted !== null,
|
|
100
|
+
emphasisKeyCount: effectiveEmphasisKeys.length,
|
|
101
|
+
});
|
|
102
|
+
legendPreview = null;
|
|
103
|
+
legendCommitted = null;
|
|
104
|
+
emphasisKeys.clear(source);
|
|
105
|
+
if (emitClear)
|
|
106
|
+
emitLegendFocus({ type: "legend-focus", phase: "clear", source });
|
|
107
|
+
}
|
|
108
|
+
function clearLegendFromControl(event) {
|
|
109
|
+
const returnTarget = deps
|
|
110
|
+
.root()
|
|
111
|
+
?.querySelector(".gg-legend-target[aria-pressed='true']");
|
|
112
|
+
const source = resolveLegendClearControlSource({
|
|
113
|
+
detail: event.detail,
|
|
114
|
+
pointerType: legendClearPointerType,
|
|
115
|
+
});
|
|
116
|
+
legendClearPointerType = null;
|
|
117
|
+
clearLegendFocus(source);
|
|
118
|
+
queueMicrotask(() => {
|
|
119
|
+
if (returnTarget === null || returnTarget === undefined)
|
|
120
|
+
return;
|
|
121
|
+
suppressLegendFocusPreview = true;
|
|
122
|
+
returnTarget.focus();
|
|
123
|
+
suppressLegendFocusPreview = false;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function computeInteractiveEntries(model) {
|
|
127
|
+
if (model === null || !deps.legendFocusEnabled())
|
|
128
|
+
return [];
|
|
129
|
+
return buildInteractiveLegendEntries(model.scene.legends);
|
|
130
|
+
}
|
|
131
|
+
function computeLegendPressed(model) {
|
|
132
|
+
const keys = emphasisKeys.value;
|
|
133
|
+
if (keys.length === 0 || model === null)
|
|
134
|
+
return null;
|
|
135
|
+
// Match against all discrete scene legends (not only interactive targets).
|
|
136
|
+
return findLegendPressedIdentity({
|
|
137
|
+
keys,
|
|
138
|
+
entries: buildInteractiveLegendEntries(model.scene.legends),
|
|
139
|
+
keyIndex: deps.entryKeys().legendEntryKeyIndex,
|
|
140
|
+
committed: legendCommitted,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function commitLegend(action) {
|
|
144
|
+
// Eager key lookup (O(1) Map.get) before pure routing; unused on toggle-clear.
|
|
145
|
+
const keys = deps.entryKeys().keysForLegend(action);
|
|
146
|
+
// Host's cached effectiveLegendPressed derived — the single source of
|
|
147
|
+
// truth shared with aria-pressed, not a per-commit recompute.
|
|
148
|
+
const commit = resolveLegendCommitAction({
|
|
149
|
+
pressed: deps.pressed(),
|
|
150
|
+
identity: action.identity,
|
|
151
|
+
keyCount: keys.length,
|
|
152
|
+
entrySource: action.source,
|
|
153
|
+
});
|
|
154
|
+
switch (commit.type) {
|
|
155
|
+
case "toggle-clear":
|
|
156
|
+
clearLegendFocus(commit.source);
|
|
157
|
+
break;
|
|
158
|
+
case "ignore":
|
|
159
|
+
break;
|
|
160
|
+
case "commit":
|
|
161
|
+
legendPreview = null;
|
|
162
|
+
legendCommitted = { identity: action.identity, keys };
|
|
163
|
+
emphasisKeys.set([...keys], commit.source);
|
|
164
|
+
emitLegendFocus({
|
|
165
|
+
type: "legend-focus",
|
|
166
|
+
phase: "change",
|
|
167
|
+
state: "committed",
|
|
168
|
+
source: commit.source,
|
|
169
|
+
scale: action.identity.scale,
|
|
170
|
+
value: action.entry.value,
|
|
171
|
+
label: action.entry.label,
|
|
172
|
+
keys,
|
|
173
|
+
});
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function legendAction(index, source) {
|
|
178
|
+
const target = deps.entries()[index];
|
|
179
|
+
return target === undefined ? null : { identity: target.identity, entry: target.entry, source };
|
|
180
|
+
}
|
|
181
|
+
function previewLegendIndex(index, source) {
|
|
182
|
+
if (!deps.legendFocusPreviewEnabled())
|
|
183
|
+
return;
|
|
184
|
+
previewLegend(legendAction(index, source));
|
|
185
|
+
}
|
|
186
|
+
function onLegendFocus(index) {
|
|
187
|
+
if (suppressLegendFocusPreview)
|
|
188
|
+
return;
|
|
189
|
+
previewLegendIndex(index, "focus");
|
|
190
|
+
}
|
|
191
|
+
function moveLegendFocus(index, key) {
|
|
192
|
+
const next = moveLegendRovingIndex(index, key, deps.entries().length);
|
|
193
|
+
legendRovingIndex = next;
|
|
194
|
+
deps
|
|
195
|
+
.root()
|
|
196
|
+
?.querySelector(`[data-gg-legend-target][data-index="${String(next)}"]`)
|
|
197
|
+
?.focus();
|
|
198
|
+
}
|
|
199
|
+
function onLegendKeydown(event, index) {
|
|
200
|
+
// Decision table is pure (legend/surface); this switch owns side
|
|
201
|
+
// effects only. Roving move, commit, and clear stay host-owned.
|
|
202
|
+
const { action, preventDefault } = resolveLegendKeyAction({
|
|
203
|
+
key: event.key,
|
|
204
|
+
});
|
|
205
|
+
if (preventDefault)
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
switch (action.type) {
|
|
208
|
+
case "move":
|
|
209
|
+
moveLegendFocus(index, action.key);
|
|
210
|
+
break;
|
|
211
|
+
case "commit": {
|
|
212
|
+
const next = legendAction(index, "keyboard");
|
|
213
|
+
if (next !== null)
|
|
214
|
+
commitLegend(next);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
case "clear":
|
|
218
|
+
clearLegendFocus("keyboard");
|
|
219
|
+
break;
|
|
220
|
+
case "none":
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function onLegendPointerDown(event, index) {
|
|
225
|
+
if (event.pointerType === "touch")
|
|
226
|
+
legendTouchIndex = index;
|
|
227
|
+
}
|
|
228
|
+
function onLegendPointerUp(event, index) {
|
|
229
|
+
// Pure gate: touch + matching legendTouchIndex. Host always clears the
|
|
230
|
+
// index and sets suppressLegendClick on touch-commit (exact-once with the
|
|
231
|
+
// synthetic click). pointercancel clears the index in the template.
|
|
232
|
+
const resolved = resolveLegendPointerUpAction({
|
|
233
|
+
pointerType: event.pointerType,
|
|
234
|
+
index,
|
|
235
|
+
touchIndex: legendTouchIndex,
|
|
236
|
+
});
|
|
237
|
+
switch (resolved.type) {
|
|
238
|
+
case "touch-commit": {
|
|
239
|
+
legendTouchIndex = -1;
|
|
240
|
+
suppressLegendClick = true;
|
|
241
|
+
const next = legendAction(index, "touch");
|
|
242
|
+
if (next !== null)
|
|
243
|
+
commitLegend(next);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
case "none":
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function onLegendClick(event, index) {
|
|
251
|
+
// Pure priority: suppress (after touch) outranks detail-classified commit.
|
|
252
|
+
// detail === 0 is current source classification (not an a11y guarantee).
|
|
253
|
+
const resolved = resolveLegendClickAction({
|
|
254
|
+
suppressClick: suppressLegendClick,
|
|
255
|
+
detail: event.detail,
|
|
256
|
+
});
|
|
257
|
+
switch (resolved.type) {
|
|
258
|
+
case "suppress":
|
|
259
|
+
suppressLegendClick = false;
|
|
260
|
+
break;
|
|
261
|
+
case "commit": {
|
|
262
|
+
const next = legendAction(index, resolved.source);
|
|
263
|
+
if (next !== null)
|
|
264
|
+
commitLegend(next);
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function onLegendBlur(event) {
|
|
270
|
+
if (!shouldClearLegendPreviewOnBlur({
|
|
271
|
+
relatedTarget: event.relatedTarget,
|
|
272
|
+
root: deps.root(),
|
|
273
|
+
}))
|
|
274
|
+
return;
|
|
275
|
+
previewLegend(null);
|
|
276
|
+
}
|
|
277
|
+
function setTouchIndexCleared() {
|
|
278
|
+
legendTouchIndex = -1;
|
|
279
|
+
}
|
|
280
|
+
function setClearPointerType(type) {
|
|
281
|
+
legendClearPointerType = type;
|
|
282
|
+
}
|
|
283
|
+
function onPreviewIndex(index) {
|
|
284
|
+
previewLegendIndex(index, "pointer");
|
|
285
|
+
}
|
|
286
|
+
function onPreviewClear() {
|
|
287
|
+
previewLegend(null);
|
|
288
|
+
}
|
|
289
|
+
function installHostDerivedEffects() {
|
|
290
|
+
installLegendFocusReconcileEffects({
|
|
291
|
+
entries: deps.entries,
|
|
292
|
+
entryKeys: deps.entryKeys,
|
|
293
|
+
root: deps.root,
|
|
294
|
+
interaction: deps.interaction,
|
|
295
|
+
legendFocusEnabled: deps.legendFocusEnabled,
|
|
296
|
+
emphasisKeys,
|
|
297
|
+
rovingIndex: () => legendRovingIndex,
|
|
298
|
+
setRovingIndex: (next) => {
|
|
299
|
+
legendRovingIndex = next;
|
|
300
|
+
},
|
|
301
|
+
committed: () => legendCommitted,
|
|
302
|
+
setCommitted: (next) => {
|
|
303
|
+
legendCommitted = next;
|
|
304
|
+
},
|
|
305
|
+
preview: () => legendPreview,
|
|
306
|
+
setPreview: (next) => {
|
|
307
|
+
legendPreview = next;
|
|
308
|
+
},
|
|
309
|
+
emitLegendFocus,
|
|
310
|
+
previewLegend,
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
get effectiveEmphasisKeys() {
|
|
315
|
+
return effectiveEmphasisKeys;
|
|
316
|
+
},
|
|
317
|
+
get previewIdentity() {
|
|
318
|
+
return legendPreview?.action.identity ?? null;
|
|
319
|
+
},
|
|
320
|
+
get rovingIndex() {
|
|
321
|
+
return legendRovingIndex;
|
|
322
|
+
},
|
|
323
|
+
computeInteractiveEntries,
|
|
324
|
+
computeLegendPressed,
|
|
325
|
+
onPreviewIndex,
|
|
326
|
+
onPreviewClear,
|
|
327
|
+
onLegendFocus,
|
|
328
|
+
onLegendKeydown,
|
|
329
|
+
onLegendPointerDown,
|
|
330
|
+
onLegendPointerUp,
|
|
331
|
+
onLegendClick,
|
|
332
|
+
onLegendBlur,
|
|
333
|
+
clearLegendFromControl,
|
|
334
|
+
setTouchIndexCleared,
|
|
335
|
+
setClearPointerType,
|
|
336
|
+
installHostDerivedEffects,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { type LegendEntryIdentity, type LegendInteractionSource, type LegendEntryAction, type InteractiveLegendEntry, legendIdentityKey, buildInteractiveLegendEntries, samePropertyKeySet, legendInteractionSource, keysForLegendEntry, clampLegendRovingIndex, moveLegendRovingIndex, } from "@ggts-sh/core/interaction";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared core of the legend channel capabilities (GuideLegend `focus` /
|
|
3
|
+
* `filter`). Owns the skeleton both share: off when nothing enables the kind,
|
|
4
|
+
* children define the channel set and route through the capability-specific
|
|
5
|
+
* merge, a plot prop alone means every channel (`"all"`) and passes the RAW
|
|
6
|
+
* prop through (same reference — no normalization on that path).
|
|
7
|
+
*
|
|
8
|
+
* The capability-specific config merges stay with their owners:
|
|
9
|
+
* focus = any explicit `preview: false` wins; filter = last explicit
|
|
10
|
+
* `mode`/`multiple` wins (plot first, then children in registry order).
|
|
11
|
+
*/
|
|
12
|
+
export type LegendChannelSet = ReadonlySet<string> | "all";
|
|
13
|
+
export type ResolvedLegendChannelCapability<TInput> = {
|
|
14
|
+
/** Opt-in for wiring advisories (truthy even when later checks null it). */
|
|
15
|
+
readonly requested: TInput | false;
|
|
16
|
+
/** Value fed to the capability's config consumer. */
|
|
17
|
+
readonly configInput: TInput | false;
|
|
18
|
+
/** `"all"` = plot prop only; otherwise the children's channel set. */
|
|
19
|
+
readonly channels: LegendChannelSet;
|
|
20
|
+
};
|
|
21
|
+
/** Registry layer shape (values may be live getters — read via access). */
|
|
22
|
+
type ChannelLayerLike = {
|
|
23
|
+
readonly kind: string;
|
|
24
|
+
readonly value?: unknown;
|
|
25
|
+
};
|
|
26
|
+
type ChannelChild<TInput> = {
|
|
27
|
+
channel: string;
|
|
28
|
+
input: Exclude<TInput, false>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Combine plot prop + declaration children into one channel capability.
|
|
32
|
+
* `mergeChildrenConfig` runs ONLY when children are present — plot-alone
|
|
33
|
+
* returns the raw prop unchanged.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveLegendChannelCapability<TInput>(args: {
|
|
36
|
+
readonly plotProp: TInput | undefined;
|
|
37
|
+
readonly layers: readonly ChannelLayerLike[];
|
|
38
|
+
readonly layerKind: string;
|
|
39
|
+
readonly mergeChildrenConfig: (plotProp: TInput | undefined, children: ReadonlyArray<ChannelChild<TInput>>) => Exclude<TInput, false>;
|
|
40
|
+
}): ResolvedLegendChannelCapability<TInput>;
|
|
41
|
+
/**
|
|
42
|
+
* Keep entries whose scene legend aesthetics intersect the enabled channel
|
|
43
|
+
* set. Merged legends expose all aesthetics on `legend.aesthetics` (primary
|
|
44
|
+
* `scale` alone is not enough).
|
|
45
|
+
*/
|
|
46
|
+
export declare function filterEntriesByChannels<T extends {
|
|
47
|
+
readonly legend: {
|
|
48
|
+
readonly scale: string;
|
|
49
|
+
readonly aesthetics?: readonly string[];
|
|
50
|
+
};
|
|
51
|
+
}>(entries: readonly T[], channels: LegendChannelSet): T[];
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared core of the legend channel capabilities (GuideLegend `focus` /
|
|
3
|
+
* `filter`). Owns the skeleton both share: off when nothing enables the kind,
|
|
4
|
+
* children define the channel set and route through the capability-specific
|
|
5
|
+
* merge, a plot prop alone means every channel (`"all"`) and passes the RAW
|
|
6
|
+
* prop through (same reference — no normalization on that path).
|
|
7
|
+
*
|
|
8
|
+
* The capability-specific config merges stay with their owners:
|
|
9
|
+
* focus = any explicit `preview: false` wins; filter = last explicit
|
|
10
|
+
* `mode`/`multiple` wins (plot first, then children in registry order).
|
|
11
|
+
*/
|
|
12
|
+
function isEnabledInput(input) {
|
|
13
|
+
return input !== undefined && input !== false;
|
|
14
|
+
}
|
|
15
|
+
function readChildLayers(layers, layerKind) {
|
|
16
|
+
const out = [];
|
|
17
|
+
for (const layer of layers) {
|
|
18
|
+
if (layer.kind !== layerKind)
|
|
19
|
+
continue;
|
|
20
|
+
const value = layer.value;
|
|
21
|
+
if (value === null || value === undefined)
|
|
22
|
+
continue;
|
|
23
|
+
if (!isEnabledInput(value.input))
|
|
24
|
+
continue;
|
|
25
|
+
out.push({ channel: value.channel, input: value.input });
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Combine plot prop + declaration children into one channel capability.
|
|
31
|
+
* `mergeChildrenConfig` runs ONLY when children are present — plot-alone
|
|
32
|
+
* returns the raw prop unchanged.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveLegendChannelCapability(args) {
|
|
35
|
+
const children = readChildLayers(args.layers, args.layerKind);
|
|
36
|
+
const plotOn = isEnabledInput(args.plotProp);
|
|
37
|
+
if (children.length === 0 && !plotOn) {
|
|
38
|
+
return { requested: false, configInput: false, channels: new Set() };
|
|
39
|
+
}
|
|
40
|
+
if (children.length > 0) {
|
|
41
|
+
const configInput = args.mergeChildrenConfig(args.plotProp, children);
|
|
42
|
+
return {
|
|
43
|
+
requested: configInput,
|
|
44
|
+
configInput,
|
|
45
|
+
channels: new Set(children.map((child) => child.channel)),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
requested: args.plotProp ?? false,
|
|
50
|
+
configInput: args.plotProp ?? false,
|
|
51
|
+
channels: "all",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Keep entries whose scene legend aesthetics intersect the enabled channel
|
|
56
|
+
* set. Merged legends expose all aesthetics on `legend.aesthetics` (primary
|
|
57
|
+
* `scale` alone is not enough).
|
|
58
|
+
*/
|
|
59
|
+
export function filterEntriesByChannels(entries, channels) {
|
|
60
|
+
if (channels === "all")
|
|
61
|
+
return entries.slice();
|
|
62
|
+
if (channels.size === 0)
|
|
63
|
+
return [];
|
|
64
|
+
return entries.filter((entry) => {
|
|
65
|
+
const aesthetics = entry.legend.aesthetics ?? [entry.legend.scale];
|
|
66
|
+
return aesthetics.some((aesthetic) => channels.has(aesthetic));
|
|
67
|
+
});
|
|
68
|
+
}
|