@d3plus/core 4.2.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2137 -953
- 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 +58 -9
- package/es/src/charts/Geomap/emit.js.map +1 -1
- package/es/src/charts/Geomap/index.js +93 -99
- 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 +99 -4
- package/es/src/charts/Plot/index.js.map +1 -1
- package/es/src/charts/Plot/pipeline.js +25 -5
- 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/shapeEmit.js +3 -1
- package/es/src/charts/features/shapeEmit.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 +102 -61
- 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/interactionOpacity.js +4 -1
- package/es/src/charts/viz/interactionOpacity.js.map +1 -1
- package/es/src/charts/viz/vizDefaults.js +247 -51
- package/es/src/charts/viz/vizDefaults.js.map +1 -1
- package/es/src/charts/viz/vizRender.js +7 -3
- package/es/src/charts/viz/vizRender.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/shapes/Shape.js +12 -10
- package/es/src/shapes/Shape.js.map +1 -1
- package/es/src/shapes/hitAreaNode.js +31 -5
- package/es/src/shapes/hitAreaNode.js.map +1 -1
- package/es/src/shapes/interactionPoints.js +30 -0
- package/es/src/shapes/interactionPoints.js.map +1 -0
- 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 +32 -2
- package/types/src/charts/Plot/pipeline.d.ts +2 -1
- 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/Viz.d.ts +31 -1
- 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 +75 -1
- package/types/src/components/Axis/Axis.d.ts +2 -0
- package/types/src/shapes/Shape.d.ts +2 -2
- package/types/src/shapes/hitAreaNode.d.ts +5 -4
- package/types/src/shapes/interactionPoints.d.ts +15 -0
- package/types/src/utils/D3plusConfig.d.ts +102 -8
- package/umd/d3plus-core.full.js +39793 -34875
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +5836 -4264
- package/umd/d3plus-core.js +13998 -9927
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +3716 -2264
|
@@ -93,7 +93,10 @@ import { activeBucketColors } from "../features/colorScaleBucket.js";
|
|
|
93
93
|
var paint = _object_spread({}, (_node_paint = node.paint) !== null && _node_paint !== void 0 ? _node_paint : {});
|
|
94
94
|
var base = typeof paint.fill === "string" ? paint.fill : undefined;
|
|
95
95
|
if (!base || base === "transparent" || base === "none") base = typeof paint.stroke === "string" ? paint.stroke : undefined;
|
|
96
|
-
|
|
96
|
+
// No visible paint to emphasize (e.g. an invisible hit-area node): leave it
|
|
97
|
+
// untouched — darkening `transparent`/`none` would format to opaque black.
|
|
98
|
+
if (!base || base === "transparent" || base === "none") return node;
|
|
99
|
+
var c = color(base);
|
|
97
100
|
if (c) paint.stroke = c.darker(darken).formatHex();
|
|
98
101
|
var w = typeof paint.strokeWidth === "number" && paint.strokeWidth ? paint.strokeWidth : 1;
|
|
99
102
|
paint.strokeWidth = w * widthMult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/charts/viz/interactionOpacity.ts"],"sourcesContent":["/**\n `applyInteractionOpacity` — recomputes node alpha for hover/active state.\n\n v4 expresses hover/active dimming as `paint.opacity` on the scene node\n (see the `Paint` docs in @d3plus/render), not via DOM surgery. When a\n hover or active predicate is set, this walks the chart-cell nodes and\n returns clones of the non-matching ones with a reduced opacity, leaving\n the originals (and the un-dimmed nodes) untouched. With no predicate set\n it returns the input array unchanged, so normal renders pay nothing.\n*/\n\nimport {color, hsl} from \"d3-color\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport {activeBucketColors} from \"../features/colorScaleBucket.js\";\nimport type {VizInstance} from \"./vizTypes.js\";\n\ntype Predicate = (d: DataPoint, i: number) => boolean;\n\n/** z value that floats a hovered/highlighted node above its (z-less, i.e. 0) siblings. */\nconst HOVER_RAISE_Z = 1e6;\n\n/**\n De-emphasizes a paint color for `highlight` by stripping its chroma while\n keeping its lightness and alpha — so the highlighted series is the only\n color on the chart. Keeping lightness (rather than flattening to one gray)\n means a mark's label keeps the same contrast it was given, and a transparent\n fill (e.g. a legend hit-area rect) stays transparent instead of becoming a\n solid gray box. Unparseable values (`\"none\"`) are left untouched.\n*/\nfunction deemphasize(c: string): string {\n const h = hsl(c);\n if (Number.isNaN(h.l)) return c;\n h.s = 0;\n return `${h}`;\n}\n\n/** Scene mark types that carry a fill/stroke a hover/active emphasis applies to. */\nconst MARK_TYPES = new Set([\"rect\", \"circle\", \"line\", \"area\", \"path\"]);\n\n/**\n Emphasizes a matched mark's stroke on hover/active — the v3 `hoverStyle` /\n `activeStyle` look (a thicker, darker outline). v4 paints from the scene\n graph, so this reapplies it here: darken the fill by `darken` for the stroke\n and multiply the stroke width by `widthMult` (treating a 0/absent width as 1,\n matching the shape defaults). Non-mark nodes (labels, groups) are untouched.\n*/\nfunction emphasizeStroke(node: SceneNode, darken: number, widthMult: number): SceneNode {\n const paint = {...((node.paint ?? {}) as Record<string, unknown>)};\n let base = typeof paint.fill === \"string\" ? paint.fill : undefined;\n if (!base || base === \"transparent\" || base === \"none\")\n base = typeof paint.stroke === \"string\" ? paint.stroke : undefined;\n const c = base ? color(base) : null;\n if (c) paint.stroke = c.darker(darken).formatHex();\n const w = typeof paint.strokeWidth === \"number\" && paint.strokeWidth ? paint.strokeWidth : 1;\n paint.strokeWidth = w * widthMult;\n return {...node, paint} as SceneNode;\n}\n\n/**\n Reads the interaction predicate + treatment off a viz, or null when nothing\n is set. Precedence: transient `hover`, then `active`, then the standing\n `highlight`. `hover`/`active` dim non-matching marks by opacity; `highlight`\n grays them (the emphasis form), signalled by `gray`.\n*/\nfunction dimSettings(viz: VizInstance): {\n predicate: Predicate;\n dimOpacity: number;\n isHover: boolean;\n gray: boolean;\n kind: \"hover\" | \"active\" | \"highlight\";\n activePredicate: Predicate | null;\n} | null {\n const hover = typeof viz._hover === \"function\" ? (viz._hover as Predicate) : null;\n const active = typeof viz._active === \"function\" ? (viz._active as Predicate) : null;\n const highlight =\n typeof viz._highlight === \"function\" ? (viz._highlight as Predicate) : null;\n if (!hover && !active && !highlight) return null;\n const sc = (viz.schema.shapeConfig ?? {}) as Record<string, unknown>;\n let hoverOpacity = typeof sc.hoverOpacity === \"number\" ? sc.hoverOpacity : 0.5;\n const activeOpacity = typeof sc.activeOpacity === \"number\" ? sc.activeOpacity : 0.25;\n const gray = !hover && !active;\n // A colorScale bucket hover must dim the non-matching marks to read as a\n // highlight, even on charts (Geomap) that set hoverOpacity:1 to keep a plain\n // shape hover from dimming the map. Fall back to the default dim there.\n if (hover && viz._hoverBucket && hoverOpacity >= 1) hoverOpacity = 0.5;\n return {\n predicate: (hover ?? active ?? highlight) as Predicate,\n dimOpacity: hover ? hoverOpacity : active ? activeOpacity : 1,\n isHover: !!hover,\n gray,\n kind: hover ? \"hover\" : active ? \"active\" : \"highlight\",\n // The active predicate is exposed even when hover wins the dim pass, so a\n // node that is BOTH active and hovered keeps its (stronger) active stroke\n // instead of dropping to the thinner hover stroke.\n activePredicate: active,\n };\n}\n\n/**\n `applyColorScaleBucketOpacity` — dims the colorScale's sibling swatches on\n hover, the way `applyInteractionOpacity` dims chart marks and legend\n swatches. A swatch (and its label) is a `_isColorScaleBucket` node matched\n by its bucket COLOR, not by id/value — so this only touches those nodes and\n leaves the colorScale title/axis/gradient at full opacity. A swatch stays\n bright when its color is \"active\" (its range contains a datum matching the\n current hover); every other swatch dims. No-op when nothing is hovered.\n*/\nexport function applyColorScaleBucketOpacity(\n nodes: SceneNode[],\n viz: VizInstance,\n): SceneNode[] {\n const settings = dimSettings(viz);\n if (!settings) return nodes;\n const activeColors = activeBucketColors(viz, settings.predicate);\n if (!activeColors) return nodes;\n\n const walk = (node: SceneNode): SceneNode => {\n let next = node;\n // Unwrap the node's datum to the source row: the swatch label is a\n // double-wrapped TextBox node (label → shape-row → bucket).\n let src = node.datum as\n | (DataPoint & {__d3plus__?: boolean; data?: DataPoint; _isColorScaleBucket?: boolean; color?: unknown})\n | undefined;\n while (src && src.__d3plus__ && src.data) src = src.data as typeof src;\n if (src && src._isColorScaleBucket && !activeColors.has(src.color)) {\n const base =\n node.paint && typeof node.paint.opacity === \"number\" ? node.paint.opacity : 1;\n next = {...node, paint: {...(node.paint ?? {}), opacity: base * settings.dimOpacity}};\n }\n const kids = (next as {children?: SceneNode[]}).children;\n if (kids && kids.length) next = {...next, children: kids.map(walk)} as SceneNode;\n return next;\n };\n return nodes.map(walk);\n}\n\nexport function applyInteractionOpacity(\n nodes: SceneNode[],\n viz: VizInstance,\n): SceneNode[] {\n // Precedence (hover → active → highlight) and the dim-vs-gray treatment are\n // resolved once in dimSettings; picking one source avoids ambiguous\n // compounding when several are momentarily set.\n const settings = dimSettings(viz);\n if (!settings) return nodes;\n const {predicate, dimOpacity, isHover, gray, kind, activePredicate} = settings;\n\n const walk = (node: SceneNode): SceneNode => {\n // Axes and the timeline are chrome, not data marks — they keep full\n // opacity when a shape is hovered/selected (the whole subtree is tagged).\n const group = (node as {interactionGroup?: string}).interactionGroup;\n if (group === \"axis\" || group === \"timeline\") return node;\n let next = node;\n const datum = node.datum as (DataPoint & {data?: DataPoint; i?: number}) | undefined;\n if (datum) {\n // Mirror the renderer→handler bridge's one-level unwrap\n // (`rawDatum.data ?? rawDatum`) so the predicate sees the same row the\n // hover predicate was built from — for shape nodes the datum is already\n // the row; for label nodes it's the layout node whose `.data` is the row.\n const row = (datum.data ?? datum) as DataPoint;\n const i =\n typeof node.index === \"number\"\n ? node.index\n : typeof (row as {i?: number}).i === \"number\"\n ? (row as {i: number}).i\n : 0;\n if (!predicate!(row, i)) {\n const paint = (node.paint ?? {}) as Record<string, unknown>;\n if (gray) {\n // highlight: recolor the mark to the de-emphasis gray so the\n // highlighted series keeps the only color on the chart.\n const next2: Record<string, unknown> = {...paint};\n if (typeof paint.fill === \"string\") next2.fill = deemphasize(paint.fill);\n if (typeof paint.stroke === \"string\") next2.stroke = deemphasize(paint.stroke);\n next = {...node, paint: next2} as SceneNode;\n } else {\n const base = typeof paint.opacity === \"number\" ? paint.opacity : 1;\n next = {...node, paint: {...paint, opacity: base * dimOpacity}};\n }\n } else {\n // Matched (hovered / active / highlighted) mark. Restore the v3\n // hover/active emphasis — a thicker, darker stroke — on the mark shapes\n // (not labels/groups). Highlight keeps its color-vs-gray treatment and\n // adds no outline. An active node keeps the stronger active stroke even\n // while hovered, rather than dropping to the thinner hover stroke.\n if (kind !== \"highlight\" && MARK_TYPES.has(node.type)) {\n const active = kind === \"active\" || (activePredicate?.(row, i) ?? false);\n next = active ? emphasizeStroke(node, 1, 3) : emphasizeStroke(node, 0.5, 2);\n }\n if (isHover) {\n // Raise the hovered node above its siblings. Both renderers paint by\n // ascending `z`; restore is automatic — the next repaint rebuilds the\n // scene with no `z`. Only for hover: a matched mark's data label is a\n // separate (un-raised) node, so raising the mark would paint it over\n // its own label. Highlight relies on color-vs-gray, not z-order.\n next = {...next, z: HOVER_RAISE_Z} as SceneNode;\n }\n }\n }\n const kids = (next as {children?: SceneNode[]}).children;\n if (kids && kids.length) {\n next = {...next, children: kids.map(walk)} as SceneNode;\n }\n return next;\n };\n\n return nodes.map(walk);\n}\n"],"names":["color","hsl","activeBucketColors","HOVER_RAISE_Z","deemphasize","c","h","Number","isNaN","l","s","MARK_TYPES","Set","emphasizeStroke","node","darken","widthMult","paint","base","fill","undefined","stroke","darker","formatHex","w","strokeWidth","dimSettings","viz","hover","_hover","active","_active","highlight","_highlight","sc","schema","shapeConfig","hoverOpacity","activeOpacity","gray","_hoverBucket","predicate","dimOpacity","isHover","kind","activePredicate","applyColorScaleBucketOpacity","nodes","settings","activeColors","walk","next","src","datum","__d3plus__","data","_isColorScaleBucket","has","opacity","kids","children","length","map","applyInteractionOpacity","group","interactionGroup","row","i","index","next2","type","z"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;AASA,GAEA,SAAQA,KAAK,EAAEC,GAAG,QAAO,WAAW;AAKpC,SAAQC,kBAAkB,QAAO,kCAAkC;AAKnE,wFAAwF,GACxF,IAAMC,gBAAgB;AAEtB;;;;;;;AAOA,GACA,SAASC,YAAYC,CAAS;IAC5B,IAAMC,IAAIL,IAAII;IACd,IAAIE,OAAOC,KAAK,CAACF,EAAEG,CAAC,GAAG,OAAOJ;IAC9BC,EAAEI,CAAC,GAAG;IACN,OAAO,AAAC,GAAI,OAAFJ;AACZ;AAEA,kFAAkF,GAClF,IAAMK,aAAa,IAAIC,IAAI;IAAC;IAAQ;IAAU;IAAQ;I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,GAAGf,YAAYa,MAAME,IAAI;oBACvE,IAAI,OAAOF,MAAMI,MAAM,KAAK,UAAUgD,MAAMhD,MAAM,GAAGjB,YAAYa,MAAMI,MAAM;oBAC7E8B,OAAO,wCAAIrC;wBAAMG,OAAOoD;;gBAC1B,OAAO;oBACL,IAAMnD,OAAO,OAAOD,MAAMyC,OAAO,KAAK,WAAWzC,MAAMyC,OAAO,GAAG;oBACjEP,OAAO,wCAAIrC;wBAAMG,OAAO,wCAAIA;4BAAOyC,SAASxC,OAAOwB;;;gBACrD;YACF,OAAO;gBACL,gEAAgE;gBAChE,wEAAwE;gBACxE,uEAAuE;gBACvE,wEAAwE;gBACxE,mEAAmE;gBACnE,IAAIE,SAAS,eAAejC,WAAW8C,GAAG,CAAC3C,KAAKwD,IAAI,GAAG;;oBACrD,IAAMxC,SAASc,SAAS,qBAAaC,4BAAAA,sCAAAA,gBAAkBqB,KAAKC,yCAAM;oBAClEhB,OAAOrB,SAASjB,gBAAgBC,MAAM,GAAG,KAAKD,gBAAgBC,MAAM,KAAK;gBAC3E;gBACA,IAAI6B,SAAS;oBACX,qEAAqE;oBACrE,sEAAsE;oBACtE,sEAAsE;oBACtE,qEAAqE;oBACrE,iEAAiE;oBACjEQ,OAAO,wCAAIA;wBAAMoB,GAAGpE;;gBACtB;YACF;QACF;QACA,IAAMwD,OAAO,AAACR,KAAkCS,QAAQ;QACxD,IAAID,QAAQA,KAAKE,MAAM,EAAE;YACvBV,OAAO,wCAAIA;gBAAMS,UAAUD,KAAKG,GAAG,CAACZ;;QACtC;QACA,OAAOC;IACT;IAEA,OAAOJ,MAAMe,GAAG,CAACZ;AACnB"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/charts/viz/interactionOpacity.ts"],"sourcesContent":["/**\n `applyInteractionOpacity` — recomputes node alpha for hover/active state.\n\n v4 expresses hover/active dimming as `paint.opacity` on the scene node\n (see the `Paint` docs in @d3plus/render), not via DOM surgery. When a\n hover or active predicate is set, this walks the chart-cell nodes and\n returns clones of the non-matching ones with a reduced opacity, leaving\n the originals (and the un-dimmed nodes) untouched. With no predicate set\n it returns the input array unchanged, so normal renders pay nothing.\n*/\n\nimport {color, hsl} from \"d3-color\";\n\nimport type {DataPoint} from \"@d3plus/data\";\nimport type {SceneNode} from \"@d3plus/render\";\n\nimport {activeBucketColors} from \"../features/colorScaleBucket.js\";\nimport type {VizInstance} from \"./vizTypes.js\";\n\ntype Predicate = (d: DataPoint, i: number) => boolean;\n\n/** z value that floats a hovered/highlighted node above its (z-less, i.e. 0) siblings. */\nconst HOVER_RAISE_Z = 1e6;\n\n/**\n De-emphasizes a paint color for `highlight` by stripping its chroma while\n keeping its lightness and alpha — so the highlighted series is the only\n color on the chart. Keeping lightness (rather than flattening to one gray)\n means a mark's label keeps the same contrast it was given, and a transparent\n fill (e.g. a legend hit-area rect) stays transparent instead of becoming a\n solid gray box. Unparseable values (`\"none\"`) are left untouched.\n*/\nfunction deemphasize(c: string): string {\n const h = hsl(c);\n if (Number.isNaN(h.l)) return c;\n h.s = 0;\n return `${h}`;\n}\n\n/** Scene mark types that carry a fill/stroke a hover/active emphasis applies to. */\nconst MARK_TYPES = new Set([\"rect\", \"circle\", \"line\", \"area\", \"path\"]);\n\n/**\n Emphasizes a matched mark's stroke on hover/active — the v3 `hoverStyle` /\n `activeStyle` look (a thicker, darker outline). v4 paints from the scene\n graph, so this reapplies it here: darken the fill by `darken` for the stroke\n and multiply the stroke width by `widthMult` (treating a 0/absent width as 1,\n matching the shape defaults). Non-mark nodes (labels, groups) are untouched.\n*/\nfunction emphasizeStroke(node: SceneNode, darken: number, widthMult: number): SceneNode {\n const paint = {...((node.paint ?? {}) as Record<string, unknown>)};\n let base = typeof paint.fill === \"string\" ? paint.fill : undefined;\n if (!base || base === \"transparent\" || base === \"none\")\n base = typeof paint.stroke === \"string\" ? paint.stroke : undefined;\n // No visible paint to emphasize (e.g. an invisible hit-area node): leave it\n // untouched — darkening `transparent`/`none` would format to opaque black.\n if (!base || base === \"transparent\" || base === \"none\") return node;\n const c = color(base);\n if (c) paint.stroke = c.darker(darken).formatHex();\n const w = typeof paint.strokeWidth === \"number\" && paint.strokeWidth ? paint.strokeWidth : 1;\n paint.strokeWidth = w * widthMult;\n return {...node, paint} as SceneNode;\n}\n\n/**\n Reads the interaction predicate + treatment off a viz, or null when nothing\n is set. Precedence: transient `hover`, then `active`, then the standing\n `highlight`. `hover`/`active` dim non-matching marks by opacity; `highlight`\n grays them (the emphasis form), signalled by `gray`.\n*/\nfunction dimSettings(viz: VizInstance): {\n predicate: Predicate;\n dimOpacity: number;\n isHover: boolean;\n gray: boolean;\n kind: \"hover\" | \"active\" | \"highlight\";\n activePredicate: Predicate | null;\n} | null {\n const hover = typeof viz._hover === \"function\" ? (viz._hover as Predicate) : null;\n const active = typeof viz._active === \"function\" ? (viz._active as Predicate) : null;\n const highlight =\n typeof viz._highlight === \"function\" ? (viz._highlight as Predicate) : null;\n if (!hover && !active && !highlight) return null;\n const sc = (viz.schema.shapeConfig ?? {}) as Record<string, unknown>;\n let hoverOpacity = typeof sc.hoverOpacity === \"number\" ? sc.hoverOpacity : 0.5;\n const activeOpacity = typeof sc.activeOpacity === \"number\" ? sc.activeOpacity : 0.25;\n const gray = !hover && !active;\n // A colorScale bucket hover must dim the non-matching marks to read as a\n // highlight, even on charts (Geomap) that set hoverOpacity:1 to keep a plain\n // shape hover from dimming the map. Fall back to the default dim there.\n if (hover && viz._hoverBucket && hoverOpacity >= 1) hoverOpacity = 0.5;\n return {\n predicate: (hover ?? active ?? highlight) as Predicate,\n dimOpacity: hover ? hoverOpacity : active ? activeOpacity : 1,\n isHover: !!hover,\n gray,\n kind: hover ? \"hover\" : active ? \"active\" : \"highlight\",\n // The active predicate is exposed even when hover wins the dim pass, so a\n // node that is BOTH active and hovered keeps its (stronger) active stroke\n // instead of dropping to the thinner hover stroke.\n activePredicate: active,\n };\n}\n\n/**\n `applyColorScaleBucketOpacity` — dims the colorScale's sibling swatches on\n hover, the way `applyInteractionOpacity` dims chart marks and legend\n swatches. A swatch (and its label) is a `_isColorScaleBucket` node matched\n by its bucket COLOR, not by id/value — so this only touches those nodes and\n leaves the colorScale title/axis/gradient at full opacity. A swatch stays\n bright when its color is \"active\" (its range contains a datum matching the\n current hover); every other swatch dims. No-op when nothing is hovered.\n*/\nexport function applyColorScaleBucketOpacity(\n nodes: SceneNode[],\n viz: VizInstance,\n): SceneNode[] {\n const settings = dimSettings(viz);\n if (!settings) return nodes;\n const activeColors = activeBucketColors(viz, settings.predicate);\n if (!activeColors) return nodes;\n\n const walk = (node: SceneNode): SceneNode => {\n let next = node;\n // Unwrap the node's datum to the source row: the swatch label is a\n // double-wrapped TextBox node (label → shape-row → bucket).\n let src = node.datum as\n | (DataPoint & {__d3plus__?: boolean; data?: DataPoint; _isColorScaleBucket?: boolean; color?: unknown})\n | undefined;\n while (src && src.__d3plus__ && src.data) src = src.data as typeof src;\n if (src && src._isColorScaleBucket && !activeColors.has(src.color)) {\n const base =\n node.paint && typeof node.paint.opacity === \"number\" ? node.paint.opacity : 1;\n next = {...node, paint: {...(node.paint ?? {}), opacity: base * settings.dimOpacity}};\n }\n const kids = (next as {children?: SceneNode[]}).children;\n if (kids && kids.length) next = {...next, children: kids.map(walk)} as SceneNode;\n return next;\n };\n return nodes.map(walk);\n}\n\nexport function applyInteractionOpacity(\n nodes: SceneNode[],\n viz: VizInstance,\n): SceneNode[] {\n // Precedence (hover → active → highlight) and the dim-vs-gray treatment are\n // resolved once in dimSettings; picking one source avoids ambiguous\n // compounding when several are momentarily set.\n const settings = dimSettings(viz);\n if (!settings) return nodes;\n const {predicate, dimOpacity, isHover, gray, kind, activePredicate} = settings;\n\n const walk = (node: SceneNode): SceneNode => {\n // Axes and the timeline are chrome, not data marks — they keep full\n // opacity when a shape is hovered/selected (the whole subtree is tagged).\n const group = (node as {interactionGroup?: string}).interactionGroup;\n if (group === \"axis\" || group === \"timeline\") return node;\n let next = node;\n const datum = node.datum as (DataPoint & {data?: DataPoint; i?: number}) | undefined;\n if (datum) {\n // Mirror the renderer→handler bridge's one-level unwrap\n // (`rawDatum.data ?? rawDatum`) so the predicate sees the same row the\n // hover predicate was built from — for shape nodes the datum is already\n // the row; for label nodes it's the layout node whose `.data` is the row.\n const row = (datum.data ?? datum) as DataPoint;\n const i =\n typeof node.index === \"number\"\n ? node.index\n : typeof (row as {i?: number}).i === \"number\"\n ? (row as {i: number}).i\n : 0;\n if (!predicate!(row, i)) {\n const paint = (node.paint ?? {}) as Record<string, unknown>;\n if (gray) {\n // highlight: recolor the mark to the de-emphasis gray so the\n // highlighted series keeps the only color on the chart.\n const next2: Record<string, unknown> = {...paint};\n if (typeof paint.fill === \"string\") next2.fill = deemphasize(paint.fill);\n if (typeof paint.stroke === \"string\") next2.stroke = deemphasize(paint.stroke);\n next = {...node, paint: next2} as SceneNode;\n } else {\n const base = typeof paint.opacity === \"number\" ? paint.opacity : 1;\n next = {...node, paint: {...paint, opacity: base * dimOpacity}};\n }\n } else {\n // Matched (hovered / active / highlighted) mark. Restore the v3\n // hover/active emphasis — a thicker, darker stroke — on the mark shapes\n // (not labels/groups). Highlight keeps its color-vs-gray treatment and\n // adds no outline. An active node keeps the stronger active stroke even\n // while hovered, rather than dropping to the thinner hover stroke.\n if (kind !== \"highlight\" && MARK_TYPES.has(node.type)) {\n const active = kind === \"active\" || (activePredicate?.(row, i) ?? false);\n next = active ? emphasizeStroke(node, 1, 3) : emphasizeStroke(node, 0.5, 2);\n }\n if (isHover) {\n // Raise the hovered node above its siblings. Both renderers paint by\n // ascending `z`; restore is automatic — the next repaint rebuilds the\n // scene with no `z`. Only for hover: a matched mark's data label is a\n // separate (un-raised) node, so raising the mark would paint it over\n // its own label. Highlight relies on color-vs-gray, not z-order.\n next = {...next, z: HOVER_RAISE_Z} as SceneNode;\n }\n }\n }\n const kids = (next as {children?: SceneNode[]}).children;\n if (kids && kids.length) {\n next = {...next, children: kids.map(walk)} as SceneNode;\n }\n return next;\n };\n\n return nodes.map(walk);\n}\n"],"names":["color","hsl","activeBucketColors","HOVER_RAISE_Z","deemphasize","c","h","Number","isNaN","l","s","MARK_TYPES","Set","emphasizeStroke","node","darken","widthMult","paint","base","fill","undefined","stroke","darker","formatHex","w","strokeWidth","dimSettings","viz","hover","_hover","active","_active","highlight","_highlight","sc","schema","shapeConfig","hoverOpacity","activeOpacity","gray","_hoverBucket","predicate","dimOpacity","isHover","kind","activePredicate","applyColorScaleBucketOpacity","nodes","settings","activeColors","walk","next","src","datum","__d3plus__","data","_isColorScaleBucket","has","opacity","kids","children","length","map","applyInteractionOpacity","group","interactionGroup","row","i","index","next2","type","z"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;AASA,GAEA,SAAQA,KAAK,EAAEC,GAAG,QAAO,WAAW;AAKpC,SAAQC,kBAAkB,QAAO,kCAAkC;AAKnE,wFAAwF,GACxF,IAAMC,gBAAgB;AAEtB;;;;;;;AAOA,GACA,SAASC,YAAYC,CAAS;IAC5B,IAAMC,IAAIL,IAAII;IACd,IAAIE,OAAOC,KAAK,CAACF,EAAEG,CAAC,GAAG,OAAOJ;IAC9BC,EAAEI,CAAC,GAAG;IACN,OAAO,AAAC,GAAI,OAAFJ;AACZ;AAEA,kFAAkF,GAClF,IAAMK,aAAa,IAAIC,IAAI;IAAC;IAAQ;IAAU;IAAQ;IAAQ;CAAO;AAErE;;;;;;AAMA,GACA,SAASC,gBAAgBC,IAAe,EAAEC,MAAc,EAAEC,SAAiB;QACrDF;IAApB,IAAMG,QAAQ,oBAAMH,cAAAA,KAAKG,KAAK,cAAVH,yBAAAA,cAAc,CAAC;IACnC,IAAII,OAAO,OAAOD,MAAME,IAAI,KAAK,WAAWF,MAAME,IAAI,GAAGC;IACzD,IAAI,CAACF,QAAQA,SAAS,iBAAiBA,SAAS,QAC9CA,OAAO,OAAOD,MAAMI,MAAM,KAAK,WAAWJ,MAAMI,MAAM,GAAGD;IAC3D,4EAA4E;I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wCAAIA;4BAAOyC,SAASxC,OAAOwB;;;gBACrD;YACF,OAAO;gBACL,gEAAgE;gBAChE,wEAAwE;gBACxE,uEAAuE;gBACvE,wEAAwE;gBACxE,mEAAmE;gBACnE,IAAIE,SAAS,eAAejC,WAAW8C,GAAG,CAAC3C,KAAKwD,IAAI,GAAG;;oBACrD,IAAMxC,SAASc,SAAS,qBAAaC,4BAAAA,sCAAAA,gBAAkBqB,KAAKC,yCAAM;oBAClEhB,OAAOrB,SAASjB,gBAAgBC,MAAM,GAAG,KAAKD,gBAAgBC,MAAM,KAAK;gBAC3E;gBACA,IAAI6B,SAAS;oBACX,qEAAqE;oBACrE,sEAAsE;oBACtE,sEAAsE;oBACtE,qEAAqE;oBACrE,iEAAiE;oBACjEQ,OAAO,wCAAIA;wBAAMoB,GAAGpE;;gBACtB;YACF;QACF;QACA,IAAMwD,OAAO,AAACR,KAAkCS,QAAQ;QACxD,IAAID,QAAQA,KAAKE,MAAM,EAAE;YACvBV,OAAO,wCAAIA;gBAAMS,UAAUD,KAAKG,GAAG,CAACZ;;QACtC;QACA,OAAOC;IACT;IAEA,OAAOJ,MAAMe,GAAG,CAACZ;AACnB"}
|
|
@@ -196,6 +196,14 @@ var vizSchema = [
|
|
|
196
196
|
key: "legendSort",
|
|
197
197
|
coerce: "identity"
|
|
198
198
|
},
|
|
199
|
+
{
|
|
200
|
+
key: "minimap",
|
|
201
|
+
coerce: "identity"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
key: "search",
|
|
205
|
+
coerce: "identity"
|
|
206
|
+
},
|
|
199
207
|
{
|
|
200
208
|
key: "svgDesc",
|
|
201
209
|
coerce: "identity"
|
|
@@ -204,6 +212,18 @@ var vizSchema = [
|
|
|
204
212
|
key: "svgTitle",
|
|
205
213
|
coerce: "identity"
|
|
206
214
|
},
|
|
215
|
+
{
|
|
216
|
+
key: "tableView",
|
|
217
|
+
coerce: "identity"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
key: "tableViewDownload",
|
|
221
|
+
coerce: "identity"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
key: "tableViewSort",
|
|
225
|
+
coerce: "identity"
|
|
226
|
+
},
|
|
207
227
|
{
|
|
208
228
|
key: "timeFilter",
|
|
209
229
|
coerce: "identity"
|
|
@@ -247,31 +267,46 @@ var vizSchema = [
|
|
|
247
267
|
viz._renderMode = "full";
|
|
248
268
|
viz.schema.ariaHidden = true;
|
|
249
269
|
viz.schema.attribution = false;
|
|
250
|
-
|
|
251
|
-
viz.schema.attributionStyle =
|
|
252
|
-
background: attributionBg,
|
|
253
|
-
border: "1px solid rgba(0, 0, 0, 0.25)",
|
|
254
|
-
color: colorContrast(attributionBg),
|
|
255
|
-
display: "block",
|
|
256
|
-
font: "400 11px/11px ".concat(fontFamilyStringify(fontFamily)),
|
|
257
|
-
margin: "5px",
|
|
258
|
-
opacity: 0.75,
|
|
259
|
-
padding: "4px 6px 3px"
|
|
260
|
-
};
|
|
261
|
-
viz._backClass = new TextBox().on("click", function() {
|
|
262
|
-
if (viz._history.length) viz.config(viz._history.pop()).render();
|
|
263
|
-
else viz.depth(viz._drawDepth - 1).filter(false);
|
|
264
|
-
viz.render();
|
|
265
|
-
}).on("mousemove", function() {
|
|
266
|
-
return viz._backClass.select().style("cursor", "pointer");
|
|
267
|
-
});
|
|
268
|
-
viz.schema.backConfig = {
|
|
269
|
-
fontSize: 10,
|
|
270
|
-
padding: 5,
|
|
271
|
-
resize: false
|
|
272
|
-
};
|
|
270
|
+
viz.schema.attributionIcon = undefined;
|
|
271
|
+
viz.schema.attributionStyle = attributionStyleDefault;
|
|
273
272
|
viz.schema.cache = true;
|
|
274
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
Default inline style for the "← Back" button — structural-only, the
|
|
276
|
+
same properties `zoomControlStyleDefault`/`searchControlStyleDefault`
|
|
277
|
+
use, except `width: "auto"` (it shows an icon + the word "Back", not a
|
|
278
|
+
single centered glyph) with a small `gap` between them and horizontal
|
|
279
|
+
padding for breathing room. Also lighter/smaller than the other two's
|
|
280
|
+
`font` (900 15px): that value is a holdover from when their icons were
|
|
281
|
+
bold Unicode glyphs sized to read clearly (the icons are SVG now, so it
|
|
282
|
+
no longer affects THEM at all) — but back is the one place that font
|
|
283
|
+
actually renders visible text, where 900 15px reads oversized/heavy.
|
|
284
|
+
No background/border/color, same as the other two: a plain
|
|
285
|
+
browser-appearance button, letting native/host-page button chrome show
|
|
286
|
+
through by default.
|
|
287
|
+
@private
|
|
288
|
+
*/ export var backControlStyleDefault = {
|
|
289
|
+
"align-items": "center",
|
|
290
|
+
display: "inline-flex",
|
|
291
|
+
font: "400 12px/1 ".concat(fontFamilyStringify(fontFamily)),
|
|
292
|
+
gap: "4px",
|
|
293
|
+
height: "20px",
|
|
294
|
+
"justify-content": "center",
|
|
295
|
+
padding: "0 6px",
|
|
296
|
+
width: "auto"
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
Back-button control styling defaults.
|
|
300
|
+
@private
|
|
301
|
+
*/ function initBackDefaults(viz) {
|
|
302
|
+
// No longer drives the button's appearance (see `.backConfig()`'s own
|
|
303
|
+
// doc comment), but `.backConfig({...})` merges into this via
|
|
304
|
+
// `assign(this.schema.backConfig, _)` — leaving it undefined makes that
|
|
305
|
+
// throw on the very first call, on every chart.
|
|
306
|
+
viz.schema.backConfig = {};
|
|
307
|
+
viz.schema.backControlClassName = undefined;
|
|
308
|
+
viz.schema.backControlStyle = backControlStyleDefault;
|
|
309
|
+
}
|
|
275
310
|
/**
|
|
276
311
|
Color accessor and color-scale defaults.
|
|
277
312
|
@private
|
|
@@ -400,7 +435,10 @@ var vizSchema = [
|
|
|
400
435
|
}
|
|
401
436
|
};
|
|
402
437
|
var debouncedResize = debounce(applyResize, viz.schema.detectResizeDelay);
|
|
403
|
-
|
|
438
|
+
// Guarded so a chart can be constructed in an environment without a DOM (e.g.
|
|
439
|
+
// before `@d3plus/ssr` installs one). Auto-resize is a browser-only feature;
|
|
440
|
+
// when absent, `_resizeObserver` stays undefined and its call sites skip it.
|
|
441
|
+
viz._resizeObserver = typeof ResizeObserver === "undefined" ? undefined : new ResizeObserver(function(entries) {
|
|
404
442
|
// The first real-size notification after `observe()` reports the
|
|
405
443
|
// container's settled layout size, which on an auto-sized chart often
|
|
406
444
|
// differs from the size the chart just measured pre-layout (the
|
|
@@ -531,11 +569,92 @@ var vizSchema = [
|
|
|
531
569
|
};
|
|
532
570
|
viz.schema.totalPadding = defaultPadding;
|
|
533
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
Default attribution styles: flush to the chart area's bottom-right corner
|
|
574
|
+
like the credit on a slippy map, in small type on a translucent backing
|
|
575
|
+
that keeps it legible over busy tiles without boxing it in. The dark
|
|
576
|
+
variant applies over a dark basemap while the style is still this
|
|
577
|
+
untouched default (compared by reference, like the zoom-control styles).
|
|
578
|
+
@private
|
|
579
|
+
*/ var attributionLightBg = "rgba(255, 255, 255, 0.7)";
|
|
580
|
+
var attributionDarkBg = "rgba(24, 25, 28, 0.7)";
|
|
581
|
+
var attributionBase = {
|
|
582
|
+
"border-radius": "3px 0 0 0",
|
|
583
|
+
display: "flex",
|
|
584
|
+
"align-items": "center",
|
|
585
|
+
gap: "4px",
|
|
586
|
+
font: "400 10px/1.4 ".concat(fontFamilyStringify(fontFamily))
|
|
587
|
+
};
|
|
588
|
+
export var attributionStyleDefault = _object_spread_props(_object_spread({}, attributionBase), {
|
|
589
|
+
background: attributionLightBg,
|
|
590
|
+
color: colorContrast(attributionLightBg)
|
|
591
|
+
});
|
|
592
|
+
export var attributionStyleDarkDefault = _object_spread_props(_object_spread({}, attributionBase), {
|
|
593
|
+
background: attributionDarkBg,
|
|
594
|
+
color: colorContrast(attributionDarkBg)
|
|
595
|
+
});
|
|
596
|
+
/**
|
|
597
|
+
Default inline styles for the zoom-control buttons — structural only
|
|
598
|
+
(sizing/spacing/typography); no color, background, border, or opacity.
|
|
599
|
+
Letting native/host-page button chrome show through by default means a
|
|
600
|
+
page styling its own buttons (Tailwind, Bootstrap, a design system) via
|
|
601
|
+
`zoomControlClassName` composes cleanly instead of fighting inline color
|
|
602
|
+
overrides. The active state (brush mode on) paints the OS accent color
|
|
603
|
+
through CSS system colors (`AccentColor`/`AccentColorText`, falling back
|
|
604
|
+
to the selection `Highlight` where unsupported), so it reads as pressed
|
|
605
|
+
in the browser's own idiom; hover gets no default styling (`false`). The
|
|
606
|
+
`.active` class, `aria-pressed`, and `:hover`/`:active` pseudo-classes
|
|
607
|
+
stay available for a host page's own CSS to hook into. Consumers who want d3plus's old
|
|
608
|
+
opinionated look can restore it via `.zoomControlStyle({...})`.
|
|
609
|
+
|
|
610
|
+
Exported as stable object references (not inlined per-instance) so
|
|
611
|
+
`zoomControls.ts` can tell, via `===`, whether a given viz's
|
|
612
|
+
`zoomControlStyle*` is still the untouched default — that's what lets
|
|
613
|
+
setting `zoomControlClassName` auto-disable the defaults without also
|
|
614
|
+
clobbering a style the caller explicitly customized themselves.
|
|
615
|
+
@private
|
|
616
|
+
*/ export var zoomControlStyleDefault = {
|
|
617
|
+
"align-items": "center",
|
|
618
|
+
display: "inline-flex",
|
|
619
|
+
font: "900 15px/1 ".concat(fontFamilyStringify(fontFamily)),
|
|
620
|
+
height: "20px",
|
|
621
|
+
"justify-content": "center",
|
|
622
|
+
padding: 0,
|
|
623
|
+
width: "20px"
|
|
624
|
+
};
|
|
625
|
+
export var zoomControlStyleActiveDefault = {
|
|
626
|
+
"background-color": "AccentColor",
|
|
627
|
+
"border-color": "AccentColor",
|
|
628
|
+
color: "AccentColorText"
|
|
629
|
+
};
|
|
630
|
+
export var zoomControlStyleHoverDefault = false;
|
|
631
|
+
/**
|
|
632
|
+
Default inline styles for the table-view toggle button — structural only,
|
|
633
|
+
mirroring `zoomControlStyleDefault` et al. so the two chrome features look
|
|
634
|
+
and behave consistently. Kept as separate object references (not shared
|
|
635
|
+
with zoom's) so `tableViewControl.ts` can independently detect, via `===`,
|
|
636
|
+
whether `tableViewControlStyle*` is still untouched — the same
|
|
637
|
+
auto-disable-on-className trick `zoomControlClassName` uses.
|
|
638
|
+
*/ export var tableViewControlStyleDefault = {
|
|
639
|
+
"align-items": "center",
|
|
640
|
+
display: "inline-flex",
|
|
641
|
+
font: "900 15px/1 ".concat(fontFamilyStringify(fontFamily)),
|
|
642
|
+
height: "20px",
|
|
643
|
+
"justify-content": "center",
|
|
644
|
+
padding: 0,
|
|
645
|
+
width: "20px"
|
|
646
|
+
};
|
|
647
|
+
export var tableViewControlStyleActiveDefault = {
|
|
648
|
+
"background-color": "AccentColor",
|
|
649
|
+
"border-color": "AccentColor",
|
|
650
|
+
color: "AccentColorText"
|
|
651
|
+
};
|
|
652
|
+
export var tableViewControlStyleHoverDefault = false;
|
|
534
653
|
/**
|
|
535
654
|
Zoom behavior, brush, control button styling, and zoom limit defaults.
|
|
536
655
|
@private
|
|
537
656
|
*/ function initZoomDefaults(viz) {
|
|
538
|
-
viz.schema.zoom =
|
|
657
|
+
viz.schema.zoom = true;
|
|
539
658
|
viz._zoomBehavior = zoom();
|
|
540
659
|
viz._zoomBrush = brush();
|
|
541
660
|
viz.schema.zoomBrushHandleSize = 1;
|
|
@@ -546,35 +665,108 @@ var vizSchema = [
|
|
|
546
665
|
fill: "#777",
|
|
547
666
|
"stroke-width": 0
|
|
548
667
|
};
|
|
549
|
-
|
|
550
|
-
viz.schema.
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
display: "block",
|
|
555
|
-
font: "900 15px/21px ".concat(fontFamilyStringify(fontFamily)),
|
|
556
|
-
height: "20px",
|
|
557
|
-
margin: "5px",
|
|
558
|
-
opacity: 0.75,
|
|
559
|
-
padding: 0,
|
|
560
|
-
"text-align": "center",
|
|
561
|
-
width: "20px"
|
|
562
|
-
};
|
|
563
|
-
var zoomActiveBg = "rgba(0, 0, 0, 0.75)";
|
|
564
|
-
viz.schema.zoomControlStyleActive = {
|
|
565
|
-
background: zoomActiveBg,
|
|
566
|
-
color: colorContrast(zoomActiveBg),
|
|
567
|
-
opacity: 1
|
|
568
|
-
};
|
|
569
|
-
viz.schema.zoomControlStyleHover = {
|
|
570
|
-
cursor: "pointer",
|
|
571
|
-
opacity: 1
|
|
572
|
-
};
|
|
668
|
+
viz.schema.zoomControlClassName = undefined;
|
|
669
|
+
viz.schema.zoomControlIcons = undefined;
|
|
670
|
+
viz.schema.zoomControlStyle = zoomControlStyleDefault;
|
|
671
|
+
viz.schema.zoomControlStyleActive = zoomControlStyleActiveDefault;
|
|
672
|
+
viz.schema.zoomControlStyleHover = zoomControlStyleHoverDefault;
|
|
573
673
|
viz.schema.zoomFactor = 2;
|
|
574
|
-
viz.schema.zoomMax =
|
|
674
|
+
viz.schema.zoomMax = undefined;
|
|
575
675
|
viz.schema.zoomPadding = 20;
|
|
576
676
|
viz.schema.zoomPan = true;
|
|
577
|
-
viz.schema.zoomScroll =
|
|
677
|
+
viz.schema.zoomScroll = "modifier";
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
Table-view button + data-table defaults. Mirrors `initZoomDefaults`:
|
|
681
|
+
a chrome toggle shown by default, styled structurally (no color/
|
|
682
|
+
background) so a host page's own button styling applies through the
|
|
683
|
+
cascade once `tableViewControlClassName` is set.
|
|
684
|
+
@private
|
|
685
|
+
*/ function initTableViewDefaults(viz) {
|
|
686
|
+
viz.schema.tableView = true;
|
|
687
|
+
viz.schema.tableViewClassName = undefined;
|
|
688
|
+
viz.schema.tableViewControlClassName = undefined;
|
|
689
|
+
viz.schema.tableViewControlStyle = tableViewControlStyleDefault;
|
|
690
|
+
viz.schema.tableViewControlStyleActive = tableViewControlStyleActiveDefault;
|
|
691
|
+
viz.schema.tableViewControlStyleHover = tableViewControlStyleHoverDefault;
|
|
692
|
+
viz.schema.tableViewDownload = true;
|
|
693
|
+
viz.schema.tableViewPageSize = 50;
|
|
694
|
+
viz.schema.tableViewSort = true;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
Default inline styles for the minimap — mirrors the zoom-control defaults'
|
|
698
|
+
own reasoning (structural/neutral, easy to override or auto-disable via
|
|
699
|
+
`minimapClassName`) and the same by-reference `===` trick that lets
|
|
700
|
+
setting `minimapClassName` auto-disable an untouched default without
|
|
701
|
+
clobbering a caller's own customization.
|
|
702
|
+
@private
|
|
703
|
+
*/ export var minimapStyleDefault = {
|
|
704
|
+
background: "rgba(255, 255, 255, 0.75)",
|
|
705
|
+
border: "1px solid rgba(0, 0, 0, 0.25)",
|
|
706
|
+
"border-radius": "2px",
|
|
707
|
+
"box-sizing": "border-box"
|
|
708
|
+
};
|
|
709
|
+
export var minimapViewportStyleDefault = {
|
|
710
|
+
background: "rgba(0, 0, 0, 0.15)",
|
|
711
|
+
border: "1px solid rgba(0, 0, 0, 0.5)",
|
|
712
|
+
"border-radius": "2px",
|
|
713
|
+
cursor: "grab"
|
|
714
|
+
};
|
|
715
|
+
export var minimapViewportStyleActiveDefault = {
|
|
716
|
+
background: "rgba(0, 0, 0, 0.25)",
|
|
717
|
+
cursor: "grabbing"
|
|
718
|
+
};
|
|
719
|
+
export var minimapLabelStyleDefault = {
|
|
720
|
+
bottom: "2px",
|
|
721
|
+
right: "3px",
|
|
722
|
+
color: "rgba(0, 0, 0, 0.75)",
|
|
723
|
+
font: "400 9px/1 ".concat(fontFamilyStringify(fontFamily)),
|
|
724
|
+
"pointer-events": "none"
|
|
725
|
+
};
|
|
726
|
+
/**
|
|
727
|
+
Minimap visibility and styling defaults.
|
|
728
|
+
@private
|
|
729
|
+
*/ function initMinimapDefaults(viz) {
|
|
730
|
+
viz.schema.minimap = true;
|
|
731
|
+
viz.schema.minimapClassName = undefined;
|
|
732
|
+
viz.schema.minimapStyle = minimapStyleDefault;
|
|
733
|
+
viz.schema.minimapViewportStyle = minimapViewportStyleDefault;
|
|
734
|
+
viz.schema.minimapViewportStyleActive = minimapViewportStyleActiveDefault;
|
|
735
|
+
viz.schema.minimapLabelStyle = minimapLabelStyleDefault;
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
Default inline styles for the search control's toggle button — the same
|
|
739
|
+
structural-only values as `zoomControlStyleDefault` et al. (visual
|
|
740
|
+
parity by default), kept as independent objects/consumers rather than
|
|
741
|
+
shared references so restyling one doesn't affect the other.
|
|
742
|
+
@private
|
|
743
|
+
*/ export var searchControlStyleDefault = {
|
|
744
|
+
"align-items": "center",
|
|
745
|
+
display: "inline-flex",
|
|
746
|
+
font: "900 15px/1 ".concat(fontFamilyStringify(fontFamily)),
|
|
747
|
+
height: "20px",
|
|
748
|
+
"justify-content": "center",
|
|
749
|
+
padding: 0,
|
|
750
|
+
width: "20px"
|
|
751
|
+
};
|
|
752
|
+
export var searchControlStyleActiveDefault = {
|
|
753
|
+
"background-color": "AccentColor",
|
|
754
|
+
"border-color": "AccentColor",
|
|
755
|
+
color: "AccentColorText"
|
|
756
|
+
};
|
|
757
|
+
export var searchControlStyleHoverDefault = false;
|
|
758
|
+
/**
|
|
759
|
+
Search-control (toggle button + input) styling defaults.
|
|
760
|
+
@private
|
|
761
|
+
*/ function initSearchDefaults(viz) {
|
|
762
|
+
viz.schema.search = true;
|
|
763
|
+
viz.schema.searchAccessor = function(d, i) {
|
|
764
|
+
return viz._drawLabel(d, i);
|
|
765
|
+
};
|
|
766
|
+
viz.schema.searchControlClassName = undefined;
|
|
767
|
+
viz.schema.searchControlStyle = searchControlStyleDefault;
|
|
768
|
+
viz.schema.searchControlStyleActive = searchControlStyleActiveDefault;
|
|
769
|
+
viz.schema.searchControlStyleHover = searchControlStyleHoverDefault;
|
|
578
770
|
}
|
|
579
771
|
/**
|
|
580
772
|
Seeds a fresh Viz instance's schema defaults and installs the identity-coerce
|
|
@@ -597,6 +789,10 @@ var vizSchema = [
|
|
|
597
789
|
initShapeDefaults(viz);
|
|
598
790
|
initLabelDefaults(viz);
|
|
599
791
|
initZoomDefaults(viz);
|
|
792
|
+
initTableViewDefaults(viz);
|
|
793
|
+
initMinimapDefaults(viz);
|
|
794
|
+
initBackDefaults(viz);
|
|
795
|
+
initSearchDefaults(viz);
|
|
600
796
|
}
|
|
601
797
|
|
|
602
798
|
//# sourceMappingURL=vizDefaults.js.map
|