UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

77 lines (76 loc) 2.79 kB
/** * Logic for matching JSX elements to applicable accessibility rules * Provides efficient rule lookup and filtering based on element characteristics */ import { JSXElementInfo, A11yRule, A11yRuleMatch } from "../types/accessibilityTypes"; export declare class ElementMatcher { /** * Find all rules that apply to a given JSX element */ static getApplicableRules(element: JSXElementInfo): A11yRule[]; /** * Create rule matches for an element with its applicable rules */ static createRuleMatches(element: JSXElementInfo): A11yRuleMatch[]; /** * Batch process multiple elements to find all rule matches */ static createRuleMatchesForElements(elements: JSXElementInfo[]): A11yRuleMatch[]; /** * Check if an element matches a given selector */ private static matchesSelector; /** * Get rules that are specifically for HTML elements */ static getHTMLElementRules(): A11yRule[]; /** * Get rules that apply to React components (non-HTML elements) */ static getReactComponentRules(): A11yRule[]; /** * Filter elements by type (HTML vs React components) */ static filterElementsByType(elements: JSXElementInfo[], type: "html" | "react"): JSXElementInfo[]; /** * Get rules applicable to a specific WCAG level */ static getRulesForWCAGLevel(level: "A" | "AA" | "AAA"): A11yRule[]; /** * Get rules with specific severity level */ static getRulesForSeverity(severity: "error" | "warning" | "info"): A11yRule[]; /** * Find elements that match a specific rule */ static findElementsForRule(elements: JSXElementInfo[], ruleId: string): JSXElementInfo[]; /** * Check if any elements in a collection match a rule */ static hasElementsForRule(elements: JSXElementInfo[], ruleId: string): boolean; /** * Get rule matches grouped by rule ID */ static groupMatchesByRule(matches: A11yRuleMatch[]): Record<string, A11yRuleMatch[]>; /** * Get rule matches grouped by element */ static groupMatchesByElement(matches: A11yRuleMatch[]): Map<JSXElementInfo, A11yRuleMatch[]>; /** * Find rules that have no matching elements (useful for coverage analysis) */ static findUnusedRules(elements: JSXElementInfo[]): A11yRule[]; /** * Calculate rule coverage statistics */ static calculateRuleCoverage(elements: JSXElementInfo[]): { totalRules: number; applicableRules: number; coveragePercentage: number; unusedRules: string[]; }; /** * Optimize rule matching by pre-filtering based on element characteristics */ static optimizedRuleMatching(elements: JSXElementInfo[]): A11yRuleMatch[]; }