@d3plus/core 4.5.0 → 4.6.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 (241) hide show
  1. package/README.md +3698 -1074
  2. package/es/index.js +3 -3
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +6 -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 +15 -0
  13. package/es/src/charts/Chord/index.js.map +1 -1
  14. package/es/src/charts/Geomap/applyLayout.js +17 -10
  15. package/es/src/charts/Geomap/applyLayout.js.map +1 -1
  16. package/es/src/charts/Geomap/index.js +5 -1
  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/Network/applyLayout.js +52 -4
  23. package/es/src/charts/Network/applyLayout.js.map +1 -1
  24. package/es/src/charts/Network/emit.js +4 -4
  25. package/es/src/charts/Network/emit.js.map +1 -1
  26. package/es/src/charts/Network/index.js +6 -1
  27. package/es/src/charts/Network/index.js.map +1 -1
  28. package/es/src/charts/Pack/emit.js +37 -2
  29. package/es/src/charts/Pack/emit.js.map +1 -1
  30. package/es/src/charts/Pack/index.js +13 -0
  31. package/es/src/charts/Pack/index.js.map +1 -1
  32. package/es/src/charts/Pie/applyLayout.js +20 -2
  33. package/es/src/charts/Pie/applyLayout.js.map +1 -1
  34. package/es/src/charts/Pie/emit.js +274 -33
  35. package/es/src/charts/Pie/emit.js.map +1 -1
  36. package/es/src/charts/Pie/index.js +46 -1
  37. package/es/src/charts/Pie/index.js.map +1 -1
  38. package/es/src/charts/Plot/discreteSpan.js +42 -0
  39. package/es/src/charts/Plot/discreteSpan.js.map +1 -0
  40. package/es/src/charts/Plot/draw.js +3 -1
  41. package/es/src/charts/Plot/draw.js.map +1 -1
  42. package/es/src/charts/Plot/index.js +129 -14
  43. package/es/src/charts/Plot/index.js.map +1 -1
  44. package/es/src/charts/Plot/pipeline.js +47 -20
  45. package/es/src/charts/Plot/pipeline.js.map +1 -1
  46. package/es/src/charts/Plot/pipelineDomains.js +84 -8
  47. package/es/src/charts/Plot/pipelineDomains.js.map +1 -1
  48. package/es/src/charts/Plot/shapeDefaults.js +3 -3
  49. package/es/src/charts/Plot/shapeDefaults.js.map +1 -1
  50. package/es/src/charts/Plot/sharedHover.js +431 -0
  51. package/es/src/charts/Plot/sharedHover.js.map +1 -0
  52. package/es/src/charts/Plot/sharedHoverScene.js +230 -0
  53. package/es/src/charts/Plot/sharedHoverScene.js.map +1 -0
  54. package/es/src/charts/Plot/sharedTooltip.js +163 -0
  55. package/es/src/charts/Plot/sharedTooltip.js.map +1 -0
  56. package/es/src/charts/Plot/stackShareLabels.js +137 -0
  57. package/es/src/charts/Plot/stackShareLabels.js.map +1 -0
  58. package/es/src/charts/Plot/stackShareTooltip.js +31 -0
  59. package/es/src/charts/Plot/stackShareTooltip.js.map +1 -0
  60. package/es/src/charts/Plot/trendLines.js +367 -0
  61. package/es/src/charts/Plot/trendLines.js.map +1 -0
  62. package/es/src/charts/Plot/trendScene.js +220 -0
  63. package/es/src/charts/Plot/trendScene.js.map +1 -0
  64. package/es/src/charts/Plot/trendTooltip.js +160 -0
  65. package/es/src/charts/Plot/trendTooltip.js.map +1 -0
  66. package/es/src/charts/Priestley/emit.js +32 -3
  67. package/es/src/charts/Priestley/emit.js.map +1 -1
  68. package/es/src/charts/Radar/index.js +15 -2
  69. package/es/src/charts/Radar/index.js.map +1 -1
  70. package/es/src/charts/RadialMatrix/index.js +17 -1
  71. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  72. package/es/src/charts/Rings/applyLayout.js +72 -116
  73. package/es/src/charts/Rings/applyLayout.js.map +1 -1
  74. package/es/src/charts/Rings/emit.js +2 -3
  75. package/es/src/charts/Rings/emit.js.map +1 -1
  76. package/es/src/charts/Rings/index.js +13 -2
  77. package/es/src/charts/Rings/index.js.map +1 -1
  78. package/es/src/charts/Rings/ringsSizing.js +189 -0
  79. package/es/src/charts/Rings/ringsSizing.js.map +1 -0
  80. package/es/src/charts/StackedArea/index.js +8 -1
  81. package/es/src/charts/StackedArea/index.js.map +1 -1
  82. package/es/src/charts/Tree/emit.js +2 -2
  83. package/es/src/charts/Tree/emit.js.map +1 -1
  84. package/es/src/charts/Tree/index.js +5 -3
  85. package/es/src/charts/Tree/index.js.map +1 -1
  86. package/es/src/charts/Treemap/emit.js +56 -3
  87. package/es/src/charts/Treemap/emit.js.map +1 -1
  88. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  89. package/es/src/charts/definition/makeChart.js +8 -1
  90. package/es/src/charts/definition/makeChart.js.map +1 -1
  91. package/es/src/charts/drawSteps/backControl.js +17 -2
  92. package/es/src/charts/drawSteps/backControl.js.map +1 -1
  93. package/es/src/charts/drawSteps/bottomRightControls.js +193 -0
  94. package/es/src/charts/drawSteps/bottomRightControls.js.map +1 -0
  95. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js +161 -0
  96. package/es/src/charts/drawSteps/bottomRightControlsMarkup.js.map +1 -0
  97. package/es/src/charts/drawSteps/minimap.js +34 -9
  98. package/es/src/charts/drawSteps/minimap.js.map +1 -1
  99. package/es/src/charts/drawSteps/zoomControls.js +3 -0
  100. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  101. package/es/src/charts/events/click.shape.js +24 -1
  102. package/es/src/charts/events/click.shape.js.map +1 -1
  103. package/es/src/charts/events/mouseenter.js +3 -0
  104. package/es/src/charts/events/mouseenter.js.map +1 -1
  105. package/es/src/charts/events/mouseleave.js +3 -0
  106. package/es/src/charts/events/mouseleave.js.map +1 -1
  107. package/es/src/charts/events/mousemove.shape.js +2 -0
  108. package/es/src/charts/events/mousemove.shape.js.map +1 -1
  109. package/es/src/charts/features/axes.js +4 -1
  110. package/es/src/charts/features/axes.js.map +1 -1
  111. package/es/src/charts/features/emitHelpers.js +24 -0
  112. package/es/src/charts/features/emitHelpers.js.map +1 -1
  113. package/es/src/charts/features/features.js +6 -2
  114. package/es/src/charts/features/features.js.map +1 -1
  115. package/es/src/charts/features/featuresLegend.js +13 -5
  116. package/es/src/charts/features/featuresLegend.js.map +1 -1
  117. package/es/src/charts/features/plotPaint.js +51 -24
  118. package/es/src/charts/features/plotPaint.js.map +1 -1
  119. package/es/src/charts/features/shapeEmit.js +20 -2
  120. package/es/src/charts/features/shapeEmit.js.map +1 -1
  121. package/es/src/charts/index.js +1 -0
  122. package/es/src/charts/index.js.map +1 -1
  123. package/es/src/charts/pipeline/drillMorph.js +159 -0
  124. package/es/src/charts/pipeline/drillMorph.js.map +1 -0
  125. package/es/src/charts/pipeline/runChartDraw.js +35 -1
  126. package/es/src/charts/pipeline/runChartDraw.js.map +1 -1
  127. package/es/src/charts/pipeline/runVizPipeline.js +16 -1
  128. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  129. package/es/src/charts/pipeline/vizDrawPure.js +20 -0
  130. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  131. package/es/src/charts/viz/Viz.js +64 -8
  132. package/es/src/charts/viz/Viz.js.map +1 -1
  133. package/es/src/charts/viz/VizBase.js +29 -1
  134. package/es/src/charts/viz/VizBase.js.map +1 -1
  135. package/es/src/charts/viz/VizBaseConfig.js +9 -1
  136. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  137. package/es/src/charts/viz/ordinalColor.js +2 -2
  138. package/es/src/charts/viz/ordinalColor.js.map +1 -1
  139. package/es/src/charts/viz/vizDefaults.js +27 -8
  140. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  141. package/es/src/charts/viz/vizRender.js +54 -4
  142. package/es/src/charts/viz/vizRender.js.map +1 -1
  143. package/es/src/charts/viz/vizTypes.js.map +1 -1
  144. package/es/src/charts/viz/vizVisibility.js +145 -0
  145. package/es/src/charts/viz/vizVisibility.js.map +1 -0
  146. package/es/src/components/Axis/Axis.js +8 -8
  147. package/es/src/components/Axis/Axis.js.map +1 -1
  148. package/es/src/components/ColorScale/ColorScale.js +11 -11
  149. package/es/src/components/ColorScale/ColorScale.js.map +1 -1
  150. package/es/src/components/ColorScale/colorScaleScale.js +22 -10
  151. package/es/src/components/ColorScale/colorScaleScale.js.map +1 -1
  152. package/es/src/components/Legend/Legend.js +8 -5
  153. package/es/src/components/Legend/Legend.js.map +1 -1
  154. package/es/src/components/Legend/legendConfig.js +1 -1
  155. package/es/src/components/Legend/legendConfig.js.map +1 -1
  156. package/es/src/components/Legend/legendRender.js +29 -22
  157. package/es/src/components/Legend/legendRender.js.map +1 -1
  158. package/es/src/components/SizeLegend/SizeLegend.js +411 -0
  159. package/es/src/components/SizeLegend/SizeLegend.js.map +1 -0
  160. package/es/src/components/SizeLegend/sizeLegendLayout.js +285 -0
  161. package/es/src/components/SizeLegend/sizeLegendLayout.js.map +1 -0
  162. package/es/src/components/Timeline/timelineConfig.js +8 -4
  163. package/es/src/components/Timeline/timelineConfig.js.map +1 -1
  164. package/es/src/components/Timeline/timelineRender.js +1 -2
  165. package/es/src/components/Timeline/timelineRender.js.map +1 -1
  166. package/es/src/components/Tooltip.js +27 -7
  167. package/es/src/components/Tooltip.js.map +1 -1
  168. package/es/src/components/index.js +1 -0
  169. package/es/src/components/index.js.map +1 -1
  170. package/es/src/shapes/Box.js +4 -2
  171. package/es/src/shapes/Box.js.map +1 -1
  172. package/es/src/shapes/Shape.js +1 -1
  173. package/es/src/shapes/Shape.js.map +1 -1
  174. package/es/src/shapes/Whisker.js +3 -2
  175. package/es/src/shapes/Whisker.js.map +1 -1
  176. package/es/src/shapes/validateShapeConfig.js +141 -0
  177. package/es/src/shapes/validateShapeConfig.js.map +1 -0
  178. package/es/src/utils/BaseClass.js +134 -4
  179. package/es/src/utils/BaseClass.js.map +1 -1
  180. package/es/src/utils/D3plusConfig.js.map +1 -1
  181. package/es/src/utils/configDefault.js +17 -0
  182. package/es/src/utils/configDefault.js.map +1 -0
  183. package/es/src/utils/configPrep.js +2 -1
  184. package/es/src/utils/configPrep.js.map +1 -1
  185. package/es/src/utils/configWarnings.js +37 -0
  186. package/es/src/utils/configWarnings.js.map +1 -0
  187. package/es/src/utils/index.js +1 -0
  188. package/es/src/utils/index.js.map +1 -1
  189. package/package.json +11 -10
  190. package/types/index.d.ts +4 -4
  191. package/types/internal.d.ts +8 -1
  192. package/types/src/charts/BarChart/index.d.ts +2 -1
  193. package/types/src/charts/Geomap/applyLayout.d.ts +9 -1
  194. package/types/src/charts/Histogram/binData.d.ts +37 -0
  195. package/types/src/charts/Histogram/index.d.ts +14 -0
  196. package/types/src/charts/Network/applyLayout.d.ts +8 -0
  197. package/types/src/charts/Plot/discreteSpan.d.ts +9 -0
  198. package/types/src/charts/Plot/index.d.ts +39 -0
  199. package/types/src/charts/Plot/pipeline.d.ts +14 -0
  200. package/types/src/charts/Plot/sharedHover.d.ts +79 -0
  201. package/types/src/charts/Plot/sharedHoverScene.d.ts +11 -0
  202. package/types/src/charts/Plot/sharedTooltip.d.ts +26 -0
  203. package/types/src/charts/Plot/stackShareLabels.d.ts +21 -0
  204. package/types/src/charts/Plot/stackShareTooltip.d.ts +9 -0
  205. package/types/src/charts/Plot/trendLines.d.ts +70 -0
  206. package/types/src/charts/Plot/trendScene.d.ts +18 -0
  207. package/types/src/charts/Plot/trendTooltip.d.ts +19 -0
  208. package/types/src/charts/Rings/applyLayout.d.ts +9 -0
  209. package/types/src/charts/Rings/ringsSizing.d.ts +49 -0
  210. package/types/src/charts/StackedArea/index.d.ts +2 -1
  211. package/types/src/charts/definition/ChartDefinition.d.ts +30 -0
  212. package/types/src/charts/definition/makeChart.d.ts +2 -1
  213. package/types/src/charts/drawSteps/bottomRightControls.d.ts +26 -0
  214. package/types/src/charts/drawSteps/bottomRightControlsMarkup.d.ts +108 -0
  215. package/types/src/charts/features/emitHelpers.d.ts +8 -0
  216. package/types/src/charts/features/plotPaint.d.ts +25 -0
  217. package/types/src/charts/index.d.ts +1 -0
  218. package/types/src/charts/pipeline/drillMorph.d.ts +29 -0
  219. package/types/src/charts/pipeline/runVizPipeline.d.ts +8 -0
  220. package/types/src/charts/viz/Viz.d.ts +18 -1
  221. package/types/src/charts/viz/VizBase.d.ts +13 -0
  222. package/types/src/charts/viz/VizBaseConfig.d.ts +5 -1
  223. package/types/src/charts/viz/vizTypes.d.ts +147 -3
  224. package/types/src/charts/viz/vizVisibility.d.ts +34 -0
  225. package/types/src/components/Legend/legendRender.d.ts +8 -2
  226. package/types/src/components/SizeLegend/SizeLegend.d.ts +107 -0
  227. package/types/src/components/SizeLegend/sizeLegendLayout.d.ts +101 -0
  228. package/types/src/components/Tooltip.d.ts +18 -3
  229. package/types/src/components/index.d.ts +1 -0
  230. package/types/src/shapes/validateShapeConfig.d.ts +10 -0
  231. package/types/src/utils/BaseClass.d.ts +15 -1
  232. package/types/src/utils/D3plusConfig.d.ts +98 -0
  233. package/types/src/utils/configDefault.d.ts +11 -0
  234. package/types/src/utils/configWarnings.d.ts +28 -0
  235. package/types/src/utils/index.d.ts +2 -1
  236. package/umd/d3plus-core.full.js +7104 -2602
  237. package/umd/d3plus-core.full.js.map +1 -1
  238. package/umd/d3plus-core.full.min.js +2860 -1583
  239. package/umd/d3plus-core.js +3682 -441
  240. package/umd/d3plus-core.js.map +1 -1
  241. package/umd/d3plus-core.min.js +1656 -719
@@ -0,0 +1,26 @@
1
+ import type { FeatureModule } from "../features/features.js";
2
+ import type { VizInstance } from "../viz/vizTypes.js";
3
+ import type { BottomRightContribution } from "./bottomRightControlsMarkup.js";
4
+ /** The chart area a contribution may size itself against, before layout. */
5
+ export interface BottomRightAvailable {
6
+ width: number;
7
+ height: number;
8
+ }
9
+ /**
10
+ The size legend's contribution: sized from the chart's pre-layout scale
11
+ estimate, painted from the scale the chart's layout actually drew with.
12
+ */
13
+ export declare function sizeLegendContribution(viz: VizInstance, available: BottomRightAvailable): BottomRightContribution | null;
14
+ /**
15
+ Ordered contributors to the bottom-right panel, right to left.
16
+ */
17
+ export declare const BOTTOM_RIGHT_CONTRIBUTORS: Array<(viz: VizInstance, available: BottomRightAvailable) => BottomRightContribution | null>;
18
+ /**
19
+ Measures the panel for this draw and stores it on `viz._bottomRightBox`
20
+ (null when nothing contributes). `bottom` is how far above the chart's
21
+ bottom edge the panel sits (below it: the timeline); `available` is the
22
+ chart area left after the claims made so far. `sizeLegendPosition`
23
+ picks the margin it claims (see `BottomRightBox.side`).
24
+ */
25
+ export declare function reserveBottomRight(viz: VizInstance, bottom: number, available: BottomRightAvailable): void;
26
+ export declare const bottomRightControlsFeature: FeatureModule;
@@ -0,0 +1,108 @@
1
+ /**
2
+ Layout for the bottom-right corner panel — the bottom-corner counterpart
3
+ of the top-right zoom-control panel. Its items (the size legend, today)
4
+ are scene nodes rather than HTML, so the panel exports with the chart.
5
+
6
+ The panel is measured before the chart lays out (`reserveBottomRight`,
7
+ called from `vizDrawPure`), and the result is stored on
8
+ `viz._bottomRightBox` so content sharing the bottom band (a bottom
9
+ legend or colorScale) can inset around it via `bottomRightControlsInset`,
10
+ and content in the right column can stop short of it via
11
+ `bottomRightControlsDrop`. It paints after the chart lays out
12
+ (`bottomRightControlsFeature`), from each item's final state.
13
+
14
+ Kept separate from `bottomRightControls.ts` (the `FeatureModule` + the
15
+ contributor list) so the legend/colorScale features can import the inset
16
+ helpers without depending on the contributors.
17
+
18
+ @module
19
+ */
20
+ import type { SceneNode } from "@d3plus/render";
21
+ import type { VizInstance } from "../viz/vizTypes.js";
22
+ /**
23
+ One item's contribution to the bottom-right panel: its size as reserved
24
+ before layout, and a `paint` that builds its scene after layout (its
25
+ top-left at the origin) along with the size it actually drew at, which
26
+ must not exceed the reservation. `zoom` is the scale the chart's picture
27
+ is currently zoomed by (1 unzoomed; charts that zoom by rescaling axes,
28
+ like Plot, always paint at 1).
29
+ */
30
+ export interface BottomRightContribution {
31
+ key: string;
32
+ width: number;
33
+ height: number;
34
+ paint: (zoom: number) => {
35
+ node: SceneNode;
36
+ width: number;
37
+ height: number;
38
+ } | null;
39
+ }
40
+ /** The measured panel, as stored on `viz._bottomRightBox`. */
41
+ export interface BottomRightBox {
42
+ width: number;
43
+ height: number;
44
+ /** Offset of the panel's bottom edge from the chart's bottom edge (the timeline sits below it). */
45
+ bottom: number;
46
+ /**
47
+ The margin the panel claims: `"right"` widens the right margin so the
48
+ chart body ends left of it (it shares the right column, below any
49
+ right legend/colorScale); `"bottom"` deepens the bottom margin so the
50
+ body ends above it (bottom legends/colorScales sit beside it).
51
+ */
52
+ side: "right" | "bottom";
53
+ items: BottomRightContribution[];
54
+ }
55
+ /** Horizontal gap between items, and between the panel and content inset around it. */
56
+ export declare const BOTTOM_RIGHT_GAP = 6;
57
+ /** Lays contributions out in a row, right to left: the panel's total width and height. */
58
+ export declare function measureBottomRight(items: BottomRightContribution[]): {
59
+ width: number;
60
+ height: number;
61
+ };
62
+ /** The panel reserved for this draw, or null when nothing is showing there. */
63
+ export declare function bottomRightControlsBox(viz: VizInstance): BottomRightBox | null;
64
+ /**
65
+ How far content in the bottom band must pull in its right edge to clear
66
+ the panel: content whose bottom edge sits `bottom` px above the chart's
67
+ bottom edge and whose right edge sits `right` px in from the chart's
68
+ right edge. Zero when nothing is showing or the content starts above the
69
+ panel.
70
+ */
71
+ export declare function bottomRightControlsInset(viz: VizInstance, bottom: number, right: number): number;
72
+ /**
73
+ How much content in the right column, whose bottom edge sits `bottom` px
74
+ above the chart's bottom edge, must shorten to end above the panel. Zero
75
+ when nothing is showing.
76
+ */
77
+ export declare function bottomRightControlsDrop(viz: VizInstance, bottom: number): number;
78
+ /**
79
+ How a legend or colorScale at `position` clears the panel: a bottom one
80
+ pulls its right edge in by `inset`, a left/right one shortens by `drop`.
81
+ `bottom`/`right` are its edges' distances from the chart's bottom/right.
82
+ */
83
+ export declare function bottomRightClearance(viz: VizInstance, position: string | false, bottom: number, right: number): {
84
+ inset: number;
85
+ drop: number;
86
+ };
87
+ /**
88
+ How much taller the bottom margin must grow so the chart body, ending
89
+ `bottom` px above the chart's bottom edge, stays clear of a bottom-side
90
+ panel. Zero for a right-side panel.
91
+ */
92
+ export declare function bottomRightControlsShortfall(viz: VizInstance, bottom: number): number;
93
+ /**
94
+ How much wider the right margin must grow so the chart body, ending
95
+ `right` px in from the chart's right edge, stays clear of a right-side
96
+ panel. Zero for a bottom-side panel.
97
+ */
98
+ export declare function bottomRightControlsRightShortfall(viz: VizInstance, right: number): number;
99
+ /**
100
+ The panel's scene: each item painted from its final state, bottom-right
101
+ aligned in the slot it reserved. Null when nothing paints.
102
+ */
103
+ export declare function buildBottomRightPanel(viz: VizInstance, box: BottomRightBox): SceneNode | null;
104
+ /**
105
+ Repaints the panel in place for the current zoom — called on every zoom
106
+ event, which repaints the scene without re-running the pipeline.
107
+ */
108
+ export declare function refreshBottomRightPanel(viz: VizInstance): void;
@@ -97,6 +97,14 @@ export declare function drawNodeLabel(viz: {
97
97
  uses `"edge"` instead.
98
98
  */
99
99
  export declare function shapeConfigFor(viz: VizLike, shapeKey: string, config?: Record<string, unknown>, kind?: string): Record<string, unknown>;
100
+ /**
101
+ The user's label config for one shape kind — `shapeConfig.labelConfig`
102
+ overlaid with `shapeConfig[shapeKey].labelConfig`, data-wrapped the same
103
+ way the Shape path wraps it. Spread it over a chart's own label defaults so
104
+ user settings (including `fontFamily()`) win. Library-seeded defaults are
105
+ left out so they don't override the chart's.
106
+ */
107
+ export declare function userLabelConfig(viz: VizLike, shapeKey: string): Record<string, unknown>;
100
108
  /**
101
109
  Run `shape.render()` in compute mode and collect the resulting scene
102
110
  nodes — shape children and/or label children — in a single flat array.
@@ -13,6 +13,7 @@
13
13
  import type { DataPoint } from "@d3plus/data";
14
14
  import type { ClipShape, SceneNode } from "@d3plus/render";
15
15
  import type Axis from "../../components/Axis/Axis.js";
16
+ import * as shapes from "../../shapes/index.js";
16
17
  import type { VizInstance as Viz } from "../viz/vizTypes.js";
17
18
  /** An axis position function: maps a domain value to a pixel coordinate. */
18
19
  export type PlotAxisFn = (d: unknown, axis?: string) => number;
@@ -52,6 +53,12 @@ export interface PlotDatum {
52
53
  hci?: number;
53
54
  [key: string]: unknown;
54
55
  }
56
+ /** A user annotation: a shape key plus its config, optionally z-layered. */
57
+ export interface Annotation {
58
+ shape: string;
59
+ layer?: string;
60
+ [key: string]: unknown;
61
+ }
55
62
  /**
56
63
  Cross-phase locals threaded from `Plot._draw` (and its extracted pipeline
57
64
  stages) into `plotPaint` — the contract any consumer of `plotPaint` must
@@ -209,6 +216,24 @@ export interface PlotMeasureResult {
209
216
  yOffset: number;
210
217
  labelPositions: Record<string, number>;
211
218
  }
219
+ /**
220
+ Wraps one annotation's scene in its OWN stable-keyed group, keeping the
221
+ shape's node group and label group as distinct sub-groups (rather than
222
+ flattening them into the chart-cell siblings, as `collectComputed` would).
223
+
224
+ The per-annotation `key` scopes the renderer's keyed join: ids reused
225
+ across different annotation shapes (e.g. "curve-mask" on both a Circle and
226
+ a Rect) no longer collide into one sibling list, so each annotation's nodes
227
+ match old→new by id frame-to-frame and TWEEN instead of exit/entering. The
228
+ subtree is marked inert (annotations never show tooltips).
229
+ */
230
+ export declare function collectAnnotationGroup(inst: shapes.Shape, key: string): SceneNode | null;
231
+ /**
232
+ Renders one annotation in compute mode: the annotation's own config, with
233
+ positions mapped from data space through the plot's axis functions — the
234
+ same mapping user `annotations` get.
235
+ */
236
+ export declare function renderPlotAnnotation(viz: Viz, annotation: Annotation, x: PlotAxisFn, y: PlotAxisFn, domains: Record<string, unknown[]>, yOffset: number): shapes.Shape;
212
237
  /**
213
238
  EMIT phase of plotPaint. Takes the `PlotMeasureResult` from
214
239
  `renderAxes` and produces ALL the scene nodes: background rect,
@@ -5,6 +5,7 @@ export { default as BumpChart } from "./BumpChart/index.js";
5
5
  export { default as Chord } from "./Chord/index.js";
6
6
  export { default as Donut } from "./Donut/index.js";
7
7
  export { default as Geomap } from "./Geomap/index.js";
8
+ export { default as Histogram } from "./Histogram/index.js";
8
9
  export { default as LinePlot } from "./LinePlot/index.js";
9
10
  export { default as Matrix } from "./Matrix/index.js";
10
11
  export { default as Network } from "./Network/index.js";
@@ -0,0 +1,29 @@
1
+ /**
2
+ `resolveDrillMorph(viz)` — resolves the one-shot drill-down morph state
3
+ armed by `clickShape`'s forward capture or a Back click's reunion lookup
4
+ (see `events/click.shape.ts`, `viz/vizDefaults.ts`, `viz/Viz.ts`) into the
5
+ `_resolvedEnterFrom`/`_resolvedExitTo` boxes `_drawSceneToTarget` passes to
6
+ `drawScene`, using the *current* draw's `_bodyRect`/`_chartScene` — the
7
+ ones the layout/paint step just produced.
8
+
9
+ Chart-family-agnostic: every emitted rect/circle node already carries
10
+ `.datum`/`.index` (Treemap/Pack hand-built, or Plot's Shape-based), so the
11
+ Back-click reunion lookup needs no per-chart code — beyond unwrapping the
12
+ datum the same way every other interaction handler does (see
13
+ `unwrapDatum` below). Call once per draw, after `_draw()`/post-draw
14
+ features and before `_drawSceneToTarget()` (`runVizPipeline`) — by then
15
+ `_bodyRect`/`_chartScene` reflect the new frame, and both pending fields
16
+ are cleared unconditionally so a later, unrelated repaint (hover, resize,
17
+ legend toggle) never inherits a stale morph.
18
+ */
19
+ import type { SceneNode, TransitionRect } from "@d3plus/render";
20
+ import type { VizInstance as Viz } from "../viz/vizTypes.js";
21
+ /**
22
+ A flip-eligible node's geometry as a plain bounding box — every type
23
+ `isFlipEligible` (render package) approves: rect, circle, the `AreaNode`
24
+ type, and a `path` node stamped `shapeType: "Area"` (StackedArea/
25
+ AreaPlot's actual band representation). Shared with `click.shape.ts`'s
26
+ forward capture, which needs the identical conversion for the clicked node.
27
+ */
28
+ export declare function nodeRect(node: SceneNode): TransitionRect | null;
29
+ export declare function resolveDrillMorph(viz: Viz): void;
@@ -17,6 +17,7 @@
17
17
  3. `zoomControls(viz)` — zoom HTML overlay (architectural carve-out)
18
18
  4. `minimapFeature.layout(viz)` — zoomed-chart viewport indicator
19
19
  5. `topLeftControlsFeature.layout(viz)` — back/table-view/search panel
20
+ 5b. `bottomRightControlsFeature.layout(viz)` — size-legend corner panel
20
21
  6. `attributionFeature.layout(viz)` — bottom-right attribution panel
21
22
  7. `tableViewFeature.layout(viz)` — chart-sized data-table overlay
22
23
  8. `viz._drawSceneToTarget()` — paint scene via SvgRenderer/CanvasRenderer
@@ -32,3 +33,10 @@
32
33
  */
33
34
  import type { VizInstance as Viz } from "../viz/vizTypes.js";
34
35
  export declare function runVizPipeline(viz: Viz): void;
36
+ /**
37
+ Runs the post-draw features (see above) and appends their panels. Anything
38
+ that re-runs `viz._draw()` outside this pipeline — Rings re-centering on a
39
+ click, say — must call this after it: `_draw()` resets the feature panels,
40
+ so skipping it drops the corner controls, size legend, and attribution.
41
+ */
42
+ export declare function runPostDrawFeatures(viz: Viz): void;
@@ -1,6 +1,7 @@
1
1
  import type { DataPoint } from "@d3plus/data";
2
2
  import type { PickResult, Renderer, Scene, SceneEvent } from "@d3plus/render";
3
3
  import VizBase from "./VizBase.js";
4
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
4
5
  /**
5
6
  Creates an x/y plot based on an array of data. See [this example](https://d3plus.org/examples/d3plus-treemap/getting-started/) for help getting started using the treemap generator.
6
7
  */
@@ -30,6 +31,15 @@ export default class Viz extends VizBase {
30
31
  @private
31
32
  */
32
33
  _draw(): void;
34
+ /**
35
+ The chart's size-legend radius scale (see `ChartDefinition.sizeLegendScale`).
36
+ Charts that size marks override this; the base chart sizes nothing.
37
+ @private
38
+ */
39
+ _sizeLegendScale(_available: {
40
+ width: number;
41
+ height: number;
42
+ }): SizeLegendScale | null;
33
43
  /**
34
44
  * Applies the threshold algorithm according to the type of chart used.
35
45
  * @param {Array} data The data to process.
@@ -113,6 +123,13 @@ export default class Viz extends VizBase {
113
123
  i: number;
114
124
  x: unknown;
115
125
  };
126
+ /**
127
+ Pointer hook run by `_routeSceneEvent` before any handler routing, for
128
+ every event including ones over empty space. No-op here; Plot overrides
129
+ it to drive the shared multi-series tooltip and crosshair.
130
+ @private
131
+ */
132
+ _sharedHover(_event: SceneEvent): void;
116
133
  /**
117
134
  Routes a renderer pointer event to the matching `viz.schema.on` handlers.
118
135
  Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where
@@ -135,7 +152,7 @@ export default class Viz extends VizBase {
135
152
  */
136
153
  _scheduleSceneRepaint(): void;
137
154
  /**
138
- Tears down the visualization: disconnects the ResizeObserver and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
155
+ Tears down the visualization: disconnects the ResizeObserver, stops listening for web font loads, and removes DOM event listeners. Call this when unmounting to avoid memory leaks.
139
156
  */
140
157
  destroy(): this;
141
158
  }
@@ -2,6 +2,7 @@ import { select } from "d3-selection";
2
2
  import type { DataPoint } from "@d3plus/data";
3
3
  import type { D3plusConfig } from "../../utils/index.js";
4
4
  import type { ZoomControlIcons } from "../drawSteps/zoomControlsMarkup.js";
5
+ import type { SizeLegendScale, SizeLegendSize } from "../../components/SizeLegend/sizeLegendLayout.js";
5
6
  import VizBaseConfig from "./VizBaseConfig.js";
6
7
  /**
7
8
  Second half of the fluent config accessors shared by every Viz chart
@@ -102,6 +103,18 @@ export default class VizBase extends VizBaseConfig {
102
103
  */
103
104
  shapeConfig(): D3plusConfig;
104
105
  shapeConfig(_: D3plusConfig): this;
106
+ /**
107
+ Whether to display the size legend: a nested-circle key, in the chart's bottom-right corner, for charts that size their marks with a `size` accessor (bubble plots, Geomap points via `pointSize`, Network, Rings). By default it shows whenever marks are sized by more than one value, unless it would take up more than a third of the chart's width or height. Pass `true` to always show it, `false` to hide it, or a function that receives the resolved chart config, the radius scale, and the legend's measured `{width, height, availableWidth, availableHeight}`, and returns a boolean.
108
+ */
109
+ sizeLegend(_?: boolean | ((config: Record<string, unknown>, scale: SizeLegendScale, size: SizeLegendSize) => boolean)): this | boolean | ((config: Record<string, unknown>, scale: SizeLegendScale, size: SizeLegendSize) => boolean);
110
+ /**
111
+ Configuration object passed to the size legend's config method: `values` (an array of values to draw, or how many to pick), `tickFormat`, `title` (defaults to the `size` key when `size` is set to a string), `shapeConfig`, `lineConfig`, `labelConfig`, `titleConfig`, `padding`, `lineLength`, and `labelPadding`.
112
+ */
113
+ sizeLegendConfig(_?: Record<string, unknown>): this | Record<string, unknown>;
114
+ /**
115
+ Which margin the size legend claims in the chart's bottom-right corner. `"right"` (the default) widens the right margin, so the chart keeps its full height and the legend sits at the bottom of the right column, below any right-side legend or colorScale. `"bottom"` deepens the bottom margin instead, so the chart keeps its full width and any bottom legend or colorScale narrows to sit beside it.
116
+ */
117
+ sizeLegendPosition(_?: "right" | "bottom"): this | "right" | "bottom";
105
118
  /**
106
119
  Accessor function or string for the visualization's subtitle.
107
120
  */
@@ -99,9 +99,13 @@ export default class VizBaseConfig extends BaseClass {
99
99
  */
100
100
  detectVisible(_?: boolean): this | boolean;
101
101
  /**
102
- The interval, in milliseconds, for checking if the visualization is visible on the page.
102
+ The interval, in milliseconds, for checking if the visualization is visible on the page. When `detectVisible` defers a render until the visualization scrolls into view, this is also how long it must stay in view before it renders, so visualizations scrolled past quickly are never drawn.
103
103
  */
104
104
  detectVisibleInterval(_?: number): this | number;
105
+ /**
106
+ When `true` (the default) and `detectVisible` is enabled, the Viz releases its DOM and scene while it is scrolled out of view and redraws when it returns, keeping the page light when there are many visualizations. Data and configuration are retained; interaction state such as zoom or selection is not, so set this to `false` to keep it. With `detectVisible` enabled, each chart's `<svg>` is also given `content-visibility: auto`, so the browser skips rendering its contents while it is far off-screen (this matters most when this is `false` and charts are kept). For a larger saving you can also apply `content-visibility: auto` and a `contain-intrinsic-size` to the container element yourself; that adds paint containment to an element you own, so it is not done automatically. Requires `IntersectionObserver`.
107
+ */
108
+ detectVisibleUnload(_?: boolean): this | boolean;
105
109
  /**
106
110
  Shows a button that allows for downloading the current visualization.
107
111
  */
@@ -21,11 +21,14 @@
21
21
  @module
22
22
  */
23
23
  import type { PlotZoomBase, ZoomState } from "../Plot/plotZoom.js";
24
+ import type { TrendFit, TrendLineType } from "../Plot/trendLines.js";
24
25
  import type { ZoomControlIconKey } from "../drawSteps/zoomControlsMarkup.js";
26
+ import type { BottomRightBox } from "../drawSteps/bottomRightControlsMarkup.js";
25
27
  import type { ZoomTransform } from "d3-zoom";
26
28
  import type { DataPoint } from "@d3plus/data";
27
- import type { ClipShape, SceneNode, Transform } from "@d3plus/render";
28
- import type { Axis, ColorScale, Legend, Message, TextBox, Timeline, Tooltip } from "../../components/index.js";
29
+ import type { ClipShape, SceneNode, Transform, TransitionRect } from "@d3plus/render";
30
+ import type { Axis, ColorScale, Legend, Message, SizeLegend, TextBox, Timeline, Tooltip } from "../../components/index.js";
31
+ import type { SizeLegendScale } from "../../components/SizeLegend/sizeLegendLayout.js";
29
32
  import type Shape from "../../shapes/Shape.js";
30
33
  import type { D3plusConfig, D3Scale } from "../../utils/index.js";
31
34
  import type { PlotPaintContext } from "../features/plotPaint.js";
@@ -43,6 +46,15 @@ export interface Padding {
43
46
  left: number;
44
47
  right: number;
45
48
  }
49
+ /** One entry on the drill-down history stack (`Viz._history`), pushed by a click.shape drill-down and popped by Back. */
50
+ export interface DrillDownHistoryEntry {
51
+ depth: number;
52
+ filter?: (d: DataPoint, i: number) => boolean;
53
+ /** `groupBy[groupDepth]`'s value for the clicked node — identifies the reunion node the Back morph grows back into. */
54
+ groupId?: unknown;
55
+ /** The groupBy index `groupId` was read at (== `_drawDepth` when the node was clicked). */
56
+ groupDepth?: number;
57
+ }
46
58
  /**
47
59
  D3-style selection — deliberately loose. d3-selection's element/datum
48
60
  generics are invariant, so a single typed alias can't accept every
@@ -116,6 +128,8 @@ export interface VizInstance {
116
128
  _y2?: (d: DataPoint, i: number) => number | Date | string;
117
129
  _shape: (d: DataPoint, i: number) => string;
118
130
  _size?: (d: DataPoint, i?: number) => number;
131
+ /** The data key `size` was set to, when it was set with a string; the size legend's default title. */
132
+ _sizeKey?: string;
119
133
  _value?: (d: DataPoint, i: number) => number;
120
134
  _time?: (d: DataPoint, i: number) => string | number | Date;
121
135
  _sort?: ((a: DataPoint, b: DataPoint) => number) | null;
@@ -179,6 +193,8 @@ export interface VizInstance {
179
193
  _searchMatchIndex?: number;
180
194
  _ordinalColorScale?: ((value: string) => string) | undefined;
181
195
  _hoverDatum?: DataPoint | null;
196
+ /** Epoch ms until which an animated transition is in flight (pointer routing pauses). */
197
+ _transitionEndsAt?: number;
182
198
  _userHover?: number;
183
199
  _userDuration?: number;
184
200
  _dataCutoff: number;
@@ -207,7 +223,80 @@ export interface VizInstance {
207
223
  /** The user-set data, retained to detect changes across `.data()` calls. */
208
224
  _userData?: DataPoint[] | string;
209
225
  /** Drill-down history stack (back button). */
210
- _history?: DataPoint[];
226
+ _history?: DrillDownHistoryEntry[];
227
+ /**
228
+ The local, chart-family-defined "body rect" flip-morph fractions are
229
+ measured against — e.g. Treemap/Pack's margin-adjusted chart area at
230
+ local origin, or Plot's measured axis plot rect. Set by `runChartDraw`
231
+ (via `ChartDefinition.chartBodyRect`) or by Plot's own paint pipeline.
232
+ */
233
+ _bodyRect?: {
234
+ x: number;
235
+ y: number;
236
+ width: number;
237
+ height: number;
238
+ };
239
+ /**
240
+ One-shot: the clicked node's rect, captured at click time and
241
+ normalized as fractions of the *pre-click* `_bodyRect`, armed by
242
+ `clickShape`. Resolved into `_resolvedEnterFrom` (against the *new*
243
+ draw's `_bodyRect`) and cleared by `resolveDrillMorph`. Also carries:
244
+ `key`, the clicked node's own scene key, resolved into
245
+ `_resolvedInstantExitKey` so its own exit (now filtered out of the new
246
+ scene) is removed instantly instead of animating on top of the
247
+ children that replace it; and, when the clicked node carried them
248
+ (currently only Pie/Donut wedges), `parentStartAngle`/`parentEndAngle`
249
+ — its angular range, read by the next draw's `pieEmit` to build each
250
+ entering child wedge's `flipFromArc` (a real arc confined within that
251
+ range, at full radius) via the actual arc generator.
252
+ */
253
+ _pendingEnterOrigin?: {
254
+ fx: number;
255
+ fy: number;
256
+ fw: number;
257
+ fh: number;
258
+ key?: string | number;
259
+ parentStartAngle?: number;
260
+ parentEndAngle?: number;
261
+ };
262
+ /**
263
+ One-shot: the group id/depth being un-filtered by a Back click, armed by
264
+ the two Back-click sites — plus the OLD (pre-render) `_bodyRect`,
265
+ captured at the same moment, so the exiting siblings' own (frozen)
266
+ geometry can be read as proportions of the frame they were actually
267
+ laid out in. Resolved into `_resolvedExitTo`/`_resolvedExitToBody` (by
268
+ finding the matching node in the *new* `_chartScene`) and cleared by
269
+ `resolveDrillMorph`.
270
+ */
271
+ _pendingExitReunion?: {
272
+ groupId: unknown;
273
+ groupDepth: number;
274
+ body?: {
275
+ x: number;
276
+ y: number;
277
+ width: number;
278
+ height: number;
279
+ };
280
+ };
281
+ /**
282
+ The drill-down morph's resolved enter/exit boxes for the upcoming
283
+ `drawScene` call, plus each one's "body" reference box (the full
284
+ layout entering/exiting nodes' own geometry is proportional within —
285
+ see `DrawOptions.enterFromBody`/`exitToBody`). Set by
286
+ `resolveDrillMorph`, read and one-shot cleared by `_drawSceneToTarget`.
287
+ */
288
+ _resolvedEnterFrom?: TransitionRect;
289
+ _resolvedEnterFromBody?: TransitionRect;
290
+ _resolvedExitTo?: TransitionRect;
291
+ _resolvedExitToBody?: TransitionRect;
292
+ /** See `DrawOptions.instantExitKey` — the clicked node's own key, resolved from `_pendingEnterOrigin.key`. */
293
+ _resolvedInstantExitKey?: string | number;
294
+ /** See `DrawOptions.reunionEnterKey` — the Back click's reunion node's own key, resolved when `resolveDrillMorph` finds a match. */
295
+ _resolvedReunionEnterKey?: string | number;
296
+ /** See `DrawOptions.reunionEnterFrom` — the OLD (pre-Back) body rect, the full size the reunion node's former children occupied. */
297
+ _resolvedReunionEnterFrom?: TransitionRect;
298
+ /** See `DrawOptions.instantExitAll` — set alongside `_resolvedReunionEnterKey`, when a reunion match was found. */
299
+ _resolvedInstantExitAll?: boolean;
211
300
  /** Cached measured size of the shared top-left controls panel (back/table-view/search). `measurement` is `topLeftControlsMarkup.ts`-internal (per-item positions); `signature` is the cache key (each contribution's html + resolved style). */
212
301
  _topLeftControlsBox?: {
213
302
  width: number;
@@ -219,10 +308,53 @@ export interface VizInstance {
219
308
  _yAxis?: Axis;
220
309
  _x2Axis?: Axis;
221
310
  _y2Axis?: Axis;
311
+ /** The x/y data keys, when set by string (Plot's default axis titles). */
312
+ _xKey?: string;
313
+ _yKey?: string;
222
314
  _xFunc?: (d: DataPoint, axis?: string) => number;
223
315
  _yFunc?: (d: DataPoint, axis?: string) => number;
316
+ /** The plot area (inside the axes) in chart content space, set by the paint phase. */
317
+ _plotArea?: {
318
+ x: number;
319
+ y: number;
320
+ width: number;
321
+ height: number;
322
+ };
323
+ /** Crosshair guide-line paint for the shared tooltip. */
324
+ _crosshairConfig?: Record<string, unknown>;
325
+ /**
326
+ The active shared-tooltip hover, if any: the snapped discrete position
327
+ (pixel + data value), the hovered Line points to mark, and which side of
328
+ the marks the crosshair draws on.
329
+ */
330
+ _sharedHoverState?: {
331
+ mode: "shared" | "single";
332
+ axis: "x" | "y";
333
+ px: number;
334
+ value: unknown;
335
+ markers: {
336
+ datum: DataPoint;
337
+ x: number;
338
+ y: number;
339
+ }[];
340
+ layer: "back" | "front";
341
+ } | null;
342
+ /** True while the shared multi-series tooltip owns the tooltip. */
343
+ _sharedHoverActive?: boolean;
344
+ /** The tooltip's own `arrow`/`thead`/`tbody`, held while the shared tooltip replaces them. */
345
+ _sharedTooltipSaved?: {
346
+ arrow: unknown;
347
+ thead: unknown;
348
+ tbody: unknown;
349
+ };
224
350
  /** Internal size scale built in Plot's pipeline; maps `_size` → pixel radius. */
225
351
  _sizeScaleD3?: D3Scale;
352
+ /** The radius scale the chart's layout actually drew with; the size legend paints from it. Null when nothing is sized. */
353
+ _sizeLegendFinal?: SizeLegendScale | null;
354
+ /** Size-legend component, rendered in the bottom-right corner panel. */
355
+ _sizeLegendClass?: SizeLegend;
356
+ /** The bottom-right corner panel reserved in `vizDrawPure` for this draw (see `bottomRightControlsMarkup.ts`). */
357
+ _bottomRightBox?: BottomRightBox | null;
226
358
  /** Per-axis "is this axis time-valued" flags, set by `formatPlotData`. */
227
359
  _xTime?: boolean;
228
360
  _x2Time?: boolean;
@@ -244,9 +376,16 @@ export interface VizInstance {
244
376
  _labelConnectorConfig?: Record<string, unknown>;
245
377
  _lineMarkerConfig?: Record<string, unknown>;
246
378
  _confidenceConfig?: Record<string, unknown>;
379
+ /** The `trendLine` setting: a regression type, `true` (linear), or `false`. */
380
+ _trendLine?: TrendLineType;
381
+ _trendLineConfig?: Record<string, unknown>;
382
+ /** The trend lines fit by `computePlotTrendFits` for the current draw. */
383
+ _trendFits?: TrendFit[];
247
384
  _xCutoff?: number;
248
385
  _yCutoff?: number;
249
386
  _discreteCutoff?: number;
387
+ /** Per-datum `[start, end]` along the discrete axis; makes that axis continuous (see Plot/discreteSpan.ts). */
388
+ _discreteExtent?: (d: DataPoint) => [number, number];
250
389
  _buffer?: Record<string, unknown>;
251
390
  _legendClass?: Legend;
252
391
  _colorScaleClass?: ColorScale;
@@ -315,6 +454,11 @@ export interface VizInstance {
315
454
  _scheduleSceneRepaint(): void;
316
455
  _sceneRepaintRAF?: number;
317
456
  _thresholdFunction?(data: DataPoint[], tree?: unknown): DataPoint[];
457
+ /** The chart's size-legend radius scale, estimated before layout for the given chart area (see `ChartDefinition.sizeLegendScale`). */
458
+ _sizeLegendScale?(available: {
459
+ width: number;
460
+ height: number;
461
+ }): SizeLegendScale | null;
318
462
  toScene?(): SceneNode;
319
463
  config?(_?: D3plusConfig): D3plusConfig | this;
320
464
  active?(_?: unknown): unknown;
@@ -0,0 +1,34 @@
1
+ import type Viz from "./Viz.js";
2
+ /**
3
+ Whether viewport observation is available (false in JSDOM/SSR, where the
4
+ scroll-polling fallback in `vizRender` is used instead).
5
+ @private
6
+ */
7
+ export declare function canObserveVisibility(): boolean;
8
+ /**
9
+ Observes `el` against `scrollContainer` through one IntersectionObserver
10
+ shared by every viz using that root. `onVisible` runs once `el` has stayed in
11
+ view for `delay` ms, so elements scrolled past quickly never fire; leaving
12
+ view cancels the pending call and runs `onHidden`, if given. Returns a function
13
+ that stops observing.
14
+ @private
15
+ */
16
+ export declare function observeVisibility(el: Element, scrollContainer: unknown, onVisible: () => void, delay?: number, onHidden?: () => void): () => void;
17
+ /**
18
+ Releases a chart's DOM/scene while it is off-screen. The `<svg>` and its
19
+ size stay in place so the page doesn't reflow; data and config are kept, so
20
+ `vizReload` can redraw it without refetching.
21
+ @private
22
+ */
23
+ export declare function vizUnload(viz: Viz): void;
24
+ /**
25
+ Redraws an unloaded chart without an entrance animation.
26
+ @private
27
+ */
28
+ export declare function vizReload(viz: Viz): void;
29
+ /**
30
+ Installs (or removes) the persistent observer that unloads the chart when it
31
+ leaves the viewport and reloads it on return. Idempotent.
32
+ @private
33
+ */
34
+ export declare function syncUnloadObserver(viz: Viz): void;
@@ -5,9 +5,15 @@ export declare function measureLegendTitle(legend: Legend): void;
5
5
  export declare function computeLegendLineData(legend: Legend, availableHeight: number): Record<string, unknown>[];
6
6
  /**
7
7
  Runs the row-wrapping pass: builds rows, retries label-free if it overflows,
8
- then distributes row `y` offsets. Returns the resolved `spaceNeeded`.
8
+ then distributes row `y` offsets. Returns the widest row's width, or
9
+ `false` when even label-free swatches overflow the available space.
9
10
  */
10
- export declare function wrapLegendRows(legend: Legend, availableWidth: number, availableHeight: number, spaceNeeded: number): number;
11
+ export declare function wrapLegendRows(legend: Legend, availableWidth: number, availableHeight: number): number | false;
12
+ /**
13
+ Empties a legend whose swatches don't fit: no title, no shapes, and zero
14
+ outer bounds, so a parent chart claims no margin for it.
15
+ */
16
+ export declare function clearLegend(legend: Legend): void;
11
17
  /** Computes `_outerBounds` (size + aligned x/y offset) from the laid-out rows. */
12
18
  export declare function computeLegendBounds(legend: Legend, spaceNeeded: number): void;
13
19
  /** Renders the title TextBox into the legend's title group. */