@d3plus/core 3.1.6 → 4.0.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 (579) hide show
  1. package/README.md +9922 -78537
  2. package/es/index.js +8 -0
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +54 -0
  5. package/es/internal.js.map +1 -0
  6. package/es/src/charts/AreaPlot/index.js +36 -0
  7. package/es/src/charts/AreaPlot/index.js.map +1 -0
  8. package/es/src/charts/BarChart/index.js +48 -0
  9. package/es/src/charts/BarChart/index.js.map +1 -0
  10. package/es/src/charts/BoxWhisker/index.js +52 -0
  11. package/es/src/charts/BoxWhisker/index.js.map +1 -0
  12. package/es/src/charts/BumpChart/index.js +81 -0
  13. package/es/src/charts/BumpChart/index.js.map +1 -0
  14. package/es/src/charts/Donut/index.js +42 -0
  15. package/es/src/charts/Donut/index.js.map +1 -0
  16. package/es/src/charts/Geomap/applyLayout.js +208 -0
  17. package/es/src/charts/Geomap/applyLayout.js.map +1 -0
  18. package/es/src/charts/Geomap/emit.js +169 -0
  19. package/es/src/charts/Geomap/emit.js.map +1 -0
  20. package/es/src/charts/Geomap/index.js +521 -0
  21. package/es/src/charts/Geomap/index.js.map +1 -0
  22. package/es/src/charts/LinePlot/index.js +32 -0
  23. package/es/src/charts/LinePlot/index.js.map +1 -0
  24. package/es/src/charts/Matrix/applyLayout.js +92 -0
  25. package/es/src/charts/Matrix/applyLayout.js.map +1 -0
  26. package/es/src/charts/Matrix/emit.js +44 -0
  27. package/es/src/charts/Matrix/emit.js.map +1 -0
  28. package/es/src/charts/Matrix/index.js +154 -0
  29. package/es/src/charts/Matrix/index.js.map +1 -0
  30. package/es/src/charts/Network/applyLayout.js +322 -0
  31. package/es/src/charts/Network/applyLayout.js.map +1 -0
  32. package/es/src/charts/Network/emit.js +273 -0
  33. package/es/src/charts/Network/emit.js.map +1 -0
  34. package/es/src/charts/Network/index.js +422 -0
  35. package/es/src/charts/Network/index.js.map +1 -0
  36. package/es/src/charts/Pack/applyLayout.js +46 -0
  37. package/es/src/charts/Pack/applyLayout.js.map +1 -0
  38. package/es/src/charts/Pack/emit.js +116 -0
  39. package/es/src/charts/Pack/emit.js.map +1 -0
  40. package/es/src/charts/Pack/index.js +194 -0
  41. package/es/src/charts/Pack/index.js.map +1 -0
  42. package/es/src/charts/Pack/recursionCircles.js +18 -0
  43. package/es/src/charts/Pack/recursionCircles.js.map +1 -0
  44. package/es/src/charts/Pie/applyLayout.js +44 -0
  45. package/es/src/charts/Pie/applyLayout.js.map +1 -0
  46. package/es/src/charts/Pie/emit.js +111 -0
  47. package/es/src/charts/Pie/emit.js.map +1 -0
  48. package/es/src/charts/Pie/index.js +134 -0
  49. package/es/src/charts/Pie/index.js.map +1 -0
  50. package/es/src/charts/Plot/draw.js +424 -0
  51. package/es/src/charts/Plot/draw.js.map +1 -0
  52. package/es/src/charts/Plot/index.js +827 -0
  53. package/es/src/charts/Plot/index.js.map +1 -0
  54. package/es/src/charts/Plot/labelPlacement.js +36 -0
  55. package/es/src/charts/Plot/labelPlacement.js.map +1 -0
  56. package/es/src/charts/Plot/pipeline.js +594 -0
  57. package/es/src/charts/Plot/pipeline.js.map +1 -0
  58. package/es/src/charts/Plot/pipelineDomains.js +254 -0
  59. package/es/src/charts/Plot/pipelineDomains.js.map +1 -0
  60. package/es/src/charts/Plot/pipelineLineLabels.js +210 -0
  61. package/es/src/charts/Plot/pipelineLineLabels.js.map +1 -0
  62. package/es/src/charts/Plot/shapeDefaults.js +189 -0
  63. package/es/src/charts/Plot/shapeDefaults.js.map +1 -0
  64. package/es/src/charts/Plot/stackHelpers.js +52 -0
  65. package/es/src/charts/Plot/stackHelpers.js.map +1 -0
  66. package/es/src/charts/Priestley/applyLayout.js +121 -0
  67. package/es/src/charts/Priestley/applyLayout.js.map +1 -0
  68. package/es/src/charts/Priestley/emit.js +129 -0
  69. package/es/src/charts/Priestley/emit.js.map +1 -0
  70. package/es/src/charts/Priestley/index.js +97 -0
  71. package/es/src/charts/Priestley/index.js.map +1 -0
  72. package/es/src/charts/Radar/applyLayout.js +326 -0
  73. package/es/src/charts/Radar/applyLayout.js.map +1 -0
  74. package/es/src/charts/Radar/emit.js +28 -0
  75. package/es/src/charts/Radar/emit.js.map +1 -0
  76. package/es/src/charts/Radar/index.js +98 -0
  77. package/es/src/charts/Radar/index.js.map +1 -0
  78. package/es/src/charts/RadialMatrix/applyLayout.js +132 -0
  79. package/es/src/charts/RadialMatrix/applyLayout.js.map +1 -0
  80. package/es/src/charts/RadialMatrix/emit.js +33 -0
  81. package/es/src/charts/RadialMatrix/emit.js.map +1 -0
  82. package/es/src/charts/RadialMatrix/index.js +144 -0
  83. package/es/src/charts/RadialMatrix/index.js.map +1 -0
  84. package/es/src/charts/Rings/applyLayout.js +508 -0
  85. package/es/src/charts/Rings/applyLayout.js.map +1 -0
  86. package/es/src/charts/Rings/emit.js +222 -0
  87. package/es/src/charts/Rings/emit.js.map +1 -0
  88. package/es/src/charts/Rings/index.js +245 -0
  89. package/es/src/charts/Rings/index.js.map +1 -0
  90. package/es/src/charts/Sankey/applyLayout.js +107 -0
  91. package/es/src/charts/Sankey/applyLayout.js.map +1 -0
  92. package/es/src/charts/Sankey/emit.js +134 -0
  93. package/es/src/charts/Sankey/emit.js.map +1 -0
  94. package/es/src/charts/Sankey/index.js +219 -0
  95. package/es/src/charts/Sankey/index.js.map +1 -0
  96. package/es/src/charts/StackedArea/index.js +27 -0
  97. package/es/src/charts/StackedArea/index.js.map +1 -0
  98. package/es/src/charts/Tree/applyLayout.js +233 -0
  99. package/es/src/charts/Tree/applyLayout.js.map +1 -0
  100. package/es/src/charts/Tree/emit.js +257 -0
  101. package/es/src/charts/Tree/emit.js.map +1 -0
  102. package/es/src/charts/Tree/index.js +105 -0
  103. package/es/src/charts/Tree/index.js.map +1 -0
  104. package/es/src/charts/Treemap/applyLayout.js +85 -0
  105. package/es/src/charts/Treemap/applyLayout.js.map +1 -0
  106. package/es/src/charts/Treemap/emit.js +141 -0
  107. package/es/src/charts/Treemap/emit.js.map +1 -0
  108. package/es/src/charts/Treemap/index.js +177 -0
  109. package/es/src/charts/Treemap/index.js.map +1 -0
  110. package/es/src/charts/Treemap/thresholdFunction.js +112 -0
  111. package/es/src/charts/Treemap/thresholdFunction.js.map +1 -0
  112. package/es/src/charts/definition/ChartDefinition.js +12 -0
  113. package/es/src/charts/definition/ChartDefinition.js.map +1 -0
  114. package/es/src/charts/definition/applyDefinition.js +107 -0
  115. package/es/src/charts/definition/applyDefinition.js.map +1 -0
  116. package/es/src/charts/definition/makeChart.js +153 -0
  117. package/es/src/charts/definition/makeChart.js.map +1 -0
  118. package/es/src/charts/drawSteps/zoomControls.js +231 -96
  119. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  120. package/es/src/charts/events/click.legend.js +2 -2
  121. package/es/src/charts/events/click.legend.js.map +1 -1
  122. package/es/src/charts/events/click.shape.js +5 -5
  123. package/es/src/charts/events/click.shape.js.map +1 -1
  124. package/es/src/charts/events/mouseenter.js +20 -1
  125. package/es/src/charts/events/mouseenter.js.map +1 -1
  126. package/es/src/charts/events/mouseleave.js +19 -4
  127. package/es/src/charts/events/mouseleave.js.map +1 -1
  128. package/es/src/charts/events/mousemove.legend.js +10 -10
  129. package/es/src/charts/events/mousemove.legend.js.map +1 -1
  130. package/es/src/charts/events/mousemove.shape.js +14 -8
  131. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  132. package/es/src/charts/events/touchstart.body.js.map +1 -1
  133. package/es/src/charts/features/axes.js +432 -0
  134. package/es/src/charts/features/axes.js.map +1 -0
  135. package/es/src/charts/features/chartGeometry.js +66 -0
  136. package/es/src/charts/features/chartGeometry.js.map +1 -0
  137. package/es/src/charts/features/colorScaleBucket.js +92 -0
  138. package/es/src/charts/features/colorScaleBucket.js.map +1 -0
  139. package/es/src/charts/features/emitHelpers.js +217 -0
  140. package/es/src/charts/features/emitHelpers.js.map +1 -0
  141. package/es/src/charts/features/ensureZoomDom.js +71 -0
  142. package/es/src/charts/features/ensureZoomDom.js.map +1 -0
  143. package/es/src/charts/features/features.js +650 -0
  144. package/es/src/charts/features/features.js.map +1 -0
  145. package/es/src/charts/features/featuresLegend.js +180 -0
  146. package/es/src/charts/features/featuresLegend.js.map +1 -0
  147. package/es/src/charts/features/legendLabel.js +12 -0
  148. package/es/src/charts/features/legendLabel.js.map +1 -0
  149. package/es/src/charts/features/lineLabels.js +154 -0
  150. package/es/src/charts/features/lineLabels.js.map +1 -0
  151. package/es/src/charts/features/plotPaint.js +512 -0
  152. package/es/src/charts/features/plotPaint.js.map +1 -0
  153. package/es/src/charts/features/shapeEmit.js +273 -0
  154. package/es/src/charts/features/shapeEmit.js.map +1 -0
  155. package/es/src/charts/helpers/matrixData.js +3 -3
  156. package/es/src/charts/helpers/matrixData.js.map +1 -1
  157. package/es/src/charts/index.js +21 -21
  158. package/es/src/charts/index.js.map +1 -1
  159. package/es/src/charts/pipeline/resolveSpec.js +44 -0
  160. package/es/src/charts/pipeline/resolveSpec.js.map +1 -0
  161. package/es/src/charts/pipeline/runChartDraw.js +109 -0
  162. package/es/src/charts/pipeline/runChartDraw.js.map +1 -0
  163. package/es/src/charts/pipeline/runVizPipeline.js +84 -0
  164. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -0
  165. package/es/src/charts/pipeline/stages.js +103 -0
  166. package/es/src/charts/pipeline/stages.js.map +1 -0
  167. package/es/src/charts/pipeline/vizContext.js +29 -0
  168. package/es/src/charts/pipeline/vizContext.js.map +1 -0
  169. package/es/src/charts/pipeline/vizDraw.js +37 -0
  170. package/es/src/charts/pipeline/vizDraw.js.map +1 -0
  171. package/es/src/charts/pipeline/vizDrawPure.js +174 -0
  172. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -0
  173. package/es/src/charts/pipeline/vizPreDraw.js +145 -0
  174. package/es/src/charts/pipeline/vizPreDraw.js.map +1 -0
  175. package/es/src/charts/pipeline/vizPreDrawPure.js +279 -0
  176. package/es/src/charts/pipeline/vizPreDrawPure.js.map +1 -0
  177. package/es/src/charts/plotBuffers/Bar.js +4 -4
  178. package/es/src/charts/plotBuffers/Bar.js.map +1 -1
  179. package/es/src/charts/plotBuffers/Box.js +4 -4
  180. package/es/src/charts/plotBuffers/Box.js.map +1 -1
  181. package/es/src/charts/plotBuffers/Circle.js +2 -2
  182. package/es/src/charts/plotBuffers/Circle.js.map +1 -1
  183. package/es/src/charts/plotBuffers/Line.js +5 -5
  184. package/es/src/charts/plotBuffers/Line.js.map +1 -1
  185. package/es/src/charts/plotBuffers/Rect.js +2 -2
  186. package/es/src/charts/plotBuffers/Rect.js.map +1 -1
  187. package/es/src/charts/plotBuffers/discreteBuffer.js +1 -2
  188. package/es/src/charts/plotBuffers/discreteBuffer.js.map +1 -1
  189. package/es/src/charts/plotBuffers/numericBuffer.js +1 -2
  190. package/es/src/charts/plotBuffers/numericBuffer.js.map +1 -1
  191. package/es/src/charts/viz/Viz.js +985 -0
  192. package/es/src/charts/viz/Viz.js.map +1 -0
  193. package/es/src/charts/viz/VizBase.js +447 -0
  194. package/es/src/charts/viz/VizBase.js.map +1 -0
  195. package/es/src/charts/viz/VizBaseConfig.js +504 -0
  196. package/es/src/charts/viz/VizBaseConfig.js.map +1 -0
  197. package/es/src/charts/viz/interactionOpacity.js +247 -0
  198. package/es/src/charts/viz/interactionOpacity.js.map +1 -0
  199. package/es/src/charts/viz/ordinalColor.js +71 -0
  200. package/es/src/charts/viz/ordinalColor.js.map +1 -0
  201. package/es/src/charts/viz/trailCatchup.js +127 -0
  202. package/es/src/charts/viz/trailCatchup.js.map +1 -0
  203. package/es/src/charts/viz/vizDefaults.js +602 -0
  204. package/es/src/charts/viz/vizDefaults.js.map +1 -0
  205. package/es/src/charts/viz/vizRender.js +251 -0
  206. package/es/src/charts/viz/vizRender.js.map +1 -0
  207. package/es/src/charts/viz/vizTypes.js +28 -0
  208. package/es/src/charts/viz/vizTypes.js.map +1 -0
  209. package/es/src/components/Axis/Axis.js +691 -0
  210. package/es/src/components/Axis/Axis.js.map +1 -0
  211. package/es/src/components/Axis/AxisBottom.js.map +1 -0
  212. package/es/src/components/Axis/AxisLeft.js.map +1 -0
  213. package/es/src/components/Axis/AxisRight.js.map +1 -0
  214. package/es/src/components/Axis/AxisTop.js.map +1 -0
  215. package/es/src/components/Axis/axisLayout.js +208 -0
  216. package/es/src/components/Axis/axisLayout.js.map +1 -0
  217. package/es/src/components/Axis/axisLayoutLabels.js +177 -0
  218. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -0
  219. package/es/src/components/Axis/axisLayoutScale.js +374 -0
  220. package/es/src/components/Axis/axisLayoutScale.js.map +1 -0
  221. package/es/src/components/Axis/axisRender.js +535 -0
  222. package/es/src/components/Axis/axisRender.js.map +1 -0
  223. package/es/src/components/ColorScale/ColorScale.js +506 -0
  224. package/es/src/components/ColorScale/ColorScale.js.map +1 -0
  225. package/es/src/components/ColorScale/colorScaleRender.js +277 -0
  226. package/es/src/components/ColorScale/colorScaleRender.js.map +1 -0
  227. package/es/src/components/ColorScale/colorScaleScale.js +274 -0
  228. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -0
  229. package/es/src/components/Legend/Legend.js +445 -0
  230. package/es/src/components/Legend/Legend.js.map +1 -0
  231. package/es/src/components/Legend/legendConfig.js +87 -0
  232. package/es/src/components/Legend/legendConfig.js.map +1 -0
  233. package/es/src/components/Legend/legendRender.js +245 -0
  234. package/es/src/components/Legend/legendRender.js.map +1 -0
  235. package/es/src/components/Message.js.map +1 -1
  236. package/es/src/components/TextBox.js +639 -453
  237. package/es/src/components/TextBox.js.map +1 -1
  238. package/es/src/components/Timeline/Timeline.js +674 -0
  239. package/es/src/components/Timeline/Timeline.js.map +1 -0
  240. package/es/src/components/Timeline/timelineConfig.js +115 -0
  241. package/es/src/components/Timeline/timelineConfig.js.map +1 -0
  242. package/es/src/components/Timeline/timelineRender.js +267 -0
  243. package/es/src/components/Timeline/timelineRender.js.map +1 -0
  244. package/es/src/components/Tooltip.js +288 -249
  245. package/es/src/components/Tooltip.js.map +1 -1
  246. package/es/src/components/index.js +8 -8
  247. package/es/src/components/index.js.map +1 -1
  248. package/es/src/fluent.js +265 -0
  249. package/es/src/fluent.js.map +1 -0
  250. package/es/src/shapes/Area.js +96 -114
  251. package/es/src/shapes/Area.js.map +1 -1
  252. package/es/src/shapes/Bar.js +71 -86
  253. package/es/src/shapes/Bar.js.map +1 -1
  254. package/es/src/shapes/Box.js +295 -190
  255. package/es/src/shapes/Box.js.map +1 -1
  256. package/es/src/shapes/Circle.js +72 -31
  257. package/es/src/shapes/Circle.js.map +1 -1
  258. package/es/src/shapes/Image.js +164 -85
  259. package/es/src/shapes/Image.js.map +1 -1
  260. package/es/src/shapes/Line.js +51 -94
  261. package/es/src/shapes/Line.js.map +1 -1
  262. package/es/src/shapes/Path.js +33 -41
  263. package/es/src/shapes/Path.js.map +1 -1
  264. package/es/src/shapes/Rect.js +86 -37
  265. package/es/src/shapes/Rect.js.map +1 -1
  266. package/es/src/shapes/Shape.js +655 -678
  267. package/es/src/shapes/Shape.js.map +1 -1
  268. package/es/src/shapes/Whisker.js +156 -61
  269. package/es/src/shapes/Whisker.js.map +1 -1
  270. package/es/src/shapes/buildLabelData.js +70 -0
  271. package/es/src/shapes/buildLabelData.js.map +1 -0
  272. package/es/src/shapes/emitLabels.js +84 -0
  273. package/es/src/shapes/emitLabels.js.map +1 -0
  274. package/es/src/shapes/hitAreaNode.js +37 -0
  275. package/es/src/shapes/hitAreaNode.js.map +1 -0
  276. package/es/src/shapes/sceneSort.js +57 -0
  277. package/es/src/shapes/sceneSort.js.map +1 -0
  278. package/es/src/shapes/shapeConfig.js +31 -0
  279. package/es/src/shapes/shapeConfig.js.map +1 -0
  280. package/es/src/utils/BaseClass.js +35 -19
  281. package/es/src/utils/BaseClass.js.map +1 -1
  282. package/es/src/utils/D3Scale.js +16 -0
  283. package/es/src/utils/D3Scale.js.map +1 -0
  284. package/es/src/utils/D3plusConfig.js.map +1 -1
  285. package/es/src/utils/configPrep.js +8 -3
  286. package/es/src/utils/configPrep.js.map +1 -1
  287. package/es/src/utils/getProp.js +1 -1
  288. package/es/src/utils/getProp.js.map +1 -1
  289. package/es/src/utils/index.js +1 -0
  290. package/es/src/utils/index.js.map +1 -1
  291. package/es/src/utils/paintComponentScene.js +59 -0
  292. package/es/src/utils/paintComponentScene.js.map +1 -0
  293. package/es/umd-entry.js +16 -0
  294. package/es/umd-entry.js.map +1 -0
  295. package/package.json +14 -9
  296. package/types/index.d.ts +3 -1
  297. package/types/internal.d.ts +54 -0
  298. package/types/src/charts/AreaPlot/index.d.ts +10 -0
  299. package/types/src/charts/BarChart/index.d.ts +10 -0
  300. package/types/src/charts/BoxWhisker/index.d.ts +11 -0
  301. package/types/src/charts/BumpChart/index.d.ts +11 -0
  302. package/types/src/charts/ChartDefinition.d.ts +75 -0
  303. package/types/src/charts/Donut/index.d.ts +13 -0
  304. package/types/src/charts/Geomap/applyLayout.d.ts +7 -0
  305. package/types/src/charts/Geomap/emit.d.ts +7 -0
  306. package/types/src/charts/Geomap/index.d.ts +14 -0
  307. package/types/src/charts/Geomap.d.ts +6 -0
  308. package/types/src/charts/LinePlot/index.d.ts +10 -0
  309. package/types/src/charts/Matrix/applyLayout.d.ts +9 -0
  310. package/types/src/charts/Matrix/emit.d.ts +6 -0
  311. package/types/src/charts/Matrix/index.d.ts +14 -0
  312. package/types/src/charts/Matrix.d.ts +0 -26
  313. package/types/src/charts/Network/applyLayout.d.ts +10 -0
  314. package/types/src/charts/Network/emit.d.ts +6 -0
  315. package/types/src/charts/Network/index.d.ts +7 -0
  316. package/types/src/charts/Network.d.ts +0 -24
  317. package/types/src/charts/Pack/applyLayout.d.ts +16 -0
  318. package/types/src/charts/Pack/emit.d.ts +6 -0
  319. package/types/src/charts/Pack/index.d.ts +15 -0
  320. package/types/src/charts/Pack/recursionCircles.d.ts +7 -0
  321. package/types/src/charts/Pack.d.ts +0 -13
  322. package/types/src/charts/Pie/applyLayout.d.ts +8 -0
  323. package/types/src/charts/Pie/emit.d.ts +5 -0
  324. package/types/src/charts/Pie/index.d.ts +14 -0
  325. package/types/src/charts/Pie.d.ts +0 -27
  326. package/types/src/charts/Plot/draw.d.ts +2 -0
  327. package/types/src/charts/Plot/index.d.ts +167 -0
  328. package/types/src/charts/Plot/labelPlacement.d.ts +15 -0
  329. package/types/src/charts/Plot/pipeline.d.ts +70 -0
  330. package/types/src/charts/Plot/pipelineDomains.d.ts +2 -0
  331. package/types/src/charts/Plot/pipelineLineLabels.d.ts +2 -0
  332. package/types/src/charts/Plot/shapeDefaults.d.ts +64 -0
  333. package/types/src/charts/Plot/stackHelpers.d.ts +24 -0
  334. package/types/src/charts/Plot.d.ts +23 -72
  335. package/types/src/charts/Priestley/applyLayout.d.ts +21 -0
  336. package/types/src/charts/Priestley/emit.d.ts +6 -0
  337. package/types/src/charts/Priestley/index.d.ts +14 -0
  338. package/types/src/charts/Radar/applyLayout.d.ts +10 -0
  339. package/types/src/charts/Radar/emit.d.ts +7 -0
  340. package/types/src/charts/Radar/index.d.ts +14 -0
  341. package/types/src/charts/RadialMatrix/applyLayout.d.ts +11 -0
  342. package/types/src/charts/RadialMatrix/emit.d.ts +6 -0
  343. package/types/src/charts/RadialMatrix/index.d.ts +14 -0
  344. package/types/src/charts/RadialMatrix.d.ts +0 -15
  345. package/types/src/charts/Rings/applyLayout.d.ts +2 -0
  346. package/types/src/charts/Rings/emit.d.ts +7 -0
  347. package/types/src/charts/Rings/index.d.ts +15 -0
  348. package/types/src/charts/Rings.d.ts +0 -13
  349. package/types/src/charts/Sankey/applyLayout.d.ts +7 -0
  350. package/types/src/charts/Sankey/emit.d.ts +6 -0
  351. package/types/src/charts/Sankey/index.d.ts +7 -0
  352. package/types/src/charts/Sankey.d.ts +0 -4
  353. package/types/src/charts/StackedArea/index.d.ts +10 -0
  354. package/types/src/charts/Tree/applyLayout.d.ts +2 -0
  355. package/types/src/charts/Tree/emit.d.ts +7 -0
  356. package/types/src/charts/Tree/index.d.ts +14 -0
  357. package/types/src/charts/Tree.d.ts +0 -16
  358. package/types/src/charts/Treemap/applyLayout.d.ts +16 -0
  359. package/types/src/charts/Treemap/emit.d.ts +6 -0
  360. package/types/src/charts/Treemap/index.d.ts +18 -0
  361. package/types/src/charts/Treemap/thresholdFunction.d.ts +25 -0
  362. package/types/src/charts/Treemap.d.ts +4 -13
  363. package/types/src/charts/Viz.d.ts +49 -361
  364. package/types/src/charts/VizBase.d.ts +158 -0
  365. package/types/src/charts/VizBaseConfig.d.ts +148 -0
  366. package/types/src/charts/applyDefinition.d.ts +13 -0
  367. package/types/src/charts/axes.d.ts +134 -0
  368. package/types/src/charts/chartGeometry.d.ts +58 -0
  369. package/types/src/charts/definition/ChartDefinition.d.ts +84 -0
  370. package/types/src/charts/definition/applyDefinition.d.ts +13 -0
  371. package/types/src/charts/definition/makeChart.d.ts +22 -0
  372. package/types/src/charts/drawSteps/zoomControls.d.ts +25 -5
  373. package/types/src/charts/emitHelpers.d.ts +122 -0
  374. package/types/src/charts/ensureZoomDom.d.ts +39 -0
  375. package/types/src/charts/events/click.legend.d.ts +1 -1
  376. package/types/src/charts/events/click.shape.d.ts +1 -1
  377. package/types/src/charts/events/mouseenter.d.ts +1 -1
  378. package/types/src/charts/events/mouseleave.d.ts +1 -1
  379. package/types/src/charts/events/mousemove.legend.d.ts +1 -1
  380. package/types/src/charts/events/mousemove.shape.d.ts +1 -1
  381. package/types/src/charts/events/touchstart.body.d.ts +1 -1
  382. package/types/src/charts/factories.d.ts +73 -0
  383. package/types/src/charts/features/axes.d.ts +134 -0
  384. package/types/src/charts/features/chartGeometry.d.ts +58 -0
  385. package/types/src/charts/features/colorScaleBucket.d.ts +43 -0
  386. package/types/src/charts/features/colorScaleBucketShare.d.ts +16 -0
  387. package/types/src/charts/features/emitHelpers.d.ts +123 -0
  388. package/types/src/charts/features/ensureZoomDom.d.ts +39 -0
  389. package/types/src/charts/features/features.d.ts +152 -0
  390. package/types/src/charts/features/featuresLegend.d.ts +12 -0
  391. package/types/src/charts/features/legendLabel.d.ts +11 -0
  392. package/types/src/charts/features/lineLabels.d.ts +40 -0
  393. package/types/src/charts/features/plotPaint.d.ts +233 -0
  394. package/types/src/charts/features/shapeEmit.d.ts +61 -0
  395. package/types/src/charts/features.d.ts +152 -0
  396. package/types/src/charts/featuresLegend.d.ts +12 -0
  397. package/types/src/charts/helpers/matrixData.d.ts +1 -1
  398. package/types/src/charts/index.d.ts +21 -21
  399. package/types/src/charts/legendLabel.d.ts +11 -0
  400. package/types/src/charts/lineLabels.d.ts +40 -0
  401. package/types/src/charts/makeChart.d.ts +22 -0
  402. package/types/src/charts/pipeline/resolveSpec.d.ts +51 -0
  403. package/types/src/charts/pipeline/runChartDraw.d.ts +38 -0
  404. package/types/src/charts/pipeline/runVizPipeline.d.ts +31 -0
  405. package/types/src/charts/pipeline/stages.d.ts +160 -0
  406. package/types/src/charts/pipeline/vizContext.d.ts +45 -0
  407. package/types/src/charts/pipeline/vizDraw.d.ts +25 -0
  408. package/types/src/charts/pipeline/vizDrawPure.d.ts +46 -0
  409. package/types/src/charts/pipeline/vizPreDraw.d.ts +22 -0
  410. package/types/src/charts/pipeline/vizPreDrawPure.d.ts +68 -0
  411. package/types/src/charts/plotBuffers/Bar.d.ts +6 -5
  412. package/types/src/charts/plotBuffers/Box.d.ts +6 -5
  413. package/types/src/charts/plotBuffers/Circle.d.ts +6 -5
  414. package/types/src/charts/plotBuffers/Line.d.ts +6 -5
  415. package/types/src/charts/plotBuffers/Rect.d.ts +6 -5
  416. package/types/src/charts/plotBuffers/discreteBuffer.d.ts +2 -1
  417. package/types/src/charts/plotBuffers/numericBuffer.d.ts +2 -1
  418. package/types/src/charts/plotPaint.d.ts +233 -0
  419. package/types/src/charts/resolveSpec.d.ts +50 -0
  420. package/types/src/charts/runChartDraw.d.ts +38 -0
  421. package/types/src/charts/runVizPipeline.d.ts +31 -0
  422. package/types/src/charts/shapeEmit.d.ts +61 -0
  423. package/types/src/charts/stages.d.ts +117 -0
  424. package/types/src/charts/viz/Viz.d.ts +111 -0
  425. package/types/src/charts/viz/VizBase.d.ts +160 -0
  426. package/types/src/charts/viz/VizBaseConfig.d.ts +156 -0
  427. package/types/src/charts/viz/interactionOpacity.d.ts +23 -0
  428. package/types/src/charts/viz/ordinalColor.d.ts +14 -0
  429. package/types/src/charts/viz/trailCatchup.d.ts +14 -0
  430. package/types/src/charts/viz/vizDefaults.d.ts +8 -0
  431. package/types/src/charts/viz/vizRender.d.ts +8 -0
  432. package/types/src/charts/viz/vizTypes.d.ts +250 -0
  433. package/types/src/charts/vizContext.d.ts +46 -0
  434. package/types/src/charts/vizDefaults.d.ts +8 -0
  435. package/types/src/charts/vizDraw.d.ts +25 -0
  436. package/types/src/charts/vizDrawPure.d.ts +17 -0
  437. package/types/src/charts/vizPreDraw.d.ts +22 -0
  438. package/types/src/charts/vizPreDrawPure.d.ts +40 -0
  439. package/types/src/charts/vizRender.d.ts +8 -0
  440. package/types/src/charts/vizTypes.d.ts +202 -0
  441. package/types/src/components/Axis/Axis.d.ts +182 -0
  442. package/types/src/components/Axis/AxisBottom.d.ts +11 -0
  443. package/types/src/components/Axis/AxisLeft.d.ts +11 -0
  444. package/types/src/components/Axis/AxisRight.d.ts +11 -0
  445. package/types/src/components/Axis/AxisTop.d.ts +11 -0
  446. package/types/src/components/Axis/axisLayout.d.ts +29 -0
  447. package/types/src/components/Axis/axisLayoutLabels.d.ts +70 -0
  448. package/types/src/components/Axis/axisLayoutScale.d.ts +14 -0
  449. package/types/src/components/Axis/axisRender.d.ts +68 -0
  450. package/types/src/components/Axis.d.ts +68 -194
  451. package/types/src/components/ColorScale/ColorScale.d.ts +100 -0
  452. package/types/src/components/ColorScale/colorScaleRender.d.ts +15 -0
  453. package/types/src/components/ColorScale/colorScaleScale.d.ts +19 -0
  454. package/types/src/components/ColorScale.d.ts +1 -129
  455. package/types/src/components/Legend/Legend.d.ts +95 -0
  456. package/types/src/components/Legend/legendConfig.d.ts +7 -0
  457. package/types/src/components/Legend/legendRender.d.ts +16 -0
  458. package/types/src/components/Legend.d.ts +9 -73
  459. package/types/src/components/TextBox.d.ts +25 -218
  460. package/types/src/components/Timeline/Timeline.d.ts +118 -0
  461. package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
  462. package/types/src/components/Timeline/timelineRender.d.ts +24 -0
  463. package/types/src/components/Timeline.d.ts +7 -81
  464. package/types/src/components/Tooltip.d.ts +20 -200
  465. package/types/src/components/axisLayout.d.ts +27 -0
  466. package/types/src/components/axisLayoutLabels.d.ts +42 -0
  467. package/types/src/components/axisLayoutScale.d.ts +12 -0
  468. package/types/src/components/axisRender.d.ts +65 -0
  469. package/types/src/components/colorScaleRender.d.ts +15 -0
  470. package/types/src/components/colorScaleScale.d.ts +19 -0
  471. package/types/src/components/index.d.ts +8 -8
  472. package/types/src/components/legendConfig.d.ts +7 -0
  473. package/types/src/components/legendRender.d.ts +16 -0
  474. package/types/src/components/timelineConfig.d.ts +6 -0
  475. package/types/src/components/timelineRender.d.ts +14 -0
  476. package/types/src/fluent.d.ts +94 -0
  477. package/types/src/shapes/Area.d.ts +15 -27
  478. package/types/src/shapes/Bar.d.ts +13 -33
  479. package/types/src/shapes/Box.d.ts +17 -56
  480. package/types/src/shapes/Circle.d.ts +11 -17
  481. package/types/src/shapes/Image.d.ts +18 -84
  482. package/types/src/shapes/Line.d.ts +12 -22
  483. package/types/src/shapes/Path.d.ts +12 -19
  484. package/types/src/shapes/Rect.d.ts +11 -27
  485. package/types/src/shapes/Shape.d.ts +46 -257
  486. package/types/src/shapes/Whisker.d.ts +15 -42
  487. package/types/src/shapes/buildLabelData.d.ts +50 -0
  488. package/types/src/shapes/emitLabels.d.ts +16 -0
  489. package/types/src/shapes/hitAreaNode.d.ts +19 -0
  490. package/types/src/shapes/sceneSort.d.ts +20 -0
  491. package/types/src/shapes/shapeConfig.d.ts +226 -0
  492. package/types/src/utils/BaseClass.d.ts +13 -7
  493. package/types/src/utils/D3Scale.d.ts +48 -0
  494. package/types/src/utils/D3plusConfig.d.ts +230 -3
  495. package/types/src/utils/configPrep.d.ts +7 -4
  496. package/types/src/utils/getProp.d.ts +3 -1
  497. package/types/src/utils/index.d.ts +3 -1
  498. package/types/src/utils/paintComponentScene.d.ts +28 -0
  499. package/types/umd-entry.d.ts +15 -0
  500. package/umd/d3plus-core.full.js +31148 -19484
  501. package/umd/d3plus-core.full.js.map +1 -1
  502. package/umd/d3plus-core.full.min.js +5309 -2944
  503. package/umd/d3plus-core.js +17379 -10578
  504. package/umd/d3plus-core.js.map +1 -1
  505. package/umd/d3plus-core.min.js +3470 -1876
  506. package/es/src/charts/AreaPlot.js +0 -85
  507. package/es/src/charts/AreaPlot.js.map +0 -1
  508. package/es/src/charts/BarChart.js +0 -92
  509. package/es/src/charts/BarChart.js.map +0 -1
  510. package/es/src/charts/BoxWhisker.js +0 -92
  511. package/es/src/charts/BoxWhisker.js.map +0 -1
  512. package/es/src/charts/BumpChart.js +0 -147
  513. package/es/src/charts/BumpChart.js.map +0 -1
  514. package/es/src/charts/Donut.js +0 -84
  515. package/es/src/charts/Donut.js.map +0 -1
  516. package/es/src/charts/Geomap.js +0 -766
  517. package/es/src/charts/Geomap.js.map +0 -1
  518. package/es/src/charts/LinePlot.js +0 -83
  519. package/es/src/charts/LinePlot.js.map +0 -1
  520. package/es/src/charts/Matrix.js +0 -341
  521. package/es/src/charts/Matrix.js.map +0 -1
  522. package/es/src/charts/Network.js +0 -796
  523. package/es/src/charts/Network.js.map +0 -1
  524. package/es/src/charts/Pack.js +0 -308
  525. package/es/src/charts/Pack.js.map +0 -1
  526. package/es/src/charts/Pie.js +0 -232
  527. package/es/src/charts/Pie.js.map +0 -1
  528. package/es/src/charts/Plot.js +0 -2114
  529. package/es/src/charts/Plot.js.map +0 -1
  530. package/es/src/charts/Priestley.js +0 -296
  531. package/es/src/charts/Priestley.js.map +0 -1
  532. package/es/src/charts/Radar.js +0 -420
  533. package/es/src/charts/Radar.js.map +0 -1
  534. package/es/src/charts/RadialMatrix.js +0 -383
  535. package/es/src/charts/RadialMatrix.js.map +0 -1
  536. package/es/src/charts/Rings.js +0 -788
  537. package/es/src/charts/Rings.js.map +0 -1
  538. package/es/src/charts/Sankey.js +0 -461
  539. package/es/src/charts/Sankey.js.map +0 -1
  540. package/es/src/charts/StackedArea.js +0 -80
  541. package/es/src/charts/StackedArea.js.map +0 -1
  542. package/es/src/charts/Tree.js +0 -347
  543. package/es/src/charts/Tree.js.map +0 -1
  544. package/es/src/charts/Treemap.js +0 -454
  545. package/es/src/charts/Treemap.js.map +0 -1
  546. package/es/src/charts/Viz.js +0 -1832
  547. package/es/src/charts/Viz.js.map +0 -1
  548. package/es/src/charts/drawSteps/drawAttribution.js +0 -16
  549. package/es/src/charts/drawSteps/drawAttribution.js.map +0 -1
  550. package/es/src/charts/drawSteps/drawBack.js +0 -24
  551. package/es/src/charts/drawSteps/drawBack.js.map +0 -1
  552. package/es/src/charts/drawSteps/drawColorScale.js +0 -75
  553. package/es/src/charts/drawSteps/drawColorScale.js.map +0 -1
  554. package/es/src/charts/drawSteps/drawLegend.js +0 -122
  555. package/es/src/charts/drawSteps/drawLegend.js.map +0 -1
  556. package/es/src/charts/drawSteps/drawSubtitle.js +0 -31
  557. package/es/src/charts/drawSteps/drawSubtitle.js.map +0 -1
  558. package/es/src/charts/drawSteps/drawTimeline.js +0 -85
  559. package/es/src/charts/drawSteps/drawTimeline.js.map +0 -1
  560. package/es/src/charts/drawSteps/drawTitle.js +0 -31
  561. package/es/src/charts/drawSteps/drawTitle.js.map +0 -1
  562. package/es/src/charts/drawSteps/drawTotal.js +0 -32
  563. package/es/src/charts/drawSteps/drawTotal.js.map +0 -1
  564. package/es/src/components/Axis.js +0 -1457
  565. package/es/src/components/Axis.js.map +0 -1
  566. package/es/src/components/AxisBottom.js.map +0 -1
  567. package/es/src/components/AxisLeft.js.map +0 -1
  568. package/es/src/components/AxisRight.js.map +0 -1
  569. package/es/src/components/AxisTop.js.map +0 -1
  570. package/es/src/components/ColorScale.js +0 -843
  571. package/es/src/components/ColorScale.js.map +0 -1
  572. package/es/src/components/Legend.js +0 -622
  573. package/es/src/components/Legend.js.map +0 -1
  574. package/es/src/components/Timeline.js +0 -695
  575. package/es/src/components/Timeline.js.map +0 -1
  576. /package/es/src/components/{AxisBottom.js → Axis/AxisBottom.js} +0 -0
  577. /package/es/src/components/{AxisLeft.js → Axis/AxisLeft.js} +0 -0
  578. /package/es/src/components/{AxisRight.js → Axis/AxisRight.js} +0 -0
  579. /package/es/src/components/{AxisTop.js → Axis/AxisTop.js} +0 -0
@@ -0,0 +1,84 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_without_holes(arr) {
7
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
8
+ }
9
+ function _iterable_to_array(iter) {
10
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
+ }
12
+ function _non_iterable_spread() {
13
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
+ }
15
+ function _to_consumable_array(arr) {
16
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
+ }
18
+ function _unsupported_iterable_to_array(o, minLen) {
19
+ if (!o) return;
20
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
21
+ var n = Object.prototype.toString.call(o).slice(8, -1);
22
+ if (n === "Object" && o.constructor) n = o.constructor.name;
23
+ if (n === "Map" || n === "Set") return Array.from(n);
24
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
+ }
26
+ /**
27
+ `runVizPipeline(viz)` — the chart pipeline as a free function.
28
+
29
+ Draws the boundary between "lifecycle/DOM/data-loading" (which lives on
30
+ `Viz.render()`, inherently instance-bound) and
31
+ "transform-the-data-into-a-scene" (callable without the lifecycle). The
32
+ transform side isn't fully pure yet — `_preDraw`/`_draw` still mutate
33
+ `this` rather than threading an explicit context
34
+ (`UserConfig → ResolvedSpec → transform stages → SceneGraph → renderer`).
35
+
36
+ Calling this function on a Viz instance runs the same four steps
37
+ `Viz.render()` previously inlined inside its `Promise.all().then()`
38
+ callback:
39
+
40
+ 1. `viz._preDraw()` — data filtering + legend-data + drawDepth
41
+ 2. `viz._draw()` — chart-specific layout + scene absorption
42
+ 3. `zoomControls(viz)` — zoom HTML overlay (architectural carve-out)
43
+ 4. `attributionFeature.layout(viz)` — bottom-right attribution panel
44
+ 5. `viz._drawSceneToTarget()` — paint scene via SvgRenderer/CanvasRenderer
45
+
46
+ Future work:
47
+ - Extract a `ResolvedSpec` so step 1 takes (config) not (this).
48
+ - Decouple step 2 so it takes (ctx) not (this); stages already follow
49
+ this pattern but `_draw` itself doesn't.
50
+ - Replace step 5's `this._sceneRenderer` slot with a returned handle
51
+ so callers can pick/destroy/diff without instance lookup.
52
+
53
+ @param viz A Viz instance (or any subclass: Plot, Treemap, Pack, …).
54
+ */ import { attributionFeature, runLayout } from "../features/features.js";
55
+ import { zoomFeature } from "../drawSteps/zoomControls.js";
56
+ export function runVizPipeline(viz) {
57
+ // Goes through `viz._preDraw()` / `viz._draw()` (not the free functions
58
+ // directly) so subclass overrides (Plot._preDraw, Treemap._draw, Plot._draw,
59
+ // Pack/Pie/Matrix/…) still run. The free functions `vizPreDraw` / `vizDraw`
60
+ // hold the BASE Viz behavior; subclasses' `super._preDraw()`/`super._draw()`
61
+ // calls hit the shim which delegates to the free functions.
62
+ viz._preDraw();
63
+ viz._draw();
64
+ // Post-draw features: zoom + brush event wiring and the attribution
65
+ // overlay. Both run after `_draw()` (they need the rendered chart body +
66
+ // `_container`/`_zoomGroup`), claim zero margin, and wire DOM the
67
+ // serializable scene graph can't carry. `zoomFeature` runs before
68
+ // `attributionFeature` to preserve the prior step order.
69
+ // `zoomFeature` returns its control-button overlay as a panel rather
70
+ // than mutating `viz._featurePanels` from inside `layout()` (the
71
+ // FeatureModule contract). The engine appends the returned panels to
72
+ // the instance buffer that `toScene()` reads — including on later zoom
73
+ // repaints, which re-walk `toScene()` outside this pipeline pass.
74
+ var post = runLayout({
75
+ viz: viz
76
+ }, [
77
+ zoomFeature,
78
+ attributionFeature
79
+ ]);
80
+ if (post.panels.length) viz._featurePanels = _to_consumable_array(viz._featurePanels || []).concat(_to_consumable_array(post.panels));
81
+ viz._drawSceneToTarget();
82
+ }
83
+
84
+ //# sourceMappingURL=runVizPipeline.js.map
@@ -0,0 +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. `attributionFeature.layout(viz)` — bottom-right attribution panel\n 5. `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 5'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 {zoomFeature} from \"../drawSteps/zoomControls.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 and the attribution\n // overlay. Both run after `_draw()` (they need the rendered chart body +\n // `_container`/`_zoomGroup`), claim zero margin, and wire DOM the\n // serializable scene graph can't carry. `zoomFeature` runs before\n // `attributionFeature` to preserve the prior step order.\n // `zoomFeature` returns its control-button overlay as a panel rather\n // than mutating `viz._featurePanels` from inside `layout()` (the\n // FeatureModule contract). The engine appends the returned panels to\n // the instance buffer that `toScene()` reads — including on later zoom\n // repaints, which re-walk `toScene()` outside this pipeline pass.\n const post = runLayout({viz}, [zoomFeature, attributionFeature]);\n if (post.panels.length)\n viz._featurePanels = [...(viz._featurePanels || []), ...post.panels];\n viz._drawSceneToTarget();\n}\n"],"names":["attributionFeature","runLayout","zoomFeature","runVizPipeline","viz","_preDraw","_draw","post","panels","length","_featurePanels","_drawSceneToTarget"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,GAEA,SAAQA,kBAAkB,EAAEC,SAAS,QAAO,0BAA0B;AACtE,SAAQC,WAAW,QAAO,+BAA+B;AAGzD,OAAO,SAASC,eAAeC,GAAQ;IACrC,wEAAwE;IACxE,6EAA6E;IAC7E,4EAA4E;IAC5E,6EAA6E;IAC7E,4DAA4D;IAC5DA,IAAIC,QAAQ;IACZD,IAAIE,KAAK;IACT,oEAAoE;IACpE,yEAAyE;IACzE,kEAAkE;IAClE,kEAAkE;IAClE,yDAAyD;IACzD,qEAAqE;IACrE,iEAAiE;IACjE,qEAAqE;IACrE,uEAAuE;IACvE,kEAAkE;IAClE,IAAMC,OAAON,UAAU;QAACG,KAAAA;IAAG,GAAG;QAACF;QAAaF;KAAmB;IAC/D,IAAIO,KAAKC,MAAM,CAACC,MAAM,EACpBL,IAAIM,cAAc,GAAG,AAAC,qBAAIN,IAAIM,cAAc,IAAI,EAAE,SAAG,qBAAGH,KAAKC,MAAM;IACrEJ,IAAIO,kBAAkB;AACxB"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ `runStages` folds a list of `TransformStage`s into a context, plus the
3
+ `VizContext` / `TransformStage` types they share and `discreteNestKeys`,
4
+ the rollup nest-key helper.
5
+
6
+ `runStages` is the engine for the per-chart layout stages
7
+ (`applyTreemapLayout` etc.) that `runChartDraw` and the Plot pipeline
8
+ invoke. Its progressive writeback copies each stage's outputs onto
9
+ `this` so downstream consumers read the values the prior stage produced
10
+ (writeback is progressive, not after all stages, because
11
+ `Treemap._thresholdFunction` reads `this._drawDepth` mid-pipeline).
12
+
13
+ The chart-shell data prep (draw-depth, id accessors, time/user
14
+ filtering, rollup, threshold, large-data adjustment, empty-data
15
+ detection) runs through the imperative `vizPreDrawPure` (see
16
+ `vizPreDrawPure.ts`), which is the single source of truth for it.
17
+ */ export function discreteNestKeys(viz) {
18
+ var disc = viz.schema.discrete;
19
+ if (!disc) return [];
20
+ var keys = [];
21
+ var dynamic = viz;
22
+ for(var _i = 0, _iter = [
23
+ disc,
24
+ "".concat(disc, "2")
25
+ ]; _i < _iter.length; _i++){
26
+ var k = _iter[_i];
27
+ if ("_".concat(k) in viz) keys.push(dynamic["_".concat(k)]);
28
+ else if (typeof viz.schema[k] === "function") keys.push(viz.schema[k]);
29
+ }
30
+ return keys;
31
+ }
32
+ /**
33
+ Maps context-field names to the `this.*` properties downstream
34
+ consumers (`_draw`, drawSteps, component instances, chart subclasses) read.
35
+ Stages with side effects on `this` (the threshold function reading
36
+ `this._drawDepth`, drawSteps reading `this._filteredData`, etc.) require
37
+ this writeback to happen *before* later stages that may invoke them.
38
+ */ var writebackMap = {
39
+ drawDepth: "_drawDepth",
40
+ id: "_id",
41
+ ids: "_ids",
42
+ drawLabel: "_drawLabel",
43
+ timeFilter: "_timeFilter",
44
+ filteredData: "_filteredData",
45
+ legendData: "_legendData"
46
+ };
47
+ /**
48
+ Run a stage pipeline and accumulate the partial outputs into one context.
49
+ */ export function runStages(initial, stages) {
50
+ var ctx = initial;
51
+ var viz = initial.viz;
52
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
53
+ try {
54
+ for(var _iterator = stages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
55
+ var stage = _step.value;
56
+ var partial = stage(ctx);
57
+ ctx = Object.assign({}, ctx, partial);
58
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
59
+ try {
60
+ // Progressive writeback: code that one stage transitively invokes
61
+ // (e.g. Treemap._thresholdFunction reading this._drawDepth) sees the
62
+ // values the prior stage produced. `Object.keys` (not `for...in`) so a
63
+ // stage returning a class-instance partial doesn't leak prototype-bag
64
+ // entries onto viz — parity with runLayout's vizUpdate fix.
65
+ for(var _iterator1 = Object.keys(partial)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
66
+ var key = _step1.value;
67
+ var field = writebackMap[key];
68
+ var value = partial[key];
69
+ if (field && value !== undefined) viz[field] = value;
70
+ }
71
+ } catch (err) {
72
+ _didIteratorError1 = true;
73
+ _iteratorError1 = err;
74
+ } finally{
75
+ try {
76
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
77
+ _iterator1.return();
78
+ }
79
+ } finally{
80
+ if (_didIteratorError1) {
81
+ throw _iteratorError1;
82
+ }
83
+ }
84
+ }
85
+ }
86
+ } catch (err) {
87
+ _didIteratorError = true;
88
+ _iteratorError = err;
89
+ } finally{
90
+ try {
91
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
92
+ _iterator.return();
93
+ }
94
+ } finally{
95
+ if (_didIteratorError) {
96
+ throw _iteratorError;
97
+ }
98
+ }
99
+ }
100
+ return ctx;
101
+ }
102
+
103
+ //# sourceMappingURL=stages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/charts/pipeline/stages.ts"],"sourcesContent":["/**\n `runStages` folds a list of `TransformStage`s into a context, plus the\n `VizContext` / `TransformStage` types they share and `discreteNestKeys`,\n the rollup nest-key helper.\n\n `runStages` is the engine for the per-chart layout stages\n (`applyTreemapLayout` etc.) that `runChartDraw` and the Plot pipeline\n invoke. Its progressive writeback copies each stage's outputs onto\n `this` so downstream consumers read the values the prior stage produced\n (writeback is progressive, not after all stages, because\n `Treemap._thresholdFunction` reads `this._drawDepth` mid-pipeline).\n\n The chart-shell data prep (draw-depth, id accessors, time/user\n filtering, rollup, threshold, large-data adjustment, empty-data\n detection) runs through the imperative `vizPreDrawPure` (see\n `vizPreDrawPure.ts`), which is the single source of truth for it.\n*/\nimport type {DataPoint} from \"@d3plus/data\";\n\nimport type {Axis, TextBox} from \"../../components/index.js\";\nimport type Shape from \"../../shapes/Shape.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\nimport type {VizInstance} from \"../viz/vizTypes.js\";\n\n/** The four configured d3 scales plus their resolved scale-type strings. */\nexport interface PlotScales {\n x: D3Scale;\n y: D3Scale;\n x2: D3Scale;\n y2: D3Scale;\n xScale: string;\n yScale: string;\n x2Scale: string;\n y2Scale: string;\n}\n\n/** Resolved (lower-cased) scale-type strings for each axis. */\nexport interface PlotConfigScales {\n xConfigScale: string;\n yConfigScale: string;\n x2ConfigScale: string;\n y2ConfigScale: string;\n}\n\n/**\n @interface VizContext\n The value that flows through the chart pipeline. Each stage reads from it\n and returns the fields it derives. The runner (`Viz._preDraw`) folds the\n stages together and writes the result back onto the Viz instance so\n consumers (`_draw`, drawSteps, components) see the same shape.\n*/\nexport interface VizContext {\n /**\n The chart instance. Stages read configuration from it. Deliberately\n `any`: this is the pipeline's dynamic bag — stages reach into chart-,\n axis-, and family-specific fields by computed name (`_${axis}Time`,\n `_${o}Config`, …) that a single structural type can't enumerate. Free\n functions that take a single chart use the `VizInstance` contract; this\n bag field stays loose by design (same rationale as `BaseClass.schema`).\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n viz: any;\n // Derived outputs (populated as stages run):\n drawDepth?: number;\n id?: (d: DataPoint, i: number) => unknown;\n ids?: (d: DataPoint, i: number) => string[];\n drawLabel?: (d: DataPoint, i: number, depth?: number) => string;\n timeFilter?: (d: DataPoint, i?: number) => boolean;\n filteredData?: DataPoint[];\n legendData?: DataPoint[];\n /** Adjustments to `viz.schema.shapeConfig` deferred until writeback. */\n shapeConfigOverrides?: {hoverOpacity?: number; duration?: number};\n /** True when no data passes filters and the noData message should display. */\n displayNoData?: boolean;\n /**\n Chart-specific layout output (e.g. Treemap's d3-hierarchy result). Produced\n by `applyTreemapLayout` and consumed by Treemap's `_draw` to drive the\n Rect emit. Generic on purpose — each chart's layout stage shapes it\n (d3-hierarchy nodes, pie arcs, sankey nodes, …); `ChartEmit` narrows it\n to `DataPoint[]` at the emit boundary.\n */\n shapeData?: unknown[];\n /**\n Plot's chart-specific staged outputs. `formatPlotData` produces them;\n downstream Plot stages (and Plot._draw's paint phase) read them.\n */\n plotFormattedData?: Record<string, unknown>[];\n plotAxisData?: Record<string, unknown>[];\n x2Exists?: boolean;\n y2Exists?: boolean;\n /** Closure used by Plot's stacked branch to compute fillerPoint groups. */\n plotStackGroup?: (d: DataPoint, i: number) => string;\n /** Per-axis unique values arrays (output of `computePlotAxisValues`). */\n xData?: unknown[];\n x2Data?: unknown[];\n yData?: unknown[];\n y2Data?: unknown[];\n /** Initial domains from the stacked/non-stacked branch (output of `computePlotInitialDomains`). */\n plotInitialDomains?: Record<string, (number | string | Date)[]>;\n /** Stacked-mode bookkeeping (output of `computePlotInitialDomains`). */\n plotDiscreteKeys?: unknown[];\n plotStackData?: unknown[];\n plotStackKeys?: unknown[];\n /** Final domains after log/baseline adjustments (output of `computePlotScales`). */\n plotDomains?: Record<string, (number | string | Date)[]>;\n /** Four configured d3 scale instances + their scale-type strings. */\n plotScales?: PlotScales;\n plotConfigScales?: PlotConfigScales;\n plotOpps?: {opp?: string; opp2?: string; opps: string[]};\n /** Pre-measured test axes + label-test shapes for `measurePlotLineLabels`. */\n plotTestAxes?: {xTest: Axis; yTest: Axis};\n plotLineLabelTest?: {testLineShape: Shape; testTextBox: TextBox};\n /** Outputs of `measurePlotLineLabels`. */\n plotLabelWidths?: unknown[];\n plotLargestLabel?: number;\n plotXRangeMax?: number;\n /** Outputs of `preparePlotAxisLayout`. */\n plotDefaultConfig?: Record<string, unknown>;\n plotDefaultX2Config?: Record<string, unknown>;\n plotDefaultY2Config?: Record<string, unknown>;\n plotShowX?: boolean;\n plotShowY?: boolean;\n plotYC?: Record<string, unknown>;\n plotBarLabels?: string[];\n plotXTicks?: unknown[] | null;\n plotX2Ticks?: unknown[] | null;\n plotYTicks?: unknown[] | null;\n plotY2Ticks?: unknown[] | null;\n plotXDomain?: (number | string | Date)[];\n plotX2Domain?: (number | string | Date)[];\n plotYDomain?: (number | string | Date)[];\n plotY2Domain?: (number | string | Date)[];\n}\n\n/**\n @type TransformStage\n A pipeline stage: pure function from a context to the fields it derives.\n Stages never mutate the input; the runner merges the returned partial.\n*/\nexport type TransformStage = (ctx: VizContext) => Partial<VizContext>;\n\n/**\n Discrete-axis nest keys for the rollup. Plot stores its discrete accessor\n on `viz._x`/`viz._y`; fluent-schema charts (Radar/RadialMatrix `metric`)\n store it on `viz.schema.<discrete>`. Resolve from either so the rollup\n nests by the discrete dimension regardless of where the accessor lives —\n without it, per-metric rows collapse into one aggregated row per group.\n*/\ntype NestKey = (d: DataPoint, i: number) => DataPoint[keyof DataPoint];\n\nexport function discreteNestKeys(viz: VizInstance): NestKey[] {\n const disc = viz.schema.discrete;\n if (!disc) return [];\n const keys: NestKey[] = [];\n const dynamic = viz as unknown as Record<string, NestKey>;\n for (const k of [disc, `${disc}2`]) {\n if (`_${k}` in viz) keys.push(dynamic[`_${k}`]);\n else if (typeof viz.schema[k] === \"function\") keys.push(viz.schema[k]);\n }\n return keys;\n}\n\n/**\n Maps context-field names to the `this.*` properties downstream\n consumers (`_draw`, drawSteps, component instances, chart subclasses) read.\n Stages with side effects on `this` (the threshold function reading\n `this._drawDepth`, drawSteps reading `this._filteredData`, etc.) require\n this writeback to happen *before* later stages that may invoke them.\n*/\nconst writebackMap: Record<string, string> = {\n drawDepth: \"_drawDepth\",\n id: \"_id\",\n ids: \"_ids\",\n drawLabel: \"_drawLabel\",\n timeFilter: \"_timeFilter\",\n filteredData: \"_filteredData\",\n legendData: \"_legendData\",\n};\n\n/**\n Run a stage pipeline and accumulate the partial outputs into one context.\n*/\nexport function runStages(\n initial: VizContext,\n stages: TransformStage[],\n): VizContext {\n let ctx = initial;\n const viz = initial.viz;\n for (const stage of stages) {\n const partial = stage(ctx);\n ctx = Object.assign({}, ctx, partial);\n // Progressive writeback: code that one stage transitively invokes\n // (e.g. Treemap._thresholdFunction reading this._drawDepth) sees the\n // values the prior stage produced. `Object.keys` (not `for...in`) so a\n // stage returning a class-instance partial doesn't leak prototype-bag\n // entries onto viz — parity with runLayout's vizUpdate fix.\n for (const key of Object.keys(partial)) {\n const field = writebackMap[key];\n const value = (partial as Record<string, unknown>)[key];\n if (field && value !== undefined)\n (viz as unknown as Record<string, unknown>)[field] = value;\n }\n }\n return ctx;\n}\n"],"names":["discreteNestKeys","viz","disc","schema","discrete","keys","dynamic","k","push","writebackMap","drawDepth","id","ids","drawLabel","timeFilter","filteredData","legendData","runStages","initial","stages","ctx","stage","partial","Object","assign","key","field","value","undefined"],"mappings":"AAAA;;;;;;;;;;;;;;;;AAgBA,GAsIA,OAAO,SAASA,iBAAiBC,GAAgB;IAC/C,IAAMC,OAAOD,IAAIE,MAAM,CAACC,QAAQ;IAChC,IAAI,CAACF,MAAM,OAAO,EAAE;IACpB,IAAMG,OAAkB,EAAE;IAC1B,IAAMC,UAAUL;IAChB,gBAAgB,QAAA;QAACC;QAAO,GAAO,OAALA,MAAK;KAAG,OAAlB,mBAAoB;YAAzBK,IAAK;QACd,IAAI,AAAC,IAAK,OAAFA,MAAON,KAAKI,KAAKG,IAAI,CAACF,OAAO,CAAC,AAAC,IAAK,OAAFC,GAAI;aACzC,IAAI,OAAON,IAAIE,MAAM,CAACI,EAAE,KAAK,YAAYF,KAAKG,IAAI,CAACP,IAAIE,MAAM,CAACI,EAAE;IACvE;IACA,OAAOF;AACT;AAEA;;;;;;AAMA,GACA,IAAMI,eAAuC;IAC3CC,WAAW;IACXC,IAAI;IACJC,KAAK;IACLC,WAAW;IACXC,YAAY;IACZC,cAAc;IACdC,YAAY;AACd;AAEA;;AAEA,GACA,OAAO,SAASC,UACdC,OAAmB,EACnBC,MAAwB;IAExB,IAAIC,MAAMF;IACV,IAAMjB,MAAMiB,QAAQjB,GAAG;QAClB,kCAAA,2BAAA;;QAAL,QAAK,YAAekB,2BAAf,SAAA,6BAAA,QAAA,yBAAA,iCAAuB;YAAvB,IAAME,QAAN;YACH,IAAMC,UAAUD,MAAMD;YACtBA,MAAMG,OAAOC,MAAM,CAAC,CAAC,GAAGJ,KAAKE;gBAMxB,mCAAA,4BAAA;;gBALL,kEAAkE;gBAClE,qEAAqE;gBACrE,uEAAuE;gBACvE,sEAAsE;gBACtE,4DAA4D;gBAC5D,QAAK,aAAaC,OAAOlB,IAAI,CAACiB,6BAAzB,UAAA,8BAAA,SAAA,0BAAA,kCAAmC;oBAAnC,IAAMG,MAAN;oBACH,IAAMC,QAAQjB,YAAY,CAACgB,IAAI;oBAC/B,IAAME,QAAQ,AAACL,OAAmC,CAACG,IAAI;oBACvD,IAAIC,SAASC,UAAUC,WACrB,AAAC3B,GAA0C,CAACyB,MAAM,GAAGC;gBACzD;;gBALK;gBAAA;;;yBAAA,8BAAA;wBAAA;;;wBAAA;8BAAA;;;;QAMP;;QAdK;QAAA;;;iBAAA,6BAAA;gBAAA;;;gBAAA;sBAAA;;;;IAeL,OAAOP;AACT"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ `VizContext` — the pipeline-derived state companion to `ResolvedSpec`.
3
+
4
+ This boundary splits a chart's runtime data into two halves:
5
+
6
+ ResolvedSpec <- user config (frozen, immutable; see resolveSpec.ts)
7
+ ↓
8
+ VizContext <- pipeline-derived state (filteredData, drawDepth,
9
+ legendData, _id closures, …)
10
+
11
+ `vizPreDrawPure(spec, prevCtx) → Partial<VizContext>` is the contract:
12
+ given a frozen spec and any prior context, return the keys the stage
13
+ computed. Callers compose this with their `prevCtx` via spread:
14
+
15
+ const next = {...prevCtx, ...vizPreDrawPure(spec, prevCtx)};
16
+
17
+ Same for `vizDrawPure(spec, ctx) → Partial<VizContext>`.
18
+
19
+ The class `Viz._preDraw()` / `Viz._draw()` stay as imperative shims
20
+ that wrap the pure functions + write results back to `this` (for back-
21
+ compat with subclass overrides that read `this._filteredData` etc.).
22
+ Direct callers of the pure functions get the architectural seam.
23
+ */ /**
24
+ The shape of every field vizPreDraw + vizDraw can populate. The
25
+ `Record<string, unknown>` base covers chart-specific stash slots that
26
+ aren't enumerated below; named fields type the common pipeline outputs.
27
+ */ export { };
28
+
29
+ //# sourceMappingURL=vizContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/charts/pipeline/vizContext.ts"],"sourcesContent":["/**\n `VizContext` — the pipeline-derived state companion to `ResolvedSpec`.\n\n This boundary splits a chart's runtime data into two halves:\n\n ResolvedSpec <- user config (frozen, immutable; see resolveSpec.ts)\n ↓\n VizContext <- pipeline-derived state (filteredData, drawDepth,\n legendData, _id closures, …)\n\n `vizPreDrawPure(spec, prevCtx) → Partial<VizContext>` is the contract:\n given a frozen spec and any prior context, return the keys the stage\n computed. Callers compose this with their `prevCtx` via spread:\n\n const next = {...prevCtx, ...vizPreDrawPure(spec, prevCtx)};\n\n Same for `vizDrawPure(spec, ctx) → Partial<VizContext>`.\n\n The class `Viz._preDraw()` / `Viz._draw()` stay as imperative shims\n that wrap the pure functions + write results back to `this` (for back-\n compat with subclass overrides that read `this._filteredData` etc.).\n Direct callers of the pure functions get the architectural seam.\n*/\n\nimport type {DataPoint} from \"@d3plus/data\";\n\n/**\n The shape of every field vizPreDraw + vizDraw can populate. The\n `Record<string, unknown>` base covers chart-specific stash slots that\n aren't enumerated below; named fields type the common pipeline outputs.\n*/\nexport interface VizContext extends Record<string, unknown> {\n /** Effective draw depth (capped to groupBy.length - 1). */\n drawDepth?: number;\n /** Unique-id-per-datum accessor (depth-scoped). */\n id?: (d: DataPoint, i: number) => string | number;\n /** Array-of-ids-per-datum accessor. */\n ids?: (d: DataPoint, i: number) => string[];\n /** Human-readable label-per-datum accessor (handles aggregation labels). */\n drawLabel?: (d: DataPoint, i: number, depth?: number) => string;\n /** Data after filter + timeFilter + threshold are applied. */\n filteredData?: DataPoint[];\n /** Per-id rank order used by legend + treemap label sorting. */\n legendData?: DataPoint[];\n /** Whether a \"no data\" message should currently be visible. */\n noDataMessage?: boolean;\n}\n"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;AAsBA,GAIA;;;;AAIA,GACA,WAeC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ `vizDraw(viz)` — the imperative shim wrapping `vizDrawPure`.
3
+
4
+ The pure function (`vizDrawPure(viz, prevCtx) → Partial<VizDrawCtx>`)
5
+ computes the chart-shell layout — margin deltas + reset signals +
6
+ feature panels — at the outer level. Inner FeatureModule.layout()
7
+ calls still write through to `viz` directly (component mounts,
8
+ intra-feature accessor writes); that's intentional — `vizUpdate` is
9
+ the cross-feature publishing channel, but a feature's OWN intra-body
10
+ state lives on viz directly because the feature's component instance
11
+ (`Legend`, `Timeline`) is a stateful object whose configuration calls
12
+ happen inline.
13
+
14
+ `vizDrawPure` threads its margin accumulator locally and returns the
15
+ per-side deltas in `marginDelta`; it no longer writes `viz._margin`.
16
+ This shim applies those deltas to the instance once, so the
17
+ post-layout consumers (axes, chartGeometry, plotPaint, ensureZoomDom,
18
+ attribution) read the final margin off `viz._margin`.
19
+
20
+ Note: Plot (and other Viz subclasses) OVERRIDE `_draw` and call
21
+ `super._draw(callback)` — that still works through this shim, which
22
+ in turn invokes `vizDraw(this)` with `this` bound to the subclass.
23
+ */ import { vizDrawPure } from "./vizDrawPure.js";
24
+ export function vizDraw(viz) {
25
+ var ctx = vizDrawPure(viz);
26
+ var d = ctx.marginDelta;
27
+ if (d) {
28
+ viz._margin = {
29
+ top: viz._margin.top + d.top,
30
+ right: viz._margin.right + d.right,
31
+ bottom: viz._margin.bottom + d.bottom,
32
+ left: viz._margin.left + d.left
33
+ };
34
+ }
35
+ }
36
+
37
+ //# sourceMappingURL=vizDraw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/charts/pipeline/vizDraw.ts"],"sourcesContent":["\n/**\n `vizDraw(viz)` — the imperative shim wrapping `vizDrawPure`.\n\n The pure function (`vizDrawPure(viz, prevCtx) → Partial<VizDrawCtx>`)\n computes the chart-shell layout — margin deltas + reset signals +\n feature panels — at the outer level. Inner FeatureModule.layout()\n calls still write through to `viz` directly (component mounts,\n intra-feature accessor writes); that's intentional — `vizUpdate` is\n the cross-feature publishing channel, but a feature's OWN intra-body\n state lives on viz directly because the feature's component instance\n (`Legend`, `Timeline`) is a stateful object whose configuration calls\n happen inline.\n\n `vizDrawPure` threads its margin accumulator locally and returns the\n per-side deltas in `marginDelta`; it no longer writes `viz._margin`.\n This shim applies those deltas to the instance once, so the\n post-layout consumers (axes, chartGeometry, plotPaint, ensureZoomDom,\n attribution) read the final margin off `viz._margin`.\n\n Note: Plot (and other Viz subclasses) OVERRIDE `_draw` and call\n `super._draw(callback)` — that still works through this shim, which\n in turn invokes `vizDraw(this)` with `this` bound to the subclass.\n*/\n\nimport {vizDrawPure} from \"./vizDrawPure.js\";\nimport type {VizInstance as Viz} from \"../viz/vizTypes.js\";\n\nexport function vizDraw(viz: Viz): void {\n const ctx = vizDrawPure(viz);\n const d = ctx.marginDelta;\n if (d) {\n viz._margin = {\n top: viz._margin.top + d.top,\n right: viz._margin.right + d.right,\n bottom: viz._margin.bottom + d.bottom,\n left: viz._margin.left + d.left,\n };\n }\n}\n"],"names":["vizDrawPure","vizDraw","viz","ctx","d","marginDelta","_margin","top","right","bottom","left"],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;AAsBA,GAEA,SAAQA,WAAW,QAAO,mBAAmB;AAG7C,OAAO,SAASC,QAAQC,GAAQ;IAC9B,IAAMC,MAAMH,YAAYE;IACxB,IAAME,IAAID,IAAIE,WAAW;IACzB,IAAID,GAAG;QACLF,IAAII,OAAO,GAAG;YACZC,KAAKL,IAAII,OAAO,CAACC,GAAG,GAAGH,EAAEG,GAAG;YAC5BC,OAAON,IAAII,OAAO,CAACE,KAAK,GAAGJ,EAAEI,KAAK;YAClCC,QAAQP,IAAII,OAAO,CAACG,MAAM,GAAGL,EAAEK,MAAM;YACrCC,MAAMR,IAAII,OAAO,CAACI,IAAI,GAAGN,EAAEM,IAAI;QACjC;IACF;AACF"}
@@ -0,0 +1,174 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_without_holes(arr) {
7
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
8
+ }
9
+ function _iterable_to_array(iter) {
10
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
+ }
12
+ function _non_iterable_spread() {
13
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
+ }
15
+ function _to_consumable_array(arr) {
16
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
+ }
18
+ function _unsupported_iterable_to_array(o, minLen) {
19
+ if (!o) return;
20
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
21
+ var n = Object.prototype.toString.call(o).slice(8, -1);
22
+ if (n === "Object" && o.constructor) n = o.constructor.name;
23
+ if (n === "Map" || n === "Set") return Array.from(n);
24
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
25
+ }
26
+ /**
27
+ `vizDrawPure(viz, prevCtx)` — the returning form of `vizDraw`.
28
+
29
+ NAMING CAVEAT: the suffix `Pure` here means **"returns a Partial<
30
+ VizContext> describing the layout intent"**, not "free of side effects
31
+ in the FP sense." The OUTER orchestration (margin computation,
32
+ legendPosition resolution, panel aggregation, reset signals) is pure
33
+ in the returned-ctx sense — its observable output is the ctx. The
34
+ inner `runLayout([features])` calls write through to viz directly:
35
+ - reset writes (`viz._featurePanels = []`, `viz._chartScene = []`,
36
+ `viz._chartTransform = undefined`, `viz._shapes = []`)
37
+ - margin claims (`viz._margin.X += claim.margin.X`) so the next
38
+ runLayout sees the updated margins
39
+ - FeatureModule layouts that mount/measure their components
40
+ These writes are part of the contract: subclasses and feature
41
+ modules consume live viz state during the layout body, and the shim
42
+ pattern (`vizDraw` calling `vizDrawPure`) is what bridges the
43
+ free-function surface to the class instances that still hold the
44
+ components.
45
+
46
+ The shim (`vizDraw`) wraps this and serves as the public surface.
47
+
48
+ Returns a context with:
49
+ - `marginDelta` (top/bottom/left/right) — total added to viz._margin
50
+ - `featurePanels` — final aggregated panel list
51
+ - `resetChartScene`/`resetChartTransform`/`resetShapes` (always true)
52
+ - `legendPosition`/`colorScalePosition` — sanitized values
53
+ */ import { backFeature, colorScaleFeature, legendFeature, runLayout, sanitizePosition, subtitleFeature, timelineFeature, titleFeature, totalFeature } from "../features/features.js";
54
+ import { resolveSpec } from "./resolveSpec.js";
55
+ export function vizDrawPure(viz) {
56
+ var _prevCtx = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
57
+ var _viz__featurePanels;
58
+ var out = {
59
+ resetChartScene: true,
60
+ resetChartTransform: true,
61
+ resetShapes: true,
62
+ marginDelta: {
63
+ top: 0,
64
+ bottom: 0,
65
+ left: 0,
66
+ right: 0
67
+ },
68
+ featurePanels: []
69
+ };
70
+ // Reset side effects before features run. `viz._featurePanels` is a
71
+ // cross-stage accumulator: seeded here, appended to later by the
72
+ // zoomControls feature, and read by Viz.toScene — so it has to live on
73
+ // the instance, not in a local. The shim RE-reads viz._featurePanels
74
+ // into out.featurePanels for callers.
75
+ viz._featurePanels = [];
76
+ viz._chartScene = [];
77
+ viz._chartTransform = undefined;
78
+ viz._shapes = [];
79
+ // Sanitize positions via the shared `sanitizePosition` helper (same
80
+ // function legendFeature / colorScaleFeature use) so the three sites
81
+ // can't drift. One frozen `resolveSpec` snapshot feeds both accessors:
82
+ // the position accessors take the resolved config as their argument, so
83
+ // a single snapshot reflects config once instead of twice.
84
+ var spec = resolveSpec(viz);
85
+ var legendPosition = sanitizePosition(viz.schema.legendPosition.bind(viz)(spec));
86
+ var colorScalePosition = sanitizePosition(viz.schema.colorScalePosition.bind(viz)(spec));
87
+ out.legendPosition = legendPosition;
88
+ out.colorScalePosition = colorScalePosition;
89
+ // `running` is the cross-call margin accumulator, threaded into each
90
+ // runLayout as its baseMargin so features read the live running total via
91
+ // ctx.layoutMargin (not viz._margin). Seeded from viz._margin so the math
92
+ // matches whatever base the instance carried in.
93
+ var running = {
94
+ top: viz._margin.top,
95
+ right: viz._margin.right,
96
+ bottom: viz._margin.bottom,
97
+ left: viz._margin.left
98
+ };
99
+ // Top blocks first (back / title / subtitle / total) so the running
100
+ // margin.top grows BEFORE the left/right legend lays out — the legend
101
+ // positions against it. Title must lay out first or the left legend
102
+ // overlaps the title at y=0.
103
+ var topBlocks = runLayout({
104
+ viz: viz
105
+ }, [
106
+ backFeature,
107
+ titleFeature,
108
+ subtitleFeature,
109
+ totalFeature
110
+ ], running);
111
+ (_viz__featurePanels = viz._featurePanels).push.apply(_viz__featurePanels, _to_consumable_array(topBlocks.panels));
112
+ out.marginDelta.top += topBlocks.margin.top;
113
+ running.top += topBlocks.margin.top;
114
+ var timelineClaim = runLayout({
115
+ viz: viz
116
+ }, [
117
+ timelineFeature
118
+ ], running);
119
+ out.marginDelta.bottom += timelineClaim.margin.bottom;
120
+ running.bottom += timelineClaim.margin.bottom;
121
+ // Left/right legend + colorScale claims. Includes `=== false` (mirrors
122
+ // colorScale below) so a previously-rendered left/right legend tears
123
+ // down its DOM when the user toggles off via `.legendPosition(false)`.
124
+ if (legendPosition === "left" || legendPosition === "right" || legendPosition === false) {
125
+ var claim = runLayout({
126
+ viz: viz
127
+ }, [
128
+ legendFeature
129
+ ], running);
130
+ out.marginDelta.left += claim.margin.left;
131
+ out.marginDelta.right += claim.margin.right;
132
+ running.left += claim.margin.left;
133
+ running.right += claim.margin.right;
134
+ }
135
+ if (colorScalePosition === "left" || colorScalePosition === "right" || colorScalePosition === false) {
136
+ var claim1 = runLayout({
137
+ viz: viz
138
+ }, [
139
+ colorScaleFeature
140
+ ], running);
141
+ out.marginDelta.left += claim1.margin.left;
142
+ out.marginDelta.right += claim1.margin.right;
143
+ running.left += claim1.margin.left;
144
+ running.right += claim1.margin.right;
145
+ }
146
+ // Top/bottom legend + colorScale.
147
+ if (legendPosition === "top" || legendPosition === "bottom") {
148
+ var claim2 = runLayout({
149
+ viz: viz
150
+ }, [
151
+ legendFeature
152
+ ], running);
153
+ out.marginDelta.top += claim2.margin.top;
154
+ out.marginDelta.bottom += claim2.margin.bottom;
155
+ running.top += claim2.margin.top;
156
+ running.bottom += claim2.margin.bottom;
157
+ }
158
+ if (colorScalePosition === "top" || colorScalePosition === "bottom") {
159
+ var claim3 = runLayout({
160
+ viz: viz
161
+ }, [
162
+ colorScaleFeature
163
+ ], running);
164
+ out.marginDelta.top += claim3.margin.top;
165
+ out.marginDelta.bottom += claim3.margin.bottom;
166
+ running.top += claim3.margin.top;
167
+ running.bottom += claim3.margin.bottom;
168
+ }
169
+ // Snapshot final featurePanels onto the returned ctx.
170
+ out.featurePanels = viz._featurePanels.slice();
171
+ return out;
172
+ }
173
+
174
+ //# sourceMappingURL=vizDrawPure.js.map
@@ -0,0 +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 backFeature,\n colorScaleFeature,\n legendFeature,\n runLayout,\n sanitizePosition,\n subtitleFeature,\n timelineFeature,\n titleFeature,\n totalFeature,\n} from \"../features/features.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 (back / title / subtitle / total) so the running\n // margin.top grows BEFORE the left/right legend lays out — the legend\n // positions against it. Title must lay out first or the left legend\n // overlaps the title at y=0.\n const topBlocks = runLayout({viz}, [\n backFeature,\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 // Snapshot final featurePanels onto the returned ctx.\n out.featurePanels = viz._featurePanels.slice();\n\n return out;\n}\n"],"names":["backFeature","colorScaleFeature","legendFeature","runLayout","sanitizePosition","subtitleFeature","timelineFeature","titleFeature","totalFeature","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","slice"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,GAEA,SACEA,WAAW,EACXC,iBAAiB,EACjBC,aAAa,EACbC,SAAS,EACTC,gBAAgB,EAChBC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,YAAY,QACP,0BAA0B;AAEjC,SAAQC,WAAW,QAAO,mBAAmB;AAiB7C,OAAO,SAASC,YACdC,GAAQ;QACRC,WAAAA,iEAAgC,CAAC;QAwDjCD;IAtDA,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,iBAAiBzB,iBACrBO,IAAImB,MAAM,CAACD,cAAc,CAACE,IAAI,CAACpB,KAAKiB;IAEtC,IAAMI,qBAAqB5B,iBACzBO,IAAImB,MAAM,CAACE,kBAAkB,CAACD,IAAI,CAACpB,KAAKiB;IAE1Cf,IAAIgB,cAAc,GAAGA;IACrBhB,IAAImB,kBAAkB,GAAGA;IAEzB,qEAAqE;IACrE,0EAA0E;IAC1E,0EAA0E;IAC1E,iDAAiD;IACjD,IAAMC,UAAU;QACdf,KAAKP,IAAIuB,OAAO,CAAChB,GAAG;QACpBG,OAAOV,IAAIuB,OAAO,CAACb,KAAK;QACxBF,QAAQR,IAAIuB,OAAO,CAACf,MAAM;QAC1BC,MAAMT,IAAIuB,OAAO,CAACd,IAAI;IACxB;IAEA,oEAAoE;IACpE,sEAAsE;IACtE,oEAAoE;IACpE,6BAA6B;IAC7B,IAAMe,YAAYhC,UAAU;QAACQ,KAAAA;IAAG,GAAG;QACjCX;QACAO;QACAF;QACAG;KACD,EAAEyB;IACHtB,CAAAA,sBAAAA,IAAIY,cAAc,EAACa,IAAI,OAAvBzB,qBAAwB,qBAAGwB,UAAUE,MAAM;IAC3CxB,IAAII,WAAW,CAAEC,GAAG,IAAIiB,UAAUG,MAAM,CAACpB,GAAG;IAC5Ce,QAAQf,GAAG,IAAIiB,UAAUG,MAAM,CAACpB,GAAG;IAEnC,IAAMqB,gBAAgBpC,UAAU;QAACQ,KAAAA;IAAG,GAAG;QAACL;KAAgB,EAAE2B;IAC1DpB,IAAII,WAAW,CAAEE,MAAM,IAAIoB,cAAcD,MAAM,CAACnB,MAAM;IACtDc,QAAQd,MAAM,IAAIoB,cAAcD,MAAM,CAACnB,MAAM;IAE7C,uEAAuE;IACvE,qEAAqE;IACrE,uEAAuE;IACvE,IACEU,mBAAmB,UACnBA,mBAAmB,WACnBA,mBAAmB,OACnB;QACA,IAAMW,QAAQrC,UAAU;YAACQ,KAAAA;QAAG,GAAG;YAACT;SAAc,EAAE+B;QAChDpB,IAAII,WAAW,CAAEG,IAAI,IAAIoB,MAAMF,MAAM,CAAClB,IAAI;QAC1CP,IAAII,WAAW,CAAEI,KAAK,IAAImB,MAAMF,MAAM,CAACjB,KAAK;QAC5CY,QAAQb,IAAI,IAAIoB,MAAMF,MAAM,CAAClB,IAAI;QACjCa,QAAQZ,KAAK,IAAImB,MAAMF,MAAM,CAACjB,KAAK;IACrC;IACA,IACEW,uBAAuB,UACvBA,uBAAuB,WACvBA,uBAAuB,OACvB;QACA,IAAMQ,SAAQrC,UAAU;YAACQ,KAAAA;QAAG,GAAG;YAACV;SAAkB,EAAEgC;QACpDpB,IAAII,WAAW,CAAEG,IAAI,IAAIoB,OAAMF,MAAM,CAAClB,IAAI;QAC1CP,IAAII,WAAW,CAAEI,KAAK,IAAImB,OAAMF,MAAM,CAACjB,KAAK;QAC5CY,QAAQb,IAAI,IAAIoB,OAAMF,MAAM,CAAClB,IAAI;QACjCa,QAAQZ,KAAK,IAAImB,OAAMF,MAAM,CAACjB,KAAK;IACrC;IAEA,kCAAkC;IAClC,IAAIQ,mBAAmB,SAASA,mBAAmB,UAAU;QAC3D,IAAMW,SAAQrC,UAAU;YAACQ,KAAAA;QAAG,GAAG;YAACT;SAAc,EAAE+B;QAChDpB,IAAII,WAAW,CAAEC,GAAG,IAAIsB,OAAMF,MAAM,CAACpB,GAAG;QACxCL,IAAII,WAAW,CAAEE,MAAM,IAAIqB,OAAMF,MAAM,CAACnB,MAAM;QAC9Cc,QAAQf,GAAG,IAAIsB,OAAMF,MAAM,CAACpB,GAAG;QAC/Be,QAAQd,MAAM,IAAIqB,OAAMF,MAAM,CAACnB,MAAM;IACvC;IACA,IAAIa,uBAAuB,SAASA,uBAAuB,UAAU;QACnE,IAAMQ,SAAQrC,UAAU;YAACQ,KAAAA;QAAG,GAAG;YAACV;SAAkB,EAAEgC;QACpDpB,IAAII,WAAW,CAAEC,GAAG,IAAIsB,OAAMF,MAAM,CAACpB,GAAG;QACxCL,IAAII,WAAW,CAAEE,MAAM,IAAIqB,OAAMF,MAAM,CAACnB,MAAM;QAC9Cc,QAAQf,GAAG,IAAIsB,OAAMF,MAAM,CAACpB,GAAG;QAC/Be,QAAQd,MAAM,IAAIqB,OAAMF,MAAM,CAACnB,MAAM;IACvC;IAEA,sDAAsD;IACtDN,IAAIS,aAAa,GAAGX,IAAIY,cAAc,CAACkB,KAAK;IAE5C,OAAO5B;AACT"}
@@ -0,0 +1,145 @@
1
+ function _define_property(obj, key, value) {
2
+ if (key in obj) {
3
+ Object.defineProperty(obj, key, {
4
+ value: value,
5
+ enumerable: true,
6
+ configurable: true,
7
+ writable: true
8
+ });
9
+ } else {
10
+ obj[key] = value;
11
+ }
12
+ return obj;
13
+ }
14
+ function _object_spread(target) {
15
+ for(var i = 1; i < arguments.length; i++){
16
+ var source = arguments[i] != null ? arguments[i] : {};
17
+ var ownKeys = Object.keys(source);
18
+ if (typeof Object.getOwnPropertySymbols === "function") {
19
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
20
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
21
+ }));
22
+ }
23
+ ownKeys.forEach(function(key) {
24
+ _define_property(target, key, source[key]);
25
+ });
26
+ }
27
+ return target;
28
+ }
29
+ function ownKeys(object, enumerableOnly) {
30
+ var keys = Object.keys(object);
31
+ if (Object.getOwnPropertySymbols) {
32
+ var symbols = Object.getOwnPropertySymbols(object);
33
+ if (enumerableOnly) {
34
+ symbols = symbols.filter(function(sym) {
35
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
+ });
37
+ }
38
+ keys.push.apply(keys, symbols);
39
+ }
40
+ return keys;
41
+ }
42
+ function _object_spread_props(target, source) {
43
+ source = source != null ? source : {};
44
+ if (Object.getOwnPropertyDescriptors) {
45
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
46
+ } else {
47
+ ownKeys(Object(source)).forEach(function(key) {
48
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
49
+ });
50
+ }
51
+ return target;
52
+ }
53
+ /**
54
+ `vizPreDraw(viz)` — the imperative shim wrapping `vizPreDrawPure`.
55
+
56
+ The pure function (`vizPreDrawPure(viz, prevCtx) → Partial<VizContext>`)
57
+ computes the data-prep results without mutating viz. This shim:
58
+ 1. calls the pure function;
59
+ 2. writes the returned ctx fields back to viz (so subclass methods
60
+ that read `this._drawDepth` / `this._filteredData` see them);
61
+ 3. invokes `viz._thresholdFunction(filteredData, tree)` — this is
62
+ an instance method that needs `this`-bound state populated by
63
+ step 2;
64
+ 4. recomputes hover-cutoff overrides + no-data flag against the
65
+ threshold-applied data (via `vizPostThresholdCtx`);
66
+ 5. applies the deferred DOM side effects (no-data message mount,
67
+ opacity fade).
68
+
69
+ `Viz._preDraw()` calls this shim so subclass overrides + the existing
70
+ test surface remain unchanged. Direct consumers of the architectural
71
+ seam should use `vizPreDrawPure` (exported from the package index).
72
+ */ import { vizPostThresholdCtx, vizPreDrawPure } from "./vizPreDrawPure.js";
73
+ import { configureOrdinalColor } from "../viz/ordinalColor.js";
74
+ /** Whether the shapeConfig enables a persistent trail (a positive count or `true`). */ function hasPersistentTrail(sc) {
75
+ var on = function on(v) {
76
+ return v === true || typeof v === "number" && v > 0;
77
+ };
78
+ var shape = function shape(k) {
79
+ var _sc_k;
80
+ return sc === null || sc === void 0 ? void 0 : (_sc_k = sc[k]) === null || _sc_k === void 0 ? void 0 : _sc_k.trailPersist;
81
+ };
82
+ return !!sc && (on(sc.trailPersist) || on(shape("Circle")) || on(shape("Rect")));
83
+ }
84
+ export function vizPreDraw(viz) {
85
+ var _post_hoverOverride, _post_hoverOverride1;
86
+ var ctx = vizPreDrawPure(viz);
87
+ // 1. Write computed ctx back to viz.
88
+ if (ctx.drawDepth !== undefined) viz._drawDepth = ctx.drawDepth;
89
+ if (ctx.id) viz._id = ctx.id;
90
+ if (ctx.ids) viz._ids = ctx.ids;
91
+ if (ctx.drawLabel) viz._drawLabel = ctx.drawLabel;
92
+ if (ctx.legendData !== undefined) viz._legendData = ctx.legendData;
93
+ // 1b. A persistent trail only stays coherent with fixed axes (so committed
94
+ // segments don't drift as the domain shifts) and a single-period timeline (so
95
+ // the forward/backward step logic has one current time). Turn both on
96
+ // automatically when `trailPersist` is set, so callers don't have to know.
97
+ if (hasPersistentTrail(viz.schema.shapeConfig)) {
98
+ viz._axisPersist = true;
99
+ viz.schema.timelineConfig = _object_spread_props(_object_spread({}, viz.schema.timelineConfig || {}), {
100
+ brushing: false
101
+ });
102
+ }
103
+ // 2. computedTimeFilter — surfaced on the ctx for downstream consumers
104
+ // (rollupAndFilter etc.) but NOT back-assigned to `viz.schema.timeFilter`.
105
+ // Back-assigning would pin the synthesized filter (which captures
106
+ // `latestTime` at synthesis time) to the viz, so a subsequent render
107
+ // with newer data would skip re-synthesis and silently filter
108
+ // post-latestTime rows out. The pure function consumes its own
109
+ // computedTimeFilter for filteredData; `viz.schema.timeFilter`
110
+ // reflects the user's value (truthy) or undefined.
111
+ // 3. filteredData — pre-threshold from pure, then run threshold (which
112
+ // reads this.schema.aggs/_drawDepth/_groupBy via the instance method).
113
+ var filteredData = ctx.filteredData || [];
114
+ if (viz._data.length && ctx._thresholdTree) {
115
+ filteredData = viz._thresholdFunction(filteredData, ctx._thresholdTree);
116
+ }
117
+ viz._filteredData = filteredData;
118
+ // 3b. Ordinal color mode: build the single-hue ramp scale from the distinct
119
+ // values of the drawn data (a no-op when colorOrdinal is off).
120
+ configureOrdinalColor(viz);
121
+ // 4. hover/duration override + noDataMessage flag — computed against
122
+ // the post-threshold filteredData.
123
+ var post = vizPostThresholdCtx(viz, filteredData, viz._id);
124
+ if ((_post_hoverOverride = post.hoverOverride) === null || _post_hoverOverride === void 0 ? void 0 : _post_hoverOverride.stashOriginals) {
125
+ if (viz._userHover === undefined) viz._userHover = viz.schema.shapeConfig.hoverOpacity || 0.5;
126
+ if (viz._userDuration === undefined) viz._userDuration = viz.schema.shapeConfig.duration || 600;
127
+ viz.schema.shapeConfig.hoverOpacity = post.hoverOverride.hoverOpacity;
128
+ viz.schema.shapeConfig.duration = post.hoverOverride.duration;
129
+ } else if ((_post_hoverOverride1 = post.hoverOverride) === null || _post_hoverOverride1 === void 0 ? void 0 : _post_hoverOverride1.restoreOriginals) {
130
+ viz.schema.shapeConfig.hoverOpacity = post.hoverOverride.hoverOpacity;
131
+ viz.schema.shapeConfig.duration = post.hoverOverride.duration;
132
+ }
133
+ // 5. No-data-message DOM mount + opacity fade.
134
+ if (post.noDataMessage) {
135
+ viz._messageClass.render({
136
+ container: viz._select.node().parentNode,
137
+ html: viz.schema.noDataHTML(viz),
138
+ mask: false,
139
+ style: viz.schema.messageStyle
140
+ });
141
+ viz._select.transition().duration(viz.schema.duration).attr("opacity", 0);
142
+ }
143
+ }
144
+
145
+ //# sourceMappingURL=vizPreDraw.js.map