@untemps/vocal 2.0.0-beta.24 → 2.0.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ # [2.0.0-beta.25](https://github.com/untemps/vocal/compare/v2.0.0-beta.24...v2.0.0-beta.25) (2026-05-22)
2
+
1
3
  # [2.0.0-beta.24](https://github.com/untemps/vocal/compare/v2.0.0-beta.23...v2.0.0-beta.24) (2026-05-22)
2
4
 
3
5
  # [2.0.0-beta.23](https://github.com/untemps/vocal/compare/v2.0.0-beta.22...v2.0.0-beta.23) (2026-05-22)
@@ -0,0 +1,73 @@
1
+ declare global {
2
+ interface SpeechRecognition extends EventTarget {
3
+ continuous: boolean;
4
+ grammars: SpeechGrammarList | null;
5
+ interimResults: boolean;
6
+ lang: string;
7
+ maxAlternatives: number;
8
+ start(): void;
9
+ stop(): void;
10
+ abort(): void;
11
+ }
12
+ var SpeechRecognition: {
13
+ new (): SpeechRecognition;
14
+ prototype: SpeechRecognition;
15
+ };
16
+ interface SpeechGrammarList {
17
+ length: number;
18
+ }
19
+ var SpeechGrammarList: {
20
+ new (): SpeechGrammarList;
21
+ prototype: SpeechGrammarList;
22
+ };
23
+ interface Window {
24
+ SpeechRecognition?: typeof SpeechRecognition;
25
+ webkitSpeechRecognition?: typeof SpeechRecognition;
26
+ mozSpeechRecognition?: typeof SpeechRecognition;
27
+ msSpeechRecognition?: typeof SpeechRecognition;
28
+ SpeechGrammarList?: typeof SpeechGrammarList;
29
+ webkitSpeechGrammarList?: typeof SpeechGrammarList;
30
+ mozSpeechGrammarList?: typeof SpeechGrammarList;
31
+ msSpeechGrammarList?: typeof SpeechGrammarList;
32
+ }
33
+ }
34
+ export interface VocalOptions {
35
+ grammars?: SpeechGrammarList | null;
36
+ lang?: string;
37
+ continuous?: boolean;
38
+ interimResults?: boolean;
39
+ maxAlternatives?: number;
40
+ }
41
+ export declare const eventTypes: {
42
+ readonly AUDIO_END: "audioend";
43
+ readonly AUDIO_START: "audiostart";
44
+ readonly END: "end";
45
+ readonly ERROR: "error";
46
+ readonly NO_MATCH: "nomatch";
47
+ readonly RESULT: "result";
48
+ readonly SOUND_END: "soundend";
49
+ readonly SOUND_START: "soundstart";
50
+ readonly SPEECH_END: "speechend";
51
+ readonly SPEECH_START: "speechstart";
52
+ readonly START: "start";
53
+ };
54
+ export type EventType = (typeof eventTypes)[keyof typeof eventTypes];
55
+ export type ResultEventHandler = (event: SpeechRecognitionEvent, bestAlternative: string, alternatives: string[]) => void;
56
+ export type ErrorEventHandler = (event: SpeechRecognitionErrorEvent) => void;
57
+ export type GenericEventHandler = (event: Event) => void;
58
+ export type EventHandlerFor<T extends EventType> = T extends 'result' ? ResultEventHandler : T extends 'error' ? ErrorEventHandler : GenericEventHandler;
59
+ export interface VocalInstance {
60
+ readonly isRecording: boolean;
61
+ start(options?: {
62
+ signal?: AbortSignal;
63
+ }): Promise<void>;
64
+ stop(): void;
65
+ abort(): void;
66
+ on<T extends EventType>(eventType: T, callback: EventHandlerFor<T>): void;
67
+ on(eventType: string, callback: GenericEventHandler): void;
68
+ off<T extends EventType>(eventType: T, callback?: EventHandlerFor<T>): void;
69
+ off(eventType: string, callback?: GenericEventHandler): void;
70
+ cleanup(): void;
71
+ }
72
+ export declare const isSupported: () => boolean;
73
+ export declare const createVocal: (options?: VocalOptions) => VocalInstance;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@untemps/vocal",
3
- "version": "2.0.0-beta.24",
3
+ "version": "2.0.0-beta.25",
4
4
  "description": "Class wrapped around the SpeechRecognition Web API",
5
5
  "repository": "git@github.com:untemps/vocal.git",
6
6
  "keywords": [
@@ -24,6 +24,7 @@
24
24
  "dist/index.cjs",
25
25
  "dist/index.es.js",
26
26
  "dist/index.d.ts",
27
+ "dist/Vocal.d.ts",
27
28
  "CHANGELOG.md"
28
29
  ],
29
30
  "main": "dist/index.cjs",