@d3plus/core 3.1.5 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (579) hide show
  1. package/README.md +9922 -78537
  2. package/es/index.js +8 -0
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +54 -0
  5. package/es/internal.js.map +1 -0
  6. package/es/src/charts/AreaPlot/index.js +36 -0
  7. package/es/src/charts/AreaPlot/index.js.map +1 -0
  8. package/es/src/charts/BarChart/index.js +48 -0
  9. package/es/src/charts/BarChart/index.js.map +1 -0
  10. package/es/src/charts/BoxWhisker/index.js +52 -0
  11. package/es/src/charts/BoxWhisker/index.js.map +1 -0
  12. package/es/src/charts/BumpChart/index.js +81 -0
  13. package/es/src/charts/BumpChart/index.js.map +1 -0
  14. package/es/src/charts/Donut/index.js +42 -0
  15. package/es/src/charts/Donut/index.js.map +1 -0
  16. package/es/src/charts/Geomap/applyLayout.js +208 -0
  17. package/es/src/charts/Geomap/applyLayout.js.map +1 -0
  18. package/es/src/charts/Geomap/emit.js +169 -0
  19. package/es/src/charts/Geomap/emit.js.map +1 -0
  20. package/es/src/charts/Geomap/index.js +521 -0
  21. package/es/src/charts/Geomap/index.js.map +1 -0
  22. package/es/src/charts/LinePlot/index.js +32 -0
  23. package/es/src/charts/LinePlot/index.js.map +1 -0
  24. package/es/src/charts/Matrix/applyLayout.js +92 -0
  25. package/es/src/charts/Matrix/applyLayout.js.map +1 -0
  26. package/es/src/charts/Matrix/emit.js +44 -0
  27. package/es/src/charts/Matrix/emit.js.map +1 -0
  28. package/es/src/charts/Matrix/index.js +154 -0
  29. package/es/src/charts/Matrix/index.js.map +1 -0
  30. package/es/src/charts/Network/applyLayout.js +322 -0
  31. package/es/src/charts/Network/applyLayout.js.map +1 -0
  32. package/es/src/charts/Network/emit.js +273 -0
  33. package/es/src/charts/Network/emit.js.map +1 -0
  34. package/es/src/charts/Network/index.js +422 -0
  35. package/es/src/charts/Network/index.js.map +1 -0
  36. package/es/src/charts/Pack/applyLayout.js +46 -0
  37. package/es/src/charts/Pack/applyLayout.js.map +1 -0
  38. package/es/src/charts/Pack/emit.js +116 -0
  39. package/es/src/charts/Pack/emit.js.map +1 -0
  40. package/es/src/charts/Pack/index.js +194 -0
  41. package/es/src/charts/Pack/index.js.map +1 -0
  42. package/es/src/charts/Pack/recursionCircles.js +18 -0
  43. package/es/src/charts/Pack/recursionCircles.js.map +1 -0
  44. package/es/src/charts/Pie/applyLayout.js +44 -0
  45. package/es/src/charts/Pie/applyLayout.js.map +1 -0
  46. package/es/src/charts/Pie/emit.js +111 -0
  47. package/es/src/charts/Pie/emit.js.map +1 -0
  48. package/es/src/charts/Pie/index.js +134 -0
  49. package/es/src/charts/Pie/index.js.map +1 -0
  50. package/es/src/charts/Plot/draw.js +424 -0
  51. package/es/src/charts/Plot/draw.js.map +1 -0
  52. package/es/src/charts/Plot/index.js +827 -0
  53. package/es/src/charts/Plot/index.js.map +1 -0
  54. package/es/src/charts/Plot/labelPlacement.js +36 -0
  55. package/es/src/charts/Plot/labelPlacement.js.map +1 -0
  56. package/es/src/charts/Plot/pipeline.js +594 -0
  57. package/es/src/charts/Plot/pipeline.js.map +1 -0
  58. package/es/src/charts/Plot/pipelineDomains.js +254 -0
  59. package/es/src/charts/Plot/pipelineDomains.js.map +1 -0
  60. package/es/src/charts/Plot/pipelineLineLabels.js +210 -0
  61. package/es/src/charts/Plot/pipelineLineLabels.js.map +1 -0
  62. package/es/src/charts/Plot/shapeDefaults.js +189 -0
  63. package/es/src/charts/Plot/shapeDefaults.js.map +1 -0
  64. package/es/src/charts/Plot/stackHelpers.js +52 -0
  65. package/es/src/charts/Plot/stackHelpers.js.map +1 -0
  66. package/es/src/charts/Priestley/applyLayout.js +121 -0
  67. package/es/src/charts/Priestley/applyLayout.js.map +1 -0
  68. package/es/src/charts/Priestley/emit.js +129 -0
  69. package/es/src/charts/Priestley/emit.js.map +1 -0
  70. package/es/src/charts/Priestley/index.js +97 -0
  71. package/es/src/charts/Priestley/index.js.map +1 -0
  72. package/es/src/charts/Radar/applyLayout.js +326 -0
  73. package/es/src/charts/Radar/applyLayout.js.map +1 -0
  74. package/es/src/charts/Radar/emit.js +28 -0
  75. package/es/src/charts/Radar/emit.js.map +1 -0
  76. package/es/src/charts/Radar/index.js +98 -0
  77. package/es/src/charts/Radar/index.js.map +1 -0
  78. package/es/src/charts/RadialMatrix/applyLayout.js +132 -0
  79. package/es/src/charts/RadialMatrix/applyLayout.js.map +1 -0
  80. package/es/src/charts/RadialMatrix/emit.js +33 -0
  81. package/es/src/charts/RadialMatrix/emit.js.map +1 -0
  82. package/es/src/charts/RadialMatrix/index.js +144 -0
  83. package/es/src/charts/RadialMatrix/index.js.map +1 -0
  84. package/es/src/charts/Rings/applyLayout.js +508 -0
  85. package/es/src/charts/Rings/applyLayout.js.map +1 -0
  86. package/es/src/charts/Rings/emit.js +222 -0
  87. package/es/src/charts/Rings/emit.js.map +1 -0
  88. package/es/src/charts/Rings/index.js +245 -0
  89. package/es/src/charts/Rings/index.js.map +1 -0
  90. package/es/src/charts/Sankey/applyLayout.js +107 -0
  91. package/es/src/charts/Sankey/applyLayout.js.map +1 -0
  92. package/es/src/charts/Sankey/emit.js +134 -0
  93. package/es/src/charts/Sankey/emit.js.map +1 -0
  94. package/es/src/charts/Sankey/index.js +219 -0
  95. package/es/src/charts/Sankey/index.js.map +1 -0
  96. package/es/src/charts/StackedArea/index.js +27 -0
  97. package/es/src/charts/StackedArea/index.js.map +1 -0
  98. package/es/src/charts/Tree/applyLayout.js +233 -0
  99. package/es/src/charts/Tree/applyLayout.js.map +1 -0
  100. package/es/src/charts/Tree/emit.js +257 -0
  101. package/es/src/charts/Tree/emit.js.map +1 -0
  102. package/es/src/charts/Tree/index.js +105 -0
  103. package/es/src/charts/Tree/index.js.map +1 -0
  104. package/es/src/charts/Treemap/applyLayout.js +85 -0
  105. package/es/src/charts/Treemap/applyLayout.js.map +1 -0
  106. package/es/src/charts/Treemap/emit.js +141 -0
  107. package/es/src/charts/Treemap/emit.js.map +1 -0
  108. package/es/src/charts/Treemap/index.js +177 -0
  109. package/es/src/charts/Treemap/index.js.map +1 -0
  110. package/es/src/charts/Treemap/thresholdFunction.js +112 -0
  111. package/es/src/charts/Treemap/thresholdFunction.js.map +1 -0
  112. package/es/src/charts/definition/ChartDefinition.js +12 -0
  113. package/es/src/charts/definition/ChartDefinition.js.map +1 -0
  114. package/es/src/charts/definition/applyDefinition.js +107 -0
  115. package/es/src/charts/definition/applyDefinition.js.map +1 -0
  116. package/es/src/charts/definition/makeChart.js +153 -0
  117. package/es/src/charts/definition/makeChart.js.map +1 -0
  118. package/es/src/charts/drawSteps/zoomControls.js +231 -96
  119. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  120. package/es/src/charts/events/click.legend.js +2 -2
  121. package/es/src/charts/events/click.legend.js.map +1 -1
  122. package/es/src/charts/events/click.shape.js +5 -5
  123. package/es/src/charts/events/click.shape.js.map +1 -1
  124. package/es/src/charts/events/mouseenter.js +20 -1
  125. package/es/src/charts/events/mouseenter.js.map +1 -1
  126. package/es/src/charts/events/mouseleave.js +19 -4
  127. package/es/src/charts/events/mouseleave.js.map +1 -1
  128. package/es/src/charts/events/mousemove.legend.js +10 -10
  129. package/es/src/charts/events/mousemove.legend.js.map +1 -1
  130. package/es/src/charts/events/mousemove.shape.js +14 -8
  131. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  132. package/es/src/charts/events/touchstart.body.js.map +1 -1
  133. package/es/src/charts/features/axes.js +432 -0
  134. package/es/src/charts/features/axes.js.map +1 -0
  135. package/es/src/charts/features/chartGeometry.js +66 -0
  136. package/es/src/charts/features/chartGeometry.js.map +1 -0
  137. package/es/src/charts/features/colorScaleBucket.js +92 -0
  138. package/es/src/charts/features/colorScaleBucket.js.map +1 -0
  139. package/es/src/charts/features/emitHelpers.js +217 -0
  140. package/es/src/charts/features/emitHelpers.js.map +1 -0
  141. package/es/src/charts/features/ensureZoomDom.js +71 -0
  142. package/es/src/charts/features/ensureZoomDom.js.map +1 -0
  143. package/es/src/charts/features/features.js +650 -0
  144. package/es/src/charts/features/features.js.map +1 -0
  145. package/es/src/charts/features/featuresLegend.js +180 -0
  146. package/es/src/charts/features/featuresLegend.js.map +1 -0
  147. package/es/src/charts/features/legendLabel.js +12 -0
  148. package/es/src/charts/features/legendLabel.js.map +1 -0
  149. package/es/src/charts/features/lineLabels.js +154 -0
  150. package/es/src/charts/features/lineLabels.js.map +1 -0
  151. package/es/src/charts/features/plotPaint.js +512 -0
  152. package/es/src/charts/features/plotPaint.js.map +1 -0
  153. package/es/src/charts/features/shapeEmit.js +273 -0
  154. package/es/src/charts/features/shapeEmit.js.map +1 -0
  155. package/es/src/charts/helpers/matrixData.js +3 -3
  156. package/es/src/charts/helpers/matrixData.js.map +1 -1
  157. package/es/src/charts/index.js +21 -21
  158. package/es/src/charts/index.js.map +1 -1
  159. package/es/src/charts/pipeline/resolveSpec.js +44 -0
  160. package/es/src/charts/pipeline/resolveSpec.js.map +1 -0
  161. package/es/src/charts/pipeline/runChartDraw.js +109 -0
  162. package/es/src/charts/pipeline/runChartDraw.js.map +1 -0
  163. package/es/src/charts/pipeline/runVizPipeline.js +84 -0
  164. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -0
  165. package/es/src/charts/pipeline/stages.js +103 -0
  166. package/es/src/charts/pipeline/stages.js.map +1 -0
  167. package/es/src/charts/pipeline/vizContext.js +29 -0
  168. package/es/src/charts/pipeline/vizContext.js.map +1 -0
  169. package/es/src/charts/pipeline/vizDraw.js +37 -0
  170. package/es/src/charts/pipeline/vizDraw.js.map +1 -0
  171. package/es/src/charts/pipeline/vizDrawPure.js +174 -0
  172. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -0
  173. package/es/src/charts/pipeline/vizPreDraw.js +145 -0
  174. package/es/src/charts/pipeline/vizPreDraw.js.map +1 -0
  175. package/es/src/charts/pipeline/vizPreDrawPure.js +279 -0
  176. package/es/src/charts/pipeline/vizPreDrawPure.js.map +1 -0
  177. package/es/src/charts/plotBuffers/Bar.js +4 -4
  178. package/es/src/charts/plotBuffers/Bar.js.map +1 -1
  179. package/es/src/charts/plotBuffers/Box.js +4 -4
  180. package/es/src/charts/plotBuffers/Box.js.map +1 -1
  181. package/es/src/charts/plotBuffers/Circle.js +2 -2
  182. package/es/src/charts/plotBuffers/Circle.js.map +1 -1
  183. package/es/src/charts/plotBuffers/Line.js +5 -5
  184. package/es/src/charts/plotBuffers/Line.js.map +1 -1
  185. package/es/src/charts/plotBuffers/Rect.js +2 -2
  186. package/es/src/charts/plotBuffers/Rect.js.map +1 -1
  187. package/es/src/charts/plotBuffers/discreteBuffer.js +1 -2
  188. package/es/src/charts/plotBuffers/discreteBuffer.js.map +1 -1
  189. package/es/src/charts/plotBuffers/numericBuffer.js +1 -2
  190. package/es/src/charts/plotBuffers/numericBuffer.js.map +1 -1
  191. package/es/src/charts/viz/Viz.js +985 -0
  192. package/es/src/charts/viz/Viz.js.map +1 -0
  193. package/es/src/charts/viz/VizBase.js +447 -0
  194. package/es/src/charts/viz/VizBase.js.map +1 -0
  195. package/es/src/charts/viz/VizBaseConfig.js +504 -0
  196. package/es/src/charts/viz/VizBaseConfig.js.map +1 -0
  197. package/es/src/charts/viz/interactionOpacity.js +247 -0
  198. package/es/src/charts/viz/interactionOpacity.js.map +1 -0
  199. package/es/src/charts/viz/ordinalColor.js +71 -0
  200. package/es/src/charts/viz/ordinalColor.js.map +1 -0
  201. package/es/src/charts/viz/trailCatchup.js +127 -0
  202. package/es/src/charts/viz/trailCatchup.js.map +1 -0
  203. package/es/src/charts/viz/vizDefaults.js +602 -0
  204. package/es/src/charts/viz/vizDefaults.js.map +1 -0
  205. package/es/src/charts/viz/vizRender.js +251 -0
  206. package/es/src/charts/viz/vizRender.js.map +1 -0
  207. package/es/src/charts/viz/vizTypes.js +28 -0
  208. package/es/src/charts/viz/vizTypes.js.map +1 -0
  209. package/es/src/components/Axis/Axis.js +691 -0
  210. package/es/src/components/Axis/Axis.js.map +1 -0
  211. package/es/src/components/Axis/AxisBottom.js.map +1 -0
  212. package/es/src/components/Axis/AxisLeft.js.map +1 -0
  213. package/es/src/components/Axis/AxisRight.js.map +1 -0
  214. package/es/src/components/Axis/AxisTop.js.map +1 -0
  215. package/es/src/components/Axis/axisLayout.js +208 -0
  216. package/es/src/components/Axis/axisLayout.js.map +1 -0
  217. package/es/src/components/Axis/axisLayoutLabels.js +177 -0
  218. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -0
  219. package/es/src/components/Axis/axisLayoutScale.js +374 -0
  220. package/es/src/components/Axis/axisLayoutScale.js.map +1 -0
  221. package/es/src/components/Axis/axisRender.js +535 -0
  222. package/es/src/components/Axis/axisRender.js.map +1 -0
  223. package/es/src/components/ColorScale/ColorScale.js +506 -0
  224. package/es/src/components/ColorScale/ColorScale.js.map +1 -0
  225. package/es/src/components/ColorScale/colorScaleRender.js +277 -0
  226. package/es/src/components/ColorScale/colorScaleRender.js.map +1 -0
  227. package/es/src/components/ColorScale/colorScaleScale.js +274 -0
  228. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -0
  229. package/es/src/components/Legend/Legend.js +445 -0
  230. package/es/src/components/Legend/Legend.js.map +1 -0
  231. package/es/src/components/Legend/legendConfig.js +87 -0
  232. package/es/src/components/Legend/legendConfig.js.map +1 -0
  233. package/es/src/components/Legend/legendRender.js +245 -0
  234. package/es/src/components/Legend/legendRender.js.map +1 -0
  235. package/es/src/components/Message.js.map +1 -1
  236. package/es/src/components/TextBox.js +639 -453
  237. package/es/src/components/TextBox.js.map +1 -1
  238. package/es/src/components/Timeline/Timeline.js +674 -0
  239. package/es/src/components/Timeline/Timeline.js.map +1 -0
  240. package/es/src/components/Timeline/timelineConfig.js +115 -0
  241. package/es/src/components/Timeline/timelineConfig.js.map +1 -0
  242. package/es/src/components/Timeline/timelineRender.js +267 -0
  243. package/es/src/components/Timeline/timelineRender.js.map +1 -0
  244. package/es/src/components/Tooltip.js +288 -249
  245. package/es/src/components/Tooltip.js.map +1 -1
  246. package/es/src/components/index.js +8 -8
  247. package/es/src/components/index.js.map +1 -1
  248. package/es/src/fluent.js +265 -0
  249. package/es/src/fluent.js.map +1 -0
  250. package/es/src/shapes/Area.js +96 -114
  251. package/es/src/shapes/Area.js.map +1 -1
  252. package/es/src/shapes/Bar.js +71 -86
  253. package/es/src/shapes/Bar.js.map +1 -1
  254. package/es/src/shapes/Box.js +295 -190
  255. package/es/src/shapes/Box.js.map +1 -1
  256. package/es/src/shapes/Circle.js +72 -31
  257. package/es/src/shapes/Circle.js.map +1 -1
  258. package/es/src/shapes/Image.js +164 -85
  259. package/es/src/shapes/Image.js.map +1 -1
  260. package/es/src/shapes/Line.js +51 -94
  261. package/es/src/shapes/Line.js.map +1 -1
  262. package/es/src/shapes/Path.js +33 -41
  263. package/es/src/shapes/Path.js.map +1 -1
  264. package/es/src/shapes/Rect.js +86 -37
  265. package/es/src/shapes/Rect.js.map +1 -1
  266. package/es/src/shapes/Shape.js +655 -678
  267. package/es/src/shapes/Shape.js.map +1 -1
  268. package/es/src/shapes/Whisker.js +156 -61
  269. package/es/src/shapes/Whisker.js.map +1 -1
  270. package/es/src/shapes/buildLabelData.js +70 -0
  271. package/es/src/shapes/buildLabelData.js.map +1 -0
  272. package/es/src/shapes/emitLabels.js +84 -0
  273. package/es/src/shapes/emitLabels.js.map +1 -0
  274. package/es/src/shapes/hitAreaNode.js +37 -0
  275. package/es/src/shapes/hitAreaNode.js.map +1 -0
  276. package/es/src/shapes/sceneSort.js +57 -0
  277. package/es/src/shapes/sceneSort.js.map +1 -0
  278. package/es/src/shapes/shapeConfig.js +31 -0
  279. package/es/src/shapes/shapeConfig.js.map +1 -0
  280. package/es/src/utils/BaseClass.js +35 -19
  281. package/es/src/utils/BaseClass.js.map +1 -1
  282. package/es/src/utils/D3Scale.js +16 -0
  283. package/es/src/utils/D3Scale.js.map +1 -0
  284. package/es/src/utils/D3plusConfig.js.map +1 -1
  285. package/es/src/utils/configPrep.js +8 -3
  286. package/es/src/utils/configPrep.js.map +1 -1
  287. package/es/src/utils/getProp.js +1 -1
  288. package/es/src/utils/getProp.js.map +1 -1
  289. package/es/src/utils/index.js +1 -0
  290. package/es/src/utils/index.js.map +1 -1
  291. package/es/src/utils/paintComponentScene.js +59 -0
  292. package/es/src/utils/paintComponentScene.js.map +1 -0
  293. package/es/umd-entry.js +16 -0
  294. package/es/umd-entry.js.map +1 -0
  295. package/package.json +17 -9
  296. package/types/index.d.ts +3 -1
  297. package/types/internal.d.ts +54 -0
  298. package/types/src/charts/AreaPlot/index.d.ts +10 -0
  299. package/types/src/charts/BarChart/index.d.ts +10 -0
  300. package/types/src/charts/BoxWhisker/index.d.ts +11 -0
  301. package/types/src/charts/BumpChart/index.d.ts +11 -0
  302. package/types/src/charts/ChartDefinition.d.ts +75 -0
  303. package/types/src/charts/Donut/index.d.ts +13 -0
  304. package/types/src/charts/Geomap/applyLayout.d.ts +7 -0
  305. package/types/src/charts/Geomap/emit.d.ts +7 -0
  306. package/types/src/charts/Geomap/index.d.ts +14 -0
  307. package/types/src/charts/Geomap.d.ts +6 -0
  308. package/types/src/charts/LinePlot/index.d.ts +10 -0
  309. package/types/src/charts/Matrix/applyLayout.d.ts +9 -0
  310. package/types/src/charts/Matrix/emit.d.ts +6 -0
  311. package/types/src/charts/Matrix/index.d.ts +14 -0
  312. package/types/src/charts/Matrix.d.ts +0 -26
  313. package/types/src/charts/Network/applyLayout.d.ts +10 -0
  314. package/types/src/charts/Network/emit.d.ts +6 -0
  315. package/types/src/charts/Network/index.d.ts +7 -0
  316. package/types/src/charts/Network.d.ts +0 -24
  317. package/types/src/charts/Pack/applyLayout.d.ts +16 -0
  318. package/types/src/charts/Pack/emit.d.ts +6 -0
  319. package/types/src/charts/Pack/index.d.ts +15 -0
  320. package/types/src/charts/Pack/recursionCircles.d.ts +7 -0
  321. package/types/src/charts/Pack.d.ts +0 -13
  322. package/types/src/charts/Pie/applyLayout.d.ts +8 -0
  323. package/types/src/charts/Pie/emit.d.ts +5 -0
  324. package/types/src/charts/Pie/index.d.ts +14 -0
  325. package/types/src/charts/Pie.d.ts +0 -27
  326. package/types/src/charts/Plot/draw.d.ts +2 -0
  327. package/types/src/charts/Plot/index.d.ts +167 -0
  328. package/types/src/charts/Plot/labelPlacement.d.ts +15 -0
  329. package/types/src/charts/Plot/pipeline.d.ts +70 -0
  330. package/types/src/charts/Plot/pipelineDomains.d.ts +2 -0
  331. package/types/src/charts/Plot/pipelineLineLabels.d.ts +2 -0
  332. package/types/src/charts/Plot/shapeDefaults.d.ts +64 -0
  333. package/types/src/charts/Plot/stackHelpers.d.ts +24 -0
  334. package/types/src/charts/Plot.d.ts +23 -72
  335. package/types/src/charts/Priestley/applyLayout.d.ts +21 -0
  336. package/types/src/charts/Priestley/emit.d.ts +6 -0
  337. package/types/src/charts/Priestley/index.d.ts +14 -0
  338. package/types/src/charts/Radar/applyLayout.d.ts +10 -0
  339. package/types/src/charts/Radar/emit.d.ts +7 -0
  340. package/types/src/charts/Radar/index.d.ts +14 -0
  341. package/types/src/charts/RadialMatrix/applyLayout.d.ts +11 -0
  342. package/types/src/charts/RadialMatrix/emit.d.ts +6 -0
  343. package/types/src/charts/RadialMatrix/index.d.ts +14 -0
  344. package/types/src/charts/RadialMatrix.d.ts +0 -15
  345. package/types/src/charts/Rings/applyLayout.d.ts +2 -0
  346. package/types/src/charts/Rings/emit.d.ts +7 -0
  347. package/types/src/charts/Rings/index.d.ts +15 -0
  348. package/types/src/charts/Rings.d.ts +0 -13
  349. package/types/src/charts/Sankey/applyLayout.d.ts +7 -0
  350. package/types/src/charts/Sankey/emit.d.ts +6 -0
  351. package/types/src/charts/Sankey/index.d.ts +7 -0
  352. package/types/src/charts/Sankey.d.ts +0 -4
  353. package/types/src/charts/StackedArea/index.d.ts +10 -0
  354. package/types/src/charts/Tree/applyLayout.d.ts +2 -0
  355. package/types/src/charts/Tree/emit.d.ts +7 -0
  356. package/types/src/charts/Tree/index.d.ts +14 -0
  357. package/types/src/charts/Tree.d.ts +0 -16
  358. package/types/src/charts/Treemap/applyLayout.d.ts +16 -0
  359. package/types/src/charts/Treemap/emit.d.ts +6 -0
  360. package/types/src/charts/Treemap/index.d.ts +18 -0
  361. package/types/src/charts/Treemap/thresholdFunction.d.ts +25 -0
  362. package/types/src/charts/Treemap.d.ts +4 -13
  363. package/types/src/charts/Viz.d.ts +49 -361
  364. package/types/src/charts/VizBase.d.ts +158 -0
  365. package/types/src/charts/VizBaseConfig.d.ts +148 -0
  366. package/types/src/charts/applyDefinition.d.ts +13 -0
  367. package/types/src/charts/axes.d.ts +134 -0
  368. package/types/src/charts/chartGeometry.d.ts +58 -0
  369. package/types/src/charts/definition/ChartDefinition.d.ts +84 -0
  370. package/types/src/charts/definition/applyDefinition.d.ts +13 -0
  371. package/types/src/charts/definition/makeChart.d.ts +22 -0
  372. package/types/src/charts/drawSteps/zoomControls.d.ts +25 -5
  373. package/types/src/charts/emitHelpers.d.ts +122 -0
  374. package/types/src/charts/ensureZoomDom.d.ts +39 -0
  375. package/types/src/charts/events/click.legend.d.ts +1 -1
  376. package/types/src/charts/events/click.shape.d.ts +1 -1
  377. package/types/src/charts/events/mouseenter.d.ts +1 -1
  378. package/types/src/charts/events/mouseleave.d.ts +1 -1
  379. package/types/src/charts/events/mousemove.legend.d.ts +1 -1
  380. package/types/src/charts/events/mousemove.shape.d.ts +1 -1
  381. package/types/src/charts/events/touchstart.body.d.ts +1 -1
  382. package/types/src/charts/factories.d.ts +73 -0
  383. package/types/src/charts/features/axes.d.ts +134 -0
  384. package/types/src/charts/features/chartGeometry.d.ts +58 -0
  385. package/types/src/charts/features/colorScaleBucket.d.ts +43 -0
  386. package/types/src/charts/features/colorScaleBucketShare.d.ts +16 -0
  387. package/types/src/charts/features/emitHelpers.d.ts +123 -0
  388. package/types/src/charts/features/ensureZoomDom.d.ts +39 -0
  389. package/types/src/charts/features/features.d.ts +152 -0
  390. package/types/src/charts/features/featuresLegend.d.ts +12 -0
  391. package/types/src/charts/features/legendLabel.d.ts +11 -0
  392. package/types/src/charts/features/lineLabels.d.ts +40 -0
  393. package/types/src/charts/features/plotPaint.d.ts +233 -0
  394. package/types/src/charts/features/shapeEmit.d.ts +61 -0
  395. package/types/src/charts/features.d.ts +152 -0
  396. package/types/src/charts/featuresLegend.d.ts +12 -0
  397. package/types/src/charts/helpers/matrixData.d.ts +1 -1
  398. package/types/src/charts/index.d.ts +21 -21
  399. package/types/src/charts/legendLabel.d.ts +11 -0
  400. package/types/src/charts/lineLabels.d.ts +40 -0
  401. package/types/src/charts/makeChart.d.ts +22 -0
  402. package/types/src/charts/pipeline/resolveSpec.d.ts +51 -0
  403. package/types/src/charts/pipeline/runChartDraw.d.ts +38 -0
  404. package/types/src/charts/pipeline/runVizPipeline.d.ts +31 -0
  405. package/types/src/charts/pipeline/stages.d.ts +160 -0
  406. package/types/src/charts/pipeline/vizContext.d.ts +45 -0
  407. package/types/src/charts/pipeline/vizDraw.d.ts +25 -0
  408. package/types/src/charts/pipeline/vizDrawPure.d.ts +46 -0
  409. package/types/src/charts/pipeline/vizPreDraw.d.ts +22 -0
  410. package/types/src/charts/pipeline/vizPreDrawPure.d.ts +68 -0
  411. package/types/src/charts/plotBuffers/Bar.d.ts +6 -5
  412. package/types/src/charts/plotBuffers/Box.d.ts +6 -5
  413. package/types/src/charts/plotBuffers/Circle.d.ts +6 -5
  414. package/types/src/charts/plotBuffers/Line.d.ts +6 -5
  415. package/types/src/charts/plotBuffers/Rect.d.ts +6 -5
  416. package/types/src/charts/plotBuffers/discreteBuffer.d.ts +2 -1
  417. package/types/src/charts/plotBuffers/numericBuffer.d.ts +2 -1
  418. package/types/src/charts/plotPaint.d.ts +233 -0
  419. package/types/src/charts/resolveSpec.d.ts +50 -0
  420. package/types/src/charts/runChartDraw.d.ts +38 -0
  421. package/types/src/charts/runVizPipeline.d.ts +31 -0
  422. package/types/src/charts/shapeEmit.d.ts +61 -0
  423. package/types/src/charts/stages.d.ts +117 -0
  424. package/types/src/charts/viz/Viz.d.ts +111 -0
  425. package/types/src/charts/viz/VizBase.d.ts +160 -0
  426. package/types/src/charts/viz/VizBaseConfig.d.ts +156 -0
  427. package/types/src/charts/viz/interactionOpacity.d.ts +23 -0
  428. package/types/src/charts/viz/ordinalColor.d.ts +14 -0
  429. package/types/src/charts/viz/trailCatchup.d.ts +14 -0
  430. package/types/src/charts/viz/vizDefaults.d.ts +8 -0
  431. package/types/src/charts/viz/vizRender.d.ts +8 -0
  432. package/types/src/charts/viz/vizTypes.d.ts +250 -0
  433. package/types/src/charts/vizContext.d.ts +46 -0
  434. package/types/src/charts/vizDefaults.d.ts +8 -0
  435. package/types/src/charts/vizDraw.d.ts +25 -0
  436. package/types/src/charts/vizDrawPure.d.ts +17 -0
  437. package/types/src/charts/vizPreDraw.d.ts +22 -0
  438. package/types/src/charts/vizPreDrawPure.d.ts +40 -0
  439. package/types/src/charts/vizRender.d.ts +8 -0
  440. package/types/src/charts/vizTypes.d.ts +202 -0
  441. package/types/src/components/Axis/Axis.d.ts +182 -0
  442. package/types/src/components/Axis/AxisBottom.d.ts +11 -0
  443. package/types/src/components/Axis/AxisLeft.d.ts +11 -0
  444. package/types/src/components/Axis/AxisRight.d.ts +11 -0
  445. package/types/src/components/Axis/AxisTop.d.ts +11 -0
  446. package/types/src/components/Axis/axisLayout.d.ts +29 -0
  447. package/types/src/components/Axis/axisLayoutLabels.d.ts +70 -0
  448. package/types/src/components/Axis/axisLayoutScale.d.ts +14 -0
  449. package/types/src/components/Axis/axisRender.d.ts +68 -0
  450. package/types/src/components/Axis.d.ts +68 -194
  451. package/types/src/components/ColorScale/ColorScale.d.ts +100 -0
  452. package/types/src/components/ColorScale/colorScaleRender.d.ts +15 -0
  453. package/types/src/components/ColorScale/colorScaleScale.d.ts +19 -0
  454. package/types/src/components/ColorScale.d.ts +1 -129
  455. package/types/src/components/Legend/Legend.d.ts +95 -0
  456. package/types/src/components/Legend/legendConfig.d.ts +7 -0
  457. package/types/src/components/Legend/legendRender.d.ts +16 -0
  458. package/types/src/components/Legend.d.ts +9 -73
  459. package/types/src/components/TextBox.d.ts +25 -218
  460. package/types/src/components/Timeline/Timeline.d.ts +118 -0
  461. package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
  462. package/types/src/components/Timeline/timelineRender.d.ts +24 -0
  463. package/types/src/components/Timeline.d.ts +7 -81
  464. package/types/src/components/Tooltip.d.ts +20 -200
  465. package/types/src/components/axisLayout.d.ts +27 -0
  466. package/types/src/components/axisLayoutLabels.d.ts +42 -0
  467. package/types/src/components/axisLayoutScale.d.ts +12 -0
  468. package/types/src/components/axisRender.d.ts +65 -0
  469. package/types/src/components/colorScaleRender.d.ts +15 -0
  470. package/types/src/components/colorScaleScale.d.ts +19 -0
  471. package/types/src/components/index.d.ts +8 -8
  472. package/types/src/components/legendConfig.d.ts +7 -0
  473. package/types/src/components/legendRender.d.ts +16 -0
  474. package/types/src/components/timelineConfig.d.ts +6 -0
  475. package/types/src/components/timelineRender.d.ts +14 -0
  476. package/types/src/fluent.d.ts +94 -0
  477. package/types/src/shapes/Area.d.ts +15 -27
  478. package/types/src/shapes/Bar.d.ts +13 -33
  479. package/types/src/shapes/Box.d.ts +17 -56
  480. package/types/src/shapes/Circle.d.ts +11 -17
  481. package/types/src/shapes/Image.d.ts +18 -84
  482. package/types/src/shapes/Line.d.ts +12 -22
  483. package/types/src/shapes/Path.d.ts +12 -19
  484. package/types/src/shapes/Rect.d.ts +11 -27
  485. package/types/src/shapes/Shape.d.ts +46 -257
  486. package/types/src/shapes/Whisker.d.ts +15 -42
  487. package/types/src/shapes/buildLabelData.d.ts +50 -0
  488. package/types/src/shapes/emitLabels.d.ts +16 -0
  489. package/types/src/shapes/hitAreaNode.d.ts +19 -0
  490. package/types/src/shapes/sceneSort.d.ts +20 -0
  491. package/types/src/shapes/shapeConfig.d.ts +226 -0
  492. package/types/src/utils/BaseClass.d.ts +13 -7
  493. package/types/src/utils/D3Scale.d.ts +48 -0
  494. package/types/src/utils/D3plusConfig.d.ts +230 -3
  495. package/types/src/utils/configPrep.d.ts +7 -4
  496. package/types/src/utils/getProp.d.ts +3 -1
  497. package/types/src/utils/index.d.ts +3 -1
  498. package/types/src/utils/paintComponentScene.d.ts +28 -0
  499. package/types/umd-entry.d.ts +15 -0
  500. package/umd/d3plus-core.full.js +31148 -19470
  501. package/umd/d3plus-core.full.js.map +1 -1
  502. package/umd/d3plus-core.full.min.js +5315 -2939
  503. package/umd/d3plus-core.js +17379 -10575
  504. package/umd/d3plus-core.js.map +1 -1
  505. package/umd/d3plus-core.min.js +3470 -1873
  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 -1454
  565. package/es/src/components/Axis.js.map +0 -1
  566. package/es/src/components/AxisBottom.js.map +0 -1
  567. package/es/src/components/AxisLeft.js.map +0 -1
  568. package/es/src/components/AxisRight.js.map +0 -1
  569. package/es/src/components/AxisTop.js.map +0 -1
  570. package/es/src/components/ColorScale.js +0 -843
  571. package/es/src/components/ColorScale.js.map +0 -1
  572. package/es/src/components/Legend.js +0 -622
  573. package/es/src/components/Legend.js.map +0 -1
  574. package/es/src/components/Timeline.js +0 -695
  575. package/es/src/components/Timeline.js.map +0 -1
  576. /package/es/src/components/{AxisBottom.js → Axis/AxisBottom.js} +0 -0
  577. /package/es/src/components/{AxisLeft.js → Axis/AxisLeft.js} +0 -0
  578. /package/es/src/components/{AxisRight.js → Axis/AxisRight.js} +0 -0
  579. /package/es/src/components/{AxisTop.js → Axis/AxisTop.js} +0 -0
@@ -0,0 +1,691 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_without_holes(arr) {
7
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
8
+ }
9
+ function _assert_this_initialized(self) {
10
+ if (self === void 0) {
11
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
12
+ }
13
+ return self;
14
+ }
15
+ function _call_super(_this, derived, args) {
16
+ derived = _get_prototype_of(derived);
17
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
18
+ }
19
+ function _class_call_check(instance, Constructor) {
20
+ if (!(instance instanceof Constructor)) {
21
+ throw new TypeError("Cannot call a class as a function");
22
+ }
23
+ }
24
+ function _defineProperties(target, props) {
25
+ for(var i = 0; i < props.length; i++){
26
+ var descriptor = props[i];
27
+ descriptor.enumerable = descriptor.enumerable || false;
28
+ descriptor.configurable = true;
29
+ if ("value" in descriptor) descriptor.writable = true;
30
+ Object.defineProperty(target, descriptor.key, descriptor);
31
+ }
32
+ }
33
+ function _create_class(Constructor, protoProps, staticProps) {
34
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
35
+ if (staticProps) _defineProperties(Constructor, staticProps);
36
+ return Constructor;
37
+ }
38
+ function _define_property(obj, key, value) {
39
+ if (key in obj) {
40
+ Object.defineProperty(obj, key, {
41
+ value: value,
42
+ enumerable: true,
43
+ configurable: true,
44
+ writable: true
45
+ });
46
+ } else {
47
+ obj[key] = value;
48
+ }
49
+ return obj;
50
+ }
51
+ function _get_prototype_of(o) {
52
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
53
+ return o.__proto__ || Object.getPrototypeOf(o);
54
+ };
55
+ return _get_prototype_of(o);
56
+ }
57
+ function _inherits(subClass, superClass) {
58
+ if (typeof superClass !== "function" && superClass !== null) {
59
+ throw new TypeError("Super expression must either be null or a function");
60
+ }
61
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
62
+ constructor: {
63
+ value: subClass,
64
+ writable: true,
65
+ configurable: true
66
+ }
67
+ });
68
+ if (superClass) _set_prototype_of(subClass, superClass);
69
+ }
70
+ function _iterable_to_array(iter) {
71
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
72
+ }
73
+ function _non_iterable_spread() {
74
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
75
+ }
76
+ function _possible_constructor_return(self, call) {
77
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
78
+ return call;
79
+ }
80
+ return _assert_this_initialized(self);
81
+ }
82
+ function _set_prototype_of(o, p) {
83
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
84
+ o.__proto__ = p;
85
+ return o;
86
+ };
87
+ return _set_prototype_of(o, p);
88
+ }
89
+ function _to_consumable_array(arr) {
90
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
91
+ }
92
+ function _type_of(obj) {
93
+ "@swc/helpers - typeof";
94
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
95
+ }
96
+ function _unsupported_iterable_to_array(o, minLen) {
97
+ if (!o) return;
98
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
99
+ var n = Object.prototype.toString.call(o).slice(8, -1);
100
+ if (n === "Object" && o.constructor) n = o.constructor.name;
101
+ if (n === "Map" || n === "Set") return Array.from(n);
102
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
103
+ }
104
+ function _is_native_reflect_construct() {
105
+ try {
106
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
107
+ } catch (_) {}
108
+ return (_is_native_reflect_construct = function() {
109
+ return !!result;
110
+ })();
111
+ }
112
+ import { extent, min } from "d3-array";
113
+ import { select } from "d3-selection";
114
+ // @ts-ignore
115
+ import pkg from "open-color/open-color.js";
116
+ var openColor = pkg.theme;
117
+ import { colorContrast, colorDefaults } from "@d3plus/color";
118
+ import { assign, backgroundColor, date, elem, rtl as detectRTL } from "@d3plus/dom";
119
+ import { TextBox } from "../index.js";
120
+ import { measureAxis } from "./axisLayout.js";
121
+ import { axisToScene, buildTickData, calculateTicks, configureTickShape, isNegative, renderAxisTitle } from "./axisRender.js";
122
+ import { BaseClass, constant, paintComponentScene } from "../../utils/index.js";
123
+ import { installFluent } from "../../fluent.js";
124
+ /** Axis's fluent accessor schema. Config storage lives on `this.schema.<key>`. */ var axisSchema = [
125
+ {
126
+ key: "align",
127
+ coerce: "identity",
128
+ default: "middle"
129
+ },
130
+ {
131
+ key: "domain",
132
+ coerce: "identity",
133
+ default: [
134
+ 0,
135
+ 10
136
+ ]
137
+ },
138
+ {
139
+ key: "duration",
140
+ coerce: "identity",
141
+ default: 600
142
+ },
143
+ {
144
+ key: "grid",
145
+ coerce: "identity"
146
+ },
147
+ {
148
+ key: "gridLog",
149
+ coerce: "identity",
150
+ default: false
151
+ },
152
+ {
153
+ key: "gridSize",
154
+ coerce: "identity"
155
+ },
156
+ {
157
+ key: "height",
158
+ coerce: "identity",
159
+ default: 400
160
+ },
161
+ {
162
+ key: "labels",
163
+ coerce: "identity"
164
+ },
165
+ {
166
+ key: "labelOffset",
167
+ coerce: "identity",
168
+ default: false
169
+ },
170
+ {
171
+ key: "maxSize",
172
+ coerce: "identity"
173
+ },
174
+ {
175
+ key: "minSize",
176
+ coerce: "identity"
177
+ },
178
+ {
179
+ key: "padding",
180
+ coerce: "identity",
181
+ default: 5
182
+ },
183
+ {
184
+ key: "paddingInner",
185
+ coerce: "identity",
186
+ default: 0.1
187
+ },
188
+ {
189
+ key: "paddingOuter",
190
+ coerce: "identity",
191
+ default: 0.1
192
+ },
193
+ {
194
+ key: "range",
195
+ coerce: "identity"
196
+ },
197
+ {
198
+ key: "renderMode",
199
+ coerce: "identity",
200
+ default: "full"
201
+ },
202
+ {
203
+ key: "rounding",
204
+ coerce: "identity",
205
+ default: "none"
206
+ },
207
+ {
208
+ key: "roundingInsideMinPrefix",
209
+ coerce: "identity",
210
+ default: "< "
211
+ },
212
+ {
213
+ key: "roundingInsideMinSuffix",
214
+ coerce: "identity",
215
+ default: ""
216
+ },
217
+ {
218
+ key: "roundingInsideMaxPrefix",
219
+ coerce: "identity",
220
+ default: ""
221
+ },
222
+ {
223
+ key: "roundingInsideMaxSuffix",
224
+ coerce: "identity",
225
+ default: "+"
226
+ },
227
+ {
228
+ key: "scale",
229
+ coerce: "identity",
230
+ default: "linear"
231
+ },
232
+ {
233
+ key: "scalePadding",
234
+ coerce: "identity",
235
+ default: 0.5
236
+ },
237
+ {
238
+ key: "shape",
239
+ coerce: "identity",
240
+ default: "Line"
241
+ },
242
+ {
243
+ key: "tickFormat",
244
+ coerce: "identity"
245
+ },
246
+ {
247
+ key: "ticks",
248
+ coerce: "identity"
249
+ },
250
+ {
251
+ key: "tickSize",
252
+ coerce: "identity",
253
+ default: 8
254
+ },
255
+ {
256
+ key: "tickSuffix",
257
+ coerce: "identity",
258
+ default: "normal"
259
+ },
260
+ {
261
+ key: "timeLocale",
262
+ coerce: "identity",
263
+ default: undefined
264
+ },
265
+ {
266
+ key: "title",
267
+ coerce: "identity"
268
+ },
269
+ {
270
+ key: "width",
271
+ coerce: "identity",
272
+ default: 400
273
+ }
274
+ ];
275
+ var Axis = /*#__PURE__*/ function(BaseClass) {
276
+ "use strict";
277
+ _inherits(Axis, BaseClass);
278
+ function Axis() {
279
+ _class_call_check(this, Axis);
280
+ var _this;
281
+ _this = _call_super(this, Axis), _define_property(_this, "_select", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_labelRotation", void 0), _define_property(_this, "_margin", void 0), _define_property(_this, "_outerBounds", void 0), _define_property(_this, "_position", void 0), _define_property(_this, "_tickUnit", void 0), _define_property(_this, "_titleClass", void 0), // Stored render() intermediate (the compute-mode tick Shape) so toScene()
282
+ // can compose it natively. Type-only import avoids the components↔shapes
283
+ // runtime cycle.
284
+ _define_property(_this, "_tickShape", void 0), _define_property(_this, "_gridLineData", void 0), _define_property(_this, "_d3Scale", null), _define_property(_this, "_d3ScaleNegative", null), _define_property(_this, "_group", void 0), _define_property(_this, "_lastScale", void 0), _define_property(_this, "_availableTicks", void 0), _define_property(_this, "_visibleTicks", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_userFormat", void 0), // Standalone scene renderer (used when rendered on its own, not inside a
285
+ // Viz). Reused across re-renders by paintComponentScene().
286
+ _define_property(_this, "_sceneRenderer", void 0), // Subclasses (Timeline) that paint after their own post-super render work
287
+ // set this so Axis.render() doesn't paint a half-built scene.
288
+ _define_property(_this, "_managesOwnScenePaint", void 0);
289
+ installFluent(_this, axisSchema);
290
+ _this._data = [];
291
+ _this._labelRotation = false;
292
+ _this.schema.barConfig = {
293
+ stroke: function stroke() {
294
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
295
+ return colorContrast(bg);
296
+ },
297
+ "stroke-width": 1
298
+ };
299
+ _this.schema.gridConfig = {
300
+ stroke: function stroke() {
301
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
302
+ var contrast = colorContrast(bg);
303
+ return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
304
+ },
305
+ "stroke-width": 1
306
+ };
307
+ _this.orient("bottom");
308
+ _this._outerBounds = {
309
+ width: 0,
310
+ height: 0,
311
+ x: 0,
312
+ y: 0
313
+ };
314
+ _this.schema.shapeConfig = {
315
+ fill: function fill() {
316
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
317
+ return colorContrast(bg);
318
+ },
319
+ height: function height(d) {
320
+ return d.tick ? 8 : 0;
321
+ },
322
+ label: function label(d) {
323
+ return d.text;
324
+ },
325
+ labelBounds: function labelBounds(d) {
326
+ return d.labelBounds;
327
+ },
328
+ labelConfig: {
329
+ fontColor: function fontColor() {
330
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
331
+ return colorContrast(bg);
332
+ },
333
+ fontResize: false,
334
+ fontSize: constant(12),
335
+ padding: 5,
336
+ textAnchor: function textAnchor() {
337
+ var rtl = detectRTL();
338
+ return _this.schema.orient === "left" ? rtl ? "start" : "end" : _this.schema.orient === "right" ? rtl ? "end" : "start" : _this._labelRotation ? _this.schema.orient === "bottom" ? "end" : "start" : "middle";
339
+ },
340
+ verticalAlign: function verticalAlign() {
341
+ return _this.schema.orient === "bottom" ? "top" : _this.schema.orient === "top" ? _this._labelRotation ? "top" : "bottom" : "middle";
342
+ }
343
+ },
344
+ r: function r(d) {
345
+ return d.tick ? 4 : 0;
346
+ },
347
+ stroke: function stroke() {
348
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
349
+ return colorContrast(bg);
350
+ },
351
+ strokeWidth: 1,
352
+ width: function width(d) {
353
+ return d.tick ? 8 : 0;
354
+ }
355
+ };
356
+ _this._tickUnit = 0;
357
+ _this._titleClass = new TextBox();
358
+ _this.schema.titleConfig = {
359
+ fontColor: function fontColor() {
360
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
361
+ return colorContrast(bg);
362
+ },
363
+ fontSize: 12,
364
+ textAnchor: "middle"
365
+ };
366
+ _this._margin = {
367
+ top: 0,
368
+ right: 0,
369
+ bottom: 0,
370
+ left: 0
371
+ };
372
+ _this._availableTicks = [];
373
+ _this._visibleTicks = [];
374
+ return _this;
375
+ }
376
+ _create_class(Axis, [
377
+ {
378
+ /**
379
+ Returns the scale's domain, taking into account negative and positive log scales.
380
+ @private
381
+ */ key: "_getDomain",
382
+ value: function _getDomain() {
383
+ var ticks = [];
384
+ if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.domain();
385
+ if (this._d3Scale) ticks = ticks.concat(this._d3Scale.domain());
386
+ var domain = [
387
+ "band",
388
+ "ordinal",
389
+ "point"
390
+ ].includes(this.schema.scale) ? ticks : extent(ticks);
391
+ return ticks[0] > ticks[1] ? domain.reverse() : domain;
392
+ }
393
+ },
394
+ {
395
+ /**
396
+ Returns a value's scale position, taking into account negative and positive log scales.
397
+ @param d @private
398
+ */ key: "_getPosition",
399
+ value: function _getPosition(d) {
400
+ if (this.schema.scale === "log") {
401
+ if (d === 0) return (this._d3Scale || this._d3ScaleNegative).range()[this._d3Scale ? 0 : 1];
402
+ var scale = isNegative(d) ? this._d3ScaleNegative : this._d3Scale;
403
+ return scale ? scale(d) : 0;
404
+ }
405
+ return this._d3Scale ? this._d3Scale(d) : 0;
406
+ }
407
+ },
408
+ {
409
+ /**
410
+ Returns the scale's range, taking into account negative and positive log scales.
411
+ @private
412
+ */ key: "_getRange",
413
+ value: function _getRange() {
414
+ var ticks = [];
415
+ if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.range();
416
+ if (this._d3Scale) ticks = ticks.concat(this._d3Scale.range());
417
+ return ticks[0] > ticks[1] ? extent(ticks).reverse() : extent(ticks);
418
+ }
419
+ },
420
+ {
421
+ /**
422
+ Returns the scale's labels, taking into account negative and positive log scales.
423
+ @private
424
+ */ key: "_getLabels",
425
+ value: function _getLabels() {
426
+ var labels = [];
427
+ if (this._d3ScaleNegative) labels = labels.concat(calculateTicks.bind(this)(this._d3ScaleNegative, false));
428
+ if (this._d3Scale) labels = labels.concat(calculateTicks.bind(this)(this._d3Scale, false));
429
+ if (this.schema.scale === "log") {
430
+ var diverging = labels.some(function(d) {
431
+ return isNegative(d);
432
+ }) && labels.some(function(d) {
433
+ return d > 0;
434
+ });
435
+ if (diverging) {
436
+ var minValue = min(_to_consumable_array(this._d3ScaleNegative.domain().map(Math.abs)).concat(_to_consumable_array(this._d3Scale.domain())));
437
+ // add minValue if it does not exist, and should
438
+ if (!labels.includes(minValue)) {
439
+ labels.splice(labels.findIndex(function(d) {
440
+ return d > minValue;
441
+ }), 0, minValue);
442
+ }
443
+ // remove -minValue if minValue also exists
444
+ if (labels.includes(-minValue) && labels.includes(minValue)) {
445
+ labels.splice(labels.indexOf(-minValue), 1);
446
+ }
447
+ }
448
+ }
449
+ return labels;
450
+ }
451
+ },
452
+ {
453
+ /**
454
+ Returns the scale's ticks, taking into account negative and positive log scales.
455
+ @private
456
+ */ key: "_getTicks",
457
+ value: function _getTicks() {
458
+ if ([
459
+ "band",
460
+ "ordinal",
461
+ "point",
462
+ "time"
463
+ ].includes(this.schema.scale) && this._data.length && this._data.length < this.schema.width / 4) {
464
+ return this.schema.scale === "time" ? this._data.map(function(d) {
465
+ return date(d);
466
+ }) : this._data;
467
+ }
468
+ var ticks = [];
469
+ if (this._d3ScaleNegative) ticks = ticks.concat(calculateTicks.bind(this)(this._d3ScaleNegative, true));
470
+ if (this._d3Scale) ticks = ticks.concat(calculateTicks.bind(this)(this._d3Scale, true));
471
+ if (this.schema.scale === "log" && ticks.includes(-1) && ticks.includes(1)) ticks.splice(ticks.indexOf(-1), 1);
472
+ return ticks;
473
+ }
474
+ },
475
+ {
476
+ /**
477
+ Produces a backend-agnostic scene graph for this axis with no DOM dependency:
478
+ gridlines + domain bar emitted natively, tick marks/labels composed from the
479
+ tick Shape's toScene(), and the title from the title TextBox's toScene().
480
+ */ key: "toScene",
481
+ value: function toScene() {
482
+ return axisToScene(this);
483
+ }
484
+ },
485
+ {
486
+ /**
487
+ Renders the current Axis to the page.
488
+ @param callback Optional callback invoked after rendering completes.
489
+ */ key: "render",
490
+ value: function render(callback) {
491
+ /**
492
+ * In `renderMode("compute")` the axis is scene-only — the caller will
493
+ * read `toScene()`, not the DOM. We skip creating any SVG element at
494
+ * all: the elem() calls later in render() are no-ops when `_select`
495
+ * is undefined (d3-selection.select(undefined) yields a null-wrapped
496
+ * selection whose .append/.select on it short-circuit). This also
497
+ * fixes the "every Axis instance holds a detached svg forever" leak
498
+ * — Plot has four long-lived axes and was accumulating 4 detached
499
+ * SVGs per chart instance.
500
+ *
501
+ * In `renderMode("full")` with `_select` unset, we create a
502
+ * body-attached svg so standalone `new Axis().render()` works.
503
+ */ if (this._select === void 0 && this.schema.renderMode !== "compute") {
504
+ // Timeline (`_managesOwnScenePaint`) paints its own brush + play-button
505
+ // DOM into this root, so it needs a real <svg>. A plain Axis paints
506
+ // through `paintComponentScene`, whose renderer creates the single <svg> —
507
+ // so mount it into a <div>, since an <svg> container would nest a second.
508
+ if (this._managesOwnScenePaint) {
509
+ var svgNode = document.createElementNS("http://www.w3.org/2000/svg", "svg");
510
+ svgNode.setAttribute("width", "".concat(this.schema.width, "px"));
511
+ svgNode.setAttribute("height", "".concat(this.schema.height, "px"));
512
+ document.body.appendChild(svgNode);
513
+ this.select(svgNode);
514
+ } else {
515
+ var div = document.createElement("div");
516
+ document.body.appendChild(div);
517
+ this.select(div);
518
+ }
519
+ }
520
+ // Pure layout pass. `measureAxis(this)` constructs the d3 scale, picks
521
+ // ticks, runs label textWrap, and computes outerBounds — no DOM, no
522
+ // rendering. It mutates `this._d3Scale`/`_outerBounds`/`_margin` etc. for
523
+ // consumers reading off the instance, and returns the local layout
524
+ // artifacts the paint phase below consumes. The standalone `measureAxis`
525
+ // lives in axisLayout.ts so Plot test-axes can drive it without a class
526
+ // instance at all (any AxisLike object works).
527
+ var measure = measureAxis(this);
528
+ var ticks = measure.ticks, labels = measure.labels;
529
+ var parent = this._select;
530
+ // Skip the wrapper group only when in compute mode WITHOUT a real
531
+ // `_select` (the standalone compute path used by Plot's axes — toScene
532
+ // is the consumer, no DOM mount needed). When `_select` is set, the
533
+ // group still mounts because consumers (Timeline extends Axis and
534
+ // calls `elem("g.brushGroup", {parent: this._group})` after super
535
+ // render) expect it.
536
+ var standaloneCompute = this.schema.renderMode === "compute" && (this._select === void 0 || this._select === null || typeof this._select.node === "function" && this._select.node() === null);
537
+ var group = standaloneCompute ? null : elem("g#d3plus-Axis-".concat(this._uuid), {
538
+ parent: parent
539
+ });
540
+ this._group = group;
541
+ var gridLineData = (this.schema.gridSize !== 0 ? this.schema.grid || this.schema.scale === "log" && !this.schema.gridLog ? labels : ticks : []).map(function(d) {
542
+ return {
543
+ id: d
544
+ };
545
+ });
546
+ // Scene-only: grid lines are emitted natively by toScene() via
547
+ // _gridLinePoints() from this._gridLineData. No <line> DOM.
548
+ this._gridLineData = gridLineData;
549
+ // Tick marks/labels and the title are composed in compute mode by
550
+ // axisRender helpers; toScene() reads the resulting _tickShape/_titleClass.
551
+ // The domain bar is emitted natively by toScene() via _barLinePoints().
552
+ var tickData = buildTickData(this, measure);
553
+ configureTickShape(this, tickData);
554
+ renderAxisTitle(this, measure, group);
555
+ this._lastScale = this._getPosition.bind(this);
556
+ // Standalone render: paint the scene into the user's `_select`. Inside a
557
+ // Viz the axis runs in compute mode and the Viz composes its toScene(), so
558
+ // skip both compute mode and subclasses that paint themselves (Timeline).
559
+ if (this.schema.renderMode !== "compute" && !this._managesOwnScenePaint) paintComponentScene(this);
560
+ if (callback) setTimeout(callback, this.schema.duration + 100);
561
+ return this;
562
+ }
563
+ },
564
+ {
565
+ key: "barConfig",
566
+ value: function barConfig(_) {
567
+ return arguments.length ? (this.schema.barConfig = Object.assign(this.schema.barConfig, _), this) : this.schema.barConfig;
568
+ }
569
+ },
570
+ {
571
+ key: "data",
572
+ value: function data(_) {
573
+ return arguments.length ? (this._data = _, this) : this._data;
574
+ }
575
+ },
576
+ {
577
+ key: "gridConfig",
578
+ value: function gridConfig(_) {
579
+ return arguments.length ? (this.schema.gridConfig = Object.assign(this.schema.gridConfig, _), this) : this.schema.gridConfig;
580
+ }
581
+ },
582
+ {
583
+ key: "labelRotation",
584
+ value: function labelRotation(_) {
585
+ return arguments.length ? (this._labelRotation = _, this) : this._labelRotation;
586
+ }
587
+ },
588
+ {
589
+ key: "orient",
590
+ value: function orient(_) {
591
+ if (arguments.length) {
592
+ var horizontal = [
593
+ "top",
594
+ "bottom"
595
+ ].includes(_), opps = {
596
+ top: "bottom",
597
+ right: "left",
598
+ bottom: "top",
599
+ left: "right"
600
+ };
601
+ this._position = {
602
+ horizontal: horizontal,
603
+ width: horizontal ? "width" : "height",
604
+ height: horizontal ? "height" : "width",
605
+ x: horizontal ? "x" : "y",
606
+ y: horizontal ? "y" : "x",
607
+ opposite: opps[_]
608
+ };
609
+ return this.schema.orient = _, this;
610
+ }
611
+ return this.schema.orient;
612
+ }
613
+ },
614
+ {
615
+ /**
616
+ Returns the outer bounds of the axis content. Must be called after rendering.
617
+ @example
618
+ {"width": 180, "height": 24, "x": 10, "y": 20}
619
+ */ key: "outerBounds",
620
+ value: function outerBounds() {
621
+ return this._outerBounds;
622
+ }
623
+ },
624
+ {
625
+ /**
626
+ Runs the layout pass only — scale construction, tick selection, label
627
+ textWrap, and outerBounds — with **no DOM access**. After it returns,
628
+ `outerBounds()` / `_d3Scale` / `_getPosition()` are populated exactly as
629
+ they would be after a full `render()`, but no `<svg>`, `<g>`, tick shapes,
630
+ or label TextBoxes are created. Answers "how much room will this axis
631
+ need?" without rendering; Plot uses it to size its test-axes. Delegates to
632
+ the standalone `measureAxis(axis)` in axisLayout.ts, so callers can run
633
+ layout without owning an Axis instance.
634
+ */ key: "measure",
635
+ value: function measure() {
636
+ measureAxis(this);
637
+ return this;
638
+ }
639
+ },
640
+ {
641
+ key: "select",
642
+ value: function select1(_) {
643
+ if (!arguments.length) return this._select;
644
+ if (_ == null) {
645
+ this._select = undefined;
646
+ } else {
647
+ this._select = select(_);
648
+ }
649
+ return this;
650
+ }
651
+ },
652
+ {
653
+ key: "shapeConfig",
654
+ value: function shapeConfig(_) {
655
+ return arguments.length ? (this.schema.shapeConfig = assign(this.schema.shapeConfig, _), this) : this.schema.shapeConfig;
656
+ }
657
+ },
658
+ {
659
+ key: "titleConfig",
660
+ value: function titleConfig(_) {
661
+ return arguments.length ? (this.schema.titleConfig = Object.assign(this.schema.titleConfig, _), this) : this.schema.titleConfig;
662
+ }
663
+ }
664
+ ]);
665
+ return Axis;
666
+ }(BaseClass);
667
+ /**
668
+ Creates an SVG scale based on an array of data.
669
+ */ export { Axis as default };
670
+ export function computeAxisLayout(axis) {
671
+ // Free function from axisLayout.ts. Mutates `axis` (so instance-slot
672
+ // readers stay in sync) and returns the layout artifacts; we re-shape
673
+ // its result + the mutated instance fields into the stable `AxisLayout` API.
674
+ measureAxis(axis);
675
+ return {
676
+ bounds: axis._outerBounds,
677
+ d3Scale: axis._d3Scale,
678
+ d3ScaleNegative: axis._d3ScaleNegative,
679
+ getPosition: function getPosition(d) {
680
+ return axis._getPosition(d);
681
+ },
682
+ availableTicks: axis._availableTicks,
683
+ visibleTicks: axis._visibleTicks,
684
+ margin: axis._margin
685
+ };
686
+ }
687
+ // Re-export the standalone `measureAxis` and its result type so consumers
688
+ // can import them from the same module as the Axis class.
689
+ export { measureAxis } from "./axisLayout.js";
690
+
691
+ //# sourceMappingURL=Axis.js.map