UNPKG

@tachui/devtools

Version:

Development & debugging tools for tachUI framework

261 lines 7.14 kB
/** * Developer Experience Integration - Phase 1D * * Enhanced error message templates, intelligent fix suggestions, * and comprehensive developer guidance system. */ export type ValidationErrorCategory = 'component' | 'modifier' | 'runtime' | 'reactive' | 'validation' | 'component-construction' | 'modifier-usage' | 'performance'; export type ValidationErrorSeverity = 'error' | 'warning' | 'info' | 'critical'; export interface EnhancedValidationError { message: string; context: { component: string; property?: string; suggestion?: string; documentation?: string; package?: string; }; getFormattedMessage(): string; } export declare function createEnhancedValidationError(message: string, context: { component: string; property?: string; suggestion?: string; documentation?: string; package?: string; }): EnhancedValidationError; /** * Intelligent fix suggestion with automated repair capability */ export interface IntelligentFixSuggestion { id: string; title: string; description: string; difficulty: 'easy' | 'medium' | 'hard'; confidence: number; category: 'syntax' | 'logic' | 'performance' | 'accessibility' | 'best-practice'; before: string; after: string; canAutoFix: boolean; autoFix?: () => string; learnMore?: { documentation: string; examples: string[]; videoTutorial?: string; }; relatedFixes: string[]; } /** * Enhanced error message template with rich formatting */ export interface DeveloperErrorMessageTemplate { id: string; title: string; description: string; severity: ValidationErrorSeverity; category: ValidationErrorCategory; emoji: string; color: string; quickFix: string; explanation: string; prevention: string; suggestions: IntelligentFixSuggestion[]; examples: { wrong: CodeExample[]; correct: CodeExample[]; }; documentation: { primary: string; related: string[]; apiReference?: string; }; context: { component?: string; modifier?: string; package?: string; commonCause: string[]; }; } /** * Code example with syntax highlighting metadata */ export interface CodeExample { code: string; language: 'typescript' | 'javascript' | 'tsx' | 'jsx'; title: string; description?: string; highlights?: { line: number; type: 'error' | 'warning' | 'info' | 'success'; message: string; }[]; } /** * Developer experience configuration */ export interface DeveloperExperienceConfig { verbosity: 'minimal' | 'standard' | 'detailed' | 'comprehensive'; showEmojis: boolean; showColors: boolean; showCodeExamples: boolean; showDocumentationLinks: boolean; enableAutoFix: boolean; suggestionCount: number; minConfidenceScore: number; enableInlineHelp: boolean; enableHoverInfo: boolean; enableQuickActions: boolean; showLearningTips: boolean; trackProgress: boolean; personalization: boolean; } /** * Comprehensive error message templates database */ export declare const errorMessageTemplates: Record<string, DeveloperErrorMessageTemplate>; /** * Intelligent fix suggestion engine */ export declare class FixSuggestionEngine { private suggestionDatabase; private usageTracker; constructor(); /** * Get intelligent fix suggestions for a given error */ getSuggestions(errorType: string, _context: { component?: string; modifier?: string; code?: string; severity?: ValidationErrorSeverity; }): IntelligentFixSuggestion[]; /** * Apply automatic fix */ applyAutoFix(suggestionId: string, _code: string): string | null; /** * Track suggestion usage for improvement */ private trackSuggestionUsage; /** * Initialize suggestion database with common fixes */ private initializeSuggestionDatabase; /** * Get suggestion statistics */ getStatistics(): { totalSuggestions: number; totalUsages: number; topSuggestions: [string, number][]; }; } /** * Enhanced error message formatter with rich templates */ export declare class EnhancedErrorFormatter { private fixEngine; /** * Format error with enhanced template */ formatError(error: EnhancedValidationError, templateId?: string): FormattedErrorMessage; /** * Find the best template for an error */ private findBestTemplate; /** * Render formatted message with rich content */ private renderFormattedMessage; /** * Format basic error without template */ private formatBasicError; /** * Generate quick actions for IDE integration */ private generateQuickActions; } /** * Formatted error message with rich content */ export interface FormattedErrorMessage { id: string; template: DeveloperErrorMessageTemplate | null; error: EnhancedValidationError; suggestions: IntelligentFixSuggestion[]; formatted: string; interactive: { canAutoFix: boolean; quickActions: QuickAction[]; learnMore: { primary: string; related: string[]; }; }; } /** * Quick action for IDE integration */ export interface QuickAction { id: string; title: string; description: string; command: string; arguments: any[]; } /** * Configure developer experience */ export declare function configureDeveloperExperience(config: Partial<DeveloperExperienceConfig>): void; /** * Get current developer experience configuration */ export declare function getDeveloperExperienceConfig(): DeveloperExperienceConfig; declare const enhancedFormatter: EnhancedErrorFormatter; declare const fixEngine: FixSuggestionEngine; /** * Developer Experience utilities */ export declare const DeveloperExperienceUtils: { /** * Format error with enhanced template */ formatError: (error: EnhancedValidationError, templateId?: string) => FormattedErrorMessage; /** * Get fix suggestions */ getSuggestions: (errorType: string, context: any) => IntelligentFixSuggestion[]; /** * Apply automatic fix */ applyAutoFix: (suggestionId: string, code: string) => string | null; /** * Get available error templates */ getErrorTemplates: () => Record<string, DeveloperErrorMessageTemplate>; /** * Configure experience */ configure: typeof configureDeveloperExperience; /** * Get statistics */ getStatistics: () => { formatter: { templatesAvailable: number; }; fixEngine: { totalSuggestions: number; totalUsages: number; topSuggestions: [string, number][]; }; config: DeveloperExperienceConfig; }; /** * Test developer experience system */ test: () => void; }; export { enhancedFormatter, fixEngine }; //# sourceMappingURL=developer-experience.d.ts.map