@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
@@ -0,0 +1,29 @@
1
+ /**
2
+ The "← Back" control's contribution to the shared top-left controls
3
+ panel (`topLeftControls.ts`) — visible only when the chart has
4
+ drill-down history to pop. Styled like the zoom/search controls: a real
5
+ `<button>` at the same 20px height, an SVG arrow icon (not a text
6
+ glyph), and no default background/border/color — a plain
7
+ browser-appearance button that lets native/host-page button chrome
8
+ show through, restylable via `.backControlStyle()`/
9
+ `.backControlClassName()` the same way zoom/search are.
10
+
11
+ Previously `backFeature` rendered "← Back" as an SVG text scene node in
12
+ its own margin-claiming row, with its click routed through
13
+ `Viz._routeSceneEvent`'s `interactionGroup === "back"` special case —
14
+ the only way to attach a click handler to a plain scene text node. As a
15
+ real button inside the shared `htmlOverlay` panel, its click instead
16
+ rides the same declarative delegated-events map every other top-left/
17
+ zoom control uses, and it claims no margin of its own — like zoom, it
18
+ floats over whatever's there, and content that needs to avoid it insets
19
+ around the whole panel via `topLeftControlsInset`.
20
+
21
+ @module
22
+ */
23
+ import type Viz from "../viz/Viz.js";
24
+ import type { Contribution } from "./topLeftControlsMarkup.js";
25
+ /** Paints the back button's inline style. There's no active/hover override — unlike zoom/search it's not a toggle, so it relies on the browser's native `:hover`, like their own hover default (`false`) already does. */
26
+ export declare function paintBackButton(viz: Viz, btn: HTMLElement): void;
27
+ /** The back button's markup: a real `<button>` (icon + visible "Back" text), so host-page button styling applies through the cascade once `backControlClassName` auto-disables the inline default. */
28
+ export declare function backControlsHtml(viz: Viz): string;
29
+ export declare function backContribution(viz: Viz): Contribution | null;
@@ -0,0 +1,45 @@
1
+ /**
2
+ Shared mechanics for a chart-chrome button's base/active/hover inline
3
+ styling — the resolve-and-paint algorithm zoom/search/back controls all
4
+ use identically. Each control still owns its OWN default style VALUES
5
+ and schema keys (`zoomControlStyle*` vs `searchControlStyle*` vs
6
+ `backControlStyle`) in its own module, so restyling one doesn't affect
7
+ another — only the mechanical part (which was three copy-pasted near-
8
+ duplicates) lives here.
9
+
10
+ @module
11
+ */
12
+ export type StyleObject = Record<string, string | number | undefined | null | false>;
13
+ export type ControlStyleValue = StyleObject | false | null | undefined;
14
+ /** `alignItems` / `align-items` → `align-items`, for `style.setProperty`. */
15
+ export declare const kebab: (key: string) => string;
16
+ /**
17
+ Fallbacks for CSS system colors a browser may not support yet: an
18
+ active-button default uses the OS accent color (Firefox, Safari), and
19
+ Chromium falls back to the text-selection highlight.
20
+ */
21
+ export declare const SYSTEM_COLOR_FALLBACKS: Record<string, string>;
22
+ /** Sets one style property, swapping an unsupported system color for its fallback. */
23
+ export declare function setControlStyle(el: HTMLElement, key: string, value: string): void;
24
+ /**
25
+ Resolves a `*ControlStyle`/`Active`/`Hover` value for painting. Setting
26
+ the matching `*ControlClassName` auto-disables whichever of the three is
27
+ still the untouched built-in default (identified by reference — the
28
+ caller's own default constant) so a host page's own button styling can
29
+ apply through the cascade without also requiring `.xControlStyle(false)`.
30
+ An explicit custom style object (a different reference) always wins,
31
+ className or not.
32
+ */
33
+ export declare function resolveControlStyle(value: ControlStyleValue, defaultValue: ControlStyleValue, classNameSet: boolean): StyleObject;
34
+ /**
35
+ Paints a control button's inline style for its current state: the base
36
+ style, then the hover style while hovered, then the active style while
37
+ its mode is on (so an active button reads as active even under the
38
+ cursor). Every property any of the three styles sets is cleared first,
39
+ so leaving a state fully undoes it.
40
+ */
41
+ export declare function paintControlButton(btn: HTMLElement, styles: {
42
+ base: StyleObject;
43
+ active?: StyleObject;
44
+ hover?: StyleObject;
45
+ }, hovered: boolean, isActive: boolean): void;
@@ -0,0 +1,19 @@
1
+ import type { FeatureModule } from "../features/features.js";
2
+ /**
3
+ @name minimapFeature
4
+ A small overview of the full scene, underneath the zoom-control panel,
5
+ with a draggable box showing the current viewport and a zoom-level
6
+ label — hidden at the chart's natural 1x view, shown once zoomed in.
7
+
8
+ Runs as a post-draw `FeatureModule` right after `zoomFeature` (needs its
9
+ `_zoomBehavior.translateExtent()`/`scaleExtent()` already configured for
10
+ this draw). Claims zero margin, like `zoomFeature` — it floats over the
11
+ existing chart area rather than pushing content around. The panel is
12
+ ALWAYS mounted whenever zoom + minimap are both enabled, regardless of
13
+ the current zoom level: the "hidden at 1x" gate lives inside the panel's
14
+ `onUpdate`, reading the LIVE transform on every repaint, so it hides/
15
+ shows correctly during any live pan/zoom gesture — not just on the next
16
+ full `.render()` (dragging the minimap itself, wheel-zooming, clicking a
17
+ zoom button, and brush-zooming all repaint outside the layout pipeline).
18
+ */
19
+ export declare const minimapFeature: FeatureModule;
@@ -0,0 +1,45 @@
1
+ /**
2
+ Markup, styling, and formatting for the minimap panel — mirrors
3
+ `zoomControlsMarkup.ts`'s shape for the zoom-control buttons.
4
+
5
+ @module
6
+ */
7
+ import type Viz from "../viz/Viz.js";
8
+ export type StyleObject = Record<string, string | number | undefined | null | false>;
9
+ /** The resolved outer / viewport / viewport-active / label styles for a chart. */
10
+ export declare function minimapStyles(viz: Viz): {
11
+ outer: StyleObject;
12
+ viewport: StyleObject;
13
+ viewportActive: StyleObject;
14
+ label: StyleObject;
15
+ };
16
+ /**
17
+ Paints one or more style layers onto an element, clearing the union of
18
+ their keys first so leaving a state (e.g. no longer dragging) fully
19
+ undoes it. Mirrors `paintZoomButton`'s clear-then-apply pattern in
20
+ `zoomControlsMarkup.ts`.
21
+ */
22
+ export declare function paintMinimapStyle(el: HTMLElement, ...layers: StyleObject[]): void;
23
+ /** Formats a zoom scale as a short label: `"2x"`, `"4.4x"`. */
24
+ export declare function formatZoomLabel(k: number): string;
25
+ /**
26
+ The minimap's static HTML skeleton — no baked-in geometry; `onUpdate`
27
+ positions the viewport box and label live on every repaint (see
28
+ `minimap.ts`), the same reason `zoomControlsHtml` bakes in everything
29
+ that CAN change (locale, className) but nothing here changes per-tick.
30
+ The viewport box is `tabindex="0"` so it's keyboard-focusable — arrow
31
+ keys nudge the pan, matching what the `aria-label` describes. No ARIA
32
+ `role`: a 2D pan target doesn't map onto any single widget role (a
33
+ `slider` is one-dimensional), so a plain focusable, labeled element is
34
+ the more honest choice over one implying unmet role semantics.
35
+
36
+ `minimapClassName` (documented as applying to all three elements — the
37
+ outer box, viewport box, and label) is appended to the viewport/label
38
+ classes here; the outer box gets it separately, in `minimap.ts`'s panel
39
+ `className`, since that one isn't part of this inner HTML string.
40
+ */
41
+ export declare function minimapHtml(viz: Viz): string;
42
+ /** Right inset shared with the zoom-control panel, so the two clusters' right edges line up. */
43
+ export declare const MINIMAP_RIGHT_INSET = 4;
44
+ /** Vertical gap between the zoom-control panel and the minimap beneath it. */
45
+ export declare const MINIMAP_GAP = 4;
@@ -0,0 +1,3 @@
1
+ import type Viz from "../viz/Viz.js";
2
+ import type { Contribution } from "./topLeftControlsMarkup.js";
3
+ export declare function searchContribution(viz: Viz): Contribution | null;
@@ -0,0 +1,111 @@
1
+ /**
2
+ Markup, styling, and event handlers for the search control (a toggle
3
+ button + an expanding text input) — the top-left counterpart to the
4
+ zoom-controls panel's buttons, contributed into the shared top-left
5
+ controls panel (`topLeftControls.ts`) alongside the back button. Kept as
6
+ its own module rather than folded into `zoomControlsMarkup.ts`/
7
+ `topLeftControlsMarkup.ts`: search is independent chrome a chart can mix
8
+ and match with zoom/back, so its styling knobs stay uncoupled from
9
+ theirs (matching the convention `zoomControlsMarkup.ts` itself notes for
10
+ why zoom and table-view don't share styling code).
11
+
12
+ @module
13
+ */
14
+ import type { DataPoint } from "@d3plus/data";
15
+ import type { SceneNode } from "@d3plus/render";
16
+ import type Viz from "../viz/Viz.js";
17
+ import { type StyleObject } from "./controlButtonStyle.js";
18
+ /** Search-open state is per-chart, read/written via `viz._searchOpen`. */
19
+ export declare function isSearchOpen(viz: Viz): boolean;
20
+ /** The resolved base / active / hover button styles for a chart — also the cheap, non-DOM basis for `searchContribution`'s `styleSignature` (see `Contribution.styleSignature`). */
21
+ export declare function searchButtonStyles(viz: Viz): {
22
+ base: StyleObject;
23
+ active: StyleObject;
24
+ hover: StyleObject;
25
+ };
26
+ /** Paints the search toggle button's inline style for its current state. Mirrors `paintZoomButton`. */
27
+ export declare function paintSearchButton(viz: Viz, btn: HTMLElement, hovered?: boolean): void;
28
+ /**
29
+ The input's inline style at rest (closed) vs. open — set directly by the
30
+ toggle click handler, never regenerated mid-typing. Open's right padding
31
+ reserves room for the clear button, which sits absolutely-positioned
32
+ INSIDE the input's own box (see `SEARCH_CLEAR_STYLE_SHOWN`) rather than
33
+ beside it, so typed text wraps short of it instead of running underneath.
34
+ */
35
+ export declare const SEARCH_INPUT_STYLE_CLOSED: Record<string, string>;
36
+ export declare const SEARCH_INPUT_STYLE_OPEN: Record<string, string>;
37
+ /**
38
+ The wrapper `.search-input-wrap` is the positioning context for both the
39
+ clear button (absolute, inside the input's own box) and the match-count
40
+ feedback (absolute, below it) — an `inline-block` with no explicit width
41
+ of its own, so it always shrink-wraps to the input's CURRENT width
42
+ (0 closed, 120px open) and the count box (`width: 100%`) automatically
43
+ matches it.
44
+ */
45
+ export declare const SEARCH_INPUT_WRAP_STYLE: Record<string, string>;
46
+ /** Applies the open/closed inline style directly to the input DOM node — no panel rebuild, so focus/cursor survive. */
47
+ export declare function applySearchInputOpenState(input: HTMLInputElement, open: boolean): void;
48
+ /** Shows/hides the clear button, directly on the DOM node — same no-rebuild pattern as the input's open state. */
49
+ export declare function applySearchClearVisible(btn: HTMLElement, visible: boolean): void;
50
+ /** Writes the match-count feedback's text/visibility directly onto the DOM node — visible whenever there's a term, regardless of whether it matched anything ("No Matches" is itself useful feedback). */
51
+ export declare function applySearchCount(viz: Viz, el: HTMLElement, hasTerm: boolean, index: number | undefined, total: number): void;
52
+ /**
53
+ The search control's markup: a toggle `<button>`, an `<input>`, a clear
54
+ (×) button, and a match-count span — all real elements so host-page
55
+ button/input styling applies through the cascade the same way zoom's
56
+ buttons do. Term/open state is baked in from `viz._searchTerm`/
57
+ `_searchOpen` so a full re-render (e.g. a resize or data change)
58
+ preserves whatever the user was doing — typing itself never regenerates
59
+ this markup (see `searchControls.ts`).
60
+
61
+ The count span is left EMPTY here on purpose — its text is written by
62
+ `searchContribution`'s `onUpdate` instead (see there), not baked into
63
+ this string. `onUpdate` runs on every draw regardless of whether this
64
+ html string changed, while the match count itself depends on the
65
+ CHART's data/scene, not on the search box's own state — baking its text
66
+ in here would make this contribution's own html change (and its DOM,
67
+ including the live `<input>`, get torn down and rebuilt) every time the
68
+ chart's data changes for a reason that has nothing to do with search,
69
+ e.g. drilling down while the box is open and focused.
70
+ */
71
+ export declare function searchControlsHtml(viz: Viz): string;
72
+ /**
73
+ Builds the predicate `.highlight()` drives from the current search term
74
+ — see `matchesSearchNeedle` for the match rule. Empty term restores
75
+ whatever `.highlight()` predicate (if any) was active before the search
76
+ box opened.
77
+ */
78
+ export declare function searchHighlightPredicate(viz: Viz, term: string): ((d: DataPoint, i: number) => boolean) | false;
79
+ /** One matching mark: its scene node (for `.key`/geometry), the unwrapped source row, and its index. */
80
+ export interface SearchMatch {
81
+ node: SceneNode;
82
+ row: DataPoint;
83
+ index: number;
84
+ }
85
+ /**
86
+ Every currently-rendered mark matching the given term, in scene order.
87
+ Walks `viz._chartScene` (the actual painted scene, post-layout) rather
88
+ than the raw data array, unwrapping each node's datum the same way
89
+ `applyInteractionOpacity` does, so a grouped/aggregated chart matches by
90
+ rendered mark, not by raw input row — and de-dupes by datum reference so
91
+ a mark's separate label node doesn't double-count it. An empty term
92
+ matches nothing (there's no "everything" state to jump through).
93
+ */
94
+ export declare function searchMatches(viz: Viz, term: string): SearchMatch[];
95
+ /**
96
+ Formats the match-count feedback as a readable, localized phrase:
97
+ "No Matches" with nothing found, "6 Matches"/"1 Match" once there's a
98
+ count but the user hasn't stepped to one yet (Enter/Shift+Enter), and
99
+ "Match 2/6" once they have — the translated noun for context, plus a
100
+ compact numeric position rather than a translated "of" connector, since
101
+ a fixed English word order ("Match 2 of 6") wouldn't read naturally in
102
+ every locale, while a number pair after a noun does. `index` is 0-based
103
+ (`viz._searchMatchIndex`); `total` is `searchMatches(...).length`. Text
104
+ and label are the same string — both visible and accessible.
105
+ */
106
+ export declare function formatMatchCount(viz: Viz, index: number | undefined, total: number): {
107
+ text: string;
108
+ label: string;
109
+ };
110
+ /** Whether a chart shows the search control. */
111
+ export declare function showsSearchControls(viz: Viz): boolean;
@@ -0,0 +1,23 @@
1
+ import type { FeatureModule } from "../features/features.js";
2
+ import type Viz from "../viz/Viz.js";
3
+ export declare function toggleTableView(viz: Viz): void;
4
+ export declare function changeTableViewPage(viz: Viz, dir: number): void;
5
+ /**
6
+ Clicking a column header: the same column toggles asc ↔ desc; a
7
+ different column starts at asc. Resets to page 0 — re-sorting while deep
8
+ in the pagination would otherwise strand the user on a page whose
9
+ contents just changed out from under them.
10
+ */
11
+ export declare function changeTableViewSort(viz: Viz, column: string): void;
12
+ /**
13
+ Clicking the raw/aggregate toggle (`dataSourceButtonHtml` — only
14
+ rendered when the two actually differ). Resets to page 0, same reasoning
15
+ as `changeTableViewSort`: the row count itself changes underneath
16
+ whatever page was showing. Sort state is left alone — raw and aggregate
17
+ can have different column sets (an aggregate merge may add a computed
18
+ field the raw rows don't have, e.g. Pie's "share"), and
19
+ `sortedTableViewRows` already no-ops a sort whose column isn't among the
20
+ new source's columns, so there's nothing to actively reconcile.
21
+ */
22
+ export declare function toggleTableViewDataSource(viz: Viz): void;
23
+ export declare const tableViewFeature: FeatureModule;
@@ -0,0 +1,21 @@
1
+ /**
2
+ The table-view toggle's contribution to the shared top-left controls
3
+ panel (`topLeftControls.ts`) — the button that switches the chart to a
4
+ static, scrollable data table (`tableView.ts` owns the actual overlay).
5
+
6
+ Unlike `backContribution` (only shows with drill-down history), this one
7
+ contributes as long as `tableView` is enabled — REGARDLESS of whether
8
+ table view is currently active. While active, `tableView.ts`'s
9
+ chart-sized overlay panel paints on top of the entire chart (including
10
+ this shared panel), so this button becomes invisible and unreachable by
11
+ real pointer hit-testing; the overlay embeds its own copy of the same
12
+ button (see `tableViewOverlayHtml`) for the user to actually click to
13
+ switch back. Keeping this contribution constant means toggling table
14
+ view never has to touch the shared panel's composition — only the
15
+ separate overlay panel appears/disappears.
16
+
17
+ @module
18
+ */
19
+ import type Viz from "../viz/Viz.js";
20
+ import type { Contribution } from "./topLeftControlsMarkup.js";
21
+ export declare function tableViewContribution(viz: Viz): Contribution | null;
@@ -0,0 +1,119 @@
1
+ /**
2
+ Markup, styling, and state helpers for the table-view toggle button + the
3
+ data-table overlay it swaps in (sorting, CSV export, pagination).
4
+
5
+ The button's html (`tableViewButtonHtml`) is consumed two ways: as
6
+ `tableViewContribution`'s piece of the shared top-left controls panel
7
+ (`tableViewControl.ts`) while the chart is showing, and embedded at the
8
+ top of the full-chart data-table overlay (`tableView.ts`) while table
9
+ view is active — so a click there can toggle back. Kept as its own
10
+ module (rather than folded into `zoomControlsMarkup.ts`) because the two
11
+ features are independent chrome a chart can mix and match; sharing
12
+ styling *knobs* (config keys, defaults) between them would couple them
13
+ for no benefit. The button-painting *mechanism* is genuinely
14
+ feature-agnostic, though — `paintControlButton`/`resolveControlStyle`
15
+ come from the shared `controlButtonStyle.ts` (also used by zoom/back/
16
+ search), the same way `zoomControlsInset` and `topLeftControlsInset`
17
+ share the box-measuring pattern without sharing what they measure.
18
+ `overlayHost` is reused from `zoomControlsMarkup.ts`.
19
+
20
+ @module
21
+ */
22
+ import type { DataPoint } from "@d3plus/data";
23
+ import type Viz from "../viz/Viz.js";
24
+ /** Table-view mode is per-chart state, read/written via `viz._tableView`. */
25
+ export declare function isTableView(viz: Viz): boolean;
26
+ export declare function setTableView(viz: Viz, value: boolean): void;
27
+ /** The current page (0-indexed) of the paginated data table. */
28
+ export declare function getTableViewPage(viz: Viz): number;
29
+ export declare function setTableViewPage(viz: Viz, value: number): void;
30
+ export type SortDirection = "asc" | "desc";
31
+ export interface TableViewSort {
32
+ column: string;
33
+ direction: SortDirection;
34
+ }
35
+ /** The data table's current sort column + direction, if any (`viz._tableViewSort`). */
36
+ export declare function getTableViewSort(viz: Viz): TableViewSort | undefined;
37
+ export declare function setTableViewSort(viz: Viz, value: TableViewSort | undefined): void;
38
+ export type TableViewDataSource = "raw" | "aggregate";
39
+ /** Which dataset the table currently shows: `viz._data` (raw) or `viz._filteredData` (aggregate, the default — matches the chart's own on-screen behavior). */
40
+ export declare function getTableViewDataSource(viz: Viz): TableViewDataSource;
41
+ export declare function setTableViewDataSource(viz: Viz, value: TableViewDataSource): void;
42
+ /** Paints the table-view button's inline style for its current state (base/hover/active) — see `paintControlButton`. */
43
+ export declare function paintTableViewButton(viz: Viz, btn: HTMLElement, hovered?: boolean): void;
44
+ /** The cheap, non-DOM signature capturing the button's resolved style — see `Contribution.styleSignature`. */
45
+ export declare function tableViewButtonStyleSignature(viz: Viz): string;
46
+ /** The toggle button's markup — a real `<button>` so host-page button styling applies once `tableViewControlClassName` disables the inline defaults. */
47
+ export declare function tableViewButtonHtml(viz: Viz): string;
48
+ /**
49
+ The chart's current data-table rows and their columns (the union of
50
+ every row's own keys — see `allColumns`), sorted per
51
+ `viz._tableViewSort` when set. Shared by the on-screen table (which
52
+ further paginates this) and CSV export (which exports it in full,
53
+ unpaginated) — both automatically follow whichever data source
54
+ `dataSourceButtonHtml`'s toggle currently selects.
55
+
56
+ Source: `viz._filteredData` (aggregate — what's actually charted) by
57
+ default, or `viz._data` (raw, untouched input) once the toggle picks
58
+ "raw" — guarded by `hasDistinctRawData` so a stale `_tableViewDataSource`
59
+ from a previous, genuinely-different dataset can't silently switch a
60
+ chart whose raw/aggregate happen to now coincide.
61
+
62
+ Absent an explicit column sort, the AGGREGATE source is further
63
+ reordered (`defaultRowOrder`) to match the chart's original `.data()`
64
+ insertion order — raw is already in that order by definition, so it's
65
+ skipped there.
66
+ */
67
+ export declare function sortedTableViewRows(viz: Viz): {
68
+ rows: DataPoint[];
69
+ columns: string[];
70
+ };
71
+ /** One page of rows, clamped/derived from `tableViewPageSize` + the current `_tableViewPage`. Clamps and writes back the page so it can't drift out of range as data/sort changes. Exported so `setupTableViewVirtualization` can re-derive the identical slice `tableViewOverlayHtml` built. */
72
+ export declare function paginate(viz: Viz, rows: DataPoint[]): {
73
+ slice: DataPoint[];
74
+ page: number;
75
+ totalPages: number;
76
+ start: number;
77
+ end: number;
78
+ total: number;
79
+ };
80
+ /** Whether a chart shows the table-view toggle button. */
81
+ export declare function showsTableView(viz: Viz): boolean;
82
+ /**
83
+ The full data-table overlay's markup: a toolbar (the toggle button, —
84
+ unless disabled — a "download CSV" button, and — only when raw and
85
+ aggregate data actually differ — the raw/aggregate source toggle), a
86
+ scrollable table with a sticky, click-to-sort header, and — when the
87
+ data doesn't fit on one page — Prev/Next pagination. Columns come from
88
+ the union of every row's own keys; every value is escaped, since it's
89
+ caller-supplied data landing in `innerHTML`.
90
+ */
91
+ export declare function tableViewOverlayHtml(viz: Viz): string;
92
+ /** Builds the CSV and triggers a browser download of the chart's full (sorted, unpaginated) data-table rows. */
93
+ export declare function downloadTableViewCsv(viz: Viz): void;
94
+ /**
95
+ Paints every `.table-view-control` button's inline style (base/active,
96
+ plus hover — which can't be delegated like click, since mouseenter/
97
+ mouseleave don't bubble) once per button DOM node, guarded by
98
+ `data-table-view-bound` the same way `buildZoomControlPanel`'s
99
+ `onUpdate` guards its four buttons. Shared by `tableViewContribution`
100
+ (the shared top-left panel's lone toggle button) and `tableView.ts`'s
101
+ full overlay (whose toolbar has both the toggle and the download button).
102
+ */
103
+ export declare function bindTableViewButton(host: HTMLElement, viz: Viz): void;
104
+ /** Wires both the toolbar buttons and (when applicable) row virtualization for the full data-table overlay. */
105
+ export declare function bindTableViewOverlay(host: HTMLElement, viz: Viz): void;
106
+ /**
107
+ Reflects the current active state onto the shared top-left panel's
108
+ toggle button DOM directly — mirrors `syncBrushButton`. Needed because
109
+ toggling table view deliberately does NOT rebuild the shared panel (see
110
+ `refreshTableViewOverlay` in `tableView.ts`: `tableViewContribution`'s
111
+ html bakes in `isTableView(viz)` at the time THAT panel was last built,
112
+ which only happens on a full `_preDraw`/`_draw` pass). Without this, the
113
+ shared panel's copy of the button can go visibly stale: activate table
114
+ view, let any unrelated full re-render happen while still active (a
115
+ resize, a `.data()` call), then deactivate via the overlay's OWN
116
+ embedded copy of the button — the shared one, now uncovered again,
117
+ would otherwise still read "active" until the next full re-render.
118
+ */
119
+ export declare function syncSharedTableViewButton(viz: Viz): void;
@@ -0,0 +1,32 @@
1
+ /**
2
+ @name topLeftControlsFeature
3
+ Shared top-left corner control panel — mirrors the top-right
4
+ zoom-controls panel's "N buttons, one flex-row `htmlOverlay` panel"
5
+ composition (`zoomControls.ts`/`zoomControlsMarkup.ts`), except fed by
6
+ independent contributor functions (`backContribution`,
7
+ `tableViewContribution`, `searchContribution`) rather than one feature's
8
+ own fixed button set. A downstream branch adding a new top-left control
9
+ appends its own contributor function to `TOP_LEFT_CONTRIBUTORS` — a
10
+ one-line diff, not a dynamic registry.
11
+
12
+ Runs as a post-draw `FeatureModule` (see `runVizPipeline`), the same
13
+ slot as `zoomFeature`/`attributionFeature`: it claims zero margin and
14
+ floats over whatever the chart already rendered. Content that needs to
15
+ avoid it (title/subtitle/total/legend) insets around the whole panel via
16
+ `topLeftControlsInset` (`topLeftControlsMarkup.ts`), the same way they
17
+ already inset around the zoom panel via `zoomControlsInset`.
18
+
19
+ @module
20
+ */
21
+ import type { FeatureModule } from "../features/features.js";
22
+ import type Viz from "../viz/Viz.js";
23
+ import { type Contribution } from "./topLeftControlsMarkup.js";
24
+ export type { Contribution };
25
+ /**
26
+ Ordered list of contributors to the shared top-left panel. Order is
27
+ visual order (left to right).
28
+ */
29
+ export declare const TOP_LEFT_CONTRIBUTORS: Array<(viz: Viz) => Contribution | null>;
30
+ /** The current, non-null contributions for a chart — computed once per layout/measurement. */
31
+ export declare function getTopLeftContributions(viz: Viz): Contribution[];
32
+ export declare const topLeftControlsFeature: FeatureModule;
@@ -0,0 +1,72 @@
1
+ /**
2
+ Markup, styling, and measurement for the shared top-left controls panel —
3
+ the top-left mirror of `zoomControlsMarkup.ts`'s top-right zoom-control
4
+ panel. Kept separate from `topLeftControls.ts` (which owns the
5
+ `FeatureModule` + the contributor list) so this module has no dependency
6
+ on `../features/features.js` — `textBlockLayout`/`featuresLegend.ts`
7
+ import only from here, the same way they already import
8
+ `zoomControlsBox`/`zoomControlsInset` from `zoomControlsMarkup.ts` rather
9
+ than from `zoomControls.ts`.
10
+
11
+ @module
12
+ */
13
+ import type { SceneNode } from "@d3plus/render";
14
+ import type Viz from "../viz/Viz.js";
15
+ /**
16
+ One control's contribution to the shared panel: its markup, its
17
+ delegated event handlers (keyed by its own CSS selector, so independent
18
+ contributors never collide), and an optional `onUpdate` for listeners
19
+ that can't be delegated (mirrors `HtmlOverlayNode`'s own shape — see
20
+ `zoomControls.ts`'s `buildZoomControlPanel` for the pattern this panel
21
+ generalizes from one feature's four buttons to N independent features).
22
+ */
23
+ export interface Contribution {
24
+ key: string;
25
+ html: string;
26
+ /**
27
+ A cheap, non-DOM string capturing anything besides `html` that can
28
+ change this contribution's rendered size — its resolved button style
29
+ object, typically (`JSON.stringify(...)`, mirroring how
30
+ `zoomControlsBox` folds its own resolved style into its signature).
31
+ Without this, a style-only change (e.g. `.searchControlStyle({width:
32
+ '60px'})`) wouldn't invalidate the measurement cache below, since the
33
+ *markup* (`html`) wouldn't have changed. Optional: a contribution
34
+ whose rendered size never varies with config can omit it.
35
+ */
36
+ styleSignature?: string;
37
+ events?: Record<string, Partial<Record<string, (e: Event) => void>>>;
38
+ onUpdate?: (host: HTMLElement) => void;
39
+ }
40
+ /**
41
+ Builds the shared panel as a GROUP of independent `htmlOverlay` nodes,
42
+ one per contribution, rather than one node holding every contribution's
43
+ markup concatenated together. `@d3plus/render`'s overlay diff replaces
44
+ an `htmlOverlay` node's ENTIRE `innerHTML` whenever its `html` string
45
+ changes — with one shared node, back appearing (its own html changing)
46
+ would rewrite the whole panel's DOM, destroying and recreating search's
47
+ `<input>` along with it and silently dropping its focus/cursor position
48
+ mid-type. Separate nodes mean each contribution's DOM subtree is only
49
+ ever touched by ITS OWN html changing.
50
+ */
51
+ export declare function buildTopLeftPanel(viz: Viz, contributions: Contribution[]): SceneNode | null;
52
+ /**
53
+ The shared top-left panel's rendered size (padding included) as it will
54
+ render in the chart's page, so top-positioned content can leave room for
55
+ it — the same measure-a-hidden-probe technique `zoomControlsBox` uses,
56
+ generalized to whichever mix of controls (back / table-view / search)
57
+ is currently contributing, and to each contribution's OWN resolved
58
+ button styling (not just its markup). Returns null when nothing is
59
+ contributing.
60
+ */
61
+ export declare function topLeftControlsBox(viz: Viz, contributions: Contribution[]): {
62
+ width: number;
63
+ height: number;
64
+ } | null;
65
+ /**
66
+ How far content starting `top` px down the chart, whose left edge sits
67
+ `left` px in from the chart's left edge, must pull in its left edge to
68
+ clear the top-left controls panel. Zero when nothing is showing there or
69
+ content starts below the panel's height. Mirrors `zoomControlsInset`,
70
+ measuring/insetting from the left instead of the right.
71
+ */
72
+ export declare function topLeftControlsInset(viz: Viz, top: number, left: number, contributions: Contribution[]): number;
@@ -1,4 +1,6 @@
1
+ import type { ZoomTransform } from "d3-zoom";
1
2
  import type { FeatureModule } from "../features/features.js";
3
+ import type Viz from "../viz/Viz.js";
2
4
  /**
3
5
  @name zoomFeature
4
6
  Sets up zoom + brush event behaviors and the zoom-control buttons.
@@ -15,13 +17,51 @@ import type { FeatureModule } from "../features/features.js";
15
17
  the SVG element directly via `viz._container.call(zoomBehavior)`.
16
18
  2. Returns the four control buttons (in/out/reset/brush) as an
17
19
  `htmlOverlay` scene-node panel; `runVizPipeline` appends it to
18
- `viz._featurePanels`. `onMount` is
19
- the scene's interactive-HTML escape hook: it wires the click/hover
20
- handlers + applies the user's zoomControl style configs. `onMount`
21
- fires ONCE per host element (after innerHTML is written, so the
22
- `.zoom-in` / `.zoom-out` querySelectors below resolve), not per
23
- draw — the html string is constant, so listeners attached here
24
- survive every subsequent draw (renderers only rewrite innerHTML
25
- when it differs from the current value).
20
+ `viz._featurePanels`. `onUpdate` is the scene's interactive-HTML
21
+ escape hook: it wires the hover handlers + applies the user's
22
+ zoomControl style configs, once per button DOM node (guarded by a
23
+ `data-zoom-bound` marker). Click handling instead rides the
24
+ declarative `events` map, which the renderer delegates from the
25
+ host element, so it survives DOM churn with no extra bookkeeping.
26
+ `onUpdate` (rather than `onMount`) matters because the html string
27
+ below isn't a fixed constant — it bakes in `zoomControlClassName`,
28
+ the active locale's translated `aria-label`s, and the current brush
29
+ state, so a `.locale(...)` or `.zoomControlClassName(...)` call
30
+ replaces the button nodes on the next draw. Renderers only rewrite
31
+ `innerHTML` when the string actually differs from the last-written
32
+ value, so the common case (nothing changed) is a cheap no-op.
26
33
  */
27
34
  export declare const zoomFeature: FeatureModule;
35
+ /**
36
+ Canvas backend: once the scene is painted (so the <canvas> exists), bind
37
+ d3-zoom to it. The compute <svg> overlaying the canvas is transparent to
38
+ pointer events there, so the canvas is the sole interaction surface —
39
+ CanvasRenderer's pick drives tooltips and d3-zoom drives pan/zoom on the
40
+ same element. Called after every canvas paint; a no-op once bound.
41
+ */
42
+ export declare function bindCanvasZoom(viz: Viz): void;
43
+ /**
44
+ Routes pointer events between the chart surface and the zoom brush.
45
+ While brush mode is on, the outer <svg> goes transparent to pointer
46
+ events and only the brush group opts back in, so a drag anywhere over the
47
+ chart (shapes included) reaches the brush rather than a shape. On the
48
+ Canvas backend the compute <svg> stays transparent otherwise, so the
49
+ <canvas> beneath is the interaction surface.
50
+ */
51
+ export declare function applyZoomPointerEvents(viz: Viz): void;
52
+ /**
53
+ The current zoom transform re-expressed for content inside `_container`,
54
+ which sits at the chart's margin offset rather than at the surface origin
55
+ the zoom behavior measures from (Geomap's imperative tile layer).
56
+ */
57
+ export declare function tileZoomTransform(viz: Viz): ZoomTransform;
58
+ /**
59
+ Applies a programmatic zoom: clamps the scale to `scaleExtent` and the
60
+ translate to `translateExtent` (the constraint d3-zoom enforces for
61
+ pointer gestures), records it as the bound element's zoom state so the
62
+ next wheel/drag continues from here, and paints it.
63
+
64
+ Exported so `minimap.ts`'s drag-to-pan and Cmd/Ctrl+scroll-to-zoom can
65
+ reuse the same scale/translate clamping instead of reimplementing it.
66
+ */
67
+ export declare function zoomTo(viz: Viz, scale: number, x: number, y: number, duration?: number): void;