@quantumwake/terminal-ux-dashboard-components 0.1.12 → 0.1.15

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
@@ -31,6 +31,14 @@ interface DashboardCapabilities {
31
31
  addPanel?: (panel: PanelInput) => void;
32
32
  removePanel?: (panelId: string) => void;
33
33
  persistPanelData?: (panelId: string, rows: QueryResult['rows'], refreshedAt: string) => void;
34
+ persistLayout?: (items: PanelLayout[]) => void;
35
+ }
36
+ interface PanelLayout {
37
+ id: string;
38
+ x: number;
39
+ y: number;
40
+ w: number;
41
+ h: number;
34
42
  }
35
43
  interface DashboardContextValue extends DashboardCapabilities {
36
44
  theme: DashboardTheme;
@@ -54,6 +62,7 @@ declare function useCapabilities(): {
54
62
  canAddPanel: boolean;
55
63
  canEditPanels: boolean;
56
64
  canRefresh: boolean;
65
+ canEditLayout: boolean;
57
66
  };
58
67
 
59
68
  type ChartType = 'bar' | 'grouped-bar' | 'pie' | 'line' | 'scatter' | 'heatmap';
@@ -98,8 +107,20 @@ interface ChartStyle {
98
107
  xLegendOffset: number;
99
108
  yLegendPosition: LegendPosition;
100
109
  yLegendOffset: number;
110
+ xAxisLabel: string;
111
+ yAxisLabel: string;
112
+ showXLegend: boolean;
113
+ showYLegend: boolean;
114
+ legendBold: boolean;
115
+ legendHighlight: string;
116
+ xTickRotation: number;
117
+ yTickRotation: number;
118
+ tickTruncate: number;
101
119
  legendAnchor: LegendAnchor;
102
120
  titleAlign: TitleAlign;
121
+ titleBold: boolean;
122
+ titleBackground: string;
123
+ titleColor: string;
103
124
  }
104
125
  declare const DEFAULT_CHART_STYLE: ChartStyle;
105
126
  declare const LEGEND_ANCHORS: LegendAnchor[];
@@ -121,6 +142,9 @@ declare const buildNivoTheme: (style?: Partial<ChartStyle> | null) => {
121
142
  text: {
122
143
  fill: string;
123
144
  fontSize: number;
145
+ fontWeight: number;
146
+ outlineWidth: number;
147
+ outlineColor: string;
124
148
  };
125
149
  };
126
150
  };
@@ -176,11 +200,9 @@ declare const legendConfig: (style?: Partial<ChartStyle> | null) => {
176
200
  symbolShape: "circle";
177
201
  itemTextColor: string;
178
202
  } | null;
179
- declare const axisLegend: (style: Partial<ChartStyle> | null | undefined, axis: "x" | "y", legendText: string) => {
180
- legend: string;
181
- legendPosition: LegendPosition;
182
- legendOffset: number;
183
- };
203
+ declare const axisLegend: (style: Partial<ChartStyle> | null | undefined, axis: "x" | "y", columnName: string, opts?: {
204
+ numeric?: boolean;
205
+ }) => Record<string, unknown>;
184
206
 
185
207
  type AggFn = 'count' | 'distinct' | 'sum' | 'avg' | 'min' | 'max';
186
208
  declare const groupBy: (records: Row[], column: string) => Record<string, Row[]>;
@@ -313,12 +335,6 @@ interface ChartStyleControlsProps {
313
335
  style?: Partial<ChartStyle> | null;
314
336
  onChange: (next: ChartStyle) => void;
315
337
  }
316
- /**
317
- * ChartStyleControls — the standardized appearance editor used across all
318
- * charts. Edits a plain style object (see chartStyle.ts); theme-aware via the
319
- * host-injected DashboardContext theme. Parent persists the style and passes it
320
- * to the views.
321
- */
322
338
  declare function ChartStyleControls({ style, onChange }: ChartStyleControlsProps): react.JSX.Element;
323
339
 
324
340
  interface SqlConsoleColumn {
@@ -370,6 +386,8 @@ interface DashboardPanel$1 {
370
386
  title?: string;
371
387
  width?: number;
372
388
  height?: number;
389
+ x?: number;
390
+ y?: number;
373
391
  config?: PanelConfig;
374
392
  }
375
393
  interface Dashboard$1 {
@@ -386,8 +404,12 @@ interface DashboardRendererProps {
386
404
  }
387
405
  /**
388
406
  * DashboardRenderer — renders a grid of AI-generated or manually configured
389
- * panels. The per-panel remove button is gated behind canEditPanels: the
390
- * published viewer (no removePanel) renders the dashboard READ-ONLY.
407
+ * panels via react-grid-layout. Editing is capability-gated:
408
+ * - studio (persistLayout wired) ⇒ panels drag (by their header) + resize, and
409
+ * the new geometry is persisted back to the host.
410
+ * - published viewer (no persistLayout) ⇒ a static grid, rendered exactly where
411
+ * the studio left the panels.
412
+ * The per-panel remove button is similarly gated behind canEditPanels.
391
413
  */
392
414
  declare function DashboardRenderer({ dashboard, records, columns }: DashboardRendererProps): react.JSX.Element | null;
393
415
 
@@ -492,4 +514,4 @@ interface DataExplorerProps {
492
514
  }
493
515
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
494
516
 
495
- 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, type PanelInput, 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 };
517
+ 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, type PanelInput, type PanelLayout, 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 };
package/dist/index.d.ts CHANGED
@@ -31,6 +31,14 @@ interface DashboardCapabilities {
31
31
  addPanel?: (panel: PanelInput) => void;
32
32
  removePanel?: (panelId: string) => void;
33
33
  persistPanelData?: (panelId: string, rows: QueryResult['rows'], refreshedAt: string) => void;
34
+ persistLayout?: (items: PanelLayout[]) => void;
35
+ }
36
+ interface PanelLayout {
37
+ id: string;
38
+ x: number;
39
+ y: number;
40
+ w: number;
41
+ h: number;
34
42
  }
35
43
  interface DashboardContextValue extends DashboardCapabilities {
36
44
  theme: DashboardTheme;
@@ -54,6 +62,7 @@ declare function useCapabilities(): {
54
62
  canAddPanel: boolean;
55
63
  canEditPanels: boolean;
56
64
  canRefresh: boolean;
65
+ canEditLayout: boolean;
57
66
  };
58
67
 
59
68
  type ChartType = 'bar' | 'grouped-bar' | 'pie' | 'line' | 'scatter' | 'heatmap';
@@ -98,8 +107,20 @@ interface ChartStyle {
98
107
  xLegendOffset: number;
99
108
  yLegendPosition: LegendPosition;
100
109
  yLegendOffset: number;
110
+ xAxisLabel: string;
111
+ yAxisLabel: string;
112
+ showXLegend: boolean;
113
+ showYLegend: boolean;
114
+ legendBold: boolean;
115
+ legendHighlight: string;
116
+ xTickRotation: number;
117
+ yTickRotation: number;
118
+ tickTruncate: number;
101
119
  legendAnchor: LegendAnchor;
102
120
  titleAlign: TitleAlign;
121
+ titleBold: boolean;
122
+ titleBackground: string;
123
+ titleColor: string;
103
124
  }
104
125
  declare const DEFAULT_CHART_STYLE: ChartStyle;
105
126
  declare const LEGEND_ANCHORS: LegendAnchor[];
@@ -121,6 +142,9 @@ declare const buildNivoTheme: (style?: Partial<ChartStyle> | null) => {
121
142
  text: {
122
143
  fill: string;
123
144
  fontSize: number;
145
+ fontWeight: number;
146
+ outlineWidth: number;
147
+ outlineColor: string;
124
148
  };
125
149
  };
126
150
  };
@@ -176,11 +200,9 @@ declare const legendConfig: (style?: Partial<ChartStyle> | null) => {
176
200
  symbolShape: "circle";
177
201
  itemTextColor: string;
178
202
  } | null;
179
- declare const axisLegend: (style: Partial<ChartStyle> | null | undefined, axis: "x" | "y", legendText: string) => {
180
- legend: string;
181
- legendPosition: LegendPosition;
182
- legendOffset: number;
183
- };
203
+ declare const axisLegend: (style: Partial<ChartStyle> | null | undefined, axis: "x" | "y", columnName: string, opts?: {
204
+ numeric?: boolean;
205
+ }) => Record<string, unknown>;
184
206
 
185
207
  type AggFn = 'count' | 'distinct' | 'sum' | 'avg' | 'min' | 'max';
186
208
  declare const groupBy: (records: Row[], column: string) => Record<string, Row[]>;
@@ -313,12 +335,6 @@ interface ChartStyleControlsProps {
313
335
  style?: Partial<ChartStyle> | null;
314
336
  onChange: (next: ChartStyle) => void;
315
337
  }
316
- /**
317
- * ChartStyleControls — the standardized appearance editor used across all
318
- * charts. Edits a plain style object (see chartStyle.ts); theme-aware via the
319
- * host-injected DashboardContext theme. Parent persists the style and passes it
320
- * to the views.
321
- */
322
338
  declare function ChartStyleControls({ style, onChange }: ChartStyleControlsProps): react.JSX.Element;
323
339
 
324
340
  interface SqlConsoleColumn {
@@ -370,6 +386,8 @@ interface DashboardPanel$1 {
370
386
  title?: string;
371
387
  width?: number;
372
388
  height?: number;
389
+ x?: number;
390
+ y?: number;
373
391
  config?: PanelConfig;
374
392
  }
375
393
  interface Dashboard$1 {
@@ -386,8 +404,12 @@ interface DashboardRendererProps {
386
404
  }
387
405
  /**
388
406
  * DashboardRenderer — renders a grid of AI-generated or manually configured
389
- * panels. The per-panel remove button is gated behind canEditPanels: the
390
- * published viewer (no removePanel) renders the dashboard READ-ONLY.
407
+ * panels via react-grid-layout. Editing is capability-gated:
408
+ * - studio (persistLayout wired) ⇒ panels drag (by their header) + resize, and
409
+ * the new geometry is persisted back to the host.
410
+ * - published viewer (no persistLayout) ⇒ a static grid, rendered exactly where
411
+ * the studio left the panels.
412
+ * The per-panel remove button is similarly gated behind canEditPanels.
391
413
  */
392
414
  declare function DashboardRenderer({ dashboard, records, columns }: DashboardRendererProps): react.JSX.Element | null;
393
415
 
@@ -492,4 +514,4 @@ interface DataExplorerProps {
492
514
  }
493
515
  declare function DataExplorer({ records, columns, states, activeStateId, profile, dashboard, dashboardId, savedDashboards, loading, analyzing, defaultMode, tabs, onSelectState, onRefreshStates, }: DataExplorerProps): react.JSX.Element;
494
516
 
495
- 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, type PanelInput, 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 };
517
+ 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, type PanelInput, type PanelLayout, 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 };