@quantumwake/terminal-ux-dashboard-components 0.1.18 → 0.1.19

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.
package/dist/index.d.cts CHANGED
@@ -71,7 +71,7 @@ declare function useCapabilities(): {
71
71
  canEditLayout: boolean;
72
72
  };
73
73
 
74
- type ChartType = 'bar' | 'grouped-bar' | 'pie' | 'line' | 'scatter' | 'heatmap';
74
+ type ChartType = 'bar' | 'grouped-bar' | 'pie' | 'line' | 'scatter' | 'heatmap' | 'heatmap-plus';
75
75
  interface ChartField {
76
76
  name: string;
77
77
  agg?: string;
@@ -87,13 +87,16 @@ interface ChartConfig {
87
87
  yFields?: ChartField[];
88
88
  valueField?: ChartField | null;
89
89
  filters?: ChartFilter[];
90
+ labelStat?: string;
91
+ colorStat?: string;
92
+ blockField?: string;
90
93
  }
91
94
  type Row = Record<string, unknown>;
92
95
  declare const qIdent: (name: string) => string;
93
96
  declare const qLit: (v: unknown) => string;
94
97
  declare const aggExpr: (agg: string | undefined, col?: string) => string;
95
98
  declare const compileWhere: (filters?: ChartFilter[]) => string;
96
- declare const buildChartSQL: ({ chartType, xFields, yFields, valueField, filters, }: ChartConfig) => string | null;
99
+ declare const buildChartSQL: ({ chartType, xFields, yFields, valueField, filters, labelStat, colorStat, blockField, }: ChartConfig) => string | null;
97
100
  declare const shapeChartData: (chartType: ChartType, rows: Row[], { yFields }?: {
98
101
  yFields?: ChartField[];
99
102
  }) => unknown;
@@ -215,10 +218,30 @@ declare const axisLegend: (style: Partial<ChartStyle> | null | undefined, axis:
215
218
  numeric?: boolean;
216
219
  }) => Record<string, unknown>;
217
220
 
218
- type AggFn = 'count' | 'distinct' | 'sum' | 'avg' | 'min' | 'max';
221
+ type AggFn = 'count' | 'distinct' | 'sum' | 'avg' | 'min' | 'max' | 'median';
219
222
  declare const groupBy: (records: Row[], column: string) => Record<string, Row[]>;
220
223
  declare const aggregate: (records: Row[], column: string, fn: AggFn | string) => number;
221
224
 
225
+ type HeatStat = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'median';
226
+ type ColorScope = 'global' | 'row' | 'column' | 'block';
227
+ type ColorMethod = 'linear' | 'rank';
228
+ declare const HEAT_STATS: HeatStat[];
229
+ interface HeatCell {
230
+ row: string;
231
+ col: string;
232
+ colorValue: number;
233
+ block?: string;
234
+ }
235
+ interface ColorOptions {
236
+ scope?: ColorScope;
237
+ method?: ColorMethod;
238
+ vmin?: number;
239
+ vmax?: number;
240
+ }
241
+ declare const normalizeCells: (cells: HeatCell[], { scope, method, vmin, vmax }?: ColorOptions) => Map<string, number>;
242
+ declare const heatColor: (t: number) => string;
243
+ declare const heatLabelColor: (t: number) => string;
244
+
222
245
  interface MetricConfig {
223
246
  column: string;
224
247
  agg?: string;
@@ -312,7 +335,7 @@ interface HeatmapSerie {
312
335
  y: number;
313
336
  }[];
314
337
  }
315
- type AxisOrder = 'alpha' | 'total-asc' | 'total-desc';
338
+ type AxisOrder$1 = 'alpha' | 'total-asc' | 'total-desc';
316
339
  interface HeatmapViewProps {
317
340
  records?: Row[];
318
341
  rowColumn: string;
@@ -320,8 +343,8 @@ interface HeatmapViewProps {
320
343
  valueColumn?: string;
321
344
  aggFn?: string;
322
345
  data?: HeatmapSerie[];
323
- rowOrder?: AxisOrder;
324
- colOrder?: AxisOrder;
346
+ rowOrder?: AxisOrder$1;
347
+ colOrder?: AxisOrder$1;
325
348
  marginAgg?: string;
326
349
  showTotals?: boolean;
327
350
  style?: Partial<ChartStyle>;
@@ -333,6 +356,42 @@ interface HeatmapViewProps {
333
356
  */
334
357
  declare function HeatmapView({ records, rowColumn, colColumn, valueColumn, aggFn, data: presetData, rowOrder, colOrder, marginAgg, showTotals, style, }: HeatmapViewProps): react.JSX.Element;
335
358
 
359
+ interface HeatPlusDatum {
360
+ r: string | null;
361
+ c: string | null;
362
+ lv: number;
363
+ cv: number;
364
+ gr?: number;
365
+ gc?: number;
366
+ block?: string;
367
+ }
368
+ type AxisOrder = 'alpha' | 'margin-asc' | 'margin-desc' | 'total-asc' | 'total-desc';
369
+ interface HeatmapPlusViewProps {
370
+ records?: Row[];
371
+ rowColumn: string;
372
+ colColumn: string;
373
+ valueColumn?: string;
374
+ labelStat?: HeatStat;
375
+ colorStat?: HeatStat;
376
+ blockField?: string;
377
+ data?: HeatPlusDatum[];
378
+ scope?: ColorScope;
379
+ method?: ColorMethod;
380
+ vmin?: number;
381
+ vmax?: number;
382
+ rowOrder?: AxisOrder;
383
+ colOrder?: AxisOrder;
384
+ showMargins?: boolean;
385
+ style?: Partial<ChartStyle>;
386
+ }
387
+ /**
388
+ * HeatmapPlusView — a cross-tab heatmap with independent label/color stats,
389
+ * margins computed over the underlying rows, and a scope/method color engine
390
+ * (see heatmapColor.ts). nivo's built-in scales normalize globally, so colors
391
+ * are precomputed per cell here and handed to nivo as a function.
392
+ */
393
+ declare function HeatmapPlusView({ records, rowColumn, colColumn, valueColumn, labelStat, colorStat, blockField, data: presetData, scope, method, vmin, vmax, rowOrder, colOrder, showMargins, style, }: HeatmapPlusViewProps): react.JSX.Element;
394
+
336
395
  interface PivotViewProps {
337
396
  records?: Row[];
338
397
  }
@@ -383,6 +442,14 @@ interface PanelConfig {
383
442
  colOrder?: string;
384
443
  marginAgg?: string;
385
444
  showTotals?: boolean;
445
+ labelStat?: string;
446
+ colorStat?: string;
447
+ blockField?: string;
448
+ scope?: string;
449
+ method?: string;
450
+ vmin?: number;
451
+ vmax?: number;
452
+ showMargins?: boolean;
386
453
  columns?: string[];
387
454
  text?: string;
388
455
  label?: string;
@@ -462,7 +529,7 @@ interface Column {
462
529
  name: string;
463
530
  type: string;
464
531
  }
465
- /** A selectable state (dataset) in the statefs catalog. */
532
+ /** A selectable state (dataset) in the host's catalog. */
466
533
  interface StatefsState {
467
534
  state_id: string;
468
535
  row_count?: number;
@@ -539,4 +606,4 @@ interface DataExplorerProps {
539
606
  }
540
607
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
541
608
 
542
- export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
609
+ export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, type ColorMethod, type ColorOptions, type ColorScope, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, HEAT_STATS, type HeatCell, type HeatPlusDatum, type HeatStat, HeatmapPlusView, type HeatmapPlusViewProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
package/dist/index.d.ts CHANGED
@@ -71,7 +71,7 @@ declare function useCapabilities(): {
71
71
  canEditLayout: boolean;
72
72
  };
73
73
 
74
- type ChartType = 'bar' | 'grouped-bar' | 'pie' | 'line' | 'scatter' | 'heatmap';
74
+ type ChartType = 'bar' | 'grouped-bar' | 'pie' | 'line' | 'scatter' | 'heatmap' | 'heatmap-plus';
75
75
  interface ChartField {
76
76
  name: string;
77
77
  agg?: string;
@@ -87,13 +87,16 @@ interface ChartConfig {
87
87
  yFields?: ChartField[];
88
88
  valueField?: ChartField | null;
89
89
  filters?: ChartFilter[];
90
+ labelStat?: string;
91
+ colorStat?: string;
92
+ blockField?: string;
90
93
  }
91
94
  type Row = Record<string, unknown>;
92
95
  declare const qIdent: (name: string) => string;
93
96
  declare const qLit: (v: unknown) => string;
94
97
  declare const aggExpr: (agg: string | undefined, col?: string) => string;
95
98
  declare const compileWhere: (filters?: ChartFilter[]) => string;
96
- declare const buildChartSQL: ({ chartType, xFields, yFields, valueField, filters, }: ChartConfig) => string | null;
99
+ declare const buildChartSQL: ({ chartType, xFields, yFields, valueField, filters, labelStat, colorStat, blockField, }: ChartConfig) => string | null;
97
100
  declare const shapeChartData: (chartType: ChartType, rows: Row[], { yFields }?: {
98
101
  yFields?: ChartField[];
99
102
  }) => unknown;
@@ -215,10 +218,30 @@ declare const axisLegend: (style: Partial<ChartStyle> | null | undefined, axis:
215
218
  numeric?: boolean;
216
219
  }) => Record<string, unknown>;
217
220
 
218
- type AggFn = 'count' | 'distinct' | 'sum' | 'avg' | 'min' | 'max';
221
+ type AggFn = 'count' | 'distinct' | 'sum' | 'avg' | 'min' | 'max' | 'median';
219
222
  declare const groupBy: (records: Row[], column: string) => Record<string, Row[]>;
220
223
  declare const aggregate: (records: Row[], column: string, fn: AggFn | string) => number;
221
224
 
225
+ type HeatStat = 'count' | 'sum' | 'avg' | 'min' | 'max' | 'median';
226
+ type ColorScope = 'global' | 'row' | 'column' | 'block';
227
+ type ColorMethod = 'linear' | 'rank';
228
+ declare const HEAT_STATS: HeatStat[];
229
+ interface HeatCell {
230
+ row: string;
231
+ col: string;
232
+ colorValue: number;
233
+ block?: string;
234
+ }
235
+ interface ColorOptions {
236
+ scope?: ColorScope;
237
+ method?: ColorMethod;
238
+ vmin?: number;
239
+ vmax?: number;
240
+ }
241
+ declare const normalizeCells: (cells: HeatCell[], { scope, method, vmin, vmax }?: ColorOptions) => Map<string, number>;
242
+ declare const heatColor: (t: number) => string;
243
+ declare const heatLabelColor: (t: number) => string;
244
+
222
245
  interface MetricConfig {
223
246
  column: string;
224
247
  agg?: string;
@@ -312,7 +335,7 @@ interface HeatmapSerie {
312
335
  y: number;
313
336
  }[];
314
337
  }
315
- type AxisOrder = 'alpha' | 'total-asc' | 'total-desc';
338
+ type AxisOrder$1 = 'alpha' | 'total-asc' | 'total-desc';
316
339
  interface HeatmapViewProps {
317
340
  records?: Row[];
318
341
  rowColumn: string;
@@ -320,8 +343,8 @@ interface HeatmapViewProps {
320
343
  valueColumn?: string;
321
344
  aggFn?: string;
322
345
  data?: HeatmapSerie[];
323
- rowOrder?: AxisOrder;
324
- colOrder?: AxisOrder;
346
+ rowOrder?: AxisOrder$1;
347
+ colOrder?: AxisOrder$1;
325
348
  marginAgg?: string;
326
349
  showTotals?: boolean;
327
350
  style?: Partial<ChartStyle>;
@@ -333,6 +356,42 @@ interface HeatmapViewProps {
333
356
  */
334
357
  declare function HeatmapView({ records, rowColumn, colColumn, valueColumn, aggFn, data: presetData, rowOrder, colOrder, marginAgg, showTotals, style, }: HeatmapViewProps): react.JSX.Element;
335
358
 
359
+ interface HeatPlusDatum {
360
+ r: string | null;
361
+ c: string | null;
362
+ lv: number;
363
+ cv: number;
364
+ gr?: number;
365
+ gc?: number;
366
+ block?: string;
367
+ }
368
+ type AxisOrder = 'alpha' | 'margin-asc' | 'margin-desc' | 'total-asc' | 'total-desc';
369
+ interface HeatmapPlusViewProps {
370
+ records?: Row[];
371
+ rowColumn: string;
372
+ colColumn: string;
373
+ valueColumn?: string;
374
+ labelStat?: HeatStat;
375
+ colorStat?: HeatStat;
376
+ blockField?: string;
377
+ data?: HeatPlusDatum[];
378
+ scope?: ColorScope;
379
+ method?: ColorMethod;
380
+ vmin?: number;
381
+ vmax?: number;
382
+ rowOrder?: AxisOrder;
383
+ colOrder?: AxisOrder;
384
+ showMargins?: boolean;
385
+ style?: Partial<ChartStyle>;
386
+ }
387
+ /**
388
+ * HeatmapPlusView — a cross-tab heatmap with independent label/color stats,
389
+ * margins computed over the underlying rows, and a scope/method color engine
390
+ * (see heatmapColor.ts). nivo's built-in scales normalize globally, so colors
391
+ * are precomputed per cell here and handed to nivo as a function.
392
+ */
393
+ declare function HeatmapPlusView({ records, rowColumn, colColumn, valueColumn, labelStat, colorStat, blockField, data: presetData, scope, method, vmin, vmax, rowOrder, colOrder, showMargins, style, }: HeatmapPlusViewProps): react.JSX.Element;
394
+
336
395
  interface PivotViewProps {
337
396
  records?: Row[];
338
397
  }
@@ -383,6 +442,14 @@ interface PanelConfig {
383
442
  colOrder?: string;
384
443
  marginAgg?: string;
385
444
  showTotals?: boolean;
445
+ labelStat?: string;
446
+ colorStat?: string;
447
+ blockField?: string;
448
+ scope?: string;
449
+ method?: string;
450
+ vmin?: number;
451
+ vmax?: number;
452
+ showMargins?: boolean;
386
453
  columns?: string[];
387
454
  text?: string;
388
455
  label?: string;
@@ -462,7 +529,7 @@ interface Column {
462
529
  name: string;
463
530
  type: string;
464
531
  }
465
- /** A selectable state (dataset) in the statefs catalog. */
532
+ /** A selectable state (dataset) in the host's catalog. */
466
533
  interface StatefsState {
467
534
  state_id: string;
468
535
  row_count?: number;
@@ -539,4 +606,4 @@ interface DataExplorerProps {
539
606
  }
540
607
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
541
608
 
542
- export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, legendConfig, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };
609
+ export { type AggFn, type BarDatum, BarView, type BarViewProps, ChartBuilder, type ChartBuilderColumn, type ChartBuilderProps, type ChartConfig, type ChartField, type ChartFilter, type ChartPanel, type ChartStyle, ChartStyleControls, type ChartStyleControlsProps, type ChartType, type ColorMethod, type ColorOptions, type ColorScope, DEFAULT_CHART_STYLE, type Dashboard$1 as Dashboard, type DashboardCapabilities, type DashboardContextValue, type DashboardPanel$1 as DashboardPanel, DashboardProvider, type DashboardProviderProps, DashboardRenderer, type DashboardRendererProps, type DashboardTheme, DataExplorer, type DataExplorerProps, HEAT_STATS, type HeatCell, type HeatPlusDatum, type HeatStat, HeatmapPlusView, type HeatmapPlusViewProps, type HeatmapSerie, HeatmapView, type HeatmapViewProps, type InsightConfig, InsightView, type InsightViewProps, LEGEND_ANCHORS, type LegendAnchor, type LegendPosition, type LineSerie, LineView, type LineViewProps, type MetricConfig, MetricView, type MetricViewProps, PanelChart, type PanelChartProps, type PanelInput, type PanelLayout, type PanelRef, type PieDatum, PieView, type PieViewProps, PivotView, type PivotViewProps, type QueryResult, type Row, type SavedDashboard, type ScatterSerie, ScatterView, type ScatterViewProps, SqlConsole, type SqlConsoleColumn, type SqlConsoleProps, type TitleAlign, aggExpr, aggregate, axisLegend, buildChartSQL, buildNivoTheme, compileWhere, groupBy, heatColor, heatLabelColor, legendConfig, normalizeCells, qIdent, qLit, shapeChartData, useCapabilities, useDashboard, withStyleDefaults };