@d3plus/core 4.3.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 (197) hide show
  1. package/README.md +1820 -714
  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 +18 -9
  23. package/es/src/charts/Geomap/emit.js.map +1 -1
  24. package/es/src/charts/Geomap/index.js +69 -104
  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 +26 -6
  45. package/es/src/charts/Plot/index.js.map +1 -1
  46. package/es/src/charts/Plot/pipeline.js +1 -2
  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/zoomExtent.js +185 -0
  124. package/es/src/charts/features/zoomExtent.js.map +1 -0
  125. package/es/src/charts/helpers/tileAttributions.js +26 -0
  126. package/es/src/charts/helpers/tileAttributions.js.map +1 -1
  127. package/es/src/charts/index.js +1 -0
  128. package/es/src/charts/index.js.map +1 -1
  129. package/es/src/charts/pipeline/runVizPipeline.js +33 -14
  130. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  131. package/es/src/charts/pipeline/vizDrawPure.js +32 -6
  132. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  133. package/es/src/charts/viz/Viz.js +39 -51
  134. package/es/src/charts/viz/Viz.js.map +1 -1
  135. package/es/src/charts/viz/VizBase.js +157 -4
  136. package/es/src/charts/viz/VizBase.js.map +1 -1
  137. package/es/src/charts/viz/VizBaseConfig.js +32 -2
  138. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  139. package/es/src/charts/viz/vizDefaults.js +243 -50
  140. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  141. package/es/src/charts/viz/vizTypes.js.map +1 -1
  142. package/es/src/components/Axis/Axis.js +10 -1
  143. package/es/src/components/Axis/Axis.js.map +1 -1
  144. package/es/src/components/Axis/axisLayoutLabels.js +2 -1
  145. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
  146. package/es/src/components/Axis/axisRender.js +5 -1
  147. package/es/src/components/Axis/axisRender.js.map +1 -1
  148. package/es/src/components/Legend/legendConfig.js +86 -20
  149. package/es/src/components/Legend/legendConfig.js.map +1 -1
  150. package/es/src/utils/D3plusConfig.js.map +1 -1
  151. package/package.json +11 -10
  152. package/types/index.d.ts +1 -1
  153. package/types/internal.d.ts +8 -1
  154. package/types/src/charts/Chord/applyLayout.d.ts +43 -0
  155. package/types/src/charts/Chord/emit.d.ts +10 -0
  156. package/types/src/charts/Chord/index.d.ts +19 -0
  157. package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
  158. package/types/src/charts/Plot/index.d.ts +12 -3
  159. package/types/src/charts/Plot/plotZoom.d.ts +65 -0
  160. package/types/src/charts/definition/ChartDefinition.d.ts +3 -1
  161. package/types/src/charts/drawSteps/backControl.d.ts +29 -0
  162. package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
  163. package/types/src/charts/drawSteps/minimap.d.ts +19 -0
  164. package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
  165. package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
  166. package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
  167. package/types/src/charts/drawSteps/tableView.d.ts +23 -0
  168. package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
  169. package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
  170. package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
  171. package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
  172. package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
  173. package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
  174. package/types/src/charts/features/attributionFeature.d.ts +21 -0
  175. package/types/src/charts/features/axes.d.ts +1 -1
  176. package/types/src/charts/features/chartGeometry.d.ts +9 -3
  177. package/types/src/charts/features/edgeArrows.d.ts +92 -0
  178. package/types/src/charts/features/emitHelpers.d.ts +11 -0
  179. package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
  180. package/types/src/charts/features/features.d.ts +32 -17
  181. package/types/src/charts/features/featuresLegend.d.ts +15 -0
  182. package/types/src/charts/features/plotPaint.d.ts +15 -2
  183. package/types/src/charts/features/zoomExtent.d.ts +25 -0
  184. package/types/src/charts/index.d.ts +1 -0
  185. package/types/src/charts/pipeline/runVizPipeline.d.ts +6 -3
  186. package/types/src/charts/viz/VizBase.d.ts +86 -4
  187. package/types/src/charts/viz/VizBaseConfig.d.ts +20 -2
  188. package/types/src/charts/viz/vizDefaults.d.ts +155 -0
  189. package/types/src/charts/viz/vizTypes.d.ts +57 -1
  190. package/types/src/components/Axis/Axis.d.ts +2 -0
  191. package/types/src/utils/D3plusConfig.d.ts +102 -8
  192. package/umd/d3plus-core.full.js +39613 -35374
  193. package/umd/d3plus-core.full.js.map +1 -1
  194. package/umd/d3plus-core.full.min.js +5747 -4361
  195. package/umd/d3plus-core.js +13132 -9289
  196. package/umd/d3plus-core.js.map +1 -1
  197. package/umd/d3plus-core.min.js +3658 -2302
@@ -323,6 +323,8 @@ import { computeTrailCatchup } from "./trailCatchup.js";
323
323
  import { CanvasRenderer, SvgRenderer } from "@d3plus/render";
324
324
  import VizBase from "./VizBase.js";
325
325
  import { applyColorScaleBucketOpacity, applyInteractionOpacity } from "./interactionOpacity.js";
326
+ import { chartAreaRect } from "../features/chartGeometry.js";
327
+ import { applyZoomPointerEvents, bindCanvasZoom } from "../drawSteps/zoomControls.js";
326
328
  import { initVizDefaults } from "./vizDefaults.js";
327
329
  import { vizRender } from "./vizRender.js";
328
330
  import { vizDraw } from "../pipeline/vizDraw.js";
@@ -399,15 +401,19 @@ var Viz = /*#__PURE__*/ function(VizBase) {
399
401
  var children = [];
400
402
  // Chart cells stashed on _chartScene — via `chartDef.emit(ctx)` for
401
403
  // data-driven charts, or `Plot._paint` for the paint-driven Plot family.
402
- // Wraps in two groups when a zoom transform is active:
403
- // viz-chart-cells (chart-positioning transform)
404
+ // Wraps in three groups:
405
+ // viz-chart-cells (clip window, untransformed)
404
406
  // viz-zoom (zoom transform — pan/scale from d3-zoom)
405
- // … chart scene children
407
+ // viz-chart-body (chart-positioning transform)
408
+ // … chart scene children
406
409
  // This lets zoom apply to the chart content WITHOUT moving legend/
407
410
  // title/total/etc. (which live in sibling viz-* groups, not under
408
- // viz-chart-cells).
411
+ // viz-chart-cells). The zoom transform sits above the chart transform so
412
+ // it lives in the same surface space d3-zoom measures the pointer in —
413
+ // a wheel zoom stays anchored under the cursor regardless of margins or
414
+ // a chart's own centering transform (Pie, Radar, …).
409
415
  if (this._chartScene && this._chartScene.length) {
410
- var _this__zoomTransform;
416
+ var _this__zoomTransform, _this__chartClip;
411
417
  var sliced = applyInteractionOpacity(this._chartScene, this);
412
418
  // Always emit the viz-zoom group (identity transform when no zoom is
413
419
  // active) so its key is stable across the first zoom. Otherwise the first
@@ -423,16 +429,28 @@ var Viz = /*#__PURE__*/ function(VizBase) {
423
429
  y: 0,
424
430
  scale: 1
425
431
  },
426
- children: sliced
432
+ children: [
433
+ _object_spread_props(_object_spread({
434
+ type: "group",
435
+ key: "viz-chart-body"
436
+ }, this._chartTransform ? {
437
+ transform: this._chartTransform
438
+ } : {}), {
439
+ children: sliced
440
+ })
441
+ ]
427
442
  }
428
443
  ];
444
+ // Fixed clip window (e.g. Geomap's map rect): stays put in scene space
445
+ // while the viz-zoom child transform pans/scales content beneath it.
446
+ // Any zoomable chart without its own clip is clipped to the chart area,
447
+ // so zoomed content can't spill over the legend/title/timeline.
448
+ var clip = (_this__chartClip = this._chartClip) !== null && _this__chartClip !== void 0 ? _this__chartClip : this.schema.zoom && this._margin ? chartAreaRect(this) : undefined;
429
449
  children.push(_object_spread_props(_object_spread({
430
450
  type: "group",
431
451
  key: "viz-chart-cells"
432
- }, this._chartTransform ? {
433
- transform: this._chartTransform
434
- } : {}, this._chartClip ? {
435
- clip: this._chartClip
452
+ }, clip ? {
453
+ clip: clip
436
454
  } : {}), {
437
455
  children: zoomNode
438
456
  }));
@@ -528,34 +546,13 @@ var Viz = /*#__PURE__*/ function(VizBase) {
528
546
  }
529
547
  }
530
548
  }
531
- // E2: FeatureModule.layout() panels (title/subtitle/total/back).
549
+ // E2: FeatureModule.layout() panels (title/subtitle/total, plus the
550
+ // zoom/top-left-controls/attribution overlays appended post-draw).
532
551
  if (this._featurePanels && this._featurePanels.length) {
533
- var panels = this._featurePanels.slice();
534
- var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
535
- try {
536
- // Tag the back-button panel so the pointer bridge can route its click.
537
- for(var _iterator1 = panels[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
538
- var panel = _step1.value;
539
- if (panel && typeof panel.key === "string" && panel.key.toLowerCase().includes("back")) tagInteractionGroup(panel, "back");
540
- }
541
- } catch (err) {
542
- _didIteratorError1 = true;
543
- _iteratorError1 = err;
544
- } finally{
545
- try {
546
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
547
- _iterator1.return();
548
- }
549
- } finally{
550
- if (_didIteratorError1) {
551
- throw _iteratorError1;
552
- }
553
- }
554
- }
555
552
  children.push({
556
553
  type: "group",
557
554
  key: "viz-features",
558
- children: panels
555
+ children: this._featurePanels
559
556
  });
560
557
  }
561
558
  return {
@@ -822,12 +819,11 @@ var Viz = /*#__PURE__*/ function(VizBase) {
822
819
  // is the sole interaction surface. The only interactive DOM that still
823
820
  // lives in this svg is the timeline's d3-brush (the canvas can't host the
824
821
  // native brush handles), so re-enable events on just that group. On the
825
- // SVG backend `_select` IS the scene host, so events must stay enabled.
826
- if (this._select) {
827
- this._select.style("pointer-events", kind === "canvas" ? "none" : null);
828
- if (this._container) this._container.style("pointer-events", kind === "canvas" ? "none" : null);
829
- if (kind === "canvas") this._select.select("g.d3plus-viz-timeline").style("pointer-events", "auto");
830
- }
822
+ // SVG backend `_select` IS the scene host, so events must stay enabled
823
+ // (except while the zoom brush is active — see `applyZoomPointerEvents`).
824
+ applyZoomPointerEvents(this);
825
+ if (this._select && kind === "canvas") this._select.select("g.d3plus-viz-timeline").style("pointer-events", "auto");
826
+ if (kind === "canvas") bindCanvasZoom(this);
831
827
  // The timeline brush (d3-brush DOM, mounted in `g.d3plus-viz-timeline` in
832
828
  // the outer svg) must paint above the scene-rendered timeline buttons/ticks
833
829
  // so its selection tint + handles sit on top of them (matching v3). The
@@ -838,6 +834,9 @@ var Viz = /*#__PURE__*/ function(VizBase) {
838
834
  var host = userTarget && typeof userTarget.querySelector === "function" ? userTarget : null;
839
835
  var tlGroup = host ? host.querySelector(":scope > g.d3plus-viz-timeline") : null;
840
836
  if (tlGroup) host.appendChild(tlGroup);
837
+ // Likewise the zoom brush, so its selection box draws over the shapes.
838
+ var zoomBrush = host ? host.querySelector(":scope > g.d3plus-zoom-brush") : null;
839
+ if (zoomBrush && zoomBrush !== host.lastElementChild) host.appendChild(zoomBrush);
841
840
  }
842
841
  }
843
842
  },
@@ -916,17 +915,6 @@ var Viz = /*#__PURE__*/ function(VizBase) {
916
915
  if (!pick || !pick.node) return;
917
916
  // Scene nodes carry interaction metadata stamped by Viz.toScene.
918
917
  var nodeAny = pick.node;
919
- // Back-button panel: its d3-selection click listener never fires in the
920
- // scene path (it's a plain text node), so route its click here to pop
921
- // the drill-down history / step up a level.
922
- if (nodeAny.interactionGroup === "back") {
923
- if (event.type === "click") {
924
- var self = this;
925
- if (self._history.length) self.config(self._history.pop()).render();
926
- else self.depth(self._drawDepth - 1).filter(false).render();
927
- }
928
- return;
929
- }
930
918
  // Axis ticks/labels and the timeline are chrome — they carry data but
931
919
  // are not chart shapes, so they must not fire shape tooltips/handlers.
932
920
  if (nodeAny.interactionGroup === "axis" || nodeAny.interactionGroup === "timeline") return;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/charts/viz/Viz.ts"],"sourcesContent":["import {select} from \"d3-selection\";\n\nimport {date, getSize} from \"@d3plus/dom\";\n\nimport {computeTrailCatchup} from \"./trailCatchup.js\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {CanvasRenderer, SvgRenderer} from \"@d3plus/render\";\nimport type {PickResult, Renderer, Scene, SceneEvent, SceneNode, Transform} from \"@d3plus/render\";\n\nimport VizBase from \"./VizBase.js\";\nimport type {ColorScale, Legend, Timeline} from \"../../components/index.js\";\nimport type Shape from \"../../shapes/Shape.js\";\nimport {applyColorScaleBucketOpacity, applyInteractionOpacity} from \"./interactionOpacity.js\";\nimport {initVizDefaults} from \"./vizDefaults.js\";\nimport {vizRender} from \"./vizRender.js\";\nimport {vizDraw} from \"../pipeline/vizDraw.js\";\nimport {vizPreDraw} from \"../pipeline/vizPreDraw.js\";\nimport type {VizInstance} from \"./vizTypes.js\";\n\n/**\n Stamps `interactionGroup` onto a component's scene subtree so the pointer\n bridge can route its nodes to component-scoped handlers (e.g. legend) on\n every backend — including Canvas, where there is no per-shape DOM to walk.\n*/\nfunction tagInteractionGroup(node: SceneNode, group: string): void {\n (node as {interactionGroup?: string}).interactionGroup = group;\n const kids = (node as {children?: SceneNode[]}).children;\n if (kids) for (const child of kids) tagInteractionGroup(child, group);\n}\n\n/**\n Resolves the element a renderer mounts into. A `<canvas>` cannot paint inside\n an `<svg>`, so when the scene target is the compute svg, the canvas mounts\n into that svg's parent (the user's element); the emptied, position:absolute\n compute svg overlays the same top-left box. SVG mounts into the target as-is.\n*/\nfunction mountTargetFor(kind: string, target: Element): Element {\n if (\n kind === \"canvas\" &&\n typeof Element !== \"undefined\" &&\n target instanceof Element &&\n target.tagName.toLowerCase() === \"svg\"\n )\n return (target.parentNode as Element | null) ?? target;\n return target;\n}\n\n/**\n 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.\n*/\nexport default class Viz extends VizBase {\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n */\n constructor() {\n super();\n initVizDefaults(this);\n }\n\n /**\n Called by draw before anything is drawn. Formats the data and performs preparations for draw.\n @private\n */\n _preDraw(): void {\n vizPreDraw(this as unknown as VizInstance);\n }\n\n /**\n Composes a backend-agnostic scene graph from the shapes/features produced\n by the most recent render. Combines:\n - `_chartScene` (cells from `chartDef.emit`, or `Plot._paint` for the\n paint-driven Plot family) wrapped in viz-chart-cells\n - `_shapes` (still used by some charts) — each shape's toScene\n - chart-level components (Legend/ColorScale/Timeline) via their toScene\n - `_featurePanels` (from FeatureModule layouts) wrapped in viz-features\n */\n toScene(): Scene {\n const children: SceneNode[] = [];\n // Chart cells stashed on _chartScene — via `chartDef.emit(ctx)` for\n // data-driven charts, or `Plot._paint` for the paint-driven Plot family.\n // Wraps in two groups when a zoom transform is active:\n // viz-chart-cells (chart-positioning transform)\n // viz-zoom (zoom transform — pan/scale from d3-zoom)\n // … chart scene children\n // This lets zoom apply to the chart content WITHOUT moving legend/\n // title/total/etc. (which live in sibling viz-* groups, not under\n // viz-chart-cells).\n if (this._chartScene && this._chartScene.length) {\n const sliced = applyInteractionOpacity(\n this._chartScene,\n this as unknown as VizInstance,\n );\n // Always emit the viz-zoom group (identity transform when no zoom is\n // active) so its key is stable across the first zoom. Otherwise the first\n // zoom adds a brand-new group → the renderer treats the chart cells as\n // exit+enter (teardown/rebuild) instead of tweening the group transform,\n // so the zoom snaps in instead of animating.\n const zoomNode = [{\n type: \"group\" as const,\n key: \"viz-zoom\",\n transform: this._zoomTransform ?? {x: 0, y: 0, scale: 1},\n children: sliced,\n }];\n children.push({\n type: \"group\",\n key: \"viz-chart-cells\",\n ...(this._chartTransform ? {transform: this._chartTransform} : {}),\n // Fixed clip window (e.g. Geomap's map rect): stays put in scene space\n // while the viz-zoom child transform pans/scales content beneath it.\n ...(this._chartClip ? {clip: this._chartClip} : {}),\n children: zoomNode,\n });\n }\n // `_shapes` collection (Treemap/Pack/etc. route through `_chartScene`\n // instead, as does Plot's `absorbShapeIntoChartScene`). Any caller\n // pushing into `_shapes` gets its `toScene()` walked here; we read the\n // shape's `_select` transform via d3's transform baseVal if present,\n // otherwise emit without a transform.\n (this._shapes || []).forEach((shape: Shape, si: number) => {\n if (!shape || typeof shape.toScene !== \"function\") return;\n const group = shape.toScene();\n let transform: Transform | undefined;\n const sel = shape._select;\n if (sel && typeof sel.attr === \"function\") {\n // Parse `translate(x, y)` from the selection's transform attr.\n // Falls back to undefined for non-translate transforms — the\n // `_shapes` path only uses translate.\n const t = sel.attr(\"transform\");\n if (typeof t === \"string\") {\n const m = t.match(/translate\\(\\s*(-?[\\d.]+)[, ]\\s*(-?[\\d.]+)\\s*\\)/);\n if (m) transform = {x: parseFloat(m[1]), y: parseFloat(m[2])};\n }\n }\n children.push({\n type: \"group\",\n key: `${group.key || \"shape\"}-${si}`,\n ...(transform ? {transform} : {}),\n children: group.children,\n });\n });\n // Chart-level components that have their own toScene.\n const components: [string, Legend | ColorScale | Timeline | undefined][] = [\n [\"legend\", this._legendClass],\n [\"colorScale\", this._colorScaleClass],\n [\"timeline\", this._timelineClass],\n ];\n for (const [name, comp] of components) {\n if (\n comp &&\n typeof comp.toScene === \"function\" &&\n comp._select &&\n typeof comp._select.node === \"function\" &&\n comp._select.node()\n ) {\n let compScene: SceneNode = comp.toScene();\n // Tag the legend subtree so its swatches route to legend handlers via\n // the node stamp (renderer-independent), not just SVG DOM ancestry.\n if (name === \"legend\") {\n tagInteractionGroup(compScene, \"legend\");\n // Hovering a legend swatch dims the others, like the chart marks:\n // run the legend subtree through the same interaction-opacity pass\n // (a no-op when no hover/active predicate is set).\n compScene = applyInteractionOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Hovering a colorScale swatch (or a data shape) dims the sibling\n // swatches by bucket color — leaving the colorScale title/axis/gradient\n // untouched. Not tagged \"legend\": colorScale swatches keep the shape\n // event path (range-based tooltip + hover), unlike groupBy legend items.\n else if (name === \"colorScale\") {\n compScene = applyColorScaleBucketOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Tag the timeline subtree so its ticks/labels are exempt from shape\n // tooltips and hover/active dimming (it's chrome, not data marks).\n else if (name === \"timeline\") tagInteractionGroup(compScene, \"timeline\");\n children.push({\n type: \"group\",\n key: `viz-${name}`,\n children: [compScene],\n });\n }\n }\n // E2: FeatureModule.layout() panels (title/subtitle/total/back).\n if (this._featurePanels && this._featurePanels.length) {\n const panels = this._featurePanels.slice();\n // Tag the back-button panel so the pointer bridge can route its click.\n for (const panel of panels) {\n if (\n panel &&\n typeof (panel as {key?: string}).key === \"string\" &&\n (panel as {key: string}).key.toLowerCase().includes(\"back\")\n )\n tagInteractionGroup(panel as SceneNode, \"back\");\n }\n children.push({type: \"group\", key: \"viz-features\", children: panels});\n }\n return {\n width: this.schema.width,\n height: this.schema.height,\n root: {type: \"group\", key: \"viz-root\", children},\n };\n }\n\n /**\n Called by render once all checks are passed.\n @private\n */\n _draw(): void {\n vizDraw(this as unknown as VizInstance);\n }\n\n /**\n * Applies the threshold algorithm according to the type of chart used.\n * @param {Array} data The data to process.\n * @private\n */\n _thresholdFunction(data: DataPoint[], _tree?: unknown): DataPoint[] {\n return data;\n }\n\n /**\n * Detects width and height and sets SVG properties\n * @private\n */\n _setSVGSize(width?: number, height?: number): void {\n let [w, h] =\n width && height\n ? [width, height]\n : getSize(this._select.node().parentNode);\n w! -= parseFloat(this._select.style(\"border-left-width\"));\n w! -= parseFloat(this._select.style(\"border-right-width\"));\n h! -= parseFloat(this._select.style(\"border-top-width\"));\n h! -= parseFloat(this._select.style(\"border-bottom-width\"));\n \n if (this._autoWidth && this.schema.width !== w) {\n this.width(w);\n this._select\n .style(\"width\", `${this.schema.width}px`)\n .attr(\"width\", `${this.schema.width}px`);\n }\n if (this._autoHeight && this.schema.height !== h) {\n this.height(h);\n this._select\n .style(\"height\", `${this.schema.height}px`)\n .attr(\"height\", `${this.schema.height}px`);\n }\n }\n\n /**\n Draws the visualization given the specified configuration.\n @param callback Optional callback invoked after rendering completes.\n */\n render(callback?: () => void): this {\n return vizRender(this, callback) as this;\n }\n\n /**\n Serializes the most recently rendered output to an SVG string. Returns\n `\"\"` if the chart has not been rendered yet. Both backends support this:\n the SVG backend returns its live `<svg>`, the canvas backend re-renders the\n retained scene through a throwaway SVG backend. Primarily used for\n server-side rendering (see `@d3plus/ssr`).\n */\n toSVGString(): string {\n return this._sceneRenderer?.toSVGString?.() ?? \"\";\n }\n\n /**\n Returns the underlying canvas element of the most recent render when the\n canvas backend is active (`renderer(\"canvas\")`), or `undefined` otherwise.\n Server-side callers cast this to their native canvas to encode a raster\n (see `@d3plus/ssr`).\n */\n toCanvas(): unknown {\n return this._renderer === \"canvas\"\n ? this._sceneRenderer?.toCanvas?.()\n : undefined;\n }\n\n /**\n Selects which @d3plus/render backend paints the visible output.\n `\"svg\"` = SvgRenderer (default), `\"canvas\"` = CanvasRenderer.\n Boolean arguments both normalize to `\"svg\"`.\n */\n renderer(): \"svg\" | \"canvas\";\n renderer(_: \"svg\" | \"canvas\" | true | false): this;\n renderer(_?: \"svg\" | \"canvas\" | true | false): \"svg\" | \"canvas\" | this {\n if (!arguments.length) return this._renderer;\n this._renderer = _ === \"canvas\" ? \"canvas\" : \"svg\";\n return this;\n }\n\n /**\n \"full\" runs the DOM enter/update/exit for every shape; \"compute\"\n skips DOM work and only populates the scene data (`_textData`,\n `_shapes[i]._select`, etc.) for `toScene()` to read. Set automatically by\n `renderScene` callers; users can also opt-in.\n */\n renderMode(): \"full\" | \"compute\";\n renderMode(_: \"full\" | \"compute\"): this;\n renderMode(_?: \"full\" | \"compute\"): \"full\" | \"compute\" | this {\n if (!arguments.length) return this._renderMode || \"full\";\n this._renderMode = _!;\n return this;\n }\n\n /**\n Public entry point that renders this chart through the @d3plus/render\n pluggable backends. The compute pass happens via render() (in an svg\n auto-created inside the target div); SvgRenderer/CanvasRenderer paints\n the scene to the target. Returns `{renderer, scene}` so callers can\n interact with the renderer (e.g. for picking) or read the scene data.\n */\n async renderScene(\n target: Element,\n opts?: {kind?: \"svg\" | \"canvas\"},\n ): Promise<{renderer: Renderer; scene: Scene}> {\n const kind = opts?.kind || (this._renderer === \"canvas\" ? \"canvas\" : \"svg\");\n this._sceneTarget = target;\n this._renderer = kind;\n this.select(target as HTMLElement);\n await new Promise<void>(resolve => this.render(() => resolve()));\n return {\n renderer: this._sceneRenderer as Renderer,\n scene: this._lastSceneRendered as Scene,\n };\n }\n\n /**\n Renders this chart through the @d3plus/render pluggable backends. Called\n automatically by `render()`. The compute pass draws into `this._select`\n (an auto-created svg INSIDE the user's target div) — that svg is the\n off-stage detached compute svg. SvgRenderer mounts to the user's target\n div (the parent), as a sibling to the detached compute svg. The compute\n svg's children get cleared so only the scene output is visible.\n */\n _drawSceneToTarget(durationOverride?: number): void {\n const kind = this._renderer === \"canvas\" ? \"canvas\" : \"svg\";\n const computeSvg = this._select && this._select.node ? this._select.node() : null;\n if (!computeSvg) return;\n // Mount renderer INSIDE the user's `_select` (svg or div). Tests like\n // `svgA.querySelector('[data-key=\"viz-legend\"]')` need the scene output\n // to live inside the user's container, not as a sibling.\n const userTarget = this._sceneTarget || computeSvg;\n if (!userTarget) return;\n const mountTarget = mountTargetFor(kind, userTarget as Element);\n const scene = this.toScene();\n const w = this.schema.width || 400;\n const h = this.schema.height || 300;\n // Reuse the renderer instance if it matches the kind, to avoid mount\n // churn. `target()` is the public Renderer-interface method (no\n // reaching into renderer-private slots). It's optional on the\n // interface; third-party renderers without it fall through to\n // remount on every draw — correct but with mount churn.\n const currentContainer = this._sceneRenderer?.target\n ? this._sceneRenderer.target()?.container\n : undefined;\n const containerChanged = this._sceneRenderer?.target\n ? currentContainer !== mountTarget\n : false;\n if (\n !this._sceneRenderer ||\n this._sceneRenderer.kind !== kind ||\n containerChanged\n ) {\n // Tear down the outgoing renderer before mounting a fresh one. It owns\n // its own DOM (canvas/svg + overlay host), pointer listeners, and\n // transition timers; without this, switching kind (svg<->canvas) or\n // container orphans that DOM in the user's element, stacking the old\n // mode's output behind the new one and accumulating on every switch.\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\")\n this._sceneRenderer.destroy();\n const Ctor = kind === \"canvas\" ? CanvasRenderer : SvgRenderer;\n this._sceneRenderer = new Ctor();\n // `_scenePixelRatio`, when set (e.g. by @d3plus/ssr for hi-res PNG output),\n // fixes the canvas backing-store scale; otherwise the renderer falls back\n // to `devicePixelRatio`.\n this._sceneRenderer.mount({\n container: mountTarget,\n width: w,\n height: h,\n pixelRatio: this._scenePixelRatio,\n });\n // Bridge renderer pointer events → viz.schema.on handlers. Without this,\n // tooltips never fire on the v4 scene-rendered path because\n // `shape.on(evt, fn)` in plotPaint only wires d3-selection\n // listeners on DOM nodes the scene renderer doesn't create.\n // Renderer events carry the picked scene node; the routing lives in\n // `_routeSceneEvent` (kept out of this method so the mount path stays\n // readable). `_lastScenePick` remembers the most recently hovered node\n // so `mouseleave` — fired with a null pick — can still tell the matching\n // handlers which shape/legend item was left (so the tooltip clears).\n this._lastScenePick = null;\n this._sceneRenderer.on((event: SceneEvent) => this._routeSceneEvent(event));\n } else {\n this._sceneRenderer.resize(w, h);\n }\n // `durationOverride` defaults to the chart's `_duration` for normal\n // re-renders. Interaction handlers (zoomed, hover, etc.) pass 0 to\n // skip the transition machinery — animating every wheel/drag tick\n // accumulates `setTimeout(duration+10)` per event.\n const drawDuration =\n durationOverride !== undefined ? durationOverride : this.schema.duration;\n // A duration>0 render (drill-down, zoom, re-center) must win over any\n // pending coalesced duration-0 repaint — otherwise that repaint fires on\n // the next frame and interrupts this transition, snapping shapes to their\n // final geometry.\n if (drawDuration > 0 && this._sceneRepaintRAF != null) {\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n // Mark the window during which an animated transition is in flight, so the\n // pointer bridge can ignore interaction until it settles. A hover/click\n // mid-transition would schedule a duration-0 repaint that interrupts the\n // running transition and snaps it to its end (the glitchy jump). Matches\n // the SvgRenderer/CanvasRenderer `duration + 10` end timer, plus a small\n // buffer so events re-enable just after the paint completes.\n if (drawDuration > 0)\n this._transitionEndsAt = Date.now() + drawDuration + 30;\n // Order persistent motion trails in time by the current timeline period, so\n // they grow only as playback moves forward and rewind when it steps back.\n // Only when the timeline selects a single period (`brushing: false`): a range\n // selection has no single \"current time\", which would scramble the step\n // logic, so we withhold the sequence and trails fall back to ephemeral.\n // Normalize to milliseconds via `date()` — the selection mixes Date objects\n // (brush/initial) and raw period numbers (playback), which compare on wildly\n // different scales otherwise, scrambling the forward/backward test.\n const sel = this._timelineSelection;\n const brushing = this._timelineClass\n ? (this._timelineClass.schema as {brushing?: boolean}).brushing !== false\n : true;\n const sequence = !brushing && Array.isArray(sel) && sel.length\n ? Math.max(...sel.map(v => Number(date(Number(v)))))\n : undefined;\n // A forward jump that skips periods (manual click, not single-step play) draws\n // one coarse segment; compute the marks' real positions at the skipped periods\n // so the trail bends through them (see render commitTrailCatchups).\n const trailCatchup =\n sequence !== undefined && this._trailSeq !== undefined && sequence > this._trailSeq\n ? computeTrailCatchup(this as unknown as VizInstance, scene, this._trailSeq, sequence)\n : undefined;\n if (sequence !== undefined) this._trailSeq = sequence;\n this._sceneRenderer.drawScene(scene, {duration: drawDuration, sequence, trailCatchup});\n this._lastSceneRendered = scene;\n\n // Canvas backend: the compute <svg> (`_select`) is an emptied overlay\n // sitting on top of the <canvas>. An svg root hit-tests its whole box, so\n // even empty it swallows the pointer events the canvas needs for\n // tooltip/hover/legend picking — the symptom being \"renders fine, no\n // tooltips.\" Make the overlay transparent to pointer events so the canvas\n // is the sole interaction surface. The only interactive DOM that still\n // lives in this svg is the timeline's d3-brush (the canvas can't host the\n // native brush handles), so re-enable events on just that group. On the\n // SVG backend `_select` IS the scene host, so events must stay enabled.\n if (this._select) {\n this._select.style(\"pointer-events\", kind === \"canvas\" ? \"none\" : null);\n if (this._container)\n this._container.style(\"pointer-events\", kind === \"canvas\" ? \"none\" : null);\n if (kind === \"canvas\")\n this._select\n .select(\"g.d3plus-viz-timeline\")\n .style(\"pointer-events\", \"auto\");\n }\n\n // The timeline brush (d3-brush DOM, mounted in `g.d3plus-viz-timeline` in\n // the outer svg) must paint above the scene-rendered timeline buttons/ticks\n // so its selection tint + handles sit on top of them (matching v3). The\n // renderer appends its scene <svg> last, so without this the brush layer\n // ends up behind it — the selection's translucent fill is then hidden by\n // the opaque buttons and only the edge handles peek out.\n if (kind === \"svg\") {\n const host =\n userTarget && typeof (userTarget as Element).querySelector === \"function\"\n ? (userTarget as Element)\n : null;\n const tlGroup = host\n ? host.querySelector(\":scope > g.d3plus-viz-timeline\")\n : null;\n if (tlGroup) host!.appendChild(tlGroup);\n }\n }\n\n /**\n Resolves the `(d, i, x)` a picked scene node reports to interaction\n handlers (tooltip, click, user `on` handlers). `pick.datum` is the raw\n scene datum; for a Plot shape that's the wrapped record `{data, i}`, which\n handlers expect unwrapped to `(d.data, d.i, wrapped)`. The base does that\n unwrap; Plot overrides this to report the point nearest the cursor for\n multi-point shapes (Line/Area) so a series tooltip reflects the hovered\n x rather than the whole-series aggregate.\n @private\n */\n _interactionDatum(\n pick: PickResult,\n _event: SceneEvent,\n ): {d: unknown; i: number; x: unknown} {\n const rawDatum = pick.datum as {data?: unknown; i?: number} | null | undefined;\n const sourceDatum = rawDatum && rawDatum.data ? rawDatum.data : rawDatum;\n const sourceIndex =\n rawDatum && typeof rawDatum.i === \"number\" ? rawDatum.i : pick.index ?? 0;\n return {d: sourceDatum, i: sourceIndex, x: rawDatum};\n }\n\n /**\n Routes a renderer pointer event to the matching `viz.schema.on` handlers.\n Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where\n compute-mode shapes mount no per-shape DOM, so `shape.on(evt, fn)`\n listeners never fire. We look up the appropriate `on` key from the picked\n scene node: legend swatches route to legend handlers, chart shapes to\n shape (+ shape-class-scoped) handlers, and chrome (axis/timeline/back) is\n excluded. Split out of `_drawSceneToTarget` to keep that method small.\n @private\n */\n _routeSceneEvent(event: SceneEvent): void {\n // Ignore all pointer interaction while an animated transition (zoom,\n // re-center, drill-down, entrance) is in flight. Hovering or clicking a\n // shape mid-transition would fire a handler that schedules a duration-0\n // repaint, interrupting the running transition and snapping it to its end\n // — the glitchy jump. `_transitionEndsAt` is stamped by `_drawSceneToTarget`\n // for the transition's duration; it lapses on its own, so interaction\n // resumes the instant the transition settles.\n if (this._transitionEndsAt && Date.now() < this._transitionEndsAt) return;\n const pick = event.pick;\n // Dispatch helper shared by the live-pick path and the leave path.\n const fire = (\n key: string,\n d: unknown,\n i: number,\n x: unknown,\n ): void => {\n const fn = this.schema.on && this.schema.on[key];\n if (typeof fn === \"function\") {\n try {\n fn.call(this, d, i, x, event.nativeEvent);\n } catch {\n // swallow per-event errors so one bad handler doesn't\n // break subsequent events.\n }\n }\n };\n if (event.type === \"mouseleave\") {\n const lastPick = this._lastScenePick;\n if (lastPick) {\n fire(\n `mouseleave.${lastPick.isLegend ? \"legend\" : \"shape\"}`,\n lastPick.d,\n lastPick.i,\n lastPick.x,\n );\n if (!lastPick.isLegend && lastPick.shapeType)\n fire(`mouseleave.${lastPick.shapeType}`, lastPick.d, lastPick.i, lastPick.x);\n fire(\"mouseleave\", lastPick.d, lastPick.i, lastPick.x);\n }\n this._lastScenePick = null;\n // Cleared here, then re-set by the enter/move the renderer fires\n // synchronously when the pointer crosses to an adjacent node — so a\n // shape→label hand-off leaves `_hoverDatum` pointing at the new node\n // (same datum), which `mouseleave` reads to suppress a flicker.\n this._hoverDatum = null;\n return;\n }\n if (!pick || !pick.node) return;\n // Scene nodes carry interaction metadata stamped by Viz.toScene.\n const nodeAny = pick.node as {\n interactionGroup?: string;\n shapeType?: string;\n };\n // Back-button panel: its d3-selection click listener never fires in the\n // scene path (it's a plain text node), so route its click here to pop\n // the drill-down history / step up a level.\n if (nodeAny.interactionGroup === \"back\") {\n if (event.type === \"click\") {\n const self = this;\n if (self._history.length) self.config(self._history.pop()).render();\n else self.depth(self._drawDepth - 1).filter(false).render();\n }\n return;\n }\n // Axis ticks/labels and the timeline are chrome — they carry data but\n // are not chart shapes, so they must not fire shape tooltips/handlers.\n if (\n nodeAny.interactionGroup === \"axis\" ||\n nodeAny.interactionGroup === \"timeline\"\n )\n return;\n // Prefer the node's stamped interaction group (set by Viz.toScene), so\n // legend swatches route to legend handlers on Canvas too — where the\n // single canvas element has no per-shape DOM to walk. Fall back to SVG\n // DOM ancestry for nodes the stamp didn't reach.\n const target =\n event.nativeEvent && (event.nativeEvent as Event).target;\n const isLegendNode =\n nodeAny.interactionGroup === \"legend\" ||\n (target && typeof (target as Element).closest === \"function\"\n ? !!(target as Element).closest('[data-key=\"viz-legend\"]')\n : false);\n const suffix = isLegendNode ? \"legend\" : \"shape\";\n const handlerKey = `${event.type}.${suffix}`;\n // Resolve the datum + index this pick reports to handlers, ONCE, and reuse\n // it for every handler fired below so tooltip/click/user handlers agree on\n // which datum the pointer is over. The base unwraps the node's raw datum to\n // its source row; Plot overrides `_interactionDatum` to report the point\n // nearest the cursor for multi-point shapes (Line/Area).\n const {d: sourceDatum, i: sourceIndex, x: rawDatum} = this._interactionDatum(\n pick,\n event,\n );\n const shapeType =\n typeof nodeAny.shapeType === \"string\" ? nodeAny.shapeType : null;\n this._lastScenePick = {\n d: sourceDatum, i: sourceIndex, x: rawDatum, isLegend: isLegendNode, shapeType,\n };\n this._hoverDatum = rawDatum;\n fire(handlerKey, sourceDatum, sourceIndex, rawDatum);\n // Shape-class-scoped handlers (`\"click.Bar\"`, `\"mousemove.Circle\"`). The\n // emitting shape stamps its type onto the node; on the scene path this is\n // the only place these fire (compute-mode shapes wire no DOM listeners).\n // Legend nodes are excluded so a legend swatch's shape type can't\n // masquerade as a chart-shape handler.\n if (!isLegendNode && shapeType) {\n fire(`${event.type}.${shapeType}`, sourceDatum, sourceIndex, rawDatum);\n }\n // Also fire the un-suffixed handler (e.g. \"mousemove\") so user-registered\n // global handlers see the event too.\n fire(event.type, sourceDatum, sourceIndex, rawDatum);\n }\n\n /**\n Coalesces interaction-driven scene repaints (hover/active dimming) into a\n single paint per animation frame. A fast pointer sweep across a dense\n chart fires a hover transition per shape crossed; painting each one\n synchronously rebuilt the whole scene back-to-back, saturating the main\n thread (~200ms stalls) so the tooltip couldn't reposition and appeared\n stuck at its last spot. Only the latest hover state is visible, so the\n intermediate paints are wasted — collapse them to one rAF-scheduled draw.\n */\n _scheduleSceneRepaint(): void {\n if (!this._sceneRenderer) return;\n if (typeof requestAnimationFrame !== \"function\") {\n this._drawSceneToTarget(0);\n return;\n }\n if (this._sceneRepaintRAF != null) return;\n this._sceneRepaintRAF = requestAnimationFrame(() => {\n this._sceneRepaintRAF = undefined;\n this._drawSceneToTarget(0);\n });\n }\n\n /**\n Tears down the visualization: disconnects the ResizeObserver and removes DOM event listeners. Call this when unmounting to avoid memory leaks.\n */\n destroy(): this {\n this._resizeObserver?.disconnect();\n this._tooltipClass.data([]).render();\n select(\"body\").on(`touchstart.${this._uuid}`, null);\n // Clear the visibility/resize/scroll poll timers + scroll listener\n // so a destroyed chart doesn't keep firing intervals/timeouts that\n // hold the entire viz instance alive. Without this, an SPA that\n // mounts/unmounts charts on tab switches leaks the scene tree +\n // a 200ms-interval timer per leaked chart.\n if (this._visiblePoll) {\n this._visiblePoll = clearInterval(this._visiblePoll) as never;\n }\n if (this._resizePoll) {\n this._resizePoll = clearTimeout(this._resizePoll) as never;\n }\n if (this._scrollPoll) {\n this._scrollPoll = clearTimeout(this._scrollPoll) as never;\n }\n if (this._sceneRepaintRAF != null) {\n if (typeof cancelAnimationFrame === \"function\")\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n if (this.schema.scrollContainer)\n select(this.schema.scrollContainer).on(`scroll.${this._uuid}`, null);\n // Destroy the active scene renderer (clears its own pointer-rect\n // listeners, overlay host, canvas/svg DOM, timers).\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\") {\n this._sceneRenderer.destroy();\n this._sceneRenderer = undefined;\n }\n return this;\n }\n\n}\n"],"names":["select","date","getSize","computeTrailCatchup","CanvasRenderer","SvgRenderer","VizBase","applyColorScaleBucketOpacity","applyInteractionOpacity","initVizDefaults","vizRender","vizDraw","vizPreDraw","tagInteractionGroup","node","group","interactionGroup","kids","children","child","mountTargetFor","kind","target","Element","tagName","toLowerCase","parentNode","Viz","_preDraw","toScene","_chartScene","length","sliced","zoomNode","type","key","transform","_zoomTransform","x","y","scale","push","_chartTransform","_chartClip","clip","_shapes","forEach","shape","si","sel","_select","attr","t","m","match","parseFloat","components","_legendClass","_colorScaleClass","_timelineClass","name","comp","compScene","_featurePanels","panels","slice","panel","includes","width","schema","height","root","_draw","_thresholdFunction","data","_tree","_setSVGSize","w","h","style","_autoWidth","_autoHeight","render","callback","toSVGString","_sceneRenderer","toCanvas","_renderer","undefined","renderer","_","arguments","renderMode","_renderMode","renderScene","opts","_sceneTarget","Promise","resolve","scene","_lastSceneRendered","_drawSceneToTarget","durationOverride","Math","computeSvg","userTarget","mountTarget","currentContainer","container","containerChanged","destroy","Ctor","mount","pixelRatio","_scenePixelRatio","_lastScenePick","on","event","_routeSceneEvent","resize","drawDuration","duration","_sceneRepaintRAF","cancelAnimationFrame","_transitionEndsAt","Date","now","_timelineSelection","brushing","sequence","Array","isArray","max","map","v","Number","trailCatchup","_trailSeq","drawScene","_container","host","querySelector","tlGroup","appendChild","_interactionDatum","pick","_event","rawDatum","datum","sourceDatum","sourceIndex","i","index","d","fire","fn","call","nativeEvent","lastPick","isLegend","shapeType","_hoverDatum","nodeAny","self","_history","config","pop","depth","_drawDepth","filter","isLegendNode","closest","suffix","handlerKey","_scheduleSceneRepaint","requestAnimationFrame","_resizeObserver","disconnect","_tooltipClass","_uuid","_visiblePoll","clearInterval","_resizePoll","clearTimeout","_scrollPoll","scrollContainer"],"mappings":";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I,CAACA,YAAY,GAAGC,cAAc,IAAI,CAACD,YAAY;gBACrD;gBACA,IAAI,IAAI,CAACE,WAAW,EAAE;oBACpB,IAAI,CAACA,WAAW,GAAGC,aAAa,IAAI,CAACD,WAAW;gBAClD;gBACA,IAAI,IAAI,CAACE,WAAW,EAAE;oBACpB,IAAI,CAACA,WAAW,GAAGD,aAAa,IAAI,CAACC,WAAW;gBAClD;gBACA,IAAI,IAAI,CAAC9D,gBAAgB,IAAI,MAAM;oBACjC,IAAI,OAAOC,yBAAyB,YAClCA,qBAAqB,IAAI,CAACD,gBAAgB;oBAC5C,IAAI,CAACA,gBAAgB,GAAGlC;gBAC1B;gBACA,IAAI,IAAI,CAACnB,MAAM,CAACoH,eAAe,EAC7BzL,OAAO,IAAI,CAACqE,MAAM,CAACoH,eAAe,EAAErE,EAAE,CAAC,AAAC,UAAoB,OAAX,IAAI,CAAC+D,KAAK,GAAI;gBACjE,iEAAiE;gBACjE,oDAAoD;gBACpD,IAAI,IAAI,CAAC9F,cAAc,IAAI,OAAO,IAAI,CAACA,cAAc,CAACyB,OAAO,KAAK,YAAY;oBAC5E,IAAI,CAACzB,cAAc,CAACyB,OAAO;oBAC3B,IAAI,CAACzB,cAAc,GAAGG;gBACxB;gBACA,OAAO,IAAI;YACb;;;WAjoBmB7D;EAAYrB;AAHjC;;AAEA,GACA,SAAqBqB,iBAmoBpB"}
1
+ {"version":3,"sources":["../../../../src/charts/viz/Viz.ts"],"sourcesContent":["import {select} from \"d3-selection\";\n\nimport {date, getSize} from \"@d3plus/dom\";\n\nimport {computeTrailCatchup} from \"./trailCatchup.js\";\nimport type {DataPoint} from \"@d3plus/data\";\nimport {CanvasRenderer, SvgRenderer} from \"@d3plus/render\";\nimport type {PickResult, Renderer, Scene, SceneEvent, SceneNode, Transform} from \"@d3plus/render\";\n\nimport VizBase from \"./VizBase.js\";\nimport type {ColorScale, Legend, Timeline} from \"../../components/index.js\";\nimport type Shape from \"../../shapes/Shape.js\";\nimport {applyColorScaleBucketOpacity, applyInteractionOpacity} from \"./interactionOpacity.js\";\nimport {chartAreaRect} from \"../features/chartGeometry.js\";\nimport {applyZoomPointerEvents, bindCanvasZoom} from \"../drawSteps/zoomControls.js\";\nimport {initVizDefaults} from \"./vizDefaults.js\";\nimport {vizRender} from \"./vizRender.js\";\nimport {vizDraw} from \"../pipeline/vizDraw.js\";\nimport {vizPreDraw} from \"../pipeline/vizPreDraw.js\";\nimport type {VizInstance} from \"./vizTypes.js\";\n\n/**\n Stamps `interactionGroup` onto a component's scene subtree so the pointer\n bridge can route its nodes to component-scoped handlers (e.g. legend) on\n every backend — including Canvas, where there is no per-shape DOM to walk.\n*/\nfunction tagInteractionGroup(node: SceneNode, group: string): void {\n (node as {interactionGroup?: string}).interactionGroup = group;\n const kids = (node as {children?: SceneNode[]}).children;\n if (kids) for (const child of kids) tagInteractionGroup(child, group);\n}\n\n/**\n Resolves the element a renderer mounts into. A `<canvas>` cannot paint inside\n an `<svg>`, so when the scene target is the compute svg, the canvas mounts\n into that svg's parent (the user's element); the emptied, position:absolute\n compute svg overlays the same top-left box. SVG mounts into the target as-is.\n*/\nfunction mountTargetFor(kind: string, target: Element): Element {\n if (\n kind === \"canvas\" &&\n typeof Element !== \"undefined\" &&\n target instanceof Element &&\n target.tagName.toLowerCase() === \"svg\"\n )\n return (target.parentNode as Element | null) ?? target;\n return target;\n}\n\n/**\n 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.\n*/\nexport default class Viz extends VizBase {\n\n /**\n Invoked when creating a new class instance, and sets any default parameters.\n @private\n */\n constructor() {\n super();\n initVizDefaults(this);\n }\n\n /**\n Called by draw before anything is drawn. Formats the data and performs preparations for draw.\n @private\n */\n _preDraw(): void {\n vizPreDraw(this as unknown as VizInstance);\n }\n\n /**\n Composes a backend-agnostic scene graph from the shapes/features produced\n by the most recent render. Combines:\n - `_chartScene` (cells from `chartDef.emit`, or `Plot._paint` for the\n paint-driven Plot family) wrapped in viz-chart-cells\n - `_shapes` (still used by some charts) — each shape's toScene\n - chart-level components (Legend/ColorScale/Timeline) via their toScene\n - `_featurePanels` (from FeatureModule layouts) wrapped in viz-features\n */\n toScene(): Scene {\n const children: SceneNode[] = [];\n // Chart cells stashed on _chartScene — via `chartDef.emit(ctx)` for\n // data-driven charts, or `Plot._paint` for the paint-driven Plot family.\n // Wraps in three groups:\n // viz-chart-cells (clip window, untransformed)\n // viz-zoom (zoom transform — pan/scale from d3-zoom)\n // viz-chart-body (chart-positioning transform)\n // … chart scene children\n // This lets zoom apply to the chart content WITHOUT moving legend/\n // title/total/etc. (which live in sibling viz-* groups, not under\n // viz-chart-cells). The zoom transform sits above the chart transform so\n // it lives in the same surface space d3-zoom measures the pointer in —\n // a wheel zoom stays anchored under the cursor regardless of margins or\n // a chart's own centering transform (Pie, Radar, …).\n if (this._chartScene && this._chartScene.length) {\n const sliced = applyInteractionOpacity(\n this._chartScene,\n this as unknown as VizInstance,\n );\n // Always emit the viz-zoom group (identity transform when no zoom is\n // active) so its key is stable across the first zoom. Otherwise the first\n // zoom adds a brand-new group → the renderer treats the chart cells as\n // exit+enter (teardown/rebuild) instead of tweening the group transform,\n // so the zoom snaps in instead of animating.\n const zoomNode = [{\n type: \"group\" as const,\n key: \"viz-zoom\",\n transform: this._zoomTransform ?? {x: 0, y: 0, scale: 1},\n children: [{\n type: \"group\" as const,\n key: \"viz-chart-body\",\n ...(this._chartTransform ? {transform: this._chartTransform} : {}),\n children: sliced,\n }],\n }];\n // Fixed clip window (e.g. Geomap's map rect): stays put in scene space\n // while the viz-zoom child transform pans/scales content beneath it.\n // Any zoomable chart without its own clip is clipped to the chart area,\n // so zoomed content can't spill over the legend/title/timeline.\n const clip = this._chartClip ?? (this.schema.zoom && this._margin ? chartAreaRect(this as unknown as VizInstance) : undefined);\n children.push({\n type: \"group\",\n key: \"viz-chart-cells\",\n ...(clip ? {clip} : {}),\n children: zoomNode,\n });\n }\n // `_shapes` collection (Treemap/Pack/etc. route through `_chartScene`\n // instead, as does Plot's `absorbShapeIntoChartScene`). Any caller\n // pushing into `_shapes` gets its `toScene()` walked here; we read the\n // shape's `_select` transform via d3's transform baseVal if present,\n // otherwise emit without a transform.\n (this._shapes || []).forEach((shape: Shape, si: number) => {\n if (!shape || typeof shape.toScene !== \"function\") return;\n const group = shape.toScene();\n let transform: Transform | undefined;\n const sel = shape._select;\n if (sel && typeof sel.attr === \"function\") {\n // Parse `translate(x, y)` from the selection's transform attr.\n // Falls back to undefined for non-translate transforms — the\n // `_shapes` path only uses translate.\n const t = sel.attr(\"transform\");\n if (typeof t === \"string\") {\n const m = t.match(/translate\\(\\s*(-?[\\d.]+)[, ]\\s*(-?[\\d.]+)\\s*\\)/);\n if (m) transform = {x: parseFloat(m[1]), y: parseFloat(m[2])};\n }\n }\n children.push({\n type: \"group\",\n key: `${group.key || \"shape\"}-${si}`,\n ...(transform ? {transform} : {}),\n children: group.children,\n });\n });\n // Chart-level components that have their own toScene.\n const components: [string, Legend | ColorScale | Timeline | undefined][] = [\n [\"legend\", this._legendClass],\n [\"colorScale\", this._colorScaleClass],\n [\"timeline\", this._timelineClass],\n ];\n for (const [name, comp] of components) {\n if (\n comp &&\n typeof comp.toScene === \"function\" &&\n comp._select &&\n typeof comp._select.node === \"function\" &&\n comp._select.node()\n ) {\n let compScene: SceneNode = comp.toScene();\n // Tag the legend subtree so its swatches route to legend handlers via\n // the node stamp (renderer-independent), not just SVG DOM ancestry.\n if (name === \"legend\") {\n tagInteractionGroup(compScene, \"legend\");\n // Hovering a legend swatch dims the others, like the chart marks:\n // run the legend subtree through the same interaction-opacity pass\n // (a no-op when no hover/active predicate is set).\n compScene = applyInteractionOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Hovering a colorScale swatch (or a data shape) dims the sibling\n // swatches by bucket color — leaving the colorScale title/axis/gradient\n // untouched. Not tagged \"legend\": colorScale swatches keep the shape\n // event path (range-based tooltip + hover), unlike groupBy legend items.\n else if (name === \"colorScale\") {\n compScene = applyColorScaleBucketOpacity(\n [compScene],\n this as unknown as VizInstance,\n )[0];\n }\n // Tag the timeline subtree so its ticks/labels are exempt from shape\n // tooltips and hover/active dimming (it's chrome, not data marks).\n else if (name === \"timeline\") tagInteractionGroup(compScene, \"timeline\");\n children.push({\n type: \"group\",\n key: `viz-${name}`,\n children: [compScene],\n });\n }\n }\n // E2: FeatureModule.layout() panels (title/subtitle/total, plus the\n // zoom/top-left-controls/attribution overlays appended post-draw).\n if (this._featurePanels && this._featurePanels.length) {\n children.push({type: \"group\", key: \"viz-features\", children: this._featurePanels});\n }\n return {\n width: this.schema.width,\n height: this.schema.height,\n root: {type: \"group\", key: \"viz-root\", children},\n };\n }\n\n /**\n Called by render once all checks are passed.\n @private\n */\n _draw(): void {\n vizDraw(this as unknown as VizInstance);\n }\n\n /**\n * Applies the threshold algorithm according to the type of chart used.\n * @param {Array} data The data to process.\n * @private\n */\n _thresholdFunction(data: DataPoint[], _tree?: unknown): DataPoint[] {\n return data;\n }\n\n /**\n * Detects width and height and sets SVG properties\n * @private\n */\n _setSVGSize(width?: number, height?: number): void {\n let [w, h] =\n width && height\n ? [width, height]\n : getSize(this._select.node().parentNode);\n w! -= parseFloat(this._select.style(\"border-left-width\"));\n w! -= parseFloat(this._select.style(\"border-right-width\"));\n h! -= parseFloat(this._select.style(\"border-top-width\"));\n h! -= parseFloat(this._select.style(\"border-bottom-width\"));\n \n if (this._autoWidth && this.schema.width !== w) {\n this.width(w);\n this._select\n .style(\"width\", `${this.schema.width}px`)\n .attr(\"width\", `${this.schema.width}px`);\n }\n if (this._autoHeight && this.schema.height !== h) {\n this.height(h);\n this._select\n .style(\"height\", `${this.schema.height}px`)\n .attr(\"height\", `${this.schema.height}px`);\n }\n }\n\n /**\n Draws the visualization given the specified configuration.\n @param callback Optional callback invoked after rendering completes.\n */\n render(callback?: () => void): this {\n return vizRender(this, callback) as this;\n }\n\n /**\n Serializes the most recently rendered output to an SVG string. Returns\n `\"\"` if the chart has not been rendered yet. Both backends support this:\n the SVG backend returns its live `<svg>`, the canvas backend re-renders the\n retained scene through a throwaway SVG backend. Primarily used for\n server-side rendering (see `@d3plus/ssr`).\n */\n toSVGString(): string {\n return this._sceneRenderer?.toSVGString?.() ?? \"\";\n }\n\n /**\n Returns the underlying canvas element of the most recent render when the\n canvas backend is active (`renderer(\"canvas\")`), or `undefined` otherwise.\n Server-side callers cast this to their native canvas to encode a raster\n (see `@d3plus/ssr`).\n */\n toCanvas(): unknown {\n return this._renderer === \"canvas\"\n ? this._sceneRenderer?.toCanvas?.()\n : undefined;\n }\n\n /**\n Selects which @d3plus/render backend paints the visible output.\n `\"svg\"` = SvgRenderer (default), `\"canvas\"` = CanvasRenderer.\n Boolean arguments both normalize to `\"svg\"`.\n */\n renderer(): \"svg\" | \"canvas\";\n renderer(_: \"svg\" | \"canvas\" | true | false): this;\n renderer(_?: \"svg\" | \"canvas\" | true | false): \"svg\" | \"canvas\" | this {\n if (!arguments.length) return this._renderer;\n this._renderer = _ === \"canvas\" ? \"canvas\" : \"svg\";\n return this;\n }\n\n /**\n \"full\" runs the DOM enter/update/exit for every shape; \"compute\"\n skips DOM work and only populates the scene data (`_textData`,\n `_shapes[i]._select`, etc.) for `toScene()` to read. Set automatically by\n `renderScene` callers; users can also opt-in.\n */\n renderMode(): \"full\" | \"compute\";\n renderMode(_: \"full\" | \"compute\"): this;\n renderMode(_?: \"full\" | \"compute\"): \"full\" | \"compute\" | this {\n if (!arguments.length) return this._renderMode || \"full\";\n this._renderMode = _!;\n return this;\n }\n\n /**\n Public entry point that renders this chart through the @d3plus/render\n pluggable backends. The compute pass happens via render() (in an svg\n auto-created inside the target div); SvgRenderer/CanvasRenderer paints\n the scene to the target. Returns `{renderer, scene}` so callers can\n interact with the renderer (e.g. for picking) or read the scene data.\n */\n async renderScene(\n target: Element,\n opts?: {kind?: \"svg\" | \"canvas\"},\n ): Promise<{renderer: Renderer; scene: Scene}> {\n const kind = opts?.kind || (this._renderer === \"canvas\" ? \"canvas\" : \"svg\");\n this._sceneTarget = target;\n this._renderer = kind;\n this.select(target as HTMLElement);\n await new Promise<void>(resolve => this.render(() => resolve()));\n return {\n renderer: this._sceneRenderer as Renderer,\n scene: this._lastSceneRendered as Scene,\n };\n }\n\n /**\n Renders this chart through the @d3plus/render pluggable backends. Called\n automatically by `render()`. The compute pass draws into `this._select`\n (an auto-created svg INSIDE the user's target div) — that svg is the\n off-stage detached compute svg. SvgRenderer mounts to the user's target\n div (the parent), as a sibling to the detached compute svg. The compute\n svg's children get cleared so only the scene output is visible.\n */\n _drawSceneToTarget(durationOverride?: number): void {\n const kind = this._renderer === \"canvas\" ? \"canvas\" : \"svg\";\n const computeSvg = this._select && this._select.node ? this._select.node() : null;\n if (!computeSvg) return;\n // Mount renderer INSIDE the user's `_select` (svg or div). Tests like\n // `svgA.querySelector('[data-key=\"viz-legend\"]')` need the scene output\n // to live inside the user's container, not as a sibling.\n const userTarget = this._sceneTarget || computeSvg;\n if (!userTarget) return;\n const mountTarget = mountTargetFor(kind, userTarget as Element);\n const scene = this.toScene();\n const w = this.schema.width || 400;\n const h = this.schema.height || 300;\n // Reuse the renderer instance if it matches the kind, to avoid mount\n // churn. `target()` is the public Renderer-interface method (no\n // reaching into renderer-private slots). It's optional on the\n // interface; third-party renderers without it fall through to\n // remount on every draw — correct but with mount churn.\n const currentContainer = this._sceneRenderer?.target\n ? this._sceneRenderer.target()?.container\n : undefined;\n const containerChanged = this._sceneRenderer?.target\n ? currentContainer !== mountTarget\n : false;\n if (\n !this._sceneRenderer ||\n this._sceneRenderer.kind !== kind ||\n containerChanged\n ) {\n // Tear down the outgoing renderer before mounting a fresh one. It owns\n // its own DOM (canvas/svg + overlay host), pointer listeners, and\n // transition timers; without this, switching kind (svg<->canvas) or\n // container orphans that DOM in the user's element, stacking the old\n // mode's output behind the new one and accumulating on every switch.\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\")\n this._sceneRenderer.destroy();\n const Ctor = kind === \"canvas\" ? CanvasRenderer : SvgRenderer;\n this._sceneRenderer = new Ctor();\n // `_scenePixelRatio`, when set (e.g. by @d3plus/ssr for hi-res PNG output),\n // fixes the canvas backing-store scale; otherwise the renderer falls back\n // to `devicePixelRatio`.\n this._sceneRenderer.mount({\n container: mountTarget,\n width: w,\n height: h,\n pixelRatio: this._scenePixelRatio,\n });\n // Bridge renderer pointer events → viz.schema.on handlers. Without this,\n // tooltips never fire on the v4 scene-rendered path because\n // `shape.on(evt, fn)` in plotPaint only wires d3-selection\n // listeners on DOM nodes the scene renderer doesn't create.\n // Renderer events carry the picked scene node; the routing lives in\n // `_routeSceneEvent` (kept out of this method so the mount path stays\n // readable). `_lastScenePick` remembers the most recently hovered node\n // so `mouseleave` — fired with a null pick — can still tell the matching\n // handlers which shape/legend item was left (so the tooltip clears).\n this._lastScenePick = null;\n this._sceneRenderer.on((event: SceneEvent) => this._routeSceneEvent(event));\n } else {\n this._sceneRenderer.resize(w, h);\n }\n // `durationOverride` defaults to the chart's `_duration` for normal\n // re-renders. Interaction handlers (zoomed, hover, etc.) pass 0 to\n // skip the transition machinery — animating every wheel/drag tick\n // accumulates `setTimeout(duration+10)` per event.\n const drawDuration =\n durationOverride !== undefined ? durationOverride : this.schema.duration;\n // A duration>0 render (drill-down, zoom, re-center) must win over any\n // pending coalesced duration-0 repaint — otherwise that repaint fires on\n // the next frame and interrupts this transition, snapping shapes to their\n // final geometry.\n if (drawDuration > 0 && this._sceneRepaintRAF != null) {\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n // Mark the window during which an animated transition is in flight, so the\n // pointer bridge can ignore interaction until it settles. A hover/click\n // mid-transition would schedule a duration-0 repaint that interrupts the\n // running transition and snaps it to its end (the glitchy jump). Matches\n // the SvgRenderer/CanvasRenderer `duration + 10` end timer, plus a small\n // buffer so events re-enable just after the paint completes.\n if (drawDuration > 0)\n this._transitionEndsAt = Date.now() + drawDuration + 30;\n // Order persistent motion trails in time by the current timeline period, so\n // they grow only as playback moves forward and rewind when it steps back.\n // Only when the timeline selects a single period (`brushing: false`): a range\n // selection has no single \"current time\", which would scramble the step\n // logic, so we withhold the sequence and trails fall back to ephemeral.\n // Normalize to milliseconds via `date()` — the selection mixes Date objects\n // (brush/initial) and raw period numbers (playback), which compare on wildly\n // different scales otherwise, scrambling the forward/backward test.\n const sel = this._timelineSelection;\n const brushing = this._timelineClass\n ? (this._timelineClass.schema as {brushing?: boolean}).brushing !== false\n : true;\n const sequence = !brushing && Array.isArray(sel) && sel.length\n ? Math.max(...sel.map(v => Number(date(Number(v)))))\n : undefined;\n // A forward jump that skips periods (manual click, not single-step play) draws\n // one coarse segment; compute the marks' real positions at the skipped periods\n // so the trail bends through them (see render commitTrailCatchups).\n const trailCatchup =\n sequence !== undefined && this._trailSeq !== undefined && sequence > this._trailSeq\n ? computeTrailCatchup(this as unknown as VizInstance, scene, this._trailSeq, sequence)\n : undefined;\n if (sequence !== undefined) this._trailSeq = sequence;\n this._sceneRenderer.drawScene(scene, {duration: drawDuration, sequence, trailCatchup});\n this._lastSceneRendered = scene;\n\n // Canvas backend: the compute <svg> (`_select`) is an emptied overlay\n // sitting on top of the <canvas>. An svg root hit-tests its whole box, so\n // even empty it swallows the pointer events the canvas needs for\n // tooltip/hover/legend picking — the symptom being \"renders fine, no\n // tooltips.\" Make the overlay transparent to pointer events so the canvas\n // is the sole interaction surface. The only interactive DOM that still\n // lives in this svg is the timeline's d3-brush (the canvas can't host the\n // native brush handles), so re-enable events on just that group. On the\n // SVG backend `_select` IS the scene host, so events must stay enabled\n // (except while the zoom brush is active — see `applyZoomPointerEvents`).\n applyZoomPointerEvents(this);\n if (this._select && kind === \"canvas\")\n this._select\n .select(\"g.d3plus-viz-timeline\")\n .style(\"pointer-events\", \"auto\");\n if (kind === \"canvas\") bindCanvasZoom(this);\n\n // The timeline brush (d3-brush DOM, mounted in `g.d3plus-viz-timeline` in\n // the outer svg) must paint above the scene-rendered timeline buttons/ticks\n // so its selection tint + handles sit on top of them (matching v3). The\n // renderer appends its scene <svg> last, so without this the brush layer\n // ends up behind it — the selection's translucent fill is then hidden by\n // the opaque buttons and only the edge handles peek out.\n if (kind === \"svg\") {\n const host =\n userTarget && typeof (userTarget as Element).querySelector === \"function\"\n ? (userTarget as Element)\n : null;\n const tlGroup = host\n ? host.querySelector(\":scope > g.d3plus-viz-timeline\")\n : null;\n if (tlGroup) host!.appendChild(tlGroup);\n // Likewise the zoom brush, so its selection box draws over the shapes.\n const zoomBrush = host ? host.querySelector(\":scope > g.d3plus-zoom-brush\") : null;\n if (zoomBrush && zoomBrush !== host!.lastElementChild) host!.appendChild(zoomBrush);\n }\n }\n\n /**\n Resolves the `(d, i, x)` a picked scene node reports to interaction\n handlers (tooltip, click, user `on` handlers). `pick.datum` is the raw\n scene datum; for a Plot shape that's the wrapped record `{data, i}`, which\n handlers expect unwrapped to `(d.data, d.i, wrapped)`. The base does that\n unwrap; Plot overrides this to report the point nearest the cursor for\n multi-point shapes (Line/Area) so a series tooltip reflects the hovered\n x rather than the whole-series aggregate.\n @private\n */\n _interactionDatum(\n pick: PickResult,\n _event: SceneEvent,\n ): {d: unknown; i: number; x: unknown} {\n const rawDatum = pick.datum as {data?: unknown; i?: number} | null | undefined;\n const sourceDatum = rawDatum && rawDatum.data ? rawDatum.data : rawDatum;\n const sourceIndex =\n rawDatum && typeof rawDatum.i === \"number\" ? rawDatum.i : pick.index ?? 0;\n return {d: sourceDatum, i: sourceIndex, x: rawDatum};\n }\n\n /**\n Routes a renderer pointer event to the matching `viz.schema.on` handlers.\n Bridges the v4 scene-rendered path (SvgRenderer/CanvasRenderer), where\n compute-mode shapes mount no per-shape DOM, so `shape.on(evt, fn)`\n listeners never fire. We look up the appropriate `on` key from the picked\n scene node: legend swatches route to legend handlers, chart shapes to\n shape (+ shape-class-scoped) handlers, and chrome (axis/timeline/back) is\n excluded. Split out of `_drawSceneToTarget` to keep that method small.\n @private\n */\n _routeSceneEvent(event: SceneEvent): void {\n // Ignore all pointer interaction while an animated transition (zoom,\n // re-center, drill-down, entrance) is in flight. Hovering or clicking a\n // shape mid-transition would fire a handler that schedules a duration-0\n // repaint, interrupting the running transition and snapping it to its end\n // — the glitchy jump. `_transitionEndsAt` is stamped by `_drawSceneToTarget`\n // for the transition's duration; it lapses on its own, so interaction\n // resumes the instant the transition settles.\n if (this._transitionEndsAt && Date.now() < this._transitionEndsAt) return;\n const pick = event.pick;\n // Dispatch helper shared by the live-pick path and the leave path.\n const fire = (\n key: string,\n d: unknown,\n i: number,\n x: unknown,\n ): void => {\n const fn = this.schema.on && this.schema.on[key];\n if (typeof fn === \"function\") {\n try {\n fn.call(this, d, i, x, event.nativeEvent);\n } catch {\n // swallow per-event errors so one bad handler doesn't\n // break subsequent events.\n }\n }\n };\n if (event.type === \"mouseleave\") {\n const lastPick = this._lastScenePick;\n if (lastPick) {\n fire(\n `mouseleave.${lastPick.isLegend ? \"legend\" : \"shape\"}`,\n lastPick.d,\n lastPick.i,\n lastPick.x,\n );\n if (!lastPick.isLegend && lastPick.shapeType)\n fire(`mouseleave.${lastPick.shapeType}`, lastPick.d, lastPick.i, lastPick.x);\n fire(\"mouseleave\", lastPick.d, lastPick.i, lastPick.x);\n }\n this._lastScenePick = null;\n // Cleared here, then re-set by the enter/move the renderer fires\n // synchronously when the pointer crosses to an adjacent node — so a\n // shape→label hand-off leaves `_hoverDatum` pointing at the new node\n // (same datum), which `mouseleave` reads to suppress a flicker.\n this._hoverDatum = null;\n return;\n }\n if (!pick || !pick.node) return;\n // Scene nodes carry interaction metadata stamped by Viz.toScene.\n const nodeAny = pick.node as {\n interactionGroup?: string;\n shapeType?: string;\n };\n // Axis ticks/labels and the timeline are chrome — they carry data but\n // are not chart shapes, so they must not fire shape tooltips/handlers.\n if (\n nodeAny.interactionGroup === \"axis\" ||\n nodeAny.interactionGroup === \"timeline\"\n )\n return;\n // Prefer the node's stamped interaction group (set by Viz.toScene), so\n // legend swatches route to legend handlers on Canvas too — where the\n // single canvas element has no per-shape DOM to walk. Fall back to SVG\n // DOM ancestry for nodes the stamp didn't reach.\n const target =\n event.nativeEvent && (event.nativeEvent as Event).target;\n const isLegendNode =\n nodeAny.interactionGroup === \"legend\" ||\n (target && typeof (target as Element).closest === \"function\"\n ? !!(target as Element).closest('[data-key=\"viz-legend\"]')\n : false);\n const suffix = isLegendNode ? \"legend\" : \"shape\";\n const handlerKey = `${event.type}.${suffix}`;\n // Resolve the datum + index this pick reports to handlers, ONCE, and reuse\n // it for every handler fired below so tooltip/click/user handlers agree on\n // which datum the pointer is over. The base unwraps the node's raw datum to\n // its source row; Plot overrides `_interactionDatum` to report the point\n // nearest the cursor for multi-point shapes (Line/Area).\n const {d: sourceDatum, i: sourceIndex, x: rawDatum} = this._interactionDatum(\n pick,\n event,\n );\n const shapeType =\n typeof nodeAny.shapeType === \"string\" ? nodeAny.shapeType : null;\n this._lastScenePick = {\n d: sourceDatum, i: sourceIndex, x: rawDatum, isLegend: isLegendNode, shapeType,\n };\n this._hoverDatum = rawDatum;\n fire(handlerKey, sourceDatum, sourceIndex, rawDatum);\n // Shape-class-scoped handlers (`\"click.Bar\"`, `\"mousemove.Circle\"`). The\n // emitting shape stamps its type onto the node; on the scene path this is\n // the only place these fire (compute-mode shapes wire no DOM listeners).\n // Legend nodes are excluded so a legend swatch's shape type can't\n // masquerade as a chart-shape handler.\n if (!isLegendNode && shapeType) {\n fire(`${event.type}.${shapeType}`, sourceDatum, sourceIndex, rawDatum);\n }\n // Also fire the un-suffixed handler (e.g. \"mousemove\") so user-registered\n // global handlers see the event too.\n fire(event.type, sourceDatum, sourceIndex, rawDatum);\n }\n\n /**\n Coalesces interaction-driven scene repaints (hover/active dimming) into a\n single paint per animation frame. A fast pointer sweep across a dense\n chart fires a hover transition per shape crossed; painting each one\n synchronously rebuilt the whole scene back-to-back, saturating the main\n thread (~200ms stalls) so the tooltip couldn't reposition and appeared\n stuck at its last spot. Only the latest hover state is visible, so the\n intermediate paints are wasted — collapse them to one rAF-scheduled draw.\n */\n _scheduleSceneRepaint(): void {\n if (!this._sceneRenderer) return;\n if (typeof requestAnimationFrame !== \"function\") {\n this._drawSceneToTarget(0);\n return;\n }\n if (this._sceneRepaintRAF != null) return;\n this._sceneRepaintRAF = requestAnimationFrame(() => {\n this._sceneRepaintRAF = undefined;\n this._drawSceneToTarget(0);\n });\n }\n\n /**\n Tears down the visualization: disconnects the ResizeObserver and removes DOM event listeners. Call this when unmounting to avoid memory leaks.\n */\n destroy(): this {\n this._resizeObserver?.disconnect();\n this._tooltipClass.data([]).render();\n select(\"body\").on(`touchstart.${this._uuid}`, null);\n // Clear the visibility/resize/scroll poll timers + scroll listener\n // so a destroyed chart doesn't keep firing intervals/timeouts that\n // hold the entire viz instance alive. Without this, an SPA that\n // mounts/unmounts charts on tab switches leaks the scene tree +\n // a 200ms-interval timer per leaked chart.\n if (this._visiblePoll) {\n this._visiblePoll = clearInterval(this._visiblePoll) as never;\n }\n if (this._resizePoll) {\n this._resizePoll = clearTimeout(this._resizePoll) as never;\n }\n if (this._scrollPoll) {\n this._scrollPoll = clearTimeout(this._scrollPoll) as never;\n }\n if (this._sceneRepaintRAF != null) {\n if (typeof cancelAnimationFrame === \"function\")\n cancelAnimationFrame(this._sceneRepaintRAF);\n this._sceneRepaintRAF = undefined;\n }\n if (this.schema.scrollContainer)\n select(this.schema.scrollContainer).on(`scroll.${this._uuid}`, null);\n // Destroy the active scene renderer (clears its own pointer-rect\n // listeners, overlay host, canvas/svg DOM, timers).\n if (this._sceneRenderer && typeof this._sceneRenderer.destroy === \"function\") {\n this._sceneRenderer.destroy();\n this._sceneRenderer = undefined;\n }\n return this;\n }\n\n}\n"],"names":["select","date","getSize","computeTrailCatchup","CanvasRenderer","SvgRenderer","VizBase","applyColorScaleBucketOpacity","applyInteractionOpacity","chartAreaRect","applyZoomPointerEvents","bindCanvasZoom","initVizDefaults","vizRender","vizDraw","vizPreDraw","tagInteractionGroup","node","group","interactionGroup","kids","children","child","mountTargetFor","kind","target","Element","tagName","toLowerCase","parentNode","Viz","_preDraw","toScene","_chartScene","length","sliced","zoomNode","type","key","transform","_zoomTransform","x","y","scale","_chartTransform","clip","_chartClip","schema","zoom","_margin","undefined","push","_shapes","forEach","shape","si","sel","_select","attr","t","m","match","parseFloat","components","_legendClass","_colorScaleClass","_timelineClass","name","comp","compScene","_featurePanels","width","height","root","_draw","_thresholdFunction","data","_tree","_setSVGSize","w","h","style","_autoWidth","_autoHeight","render","callback","toSVGString","_sceneRenderer","toCanvas","_renderer","renderer","_","arguments","renderMode","_renderMode","renderScene","opts","_sceneTarget","Promise","resolve","scene","_lastSceneRendered","_drawSceneToTarget","durationOverride","Math","computeSvg","userTarget","mountTarget","currentContainer","container","containerChanged","destroy","Ctor","mount","pixelRatio","_scenePixelRatio","_lastScenePick","on","event","_routeSceneEvent","resize","drawDuration","duration","_sceneRepaintRAF","cancelAnimationFrame","_transitionEndsAt","Date","now","_timelineSelection","brushing","sequence","Array","isArray","max","map","v","Number","trailCatchup","_trailSeq","drawScene","host","querySelector","tlGroup","appendChild","zoomBrush","lastElementChild","_interactionDatum","pick","_event","rawDatum","datum","sourceDatum","sourceIndex","i","index","d","fire","fn","call","nativeEvent","lastPick","isLegend","shapeType","_hoverDatum","nodeAny","isLegendNode","closest","suffix","handlerKey","_scheduleSceneRepaint","requestAnimationFrame","_resizeObserver","disconnect","_tooltipClass","_uuid","_visiblePoll","clearInterval","_resizePoll","clearTimeout","_scrollPoll","scrollContainer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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E;gBACjE,oDAAoD;gBACpD,IAAI,IAAI,CAACvF,cAAc,IAAI,OAAO,IAAI,CAACA,cAAc,CAACwB,OAAO,KAAK,YAAY;oBAC5E,IAAI,CAACxB,cAAc,CAACwB,OAAO;oBAC3B,IAAI,CAACxB,cAAc,GAAGrC;gBACxB;gBACA,OAAO,IAAI;YACb;;;WAznBmBpB;EAAYxB;AAHjC;;AAEA,GACA,SAAqBwB,iBA2nBpB"}
@@ -126,6 +126,46 @@ var VizBase = /*#__PURE__*/ function(VizBaseConfig) {
126
126
  },
127
127
  {
128
128
  /**
129
+ An additional CSS class name (or space-separated list of class names) applied to the minimap's outer box, viewport box, and zoom-level label, alongside their fixed `d3plus-minimap` / `d3plus-minimap-viewport` / `d3plus-minimap-label` classes. Setting this automatically disables d3plus's built-in inline `minimapStyle`/`minimapViewportStyle`/`minimapViewportStyleActive`/`minimapLabelStyle` defaults (as long as you haven't already customized them yourself), so a host page's own styling applies through the cascade with no other configuration needed.
130
+ */ key: "minimapClassName",
131
+ value: function minimapClassName(_) {
132
+ return arguments.length ? (this.schema.minimapClassName = _, this) : this.schema.minimapClassName;
133
+ }
134
+ },
135
+ {
136
+ /**
137
+ An object containing CSS key/value pairs that is used to style the minimap's zoom-level text label (e.g. "2x"). Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.minimapClassName(...)` is set, unless you've explicitly customized this yourself.
138
+ */ key: "minimapLabelStyle",
139
+ value: function minimapLabelStyle(_) {
140
+ return arguments.length ? (this.schema.minimapLabelStyle = _, this) : this.schema.minimapLabelStyle;
141
+ }
142
+ },
143
+ {
144
+ /**
145
+ An object containing CSS key/value pairs that is used to style the minimap's outer box (the full-scene overview). Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.minimapClassName(...)` is set, unless you've explicitly customized this yourself.
146
+ */ key: "minimapStyle",
147
+ value: function minimapStyle(_) {
148
+ return arguments.length ? (this.schema.minimapStyle = _, this) : this.schema.minimapStyle;
149
+ }
150
+ },
151
+ {
152
+ /**
153
+ An object containing CSS key/value pairs that is used to style the minimap's draggable viewport box in its resting state. Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.minimapClassName(...)` is set, unless you've explicitly customized this yourself.
154
+ */ key: "minimapViewportStyle",
155
+ value: function minimapViewportStyle(_) {
156
+ return arguments.length ? (this.schema.minimapViewportStyle = _, this) : this.schema.minimapViewportStyle;
157
+ }
158
+ },
159
+ {
160
+ /**
161
+ An object containing CSS key/value pairs that is used to style the minimap's draggable viewport box while it's being dragged. Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.minimapClassName(...)` is set, unless you've explicitly customized this yourself.
162
+ */ key: "minimapViewportStyleActive",
163
+ value: function minimapViewportStyleActive(_) {
164
+ return arguments.length ? (this.schema.minimapViewportStyleActive = _, this) : this.schema.minimapViewportStyleActive;
165
+ }
166
+ },
167
+ {
168
+ /**
129
169
  The inner HTML of the status message displayed when no data is supplied to the visualization. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.
130
170
  */ key: "noDataHTML",
131
171
  value: function noDataHTML(_) {
@@ -150,6 +190,55 @@ var VizBase = /*#__PURE__*/ function(VizBaseConfig) {
150
190
  },
151
191
  {
152
192
  /**
193
+ Resolves the string the search box matches its typed term against, for
194
+ a given datum. Defaults to the mark's resolved on-screen label
195
+ (`viz._drawLabel`) — the same text the user reads on the chart.
196
+ Override it to match against something else instead, e.g. a data
197
+ field that isn't shown as the label.
198
+
199
+ This is checked alongside, not instead of, every level of the datum's
200
+ own groupBy hierarchy — searching a leaf's label also matches its
201
+ ancestor group's cell/legend entry, and vice versa, regardless of
202
+ this accessor's override.
203
+ */ key: "searchAccessor",
204
+ value: function searchAccessor(_) {
205
+ return arguments.length ? (this.schema.searchAccessor = _, this) : this.schema.searchAccessor;
206
+ }
207
+ },
208
+ {
209
+ /**
210
+ An additional CSS class name (or space-separated list of class names) applied to the search toggle button and input, alongside their fixed `search-control` classes. Setting this automatically disables d3plus's built-in inline `searchControlStyle`/`searchControlStyleActive`/`searchControlStyleHover` defaults (as long as you haven't already customized them yourself), so a host page's own button styling — Tailwind, Bootstrap, a design system — applies through the cascade with no other configuration needed.
211
+ */ key: "searchControlClassName",
212
+ value: function searchControlClassName(_) {
213
+ return arguments.length ? (this.schema.searchControlClassName = _, this) : this.schema.searchControlClassName;
214
+ }
215
+ },
216
+ {
217
+ /**
218
+ An object containing CSS key/value pairs that is used to style the search toggle button. Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.searchControlClassName(...)` is set, unless you've explicitly customized this yourself.
219
+ */ key: "searchControlStyle",
220
+ value: function searchControlStyle(_) {
221
+ return arguments.length ? (this.schema.searchControlStyle = _, this) : this.schema.searchControlStyle;
222
+ }
223
+ },
224
+ {
225
+ /**
226
+ An object containing CSS key/value pairs that is used to style the search toggle button while open. Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.searchControlClassName(...)` is set, unless you've explicitly customized this yourself.
227
+ */ key: "searchControlStyleActive",
228
+ value: function searchControlStyleActive(_) {
229
+ return arguments.length ? (this.schema.searchControlStyleActive = _, this) : this.schema.searchControlStyleActive;
230
+ }
231
+ },
232
+ {
233
+ /**
234
+ An object containing CSS key/value pairs that is used to style the search toggle button on hover. Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.searchControlClassName(...)` is set, unless you've explicitly customized this yourself.
235
+ */ key: "searchControlStyleHover",
236
+ value: function searchControlStyleHover(_) {
237
+ return arguments.length ? (this.schema.searchControlStyleHover = _, this) : this.schema.searchControlStyleHover;
238
+ }
239
+ },
240
+ {
241
+ /**
153
242
  The SVG container element as a d3 selector or DOM element. Defaults to `undefined`.
154
243
  */ key: "select",
155
244
  value: function select1(_) {
@@ -402,7 +491,23 @@ var VizBase = /*#__PURE__*/ function(VizBaseConfig) {
402
491
  },
403
492
  {
404
493
  /**
405
- An object containing CSS key/value pairs that is used to style each zoom control button (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.
494
+ An additional CSS class name (or space-separated list of class names) applied to each zoom control button, alongside the fixed `zoom-control` / `zoom-in` / `zoom-out` / `zoom-reset` / `zoom-brush` classes. Setting this automatically disables d3plus's built-in inline `zoomControlStyle`/`zoomControlStyleActive`/`zoomControlStyleHover` defaults (as long as you haven't already customized them yourself), so a host page's own button styling — Tailwind, Bootstrap, a design system — applies through the cascade with no other configuration needed.
495
+ */ key: "zoomControlClassName",
496
+ value: function zoomControlClassName(_) {
497
+ return arguments.length ? (this.schema.zoomControlClassName = _, this) : this.schema.zoomControlClassName;
498
+ }
499
+ },
500
+ {
501
+ /**
502
+ Overrides one or more of the four built-in zoom-control icons (`zoomIn`, `zoomOut`, `zoomReset`, `zoomBrush`), which otherwise render as inline SVGs. Each value is either an HTML string — used as the button's content in place of the built-in icon — or a mount function, `(el: HTMLElement) => void | (() => void)`, called once with the button's reserved icon slot (a 12x12px element) so you can mount anything imperative into it: a React tree (`createRoot(el).render(<Icon/>)`), a Vue app, a canvas sprite, a brand `<img>`. Return a cleanup function from the mount function if there's teardown to do; it runs right before that slot is discarded — which happens whenever the whole button panel's markup regenerates (a `.locale(...)` change, a `zoomControlClassName` change, or the brush toggle switching), not just once per chart.
503
+ */ key: "zoomControlIcons",
504
+ value: function zoomControlIcons(_) {
505
+ return arguments.length ? (this.schema.zoomControlIcons = _, this) : this.schema.zoomControlIcons;
506
+ }
507
+ },
508
+ {
509
+ /**
510
+ An object containing CSS key/value pairs that is used to style each zoom control button (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.zoomControlClassName(...)` is set, unless you've explicitly customized this yourself.
406
511
  */ key: "zoomControlStyle",
407
512
  value: function zoomControlStyle(_) {
408
513
  return arguments.length ? (this.schema.zoomControlStyle = _, this) : this.schema.zoomControlStyle;
@@ -410,7 +515,7 @@ var VizBase = /*#__PURE__*/ function(VizBaseConfig) {
410
515
  },
411
516
  {
412
517
  /**
413
- An object containing CSS key/value pairs that is used to style each zoom control button when active (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.
518
+ An object containing CSS key/value pairs that is used to style each zoom control button when active (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.zoomControlClassName(...)` is set, unless you've explicitly customized this yourself.
414
519
  */ key: "zoomControlStyleActive",
415
520
  value: function zoomControlStyleActive(_) {
416
521
  return arguments.length ? (this.schema.zoomControlStyleActive = _, this) : this.schema.zoomControlStyleActive;
@@ -418,7 +523,7 @@ var VizBase = /*#__PURE__*/ function(VizBaseConfig) {
418
523
  },
419
524
  {
420
525
  /**
421
- An object containing CSS key/value pairs that is used to style each zoom control button on hover (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.
526
+ An object containing CSS key/value pairs that is used to style each zoom control button on hover (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.zoomControlClassName(...)` is set, unless you've explicitly customized this yourself.
422
527
  */ key: "zoomControlStyleHover",
423
528
  value: function zoomControlStyleHover(_) {
424
529
  return arguments.length ? (this.schema.zoomControlStyleHover = _, this) : this.schema.zoomControlStyleHover;
@@ -431,13 +536,61 @@ var VizBase = /*#__PURE__*/ function(VizBaseConfig) {
431
536
  value: function zoomPadding(_) {
432
537
  return arguments.length ? (this.schema.zoomPadding = _, this) : this.schema.zoomPadding;
433
538
  }
539
+ },
540
+ {
541
+ /**
542
+ An additional CSS class name (or space-separated list of class names) applied to the `<table>` element the table-view toggle renders, alongside the fixed `d3plus-table-view-table` class. Lets a host page style the data table with its own table styling (Tailwind, Bootstrap, a design system) via descendant selectors.
543
+ */ key: "tableViewClassName",
544
+ value: function tableViewClassName(_) {
545
+ return arguments.length ? (this.schema.tableViewClassName = _, this) : this.schema.tableViewClassName;
546
+ }
547
+ },
548
+ {
549
+ /**
550
+ An additional CSS class name (or space-separated list of class names) applied to the table-view toggle button, alongside the fixed `table-view-control`/`table-view-toggle` classes. Setting this automatically disables d3plus's built-in inline `tableViewControlStyle`/`tableViewControlStyleActive`/`tableViewControlStyleHover` defaults (as long as you haven't already customized them yourself), so a host page's own button styling applies through the cascade with no other configuration needed.
551
+ */ key: "tableViewControlClassName",
552
+ value: function tableViewControlClassName(_) {
553
+ return arguments.length ? (this.schema.tableViewControlClassName = _, this) : this.schema.tableViewControlClassName;
554
+ }
555
+ },
556
+ {
557
+ /**
558
+ An object containing CSS key/value pairs that is used to style the table-view toggle button. Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.tableViewControlClassName(...)` is set, unless you've explicitly customized this yourself.
559
+ */ key: "tableViewControlStyle",
560
+ value: function tableViewControlStyle(_) {
561
+ return arguments.length ? (this.schema.tableViewControlStyle = _, this) : this.schema.tableViewControlStyle;
562
+ }
563
+ },
564
+ {
565
+ /**
566
+ An object containing CSS key/value pairs that is used to style the table-view toggle button while it is active (showing the data table). Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.tableViewControlClassName(...)` is set, unless you've explicitly customized this yourself.
567
+ */ key: "tableViewControlStyleActive",
568
+ value: function tableViewControlStyleActive(_) {
569
+ return arguments.length ? (this.schema.tableViewControlStyleActive = _, this) : this.schema.tableViewControlStyleActive;
570
+ }
571
+ },
572
+ {
573
+ /**
574
+ An object containing CSS key/value pairs that is used to style the table-view toggle button on hover. Passing `false` will remove all default styling. Automatically skipped (as if `false`) once `.tableViewControlClassName(...)` is set, unless you've explicitly customized this yourself.
575
+ */ key: "tableViewControlStyleHover",
576
+ value: function tableViewControlStyleHover(_) {
577
+ return arguments.length ? (this.schema.tableViewControlStyleHover = _, this) : this.schema.tableViewControlStyleHover;
578
+ }
579
+ },
580
+ {
581
+ /**
582
+ The number of data-table rows shown per page while in table view. Set to `false` (or any non-positive number) to disable pagination and show every row on one page.
583
+ */ key: "tableViewPageSize",
584
+ value: function tableViewPageSize(_) {
585
+ return arguments.length ? (this.schema.tableViewPageSize = _, this) : this.schema.tableViewPageSize;
586
+ }
434
587
  }
435
588
  ]);
436
589
  return VizBase;
437
590
  }(VizBaseConfig);
438
591
  /**
439
592
  Second half of the fluent config accessors shared by every Viz chart
440
- (`loadingHTML` through `zoomPadding`), extending `VizBaseConfig` which
593
+ (`loadingHTML` through `tableViewPageSize`), extending `VizBaseConfig` which
441
594
  holds the first half. Split purely so each file stays under the
442
595
  `max-lines` budget; the methods remain real prototype methods, so
443
596
  `BaseClass.config()` reflection and polymorphic `this` chaining are