kempo-ui 0.4.2 → 0.4.4
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/.claude/skills/get-icon/SKILL.md +144 -0
- package/.claude/skills/highlight-code/SKILL.md +62 -0
- package/.claude/skills/new-component/SKILL.md +362 -0
- package/.github/skills/get-icon/SKILL.md +4 -4
- package/.github/skills/highlight-code/SKILL.md +51 -20
- package/.github/skills/new-component/SKILL.md +183 -152
- package/AGENTS.md +2 -2
- package/dist/components/Calendar.js +170 -0
- package/dist/components/SpeechToText.js +60 -0
- package/dist/components/TextToSpeech.js +56 -0
- package/dist/components/Time.js +37 -0
- package/docs/components/accordion.html +16 -0
- package/docs/components/aside.html +16 -0
- package/docs/components/calendar.html +720 -0
- package/docs/components/card.html +16 -0
- package/docs/components/code-editor.html +16 -0
- package/docs/components/color-picker.html +16 -0
- package/docs/components/combobox.html +16 -0
- package/docs/components/content-slider.html +16 -0
- package/docs/components/context.html +16 -0
- package/docs/components/dialog.html +16 -0
- package/docs/components/dropdown.html +16 -0
- package/docs/components/filter-list.html +16 -0
- package/docs/components/focus-capture.html +16 -0
- package/docs/components/html-editor.html +16 -0
- package/docs/components/hybrid-component.html +16 -0
- package/docs/components/icon.html +16 -0
- package/docs/components/import.html +16 -0
- package/docs/components/light-component.html +16 -0
- package/docs/components/nav-spacer.html +16 -0
- package/docs/components/nav.html +16 -0
- package/docs/components/photo-viewer.html +16 -0
- package/docs/components/progress.html +16 -0
- package/docs/components/resize.html +16 -0
- package/docs/components/shadow-component.html +16 -0
- package/docs/components/show-more.html +16 -0
- package/docs/components/slider.html +16 -0
- package/docs/components/sortable.html +16 -0
- package/docs/components/speech-to-text.html +717 -0
- package/docs/components/spinner.html +16 -0
- package/docs/components/split.html +16 -0
- package/docs/components/table.html +16 -0
- package/docs/components/tableControls.html +16 -0
- package/docs/components/tableCustomFields.html +16 -0
- package/docs/components/tableFetchRecords.html +16 -0
- package/docs/components/tableFieldSortHide.html +16 -0
- package/docs/components/tablePagination.html +16 -0
- package/docs/components/tablePlaceholder.html +16 -0
- package/docs/components/tableRecordEditing.html +16 -0
- package/docs/components/tableRecordFiltering.html +16 -0
- package/docs/components/tableRecordHiding.html +16 -0
- package/docs/components/tableRecordSearching.html +16 -0
- package/docs/components/tableRecordSelection.html +16 -0
- package/docs/components/tableRowControls.html +16 -0
- package/docs/components/tableServerSync.html +16 -0
- package/docs/components/tableSorting.html +16 -0
- package/docs/components/tabs.html +16 -0
- package/docs/components/tags.html +16 -0
- package/docs/components/text-to-speech.html +668 -0
- package/docs/components/theme-select.html +16 -0
- package/docs/components/theme-switcher.html +16 -0
- package/docs/components/time.html +670 -0
- package/docs/components/timestamp.html +16 -0
- package/docs/components/toast.html +16 -0
- package/docs/components/toggle.html +16 -0
- package/docs/components/tree.html +16 -0
- package/docs/icons/mic.svg +1 -0
- package/docs/icons/record_voice_over.svg +1 -0
- package/docs/icons/stop.svg +1 -0
- package/docs/index.html +40 -0
- package/docs/src/components/Calendar.js +170 -0
- package/docs/src/components/SpeechToText.js +60 -0
- package/docs/src/components/TextToSpeech.js +56 -0
- package/docs/src/components/Time.js +37 -0
- package/docs/utils/context.html +16 -0
- package/docs/utils/cookie.html +16 -0
- package/docs/utils/debounce.html +16 -0
- package/docs/utils/drag.html +16 -0
- package/docs/utils/elevation.html +16 -0
- package/docs/utils/formatTimestamp.html +16 -0
- package/docs/utils/object.html +16 -0
- package/docs/utils/propConverters.html +16 -0
- package/docs/utils/string.html +16 -0
- package/docs/utils/theme.html +16 -0
- package/docs/utils/toTitleCase.html +16 -0
- package/docs/utils/type.html +16 -0
- package/docs/utils/wait.html +16 -0
- package/docs-src/components/calendar.page.html +254 -0
- package/docs-src/components/speech-to-text.page.html +251 -0
- package/docs-src/components/text-to-speech.page.html +202 -0
- package/docs-src/components/time.page.html +204 -0
- package/docs-src/index.page.html +24 -0
- package/docs-src/nav.fragment.html +16 -0
- package/icons/mic.svg +1 -0
- package/icons/record_voice_over.svg +1 -0
- package/icons/stop.svg +1 -0
- package/llms.txt +4 -0
- package/package.json +1 -1
- package/src/components/Calendar.js +473 -0
- package/src/components/SpeechToText.js +252 -0
- package/src/components/TextToSpeech.js +194 -0
- package/src/components/Time.js +137 -0
- package/tests/components/SpeechToText.browser-test.js +530 -0
- package/tests/components/TextToSpeech.browser-test.js +432 -0
|
@@ -0,0 +1,668 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Text To Speech - Components - Kempo Docs - A Web Components Solution</title>
|
|
7
|
+
<link rel="icon" type="image/png" sizes="48x48" href="../media/icon48.png">
|
|
8
|
+
<link rel="manifest" href="../manifest.json" />
|
|
9
|
+
<link rel="stylesheet" href="../kempo-vars.css" />
|
|
10
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/kempo-css@2/dist/kempo.min.css" />
|
|
11
|
+
<link rel="stylesheet" href="../kempo-hljs.css" />
|
|
12
|
+
<link rel="stylesheet" href="../styles.css" />
|
|
13
|
+
<script>window.litDisableBundleWarning = true;</script>
|
|
14
|
+
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<k-nav
|
|
19
|
+
fixed
|
|
20
|
+
class="bg-primary"
|
|
21
|
+
>
|
|
22
|
+
<button
|
|
23
|
+
id="toggleNavSideMenu"
|
|
24
|
+
class="link"
|
|
25
|
+
>
|
|
26
|
+
<k-icon name="menu"></k-icon>
|
|
27
|
+
</button>
|
|
28
|
+
<a
|
|
29
|
+
href="../"
|
|
30
|
+
class="d-if ph"
|
|
31
|
+
style="align-items: center"
|
|
32
|
+
>
|
|
33
|
+
<img
|
|
34
|
+
src="../media/icon32.png"
|
|
35
|
+
alt="Kempo UI Icon"
|
|
36
|
+
class="pr"
|
|
37
|
+
/>
|
|
38
|
+
Kempo UI
|
|
39
|
+
</a>
|
|
40
|
+
<div
|
|
41
|
+
style="position:relative;margin:0 .25rem;align-self:center;"
|
|
42
|
+
theme="light"
|
|
43
|
+
>
|
|
44
|
+
<input
|
|
45
|
+
id="navSearchInput"
|
|
46
|
+
type="search"
|
|
47
|
+
placeholder="Search docs..."
|
|
48
|
+
autocomplete="off"
|
|
49
|
+
style="width:11rem;"
|
|
50
|
+
/>
|
|
51
|
+
<div
|
|
52
|
+
id="navSearchDropdown"
|
|
53
|
+
hidden
|
|
54
|
+
theme="light"
|
|
55
|
+
style="position:absolute;top:calc(100% + 4px);left:0;width:min(480px,90vw);max-height:70vh;background:var(--c_bg);border:1px solid var(--c_border);border-radius:var(--radius);overflow:auto;z-index:9999;box-shadow:0 4px 12px rgba(0,0,0,.3);"
|
|
56
|
+
>
|
|
57
|
+
<k-filter-list
|
|
58
|
+
id="navSearchList"
|
|
59
|
+
style="display:block;padding:.25rem 0;"
|
|
60
|
+
>
|
|
61
|
+
<k-filter-item filter-keywords="accordion components"><a
|
|
62
|
+
href="../components/accordion.html">Accordion<br><small>Component</small></a></k-filter-item>
|
|
63
|
+
<k-filter-item filter-keywords="aside sidebar components"><a
|
|
64
|
+
href="../components/aside.html">Aside<br><small>Component</small></a></k-filter-item>
|
|
65
|
+
<k-filter-item filter-keywords="calendar date picker range month day components"><a
|
|
66
|
+
href="../components/calendar.html"
|
|
67
|
+
>Calendar<br><small>Component</small></a></k-filter-item>
|
|
68
|
+
<k-filter-item filter-keywords="card components"><a
|
|
69
|
+
href="../components/card.html">Card<br><small>Component</small></a></k-filter-item>
|
|
70
|
+
<k-filter-item filter-keywords="code editor codeeditor monaco components"><a
|
|
71
|
+
href="../components/code-editor.html"
|
|
72
|
+
>Code Editor<br><small>Component</small></a></k-filter-item>
|
|
73
|
+
<k-filter-item filter-keywords="combobox combo box search autocomplete components"><a
|
|
74
|
+
href="../components/combobox.html"
|
|
75
|
+
>Combobox<br><small>Component</small></a></k-filter-item>
|
|
76
|
+
<k-filter-item filter-keywords="color picker colorpicker components"><a
|
|
77
|
+
href="../components/color-picker.html"
|
|
78
|
+
>Color Picker<br><small>Component</small></a></k-filter-item>
|
|
79
|
+
<k-filter-item filter-keywords="content slider components"><a
|
|
80
|
+
href="../components/content-slider.html"
|
|
81
|
+
>Content Slider<br><small>Component</small></a></k-filter-item>
|
|
82
|
+
<k-filter-item filter-keywords="context state global components"><a
|
|
83
|
+
href="../components/context.html"
|
|
84
|
+
>Context<br><small>Component</small></a></k-filter-item>
|
|
85
|
+
<k-filter-item filter-keywords="dialog modal popup components"><a
|
|
86
|
+
href="../components/dialog.html">Dialog<br><small>Component</small></a></k-filter-item>
|
|
87
|
+
<k-filter-item filter-keywords="dropdown select components"><a
|
|
88
|
+
href="../components/dropdown.html">Dropdown<br><small>Component</small></a></k-filter-item>
|
|
89
|
+
<k-filter-item filter-keywords="filter list filterlist components"><a
|
|
90
|
+
href="../components/filter-list.html"
|
|
91
|
+
>Filter List<br><small>Component</small></a></k-filter-item>
|
|
92
|
+
<k-filter-item filter-keywords="focus capture focuscapture components"><a
|
|
93
|
+
href="../components/focus-capture.html"
|
|
94
|
+
>Focus Capture<br><small>Component</small></a></k-filter-item>
|
|
95
|
+
<k-filter-item filter-keywords="html editor components"><a
|
|
96
|
+
href="../components/html-editor.html">HTML
|
|
97
|
+
Editor<br><small>Component</small></a></k-filter-item>
|
|
98
|
+
<k-filter-item filter-keywords="icon components"><a
|
|
99
|
+
href="../components/icon.html">Icon<br><small>Component</small></a></k-filter-item>
|
|
100
|
+
<k-filter-item filter-keywords="import components"><a
|
|
101
|
+
href="../components/import.html">Import<br><small>Component</small></a></k-filter-item>
|
|
102
|
+
<k-filter-item filter-keywords="nav navbar navigation components"><a
|
|
103
|
+
href="../components/nav.html">Nav<br><small>Component</small></a></k-filter-item>
|
|
104
|
+
<k-filter-item filter-keywords="nav spacer navbar spacer navspacer components"><a
|
|
105
|
+
href="../components/nav-spacer.html"
|
|
106
|
+
>Nav Spacer<br><small>Component</small></a></k-filter-item>
|
|
107
|
+
<k-filter-item filter-keywords="photo viewer photoviewer components"><a
|
|
108
|
+
href="../components/photo-viewer.html"
|
|
109
|
+
>Photo Viewer<br><small>Component</small></a></k-filter-item>
|
|
110
|
+
<k-filter-item filter-keywords="progress loading components"><a
|
|
111
|
+
href="../components/progress.html">Progress<br><small>Component</small></a></k-filter-item>
|
|
112
|
+
<k-filter-item filter-keywords="resize components"><a
|
|
113
|
+
href="../components/resize.html">Resize<br><small>Component</small></a></k-filter-item>
|
|
114
|
+
<k-filter-item filter-keywords="show more showmore components"><a
|
|
115
|
+
href="../components/show-more.html"
|
|
116
|
+
>Show More<br><small>Component</small></a></k-filter-item>
|
|
117
|
+
<k-filter-item filter-keywords="slider range input step components"><a
|
|
118
|
+
href="../components/slider.html"
|
|
119
|
+
>Slider<br><small>Component</small></a></k-filter-item>
|
|
120
|
+
<k-filter-item filter-keywords="sortable drag drop sort components"><a
|
|
121
|
+
href="../components/sortable.html"
|
|
122
|
+
>Sortable<br><small>Component</small></a></k-filter-item>
|
|
123
|
+
<k-filter-item filter-keywords="speech to text speechtotext microphone voice recognition transcription components"><a
|
|
124
|
+
href="../components/speech-to-text.html"
|
|
125
|
+
>Speech To Text<br><small>Component</small></a></k-filter-item>
|
|
126
|
+
<k-filter-item filter-keywords="spinner loading components"><a
|
|
127
|
+
href="../components/spinner.html">Spinner<br><small>Component</small></a></k-filter-item>
|
|
128
|
+
<k-filter-item filter-keywords="split pane components"><a
|
|
129
|
+
href="../components/split.html">Split<br><small>Component</small></a></k-filter-item>
|
|
130
|
+
<k-filter-item filter-keywords="table data grid components"><a
|
|
131
|
+
href="../components/table.html">Table<br><small>Component</small></a></k-filter-item>
|
|
132
|
+
<k-filter-item filter-keywords="table controls advanced example"><a
|
|
133
|
+
href="../components/tableControls.html"
|
|
134
|
+
>Table — Controls<br><small>Advanced Example</small></a></k-filter-item>
|
|
135
|
+
<k-filter-item filter-keywords="table custom fields advanced example"><a
|
|
136
|
+
href="../components/tableCustomFields.html"
|
|
137
|
+
>Table — Custom Fields<br><small>Advanced Example</small></a></k-filter-item>
|
|
138
|
+
<k-filter-item filter-keywords="table fetch records advanced example"><a
|
|
139
|
+
href="../components/tableFetchRecords.html"
|
|
140
|
+
>Table — Fetch Records<br><small>Advanced Example</small></a></k-filter-item>
|
|
141
|
+
<k-filter-item filter-keywords="table field sort hide advanced example"><a
|
|
142
|
+
href="../components/tableFieldSortHide.html"
|
|
143
|
+
>Table — Field Sort & Hide<br><small>Advanced Example</small></a></k-filter-item>
|
|
144
|
+
<k-filter-item filter-keywords="table pagination advanced example"><a
|
|
145
|
+
href="../components/tablePagination.html"
|
|
146
|
+
>Table — Pagination<br><small>Advanced Example</small></a></k-filter-item>
|
|
147
|
+
<k-filter-item filter-keywords="table record editing advanced example"><a
|
|
148
|
+
href="../components/tableRecordEditing.html"
|
|
149
|
+
>Table — Record Editing<br><small>Advanced Example</small></a></k-filter-item>
|
|
150
|
+
<k-filter-item filter-keywords="table record filtering advanced example"><a
|
|
151
|
+
href="../components/tableRecordFiltering.html"
|
|
152
|
+
>Table — Record Filtering<br><small>Advanced Example</small></a></k-filter-item>
|
|
153
|
+
<k-filter-item filter-keywords="table record hiding advanced example"><a
|
|
154
|
+
href="../components/tableRecordHiding.html"
|
|
155
|
+
>Table — Record Hiding<br><small>Advanced Example</small></a></k-filter-item>
|
|
156
|
+
<k-filter-item filter-keywords="table record searching advanced example"><a
|
|
157
|
+
href="../components/tableRecordSearching.html"
|
|
158
|
+
>Table — Record Searching<br><small>Advanced Example</small></a></k-filter-item>
|
|
159
|
+
<k-filter-item filter-keywords="table record selection advanced example"><a
|
|
160
|
+
href="../components/tableRecordSelection.html"
|
|
161
|
+
>Table — Record Selection<br><small>Advanced Example</small></a></k-filter-item>
|
|
162
|
+
<k-filter-item filter-keywords="table row controls advanced example"><a
|
|
163
|
+
href="../components/tableRowControls.html"
|
|
164
|
+
>Table — Row Controls<br><small>Advanced Example</small></a></k-filter-item>
|
|
165
|
+
<k-filter-item filter-keywords="table server sync advanced example"><a
|
|
166
|
+
href="../components/tableServerSync.html"
|
|
167
|
+
>Table — Server Sync<br><small>Advanced Example</small></a></k-filter-item>
|
|
168
|
+
<k-filter-item filter-keywords="table sorting advanced example"><a
|
|
169
|
+
href="../components/tableSorting.html"
|
|
170
|
+
>Table — Sorting<br><small>Advanced Example</small></a></k-filter-item>
|
|
171
|
+
<k-filter-item filter-keywords="table placeholder advanced example"><a
|
|
172
|
+
href="../components/tablePlaceholder.html"
|
|
173
|
+
>Table — Placeholder<br><small>Advanced Example</small></a></k-filter-item>
|
|
174
|
+
<k-filter-item filter-keywords="tabs tab panel components"><a
|
|
175
|
+
href="../components/tabs.html">Tabs<br><small>Component</small></a></k-filter-item>
|
|
176
|
+
<k-filter-item filter-keywords="tags tag input components"><a
|
|
177
|
+
href="../components/tags.html">Tags<br><small>Component</small></a></k-filter-item>
|
|
178
|
+
<k-filter-item filter-keywords="text to speech texttospeech tts speak voice synthesis components"><a
|
|
179
|
+
href="../components/text-to-speech.html"
|
|
180
|
+
>Text To Speech<br><small>Component</small></a></k-filter-item>
|
|
181
|
+
<k-filter-item filter-keywords="theme select dropdown dark light components"><a
|
|
182
|
+
href="../components/theme-select.html"
|
|
183
|
+
>Theme Select<br><small>Component</small></a></k-filter-item>
|
|
184
|
+
<k-filter-item filter-keywords="theme switcher dark light components"><a
|
|
185
|
+
href="../components/theme-switcher.html"
|
|
186
|
+
>Theme Switcher<br><small>Component</small></a></k-filter-item>
|
|
187
|
+
<k-filter-item filter-keywords="time picker clock hour minute form components"><a
|
|
188
|
+
href="../components/time.html"
|
|
189
|
+
>Time<br><small>Component</small></a></k-filter-item>
|
|
190
|
+
<k-filter-item filter-keywords="timestamp date time components"><a
|
|
191
|
+
href="../components/timestamp.html"
|
|
192
|
+
>Timestamp<br><small>Component</small></a></k-filter-item>
|
|
193
|
+
<k-filter-item filter-keywords="toast notification alert components"><a
|
|
194
|
+
href="../components/toast.html"
|
|
195
|
+
>Toast<br><small>Component</small></a></k-filter-item>
|
|
196
|
+
<k-filter-item filter-keywords="toggle switch checkbox components"><a
|
|
197
|
+
href="../components/toggle.html"
|
|
198
|
+
>Toggle<br><small>Component</small></a></k-filter-item>
|
|
199
|
+
<k-filter-item filter-keywords="tree treeview components"><a
|
|
200
|
+
href="../components/tree.html">Tree<br><small>Component</small></a></k-filter-item>
|
|
201
|
+
<k-filter-item filter-keywords="shadow component base"><a
|
|
202
|
+
href="../components/shadow-component.html"
|
|
203
|
+
>Shadow Component<br><small>Base Component</small></a></k-filter-item>
|
|
204
|
+
<k-filter-item filter-keywords="light component base"><a
|
|
205
|
+
href="../components/light-component.html">Light Component<br><small>Base
|
|
206
|
+
Component</small></a></k-filter-item>
|
|
207
|
+
<k-filter-item filter-keywords="hybrid component base"><a
|
|
208
|
+
href="../components/hybrid-component.html"
|
|
209
|
+
>Hybrid Component<br><small>Base Component</small></a></k-filter-item>
|
|
210
|
+
<k-filter-item filter-keywords="cookie utils utility"><a
|
|
211
|
+
href="../utils/cookie.html">cookie<br><small>Utility</small></a></k-filter-item>
|
|
212
|
+
<k-filter-item filter-keywords="context utils utility"><a
|
|
213
|
+
href="../utils/context.html">context<br><small>Utility</small></a></k-filter-item>
|
|
214
|
+
<k-filter-item filter-keywords="debounce utils utility"><a
|
|
215
|
+
href="../utils/debounce.html">debounce<br><small>Utility</small></a></k-filter-item>
|
|
216
|
+
<k-filter-item filter-keywords="drag utils utility"><a
|
|
217
|
+
href="../utils/drag.html">drag<br><small>Utility</small></a></k-filter-item>
|
|
218
|
+
<k-filter-item filter-keywords="elevation z-index stacking utils"><a
|
|
219
|
+
href="../utils/elevation.html">elevation<br><small>Utility</small></a></k-filter-item>
|
|
220
|
+
<k-filter-item filter-keywords="formattimestamp timestamp format date time utils utility"><a
|
|
221
|
+
href="../utils/formatTimestamp.html"
|
|
222
|
+
>formatTimestamp<br><small>Utility</small></a></k-filter-item>
|
|
223
|
+
<k-filter-item filter-keywords="object utils utility"><a
|
|
224
|
+
href="../utils/object.html">object<br><small>Utility</small></a></k-filter-item>
|
|
225
|
+
<k-filter-item filter-keywords="propconverters prop converters utils utility"><a
|
|
226
|
+
href="../utils/propConverters.html"
|
|
227
|
+
>propConverters<br><small>Utility</small></a></k-filter-item>
|
|
228
|
+
<k-filter-item filter-keywords="string utils utility"><a
|
|
229
|
+
href="../utils/string.html">string<br><small>Utility</small></a></k-filter-item>
|
|
230
|
+
<k-filter-item filter-keywords="theme utils utility"><a
|
|
231
|
+
href="../utils/theme.html">theme<br><small>Utility</small></a></k-filter-item>
|
|
232
|
+
<k-filter-item filter-keywords="type utils utility"><a
|
|
233
|
+
href="../utils/type.html">type<br><small>Utility</small></a></k-filter-item>
|
|
234
|
+
<k-filter-item filter-keywords="wait async utils utility"><a
|
|
235
|
+
href="../utils/wait.html">wait<br><small>Utility</small></a></k-filter-item>
|
|
236
|
+
</k-filter-list>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
<div class="flex"></div>
|
|
240
|
+
<a
|
|
241
|
+
href="https://github.com/dustinpoissant/kempo-ui?tab=License-1-ov-file#creative-commons-attribution-noncommercial-sharealike-20"
|
|
242
|
+
target="_blank"
|
|
243
|
+
><k-icon name="license"></k-icon></a>
|
|
244
|
+
<a
|
|
245
|
+
href="https://www.npmjs.com/package/kempo-ui"
|
|
246
|
+
target="_blank"
|
|
247
|
+
><k-icon name="npm"></k-icon></a>
|
|
248
|
+
<a
|
|
249
|
+
href="https://github.com/dustinpoissant/kempo-ui"
|
|
250
|
+
target="_blank"
|
|
251
|
+
><k-icon name="github-mark"></k-icon></a>
|
|
252
|
+
<k-theme-switcher
|
|
253
|
+
class="mr"
|
|
254
|
+
style="
|
|
255
|
+
--padding: 0.5rem;
|
|
256
|
+
--c_active: var(--tc_on_primary);
|
|
257
|
+
--tc_active: var(--c_primary);
|
|
258
|
+
--c_inactive__hover: rgba(255, 255, 255, 0.1);
|
|
259
|
+
"
|
|
260
|
+
></k-theme-switcher>
|
|
261
|
+
</k-nav>
|
|
262
|
+
<div style="width: 100%; height: 4rem;"></div>
|
|
263
|
+
<k-aside
|
|
264
|
+
id="navSideMenu"
|
|
265
|
+
main="overlay"
|
|
266
|
+
state="offscreen"
|
|
267
|
+
>
|
|
268
|
+
<menu>
|
|
269
|
+
<a
|
|
270
|
+
href="../"
|
|
271
|
+
class="ta-center bb mb r0"
|
|
272
|
+
>
|
|
273
|
+
<h1 class="tc-primary">Kempo UI</h1>
|
|
274
|
+
<img
|
|
275
|
+
src="../media/icon128.png"
|
|
276
|
+
alt="Kempo UI Icon"
|
|
277
|
+
/>
|
|
278
|
+
</a>
|
|
279
|
+
|
|
280
|
+
<div class="pl mb">
|
|
281
|
+
<h3>Components</h3>
|
|
282
|
+
<a href="../components/accordion.html">Accordion</a>
|
|
283
|
+
<a href="../components/aside.html">Aside</a>
|
|
284
|
+
<a href="../components/calendar.html">Calendar</a>
|
|
285
|
+
<a href="../components/card.html">Card</a>
|
|
286
|
+
<a href="../components/code-editor.html">Code Editor</a>
|
|
287
|
+
<a href="../components/combobox.html">Combobox</a>
|
|
288
|
+
<a href="../components/color-picker.html">ColorPicker</a>
|
|
289
|
+
<a href="../components/content-slider.html">Content Slider</a>
|
|
290
|
+
<a href="../components/context.html">Context</a>
|
|
291
|
+
<a href="../components/dialog.html">Dialog</a>
|
|
292
|
+
<a href="../components/dropdown.html">Dropdown</a>
|
|
293
|
+
<a href="../components/filter-list.html">Filter List</a>
|
|
294
|
+
<a href="../components/focus-capture.html">FocusCapture</a>
|
|
295
|
+
<a href="../components/html-editor.html">HTML Editor</a>
|
|
296
|
+
<a href="../components/icon.html">Icon</a>
|
|
297
|
+
<a href="../components/import.html">Import</a>
|
|
298
|
+
<a href="../components/nav.html">Nav</a>
|
|
299
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
300
|
+
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
301
|
+
<a href="../components/progress.html">Progress</a>
|
|
302
|
+
<a href="../components/resize.html">Resize</a>
|
|
303
|
+
<a href="../components/show-more.html">Show More</a>
|
|
304
|
+
<a href="../components/slider.html">Slider</a>
|
|
305
|
+
<a href="../components/sortable.html">Sortable</a>
|
|
306
|
+
<a href="../components/speech-to-text.html">Speech To Text</a>
|
|
307
|
+
<a href="../components/spinner.html">Spinner</a>
|
|
308
|
+
<a href="../components/split.html">Split</a>
|
|
309
|
+
<a href="../components/table.html">Table</a>
|
|
310
|
+
<a href="../components/tabs.html">Tabs</a>
|
|
311
|
+
<a href="../components/tags.html">Tags</a>
|
|
312
|
+
<a href="../components/text-to-speech.html">Text To Speech</a>
|
|
313
|
+
<a href="../components/theme-select.html">Theme Select</a>
|
|
314
|
+
<a href="../components/theme-switcher.html">Theme Switcher</a>
|
|
315
|
+
<a href="../components/time.html">Time</a>
|
|
316
|
+
<a href="../components/timestamp.html">Timestamp</a>
|
|
317
|
+
<a href="../components/toast.html">Toast</a>
|
|
318
|
+
<a href="../components/toggle.html">Toggle</a>
|
|
319
|
+
<a href="../components/tree.html">Tree</a>
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<h5 class="mb0">Base Components</h5>
|
|
323
|
+
<div class="pl mb">
|
|
324
|
+
<a href="../components/shadow-component.html">Shadow Component</a>
|
|
325
|
+
<a href="../components/light-component.html">Light Component</a>
|
|
326
|
+
<a href="../components/hybrid-component.html">Hybrid Component</a>
|
|
327
|
+
</div>
|
|
328
|
+
|
|
329
|
+
<h5 class="mb0">Utils</h5>
|
|
330
|
+
<div class="pl mb">
|
|
331
|
+
<a href="../utils/cookie.html">cookie</a>
|
|
332
|
+
<a href="../utils/context.html">context</a>
|
|
333
|
+
<a href="../utils/debounce.html">debounce</a>
|
|
334
|
+
<a href="../utils/drag.html">drag</a>
|
|
335
|
+
<a href="../utils/elevation.html">elevation</a>
|
|
336
|
+
<a href="../utils/formatTimestamp.html">formatTimestamp</a>
|
|
337
|
+
<a href="../utils/object.html">object</a>
|
|
338
|
+
<a href="../utils/propConverters.html">propConverters</a>
|
|
339
|
+
<a href="../utils/string.html">string</a>
|
|
340
|
+
<a href="../utils/theme.html">theme</a>
|
|
341
|
+
<a href="../utils/type.html">type</a>
|
|
342
|
+
<a href="../utils/wait.html">wait</a>
|
|
343
|
+
</div>
|
|
344
|
+
</menu>
|
|
345
|
+
</k-aside>
|
|
346
|
+
<style>
|
|
347
|
+
#navSearchList a {
|
|
348
|
+
display: block;
|
|
349
|
+
padding: .25rem .5rem;
|
|
350
|
+
border-radius: var(--radius);
|
|
351
|
+
text-decoration: none;
|
|
352
|
+
color: var(--tc);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
#navSearchList a:hover {
|
|
356
|
+
background: rgba(128, 128, 128, .15);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
#navSearchList a small {
|
|
360
|
+
display: block;
|
|
361
|
+
color: var(--tc_muted);
|
|
362
|
+
}
|
|
363
|
+
</style>
|
|
364
|
+
<script
|
|
365
|
+
src="../src/components/Nav.js"
|
|
366
|
+
type="module"
|
|
367
|
+
></script>
|
|
368
|
+
<script
|
|
369
|
+
src="../src/components/FilterList.js"
|
|
370
|
+
type="module"
|
|
371
|
+
></script>
|
|
372
|
+
<script
|
|
373
|
+
src="../src/components/FilterItem.js"
|
|
374
|
+
type="module"
|
|
375
|
+
></script>
|
|
376
|
+
<script
|
|
377
|
+
src="../src/components/Aside.js"
|
|
378
|
+
type="module"
|
|
379
|
+
></script>
|
|
380
|
+
<script
|
|
381
|
+
src="../src/components/Icon.js"
|
|
382
|
+
type="module"
|
|
383
|
+
></script>
|
|
384
|
+
<script
|
|
385
|
+
src="../src/components/ThemeSwitcher.js"
|
|
386
|
+
type="module"
|
|
387
|
+
></script>
|
|
388
|
+
<script type="module">
|
|
389
|
+
import debounce from '../src/utils/debounce.js';
|
|
390
|
+
|
|
391
|
+
document.getElementById('toggleNavSideMenu').addEventListener('click', async () => {
|
|
392
|
+
await window.customElements.whenDefined('k-aside');
|
|
393
|
+
document.getElementById('navSideMenu').toggle();
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
document.addEventListener('click', function (e) {
|
|
397
|
+
if (e.target.matches('a[href^="#"]')) {
|
|
398
|
+
e.preventDefault();
|
|
399
|
+
const targetId = e.target.getAttribute('href').replace('#', '');
|
|
400
|
+
const target = document.getElementById(targetId);
|
|
401
|
+
if (target) {
|
|
402
|
+
target.scrollIntoView({ behavior: 'smooth' });
|
|
403
|
+
const url = window.location.pathname + window.location.search + '#' + targetId;
|
|
404
|
+
history.replaceState(null, '', url);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
/*
|
|
410
|
+
Nav Search
|
|
411
|
+
*/
|
|
412
|
+
const searchInput = document.getElementById('navSearchInput');
|
|
413
|
+
const searchDropdown = document.getElementById('navSearchDropdown');
|
|
414
|
+
let navSearchList = null;
|
|
415
|
+
|
|
416
|
+
const openSearch = async () => {
|
|
417
|
+
await customElements.whenDefined('k-filter-list');
|
|
418
|
+
if (!navSearchList) navSearchList = document.getElementById('navSearchList');
|
|
419
|
+
navSearchList.filter(searchInput.value);
|
|
420
|
+
searchDropdown.hidden = false;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
const closeSearch = () => {
|
|
424
|
+
searchDropdown.hidden = true;
|
|
425
|
+
navSearchList?.clearFocus();
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
searchInput.addEventListener('focus', openSearch);
|
|
429
|
+
|
|
430
|
+
searchInput.addEventListener('input', debounce(e => {
|
|
431
|
+
navSearchList?.filter(e.target.value);
|
|
432
|
+
}, 150));
|
|
433
|
+
|
|
434
|
+
searchInput.addEventListener('keydown', e => {
|
|
435
|
+
if (e.key === 'Escape') {
|
|
436
|
+
searchInput.value = '';
|
|
437
|
+
searchInput.blur();
|
|
438
|
+
closeSearch();
|
|
439
|
+
} else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter') {
|
|
440
|
+
navSearchList?.handleKeydown(e);
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
searchInput.addEventListener('blur', () => {
|
|
445
|
+
setTimeout(closeSearch, 150);
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
document.addEventListener('keydown', e => {
|
|
449
|
+
let active = document.activeElement;
|
|
450
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
451
|
+
const tag = active?.tagName;
|
|
452
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || active?.isContentEditable) return;
|
|
453
|
+
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
454
|
+
if (e.key.length === 1) {
|
|
455
|
+
searchInput.focus();
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
</script>
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
<h1 class="ta-center">Text To Speech</h1>
|
|
462
|
+
|
|
463
|
+
<k-main>
|
|
464
|
+
|
|
465
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
466
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
467
|
+
<k-accordion-panel name="toc-panel">
|
|
468
|
+
<div class="m pl">
|
|
469
|
+
<h6>Examples</h6>
|
|
470
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
471
|
+
<a href="#slotted">Slotted Text</a><br />
|
|
472
|
+
<a href="#rate">Rate & Pitch</a><br />
|
|
473
|
+
<a href="#language">Language</a><br />
|
|
474
|
+
<a href="#dynamic">Dynamic Text</a><br />
|
|
475
|
+
<a href="#disabled">Disabled</a><br />
|
|
476
|
+
|
|
477
|
+
<h6 class="mt"><a href="#jsRef" class="no-link">JavaScript Reference</a></h6>
|
|
478
|
+
<a href="#constructor">Constructor</a><br />
|
|
479
|
+
<a href="#requirements">Requirements</a><br />
|
|
480
|
+
<a href="#properties">Properties</a><br />
|
|
481
|
+
<a href="#methods">Methods</a><br />
|
|
482
|
+
<a href="#cssVariables">CSS Variables</a><br />
|
|
483
|
+
<a href="#events">Events</a><br />
|
|
484
|
+
</div>
|
|
485
|
+
</k-accordion-panel>
|
|
486
|
+
</k-accordion>
|
|
487
|
+
|
|
488
|
+
<p>Wraps the browser's <a href="https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis" target="_blank">SpeechSynthesis API</a> in a single button. Click to speak; click again while speaking to stop. Works in all modern browsers (Chromium, Firefox, Safari).</p>
|
|
489
|
+
|
|
490
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
491
|
+
<p>The <code>text</code> attribute holds the phrase to read aloud.</p>
|
|
492
|
+
<div class="row -mx">
|
|
493
|
+
<div class="col m-span-12 px">
|
|
494
|
+
<k-card label="HTML">
|
|
495
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-text-to-speech</span> <span class="hljs-attr">text</span>=<span class="hljs-string">"Hello, world!"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-text-to-speech</span>></span></code></pre>
|
|
496
|
+
</k-card>
|
|
497
|
+
</div>
|
|
498
|
+
<div class="col m-span-12 px">
|
|
499
|
+
<k-card label="Output">
|
|
500
|
+
<k-text-to-speech text="Hello, world!"></k-text-to-speech>
|
|
501
|
+
</k-card>
|
|
502
|
+
</div>
|
|
503
|
+
</div>
|
|
504
|
+
|
|
505
|
+
<h3 id="slotted"><a href="#slotted" class="no-link">Slotted Text</a></h3>
|
|
506
|
+
<p>If <code>text</code> is not set, the element's text content is spoken. Useful when the text is longer or already lives in the DOM.</p>
|
|
507
|
+
<div class="row -mx">
|
|
508
|
+
<div class="col m-span-12 px">
|
|
509
|
+
<k-card label="HTML">
|
|
510
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-text-to-speech</span>></span>The quick brown fox jumps over the lazy dog.<span class="hljs-tag"></<span class="hljs-name">k-text-to-speech</span>></span></code></pre>
|
|
511
|
+
</k-card>
|
|
512
|
+
</div>
|
|
513
|
+
<div class="col m-span-12 px">
|
|
514
|
+
<k-card label="Output">
|
|
515
|
+
<k-text-to-speech>The quick brown fox jumps over the lazy dog.</k-text-to-speech>
|
|
516
|
+
</k-card>
|
|
517
|
+
</div>
|
|
518
|
+
</div>
|
|
519
|
+
|
|
520
|
+
<h3 id="rate"><a href="#rate" class="no-link">Rate & Pitch</a></h3>
|
|
521
|
+
<p>Tune playback with the <code>rate</code> (<code>0.1</code>–<code>10</code>, default <code>1</code>) and <code>pitch</code> (<code>0</code>–<code>2</code>, default <code>1</code>) attributes. <code>volume</code> (<code>0</code>–<code>1</code>, default <code>1</code>) is also available.</p>
|
|
522
|
+
<div class="row -mx">
|
|
523
|
+
<div class="col m-span-12 px">
|
|
524
|
+
<k-card label="HTML">
|
|
525
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-text-to-speech</span> <span class="hljs-attr">text</span>=<span class="hljs-string">"Wow that is fast"</span> <span class="hljs-attr">rate</span>=<span class="hljs-string">"2"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-text-to-speech</span>></span><br><span class="hljs-tag"><<span class="hljs-name">k-text-to-speech</span> <span class="hljs-attr">text</span>=<span class="hljs-string">"A bit higher pitch"</span> <span class="hljs-attr">pitch</span>=<span class="hljs-string">"1.6"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-text-to-speech</span>></span></code></pre>
|
|
526
|
+
</k-card>
|
|
527
|
+
</div>
|
|
528
|
+
<div class="col m-span-12 px">
|
|
529
|
+
<k-card label="Output">
|
|
530
|
+
<k-text-to-speech text="Wow that is fast" rate="2" class="mr"></k-text-to-speech>
|
|
531
|
+
<k-text-to-speech text="A bit higher pitch" pitch="1.6"></k-text-to-speech>
|
|
532
|
+
</k-card>
|
|
533
|
+
</div>
|
|
534
|
+
</div>
|
|
535
|
+
|
|
536
|
+
<h3 id="language"><a href="#language" class="no-link">Language</a></h3>
|
|
537
|
+
<p>Set <code>language</code> to a BCP‑47 tag to pick a localized voice (browser-dependent — the OS-installed voices determine availability).</p>
|
|
538
|
+
<div class="row -mx">
|
|
539
|
+
<div class="col m-span-12 px">
|
|
540
|
+
<k-card label="HTML">
|
|
541
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-text-to-speech</span> <span class="hljs-attr">text</span>=<span class="hljs-string">"Bonjour le monde"</span> <span class="hljs-attr">language</span>=<span class="hljs-string">"fr-FR"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-text-to-speech</span>></span></code></pre>
|
|
542
|
+
</k-card>
|
|
543
|
+
</div>
|
|
544
|
+
<div class="col m-span-12 px">
|
|
545
|
+
<k-card label="Output">
|
|
546
|
+
<k-text-to-speech text="Bonjour le monde" language="fr-FR"></k-text-to-speech>
|
|
547
|
+
</k-card>
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
|
|
551
|
+
<h3 id="dynamic"><a href="#dynamic" class="no-link">Dynamic Text</a></h3>
|
|
552
|
+
<p>Set the <code>text</code> property at runtime to read whatever is in an input or other DOM source.</p>
|
|
553
|
+
<div class="row -mx">
|
|
554
|
+
<div class="col m-span-12 px">
|
|
555
|
+
<k-card label="HTML">
|
|
556
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-text-to-speech</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"ttsExample"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-text-to-speech</span>></span><br><span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"ttsInput"</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Type something then click the button"</span> /></span><br><span class="hljs-tag"><<span class="hljs-name">script</span>></span><span class="language-javascript"><br> <span class="hljs-keyword">const</span> $tts = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">'ttsExample'</span>);<br> <span class="hljs-keyword">const</span> $input = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">'ttsInput'</span>);<br> $input.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'input'</span>, <span class="hljs-function">() =></span> {<br> $tts.<span class="hljs-property">text</span> = $input.<span class="hljs-property">value</span>;<br> });<br> $tts.<span class="hljs-property">text</span> = $input.<span class="hljs-property">value</span>;<br></span><span class="hljs-tag"></<span class="hljs-name">script</span>></span></code></pre>
|
|
557
|
+
</k-card>
|
|
558
|
+
</div>
|
|
559
|
+
<div class="col m-span-12 px">
|
|
560
|
+
<k-card label="Output">
|
|
561
|
+
<k-text-to-speech id="ttsExample" class="mr"></k-text-to-speech>
|
|
562
|
+
<input id="ttsInput" type="text" value="Type something then click the button" />
|
|
563
|
+
<script>
|
|
564
|
+
const $tts = document.getElementById('ttsExample');
|
|
565
|
+
const $input = document.getElementById('ttsInput');
|
|
566
|
+
$input.addEventListener('input', () => {
|
|
567
|
+
$tts.text = $input.value;
|
|
568
|
+
});
|
|
569
|
+
$tts.text = $input.value;
|
|
570
|
+
</script>
|
|
571
|
+
</k-card>
|
|
572
|
+
</div>
|
|
573
|
+
</div>
|
|
574
|
+
|
|
575
|
+
<h3 id="disabled"><a href="#disabled" class="no-link">Disabled</a></h3>
|
|
576
|
+
<p>The <code>disabled</code> attribute prevents user interaction. The button also auto-disables when the browser doesn't support the SpeechSynthesis API.</p>
|
|
577
|
+
<div class="row -mx">
|
|
578
|
+
<div class="col m-span-12 px">
|
|
579
|
+
<k-card label="HTML">
|
|
580
|
+
<pre><code class="hljs xml"><span class="hljs-tag"><<span class="hljs-name">k-text-to-speech</span> <span class="hljs-attr">disabled</span> <span class="hljs-attr">text</span>=<span class="hljs-string">"You can't hear this"</span>></span><span class="hljs-tag"></<span class="hljs-name">k-text-to-speech</span>></span></code></pre>
|
|
581
|
+
</k-card>
|
|
582
|
+
</div>
|
|
583
|
+
<div class="col m-span-12 px">
|
|
584
|
+
<k-card label="Output">
|
|
585
|
+
<k-text-to-speech disabled text="You can't hear this"></k-text-to-speech>
|
|
586
|
+
</k-card>
|
|
587
|
+
</div>
|
|
588
|
+
</div>
|
|
589
|
+
|
|
590
|
+
<h2 id="jsRef"><a href="#jsRef" class="no-link">JavaScript Reference</a></h2>
|
|
591
|
+
|
|
592
|
+
<h3 id="constructor"><a href="#constructor" class="no-link">Constructor</a></h3>
|
|
593
|
+
<h6>Extends <a href="./shadow-component.html">ShadowComponent</a></h6>
|
|
594
|
+
<h5><code>new TextToSpeech()</code></h5>
|
|
595
|
+
|
|
596
|
+
<h3 id="requirements"><a href="#requirements" class="no-link">Requirements</a></h3>
|
|
597
|
+
<ul>
|
|
598
|
+
<li><a href="./shadow-component.html">ShadowComponent</a></li>
|
|
599
|
+
<li>A browser with <code>window.speechSynthesis</code> (all major modern browsers)</li>
|
|
600
|
+
</ul>
|
|
601
|
+
|
|
602
|
+
<h3 id="properties"><a href="#properties" class="no-link">Properties</a></h3>
|
|
603
|
+
<h5><code>text<i>: String</i></code></h5>
|
|
604
|
+
<p>The text to speak. When empty, the element's slotted text content is used. Syncs to <code>text</code> attribute.</p>
|
|
605
|
+
|
|
606
|
+
<h5><code>voice<i>: String</i></code></h5>
|
|
607
|
+
<p>Optional voice name (matched against <code>speechSynthesis.getVoices()</code>). Falls back to the default voice for the language. Syncs to <code>voice</code> attribute.</p>
|
|
608
|
+
|
|
609
|
+
<h5><code>language<i>: String</i></code></h5>
|
|
610
|
+
<p>BCP‑47 language tag (e.g. <code>"en-US"</code>, <code>"fr-FR"</code>). Default is empty (browser default). Syncs to <code>language</code> attribute.</p>
|
|
611
|
+
|
|
612
|
+
<h5><code>rate<i>: Number</i></code></h5>
|
|
613
|
+
<p>Speech rate from <code>0.1</code> (slow) to <code>10</code> (fast). Default is <code>1</code>. Syncs to <code>rate</code> attribute.</p>
|
|
614
|
+
|
|
615
|
+
<h5><code>pitch<i>: Number</i></code></h5>
|
|
616
|
+
<p>Pitch from <code>0</code> to <code>2</code>. Default is <code>1</code>. Syncs to <code>pitch</code> attribute.</p>
|
|
617
|
+
|
|
618
|
+
<h5><code>volume<i>: Number</i></code></h5>
|
|
619
|
+
<p>Volume from <code>0</code> (silent) to <code>1</code> (loud). Default is <code>1</code>. Syncs to <code>volume</code> attribute.</p>
|
|
620
|
+
|
|
621
|
+
<h5><code>disabled<i>: Boolean</i></code></h5>
|
|
622
|
+
<p>When <code>true</code>, the button cannot be clicked. Syncs to <code>disabled</code> attribute.</p>
|
|
623
|
+
|
|
624
|
+
<h5><code>speaking<i>: Boolean</i></code></h5>
|
|
625
|
+
<p>Reflects whether the component is currently speaking. The button shows the stop icon and switches to the active color while <code>true</code>. Syncs to <code>speaking</code> attribute.</p>
|
|
626
|
+
|
|
627
|
+
<h3 id="methods"><a href="#methods" class="no-link">Methods</a></h3>
|
|
628
|
+
<h5><code>speak(textOverride?)<i>: void</i></code></h5>
|
|
629
|
+
<p>Begin speaking. If <code>textOverride</code> is supplied, it is spoken instead of <code>text</code>/slot content. Cancels any in-flight utterance first.</p>
|
|
630
|
+
|
|
631
|
+
<h5><code>stop()<i>: void</i></code></h5>
|
|
632
|
+
<p>Cancel any speech in progress.</p>
|
|
633
|
+
|
|
634
|
+
<h5><code>toggle()<i>: void</i></code></h5>
|
|
635
|
+
<p>Calls <code>stop()</code> if currently speaking, otherwise <code>speak()</code> — the same behavior as clicking the button.</p>
|
|
636
|
+
|
|
637
|
+
<h3 id="cssVariables"><a href="#cssVariables" class="no-link">CSS Variables</a></h3>
|
|
638
|
+
<table class="b">
|
|
639
|
+
<thead><tr><th>Variable</th><th>Default</th><th>Description</th></tr></thead>
|
|
640
|
+
<tbody>
|
|
641
|
+
<tr><td><code>--btn_size</code></td><td><code>2.5rem</code></td><td>Diameter of the button</td></tr>
|
|
642
|
+
<tr><td><code>--btn_bg</code></td><td><code>var(--c_bg)</code></td><td>Background of the idle button</td></tr>
|
|
643
|
+
<tr><td><code>--btn_bg__speaking</code></td><td><code>var(--c_primary)</code></td><td>Background while actively speaking</td></tr>
|
|
644
|
+
<tr><td><code>--btn_tc__speaking</code></td><td><code>white</code></td><td>Icon color while speaking</td></tr>
|
|
645
|
+
</tbody>
|
|
646
|
+
</table>
|
|
647
|
+
|
|
648
|
+
<h3 id="events"><a href="#events" class="no-link">Events</a></h3>
|
|
649
|
+
<h5><code>start</code></h5>
|
|
650
|
+
<p>Fires when speech begins.</p>
|
|
651
|
+
|
|
652
|
+
<h5><code>end</code></h5>
|
|
653
|
+
<p>Fires when speech finishes (naturally or via <code>stop()</code>).</p>
|
|
654
|
+
|
|
655
|
+
<h5><code>error</code></h5>
|
|
656
|
+
<p>Fires if the underlying <code>SpeechSynthesisUtterance</code> reports an error. <code>detail</code> contains <code>{ error: String }</code>.</p>
|
|
657
|
+
|
|
658
|
+
</k-main>
|
|
659
|
+
<div style="height:33vh"></div>
|
|
660
|
+
<script type="module" src="../src/components/Main.js"></script>
|
|
661
|
+
|
|
662
|
+
<script type="module" src="../src/components/TextToSpeech.js"></script>
|
|
663
|
+
<script type="module" src="../src/components/Icon.js"></script>
|
|
664
|
+
<script type="module" src="../src/components/Accordion.js"></script>
|
|
665
|
+
<script type="module" src="../src/components/Card.js"></script>
|
|
666
|
+
|
|
667
|
+
</body>
|
|
668
|
+
</html>
|