@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,78 @@
|
|
|
1
|
+
function _type_of(obj) {
|
|
2
|
+
"@swc/helpers - typeof";
|
|
3
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
Light/dark basemaps. `tileUrl` and `ocean` accept either one value or a
|
|
7
|
+
`{light, dark}` pair; a pair resolves against the chart's backdrop each
|
|
8
|
+
draw, and the chart redraws when that backdrop flips.
|
|
9
|
+
|
|
10
|
+
@module
|
|
11
|
+
*/ import { lab } from "d3-color";
|
|
12
|
+
/** Esri's Canvas basemaps: muted, nearly label-free bases for data overlays. */ export var DEFAULT_TILE_URL = {
|
|
13
|
+
light: "https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}",
|
|
14
|
+
dark: "https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}"
|
|
15
|
+
};
|
|
16
|
+
/** The Canvas basemaps' own water colors, so the ocean around the tiles matches. */ export var DEFAULT_OCEAN = {
|
|
17
|
+
light: "#d0cfd4",
|
|
18
|
+
dark: "#222327"
|
|
19
|
+
};
|
|
20
|
+
var isPair = function isPair(value) {
|
|
21
|
+
return (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null && "light" in value && "dark" in value;
|
|
22
|
+
};
|
|
23
|
+
/** Picks a themed value's light or dark side. */ export function resolveThemed(value, dark) {
|
|
24
|
+
return isPair(value) ? dark ? value.dark : value.light : value;
|
|
25
|
+
}
|
|
26
|
+
/** Whether a Geomap has any themed value that depends on the backdrop. */ export function isThemed(viz) {
|
|
27
|
+
return isPair(viz.schema.tileUrl) || isPair(viz.schema.ocean);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
Whether the chart sits on a dark backdrop: the first non-transparent
|
|
31
|
+
background among its ancestors, or — when none sets one — the browser's
|
|
32
|
+
own page canvas, which is dark only when the page opts into a dark
|
|
33
|
+
`color-scheme` and the system prefers dark. Server renders are light.
|
|
34
|
+
*/ export function pageIsDark(viz) {
|
|
35
|
+
var _ref;
|
|
36
|
+
var _viz__select;
|
|
37
|
+
if (viz._ssr || typeof window === "undefined" || typeof getComputedStyle !== "function") return false;
|
|
38
|
+
var node = (_ref = (_viz__select = viz._select) === null || _viz__select === void 0 ? void 0 : _viz__select.node()) !== null && _ref !== void 0 ? _ref : null;
|
|
39
|
+
while(node){
|
|
40
|
+
var bg = getComputedStyle(node).backgroundColor;
|
|
41
|
+
if (bg && bg !== "transparent" && bg !== "rgba(0, 0, 0, 0)") return lab(bg).l < 50;
|
|
42
|
+
node = node.parentElement;
|
|
43
|
+
}
|
|
44
|
+
var scheme = getComputedStyle(document.documentElement).colorScheme || "";
|
|
45
|
+
if (!scheme.includes("dark")) return false;
|
|
46
|
+
if (!scheme.includes("light")) return true;
|
|
47
|
+
return typeof matchMedia === "function" && matchMedia("(prefers-color-scheme: dark)").matches;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
Redraws the chart when its backdrop changes theme: on a system theme
|
|
51
|
+
change, or when the page flips a theme class/attribute/style on <html>
|
|
52
|
+
or <body> (how most theme toggles work). Installed once per chart, and
|
|
53
|
+
only while it uses a `{light, dark}` pair.
|
|
54
|
+
*/ export function watchPageTheme(viz) {
|
|
55
|
+
var _media_addEventListener;
|
|
56
|
+
if (viz._themeWatch || viz._ssr || typeof window === "undefined") return;
|
|
57
|
+
var check = function check() {
|
|
58
|
+
var _viz__select, _viz_render;
|
|
59
|
+
var host = (_viz__select = viz._select) === null || _viz__select === void 0 ? void 0 : _viz__select.node();
|
|
60
|
+
if (!host || !host.isConnected) return;
|
|
61
|
+
if (isThemed(viz) && pageIsDark(viz) !== viz._basemapDark) (_viz_render = viz.render) === null || _viz_render === void 0 ? void 0 : _viz_render.call(viz);
|
|
62
|
+
};
|
|
63
|
+
var media = typeof matchMedia === "function" ? matchMedia("(prefers-color-scheme: dark)") : null;
|
|
64
|
+
media === null || media === void 0 ? void 0 : (_media_addEventListener = media.addEventListener) === null || _media_addEventListener === void 0 ? void 0 : _media_addEventListener.call(media, "change", check);
|
|
65
|
+
var observer = typeof MutationObserver === "function" ? new MutationObserver(check) : null;
|
|
66
|
+
for(var _i = 0, _iter = [
|
|
67
|
+
document.documentElement,
|
|
68
|
+
document.body
|
|
69
|
+
]; _i < _iter.length; _i++){
|
|
70
|
+
var el = _iter[_i];
|
|
71
|
+
if (el) observer === null || observer === void 0 ? void 0 : observer.observe(el, {
|
|
72
|
+
attributes: true
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
viz._themeWatch = true;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=basemapTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/Geomap/basemapTheme.ts"],"sourcesContent":["/**\n Light/dark basemaps. `tileUrl` and `ocean` accept either one value or a\n `{light, dark}` pair; a pair resolves against the chart's backdrop each\n draw, and the chart redraws when that backdrop flips.\n\n @module\n*/\n\nimport {lab} from \"d3-color\";\n\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** A value, or one per page theme. */\nexport type Themed<T> = T | {light: T; dark: T};\n\n/** Esri's Canvas basemaps: muted, nearly label-free bases for data overlays. */\nexport const DEFAULT_TILE_URL: Themed<string> = {\n light: \"https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}\",\n dark: \"https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/{z}/{y}/{x}\",\n};\n\n/** The Canvas basemaps' own water colors, so the ocean around the tiles matches. */\nexport const DEFAULT_OCEAN: Themed<string> = {light: \"#d0cfd4\", dark: \"#222327\"};\n\nconst isPair = <T>(value: Themed<T>): value is {light: T; dark: T} =>\n typeof value === \"object\" && value !== null && \"light\" in value && \"dark\" in value;\n\n/** Picks a themed value's light or dark side. */\nexport function resolveThemed<T>(value: Themed<T>, dark: boolean): T {\n return isPair(value) ? (dark ? value.dark : value.light) : value;\n}\n\n/** Whether a Geomap has any themed value that depends on the backdrop. */\nexport function isThemed(viz: VizInstance): boolean {\n return isPair(viz.schema.tileUrl) || isPair(viz.schema.ocean);\n}\n\n/**\n Whether the chart sits on a dark backdrop: the first non-transparent\n background among its ancestors, or — when none sets one — the browser's\n own page canvas, which is dark only when the page opts into a dark\n `color-scheme` and the system prefers dark. Server renders are light.\n*/\nexport function pageIsDark(viz: VizInstance): boolean {\n if (viz._ssr || typeof window === \"undefined\" || typeof getComputedStyle !== \"function\") return false;\n let node: Element | null = viz._select?.node() ?? null;\n while (node) {\n const bg = getComputedStyle(node).backgroundColor;\n if (bg && bg !== \"transparent\" && bg !== \"rgba(0, 0, 0, 0)\") return lab(bg).l < 50;\n node = node.parentElement;\n }\n const scheme = getComputedStyle(document.documentElement).colorScheme || \"\";\n if (!scheme.includes(\"dark\")) return false;\n if (!scheme.includes(\"light\")) return true;\n return typeof matchMedia === \"function\" && matchMedia(\"(prefers-color-scheme: dark)\").matches;\n}\n\n/**\n Redraws the chart when its backdrop changes theme: on a system theme\n change, or when the page flips a theme class/attribute/style on <html>\n or <body> (how most theme toggles work). Installed once per chart, and\n only while it uses a `{light, dark}` pair.\n*/\nexport function watchPageTheme(viz: VizInstance): void {\n if (viz._themeWatch || viz._ssr || typeof window === \"undefined\") return;\n const check = () => {\n const host = viz._select?.node();\n if (!host || !host.isConnected) return;\n if (isThemed(viz) && pageIsDark(viz) !== viz._basemapDark) viz.render?.();\n };\n const media = typeof matchMedia === \"function\" ? matchMedia(\"(prefers-color-scheme: dark)\") : null;\n media?.addEventListener?.(\"change\", check);\n const observer = typeof MutationObserver === \"function\" ? new MutationObserver(check) : null;\n for (const el of [document.documentElement, document.body])\n if (el) observer?.observe(el, {attributes: true});\n viz._themeWatch = true;\n}\n"],"names":["lab","DEFAULT_TILE_URL","light","dark","DEFAULT_OCEAN","isPair","value","resolveThemed","isThemed","viz","schema","tileUrl","ocean","pageIsDark","_ssr","window","getComputedStyle","node","_select","bg","backgroundColor","l","parentElement","scheme","document","documentElement","colorScheme","includes","matchMedia","matches","watchPageTheme","media","_themeWatch","check","host","isConnected","_basemapDark","render","addEventListener","observer","MutationObserver","body","el","observe","attributes"],"mappings":";;;;AAAA;;;;;;AAMA,GAEA,SAAQA,GAAG,QAAO,WAAW;AAO7B,8EAA8E,GAC9E,OAAO,IAAMC,mBAAmC;IAC9CC,OAAO;IACPC,MAAM;AACR,EAAE;AAEF,kFAAkF,GAClF,OAAO,IAAMC,gBAAgC;IAACF,OAAO;IAAWC,MAAM;AAAS,EAAE;AAEjF,IAAME,SAAS,gBAAIC;WACjB,CAAA,OAAOA,sCAAP,SAAOA,MAAI,MAAM,YAAYA,UAAU,QAAQ,WAAWA,SAAS,UAAUA;;AAE/E,+CAA+C,GAC/C,OAAO,SAASC,cAAiBD,KAAgB,EAAEH,IAAa;IAC9D,OAAOE,OAAOC,SAAUH,OAAOG,MAAMH,IAAI,GAAGG,MAAMJ,KAAK,GAAII;AAC7D;AAEA,wEAAwE,GACxE,OAAO,SAASE,SAASC,GAAgB;IACvC,OAAOJ,OAAOI,IAAIC,MAAM,CAACC,OAAO,KAAKN,OAAOI,IAAIC,MAAM,CAACE,KAAK;AAC9D;AAEA;;;;;AAKA,GACA,OAAO,SAASC,WAAWJ,GAAgB;;QAEdA;IAD3B,IAAIA,IAAIK,IAAI,IAAI,OAAOC,WAAW,eAAe,OAAOC,qBAAqB,YAAY,OAAO;IAChG,IAAIC,gBAAuBR,eAAAA,IAAIS,OAAO,cAAXT,mCAAAA,aAAaQ,IAAI,yCAAM;IAClD,MAAOA,KAAM;QACX,IAAME,KAAKH,iBAAiBC,MAAMG,eAAe;QACjD,IAAID,MAAMA,OAAO,i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ds } from "../features/chartGeometry.js";
|
|
83
83
|
import { paintFromShapeConfig, shapeConfigFor } from "../features/emitHelpers.js";
|
|
84
|
+
import { resolveThemed } from "./basemapTheme.js";
|
|
84
85
|
export var geomapEmit = function geomapEmit(param) {
|
|
85
86
|
var viz = param.viz;
|
|
86
87
|
var c = viz.ctx.geomapCtx;
|
|
87
88
|
if (!c) return [];
|
|
88
89
|
var out = [];
|
|
89
90
|
// The ocean rect and basemap tiles normally live in the imperative geomap
|
|
90
|
-
// <svg> (`_container`), outside the scene graph
|
|
91
|
-
//
|
|
92
|
-
//
|
|
91
|
+
// <svg> (`_container`), outside the scene graph — beneath the scene on SVG,
|
|
92
|
+
// or in an underlay beneath the <canvas>. That's fine on-screen, but a
|
|
93
|
+
// server render serializes only the scene, so under SSR (`viz._ssr`) paint
|
|
93
94
|
// them into the scene here, beneath the geography, so the output is complete.
|
|
94
|
-
if (viz.
|
|
95
|
-
var ocean = viz.schema.ocean;
|
|
95
|
+
if (viz._ssr) {
|
|
96
|
+
var ocean = resolveThemed(viz.schema.ocean, Boolean(viz._basemapDark));
|
|
96
97
|
if (ocean && ocean !== "transparent") {
|
|
97
98
|
var _chartBounds = chartBounds(viz), width = _chartBounds.width, height = _chartBounds.height;
|
|
98
99
|
out.push({
|
|
99
100
|
type: "rect",
|
|
100
101
|
key: "geomap-ocean",
|
|
101
|
-
x:
|
|
102
|
-
y:
|
|
102
|
+
x: 0,
|
|
103
|
+
y: 0,
|
|
103
104
|
width: width,
|
|
104
105
|
height: height,
|
|
105
106
|
paint: {
|
|
@@ -148,11 +149,13 @@ export var geomapEmit = function geomapEmit(param) {
|
|
|
148
149
|
}
|
|
149
150
|
if (c.topoData && c.topoData.length) {
|
|
150
151
|
var pathConfig = shapeConfigFor(viz, "Path");
|
|
152
|
+
var colorScale = viz.schema.colorScale;
|
|
151
153
|
for(var i = 0; i < c.topoData.length; i++){
|
|
152
154
|
var _d_data, _paint_vectorEffect;
|
|
153
155
|
var d = c.topoData[i];
|
|
154
156
|
var datum = (_d_data = d.data) !== null && _d_data !== void 0 ? _d_data : d;
|
|
155
157
|
var paint = paintFromShapeConfig(pathConfig, datum, i);
|
|
158
|
+
var validColorScale = colorScale ? ", ".concat(colorScale(datum, i)) : "";
|
|
156
159
|
out.push({
|
|
157
160
|
type: "path",
|
|
158
161
|
key: "geomap-path-".concat(d.id),
|
|
@@ -163,7 +166,10 @@ export var geomapEmit = function geomapEmit(param) {
|
|
|
163
166
|
// the zoom transform. Honors an explicit shapeConfig.vectorEffect.
|
|
164
167
|
paint: _object_spread_props(_object_spread({}, paint), {
|
|
165
168
|
vectorEffect: (_paint_vectorEffect = paint.vectorEffect) !== null && _paint_vectorEffect !== void 0 ? _paint_vectorEffect : "non-scaling-stroke"
|
|
166
|
-
})
|
|
169
|
+
}),
|
|
170
|
+
aria: {
|
|
171
|
+
label: "".concat(viz._drawLabel(datum, i)).concat(validColorScale, ".")
|
|
172
|
+
}
|
|
167
173
|
});
|
|
168
174
|
}
|
|
169
175
|
}
|
|
@@ -195,7 +201,10 @@ export var geomapEmit = function geomapEmit(param) {
|
|
|
195
201
|
// screen width through zoom (v3 parity), like the topojson borders.
|
|
196
202
|
paint: _object_spread_props(_object_spread({}, paint1), {
|
|
197
203
|
vectorEffect: (_paint_vectorEffect1 = paint1.vectorEffect) !== null && _paint_vectorEffect1 !== void 0 ? _paint_vectorEffect1 : "non-scaling-stroke"
|
|
198
|
-
})
|
|
204
|
+
}),
|
|
205
|
+
aria: {
|
|
206
|
+
label: "".concat(viz._drawLabel(d1, i1), ", ").concat(viz.schema.pointSize(d1, i1), ".")
|
|
207
|
+
}
|
|
199
208
|
}, circleConfig.trail ? {
|
|
200
209
|
trail: true
|
|
201
210
|
} : {}, circleConfig.trailPersist ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/Geomap/emit.ts"],"sourcesContent":["/**\n `geomapEmit` — country Paths + point Circles using `geomapCtx`\n stashed on `viz.ctx`. Emits flat SceneNodes directly (no transient\n Shape compute pass).\n*/\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport {chartBounds} from \"../features/chartGeometry.js\";\nimport {paintFromShapeConfig, shapeConfigFor} from \"../features/emitHelpers.js\";\nimport type {ChartEmit} from \"../definition/ChartDefinition.js\";\n\ninterface GeomapCtx {\n topoData: Array<{__d3plus__?: true; data?: DataPoint; feature: unknown; id: string | number}>;\n pathFn: (d: {feature: unknown}) => string;\n pointData: DataPoint[];\n pointR: (d: DataPoint, i: number) => number;\n pointX: (d: DataPoint, i: number) => number;\n pointY: (d: DataPoint, i: number) => number;\n pointSort?: (a: DataPoint, b: DataPoint) => number;\n}\n\nexport const geomapEmit: ChartEmit = ({viz}) => {\n const c = viz.ctx.geomapCtx as GeomapCtx | undefined;\n if (!c) return [];\n const out: SceneNode[] = [];\n\n // The ocean rect and basemap tiles normally live in the imperative geomap\n // <svg> (`_container`), outside the scene graph
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/Geomap/emit.ts"],"sourcesContent":["/**\n `geomapEmit` — country Paths + point Circles using `geomapCtx`\n stashed on `viz.ctx`. Emits flat SceneNodes directly (no transient\n Shape compute pass).\n*/\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport {chartBounds} from \"../features/chartGeometry.js\";\nimport {paintFromShapeConfig, shapeConfigFor} from \"../features/emitHelpers.js\";\nimport type {ChartEmit} from \"../definition/ChartDefinition.js\";\nimport {resolveThemed} from \"./basemapTheme.js\";\nimport type {Themed} from \"./basemapTheme.js\";\n\ninterface GeomapCtx {\n topoData: Array<{__d3plus__?: true; data?: DataPoint; feature: unknown; id: string | number}>;\n pathFn: (d: {feature: unknown}) => string;\n pointData: DataPoint[];\n pointR: (d: DataPoint, i: number) => number;\n pointX: (d: DataPoint, i: number) => number;\n pointY: (d: DataPoint, i: number) => number;\n pointSort?: (a: DataPoint, b: DataPoint) => number;\n}\n\nexport const geomapEmit: ChartEmit = ({viz}) => {\n const c = viz.ctx.geomapCtx as GeomapCtx | undefined;\n if (!c) return [];\n const out: SceneNode[] = [];\n\n // The ocean rect and basemap tiles normally live in the imperative geomap\n // <svg> (`_container`), outside the scene graph — beneath the scene on SVG,\n // or in an underlay beneath the <canvas>. That's fine on-screen, but a\n // server render serializes only the scene, so under SSR (`viz._ssr`) paint\n // them into the scene here, beneath the geography, so the output is complete.\n if (viz._ssr) {\n const ocean = resolveThemed(viz.schema.ocean as Themed<string>, Boolean(viz._basemapDark)) as string | undefined;\n if (ocean && ocean !== \"transparent\") {\n const {width, height} = chartBounds(viz);\n out.push({\n type: \"rect\",\n key: \"geomap-ocean\",\n x: 0,\n y: 0,\n width,\n height,\n paint: {fill: ocean},\n } as SceneNode);\n }\n }\n\n // Basemap tiles, pre-fetched + inlined as data URIs by @d3plus/ssr. Placed\n // above the ocean and below the geography, at the positions `_computeTileList`\n // derives from the fitted projection (same math as the live `_renderTiles`).\n const ssrTiles = viz._ssrTiles as Map<string, string> | undefined;\n if (ssrTiles && ssrTiles.size && typeof viz._computeTileList === \"function\") {\n for (const t of viz._computeTileList()) {\n const href = ssrTiles.get(t.key);\n if (!href) continue;\n out.push({\n type: \"image\",\n key: `geomap-tile-${t.key}`,\n x: t.x,\n y: t.y,\n width: t.size,\n height: t.size,\n href,\n preserveAspectRatio: \"none\",\n interactive: false,\n } as SceneNode);\n }\n }\n\n if (c.topoData && c.topoData.length) {\n const pathConfig = shapeConfigFor(viz, \"Path\");\n const colorScale = viz.schema.colorScale as ((d: DataPoint, i: number) => unknown) | undefined;\n for (let i = 0; i < c.topoData.length; i++) {\n const d = c.topoData[i];\n const datum = (d.data ?? d) as DataPoint;\n const paint = paintFromShapeConfig(pathConfig, datum, i);\n const validColorScale = colorScale ? `, ${colorScale(datum, i)}` : \"\";\n out.push({\n type: \"path\",\n key: `geomap-path-${d.id}`,\n d: c.pathFn(d),\n datum,\n // Topojson geography is a data shape: keep its border stroke a constant\n // screen width as the map zooms (v3 parity), rather than scaling with\n // the zoom transform. Honors an explicit shapeConfig.vectorEffect.\n paint: {...paint, vectorEffect: paint.vectorEffect ?? \"non-scaling-stroke\"},\n aria: {label: `${viz._drawLabel(datum, i)}${validColorScale}.`},\n } as SceneNode);\n }\n }\n\n if (c.pointData && c.pointData.length) {\n const circleConfig = shapeConfigFor(viz, \"Circle\");\n const points = c.pointSort ? [...c.pointData].sort(c.pointSort) : c.pointData;\n for (let i = 0; i < points.length; i++) {\n const d = points[i];\n const paint = paintFromShapeConfig(circleConfig, d, i);\n // Origin-centered geometry with the projected position in `transform`,\n // matching how Shape-emitted Circle marks are placed (cx/cy = 0, group\n // transform positions the mark). The motion-trail layer reads a mark's\n // position off `transform.x/y`, so points must follow this convention to\n // trail when they move between timeline frames (`Circle.trail`, on by\n // default for Geomap points).\n out.push({\n type: \"circle\",\n key: `geomap-point-${viz._id(d, i)}`,\n cx: 0,\n cy: 0,\n r: c.pointR(d, i),\n transform: {x: c.pointX(d, i), y: c.pointY(d, i)},\n datum: d,\n // Coordinate points are data shapes: hold their stroke at a constant\n // screen width through zoom (v3 parity), like the topojson borders.\n paint: {...paint, vectorEffect: paint.vectorEffect ?? \"non-scaling-stroke\"},\n aria: {label: `${viz._drawLabel(d, i)}, ${(viz.schema.pointSize as (d: DataPoint, i: number) => unknown)(d, i)}.`},\n ...(circleConfig.trail ? {trail: true} : {}),\n ...(circleConfig.trailPersist ? {trailPersist: circleConfig.trailPersist} : {}),\n } as SceneNode);\n }\n }\n\n return out;\n};\n"],"names":["chartBounds","paintFromShapeConfig","shapeConfigFor","resolveThemed","geomapEmit","viz","c","ctx","geomapCtx","out","_ssr","ocean","schema","Boolean","_basemapDark","width","height","push","type","key","x","y","paint","fill","ssrTiles","_ssrTiles","size","_computeTileList","t","href","get","preserveAspectRatio","interactive","topoData","length","pathConfig","colorScale","i","d","datum","data","validColorScale","id","pathFn","vectorEffect","aria","label","_drawLabel","pointData","circleConfig","points","point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AEjF;IACF;IAEA,OAAOtD;AACT,EAAE"}
|
|
@@ -59,8 +59,6 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
59
59
|
- `applyLayout.ts` — topojson + projection + path/point compute.
|
|
60
60
|
- `emit.ts` — country Paths + point Circles.
|
|
61
61
|
*/ import { color } from "d3-color";
|
|
62
|
-
import { select } from "d3-selection";
|
|
63
|
-
import { zoomTransform } from "d3-zoom";
|
|
64
62
|
import { tile } from "d3-tile";
|
|
65
63
|
import * as d3GeoCore from "d3-geo";
|
|
66
64
|
import * as d3GeoProjection from "d3-geo-projection";
|
|
@@ -71,11 +69,13 @@ import { parseSides } from "@d3plus/dom";
|
|
|
71
69
|
import accessor from "../../utils/accessor.js";
|
|
72
70
|
import attributions from "../helpers/tileAttributions.js";
|
|
73
71
|
import constant from "../../utils/constant.js";
|
|
74
|
-
import { chartBounds } from "../features/chartGeometry.js";
|
|
75
|
-
import {
|
|
72
|
+
import { chartAreaRect, chartBounds } from "../features/chartGeometry.js";
|
|
73
|
+
import { subtitleFeature, titleFeature, totalFeature } from "../features/features.js";
|
|
76
74
|
import { ensureZoomDom } from "../features/ensureZoomDom.js";
|
|
75
|
+
import { tileZoomTransform } from "../drawSteps/zoomControls.js";
|
|
76
|
+
import { DEFAULT_OCEAN, DEFAULT_TILE_URL, isThemed, pageIsDark, resolveThemed, watchPageTheme } from "./basemapTheme.js";
|
|
77
77
|
import { makeChart } from "../definition/makeChart.js";
|
|
78
|
-
import { applyGeomapLayout } from "./applyLayout.js";
|
|
78
|
+
import { applyGeomapLayout, geomapPointData, geomapPointSizeScale } from "./applyLayout.js";
|
|
79
79
|
import { geomapEmit } from "./emit.js";
|
|
80
80
|
function findAttribution(url) {
|
|
81
81
|
var a = attributions.find(function(d) {
|
|
@@ -85,11 +85,36 @@ function findAttribution(url) {
|
|
|
85
85
|
});
|
|
86
86
|
return a ? a.text : false;
|
|
87
87
|
}
|
|
88
|
+
/** The tile layer's extent: the map rect in `_container`'s own (margin-relative) space. */ function tileExtent(viz) {
|
|
89
|
+
var _chartBounds = chartBounds(viz), width = _chartBounds.width, height = _chartBounds.height;
|
|
90
|
+
return [
|
|
91
|
+
[
|
|
92
|
+
0,
|
|
93
|
+
0
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
width,
|
|
97
|
+
height
|
|
98
|
+
]
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
/** The tile URL template for the chart's current light/dark backdrop. */ function currentTileUrl(viz) {
|
|
102
|
+
return resolveThemed(viz.schema.tileUrl, Boolean(viz._basemapDark));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
Keeps the tile credit in sync with the active tile URL (a `{light, dark}`
|
|
106
|
+
pair can mix providers), unless the attribution was set by hand.
|
|
107
|
+
*/ function syncTileAttribution(viz) {
|
|
108
|
+
var auto = viz.schema.tiles ? findAttribution(currentTileUrl(viz)) : false;
|
|
109
|
+
var current = viz.schema.attribution;
|
|
110
|
+
if (!current || current === viz._tileAttribution) viz.schema.attribution = auto || "";
|
|
111
|
+
viz._tileAttribution = auto;
|
|
112
|
+
}
|
|
88
113
|
/** Installs `_renderTiles`, the per-instance method that mutates the tile group. */ function setupGeomapRenderTiles(viz) {
|
|
89
114
|
// `_renderTiles` is a per-instance method that mutates the tile group.
|
|
90
115
|
viz._renderTiles = function() {
|
|
91
116
|
var _this = this;
|
|
92
|
-
var transform = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] :
|
|
117
|
+
var transform = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : tileZoomTransform(this), duration = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
93
118
|
// Under SSR the basemap is composited into the scene graph (see geomapEmit +
|
|
94
119
|
// `_computeTileList`), so skip the imperative <image> tile layer entirely.
|
|
95
120
|
// It wouldn't be serialized anyway, and its transform transition relies on
|
|
@@ -97,7 +122,7 @@ function findAttribution(url) {
|
|
|
97
122
|
if (this._ssr) return;
|
|
98
123
|
var tileData = [];
|
|
99
124
|
if (this.schema.tiles) {
|
|
100
|
-
tileData = this._tileGen.extent(this
|
|
125
|
+
tileData = this._tileGen.extent(tileExtent(this)).scale(this.schema.projection.scale() * (2 * Math.PI) * transform.k).translate(transform.apply(this.schema.projection.translate()))();
|
|
101
126
|
this._tileGroup.transition().duration(duration).attr("transform", transform);
|
|
102
127
|
}
|
|
103
128
|
var images = this._tileGroup.selectAll("image.d3plus-geomap-tile").data(tileData, function(param) {
|
|
@@ -108,9 +133,25 @@ function findAttribution(url) {
|
|
|
108
133
|
var scale = tileData.scale / transform.k;
|
|
109
134
|
var tileEnter = images.enter().append("image").attr("class", "d3plus-geomap-tile");
|
|
110
135
|
tileEnter.attr("opacity", 0).transition().duration(duration).attr("opacity", 1);
|
|
136
|
+
// `images.interrupt()`: a config change that fires two `_renderTiles` calls
|
|
137
|
+
// back to back — e.g. a React `config` update that touches `tileUrl`
|
|
138
|
+
// alongside `projection`, whose setter resets the projection's fit before
|
|
139
|
+
// the real render's `applyGeomapLayout` re-fits it — makes the FIRST call
|
|
140
|
+
// compute tile keys against a momentarily stale projection. Its
|
|
141
|
+
// `images.exit()` schedules THIS call's own (correct-key) tiles for a
|
|
142
|
+
// fade-out-then-remove (queued for the next animation frame, not yet run).
|
|
143
|
+
// This call's join then re-matches those same elements by key as an
|
|
144
|
+
// "update" (they're `images`, not `tileEnter`) — but the queued removal
|
|
145
|
+
// still fires on schedule and deletes them anyway, since nothing here
|
|
146
|
+
// touches that scheduled transition. Interrupting `images` (the matched
|
|
147
|
+
// set only — NOT `tileEnter`, whose own fade-in transition just below
|
|
148
|
+
// must run) cancels any such leftover exit before it fires, so a same-key
|
|
149
|
+
// tile revived within one tick of being marked for exit survives instead
|
|
150
|
+
// of vanishing.
|
|
151
|
+
images.interrupt();
|
|
111
152
|
images.merge(tileEnter).attr("width", scale).attr("height", scale).attr("xlink:href", function(param) {
|
|
112
153
|
var _param = _sliced_to_array(param, 3), x = _param[0], y = _param[1], z = _param[2];
|
|
113
|
-
return _this.
|
|
154
|
+
return currentTileUrl(_this).replace("{s}", [
|
|
114
155
|
"a",
|
|
115
156
|
"b",
|
|
116
157
|
"c"
|
|
@@ -131,13 +172,13 @@ function findAttribution(url) {
|
|
|
131
172
|
viz._computeTileList = function() {
|
|
132
173
|
var _this = this;
|
|
133
174
|
if (!this.schema.tiles) return [];
|
|
134
|
-
var tileData = this._tileGen.extent(this
|
|
175
|
+
var tileData = this._tileGen.extent(tileExtent(this)).scale(this.schema.projection.scale() * (2 * Math.PI)).translate(this.schema.projection.translate())();
|
|
135
176
|
var size = tileData.scale;
|
|
136
177
|
return tileData.map(function(param) {
|
|
137
178
|
var _param = _sliced_to_array(param, 3), x = _param[0], y = _param[1], z = _param[2];
|
|
138
179
|
return {
|
|
139
180
|
key: "".concat(x, "-").concat(y, "-").concat(z),
|
|
140
|
-
url: _this.
|
|
181
|
+
url: currentTileUrl(_this).replace("{s}", "a").replace("{z}", "".concat(z)).replace("{x}", "".concat(x)).replace("{y}", "".concat(y)),
|
|
141
182
|
x: x * size + tileData.translate[0] * size,
|
|
142
183
|
y: y * size + tileData.translate[1] * size,
|
|
143
184
|
size: size
|
|
@@ -149,20 +190,10 @@ function findAttribution(url) {
|
|
|
149
190
|
// Wrap _draw to ensure DOM zoom group + zoom wiring.
|
|
150
191
|
var supDraw = viz._draw.bind(viz);
|
|
151
192
|
viz._draw = function(callback) {
|
|
152
|
-
//
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// ancestor of both, so it receives events over the geography (bubbling up
|
|
157
|
-
// from the scene svg) and the ocean (from the geomap svg). Setting the
|
|
158
|
-
// target before the wrapped draw lets `zoomEvents` bind it directly (with
|
|
159
|
-
// its zoomScroll/zoomPan disabling); clear any stale handler on the geomap
|
|
160
|
-
// svg so an ocean event isn't zoomed twice. (Canvas keeps its own target —
|
|
161
|
-
// the <canvas>, set in `_drawSceneToTarget`.)
|
|
162
|
-
if (viz._renderer !== "canvas" && viz._select) {
|
|
163
|
-
viz._zoomEventTarget = viz._select;
|
|
164
|
-
if (viz._container) viz._container.on(".zoom", null);
|
|
165
|
-
}
|
|
193
|
+
// Resolve `{light, dark}` basemaps against the chart's backdrop.
|
|
194
|
+
viz._basemapDark = pageIsDark(viz);
|
|
195
|
+
if (isThemed(viz)) watchPageTheme(viz);
|
|
196
|
+
syncTileAttribution(viz);
|
|
166
197
|
var result = supDraw(callback);
|
|
167
198
|
var _chartBounds = chartBounds(viz), width = _chartBounds.width, height = _chartBounds.height;
|
|
168
199
|
ensureZoomDom(viz, {
|
|
@@ -170,68 +201,14 @@ function findAttribution(url) {
|
|
|
170
201
|
width: width,
|
|
171
202
|
height: height,
|
|
172
203
|
duration: viz.schema.duration,
|
|
173
|
-
// On the canvas backend
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
ocean: viz._renderer === "canvas" ? "transparent" : viz.schema.ocean
|
|
204
|
+
// On the canvas backend the ocean + tiles mount in an underlay beneath
|
|
205
|
+
// the <canvas> (see `ensureZoomDom`), so they show through around the
|
|
206
|
+
// geography on either backend.
|
|
207
|
+
ocean: resolveThemed(viz.schema.ocean, Boolean(viz._basemapDark))
|
|
178
208
|
});
|
|
179
|
-
|
|
180
|
-
viz._zoomBehavior.extent([
|
|
181
|
-
[
|
|
182
|
-
0,
|
|
183
|
-
0
|
|
184
|
-
],
|
|
185
|
-
[
|
|
186
|
-
width,
|
|
187
|
-
height
|
|
188
|
-
]
|
|
189
|
-
]).scaleExtent([
|
|
190
|
-
1,
|
|
191
|
-
viz.schema.zoomMax
|
|
192
|
-
]).translateExtent([
|
|
193
|
-
[
|
|
194
|
-
0,
|
|
195
|
-
0
|
|
196
|
-
],
|
|
197
|
-
[
|
|
198
|
-
width,
|
|
199
|
-
height
|
|
200
|
-
]
|
|
201
|
-
]);
|
|
202
|
-
viz._zoomSet = true;
|
|
203
|
-
}
|
|
209
|
+
viz._zoomSet = true;
|
|
204
210
|
return result;
|
|
205
211
|
};
|
|
206
|
-
// On the Canvas backend the geography is painted on the <canvas>, but the
|
|
207
|
-
// compute <svg> (`_container`, holding the transparent ocean rect) is
|
|
208
|
-
// absolutely positioned and paints above it — intercepting the pointer
|
|
209
|
-
// events the canvas needs for hover/pick, so tooltips never fired. After the
|
|
210
|
-
// scene is painted (when the canvas exists), make that svg transparent to
|
|
211
|
-
// pointer events and move d3-zoom onto the canvas, so the canvas is the sole
|
|
212
|
-
// interaction surface: CanvasRenderer's pick drives tooltips and d3-zoom
|
|
213
|
-
// drives pan/zoom on the same element. (On SVG this is a no-op — the scene
|
|
214
|
-
// svg already sits on top and handles both.)
|
|
215
|
-
var supDrawScene = viz._drawSceneToTarget.bind(viz);
|
|
216
|
-
viz._drawSceneToTarget = function(durationOverride) {
|
|
217
|
-
supDrawScene(durationOverride);
|
|
218
|
-
if (viz._renderer === "canvas" && // Under SSR the canvas is a headless native surface with no
|
|
219
|
-
// addEventListener; there is no interaction to wire, so skip the
|
|
220
|
-
// pointer/zoom rebind entirely.
|
|
221
|
-
!viz._ssr && viz._sceneRenderer && typeof viz._sceneRenderer.toCanvas === "function") {
|
|
222
|
-
var canvasNode = viz._sceneRenderer.toCanvas();
|
|
223
|
-
if (canvasNode) {
|
|
224
|
-
// The compute svg is absolutely positioned over the canvas; an svg root
|
|
225
|
-
// hit-tests its whole box, so even an empty one swallows the canvas's
|
|
226
|
-
// pointer events. The canvas is the sole render + interaction surface in
|
|
227
|
-
// canvas mode, so make the entire compute svg transparent to events.
|
|
228
|
-
if (viz._select) viz._select.style("pointer-events", "none");
|
|
229
|
-
if (viz._container) viz._container.style("pointer-events", "none");
|
|
230
|
-
viz._zoomEventTarget = select(canvasNode);
|
|
231
|
-
if (viz.schema.zoom && !viz._brushing) viz._zoomEventTarget.call(viz._zoomBehavior);
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
212
|
}
|
|
236
213
|
/** Installs the imperative fluent accessors on the Geomap instance. */ function setupGeomapFluent(viz) {
|
|
237
214
|
// Imperative fluent accessors. Parameter type is `unknown` since each
|
|
@@ -308,9 +285,7 @@ function findAttribution(url) {
|
|
|
308
285
|
v.tiles = function(_) {
|
|
309
286
|
if (arguments.length) {
|
|
310
287
|
this.schema.tiles = _;
|
|
311
|
-
|
|
312
|
-
if (_ && this.schema.attribution === "") this.schema.attribution = attribution;
|
|
313
|
-
else if (!_ && this.schema.attribution === attribution) this.schema.attribution = "";
|
|
288
|
+
syncTileAttribution(this);
|
|
314
289
|
return this;
|
|
315
290
|
}
|
|
316
291
|
return this.schema.tiles;
|
|
@@ -318,7 +293,7 @@ function findAttribution(url) {
|
|
|
318
293
|
v.tileUrl = function(_) {
|
|
319
294
|
if (arguments.length) {
|
|
320
295
|
this.schema.tileUrl = _;
|
|
321
|
-
|
|
296
|
+
syncTileAttribution(this);
|
|
322
297
|
if (this._tileGroup) this._renderTiles.bind(this)();
|
|
323
298
|
return this;
|
|
324
299
|
}
|
|
@@ -370,35 +345,24 @@ function findAttribution(url) {
|
|
|
370
345
|
export var geomapDef = {
|
|
371
346
|
name: "Geomap",
|
|
372
347
|
features: [
|
|
373
|
-
backFeature,
|
|
374
348
|
titleFeature,
|
|
375
349
|
subtitleFeature,
|
|
376
350
|
totalFeature
|
|
377
351
|
],
|
|
378
352
|
layoutStage: applyGeomapLayout,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
return undefined;
|
|
353
|
+
sizeLegendScale: function sizeLegendScale(viz) {
|
|
354
|
+
var pointData = geomapPointData(viz);
|
|
355
|
+
return pointData.length ? geomapPointSizeScale(viz, pointData) : null;
|
|
383
356
|
},
|
|
357
|
+
emit: geomapEmit,
|
|
384
358
|
// Clip the geography to the map rectangle — the same box as the ocean rect and
|
|
385
359
|
// the imperative inner <svg> viewport — so projected paths and points can't
|
|
386
360
|
// spill past it (e.g. under the legend/timeline) when a `fitObject`/zoom pushes
|
|
387
361
|
// features outside the fitted extent. The clip lives on the untransformed
|
|
388
362
|
// chart-cells group, so it stays fixed while pan/zoom moves the map beneath it.
|
|
389
|
-
chartClip:
|
|
390
|
-
var _chartBounds = chartBounds(viz), width = _chartBounds.width, height = _chartBounds.height;
|
|
391
|
-
return {
|
|
392
|
-
type: "rect",
|
|
393
|
-
x: viz._margin.left,
|
|
394
|
-
y: viz._margin.top,
|
|
395
|
-
width: width,
|
|
396
|
-
height: height
|
|
397
|
-
};
|
|
398
|
-
},
|
|
363
|
+
chartClip: chartAreaRect,
|
|
399
364
|
setup: function setup(viz) {
|
|
400
365
|
var v = viz;
|
|
401
|
-
viz.schema.zoom = true;
|
|
402
366
|
viz._zoomSet = false;
|
|
403
367
|
viz.schema.tiles = true;
|
|
404
368
|
viz._tileGen = tile();
|
|
@@ -406,7 +370,12 @@ export var geomapDef = {
|
|
|
406
370
|
setupGeomapDraw(viz);
|
|
407
371
|
setupGeomapFluent(viz);
|
|
408
372
|
// Seed the default tile URL through the wrapped accessor so attribution is set.
|
|
409
|
-
v.tileUrl(
|
|
373
|
+
v.tileUrl(DEFAULT_TILE_URL);
|
|
374
|
+
// Regions with no data: a quiet light fill, or its dark counterpart over a
|
|
375
|
+
// dark basemap (`topojsonFill` replaces both).
|
|
376
|
+
viz.schema.topojsonFill = function() {
|
|
377
|
+
return viz._basemapDark ? "#3d3e44" : "#f5f5f3";
|
|
378
|
+
};
|
|
410
379
|
},
|
|
411
380
|
ctx: {},
|
|
412
381
|
fields: [
|
|
@@ -420,7 +389,7 @@ export var geomapDef = {
|
|
|
420
389
|
},
|
|
421
390
|
{
|
|
422
391
|
key: "ocean",
|
|
423
|
-
default:
|
|
392
|
+
default: DEFAULT_OCEAN
|
|
424
393
|
},
|
|
425
394
|
{
|
|
426
395
|
key: "point",
|