@allternit/viz 0.1.0 → 0.1.1

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/src/types.ts.bak DELETED
@@ -1,410 +0,0 @@
1
- /**
2
- * A2R Data Visualization Types
3
- */
4
-
5
- /**
6
- * Chart Types
7
- */
8
- export type ChartType =
9
- | 'line'
10
- | 'bar'
11
- | 'column'
12
- | 'area'
13
- | 'pie'
14
- | 'donut'
15
- | 'scatter'
16
- | 'bubble'
17
- | 'radar'
18
- | 'heatmap'
19
- | 'treemap'
20
- | 'sankey'
21
- | 'gauge'
22
- | 'candlestick';
23
-
24
- /**
25
- * Chart Configuration
26
- */
27
- export interface ChartConfig {
28
- /** Chart type */
29
- type: ChartType;
30
- /** Chart title */
31
- title?: string;
32
- /** Chart subtitle */
33
- subtitle?: string;
34
- /** Width in pixels */
35
- width?: number;
36
- /** Height in pixels */
37
- height?: number;
38
- /** X-axis configuration */
39
- xAxis?: AxisConfig;
40
- /** Y-axis configuration */
41
- yAxis?: AxisConfig;
42
- /** Legend configuration */
43
- legend?: LegendConfig;
44
- /** Tooltip configuration */
45
- tooltip?: TooltipConfig;
46
- /** Chart colors */
47
- colors?: string[];
48
- /** Theme */
49
- theme?: 'light' | 'dark';
50
- /** Enable animations */
51
- animation?: boolean;
52
- /** Enable stacking (for bar/area) */
53
- stacking?: boolean;
54
- /** Show data labels */
55
- dataLabels?: boolean;
56
- /** Chart-specific options */
57
- options?: Record<string, unknown>;
58
- }
59
-
60
- /**
61
- * Axis Configuration
62
- */
63
- export interface AxisConfig {
64
- /** Axis title */
65
- title?: string;
66
- /** Axis type */
67
- type?: 'category' | 'number' | 'datetime' | 'logarithmic';
68
- /** Minimum value */
69
- min?: number;
70
- /** Maximum value */
71
- max?: number;
72
- /** Tick interval */
73
- tickInterval?: number;
74
- /** Label format */
75
- labelFormat?: string;
76
- /** Categories (for category axis) */
77
- categories?: string[];
78
- /** Grid lines */
79
- grid?: GridConfig;
80
- /** Opposite side */
81
- opposite?: boolean;
82
- /** Reversed */
83
- reversed?: boolean;
84
- }
85
-
86
- /**
87
- * Grid Configuration
88
- */
89
- export interface GridConfig {
90
- /** Show grid */
91
- enabled?: boolean;
92
- /** Grid color */
93
- color?: string;
94
- /** Dash style */
95
- dashStyle?: string;
96
- }
97
-
98
- /**
99
- * Legend Configuration
100
- */
101
- export interface LegendConfig {
102
- /** Show legend */
103
- enabled?: boolean;
104
- /** Legend position */
105
- position?: 'top' | 'bottom' | 'left' | 'right';
106
- /** Legend alignment */
107
- align?: 'left' | 'center' | 'right';
108
- }
109
-
110
- /**
111
- * Tooltip Configuration
112
- */
113
- export interface TooltipConfig {
114
- /** Show tooltip */
115
- enabled?: boolean;
116
- /** Shared tooltip */
117
- shared?: boolean;
118
- /** Follow cursor */
119
- followCursor?: boolean;
120
- /** Formatter function */
121
- formatter?: string;
122
- }
123
-
124
- /**
125
- * Data Series
126
- */
127
- export interface DataSeries {
128
- /** Series ID */
129
- id: string;
130
- /** Series name */
131
- name: string;
132
- /** Series type (can override chart type) */
133
- type?: ChartType;
134
- /** Series data */
135
- data: DataPoint[];
136
- /** Series color */
137
- color?: string;
138
- /** Y-axis index (for multi-axis) */
139
- yAxis?: number;
140
- /** Series options */
141
- options?: Record<string, unknown>;
142
- }
143
-
144
- /**
145
- * Data Point
146
- */
147
- export interface DataPoint {
148
- /** X value */
149
- x?: string | number | Date;
150
- /** Y value */
151
- y?: number;
152
- /** Category name (for pie/donut) */
153
- name?: string;
154
- /** Value (for pie/donut) */
155
- value?: number;
156
- /** Additional properties */
157
- [key: string]: unknown;
158
- }
159
-
160
- /**
161
- * Dashboard Configuration
162
- */
163
- export interface DashboardConfig {
164
- /** Dashboard ID */
165
- id: string;
166
- /** Dashboard title */
167
- title: string;
168
- /** Layout grid columns */
169
- columns?: number;
170
- /** Widgets */
171
- widgets: WidgetConfig[];
172
- /** Refresh interval (seconds) */
173
- refreshInterval?: number;
174
- /** Theme */
175
- theme?: 'light' | 'dark';
176
- }
177
-
178
- /**
179
- * Widget Configuration
180
- */
181
- export interface WidgetConfig {
182
- /** Widget ID */
183
- id: string;
184
- /** Widget type */
185
- type: 'chart' | 'metric' | 'table' | 'text' | 'image';
186
- /** Widget title */
187
- title?: string;
188
- /** Grid position */
189
- position: GridPosition;
190
- /** Widget data source */
191
- dataSource?: DataSource;
192
- /** Widget-specific config */
193
- config?: ChartConfig | MetricConfig | TableConfig;
194
- }
195
-
196
- /**
197
- * Grid Position
198
- */
199
- export interface GridPosition {
200
- /** Column start (1-based) */
201
- x: number;
202
- /** Row start (1-based) */
203
- y: number;
204
- /** Width in columns */
205
- w: number;
206
- /** Height in rows */
207
- h: number;
208
- }
209
-
210
- /**
211
- * Metric Configuration
212
- */
213
- export interface MetricConfig {
214
- /** Metric value format */
215
- format?: 'number' | 'currency' | 'percentage' | 'duration';
216
- /** Decimal places */
217
- decimals?: number;
218
- /** Prefix */
219
- prefix?: string;
220
- /** Suffix */
221
- suffix?: string;
222
- /** Comparison to previous period */
223
- comparison?: boolean;
224
- /** Trend indicator */
225
- trend?: 'up' | 'down' | 'neutral';
226
- /** Color by trend */
227
- colorByTrend?: boolean;
228
- }
229
-
230
- /**
231
- * Table Configuration
232
- */
233
- export interface TableConfig {
234
- /** Columns */
235
- columns: TableColumn[];
236
- /** Enable pagination */
237
- pagination?: boolean;
238
- /** Page size */
239
- pageSize?: number;
240
- /** Enable sorting */
241
- sortable?: boolean;
242
- /** Enable filtering */
243
- filterable?: boolean;
244
- /** Enable search */
245
- searchable?: boolean;
246
- }
247
-
248
- /**
249
- * Table Column
250
- */
251
- export interface TableColumn {
252
- /** Column ID */
253
- id: string;
254
- /** Column header */
255
- header: string;
256
- /** Column type */
257
- type?: 'text' | 'number' | 'date' | 'currency' | 'percentage' | 'badge';
258
- /** Column width */
259
- width?: number | string;
260
- /** Align */
261
- align?: 'left' | 'center' | 'right';
262
- /** Format string */
263
- format?: string;
264
- /** Sortable */
265
- sortable?: boolean;
266
- }
267
-
268
- /**
269
- * Data Source
270
- */
271
- export interface DataSource {
272
- /** Source type */
273
- type: 'static' | 'api' | 'websocket' | 'query';
274
- /** Source configuration */
275
- config: Record<string, unknown>;
276
- /** Data transform pipeline */
277
- transforms?: DataTransform[];
278
- /** Polling interval (seconds) */
279
- pollingInterval?: number;
280
- }
281
-
282
- /**
283
- * Data Transform
284
- */
285
- export interface DataTransform {
286
- /** Transform type */
287
- type: 'filter' | 'map' | 'reduce' | 'aggregate' | 'sort' | 'limit';
288
- /** Transform configuration */
289
- config: Record<string, unknown>;
290
- }
291
-
292
- /**
293
- * Chart Renderer
294
- */
295
- export interface ChartRenderer {
296
- /** Render chart to SVG */
297
- renderSVG(config: ChartConfig, series: DataSeries[]): string;
298
- /** Render chart to Canvas */
299
- renderCanvas(config: ChartConfig, series: DataSeries[]): HTMLCanvasElement;
300
- /** Get chart metadata */
301
- getMetadata(type: ChartType): ChartMetadata;
302
- }
303
-
304
- /**
305
- * Chart Metadata
306
- */
307
- export interface ChartMetadata {
308
- /** Chart type */
309
- type: ChartType;
310
- /** Display name */
311
- name: string;
312
- /** Description */
313
- description: string;
314
- /** Supported axes */
315
- axes: ('x' | 'y' | 'z')[];
316
- /** Required data structure */
317
- dataStructure: string;
318
- /** Use cases */
319
- useCases: string[];
320
- }
321
-
322
- /**
323
- * Export Options
324
- */
325
- export interface ExportOptions {
326
- /** Export format */
327
- format: 'png' | 'svg' | 'pdf' | 'csv' | 'json';
328
- /** Export filename */
329
- filename?: string;
330
- /** Export dimensions */
331
- width?: number;
332
- height?: number;
333
- /** Background color */
334
- backgroundColor?: string;
335
- }
336
-
337
- /**
338
- * Visualization Event
339
- */
340
- export interface VizEvent {
341
- /** Event type */
342
- type: 'click' | 'hover' | 'select' | 'zoom' | 'pan';
343
- /** Target element */
344
- target: string;
345
- /** Event data */
346
- data: Record<string, unknown>;
347
- /** Timestamp */
348
- timestamp: number;
349
- }
350
-
351
- /**
352
- * Chart Palette
353
- */
354
- export interface ChartPalette {
355
- /** Primary colors */
356
- primary: string[];
357
- /** Secondary colors */
358
- secondary: string[];
359
- /** Semantic colors */
360
- semantic: {
361
- success: string;
362
- warning: string;
363
- error: string;
364
- info: string;
365
- };
366
- /** Background colors */
367
- background: string[];
368
- /** Text colors */
369
- text: {
370
- primary: string;
371
- secondary: string;
372
- muted: string;
373
- };
374
- }
375
-
376
- /** Predefined palettes */
377
- export const palettes: Record<string, ChartPalette> = {
378
- default: {
379
- primary: ['#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6', '#ec4899'],
380
- secondary: ['#60a5fa', '#34d399', '#fbbf24', '#f87171', '#a78bfa', '#f472b6'],
381
- semantic: {
382
- success: '#10b981',
383
- warning: '#f59e0b',
384
- error: '#ef4444',
385
- info: '#3b82f6',
386
- },
387
- background: ['#ffffff', '#f3f4f6', '#e5e7eb', '#d1d5db'],
388
- text: {
389
- primary: '#111827',
390
- secondary: '#4b5563',
391
- muted: '#9ca3af',
392
- },
393
- },
394
- dark: {
395
- primary: ['#60a5fa', '#34d399', '#fbbf24', '#f87171', '#a78bfa', '#f472b6'],
396
- secondary: ['#93c5fd', '#6ee7b7', '#fcd34d', '#fca5a5', '#c4b5fd', '#fbcfe8'],
397
- semantic: {
398
- success: '#34d399',
399
- warning: '#fbbf24',
400
- error: '#f87171',
401
- info: '#60a5fa',
402
- },
403
- background: ['#1f2937', '#111827', '#374151', '#4b5563'],
404
- text: {
405
- primary: '#f9fafb',
406
- secondary: '#d1d5db',
407
- muted: '#9ca3af',
408
- },
409
- },
410
- };