@tachui/devtools 0.8.0-alpha

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.
Files changed (75) hide show
  1. package/LICENSE +363 -0
  2. package/README.md +189 -0
  3. package/dist/build-time/detection.d.ts +32 -0
  4. package/dist/build-time/detection.d.ts.map +1 -0
  5. package/dist/build-time/index.d.ts +84 -0
  6. package/dist/build-time/index.d.ts.map +1 -0
  7. package/dist/build-time/plugins.d.ts +75 -0
  8. package/dist/build-time/plugins.d.ts.map +1 -0
  9. package/dist/build-time/rules.d.ts +73 -0
  10. package/dist/build-time/rules.d.ts.map +1 -0
  11. package/dist/build-time/transformer.d.ts +23 -0
  12. package/dist/build-time/transformer.d.ts.map +1 -0
  13. package/dist/build-time/types.d.ts +212 -0
  14. package/dist/build-time/types.d.ts.map +1 -0
  15. package/dist/debug/advanced-debugging.d.ts +327 -0
  16. package/dist/debug/advanced-debugging.d.ts.map +1 -0
  17. package/dist/debug/debug.d.ts +61 -0
  18. package/dist/debug/debug.d.ts.map +1 -0
  19. package/dist/debug/developer-experience.d.ts +261 -0
  20. package/dist/debug/developer-experience.d.ts.map +1 -0
  21. package/dist/debug/development-warnings.d.ts +42 -0
  22. package/dist/debug/development-warnings.d.ts.map +1 -0
  23. package/dist/debug/documentation-integration.d.ts +269 -0
  24. package/dist/debug/documentation-integration.d.ts.map +1 -0
  25. package/dist/debug/enhanced-errors.d.ts +176 -0
  26. package/dist/debug/enhanced-errors.d.ts.map +1 -0
  27. package/dist/debug/enhanced-types.d.ts +284 -0
  28. package/dist/debug/enhanced-types.d.ts.map +1 -0
  29. package/dist/debug/ide-integration.d.ts +328 -0
  30. package/dist/debug/ide-integration.d.ts.map +1 -0
  31. package/dist/debug/index.d.ts +12 -0
  32. package/dist/debug/index.d.ts.map +1 -0
  33. package/dist/debug/index.js +1251 -0
  34. package/dist/debug/index.js.map +1 -0
  35. package/dist/debug/validation-debug-tools.d.ts +228 -0
  36. package/dist/debug/validation-debug-tools.d.ts.map +1 -0
  37. package/dist/index.d.ts +22 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +216229 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/inspector/index.d.ts +232 -0
  42. package/dist/inspector/index.d.ts.map +1 -0
  43. package/dist/inspector/index.js +525 -0
  44. package/dist/inspector/index.js.map +1 -0
  45. package/dist/plugins/simplified-error-handler.d.ts +83 -0
  46. package/dist/plugins/simplified-error-handler.d.ts.map +1 -0
  47. package/dist/profiler/index.d.ts +21 -0
  48. package/dist/profiler/index.d.ts.map +1 -0
  49. package/dist/profiler/index.js +519 -0
  50. package/dist/profiler/index.js.map +1 -0
  51. package/dist/profiler/performance-optimizer.d.ts +115 -0
  52. package/dist/profiler/performance-optimizer.d.ts.map +1 -0
  53. package/dist/profiler/production-monitoring.d.ts +150 -0
  54. package/dist/profiler/production-monitoring.d.ts.map +1 -0
  55. package/dist/runtime/error-boundary.d.ts +302 -0
  56. package/dist/runtime/error-boundary.d.ts.map +1 -0
  57. package/dist/runtime/error-recovery.d.ts +267 -0
  58. package/dist/runtime/error-recovery.d.ts.map +1 -0
  59. package/dist/runtime/error-reporting.d.ts +287 -0
  60. package/dist/runtime/error-reporting.d.ts.map +1 -0
  61. package/dist/runtime/error-utils.d.ts +204 -0
  62. package/dist/runtime/error-utils.d.ts.map +1 -0
  63. package/dist/runtime/performance.d.ts +217 -0
  64. package/dist/runtime/performance.d.ts.map +1 -0
  65. package/dist/testing/index.d.ts +29 -0
  66. package/dist/testing/index.d.ts.map +1 -0
  67. package/dist/testing/index.js +47 -0
  68. package/dist/testing/index.js.map +1 -0
  69. package/dist/validation/debug-tools-stub.d.ts +67 -0
  70. package/dist/validation/debug-tools-stub.d.ts.map +1 -0
  71. package/dist/validation/enhanced-runtime.d.ts +310 -0
  72. package/dist/validation/enhanced-runtime.d.ts.map +1 -0
  73. package/dist/validation/error-reporting.d.ts +186 -0
  74. package/dist/validation/error-reporting.d.ts.map +1 -0
  75. package/package.json +78 -0
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Performance Optimization System - Phase 1C
3
+ *
4
+ * Advanced performance optimizations to reduce validation overhead
5
+ * to <5% impact in development mode with smart caching and batching.
6
+ */
7
+ /**
8
+ * Performance optimization configuration
9
+ */
10
+ export interface PerformanceOptimizerConfig {
11
+ enabled: boolean;
12
+ targetOverhead: number;
13
+ batchSize: number;
14
+ cacheStrategy: 'aggressive' | 'moderate' | 'conservative';
15
+ asyncValidation: boolean;
16
+ throttleMs: number;
17
+ skipFrames: number;
18
+ }
19
+ /**
20
+ * Validation operation metrics
21
+ */
22
+ export interface ValidationMetrics {
23
+ operationCount: number;
24
+ totalTime: number;
25
+ averageTime: number;
26
+ maxTime: number;
27
+ cacheHitRate: number;
28
+ skipRate: number;
29
+ }
30
+ /**
31
+ * Performance optimization engine
32
+ */
33
+ export declare class PerformanceOptimizer {
34
+ private static instance;
35
+ private config;
36
+ private metrics;
37
+ private operationQueue;
38
+ private frameCounter;
39
+ private lastBatchTime;
40
+ private throttleTimers;
41
+ private defaultConfig;
42
+ constructor(config?: Partial<PerformanceOptimizerConfig>);
43
+ static getInstance(config?: Partial<PerformanceOptimizerConfig>): PerformanceOptimizer;
44
+ configure(config: Partial<PerformanceOptimizerConfig>): void;
45
+ /**
46
+ * Optimize a validation operation with smart batching and caching
47
+ */
48
+ optimizeValidation<T>(key: string, operation: () => T, _skipCache?: boolean): T;
49
+ /**
50
+ * Batch validation operations for better performance
51
+ */
52
+ batchValidations(operations: Array<() => void>): void;
53
+ /**
54
+ * Process queued validation operations
55
+ */
56
+ private processBatch;
57
+ /**
58
+ * Check if validation should be skipped this frame
59
+ */
60
+ private shouldSkipFrame;
61
+ /**
62
+ * Check if operation is currently throttled
63
+ */
64
+ private isThrottled;
65
+ /**
66
+ * Record performance metrics
67
+ */
68
+ private recordMetrics;
69
+ /**
70
+ * Get performance metrics for a specific operation
71
+ */
72
+ getMetrics(key: string): ValidationMetrics | undefined;
73
+ /**
74
+ * Get all performance metrics
75
+ */
76
+ getAllMetrics(): Map<string, ValidationMetrics>;
77
+ /**
78
+ * Reset all metrics
79
+ */
80
+ resetMetrics(): void;
81
+ /**
82
+ * Auto-optimize based on current performance
83
+ */
84
+ autoOptimize(currentOverhead: number): void;
85
+ /**
86
+ * Measure validation overhead
87
+ */
88
+ measureOverhead(validationFn: () => void, iterations?: number): number;
89
+ /**
90
+ * Monitor and report performance continuously
91
+ */
92
+ startPerformanceMonitoring(intervalMs?: number): () => void;
93
+ }
94
+ /**
95
+ * Global performance optimizer instance
96
+ */
97
+ export declare const performanceOptimizer: PerformanceOptimizer;
98
+ /**
99
+ * Performance optimization utilities
100
+ */
101
+ export declare const PerformanceOptimizationUtils: {
102
+ configure: (config: Partial<PerformanceOptimizerConfig>) => void;
103
+ getMetrics: (key?: string) => ValidationMetrics | Map<string, ValidationMetrics> | undefined;
104
+ resetMetrics: () => void;
105
+ measureOverhead: (validationFn: () => void, iterations?: number) => number;
106
+ startMonitoring: (intervalMs?: number) => () => void;
107
+ getStats: () => {
108
+ enabled: boolean;
109
+ targetOverhead: number;
110
+ batchSize: number;
111
+ cacheStrategy: "aggressive" | "moderate" | "conservative";
112
+ metricsCount: number;
113
+ };
114
+ };
115
+ //# sourceMappingURL=performance-optimizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"performance-optimizer.d.ts","sourceRoot":"","sources":["../../src/profiler/performance-optimizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,OAAO,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,YAAY,GAAG,UAAU,GAAG,cAAc,CAAA;IACzD,eAAe,EAAE,OAAO,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM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IACH,YAAY,IAAI,IAAI;IAMpB;;OAEG;IACH,YAAY,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI;IAkB3C;;OAEG;IACH,eAAe,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,UAAU,SAAM,GAAG,MAAM;IAsBnE;;OAEG;IACH,0BAA0B,CAAC,UAAU,SAAO,GAAG,MAAM,IAAI;CAuB1D;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,sBAAqC,CAAA;AAEtE;;GAEG;AACH,eAAO,MAAM,4BAA4B;wBACnB,OAAO,CAAC,0BAA0B,CAAC;uBAGpC,MAAM;;oCAOO,MAAM,IAAI,eAAe,MAAM;mCAGhC,MAAM,WA/CgB,IAAI;;;;;;;;CAyD1D,CAAA"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Production Mode Monitoring and Analysis
3
+ *
4
+ * Development tools for monitoring production optimization effectiveness,
5
+ * performance tracking, and bundle analysis.
6
+ *
7
+ * Moved from @tachui/core for proper separation of dev vs production concerns.
8
+ */
9
+ /**
10
+ * Enhanced production configuration with debugging
11
+ */
12
+ export interface EnhancedProductionConfig {
13
+ enabled: boolean;
14
+ mode: 'development' | 'production' | 'test';
15
+ optimizationLevel: 'none' | 'basic' | 'aggressive';
16
+ debugInfo: boolean;
17
+ }
18
+ /**
19
+ * Performance statistics for production optimization
20
+ */
21
+ interface PerformanceStats {
22
+ bypassCount: number;
23
+ performanceGain: number;
24
+ averageOverhead: number;
25
+ slowValidations: Array<{
26
+ component: string;
27
+ time: number;
28
+ }>;
29
+ }
30
+ /**
31
+ * Bundle analysis report
32
+ */
33
+ interface BundleOptimizationReport {
34
+ validationCodeSize: number;
35
+ performanceGain: number;
36
+ optimization: string;
37
+ recommendations: string[];
38
+ }
39
+ /**
40
+ * Production monitoring and analysis
41
+ */
42
+ export declare class ProductionMonitor {
43
+ private static instance;
44
+ private bypassCount;
45
+ private performanceGain;
46
+ private validationTimes;
47
+ private slowValidations;
48
+ static getInstance(): ProductionMonitor;
49
+ /**
50
+ * Record a validation bypass for performance tracking
51
+ */
52
+ recordBypass(timesSaved: number): void;
53
+ /**
54
+ * Record validation performance
55
+ */
56
+ recordValidationTime(componentType: string, duration: number): void;
57
+ /**
58
+ * Get performance statistics
59
+ */
60
+ getStats(): PerformanceStats;
61
+ /**
62
+ * Reset monitoring statistics
63
+ */
64
+ reset(): void;
65
+ /**
66
+ * Generate optimization recommendations
67
+ */
68
+ getRecommendations(): string[];
69
+ }
70
+ /**
71
+ * Bundle size analysis
72
+ */
73
+ export declare class BundleAnalysis {
74
+ /**
75
+ * Estimate validation code size in bundle
76
+ */
77
+ static getValidationCodeSize(): number;
78
+ /**
79
+ * Generate optimization report
80
+ */
81
+ static getOptimizationReport(): BundleOptimizationReport;
82
+ }
83
+ /**
84
+ * Development-only assertion macro with detailed reporting
85
+ */
86
+ export declare function devAssert(condition: boolean, message: string, context?: any): void;
87
+ /**
88
+ * Development-only warning macro with enhanced reporting
89
+ */
90
+ export declare function devWarn(condition: boolean, message: string, context?: any): void;
91
+ /**
92
+ * Enhanced performance monitoring wrapper
93
+ */
94
+ export declare function withPerformanceMonitoring<T extends (...args: any[]) => any>(fn: T, name: string, options?: {
95
+ threshold?: number;
96
+ logSlow?: boolean;
97
+ trackStats?: boolean;
98
+ }): T;
99
+ /**
100
+ * Component validation wrapper with performance monitoring
101
+ */
102
+ export declare function withMonitoredValidation<T extends (...args: any[]) => any>(originalConstructor: T, componentType: string, validator?: (args: unknown[]) => void): T;
103
+ /**
104
+ * Development build constants (for tree-shaking)
105
+ */
106
+ export declare const DevConstants: {
107
+ __DEVELOPMENT_ONLY__: boolean;
108
+ __TACHUI_VERSION__: string;
109
+ defineGlobals: {
110
+ __TACHUI_PRODUCTION_MODE__: boolean;
111
+ __TACHUI_DEBUG_INFO__: boolean;
112
+ };
113
+ };
114
+ /**
115
+ * Production optimization utilities with monitoring
116
+ */
117
+ export declare const ProductionOptimizationUtils: {
118
+ /**
119
+ * Get detailed performance statistics
120
+ */
121
+ getDetailedStats: () => {
122
+ recommendations: string[];
123
+ bundleReport: BundleOptimizationReport;
124
+ bypassCount: number;
125
+ performanceGain: number;
126
+ averageOverhead: number;
127
+ slowValidations: Array<{
128
+ component: string;
129
+ time: number;
130
+ }>;
131
+ };
132
+ /**
133
+ * Reset monitoring data
134
+ */
135
+ resetStats: () => void;
136
+ /**
137
+ * Get bundle optimization report
138
+ */
139
+ getBundleReport: typeof BundleAnalysis.getOptimizationReport;
140
+ /**
141
+ * Test production optimization with detailed reporting
142
+ */
143
+ test(): void;
144
+ /**
145
+ * Start continuous monitoring
146
+ */
147
+ startMonitoring(intervalMs?: number): () => void;
148
+ };
149
+ export {};
150
+ //# sourceMappingURL=production-monitoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"production-monitoring.d.ts","sourceRoot":"","sources":["../../src/profiler/production-monitoring.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,aAAa,GAAG,YAAY,GAAG,MAAM,CAAA;IAC3C,iBAAiB,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,CAAA;IAClD,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC5D;AAED;;GAEG;AACH,UAAU,wBAAwB;IAChC,kBAAkB,EAAE,MAAM,CAAA;IAC1B,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED;;GAEG;AACH,qBAAa,iBAAiB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CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACvE,mBAAmB,EAAE,CAAC,EACtB,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACpC,CAAC,CA0BH;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;CASxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,2BAA2B;IACtC;;OAEG;;;;qBA1RU,MAAM;yBACF,MAAM;yBACN,MAAM;yBACN,KAAK,CAAC;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC;;IAiS3D;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;YACK,IAAI;IA8CZ;;OAEG;0CACkC,MAAM,IAAI;CAmBhD,CAAA"}
@@ -0,0 +1,302 @@
1
+ /**
2
+ * Error Boundary and Error Handling System (Phase 3.2.3)
3
+ *
4
+ * Comprehensive error handling system for TachUI applications.
5
+ * Provides error boundaries, recovery mechanisms, and error reporting.
6
+ */
7
+ import type { ComponentInstance, ComponentProps, DOMNode } from '@tachui/core';
8
+ /**
9
+ * Error severity levels
10
+ */
11
+ export type ErrorSeverity = 'low' | 'medium' | 'high' | 'critical';
12
+ /**
13
+ * Error categories for classification
14
+ */
15
+ export type ErrorCategory = 'component_error' | 'reactive_error' | 'render_error' | 'lifecycle_error' | 'network_error' | 'validation_error' | 'unknown_error';
16
+ /**
17
+ * Comprehensive error information
18
+ */
19
+ export interface TachUIError {
20
+ id: string;
21
+ message: string;
22
+ stack?: string;
23
+ cause?: Error;
24
+ timestamp: number;
25
+ category: ErrorCategory;
26
+ severity: ErrorSeverity;
27
+ componentId?: string;
28
+ componentName?: string;
29
+ phase?: string;
30
+ context?: Record<string, any>;
31
+ userAgent?: string;
32
+ url?: string;
33
+ retryCount: number;
34
+ recovered: boolean;
35
+ }
36
+ /**
37
+ * Error boundary state
38
+ */
39
+ export interface ErrorBoundaryState {
40
+ hasError: boolean;
41
+ error: TachUIError | null;
42
+ errorInfo: {
43
+ componentStack?: string;
44
+ errorBoundary?: string;
45
+ retryAttempts: number;
46
+ };
47
+ }
48
+ /**
49
+ * Error recovery strategies
50
+ */
51
+ export type ErrorRecoveryStrategy = 'retry' | 'fallback' | 'reload' | 'redirect' | 'ignore' | 'escalate';
52
+ /**
53
+ * Error recovery configuration
54
+ */
55
+ export interface ErrorRecoveryConfig {
56
+ strategy: ErrorRecoveryStrategy;
57
+ maxRetries?: number;
58
+ retryDelay?: number;
59
+ fallbackComponent?: ComponentInstance;
60
+ onRecovery?: (error: TachUIError) => void;
61
+ condition?: (error: TachUIError) => boolean;
62
+ }
63
+ /**
64
+ * Error boundary props
65
+ */
66
+ export interface ErrorBoundaryProps extends ComponentProps {
67
+ fallback?: ComponentInstance | ((error: TachUIError, retry: () => void) => ComponentInstance);
68
+ onError?: (error: TachUIError, errorInfo: ErrorBoundaryState['errorInfo']) => void;
69
+ recovery?: ErrorRecoveryConfig[];
70
+ isolate?: boolean;
71
+ resetOnPropsChange?: boolean;
72
+ resetKeys?: string[];
73
+ }
74
+ /**
75
+ * Error reporter interface
76
+ */
77
+ export interface ErrorReporter {
78
+ report(error: TachUIError): void | Promise<void>;
79
+ }
80
+ /**
81
+ * Error handler function type
82
+ */
83
+ export type ErrorHandler = (error: TachUIError) => void | Promise<void>;
84
+ /**
85
+ * Global error handling configuration
86
+ */
87
+ export interface ErrorHandlingConfig {
88
+ enabled: boolean;
89
+ captureConsoleErrors: boolean;
90
+ captureUnhandledPromises: boolean;
91
+ captureReactiveErrors: boolean;
92
+ captureComponentErrors: boolean;
93
+ maxErrorsPerSession: number;
94
+ maxErrorAge: number;
95
+ reportingThrottle: number;
96
+ enableStackTrace: boolean;
97
+ enableSourceMap: boolean;
98
+ development: boolean;
99
+ }
100
+ /**
101
+ * Error boundary component implementation
102
+ */
103
+ export declare class ErrorBoundary {
104
+ private state;
105
+ private props;
106
+ private children;
107
+ private errorManager;
108
+ private stateSignal;
109
+ private setState;
110
+ constructor(props: ErrorBoundaryProps, children: ComponentInstance[], errorManager: ErrorManager);
111
+ /**
112
+ * Catch and handle errors in child components
113
+ */
114
+ componentDidCatch(error: Error, errorInfo: any): void;
115
+ /**
116
+ * Handle error and determine recovery strategy
117
+ */
118
+ private handleError;
119
+ /**
120
+ * Attempt error recovery based on configured strategies
121
+ */
122
+ private attemptRecovery;
123
+ /**
124
+ * Retry failed operation with configuration
125
+ */
126
+ private retryWithConfig;
127
+ /**
128
+ * Retry the failed operation
129
+ */
130
+ retry(): void;
131
+ /**
132
+ * Reset error boundary to normal state
133
+ */
134
+ resetErrorBoundary(): void;
135
+ /**
136
+ * Reload the component
137
+ */
138
+ private reloadComponent;
139
+ /**
140
+ * Setup props watcher for error boundary reset
141
+ */
142
+ private setupPropsWatcher;
143
+ /**
144
+ * Check if error boundary should reset based on props
145
+ */
146
+ private shouldResetOnProps;
147
+ /**
148
+ * Render error boundary content
149
+ */
150
+ render(): DOMNode[];
151
+ /**
152
+ * Render default error UI
153
+ */
154
+ private renderDefaultErrorUI;
155
+ /**
156
+ * Get current error boundary state
157
+ */
158
+ getState(): ErrorBoundaryState;
159
+ /**
160
+ * Get reactive state signal
161
+ */
162
+ getStateSignal(): () => ErrorBoundaryState;
163
+ }
164
+ /**
165
+ * Global error manager
166
+ */
167
+ export declare class ErrorManager {
168
+ private static instance;
169
+ private config;
170
+ private errors;
171
+ private reporters;
172
+ private handlers;
173
+ private throttleMap;
174
+ private errorsSignal;
175
+ private setErrors;
176
+ constructor();
177
+ static getInstance(): ErrorManager;
178
+ /**
179
+ * Configure error handling
180
+ */
181
+ configure(config: Partial<ErrorHandlingConfig>): void;
182
+ /**
183
+ * Setup global error handlers
184
+ */
185
+ private setupGlobalErrorHandlers;
186
+ /**
187
+ * Create standardized TachUI error
188
+ */
189
+ createTachUIError(error: Error, options?: {
190
+ category?: ErrorCategory;
191
+ severity?: ErrorSeverity;
192
+ componentId?: string;
193
+ componentName?: string;
194
+ phase?: string;
195
+ context?: Record<string, any>;
196
+ }): TachUIError;
197
+ /**
198
+ * Report error to all registered reporters
199
+ */
200
+ reportError(error: TachUIError): void;
201
+ /**
202
+ * Clean old errors based on max age
203
+ */
204
+ private cleanOldErrors;
205
+ /**
206
+ * Add error reporter
207
+ */
208
+ addReporter(reporter: ErrorReporter): () => void;
209
+ /**
210
+ * Add error handler
211
+ */
212
+ addHandler(handler: ErrorHandler): () => void;
213
+ /**
214
+ * Get all errors
215
+ */
216
+ getErrors(): TachUIError[];
217
+ /**
218
+ * Get errors signal
219
+ */
220
+ getErrorsSignal(): () => TachUIError[];
221
+ /**
222
+ * Get errors by category
223
+ */
224
+ getErrorsByCategory(category: ErrorCategory): TachUIError[];
225
+ /**
226
+ * Get errors by severity
227
+ */
228
+ getErrorsBySeverity(severity: ErrorSeverity): TachUIError[];
229
+ /**
230
+ * Get errors by component
231
+ */
232
+ getErrorsByComponent(componentId: string): TachUIError[];
233
+ /**
234
+ * Mark error as recovered
235
+ */
236
+ markErrorRecovered(errorId: string): void;
237
+ /**
238
+ * Clear all errors
239
+ */
240
+ clear(): void;
241
+ /**
242
+ * Get error statistics
243
+ */
244
+ getStatistics(): {
245
+ totalErrors: number;
246
+ errorsByCategory: Record<ErrorCategory, number>;
247
+ errorsBySeverity: Record<ErrorSeverity, number>;
248
+ recoveredErrors: number;
249
+ recentErrors: number;
250
+ };
251
+ }
252
+ /**
253
+ * Global error manager instance
254
+ */
255
+ export declare const globalErrorManager: ErrorManager;
256
+ /**
257
+ * Create error boundary component
258
+ */
259
+ export declare function createErrorBoundary(props: ErrorBoundaryProps, children: ComponentInstance[]): ErrorBoundary;
260
+ /**
261
+ * Built-in error reporters
262
+ */
263
+ export declare const errorReporters: {
264
+ /**
265
+ * Console reporter
266
+ */
267
+ console: ErrorReporter;
268
+ /**
269
+ * Local storage reporter
270
+ */
271
+ localStorage: ErrorReporter;
272
+ /**
273
+ * Remote API reporter
274
+ */
275
+ createRemoteReporter(endpoint: string, apiKey?: string): ErrorReporter;
276
+ };
277
+ /**
278
+ * Error handling utilities
279
+ */
280
+ export declare const errorUtils: {
281
+ /**
282
+ * Wrap function with error handling
283
+ */
284
+ withErrorHandling<T extends (...args: any[]) => any>(fn: T, options?: {
285
+ category?: ErrorCategory;
286
+ onError?: (error: TachUIError) => void;
287
+ fallback?: ReturnType<T>;
288
+ }): T;
289
+ /**
290
+ * Wrap async function with error handling
291
+ */
292
+ withAsyncErrorHandling<T extends (...args: any[]) => Promise<any>>(fn: T, options?: {
293
+ category?: ErrorCategory;
294
+ onError?: (error: TachUIError) => void;
295
+ fallback?: Awaited<ReturnType<T>>;
296
+ }): T;
297
+ /**
298
+ * Create error boundary with common configurations
299
+ */
300
+ createSimpleErrorBoundary(fallbackMessage?: string): (children: ComponentInstance[]) => ErrorBoundary;
301
+ };
302
+ //# sourceMappingURL=error-boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-boundary.d.ts","sourceRoot":"","sources":["../../src/runtime/error-boundary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE9E;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAA;AAElE;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,iBAAiB,GACjB,gBAAgB,GAChB,cAAc,GACd,iBAAiB,GACjB,eAAe,GACf,kBAAkB,GAClB,eAAe,CAAA;AAEnB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,aAAa,CAAA;IACvB,QAAQ,EA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