aura-glass
Version:
A comprehensive glassmorphism design system for React applications with 142+ production-ready components
125 lines • 4.03 kB
TypeScript
import React from "react";
declare global {
interface Window {
SpeechRecognition: typeof SpeechRecognition;
webkitSpeechRecognition: typeof SpeechRecognition;
webkitAudioContext: typeof AudioContext;
}
}
interface SpeechRecognition extends EventTarget {
continuous: boolean;
interimResults: boolean;
lang: string;
maxAlternatives: number;
onstart: ((this: SpeechRecognition, ev: Event) => any) | null;
onend: ((this: SpeechRecognition, ev: Event) => any) | null;
onresult: ((this: SpeechRecognition, ev: SpeechRecognitionEvent) => any) | null;
onerror: ((this: SpeechRecognition, ev: SpeechRecognitionErrorEvent) => any) | null;
start(): void;
stop(): void;
abort(): void;
}
interface SpeechRecognitionEvent extends Event {
resultIndex: number;
results: SpeechRecognitionResultList;
}
interface SpeechRecognitionErrorEvent extends Event {
error: string;
message?: string;
}
interface SpeechRecognitionResultList {
readonly length: number;
item(index: number): SpeechRecognitionResult;
[index: number]: SpeechRecognitionResult;
}
interface SpeechRecognitionResult {
readonly length: number;
item(index: number): SpeechRecognitionAlternative;
[index: number]: SpeechRecognitionAlternative;
isFinal: boolean;
}
interface SpeechRecognitionAlternative {
transcript: string;
confidence: number;
}
declare var SpeechRecognition: {
prototype: SpeechRecognition;
new (): SpeechRecognition;
};
export interface VoiceCommand {
phrase: string;
action: string;
confidence: number;
timestamp: number;
id: string;
}
export interface VoiceAnalysis {
volume: number;
frequency: number;
clarity: number;
pitch: number;
timestamp: number;
}
export interface GlassVoiceInputProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange" | "onError"> {
/** Whether voice input is active */
active?: boolean;
/** Voice recognition language */
language?: string;
/** Continuous listening mode */
continuous?: boolean;
/** Interim results while speaking */
interimResults?: boolean;
/** Maximum recognition alternatives */
maxAlternatives?: number;
/** Commands to listen for */
commands?: Array<{
phrase: string;
action: string;
fuzzy?: boolean;
}>;
/** Wake word for activation */
wakeWord?: string;
/** Minimum confidence threshold */
confidenceThreshold?: number;
/** Whether to show voice visualizations */
showVisualizer?: boolean;
/** Visualizer style */
visualizerStyle?: "waveform" | "circular" | "bars" | "particle";
/** Whether to show transcript */
showTranscript?: boolean;
/** Maximum transcript length */
maxTranscriptLength?: number;
/** Voice input timeout */
timeout?: number;
/** Noise suppression */
noiseSuppression?: boolean;
/** Echo cancellation */
echoCancellation?: boolean;
/** Auto gain control */
autoGainControl?: boolean;
/** Voice change handler */
onVoiceStart?: () => void;
/** Voice end handler */
onVoiceEnd?: () => void;
/** Speech result handler */
onResult?: (result: string, confidence: number) => void;
/** Command recognition handler */
onCommand?: (command: VoiceCommand) => void;
/** Error handler */
onError?: (error: string) => void;
/** Audio level handler */
onAudioLevel?: (level: number) => void;
/** Transcript change handler */
onTranscriptChange?: (transcript: string) => void;
/** Show controls */
showControls?: boolean;
/** Respect user's motion preferences */
respectMotionPreference?: boolean;
/**
* Custom data-testid for testing
*/
"data-testid"?: string;
}
export declare const GlassVoiceInput: React.ForwardRefExoticComponent<GlassVoiceInputProps & React.RefAttributes<HTMLDivElement>>;
export default GlassVoiceInput;
//# sourceMappingURL=GlassVoiceInput.d.ts.map