@neuroequality/neuroadapt-mobile
Version:
Mobile accessibility features for React Native and cross-platform apps
157 lines • 4.91 kB
TypeScript
/**
* Accessible Gestures - Customizable mobile gesture system
* @fileoverview Provides accessible gesture recognition and customization for mobile apps
*/
export interface GestureConfig {
type: GestureType;
sensitivity: 'low' | 'medium' | 'high';
requiresConfirmation: boolean;
hapticFeedback: boolean;
audioFeedback: boolean;
timeoutMs: number;
customization: GestureCustomization;
}
export type GestureType = 'tap' | 'double_tap' | 'long_press' | 'swipe_left' | 'swipe_right' | 'swipe_up' | 'swipe_down' | 'pinch' | 'rotate' | 'two_finger_tap' | 'three_finger_tap' | 'four_finger_tap' | 'shake';
export interface GestureCustomization {
minimumDistance?: number;
maximumDistance?: number;
minimumVelocity?: number;
maximumVelocity?: number;
minimumDuration?: number;
maximumDuration?: number;
requiredFingers?: number;
allowSimultaneous?: boolean;
}
export interface GestureEvent {
type: GestureType;
timestamp: number;
duration: number;
distance: number;
velocity: number;
fingerCount: number;
location: {
x: number;
y: number;
};
target?: any;
}
export interface GestureHandler {
id: string;
gesture: GestureType;
callback: (event: GestureEvent) => void;
enabled: boolean;
config: GestureConfig;
}
export interface AccessibilityGestureMap {
navigation: {
next: GestureType;
previous: GestureType;
activate: GestureType;
back: GestureType;
home: GestureType;
};
content: {
scrollUp: GestureType;
scrollDown: GestureType;
scrollLeft: GestureType;
scrollRight: GestureType;
zoom: GestureType;
details: GestureType;
};
system: {
menu: GestureType;
settings: GestureType;
help: GestureType;
emergency: GestureType;
};
}
/**
* Accessible Gesture Manager
*/
export declare class AccessibleGestureManager {
private handlers;
private gestureMap;
private isEnabled;
private debugMode;
constructor(customGestureMap?: Partial<AccessibilityGestureMap>);
/**
* Register a gesture handler
*/
registerHandler(id: string, gestureType: GestureType, callback: (event: GestureEvent) => void, config?: Partial<GestureConfig>): void;
/**
* Unregister a gesture handler
*/
unregisterHandler(id: string): void;
/**
* Enable or disable a gesture handler
*/
setHandlerEnabled(id: string, enabled: boolean): void;
/**
* Update gesture configuration
*/
updateGestureConfig(id: string, config: Partial<GestureConfig>): void;
/**
* Process gesture event
*/
processGesture(event: GestureEvent): boolean;
/**
* Get accessibility gesture for action
*/
getGestureForAction(category: keyof AccessibilityGestureMap, action: string): GestureType | null;
/**
* Customize gesture mapping
*/
customizeGestureMap(category: keyof AccessibilityGestureMap, action: string, gesture: GestureType): void;
/**
* Get gesture statistics
*/
getGestureStatistics(): {
totalHandlers: number;
enabledHandlers: number;
gesturesByType: Record<GestureType, number>;
recentActivity: GestureEvent[];
};
/**
* Enable/disable gesture system
*/
setEnabled(enabled: boolean): void;
/**
* Enable/disable debug mode
*/
setDebugMode(enabled: boolean): void;
/**
* Create platform-specific gesture recognizer
*/
createGestureRecognizer(gestureType: GestureType, config: GestureConfig): any;
/**
* Get recommended gestures for user needs
*/
getRecommendedGestures(userNeeds: {
hasMotorDifficulties: boolean;
hasVisionImpairment: boolean;
hasHearingImpairment: boolean;
prefersSingleFinger: boolean;
}): {
recommended: GestureType[];
discouraged: GestureType[];
alternatives: Record<GestureType, GestureType[]>;
};
private initializeDefaultHandlers;
private getDefaultCustomization;
private validateGesture;
private triggerHapticFeedback;
private triggerAudioFeedback;
private requestConfirmation;
}
/**
* React Hook for gesture management
*/
export declare const useAccessibleGestures: (gestureMap?: Partial<AccessibilityGestureMap>) => {
registerGesture: (id: string, gestureType: GestureType, callback: (event: GestureEvent) => void, config?: Partial<GestureConfig>) => void;
unregisterGesture: (id: string) => void;
processGesture: (event: GestureEvent) => boolean;
getGestureForAction: (category: keyof AccessibilityGestureMap, action: string) => GestureType | null;
gestureManager: AccessibleGestureManager;
};
export default AccessibleGestureManager;
//# sourceMappingURL=accessible-gestures.d.ts.map