@d3plus/core 4.2.0 → 4.5.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 (214) hide show
  1. package/README.md +2137 -953
  2. package/es/index.js +1 -1
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +7 -1
  5. package/es/internal.js.map +1 -1
  6. package/es/src/charts/AreaPlot/index.js +1 -2
  7. package/es/src/charts/AreaPlot/index.js.map +1 -1
  8. package/es/src/charts/BarChart/index.js +1 -2
  9. package/es/src/charts/BarChart/index.js.map +1 -1
  10. package/es/src/charts/BoxWhisker/index.js +1 -2
  11. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  12. package/es/src/charts/BumpChart/index.js +1 -2
  13. package/es/src/charts/BumpChart/index.js.map +1 -1
  14. package/es/src/charts/Chord/applyLayout.js +205 -0
  15. package/es/src/charts/Chord/applyLayout.js.map +1 -0
  16. package/es/src/charts/Chord/emit.js +168 -0
  17. package/es/src/charts/Chord/emit.js.map +1 -0
  18. package/es/src/charts/Chord/index.js +234 -0
  19. package/es/src/charts/Chord/index.js.map +1 -0
  20. package/es/src/charts/Geomap/basemapTheme.js +78 -0
  21. package/es/src/charts/Geomap/basemapTheme.js.map +1 -0
  22. package/es/src/charts/Geomap/emit.js +58 -9
  23. package/es/src/charts/Geomap/emit.js.map +1 -1
  24. package/es/src/charts/Geomap/index.js +93 -99
  25. package/es/src/charts/Geomap/index.js.map +1 -1
  26. package/es/src/charts/LinePlot/index.js +1 -2
  27. package/es/src/charts/LinePlot/index.js.map +1 -1
  28. package/es/src/charts/Matrix/emit.js +6 -0
  29. package/es/src/charts/Matrix/emit.js.map +1 -1
  30. package/es/src/charts/Matrix/index.js +1 -2
  31. package/es/src/charts/Matrix/index.js.map +1 -1
  32. package/es/src/charts/Network/emit.js +58 -24
  33. package/es/src/charts/Network/emit.js.map +1 -1
  34. package/es/src/charts/Network/index.js +34 -54
  35. package/es/src/charts/Network/index.js.map +1 -1
  36. package/es/src/charts/Pack/emit.js +3 -0
  37. package/es/src/charts/Pack/emit.js.map +1 -1
  38. package/es/src/charts/Pack/index.js +1 -2
  39. package/es/src/charts/Pack/index.js.map +1 -1
  40. package/es/src/charts/Pie/emit.js +6 -2
  41. package/es/src/charts/Pie/emit.js.map +1 -1
  42. package/es/src/charts/Pie/index.js +1 -2
  43. package/es/src/charts/Pie/index.js.map +1 -1
  44. package/es/src/charts/Plot/index.js +99 -4
  45. package/es/src/charts/Plot/index.js.map +1 -1
  46. package/es/src/charts/Plot/pipeline.js +25 -5
  47. package/es/src/charts/Plot/pipeline.js.map +1 -1
  48. package/es/src/charts/Plot/plotZoom.js +278 -0
  49. package/es/src/charts/Plot/plotZoom.js.map +1 -0
  50. package/es/src/charts/Priestley/emit.js +4 -0
  51. package/es/src/charts/Priestley/emit.js.map +1 -1
  52. package/es/src/charts/Priestley/index.js +1 -2
  53. package/es/src/charts/Priestley/index.js.map +1 -1
  54. package/es/src/charts/Radar/emit.js +4 -1
  55. package/es/src/charts/Radar/emit.js.map +1 -1
  56. package/es/src/charts/Radar/index.js +1 -2
  57. package/es/src/charts/Radar/index.js.map +1 -1
  58. package/es/src/charts/RadialMatrix/emit.js +6 -0
  59. package/es/src/charts/RadialMatrix/emit.js.map +1 -1
  60. package/es/src/charts/RadialMatrix/index.js +1 -2
  61. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  62. package/es/src/charts/Rings/emit.js +74 -8
  63. package/es/src/charts/Rings/emit.js.map +1 -1
  64. package/es/src/charts/Rings/index.js +11 -3
  65. package/es/src/charts/Rings/index.js.map +1 -1
  66. package/es/src/charts/Sankey/emit.js +55 -11
  67. package/es/src/charts/Sankey/emit.js.map +1 -1
  68. package/es/src/charts/Sankey/index.js +8 -2
  69. package/es/src/charts/Sankey/index.js.map +1 -1
  70. package/es/src/charts/StackedArea/index.js +1 -2
  71. package/es/src/charts/StackedArea/index.js.map +1 -1
  72. package/es/src/charts/Tree/emit.js +8 -2
  73. package/es/src/charts/Tree/emit.js.map +1 -1
  74. package/es/src/charts/Tree/index.js +1 -2
  75. package/es/src/charts/Tree/index.js.map +1 -1
  76. package/es/src/charts/Treemap/index.js +1 -2
  77. package/es/src/charts/Treemap/index.js.map +1 -1
  78. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  79. package/es/src/charts/drawSteps/backControl.js +70 -0
  80. package/es/src/charts/drawSteps/backControl.js.map +1 -0
  81. package/es/src/charts/drawSteps/controlButtonStyle.js +108 -0
  82. package/es/src/charts/drawSteps/controlButtonStyle.js.map +1 -0
  83. package/es/src/charts/drawSteps/minimap.js +370 -0
  84. package/es/src/charts/drawSteps/minimap.js.map +1 -0
  85. package/es/src/charts/drawSteps/minimapMarkup.js +147 -0
  86. package/es/src/charts/drawSteps/minimapMarkup.js.map +1 -0
  87. package/es/src/charts/drawSteps/searchControls.js +358 -0
  88. package/es/src/charts/drawSteps/searchControls.js.map +1 -0
  89. package/es/src/charts/drawSteps/searchControlsMarkup.js +430 -0
  90. package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -0
  91. package/es/src/charts/drawSteps/tableView.js +173 -0
  92. package/es/src/charts/drawSteps/tableView.js.map +1 -0
  93. package/es/src/charts/drawSteps/tableViewControl.js +39 -0
  94. package/es/src/charts/drawSteps/tableViewControl.js.map +1 -0
  95. package/es/src/charts/drawSteps/tableViewMarkup.js +647 -0
  96. package/es/src/charts/drawSteps/tableViewMarkup.js.map +1 -0
  97. package/es/src/charts/drawSteps/topLeftControls.js +73 -0
  98. package/es/src/charts/drawSteps/topLeftControls.js.map +1 -0
  99. package/es/src/charts/drawSteps/topLeftControlsMarkup.js +227 -0
  100. package/es/src/charts/drawSteps/topLeftControlsMarkup.js.map +1 -0
  101. package/es/src/charts/drawSteps/zoomControls.js +314 -175
  102. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  103. package/es/src/charts/drawSteps/zoomControlsMarkup.js +280 -0
  104. package/es/src/charts/drawSteps/zoomControlsMarkup.js.map +1 -0
  105. package/es/src/charts/features/attributionFeature.js +137 -0
  106. package/es/src/charts/features/attributionFeature.js.map +1 -0
  107. package/es/src/charts/features/axes.js +20 -8
  108. package/es/src/charts/features/axes.js.map +1 -1
  109. package/es/src/charts/features/chartGeometry.js +16 -2
  110. package/es/src/charts/features/chartGeometry.js.map +1 -1
  111. package/es/src/charts/features/edgeArrows.js +155 -0
  112. package/es/src/charts/features/edgeArrows.js.map +1 -0
  113. package/es/src/charts/features/emitHelpers.js +8 -0
  114. package/es/src/charts/features/emitHelpers.js.map +1 -1
  115. package/es/src/charts/features/ensureZoomDom.js +63 -12
  116. package/es/src/charts/features/ensureZoomDom.js.map +1 -1
  117. package/es/src/charts/features/features.js +83 -110
  118. package/es/src/charts/features/features.js.map +1 -1
  119. package/es/src/charts/features/featuresLegend.js +45 -17
  120. package/es/src/charts/features/featuresLegend.js.map +1 -1
  121. package/es/src/charts/features/plotPaint.js +32 -7
  122. package/es/src/charts/features/plotPaint.js.map +1 -1
  123. package/es/src/charts/features/shapeEmit.js +3 -1
  124. package/es/src/charts/features/shapeEmit.js.map +1 -1
  125. package/es/src/charts/features/zoomExtent.js +185 -0
  126. package/es/src/charts/features/zoomExtent.js.map +1 -0
  127. package/es/src/charts/helpers/tileAttributions.js +26 -0
  128. package/es/src/charts/helpers/tileAttributions.js.map +1 -1
  129. package/es/src/charts/index.js +1 -0
  130. package/es/src/charts/index.js.map +1 -1
  131. package/es/src/charts/pipeline/runVizPipeline.js +33 -14
  132. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  133. package/es/src/charts/pipeline/vizDrawPure.js +32 -6
  134. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  135. package/es/src/charts/viz/Viz.js +102 -61
  136. package/es/src/charts/viz/Viz.js.map +1 -1
  137. package/es/src/charts/viz/VizBase.js +157 -4
  138. package/es/src/charts/viz/VizBase.js.map +1 -1
  139. package/es/src/charts/viz/VizBaseConfig.js +32 -2
  140. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  141. package/es/src/charts/viz/interactionOpacity.js +4 -1
  142. package/es/src/charts/viz/interactionOpacity.js.map +1 -1
  143. package/es/src/charts/viz/vizDefaults.js +247 -51
  144. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  145. package/es/src/charts/viz/vizRender.js +7 -3
  146. package/es/src/charts/viz/vizRender.js.map +1 -1
  147. package/es/src/charts/viz/vizTypes.js.map +1 -1
  148. package/es/src/components/Axis/Axis.js +10 -1
  149. package/es/src/components/Axis/Axis.js.map +1 -1
  150. package/es/src/components/Axis/axisLayoutLabels.js +2 -1
  151. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
  152. package/es/src/components/Axis/axisRender.js +5 -1
  153. package/es/src/components/Axis/axisRender.js.map +1 -1
  154. package/es/src/components/Legend/legendConfig.js +86 -20
  155. package/es/src/components/Legend/legendConfig.js.map +1 -1
  156. package/es/src/shapes/Shape.js +12 -10
  157. package/es/src/shapes/Shape.js.map +1 -1
  158. package/es/src/shapes/hitAreaNode.js +31 -5
  159. package/es/src/shapes/hitAreaNode.js.map +1 -1
  160. package/es/src/shapes/interactionPoints.js +30 -0
  161. package/es/src/shapes/interactionPoints.js.map +1 -0
  162. package/es/src/utils/D3plusConfig.js.map +1 -1
  163. package/package.json +11 -10
  164. package/types/index.d.ts +1 -1
  165. package/types/internal.d.ts +8 -1
  166. package/types/src/charts/Chord/applyLayout.d.ts +43 -0
  167. package/types/src/charts/Chord/emit.d.ts +10 -0
  168. package/types/src/charts/Chord/index.d.ts +19 -0
  169. package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
  170. package/types/src/charts/Plot/index.d.ts +32 -2
  171. package/types/src/charts/Plot/pipeline.d.ts +2 -1
  172. package/types/src/charts/Plot/plotZoom.d.ts +65 -0
  173. package/types/src/charts/definition/ChartDefinition.d.ts +3 -1
  174. package/types/src/charts/drawSteps/backControl.d.ts +29 -0
  175. package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
  176. package/types/src/charts/drawSteps/minimap.d.ts +19 -0
  177. package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
  178. package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
  179. package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
  180. package/types/src/charts/drawSteps/tableView.d.ts +23 -0
  181. package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
  182. package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
  183. package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
  184. package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
  185. package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
  186. package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
  187. package/types/src/charts/features/attributionFeature.d.ts +21 -0
  188. package/types/src/charts/features/axes.d.ts +1 -1
  189. package/types/src/charts/features/chartGeometry.d.ts +9 -3
  190. package/types/src/charts/features/edgeArrows.d.ts +92 -0
  191. package/types/src/charts/features/emitHelpers.d.ts +11 -0
  192. package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
  193. package/types/src/charts/features/features.d.ts +32 -17
  194. package/types/src/charts/features/featuresLegend.d.ts +15 -0
  195. package/types/src/charts/features/plotPaint.d.ts +15 -2
  196. package/types/src/charts/features/zoomExtent.d.ts +25 -0
  197. package/types/src/charts/index.d.ts +1 -0
  198. package/types/src/charts/pipeline/runVizPipeline.d.ts +6 -3
  199. package/types/src/charts/viz/Viz.d.ts +31 -1
  200. package/types/src/charts/viz/VizBase.d.ts +86 -4
  201. package/types/src/charts/viz/VizBaseConfig.d.ts +20 -2
  202. package/types/src/charts/viz/vizDefaults.d.ts +155 -0
  203. package/types/src/charts/viz/vizTypes.d.ts +75 -1
  204. package/types/src/components/Axis/Axis.d.ts +2 -0
  205. package/types/src/shapes/Shape.d.ts +2 -2
  206. package/types/src/shapes/hitAreaNode.d.ts +5 -4
  207. package/types/src/shapes/interactionPoints.d.ts +15 -0
  208. package/types/src/utils/D3plusConfig.d.ts +102 -8
  209. package/umd/d3plus-core.full.js +39793 -34875
  210. package/umd/d3plus-core.full.js.map +1 -1
  211. package/umd/d3plus-core.full.min.js +5836 -4264
  212. package/umd/d3plus-core.js +13998 -9927
  213. package/umd/d3plus-core.js.map +1 -1
  214. package/umd/d3plus-core.min.js +3716 -2264
@@ -1,4 +1,159 @@
1
1
  import type Viz from "./Viz.js";
2
+ /**
3
+ Default inline style for the "← Back" button — structural-only, the
4
+ same properties `zoomControlStyleDefault`/`searchControlStyleDefault`
5
+ use, except `width: "auto"` (it shows an icon + the word "Back", not a
6
+ single centered glyph) with a small `gap` between them and horizontal
7
+ padding for breathing room. Also lighter/smaller than the other two's
8
+ `font` (900 15px): that value is a holdover from when their icons were
9
+ bold Unicode glyphs sized to read clearly (the icons are SVG now, so it
10
+ no longer affects THEM at all) — but back is the one place that font
11
+ actually renders visible text, where 900 15px reads oversized/heavy.
12
+ No background/border/color, same as the other two: a plain
13
+ browser-appearance button, letting native/host-page button chrome show
14
+ through by default.
15
+ @private
16
+ */
17
+ export declare const backControlStyleDefault: {
18
+ "align-items": string;
19
+ display: string;
20
+ font: string;
21
+ gap: string;
22
+ height: string;
23
+ "justify-content": string;
24
+ padding: string;
25
+ width: string;
26
+ };
27
+ export declare const attributionStyleDefault: {
28
+ background: string;
29
+ color: string;
30
+ "border-radius": string;
31
+ display: string;
32
+ "align-items": string;
33
+ gap: string;
34
+ font: string;
35
+ };
36
+ export declare const attributionStyleDarkDefault: {
37
+ background: string;
38
+ color: string;
39
+ "border-radius": string;
40
+ display: string;
41
+ "align-items": string;
42
+ gap: string;
43
+ font: string;
44
+ };
45
+ /**
46
+ Default inline styles for the zoom-control buttons — structural only
47
+ (sizing/spacing/typography); no color, background, border, or opacity.
48
+ Letting native/host-page button chrome show through by default means a
49
+ page styling its own buttons (Tailwind, Bootstrap, a design system) via
50
+ `zoomControlClassName` composes cleanly instead of fighting inline color
51
+ overrides. The active state (brush mode on) paints the OS accent color
52
+ through CSS system colors (`AccentColor`/`AccentColorText`, falling back
53
+ to the selection `Highlight` where unsupported), so it reads as pressed
54
+ in the browser's own idiom; hover gets no default styling (`false`). The
55
+ `.active` class, `aria-pressed`, and `:hover`/`:active` pseudo-classes
56
+ stay available for a host page's own CSS to hook into. Consumers who want d3plus's old
57
+ opinionated look can restore it via `.zoomControlStyle({...})`.
58
+
59
+ Exported as stable object references (not inlined per-instance) so
60
+ `zoomControls.ts` can tell, via `===`, whether a given viz's
61
+ `zoomControlStyle*` is still the untouched default — that's what lets
62
+ setting `zoomControlClassName` auto-disable the defaults without also
63
+ clobbering a style the caller explicitly customized themselves.
64
+ @private
65
+ */
66
+ export declare const zoomControlStyleDefault: {
67
+ "align-items": string;
68
+ display: string;
69
+ font: string;
70
+ height: string;
71
+ "justify-content": string;
72
+ padding: number;
73
+ width: string;
74
+ };
75
+ export declare const zoomControlStyleActiveDefault: {
76
+ "background-color": string;
77
+ "border-color": string;
78
+ color: string;
79
+ };
80
+ export declare const zoomControlStyleHoverDefault: false;
81
+ /**
82
+ Default inline styles for the table-view toggle button — structural only,
83
+ mirroring `zoomControlStyleDefault` et al. so the two chrome features look
84
+ and behave consistently. Kept as separate object references (not shared
85
+ with zoom's) so `tableViewControl.ts` can independently detect, via `===`,
86
+ whether `tableViewControlStyle*` is still untouched — the same
87
+ auto-disable-on-className trick `zoomControlClassName` uses.
88
+ */
89
+ export declare const tableViewControlStyleDefault: {
90
+ "align-items": string;
91
+ display: string;
92
+ font: string;
93
+ height: string;
94
+ "justify-content": string;
95
+ padding: number;
96
+ width: string;
97
+ };
98
+ export declare const tableViewControlStyleActiveDefault: {
99
+ "background-color": string;
100
+ "border-color": string;
101
+ color: string;
102
+ };
103
+ export declare const tableViewControlStyleHoverDefault: false;
104
+ /**
105
+ Default inline styles for the minimap — mirrors the zoom-control defaults'
106
+ own reasoning (structural/neutral, easy to override or auto-disable via
107
+ `minimapClassName`) and the same by-reference `===` trick that lets
108
+ setting `minimapClassName` auto-disable an untouched default without
109
+ clobbering a caller's own customization.
110
+ @private
111
+ */
112
+ export declare const minimapStyleDefault: {
113
+ background: string;
114
+ border: string;
115
+ "border-radius": string;
116
+ "box-sizing": string;
117
+ };
118
+ export declare const minimapViewportStyleDefault: {
119
+ background: string;
120
+ border: string;
121
+ "border-radius": string;
122
+ cursor: string;
123
+ };
124
+ export declare const minimapViewportStyleActiveDefault: {
125
+ background: string;
126
+ cursor: string;
127
+ };
128
+ export declare const minimapLabelStyleDefault: {
129
+ bottom: string;
130
+ right: string;
131
+ color: string;
132
+ font: string;
133
+ "pointer-events": string;
134
+ };
135
+ /**
136
+ Default inline styles for the search control's toggle button — the same
137
+ structural-only values as `zoomControlStyleDefault` et al. (visual
138
+ parity by default), kept as independent objects/consumers rather than
139
+ shared references so restyling one doesn't affect the other.
140
+ @private
141
+ */
142
+ export declare const searchControlStyleDefault: {
143
+ "align-items": string;
144
+ display: string;
145
+ font: string;
146
+ height: string;
147
+ "justify-content": string;
148
+ padding: number;
149
+ width: string;
150
+ };
151
+ export declare const searchControlStyleActiveDefault: {
152
+ "background-color": string;
153
+ "border-color": string;
154
+ color: string;
155
+ };
156
+ export declare const searchControlStyleHoverDefault: false;
2
157
  /**
3
158
  Seeds a fresh Viz instance's schema defaults and installs the identity-coerce
4
159
  fluent accessors. Extracted from the constructor so the seeding logic stays
@@ -20,6 +20,8 @@
20
20
 
21
21
  @module
22
22
  */
23
+ import type { PlotZoomBase, ZoomState } from "../Plot/plotZoom.js";
24
+ import type { ZoomControlIconKey } from "../drawSteps/zoomControlsMarkup.js";
23
25
  import type { ZoomTransform } from "d3-zoom";
24
26
  import type { DataPoint } from "@d3plus/data";
25
27
  import type { ClipShape, SceneNode, Transform } from "@d3plus/render";
@@ -69,6 +71,9 @@ export interface VizRenderer {
69
71
  } | undefined;
70
72
  destroy(): void;
71
73
  drawScene(scene: any, opts?: any): any;
74
+ toSVGString?(): string;
75
+ toCanvas?(): HTMLCanvasElement;
76
+ whenSettled?(): Promise<void>;
72
77
  [key: string]: any;
73
78
  }
74
79
  /**
@@ -137,6 +142,21 @@ export interface VizInstance {
137
142
  _previousShapes?: string[];
138
143
  _previousAnnotations?: Record<string, string[]>;
139
144
  _zoomTransform?: Transform;
145
+ /** Data-shape nodes the automatic `zoomMax` measures when they aren't `_chartScene`'s top level (Plot). */
146
+ _zoomShapes?: SceneNode[];
147
+ /** The unzoomed Plot draw an axis-rescaling zoom rescales from. */
148
+ _plotZoomBase?: PlotZoomBase;
149
+ /** Pending repaint that drops a Plot's zoom clip once an animated reset settles. */
150
+ _plotUnclipTimer?: ReturnType<typeof setTimeout>;
151
+ /**
152
+ Chart-specific zoom: repaints for a transform and returns true, or
153
+ returns false to fall back to picture zoom (Plot rescales its axes).
154
+ */
155
+ _zoomRescale?: (t: ZoomState, duration?: number) => boolean;
156
+ /** Cleanup functions returned by `zoomControlIcons`' mount functions, keyed by button. */
157
+ _zoomIconCleanup?: Partial<Record<ZoomControlIconKey, () => void>>;
158
+ /** Cleanup function returned by an `attributionIcon` mount function. */
159
+ _attributionIconCleanup?: () => void;
140
160
  _select?: D3Selection;
141
161
  _sceneTarget?: Element;
142
162
  _sceneRenderer?: VizRenderer;
@@ -149,12 +169,37 @@ export interface VizInstance {
149
169
  /** True while the current hover came from a colorScale bucket swatch. */
150
170
  _hoverBucket?: boolean;
151
171
  _highlight?: ((d: DataPoint, i?: number) => boolean) | false;
172
+ /** Whether the search control's input is currently open. */
173
+ _searchOpen?: boolean;
174
+ /** The search control's current (lowercased) search term. */
175
+ _searchTerm?: string;
176
+ /** The `_highlight` predicate saved when the search box opened, restored when it closes. */
177
+ _searchPrevHighlight?: ((d: DataPoint, i?: number) => boolean) | false;
178
+ /** 0-based index of the current match within `searchMatches(...)`, once Enter/Shift+Enter has stepped to one. */
179
+ _searchMatchIndex?: number;
152
180
  _ordinalColorScale?: ((value: string) => string) | undefined;
153
181
  _hoverDatum?: DataPoint | null;
154
182
  _userHover?: number;
155
183
  _userDuration?: number;
156
184
  _dataCutoff: number;
157
185
  _brushing?: boolean;
186
+ /** Whether the table-view toggle is currently showing the data table instead of the chart. */
187
+ _tableView?: boolean;
188
+ /** The data table's current page (0-indexed), when `tableViewPageSize` paginates it. */
189
+ _tableViewPage?: number;
190
+ /** The data table's current sort column + direction, when the user has clicked a header. */
191
+ _tableViewSort?: {
192
+ column: string;
193
+ direction: "asc" | "desc";
194
+ };
195
+ /** Which dataset the data table currently shows — `viz._data` (raw) once toggled, `viz._filteredData` (aggregate) by default. */
196
+ _tableViewDataSource?: "raw" | "aggregate";
197
+ /** Cached first-occurrence-index lookups (exact JSON match, and groupBy-key fallback) for restoring `.data()` insertion order to the aggregate view; invalidated by comparing against the raw array reference they were built from. */
198
+ _tableViewGroupOrder?: {
199
+ data: DataPoint[];
200
+ exact: Map<string, number>;
201
+ group: Map<string, number>;
202
+ };
158
203
  /** Timeline brush selection (timeline feature). */
159
204
  _timelineSelection?: (Date | number)[] | false;
160
205
  /** The last drawn timeline value (ms), to detect multi-period trail jumps. */
@@ -163,6 +208,13 @@ export interface VizInstance {
163
208
  _userData?: DataPoint[] | string;
164
209
  /** Drill-down history stack (back button). */
165
210
  _history?: DataPoint[];
211
+ /** 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
+ _topLeftControlsBox?: {
213
+ width: number;
214
+ height: number;
215
+ signature: string;
216
+ measurement: unknown;
217
+ };
166
218
  _xAxis?: Axis;
167
219
  _yAxis?: Axis;
168
220
  _x2Axis?: Axis;
@@ -201,7 +253,6 @@ export interface VizInstance {
201
253
  _timelineClass?: Timeline;
202
254
  _titleClass?: TextBox;
203
255
  _subtitleClass?: TextBox;
204
- _backClass?: TextBox;
205
256
  _messageClass?: Message;
206
257
  _tooltipClass?: Tooltip;
207
258
  _legendSort?: (a: DataPoint, b: DataPoint) => number;
@@ -229,8 +280,31 @@ export interface VizInstance {
229
280
  _zoomBehavior?: any;
230
281
  _zoomBrush?: any;
231
282
  _zoomSet?: boolean;
283
+ /** Whether a Geomap's themed basemap resolved dark on the latest draw. */
284
+ _basemapDark?: boolean;
285
+ /** Whether a Geomap is watching its backdrop for theme changes. */
286
+ _themeWatch?: boolean;
287
+ /** The attribution d3plus last set from the tile URL (vs. a user-set one). */
288
+ _tileAttribution?: string | false;
289
+ /** Whether a compact (ⓘ) attribution was clicked open. */
290
+ _attributionPinned?: boolean;
232
291
  _zoomToBounds?: (bounds: number[][] | null, duration?: number) => void;
233
292
  _renderTiles?: (transform?: ZoomTransform, duration?: number) => void;
293
+ /**
294
+ Geomap only: the static (identity-transform) basemap tile list — URLs and
295
+ projection-pixel positions — used by @d3plus/ssr to fetch + inline tiles.
296
+ */
297
+ _computeTileList?: () => Array<{
298
+ key: string;
299
+ url: string;
300
+ x: number;
301
+ y: number;
302
+ size: number;
303
+ }>;
304
+ /** Set by @d3plus/ssr: emit ocean/tiles into the scene for a complete server render. */
305
+ _ssr?: boolean;
306
+ /** Set by @d3plus/ssr: pre-fetched basemap tiles keyed by `${x}-${y}-${z}` → data URI. */
307
+ _ssrTiles?: Map<string, string>;
234
308
  _wirePlotShapeEvents?: (shape: Shape, shapeKey: string, events: string[]) => void;
235
309
  _uuid: string;
236
310
  _preDraw(): void;
@@ -16,6 +16,8 @@ export default class Axis extends BaseClass {
16
16
  _labelRotation: boolean | undefined;
17
17
  _margin: Record<string, number>;
18
18
  _outerBounds: Record<string, number>;
19
+ /** The measured size of the tick-label/title space, before margins (see `fixedSize`). */
20
+ _labelSpace?: number;
19
21
  _position: {
20
22
  horizontal: boolean;
21
23
  width: string;
@@ -76,8 +76,8 @@ export default class Shape extends BaseClass {
76
76
  @param callback Optional callback invoked after rendering completes.
77
77
  */
78
78
  /**
79
- Resolves a style accessor for a data point, mirroring the nested-data logic
80
- of _applyStyle so scene output matches DOM rendering.
79
+ Resolves a style accessor. For a nested shape (Line/Area) the accessor gets
80
+ the merged aggregate `d.data`/`d.i` — matching `_nestWrapper` + scene datum.
81
81
  @private
82
82
  */
83
83
  _styleVal(fn: unknown, d: DataPoint, i: number): unknown;
@@ -11,9 +11,10 @@ type HitArea = ((d: DataPoint, i: number, aes: unknown) => Record<string, unknow
11
11
  the swatch↔hit-area crossing) but a DISTINCT `key`: the hit-area and the
12
12
  visible geometry are siblings, and the SVG keyed join can't hold two nodes
13
13
  under one key — sharing it made the geometry re-enter (collapse→grow) on every
14
- redraw (a "pulse" on e.g. every timeline step). Returns null when no
15
- rect-style hitArea is configured; Line's path-style hitArea is covered by its
16
- own geometry.
14
+ redraw (a "pulse" on e.g. every timeline step). Returns null when no hitArea
15
+ is configured. A path-style hitArea (Line: a fat, transparent stroke) reuses
16
+ the resolved geometry `d`/`transform` so the hover target overlaps the
17
+ visible line exactly while extending past its ~1px stroke.
17
18
  */
18
- export declare function hitAreaNode(hitArea: HitArea, d: DataPoint, i: number, aes: unknown, key: string | number, datum: DataPoint, name: string, transform: Transform): SceneNode | null;
19
+ export declare function hitAreaNode(hitArea: HitArea, d: DataPoint, i: number, aes: unknown, key: string | number, datum: DataPoint, name: string, transform: Transform, geomD?: string): SceneNode | null;
19
20
  export {};
@@ -0,0 +1,15 @@
1
+ import type { DataPoint } from "@d3plus/data";
2
+ import type { InteractionPoint } from "@d3plus/render";
3
+ import type { AccessorFn } from "../utils/index.js";
4
+ /**
5
+ For a nested shape datum (Line/Area, whose datum wraps many points) returns a
6
+ spreadable scene-node fragment carrying each point's content-space position
7
+ paired with its source datum, so the pointer bridge can report the point
8
+ nearest the cursor rather than the whole-series aggregate. Points the
9
+ `defined` accessor rejects, or whose position isn't finite (a missing value),
10
+ are skipped — so the nearest match is always a real, defined point. Returns
11
+ an empty object for non-nested data (spreads to nothing).
12
+ */
13
+ export declare function interactionPoints(d: DataPoint, x: AccessorFn, y: AccessorFn, defined?: AccessorFn): {
14
+ interactionPoints?: InteractionPoint[];
15
+ };
@@ -17,6 +17,12 @@ export interface AxisConfig {
17
17
  /** Visible tick labels of the axis. */
18
18
  labels?: unknown[];
19
19
  labelOffset?: false | number;
20
+ /**
21
+ Exact size of the space that contains the axis tick labels and title.
22
+ Labels that need more room overflow outward instead of moving the axis
23
+ line; zooming pins a rescaled axis this way so it doesn't shift.
24
+ */
25
+ fixedSize?: number;
20
26
  /** Maximum size allowed for the space that contains the axis tick labels and title. */
21
27
  maxSize?: number;
22
28
  /** Minimum size alloted for the space that contains the axis tick labels and title. */
@@ -32,6 +38,13 @@ export interface AxisConfig {
32
38
  tickFormat?: (d: number | string) => string | number;
33
39
  /** Tick values of the axis. */
34
40
  ticks?: unknown[];
41
+ /**
42
+ Whether the domain's min and max are always shown as ticks, even when
43
+ they aren't among the scale's own "nice" tick values (the nearest nice
44
+ tick is dropped when it would crowd them). Defaults to `true`; zooming
45
+ turns it off so a rescaled axis shows only nice values.
46
+ */
47
+ domainTicks?: boolean;
35
48
  tickSize?: number;
36
49
  /**
37
50
  Defines a custom locale object to be used in time scales. Must include
@@ -198,6 +211,28 @@ export interface D3plusConfig {
198
211
  };
199
212
  /** Hides the SVG from assistive technology when true (`aria-hidden`). */
200
213
  ariaHidden?: boolean;
214
+ /**
215
+ Text (rendered as HTML — any valid HTML string works, including anchor
216
+ links) shown in the chart's bottom-right corner, most often a map tile
217
+ credit. `false` (the default) shows nothing. A credit wider than half
218
+ the chart area collapses to a small "ⓘ" badge that expands on hover,
219
+ focus, or click.
220
+ */
221
+ attribution?: string | boolean;
222
+ /**
223
+ Overrides the "ⓘ" badge a long attribution collapses to, which
224
+ otherwise renders as an inline SVG. A string is used as the badge's
225
+ raw HTML content; a mount function, `(el: HTMLElement) => void | (() =>
226
+ void)`, is called once with the badge's reserved element so a live
227
+ component (a React tree via `createRoot(el).render(...)`, or anything
228
+ else imperative) can be mounted into it — return a cleanup function if
229
+ there's teardown to do.
230
+ */
231
+ attributionIcon?: string | ((el: HTMLElement) => void | (() => void));
232
+ /** CSS key/value pairs used to style the attribution text. */
233
+ attributionStyle?: Record<string, unknown>;
234
+ /** Additional CSS class name(s) applied to the back button, alongside the fixed `back-control` class. */
235
+ backControlClassName?: string;
201
236
  /** Padding between bars in pixels. */
202
237
  barPadding?: number;
203
238
  /** The baseline for the x/y plot. */
@@ -291,10 +326,21 @@ export interface D3plusConfig {
291
326
  loadingHTML?: string | ((viz: VizBase) => string);
292
327
  /** Metric key for the visualization. */
293
328
  metric?: string;
329
+ /** Shows a small overview + draggable-viewport minimap underneath the zoom controls once the chart is zoomed in. On by default whenever `zoom` is enabled. */
330
+ minimap?: boolean;
331
+ /** Additional CSS class name(s) applied to the minimap, alongside its fixed `d3plus-minimap`/etc. classes. */
332
+ minimapClassName?: string;
294
333
  /** Custom HTML content shown when no data is supplied, or a function receiving the viz instance. */
295
334
  noDataHTML?: string | ((viz: VizBase) => string);
296
- /** Ocean color for geomaps (any CSS value including 'transparent'). */
297
- ocean?: string;
335
+ /**
336
+ Ocean color for geomaps (any CSS value including 'transparent'), or a
337
+ `{light, dark}` pair chosen by the chart's backdrop. Defaults to the
338
+ default basemap's own water colors.
339
+ */
340
+ ocean?: string | {
341
+ light: string;
342
+ dark: string;
343
+ };
298
344
  /** Event listeners keyed by event name. */
299
345
  on?: Record<string, (event: Event) => void>;
300
346
  /** Coordinate accessor for point-based geomaps. */
@@ -315,6 +361,12 @@ export interface D3plusConfig {
315
361
  row?: string;
316
362
  /** Scrollable container selector for tooltip positioning. */
317
363
  scrollContainer?: string | Window;
364
+ /** Shows a top-left search button that expands into an input; typing highlights shapes whose label matches. On by default for every chart. */
365
+ search?: boolean;
366
+ /** Resolves the string the search box matches its typed term against, for a given datum. Defaults to the mark's resolved on-screen label. */
367
+ searchAccessor?: (d: DataPoint, i: number) => string;
368
+ /** Additional CSS class name(s) applied to the search toggle button and input, alongside the fixed `search-control` classes. */
369
+ searchControlClassName?: string;
318
370
  /** Configuration for shape rendering. */
319
371
  shapeConfig?: {
320
372
  duration?: number;
@@ -360,12 +412,37 @@ export interface D3plusConfig {
360
412
  svgDesc?: string;
361
413
  /** Accessible title applied to the root SVG (`<title>`). */
362
414
  svgTitle?: string;
415
+ /** Enables the top-left table-view toggle button, which swaps the chart for a static, scrollable `<table>` of its data. On by default for every chart. */
416
+ tableView?: boolean;
417
+ /** Additional CSS class name(s) applied to the `<table>` element rendered while in table view, alongside the fixed `d3plus-table-view-table` class. */
418
+ tableViewClassName?: string;
419
+ /** Additional CSS class name(s) applied to the table-view toggle button, alongside the fixed `table-view-control`/`table-view-toggle` classes. */
420
+ tableViewControlClassName?: string;
421
+ /** CSS key/value pairs styling the table-view toggle button. `false` removes all default styling. */
422
+ tableViewControlStyle?: Record<string, unknown> | false;
423
+ /** CSS key/value pairs styling the table-view toggle button while active (showing the data table). `false` removes all default styling. */
424
+ tableViewControlStyleActive?: Record<string, unknown> | false;
425
+ /** CSS key/value pairs styling the table-view toggle button on hover. `false` removes all default styling. */
426
+ tableViewControlStyleHover?: Record<string, unknown> | false;
427
+ /** Whether the data table shows a "download CSV" button, exporting its full (sorted, unpaginated) rows. On by default. */
428
+ tableViewDownload?: boolean;
429
+ /** Rows per page while in table view. `false` (or any non-positive number) disables pagination and shows every row on one page. */
430
+ tableViewPageSize?: number | false;
431
+ /** Whether the data table's column headers are clickable to sort (toggling asc/desc). On by default. */
432
+ tableViewSort?: boolean;
363
433
  /** Threshold value for grouping small slices. */
364
434
  threshold?: number;
365
435
  /** Label for the threshold group, or a `(datum, index)` accessor. */
366
436
  thresholdName?: string | ((d: DataPoint, i: number) => string);
367
- /** URL to XYZ map tiles. */
368
- tileUrl?: string;
437
+ /**
438
+ URL template for XYZ map tiles, with `{z}`, `{x}`, `{y}` (and optional
439
+ `{s}` subdomain) placeholders — or a `{light, dark}` pair, chosen by the
440
+ chart's backdrop. Defaults to Esri's Light Gray and Dark Gray Canvas.
441
+ */
442
+ tileUrl?: string | {
443
+ light: string;
444
+ dark: string;
445
+ };
369
446
  /** Whether to show map tiles. */
370
447
  tiles?: boolean;
371
448
  /** Time key for temporal data. */
@@ -422,16 +499,33 @@ export interface D3plusConfig {
422
499
  ySort?: (a: DataPoint, b: DataPoint) => number;
423
500
  /** Defines a custom sorting comparator function for discrete y2 axes. */
424
501
  y2Sort?: (a: DataPoint, b: DataPoint) => number;
425
- /** Set to false to disable zooming on Geomap and Network. */
502
+ /** Enables pan/zoom with zoom-control buttons. On by default for every chart. */
426
503
  zoom?: boolean;
504
+ /** Additional CSS class name(s) applied to each zoom control button, alongside the fixed `zoom-control`/`zoom-in`/etc. classes. */
505
+ zoomControlClassName?: string;
506
+ /**
507
+ Overrides one or more of the four built-in zoom-control icons (`zoomIn`,
508
+ `zoomOut`, `zoomReset`, `zoomBrush`), which otherwise render as inline
509
+ SVGs. Each value is either raw HTML — used as that button's content — or
510
+ a mount function, `(el: HTMLElement) => void | (() => void)`, called
511
+ once with the button's reserved icon slot so a live component (a React
512
+ tree via `createRoot(el).render(...)`, or anything else imperative) can
513
+ be mounted into it — return a cleanup function if there's teardown to do.
514
+ */
515
+ zoomControlIcons?: Partial<Record<"zoomIn" | "zoomOut" | "zoomReset" | "zoomBrush", string | ((el: HTMLElement) => void | (() => void))>>;
427
516
  /** Multiplier applied to programmatic zoom steps. */
428
517
  zoomFactor?: number;
429
- /** Maximum zoom scale factor. */
518
+ /** Maximum zoom scale factor. Defaults to the scale at which the smallest shape fills the chart area. */
430
519
  zoomMax?: number;
431
520
  /** Whether panning (drag) is enabled while zoomed. */
432
521
  zoomPan?: boolean;
433
- /** Whether scroll-wheel zooming is enabled. */
434
- zoomScroll?: boolean;
522
+ /**
523
+ Whether the mouse wheel (and one-finger touch) zooms. `"modifier"` (the
524
+ default) leaves page scrolling alone: only
525
+ Ctrl/⌘ + wheel or a trackpad/two-finger pinch zooms, and one finger pans
526
+ only once zoomed in. `true` zooms on any wheel; `false` never does.
527
+ */
528
+ zoomScroll?: boolean | "modifier";
435
529
  /** Allows additional custom properties. */
436
530
  [key: string]: unknown;
437
531
  }