Skip to content

Commit 1fd59dd

Browse files
update readme
1 parent 07dfa18 commit 1fd59dd

File tree

2 files changed

+56
-64
lines changed

2 files changed

+56
-64
lines changed

README.md

Lines changed: 55 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,73 @@
1-
# voicecapture-vue
1+
Here's a more concise version of the README for `voicecapture-vue`, incorporating your previous example while maintaining clarity:
22

3-
A component darkmode injection in your document page with vue.js
3+
---
44

5-
<a href="https://voicecapture-vue.web.app" target="_blank">Live Preview</a>
5+
# VoiceCapture Vue
66

7-
Install
8-
```js
9-
npm install --save voicecapture-vue
10-
```
7+
`VoiceCapture Vue` is a Vue component for real-time voice capture and speech transcription. This component leverages the Web Speech API for speech recognition and provides an interactive UI.
118

12-
Usage basic
13-
```vue
14-
import VoiceCaptureVue from 'voicecapture-vue';
9+
## Installation
1510

16-
<VoiceCaptureVue />
17-
```
11+
Install `voicecapture-vue` via npm:
1812

19-
Prop hiddenLabel
20-
```vue
21-
<VoiceCaptureVue :hiddenLabel="true" />
13+
```bash
14+
npm install voicecapture-vue
2215
```
2316

24-
Prop hiddenIcon
25-
```vue
26-
<VoiceCaptureVue :hiddenIcon="true" />
27-
```
17+
## Basic Usage
2818

29-
Prop labelDark and labelLight
30-
```vue
31-
<VoiceCaptureVue labelDark="Tema escuro" labelLight="Tema claro" />
32-
```
19+
### Script Setup
3320

34-
Slot change icon and label custom
35-
```vue
36-
<VoiceCaptureVue>
37-
<template #iconDark>
38-
<svg></svg>
39-
</template>
40-
<template #iconLight>
41-
<svg></svg>
42-
</template>
43-
<template #labelDark>
44-
Off
45-
</template>
46-
<template #labelLight>
47-
On
48-
</template>
49-
</VoiceCaptureVue>
50-
```
21+
```javascript
22+
<script setup>
23+
import { ref } from 'vue';
24+
import VoiceCapture from 'voicecapture-vue';
5125

52-
Usage useVoiceCaptureVue with toggleMode and mode value
53-
```vue
54-
import { useVoiceCaptureVue } from 'voicecapture-vue';
26+
const isVoiceCaptureActive = ref(false);
27+
const selectedLang = ref('en');
28+
const selectedMode = ref('fullscreen');
29+
const transcript = ref('');
5530

56-
const { mode, toggleMode } = useVoiceCaptureVue();
31+
function handleTranscript(text) {
32+
transcript.value = text;
33+
}
5734

58-
<button @click="toggleMode">VoiceCaptureVue {{ mode }}</button>
35+
function handleStatusChange(status) {
36+
isVoiceCaptureActive.value = status;
37+
}
38+
</script>
5939
```
6040

61-
Style modification and usage in your styles
62-
```css
63-
body {
64-
--dm-color-primary: #41b883;
65-
--dm-color-secondary: #34495e;
66-
--dm-color-text: #222;
67-
--dm-color-background: #fff;
68-
}
41+
### Template Example
6942

70-
body.darkmode {
71-
--dm-color-text: #fff;
72-
--dm-color-background: #222;
73-
}
43+
Use the component in your template with language and mode options:
44+
45+
```html
46+
<template>
47+
<div>
48+
<VoiceCapture
49+
:status="isVoiceCaptureActive"
50+
:lang="selectedLang"
51+
:mode="selectedMode"
52+
@voiceTranscript="handleTranscript"
53+
@onStatus="handleStatusChange"
54+
/>
55+
<textarea v-model="transcript" placeholder="Transcript results"></textarea>
56+
</div>
57+
</template>
7458
```
75-
Create your variable colors and update this with class .darkmode.
7659

77-
### Description class of components
78-
If VoiceCaptureVue usage in a page, a class in body document is update with class darkmode.
79-
In LocalStorage is created a key store with value current mode.
80-
Do you usage children body.darkmode styles for your application.
81-
I recomend create a variables colors in css and update this with toggle class of body document.
60+
### Props
61+
62+
| Prop | Type | Default | Description |
63+
|------------|---------|------------|----------------------------------------------------------------------------------------------|
64+
| `status` | Boolean | `false` | Toggles the voice capture on/off. Set to `true` to activate voice recognition. |
65+
| `lang` | String | `"en"` | Specifies the language for speech recognition (e.g., `"pt"` for Portuguese). |
66+
| `mode` | String | `"normal"` | Defines the display mode: `"normal"` for inline, `"fullscreen"` for full-screen. |
67+
68+
### Events
69+
70+
| Event | Payload | Description |
71+
|--------------------|-------------|-------------------------------------------------------------------------------------------------|
72+
| `@voiceTranscript` | `String` | Emitted with the transcription generated from the user's speech. |
73+
| `@onStatus` | `Boolean` | Emitted when the voice capture status changes (active/inactive). |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "voicecapture-vue",
3-
"version": "0.4.1",
3+
"version": "0.0.1",
44
"private": false,
55
"type": "module",
66
"files": [

0 commit comments

Comments
 (0)