a11yanalyze
Version:
A command-line tool for developers and QA engineers to test web pages and websites for WCAG 2.2 AA accessibility compliance
111 lines • 3.39 kB
TypeScript
import { AccessibilityIssue, WCAGLevel } from '../types';
/**
* Configuration for WCAG level handling
*/
export interface WCAGLevelConfig {
/** Primary WCAG compliance level (determines what are errors vs warnings) */
primaryLevel: WCAGLevel;
/** Whether to include AAA level checks as warnings */
includeAAA: boolean;
/** Whether to include ARIA checks as warnings */
includeARIA: boolean;
/** Whether to treat warnings as errors */
treatWarningsAsErrors: boolean;
/** Whether to include best practice violations */
includeBestPractices: boolean;
/** Custom severity overrides for specific WCAG criteria */
severityOverrides: Record<string, AccessibilityIssue['severity']>;
}
/**
* WCAG level information and metadata
*/
export interface WCAGLevelInfo {
level: WCAGLevel;
isRequired: boolean;
isWarning: boolean;
category: 'error' | 'warning' | 'info';
priority: number;
}
/**
* WCAG compliance level handler
* Manages WCAG level selection, categorization, and severity mapping
*/
export declare class WCAGLevelHandler {
private config;
constructor(config?: Partial<WCAGLevelConfig>);
/**
* Determine if a WCAG level should be included in scanning
*/
shouldIncludeLevel(level: WCAGLevel): boolean;
/**
* Get WCAG level information including categorization
*/
getLevelInfo(level: WCAGLevel): WCAGLevelInfo;
/**
* Determine if a WCAG level is required (error) based on primary level
*/
private isRequiredLevel;
/**
* Determine if a WCAG level should be treated as warning
*/
private isWarningLevel;
/**
* Get priority for WCAG level (lower number = higher priority)
*/
private getLevelPriority;
/**
* Map WCAG level and impact to appropriate severity
*/
mapToSeverity(level: WCAGLevel, impact: string, wcagReference?: string): AccessibilityIssue['severity'];
/**
* Map impact to error severity (full range)
*/
private mapImpactToErrorSeverity;
/**
* Map impact to warning severity (capped at warning)
*/
private mapImpactToWarningSeverity;
/**
* Filter issues based on WCAG level configuration
*/
filterIssues(issues: AccessibilityIssue[]): AccessibilityIssue[];
/**
* Categorize issues by WCAG level
*/
categorizeIssues(issues: AccessibilityIssue[]): {
errors: AccessibilityIssue[];
warnings: AccessibilityIssue[];
info: AccessibilityIssue[];
};
/**
* Generate axe-core tags based on WCAG level configuration
*/
generateAxeTags(): string[];
/**
* Get compliance summary for scan results
*/
getComplianceSummary(issues: AccessibilityIssue[]): {
compliant: boolean;
primaryLevelIssues: number;
warningIssues: number;
totalIssues: number;
levelBreakdown: Record<WCAGLevel, number>;
};
/**
* Update configuration
*/
updateConfig(newConfig: Partial<WCAGLevelConfig>): void;
/**
* Get current configuration
*/
getConfig(): WCAGLevelConfig;
/**
* Get supported WCAG levels with descriptions
*/
static getSupportedLevels(): Array<{
level: WCAGLevel;
description: string;
requirements: string;
}>;
}
//# sourceMappingURL=wcag-level-handler.d.ts.map