@untemps/react-vocal 2.0.0-beta.4 → 2.0.0-beta.5
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 +12 -0
- package/README.md +13 -1
- package/dist/index.es.js +97 -1243
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -3
- package/src/hooks/__tests__/useCommands.test.js +28 -2
- package/src/hooks/useCommands.js +37 -11
- package/vite.config.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [2.0.0-beta.5](https://github.com/untemps/react-vocal/compare/v2.0.0-beta.4...v2.0.0-beta.5) (2026-05-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Make fuse.js an optional peer dependency ([#117](https://github.com/untemps/react-vocal/issues/117)) ([a1c2a33](https://github.com/untemps/react-vocal/commit/a1c2a337f8d4ba4729c81f0a9b8664bcf914755f))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* fuse.js must now be installed separately to enable fuzzy matching for phrase commands.
|
|
12
|
+
|
|
1
13
|
# [2.0.0-beta.4](https://github.com/untemps/react-vocal/compare/v2.0.0-beta.3...v2.0.0-beta.4) (2026-05-10)
|
|
2
14
|
|
|
3
15
|
|
package/README.md
CHANGED
|
@@ -46,6 +46,14 @@ Although the lack of `SpeechGrammar` and `SpeechGrammarList` is handled by the u
|
|
|
46
46
|
yarn add @untemps/react-vocal
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
Fuzzy matching for phrase commands requires [fuse.js](https://fusejs.io/) as an optional peer dependency:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
yarn add fuse.js
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Without fuse.js, phrase commands fall back to case-insensitive exact matching. Single-word commands always use exact matching and never require fuse.js.
|
|
56
|
+
|
|
49
57
|
## Usage
|
|
50
58
|
|
|
51
59
|
### `Vocal` component
|
|
@@ -190,7 +198,11 @@ const commands = {
|
|
|
190
198
|
}
|
|
191
199
|
```
|
|
192
200
|
|
|
193
|
-
The component utilizes a special hook called `useCommands` to respond to the commands.
|
|
201
|
+
The component utilizes a special hook called `useCommands` to respond to the commands.
|
|
202
|
+
The hook performs a fuzzy search to match approximate commands if needed. This allows to fix accidental typos or approximate recognition results.
|
|
203
|
+
To do so the hook uses [fuse.js](https://fusejs.io/) which implements an algorithm to find strings that are approximately equal to a given input. The score precision that distinguishes acceptable command-to-callback mapping from negative matching can be customized in the hook instantiation.
|
|
204
|
+
|
|
205
|
+
fuse.js is an optional peer dependency — install it separately to enable fuzzy matching (see [Installation](#installation)). Without it, phrase commands fall back to case-insensitive exact matching.
|
|
194
206
|
|
|
195
207
|
**Single-word command keys** (e.g. `rouge`, `submit`) use exact case-insensitive lookup. When the recognition returns a multi-word transcript, each word is tried individually so a command fires even when embedded in a phrase (e.g. _"je veux du rouge"_ triggers `rouge`).
|
|
196
208
|
|