ai-progress-controls 0.1.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.
- package/LICENSE +21 -0
- package/README.md +823 -0
- package/dist/ai-progress-controls.es.js +7191 -0
- package/dist/ai-progress-controls.es.js.map +1 -0
- package/dist/ai-progress-controls.umd.js +2 -0
- package/dist/ai-progress-controls.umd.js.map +1 -0
- package/dist/index.d.ts +2212 -0
- package/package.json +105 -0
- package/src/__tests__/setup.ts +93 -0
- package/src/core/base/AIControl.ts +230 -0
- package/src/core/base/index.ts +3 -0
- package/src/core/base/types.ts +77 -0
- package/src/core/base/utils.ts +168 -0
- package/src/core/batch-progress/BatchProgress.test.ts +458 -0
- package/src/core/batch-progress/BatchProgress.ts +760 -0
- package/src/core/batch-progress/index.ts +14 -0
- package/src/core/batch-progress/styles.ts +480 -0
- package/src/core/batch-progress/types.ts +169 -0
- package/src/core/model-loader/ModelLoader.test.ts +311 -0
- package/src/core/model-loader/ModelLoader.ts +673 -0
- package/src/core/model-loader/index.ts +2 -0
- package/src/core/model-loader/styles.ts +496 -0
- package/src/core/model-loader/types.ts +127 -0
- package/src/core/parameter-panel/ParameterPanel.test.ts +856 -0
- package/src/core/parameter-panel/ParameterPanel.ts +877 -0
- package/src/core/parameter-panel/index.ts +14 -0
- package/src/core/parameter-panel/styles.ts +323 -0
- package/src/core/parameter-panel/types.ts +278 -0
- package/src/core/parameter-slider/ParameterSlider.test.ts +299 -0
- package/src/core/parameter-slider/ParameterSlider.ts +653 -0
- package/src/core/parameter-slider/index.ts +8 -0
- package/src/core/parameter-slider/styles.ts +493 -0
- package/src/core/parameter-slider/types.ts +107 -0
- package/src/core/queue-progress/QueueProgress.test.ts +344 -0
- package/src/core/queue-progress/QueueProgress.ts +563 -0
- package/src/core/queue-progress/index.ts +5 -0
- package/src/core/queue-progress/styles.ts +469 -0
- package/src/core/queue-progress/types.ts +130 -0
- package/src/core/retry-progress/RetryProgress.test.ts +397 -0
- package/src/core/retry-progress/RetryProgress.ts +957 -0
- package/src/core/retry-progress/index.ts +6 -0
- package/src/core/retry-progress/styles.ts +530 -0
- package/src/core/retry-progress/types.ts +176 -0
- package/src/core/stream-progress/StreamProgress.test.ts +531 -0
- package/src/core/stream-progress/StreamProgress.ts +517 -0
- package/src/core/stream-progress/index.ts +2 -0
- package/src/core/stream-progress/styles.ts +349 -0
- package/src/core/stream-progress/types.ts +82 -0
- package/src/index.ts +19 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all AI Progress Controls
|
|
3
|
+
* Provides common functionality for Web Components including:
|
|
4
|
+
* - Theme management
|
|
5
|
+
* - Event handling
|
|
6
|
+
* - Accessibility features
|
|
7
|
+
* - Debug logging
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* class MyControl extends AIControl {
|
|
12
|
+
* constructor() {
|
|
13
|
+
* super();
|
|
14
|
+
* this.attachShadow({ mode: 'open' });
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* protected render() {
|
|
18
|
+
* // Your rendering logic
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class AIControl extends HTMLElement {
|
|
24
|
+
protected config: AIControlConfig;
|
|
25
|
+
protected _disabled: boolean;
|
|
26
|
+
protected startTime: number;
|
|
27
|
+
constructor(config?: AIControlConfig);
|
|
28
|
+
/**
|
|
29
|
+
* Called when the element is connected to the DOM
|
|
30
|
+
*/
|
|
31
|
+
connectedCallback(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Called when the element is disconnected from the DOM
|
|
34
|
+
*/
|
|
35
|
+
disconnectedCallback(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Called when an observed attribute changes
|
|
38
|
+
*/
|
|
39
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Apply theme using CSS custom properties
|
|
42
|
+
*/
|
|
43
|
+
protected applyTheme(theme?: ThemeConfig): void;
|
|
44
|
+
/**
|
|
45
|
+
* Set up accessibility features (ARIA attributes, keyboard navigation)
|
|
46
|
+
*/
|
|
47
|
+
protected setupAccessibility(): void;
|
|
48
|
+
/**
|
|
49
|
+
* Emit a custom event
|
|
50
|
+
*/
|
|
51
|
+
protected emit<T>(eventName: string, detail?: T): void;
|
|
52
|
+
/**
|
|
53
|
+
* Log debug messages (only if debug mode is enabled)
|
|
54
|
+
*/
|
|
55
|
+
protected log(message: string, ...args: unknown[]): void;
|
|
56
|
+
/**
|
|
57
|
+
* Log errors (always logged)
|
|
58
|
+
*/
|
|
59
|
+
protected logError(message: string, error?: Error): void;
|
|
60
|
+
/**
|
|
61
|
+
* Start timing an operation
|
|
62
|
+
*/
|
|
63
|
+
protected startTimer(): void;
|
|
64
|
+
/**
|
|
65
|
+
* Get elapsed time since timer started
|
|
66
|
+
*/
|
|
67
|
+
protected getElapsedTime(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Format numbers for display (e.g., 1234 -> "1.2K")
|
|
70
|
+
*/
|
|
71
|
+
protected formatNumber(num: number): string;
|
|
72
|
+
/**
|
|
73
|
+
* Format duration in milliseconds to human-readable string
|
|
74
|
+
*/
|
|
75
|
+
protected formatDuration(ms: number): string;
|
|
76
|
+
/**
|
|
77
|
+
* Calculate percentage safely
|
|
78
|
+
*/
|
|
79
|
+
protected calculatePercentage(current: number, total: number): number;
|
|
80
|
+
/**
|
|
81
|
+
* Get/Set disabled state
|
|
82
|
+
*/
|
|
83
|
+
get disabled(): boolean;
|
|
84
|
+
set disabled(value: boolean);
|
|
85
|
+
/**
|
|
86
|
+
* Abstract method to render the component
|
|
87
|
+
* Must be implemented by subclasses
|
|
88
|
+
*/
|
|
89
|
+
protected abstract render(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Get the default ARIA role for this component
|
|
92
|
+
* Can be overridden by subclasses
|
|
93
|
+
*/
|
|
94
|
+
protected getDefaultRole(): string;
|
|
95
|
+
/**
|
|
96
|
+
* Handle attribute changes
|
|
97
|
+
* Can be overridden by subclasses to handle specific attributes
|
|
98
|
+
*/
|
|
99
|
+
protected handleAttributeChange(_name: string, _oldValue: string, _newValue: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Cleanup resources when component is destroyed
|
|
102
|
+
* Can be overridden by subclasses
|
|
103
|
+
*/
|
|
104
|
+
protected cleanup(): void;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Base configuration for all AI Progress Controls
|
|
109
|
+
*/
|
|
110
|
+
export declare interface AIControlConfig {
|
|
111
|
+
/** Enable/disable console logging for debugging */
|
|
112
|
+
debug?: boolean;
|
|
113
|
+
/** Custom CSS class names to apply */
|
|
114
|
+
className?: string;
|
|
115
|
+
/** Whether the control is disabled */
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
/** ARIA label for accessibility */
|
|
118
|
+
ariaLabel?: string;
|
|
119
|
+
/** Enable automatic cursor feedback based on state (default: true) */
|
|
120
|
+
cursorFeedback?: boolean;
|
|
121
|
+
/** Size variant: compact, default, or large */
|
|
122
|
+
size?: SizeVariant;
|
|
123
|
+
/** Visual style variant: default, minimal, gradient, or glassmorphic */
|
|
124
|
+
variant?: VisualVariant;
|
|
125
|
+
/** Animation effect: none, striped, pulse, or glow */
|
|
126
|
+
animation?: AnimationEffect_2;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Animation effect for progress indicators
|
|
131
|
+
*/
|
|
132
|
+
declare type AnimationEffect_2 = 'none' | 'striped' | 'pulse' | 'glow';
|
|
133
|
+
export { AnimationEffect_2 as AnimationEffect }
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Event detail for batch cancel
|
|
137
|
+
*/
|
|
138
|
+
export declare interface BatchCancelEvent {
|
|
139
|
+
completedCount: number;
|
|
140
|
+
failedCount: number;
|
|
141
|
+
cancelledCount: number;
|
|
142
|
+
reason?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Event detail for batch complete
|
|
147
|
+
*/
|
|
148
|
+
export declare interface BatchCompleteEvent {
|
|
149
|
+
totalItems: number;
|
|
150
|
+
successCount: number;
|
|
151
|
+
failedCount: number;
|
|
152
|
+
duration: number;
|
|
153
|
+
averageRate: number;
|
|
154
|
+
startTime: number;
|
|
155
|
+
endTime: number;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Individual batch item
|
|
160
|
+
*/
|
|
161
|
+
export declare interface BatchItem {
|
|
162
|
+
id: string;
|
|
163
|
+
label?: string;
|
|
164
|
+
status: BatchItemStatus;
|
|
165
|
+
progress?: number;
|
|
166
|
+
error?: string;
|
|
167
|
+
result?: any;
|
|
168
|
+
startTime?: number;
|
|
169
|
+
endTime?: number;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Event detail for batch item complete
|
|
174
|
+
*/
|
|
175
|
+
export declare interface BatchItemCompleteEvent {
|
|
176
|
+
item: BatchItem;
|
|
177
|
+
totalCompleted: number;
|
|
178
|
+
remainingItems: number;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Event detail for batch item failed
|
|
183
|
+
*/
|
|
184
|
+
export declare interface BatchItemFailedEvent {
|
|
185
|
+
item: BatchItem;
|
|
186
|
+
error: string;
|
|
187
|
+
totalFailed: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Status of a batch item
|
|
192
|
+
*/
|
|
193
|
+
export declare type BatchItemStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Event detail for batch item update
|
|
197
|
+
*/
|
|
198
|
+
export declare interface BatchItemUpdateEvent extends BatchItem {
|
|
199
|
+
totalCompleted: number;
|
|
200
|
+
totalFailed: number;
|
|
201
|
+
overallProgress: number;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* BatchProgress Component
|
|
206
|
+
*
|
|
207
|
+
* Displays progress for batch operations processing multiple items.
|
|
208
|
+
* Perfect for processing multiple AI requests, documents, or images in parallel.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```typescript
|
|
212
|
+
* // Create batch progress
|
|
213
|
+
* const batch = new BatchProgress({
|
|
214
|
+
* totalItems: 50,
|
|
215
|
+
* concurrency: 5,
|
|
216
|
+
* showItems: true,
|
|
217
|
+
* showStats: true
|
|
218
|
+
* });
|
|
219
|
+
*
|
|
220
|
+
* document.body.appendChild(batch);
|
|
221
|
+
*
|
|
222
|
+
* // Start batch
|
|
223
|
+
* batch.start();
|
|
224
|
+
*
|
|
225
|
+
* // Add items
|
|
226
|
+
* for (let i = 0; i < 50; i++) {
|
|
227
|
+
* batch.addItem(`item-${i}`, `Process item ${i}`);
|
|
228
|
+
* }
|
|
229
|
+
*
|
|
230
|
+
* // Update item progress
|
|
231
|
+
* batch.updateItem({
|
|
232
|
+
* itemId: 'item-0',
|
|
233
|
+
* status: 'processing',
|
|
234
|
+
* progress: 50
|
|
235
|
+
* });
|
|
236
|
+
*
|
|
237
|
+
* // Complete item
|
|
238
|
+
* batch.completeItem('item-0', { result: 'success' });
|
|
239
|
+
*
|
|
240
|
+
* // Listen to events
|
|
241
|
+
* batch.addEventListener('batchcomplete', (e) => {
|
|
242
|
+
* console.log(`Completed ${e.detail.successCount}/${e.detail.totalItems}`);
|
|
243
|
+
* });
|
|
244
|
+
* ```
|
|
245
|
+
*
|
|
246
|
+
* @fires batchstart - Fired when batch processing starts
|
|
247
|
+
* @fires itemupdate - Fired when batch item is updated
|
|
248
|
+
* @fires itemcomplete - Fired when batch item completes
|
|
249
|
+
* @fires itemfailed - Fired when batch item fails
|
|
250
|
+
* @fires batchcomplete - Fired when all items are processed
|
|
251
|
+
* @fires batchcancel - Fired when batch is cancelled
|
|
252
|
+
*/
|
|
253
|
+
export declare class BatchProgress extends AIControl {
|
|
254
|
+
protected config: Required<BatchProgressConfig>;
|
|
255
|
+
private readonly state;
|
|
256
|
+
private updateThrottleTimer;
|
|
257
|
+
static get observedAttributes(): string[];
|
|
258
|
+
constructor(config?: BatchProgressConfig);
|
|
259
|
+
connectedCallback(): void;
|
|
260
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
261
|
+
/**
|
|
262
|
+
* Update cursor based on component state
|
|
263
|
+
*/
|
|
264
|
+
private updateCursor;
|
|
265
|
+
/**
|
|
266
|
+
* Start batch processing
|
|
267
|
+
*/
|
|
268
|
+
start(message?: string): void;
|
|
269
|
+
/**
|
|
270
|
+
* Add item to batch
|
|
271
|
+
*/
|
|
272
|
+
addItem(itemId: string, label?: string): void;
|
|
273
|
+
/**
|
|
274
|
+
* Update batch item
|
|
275
|
+
*/
|
|
276
|
+
updateItem(update: BatchProgressUpdate): void;
|
|
277
|
+
/**
|
|
278
|
+
* Complete a batch item
|
|
279
|
+
*/
|
|
280
|
+
completeItem(itemId: string, result?: any): void;
|
|
281
|
+
/**
|
|
282
|
+
* Fail a batch item
|
|
283
|
+
*/
|
|
284
|
+
failItem(itemId: string, error: string): void;
|
|
285
|
+
/**
|
|
286
|
+
* Complete batch processing
|
|
287
|
+
*/
|
|
288
|
+
complete(): void;
|
|
289
|
+
/**
|
|
290
|
+
* Cancel batch processing
|
|
291
|
+
*/
|
|
292
|
+
cancel(reason?: string): void;
|
|
293
|
+
/**
|
|
294
|
+
* Reset batch to initial state
|
|
295
|
+
*/
|
|
296
|
+
reset(): void;
|
|
297
|
+
/**
|
|
298
|
+
* Get overall progress percentage
|
|
299
|
+
*/
|
|
300
|
+
getOverallProgress(): number;
|
|
301
|
+
/**
|
|
302
|
+
* Get processing rate (items/second)
|
|
303
|
+
*/
|
|
304
|
+
getRate(): number;
|
|
305
|
+
/**
|
|
306
|
+
* Get batch statistics
|
|
307
|
+
*/
|
|
308
|
+
getStats(): {
|
|
309
|
+
total: number;
|
|
310
|
+
completed: number;
|
|
311
|
+
success: number;
|
|
312
|
+
failed: number;
|
|
313
|
+
pending: number;
|
|
314
|
+
progress: number;
|
|
315
|
+
rate: number;
|
|
316
|
+
duration: number;
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Throttled render to avoid excessive updates
|
|
320
|
+
*/
|
|
321
|
+
private throttledRender;
|
|
322
|
+
/**
|
|
323
|
+
* Calculate duration based on state
|
|
324
|
+
*/
|
|
325
|
+
private _calculateDuration;
|
|
326
|
+
/**
|
|
327
|
+
* Get rate display HTML
|
|
328
|
+
*/
|
|
329
|
+
private _getRateDisplay;
|
|
330
|
+
/**
|
|
331
|
+
* Sync config attributes to host element
|
|
332
|
+
*/
|
|
333
|
+
private _syncAttributes;
|
|
334
|
+
/**
|
|
335
|
+
* Get status badge CSS class
|
|
336
|
+
*/
|
|
337
|
+
private _getStatusBadgeClass;
|
|
338
|
+
/**
|
|
339
|
+
* Get status display text
|
|
340
|
+
*/
|
|
341
|
+
private _getStatusText;
|
|
342
|
+
/**
|
|
343
|
+
* Get stats section HTML
|
|
344
|
+
*/
|
|
345
|
+
private _getStatsHtml;
|
|
346
|
+
/**
|
|
347
|
+
* Get progress bar HTML
|
|
348
|
+
*/
|
|
349
|
+
private _getProgressBarHtml;
|
|
350
|
+
/**
|
|
351
|
+
* Get controls HTML
|
|
352
|
+
*/
|
|
353
|
+
private _getControlsHtml;
|
|
354
|
+
/**
|
|
355
|
+
* Attach event listeners to rendered elements
|
|
356
|
+
*/
|
|
357
|
+
private _attachEventListeners;
|
|
358
|
+
/**
|
|
359
|
+
* Render the component
|
|
360
|
+
*/
|
|
361
|
+
protected render(): void;
|
|
362
|
+
/**
|
|
363
|
+
* Render batch items
|
|
364
|
+
*/
|
|
365
|
+
private renderItems;
|
|
366
|
+
/**
|
|
367
|
+
* Get status icon
|
|
368
|
+
*/
|
|
369
|
+
private getStatusIcon;
|
|
370
|
+
/**
|
|
371
|
+
* Get/set disabled state
|
|
372
|
+
*/
|
|
373
|
+
get disabled(): boolean;
|
|
374
|
+
set disabled(value: boolean);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Configuration options for BatchProgress
|
|
379
|
+
*/
|
|
380
|
+
export declare interface BatchProgressConfig {
|
|
381
|
+
/** Total number of items in batch */
|
|
382
|
+
totalItems?: number;
|
|
383
|
+
/** Maximum concurrent operations */
|
|
384
|
+
concurrency?: number;
|
|
385
|
+
/** Show individual item progress */
|
|
386
|
+
showItems?: boolean;
|
|
387
|
+
/** Maximum items to display */
|
|
388
|
+
maxDisplayItems?: number;
|
|
389
|
+
/** Show overall progress bar */
|
|
390
|
+
showProgressBar?: boolean;
|
|
391
|
+
/** Show statistics (success/fail counts) */
|
|
392
|
+
showStats?: boolean;
|
|
393
|
+
/** Show elapsed time */
|
|
394
|
+
showTime?: boolean;
|
|
395
|
+
/** Show processing rate (items/sec) */
|
|
396
|
+
showRate?: boolean;
|
|
397
|
+
/** Allow cancellation */
|
|
398
|
+
allowCancel?: boolean;
|
|
399
|
+
/** Cancel button label */
|
|
400
|
+
cancelLabel?: string;
|
|
401
|
+
/** Automatically collapse completed items */
|
|
402
|
+
collapseCompleted?: boolean;
|
|
403
|
+
/** Status message */
|
|
404
|
+
message?: string;
|
|
405
|
+
/** Enable automatic cursor state changes based on component state */
|
|
406
|
+
cursorFeedback?: boolean;
|
|
407
|
+
/** Component size variant */
|
|
408
|
+
size?: 'compact' | 'default' | 'large';
|
|
409
|
+
/** Visual style variant */
|
|
410
|
+
variant?: 'default' | 'minimal' | 'gradient' | 'glassmorphic';
|
|
411
|
+
/** Animation style */
|
|
412
|
+
animation?: 'none' | 'striped' | 'pulse' | 'glow';
|
|
413
|
+
/** Disabled state */
|
|
414
|
+
disabled?: boolean;
|
|
415
|
+
/** Enable debug logging */
|
|
416
|
+
debug?: boolean;
|
|
417
|
+
/** Additional CSS class */
|
|
418
|
+
className?: string;
|
|
419
|
+
/** ARIA label for accessibility */
|
|
420
|
+
ariaLabel?: string;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Internal state of the BatchProgress
|
|
425
|
+
*/
|
|
426
|
+
export declare interface BatchProgressState {
|
|
427
|
+
status: 'idle' | 'processing' | 'completed' | 'paused' | 'cancelled';
|
|
428
|
+
items: Map<string, BatchItem>;
|
|
429
|
+
totalItems: number;
|
|
430
|
+
completedCount: number;
|
|
431
|
+
failedCount: number;
|
|
432
|
+
successCount: number;
|
|
433
|
+
currentConcurrency: number;
|
|
434
|
+
startTime: number | null;
|
|
435
|
+
endTime: number | null;
|
|
436
|
+
message: string;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* Update parameters for batch progress
|
|
441
|
+
*/
|
|
442
|
+
export declare interface BatchProgressUpdate {
|
|
443
|
+
itemId: string;
|
|
444
|
+
status?: BatchItemStatus;
|
|
445
|
+
progress?: number;
|
|
446
|
+
error?: string;
|
|
447
|
+
result?: any;
|
|
448
|
+
label?: string;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Event detail for batch start
|
|
453
|
+
*/
|
|
454
|
+
export declare interface BatchStartEvent {
|
|
455
|
+
totalItems: number;
|
|
456
|
+
startTime: number;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Calculate estimated time remaining
|
|
461
|
+
*/
|
|
462
|
+
export declare function calculateETA(current: number, total: number, startTime: number): number;
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Clamp a number between min and max
|
|
466
|
+
*/
|
|
467
|
+
export declare function clamp(value: number, min: number, max: number): number;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Event detail for completion
|
|
471
|
+
*/
|
|
472
|
+
export declare interface CompleteEvent {
|
|
473
|
+
duration: number;
|
|
474
|
+
timestamp: number;
|
|
475
|
+
metadata?: Record<string, unknown>;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Event detail when configuration is exported
|
|
480
|
+
*/
|
|
481
|
+
export declare interface ConfigExportEvent {
|
|
482
|
+
/** Exported configuration */
|
|
483
|
+
config: ExportedConfig;
|
|
484
|
+
/** Export format */
|
|
485
|
+
format: 'json' | 'url';
|
|
486
|
+
/** Timestamp */
|
|
487
|
+
timestamp: number;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Event detail when configuration is imported
|
|
492
|
+
*/
|
|
493
|
+
export declare interface ConfigImportEvent {
|
|
494
|
+
/** Imported configuration */
|
|
495
|
+
config: ExportedConfig;
|
|
496
|
+
/** Previous values */
|
|
497
|
+
previousValues: Record<string, number>;
|
|
498
|
+
/** Timestamp */
|
|
499
|
+
timestamp: number;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Create a style element with CSS
|
|
504
|
+
*/
|
|
505
|
+
export declare function createStyle(css: string): HTMLStyleElement;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Utility functions for AI Progress Controls
|
|
509
|
+
*/
|
|
510
|
+
/**
|
|
511
|
+
* Debounce function calls
|
|
512
|
+
*/
|
|
513
|
+
export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Easing function for smooth animations
|
|
517
|
+
*/
|
|
518
|
+
export declare function easeOutCubic(t: number): number;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Event detail for errors
|
|
522
|
+
*/
|
|
523
|
+
declare interface ErrorEvent_2 {
|
|
524
|
+
message: string;
|
|
525
|
+
code?: string;
|
|
526
|
+
timestamp: number;
|
|
527
|
+
}
|
|
528
|
+
export { ErrorEvent_2 as ErrorEvent }
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Exported configuration format
|
|
532
|
+
*/
|
|
533
|
+
export declare interface ExportedConfig {
|
|
534
|
+
/** Format version */
|
|
535
|
+
version: string;
|
|
536
|
+
/** Preset name if applicable */
|
|
537
|
+
preset?: string;
|
|
538
|
+
/** Parameter values */
|
|
539
|
+
parameters: Record<string, number>;
|
|
540
|
+
/** Metadata */
|
|
541
|
+
metadata?: {
|
|
542
|
+
/** Creation timestamp */
|
|
543
|
+
created: string;
|
|
544
|
+
/** Configuration name */
|
|
545
|
+
name?: string;
|
|
546
|
+
/** Description */
|
|
547
|
+
description?: string;
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Format bytes to human-readable string
|
|
553
|
+
*/
|
|
554
|
+
export declare function formatBytes(bytes: number, decimals?: number): string;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Format currency (USD)
|
|
558
|
+
*/
|
|
559
|
+
export declare function formatCurrency(amount: number, decimals?: number): string;
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Format seconds to human-readable time string
|
|
563
|
+
*/
|
|
564
|
+
export declare function formatTime(seconds: number): string;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Generate a unique ID
|
|
568
|
+
*/
|
|
569
|
+
export declare function generateId(prefix?: string): string;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Check if an element is in viewport
|
|
573
|
+
*/
|
|
574
|
+
export declare function isInViewport(element: HTMLElement): boolean;
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Linear interpolation
|
|
578
|
+
*/
|
|
579
|
+
export declare function lerp(start: number, end: number, t: number): number;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Event data for completion
|
|
583
|
+
*/
|
|
584
|
+
export declare interface LoadCompleteEvent {
|
|
585
|
+
duration: number;
|
|
586
|
+
memoryUsage?: number;
|
|
587
|
+
stages: Record<ModelStage, StageState>;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* Event data for error
|
|
592
|
+
*/
|
|
593
|
+
export declare interface LoadErrorEvent {
|
|
594
|
+
stage: ModelStage;
|
|
595
|
+
message: string;
|
|
596
|
+
timestamp: number;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Event detail for manual retry trigger
|
|
601
|
+
*/
|
|
602
|
+
export declare interface ManualRetryEvent {
|
|
603
|
+
attempt: number;
|
|
604
|
+
timestamp: number;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* ModelLoader Component
|
|
609
|
+
*
|
|
610
|
+
* Displays multi-stage progress for AI model loading operations.
|
|
611
|
+
* Shows download progress, initialization stages, memory usage, and ETA.
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* ```typescript
|
|
615
|
+
* // Create the component
|
|
616
|
+
* const loader = new ModelLoader({
|
|
617
|
+
* modelName: 'GPT-4 Vision',
|
|
618
|
+
* stages: ['download', 'load', 'initialize', 'ready'],
|
|
619
|
+
* showBytes: true,
|
|
620
|
+
* showMemoryUsage: true,
|
|
621
|
+
* showETA: true,
|
|
622
|
+
* });
|
|
623
|
+
*
|
|
624
|
+
* document.body.appendChild(loader);
|
|
625
|
+
*
|
|
626
|
+
* // Start loading
|
|
627
|
+
* loader.start();
|
|
628
|
+
*
|
|
629
|
+
* // Update download stage
|
|
630
|
+
* loader.updateStage('download', {
|
|
631
|
+
* bytesLoaded: 50000000,
|
|
632
|
+
* totalBytes: 100000000,
|
|
633
|
+
* message: 'Downloading model weights...'
|
|
634
|
+
* });
|
|
635
|
+
*
|
|
636
|
+
* // Move to next stage
|
|
637
|
+
* loader.setStage('load', { message: 'Loading into memory...' });
|
|
638
|
+
*
|
|
639
|
+
* // Complete
|
|
640
|
+
* loader.complete();
|
|
641
|
+
*
|
|
642
|
+
* // Listen to events
|
|
643
|
+
* loader.addEventListener('stagechange', (e) => {
|
|
644
|
+
* console.log('Stage changed', e.detail);
|
|
645
|
+
* });
|
|
646
|
+
* ```
|
|
647
|
+
*
|
|
648
|
+
* @fires loadstart - Fired when loading starts
|
|
649
|
+
* @fires stagechange - Fired when stage changes
|
|
650
|
+
* @fires stageupdate - Fired when stage progress updates
|
|
651
|
+
* @fires loadcomplete - Fired when loading completes
|
|
652
|
+
* @fires loaderror - Fired when an error occurs
|
|
653
|
+
*/
|
|
654
|
+
export declare class ModelLoader extends AIControl {
|
|
655
|
+
protected config: Required<ModelLoaderConfig>;
|
|
656
|
+
private state;
|
|
657
|
+
private readonly updateThrottled;
|
|
658
|
+
static get observedAttributes(): string[];
|
|
659
|
+
constructor(config?: ModelLoaderConfig);
|
|
660
|
+
connectedCallback(): void;
|
|
661
|
+
protected getDefaultRole(): string;
|
|
662
|
+
/**
|
|
663
|
+
* Update cursor based on component state
|
|
664
|
+
*/
|
|
665
|
+
private updateCursor;
|
|
666
|
+
protected handleAttributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
667
|
+
/**
|
|
668
|
+
* Start loading
|
|
669
|
+
*/
|
|
670
|
+
start(initialMessage?: string): void;
|
|
671
|
+
/**
|
|
672
|
+
* Update current stage progress
|
|
673
|
+
*/
|
|
674
|
+
updateStage(stage: ModelStage, update: Omit<StageUpdate, 'stage'>): void;
|
|
675
|
+
private _updateStageInternal;
|
|
676
|
+
/**
|
|
677
|
+
* Move to a specific stage
|
|
678
|
+
*/
|
|
679
|
+
setStage(stage: ModelStage, options?: {
|
|
680
|
+
message?: string;
|
|
681
|
+
progress?: number;
|
|
682
|
+
}): void;
|
|
683
|
+
/**
|
|
684
|
+
* Mark current stage as completed and move to next
|
|
685
|
+
*/
|
|
686
|
+
completeStage(nextMessage?: string): void;
|
|
687
|
+
/**
|
|
688
|
+
* Complete loading
|
|
689
|
+
*/
|
|
690
|
+
complete(): void;
|
|
691
|
+
/**
|
|
692
|
+
* Set error state
|
|
693
|
+
*/
|
|
694
|
+
error(message: string, stage?: ModelStage): void;
|
|
695
|
+
/**
|
|
696
|
+
* Retry loading from the beginning
|
|
697
|
+
*/
|
|
698
|
+
retry(): void;
|
|
699
|
+
/**
|
|
700
|
+
* Reset the component
|
|
701
|
+
*/
|
|
702
|
+
reset(): void;
|
|
703
|
+
/**
|
|
704
|
+
* Get status icon for a stage
|
|
705
|
+
*/
|
|
706
|
+
private getStageIcon;
|
|
707
|
+
/**
|
|
708
|
+
* Calculate ETA for remaining stages
|
|
709
|
+
*/
|
|
710
|
+
private calculateETA;
|
|
711
|
+
/**
|
|
712
|
+
* Get overall status for rendering
|
|
713
|
+
*/
|
|
714
|
+
private getOverallStatus;
|
|
715
|
+
/**
|
|
716
|
+
* Get status badge text
|
|
717
|
+
*/
|
|
718
|
+
private getStatusBadgeText;
|
|
719
|
+
/**
|
|
720
|
+
* Generate HTML for all stages
|
|
721
|
+
*/
|
|
722
|
+
private generateStagesHtml;
|
|
723
|
+
/**
|
|
724
|
+
* Generate HTML for stats section
|
|
725
|
+
*/
|
|
726
|
+
private generateStatsHtml;
|
|
727
|
+
/**
|
|
728
|
+
* Render the component
|
|
729
|
+
*/
|
|
730
|
+
protected render(): void;
|
|
731
|
+
/**
|
|
732
|
+
* Get current state (for debugging/inspection)
|
|
733
|
+
*/
|
|
734
|
+
getState(): Readonly<ModelLoaderState>;
|
|
735
|
+
/**
|
|
736
|
+
* Get current configuration
|
|
737
|
+
*/
|
|
738
|
+
getConfig(): Readonly<Required<ModelLoaderConfig>>;
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Configuration for ModelLoader component
|
|
743
|
+
*/
|
|
744
|
+
export declare interface ModelLoaderConfig {
|
|
745
|
+
/** Stages to show (default: all) */
|
|
746
|
+
stages?: ModelStage[];
|
|
747
|
+
/** Model name to display */
|
|
748
|
+
modelName?: string;
|
|
749
|
+
/** Show bytes downloaded/total */
|
|
750
|
+
showBytes?: boolean;
|
|
751
|
+
/** Show memory usage */
|
|
752
|
+
showMemoryUsage?: boolean;
|
|
753
|
+
/** Show estimated time remaining */
|
|
754
|
+
showETA?: boolean;
|
|
755
|
+
/** Show retry button on error */
|
|
756
|
+
showRetryButton?: boolean;
|
|
757
|
+
/** Enable smooth progress animation */
|
|
758
|
+
smoothProgress?: boolean;
|
|
759
|
+
/** Update throttle in milliseconds */
|
|
760
|
+
updateThrottle?: number;
|
|
761
|
+
/** Custom retry button label */
|
|
762
|
+
retryLabel?: string;
|
|
763
|
+
/** Enable automatic cursor state changes based on component state */
|
|
764
|
+
cursorFeedback?: boolean;
|
|
765
|
+
/** Component size variant */
|
|
766
|
+
size?: 'compact' | 'default' | 'large';
|
|
767
|
+
/** Visual style variant */
|
|
768
|
+
variant?: 'default' | 'minimal' | 'gradient' | 'glassmorphic';
|
|
769
|
+
/** Animation style */
|
|
770
|
+
animation?: 'none' | 'striped' | 'pulse' | 'glow';
|
|
771
|
+
/** Debug mode */
|
|
772
|
+
debug?: boolean;
|
|
773
|
+
/** Custom CSS class */
|
|
774
|
+
className?: string;
|
|
775
|
+
/** Aria label */
|
|
776
|
+
ariaLabel?: string;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Overall ModelLoader state
|
|
781
|
+
*/
|
|
782
|
+
export declare interface ModelLoaderState {
|
|
783
|
+
currentStage: ModelStage;
|
|
784
|
+
stages: Record<ModelStage, StageState>;
|
|
785
|
+
isLoading: boolean;
|
|
786
|
+
hasError: boolean;
|
|
787
|
+
errorMessage?: string;
|
|
788
|
+
memoryUsage?: number;
|
|
789
|
+
startTime: number;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Loading stages for model initialization
|
|
794
|
+
*/
|
|
795
|
+
export declare type ModelStage = 'download' | 'load' | 'initialize' | 'ready';
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Event detail when any parameter changes
|
|
799
|
+
*/
|
|
800
|
+
export declare interface PanelChangeEvent {
|
|
801
|
+
/** Changed parameter ID */
|
|
802
|
+
parameterId: string;
|
|
803
|
+
/** New value */
|
|
804
|
+
value: number;
|
|
805
|
+
/** Previous value */
|
|
806
|
+
previousValue: number;
|
|
807
|
+
/** All current values */
|
|
808
|
+
allValues: Record<string, number>;
|
|
809
|
+
/** Source of change */
|
|
810
|
+
source: 'slider' | 'input' | 'preset' | 'reset' | 'import';
|
|
811
|
+
/** Timestamp */
|
|
812
|
+
timestamp: number;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* Event detail when panel is reset
|
|
817
|
+
*/
|
|
818
|
+
export declare interface PanelResetEvent {
|
|
819
|
+
/** Previous values before reset */
|
|
820
|
+
previousValues: Record<string, number>;
|
|
821
|
+
/** New values after reset */
|
|
822
|
+
newValues: Record<string, number>;
|
|
823
|
+
/** Timestamp */
|
|
824
|
+
timestamp: number;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Parameter definition for a single slider in the panel
|
|
829
|
+
*/
|
|
830
|
+
export declare interface ParameterDefinition {
|
|
831
|
+
/** Unique parameter ID */
|
|
832
|
+
id: string;
|
|
833
|
+
/** Display label */
|
|
834
|
+
label: string;
|
|
835
|
+
/** Minimum value */
|
|
836
|
+
min: number;
|
|
837
|
+
/** Maximum value */
|
|
838
|
+
max: number;
|
|
839
|
+
/** Current/default value */
|
|
840
|
+
value: number;
|
|
841
|
+
/** Step size for slider */
|
|
842
|
+
step?: number;
|
|
843
|
+
/** Number of decimal places to display */
|
|
844
|
+
decimals?: number;
|
|
845
|
+
/** Parameter description/help text */
|
|
846
|
+
description?: string;
|
|
847
|
+
/** Unit suffix (e.g., '%', 'tokens') */
|
|
848
|
+
unit?: string;
|
|
849
|
+
/** Preset values for this parameter */
|
|
850
|
+
presets?: PresetValue[];
|
|
851
|
+
/** Show manual input field */
|
|
852
|
+
showInput?: boolean;
|
|
853
|
+
/** Show reset button */
|
|
854
|
+
showReset?: boolean;
|
|
855
|
+
/** Disabled state */
|
|
856
|
+
disabled?: boolean;
|
|
857
|
+
/** Validation function */
|
|
858
|
+
validate?: (value: number, allValues: Record<string, number>) => boolean | string;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* ParameterPanel Component
|
|
863
|
+
*
|
|
864
|
+
* Manages multiple AI parameters as a coordinated group with presets, validation, and export/import.
|
|
865
|
+
* Automatically creates and manages child ParameterSlider instances.
|
|
866
|
+
*
|
|
867
|
+
* @example
|
|
868
|
+
* ```typescript
|
|
869
|
+
* // Create LLM configuration panel
|
|
870
|
+
* const panel = new ParameterPanel({
|
|
871
|
+
* title: 'Model Configuration',
|
|
872
|
+
* parameters: [
|
|
873
|
+
* { id: 'temperature', label: 'Temperature', min: 0, max: 2, value: 0.7, step: 0.1 },
|
|
874
|
+
* { id: 'topP', label: 'Top-P', min: 0, max: 1, value: 0.9, step: 0.05 },
|
|
875
|
+
* { id: 'maxTokens', label: 'Max Tokens', min: 100, max: 4000, value: 2000, step: 100 }
|
|
876
|
+
* ],
|
|
877
|
+
* presets: {
|
|
878
|
+
* chatgpt: {
|
|
879
|
+
* name: 'ChatGPT',
|
|
880
|
+
* description: 'Balanced configuration',
|
|
881
|
+
* values: { temperature: 0.7, topP: 0.9, maxTokens: 2000 }
|
|
882
|
+
* },
|
|
883
|
+
* code: {
|
|
884
|
+
* name: 'Code Generation',
|
|
885
|
+
* description: 'More focused for code',
|
|
886
|
+
* values: { temperature: 0.2, topP: 0.8, maxTokens: 1000 }
|
|
887
|
+
* }
|
|
888
|
+
* }
|
|
889
|
+
* });
|
|
890
|
+
*
|
|
891
|
+
* document.body.appendChild(panel);
|
|
892
|
+
*
|
|
893
|
+
* // Get all values
|
|
894
|
+
* const config = panel.getAllValues();
|
|
895
|
+
* // { temperature: 0.7, topP: 0.9, maxTokens: 2000 }
|
|
896
|
+
*
|
|
897
|
+
* // Load preset
|
|
898
|
+
* panel.loadPreset('code');
|
|
899
|
+
*
|
|
900
|
+
* // Listen to changes
|
|
901
|
+
* panel.addEventListener('panelchange', (e) => {
|
|
902
|
+
* console.log('Changed parameter:', e.detail.parameterId);
|
|
903
|
+
* console.log('All values:', e.detail.allValues);
|
|
904
|
+
* });
|
|
905
|
+
* ```
|
|
906
|
+
*
|
|
907
|
+
* @fires panelchange - Fired when any parameter changes
|
|
908
|
+
* @fires presetload - Fired when preset is loaded
|
|
909
|
+
* @fires configexport - Fired when configuration is exported
|
|
910
|
+
* @fires configimport - Fired when configuration is imported
|
|
911
|
+
* @fires panelreset - Fired when panel is reset
|
|
912
|
+
* @fires validationerror - Fired when validation fails
|
|
913
|
+
*/
|
|
914
|
+
export declare class ParameterPanel extends AIControl {
|
|
915
|
+
private readonly state;
|
|
916
|
+
private readonly parameters;
|
|
917
|
+
private readonly parameterDefinitions;
|
|
918
|
+
private readonly presets;
|
|
919
|
+
private readonly panelConfig;
|
|
920
|
+
constructor(config: ParameterPanelConfig);
|
|
921
|
+
/**
|
|
922
|
+
* Get all parameter values
|
|
923
|
+
*/
|
|
924
|
+
getAllValues(): Record<string, number>;
|
|
925
|
+
/**
|
|
926
|
+
* Get specific parameter value
|
|
927
|
+
*/
|
|
928
|
+
getValue(parameterId: string): number | undefined;
|
|
929
|
+
/**
|
|
930
|
+
* Set specific parameter value
|
|
931
|
+
*/
|
|
932
|
+
setValue(parameterId: string, value: number, source?: 'slider' | 'input' | 'preset' | 'reset' | 'import'): void;
|
|
933
|
+
/**
|
|
934
|
+
* Load preset values
|
|
935
|
+
*/
|
|
936
|
+
loadPreset(presetId: string): void;
|
|
937
|
+
/**
|
|
938
|
+
* Reset all parameters to default values
|
|
939
|
+
*/
|
|
940
|
+
resetAll(): void;
|
|
941
|
+
/**
|
|
942
|
+
* Export configuration as JSON
|
|
943
|
+
*/
|
|
944
|
+
exportConfig(): ExportedConfig;
|
|
945
|
+
/**
|
|
946
|
+
* Import configuration from JSON
|
|
947
|
+
*/
|
|
948
|
+
importConfig(config: ExportedConfig): void;
|
|
949
|
+
/**
|
|
950
|
+
* Toggle collapsed state
|
|
951
|
+
*/
|
|
952
|
+
toggleCollapse(): void;
|
|
953
|
+
/**
|
|
954
|
+
* Validate all parameters
|
|
955
|
+
*/
|
|
956
|
+
validateAll(): boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Add custom preset
|
|
959
|
+
*/
|
|
960
|
+
addPreset(id: string, name: string, values: Record<string, number>, description?: string): void;
|
|
961
|
+
/**
|
|
962
|
+
* Remove custom preset
|
|
963
|
+
*/
|
|
964
|
+
removePreset(id: string): void;
|
|
965
|
+
private dispatchPanelChange;
|
|
966
|
+
private dispatchPresetLoad;
|
|
967
|
+
private dispatchConfigExport;
|
|
968
|
+
private dispatchConfigImport;
|
|
969
|
+
private dispatchPanelReset;
|
|
970
|
+
private dispatchValidationError;
|
|
971
|
+
private saveToStorage;
|
|
972
|
+
private loadFromStorage;
|
|
973
|
+
private savePresetsToStorage;
|
|
974
|
+
private loadPresetsFromStorage;
|
|
975
|
+
protected render(): void;
|
|
976
|
+
private renderHeader;
|
|
977
|
+
private renderErrors;
|
|
978
|
+
private renderPresets;
|
|
979
|
+
private renderParameters;
|
|
980
|
+
private renderActions;
|
|
981
|
+
private attachEventListeners;
|
|
982
|
+
private createParameterSliders;
|
|
983
|
+
private handleExport;
|
|
984
|
+
private handleImport;
|
|
985
|
+
/**
|
|
986
|
+
* Clean up when component is removed
|
|
987
|
+
*/
|
|
988
|
+
disconnectedCallback(): void;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
/**
|
|
992
|
+
* Configuration options for ParameterPanel
|
|
993
|
+
*/
|
|
994
|
+
export declare interface ParameterPanelConfig {
|
|
995
|
+
/** Array of parameter definitions */
|
|
996
|
+
parameters: ParameterDefinition[];
|
|
997
|
+
/** Built-in and custom presets */
|
|
998
|
+
presets?: Record<string, PresetConfiguration>;
|
|
999
|
+
/** Default preset to load on initialization */
|
|
1000
|
+
defaultPreset?: string;
|
|
1001
|
+
/** Layout style: grid or vertical */
|
|
1002
|
+
layout?: 'grid' | 'vertical';
|
|
1003
|
+
/** Number of columns for grid layout */
|
|
1004
|
+
columns?: number;
|
|
1005
|
+
/** Panel title */
|
|
1006
|
+
title?: string;
|
|
1007
|
+
/** Show preset selector buttons */
|
|
1008
|
+
showPresets?: boolean;
|
|
1009
|
+
/** Show reset all button */
|
|
1010
|
+
showResetAll?: boolean;
|
|
1011
|
+
/** Show export/import buttons */
|
|
1012
|
+
showExportImport?: boolean;
|
|
1013
|
+
/** Enable value persistence to localStorage */
|
|
1014
|
+
persistValues?: boolean;
|
|
1015
|
+
/** Enable preset persistence to localStorage */
|
|
1016
|
+
persistPresets?: boolean;
|
|
1017
|
+
/** LocalStorage key for persistence */
|
|
1018
|
+
storageKey?: string;
|
|
1019
|
+
/** Make panel collapsible */
|
|
1020
|
+
collapsible?: boolean;
|
|
1021
|
+
/** Start collapsed */
|
|
1022
|
+
startCollapsed?: boolean;
|
|
1023
|
+
/** Validate parameters on change */
|
|
1024
|
+
validateOnChange?: boolean;
|
|
1025
|
+
/** Emit change events */
|
|
1026
|
+
emitChangeEvents?: boolean;
|
|
1027
|
+
/** Disabled state for entire panel */
|
|
1028
|
+
disabled?: boolean;
|
|
1029
|
+
/** Enable debug logging */
|
|
1030
|
+
debug?: boolean;
|
|
1031
|
+
/** Additional CSS class */
|
|
1032
|
+
className?: string;
|
|
1033
|
+
/** ARIA label for accessibility */
|
|
1034
|
+
ariaLabel?: string;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Internal state of the ParameterPanel
|
|
1039
|
+
*/
|
|
1040
|
+
export declare interface ParameterPanelState {
|
|
1041
|
+
/** Current values for all parameters */
|
|
1042
|
+
values: Record<string, number>;
|
|
1043
|
+
/** Currently active preset name */
|
|
1044
|
+
activePreset: string | null;
|
|
1045
|
+
/** Is panel collapsed */
|
|
1046
|
+
isCollapsed: boolean;
|
|
1047
|
+
/** Validation errors by parameter ID */
|
|
1048
|
+
errors: Record<string, string>;
|
|
1049
|
+
/** Are any parameters being modified */
|
|
1050
|
+
isDirty: boolean;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* ParameterSlider Component
|
|
1055
|
+
*
|
|
1056
|
+
* Interactive slider for AI parameter configuration (temperature, top-p, penalties, etc.).
|
|
1057
|
+
* Supports presets, manual input, keyboard navigation, and accessibility.
|
|
1058
|
+
*
|
|
1059
|
+
* @example
|
|
1060
|
+
* ```typescript
|
|
1061
|
+
* // Create temperature slider
|
|
1062
|
+
* const slider = new ParameterSlider({
|
|
1063
|
+
* label: 'Temperature',
|
|
1064
|
+
* min: 0,
|
|
1065
|
+
* max: 2,
|
|
1066
|
+
* value: 0.7,
|
|
1067
|
+
* step: 0.1,
|
|
1068
|
+
* description: 'Controls randomness in responses',
|
|
1069
|
+
* presets: [
|
|
1070
|
+
* { value: 0, label: 'Focused' },
|
|
1071
|
+
* { value: 0.7, label: 'Balanced' },
|
|
1072
|
+
* { value: 1.5, label: 'Creative' }
|
|
1073
|
+
* ]
|
|
1074
|
+
* });
|
|
1075
|
+
*
|
|
1076
|
+
* document.body.appendChild(slider);
|
|
1077
|
+
*
|
|
1078
|
+
* // Listen to value changes
|
|
1079
|
+
* slider.addEventListener('valuechange', (e) => {
|
|
1080
|
+
* console.log('New value:', e.detail.value);
|
|
1081
|
+
* });
|
|
1082
|
+
*
|
|
1083
|
+
* // Get current value
|
|
1084
|
+
* const value = slider.getValue();
|
|
1085
|
+
*
|
|
1086
|
+
* // Set value programmatically
|
|
1087
|
+
* slider.setValue(1.2);
|
|
1088
|
+
* ```
|
|
1089
|
+
*
|
|
1090
|
+
* @fires valuechange - Fired when value changes
|
|
1091
|
+
* @fires presetselect - Fired when preset is selected
|
|
1092
|
+
*/
|
|
1093
|
+
export declare class ParameterSlider extends AIControl {
|
|
1094
|
+
protected config: Required<ParameterSliderConfig>;
|
|
1095
|
+
private readonly state;
|
|
1096
|
+
private sliderTrack;
|
|
1097
|
+
private sliderThumb;
|
|
1098
|
+
static get observedAttributes(): string[];
|
|
1099
|
+
constructor(config?: ParameterSliderConfig);
|
|
1100
|
+
connectedCallback(): void;
|
|
1101
|
+
disconnectedCallback(): void;
|
|
1102
|
+
protected getDefaultRole(): string;
|
|
1103
|
+
protected handleAttributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
1104
|
+
/**
|
|
1105
|
+
* Get current value
|
|
1106
|
+
*/
|
|
1107
|
+
getValue(): number;
|
|
1108
|
+
/**
|
|
1109
|
+
* Set value programmatically
|
|
1110
|
+
*/
|
|
1111
|
+
setValue(value: number, source?: 'slider' | 'input' | 'preset' | 'reset'): void;
|
|
1112
|
+
/**
|
|
1113
|
+
* Reset to default value
|
|
1114
|
+
*/
|
|
1115
|
+
reset(): void;
|
|
1116
|
+
/**
|
|
1117
|
+
* Select a preset value
|
|
1118
|
+
*/
|
|
1119
|
+
selectPreset(preset: PresetValue): void;
|
|
1120
|
+
/**
|
|
1121
|
+
* Attach event listeners to slider elements
|
|
1122
|
+
*/
|
|
1123
|
+
private attachEventListeners;
|
|
1124
|
+
/**
|
|
1125
|
+
* Remove event listeners
|
|
1126
|
+
*/
|
|
1127
|
+
private removeEventListeners;
|
|
1128
|
+
/**
|
|
1129
|
+
* Handle track click
|
|
1130
|
+
*/
|
|
1131
|
+
private handleTrackClick;
|
|
1132
|
+
/**
|
|
1133
|
+
* Handle thumb mouse down
|
|
1134
|
+
*/
|
|
1135
|
+
private handleThumbMouseDown;
|
|
1136
|
+
/**
|
|
1137
|
+
* Handle thumb mouse move
|
|
1138
|
+
*/
|
|
1139
|
+
private readonly handleThumbMouseMove;
|
|
1140
|
+
/**
|
|
1141
|
+
* Handle thumb mouse up
|
|
1142
|
+
*/
|
|
1143
|
+
private readonly handleThumbMouseUp;
|
|
1144
|
+
/**
|
|
1145
|
+
* Handle thumb touch start
|
|
1146
|
+
*/
|
|
1147
|
+
private handleThumbTouchStart;
|
|
1148
|
+
/**
|
|
1149
|
+
* Handle thumb touch move
|
|
1150
|
+
*/
|
|
1151
|
+
private readonly handleThumbTouchMove;
|
|
1152
|
+
/**
|
|
1153
|
+
* Handle thumb touch end
|
|
1154
|
+
*/
|
|
1155
|
+
private readonly handleThumbTouchEnd;
|
|
1156
|
+
/**
|
|
1157
|
+
* Handle keyboard navigation
|
|
1158
|
+
*/
|
|
1159
|
+
private handleThumbKeyDown;
|
|
1160
|
+
/**
|
|
1161
|
+
* Handle input field change
|
|
1162
|
+
*/
|
|
1163
|
+
private handleInputChange;
|
|
1164
|
+
/**
|
|
1165
|
+
* Handle input field blur (validate)
|
|
1166
|
+
*/
|
|
1167
|
+
private handleInputBlur;
|
|
1168
|
+
/**
|
|
1169
|
+
* Update slider thumb position based on current value
|
|
1170
|
+
*/
|
|
1171
|
+
private updateSliderPosition;
|
|
1172
|
+
/**
|
|
1173
|
+
* Update cursor based on slider state
|
|
1174
|
+
*/
|
|
1175
|
+
private updateCursor;
|
|
1176
|
+
/**
|
|
1177
|
+
* Update active preset button
|
|
1178
|
+
*/
|
|
1179
|
+
private updateActivePreset;
|
|
1180
|
+
/**
|
|
1181
|
+
* Render input controls section
|
|
1182
|
+
*/
|
|
1183
|
+
private renderInputControls;
|
|
1184
|
+
/**
|
|
1185
|
+
* Render the component
|
|
1186
|
+
*/
|
|
1187
|
+
protected render(): void;
|
|
1188
|
+
/**
|
|
1189
|
+
* Get current state (for debugging)
|
|
1190
|
+
*/
|
|
1191
|
+
getState(): Readonly<ParameterSliderState>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Get current configuration
|
|
1194
|
+
*/
|
|
1195
|
+
getConfig(): Readonly<Required<ParameterSliderConfig>>;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
/**
|
|
1199
|
+
* Configuration options for ParameterSlider
|
|
1200
|
+
*/
|
|
1201
|
+
export declare interface ParameterSliderConfig {
|
|
1202
|
+
/** Parameter label */
|
|
1203
|
+
label?: string;
|
|
1204
|
+
/** Minimum value */
|
|
1205
|
+
min?: number;
|
|
1206
|
+
/** Maximum value */
|
|
1207
|
+
max?: number;
|
|
1208
|
+
/** Current value */
|
|
1209
|
+
value?: number;
|
|
1210
|
+
/** Default value to reset to */
|
|
1211
|
+
defaultValue?: number;
|
|
1212
|
+
/** Step size for slider */
|
|
1213
|
+
step?: number;
|
|
1214
|
+
/** Number of decimal places to display */
|
|
1215
|
+
decimals?: number;
|
|
1216
|
+
/** Parameter description/help text */
|
|
1217
|
+
description?: string;
|
|
1218
|
+
/** Show preset value buttons */
|
|
1219
|
+
showPresets?: boolean;
|
|
1220
|
+
/** Preset values with labels */
|
|
1221
|
+
presets?: PresetValue[];
|
|
1222
|
+
/** Show manual input field */
|
|
1223
|
+
showInput?: boolean;
|
|
1224
|
+
/** Show reset button */
|
|
1225
|
+
showReset?: boolean;
|
|
1226
|
+
/** Show range labels (min/max) */
|
|
1227
|
+
showRangeLabels?: boolean;
|
|
1228
|
+
/** Unit suffix (e.g., '%', 'tokens') */
|
|
1229
|
+
unit?: string;
|
|
1230
|
+
/** Enable automatic cursor state changes based on component state */
|
|
1231
|
+
cursorFeedback?: boolean;
|
|
1232
|
+
/** Component size variant */
|
|
1233
|
+
size?: 'compact' | 'default' | 'large';
|
|
1234
|
+
/** Visual style variant */
|
|
1235
|
+
variant?: 'default' | 'minimal' | 'gradient' | 'glassmorphic';
|
|
1236
|
+
/** Animation style */
|
|
1237
|
+
animation?: 'none' | 'striped' | 'pulse' | 'glow';
|
|
1238
|
+
/** Disabled state */
|
|
1239
|
+
disabled?: boolean;
|
|
1240
|
+
/** Enable debug logging */
|
|
1241
|
+
debug?: boolean;
|
|
1242
|
+
/** Additional CSS class */
|
|
1243
|
+
className?: string;
|
|
1244
|
+
/** ARIA label for accessibility */
|
|
1245
|
+
ariaLabel?: string;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Internal state of the ParameterSlider
|
|
1250
|
+
*/
|
|
1251
|
+
export declare interface ParameterSliderState {
|
|
1252
|
+
currentValue: number;
|
|
1253
|
+
isDragging: boolean;
|
|
1254
|
+
isFocused: boolean;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Parse CSS color to RGB
|
|
1259
|
+
*/
|
|
1260
|
+
export declare function parseColor(color: string): {
|
|
1261
|
+
r: number;
|
|
1262
|
+
g: number;
|
|
1263
|
+
b: number;
|
|
1264
|
+
} | null;
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* Event data for position change
|
|
1268
|
+
*/
|
|
1269
|
+
export declare interface PositionChangeEvent {
|
|
1270
|
+
previousPosition: number;
|
|
1271
|
+
currentPosition: number;
|
|
1272
|
+
queueSize: number;
|
|
1273
|
+
estimatedWait: number;
|
|
1274
|
+
timestamp: number;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Check if reduced motion is preferred
|
|
1279
|
+
*/
|
|
1280
|
+
export declare function prefersReducedMotion(): boolean;
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* Preset configuration containing values for all parameters
|
|
1284
|
+
*/
|
|
1285
|
+
export declare interface PresetConfiguration {
|
|
1286
|
+
/** Preset name (display) */
|
|
1287
|
+
name: string;
|
|
1288
|
+
/** Preset description */
|
|
1289
|
+
description?: string;
|
|
1290
|
+
/** Parameter values */
|
|
1291
|
+
values: Record<string, number>;
|
|
1292
|
+
/** Optional icon/emoji */
|
|
1293
|
+
icon?: string;
|
|
1294
|
+
/** Is this a built-in preset? */
|
|
1295
|
+
isBuiltIn?: boolean;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
/**
|
|
1299
|
+
* Event detail when preset is loaded
|
|
1300
|
+
*/
|
|
1301
|
+
export declare interface PresetLoadEvent {
|
|
1302
|
+
/** Preset name/ID */
|
|
1303
|
+
presetId: string;
|
|
1304
|
+
/** Preset configuration */
|
|
1305
|
+
preset: PresetConfiguration;
|
|
1306
|
+
/** Previous values before preset load */
|
|
1307
|
+
previousValues: Record<string, number>;
|
|
1308
|
+
/** Timestamp */
|
|
1309
|
+
timestamp: number;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Event detail for preset selection
|
|
1314
|
+
*/
|
|
1315
|
+
export declare interface PresetSelectEvent {
|
|
1316
|
+
preset: PresetValue;
|
|
1317
|
+
previousValue: number;
|
|
1318
|
+
timestamp: number;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/**
|
|
1322
|
+
* Preset configuration for common values
|
|
1323
|
+
*/
|
|
1324
|
+
export declare interface PresetValue {
|
|
1325
|
+
value: number;
|
|
1326
|
+
label: string;
|
|
1327
|
+
description?: string;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Event detail for progress updates
|
|
1332
|
+
*/
|
|
1333
|
+
export declare interface ProgressUpdateEvent {
|
|
1334
|
+
current: number;
|
|
1335
|
+
total?: number;
|
|
1336
|
+
percentage?: number;
|
|
1337
|
+
message?: string;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* Event data for queue complete
|
|
1342
|
+
*/
|
|
1343
|
+
export declare interface QueueCompleteEvent {
|
|
1344
|
+
totalWaitTime: number;
|
|
1345
|
+
startPosition: number;
|
|
1346
|
+
timestamp: number;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Event data for queue error
|
|
1351
|
+
*/
|
|
1352
|
+
export declare interface QueueErrorEvent {
|
|
1353
|
+
message: string;
|
|
1354
|
+
position: number;
|
|
1355
|
+
timestamp: number;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
/**
|
|
1359
|
+
* QueueProgress Component
|
|
1360
|
+
*
|
|
1361
|
+
* Displays queue position and estimated wait time for rate-limited AI APIs.
|
|
1362
|
+
* Shows position updates, processing rate, and estimated wait time.
|
|
1363
|
+
*
|
|
1364
|
+
* @example
|
|
1365
|
+
* ```typescript
|
|
1366
|
+
* // Create the component
|
|
1367
|
+
* const queue = new QueueProgress({
|
|
1368
|
+
* position: 47,
|
|
1369
|
+
* queueSize: 120,
|
|
1370
|
+
* estimatedWait: 180, // 3 minutes
|
|
1371
|
+
* processingRate: 3, // 3 requests per second
|
|
1372
|
+
* });
|
|
1373
|
+
*
|
|
1374
|
+
* document.body.appendChild(queue);
|
|
1375
|
+
*
|
|
1376
|
+
* // Start tracking
|
|
1377
|
+
* queue.start();
|
|
1378
|
+
*
|
|
1379
|
+
* // Update position
|
|
1380
|
+
* queue.update({
|
|
1381
|
+
* position: 25,
|
|
1382
|
+
* estimatedWait: 90
|
|
1383
|
+
* });
|
|
1384
|
+
*
|
|
1385
|
+
* // Complete
|
|
1386
|
+
* queue.complete();
|
|
1387
|
+
*
|
|
1388
|
+
* // Listen to events
|
|
1389
|
+
* queue.addEventListener('positionchange', (e) => {
|
|
1390
|
+
* console.log('Position changed', e.detail);
|
|
1391
|
+
* });
|
|
1392
|
+
* ```
|
|
1393
|
+
*
|
|
1394
|
+
* @fires queuestart - Fired when queue tracking starts
|
|
1395
|
+
* @fires positionchange - Fired when position updates
|
|
1396
|
+
* @fires queuecomplete - Fired when processing begins
|
|
1397
|
+
* @fires queueerror - Fired when an error occurs
|
|
1398
|
+
*/
|
|
1399
|
+
export declare class QueueProgress extends AIControl {
|
|
1400
|
+
protected config: Required<QueueProgressConfig>;
|
|
1401
|
+
private state;
|
|
1402
|
+
private readonly updateThrottled;
|
|
1403
|
+
private timerInterval;
|
|
1404
|
+
private initialPosition;
|
|
1405
|
+
static get observedAttributes(): string[];
|
|
1406
|
+
constructor(config?: QueueProgressConfig);
|
|
1407
|
+
connectedCallback(): void;
|
|
1408
|
+
disconnectedCallback(): void;
|
|
1409
|
+
protected getDefaultRole(): string;
|
|
1410
|
+
protected handleAttributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
1411
|
+
/**
|
|
1412
|
+
* Start queue tracking
|
|
1413
|
+
*/
|
|
1414
|
+
start(message?: string): void;
|
|
1415
|
+
/**
|
|
1416
|
+
* Update queue position
|
|
1417
|
+
*/
|
|
1418
|
+
update(update: QueueUpdate): void;
|
|
1419
|
+
private _updateInternal;
|
|
1420
|
+
/**
|
|
1421
|
+
* Mark as processing (reached front of queue)
|
|
1422
|
+
*/
|
|
1423
|
+
complete(): void;
|
|
1424
|
+
/**
|
|
1425
|
+
* Cancel queue
|
|
1426
|
+
*/
|
|
1427
|
+
cancel(reason?: string): void;
|
|
1428
|
+
/**
|
|
1429
|
+
* Handle error
|
|
1430
|
+
*/
|
|
1431
|
+
error(errorMessage: string): void;
|
|
1432
|
+
/**
|
|
1433
|
+
* Reset to initial state
|
|
1434
|
+
*/
|
|
1435
|
+
reset(): void;
|
|
1436
|
+
/**
|
|
1437
|
+
* Get current position
|
|
1438
|
+
*/
|
|
1439
|
+
getPosition(): number;
|
|
1440
|
+
/**
|
|
1441
|
+
* Get current status
|
|
1442
|
+
*/
|
|
1443
|
+
getStatus(): QueueStatus;
|
|
1444
|
+
/**
|
|
1445
|
+
* Start elapsed time timer
|
|
1446
|
+
*/
|
|
1447
|
+
protected startTimer(): void;
|
|
1448
|
+
/**
|
|
1449
|
+
* Stop timer
|
|
1450
|
+
*/
|
|
1451
|
+
private stopTimer;
|
|
1452
|
+
/**
|
|
1453
|
+
* Calculate progress percentage
|
|
1454
|
+
*/
|
|
1455
|
+
private getProgressPercentage;
|
|
1456
|
+
/**
|
|
1457
|
+
* Update cursor based on queue state
|
|
1458
|
+
*/
|
|
1459
|
+
private updateCursor;
|
|
1460
|
+
/**
|
|
1461
|
+
* Render metrics section
|
|
1462
|
+
*/
|
|
1463
|
+
private renderMetrics;
|
|
1464
|
+
/**
|
|
1465
|
+
* Render component
|
|
1466
|
+
*/
|
|
1467
|
+
protected render(): void;
|
|
1468
|
+
private getStatusIcon;
|
|
1469
|
+
private getStatusText;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Configuration for QueueProgress component
|
|
1474
|
+
*/
|
|
1475
|
+
export declare interface QueueProgressConfig {
|
|
1476
|
+
/** Initial position in queue */
|
|
1477
|
+
position?: number;
|
|
1478
|
+
/** Total queue size */
|
|
1479
|
+
queueSize?: number;
|
|
1480
|
+
/** Estimated wait time in seconds */
|
|
1481
|
+
estimatedWait?: number;
|
|
1482
|
+
/** Processing rate (items per second) */
|
|
1483
|
+
processingRate?: number;
|
|
1484
|
+
/** Show position counter */
|
|
1485
|
+
showPosition?: boolean;
|
|
1486
|
+
/** Show estimated wait time */
|
|
1487
|
+
showWaitTime?: boolean;
|
|
1488
|
+
/** Show processing rate */
|
|
1489
|
+
showRate?: boolean;
|
|
1490
|
+
/** Show queue size */
|
|
1491
|
+
showQueueSize?: boolean;
|
|
1492
|
+
/** Show visual progress bar */
|
|
1493
|
+
showProgressBar?: boolean;
|
|
1494
|
+
/** Custom message */
|
|
1495
|
+
message?: string;
|
|
1496
|
+
/** Enable animations */
|
|
1497
|
+
animate?: boolean;
|
|
1498
|
+
/** Update throttle in milliseconds */
|
|
1499
|
+
updateThrottle?: number;
|
|
1500
|
+
/** Enable automatic cursor state changes based on component state */
|
|
1501
|
+
cursorFeedback?: boolean;
|
|
1502
|
+
/** Component size variant */
|
|
1503
|
+
size?: 'compact' | 'default' | 'large';
|
|
1504
|
+
/** Visual style variant */
|
|
1505
|
+
variant?: 'default' | 'minimal' | 'gradient' | 'glassmorphic';
|
|
1506
|
+
/** Animation style */
|
|
1507
|
+
animation?: 'none' | 'striped' | 'pulse' | 'glow';
|
|
1508
|
+
/** Debug mode */
|
|
1509
|
+
debug?: boolean;
|
|
1510
|
+
/** Custom CSS class */
|
|
1511
|
+
className?: string;
|
|
1512
|
+
/** Aria label */
|
|
1513
|
+
ariaLabel?: string;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* QueueProgress state
|
|
1518
|
+
*/
|
|
1519
|
+
export declare interface QueueProgressState {
|
|
1520
|
+
status: QueueStatus;
|
|
1521
|
+
position: number;
|
|
1522
|
+
queueSize: number;
|
|
1523
|
+
estimatedWait: number;
|
|
1524
|
+
processingRate: number;
|
|
1525
|
+
startTime: number;
|
|
1526
|
+
message?: string;
|
|
1527
|
+
elapsedTime: number;
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* Event data for queue start
|
|
1532
|
+
*/
|
|
1533
|
+
export declare interface QueueStartEvent {
|
|
1534
|
+
position: number;
|
|
1535
|
+
queueSize: number;
|
|
1536
|
+
estimatedWait: number;
|
|
1537
|
+
timestamp: number;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* Queue status types
|
|
1542
|
+
*/
|
|
1543
|
+
export declare type QueueStatus = 'waiting' | 'processing' | 'completed' | 'cancelled' | 'error';
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Update data for queue position
|
|
1547
|
+
*/
|
|
1548
|
+
export declare interface QueueUpdate {
|
|
1549
|
+
position?: number;
|
|
1550
|
+
queueSize?: number;
|
|
1551
|
+
estimatedWait?: number;
|
|
1552
|
+
processingRate?: number;
|
|
1553
|
+
message?: string;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Event detail for retry attempt start
|
|
1558
|
+
*/
|
|
1559
|
+
export declare interface RetryAttemptEvent {
|
|
1560
|
+
attempt: number;
|
|
1561
|
+
maxAttempts: number;
|
|
1562
|
+
message: string;
|
|
1563
|
+
timestamp: number;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Data for retry attempt updates
|
|
1568
|
+
*/
|
|
1569
|
+
export declare interface RetryAttemptUpdate {
|
|
1570
|
+
/** New attempt number */
|
|
1571
|
+
attempt?: number;
|
|
1572
|
+
/** Operation message */
|
|
1573
|
+
message?: string;
|
|
1574
|
+
/** Error from last attempt */
|
|
1575
|
+
error?: Error;
|
|
1576
|
+
/** Override calculated delay (ms) */
|
|
1577
|
+
delay?: number;
|
|
1578
|
+
}
|
|
1579
|
+
|
|
1580
|
+
/**
|
|
1581
|
+
* Event detail for retry cancellation
|
|
1582
|
+
*/
|
|
1583
|
+
export declare interface RetryCancelEvent {
|
|
1584
|
+
attempt: number;
|
|
1585
|
+
reason?: string;
|
|
1586
|
+
timestamp: number;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
/**
|
|
1590
|
+
* Event detail for retry failure (max attempts reached)
|
|
1591
|
+
*/
|
|
1592
|
+
export declare interface RetryFailureEvent {
|
|
1593
|
+
totalAttempts: number;
|
|
1594
|
+
lastError?: Error;
|
|
1595
|
+
elapsedTime: number;
|
|
1596
|
+
timestamp: number;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
/**
|
|
1600
|
+
* RetryProgress Component
|
|
1601
|
+
*
|
|
1602
|
+
* Displays retry progress with exponential backoff, attempt tracking, and error handling.
|
|
1603
|
+
* Perfect for handling transient failures in API calls, network requests, or AI operations.
|
|
1604
|
+
*
|
|
1605
|
+
* @example
|
|
1606
|
+
* ```typescript
|
|
1607
|
+
* // Create the component
|
|
1608
|
+
* const retry = new RetryProgress({
|
|
1609
|
+
* maxAttempts: 5,
|
|
1610
|
+
* initialDelay: 1000,
|
|
1611
|
+
* strategy: 'exponential',
|
|
1612
|
+
* allowManualRetry: true,
|
|
1613
|
+
* });
|
|
1614
|
+
*
|
|
1615
|
+
* document.body.appendChild(retry);
|
|
1616
|
+
*
|
|
1617
|
+
* // Start first attempt
|
|
1618
|
+
* retry.attempt('Connecting to API...');
|
|
1619
|
+
*
|
|
1620
|
+
* // If it fails, start waiting for retry
|
|
1621
|
+
* retry.waitForRetry({
|
|
1622
|
+
* attempt: 2,
|
|
1623
|
+
* error: new Error('Connection timeout'),
|
|
1624
|
+
* });
|
|
1625
|
+
*
|
|
1626
|
+
* // On success
|
|
1627
|
+
* retry.success('Connected successfully!');
|
|
1628
|
+
*
|
|
1629
|
+
* // Listen to events
|
|
1630
|
+
* retry.addEventListener('retryattempt', (e) => {
|
|
1631
|
+
* console.log('Attempting:', e.detail);
|
|
1632
|
+
* });
|
|
1633
|
+
* ```
|
|
1634
|
+
*
|
|
1635
|
+
* @fires retryattempt - Fired when a retry attempt starts
|
|
1636
|
+
* @fires retrywaiting - Fired when waiting for next retry
|
|
1637
|
+
* @fires retrysuccess - Fired when operation succeeds
|
|
1638
|
+
* @fires retryfailure - Fired when max attempts reached
|
|
1639
|
+
* @fires retrycancel - Fired when retry is cancelled
|
|
1640
|
+
* @fires manualretry - Fired when user manually triggers retry
|
|
1641
|
+
*/
|
|
1642
|
+
export declare class RetryProgress extends AIControl {
|
|
1643
|
+
protected config: Required<RetryProgressConfig>;
|
|
1644
|
+
private state;
|
|
1645
|
+
private waitTimer?;
|
|
1646
|
+
private elapsedTimer?;
|
|
1647
|
+
private progressTimer?;
|
|
1648
|
+
constructor(config?: RetryProgressConfig);
|
|
1649
|
+
/**
|
|
1650
|
+
* Read max-attempts attribute
|
|
1651
|
+
*/
|
|
1652
|
+
private _readMaxAttemptsAttribute;
|
|
1653
|
+
/**
|
|
1654
|
+
* Read initial-delay attribute
|
|
1655
|
+
*/
|
|
1656
|
+
private _readInitialDelayAttribute;
|
|
1657
|
+
/**
|
|
1658
|
+
* Read max-delay attribute
|
|
1659
|
+
*/
|
|
1660
|
+
private _readMaxDelayAttribute;
|
|
1661
|
+
/**
|
|
1662
|
+
* Read backoff-multiplier attribute
|
|
1663
|
+
*/
|
|
1664
|
+
private _readBackoffMultiplierAttribute;
|
|
1665
|
+
/**
|
|
1666
|
+
* Read strategy attribute
|
|
1667
|
+
*/
|
|
1668
|
+
private _readStrategyAttribute;
|
|
1669
|
+
/**
|
|
1670
|
+
* Read boolean attributes
|
|
1671
|
+
*/
|
|
1672
|
+
private _readBooleanAttributes;
|
|
1673
|
+
/**
|
|
1674
|
+
* Connected callback - read initial attributes
|
|
1675
|
+
*/
|
|
1676
|
+
connectedCallback(): void;
|
|
1677
|
+
/**
|
|
1678
|
+
* Calculate delay for retry attempt based on strategy
|
|
1679
|
+
*/
|
|
1680
|
+
private calculateDelay;
|
|
1681
|
+
/**
|
|
1682
|
+
* Calculate fibonacci number
|
|
1683
|
+
*/
|
|
1684
|
+
private fibonacci;
|
|
1685
|
+
/**
|
|
1686
|
+
* Start a retry attempt
|
|
1687
|
+
*/
|
|
1688
|
+
attempt(message?: string): void;
|
|
1689
|
+
/**
|
|
1690
|
+
* Wait for next retry with optional error
|
|
1691
|
+
*/
|
|
1692
|
+
waitForRetry(update?: RetryAttemptUpdate): void;
|
|
1693
|
+
/**
|
|
1694
|
+
* Mark operation as successful
|
|
1695
|
+
*/
|
|
1696
|
+
success(message?: string): void;
|
|
1697
|
+
/**
|
|
1698
|
+
* Mark operation as failed (max attempts reached)
|
|
1699
|
+
*/
|
|
1700
|
+
failure(error?: Error): void;
|
|
1701
|
+
/**
|
|
1702
|
+
* Cancel retry operation
|
|
1703
|
+
*/
|
|
1704
|
+
cancel(reason?: string): void;
|
|
1705
|
+
/**
|
|
1706
|
+
* Reset to initial state
|
|
1707
|
+
*/
|
|
1708
|
+
reset(): void;
|
|
1709
|
+
/**
|
|
1710
|
+
* Get current attempt number
|
|
1711
|
+
*/
|
|
1712
|
+
getAttempt(): number;
|
|
1713
|
+
/**
|
|
1714
|
+
* Get current status
|
|
1715
|
+
*/
|
|
1716
|
+
getStatus(): RetryStatus;
|
|
1717
|
+
/**
|
|
1718
|
+
* Get time until next retry (ms)
|
|
1719
|
+
*/
|
|
1720
|
+
getTimeUntilRetry(): number;
|
|
1721
|
+
/**
|
|
1722
|
+
* Start elapsed time timer
|
|
1723
|
+
*/
|
|
1724
|
+
private startElapsedTimer;
|
|
1725
|
+
/**
|
|
1726
|
+
* Start wait timer for automatic retry
|
|
1727
|
+
*/
|
|
1728
|
+
private startWaitTimer;
|
|
1729
|
+
/**
|
|
1730
|
+
* Start progress bar timer
|
|
1731
|
+
*/
|
|
1732
|
+
private startProgressTimer;
|
|
1733
|
+
/**
|
|
1734
|
+
* Stop all timers
|
|
1735
|
+
*/
|
|
1736
|
+
private stopTimers;
|
|
1737
|
+
/**
|
|
1738
|
+
* Handle manual retry button click
|
|
1739
|
+
*/
|
|
1740
|
+
private handleManualRetry;
|
|
1741
|
+
/**
|
|
1742
|
+
* Handle cancel button click
|
|
1743
|
+
*/
|
|
1744
|
+
private handleCancel;
|
|
1745
|
+
/**
|
|
1746
|
+
* Update state and re-render
|
|
1747
|
+
*/
|
|
1748
|
+
private setState;
|
|
1749
|
+
/**
|
|
1750
|
+
* Update cursor based on retry state
|
|
1751
|
+
*/
|
|
1752
|
+
private updateCursor;
|
|
1753
|
+
/**
|
|
1754
|
+
* Get status icon
|
|
1755
|
+
*/
|
|
1756
|
+
private getStatusIcon;
|
|
1757
|
+
/**
|
|
1758
|
+
* Get status text
|
|
1759
|
+
*/
|
|
1760
|
+
private getStatusText;
|
|
1761
|
+
/**
|
|
1762
|
+
* Calculate progress percentage
|
|
1763
|
+
*/
|
|
1764
|
+
private getProgressPercentage;
|
|
1765
|
+
/**
|
|
1766
|
+
* Render success message
|
|
1767
|
+
*/
|
|
1768
|
+
private renderSuccessMessage;
|
|
1769
|
+
/**
|
|
1770
|
+
* Render action buttons
|
|
1771
|
+
*/
|
|
1772
|
+
private renderActions;
|
|
1773
|
+
/**
|
|
1774
|
+
* Sync config attributes to host element
|
|
1775
|
+
*/
|
|
1776
|
+
private _syncAttributes;
|
|
1777
|
+
/**
|
|
1778
|
+
* Get attempt counter HTML
|
|
1779
|
+
*/
|
|
1780
|
+
private _getAttemptCounterHtml;
|
|
1781
|
+
/**
|
|
1782
|
+
* Get metrics grid HTML
|
|
1783
|
+
*/
|
|
1784
|
+
private _getMetricsGridHtml;
|
|
1785
|
+
/**
|
|
1786
|
+
* Get progress bar HTML
|
|
1787
|
+
*/
|
|
1788
|
+
private _getProgressBarHtml;
|
|
1789
|
+
/**
|
|
1790
|
+
* Get error display HTML
|
|
1791
|
+
*/
|
|
1792
|
+
private _getErrorDisplayHtml;
|
|
1793
|
+
/**
|
|
1794
|
+
* Attach event listeners to rendered elements
|
|
1795
|
+
*/
|
|
1796
|
+
private _attachEventListeners;
|
|
1797
|
+
/**
|
|
1798
|
+
* Render component
|
|
1799
|
+
*/
|
|
1800
|
+
protected render(): void;
|
|
1801
|
+
/**
|
|
1802
|
+
* Cleanup on disconnect
|
|
1803
|
+
*/
|
|
1804
|
+
disconnectedCallback(): void;
|
|
1805
|
+
/**
|
|
1806
|
+
* Observed attributes
|
|
1807
|
+
*/
|
|
1808
|
+
static get observedAttributes(): string[];
|
|
1809
|
+
/**
|
|
1810
|
+
* Handle attribute changes
|
|
1811
|
+
*/
|
|
1812
|
+
protected handleAttributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Configuration for RetryProgress component
|
|
1817
|
+
*/
|
|
1818
|
+
export declare interface RetryProgressConfig {
|
|
1819
|
+
/** Current attempt number (1-indexed) */
|
|
1820
|
+
attempt?: number;
|
|
1821
|
+
/** Maximum number of retry attempts */
|
|
1822
|
+
maxAttempts?: number;
|
|
1823
|
+
/** Initial delay in milliseconds */
|
|
1824
|
+
initialDelay?: number;
|
|
1825
|
+
/** Maximum delay in milliseconds */
|
|
1826
|
+
maxDelay?: number;
|
|
1827
|
+
/** Backoff multiplier for exponential strategy */
|
|
1828
|
+
backoffMultiplier?: number;
|
|
1829
|
+
/** Retry strategy */
|
|
1830
|
+
strategy?: RetryStrategy;
|
|
1831
|
+
/** Operation message */
|
|
1832
|
+
message?: string;
|
|
1833
|
+
/** Show attempt count */
|
|
1834
|
+
showAttemptCount?: boolean;
|
|
1835
|
+
/** Show next retry time */
|
|
1836
|
+
showNextRetry?: boolean;
|
|
1837
|
+
/** Show progress bar for wait time */
|
|
1838
|
+
showProgressBar?: boolean;
|
|
1839
|
+
/** Show elapsed time */
|
|
1840
|
+
showElapsedTime?: boolean;
|
|
1841
|
+
/** Enable manual retry button */
|
|
1842
|
+
allowManualRetry?: boolean;
|
|
1843
|
+
/** Enable cancel button */
|
|
1844
|
+
allowCancel?: boolean;
|
|
1845
|
+
/** Enable animations */
|
|
1846
|
+
animate?: boolean;
|
|
1847
|
+
/** Enable automatic cursor state changes based on component state */
|
|
1848
|
+
cursorFeedback?: boolean;
|
|
1849
|
+
/** Component size variant */
|
|
1850
|
+
size?: 'compact' | 'default' | 'large';
|
|
1851
|
+
/** Visual style variant */
|
|
1852
|
+
variant?: 'default' | 'minimal' | 'gradient' | 'glassmorphic';
|
|
1853
|
+
/** Animation style */
|
|
1854
|
+
animation?: 'none' | 'striped' | 'pulse' | 'glow';
|
|
1855
|
+
/** Custom CSS class */
|
|
1856
|
+
className?: string;
|
|
1857
|
+
/** ARIA label for accessibility */
|
|
1858
|
+
ariaLabel?: string;
|
|
1859
|
+
/** Debug mode */
|
|
1860
|
+
debug?: boolean;
|
|
1861
|
+
/** Disabled state */
|
|
1862
|
+
disabled?: boolean;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* Internal state for RetryProgress
|
|
1867
|
+
*/
|
|
1868
|
+
export declare interface RetryProgressState {
|
|
1869
|
+
status: RetryStatus;
|
|
1870
|
+
attempt: number;
|
|
1871
|
+
maxAttempts: number;
|
|
1872
|
+
currentDelay: number;
|
|
1873
|
+
nextRetryTime: number;
|
|
1874
|
+
startTime: number;
|
|
1875
|
+
elapsedTime: number;
|
|
1876
|
+
message: string;
|
|
1877
|
+
errorMessage?: string;
|
|
1878
|
+
lastError?: Error;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
/**
|
|
1882
|
+
* Types for RetryProgress component
|
|
1883
|
+
*/
|
|
1884
|
+
/**
|
|
1885
|
+
* Retry status
|
|
1886
|
+
*/
|
|
1887
|
+
export declare type RetryStatus = 'idle' | 'attempting' | 'waiting' | 'success' | 'failed' | 'cancelled';
|
|
1888
|
+
|
|
1889
|
+
/**
|
|
1890
|
+
* Retry strategy for backoff calculation
|
|
1891
|
+
*/
|
|
1892
|
+
export declare type RetryStrategy = 'exponential' | 'linear' | 'fixed' | 'fibonacci';
|
|
1893
|
+
|
|
1894
|
+
/**
|
|
1895
|
+
* Event detail for retry success
|
|
1896
|
+
*/
|
|
1897
|
+
export declare interface RetrySuccessEvent {
|
|
1898
|
+
attempt: number;
|
|
1899
|
+
totalAttempts: number;
|
|
1900
|
+
elapsedTime: number;
|
|
1901
|
+
message: string;
|
|
1902
|
+
timestamp: number;
|
|
1903
|
+
}
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Event detail for retry waiting period
|
|
1907
|
+
*/
|
|
1908
|
+
export declare interface RetryWaitingEvent {
|
|
1909
|
+
attempt: number;
|
|
1910
|
+
delay: number;
|
|
1911
|
+
nextRetryTime: number;
|
|
1912
|
+
strategy: RetryStrategy;
|
|
1913
|
+
timestamp: number;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Size variant for components
|
|
1918
|
+
*/
|
|
1919
|
+
export declare type SizeVariant = 'compact' | 'default' | 'large';
|
|
1920
|
+
|
|
1921
|
+
/**
|
|
1922
|
+
* Event data for stage change
|
|
1923
|
+
*/
|
|
1924
|
+
export declare interface StageChangeEvent {
|
|
1925
|
+
previousStage: ModelStage;
|
|
1926
|
+
currentStage: ModelStage;
|
|
1927
|
+
timestamp: number;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* State for each stage
|
|
1932
|
+
*/
|
|
1933
|
+
export declare interface StageState {
|
|
1934
|
+
status: StageStatus;
|
|
1935
|
+
progress: number;
|
|
1936
|
+
message?: string;
|
|
1937
|
+
bytesLoaded?: number;
|
|
1938
|
+
totalBytes?: number;
|
|
1939
|
+
startTime?: number;
|
|
1940
|
+
endTime?: number;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
/**
|
|
1944
|
+
* Status of each stage
|
|
1945
|
+
*/
|
|
1946
|
+
export declare type StageStatus = 'pending' | 'in-progress' | 'completed' | 'error';
|
|
1947
|
+
|
|
1948
|
+
/**
|
|
1949
|
+
* Update data for a stage
|
|
1950
|
+
*/
|
|
1951
|
+
export declare interface StageUpdate {
|
|
1952
|
+
stage: ModelStage;
|
|
1953
|
+
progress?: number;
|
|
1954
|
+
bytesLoaded?: number;
|
|
1955
|
+
totalBytes?: number;
|
|
1956
|
+
message?: string;
|
|
1957
|
+
memoryUsage?: number;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* Event data for stream cancellation
|
|
1962
|
+
*/
|
|
1963
|
+
export declare interface StreamCancelEvent {
|
|
1964
|
+
tokensGenerated: number;
|
|
1965
|
+
duration: number;
|
|
1966
|
+
reason: 'user' | 'error' | 'timeout';
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1969
|
+
/**
|
|
1970
|
+
* Event data for stream completion
|
|
1971
|
+
*/
|
|
1972
|
+
export declare interface StreamCompleteEvent {
|
|
1973
|
+
tokensGenerated: number;
|
|
1974
|
+
duration: number;
|
|
1975
|
+
totalCost: number;
|
|
1976
|
+
averageRate: number;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/**
|
|
1980
|
+
* StreamProgress Component
|
|
1981
|
+
*
|
|
1982
|
+
* Displays real-time progress for streaming AI responses (e.g., LLM token generation).
|
|
1983
|
+
* Shows token count, generation rate, cost estimation, and provides cancel functionality.
|
|
1984
|
+
*
|
|
1985
|
+
* @example
|
|
1986
|
+
* ```typescript
|
|
1987
|
+
* // Create the component
|
|
1988
|
+
* const progress = new StreamProgress({
|
|
1989
|
+
* maxTokens: 2000,
|
|
1990
|
+
* costPerToken: 0.00002,
|
|
1991
|
+
* showRate: true,
|
|
1992
|
+
* showCost: true,
|
|
1993
|
+
* });
|
|
1994
|
+
*
|
|
1995
|
+
* document.body.appendChild(progress);
|
|
1996
|
+
*
|
|
1997
|
+
* // Start streaming
|
|
1998
|
+
* progress.start();
|
|
1999
|
+
*
|
|
2000
|
+
* // Update as tokens stream in
|
|
2001
|
+
* progress.update({
|
|
2002
|
+
* tokensGenerated: 150,
|
|
2003
|
+
* tokensPerSecond: 25,
|
|
2004
|
+
* message: 'Generating response...'
|
|
2005
|
+
* });
|
|
2006
|
+
*
|
|
2007
|
+
* // Complete the stream
|
|
2008
|
+
* progress.complete();
|
|
2009
|
+
*
|
|
2010
|
+
* // Listen to events
|
|
2011
|
+
* progress.addEventListener('cancel', (e) => {
|
|
2012
|
+
* console.log('Stream cancelled', e.detail);
|
|
2013
|
+
* });
|
|
2014
|
+
* ```
|
|
2015
|
+
*
|
|
2016
|
+
* @fires streamstart - Fired when streaming starts
|
|
2017
|
+
* @fires streamupdate - Fired when progress is updated
|
|
2018
|
+
* @fires streamcomplete - Fired when streaming completes
|
|
2019
|
+
* @fires streamcancel - Fired when streaming is cancelled
|
|
2020
|
+
*/
|
|
2021
|
+
export declare class StreamProgress extends AIControl {
|
|
2022
|
+
protected config: Required<StreamProgressConfig>;
|
|
2023
|
+
private state;
|
|
2024
|
+
private readonly updateThrottled;
|
|
2025
|
+
private animationFrame;
|
|
2026
|
+
private displayTokens;
|
|
2027
|
+
static get observedAttributes(): string[];
|
|
2028
|
+
constructor(config?: StreamProgressConfig);
|
|
2029
|
+
connectedCallback(): void;
|
|
2030
|
+
disconnectedCallback(): void;
|
|
2031
|
+
protected cleanup(): void;
|
|
2032
|
+
/**
|
|
2033
|
+
* Update cursor based on component state
|
|
2034
|
+
*/
|
|
2035
|
+
private updateCursor;
|
|
2036
|
+
protected getDefaultRole(): string;
|
|
2037
|
+
protected handleAttributeChange(name: string, _oldValue: string, newValue: string): void;
|
|
2038
|
+
/**
|
|
2039
|
+
* Start streaming
|
|
2040
|
+
*/
|
|
2041
|
+
start(message?: string): void;
|
|
2042
|
+
/**
|
|
2043
|
+
* Update progress
|
|
2044
|
+
*/
|
|
2045
|
+
update(update: StreamProgressUpdate): void;
|
|
2046
|
+
private _updateInternal;
|
|
2047
|
+
/**
|
|
2048
|
+
* Smooth animation for progress
|
|
2049
|
+
*/
|
|
2050
|
+
private animateProgress;
|
|
2051
|
+
/**
|
|
2052
|
+
* Complete streaming
|
|
2053
|
+
*/
|
|
2054
|
+
complete(): void;
|
|
2055
|
+
/**
|
|
2056
|
+
* Cancel streaming
|
|
2057
|
+
*/
|
|
2058
|
+
cancel(reason?: 'user' | 'error' | 'timeout'): void;
|
|
2059
|
+
/**
|
|
2060
|
+
* Reset the component
|
|
2061
|
+
*/
|
|
2062
|
+
reset(): void;
|
|
2063
|
+
/**
|
|
2064
|
+
* Sync config attributes to host element
|
|
2065
|
+
*/
|
|
2066
|
+
private _syncAttributes;
|
|
2067
|
+
/**
|
|
2068
|
+
* Get progress bar HTML
|
|
2069
|
+
*/
|
|
2070
|
+
private _getProgressBarHtml;
|
|
2071
|
+
/**
|
|
2072
|
+
* Get stats HTML
|
|
2073
|
+
*/
|
|
2074
|
+
private _getStatsHtml;
|
|
2075
|
+
/**
|
|
2076
|
+
* Get cancel button HTML
|
|
2077
|
+
*/
|
|
2078
|
+
private _getCancelButtonHtml;
|
|
2079
|
+
/**
|
|
2080
|
+
* Get status CSS class
|
|
2081
|
+
*/
|
|
2082
|
+
private _getStatusClass;
|
|
2083
|
+
/**
|
|
2084
|
+
* Attach event listeners to rendered elements
|
|
2085
|
+
*/
|
|
2086
|
+
private _attachEventListeners;
|
|
2087
|
+
/**
|
|
2088
|
+
* Render the component
|
|
2089
|
+
*/
|
|
2090
|
+
protected render(): void;
|
|
2091
|
+
/**
|
|
2092
|
+
* Get current state (for debugging/inspection)
|
|
2093
|
+
*/
|
|
2094
|
+
getState(): Readonly<StreamProgressState>;
|
|
2095
|
+
/**
|
|
2096
|
+
* Get current configuration
|
|
2097
|
+
*/
|
|
2098
|
+
getConfig(): Readonly<Required<StreamProgressConfig>>;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* Configuration for StreamProgress component
|
|
2103
|
+
*/
|
|
2104
|
+
export declare interface StreamProgressConfig {
|
|
2105
|
+
/** Maximum tokens allowed */
|
|
2106
|
+
maxTokens?: number;
|
|
2107
|
+
/** Cost per token (for cost estimation) */
|
|
2108
|
+
costPerToken?: number;
|
|
2109
|
+
/** Currency symbol */
|
|
2110
|
+
currency?: string;
|
|
2111
|
+
/** Show tokens per second */
|
|
2112
|
+
showRate?: boolean;
|
|
2113
|
+
/** Show cost estimation */
|
|
2114
|
+
showCost?: boolean;
|
|
2115
|
+
/** Show progress bar */
|
|
2116
|
+
showProgressBar?: boolean;
|
|
2117
|
+
/** Show cancel button */
|
|
2118
|
+
showCancelButton?: boolean;
|
|
2119
|
+
/** Enable smooth progress animation */
|
|
2120
|
+
smoothProgress?: boolean;
|
|
2121
|
+
/** Update throttle in milliseconds */
|
|
2122
|
+
updateThrottle?: number;
|
|
2123
|
+
/** Custom cancel button label */
|
|
2124
|
+
cancelLabel?: string;
|
|
2125
|
+
/** Enable automatic cursor state changes based on component state */
|
|
2126
|
+
cursorFeedback?: boolean;
|
|
2127
|
+
/** Component size variant */
|
|
2128
|
+
size?: 'compact' | 'default' | 'large';
|
|
2129
|
+
/** Visual style variant */
|
|
2130
|
+
variant?: 'default' | 'minimal' | 'gradient' | 'glassmorphic';
|
|
2131
|
+
/** Animation style */
|
|
2132
|
+
animation?: 'none' | 'striped' | 'pulse' | 'glow';
|
|
2133
|
+
/** Debug mode */
|
|
2134
|
+
debug?: boolean;
|
|
2135
|
+
/** Custom CSS class */
|
|
2136
|
+
className?: string;
|
|
2137
|
+
/** Aria label */
|
|
2138
|
+
ariaLabel?: string;
|
|
2139
|
+
}
|
|
2140
|
+
|
|
2141
|
+
/**
|
|
2142
|
+
* State for StreamProgress
|
|
2143
|
+
*/
|
|
2144
|
+
export declare interface StreamProgressState {
|
|
2145
|
+
tokensGenerated: number;
|
|
2146
|
+
tokensPerSecond: number;
|
|
2147
|
+
totalCost: number;
|
|
2148
|
+
isStreaming: boolean;
|
|
2149
|
+
isPaused: boolean;
|
|
2150
|
+
isCancelled: boolean;
|
|
2151
|
+
startTime: number;
|
|
2152
|
+
lastUpdateTime: number;
|
|
2153
|
+
message?: string;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Event data for progress updates
|
|
2158
|
+
*/
|
|
2159
|
+
export declare interface StreamProgressUpdate {
|
|
2160
|
+
tokensGenerated: number;
|
|
2161
|
+
tokensPerSecond?: number;
|
|
2162
|
+
message?: string;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* Theme configuration using CSS custom properties
|
|
2167
|
+
*/
|
|
2168
|
+
export declare interface ThemeConfig {
|
|
2169
|
+
primaryColor?: string;
|
|
2170
|
+
secondaryColor?: string;
|
|
2171
|
+
backgroundColor?: string;
|
|
2172
|
+
textColor?: string;
|
|
2173
|
+
borderRadius?: string;
|
|
2174
|
+
fontSize?: string;
|
|
2175
|
+
fontFamily?: string;
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
/**
|
|
2179
|
+
* Throttle function calls
|
|
2180
|
+
*/
|
|
2181
|
+
export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): (...args: Parameters<T>) => void;
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
* Event detail when validation fails
|
|
2185
|
+
*/
|
|
2186
|
+
export declare interface ValidationErrorEvent {
|
|
2187
|
+
/** Parameter ID with error */
|
|
2188
|
+
parameterId: string;
|
|
2189
|
+
/** Error message */
|
|
2190
|
+
error: string;
|
|
2191
|
+
/** Current value */
|
|
2192
|
+
value: number;
|
|
2193
|
+
/** Timestamp */
|
|
2194
|
+
timestamp: number;
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
/**
|
|
2198
|
+
* Event detail for value change
|
|
2199
|
+
*/
|
|
2200
|
+
export declare interface ValueChangeEvent {
|
|
2201
|
+
value: number;
|
|
2202
|
+
previousValue: number;
|
|
2203
|
+
source: 'slider' | 'input' | 'preset' | 'reset';
|
|
2204
|
+
timestamp: number;
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* Visual style variant for components
|
|
2209
|
+
*/
|
|
2210
|
+
export declare type VisualVariant = 'default' | 'minimal' | 'gradient' | 'glassmorphic';
|
|
2211
|
+
|
|
2212
|
+
export { }
|