@smartnet360/svelte-components 0.0.17 → 0.0.20

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.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Example KPI Configuration
3
+ *
4
+ * This is a reference example showing the structure for availableKPIs.
5
+ * In your application, you should:
6
+ * 1. Load KPIs from your backend API
7
+ * 2. Store in a JSON file specific to your domain
8
+ * 3. Generate dynamically based on your data schema
9
+ */
10
+ import type { KPI } from '../charts.model.js';
11
+ /**
12
+ * Example KPI list structure
13
+ * Each KPI must have: rawName, name, scale, unit, and optional color
14
+ */
15
+ export declare const exampleKPIs: KPI[];
16
+ /**
17
+ * KPI Interface Reference:
18
+ *
19
+ * interface KPI {
20
+ * rawName: string; // Column name in your data source
21
+ * name: string; // Display name shown in UI
22
+ * scale: 'percent' | 'absolute'; // Data type
23
+ * unit: string; // Unit of measurement (%, GB, users, etc.)
24
+ * color?: string; // Optional hex color for chart line
25
+ * }
26
+ */
27
+ /**
28
+ * Usage Example:
29
+ *
30
+ * <script>
31
+ * import { ChartLayoutEditor } from '..';
32
+ * import { exampleKPIs } from './exampleKPIs';
33
+ * // OR load from API:
34
+ * // const myKPIs = await fetch('/api/kpis').then(r => r.json());
35
+ * </script>
36
+ *
37
+ * <ChartLayoutEditor availableKPIs={exampleKPIs} />
38
+ */
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Example KPI Configuration
3
+ *
4
+ * This is a reference example showing the structure for availableKPIs.
5
+ * In your application, you should:
6
+ * 1. Load KPIs from your backend API
7
+ * 2. Store in a JSON file specific to your domain
8
+ * 3. Generate dynamically based on your data schema
9
+ */
10
+ /**
11
+ * Example KPI list structure
12
+ * Each KPI must have: rawName, name, scale, unit, and optional color
13
+ */
14
+ export const exampleKPIs = [
15
+ {
16
+ rawName: 'CCSR_PC',
17
+ name: 'CCSR Success Rate',
18
+ scale: 'percent',
19
+ unit: '%',
20
+ color: '#2ca02c' // Optional: hex color for the trace
21
+ },
22
+ {
23
+ rawName: 'DL_GBYTES',
24
+ name: 'Downlink Traffic',
25
+ scale: 'absolute',
26
+ unit: 'GB',
27
+ color: '#06B6D4'
28
+ },
29
+ {
30
+ rawName: 'UL_GBYTES',
31
+ name: 'Uplink Traffic',
32
+ scale: 'absolute',
33
+ unit: 'GB',
34
+ color: '#84CC16'
35
+ },
36
+ {
37
+ rawName: 'AVG_USERS',
38
+ name: 'Average Connected Users',
39
+ scale: 'absolute',
40
+ unit: 'users',
41
+ color: '#EF4444'
42
+ }
43
+ ];
44
+ /**
45
+ * KPI Interface Reference:
46
+ *
47
+ * interface KPI {
48
+ * rawName: string; // Column name in your data source
49
+ * name: string; // Display name shown in UI
50
+ * scale: 'percent' | 'absolute'; // Data type
51
+ * unit: string; // Unit of measurement (%, GB, users, etc.)
52
+ * color?: string; // Optional hex color for chart line
53
+ * }
54
+ */
55
+ /**
56
+ * Usage Example:
57
+ *
58
+ * <script>
59
+ * import { ChartLayoutEditor } from '..';
60
+ * import { exampleKPIs } from './exampleKPIs';
61
+ * // OR load from API:
62
+ * // const myKPIs = await fetch('/api/kpis').then(r => r.json());
63
+ * </script>
64
+ *
65
+ * <ChartLayoutEditor availableKPIs={exampleKPIs} />
66
+ */
@@ -4,3 +4,7 @@ export type { Layout, Section, Chart, KPI, Mode, Scale, ChartMarker, ChartGrid,
4
4
  export { createTimeSeriesTrace, getYAxisTitle, formatValue, processKPIData, createDefaultPlotlyLayout } from './data-utils.js';
5
5
  export { adaptPlotlyLayout, getSizeCategory, createMarkerShapes, createMarkerAnnotations, addMarkersToLayout } from './adapt.js';
6
6
  export type { ContainerSize, ChartInfo, AdaptationConfig } from './adapt.js';
7
+ export { default as ChartLayoutEditor } from './editor/ChartLayoutEditor.svelte';
8
+ export { editorStore, currentLayout, savedLayouts, selection, isDirty, selectedItem } from './editor/editorState.js';
9
+ export type { Selection, SelectionType, EditorState } from './editor/editorState.js';
10
+ export { exampleKPIs } from './editor/exampleKPIs.js';
@@ -2,3 +2,7 @@ export { default as ChartComponent } from './ChartComponent.svelte';
2
2
  export { default as ChartCard } from './ChartCard.svelte';
3
3
  export { createTimeSeriesTrace, getYAxisTitle, formatValue, processKPIData, createDefaultPlotlyLayout } from './data-utils.js';
4
4
  export { adaptPlotlyLayout, getSizeCategory, createMarkerShapes, createMarkerAnnotations, addMarkersToLayout } from './adapt.js';
5
+ // Editor exports
6
+ export { default as ChartLayoutEditor } from './editor/ChartLayoutEditor.svelte';
7
+ export { editorStore, currentLayout, savedLayouts, selection, isDirty, selectedItem } from './editor/editorState.js';
8
+ export { exampleKPIs } from './editor/exampleKPIs.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.17",
3
+ "version": "0.0.20",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",