@d3plus/core 3.1.5 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (579) hide show
  1. package/README.md +9922 -78537
  2. package/es/index.js +8 -0
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +54 -0
  5. package/es/internal.js.map +1 -0
  6. package/es/src/charts/AreaPlot/index.js +36 -0
  7. package/es/src/charts/AreaPlot/index.js.map +1 -0
  8. package/es/src/charts/BarChart/index.js +48 -0
  9. package/es/src/charts/BarChart/index.js.map +1 -0
  10. package/es/src/charts/BoxWhisker/index.js +52 -0
  11. package/es/src/charts/BoxWhisker/index.js.map +1 -0
  12. package/es/src/charts/BumpChart/index.js +81 -0
  13. package/es/src/charts/BumpChart/index.js.map +1 -0
  14. package/es/src/charts/Donut/index.js +42 -0
  15. package/es/src/charts/Donut/index.js.map +1 -0
  16. package/es/src/charts/Geomap/applyLayout.js +208 -0
  17. package/es/src/charts/Geomap/applyLayout.js.map +1 -0
  18. package/es/src/charts/Geomap/emit.js +169 -0
  19. package/es/src/charts/Geomap/emit.js.map +1 -0
  20. package/es/src/charts/Geomap/index.js +521 -0
  21. package/es/src/charts/Geomap/index.js.map +1 -0
  22. package/es/src/charts/LinePlot/index.js +32 -0
  23. package/es/src/charts/LinePlot/index.js.map +1 -0
  24. package/es/src/charts/Matrix/applyLayout.js +92 -0
  25. package/es/src/charts/Matrix/applyLayout.js.map +1 -0
  26. package/es/src/charts/Matrix/emit.js +44 -0
  27. package/es/src/charts/Matrix/emit.js.map +1 -0
  28. package/es/src/charts/Matrix/index.js +154 -0
  29. package/es/src/charts/Matrix/index.js.map +1 -0
  30. package/es/src/charts/Network/applyLayout.js +322 -0
  31. package/es/src/charts/Network/applyLayout.js.map +1 -0
  32. package/es/src/charts/Network/emit.js +273 -0
  33. package/es/src/charts/Network/emit.js.map +1 -0
  34. package/es/src/charts/Network/index.js +422 -0
  35. package/es/src/charts/Network/index.js.map +1 -0
  36. package/es/src/charts/Pack/applyLayout.js +46 -0
  37. package/es/src/charts/Pack/applyLayout.js.map +1 -0
  38. package/es/src/charts/Pack/emit.js +116 -0
  39. package/es/src/charts/Pack/emit.js.map +1 -0
  40. package/es/src/charts/Pack/index.js +194 -0
  41. package/es/src/charts/Pack/index.js.map +1 -0
  42. package/es/src/charts/Pack/recursionCircles.js +18 -0
  43. package/es/src/charts/Pack/recursionCircles.js.map +1 -0
  44. package/es/src/charts/Pie/applyLayout.js +44 -0
  45. package/es/src/charts/Pie/applyLayout.js.map +1 -0
  46. package/es/src/charts/Pie/emit.js +111 -0
  47. package/es/src/charts/Pie/emit.js.map +1 -0
  48. package/es/src/charts/Pie/index.js +134 -0
  49. package/es/src/charts/Pie/index.js.map +1 -0
  50. package/es/src/charts/Plot/draw.js +424 -0
  51. package/es/src/charts/Plot/draw.js.map +1 -0
  52. package/es/src/charts/Plot/index.js +827 -0
  53. package/es/src/charts/Plot/index.js.map +1 -0
  54. package/es/src/charts/Plot/labelPlacement.js +36 -0
  55. package/es/src/charts/Plot/labelPlacement.js.map +1 -0
  56. package/es/src/charts/Plot/pipeline.js +594 -0
  57. package/es/src/charts/Plot/pipeline.js.map +1 -0
  58. package/es/src/charts/Plot/pipelineDomains.js +254 -0
  59. package/es/src/charts/Plot/pipelineDomains.js.map +1 -0
  60. package/es/src/charts/Plot/pipelineLineLabels.js +210 -0
  61. package/es/src/charts/Plot/pipelineLineLabels.js.map +1 -0
  62. package/es/src/charts/Plot/shapeDefaults.js +189 -0
  63. package/es/src/charts/Plot/shapeDefaults.js.map +1 -0
  64. package/es/src/charts/Plot/stackHelpers.js +52 -0
  65. package/es/src/charts/Plot/stackHelpers.js.map +1 -0
  66. package/es/src/charts/Priestley/applyLayout.js +121 -0
  67. package/es/src/charts/Priestley/applyLayout.js.map +1 -0
  68. package/es/src/charts/Priestley/emit.js +129 -0
  69. package/es/src/charts/Priestley/emit.js.map +1 -0
  70. package/es/src/charts/Priestley/index.js +97 -0
  71. package/es/src/charts/Priestley/index.js.map +1 -0
  72. package/es/src/charts/Radar/applyLayout.js +326 -0
  73. package/es/src/charts/Radar/applyLayout.js.map +1 -0
  74. package/es/src/charts/Radar/emit.js +28 -0
  75. package/es/src/charts/Radar/emit.js.map +1 -0
  76. package/es/src/charts/Radar/index.js +98 -0
  77. package/es/src/charts/Radar/index.js.map +1 -0
  78. package/es/src/charts/RadialMatrix/applyLayout.js +132 -0
  79. package/es/src/charts/RadialMatrix/applyLayout.js.map +1 -0
  80. package/es/src/charts/RadialMatrix/emit.js +33 -0
  81. package/es/src/charts/RadialMatrix/emit.js.map +1 -0
  82. package/es/src/charts/RadialMatrix/index.js +144 -0
  83. package/es/src/charts/RadialMatrix/index.js.map +1 -0
  84. package/es/src/charts/Rings/applyLayout.js +508 -0
  85. package/es/src/charts/Rings/applyLayout.js.map +1 -0
  86. package/es/src/charts/Rings/emit.js +222 -0
  87. package/es/src/charts/Rings/emit.js.map +1 -0
  88. package/es/src/charts/Rings/index.js +245 -0
  89. package/es/src/charts/Rings/index.js.map +1 -0
  90. package/es/src/charts/Sankey/applyLayout.js +107 -0
  91. package/es/src/charts/Sankey/applyLayout.js.map +1 -0
  92. package/es/src/charts/Sankey/emit.js +134 -0
  93. package/es/src/charts/Sankey/emit.js.map +1 -0
  94. package/es/src/charts/Sankey/index.js +219 -0
  95. package/es/src/charts/Sankey/index.js.map +1 -0
  96. package/es/src/charts/StackedArea/index.js +27 -0
  97. package/es/src/charts/StackedArea/index.js.map +1 -0
  98. package/es/src/charts/Tree/applyLayout.js +233 -0
  99. package/es/src/charts/Tree/applyLayout.js.map +1 -0
  100. package/es/src/charts/Tree/emit.js +257 -0
  101. package/es/src/charts/Tree/emit.js.map +1 -0
  102. package/es/src/charts/Tree/index.js +105 -0
  103. package/es/src/charts/Tree/index.js.map +1 -0
  104. package/es/src/charts/Treemap/applyLayout.js +85 -0
  105. package/es/src/charts/Treemap/applyLayout.js.map +1 -0
  106. package/es/src/charts/Treemap/emit.js +141 -0
  107. package/es/src/charts/Treemap/emit.js.map +1 -0
  108. package/es/src/charts/Treemap/index.js +177 -0
  109. package/es/src/charts/Treemap/index.js.map +1 -0
  110. package/es/src/charts/Treemap/thresholdFunction.js +112 -0
  111. package/es/src/charts/Treemap/thresholdFunction.js.map +1 -0
  112. package/es/src/charts/definition/ChartDefinition.js +12 -0
  113. package/es/src/charts/definition/ChartDefinition.js.map +1 -0
  114. package/es/src/charts/definition/applyDefinition.js +107 -0
  115. package/es/src/charts/definition/applyDefinition.js.map +1 -0
  116. package/es/src/charts/definition/makeChart.js +153 -0
  117. package/es/src/charts/definition/makeChart.js.map +1 -0
  118. package/es/src/charts/drawSteps/zoomControls.js +231 -96
  119. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  120. package/es/src/charts/events/click.legend.js +2 -2
  121. package/es/src/charts/events/click.legend.js.map +1 -1
  122. package/es/src/charts/events/click.shape.js +5 -5
  123. package/es/src/charts/events/click.shape.js.map +1 -1
  124. package/es/src/charts/events/mouseenter.js +20 -1
  125. package/es/src/charts/events/mouseenter.js.map +1 -1
  126. package/es/src/charts/events/mouseleave.js +19 -4
  127. package/es/src/charts/events/mouseleave.js.map +1 -1
  128. package/es/src/charts/events/mousemove.legend.js +10 -10
  129. package/es/src/charts/events/mousemove.legend.js.map +1 -1
  130. package/es/src/charts/events/mousemove.shape.js +14 -8
  131. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  132. package/es/src/charts/events/touchstart.body.js.map +1 -1
  133. package/es/src/charts/features/axes.js +432 -0
  134. package/es/src/charts/features/axes.js.map +1 -0
  135. package/es/src/charts/features/chartGeometry.js +66 -0
  136. package/es/src/charts/features/chartGeometry.js.map +1 -0
  137. package/es/src/charts/features/colorScaleBucket.js +92 -0
  138. package/es/src/charts/features/colorScaleBucket.js.map +1 -0
  139. package/es/src/charts/features/emitHelpers.js +217 -0
  140. package/es/src/charts/features/emitHelpers.js.map +1 -0
  141. package/es/src/charts/features/ensureZoomDom.js +71 -0
  142. package/es/src/charts/features/ensureZoomDom.js.map +1 -0
  143. package/es/src/charts/features/features.js +650 -0
  144. package/es/src/charts/features/features.js.map +1 -0
  145. package/es/src/charts/features/featuresLegend.js +180 -0
  146. package/es/src/charts/features/featuresLegend.js.map +1 -0
  147. package/es/src/charts/features/legendLabel.js +12 -0
  148. package/es/src/charts/features/legendLabel.js.map +1 -0
  149. package/es/src/charts/features/lineLabels.js +154 -0
  150. package/es/src/charts/features/lineLabels.js.map +1 -0
  151. package/es/src/charts/features/plotPaint.js +512 -0
  152. package/es/src/charts/features/plotPaint.js.map +1 -0
  153. package/es/src/charts/features/shapeEmit.js +273 -0
  154. package/es/src/charts/features/shapeEmit.js.map +1 -0
  155. package/es/src/charts/helpers/matrixData.js +3 -3
  156. package/es/src/charts/helpers/matrixData.js.map +1 -1
  157. package/es/src/charts/index.js +21 -21
  158. package/es/src/charts/index.js.map +1 -1
  159. package/es/src/charts/pipeline/resolveSpec.js +44 -0
  160. package/es/src/charts/pipeline/resolveSpec.js.map +1 -0
  161. package/es/src/charts/pipeline/runChartDraw.js +109 -0
  162. package/es/src/charts/pipeline/runChartDraw.js.map +1 -0
  163. package/es/src/charts/pipeline/runVizPipeline.js +84 -0
  164. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -0
  165. package/es/src/charts/pipeline/stages.js +103 -0
  166. package/es/src/charts/pipeline/stages.js.map +1 -0
  167. package/es/src/charts/pipeline/vizContext.js +29 -0
  168. package/es/src/charts/pipeline/vizContext.js.map +1 -0
  169. package/es/src/charts/pipeline/vizDraw.js +37 -0
  170. package/es/src/charts/pipeline/vizDraw.js.map +1 -0
  171. package/es/src/charts/pipeline/vizDrawPure.js +174 -0
  172. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -0
  173. package/es/src/charts/pipeline/vizPreDraw.js +145 -0
  174. package/es/src/charts/pipeline/vizPreDraw.js.map +1 -0
  175. package/es/src/charts/pipeline/vizPreDrawPure.js +279 -0
  176. package/es/src/charts/pipeline/vizPreDrawPure.js.map +1 -0
  177. package/es/src/charts/plotBuffers/Bar.js +4 -4
  178. package/es/src/charts/plotBuffers/Bar.js.map +1 -1
  179. package/es/src/charts/plotBuffers/Box.js +4 -4
  180. package/es/src/charts/plotBuffers/Box.js.map +1 -1
  181. package/es/src/charts/plotBuffers/Circle.js +2 -2
  182. package/es/src/charts/plotBuffers/Circle.js.map +1 -1
  183. package/es/src/charts/plotBuffers/Line.js +5 -5
  184. package/es/src/charts/plotBuffers/Line.js.map +1 -1
  185. package/es/src/charts/plotBuffers/Rect.js +2 -2
  186. package/es/src/charts/plotBuffers/Rect.js.map +1 -1
  187. package/es/src/charts/plotBuffers/discreteBuffer.js +1 -2
  188. package/es/src/charts/plotBuffers/discreteBuffer.js.map +1 -1
  189. package/es/src/charts/plotBuffers/numericBuffer.js +1 -2
  190. package/es/src/charts/plotBuffers/numericBuffer.js.map +1 -1
  191. package/es/src/charts/viz/Viz.js +985 -0
  192. package/es/src/charts/viz/Viz.js.map +1 -0
  193. package/es/src/charts/viz/VizBase.js +447 -0
  194. package/es/src/charts/viz/VizBase.js.map +1 -0
  195. package/es/src/charts/viz/VizBaseConfig.js +504 -0
  196. package/es/src/charts/viz/VizBaseConfig.js.map +1 -0
  197. package/es/src/charts/viz/interactionOpacity.js +247 -0
  198. package/es/src/charts/viz/interactionOpacity.js.map +1 -0
  199. package/es/src/charts/viz/ordinalColor.js +71 -0
  200. package/es/src/charts/viz/ordinalColor.js.map +1 -0
  201. package/es/src/charts/viz/trailCatchup.js +127 -0
  202. package/es/src/charts/viz/trailCatchup.js.map +1 -0
  203. package/es/src/charts/viz/vizDefaults.js +602 -0
  204. package/es/src/charts/viz/vizDefaults.js.map +1 -0
  205. package/es/src/charts/viz/vizRender.js +251 -0
  206. package/es/src/charts/viz/vizRender.js.map +1 -0
  207. package/es/src/charts/viz/vizTypes.js +28 -0
  208. package/es/src/charts/viz/vizTypes.js.map +1 -0
  209. package/es/src/components/Axis/Axis.js +691 -0
  210. package/es/src/components/Axis/Axis.js.map +1 -0
  211. package/es/src/components/Axis/AxisBottom.js.map +1 -0
  212. package/es/src/components/Axis/AxisLeft.js.map +1 -0
  213. package/es/src/components/Axis/AxisRight.js.map +1 -0
  214. package/es/src/components/Axis/AxisTop.js.map +1 -0
  215. package/es/src/components/Axis/axisLayout.js +208 -0
  216. package/es/src/components/Axis/axisLayout.js.map +1 -0
  217. package/es/src/components/Axis/axisLayoutLabels.js +177 -0
  218. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -0
  219. package/es/src/components/Axis/axisLayoutScale.js +374 -0
  220. package/es/src/components/Axis/axisLayoutScale.js.map +1 -0
  221. package/es/src/components/Axis/axisRender.js +535 -0
  222. package/es/src/components/Axis/axisRender.js.map +1 -0
  223. package/es/src/components/ColorScale/ColorScale.js +506 -0
  224. package/es/src/components/ColorScale/ColorScale.js.map +1 -0
  225. package/es/src/components/ColorScale/colorScaleRender.js +277 -0
  226. package/es/src/components/ColorScale/colorScaleRender.js.map +1 -0
  227. package/es/src/components/ColorScale/colorScaleScale.js +274 -0
  228. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -0
  229. package/es/src/components/Legend/Legend.js +445 -0
  230. package/es/src/components/Legend/Legend.js.map +1 -0
  231. package/es/src/components/Legend/legendConfig.js +87 -0
  232. package/es/src/components/Legend/legendConfig.js.map +1 -0
  233. package/es/src/components/Legend/legendRender.js +245 -0
  234. package/es/src/components/Legend/legendRender.js.map +1 -0
  235. package/es/src/components/Message.js.map +1 -1
  236. package/es/src/components/TextBox.js +639 -453
  237. package/es/src/components/TextBox.js.map +1 -1
  238. package/es/src/components/Timeline/Timeline.js +674 -0
  239. package/es/src/components/Timeline/Timeline.js.map +1 -0
  240. package/es/src/components/Timeline/timelineConfig.js +115 -0
  241. package/es/src/components/Timeline/timelineConfig.js.map +1 -0
  242. package/es/src/components/Timeline/timelineRender.js +267 -0
  243. package/es/src/components/Timeline/timelineRender.js.map +1 -0
  244. package/es/src/components/Tooltip.js +288 -249
  245. package/es/src/components/Tooltip.js.map +1 -1
  246. package/es/src/components/index.js +8 -8
  247. package/es/src/components/index.js.map +1 -1
  248. package/es/src/fluent.js +265 -0
  249. package/es/src/fluent.js.map +1 -0
  250. package/es/src/shapes/Area.js +96 -114
  251. package/es/src/shapes/Area.js.map +1 -1
  252. package/es/src/shapes/Bar.js +71 -86
  253. package/es/src/shapes/Bar.js.map +1 -1
  254. package/es/src/shapes/Box.js +295 -190
  255. package/es/src/shapes/Box.js.map +1 -1
  256. package/es/src/shapes/Circle.js +72 -31
  257. package/es/src/shapes/Circle.js.map +1 -1
  258. package/es/src/shapes/Image.js +164 -85
  259. package/es/src/shapes/Image.js.map +1 -1
  260. package/es/src/shapes/Line.js +51 -94
  261. package/es/src/shapes/Line.js.map +1 -1
  262. package/es/src/shapes/Path.js +33 -41
  263. package/es/src/shapes/Path.js.map +1 -1
  264. package/es/src/shapes/Rect.js +86 -37
  265. package/es/src/shapes/Rect.js.map +1 -1
  266. package/es/src/shapes/Shape.js +655 -678
  267. package/es/src/shapes/Shape.js.map +1 -1
  268. package/es/src/shapes/Whisker.js +156 -61
  269. package/es/src/shapes/Whisker.js.map +1 -1
  270. package/es/src/shapes/buildLabelData.js +70 -0
  271. package/es/src/shapes/buildLabelData.js.map +1 -0
  272. package/es/src/shapes/emitLabels.js +84 -0
  273. package/es/src/shapes/emitLabels.js.map +1 -0
  274. package/es/src/shapes/hitAreaNode.js +37 -0
  275. package/es/src/shapes/hitAreaNode.js.map +1 -0
  276. package/es/src/shapes/sceneSort.js +57 -0
  277. package/es/src/shapes/sceneSort.js.map +1 -0
  278. package/es/src/shapes/shapeConfig.js +31 -0
  279. package/es/src/shapes/shapeConfig.js.map +1 -0
  280. package/es/src/utils/BaseClass.js +35 -19
  281. package/es/src/utils/BaseClass.js.map +1 -1
  282. package/es/src/utils/D3Scale.js +16 -0
  283. package/es/src/utils/D3Scale.js.map +1 -0
  284. package/es/src/utils/D3plusConfig.js.map +1 -1
  285. package/es/src/utils/configPrep.js +8 -3
  286. package/es/src/utils/configPrep.js.map +1 -1
  287. package/es/src/utils/getProp.js +1 -1
  288. package/es/src/utils/getProp.js.map +1 -1
  289. package/es/src/utils/index.js +1 -0
  290. package/es/src/utils/index.js.map +1 -1
  291. package/es/src/utils/paintComponentScene.js +59 -0
  292. package/es/src/utils/paintComponentScene.js.map +1 -0
  293. package/es/umd-entry.js +16 -0
  294. package/es/umd-entry.js.map +1 -0
  295. package/package.json +17 -9
  296. package/types/index.d.ts +3 -1
  297. package/types/internal.d.ts +54 -0
  298. package/types/src/charts/AreaPlot/index.d.ts +10 -0
  299. package/types/src/charts/BarChart/index.d.ts +10 -0
  300. package/types/src/charts/BoxWhisker/index.d.ts +11 -0
  301. package/types/src/charts/BumpChart/index.d.ts +11 -0
  302. package/types/src/charts/ChartDefinition.d.ts +75 -0
  303. package/types/src/charts/Donut/index.d.ts +13 -0
  304. package/types/src/charts/Geomap/applyLayout.d.ts +7 -0
  305. package/types/src/charts/Geomap/emit.d.ts +7 -0
  306. package/types/src/charts/Geomap/index.d.ts +14 -0
  307. package/types/src/charts/Geomap.d.ts +6 -0
  308. package/types/src/charts/LinePlot/index.d.ts +10 -0
  309. package/types/src/charts/Matrix/applyLayout.d.ts +9 -0
  310. package/types/src/charts/Matrix/emit.d.ts +6 -0
  311. package/types/src/charts/Matrix/index.d.ts +14 -0
  312. package/types/src/charts/Matrix.d.ts +0 -26
  313. package/types/src/charts/Network/applyLayout.d.ts +10 -0
  314. package/types/src/charts/Network/emit.d.ts +6 -0
  315. package/types/src/charts/Network/index.d.ts +7 -0
  316. package/types/src/charts/Network.d.ts +0 -24
  317. package/types/src/charts/Pack/applyLayout.d.ts +16 -0
  318. package/types/src/charts/Pack/emit.d.ts +6 -0
  319. package/types/src/charts/Pack/index.d.ts +15 -0
  320. package/types/src/charts/Pack/recursionCircles.d.ts +7 -0
  321. package/types/src/charts/Pack.d.ts +0 -13
  322. package/types/src/charts/Pie/applyLayout.d.ts +8 -0
  323. package/types/src/charts/Pie/emit.d.ts +5 -0
  324. package/types/src/charts/Pie/index.d.ts +14 -0
  325. package/types/src/charts/Pie.d.ts +0 -27
  326. package/types/src/charts/Plot/draw.d.ts +2 -0
  327. package/types/src/charts/Plot/index.d.ts +167 -0
  328. package/types/src/charts/Plot/labelPlacement.d.ts +15 -0
  329. package/types/src/charts/Plot/pipeline.d.ts +70 -0
  330. package/types/src/charts/Plot/pipelineDomains.d.ts +2 -0
  331. package/types/src/charts/Plot/pipelineLineLabels.d.ts +2 -0
  332. package/types/src/charts/Plot/shapeDefaults.d.ts +64 -0
  333. package/types/src/charts/Plot/stackHelpers.d.ts +24 -0
  334. package/types/src/charts/Plot.d.ts +23 -72
  335. package/types/src/charts/Priestley/applyLayout.d.ts +21 -0
  336. package/types/src/charts/Priestley/emit.d.ts +6 -0
  337. package/types/src/charts/Priestley/index.d.ts +14 -0
  338. package/types/src/charts/Radar/applyLayout.d.ts +10 -0
  339. package/types/src/charts/Radar/emit.d.ts +7 -0
  340. package/types/src/charts/Radar/index.d.ts +14 -0
  341. package/types/src/charts/RadialMatrix/applyLayout.d.ts +11 -0
  342. package/types/src/charts/RadialMatrix/emit.d.ts +6 -0
  343. package/types/src/charts/RadialMatrix/index.d.ts +14 -0
  344. package/types/src/charts/RadialMatrix.d.ts +0 -15
  345. package/types/src/charts/Rings/applyLayout.d.ts +2 -0
  346. package/types/src/charts/Rings/emit.d.ts +7 -0
  347. package/types/src/charts/Rings/index.d.ts +15 -0
  348. package/types/src/charts/Rings.d.ts +0 -13
  349. package/types/src/charts/Sankey/applyLayout.d.ts +7 -0
  350. package/types/src/charts/Sankey/emit.d.ts +6 -0
  351. package/types/src/charts/Sankey/index.d.ts +7 -0
  352. package/types/src/charts/Sankey.d.ts +0 -4
  353. package/types/src/charts/StackedArea/index.d.ts +10 -0
  354. package/types/src/charts/Tree/applyLayout.d.ts +2 -0
  355. package/types/src/charts/Tree/emit.d.ts +7 -0
  356. package/types/src/charts/Tree/index.d.ts +14 -0
  357. package/types/src/charts/Tree.d.ts +0 -16
  358. package/types/src/charts/Treemap/applyLayout.d.ts +16 -0
  359. package/types/src/charts/Treemap/emit.d.ts +6 -0
  360. package/types/src/charts/Treemap/index.d.ts +18 -0
  361. package/types/src/charts/Treemap/thresholdFunction.d.ts +25 -0
  362. package/types/src/charts/Treemap.d.ts +4 -13
  363. package/types/src/charts/Viz.d.ts +49 -361
  364. package/types/src/charts/VizBase.d.ts +158 -0
  365. package/types/src/charts/VizBaseConfig.d.ts +148 -0
  366. package/types/src/charts/applyDefinition.d.ts +13 -0
  367. package/types/src/charts/axes.d.ts +134 -0
  368. package/types/src/charts/chartGeometry.d.ts +58 -0
  369. package/types/src/charts/definition/ChartDefinition.d.ts +84 -0
  370. package/types/src/charts/definition/applyDefinition.d.ts +13 -0
  371. package/types/src/charts/definition/makeChart.d.ts +22 -0
  372. package/types/src/charts/drawSteps/zoomControls.d.ts +25 -5
  373. package/types/src/charts/emitHelpers.d.ts +122 -0
  374. package/types/src/charts/ensureZoomDom.d.ts +39 -0
  375. package/types/src/charts/events/click.legend.d.ts +1 -1
  376. package/types/src/charts/events/click.shape.d.ts +1 -1
  377. package/types/src/charts/events/mouseenter.d.ts +1 -1
  378. package/types/src/charts/events/mouseleave.d.ts +1 -1
  379. package/types/src/charts/events/mousemove.legend.d.ts +1 -1
  380. package/types/src/charts/events/mousemove.shape.d.ts +1 -1
  381. package/types/src/charts/events/touchstart.body.d.ts +1 -1
  382. package/types/src/charts/factories.d.ts +73 -0
  383. package/types/src/charts/features/axes.d.ts +134 -0
  384. package/types/src/charts/features/chartGeometry.d.ts +58 -0
  385. package/types/src/charts/features/colorScaleBucket.d.ts +43 -0
  386. package/types/src/charts/features/colorScaleBucketShare.d.ts +16 -0
  387. package/types/src/charts/features/emitHelpers.d.ts +123 -0
  388. package/types/src/charts/features/ensureZoomDom.d.ts +39 -0
  389. package/types/src/charts/features/features.d.ts +152 -0
  390. package/types/src/charts/features/featuresLegend.d.ts +12 -0
  391. package/types/src/charts/features/legendLabel.d.ts +11 -0
  392. package/types/src/charts/features/lineLabels.d.ts +40 -0
  393. package/types/src/charts/features/plotPaint.d.ts +233 -0
  394. package/types/src/charts/features/shapeEmit.d.ts +61 -0
  395. package/types/src/charts/features.d.ts +152 -0
  396. package/types/src/charts/featuresLegend.d.ts +12 -0
  397. package/types/src/charts/helpers/matrixData.d.ts +1 -1
  398. package/types/src/charts/index.d.ts +21 -21
  399. package/types/src/charts/legendLabel.d.ts +11 -0
  400. package/types/src/charts/lineLabels.d.ts +40 -0
  401. package/types/src/charts/makeChart.d.ts +22 -0
  402. package/types/src/charts/pipeline/resolveSpec.d.ts +51 -0
  403. package/types/src/charts/pipeline/runChartDraw.d.ts +38 -0
  404. package/types/src/charts/pipeline/runVizPipeline.d.ts +31 -0
  405. package/types/src/charts/pipeline/stages.d.ts +160 -0
  406. package/types/src/charts/pipeline/vizContext.d.ts +45 -0
  407. package/types/src/charts/pipeline/vizDraw.d.ts +25 -0
  408. package/types/src/charts/pipeline/vizDrawPure.d.ts +46 -0
  409. package/types/src/charts/pipeline/vizPreDraw.d.ts +22 -0
  410. package/types/src/charts/pipeline/vizPreDrawPure.d.ts +68 -0
  411. package/types/src/charts/plotBuffers/Bar.d.ts +6 -5
  412. package/types/src/charts/plotBuffers/Box.d.ts +6 -5
  413. package/types/src/charts/plotBuffers/Circle.d.ts +6 -5
  414. package/types/src/charts/plotBuffers/Line.d.ts +6 -5
  415. package/types/src/charts/plotBuffers/Rect.d.ts +6 -5
  416. package/types/src/charts/plotBuffers/discreteBuffer.d.ts +2 -1
  417. package/types/src/charts/plotBuffers/numericBuffer.d.ts +2 -1
  418. package/types/src/charts/plotPaint.d.ts +233 -0
  419. package/types/src/charts/resolveSpec.d.ts +50 -0
  420. package/types/src/charts/runChartDraw.d.ts +38 -0
  421. package/types/src/charts/runVizPipeline.d.ts +31 -0
  422. package/types/src/charts/shapeEmit.d.ts +61 -0
  423. package/types/src/charts/stages.d.ts +117 -0
  424. package/types/src/charts/viz/Viz.d.ts +111 -0
  425. package/types/src/charts/viz/VizBase.d.ts +160 -0
  426. package/types/src/charts/viz/VizBaseConfig.d.ts +156 -0
  427. package/types/src/charts/viz/interactionOpacity.d.ts +23 -0
  428. package/types/src/charts/viz/ordinalColor.d.ts +14 -0
  429. package/types/src/charts/viz/trailCatchup.d.ts +14 -0
  430. package/types/src/charts/viz/vizDefaults.d.ts +8 -0
  431. package/types/src/charts/viz/vizRender.d.ts +8 -0
  432. package/types/src/charts/viz/vizTypes.d.ts +250 -0
  433. package/types/src/charts/vizContext.d.ts +46 -0
  434. package/types/src/charts/vizDefaults.d.ts +8 -0
  435. package/types/src/charts/vizDraw.d.ts +25 -0
  436. package/types/src/charts/vizDrawPure.d.ts +17 -0
  437. package/types/src/charts/vizPreDraw.d.ts +22 -0
  438. package/types/src/charts/vizPreDrawPure.d.ts +40 -0
  439. package/types/src/charts/vizRender.d.ts +8 -0
  440. package/types/src/charts/vizTypes.d.ts +202 -0
  441. package/types/src/components/Axis/Axis.d.ts +182 -0
  442. package/types/src/components/Axis/AxisBottom.d.ts +11 -0
  443. package/types/src/components/Axis/AxisLeft.d.ts +11 -0
  444. package/types/src/components/Axis/AxisRight.d.ts +11 -0
  445. package/types/src/components/Axis/AxisTop.d.ts +11 -0
  446. package/types/src/components/Axis/axisLayout.d.ts +29 -0
  447. package/types/src/components/Axis/axisLayoutLabels.d.ts +70 -0
  448. package/types/src/components/Axis/axisLayoutScale.d.ts +14 -0
  449. package/types/src/components/Axis/axisRender.d.ts +68 -0
  450. package/types/src/components/Axis.d.ts +68 -194
  451. package/types/src/components/ColorScale/ColorScale.d.ts +100 -0
  452. package/types/src/components/ColorScale/colorScaleRender.d.ts +15 -0
  453. package/types/src/components/ColorScale/colorScaleScale.d.ts +19 -0
  454. package/types/src/components/ColorScale.d.ts +1 -129
  455. package/types/src/components/Legend/Legend.d.ts +95 -0
  456. package/types/src/components/Legend/legendConfig.d.ts +7 -0
  457. package/types/src/components/Legend/legendRender.d.ts +16 -0
  458. package/types/src/components/Legend.d.ts +9 -73
  459. package/types/src/components/TextBox.d.ts +25 -218
  460. package/types/src/components/Timeline/Timeline.d.ts +118 -0
  461. package/types/src/components/Timeline/timelineConfig.d.ts +6 -0
  462. package/types/src/components/Timeline/timelineRender.d.ts +24 -0
  463. package/types/src/components/Timeline.d.ts +7 -81
  464. package/types/src/components/Tooltip.d.ts +20 -200
  465. package/types/src/components/axisLayout.d.ts +27 -0
  466. package/types/src/components/axisLayoutLabels.d.ts +42 -0
  467. package/types/src/components/axisLayoutScale.d.ts +12 -0
  468. package/types/src/components/axisRender.d.ts +65 -0
  469. package/types/src/components/colorScaleRender.d.ts +15 -0
  470. package/types/src/components/colorScaleScale.d.ts +19 -0
  471. package/types/src/components/index.d.ts +8 -8
  472. package/types/src/components/legendConfig.d.ts +7 -0
  473. package/types/src/components/legendRender.d.ts +16 -0
  474. package/types/src/components/timelineConfig.d.ts +6 -0
  475. package/types/src/components/timelineRender.d.ts +14 -0
  476. package/types/src/fluent.d.ts +94 -0
  477. package/types/src/shapes/Area.d.ts +15 -27
  478. package/types/src/shapes/Bar.d.ts +13 -33
  479. package/types/src/shapes/Box.d.ts +17 -56
  480. package/types/src/shapes/Circle.d.ts +11 -17
  481. package/types/src/shapes/Image.d.ts +18 -84
  482. package/types/src/shapes/Line.d.ts +12 -22
  483. package/types/src/shapes/Path.d.ts +12 -19
  484. package/types/src/shapes/Rect.d.ts +11 -27
  485. package/types/src/shapes/Shape.d.ts +46 -257
  486. package/types/src/shapes/Whisker.d.ts +15 -42
  487. package/types/src/shapes/buildLabelData.d.ts +50 -0
  488. package/types/src/shapes/emitLabels.d.ts +16 -0
  489. package/types/src/shapes/hitAreaNode.d.ts +19 -0
  490. package/types/src/shapes/sceneSort.d.ts +20 -0
  491. package/types/src/shapes/shapeConfig.d.ts +226 -0
  492. package/types/src/utils/BaseClass.d.ts +13 -7
  493. package/types/src/utils/D3Scale.d.ts +48 -0
  494. package/types/src/utils/D3plusConfig.d.ts +230 -3
  495. package/types/src/utils/configPrep.d.ts +7 -4
  496. package/types/src/utils/getProp.d.ts +3 -1
  497. package/types/src/utils/index.d.ts +3 -1
  498. package/types/src/utils/paintComponentScene.d.ts +28 -0
  499. package/types/umd-entry.d.ts +15 -0
  500. package/umd/d3plus-core.full.js +31148 -19470
  501. package/umd/d3plus-core.full.js.map +1 -1
  502. package/umd/d3plus-core.full.min.js +5315 -2939
  503. package/umd/d3plus-core.js +17379 -10575
  504. package/umd/d3plus-core.js.map +1 -1
  505. package/umd/d3plus-core.min.js +3470 -1873
  506. package/es/src/charts/AreaPlot.js +0 -85
  507. package/es/src/charts/AreaPlot.js.map +0 -1
  508. package/es/src/charts/BarChart.js +0 -92
  509. package/es/src/charts/BarChart.js.map +0 -1
  510. package/es/src/charts/BoxWhisker.js +0 -92
  511. package/es/src/charts/BoxWhisker.js.map +0 -1
  512. package/es/src/charts/BumpChart.js +0 -147
  513. package/es/src/charts/BumpChart.js.map +0 -1
  514. package/es/src/charts/Donut.js +0 -84
  515. package/es/src/charts/Donut.js.map +0 -1
  516. package/es/src/charts/Geomap.js +0 -766
  517. package/es/src/charts/Geomap.js.map +0 -1
  518. package/es/src/charts/LinePlot.js +0 -83
  519. package/es/src/charts/LinePlot.js.map +0 -1
  520. package/es/src/charts/Matrix.js +0 -341
  521. package/es/src/charts/Matrix.js.map +0 -1
  522. package/es/src/charts/Network.js +0 -796
  523. package/es/src/charts/Network.js.map +0 -1
  524. package/es/src/charts/Pack.js +0 -308
  525. package/es/src/charts/Pack.js.map +0 -1
  526. package/es/src/charts/Pie.js +0 -232
  527. package/es/src/charts/Pie.js.map +0 -1
  528. package/es/src/charts/Plot.js +0 -2114
  529. package/es/src/charts/Plot.js.map +0 -1
  530. package/es/src/charts/Priestley.js +0 -296
  531. package/es/src/charts/Priestley.js.map +0 -1
  532. package/es/src/charts/Radar.js +0 -420
  533. package/es/src/charts/Radar.js.map +0 -1
  534. package/es/src/charts/RadialMatrix.js +0 -383
  535. package/es/src/charts/RadialMatrix.js.map +0 -1
  536. package/es/src/charts/Rings.js +0 -788
  537. package/es/src/charts/Rings.js.map +0 -1
  538. package/es/src/charts/Sankey.js +0 -461
  539. package/es/src/charts/Sankey.js.map +0 -1
  540. package/es/src/charts/StackedArea.js +0 -80
  541. package/es/src/charts/StackedArea.js.map +0 -1
  542. package/es/src/charts/Tree.js +0 -347
  543. package/es/src/charts/Tree.js.map +0 -1
  544. package/es/src/charts/Treemap.js +0 -454
  545. package/es/src/charts/Treemap.js.map +0 -1
  546. package/es/src/charts/Viz.js +0 -1832
  547. package/es/src/charts/Viz.js.map +0 -1
  548. package/es/src/charts/drawSteps/drawAttribution.js +0 -16
  549. package/es/src/charts/drawSteps/drawAttribution.js.map +0 -1
  550. package/es/src/charts/drawSteps/drawBack.js +0 -24
  551. package/es/src/charts/drawSteps/drawBack.js.map +0 -1
  552. package/es/src/charts/drawSteps/drawColorScale.js +0 -75
  553. package/es/src/charts/drawSteps/drawColorScale.js.map +0 -1
  554. package/es/src/charts/drawSteps/drawLegend.js +0 -122
  555. package/es/src/charts/drawSteps/drawLegend.js.map +0 -1
  556. package/es/src/charts/drawSteps/drawSubtitle.js +0 -31
  557. package/es/src/charts/drawSteps/drawSubtitle.js.map +0 -1
  558. package/es/src/charts/drawSteps/drawTimeline.js +0 -85
  559. package/es/src/charts/drawSteps/drawTimeline.js.map +0 -1
  560. package/es/src/charts/drawSteps/drawTitle.js +0 -31
  561. package/es/src/charts/drawSteps/drawTitle.js.map +0 -1
  562. package/es/src/charts/drawSteps/drawTotal.js +0 -32
  563. package/es/src/charts/drawSteps/drawTotal.js.map +0 -1
  564. package/es/src/components/Axis.js +0 -1454
  565. package/es/src/components/Axis.js.map +0 -1
  566. package/es/src/components/AxisBottom.js.map +0 -1
  567. package/es/src/components/AxisLeft.js.map +0 -1
  568. package/es/src/components/AxisRight.js.map +0 -1
  569. package/es/src/components/AxisTop.js.map +0 -1
  570. package/es/src/components/ColorScale.js +0 -843
  571. package/es/src/components/ColorScale.js.map +0 -1
  572. package/es/src/components/Legend.js +0 -622
  573. package/es/src/components/Legend.js.map +0 -1
  574. package/es/src/components/Timeline.js +0 -695
  575. package/es/src/components/Timeline.js.map +0 -1
  576. /package/es/src/components/{AxisBottom.js → Axis/AxisBottom.js} +0 -0
  577. /package/es/src/components/{AxisLeft.js → Axis/AxisLeft.js} +0 -0
  578. /package/es/src/components/{AxisRight.js → Axis/AxisRight.js} +0 -0
  579. /package/es/src/components/{AxisTop.js → Axis/AxisTop.js} +0 -0
@@ -1,3 +1,11 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
1
9
  function _assert_this_initialized(self) {
2
10
  if (self === void 0) {
3
11
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
@@ -59,6 +67,48 @@ function _inherits(subClass, superClass) {
59
67
  });
60
68
  if (superClass) _set_prototype_of(subClass, superClass);
61
69
  }
70
+ function _iterable_to_array_limit(arr, i) {
71
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
72
+ if (_i == null) return;
73
+ var _arr = [];
74
+ var _n = true;
75
+ var _d = false;
76
+ var _s, _e;
77
+ try {
78
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
79
+ _arr.push(_s.value);
80
+ if (i && _arr.length === i) break;
81
+ }
82
+ } catch (err) {
83
+ _d = true;
84
+ _e = err;
85
+ } finally{
86
+ try {
87
+ if (!_n && _i["return"] != null) _i["return"]();
88
+ } finally{
89
+ if (_d) throw _e;
90
+ }
91
+ }
92
+ return _arr;
93
+ }
94
+ function _non_iterable_rest() {
95
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
96
+ }
97
+ function _object_spread(target) {
98
+ for(var i = 1; i < arguments.length; i++){
99
+ var source = arguments[i] != null ? arguments[i] : {};
100
+ var ownKeys = Object.keys(source);
101
+ if (typeof Object.getOwnPropertySymbols === "function") {
102
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
103
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
104
+ }));
105
+ }
106
+ ownKeys.forEach(function(key) {
107
+ _define_property(target, key, source[key]);
108
+ });
109
+ }
110
+ return target;
111
+ }
62
112
  function _possible_constructor_return(self, call) {
63
113
  if (call && (_type_of(call) === "object" || typeof call === "function")) {
64
114
  return call;
@@ -72,10 +122,21 @@ function _set_prototype_of(o, p) {
72
122
  };
73
123
  return _set_prototype_of(o, p);
74
124
  }
125
+ function _sliced_to_array(arr, i) {
126
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
127
+ }
75
128
  function _type_of(obj) {
76
129
  "@swc/helpers - typeof";
77
130
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
78
131
  }
132
+ function _unsupported_iterable_to_array(o, minLen) {
133
+ if (!o) return;
134
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
135
+ var n = Object.prototype.toString.call(o).slice(8, -1);
136
+ if (n === "Object" && o.constructor) n = o.constructor.name;
137
+ if (n === "Map" || n === "Set") return Array.from(n);
138
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
139
+ }
79
140
  function _is_native_reflect_construct() {
80
141
  try {
81
142
  var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
@@ -86,458 +147,625 @@ function _is_native_reflect_construct() {
86
147
  }
87
148
  import { max, min, sum } from "d3-array";
88
149
  import { select } from "d3-selection";
89
- // side-effect import: registers .transition() on d3 selections
90
- import "d3-transition";
91
150
  import { fontExists, parseSides, rtl as detectRTL, textWidth } from "@d3plus/dom";
92
151
  import { fontFamily, strip, textSplit, textWrap } from "@d3plus/text";
152
+ import { SvgRenderer } from "@d3plus/render";
93
153
  import { accessor, BaseClass, constant } from "../utils/index.js";
154
+ import { installFluent } from "../fluent.js";
94
155
  var defaultHtmlLookup = {
95
156
  i: "font-style: italic;",
96
157
  em: "font-style: italic;",
97
158
  b: "font-weight: bold;",
98
159
  strong: "font-weight: bold;"
99
160
  };
100
- var TextBox = /*#__PURE__*/ function(BaseClass) {
101
- "use strict";
102
- _inherits(TextBox, BaseClass);
103
- function TextBox() {
104
- _class_call_check(this, TextBox);
105
- var _this;
106
- _this = _call_super(this, TextBox), _define_property(_this, "_select", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_ariaHidden", void 0), _define_property(_this, "_delay", void 0), _define_property(_this, "_duration", void 0), _define_property(_this, "_ellipsis", void 0), _define_property(_this, "_fontColor", void 0), _define_property(_this, "_fontFamily", void 0), _define_property(_this, "_fontMax", void 0), _define_property(_this, "_fontMin", void 0), _define_property(_this, "_fontOpacity", void 0), _define_property(_this, "_fontResize", void 0), _define_property(_this, "_fontSize", void 0), _define_property(_this, "_fontStroke", void 0), _define_property(_this, "_fontStrokeWidth", void 0), _define_property(_this, "_fontWeight", void 0), _define_property(_this, "_height", void 0), _define_property(_this, "_html", void 0), _define_property(_this, "_id", void 0), _define_property(_this, "_lineHeight", void 0), _define_property(_this, "_maxLines", void 0), _define_property(_this, "_on", void 0), _define_property(_this, "_overflow", void 0), _define_property(_this, "_padding", void 0), _define_property(_this, "_pointerEvents", void 0), _define_property(_this, "_rotate", void 0), _define_property(_this, "_rotateAnchor", void 0), _define_property(_this, "_split", void 0), _define_property(_this, "_text", void 0), _define_property(_this, "_textAnchor", void 0), _define_property(_this, "_verticalAlign", void 0), _define_property(_this, "_width", void 0), _define_property(_this, "_x", void 0), _define_property(_this, "_y", void 0);
107
- _this._ariaHidden = constant("false");
108
- _this._delay = 0;
109
- _this._duration = 0;
110
- _this._ellipsis = function(text, line) {
111
- return line ? "".concat(text.replace(/\.|,$/g, ""), "...") : "";
161
+ /** Parses a "style: foo; …" string from defaultHtmlLookup into TextRun style. */ function parseStyleString(styleStr) {
162
+ var out = {};
163
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
164
+ try {
165
+ for(var _iterator = styleStr.split(";")[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
166
+ var decl = _step.value;
167
+ var _decl_split_map = _sliced_to_array(decl.split(":").map(function(s) {
168
+ return s.trim();
169
+ }), 2), k = _decl_split_map[0], v = _decl_split_map[1];
170
+ if (!k || !v) continue;
171
+ if (k === "font-weight") out.weight = /^\d+$/.test(v) ? Number(v) : v;
172
+ else if (k === "font-style") out.style = v === "italic" ? "italic" : "normal";
173
+ }
174
+ } catch (err) {
175
+ _didIteratorError = true;
176
+ _iteratorError = err;
177
+ } finally{
178
+ try {
179
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
180
+ _iterator.return();
181
+ }
182
+ } finally{
183
+ if (_didIteratorError) {
184
+ throw _iteratorError;
185
+ }
186
+ }
187
+ }
188
+ return out.weight === undefined && out.style === undefined ? undefined : out;
189
+ }
190
+ /**
191
+ Walks one wrapped line, applies the regex cleanup (closing dangling
192
+ open tags, opening trailing closing tags), then splits it into runs by the
193
+ configured htmlLookup. Returns the new openTag state for the next line so a
194
+ multi-line bold/italic continues to style subsequent lines.
195
+ */ function lineToRuns(raw, htmlLookup, openTag) {
196
+ // textContent escaping: keep entity escaping in sync with render()
197
+ // so SVG output stays identical.
198
+ var cleaned = raw.trimEnd().replace(/&([^;&]*)/g, function(str, a) {
199
+ return a === "amp" ? str : "&amp;".concat(a);
200
+ }).replace(/<([^A-z^/]+)/g, function(_str, a) {
201
+ return "&lt;".concat(a);
202
+ }).replace(/<$/g, "&lt;").replace(/(<[^>^/]+>)([^<^>]+)$/g, function(_str, a, b) {
203
+ return "".concat(a).concat(b).concat(a.replace("<", "</"));
204
+ }).replace(/^([^<^>]+)(<\/[^>]+>)/g, function(_str, a, b) {
205
+ return "".concat(b.replace("</", "<")).concat(a).concat(b);
206
+ });
207
+ // If we're already inside an open tag from a previous line, prefix this
208
+ // line with the opening tag so the same tag closes within the line.
209
+ var nextOpenTag = openTag;
210
+ if (nextOpenTag && !cleaned.startsWith("<")) {
211
+ cleaned = "<".concat(nextOpenTag, ">").concat(cleaned);
212
+ if (!cleaned.includes("</".concat(nextOpenTag, ">"))) cleaned += "</".concat(nextOpenTag, ">");
213
+ }
214
+ var tagRegex = /<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g;
215
+ var runs = [];
216
+ var lastIndex = 0;
217
+ var m;
218
+ while((m = tagRegex.exec(cleaned)) !== null){
219
+ if (m.index > lastIndex) runs.push({
220
+ text: cleaned.slice(lastIndex, m.index)
221
+ });
222
+ var tag = m[1];
223
+ var inner = m[2];
224
+ var styleStr = htmlLookup[tag];
225
+ if (styleStr) {
226
+ // If the original raw line contains a closing tag, the tag has terminated.
227
+ if (raw.includes("</".concat(tag, ">"))) nextOpenTag = false;
228
+ else nextOpenTag = tag;
229
+ runs.push({
230
+ text: inner,
231
+ style: parseStyleString(styleStr)
232
+ });
233
+ } else {
234
+ runs.push({
235
+ text: inner
236
+ });
237
+ }
238
+ lastIndex = m.index + m[0].length;
239
+ }
240
+ if (lastIndex < cleaned.length) runs.push({
241
+ text: cleaned.slice(lastIndex)
242
+ });
243
+ // If the raw line never opened a tag but we already had openTag set, the
244
+ // line is fully inside that tag — wrap it.
245
+ if (!runs.length && cleaned) runs.push({
246
+ text: cleaned
247
+ });
248
+ return {
249
+ runs: runs,
250
+ openTag: nextOpenTag
251
+ };
252
+ }
253
+ /** Builds the per-line LineRun arrays from wrapped lines, carrying open-tag state. */ function buildLineRuns(box, lineData) {
254
+ var lineRuns = null;
255
+ if (box.schema.html) {
256
+ var lookup = box.schema.html;
257
+ var openTag = false;
258
+ var out = [];
259
+ var hasStyle = false;
260
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
261
+ try {
262
+ for(var _iterator = lineData[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
263
+ var ln = _step.value;
264
+ var _lineToRuns = lineToRuns(ln, lookup, openTag), runs = _lineToRuns.runs, next = _lineToRuns.openTag;
265
+ out.push(runs);
266
+ openTag = next;
267
+ if (runs.some(function(r) {
268
+ return r.style;
269
+ })) hasStyle = true;
270
+ }
271
+ } catch (err) {
272
+ _didIteratorError = true;
273
+ _iteratorError = err;
274
+ } finally{
275
+ try {
276
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
277
+ _iterator.return();
278
+ }
279
+ } finally{
280
+ if (_didIteratorError) {
281
+ throw _iteratorError;
282
+ }
283
+ }
284
+ }
285
+ // Only emit runs when at least one line carries a style; otherwise
286
+ // leave runs unset so the renderer emits a single text node.
287
+ if (hasStyle) lineRuns = out;
288
+ }
289
+ return lineRuns;
290
+ }
291
+ /** Pre-scales the font size to fit the box area before wrapping (resize mode). */ function resizeFontSize(fS, w, h, lH, words, style) {
292
+ var sizes = textWidth(words, style);
293
+ var areaMod = 1.165 + w / h * 0.1, boxArea = w * h, maxWidth = max(sizes), textArea = sum(sizes, function(d) {
294
+ return d * lH;
295
+ }) * areaMod;
296
+ if (maxWidth > w || textArea > boxArea) {
297
+ var areaRatio = Math.sqrt(boxArea / textArea), widthRatio = w / maxWidth;
298
+ var sizeRatio = min([
299
+ areaRatio,
300
+ widthRatio
301
+ ]);
302
+ fS = Math.floor(fS * sizeRatio);
303
+ }
304
+ var heightMax = Math.floor(h * 0.8);
305
+ if (fS > heightMax) fS = heightMax;
306
+ return fS;
307
+ }
308
+ /** Assembles the final TextBoxDatum from the resolved layout values. */ function assembleTextBoxDatum(box, d, i, layout) {
309
+ var lineData = layout.lineData, line = layout.line, fS = layout.fS, lH = layout.lH, w = layout.w, h = layout.h, vA = layout.vA, style = layout.style, widths = layout.widths, padding = layout.padding;
310
+ var tH = line * lH;
311
+ var r = box.schema.rotate(d, i);
312
+ var yP = r === 0 ? vA === "top" ? 0 : vA === "middle" ? h / 2 - tH / 2 : h - tH : 0;
313
+ yP -= lH * 0.1;
314
+ // Pre-compute per-line runs from HTML markup, carrying open-tag state
315
+ // across lines so a multi-line <b> continues to bold subsequent lines.
316
+ var lineRuns = buildLineRuns(box, lineData);
317
+ return {
318
+ aH: box.schema.ariaHidden(d, i),
319
+ data: d,
320
+ i: i,
321
+ lines: lineData,
322
+ lineRuns: lineRuns,
323
+ fC: box.schema.fontColor(d, i),
324
+ fStroke: box.schema.fontStroke(d, i),
325
+ fSW: box.schema.fontStrokeWidth(d, i),
326
+ fF: style["font-family"],
327
+ fO: box.schema.fontOpacity(d, i),
328
+ fW: style["font-weight"],
329
+ id: box.schema.id(d, i),
330
+ pE: box.schema.pointerEvents(d, i),
331
+ tA: box.schema.textAnchor(d, i),
332
+ vA: box.schema.verticalAlign(d, i),
333
+ widths: widths,
334
+ fS: fS,
335
+ lH: lH,
336
+ w: w,
337
+ h: h,
338
+ r: r,
339
+ x: box.schema.x(d, i) + padding.left,
340
+ y: box.schema.y(d, i) + yP + padding.top
341
+ };
342
+ }
343
+ /**
344
+ Computes the laid-out text box for a single data point, or null when the
345
+ text is undefined or wraps to no visible lines.
346
+ */ function computeTextBoxDatum(box, d, i) {
347
+ var that = box;
348
+ var t = box.schema.text(d, i);
349
+ if (t === void 0) return null;
350
+ t = "".concat(t).trim();
351
+ var resize = box.schema.fontResize(d, i);
352
+ var lHRatio = box.schema.lineHeight(d, i) / box.schema.fontSize(d, i);
353
+ var fS = resize ? box.schema.fontMax(d, i) : box.schema.fontSize(d, i), lH = resize ? fS * lHRatio : box.schema.lineHeight(d, i), line = 1, lineData = [], wrapResults = {
354
+ lines: [],
355
+ truncated: false,
356
+ widths: []
357
+ };
358
+ var style = {
359
+ "font-family": fontExists(box.schema.fontFamily(d, i)),
360
+ "font-size": fS,
361
+ "font-weight": box.schema.fontWeight(d, i),
362
+ "line-height": lH
363
+ };
364
+ var padding = parseSides(box.schema.padding(d, i));
365
+ var h = box.schema.height(d, i) - (padding.top + padding.bottom), w = box.schema.width(d, i) - (padding.left + padding.right);
366
+ var wrapper = textWrap().fontFamily(style["font-family"]).fontSize(fS).fontWeight(style["font-weight"]).lineHeight(lH).maxLines(box.schema.maxLines(d, i)).height(h).overflow(box.schema.overflow(d, i)).width(w).split(box.schema.split);
367
+ var fMax = box.schema.fontMax(d, i), fMin = box.schema.fontMin(d, i), vA = box.schema.verticalAlign(d, i), words = box.schema.split(t, i);
368
+ /**
369
+ Figures out the lineData to be used for wrapping.
370
+ @private
371
+ */ function checkSize() {
372
+ var truncate = function truncate() {
373
+ if (line < 1) lineData = [
374
+ that.schema.ellipsis("", line)
375
+ ];
376
+ else lineData[line - 1] = that.schema.ellipsis(lineData[line - 1], line);
112
377
  };
113
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
- _this._fontColor = constant("black");
115
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
116
- _this._fontFamily = constant(fontFamily);
117
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
- _this._fontMax = constant(50);
119
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
120
- _this._fontMin = constant(8);
121
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
- _this._fontOpacity = constant(1);
123
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
- _this._fontResize = constant(false);
125
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
126
- _this._fontSize = constant(10);
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
- _this._fontStroke = constant("transparent");
129
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
- _this._fontStrokeWidth = constant(0);
131
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
132
- _this._fontWeight = constant(400);
133
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
134
- _this._height = accessor("height", 200);
135
- _this._html = defaultHtmlLookup;
136
- _this._id = function(d, i) {
378
+ // Constraint the font size
379
+ fS = max([
380
+ fS,
381
+ fMin
382
+ ]);
383
+ fS = min([
384
+ fS,
385
+ fMax
386
+ ]);
387
+ if (resize) {
388
+ lH = fS * lHRatio;
389
+ wrapper.fontSize(fS).lineHeight(lH);
390
+ style["font-size"] = fS;
391
+ style["line-height"] = lH;
392
+ }
393
+ wrapResults = wrapper(t);
394
+ lineData = wrapResults.lines.filter(function(l) {
395
+ return l !== "";
396
+ });
397
+ line = lineData.length;
398
+ if (wrapResults.truncated) {
399
+ if (resize) {
400
+ fS--;
401
+ if (fS < fMin) {
402
+ fS = fMin;
403
+ truncate();
404
+ return;
405
+ } else checkSize();
406
+ } else truncate();
407
+ }
408
+ }
409
+ if (w > fMin && (h > lH || resize && h > fMin * lHRatio)) {
410
+ if (resize) fS = resizeFontSize(fS, w, h, lH, words, style);
411
+ checkSize();
412
+ }
413
+ if (!lineData.length) return null;
414
+ return assembleTextBoxDatum(box, d, i, {
415
+ lineData: lineData,
416
+ line: line,
417
+ fS: fS,
418
+ lH: lH,
419
+ w: w,
420
+ h: h,
421
+ vA: vA,
422
+ style: style,
423
+ widths: wrapResults.widths,
424
+ padding: padding
425
+ });
426
+ }
427
+ /** TextBox's fluent accessor schema. Config storage lives on `this.schema.<key>`. */ var textBoxSchema = [
428
+ {
429
+ key: "ariaHidden",
430
+ coerce: "const",
431
+ default: constant("false")
432
+ },
433
+ {
434
+ key: "delay",
435
+ coerce: "identity",
436
+ default: 0
437
+ },
438
+ {
439
+ key: "duration",
440
+ coerce: "identity",
441
+ default: 0
442
+ },
443
+ {
444
+ key: "ellipsis",
445
+ coerce: "const",
446
+ default: function _default(text, line) {
447
+ return line ? "".concat(text.replace(/\.|,$/g, ""), "...") : "";
448
+ }
449
+ },
450
+ {
451
+ key: "fontColor",
452
+ coerce: "const",
453
+ default: constant("black")
454
+ },
455
+ {
456
+ key: "fontFamily",
457
+ coerce: "const",
458
+ default: constant(fontFamily)
459
+ },
460
+ {
461
+ key: "fontMax",
462
+ coerce: "const",
463
+ default: constant(50)
464
+ },
465
+ {
466
+ key: "fontMin",
467
+ coerce: "const",
468
+ default: constant(8)
469
+ },
470
+ {
471
+ key: "fontOpacity",
472
+ coerce: "const",
473
+ default: constant(1)
474
+ },
475
+ {
476
+ key: "fontResize",
477
+ coerce: "const",
478
+ default: constant(false)
479
+ },
480
+ {
481
+ key: "fontSize",
482
+ coerce: "const",
483
+ default: constant(10)
484
+ },
485
+ {
486
+ key: "fontStroke",
487
+ coerce: "const",
488
+ default: constant("transparent")
489
+ },
490
+ {
491
+ key: "fontStrokeWidth",
492
+ coerce: "const",
493
+ default: constant(0)
494
+ },
495
+ {
496
+ key: "fontWeight",
497
+ coerce: "const",
498
+ default: constant(400)
499
+ },
500
+ {
501
+ key: "height",
502
+ coerce: "const",
503
+ default: accessor("height", 200)
504
+ },
505
+ {
506
+ key: "id",
507
+ coerce: "const",
508
+ default: function _default(d, i) {
137
509
  return d.id || "".concat(i);
138
- };
139
- _this._lineHeight = function(d, i) {
140
- return _this._fontSize(d, i) * 1.2;
141
- };
142
- _this._maxLines = constant(null);
143
- _this._on = {};
144
- _this._overflow = constant(false);
145
- _this._padding = constant(0);
146
- _this._pointerEvents = constant("auto");
147
- _this._rotate = constant(0);
148
- _this._rotateAnchor = function(d) {
510
+ }
511
+ },
512
+ {
513
+ key: "lineHeight",
514
+ coerce: "const"
515
+ },
516
+ {
517
+ key: "maxLines",
518
+ coerce: "const",
519
+ default: constant(null)
520
+ },
521
+ {
522
+ key: "overflow",
523
+ coerce: "const",
524
+ default: constant(false)
525
+ },
526
+ {
527
+ key: "padding",
528
+ coerce: "const",
529
+ default: constant(0)
530
+ },
531
+ {
532
+ key: "pointerEvents",
533
+ coerce: "const",
534
+ default: constant("auto")
535
+ },
536
+ {
537
+ key: "renderMode",
538
+ coerce: "identity",
539
+ default: "full"
540
+ },
541
+ {
542
+ key: "rotate",
543
+ coerce: "const",
544
+ default: constant(0)
545
+ },
546
+ {
547
+ key: "rotateAnchor",
548
+ coerce: "const",
549
+ default: function _default(d) {
149
550
  return [
150
551
  d.w / 2,
151
552
  d.h / 2
152
553
  ];
554
+ }
555
+ },
556
+ {
557
+ key: "split",
558
+ coerce: "identity",
559
+ default: textSplit
560
+ },
561
+ {
562
+ key: "text",
563
+ coerce: "const",
564
+ default: accessor("text")
565
+ },
566
+ {
567
+ key: "textAnchor",
568
+ coerce: "const",
569
+ default: constant("start")
570
+ },
571
+ {
572
+ key: "verticalAlign",
573
+ coerce: "const",
574
+ default: constant("top")
575
+ },
576
+ {
577
+ key: "width",
578
+ coerce: "const",
579
+ default: accessor("width", 200)
580
+ },
581
+ {
582
+ key: "x",
583
+ coerce: "const",
584
+ default: accessor("x", 0)
585
+ },
586
+ {
587
+ key: "y",
588
+ coerce: "const",
589
+ default: accessor("y", 0)
590
+ }
591
+ ];
592
+ var TextBox = /*#__PURE__*/ function(BaseClass) {
593
+ "use strict";
594
+ _inherits(TextBox, BaseClass);
595
+ function TextBox() {
596
+ _class_call_check(this, TextBox);
597
+ var _this;
598
+ _this = _call_super(this, TextBox), _define_property(_this, "_select", void 0), _define_property(_this, "_data", void 0);
599
+ installFluent(_this, textBoxSchema);
600
+ _this.schema.lineHeight = function(d, i) {
601
+ return _this.schema.fontSize(d, i) * 1.2;
153
602
  };
154
- _this._split = textSplit;
155
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
156
- _this._text = accessor("text");
157
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
158
- _this._textAnchor = constant("start");
159
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
160
- _this._verticalAlign = constant("top");
161
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
162
- _this._width = accessor("width", 200);
163
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
164
- _this._x = accessor("x", 0);
165
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
166
- _this._y = accessor("y", 0);
603
+ _this.schema.html = defaultHtmlLookup;
167
604
  return _this;
168
605
  }
169
606
  _create_class(TextBox, [
170
607
  {
171
608
  /**
609
+ Computes the laid-out text boxes (wrapping, font sizing, per-box position)
610
+ for the current data. Shared by render() and toScene() so both produce
611
+ identical layout.
612
+ @private
613
+ */ key: "_textData",
614
+ value: function _textData() {
615
+ var _this = this;
616
+ return this._data.reduce(function(arr, d, i) {
617
+ var datum = computeTextBoxDatum(_this, d, i);
618
+ if (datum) arr.push(datum);
619
+ return arr;
620
+ }, []);
621
+ }
622
+ },
623
+ {
624
+ /**
625
+ Produces a backend-agnostic scene graph for the text boxes, reusing the same
626
+ layout (_textData) and per-line positioning render() applies to the DOM.
627
+ */ key: "toScene",
628
+ value: function toScene() {
629
+ var _this = this;
630
+ var rtl = detectRTL();
631
+ var children = this._textData().map(function(d) {
632
+ var anchor = d.tA === "middle" ? "middle" : d.tA === "end" ? "end" : "start";
633
+ var lineX = d.tA === "middle" ? d.w / 2 : rtl ? d.tA === "start" ? d.w : 0 : d.tA === "end" ? d.w : 2 * Math.sin(Math.PI * d.r / 180);
634
+ var lines = d.lines.map(function(text, i) {
635
+ var _d_widths_i;
636
+ var y = d.r === 0 || d.vA === "top" ? (i + 1) * d.lH - (d.lH - d.fS) : d.vA === "middle" ? (d.h + d.fS) / 2 - (d.lH - d.fS) + (i - d.lines.length / 2 + 0.5) * d.lH : d.h - 2 * (d.lH - d.fS) - (d.lines.length - (i + 1)) * d.lH + 2 * Math.cos(Math.PI * d.r / 180);
637
+ var width = d.widths ? (_d_widths_i = d.widths[i]) !== null && _d_widths_i !== void 0 ? _d_widths_i : 0 : 0;
638
+ var runs = d.lineRuns ? d.lineRuns[i] : undefined;
639
+ return runs ? {
640
+ text: text,
641
+ x: lineX,
642
+ y: y,
643
+ width: width,
644
+ runs: runs
645
+ } : {
646
+ text: text,
647
+ x: lineX,
648
+ y: y,
649
+ width: width
650
+ };
651
+ });
652
+ var rotateAnchor = _this.schema.rotateAnchor(d, d.i);
653
+ var ariaHidden = d.aH === "true" || d.aH === true;
654
+ var interactive = d.pE !== "none";
655
+ return {
656
+ type: "text",
657
+ key: d.id,
658
+ id: "d3plus-textBox-".concat(strip(d.id)),
659
+ datum: d.data,
660
+ index: d.i,
661
+ x: 0,
662
+ y: 0,
663
+ width: d.w,
664
+ height: d.h,
665
+ lines: lines,
666
+ font: {
667
+ family: d.fF,
668
+ size: d.fS,
669
+ weight: d.fW,
670
+ anchor: anchor,
671
+ baseline: "alphabetic",
672
+ dir: rtl ? "rtl" : "ltr"
673
+ },
674
+ paint: _object_spread({
675
+ fill: d.fC,
676
+ opacity: d.fO
677
+ }, d.fStroke && d.fStroke !== "transparent" ? {
678
+ stroke: d.fStroke
679
+ } : {}, d.fSW ? {
680
+ strokeWidth: d.fSW
681
+ } : {}),
682
+ transform: {
683
+ x: d.x,
684
+ y: d.y,
685
+ rotate: d.r,
686
+ rotateAnchor: rotateAnchor
687
+ },
688
+ aria: ariaHidden ? {
689
+ hidden: true
690
+ } : undefined,
691
+ interactive: interactive
692
+ };
693
+ });
694
+ return {
695
+ type: "group",
696
+ key: "textBox-group",
697
+ children: children
698
+ };
699
+ }
700
+ },
701
+ {
702
+ /**
172
703
  Renders the text boxes. If a *callback* is specified, it will be called once the shapes are done drawing.
173
704
  @param callback Optional callback invoked after rendering completes.
174
705
  */ key: "render",
175
706
  value: function render(callback) {
176
- var _this = this;
177
- if (this._select === void 0) this.select(select("body").append("svg").style("width", "".concat(window.innerWidth, "px")).style("height", "".concat(window.innerHeight, "px")).node());
178
- var that = this;
179
- var boxes = this._select.selectAll(".d3plus-textBox").data(this._data.reduce(function(arr, d, i) {
180
- var t = _this._text(d, i);
181
- if (t === void 0) return arr;
182
- t = "".concat(t).trim();
183
- var resize = _this._fontResize(d, i);
184
- var lHRatio = _this._lineHeight(d, i) / _this._fontSize(d, i);
185
- var fS = resize ? _this._fontMax(d, i) : _this._fontSize(d, i), lH = resize ? fS * lHRatio : _this._lineHeight(d, i), line = 1, lineData = [], sizes, wrapResults = {
186
- lines: [],
187
- truncated: false,
188
- widths: []
189
- };
190
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
191
- var style = {
192
- "font-family": fontExists(_this._fontFamily(d, i)),
193
- "font-size": fS,
194
- "font-weight": _this._fontWeight(d, i),
195
- "line-height": lH
196
- };
197
- var padding = parseSides(_this._padding(d, i));
198
- var h = _this._height(d, i) - (padding.top + padding.bottom), w = _this._width(d, i) - (padding.left + padding.right);
199
- var wrapper = textWrap().fontFamily(style["font-family"]).fontSize(fS).fontWeight(style["font-weight"]).lineHeight(lH).maxLines(_this._maxLines(d, i)).height(h).overflow(_this._overflow(d, i)).width(w).split(_this._split);
200
- var fMax = _this._fontMax(d, i), fMin = _this._fontMin(d, i), vA = _this._verticalAlign(d, i), words = _this._split(t, i);
201
- /**
202
- Figures out the lineData to be used for wrapping.
203
- @private
204
- */ function checkSize() {
205
- var truncate = function truncate() {
206
- if (line < 1) lineData = [
207
- that._ellipsis("", line)
208
- ];
209
- else lineData[line - 1] = that._ellipsis(lineData[line - 1], line);
210
- };
211
- // Constraint the font size
212
- fS = max([
213
- fS,
214
- fMin
215
- ]);
216
- fS = min([
217
- fS,
218
- fMax
219
- ]);
220
- if (resize) {
221
- lH = fS * lHRatio;
222
- wrapper.fontSize(fS).lineHeight(lH);
223
- style["font-size"] = fS;
224
- style["line-height"] = lH;
225
- }
226
- wrapResults = wrapper(t);
227
- lineData = wrapResults.lines.filter(function(l) {
228
- return l !== "";
229
- });
230
- line = lineData.length;
231
- if (wrapResults.truncated) {
232
- if (resize) {
233
- fS--;
234
- if (fS < fMin) {
235
- fS = fMin;
236
- truncate();
237
- return;
238
- } else checkSize();
239
- } else truncate();
240
- }
241
- }
242
- if (w > fMin && (h > lH || resize && h > fMin * lHRatio)) {
243
- if (resize) {
244
- sizes = textWidth(words, style);
245
- var areaMod = 1.165 + w / h * 0.1, boxArea = w * h, maxWidth = max(sizes), textArea = sum(sizes, function(d) {
246
- return d * lH;
247
- }) * areaMod;
248
- if (maxWidth > w || textArea > boxArea) {
249
- var areaRatio = Math.sqrt(boxArea / textArea), widthRatio = w / maxWidth;
250
- var sizeRatio = min([
251
- areaRatio,
252
- widthRatio
253
- ]);
254
- fS = Math.floor(fS * sizeRatio);
255
- }
256
- var heightMax = Math.floor(h * 0.8);
257
- if (fS > heightMax) fS = heightMax;
258
- }
259
- checkSize();
260
- }
261
- if (lineData.length) {
262
- var tH = line * lH;
263
- var r = _this._rotate(d, i);
264
- var yP = r === 0 ? vA === "top" ? 0 : vA === "middle" ? h / 2 - tH / 2 : h - tH : 0;
265
- yP -= lH * 0.1;
266
- arr.push({
267
- aH: _this._ariaHidden(d, i),
268
- data: d,
269
- i: i,
270
- lines: lineData,
271
- fC: _this._fontColor(d, i),
272
- fStroke: _this._fontStroke(d, i),
273
- fSW: _this._fontStrokeWidth(d, i),
274
- fF: style["font-family"],
275
- fO: _this._fontOpacity(d, i),
276
- fW: style["font-weight"],
277
- id: _this._id(d, i),
278
- tA: _this._textAnchor(d, i),
279
- vA: _this._verticalAlign(d, i),
280
- widths: wrapResults.widths,
281
- fS: fS,
282
- lH: lH,
283
- w: w,
284
- h: h,
285
- r: r,
286
- x: _this._x(d, i) + padding.left,
287
- y: _this._y(d, i) + yP + padding.top
288
- });
289
- }
290
- return arr;
291
- }, []), // eslint-disable-next-line @typescript-eslint/no-explicit-any
292
- function(d) {
293
- return _this._id(d.data, d.i);
294
- });
295
- var t = this._select.transition().duration(this._duration);
296
- if (this._duration === 0) {
297
- boxes.exit().remove();
298
- } else {
299
- boxes.exit().transition().delay(this._duration).remove();
300
- boxes.exit().selectAll("text").transition(t).attr("opacity", 0).style("opacity", 0);
707
+ if (this.schema.renderMode === "compute") {
708
+ // A Viz pipeline (or parent shape) is driving this TextBox — it will
709
+ // compose the scene itself, so we only need _textData to be reachable.
710
+ if (callback) setTimeout(callback, 0);
711
+ return this;
301
712
  }
302
- /**
303
- * Applies translate and rotate to a text element.
304
- * @param {D3Selection} text
305
- * @private
306
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
307
- function rotate(text) {
308
- text.attr("transform", function(d, i) {
309
- var rotateAnchor = that._rotateAnchor(d, i);
310
- return "translate(".concat(d.x, ", ").concat(d.y, ") rotate(").concat(d.r, ", ").concat(rotateAnchor[0], ", ").concat(rotateAnchor[1], ")");
311
- });
713
+ // Standalone use: route toScene() through SvgRenderer. Mirrors Shape.render
714
+ // so `new TextBox().render()` works without a d3-selection body.
715
+ if (this._select === undefined && typeof document !== "undefined") {
716
+ var svgNode = select("body").append("svg").style("width", "".concat(window.innerWidth, "px")).style("height", "".concat(window.innerHeight, "px")).node();
717
+ this.select(svgNode);
312
718
  }
313
- var update = boxes.enter().append("g").attr("class", "d3plus-textBox").attr("id", function(d) {
314
- return "d3plus-textBox-".concat(strip(d.id));
315
- }).call(rotate).merge(boxes);
316
- var rtl = detectRTL();
317
- update.order().style("pointer-events", function(d) {
318
- return _this._pointerEvents(d.data, d.i);
319
- }).each(function(d) {
320
- /**
321
- Sets the inner text content of each <text> element.
322
- @private
323
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
- function textContent(text) {
325
- var tag = false;
326
- text[that._html ? "html" : "text"](function(t) {
327
- var cleaned = t.trimEnd().replace(/&([^;&]*)/g, function(str, a) {
328
- return a === "amp" ? str : "&amp;".concat(a);
329
- }) // replaces all non-HTML ampersands with escaped entity
330
- .replace(/<([^A-z^/]+)/g, function(_str, a) {
331
- return "&lt;".concat(a);
332
- }).replace(/<$/g, "&lt;") // replaces all non-HTML left angle brackets with escaped entity
333
- .replace(/(<[^>^/]+>)([^<^>]+)$/g, function(_str, a, b) {
334
- return "".concat(a).concat(b).concat(a.replace("<", "</"));
335
- }) // ands end tag to lines before mid-HTML break
336
- .replace(/^([^<^>]+)(<\/[^>]+>)/g, function(_str, a, b) {
337
- return "".concat(b.replace("</", "<")).concat(a).concat(b);
338
- }); // ands start tag to lines after mid-HTML break
339
- var tagRegex = new RegExp(/<([A-z]+)[^>]*>([^<^>]+)<\/[^>]+>/g);
340
- if (cleaned.match(tagRegex)) {
341
- var htmlLookup = that._html;
342
- cleaned = cleaned.replace(tagRegex, function(_str, a, b) {
343
- tag = htmlLookup[a] ? a : false;
344
- if (tag) {
345
- var style = htmlLookup[tag];
346
- if (t.includes("</".concat(tag, ">"))) tag = false;
347
- return '<tspan style="'.concat(style, '">').concat(b, "</tspan>");
348
- }
349
- return b;
350
- });
351
- } else if (tag && tag.length) {
352
- var htmlLookup1 = that._html;
353
- cleaned = '<tspan style="'.concat(htmlLookup1[tag], '">').concat(cleaned, "</tspan>");
354
- }
355
- return cleaned;
356
- });
357
- }
358
- /**
359
- Styles to apply to each <text> element.
360
- @private
361
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
362
- function textStyle(text) {
363
- text.attr("aria-hidden", d.aH).attr("dir", rtl ? "rtl" : "ltr").attr("fill", d.fC).attr("stroke", d.fStroke).attr("stroke-width", d.fSW).attr("text-anchor", d.tA).attr("font-family", d.fF).style("font-family", d.fF).attr("font-size", "".concat(d.fS, "px")).style("font-size", "".concat(d.fS, "px")).attr("font-weight", d.fW).style("font-weight", d.fW).attr("x", "".concat(d.tA === "middle" ? d.w / 2 : rtl ? d.tA === "start" ? d.w : 0 : d.tA === "end" ? d.w : 2 * Math.sin(Math.PI * d.r / 180), "px")).attr("y", function(_t, i) {
364
- return d.r === 0 || d.vA === "top" ? "".concat((i + 1) * d.lH - (d.lH - d.fS), "px") : d.vA === "middle" ? "".concat((d.h + d.fS) / 2 - (d.lH - d.fS) + (i - d.lines.length / 2 + 0.5) * d.lH, "px") : "".concat(d.h - 2 * (d.lH - d.fS) - (d.lines.length - (i + 1)) * d.lH + 2 * Math.cos(Math.PI * d.r / 180), "px");
719
+ if (this._select) {
720
+ var sel = this._select;
721
+ var node = sel && typeof sel.node === "function" ? sel.node() : sel;
722
+ if (node) {
723
+ var root = this.toScene();
724
+ var contentW = root.children.reduce(function(m, c) {
725
+ var _ref, _c_width;
726
+ var _c_transform;
727
+ return Math.max(m, ((_ref = (_c_transform = c.transform) === null || _c_transform === void 0 ? void 0 : _c_transform.x) !== null && _ref !== void 0 ? _ref : 0) + ((_c_width = c.width) !== null && _c_width !== void 0 ? _c_width : 0));
728
+ }, 0);
729
+ var contentH = root.children.reduce(function(m, c) {
730
+ var _ref, _c_height;
731
+ var _c_transform;
732
+ return Math.max(m, ((_ref = (_c_transform = c.transform) === null || _c_transform === void 0 ? void 0 : _c_transform.y) !== null && _ref !== void 0 ? _ref : 0) + ((_c_height = c.height) !== null && _c_height !== void 0 ? _c_height : 0));
733
+ }, 0);
734
+ var rect = typeof node.getBoundingClientRect === "function" ? node.getBoundingClientRect() : null;
735
+ var boxW = rect && rect.width || Number(node.getAttribute("width")) || node.clientWidth || 0;
736
+ var boxH = rect && rect.height || Number(node.getAttribute("height")) || node.clientHeight || 0;
737
+ var width = Math.max(boxW, contentW) || 400;
738
+ var height = Math.max(boxH, contentH) || 300;
739
+ while(node.firstChild)node.removeChild(node.firstChild);
740
+ var scene = {
741
+ root: root,
742
+ width: width,
743
+ height: height
744
+ };
745
+ var renderer = new SvgRenderer();
746
+ renderer.mount({
747
+ container: node,
748
+ width: width,
749
+ height: height
365
750
  });
751
+ renderer.drawScene(scene);
752
+ this._sceneRenderer = renderer;
366
753
  }
367
- var texts = select(this).selectAll("text").data(d.lines);
368
- if (that._duration === 0) {
369
- texts.call(textContent).call(textStyle);
370
- texts.exit().remove();
371
- texts.enter().append("text").attr("dominant-baseline", "alphabetic").style("baseline-shift", "0%").attr("unicode-bidi", "bidi-override").call(textContent).call(textStyle).attr("opacity", d.fO).style("opacity", d.fO);
372
- } else {
373
- texts.call(textContent).transition(t).call(textStyle);
374
- texts.exit().transition(t).attr("opacity", 0).remove();
375
- texts.enter().append("text").attr("dominant-baseline", "alphabetic").style("baseline-shift", "0%").attr("opacity", 0).style("opacity", 0).call(textContent).call(textStyle).merge(texts).transition(t).delay(that._delay).call(textStyle).attr("opacity", d.fO).style("opacity", d.fO);
376
- }
377
- }).transition(t).call(rotate);
378
- var events = Object.keys(this._on), on = events.reduce(function(obj, e) {
379
- var _this1 = _this;
380
- obj[e] = function() {
381
- for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
382
- args[_key] = arguments[_key];
383
- }
384
- return _this1._on[e](args[0].data, args[1]);
385
- };
386
- return obj;
387
- }, {});
388
- for(var e = 0; e < events.length; e++)update.on(events[e], on[events[e]]);
389
- if (callback) setTimeout(callback, this._duration + 100);
754
+ }
755
+ if (callback) setTimeout(callback, 0);
390
756
  return this;
391
757
  }
392
758
  },
393
- {
394
- key: "ariaHidden",
395
- value: function ariaHidden(_) {
396
- return _ !== undefined ? (this._ariaHidden = typeof _ === "function" ? _ : constant(_), this) : this._ariaHidden;
397
- }
398
- },
399
759
  {
400
760
  key: "data",
401
761
  value: function data(_) {
402
762
  return arguments.length ? (this._data = _, this) : this._data;
403
763
  }
404
764
  },
405
- {
406
- key: "delay",
407
- value: function delay(_) {
408
- return arguments.length ? (this._delay = _, this) : this._delay;
409
- }
410
- },
411
- {
412
- key: "duration",
413
- value: function duration(_) {
414
- return arguments.length ? (this._duration = _, this) : this._duration;
415
- }
416
- },
417
- {
418
- key: "ellipsis",
419
- value: function ellipsis(_) {
420
- return arguments.length ? (this._ellipsis = typeof _ === "function" ? _ : constant(_), this) : this._ellipsis;
421
- }
422
- },
423
- {
424
- key: "fontColor",
425
- value: function fontColor(_) {
426
- return arguments.length ? (this._fontColor = typeof _ === "function" ? _ : constant(_), this) : this._fontColor;
427
- }
428
- },
429
- {
430
- key: "fontFamily",
431
- value: function fontFamily(_) {
432
- return arguments.length ? (this._fontFamily = typeof _ === "function" ? _ : constant(_), this) : this._fontFamily;
433
- }
434
- },
435
- {
436
- key: "fontMax",
437
- value: function fontMax(_) {
438
- return arguments.length ? (this._fontMax = typeof _ === "function" ? _ : constant(_), this) : this._fontMax;
439
- }
440
- },
441
- {
442
- key: "fontMin",
443
- value: function fontMin(_) {
444
- return arguments.length ? (this._fontMin = typeof _ === "function" ? _ : constant(_), this) : this._fontMin;
445
- }
446
- },
447
- {
448
- key: "fontOpacity",
449
- value: function fontOpacity(_) {
450
- return arguments.length ? (this._fontOpacity = typeof _ === "function" ? _ : constant(_), this) : this._fontOpacity;
451
- }
452
- },
453
- {
454
- key: "fontResize",
455
- value: function fontResize(_) {
456
- return arguments.length ? (this._fontResize = typeof _ === "function" ? _ : constant(_), this) : this._fontResize;
457
- }
458
- },
459
- {
460
- key: "fontSize",
461
- value: function fontSize(_) {
462
- return arguments.length ? (this._fontSize = typeof _ === "function" ? _ : constant(_), this) : this._fontSize;
463
- }
464
- },
465
- {
466
- key: "fontStroke",
467
- value: function fontStroke(_) {
468
- return arguments.length ? (this._fontStroke = typeof _ === "function" ? _ : constant(_), this) : this._fontStroke;
469
- }
470
- },
471
- {
472
- key: "fontStrokeWidth",
473
- value: function fontStrokeWidth(_) {
474
- return arguments.length ? (this._fontStrokeWidth = typeof _ === "function" ? _ : constant(_), this) : this._fontStrokeWidth;
475
- }
476
- },
477
- {
478
- key: "fontWeight",
479
- value: function fontWeight(_) {
480
- return arguments.length ? (this._fontWeight = typeof _ === "function" ? _ : constant(_), this) : this._fontWeight;
481
- }
482
- },
483
- {
484
- key: "height",
485
- value: function height(_) {
486
- return arguments.length ? (this._height = typeof _ === "function" ? _ : constant(_), this) : this._height;
487
- }
488
- },
489
765
  {
490
766
  key: "html",
491
767
  value: function html(_) {
492
- return arguments.length ? (this._html = typeof _ === "boolean" ? _ ? defaultHtmlLookup : false : _, this) : this._html;
493
- }
494
- },
495
- {
496
- key: "id",
497
- value: function id(_) {
498
- return arguments.length ? (this._id = typeof _ === "function" ? _ : constant(_), this) : this._id;
499
- }
500
- },
501
- {
502
- key: "lineHeight",
503
- value: function lineHeight(_) {
504
- return arguments.length ? (this._lineHeight = typeof _ === "function" ? _ : constant(_), this) : this._lineHeight;
505
- }
506
- },
507
- {
508
- key: "maxLines",
509
- value: function maxLines(_) {
510
- return arguments.length ? (this._maxLines = typeof _ === "function" ? _ : constant(_), this) : this._maxLines;
511
- }
512
- },
513
- {
514
- key: "overflow",
515
- value: function overflow(_) {
516
- return arguments.length ? (this._overflow = typeof _ === "function" ? _ : constant(_), this) : this._overflow;
517
- }
518
- },
519
- {
520
- key: "padding",
521
- value: function padding(_) {
522
- return arguments.length ? (this._padding = typeof _ === "function" ? _ : constant(_), this) : this._padding;
523
- }
524
- },
525
- {
526
- key: "pointerEvents",
527
- value: function pointerEvents(_) {
528
- return arguments.length ? (this._pointerEvents = typeof _ === "function" ? _ : constant(_), this) : this._pointerEvents;
529
- }
530
- },
531
- {
532
- key: "rotate",
533
- value: function rotate(_) {
534
- return arguments.length ? (this._rotate = typeof _ === "function" ? _ : constant(_), this) : this._rotate;
535
- }
536
- },
537
- {
538
- key: "rotateAnchor",
539
- value: function rotateAnchor(_) {
540
- return arguments.length ? (this._rotateAnchor = typeof _ === "function" ? _ : constant(_), this) : this._rotateAnchor;
768
+ return arguments.length ? (this.schema.html = typeof _ === "boolean" ? _ ? defaultHtmlLookup : false : _, this) : this.schema.html;
541
769
  }
542
770
  },
543
771
  {
@@ -545,48 +773,6 @@ var TextBox = /*#__PURE__*/ function(BaseClass) {
545
773
  value: function select1(_) {
546
774
  return arguments.length ? (this._select = select(_), this) : this._select;
547
775
  }
548
- },
549
- {
550
- key: "split",
551
- value: function split(_) {
552
- return arguments.length ? (this._split = _, this) : this._split;
553
- }
554
- },
555
- {
556
- key: "text",
557
- value: function text(_) {
558
- return arguments.length ? (this._text = typeof _ === "function" ? _ : constant(_), this) : this._text;
559
- }
560
- },
561
- {
562
- key: "textAnchor",
563
- value: function textAnchor(_) {
564
- return arguments.length ? (this._textAnchor = typeof _ === "function" ? _ : constant(_), this) : this._textAnchor;
565
- }
566
- },
567
- {
568
- key: "verticalAlign",
569
- value: function verticalAlign(_) {
570
- return arguments.length ? (this._verticalAlign = typeof _ === "function" ? _ : constant(_), this) : this._verticalAlign;
571
- }
572
- },
573
- {
574
- key: "width",
575
- value: function width(_) {
576
- return arguments.length ? (this._width = typeof _ === "function" ? _ : constant(_), this) : this._width;
577
- }
578
- },
579
- {
580
- key: "x",
581
- value: function x(_) {
582
- return arguments.length ? (this._x = typeof _ === "function" ? _ : constant(_), this) : this._x;
583
- }
584
- },
585
- {
586
- key: "y",
587
- value: function y(_) {
588
- return arguments.length ? (this._y = typeof _ === "function" ? _ : constant(_), this) : this._y;
589
- }
590
776
  }
591
777
  ]);
592
778
  return TextBox;