@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.
- package/README.md +1820 -714
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/internal.js +7 -1
- package/es/internal.js.map +1 -1
- package/es/src/charts/AreaPlot/index.js +1 -2
- package/es/src/charts/AreaPlot/index.js.map +1 -1
- package/es/src/charts/BarChart/index.js +1 -2
- package/es/src/charts/BarChart/index.js.map +1 -1
- package/es/src/charts/BoxWhisker/index.js +1 -2
- package/es/src/charts/BoxWhisker/index.js.map +1 -1
- package/es/src/charts/BumpChart/index.js +1 -2
- package/es/src/charts/BumpChart/index.js.map +1 -1
- package/es/src/charts/Chord/applyLayout.js +205 -0
- package/es/src/charts/Chord/applyLayout.js.map +1 -0
- package/es/src/charts/Chord/emit.js +168 -0
- package/es/src/charts/Chord/emit.js.map +1 -0
- package/es/src/charts/Chord/index.js +234 -0
- package/es/src/charts/Chord/index.js.map +1 -0
- package/es/src/charts/Geomap/basemapTheme.js +78 -0
- package/es/src/charts/Geomap/basemapTheme.js.map +1 -0
- package/es/src/charts/Geomap/emit.js +18 -9
- package/es/src/charts/Geomap/emit.js.map +1 -1
- package/es/src/charts/Geomap/index.js +69 -104
- package/es/src/charts/Geomap/index.js.map +1 -1
- package/es/src/charts/LinePlot/index.js +1 -2
- package/es/src/charts/LinePlot/index.js.map +1 -1
- package/es/src/charts/Matrix/emit.js +6 -0
- package/es/src/charts/Matrix/emit.js.map +1 -1
- package/es/src/charts/Matrix/index.js +1 -2
- package/es/src/charts/Matrix/index.js.map +1 -1
- package/es/src/charts/Network/emit.js +58 -24
- package/es/src/charts/Network/emit.js.map +1 -1
- package/es/src/charts/Network/index.js +34 -54
- package/es/src/charts/Network/index.js.map +1 -1
- package/es/src/charts/Pack/emit.js +3 -0
- package/es/src/charts/Pack/emit.js.map +1 -1
- package/es/src/charts/Pack/index.js +1 -2
- package/es/src/charts/Pack/index.js.map +1 -1
- package/es/src/charts/Pie/emit.js +6 -2
- package/es/src/charts/Pie/emit.js.map +1 -1
- package/es/src/charts/Pie/index.js +1 -2
- package/es/src/charts/Pie/index.js.map +1 -1
- package/es/src/charts/Plot/index.js +26 -6
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +1 -2
- package/es/src/charts/Plot/pipeline.js.map +1 -1
- package/es/src/charts/Plot/plotZoom.js +278 -0
- package/es/src/charts/Plot/plotZoom.js.map +1 -0
- package/es/src/charts/Priestley/emit.js +4 -0
- package/es/src/charts/Priestley/emit.js.map +1 -1
- package/es/src/charts/Priestley/index.js +1 -2
- package/es/src/charts/Priestley/index.js.map +1 -1
- package/es/src/charts/Radar/emit.js +4 -1
- package/es/src/charts/Radar/emit.js.map +1 -1
- package/es/src/charts/Radar/index.js +1 -2
- package/es/src/charts/Radar/index.js.map +1 -1
- package/es/src/charts/RadialMatrix/emit.js +6 -0
- package/es/src/charts/RadialMatrix/emit.js.map +1 -1
- package/es/src/charts/RadialMatrix/index.js +1 -2
- package/es/src/charts/RadialMatrix/index.js.map +1 -1
- package/es/src/charts/Rings/emit.js +74 -8
- package/es/src/charts/Rings/emit.js.map +1 -1
- package/es/src/charts/Rings/index.js +11 -3
- package/es/src/charts/Rings/index.js.map +1 -1
- package/es/src/charts/Sankey/emit.js +55 -11
- package/es/src/charts/Sankey/emit.js.map +1 -1
- package/es/src/charts/Sankey/index.js +8 -2
- package/es/src/charts/Sankey/index.js.map +1 -1
- package/es/src/charts/StackedArea/index.js +1 -2
- package/es/src/charts/StackedArea/index.js.map +1 -1
- package/es/src/charts/Tree/emit.js +8 -2
- package/es/src/charts/Tree/emit.js.map +1 -1
- package/es/src/charts/Tree/index.js +1 -2
- package/es/src/charts/Tree/index.js.map +1 -1
- package/es/src/charts/Treemap/index.js +1 -2
- package/es/src/charts/Treemap/index.js.map +1 -1
- package/es/src/charts/definition/ChartDefinition.js.map +1 -1
- package/es/src/charts/drawSteps/backControl.js +70 -0
- package/es/src/charts/drawSteps/backControl.js.map +1 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js +108 -0
- package/es/src/charts/drawSteps/controlButtonStyle.js.map +1 -0
- package/es/src/charts/drawSteps/minimap.js +370 -0
- package/es/src/charts/drawSteps/minimap.js.map +1 -0
- package/es/src/charts/drawSteps/minimapMarkup.js +147 -0
- package/es/src/charts/drawSteps/minimapMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/searchControls.js +358 -0
- package/es/src/charts/drawSteps/searchControls.js.map +1 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js +430 -0
- package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/tableView.js +173 -0
- package/es/src/charts/drawSteps/tableView.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewControl.js +39 -0
- package/es/src/charts/drawSteps/tableViewControl.js.map +1 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js +647 -0
- package/es/src/charts/drawSteps/tableViewMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControls.js +73 -0
- package/es/src/charts/drawSteps/topLeftControls.js.map +1 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js +227 -0
- package/es/src/charts/drawSteps/topLeftControlsMarkup.js.map +1 -0
- package/es/src/charts/drawSteps/zoomControls.js +314 -175
- package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
- package/es/src/charts/drawSteps/zoomControlsMarkup.js +280 -0
- package/es/src/charts/drawSteps/zoomControlsMarkup.js.map +1 -0
- package/es/src/charts/features/attributionFeature.js +137 -0
- package/es/src/charts/features/attributionFeature.js.map +1 -0
- package/es/src/charts/features/axes.js +20 -8
- package/es/src/charts/features/axes.js.map +1 -1
- package/es/src/charts/features/chartGeometry.js +16 -2
- package/es/src/charts/features/chartGeometry.js.map +1 -1
- package/es/src/charts/features/edgeArrows.js +155 -0
- package/es/src/charts/features/edgeArrows.js.map +1 -0
- package/es/src/charts/features/emitHelpers.js +8 -0
- package/es/src/charts/features/emitHelpers.js.map +1 -1
- package/es/src/charts/features/ensureZoomDom.js +63 -12
- package/es/src/charts/features/ensureZoomDom.js.map +1 -1
- package/es/src/charts/features/features.js +83 -110
- package/es/src/charts/features/features.js.map +1 -1
- package/es/src/charts/features/featuresLegend.js +45 -17
- package/es/src/charts/features/featuresLegend.js.map +1 -1
- package/es/src/charts/features/plotPaint.js +32 -7
- package/es/src/charts/features/plotPaint.js.map +1 -1
- package/es/src/charts/features/zoomExtent.js +185 -0
- package/es/src/charts/features/zoomExtent.js.map +1 -0
- package/es/src/charts/helpers/tileAttributions.js +26 -0
- package/es/src/charts/helpers/tileAttributions.js.map +1 -1
- package/es/src/charts/index.js +1 -0
- package/es/src/charts/index.js.map +1 -1
- package/es/src/charts/pipeline/runVizPipeline.js +33 -14
- package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
- package/es/src/charts/pipeline/vizDrawPure.js +32 -6
- package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
- package/es/src/charts/viz/Viz.js +39 -51
- package/es/src/charts/viz/Viz.js.map +1 -1
- package/es/src/charts/viz/VizBase.js +157 -4
- package/es/src/charts/viz/VizBase.js.map +1 -1
- package/es/src/charts/viz/VizBaseConfig.js +32 -2
- package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +243 -50
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizTypes.js.map +1 -1
- package/es/src/components/Axis/Axis.js +10 -1
- package/es/src/components/Axis/Axis.js.map +1 -1
- package/es/src/components/Axis/axisLayoutLabels.js +2 -1
- package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
- package/es/src/components/Axis/axisRender.js +5 -1
- package/es/src/components/Axis/axisRender.js.map +1 -1
- package/es/src/components/Legend/legendConfig.js +86 -20
- package/es/src/components/Legend/legendConfig.js.map +1 -1
- package/es/src/utils/D3plusConfig.js.map +1 -1
- package/package.json +11 -10
- package/types/index.d.ts +1 -1
- package/types/internal.d.ts +8 -1
- package/types/src/charts/Chord/applyLayout.d.ts +43 -0
- package/types/src/charts/Chord/emit.d.ts +10 -0
- package/types/src/charts/Chord/index.d.ts +19 -0
- package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
- package/types/src/charts/Plot/index.d.ts +12 -3
- package/types/src/charts/Plot/plotZoom.d.ts +65 -0
- package/types/src/charts/definition/ChartDefinition.d.ts +3 -1
- package/types/src/charts/drawSteps/backControl.d.ts +29 -0
- package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
- package/types/src/charts/drawSteps/minimap.d.ts +19 -0
- package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
- package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
- package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
- package/types/src/charts/drawSteps/tableView.d.ts +23 -0
- package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
- package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
- package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
- package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
- package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
- package/types/src/charts/features/attributionFeature.d.ts +21 -0
- package/types/src/charts/features/axes.d.ts +1 -1
- package/types/src/charts/features/chartGeometry.d.ts +9 -3
- package/types/src/charts/features/edgeArrows.d.ts +92 -0
- package/types/src/charts/features/emitHelpers.d.ts +11 -0
- package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
- package/types/src/charts/features/features.d.ts +32 -17
- package/types/src/charts/features/featuresLegend.d.ts +15 -0
- package/types/src/charts/features/plotPaint.d.ts +15 -2
- package/types/src/charts/features/zoomExtent.d.ts +25 -0
- package/types/src/charts/index.d.ts +1 -0
- package/types/src/charts/pipeline/runVizPipeline.d.ts +6 -3
- package/types/src/charts/viz/VizBase.d.ts +86 -4
- package/types/src/charts/viz/VizBaseConfig.d.ts +20 -2
- package/types/src/charts/viz/vizDefaults.d.ts +155 -0
- package/types/src/charts/viz/vizTypes.d.ts +57 -1
- package/types/src/components/Axis/Axis.d.ts +2 -0
- package/types/src/utils/D3plusConfig.d.ts +102 -8
- package/umd/d3plus-core.full.js +39613 -35374
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5747 -4361
- package/umd/d3plus-core.js +13132 -9289
- package/umd/d3plus-core.js.map +1 -1
- 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,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`. `
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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;
|