@d3plus/core 4.3.0 → 4.6.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 +7406 -3676
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/internal.js +13 -2
- package/es/internal.js.map +1 -1
- package/es/src/charts/AreaPlot/index.js +1 -2
- package/es/src/charts/AreaPlot/index.js.map +1 -1
- package/es/src/charts/BarChart/index.js +9 -3
- package/es/src/charts/BarChart/index.js.map +1 -1
- package/es/src/charts/BoxWhisker/index.js +6 -2
- package/es/src/charts/BoxWhisker/index.js.map +1 -1
- package/es/src/charts/BumpChart/index.js +1 -2
- package/es/src/charts/BumpChart/index.js.map +1 -1
- package/es/src/charts/Chord/applyLayout.js +205 -0
- package/es/src/charts/Chord/applyLayout.js.map +1 -0
- package/es/src/charts/Chord/emit.js +220 -0
- package/es/src/charts/Chord/emit.js.map +1 -0
- package/es/src/charts/Chord/index.js +249 -0
- package/es/src/charts/Chord/index.js.map +1 -0
- package/es/src/charts/Geomap/applyLayout.js +17 -10
- package/es/src/charts/Geomap/applyLayout.js.map +1 -1
- package/es/src/charts/Geomap/basemapTheme.js +78 -0
- package/es/src/charts/Geomap/basemapTheme.js.map +1 -0
- package/es/src/charts/Geomap/emit.js +18 -9
- package/es/src/charts/Geomap/emit.js.map +1 -1
- package/es/src/charts/Geomap/index.js +74 -105
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/Histogram/binData.js +225 -0
- package/es/src/charts/Histogram/binData.js.map +1 -0
- package/es/src/charts/Histogram/index.js +271 -0
- package/es/src/charts/Histogram/index.js.map +1 -0
- package/es/src/charts/LinePlot/index.js +1 -2
- package/es/src/charts/LinePlot/index.js.map +1 -1
- package/es/src/charts/Matrix/emit.js +6 -0
- package/es/src/charts/Matrix/emit.js.map +1 -1
- package/es/src/charts/Matrix/index.js +1 -2
- package/es/src/charts/Matrix/index.js.map +1 -1
- package/es/src/charts/Network/applyLayout.js +52 -4
- package/es/src/charts/Network/applyLayout.js.map +1 -1
- package/es/src/charts/Network/emit.js +61 -27
- package/es/src/charts/Network/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +40 -55
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +40 -2
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +14 -2
- package/es/src/charts/Pack/index.js.map +1 -1
- package/es/src/charts/Pie/applyLayout.js +20 -2
- package/es/src/charts/Pie/applyLayout.js.map +1 -1
- package/es/src/charts/Pie/emit.js +277 -32
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +47 -3
- package/es/src/charts/Pie/index.js.map +1 -1
- package/es/src/charts/Plot/discreteSpan.js +42 -0
- package/es/src/charts/Plot/discreteSpan.js.map +1 -0
- package/es/src/charts/Plot/draw.js +3 -1
- package/es/src/charts/Plot/draw.js.map +1 -1
- package/es/src/charts/Plot/index.js +152 -17
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +48 -22
- package/es/src/charts/Plot/pipeline.js.map +1 -1
- package/es/src/charts/Plot/pipelineDomains.js +84 -8
- package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
- package/es/src/charts/Plot/plotZoom.js +278 -0
- package/es/src/charts/Plot/plotZoom.js.map +1 -0
- package/es/src/charts/Plot/shapeDefaults.js +3 -3
- package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
- package/es/src/charts/Plot/sharedHover.js +431 -0
- package/es/src/charts/Plot/sharedHover.js.map +1 -0
- package/es/src/charts/Plot/sharedHoverScene.js +230 -0
- package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
- package/es/src/charts/Plot/sharedTooltip.js +163 -0
- package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
- package/es/src/charts/Plot/stackShareLabels.js +137 -0
- package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
- package/es/src/charts/Plot/stackShareTooltip.js +31 -0
- package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
- package/es/src/charts/Plot/trendLines.js +367 -0
- package/es/src/charts/Plot/trendLines.js.map +1 -0
- package/es/src/charts/Plot/trendScene.js +220 -0
- package/es/src/charts/Plot/trendScene.js.map +1 -0
- package/es/src/charts/Plot/trendTooltip.js +160 -0
- package/es/src/charts/Plot/trendTooltip.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +36 -3
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/Priestley/index.js +1 -2
- package/es/src/charts/Priestley/index.js.map +1 -1
- package/es/src/charts/Radar/emit.js +4 -1
- package/es/src/charts/Radar/emit.js.map +1 -1
- package/es/src/charts/Radar/index.js +16 -4
- package/es/src/charts/Radar/index.js.map +1 -1
- package/es/src/charts/RadialMatrix/emit.js +6 -0
- package/es/src/charts/RadialMatrix/emit.js.map +1 -1
- package/es/src/charts/RadialMatrix/index.js +18 -3
- package/es/src/charts/RadialMatrix/index.js.map +1 -1
- package/es/src/charts/Rings/applyLayout.js +72 -116
- package/es/src/charts/Rings/applyLayout.js.map +1 -1
- package/es/src/charts/Rings/emit.js +75 -10
- package/es/src/charts/Rings/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +24 -5
- package/es/src/charts/Rings/index.js.map +1 -1
- package/es/src/charts/Rings/ringsSizing.js +189 -0
- package/es/src/charts/Rings/ringsSizing.js.map +1 -0
- package/es/src/charts/Sankey/emit.js +55 -11
- package/es/src/charts/Sankey/emit.js.map +1 -1
- package/es/src/charts/Sankey/index.js +8 -2
- package/es/src/charts/Sankey/index.js.map +1 -1
- package/es/src/charts/StackedArea/index.js +9 -3
- package/es/src/charts/StackedArea/index.js.map +1 -1
- package/es/src/charts/Tree/emit.js +10 -4
- package/es/src/charts/Tree/emit.js.map +1 -1
- package/es/src/charts/Tree/index.js +6 -5
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/emit.js +56 -3
- package/es/src/charts/Treemap/emit.js.map +1 -1
- package/es/src/charts/Treemap/index.js +1 -2
- package/es/src/charts/Treemap/index.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/definition/makeChart.js +8 -1
- package/es/src/charts/definition/makeChart.js.map +1 -1
- package/es/src/charts/drawSteps/backControl.js +85 -0
- package/es/src/charts/drawSteps/backControl.js.map +1 -0
- package/es/src/charts/drawSteps/bottomRightControls.js +193 -0
- package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +161 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js +108 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js.map +1 -0
- package/es/src/charts/drawSteps/minimap.js +395 -0
- package/es/src/charts/drawSteps/minimap.js.map +1 -0
- package/es/src/charts/drawSteps/minimapMarkup.js +147 -0
- package/es/src/charts/drawSteps/minimapMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/searchControls.js +358 -0
- package/es/src/charts/drawSteps/searchControls.js.map +1 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js +430 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/tableView.js +173 -0
- package/es/src/charts/drawSteps/tableView.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewControl.js +39 -0
- package/es/src/charts/drawSteps/tableViewControl.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js +647 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControls.js +73 -0
- package/es/src/charts/drawSteps/topLeftControls.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js +227 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/zoomControls.js +317 -175
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/drawSteps/zoomControlsMarkup.js +280 -0
- package/es/src/charts/drawSteps/zoomControlsMarkup.js.map +1 -0
- package/es/src/charts/events/click.shape.js +24 -1
- package/es/src/charts/events/click.shape.js.map +1 -1
- package/es/src/charts/events/mouseenter.js +3 -0
- package/es/src/charts/events/mouseenter.js.map +1 -1
- package/es/src/charts/events/mouseleave.js +3 -0
- package/es/src/charts/events/mouseleave.js.map +1 -1
- package/es/src/charts/events/mousemove.shape.js +2 -0
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/features/attributionFeature.js +137 -0
- package/es/src/charts/features/attributionFeature.js.map +1 -0
- package/es/src/charts/features/axes.js +24 -9
- package/es/src/charts/features/axes.js.map +1 -1
- package/es/src/charts/features/chartGeometry.js +16 -2
- package/es/src/charts/features/chartGeometry.js.map +1 -1
- package/es/src/charts/features/edgeArrows.js +155 -0
- package/es/src/charts/features/edgeArrows.js.map +1 -0
- package/es/src/charts/features/emitHelpers.js +32 -0
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/ensureZoomDom.js +63 -12
- package/es/src/charts/features/ensureZoomDom.js.map +1 -1
- package/es/src/charts/features/features.js +89 -112
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresLegend.js +53 -17
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/plotPaint.js +81 -29
- package/es/src/charts/features/plotPaint.js.map +1 -1
- package/es/src/charts/features/shapeEmit.js +20 -2
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/features/zoomExtent.js +185 -0
- package/es/src/charts/features/zoomExtent.js.map +1 -0
- package/es/src/charts/helpers/tileAttributions.js +26 -0
- package/es/src/charts/helpers/tileAttributions.js.map +1 -1
- package/es/src/charts/index.js +2 -0
- package/es/src/charts/index.js.map +1 -1
- package/es/src/charts/pipeline/drillMorph.js +159 -0
- package/es/src/charts/pipeline/drillMorph.js.map +1 -0
- package/es/src/charts/pipeline/runChartDraw.js +35 -1
- package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
- package/es/src/charts/pipeline/runVizPipeline.js +49 -15
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/pipeline/vizDrawPure.js +52 -6
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
- package/es/src/charts/viz/Viz.js +103 -59
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBase.js +186 -5
- package/es/src/charts/viz/VizBase.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +41 -3
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/ordinalColor.js +2 -2
- package/es/src/charts/viz/ordinalColor.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +270 -58
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizRender.js +54 -4
- package/es/src/charts/viz/vizRender.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/charts/viz/vizVisibility.js +145 -0
- package/es/src/charts/viz/vizVisibility.js.map +1 -0
- package/es/src/components/Axis/Axis.js +18 -9
- package/es/src/components/Axis/Axis.js.map +1 -1
- package/es/src/components/Axis/axisLayoutLabels.js +2 -1
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
- package/es/src/components/Axis/axisRender.js +5 -1
- package/es/src/components/Axis/axisRender.js.map +1 -1
- package/es/src/components/ColorScale/ColorScale.js +11 -11
- package/es/src/components/ColorScale/ColorScale.js.map +1 -1
- package/es/src/components/ColorScale/colorScaleScale.js +22 -10
- package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
- package/es/src/components/Legend/Legend.js +8 -5
- package/es/src/components/Legend/Legend.js.map +1 -1
- package/es/src/components/Legend/legendConfig.js +87 -21
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/components/Legend/legendRender.js +29 -22
- package/es/src/components/Legend/legendRender.js.map +1 -1
- package/es/src/components/SizeLegend/SizeLegend.js +411 -0
- package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
- package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
- package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
- package/es/src/components/Timeline/timelineConfig.js +8 -4
- package/es/src/components/Timeline/timelineConfig.js.map +1 -1
- package/es/src/components/Timeline/timelineRender.js +1 -2
- package/es/src/components/Timeline/timelineRender.js.map +1 -1
- package/es/src/components/Tooltip.js +27 -7
- package/es/src/components/Tooltip.js.map +1 -1
- package/es/src/components/index.js +1 -0
- package/es/src/components/index.js.map +1 -1
- package/es/src/shapes/Box.js +4 -2
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Shape.js +1 -1
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +3 -2
- package/es/src/shapes/Whisker.js.map +1 -1
- package/es/src/shapes/validateShapeConfig.js +141 -0
- package/es/src/shapes/validateShapeConfig.js.map +1 -0
- package/es/src/utils/BaseClass.js +134 -4
- package/es/src/utils/BaseClass.js.map +1 -1
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/es/src/utils/configDefault.js +17 -0
- package/es/src/utils/configDefault.js.map +1 -0
- package/es/src/utils/configPrep.js +2 -1
- package/es/src/utils/configPrep.js.map +1 -1
- package/es/src/utils/configWarnings.js +37 -0
- package/es/src/utils/configWarnings.js.map +1 -0
- package/es/src/utils/index.js +1 -0
- package/es/src/utils/index.js.map +1 -1
- package/package.json +13 -11
- package/types/index.d.ts +4 -4
- package/types/internal.d.ts +16 -2
- package/types/src/charts/BarChart/index.d.ts +2 -1
- package/types/src/charts/Chord/applyLayout.d.ts +43 -0
- package/types/src/charts/Chord/emit.d.ts +10 -0
- package/types/src/charts/Chord/index.d.ts +19 -0
- package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
- package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
- package/types/src/charts/Histogram/binData.d.ts +37 -0
- package/types/src/charts/Histogram/index.d.ts +14 -0
- package/types/src/charts/Network/applyLayout.d.ts +8 -0
- package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
- package/types/src/charts/Plot/index.d.ts +51 -3
- package/types/src/charts/Plot/pipeline.d.ts +14 -0
- package/types/src/charts/Plot/plotZoom.d.ts +65 -0
- package/types/src/charts/Plot/sharedHover.d.ts +79 -0
- package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +26 -0
- package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
- package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
- package/types/src/charts/Plot/trendLines.d.ts +70 -0
- package/types/src/charts/Plot/trendScene.d.ts +18 -0
- package/types/src/charts/Plot/trendTooltip.d.ts +19 -0
- package/types/src/charts/Rings/applyLayout.d.ts +9 -0
- package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
- package/types/src/charts/StackedArea/index.d.ts +2 -1
- package/types/src/charts/definition/ChartDefinition.d.ts +33 -1
- package/types/src/charts/definition/makeChart.d.ts +2 -1
- package/types/src/charts/drawSteps/backControl.d.ts +29 -0
- package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
- package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +108 -0
- package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
- package/types/src/charts/drawSteps/minimap.d.ts +19 -0
- package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
- package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
- package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
- package/types/src/charts/drawSteps/tableView.d.ts +23 -0
- package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
- package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
- package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
- package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
- package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
- package/types/src/charts/features/attributionFeature.d.ts +21 -0
- package/types/src/charts/features/axes.d.ts +1 -1
- package/types/src/charts/features/chartGeometry.d.ts +9 -3
- package/types/src/charts/features/edgeArrows.d.ts +92 -0
- package/types/src/charts/features/emitHelpers.d.ts +19 -0
- package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
- package/types/src/charts/features/features.d.ts +32 -17
- package/types/src/charts/features/featuresLegend.d.ts +15 -0
- package/types/src/charts/features/plotPaint.d.ts +40 -2
- package/types/src/charts/features/zoomExtent.d.ts +25 -0
- package/types/src/charts/index.d.ts +2 -0
- package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +14 -3
- package/types/src/charts/viz/Viz.d.ts +18 -1
- package/types/src/charts/viz/VizBase.d.ts +99 -4
- package/types/src/charts/viz/VizBaseConfig.d.ts +25 -3
- package/types/src/charts/viz/vizDefaults.d.ts +155 -0
- package/types/src/charts/viz/vizTypes.d.ts +204 -4
- package/types/src/charts/viz/vizVisibility.d.ts +34 -0
- package/types/src/components/Axis/Axis.d.ts +2 -0
- package/types/src/components/Legend/legendRender.d.ts +8 -2
- package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
- package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
- package/types/src/components/Tooltip.d.ts +18 -3
- package/types/src/components/index.d.ts +1 -0
- package/types/src/shapes/validateShapeConfig.d.ts +10 -0
- package/types/src/utils/BaseClass.d.ts +15 -1
- package/types/src/utils/D3plusConfig.d.ts +200 -8
- package/types/src/utils/configDefault.d.ts +11 -0
- package/types/src/utils/configWarnings.d.ts +28 -0
- package/types/src/utils/index.d.ts +2 -1
- package/umd/d3plus-core.full.js +44507 -35766
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +7073 -4410
- package/umd/d3plus-core.js +16718 -9634
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +4615 -2322
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FeatureModule } from "../features/features.js";
|
|
2
|
+
import type Viz from "../viz/Viz.js";
|
|
3
|
+
export declare function toggleTableView(viz: Viz): void;
|
|
4
|
+
export declare function changeTableViewPage(viz: Viz, dir: number): void;
|
|
5
|
+
/**
|
|
6
|
+
Clicking a column header: the same column toggles asc ↔ desc; a
|
|
7
|
+
different column starts at asc. Resets to page 0 — re-sorting while deep
|
|
8
|
+
in the pagination would otherwise strand the user on a page whose
|
|
9
|
+
contents just changed out from under them.
|
|
10
|
+
*/
|
|
11
|
+
export declare function changeTableViewSort(viz: Viz, column: string): void;
|
|
12
|
+
/**
|
|
13
|
+
Clicking the raw/aggregate toggle (`dataSourceButtonHtml` — only
|
|
14
|
+
rendered when the two actually differ). Resets to page 0, same reasoning
|
|
15
|
+
as `changeTableViewSort`: the row count itself changes underneath
|
|
16
|
+
whatever page was showing. Sort state is left alone — raw and aggregate
|
|
17
|
+
can have different column sets (an aggregate merge may add a computed
|
|
18
|
+
field the raw rows don't have, e.g. Pie's "share"), and
|
|
19
|
+
`sortedTableViewRows` already no-ops a sort whose column isn't among the
|
|
20
|
+
new source's columns, so there's nothing to actively reconcile.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toggleTableViewDataSource(viz: Viz): void;
|
|
23
|
+
export declare const tableViewFeature: FeatureModule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The table-view toggle's contribution to the shared top-left controls
|
|
3
|
+
panel (`topLeftControls.ts`) — the button that switches the chart to a
|
|
4
|
+
static, scrollable data table (`tableView.ts` owns the actual overlay).
|
|
5
|
+
|
|
6
|
+
Unlike `backContribution` (only shows with drill-down history), this one
|
|
7
|
+
contributes as long as `tableView` is enabled — REGARDLESS of whether
|
|
8
|
+
table view is currently active. While active, `tableView.ts`'s
|
|
9
|
+
chart-sized overlay panel paints on top of the entire chart (including
|
|
10
|
+
this shared panel), so this button becomes invisible and unreachable by
|
|
11
|
+
real pointer hit-testing; the overlay embeds its own copy of the same
|
|
12
|
+
button (see `tableViewOverlayHtml`) for the user to actually click to
|
|
13
|
+
switch back. Keeping this contribution constant means toggling table
|
|
14
|
+
view never has to touch the shared panel's composition — only the
|
|
15
|
+
separate overlay panel appears/disappears.
|
|
16
|
+
|
|
17
|
+
@module
|
|
18
|
+
*/
|
|
19
|
+
import type Viz from "../viz/Viz.js";
|
|
20
|
+
import type { Contribution } from "./topLeftControlsMarkup.js";
|
|
21
|
+
export declare function tableViewContribution(viz: Viz): Contribution | null;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Markup, styling, and state helpers for the table-view toggle button + the
|
|
3
|
+
data-table overlay it swaps in (sorting, CSV export, pagination).
|
|
4
|
+
|
|
5
|
+
The button's html (`tableViewButtonHtml`) is consumed two ways: as
|
|
6
|
+
`tableViewContribution`'s piece of the shared top-left controls panel
|
|
7
|
+
(`tableViewControl.ts`) while the chart is showing, and embedded at the
|
|
8
|
+
top of the full-chart data-table overlay (`tableView.ts`) while table
|
|
9
|
+
view is active — so a click there can toggle back. Kept as its own
|
|
10
|
+
module (rather than folded into `zoomControlsMarkup.ts`) because the two
|
|
11
|
+
features are independent chrome a chart can mix and match; sharing
|
|
12
|
+
styling *knobs* (config keys, defaults) between them would couple them
|
|
13
|
+
for no benefit. The button-painting *mechanism* is genuinely
|
|
14
|
+
feature-agnostic, though — `paintControlButton`/`resolveControlStyle`
|
|
15
|
+
come from the shared `controlButtonStyle.ts` (also used by zoom/back/
|
|
16
|
+
search), the same way `zoomControlsInset` and `topLeftControlsInset`
|
|
17
|
+
share the box-measuring pattern without sharing what they measure.
|
|
18
|
+
`overlayHost` is reused from `zoomControlsMarkup.ts`.
|
|
19
|
+
|
|
20
|
+
@module
|
|
21
|
+
*/
|
|
22
|
+
import type { DataPoint } from "@d3plus/data";
|
|
23
|
+
import type Viz from "../viz/Viz.js";
|
|
24
|
+
/** Table-view mode is per-chart state, read/written via `viz._tableView`. */
|
|
25
|
+
export declare function isTableView(viz: Viz): boolean;
|
|
26
|
+
export declare function setTableView(viz: Viz, value: boolean): void;
|
|
27
|
+
/** The current page (0-indexed) of the paginated data table. */
|
|
28
|
+
export declare function getTableViewPage(viz: Viz): number;
|
|
29
|
+
export declare function setTableViewPage(viz: Viz, value: number): void;
|
|
30
|
+
export type SortDirection = "asc" | "desc";
|
|
31
|
+
export interface TableViewSort {
|
|
32
|
+
column: string;
|
|
33
|
+
direction: SortDirection;
|
|
34
|
+
}
|
|
35
|
+
/** The data table's current sort column + direction, if any (`viz._tableViewSort`). */
|
|
36
|
+
export declare function getTableViewSort(viz: Viz): TableViewSort | undefined;
|
|
37
|
+
export declare function setTableViewSort(viz: Viz, value: TableViewSort | undefined): void;
|
|
38
|
+
export type TableViewDataSource = "raw" | "aggregate";
|
|
39
|
+
/** Which dataset the table currently shows: `viz._data` (raw) or `viz._filteredData` (aggregate, the default — matches the chart's own on-screen behavior). */
|
|
40
|
+
export declare function getTableViewDataSource(viz: Viz): TableViewDataSource;
|
|
41
|
+
export declare function setTableViewDataSource(viz: Viz, value: TableViewDataSource): void;
|
|
42
|
+
/** Paints the table-view button's inline style for its current state (base/hover/active) — see `paintControlButton`. */
|
|
43
|
+
export declare function paintTableViewButton(viz: Viz, btn: HTMLElement, hovered?: boolean): void;
|
|
44
|
+
/** The cheap, non-DOM signature capturing the button's resolved style — see `Contribution.styleSignature`. */
|
|
45
|
+
export declare function tableViewButtonStyleSignature(viz: Viz): string;
|
|
46
|
+
/** The toggle button's markup — a real `<button>` so host-page button styling applies once `tableViewControlClassName` disables the inline defaults. */
|
|
47
|
+
export declare function tableViewButtonHtml(viz: Viz): string;
|
|
48
|
+
/**
|
|
49
|
+
The chart's current data-table rows and their columns (the union of
|
|
50
|
+
every row's own keys — see `allColumns`), sorted per
|
|
51
|
+
`viz._tableViewSort` when set. Shared by the on-screen table (which
|
|
52
|
+
further paginates this) and CSV export (which exports it in full,
|
|
53
|
+
unpaginated) — both automatically follow whichever data source
|
|
54
|
+
`dataSourceButtonHtml`'s toggle currently selects.
|
|
55
|
+
|
|
56
|
+
Source: `viz._filteredData` (aggregate — what's actually charted) by
|
|
57
|
+
default, or `viz._data` (raw, untouched input) once the toggle picks
|
|
58
|
+
"raw" — guarded by `hasDistinctRawData` so a stale `_tableViewDataSource`
|
|
59
|
+
from a previous, genuinely-different dataset can't silently switch a
|
|
60
|
+
chart whose raw/aggregate happen to now coincide.
|
|
61
|
+
|
|
62
|
+
Absent an explicit column sort, the AGGREGATE source is further
|
|
63
|
+
reordered (`defaultRowOrder`) to match the chart's original `.data()`
|
|
64
|
+
insertion order — raw is already in that order by definition, so it's
|
|
65
|
+
skipped there.
|
|
66
|
+
*/
|
|
67
|
+
export declare function sortedTableViewRows(viz: Viz): {
|
|
68
|
+
rows: DataPoint[];
|
|
69
|
+
columns: string[];
|
|
70
|
+
};
|
|
71
|
+
/** One page of rows, clamped/derived from `tableViewPageSize` + the current `_tableViewPage`. Clamps and writes back the page so it can't drift out of range as data/sort changes. Exported so `setupTableViewVirtualization` can re-derive the identical slice `tableViewOverlayHtml` built. */
|
|
72
|
+
export declare function paginate(viz: Viz, rows: DataPoint[]): {
|
|
73
|
+
slice: DataPoint[];
|
|
74
|
+
page: number;
|
|
75
|
+
totalPages: number;
|
|
76
|
+
start: number;
|
|
77
|
+
end: number;
|
|
78
|
+
total: number;
|
|
79
|
+
};
|
|
80
|
+
/** Whether a chart shows the table-view toggle button. */
|
|
81
|
+
export declare function showsTableView(viz: Viz): boolean;
|
|
82
|
+
/**
|
|
83
|
+
The full data-table overlay's markup: a toolbar (the toggle button, —
|
|
84
|
+
unless disabled — a "download CSV" button, and — only when raw and
|
|
85
|
+
aggregate data actually differ — the raw/aggregate source toggle), a
|
|
86
|
+
scrollable table with a sticky, click-to-sort header, and — when the
|
|
87
|
+
data doesn't fit on one page — Prev/Next pagination. Columns come from
|
|
88
|
+
the union of every row's own keys; every value is escaped, since it's
|
|
89
|
+
caller-supplied data landing in `innerHTML`.
|
|
90
|
+
*/
|
|
91
|
+
export declare function tableViewOverlayHtml(viz: Viz): string;
|
|
92
|
+
/** Builds the CSV and triggers a browser download of the chart's full (sorted, unpaginated) data-table rows. */
|
|
93
|
+
export declare function downloadTableViewCsv(viz: Viz): void;
|
|
94
|
+
/**
|
|
95
|
+
Paints every `.table-view-control` button's inline style (base/active,
|
|
96
|
+
plus hover — which can't be delegated like click, since mouseenter/
|
|
97
|
+
mouseleave don't bubble) once per button DOM node, guarded by
|
|
98
|
+
`data-table-view-bound` the same way `buildZoomControlPanel`'s
|
|
99
|
+
`onUpdate` guards its four buttons. Shared by `tableViewContribution`
|
|
100
|
+
(the shared top-left panel's lone toggle button) and `tableView.ts`'s
|
|
101
|
+
full overlay (whose toolbar has both the toggle and the download button).
|
|
102
|
+
*/
|
|
103
|
+
export declare function bindTableViewButton(host: HTMLElement, viz: Viz): void;
|
|
104
|
+
/** Wires both the toolbar buttons and (when applicable) row virtualization for the full data-table overlay. */
|
|
105
|
+
export declare function bindTableViewOverlay(host: HTMLElement, viz: Viz): void;
|
|
106
|
+
/**
|
|
107
|
+
Reflects the current active state onto the shared top-left panel's
|
|
108
|
+
toggle button DOM directly — mirrors `syncBrushButton`. Needed because
|
|
109
|
+
toggling table view deliberately does NOT rebuild the shared panel (see
|
|
110
|
+
`refreshTableViewOverlay` in `tableView.ts`: `tableViewContribution`'s
|
|
111
|
+
html bakes in `isTableView(viz)` at the time THAT panel was last built,
|
|
112
|
+
which only happens on a full `_preDraw`/`_draw` pass). Without this, the
|
|
113
|
+
shared panel's copy of the button can go visibly stale: activate table
|
|
114
|
+
view, let any unrelated full re-render happen while still active (a
|
|
115
|
+
resize, a `.data()` call), then deactivate via the overlay's OWN
|
|
116
|
+
embedded copy of the button — the shared one, now uncovered again,
|
|
117
|
+
would otherwise still read "active" until the next full re-render.
|
|
118
|
+
*/
|
|
119
|
+
export declare function syncSharedTableViewButton(viz: Viz): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@name topLeftControlsFeature
|
|
3
|
+
Shared top-left corner control panel — mirrors the top-right
|
|
4
|
+
zoom-controls panel's "N buttons, one flex-row `htmlOverlay` panel"
|
|
5
|
+
composition (`zoomControls.ts`/`zoomControlsMarkup.ts`), except fed by
|
|
6
|
+
independent contributor functions (`backContribution`,
|
|
7
|
+
`tableViewContribution`, `searchContribution`) rather than one feature's
|
|
8
|
+
own fixed button set. A downstream branch adding a new top-left control
|
|
9
|
+
appends its own contributor function to `TOP_LEFT_CONTRIBUTORS` — a
|
|
10
|
+
one-line diff, not a dynamic registry.
|
|
11
|
+
|
|
12
|
+
Runs as a post-draw `FeatureModule` (see `runVizPipeline`), the same
|
|
13
|
+
slot as `zoomFeature`/`attributionFeature`: it claims zero margin and
|
|
14
|
+
floats over whatever the chart already rendered. Content that needs to
|
|
15
|
+
avoid it (title/subtitle/total/legend) insets around the whole panel via
|
|
16
|
+
`topLeftControlsInset` (`topLeftControlsMarkup.ts`), the same way they
|
|
17
|
+
already inset around the zoom panel via `zoomControlsInset`.
|
|
18
|
+
|
|
19
|
+
@module
|
|
20
|
+
*/
|
|
21
|
+
import type { FeatureModule } from "../features/features.js";
|
|
22
|
+
import type Viz from "../viz/Viz.js";
|
|
23
|
+
import { type Contribution } from "./topLeftControlsMarkup.js";
|
|
24
|
+
export type { Contribution };
|
|
25
|
+
/**
|
|
26
|
+
Ordered list of contributors to the shared top-left panel. Order is
|
|
27
|
+
visual order (left to right).
|
|
28
|
+
*/
|
|
29
|
+
export declare const TOP_LEFT_CONTRIBUTORS: Array<(viz: Viz) => Contribution | null>;
|
|
30
|
+
/** The current, non-null contributions for a chart — computed once per layout/measurement. */
|
|
31
|
+
export declare function getTopLeftContributions(viz: Viz): Contribution[];
|
|
32
|
+
export declare const topLeftControlsFeature: FeatureModule;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Markup, styling, and measurement for the shared top-left controls panel —
|
|
3
|
+
the top-left mirror of `zoomControlsMarkup.ts`'s top-right zoom-control
|
|
4
|
+
panel. Kept separate from `topLeftControls.ts` (which owns the
|
|
5
|
+
`FeatureModule` + the contributor list) so this module has no dependency
|
|
6
|
+
on `../features/features.js` — `textBlockLayout`/`featuresLegend.ts`
|
|
7
|
+
import only from here, the same way they already import
|
|
8
|
+
`zoomControlsBox`/`zoomControlsInset` from `zoomControlsMarkup.ts` rather
|
|
9
|
+
than from `zoomControls.ts`.
|
|
10
|
+
|
|
11
|
+
@module
|
|
12
|
+
*/
|
|
13
|
+
import type { SceneNode } from "@d3plus/render";
|
|
14
|
+
import type Viz from "../viz/Viz.js";
|
|
15
|
+
/**
|
|
16
|
+
One control's contribution to the shared panel: its markup, its
|
|
17
|
+
delegated event handlers (keyed by its own CSS selector, so independent
|
|
18
|
+
contributors never collide), and an optional `onUpdate` for listeners
|
|
19
|
+
that can't be delegated (mirrors `HtmlOverlayNode`'s own shape — see
|
|
20
|
+
`zoomControls.ts`'s `buildZoomControlPanel` for the pattern this panel
|
|
21
|
+
generalizes from one feature's four buttons to N independent features).
|
|
22
|
+
*/
|
|
23
|
+
export interface Contribution {
|
|
24
|
+
key: string;
|
|
25
|
+
html: string;
|
|
26
|
+
/**
|
|
27
|
+
A cheap, non-DOM string capturing anything besides `html` that can
|
|
28
|
+
change this contribution's rendered size — its resolved button style
|
|
29
|
+
object, typically (`JSON.stringify(...)`, mirroring how
|
|
30
|
+
`zoomControlsBox` folds its own resolved style into its signature).
|
|
31
|
+
Without this, a style-only change (e.g. `.searchControlStyle({width:
|
|
32
|
+
'60px'})`) wouldn't invalidate the measurement cache below, since the
|
|
33
|
+
*markup* (`html`) wouldn't have changed. Optional: a contribution
|
|
34
|
+
whose rendered size never varies with config can omit it.
|
|
35
|
+
*/
|
|
36
|
+
styleSignature?: string;
|
|
37
|
+
events?: Record<string, Partial<Record<string, (e: Event) => void>>>;
|
|
38
|
+
onUpdate?: (host: HTMLElement) => void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
Builds the shared panel as a GROUP of independent `htmlOverlay` nodes,
|
|
42
|
+
one per contribution, rather than one node holding every contribution's
|
|
43
|
+
markup concatenated together. `@d3plus/render`'s overlay diff replaces
|
|
44
|
+
an `htmlOverlay` node's ENTIRE `innerHTML` whenever its `html` string
|
|
45
|
+
changes — with one shared node, back appearing (its own html changing)
|
|
46
|
+
would rewrite the whole panel's DOM, destroying and recreating search's
|
|
47
|
+
`<input>` along with it and silently dropping its focus/cursor position
|
|
48
|
+
mid-type. Separate nodes mean each contribution's DOM subtree is only
|
|
49
|
+
ever touched by ITS OWN html changing.
|
|
50
|
+
*/
|
|
51
|
+
export declare function buildTopLeftPanel(viz: Viz, contributions: Contribution[]): SceneNode | null;
|
|
52
|
+
/**
|
|
53
|
+
The shared top-left panel's rendered size (padding included) as it will
|
|
54
|
+
render in the chart's page, so top-positioned content can leave room for
|
|
55
|
+
it — the same measure-a-hidden-probe technique `zoomControlsBox` uses,
|
|
56
|
+
generalized to whichever mix of controls (back / table-view / search)
|
|
57
|
+
is currently contributing, and to each contribution's OWN resolved
|
|
58
|
+
button styling (not just its markup). Returns null when nothing is
|
|
59
|
+
contributing.
|
|
60
|
+
*/
|
|
61
|
+
export declare function topLeftControlsBox(viz: Viz, contributions: Contribution[]): {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
} | null;
|
|
65
|
+
/**
|
|
66
|
+
How far content starting `top` px down the chart, whose left edge sits
|
|
67
|
+
`left` px in from the chart's left edge, must pull in its left edge to
|
|
68
|
+
clear the top-left controls panel. Zero when nothing is showing there or
|
|
69
|
+
content starts below the panel's height. Mirrors `zoomControlsInset`,
|
|
70
|
+
measuring/insetting from the left instead of the right.
|
|
71
|
+
*/
|
|
72
|
+
export declare function topLeftControlsInset(viz: Viz, top: number, left: number, contributions: Contribution[]): number;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { ZoomTransform } from "d3-zoom";
|
|
1
2
|
import type { FeatureModule } from "../features/features.js";
|
|
3
|
+
import type Viz from "../viz/Viz.js";
|
|
2
4
|
/**
|
|
3
5
|
@name zoomFeature
|
|
4
6
|
Sets up zoom + brush event behaviors and the zoom-control buttons.
|
|
@@ -15,13 +17,51 @@ import type { FeatureModule } from "../features/features.js";
|
|
|
15
17
|
the SVG element directly via `viz._container.call(zoomBehavior)`.
|
|
16
18
|
2. Returns the four control buttons (in/out/reset/brush) as an
|
|
17
19
|
`htmlOverlay` scene-node panel; `runVizPipeline` appends it to
|
|
18
|
-
`viz._featurePanels`. `
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
`viz._featurePanels`. `onUpdate` is the scene's interactive-HTML
|
|
21
|
+
escape hook: it wires the hover handlers + applies the user's
|
|
22
|
+
zoomControl style configs, once per button DOM node (guarded by a
|
|
23
|
+
`data-zoom-bound` marker). Click handling instead rides the
|
|
24
|
+
declarative `events` map, which the renderer delegates from the
|
|
25
|
+
host element, so it survives DOM churn with no extra bookkeeping.
|
|
26
|
+
`onUpdate` (rather than `onMount`) matters because the html string
|
|
27
|
+
below isn't a fixed constant — it bakes in `zoomControlClassName`,
|
|
28
|
+
the active locale's translated `aria-label`s, and the current brush
|
|
29
|
+
state, so a `.locale(...)` or `.zoomControlClassName(...)` call
|
|
30
|
+
replaces the button nodes on the next draw. Renderers only rewrite
|
|
31
|
+
`innerHTML` when the string actually differs from the last-written
|
|
32
|
+
value, so the common case (nothing changed) is a cheap no-op.
|
|
26
33
|
*/
|
|
27
34
|
export declare const zoomFeature: FeatureModule;
|
|
35
|
+
/**
|
|
36
|
+
Canvas backend: once the scene is painted (so the <canvas> exists), bind
|
|
37
|
+
d3-zoom to it. The compute <svg> overlaying the canvas is transparent to
|
|
38
|
+
pointer events there, so the canvas is the sole interaction surface —
|
|
39
|
+
CanvasRenderer's pick drives tooltips and d3-zoom drives pan/zoom on the
|
|
40
|
+
same element. Called after every canvas paint; a no-op once bound.
|
|
41
|
+
*/
|
|
42
|
+
export declare function bindCanvasZoom(viz: Viz): void;
|
|
43
|
+
/**
|
|
44
|
+
Routes pointer events between the chart surface and the zoom brush.
|
|
45
|
+
While brush mode is on, the outer <svg> goes transparent to pointer
|
|
46
|
+
events and only the brush group opts back in, so a drag anywhere over the
|
|
47
|
+
chart (shapes included) reaches the brush rather than a shape. On the
|
|
48
|
+
Canvas backend the compute <svg> stays transparent otherwise, so the
|
|
49
|
+
<canvas> beneath is the interaction surface.
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyZoomPointerEvents(viz: Viz): void;
|
|
52
|
+
/**
|
|
53
|
+
The current zoom transform re-expressed for content inside `_container`,
|
|
54
|
+
which sits at the chart's margin offset rather than at the surface origin
|
|
55
|
+
the zoom behavior measures from (Geomap's imperative tile layer).
|
|
56
|
+
*/
|
|
57
|
+
export declare function tileZoomTransform(viz: Viz): ZoomTransform;
|
|
58
|
+
/**
|
|
59
|
+
Applies a programmatic zoom: clamps the scale to `scaleExtent` and the
|
|
60
|
+
translate to `translateExtent` (the constraint d3-zoom enforces for
|
|
61
|
+
pointer gestures), records it as the bound element's zoom state so the
|
|
62
|
+
next wheel/drag continues from here, and paints it.
|
|
63
|
+
|
|
64
|
+
Exported so `minimap.ts`'s drag-to-pan and Cmd/Ctrl+scroll-to-zoom can
|
|
65
|
+
reuse the same scale/translate clamping instead of reimplementing it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function zoomTo(viz: Viz, scale: number, x: number, y: number, duration?: number): void;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Markup, styling, and measurement for the zoom-control button panel —
|
|
3
|
+
shared by the zoom feature (which renders and wires the panel) and the
|
|
4
|
+
top-positioned layout features (title, subtitle, total, legend), which
|
|
5
|
+
measure the panel so their content can leave room for it.
|
|
6
|
+
|
|
7
|
+
@module
|
|
8
|
+
*/
|
|
9
|
+
import type Viz from "../viz/Viz.js";
|
|
10
|
+
import { kebab } from "./controlButtonStyle.js";
|
|
11
|
+
export { kebab };
|
|
12
|
+
/**
|
|
13
|
+
Brush mode is per-chart, not global: it lives on `viz._brushing` and is
|
|
14
|
+
read/written via these helpers.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isBrushing(viz: Viz): boolean;
|
|
17
|
+
export declare function setBrushing(viz: Viz, value: boolean): void;
|
|
18
|
+
/** Paints a zoom-control button's inline style for its current state (base/hover/active) — see `paintControlButton`. */
|
|
19
|
+
export declare function paintZoomButton(viz: Viz, btn: HTMLElement, hovered?: boolean): void;
|
|
20
|
+
/**
|
|
21
|
+
Shared attributes for the four icon `<svg>`s below: one `viewBox`, one
|
|
22
|
+
`stroke-width`, `currentColor` for the stroke (so the icon still follows
|
|
23
|
+
`color` from `zoomControlStyle`/a host page's CSS, same as the glyph
|
|
24
|
+
characters this replaced). Sizing and `vertical-align: middle` live in
|
|
25
|
+
the `style` attribute rather than as `width`/`height` SVG attributes —
|
|
26
|
+
plenty of CSS resets (Bulma's base stylesheet, for one) include a plain
|
|
27
|
+
`svg { width: auto; height: auto }` rule, and *any* CSS declaration beats
|
|
28
|
+
a presentation attribute. An SVG with only a `viewBox` and no definite
|
|
29
|
+
CSS size can collapse to 0×0 inside a flex layout, which is exactly what
|
|
30
|
+
happened here — an inline `style` has enough specificity that no host
|
|
31
|
+
page's element-selector reset can strip it back out. `vertical-align:
|
|
32
|
+
middle` matters because an inline `svg` defaults to `vertical-align:
|
|
33
|
+
baseline` like text, which sits it a couple pixels off-center inside a
|
|
34
|
+
host page's own button styling (Bootstrap/Tailwind/Bulma center *text*
|
|
35
|
+
via their own line-height/padding, not a replaced element's baseline).
|
|
36
|
+
`zoomControlClassName` intentionally drops our own `align-items`/
|
|
37
|
+
`justify-content` centering so it doesn't fight a framework's layout —
|
|
38
|
+
`vertical-align: middle` is what keeps the icon itself centered
|
|
39
|
+
regardless of whose CSS is doing the centering. `flex-shrink: 0` guards
|
|
40
|
+
against a different failure mode: if a host framework's own button
|
|
41
|
+
(Bulma's `.button`, for one) is itself `display: flex` with padding wide
|
|
42
|
+
enough to leave less than 12px of content room, the icon — a flex item
|
|
43
|
+
of that button — would otherwise shrink to fit, quietly distorting it
|
|
44
|
+
into a non-square sliver instead of keeping its aspect ratio.
|
|
45
|
+
|
|
46
|
+
Text-glyph icons (`+`, `−`, a Unicode home/square symbol, …) come from
|
|
47
|
+
different font fallback chains, and browsers apply synthetic bold to
|
|
48
|
+
each inconsistently — no single font reliably bolds all of them to the
|
|
49
|
+
same visual stroke thickness across OSes. Vector paths sidestep that
|
|
50
|
+
entirely: every icon renders at the exact same stroke weight regardless
|
|
51
|
+
of the visitor's font/OS/browser (and all four share the same 4–20
|
|
52
|
+
bounding box within the 24x24 viewBox, so they also match in apparent
|
|
53
|
+
size) — this is how icon sets like Feather/Lucide/Material Symbols do it.
|
|
54
|
+
*/
|
|
55
|
+
export declare const ICON_ATTRS = "viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"width:12px;height:12px;vertical-align:middle;flex-shrink:0\"";
|
|
56
|
+
/**
|
|
57
|
+
A custom zoom-control icon: either raw markup (a string — inserted as the
|
|
58
|
+
button's content in place of the built-in `<svg>`, no wrapper) or a mount
|
|
59
|
+
function, the escape hatch for a live component (a React/Vue/Svelte tree,
|
|
60
|
+
a canvas sprite, anything imperative). The function receives the actual
|
|
61
|
+
`<span>` reserved for the icon — sized to match the built-ins, 12x12px —
|
|
62
|
+
once per fresh button element (see `mountCustomIcons` below), and may
|
|
63
|
+
return a cleanup function, called right before that element is discarded
|
|
64
|
+
(the panel's html regenerates wholesale on a brush toggle, a `.locale(...)`
|
|
65
|
+
change, or a `zoomControlClassName` change — see `zoomControlsHtml`'s own
|
|
66
|
+
doc — so a mounted icon is torn down and remounted on those, not just once
|
|
67
|
+
per chart). Omit the return value for icons with nothing to clean up.
|
|
68
|
+
|
|
69
|
+
@example
|
|
70
|
+
// Raw markup — a single emoji.
|
|
71
|
+
viz.zoomControlIcons({zoomIn: "➕"})
|
|
72
|
+
|
|
73
|
+
// A React tree, mounted imperatively into the reserved slot.
|
|
74
|
+
viz.zoomControlIcons({
|
|
75
|
+
zoomIn: el => {
|
|
76
|
+
const root = createRoot(el);
|
|
77
|
+
root.render(<PlusIcon />);
|
|
78
|
+
return () => root.unmount();
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
*/
|
|
82
|
+
export type ZoomControlIconRenderer = (el: HTMLElement) => void | (() => void);
|
|
83
|
+
export type ZoomControlIconValue = string | ZoomControlIconRenderer;
|
|
84
|
+
export type ZoomControlIconKey = "zoomIn" | "zoomOut" | "zoomReset" | "zoomBrush";
|
|
85
|
+
export type ZoomControlIcons = Partial<Record<ZoomControlIconKey, ZoomControlIconValue>>;
|
|
86
|
+
/**
|
|
87
|
+
The panel's own layout: a right-aligned flex row. Spacing lives here, not
|
|
88
|
+
on the buttons — per-button `margin` doesn't collapse between flex
|
|
89
|
+
siblings, so two adjacent 4px margins would add up to an 8px gap. A
|
|
90
|
+
container `gap` gives exactly one 4px gap between each pair, and
|
|
91
|
+
`padding` (with `box-sizing: border-box`) one 4px inset from the chart's
|
|
92
|
+
top/right edge. This isn't part of the auto-disable `zoomControlClassName`
|
|
93
|
+
triggers, so a host page never has to re-add its own spacing utility.
|
|
94
|
+
*/
|
|
95
|
+
export declare const ZOOM_PANEL_STYLE: Record<string, string>;
|
|
96
|
+
/**
|
|
97
|
+
The four buttons' markup. Real <button>s (not <div>s) so a host page's own
|
|
98
|
+
button styling (Tailwind, Bootstrap, a design system's global `button`
|
|
99
|
+
reset) applies through the cascade once a `zoomControlClassName`
|
|
100
|
+
auto-disables the inline defaults. `zoomControlClassName` layers a
|
|
101
|
+
consumer's own class onto each button without losing the fixed classes
|
|
102
|
+
event delegation depends on. The brush toggle carries `aria-pressed` (and
|
|
103
|
+
the `.active` class frameworks like Bootstrap style) while brush mode is on.
|
|
104
|
+
*/
|
|
105
|
+
export declare function zoomControlsHtml(viz: Viz): string;
|
|
106
|
+
/**
|
|
107
|
+
Mounts each configured custom icon function into its button's reserved
|
|
108
|
+
slot — called once per fresh button element (from the same `onUpdate`
|
|
109
|
+
guard in `zoomControls.ts` that binds hover/style exactly once), so a
|
|
110
|
+
remount only happens when the whole panel's html actually regenerates
|
|
111
|
+
(see `ZoomControlIconRenderer`'s doc for when that is). Runs any PREVIOUS
|
|
112
|
+
mount's cleanup for that icon key first — the prior button element (if
|
|
113
|
+
any) is about to be discarded regardless of whether its content was
|
|
114
|
+
custom-mounted, so this is the one place that teardown can happen.
|
|
115
|
+
*/
|
|
116
|
+
export declare function mountCustomIcons(viz: Viz, btn: HTMLElement): void;
|
|
117
|
+
/** The HTML element a chart's overlays (the zoom controls) mount in. */
|
|
118
|
+
export declare function overlayHost(viz: Viz): HTMLElement | null;
|
|
119
|
+
/**
|
|
120
|
+
Reflects the brush mode onto the brush toggle button (its `.active`
|
|
121
|
+
class, `aria-pressed`, and active style) when the mode changes without
|
|
122
|
+
a click on the button itself — e.g. leaving brush mode after a selection.
|
|
123
|
+
*/
|
|
124
|
+
export declare function syncBrushButton(viz: Viz): void;
|
|
125
|
+
/** Whether a chart shows the zoom-control panel. */
|
|
126
|
+
export declare function showsZoomControls(viz: Viz): boolean;
|
|
127
|
+
/**
|
|
128
|
+
The zoom-control panel's size (padding included) as it will render in the
|
|
129
|
+
chart's page, so top-positioned content can leave room for it. Measured
|
|
130
|
+
by mounting a hidden copy beside the chart — the buttons' size depends on
|
|
131
|
+
the host page's CSS (a `zoomControlClassName`, a global `button` reset) —
|
|
132
|
+
and cached until the markup or styling changes. Returns null when the
|
|
133
|
+
chart shows no controls.
|
|
134
|
+
*/
|
|
135
|
+
export declare function zoomControlsBox(viz: Viz): {
|
|
136
|
+
width: number;
|
|
137
|
+
height: number;
|
|
138
|
+
} | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The tile/data credit, an HTML overlay in the chart area's bottom-right
|
|
3
|
+
corner. It sits outside the SVG plane, so rather than encode it into the
|
|
4
|
+
scene graph this feature creates it imperatively from inside `layout()`
|
|
5
|
+
(funneled through `runLayout` like the other features); it claims zero
|
|
6
|
+
margin and emits no panel.
|
|
7
|
+
|
|
8
|
+
A credit that would take up more than half the chart's width collapses to
|
|
9
|
+
an ⓘ badge that expands on hover, focus, or click — the compact
|
|
10
|
+
attribution modern web maps use — so a long required credit (Esri's
|
|
11
|
+
basemap credit, for one) doesn't lay a banner across a small map.
|
|
12
|
+
|
|
13
|
+
The badge is an inline SVG by default; `attributionIcon` overrides it with
|
|
14
|
+
raw HTML or a mount function (a live component escape hatch — see its doc
|
|
15
|
+
and `zoomControlsMarkup.ts`'s matching `zoomControlIcons`, which this
|
|
16
|
+
mirrors).
|
|
17
|
+
|
|
18
|
+
@module
|
|
19
|
+
*/
|
|
20
|
+
import type { FeatureModule } from "./features.js";
|
|
21
|
+
export declare const attributionFeature: FeatureModule;
|
|
@@ -130,5 +130,5 @@ export declare function measureAxes(viz: Viz, inputs: AxisMeasureInputs, measure
|
|
|
130
130
|
bumps the line labels, and queues axis scenes for the emit phase.
|
|
131
131
|
Returns everything `plotEmit` needs to consume.
|
|
132
132
|
*/
|
|
133
|
-
export declare function renderAxes(viz: Viz, pCtx: PlotPaintContext): PlotMeasureResult;
|
|
133
|
+
export declare function renderAxes(viz: Viz, pCtx: PlotPaintContext, frozen?: PlotMeasureResult): PlotMeasureResult;
|
|
134
134
|
export {};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
@module
|
|
18
18
|
*/
|
|
19
|
-
import type { Transform } from "@d3plus/render";
|
|
19
|
+
import type { ClipShape, Transform } from "@d3plus/render";
|
|
20
20
|
import type { VizInstance as Viz } from "../viz/vizTypes.js";
|
|
21
21
|
/**
|
|
22
22
|
Margin-adjusted chart-area dimensions. Replaces the pattern:
|
|
@@ -48,11 +48,17 @@ export declare function marginOriginTransform(viz: Viz): Transform;
|
|
|
48
48
|
y: this._margin.top + height / 2,
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
Used by Pie, Donut, RadialMatrix, Radar — every chart whose
|
|
52
|
-
lays out around a center point (polar / circular geometry).
|
|
51
|
+
Used by Pie, Donut, RadialMatrix, Radar, Chord — every chart whose
|
|
52
|
+
data lays out around a center point (polar / circular geometry).
|
|
53
53
|
|
|
54
54
|
Width and height are the margin-adjusted chart-area dimensions —
|
|
55
55
|
callers usually have them on hand from `chartBounds(viz)` or from
|
|
56
56
|
fields a stage stashed (e.g. `_pieWidth` / `_radialMatrixWidth`).
|
|
57
57
|
*/
|
|
58
58
|
export declare function centerChartTransform(viz: Viz, width: number, height: number): Transform;
|
|
59
|
+
/**
|
|
60
|
+
The chart area (the svg minus its margins) as a scene-space rect clip —
|
|
61
|
+
where zoomable content is clipped so pan/zoom can't spill it over the
|
|
62
|
+
legend, title, or timeline.
|
|
63
|
+
*/
|
|
64
|
+
export declare function chartAreaRect(viz: Viz): ClipShape;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Shared arrowhead geometry for edge charts (Network, Rings, Sankey).
|
|
3
|
+
|
|
4
|
+
Arrowheads are drawn as filled-triangle `path` scene nodes rather than SVG
|
|
5
|
+
`marker-end`, because d3plus renders to both SVG and Canvas and Canvas has no
|
|
6
|
+
marker support. Each chart computes the tip point + tangent angle from its own
|
|
7
|
+
edge geometry (edges terminate differently per chart) and calls `arrowNode`.
|
|
8
|
+
The triangle lives in the same content coordinate space as its edge, so it
|
|
9
|
+
pans/zooms and hover-dims in lockstep with the edge.
|
|
10
|
+
|
|
11
|
+
Chord doesn't use this module — its ribbons carry arrowheads via d3-chord's
|
|
12
|
+
`ribbonArrow`.
|
|
13
|
+
|
|
14
|
+
@module
|
|
15
|
+
*/
|
|
16
|
+
import type { DataPoint } from "@d3plus/data";
|
|
17
|
+
import type { SceneNode } from "@d3plus/render";
|
|
18
|
+
/** Which end(s) of an edge carry an arrowhead. `true` is equivalent to `"target"`. */
|
|
19
|
+
export type ArrowEndValue = boolean | "target" | "source" | "both";
|
|
20
|
+
/** The `arrows` config: a fixed value or a per-edge accessor. */
|
|
21
|
+
export type ArrowValue = ArrowEndValue | ((d: DataPoint, i: number) => ArrowEndValue);
|
|
22
|
+
/** Resolved per-edge arrow ends. */
|
|
23
|
+
export interface ArrowEnds {
|
|
24
|
+
source: boolean;
|
|
25
|
+
target: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Normalize an `arrows` config value for one edge into `{source, target}` flags. */
|
|
28
|
+
export declare function arrowEnds(arrows: ArrowValue, d: DataPoint, i: number): ArrowEnds;
|
|
29
|
+
/**
|
|
30
|
+
SVG path `d` for a filled isosceles triangle whose tip is at `(x, y)`, pointing
|
|
31
|
+
along `angle` (radians), with `size` the tip-to-base length.
|
|
32
|
+
*/
|
|
33
|
+
export declare function arrowPathD(x: number, y: number, angle: number, size: number): string;
|
|
34
|
+
/**
|
|
35
|
+
Tip point + direction for a straight-edge arrowhead sitting at the boundary of
|
|
36
|
+
an endpoint node (radius `r`), pointing from `(fromX, fromY)` toward
|
|
37
|
+
`(toX, toY)`. `gap` insets the tip slightly off the node edge. Used by Network
|
|
38
|
+
(center-to-center links) and Rings' straight center-links.
|
|
39
|
+
*/
|
|
40
|
+
export declare function straightArrowTip(fromX: number, fromY: number, toX: number, toY: number, r: number, gap?: number): {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
angle: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
Resolve the arrowhead size from the `arrowSize` config (a number or per-edge
|
|
47
|
+
accessor), falling back to a size derived from the edge's stroke width.
|
|
48
|
+
*/
|
|
49
|
+
export declare function arrowSizeFor(arrowSize: unknown, d: DataPoint, i: number, strokeWidth: number): number;
|
|
50
|
+
/**
|
|
51
|
+
Emit arrowhead nodes for a straight, center-to-center edge between two nodes
|
|
52
|
+
(radii `source.r`/`target.r`), insetting each tip to the node boundary.
|
|
53
|
+
Returns `[]` when `arrows` selects neither end. Used by Network and Rings'
|
|
54
|
+
straight center-links.
|
|
55
|
+
*/
|
|
56
|
+
export declare function straightEdgeArrows(opts: {
|
|
57
|
+
arrows: ArrowValue;
|
|
58
|
+
arrowSize: unknown;
|
|
59
|
+
strokeWidth?: number;
|
|
60
|
+
datum: DataPoint;
|
|
61
|
+
i: number;
|
|
62
|
+
keyPrefix: string;
|
|
63
|
+
fill?: string;
|
|
64
|
+
source: {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
r?: number;
|
|
68
|
+
};
|
|
69
|
+
target: {
|
|
70
|
+
x: number;
|
|
71
|
+
y: number;
|
|
72
|
+
r?: number;
|
|
73
|
+
};
|
|
74
|
+
}): SceneNode[];
|
|
75
|
+
/** Inputs for a single arrowhead scene node. */
|
|
76
|
+
export interface ArrowNodeOpts {
|
|
77
|
+
key: string | number;
|
|
78
|
+
datum: DataPoint;
|
|
79
|
+
x: number;
|
|
80
|
+
y: number;
|
|
81
|
+
/** Direction the arrow points, in radians. */
|
|
82
|
+
angle: number;
|
|
83
|
+
size: number;
|
|
84
|
+
fill?: string;
|
|
85
|
+
opacity?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
Build one arrowhead scene node. `interactive: false` so the edge path owns
|
|
89
|
+
hit-testing, and the same `datum` as its edge so the hover-dim pass keeps the
|
|
90
|
+
arrow paired with its edge.
|
|
91
|
+
*/
|
|
92
|
+
export declare function arrowNode(opts: ArrowNodeOpts): SceneNode;
|