@aquera/nile-visualization 2.9.28 → 2.9.29

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 (121) hide show
  1. package/README.md +4 -0
  2. package/dist/src/index.d.ts +3 -0
  3. package/dist/src/index.js +2 -0
  4. package/dist/src/internal/chart-events.d.ts +92 -0
  5. package/dist/src/internal/chart-events.js +291 -0
  6. package/dist/src/internal/chart-runtime.d.ts +41 -0
  7. package/dist/src/internal/chart-runtime.js +30 -0
  8. package/dist/src/internal/highcharts-provider.js +2 -0
  9. package/dist/src/internal/nile-chart-base.d.ts +43 -0
  10. package/dist/src/internal/nile-chart-base.js +67 -0
  11. package/dist/src/internal/resolve-widget-kind.d.ts +10 -0
  12. package/dist/src/internal/resolve-widget-kind.js +16 -0
  13. package/dist/src/internal/responsive-defaults.d.ts +32 -0
  14. package/dist/src/internal/responsive-defaults.js +255 -0
  15. package/dist/src/internal/types/highcharts-passthrough.type.d.ts +80 -0
  16. package/dist/src/internal/types/highcharts-passthrough.type.js +24 -0
  17. package/dist/src/internal/types/index.d.ts +2 -0
  18. package/dist/src/internal/types/index.js +1 -1
  19. package/dist/src/internal/types/widget-config.type.d.ts +14 -3
  20. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.d.ts +2 -0
  21. package/dist/src/nile-anomaly-chart/nile-anomaly-chart.js +8 -1
  22. package/dist/src/nile-area-chart/nile-area-chart.d.ts +1 -0
  23. package/dist/src/nile-area-chart/nile-area-chart.js +7 -1
  24. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.d.ts +1 -0
  25. package/dist/src/nile-area-negative-chart/nile-area-negative-chart.js +7 -1
  26. package/dist/src/nile-area-range-chart/nile-area-range-chart.d.ts +1 -0
  27. package/dist/src/nile-area-range-chart/nile-area-range-chart.js +7 -1
  28. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.d.ts +1 -0
  29. package/dist/src/nile-area-spline-chart/nile-area-spline-chart.js +7 -1
  30. package/dist/src/nile-bar-chart/nile-bar-chart.d.ts +2 -0
  31. package/dist/src/nile-bar-chart/nile-bar-chart.js +8 -1
  32. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.d.ts +1 -0
  33. package/dist/src/nile-bellcurve-chart/nile-bellcurve-chart.js +7 -1
  34. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.d.ts +1 -0
  35. package/dist/src/nile-boxplot-chart/nile-boxplot-chart.js +7 -1
  36. package/dist/src/nile-bubble-chart/nile-bubble-chart.d.ts +1 -0
  37. package/dist/src/nile-bubble-chart/nile-bubble-chart.js +7 -1
  38. package/dist/src/nile-chart/nile-chart-config.d.ts +2 -2
  39. package/dist/src/nile-chart/nile-chart.css.js +3 -1
  40. package/dist/src/nile-chart/nile-chart.d.ts +59 -0
  41. package/dist/src/nile-chart/nile-chart.js +176 -3
  42. package/dist/src/nile-cluster-chart/nile-cluster-chart.d.ts +1 -0
  43. package/dist/src/nile-cluster-chart/nile-cluster-chart.js +7 -1
  44. package/dist/src/nile-column-chart/nile-column-chart.d.ts +1 -0
  45. package/dist/src/nile-column-chart/nile-column-chart.js +7 -1
  46. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.d.ts +1 -0
  47. package/dist/src/nile-column-drilldown-chart/nile-column-drilldown-chart.js +8 -1
  48. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.d.ts +1 -0
  49. package/dist/src/nile-column-pyramid-chart/nile-column-pyramid-chart.js +7 -1
  50. package/dist/src/nile-column-range-chart/nile-column-range-chart.d.ts +1 -0
  51. package/dist/src/nile-column-range-chart/nile-column-range-chart.js +7 -1
  52. package/dist/src/nile-dashboard-builder/nile-dashboard-builder.css.js +24 -8
  53. package/dist/src/nile-dashboard-builder/nile-dashboard-builder.d.ts +111 -0
  54. package/dist/src/nile-dashboard-builder/nile-dashboard-builder.js +188 -6
  55. package/dist/src/nile-donut-chart/nile-donut-chart.d.ts +1 -0
  56. package/dist/src/nile-donut-chart/nile-donut-chart.js +7 -1
  57. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.d.ts +1 -0
  58. package/dist/src/nile-dumbbell-chart/nile-dumbbell-chart.js +7 -1
  59. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.d.ts +1 -0
  60. package/dist/src/nile-dumbbell-lower-chart/nile-dumbbell-lower-chart.js +7 -1
  61. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.d.ts +1 -0
  62. package/dist/src/nile-dumbbell-upper-chart/nile-dumbbell-upper-chart.js +7 -1
  63. package/dist/src/nile-euler-chart/nile-euler-chart.d.ts +1 -0
  64. package/dist/src/nile-euler-chart/nile-euler-chart.js +7 -1
  65. package/dist/src/nile-fan-chart/nile-fan-chart.d.ts +1 -0
  66. package/dist/src/nile-fan-chart/nile-fan-chart.js +7 -1
  67. package/dist/src/nile-flame-chart/nile-flame-chart.d.ts +1 -0
  68. package/dist/src/nile-flame-chart/nile-flame-chart.js +7 -1
  69. package/dist/src/nile-funnel-chart/nile-funnel-chart.d.ts +1 -0
  70. package/dist/src/nile-funnel-chart/nile-funnel-chart.js +7 -1
  71. package/dist/src/nile-gauge-chart/nile-gauge-chart.d.ts +20 -0
  72. package/dist/src/nile-gauge-chart/nile-gauge-chart.js +80 -4
  73. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.d.ts +1 -0
  74. package/dist/src/nile-heatmap-chart/nile-heatmap-chart.js +7 -1
  75. package/dist/src/nile-histogram-chart/nile-histogram-chart.d.ts +1 -0
  76. package/dist/src/nile-histogram-chart/nile-histogram-chart.js +7 -1
  77. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.d.ts +1 -0
  78. package/dist/src/nile-inverted-area-chart/nile-inverted-area-chart.js +7 -1
  79. package/dist/src/nile-line-chart/nile-line-chart.d.ts +1 -0
  80. package/dist/src/nile-line-chart/nile-line-chart.js +7 -1
  81. package/dist/src/nile-line-column-chart/nile-line-column-chart.d.ts +1 -0
  82. package/dist/src/nile-line-column-chart/nile-line-column-chart.js +7 -1
  83. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.d.ts +1 -0
  84. package/dist/src/nile-lollipop-chart/nile-lollipop-chart.js +7 -1
  85. package/dist/src/nile-map-chart/nile-map-chart.d.ts +23 -3
  86. package/dist/src/nile-map-chart/nile-map-chart.js +52 -12
  87. package/dist/src/nile-master-detail-chart/nile-master-detail-chart.css.js +13 -1
  88. package/dist/src/nile-master-detail-chart/nile-master-detail-chart.d.ts +1 -0
  89. package/dist/src/nile-master-detail-chart/nile-master-detail-chart.js +48 -4
  90. package/dist/src/nile-organization-chart/nile-organization-chart.d.ts +1 -0
  91. package/dist/src/nile-organization-chart/nile-organization-chart.js +7 -1
  92. package/dist/src/nile-pie-chart/nile-pie-chart.d.ts +2 -0
  93. package/dist/src/nile-pie-chart/nile-pie-chart.js +8 -1
  94. package/dist/src/nile-polygon-chart/nile-polygon-chart.d.ts +1 -0
  95. package/dist/src/nile-polygon-chart/nile-polygon-chart.js +7 -1
  96. package/dist/src/nile-radar-chart/nile-radar-chart.d.ts +1 -0
  97. package/dist/src/nile-radar-chart/nile-radar-chart.js +7 -1
  98. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.d.ts +1 -0
  99. package/dist/src/nile-radial-bar-chart/nile-radial-bar-chart.js +7 -1
  100. package/dist/src/nile-scatter-chart/nile-scatter-chart.d.ts +1 -0
  101. package/dist/src/nile-scatter-chart/nile-scatter-chart.js +7 -1
  102. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.d.ts +1 -0
  103. package/dist/src/nile-spiderweb-chart/nile-spiderweb-chart.js +7 -1
  104. package/dist/src/nile-spline-chart/nile-spline-chart.d.ts +1 -0
  105. package/dist/src/nile-spline-chart/nile-spline-chart.js +7 -1
  106. package/dist/src/nile-stacked-chart/nile-stacked-chart.d.ts +1 -0
  107. package/dist/src/nile-stacked-chart/nile-stacked-chart.js +7 -1
  108. package/dist/src/nile-timeline-chart/nile-timeline-chart.d.ts +1 -0
  109. package/dist/src/nile-timeline-chart/nile-timeline-chart.js +7 -1
  110. package/dist/src/nile-trendline-chart/nile-trendline-chart.d.ts +2 -0
  111. package/dist/src/nile-trendline-chart/nile-trendline-chart.js +8 -1
  112. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.d.ts +1 -0
  113. package/dist/src/nile-variable-pie-chart/nile-variable-pie-chart.js +7 -1
  114. package/dist/src/nile-vector-chart/nile-vector-chart.d.ts +1 -0
  115. package/dist/src/nile-vector-chart/nile-vector-chart.js +7 -1
  116. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.d.ts +1 -0
  117. package/dist/src/nile-waterfall-chart/nile-waterfall-chart.js +7 -1
  118. package/dist/src/nile-widget-viewer/nile-widget-viewer.js +6 -6
  119. package/dist/src/nile-xrange-chart/nile-xrange-chart.d.ts +1 -0
  120. package/dist/src/nile-xrange-chart/nile-xrange-chart.js +7 -1
  121. package/package.json +1 -1
package/README.md CHANGED
@@ -36,6 +36,10 @@ To run a local development server that serves the basic demo located in `demo/in
36
36
 
37
37
  In this section, you can find the updates for each release of `nile-visualization`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
38
38
 
39
+ #### Version 2.9.29 (July 27, 2026)
40
+ - Nile Dashboard Builder: Update on Nile Dashboard Builder (UIF-1315)
41
+ - Nile Chart: Added Responsiveness, APIs and Events to Nile Chart (UIF-1313) (UIF-1312) (UIF-1314)
42
+
39
43
  #### Version 2.9.28 (July 22, 2026)
40
44
  - Nile Dashboard Builder: Added Nile Dashboard Builder Component (UIF-1309)
41
45
 
@@ -1,3 +1,5 @@
1
+ export { NileChartEvents } from './internal/chart-events.js';
2
+ export type { NileChartEventName } from './internal/chart-events.js';
1
3
  export { NileBarChart } from './nile-bar-chart/index.js';
2
4
  export type { BarChartSeriesData } from './nile-bar-chart/index.js';
3
5
  export { NilePieChart } from './nile-pie-chart/index.js';
@@ -101,6 +103,7 @@ export { NileFilterChart } from './nile-filter-chart/index.js';
101
103
  export type { FilterChartSeparatedPayload, FilterControl, FilterOption, FilterChartConfig, } from './nile-filter-chart/nile-filter-chart.js';
102
104
  export { NileMapChart } from './nile-map-chart/index.js';
103
105
  export type { MapChartDataPoint } from './nile-map-chart/index.js';
106
+ export type { ChartExtremes, SetExtremesOptions, MapBounds, } from './internal/chart-runtime.js';
104
107
  export { NileAiSender } from './nile-ai-sender/index.js';
105
108
  export { NileAiPanel } from './nile-ai-panel/index.js';
106
109
  export { NileWidgetViewer } from './nile-widget-viewer/index.js';
package/dist/src/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // /* eslint-disable no-console */
2
2
  // console.log(`[nile-visualization] Build: ${__NILE_BUILD_DATE__}`);
3
3
  // /* eslint-enable no-console */
4
+ // Names of all Highcharts-derived events forwarded as `nile-*` CustomEvents on charts.
5
+ export { NileChartEvents } from './internal/chart-events.js';
4
6
  export { NileBarChart } from './nile-bar-chart/index.js';
5
7
  export { NilePieChart } from './nile-pie-chart/index.js';
6
8
  export { NileTrendlineChart } from './nile-trendline-chart/index.js';
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Central Highcharts → Nile event forwarding.
3
+ *
4
+ * HOW THIS FIRES WITHOUT ANY PER-CHART `emit()` CALLS
5
+ * ---------------------------------------------------
6
+ * The individual chart files (nile-bar-chart, nile-line-chart, …) do NOT emit
7
+ * these events. Instead `registerNileChartEvents()` calls `Highcharts.setOptions()`
8
+ * ONCE on the shared Highcharts instance (from `highcharts-provider.ts`). That
9
+ * registers the handlers below as GLOBAL DEFAULTS on Highcharts itself.
10
+ *
11
+ * Every chart is created via that same shared instance, and Highcharts merges
12
+ * these global defaults into each chart's own options at creation time. So when
13
+ * a chart file runs `Highcharts.chart(container, buildOptions())` — with no
14
+ * `series.events` of its own — Highcharts injects the default `mouseOver` (etc.)
15
+ * handler for it. Highcharts then invokes that handler on the live chart, and
16
+ * the handler dispatches a `composed`, bubbling CustomEvent from the chart
17
+ * container, which crosses the shadow DOM up to the host `<nile-chart>` /
18
+ * `<nile-*-chart>` element where consumers listen.
19
+ *
20
+ * setOptions(defaults) -> Highcharts.chart(el, buildOptions())
21
+ * = merge(defaults, chartOptions) // events injected here
22
+ * -> Highcharts fires event -> handler -> container.dispatchEvent(...)
23
+ * -> composed CustomEvent bubbles to the host element
24
+ *
25
+ * This is why lifecycle events (`load`, the first `render`) are captured — the
26
+ * defaults are present before the chart is even constructed — and why no chart
27
+ * file needs touching.
28
+ *
29
+ * MERGE NOTES
30
+ * - Highcharts merges `events` objects key-by-key, and a per-chart handler wins
31
+ * its own key. So a chart's inline `point.events.click` (which emits the
32
+ * long-standing `nile-chart-click`) coexists with the point events registered
33
+ * here; only that one `click` key is the chart's. Point `click` is therefore
34
+ * deliberately NOT forwarded here.
35
+ * - The single case where an inline handler shadows one registered here is
36
+ * `nile-column-drilldown-chart`'s inline `chart.events.render`; it re-emits
37
+ * `nile-chart-render` itself to stay consistent. Master-detail's inline
38
+ * `chart.events.selection` likewise re-emits `nile-chart-selection`.
39
+ *
40
+ * NOT FORWARDED HERE (no global-default slot for `setOptions` to attach to)
41
+ * - `xAxis.plotLines[].events` / `plotBands[].events` and `annotations[].events`
42
+ * are per-array-item config, not global option nodes — there is no "default
43
+ * plot line / band / annotation" for `setOptions` to hang a handler on. If a
44
+ * chart needs those, wire them where each line/band/annotation is defined.
45
+ * - Point `dragStart`/`drag`/`drop` and legend `itemClick` ARE registered here,
46
+ * but only do anything when the relevant module is present (draggable-points)
47
+ * or a legend is rendered.
48
+ */
49
+ export declare const NileChartEvents: {
50
+ readonly load: "nile-chart-load";
51
+ readonly render: "nile-chart-render";
52
+ readonly redraw: "nile-chart-redraw";
53
+ /** chart.events.click — click on the plot area. Distinct from the point-level `nile-chart-click`. */
54
+ readonly plotClick: "nile-chart-plot-click";
55
+ readonly selection: "nile-chart-selection";
56
+ readonly addSeries: "nile-chart-add-series";
57
+ readonly afterPrint: "nile-chart-after-print";
58
+ readonly beforePrint: "nile-chart-before-print";
59
+ readonly drilldown: "nile-chart-drilldown";
60
+ readonly drillup: "nile-chart-drillup";
61
+ readonly drillupall: "nile-chart-drillupall";
62
+ readonly exportData: "nile-chart-export-data";
63
+ readonly fullscreenOpen: "nile-chart-fullscreen-open";
64
+ readonly fullscreenClose: "nile-chart-fullscreen-close";
65
+ readonly seriesClick: "nile-series-click";
66
+ readonly seriesMouseOver: "nile-series-mouse-over";
67
+ readonly seriesMouseOut: "nile-series-mouse-out";
68
+ readonly seriesShow: "nile-series-show";
69
+ readonly seriesHide: "nile-series-hide";
70
+ readonly seriesLegendItemClick: "nile-series-legend-item-click";
71
+ readonly seriesCheckboxClick: "nile-series-checkbox-click";
72
+ readonly seriesAfterAnimate: "nile-series-after-animate";
73
+ readonly pointMouseOver: "nile-point-mouse-over";
74
+ readonly pointMouseOut: "nile-point-mouse-out";
75
+ readonly pointSelect: "nile-point-select";
76
+ readonly pointUnselect: "nile-point-unselect";
77
+ readonly pointRemove: "nile-point-remove";
78
+ readonly pointUpdate: "nile-point-update";
79
+ readonly pointDragStart: "nile-point-drag-start";
80
+ readonly pointDrag: "nile-point-drag";
81
+ readonly pointDrop: "nile-point-drop";
82
+ readonly legendItemClick: "nile-legend-item-click";
83
+ readonly axisSetExtremes: "nile-axis-set-extremes";
84
+ readonly axisAfterSetExtremes: "nile-axis-after-set-extremes";
85
+ readonly axisPointBreak: "nile-axis-point-break";
86
+ readonly axisPointInBreak: "nile-axis-point-in-break";
87
+ readonly axisAfterBreaks: "nile-axis-after-breaks";
88
+ };
89
+ export type NileChartEventName = (typeof NileChartEvents)[keyof typeof NileChartEvents];
90
+ export declare function registerNileChartEvents(H: {
91
+ setOptions(options: any): unknown;
92
+ }): void;
@@ -0,0 +1,291 @@
1
+ /**
2
+ * Central Highcharts → Nile event forwarding.
3
+ *
4
+ * HOW THIS FIRES WITHOUT ANY PER-CHART `emit()` CALLS
5
+ * ---------------------------------------------------
6
+ * The individual chart files (nile-bar-chart, nile-line-chart, …) do NOT emit
7
+ * these events. Instead `registerNileChartEvents()` calls `Highcharts.setOptions()`
8
+ * ONCE on the shared Highcharts instance (from `highcharts-provider.ts`). That
9
+ * registers the handlers below as GLOBAL DEFAULTS on Highcharts itself.
10
+ *
11
+ * Every chart is created via that same shared instance, and Highcharts merges
12
+ * these global defaults into each chart's own options at creation time. So when
13
+ * a chart file runs `Highcharts.chart(container, buildOptions())` — with no
14
+ * `series.events` of its own — Highcharts injects the default `mouseOver` (etc.)
15
+ * handler for it. Highcharts then invokes that handler on the live chart, and
16
+ * the handler dispatches a `composed`, bubbling CustomEvent from the chart
17
+ * container, which crosses the shadow DOM up to the host `<nile-chart>` /
18
+ * `<nile-*-chart>` element where consumers listen.
19
+ *
20
+ * setOptions(defaults) -> Highcharts.chart(el, buildOptions())
21
+ * = merge(defaults, chartOptions) // events injected here
22
+ * -> Highcharts fires event -> handler -> container.dispatchEvent(...)
23
+ * -> composed CustomEvent bubbles to the host element
24
+ *
25
+ * This is why lifecycle events (`load`, the first `render`) are captured — the
26
+ * defaults are present before the chart is even constructed — and why no chart
27
+ * file needs touching.
28
+ *
29
+ * MERGE NOTES
30
+ * - Highcharts merges `events` objects key-by-key, and a per-chart handler wins
31
+ * its own key. So a chart's inline `point.events.click` (which emits the
32
+ * long-standing `nile-chart-click`) coexists with the point events registered
33
+ * here; only that one `click` key is the chart's. Point `click` is therefore
34
+ * deliberately NOT forwarded here.
35
+ * - The single case where an inline handler shadows one registered here is
36
+ * `nile-column-drilldown-chart`'s inline `chart.events.render`; it re-emits
37
+ * `nile-chart-render` itself to stay consistent. Master-detail's inline
38
+ * `chart.events.selection` likewise re-emits `nile-chart-selection`.
39
+ *
40
+ * NOT FORWARDED HERE (no global-default slot for `setOptions` to attach to)
41
+ * - `xAxis.plotLines[].events` / `plotBands[].events` and `annotations[].events`
42
+ * are per-array-item config, not global option nodes — there is no "default
43
+ * plot line / band / annotation" for `setOptions` to hang a handler on. If a
44
+ * chart needs those, wire them where each line/band/annotation is defined.
45
+ * - Point `dragStart`/`drag`/`drop` and legend `itemClick` ARE registered here,
46
+ * but only do anything when the relevant module is present (draggable-points)
47
+ * or a legend is rendered.
48
+ */
49
+ export const NileChartEvents = {
50
+ // Chart-level (chart.events)
51
+ load: 'nile-chart-load',
52
+ render: 'nile-chart-render',
53
+ redraw: 'nile-chart-redraw',
54
+ /** chart.events.click — click on the plot area. Distinct from the point-level `nile-chart-click`. */
55
+ plotClick: 'nile-chart-plot-click',
56
+ selection: 'nile-chart-selection',
57
+ addSeries: 'nile-chart-add-series',
58
+ afterPrint: 'nile-chart-after-print',
59
+ beforePrint: 'nile-chart-before-print',
60
+ drilldown: 'nile-chart-drilldown',
61
+ drillup: 'nile-chart-drillup',
62
+ drillupall: 'nile-chart-drillupall',
63
+ exportData: 'nile-chart-export-data',
64
+ fullscreenOpen: 'nile-chart-fullscreen-open',
65
+ fullscreenClose: 'nile-chart-fullscreen-close',
66
+ // Series-level (plotOptions.series.events)
67
+ seriesClick: 'nile-series-click',
68
+ seriesMouseOver: 'nile-series-mouse-over',
69
+ seriesMouseOut: 'nile-series-mouse-out',
70
+ seriesShow: 'nile-series-show',
71
+ seriesHide: 'nile-series-hide',
72
+ seriesLegendItemClick: 'nile-series-legend-item-click',
73
+ seriesCheckboxClick: 'nile-series-checkbox-click',
74
+ seriesAfterAnimate: 'nile-series-after-animate',
75
+ // Point-level (plotOptions.series.point.events) — `click` stays as `nile-chart-click`
76
+ pointMouseOver: 'nile-point-mouse-over',
77
+ pointMouseOut: 'nile-point-mouse-out',
78
+ pointSelect: 'nile-point-select',
79
+ pointUnselect: 'nile-point-unselect',
80
+ pointRemove: 'nile-point-remove',
81
+ pointUpdate: 'nile-point-update',
82
+ // Draggable-points module (fire only when that module is loaded)
83
+ pointDragStart: 'nile-point-drag-start',
84
+ pointDrag: 'nile-point-drag',
85
+ pointDrop: 'nile-point-drop',
86
+ // Legend-level (legend.events) — distinct from series.events.legendItemClick
87
+ legendItemClick: 'nile-legend-item-click',
88
+ // Axis-level (xAxis.events / yAxis.events)
89
+ axisSetExtremes: 'nile-axis-set-extremes',
90
+ axisAfterSetExtremes: 'nile-axis-after-set-extremes',
91
+ axisPointBreak: 'nile-axis-point-break',
92
+ axisPointInBreak: 'nile-axis-point-in-break',
93
+ axisAfterBreaks: 'nile-axis-after-breaks',
94
+ };
95
+ function fire(container, name, detail, cancelable = false) {
96
+ if (!container || typeof container.dispatchEvent !== 'function')
97
+ return undefined;
98
+ const event = new CustomEvent(name, { bubbles: true, composed: true, cancelable, detail });
99
+ container.dispatchEvent(event);
100
+ return event;
101
+ }
102
+ /** Container lookups for each Highcharts event context (`this`). */
103
+ const chartContainer = (chart) => chart?.container;
104
+ const seriesContainer = (series) => series?.chart?.container;
105
+ const pointContainer = (point) => point?.series?.chart?.container;
106
+ const axisContainer = (axis) => axis?.chart?.container;
107
+ export function registerNileChartEvents(H) {
108
+ const E = NileChartEvents;
109
+ H.setOptions({
110
+ chart: {
111
+ events: {
112
+ load() {
113
+ fire(chartContainer(this), E.load, { chart: this });
114
+ },
115
+ render() {
116
+ fire(chartContainer(this), E.render, { chart: this });
117
+ },
118
+ redraw() {
119
+ fire(chartContainer(this), E.redraw, { chart: this });
120
+ },
121
+ click(event) {
122
+ fire(chartContainer(this), E.plotClick, {
123
+ chart: this,
124
+ event,
125
+ xValue: event?.xAxis?.[0]?.value,
126
+ yValue: event?.yAxis?.[0]?.value,
127
+ });
128
+ },
129
+ selection(event) {
130
+ const ev = fire(chartContainer(this), E.selection, { chart: this, event, reset: !event?.xAxis, xAxis: event?.xAxis, yAxis: event?.yAxis }, true);
131
+ // Return false to keep Highcharts from applying its default zoom.
132
+ return ev?.defaultPrevented ? false : undefined;
133
+ },
134
+ addSeries(event) {
135
+ fire(chartContainer(this), E.addSeries, { chart: this, event, options: event?.options });
136
+ },
137
+ afterPrint() {
138
+ fire(chartContainer(this), E.afterPrint, { chart: this });
139
+ },
140
+ beforePrint() {
141
+ fire(chartContainer(this), E.beforePrint, { chart: this });
142
+ },
143
+ drilldown(event) {
144
+ fire(chartContainer(this), E.drilldown, {
145
+ chart: this,
146
+ event,
147
+ point: event?.point,
148
+ seriesOptions: event?.seriesOptions,
149
+ });
150
+ },
151
+ drillup(event) {
152
+ fire(chartContainer(this), E.drillup, { chart: this, event, seriesOptions: event?.seriesOptions });
153
+ },
154
+ drillupall(event) {
155
+ fire(chartContainer(this), E.drillupall, { chart: this, event });
156
+ },
157
+ exportData(event) {
158
+ // Consumers can mutate `event.dataRows` in place to alter exported data.
159
+ fire(chartContainer(this), E.exportData, { chart: this, event, dataRows: event?.dataRows });
160
+ },
161
+ fullscreenOpen(event) {
162
+ fire(chartContainer(this), E.fullscreenOpen, { chart: this, event });
163
+ },
164
+ fullscreenClose(event) {
165
+ fire(chartContainer(this), E.fullscreenClose, { chart: this, event });
166
+ },
167
+ },
168
+ },
169
+ legend: {
170
+ events: {
171
+ itemClick(event) {
172
+ const ev = fire(chartContainer(this?.chart), E.legendItemClick, { legend: this, event, legendItem: event?.legendItem }, true);
173
+ // Return false to suppress the default show/hide toggle.
174
+ return ev?.defaultPrevented ? false : undefined;
175
+ },
176
+ },
177
+ },
178
+ plotOptions: {
179
+ series: {
180
+ events: {
181
+ click(event) {
182
+ fire(seriesContainer(this), E.seriesClick, { series: this, event, point: event?.point });
183
+ },
184
+ mouseOver() {
185
+ fire(seriesContainer(this), E.seriesMouseOver, { series: this });
186
+ },
187
+ mouseOut() {
188
+ fire(seriesContainer(this), E.seriesMouseOut, { series: this });
189
+ },
190
+ show() {
191
+ fire(seriesContainer(this), E.seriesShow, { series: this });
192
+ },
193
+ hide() {
194
+ fire(seriesContainer(this), E.seriesHide, { series: this });
195
+ },
196
+ legendItemClick(event) {
197
+ const ev = fire(seriesContainer(this), E.seriesLegendItemClick, { series: this, event }, true);
198
+ // Return false to keep Highcharts from toggling series visibility.
199
+ return ev?.defaultPrevented ? false : undefined;
200
+ },
201
+ checkboxClick(event) {
202
+ fire(seriesContainer(this), E.seriesCheckboxClick, {
203
+ series: this,
204
+ event,
205
+ checked: event?.checked,
206
+ });
207
+ },
208
+ afterAnimate() {
209
+ fire(seriesContainer(this), E.seriesAfterAnimate, { series: this });
210
+ },
211
+ },
212
+ point: {
213
+ events: {
214
+ // `click` is deliberately omitted — charts wire it inline as `nile-chart-click`.
215
+ mouseOver() {
216
+ fire(pointContainer(this), E.pointMouseOver, { point: this, series: this?.series });
217
+ },
218
+ mouseOut() {
219
+ fire(pointContainer(this), E.pointMouseOut, { point: this, series: this?.series });
220
+ },
221
+ select(event) {
222
+ const ev = fire(pointContainer(this), E.pointSelect, { point: this, event }, true);
223
+ return ev?.defaultPrevented ? false : undefined;
224
+ },
225
+ unselect(event) {
226
+ const ev = fire(pointContainer(this), E.pointUnselect, { point: this, event }, true);
227
+ return ev?.defaultPrevented ? false : undefined;
228
+ },
229
+ remove(event) {
230
+ fire(pointContainer(this), E.pointRemove, { point: this, event });
231
+ },
232
+ update(event) {
233
+ fire(pointContainer(this), E.pointUpdate, { point: this, event, newOptions: event?.options });
234
+ },
235
+ // Draggable-points module — these only fire when that module is loaded.
236
+ dragStart(event) {
237
+ const ev = fire(pointContainer(this), E.pointDragStart, { point: this, event }, true);
238
+ return ev?.defaultPrevented ? false : undefined;
239
+ },
240
+ drag(event) {
241
+ const ev = fire(pointContainer(this), E.pointDrag, { point: this, event, newPoints: event?.newPoints }, true);
242
+ return ev?.defaultPrevented ? false : undefined;
243
+ },
244
+ drop(event) {
245
+ const ev = fire(pointContainer(this), E.pointDrop, { point: this, event, newPoints: event?.newPoints }, true);
246
+ return ev?.defaultPrevented ? false : undefined;
247
+ },
248
+ },
249
+ },
250
+ },
251
+ },
252
+ xAxis: { events: axisEventHandlers() },
253
+ yAxis: { events: axisEventHandlers() },
254
+ });
255
+ }
256
+ /** Shared axis event handlers, applied to both x and y axes. */
257
+ function axisEventHandlers() {
258
+ const E = NileChartEvents;
259
+ return {
260
+ setExtremes(event) {
261
+ fire(axisContainer(this), E.axisSetExtremes, {
262
+ axis: this,
263
+ event,
264
+ min: event?.min,
265
+ max: event?.max,
266
+ trigger: event?.trigger,
267
+ isX: this?.isXAxis,
268
+ });
269
+ },
270
+ afterSetExtremes(event) {
271
+ fire(axisContainer(this), E.axisAfterSetExtremes, {
272
+ axis: this,
273
+ event,
274
+ min: event?.min,
275
+ max: event?.max,
276
+ trigger: event?.trigger,
277
+ isX: this?.isXAxis,
278
+ });
279
+ },
280
+ pointBreak(event) {
281
+ fire(axisContainer(this), E.axisPointBreak, { axis: this, event, point: event?.point, brk: event?.brk });
282
+ },
283
+ pointInBreak(event) {
284
+ fire(axisContainer(this), E.axisPointInBreak, { axis: this, event, point: event?.point, brk: event?.brk });
285
+ },
286
+ afterBreaks() {
287
+ fire(axisContainer(this), E.axisAfterBreaks, { axis: this });
288
+ },
289
+ };
290
+ }
291
+ //# sourceMappingURL=chart-events.js.map
@@ -0,0 +1,41 @@
1
+ import type Highcharts from 'highcharts';
2
+ /** Result of reading axis extremes — mirrors Highcharts' ExtremesObject. */
3
+ export interface ChartExtremes {
4
+ /** The user-set (zoomed/panned) minimum, or the data minimum when not set. */
5
+ min: number;
6
+ /** The user-set (zoomed/panned) maximum, or the data maximum when not set. */
7
+ max: number;
8
+ /** The lowest value in the data. */
9
+ dataMin: number;
10
+ /** The highest value in the data. */
11
+ dataMax: number;
12
+ }
13
+ /** Options for {@link setAxisExtremes} / `nile-chart`.`setExtremes`. */
14
+ export interface SetExtremesOptions {
15
+ /** Axis index (default 0). */
16
+ axis?: number;
17
+ /** Which axis collection to target (default `'x'`). */
18
+ dimension?: 'x' | 'y';
19
+ /** Redraw the chart after setting (default true). */
20
+ redraw?: boolean;
21
+ /** Highcharts animation options (default: Highcharts' own default). */
22
+ animation?: boolean | Partial<Highcharts.AnimationOptionsObject>;
23
+ }
24
+ /** Projected bounds for a map view — `{ x1, y1, x2, y2 }` in projected units. */
25
+ export interface MapBounds {
26
+ x1: number;
27
+ y1: number;
28
+ x2: number;
29
+ y2: number;
30
+ }
31
+ /**
32
+ * Read the current extremes of an axis. Returns `null` when the chart isn't
33
+ * ready or the target axis doesn't exist (e.g. pie/gauge/map have no xAxis).
34
+ */
35
+ export declare function getAxisExtremes(chart: Highcharts.Chart | null | undefined, axis?: number, dimension?: 'x' | 'y'): ChartExtremes | null;
36
+ /**
37
+ * Set the extremes (zoom/pan range) of an axis. Silent no-op when the chart
38
+ * isn't ready or the target axis doesn't exist, so it's safe to call on any
39
+ * chart type. Pass `null` for `min`/`max` to reset that bound to the data edge.
40
+ */
41
+ export declare function setAxisExtremes(chart: Highcharts.Chart | null | undefined, min: number | null, max: number | null, opts?: SetExtremesOptions): void;
@@ -0,0 +1,30 @@
1
+ function pickAxis(chart, axis, dimension) {
2
+ if (!chart)
3
+ return undefined;
4
+ const axes = dimension === 'y' ? chart.yAxis : chart.xAxis;
5
+ return axes?.[axis];
6
+ }
7
+ /**
8
+ * Read the current extremes of an axis. Returns `null` when the chart isn't
9
+ * ready or the target axis doesn't exist (e.g. pie/gauge/map have no xAxis).
10
+ */
11
+ export function getAxisExtremes(chart, axis = 0, dimension = 'x') {
12
+ const target = pickAxis(chart, axis, dimension);
13
+ if (!target || typeof target.getExtremes !== 'function')
14
+ return null;
15
+ const e = target.getExtremes();
16
+ return { min: e.min, max: e.max, dataMin: e.dataMin, dataMax: e.dataMax };
17
+ }
18
+ /**
19
+ * Set the extremes (zoom/pan range) of an axis. Silent no-op when the chart
20
+ * isn't ready or the target axis doesn't exist, so it's safe to call on any
21
+ * chart type. Pass `null` for `min`/`max` to reset that bound to the data edge.
22
+ */
23
+ export function setAxisExtremes(chart, min, max, opts = {}) {
24
+ const { axis = 0, dimension = 'x', redraw = true, animation } = opts;
25
+ const target = pickAxis(chart, axis, dimension);
26
+ if (!target || typeof target.setExtremes !== 'function')
27
+ return;
28
+ target.setExtremes(min ?? undefined, max ?? undefined, redraw, animation);
29
+ }
30
+ //# sourceMappingURL=chart-runtime.js.map
@@ -5,6 +5,7 @@
5
5
  * - CDN users: the dynamic import fails (bare specifier), falls back to `window.Highcharts`.
6
6
  * Consumer must load Highcharts via `<script>` before nile-visualization.
7
7
  */
8
+ import { registerNileChartEvents } from './chart-events.js';
8
9
  let _Highcharts;
9
10
  let _initPromise = null;
10
11
  async function init() {
@@ -193,6 +194,7 @@ async function init() {
193
194
  },
194
195
  },
195
196
  });
197
+ registerNileChartEvents(_Highcharts);
196
198
  return _Highcharts;
197
199
  }
198
200
  /**
@@ -0,0 +1,43 @@
1
+ import type Highcharts from 'highcharts';
2
+ import NileElement from './nile-element.js';
3
+ import { type ChartExtremes, type SetExtremesOptions } from './chart-runtime.js';
4
+ /**
5
+ * Shared base for the individual chart components. Extends {@link NileElement}
6
+ * (so `emit()` and its defaults are unchanged) and adds a small, additive
7
+ * runtime surface every chart can inherit:
8
+ *
9
+ * - `chart` getter — the live `Highcharts.Chart`, or `null` until ready.
10
+ * - `whenReady()` — a promise that resolves once the chart exists.
11
+ * - `getExtremes()` / `setExtremes()` — axis range read/write for cross-panel sync.
12
+ *
13
+ * Subclasses assign `this._chart` where they used to assign their private
14
+ * `chart` field, call `this._notifyChartReady()` right after, and
15
+ * `this._clearChart()` when destroying. Nothing else about their lifecycle
16
+ * changes.
17
+ */
18
+ export default class NileChartBase extends NileElement {
19
+ /** The underlying Highcharts instance. Managed by subclasses via the hooks below. */
20
+ protected _chart: Highcharts.Chart | null;
21
+ private _readyResolvers;
22
+ /** The underlying `Highcharts.Chart` instance, or `null` until the chart is ready. */
23
+ get chart(): Highcharts.Chart | null;
24
+ /**
25
+ * Resolves with the `Highcharts.Chart` instance. Resolves immediately if the
26
+ * chart already exists, otherwise on the next time it becomes ready.
27
+ */
28
+ whenReady(): Promise<Highcharts.Chart>;
29
+ /** Subclasses call this right after assigning `this._chart`. */
30
+ protected _notifyChartReady(): void;
31
+ /** Subclasses call this after destroying the chart, so stale instances aren't handed out. */
32
+ protected _clearChart(): void;
33
+ /**
34
+ * Read the current extremes of an axis (default: primary x-axis). Returns
35
+ * `null` when the chart isn't ready or the axis doesn't exist.
36
+ */
37
+ getExtremes(axis?: number, dimension?: 'x' | 'y'): ChartExtremes | null;
38
+ /**
39
+ * Set the extremes (zoom/pan range) of an axis. Safe no-op if the chart isn't
40
+ * ready or the axis doesn't exist. Pass `null` to reset a bound to the data edge.
41
+ */
42
+ setExtremes(min: number | null, max: number | null, opts?: SetExtremesOptions): void;
43
+ }
@@ -0,0 +1,67 @@
1
+ import NileElement from './nile-element.js';
2
+ import { getAxisExtremes, setAxisExtremes, } from './chart-runtime.js';
3
+ /**
4
+ * Shared base for the individual chart components. Extends {@link NileElement}
5
+ * (so `emit()` and its defaults are unchanged) and adds a small, additive
6
+ * runtime surface every chart can inherit:
7
+ *
8
+ * - `chart` getter — the live `Highcharts.Chart`, or `null` until ready.
9
+ * - `whenReady()` — a promise that resolves once the chart exists.
10
+ * - `getExtremes()` / `setExtremes()` — axis range read/write for cross-panel sync.
11
+ *
12
+ * Subclasses assign `this._chart` where they used to assign their private
13
+ * `chart` field, call `this._notifyChartReady()` right after, and
14
+ * `this._clearChart()` when destroying. Nothing else about their lifecycle
15
+ * changes.
16
+ */
17
+ export default class NileChartBase extends NileElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ /** The underlying Highcharts instance. Managed by subclasses via the hooks below. */
21
+ this._chart = null;
22
+ this._readyResolvers = [];
23
+ }
24
+ /** The underlying `Highcharts.Chart` instance, or `null` until the chart is ready. */
25
+ get chart() {
26
+ return this._chart;
27
+ }
28
+ /**
29
+ * Resolves with the `Highcharts.Chart` instance. Resolves immediately if the
30
+ * chart already exists, otherwise on the next time it becomes ready.
31
+ */
32
+ whenReady() {
33
+ if (this._chart)
34
+ return Promise.resolve(this._chart);
35
+ return new Promise((resolve) => {
36
+ this._readyResolvers.push(resolve);
37
+ });
38
+ }
39
+ /** Subclasses call this right after assigning `this._chart`. */
40
+ _notifyChartReady() {
41
+ const chart = this._chart;
42
+ if (!chart)
43
+ return;
44
+ const resolvers = this._readyResolvers;
45
+ this._readyResolvers = [];
46
+ resolvers.forEach((resolve) => resolve(chart));
47
+ }
48
+ /** Subclasses call this after destroying the chart, so stale instances aren't handed out. */
49
+ _clearChart() {
50
+ this._chart = null;
51
+ }
52
+ /**
53
+ * Read the current extremes of an axis (default: primary x-axis). Returns
54
+ * `null` when the chart isn't ready or the axis doesn't exist.
55
+ */
56
+ getExtremes(axis = 0, dimension = 'x') {
57
+ return getAxisExtremes(this._chart, axis, dimension);
58
+ }
59
+ /**
60
+ * Set the extremes (zoom/pan range) of an axis. Safe no-op if the chart isn't
61
+ * ready or the axis doesn't exist. Pass `null` to reset a bound to the data edge.
62
+ */
63
+ setExtremes(min, max, opts = {}) {
64
+ setAxisExtremes(this._chart, min, max, opts);
65
+ }
66
+ }
67
+ //# sourceMappingURL=nile-chart-base.js.map
@@ -0,0 +1,10 @@
1
+ import type { NileWidgetConfig } from './types/widget-config.type.js';
2
+ /**
3
+ * Resolves whether a widget renders as a chart or a KPI tile.
4
+ *
5
+ * Uses the explicit `type` discriminator when present (back-compat); otherwise
6
+ * infers it from the widget's `nileConfig.chart.type` — `'kpi'` yields a KPI
7
+ * tile, anything else (bar, pie, line, …) yields a chart. This lets hosts omit
8
+ * the redundant top-level `type` and let the chart config drive the kind.
9
+ */
10
+ export declare function resolveWidgetKind(config: NileWidgetConfig): 'chart' | 'kpi';
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Resolves whether a widget renders as a chart or a KPI tile.
3
+ *
4
+ * Uses the explicit `type` discriminator when present (back-compat); otherwise
5
+ * infers it from the widget's `nileConfig.chart.type` — `'kpi'` yields a KPI
6
+ * tile, anything else (bar, pie, line, …) yields a chart. This lets hosts omit
7
+ * the redundant top-level `type` and let the chart config drive the kind.
8
+ */
9
+ export function resolveWidgetKind(config) {
10
+ if (config.type)
11
+ return config.type;
12
+ const chartType = config.nileConfig?.chart
13
+ ?.type;
14
+ return chartType === 'kpi' ? 'kpi' : 'chart';
15
+ }
16
+ //# sourceMappingURL=resolve-widget-kind.js.map