@aquera/nile-visualization 2.9.52 → 2.9.54

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.
@@ -17,12 +17,15 @@ export interface MasterDetailSeries {
17
17
  export declare const MASTER_DETAIL_STACKING: readonly ["normal", "percent"];
18
18
  /** `''` (or any unknown value) means no stacking. */
19
19
  export type MasterDetailStacking = (typeof MASTER_DETAIL_STACKING)[number] | '';
20
+ export type MasterDetailHandleVariant = 'pill' | 'labeled';
21
+ export type MasterDetailHandleLabel = 'always' | 'active';
22
+ export type MasterDetailMask = 'solid' | 'frost';
20
23
  export declare const MASTER_DETAIL_SERIES_TYPES: readonly ["area", "line", "spline", "areaspline", "column", "bar"];
21
24
  export type MasterDetailSeriesType = (typeof MASTER_DETAIL_SERIES_TYPES)[number];
22
25
  export declare const MASTER_DETAIL_X_AXIS_TYPES: readonly ["datetime", "linear", "logarithmic", "category"];
23
26
  export type MasterDetailXAxisType = (typeof MASTER_DETAIL_X_AXIS_TYPES)[number];
24
27
  /** Every CSS part `nile-master-detail-chart` renders; `nile-chart` re-exports them as `master-detail-<part>`. */
25
- export declare const MASTER_DETAIL_CHART_PARTS: readonly ["detail-container", "master-container", "master-toggle", "navigator", "navigator-button", "navigator-bar", "navigator-slider", "navigator-pan-button"];
28
+ export declare const MASTER_DETAIL_CHART_PARTS: readonly ["detail-container", "master-container", "master-toggle", "navigator", "navigator-button", "navigator-bar", "navigator-slider", "navigator-pan-button", "navigator-handle", "navigator-window", "navigator-handle-label", "navigator-mask"];
26
29
  /**
27
30
  * @tag nile-master-detail-chart
28
31
  * @summary A detail chart above an overview (master) strip; dragging on the strip zooms the detail.
@@ -40,7 +43,14 @@ export declare const MASTER_DETAIL_CHART_PARTS: readonly ["detail-container", "m
40
43
  * (`navigator-slider`, `navigator-pan-buttons`).
41
44
  * @csspart navigator-slider - The `nile-slider` that positions the window (`navigator-slider`).
42
45
  * @csspart navigator-pan-button - Each pan button (`Pan back`, `Pan forward`) in the bar (`navigator-pan-buttons`).
46
+ * @csspart navigator-handle - Each draggable edge grip on the master window (`navigator-handles`).
47
+ * @csspart navigator-window - The draggable window body between the grips (`navigator-handles`).
48
+ * @csspart navigator-handle-label - The value pill above each `labeled` grip (`navigator-handle-variant="labeled"`).
49
+ * @csspart navigator-mask - Each frosted area outside the window on the master pane (`navigator-mask="frost"`).
43
50
  *
51
+ * @cssproperty --nile-master-detail-frost-tint - How much surface colour covers the master outside the window
52
+ * with `navigator-mask="frost"`: `0%` is clear, `100%` hides it. Default `45%`.
53
+ * @cssproperty --nile-master-detail-frost-blur - Blur behind the `frost` mask. Default `1px`; `0` turns it off.
44
54
  * @dependency nile-slider - `navigator-slider` renders a `nile-slider` from `@aquera/nile-elements`; register it in the app.
45
55
  */
46
56
  export declare class NileMasterDetailChart extends NileElement {
@@ -58,6 +68,9 @@ export declare class NileMasterDetailChart extends NileElement {
58
68
  private _panning;
59
69
  private _drag;
60
70
  private _dragFrame;
71
+ /** Live grip-drag gesture: which edge (or the body), the pointer id, and the master-axis geometry at grab. */
72
+ private _grip;
73
+ private _gripFrame;
61
74
  private toggleMasterCollapsed;
62
75
  config: SeparatedChartConfigInputType | null;
63
76
  chartTitle: string;
@@ -113,6 +126,35 @@ export declare class NileMasterDetailChart extends NileElement {
113
126
  * ending at the latest data. Empty opens on the full range.
114
127
  */
115
128
  navigatorDefaultWindow: string;
129
+ /**
130
+ * Draggable grips on the master window: an edge grip on each side resizes the window (the other edge
131
+ * stays put, grips never cross), the body between them moves it keeping its width. Each grip is a
132
+ * keyboard-focusable `role="slider"` thumb. Works in master+detail and `master-only`. Turns on
133
+ * `navigator-default-window`.
134
+ */
135
+ navigatorHandles: boolean;
136
+ /**
137
+ * Look of the `navigator-handles` grips: `pill` (default) is a small rounded grip; `labeled` is a
138
+ * full-height edge line with a grip and a pill above it showing the edge's value.
139
+ */
140
+ navigatorHandleVariant: MasterDetailHandleVariant;
141
+ /**
142
+ * When the `labeled` handles show their value pills: `active` (default) — only while a grip is hovered,
143
+ * focused or dragged, or the window is dragged — or `always`.
144
+ */
145
+ navigatorHandleLabel: MasterDetailHandleLabel;
146
+ /**
147
+ * Highcharts date format for the `labeled` handles' pills on a datetime axis, e.g. `%b %e` (default,
148
+ * `Jun 15`), `%e %b %Y` (`15 Jun 2026`) or `%H:%M`. Other axes show the formatted value.
149
+ */
150
+ navigatorHandleLabelFormat: string;
151
+ /**
152
+ * How the master pane shades the range outside the window: `solid` (default) fills it with `mask-fill`;
153
+ * `frost` blurs and fades it so the window stands out.
154
+ */
155
+ navigatorMask: MasterDetailMask;
156
+ private get _labeledHandles();
157
+ private get _frostMask();
116
158
  private _window;
117
159
  /** True when any navigator feature is on. */
118
160
  private get _anyNavigator();
@@ -153,6 +195,8 @@ export declare class NileMasterDetailChart extends NileElement {
153
195
  disconnectedCallback(): void;
154
196
  protected firstUpdated(): void;
155
197
  protected updated(changedProperties: PropertyValues): void;
198
+ /** Applies a handle-look or mask change to the master without resetting the window. */
199
+ private _restyleMaster;
156
200
  private setupResizeObserver;
157
201
  /** `series` when given, else one series built from `data` / `seriesName` / `seriesColor`. */
158
202
  private get _seriesList();
@@ -220,6 +264,24 @@ export declare class NileMasterDetailChart extends NileElement {
220
264
  private _onPanStart;
221
265
  private _onPanMove;
222
266
  private _onPanEnd;
267
+ /** Grip step for Shift + arrow: ~10% of the data points, at least one. */
268
+ private get _gripShiftStep();
269
+ /** Moves one window edge to data index `index`, clamped so the grips stay at least one point apart. */
270
+ private _resizeWindow;
271
+ /** The master x-axis, when the chart exists. */
272
+ private get _masterAxis();
273
+ /** Positions the two grips and the body over the master plot from the current window. No-op when off. */
274
+ private _positionHandles;
275
+ /** Centres each value pill on its edge, pushes the two apart when they would overlap, and keeps both inside the master. */
276
+ private _placeLabels;
277
+ private _onGripStart;
278
+ private _onGripMove;
279
+ private _onGripEnd;
280
+ private _onGripKeydown;
281
+ /** An x value as a `labeled` grip's pill shows it: `navigator-handle-label-format` on a datetime axis. */
282
+ private _formatShortX;
283
+ /** Formats an x value for a grip's `aria-valuetext`: a date on a datetime axis, else the raw value. */
284
+ private _formatX;
223
285
  /** Arrow keys pan, + / − zoom, when the chart pane has focus. */
224
286
  private _onNavKeydown;
225
287
  /**
@@ -232,6 +294,10 @@ export declare class NileMasterDetailChart extends NileElement {
232
294
  private _currentSliderKey;
233
295
  /** Bar under the master pane: optional ‹ pan, slider, › pan — each part on its own property. */
234
296
  private _renderNavigatorBar;
297
+ /** Draggable grips over the master window: an edge grip each side plus the movable body between them. */
298
+ private _renderOverlay;
299
+ private _renderGrip;
300
+ private _renderHandles;
235
301
  /** Map-style + / − zoom buttons, overlaid on the top-right corner of the chart. */
236
302
  private _renderZoomControls;
237
303
  private initCharts;
@@ -28,11 +28,17 @@ export const MASTER_DETAIL_CHART_PARTS = [
28
28
  'navigator-bar',
29
29
  'navigator-slider',
30
30
  'navigator-pan-button',
31
+ 'navigator-handle',
32
+ 'navigator-window',
33
+ 'navigator-handle-label',
34
+ 'navigator-mask',
31
35
  ];
32
36
  /** Duration units accepted by `navigator-default-window`, `navigator-pan-step` and `navigator-slider-step`. */
33
37
  const DURATION_UNITS = { m: 6e4, h: 36e5, d: 864e5, w: 6048e5 };
34
38
  /** Right spacing (px) reserved on the chart under the zoom control: 32px control + 8px offset + 8px gap. */
35
39
  const NAV_CONTROL_GUTTER = 48;
40
+ /** Room (px) reserved above the master plot for the `labeled` handles' value pills. */
41
+ const LABEL_ROOM = 26;
36
42
  /**
37
43
  * @tag nile-master-detail-chart
38
44
  * @summary A detail chart above an overview (master) strip; dragging on the strip zooms the detail.
@@ -50,7 +56,14 @@ const NAV_CONTROL_GUTTER = 48;
50
56
  * (`navigator-slider`, `navigator-pan-buttons`).
51
57
  * @csspart navigator-slider - The `nile-slider` that positions the window (`navigator-slider`).
52
58
  * @csspart navigator-pan-button - Each pan button (`Pan back`, `Pan forward`) in the bar (`navigator-pan-buttons`).
59
+ * @csspart navigator-handle - Each draggable edge grip on the master window (`navigator-handles`).
60
+ * @csspart navigator-window - The draggable window body between the grips (`navigator-handles`).
61
+ * @csspart navigator-handle-label - The value pill above each `labeled` grip (`navigator-handle-variant="labeled"`).
62
+ * @csspart navigator-mask - Each frosted area outside the window on the master pane (`navigator-mask="frost"`).
53
63
  *
64
+ * @cssproperty --nile-master-detail-frost-tint - How much surface colour covers the master outside the window
65
+ * with `navigator-mask="frost"`: `0%` is clear, `100%` hides it. Default `45%`.
66
+ * @cssproperty --nile-master-detail-frost-blur - Blur behind the `frost` mask. Default `1px`; `0` turns it off.
54
67
  * @dependency nile-slider - `navigator-slider` renders a `nile-slider` from `@aquera/nile-elements`; register it in the app.
55
68
  */
56
69
  let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
@@ -66,6 +79,9 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
66
79
  this._panning = false;
67
80
  this._drag = null;
68
81
  this._dragFrame = 0;
82
+ /** Live grip-drag gesture: which edge (or the body), the pointer id, and the master-axis geometry at grab. */
83
+ this._grip = null;
84
+ this._gripFrame = 0;
69
85
  this.config = null;
70
86
  this.chartTitle = '';
71
87
  this.chartSubtitle = '';
@@ -120,6 +136,33 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
120
136
  * ending at the latest data. Empty opens on the full range.
121
137
  */
122
138
  this.navigatorDefaultWindow = '';
139
+ /**
140
+ * Draggable grips on the master window: an edge grip on each side resizes the window (the other edge
141
+ * stays put, grips never cross), the body between them moves it keeping its width. Each grip is a
142
+ * keyboard-focusable `role="slider"` thumb. Works in master+detail and `master-only`. Turns on
143
+ * `navigator-default-window`.
144
+ */
145
+ this.navigatorHandles = false;
146
+ /**
147
+ * Look of the `navigator-handles` grips: `pill` (default) is a small rounded grip; `labeled` is a
148
+ * full-height edge line with a grip and a pill above it showing the edge's value.
149
+ */
150
+ this.navigatorHandleVariant = 'pill';
151
+ /**
152
+ * When the `labeled` handles show their value pills: `active` (default) — only while a grip is hovered,
153
+ * focused or dragged, or the window is dragged — or `always`.
154
+ */
155
+ this.navigatorHandleLabel = 'active';
156
+ /**
157
+ * Highcharts date format for the `labeled` handles' pills on a datetime axis, e.g. `%b %e` (default,
158
+ * `Jun 15`), `%e %b %Y` (`15 Jun 2026`) or `%H:%M`. Other axes show the formatted value.
159
+ */
160
+ this.navigatorHandleLabelFormat = '%b %e';
161
+ /**
162
+ * How the master pane shades the range outside the window: `solid` (default) fills it with `mask-fill`;
163
+ * `frost` blurs and fades it so the window stands out.
164
+ */
165
+ this.navigatorMask = 'solid';
123
166
  this._window = null;
124
167
  this.height = '600px';
125
168
  this.masterHeight = 100;
@@ -167,15 +210,23 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
167
210
  this.masterChart?.reflow();
168
211
  }
169
212
  }
213
+ get _labeledHandles() {
214
+ return this.navigatorHandles && this.navigatorHandleVariant === 'labeled';
215
+ }
216
+ get _frostMask() {
217
+ return this.navigatorMask === 'frost';
218
+ }
170
219
  /** True when any navigator feature is on. */
171
220
  get _anyNavigator() {
172
- return this.navigatorControls || this.navigatorSlider || this.navigatorPanButtons;
221
+ return this.navigatorControls || this.navigatorSlider || this.navigatorPanButtons || this.navigatorHandles;
173
222
  }
174
223
  /** Re-renders only when a navigator is shown, so plain charts skip the extra update. */
175
224
  _trackWindow(min, max) {
176
225
  this._window = { min, max };
177
226
  if (this._anyNavigator)
178
227
  this.requestUpdate();
228
+ if (this.navigatorHandles || this._frostMask)
229
+ this.updateComplete.then(() => this._positionHandles());
179
230
  }
180
231
  _cssLength(val) {
181
232
  return typeof val === 'number'
@@ -231,6 +282,8 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
231
282
  this.applyConfig(this.config);
232
283
  return;
233
284
  }
285
+ if (changedProperties.has('navigatorHandleLabelFormat'))
286
+ this._positionHandles();
234
287
  if (changedProperties.has('masterOnly')) {
235
288
  this.destroyCharts();
236
289
  if (!this.loading)
@@ -264,6 +317,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
264
317
  'navigatorControls',
265
318
  'navigatorSlider',
266
319
  'navigatorPanButtons',
320
+ 'navigatorHandles',
267
321
  'detailTitle',
268
322
  'masterTitle',
269
323
  'maskFill',
@@ -289,8 +343,12 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
289
343
  return oldV !== newV;
290
344
  }
291
345
  };
292
- if (!props.some(reallyChanged))
346
+ if (!props.some(reallyChanged)) {
347
+ if (changedProperties.has('navigatorHandleVariant') || changedProperties.has('navigatorMask')) {
348
+ this._restyleMaster();
349
+ }
293
350
  return;
351
+ }
294
352
  if (this.loading) {
295
353
  this.destroyCharts();
296
354
  return;
@@ -313,6 +371,15 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
313
371
  this.initCharts();
314
372
  }
315
373
  }
374
+ /** Applies a handle-look or mask change to the master without resetting the window. */
375
+ _restyleMaster() {
376
+ if (!this.masterChart || this.loading || !this._typesValid)
377
+ return;
378
+ this.masterChart.update(this.buildMasterOptions(), true, true);
379
+ if (this._window)
380
+ this.applySelection(this._window.min, this._window.max);
381
+ this._positionHandles();
382
+ }
316
383
  setupResizeObserver() {
317
384
  const target = this.detailContainer ?? this.masterContainer;
318
385
  if (!target)
@@ -514,6 +581,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
514
581
  // room — leave that mode untouched.
515
582
  marginBottom: mo ? undefined : 30,
516
583
  spacingRight: mo && this.navigatorControls ? NAV_CONTROL_GUTTER : undefined,
584
+ spacingTop: this._labeledHandles && !this.masterTitle ? 10 + LABEL_ROOM : undefined,
517
585
  zoomType: 'x',
518
586
  events: {
519
587
  selection(event) {
@@ -536,9 +604,18 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
536
604
  self.setZoomed(true);
537
605
  return false;
538
606
  },
607
+ redraw() {
608
+ self._positionHandles();
609
+ },
610
+ render() {
611
+ self._positionHandles();
612
+ },
539
613
  },
540
614
  },
541
- title: { text: this.masterTitle || undefined },
615
+ title: {
616
+ text: this.masterTitle || undefined,
617
+ ...(this._labeledHandles && this.masterTitle ? { margin: 15 + LABEL_ROOM } : {}),
618
+ },
542
619
  // With several series the legend lives on the detail pane, so the master
543
620
  // must use the same colours or the overview contradicts it. Inherit the
544
621
  // detail palette (`options.colors`, which nile-chart fills from its theme)
@@ -636,6 +713,8 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
636
713
  const xAxis = this.masterChart.xAxis[0];
637
714
  xAxis.removePlotBand('mask-before');
638
715
  xAxis.removePlotBand('mask-after');
716
+ if (this._frostMask)
717
+ return;
639
718
  if (min > dataMin)
640
719
  xAxis.addPlotBand({ id: 'mask-before', from: dataMin, to: min, color: this.maskFill });
641
720
  if (max < dataMax)
@@ -916,6 +995,194 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
916
995
  this._drag = null;
917
996
  this._panning = false;
918
997
  }
998
+ /** Grip step for Shift + arrow: ~10% of the data points, at least one. */
999
+ get _gripShiftStep() {
1000
+ return Math.max(1, Math.round(this._allXs().length * 0.1));
1001
+ }
1002
+ /** Moves one window edge to data index `index`, clamped so the grips stay at least one point apart. */
1003
+ _resizeWindow(edge, index) {
1004
+ const cur = this._windowIndices();
1005
+ const xs = this._allXs();
1006
+ if (!cur || xs.length < 2)
1007
+ return;
1008
+ const last = xs.length - 1;
1009
+ let { lo, hi } = cur;
1010
+ if (edge === 'start')
1011
+ lo = Math.min(Math.max(0, index), hi - 1);
1012
+ else
1013
+ hi = Math.max(Math.min(last, index), lo + 1);
1014
+ if (lo === cur.lo && hi === cur.hi)
1015
+ return;
1016
+ this._applyWindow(lo, hi);
1017
+ }
1018
+ /** The master x-axis, when the chart exists. */
1019
+ get _masterAxis() {
1020
+ return this.masterChart?.xAxis?.[0] ?? null;
1021
+ }
1022
+ /** Positions the two grips and the body over the master plot from the current window. No-op when off. */
1023
+ _positionHandles() {
1024
+ if (!(this.navigatorHandles || this._frostMask) || this.masterCollapsed)
1025
+ return;
1026
+ const chart = this.masterChart;
1027
+ const ax = this._masterAxis;
1028
+ const cur = this._windowIndices();
1029
+ if (!chart || !ax || typeof ax.toPixels !== 'function' || !cur)
1030
+ return;
1031
+ const xs = this._allXs();
1032
+ const left = ax.toPixels(xs[cur.lo], false);
1033
+ const right = ax.toPixels(xs[cur.hi], false);
1034
+ const top = chart.plotTop ?? 0;
1035
+ const height = chart.plotHeight ?? 0;
1036
+ const grips = this.renderRoot.querySelectorAll('[part~="navigator-handle"]');
1037
+ const body = this.renderRoot.querySelector('[part~="navigator-window"]');
1038
+ grips.forEach(g => {
1039
+ const px = g.dataset.edge === 'end' ? right : left;
1040
+ g.style.left = `${px}px`;
1041
+ g.style.top = `${top}px`;
1042
+ g.style.height = `${height}px`;
1043
+ });
1044
+ this._placeLabels(grips, left, right);
1045
+ if (body) {
1046
+ body.style.left = `${left}px`;
1047
+ body.style.width = `${Math.max(0, right - left)}px`;
1048
+ body.style.top = `${top}px`;
1049
+ body.style.height = `${height}px`;
1050
+ }
1051
+ const plotLeft = chart.plotLeft ?? 0;
1052
+ const plotRight = plotLeft + (chart.plotWidth ?? 0);
1053
+ this.renderRoot.querySelectorAll('[part~="navigator-mask"]').forEach(m => {
1054
+ const [from, to] = m.dataset.side === 'after' ? [right, plotRight] : [plotLeft, left];
1055
+ m.style.left = `${from}px`;
1056
+ m.style.width = `${Math.max(0, to - from)}px`;
1057
+ m.style.top = `${top}px`;
1058
+ m.style.height = `${height}px`;
1059
+ });
1060
+ }
1061
+ /** Centres each value pill on its edge, pushes the two apart when they would overlap, and keeps both inside the master. */
1062
+ _placeLabels(grips, left, right) {
1063
+ const width = grips[0]?.offsetParent?.clientWidth ?? 0;
1064
+ const labelOf = (edge) => Array.from(grips)
1065
+ .find(g => g.dataset.edge === edge)
1066
+ ?.querySelector('[part~="navigator-handle-label"]') ?? null;
1067
+ const start = labelOf('start');
1068
+ const end = labelOf('end');
1069
+ if (!start || !end || !width)
1070
+ return;
1071
+ const ws = start.offsetWidth;
1072
+ const we = end.offsetWidth;
1073
+ const gap = 4;
1074
+ let cs = left;
1075
+ let ce = right;
1076
+ const needed = ws / 2 + we / 2 + gap;
1077
+ if (ce - cs < needed) {
1078
+ const mid = (cs + ce) / 2 + (ws - we) / 4;
1079
+ cs = mid - needed / 2;
1080
+ ce = mid + needed / 2;
1081
+ }
1082
+ const under = Math.max(0, ws / 2 - cs);
1083
+ cs += under;
1084
+ ce += under;
1085
+ const over = Math.max(0, ce + we / 2 - width);
1086
+ cs -= over;
1087
+ ce -= over;
1088
+ start.style.marginLeft = cs !== left ? `${cs - left}px` : '';
1089
+ end.style.marginLeft = ce !== right ? `${ce - right}px` : '';
1090
+ }
1091
+ _onGripStart(e, edge) {
1092
+ if (e.button !== 0 || !e.isPrimary)
1093
+ return;
1094
+ const cur = this._windowIndices();
1095
+ const ax = this._masterAxis;
1096
+ const len = ax?.len;
1097
+ if (!cur || !len)
1098
+ return;
1099
+ const xs = this._allXs();
1100
+ const a = this._toScale(xs[cur.lo]);
1101
+ const b = this._toScale(xs[cur.hi]);
1102
+ const span = this._toScale(xs[xs.length - 1]) - this._toScale(xs[0]);
1103
+ this._grip = { id: e.pointerId, edge, x: e.clientX, a, b, perPx: span / len, active: false };
1104
+ // Capture at once: a narrow grip loses the pointer before the 4px threshold otherwise.
1105
+ try {
1106
+ e.currentTarget.setPointerCapture(e.pointerId);
1107
+ }
1108
+ catch {
1109
+ // Synthetic pointers can't be captured; the gesture still follows move events.
1110
+ }
1111
+ }
1112
+ _onGripMove(e) {
1113
+ const g = this._grip;
1114
+ if (!g || e.pointerId !== g.id)
1115
+ return;
1116
+ const dx = e.clientX - g.x;
1117
+ if (!g.active) {
1118
+ if (Math.abs(dx) < 4)
1119
+ return;
1120
+ g.active = true;
1121
+ try {
1122
+ e.currentTarget.setPointerCapture(e.pointerId);
1123
+ }
1124
+ catch {
1125
+ // Pointer already released (or synthetic) — the gesture still follows move events.
1126
+ }
1127
+ }
1128
+ e.preventDefault();
1129
+ cancelAnimationFrame(this._gripFrame);
1130
+ this._gripFrame = requestAnimationFrame(() => {
1131
+ const xs = this._allXs();
1132
+ const perPx = g.perPx;
1133
+ if (g.edge === 'body') {
1134
+ const shift = dx * perPx;
1135
+ this._setWindow(this._fromScale(g.a + shift), this._fromScale(g.b + shift));
1136
+ }
1137
+ else {
1138
+ const scale = (g.edge === 'start' ? g.a : g.b) + dx * perPx;
1139
+ this._resizeWindow(g.edge, this._nearestIndex(xs, this._fromScale(scale)));
1140
+ }
1141
+ });
1142
+ }
1143
+ _onGripEnd(e) {
1144
+ if (!this._grip || e.pointerId !== this._grip.id)
1145
+ return;
1146
+ this._grip = null;
1147
+ cancelAnimationFrame(this._gripFrame);
1148
+ }
1149
+ _onGripKeydown(e, edge) {
1150
+ if (e.altKey || e.ctrlKey || e.metaKey)
1151
+ return;
1152
+ const cur = this._windowIndices();
1153
+ const xs = this._allXs();
1154
+ if (!cur || xs.length < 2)
1155
+ return;
1156
+ const last = xs.length - 1;
1157
+ const idx = edge === 'start' ? cur.lo : cur.hi;
1158
+ const step = e.shiftKey ? this._gripShiftStep : 1;
1159
+ let next;
1160
+ if (e.key === 'ArrowLeft')
1161
+ next = idx - step;
1162
+ else if (e.key === 'ArrowRight')
1163
+ next = idx + step;
1164
+ else if (e.key === 'Home')
1165
+ next = edge === 'start' ? 0 : cur.lo + 1;
1166
+ else if (e.key === 'End')
1167
+ next = edge === 'start' ? cur.hi - 1 : last;
1168
+ else
1169
+ return;
1170
+ e.preventDefault();
1171
+ this._resizeWindow(edge, next);
1172
+ }
1173
+ /** An x value as a `labeled` grip's pill shows it: `navigator-handle-label-format` on a datetime axis. */
1174
+ _formatShortX(v) {
1175
+ if (this.xAxisType === 'datetime' && this._hc?.dateFormat) {
1176
+ return this._hc.dateFormat(this.navigatorHandleLabelFormat || '%b %e', v);
1177
+ }
1178
+ return this._formatX(v);
1179
+ }
1180
+ /** Formats an x value for a grip's `aria-valuetext`: a date on a datetime axis, else the raw value. */
1181
+ _formatX(v) {
1182
+ if (this.xAxisType === 'datetime' && this._hc?.dateFormat)
1183
+ return this._hc.dateFormat('%e %b %Y', v);
1184
+ return String(v);
1185
+ }
919
1186
  /** Arrow keys pan, + / − zoom, when the chart pane has focus. */
920
1187
  _onNavKeydown(e) {
921
1188
  if (!this.navigatorControls || e.altKey || e.ctrlKey || e.metaKey)
@@ -975,6 +1242,7 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
975
1242
  class="navigator-slider"
976
1243
  part="navigator-slider"
977
1244
  aria-label="Visible range position"
1245
+ .valueLabel=${'none'}
978
1246
  .minValue=${0}
979
1247
  .maxValue=${1000}
980
1248
  .value=${nav.sliderValue}
@@ -986,6 +1254,64 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
986
1254
  ${this.navigatorPanButtons ? this._panButton('ng-chevron-right', 'Pan forward', nav.atEnd, 1) : nothing}
987
1255
  </div>`;
988
1256
  }
1257
+ /** Draggable grips over the master window: an edge grip each side plus the movable body between them. */
1258
+ _renderOverlay(showHandles, showMask) {
1259
+ const overlayClasses = [
1260
+ 'navigator-overlay',
1261
+ this._labeledHandles ? 'navigator-overlay--labeled' : '',
1262
+ this._labeledHandles && this.navigatorHandleLabel === 'active' ? 'navigator-overlay--label-active' : '',
1263
+ ].join(' ');
1264
+ return html `<div class=${overlayClasses}>
1265
+ ${showMask
1266
+ ? html `<div class="navigator-mask" part="navigator-mask" data-side="before"></div>
1267
+ <div class="navigator-mask" part="navigator-mask" data-side="after"></div>`
1268
+ : nothing}
1269
+ ${showHandles ? this._renderHandles() : nothing}
1270
+ </div>`;
1271
+ }
1272
+ _renderGrip(edge, value, min, max) {
1273
+ const labeled = this._labeledHandles;
1274
+ return html `<div
1275
+ class="navigator-handle"
1276
+ part="navigator-handle"
1277
+ data-edge=${edge}
1278
+ role="slider"
1279
+ tabindex="0"
1280
+ aria-label=${edge === 'start' ? 'Window start' : 'Window end'}
1281
+ aria-valuemin=${min}
1282
+ aria-valuemax=${max}
1283
+ aria-valuenow=${value}
1284
+ aria-valuetext=${this._formatX(value)}
1285
+ @pointerdown=${(e) => this._onGripStart(e, edge)}
1286
+ @pointermove=${this._onGripMove}
1287
+ @pointerup=${this._onGripEnd}
1288
+ @pointercancel=${this._onGripEnd}
1289
+ @keydown=${(e) => this._onGripKeydown(e, edge)}
1290
+ >
1291
+ ${labeled
1292
+ ? html `<span class="navigator-handle-grip"></span
1293
+ ><span class="navigator-handle-label" part="navigator-handle-label" aria-hidden="true"
1294
+ >${this._formatShortX(value)}</span
1295
+ >`
1296
+ : nothing}
1297
+ </div>`;
1298
+ }
1299
+ _renderHandles() {
1300
+ const xs = this._allXs();
1301
+ const cur = this._windowIndices() ?? { lo: 0, hi: xs.length - 1 };
1302
+ const startX = xs[cur.lo];
1303
+ const endX = xs[cur.hi];
1304
+ return html `${this._renderGrip('start', startX, xs[0], endX)}
1305
+ <div
1306
+ class="navigator-window"
1307
+ part="navigator-window"
1308
+ @pointerdown=${(e) => this._onGripStart(e, 'body')}
1309
+ @pointermove=${this._onGripMove}
1310
+ @pointerup=${this._onGripEnd}
1311
+ @pointercancel=${this._onGripEnd}
1312
+ ></div>
1313
+ ${this._renderGrip('end', endX, startX, xs[xs.length - 1])}`;
1314
+ }
989
1315
  /** Map-style + / − zoom buttons, overlaid on the top-right corner of the chart. */
990
1316
  _renderZoomControls() {
991
1317
  const nav = this._navState;
@@ -1042,6 +1368,8 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
1042
1368
  const enoughData = this._allXs().length >= 2;
1043
1369
  const showNav = this.navigatorControls && enoughData;
1044
1370
  const showBar = (this.navigatorSlider || this.navigatorPanButtons) && enoughData;
1371
+ const showHandles = this.navigatorHandles && enoughData && !masterHidden;
1372
+ const showMask = this._frostMask && enoughData && !masterHidden && !this.masterOnly;
1045
1373
  const pannable = showNav && !this.masterOnly && !this._navState.full;
1046
1374
  const navLabel = 'Chart. Arrow keys pan, plus and minus zoom.';
1047
1375
  const detailClasses = [
@@ -1079,14 +1407,17 @@ let NileMasterDetailChart = class NileMasterDetailChart extends NileElement {
1079
1407
  </button>
1080
1408
  </nile-lite-tooltip>`
1081
1409
  : null}`}
1082
- <div
1083
- class="master-container ${masterHidden ? 'master-container--collapsed' : ''}"
1084
- part="master-container"
1085
- tabindex=${showNav && this.masterOnly ? '0' : nothing}
1086
- role=${showNav && this.masterOnly ? 'region' : nothing}
1087
- aria-label=${showNav && this.masterOnly ? navLabel : nothing}
1088
- @keydown=${this.masterOnly ? this._onNavKeydown : nothing}
1089
- ></div>
1410
+ <div class="master-wrap ${masterHidden ? 'master-wrap--collapsed' : ''}">
1411
+ <div
1412
+ class="master-container ${masterHidden ? 'master-container--collapsed' : ''}"
1413
+ part="master-container"
1414
+ tabindex=${showNav && this.masterOnly ? '0' : nothing}
1415
+ role=${showNav && this.masterOnly ? 'region' : nothing}
1416
+ aria-label=${showNav && this.masterOnly ? navLabel : nothing}
1417
+ @keydown=${this.masterOnly ? this._onNavKeydown : nothing}
1418
+ ></div>
1419
+ ${showHandles || showMask ? this._renderOverlay(showHandles, showMask) : nothing}
1420
+ </div>
1090
1421
  ${showNav ? this._renderZoomControls() : nothing}
1091
1422
  ${showBar ? this._renderNavigatorBar() : nothing}
1092
1423
  </div>`;
@@ -1165,6 +1496,21 @@ __decorate([
1165
1496
  __decorate([
1166
1497
  property({ type: String, attribute: 'navigator-default-window' })
1167
1498
  ], NileMasterDetailChart.prototype, "navigatorDefaultWindow", void 0);
1499
+ __decorate([
1500
+ property({ type: Boolean, reflect: true, attribute: 'navigator-handles' })
1501
+ ], NileMasterDetailChart.prototype, "navigatorHandles", void 0);
1502
+ __decorate([
1503
+ property({ type: String, reflect: true, attribute: 'navigator-handle-variant' })
1504
+ ], NileMasterDetailChart.prototype, "navigatorHandleVariant", void 0);
1505
+ __decorate([
1506
+ property({ type: String, reflect: true, attribute: 'navigator-handle-label' })
1507
+ ], NileMasterDetailChart.prototype, "navigatorHandleLabel", void 0);
1508
+ __decorate([
1509
+ property({ type: String, attribute: 'navigator-handle-label-format' })
1510
+ ], NileMasterDetailChart.prototype, "navigatorHandleLabelFormat", void 0);
1511
+ __decorate([
1512
+ property({ type: String, reflect: true, attribute: 'navigator-mask' })
1513
+ ], NileMasterDetailChart.prototype, "navigatorMask", void 0);
1168
1514
  __decorate([
1169
1515
  property({ type: String })
1170
1516
  ], NileMasterDetailChart.prototype, "height", void 0);