@d3plus/core 4.5.0 → 4.7.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 +3930 -2032
- package/es/index.js +3 -3
- package/es/index.js.map +1 -1
- package/es/internal.js +11 -1
- package/es/internal.js.map +1 -1
- package/es/src/charts/BarChart/index.js +8 -1
- package/es/src/charts/BarChart/index.js.map +1 -1
- package/es/src/charts/BoxWhisker/index.js +5 -0
- package/es/src/charts/BoxWhisker/index.js.map +1 -1
- package/es/src/charts/Chord/emit.js +55 -3
- package/es/src/charts/Chord/emit.js.map +1 -1
- package/es/src/charts/Chord/index.js +17 -0
- package/es/src/charts/Chord/index.js.map +1 -1
- package/es/src/charts/Geomap/applyLayout.js +20 -11
- package/es/src/charts/Geomap/applyLayout.js.map +1 -1
- package/es/src/charts/Geomap/index.js +8 -2
- 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/Matrix/emit.js +5 -4
- package/es/src/charts/Matrix/emit.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 +4 -4
- package/es/src/charts/Network/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +10 -1
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +42 -7
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +15 -0
- 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 +275 -35
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +48 -1
- 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 +143 -14
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/insetRegion.js +21 -0
- package/es/src/charts/Plot/insetRegion.js.map +1 -0
- package/es/src/charts/Plot/pipeline.js +47 -20
- 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/shapeDefaults.js +3 -3
- package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
- package/es/src/charts/Plot/sharedHover.js +532 -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 +183 -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 +469 -0
- package/es/src/charts/Plot/trendLines.js.map +1 -0
- package/es/src/charts/Plot/trendProjection.js +120 -0
- package/es/src/charts/Plot/trendProjection.js.map +1 -0
- package/es/src/charts/Plot/trendScene.js +234 -0
- package/es/src/charts/Plot/trendScene.js.map +1 -0
- package/es/src/charts/Plot/trendTooltip.js +222 -0
- package/es/src/charts/Plot/trendTooltip.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +34 -6
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/Radar/index.js +15 -2
- package/es/src/charts/Radar/index.js.map +1 -1
- package/es/src/charts/RadialMatrix/emit.js +4 -4
- package/es/src/charts/RadialMatrix/emit.js.map +1 -1
- package/es/src/charts/RadialMatrix/index.js +17 -1
- 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 +2 -3
- package/es/src/charts/Rings/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +18 -3
- 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/index.js +2 -0
- package/es/src/charts/Sankey/index.js.map +1 -1
- package/es/src/charts/StackedArea/index.js +8 -1
- package/es/src/charts/StackedArea/index.js.map +1 -1
- package/es/src/charts/Tree/emit.js +2 -2
- package/es/src/charts/Tree/emit.js.map +1 -1
- package/es/src/charts/Tree/index.js +7 -3
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/emit.js +58 -6
- package/es/src/charts/Treemap/emit.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/definition/makeChart.js +14 -1
- package/es/src/charts/definition/makeChart.js.map +1 -1
- package/es/src/charts/drawSteps/backControl.js +17 -2
- package/es/src/charts/drawSteps/backControl.js.map +1 -1
- package/es/src/charts/drawSteps/bottomRightControls.js +196 -0
- package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +292 -0
- package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/minimap.js +34 -9
- package/es/src/charts/drawSteps/minimap.js.map +1 -1
- package/es/src/charts/drawSteps/searchControlsMarkup.js +15 -38
- package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -1
- package/es/src/charts/drawSteps/zoomControls.js +3 -0
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/events/click.legend.js +10 -5
- package/es/src/charts/events/click.legend.js.map +1 -1
- 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 +10 -1
- package/es/src/charts/events/mousemove.shape.js.map +1 -1
- package/es/src/charts/features/axes.js +4 -1
- package/es/src/charts/features/axes.js.map +1 -1
- package/es/src/charts/features/emitHelpers.js +43 -5
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/features.js +3 -104
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresColorScale.js +161 -0
- package/es/src/charts/features/featuresColorScale.js.map +1 -0
- package/es/src/charts/features/featuresLegend.js +155 -34
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/insetState.js +174 -0
- package/es/src/charts/features/insetState.js.map +1 -0
- package/es/src/charts/features/plotPaint.js +51 -24
- package/es/src/charts/features/plotPaint.js.map +1 -1
- package/es/src/charts/features/sceneBounds.js +271 -0
- package/es/src/charts/features/sceneBounds.js.map +1 -0
- package/es/src/charts/features/shapeEmit.js +20 -2
- package/es/src/charts/features/shapeEmit.js.map +1 -1
- package/es/src/charts/features/tooltipSwatch.js +73 -0
- package/es/src/charts/features/tooltipSwatch.js.map +1 -0
- package/es/src/charts/index.js +1 -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/insetPlacement.js +406 -0
- package/es/src/charts/pipeline/insetPlacement.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 +22 -3
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/pipeline/vizDrawPure.js +20 -0
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
- package/es/src/charts/viz/Viz.js +82 -11
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBase.js +29 -1
- package/es/src/charts/viz/VizBase.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +25 -21
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/interactionOpacity.js +21 -13
- package/es/src/charts/viz/interactionOpacity.js.map +1 -1
- package/es/src/charts/viz/linkGroup.js +386 -0
- package/es/src/charts/viz/linkGroup.js.map +1 -0
- package/es/src/charts/viz/ordinalColor.js +2 -2
- package/es/src/charts/viz/ordinalColor.js.map +1 -1
- package/es/src/charts/viz/sceneRows.js +33 -0
- package/es/src/charts/viz/sceneRows.js.map +1 -0
- package/es/src/charts/viz/vizDefaults.js +39 -15
- 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 +8 -8
- package/es/src/components/Axis/Axis.js.map +1 -1
- package/es/src/components/Axis/AxisBottom.js +1 -1
- package/es/src/components/Axis/AxisBottom.js.map +1 -1
- package/es/src/components/Axis/AxisLeft.js +1 -1
- package/es/src/components/Axis/AxisLeft.js.map +1 -1
- package/es/src/components/Axis/AxisRight.js +1 -1
- package/es/src/components/Axis/AxisRight.js.map +1 -1
- package/es/src/components/Axis/AxisTop.js +1 -1
- package/es/src/components/Axis/AxisTop.js.map +1 -1
- package/es/src/components/Axis/axisLayoutLabels.js +13 -1
- package/es/src/components/Axis/axisLayoutLabels.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 +3 -2
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/components/Legend/legendRender.js +70 -26
- 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/TextBox.js +1 -1
- package/es/src/components/TextBox.js.map +1 -1
- 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/Bar.js +1 -1
- package/es/src/shapes/Bar.js.map +1 -1
- package/es/src/shapes/Box.js +5 -3
- package/es/src/shapes/Box.js.map +1 -1
- package/es/src/shapes/Rect.js +1 -1
- package/es/src/shapes/Rect.js.map +1 -1
- package/es/src/shapes/Shape.js +10 -37
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/Whisker.js +4 -3
- package/es/src/shapes/Whisker.js.map +1 -1
- package/es/src/shapes/textureKey.js +104 -0
- package/es/src/shapes/textureKey.js.map +1 -0
- 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 +12 -10
- package/types/index.d.ts +5 -4
- package/types/internal.d.ts +15 -1
- package/types/src/charts/BarChart/index.d.ts +2 -1
- package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
- 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 +47 -0
- package/types/src/charts/Plot/insetRegion.d.ts +4 -0
- package/types/src/charts/Plot/pipeline.d.ts +14 -0
- package/types/src/charts/Plot/sharedHover.d.ts +84 -0
- package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
- package/types/src/charts/Plot/sharedTooltip.d.ts +36 -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 +90 -0
- package/types/src/charts/Plot/trendProjection.d.ts +28 -0
- package/types/src/charts/Plot/trendScene.d.ts +19 -0
- package/types/src/charts/Plot/trendTooltip.d.ts +30 -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 +39 -0
- package/types/src/charts/definition/makeChart.d.ts +2 -1
- package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
- package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +110 -0
- package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +7 -5
- package/types/src/charts/features/emitHelpers.d.ts +18 -4
- package/types/src/charts/features/features.d.ts +1 -8
- package/types/src/charts/features/featuresColorScale.d.ts +24 -0
- package/types/src/charts/features/featuresLegend.d.ts +15 -0
- package/types/src/charts/features/insetState.d.ts +95 -0
- package/types/src/charts/features/plotPaint.d.ts +25 -0
- package/types/src/charts/features/sceneBounds.d.ts +18 -0
- package/types/src/charts/features/tooltipSwatch.d.ts +31 -0
- package/types/src/charts/index.d.ts +1 -0
- package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
- package/types/src/charts/pipeline/insetPlacement.d.ts +45 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +10 -1
- package/types/src/charts/viz/Viz.d.ts +27 -2
- package/types/src/charts/viz/VizBase.d.ts +13 -0
- package/types/src/charts/viz/VizBaseConfig.d.ts +11 -11
- package/types/src/charts/viz/linkGroup.d.ts +96 -0
- package/types/src/charts/viz/sceneRows.d.ts +13 -0
- package/types/src/charts/viz/vizTypes.d.ts +164 -3
- package/types/src/charts/viz/vizVisibility.d.ts +34 -0
- package/types/src/components/Axis/AxisBottom.d.ts +1 -1
- package/types/src/components/Axis/AxisLeft.d.ts +1 -1
- package/types/src/components/Axis/AxisRight.d.ts +1 -1
- package/types/src/components/Axis/AxisTop.d.ts +1 -1
- package/types/src/components/ColorScale/ColorScale.d.ts +4 -4
- package/types/src/components/Legend/legendRender.d.ts +9 -3
- package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
- package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
- package/types/src/components/TextBox.d.ts +1 -1
- package/types/src/components/Tooltip.d.ts +18 -3
- package/types/src/components/index.d.ts +1 -0
- package/types/src/shapes/Bar.d.ts +1 -1
- package/types/src/shapes/Box.d.ts +1 -1
- package/types/src/shapes/Rect.d.ts +1 -1
- package/types/src/shapes/Whisker.d.ts +1 -1
- package/types/src/shapes/textureKey.d.ts +9 -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 +139 -0
- 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 +9325 -3024
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +3348 -1727
- package/umd/d3plus-core.js +5412 -831
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +2199 -948
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/features/features.ts"],"sourcesContent":["/**\n FeatureModule + layout engine. The chart-level features (title,\n subtitle, total, legend, timeline, colorScale, back) are\n `FeatureModule` values composed by `runLayout`, which performs\n **explicit margin negotiation** — each feature returns a `MarginClaim`\n + optional `panel` scene node + optional declarative `vizUpdate`\n writes, and the engine accumulates margins across features in order.\n\n Every Plot-family + chart-shell feature here is wired into\n `vizDrawPure` via `runLayout(ctx, [...features])`.\n*/\nimport {extent, min, rollup, sum} from \"d3-array\";\n\nimport {merge, unique} from \"@d3plus/data\";\nimport type {DataPoint, MergedDataPoint} from \"@d3plus/data\";\nimport {date, elem} from \"@d3plus/dom\";\n\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport {resolveSpec} from \"../pipeline/resolveSpec.js\";\nimport type {VizContext} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\nimport {zoomControlsBox} from \"../drawSteps/zoomControlsMarkup.js\";\nimport {getTopLeftContributions} from \"../drawSteps/topLeftControls.js\";\nimport {topLeftControlsInset as topLeftControlsInsetRaw} from \"../drawSteps/topLeftControlsMarkup.js\";\n\n/** A margin claim, in pixels along each side. Unclaimed sides default to 0. */\nexport interface MarginClaim {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n}\n\n/** The shape a `layout` step returns: optional panel node + margin claim + optional viz writebacks. */\nexport interface FeatureLayout {\n panel: SceneNode | null;\n margin: MarginClaim;\n /**\n v4 purity: features that need to publish CROSS-FEATURE state — a\n write that a DIFFERENT feature or downstream stage will read — return\n those writes here as declarative key→value pairs. `runLayout`\n applies them to viz after the layout call so the next feature in\n the chain sees them.\n\n Key convention: keys are auto-prefixed with `_` to match viz's\n internal field convention. Return `{drawDepth: 2}` to write\n `viz._drawDepth`; explicitly-underscored keys (`{_drawDepth: 2}`)\n pass through unchanged for the rare case where the engine\n shouldn't prepend. This rule exists because a leading underscore\n is easy to forget and writing `viz.drawDepth` (no underscore) is\n almost never what callers want.\n\n Intra-feature local writes (a feature setting state that its OWN\n component instance reads inside the same `layout()` body) are\n legitimate direct mutations on viz — `vizUpdate` would defer the\n write past the local read. legendFeature's `_legendDepth` is an\n example of an intra-feature local; timelineFeature's\n `_timelineSelection` similarly mutates from its event handler\n context. The contract is about CROSS-feature mutation, not all\n mutation.\n */\n vizUpdate?: Record<string, unknown>;\n}\n\n/**\n @interface FeatureModule\n A chart-level component (title, subtitle, total, legend, timeline,\n colorScale, back, attribution) expressed as a pure value. Each feature:\n - contributes config keys to the chart's schema (`configFields`),\n - optionally derives extra fields onto the pipeline context (`derive`),\n - optionally claims a margin region + emits its panel scene (`layout`),\n - optionally registers event reducers (`events`).\n*/\nexport interface FeatureModule {\n name: string;\n /** Keys the chart's config inherits from this feature (used by E4 fluent gen). */\n configFields?: string[];\n /** Extra derivations to add into the pipeline context. */\n derive?: (ctx: VizContext) => Partial<VizContext>;\n /**\n Pure layout: read the (possibly updated-by-earlier-features) context and\n return the panel scene + margin this feature claims. The layoutEngine\n threads the margin claims through `ctx.layoutMargin` so a feature can\n read what earlier features already took.\n */\n layout?: (\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n ) => FeatureLayout;\n /**\n Event reducers `(ctx, event) => Partial<VizConfig>`. Fire when a\n user interaction occurs on a node tagged with this feature's name.\n */\n events?: Record<string, (ctx: VizContext, event: unknown) => unknown>;\n}\n\n/**\n Result of running a list of features through the layout engine.\n*/\nexport interface LayoutResult {\n /** Panel nodes in feature order, ready to compose into the scene root. */\n panels: SceneNode[];\n /** Final margin after every feature claimed its space. */\n margin: Required<MarginClaim>;\n}\n\n/**\n The allowed values for `legendPosition` and `colorScalePosition`.\n `false` means \"hidden\" (the feature still runs to tear down DOM); the\n four strings are the four sides.\n*/\nexport type PanelPosition = false | \"top\" | \"right\" | \"bottom\" | \"left\";\n\nconst VALID_POSITIONS: ReadonlySet<PanelPosition | string> = new Set([\n false as unknown as string,\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n]);\n\n/**\n Canonical sanitizer for `legendPosition` / `colorScalePosition`.\n Falls back to `\"bottom\"` when the user-supplied accessor returns\n something outside the allowed set. Single source of truth — used by\n `vizDrawPure` (for sanitized ctx publication) and by `legendFeature`\n + `colorScaleFeature` (for their internal positioning math).\n*/\nexport function sanitizePosition(raw: unknown): PanelPosition {\n return (VALID_POSITIONS.has(raw as string) ? raw : \"bottom\") as PanelPosition;\n}\n\n/**\n Runs each feature's `layout` in order, accumulating margin claims so that\n later features see the space already taken by earlier ones. The order of\n `features` is the layout order — this is how implicit `this._margin +=`\n side effects become *explicit* data flow.\n\n Today's order in `Viz._draw` (`drawTitle`, `drawSubtitle`, `drawTotal`,\n `drawBack`, `drawAttribution`, `drawColorScale`, `drawLegend`,\n `drawTimeline`) should be ported verbatim as the default sequence — port\n the math first, then improve.\n*/\nexport function runLayout(\n ctx: VizContext,\n features: FeatureModule[],\n baseMargin: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0},\n): LayoutResult {\n // `claims` is this call's accumulated margin (the returned delta).\n // `layoutMargin` handed to each feature is the running TOTAL —\n // `baseMargin` (margin already taken by prior runLayout calls in the same\n // draw) plus the claims taken so far in this call — so a feature reads\n // the true current margin without touching viz._margin.\n const claims: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0};\n const panels: SceneNode[] = [];\n for (const f of features) {\n if (!f.layout) continue;\n const layoutMargin: Required<MarginClaim> = {\n top: baseMargin.top + claims.top,\n right: baseMargin.right + claims.right,\n bottom: baseMargin.bottom + claims.bottom,\n left: baseMargin.left + claims.left,\n };\n const result = f.layout({...ctx, layoutMargin});\n const {panel, margin: claim, vizUpdate} = result;\n if (panel) panels.push(panel);\n claims.top += claim.top ?? 0;\n claims.right += claim.right ?? 0;\n claims.bottom += claim.bottom ?? 0;\n claims.left += claim.left ?? 0;\n // v4 purity: features publish cross-feature viz writes declaratively\n // via `vizUpdate`. The engine applies them — features don't mutate\n // viz directly from layout(). Skips own component-instance config\n // calls (those are local mutation, not cross-feature). Use\n // `Object.keys` (not `for...in`) so inherited enumerable properties\n // on a class-instance vizUpdate don't leak onto viz.\n //\n // Key convention: keys are auto-prefixed with `_` to land on the\n // viz's internal field convention (`viz._drawDepth`, `viz._legendDepth`).\n // Features should return UNPREFIXED keys (`{drawDepth: 2}`); the\n // engine normalizes — so feature authors can't accidentally write\n // `viz.drawDepth` (a different non-underscore property) instead of\n // `viz._drawDepth`. Keys that already start with `_` are passed\n // through unchanged so future explicit-internal writes still work.\n if (vizUpdate && ctx.viz) {\n const target = ctx.viz as Record<string, unknown>;\n for (const k of Object.keys(vizUpdate)) {\n const key = k.startsWith(\"_\") ? k : `_${k}`;\n target[key] = vizUpdate[k];\n }\n }\n }\n return {panels, margin: claims};\n}\n\n/* --------------------------- text-block features --------------------------- */\n\n/** A TextBox `_textData()` row, as the text-block features read it. */\ninterface TextDatum {\n lines: string[];\n lH: number;\n fS: number;\n fF: string;\n fC: string;\n fO: number;\n tA: string;\n widths: number[];\n}\n\n/**\n A little breathing room added to a NON-zero corner inset, on top of the\n exact pixel width the corner panel measured at. Without it, content\n insets to EXACTLY the corner box's edge — any tiny discrepancy between\n that hidden-probe measurement and the real rendered box (sub-pixel\n rounding, a font metric quirk) then reads as the text visibly, if\n slightly, running under the buttons.\n*/\nconst CORNER_INSET_GAP = 6;\n\n/**\n How far content starting `top` px down the chart, whose right edge sits\n `right` px in from the chart's right edge, must pull in its right edge to\n clear the zoom-control panel pinned to the chart's top-right corner. Zero\n when the chart shows no controls or the content starts below them.\n*/\nexport function zoomControlsInset(viz: VizInstance, top: number, right: number): number {\n const box = zoomControlsBox(viz as never);\n if (!box || top >= box.height) return 0;\n const inset = box.width - right;\n return inset > 0 ? inset + CORNER_INSET_GAP : 0;\n}\n\n/**\n The left-side mirror of `zoomControlsInset`: how far content starting\n `top` px down the chart, whose left edge sits `left` px in from the\n chart's left edge, must pull in to clear the shared top-left controls\n panel (back / table-view / search). Zero when nothing is showing there\n or content starts below the panel's height.\n*/\nexport function topLeftControlsInset(viz: VizInstance, top: number, left: number): number {\n const contributions = getTopLeftContributions(viz as never);\n const inset = topLeftControlsInsetRaw(viz as never, top, left, contributions);\n return inset > 0 ? inset + CORNER_INSET_GAP : 0;\n}\n\n/**\n The combined left+right corner-panel insets for content starting `top`\n px down the chart, plus the single symmetric amount CENTERED content\n should inset both sides by to stay centered on the full chart width even\n when only one corner has something to avoid (the larger of the two —\n see `textBlockLayout`'s doc comment for why). Shared by `textBlockLayout`\n (title/subtitle/total) and the legend's own top-position layout\n (`featuresLegend.ts`), which independently needed this exact same\n \"combine the two corners' insets\" math before this existed.\n*/\nexport function cornerInsets(\n viz: VizInstance,\n top: number,\n left: number,\n right: number,\n): {left: number; right: number; symmetric: number} {\n const leftInset = topLeftControlsInset(viz, top, left);\n const rightInset = zoomControlsInset(viz, top, right);\n return {left: leftInset, right: rightInset, symmetric: Math.max(leftInset, rightInset)};\n}\n\n/**\n Shared layout logic for any \"single line of text claiming margin.top\" feature\n (title, subtitle, total). Each feature passes the viz fields that source its\n text + TextBox + config; the helper computes the panel + margin claim using\n the TextBox's pure `_textData()` (no DOM).\n*/\nfunction textBlockLayout(\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n opts: {\n panelKey: string;\n getText: (viz: VizInstance) => string | false;\n textClassKey: string; // e.g. \"_titleClass\"\n configKey: string; // schema key, e.g. \"titleConfig\"\n paddingMethod: string; // schema key, e.g. \"titlePadding\"\n },\n): FeatureLayout {\n const {viz, layoutMargin} = ctx;\n const text = opts.getText(viz);\n if (!text) return {panel: null, margin: {}};\n\n const usesPadding = (viz.schema[opts.paddingMethod] as (viz: VizInstance) => boolean)(viz);\n const padding = usesPadding\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n let width =\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right);\n\n const textClass = viz[opts.textClassKey];\n textClass\n .data([{text}])\n .locale(viz.schema.locale)\n .width(width)\n .config(viz.schema[opts.configKey]);\n let boxes = textClass._textData() as TextDatum[];\n\n // Text alongside the zoom controls (right) and/or the shared top-left\n // controls panel (left — back/table-view/search) wraps short of them.\n // Centered text insets both sides by the SAME (larger) amount so it stays\n // centered on the full chart width, matching how it already behaved\n // relative to zoom alone; start/end-aligned text instead just narrows the\n // true available box (its unaffected edge stays exactly where it was).\n let x = layoutMargin.left + padding.left;\n const {left: leftInset, right: rightInset, symmetric} = cornerInsets(\n viz,\n layoutMargin.top,\n layoutMargin.left + padding.left,\n layoutMargin.right + padding.right,\n );\n if ((rightInset || leftInset) && boxes.length) {\n const centered = boxes[0].tA === \"middle\";\n if (centered) {\n x += symmetric;\n width -= symmetric * 2;\n } else {\n x += leftInset;\n width -= leftInset + rightInset;\n }\n textClass.width(width);\n boxes = textClass._textData() as TextDatum[];\n }\n if (!boxes.length) return {panel: null, margin: {}};\n const box = boxes[0];\n\n const lineHeight = box.lH;\n const blockPadding = (viz.schema[opts.configKey]?.padding as number) ?? 0;\n const height = box.lines.length * lineHeight + blockPadding * 2;\n // The claimed margin (below) already reserves `blockPadding` above AND\n // below the text — shifting the panel down by that same amount is what\n // actually centers the text within that reserved band, rather than\n // pinning it flush to the very top of it. Previously `blockPadding` only\n // grew/shrank the claimed space; it never moved the text within it,\n // which is why the default title padding (5px) had no visible effect —\n // the title sat at the top of its claim regardless, reading noticeably\n // higher than the same-row zoom/back/search buttons beside it.\n const y = layoutMargin.top + blockPadding;\n\n const lines = box.lines.map((str: string, i: number) => ({\n text: str,\n x:\n box.tA === \"middle\"\n ? width / 2\n : box.tA === \"end\"\n ? width\n : 0,\n y: (i + 1) * lineHeight - (lineHeight - box.fS),\n width: box.widths?.[i] ?? 0,\n }));\n\n const panel: SceneNode = {\n type: \"text\",\n key: opts.panelKey,\n x: 0,\n y: 0,\n lines,\n font: {\n family: box.fF,\n size: box.fS,\n anchor:\n box.tA === \"middle\" || box.tA === \"end\" || box.tA === \"start\"\n ? (box.tA as \"middle\" | \"end\" | \"start\")\n : \"start\",\n baseline: \"alphabetic\",\n },\n paint: {fill: box.fC, opacity: box.fO},\n transform: {x, y},\n };\n\n return {panel, margin: {top: height}};\n}\n\n/**\n Title as a FeatureModule. Uses `_titleClass._textData()` for height\n (pure compute, no DOM) and returns the margin claim explicitly.\n*/\nexport const titleFeature: FeatureModule = {\n name: \"title\",\n configFields: [\"title\", \"titleConfig\", \"titlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-title\",\n getText: viz => (viz.schema.title ? viz.schema.title(viz._filteredData || []) : false),\n textClassKey: \"_titleClass\",\n configKey: \"titleConfig\",\n paddingMethod: \"titlePadding\",\n }),\n};\n\n/** Converts `drawSubtitle.ts` to a FeatureModule. Mirrors titleFeature. */\nexport const subtitleFeature: FeatureModule = {\n name: \"subtitle\",\n configFields: [\"subtitle\", \"subtitleConfig\", \"subtitlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-subtitle\",\n getText: viz => (viz.schema.subtitle ? viz.schema.subtitle(viz._filteredData || []) : false),\n textClassKey: \"_subtitleClass\",\n configKey: \"subtitleConfig\",\n paddingMethod: \"subtitlePadding\",\n }),\n};\n\n/* -------------------------------- Legend --------------------------------- */\n\nexport {legendFeature} from \"./featuresLegend.js\";\n\n/* -------------------------------- Timeline ------------------------------- */\n\n/**\n Helper mirroring drawTimeline's `setTimeFilter`. Triggers a re-render when\n the brush selection changes — kept here so the feature owns its event flow.\n*/\nfunction setTimeFilter(viz: VizInstance, s: Date | Date[] | number[]): void {\n if (!Array.isArray(s)) s = [s, s] as Date[];\n if (JSON.stringify(s) !== JSON.stringify(viz._timelineSelection)) {\n viz._timelineSelection = s;\n const nums = (s as Array<Date | number>).map(Number) as number[];\n viz\n .timeFilter!((d: DataPoint) => {\n const ms = (date(viz.schema.time(d)) as Date).getTime();\n return ms >= nums[0] && ms <= nums[1];\n })\n .render!();\n }\n}\n\n/**\n Converts `drawTimeline.ts` to a FeatureModule.\n\n Visible only when `_time` is set, `_timeline` is truthy, and there is more\n than one distinct tick. Renders the chart's `_timelineClass` Timeline\n instance (compute mode — scene comes from Timeline.toScene via Viz.toScene's\n components collection) and claims `margin.bottom` from its outerBounds.\n*/\nexport const timelineFeature: FeatureModule = {\n name: \"timeline\",\n configFields: [\"timeline\", \"timelineConfig\", \"timelinePadding\"],\n layout: ({viz, layoutMargin}) => {\n let timelinePossible = viz.schema.time && viz.schema.timeline;\n const ticks = (\n timelinePossible\n ? unique(viz._data.map(viz.schema.time)).map(\n (d: unknown) => date(d as string | number),\n )\n : []\n ) as Date[];\n timelinePossible = timelinePossible && ticks.length > 1;\n const padding = viz.schema.timelinePadding(viz)\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n const transform = {\n transform: `translate(${layoutMargin.left + padding.left}, 0)`,\n };\n\n const timelineGroup = elem(\"g.d3plus-viz-timeline\", {\n condition: timelinePossible,\n enter: transform,\n parent: viz._select,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!timelinePossible) return {panel: null, margin: {}};\n\n const timeline = viz._timelineClass\n .renderMode(\"compute\")\n .domain(extent(ticks) as [Date, Date])\n .duration(viz.schema.duration)\n .height(viz.schema.height - layoutMargin.bottom)\n .locale(viz.schema.locale)\n .select(timelineGroup)\n .ticks(ticks.sort((a: Date, b: Date) => +a - +b))\n .width(\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right),\n );\n\n // Clamp bound = the full time range (every tick); it never goes stale\n // mid-render. Clamping to `viz._filteredData`'s extent instead collapsed a\n // freshly-committed range down to the previous selection — the release\n // snap-back (e.g. [2017,2024] clamped to a stale [2022,2022]).\n const fullExtent = extent(ticks) as [Date, Date];\n if (!viz._timelineSelection) {\n // First render only: default to the *filtered* extent, which the\n // synthesized default timeFilter pins to the latest period (see\n // vizPreDraw) — the historical default. `timelineDefault` overrides it.\n const filtered = extent(\n (viz._filteredData || [])\n .map(viz.schema.time)\n .map((d: unknown) => date(d as string | number)) as Date[],\n ) as [Date, Date];\n viz._timelineSelection =\n viz.schema.timelineDefault || (filtered[0] ? filtered : fullExtent);\n } else {\n if (viz._timelineSelection[0] < fullExtent[0])\n viz._timelineSelection[0] = fullExtent[0];\n if (viz._timelineSelection[1] > fullExtent[1])\n viz._timelineSelection[1] = fullExtent[1];\n }\n timeline.selection(viz._timelineSelection);\n\n // Repaint the scene when playback toggles without moving the selection\n // (e.g. a manual pause), so the play/pause glyph refreshes immediately.\n timeline._onPlayToggle = () => viz._scheduleSceneRepaint();\n\n const config = viz.schema.timelineConfig;\n timeline\n .config(config)\n .on(\"brush\", (s: Date[]) => {\n // Filter on \"end\", not on every brush move. Re-rendering the whole Viz\n // mid-drag re-creates the d3-brush (and starts a brush transition),\n // which fights the active gesture and can make the selection snap back\n // on release — and it re-lays-out the chart on every pixel of the drag,\n // which is costly for large data. The brush still tracks the cursor\n // live; the chart updates when the drag finishes. User `on.brush`\n // callbacks still fire for custom live behavior.\n if (config.on && config.on.brush) config.on.brush(s);\n })\n .on(\"end\", (s: Date[]) => {\n setTimeFilter(viz, s);\n if (config.on && config.on.end) config.on.end(s);\n })\n .render();\n\n return {\n panel: null,\n margin: {bottom: timeline.outerBounds().height + timeline.padding() * 2},\n };\n },\n};\n\n/* ------------------------------- ColorScale ------------------------------ */\n\n/**\n Converts `drawColorScale.ts` to a FeatureModule.\n\n Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves\n to a side. Renders the chart's `_colorScaleClass` ColorScale instance and\n claims margin along its position side.\n*/\nexport const colorScaleFeature: FeatureModule = {\n name: \"colorScale\",\n configFields: [\n \"colorScale\",\n \"colorScaleConfig\",\n \"colorScaleMaxSize\",\n \"colorScalePadding\",\n \"colorScalePosition\",\n ],\n layout: ({viz, layoutMargin}) => {\n const data = Array.from(\n rollup(\n viz._data,\n (leaves: DataPoint[]) => merge(leaves, viz.schema.aggs),\n (d: DataPoint, i: number) =>\n `${viz.schema.time ? viz.schema.time(d, i) : \"all\"}-${viz._ids(d, i).join(\"_\")}`,\n ).values(),\n );\n\n const position = sanitizePosition(viz.schema.colorScalePosition.bind(viz)(resolveSpec(viz)));\n const wide = [\"top\", \"bottom\"].includes(position as string);\n const showColorScale = viz.schema.colorScale && position;\n const padding = viz.schema.colorScalePadding(viz)\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n const availableWidth =\n viz.schema.width - (layoutMargin.left + layoutMargin.right + padding.left + padding.right);\n const width = wide\n ? min([viz.schema.colorScaleMaxSize, availableWidth])!\n : viz.schema.width - (layoutMargin.left + layoutMargin.right);\n\n const availableHeight =\n viz.schema.height - (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top);\n const height = !wide\n ? min([viz.schema.colorScaleMaxSize, availableHeight])!\n : viz.schema.height - (layoutMargin.bottom + layoutMargin.top);\n\n const transform = {\n opacity: position ? 1 : 0,\n transform: `translate(${\n wide\n ? layoutMargin.left + padding.left + (availableWidth - width) / 2\n : layoutMargin.left\n }, ${\n wide\n ? layoutMargin.top\n : layoutMargin.top + padding.top + (availableHeight - height) / 2\n })`,\n };\n\n const scaleGroup = elem(\"g.d3plus-viz-colorScale\", {\n condition: showColorScale && !viz.schema.colorScaleConfig.select,\n enter: transform,\n parent: viz._select,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!viz.schema.colorScale) return {panel: null, margin: {}};\n\n const scaleData = data.filter((d: MergedDataPoint, i: number) => {\n const c = viz.schema.colorScale(d as unknown as DataPoint, i);\n return c !== undefined && c !== null;\n });\n\n // Discrete (bucket/jenks/quantile) colorScales render their swatches via an\n // internal Legend, which composes cleanly through the Viz scene — so run\n // them in compute mode (like the legend) so the Viz's toScene owns them and\n // hover/active dimming applies. Without this they render full-mode, where\n // paintComponentScene paints a full-opacity copy that overlays and defeats\n // the dimming. The smooth-gradient variant stays full-mode: its gradient\n // fill is materialized through paintComponentScene, not the Viz scene.\n const csCfg = (viz.schema.colorScaleConfig || {}) as {\n scale?: string;\n bucketAxis?: boolean;\n };\n const csDiscrete =\n !csCfg.bucketAxis &&\n [\"buckets\", \"jenks\", \"quantile\"].includes(\n typeof csCfg.scale === \"string\" ? csCfg.scale : \"\",\n );\n\n viz._colorScaleClass\n .renderMode(csDiscrete ? \"compute\" : \"full\")\n .align(\n ({bottom: \"end\", left: \"start\", right: \"end\", top: \"start\"} as Record<string, string>)[\n position as string\n ] || \"bottom\",\n )\n .duration(viz.schema.duration)\n .data(scaleData)\n .height(height)\n .locale(viz.schema.locale)\n .orient(position)\n .select(scaleGroup)\n .value(viz.schema.colorScale)\n .width(width)\n .config(viz.schema.colorScaleConfig)\n .render();\n\n const margin: Record<string, number> = {};\n if (showColorScale) {\n const scaleBounds = viz._colorScaleClass.outerBounds();\n if (!viz.schema.colorScaleConfig.select && scaleBounds.height) {\n // Use the colorScale's OWN padding for its margin claim — not the\n // legend's, so a custom legendPadding doesn't shift the\n // colorScale's claim when the legend is hidden. The colorScale\n // class is the source of truth.\n const csPadding =\n typeof viz._colorScaleClass.padding === \"function\"\n ? viz._colorScaleClass.padding()\n : viz._legendClass.padding();\n if (wide) margin[position] = scaleBounds.height + csPadding * 2;\n else margin[position] = scaleBounds.width + csPadding * 2;\n }\n }\n return {panel: null, margin};\n },\n};\n\n/* ------------------------------ Attribution ------------------------------ */\n\nexport {attributionFeature} from \"./attributionFeature.js\";\n\n/**\n Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/\n subtitle: the text comes from `sum()` over the filtered data when `_total`\n is a function, or from `sum(data.map(_size))` when `_total === true`.\n*/\nexport const totalFeature: FeatureModule = {\n name: \"total\",\n configFields: [\"total\", \"totalConfig\", \"totalFormat\", \"totalPadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-total\",\n getText: viz => {\n const data = viz._filteredData || [];\n const total =\n typeof viz.schema.total === \"function\"\n ? sum(data.map(viz.schema.total))\n : viz.schema.total === true && viz._size\n ? sum(data.map(viz._size))\n : false;\n return total ? viz.schema.totalFormat(total) : false;\n },\n textClassKey: \"_totalClass\",\n configKey: \"totalConfig\",\n paddingMethod: \"totalPadding\",\n }),\n};\n"],"names":["extent","min","rollup","sum","merge","unique","date","elem","resolveSpec","zoomControlsBox","getTopLeftContributions","topLeftControlsInset","topLeftControlsInsetRaw","VALID_POSITIONS","Set","sanitizePosition","raw","has","runLayout","ctx","features","baseMargin","top","right","bottom","left","claims","panels","f","claim","layout","layoutMargin","result","panel","margin","vizUpdate","push","viz","target","Object","keys","k","key","startsWith","CORNER_INSET_GAP","zoomControlsInset","box","height","inset","width","contributions","cornerInsets","leftInset","rightInset","symmetric","Math","max","textBlockLayout","opts","text","getText","usesPadding","schema","paddingMethod","padding","_padding","textClass","textClassKey","data","locale","config","configKey","boxes","_textData","x","length","centered","tA","lineHeight","lH","blockPadding","lines","y","map","str","i","fS","widths","type","panelKey","font","family","fF","size","anchor","baseline","paint","fill","fC","opacity","fO","transform","titleFeature","name","configFields","title","_filteredData","subtitleFeature","subtitle","legendFeature","setTimeFilter","s","Array","isArray","JSON","stringify","_timelineSelection","nums","Number","timeFilter","d","ms","time","getTime","render","timelineFeature","timelinePossible","timeline","ticks","_data","timelinePadding","timelineGroup","condition","enter","parent","_select","duration","update","node","_timelineClass","renderMode","domain","select","sort","a","b","fullExtent","filtered","timelineDefault","selection","_onPlayToggle","_scheduleSceneRepaint","timelineConfig","on","brush","end","outerBounds","colorScaleFeature","from","leaves","aggs","_ids","join","values","position","colorScalePosition","bind","wide","includes","showColorScale","colorScale","colorScalePadding","availableWidth","colorScaleMaxSize","availableHeight","scaleGroup","colorScaleConfig","scaleData","filter","c","undefined","csCfg","csDiscrete","bucketAxis","scale","_colorScaleClass","align","orient","value","scaleBounds","csPadding","_legendClass","attributionFeature","totalFeature","total","_size","totalFormat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;AAUA,GACA,SAAQA,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,GAAG,QAAO,WAAW;AAElD,SAAQC,KAAK,EAAEC,MAAM,QAAO,eAAe;AAE3C,SAAQC,IAAI,EAAEC,IAAI,QAAO,cAAc;AAIvC,SAAQC,WAAW,QAAO,6BAA6B;AAGvD,SAAQC,eAAe,QAAO,qCAAqC;AACnE,SAAQC,uBAAuB,QAAO,kCAAkC;AACxE,SAAQC,wBAAwBC,uBAAuB,QAAO,wCAAwC;AAyFtG,IAAMC,kBAAuD,IAAIC,IAAI;IACnE;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;AAMA,GACA,OAAO,SAASC,iBAAiBC,GAAY;IAC3C,OAAQH,gBAAgBI,GAAG,CAACD,OAAiBA,MAAM;AACrD;AAEA;;;;;;;;;;AAUA,GACA,OAAO,SAASE,UACdC,GAAe,EACfC,QAAyB;QACzBC,aAAAA,iEAAoC;QAACC,KAAK;QAAGC,OAAO;QAAGC,QAAQ;QAAGC,MAAM;IAAC;IAEzE,mEAAmE;IACnE,+DAA+D;IAC/D,0EAA0E;IAC1E,uEAAuE;IACvE,wDAAwD;IACxD,IAAMC,SAAgC;QAACJ,KAAK;QAAGC,OAAO;QAAGC,QAAQ;QAAGC,MAAM;IAAC;IAC3E,IAAME,SAAsB,EAAE;QACzB,kCAAA,2BAAA;;QAAL,QAAK,YAAWP,6BAAX,SAAA,6BAAA,QAAA,yBAAA,iCAAqB;YAArB,IAAMQ,IAAN;gBAWWC,YACEA,cACCA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gBtC,KAAK;YACnBsE,UAAU;YACV7B,SAASvB,SAATuB,QAASvB;gBACP,IAAM+B,OAAO/B,IAAIqE,aAAa,IAAI,EAAE;gBACpC,IAAMwF,QACJ,OAAO7J,IAAIyB,MAAM,CAACoI,KAAK,KAAK,aACxB/L,IAAIiE,KAAKe,GAAG,CAAC9C,IAAIyB,MAAM,CAACoI,KAAK,KAC7B7J,IAAIyB,MAAM,CAACoI,KAAK,KAAK,QAAQ7J,IAAI8J,KAAK,GACpChM,IAAIiE,KAAKe,GAAG,CAAC9C,IAAI8J,KAAK,KACtB;gBACR,OAAOD,QAAQ7J,IAAIyB,MAAM,CAACsI,WAAW,CAACF,SAAS;YACjD;YACA/H,cAAc;YACdI,WAAW;YACXR,eAAe;QACjB;;AACJ,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/features/features.ts"],"sourcesContent":["/**\n FeatureModule + layout engine. The chart-level features (title,\n subtitle, total, legend, timeline, colorScale, back) are\n `FeatureModule` values composed by `runLayout`, which performs\n **explicit margin negotiation** — each feature returns a `MarginClaim`\n + optional `panel` scene node + optional declarative `vizUpdate`\n writes, and the engine accumulates margins across features in order.\n\n Every Plot-family + chart-shell feature here is wired into\n `vizDrawPure` via `runLayout(ctx, [...features])`.\n*/\nimport {extent, sum} from \"d3-array\";\n\nimport {unique} from \"@d3plus/data\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {date, elem} from \"@d3plus/dom\";\n\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport type {VizContext} from \"../pipeline/stages.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\nimport {zoomControlsBox} from \"../drawSteps/zoomControlsMarkup.js\";\nimport {getTopLeftContributions} from \"../drawSteps/topLeftControls.js\";\nimport {topLeftControlsInset as topLeftControlsInsetRaw} from \"../drawSteps/topLeftControlsMarkup.js\";\n\n/** A margin claim, in pixels along each side. Unclaimed sides default to 0. */\nexport interface MarginClaim {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n}\n\n/** The shape a `layout` step returns: optional panel node + margin claim + optional viz writebacks. */\nexport interface FeatureLayout {\n panel: SceneNode | null;\n margin: MarginClaim;\n /**\n v4 purity: features that need to publish CROSS-FEATURE state — a\n write that a DIFFERENT feature or downstream stage will read — return\n those writes here as declarative key→value pairs. `runLayout`\n applies them to viz after the layout call so the next feature in\n the chain sees them.\n\n Key convention: keys are auto-prefixed with `_` to match viz's\n internal field convention. Return `{drawDepth: 2}` to write\n `viz._drawDepth`; explicitly-underscored keys (`{_drawDepth: 2}`)\n pass through unchanged for the rare case where the engine\n shouldn't prepend. This rule exists because a leading underscore\n is easy to forget and writing `viz.drawDepth` (no underscore) is\n almost never what callers want.\n\n Intra-feature local writes (a feature setting state that its OWN\n component instance reads inside the same `layout()` body) are\n legitimate direct mutations on viz — `vizUpdate` would defer the\n write past the local read. legendFeature's `_legendDepth` is an\n example of an intra-feature local; timelineFeature's\n `_timelineSelection` similarly mutates from its event handler\n context. The contract is about CROSS-feature mutation, not all\n mutation.\n */\n vizUpdate?: Record<string, unknown>;\n}\n\n/**\n @interface FeatureModule\n A chart-level component (title, subtitle, total, legend, timeline,\n colorScale, back, attribution) expressed as a pure value. Each feature:\n - contributes config keys to the chart's schema (`configFields`),\n - optionally derives extra fields onto the pipeline context (`derive`),\n - optionally claims a margin region + emits its panel scene (`layout`),\n - optionally registers event reducers (`events`).\n*/\nexport interface FeatureModule {\n name: string;\n /** Keys the chart's config inherits from this feature (used by E4 fluent gen). */\n configFields?: string[];\n /** Extra derivations to add into the pipeline context. */\n derive?: (ctx: VizContext) => Partial<VizContext>;\n /**\n Pure layout: read the (possibly updated-by-earlier-features) context and\n return the panel scene + margin this feature claims. The layoutEngine\n threads the margin claims through `ctx.layoutMargin` so a feature can\n read what earlier features already took.\n */\n layout?: (\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n ) => FeatureLayout;\n /**\n Event reducers `(ctx, event) => Partial<VizConfig>`. Fire when a\n user interaction occurs on a node tagged with this feature's name.\n */\n events?: Record<string, (ctx: VizContext, event: unknown) => unknown>;\n}\n\n/**\n Result of running a list of features through the layout engine.\n*/\nexport interface LayoutResult {\n /** Panel nodes in feature order, ready to compose into the scene root. */\n panels: SceneNode[];\n /** Final margin after every feature claimed its space. */\n margin: Required<MarginClaim>;\n}\n\n/**\n The allowed values for `legendPosition` and `colorScalePosition`.\n `false` means \"hidden\" (the feature still runs to tear down DOM); the\n four strings are the four sides.\n*/\nexport type PanelPosition = false | \"top\" | \"right\" | \"bottom\" | \"left\";\n\nconst VALID_POSITIONS: ReadonlySet<PanelPosition | string> = new Set([\n false as unknown as string,\n \"top\",\n \"right\",\n \"bottom\",\n \"left\",\n]);\n\n/**\n Canonical sanitizer for `legendPosition` / `colorScalePosition`.\n Falls back to `\"bottom\"` when the user-supplied accessor returns\n something outside the allowed set. Single source of truth — used by\n `vizDrawPure` (for sanitized ctx publication) and by `legendFeature`\n + `colorScaleFeature` (for their internal positioning math).\n*/\nexport function sanitizePosition(raw: unknown): PanelPosition {\n return (VALID_POSITIONS.has(raw as string) ? raw : \"bottom\") as PanelPosition;\n}\n\n/**\n Runs each feature's `layout` in order, accumulating margin claims so that\n later features see the space already taken by earlier ones. The order of\n `features` is the layout order — this is how implicit `this._margin +=`\n side effects become *explicit* data flow.\n\n Today's order in `Viz._draw` (`drawTitle`, `drawSubtitle`, `drawTotal`,\n `drawBack`, `drawAttribution`, `drawColorScale`, `drawLegend`,\n `drawTimeline`) should be ported verbatim as the default sequence — port\n the math first, then improve.\n*/\nexport function runLayout(\n ctx: VizContext,\n features: FeatureModule[],\n baseMargin: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0},\n): LayoutResult {\n // `claims` is this call's accumulated margin (the returned delta).\n // `layoutMargin` handed to each feature is the running TOTAL —\n // `baseMargin` (margin already taken by prior runLayout calls in the same\n // draw) plus the claims taken so far in this call — so a feature reads\n // the true current margin without touching viz._margin.\n const claims: Required<MarginClaim> = {top: 0, right: 0, bottom: 0, left: 0};\n const panels: SceneNode[] = [];\n for (const f of features) {\n if (!f.layout) continue;\n const layoutMargin: Required<MarginClaim> = {\n top: baseMargin.top + claims.top,\n right: baseMargin.right + claims.right,\n bottom: baseMargin.bottom + claims.bottom,\n left: baseMargin.left + claims.left,\n };\n const result = f.layout({...ctx, layoutMargin});\n const {panel, margin: claim, vizUpdate} = result;\n if (panel) panels.push(panel);\n claims.top += claim.top ?? 0;\n claims.right += claim.right ?? 0;\n claims.bottom += claim.bottom ?? 0;\n claims.left += claim.left ?? 0;\n // v4 purity: features publish cross-feature viz writes declaratively\n // via `vizUpdate`. The engine applies them — features don't mutate\n // viz directly from layout(). Skips own component-instance config\n // calls (those are local mutation, not cross-feature). Use\n // `Object.keys` (not `for...in`) so inherited enumerable properties\n // on a class-instance vizUpdate don't leak onto viz.\n //\n // Key convention: keys are auto-prefixed with `_` to land on the\n // viz's internal field convention (`viz._drawDepth`, `viz._legendDepth`).\n // Features should return UNPREFIXED keys (`{drawDepth: 2}`); the\n // engine normalizes — so feature authors can't accidentally write\n // `viz.drawDepth` (a different non-underscore property) instead of\n // `viz._drawDepth`. Keys that already start with `_` are passed\n // through unchanged so future explicit-internal writes still work.\n if (vizUpdate && ctx.viz) {\n const target = ctx.viz as Record<string, unknown>;\n for (const k of Object.keys(vizUpdate)) {\n const key = k.startsWith(\"_\") ? k : `_${k}`;\n target[key] = vizUpdate[k];\n }\n }\n }\n return {panels, margin: claims};\n}\n\n/* --------------------------- text-block features --------------------------- */\n\n/** A TextBox `_textData()` row, as the text-block features read it. */\ninterface TextDatum {\n lines: string[];\n lH: number;\n fS: number;\n fF: string;\n fC: string;\n fO: number;\n tA: string;\n widths: number[];\n}\n\n/**\n A little breathing room added to a NON-zero corner inset, on top of the\n exact pixel width the corner panel measured at. Without it, content\n insets to EXACTLY the corner box's edge — any tiny discrepancy between\n that hidden-probe measurement and the real rendered box (sub-pixel\n rounding, a font metric quirk) then reads as the text visibly, if\n slightly, running under the buttons.\n*/\nconst CORNER_INSET_GAP = 6;\n\n/**\n How far content starting `top` px down the chart, whose right edge sits\n `right` px in from the chart's right edge, must pull in its right edge to\n clear the zoom-control panel pinned to the chart's top-right corner. Zero\n when the chart shows no controls or the content starts below them.\n*/\nexport function zoomControlsInset(viz: VizInstance, top: number, right: number): number {\n const box = zoomControlsBox(viz as never);\n if (!box || top >= box.height) return 0;\n const inset = box.width - right;\n return inset > 0 ? inset + CORNER_INSET_GAP : 0;\n}\n\n/**\n The left-side mirror of `zoomControlsInset`: how far content starting\n `top` px down the chart, whose left edge sits `left` px in from the\n chart's left edge, must pull in to clear the shared top-left controls\n panel (back / table-view / search). Zero when nothing is showing there\n or content starts below the panel's height.\n*/\nexport function topLeftControlsInset(viz: VizInstance, top: number, left: number): number {\n const contributions = getTopLeftContributions(viz as never);\n const inset = topLeftControlsInsetRaw(viz as never, top, left, contributions);\n return inset > 0 ? inset + CORNER_INSET_GAP : 0;\n}\n\n/**\n The combined left+right corner-panel insets for content starting `top`\n px down the chart, plus the single symmetric amount CENTERED content\n should inset both sides by to stay centered on the full chart width even\n when only one corner has something to avoid (the larger of the two —\n see `textBlockLayout`'s doc comment for why). Shared by `textBlockLayout`\n (title/subtitle/total) and the legend's own top-position layout\n (`featuresLegend.ts`), which independently needed this exact same\n \"combine the two corners' insets\" math before this existed.\n*/\nexport function cornerInsets(\n viz: VizInstance,\n top: number,\n left: number,\n right: number,\n): {left: number; right: number; symmetric: number} {\n const leftInset = topLeftControlsInset(viz, top, left);\n const rightInset = zoomControlsInset(viz, top, right);\n return {left: leftInset, right: rightInset, symmetric: Math.max(leftInset, rightInset)};\n}\n\n/**\n Shared layout logic for any \"single line of text claiming margin.top\" feature\n (title, subtitle, total). Each feature passes the viz fields that source its\n text + TextBox + config; the helper computes the panel + margin claim using\n the TextBox's pure `_textData()` (no DOM).\n*/\nfunction textBlockLayout(\n ctx: VizContext & {layoutMargin: Required<MarginClaim>},\n opts: {\n panelKey: string;\n getText: (viz: VizInstance) => string | false;\n textClassKey: string; // e.g. \"_titleClass\"\n configKey: string; // schema key, e.g. \"titleConfig\"\n paddingMethod: string; // schema key, e.g. \"titlePadding\"\n },\n): FeatureLayout {\n const {viz, layoutMargin} = ctx;\n const text = opts.getText(viz);\n if (!text) return {panel: null, margin: {}};\n\n const usesPadding = (viz.schema[opts.paddingMethod] as (viz: VizInstance) => boolean)(viz);\n const padding = usesPadding\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n let width =\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right);\n\n const textClass = viz[opts.textClassKey];\n textClass\n .data([{text}])\n .locale(viz.schema.locale)\n .width(width)\n .config(viz.schema[opts.configKey]);\n let boxes = textClass._textData() as TextDatum[];\n\n // Text alongside the zoom controls (right) and/or the shared top-left\n // controls panel (left — back/table-view/search) wraps short of them.\n // Centered text insets both sides by the SAME (larger) amount so it stays\n // centered on the full chart width, matching how it already behaved\n // relative to zoom alone; start/end-aligned text instead just narrows the\n // true available box (its unaffected edge stays exactly where it was).\n let x = layoutMargin.left + padding.left;\n const {left: leftInset, right: rightInset, symmetric} = cornerInsets(\n viz,\n layoutMargin.top,\n layoutMargin.left + padding.left,\n layoutMargin.right + padding.right,\n );\n if ((rightInset || leftInset) && boxes.length) {\n const centered = boxes[0].tA === \"middle\";\n if (centered) {\n x += symmetric;\n width -= symmetric * 2;\n } else {\n x += leftInset;\n width -= leftInset + rightInset;\n }\n textClass.width(width);\n boxes = textClass._textData() as TextDatum[];\n }\n if (!boxes.length) return {panel: null, margin: {}};\n const box = boxes[0];\n\n const lineHeight = box.lH;\n const blockPadding = (viz.schema[opts.configKey]?.padding as number) ?? 0;\n const height = box.lines.length * lineHeight + blockPadding * 2;\n // The claimed margin (below) already reserves `blockPadding` above AND\n // below the text — shifting the panel down by that same amount is what\n // actually centers the text within that reserved band, rather than\n // pinning it flush to the very top of it. Previously `blockPadding` only\n // grew/shrank the claimed space; it never moved the text within it,\n // which is why the default title padding (5px) had no visible effect —\n // the title sat at the top of its claim regardless, reading noticeably\n // higher than the same-row zoom/back/search buttons beside it.\n const y = layoutMargin.top + blockPadding;\n\n const lines = box.lines.map((str: string, i: number) => ({\n text: str,\n x:\n box.tA === \"middle\"\n ? width / 2\n : box.tA === \"end\"\n ? width\n : 0,\n y: (i + 1) * lineHeight - (lineHeight - box.fS),\n width: box.widths?.[i] ?? 0,\n }));\n\n const panel: SceneNode = {\n type: \"text\",\n key: opts.panelKey,\n x: 0,\n y: 0,\n lines,\n font: {\n family: box.fF,\n size: box.fS,\n anchor:\n box.tA === \"middle\" || box.tA === \"end\" || box.tA === \"start\"\n ? (box.tA as \"middle\" | \"end\" | \"start\")\n : \"start\",\n baseline: \"alphabetic\",\n },\n paint: {fill: box.fC, opacity: box.fO},\n transform: {x, y},\n };\n\n return {panel, margin: {top: height}};\n}\n\n/**\n Title as a FeatureModule. Uses `_titleClass._textData()` for height\n (pure compute, no DOM) and returns the margin claim explicitly.\n*/\nexport const titleFeature: FeatureModule = {\n name: \"title\",\n configFields: [\"title\", \"titleConfig\", \"titlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-title\",\n getText: viz => (viz.schema.title ? viz.schema.title(viz._filteredData || []) : false),\n textClassKey: \"_titleClass\",\n configKey: \"titleConfig\",\n paddingMethod: \"titlePadding\",\n }),\n};\n\n/** Converts `drawSubtitle.ts` to a FeatureModule. Mirrors titleFeature. */\nexport const subtitleFeature: FeatureModule = {\n name: \"subtitle\",\n configFields: [\"subtitle\", \"subtitleConfig\", \"subtitlePadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-subtitle\",\n getText: viz => (viz.schema.subtitle ? viz.schema.subtitle(viz._filteredData || []) : false),\n textClassKey: \"_subtitleClass\",\n configKey: \"subtitleConfig\",\n paddingMethod: \"subtitlePadding\",\n }),\n};\n\n/* -------------------------------- Legend --------------------------------- */\n\nexport {legendFeature} from \"./featuresLegend.js\";\n\n/* -------------------------------- Timeline ------------------------------- */\n\n/**\n Helper mirroring drawTimeline's `setTimeFilter`. Triggers a re-render when\n the brush selection changes — kept here so the feature owns its event flow.\n*/\nfunction setTimeFilter(viz: VizInstance, s: Date | Date[] | number[]): void {\n if (!Array.isArray(s)) s = [s, s] as Date[];\n if (JSON.stringify(s) !== JSON.stringify(viz._timelineSelection)) {\n viz._timelineSelection = s;\n const nums = (s as Array<Date | number>).map(Number) as number[];\n viz\n .timeFilter!((d: DataPoint) => {\n const ms = (date(viz.schema.time(d)) as Date).getTime();\n return ms >= nums[0] && ms <= nums[1];\n })\n .render!();\n }\n}\n\n/**\n Converts `drawTimeline.ts` to a FeatureModule.\n\n Visible only when `_time` is set, `_timeline` is truthy, and there is more\n than one distinct tick. Renders the chart's `_timelineClass` Timeline\n instance (compute mode — scene comes from Timeline.toScene via Viz.toScene's\n components collection) and claims `margin.bottom` from its outerBounds.\n*/\nexport const timelineFeature: FeatureModule = {\n name: \"timeline\",\n configFields: [\"timeline\", \"timelineConfig\", \"timelinePadding\"],\n layout: ({viz, layoutMargin}) => {\n let timelinePossible = viz.schema.time && viz.schema.timeline;\n const ticks = (\n timelinePossible\n ? unique(viz._data.map(viz.schema.time)).map(\n (d: unknown) => date(d as string | number),\n )\n : []\n ) as Date[];\n timelinePossible = timelinePossible && ticks.length > 1;\n const padding = viz.schema.timelinePadding(viz)\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n const transform = {\n transform: `translate(${layoutMargin.left + padding.left}, 0)`,\n };\n\n const timelineGroup = elem(\"g.d3plus-viz-timeline\", {\n condition: timelinePossible,\n enter: transform,\n parent: viz._select,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!timelinePossible) return {panel: null, margin: {}};\n\n const timeline = viz._timelineClass\n .renderMode(\"compute\")\n .domain(extent(ticks) as [Date, Date])\n .duration(viz.schema.duration)\n .height(viz.schema.height - layoutMargin.bottom)\n .locale(viz.schema.locale)\n .select(timelineGroup)\n .ticks(ticks.sort((a: Date, b: Date) => +a - +b))\n .width(\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right),\n );\n\n // Clamp bound = the full time range (every tick); it never goes stale\n // mid-render. Clamping to `viz._filteredData`'s extent instead collapsed a\n // freshly-committed range down to the previous selection — the release\n // snap-back (e.g. [2017,2024] clamped to a stale [2022,2022]).\n const fullExtent = extent(ticks) as [Date, Date];\n if (!viz._timelineSelection) {\n // First render only: default to the *filtered* extent, which the\n // synthesized default timeFilter pins to the latest period (see\n // vizPreDraw) — the historical default. `timelineDefault` overrides it.\n const filtered = extent(\n (viz._filteredData || [])\n .map(viz.schema.time)\n .map((d: unknown) => date(d as string | number)) as Date[],\n ) as [Date, Date];\n viz._timelineSelection =\n viz.schema.timelineDefault || (filtered[0] ? filtered : fullExtent);\n } else {\n if (viz._timelineSelection[0] < fullExtent[0])\n viz._timelineSelection[0] = fullExtent[0];\n if (viz._timelineSelection[1] > fullExtent[1])\n viz._timelineSelection[1] = fullExtent[1];\n }\n timeline.selection(viz._timelineSelection);\n\n // Repaint the scene when playback toggles without moving the selection\n // (e.g. a manual pause), so the play/pause glyph refreshes immediately.\n timeline._onPlayToggle = () => viz._scheduleSceneRepaint();\n\n const config = viz.schema.timelineConfig;\n timeline\n .config(config)\n .on(\"brush\", (s: Date[]) => {\n // Filter on \"end\", not on every brush move. Re-rendering the whole Viz\n // mid-drag re-creates the d3-brush (and starts a brush transition),\n // which fights the active gesture and can make the selection snap back\n // on release — and it re-lays-out the chart on every pixel of the drag,\n // which is costly for large data. The brush still tracks the cursor\n // live; the chart updates when the drag finishes. User `on.brush`\n // callbacks still fire for custom live behavior.\n if (config.on && config.on.brush) config.on.brush(s);\n })\n .on(\"end\", (s: Date[]) => {\n setTimeFilter(viz, s);\n if (config.on && config.on.end) config.on.end(s);\n })\n .render();\n\n return {\n panel: null,\n margin: {bottom: timeline.outerBounds().height + timeline.padding() * 2},\n };\n },\n};\n\n/* ------------------------------- ColorScale ------------------------------ */\n\nexport {colorScaleFeature} from \"./featuresColorScale.js\";\n\n/* ------------------------------ Attribution ------------------------------ */\n\nexport {attributionFeature} from \"./attributionFeature.js\";\n\n/**\n Converts `drawTotal.ts` to a FeatureModule. Slightly different from title/\n subtitle: the text comes from `sum()` over the filtered data when `_total`\n is a function, or from `sum(data.map(_size))` when `_total === true`.\n*/\nexport const totalFeature: FeatureModule = {\n name: \"total\",\n configFields: [\"total\", \"totalConfig\", \"totalFormat\", \"totalPadding\"],\n layout: ctx =>\n textBlockLayout(ctx, {\n panelKey: \"viz-total\",\n getText: viz => {\n const data = viz._filteredData || [];\n const total =\n typeof viz.schema.total === \"function\"\n ? sum(data.map(viz.schema.total))\n : viz.schema.total === true && viz._size\n ? sum(data.map(viz._size))\n : false;\n return total ? viz.schema.totalFormat(total) : false;\n },\n textClassKey: \"_totalClass\",\n configKey: \"totalConfig\",\n paddingMethod: \"totalPadding\",\n }),\n};\n"],"names":["extent","sum","unique","date","elem","zoomControlsBox","getTopLeftContributions","topLeftControlsInset","topLeftControlsInsetRaw","VALID_POSITIONS","Set","sanitizePosition","raw","has","runLayout","ctx","features","baseMargin","top","right","bottom","left","claims","panels","f","claim","layout","layoutMargin","result","panel","margin","vizUpdate","push","viz","target","Object","keys","k","key","startsWith","CORNER_INSET_GAP","zoomControlsInset","box","height","inset","width","contributions","cornerInsets","leftInset","rightInset","symmetric","Math","max","textBlockLayout","opts","text","getText","usesPadding","schema","paddingMethod","padding","_padding","textClass","textClassKey","data","locale","config","configKey","boxes","_textData","x","length","centered","tA","lineHeight","lH","blockPadding","lines","y","map","str","i","fS","widths","type","panelKey","font","family","fF","size","anchor","baseline","paint","fill","fC","opacity","fO","transform","titleFeature","name","configFields","title","_filteredData","subtitleFeature","subtitle","legendFeature","setTimeFilter","s","Array","isArray","JSON","stringify","_timelineSelection","nums","Number","timeFilter","d","ms","time","getTime","render","timelineFeature","timelinePossible","timeline","ticks","_data","timelinePadding","timelineGroup","condition","enter","parent","_select","duration","update","node","_timelineClass","renderMode","domain","select","sort","a","b","fullExtent","filtered","timelineDefault","selection","_onPlayToggle","_scheduleSceneRepaint","timelineConfig","on","brush","end","outerBounds","colorScaleFeature","attributionFeature","totalFeature","total","_size","totalFormat"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;AAUA,GACA,SAAQA,MAAM,EAAEC,GAAG,QAAO,WAAW;AAErC,SAAQC,MAAM,QAAO,eAAe;AAEpC,SAAQC,IAAI,EAAEC,IAAI,QAAO,cAAc;AAMvC,SAAQC,eAAe,QAAO,qCAAqC;AACnE,SAAQC,uBAAuB,QAAO,kCAAkC;AACxE,SAAQC,wBAAwBC,uBAAuB,QAAO,wCAAwC;AAyFtG,IAAMC,kBAAuD,IAAIC,IAAI;IACnE;IACA;IACA;IACA;IACA;CACD;AAED;;;;;;AAMA,GACA,OAAO,SAASC,iBAAiBC,GAAY;IAC3C,OAAQH,gBAAgBI,GAAG,CAACD,OAAiBA,MAAM;AACrD;AAEA;;;;;;;;;;AAUA,GACA,OAAO,SAASE,UACdC,GAAe,EACfC,QAAyB;QACzBC,aAAAA,iEAAoC;QAACC,KAAK;QAAGC,OAAO;QAAGC,QAAQ;QAAGC,MAAM;IAAC;IAEzE,mEAAmE;IACnE,+DAA+D;IAC/D,0EAA0E;IAC1E,uEAAuE;IACvE,wDAAwD;IACxD,IAAMC,SAAgC;QAACJ,KAAK;QAAGC,OAAO;QAAGC,QAAQ;QAAGC,MAAM;IAAC;IAC3E,IAAME,SAAsB,EAAE;QACzB,kCAAA,2BAAA;;QAAL,QAAK,YAAWP,6BAAX,SAAA,6BAAA,QAAA,yBAAA,iCAAqB;YAArB,IAAMQ,IAAN;gBAWWC,YACEA,cACCA,eACFA;YAbf,IAAI,CAACD,EAAEE,MAAM,EAAE;YACf,IAAMC,eAAsC;gBAC1CT,KAAKD,WAAWC,GAAG,GAAGI,OAAOJ,GAAG;gBAChCC,OAAOF,WAAWE,KA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MAAM,CAACkG,KAAK,KAAK,QAAQ3H,IAAI4H,KAAK,GACpC5J,IAAI+D,KAAKe,GAAG,CAAC9C,IAAI4H,KAAK,KACtB;gBACR,OAAOD,QAAQ3H,IAAIyB,MAAM,CAACoG,WAAW,CAACF,SAAS;YACjD;YACA7F,cAAc;YACdI,WAAW;YACXR,eAAe;QACjB;;AACJ,EAAE"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The `colorScaleFeature` FeatureModule, re-exported from `features.ts`.
|
|
3
|
+
The colorScale either claims a margin band along its position side, or —
|
|
4
|
+
while it's being laid out for the chart's interior (see
|
|
5
|
+
`pipeline/insetPlacement.ts`) — lays out at the origin and claims nothing.
|
|
6
|
+
*/ import { min, rollup } from "d3-array";
|
|
7
|
+
import { merge } from "@d3plus/data";
|
|
8
|
+
import { elem } from "@d3plus/dom";
|
|
9
|
+
import { resolveSpec } from "../pipeline/resolveSpec.js";
|
|
10
|
+
import { bottomRightClearance } from "../drawSteps/bottomRightControlsMarkup.js";
|
|
11
|
+
import { sanitizePosition } from "./features.js";
|
|
12
|
+
import { insetFrame, insetOrient, isInsetPending } from "./insetState.js";
|
|
13
|
+
/** The colorScale's data: the chart's data rolled up per time/id, keeping rows with a colorScale value. */ function colorScaleData(viz) {
|
|
14
|
+
var data = Array.from(rollup(viz._data, function(leaves) {
|
|
15
|
+
return merge(leaves, viz.schema.aggs);
|
|
16
|
+
}, function(d, i) {
|
|
17
|
+
return "".concat(viz.schema.time ? viz.schema.time(d, i) : "all", "-").concat(viz._ids(d, i).join("_"));
|
|
18
|
+
}).values());
|
|
19
|
+
return data.filter(function(d, i) {
|
|
20
|
+
var c = viz.schema.colorScale(d, i);
|
|
21
|
+
return c !== undefined && c !== null;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
Configures and lays out the chart's `_colorScaleClass` into `frame`. It
|
|
26
|
+
always runs in compute mode: Viz.toScene composes its scene, so the
|
|
27
|
+
colorScale never paints a DOM copy of its own.
|
|
28
|
+
*/ function paintColorScale(viz, frame, show) {
|
|
29
|
+
var transform = {
|
|
30
|
+
opacity: frame.orient ? 1 : 0,
|
|
31
|
+
transform: "translate(".concat(frame.x, ", ").concat(frame.y, ")")
|
|
32
|
+
};
|
|
33
|
+
var scaleGroup = elem("g.d3plus-viz-colorScale", {
|
|
34
|
+
condition: show && !viz.schema.colorScaleConfig.select,
|
|
35
|
+
enter: transform,
|
|
36
|
+
parent: viz._select,
|
|
37
|
+
duration: viz.schema.duration,
|
|
38
|
+
update: transform
|
|
39
|
+
}).node();
|
|
40
|
+
if (!viz.schema.colorScale) return;
|
|
41
|
+
viz._colorScaleClass.renderMode("compute").align(frame.align).duration(viz.schema.duration).data(colorScaleData(viz)).height(frame.height).locale(viz.schema.locale).orient(frame.orient).select(scaleGroup).value(viz.schema.colorScale).width(frame.width).config(viz.schema.colorScaleConfig).render();
|
|
42
|
+
}
|
|
43
|
+
/** The colorScale's sanitized position side (false when hidden). */ function colorScalePosition(viz) {
|
|
44
|
+
return sanitizePosition(viz.schema.colorScalePosition.bind(viz)(resolveSpec(viz)));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
Lays the colorScale out to be drawn inside the chart: at the origin —
|
|
48
|
+
Viz.toScene moves it into place — vertically (`"column"`) or
|
|
49
|
+
horizontally (`"row"`), sized against the chart area `area`. Returns its
|
|
50
|
+
measured size, or null when it isn't showing.
|
|
51
|
+
*/ export function paintColorScaleInset(viz, orient, area) {
|
|
52
|
+
var show = Boolean(viz.schema.colorScale) && colorScalePosition(viz) !== false && !viz.schema.colorScaleConfig.select;
|
|
53
|
+
var frame = insetFrame(orient, area);
|
|
54
|
+
var maxSize = viz.schema.colorScaleMaxSize;
|
|
55
|
+
paintColorScale(viz, {
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0,
|
|
58
|
+
width: orient === "row" ? min([
|
|
59
|
+
maxSize,
|
|
60
|
+
frame.width
|
|
61
|
+
]) : frame.width,
|
|
62
|
+
height: orient === "column" ? min([
|
|
63
|
+
maxSize,
|
|
64
|
+
frame.height
|
|
65
|
+
]) : frame.height,
|
|
66
|
+
orient: orient === "column" ? "right" : "bottom",
|
|
67
|
+
align: "start"
|
|
68
|
+
}, show);
|
|
69
|
+
if (!show) return null;
|
|
70
|
+
var _viz__colorScaleClass_outerBounds = viz._colorScaleClass.outerBounds(), width = _viz__colorScaleClass_outerBounds.width, height = _viz__colorScaleClass_outerBounds.height;
|
|
71
|
+
return width && height ? {
|
|
72
|
+
width: width,
|
|
73
|
+
height: height
|
|
74
|
+
} : null;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
Converts `drawColorScale.ts` to a FeatureModule.
|
|
78
|
+
|
|
79
|
+
Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves
|
|
80
|
+
to a side. Renders the chart's `_colorScaleClass` ColorScale instance and
|
|
81
|
+
claims margin along its position side.
|
|
82
|
+
*/ export var colorScaleFeature = {
|
|
83
|
+
name: "colorScale",
|
|
84
|
+
configFields: [
|
|
85
|
+
"colorScale",
|
|
86
|
+
"colorScaleConfig",
|
|
87
|
+
"colorScaleMaxSize",
|
|
88
|
+
"colorScalePadding",
|
|
89
|
+
"colorScalePosition"
|
|
90
|
+
],
|
|
91
|
+
layout: function layout(param) {
|
|
92
|
+
var viz = param.viz, layoutMargin = param.layoutMargin;
|
|
93
|
+
if (isInsetPending(viz, "colorScale")) {
|
|
94
|
+
paintColorScaleInset(viz, insetOrient(viz, "colorScale"), {
|
|
95
|
+
width: viz.schema.width - layoutMargin.left - layoutMargin.right,
|
|
96
|
+
height: viz.schema.height - layoutMargin.top - layoutMargin.bottom
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
panel: null,
|
|
100
|
+
margin: {}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
var position = colorScalePosition(viz);
|
|
104
|
+
var wide = [
|
|
105
|
+
"top",
|
|
106
|
+
"bottom"
|
|
107
|
+
].includes(position);
|
|
108
|
+
var showColorScale = viz.schema.colorScale && position;
|
|
109
|
+
var padding = viz.schema.colorScalePadding(viz) ? viz._padding : {
|
|
110
|
+
top: 0,
|
|
111
|
+
right: 0,
|
|
112
|
+
bottom: 0,
|
|
113
|
+
left: 0
|
|
114
|
+
};
|
|
115
|
+
// Share the bottom band with the bottom-right corner panel (size legend):
|
|
116
|
+
// a bottom colorScale fits beside it, a side one ends above it.
|
|
117
|
+
var corner = bottomRightClearance(viz, position, layoutMargin.bottom + padding.bottom, layoutMargin.right + padding.right);
|
|
118
|
+
var availableWidth = viz.schema.width - (layoutMargin.left + layoutMargin.right + padding.left + padding.right) - corner.inset;
|
|
119
|
+
var width = wide ? min([
|
|
120
|
+
viz.schema.colorScaleMaxSize,
|
|
121
|
+
availableWidth
|
|
122
|
+
]) : viz.schema.width - (layoutMargin.left + layoutMargin.right);
|
|
123
|
+
var availableHeight = viz.schema.height - (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top) - corner.drop;
|
|
124
|
+
var height = !wide ? min([
|
|
125
|
+
viz.schema.colorScaleMaxSize,
|
|
126
|
+
availableHeight
|
|
127
|
+
]) : viz.schema.height - (layoutMargin.bottom + layoutMargin.top);
|
|
128
|
+
paintColorScale(viz, {
|
|
129
|
+
x: wide ? layoutMargin.left + padding.left + (availableWidth - width) / 2 : layoutMargin.left,
|
|
130
|
+
y: wide ? layoutMargin.top : layoutMargin.top + padding.top + (availableHeight - height) / 2,
|
|
131
|
+
width: width,
|
|
132
|
+
height: height,
|
|
133
|
+
orient: position,
|
|
134
|
+
align: {
|
|
135
|
+
bottom: "end",
|
|
136
|
+
left: "start",
|
|
137
|
+
right: "end",
|
|
138
|
+
top: "start"
|
|
139
|
+
}[position] || "bottom"
|
|
140
|
+
}, Boolean(showColorScale));
|
|
141
|
+
var margin = {};
|
|
142
|
+
if (showColorScale) {
|
|
143
|
+
var scaleBounds = viz._colorScaleClass.outerBounds();
|
|
144
|
+
if (!viz.schema.colorScaleConfig.select && scaleBounds.height) {
|
|
145
|
+
// Use the colorScale's OWN padding for its margin claim — not the
|
|
146
|
+
// legend's, so a custom legendPadding doesn't shift the
|
|
147
|
+
// colorScale's claim when the legend is hidden. The colorScale
|
|
148
|
+
// class is the source of truth.
|
|
149
|
+
var csPadding = typeof viz._colorScaleClass.padding === "function" ? viz._colorScaleClass.padding() : viz._legendClass.padding();
|
|
150
|
+
if (wide) margin[position] = scaleBounds.height + csPadding * 2;
|
|
151
|
+
else margin[position] = scaleBounds.width + csPadding * 2;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
panel: null,
|
|
156
|
+
margin: margin
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
//# sourceMappingURL=featuresColorScale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/features/featuresColorScale.ts"],"sourcesContent":["/**\n The `colorScaleFeature` FeatureModule, re-exported from `features.ts`.\n The colorScale either claims a margin band along its position side, or —\n while it's being laid out for the chart's interior (see\n `pipeline/insetPlacement.ts`) — lays out at the origin and claims nothing.\n*/\nimport {min, rollup} from \"d3-array\";\n\nimport {merge} from \"@d3plus/data\";\nimport type {DataPoint, MergedDataPoint} from \"@d3plus/data\";\nimport {elem} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport {resolveSpec} from \"../pipeline/resolveSpec.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\nimport {bottomRightClearance} from \"../drawSteps/bottomRightControlsMarkup.js\";\nimport type {FeatureModule} from \"./features.js\";\nimport {sanitizePosition} from \"./features.js\";\nimport {insetFrame, insetOrient, isInsetPending} from \"./insetState.js\";\nimport type {InsetOrient} from \"./insetState.js\";\n\n/** Where and how the colorScale lays itself out for one render. */\ninterface ColorScaleFrame {\n x: number;\n y: number;\n width: number;\n height: number;\n /** The side the scale's labels face, which also sets its direction. */\n orient: string | false;\n align: string;\n}\n\n/** The colorScale's data: the chart's data rolled up per time/id, keeping rows with a colorScale value. */\nfunction colorScaleData(viz: VizInstance): MergedDataPoint[] {\n const data = Array.from(\n rollup(\n viz._data,\n (leaves: DataPoint[]) => merge(leaves, viz.schema.aggs),\n (d: DataPoint, i: number) =>\n `${viz.schema.time ? viz.schema.time(d, i) : \"all\"}-${viz._ids(d, i).join(\"_\")}`,\n ).values(),\n );\n return data.filter((d: MergedDataPoint, i: number) => {\n const c = viz.schema.colorScale(d as unknown as DataPoint, i);\n return c !== undefined && c !== null;\n });\n}\n\n/**\n Configures and lays out the chart's `_colorScaleClass` into `frame`. It\n always runs in compute mode: Viz.toScene composes its scene, so the\n colorScale never paints a DOM copy of its own.\n*/\nfunction paintColorScale(viz: VizInstance, frame: ColorScaleFrame, show: boolean): void {\n const transform = {\n opacity: frame.orient ? 1 : 0,\n transform: `translate(${frame.x}, ${frame.y})`,\n };\n\n const scaleGroup = elem(\"g.d3plus-viz-colorScale\", {\n condition: show && !viz.schema.colorScaleConfig.select,\n enter: transform,\n parent: viz._select as unknown as D3Selection,\n duration: viz.schema.duration,\n update: transform,\n }).node();\n\n if (!viz.schema.colorScale) return;\n\n viz._colorScaleClass!\n .renderMode(\"compute\")\n .align(frame.align)\n .duration(viz.schema.duration)\n .data(colorScaleData(viz))\n .height(frame.height)\n .locale(viz.schema.locale)\n .orient(frame.orient)\n .select(scaleGroup)\n .value(viz.schema.colorScale)\n .width(frame.width)\n .config(viz.schema.colorScaleConfig)\n .render();\n}\n\n/** The colorScale's sanitized position side (false when hidden). */\nfunction colorScalePosition(viz: VizInstance): ReturnType<typeof sanitizePosition> {\n return sanitizePosition(viz.schema.colorScalePosition.bind(viz)(resolveSpec(viz)));\n}\n\n/**\n Lays the colorScale out to be drawn inside the chart: at the origin —\n Viz.toScene moves it into place — vertically (`\"column\"`) or\n horizontally (`\"row\"`), sized against the chart area `area`. Returns its\n measured size, or null when it isn't showing.\n*/\nexport function paintColorScaleInset(\n viz: VizInstance,\n orient: InsetOrient,\n area: {width: number; height: number},\n): {width: number; height: number} | null {\n const show = Boolean(viz.schema.colorScale) && colorScalePosition(viz) !== false &&\n !viz.schema.colorScaleConfig.select;\n const frame = insetFrame(orient, area);\n const maxSize = viz.schema.colorScaleMaxSize;\n paintColorScale(viz, {\n x: 0,\n y: 0,\n width: orient === \"row\" ? min([maxSize, frame.width])! : frame.width,\n height: orient === \"column\" ? min([maxSize, frame.height])! : frame.height,\n orient: orient === \"column\" ? \"right\" : \"bottom\",\n align: \"start\",\n }, show);\n if (!show) return null;\n const {width, height} = viz._colorScaleClass!.outerBounds();\n return width && height ? {width, height} : null;\n}\n\n/**\n Converts `drawColorScale.ts` to a FeatureModule.\n\n Visible only when `_colorScale` is truthy and `_colorScalePosition` resolves\n to a side. Renders the chart's `_colorScaleClass` ColorScale instance and\n claims margin along its position side.\n*/\nexport const colorScaleFeature: FeatureModule = {\n name: \"colorScale\",\n configFields: [\n \"colorScale\",\n \"colorScaleConfig\",\n \"colorScaleMaxSize\",\n \"colorScalePadding\",\n \"colorScalePosition\",\n ],\n layout: ({viz, layoutMargin}) => {\n if (isInsetPending(viz, \"colorScale\")) {\n paintColorScaleInset(viz, insetOrient(viz, \"colorScale\"), {\n width: viz.schema.width - layoutMargin.left - layoutMargin.right,\n height: viz.schema.height - layoutMargin.top - layoutMargin.bottom,\n });\n return {panel: null, margin: {}};\n }\n\n const position = colorScalePosition(viz);\n const wide = [\"top\", \"bottom\"].includes(position as string);\n const showColorScale = viz.schema.colorScale && position;\n const padding = viz.schema.colorScalePadding(viz)\n ? viz._padding\n : {top: 0, right: 0, bottom: 0, left: 0};\n\n // Share the bottom band with the bottom-right corner panel (size legend):\n // a bottom colorScale fits beside it, a side one ends above it.\n const corner = bottomRightClearance(\n viz, position, layoutMargin.bottom + padding.bottom, layoutMargin.right + padding.right,\n );\n\n const availableWidth =\n viz.schema.width -\n (layoutMargin.left + layoutMargin.right + padding.left + padding.right) -\n corner.inset;\n const width = wide\n ? min([viz.schema.colorScaleMaxSize, availableWidth])!\n : viz.schema.width - (layoutMargin.left + layoutMargin.right);\n\n const availableHeight =\n viz.schema.height -\n (layoutMargin.bottom + layoutMargin.top + padding.bottom + padding.top) -\n corner.drop;\n const height = !wide\n ? min([viz.schema.colorScaleMaxSize, availableHeight])!\n : viz.schema.height - (layoutMargin.bottom + layoutMargin.top);\n\n paintColorScale(viz, {\n x: wide\n ? layoutMargin.left + padding.left + (availableWidth - width) / 2\n : layoutMargin.left,\n y: wide\n ? layoutMargin.top\n : layoutMargin.top + padding.top + (availableHeight - height) / 2,\n width,\n height,\n orient: position,\n align:\n ({bottom: \"end\", left: \"start\", right: \"end\", top: \"start\"} as Record<string, string>)[\n position as string\n ] || \"bottom\",\n }, Boolean(showColorScale));\n\n const margin: Record<string, number> = {};\n if (showColorScale) {\n const scaleBounds = viz._colorScaleClass.outerBounds();\n if (!viz.schema.colorScaleConfig.select && scaleBounds.height) {\n // Use the colorScale's OWN padding for its margin claim — not the\n // legend's, so a custom legendPadding doesn't shift the\n // colorScale's claim when the legend is hidden. The colorScale\n // class is the source of truth.\n const csPadding =\n typeof viz._colorScaleClass.padding === \"function\"\n ? viz._colorScaleClass.padding()\n : viz._legendClass.padding();\n if (wide) margin[position as string] = scaleBounds.height + csPadding * 2;\n else margin[position as string] = scaleBounds.width + csPadding * 2;\n }\n }\n return {panel: null, margin};\n },\n};\n"],"names":["min","rollup","merge","elem","resolveSpec","bottomRightClearance","sanitizePosition","insetFrame","insetOrient","isInsetPending","colorScaleData","viz","data","Array","from","_data","leaves","schema","aggs","d","i","time","_ids","join","values","filter","c","colorScale","undefined","paintColorScale","frame","show","transform","opacity","orient","x","y","scaleGroup","condition","colorScaleConfig","select","enter","parent","_select","duration","update","node","_colorScaleClass","renderMode","align","height","locale","value","width","config","render","colorScalePosition","bind","paintColorScaleInset","area","Boolean","maxSize","colorScaleMaxSize","outerBounds","colorScaleFeature","name","configFields","layout","layoutMargin","left","right","top","bottom","panel","margin","position","wide","includes","showColorScale","padding","colorScalePadding","_padding","corner","availableWidth","inset","availableHeight","drop","scaleBounds","csPadding","_legendClass"],"mappings":"AAAA;;;;;AAKA,GACA,SAAQA,GAAG,EAAEC,MAAM,QAAO,WAAW;AAErC,SAAQC,KAAK,QAAO,eAAe;AAEnC,SAAQC,IAAI,QAAO,cAAc;AAGjC,SAAQC,WAAW,QAAO,6BAA6B;AAEvD,SAAQC,oBAAoB,QAAO,4CAA4C;AAE/E,SAAQC,gBAAgB,QAAO,gBAAgB;AAC/C,SAAQC,UAAU,EAAEC,WAAW,EAAEC,cAAc,QAAO,kBAAkB;AAcxE,yGAAyG,GACzG,SAASC,eAAeC,GAAgB;IACtC,IAAMC,OAAOC,MAAMC,IAAI,CACrBb,OACEU,IAAII,KAAK,EACT,SAACC;eAAwBd,MAAMc,QAAQL,IAAIM,MAAM,CAACC,IAAI;OACtD,SAACC,GAAcC;eACb,AAAC,GAAqDT,OAAnDA,IAAIM,MAAM,CAACI,IAAI,GAAGV,IAAIM,MAAM,CAACI,IAAI,CAACF,GAAGC,KAAK,OAAM,KAA4B,OAAzBT,IAAIW,IAAI,CAACH,GAAGC,GAAGG,IAAI,CAAC;OAC5EC,MAAM;IAEV,OAAOZ,KAAKa,MAAM,CAAC,SAACN,GAAoBC;QACtC,IAAMM,IAAIf,IAAIM,MAAM,CAACU,UAAU,CAACR,GAA2BC;QAC3D,OAAOM,MAAME,aAAaF,MAAM;IAClC;AACF;AAEA;;;;AAIA,GACA,SAASG,gBAAgBlB,GAAgB,EAAEmB,KAAsB,EAAEC,IAAa;IAC9E,IAAMC,YAAY;QAChBC,SAASH,MAAMI,MAAM,GAAG,IAAI;QAC5BF,WAAW,AAAC,aAAwBF,OAAZA,MAAMK,CAAC,EAAC,MAAY,OAARL,MAAMM,CAAC,EAAC;IAC9C;IAEA,IAAMC,aAAalC,KAAK,2BAA2B;QACjDmC,WAAWP,QAAQ,CAACpB,IAAIM,MAAM,CAACs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