@d3plus/core 4.2.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/README.md +2137 -953
  2. package/es/index.js +1 -1
  3. package/es/index.js.map +1 -1
  4. package/es/internal.js +7 -1
  5. package/es/internal.js.map +1 -1
  6. package/es/src/charts/AreaPlot/index.js +1 -2
  7. package/es/src/charts/AreaPlot/index.js.map +1 -1
  8. package/es/src/charts/BarChart/index.js +1 -2
  9. package/es/src/charts/BarChart/index.js.map +1 -1
  10. package/es/src/charts/BoxWhisker/index.js +1 -2
  11. package/es/src/charts/BoxWhisker/index.js.map +1 -1
  12. package/es/src/charts/BumpChart/index.js +1 -2
  13. package/es/src/charts/BumpChart/index.js.map +1 -1
  14. package/es/src/charts/Chord/applyLayout.js +205 -0
  15. package/es/src/charts/Chord/applyLayout.js.map +1 -0
  16. package/es/src/charts/Chord/emit.js +168 -0
  17. package/es/src/charts/Chord/emit.js.map +1 -0
  18. package/es/src/charts/Chord/index.js +234 -0
  19. package/es/src/charts/Chord/index.js.map +1 -0
  20. package/es/src/charts/Geomap/basemapTheme.js +78 -0
  21. package/es/src/charts/Geomap/basemapTheme.js.map +1 -0
  22. package/es/src/charts/Geomap/emit.js +58 -9
  23. package/es/src/charts/Geomap/emit.js.map +1 -1
  24. package/es/src/charts/Geomap/index.js +93 -99
  25. package/es/src/charts/Geomap/index.js.map +1 -1
  26. package/es/src/charts/LinePlot/index.js +1 -2
  27. package/es/src/charts/LinePlot/index.js.map +1 -1
  28. package/es/src/charts/Matrix/emit.js +6 -0
  29. package/es/src/charts/Matrix/emit.js.map +1 -1
  30. package/es/src/charts/Matrix/index.js +1 -2
  31. package/es/src/charts/Matrix/index.js.map +1 -1
  32. package/es/src/charts/Network/emit.js +58 -24
  33. package/es/src/charts/Network/emit.js.map +1 -1
  34. package/es/src/charts/Network/index.js +34 -54
  35. package/es/src/charts/Network/index.js.map +1 -1
  36. package/es/src/charts/Pack/emit.js +3 -0
  37. package/es/src/charts/Pack/emit.js.map +1 -1
  38. package/es/src/charts/Pack/index.js +1 -2
  39. package/es/src/charts/Pack/index.js.map +1 -1
  40. package/es/src/charts/Pie/emit.js +6 -2
  41. package/es/src/charts/Pie/emit.js.map +1 -1
  42. package/es/src/charts/Pie/index.js +1 -2
  43. package/es/src/charts/Pie/index.js.map +1 -1
  44. package/es/src/charts/Plot/index.js +99 -4
  45. package/es/src/charts/Plot/index.js.map +1 -1
  46. package/es/src/charts/Plot/pipeline.js +25 -5
  47. package/es/src/charts/Plot/pipeline.js.map +1 -1
  48. package/es/src/charts/Plot/plotZoom.js +278 -0
  49. package/es/src/charts/Plot/plotZoom.js.map +1 -0
  50. package/es/src/charts/Priestley/emit.js +4 -0
  51. package/es/src/charts/Priestley/emit.js.map +1 -1
  52. package/es/src/charts/Priestley/index.js +1 -2
  53. package/es/src/charts/Priestley/index.js.map +1 -1
  54. package/es/src/charts/Radar/emit.js +4 -1
  55. package/es/src/charts/Radar/emit.js.map +1 -1
  56. package/es/src/charts/Radar/index.js +1 -2
  57. package/es/src/charts/Radar/index.js.map +1 -1
  58. package/es/src/charts/RadialMatrix/emit.js +6 -0
  59. package/es/src/charts/RadialMatrix/emit.js.map +1 -1
  60. package/es/src/charts/RadialMatrix/index.js +1 -2
  61. package/es/src/charts/RadialMatrix/index.js.map +1 -1
  62. package/es/src/charts/Rings/emit.js +74 -8
  63. package/es/src/charts/Rings/emit.js.map +1 -1
  64. package/es/src/charts/Rings/index.js +11 -3
  65. package/es/src/charts/Rings/index.js.map +1 -1
  66. package/es/src/charts/Sankey/emit.js +55 -11
  67. package/es/src/charts/Sankey/emit.js.map +1 -1
  68. package/es/src/charts/Sankey/index.js +8 -2
  69. package/es/src/charts/Sankey/index.js.map +1 -1
  70. package/es/src/charts/StackedArea/index.js +1 -2
  71. package/es/src/charts/StackedArea/index.js.map +1 -1
  72. package/es/src/charts/Tree/emit.js +8 -2
  73. package/es/src/charts/Tree/emit.js.map +1 -1
  74. package/es/src/charts/Tree/index.js +1 -2
  75. package/es/src/charts/Tree/index.js.map +1 -1
  76. package/es/src/charts/Treemap/index.js +1 -2
  77. package/es/src/charts/Treemap/index.js.map +1 -1
  78. package/es/src/charts/definition/ChartDefinition.js.map +1 -1
  79. package/es/src/charts/drawSteps/backControl.js +70 -0
  80. package/es/src/charts/drawSteps/backControl.js.map +1 -0
  81. package/es/src/charts/drawSteps/controlButtonStyle.js +108 -0
  82. package/es/src/charts/drawSteps/controlButtonStyle.js.map +1 -0
  83. package/es/src/charts/drawSteps/minimap.js +370 -0
  84. package/es/src/charts/drawSteps/minimap.js.map +1 -0
  85. package/es/src/charts/drawSteps/minimapMarkup.js +147 -0
  86. package/es/src/charts/drawSteps/minimapMarkup.js.map +1 -0
  87. package/es/src/charts/drawSteps/searchControls.js +358 -0
  88. package/es/src/charts/drawSteps/searchControls.js.map +1 -0
  89. package/es/src/charts/drawSteps/searchControlsMarkup.js +430 -0
  90. package/es/src/charts/drawSteps/searchControlsMarkup.js.map +1 -0
  91. package/es/src/charts/drawSteps/tableView.js +173 -0
  92. package/es/src/charts/drawSteps/tableView.js.map +1 -0
  93. package/es/src/charts/drawSteps/tableViewControl.js +39 -0
  94. package/es/src/charts/drawSteps/tableViewControl.js.map +1 -0
  95. package/es/src/charts/drawSteps/tableViewMarkup.js +647 -0
  96. package/es/src/charts/drawSteps/tableViewMarkup.js.map +1 -0
  97. package/es/src/charts/drawSteps/topLeftControls.js +73 -0
  98. package/es/src/charts/drawSteps/topLeftControls.js.map +1 -0
  99. package/es/src/charts/drawSteps/topLeftControlsMarkup.js +227 -0
  100. package/es/src/charts/drawSteps/topLeftControlsMarkup.js.map +1 -0
  101. package/es/src/charts/drawSteps/zoomControls.js +314 -175
  102. package/es/src/charts/drawSteps/zoomControls.js.map +1 -1
  103. package/es/src/charts/drawSteps/zoomControlsMarkup.js +280 -0
  104. package/es/src/charts/drawSteps/zoomControlsMarkup.js.map +1 -0
  105. package/es/src/charts/features/attributionFeature.js +137 -0
  106. package/es/src/charts/features/attributionFeature.js.map +1 -0
  107. package/es/src/charts/features/axes.js +20 -8
  108. package/es/src/charts/features/axes.js.map +1 -1
  109. package/es/src/charts/features/chartGeometry.js +16 -2
  110. package/es/src/charts/features/chartGeometry.js.map +1 -1
  111. package/es/src/charts/features/edgeArrows.js +155 -0
  112. package/es/src/charts/features/edgeArrows.js.map +1 -0
  113. package/es/src/charts/features/emitHelpers.js +8 -0
  114. package/es/src/charts/features/emitHelpers.js.map +1 -1
  115. package/es/src/charts/features/ensureZoomDom.js +63 -12
  116. package/es/src/charts/features/ensureZoomDom.js.map +1 -1
  117. package/es/src/charts/features/features.js +83 -110
  118. package/es/src/charts/features/features.js.map +1 -1
  119. package/es/src/charts/features/featuresLegend.js +45 -17
  120. package/es/src/charts/features/featuresLegend.js.map +1 -1
  121. package/es/src/charts/features/plotPaint.js +32 -7
  122. package/es/src/charts/features/plotPaint.js.map +1 -1
  123. package/es/src/charts/features/shapeEmit.js +3 -1
  124. package/es/src/charts/features/shapeEmit.js.map +1 -1
  125. package/es/src/charts/features/zoomExtent.js +185 -0
  126. package/es/src/charts/features/zoomExtent.js.map +1 -0
  127. package/es/src/charts/helpers/tileAttributions.js +26 -0
  128. package/es/src/charts/helpers/tileAttributions.js.map +1 -1
  129. package/es/src/charts/index.js +1 -0
  130. package/es/src/charts/index.js.map +1 -1
  131. package/es/src/charts/pipeline/runVizPipeline.js +33 -14
  132. package/es/src/charts/pipeline/runVizPipeline.js.map +1 -1
  133. package/es/src/charts/pipeline/vizDrawPure.js +32 -6
  134. package/es/src/charts/pipeline/vizDrawPure.js.map +1 -1
  135. package/es/src/charts/viz/Viz.js +102 -61
  136. package/es/src/charts/viz/Viz.js.map +1 -1
  137. package/es/src/charts/viz/VizBase.js +157 -4
  138. package/es/src/charts/viz/VizBase.js.map +1 -1
  139. package/es/src/charts/viz/VizBaseConfig.js +32 -2
  140. package/es/src/charts/viz/VizBaseConfig.js.map +1 -1
  141. package/es/src/charts/viz/interactionOpacity.js +4 -1
  142. package/es/src/charts/viz/interactionOpacity.js.map +1 -1
  143. package/es/src/charts/viz/vizDefaults.js +247 -51
  144. package/es/src/charts/viz/vizDefaults.js.map +1 -1
  145. package/es/src/charts/viz/vizRender.js +7 -3
  146. package/es/src/charts/viz/vizRender.js.map +1 -1
  147. package/es/src/charts/viz/vizTypes.js.map +1 -1
  148. package/es/src/components/Axis/Axis.js +10 -1
  149. package/es/src/components/Axis/Axis.js.map +1 -1
  150. package/es/src/components/Axis/axisLayoutLabels.js +2 -1
  151. package/es/src/components/Axis/axisLayoutLabels.js.map +1 -1
  152. package/es/src/components/Axis/axisRender.js +5 -1
  153. package/es/src/components/Axis/axisRender.js.map +1 -1
  154. package/es/src/components/Legend/legendConfig.js +86 -20
  155. package/es/src/components/Legend/legendConfig.js.map +1 -1
  156. package/es/src/shapes/Shape.js +12 -10
  157. package/es/src/shapes/Shape.js.map +1 -1
  158. package/es/src/shapes/hitAreaNode.js +31 -5
  159. package/es/src/shapes/hitAreaNode.js.map +1 -1
  160. package/es/src/shapes/interactionPoints.js +30 -0
  161. package/es/src/shapes/interactionPoints.js.map +1 -0
  162. package/es/src/utils/D3plusConfig.js.map +1 -1
  163. package/package.json +11 -10
  164. package/types/index.d.ts +1 -1
  165. package/types/internal.d.ts +8 -1
  166. package/types/src/charts/Chord/applyLayout.d.ts +43 -0
  167. package/types/src/charts/Chord/emit.d.ts +10 -0
  168. package/types/src/charts/Chord/index.d.ts +19 -0
  169. package/types/src/charts/Geomap/basemapTheme.d.ts +35 -0
  170. package/types/src/charts/Plot/index.d.ts +32 -2
  171. package/types/src/charts/Plot/pipeline.d.ts +2 -1
  172. package/types/src/charts/Plot/plotZoom.d.ts +65 -0
  173. package/types/src/charts/definition/ChartDefinition.d.ts +3 -1
  174. package/types/src/charts/drawSteps/backControl.d.ts +29 -0
  175. package/types/src/charts/drawSteps/controlButtonStyle.d.ts +45 -0
  176. package/types/src/charts/drawSteps/minimap.d.ts +19 -0
  177. package/types/src/charts/drawSteps/minimapMarkup.d.ts +45 -0
  178. package/types/src/charts/drawSteps/searchControls.d.ts +3 -0
  179. package/types/src/charts/drawSteps/searchControlsMarkup.d.ts +111 -0
  180. package/types/src/charts/drawSteps/tableView.d.ts +23 -0
  181. package/types/src/charts/drawSteps/tableViewControl.d.ts +21 -0
  182. package/types/src/charts/drawSteps/tableViewMarkup.d.ts +119 -0
  183. package/types/src/charts/drawSteps/topLeftControls.d.ts +32 -0
  184. package/types/src/charts/drawSteps/topLeftControlsMarkup.d.ts +72 -0
  185. package/types/src/charts/drawSteps/zoomControls.d.ts +48 -8
  186. package/types/src/charts/drawSteps/zoomControlsMarkup.d.ts +138 -0
  187. package/types/src/charts/features/attributionFeature.d.ts +21 -0
  188. package/types/src/charts/features/axes.d.ts +1 -1
  189. package/types/src/charts/features/chartGeometry.d.ts +9 -3
  190. package/types/src/charts/features/edgeArrows.d.ts +92 -0
  191. package/types/src/charts/features/emitHelpers.d.ts +11 -0
  192. package/types/src/charts/features/ensureZoomDom.d.ts +6 -2
  193. package/types/src/charts/features/features.d.ts +32 -17
  194. package/types/src/charts/features/featuresLegend.d.ts +15 -0
  195. package/types/src/charts/features/plotPaint.d.ts +15 -2
  196. package/types/src/charts/features/zoomExtent.d.ts +25 -0
  197. package/types/src/charts/index.d.ts +1 -0
  198. package/types/src/charts/pipeline/runVizPipeline.d.ts +6 -3
  199. package/types/src/charts/viz/Viz.d.ts +31 -1
  200. package/types/src/charts/viz/VizBase.d.ts +86 -4
  201. package/types/src/charts/viz/VizBaseConfig.d.ts +20 -2
  202. package/types/src/charts/viz/vizDefaults.d.ts +155 -0
  203. package/types/src/charts/viz/vizTypes.d.ts +75 -1
  204. package/types/src/components/Axis/Axis.d.ts +2 -0
  205. package/types/src/shapes/Shape.d.ts +2 -2
  206. package/types/src/shapes/hitAreaNode.d.ts +5 -4
  207. package/types/src/shapes/interactionPoints.d.ts +15 -0
  208. package/types/src/utils/D3plusConfig.d.ts +102 -8
  209. package/umd/d3plus-core.full.js +39793 -34875
  210. package/umd/d3plus-core.full.js.map +1 -1
  211. package/umd/d3plus-core.full.min.js +5836 -4264
  212. package/umd/d3plus-core.js +13998 -9927
  213. package/umd/d3plus-core.js.map +1 -1
  214. package/umd/d3plus-core.min.js +3716 -2264
@@ -0,0 +1,147 @@
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
+ */ import { minimapLabelStyleDefault, minimapStyleDefault, minimapViewportStyleActiveDefault, minimapViewportStyleDefault } from "../viz/vizDefaults.js";
7
+ import { kebab } from "./zoomControlsMarkup.js";
8
+ /**
9
+ Resolves a `minimapStyle`/`minimapViewportStyle`/`minimapViewportStyleActive`/
10
+ `minimapLabelStyle` value for painting. Setting `minimapClassName`
11
+ auto-disables whichever of the four is still the untouched built-in
12
+ default (identified by reference — see `minimapStyleDefault` et al. in
13
+ `vizDefaults.ts`) so a host page's own styling can apply through the
14
+ cascade without also requiring `.minimapStyle(false)` etc. An explicit
15
+ custom style object (a different reference) always wins, className or not.
16
+ Mirrors `resolveZoomControlStyle` in `zoomControlsMarkup.ts`.
17
+ */ function resolveMinimapStyle(viz, value, defaultValue) {
18
+ if (viz.schema.minimapClassName && value === defaultValue) return {};
19
+ return value || {};
20
+ }
21
+ /** The resolved outer / viewport / viewport-active / label styles for a chart. */ export function minimapStyles(viz) {
22
+ return {
23
+ outer: resolveMinimapStyle(viz, viz.schema.minimapStyle, minimapStyleDefault),
24
+ viewport: resolveMinimapStyle(viz, viz.schema.minimapViewportStyle, minimapViewportStyleDefault),
25
+ viewportActive: resolveMinimapStyle(viz, viz.schema.minimapViewportStyleActive, minimapViewportStyleActiveDefault),
26
+ label: resolveMinimapStyle(viz, viz.schema.minimapLabelStyle, minimapLabelStyleDefault)
27
+ };
28
+ }
29
+ /**
30
+ Paints one or more style layers onto an element, clearing the union of
31
+ their keys first so leaving a state (e.g. no longer dragging) fully
32
+ undoes it. Mirrors `paintZoomButton`'s clear-then-apply pattern in
33
+ `zoomControlsMarkup.ts`.
34
+ */ export function paintMinimapStyle(el) {
35
+ for(var _len = arguments.length, layers = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
36
+ layers[_key - 1] = arguments[_key];
37
+ }
38
+ var keys = new Set();
39
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined, _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
40
+ try {
41
+ for(var _iterator = layers[Symbol.iterator](), _step; !(_iteratorNormalCompletion1 = (_step = _iterator.next()).done); _iteratorNormalCompletion1 = true){
42
+ var style = _step.value;
43
+ try {
44
+ for(var _iterator1 = Object.keys(style)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion = true){
45
+ var key = _step1.value;
46
+ keys.add(key);
47
+ }
48
+ } catch (err) {
49
+ _didIteratorError = true;
50
+ _iteratorError = err;
51
+ } finally{
52
+ try {
53
+ if (!_iteratorNormalCompletion && _iterator1.return != null) {
54
+ _iterator1.return();
55
+ }
56
+ } finally{
57
+ if (_didIteratorError) {
58
+ throw _iteratorError;
59
+ }
60
+ }
61
+ }
62
+ }
63
+ } catch (err) {
64
+ _didIteratorError1 = true;
65
+ _iteratorError1 = err;
66
+ } finally{
67
+ try {
68
+ if (!_iteratorNormalCompletion1 && _iterator.return != null) {
69
+ _iterator.return();
70
+ }
71
+ } finally{
72
+ if (_didIteratorError1) {
73
+ throw _iteratorError1;
74
+ }
75
+ }
76
+ }
77
+ var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
78
+ try {
79
+ for(var _iterator2 = keys[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
80
+ var key1 = _step2.value;
81
+ el.style.removeProperty(kebab(key1));
82
+ }
83
+ } catch (err) {
84
+ _didIteratorError2 = true;
85
+ _iteratorError2 = err;
86
+ } finally{
87
+ try {
88
+ if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
89
+ _iterator2.return();
90
+ }
91
+ } finally{
92
+ if (_didIteratorError2) {
93
+ throw _iteratorError2;
94
+ }
95
+ }
96
+ }
97
+ var _iteratorNormalCompletion3 = true, _didIteratorError3 = false, _iteratorError3 = undefined;
98
+ try {
99
+ for(var _iterator3 = layers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true){
100
+ var style1 = _step3.value;
101
+ for(var key2 in style1){
102
+ var v = style1[key2];
103
+ if (v !== undefined && v !== null && v !== false) el.style.setProperty(kebab(key2), String(v));
104
+ }
105
+ }
106
+ } catch (err) {
107
+ _didIteratorError3 = true;
108
+ _iteratorError3 = err;
109
+ } finally{
110
+ try {
111
+ if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
112
+ _iterator3.return();
113
+ }
114
+ } finally{
115
+ if (_didIteratorError3) {
116
+ throw _iteratorError3;
117
+ }
118
+ }
119
+ }
120
+ }
121
+ /** Formats a zoom scale as a short label: `"2x"`, `"4.4x"`. */ export function formatZoomLabel(k) {
122
+ var rounded = Math.round(k * 10) / 10;
123
+ return "".concat(rounded % 1 === 0 ? rounded.toFixed(0) : rounded.toFixed(1), "x");
124
+ }
125
+ /**
126
+ The minimap's static HTML skeleton — no baked-in geometry; `onUpdate`
127
+ positions the viewport box and label live on every repaint (see
128
+ `minimap.ts`), the same reason `zoomControlsHtml` bakes in everything
129
+ that CAN change (locale, className) but nothing here changes per-tick.
130
+ The viewport box is `tabindex="0"` so it's keyboard-focusable — arrow
131
+ keys nudge the pan, matching what the `aria-label` describes. No ARIA
132
+ `role`: a 2D pan target doesn't map onto any single widget role (a
133
+ `slider` is one-dimensional), so a plain focusable, labeled element is
134
+ the more honest choice over one implying unmet role semantics.
135
+
136
+ `minimapClassName` (documented as applying to all three elements — the
137
+ outer box, viewport box, and label) is appended to the viewport/label
138
+ classes here; the outer box gets it separately, in `minimap.ts`'s panel
139
+ `className`, since that one isn't part of this inner HTML string.
140
+ */ export function minimapHtml(viz) {
141
+ var extraClass = viz.schema.minimapClassName ? " ".concat(viz.schema.minimapClassName) : "";
142
+ return '<div class="d3plus-minimap-viewport'.concat(extraClass, '" tabindex="0" aria-label="').concat(viz.schema.translate("Pan viewport — drag or use arrow keys"), '"></div>') + '<div class="d3plus-minimap-label'.concat(extraClass, '"></div>');
143
+ }
144
+ /** Right inset shared with the zoom-control panel, so the two clusters' right edges line up. */ export var MINIMAP_RIGHT_INSET = 4;
145
+ /** Vertical gap between the zoom-control panel and the minimap beneath it. */ export var MINIMAP_GAP = 4;
146
+
147
+ //# sourceMappingURL=minimapMarkup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/charts/drawSteps/minimapMarkup.ts"],"sourcesContent":["/**\n Markup, styling, and formatting for the minimap panel — mirrors\n `zoomControlsMarkup.ts`'s shape for the zoom-control buttons.\n\n @module\n*/\n\nimport type Viz from \"../viz/Viz.js\";\nimport {\n minimapLabelStyleDefault,\n minimapStyleDefault,\n minimapViewportStyleActiveDefault,\n minimapViewportStyleDefault,\n} from \"../viz/vizDefaults.js\";\nimport {kebab} from \"./zoomControlsMarkup.js\";\n\nexport type StyleObject = Record<string, string | number | undefined | null | false>;\ntype MinimapStyleValue = StyleObject | false | null | undefined;\n\n/**\n Resolves a `minimapStyle`/`minimapViewportStyle`/`minimapViewportStyleActive`/\n `minimapLabelStyle` value for painting. Setting `minimapClassName`\n auto-disables whichever of the four is still the untouched built-in\n default (identified by reference — see `minimapStyleDefault` et al. in\n `vizDefaults.ts`) so a host page's own styling can apply through the\n cascade without also requiring `.minimapStyle(false)` etc. An explicit\n custom style object (a different reference) always wins, className or not.\n Mirrors `resolveZoomControlStyle` in `zoomControlsMarkup.ts`.\n*/\nfunction resolveMinimapStyle(\n viz: Viz,\n value: MinimapStyleValue,\n defaultValue: MinimapStyleValue,\n): StyleObject {\n if (viz.schema.minimapClassName && value === defaultValue) return {};\n return value || {};\n}\n\n/** The resolved outer / viewport / viewport-active / label styles for a chart. */\nexport function minimapStyles(viz: Viz): {\n outer: StyleObject;\n viewport: StyleObject;\n viewportActive: StyleObject;\n label: StyleObject;\n} {\n return {\n outer: resolveMinimapStyle(viz, viz.schema.minimapStyle, minimapStyleDefault),\n viewport: resolveMinimapStyle(viz, viz.schema.minimapViewportStyle, minimapViewportStyleDefault),\n viewportActive: resolveMinimapStyle(\n viz,\n viz.schema.minimapViewportStyleActive,\n minimapViewportStyleActiveDefault,\n ),\n label: resolveMinimapStyle(viz, viz.schema.minimapLabelStyle, minimapLabelStyleDefault),\n };\n}\n\n/**\n Paints one or more style layers onto an element, clearing the union of\n their keys first so leaving a state (e.g. no longer dragging) fully\n undoes it. Mirrors `paintZoomButton`'s clear-then-apply pattern in\n `zoomControlsMarkup.ts`.\n*/\nexport function paintMinimapStyle(el: HTMLElement, ...layers: StyleObject[]): void {\n const keys = new Set<string>();\n for (const style of layers) for (const key of Object.keys(style)) keys.add(key);\n for (const key of keys) el.style.removeProperty(kebab(key));\n for (const style of layers)\n for (const key in style) {\n const v = style[key];\n if (v !== undefined && v !== null && v !== false) el.style.setProperty(kebab(key), String(v));\n }\n}\n\n/** Formats a zoom scale as a short label: `\"2x\"`, `\"4.4x\"`. */\nexport function formatZoomLabel(k: number): string {\n const rounded = Math.round(k * 10) / 10;\n return `${rounded % 1 === 0 ? rounded.toFixed(0) : rounded.toFixed(1)}x`;\n}\n\n/**\n The minimap's static HTML skeleton — no baked-in geometry; `onUpdate`\n positions the viewport box and label live on every repaint (see\n `minimap.ts`), the same reason `zoomControlsHtml` bakes in everything\n that CAN change (locale, className) but nothing here changes per-tick.\n The viewport box is `tabindex=\"0\"` so it's keyboard-focusable — arrow\n keys nudge the pan, matching what the `aria-label` describes. No ARIA\n `role`: a 2D pan target doesn't map onto any single widget role (a\n `slider` is one-dimensional), so a plain focusable, labeled element is\n the more honest choice over one implying unmet role semantics.\n\n `minimapClassName` (documented as applying to all three elements — the\n outer box, viewport box, and label) is appended to the viewport/label\n classes here; the outer box gets it separately, in `minimap.ts`'s panel\n `className`, since that one isn't part of this inner HTML string.\n*/\nexport function minimapHtml(viz: Viz): string {\n const extraClass = viz.schema.minimapClassName ? ` ${viz.schema.minimapClassName}` : \"\";\n return (\n `<div class=\"d3plus-minimap-viewport${extraClass}\" tabindex=\"0\" aria-label=\"${viz.schema.translate(\"Pan viewport — drag or use arrow keys\")}\"></div>` +\n `<div class=\"d3plus-minimap-label${extraClass}\"></div>`\n );\n}\n\n/** Right inset shared with the zoom-control panel, so the two clusters' right edges line up. */\nexport const MINIMAP_RIGHT_INSET = 4;\n/** Vertical gap between the zoom-control panel and the minimap beneath it. */\nexport const MINIMAP_GAP = 4;\n"],"names":["minimapLabelStyleDefault","minimapStyleDefault","minimapViewportStyleActiveDefault","minimapViewportStyleDefault","kebab","resolveMinimapStyle","viz","value","defaultValue","schema","minimapClassName","minimapStyles","outer","minimapStyle","viewport","minimapViewportStyle","viewportActive","minimapViewportStyleActive","label","minimapLabelStyle","paintMinimapStyle","el","layers","keys","Set","style","Object","key","add","removeProperty","v","undefined","setProperty","String","formatZoomLabel","k","rounded","Math","round","toFixed","minimapHtml","extraClass","translate","MINIMAP_RIGHT_INSET","MINIMAP_GAP"],"mappings":"AAAA;;;;;AAKA,GAGA,SACEA,wBAAwB,EACxBC,mBAAmB,EACnBC,iCAAiC,EACjCC,2BAA2B,QACtB,wBAAwB;AAC/B,SAAQC,KAAK,QAAO,0BAA0B;AAK9C;;;;;;;;;AASA,GACA,SAASC,oBACPC,GAAQ,EACRC,KAAwB,EACxBC,YAA+B;IAE/B,IAAIF,IAAIG,MAAM,CAACC,gBAAgB,IAAIH,UAAUC,cAAc,OAAO,CAAC;IACnE,OAAOD,SAAS,CAAC;AACnB;AAEA,gFAAgF,GAChF,OAAO,SA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,IAAMK,IAAIL,MAAK,CAACE,KAAI;gBACpB,IAAIG,MAAMC,aAAaD,MAAM,QAAQA,MAAM,OAAOT,GAAGI,KAAK,CAACO,WAAW,CAAC5B,MAAMuB,OAAMM,OAAOH;YAC5F;;;QAJG;QAAA;;;iBAAA,8BAAA;gBAAA;;;gBAAA;sBAAA;;;;AAKP;AAEA,6DAA6D,GAC7D,OAAO,SAASI,gBAAgBC,CAAS;IACvC,IAAMC,UAAUC,KAAKC,KAAK,CAACH,IAAI,MAAM;IACrC,OAAO,AAAC,GAA8D,OAA5DC,UAAU,MAAM,IAAIA,QAAQG,OAAO,CAAC,KAAKH,QAAQG,OAAO,CAAC,IAAG;AACxE;AAEA;;;;;;;;;;;;;;;AAeA,GACA,OAAO,SAASC,YAAYlC,GAAQ;IAClC,IAAMmC,aAAanC,IAAIG,MAAM,CAACC,gBAAgB,GAAG,AAAC,IAA+B,OAA5BJ,IAAIG,MAAM,CAACC,gBAAgB,IAAK;IACrF,OACE,AAAC,sCAA6EJ,OAAxCmC,YAAW,+BAA2F,OAA9DnC,IAAIG,MAAM,CAACiC,SAAS,CAAC,0CAAyC,cAC5I,AAAC,mCAA6C,OAAXD,YAAW;AAElD;AAEA,8FAA8F,GAC9F,OAAO,IAAME,sBAAsB,EAAE;AACrC,4EAA4E,GAC5E,OAAO,IAAMC,cAAc,EAAE"}
@@ -0,0 +1,358 @@
1
+ /**
2
+ @name searchContribution
3
+ The search control's contribution to the shared top-left controls panel
4
+ (`topLeftControls.ts`): a toggle button that expands into a text input,
5
+ whose typed value drives `.highlight()` with a predicate matching each
6
+ mark's resolved label (`viz._drawLabel`, or `.searchAccessor()`'s
7
+ override) — a persistent, standing highlight rather than `.hover()`'s
8
+ transient one, so it survives the user's mouse moving over the chart.
9
+
10
+ While the box is open it owns `viz._highlight` exclusively: opening
11
+ saves whatever predicate was already set (a chart author's own
12
+ `.highlight()` call, if any) into `viz._searchPrevHighlight`; typing
13
+ drives the search predicate; closing restores the saved predicate and
14
+ clears the saved slot.
15
+
16
+ Toggling and typing both mutate DOM/instance state directly and call
17
+ `viz.highlight()` (which self-schedules its own lightweight repaint)
18
+ rather than `.render()` — like the zoom-brush toggle, neither changes
19
+ layout, so neither needs a layout pass. Crucially, this also means
20
+ typing never regenerates this panel's `html` string (only a full
21
+ `runVizPipeline()` pass does that), so the real `<input>` DOM node is
22
+ left alone by the renderer's overlay diffing and keeps focus/cursor
23
+ position naturally — a future edit that bakes the live term into the
24
+ generated html on every keystroke (instead of leaving the DOM node's
25
+ value alone) would break that.
26
+
27
+ Enter/Shift+Enter step through the matches (wrapping), updating the
28
+ `N/total` feedback and, on the SVG renderer, panning/zooming the
29
+ matched mark into view via the existing `_zoomToBounds` — computed from
30
+ the matched element's real `getBoundingClientRect()` rather than any
31
+ per-chart-type geometry, so it works for any mark shape (rect/circle/
32
+ path) without special-casing chart types. Canvas has no per-mark DOM to
33
+ measure, so there the step still updates the count/current-match state,
34
+ it just can't pan/zoom to it.
35
+
36
+ @module
37
+ */ import { markOverlayHtmlSynced } from "@d3plus/render";
38
+ import { applySearchClearVisible, applySearchCount, applySearchInputOpenState, isSearchOpen, paintSearchButton, searchButtonStyles, searchControlsHtml, searchHighlightPredicate, searchMatches, showsSearchControls } from "./searchControlsMarkup.js";
39
+ /**
40
+ Finds this contribution's OWN node within `viz._featurePanels` — the
41
+ "group" `topLeftControlsFeature.layout()` returned last, still sitting
42
+ frozen on the instance until the next full render — so its `.html` can
43
+ be updated in place. Structurally coupled to `topLeftControlsMarkup.ts`'s
44
+ node shape (a "group" keyed `viz-top-left-controls` whose children are
45
+ keyed `viz-top-left-controls-<contribution key>`); degrades to a no-op
46
+ rather than throwing if that shape ever changes.
47
+ */ function findFrozenSearchNode(viz) {
48
+ var _viz__featurePanels;
49
+ var panels = (_viz__featurePanels = viz._featurePanels) !== null && _viz__featurePanels !== void 0 ? _viz__featurePanels : [];
50
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
51
+ try {
52
+ for(var _iterator = panels[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
53
+ var panel = _step.value;
54
+ if ((panel === null || panel === void 0 ? void 0 : panel.key) !== "viz-top-left-controls" || !panel.children) continue;
55
+ var child = panel.children.find(function(c) {
56
+ return c.key === "viz-top-left-controls-search";
57
+ });
58
+ if (child) return child;
59
+ }
60
+ } catch (err) {
61
+ _didIteratorError = true;
62
+ _iteratorError = err;
63
+ } finally{
64
+ try {
65
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
66
+ _iterator.return();
67
+ }
68
+ } finally{
69
+ if (_didIteratorError) {
70
+ throw _iteratorError;
71
+ }
72
+ }
73
+ }
74
+ return null;
75
+ }
76
+ /**
77
+ Keeps this contribution's html in sync on BOTH sides of the renderer's
78
+ overlay diff after an imperative mutation (`_searchOpen`/`_searchTerm`
79
+ changing) — call this whenever either one does.
80
+
81
+ The diff (`applyOverlayToElement` in `@d3plus/render`) compares the
82
+ scene node's OWN `.html` against `__d3plusHTML`, a tracked "what I last
83
+ wrote" value on the overlay's host element. Between full renders, the
84
+ scene node itself (frozen in `viz._featurePanels` since the last one) is
85
+ NOT regenerated — only its live DOM is imperatively mutated here — so if
86
+ only the TRACKED side were updated to the fresh (now open/typed) html,
87
+ the two sides would disagree; the very next repaint for ANY OTHER reason
88
+ (a hover elsewhere, or `.highlight()`'s own self-scheduled repaint from
89
+ typing itself) would then see the frozen (stale, closed/empty) node
90
+ html as "changed" relative to the tracked (fresh) one and rewrite the
91
+ live DOM back to that stale content, discarding focus along the way —
92
+ the opposite of what this is trying to prevent. Updating the frozen
93
+ node's `.html` TOO keeps both sides equal, so neither an intervening
94
+ repaint nor the eventual next full render (which regenerates a fresh,
95
+ matching string from the same `_searchOpen`/`_searchTerm`) ever disagree
96
+ with what's already live.
97
+ */ function syncTrackedHtml(viz, host) {
98
+ var html = searchControlsHtml(viz);
99
+ var frozenNode = findFrozenSearchNode(viz);
100
+ if (frozenNode) frozenNode.html = html;
101
+ markOverlayHtmlSynced(host, html);
102
+ }
103
+ /**
104
+ Recomputes and displays the match-count feedback from CURRENT state.
105
+ Deliberately NOT baked into `searchControlsHtml` — the count depends on
106
+ the chart's data/scene, not on the search box's own state, so if it were
107
+ part of the generated html, a data change unrelated to search (e.g.
108
+ drilling down) would change this contribution's own html and force its
109
+ whole DOM — including the live `<input>` — to be torn down and rebuilt.
110
+ Called from `onUpdate` (every draw, so a data change alone keeps this
111
+ correct) as well as after typing/clearing/stepping.
112
+ */ function refreshCount(viz, host) {
113
+ var countEl = host.querySelector(".search-count");
114
+ if (!countEl) return;
115
+ var term = viz._searchTerm || "";
116
+ var hasTerm = term.trim().length > 0;
117
+ var total = hasTerm ? searchMatches(viz, term).length : 0;
118
+ // A full re-render (drill-down, `.data()`/filter change, resize) can
119
+ // shrink the match set out from under a previously-stepped-to index —
120
+ // typing/clearing/Enter always keep this in range themselves, but this
121
+ // runs on EVERY draw, so it's also the path that catches the matches
122
+ // silently changing underneath an unrelated re-render. Drop it rather
123
+ // than show an impossible position like "Match 6/2".
124
+ if (typeof viz._searchMatchIndex === "number" && viz._searchMatchIndex >= total) {
125
+ viz._searchMatchIndex = undefined;
126
+ }
127
+ applySearchCount(viz, countEl, hasTerm, viz._searchMatchIndex, total);
128
+ }
129
+ /** Resets the clear-button/count feedback after the match set changes (typing, clearing) — no "current" position yet. */ function refreshFeedback(viz, host, term) {
130
+ var hasTerm = term.trim().length > 0;
131
+ viz._searchMatchIndex = undefined;
132
+ var clearBtn = host.querySelector(".search-clear");
133
+ if (clearBtn) applySearchClearVisible(clearBtn, hasTerm);
134
+ refreshCount(viz, host);
135
+ }
136
+ /** Closes the search box: restores the saved highlight and resets the button/input DOM. */ function closeSearch(viz, host) {
137
+ var _viz__searchPrevHighlight;
138
+ viz._searchOpen = false;
139
+ viz._searchTerm = "";
140
+ viz.highlight((_viz__searchPrevHighlight = viz._searchPrevHighlight) !== null && _viz__searchPrevHighlight !== void 0 ? _viz__searchPrevHighlight : false);
141
+ viz._searchPrevHighlight = undefined;
142
+ syncTrackedHtml(viz, host);
143
+ refreshFeedback(viz, host, "");
144
+ var btn = host.querySelector(".search-toggle");
145
+ if (btn) {
146
+ btn.classList.remove("active");
147
+ btn.setAttribute("aria-pressed", "false");
148
+ paintSearchButton(viz, btn, btn.matches(":hover"));
149
+ }
150
+ var input = host.querySelector(".search-input");
151
+ if (input) {
152
+ input.value = "";
153
+ input.setAttribute("tabindex", "-1");
154
+ applySearchInputOpenState(input, false);
155
+ }
156
+ }
157
+ /** Opens the search box: saves the current highlight (if any) and focuses the input. */ function openSearch(viz, host) {
158
+ viz._searchOpen = true;
159
+ viz._searchPrevHighlight = viz._highlight;
160
+ syncTrackedHtml(viz, host);
161
+ var btn = host.querySelector(".search-toggle");
162
+ if (btn) {
163
+ btn.classList.add("active");
164
+ btn.setAttribute("aria-pressed", "true");
165
+ paintSearchButton(viz, btn, btn.matches(":hover"));
166
+ }
167
+ var input = host.querySelector(".search-input");
168
+ if (input) {
169
+ input.removeAttribute("tabindex");
170
+ applySearchInputOpenState(input, true);
171
+ input.focus();
172
+ }
173
+ }
174
+ function onToggleClick(viz, e) {
175
+ var host = e.currentTarget;
176
+ if (isSearchOpen(viz)) closeSearch(viz, host);
177
+ else openSearch(viz, host);
178
+ }
179
+ function applyTerm(viz, host, term) {
180
+ viz._searchTerm = term;
181
+ viz.highlight(searchHighlightPredicate(viz, term));
182
+ syncTrackedHtml(viz, host);
183
+ refreshFeedback(viz, host, term);
184
+ }
185
+ function onSearchInput(viz, e) {
186
+ var input = e.target;
187
+ applyTerm(viz, e.currentTarget, input.value);
188
+ }
189
+ function onClearClick(viz, e) {
190
+ var host = e.currentTarget;
191
+ var input = host.querySelector(".search-input");
192
+ if (input) input.value = "";
193
+ applyTerm(viz, host, "");
194
+ input === null || input === void 0 ? void 0 : input.focus();
195
+ }
196
+ /**
197
+ Finds the real DOM element the SVG renderer painted for a matched scene
198
+ node, via its stable `data-key` (`svgNodeAttrs.ts` stamps one on every
199
+ mark, keyed off the row's own id — not array position, so it's the same
200
+ element across repaints/re-sorts). Scans rather than building a CSS
201
+ attribute-selector string, so an id containing quotes can't break (or
202
+ inject into) the query.
203
+ */ function findMarkElement(container, key) {
204
+ var candidates = container.querySelectorAll("[data-key]");
205
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
206
+ try {
207
+ for(var _iterator = candidates[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
208
+ var el = _step.value;
209
+ if (el.getAttribute("data-key") === String(key)) return el;
210
+ }
211
+ } catch (err) {
212
+ _didIteratorError = true;
213
+ _iteratorError = err;
214
+ } finally{
215
+ try {
216
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
217
+ _iterator.return();
218
+ }
219
+ } finally{
220
+ if (_didIteratorError) {
221
+ throw _iteratorError;
222
+ }
223
+ }
224
+ }
225
+ return null;
226
+ }
227
+ /**
228
+ Pans/zooms the matched mark into view using its real rendered bounding
229
+ box — `getBoundingClientRect()` already resolves every ancestor
230
+ transform (group nesting, the chart's own positioning transform, the
231
+ current zoom/pan), so this needs no per-chart-type geometry, unlike
232
+ computing bounds from the scene node's own x/y/width/height would.
233
+ SVG-only: Canvas paints no per-mark DOM to measure (see the module doc).
234
+ */ function panToMatch(viz, host, key) {
235
+ var _host_parentElement;
236
+ if (viz._renderer === "canvas" || typeof viz._zoomToBounds !== "function") return;
237
+ // `host` is one overlay panel inside the shared `.d3plus-render-overlays`
238
+ // host div (@d3plus/render's `createOverlayHost`), which is itself a
239
+ // SIBLING of the rendered `<svg>` — not its parent. The chart's actual
240
+ // marks (and the svg to measure against) live two levels up, under the
241
+ // element the user originally `.select()`ed.
242
+ var container = (_host_parentElement = host.parentElement) === null || _host_parentElement === void 0 ? void 0 : _host_parentElement.parentElement;
243
+ var svg = container === null || container === void 0 ? void 0 : container.querySelector("svg");
244
+ if (!container || !svg) return;
245
+ var markEl = findMarkElement(container, key);
246
+ if (!markEl) return;
247
+ var elRect = markEl.getBoundingClientRect();
248
+ var svgRect = svg.getBoundingClientRect();
249
+ if (!elRect.width && !elRect.height) return;
250
+ viz._zoomToBounds([
251
+ [
252
+ elRect.left - svgRect.left,
253
+ elRect.top - svgRect.top
254
+ ],
255
+ [
256
+ elRect.right - svgRect.left,
257
+ elRect.bottom - svgRect.top
258
+ ]
259
+ ], viz.schema.duration);
260
+ }
261
+ /** Steps to the next (`direction: 1`) or previous (`-1`) match, wrapping, and updates the count feedback + (SVG) pans to it. */ function jumpToMatch(viz, host, direction) {
262
+ var term = viz._searchTerm || "";
263
+ if (!term.trim()) return;
264
+ var matches = searchMatches(viz, term);
265
+ if (!matches.length) return;
266
+ var count = matches.length;
267
+ var prev = viz._searchMatchIndex;
268
+ var next = ((typeof prev === "number" ? prev : direction === 1 ? -1 : 0) + direction + count) % count;
269
+ viz._searchMatchIndex = next;
270
+ refreshCount(viz, host);
271
+ panToMatch(viz, host, matches[next].node.key);
272
+ }
273
+ /**
274
+ Closes the search box on blur, but only when there's no term to preserve
275
+ — an empty, still-open box is just visual clutter once the user's
276
+ attention has moved on, while a typed term stays open so its highlight/
277
+ match-count feedback remains visible (e.g. while the user clicks a
278
+ matched mark). `relatedTarget` is the element GAINING focus; when it's
279
+ still inside this contribution's own host (the clear button, or the
280
+ toggle button itself mid-close-click), this is internal focus shuffling,
281
+ not the user leaving — skip so those clicks keep handling themselves.
282
+ */ function onSearchBlur(viz, host, e) {
283
+ if ((viz._searchTerm || "").trim().length > 0) return;
284
+ var next = e.relatedTarget;
285
+ if (next && host.contains(next)) return;
286
+ closeSearch(viz, host);
287
+ }
288
+ function onSearchKeydown(viz, e) {
289
+ var ke = e;
290
+ var host = e.currentTarget;
291
+ if (ke.key === "Escape") {
292
+ closeSearch(viz, host);
293
+ } else if (ke.key === "Enter") {
294
+ ke.preventDefault();
295
+ jumpToMatch(viz, host, ke.shiftKey ? -1 : 1);
296
+ }
297
+ }
298
+ export function searchContribution(viz) {
299
+ if (!showsSearchControls(viz)) return null;
300
+ return {
301
+ key: "search",
302
+ html: searchControlsHtml(viz),
303
+ styleSignature: JSON.stringify(searchButtonStyles(viz)),
304
+ events: {
305
+ ".search-toggle": {
306
+ click: function click(e) {
307
+ return onToggleClick(viz, e);
308
+ }
309
+ },
310
+ ".search-clear": {
311
+ click: function click(e) {
312
+ return onClearClick(viz, e);
313
+ }
314
+ },
315
+ ".search-input": {
316
+ input: function input(e) {
317
+ return onSearchInput(viz, e);
318
+ },
319
+ keydown: function keydown(e) {
320
+ return onSearchKeydown(viz, e);
321
+ }
322
+ }
323
+ },
324
+ // Hover can't be delegated (mouseenter/mouseleave don't bubble), so bind
325
+ // it here, guarded so it only binds once per DOM node — mirrors
326
+ // zoomControls.ts's `data-zoom-bound` pattern exactly.
327
+ onUpdate: function onUpdate(host) {
328
+ // Runs on EVERY draw (not just when this contribution's own html
329
+ // changed) — exactly why the match count lives here rather than in
330
+ // the generated html: a data/scene change alone (no search state
331
+ // change at all) still needs to refresh it.
332
+ refreshCount(viz, host);
333
+ var btn = host.querySelector(".search-toggle");
334
+ if (btn && !btn.dataset.searchBound) {
335
+ btn.dataset.searchBound = "1";
336
+ paintSearchButton(viz, btn);
337
+ btn.addEventListener("mouseenter", function() {
338
+ return paintSearchButton(viz, btn, true);
339
+ });
340
+ btn.addEventListener("mouseleave", function() {
341
+ return paintSearchButton(viz, btn);
342
+ });
343
+ }
344
+ // `blur` doesn't bubble, so it can't ride the declarative `events`
345
+ // map (which delegates via a bubbling listener on `host`) the way
346
+ // click/input/keydown do — bind it directly, same as hover above.
347
+ var input = host.querySelector(".search-input");
348
+ if (input && !input.dataset.searchBlurBound) {
349
+ input.dataset.searchBlurBound = "1";
350
+ input.addEventListener("blur", function(e) {
351
+ return onSearchBlur(viz, host, e);
352
+ });
353
+ }
354
+ }
355
+ };
356
+ }
357
+
358
+ //# sourceMappingURL=searchControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/charts/drawSteps/searchControls.ts"],"sourcesContent":["/**\n @name searchContribution\n The search control's contribution to the shared top-left controls panel\n (`topLeftControls.ts`): a toggle button that expands into a text input,\n whose typed value drives `.highlight()` with a predicate matching each\n mark's resolved label (`viz._drawLabel`, or `.searchAccessor()`'s\n override) — a persistent, standing highlight rather than `.hover()`'s\n transient one, so it survives the user's mouse moving over the chart.\n\n While the box is open it owns `viz._highlight` exclusively: opening\n saves whatever predicate was already set (a chart author's own\n `.highlight()` call, if any) into `viz._searchPrevHighlight`; typing\n drives the search predicate; closing restores the saved predicate and\n clears the saved slot.\n\n Toggling and typing both mutate DOM/instance state directly and call\n `viz.highlight()` (which self-schedules its own lightweight repaint)\n rather than `.render()` — like the zoom-brush toggle, neither changes\n layout, so neither needs a layout pass. Crucially, this also means\n typing never regenerates this panel's `html` string (only a full\n `runVizPipeline()` pass does that), so the real `<input>` DOM node is\n left alone by the renderer's overlay diffing and keeps focus/cursor\n position naturally — a future edit that bakes the live term into the\n generated html on every keystroke (instead of leaving the DOM node's\n value alone) would break that.\n\n Enter/Shift+Enter step through the matches (wrapping), updating the\n `N/total` feedback and, on the SVG renderer, panning/zooming the\n matched mark into view via the existing `_zoomToBounds` — computed from\n the matched element's real `getBoundingClientRect()` rather than any\n per-chart-type geometry, so it works for any mark shape (rect/circle/\n path) without special-casing chart types. Canvas has no per-mark DOM to\n measure, so there the step still updates the count/current-match state,\n it just can't pan/zoom to it.\n\n @module\n*/\nimport {markOverlayHtmlSynced} from \"@d3plus/render\";\n\nimport type Viz from \"../viz/Viz.js\";\nimport type {Contribution} from \"./topLeftControlsMarkup.js\";\nimport {\n applySearchClearVisible,\n applySearchCount,\n applySearchInputOpenState,\n isSearchOpen,\n paintSearchButton,\n searchButtonStyles,\n searchControlsHtml,\n searchHighlightPredicate,\n searchMatches,\n showsSearchControls,\n} from \"./searchControlsMarkup.js\";\n\n/**\n Finds this contribution's OWN node within `viz._featurePanels` — the\n \"group\" `topLeftControlsFeature.layout()` returned last, still sitting\n frozen on the instance until the next full render — so its `.html` can\n be updated in place. Structurally coupled to `topLeftControlsMarkup.ts`'s\n node shape (a \"group\" keyed `viz-top-left-controls` whose children are\n keyed `viz-top-left-controls-<contribution key>`); degrades to a no-op\n rather than throwing if that shape ever changes.\n*/\nfunction findFrozenSearchNode(viz: Viz): {html: string} | null {\n const panels = (viz._featurePanels ?? []) as Array<{\n key?: unknown;\n children?: Array<{key?: unknown; html?: string}>;\n }>;\n for (const panel of panels) {\n if (panel?.key !== \"viz-top-left-controls\" || !panel.children) continue;\n const child = panel.children.find(c => c.key === \"viz-top-left-controls-search\");\n if (child) return child as {html: string};\n }\n return null;\n}\n\n/**\n Keeps this contribution's html in sync on BOTH sides of the renderer's\n overlay diff after an imperative mutation (`_searchOpen`/`_searchTerm`\n changing) — call this whenever either one does.\n\n The diff (`applyOverlayToElement` in `@d3plus/render`) compares the\n scene node's OWN `.html` against `__d3plusHTML`, a tracked \"what I last\n wrote\" value on the overlay's host element. Between full renders, the\n scene node itself (frozen in `viz._featurePanels` since the last one) is\n NOT regenerated — only its live DOM is imperatively mutated here — so if\n only the TRACKED side were updated to the fresh (now open/typed) html,\n the two sides would disagree; the very next repaint for ANY OTHER reason\n (a hover elsewhere, or `.highlight()`'s own self-scheduled repaint from\n typing itself) would then see the frozen (stale, closed/empty) node\n html as \"changed\" relative to the tracked (fresh) one and rewrite the\n live DOM back to that stale content, discarding focus along the way —\n the opposite of what this is trying to prevent. Updating the frozen\n node's `.html` TOO keeps both sides equal, so neither an intervening\n repaint nor the eventual next full render (which regenerates a fresh,\n matching string from the same `_searchOpen`/`_searchTerm`) ever disagree\n with what's already live.\n*/\nfunction syncTrackedHtml(viz: Viz, host: HTMLElement): void {\n const html = searchControlsHtml(viz);\n const frozenNode = findFrozenSearchNode(viz);\n if (frozenNode) frozenNode.html = html;\n markOverlayHtmlSynced(host, html);\n}\n\n/**\n Recomputes and displays the match-count feedback from CURRENT state.\n Deliberately NOT baked into `searchControlsHtml` — the count depends on\n the chart's data/scene, not on the search box's own state, so if it were\n part of the generated html, a data change unrelated to search (e.g.\n drilling down) would change this contribution's own html and force its\n whole DOM — including the live `<input>` — to be torn down and rebuilt.\n Called from `onUpdate` (every draw, so a data change alone keeps this\n correct) as well as after typing/clearing/stepping.\n*/\nfunction refreshCount(viz: Viz, host: HTMLElement): void {\n const countEl = host.querySelector<HTMLElement>(\".search-count\");\n if (!countEl) return;\n const term = viz._searchTerm || \"\";\n const hasTerm = term.trim().length > 0;\n const total = hasTerm ? searchMatches(viz, term).length : 0;\n // A full re-render (drill-down, `.data()`/filter change, resize) can\n // shrink the match set out from under a previously-stepped-to index —\n // typing/clearing/Enter always keep this in range themselves, but this\n // runs on EVERY draw, so it's also the path that catches the matches\n // silently changing underneath an unrelated re-render. Drop it rather\n // than show an impossible position like \"Match 6/2\".\n if (typeof viz._searchMatchIndex === \"number\" && viz._searchMatchIndex >= total) {\n viz._searchMatchIndex = undefined;\n }\n applySearchCount(viz, countEl, hasTerm, viz._searchMatchIndex, total);\n}\n\n/** Resets the clear-button/count feedback after the match set changes (typing, clearing) — no \"current\" position yet. */\nfunction refreshFeedback(viz: Viz, host: HTMLElement, term: string): void {\n const hasTerm = term.trim().length > 0;\n viz._searchMatchIndex = undefined;\n const clearBtn = host.querySelector<HTMLElement>(\".search-clear\");\n if (clearBtn) applySearchClearVisible(clearBtn, hasTerm);\n refreshCount(viz, host);\n}\n\n/** Closes the search box: restores the saved highlight and resets the button/input DOM. */\nfunction closeSearch(viz: Viz, host: HTMLElement): void {\n viz._searchOpen = false;\n viz._searchTerm = \"\";\n viz.highlight(viz._searchPrevHighlight ?? false);\n viz._searchPrevHighlight = undefined;\n syncTrackedHtml(viz, host);\n refreshFeedback(viz, host, \"\");\n\n const btn = host.querySelector<HTMLElement>(\".search-toggle\");\n if (btn) {\n btn.classList.remove(\"active\");\n btn.setAttribute(\"aria-pressed\", \"false\");\n paintSearchButton(viz, btn, btn.matches(\":hover\"));\n }\n const input = host.querySelector<HTMLInputElement>(\".search-input\");\n if (input) {\n input.value = \"\";\n input.setAttribute(\"tabindex\", \"-1\");\n applySearchInputOpenState(input, false);\n }\n}\n\n/** Opens the search box: saves the current highlight (if any) and focuses the input. */\nfunction openSearch(viz: Viz, host: HTMLElement): void {\n viz._searchOpen = true;\n viz._searchPrevHighlight = viz._highlight;\n syncTrackedHtml(viz, host);\n\n const btn = host.querySelector<HTMLElement>(\".search-toggle\");\n if (btn) {\n btn.classList.add(\"active\");\n btn.setAttribute(\"aria-pressed\", \"true\");\n paintSearchButton(viz, btn, btn.matches(\":hover\"));\n }\n const input = host.querySelector<HTMLInputElement>(\".search-input\");\n if (input) {\n input.removeAttribute(\"tabindex\");\n applySearchInputOpenState(input, true);\n input.focus();\n }\n}\n\nfunction onToggleClick(viz: Viz, e: Event): void {\n const host = e.currentTarget as HTMLElement;\n if (isSearchOpen(viz)) closeSearch(viz, host);\n else openSearch(viz, host);\n}\n\nfunction applyTerm(viz: Viz, host: HTMLElement, term: string): void {\n viz._searchTerm = term;\n viz.highlight(searchHighlightPredicate(viz, term));\n syncTrackedHtml(viz, host);\n refreshFeedback(viz, host, term);\n}\n\nfunction onSearchInput(viz: Viz, e: Event): void {\n const input = e.target as HTMLInputElement;\n applyTerm(viz, e.currentTarget as HTMLElement, input.value);\n}\n\nfunction onClearClick(viz: Viz, e: Event): void {\n const host = e.currentTarget as HTMLElement;\n const input = host.querySelector<HTMLInputElement>(\".search-input\");\n if (input) input.value = \"\";\n applyTerm(viz, host, \"\");\n input?.focus();\n}\n\n/**\n Finds the real DOM element the SVG renderer painted for a matched scene\n node, via its stable `data-key` (`svgNodeAttrs.ts` stamps one on every\n mark, keyed off the row's own id — not array position, so it's the same\n element across repaints/re-sorts). Scans rather than building a CSS\n attribute-selector string, so an id containing quotes can't break (or\n inject into) the query.\n*/\nfunction findMarkElement(container: Element, key: unknown): HTMLElement | null {\n const candidates = container.querySelectorAll<HTMLElement>(\"[data-key]\");\n for (const el of candidates) if (el.getAttribute(\"data-key\") === String(key)) return el;\n return null;\n}\n\n/**\n Pans/zooms the matched mark into view using its real rendered bounding\n box — `getBoundingClientRect()` already resolves every ancestor\n transform (group nesting, the chart's own positioning transform, the\n current zoom/pan), so this needs no per-chart-type geometry, unlike\n computing bounds from the scene node's own x/y/width/height would.\n SVG-only: Canvas paints no per-mark DOM to measure (see the module doc).\n*/\nfunction panToMatch(viz: Viz, host: HTMLElement, key: unknown): void {\n if (viz._renderer === \"canvas\" || typeof viz._zoomToBounds !== \"function\") return;\n // `host` is one overlay panel inside the shared `.d3plus-render-overlays`\n // host div (@d3plus/render's `createOverlayHost`), which is itself a\n // SIBLING of the rendered `<svg>` — not its parent. The chart's actual\n // marks (and the svg to measure against) live two levels up, under the\n // element the user originally `.select()`ed.\n const container = host.parentElement?.parentElement;\n const svg = container?.querySelector(\"svg\");\n if (!container || !svg) return;\n const markEl = findMarkElement(container, key);\n if (!markEl) return;\n const elRect = markEl.getBoundingClientRect();\n const svgRect = svg.getBoundingClientRect();\n if (!elRect.width && !elRect.height) return;\n viz._zoomToBounds(\n [\n [elRect.left - svgRect.left, elRect.top - svgRect.top],\n [elRect.right - svgRect.left, elRect.bottom - svgRect.top],\n ],\n viz.schema.duration,\n );\n}\n\n/** Steps to the next (`direction: 1`) or previous (`-1`) match, wrapping, and updates the count feedback + (SVG) pans to it. */\nfunction jumpToMatch(viz: Viz, host: HTMLElement, direction: 1 | -1): void {\n const term = viz._searchTerm || \"\";\n if (!term.trim()) return;\n const matches = searchMatches(viz, term);\n if (!matches.length) return;\n const count = matches.length;\n const prev = viz._searchMatchIndex;\n const next = ((typeof prev === \"number\" ? prev : direction === 1 ? -1 : 0) + direction + count) % count;\n viz._searchMatchIndex = next;\n refreshCount(viz, host);\n panToMatch(viz, host, matches[next].node.key);\n}\n\n/**\n Closes the search box on blur, but only when there's no term to preserve\n — an empty, still-open box is just visual clutter once the user's\n attention has moved on, while a typed term stays open so its highlight/\n match-count feedback remains visible (e.g. while the user clicks a\n matched mark). `relatedTarget` is the element GAINING focus; when it's\n still inside this contribution's own host (the clear button, or the\n toggle button itself mid-close-click), this is internal focus shuffling,\n not the user leaving — skip so those clicks keep handling themselves.\n*/\nfunction onSearchBlur(viz: Viz, host: HTMLElement, e: FocusEvent): void {\n if ((viz._searchTerm || \"\").trim().length > 0) return;\n const next = e.relatedTarget as Node | null;\n if (next && host.contains(next)) return;\n closeSearch(viz, host);\n}\n\nfunction onSearchKeydown(viz: Viz, e: Event): void {\n const ke = e as KeyboardEvent;\n const host = e.currentTarget as HTMLElement;\n if (ke.key === \"Escape\") {\n closeSearch(viz, host);\n } else if (ke.key === \"Enter\") {\n ke.preventDefault();\n jumpToMatch(viz, host, ke.shiftKey ? -1 : 1);\n }\n}\n\nexport function searchContribution(viz: Viz): Contribution | null {\n if (!showsSearchControls(viz)) return null;\n return {\n key: \"search\",\n html: searchControlsHtml(viz),\n styleSignature: JSON.stringify(searchButtonStyles(viz)),\n events: {\n \".search-toggle\": {click: (e: Event) => onToggleClick(viz, e)},\n \".search-clear\": {click: (e: Event) => onClearClick(viz, e)},\n \".search-input\": {\n input: (e: Event) => onSearchInput(viz, e),\n keydown: (e: Event) => onSearchKeydown(viz, e),\n },\n },\n // Hover can't be delegated (mouseenter/mouseleave don't bubble), so bind\n // it here, guarded so it only binds once per DOM node — mirrors\n // zoomControls.ts's `data-zoom-bound` pattern exactly.\n onUpdate: (host: HTMLElement) => {\n // Runs on EVERY draw (not just when this contribution's own html\n // changed) — exactly why the match count lives here rather than in\n // the generated html: a data/scene change alone (no search state\n // change at all) still needs to refresh it.\n refreshCount(viz, host);\n const btn = host.querySelector<HTMLElement>(\".search-toggle\");\n if (btn && !btn.dataset.searchBound) {\n btn.dataset.searchBound = \"1\";\n paintSearchButton(viz, btn);\n btn.addEventListener(\"mouseenter\", () => paintSearchButton(viz, btn, true));\n btn.addEventListener(\"mouseleave\", () => paintSearchButton(viz, btn));\n }\n // `blur` doesn't bubble, so it can't ride the declarative `events`\n // map (which delegates via a bubbling listener on `host`) the way\n // click/input/keydown do — bind it directly, same as hover above.\n const input = host.querySelector<HTMLInputElement>(\".search-input\");\n if (input && !input.dataset.searchBlurBound) {\n input.dataset.searchBlurBound = \"1\";\n input.addEventListener(\"blur\", e => onSearchBlur(viz, host, e as FocusEvent));\n }\n },\n };\n}\n"],"names":["markOverlayHtmlSynced","applySearchClearVisible","applySearchCount","applySearchInputOpenState","isSearchOpen","paintSearchButton","searchButtonStyles","searchControlsHtml","searchHighlightPredicate","searchMatches","showsSearchControls","findFrozenSearchNode","viz","panels","_featurePanels","panel","key","children","child","find","c","syncTrackedHtml","host","html","frozenNode","refreshCount","countEl","querySelector","term","_searchTerm","hasTerm","trim","length","total","_searchMatchIndex","undefined","refreshFeedback","clearBtn","closeSearch","_searchOpen","highlight","_searchPrevHighlight","btn","classList","remove","setAttribute","matches","input","value","openSearch","_highlight","add","removeAttribute","focus","onToggleClick","e","currentTarget","applyTerm","onSearchInput","target","onClearClick","findMarkElement","container","candidates","querySelectorAll","el","getAttribute","String","panToMatch","_renderer","_zoomToBounds","parentElement","svg","markEl","elRect","getBoundingClientRect","svgRect","width","height","left","top","right","bottom","schema","duration","jumpToMatch","direction","count","prev","next","node","onSearchBlur","relatedTarget","contains","onSearchKeydown","ke","preventDefault","shiftKey","searchContribution","styleSignature","JSON","stringify","events","click","keydown","onUpdate","dataset","searchBound","addEventListener","searchBlurBound"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,GACA,SAAQA,qBAAqB,QAAO,iBAAiB;AAIrD,SACEC,uBAAuB,EACvBC,gBAAgB,EAChBC,yBAAyB,EACzBC,YAAY,EACZC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,wBAAwB,EACxBC,aAAa,EACbC,mBAAmB,QACd,4BAA4B;AAEnC;;;;;;;;AAQA,GACA,SAASC,qBAAqBC,GAAQ;QACpBA;IAAhB,IAAMC,U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