@aquera/nile-visualization 2.9.49 → 2.9.52

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.
@@ -16,6 +16,90 @@ function ensureTooltipStyles() {
16
16
  document.head.appendChild(style);
17
17
  _tooltipStylesInjected = true;
18
18
  }
19
+ /** Every CSS part `nile-kpi-chart` renders; `nile-chart` re-exports them as `kpi-<part>`. */
20
+ export const KPI_CHART_PARTS = [
21
+ 'base',
22
+ 'loading',
23
+ 'header',
24
+ 'label-tooltip',
25
+ 'label',
26
+ 'label-text',
27
+ 'header-controls',
28
+ 'header-lead',
29
+ 'header-actions',
30
+ 'trend-row',
31
+ 'trend-tooltip',
32
+ 'trend',
33
+ 'trend-up',
34
+ 'trend-down',
35
+ 'trend-neutral',
36
+ 'trend-arrow',
37
+ 'trend-value',
38
+ 'trend-label',
39
+ 'value-row',
40
+ 'value-group',
41
+ 'value-tooltip',
42
+ 'value',
43
+ 'prefix',
44
+ 'suffix',
45
+ 'value-info-tooltip',
46
+ 'value-info',
47
+ 'value-info-icon',
48
+ 'forecast',
49
+ 'forecast-glyph',
50
+ 'forecast-value',
51
+ 'forecast-prefix',
52
+ 'forecast-suffix',
53
+ 'forecast-label',
54
+ 'description-tooltip',
55
+ 'description',
56
+ 'sparkline',
57
+ 'gauge-slot',
58
+ 'gauge',
59
+ ];
60
+ /**
61
+ * @tag nile-kpi-chart
62
+ * @summary A KPI tile: label, value, trend, optional forecast, description, sparkline or gauge.
63
+ *
64
+ * @csspart base - The tile body (every variant).
65
+ * @csspart loading - The loading message (`loading`).
66
+ * @csspart header - The header row: label plus header controls.
67
+ * @csspart label-tooltip - The tooltip wrapping the label (shown when truncated).
68
+ * @csspart label - The label paragraph.
69
+ * @csspart label-text - The label text inside `label`.
70
+ * @csspart header-controls - The trailing header cluster (compact trend, `header-lead`, `header-actions`).
71
+ * @csspart header-lead - Wrapper of the `header-lead` slot.
72
+ * @csspart header-actions - Wrapper of the `header-actions` slot.
73
+ * @csspart trend-row - The compact variant's trend row under the header.
74
+ * @csspart trend-tooltip - The tooltip wrapping the trend badge.
75
+ * @csspart trend - The trend badge. Also carries `trend-up`, `trend-down` or `trend-neutral`.
76
+ * @csspart trend-up - The trend badge when the trend is up.
77
+ * @csspart trend-down - The trend badge when the trend is down.
78
+ * @csspart trend-neutral - The trend badge when the trend is neutral.
79
+ * @csspart trend-arrow - The arrow icon in the trend badge.
80
+ * @csspart trend-value - The percentage in the trend badge.
81
+ * @csspart trend-label - The trend label text (`trend-label`).
82
+ * @csspart value-row - The row holding the value (and the trend, outside compact).
83
+ * @csspart value-group - The value plus its info icon.
84
+ * @csspart value-tooltip - The tooltip wrapping an abbreviated value.
85
+ * @csspart value - The main value heading.
86
+ * @csspart prefix - The value prefix (`prefix`).
87
+ * @csspart suffix - The value suffix (`suffix`).
88
+ * @csspart value-info-tooltip - The tooltip wrapping the value info icon (`value-info`).
89
+ * @csspart value-info - The value info icon button.
90
+ * @csspart value-info-icon - The `nile-glyph` inside `value-info`.
91
+ * @csspart forecast - The forecast line (`forecast-value`).
92
+ * @csspart forecast-glyph - The forecast icon.
93
+ * @csspart forecast-value - The forecast number.
94
+ * @csspart forecast-prefix - The prefix inside the forecast.
95
+ * @csspart forecast-suffix - The suffix inside the forecast.
96
+ * @csspart forecast-label - The forecast label (`forecast-label`).
97
+ * @csspart description-tooltip - The tooltip wrapping the description.
98
+ * @csspart description - The description paragraph.
99
+ * @csspart sparkline - The sparkline container.
100
+ * @csspart gauge-slot - The gauge area (`variant="gauge"`).
101
+ * @csspart gauge - The gauge chart container.
102
+ */
19
103
  let NileKpiChart = class NileKpiChart extends NileElement {
20
104
  constructor() {
21
105
  super(...arguments);
@@ -1254,6 +1338,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1254
1338
  return nothing;
1255
1339
  const [vertical, side] = (typeof this.valueInfoPlacement === 'string' ? this.valueInfoPlacement : 'top-right').split('-');
1256
1340
  return html `<nile-lite-tooltip
1341
+ part="value-info-tooltip"
1257
1342
  class="kpi-info-tip kpi-info--${vertical === 'bottom' || vertical === 'center' ? vertical : 'top'} kpi-info--${side === 'left' ? 'left' : 'right'}"
1258
1343
  content=${this.valueInfo}
1259
1344
  placement="top"
@@ -1264,6 +1349,7 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1264
1349
  tabindex="0"
1265
1350
  aria-label=${this.valueInfo}
1266
1351
  ><nile-glyph
1352
+ part="value-info-icon"
1267
1353
  name=${this.valueInfoIcon || 'ng-info-circle'}
1268
1354
  method=${this.valueInfoIconMethod || 'stroke'}
1269
1355
  size=${ifDefined(this.valueInfoIconSize === '' || this.valueInfoIconSize == null ? undefined : this.valueInfoIconSize)}
@@ -1302,20 +1388,21 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1302
1388
  const dir = this.trendDirection;
1303
1389
  const formatted = Math.abs(this.trendValue).toFixed(1) + '%';
1304
1390
  const trendAriaLabel = `Trend ${dir === 'up' ? 'up' : dir === 'down' ? 'down' : 'neutral'} ${formatted}${this.trendLabel ? ' ' + this.trendLabel : ''}`.trim();
1305
- return html `<nile-lite-tooltip class="kpi-tip" data-kpi-tip="trend" content=${this._trendTooltipText()} placement="top" disabled><span
1391
+ return html `<nile-lite-tooltip class="kpi-tip" part="trend-tooltip" data-kpi-tip="trend" content=${this._trendTooltipText()} placement="top" disabled><span
1306
1392
  class="kpi-trend kpi-trend--${dir}"
1393
+ part="trend trend-${dir}"
1307
1394
  tabindex="0"
1308
1395
  role="button"
1309
1396
  aria-label=${trendAriaLabel}
1310
1397
  >
1311
- <span class="kpi-trend-arrow">
1398
+ <span class="kpi-trend-arrow" part="trend-arrow">
1312
1399
  ${dir === 'up'
1313
1400
  ? html `<svg viewBox="0 0 12 12"><path d="M6 2.5l4 5H2z"/></svg>`
1314
1401
  : dir === 'down'
1315
1402
  ? html `<svg viewBox="0 0 12 12"><path d="M6 9.5l4-5H2z"/></svg>`
1316
1403
  : html `<svg viewBox="0 0 12 12"><path d="M2 6.5h8" stroke="currentColor" stroke-width="1.5" fill="none"/></svg>`}
1317
1404
  </span>
1318
- <span class="kpi-trend-value">${formatted}</span>${this.trendLabel ? html ` <span class="kpi-trend-label">${this.trendLabel}</span>` : nothing}
1405
+ <span class="kpi-trend-value" part="trend-value">${formatted}</span>${this.trendLabel ? html ` <span class="kpi-trend-label" part="trend-label">${this.trendLabel}</span>` : nothing}
1319
1406
  </span></nile-lite-tooltip>`;
1320
1407
  }
1321
1408
  /**
@@ -1334,12 +1421,12 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1334
1421
  + (this.forecastLabel ? ` ${this.forecastLabel}` : '');
1335
1422
  return html `
1336
1423
  <p class="kpi-forecast" part="forecast" aria-label=${spoken}>
1337
- <span class="kpi-forecast-glyph" aria-hidden="true">
1424
+ <span class="kpi-forecast-glyph" part="forecast-glyph" aria-hidden="true">
1338
1425
  <svg viewBox="0 0 12 12"><path d="M6 0l1.1 3.4L10.5 4.5 7.1 5.6 6 9 4.9 5.6 1.5 4.5 4.9 3.4z"/></svg>
1339
1426
  </span>
1340
- <span class="kpi-forecast-value"
1341
- >${approx}${this.prefix ? html `<span class="kpi-prefix">${this.prefix}</span>` : nothing}${shown}${this.suffix ? html `<span class="kpi-suffix">${this.suffix}</span>` : nothing}</span
1342
- >${this.forecastLabel ? html `<span class="kpi-forecast-label">${this.forecastLabel}</span>` : nothing}
1427
+ <span class="kpi-forecast-value" part="forecast-value"
1428
+ >${approx}${this.prefix ? html `<span class="kpi-prefix" part="forecast-prefix">${this.prefix}</span>` : nothing}${shown}${this.suffix ? html `<span class="kpi-suffix" part="forecast-suffix">${this.suffix}</span>` : nothing}</span
1429
+ >${this.forecastLabel ? html `<span class="kpi-forecast-label" part="forecast-label">${this.forecastLabel}</span>` : nothing}
1343
1430
  </p>
1344
1431
  `;
1345
1432
  }
@@ -1368,21 +1455,22 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1368
1455
  * (see the `has-header-*` rules in the stylesheet).
1369
1456
  */
1370
1457
  renderHeaderRow(extra, trendRow) {
1371
- return html `<div class="kpi-header">
1372
- ${this.label ? html `<nile-lite-tooltip class="kpi-tip" data-kpi-tip="label" content=${this.label} placement="top" disabled><p
1458
+ return html `<div class="kpi-header" part="header">
1459
+ ${this.label ? html `<nile-lite-tooltip class="kpi-tip" part="label-tooltip" data-kpi-tip="label" content=${this.label} placement="top" disabled><p
1373
1460
  class="kpi-label"
1461
+ part="label"
1374
1462
  tabindex="0"
1375
- ><span class="kpi-label-text">${this.label}</span></p></nile-lite-tooltip>` : nothing}
1376
- <div class="kpi-header-controls">
1463
+ ><span class="kpi-label-text" part="label-text">${this.label}</span></p></nile-lite-tooltip>` : nothing}
1464
+ <div class="kpi-header-controls" part="header-controls">
1377
1465
  ${extra ?? nothing}
1378
- <span class="kpi-header-lead"><slot name="header-lead" @slotchange=${this._onHeaderSlotChange}></slot></span>
1379
- <span class="kpi-header-actions"><slot name="header-actions" @slotchange=${this._onHeaderSlotChange}></slot></span>
1466
+ <span class="kpi-header-lead" part="header-lead"><slot name="header-lead" @slotchange=${this._onHeaderSlotChange}></slot></span>
1467
+ <span class="kpi-header-actions" part="header-actions"><slot name="header-actions" @slotchange=${this._onHeaderSlotChange}></slot></span>
1380
1468
  </div>
1381
- </div>${trendRow ? html `<div class="kpi-trend-row">${trendRow}</div>` : nothing}`;
1469
+ </div>${trendRow ? html `<div class="kpi-trend-row" part="trend-row">${trendRow}</div>` : nothing}`;
1382
1470
  }
1383
1471
  render() {
1384
1472
  if (this.loading) {
1385
- return html `<div class="chart-loading">${this.loadingText}</div>`;
1473
+ return html `<div class="chart-loading" part="loading">${this.loadingText}</div>`;
1386
1474
  }
1387
1475
  const isGauge = this.variant === 'gauge';
1388
1476
  const rawNum = this.parseNumericValue(this.value);
@@ -1392,20 +1480,21 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1392
1480
  const infoLeft = typeof this.valueInfoPlacement === 'string' && this.valueInfoPlacement.endsWith('-left');
1393
1481
  const valueEl = html `<h2
1394
1482
  class="kpi-value"
1483
+ part="value"
1395
1484
  tabindex=${showTooltip ? '0' : nothing}
1396
1485
  >
1397
- ${this.prefix ? html `<span class="kpi-prefix">${this.prefix}</span>` : nothing}${displayValue}${this.suffix ? html `<span class="kpi-suffix">${this.suffix}</span>` : nothing}
1486
+ ${this.prefix ? html `<span class="kpi-prefix" part="prefix">${this.prefix}</span>` : nothing}${displayValue}${this.suffix ? html `<span class="kpi-suffix" part="suffix">${this.suffix}</span>` : nothing}
1398
1487
  </h2>`;
1399
1488
  if (this.variant === 'compact') {
1400
1489
  return html `
1401
- <div class="kpi kpi--compact">
1490
+ <div class="kpi kpi--compact" part="base">
1402
1491
  ${this.renderHeaderRow(this.renderTrend(), this.renderTrend())}
1403
1492
 
1404
- <div class="kpi-value-row">
1405
- <span class="kpi-value-group">
1493
+ <div class="kpi-value-row" part="value-row">
1494
+ <span class="kpi-value-group" part="value-group">
1406
1495
  ${infoLeft ? this.renderValueInfo() : nothing}
1407
1496
  ${showTooltip
1408
- ? html `<nile-lite-tooltip class="kpi-tip" content=${this._valueTooltipText()} placement="top" ?disabled=${!this.tooltipEnabled}>${valueEl}</nile-lite-tooltip>`
1497
+ ? html `<nile-lite-tooltip class="kpi-tip" part="value-tooltip" content=${this._valueTooltipText()} placement="top" ?disabled=${!this.tooltipEnabled}>${valueEl}</nile-lite-tooltip>`
1409
1498
  : valueEl}
1410
1499
  ${infoLeft ? nothing : this.renderValueInfo()}
1411
1500
  </span>
@@ -1413,23 +1502,25 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1413
1502
 
1414
1503
  ${this.renderForecast()}
1415
1504
 
1416
- ${this.description ? html `<nile-lite-tooltip class="kpi-tip" data-kpi-tip="description" content=${this.description} placement="top" disabled><p
1505
+ ${this.description ? html `<nile-lite-tooltip class="kpi-tip" part="description-tooltip" data-kpi-tip="description" content=${this.description} placement="top" disabled><p
1417
1506
  class="kpi-description"
1507
+ part="description"
1418
1508
  tabindex="0"
1419
1509
  >${this.description}</p></nile-lite-tooltip>` : nothing}
1420
1510
 
1421
- ${this.sparkline.length ? html `<div class="kpi-sparkline"></div>` : nothing}
1511
+ ${this.sparkline.length ? html `<div class="kpi-sparkline" part="sparkline"></div>` : nothing}
1422
1512
  </div>
1423
1513
  `;
1424
1514
  }
1425
1515
  return html `
1426
- <div class="kpi ${isGauge ? 'kpi--gauge' : ''}">
1516
+ <div class="kpi ${isGauge ? 'kpi--gauge' : ''}" part="base">
1427
1517
  ${this.renderHeaderRow()}
1428
1518
 
1429
1519
  ${isGauge ? html `
1430
- <div class="kpi-gauge-slot">
1520
+ <div class="kpi-gauge-slot" part="gauge-slot">
1431
1521
  <div
1432
1522
  class="kpi-gauge-container"
1523
+ part="gauge"
1433
1524
  tabindex="0"
1434
1525
  role="img"
1435
1526
  aria-label=${this.getTooltipContent()}
@@ -1442,12 +1533,12 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1442
1533
  </div>
1443
1534
  ` : nothing}
1444
1535
 
1445
- <div class="kpi-value-row">
1536
+ <div class="kpi-value-row" part="value-row">
1446
1537
  ${!isGauge ? html `
1447
- <span class="kpi-value-group">
1538
+ <span class="kpi-value-group" part="value-group">
1448
1539
  ${infoLeft ? this.renderValueInfo() : nothing}
1449
1540
  ${showTooltip
1450
- ? html `<nile-lite-tooltip class="kpi-tip" content=${this._valueTooltipText()} placement="top" ?disabled=${!this.tooltipEnabled}>${valueEl}</nile-lite-tooltip>`
1541
+ ? html `<nile-lite-tooltip class="kpi-tip" part="value-tooltip" content=${this._valueTooltipText()} placement="top" ?disabled=${!this.tooltipEnabled}>${valueEl}</nile-lite-tooltip>`
1451
1542
  : valueEl}
1452
1543
  ${infoLeft ? nothing : this.renderValueInfo()}
1453
1544
  </span>
@@ -1459,12 +1550,13 @@ let NileKpiChart = class NileKpiChart extends NileElement {
1459
1550
 
1460
1551
  ${this.renderForecast()}
1461
1552
 
1462
- ${this.description ? html `<nile-lite-tooltip class="kpi-tip" data-kpi-tip="description" content=${this.description} placement="top" disabled><p
1553
+ ${this.description ? html `<nile-lite-tooltip class="kpi-tip" part="description-tooltip" data-kpi-tip="description" content=${this.description} placement="top" disabled><p
1463
1554
  class="kpi-description"
1555
+ part="description"
1464
1556
  tabindex="0"
1465
1557
  >${this.description}</p></nile-lite-tooltip>` : nothing}
1466
1558
 
1467
- ${this.sparkline.length && !isGauge ? html `<div class="kpi-sparkline"></div>` : nothing}
1559
+ ${this.sparkline.length && !isGauge ? html `<div class="kpi-sparkline" part="sparkline"></div>` : nothing}
1468
1560
  </div>
1469
1561
  `;
1470
1562
  }
@@ -1 +1,2 @@
1
1
  import './nile-kpi-chart';
2
+ import '../nile-chart/nile-chart';
@@ -1,6 +1,8 @@
1
1
  /** Tests for <nile-kpi-chart>: sparkline tooltip placement, compact title overflow, sparkline sizing. */
2
2
  import { expect, fixture, html } from '@open-wc/testing';
3
3
  import './nile-kpi-chart';
4
+ import { KPI_CHART_PARTS } from './nile-kpi-chart';
5
+ import '../nile-chart/nile-chart';
4
6
  const LONG = '8 accounts waiting for review across all regions';
5
7
  describe('NileKpiChart sparkline tooltip placement', () => {
6
8
  let el;
@@ -370,4 +372,94 @@ describe('NileKpiChart sparkline size under a transform', () => {
370
372
  expect(stub.chartWidth).to.equal(148);
371
373
  });
372
374
  });
375
+ describe('NileKpiChart CSS parts', () => {
376
+ const FULL = {
377
+ label: 'Monthly recurring revenue', value: 1234567, prefix: '$', suffix: '/mo',
378
+ trendValue: 12.5, trendDirection: 'up', trendLabel: 'vs last month',
379
+ forecastValue: 1500000, forecastLabel: 'by Q4', description: 'All regions', valueInfo: 'Net of refunds',
380
+ };
381
+ const partsOf = (el) => [...el.shadowRoot.querySelectorAll('[part]')].flatMap((n) => n.getAttribute('part').split(/\s+/));
382
+ async function render(props) {
383
+ const el = await fixture(html `<nile-kpi-chart style="display:block;width:320px"></nile-kpi-chart>`);
384
+ Object.assign(el, props);
385
+ await el.updateComplete;
386
+ return el;
387
+ }
388
+ it('every listed part renders in some variant, and nothing renders that is not listed', async () => {
389
+ const seen = new Set();
390
+ for (const variant of ['default', 'compact', 'gauge']) {
391
+ for (const dir of ['up', 'down', 'neutral']) {
392
+ const el = await render({ ...FULL, variant, trendDirection: dir, sparkline: variant === 'gauge' ? [] : [1, 3, 2, 5] });
393
+ partsOf(el).forEach((p) => seen.add(p));
394
+ }
395
+ }
396
+ partsOf(await render({ loading: true })).forEach((p) => seen.add(p));
397
+ const listed = new Set(KPI_CHART_PARTS);
398
+ expect([...seen].filter((p) => !listed.has(p)), 'rendered but not in KPI_CHART_PARTS').to.deep.equal([]);
399
+ expect(KPI_CHART_PARTS.filter((p) => !seen.has(p)), 'listed but never rendered').to.deep.equal([]);
400
+ });
401
+ it('the trend badge carries its direction as a second part name', async () => {
402
+ const el = await render({ ...FULL, trendDirection: 'down' });
403
+ const trend = el.shadowRoot.querySelector('[part~="trend"]');
404
+ expect(trend.getAttribute('part')).to.equal('trend trend-down');
405
+ });
406
+ it('parts are stylable from outside with ::part()', async () => {
407
+ const style = document.createElement('style');
408
+ style.textContent = 'nile-kpi-chart.parts-test::part(value) { color: rgb(1, 2, 3); }';
409
+ document.head.appendChild(style);
410
+ const el = await render(FULL);
411
+ el.classList.add('parts-test');
412
+ const value = el.shadowRoot.querySelector('[part~="value"]');
413
+ expect(getComputedStyle(value).color).to.equal('rgb(1, 2, 3)');
414
+ style.remove();
415
+ });
416
+ });
417
+ describe('nile-chart forwards embedded chart parts', () => {
418
+ async function kpiInChart() {
419
+ const chart = await fixture(html `<nile-chart class="fwd-test" style="display:block;width:360px;height:200px"></nile-chart>`);
420
+ chart.config = {
421
+ chart: { type: 'kpi', label: 'MRR', value: 1234, trend: { value: 4, direction: 'up' }, description: 'All regions' },
422
+ };
423
+ await chart.updateComplete;
424
+ await chart.updateComplete;
425
+ const kpi = chart.shadowRoot.querySelector('nile-kpi-chart');
426
+ await kpi.updateComplete;
427
+ return { chart, kpi };
428
+ }
429
+ it('tags the embedded element with `chart` and its type', async () => {
430
+ const { kpi } = await kpiInChart();
431
+ expect(kpi.getAttribute('part')).to.equal('chart kpi-chart');
432
+ });
433
+ it('re-exports every KPI part with a kpi- prefix', async () => {
434
+ const { kpi } = await kpiInChart();
435
+ const map = kpi.getAttribute('exportparts');
436
+ for (const p of KPI_CHART_PARTS)
437
+ expect(map).to.contain(`${p}: kpi-${p}`);
438
+ });
439
+ it('nile-chart::part(kpi-value) and ::part(kpi-chart) style the KPI from the page', async () => {
440
+ const style = document.createElement('style');
441
+ style.textContent = `
442
+ nile-chart.fwd-test::part(kpi-value) { color: rgb(4, 5, 6); }
443
+ nile-chart.fwd-test::part(kpi-chart) { outline: 3px solid rgb(7, 8, 9); }
444
+ nile-chart.fwd-test::part(kpi-header) { padding-top: 11px; }
445
+ `;
446
+ document.head.appendChild(style);
447
+ const { kpi } = await kpiInChart();
448
+ const value = kpi.shadowRoot.querySelector('[part~="value"]');
449
+ const header = kpi.shadowRoot.querySelector('[part~="header"]');
450
+ expect(getComputedStyle(value).color).to.equal('rgb(4, 5, 6)');
451
+ expect(getComputedStyle(kpi).outlineColor).to.equal('rgb(7, 8, 9)');
452
+ expect(getComputedStyle(header).paddingTop).to.equal('11px');
453
+ style.remove();
454
+ });
455
+ it("the KPI's header does not collide with nile-chart's own header part", async () => {
456
+ const style = document.createElement('style');
457
+ style.textContent = 'nile-chart.fwd-test::part(header) { padding-top: 13px; }';
458
+ document.head.appendChild(style);
459
+ const { kpi } = await kpiInChart();
460
+ const header = kpi.shadowRoot.querySelector('[part~="header"]');
461
+ expect(getComputedStyle(header).paddingTop).to.not.equal('13px');
462
+ style.remove();
463
+ });
464
+ });
373
465
  //# sourceMappingURL=nile-kpi-chart.test.js.map
@@ -155,6 +155,66 @@ export const styles = css `
155
155
  cursor: not-allowed;
156
156
  }
157
157
 
158
+ /* Slider / pan-button bar under the master pane (navigator-slider, navigator-pan-buttons). */
159
+ .navigator-bar {
160
+ flex: 0 0 auto;
161
+ display: flex;
162
+ flex-wrap: nowrap;
163
+ align-items: center;
164
+ gap: var(--nile-spacing-2, var(--ng-spacing-2, 8px));
165
+ padding-top: var(--nile-spacing-2, var(--ng-spacing-2, 8px));
166
+ }
167
+
168
+ .navigator-bar-spacer {
169
+ flex: 1 1 auto;
170
+ }
171
+
172
+ /* Half the thumb plus a gap, so the thumb at either end clears the buttons. */
173
+ .navigator-slider {
174
+ flex: 1 1 160px;
175
+ min-width: 120px;
176
+ margin-inline: calc(
177
+ var(--nile-spacing-lg, var(--ng-spacing-2xl, 24px)) / 2 + var(--nile-spacing-xs, var(--ng-spacing-xs, 4px))
178
+ );
179
+ --nile-slider-width: 100%;
180
+ }
181
+
182
+ .navigator-pan-button {
183
+ flex: 0 0 auto;
184
+ display: flex;
185
+ align-items: center;
186
+ justify-content: center;
187
+ box-sizing: border-box;
188
+ width: var(--nile-height-32px, var(--ng-height-32px, 32px));
189
+ height: var(--nile-height-32px, var(--ng-height-32px, 32px));
190
+ padding: 0;
191
+ margin: 0;
192
+ background: var(--nile-colors-white-base, var(--ng-colors-bg-primary, Canvas));
193
+ border: var(--nile-border-width-1, var(--ng-stroke-width-1, 1px)) solid
194
+ var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
195
+ border-radius: var(--nile-radius-sm, var(--ng-radius-md, 8px));
196
+ box-shadow: var(--nile-box-shadow-1, var(--ng-shadow-xs));
197
+ color: var(--nile-colors-neutral-700, var(--ng-colors-text-secondary-700));
198
+ cursor: pointer;
199
+ transition: background 150ms ease, color 150ms ease;
200
+ }
201
+
202
+ .navigator-pan-button:hover:not(:disabled) {
203
+ background: var(--nile-colors-dark-200, var(--ng-colors-bg-secondary-hover));
204
+ }
205
+
206
+ .navigator-pan-button:focus-visible {
207
+ outline: var(--nile-border-width-2, var(--ng-stroke-width-2, 2px)) solid
208
+ var(--nile-colors-primary-600, var(--ng-colors-border-brand));
209
+ outline-offset: 2px;
210
+ }
211
+
212
+ .navigator-pan-button:disabled {
213
+ background: var(--nile-colors-neutral-100, var(--ng-colors-bg-tertiary, color-mix(in srgb, CanvasText 6%, Canvas)));
214
+ color: var(--nile-colors-neutral-400, var(--ng-colors-fg-disabled, GrayText));
215
+ cursor: not-allowed;
216
+ }
217
+
158
218
  /* Drag-to-pan on the detail pane once zoomed in; vertical touch scroll still scrolls the page. */
159
219
  .detail-container--pannable {
160
220
  cursor: grab;
@@ -21,6 +21,28 @@ export declare const MASTER_DETAIL_SERIES_TYPES: readonly ["area", "line", "spli
21
21
  export type MasterDetailSeriesType = (typeof MASTER_DETAIL_SERIES_TYPES)[number];
22
22
  export declare const MASTER_DETAIL_X_AXIS_TYPES: readonly ["datetime", "linear", "logarithmic", "category"];
23
23
  export type MasterDetailXAxisType = (typeof MASTER_DETAIL_X_AXIS_TYPES)[number];
24
+ /** 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"];
26
+ /**
27
+ * @tag nile-master-detail-chart
28
+ * @summary A detail chart above an overview (master) strip; dragging on the strip zooms the detail.
29
+ *
30
+ * @event nile-chart-ready - Charts are created. `detail: { chart }`
31
+ * @event nile-chart-selection - The visible window changed. `detail: { min, max }`
32
+ * @event nile-master-detail-zoom - Zoomed in or back to the full range. `detail: { zoomed }`
33
+ *
34
+ * @csspart detail-container - The detail chart.
35
+ * @csspart master-container - The master (overview) strip.
36
+ * @csspart master-toggle - The show/hide button for the master strip (`master-collapsible`).
37
+ * @csspart navigator - The map-style zoom buttons (+ / −) over the top-right corner of the chart (`navigator-controls`).
38
+ * @csspart navigator-button - Each zoom button (`Zoom in`, `Zoom out`) inside the `navigator` control.
39
+ * @csspart navigator-bar - The bar under the master pane holding the slider and / or pan buttons
40
+ * (`navigator-slider`, `navigator-pan-buttons`).
41
+ * @csspart navigator-slider - The `nile-slider` that positions the window (`navigator-slider`).
42
+ * @csspart navigator-pan-button - Each pan button (`Pan back`, `Pan forward`) in the bar (`navigator-pan-buttons`).
43
+ *
44
+ * @dependency nile-slider - `navigator-slider` renders a `nile-slider` from `@aquera/nile-elements`; register it in the app.
45
+ */
24
46
  export declare class NileMasterDetailChart extends NileElement {
25
47
  static styles: CSSResultGroup;
26
48
  private _hc;
@@ -54,15 +76,47 @@ export declare class NileMasterDetailChart extends NileElement {
54
76
  masterType: MasterDetailSeriesType;
55
77
  masterOnly: boolean;
56
78
  masterCollapsible: boolean;
79
+ /** Map-style + / − zoom over the chart's top-right corner, drag-to-pan and keyboard pan / zoom. */
57
80
  navigatorControls: boolean;
58
81
  /**
59
- * Opening window when `navigator-controls` is on and no `selection-min` / `selection-max` is set:
82
+ * A slider under the master pane that moves the visible window along the data. Independent of
83
+ * `navigator-controls` and `navigator-pan-buttons`; disabled while the window covers the full range.
84
+ */
85
+ navigatorSlider: boolean;
86
+ /**
87
+ * ‹ / › buttons under the master pane that pan the window by 25% of its width. Independent of
88
+ * `navigator-controls` and `navigator-slider`.
89
+ */
90
+ navigatorPanButtons: boolean;
91
+ /**
92
+ * How far one pan moves (the ‹ / › buttons, ← / → keys and `panBy()`): a percentage of the visible window
93
+ * (`25%`, the default), a fraction (`0.5`), a number of data points (`1pt`, `3pt`), or on a datetime axis a
94
+ * duration (`30m`, `6h`, `1d`, `1w`). Invalid values fall back to `25%`. Every pan moves at least one data point.
95
+ */
96
+ navigatorPanStep: string;
97
+ /**
98
+ * Granularity of `navigator-slider`. Empty (default) is smooth. Otherwise the window's start moves in steps:
99
+ * a percentage of the slider travel (`10%` = 11 stops), a fraction (`0.1`), a number of data points (`1pt`),
100
+ * or on a datetime axis a duration (`1d`) counted from the first data point. Invalid values mean smooth.
101
+ */
102
+ navigatorSliderStep: string;
103
+ /** Move the window while the slider thumb is dragged, not only when it is released. */
104
+ navigatorSliderLive: boolean;
105
+ /**
106
+ * Zoom factor for the + / − buttons and keys: `2` (default) halves / doubles the window, `1.5` is gentler,
107
+ * `4` is coarser. Values ≤ 1 fall back to `2`.
108
+ */
109
+ navigatorZoomStep: number;
110
+ /**
111
+ * Opening window when any navigator feature (`navigator-controls`, `navigator-slider`, `navigator-pan-buttons`) is on and no `selection-min` / `selection-max` is set:
60
112
  * a fraction of the range (`0.25`) or, on a datetime axis, a duration (`30m`, `12h`, `7d`, `2w`),
61
113
  * ending at the latest data. Empty opens on the full range.
62
114
  */
63
115
  navigatorDefaultWindow: string;
64
116
  private _window;
65
- /** Re-renders only when the control bar is shown, so plain charts skip the extra update. */
117
+ /** True when any navigator feature is on. */
118
+ private get _anyNavigator();
119
+ /** Re-renders only when a navigator is shown, so plain charts skip the extra update. */
66
120
  private _trackWindow;
67
121
  height: string;
68
122
  masterHeight: string | number;
@@ -133,11 +187,34 @@ export declare class NileMasterDetailChart extends NileElement {
133
187
  private _windowIndices;
134
188
  private _applyWindow;
135
189
  private _setWindow;
136
- /** Move the window by 25% of its width toward the start (`-1`) or end (`1`), at least one data point. */
137
- panBy(direction: -1 | 1): void;
190
+ /**
191
+ * Parses a navigator step: `25%`, a fraction (`0.25`), data points (`3pt`), or a datetime duration
192
+ * (`6h`, `1d`). `null` when empty or invalid (durations need a datetime axis).
193
+ */
194
+ private _parseStep;
195
+ /** Zoom factor used by the + / − buttons and keys. */
196
+ private get _zoomFactor();
197
+ /**
198
+ * Move the window toward the start (`-1`) or end (`1`), keeping its width. The distance is `step` if given,
199
+ * else `navigator-pan-step` (default 25% of the window); at least one data point.
200
+ */
201
+ panBy(direction: -1 | 1, step?: string | number): void;
138
202
  /** Scale the window around its centre: `0.5` zooms in, `2` zooms out; at least one data point per step. */
139
203
  zoomBy(factor: number): void;
140
204
  private get _navState();
205
+ /**
206
+ * The slider's stops: the free room (data range minus window width, on the axis scale) split by
207
+ * `navigator-slider-step`. Smooth (no step) is 1000 stops. `null` when the window fills the range.
208
+ */
209
+ private _sliderModel;
210
+ /** Moves the window to slider value `value` (0–1000), rounded to the nearest stop; the width is kept. */
211
+ private _applySliderValue;
212
+ /** True while the slider thumb is being dragged in live mode, so the slider isn't re-created mid-drag. */
213
+ private _sliderDragging;
214
+ private _sliderKey;
215
+ private _sliderFrame;
216
+ private _onSliderInput;
217
+ private _onSliderChange;
141
218
  /** Drag-to-pan on the detail pane: the window follows the pointer, keeping its width. */
142
219
  private get _canDragPan();
143
220
  private _onPanStart;
@@ -150,6 +227,11 @@ export declare class NileMasterDetailChart extends NileElement {
150
227
  * chart never shows through, and the cluster keeps a single border with a hairline divider.
151
228
  */
152
229
  private _navButton;
230
+ private _panButton;
231
+ /** The slider re-renders (re-positions its thumb) when its value changes, except mid-drag in live mode. */
232
+ private _currentSliderKey;
233
+ /** Bar under the master pane: optional ‹ pan, slider, › pan — each part on its own property. */
234
+ private _renderNavigatorBar;
153
235
  /** Map-style + / − zoom buttons, overlaid on the top-right corner of the chart. */
154
236
  private _renderZoomControls;
155
237
  private initCharts;