@aquera/nile-visualization 2.9.24 → 2.9.26

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 (61) hide show
  1. package/README.md +7 -0
  2. package/dist/src/index.d.ts +1 -0
  3. package/dist/src/internal/types/aq-config.type.d.ts +6 -0
  4. package/dist/src/internal/types/index.d.ts +1 -0
  5. package/dist/src/internal/types/legend-config.type.d.ts +145 -0
  6. package/dist/src/internal/types/legend-config.type.js +9 -0
  7. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +1 -1
  8. package/dist/src/nile-area-chart/nile-area-chart.d.ts +1 -1
  9. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +1 -1
  10. package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +1 -1
  11. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +1 -1
  12. package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +1 -1
  13. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.d.ts +1 -1
  14. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.d.ts +1 -1
  15. package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +1 -1
  16. package/dist/src/nile-chart/index.d.ts +1 -1
  17. package/dist/src/nile-chart/nile-chart-config.d.ts +12 -1
  18. package/dist/src/nile-chart/nile-chart.d.ts +36 -2
  19. package/dist/src/nile-chart/nile-chart.js +123 -46
  20. package/dist/src/nile-cluster-chart/nile-cluster-chart.d.ts +1 -1
  21. package/dist/src/nile-column-chart/nile-column-chart.d.ts +1 -1
  22. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +1 -1
  23. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +1 -1
  24. package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +1 -1
  25. package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +1 -1
  26. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.d.ts +1 -1
  27. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +1 -1
  28. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +1 -1
  29. package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +1 -1
  30. package/dist/src/nile-fan-chart/nile-fan-chart.d.ts +1 -1
  31. package/dist/src/nile-filter-chart/nile-filter-chart.d.ts +1 -0
  32. package/dist/src/nile-filter-chart/nile-filter-chart.js +7 -2
  33. package/dist/src/nile-flame-chart/nile-flame-chart.d.ts +1 -1
  34. package/dist/src/nile-funnel-chart/nile-funnel-chart.d.ts +1 -1
  35. package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +1 -1
  36. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.d.ts +1 -1
  37. package/dist/src/nile-histogram-chart/nile-histogram-chart.d.ts +1 -1
  38. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +1 -1
  39. package/dist/src/nile-line-chart/nile-line-chart.d.ts +1 -1
  40. package/dist/src/nile-line-column-chart/nile-line-column-chart.d.ts +1 -1
  41. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +1 -1
  42. package/dist/src/nile-map-chart/nile-map-chart.d.ts +1 -1
  43. package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +1 -1
  44. package/dist/src/nile-organization-chart/nile-organization-chart.d.ts +1 -1
  45. package/dist/src/nile-pie-chart/index.d.ts +1 -1
  46. package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +2 -51
  47. package/dist/src/nile-pie-chart/nile-pie-chart.js +3 -0
  48. package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +1 -1
  49. package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +1 -1
  50. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +1 -1
  51. package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +1 -1
  52. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.d.ts +1 -1
  53. package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +1 -1
  54. package/dist/src/nile-stacked-chart/nile-stacked-chart.d.ts +1 -1
  55. package/dist/src/nile-timeline-chart/nile-timeline-chart.d.ts +1 -1
  56. package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +1 -1
  57. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +1 -1
  58. package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +1 -1
  59. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +1 -1
  60. package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +1 -1
  61. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ var NileChart_1;
1
2
  import { __decorate } from "tslib";
2
3
  import { customElement, property, query, state } from 'lit/decorators.js';
3
4
  import { html, nothing } from 'lit';
@@ -9,11 +10,6 @@ import { convertConfig } from '../internal/chart-adapters.js';
9
10
  import { deepMerge } from '../internal/utils.js';
10
11
  import { initNileChartExporting, getHighcharts } from '../internal/highcharts-provider.js';
11
12
  import { resolveColorPaletteColors } from '../internal/color-palettes/index.js';
12
- // Start loading exporting/offline-exporting/export-data at module import time.
13
- // `chart.fullscreen` is attached via a `beforeRender` hook installed by the exporting module's
14
- // compose step, so if a chart is constructed before the module applies, that instance will have
15
- // no `fullscreen`. Kicking the load off here gives it a head start; handlers still await it
16
- // before invoking methods, and viewFullscreen falls back to the DOM Fullscreen API.
17
13
  initNileChartExporting();
18
14
  import '../nile-bar-chart/index.js';
19
15
  import '../nile-pie-chart/index.js';
@@ -133,10 +129,40 @@ function ensureHeaderTooltipStyles() {
133
129
  document.head.appendChild(style);
134
130
  _headerTooltipStylesInjected = true;
135
131
  }
136
- let NileChart = class NileChart extends NileElement {
132
+ /**
133
+ * Universal chart wrapper. Renders a card with an optional header (titles +
134
+ * actions) and the active chart type below.
135
+ *
136
+ * @csspart chart-card - The outer card wrapper.
137
+ * @csspart chart-body - The wrapper between the header and the chart body.
138
+ * @csspart chart-inner - The chart body region below the header.
139
+ * @csspart header - The header row (titles + actions).
140
+ * @csspart header-titles - The titles column (title + subtitle).
141
+ * @csspart header-title - The title text.
142
+ * @csspart header-subtitle - The subtitle text.
143
+ * @csspart header-actions - The actions column (reset-zoom, AI, menu).
144
+ * @csspart reset-zoom-tooltip - Tooltip wrapping the reset-zoom button (master-detail only).
145
+ * @csspart reset-zoom - The reset-zoom button (master-detail only).
146
+ * @csspart reset-zoom-glyph - Glyph inside the reset-zoom button.
147
+ * @csspart ai-trigger - The "Ask AI" button.
148
+ * @csspart ai-trigger-glyph - Glyph inside the "Ask AI" button.
149
+ * @csspart ai-panel - The AI chat panel overlay.
150
+ * @csspart ai-panel-content - The nile-ai-panel element inside the overlay.
151
+ * @csspart menu-anchor - The actions-menu dropdown anchor.
152
+ * @csspart menu-trigger - The actions-menu trigger button.
153
+ * @csspart menu-trigger-glyph - Glyph inside the actions-menu trigger.
154
+ * @csspart menu - The actions-menu popup (also matches `dropdown`).
155
+ * @csspart menu-group-header - A group heading inside the actions menu.
156
+ * @csspart menu-separator - A separator inside the actions menu.
157
+ * @csspart menu-item - Any actions-menu item (also carries a kind-specific
158
+ * sub-part: `type`, `custom`, `fullscreen`, `print`, `download-png`, `download-svg`, `download-csv`).
159
+ * @csspart menu-item-glyph - Glyph inside an actions-menu item.
160
+ */
161
+ let NileChart = NileChart_1 = class NileChart extends NileElement {
137
162
  constructor() {
138
163
  super(...arguments);
139
164
  this._headerTipEl = null;
165
+ this._headerResizeObs = null;
140
166
  /** Full chart configuration. Accepts flat NileChartConfig or separated { chart, aq } input. */
141
167
  this.config = null;
142
168
  /**
@@ -200,14 +226,9 @@ let NileChart = class NileChart extends NileElement {
200
226
  this._hcChart = e.detail?.chart ?? null;
201
227
  };
202
228
  this.resolvedConfig = null;
203
- this._onTitleEnter = (e) => {
204
- const el = e.currentTarget;
205
- if (el.scrollWidth <= el.clientWidth)
206
- return;
207
- const rect = el.getBoundingClientRect();
208
- this._showHeaderTip(el.textContent ?? '', rect.left + rect.width / 2, rect.top);
209
- };
210
- this._onSubtitleEnter = (e) => {
229
+ // Reveal the full text when a title/subtitle is truncated. Accepts any Event
230
+ // so it works for BOTH pointer (mouseenter) and keyboard (focus) users.
231
+ this._onHeaderTextEnter = (e) => {
211
232
  const el = e.currentTarget;
212
233
  if (el.scrollWidth <= el.clientWidth)
213
234
  return;
@@ -231,6 +252,7 @@ let NileChart = class NileChart extends NileElement {
231
252
  injectGlobalChartMenuOverrides();
232
253
  const tip = document.createElement('div');
233
254
  tip.className = 'nile-chart-header-tooltip';
255
+ tip.setAttribute('role', 'tooltip');
234
256
  document.body.appendChild(tip);
235
257
  this._headerTipEl = tip;
236
258
  document.addEventListener('click', this.handleOutsideClick);
@@ -249,6 +271,8 @@ let NileChart = class NileChart extends NileElement {
249
271
  this.removeEventListener('nile-chart-ready', this.handleChartReady);
250
272
  this._headerTipEl?.remove();
251
273
  this._headerTipEl = null;
274
+ this._headerResizeObs?.disconnect();
275
+ this._headerResizeObs = null;
252
276
  }
253
277
  mergeChartTypeFromAttr(chart) {
254
278
  const t = this.chartTypeAttr?.trim();
@@ -280,6 +304,8 @@ let NileChart = class NileChart extends NileElement {
280
304
  if (resolved.appearance && this.appearance !== resolved.appearance)
281
305
  this.appearance = resolved.appearance;
282
306
  }
307
+ // Keep truncated-title focusability in sync after any re-render.
308
+ this._syncHeaderTruncationA11y();
283
309
  }
284
310
  closeMenu() {
285
311
  const dropdown = this.shadowRoot?.querySelector('.nile-chart-menu-anchor');
@@ -346,6 +372,18 @@ let NileChart = class NileChart extends NileElement {
346
372
  }
347
373
  return '';
348
374
  }
375
+ /** Normalize a numeric (→px) or string dimension to a CSS length. */
376
+ static toCssSize(value) {
377
+ if (value == null || value === '')
378
+ return undefined;
379
+ return typeof value === 'number' ? `${value}px` : value;
380
+ }
381
+ get titleFontSize() {
382
+ return NileChart_1.toCssSize(this.activeConfig?.titleFontSize ?? this.resolvedConfig?.titleFontSize);
383
+ }
384
+ get subtitleFontSize() {
385
+ return NileChart_1.toCssSize(this.activeConfig?.subtitleFontSize ?? this.resolvedConfig?.subtitleFontSize);
386
+ }
349
387
  onHeaderSlotChange(e) {
350
388
  const slot = e.target;
351
389
  this.hasHeaderSlotContent = slot.assignedElements({ flatten: true }).length > 0;
@@ -383,6 +421,10 @@ let NileChart = class NileChart extends NileElement {
383
421
  firstUpdated(changedProperties) {
384
422
  super.firstUpdated(changedProperties);
385
423
  this.syncHeaderSlots();
424
+ this._syncHeaderTruncationA11y();
425
+ // Truncation depends on width, so re-check when the host resizes.
426
+ this._headerResizeObs = new ResizeObserver(() => this._syncHeaderTruncationA11y());
427
+ this._headerResizeObs.observe(this);
386
428
  }
387
429
  /** Direct children with `slot=` — header row renders on first paint before slot assignment runs. */
388
430
  lightDomHasSlot(name) {
@@ -453,6 +495,7 @@ let NileChart = class NileChart extends NileElement {
453
495
  ? html `<nile-glyph
454
496
  slot="prefix"
455
497
  class="nile-chart-actions-menu-glyph"
498
+ part="menu-item-glyph"
456
499
  name=${item.glyph}
457
500
  method=${item.method ?? 'stroke'}
458
501
  color=${item.color ?? 'var(--nile-colors-dark-500,var(--ng-colors-fg-secondary-700))'}
@@ -461,8 +504,8 @@ let NileChart = class NileChart extends NileElement {
461
504
  : nothing;
462
505
  if (item.type === 'custom') {
463
506
  return html `
464
- ${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
465
- <nile-menu-item class="nile-chart-actions-menu-item" value=${`custom:${item.id}`}
507
+ ${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
508
+ <nile-menu-item class="nile-chart-actions-menu-item" part="menu-item custom" value=${`custom:${item.id}`}
466
509
  @click=${() => { this.closeMenu(); this.emit('nile-menu-change', { id: item.id }); }}>
467
510
  ${glyph}${item.label}
468
511
  </nile-menu-item>
@@ -471,12 +514,12 @@ let NileChart = class NileChart extends NileElement {
471
514
  if (!hasChart)
472
515
  return nothing;
473
516
  return html `
474
- ${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
475
- ${item.fullscreen ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="fullscreen" @click=${() => this.viewFullscreen()}>${glyph}${item.label ?? 'Fullscreen'}</nile-menu-item>` : nothing}
476
- ${item.print ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="print" @click=${() => this.printChart()}>${glyph}${item.label ?? 'Print'}</nile-menu-item>` : nothing}
477
- ${item.downloadPng ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-png" @click=${() => this.exportChart('image/png')}>${glyph}${item.label ?? 'Download PNG'}</nile-menu-item>` : nothing}
478
- ${item.downloadSvg ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-svg" @click=${() => this.exportChart('image/svg+xml')}>${glyph}${item.label ?? 'Download SVG'}</nile-menu-item>` : nothing}
479
- ${item.downloadCsv ? html `<nile-menu-item class="nile-chart-actions-menu-item" value="download-csv" @click=${() => this.downloadCsv()}>${glyph}${item.label ?? 'Download CSV'}</nile-menu-item>` : nothing}
517
+ ${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
518
+ ${item.fullscreen ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item fullscreen" value="fullscreen" @click=${() => this.viewFullscreen()}>${glyph}${item.label ?? 'Fullscreen'}</nile-menu-item>` : nothing}
519
+ ${item.print ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item print" value="print" @click=${() => this.printChart()}>${glyph}${item.label ?? 'Print'}</nile-menu-item>` : nothing}
520
+ ${item.downloadPng ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item download-png" value="download-png" @click=${() => this.exportChart('image/png')}>${glyph}${item.label ?? 'Download PNG'}</nile-menu-item>` : nothing}
521
+ ${item.downloadSvg ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item download-svg" value="download-svg" @click=${() => this.exportChart('image/svg+xml')}>${glyph}${item.label ?? 'Download SVG'}</nile-menu-item>` : nothing}
522
+ ${item.downloadCsv ? html `<nile-menu-item class="nile-chart-actions-menu-item" part="menu-item download-csv" value="download-csv" @click=${() => this.downloadCsv()}>${glyph}${item.label ?? 'Download CSV'}</nile-menu-item>` : nothing}
480
523
  `;
481
524
  }
482
525
  renderActionsMenu() {
@@ -494,35 +537,36 @@ let NileChart = class NileChart extends NileElement {
494
537
  const hasAnyItems = !!(types?.length || allItems.length);
495
538
  if (!hasAnyItems) {
496
539
  return html `
497
- <button type="button" class="nile-chart-menu-trigger" aria-label="Chart actions">
498
- <nile-glyph name="options" size="16"></nile-glyph>
540
+ <button type="button" class="nile-chart-menu-trigger" part="menu-trigger" aria-label="Chart actions">
541
+ <nile-glyph name="options" size="16" part="menu-trigger-glyph"></nile-glyph>
499
542
  </button>
500
543
  `;
501
544
  }
502
545
  return html `
503
- <nile-dropdown class="nile-chart-menu-anchor" placement="bottom-end" distance="4" portal>
546
+ <nile-dropdown class="nile-chart-menu-anchor" placement="bottom-end" distance="4" portal part="menu-anchor">
504
547
  <button
505
548
  type="button"
506
549
  slot="trigger"
507
550
  class="nile-chart-menu-trigger"
551
+ part="menu-trigger"
508
552
  aria-label="Chart actions"
509
553
  >
510
- <nile-glyph name="options" size="16"></nile-glyph>
554
+ <nile-glyph name="options" size="16" part="menu-trigger-glyph"></nile-glyph>
511
555
  </button>
512
- <nile-menu class="nile-chart-actions-menu" part="dropdown">
556
+ <nile-menu class="nile-chart-actions-menu" part="dropdown menu">
513
557
  ${types?.length ? html `
514
558
  ${types.map(type => html `
515
- <nile-menu-item class="nile-chart-actions-menu-item" value=${`type:${type}`} ?active=${type === this.activeType} @click=${() => this.switchType(type)}>
559
+ <nile-menu-item class="nile-chart-actions-menu-item" part="menu-item type" value=${`type:${type}`} ?active=${type === this.activeType} @click=${() => this.switchType(type)}>
516
560
  ${chartTypeLabel(type)}
517
561
  </nile-menu-item>
518
562
  `)}
519
- ${allItems.length ? html `<div class="nile-chart-actions-menu-separator" role="separator"></div>` : nothing}
563
+ ${allItems.length ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
520
564
  ` : nothing}
521
565
  ${allItems.map(item => {
522
566
  if (item.type === 'group') {
523
567
  return html `
524
- ${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="seperator"></div>` : nothing}
525
- <span class="nile-chart-actions-menu-group-header" role="presentation" part="header">${item.label}</span>
568
+ ${item.divider ? html `<div class="nile-chart-actions-menu-separator" role="separator" part="menu-separator"></div>` : nothing}
569
+ <span class="nile-chart-actions-menu-group-header" role="presentation" part="menu-group-header">${item.label}</span>
526
570
  ${item.items.map(child => this._renderMenuItem(child, hasChart))}
527
571
  `;
528
572
  }
@@ -543,7 +587,7 @@ let NileChart = class NileChart extends NileElement {
543
587
  @click=${this.toggleChat}
544
588
  part="ai-trigger"
545
589
  >
546
- <nile-glyph name="smart-code" size="16"></nile-glyph>
590
+ <nile-glyph name="smart-code" size="16" part="ai-trigger-glyph"></nile-glyph>
547
591
  </button>
548
592
  <slot name="nile-ai-trigger-after"></slot>
549
593
  `;
@@ -560,6 +604,24 @@ let NileChart = class NileChart extends NileElement {
560
604
  if (this._headerTipEl)
561
605
  this._headerTipEl.style.display = 'none';
562
606
  }
607
+ _syncHeaderTruncationA11y() {
608
+ const root = this.shadowRoot;
609
+ if (!root)
610
+ return;
611
+ for (const sel of ['.nile-chart-header-title', '.nile-chart-header-subtitle']) {
612
+ const el = root.querySelector(sel);
613
+ if (!el)
614
+ continue;
615
+ const truncated = el.scrollWidth > el.clientWidth;
616
+ if (truncated) {
617
+ el.setAttribute('tabindex', '0');
618
+ }
619
+ else {
620
+ el.removeAttribute('tabindex');
621
+ this._hideHeaderTip();
622
+ }
623
+ }
624
+ }
563
625
  renderHeader() {
564
626
  if (!this.shouldShowHeader())
565
627
  return nothing;
@@ -567,21 +629,23 @@ let NileChart = class NileChart extends NileElement {
567
629
  const subtitle = this.headerSubtitle;
568
630
  const showDefaultTitles = !this.hasHeaderSlotContent && !!(title || subtitle);
569
631
  const headerCompact = !subtitle?.trim();
632
+ const titleFontSize = this.titleFontSize;
633
+ const subtitleFontSize = this.subtitleFontSize;
570
634
  return html `
571
- <div class="nile-chart-header ${headerCompact ? 'nile-chart-header--compact' : ''}">
572
- <div class="nile-chart-header-titles">
635
+ <div class="nile-chart-header ${headerCompact ? 'nile-chart-header--compact' : ''}" part="header">
636
+ <div class="nile-chart-header-titles" part="header-titles">
573
637
  <slot name="header" @slotchange=${this.onHeaderSlotChange}></slot>
574
638
  ${showDefaultTitles
575
639
  ? html `
576
- ${title ? html `<p class="nile-chart-header-title" @mouseenter=${this._onTitleEnter} @mouseleave=${() => this._hideHeaderTip()}>${title}</p>` : nothing}
577
- ${subtitle ? html `<p class="nile-chart-header-subtitle" @mouseenter=${this._onSubtitleEnter} @mouseleave=${() => this._hideHeaderTip()}>${subtitle}</p>` : nothing}
640
+ ${title ? html `<p class="nile-chart-header-title" part="header-title" style=${titleFontSize ? `font-size:${titleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${title}</p>` : nothing}
641
+ ${subtitle ? html `<p class="nile-chart-header-subtitle" part="header-subtitle" style=${subtitleFontSize ? `font-size:${subtitleFontSize}` : nothing} @mouseenter=${this._onHeaderTextEnter} @mouseleave=${() => this._hideHeaderTip()} @focus=${this._onHeaderTextEnter} @blur=${() => this._hideHeaderTip()}>${subtitle}</p>` : nothing}
578
642
  `
579
643
  : nothing}
580
644
  </div>
581
- <div class="nile-chart-header-actions">
645
+ <div class="nile-chart-header-actions" part="header-actions">
582
646
  <slot name="header-actions" @slotchange=${this.onHeaderActionsSlotChange}></slot>
583
647
  ${this.masterZoomed && (this.activeType ?? this.resolvedConfig?.type) === 'master-detail'
584
- ? html `<nile-tooltip content="Reset zoom" placement="top">
648
+ ? html `<nile-tooltip content="Reset zoom" placement="top" part="reset-zoom-tooltip">
585
649
  <button
586
650
  type="button"
587
651
  class="nile-chart-menu-trigger nile-chart-reset-zoom"
@@ -589,7 +653,7 @@ let NileChart = class NileChart extends NileElement {
589
653
  aria-label="Reset zoom"
590
654
  @click=${() => this.masterDetailChart?.resetZoom()}
591
655
  >
592
- <nile-glyph name="refresh" size="16"></nile-glyph>
656
+ <nile-glyph name="refresh" size="16" part="reset-zoom-glyph"></nile-glyph>
593
657
  </button>
594
658
  </nile-tooltip>`
595
659
  : nothing}
@@ -610,8 +674,9 @@ let NileChart = class NileChart extends NileElement {
610
674
  const summaryMessage = summary;
611
675
  const welcomeMessage = summary ? '' : (aiConfig?.welcomeMessage ?? '');
612
676
  return html `
613
- <div class="nile-ai-panel-overlay" ?data-open=${this.chatOpen}>
677
+ <div class="nile-ai-panel-overlay" part="ai-panel" ?data-open=${this.chatOpen}>
614
678
  <nile-ai-panel
679
+ part="ai-panel-content"
615
680
  .placeholder=${aiConfig?.placeholder ?? 'Ask about this chart...'}
616
681
  .welcomeMessage=${welcomeMessage}
617
682
  .summaryMessage=${summaryMessage}
@@ -631,16 +696,28 @@ let NileChart = class NileChart extends NileElement {
631
696
  const { show, ...rest } = config.legend;
632
697
  legendOptions.legend = { enabled: show ?? true, ...rest };
633
698
  }
699
+ const spacingOptions = {};
700
+ if (config.chartSpacing) {
701
+ const { top, right, bottom, left } = config.chartSpacing;
702
+ const chart = {};
703
+ if (top != null)
704
+ chart.spacingTop = top;
705
+ if (right != null)
706
+ chart.spacingRight = right;
707
+ if (bottom != null)
708
+ chart.spacingBottom = bottom;
709
+ if (left != null)
710
+ chart.spacingLeft = left;
711
+ if (Object.keys(chart).length)
712
+ spacingOptions.chart = chart;
713
+ }
634
714
  const cfgData = config.data;
635
715
  const dataCount = Array.isArray(cfgData) ? cfgData.length : undefined;
636
- // Apply the built-in 'default' palette automatically when no colorPalette is
637
- // given — so charts use Nile colors out of the box with no config needed. A
638
- // consumer who supplies their own `options.colors` opts out (not clobbered).
639
716
  const hasExplicitColors = Array.isArray(config.options?.colors);
640
717
  const paletteCfg = config.colorPalette ?? (hasExplicitColors ? undefined : { theme: 'default' });
641
718
  const paletteColors = resolveColorPaletteColors(paletteCfg, dataCount);
642
719
  const paletteOptions = paletteColors ? { colors: paletteColors } : {};
643
- const mergedOptions = deepMerge(deepMerge(deepMerge(deepMerge(config.options ?? {}, legendOptions), paletteOptions), noTitle), this.buildExportingOptions());
720
+ const mergedOptions = deepMerge(deepMerge(deepMerge(deepMerge(deepMerge(config.options ?? {}, legendOptions), spacingOptions), paletteOptions), noTitle), this.buildExportingOptions());
644
721
  switch (config.type) {
645
722
  case 'bar':
646
723
  return html `<nile-bar-chart
@@ -1902,7 +1979,7 @@ let NileChart = class NileChart extends NileElement {
1902
1979
  return html `
1903
1980
  <div class="nile-chart-card ${isGrid ? 'nile-chart-card--grid' : ''} ${isLoading ? 'nile-chart-card--loading' : ''} ${this.activeConfig?.type === 'kpi' ? 'nile-chart-card--kpi' : ''}" part="chart-card">
1904
1981
  ${this.renderHeader()}
1905
- <div class="nile-chart-wrapper">
1982
+ <div class="nile-chart-wrapper" part="chart-body">
1906
1983
  <div class="nile-chart-inner ${this.activeConfig?.type === 'kpi' ? 'nile-chart-inner--kpi' : ''} ${this.activeConfig?.type === 'filter' ? 'nile-chart-inner--filter' : ''}" part="chart-inner">
1907
1984
  ${isLoading
1908
1985
  ? this.renderSkeleton()
@@ -1970,7 +2047,7 @@ __decorate([
1970
2047
  __decorate([
1971
2048
  state()
1972
2049
  ], NileChart.prototype, "masterZoomed", void 0);
1973
- NileChart = __decorate([
2050
+ NileChart = NileChart_1 = __decorate([
1974
2051
  customElement('nile-chart')
1975
2052
  ], NileChart);
1976
2053
  export { NileChart };
@@ -26,7 +26,7 @@ export declare class NileClusterChart extends NileElement {
26
26
  yAxisTitle: string;
27
27
  showLegend: boolean;
28
28
  /** Full legend configuration — all Highcharts legend options in one object. */
29
- legend: import('../nile-pie-chart/nile-pie-chart.js').LegendConfig | null;
29
+ legend: import('../internal/types/index.js').LegendConfig | null;
30
30
  groupPadding: number;
31
31
  pointPadding: number;
32
32
  chartBg: string;
@@ -25,7 +25,7 @@ export declare class NileColumnChart extends NileElement {
25
25
  yAxisTitle: string;
26
26
  showLegend: boolean;
27
27
  /** Full legend configuration — all Highcharts legend options in one object. */
28
- legend: import('../nile-pie-chart/nile-pie-chart.js').LegendConfig | null;
28
+ legend: import('../internal/types/index.js').LegendConfig | null;
29
29
  chartBg: string;
30
30
  chartBorderRadius: string | number;
31
31
  chartBorder: string;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface ColumnDrilldownParentPoint {
7
7
  name: string;
8
8
  y: number;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface ColumnPyramidSeriesData {
7
7
  name: string;
8
8
  data: number[];
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface ColumnRangeSeriesData {
7
7
  name: string;
8
8
  data: [number, number][];
@@ -30,7 +30,7 @@ export declare class NileDonutChart extends NileElement {
30
30
  showDataLabels: boolean;
31
31
  showLegend: boolean;
32
32
  /** Full legend configuration — all Highcharts legend options in one object. */
33
- legend: import('../nile-pie-chart/nile-pie-chart.js').LegendConfig | null;
33
+ legend: import('../internal/types/index.js').LegendConfig | null;
34
34
  chartBg: string;
35
35
  chartBorderRadius: string | number;
36
36
  chartBorder: string;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface DumbbellPoint {
7
7
  name: string;
8
8
  low: number;
@@ -3,7 +3,7 @@ import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
5
  import type { DumbbellPoint } from '../nile-dumbbell-chart/nile-dumbbell-chart.js';
6
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
6
+ import type { LegendConfig } from '../internal/types/index.js';
7
7
  export declare class NileDumbbellLowerChart extends NileElement {
8
8
  static styles: CSSResultGroup;
9
9
  private _hc;
@@ -3,7 +3,7 @@ import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
5
  import type { DumbbellPoint } from '../nile-dumbbell-chart/nile-dumbbell-chart.js';
6
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
6
+ import type { LegendConfig } from '../internal/types/index.js';
7
7
  export declare class NileDumbbellUpperChart extends NileElement {
8
8
  static styles: CSSResultGroup;
9
9
  private _hc;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface EulerVennDataPoint {
7
7
  sets: string[];
8
8
  value: number;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  /** Central path (history + median / point forecast). */
7
7
  export interface FanLinePoint {
8
8
  category: string;
@@ -79,6 +79,7 @@ export declare class NileFilterChart extends NileElement implements FilterChartH
79
79
  private _validateOrClear;
80
80
  private _clearPromptValidation;
81
81
  private _syncPromptAnimations;
82
+ private _shouldAnimateTypewriter;
82
83
  private _startPromptAnimation;
83
84
  private _stopPromptAnimation;
84
85
  private _stopAllPromptAnimations;
@@ -241,18 +241,23 @@ let NileFilterChart = NileFilterChart_1 = class NileFilterChart extends NileElem
241
241
  _syncPromptAnimations() {
242
242
  const wanted = new Set();
243
243
  for (const ctrl of this._flatControls()) {
244
- if (ctrl.variant === 'prompt' || ctrl.variant === 'hybrid' || ctrl.variant === 'expression') {
244
+ const isPromptLike = ctrl.variant === 'prompt' || ctrl.variant === 'hybrid' || ctrl.variant === 'expression';
245
+ if (isPromptLike && this._shouldAnimateTypewriter(ctrl)) {
245
246
  wanted.add(ctrl.id);
246
247
  if (!this._promptTimers.has(ctrl.id))
247
248
  this._startPromptAnimation(ctrl);
248
249
  }
249
250
  }
250
- // Stop animations whose controls were removed from the config
251
251
  for (const id of [...this._promptTimers.keys()]) {
252
252
  if (!wanted.has(id))
253
253
  this._stopPromptAnimation(id);
254
254
  }
255
255
  }
256
+ _shouldAnimateTypewriter(ctrl) {
257
+ return ((ctrl.placeholders?.length ?? 0) > 1 ||
258
+ (ctrl.promptPlaceholders?.length ?? 0) > 1 ||
259
+ (ctrl.expressionPlaceholders?.length ?? 0) > 1);
260
+ }
256
261
  _startPromptAnimation(ctrl) {
257
262
  const getPhrases = () => {
258
263
  const mode = this.promptModes.get(ctrl.id);
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  /** Segment row for the flame / icicle layout (`columnrange`-based). */
7
7
  export interface FlameChartPoint {
8
8
  name: string;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface FunnelDataPoint {
7
7
  name: string;
8
8
  y: number;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { NileChartConfigInputType } from '../internal/types/index.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface GaugeBand {
7
7
  from: number;
8
8
  to: number;
@@ -32,7 +32,7 @@ export declare class NileHeatmapChart extends NileElement {
32
32
  showDataLabels: boolean;
33
33
  showLegend: boolean;
34
34
  /** Full legend configuration — all Highcharts legend options in one object. */
35
- legend: import('../nile-pie-chart/nile-pie-chart.js').LegendConfig | null;
35
+ legend: import('../internal/types/index.js').LegendConfig | null;
36
36
  chartBg: string;
37
37
  chartBorderRadius: string | number;
38
38
  chartBorder: string;
@@ -34,7 +34,7 @@ export declare class NileHistogramChart extends NileElement {
34
34
  binWidth: number;
35
35
  showLegend: boolean;
36
36
  /** Full legend configuration — all Highcharts legend options in one object. */
37
- legend: import('../nile-pie-chart/nile-pie-chart.js').LegendConfig | null;
37
+ legend: import('../internal/types/index.js').LegendConfig | null;
38
38
  chartBg: string;
39
39
  chartBorderRadius: string | number;
40
40
  chartBorder: string;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/index.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface InvertedAreaChartSeriesData {
7
7
  name: string;
8
8
  data: number[];
@@ -25,7 +25,7 @@ export declare class NileLineChart extends NileElement {
25
25
  yAxisTitle: string;
26
26
  showLegend: boolean;
27
27
  /** Full legend configuration — all Highcharts legend options in one object. */
28
- legend: import('../nile-pie-chart/nile-pie-chart.js').LegendConfig | null;
28
+ legend: import('../internal/types/index.js').LegendConfig | null;
29
29
  chartBg: string;
30
30
  chartBorderRadius: string | number;
31
31
  chartBorder: string;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface LineColumnSeriesPart {
7
7
  name: string;
8
8
  data: number[];
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface LollipopSeriesData {
7
7
  name: string;
8
8
  data: number[];
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { NileChartConfigInputType } from '../internal/types/index.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  export interface MapChartDataPoint {
7
7
  /** Highcharts map key matching the map topology (e.g. 'us-ca'). */
8
8
  'hc-key'?: string;
@@ -3,7 +3,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
3
3
  import type Highcharts from 'highcharts';
4
4
  import NileElement from '../internal/nile-element.js';
5
5
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
6
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
6
+ import type { LegendConfig } from '../internal/types/index.js';
7
7
  export interface MasterDetailPoint {
8
8
  x: number;
9
9
  y: number;
@@ -2,7 +2,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
2
2
  import type Highcharts from 'highcharts';
3
3
  import NileElement from '../internal/nile-element.js';
4
4
  import type { SeparatedChartConfigInputType } from '../internal/types/separated-chart-config-input.type.js';
5
- import type { LegendConfig } from '../nile-pie-chart/nile-pie-chart.js';
5
+ import type { LegendConfig } from '../internal/types/index.js';
6
6
  /** Directed edge: reporting line from `from` to `to` (node ids). */
7
7
  export interface OrgChartLink {
8
8
  from: string;
@@ -1,2 +1,2 @@
1
1
  export { NilePieChart } from './nile-pie-chart.js';
2
- export type { PieChartSeriesData } from './nile-pie-chart.js';
2
+ export type { PieChartSeriesData, LegendConfig, LegendNavigationConfig, LegendTitleConfig, LegendAccessibilityConfig, CSSObject, } from './nile-pie-chart.js';