@d3plus/core 3.1.6 → 4.1.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 +9924 -78528
  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 +655 -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 +84 -35
  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 +125 -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 +15 -10
  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 +157 -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 +270 -15
  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 +30966 -19051
  501. package/umd/d3plus-core.full.js.map +1 -1
  502. package/umd/d3plus-core.full.min.js +5400 -2949
  503. package/umd/d3plus-core.js +17364 -10534
  504. package/umd/d3plus-core.js.map +1 -1
  505. package/umd/d3plus-core.min.js +3494 -1877
  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
@@ -1,3 +1,14 @@
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_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
+ }
1
12
  function _assert_this_initialized(self) {
2
13
  if (self === void 0) {
3
14
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -40,6 +51,22 @@ function _define_property(obj, key, value) {
40
51
  }
41
52
  return obj;
42
53
  }
54
+ function _get(target, property, receiver) {
55
+ if (typeof Reflect !== "undefined" && Reflect.get) {
56
+ _get = Reflect.get;
57
+ } else {
58
+ _get = function get(target, property, receiver) {
59
+ var base = _super_prop_base(target, property);
60
+ if (!base) return;
61
+ var desc = Object.getOwnPropertyDescriptor(base, property);
62
+ if (desc.get) {
63
+ return desc.get.call(receiver || target);
64
+ }
65
+ return desc.value;
66
+ };
67
+ }
68
+ return _get(target, property, receiver || target);
69
+ }
43
70
  function _get_prototype_of(o) {
44
71
  _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
45
72
  return o.__proto__ || Object.getPrototypeOf(o);
@@ -59,13 +86,77 @@ function _inherits(subClass, superClass) {
59
86
  });
60
87
  if (superClass) _set_prototype_of(subClass, superClass);
61
88
  }
62
- function _instanceof(left, right) {
63
- "@swc/helpers - instanceof";
64
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
65
- return !!right[Symbol.hasInstance](left);
89
+ function _iterable_to_array(iter) {
90
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
91
+ }
92
+ function _iterable_to_array_limit(arr, i) {
93
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
94
+ if (_i == null) return;
95
+ var _arr = [];
96
+ var _n = true;
97
+ var _d = false;
98
+ var _s, _e;
99
+ try {
100
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
101
+ _arr.push(_s.value);
102
+ if (i && _arr.length === i) break;
103
+ }
104
+ } catch (err) {
105
+ _d = true;
106
+ _e = err;
107
+ } finally{
108
+ try {
109
+ if (!_n && _i["return"] != null) _i["return"]();
110
+ } finally{
111
+ if (_d) throw _e;
112
+ }
113
+ }
114
+ return _arr;
115
+ }
116
+ function _non_iterable_rest() {
117
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
118
+ }
119
+ function _non_iterable_spread() {
120
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
121
+ }
122
+ function _object_spread(target) {
123
+ for(var i = 1; i < arguments.length; i++){
124
+ var source = arguments[i] != null ? arguments[i] : {};
125
+ var ownKeys = Object.keys(source);
126
+ if (typeof Object.getOwnPropertySymbols === "function") {
127
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
128
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
129
+ }));
130
+ }
131
+ ownKeys.forEach(function(key) {
132
+ _define_property(target, key, source[key]);
133
+ });
134
+ }
135
+ return target;
136
+ }
137
+ function ownKeys(object, enumerableOnly) {
138
+ var keys = Object.keys(object);
139
+ if (Object.getOwnPropertySymbols) {
140
+ var symbols = Object.getOwnPropertySymbols(object);
141
+ if (enumerableOnly) {
142
+ symbols = symbols.filter(function(sym) {
143
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
144
+ });
145
+ }
146
+ keys.push.apply(keys, symbols);
147
+ }
148
+ return keys;
149
+ }
150
+ function _object_spread_props(target, source) {
151
+ source = source != null ? source : {};
152
+ if (Object.getOwnPropertyDescriptors) {
153
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
66
154
  } else {
67
- return left instanceof right;
155
+ ownKeys(Object(source)).forEach(function(key) {
156
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
157
+ });
68
158
  }
159
+ return target;
69
160
  }
70
161
  function _possible_constructor_return(self, call) {
71
162
  if (call && (_type_of(call) === "object" || typeof call === "function")) {
@@ -80,10 +171,31 @@ function _set_prototype_of(o, p) {
80
171
  };
81
172
  return _set_prototype_of(o, p);
82
173
  }
174
+ function _sliced_to_array(arr, i) {
175
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
176
+ }
177
+ function _super_prop_base(object, property) {
178
+ while(!Object.prototype.hasOwnProperty.call(object, property)){
179
+ object = _get_prototype_of(object);
180
+ if (object === null) break;
181
+ }
182
+ return object;
183
+ }
184
+ function _to_consumable_array(arr) {
185
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
186
+ }
83
187
  function _type_of(obj) {
84
188
  "@swc/helpers - typeof";
85
189
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
86
190
  }
191
+ function _unsupported_iterable_to_array(o, minLen) {
192
+ if (!o) return;
193
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
194
+ var n = Object.prototype.toString.call(o).slice(8, -1);
195
+ if (n === "Object" && o.constructor) n = o.constructor.name;
196
+ if (n === "Map" || n === "Set") return Array.from(n);
197
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
198
+ }
87
199
  function _is_native_reflect_construct() {
88
200
  try {
89
201
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
@@ -92,37 +204,199 @@ function _is_native_reflect_construct() {
92
204
  return !!result;
93
205
  })();
94
206
  }
95
- import { min } from "d3-array";
96
207
  import { color } from "d3-color";
97
- import { pointer, select, selectAll } from "d3-selection";
98
- import * as paths from "d3-shape";
99
- import { transition } from "d3-transition";
100
- import textures from "textures";
208
+ import { select } from "d3-selection";
101
209
  import { colorContrast } from "@d3plus/color";
102
- import { unique } from "@d3plus/data";
103
- import { assign, attrize, elem, isObject } from "@d3plus/dom";
104
- import { pointDistance } from "@d3plus/math";
105
- import { strip } from "@d3plus/text";
210
+ import { assign, getSize, isObject } from "@d3plus/dom";
211
+ import { SvgRenderer } from "@d3plus/render";
106
212
  import { TextBox } from "../components/index.js";
107
- import { accessor, BaseClass, configPrep, constant } from "../utils/index.js";
108
- /**
109
- * @param {*} nodeList
110
- * @param {*} classNames
111
- * @private
112
- */ function findLastIndexWithClass(nodeList, classNames) {
113
- for(var x = 0; x < classNames.length; x++){
114
- var className = classNames[x];
115
- for(var i = nodeList.length - 1; i >= 0; i--){
116
- // Iterate backwards
117
- if (nodeList[i].classList.contains(className)) {
118
- // Check for the class
119
- return i; // Return the index if found
120
- }
121
- }
122
- }
123
- return -1; // Return -1 if no element is found with the class
213
+ import { accessor, BaseClass, constant } from "../utils/index.js";
214
+ import { installFluent } from "../fluent.js";
215
+ import { buildLabelData } from "./buildLabelData.js";
216
+ import { hitAreaNode } from "./hitAreaNode.js";
217
+ /** Coerces a value to a finite number, or undefined. @private */ export function numOrUndef(v) {
218
+ var n = Number(v);
219
+ return Number.isFinite(n) ? n : undefined;
220
+ }
221
+ /** Returns a non-empty string, or undefined. @private */ export function strOrUndef(v) {
222
+ return v == null || v === "" ? undefined : String(v);
223
+ }
224
+ /** Parses an SVG stroke-dasharray value into an array of numbers. @private */ export function parseDash(v) {
225
+ if (v == null || v === "none" || v === "") return undefined;
226
+ if (typeof v === "number") return [
227
+ v
228
+ ];
229
+ var parts = String(v).split(/[\s,]+/).map(Number).filter(function(n) {
230
+ return Number.isFinite(n);
231
+ });
232
+ return parts.length ? parts : undefined;
124
233
  }
125
234
  import Image from "./Image.js";
235
+ import { emitBackgroundImages, sortRanks } from "./sceneSort.js";
236
+ /** Shape's fluent accessor schema. Config storage lives on `this.schema.<key>`. */ var shapeSchema = [
237
+ {
238
+ key: "activeOpacity",
239
+ coerce: "identity",
240
+ default: 0.25
241
+ },
242
+ {
243
+ key: "ariaLabel",
244
+ coerce: "const",
245
+ default: constant("")
246
+ },
247
+ {
248
+ key: "backgroundImage",
249
+ coerce: "const",
250
+ default: constant(false)
251
+ },
252
+ {
253
+ key: "discrete",
254
+ coerce: "identity"
255
+ },
256
+ {
257
+ key: "duration",
258
+ coerce: "identity",
259
+ default: 600
260
+ },
261
+ {
262
+ key: "fill",
263
+ coerce: "const",
264
+ default: constant("black")
265
+ },
266
+ {
267
+ key: "fillOpacity",
268
+ coerce: "const",
269
+ default: constant(1)
270
+ },
271
+ {
272
+ key: "hitArea",
273
+ coerce: "const"
274
+ },
275
+ {
276
+ key: "hoverOpacity",
277
+ coerce: "identity",
278
+ default: 0.5
279
+ },
280
+ {
281
+ key: "id",
282
+ coerce: "accessor",
283
+ default: function _default(d, i) {
284
+ return d.id !== void 0 ? d.id : i;
285
+ }
286
+ },
287
+ {
288
+ key: "label",
289
+ coerce: "const",
290
+ default: constant(false)
291
+ },
292
+ {
293
+ key: "labelBounds",
294
+ coerce: "const"
295
+ },
296
+ {
297
+ key: "opacity",
298
+ coerce: "const",
299
+ default: constant(1)
300
+ },
301
+ {
302
+ key: "pointerEvents",
303
+ coerce: "const",
304
+ default: constant("visiblePainted")
305
+ },
306
+ {
307
+ key: "renderMode",
308
+ coerce: "identity",
309
+ default: "full"
310
+ },
311
+ {
312
+ key: "role",
313
+ coerce: "const",
314
+ default: constant("presentation")
315
+ },
316
+ {
317
+ key: "rotate",
318
+ coerce: "const",
319
+ default: constant(0)
320
+ },
321
+ {
322
+ key: "rx",
323
+ coerce: "const",
324
+ default: constant(0)
325
+ },
326
+ {
327
+ key: "ry",
328
+ coerce: "const",
329
+ default: constant(0)
330
+ },
331
+ {
332
+ key: "scale",
333
+ coerce: "const",
334
+ default: constant(1)
335
+ },
336
+ {
337
+ key: "shapeRendering",
338
+ coerce: "const",
339
+ default: constant("geometricPrecision")
340
+ },
341
+ {
342
+ key: "stroke",
343
+ coerce: "const"
344
+ },
345
+ {
346
+ key: "strokeDasharray",
347
+ coerce: "const",
348
+ default: constant("0")
349
+ },
350
+ {
351
+ key: "strokeLinecap",
352
+ coerce: "const",
353
+ default: constant("butt")
354
+ },
355
+ {
356
+ key: "strokeOpacity",
357
+ coerce: "const",
358
+ default: constant(1)
359
+ },
360
+ {
361
+ key: "strokeWidth",
362
+ coerce: "const",
363
+ default: constant(0)
364
+ },
365
+ {
366
+ key: "textAnchor",
367
+ coerce: "const",
368
+ default: constant("start")
369
+ },
370
+ {
371
+ key: "texture",
372
+ coerce: "const",
373
+ default: constant(false)
374
+ },
375
+ {
376
+ key: "vectorEffect",
377
+ coerce: "const",
378
+ default: constant("non-scaling-stroke")
379
+ },
380
+ {
381
+ key: "verticalAlign",
382
+ coerce: "const",
383
+ default: constant("top")
384
+ },
385
+ // "accessor" (not "const"): a string names a data key (`.x("year")`), a
386
+ // number is a constant (`.x(50)`), and a function passes through — so a
387
+ // standalone shape given string accessors (as the pipeline never does, but
388
+ // direct users do) reads the field instead of treating "x" as the literal.
389
+ {
390
+ key: "x",
391
+ coerce: "accessor",
392
+ default: accessor("x", 0)
393
+ },
394
+ {
395
+ key: "y",
396
+ coerce: "accessor",
397
+ default: accessor("y", 0)
398
+ }
399
+ ];
126
400
  var Shape = /*#__PURE__*/ function(BaseClass) {
127
401
  "use strict";
128
402
  _inherits(Shape, BaseClass);
@@ -130,81 +404,76 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
130
404
  var tagName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "g";
131
405
  _class_call_check(this, Shape);
132
406
  var _this;
133
- _this = _call_super(this, Shape), _define_property(_this, "_activeOpacity", void 0), _define_property(_this, "_activeStyle", void 0), _define_property(_this, "_ariaLabel", void 0), _define_property(_this, "_backgroundImage", void 0), _define_property(_this, "_backgroundImageClass", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_duration", void 0), _define_property(_this, "_fill", void 0), _define_property(_this, "_fillOpacity", void 0), _define_property(_this, "_hoverOpacity", void 0), _define_property(_this, "_hoverStyle", void 0), _define_property(_this, "_id", void 0), _define_property(_this, "_label", void 0), _define_property(_this, "_labelClass", void 0), _define_property(_this, "_labelConfig", void 0), _define_property(_this, "_labelBounds", void 0), _define_property(_this, "_name", void 0), _define_property(_this, "_opacity", void 0), _define_property(_this, "_pointerEvents", void 0), _define_property(_this, "_role", void 0), _define_property(_this, "_rotate", void 0), _define_property(_this, "_rx", void 0), _define_property(_this, "_ry", void 0), _define_property(_this, "_scale", void 0), _define_property(_this, "_shapeRendering", void 0), _define_property(_this, "_stroke", void 0), _define_property(_this, "_strokeDasharray", void 0), _define_property(_this, "_strokeLinecap", void 0), _define_property(_this, "_strokeOpacity", void 0), _define_property(_this, "_strokeWidth", void 0), _define_property(_this, "_tagName", void 0), _define_property(_this, "_textAnchor", void 0), _define_property(_this, "_texture", void 0), _define_property(_this, "_textureDefault", void 0), _define_property(_this, "_textureDefs", void 0), _define_property(_this, "_vectorEffect", void 0), _define_property(_this, "_verticalAlign", void 0), _define_property(_this, "_x", void 0), _define_property(_this, "_y", void 0), _define_property(_this, "_select", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_sort", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_update", void 0), _define_property(_this, "_enter", void 0), _define_property(_this, "_exit", void 0), _define_property(_this, "_hoverGroup", void 0), _define_property(_this, "_activeGroup", void 0), _define_property(_this, "_hitArea", void 0), _define_property(_this, "_active", void 0), _define_property(_this, "_hover", void 0), _define_property(_this, "_discrete", void 0), _define_property(_this, "_path", void 0), _define_property(_this, "_defined", void 0), _define_property(_this, "_curve", void 0);
134
- _this._activeOpacity = 0.25;
135
- _this._activeStyle = {
407
+ _this = _call_super(this, Shape), _define_property(_this, "_backgroundImageClass", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_labelClass", void 0), _define_property(_this, "_name", void 0), _define_property(_this, "_tagName", void 0), _define_property(_this, "_textureDefs", void 0), _define_property(_this, "_select", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_update", void 0), _define_property(_this, "_enter", void 0), _define_property(_this, "_exit", void 0), _define_property(_this, "_hoverGroup", void 0), _define_property(_this, "_activeGroup", void 0), _define_property(_this, "_path", void 0), /** SvgRenderer mounted by the standalone `render()` path; reused across redraws. */ _define_property(_this, "_sceneRenderer", void 0);
408
+ installFluent(_this, shapeSchema);
409
+ _this._backgroundImageClass = new Image();
410
+ _this._data = [];
411
+ _this._labelClass = new TextBox();
412
+ _this._name = "Shape";
413
+ _this._tagName = tagName;
414
+ _this._textureDefs = {};
415
+ // stroke defaults to a darker shade of fill — closes over `this.schema`
416
+ // so it tracks the current fill accessor. A fill that doesn't parse as a
417
+ // color (e.g. "none"/"transparent", a gradient token) has no darker shade,
418
+ // so fall back to the fill value itself.
419
+ _this.schema.stroke = function(d, i) {
420
+ var c = color(_this.schema.fill(d, i));
421
+ return c ? c.darker(1).formatHex() : _this.schema.fill(d, i);
422
+ };
423
+ _this.schema.activeStyle = {
136
424
  stroke: function stroke(d, i) {
137
- var c = _this._fill(d, i);
425
+ var c = _this.schema.fill(d, i);
138
426
  if ([
139
427
  "transparent",
140
428
  "none"
141
- ].includes(c)) c = _this._stroke(d, i);
142
- return color(c).darker(1);
429
+ ].includes(c)) c = _this.schema.stroke(d, i);
430
+ var col = color(c);
431
+ return col ? col.darker(1) : c;
143
432
  },
144
433
  "stroke-width": function(d, i) {
145
- var s = _this._strokeWidth(d, i) || 1;
434
+ var s = _this.schema.strokeWidth(d, i) || 1;
146
435
  return s * 3;
147
436
  }
148
437
  };
149
- _this._ariaLabel = constant("");
150
- _this._backgroundImage = constant(false);
151
- _this._backgroundImageClass = new Image();
152
- _this._data = [];
153
- _this._duration = 600;
154
- _this._fill = constant("black");
155
- _this._fillOpacity = constant(1);
156
- _this._hoverOpacity = 0.5;
157
- _this._hoverStyle = {
438
+ _this.schema.hoverStyle = {
158
439
  stroke: function stroke(d, i) {
159
- var c = _this._fill(d, i);
440
+ var c = _this.schema.fill(d, i);
160
441
  if ([
161
442
  "transparent",
162
443
  "none"
163
- ].includes(c)) c = _this._stroke(d, i);
164
- return color(c).darker(0.5);
444
+ ].includes(c)) c = _this.schema.stroke(d, i);
445
+ var col = color(c);
446
+ return col ? col.darker(0.5) : c;
165
447
  },
166
448
  "stroke-width": function(d, i) {
167
- var s = _this._strokeWidth(d, i) || 1;
449
+ var s = _this.schema.strokeWidth(d, i) || 1;
168
450
  return s * 2;
169
451
  }
170
452
  };
171
- _this._id = function(d, i) {
172
- return d.id !== void 0 ? d.id : i;
173
- };
174
- _this._label = constant(false);
175
- _this._labelClass = new TextBox();
176
- _this._labelConfig = {
453
+ // Shape's label defaults. These are pushed to `_labelClass` via
454
+ // `_labelClass.config(this.schema.labelConfig)` in render() so the
455
+ // TextBox actually picks them up.
456
+ // textAnchor defaults to "start" (left-aligned) — Treemap, Pie,
457
+ // etc. rely on this. Bar overrides to "middle" in its constructor.
458
+ _this.schema.labelConfig = {
177
459
  fontColor: function fontColor(d, i) {
178
- return colorContrast(_this._fill(d, i));
460
+ return colorContrast(_this.schema.fill(d, i));
461
+ },
462
+ // Fade labels with their shape's opacity (e.g. an axis tick label hides
463
+ // when `shapeConfig.opacity` is 0). Reads `this.schema.opacity` live —
464
+ // like `fontColor` reads `fill` — which unwraps nested label data.
465
+ fontOpacity: function fontOpacity(d, i) {
466
+ return _this.schema.opacity(d, i);
179
467
  },
468
+ fontResize: true,
469
+ fontMax: 50,
470
+ fontMin: 8,
180
471
  fontSize: 12,
181
- padding: 5
182
- };
183
- _this._name = "Shape";
184
- _this._opacity = constant(1);
185
- _this._pointerEvents = constant("visiblePainted");
186
- _this._role = constant("presentation");
187
- _this._rotate = constant(0);
188
- _this._rx = constant(0);
189
- _this._ry = constant(0);
190
- _this._scale = constant(1);
191
- _this._shapeRendering = constant("geometricPrecision");
192
- _this._stroke = function(d, i) {
193
- return color(_this._fill(d, i)).darker(1).formatHex();
472
+ padding: 5,
473
+ textAnchor: "start",
474
+ verticalAlign: "top"
194
475
  };
195
- _this._strokeDasharray = constant("0");
196
- _this._strokeLinecap = constant("butt");
197
- _this._strokeOpacity = constant(1);
198
- _this._strokeWidth = constant(0);
199
- _this._tagName = tagName;
200
- _this._textAnchor = constant("start");
201
- _this._texture = constant(false);
202
- _this._textureDefault = {};
203
- _this._textureDefs = {};
204
- _this._vectorEffect = constant("non-scaling-stroke");
205
- _this._verticalAlign = constant("top");
206
- _this._x = accessor("x", 0);
207
- _this._y = accessor("y", 0);
476
+ _this.schema.textureDefault = {};
208
477
  return _this;
209
478
  }
210
479
  _create_class(Shape, [
@@ -220,117 +489,13 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
220
489
  },
221
490
  {
222
491
  /**
223
- Adds event listeners to each shape group or hit area.
224
- @private
225
- */ key: "_applyEvents",
226
- value: function _applyEvents(handler) {
227
- var _loop = function(e) {
228
- handler.on(events[e], function(event, d) {
229
- var i = 0;
230
- if (!_this._on[events[e]]) return;
231
- if (d.i !== void 0) i = d.i;
232
- if (d.nested && d.values) {
233
- var calcPoint = function calcPoint(d, i) {
234
- if (_this._discrete === "x") return [
235
- _this._x(d, i),
236
- cursor[1]
237
- ];
238
- else if (_this._discrete === "y") return [
239
- cursor[0],
240
- _this._y(d, i)
241
- ];
242
- else return [
243
- _this._x(d, i),
244
- _this._y(d, i)
245
- ];
246
- };
247
- var cursor = pointer(event, _this._select.node()), values = d.values.map(function(d) {
248
- return pointDistance(cursor, calcPoint(d, i));
249
- });
250
- i = values.indexOf(min(values));
251
- d = d.values[i];
252
- }
253
- _this._on[events[e]].bind(_this)(d, i, undefined, event);
254
- });
255
- };
256
- var _this = this;
257
- var events = Object.keys(this._on);
258
- for(var e = 0; e < events.length; e++)_loop(e);
259
- }
260
- },
261
- {
262
- /**
263
- Provides the updated styling to the given shape elements.
264
-
265
- @private
266
- */ key: "_updateStyle",
267
- value: function _updateStyle(elem, style) {
268
- var that = this;
269
- if (elem.size() && elem.node().tagName === "g") elem = elem.selectAll("*");
270
- /**
271
- Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
272
- @param d data point
273
- @param i index
274
- @private
275
- */ function styleLogic(d, i) {
276
- return typeof this !== "function" ? this : d.nested && d.key && d.values ? this(d.values[0], that._data.indexOf(d.values[0])) : this(d, i);
277
- }
278
- var styleObject = {};
279
- for(var key in style){
280
- if (({}).hasOwnProperty.call(style, key)) {
281
- styleObject[key] = styleLogic.bind(style[key]);
282
- }
283
- }
284
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
285
- elem.transition().duration(0).call(attrize, styleObject);
286
- }
287
- },
288
- {
289
- /**
290
- Provides the default styling to the shape elements.
291
- @param elem @private
292
- */ key: "_applyStyle",
293
- value: function _applyStyle(elem) {
294
- var _this = this;
295
- var that = this;
296
- if (elem.size() && elem.node().tagName === "g") elem = elem.selectAll("*");
297
- /**
298
- Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
299
- @param d data point
300
- @param i index
301
- @private
302
- */ function styleLogic(d, i) {
303
- return typeof this !== "function" ? this : d.nested && d.key && d.values ? this(d.values[0], that._data.indexOf(d.values[0])) : this(d, i);
304
- }
305
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
306
- elem.attr("fill", function(d, i) {
307
- var texture = _this._getTextureKey.bind(_this)(d, i);
308
- return texture ? _this._textureDefs[texture].url() : styleLogic.bind(_this._fill)(d, i);
309
- }).attr("fill-opacity", styleLogic.bind(this._fillOpacity)).attr("rx", styleLogic.bind(this._rx)).attr("ry", styleLogic.bind(this._ry)).attr("stroke", styleLogic.bind(this._stroke)).attr("stroke-dasharray", styleLogic.bind(this._strokeDasharray)).attr("stroke-linecap", styleLogic.bind(this._strokeLinecap)).attr("stroke-opacity", styleLogic.bind(this._strokeOpacity)).attr("stroke-width", styleLogic.bind(this._strokeWidth)).attr("vector-effect", styleLogic.bind(this._vectorEffect));
310
- }
311
- },
312
- {
313
- /**
314
- Calculates the transform for the group elements.
315
- @param elem @private
316
- */ key: "_applyTransform",
317
- value: function _applyTransform(elem) {
318
- var _this = this;
319
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
320
- elem.attr("transform", function(d, i) {
321
- return "\n translate(".concat(d.__d3plusShape__ ? d.translate ? d.translate : "".concat(_this._x(d.data, d.i), ",").concat(_this._y(d.data, d.i)) : "".concat(_this._x(d, i), ",").concat(_this._y(d, i)), ")\n scale(").concat(d.__d3plusShape__ ? d.scale || _this._scale(d.data, d.i) : _this._scale(d, i), ")\n rotate(").concat(d.__d3plusShape__ ? d.rotate ? d.rotate : _this._rotate(d.data || d, d.i) : _this._rotate(d.data || d, d.i), ")");
322
- });
323
- }
324
- },
325
- {
326
- /**
327
492
  Returns a full JSON string of the texture config for a given data point.
328
493
 
329
494
  @private
330
495
  */ key: "_getTextureKey",
331
496
  value: function _getTextureKey(d, i) {
332
497
  var _this = this;
333
- var textureVal = this._texture(d, i);
498
+ var textureVal = this.schema.texture(d, i);
334
499
  if (!textureVal) return false;
335
500
  /**
336
501
  Determines whether a shape is a nested collection of data points, and uses the appropriate data and index for the given function context.
@@ -338,14 +503,14 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
338
503
  */ var styleLogic = function styleLogic(_) {
339
504
  return typeof _ !== "function" ? _ : d.nested && d.key && d.values ? _(d.values[0], _this._data.indexOf(d.values[0])) : _(d, i);
340
505
  };
341
- var fallback = this._textureDefault;
506
+ var fallback = this.schema.textureDefault;
342
507
  var texture;
343
508
  if (!isObject(textureVal)) texture = {
344
509
  texture: textureVal
345
510
  };
346
511
  else texture = textureVal;
347
- if (!texture.background) texture.background = styleLogic(this._fill);
348
- if (!texture.stroke && !fallback.stroke) texture.stroke = styleLogic(this._stroke);
512
+ if (!texture.background) texture.background = styleLogic(this.schema.fill);
513
+ if (!texture.stroke && !fallback.stroke) texture.stroke = styleLogic(this.schema.stroke);
349
514
  var pathNames = [
350
515
  "squares",
351
516
  "nylon",
@@ -386,359 +551,335 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
386
551
  },
387
552
  {
388
553
  /**
389
- Modifies existing shapes to show active status.
554
+ Adds labels to each shape group.
390
555
  @private
391
- */ key: "_renderActive",
392
- value: function _renderActive() {
393
- var that = this;
394
- this._group.selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox")// eslint-disable-next-line @typescript-eslint/no-explicit-any
395
- .each(function(_d, i) {
396
- var d = _d || {};
397
- if (!d.parentNode) d.parentNode = this.parentNode;
398
- var parent = d.parentNode;
399
- if (select(this).classed("d3plus-textBox")) d = d.data;
400
- if (d.__d3plusShape__ || d.__d3plus__) {
401
- while(d && (d.__d3plusShape__ || d.__d3plus__)){
402
- i = d.i;
403
- d = d.data;
404
- }
405
- } else i = that._data.indexOf(d);
406
- var group = !that._active || typeof that._active !== "function" || !that._active(d, i) ? parent : that._activeGroup.node();
407
- if (group !== this.parentNode) {
408
- group.appendChild(this);
409
- if (this.className.baseVal.includes("d3plus-Shape")) {
410
- if (parent === group) // eslint-disable-next-line @typescript-eslint/no-explicit-any
411
- select(this).call(that._applyStyle.bind(that));
412
- else select(this).call(that._updateStyle.bind(that, select(this), that._activeStyle));
413
- }
414
- }
556
+ */ key: "_buildLabelData",
557
+ value: function _buildLabelData() {
558
+ // Delegates to the pure `buildLabelData()` helper. The helper
559
+ // takes the same inputs `this` exposes but works without a Shape
560
+ // instance — emit functions or other callers that need only the
561
+ // label-record layout can call it directly without instantiating
562
+ // a Shape in compute mode.
563
+ // All Shape methods bound to `this` before handing them to the pure
564
+ // helper — subclasses (e.g. Line._dataFilter) reach for `this.schema.id`
565
+ // and friends inside their bodies.
566
+ return buildLabelData({
567
+ data: this._data,
568
+ dataFilter: this._dataFilter ? this._dataFilter.bind(this) : undefined,
569
+ label: this.schema.label,
570
+ labelBounds: this.schema.labelBounds ? this.schema.labelBounds.bind(this) : undefined,
571
+ x: this.schema.x,
572
+ y: this.schema.y,
573
+ aes: this._aes.bind(this),
574
+ rotate: this.schema.rotate,
575
+ id: this.schema.id
415
576
  });
416
- // this._renderImage();
417
- // this._renderLabels();
418
- this._group.selectAll("g.d3plus-".concat(this._name, "-shape, g.d3plus-").concat(this._name, "-image, g.d3plus-").concat(this._name, "-text")).attr("opacity", this._hover ? this._hoverOpacity : this._active ? this._activeOpacity : 1);
419
577
  }
420
578
  },
421
579
  {
422
580
  /**
423
- Modifies existing shapes to show hover status.
581
+ Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
582
+ @param callback Optional callback invoked after rendering completes.
583
+ */ /**
584
+ Resolves a style accessor for a data point, mirroring the nested-data logic
585
+ of _applyStyle so scene output matches DOM rendering.
424
586
  @private
425
- */ key: "_renderHover",
426
- value: function _renderHover() {
427
- var that = this;
428
- this._group.selectAll("g.d3plus-".concat(this._name, "-shape, g.d3plus-").concat(this._name, "-image, g.d3plus-").concat(this._name, "-text, g.d3plus-").concat(this._name, "-hover")).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox")// eslint-disable-next-line @typescript-eslint/no-explicit-any
429
- .each(function(_d, i) {
430
- var d = _d || {};
431
- if (!d.parentNode) d.parentNode = this.parentNode;
432
- var parent = d.parentNode;
433
- var d3plusType = select(this).classed("d3plus-textBox") ? "textBox" : select(this).classed("d3plus-Image") ? "Image" : "Shape";
434
- if (d3plusType === "textBox") d = d.data;
435
- if (d.__d3plusShape__ || d.__d3plus__) {
436
- while(d && (d.__d3plusShape__ || d.__d3plus__)){
437
- i = d.i;
438
- d = d.data;
439
- }
440
- } else i = that._data.indexOf(d);
441
- var notHovering = !that._hover || typeof that._hover !== "function" || !that._hover(d, i);
442
- var group = notHovering ? parent : that._hoverGroup.node();
443
- if (group !== this.parentNode) {
444
- var afterIndex = d3plusType === "textBox" ? findLastIndexWithClass(group.childNodes, [
445
- "d3plus-Image",
446
- "d3plus-Shape"
447
- ]) : d3plusType === "Image" ? findLastIndexWithClass(group.childNodes, [
448
- "d3plus-Shape"
449
- ]) : -1;
450
- if (notHovering) group.appendChild(this);
451
- else if (afterIndex === -1) group.prepend(this);
452
- else group.childNodes[afterIndex].after(this);
453
- }
454
- if (this.className.baseVal.includes("d3plus-Shape")) {
455
- if (parent === group) // eslint-disable-next-line @typescript-eslint/no-explicit-any
456
- select(this).call(that._applyStyle.bind(that));
457
- else select(this).call(that._updateStyle.bind(that, select(this), that._hoverStyle));
458
- }
459
- });
460
- // this._renderImage();
461
- // this._renderLabels();
462
- this._group.selectAll("g.d3plus-".concat(this._name, "-shape, g.d3plus-").concat(this._name, "-image, g.d3plus-").concat(this._name, "-text")).attr("opacity", this._hover ? this._hoverOpacity : this._active ? this._activeOpacity : 1);
587
+ */ key: "_styleVal",
588
+ value: function _styleVal(fn, d, i) {
589
+ if (typeof fn !== "function") return fn;
590
+ if (d.nested && d.key && d.values) {
591
+ var first = d.values[0];
592
+ return fn(first, this._data.indexOf(first));
593
+ }
594
+ return fn(d, i);
463
595
  }
464
596
  },
465
597
  {
466
598
  /**
467
- Adds background image to each shape group.
599
+ Builds the resolved Transform for a data point, mirroring _applyTransform.
468
600
  @private
469
- */ key: "_renderImage",
470
- value: function _renderImage() {
471
- var _this = this;
472
- var imageData = [];
473
- this._update.merge(this._enter).data().forEach(function(datum, i) {
474
- var aes = _this._aes(datum, i);
475
- if (aes.r || aes.width && aes.height) {
476
- var d = datum;
477
- if (datum.nested && datum.key && datum.values) {
478
- d = datum.values[0];
479
- i = _this._data.indexOf(d);
480
- }
481
- var height = aes.r ? aes.r * 2 : aes.height, url = _this._backgroundImage(d, i), width = aes.r ? aes.r * 2 : aes.width;
482
- if (url) {
483
- var x = d.__d3plusShape__ ? d.translate ? d.translate[0] : _this._x(d.data, d.i) : _this._x(d, i), y = d.__d3plusShape__ ? d.translate ? d.translate[1] : _this._y(d.data, d.i) : _this._y(d, i);
484
- if (aes.x) x += aes.x;
485
- if (aes.y) y += aes.y;
486
- if (d.__d3plusShape__) {
487
- d = d.data;
488
- i = d.i;
489
- }
490
- imageData.push({
491
- __d3plus__: true,
492
- data: d,
493
- height: height,
494
- i: i,
495
- id: _this._id(d, i),
496
- url: url,
497
- width: width,
498
- x: x + -width / 2,
499
- y: y + -height / 2
500
- });
501
- }
502
- }
503
- });
504
- this._backgroundImageClass.data(imageData).duration(this._duration).opacity(this._nestWrapper(this._opacity)).pointerEvents("none").select(elem("g.d3plus-".concat(this._name, "-image"), {
505
- parent: this._group,
506
- update: {
507
- opacity: this._active ? this._activeOpacity : 1
508
- }
509
- }).node()).render();
601
+ */ key: "_sceneTransform",
602
+ value: function _sceneTransform(d, i) {
603
+ var wrapped = Boolean(d.__d3plusShape__);
604
+ var dd = wrapped ? d.data : d;
605
+ var ii = wrapped ? d.i : i;
606
+ var x, y;
607
+ if (wrapped && d.translate) {
608
+ var _String_split_map = _sliced_to_array(String(d.translate).split(",").map(Number), 2), tx = _String_split_map[0], ty = _String_split_map[1];
609
+ x = tx;
610
+ y = ty;
611
+ } else {
612
+ x = Number(this.schema.x(dd, ii));
613
+ y = Number(this.schema.y(dd, ii));
614
+ }
615
+ var scale = wrapped && d.scale !== undefined ? Number(d.scale) : Number(this.schema.scale(dd, ii));
616
+ var rotate = wrapped && d.rotate !== undefined ? Number(d.rotate) : Number(this.schema.rotate(d.data || d, ii));
617
+ return {
618
+ x: x,
619
+ y: y,
620
+ scale: scale,
621
+ rotate: rotate
622
+ };
510
623
  }
511
624
  },
512
625
  {
513
626
  /**
514
- Adds labels to each shape group.
627
+ Builds the resolved Paint for a data point, mirroring _applyStyle.
628
+ Texture fills are encoded as a stable "pattern:<key>" token at this
629
+ layer; the backend renderers (`SvgRenderer._resolveFill`,
630
+ `CanvasRenderer._resolveFill`) materialize them into a real SVG
631
+ pattern or a Canvas image pattern. The two-stage resolve is
632
+ intentional — Shapes stay backend-free, and texture
633
+ materialization happens once per renderer instead of per-shape.
634
+ @private
635
+ */ key: "_scenePaint",
636
+ value: function _scenePaint(d, i) {
637
+ // A texture resolves to a stable "pattern:<key>" token (the same JSON config
638
+ // render() uses); each backend materializes or degrades it.
639
+ var textureKey = this._getTextureKey(d, i);
640
+ return {
641
+ fill: textureKey ? "pattern:".concat(textureKey) : strOrUndef(this._styleVal(this.schema.fill, d, i)),
642
+ fillOpacity: numOrUndef(this._styleVal(this.schema.fillOpacity, d, i)),
643
+ stroke: strOrUndef(this._styleVal(this.schema.stroke, d, i)),
644
+ strokeWidth: numOrUndef(this._styleVal(this.schema.strokeWidth, d, i)),
645
+ strokeOpacity: numOrUndef(this._styleVal(this.schema.strokeOpacity, d, i)),
646
+ strokeDasharray: parseDash(this._styleVal(this.schema.strokeDasharray, d, i)),
647
+ strokeLinecap: strOrUndef(this._styleVal(this.schema.strokeLinecap, d, i)),
648
+ vectorEffect: strOrUndef(this._styleVal(this.schema.vectorEffect, d, i)),
649
+ shapeRendering: strOrUndef(this._nestWrapper(this.schema.shapeRendering)(d, i)),
650
+ opacity: numOrUndef(this._nestWrapper(this.schema.opacity)(d, i))
651
+ };
652
+ }
653
+ },
654
+ {
655
+ /**
656
+ Returns the geometry-specific scene fields for a data point. Overridden by
657
+ each shape subclass; the base provides none.
515
658
  @private
516
- */ key: "_renderLabels",
517
- value: function _renderLabels() {
659
+ */ key: "_sceneGeometry",
660
+ value: function _sceneGeometry(_d, _i) {
661
+ return null;
662
+ }
663
+ },
664
+ {
665
+ /**
666
+ Produces a backend-agnostic scene graph for this shape's data, reusing the
667
+ same accessors render() applies to the DOM. This is the migration seam toward
668
+ the @d3plus/render pluggable backends; it has no effect on render().
669
+ */ key: "toScene",
670
+ value: function toScene() {
518
671
  var _this = this;
519
- var labelData = [];
520
- this._update.merge(this._enter).data().forEach(function(datum, i) {
521
- var d = datum;
522
- if (datum.nested && datum.key && datum.values) {
523
- d = datum.values[0];
524
- i = _this._data.indexOf(d);
672
+ var _children;
673
+ var data = this._data;
674
+ if (this._dataFilter) data = this._dataFilter(data);
675
+ var children = [];
676
+ // Build the backgroundImage data for emission below. Each datum that
677
+ // resolves to a non-false `backgroundImage(d, i)` becomes an
678
+ // ImageNode positioned at the shape's geometry.
679
+ var imageData = [];
680
+ // A `sort` comparator becomes per-datum `z` ranks rather than a reorder of
681
+ // `data`: the render backends sort each group's children ascending by `z`
682
+ // (stably), so a lower rank paints first (behind) and a higher rank paints
683
+ // last (on top) — the same back-to-front meaning `.sort()` has always had,
684
+ // without disturbing the keyed data-join order that drives transitions.
685
+ var rank = sortRanks(data, this.schema.sort);
686
+ data.forEach(function(d, i) {
687
+ var geom = _this._sceneGeometry(d, i);
688
+ if (!geom) return;
689
+ var key = _this._nestWrapper(_this.schema.id)(d, i);
690
+ var datum = d.__d3plusShape__ ? d.data : d;
691
+ var transform = _this._sceneTransform(d, i);
692
+ // Push the hit area (if any) before the geometry so it sits behind it.
693
+ if (_this.schema.hitArea) {
694
+ var ha = hitAreaNode(_this.schema.hitArea, d, i, _this._aes(d, i), key, datum, _this._name, transform);
695
+ // Share the datum's rank so the hit area stays paired just behind its
696
+ // own geometry (equal `z`, kept in push order by the stable sort).
697
+ if (ha) children.push(rank ? _object_spread_props(_object_spread({}, ha), {
698
+ z: rank[i]
699
+ }) : ha);
525
700
  }
526
- var labels = _this._label(d, i);
527
- if (_this._labelBounds && labels !== false && labels !== undefined && labels !== null) {
528
- var bounds = _this._labelBounds.bind(_this)(d, i, _this._aes(datum, i));
529
- if (bounds) {
530
- if (labels.constructor !== Array) labels = [
531
- labels
532
- ];
533
- var x = d.__d3plusShape__ ? d.translate ? d.translate[0] : _this._x(d.data, d.i) : _this._x(d, i), y = d.__d3plusShape__ ? d.translate ? d.translate[1] : _this._y(d.data, d.i) : _this._y(d, i);
534
- if (d.__d3plusShape__) {
535
- d = d.data;
536
- i = d.i;
537
- }
538
- for(var l = 0; l < labels.length; l++){
539
- var b = bounds.constructor === Array ? bounds[l] : Object.assign({}, bounds);
540
- var rotate = _this._rotate(d, i);
541
- var labelConfig = d.labelConfig;
542
- var r = labelConfig && labelConfig.rotate ? labelConfig.rotate : bounds.angle !== undefined ? bounds.angle : 0;
543
- r += rotate;
544
- var rotateAnchor = rotate !== 0 ? [
545
- b.x * -1 || 0,
546
- b.y * -1 || 0
547
- ] : [
548
- b.width / 2,
549
- b.height / 2
550
- ];
551
- labelData.push({
552
- __d3plus__: true,
553
- data: d,
554
- height: b.height,
555
- l: l,
556
- id: "".concat(_this._id(d, i), "_").concat(l),
557
- r: r,
558
- rotateAnchor: rotateAnchor,
559
- text: labels[l],
560
- width: b.width,
561
- x: x + b.x,
562
- y: y + b.y
563
- });
564
- }
701
+ children.push(_object_spread(_object_spread_props(_object_spread({}, geom), {
702
+ key: key,
703
+ datum: datum,
704
+ index: i,
705
+ shapeType: _this._name,
706
+ paint: _this._scenePaint(d, i),
707
+ transform: transform,
708
+ aria: {
709
+ role: strOrUndef(_this._nestWrapper(_this.schema.role)(d, i)),
710
+ label: strOrUndef(_this._nestWrapper(_this.schema.ariaLabel)(d, i))
565
711
  }
712
+ }), rank ? {
713
+ z: rank[i]
714
+ } : {}));
715
+ // backgroundImage: collect a per-datum image when the accessor
716
+ // returns a truthy URL. The image is sized to the shape's
717
+ // geometry (preferring width/height fields when present).
718
+ var bg = _this._nestWrapper(_this.schema.backgroundImage)(d, i);
719
+ if (bg) {
720
+ var _t_x, _t_y;
721
+ var g = geom;
722
+ // Shape geometry is origin-centered; its on-screen position lives in
723
+ // the node transform. The background image is emitted as a flat sibling
724
+ // (no transform), so bake the shape's translate into the image x/y —
725
+ // otherwise every image lands at the origin (top-left).
726
+ var t = _this._sceneTransform(d, i);
727
+ var w = typeof g.width === "number" ? g.width : undefined;
728
+ var h = typeof g.height === "number" ? g.height : undefined;
729
+ var cx = typeof g.cx === "number" ? g.cx : typeof g.x === "number" ? g.x : 0;
730
+ var cy = typeof g.cy === "number" ? g.cy : typeof g.y === "number" ? g.y : 0;
731
+ var r = typeof g.r === "number" ? g.r : undefined;
732
+ var iw = w !== null && w !== void 0 ? w : r != null ? r * 2 : 0;
733
+ var ih = h !== null && h !== void 0 ? h : r != null ? r * 2 : 0;
734
+ imageData.push({
735
+ __d3plus__: true,
736
+ data: d,
737
+ i: i,
738
+ id: _this._nestWrapper(_this.schema.id)(d, i),
739
+ url: bg,
740
+ x: ((_t_x = t.x) !== null && _t_x !== void 0 ? _t_x : 0) + cx - iw / 2,
741
+ y: ((_t_y = t.y) !== null && _t_y !== void 0 ? _t_y : 0) + cy - ih / 2,
742
+ width: iw,
743
+ height: ih
744
+ });
566
745
  }
567
746
  });
568
- this._labelClass.data(labelData).duration(this._duration).fontOpacity(this._nestWrapper(this._opacity)).pointerEvents("none").rotate(function(d) {
569
- return d.__d3plus__ ? d.r : d.data.r;
570
- }).rotateAnchor(function(d) {
571
- return d.__d3plus__ ? d.rotateAnchor : d.data.rotateAnchor;
572
- }).select(elem("g.d3plus-".concat(this._name, "-text"), {
573
- parent: this._group,
574
- update: {
575
- opacity: this._active ? this._activeOpacity : 1
576
- }
577
- }).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
578
- .config(configPrep.bind(this)(this._labelConfig)).render();
747
+ // Emit background images AFTER shape children so they paint above the
748
+ // shape's fill — matches the DOM order where the <image> was
749
+ // appended as a sibling of the shape.
750
+ if (imageData.length) (_children = children).push.apply(_children, _to_consumable_array(emitBackgroundImages(this._backgroundImageClass, imageData, rank, data.length)));
751
+ // NOTE: Labels are NOT pushed here. The canonical aggregation point is
752
+ // `emitHelpers.collectComputed(shape)`, which appends `shape.toScene()`
753
+ // AND `shape._labelClass.toScene()` independently. Pushing labels here
754
+ // too would emit them twice in every chart that calls collectComputed
755
+ // (Pie/Donut/Pack/Treemap/Network/Priestley/Radar/RadialMatrix/Geomap…).
756
+ // Standalone shape.render() consumers (no collectComputed wrapper) get
757
+ // labels through Shape.render's own SvgRenderer path below.
758
+ return {
759
+ type: "group",
760
+ key: "".concat(this._name, "-group"),
761
+ children: children
762
+ };
579
763
  }
580
764
  },
581
765
  {
582
- /**
583
- Renders the current Shape to the page. If a *callback* is specified, it will be called once the shapes are done drawing.
584
- @param callback Optional callback invoked after rendering completes.
585
- */ key: "render",
766
+ key: "render",
586
767
  value: function render(callback) {
587
- var _this = this;
588
- if (this._select === void 0) {
589
- this.select(select("body").append("svg").style("width", "".concat(window.innerWidth, "px")).style("height", "".concat(window.innerHeight, "px")).style("display", "block").node());
590
- }
591
- this._transition = transition(this._uuid).duration(this._duration);
592
- var data = this._data, key = this._id;
593
- if (this._dataFilter) {
594
- data = this._dataFilter(data);
595
- if (data.key) key = data.key;
768
+ // Populate the label TextBox so toScene() reads correct label data. The
769
+ // label class is always in compute mode — the scene path materializes text.
770
+ var lc = this._labelClass;
771
+ if (lc && typeof lc.renderMode === "function") lc.renderMode("compute");
772
+ // Apply Shape's labelConfig (fontColor, fontResize, padding, textAnchor,
773
+ // verticalAlign, fontSize, …) to the underlying TextBox. Function
774
+ // accessors receive the LABEL RECORD (with `d.data` = source
775
+ // datum, `d.l` = which label index in a multi-label-per-datum
776
+ // setup, `d.text` = label text, etc.). That gives consumers like
777
+ // Treemap (two labels per cell — title + share %) the context to
778
+ // vary anchor / color / etc. based on which label they're styling.
779
+ // Shape's default `fontColor` uses `this.schema.fill(d, i)` — since
780
+ // `fill` is the configPrep-wrapped accessor, it unwraps `d.data`
781
+ // back to the source datum automatically before invoking the user
782
+ // fill function.
783
+ this._labelClass.config(this.schema.labelConfig);
784
+ this._labelClass.data(this._buildLabelData());
785
+ if (this.schema.renderMode === "compute") {
786
+ // A Viz pipeline is driving this shape — Viz.renderScene composes the
787
+ // whole chart's scene itself, so don't spin up our own SvgRenderer.
788
+ if (callback) setTimeout(callback, 0);
789
+ return this;
596
790
  }
597
- if (this._sort) {
598
- data = data.sort(function(a, b) {
599
- while(a.__d3plusShape__ || a.__d3plus__)a = a.data;
600
- while(b.__d3plusShape__ || b.__d3plus__)b = b.data;
601
- return _this._sort(a, b);
602
- });
791
+ // Standalone shape rendering: route the shape's own toScene() through
792
+ // SvgRenderer. Preserves `new Rect().render()` ergonomics with no
793
+ // d3-selection DOM.
794
+ if (this._select === undefined && typeof document !== "undefined") {
795
+ var div = document.createElement("div");
796
+ div.style.cssText = "display:block;";
797
+ document.body.appendChild(div);
798
+ this.select(div);
603
799
  }
604
- var textureSet = unique(data.map(this._getTextureKey.bind(this))).filter(Boolean);
605
- var existingTextureDefs = Object.keys(this._textureDefs);
606
- existingTextureDefs.forEach(function(key) {
607
- if (!textureSet.includes(key)) {
608
- select(// eslint-disable-next-line @typescript-eslint/no-explicit-any
609
- _this._select.select("pattern#".concat(_this._textureDefs[key].id())).node().parentNode).remove();
610
- delete _this._textureDefs[key];
611
- }
612
- });
613
- textureSet.forEach(function(key) {
614
- if (!existingTextureDefs.includes(key)) {
615
- var _loop = function(k) {
616
- if (({}).hasOwnProperty.call(t, k) && k in t) {
617
- if (k === "d" && typeof k === "function") t[k](function() {
618
- return config[k];
619
- });
620
- else _instanceof(config[k], Array) ? t[k].apply(null, config[k]) : t[k](config[k]);
621
- }
800
+ if (this._select) {
801
+ var sel = this._select;
802
+ // `_select` is a D3Selection, but the standalone path historically also
803
+ // accepted a raw element; handle both without widening to `any`.
804
+ var node = sel && typeof sel.node === "function" ? sel.node() : sel;
805
+ if (node) {
806
+ var tag = (node.tagName || "").toLowerCase();
807
+ var isSvg = tag === "svg";
808
+ // Explicit numeric size first: an <svg>'s width/height attribute, or a
809
+ // non-svg container's client box.
810
+ var rawW = isSvg ? Number(node.getAttribute("width")) : node.clientWidth;
811
+ var rawH = isSvg ? Number(node.getAttribute("height")) : node.clientHeight;
812
+ // When that isn't a usable number — e.g. width="100%" (Number → NaN)
813
+ // or a 0-size box — measure the container's real rendered size,
814
+ // walking up to the first constrained ancestor. Only fall back to the
815
+ // static 400x300 when nothing is measurable (e.g. no layout in jsdom).
816
+ var _ref = _sliced_to_array(rawW && rawH ? [
817
+ rawW,
818
+ rawH
819
+ ] : getSize(node), 2), measuredW = _ref[0], measuredH = _ref[1];
820
+ var width = rawW || measuredW || 400;
821
+ var height = rawH || measuredH || 300;
822
+ // Combine the shape's scene + label children. toScene() deliberately
823
+ // omits labels (collectComputed is the canonical aggregator for the
824
+ // chart pipeline); for the standalone render() path we add them here
825
+ // so `new Rect().data(...).render()` still produces label text.
826
+ var shapeGroup = this.toScene();
827
+ var labelChildren = [];
828
+ if (this._labelClass && typeof this._labelClass.toScene === "function" && this._labelClass._data && this._labelClass._data.length) {
829
+ var _labelChildren;
830
+ (_labelChildren = labelChildren).push.apply(_labelChildren, _to_consumable_array(this._labelClass.toScene().children));
831
+ }
832
+ var root = _object_spread_props(_object_spread({}, shapeGroup), {
833
+ children: _to_consumable_array(shapeGroup.children).concat(_to_consumable_array(labelChildren))
834
+ });
835
+ var scene = {
836
+ root: root,
837
+ width: width,
838
+ height: height
622
839
  };
623
- var config = JSON.parse(key);
624
- var textureClass = config.texture;
625
- delete config.texture;
626
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
627
- var t = textures[textureClass]();
628
- for(var k in config)_loop(k);
629
- _this._select.call(t);
630
- _this._textureDefs[key] = t;
631
- }
632
- });
633
- selectAll("g.d3plus-".concat(this._name, "-hover > *, g.d3plus-").concat(this._name, "-active > *")).each(function(d) {
634
- var dp = d;
635
- if (dp && dp.parentNode) dp.parentNode.appendChild(this);
636
- else this.parentNode.removeChild(this);
637
- });
638
- // Makes the update state of the group selection accessible.
639
- this._group = elem("g.d3plus-".concat(this._name, "-group"), {
640
- parent: this._select
641
- });
642
- var update = this._update = elem("g.d3plus-".concat(this._name, "-shape"), {
643
- parent: this._group,
644
- update: {
645
- opacity: this._active ? this._activeOpacity : 1
840
+ // Tear down any previous SvgRenderer so its DOM listeners + timers
841
+ // are cleared instead of leaking on every re-render.
842
+ var prev = this._sceneRenderer;
843
+ if (prev && typeof prev.destroy === "function") prev.destroy();
844
+ // Caller's element is preserved (downstream selectors still find it);
845
+ // we mount SvgRenderer INSIDE it. When `node` is a <g> the result is
846
+ // a nested <svg>-in-<g>, which is valid SVG but visually unusual —
847
+ // chart code reaches this path only via the Box/Whisker full-mode
848
+ // fallback, which is not the recommended flow (compute mode is).
849
+ // Only wipe children when this is the FIRST time we're mounting
850
+ // here — re-renders into the same node would otherwise destroy any
851
+ // labels/auxiliary DOM the caller put alongside.
852
+ if (!prev) {
853
+ while(node.firstChild)node.removeChild(node.firstChild);
854
+ }
855
+ var renderer = new SvgRenderer();
856
+ renderer.mount({
857
+ container: node,
858
+ width: width,
859
+ height: height
860
+ });
861
+ renderer.drawScene(scene);
862
+ this._sceneRenderer = renderer;
646
863
  }
647
- }).selectAll(".d3plus-".concat(this._name)).data(data, key);
648
- // Orders and transforms the updating Shapes.
649
- update.order();
650
- if (this._duration) {
651
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
652
- update.transition(this._transition).call(this._applyTransform.bind(this));
653
- } else {
654
- update.call(this._applyTransform.bind(this));
655
864
  }
656
- // Makes the enter state of the group selection accessible.
657
- var enter = this._enter = update.enter().append(this._tagName).attr("class", function(d, i) {
658
- return "d3plus-Shape d3plus-".concat(_this._name, " d3plus-id-").concat(strip(_this._nestWrapper(_this._id)(d, i)));
659
- }).call(this._applyTransform.bind(this)).attr("aria-label", this._ariaLabel).attr("role", this._role).attr("opacity", this._nestWrapper(this._opacity));
660
- var enterUpdate = enter.merge(update);
661
- var enterUpdateRender = enterUpdate.attr("shape-rendering", this._nestWrapper(this._shapeRendering));
662
- if (this._duration) {
663
- enterUpdateRender = enterUpdateRender.attr("pointer-events", "none").transition(this._transition).transition().delay(100).attr("pointer-events", this._pointerEvents);
664
- }
665
- enterUpdateRender.attr("opacity", this._nestWrapper(this._opacity));
666
- // Makes the exit state of the group selection accessible.
667
- var exit = this._exit = update.exit();
668
- if (this._duration) exit.transition().delay(this._duration).remove();
669
- else exit.remove();
670
- this._renderImage();
671
- this._renderLabels();
672
- this._hoverGroup = elem("g.d3plus-".concat(this._name, "-hover"), {
673
- parent: this._group
674
- });
675
- this._activeGroup = elem("g.d3plus-".concat(this._name, "-active"), {
676
- parent: this._group
677
- });
678
- var hitAreas = this._group.selectAll(".d3plus-HitArea").data(this._hitArea && Object.keys(this._on).length ? data : [], key);
679
- hitAreas.order().call(this._applyTransform.bind(this));
680
- var isLine = this._name === "Line";
681
- if (isLine) {
682
- var curve = this._curve.bind(this)(this.config());
683
- isLine && // eslint-disable-next-line @typescript-eslint/no-explicit-any
684
- this._path.curve(// eslint-disable-next-line @typescript-eslint/no-explicit-any
685
- paths["curve".concat(curve.charAt(0).toUpperCase()).concat(curve.slice(1))]).defined(this._defined).x(this._x).y(this._y);
686
- }
687
- var hitEnter = hitAreas.enter().append(isLine ? "path" : "rect").attr("class", function(d, i) {
688
- return "d3plus-HitArea d3plus-id-".concat(strip(_this._nestWrapper(_this._id)(d, i)));
689
- }).attr("fill", "black").attr("stroke", "black").attr("pointer-events", "painted").attr("opacity", 0).call(this._applyTransform.bind(this));
690
- var that = this;
691
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
692
- var hitUpdates = hitAreas.merge(hitEnter).each(function(d) {
693
- var i = that._data.indexOf(d);
694
- var h = that._hitArea(d, i, that._aes(d, i));
695
- return h && !(that._name === "Line" && parseFloat(that._strokeWidth(d, i)) > 10) ? select(this).call(attrize, h) : select(this).remove();
696
- });
697
- hitAreas.exit().remove();
698
- this._applyEvents(this._hitArea ? hitUpdates : enterUpdate);
699
- setTimeout(function() {
700
- if (_this._active) _this._renderActive();
701
- else if (_this._hover) _this._renderHover();
702
- if (callback) callback();
703
- }, this._duration + 100);
865
+ if (callback) setTimeout(callback, 0);
704
866
  return this;
705
867
  }
706
868
  },
707
869
  {
708
870
  key: "active",
709
871
  value: function active(_) {
710
- if (!arguments.length || _ === undefined) return this._active;
711
- this._active = _;
712
- if (this._group) {
713
- // this._renderImage();
714
- // this._renderLabels();
715
- this._renderActive();
716
- }
872
+ if (!arguments.length || _ === undefined) return this.schema.active;
873
+ this.schema.active = _;
874
+ // v4: active/hover visuals come from the scene path's paint recomputation
875
+ // on the next render(); no DOM mutation here.
717
876
  return this;
718
877
  }
719
878
  },
720
- {
721
- key: "activeOpacity",
722
- value: function activeOpacity(_) {
723
- return arguments.length ? (this._activeOpacity = _, this) : this._activeOpacity;
724
- }
725
- },
726
879
  {
727
880
  key: "activeStyle",
728
881
  value: function activeStyle(_) {
729
- return arguments.length ? (this._activeStyle = assign({}, this._activeStyle, _), this) : this._activeStyle;
730
- }
731
- },
732
- {
733
- key: "ariaLabel",
734
- value: function ariaLabel(_) {
735
- return _ !== undefined ? (this._ariaLabel = typeof _ === "function" ? _ : constant(_), this) : this._ariaLabel;
736
- }
737
- },
738
- {
739
- key: "backgroundImage",
740
- value: function backgroundImage(_) {
741
- return arguments.length ? (this._backgroundImage = typeof _ === "function" ? _ : constant(_), this) : this._backgroundImage;
882
+ return arguments.length ? (this.schema.activeStyle = assign({}, this.schema.activeStyle, _), this) : this.schema.activeStyle;
742
883
  }
743
884
  },
744
885
  {
@@ -747,125 +888,25 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
747
888
  return arguments.length ? (this._data = _, this) : this._data;
748
889
  }
749
890
  },
750
- {
751
- key: "discrete",
752
- value: function discrete(_) {
753
- return arguments.length ? (this._discrete = _, this) : this._discrete;
754
- }
755
- },
756
- {
757
- key: "duration",
758
- value: function duration(_) {
759
- return arguments.length ? (this._duration = _, this) : this._duration;
760
- }
761
- },
762
- {
763
- key: "fill",
764
- value: function fill(_) {
765
- return arguments.length ? (this._fill = typeof _ === "function" ? _ : constant(_), this) : this._fill;
766
- }
767
- },
768
- {
769
- key: "fillOpacity",
770
- value: function fillOpacity(_) {
771
- return arguments.length ? (this._fillOpacity = typeof _ === "function" ? _ : constant(_), this) : this._fillOpacity;
772
- }
773
- },
774
891
  {
775
892
  key: "hover",
776
893
  value: function hover(_) {
777
- if (!arguments.length || _ === void 0) return this._hover;
778
- this._hover = _;
779
- if (this._group) {
780
- // this._renderImage();
781
- // this._renderLabels();
782
- this._renderHover();
783
- }
894
+ if (!arguments.length || _ === void 0) return this.schema.hover;
895
+ this.schema.hover = _;
896
+ // v4: hover dim comes from the scene path's paint recomputation; no DOM here.
784
897
  return this;
785
898
  }
786
899
  },
787
900
  {
788
901
  key: "hoverStyle",
789
902
  value: function hoverStyle(_) {
790
- return arguments.length ? (this._hoverStyle = assign({}, this._hoverStyle, _), this) : this._hoverStyle;
791
- }
792
- },
793
- {
794
- key: "hoverOpacity",
795
- value: function hoverOpacity(_) {
796
- return arguments.length ? (this._hoverOpacity = _, this) : this._hoverOpacity;
797
- }
798
- },
799
- {
800
- key: "hitArea",
801
- value: function hitArea(_) {
802
- return arguments.length ? (this._hitArea = typeof _ === "function" ? _ : constant(_), this) : this._hitArea;
803
- }
804
- },
805
- {
806
- key: "id",
807
- value: function id(_) {
808
- return arguments.length ? (this._id = _, this) : this._id;
809
- }
810
- },
811
- {
812
- key: "label",
813
- value: function label(_) {
814
- return arguments.length ? (this._label = typeof _ === "function" ? _ : constant(_), this) : this._label;
815
- }
816
- },
817
- {
818
- key: "labelBounds",
819
- value: function labelBounds(_) {
820
- return arguments.length ? (this._labelBounds = typeof _ === "function" ? _ : constant(_), this) : this._labelBounds;
903
+ return arguments.length ? (this.schema.hoverStyle = assign({}, this.schema.hoverStyle, _), this) : this.schema.hoverStyle;
821
904
  }
822
905
  },
823
906
  {
824
907
  key: "labelConfig",
825
908
  value: function labelConfig(_) {
826
- return arguments.length ? (this._labelConfig = assign(this._labelConfig, _), this) : this._labelConfig;
827
- }
828
- },
829
- {
830
- key: "opacity",
831
- value: function opacity(_) {
832
- return arguments.length ? (this._opacity = typeof _ === "function" ? _ : constant(_), this) : this._opacity;
833
- }
834
- },
835
- {
836
- key: "pointerEvents",
837
- value: function pointerEvents(_) {
838
- return arguments.length ? (this._pointerEvents = typeof _ === "function" ? _ : constant(_), this) : this._pointerEvents;
839
- }
840
- },
841
- {
842
- key: "role",
843
- value: function role(_) {
844
- return _ !== undefined ? (this._role = typeof _ === "function" ? _ : constant(_), this) : this._role;
845
- }
846
- },
847
- {
848
- key: "rotate",
849
- value: function rotate(_) {
850
- return arguments.length ? (this._rotate = typeof _ === "function" ? _ : constant(_), this) : this._rotate;
851
- }
852
- },
853
- {
854
- key: "rx",
855
- value: function rx(_) {
856
- return arguments.length ? (this._rx = typeof _ === "function" ? _ : constant(_), this) : this._rx;
857
- }
858
- },
859
- {
860
- key: "ry",
861
- value: function ry(_) {
862
- return arguments.length ? (this._ry = typeof _ === "function" ? _ : constant(_), this) : this._ry;
863
- }
864
- },
865
- {
866
- key: "scale",
867
- value: function scale(_) {
868
- return arguments.length ? (this._scale = typeof _ === "function" ? _ : constant(_), this) : this._scale;
909
+ return arguments.length ? (this.schema.labelConfig = assign(this.schema.labelConfig, _), this) : this.schema.labelConfig;
869
910
  }
870
911
  },
871
912
  {
@@ -874,88 +915,24 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
874
915
  return arguments.length ? (this._select = select(_), this) : this._select;
875
916
  }
876
917
  },
877
- {
878
- key: "shapeRendering",
879
- value: function shapeRendering(_) {
880
- return arguments.length ? (this._shapeRendering = typeof _ === "function" ? _ : constant(_), this) : this._shapeRendering;
881
- }
882
- },
883
918
  {
884
919
  key: "sort",
885
920
  value: function sort(_) {
886
- return arguments.length ? (this._sort = _ !== null && _ !== void 0 ? _ : null, this) : this._sort;
887
- }
888
- },
889
- {
890
- key: "stroke",
891
- value: function stroke(_) {
892
- return arguments.length ? (this._stroke = typeof _ === "function" ? _ : constant(_), this) : this._stroke;
893
- }
894
- },
895
- {
896
- key: "strokeDasharray",
897
- value: function strokeDasharray(_) {
898
- return arguments.length ? (this._strokeDasharray = typeof _ === "function" ? _ : constant(_), this) : this._strokeDasharray;
899
- }
900
- },
901
- {
902
- key: "strokeLinecap",
903
- value: function strokeLinecap(_) {
904
- return arguments.length ? (this._strokeLinecap = typeof _ === "function" ? _ : constant(_), this) : this._strokeLinecap;
905
- }
906
- },
907
- {
908
- key: "strokeOpacity",
909
- value: function strokeOpacity(_) {
910
- return arguments.length ? (this._strokeOpacity = typeof _ === "function" ? _ : constant(_), this) : this._strokeOpacity;
911
- }
912
- },
913
- {
914
- key: "strokeWidth",
915
- value: function strokeWidth(_) {
916
- return arguments.length ? (this._strokeWidth = typeof _ === "function" ? _ : constant(_), this) : this._strokeWidth;
917
- }
918
- },
919
- {
920
- key: "textAnchor",
921
- value: function textAnchor(_) {
922
- return arguments.length ? (this._textAnchor = typeof _ === "function" ? _ : constant(_), this) : this._textAnchor;
923
- }
924
- },
925
- {
926
- key: "texture",
927
- value: function texture(_) {
928
- return arguments.length ? (this._texture = typeof _ === "function" ? _ : constant(_), this) : this._texture;
921
+ return arguments.length ? (this.schema.sort = _ !== null && _ !== void 0 ? _ : null, this) : this.schema.sort;
929
922
  }
930
923
  },
931
924
  {
932
925
  key: "textureDefault",
933
926
  value: function textureDefault(_) {
934
- return arguments.length ? (this._textureDefault = assign(this._textureDefault, _), this) : this._textureDefault;
935
- }
936
- },
937
- {
938
- key: "vectorEffect",
939
- value: function vectorEffect(_) {
940
- return arguments.length ? (this._vectorEffect = typeof _ === "function" ? _ : constant(_), this) : this._vectorEffect;
927
+ return arguments.length ? (this.schema.textureDefault = assign(this.schema.textureDefault, _), this) : this.schema.textureDefault;
941
928
  }
942
929
  },
943
930
  {
944
- key: "verticalAlign",
945
- value: function verticalAlign(_) {
946
- return arguments.length ? (this._verticalAlign = typeof _ === "function" ? _ : constant(_), this) : this._verticalAlign;
947
- }
948
- },
949
- {
950
- key: "x",
951
- value: function x(_) {
952
- return arguments.length ? (this._x = typeof _ === "function" ? _ : constant(_), this) : this._x;
953
- }
954
- },
955
- {
956
- key: "y",
957
- value: function y(_) {
958
- return arguments.length ? (this._y = typeof _ === "function" ? _ : constant(_), this) : this._y;
931
+ key: "config",
932
+ value: function config(_) {
933
+ if (!arguments.length) return _get(_get_prototype_of(Shape.prototype), "config", this).call(this);
934
+ _get(_get_prototype_of(Shape.prototype), "config", this).call(this, _);
935
+ return this;
959
936
  }
960
937
  }
961
938
  ]);