@aquera/nile-visualization 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/src/index.d.ts +8 -2
  2. package/dist/src/index.js +3 -0
  3. package/dist/src/internal/dashboard-adapters.d.ts +13 -0
  4. package/dist/src/internal/dashboard-adapters.js +123 -0
  5. package/dist/src/internal/highcharts-provider.js +27 -0
  6. package/dist/src/internal/types/chart-config.type.d.ts +2 -1
  7. package/dist/src/internal/types/chart-map-config.type.d.ts +29 -0
  8. package/dist/src/internal/types/chart-map-config.type.js +2 -0
  9. package/dist/src/internal/types/dashboard-config.type.d.ts +8 -0
  10. package/dist/src/internal/types/dashboard-config.type.js +2 -0
  11. package/dist/src/internal/types/index.d.ts +1 -0
  12. package/dist/src/internal/types/nile-chart-config-input.type.d.ts +6 -2
  13. package/dist/src/internal/types/widget-config.type.d.ts +23 -0
  14. package/dist/src/internal/types/widget-config.type.js +2 -0
  15. package/dist/src/internal/types/widget-layout.type.d.ts +11 -0
  16. package/dist/src/internal/types/widget-layout.type.js +2 -0
  17. package/dist/src/nile-chart/index.d.ts +2 -2
  18. package/dist/src/nile-chart/nile-chart-config-builder.js +2 -1
  19. package/dist/src/nile-chart/nile-chart-config.d.ts +119 -30
  20. package/dist/src/nile-chart/nile-chart.css.js +20 -6
  21. package/dist/src/nile-chart/nile-chart.d.ts +11 -0
  22. package/dist/src/nile-chart/nile-chart.js +39 -2
  23. package/dist/src/nile-dashboard-viewer/index.d.ts +2 -0
  24. package/dist/src/nile-dashboard-viewer/index.js +2 -0
  25. package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.css.d.ts +1 -0
  26. package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.css.js +29 -0
  27. package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.d.ts +43 -0
  28. package/dist/src/nile-dashboard-viewer/nile-dashboard-viewer.js +84 -0
  29. package/dist/src/nile-kpi-chart/nile-kpi-chart.css.js +19 -11
  30. package/dist/src/nile-kpi-chart/nile-kpi-chart.d.ts +8 -2
  31. package/dist/src/nile-kpi-chart/nile-kpi-chart.js +43 -9
  32. package/dist/src/nile-map-chart/index.d.ts +2 -0
  33. package/dist/src/nile-map-chart/index.js +2 -0
  34. package/dist/src/nile-map-chart/nile-map-chart.css.d.ts +1 -0
  35. package/dist/src/nile-map-chart/nile-map-chart.css.js +28 -0
  36. package/dist/src/nile-map-chart/nile-map-chart.d.ts +74 -0
  37. package/dist/src/nile-map-chart/nile-map-chart.js +263 -0
  38. package/dist/src/nile-widget-viewer/index.d.ts +3 -0
  39. package/dist/src/nile-widget-viewer/index.js +2 -0
  40. package/dist/src/nile-widget-viewer/nile-widget-viewer.css.d.ts +1 -0
  41. package/dist/src/nile-widget-viewer/nile-widget-viewer.css.js +20 -0
  42. package/dist/src/nile-widget-viewer/nile-widget-viewer.d.ts +33 -0
  43. package/dist/src/nile-widget-viewer/nile-widget-viewer.js +50 -0
  44. package/package.json +4 -2
@@ -7,10 +7,10 @@ export type { TrendlineSeriesData, ForecastConfig } from './nile-trendline-chart
7
7
  export { NileAnomalyChart } from './nile-anomaly-chart/index.js';
8
8
  export type { AnomalySeriesData, AnomalyConfig } from './nile-anomaly-chart/index.js';
9
9
  export { NileChart } from './nile-chart/index.js';
10
- export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, NileLineChartConfig, NileAreaChartConfig, NileColumnChartConfig, NileDonutChartConfig, NileScatterChartConfig, NileBubbleChartConfig, NileSplineChartConfig, NileRadarChartConfig, NileGaugeChartConfig, NileWaterfallChartConfig, NileKpiChartConfig, ChartType, SwitchAggregation, NileAiConfig, } from './nile-chart/index.js';
10
+ export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, NileLineChartConfig, NileAreaChartConfig, NileColumnChartConfig, NileDonutChartConfig, NileScatterChartConfig, NileBubbleChartConfig, NileSplineChartConfig, NileRadarChartConfig, NileGaugeChartConfig, NileWaterfallChartConfig, NileMapChartConfig, NileKpiChartConfig, ChartType, SwitchAggregation, NileAiConfig, } from './nile-chart/index.js';
11
11
  export { convertConfig, registerAdapter } from './nile-chart/index.js';
12
12
  export { nileChartConfig } from './nile-chart/index.js';
13
- export type { AiConfigType, SwitchableConfigType, AqConfigType, ChartBarConfigType, ChartPieConfigType, ChartTrendlineConfigType, ChartAnomalyConfigType, ChartLineConfigType, ChartAreaConfigType, ChartInvertedAreaConfigType, ChartColumnConfigType, ChartDonutConfigType, ChartScatterConfigType, ChartBubbleConfigType, ChartSplineConfigType, ChartRadarConfigType, ChartGaugeConfigType, ChartWaterfallConfigType, ChartClusterConfigType, ChartStackedConfigType, ChartHistogramConfigType, ChartBellcurveConfigType, ChartBoxplotConfigType, ChartTimelineConfigType, ChartDumbbellConfigType, ChartDumbbellLowerConfigType, ChartDumbbellUpperConfigType, ChartColumnPyramidConfigType, ChartLollipopConfigType, ChartAreaSplineConfigType, ChartAreaNegativeConfigType, ChartAreaRangeConfigType, ChartColumnRangeConfigType, ChartColumnDrilldownConfigType, ChartRadialBarConfigType, ChartVariablePieConfigType, ChartEulerConfigType, ChartPolygonConfigType, ChartVectorConfigType, ChartXrangeConfigType, ChartFanConfigType, ChartFunnelConfigType, ChartOrganizationConfigType, ChartLineColumnConfigType, ChartHeatmapConfigType, ChartFlameConfigType, ChartSpiderwebConfigType, ChartKpiConfigType, ChartKpiPropsType, PrimitiveChartConfigType, SeparatedChartConfigInputType, AllChartConfigType, ChartConfigType, NileChartConfigInputType, ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from './nile-chart/index.js';
13
+ export type { AiConfigType, SwitchableConfigType, AqConfigType, ChartBarConfigType, ChartPieConfigType, ChartTrendlineConfigType, ChartAnomalyConfigType, ChartLineConfigType, ChartAreaConfigType, ChartInvertedAreaConfigType, ChartColumnConfigType, ChartDonutConfigType, ChartScatterConfigType, ChartBubbleConfigType, ChartSplineConfigType, ChartRadarConfigType, ChartGaugeConfigType, ChartWaterfallConfigType, ChartClusterConfigType, ChartStackedConfigType, ChartHistogramConfigType, ChartBellcurveConfigType, ChartBoxplotConfigType, ChartTimelineConfigType, ChartDumbbellConfigType, ChartDumbbellLowerConfigType, ChartDumbbellUpperConfigType, ChartColumnPyramidConfigType, ChartLollipopConfigType, ChartAreaSplineConfigType, ChartAreaNegativeConfigType, ChartAreaRangeConfigType, ChartColumnRangeConfigType, ChartColumnDrilldownConfigType, ChartRadialBarConfigType, ChartVariablePieConfigType, ChartEulerConfigType, ChartPolygonConfigType, ChartVectorConfigType, ChartXrangeConfigType, ChartFanConfigType, ChartFunnelConfigType, ChartOrganizationConfigType, ChartLineColumnConfigType, ChartHeatmapConfigType, ChartFlameConfigType, ChartSpiderwebConfigType, ChartKpiConfigType, ChartKpiPropsType, ChartMapConfigType, PrimitiveChartConfigType, SeparatedChartConfigInputType, AllChartConfigType, ChartConfigType, NileChartConfigInputType, ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from './nile-chart/index.js';
14
14
  export type { SeparatedChartDemoConfig } from './internal/separated-chart-config.js';
15
15
  export { NileLineChart } from './nile-line-chart/index.js';
16
16
  export type { LineChartSeriesData } from './nile-line-chart/index.js';
@@ -92,5 +92,11 @@ export { NileSpiderwebChart } from './nile-spiderweb-chart/index.js';
92
92
  export type { SpiderwebChartSeriesData } from './nile-spiderweb-chart/index.js';
93
93
  export { NileKpiChart } from './nile-kpi-chart/index.js';
94
94
  export type { ChartKpiSeparatedPayload, KpiConfig, NileKpiConfigInputType, TrendDirection, KpiVariant, } from './nile-kpi-chart/index.js';
95
+ export { NileMapChart } from './nile-map-chart/index.js';
96
+ export type { MapChartDataPoint } from './nile-map-chart/index.js';
95
97
  export { NileAiSender } from './nile-ai-sender/index.js';
96
98
  export { NileAiPanel } from './nile-ai-panel/index.js';
99
+ export { NileWidgetViewer } from './nile-widget-viewer/index.js';
100
+ export type { NileWidgetConfig, NileWidgetChartConfig, NileWidgetKpiConfig, WidgetLayout, } from './nile-widget-viewer/index.js';
101
+ export { NileDashboardViewer } from './nile-dashboard-viewer/index.js';
102
+ export type { NileDashboardConfig } from './nile-dashboard-viewer/index.js';
package/dist/src/index.js CHANGED
@@ -49,6 +49,9 @@ export { NileHeatmapChart } from './nile-heatmap-chart/index.js';
49
49
  export { NileFlameChart } from './nile-flame-chart/index.js';
50
50
  export { NileSpiderwebChart } from './nile-spiderweb-chart/index.js';
51
51
  export { NileKpiChart } from './nile-kpi-chart/index.js';
52
+ export { NileMapChart } from './nile-map-chart/index.js';
52
53
  export { NileAiSender } from './nile-ai-sender/index.js';
53
54
  export { NileAiPanel } from './nile-ai-panel/index.js';
55
+ export { NileWidgetViewer } from './nile-widget-viewer/index.js';
56
+ export { NileDashboardViewer } from './nile-dashboard-viewer/index.js';
54
57
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,13 @@
1
+ import type { NileDashboardConfig } from './types/dashboard-config.type.js';
2
+ /**
3
+ * Converts a raw API dashboard response into a `NileDashboardConfig` ready for
4
+ * `<nile-dashboard-viewer>`.
5
+ *
6
+ * Handles:
7
+ * - `widgetType` → `type` rename
8
+ * - API chart `series[].data[].value` → `data[].y` (pie/donut)
9
+ * - Multi-series format for bar/line/column/area etc.
10
+ * - KPI sub-object: adds the `type: 'kpi'` discriminator
11
+ * - Nested `{ success, data: { ... } }` API envelope
12
+ */
13
+ export declare function fromApiDashboardResponse(apiResponse: unknown): NileDashboardConfig;
@@ -0,0 +1,123 @@
1
+ // ─── Pie / donut series adapter ─────────────────────────────────────────────
2
+ function adaptPieSeries(series) {
3
+ const first = series[0];
4
+ const data = (first?.data ?? []).map((point) => {
5
+ if (typeof point === 'number')
6
+ return { name: '', y: point };
7
+ return {
8
+ name: point.name ?? '',
9
+ y: point.value ?? point.y ?? 0,
10
+ };
11
+ });
12
+ return { data, seriesName: first?.name };
13
+ }
14
+ // ─── Multi-series adapter (bar, line, column, area, etc.) ───────────────────
15
+ function adaptMultiSeries(series) {
16
+ return series.map((s) => ({
17
+ name: s.name ?? '',
18
+ data: (s.data ?? []).map((point) => {
19
+ if (typeof point === 'number')
20
+ return point;
21
+ return point.value ?? point.y ?? 0;
22
+ }),
23
+ }));
24
+ }
25
+ // ─── Chart widget adapter ────────────────────────────────────────────────────
26
+ function adaptChartWidget(apiChart) {
27
+ const { type = 'bar', title, series = [], ...rest } = apiChart;
28
+ const aq = title ? { chartTitle: title } : undefined;
29
+ switch (type) {
30
+ case 'pie':
31
+ case 'donut': {
32
+ const { data, seriesName } = adaptPieSeries(series);
33
+ return { chart: { type: type, data, seriesName, ...rest }, aq };
34
+ }
35
+ default: {
36
+ // bar, line, column, area, spline, stacked, cluster, etc.
37
+ const data = adaptMultiSeries(series);
38
+ return { chart: { type: type, data, ...rest }, aq };
39
+ }
40
+ }
41
+ }
42
+ // ─── KPI widget adapter ──────────────────────────────────────────────────────
43
+ function adaptKpiWidget(apiKpi) {
44
+ return {
45
+ chart: {
46
+ type: 'kpi',
47
+ variant: apiKpi.variant,
48
+ label: apiKpi.label,
49
+ value: apiKpi.value,
50
+ prefix: apiKpi.prefix,
51
+ suffix: apiKpi.suffix,
52
+ trendValue: apiKpi.trendValue ?? null,
53
+ trendDirection: apiKpi.trendDirection,
54
+ trendLabel: apiKpi.trendLabel,
55
+ description: apiKpi.description,
56
+ sparkline: apiKpi.sparkline,
57
+ gaugeValue: apiKpi.gaugeValue,
58
+ gaugeMin: apiKpi.gaugeMin,
59
+ gaugeMax: apiKpi.gaugeMax,
60
+ },
61
+ };
62
+ }
63
+ // ─── Widget adapter ──────────────────────────────────────────────────────────
64
+ function adaptWidget(apiWidget) {
65
+ const layout = apiWidget.layout ?? { x: 0, y: 0, w: 6, h: 4 };
66
+ const widgetType = apiWidget.widgetType ?? apiWidget.type;
67
+ // Already in NileWidgetConfig shape — pass through
68
+ if (apiWidget.nileConfig) {
69
+ return {
70
+ id: apiWidget.id,
71
+ title: apiWidget.title,
72
+ type: widgetType,
73
+ layout,
74
+ nileConfig: apiWidget.nileConfig,
75
+ };
76
+ }
77
+ if (widgetType === 'chart' && apiWidget.chart) {
78
+ return {
79
+ id: apiWidget.id,
80
+ title: apiWidget.title,
81
+ type: 'chart',
82
+ layout,
83
+ nileConfig: adaptChartWidget(apiWidget.chart),
84
+ };
85
+ }
86
+ if (widgetType === 'kpi' && apiWidget.kpi) {
87
+ return {
88
+ id: apiWidget.id,
89
+ title: apiWidget.title,
90
+ type: 'kpi',
91
+ layout,
92
+ nileConfig: adaptKpiWidget(apiWidget.kpi),
93
+ };
94
+ }
95
+ return null;
96
+ }
97
+ // ─── Public API ──────────────────────────────────────────────────────────────
98
+ /**
99
+ * Converts a raw API dashboard response into a `NileDashboardConfig` ready for
100
+ * `<nile-dashboard-viewer>`.
101
+ *
102
+ * Handles:
103
+ * - `widgetType` → `type` rename
104
+ * - API chart `series[].data[].value` → `data[].y` (pie/donut)
105
+ * - Multi-series format for bar/line/column/area etc.
106
+ * - KPI sub-object: adds the `type: 'kpi'` discriminator
107
+ * - Nested `{ success, data: { ... } }` API envelope
108
+ */
109
+ export function fromApiDashboardResponse(apiResponse) {
110
+ const raw = apiResponse;
111
+ // Unwrap common `{ success, data: { ... } }` envelope
112
+ const payload = raw?.data ?? raw;
113
+ const widgets = (payload?.widgets ?? [])
114
+ .map(adaptWidget)
115
+ .filter((w) => w !== null);
116
+ return {
117
+ id: payload?.id,
118
+ name: payload?.name,
119
+ description: payload?.description,
120
+ widgets,
121
+ };
122
+ }
123
+ //# sourceMappingURL=dashboard-adapters.js.map
@@ -122,6 +122,33 @@ async function init() {
122
122
  catch {
123
123
  // xrange not available — consumer may have loaded it globally
124
124
  }
125
+ try {
126
+ const map = await import('highcharts/modules/map.js');
127
+ if (typeof map.default === 'function') {
128
+ map.default(_Highcharts);
129
+ }
130
+ }
131
+ catch {
132
+ // highcharts/modules/map not available — consumer may have loaded it globally
133
+ }
134
+ try {
135
+ const patternFill = await import('highcharts/modules/pattern-fill.js');
136
+ if (typeof patternFill.default === 'function') {
137
+ patternFill.default(_Highcharts);
138
+ }
139
+ }
140
+ catch {
141
+ // pattern-fill not available — consumer may have loaded it globally
142
+ }
143
+ try {
144
+ const tiledwebmap = await import('highcharts/modules/tiledwebmap.js');
145
+ if (typeof tiledwebmap.default === 'function') {
146
+ tiledwebmap.default(_Highcharts);
147
+ }
148
+ }
149
+ catch {
150
+ // tiledwebmap not available — consumer may have loaded it globally
151
+ }
125
152
  try {
126
153
  const sankey = await import('highcharts/modules/sankey.js');
127
154
  if (typeof sankey.default === 'function') {
@@ -12,6 +12,7 @@ import type { ChartSplineConfigType } from './chart-spline-config.type.js';
12
12
  import type { ChartRadarConfigType } from './chart-radar-config.type.js';
13
13
  import type { ChartGaugeConfigType } from './chart-gauge-config.type.js';
14
14
  import type { ChartWaterfallConfigType } from './chart-waterfall-config.type.js';
15
+ import type { ChartMapConfigType } from './chart-map-config.type.js';
15
16
  import type { PrimitiveChartConfigType } from './primitive-chart-config.type.js';
16
17
  /** Core chart configs (bar, pie, …) plus all primitive series types — use with `<nile-chart>` via `chart.type`. */
17
- export type ChartConfigType = ChartBarConfigType | ChartPieConfigType | ChartTrendlineConfigType | ChartAnomalyConfigType | ChartLineConfigType | ChartAreaConfigType | ChartColumnConfigType | ChartDonutConfigType | ChartScatterConfigType | ChartBubbleConfigType | ChartSplineConfigType | ChartRadarConfigType | ChartGaugeConfigType | ChartWaterfallConfigType | PrimitiveChartConfigType;
18
+ export type ChartConfigType = ChartBarConfigType | ChartPieConfigType | ChartTrendlineConfigType | ChartAnomalyConfigType | ChartLineConfigType | ChartAreaConfigType | ChartColumnConfigType | ChartDonutConfigType | ChartScatterConfigType | ChartBubbleConfigType | ChartSplineConfigType | ChartRadarConfigType | ChartGaugeConfigType | ChartWaterfallConfigType | ChartMapConfigType | PrimitiveChartConfigType;
@@ -0,0 +1,29 @@
1
+ import type { Options } from 'highcharts';
2
+ import type { MapChartDataPoint } from '../../nile-map-chart/nile-map-chart.js';
3
+ /** Highcharts Maps chart config. */
4
+ export interface ChartMapConfigType {
5
+ type: 'map';
6
+ /** Array of data points joined against the map topology. */
7
+ data: MapChartDataPoint[];
8
+ /**
9
+ * GeoJSON or Highcharts topology object for the map shapes.
10
+ * Obtain from https://code.highcharts.com/mapdata/ or supply your own.
11
+ */
12
+ mapData?: object;
13
+ /**
14
+ * How to join data against mapData. Defaults to `['hc-key', 'hc-key']`.
15
+ * Pass a string to use the same key on both sides,
16
+ * or a two-element array `[mapKey, dataKey]` for different key names.
17
+ */
18
+ joinBy?: string | string[];
19
+ /**
20
+ * Type of the primary series. Default: `'map'`.
21
+ * For multi-series or `tiledwebmap`, pass `options.series` directly.
22
+ */
23
+ seriesType?: 'map' | 'mapline' | 'mappoint' | 'mapbubble' | 'tiledwebmap';
24
+ /** Enable mouse-wheel zoom, double-click zoom, and +/− buttons. Default: true. */
25
+ zoom?: boolean;
26
+ height?: string;
27
+ loading?: boolean;
28
+ options?: Options;
29
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chart-map-config.type.js.map
@@ -0,0 +1,8 @@
1
+ import type { NileWidgetConfig } from './widget-config.type.js';
2
+ /** Full dashboard configuration passed to `<nile-dashboard-viewer>`. */
3
+ export interface NileDashboardConfig {
4
+ id?: string;
5
+ name?: string;
6
+ description?: string;
7
+ widgets: NileWidgetConfig[];
8
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=dashboard-config.type.js.map
@@ -45,6 +45,7 @@ export type { ChartHeatmapConfigType } from './chart-heatmap-config.type.js';
45
45
  export type { ChartFlameConfigType } from './chart-flame-config.type.js';
46
46
  export type { ChartSpiderwebConfigType } from './chart-spiderweb-config.type.js';
47
47
  export type { ChartKpiConfigType, ChartKpiPropsType } from './chart-kpi-config.type.js';
48
+ export type { ChartMapConfigType } from './chart-map-config.type.js';
48
49
  export type { PrimitiveChartConfigType } from './primitive-chart-config.type.js';
49
50
  export type { SeparatedChartConfigInputType } from './separated-chart-config-input.type.js';
50
51
  export type { AllChartConfigType } from './all-chart-config.type.js';
@@ -1,7 +1,11 @@
1
1
  import type { ChartConfigType } from './chart-config.type.js';
2
2
  import type { AqConfigType } from './aq-config.type.js';
3
- /** Input to nileChartConfig(). Discriminated on chart.type. */
4
- export interface NileChartConfigInputType {
3
+ import type { NileChartConfigBase } from '../../nile-chart/nile-chart-config.js';
4
+ /**
5
+ * Input to nileChartConfig(). Discriminated on chart.type.
6
+ * Card-level fields may sit on chart, in aq, or on the root (merged: root, then chart, then aq).
7
+ */
8
+ export interface NileChartConfigInputType extends Partial<NileChartConfigBase> {
5
9
  chart: ChartConfigType;
6
10
  aq?: AqConfigType;
7
11
  }
@@ -0,0 +1,23 @@
1
+ import type { NileChartConfigInputType } from './nile-chart-config-input.type.js';
2
+ import type { NileKpiConfigInputType } from '../../nile-kpi-chart/nile-kpi-chart.js';
3
+ import type { WidgetLayout } from './widget-layout.type.js';
4
+ /** Widget containing a chart (any ChartConfigType — bar, pie, line, etc.). */
5
+ export interface NileWidgetChartConfig {
6
+ id?: string;
7
+ title?: string;
8
+ type: 'chart';
9
+ layout: WidgetLayout;
10
+ /** Full nile chart config: `{ chart: ChartConfigType, aq?: AqConfigType }`. */
11
+ nileConfig: NileChartConfigInputType;
12
+ }
13
+ /** Widget containing a KPI tile. */
14
+ export interface NileWidgetKpiConfig {
15
+ id?: string;
16
+ title?: string;
17
+ type: 'kpi';
18
+ layout: WidgetLayout;
19
+ /** Full nile KPI config: `{ chart: ChartKpiSeparatedPayload, aq?: AqConfigType }`. */
20
+ nileConfig: NileKpiConfigInputType;
21
+ }
22
+ /** Discriminated union for all widget types. Discriminator: `type`. */
23
+ export type NileWidgetConfig = NileWidgetChartConfig | NileWidgetKpiConfig;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=widget-config.type.js.map
@@ -0,0 +1,11 @@
1
+ /** Grid position and size for a dashboard widget. */
2
+ export interface WidgetLayout {
3
+ /** Column start (0-based). */
4
+ x: number;
5
+ /** Row start (0-based). */
6
+ y: number;
7
+ /** Number of columns the widget spans. */
8
+ w: number;
9
+ /** Number of rows the widget spans. */
10
+ h: number;
11
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=widget-layout.type.js.map
@@ -1,5 +1,5 @@
1
1
  export { NileChart } from './nile-chart.js';
2
- export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, NileLineChartConfig, NileAreaChartConfig, NileColumnChartConfig, NileDonutChartConfig, NileScatterChartConfig, NileBubbleChartConfig, NileSplineChartConfig, NileRadarChartConfig, NileGaugeChartConfig, NileWaterfallChartConfig, NileKpiChartConfig, ChartType, SwitchAggregation, NileAiConfig, } from './nile-chart-config.js';
2
+ export type { NileChartConfig, NileBarChartConfig, NilePieChartConfig, NileTrendlineChartConfig, NileAnomalyChartConfig, NileLineChartConfig, NileAreaChartConfig, NileColumnChartConfig, NileDonutChartConfig, NileScatterChartConfig, NileBubbleChartConfig, NileSplineChartConfig, NileRadarChartConfig, NileGaugeChartConfig, NileWaterfallChartConfig, NileKpiChartConfig, NileMapChartConfig, ChartType, SwitchAggregation, NileAiConfig, } from './nile-chart-config.js';
3
3
  export { convertConfig, registerAdapter } from '../internal/chart-adapters.js';
4
4
  export { nileChartConfig } from './nile-chart-config-builder.js';
5
- export type { AiConfigType, SwitchableConfigType, AqConfigType, ChartBarConfigType, ChartPieConfigType, ChartTrendlineConfigType, ChartAnomalyConfigType, ChartLineConfigType, ChartAreaConfigType, ChartInvertedAreaConfigType, ChartColumnConfigType, ChartDonutConfigType, ChartScatterConfigType, ChartBubbleConfigType, ChartSplineConfigType, ChartRadarConfigType, ChartGaugeConfigType, ChartWaterfallConfigType, ChartClusterConfigType, ChartStackedConfigType, ChartHistogramConfigType, ChartBellcurveConfigType, ChartBoxplotConfigType, ChartTimelineConfigType, ChartDumbbellConfigType, ChartDumbbellLowerConfigType, ChartDumbbellUpperConfigType, ChartColumnPyramidConfigType, ChartLollipopConfigType, ChartAreaSplineConfigType, ChartAreaNegativeConfigType, ChartAreaRangeConfigType, ChartColumnRangeConfigType, ChartColumnDrilldownConfigType, ChartRadialBarConfigType, ChartVariablePieConfigType, ChartEulerConfigType, ChartPolygonConfigType, ChartVectorConfigType, ChartXrangeConfigType, ChartFanConfigType, ChartFunnelConfigType, ChartOrganizationConfigType, ChartLineColumnConfigType, ChartHeatmapConfigType, ChartFlameConfigType, ChartSpiderwebConfigType, ChartKpiConfigType, ChartKpiPropsType, PrimitiveChartConfigType, SeparatedChartConfigInputType, AllChartConfigType, ChartConfigType, NileChartConfigInputType, ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from '../internal/types/index.js';
5
+ export type { AiConfigType, SwitchableConfigType, AqConfigType, ChartBarConfigType, ChartPieConfigType, ChartTrendlineConfigType, ChartAnomalyConfigType, ChartLineConfigType, ChartAreaConfigType, ChartInvertedAreaConfigType, ChartColumnConfigType, ChartDonutConfigType, ChartScatterConfigType, ChartBubbleConfigType, ChartSplineConfigType, ChartRadarConfigType, ChartGaugeConfigType, ChartWaterfallConfigType, ChartClusterConfigType, ChartStackedConfigType, ChartHistogramConfigType, ChartBellcurveConfigType, ChartBoxplotConfigType, ChartTimelineConfigType, ChartDumbbellConfigType, ChartDumbbellLowerConfigType, ChartDumbbellUpperConfigType, ChartColumnPyramidConfigType, ChartLollipopConfigType, ChartAreaSplineConfigType, ChartAreaNegativeConfigType, ChartAreaRangeConfigType, ChartColumnRangeConfigType, ChartColumnDrilldownConfigType, ChartRadialBarConfigType, ChartVariablePieConfigType, ChartEulerConfigType, ChartPolygonConfigType, ChartVectorConfigType, ChartXrangeConfigType, ChartFanConfigType, ChartFunnelConfigType, ChartOrganizationConfigType, ChartLineColumnConfigType, ChartHeatmapConfigType, ChartFlameConfigType, ChartSpiderwebConfigType, ChartKpiConfigType, ChartKpiPropsType, ChartMapConfigType, PrimitiveChartConfigType, SeparatedChartConfigInputType, AllChartConfigType, ChartConfigType, NileChartConfigInputType, ChartAiPanelPayload, ChartAiSenderPayload, NileAiPanelConfigInputType, NileAiSenderConfigInputType, } from '../internal/types/index.js';
@@ -1,8 +1,9 @@
1
1
  /** Merges separated chart + aq config into a flat NileChartConfig. */
2
2
  export function nileChartConfig(input) {
3
- const { chart, aq } = input;
3
+ const { chart, aq, ...fromRoot } = input;
4
4
  const { ai, switchable, ...rest } = aq ?? {};
5
5
  return {
6
+ ...fromRoot,
6
7
  ...chart,
7
8
  ...rest,
8
9
  ...(ai && { ai }),
@@ -1,6 +1,21 @@
1
1
  import type { ChartConfigType } from '../internal/types/chart-config.type.js';
2
2
  /** Every supported `chart.type` value for `<nile-chart>`. */
3
3
  export type ChartType = ChartConfigType['type'];
4
+ import type { BarChartSeriesData } from '../nile-bar-chart/nile-bar-chart.js';
5
+ import type { PieChartSeriesData } from '../nile-pie-chart/nile-pie-chart.js';
6
+ import type { TrendlineSeriesData, ForecastConfig } from '../nile-trendline-chart/nile-trendline-chart.js';
7
+ import type { AnomalySeriesData, AnomalyConfig } from '../nile-anomaly-chart/nile-anomaly-chart.js';
8
+ import type { LineChartSeriesData } from '../nile-line-chart/nile-line-chart.js';
9
+ import type { AreaChartSeriesData } from '../nile-area-chart/nile-area-chart.js';
10
+ import type { ColumnChartSeriesData } from '../nile-column-chart/nile-column-chart.js';
11
+ import type { DonutChartSeriesData } from '../nile-donut-chart/nile-donut-chart.js';
12
+ import type { ScatterChartSeriesData } from '../nile-scatter-chart/nile-scatter-chart.js';
13
+ import type { BubbleChartSeriesData } from '../nile-bubble-chart/nile-bubble-chart.js';
14
+ import type { SplineChartSeriesData } from '../nile-spline-chart/nile-spline-chart.js';
15
+ import type { RadarChartSeriesData } from '../nile-radar-chart/nile-radar-chart.js';
16
+ import type { GaugeBand } from '../nile-gauge-chart/nile-gauge-chart.js';
17
+ import type { WaterfallDataPoint } from '../nile-waterfall-chart/nile-waterfall-chart.js';
18
+ import type { MapChartDataPoint } from '../nile-map-chart/nile-map-chart.js';
4
19
  export type SwitchAggregation = 'by-category' | 'by-series' | 'flatten';
5
20
  export interface NileAiConfig {
6
21
  /** Show the AI chat icon on the chart. Default: false. */
@@ -11,6 +26,7 @@ export interface NileAiConfig {
11
26
  welcomeMessage?: string;
12
27
  }
13
28
  /** Fields merged from `aq` (and shared card chrome) onto `chart` for `<nile-chart>`. */
29
+ /** Fields merged from `aq` (and shared card chrome) onto `chart` for `<nile-chart>`. */
14
30
  export interface NileChartConfigBase {
15
31
  chartTitle?: string;
16
32
  chartSubtitle?: string;
@@ -22,54 +38,127 @@ export interface NileChartConfigBase {
22
38
  /** Chart types the user can switch to. Shows type-switch UI when set. */
23
39
  switchableTypes?: ChartType[];
24
40
  /** How to aggregate bar-like data when converting to pie. Default: 'by-category'. */
41
+ /** How to aggregate bar-like data when converting to pie. Default: 'by-category'. */
25
42
  switchAggregation?: SwitchAggregation;
26
43
  /** AI chat configuration. When ai.enabled is true, shows the allsearch icon. */
27
44
  ai?: NileAiConfig;
28
45
  }
29
- /** Flat config for `<nile-chart>` after merging `chart` + `aq`. */
30
- export type NileChartConfig = ChartConfigType & NileChartConfigBase;
31
- export type NileBarChartConfig = Extract<NileChartConfig, {
46
+ export interface NileBarChartConfig extends NileChartConfigBase {
32
47
  type: 'bar';
33
- }>;
34
- export type NilePieChartConfig = Extract<NileChartConfig, {
48
+ data: BarChartSeriesData[];
49
+ categories?: string[];
50
+ yAxisTitle?: string;
51
+ }
52
+ export interface NilePieChartConfig extends NileChartConfigBase {
35
53
  type: 'pie';
36
- }>;
37
- export type NileTrendlineChartConfig = Extract<NileChartConfig, {
54
+ data: PieChartSeriesData[];
55
+ seriesName?: string;
56
+ showDataLabels?: boolean;
57
+ showLegend?: boolean;
58
+ }
59
+ export interface NileTrendlineChartConfig extends NileChartConfigBase {
38
60
  type: 'trendline';
39
- }>;
40
- export type NileAnomalyChartConfig = Extract<NileChartConfig, {
61
+ data: TrendlineSeriesData[];
62
+ categories?: string[];
63
+ yAxisTitle?: string;
64
+ forecast?: ForecastConfig;
65
+ }
66
+ export interface NileAnomalyChartConfig extends NileChartConfigBase {
41
67
  type: 'anomaly';
42
- }>;
43
- export type NileLineChartConfig = Extract<NileChartConfig, {
68
+ data: AnomalySeriesData[];
69
+ categories?: string[];
70
+ yAxisTitle?: string;
71
+ anomaly?: AnomalyConfig;
72
+ }
73
+ export interface NileLineChartConfig extends NileChartConfigBase {
44
74
  type: 'line';
45
- }>;
46
- export type NileAreaChartConfig = Extract<NileChartConfig, {
75
+ data: LineChartSeriesData[];
76
+ categories?: string[];
77
+ yAxisTitle?: string;
78
+ }
79
+ export interface NileAreaChartConfig extends NileChartConfigBase {
47
80
  type: 'area';
48
- }>;
49
- export type NileColumnChartConfig = Extract<NileChartConfig, {
81
+ data: AreaChartSeriesData[];
82
+ categories?: string[];
83
+ yAxisTitle?: string;
84
+ stacked?: boolean;
85
+ }
86
+ export interface NileColumnChartConfig extends NileChartConfigBase {
50
87
  type: 'column';
51
- }>;
52
- export type NileDonutChartConfig = Extract<NileChartConfig, {
88
+ data: ColumnChartSeriesData[];
89
+ categories?: string[];
90
+ yAxisTitle?: string;
91
+ }
92
+ export interface NileDonutChartConfig extends NileChartConfigBase {
53
93
  type: 'donut';
54
- }>;
55
- export type NileScatterChartConfig = Extract<NileChartConfig, {
94
+ data: DonutChartSeriesData[];
95
+ seriesName?: string;
96
+ innerSize?: string;
97
+ showDataLabels?: boolean;
98
+ showLegend?: boolean;
99
+ }
100
+ export interface NileScatterChartConfig extends NileChartConfigBase {
56
101
  type: 'scatter';
57
- }>;
58
- export type NileBubbleChartConfig = Extract<NileChartConfig, {
102
+ data: ScatterChartSeriesData[];
103
+ xAxisTitle?: string;
104
+ yAxisTitle?: string;
105
+ }
106
+ export interface NileBubbleChartConfig extends NileChartConfigBase {
59
107
  type: 'bubble';
60
- }>;
61
- export type NileSplineChartConfig = Extract<NileChartConfig, {
108
+ data: BubbleChartSeriesData[];
109
+ xAxisTitle?: string;
110
+ yAxisTitle?: string;
111
+ }
112
+ export interface NileSplineChartConfig extends NileChartConfigBase {
62
113
  type: 'spline';
63
- }>;
64
- export type NileRadarChartConfig = Extract<NileChartConfig, {
114
+ data: SplineChartSeriesData[];
115
+ categories?: string[];
116
+ yAxisTitle?: string;
117
+ }
118
+ export interface NileRadarChartConfig extends NileChartConfigBase {
65
119
  type: 'radar';
66
- }>;
67
- export type NileGaugeChartConfig = Extract<NileChartConfig, {
120
+ data: RadarChartSeriesData[];
121
+ categories?: string[];
122
+ showArea?: boolean;
123
+ }
124
+ export interface NileGaugeChartConfig extends NileChartConfigBase {
68
125
  type: 'gauge';
69
- }>;
70
- export type NileWaterfallChartConfig = Extract<NileChartConfig, {
126
+ value: number;
127
+ min?: number;
128
+ max?: number;
129
+ suffix?: string;
130
+ bands?: GaugeBand[];
131
+ }
132
+ export interface NileWaterfallChartConfig extends NileChartConfigBase {
71
133
  type: 'waterfall';
72
- }>;
134
+ data: WaterfallDataPoint[];
135
+ yAxisTitle?: string;
136
+ }
137
+ export interface NileMapChartConfig extends NileChartConfigBase {
138
+ type: 'map';
139
+ /** Array of data points joined against the map topology. */
140
+ data: MapChartDataPoint[];
141
+ /**
142
+ * GeoJSON or Highcharts topology object for the map shapes.
143
+ * Obtain from https://code.highcharts.com/mapdata/ or supply your own.
144
+ */
145
+ mapData?: object;
146
+ /**
147
+ * How to join data against mapData. Defaults to `['hc-key', 'hc-key']`.
148
+ * Pass a string to use the same key on both sides,
149
+ * or a two-element array `[mapKey, dataKey]` for different key names.
150
+ */
151
+ joinBy?: string | string[];
152
+ /**
153
+ * Type of the primary series. Default: `'map'`.
154
+ * For multi-series or `tiledwebmap`, pass `options.series` directly.
155
+ */
156
+ seriesType?: 'map' | 'mapline' | 'mappoint' | 'mapbubble' | 'tiledwebmap';
157
+ /** Enable mouse-wheel zoom, double-click zoom, and +/− buttons. Default: true. */
158
+ zoom?: boolean;
159
+ }
160
+ /** Flat config for `<nile-chart>`: discriminated `chart` fields plus merged `aq` / card chrome. */
161
+ export type NileChartConfig = ChartConfigType & NileChartConfigBase;
73
162
  export type NileKpiChartConfig = Extract<NileChartConfig, {
74
163
  type: 'kpi';
75
164
  }>;
@@ -19,7 +19,6 @@ export const styles = css `
19
19
  box-shadow: var(--nile-box-shadow-3, var(--ng-shadow-sm));
20
20
  transition: box-shadow var(--nile-transition-duration-default, var(--ng-transition-duration-default)) ease;
21
21
  }
22
-
23
22
  .chart-card:hover {
24
23
  box-shadow: var(--nile-box-shadow-7, var(--ng-shadow-md));
25
24
  }
@@ -28,8 +27,10 @@ export const styles = css `
28
27
 
29
28
  .chart-header {
30
29
  display: flex;
30
+ flex-direction: row;
31
31
  align-items: center;
32
32
  justify-content: space-between;
33
+ gap: var(--nile-spacing-lg, var(--ng-spacing-lg));
33
34
  position: relative;
34
35
  z-index: 10;
35
36
  padding: var(--nile-spacing-2xl, var(--ng-spacing-2xl)) var(--nile-spacing-3xl, var(--ng-spacing-3xl)) var(--nile-spacing-xl, var(--ng-spacing-xl));
@@ -38,16 +39,24 @@ export const styles = css `
38
39
  border-radius: var(--nile-radius-radius-3xl, var(--ng-radius-xl)) var(--nile-radius-radius-3xl, var(--ng-radius-xl)) 0 0;
39
40
  }
40
41
 
42
+ .chart-header.chart-header--compact {
43
+ padding: var(--nile-spacing-xl, var(--ng-spacing-xl)) var(--nile-spacing-3xl, var(--ng-spacing-3xl)) var(--nile-spacing-lg, var(--ng-spacing-lg));
44
+ }
45
+
41
46
  .chart-header-titles {
47
+ display: flex;
48
+ flex-direction: column;
49
+ align-items: flex-start;
50
+ justify-content: center;
42
51
  min-width: 0;
43
- flex: 1;
52
+ flex: 1 1 auto;
44
53
  }
45
54
 
46
55
  .chart-header-title {
47
56
  margin: 0;
48
57
  font-family: var(--nile-font-family-serif-colfax-medium, var(--ng-font-family-display));
49
- font-size: var(--nile-type-scale-6, var(--ng-font-size-text-xl));
50
- font-weight: var(--nile-font-weight-semi-bold, var(--ng-font-weight-semibold));
58
+ font-size: var(--nile-type-scale-6, var(--ng-font-size-text-l));
59
+ font-weight: var(--nile-font-weight-semi-bold, var(--ng-font-weight-semibold));
51
60
  color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));
52
61
  line-height: 1.3;
53
62
  }
@@ -66,7 +75,7 @@ export const styles = css `
66
75
  align-items: center;
67
76
  gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
68
77
  flex-shrink: 0;
69
- margin-left: var(--nile-spacing-lg, var(--ng-spacing-lg));
78
+ align-self: center;
70
79
  }
71
80
 
72
81
  /* ── Card Body ── */
@@ -287,7 +296,12 @@ export const styles = css `
287
296
  background: transparent;
288
297
  color: var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
289
298
  }
290
-
299
+ .chart-inner--kpi {
300
+ overflow-x: hidden;
301
+ overflow-y: auto;
302
+ -webkit-overflow-scrolling: touch;
303
+ contain: none;
304
+ }
291
305
  .ai-trigger.active {
292
306
  background: var(--nile-colors-primary-100, var(--ng-colors-bg-brand-primary));
293
307
  color: var(--nile-colors-primary-700, var(--ng-colors-bg-brand-solid-hover));