@tachui/devtools
Version:
Development & debugging tools for tachUI framework
228 lines • 5.88 kB
TypeScript
/**
* Validation Debugging Tools - Phase 1C
*
* Comprehensive debugging helpers, diagnostic tools, validation inspector,
* and developer utilities for analyzing validation behavior.
*
* Moved from @tachui/core to @tachui/devtools for better separation of concerns.
*/
export type ComponentInstance = any;
/**
* Debug session information
*/
export interface DebugSession {
id: string;
startTime: number;
endTime?: number;
validationEvents: DebugEvent[];
components: ComponentDebugInfo[];
errors: any[];
performance: PerformanceSnapshot;
}
/**
* Debug event types
*/
export type ValidationDebugEventType = 'validation-start' | 'validation-end' | 'validation-error' | 'validation-warning' | 'validation-recovery' | 'component-mount' | 'component-update' | 'component-unmount' | 'cache-hit' | 'cache-miss' | 'performance-warning';
/**
* Debug event
*/
export interface DebugEvent {
id: string;
type: ValidationDebugEventType;
timestamp: number;
componentType?: string;
componentId?: string;
message: string;
data?: any;
duration?: number;
stackTrace?: string;
}
/**
* Component debug information
*/
export interface ComponentDebugInfo {
type: string;
id: string;
props: any;
lifecycle: {
created: number;
mounted?: number;
lastUpdate?: number;
unmounted?: number;
};
validation: {
passed: boolean;
errors: string[];
warnings: string[];
lastCheck: number;
};
performance: {
mountTime?: number;
updateTimes: number[];
validationTime: number;
};
}
/**
* Performance snapshot
*/
export interface PerformanceSnapshot {
memory: number;
timing: {
[key: string]: number;
};
validationOverhead: number;
cacheEfficiency: number;
}
/**
* Validation debugging inspector
*/
export declare class ValidationDebugger {
private static instance;
private sessions;
private currentSession;
private eventListeners;
private componentRegistry;
static getInstance(): ValidationDebugger;
/**
* Start a debugging session
*/
startSession(sessionId?: string): string;
/**
* End the current debugging session
*/
endSession(): DebugSession | null;
/**
* Log a debug event
*/
logEvent(type: ValidationDebugEventType, message: string, data?: any): void;
/**
* Register component for debugging
*/
registerComponent(_component: ComponentInstance, type: string, props: any): string;
/**
* Update component debug info
*/
updateComponent(componentId: string, phase: 'mount' | 'update' | 'unmount', data?: any): void;
/**
* Record validation error for debugging
*/
recordValidationError(error: any, componentId?: string): void;
/**
* Record validation recovery for debugging
*/
recordValidationRecovery(originalError: string, recoveryStrategy: string, componentId?: string): void;
/**
* Add event listener for debug events
*/
addEventListener(type: ValidationDebugEventType, listener: (event: DebugEvent) => void): void;
/**
* Remove event listener
*/
removeEventListener(type: ValidationDebugEventType, listener: Function): void;
/**
* Get debug session by ID
*/
getSession(sessionId: string): DebugSession | undefined;
/**
* Get current active session
*/
getCurrentSession(): DebugSession | null;
/**
* Get all debug sessions
*/
getAllSessions(): DebugSession[];
/**
* Search debug events by criteria
*/
searchEvents(criteria: {
type?: ValidationDebugEventType;
componentType?: string;
timeRange?: {
start: number;
end: number;
};
messageContains?: string;
}): DebugEvent[];
/**
* Analyze component performance
*/
analyzeComponent(componentId: string): ComponentDebugInfo | null;
/**
* Generate performance report
*/
generatePerformanceReport(): string;
/**
* Clear all debug data
*/
clearDebugData(): void;
/**
* Export debug data for external analysis
*/
exportDebugData(): string;
/**
* Import debug data from external source
*/
importDebugData(jsonData: string): void;
/**
* Print session summary to console
*/
private printSessionSummary;
}
/**
* Global validation debugger instance
*/
export declare const validationDebugger: ValidationDebugger;
/**
* Validation debugging utilities
*/
export declare const ValidationDebugUtils: {
/**
* Start debugging session
*/
startSession: (sessionId?: string) => string;
/**
* End debugging session
*/
endSession: () => DebugSession | null;
/**
* Log debug event
*/
logEvent: (type: ValidationDebugEventType, message: string, data?: any) => void;
/**
* Register component for debugging
*/
registerComponent: (component: ComponentInstance, type: string, props: any) => string;
/**
* Record validation error
*/
recordError: (error: any, componentId?: string) => void;
/**
* Record validation recovery
*/
recordRecovery: (originalError: string, strategy: string, componentId?: string) => void;
/**
* Get performance report
*/
getPerformanceReport: () => string;
/**
* Search events
*/
searchEvents: (criteria: any) => DebugEvent[];
/**
* Export debug data
*/
export: () => string;
/**
* Import debug data
*/
import: (data: string) => void;
/**
* Clear all debug data
*/
clear: () => void;
/**
* Test debugging system
*/
test: () => void;
};
//# sourceMappingURL=validation-debug-tools.d.ts.map