@d3plus/core 4.5.0 → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/README.md +3930 -2032
  2. package/es/index.js +3 -3
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +11 -1
  5. package/es/internal.js.map +1 -1
  6. package/es/src/charts/BarChart/index.js +8 -1
  7. package/es/src/charts/BarChart/index.js.map +1 -1
  8. package/es/src/charts/BoxWhisker/index.js +5 -0
  9. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  10. package/es/src/charts/Chord/emit.js +55 -3
  11. package/es/src/charts/Chord/emit.js.map +1 -1
  12. package/es/src/charts/Chord/index.js +17 -0
  13. package/es/src/charts/Chord/index.js.map +1 -1
  14. package/es/src/charts/Geomap/applyLayout.js +20 -11
  15. package/es/src/charts/Geomap/applyLayout.js.map +1 -1
  16. package/es/src/charts/Geomap/index.js +8 -2
  17. package/es/src/charts/Geomap/index.js.map +1 -1
  18. package/es/src/charts/Histogram/binData.js +225 -0
  19. package/es/src/charts/Histogram/binData.js.map +1 -0
  20. package/es/src/charts/Histogram/index.js +271 -0
  21. package/es/src/charts/Histogram/index.js.map +1 -0
  22. package/es/src/charts/Matrix/emit.js +5 -4
  23. package/es/src/charts/Matrix/emit.js.map +1 -1
  24. package/es/src/charts/Network/applyLayout.js +52 -4
  25. package/es/src/charts/Network/applyLayout.js.map +1 -1
  26. package/es/src/charts/Network/emit.js +4 -4
  27. package/es/src/charts/Network/emit.js.map +1 -1
  28. package/es/src/charts/Network/index.js +10 -1
  29. package/es/src/charts/Network/index.js.map +1 -1
  30. package/es/src/charts/Pack/emit.js +42 -7
  31. package/es/src/charts/Pack/emit.js.map +1 -1
  32. package/es/src/charts/Pack/index.js +15 -0
  33. package/es/src/charts/Pack/index.js.map +1 -1
  34. package/es/src/charts/Pie/applyLayout.js +20 -2
  35. package/es/src/charts/Pie/applyLayout.js.map +1 -1
  36. package/es/src/charts/Pie/emit.js +275 -35
  37. package/es/src/charts/Pie/emit.js.map +1 -1
  38. package/es/src/charts/Pie/index.js +48 -1
  39. package/es/src/charts/Pie/index.js.map +1 -1
  40. package/es/src/charts/Plot/discreteSpan.js +42 -0
  41. package/es/src/charts/Plot/discreteSpan.js.map +1 -0
  42. package/es/src/charts/Plot/draw.js +3 -1
  43. package/es/src/charts/Plot/draw.js.map +1 -1
  44. package/es/src/charts/Plot/index.js +143 -14
  45. package/es/src/charts/Plot/index.js.map +1 -1
  46. package/es/src/charts/Plot/insetRegion.js +21 -0
  47. package/es/src/charts/Plot/insetRegion.js.map +1 -0
  48. package/es/src/charts/Plot/pipeline.js +47 -20
  49. package/es/src/charts/Plot/pipeline.js.map +1 -1
  50. package/es/src/charts/Plot/pipelineDomains.js +84 -8
  51. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  52. package/es/src/charts/Plot/shapeDefaults.js +3 -3
  53. package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
  54. package/es/src/charts/Plot/sharedHover.js +532 -0
  55. package/es/src/charts/Plot/sharedHover.js.map +1 -0
  56. package/es/src/charts/Plot/sharedHoverScene.js +230 -0
  57. package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
  58. package/es/src/charts/Plot/sharedTooltip.js +183 -0
  59. package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
  60. package/es/src/charts/Plot/stackShareLabels.js +137 -0
  61. package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
  62. package/es/src/charts/Plot/stackShareTooltip.js +31 -0
  63. package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
  64. package/es/src/charts/Plot/trendLines.js +469 -0
  65. package/es/src/charts/Plot/trendLines.js.map +1 -0
  66. package/es/src/charts/Plot/trendProjection.js +120 -0
  67. package/es/src/charts/Plot/trendProjection.js.map +1 -0
  68. package/es/src/charts/Plot/trendScene.js +234 -0
  69. package/es/src/charts/Plot/trendScene.js.map +1 -0
  70. package/es/src/charts/Plot/trendTooltip.js +222 -0
  71. package/es/src/charts/Plot/trendTooltip.js.map +1 -0
  72. package/es/src/charts/Priestley/emit.js +34 -6
  73. package/es/src/charts/Priestley/emit.js.map +1 -1
  74. package/es/src/charts/Radar/index.js +15 -2
  75. package/es/src/charts/Radar/index.js.map +1 -1
  76. package/es/src/charts/RadialMatrix/emit.js +4 -4
  77. package/es/src/charts/RadialMatrix/emit.js.map +1 -1
  78. package/es/src/charts/RadialMatrix/index.js +17 -1
  79. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  80. package/es/src/charts/Rings/applyLayout.js +72 -116
  81. package/es/src/charts/Rings/applyLayout.js.map +1 -1
  82. package/es/src/charts/Rings/emit.js +2 -3
  83. package/es/src/charts/Rings/emit.js.map +1 -1
  84. package/es/src/charts/Rings/index.js +18 -3
  85. package/es/src/charts/Rings/index.js.map +1 -1
  86. package/es/src/charts/Rings/ringsSizing.js +189 -0
  87. package/es/src/charts/Rings/ringsSizing.js.map +1 -0
  88. package/es/src/charts/Sankey/index.js +2 -0
  89. package/es/src/charts/Sankey/index.js.map +1 -1
  90. package/es/src/charts/StackedArea/index.js +8 -1
  91. package/es/src/charts/StackedArea/index.js.map +1 -1
  92. package/es/src/charts/Tree/emit.js +2 -2
  93. package/es/src/charts/Tree/emit.js.map +1 -1
  94. package/es/src/charts/Tree/index.js +7 -3
  95. package/es/src/charts/Tree/index.js.map +1 -1
  96. package/es/src/charts/Treemap/emit.js +58 -6
  97. package/es/src/charts/Treemap/emit.js.map +1 -1
  98. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  99. package/es/src/charts/definition/makeChart.js +14 -1
  100. package/es/src/charts/definition/makeChart.js.map +1 -1
  101. package/es/src/charts/drawSteps/backControl.js +17 -2
  102. package/es/src/charts/drawSteps/backControl.js.map +1 -1
  103. package/es/src/charts/drawSteps/bottomRightControls.js +196 -0
  104. package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
  105. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +292 -0
  106. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
  107. package/es/src/charts/drawSteps/minimap.js +34 -9
  108. package/es/src/charts/drawSteps/minimap.js.map +1 -1
  109. package/es/src/charts/drawSteps/searchControlsMarkup.js +15 -38
  110. package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -1
  111. package/es/src/charts/drawSteps/zoomControls.js +3 -0
  112. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  113. package/es/src/charts/events/click.legend.js +10 -5
  114. package/es/src/charts/events/click.legend.js.map +1 -1
  115. package/es/src/charts/events/click.shape.js +24 -1
  116. package/es/src/charts/events/click.shape.js.map +1 -1
  117. package/es/src/charts/events/mouseenter.js +3 -0
  118. package/es/src/charts/events/mouseenter.js.map +1 -1
  119. package/es/src/charts/events/mouseleave.js +3 -0
  120. package/es/src/charts/events/mouseleave.js.map +1 -1
  121. package/es/src/charts/events/mousemove.shape.js +10 -1
  122. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  123. package/es/src/charts/features/axes.js +4 -1
  124. package/es/src/charts/features/axes.js.map +1 -1
  125. package/es/src/charts/features/emitHelpers.js +43 -5
  126. package/es/src/charts/features/emitHelpers.js.map +1 -1
  127. package/es/src/charts/features/features.js +3 -104
  128. package/es/src/charts/features/features.js.map +1 -1
  129. package/es/src/charts/features/featuresColorScale.js +161 -0
  130. package/es/src/charts/features/featuresColorScale.js.map +1 -0
  131. package/es/src/charts/features/featuresLegend.js +155 -34
  132. package/es/src/charts/features/featuresLegend.js.map +1 -1
  133. package/es/src/charts/features/insetState.js +174 -0
  134. package/es/src/charts/features/insetState.js.map +1 -0
  135. package/es/src/charts/features/plotPaint.js +51 -24
  136. package/es/src/charts/features/plotPaint.js.map +1 -1
  137. package/es/src/charts/features/sceneBounds.js +271 -0
  138. package/es/src/charts/features/sceneBounds.js.map +1 -0
  139. package/es/src/charts/features/shapeEmit.js +20 -2
  140. package/es/src/charts/features/shapeEmit.js.map +1 -1
  141. package/es/src/charts/features/tooltipSwatch.js +73 -0
  142. package/es/src/charts/features/tooltipSwatch.js.map +1 -0
  143. package/es/src/charts/index.js +1 -0
  144. package/es/src/charts/index.js.map +1 -1
  145. package/es/src/charts/pipeline/drillMorph.js +159 -0
  146. package/es/src/charts/pipeline/drillMorph.js.map +1 -0
  147. package/es/src/charts/pipeline/insetPlacement.js +406 -0
  148. package/es/src/charts/pipeline/insetPlacement.js.map +1 -0
  149. package/es/src/charts/pipeline/runChartDraw.js +35 -1
  150. package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
  151. package/es/src/charts/pipeline/runVizPipeline.js +22 -3
  152. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  153. package/es/src/charts/pipeline/vizDrawPure.js +20 -0
  154. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  155. package/es/src/charts/viz/Viz.js +82 -11
  156. package/es/src/charts/viz/Viz.js.map +1 -1
  157. package/es/src/charts/viz/VizBase.js +29 -1
  158. package/es/src/charts/viz/VizBase.js.map +1 -1
  159. package/es/src/charts/viz/VizBaseConfig.js +25 -21
  160. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  161. package/es/src/charts/viz/interactionOpacity.js +21 -13
  162. package/es/src/charts/viz/interactionOpacity.js.map +1 -1
  163. package/es/src/charts/viz/linkGroup.js +386 -0
  164. package/es/src/charts/viz/linkGroup.js.map +1 -0
  165. package/es/src/charts/viz/ordinalColor.js +2 -2
  166. package/es/src/charts/viz/ordinalColor.js.map +1 -1
  167. package/es/src/charts/viz/sceneRows.js +33 -0
  168. package/es/src/charts/viz/sceneRows.js.map +1 -0
  169. package/es/src/charts/viz/vizDefaults.js +39 -15
  170. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  171. package/es/src/charts/viz/vizRender.js +54 -4
  172. package/es/src/charts/viz/vizRender.js.map +1 -1
  173. package/es/src/charts/viz/vizTypes.js.map +1 -1
  174. package/es/src/charts/viz/vizVisibility.js +145 -0
  175. package/es/src/charts/viz/vizVisibility.js.map +1 -0
  176. package/es/src/components/Axis/Axis.js +8 -8
  177. package/es/src/components/Axis/Axis.js.map +1 -1
  178. package/es/src/components/Axis/AxisBottom.js +1 -1
  179. package/es/src/components/Axis/AxisBottom.js.map +1 -1
  180. package/es/src/components/Axis/AxisLeft.js +1 -1
  181. package/es/src/components/Axis/AxisLeft.js.map +1 -1
  182. package/es/src/components/Axis/AxisRight.js +1 -1
  183. package/es/src/components/Axis/AxisRight.js.map +1 -1
  184. package/es/src/components/Axis/AxisTop.js +1 -1
  185. package/es/src/components/Axis/AxisTop.js.map +1 -1
  186. package/es/src/components/Axis/axisLayoutLabels.js +13 -1
  187. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
  188. package/es/src/components/ColorScale/ColorScale.js +11 -11
  189. package/es/src/components/ColorScale/ColorScale.js.map +1 -1
  190. package/es/src/components/ColorScale/colorScaleScale.js +22 -10
  191. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
  192. package/es/src/components/Legend/Legend.js +8 -5
  193. package/es/src/components/Legend/Legend.js.map +1 -1
  194. package/es/src/components/Legend/legendConfig.js +3 -2
  195. package/es/src/components/Legend/legendConfig.js.map +1 -1
  196. package/es/src/components/Legend/legendRender.js +70 -26
  197. package/es/src/components/Legend/legendRender.js.map +1 -1
  198. package/es/src/components/SizeLegend/SizeLegend.js +411 -0
  199. package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
  200. package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
  201. package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
  202. package/es/src/components/TextBox.js +1 -1
  203. package/es/src/components/TextBox.js.map +1 -1
  204. package/es/src/components/Timeline/timelineConfig.js +8 -4
  205. package/es/src/components/Timeline/timelineConfig.js.map +1 -1
  206. package/es/src/components/Timeline/timelineRender.js +1 -2
  207. package/es/src/components/Timeline/timelineRender.js.map +1 -1
  208. package/es/src/components/Tooltip.js +27 -7
  209. package/es/src/components/Tooltip.js.map +1 -1
  210. package/es/src/components/index.js +1 -0
  211. package/es/src/components/index.js.map +1 -1
  212. package/es/src/shapes/Bar.js +1 -1
  213. package/es/src/shapes/Bar.js.map +1 -1
  214. package/es/src/shapes/Box.js +5 -3
  215. package/es/src/shapes/Box.js.map +1 -1
  216. package/es/src/shapes/Rect.js +1 -1
  217. package/es/src/shapes/Rect.js.map +1 -1
  218. package/es/src/shapes/Shape.js +10 -37
  219. package/es/src/shapes/Shape.js.map +1 -1
  220. package/es/src/shapes/Whisker.js +4 -3
  221. package/es/src/shapes/Whisker.js.map +1 -1
  222. package/es/src/shapes/textureKey.js +104 -0
  223. package/es/src/shapes/textureKey.js.map +1 -0
  224. package/es/src/shapes/validateShapeConfig.js +141 -0
  225. package/es/src/shapes/validateShapeConfig.js.map +1 -0
  226. package/es/src/utils/BaseClass.js +134 -4
  227. package/es/src/utils/BaseClass.js.map +1 -1
  228. package/es/src/utils/D3plusConfig.js.map +1 -1
  229. package/es/src/utils/configDefault.js +17 -0
  230. package/es/src/utils/configDefault.js.map +1 -0
  231. package/es/src/utils/configPrep.js +2 -1
  232. package/es/src/utils/configPrep.js.map +1 -1
  233. package/es/src/utils/configWarnings.js +37 -0
  234. package/es/src/utils/configWarnings.js.map +1 -0
  235. package/es/src/utils/index.js +1 -0
  236. package/es/src/utils/index.js.map +1 -1
  237. package/package.json +12 -10
  238. package/types/index.d.ts +5 -4
  239. package/types/internal.d.ts +15 -1
  240. package/types/src/charts/BarChart/index.d.ts +2 -1
  241. package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
  242. package/types/src/charts/Histogram/binData.d.ts +37 -0
  243. package/types/src/charts/Histogram/index.d.ts +14 -0
  244. package/types/src/charts/Network/applyLayout.d.ts +8 -0
  245. package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
  246. package/types/src/charts/Plot/index.d.ts +47 -0
  247. package/types/src/charts/Plot/insetRegion.d.ts +4 -0
  248. package/types/src/charts/Plot/pipeline.d.ts +14 -0
  249. package/types/src/charts/Plot/sharedHover.d.ts +84 -0
  250. package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
  251. package/types/src/charts/Plot/sharedTooltip.d.ts +36 -0
  252. package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
  253. package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
  254. package/types/src/charts/Plot/trendLines.d.ts +90 -0
  255. package/types/src/charts/Plot/trendProjection.d.ts +28 -0
  256. package/types/src/charts/Plot/trendScene.d.ts +19 -0
  257. package/types/src/charts/Plot/trendTooltip.d.ts +30 -0
  258. package/types/src/charts/Rings/applyLayout.d.ts +9 -0
  259. package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
  260. package/types/src/charts/StackedArea/index.d.ts +2 -1
  261. package/types/src/charts/definition/ChartDefinition.d.ts +39 -0
  262. package/types/src/charts/definition/makeChart.d.ts +2 -1
  263. package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
  264. package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +110 -0
  265. package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +7 -5
  266. package/types/src/charts/features/emitHelpers.d.ts +18 -4
  267. package/types/src/charts/features/features.d.ts +1 -8
  268. package/types/src/charts/features/featuresColorScale.d.ts +24 -0
  269. package/types/src/charts/features/featuresLegend.d.ts +15 -0
  270. package/types/src/charts/features/insetState.d.ts +95 -0
  271. package/types/src/charts/features/plotPaint.d.ts +25 -0
  272. package/types/src/charts/features/sceneBounds.d.ts +18 -0
  273. package/types/src/charts/features/tooltipSwatch.d.ts +31 -0
  274. package/types/src/charts/index.d.ts +1 -0
  275. package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
  276. package/types/src/charts/pipeline/insetPlacement.d.ts +45 -0
  277. package/types/src/charts/pipeline/runVizPipeline.d.ts +10 -1
  278. package/types/src/charts/viz/Viz.d.ts +27 -2
  279. package/types/src/charts/viz/VizBase.d.ts +13 -0
  280. package/types/src/charts/viz/VizBaseConfig.d.ts +11 -11
  281. package/types/src/charts/viz/linkGroup.d.ts +96 -0
  282. package/types/src/charts/viz/sceneRows.d.ts +13 -0
  283. package/types/src/charts/viz/vizTypes.d.ts +164 -3
  284. package/types/src/charts/viz/vizVisibility.d.ts +34 -0
  285. package/types/src/components/Axis/AxisBottom.d.ts +1 -1
  286. package/types/src/components/Axis/AxisLeft.d.ts +1 -1
  287. package/types/src/components/Axis/AxisRight.d.ts +1 -1
  288. package/types/src/components/Axis/AxisTop.d.ts +1 -1
  289. package/types/src/components/ColorScale/ColorScale.d.ts +4 -4
  290. package/types/src/components/Legend/legendRender.d.ts +9 -3
  291. package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
  292. package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
  293. package/types/src/components/TextBox.d.ts +1 -1
  294. package/types/src/components/Tooltip.d.ts +18 -3
  295. package/types/src/components/index.d.ts +1 -0
  296. package/types/src/shapes/Bar.d.ts +1 -1
  297. package/types/src/shapes/Box.d.ts +1 -1
  298. package/types/src/shapes/Rect.d.ts +1 -1
  299. package/types/src/shapes/Whisker.d.ts +1 -1
  300. package/types/src/shapes/textureKey.d.ts +9 -0
  301. package/types/src/shapes/validateShapeConfig.d.ts +10 -0
  302. package/types/src/utils/BaseClass.d.ts +15 -1
  303. package/types/src/utils/D3plusConfig.d.ts +139 -0
  304. package/types/src/utils/configDefault.d.ts +11 -0
  305. package/types/src/utils/configWarnings.d.ts +28 -0
  306. package/types/src/utils/index.d.ts +2 -1
  307. package/umd/d3plus-core.full.js +9325 -3024
  308. package/umd/d3plus-core.full.js.map +1 -1
  309. package/umd/d3plus-core.full.min.js +3348 -1727
  310. package/umd/d3plus-core.js +5412 -831
  311. package/umd/d3plus-core.js.map +1 -1
  312. package/umd/d3plus-core.min.js +2199 -948
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Axis/Axis.ts"],"sourcesContent":["import {extent, min} from \"d3-array\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n// @ts-ignore\nimport pkg from \"open-color/open-color.js\";\nconst {theme: openColor} = pkg;\n\nimport {colorContrast, colorDefaults} from \"@d3plus/color\";\nimport {assign, backgroundColor, date, elem, rtl as detectRTL} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport type {GroupNode} from \"@d3plus/render\";\nimport type {SvgRenderer} from \"@d3plus/render\";\n\nimport {TextBox} from \"../index.js\";\nimport type Shape from \"../../shapes/Shape.js\";\nimport {measureAxis} from \"./axisLayout.js\";\nimport {\n axisToScene,\n buildTickData,\n calculateTicks,\n configureTickShape,\n isNegative,\n renderAxisTitle,\n} from \"./axisRender.js\";\nimport {BaseClass, constant, paintComponentScene} from \"../../utils/index.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\nimport type {ConfigField} from \"../../fluent.js\";\n\n/** Axis's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst axisSchema: ConfigField[] = [\n {key: \"align\", coerce: \"identity\", default: \"middle\"},\n {key: \"domain\", coerce: \"identity\", default: [0, 10]},\n {key: \"domainTicks\", coerce: \"identity\", default: true},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"grid\", coerce: \"identity\"},\n {key: \"gridLog\", coerce: \"identity\", default: false},\n {key: \"gridSize\", coerce: \"identity\"},\n {key: \"height\", coerce: \"identity\", default: 400},\n {key: \"labels\", coerce: \"identity\"},\n {key: \"labelOffset\", coerce: \"identity\", default: false},\n {key: \"fixedSize\", coerce: \"identity\"},\n {key: \"maxSize\", coerce: \"identity\"},\n {key: \"minSize\", coerce: \"identity\"},\n {key: \"padding\", coerce: \"identity\", default: 5},\n {key: \"paddingInner\", coerce: \"identity\", default: 0.1},\n {key: \"paddingOuter\", coerce: \"identity\", default: 0.1},\n {key: \"range\", coerce: \"identity\"},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"rounding\", coerce: \"identity\", default: \"none\"},\n {key: \"roundingInsideMinPrefix\", coerce: \"identity\", default: \"< \"},\n {key: \"roundingInsideMinSuffix\", coerce: \"identity\", default: \"\"},\n {key: \"roundingInsideMaxPrefix\", coerce: \"identity\", default: \"\"},\n {key: \"roundingInsideMaxSuffix\", coerce: \"identity\", default: \"+\"},\n {key: \"scale\", coerce: \"identity\", default: \"linear\"},\n {key: \"scalePadding\", coerce: \"identity\", default: 0.5},\n {key: \"shape\", coerce: \"identity\", default: \"Line\"},\n {key: \"tickFormat\", coerce: \"identity\"},\n {key: \"ticks\", coerce: \"identity\"},\n {key: \"tickSize\", coerce: \"identity\", default: 8},\n {key: \"tickSuffix\", coerce: \"identity\", default: \"normal\"},\n {key: \"timeLocale\", coerce: \"identity\", default: undefined},\n {key: \"title\", coerce: \"identity\"},\n {key: \"width\", coerce: \"identity\", default: 400},\n];\n\n/**\n Creates an SVG scale based on an array of data.\n*/\nexport default class Axis extends BaseClass {\n // installFluent generates the config accessors (scale, domain, ticks, …) at\n // runtime; the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n _select!: D3Selection;\n _data: unknown[];\n _labelRotation: boolean | undefined;\n _margin: Record<string, number>;\n _outerBounds: Record<string, number>;\n /** The measured size of the tick-label/title space, before margins (see `fixedSize`). */\n _labelSpace?: number;\n _position!: {\n horizontal: boolean;\n width: string;\n height: string;\n x: string;\n y: string;\n opposite: string;\n };\n _tickUnit: number;\n _titleClass: TextBox;\n // Stored render() intermediate (the compute-mode tick Shape) so toScene()\n // can compose it natively. Type-only import avoids the components↔shapes\n // runtime cycle.\n _tickShape?: Shape;\n _gridLineData?: {id: unknown}[];\n _d3Scale: D3Scale | null = null;\n _d3ScaleNegative: D3Scale | null = null;\n _group!: D3Selection;\n _lastScale: ((d: unknown) => number) | undefined;\n _availableTicks: unknown[];\n _visibleTicks: unknown[];\n _transition!: ReturnType<typeof transition>;\n _userFormat: ((d: unknown) => string) | false | undefined;\n // Standalone scene renderer (used when rendered on its own, not inside a\n // Viz). Reused across re-renders by paintComponentScene().\n _sceneRenderer?: SvgRenderer;\n // Subclasses (Timeline) that paint after their own post-super render work\n // set this so Axis.render() doesn't paint a half-built scene.\n _managesOwnScenePaint?: boolean;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n installFluent(this, axisSchema);\n\n this._data = [];\n this._labelRotation = false;\n this.schema.barConfig = {\n stroke: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg);\n },\n \"stroke-width\": 1,\n };\n this.schema.gridConfig = {\n stroke: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg);\n return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n \"stroke-width\": 1,\n };\n this.orient(\"bottom\");\n this._outerBounds = {width: 0, height: 0, x: 0, y: 0};\n this.schema.shapeConfig = {\n fill: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg);\n },\n height: (d: Record<string, unknown>) => (d.tick ? 8 : 0),\n label: (d: Record<string, unknown>) => d.text,\n labelBounds: (d: Record<string, unknown>) => d.labelBounds,\n labelConfig: {\n fontColor: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg);\n },\n fontResize: false,\n fontSize: constant(12),\n padding: 5,\n textAnchor: () => {\n const rtl = detectRTL();\n return this.schema.orient === \"left\"\n ? rtl\n ? \"start\"\n : \"end\"\n : this.schema.orient === \"right\"\n ? rtl\n ? \"end\"\n : \"start\"\n : this._labelRotation\n ? this.schema.orient === \"bottom\"\n ? \"end\"\n : \"start\"\n : \"middle\";\n },\n verticalAlign: () =>\n this.schema.orient === \"bottom\"\n ? \"top\"\n : this.schema.orient === \"top\"\n ? this._labelRotation ? \"top\" : \"bottom\"\n : \"middle\",\n },\n r: (d: Record<string, unknown>) => (d.tick ? 4 : 0),\n stroke: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg);\n },\n strokeWidth: 1,\n width: (d: Record<string, unknown>) => (d.tick ? 8 : 0),\n };\n this._tickUnit = 0;\n this._titleClass = new TextBox();\n this.schema.titleConfig = {\n fontColor: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg);\n },\n fontSize: 12,\n textAnchor: \"middle\",\n };\n this._margin = {top: 0, right: 0, bottom: 0, left: 0};\n this._availableTicks = [];\n this._visibleTicks = [];\n }\n\n\n /**\n Returns the scale's domain, taking into account negative and positive log scales.\n @private\n*/\n _getDomain(): unknown[] {\n let ticks: unknown[] = [];\n if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.domain();\n if (this._d3Scale) ticks = ticks.concat(this._d3Scale.domain());\n\n const domain = [\"band\", \"ordinal\", \"point\"].includes(this.schema.scale)\n ? ticks\n : extent(ticks as number[]);\n return (ticks[0] as number) > (ticks[1] as number)\n ? (domain as unknown[]).reverse()\n : (domain as unknown[]);\n }\n\n /**\n Returns a value's scale position, taking into account negative and positive log scales.\n @param d @private\n*/\n _getPosition(d: unknown): number {\n if (this.schema.scale === \"log\") {\n if (d === 0)\n return (this._d3Scale || this._d3ScaleNegative)!.range()[\n this._d3Scale ? 0 : 1\n ];\n const scale = isNegative(d as number)\n ? this._d3ScaleNegative\n : this._d3Scale;\n return scale ? scale(d as number) : 0;\n }\n return this._d3Scale ? this._d3Scale(d as number | string | Date) : 0;\n }\n\n /**\n Returns the scale's range, taking into account negative and positive log scales.\n @private\n*/\n _getRange(): unknown[] {\n let ticks: unknown[] = [];\n if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.range();\n if (this._d3Scale) ticks = ticks.concat(this._d3Scale.range());\n return (ticks[0] as number) > (ticks[1] as number)\n ? (extent(ticks as number[]) as unknown[]).reverse()\n : (extent(ticks as number[]) as unknown[]);\n }\n\n /**\n Returns the scale's labels, taking into account negative and positive log scales.\n @private\n*/\n _getLabels(): unknown[] {\n let labels: unknown[] = [];\n if (this._d3ScaleNegative)\n labels = labels.concat(\n calculateTicks.bind(this)(this._d3ScaleNegative, false),\n );\n if (this._d3Scale)\n labels = labels.concat(calculateTicks.bind(this)(this._d3Scale, false));\n if (this.schema.scale === \"log\") {\n const diverging =\n labels.some((d: unknown) => isNegative(d as number)) &&\n labels.some((d: unknown) => (d as number) > 0);\n if (diverging) {\n const minValue = min([\n ...(this._d3ScaleNegative!.domain() as number[]).map(Math.abs),\n ...(this._d3Scale!.domain() as number[]),\n ]);\n // add minValue if it does not exist, and should\n if (!labels.includes(minValue)) {\n labels.splice(\n labels.findIndex((d: unknown) => (d as number) > minValue!),\n 0,\n minValue,\n );\n }\n // remove -minValue if minValue also exists\n if (labels.includes(-minValue!) && labels.includes(minValue)) {\n labels.splice(labels.indexOf(-minValue!), 1);\n }\n }\n }\n return labels;\n }\n\n /**\n Returns the scale's ticks, taking into account negative and positive log scales.\n @private\n*/\n _getTicks(): unknown[] {\n if (\n [\"band\", \"ordinal\", \"point\", \"time\"].includes(this.schema.scale) &&\n this._data.length &&\n this._data.length < this.schema.width / 4\n ) {\n return this.schema.scale === \"time\"\n ? this._data.map(d => date(d as string | number | false))\n : this._data;\n }\n let ticks: unknown[] = [];\n if (this._d3ScaleNegative)\n ticks = ticks.concat(\n calculateTicks.bind(this)(this._d3ScaleNegative, true),\n );\n if (this._d3Scale)\n ticks = ticks.concat(calculateTicks.bind(this)(this._d3Scale, true));\n if (this.schema.scale === \"log\" && ticks.includes(-1) && ticks.includes(1))\n ticks.splice(ticks.indexOf(-1), 1);\n return ticks;\n }\n\n\n /**\n Produces a backend-agnostic scene graph for this axis with no DOM dependency:\n gridlines + domain bar emitted natively, tick marks/labels composed from the\n tick Shape's toScene(), and the title from the title TextBox's toScene().\n*/\n toScene(): GroupNode {\n return axisToScene(this);\n }\n\n /**\n Renders the current Axis to the page.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: (...args: unknown[]) => unknown): this {\n /**\n * In `renderMode(\"compute\")` the axis is scene-only — the caller will\n * read `toScene()`, not the DOM. We skip creating any SVG element at\n * all: the elem() calls later in render() are no-ops when `_select`\n * is undefined (d3-selection.select(undefined) yields a null-wrapped\n * selection whose .append/.select on it short-circuit). This also\n * fixes the \"every Axis instance holds a detached svg forever\" leak\n * — Plot has four long-lived axes and was accumulating 4 detached\n * SVGs per chart instance.\n *\n * In `renderMode(\"full\")` with `_select` unset, we create a\n * body-attached svg so standalone `new Axis().render()` works.\n*/\n if (this._select === void 0 && this.schema.renderMode !== \"compute\") {\n // Timeline (`_managesOwnScenePaint`) paints its own brush + play-button\n // DOM into this root, so it needs a real <svg>. A plain Axis paints\n // through `paintComponentScene`, whose renderer creates the single <svg> —\n // so mount it into a <div>, since an <svg> container would nest a second.\n if (this._managesOwnScenePaint) {\n const svgNode = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"svg\",\n );\n svgNode.setAttribute(\"width\", `${this.schema.width}px`);\n svgNode.setAttribute(\"height\", `${this.schema.height}px`);\n document.body.appendChild(svgNode);\n this.select(svgNode as unknown as HTMLElement);\n } else {\n const div = document.createElement(\"div\");\n document.body.appendChild(div);\n this.select(div as unknown as HTMLElement);\n }\n }\n\n // Pure layout pass. `measureAxis(this)` constructs the d3 scale, picks\n // ticks, runs label textWrap, and computes outerBounds — no DOM, no\n // rendering. It mutates `this._d3Scale`/`_outerBounds`/`_margin` etc. for\n // consumers reading off the instance, and returns the local layout\n // artifacts the paint phase below consumes. The standalone `measureAxis`\n // lives in axisLayout.ts so Plot test-axes can drive it without a class\n // instance at all (any AxisLike object works).\n const measure = measureAxis(this);\n const {ticks, labels} = measure;\n\n const parent = this._select;\n\n // Skip the wrapper group only when in compute mode WITHOUT a real\n // `_select` (the standalone compute path used by Plot's axes — toScene\n // is the consumer, no DOM mount needed). When `_select` is set, the\n // group still mounts because consumers (Timeline extends Axis and\n // calls `elem(\"g.brushGroup\", {parent: this._group})` after super\n // render) expect it.\n const standaloneCompute =\n this.schema.renderMode === \"compute\" &&\n (this._select === void 0 || this._select === null ||\n (typeof this._select.node === \"function\" && this._select.node() === null));\n const group = standaloneCompute\n ? null\n : elem(`g#d3plus-Axis-${this._uuid}`, {parent});\n this._group = group as D3Selection;\n\n const gridLineData: {id: unknown}[] = (\n this.schema.gridSize !== 0\n ? this.schema.grid || (this.schema.scale === \"log\" && !this.schema.gridLog)\n ? labels\n : ticks\n : []\n ).map((d: unknown) => ({id: d}));\n // Scene-only: grid lines are emitted natively by toScene() via\n // _gridLinePoints() from this._gridLineData. No <line> DOM.\n this._gridLineData = gridLineData;\n\n // Tick marks/labels and the title are composed in compute mode by\n // axisRender helpers; toScene() reads the resulting _tickShape/_titleClass.\n // The domain bar is emitted natively by toScene() via _barLinePoints().\n const tickData = buildTickData(this, measure);\n configureTickShape(this, tickData);\n renderAxisTitle(this, measure, group);\n\n this._lastScale = this._getPosition.bind(this);\n\n // Standalone render: paint the scene into the user's `_select`. Inside a\n // Viz the axis runs in compute mode and the Viz composes its toScene(), so\n // skip both compute mode and subclasses that paint themselves (Timeline).\n if (\n this.schema.renderMode !== \"compute\" &&\n !this._managesOwnScenePaint\n )\n paintComponentScene(this);\n\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n Axis line style.\n*/\n barConfig(): Record<string, unknown>;\n barConfig(_: Record<string, unknown>): this;\n barConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.barConfig = Object.assign(this.schema.barConfig, _)), this)\n : this.schema.barConfig;\n }\n\n /**\n An array of data points, which helps determine which ticks should be shown and which time resolution should be displayed.\n*/\n data(): unknown[];\n data(_: unknown[]): this;\n data(_?: unknown[]): unknown {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n Grid config of the axis.\n*/\n gridConfig(): Record<string, unknown>;\n gridConfig(_: Record<string, unknown>): this;\n gridConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.gridConfig = Object.assign(this.schema.gridConfig, _)), this)\n : this.schema.gridConfig;\n }\n\n /**\n Whether to rotate horizontal axis labels -90 degrees.\n*/\n labelRotation(): boolean | undefined;\n labelRotation(_: boolean): this;\n labelRotation(_?: boolean): boolean | undefined | this {\n return arguments.length\n ? ((this._labelRotation = _), this)\n : this._labelRotation;\n }\n\n /**\n The orientation of the shape.\n*/\n orient(): string;\n orient(_: string): this;\n orient(_?: string): string | this {\n if (arguments.length) {\n const horizontal = [\"top\", \"bottom\"].includes(_!),\n opps: Record<string, string> = {\n top: \"bottom\",\n right: \"left\",\n bottom: \"top\",\n left: \"right\",\n };\n\n this._position = {\n horizontal,\n width: horizontal ? \"width\" : \"height\",\n height: horizontal ? \"height\" : \"width\",\n x: horizontal ? \"x\" : \"y\",\n y: horizontal ? \"y\" : \"x\",\n opposite: opps[_!],\n };\n\n return ((this.schema.orient = _!), this);\n }\n return this.schema.orient;\n }\n\n /**\n Returns the outer bounds of the axis content. Must be called after rendering.\n @example\n{\"width\": 180, \"height\": 24, \"x\": 10, \"y\": 20}\n*/\n outerBounds(): Record<string, number> {\n return this._outerBounds;\n }\n\n /**\n Runs the layout pass only — scale construction, tick selection, label\n textWrap, and outerBounds — with **no DOM access**. After it returns,\n `outerBounds()` / `_d3Scale` / `_getPosition()` are populated exactly as\n they would be after a full `render()`, but no `<svg>`, `<g>`, tick shapes,\n or label TextBoxes are created. Answers \"how much room will this axis\n need?\" without rendering; Plot uses it to size its test-axes. Delegates to\n the standalone `measureAxis(axis)` in axisLayout.ts, so callers can run\n layout without owning an Axis instance.\n */\n measure(): this {\n measureAxis(this);\n return this;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element.\n\n Passing `null` or `undefined` deliberately leaves the axis unmounted\n — `renderMode(\"compute\")` plus `select(null)` produces a\n scene-only axis (no detached SVG fallback). This is the formal\n contract callers in `plotPaint` use to compute axis layout without\n mounting DOM.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement | null | undefined): this;\n select(_?: string | HTMLElement | null): unknown {\n if (!arguments.length) return this._select;\n if (_ == null) {\n this._select = undefined as unknown as D3Selection;\n } else {\n this._select = select(_ as never) as unknown as D3Selection;\n }\n return this;\n }\n\n /**\n Tick style of the axis.\n*/\n shapeConfig(): Record<string, unknown>;\n shapeConfig(_: Record<string, unknown>): this;\n shapeConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.shapeConfig = assign(this.schema.shapeConfig, _ as Record<string, unknown>)), this)\n : this.schema.shapeConfig;\n }\n\n /**\n Title configuration of the axis.\n*/\n titleConfig(): Record<string, unknown>;\n titleConfig(_: Record<string, unknown>): this;\n titleConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.titleConfig = Object.assign(this.schema.titleConfig, _)), this)\n : this.schema.titleConfig;\n }\n}\n\n/* ============================== free function ============================== */\n\n/**\n Pure-function entry point for axis layout. Given a fully configured\n `Axis` instance, runs the layout pass (no DOM) and returns a fresh result\n bag — bounds, the d3 scale(s), a `getPosition` projector, plus the\n laid-out tick state.\n\n Callers who don't want to manage an Axis instance long-term can build\n one on the fly, call this, and discard:\n\n ```ts\n const axis = new AxisBottom()\n .domain([0, 100])\n .width(800).height(400)\n .data(data)\n .config(userAxisConfig);\n const layout = computeAxisLayout(axis);\n // layout.bounds, layout.getPosition, layout.d3Scale all populated.\n ```\n\n This is the \"no temp DOM, no test svg\" path Plot's `_xTest`/`_yTest`\n consume — see Plot._draw. Internally this is a thin wrapper over\n `axis.measure()` returning a frozen snapshot of the laid-out state.\n*/\nexport interface AxisLayout {\n bounds: Record<string, number>;\n d3Scale: D3Scale | null;\n d3ScaleNegative: D3Scale | null;\n getPosition: (d: unknown) => number;\n availableTicks: unknown[];\n visibleTicks: unknown[];\n margin: Record<string, number>;\n}\n\nexport function computeAxisLayout(axis: Axis): AxisLayout {\n // Free function from axisLayout.ts. Mutates `axis` (so instance-slot\n // readers stay in sync) and returns the layout artifacts; we re-shape\n // its result + the mutated instance fields into the stable `AxisLayout` API.\n measureAxis(axis);\n return {\n bounds: axis._outerBounds,\n d3Scale: axis._d3Scale,\n d3ScaleNegative: axis._d3ScaleNegative,\n getPosition: (d: unknown) => axis._getPosition(d),\n availableTicks: axis._availableTicks,\n visibleTicks: axis._visibleTicks,\n margin: axis._margin,\n };\n}\n\n// Re-export the standalone `measureAxis` and its result type so consumers\n// can import them from the same module as the Axis class.\nexport {measureAxis} from \"./axisLayout.js\";\nexport type {AxisLayoutResult} from \"./axisLayout.js\";\n"],"names":["extent","min","select","pkg","theme","openColor","colorContrast","colorDefaults","assign","backgroundColor","date","elem","rtl","detectRTL","TextBox","measureAxis","axisToScene","buildTickData","calculateTicks","configureTickShape","isNegative","renderAxisTitle","BaseClass","constant","paintComponentScene","installFluent","axisSchema","key","coerce","default","undefined","Axis","_select","_data","_labelRotation","_margin","_outerBounds","_labelSpace","_position","_tickUnit","_titleClass","_tickShape","_gridLineData","_d3Scale","_d3ScaleNegative","_group","_lastScale","_availableTicks","_visibleTicks","_transition","_userFormat","_sceneRenderer","_managesOwnScenePaint","schema","barConfig","stroke","bg","node","gridConfig","contrast","dark","colors","gray","orient","width","height","x","y","shapeConfig","fill","d","tick","label","text","labelBounds","labelConfig","fontColor","fontResize","fontSize","padding","textAnchor","verticalAlign","r","strokeWidth","titleConfig","top","right","bottom","left","_getDomain","ticks","domain","concat","includes","scale","reverse","_getPosition","range","_getRange","_getLabels","labels","bind","diverging","some","minValue","map","Math","abs","splice","findIndex","indexOf","_getTicks","length","toScene","render","callback","renderMode","svgNode","document","createElementNS","setAttribute","body","appendChild","div","createElement","measure","parent","standaloneCompute","group","_uuid","gridLineData","gridSize","grid","gridLog","id","tickData","setTimeout","duration","_","arguments","Object","data","labelRotation","horizontal","opps","opposite","outerBounds","computeAxisLayout","axis","bounds","d3Scale","d3ScaleNegative","getPosition","availableTicks","visibleTicks","margin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;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C3E,IAAI,CAACrF,MAAM,CAAC+B,WAAW;YAC7B;;;WA1emBrD;EAAaT;AAHlC;;AAEA,GACA,SAAqBS,kBA2epB;AAqCD,OAAO,SAASoH,kBAAkBC,IAAU;IAC1C,qEAAqE;IACrE,sEAAsE;IACtE,6EAA6E;IAC7ErI,YAAYqI;IACZ,OAAO;QACLC,QAAQD,KAAKhH,YAAY;QACzBkH,SAASF,KAAKzG,QAAQ;QACtB4G,iBAAiBH,KAAKxG,gBAAgB;QACtC4G,aAAa,SAAbA,YAAclF;mBAAe8E,KAAKpD,YAAY,CAAC1B;;QAC/CmF,gBAAgBL,KAAKrG,eAAe;QACpC2G,cAAcN,KAAKpG,aAAa;QAChC2G,QAAQP,KAAKjH,OAAO;IACtB;AACF;AAEA,0EAA0E;AAC1E,0DAA0D;AAC1D,SAAQpB,WAAW,QAAO,kBAAkB"}
1
+ {"version":3,"sources":["../../../../src/components/Axis/Axis.ts"],"sourcesContent":["import {extent, min} from \"d3-array\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n// @ts-ignore\nimport pkg from \"open-color/open-color.js\";\nconst {theme: openColor} = pkg;\n\nimport {colorContrast} from \"@d3plus/color\";\nimport {assign, backgroundColor, date, elem, rtl as detectRTL} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\n\nimport type {GroupNode} from \"@d3plus/render\";\nimport type {SvgRenderer} from \"@d3plus/render\";\n\nimport {TextBox} from \"../index.js\";\nimport type Shape from \"../../shapes/Shape.js\";\nimport {measureAxis} from \"./axisLayout.js\";\nimport {\n axisToScene,\n buildTickData,\n calculateTicks,\n configureTickShape,\n isNegative,\n renderAxisTitle,\n} from \"./axisRender.js\";\nimport {BaseClass, constant, paintComponentScene} from \"../../utils/index.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\nimport type {ConfigField} from \"../../fluent.js\";\n\n/** Axis's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst axisSchema: ConfigField[] = [\n {key: \"align\", coerce: \"identity\", default: \"middle\"},\n {key: \"domain\", coerce: \"identity\", default: [0, 10]},\n {key: \"domainTicks\", coerce: \"identity\", default: true},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"grid\", coerce: \"identity\"},\n {key: \"gridLog\", coerce: \"identity\", default: false},\n {key: \"gridSize\", coerce: \"identity\"},\n {key: \"height\", coerce: \"identity\", default: 400},\n {key: \"labels\", coerce: \"identity\"},\n {key: \"labelOffset\", coerce: \"identity\", default: false},\n {key: \"fixedSize\", coerce: \"identity\"},\n {key: \"maxSize\", coerce: \"identity\"},\n {key: \"minSize\", coerce: \"identity\"},\n {key: \"padding\", coerce: \"identity\", default: 5},\n {key: \"paddingInner\", coerce: \"identity\", default: 0.1},\n {key: \"paddingOuter\", coerce: \"identity\", default: 0.1},\n {key: \"range\", coerce: \"identity\"},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"rounding\", coerce: \"identity\", default: \"none\"},\n {key: \"roundingInsideMinPrefix\", coerce: \"identity\", default: \"< \"},\n {key: \"roundingInsideMinSuffix\", coerce: \"identity\", default: \"\"},\n {key: \"roundingInsideMaxPrefix\", coerce: \"identity\", default: \"\"},\n {key: \"roundingInsideMaxSuffix\", coerce: \"identity\", default: \"+\"},\n {key: \"scale\", coerce: \"identity\", default: \"linear\"},\n {key: \"scalePadding\", coerce: \"identity\", default: 0.5},\n {key: \"shape\", coerce: \"identity\", default: \"Line\"},\n {key: \"tickFormat\", coerce: \"identity\"},\n {key: \"ticks\", coerce: \"identity\"},\n {key: \"tickSize\", coerce: \"identity\", default: 8},\n {key: \"tickSuffix\", coerce: \"identity\", default: \"normal\"},\n {key: \"timeLocale\", coerce: \"identity\", default: undefined},\n {key: \"title\", coerce: \"identity\"},\n {key: \"width\", coerce: \"identity\", default: 400},\n];\n\n/**\n Creates an SVG scale based on an array of data.\n*/\nexport default class Axis extends BaseClass {\n // installFluent generates the config accessors (scale, domain, ticks, …) at\n // runtime; the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n _select!: D3Selection;\n _data: unknown[];\n _labelRotation: boolean | undefined;\n _margin: Record<string, number>;\n _outerBounds: Record<string, number>;\n /** The measured size of the tick-label/title space, before margins (see `fixedSize`). */\n _labelSpace?: number;\n _position!: {\n horizontal: boolean;\n width: string;\n height: string;\n x: string;\n y: string;\n opposite: string;\n };\n _tickUnit: number;\n _titleClass: TextBox;\n // Stored render() intermediate (the compute-mode tick Shape) so toScene()\n // can compose it natively. Type-only import avoids the components↔shapes\n // runtime cycle.\n _tickShape?: Shape;\n _gridLineData?: {id: unknown}[];\n _d3Scale: D3Scale | null = null;\n _d3ScaleNegative: D3Scale | null = null;\n _group!: D3Selection;\n _lastScale: ((d: unknown) => number) | undefined;\n _availableTicks: unknown[];\n _visibleTicks: unknown[];\n _transition!: ReturnType<typeof transition>;\n _userFormat: ((d: unknown) => string) | false | undefined;\n // Standalone scene renderer (used when rendered on its own, not inside a\n // Viz). Reused across re-renders by paintComponentScene().\n _sceneRenderer?: SvgRenderer;\n // Subclasses (Timeline) that paint after their own post-super render work\n // set this so Axis.render() doesn't paint a half-built scene.\n _managesOwnScenePaint?: boolean;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n installFluent(this, axisSchema);\n\n this._data = [];\n this._labelRotation = false;\n this.schema.barConfig = {\n stroke: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg, this.schema.colorDefaults);\n },\n \"stroke-width\": 1,\n };\n this.schema.gridConfig = {\n stroke: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n const contrast = colorContrast(bg, this.schema.colorDefaults);\n return contrast === this.schema.colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];\n },\n \"stroke-width\": 1,\n };\n this.orient(\"bottom\");\n this._outerBounds = {width: 0, height: 0, x: 0, y: 0};\n this.schema.shapeConfig = {\n fill: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg, this.schema.colorDefaults);\n },\n height: (d: Record<string, unknown>) => (d.tick ? 8 : 0),\n label: (d: Record<string, unknown>) => d.text,\n labelBounds: (d: Record<string, unknown>) => d.labelBounds,\n labelConfig: {\n fontColor: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg, this.schema.colorDefaults);\n },\n fontResize: false,\n fontSize: constant(12),\n padding: 5,\n textAnchor: () => {\n const rtl = detectRTL();\n return this.schema.orient === \"left\"\n ? rtl\n ? \"start\"\n : \"end\"\n : this.schema.orient === \"right\"\n ? rtl\n ? \"end\"\n : \"start\"\n : this._labelRotation\n ? this.schema.orient === \"bottom\"\n ? \"end\"\n : \"start\"\n : \"middle\";\n },\n verticalAlign: () =>\n this.schema.orient === \"bottom\"\n ? \"top\"\n : this.schema.orient === \"top\"\n ? this._labelRotation ? \"top\" : \"bottom\"\n : \"middle\",\n },\n r: (d: Record<string, unknown>) => (d.tick ? 4 : 0),\n stroke: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg, this.schema.colorDefaults);\n },\n strokeWidth: 1,\n width: (d: Record<string, unknown>) => (d.tick ? 8 : 0),\n };\n this._tickUnit = 0;\n this._titleClass = new TextBox();\n this.schema.titleConfig = {\n fontColor: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg, this.schema.colorDefaults);\n },\n fontSize: 12,\n textAnchor: \"middle\",\n };\n this._margin = {top: 0, right: 0, bottom: 0, left: 0};\n this._availableTicks = [];\n this._visibleTicks = [];\n }\n\n\n /**\n Returns the scale's domain, taking into account negative and positive log scales.\n @private\n*/\n _getDomain(): unknown[] {\n let ticks: unknown[] = [];\n if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.domain();\n if (this._d3Scale) ticks = ticks.concat(this._d3Scale.domain());\n\n const domain = [\"band\", \"ordinal\", \"point\"].includes(this.schema.scale)\n ? ticks\n : extent(ticks as number[]);\n return (ticks[0] as number) > (ticks[1] as number)\n ? (domain as unknown[]).reverse()\n : (domain as unknown[]);\n }\n\n /**\n Returns a value's scale position, taking into account negative and positive log scales.\n @param d @private\n*/\n _getPosition(d: unknown): number {\n if (this.schema.scale === \"log\") {\n if (d === 0)\n return (this._d3Scale || this._d3ScaleNegative)!.range()[\n this._d3Scale ? 0 : 1\n ];\n const scale = isNegative(d as number)\n ? this._d3ScaleNegative\n : this._d3Scale;\n return scale ? scale(d as number) : 0;\n }\n return this._d3Scale ? this._d3Scale(d as number | string | Date) : 0;\n }\n\n /**\n Returns the scale's range, taking into account negative and positive log scales.\n @private\n*/\n _getRange(): unknown[] {\n let ticks: unknown[] = [];\n if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.range();\n if (this._d3Scale) ticks = ticks.concat(this._d3Scale.range());\n return (ticks[0] as number) > (ticks[1] as number)\n ? (extent(ticks as number[]) as unknown[]).reverse()\n : (extent(ticks as number[]) as unknown[]);\n }\n\n /**\n Returns the scale's labels, taking into account negative and positive log scales.\n @private\n*/\n _getLabels(): unknown[] {\n let labels: unknown[] = [];\n if (this._d3ScaleNegative)\n labels = labels.concat(\n calculateTicks.bind(this)(this._d3ScaleNegative, false),\n );\n if (this._d3Scale)\n labels = labels.concat(calculateTicks.bind(this)(this._d3Scale, false));\n if (this.schema.scale === \"log\") {\n const diverging =\n labels.some((d: unknown) => isNegative(d as number)) &&\n labels.some((d: unknown) => (d as number) > 0);\n if (diverging) {\n const minValue = min([\n ...(this._d3ScaleNegative!.domain() as number[]).map(Math.abs),\n ...(this._d3Scale!.domain() as number[]),\n ]);\n // add minValue if it does not exist, and should\n if (!labels.includes(minValue)) {\n labels.splice(\n labels.findIndex((d: unknown) => (d as number) > minValue!),\n 0,\n minValue,\n );\n }\n // remove -minValue if minValue also exists\n if (labels.includes(-minValue!) && labels.includes(minValue)) {\n labels.splice(labels.indexOf(-minValue!), 1);\n }\n }\n }\n return labels;\n }\n\n /**\n Returns the scale's ticks, taking into account negative and positive log scales.\n @private\n*/\n _getTicks(): unknown[] {\n if (\n [\"band\", \"ordinal\", \"point\", \"time\"].includes(this.schema.scale) &&\n this._data.length &&\n this._data.length < this.schema.width / 4\n ) {\n return this.schema.scale === \"time\"\n ? this._data.map(d => date(d as string | number | false))\n : this._data;\n }\n let ticks: unknown[] = [];\n if (this._d3ScaleNegative)\n ticks = ticks.concat(\n calculateTicks.bind(this)(this._d3ScaleNegative, true),\n );\n if (this._d3Scale)\n ticks = ticks.concat(calculateTicks.bind(this)(this._d3Scale, true));\n if (this.schema.scale === \"log\" && ticks.includes(-1) && ticks.includes(1))\n ticks.splice(ticks.indexOf(-1), 1);\n return ticks;\n }\n\n\n /**\n Produces a backend-agnostic scene graph for this axis with no DOM dependency:\n gridlines + domain bar emitted natively, tick marks/labels composed from the\n tick Shape's toScene(), and the title from the title TextBox's toScene().\n*/\n toScene(): GroupNode {\n return axisToScene(this);\n }\n\n /**\n Renders the current Axis to the page.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: (...args: unknown[]) => unknown): this {\n /**\n * In `renderMode(\"compute\")` the axis is scene-only — the caller will\n * read `toScene()`, not the DOM. We skip creating any SVG element at\n * all: the elem() calls later in render() are no-ops when `_select`\n * is undefined (d3-selection.select(undefined) yields a null-wrapped\n * selection whose .append/.select on it short-circuit). This also\n * fixes the \"every Axis instance holds a detached svg forever\" leak\n * — Plot has four long-lived axes and was accumulating 4 detached\n * SVGs per chart instance.\n *\n * In `renderMode(\"full\")` with `_select` unset, we create a\n * body-attached svg so standalone `new Axis().render()` works.\n*/\n if (this._select === void 0 && this.schema.renderMode !== \"compute\") {\n // Timeline (`_managesOwnScenePaint`) paints its own brush + play-button\n // DOM into this root, so it needs a real <svg>. A plain Axis paints\n // through `paintComponentScene`, whose renderer creates the single <svg> —\n // so mount it into a <div>, since an <svg> container would nest a second.\n if (this._managesOwnScenePaint) {\n const svgNode = document.createElementNS(\n \"http://www.w3.org/2000/svg\",\n \"svg\",\n );\n svgNode.setAttribute(\"width\", `${this.schema.width}px`);\n svgNode.setAttribute(\"height\", `${this.schema.height}px`);\n document.body.appendChild(svgNode);\n this.select(svgNode as unknown as HTMLElement);\n } else {\n const div = document.createElement(\"div\");\n document.body.appendChild(div);\n this.select(div as unknown as HTMLElement);\n }\n }\n\n // Pure layout pass. `measureAxis(this)` constructs the d3 scale, picks\n // ticks, runs label textWrap, and computes outerBounds — no DOM, no\n // rendering. It mutates `this._d3Scale`/`_outerBounds`/`_margin` etc. for\n // consumers reading off the instance, and returns the local layout\n // artifacts the paint phase below consumes. The standalone `measureAxis`\n // lives in axisLayout.ts so Plot test-axes can drive it without a class\n // instance at all (any AxisLike object works).\n const measure = measureAxis(this);\n const {ticks, labels} = measure;\n\n const parent = this._select;\n\n // Skip the wrapper group only when in compute mode WITHOUT a real\n // `_select` (the standalone compute path used by Plot's axes — toScene\n // is the consumer, no DOM mount needed). When `_select` is set, the\n // group still mounts because consumers (Timeline extends Axis and\n // calls `elem(\"g.brushGroup\", {parent: this._group})` after super\n // render) expect it.\n const standaloneCompute =\n this.schema.renderMode === \"compute\" &&\n (this._select === void 0 || this._select === null ||\n (typeof this._select.node === \"function\" && this._select.node() === null));\n const group = standaloneCompute\n ? null\n : elem(`g#d3plus-Axis-${this._uuid}`, {parent});\n this._group = group as D3Selection;\n\n const gridLineData: {id: unknown}[] = (\n this.schema.gridSize !== 0\n ? this.schema.grid || (this.schema.scale === \"log\" && !this.schema.gridLog)\n ? labels\n : ticks\n : []\n ).map((d: unknown) => ({id: d}));\n // Scene-only: grid lines are emitted natively by toScene() via\n // _gridLinePoints() from this._gridLineData. No <line> DOM.\n this._gridLineData = gridLineData;\n\n // Tick marks/labels and the title are composed in compute mode by\n // axisRender helpers; toScene() reads the resulting _tickShape/_titleClass.\n // The domain bar is emitted natively by toScene() via _barLinePoints().\n const tickData = buildTickData(this, measure);\n configureTickShape(this, tickData);\n renderAxisTitle(this, measure, group);\n\n this._lastScale = this._getPosition.bind(this);\n\n // Standalone render: paint the scene into the user's `_select`. Inside a\n // Viz the axis runs in compute mode and the Viz composes its toScene(), so\n // skip both compute mode and subclasses that paint themselves (Timeline).\n if (\n this.schema.renderMode !== \"compute\" &&\n !this._managesOwnScenePaint\n )\n paintComponentScene(this);\n\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n Axis line style.\n*/\n barConfig(): Record<string, unknown>;\n barConfig(_: Record<string, unknown>): this;\n barConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.barConfig = Object.assign(this.schema.barConfig, _)), this)\n : this.schema.barConfig;\n }\n\n /**\n An array of data points, which helps determine which ticks should be shown and which time resolution should be displayed.\n*/\n data(): unknown[];\n data(_: unknown[]): this;\n data(_?: unknown[]): unknown {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n Grid config of the axis.\n*/\n gridConfig(): Record<string, unknown>;\n gridConfig(_: Record<string, unknown>): this;\n gridConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.gridConfig = Object.assign(this.schema.gridConfig, _)), this)\n : this.schema.gridConfig;\n }\n\n /**\n Whether to rotate horizontal axis labels -90 degrees.\n*/\n labelRotation(): boolean | undefined;\n labelRotation(_: boolean): this;\n labelRotation(_?: boolean): boolean | undefined | this {\n return arguments.length\n ? ((this._labelRotation = _), this)\n : this._labelRotation;\n }\n\n /**\n The orientation of the shape.\n*/\n orient(): string;\n orient(_: string): this;\n orient(_?: string): string | this {\n if (arguments.length) {\n const horizontal = [\"top\", \"bottom\"].includes(_!),\n opps: Record<string, string> = {\n top: \"bottom\",\n right: \"left\",\n bottom: \"top\",\n left: \"right\",\n };\n\n this._position = {\n horizontal,\n width: horizontal ? \"width\" : \"height\",\n height: horizontal ? \"height\" : \"width\",\n x: horizontal ? \"x\" : \"y\",\n y: horizontal ? \"y\" : \"x\",\n opposite: opps[_!],\n };\n\n return ((this.schema.orient = _!), this);\n }\n return this.schema.orient;\n }\n\n /**\n Returns the outer bounds of the axis content. Must be called after rendering.\n @example\n{\"width\": 180, \"height\": 24, \"x\": 10, \"y\": 20}\n*/\n outerBounds(): Record<string, number> {\n return this._outerBounds;\n }\n\n /**\n Runs the layout pass only — scale construction, tick selection, label\n textWrap, and outerBounds — with **no DOM access**. After it returns,\n `outerBounds()` / `_d3Scale` / `_getPosition()` are populated exactly as\n they would be after a full `render()`, but no `<svg>`, `<g>`, tick shapes,\n or label TextBoxes are created. Answers \"how much room will this axis\n need?\" without rendering; Plot uses it to size its test-axes. Delegates to\n the standalone `measureAxis(axis)` in axisLayout.ts, so callers can run\n layout without owning an Axis instance.\n */\n measure(): this {\n measureAxis(this);\n return this;\n }\n\n /**\n The SVG container element as a d3 selector or DOM element.\n\n Passing `null` or `undefined` deliberately leaves the axis unmounted\n — `renderMode(\"compute\")` plus `select(null)` produces a\n scene-only axis (no detached SVG fallback). This is the formal\n contract callers in `plotPaint` use to compute axis layout without\n mounting DOM.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement | null | undefined): this;\n select(_?: string | HTMLElement | null): unknown {\n if (!arguments.length) return this._select;\n if (_ == null) {\n this._select = undefined as unknown as D3Selection;\n } else {\n this._select = select(_ as never) as unknown as D3Selection;\n }\n return this;\n }\n\n /**\n Tick style of the axis.\n*/\n shapeConfig(): Record<string, unknown>;\n shapeConfig(_: Record<string, unknown>): this;\n shapeConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.shapeConfig = assign(this.schema.shapeConfig, _ as Record<string, unknown>)), this)\n : this.schema.shapeConfig;\n }\n\n /**\n Title configuration of the axis.\n*/\n titleConfig(): Record<string, unknown>;\n titleConfig(_: Record<string, unknown>): this;\n titleConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.titleConfig = Object.assign(this.schema.titleConfig, _)), this)\n : this.schema.titleConfig;\n }\n}\n\n/* ============================== free function ============================== */\n\n/**\n Pure-function entry point for axis layout. Given a fully configured\n `Axis` instance, runs the layout pass (no DOM) and returns a fresh result\n bag — bounds, the d3 scale(s), a `getPosition` projector, plus the\n laid-out tick state.\n\n Callers who don't want to manage an Axis instance long-term can build\n one on the fly, call this, and discard:\n\n ```ts\n const axis = new AxisBottom()\n .domain([0, 100])\n .width(800).height(400)\n .data(data)\n .config(userAxisConfig);\n const layout = computeAxisLayout(axis);\n // layout.bounds, layout.getPosition, layout.d3Scale all populated.\n ```\n\n This is the \"no temp DOM, no test svg\" path Plot's `_xTest`/`_yTest`\n consume — see Plot._draw. Internally this is a thin wrapper over\n `axis.measure()` returning a frozen snapshot of the laid-out state.\n*/\nexport interface AxisLayout {\n bounds: Record<string, number>;\n d3Scale: D3Scale | null;\n d3ScaleNegative: D3Scale | null;\n getPosition: (d: unknown) => number;\n availableTicks: unknown[];\n visibleTicks: unknown[];\n margin: Record<string, number>;\n}\n\nexport function computeAxisLayout(axis: Axis): AxisLayout {\n // Free function from axisLayout.ts. Mutates `axis` (so instance-slot\n // readers stay in sync) and returns the layout artifacts; we re-shape\n // its result + the mutated instance fields into the stable `AxisLayout` API.\n measureAxis(axis);\n return {\n bounds: axis._outerBounds,\n d3Scale: axis._d3Scale,\n d3ScaleNegative: axis._d3ScaleNegative,\n getPosition: (d: unknown) => axis._getPosition(d),\n availableTicks: axis._availableTicks,\n visibleTicks: axis._visibleTicks,\n margin: axis._margin,\n };\n}\n\n// Re-export the standalone `measureAxis` and its result type so consumers\n// can import them from the same module as the Axis class.\nexport {measureAxis} from \"./axisLayout.js\";\nexport type {AxisLayoutResult} from \"./axisLayout.js\";\n"],"names":["extent","min","select","pkg","theme","openColor","colorContrast","assign","backgroundColor","date","elem","rtl","detectRTL","TextBox","measureAxis","axisToScene","buildTickData","calculateTicks","configureTickShape","isNegative","renderAxisTitle","BaseClass","constant","paintComponentScene","installFluent","axisSchema","key","coerce","default","undefined","Axis","_select","_data","_labelRotation","_margin","_outerBounds","_labelSpace","_position","_tickUnit","_titleClass","_tickShape","_gridLineData","_d3Scale","_d3ScaleNegative","_group","_lastScale","_availableTicks","_visibleTicks","_transition","_userFormat","_sceneRenderer","_managesOwnScenePaint","schema","barConfig","stroke","bg","node","colorDefaults","gridConfig","contrast","dark","colors","gray","orient","width","height","x","y","shapeConfig","fill","d","tick","label","text","labelBounds","labelConfig","fontColor","fontResize","fontSize","padding","textAnchor","verticalAlign","r","strokeWidth","titleConfig","top","right","bottom","left","_getDomain","ticks","domain","concat","includes","scale","reverse","_getPosition","range","_getRange","_getLabels","labels","bind","diverging","some","minValue","map","Math","abs","splice","findIndex","indexOf","_getTicks","length","toScene","render","callback","renderMode","svgNode","document","createElementNS","setAttribute","body","appendChild","div","createElement","measure","parent","standaloneCompute","group","_uuid","gridLineData","gridSize","grid","gridLog","id","tickData","setTimeout","duration","_","arguments","Object","data","labelRotation","horizontal","opps","opposite","outerBounds","computeAxisLayout","axis","bounds","d3Scale","d3ScaleNegative","getPosition","availableTicks","visibleTicks","margin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,MAAM,EAAEC,GAAG,QAAO,WAAW;AACrC,SAAQC,MAAM,QAAO,eAAe;AAEpC,aAAa;AACb,OAAOC,SAAS,2BAA2B;AAC3C,IAAOC,AAAOC,YAAaF,IAApBC;AAEP,SAAQE,aAAa,QAAO,gBAAgB;AAC5C,SAAQC,MAAM,EAAEC,eAAe,EAAEC,IAAI,EAAEC,IAAI,EAAEC,OAAOC,SAAS,QAAO,cAAc;AAMlF,SAAQC,OAAO,QAAO,cAAc;AAEpC,SAAQC,WAAW,QAAO,kBAAkB;AAC5C,SACEC,WAAW,EACXC,aAAa,EACbC,cAAc,E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,KAAKzG,gBAAgB;QACtC6G,aAAa,SAAbA,YAAclF;mBAAe8E,KAAKpD,YAAY,CAAC1B;;QAC/CmF,gBAAgBL,KAAKtG,eAAe;QACpC4G,cAAcN,KAAKrG,aAAa;QAChC4G,QAAQP,KAAKlH,OAAO;IACtB;AACF;AAEA,0EAA0E;AAC1E,0DAA0D;AAC1D,SAAQpB,WAAW,QAAO,kBAAkB"}
@@ -71,7 +71,7 @@ var AxisBottom = /*#__PURE__*/ function(Axis) {
71
71
  return AxisBottom;
72
72
  }(Axis);
73
73
  /**
74
- Shorthand method for creating an axis where the ticks are drawn below the horizontal domain path. Extends all functionality of the base [Axis](#Axis) class.
74
+ Axis preset whose ticks are drawn below the horizontal domain path. Accepts everything the base Axis class does.
75
75
  */ export { AxisBottom as default };
76
76
 
77
77
  //# sourceMappingURL=AxisBottom.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Axis/AxisBottom.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Shorthand method for creating an axis where the ticks are drawn below the horizontal domain path. Extends all functionality of the base [Axis](#Axis) class.\n*/\nexport default class AxisBottom extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"bottom\");\n }\n}\n"],"names":["default","Axis","AxisBottom","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,2BAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAmBD;AAHxC;;AAEA,GACA,SAAqBC,wBASpB"}
1
+ {"version":3,"sources":["../../../../src/components/Axis/AxisBottom.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Axis preset whose ticks are drawn below the horizontal domain path. Accepts everything the base Axis class does.\n*/\nexport default class AxisBottom extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"bottom\");\n }\n}\n"],"names":["default","Axis","AxisBottom","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,2BAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAmBD;AAHxC;;AAEA,GACA,SAAqBC,wBASpB"}
@@ -71,7 +71,7 @@ var AxisLeft = /*#__PURE__*/ function(Axis) {
71
71
  return AxisLeft;
72
72
  }(Axis);
73
73
  /**
74
- Shorthand method for creating an axis where the ticks are drawn to the left of the vertical domain path. Extends all functionality of the base [Axis](#Axis) class.
74
+ Axis preset whose ticks are drawn to the left of the vertical domain path. Accepts everything the base Axis class does.
75
75
  */ export { AxisLeft as default };
76
76
 
77
77
  //# sourceMappingURL=AxisLeft.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Axis/AxisLeft.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Shorthand method for creating an axis where the ticks are drawn to the left of the vertical domain path. Extends all functionality of the base [Axis](#Axis) class.\n*/\nexport default class AxisLeft extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"left\");\n }\n}\n"],"names":["default","Axis","AxisLeft","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,yBAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAiBD;AAHtC;;AAEA,GACA,SAAqBC,sBASpB"}
1
+ {"version":3,"sources":["../../../../src/components/Axis/AxisLeft.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Axis preset whose ticks are drawn to the left of the vertical domain path. Accepts everything the base Axis class does.\n*/\nexport default class AxisLeft extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"left\");\n }\n}\n"],"names":["default","Axis","AxisLeft","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,yBAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAiBD;AAHtC;;AAEA,GACA,SAAqBC,sBASpB"}
@@ -71,7 +71,7 @@ var AxisRight = /*#__PURE__*/ function(Axis) {
71
71
  return AxisRight;
72
72
  }(Axis);
73
73
  /**
74
- Shorthand method for creating an axis where the ticks are drawn to the right of the vertical domain path. Extends all functionality of the base [Axis](#Axis) class.
74
+ Axis preset whose ticks are drawn to the right of the vertical domain path. Accepts everything the base Axis class does.
75
75
  */ export { AxisRight as default };
76
76
 
77
77
  //# sourceMappingURL=AxisRight.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Axis/AxisRight.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Shorthand method for creating an axis where the ticks are drawn to the right of the vertical domain path. Extends all functionality of the base [Axis](#Axis) class.\n*/\nexport default class AxisRight extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"right\");\n }\n}\n"],"names":["default","Axis","AxisRight","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,0BAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAkBD;AAHvC;;AAEA,GACA,SAAqBC,uBASpB"}
1
+ {"version":3,"sources":["../../../../src/components/Axis/AxisRight.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Axis preset whose ticks are drawn to the right of the vertical domain path. Accepts everything the base Axis class does.\n*/\nexport default class AxisRight extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"right\");\n }\n}\n"],"names":["default","Axis","AxisRight","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,0BAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAkBD;AAHvC;;AAEA,GACA,SAAqBC,uBASpB"}
@@ -71,7 +71,7 @@ var AxisTop = /*#__PURE__*/ function(Axis) {
71
71
  return AxisTop;
72
72
  }(Axis);
73
73
  /**
74
- Shorthand method for creating an axis where the ticks are drawn above the vertical domain path. Extends all functionality of the base [Axis](#Axis) class.
74
+ Axis preset whose ticks are drawn above the horizontal domain path. Accepts everything the base Axis class does.
75
75
  */ export { AxisTop as default };
76
76
 
77
77
  //# sourceMappingURL=AxisTop.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Axis/AxisTop.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Shorthand method for creating an axis where the ticks are drawn above the vertical domain path. Extends all functionality of the base [Axis](#Axis) class.\n*/\nexport default class AxisTop extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"top\");\n }\n}\n"],"names":["default","Axis","AxisTop","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,wBAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAgBD;AAHrC;;AAEA,GACA,SAAqBC,qBASpB"}
1
+ {"version":3,"sources":["../../../../src/components/Axis/AxisTop.ts"],"sourcesContent":["import {default as Axis} from \"./Axis.js\";\n\n/**\n Axis preset whose ticks are drawn above the horizontal domain path. Accepts everything the base Axis class does.\n*/\nexport default class AxisTop extends Axis {\n /**\n Invoked when creating a new class instance, and overrides any default parameters inherited from Axis.\n @private\n */\n constructor() {\n super();\n this.orient(\"top\");\n }\n}\n"],"names":["default","Axis","AxisTop","orient"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,WAAWC,IAAI,QAAO,YAAY;AAK3B,IAAA,AAAMC,wBAAN;;cAAMA;aAAAA;gCAAAA;;gBAMjB,kBANiBA;QAOjB,MAAKC,MAAM,CAAC;;;WAPKD;EAAgBD;AAHrC;;AAEA,GACA,SAAqBC,qBASpB"}
@@ -59,7 +59,16 @@ import { fontFamily as d3plusFontFamily, textWrap } from "@d3plus/text";
59
59
  var wrap = textWrap().fontFamily(fF).fontSize(fS).lineHeight(axis.schema.shapeConfig.lineHeight ? axis.schema.shapeConfig.lineHeight(d, i) : undefined);
60
60
  wrap[w](horizontal ? space : wSize - hBuff - p - axis._margin.left - axis._margin.right);
61
61
  wrap[h](horizontal ? hSize - hBuff - p - axis._margin.top - axis._margin.bottom : space);
62
- var res = wrap(tickFormat(d));
62
+ var text = tickFormat(d);
63
+ var res = wrap(text);
64
+ // A label wider than its share of the axis wraps to nothing; measure it
65
+ // across the whole axis instead, so the overlap pass thins the labels out.
66
+ if (horizontal && !rotate && "".concat(text).trim() && !res.lines.some(function(l) {
67
+ return l !== "";
68
+ })) {
69
+ wrap.width(wSize - p * 2);
70
+ res = wrap(text);
71
+ }
63
72
  res.lines = res.lines.filter(function(d) {
64
73
  return d !== "";
65
74
  });
@@ -130,6 +139,9 @@ import { fontFamily as d3plusFontFamily, textWrap } from "@d3plus/text";
130
139
  textData = textData.map(function(datum) {
131
140
  datum.space = maxSpace - datum.fP * 2;
132
141
  var res = calculateLabelSize(axis, datum, labelCtx);
142
+ // A label measured wider than its share (see `calculateLabelSize`) is
143
+ // painted at that width; the overlap pass below thins its neighbors.
144
+ if (horizontal && !datum.rotate) datum.space = Math.max(datum.space, Math.ceil(res.width));
133
145
  return Object.assign(res, datum);
134
146
  });
135
147
  var reverseTextData = textData.slice().reverse();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/Axis/axisLayoutLabels.ts"],"sourcesContent":["/**\n Label/text layout helpers for `measureAxis` (see `axisLayout.ts`). Pure\n compute — no DOM. `createTextData` measures every label via `textWrap`,\n resolves truncation/offset, and returns the `textData` array the paint\n phase consumes; `computeAxisBounds` derives `_outerBounds` + margins.\n*/\nimport {max, min} from \"d3-array\";\n\nimport {fontFamily as d3plusFontFamily, textWrap} from \"@d3plus/text\";\n\nimport type Axis from \"./Axis.js\";\n\n/** Resolves a tick's pixel size from the shape config (or a constant). */\nexport type TickGet = (d?: {tick?: boolean; id?: unknown}, i?: number) => number;\n\n/**\n One measured axis label. Built incrementally: the base fields come from the\n label-mapping pass, `space`/`lines`/`widths`/`width`/`height` are filled by\n `calculateLabelSize`, and `truncated`/`offset` by the collision passes.\n*/\nexport interface AxisTextDatum {\n d: unknown;\n i: number;\n fF: string;\n fP: number;\n fS: number;\n lineHeight: number;\n position: number;\n rotate?: boolean;\n space: number;\n lines: string[];\n widths: number[];\n width: number;\n height: number;\n truncated?: boolean;\n offset?: number;\n}\n\ninterface LabelLayoutCtx {\n horizontal: boolean;\n hBuff: number;\n p: number;\n tickFormat: (d: unknown) => string;\n}\n\n/** Applies the axis title's wrapped height to the orient-side margin. */\nexport function applyTitleMargin(\n axis: Axis,\n ctx: {range: number[]; p: number; height: string; margin: Record<string, number>},\n): void {\n if (!axis.schema.title) return;\n const {range, p, height, margin} = ctx;\n const {fontFamily, fontSize, lineHeight} = axis.schema.titleConfig;\n const titleWrap = textWrap()\n .fontFamily(typeof fontFamily === \"function\" ? fontFamily() : fontFamily)\n .fontSize(typeof fontSize === \"function\" ? fontSize() : fontSize)\n .lineHeight(typeof lineHeight === \"function\" ? lineHeight() : lineHeight)\n .width(range[range.length - 1] - range[0] - p * 2)\n .height((axis.schema[height] as number) - axis.schema.tickSize - p * 2);\n const lines = titleWrap(axis.schema.title).lines.length;\n margin[axis.schema.orient] = lines * titleWrap.lineHeight()! + p;\n}\n\n/** Resolves the tick height/width buffers from the shape config. */\nexport function computeBuffers(\n axis: Axis,\n _ticks: unknown[],\n tickGet: TickGet,\n height: string,\n): {hBuff: number; wBuff: number} {\n // The ternary and `tickGet` already resolve per-tick functions to a single\n // value, so both buffers are numbers by here.\n let hBuff: number =\n axis.schema.shape === \"Circle\"\n ? typeof axis.schema.shapeConfig.r === \"function\"\n ? axis.schema.shapeConfig.r({tick: true})\n : axis.schema.shapeConfig.r\n : axis.schema.shape === \"Rect\"\n ? typeof axis.schema.shapeConfig[height] === \"function\"\n ? axis.schema.shapeConfig[height]({tick: true})\n : axis.schema.shapeConfig[height]\n : axis.schema.tickSize;\n let wBuff: number = tickGet({tick: true});\n\n if (axis.schema.shape === \"Rect\") hBuff /= 2;\n if (axis.schema.shape !== \"Circle\") wBuff /= 2;\n\n return {hBuff, wBuff};\n}\n\n/** Wraps + measures a single label, returning its sized text result. */\nfunction calculateLabelSize(\n axis: Axis,\n datum: AxisTextDatum,\n ctx: LabelLayoutCtx,\n): {lines: string[]; widths: number[]; width: number; height: number} {\n const {horizontal, hBuff, p, tickFormat} = ctx;\n const {d, i, fF, fP, fS, rotate, space} = datum;\n const h = rotate ? \"width\" : \"height\",\n w = rotate ? \"height\" : \"width\";\n\n const wSize = min([axis.schema.maxSize, axis.schema.width]);\n const hSize = min([axis.schema.maxSize, axis.schema.height]);\n\n const wrap = textWrap()\n .fontFamily(fF)\n .fontSize(fS)\n .lineHeight(\n axis.schema.shapeConfig.lineHeight\n ? axis.schema.shapeConfig.lineHeight(d, i)\n : undefined,\n );\n\n wrap[w](\n horizontal\n ? space\n : wSize! - hBuff - p - axis._margin.left - axis._margin.right,\n );\n wrap[h](\n horizontal\n ? hSize! - hBuff - p - axis._margin.top - axis._margin.bottom\n : space,\n );\n\n const res = wrap(tickFormat(d)) as ReturnType<typeof wrap> & {\n width: number;\n height: number;\n };\n res.lines = res.lines.filter((d: string) => d !== \"\");\n res.width = res.lines.length ? Math.ceil(max(res.widths)!) : 0;\n res.height = res.lines.length\n ? Math.ceil(res.lines.length * (wrap.lineHeight() as number)) + fP\n : 0;\n return res;\n}\n\n/** Assigns vertical offsets to alternating labels that would overlap. */\nfunction calculateOffset(arr: AxisTextDatum[] = [], horizontal: boolean): void {\n let offset = 0;\n arr.forEach((datum: AxisTextDatum) => {\n const prev = arr[datum.i - 1];\n const h =\n (datum.rotate && horizontal) || (!datum.rotate && !horizontal)\n ? \"width\"\n : \"height\",\n w =\n (datum.rotate && horizontal) || (!datum.rotate && !horizontal)\n ? \"height\"\n : \"width\";\n\n if (!prev) {\n offset = 1;\n } else if (\n prev.position + prev[w] / 2 >\n datum.position - datum[w] / 2\n ) {\n if (offset) {\n datum.offset = prev[h];\n offset = 0;\n } else offset = 1;\n }\n });\n}\n\n/**\n Measures every label, computes per-label space, sizes via `textWrap`, and\n resolves truncation (and optional offset). Returns the `textData` array.\n*/\nexport function createTextData(\n axis: Axis,\n ctx: LabelLayoutCtx & {labels: unknown[]; rangeOuter: number[]; offset?: number},\n): AxisTextDatum[] {\n const {labels, rangeOuter, horizontal, hBuff, p, tickFormat, offset = 1} = ctx;\n const labelCtx: LabelLayoutCtx = {horizontal, hBuff, p, tickFormat};\n const {fontSize} = axis.schema.shapeConfig.labelConfig;\n const fontFamilyConfig =\n axis.schema.shapeConfig.labelConfig.fontFamily || d3plusFontFamily;\n const fontPadding = axis.schema.shapeConfig.labelConfig.padding;\n\n let textData = labels.map((d: unknown, i: number) => {\n const fF =\n typeof fontFamilyConfig === \"function\" ? fontFamilyConfig(d, i) : fontFamilyConfig,\n fP =\n typeof fontPadding === \"function\" ? fontPadding(d, i) : fontPadding,\n fS = typeof fontSize === \"function\" ? fontSize(d, i) : fontSize,\n position = axis._getPosition(d);\n\n const lineHeight = axis.schema.shapeConfig.lineHeight\n ? axis.schema.shapeConfig.lineHeight(d, i)\n : fS * 1.4;\n // Base record — `space`/`lines`/`width`/`height` are filled below.\n return {\n d,\n i,\n fF,\n fP,\n fS,\n lineHeight,\n position,\n rotate: axis._labelRotation,\n } as AxisTextDatum;\n });\n\n const maxSpace =\n axis.schema.scale === \"band\"\n ? axis._d3Scale!.bandwidth!()\n : textData.reduce((s: number, d: AxisTextDatum, i: number) => {\n const {position} = d;\n const prevPosition = !i\n ? textData.length === 1\n ? rangeOuter[0]\n : position - (textData[i + 1].position - position)\n : position - (position - textData[i - 1].position);\n const prevSpace = Math.abs(position - prevPosition);\n\n const nextPosition =\n i == textData.length - 1\n ? textData.length === 1\n ? rangeOuter[1]\n : position + (position - textData[i - 1].position)\n : position - (position - textData[i + 1].position);\n const nextSpace = Math.abs(position - nextPosition);\n const mod = axis.schema.scale === \"point\" ? 1 : 2;\n return max([max([prevSpace, nextSpace])! * mod, s])!;\n }, 0);\n\n textData = textData.map((datum: AxisTextDatum) => {\n datum.space = maxSpace - datum.fP * 2;\n const res = calculateLabelSize(axis, datum, labelCtx);\n return Object.assign(res, datum);\n });\n\n const reverseTextData = textData.slice().reverse();\n textData.forEach((datum: AxisTextDatum) => {\n const {fP, i, position} = datum;\n const sizeName =\n (datum.rotate && horizontal) || (!datum.rotate && !horizontal)\n ? \"height\"\n : \"width\";\n let prev: AxisTextDatum | undefined = i\n ? reverseTextData.find((t: AxisTextDatum) => t.i < i && !t.truncated)\n : undefined;\n if (i === textData.length - 1) {\n while (\n prev &&\n position - datum[sizeName] / 2 - fP <\n prev.position + prev[sizeName] / 2\n ) {\n prev.truncated = true;\n prev = reverseTextData.find((t: AxisTextDatum) => t.i < i && !t.truncated);\n }\n }\n datum.truncated = prev\n ? position - datum[sizeName] / 2 - fP <\n prev.position + prev[sizeName] / 2\n : false;\n });\n\n if (offset > 1) calculateOffset(textData, horizontal);\n return textData;\n}\n\n/** Derives `_outerBounds` + axis margins from the measured text data. */\nexport function computeAxisBounds(\n axis: Axis,\n ctx: {\n textData: AxisTextDatum[];\n rangeOuter: number[];\n hBuff: number;\n horizontal: boolean;\n p: number;\n width: string;\n height: string;\n x: string;\n y: string;\n opposite: string;\n margin: Record<string, number>;\n },\n): Record<string, number> {\n const {textData, rangeOuter, hBuff, horizontal, p, width, height, x, y, opposite, margin} = ctx;\n const tBuff = axis.schema.shape === \"Line\" ? 0 : hBuff;\n const bounds: Record<string, number> = (axis._outerBounds = {\n [height]:\n (max(textData, (t: AxisTextDatum) =>\n Math.ceil(t[t.rotate || !horizontal ? \"width\" : \"height\"] + (t.offset ?? 0)),\n ) || 0) + (textData.length ? p : 0),\n [width]: rangeOuter[rangeOuter.length - 1] - rangeOuter[0],\n [x]: rangeOuter[0],\n });\n\n bounds[height] =\n typeof axis.schema.fixedSize === \"number\"\n ? axis.schema.fixedSize\n : max([axis.schema.minSize, bounds[height]])!;\n axis._labelSpace = bounds[height];\n\n margin[axis.schema.orient] += hBuff;\n margin[opposite] =\n axis.schema.gridSize !== undefined\n ? max([axis.schema.gridSize, tBuff])!\n : (axis.schema[height] as number) - margin[axis.schema.orient] - bounds[height] - p;\n bounds[height] += margin[opposite] + margin[axis.schema.orient];\n bounds[y] =\n axis.schema.align === \"start\"\n ? axis.schema.padding\n : axis.schema.align === \"end\"\n ? (axis.schema[height] as number) - bounds[height] - axis.schema.padding\n : (axis.schema[height] as number) / 2 - bounds[height] / 2;\n\n return bounds;\n}\n"],"names":["max","min","fontFamily","d3plusFontFamily","textWrap","applyTitleMargin","axis","ctx","schema","title","range","p","height","margin","titleConfig","fontSize","lineHeight","titleWrap","width","length","tickSize","lines","orient","computeBuffers","_ticks","tickGet","hBuff","shape","shapeConfig","r","tick","wBuff","calculateLabelSize","datum","horizontal","tickFormat","d","i","fF","fP","fS","rotate","space","h","w","wSize","maxSize","hSize","wrap","undefined","_margin","left","right","top","bottom","res","filter","Math","ceil","widths","calculateOffset","arr","offset","forEach","prev","position","createTextData","labels","rangeOuter","labelCtx","labelConfig","fontFamilyConfig","fontPadding","padding","textData","map","_getPosition","_labelRotation","maxSpace","scale","_d3Scale","bandwidth","reduce","s","prevPosition","prevSpace","abs","nextPosition","nextSpace","mod","Object","assign","reverseTextData","slice","reverse","sizeName","find","t","truncated","computeAxisBounds","x","y","opposite","tBuff","bounds","_outerBounds","fixedSize","minSize","_labelSpace","gridSize","align"],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKA,GACA,SAAQA,GAAG,EAAEC,GAAG,QAAO,WAAW;AAElC,SAAQC,cAAcC,gBAAgB,EAAEC,QAAQ,QAAO,eAAe;AAqCtE,uEAAuE,GACvE,OAAO,SAASC,iBACdC,IAAU,EACVC,GAAiF;IAEjF,IAAI,CAACD,KAAKE,MAAM,CAACC,KAAK,EAAE;IACxB,IAAOC,QAA4BH,IAA5BG,OAAOC,IAAqBJ,IAArBI,GAAGC,SAAkBL,IAAlBK,QAAQC,SAAUN,IAAVM;IACzB,IAA2CP,2BAAAA,KAAKE,MAAM,CAACM,WAAW,EAA3DZ,aAAoCI,yBAApCJ,YAAYa,WAAwBT,yBAAxBS,UAAUC,aAAcV,yBAAdU;IAC7B,IAAMC,YAAYb,WACfF,UAAU,CAAC,OAAOA,eAAe,aA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Label/text layout helpers for `measureAxis` (see `axisLayout.ts`). Pure\n compute — no DOM. `createTextData` measures every label via `textWrap`,\n resolves truncation/offset, and returns the `textData` array the paint\n phase consumes; `computeAxisBounds` derives `_outerBounds` + margins.\n*/\nimport {max, min} from \"d3-array\";\n\nimport {fontFamily as d3plusFontFamily, textWrap} from \"@d3plus/text\";\n\nimport type Axis from \"./Axis.js\";\n\n/** Resolves a tick's pixel size from the shape config (or a constant). */\nexport type TickGet = (d?: {tick?: boolean; id?: unknown}, i?: number) => number;\n\n/**\n One measured axis label. Built incrementally: the base fields come from the\n label-mapping pass, `space`/`lines`/`widths`/`width`/`height` are filled by\n `calculateLabelSize`, and `truncated`/`offset` by the collision passes.\n*/\nexport interface AxisTextDatum {\n d: unknown;\n i: number;\n fF: string;\n fP: number;\n fS: number;\n lineHeight: number;\n position: number;\n rotate?: boolean;\n space: number;\n lines: string[];\n widths: number[];\n width: number;\n height: number;\n truncated?: boolean;\n offset?: number;\n}\n\ninterface LabelLayoutCtx {\n horizontal: boolean;\n hBuff: number;\n p: number;\n tickFormat: (d: unknown) => string;\n}\n\n/** Applies the axis title's wrapped height to the orient-side margin. */\nexport function applyTitleMargin(\n axis: Axis,\n ctx: {range: number[]; p: number; height: string; margin: Record<string, number>},\n): void {\n if (!axis.schema.title) return;\n const {range, p, height, margin} = ctx;\n const {fontFamily, fontSize, lineHeight} = axis.schema.titleConfig;\n const titleWrap = textWrap()\n .fontFamily(typeof fontFamily === \"function\" ? fontFamily() : fontFamily)\n .fontSize(typeof fontSize === \"function\" ? fontSize() : fontSize)\n .lineHeight(typeof lineHeight === \"function\" ? lineHeight() : lineHeight)\n .width(range[range.length - 1] - range[0] - p * 2)\n .height((axis.schema[height] as number) - axis.schema.tickSize - p * 2);\n const lines = titleWrap(axis.schema.title).lines.length;\n margin[axis.schema.orient] = lines * titleWrap.lineHeight()! + p;\n}\n\n/** Resolves the tick height/width buffers from the shape config. */\nexport function computeBuffers(\n axis: Axis,\n _ticks: unknown[],\n tickGet: TickGet,\n height: string,\n): {hBuff: number; wBuff: number} {\n // The ternary and `tickGet` already resolve per-tick functions to a single\n // value, so both buffers are numbers by here.\n let hBuff: number =\n axis.schema.shape === \"Circle\"\n ? typeof axis.schema.shapeConfig.r === \"function\"\n ? axis.schema.shapeConfig.r({tick: true})\n : axis.schema.shapeConfig.r\n : axis.schema.shape === \"Rect\"\n ? typeof axis.schema.shapeConfig[height] === \"function\"\n ? axis.schema.shapeConfig[height]({tick: true})\n : axis.schema.shapeConfig[height]\n : axis.schema.tickSize;\n let wBuff: number = tickGet({tick: true});\n\n if (axis.schema.shape === \"Rect\") hBuff /= 2;\n if (axis.schema.shape !== \"Circle\") wBuff /= 2;\n\n return {hBuff, wBuff};\n}\n\n/** Wraps + measures a single label, returning its sized text result. */\nfunction calculateLabelSize(\n axis: Axis,\n datum: AxisTextDatum,\n ctx: LabelLayoutCtx,\n): {lines: string[]; widths: number[]; width: number; height: number} {\n const {horizontal, hBuff, p, tickFormat} = ctx;\n const {d, i, fF, fP, fS, rotate, space} = datum;\n const h = rotate ? \"width\" : \"height\",\n w = rotate ? \"height\" : \"width\";\n\n const wSize = min([axis.schema.maxSize, axis.schema.width]);\n const hSize = min([axis.schema.maxSize, axis.schema.height]);\n\n const wrap = textWrap()\n .fontFamily(fF)\n .fontSize(fS)\n .lineHeight(\n axis.schema.shapeConfig.lineHeight\n ? axis.schema.shapeConfig.lineHeight(d, i)\n : undefined,\n );\n\n wrap[w](\n horizontal\n ? space\n : wSize! - hBuff - p - axis._margin.left - axis._margin.right,\n );\n wrap[h](\n horizontal\n ? hSize! - hBuff - p - axis._margin.top - axis._margin.bottom\n : space,\n );\n\n const text = tickFormat(d);\n let res = wrap(text) as ReturnType<typeof wrap> & {\n width: number;\n height: number;\n };\n // A label wider than its share of the axis wraps to nothing; measure it\n // across the whole axis instead, so the overlap pass thins the labels out.\n if (horizontal && !rotate && `${text}`.trim() && !res.lines.some((l: string) => l !== \"\")) {\n wrap.width(wSize! - p * 2);\n res = wrap(text) as typeof res;\n }\n res.lines = res.lines.filter((d: string) => d !== \"\");\n res.width = res.lines.length ? Math.ceil(max(res.widths)!) : 0;\n res.height = res.lines.length\n ? Math.ceil(res.lines.length * (wrap.lineHeight() as number)) + fP\n : 0;\n return res;\n}\n\n/** Assigns vertical offsets to alternating labels that would overlap. */\nfunction calculateOffset(arr: AxisTextDatum[] = [], horizontal: boolean): void {\n let offset = 0;\n arr.forEach((datum: AxisTextDatum) => {\n const prev = arr[datum.i - 1];\n const h =\n (datum.rotate && horizontal) || (!datum.rotate && !horizontal)\n ? \"width\"\n : \"height\",\n w =\n (datum.rotate && horizontal) || (!datum.rotate && !horizontal)\n ? \"height\"\n : \"width\";\n\n if (!prev) {\n offset = 1;\n } else if (\n prev.position + prev[w] / 2 >\n datum.position - datum[w] / 2\n ) {\n if (offset) {\n datum.offset = prev[h];\n offset = 0;\n } else offset = 1;\n }\n });\n}\n\n/**\n Measures every label, computes per-label space, sizes via `textWrap`, and\n resolves truncation (and optional offset). Returns the `textData` array.\n*/\nexport function createTextData(\n axis: Axis,\n ctx: LabelLayoutCtx & {labels: unknown[]; rangeOuter: number[]; offset?: number},\n): AxisTextDatum[] {\n const {labels, rangeOuter, horizontal, hBuff, p, tickFormat, offset = 1} = ctx;\n const labelCtx: LabelLayoutCtx = {horizontal, hBuff, p, tickFormat};\n const {fontSize} = axis.schema.shapeConfig.labelConfig;\n const fontFamilyConfig =\n axis.schema.shapeConfig.labelConfig.fontFamily || d3plusFontFamily;\n const fontPadding = axis.schema.shapeConfig.labelConfig.padding;\n\n let textData = labels.map((d: unknown, i: number) => {\n const fF =\n typeof fontFamilyConfig === \"function\" ? fontFamilyConfig(d, i) : fontFamilyConfig,\n fP =\n typeof fontPadding === \"function\" ? fontPadding(d, i) : fontPadding,\n fS = typeof fontSize === \"function\" ? fontSize(d, i) : fontSize,\n position = axis._getPosition(d);\n\n const lineHeight = axis.schema.shapeConfig.lineHeight\n ? axis.schema.shapeConfig.lineHeight(d, i)\n : fS * 1.4;\n // Base record — `space`/`lines`/`width`/`height` are filled below.\n return {\n d,\n i,\n fF,\n fP,\n fS,\n lineHeight,\n position,\n rotate: axis._labelRotation,\n } as AxisTextDatum;\n });\n\n const maxSpace =\n axis.schema.scale === \"band\"\n ? axis._d3Scale!.bandwidth!()\n : textData.reduce((s: number, d: AxisTextDatum, i: number) => {\n const {position} = d;\n const prevPosition = !i\n ? textData.length === 1\n ? rangeOuter[0]\n : position - (textData[i + 1].position - position)\n : position - (position - textData[i - 1].position);\n const prevSpace = Math.abs(position - prevPosition);\n\n const nextPosition =\n i == textData.length - 1\n ? textData.length === 1\n ? rangeOuter[1]\n : position + (position - textData[i - 1].position)\n : position - (position - textData[i + 1].position);\n const nextSpace = Math.abs(position - nextPosition);\n const mod = axis.schema.scale === \"point\" ? 1 : 2;\n return max([max([prevSpace, nextSpace])! * mod, s])!;\n }, 0);\n\n textData = textData.map((datum: AxisTextDatum) => {\n datum.space = maxSpace - datum.fP * 2;\n const res = calculateLabelSize(axis, datum, labelCtx);\n // A label measured wider than its share (see `calculateLabelSize`) is\n // painted at that width; the overlap pass below thins its neighbors.\n if (horizontal && !datum.rotate) datum.space = Math.max(datum.space, Math.ceil(res.width));\n return Object.assign(res, datum);\n });\n\n const reverseTextData = textData.slice().reverse();\n textData.forEach((datum: AxisTextDatum) => {\n const {fP, i, position} = datum;\n const sizeName =\n (datum.rotate && horizontal) || (!datum.rotate && !horizontal)\n ? \"height\"\n : \"width\";\n let prev: AxisTextDatum | undefined = i\n ? reverseTextData.find((t: AxisTextDatum) => t.i < i && !t.truncated)\n : undefined;\n if (i === textData.length - 1) {\n while (\n prev &&\n position - datum[sizeName] / 2 - fP <\n prev.position + prev[sizeName] / 2\n ) {\n prev.truncated = true;\n prev = reverseTextData.find((t: AxisTextDatum) => t.i < i && !t.truncated);\n }\n }\n datum.truncated = prev\n ? position - datum[sizeName] / 2 - fP <\n prev.position + prev[sizeName] / 2\n : false;\n });\n\n if (offset > 1) calculateOffset(textData, horizontal);\n return textData;\n}\n\n/** Derives `_outerBounds` + axis margins from the measured text data. */\nexport function computeAxisBounds(\n axis: Axis,\n ctx: {\n textData: AxisTextDatum[];\n rangeOuter: number[];\n hBuff: number;\n horizontal: boolean;\n p: number;\n width: string;\n height: string;\n x: string;\n y: string;\n opposite: string;\n margin: Record<string, number>;\n },\n): Record<string, number> {\n const {textData, rangeOuter, hBuff, horizontal, p, width, height, x, y, opposite, margin} = ctx;\n const tBuff = axis.schema.shape === \"Line\" ? 0 : hBuff;\n const bounds: Record<string, number> = (axis._outerBounds = {\n [height]:\n (max(textData, (t: AxisTextDatum) =>\n Math.ceil(t[t.rotate || !horizontal ? \"width\" : \"height\"] + (t.offset ?? 0)),\n ) || 0) + (textData.length ? p : 0),\n [width]: rangeOuter[rangeOuter.length - 1] - rangeOuter[0],\n [x]: rangeOuter[0],\n });\n\n bounds[height] =\n typeof axis.schema.fixedSize === \"number\"\n ? axis.schema.fixedSize\n : max([axis.schema.minSize, bounds[height]])!;\n axis._labelSpace = bounds[height];\n\n margin[axis.schema.orient] += hBuff;\n margin[opposite] =\n axis.schema.gridSize !== undefined\n ? max([axis.schema.gridSize, tBuff])!\n : (axis.schema[height] as number) - margin[axis.schema.orient] - bounds[height] - p;\n bounds[height] += margin[opposite] + margin[axis.schema.orient];\n bounds[y] =\n axis.schema.align === \"start\"\n ? axis.schema.padding\n : axis.schema.align === \"end\"\n ? (axis.schema[height] as number) - bounds[height] - axis.schema.padding\n : (axis.schema[height] as number) / 2 - bounds[height] / 2;\n\n return bounds;\n}\n"],"names":["max","min","fontFamily","d3plusFontFamily","textWrap","applyTitleMargin","axis","ctx","schema","title","range","p","height","margin","titleConfig","fontSize","lineHeight","titleWrap","width","length","tickSize","lines","orient","computeBuffers","_ticks","tickGet","hBuff","shape","shapeConfig","r","tick","wBuff","calculateLabelSize","datum","horizontal","tickFormat","d","i","fF","fP","fS","rotate","space","h","w","wSize","maxSize","hSize","wrap","undefined","_margin","left","right","top","bottom","text","res","trim","some","l","filter","Math","ceil","widths","calculateOffset","arr","offset","forEach","prev","position","createTextData","labels","rangeOuter","labelCtx","labelConfig","fontFamilyConfig","fontPadding","padding","textData","map","_getPosition","_labelRotation","maxSpace","scale","_d3Scale","bandwidth","reduce","s","prevPosition","prevSpace","abs","nextPosition","nextSpace","mod","Object","assign","reverseTextData","slice","reverse","sizeName","find","t","truncated","computeAxisBounds","x","y","opposite","tBuff","bounds","_outerBounds","fixedSize","minSize","_labelSpace","gridSize","align"],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKA,GACA,SAAQA,GAAG,EAAEC,GAAG,QAAO,WAAW;AAElC,SAAQC,cAAcC,gBAAgB,EAAEC,QAAQ,QAAO,eAAe;AAqCtE,uEAAuE,GACvE,OAAO,SAASC,iBACdC,IAAU,EACVC,GAAiF;IAEjF,IAAI,CAACD,KAAKE,MAAM,CAACC,KAAK,EAAE;IACxB,IAAOC,QAA4BH,IAA5BG,OAAOC,IAAqBJ,IAArBI,GAAGC,SAAkBL,IAAlBK,QAAQC,SAAUN,IAAVM;IACzB,IAA2CP,2BAAAA,KAAKE,MAAM,CAACM,WAAW,EAA3DZ,aAAoCI,yBAApCJ,YAAYa,WAAwBT,yBAAxBS,UAAUC,aAAcV,yBAAdU;IAC7B,IAAMC,YAAYb,WACfF,UAAU,CAAC,OAAOA,eAAe,aAAaA,eAAeA,YAC7Da,QAAQ,CAAC,OAAOA,aAAa,aAAaA,aAAaA,UACvDC,UAAU,CAAC,OAAOA,eAAe,aAAaA,eAAeA,YAC7DE,KAAK,CAACR,KAAK,CAACA,MAAMS,MAAM,GAAG,EAAE,GAAGT,KAAK,CAAC,EAAE,GAAGC,IAAI,GAC/CC,MAAM,CAAC,AAACN,KAAKE,MAAM,CAACI,OAAO,GAAcN,KAAKE,MAAM,CAACY,QAAQ,GAAGT,IAAI;IACvE,IAAMU,QAAQJ,UAAUX,KAAKE,MAAM,CAACC,KAAK,EAAEY,KAAK,CAACF,M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ct() {
126
126
  import { max, min } from "d3-array";
127
127
  import { select } from "d3-selection";
128
128
  import { transition } from "d3-transition";
129
- import { colorContrast, colorDefaults } from "@d3plus/color";
129
+ import { colorContrast } from "@d3plus/color";
130
130
  import { assign, backgroundColor, elem } from "@d3plus/dom";
131
131
  import { formatAbbreviate } from "@d3plus/format";
132
132
  import { Axis, TextBox } from "../index.js";
@@ -175,22 +175,20 @@ import { renderGradient, renderLegendVariant } from "./colorScaleRender.js";
175
175
  key: "color",
176
176
  coerce: "identity"
177
177
  },
178
- // Blue high pole (and default sequential hue), gray "nothing" midpoint, red
179
- // low pole — warm/cool poles that stay distinct under color-vision deficiency.
178
+ // Unset poles fall back to `colorDefaults` at draw time: `sequential` (blue)
179
+ // high, `light` midpoint, `off` (red) low — warm/cool poles that stay
180
+ // distinct under color-vision deficiency.
180
181
  {
181
182
  key: "colorMax",
182
- coerce: "identity",
183
- default: colorDefaults.sequential
183
+ coerce: "identity"
184
184
  },
185
185
  {
186
186
  key: "colorMid",
187
- coerce: "identity",
188
- default: colorDefaults.light
187
+ coerce: "identity"
189
188
  },
190
189
  {
191
190
  key: "colorMin",
192
- coerce: "identity",
193
- default: colorDefaults.off
191
+ coerce: "identity"
194
192
  },
195
193
  {
196
194
  key: "domain",
@@ -294,14 +292,16 @@ var ColorScale = /*#__PURE__*/ function(BaseClass) {
294
292
  _this.schema.labelConfig = {
295
293
  fontColor: function fontColor() {
296
294
  var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
297
- return colorContrast(bg);
295
+ return colorContrast(bg, _this.schema.colorDefaults);
298
296
  },
299
297
  fontSize: 12
300
298
  };
301
299
  _this._legendClass = new Legend();
302
300
  _this.schema.legendConfig = {
303
301
  shapeConfig: {
304
- stroke: colorDefaults.dark,
302
+ stroke: function stroke() {
303
+ return _this.schema.colorDefaults.dark;
304
+ },
305
305
  strokeWidth: 1
306
306
  }
307
307
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/ColorScale/ColorScale.ts"],"sourcesContent":["import {max, min} from \"d3-array\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport {colorContrast, colorDefaults} from \"@d3plus/color\";\nimport {assign, backgroundColor, elem} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\nimport {formatAbbreviate} from \"@d3plus/format\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {GroupNode, SceneNode, Transform} from \"@d3plus/render\";\nimport type {SvgRenderer} from \"@d3plus/render\";\n\nimport {Axis, TextBox} from \"../index.js\";\nimport {Rect} from \"../../shapes/index.js\";\nimport {accessor, BaseClass, paintComponentScene} from \"../../utils/index.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\nimport type {ConfigField} from \"../../fluent.js\";\n\nimport Legend from \"../Legend/Legend.js\";\nimport {computeColorScale} from \"./colorScaleScale.js\";\nimport {renderGradient, renderLegendVariant} from \"./colorScaleRender.js\";\nimport type {ColorScaleGroups} from \"./colorScaleRender.js\";\n\n/** ColorScale's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst colorScaleSchema: ConfigField[] = [\n {key: \"align\", coerce: \"identity\", default: \"middle\"},\n {key: \"buckets\", coerce: \"identity\", default: 5},\n {key: \"bucketAxis\", coerce: \"identity\", default: false},\n {key: \"bucketFormat\", coerce: \"identity\"},\n {\n key: \"bucketJoiner\",\n coerce: \"identity\",\n default: (a: string, b: string): string => (a !== b ? `${a} - ${b}` : `${a}`),\n },\n {key: \"centered\", coerce: \"identity\", default: true},\n // No default palette: an unset `color` falls through to the single-hue\n // (colorMax / colorMin) ramp or the diverging (min↔mid↔max) construction,\n // so magnitude reads as one hue getting darker rather than a multi-hue ramp.\n {key: \"color\", coerce: \"identity\"},\n // Blue high pole (and default sequential hue), gray \"nothing\" midpoint, red\n // low pole — warm/cool poles that stay distinct under color-vision deficiency.\n {key: \"colorMax\", coerce: \"identity\", default: colorDefaults.sequential},\n {key: \"colorMid\", coerce: \"identity\", default: colorDefaults.light},\n {key: \"colorMin\", coerce: \"identity\", default: colorDefaults.off},\n {key: \"domain\", coerce: \"identity\"},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"height\", coerce: \"identity\", default: 200},\n {key: \"midpoint\", coerce: \"identity\", default: 0},\n {key: \"orient\", coerce: \"identity\", default: \"bottom\"},\n {key: \"padding\", coerce: \"identity\", default: 5},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"scale\", coerce: \"identity\", default: \"linear\"},\n {key: \"size\", coerce: \"identity\", default: 10},\n {key: \"value\", coerce: \"const\", default: accessor(\"value\")},\n {key: \"width\", coerce: \"identity\", default: 400},\n];\n\n/**\n Creates an SVG color scale based on an array of data.\n*/\nexport default class ColorScale extends BaseClass {\n // installFluent generates the config accessors (align, buckets, …) at\n // runtime; the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n _select!: D3Selection;\n _axisClass: Axis;\n _axisTest: Axis;\n _colorScale?: D3Scale<string>;\n _data: DataPoint[];\n _group!: D3Selection;\n _labelClass: TextBox;\n _labelMin: string | undefined;\n _labelMax: string | undefined;\n _legendClass: Legend;\n _outerBounds: Record<string, number>;\n _rectClass: Rect;\n /** Smooth-gradient fill token (`gradient:<json>`), set by renderGradientStops. */\n _gradientFill?: string;\n // Standalone scene renderer (used when rendered on its own, not inside a\n // Viz). Reused across re-renders by paintComponentScene().\n _sceneRenderer?: SvgRenderer;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n installFluent(this, colorScaleSchema);\n\n this._axisClass = new Axis();\n this.schema.axisConfig = {\n gridSize: 0,\n };\n this._axisTest = new Axis();\n this.schema.bucketFormat = (\n tick: number,\n i: number,\n ticks: number[],\n allValues: number[],\n ): string => {\n const format = (this.schema.axisConfig.tickFormat\n ? this.schema.axisConfig.tickFormat\n : formatAbbreviate) as (v: number | undefined) => string;\n\n const next = ticks[i + 1];\n const prev = i ? ticks[i - 1] : false;\n const last = i === ticks.length - 1;\n if (tick === next || last) {\n const suffix = last && tick < max(allValues)! ? \"+\" : \"\";\n return `${format(tick)}${suffix}`;\n } else {\n const mod = next ? next / 100 : tick / 100;\n\n const pow =\n mod >= 1 || mod <= -1\n ? Math.round(mod).toString().length - 1\n : mod\n .toString()\n .split(\".\")[1]\n .replace(/([1-9])[1-9].*$/, \"$1\").length * -1;\n const ten = Math.pow(10, pow);\n\n const prevValue =\n prev === tick && i === 1\n ? format(\n min([\n tick + ten,\n allValues.find((d: number) => d > tick && d < next),\n ] as number[]),\n )\n : format(tick);\n\n const nextValue =\n tick && i === 1\n ? format(next)\n : format(\n max([\n next - ten,\n allValues.reverse().find((d: number) => d > tick && d < next),\n ] as number[]),\n );\n\n return this.schema.bucketJoiner(prevValue, nextValue);\n }\n };\n this._data = [];\n this._labelClass = new TextBox();\n this.schema.labelConfig = {\n fontColor: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg);\n },\n fontSize: 12,\n };\n this._legendClass = new Legend();\n this.schema.legendConfig = {\n shapeConfig: {\n stroke: colorDefaults.dark,\n strokeWidth: 1,\n },\n };\n this._outerBounds = {width: 0, height: 0, x: 0, y: 0};\n this._rectClass = new Rect().parent(\n this as unknown as Record<string, unknown>,\n );\n this.schema.rectConfig = {\n stroke: \"#999\",\n strokeWidth: 1,\n };\n }\n\n /**\n Renders the current ColorScale to the page.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: (...args: unknown[]) => unknown): this {\n // Standalone full-render fallback: mount into a <div> appended to <body> so\n // `paintComponentScene` creates the single <svg> inside it — mounting the\n // renderer into an <svg> container would nest a second one. Skipped in\n // compute mode, where the caller reads `toScene()` and no DOM is created.\n if (this._select === void 0 && this.schema.renderMode !== \"compute\")\n this.select(select(\"body\").append(\"div\").node() as unknown as HTMLElement);\n\n // Shape <g> Group\n this._group = elem(\"g.d3plus-ColorScale\", {parent: this._select});\n\n const compute = computeColorScale(this);\n\n const gradient =\n this.schema.bucketAxis ||\n ![\"buckets\", \"jenks\", \"quantile\"].includes(this.schema.scale);\n const t = transition().duration(this.schema.duration);\n const groupParams: Record<string, unknown> = {\n enter: {opacity: 0},\n exit: {opacity: 0},\n parent: this._group,\n transition: t,\n update: {opacity: 1},\n };\n const labelGroup = elem(\n \"g.d3plus-ColorScale-labels\",\n Object.assign({condition: gradient}, groupParams),\n );\n const rectGroup = elem(\n \"g.d3plus-ColorScale-Rect\",\n Object.assign({condition: gradient}, groupParams),\n );\n const legendGroup = elem(\n \"g.d3plus-ColorScale-legend\",\n Object.assign({condition: !gradient}, groupParams),\n );\n\n const groups: ColorScaleGroups = {\n labelGroup,\n rectGroup,\n legendGroup,\n groupParams,\n gradient,\n };\n\n if (gradient) renderGradient(this, compute, groups);\n else renderLegendVariant(this, compute, groups);\n\n // Standalone render: paint the scene into the user's `_select`. Inside a\n // Viz the color scale runs in compute mode and the Viz composes its\n // toScene().\n if (this.schema.renderMode !== \"compute\") paintComponentScene(this);\n\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n Produces a backend-agnostic scene graph for this ColorScale with no DOM\n dependency. The discrete variant (jenks/buckets/quantile) delegates to the\n internal Legend's toScene(); the gradient variant composes the Rect, Axis,\n and label TextBox scenes. The scaleGroup's translate (set by the chart's\n colorScale feature on `g.d3plus-viz-colorScale`) is read off `_select` so\n the content lands at its on-screen position.\n\n A smooth (non-bucketed) gradient paints its Rect with a `gradient:<json>`\n fill token (see renderGradientStops); the backend materializes it into a\n `<linearGradient>` (SVG) or a CanvasGradient (Canvas). Bucketed gradients\n and the discrete variant use concrete per-bucket fills.\n */\n toScene(): GroupNode {\n const children: SceneNode[] = [];\n const gradient =\n this.schema.bucketAxis ||\n ![\"buckets\", \"jenks\", \"quantile\"].includes(this.schema.scale);\n\n const pushScene = (\n cls: {toScene?: () => GroupNode} | undefined,\n ): void => {\n if (cls && typeof cls.toScene === \"function\") {\n const s = cls.toScene();\n if (s) children.push(s);\n }\n };\n\n if (gradient) {\n pushScene(this._rectClass as unknown as {toScene?: () => GroupNode});\n pushScene(this._axisClass as unknown as {toScene?: () => GroupNode});\n pushScene(this._labelClass as unknown as {toScene?: () => GroupNode});\n } else {\n pushScene(this._legendClass as unknown as {toScene?: () => GroupNode});\n }\n\n // Preserve the placement of the scaleGroup the chart's colorScale feature\n // positioned (translate on `g.d3plus-viz-colorScale`).\n let transform: Transform | undefined;\n const node =\n this._select && typeof this._select.node === \"function\"\n ? (this._select.node() as Element | null)\n : null;\n if (node && typeof node.getAttribute === \"function\") {\n const attr = node.getAttribute(\"transform\");\n if (attr) {\n const m = /translate\\(\\s*([-\\d.eE]+)[\\s,]+([-\\d.eE]+)/.exec(attr);\n if (m) transform = {x: Number(m[1]), y: Number(m[2])};\n }\n }\n\n return {\n type: \"group\",\n key: `ColorScale-${this._uuid.slice(0, 8)}`,\n ...(transform ? {transform} : {}),\n children,\n };\n }\n\n /**\n The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Axis](http://d3plus.org/docs/#Axis). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/).\n*/\n axisConfig(): Record<string, unknown>;\n axisConfig(_: Record<string, unknown>): this;\n axisConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.axisConfig = assign(this.schema.axisConfig, _!)), this)\n : this.schema.axisConfig;\n }\n\n /**\n The data array used to create shapes. A shape key will be drawn for each object in the array.\n*/\n data(): DataPoint[];\n data(_: DataPoint[]): this;\n data(_?: DataPoint[]): unknown {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n A pass-through for the [TextBox](http://d3plus.org/docs/#TextBox) class used to style the labelMin and labelMax text.\n*/\n labelConfig(): Record<string, unknown>;\n labelConfig(_: Record<string, unknown>): this;\n labelConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.labelConfig = assign(this.schema.labelConfig, _!)), this)\n : this.schema.labelConfig;\n }\n\n /**\n Defines a text label to be displayed off of the end of the minimum point in the scale (currently only available in horizontal orientation).\n*/\n labelMin(): string | undefined;\n labelMin(_: string): this;\n labelMin(_?: string): unknown {\n return arguments.length ? ((this._labelMin = _), this) : this._labelMin;\n }\n\n /**\n Defines a text label to be displayed off of the end of the maximum point in the scale (currently only available in horizontal orientation).\n*/\n labelMax(): string | undefined;\n labelMax(_: string): this;\n labelMax(_?: string): unknown {\n return arguments.length ? ((this._labelMax = _), this) : this._labelMax;\n }\n\n /**\n The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Axis](http://d3plus.org/docs/#Axis). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/).\n*/\n legendConfig(): Record<string, unknown>;\n legendConfig(_: Record<string, unknown>): this;\n legendConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.legendConfig = assign(this.schema.legendConfig, _!)), this)\n : this.schema.legendConfig;\n }\n\n /**\n Returns the outer bounds of the ColorScale content. Must be called after rendering.\n @example\n{\"width\": 180, \"height\": 24, \"x\": 10, \"y\": 20}\n*/\n outerBounds(): Record<string, number> {\n return this._outerBounds;\n }\n\n /**\n The [ColorScale](http://d3plus.org/docs/#ColorScale) is constructed by combining an [Axis](http://d3plus.org/docs/#Axis) for the ticks/labels and a [Rect](http://d3plus.org/docs/#Rect) for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the [Axis](http://d3plus.org/docs/#Axis) class used to display the text ([axisConfig](http://d3plus.org/docs/#ColorScale.axisConfig)) and the [Rect](http://d3plus.org/docs/#Rect) class used to draw the color breaks ([rectConfig](http://d3plus.org/docs/#ColorScale.rectConfig)). This method acts as a pass-through to the config method of the [Rect](http://d3plus.org/docs/#Rect). An example usage of this method can be seen [here](http://d3plus.org/examples/d3plus-legend/colorScale-dark/).\n*/\n rectConfig(): Record<string, unknown>;\n rectConfig(_: Record<string, unknown>): this;\n rectConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.rectConfig = assign(this.schema.rectConfig, _!)), this)\n : this.schema.rectConfig;\n }\n\n /**\n The SVG container element for this visualization. 3 selector or DOM element.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement): this;\n select(_?: string | HTMLElement): unknown {\n return arguments.length\n ? ((this._select = select(_ as never) as unknown as D3Selection), this)\n : this._select;\n }\n}\n"],"names":["max","min","select","transition","colorContrast","colorDefaults","assign","backgroundColor","elem","formatAbbreviate","Axis","TextBox","Rect","accessor","BaseClass","paintComponentScene","installFluent","Legend","computeColorScale","renderGradient","renderLegendVariant","colorScaleSchema","key","coerce","default","a","b","sequential","light","off","ColorScale","_select","_axisClass","_axisTest","_colorScale","_data","_group","_labelClass","_labelMin","_labelMax","_legendClass","_outerBounds","_rectClass","_gradientFill","_sceneRenderer","schema","axisConfig","gridSize","bucketFormat","tick","i","ticks","allValues","format","tickFormat","next","prev","last","length","suffix","mod","pow","Math","round","toString","split","replace","ten","prevValue","find","d","nextValue","reverse","bucketJoiner","labelConfig","fontColor","bg","node","fontSize","legendConfig","shapeConfig","stroke","dark","strokeWidth","width","height","x","y","parent","rectConfig","render","callback","renderMode","append","compute","gradient","bucketAxis","includes","scale","t","duration","groupParams","enter","opacity","exit","update","labelGroup","Object","condition","rectGroup","legendGroup","groups","setTimeout","toScene","children","pushScene","cls","s","push","transform","getAttribute","attr","m","exec","Number","type","_uuid","slice","_","arguments","data","labelMin","labelMax","outerBounds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,GAAG,EAAEC,GAAG,QAAO,WAAW;AAClC,SAAQC,MAAM,QAAO,eAAe;AACpC,SAAQC,UAAU,QAAO,gBAAgB;AAEzC,SAAQC,aAAa,EAAEC,aAAa,QAAO,gBAAgB;AAC3D,SAAQC,MAAM,EAAEC,eAAe,EAAEC,IAAI,QAAO,cAAc;AAE1D,SAAQC,gBAAgB,QAAO,iBAAiB;AAMhD,SAAQC,IAAI,EAAEC,OAAO,QAAO,cAAc;AAC1C,SAAQC,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,QAAQ,EAAEC,SAAS,EAAEC,mBAAmB,QAAO,uBAAuB;AAE9E,SAAQC,aAAa,QAAO,kBAAkB;AAG9C,OAAOC,YAAY,sBAAsB;AACzC,SAAQC,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,cAAc,EAAEC,mBAAmB,QAAO,wBAAwB;AAG1E,sFAAsF,GACtF,IAAMC,mBAAkC;IACtC;QAACC,KAAK;QAASC,QAAQ;QAAYC,SAAS;IAAQ;IACpD;QAACF,KAAK;QAAWC,QAAQ;QAAYC,SAAS;IAAC;IAC/C;QAACF,KAAK;QAAcC,QAAQ;QAAYC,SAAS;IAAK;IACtD;QAACF,KAAK;QAAgBC,QAAQ;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;;YAOAwC,KAAAA;mBAAAA,SAAAA,aAAaiD,CAA2B;gBACtC,OAAOC,UAAUvE,MAAM,GAClB,CAAA,AAAC,IAAI,CAACb,MAAM,CAACkC,YAAY,GAAGzE,OAAO,IAAI,CAACuC,MAAM,CAACkC,YAAY,EAAEiD,IAAM,IAAI,AAAD,IACvE,IAAI,CAACnF,MAAM,CAACkC,YAAY;YAC9B;;;YAEA;;;;AAIF,GACEsD,KAAAA;mBAAAA,SAAAA;gBACE,OAAO,IAAI,CAAC5F,YAAY;YAC1B;;;YAOAgD,KAAAA;mBAAAA,SAAAA,WAAWuC,CAA2B;gBACpC,OAAOC,UAAUvE,MAAM,GAClB,CAAA,AAAC,IAAI,CAACb,MAAM,CAAC4C,UAAU,GAAGnF,OAAO,IAAI,CAACuC,MAAM,CAAC4C,UAAU,EAAEuC,IAAM,IAAI,AAAD,IACnE,IAAI,CAACnF,MAAM,CAAC4C,UAAU;YAC5B;;;YAOAvF,KAAAA;mBAAAA,SAAAA,QAAO8H,CAAwB;gBAC7B,OAAOC,UAAUvE,MAAM,GAClB,CAAA,AAAC,IAAI,CAAC3B,OAAO,GAAG7B,OAAO8H,IAAwC,IAAI,AAAD,IACnE,IAAI,CAACjG,OAAO;YAClB;;;WAnUmBD;EAAmBhB;AAHxC;;AAEA,GACA,SAAqBgB,wBAoUpB"}
1
+ {"version":3,"sources":["../../../../src/components/ColorScale/ColorScale.ts"],"sourcesContent":["import {max, min} from \"d3-array\";\nimport {select} from \"d3-selection\";\nimport {transition} from \"d3-transition\";\n\nimport {colorContrast} from \"@d3plus/color\";\nimport {assign, backgroundColor, elem} from \"@d3plus/dom\";\nimport type {D3Selection} from \"@d3plus/dom\";\nimport {formatAbbreviate} from \"@d3plus/format\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {GroupNode, SceneNode, Transform} from \"@d3plus/render\";\nimport type {SvgRenderer} from \"@d3plus/render\";\n\nimport {Axis, TextBox} from \"../index.js\";\nimport {Rect} from \"../../shapes/index.js\";\nimport {accessor, BaseClass, paintComponentScene} from \"../../utils/index.js\";\nimport type {D3Scale} from \"../../utils/index.js\";\nimport {installFluent} from \"../../fluent.js\";\nimport type {ConfigField} from \"../../fluent.js\";\n\nimport Legend from \"../Legend/Legend.js\";\nimport {computeColorScale} from \"./colorScaleScale.js\";\nimport {renderGradient, renderLegendVariant} from \"./colorScaleRender.js\";\nimport type {ColorScaleGroups} from \"./colorScaleRender.js\";\n\n/** ColorScale's fluent accessor schema. Config storage lives on `this.schema.<key>`. */\nconst colorScaleSchema: ConfigField[] = [\n {key: \"align\", coerce: \"identity\", default: \"middle\"},\n {key: \"buckets\", coerce: \"identity\", default: 5},\n {key: \"bucketAxis\", coerce: \"identity\", default: false},\n {key: \"bucketFormat\", coerce: \"identity\"},\n {\n key: \"bucketJoiner\",\n coerce: \"identity\",\n default: (a: string, b: string): string => (a !== b ? `${a} - ${b}` : `${a}`),\n },\n {key: \"centered\", coerce: \"identity\", default: true},\n // No default palette: an unset `color` falls through to the single-hue\n // (colorMax / colorMin) ramp or the diverging (min↔mid↔max) construction,\n // so magnitude reads as one hue getting darker rather than a multi-hue ramp.\n {key: \"color\", coerce: \"identity\"},\n // Unset poles fall back to `colorDefaults` at draw time: `sequential` (blue)\n // high, `light` midpoint, `off` (red) low — warm/cool poles that stay\n // distinct under color-vision deficiency.\n {key: \"colorMax\", coerce: \"identity\"},\n {key: \"colorMid\", coerce: \"identity\"},\n {key: \"colorMin\", coerce: \"identity\"},\n {key: \"domain\", coerce: \"identity\"},\n {key: \"duration\", coerce: \"identity\", default: 600},\n {key: \"height\", coerce: \"identity\", default: 200},\n {key: \"midpoint\", coerce: \"identity\", default: 0},\n {key: \"orient\", coerce: \"identity\", default: \"bottom\"},\n {key: \"padding\", coerce: \"identity\", default: 5},\n {key: \"renderMode\", coerce: \"identity\", default: \"full\"},\n {key: \"scale\", coerce: \"identity\", default: \"linear\"},\n {key: \"size\", coerce: \"identity\", default: 10},\n {key: \"value\", coerce: \"const\", default: accessor(\"value\")},\n {key: \"width\", coerce: \"identity\", default: 400},\n];\n\n/**\n Creates an SVG color scale based on an array of data.\n*/\nexport default class ColorScale extends BaseClass {\n // installFluent generates the config accessors (align, buckets, …) at\n // runtime; the index signature lets callers reach them through the type.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key: string]: any;\n _select!: D3Selection;\n _axisClass: Axis;\n _axisTest: Axis;\n _colorScale?: D3Scale<string>;\n _data: DataPoint[];\n _group!: D3Selection;\n _labelClass: TextBox;\n _labelMin: string | undefined;\n _labelMax: string | undefined;\n _legendClass: Legend;\n _outerBounds: Record<string, number>;\n _rectClass: Rect;\n /** Smooth-gradient fill token (`gradient:<json>`), set by renderGradientStops. */\n _gradientFill?: string;\n // Standalone scene renderer (used when rendered on its own, not inside a\n // Viz). Reused across re-renders by paintComponentScene().\n _sceneRenderer?: SvgRenderer;\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n*/\n constructor() {\n super();\n installFluent(this, colorScaleSchema);\n\n this._axisClass = new Axis();\n this.schema.axisConfig = {\n gridSize: 0,\n };\n this._axisTest = new Axis();\n this.schema.bucketFormat = (\n tick: number,\n i: number,\n ticks: number[],\n allValues: number[],\n ): string => {\n const format = (this.schema.axisConfig.tickFormat\n ? this.schema.axisConfig.tickFormat\n : formatAbbreviate) as (v: number | undefined) => string;\n\n const next = ticks[i + 1];\n const prev = i ? ticks[i - 1] : false;\n const last = i === ticks.length - 1;\n if (tick === next || last) {\n const suffix = last && tick < max(allValues)! ? \"+\" : \"\";\n return `${format(tick)}${suffix}`;\n } else {\n const mod = next ? next / 100 : tick / 100;\n\n const pow =\n mod >= 1 || mod <= -1\n ? Math.round(mod).toString().length - 1\n : mod\n .toString()\n .split(\".\")[1]\n .replace(/([1-9])[1-9].*$/, \"$1\").length * -1;\n const ten = Math.pow(10, pow);\n\n const prevValue =\n prev === tick && i === 1\n ? format(\n min([\n tick + ten,\n allValues.find((d: number) => d > tick && d < next),\n ] as number[]),\n )\n : format(tick);\n\n const nextValue =\n tick && i === 1\n ? format(next)\n : format(\n max([\n next - ten,\n allValues.reverse().find((d: number) => d > tick && d < next),\n ] as number[]),\n );\n\n return this.schema.bucketJoiner(prevValue, nextValue);\n }\n };\n this._data = [];\n this._labelClass = new TextBox();\n this.schema.labelConfig = {\n fontColor: () => {\n const bg = this._select ? backgroundColor(this._select.node()) : \"rgb(255, 255, 255)\";\n return colorContrast(bg, this.schema.colorDefaults);\n },\n fontSize: 12,\n };\n this._legendClass = new Legend();\n this.schema.legendConfig = {\n shapeConfig: {\n stroke: () => this.schema.colorDefaults.dark,\n strokeWidth: 1,\n },\n };\n this._outerBounds = {width: 0, height: 0, x: 0, y: 0};\n this._rectClass = new Rect().parent(\n this as unknown as Record<string, unknown>,\n );\n this.schema.rectConfig = {\n stroke: \"#999\",\n strokeWidth: 1,\n };\n }\n\n /**\n Renders the current ColorScale to the page.\n @param callback Optional callback invoked after rendering completes.\n*/\n render(callback?: (...args: unknown[]) => unknown): this {\n // Standalone full-render fallback: mount into a <div> appended to <body> so\n // `paintComponentScene` creates the single <svg> inside it — mounting the\n // renderer into an <svg> container would nest a second one. Skipped in\n // compute mode, where the caller reads `toScene()` and no DOM is created.\n if (this._select === void 0 && this.schema.renderMode !== \"compute\")\n this.select(select(\"body\").append(\"div\").node() as unknown as HTMLElement);\n\n // Shape <g> Group\n this._group = elem(\"g.d3plus-ColorScale\", {parent: this._select});\n\n const compute = computeColorScale(this);\n\n const gradient =\n this.schema.bucketAxis ||\n ![\"buckets\", \"jenks\", \"quantile\"].includes(this.schema.scale);\n const t = transition().duration(this.schema.duration);\n const groupParams: Record<string, unknown> = {\n enter: {opacity: 0},\n exit: {opacity: 0},\n parent: this._group,\n transition: t,\n update: {opacity: 1},\n };\n const labelGroup = elem(\n \"g.d3plus-ColorScale-labels\",\n Object.assign({condition: gradient}, groupParams),\n );\n const rectGroup = elem(\n \"g.d3plus-ColorScale-Rect\",\n Object.assign({condition: gradient}, groupParams),\n );\n const legendGroup = elem(\n \"g.d3plus-ColorScale-legend\",\n Object.assign({condition: !gradient}, groupParams),\n );\n\n const groups: ColorScaleGroups = {\n labelGroup,\n rectGroup,\n legendGroup,\n groupParams,\n gradient,\n };\n\n if (gradient) renderGradient(this, compute, groups);\n else renderLegendVariant(this, compute, groups);\n\n // Standalone render: paint the scene into the user's `_select`. Inside a\n // Viz the color scale runs in compute mode and the Viz composes its\n // toScene().\n if (this.schema.renderMode !== \"compute\") paintComponentScene(this);\n\n if (callback) setTimeout(callback, this.schema.duration + 100);\n\n return this;\n }\n\n /**\n Produces a backend-agnostic scene graph for this ColorScale with no DOM\n dependency. The discrete variant (jenks/buckets/quantile) delegates to the\n internal Legend's toScene(); the gradient variant composes the Rect, Axis,\n and label TextBox scenes. The scaleGroup's translate (set by the chart's\n colorScale feature on `g.d3plus-viz-colorScale`) is read off `_select` so\n the content lands at its on-screen position.\n\n A smooth (non-bucketed) gradient paints its Rect with a `gradient:<json>`\n fill token (see renderGradientStops); the backend materializes it into a\n `<linearGradient>` (SVG) or a CanvasGradient (Canvas). Bucketed gradients\n and the discrete variant use concrete per-bucket fills.\n */\n toScene(): GroupNode {\n const children: SceneNode[] = [];\n const gradient =\n this.schema.bucketAxis ||\n ![\"buckets\", \"jenks\", \"quantile\"].includes(this.schema.scale);\n\n const pushScene = (\n cls: {toScene?: () => GroupNode} | undefined,\n ): void => {\n if (cls && typeof cls.toScene === \"function\") {\n const s = cls.toScene();\n if (s) children.push(s);\n }\n };\n\n if (gradient) {\n pushScene(this._rectClass as unknown as {toScene?: () => GroupNode});\n pushScene(this._axisClass as unknown as {toScene?: () => GroupNode});\n pushScene(this._labelClass as unknown as {toScene?: () => GroupNode});\n } else {\n pushScene(this._legendClass as unknown as {toScene?: () => GroupNode});\n }\n\n // Preserve the placement of the scaleGroup the chart's colorScale feature\n // positioned (translate on `g.d3plus-viz-colorScale`).\n let transform: Transform | undefined;\n const node =\n this._select && typeof this._select.node === \"function\"\n ? (this._select.node() as Element | null)\n : null;\n if (node && typeof node.getAttribute === \"function\") {\n const attr = node.getAttribute(\"transform\");\n if (attr) {\n const m = /translate\\(\\s*([-\\d.eE]+)[\\s,]+([-\\d.eE]+)/.exec(attr);\n if (m) transform = {x: Number(m[1]), y: Number(m[2])};\n }\n }\n\n return {\n type: \"group\",\n key: `ColorScale-${this._uuid.slice(0, 8)}`,\n ...(transform ? {transform} : {}),\n children,\n };\n }\n\n /**\n The ColorScale is constructed by combining an Axis for the ticks/labels and a Rect for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the Axis class used to display the text (axisConfig) and the Rect class used to draw the color breaks (rectConfig). This method acts as a pass-through to the config method of the Axis.\n*/\n axisConfig(): Record<string, unknown>;\n axisConfig(_: Record<string, unknown>): this;\n axisConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.axisConfig = assign(this.schema.axisConfig, _!)), this)\n : this.schema.axisConfig;\n }\n\n /**\n The data array used to create shapes. A shape key will be drawn for each object in the array.\n*/\n data(): DataPoint[];\n data(_: DataPoint[]): this;\n data(_?: DataPoint[]): unknown {\n return arguments.length ? ((this._data = _!), this) : this._data;\n }\n\n /**\n A pass-through for the TextBox class used to style the labelMin and labelMax text.\n*/\n labelConfig(): Record<string, unknown>;\n labelConfig(_: Record<string, unknown>): this;\n labelConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.labelConfig = assign(this.schema.labelConfig, _!)), this)\n : this.schema.labelConfig;\n }\n\n /**\n Defines a text label to be displayed off of the end of the minimum point in the scale (currently only available in horizontal orientation).\n*/\n labelMin(): string | undefined;\n labelMin(_: string): this;\n labelMin(_?: string): unknown {\n return arguments.length ? ((this._labelMin = _), this) : this._labelMin;\n }\n\n /**\n Defines a text label to be displayed off of the end of the maximum point in the scale (currently only available in horizontal orientation).\n*/\n labelMax(): string | undefined;\n labelMax(_: string): this;\n labelMax(_?: string): unknown {\n return arguments.length ? ((this._labelMax = _), this) : this._labelMax;\n }\n\n /**\n Configuration passed to the Legend that draws the scale when its values are rendered as discrete swatches instead of a continuous bar (for example a categorical or buckets scale), acting as a pass-through to that Legend's config method.\n*/\n legendConfig(): Record<string, unknown>;\n legendConfig(_: Record<string, unknown>): this;\n legendConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.legendConfig = assign(this.schema.legendConfig, _!)), this)\n : this.schema.legendConfig;\n }\n\n /**\n Returns the outer bounds of the ColorScale content. Must be called after rendering.\n @example\n{\"width\": 180, \"height\": 24, \"x\": 10, \"y\": 20}\n*/\n outerBounds(): Record<string, number> {\n return this._outerBounds;\n }\n\n /**\n The ColorScale is constructed by combining an Axis for the ticks/labels and a Rect for the actual color box (or multiple boxes, as in a jenks scale). Because of this, there are separate configs for the Axis class used to display the text (axisConfig) and the Rect class used to draw the color breaks (rectConfig). This method acts as a pass-through to the config method of the Rect.\n*/\n rectConfig(): Record<string, unknown>;\n rectConfig(_: Record<string, unknown>): this;\n rectConfig(_?: Record<string, unknown>): unknown {\n return arguments.length\n ? ((this.schema.rectConfig = assign(this.schema.rectConfig, _!)), this)\n : this.schema.rectConfig;\n }\n\n /**\n The SVG container element for this visualization. 3 selector or DOM element.\n*/\n select(): D3Selection;\n select(_: string | HTMLElement): this;\n select(_?: string | HTMLElement): unknown {\n return arguments.length\n ? ((this._select = select(_ as never) as unknown as D3Selection), this)\n : this._select;\n }\n}\n"],"names":["max","min","select","transition","colorContrast","assign","backgroundColor","elem","formatAbbreviate","Axis","TextBox","Rect","accessor","BaseClass","paintComponentScene","installFluent","Legend","computeColorScale","renderGradient","renderLegendVariant","colorScaleSchema","key","coerce","default","a","b","ColorScale","_select","_axisClass","_axisTest","_colorScale","_data","_group","_labelClass","_labelMin","_labelMax","_legendClass","_outerBounds","_rectClass","_gradientFill","_sceneRenderer","schema","axisConfig","gridSize","bucketFormat","tick","i","ticks","allValues","format","tickFormat","next","prev","last","length","suffix","mod","pow","Math","round","toString","split","replace","ten","prevValue","find","d","nextValue","reverse","bucketJoiner","labelConfig","fontColor","bg","node","colorDefaults","fontSize","legendConfig","shapeConfig","stroke","dark","strokeWidth","width","height","x","y","parent","rectConfig","render","callback","renderMode","append","compute","gradient","bucketAxis","includes","scale","t","duration","groupParams","enter","opacity","exit","update","labelGroup","Object","condition","rectGroup","legendGroup","groups","setTimeout","toScene","children","pushScene","cls","s","push","transform","getAttribute","attr","m","exec","Number","type","_uuid","slice","_","arguments","data","labelMin","labelMax","outerBounds"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAQA,GAAG,EAAEC,GAAG,QAAO,WAAW;AAClC,SAAQC,MAAM,QAAO,eAAe;AACpC,SAAQC,UAAU,QAAO,gBAAgB;AAEzC,SAAQC,aAAa,QAAO,gBAAgB;AAC5C,SAAQC,MAAM,EAAEC,eAAe,EAAEC,IAAI,QAAO,cAAc;AAE1D,SAAQC,gBAAgB,QAAO,iBAAiB;AAMhD,SAAQC,IAAI,EAAEC,OAAO,QAAO,cAAc;AAC1C,SAAQC,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,QAAQ,EAAEC,SAAS,EAAEC,mBAAmB,QAAO,uBAAuB;AAE9E,SAAQC,aAAa,QAAO,kBAAkB;AAG9C,OAAOC,YAAY,sBAAsB;AACzC,SAAQC,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,cAAc,EAAEC,mBAAmB,QAAO,wBAAwB;AAG1E,sFAAsF,GACtF,IAAMC,mBAAkC;IACtC;QAACC,KAAK;QAASC,QAAQ;QAAYC,SAAS;IAAQ;IACpD;QAACF,KAAK;QAAWC,QAAQ;QAAYC,SAAS;IAAC;IAC/C;QAACF,KAAK;QAAcC,QAAQ;QAAYC,SAAS;IAAK;IACtD;QAACF,KAAK;QAAgBC,QAAQ;IAAU;IACxC;QACED,K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