kempo-ui 0.4.4 → 0.4.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/dist/components/TextToSpeech.js +4 -4
- package/dist/components/VoiceSelector.js +49 -0
- package/dist/utils/voice.js +1 -0
- package/docs/components/accordion.html +7 -0
- package/docs/components/aside.html +7 -0
- package/docs/components/calendar.html +7 -0
- package/docs/components/card.html +7 -0
- package/docs/components/code-editor.html +7 -0
- package/docs/components/color-picker.html +7 -0
- package/docs/components/combobox.html +7 -0
- package/docs/components/content-slider.html +7 -0
- package/docs/components/context.html +7 -0
- package/docs/components/dialog.html +7 -0
- package/docs/components/dropdown.html +7 -0
- package/docs/components/filter-list.html +7 -0
- package/docs/components/focus-capture.html +7 -0
- package/docs/components/html-editor.html +7 -0
- package/docs/components/hybrid-component.html +7 -0
- package/docs/components/icon.html +7 -0
- package/docs/components/import.html +7 -0
- package/docs/components/light-component.html +7 -0
- package/docs/components/nav-spacer.html +7 -0
- package/docs/components/nav.html +7 -0
- package/docs/components/photo-viewer.html +7 -0
- package/docs/components/progress.html +7 -0
- package/docs/components/resize.html +7 -0
- package/docs/components/shadow-component.html +7 -0
- package/docs/components/show-more.html +7 -0
- package/docs/components/slider.html +7 -0
- package/docs/components/sortable.html +7 -0
- package/docs/components/speech-to-text.html +7 -0
- package/docs/components/spinner.html +7 -0
- package/docs/components/split.html +7 -0
- package/docs/components/table.html +7 -0
- package/docs/components/tableControls.html +7 -0
- package/docs/components/tableCustomFields.html +7 -0
- package/docs/components/tableFetchRecords.html +7 -0
- package/docs/components/tableFieldSortHide.html +7 -0
- package/docs/components/tablePagination.html +7 -0
- package/docs/components/tablePlaceholder.html +7 -0
- package/docs/components/tableRecordEditing.html +7 -0
- package/docs/components/tableRecordFiltering.html +7 -0
- package/docs/components/tableRecordHiding.html +7 -0
- package/docs/components/tableRecordSearching.html +7 -0
- package/docs/components/tableRecordSelection.html +7 -0
- package/docs/components/tableRowControls.html +7 -0
- package/docs/components/tableServerSync.html +7 -0
- package/docs/components/tableSorting.html +7 -0
- package/docs/components/tabs.html +7 -0
- package/docs/components/tags.html +7 -0
- package/docs/components/text-to-speech.html +51 -1
- package/docs/components/theme-select.html +7 -0
- package/docs/components/theme-switcher.html +7 -0
- package/docs/components/time.html +7 -0
- package/docs/components/timestamp.html +7 -0
- package/docs/components/toast.html +7 -0
- package/docs/components/toggle.html +7 -0
- package/docs/components/tree.html +7 -0
- package/docs/components/voice-selector.html +598 -0
- package/docs/index.html +19 -0
- package/docs/src/components/TextToSpeech.js +4 -4
- package/docs/src/components/VoiceSelector.js +49 -0
- package/docs/src/utils/voice.js +1 -0
- package/docs/utils/context.html +7 -0
- package/docs/utils/cookie.html +7 -0
- package/docs/utils/debounce.html +7 -0
- package/docs/utils/drag.html +7 -0
- package/docs/utils/elevation.html +7 -0
- package/docs/utils/formatTimestamp.html +7 -0
- package/docs/utils/object.html +7 -0
- package/docs/utils/propConverters.html +7 -0
- package/docs/utils/string.html +7 -0
- package/docs/utils/theme.html +7 -0
- package/docs/utils/toTitleCase.html +7 -0
- package/docs/utils/type.html +7 -0
- package/docs/utils/voice.html +536 -0
- package/docs/utils/wait.html +7 -0
- package/docs-src/components/text-to-speech.page.html +44 -1
- package/docs-src/components/voice-selector.page.html +125 -0
- package/docs-src/index.page.html +12 -0
- package/docs-src/nav.fragment.html +7 -0
- package/docs-src/utils/voice.page.html +66 -0
- package/llms.txt +2 -0
- package/package.json +1 -1
- package/src/components/TextToSpeech.js +13 -2
- package/src/components/VoiceSelector.js +271 -0
- package/src/utils/voice.js +103 -0
- package/tests/components/TextToSpeech.browser-test.js +150 -1
- package/tests/components/VoiceSelector.browser-test.js +374 -0
- package/tests/utils/voice.browser-test.js +128 -0
|
@@ -0,0 +1,536 @@
|
|
|
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>Voice Utility - Kempo UI</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="voice selector dropdown speech synthesis preference components"><a
|
|
202
|
+
href="../components/voice-selector.html"
|
|
203
|
+
>Voice Selector<br><small>Component</small></a></k-filter-item>
|
|
204
|
+
<k-filter-item filter-keywords="shadow component base"><a
|
|
205
|
+
href="../components/shadow-component.html"
|
|
206
|
+
>Shadow Component<br><small>Base Component</small></a></k-filter-item>
|
|
207
|
+
<k-filter-item filter-keywords="light component base"><a
|
|
208
|
+
href="../components/light-component.html">Light Component<br><small>Base
|
|
209
|
+
Component</small></a></k-filter-item>
|
|
210
|
+
<k-filter-item filter-keywords="hybrid component base"><a
|
|
211
|
+
href="../components/hybrid-component.html"
|
|
212
|
+
>Hybrid Component<br><small>Base Component</small></a></k-filter-item>
|
|
213
|
+
<k-filter-item filter-keywords="cookie utils utility"><a
|
|
214
|
+
href="../utils/cookie.html">cookie<br><small>Utility</small></a></k-filter-item>
|
|
215
|
+
<k-filter-item filter-keywords="context utils utility"><a
|
|
216
|
+
href="../utils/context.html">context<br><small>Utility</small></a></k-filter-item>
|
|
217
|
+
<k-filter-item filter-keywords="debounce utils utility"><a
|
|
218
|
+
href="../utils/debounce.html">debounce<br><small>Utility</small></a></k-filter-item>
|
|
219
|
+
<k-filter-item filter-keywords="drag utils utility"><a
|
|
220
|
+
href="../utils/drag.html">drag<br><small>Utility</small></a></k-filter-item>
|
|
221
|
+
<k-filter-item filter-keywords="elevation z-index stacking utils"><a
|
|
222
|
+
href="../utils/elevation.html">elevation<br><small>Utility</small></a></k-filter-item>
|
|
223
|
+
<k-filter-item filter-keywords="formattimestamp timestamp format date time utils utility"><a
|
|
224
|
+
href="../utils/formatTimestamp.html"
|
|
225
|
+
>formatTimestamp<br><small>Utility</small></a></k-filter-item>
|
|
226
|
+
<k-filter-item filter-keywords="object utils utility"><a
|
|
227
|
+
href="../utils/object.html">object<br><small>Utility</small></a></k-filter-item>
|
|
228
|
+
<k-filter-item filter-keywords="propconverters prop converters utils utility"><a
|
|
229
|
+
href="../utils/propConverters.html"
|
|
230
|
+
>propConverters<br><small>Utility</small></a></k-filter-item>
|
|
231
|
+
<k-filter-item filter-keywords="string utils utility"><a
|
|
232
|
+
href="../utils/string.html">string<br><small>Utility</small></a></k-filter-item>
|
|
233
|
+
<k-filter-item filter-keywords="theme utils utility"><a
|
|
234
|
+
href="../utils/theme.html">theme<br><small>Utility</small></a></k-filter-item>
|
|
235
|
+
<k-filter-item filter-keywords="type utils utility"><a
|
|
236
|
+
href="../utils/type.html">type<br><small>Utility</small></a></k-filter-item>
|
|
237
|
+
<k-filter-item filter-keywords="voice speech synthesis preference utils utility"><a
|
|
238
|
+
href="../utils/voice.html">voice<br><small>Utility</small></a></k-filter-item>
|
|
239
|
+
<k-filter-item filter-keywords="wait async utils utility"><a
|
|
240
|
+
href="../utils/wait.html">wait<br><small>Utility</small></a></k-filter-item>
|
|
241
|
+
</k-filter-list>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
<div class="flex"></div>
|
|
245
|
+
<a
|
|
246
|
+
href="https://github.com/dustinpoissant/kempo-ui?tab=License-1-ov-file#creative-commons-attribution-noncommercial-sharealike-20"
|
|
247
|
+
target="_blank"
|
|
248
|
+
><k-icon name="license"></k-icon></a>
|
|
249
|
+
<a
|
|
250
|
+
href="https://www.npmjs.com/package/kempo-ui"
|
|
251
|
+
target="_blank"
|
|
252
|
+
><k-icon name="npm"></k-icon></a>
|
|
253
|
+
<a
|
|
254
|
+
href="https://github.com/dustinpoissant/kempo-ui"
|
|
255
|
+
target="_blank"
|
|
256
|
+
><k-icon name="github-mark"></k-icon></a>
|
|
257
|
+
<k-theme-switcher
|
|
258
|
+
class="mr"
|
|
259
|
+
style="
|
|
260
|
+
--padding: 0.5rem;
|
|
261
|
+
--c_active: var(--tc_on_primary);
|
|
262
|
+
--tc_active: var(--c_primary);
|
|
263
|
+
--c_inactive__hover: rgba(255, 255, 255, 0.1);
|
|
264
|
+
"
|
|
265
|
+
></k-theme-switcher>
|
|
266
|
+
</k-nav>
|
|
267
|
+
<div style="width: 100%; height: 4rem;"></div>
|
|
268
|
+
<k-aside
|
|
269
|
+
id="navSideMenu"
|
|
270
|
+
main="overlay"
|
|
271
|
+
state="offscreen"
|
|
272
|
+
>
|
|
273
|
+
<menu>
|
|
274
|
+
<a
|
|
275
|
+
href="../"
|
|
276
|
+
class="ta-center bb mb r0"
|
|
277
|
+
>
|
|
278
|
+
<h1 class="tc-primary">Kempo UI</h1>
|
|
279
|
+
<img
|
|
280
|
+
src="../media/icon128.png"
|
|
281
|
+
alt="Kempo UI Icon"
|
|
282
|
+
/>
|
|
283
|
+
</a>
|
|
284
|
+
|
|
285
|
+
<div class="pl mb">
|
|
286
|
+
<h3>Components</h3>
|
|
287
|
+
<a href="../components/accordion.html">Accordion</a>
|
|
288
|
+
<a href="../components/aside.html">Aside</a>
|
|
289
|
+
<a href="../components/calendar.html">Calendar</a>
|
|
290
|
+
<a href="../components/card.html">Card</a>
|
|
291
|
+
<a href="../components/code-editor.html">Code Editor</a>
|
|
292
|
+
<a href="../components/combobox.html">Combobox</a>
|
|
293
|
+
<a href="../components/color-picker.html">ColorPicker</a>
|
|
294
|
+
<a href="../components/content-slider.html">Content Slider</a>
|
|
295
|
+
<a href="../components/context.html">Context</a>
|
|
296
|
+
<a href="../components/dialog.html">Dialog</a>
|
|
297
|
+
<a href="../components/dropdown.html">Dropdown</a>
|
|
298
|
+
<a href="../components/filter-list.html">Filter List</a>
|
|
299
|
+
<a href="../components/focus-capture.html">FocusCapture</a>
|
|
300
|
+
<a href="../components/html-editor.html">HTML Editor</a>
|
|
301
|
+
<a href="../components/icon.html">Icon</a>
|
|
302
|
+
<a href="../components/import.html">Import</a>
|
|
303
|
+
<a href="../components/nav.html">Nav</a>
|
|
304
|
+
<a href="../components/nav-spacer.html">Nav Spacer</a>
|
|
305
|
+
<a href="../components/photo-viewer.html">Photo Viewer</a>
|
|
306
|
+
<a href="../components/progress.html">Progress</a>
|
|
307
|
+
<a href="../components/resize.html">Resize</a>
|
|
308
|
+
<a href="../components/show-more.html">Show More</a>
|
|
309
|
+
<a href="../components/slider.html">Slider</a>
|
|
310
|
+
<a href="../components/sortable.html">Sortable</a>
|
|
311
|
+
<a href="../components/speech-to-text.html">Speech To Text</a>
|
|
312
|
+
<a href="../components/spinner.html">Spinner</a>
|
|
313
|
+
<a href="../components/split.html">Split</a>
|
|
314
|
+
<a href="../components/table.html">Table</a>
|
|
315
|
+
<a href="../components/tabs.html">Tabs</a>
|
|
316
|
+
<a href="../components/tags.html">Tags</a>
|
|
317
|
+
<a href="../components/text-to-speech.html">Text To Speech</a>
|
|
318
|
+
<a href="../components/theme-select.html">Theme Select</a>
|
|
319
|
+
<a href="../components/theme-switcher.html">Theme Switcher</a>
|
|
320
|
+
<a href="../components/time.html">Time</a>
|
|
321
|
+
<a href="../components/timestamp.html">Timestamp</a>
|
|
322
|
+
<a href="../components/toast.html">Toast</a>
|
|
323
|
+
<a href="../components/toggle.html">Toggle</a>
|
|
324
|
+
<a href="../components/tree.html">Tree</a>
|
|
325
|
+
<a href="../components/voice-selector.html">Voice Selector</a>
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
<h5 class="mb0">Base Components</h5>
|
|
329
|
+
<div class="pl mb">
|
|
330
|
+
<a href="../components/shadow-component.html">Shadow Component</a>
|
|
331
|
+
<a href="../components/light-component.html">Light Component</a>
|
|
332
|
+
<a href="../components/hybrid-component.html">Hybrid Component</a>
|
|
333
|
+
</div>
|
|
334
|
+
|
|
335
|
+
<h5 class="mb0">Utils</h5>
|
|
336
|
+
<div class="pl mb">
|
|
337
|
+
<a href="../utils/cookie.html">cookie</a>
|
|
338
|
+
<a href="../utils/context.html">context</a>
|
|
339
|
+
<a href="../utils/debounce.html">debounce</a>
|
|
340
|
+
<a href="../utils/drag.html">drag</a>
|
|
341
|
+
<a href="../utils/elevation.html">elevation</a>
|
|
342
|
+
<a href="../utils/formatTimestamp.html">formatTimestamp</a>
|
|
343
|
+
<a href="../utils/object.html">object</a>
|
|
344
|
+
<a href="../utils/propConverters.html">propConverters</a>
|
|
345
|
+
<a href="../utils/string.html">string</a>
|
|
346
|
+
<a href="../utils/theme.html">theme</a>
|
|
347
|
+
<a href="../utils/type.html">type</a>
|
|
348
|
+
<a href="../utils/voice.html">voice</a>
|
|
349
|
+
<a href="../utils/wait.html">wait</a>
|
|
350
|
+
</div>
|
|
351
|
+
</menu>
|
|
352
|
+
</k-aside>
|
|
353
|
+
<style>
|
|
354
|
+
#navSearchList a {
|
|
355
|
+
display: block;
|
|
356
|
+
padding: .25rem .5rem;
|
|
357
|
+
border-radius: var(--radius);
|
|
358
|
+
text-decoration: none;
|
|
359
|
+
color: var(--tc);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
#navSearchList a:hover {
|
|
363
|
+
background: rgba(128, 128, 128, .15);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
#navSearchList a small {
|
|
367
|
+
display: block;
|
|
368
|
+
color: var(--tc_muted);
|
|
369
|
+
}
|
|
370
|
+
</style>
|
|
371
|
+
<script
|
|
372
|
+
src="../src/components/Nav.js"
|
|
373
|
+
type="module"
|
|
374
|
+
></script>
|
|
375
|
+
<script
|
|
376
|
+
src="../src/components/FilterList.js"
|
|
377
|
+
type="module"
|
|
378
|
+
></script>
|
|
379
|
+
<script
|
|
380
|
+
src="../src/components/FilterItem.js"
|
|
381
|
+
type="module"
|
|
382
|
+
></script>
|
|
383
|
+
<script
|
|
384
|
+
src="../src/components/Aside.js"
|
|
385
|
+
type="module"
|
|
386
|
+
></script>
|
|
387
|
+
<script
|
|
388
|
+
src="../src/components/Icon.js"
|
|
389
|
+
type="module"
|
|
390
|
+
></script>
|
|
391
|
+
<script
|
|
392
|
+
src="../src/components/ThemeSwitcher.js"
|
|
393
|
+
type="module"
|
|
394
|
+
></script>
|
|
395
|
+
<script type="module">
|
|
396
|
+
import debounce from '../src/utils/debounce.js';
|
|
397
|
+
|
|
398
|
+
document.getElementById('toggleNavSideMenu').addEventListener('click', async () => {
|
|
399
|
+
await window.customElements.whenDefined('k-aside');
|
|
400
|
+
document.getElementById('navSideMenu').toggle();
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
document.addEventListener('click', function (e) {
|
|
404
|
+
if (e.target.matches('a[href^="#"]')) {
|
|
405
|
+
e.preventDefault();
|
|
406
|
+
const targetId = e.target.getAttribute('href').replace('#', '');
|
|
407
|
+
const target = document.getElementById(targetId);
|
|
408
|
+
if (target) {
|
|
409
|
+
target.scrollIntoView({ behavior: 'smooth' });
|
|
410
|
+
const url = window.location.pathname + window.location.search + '#' + targetId;
|
|
411
|
+
history.replaceState(null, '', url);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
/*
|
|
417
|
+
Nav Search
|
|
418
|
+
*/
|
|
419
|
+
const searchInput = document.getElementById('navSearchInput');
|
|
420
|
+
const searchDropdown = document.getElementById('navSearchDropdown');
|
|
421
|
+
let navSearchList = null;
|
|
422
|
+
|
|
423
|
+
const openSearch = async () => {
|
|
424
|
+
await customElements.whenDefined('k-filter-list');
|
|
425
|
+
if (!navSearchList) navSearchList = document.getElementById('navSearchList');
|
|
426
|
+
navSearchList.filter(searchInput.value);
|
|
427
|
+
searchDropdown.hidden = false;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
const closeSearch = () => {
|
|
431
|
+
searchDropdown.hidden = true;
|
|
432
|
+
navSearchList?.clearFocus();
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
searchInput.addEventListener('focus', openSearch);
|
|
436
|
+
|
|
437
|
+
searchInput.addEventListener('input', debounce(e => {
|
|
438
|
+
navSearchList?.filter(e.target.value);
|
|
439
|
+
}, 150));
|
|
440
|
+
|
|
441
|
+
searchInput.addEventListener('keydown', e => {
|
|
442
|
+
if (e.key === 'Escape') {
|
|
443
|
+
searchInput.value = '';
|
|
444
|
+
searchInput.blur();
|
|
445
|
+
closeSearch();
|
|
446
|
+
} else if (e.key === 'ArrowDown' || e.key === 'ArrowUp' || e.key === 'Enter') {
|
|
447
|
+
navSearchList?.handleKeydown(e);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
searchInput.addEventListener('blur', () => {
|
|
452
|
+
setTimeout(closeSearch, 150);
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
document.addEventListener('keydown', e => {
|
|
456
|
+
let active = document.activeElement;
|
|
457
|
+
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
458
|
+
const tag = active?.tagName;
|
|
459
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || active?.isContentEditable) return;
|
|
460
|
+
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
461
|
+
if (e.key.length === 1) {
|
|
462
|
+
searchInput.focus();
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
</script>
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
<k-main>
|
|
469
|
+
|
|
470
|
+
<h1>Voice Utility</h1>
|
|
471
|
+
|
|
472
|
+
<k-accordion persistent-id="toc" class="b r mb">
|
|
473
|
+
<k-accordion-header for-panel="toc-panel">Table of Contents</k-accordion-header>
|
|
474
|
+
<k-accordion-panel name="toc-panel">
|
|
475
|
+
<div class="m">
|
|
476
|
+
<h6>Usage</h6>
|
|
477
|
+
<a href="#basicUsage">Basic Usage</a><br />
|
|
478
|
+
<a href="#api">API Methods</a><br />
|
|
479
|
+
<a href="#examples">Examples</a><br />
|
|
480
|
+
</div>
|
|
481
|
+
</k-accordion-panel>
|
|
482
|
+
</k-accordion>
|
|
483
|
+
|
|
484
|
+
<h3>Description</h3>
|
|
485
|
+
<p>The <code>voice</code> utility manages the user's preferred speech-synthesis voice across the site. It mirrors the <a href="./theme.html">theme</a> utility — persisting to <code>localStorage</code>, syncing across tabs via the <code>storage</code> event, and exposing a pub/sub API. Pair it with <a href="../components/voice-selector.html"><code><k-voice-selector></code></a> for a settings UI; <a href="../components/text-to-speech.html"><code><k-text-to-speech></code></a> automatically uses the saved preference when no <code>voice</code> attribute is set.</p>
|
|
486
|
+
|
|
487
|
+
<h3 id="basicUsage"><a href="#basicUsage" class="no-link">Basic Usage</a></h3>
|
|
488
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">import</span> voice <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/voice.js'</span>;<br><span class="hljs-comment">// Get current preferred voice (empty string = use browser default)</span><br><span class="hljs-keyword">const</span> current = voice.<span class="hljs-title function_">get</span>();<br><span class="hljs-comment">// Set a preferred voice</span><br>voice.<span class="hljs-title function_">set</span>(<span class="hljs-string">'Google US English'</span>);<br><span class="hljs-comment">// Subscribe to changes</span><br><span class="hljs-keyword">const</span> unsubscribe = voice.<span class="hljs-title function_">subscribe</span>(<span class="hljs-function">(<span class="hljs-params">name</span>) =></span> {<br> <span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'Voice preference changed to:'</span>, name);<br>});<br><span class="hljs-comment">// Enumerate available voices (may need to wait — the list loads async)</span><br><span class="hljs-keyword">const</span> voices = <span class="hljs-keyword">await</span> voice.<span class="hljs-title function_">waitForVoices</span>();</code></pre>
|
|
489
|
+
|
|
490
|
+
<h3 id="api"><a href="#api" class="no-link">API Methods</a></h3>
|
|
491
|
+
|
|
492
|
+
<h4><code>voice.get()</code></h4>
|
|
493
|
+
<p>Returns the user's saved voice name. An empty string means "no preference — use the browser default for the language".</p>
|
|
494
|
+
<h5>Returns: <code>string</code></h5>
|
|
495
|
+
|
|
496
|
+
<h4><code>voice.set(name)</code></h4>
|
|
497
|
+
<p>Sets the saved voice and persists it to <code>localStorage</code>. Pass an empty string (or a falsy value) to clear the preference.</p>
|
|
498
|
+
<h5><code>name<i>: string</i></code></h5>
|
|
499
|
+
<p>The voice <code>name</code> as reported by <code>speechSynthesis.getVoices()</code>, or a comma-separated fallback chain (<code>"Samantha, Google US English"</code>).</p>
|
|
500
|
+
|
|
501
|
+
<h4><code>voice.subscribe(callback)</code></h4>
|
|
502
|
+
<p>Subscribes to preference changes. Fires once immediately with the current value, then on every change (including changes from other tabs).</p>
|
|
503
|
+
<h5>Returns: <code>Function</code></h5>
|
|
504
|
+
<p>An unsubscribe function.</p>
|
|
505
|
+
|
|
506
|
+
<h4><code>voice.getAvailable()</code></h4>
|
|
507
|
+
<p>Synchronous shortcut for <code>window.speechSynthesis.getVoices()</code>. May return <code>[]</code> if the browser hasn't populated the list yet.</p>
|
|
508
|
+
<h5>Returns: <code>SpeechSynthesisVoice[]</code></h5>
|
|
509
|
+
|
|
510
|
+
<h4><code>voice.waitForVoices(timeoutMs?)</code></h4>
|
|
511
|
+
<p>Returns a promise that resolves with the list of available voices, waiting for the browser's <code>voiceschanged</code> event if the list is initially empty.</p>
|
|
512
|
+
<h5><code>timeoutMs<i>: number</i></code> — default <code>2000</code></h5>
|
|
513
|
+
<p>How long to wait before giving up and resolving with whatever the browser has.</p>
|
|
514
|
+
<h5>Returns: <code>Promise<SpeechSynthesisVoice[]></code></h5>
|
|
515
|
+
|
|
516
|
+
<h4><code>voice.subscribeAvailable(callback)</code></h4>
|
|
517
|
+
<p>Subscribes to changes in the available voice list (fires on the <code>voiceschanged</code> event). Useful when populating a settings UI.</p>
|
|
518
|
+
<h5>Returns: <code>Function</code></h5>
|
|
519
|
+
<p>An unsubscribe function.</p>
|
|
520
|
+
|
|
521
|
+
<h3 id="examples"><a href="#examples" class="no-link">Examples</a></h3>
|
|
522
|
+
|
|
523
|
+
<h4>Building a Voice Picker by Hand</h4>
|
|
524
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">import</span> voice <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/voice.js'</span>;<br><br><span class="hljs-keyword">const</span> $select = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">getElementById</span>(<span class="hljs-string">'voice-picker'</span>);<br><br>voice.<span class="hljs-title function_">subscribeAvailable</span>(<span class="hljs-function">(<span class="hljs-params">voices</span>) =></span> {<br> $select.<span class="hljs-property">innerHTML</span> = <span class="hljs-string">'<option value="">Browser default</option>'</span>;<br> <span class="hljs-keyword">for</span>(<span class="hljs-keyword">const</span> v <span class="hljs-keyword">of</span> voices){<br> <span class="hljs-keyword">const</span> opt = <span class="hljs-variable language_">document</span>.<span class="hljs-title function_">createElement</span>(<span class="hljs-string">'option'</span>);<br> opt.<span class="hljs-property">value</span> = v.<span class="hljs-property">name</span>;<br> opt.<span class="hljs-property">textContent</span> = <span class="hljs-string">`<span class="hljs-subst">${v.name}</span> (<span class="hljs-subst">${v.lang}</span>)`</span>;<br> $select.<span class="hljs-title function_">appendChild</span>(opt);<br> }<br> $select.<span class="hljs-property">value</span> = voice.<span class="hljs-title function_">get</span>();<br>});<br><br>$select.<span class="hljs-title function_">addEventListener</span>(<span class="hljs-string">'change'</span>, <span class="hljs-function">() =></span> voice.<span class="hljs-title function_">set</span>($select.<span class="hljs-property">value</span>));</code></pre>
|
|
525
|
+
|
|
526
|
+
<h4>Reading the Preference Without a Component</h4>
|
|
527
|
+
<pre><code class="hljs javascript"><span class="hljs-keyword">import</span> voice <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/voice.js'</span>;<br><br><span class="hljs-keyword">const</span> preferred = voice.<span class="hljs-title function_">get</span>();<br><span class="hljs-keyword">if</span>(preferred){<br> <span class="hljs-built_in">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">`User picked: <span class="hljs-subst">${preferred}</span>`</span>);<br>} <span class="hljs-keyword">else</span> {<br> <span class="hljs-built_in">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'No preference set — using browser default'</span>);<br>}</code></pre>
|
|
528
|
+
|
|
529
|
+
</k-main>
|
|
530
|
+
<div style="height:33vh"></div>
|
|
531
|
+
<script type="module" src="../src/components/Main.js"></script>
|
|
532
|
+
|
|
533
|
+
<script type="module" src="../src/components/Accordion.js"></script>
|
|
534
|
+
|
|
535
|
+
</body>
|
|
536
|
+
</html>
|
package/docs/utils/wait.html
CHANGED
|
@@ -198,6 +198,9 @@
|
|
|
198
198
|
>Toggle<br><small>Component</small></a></k-filter-item>
|
|
199
199
|
<k-filter-item filter-keywords="tree treeview components"><a
|
|
200
200
|
href="../components/tree.html">Tree<br><small>Component</small></a></k-filter-item>
|
|
201
|
+
<k-filter-item filter-keywords="voice selector dropdown speech synthesis preference components"><a
|
|
202
|
+
href="../components/voice-selector.html"
|
|
203
|
+
>Voice Selector<br><small>Component</small></a></k-filter-item>
|
|
201
204
|
<k-filter-item filter-keywords="shadow component base"><a
|
|
202
205
|
href="../components/shadow-component.html"
|
|
203
206
|
>Shadow Component<br><small>Base Component</small></a></k-filter-item>
|
|
@@ -231,6 +234,8 @@
|
|
|
231
234
|
href="../utils/theme.html">theme<br><small>Utility</small></a></k-filter-item>
|
|
232
235
|
<k-filter-item filter-keywords="type utils utility"><a
|
|
233
236
|
href="../utils/type.html">type<br><small>Utility</small></a></k-filter-item>
|
|
237
|
+
<k-filter-item filter-keywords="voice speech synthesis preference utils utility"><a
|
|
238
|
+
href="../utils/voice.html">voice<br><small>Utility</small></a></k-filter-item>
|
|
234
239
|
<k-filter-item filter-keywords="wait async utils utility"><a
|
|
235
240
|
href="../utils/wait.html">wait<br><small>Utility</small></a></k-filter-item>
|
|
236
241
|
</k-filter-list>
|
|
@@ -317,6 +322,7 @@
|
|
|
317
322
|
<a href="../components/toast.html">Toast</a>
|
|
318
323
|
<a href="../components/toggle.html">Toggle</a>
|
|
319
324
|
<a href="../components/tree.html">Tree</a>
|
|
325
|
+
<a href="../components/voice-selector.html">Voice Selector</a>
|
|
320
326
|
</div>
|
|
321
327
|
|
|
322
328
|
<h5 class="mb0">Base Components</h5>
|
|
@@ -339,6 +345,7 @@
|
|
|
339
345
|
<a href="../utils/string.html">string</a>
|
|
340
346
|
<a href="../utils/theme.html">theme</a>
|
|
341
347
|
<a href="../utils/type.html">type</a>
|
|
348
|
+
<a href="../utils/voice.html">voice</a>
|
|
342
349
|
<a href="../utils/wait.html">wait</a>
|
|
343
350
|
</div>
|
|
344
351
|
</menu>
|