UNPKG

aura-glass

Version:

A comprehensive glassmorphism design system for React applications with 142+ production-ready components

112 lines (108 loc) 3.19 kB
interface HapticPattern { intensity: number; duration: number; delay?: number; pattern?: number[]; } export declare class GlassSoundDesign { private static instance; private audioContext; private sounds; private oscillators; private gainNodes; private enabled; private hapticEnabled; private readonly glassSounds; private readonly hapticPatterns; private constructor(); /** * Attach one-time listeners to create/resume AudioContext after a user gesture */ private setupGestureListeners; static getInstance(): GlassSoundDesign; /** * Get available glass sound types */ getGlassSoundTypes(): Array<keyof typeof this.glassSounds>; /** * Get available haptic pattern types */ getHapticPatternTypes(): Array<keyof typeof this.hapticPatterns>; /** * Initialize Web Audio API context */ private initAudioContext; /** * Allow callers to explicitly request audio enablement (e.g., from a button onClick) */ requestEnableAudio(): Promise<boolean>; /** * Check if haptic feedback is supported */ private checkHapticSupport; /** * Play a synthetic glass sound */ playGlassSound(type: keyof typeof GlassSoundDesign.prototype.glassSounds, customConfig?: Partial<typeof GlassSoundDesign.prototype.glassSounds.tap>): void; /** * Play a chord (multiple frequencies) */ playChord(frequencies: number[], duration?: number, volume?: number): void; /** * Play an arpeggio */ playArpeggio(frequencies: number[], noteDuration?: number, noteDelay?: number, volume?: number): void; /** * Create ambient glass atmosphere */ createAmbientGlass(config?: { baseFrequency?: number; modulationRate?: number; volume?: number; }): { id: string; stop: () => void; setVolume: (newVolume: number) => void; } | null; /** * Trigger haptic feedback */ triggerHaptic(pattern: keyof typeof GlassSoundDesign.prototype.hapticPatterns | HapticPattern): void; /** * Combined sound and haptic feedback */ playFeedback(type: 'tap' | 'hover' | 'slide' | 'success' | 'error' | 'notification'): void; /** * Create a glass resonance effect */ createResonance(frequency?: number, decay?: number): void; /** * Enable/disable sound */ setEnabled(enabled: boolean): void; /** * Enable/disable haptics */ setHapticEnabled(enabled: boolean): void; /** * Get audio context state */ getState(): { soundEnabled: boolean; hapticEnabled: boolean; audioContextState: AudioContextState | undefined; }; /** * Cleanup */ destroy(): void; } export declare const glassSoundDesign: GlassSoundDesign; export declare function useGlassSound(): { play: (type: string) => void; haptic: (pattern: string) => void; feedback: (type: Parameters<typeof glassSoundDesign.playFeedback>[0]) => void; soundDesign: GlassSoundDesign; }; export {}; //# sourceMappingURL=soundDesign.d.ts.map