@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.
Files changed (312) hide show
  1. package/README.md +3930 -2032
  2. package/es/index.js +3 -3
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +11 -1
  5. package/es/internal.js.map +1 -1
  6. package/es/src/charts/BarChart/index.js +8 -1
  7. package/es/src/charts/BarChart/index.js.map +1 -1
  8. package/es/src/charts/BoxWhisker/index.js +5 -0
  9. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  10. package/es/src/charts/Chord/emit.js +55 -3
  11. package/es/src/charts/Chord/emit.js.map +1 -1
  12. package/es/src/charts/Chord/index.js +17 -0
  13. package/es/src/charts/Chord/index.js.map +1 -1
  14. package/es/src/charts/Geomap/applyLayout.js +20 -11
  15. package/es/src/charts/Geomap/applyLayout.js.map +1 -1
  16. package/es/src/charts/Geomap/index.js +8 -2
  17. package/es/src/charts/Geomap/index.js.map +1 -1
  18. package/es/src/charts/Histogram/binData.js +225 -0
  19. package/es/src/charts/Histogram/binData.js.map +1 -0
  20. package/es/src/charts/Histogram/index.js +271 -0
  21. package/es/src/charts/Histogram/index.js.map +1 -0
  22. package/es/src/charts/Matrix/emit.js +5 -4
  23. package/es/src/charts/Matrix/emit.js.map +1 -1
  24. package/es/src/charts/Network/applyLayout.js +52 -4
  25. package/es/src/charts/Network/applyLayout.js.map +1 -1
  26. package/es/src/charts/Network/emit.js +4 -4
  27. package/es/src/charts/Network/emit.js.map +1 -1
  28. package/es/src/charts/Network/index.js +10 -1
  29. package/es/src/charts/Network/index.js.map +1 -1
  30. package/es/src/charts/Pack/emit.js +42 -7
  31. package/es/src/charts/Pack/emit.js.map +1 -1
  32. package/es/src/charts/Pack/index.js +15 -0
  33. package/es/src/charts/Pack/index.js.map +1 -1
  34. package/es/src/charts/Pie/applyLayout.js +20 -2
  35. package/es/src/charts/Pie/applyLayout.js.map +1 -1
  36. package/es/src/charts/Pie/emit.js +275 -35
  37. package/es/src/charts/Pie/emit.js.map +1 -1
  38. package/es/src/charts/Pie/index.js +48 -1
  39. package/es/src/charts/Pie/index.js.map +1 -1
  40. package/es/src/charts/Plot/discreteSpan.js +42 -0
  41. package/es/src/charts/Plot/discreteSpan.js.map +1 -0
  42. package/es/src/charts/Plot/draw.js +3 -1
  43. package/es/src/charts/Plot/draw.js.map +1 -1
  44. package/es/src/charts/Plot/index.js +143 -14
  45. package/es/src/charts/Plot/index.js.map +1 -1
  46. package/es/src/charts/Plot/insetRegion.js +21 -0
  47. package/es/src/charts/Plot/insetRegion.js.map +1 -0
  48. package/es/src/charts/Plot/pipeline.js +47 -20
  49. package/es/src/charts/Plot/pipeline.js.map +1 -1
  50. package/es/src/charts/Plot/pipelineDomains.js +84 -8
  51. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  52. package/es/src/charts/Plot/shapeDefaults.js +3 -3
  53. package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
  54. package/es/src/charts/Plot/sharedHover.js +532 -0
  55. package/es/src/charts/Plot/sharedHover.js.map +1 -0
  56. package/es/src/charts/Plot/sharedHoverScene.js +230 -0
  57. package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
  58. package/es/src/charts/Plot/sharedTooltip.js +183 -0
  59. package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
  60. package/es/src/charts/Plot/stackShareLabels.js +137 -0
  61. package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
  62. package/es/src/charts/Plot/stackShareTooltip.js +31 -0
  63. package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
  64. package/es/src/charts/Plot/trendLines.js +469 -0
  65. package/es/src/charts/Plot/trendLines.js.map +1 -0
  66. package/es/src/charts/Plot/trendProjection.js +120 -0
  67. package/es/src/charts/Plot/trendProjection.js.map +1 -0
  68. package/es/src/charts/Plot/trendScene.js +234 -0
  69. package/es/src/charts/Plot/trendScene.js.map +1 -0
  70. package/es/src/charts/Plot/trendTooltip.js +222 -0
  71. package/es/src/charts/Plot/trendTooltip.js.map +1 -0
  72. package/es/src/charts/Priestley/emit.js +34 -6
  73. package/es/src/charts/Priestley/emit.js.map +1 -1
  74. package/es/src/charts/Radar/index.js +15 -2
  75. package/es/src/charts/Radar/index.js.map +1 -1
  76. package/es/src/charts/RadialMatrix/emit.js +4 -4
  77. package/es/src/charts/RadialMatrix/emit.js.map +1 -1
  78. package/es/src/charts/RadialMatrix/index.js +17 -1
  79. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  80. package/es/src/charts/Rings/applyLayout.js +72 -116
  81. package/es/src/charts/Rings/applyLayout.js.map +1 -1
  82. package/es/src/charts/Rings/emit.js +2 -3
  83. package/es/src/charts/Rings/emit.js.map +1 -1
  84. package/es/src/charts/Rings/index.js +18 -3
  85. package/es/src/charts/Rings/index.js.map +1 -1
  86. package/es/src/charts/Rings/ringsSizing.js +189 -0
  87. package/es/src/charts/Rings/ringsSizing.js.map +1 -0
  88. package/es/src/charts/Sankey/index.js +2 -0
  89. package/es/src/charts/Sankey/index.js.map +1 -1
  90. package/es/src/charts/StackedArea/index.js +8 -1
  91. package/es/src/charts/StackedArea/index.js.map +1 -1
  92. package/es/src/charts/Tree/emit.js +2 -2
  93. package/es/src/charts/Tree/emit.js.map +1 -1
  94. package/es/src/charts/Tree/index.js +7 -3
  95. package/es/src/charts/Tree/index.js.map +1 -1
  96. package/es/src/charts/Treemap/emit.js +58 -6
  97. package/es/src/charts/Treemap/emit.js.map +1 -1
  98. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  99. package/es/src/charts/definition/makeChart.js +14 -1
  100. package/es/src/charts/definition/makeChart.js.map +1 -1
  101. package/es/src/charts/drawSteps/backControl.js +17 -2
  102. package/es/src/charts/drawSteps/backControl.js.map +1 -1
  103. package/es/src/charts/drawSteps/bottomRightControls.js +196 -0
  104. package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
  105. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +292 -0
  106. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
  107. package/es/src/charts/drawSteps/minimap.js +34 -9
  108. package/es/src/charts/drawSteps/minimap.js.map +1 -1
  109. package/es/src/charts/drawSteps/searchControlsMarkup.js +15 -38
  110. package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -1
  111. package/es/src/charts/drawSteps/zoomControls.js +3 -0
  112. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  113. package/es/src/charts/events/click.legend.js +10 -5
  114. package/es/src/charts/events/click.legend.js.map +1 -1
  115. package/es/src/charts/events/click.shape.js +24 -1
  116. package/es/src/charts/events/click.shape.js.map +1 -1
  117. package/es/src/charts/events/mouseenter.js +3 -0
  118. package/es/src/charts/events/mouseenter.js.map +1 -1
  119. package/es/src/charts/events/mouseleave.js +3 -0
  120. package/es/src/charts/events/mouseleave.js.map +1 -1
  121. package/es/src/charts/events/mousemove.shape.js +10 -1
  122. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  123. package/es/src/charts/features/axes.js +4 -1
  124. package/es/src/charts/features/axes.js.map +1 -1
  125. package/es/src/charts/features/emitHelpers.js +43 -5
  126. package/es/src/charts/features/emitHelpers.js.map +1 -1
  127. package/es/src/charts/features/features.js +3 -104
  128. package/es/src/charts/features/features.js.map +1 -1
  129. package/es/src/charts/features/featuresColorScale.js +161 -0
  130. package/es/src/charts/features/featuresColorScale.js.map +1 -0
  131. package/es/src/charts/features/featuresLegend.js +155 -34
  132. package/es/src/charts/features/featuresLegend.js.map +1 -1
  133. package/es/src/charts/features/insetState.js +174 -0
  134. package/es/src/charts/features/insetState.js.map +1 -0
  135. package/es/src/charts/features/plotPaint.js +51 -24
  136. package/es/src/charts/features/plotPaint.js.map +1 -1
  137. package/es/src/charts/features/sceneBounds.js +271 -0
  138. package/es/src/charts/features/sceneBounds.js.map +1 -0
  139. package/es/src/charts/features/shapeEmit.js +20 -2
  140. package/es/src/charts/features/shapeEmit.js.map +1 -1
  141. package/es/src/charts/features/tooltipSwatch.js +73 -0
  142. package/es/src/charts/features/tooltipSwatch.js.map +1 -0
  143. package/es/src/charts/index.js +1 -0
  144. package/es/src/charts/index.js.map +1 -1
  145. package/es/src/charts/pipeline/drillMorph.js +159 -0
  146. package/es/src/charts/pipeline/drillMorph.js.map +1 -0
  147. package/es/src/charts/pipeline/insetPlacement.js +406 -0
  148. package/es/src/charts/pipeline/insetPlacement.js.map +1 -0
  149. package/es/src/charts/pipeline/runChartDraw.js +35 -1
  150. package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
  151. package/es/src/charts/pipeline/runVizPipeline.js +22 -3
  152. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  153. package/es/src/charts/pipeline/vizDrawPure.js +20 -0
  154. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  155. package/es/src/charts/viz/Viz.js +82 -11
  156. package/es/src/charts/viz/Viz.js.map +1 -1
  157. package/es/src/charts/viz/VizBase.js +29 -1
  158. package/es/src/charts/viz/VizBase.js.map +1 -1
  159. package/es/src/charts/viz/VizBaseConfig.js +25 -21
  160. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  161. package/es/src/charts/viz/interactionOpacity.js +21 -13
  162. package/es/src/charts/viz/interactionOpacity.js.map +1 -1
  163. package/es/src/charts/viz/linkGroup.js +386 -0
  164. package/es/src/charts/viz/linkGroup.js.map +1 -0
  165. package/es/src/charts/viz/ordinalColor.js +2 -2
  166. package/es/src/charts/viz/ordinalColor.js.map +1 -1
  167. package/es/src/charts/viz/sceneRows.js +33 -0
  168. package/es/src/charts/viz/sceneRows.js.map +1 -0
  169. package/es/src/charts/viz/vizDefaults.js +39 -15
  170. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  171. package/es/src/charts/viz/vizRender.js +54 -4
  172. package/es/src/charts/viz/vizRender.js.map +1 -1
  173. package/es/src/charts/viz/vizTypes.js.map +1 -1
  174. package/es/src/charts/viz/vizVisibility.js +145 -0
  175. package/es/src/charts/viz/vizVisibility.js.map +1 -0
  176. package/es/src/components/Axis/Axis.js +8 -8
  177. package/es/src/components/Axis/Axis.js.map +1 -1
  178. package/es/src/components/Axis/AxisBottom.js +1 -1
  179. package/es/src/components/Axis/AxisBottom.js.map +1 -1
  180. package/es/src/components/Axis/AxisLeft.js +1 -1
  181. package/es/src/components/Axis/AxisLeft.js.map +1 -1
  182. package/es/src/components/Axis/AxisRight.js +1 -1
  183. package/es/src/components/Axis/AxisRight.js.map +1 -1
  184. package/es/src/components/Axis/AxisTop.js +1 -1
  185. package/es/src/components/Axis/AxisTop.js.map +1 -1
  186. package/es/src/components/Axis/axisLayoutLabels.js +13 -1
  187. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
  188. package/es/src/components/ColorScale/ColorScale.js +11 -11
  189. package/es/src/components/ColorScale/ColorScale.js.map +1 -1
  190. package/es/src/components/ColorScale/colorScaleScale.js +22 -10
  191. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
  192. package/es/src/components/Legend/Legend.js +8 -5
  193. package/es/src/components/Legend/Legend.js.map +1 -1
  194. package/es/src/components/Legend/legendConfig.js +3 -2
  195. package/es/src/components/Legend/legendConfig.js.map +1 -1
  196. package/es/src/components/Legend/legendRender.js +70 -26
  197. package/es/src/components/Legend/legendRender.js.map +1 -1
  198. package/es/src/components/SizeLegend/SizeLegend.js +411 -0
  199. package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
  200. package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
  201. package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
  202. package/es/src/components/TextBox.js +1 -1
  203. package/es/src/components/TextBox.js.map +1 -1
  204. package/es/src/components/Timeline/timelineConfig.js +8 -4
  205. package/es/src/components/Timeline/timelineConfig.js.map +1 -1
  206. package/es/src/components/Timeline/timelineRender.js +1 -2
  207. package/es/src/components/Timeline/timelineRender.js.map +1 -1
  208. package/es/src/components/Tooltip.js +27 -7
  209. package/es/src/components/Tooltip.js.map +1 -1
  210. package/es/src/components/index.js +1 -0
  211. package/es/src/components/index.js.map +1 -1
  212. package/es/src/shapes/Bar.js +1 -1
  213. package/es/src/shapes/Bar.js.map +1 -1
  214. package/es/src/shapes/Box.js +5 -3
  215. package/es/src/shapes/Box.js.map +1 -1
  216. package/es/src/shapes/Rect.js +1 -1
  217. package/es/src/shapes/Rect.js.map +1 -1
  218. package/es/src/shapes/Shape.js +10 -37
  219. package/es/src/shapes/Shape.js.map +1 -1
  220. package/es/src/shapes/Whisker.js +4 -3
  221. package/es/src/shapes/Whisker.js.map +1 -1
  222. package/es/src/shapes/textureKey.js +104 -0
  223. package/es/src/shapes/textureKey.js.map +1 -0
  224. package/es/src/shapes/validateShapeConfig.js +141 -0
  225. package/es/src/shapes/validateShapeConfig.js.map +1 -0
  226. package/es/src/utils/BaseClass.js +134 -4
  227. package/es/src/utils/BaseClass.js.map +1 -1
  228. package/es/src/utils/D3plusConfig.js.map +1 -1
  229. package/es/src/utils/configDefault.js +17 -0
  230. package/es/src/utils/configDefault.js.map +1 -0
  231. package/es/src/utils/configPrep.js +2 -1
  232. package/es/src/utils/configPrep.js.map +1 -1
  233. package/es/src/utils/configWarnings.js +37 -0
  234. package/es/src/utils/configWarnings.js.map +1 -0
  235. package/es/src/utils/index.js +1 -0
  236. package/es/src/utils/index.js.map +1 -1
  237. package/package.json +12 -10
  238. package/types/index.d.ts +5 -4
  239. package/types/internal.d.ts +15 -1
  240. package/types/src/charts/BarChart/index.d.ts +2 -1
  241. package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
  242. package/types/src/charts/Histogram/binData.d.ts +37 -0
  243. package/types/src/charts/Histogram/index.d.ts +14 -0
  244. package/types/src/charts/Network/applyLayout.d.ts +8 -0
  245. package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
  246. package/types/src/charts/Plot/index.d.ts +47 -0
  247. package/types/src/charts/Plot/insetRegion.d.ts +4 -0
  248. package/types/src/charts/Plot/pipeline.d.ts +14 -0
  249. package/types/src/charts/Plot/sharedHover.d.ts +84 -0
  250. package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
  251. package/types/src/charts/Plot/sharedTooltip.d.ts +36 -0
  252. package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
  253. package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
  254. package/types/src/charts/Plot/trendLines.d.ts +90 -0
  255. package/types/src/charts/Plot/trendProjection.d.ts +28 -0
  256. package/types/src/charts/Plot/trendScene.d.ts +19 -0
  257. package/types/src/charts/Plot/trendTooltip.d.ts +30 -0
  258. package/types/src/charts/Rings/applyLayout.d.ts +9 -0
  259. package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
  260. package/types/src/charts/StackedArea/index.d.ts +2 -1
  261. package/types/src/charts/definition/ChartDefinition.d.ts +39 -0
  262. package/types/src/charts/definition/makeChart.d.ts +2 -1
  263. package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
  264. package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +110 -0
  265. package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +7 -5
  266. package/types/src/charts/features/emitHelpers.d.ts +18 -4
  267. package/types/src/charts/features/features.d.ts +1 -8
  268. package/types/src/charts/features/featuresColorScale.d.ts +24 -0
  269. package/types/src/charts/features/featuresLegend.d.ts +15 -0
  270. package/types/src/charts/features/insetState.d.ts +95 -0
  271. package/types/src/charts/features/plotPaint.d.ts +25 -0
  272. package/types/src/charts/features/sceneBounds.d.ts +18 -0
  273. package/types/src/charts/features/tooltipSwatch.d.ts +31 -0
  274. package/types/src/charts/index.d.ts +1 -0
  275. package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
  276. package/types/src/charts/pipeline/insetPlacement.d.ts +45 -0
  277. package/types/src/charts/pipeline/runVizPipeline.d.ts +10 -1
  278. package/types/src/charts/viz/Viz.d.ts +27 -2
  279. package/types/src/charts/viz/VizBase.d.ts +13 -0
  280. package/types/src/charts/viz/VizBaseConfig.d.ts +11 -11
  281. package/types/src/charts/viz/linkGroup.d.ts +96 -0
  282. package/types/src/charts/viz/sceneRows.d.ts +13 -0
  283. package/types/src/charts/viz/vizTypes.d.ts +164 -3
  284. package/types/src/charts/viz/vizVisibility.d.ts +34 -0
  285. package/types/src/components/Axis/AxisBottom.d.ts +1 -1
  286. package/types/src/components/Axis/AxisLeft.d.ts +1 -1
  287. package/types/src/components/Axis/AxisRight.d.ts +1 -1
  288. package/types/src/components/Axis/AxisTop.d.ts +1 -1
  289. package/types/src/components/ColorScale/ColorScale.d.ts +4 -4
  290. package/types/src/components/Legend/legendRender.d.ts +9 -3
  291. package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
  292. package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
  293. package/types/src/components/TextBox.d.ts +1 -1
  294. package/types/src/components/Tooltip.d.ts +18 -3
  295. package/types/src/components/index.d.ts +1 -0
  296. package/types/src/shapes/Bar.d.ts +1 -1
  297. package/types/src/shapes/Box.d.ts +1 -1
  298. package/types/src/shapes/Rect.d.ts +1 -1
  299. package/types/src/shapes/Whisker.d.ts +1 -1
  300. package/types/src/shapes/textureKey.d.ts +9 -0
  301. package/types/src/shapes/validateShapeConfig.d.ts +10 -0
  302. package/types/src/utils/BaseClass.d.ts +15 -1
  303. package/types/src/utils/D3plusConfig.d.ts +139 -0
  304. package/types/src/utils/configDefault.d.ts +11 -0
  305. package/types/src/utils/configWarnings.d.ts +28 -0
  306. package/types/src/utils/index.d.ts +2 -1
  307. package/umd/d3plus-core.full.js +9325 -3024
  308. package/umd/d3plus-core.full.js.map +1 -1
  309. package/umd/d3plus-core.full.min.js +3348 -1727
  310. package/umd/d3plus-core.js +5412 -831
  311. package/umd/d3plus-core.js.map +1 -1
  312. package/umd/d3plus-core.min.js +2199 -948
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/pipeline/runVizPipeline.ts"],"sourcesContent":["/**\n `runVizPipeline(viz)` — the chart pipeline as a free function.\n\n Draws the boundary between \"lifecycle/DOM/data-loading\" (which lives on\n `Viz.render()`, inherently instance-bound) and\n \"transform-the-data-into-a-scene\" (callable without the lifecycle). The\n transform side isn't fully pure yet — `_preDraw`/`_draw` still mutate\n `this` rather than threading an explicit context\n (`UserConfig → ResolvedSpec → transform stages → SceneGraph → renderer`).\n\n Calling this function on a Viz instance runs the same four steps\n `Viz.render()` previously inlined inside its `Promise.all().then()`\n callback:\n\n 1. `viz._preDraw()` — data filtering + legend-data + drawDepth\n 2. `viz._draw()` — chart-specific layout + scene absorption\n 3. `zoomControls(viz)` — zoom HTML overlay (architectural carve-out)\n 4. `minimapFeature.layout(viz)` — zoomed-chart viewport indicator\n 5. `topLeftControlsFeature.layout(viz)` — back/table-view/search panel\n 6. `attributionFeature.layout(viz)` — bottom-right attribution panel\n 7. `tableViewFeature.layout(viz)` — chart-sized data-table overlay\n 8. `viz._drawSceneToTarget()` — paint scene via SvgRenderer/CanvasRenderer\n\n Future work:\n - Extract a `ResolvedSpec` so step 1 takes (config) not (this).\n - Decouple step 2 so it takes (ctx) not (this); stages already follow\n this pattern but `_draw` itself doesn't.\n - Replace step 8's `this._sceneRenderer` slot with a returned handle\n so callers can pick/destroy/diff without instance lookup.\n\n @param viz A Viz instance (or any subclass: Plot, Treemap, Pack, …).\n*/\n\nimport {attributionFeature, runLayout} from \"../features/features.js\";\nimport {minimapFeature} from \"../drawSteps/minimap.js\";\nimport {zoomFeature} from \"../drawSteps/zoomControls.js\";\nimport {topLeftControlsFeature} from \"../drawSteps/topLeftControls.js\";\nimport {tableViewFeature} from \"../drawSteps/tableView.js\";\nimport type {VizInstance as Viz} from \"../viz/vizTypes.js\";\n\nexport function runVizPipeline(viz: Viz): void {\n // Goes through `viz._preDraw()` / `viz._draw()` (not the free functions\n // directly) so subclass overrides (Plot._preDraw, Treemap._draw, Plot._draw,\n // Pack/Pie/Matrix/…) still run. The free functions `vizPreDraw` / `vizDraw`\n // hold the BASE Viz behavior; subclasses' `super._preDraw()`/`super._draw()`\n // calls hit the shim which delegates to the free functions.\n viz._preDraw();\n viz._draw();\n // Post-draw features: zoom + brush event wiring, the minimap, the shared\n // top-left controls panel (back / table-view button / search), the\n // attribution overlay, and the table-view data-table overlay. All run\n // after `_draw()` (zoom needs the rendered chart body + `_container`/\n // `_zoomGroup`), claim zero margin, and wire DOM the serializable scene\n // graph can't carry. `minimapFeature` runs right after `zoomFeature` — it\n // needs `_zoomBehavior`'s `translateExtent()`/`scaleExtent()` already\n // configured for this draw — and before `attributionFeature` to preserve\n // the prior step order; `topLeftControlsFeature` has no ordering\n // dependency on either. `tableViewFeature` runs LAST so its panel — a\n // chart-sized overlay, present only while table view is active — stacks\n // above every other panel in the overlay host (siblings paint in scene\n // order), covering zoom/minimap/top-left-controls/attribution while\n // showing.\n // Each of these returns its overlay as a panel rather than mutating\n // `viz._featurePanels` from inside `layout()` (the FeatureModule\n // contract). The engine appends the returned panels to the instance\n // buffer that `toScene()` reads — including on later repaints (a zoom\n // event, a table-view toggle), which re-walk `toScene()` outside this\n // pipeline pass.\n const post = runLayout({viz}, [zoomFeature, minimapFeature, topLeftControlsFeature, attributionFeature, tableViewFeature]);\n if (post.panels.length)\n viz._featurePanels = [...(viz._featurePanels || []), ...post.panels];\n viz._drawSceneToTarget();\n}\n"],"names":["attributionFeature","runLayout","minimapFeature","zoomFeature","topLeftControlsFeature","tableViewFeature","runVizPipeline","viz","_preDraw","_draw","post","panels","length","_featurePanels","_drawSceneToTarget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,GAEA,SAAQA,kBAAkB,EAAEC,SAAS,QAAO,0BAA0B;AACtE,SAAQC,cAAc,QAAO,0BAA0B;AACvD,SAAQC,WAAW,QAAO,+BAA+B;AACzD,SAAQC,sBAAsB,QAAO,kCAAkC;AACvE,SAAQC,gBAAgB,QAAO,4BAA4B;AAG3D,OAAO,SAASC,eAAeC,GAAQ;IACrC,wEAAwE;IACxE,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,4DAA4D;IAC5DA,IAAIC,QAAQ;IACZD,IAAIE,KAAK;IACT,yEAAyE;IACzE,mEAAmE;IACnE,sEAAsE;IACtE,sEAAsE;IACtE,wEAAwE;IACxE,0EAA0E;IAC1E,sEAAsE;IACtE,yEAAyE;IACzE,iEAAiE;IACjE,sEAAsE;IACtE,wEAAwE;IACxE,uEAAuE;IACvE,oEAAoE;IACpE,WAAW;IACX,oEAAoE;IACpE,iEAAiE;IACjE,oEAAoE;IACpE,sEAAsE;IACtE,sEAAsE;IACtE,iBAAiB;IACjB,IAAMC,OAAOT,UAAU;QAACM,KAAAA;IAAG,GAAG;QAACJ;QAAaD;QAAgBE;QAAwBJ;QAAoBK;KAAiB;IACzH,IAAIK,KAAKC,MAAM,CAACC,MAAM,EACpBL,IAAIM,cAAc,GAAG,AAAC,qBAAIN,IAAIM,cAAc,IAAI,EAAE,SAAG,qBAAGH,KAAKC,MAAM;IACrEJ,IAAIO,kBAAkB;AACxB"}
1
+ {"version":3,"sources":["../../../../src/charts/pipeline/runVizPipeline.ts"],"sourcesContent":["/**\n `runVizPipeline(viz)` — the chart pipeline as a free function.\n\n Draws the boundary between \"lifecycle/DOM/data-loading\" (which lives on\n `Viz.render()`, inherently instance-bound) and\n \"transform-the-data-into-a-scene\" (callable without the lifecycle). The\n transform side isn't fully pure yet — `_preDraw`/`_draw` still mutate\n `this` rather than threading an explicit context\n (`UserConfig → ResolvedSpec → transform stages → SceneGraph → renderer`).\n\n Calling this function on a Viz instance runs the same four steps\n `Viz.render()` previously inlined inside its `Promise.all().then()`\n callback:\n\n 1. `viz._preDraw()` — data filtering + legend-data + drawDepth\n 2. `viz._draw()` — chart-specific layout + scene absorption, re-run\n when chrome is placed inside the chart (`drawWithInset`)\n 3. `zoomControls(viz)` — zoom HTML overlay (architectural carve-out)\n 4. `minimapFeature.layout(viz)` — zoomed-chart viewport indicator\n 5. `topLeftControlsFeature.layout(viz)` — back/table-view/search panel\n 5b. `bottomRightControlsFeature.layout(viz)` — size-legend corner panel\n 6. `attributionFeature.layout(viz)` — bottom-right attribution panel\n 7. `tableViewFeature.layout(viz)` — chart-sized data-table overlay\n 8. `viz._drawSceneToTarget()` — paint scene via SvgRenderer/CanvasRenderer\n\n Future work:\n - Extract a `ResolvedSpec` so step 1 takes (config) not (this).\n - Decouple step 2 so it takes (ctx) not (this); stages already follow\n this pattern but `_draw` itself doesn't.\n - Replace step 8's `this._sceneRenderer` slot with a returned handle\n so callers can pick/destroy/diff without instance lookup.\n\n @param viz A Viz instance (or any subclass: Plot, Treemap, Pack, …).\n*/\n\nimport {attributionFeature, runLayout} from \"../features/features.js\";\nimport {minimapFeature} from \"../drawSteps/minimap.js\";\nimport {zoomFeature} from \"../drawSteps/zoomControls.js\";\nimport {resolveDrillMorph} from \"./drillMorph.js\";\nimport {drawWithInset} from \"./insetPlacement.js\";\nimport {topLeftControlsFeature} from \"../drawSteps/topLeftControls.js\";\nimport {bottomRightControlsFeature} from \"../drawSteps/bottomRightControls.js\";\nimport {tableViewFeature} from \"../drawSteps/tableView.js\";\nimport type {VizInstance as Viz} from \"../viz/vizTypes.js\";\n\nexport function runVizPipeline(viz: Viz): void {\n // Goes through `viz._preDraw()` / `viz._draw()` (not the free functions\n // directly) so subclass overrides (Plot._preDraw, Treemap._draw, Plot._draw,\n // Pack/Pie/Matrix/…) still run. The free functions `vizPreDraw` / `vizDraw`\n // hold the BASE Viz behavior; subclasses' `super._preDraw()`/`super._draw()`\n // calls hit the shim which delegates to the free functions.\n viz._preDraw();\n // `_draw()`, possibly more than once: chrome that fits inside the chart's\n // negative space is placed there after layout (see insetPlacement.ts).\n drawWithInset(viz);\n // Post-draw features: zoom + brush event wiring, the minimap, the shared\n // top-left controls panel (back / table-view button / search), the\n // attribution overlay, and the table-view data-table overlay. All run\n // after `_draw()` (zoom needs the rendered chart body + `_container`/\n // `_zoomGroup`), claim zero margin, and wire DOM the serializable scene\n // graph can't carry. `minimapFeature` runs right after `zoomFeature` — it\n // needs `_zoomBehavior`'s `translateExtent()`/`scaleExtent()` already\n // configured for this draw — and before `attributionFeature` to preserve\n // the prior step order; `topLeftControlsFeature` has no ordering\n // dependency on either. `tableViewFeature` runs LAST so its panel — a\n // chart-sized overlay, present only while table view is active — stacks\n // above every other panel in the overlay host (siblings paint in scene\n // order), covering zoom/minimap/top-left-controls/attribution while\n // showing.\n // Each of these returns its overlay as a panel rather than mutating\n // `viz._featurePanels` from inside `layout()` (the FeatureModule\n // contract). The engine appends the returned panels to the instance\n // buffer that `toScene()` reads — including on later repaints (a zoom\n // event, a table-view toggle), which re-walk `toScene()` outside this\n // pipeline pass.\n runPostDrawFeatures(viz);\n // Resolve the drill-down morph's enter/exit boxes (if a drill click armed\n // one) now that this draw's _bodyRect/_chartScene are final.\n resolveDrillMorph(viz);\n viz._drawSceneToTarget();\n}\n\n/**\n Runs the post-draw features (see above) and appends their panels. Anything\n that re-runs `viz._draw()` outside this pipeline — Rings re-centering on a\n click, say — must call this after it: `_draw()` resets the feature panels,\n so skipping it drops the corner controls, size legend, and attribution.\n*/\nexport function runPostDrawFeatures(viz: Viz): void {\n const post = runLayout({viz}, [\n zoomFeature,\n minimapFeature,\n topLeftControlsFeature,\n bottomRightControlsFeature,\n attributionFeature,\n tableViewFeature,\n ]);\n if (post.panels.length)\n viz._featurePanels = [...(viz._featurePanels || []), ...post.panels];\n}\n"],"names":["attributionFeature","runLayout","minimapFeature","zoomFeature","resolveDrillMorph","drawWithInset","topLeftControlsFeature","bottomRightControlsFeature","tableViewFeature","runVizPipeline","viz","_preDraw","runPostDrawFeatures","_drawSceneToTarget","post","panels","length","_featurePanels"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,GAEA,SAAQA,kBAAkB,EAAEC,SAAS,QAAO,0BAA0B;AACtE,SAAQC,cAAc,QAAO,0BAA0B;AACvD,SAAQC,WAAW,QAAO,+BAA+B;AACzD,SAAQC,iBAAiB,QAAO,kBAAkB;AAClD,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAAQC,sBAAsB,QAAO,kCAAkC;AACvE,SAAQC,0BAA0B,QAAO,sCAAsC;AAC/E,SAAQC,gBAAgB,QAAO,4BAA4B;AAG3D,OAAO,SAASC,eAAeC,GAAQ;IACrC,wEAAwE;IACxE,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,4DAA4D;IAC5DA,IAAIC,QAAQ;IACZ,0EAA0E;IAC1E,uEAAuE;IACvEN,cAAcK;IACd,yEAAyE;IACzE,mEAAmE;IACnE,sEAAsE;IACtE,sEAAsE;IACtE,wEAAwE;IACxE,0EAA0E;IAC1E,sEAAsE;IACtE,yEAAyE;IACzE,iEAAiE;IACjE,sEAAsE;IACtE,wEAAwE;IACxE,uEAAuE;IACvE,oEAAoE;IACpE,WAAW;IACX,oEAAoE;IACpE,iEAAiE;IACjE,oEAAoE;IACpE,sEAAsE;IACtE,sEAAsE;IACtE,iBAAiB;IACjBE,oBAAoBF;IACpB,0EAA0E;IAC1E,6DAA6D;IAC7DN,kBAAkBM;IAClBA,IAAIG,kBAAkB;AACxB;AAEA;;;;;AAKA,GACA,OAAO,SAASD,oBAAoBF,GAAQ;IAC1C,IAAMI,OAAOb,UAAU;QAACS,KAAAA;IAAG,GAAG;QAC5BP;QACAD;QACAI;QACAC;QACAP;QACAQ;KACD;IACD,IAAIM,KAAKC,MAAM,CAACC,MAAM,EACpBN,IAAIO,cAAc,GAAG,AAAC,qBAAIP,IAAIO,cAAc,IAAI,EAAE,SAAG,qBAAGH,KAAKC,MAAM;AACvE"}
@@ -54,6 +54,8 @@ function _unsupported_iterable_to_array(o, minLen) {
54
54
  import { zoomControlsBox } from "../drawSteps/zoomControlsMarkup.js";
55
55
  import { getTopLeftContributions } from "../drawSteps/topLeftControls.js";
56
56
  import { topLeftControlsBox } from "../drawSteps/topLeftControlsMarkup.js";
57
+ import { reserveBottomRight } from "../drawSteps/bottomRightControls.js";
58
+ import { bottomRightControlsRightShortfall, bottomRightControlsShortfall } from "../drawSteps/bottomRightControlsMarkup.js";
57
59
  import { resolveSpec } from "./resolveSpec.js";
58
60
  export function vizDrawPure(viz) {
59
61
  var _prevCtx = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
@@ -123,6 +125,13 @@ export function vizDrawPure(viz) {
123
125
  ], running);
124
126
  out.marginDelta.bottom += timelineClaim.margin.bottom;
125
127
  running.bottom += timelineClaim.margin.bottom;
128
+ // The bottom-right corner panel (the size legend) measures next, above the
129
+ // timeline and against the area left so far, so the legend/colorScale
130
+ // blocks below can inset around it (see `bottomRightControlsInset`).
131
+ reserveBottomRight(viz, running.bottom, {
132
+ width: viz.schema.width - running.left - running.right,
133
+ height: viz.schema.height - running.top - running.bottom
134
+ });
126
135
  // Left/right legend + colorScale claims. Includes `=== false` (mirrors
127
136
  // colorScale below) so a previously-rendered left/right legend tears
128
137
  // down its DOM when the user toggles off via `.legendPosition(false)`.
@@ -148,6 +157,12 @@ export function vizDrawPure(viz) {
148
157
  running.left += claim1.margin.left;
149
158
  running.right += claim1.margin.right;
150
159
  }
160
+ // A right-side bottom-right panel (the size legend's default) shares the
161
+ // right column: widen the right margin to it, if the left/right claims
162
+ // above didn't already, before the bottom blocks lay out against it.
163
+ var rightShortfall = bottomRightControlsRightShortfall(viz, running.right);
164
+ out.marginDelta.right += rightShortfall;
165
+ running.right += rightShortfall;
151
166
  // Top/bottom legend + colorScale.
152
167
  if (legendPosition === "top" || legendPosition === "bottom") {
153
168
  var claim2 = runLayout({
@@ -171,6 +186,11 @@ export function vizDrawPure(viz) {
171
186
  running.top += claim3.margin.top;
172
187
  running.bottom += claim3.margin.bottom;
173
188
  }
189
+ // A bottom-side panel: the chart body must end above it, so if the bottom
190
+ // claims so far are shorter than it, top the bottom margin up.
191
+ var shortfall = bottomRightControlsShortfall(viz, running.bottom);
192
+ out.marginDelta.bottom += shortfall;
193
+ running.bottom += shortfall;
174
194
  // The corner controls (zoom, back/search) deliberately claim zero
175
195
  // margin of their own — they float at y:0, and normally whatever's
176
196
  // ABOVE the chart body (title/subtitle/total, a top legend/colorScale)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/pipeline/vizDrawPure.ts"],"sourcesContent":["/**\n `vizDrawPure(viz, prevCtx)` — the returning form of `vizDraw`.\n\n NAMING CAVEAT: the suffix `Pure` here means **\"returns a Partial<\n VizContext> describing the layout intent\"**, not \"free of side effects\n in the FP sense.\" The OUTER orchestration (margin computation,\n legendPosition resolution, panel aggregation, reset signals) is pure\n in the returned-ctx sense — its observable output is the ctx. The\n inner `runLayout([features])` calls write through to viz directly:\n - reset writes (`viz._featurePanels = []`, `viz._chartScene = []`,\n `viz._chartTransform = undefined`, `viz._shapes = []`)\n - margin claims (`viz._margin.X += claim.margin.X`) so the next\n runLayout sees the updated margins\n - FeatureModule layouts that mount/measure their components\n These writes are part of the contract: subclasses and feature\n modules consume live viz state during the layout body, and the shim\n pattern (`vizDraw` calling `vizDrawPure`) is what bridges the\n free-function surface to the class instances that still hold the\n components.\n\n The shim (`vizDraw`) wraps this and serves as the public surface.\n\n Returns a context with:\n - `marginDelta` (top/bottom/left/right) — total added to viz._margin\n - `featurePanels` — final aggregated panel list\n - `resetChartScene`/`resetChartTransform`/`resetShapes` (always true)\n - `legendPosition`/`colorScalePosition` — sanitized values\n*/\n\nimport {\n colorScaleFeature,\n legendFeature,\n runLayout,\n sanitizePosition,\n subtitleFeature,\n timelineFeature,\n titleFeature,\n totalFeature,\n} from \"../features/features.js\";\nimport {zoomControlsBox} from \"../drawSteps/zoomControlsMarkup.js\";\nimport {getTopLeftContributions} from \"../drawSteps/topLeftControls.js\";\nimport {topLeftControlsBox} from \"../drawSteps/topLeftControlsMarkup.js\";\n\nimport {resolveSpec} from \"./resolveSpec.js\";\n\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport type {VizContext} from \"./vizContext.js\";\nimport type {VizInstance as Viz} from \"../viz/vizTypes.js\";\n\nexport interface VizDrawCtx extends VizContext {\n marginDelta?: {top: number; bottom: number; left: number; right: number};\n featurePanels?: SceneNode[];\n legendPosition?: string | false;\n colorScalePosition?: string | false;\n resetChartScene?: boolean;\n resetChartTransform?: boolean;\n resetShapes?: boolean;\n}\n\nexport function vizDrawPure(\n viz: Viz,\n _prevCtx: Partial<VizContext> = {},\n): Partial<VizDrawCtx> {\n const out: Partial<VizDrawCtx> = {\n resetChartScene: true,\n resetChartTransform: true,\n resetShapes: true,\n marginDelta: {top: 0, bottom: 0, left: 0, right: 0},\n featurePanels: [],\n };\n\n // Reset side effects before features run. `viz._featurePanels` is a\n // cross-stage accumulator: seeded here, appended to later by the\n // zoomControls feature, and read by Viz.toScene — so it has to live on\n // the instance, not in a local. The shim RE-reads viz._featurePanels\n // into out.featurePanels for callers.\n viz._featurePanels = [];\n viz._chartScene = [];\n viz._chartTransform = undefined;\n viz._shapes = [];\n\n // Sanitize positions via the shared `sanitizePosition` helper (same\n // function legendFeature / colorScaleFeature use) so the three sites\n // can't drift. One frozen `resolveSpec` snapshot feeds both accessors:\n // the position accessors take the resolved config as their argument, so\n // a single snapshot reflects config once instead of twice.\n const spec = resolveSpec(viz);\n const legendPosition = sanitizePosition(\n viz.schema.legendPosition.bind(viz)(spec),\n );\n const colorScalePosition = sanitizePosition(\n viz.schema.colorScalePosition.bind(viz)(spec),\n );\n out.legendPosition = legendPosition;\n out.colorScalePosition = colorScalePosition;\n\n // `running` is the cross-call margin accumulator, threaded into each\n // runLayout as its baseMargin so features read the live running total via\n // ctx.layoutMargin (not viz._margin). Seeded from viz._margin so the math\n // matches whatever base the instance carried in.\n const running = {\n top: viz._margin.top,\n right: viz._margin.right,\n bottom: viz._margin.bottom,\n left: viz._margin.left,\n };\n\n // Top blocks first (title / subtitle / total) so the running margin.top\n // grows BEFORE the left/right legend lays out — the legend positions\n // against it. Title must lay out first or the left legend overlaps the\n // title at y=0. \"← Back\" no longer claims margin here — it's a\n // zero-margin contribution to the shared top-left controls panel\n // (`topLeftControlsFeature`, registered post-draw in `runVizPipeline`),\n // the same way zoom's buttons float rather than claim margin.\n const topBlocks = runLayout({viz}, [\n titleFeature,\n subtitleFeature,\n totalFeature,\n ], running);\n viz._featurePanels.push(...topBlocks.panels);\n out.marginDelta!.top += topBlocks.margin.top;\n running.top += topBlocks.margin.top;\n\n const timelineClaim = runLayout({viz}, [timelineFeature], running);\n out.marginDelta!.bottom += timelineClaim.margin.bottom;\n running.bottom += timelineClaim.margin.bottom;\n\n // Left/right legend + colorScale claims. Includes `=== false` (mirrors\n // colorScale below) so a previously-rendered left/right legend tears\n // down its DOM when the user toggles off via `.legendPosition(false)`.\n if (\n legendPosition === \"left\" ||\n legendPosition === \"right\" ||\n legendPosition === false\n ) {\n const claim = runLayout({viz}, [legendFeature], running);\n out.marginDelta!.left += claim.margin.left;\n out.marginDelta!.right += claim.margin.right;\n running.left += claim.margin.left;\n running.right += claim.margin.right;\n }\n if (\n colorScalePosition === \"left\" ||\n colorScalePosition === \"right\" ||\n colorScalePosition === false\n ) {\n const claim = runLayout({viz}, [colorScaleFeature], running);\n out.marginDelta!.left += claim.margin.left;\n out.marginDelta!.right += claim.margin.right;\n running.left += claim.margin.left;\n running.right += claim.margin.right;\n }\n\n // Top/bottom legend + colorScale.\n if (legendPosition === \"top\" || legendPosition === \"bottom\") {\n const claim = runLayout({viz}, [legendFeature], running);\n out.marginDelta!.top += claim.margin.top;\n out.marginDelta!.bottom += claim.margin.bottom;\n running.top += claim.margin.top;\n running.bottom += claim.margin.bottom;\n }\n if (colorScalePosition === \"top\" || colorScalePosition === \"bottom\") {\n const claim = runLayout({viz}, [colorScaleFeature], running);\n out.marginDelta!.top += claim.margin.top;\n out.marginDelta!.bottom += claim.margin.bottom;\n running.top += claim.margin.top;\n running.bottom += claim.margin.bottom;\n }\n\n // The corner controls (zoom, back/search) deliberately claim zero\n // margin of their own — they float at y:0, and normally whatever's\n // ABOVE the chart body (title/subtitle/total, a top legend/colorScale)\n // already pushed it down clear of them. But when NONE of those claimed\n // any margin.top, the chart body starts at y:0 too, and the buttons\n // paint directly over its top edge — a Treemap's very top row, most\n // visibly, since there's no dead space up there to absorb it. Reserve\n // just enough room for the taller of the two corner rows in that one\n // case; a chart with a title/legend already has (at minimum) that same\n // room from its own claim, so this never adds on top of one.\n if (!out.marginDelta!.top) {\n const zoomHeight = zoomControlsBox(viz as never)?.height ?? 0;\n const topLeftHeight =\n topLeftControlsBox(viz as never, getTopLeftContributions(viz as never))?.height ?? 0;\n const cornerHeight = Math.max(zoomHeight, topLeftHeight);\n if (cornerHeight) {\n out.marginDelta!.top += cornerHeight;\n running.top += cornerHeight;\n }\n }\n\n // Snapshot final featurePanels onto the returned ctx.\n out.featurePanels = viz._featurePanels.slice();\n\n return out;\n}\n"],"names":["colorScaleFeature","legendFeature","runLayout","sanitizePosition","subtitleFeature","timelineFeature","titleFeature","totalFeature","zoomControlsBox","getTopLeftContributions","topLeftControlsBox","resolveSpec","vizDrawPure","viz","_prevCtx","out","resetChartScene","resetChartTransform","resetShapes","marginDelta","top","bottom","left","right","featurePanels","_featurePanels","_chartScene","_chartTransform","undefined","_shapes","spec","legendPosition","schema","bind","colorScalePosition","running","_margin","topBlocks","push","panels","margin","timelineClaim","claim","zoomHeight","height","topLeftHeight","cornerHeight","Math","max","slice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,GAEA,SACEA,iBAAiB,EACjBC,aAAa,EACbC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,QACP,0BAA0B;AACjC,SAAQC,eAAe,QAAO,qCAAqC;AACnE,SAAQC,uBAAuB,QAAO,kCAAkC;AACxE,SAAQC,kBAAkB,QAAO,wCAAwC;AAEzE,SAAQC,WAAW,QAAO,mBAAmB;AAiB7C,OAAO,SAASC,YACdC,GAAQ;QACRC,WAAAA,iEAAg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ACjB;IACF;IAEA,sDAAsD;IACtD/B,IAAIS,aAAa,GAAGX,IAAIY,cAAc,CAACwB,KAAK;IAE5C,OAAOlC;AACT"}
1
+ {"version":3,"sources":["../../../../src/charts/pipeline/vizDrawPure.ts"],"sourcesContent":["/**\n `vizDrawPure(viz, prevCtx)` — the returning form of `vizDraw`.\n\n NAMING CAVEAT: the suffix `Pure` here means **\"returns a Partial<\n VizContext> describing the layout intent\"**, not \"free of side effects\n in the FP sense.\" The OUTER orchestration (margin computation,\n legendPosition resolution, panel aggregation, reset signals) is pure\n in the returned-ctx sense — its observable output is the ctx. The\n inner `runLayout([features])` calls write through to viz directly:\n - reset writes (`viz._featurePanels = []`, `viz._chartScene = []`,\n `viz._chartTransform = undefined`, `viz._shapes = []`)\n - margin claims (`viz._margin.X += claim.margin.X`) so the next\n runLayout sees the updated margins\n - FeatureModule layouts that mount/measure their components\n These writes are part of the contract: subclasses and feature\n modules consume live viz state during the layout body, and the shim\n pattern (`vizDraw` calling `vizDrawPure`) is what bridges the\n free-function surface to the class instances that still hold the\n components.\n\n The shim (`vizDraw`) wraps this and serves as the public surface.\n\n Returns a context with:\n - `marginDelta` (top/bottom/left/right) — total added to viz._margin\n - `featurePanels` — final aggregated panel list\n - `resetChartScene`/`resetChartTransform`/`resetShapes` (always true)\n - `legendPosition`/`colorScalePosition` — sanitized values\n*/\n\nimport {\n colorScaleFeature,\n legendFeature,\n runLayout,\n sanitizePosition,\n subtitleFeature,\n timelineFeature,\n titleFeature,\n totalFeature,\n} from \"../features/features.js\";\nimport {zoomControlsBox} from \"../drawSteps/zoomControlsMarkup.js\";\nimport {getTopLeftContributions} from \"../drawSteps/topLeftControls.js\";\nimport {topLeftControlsBox} from \"../drawSteps/topLeftControlsMarkup.js\";\nimport {reserveBottomRight} from \"../drawSteps/bottomRightControls.js\";\nimport {\n bottomRightControlsRightShortfall,\n bottomRightControlsShortfall,\n} from \"../drawSteps/bottomRightControlsMarkup.js\";\n\nimport {resolveSpec} from \"./resolveSpec.js\";\n\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport type {VizContext} from \"./vizContext.js\";\nimport type {VizInstance as Viz} from \"../viz/vizTypes.js\";\n\nexport interface VizDrawCtx extends VizContext {\n marginDelta?: {top: number; bottom: number; left: number; right: number};\n featurePanels?: SceneNode[];\n legendPosition?: string | false;\n colorScalePosition?: string | false;\n resetChartScene?: boolean;\n resetChartTransform?: boolean;\n resetShapes?: boolean;\n}\n\nexport function vizDrawPure(\n viz: Viz,\n _prevCtx: Partial<VizContext> = {},\n): Partial<VizDrawCtx> {\n const out: Partial<VizDrawCtx> = {\n resetChartScene: true,\n resetChartTransform: true,\n resetShapes: true,\n marginDelta: {top: 0, bottom: 0, left: 0, right: 0},\n featurePanels: [],\n };\n\n // Reset side effects before features run. `viz._featurePanels` is a\n // cross-stage accumulator: seeded here, appended to later by the\n // zoomControls feature, and read by Viz.toScene — so it has to live on\n // the instance, not in a local. The shim RE-reads viz._featurePanels\n // into out.featurePanels for callers.\n viz._featurePanels = [];\n viz._chartScene = [];\n viz._chartTransform = undefined;\n viz._shapes = [];\n\n // Sanitize positions via the shared `sanitizePosition` helper (same\n // function legendFeature / colorScaleFeature use) so the three sites\n // can't drift. One frozen `resolveSpec` snapshot feeds both accessors:\n // the position accessors take the resolved config as their argument, so\n // a single snapshot reflects config once instead of twice.\n const spec = resolveSpec(viz);\n const legendPosition = sanitizePosition(\n viz.schema.legendPosition.bind(viz)(spec),\n );\n const colorScalePosition = sanitizePosition(\n viz.schema.colorScalePosition.bind(viz)(spec),\n );\n out.legendPosition = legendPosition;\n out.colorScalePosition = colorScalePosition;\n\n // `running` is the cross-call margin accumulator, threaded into each\n // runLayout as its baseMargin so features read the live running total via\n // ctx.layoutMargin (not viz._margin). Seeded from viz._margin so the math\n // matches whatever base the instance carried in.\n const running = {\n top: viz._margin.top,\n right: viz._margin.right,\n bottom: viz._margin.bottom,\n left: viz._margin.left,\n };\n\n // Top blocks first (title / subtitle / total) so the running margin.top\n // grows BEFORE the left/right legend lays out — the legend positions\n // against it. Title must lay out first or the left legend overlaps the\n // title at y=0. \"← Back\" no longer claims margin here — it's a\n // zero-margin contribution to the shared top-left controls panel\n // (`topLeftControlsFeature`, registered post-draw in `runVizPipeline`),\n // the same way zoom's buttons float rather than claim margin.\n const topBlocks = runLayout({viz}, [\n titleFeature,\n subtitleFeature,\n totalFeature,\n ], running);\n viz._featurePanels.push(...topBlocks.panels);\n out.marginDelta!.top += topBlocks.margin.top;\n running.top += topBlocks.margin.top;\n\n const timelineClaim = runLayout({viz}, [timelineFeature], running);\n out.marginDelta!.bottom += timelineClaim.margin.bottom;\n running.bottom += timelineClaim.margin.bottom;\n\n // The bottom-right corner panel (the size legend) measures next, above the\n // timeline and against the area left so far, so the legend/colorScale\n // blocks below can inset around it (see `bottomRightControlsInset`).\n reserveBottomRight(viz, running.bottom, {\n width: viz.schema.width - running.left - running.right,\n height: viz.schema.height - running.top - running.bottom,\n });\n\n // Left/right legend + colorScale claims. Includes `=== false` (mirrors\n // colorScale below) so a previously-rendered left/right legend tears\n // down its DOM when the user toggles off via `.legendPosition(false)`.\n if (\n legendPosition === \"left\" ||\n legendPosition === \"right\" ||\n legendPosition === false\n ) {\n const claim = runLayout({viz}, [legendFeature], running);\n out.marginDelta!.left += claim.margin.left;\n out.marginDelta!.right += claim.margin.right;\n running.left += claim.margin.left;\n running.right += claim.margin.right;\n }\n if (\n colorScalePosition === \"left\" ||\n colorScalePosition === \"right\" ||\n colorScalePosition === false\n ) {\n const claim = runLayout({viz}, [colorScaleFeature], running);\n out.marginDelta!.left += claim.margin.left;\n out.marginDelta!.right += claim.margin.right;\n running.left += claim.margin.left;\n running.right += claim.margin.right;\n }\n\n // A right-side bottom-right panel (the size legend's default) shares the\n // right column: widen the right margin to it, if the left/right claims\n // above didn't already, before the bottom blocks lay out against it.\n const rightShortfall = bottomRightControlsRightShortfall(viz, running.right);\n out.marginDelta!.right += rightShortfall;\n running.right += rightShortfall;\n\n // Top/bottom legend + colorScale.\n if (legendPosition === \"top\" || legendPosition === \"bottom\") {\n const claim = runLayout({viz}, [legendFeature], running);\n out.marginDelta!.top += claim.margin.top;\n out.marginDelta!.bottom += claim.margin.bottom;\n running.top += claim.margin.top;\n running.bottom += claim.margin.bottom;\n }\n if (colorScalePosition === \"top\" || colorScalePosition === \"bottom\") {\n const claim = runLayout({viz}, [colorScaleFeature], running);\n out.marginDelta!.top += claim.margin.top;\n out.marginDelta!.bottom += claim.margin.bottom;\n running.top += claim.margin.top;\n running.bottom += claim.margin.bottom;\n }\n\n // A bottom-side panel: the chart body must end above it, so if the bottom\n // claims so far are shorter than it, top the bottom margin up.\n const shortfall = bottomRightControlsShortfall(viz, running.bottom);\n out.marginDelta!.bottom += shortfall;\n running.bottom += shortfall;\n\n // The corner controls (zoom, back/search) deliberately claim zero\n // margin of their own — they float at y:0, and normally whatever's\n // ABOVE the chart body (title/subtitle/total, a top legend/colorScale)\n // already pushed it down clear of them. But when NONE of those claimed\n // any margin.top, the chart body starts at y:0 too, and the buttons\n // paint directly over its top edge — a Treemap's very top row, most\n // visibly, since there's no dead space up there to absorb it. Reserve\n // just enough room for the taller of the two corner rows in that one\n // case; a chart with a title/legend already has (at minimum) that same\n // room from its own claim, so this never adds on top of one.\n if (!out.marginDelta!.top) {\n const zoomHeight = zoomControlsBox(viz as never)?.height ?? 0;\n const topLeftHeight =\n topLeftControlsBox(viz as never, getTopLeftContributions(viz as never))?.height ?? 0;\n const cornerHeight = Math.max(zoomHeight, topLeftHeight);\n if (cornerHeight) {\n out.marginDelta!.top += cornerHeight;\n running.top += cornerHeight;\n }\n }\n\n // Snapshot final featurePanels onto the returned ctx.\n out.featurePanels = viz._featurePanels.slice();\n\n return out;\n}\n"],"names":["colorScaleFeature","legendFeature","runLayout","sanitizePosition","subtitleFeature","timelineFeature","titleFeature","totalFeature","zoomControlsBox","getTopLeftContributions","topLeftControlsBox","reserveBottomRight","bottomRightControlsRightShortfall","bottomRightControlsShortfall","resolveSpec","vizDrawPure","viz","_prevCtx","out","resetChartScene","resetChartTransform","resetShapes","marginDelta","top","bottom","left","right","featurePanels","_featurePanels","_chartScene","_chartTransform","undefined","_shapes","spec","legendPosition","schema","bind","colorScalePosition","running","_margin","topBlocks","push","panels","margin","timelineClaim","width","height","claim","rightShortfall","shortfall","zoomHeight","topLeftHeight","cornerHeight","Math","max","slice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,GAEA,SACEA,iBAAiB,EACjBC,aAAa,EACbC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,QACP,0BAA0B;AACjC,SAAQC,eAAe,QAAO,qCAAqC;AACnE,SAAQC,uBAAuB,QAAO,kCAAkC;AACxE,SAAQC,kBAAkB,QAAO,wCAAwC;AACzE,SAAQC,kBAAkB,QAAO,sCAAsC;AACvE,SACEC,iCAAiC,EACjCC,4BAA4B,QACvB,4CAA4C;AAEnD,SAAQC,WAAW,QAAO,mBAAmB;AAiB7C,OAAO,SAASC,YACdC,GAAQ;QACRC,WAAAA,iEAAgC,CAAC;QA0DjCD;IAxDA,IAAME,MAA2B;QAC/BC,iBAAiB;QACjBC,qBAAqB;QACrBC,aAAa;QACbC,aAAa;YAACC,KAAK;YAAGC,QAAQ;YAAGC,MAAM;YAAGC,OAAO;QAAC;QAClDC,eAAe,EAAE;IACnB;IAEA,oEAAoE;IACpE,iEAAiE;IACjE,uEAAuE;IACvE,qEAAqE;IACrE,sCAAsC;IACtCX,IAAIY,cAAc,GAAG,EAAE;IACvBZ,IAAIa,WAAW,GAAG,EAAE;IACpBb,IAAIc,eAAe,GAAGC;IACtBf,IAAIgB,OAAO,GAAG,EAAE;IAEhB,oEAAoE;IACpE,qEAAqE;IACrE,uEAAuE;IACvE,wEAAwE;IACxE,2DAA2D;IAC3D,IAAMC,OAAOnB,YAAYE;IACzB,IAAMkB,iBAAiB/B,iBACrBa,IA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AACJ,YAAYC;QAC1C,IAAIC,cAAc;YAChBlC,IAAII,WAAW,CAAEC,GAAG,IAAI6B;YACxBd,QAAQf,GAAG,IAAI6B;QACjB;IACF;IAEA,sDAAsD;IACtDlC,IAAIS,aAAa,GAAGX,IAAIY,cAAc,CAAC2B,KAAK;IAE5C,OAAOrC;AACT"}
@@ -324,8 +324,10 @@ import { CanvasRenderer, SvgRenderer } from "@d3plus/render";
324
324
  import VizBase from "./VizBase.js";
325
325
  import { applyColorScaleBucketOpacity, applyInteractionOpacity } from "./interactionOpacity.js";
326
326
  import { chartAreaRect } from "../features/chartGeometry.js";
327
+ import { initInsetDefaults, insetComponentScene } from "../features/insetState.js";
327
328
  import { applyZoomPointerEvents, bindCanvasZoom } from "../drawSteps/zoomControls.js";
328
329
  import { initVizDefaults } from "./vizDefaults.js";
330
+ import { unregisterLink } from "./linkGroup.js";
329
331
  import { vizRender } from "./vizRender.js";
330
332
  import { vizDraw } from "../pipeline/vizDraw.js";
331
333
  import { vizPreDraw } from "../pipeline/vizPreDraw.js";
@@ -375,6 +377,7 @@ var Viz = /*#__PURE__*/ function(VizBase) {
375
377
  var _this;
376
378
  _this = _call_super(this, Viz);
377
379
  initVizDefaults(_this);
380
+ initInsetDefaults(_this);
378
381
  return _this;
379
382
  }
380
383
  _create_class(Viz, [
@@ -526,9 +529,9 @@ var Viz = /*#__PURE__*/ function(VizBase) {
526
529
  children.push({
527
530
  type: "group",
528
531
  key: "viz-".concat(name),
529
- children: [
532
+ children: name === "timeline" ? [
530
533
  compScene
531
- ]
534
+ ] : insetComponentScene(this, name, compScene, comp.outerBounds())
532
535
  });
533
536
  }
534
537
  }
@@ -577,6 +580,27 @@ var Viz = /*#__PURE__*/ function(VizBase) {
577
580
  },
578
581
  {
579
582
  /**
583
+ The chart's size-legend radius scale (see `ChartDefinition.sizeLegendScale`).
584
+ Charts that size marks override this; the base chart sizes nothing.
585
+ @private
586
+ */ key: "_sizeLegendScale",
587
+ value: function _sizeLegendScale(_available) {
588
+ return null;
589
+ }
590
+ },
591
+ {
592
+ /**
593
+ The region chart chrome may be drawn inside, with the chart's mark boxes
594
+ as obstacles (see `ChartDefinition.insetRegion`). Charts that leave
595
+ negative space override this; the base chart offers none.
596
+ @private
597
+ */ key: "_insetRegion",
598
+ value: function _insetRegion() {
599
+ return null;
600
+ }
601
+ },
602
+ {
603
+ /**
580
604
  * Applies the threshold algorithm according to the type of chart used.
581
605
  * @param {Array} data The data to process.
582
606
  * @private
@@ -771,7 +795,7 @@ var Viz = /*#__PURE__*/ function(VizBase) {
771
795
  // re-renders. Interaction handlers (zoomed, hover, etc.) pass 0 to
772
796
  // skip the transition machinery — animating every wheel/drag tick
773
797
  // accumulates `setTimeout(duration+10)` per event.
774
- var drawDuration = durationOverride !== undefined ? durationOverride : this.schema.duration;
798
+ var drawDuration = durationOverride !== undefined ? durationOverride : this._instantNextDraw ? 0 : this.schema.duration;
775
799
  // A duration>0 render (drill-down, zoom, re-center) must win over any
776
800
  // pending coalesced duration-0 repaint — otherwise that repaint fires on
777
801
  // the next frame and interrupts this transition, snapping shapes to their
@@ -808,8 +832,30 @@ var Viz = /*#__PURE__*/ function(VizBase) {
808
832
  this._sceneRenderer.drawScene(scene, {
809
833
  duration: drawDuration,
810
834
  sequence: sequence,
811
- trailCatchup: trailCatchup
835
+ trailCatchup: trailCatchup,
836
+ // The drill-down morph's resolved boxes for this draw, if a drill
837
+ // click armed one (resolveDrillMorph, run just before this method via
838
+ // runVizPipeline). One-shot: cleared right below so a later repaint
839
+ // that reaches this method by some OTHER path (a zoom/pan tick, a
840
+ // coalesced hover repaint, Rings' click-to-recenter) never inherits a
841
+ // stale box from an earlier drill click.
842
+ enterFrom: this._resolvedEnterFrom,
843
+ enterFromBody: this._resolvedEnterFromBody,
844
+ exitTo: this._resolvedExitTo,
845
+ exitToBody: this._resolvedExitToBody,
846
+ instantExitKey: this._resolvedInstantExitKey,
847
+ reunionEnterKey: this._resolvedReunionEnterKey,
848
+ reunionEnterFrom: this._resolvedReunionEnterFrom,
849
+ instantExitAll: this._resolvedInstantExitAll
812
850
  });
851
+ this._resolvedEnterFrom = undefined;
852
+ this._resolvedEnterFromBody = undefined;
853
+ this._resolvedExitTo = undefined;
854
+ this._resolvedExitToBody = undefined;
855
+ this._resolvedInstantExitKey = undefined;
856
+ this._resolvedReunionEnterKey = undefined;
857
+ this._resolvedReunionEnterFrom = undefined;
858
+ this._resolvedInstantExitAll = undefined;
813
859
  this._lastSceneRendered = scene;
814
860
  // Canvas backend: the compute <svg> (`_select`) is an emptied overlay
815
861
  // sitting on top of the <canvas>. An svg root hit-tests its whole box, so
@@ -865,6 +911,15 @@ var Viz = /*#__PURE__*/ function(VizBase) {
865
911
  },
866
912
  {
867
913
  /**
914
+ Pointer hook run by `_routeSceneEvent` before any handler routing, for
915
+ every event including ones over empty space. No-op here; Plot overrides
916
+ it to drive the shared multi-series tooltip and crosshair.
917
+ @private
918
+ */ key: "_sharedHover",
919
+ value: function _sharedHover(_event) {}
920
+ },
921
+ {
922
+ /**
868
923
  Routes a renderer pointer event to the matching `viz.schema.on` handlers.
869
924
  Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where
870
925
  compute-mode shapes mount no per-shape DOM, so `shape.on(evt, fn)`
@@ -883,6 +938,10 @@ var Viz = /*#__PURE__*/ function(VizBase) {
883
938
  // — the glitchy jump. `_transitionEndsAt` is stamped by `_drawSceneToTarget`
884
939
  // for the transition's duration; it lapses on its own, so interaction
885
940
  // resumes the instant the transition settles.
941
+ // Runs for every event, picked or not, so a chart can track the pointer
942
+ // across empty space (Plot's shared tooltip + crosshair) — and ahead of
943
+ // the transition guard below, so leaving mid-transition still clears it.
944
+ this._sharedHover(event);
886
945
  if (this._transitionEndsAt && Date.now() < this._transitionEndsAt) return;
887
946
  var pick = event.pick;
888
947
  // Dispatch helper shared by the live-pick path and the leave path.
@@ -915,9 +974,10 @@ var Viz = /*#__PURE__*/ function(VizBase) {
915
974
  if (!pick || !pick.node) return;
916
975
  // Scene nodes carry interaction metadata stamped by Viz.toScene.
917
976
  var nodeAny = pick.node;
918
- // Axis ticks/labels and the timeline are chrome — they carry data but
919
- // are not chart shapes, so they must not fire shape tooltips/handlers.
920
- if (nodeAny.interactionGroup === "axis" || nodeAny.interactionGroup === "timeline") return;
977
+ // Axis ticks/labels, the timeline, and Plot's trend lines are chrome —
978
+ // they carry data but are not chart shapes, so they must not fire shape
979
+ // tooltips/handlers (a trend line's own tooltip runs in `_sharedHover`).
980
+ if (nodeAny.interactionGroup === "axis" || nodeAny.interactionGroup === "timeline" || nodeAny.interactionGroup === "trend") return;
921
981
  // Prefer the node's stamped interaction group (set by Viz.toScene), so
922
982
  // legend swatches route to legend handlers on Canvas too — where the
923
983
  // single canvas element has no per-shape DOM to walk. Fall back to SVG
@@ -938,7 +998,11 @@ var Viz = /*#__PURE__*/ function(VizBase) {
938
998
  i: sourceIndex,
939
999
  x: rawDatum,
940
1000
  isLegend: isLegendNode,
941
- shapeType: shapeType
1001
+ shapeType: shapeType,
1002
+ // The live picked node's own geometry, read synchronously by clickShape
1003
+ // (before the drill-down re-render replaces this frame) to arm the
1004
+ // forward drill-down morph.
1005
+ node: pick.node
942
1006
  };
943
1007
  this._hoverDatum = rawDatum;
944
1008
  fire(handlerKey, sourceDatum, sourceIndex, rawDatum);
@@ -981,11 +1045,14 @@ var Viz = /*#__PURE__*/ function(VizBase) {
981
1045
  },
982
1046
  {
983
1047
  /**
984
- Tears down the visualization: disconnects the ResizeObserver and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
1048
+ Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
985
1049
  */ key: "destroy",
986
1050
  value: function destroy() {
987
- var _this__resizeObserver;
1051
+ var _this__resizeObserver, _this__fontsUnsubscribe, _this, _this__visibleUnobserve, _this1, _this__unloadUnobserve, _this2;
1052
+ unregisterLink(this);
988
1053
  (_this__resizeObserver = this._resizeObserver) === null || _this__resizeObserver === void 0 ? void 0 : _this__resizeObserver.disconnect();
1054
+ (_this__fontsUnsubscribe = (_this = this)._fontsUnsubscribe) === null || _this__fontsUnsubscribe === void 0 ? void 0 : _this__fontsUnsubscribe.call(_this);
1055
+ this._fontsUnsubscribe = undefined;
989
1056
  this._tooltipClass.data([]).render();
990
1057
  select("body").on("touchstart.".concat(this._uuid), null);
991
1058
  // Clear the visibility/resize/scroll poll timers + scroll listener
@@ -1002,6 +1069,10 @@ var Viz = /*#__PURE__*/ function(VizBase) {
1002
1069
  if (this._scrollPoll) {
1003
1070
  this._scrollPoll = clearTimeout(this._scrollPoll);
1004
1071
  }
1072
+ (_this__visibleUnobserve = (_this1 = this)._visibleUnobserve) === null || _this__visibleUnobserve === void 0 ? void 0 : _this__visibleUnobserve.call(_this1);
1073
+ this._visibleUnobserve = undefined;
1074
+ (_this__unloadUnobserve = (_this2 = this)._unloadUnobserve) === null || _this__unloadUnobserve === void 0 ? void 0 : _this__unloadUnobserve.call(_this2);
1075
+ this._unloadUnobserve = undefined;
1005
1076
  if (this._sceneRepaintRAF != null) {
1006
1077
  if (typeof cancelAnimationFrame === "function") cancelAnimationFrame(this._sceneRepaintRAF);
1007
1078
  this._sceneRepaintRAF = undefined;
@@ -1020,7 +1091,7 @@ var Viz = /*#__PURE__*/ function(VizBase) {
1020
1091
  return Viz;
1021
1092
  }(VizBase);
1022
1093
  /**
1023
- Creates an x/y plot based on an array of data. See [this example](https://d3plus.org/examples/d3plus-treemap/getting-started/) for help getting started using the treemap generator.
1094
+ The base class every d3plus chart extends. Owns the shared configuration surface (data, groupBy, size and color accessors, title, legend, tooltip, timeline, zoom, table view) and the render lifecycle that each chart type's definition plugs its layout into. Not used directly; see the chart classes (BarChart, Treemap, …).
1024
1095
  */ export { Viz as default };
1025
1096
 
1026
1097
  //# sourceMappingURL=Viz.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/viz/Viz.ts"],"sourcesContent":["import {select} from \"d3-selection\";\n\nimport {date, getSize} from \"@d3plus/dom\";\n\nimport {computeTrailCatchup} from \"./trailCatchup.js\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {CanvasRenderer, SvgRenderer} from \"@d3plus/render\";\nimport type {PickResult, Renderer, Scene, SceneEvent, SceneNode, Transform} from \"@d3plus/render\";\n\nimport VizBase from \"./VizBase.js\";\nimport type {ColorScale, Legend, Timeline} from \"../../components/index.js\";\nimport type Shape from \"../../shapes/Shape.js\";\nimport {applyColorScaleBucketOpacity, applyInteractionOpacity} from \"./interactionOpacity.js\";\nimport {chartAreaRect} from \"../features/chartGeometry.js\";\nimport {applyZoomPointerEvents, bindCanvasZoom} from \"../drawSteps/zoomControls.js\";\nimport {initVizDefaults} from \"./vizDefaults.js\";\nimport {vizRender} from \"./vizRender.js\";\nimport {vizDraw} from \"../pipeline/vizDraw.js\";\nimport {vizPreDraw} from \"../pipeline/vizPreDraw.js\";\nimport type {VizInstance} from \"./vizTypes.js\";\n\n/**\n Stamps `interactionGroup` onto a component's scene subtree so the pointer\n bridge can route its nodes to component-scoped handlers (e.g. legend) on\n every backend — including Canvas, where there is no per-shape DOM to walk.\n*/\nfunction tagInteractionGroup(node: SceneNode, group: string): void {\n (node as {interactionGroup?: string}).interactionGroup = group;\n const kids = (node as {children?: SceneNode[]}).children;\n if (kids) for (const child of kids) tagInteractionGroup(child, group);\n}\n\n/**\n Resolves the element a renderer mounts into. A `<canvas>` cannot paint inside\n an `<svg>`, so when the scene target is the compute svg, the canvas mounts\n into that svg's parent (the user's element); the emptied, position:absolute\n compute svg overlays the same top-left box. SVG mounts into the target as-is.\n*/\nfunction mountTargetFor(kind: string, target: Element): Element {\n if (\n kind === \"canvas\" &&\n typeof Element !== \"undefined\" &&\n target instanceof Element &&\n target.tagName.toLowerCase() === \"svg\"\n )\n return (target.parentNode as Element | null) ?? target;\n return target;\n}\n\n/**\n Creates an x/y plot based on an array of data. See [this example](https://d3plus.org/examples/d3plus-treemap/getting-started/) for help getting started using the treemap generator.\n*/\nexport default class Viz extends VizBase {\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n */\n constructor() {\n super();\n initVizDefaults(this);\n }\n\n /**\n Called by draw before anything is drawn. Formats the data and performs preparations for draw.\n @private\n */\n _preDraw(): void {\n vizPreDraw(this as unknown as VizInstance);\n }\n\n /**\n Composes a backend-agnostic scene graph from the shapes/features produced\n by the most recent render. Combines:\n - `_chartScene` (cells from `chartDef.emit`, or `Plot._paint` for the\n paint-driven Plot family) wrapped in viz-chart-cells\n - `_shapes` (still used by some charts) — each shape's toScene\n - chart-level components (Legend/ColorScale/Timeline) via their toScene\n - `_featurePanels` (from FeatureModule layouts) wrapped in viz-features\n */\n toScene(): Scene {\n const children: SceneNode[] = [];\n // Chart cells stashed on _chartScene — via `chartDef.emit(ctx)` for\n // data-driven charts, or `Plot._paint` for the paint-driven Plot family.\n // Wraps in three groups:\n // viz-chart-cells (clip window, untransformed)\n // viz-zoom (zoom transform — pan/scale from d3-zoom)\n // viz-chart-body (chart-positioning transform)\n // … chart scene children\n // This lets zoom apply to the chart content WITHOUT moving legend/\n // title/total/etc. (which live in sibling viz-* groups, not under\n // viz-chart-cells). The zoom transform sits above the chart transform so\n // it lives in the same surface space d3-zoom measures the pointer in —\n // a wheel zoom stays anchored under the cursor regardless of margins or\n // a chart's own centering transform (Pie, Radar, …).\n if (this._chartScene && this._chartScene.length) {\n const sliced = applyInteractionOpacity(\n this._chartScene,\n this as unknown as VizInstance,\n );\n // Always emit the viz-zoom group (identity transform when no zoom is\n // active) so its key is stable across the first zoom. Otherwise the first\n // zoom adds a brand-new group → the renderer treats the chart cells as\n // exit+enter (teardown/rebuild) instead of tweening the group transform,\n // so the zoom snaps in instead of animating.\n const zoomNode = [{\n type: \"group\" as const,\n key: \"viz-zoom\",\n transform: this._zoomTransform ?? {x: 0, y: 0, scale: 1},\n children: [{\n type: \"group\" as const,\n key: \"viz-chart-body\",\n ...(this._chartTransform ? {transform: this._chartTransform} : {}),\n children: sliced,\n }],\n }];\n // Fixed clip window (e.g. Geomap's map rect): stays put in scene space\n // while the viz-zoom child transform pans/scales content beneath it.\n // Any zoomable chart without its own clip is clipped to the chart area,\n // so zoomed content can't spill over the legend/title/timeline.\n const clip = this._chartClip ?? (this.schema.zoom && this._margin ? chartAreaRect(this as unknown as VizInstance) : undefined);\n children.push({\n type: \"group\",\n key: \"viz-chart-cells\",\n ...(clip ? {clip} : {}),\n children: zoomNode,\n });\n }\n // `_shapes` collection (Treemap/Pack/etc. route through `_chartScene`\n // instead, as does Plot's `absorbShapeIntoChartScene`). Any caller\n // pushing into `_shapes` gets its `toScene()` walked here; we read the\n // shape's `_select` transform via d3's transform baseVal if present,\n // otherwise emit without a transform.\n (this._shapes || []).forEach((shape: Shape, si: number) => {\n if (!shape || typeof shape.toScene !== \"function\") return;\n const group = shape.toScene();\n let transform: Transform | undefined;\n const sel = shape._select;\n if (sel && typeof sel.attr === \"function\") {\n // Parse `translate(x, y)` from the selection's transform attr.\n // Falls back to undefined for non-translate transforms — the\n // `_shapes` path only uses translate.\n const t = sel.attr(\"transform\");\n if (typeof t === \"string\") {\n const m = t.match(/translate\\(\\s*(-?[\\d.]+)[, ]\\s*(-?[\\d.]+)\\s*\\)/);\n if (m) transform = {x: parseFloat(m[1]), y: parseFloat(m[2])};\n }\n }\n children.push({\n type: \"group\",\n key: `${group.key || \"shape\"}-${si}`,\n ...(transform ? {transform} : {}),\n children: group.children,\n });\n });\n // Chart-level components that have their own toScene.\n const components: [string, Legend | ColorScale | Timeline | undefined][] = [\n [\"legend\", this._legendClass],\n [\"colorScale\", this._colorScaleClass],\n [\"timeline\", this._timelineClass],\n ];\n for (const [name, comp] of components) {\n if (\n comp &&\n typeof comp.toScene === \"function\" &&\n comp._select &&\n typeof comp._select.node === \"function\" &&\n comp._select.node()\n ) {\n let compScene: SceneNode = comp.toScene();\n // Tag the legend subtree so its swatches route to legend handlers via\n // the node stamp (renderer-independent), not just SVG DOM ancestry.\n if (name === \"legend\") {\n tagInteractionGroup(compScene, \"legend\");\n // Hovering a legend swatch dims the others, like the chart marks:\n // run the legend subtree through the same interaction-opacity pass\n // (a no-op when no hover/active predicate is set).\n compScene = applyInteractionOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Hovering a colorScale swatch (or a data shape) dims the sibling\n // swatches by bucket color — leaving the colorScale title/axis/gradient\n // untouched. Not tagged \"legend\": colorScale swatches keep the shape\n // event path (range-based tooltip + hover), unlike groupBy legend items.\n else if (name === \"colorScale\") {\n compScene = applyColorScaleBucketOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Tag the timeline subtree so its ticks/labels are exempt from shape\n // tooltips and hover/active dimming (it's chrome, not data marks).\n else if (name === \"timeline\") tagInteractionGroup(compScene, \"timeline\");\n children.push({\n type: \"group\",\n key: `viz-${name}`,\n children: [compScene],\n });\n }\n }\n // E2: FeatureModule.layout() panels (title/subtitle/total, plus the\n // zoom/top-left-controls/attribution overlays appended post-draw).\n if (this._featurePanels && this._featurePanels.length) {\n children.push({type: \"group\", key: \"viz-features\", children: this._featurePanels});\n }\n return {\n width: this.schema.width,\n height: this.schema.height,\n root: {type: \"group\", key: \"viz-root\", children},\n };\n }\n\n /**\n Called by render once all checks are passed.\n @private\n */\n _draw(): void {\n vizDraw(this as unknown as VizInstance);\n }\n\n /**\n * Applies the threshold algorithm according to the type of chart used.\n * @param {Array} data The data to process.\n * @private\n */\n _thresholdFunction(data: DataPoint[], _tree?: unknown): DataPoint[] {\n return data;\n }\n\n /**\n * Detects width and height and sets SVG properties\n * @private\n */\n _setSVGSize(width?: number, height?: number): void {\n let [w, h] =\n width && height\n ? [width, height]\n : getSize(this._select.node().parentNode);\n w! -= parseFloat(this._select.style(\"border-left-width\"));\n w! -= parseFloat(this._select.style(\"border-right-width\"));\n h! -= parseFloat(this._select.style(\"border-top-width\"));\n h! -= parseFloat(this._select.style(\"border-bottom-width\"));\n \n if (this._autoWidth && this.schema.width !== w) {\n this.width(w);\n this._select\n .style(\"width\", `${this.schema.width}px`)\n .attr(\"width\", `${this.schema.width}px`);\n }\n if (this._autoHeight && this.schema.height !== h) {\n this.height(h);\n this._select\n .style(\"height\", `${this.schema.height}px`)\n .attr(\"height\", `${this.schema.height}px`);\n }\n }\n\n /**\n Draws the visualization given the specified configuration.\n @param callback Optional callback invoked after rendering completes.\n */\n render(callback?: () => void): this {\n return vizRender(this, callback) as this;\n }\n\n /**\n Serializes the most recently rendered output to an SVG string. Returns\n `\"\"` if the chart has not been rendered yet. Both backends support this:\n the SVG backend returns its live `<svg>`, the canvas backend re-renders the\n retained scene through a throwaway SVG backend. Primarily used for\n server-side rendering (see `@d3plus/ssr`).\n */\n toSVGString(): string {\n return this._sceneRenderer?.toSVGString?.() ?? \"\";\n }\n\n /**\n Returns the underlying canvas element of the most recent render when the\n canvas backend is active (`renderer(\"canvas\")`), or `undefined` otherwise.\n Server-side callers cast this to their native canvas to encode a raster\n (see `@d3plus/ssr`).\n */\n toCanvas(): unknown {\n return this._renderer === \"canvas\"\n ? this._sceneRenderer?.toCanvas?.()\n : undefined;\n }\n\n /**\n Selects which @d3plus/render backend paints the visible output.\n `\"svg\"` = SvgRenderer (default), `\"canvas\"` = CanvasRenderer.\n Boolean arguments both normalize to `\"svg\"`.\n */\n renderer(): \"svg\" | \"canvas\";\n renderer(_: \"svg\" | \"canvas\" | true | false): this;\n renderer(_?: \"svg\" | \"canvas\" | true | false): \"svg\" | \"canvas\" | this {\n if (!arguments.length) return this._renderer;\n this._renderer = _ === \"canvas\" ? \"canvas\" : \"svg\";\n return this;\n }\n\n /**\n \"full\" runs the DOM enter/update/exit for every shape; \"compute\"\n skips DOM work and only populates the scene data (`_textData`,\n `_shapes[i]._select`, etc.) for `toScene()` to read. Set automatically by\n `renderScene` callers; users can also opt-in.\n */\n renderMode(): \"full\" | \"compute\";\n renderMode(_: \"full\" | \"compute\"): this;\n renderMode(_?: \"full\" | \"compute\"): \"full\" | \"compute\" | this {\n if (!arguments.length) return this._renderMode || \"full\";\n this._renderMode = _!;\n return this;\n }\n\n /**\n Public entry point that renders this chart through the @d3plus/render\n pluggable backends. The compute pass happens via render() (in an svg\n auto-created inside the target div); SvgRenderer/CanvasRenderer paints\n the scene to the target. Returns `{renderer, scene}` so callers can\n interact with the renderer (e.g. for picking) or read the scene data.\n */\n async renderScene(\n target: Element,\n opts?: {kind?: \"svg\" | \"canvas\"},\n ): Promise<{renderer: Renderer; scene: Scene}> {\n const kind = opts?.kind || (this._renderer === \"canvas\" ? \"canvas\" : \"svg\");\n this._sceneTarget = target;\n this._renderer = kind;\n this.select(target as HTMLElement);\n await new Promise<void>(resolve => this.render(() => resolve()));\n return {\n renderer: this._sceneRenderer as Renderer,\n scene: this._lastSceneRendered as Scene,\n };\n }\n\n /**\n Renders this chart through the @d3plus/render pluggable backends. Called\n automatically by `render()`. The compute pass draws into `this._select`\n (an auto-created svg INSIDE the user's target div) — that svg is the\n off-stage detached compute svg. SvgRenderer mounts to the user's target\n div (the parent), as a sibling to the detached compute svg. The compute\n svg's children get cleared so only the scene output is visible.\n */\n _drawSceneToTarget(durationOverride?: number): void {\n const kind = this._renderer === \"canvas\" ? \"canvas\" : \"svg\";\n const computeSvg = this._select && this._select.node ? this._select.node() : null;\n if (!computeSvg) return;\n // Mount renderer INSIDE the user's `_select` (svg or div). Tests like\n // `svgA.querySelector('[data-key=\"viz-legend\"]')` need the scene output\n // to live inside the user's container, not as a sibling.\n const userTarget = this._sceneTarget || computeSvg;\n if (!userTarget) return;\n const mountTarget = mountTargetFor(kind, userTarget as Element);\n const scene = this.toScene();\n const w = this.schema.width || 400;\n const h = this.schema.height || 300;\n // Reuse the renderer instance if it matches the kind, to avoid mount\n // churn. `target()` is the public Renderer-interface method (no\n // reaching into renderer-private slots). It's optional on the\n // interface; third-party renderers without it fall through to\n // remount on every draw — correct but with mount churn.\n const currentContainer = this._sceneRenderer?.target\n ? this._sceneRenderer.target()?.container\n : undefined;\n const containerChanged = this._sceneRenderer?.target\n ? currentContainer !== mountTarget\n : false;\n if (\n !this._sceneRenderer ||\n this._sceneRenderer.kind !== kind ||\n containerChanged\n ) {\n // Tear down the outgoing renderer before mounting a fresh one. It owns\n // its own DOM (canvas/svg + overlay host), pointer listeners, and\n // transition timers; without this, switching kind (svg<->canvas) or\n // container orphans that DOM in the user's element, stacking the old\n // mode's output behind the new one and accumulating on every switch.\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\")\n this._sceneRenderer.destroy();\n const Ctor = kind === \"canvas\" ? CanvasRenderer : SvgRenderer;\n this._sceneRenderer = new Ctor();\n // `_scenePixelRatio`, when set (e.g. by @d3plus/ssr for hi-res PNG output),\n // fixes the canvas backing-store scale; otherwise the renderer falls back\n // to `devicePixelRatio`.\n this._sceneRenderer.mount({\n container: mountTarget,\n width: w,\n height: h,\n pixelRatio: this._scenePixelRatio,\n });\n // Bridge renderer pointer events → viz.schema.on handlers. Without this,\n // tooltips never fire on the v4 scene-rendered path because\n // `shape.on(evt, fn)` in plotPaint only wires d3-selection\n // listeners on DOM nodes the scene renderer doesn't create.\n // Renderer events carry the picked scene node; the routing lives in\n // `_routeSceneEvent` (kept out of this method so the mount path stays\n // readable). `_lastScenePick` remembers the most recently hovered node\n // so `mouseleave` — fired with a null pick — can still tell the matching\n // handlers which shape/legend item was left (so the tooltip clears).\n this._lastScenePick = null;\n this._sceneRenderer.on((event: SceneEvent) => this._routeSceneEvent(event));\n } else {\n this._sceneRenderer.resize(w, h);\n }\n // `durationOverride` defaults to the chart's `_duration` for normal\n // re-renders. Interaction handlers (zoomed, hover, etc.) pass 0 to\n // skip the transition machinery — animating every wheel/drag tick\n // accumulates `setTimeout(duration+10)` per event.\n const drawDuration =\n durationOverride !== undefined ? durationOverride : this.schema.duration;\n // A duration>0 render (drill-down, zoom, re-center) must win over any\n // pending coalesced duration-0 repaint — otherwise that repaint fires on\n // the next frame and interrupts this transition, snapping shapes to their\n // final geometry.\n if (drawDuration > 0 && this._sceneRepaintRAF != null) {\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n // Mark the window during which an animated transition is in flight, so the\n // pointer bridge can ignore interaction until it settles. A hover/click\n // mid-transition would schedule a duration-0 repaint that interrupts the\n // running transition and snaps it to its end (the glitchy jump). Matches\n // the SvgRenderer/CanvasRenderer `duration + 10` end timer, plus a small\n // buffer so events re-enable just after the paint completes.\n if (drawDuration > 0)\n this._transitionEndsAt = Date.now() + drawDuration + 30;\n // Order persistent motion trails in time by the current timeline period, so\n // they grow only as playback moves forward and rewind when it steps back.\n // Only when the timeline selects a single period (`brushing: false`): a range\n // selection has no single \"current time\", which would scramble the step\n // logic, so we withhold the sequence and trails fall back to ephemeral.\n // Normalize to milliseconds via `date()` — the selection mixes Date objects\n // (brush/initial) and raw period numbers (playback), which compare on wildly\n // different scales otherwise, scrambling the forward/backward test.\n const sel = this._timelineSelection;\n const brushing = this._timelineClass\n ? (this._timelineClass.schema as {brushing?: boolean}).brushing !== false\n : true;\n const sequence = !brushing && Array.isArray(sel) && sel.length\n ? Math.max(...sel.map(v => Number(date(Number(v)))))\n : undefined;\n // A forward jump that skips periods (manual click, not single-step play) draws\n // one coarse segment; compute the marks' real positions at the skipped periods\n // so the trail bends through them (see render commitTrailCatchups).\n const trailCatchup =\n sequence !== undefined && this._trailSeq !== undefined && sequence > this._trailSeq\n ? computeTrailCatchup(this as unknown as VizInstance, scene, this._trailSeq, sequence)\n : undefined;\n if (sequence !== undefined) this._trailSeq = sequence;\n this._sceneRenderer.drawScene(scene, {duration: drawDuration, sequence, trailCatchup});\n this._lastSceneRendered = scene;\n\n // Canvas backend: the compute <svg> (`_select`) is an emptied overlay\n // sitting on top of the <canvas>. An svg root hit-tests its whole box, so\n // even empty it swallows the pointer events the canvas needs for\n // tooltip/hover/legend picking — the symptom being \"renders fine, no\n // tooltips.\" Make the overlay transparent to pointer events so the canvas\n // is the sole interaction surface. The only interactive DOM that still\n // lives in this svg is the timeline's d3-brush (the canvas can't host the\n // native brush handles), so re-enable events on just that group. On the\n // SVG backend `_select` IS the scene host, so events must stay enabled\n // (except while the zoom brush is active — see `applyZoomPointerEvents`).\n applyZoomPointerEvents(this);\n if (this._select && kind === \"canvas\")\n this._select\n .select(\"g.d3plus-viz-timeline\")\n .style(\"pointer-events\", \"auto\");\n if (kind === \"canvas\") bindCanvasZoom(this);\n\n // The timeline brush (d3-brush DOM, mounted in `g.d3plus-viz-timeline` in\n // the outer svg) must paint above the scene-rendered timeline buttons/ticks\n // so its selection tint + handles sit on top of them (matching v3). The\n // renderer appends its scene <svg> last, so without this the brush layer\n // ends up behind it — the selection's translucent fill is then hidden by\n // the opaque buttons and only the edge handles peek out.\n if (kind === \"svg\") {\n const host =\n userTarget && typeof (userTarget as Element).querySelector === \"function\"\n ? (userTarget as Element)\n : null;\n const tlGroup = host\n ? host.querySelector(\":scope > g.d3plus-viz-timeline\")\n : null;\n if (tlGroup) host!.appendChild(tlGroup);\n // Likewise the zoom brush, so its selection box draws over the shapes.\n const zoomBrush = host ? host.querySelector(\":scope > g.d3plus-zoom-brush\") : null;\n if (zoomBrush && zoomBrush !== host!.lastElementChild) host!.appendChild(zoomBrush);\n }\n }\n\n /**\n Resolves the `(d, i, x)` a picked scene node reports to interaction\n handlers (tooltip, click, user `on` handlers). `pick.datum` is the raw\n scene datum; for a Plot shape that's the wrapped record `{data, i}`, which\n handlers expect unwrapped to `(d.data, d.i, wrapped)`. The base does that\n unwrap; Plot overrides this to report the point nearest the cursor for\n multi-point shapes (Line/Area) so a series tooltip reflects the hovered\n x rather than the whole-series aggregate.\n @private\n */\n _interactionDatum(\n pick: PickResult,\n _event: SceneEvent,\n ): {d: unknown; i: number; x: unknown} {\n const rawDatum = pick.datum as {data?: unknown; i?: number} | null | undefined;\n const sourceDatum = rawDatum && rawDatum.data ? rawDatum.data : rawDatum;\n const sourceIndex =\n rawDatum && typeof rawDatum.i === \"number\" ? rawDatum.i : pick.index ?? 0;\n return {d: sourceDatum, i: sourceIndex, x: rawDatum};\n }\n\n /**\n Routes a renderer pointer event to the matching `viz.schema.on` handlers.\n Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where\n compute-mode shapes mount no per-shape DOM, so `shape.on(evt, fn)`\n listeners never fire. We look up the appropriate `on` key from the picked\n scene node: legend swatches route to legend handlers, chart shapes to\n shape (+ shape-class-scoped) handlers, and chrome (axis/timeline/back) is\n excluded. Split out of `_drawSceneToTarget` to keep that method small.\n @private\n */\n _routeSceneEvent(event: SceneEvent): void {\n // Ignore all pointer interaction while an animated transition (zoom,\n // re-center, drill-down, entrance) is in flight. Hovering or clicking a\n // shape mid-transition would fire a handler that schedules a duration-0\n // repaint, interrupting the running transition and snapping it to its end\n // — the glitchy jump. `_transitionEndsAt` is stamped by `_drawSceneToTarget`\n // for the transition's duration; it lapses on its own, so interaction\n // resumes the instant the transition settles.\n if (this._transitionEndsAt && Date.now() < this._transitionEndsAt) return;\n const pick = event.pick;\n // Dispatch helper shared by the live-pick path and the leave path.\n const fire = (\n key: string,\n d: unknown,\n i: number,\n x: unknown,\n ): void => {\n const fn = this.schema.on && this.schema.on[key];\n if (typeof fn === \"function\") {\n try {\n fn.call(this, d, i, x, event.nativeEvent);\n } catch {\n // swallow per-event errors so one bad handler doesn't\n // break subsequent events.\n }\n }\n };\n if (event.type === \"mouseleave\") {\n const lastPick = this._lastScenePick;\n if (lastPick) {\n fire(\n `mouseleave.${lastPick.isLegend ? \"legend\" : \"shape\"}`,\n lastPick.d,\n lastPick.i,\n lastPick.x,\n );\n if (!lastPick.isLegend && lastPick.shapeType)\n fire(`mouseleave.${lastPick.shapeType}`, lastPick.d, lastPick.i, lastPick.x);\n fire(\"mouseleave\", lastPick.d, lastPick.i, lastPick.x);\n }\n this._lastScenePick = null;\n // Cleared here, then re-set by the enter/move the renderer fires\n // synchronously when the pointer crosses to an adjacent node — so a\n // shape→label hand-off leaves `_hoverDatum` pointing at the new node\n // (same datum), which `mouseleave` reads to suppress a flicker.\n this._hoverDatum = null;\n return;\n }\n if (!pick || !pick.node) return;\n // Scene nodes carry interaction metadata stamped by Viz.toScene.\n const nodeAny = pick.node as {\n interactionGroup?: string;\n shapeType?: string;\n };\n // Axis ticks/labels and the timeline are chrome — they carry data but\n // are not chart shapes, so they must not fire shape tooltips/handlers.\n if (\n nodeAny.interactionGroup === \"axis\" ||\n nodeAny.interactionGroup === \"timeline\"\n )\n return;\n // Prefer the node's stamped interaction group (set by Viz.toScene), so\n // legend swatches route to legend handlers on Canvas too — where the\n // single canvas element has no per-shape DOM to walk. Fall back to SVG\n // DOM ancestry for nodes the stamp didn't reach.\n const target =\n event.nativeEvent && (event.nativeEvent as Event).target;\n const isLegendNode =\n nodeAny.interactionGroup === \"legend\" ||\n (target && typeof (target as Element).closest === \"function\"\n ? !!(target as Element).closest('[data-key=\"viz-legend\"]')\n : false);\n const suffix = isLegendNode ? \"legend\" : \"shape\";\n const handlerKey = `${event.type}.${suffix}`;\n // Resolve the datum + index this pick reports to handlers, ONCE, and reuse\n // it for every handler fired below so tooltip/click/user handlers agree on\n // which datum the pointer is over. The base unwraps the node's raw datum to\n // its source row; Plot overrides `_interactionDatum` to report the point\n // nearest the cursor for multi-point shapes (Line/Area).\n const {d: sourceDatum, i: sourceIndex, x: rawDatum} = this._interactionDatum(\n pick,\n event,\n );\n const shapeType =\n typeof nodeAny.shapeType === \"string\" ? nodeAny.shapeType : null;\n this._lastScenePick = {\n d: sourceDatum, i: sourceIndex, x: rawDatum, isLegend: isLegendNode, shapeType,\n };\n this._hoverDatum = rawDatum;\n fire(handlerKey, sourceDatum, sourceIndex, rawDatum);\n // Shape-class-scoped handlers (`\"click.Bar\"`, `\"mousemove.Circle\"`). The\n // emitting shape stamps its type onto the node; on the scene path this is\n // the only place these fire (compute-mode shapes wire no DOM listeners).\n // Legend nodes are excluded so a legend swatch's shape type can't\n // masquerade as a chart-shape handler.\n if (!isLegendNode && shapeType) {\n fire(`${event.type}.${shapeType}`, sourceDatum, sourceIndex, rawDatum);\n }\n // Also fire the un-suffixed handler (e.g. \"mousemove\") so user-registered\n // global handlers see the event too.\n fire(event.type, sourceDatum, sourceIndex, rawDatum);\n }\n\n /**\n Coalesces interaction-driven scene repaints (hover/active dimming) into a\n single paint per animation frame. A fast pointer sweep across a dense\n chart fires a hover transition per shape crossed; painting each one\n synchronously rebuilt the whole scene back-to-back, saturating the main\n thread (~200ms stalls) so the tooltip couldn't reposition and appeared\n stuck at its last spot. Only the latest hover state is visible, so the\n intermediate paints are wasted — collapse them to one rAF-scheduled draw.\n */\n _scheduleSceneRepaint(): void {\n if (!this._sceneRenderer) return;\n if (typeof requestAnimationFrame !== \"function\") {\n this._drawSceneToTarget(0);\n return;\n }\n if (this._sceneRepaintRAF != null) return;\n this._sceneRepaintRAF = requestAnimationFrame(() => {\n this._sceneRepaintRAF = undefined;\n this._drawSceneToTarget(0);\n });\n }\n\n /**\n Tears down the visualization: disconnects the ResizeObserver and removes DOM event listeners. Call this when unmounting to avoid memory leaks.\n */\n destroy(): this {\n this._resizeObserver?.disconnect();\n this._tooltipClass.data([]).render();\n select(\"body\").on(`touchstart.${this._uuid}`, null);\n // Clear the visibility/resize/scroll poll timers + scroll listener\n // so a destroyed chart doesn't keep firing intervals/timeouts that\n // hold the entire viz instance alive. Without this, an SPA that\n // mounts/unmounts charts on tab switches leaks the scene tree +\n // a 200ms-interval timer per leaked chart.\n if (this._visiblePoll) {\n this._visiblePoll = clearInterval(this._visiblePoll) as never;\n }\n if (this._resizePoll) {\n this._resizePoll = clearTimeout(this._resizePoll) as never;\n }\n if (this._scrollPoll) {\n this._scrollPoll = clearTimeout(this._scrollPoll) as never;\n }\n if (this._sceneRepaintRAF != null) {\n if (typeof cancelAnimationFrame === \"function\")\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n if (this.schema.scrollContainer)\n select(this.schema.scrollContainer).on(`scroll.${this._uuid}`, null);\n // Destroy the active scene renderer (clears its own pointer-rect\n // listeners, overlay host, canvas/svg DOM, timers).\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\") {\n this._sceneRenderer.destroy();\n this._sceneRenderer = undefined;\n }\n return this;\n }\n\n}\n"],"names":["select","date","getSize","computeTrailCatchup","CanvasRenderer","SvgRenderer","VizBase","applyColorScaleBucketOpacity","applyInteractionOpacity","chartAreaRect","applyZoomPointerEvents","bindCanvasZoom","initVizDefaults","vizRender","vizDraw","vizPreDraw","tagInteractionGroup","node","group","interactionGroup","kids","children","child","mountTargetFor","kind","target","Element","tagName","toLowerCase","parentNode","Viz","_preDraw","toScene","_chartScene","length","sliced","zoomNode","type","key","transform","_zoomTransform","x","y","scale","_chartTransform","clip","_chartClip","schema","zoom","_margin","undefined","push","_shapes","forEach","shape","si","sel","_select","attr","t","m","match","parseFloat","components","_legendClass","_colorScaleClass","_timelineClass","name","comp","compScene","_featurePanels","width","height","root","_draw","_thresholdFunction","data","_tree","_setSVGSize","w","h","style","_autoWidth","_autoHeight","render","callback","toSVGString","_sceneRenderer","toCanvas","_renderer","renderer","_","arguments","renderMode","_renderMode","renderScene","opts","_sceneTarget","Promise","resolve","scene","_lastSceneRendered","_drawSceneToTarget","durationOverride","Math","computeSvg","userTarget","mountTarget","currentContainer","container","containerChanged","destroy","Ctor","mount","pixelRatio","_scenePixelRatio","_lastScenePick","on","event","_routeSceneEvent","resize","drawDuration","duration","_sceneRepaintRAF","cancelAnimationFrame","_transitionEndsAt","Date","now","_timelineSelection","brushing","sequence","Array","isArray","max","map","v","Number","trailCatchup","_trailSeq","drawScene","host","querySelector","tlGroup","appendChild","zoomBrush","lastElementChild","_interactionDatum","pick","_event","rawDatum","datum","sourceDatum","sourceIndex","i","index","d","fire","fn","call","nativeEvent","lastPick","isLegend","shapeType","_hoverDatum","nodeAny","isLegendNode","closest","suffix","handlerKey","_scheduleSceneRepaint","requestAnimationFrame","_resizeObserver","disconnect","_tooltipClass","_uuid","_visiblePoll","clearInterval","_resizePoll","clearTimeout","_scrollPoll","scrollContainer"],"mappings":";;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gB,IAAI,MAAM;oBACjC,IAAI,OAAOC,yBAAyB,YAClCA,qBAAqB,IAAI,CAACD,gBAAgB;oBAC5C,IAAI,CAACA,gBAAgB,GAAGzE;gBAC1B;gBACA,IAAI,IAAI,CAACH,MAAM,CAACqI,eAAe,EAC7BpL,OAAO,IAAI,CAAC+C,MAAM,CAACqI,eAAe,EAAE/D,EAAE,CAAC,AAAC,UAAoB,OAAX,IAAI,CAACyD,KAAK,GAAI;gBACjE,iEAAiE;gBACjE,oDAAoD;gBACpD,IAAI,IAAI,CAACvF,cAAc,IAAI,OAAO,IAAI,CAACA,cAAc,CAACwB,OAAO,KAAK,YAAY;oBAC5E,IAAI,CAACxB,cAAc,CAACwB,OAAO;oBAC3B,IAAI,CAACxB,cAAc,GAAGrC;gBACxB;gBACA,OAAO,IAAI;YACb;;;WAznBmBpB;EAAYxB;AAHjC;;AAEA,GACA,SAAqBwB,iBA2nBpB"}
1
+ {"version":3,"sources":["../../../../src/charts/viz/Viz.ts"],"sourcesContent":["import {select} from \"d3-selection\";\n\nimport {date, getSize} from \"@d3plus/dom\";\n\nimport {computeTrailCatchup} from \"./trailCatchup.js\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {CanvasRenderer, SvgRenderer} from \"@d3plus/render\";\nimport type {PickResult, Renderer, Scene, SceneEvent, SceneNode, Transform} from \"@d3plus/render\";\n\nimport VizBase from \"./VizBase.js\";\nimport type {ColorScale, Legend, Timeline} from \"../../components/index.js\";\nimport type {SizeLegendScale} from \"../../components/SizeLegend/sizeLegendLayout.js\";\nimport type Shape from \"../../shapes/Shape.js\";\nimport {applyColorScaleBucketOpacity, applyInteractionOpacity} from \"./interactionOpacity.js\";\nimport {chartAreaRect} from \"../features/chartGeometry.js\";\nimport {initInsetDefaults, insetComponentScene} from \"../features/insetState.js\";\nimport type {InsetKey, InsetRegion} from \"../features/insetState.js\";\nimport {applyZoomPointerEvents, bindCanvasZoom} from \"../drawSteps/zoomControls.js\";\nimport {initVizDefaults} from \"./vizDefaults.js\";\nimport {unregisterLink} from \"./linkGroup.js\";\nimport {vizRender} from \"./vizRender.js\";\nimport {vizDraw} from \"../pipeline/vizDraw.js\";\nimport {vizPreDraw} from \"../pipeline/vizPreDraw.js\";\nimport type {VizInstance} from \"./vizTypes.js\";\n\n/**\n Stamps `interactionGroup` onto a component's scene subtree so the pointer\n bridge can route its nodes to component-scoped handlers (e.g. legend) on\n every backend — including Canvas, where there is no per-shape DOM to walk.\n*/\nfunction tagInteractionGroup(node: SceneNode, group: string): void {\n (node as {interactionGroup?: string}).interactionGroup = group;\n const kids = (node as {children?: SceneNode[]}).children;\n if (kids) for (const child of kids) tagInteractionGroup(child, group);\n}\n\n/**\n Resolves the element a renderer mounts into. A `<canvas>` cannot paint inside\n an `<svg>`, so when the scene target is the compute svg, the canvas mounts\n into that svg's parent (the user's element); the emptied, position:absolute\n compute svg overlays the same top-left box. SVG mounts into the target as-is.\n*/\nfunction mountTargetFor(kind: string, target: Element): Element {\n if (\n kind === \"canvas\" &&\n typeof Element !== \"undefined\" &&\n target instanceof Element &&\n target.tagName.toLowerCase() === \"svg\"\n )\n return (target.parentNode as Element | null) ?? target;\n return target;\n}\n\n/**\n The base class every d3plus chart extends. Owns the shared configuration surface (data, groupBy, size and color accessors, title, legend, tooltip, timeline, zoom, table view) and the render lifecycle that each chart type's definition plugs its layout into. Not used directly; see the chart classes (BarChart, Treemap, …).\n*/\nexport default class Viz extends VizBase {\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n */\n constructor() {\n super();\n initVizDefaults(this);\n initInsetDefaults(this as unknown as VizInstance);\n }\n\n /**\n Called by draw before anything is drawn. Formats the data and performs preparations for draw.\n @private\n */\n _preDraw(): void {\n vizPreDraw(this as unknown as VizInstance);\n }\n\n /**\n Composes a backend-agnostic scene graph from the shapes/features produced\n by the most recent render. Combines:\n - `_chartScene` (cells from `chartDef.emit`, or `Plot._paint` for the\n paint-driven Plot family) wrapped in viz-chart-cells\n - `_shapes` (still used by some charts) — each shape's toScene\n - chart-level components (Legend/ColorScale/Timeline) via their toScene\n - `_featurePanels` (from FeatureModule layouts) wrapped in viz-features\n */\n toScene(): Scene {\n const children: SceneNode[] = [];\n // Chart cells stashed on _chartScene — via `chartDef.emit(ctx)` for\n // data-driven charts, or `Plot._paint` for the paint-driven Plot family.\n // Wraps in three groups:\n // viz-chart-cells (clip window, untransformed)\n // viz-zoom (zoom transform — pan/scale from d3-zoom)\n // viz-chart-body (chart-positioning transform)\n // … chart scene children\n // This lets zoom apply to the chart content WITHOUT moving legend/\n // title/total/etc. (which live in sibling viz-* groups, not under\n // viz-chart-cells). The zoom transform sits above the chart transform so\n // it lives in the same surface space d3-zoom measures the pointer in —\n // a wheel zoom stays anchored under the cursor regardless of margins or\n // a chart's own centering transform (Pie, Radar, …).\n if (this._chartScene && this._chartScene.length) {\n const sliced = applyInteractionOpacity(\n this._chartScene,\n this as unknown as VizInstance,\n );\n // Always emit the viz-zoom group (identity transform when no zoom is\n // active) so its key is stable across the first zoom. Otherwise the first\n // zoom adds a brand-new group → the renderer treats the chart cells as\n // exit+enter (teardown/rebuild) instead of tweening the group transform,\n // so the zoom snaps in instead of animating.\n const zoomNode = [{\n type: \"group\" as const,\n key: \"viz-zoom\",\n transform: this._zoomTransform ?? {x: 0, y: 0, scale: 1},\n children: [{\n type: \"group\" as const,\n key: \"viz-chart-body\",\n ...(this._chartTransform ? {transform: this._chartTransform} : {}),\n children: sliced,\n }],\n }];\n // Fixed clip window (e.g. Geomap's map rect): stays put in scene space\n // while the viz-zoom child transform pans/scales content beneath it.\n // Any zoomable chart without its own clip is clipped to the chart area,\n // so zoomed content can't spill over the legend/title/timeline.\n const clip = this._chartClip ?? (this.schema.zoom && this._margin ? chartAreaRect(this as unknown as VizInstance) : undefined);\n children.push({\n type: \"group\",\n key: \"viz-chart-cells\",\n ...(clip ? {clip} : {}),\n children: zoomNode,\n });\n }\n // `_shapes` collection (Treemap/Pack/etc. route through `_chartScene`\n // instead, as does Plot's `absorbShapeIntoChartScene`). Any caller\n // pushing into `_shapes` gets its `toScene()` walked here; we read the\n // shape's `_select` transform via d3's transform baseVal if present,\n // otherwise emit without a transform.\n (this._shapes || []).forEach((shape: Shape, si: number) => {\n if (!shape || typeof shape.toScene !== \"function\") return;\n const group = shape.toScene();\n let transform: Transform | undefined;\n const sel = shape._select;\n if (sel && typeof sel.attr === \"function\") {\n // Parse `translate(x, y)` from the selection's transform attr.\n // Falls back to undefined for non-translate transforms — the\n // `_shapes` path only uses translate.\n const t = sel.attr(\"transform\");\n if (typeof t === \"string\") {\n const m = t.match(/translate\\(\\s*(-?[\\d.]+)[, ]\\s*(-?[\\d.]+)\\s*\\)/);\n if (m) transform = {x: parseFloat(m[1]), y: parseFloat(m[2])};\n }\n }\n children.push({\n type: \"group\",\n key: `${group.key || \"shape\"}-${si}`,\n ...(transform ? {transform} : {}),\n children: group.children,\n });\n });\n // Chart-level components that have their own toScene.\n const components: [string, Legend | ColorScale | Timeline | undefined][] = [\n [\"legend\", this._legendClass],\n [\"colorScale\", this._colorScaleClass],\n [\"timeline\", this._timelineClass],\n ];\n for (const [name, comp] of components) {\n if (\n comp &&\n typeof comp.toScene === \"function\" &&\n comp._select &&\n typeof comp._select.node === \"function\" &&\n comp._select.node()\n ) {\n let compScene: SceneNode = comp.toScene();\n // Tag the legend subtree so its swatches route to legend handlers via\n // the node stamp (renderer-independent), not just SVG DOM ancestry.\n if (name === \"legend\") {\n tagInteractionGroup(compScene, \"legend\");\n // Hovering a legend swatch dims the others, like the chart marks:\n // run the legend subtree through the same interaction-opacity pass\n // (a no-op when no hover/active predicate is set).\n compScene = applyInteractionOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Hovering a colorScale swatch (or a data shape) dims the sibling\n // swatches by bucket color — leaving the colorScale title/axis/gradient\n // untouched. Not tagged \"legend\": colorScale swatches keep the shape\n // event path (range-based tooltip + hover), unlike groupBy legend items.\n else if (name === \"colorScale\") {\n compScene = applyColorScaleBucketOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Tag the timeline subtree so its ticks/labels are exempt from shape\n // tooltips and hover/active dimming (it's chrome, not data marks).\n else if (name === \"timeline\") tagInteractionGroup(compScene, \"timeline\");\n children.push({\n type: \"group\",\n key: `viz-${name}`,\n children: name === \"timeline\"\n ? [compScene]\n : insetComponentScene(this as unknown as VizInstance, name as InsetKey, compScene, (comp as Legend | ColorScale).outerBounds()),\n });\n }\n }\n // E2: FeatureModule.layout() panels (title/subtitle/total, plus the\n // zoom/top-left-controls/attribution overlays appended post-draw).\n if (this._featurePanels && this._featurePanels.length) {\n children.push({type: \"group\", key: \"viz-features\", children: this._featurePanels});\n }\n return {\n width: this.schema.width,\n height: this.schema.height,\n root: {type: \"group\", key: \"viz-root\", children},\n };\n }\n\n /**\n Called by render once all checks are passed.\n @private\n */\n _draw(): void {\n vizDraw(this as unknown as VizInstance);\n }\n\n /**\n The chart's size-legend radius scale (see `ChartDefinition.sizeLegendScale`).\n Charts that size marks override this; the base chart sizes nothing.\n @private\n */\n _sizeLegendScale(_available: {width: number; height: number}): SizeLegendScale | null {\n return null;\n }\n\n /**\n The region chart chrome may be drawn inside, with the chart's mark boxes\n as obstacles (see `ChartDefinition.insetRegion`). Charts that leave\n negative space override this; the base chart offers none.\n @private\n */\n _insetRegion(): InsetRegion | null {\n return null;\n }\n\n /**\n * Applies the threshold algorithm according to the type of chart used.\n * @param {Array} data The data to process.\n * @private\n */\n _thresholdFunction(data: DataPoint[], _tree?: unknown): DataPoint[] {\n return data;\n }\n\n /**\n * Detects width and height and sets SVG properties\n * @private\n */\n _setSVGSize(width?: number, height?: number): void {\n let [w, h] =\n width && height\n ? [width, height]\n : getSize(this._select.node().parentNode);\n w! -= parseFloat(this._select.style(\"border-left-width\"));\n w! -= parseFloat(this._select.style(\"border-right-width\"));\n h! -= parseFloat(this._select.style(\"border-top-width\"));\n h! -= parseFloat(this._select.style(\"border-bottom-width\"));\n \n if (this._autoWidth && this.schema.width !== w) {\n this.width(w);\n this._select\n .style(\"width\", `${this.schema.width}px`)\n .attr(\"width\", `${this.schema.width}px`);\n }\n if (this._autoHeight && this.schema.height !== h) {\n this.height(h);\n this._select\n .style(\"height\", `${this.schema.height}px`)\n .attr(\"height\", `${this.schema.height}px`);\n }\n }\n\n /**\n Draws the visualization given the specified configuration.\n @param callback Optional callback invoked after rendering completes.\n */\n render(callback?: () => void): this {\n return vizRender(this, callback) as this;\n }\n\n /**\n Serializes the most recently rendered output to an SVG string. Returns\n `\"\"` if the chart has not been rendered yet. Both backends support this:\n the SVG backend returns its live `<svg>`, the canvas backend re-renders the\n retained scene through a throwaway SVG backend. Primarily used for\n server-side rendering (see `@d3plus/ssr`).\n */\n toSVGString(): string {\n return this._sceneRenderer?.toSVGString?.() ?? \"\";\n }\n\n /**\n Returns the underlying canvas element of the most recent render when the\n canvas backend is active (`renderer(\"canvas\")`), or `undefined` otherwise.\n Server-side callers cast this to their native canvas to encode a raster\n (see `@d3plus/ssr`).\n */\n toCanvas(): unknown {\n return this._renderer === \"canvas\"\n ? this._sceneRenderer?.toCanvas?.()\n : undefined;\n }\n\n /**\n Selects which @d3plus/render backend paints the visible output.\n `\"svg\"` = SvgRenderer (default), `\"canvas\"` = CanvasRenderer.\n Boolean arguments both normalize to `\"svg\"`.\n */\n renderer(): \"svg\" | \"canvas\";\n renderer(_: \"svg\" | \"canvas\" | true | false): this;\n renderer(_?: \"svg\" | \"canvas\" | true | false): \"svg\" | \"canvas\" | this {\n if (!arguments.length) return this._renderer;\n this._renderer = _ === \"canvas\" ? \"canvas\" : \"svg\";\n return this;\n }\n\n /**\n \"full\" runs the DOM enter/update/exit for every shape; \"compute\"\n skips DOM work and only populates the scene data (`_textData`,\n `_shapes[i]._select`, etc.) for `toScene()` to read. Set automatically by\n `renderScene` callers; users can also opt-in.\n */\n renderMode(): \"full\" | \"compute\";\n renderMode(_: \"full\" | \"compute\"): this;\n renderMode(_?: \"full\" | \"compute\"): \"full\" | \"compute\" | this {\n if (!arguments.length) return this._renderMode || \"full\";\n this._renderMode = _!;\n return this;\n }\n\n /**\n Public entry point that renders this chart through the @d3plus/render\n pluggable backends. The compute pass happens via render() (in an svg\n auto-created inside the target div); SvgRenderer/CanvasRenderer paints\n the scene to the target. Returns `{renderer, scene}` so callers can\n interact with the renderer (e.g. for picking) or read the scene data.\n */\n async renderScene(\n target: Element,\n opts?: {kind?: \"svg\" | \"canvas\"},\n ): Promise<{renderer: Renderer; scene: Scene}> {\n const kind = opts?.kind || (this._renderer === \"canvas\" ? \"canvas\" : \"svg\");\n this._sceneTarget = target;\n this._renderer = kind;\n this.select(target as HTMLElement);\n await new Promise<void>(resolve => this.render(() => resolve()));\n return {\n renderer: this._sceneRenderer as Renderer,\n scene: this._lastSceneRendered as Scene,\n };\n }\n\n /**\n Renders this chart through the @d3plus/render pluggable backends. Called\n automatically by `render()`. The compute pass draws into `this._select`\n (an auto-created svg INSIDE the user's target div) — that svg is the\n off-stage detached compute svg. SvgRenderer mounts to the user's target\n div (the parent), as a sibling to the detached compute svg. The compute\n svg's children get cleared so only the scene output is visible.\n */\n _drawSceneToTarget(durationOverride?: number): void {\n const kind = this._renderer === \"canvas\" ? \"canvas\" : \"svg\";\n const computeSvg = this._select && this._select.node ? this._select.node() : null;\n if (!computeSvg) return;\n // Mount renderer INSIDE the user's `_select` (svg or div). Tests like\n // `svgA.querySelector('[data-key=\"viz-legend\"]')` need the scene output\n // to live inside the user's container, not as a sibling.\n const userTarget = this._sceneTarget || computeSvg;\n if (!userTarget) return;\n const mountTarget = mountTargetFor(kind, userTarget as Element);\n const scene = this.toScene();\n const w = this.schema.width || 400;\n const h = this.schema.height || 300;\n // Reuse the renderer instance if it matches the kind, to avoid mount\n // churn. `target()` is the public Renderer-interface method (no\n // reaching into renderer-private slots). It's optional on the\n // interface; third-party renderers without it fall through to\n // remount on every draw — correct but with mount churn.\n const currentContainer = this._sceneRenderer?.target\n ? this._sceneRenderer.target()?.container\n : undefined;\n const containerChanged = this._sceneRenderer?.target\n ? currentContainer !== mountTarget\n : false;\n if (\n !this._sceneRenderer ||\n this._sceneRenderer.kind !== kind ||\n containerChanged\n ) {\n // Tear down the outgoing renderer before mounting a fresh one. It owns\n // its own DOM (canvas/svg + overlay host), pointer listeners, and\n // transition timers; without this, switching kind (svg<->canvas) or\n // container orphans that DOM in the user's element, stacking the old\n // mode's output behind the new one and accumulating on every switch.\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\")\n this._sceneRenderer.destroy();\n const Ctor = kind === \"canvas\" ? CanvasRenderer : SvgRenderer;\n this._sceneRenderer = new Ctor();\n // `_scenePixelRatio`, when set (e.g. by @d3plus/ssr for hi-res PNG output),\n // fixes the canvas backing-store scale; otherwise the renderer falls back\n // to `devicePixelRatio`.\n this._sceneRenderer.mount({\n container: mountTarget,\n width: w,\n height: h,\n pixelRatio: this._scenePixelRatio,\n });\n // Bridge renderer pointer events → viz.schema.on handlers. Without this,\n // tooltips never fire on the v4 scene-rendered path because\n // `shape.on(evt, fn)` in plotPaint only wires d3-selection\n // listeners on DOM nodes the scene renderer doesn't create.\n // Renderer events carry the picked scene node; the routing lives in\n // `_routeSceneEvent` (kept out of this method so the mount path stays\n // readable). `_lastScenePick` remembers the most recently hovered node\n // so `mouseleave` — fired with a null pick — can still tell the matching\n // handlers which shape/legend item was left (so the tooltip clears).\n this._lastScenePick = null;\n this._sceneRenderer.on((event: SceneEvent) => this._routeSceneEvent(event));\n } else {\n this._sceneRenderer.resize(w, h);\n }\n // `durationOverride` defaults to the chart's `_duration` for normal\n // re-renders. Interaction handlers (zoomed, hover, etc.) pass 0 to\n // skip the transition machinery — animating every wheel/drag tick\n // accumulates `setTimeout(duration+10)` per event.\n const drawDuration =\n durationOverride !== undefined\n ? durationOverride\n : this._instantNextDraw\n ? 0\n : this.schema.duration;\n // A duration>0 render (drill-down, zoom, re-center) must win over any\n // pending coalesced duration-0 repaint — otherwise that repaint fires on\n // the next frame and interrupts this transition, snapping shapes to their\n // final geometry.\n if (drawDuration > 0 && this._sceneRepaintRAF != null) {\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n // Mark the window during which an animated transition is in flight, so the\n // pointer bridge can ignore interaction until it settles. A hover/click\n // mid-transition would schedule a duration-0 repaint that interrupts the\n // running transition and snaps it to its end (the glitchy jump). Matches\n // the SvgRenderer/CanvasRenderer `duration + 10` end timer, plus a small\n // buffer so events re-enable just after the paint completes.\n if (drawDuration > 0)\n this._transitionEndsAt = Date.now() + drawDuration + 30;\n // Order persistent motion trails in time by the current timeline period, so\n // they grow only as playback moves forward and rewind when it steps back.\n // Only when the timeline selects a single period (`brushing: false`): a range\n // selection has no single \"current time\", which would scramble the step\n // logic, so we withhold the sequence and trails fall back to ephemeral.\n // Normalize to milliseconds via `date()` — the selection mixes Date objects\n // (brush/initial) and raw period numbers (playback), which compare on wildly\n // different scales otherwise, scrambling the forward/backward test.\n const sel = this._timelineSelection;\n const brushing = this._timelineClass\n ? (this._timelineClass.schema as {brushing?: boolean}).brushing !== false\n : true;\n const sequence = !brushing && Array.isArray(sel) && sel.length\n ? Math.max(...sel.map(v => Number(date(Number(v)))))\n : undefined;\n // A forward jump that skips periods (manual click, not single-step play) draws\n // one coarse segment; compute the marks' real positions at the skipped periods\n // so the trail bends through them (see render commitTrailCatchups).\n const trailCatchup =\n sequence !== undefined && this._trailSeq !== undefined && sequence > this._trailSeq\n ? computeTrailCatchup(this as unknown as VizInstance, scene, this._trailSeq, sequence)\n : undefined;\n if (sequence !== undefined) this._trailSeq = sequence;\n this._sceneRenderer.drawScene(scene, {\n duration: drawDuration, sequence, trailCatchup,\n // The drill-down morph's resolved boxes for this draw, if a drill\n // click armed one (resolveDrillMorph, run just before this method via\n // runVizPipeline). One-shot: cleared right below so a later repaint\n // that reaches this method by some OTHER path (a zoom/pan tick, a\n // coalesced hover repaint, Rings' click-to-recenter) never inherits a\n // stale box from an earlier drill click.\n enterFrom: this._resolvedEnterFrom, enterFromBody: this._resolvedEnterFromBody,\n exitTo: this._resolvedExitTo, exitToBody: this._resolvedExitToBody,\n instantExitKey: this._resolvedInstantExitKey,\n reunionEnterKey: this._resolvedReunionEnterKey,\n reunionEnterFrom: this._resolvedReunionEnterFrom,\n instantExitAll: this._resolvedInstantExitAll,\n });\n this._resolvedEnterFrom = undefined;\n this._resolvedEnterFromBody = undefined;\n this._resolvedExitTo = undefined;\n this._resolvedExitToBody = undefined;\n this._resolvedInstantExitKey = undefined;\n this._resolvedReunionEnterKey = undefined;\n this._resolvedReunionEnterFrom = undefined;\n this._resolvedInstantExitAll = undefined;\n this._lastSceneRendered = scene;\n\n // Canvas backend: the compute <svg> (`_select`) is an emptied overlay\n // sitting on top of the <canvas>. An svg root hit-tests its whole box, so\n // even empty it swallows the pointer events the canvas needs for\n // tooltip/hover/legend picking — the symptom being \"renders fine, no\n // tooltips.\" Make the overlay transparent to pointer events so the canvas\n // is the sole interaction surface. The only interactive DOM that still\n // lives in this svg is the timeline's d3-brush (the canvas can't host the\n // native brush handles), so re-enable events on just that group. On the\n // SVG backend `_select` IS the scene host, so events must stay enabled\n // (except while the zoom brush is active — see `applyZoomPointerEvents`).\n applyZoomPointerEvents(this);\n if (this._select && kind === \"canvas\")\n this._select\n .select(\"g.d3plus-viz-timeline\")\n .style(\"pointer-events\", \"auto\");\n if (kind === \"canvas\") bindCanvasZoom(this);\n\n // The timeline brush (d3-brush DOM, mounted in `g.d3plus-viz-timeline` in\n // the outer svg) must paint above the scene-rendered timeline buttons/ticks\n // so its selection tint + handles sit on top of them (matching v3). The\n // renderer appends its scene <svg> last, so without this the brush layer\n // ends up behind it — the selection's translucent fill is then hidden by\n // the opaque buttons and only the edge handles peek out.\n if (kind === \"svg\") {\n const host =\n userTarget && typeof (userTarget as Element).querySelector === \"function\"\n ? (userTarget as Element)\n : null;\n const tlGroup = host\n ? host.querySelector(\":scope > g.d3plus-viz-timeline\")\n : null;\n if (tlGroup) host!.appendChild(tlGroup);\n // Likewise the zoom brush, so its selection box draws over the shapes.\n const zoomBrush = host ? host.querySelector(\":scope > g.d3plus-zoom-brush\") : null;\n if (zoomBrush && zoomBrush !== host!.lastElementChild) host!.appendChild(zoomBrush);\n }\n }\n\n /**\n Resolves the `(d, i, x)` a picked scene node reports to interaction\n handlers (tooltip, click, user `on` handlers). `pick.datum` is the raw\n scene datum; for a Plot shape that's the wrapped record `{data, i}`, which\n handlers expect unwrapped to `(d.data, d.i, wrapped)`. The base does that\n unwrap; Plot overrides this to report the point nearest the cursor for\n multi-point shapes (Line/Area) so a series tooltip reflects the hovered\n x rather than the whole-series aggregate.\n @private\n */\n _interactionDatum(\n pick: PickResult,\n _event: SceneEvent,\n ): {d: unknown; i: number; x: unknown} {\n const rawDatum = pick.datum as {data?: unknown; i?: number} | null | undefined;\n const sourceDatum = rawDatum && rawDatum.data ? rawDatum.data : rawDatum;\n const sourceIndex =\n rawDatum && typeof rawDatum.i === \"number\" ? rawDatum.i : pick.index ?? 0;\n return {d: sourceDatum, i: sourceIndex, x: rawDatum};\n }\n\n /**\n Pointer hook run by `_routeSceneEvent` before any handler routing, for\n every event including ones over empty space. No-op here; Plot overrides\n it to drive the shared multi-series tooltip and crosshair.\n @private\n */\n _sharedHover(_event: SceneEvent): void {}\n\n /**\n Routes a renderer pointer event to the matching `viz.schema.on` handlers.\n Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where\n compute-mode shapes mount no per-shape DOM, so `shape.on(evt, fn)`\n listeners never fire. We look up the appropriate `on` key from the picked\n scene node: legend swatches route to legend handlers, chart shapes to\n shape (+ shape-class-scoped) handlers, and chrome (axis/timeline/back) is\n excluded. Split out of `_drawSceneToTarget` to keep that method small.\n @private\n */\n _routeSceneEvent(event: SceneEvent): void {\n // Ignore all pointer interaction while an animated transition (zoom,\n // re-center, drill-down, entrance) is in flight. Hovering or clicking a\n // shape mid-transition would fire a handler that schedules a duration-0\n // repaint, interrupting the running transition and snapping it to its end\n // — the glitchy jump. `_transitionEndsAt` is stamped by `_drawSceneToTarget`\n // for the transition's duration; it lapses on its own, so interaction\n // resumes the instant the transition settles.\n // Runs for every event, picked or not, so a chart can track the pointer\n // across empty space (Plot's shared tooltip + crosshair) — and ahead of\n // the transition guard below, so leaving mid-transition still clears it.\n this._sharedHover(event);\n if (this._transitionEndsAt && Date.now() < this._transitionEndsAt) return;\n const pick = event.pick;\n // Dispatch helper shared by the live-pick path and the leave path.\n const fire = (\n key: string,\n d: unknown,\n i: number,\n x: unknown,\n ): void => {\n const fn = this.schema.on && this.schema.on[key];\n if (typeof fn === \"function\") {\n try {\n fn.call(this, d, i, x, event.nativeEvent);\n } catch {\n // swallow per-event errors so one bad handler doesn't\n // break subsequent events.\n }\n }\n };\n if (event.type === \"mouseleave\") {\n const lastPick = this._lastScenePick;\n if (lastPick) {\n fire(\n `mouseleave.${lastPick.isLegend ? \"legend\" : \"shape\"}`,\n lastPick.d,\n lastPick.i,\n lastPick.x,\n );\n if (!lastPick.isLegend && lastPick.shapeType)\n fire(`mouseleave.${lastPick.shapeType}`, lastPick.d, lastPick.i, lastPick.x);\n fire(\"mouseleave\", lastPick.d, lastPick.i, lastPick.x);\n }\n this._lastScenePick = null;\n // Cleared here, then re-set by the enter/move the renderer fires\n // synchronously when the pointer crosses to an adjacent node — so a\n // shape→label hand-off leaves `_hoverDatum` pointing at the new node\n // (same datum), which `mouseleave` reads to suppress a flicker.\n this._hoverDatum = null;\n return;\n }\n if (!pick || !pick.node) return;\n // Scene nodes carry interaction metadata stamped by Viz.toScene.\n const nodeAny = pick.node as {\n interactionGroup?: string;\n shapeType?: string;\n };\n // Axis ticks/labels, the timeline, and Plot's trend lines are chrome —\n // they carry data but are not chart shapes, so they must not fire shape\n // tooltips/handlers (a trend line's own tooltip runs in `_sharedHover`).\n if (\n nodeAny.interactionGroup === \"axis\" ||\n nodeAny.interactionGroup === \"timeline\" ||\n nodeAny.interactionGroup === \"trend\"\n )\n return;\n // Prefer the node's stamped interaction group (set by Viz.toScene), so\n // legend swatches route to legend handlers on Canvas too — where the\n // single canvas element has no per-shape DOM to walk. Fall back to SVG\n // DOM ancestry for nodes the stamp didn't reach.\n const target =\n event.nativeEvent && (event.nativeEvent as Event).target;\n const isLegendNode =\n nodeAny.interactionGroup === \"legend\" ||\n (target && typeof (target as Element).closest === \"function\"\n ? !!(target as Element).closest('[data-key=\"viz-legend\"]')\n : false);\n const suffix = isLegendNode ? \"legend\" : \"shape\";\n const handlerKey = `${event.type}.${suffix}`;\n // Resolve the datum + index this pick reports to handlers, ONCE, and reuse\n // it for every handler fired below so tooltip/click/user handlers agree on\n // which datum the pointer is over. The base unwraps the node's raw datum to\n // its source row; Plot overrides `_interactionDatum` to report the point\n // nearest the cursor for multi-point shapes (Line/Area).\n const {d: sourceDatum, i: sourceIndex, x: rawDatum} = this._interactionDatum(\n pick,\n event,\n );\n const shapeType =\n typeof nodeAny.shapeType === \"string\" ? nodeAny.shapeType : null;\n this._lastScenePick = {\n d: sourceDatum, i: sourceIndex, x: rawDatum, isLegend: isLegendNode, shapeType,\n // The live picked node's own geometry, read synchronously by clickShape\n // (before the drill-down re-render replaces this frame) to arm the\n // forward drill-down morph.\n node: pick.node,\n };\n this._hoverDatum = rawDatum;\n fire(handlerKey, sourceDatum, sourceIndex, rawDatum);\n // Shape-class-scoped handlers (`\"click.Bar\"`, `\"mousemove.Circle\"`). The\n // emitting shape stamps its type onto the node; on the scene path this is\n // the only place these fire (compute-mode shapes wire no DOM listeners).\n // Legend nodes are excluded so a legend swatch's shape type can't\n // masquerade as a chart-shape handler.\n if (!isLegendNode && shapeType) {\n fire(`${event.type}.${shapeType}`, sourceDatum, sourceIndex, rawDatum);\n }\n // Also fire the un-suffixed handler (e.g. \"mousemove\") so user-registered\n // global handlers see the event too.\n fire(event.type, sourceDatum, sourceIndex, rawDatum);\n }\n\n /**\n Coalesces interaction-driven scene repaints (hover/active dimming) into a\n single paint per animation frame. A fast pointer sweep across a dense\n chart fires a hover transition per shape crossed; painting each one\n synchronously rebuilt the whole scene back-to-back, saturating the main\n thread (~200ms stalls) so the tooltip couldn't reposition and appeared\n stuck at its last spot. Only the latest hover state is visible, so the\n intermediate paints are wasted — collapse them to one rAF-scheduled draw.\n */\n _scheduleSceneRepaint(): void {\n if (!this._sceneRenderer) return;\n if (typeof requestAnimationFrame !== \"function\") {\n this._drawSceneToTarget(0);\n return;\n }\n if (this._sceneRepaintRAF != null) return;\n this._sceneRepaintRAF = requestAnimationFrame(() => {\n this._sceneRepaintRAF = undefined;\n this._drawSceneToTarget(0);\n });\n }\n\n /**\n Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.\n */\n destroy(): this {\n unregisterLink(this as unknown as VizInstance);\n this._resizeObserver?.disconnect();\n this._fontsUnsubscribe?.();\n this._fontsUnsubscribe = undefined;\n this._tooltipClass.data([]).render();\n select(\"body\").on(`touchstart.${this._uuid}`, null);\n // Clear the visibility/resize/scroll poll timers + scroll listener\n // so a destroyed chart doesn't keep firing intervals/timeouts that\n // hold the entire viz instance alive. Without this, an SPA that\n // mounts/unmounts charts on tab switches leaks the scene tree +\n // a 200ms-interval timer per leaked chart.\n if (this._visiblePoll) {\n this._visiblePoll = clearInterval(this._visiblePoll) as never;\n }\n if (this._resizePoll) {\n this._resizePoll = clearTimeout(this._resizePoll) as never;\n }\n if (this._scrollPoll) {\n this._scrollPoll = clearTimeout(this._scrollPoll) as never;\n }\n this._visibleUnobserve?.();\n this._visibleUnobserve = undefined;\n this._unloadUnobserve?.();\n this._unloadUnobserve = undefined;\n if (this._sceneRepaintRAF != null) {\n if (typeof cancelAnimationFrame === \"function\")\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n if (this.schema.scrollContainer)\n select(this.schema.scrollContainer).on(`scroll.${this._uuid}`, null);\n // Destroy the active scene renderer (clears its own pointer-rect\n // listeners, overlay host, canvas/svg DOM, timers).\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\") {\n this._sceneRenderer.destroy();\n this._sceneRenderer = undefined;\n }\n return this;\n }\n\n}\n"],"names":["select","date","getSize","computeTrailCatchup","CanvasRenderer","SvgRenderer","VizBase","applyColorScaleBucketOpacity","applyInteractionOpacity","chartAreaRect","initInsetDefaults","insetComponentScene","applyZoomPointerEvents","bindCanvasZoom","initVizDefaults","unregisterLink","vizRender","vizDraw","vizPreDraw","tagInteractionGroup","node","group","interactionGroup","kids","children","child","mountTargetFor","kind","target","Element","tagName","toLowerCase","parentNode","Viz","_preDraw","toScene","_chartScene","length","sliced","zoomNode","type","key","transform","_zoomTransform","x","y","scale","_chartTransform","clip","_chartClip","schema","zoom","_margin","undefined","push","_shapes","forEach","shape","si","sel","_select","attr","t","m","match","parseFloat","components","_legendClass","_colorScaleClass","_timelineClass","name","comp","compScene","outerBounds","_featurePanels","width","height","root","_draw","_sizeLegendScale","_available","_insetRegion","_thresholdFunction","data","_tree","_setSVGSize","w","h","style","_autoWidth","_autoHeight","render","callback","toSVGString","_sceneRenderer","toCanvas","_renderer","renderer","_","arguments","renderMode","_renderMode","renderScene","opts","_sceneTarget","Promise","resolve","scene","_lastSceneRendered","_drawSceneToTarget","durationOverride","Math","computeSvg","userTarget","mountTarget","currentContainer","container","containerChanged","destroy","Ctor","mount","pixelRatio","_scenePixelRatio","_lastScenePick","on","event","_routeSceneEvent","resize","drawDuration","_instantNextDraw","duration","_sceneRepaintRAF","cancelAnimationFrame","_transitionEndsAt","Date","now","_timelineSelection","brushing","sequence","Array","isArray","max","map","v","Number","trailCatchup","_trailSeq","drawScene","enterFrom","_resolvedEnterFrom","enterFromBody","_resolvedEnterFromBody","exitTo","_resolvedExitTo","exitToBody","_resolvedExitToBody","instantExitKey","_resolvedInstantExitKey","reunionEnterKey","_resolvedReunionEnterKey","reunionEnterFrom","_resolvedReunionEnterFrom","instantExitAll","_resolvedInstantExitAll","host","querySelector","tlGroup","appendChild","zoomBrush","lastElementChild","_interactionDatum","pick","_event","rawDatum","datum","sourceDatum","sourceIndex","i","index","d","_sharedHover","fire","fn","call","nativeEvent","lastPick","isLegend","shapeType","_hoverDatum","nodeAny","isLegendNode","closest","suffix","handlerKey","_scheduleSceneRepaint","requestAnimationFrame","_resizeObserver","disconnect","_fontsUnsubscribe","_tooltipClass","_uuid","_visiblePoll","clearInterval","_resizePoll","clearTimeout","_scrollPoll","_visibleUnobserve","_unloadUnobserve","scrollContainer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,QAAO,eAAe;AAEpC,SAAQC,IAAI,EAAEC,OAAO,QAAO,cAAc;AAE1C,SAAQC,mBAAmB,QAAO,oBAAoB;AAEtD,SAAQC,cAAc,EAAEC,WAAW,QAAO,iBAAiB;AAG3D,OAAOC,aAAa,eAAe;AAInC,SAAQC,4BAA4B,EAAEC,uBAAuB,QAAO,0BAA0B;AAC9F,SAAQC,aAAa,QAAO,+BAA+B;AAC3D,SAAQC,iBAAiB,EAAEC,mBAAmB,QAAO,4BAA4B;AAEjF,SAAQC,sBAAsB,EAAEC,cAAc,QAAO,+BAA+B;AACpF,SAAQC,eAAe,QAAO,mBAAmB;AACjD,SAAQC,cAAc,QAAO,iBAAiB;AAC9C,SAAQC,SAAS,QAAO,iBAAiB;AACzC,SAAQC,OAAO,QAAO,yBAAyB;AAC/C,SAAQC,UAAU,QAAO,4BAA4B;AAGrD;;;;AAIA,GACA,SAASC,oBAA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