@ordojs/accessibility
Version:
Comprehensive accessibility system for OrdoJS with ARIA generation, automated testing, and screen reader support
138 lines (134 loc) • 3.5 kB
text/typescript
import { EventEmitter } from 'events';
import { A as AccessibilityConfig, c as ARIARole, b as ARIAAttribute } from '../index-C9qyHjXw.mjs';
/**
* @fileoverview OrdoJS Accessibility - ARIA Module
*
* Automatic ARIA attribute generation and management.
*/
/**
* ARIA manager for handling ARIA attribute generation and management
*/
declare class ARIAManager extends EventEmitter {
private config;
private roles;
private attributes;
private isInitialized;
/**
* Create a new ARIAManager instance
*
* @param config - Accessibility configuration
*/
constructor(config: AccessibilityConfig);
/**
* Initialize the ARIA manager
*/
initialize(): Promise<void>;
/**
* Generate ARIA attributes for an element
*
* @param element - Element information
* @param context - Element context
* @returns Generated ARIA attributes
*/
generateARIA(element: {
tag: string;
content: string;
attributes: Record<string, string>;
}, context?: {
role?: string;
label?: string;
description?: string;
state?: Record<string, any>;
properties?: Record<string, any>;
interactive?: boolean;
landmark?: boolean;
}): Record<string, string>;
/**
* Validate ARIA attributes
*
* @param attributes - ARIA attributes to validate
* @returns Validation result
*/
validateARIA(attributes: Record<string, string>): {
isValid: boolean;
errors: string[];
warnings: string[];
suggestions: string[];
};
/**
* Get ARIA role information
*
* @param role - Role name
* @returns Role information or undefined
*/
getRoleInfo(role: string): ARIARole | undefined;
/**
* Get ARIA attribute information
*
* @param attribute - Attribute name
* @returns Attribute information or undefined
*/
getAttributeInfo(attribute: string): ARIAAttribute | undefined;
/**
* Get all available roles
*
* @returns Array of role names
*/
getAvailableRoles(): string[];
/**
* Get all available attributes
*
* @returns Array of attribute names
*/
getAvailableAttributes(): string[];
/**
* Get roles by type
*
* @param type - Role type
* @returns Array of roles
*/
getRolesByType(type: 'abstract' | 'widget' | 'document' | 'landmark' | 'window'): ARIARole[];
/**
* Get ARIA manager statistics
*
* @returns Statistics
*/
getStats(): {
totalRoles: number;
totalAttributes: number;
rolesByType: Record<string, number>;
};
/**
* Infer role from element
*
* @param tag - Element tag
* @param content - Element content
* @param attributes - Element attributes
* @returns Inferred role or undefined
*/
private inferRole;
/**
* Infer label from content and attributes
*
* @param content - Element content
* @param attributes - Element attributes
* @returns Inferred label or undefined
*/
private inferLabel;
/**
* Generate landmark label
*
* @param tag - Element tag
* @returns Landmark label
*/
private generateLandmarkLabel;
/**
* Load ARIA roles
*/
private loadARIARoles;
/**
* Load ARIA attributes
*/
private loadARIAAttributes;
}
export { ARIAManager };