@readium/speech 0.11.0 → 0.13.0
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/README.md +4 -6
- package/build/Fallback/fallbackEngineProvider.d.ts +3 -3
- package/build/Fallback/fallbackSpeechEngine.d.ts +5 -5
- package/build/Fallback/index.d.ts +3 -3
- package/build/Fallback/recoverableFailure.d.ts +1 -1
- package/build/SpeechServer/index.d.ts +7 -7
- package/build/SpeechServer/selectFormat.d.ts +1 -1
- package/build/SpeechServer/speechServerEngine.d.ts +5 -5
- package/build/SpeechServer/speechServerEngineProvider.d.ts +4 -4
- package/build/SpeechServer/speechServerVoiceMapping.d.ts +2 -2
- package/build/SpeechServer/types.d.ts +1 -1
- package/build/WebSpeech/WebSpeechVoiceManager.d.ts +1 -1
- package/build/WebSpeech/index.d.ts +3 -3
- package/build/WebSpeech/webSpeechEngine.d.ts +4 -4
- package/build/WebSpeech/webSpeechEngineProvider.d.ts +3 -3
- package/build/decorator/createLocator.d.ts +2 -1
- package/build/decorator/index.d.ts +2 -2
- package/build/decorator/setupDecorations.d.ts +1 -1
- package/build/engine.d.ts +3 -3
- package/build/index.d.ts +14 -15
- package/build/index.js +1782 -6846
- package/build/navigator.d.ts +7 -7
- package/build/preferences/Preference.d.ts +6 -6
- package/build/preferences/SpeechDefaults.d.ts +1 -1
- package/build/preferences/SpeechPreferences.d.ts +1 -1
- package/build/preferences/SpeechSettings.d.ts +1 -1
- package/build/preferences/constraints.d.ts +8 -8
- package/build/preferences/guards.d.ts +1 -1
- package/build/preferences/index.d.ts +4 -2
- package/build/preferences/verbosityTables.d.ts +1 -1
- package/build/provider.d.ts +2 -2
- package/build/providerRegistry.d.ts +3 -3
- package/build/speechNavigator.d.ts +14 -14
- package/build/utils/text.d.ts +0 -2
- package/build/utterances/contextualization.d.ts +5 -4
- package/build/utterances/extractUtterances.d.ts +4 -4
- package/build/utterances/locate.d.ts +3 -3
- package/build/utterances/mergeUtterances.d.ts +2 -2
- package/build/utterances/nodeFields.d.ts +5 -0
- package/build/utterances/roles.d.ts +1 -1
- package/build/utterances/tableStructure.d.ts +5 -5
- package/build/utterances/text.d.ts +4 -4
- package/build/utterances/types.d.ts +3 -2
- package/build/utterances/utteranceOutput.d.ts +2 -2
- package/build/utterances/walk.d.ts +2 -2
- package/build/utterances/walkContext.d.ts +8 -7
- package/build/voices/filters.d.ts +1 -1
- package/build/voices/languages.d.ts +2 -2
- package/build/voices/localized.d.ts +1 -1
- package/build/voices/packages.d.ts +1 -1
- package/build/voices/sorting.d.ts +2 -2
- package/build/voices/voiceDuplicates.d.ts +1 -1
- package/package.json +15 -15
- package/build/ar-DuqkW85r.cjs +0 -1
- package/build/bg-DQ8Or9ln.cjs +0 -1
- package/build/bho-UB6aO8oz.cjs +0 -1
- package/build/bn-DdnrYetr.cjs +0 -1
- package/build/ca-D2gB-PsU.cjs +0 -1
- package/build/cmn-BkQ6_5c5.cjs +0 -1
- package/build/cs-Dg7ZcgUn.cjs +0 -1
- package/build/da-Bmc3-wE3.cjs +0 -1
- package/build/de-yGzFecZa.cjs +0 -1
- package/build/el-BXDgzxPG.cjs +0 -1
- package/build/en-BkmFXU-D.cjs +0 -1
- package/build/es-yaOBPPo5.cjs +0 -1
- package/build/eu-uq15ZgwW.cjs +0 -1
- package/build/fa-C7gf54mN.cjs +0 -1
- package/build/fi-Ckva-_7A.cjs +0 -1
- package/build/fr-C7LUVKsE.cjs +0 -1
- package/build/gl-_cjNQmPr.cjs +0 -1
- package/build/gnd/a11y.d.ts +0 -20
- package/build/gnd/converter.d.ts +0 -73
- package/build/gnd/dom.d.ts +0 -6
- package/build/gnd/domRangeGenerator.d.ts +0 -9
- package/build/gnd/elementHandlers.d.ts +0 -5
- package/build/gnd/idAllocator.d.ts +0 -6
- package/build/gnd/index.d.ts +0 -7
- package/build/gnd/makeGnd.d.ts +0 -9
- package/build/gnd/object.d.ts +0 -28
- package/build/gnd/options.d.ts +0 -17
- package/build/gnd/prescan.d.ts +0 -1
- package/build/gnd/roles.d.ts +0 -3
- package/build/gnd/selectorGenerator.d.ts +0 -3
- package/build/gnd/text.d.ts +0 -18
- package/build/gnd/textFragmentGenerator.d.ts +0 -2
- package/build/gnd/textrefFragment.d.ts +0 -40
- package/build/gnd/types.d.ts +0 -21
- package/build/he-DVF3vvW9.cjs +0 -1
- package/build/hi-Cw9tDdoY.cjs +0 -1
- package/build/hr-BggD5hef.cjs +0 -1
- package/build/hu-CVN4AAaU.cjs +0 -1
- package/build/id-0GsU08OQ.cjs +0 -1
- package/build/index.cjs +0 -24
- package/build/it-CjraJOTi.cjs +0 -1
- package/build/ja-DZA_Jiej.cjs +0 -1
- package/build/kk-B1QeTCqa.cjs +0 -1
- package/build/kn-Dr8XiVC3.cjs +0 -1
- package/build/ko-D71TFL45.cjs +0 -1
- package/build/mr-CX6HEC_l.cjs +0 -1
- package/build/ms-DfrAHvvL.cjs +0 -1
- package/build/nb-CZLktG1o.cjs +0 -1
- package/build/nl-B5M6yG47.cjs +0 -1
- package/build/pl-l20DtMGO.cjs +0 -1
- package/build/pt-BUTOekxw.cjs +0 -1
- package/build/ro-DIcYfRAr.cjs +0 -1
- package/build/ru-CJPE4iif.cjs +0 -1
- package/build/sk-DzFVn2yw.cjs +0 -1
- package/build/sl-B4fy9eLK.cjs +0 -1
- package/build/sv-DwG8WENn.cjs +0 -1
- package/build/ta-IhlG6xub.cjs +0 -1
- package/build/te-BMlSZMWZ.cjs +0 -1
- package/build/th-Bgdg_M0f.cjs +0 -1
- package/build/tr-BS6FY0hu.cjs +0 -1
- package/build/uk-BBTtG5rE.cjs +0 -1
- package/build/vi-ZQ09Ahmv.cjs +0 -1
- package/build/wuu-DnwGQ6c-.cjs +0 -1
- package/build/yue-BU-8AjYB.cjs +0 -1
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ Documentation provides guides for:
|
|
|
147
147
|
- [Playback API](docs/Playback.md)
|
|
148
148
|
- [Preferences](docs/Preferences.md) — verbosity and prosody settings via `SpeechPreferences`/`SpeechSettings`
|
|
149
149
|
- [Highlighting](docs/Highlighting.md)
|
|
150
|
-
- [Guided Navigation](docs/GuidedNavigation.md) —
|
|
150
|
+
- [Guided Navigation](docs/GuidedNavigation.md) — getting [Guided Navigation objects](https://readium.org/guided-navigation) from HTML/XHTML content with `@readium/guided-navigation`
|
|
151
151
|
- [Utterance Extraction](docs/UtteranceExtraction.md) — extracting utterances from Guided Navigation objects
|
|
152
152
|
- [Provider Registry](docs/ProviderRegistry.md) — using more than one `ReadiumSpeechEngineProvider` (e.g. WebSpeech and speech-server) side by side
|
|
153
153
|
- [WebSpeechEngine](docs/WebSpeechEngine.md) — the `ReadiumSpeechPlaybackEngine` backed by the browser's Web Speech API
|
|
@@ -170,13 +170,12 @@ npm run build
|
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
This will compile the TypeScript code and generate the following outputs in the `build/` directory:
|
|
173
|
-
- `index.js` (ES
|
|
174
|
-
- `index.cjs` (CommonJS)
|
|
173
|
+
- `index.js` (ES module, with dependencies left as imports for the consumer's bundler to resolve)
|
|
175
174
|
- TypeScript type definitions
|
|
176
175
|
|
|
177
176
|
### Running Demos Locally
|
|
178
177
|
|
|
179
|
-
The
|
|
178
|
+
The demos import the library source directly and are served by Vite:
|
|
180
179
|
|
|
181
180
|
1. Start the local development server:
|
|
182
181
|
```bash
|
|
@@ -203,11 +202,10 @@ For ChromeOS development, the project includes a debug mode that mocks the Web S
|
|
|
203
202
|
```bash
|
|
204
203
|
npm test # build + full suite
|
|
205
204
|
npm run test:voices # WebSpeechVoiceManager only
|
|
206
|
-
npm run test:gnd # HTML/XHTML -> Guided Navigation conversion
|
|
207
205
|
npm run test:utterances # Guided Navigation -> utterance extraction
|
|
208
206
|
```
|
|
209
207
|
|
|
210
|
-
`test:
|
|
208
|
+
`test:utterances` is driven by [`fixtures/`](fixtures/README.md): the expected utterances, one option combination at a time, for every fixture of [`@readium/guided-navigation`](https://github.com/readium/ts-toolkit/tree/develop/guided-navigation)'s language-agnostic conformance suite. Each fixture is a plain-file test case any platform implementation can consume, not just this TypeScript one — see [fixtures/README.md](fixtures/README.md) for the format, how to add a fixture, and how a fixture "passes".
|
|
211
209
|
|
|
212
210
|
## Acknowledgments
|
|
213
211
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReadiumSpeechEngineProvider } from '../provider';
|
|
2
|
-
import { ReadiumSpeechPlaybackEngine } from '../engine';
|
|
3
|
-
import { ReadiumSpeechVoice } from '../voices/types';
|
|
1
|
+
import { ReadiumSpeechEngineProvider } from '../provider.js';
|
|
2
|
+
import { ReadiumSpeechPlaybackEngine } from '../engine.js';
|
|
3
|
+
import { ReadiumSpeechVoice } from '../voices/types.js';
|
|
4
4
|
export interface FallbackEngineProviderOptions {
|
|
5
5
|
primary: ReadiumSpeechEngineProvider;
|
|
6
6
|
fallback: ReadiumSpeechEngineProvider;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReadiumSpeechPlaybackEngine } from '../engine';
|
|
2
|
-
import { ReadiumSpeechEngineProvider } from '../provider';
|
|
3
|
-
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator';
|
|
4
|
-
import { ReadiumSpeechUtterance } from '../utterance';
|
|
5
|
-
import { ReadiumSpeechVoice } from '../voices/types';
|
|
1
|
+
import { ReadiumSpeechPlaybackEngine } from '../engine.js';
|
|
2
|
+
import { ReadiumSpeechEngineProvider } from '../provider.js';
|
|
3
|
+
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator.js';
|
|
4
|
+
import { ReadiumSpeechUtterance } from '../utterance.js';
|
|
5
|
+
import { ReadiumSpeechVoice } from '../voices/types.js';
|
|
6
6
|
export interface FallbackSpeechEngineOptions {
|
|
7
7
|
primaryEngine: ReadiumSpeechPlaybackEngine;
|
|
8
8
|
primaryProvider: ReadiumSpeechEngineProvider;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './fallbackSpeechEngine';
|
|
2
|
-
export * from './fallbackEngineProvider';
|
|
3
|
-
export * from './recoverableFailure';
|
|
1
|
+
export * from './fallbackSpeechEngine.js';
|
|
2
|
+
export * from './fallbackEngineProvider.js';
|
|
3
|
+
export * from './recoverableFailure.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './chunkText';
|
|
2
|
-
export * from './selectFormat';
|
|
3
|
-
export * from './speechServerEngine';
|
|
4
|
-
export * from './speechServerEngineProvider';
|
|
5
|
-
export * from './speechServerVoiceMapping';
|
|
6
|
-
export * from './errors';
|
|
7
|
-
export * from './types';
|
|
1
|
+
export * from './chunkText.js';
|
|
2
|
+
export * from './selectFormat.js';
|
|
3
|
+
export * from './speechServerEngine.js';
|
|
4
|
+
export * from './speechServerEngineProvider.js';
|
|
5
|
+
export * from './speechServerVoiceMapping.js';
|
|
6
|
+
export * from './errors.js';
|
|
7
|
+
export * from './types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpeechServerAudioFormat } from './types';
|
|
1
|
+
import { SpeechServerAudioFormat } from './types.js';
|
|
2
2
|
export type CanPlayTypeResult = "probably" | "maybe" | "";
|
|
3
3
|
export type CanPlayType = (mime: string) => CanPlayTypeResult;
|
|
4
4
|
export declare function mimeTypeForFormat(format: string): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ReadiumSpeechPlaybackEngine } from '../engine';
|
|
2
|
-
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator';
|
|
3
|
-
import { ReadiumSpeechUtterance } from '../utterance';
|
|
4
|
-
import { ReadiumSpeechVoice } from '../voices/types';
|
|
5
|
-
import { SpeechServerFormatOptions } from './selectFormat';
|
|
1
|
+
import { ReadiumSpeechPlaybackEngine } from '../engine.js';
|
|
2
|
+
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator.js';
|
|
3
|
+
import { ReadiumSpeechUtterance } from '../utterance.js';
|
|
4
|
+
import { ReadiumSpeechVoice } from '../voices/types.js';
|
|
5
|
+
import { SpeechServerFormatOptions } from './selectFormat.js';
|
|
6
6
|
export interface SpeechServerEndpoints {
|
|
7
7
|
voices: string;
|
|
8
8
|
synthesize: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReadiumSpeechEngineProvider } from '../provider';
|
|
2
|
-
import { ReadiumSpeechPlaybackEngine } from '../engine';
|
|
3
|
-
import { ReadiumSpeechVoice } from '../voices/types';
|
|
4
|
-
import { SpeechServerEngineOptions } from './speechServerEngine';
|
|
1
|
+
import { ReadiumSpeechEngineProvider } from '../provider.js';
|
|
2
|
+
import { ReadiumSpeechPlaybackEngine } from '../engine.js';
|
|
3
|
+
import { ReadiumSpeechVoice } from '../voices/types.js';
|
|
4
|
+
import { SpeechServerEngineOptions } from './speechServerEngine.js';
|
|
5
5
|
export type SpeechServerEngineProviderOptions = SpeechServerEngineOptions;
|
|
6
6
|
export declare class SpeechServerEngineProvider implements ReadiumSpeechEngineProvider {
|
|
7
7
|
readonly id: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReadiumSpeechVoice, TServerVoiceControls } from '../voices/types';
|
|
2
|
-
import { SpeechServerVoice } from './types';
|
|
1
|
+
import { ReadiumSpeechVoice, TServerVoiceControls } from '../voices/types.js';
|
|
2
|
+
import { SpeechServerVoice } from './types.js';
|
|
3
3
|
export declare function mapServerVoice(voice: SpeechServerVoice, providerControls?: TServerVoiceControls): ReadiumSpeechVoice;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './WebSpeechVoiceManager';
|
|
2
|
-
export * from './webSpeechEngine';
|
|
3
|
-
export * from './webSpeechEngineProvider';
|
|
1
|
+
export * from './WebSpeechVoiceManager.js';
|
|
2
|
+
export * from './webSpeechEngine.js';
|
|
3
|
+
export * from './webSpeechEngineProvider.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReadiumSpeechPlaybackEngine } from '../engine';
|
|
2
|
-
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator';
|
|
3
|
-
import { ReadiumSpeechUtterance } from '../utterance';
|
|
4
|
-
import { ReadiumSpeechVoice } from '../voices/types';
|
|
1
|
+
import { ReadiumSpeechPlaybackEngine } from '../engine.js';
|
|
2
|
+
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from '../navigator.js';
|
|
3
|
+
import { ReadiumSpeechUtterance } from '../utterance.js';
|
|
4
|
+
import { ReadiumSpeechVoice } from '../voices/types.js';
|
|
5
5
|
export declare class WebSpeechEngine implements ReadiumSpeechPlaybackEngine {
|
|
6
6
|
private speechSynthesis;
|
|
7
7
|
private speechSynthesisUtterance;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReadiumSpeechEngineProvider } from '../provider';
|
|
2
|
-
import { ReadiumSpeechPlaybackEngine } from '../engine';
|
|
3
|
-
import { ReadiumSpeechVoice } from '../voices/types';
|
|
1
|
+
import { ReadiumSpeechEngineProvider } from '../provider.js';
|
|
2
|
+
import { ReadiumSpeechPlaybackEngine } from '../engine.js';
|
|
3
|
+
import { ReadiumSpeechVoice } from '../voices/types.js';
|
|
4
4
|
export declare class WebSpeechEngineProvider implements ReadiumSpeechEngineProvider {
|
|
5
5
|
readonly id: string;
|
|
6
6
|
readonly name: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Locator } from '@readium/shared';
|
|
2
|
-
import { DomRangeJSON } from '
|
|
2
|
+
import { DomRangeJSON } from '@readium/guided-navigation';
|
|
3
3
|
export interface LocatorOptions {
|
|
4
|
+
href?: string;
|
|
4
5
|
text?: {
|
|
5
6
|
highlight?: string;
|
|
6
7
|
before?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './setupDecorations';
|
|
2
|
-
export * from './createLocator';
|
|
1
|
+
export * from './setupDecorations.js';
|
|
2
|
+
export * from './createLocator.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DirectCommsChannel, Decorator, DecorationController, DecorationControllerConfig, DecorationStyle } from '@readium/decorator';
|
|
2
|
-
import { LocatorOptions } from './createLocator';
|
|
2
|
+
import { LocatorOptions } from './createLocator.js';
|
|
3
3
|
export interface DecorationInput extends LocatorOptions {
|
|
4
4
|
id: string;
|
|
5
5
|
style: DecorationStyle;
|
package/build/engine.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from './navigator';
|
|
2
|
-
import { ReadiumSpeechUtterance } from './utterance';
|
|
3
|
-
import { ReadiumSpeechVoice } from './voices/types';
|
|
1
|
+
import { ReadiumSpeechPlaybackEvent, ReadiumSpeechPlaybackState } from './navigator.js';
|
|
2
|
+
import { ReadiumSpeechUtterance } from './utterance.js';
|
|
3
|
+
import { ReadiumSpeechVoice } from './voices/types.js';
|
|
4
4
|
export interface ReadiumSpeechPlaybackEngine {
|
|
5
5
|
initialize?(): Promise<unknown>;
|
|
6
6
|
loadUtterances(contents: ReadiumSpeechUtterance[], startIndex?: number): void;
|
package/build/index.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
export * from './WebSpeech';
|
|
2
|
-
export * from './SpeechServer';
|
|
3
|
-
export * from './Fallback';
|
|
1
|
+
export * from './WebSpeech/index.js';
|
|
2
|
+
export * from './SpeechServer/index.js';
|
|
3
|
+
export * from './Fallback/index.js';
|
|
4
4
|
export * from '@readium/decorator';
|
|
5
|
-
export * from './decorator';
|
|
5
|
+
export * from './decorator/index.js';
|
|
6
6
|
export { Locator, LocatorLocations, LocatorText } from '@readium/shared';
|
|
7
|
-
export { chineseVariantMap } from './voices/languages';
|
|
8
|
-
export * from './voices/types';
|
|
9
|
-
export * from './engine';
|
|
10
|
-
export * from './navigator';
|
|
11
|
-
export * from './provider';
|
|
12
|
-
export * from './providerRegistry';
|
|
13
|
-
export * from './speechNavigator';
|
|
14
|
-
export * from './utterance';
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './preferences';
|
|
7
|
+
export { chineseVariantMap } from './voices/languages.js';
|
|
8
|
+
export * from './voices/types.js';
|
|
9
|
+
export * from './engine.js';
|
|
10
|
+
export * from './navigator.js';
|
|
11
|
+
export * from './provider.js';
|
|
12
|
+
export * from './providerRegistry.js';
|
|
13
|
+
export * from './speechNavigator.js';
|
|
14
|
+
export * from './utterance.js';
|
|
15
|
+
export * from './utterances/index.js';
|
|
16
|
+
export * from './preferences/index.js';
|