@readium/speech 0.11.0 → 0.12.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.
Files changed (117) hide show
  1. package/README.md +4 -6
  2. package/build/Fallback/fallbackEngineProvider.d.ts +3 -3
  3. package/build/Fallback/fallbackSpeechEngine.d.ts +5 -5
  4. package/build/Fallback/index.d.ts +3 -3
  5. package/build/Fallback/recoverableFailure.d.ts +1 -1
  6. package/build/SpeechServer/index.d.ts +7 -7
  7. package/build/SpeechServer/selectFormat.d.ts +1 -1
  8. package/build/SpeechServer/speechServerEngine.d.ts +5 -5
  9. package/build/SpeechServer/speechServerEngineProvider.d.ts +4 -4
  10. package/build/SpeechServer/speechServerVoiceMapping.d.ts +2 -2
  11. package/build/SpeechServer/types.d.ts +1 -1
  12. package/build/WebSpeech/WebSpeechVoiceManager.d.ts +1 -1
  13. package/build/WebSpeech/index.d.ts +3 -3
  14. package/build/WebSpeech/webSpeechEngine.d.ts +4 -4
  15. package/build/WebSpeech/webSpeechEngineProvider.d.ts +3 -3
  16. package/build/decorator/createLocator.d.ts +1 -1
  17. package/build/decorator/index.d.ts +2 -2
  18. package/build/decorator/setupDecorations.d.ts +1 -1
  19. package/build/engine.d.ts +3 -3
  20. package/build/index.d.ts +14 -15
  21. package/build/index.js +1777 -6845
  22. package/build/navigator.d.ts +7 -7
  23. package/build/preferences/Preference.d.ts +6 -6
  24. package/build/preferences/SpeechDefaults.d.ts +1 -1
  25. package/build/preferences/SpeechPreferences.d.ts +1 -1
  26. package/build/preferences/SpeechSettings.d.ts +1 -1
  27. package/build/preferences/constraints.d.ts +8 -8
  28. package/build/preferences/guards.d.ts +1 -1
  29. package/build/preferences/index.d.ts +4 -2
  30. package/build/preferences/verbosityTables.d.ts +1 -1
  31. package/build/provider.d.ts +2 -2
  32. package/build/providerRegistry.d.ts +3 -3
  33. package/build/speechNavigator.d.ts +14 -14
  34. package/build/utils/text.d.ts +0 -2
  35. package/build/utterances/contextualization.d.ts +5 -4
  36. package/build/utterances/extractUtterances.d.ts +4 -4
  37. package/build/utterances/locate.d.ts +3 -3
  38. package/build/utterances/mergeUtterances.d.ts +2 -2
  39. package/build/utterances/nodeFields.d.ts +5 -0
  40. package/build/utterances/roles.d.ts +1 -1
  41. package/build/utterances/tableStructure.d.ts +5 -5
  42. package/build/utterances/text.d.ts +4 -4
  43. package/build/utterances/types.d.ts +3 -2
  44. package/build/utterances/utteranceOutput.d.ts +2 -2
  45. package/build/utterances/walk.d.ts +2 -2
  46. package/build/utterances/walkContext.d.ts +8 -7
  47. package/build/voices/filters.d.ts +1 -1
  48. package/build/voices/languages.d.ts +2 -2
  49. package/build/voices/localized.d.ts +1 -1
  50. package/build/voices/packages.d.ts +1 -1
  51. package/build/voices/sorting.d.ts +2 -2
  52. package/build/voices/voiceDuplicates.d.ts +1 -1
  53. package/package.json +15 -15
  54. package/build/ar-DuqkW85r.cjs +0 -1
  55. package/build/bg-DQ8Or9ln.cjs +0 -1
  56. package/build/bho-UB6aO8oz.cjs +0 -1
  57. package/build/bn-DdnrYetr.cjs +0 -1
  58. package/build/ca-D2gB-PsU.cjs +0 -1
  59. package/build/cmn-BkQ6_5c5.cjs +0 -1
  60. package/build/cs-Dg7ZcgUn.cjs +0 -1
  61. package/build/da-Bmc3-wE3.cjs +0 -1
  62. package/build/de-yGzFecZa.cjs +0 -1
  63. package/build/el-BXDgzxPG.cjs +0 -1
  64. package/build/en-BkmFXU-D.cjs +0 -1
  65. package/build/es-yaOBPPo5.cjs +0 -1
  66. package/build/eu-uq15ZgwW.cjs +0 -1
  67. package/build/fa-C7gf54mN.cjs +0 -1
  68. package/build/fi-Ckva-_7A.cjs +0 -1
  69. package/build/fr-C7LUVKsE.cjs +0 -1
  70. package/build/gl-_cjNQmPr.cjs +0 -1
  71. package/build/gnd/a11y.d.ts +0 -20
  72. package/build/gnd/converter.d.ts +0 -73
  73. package/build/gnd/dom.d.ts +0 -6
  74. package/build/gnd/domRangeGenerator.d.ts +0 -9
  75. package/build/gnd/elementHandlers.d.ts +0 -5
  76. package/build/gnd/idAllocator.d.ts +0 -6
  77. package/build/gnd/index.d.ts +0 -7
  78. package/build/gnd/makeGnd.d.ts +0 -9
  79. package/build/gnd/object.d.ts +0 -28
  80. package/build/gnd/options.d.ts +0 -17
  81. package/build/gnd/prescan.d.ts +0 -1
  82. package/build/gnd/roles.d.ts +0 -3
  83. package/build/gnd/selectorGenerator.d.ts +0 -3
  84. package/build/gnd/text.d.ts +0 -18
  85. package/build/gnd/textFragmentGenerator.d.ts +0 -2
  86. package/build/gnd/textrefFragment.d.ts +0 -40
  87. package/build/gnd/types.d.ts +0 -21
  88. package/build/he-DVF3vvW9.cjs +0 -1
  89. package/build/hi-Cw9tDdoY.cjs +0 -1
  90. package/build/hr-BggD5hef.cjs +0 -1
  91. package/build/hu-CVN4AAaU.cjs +0 -1
  92. package/build/id-0GsU08OQ.cjs +0 -1
  93. package/build/index.cjs +0 -24
  94. package/build/it-CjraJOTi.cjs +0 -1
  95. package/build/ja-DZA_Jiej.cjs +0 -1
  96. package/build/kk-B1QeTCqa.cjs +0 -1
  97. package/build/kn-Dr8XiVC3.cjs +0 -1
  98. package/build/ko-D71TFL45.cjs +0 -1
  99. package/build/mr-CX6HEC_l.cjs +0 -1
  100. package/build/ms-DfrAHvvL.cjs +0 -1
  101. package/build/nb-CZLktG1o.cjs +0 -1
  102. package/build/nl-B5M6yG47.cjs +0 -1
  103. package/build/pl-l20DtMGO.cjs +0 -1
  104. package/build/pt-BUTOekxw.cjs +0 -1
  105. package/build/ro-DIcYfRAr.cjs +0 -1
  106. package/build/ru-CJPE4iif.cjs +0 -1
  107. package/build/sk-DzFVn2yw.cjs +0 -1
  108. package/build/sl-B4fy9eLK.cjs +0 -1
  109. package/build/sv-DwG8WENn.cjs +0 -1
  110. package/build/ta-IhlG6xub.cjs +0 -1
  111. package/build/te-BMlSZMWZ.cjs +0 -1
  112. package/build/th-Bgdg_M0f.cjs +0 -1
  113. package/build/tr-BS6FY0hu.cjs +0 -1
  114. package/build/uk-BBTtG5rE.cjs +0 -1
  115. package/build/vi-ZQ09Ahmv.cjs +0 -1
  116. package/build/wuu-DnwGQ6c-.cjs +0 -1
  117. 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) — extracting [Guided Navigation objects](https://readium.org/guided-navigation) from HTML/XHTML content
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 modules)
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 project includes demo applications that can be served locally:
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:gnd` and `test:utterances` are both driven by [`fixtures/`](fixtures/README.md), a language-agnostic conformance suite of paired input/expected-output files (`input.html`/`input.xhtml`, `gnd.json`, `utterances.json`) covering the [Guided Navigation](docs/GuidedNavigation.md) and [utterance extraction](docs/UtteranceExtraction.md) stages one role/encoding/option at a time. 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".
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,4 +1,4 @@
1
- import { ReadiumSpeechPlaybackEvent } from '../navigator';
1
+ import { ReadiumSpeechPlaybackEvent } from '../navigator.js';
2
2
  export interface ErrorEventDetail {
3
3
  message: string;
4
4
  recoverable: boolean;
@@ -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,4 +1,4 @@
1
- import { TGender, TQuality, TServerVoiceControls } from '../voices/types';
1
+ import { TGender, TQuality, TServerVoiceControls } from '../voices/types.js';
2
2
  export interface SpeechServerVoice {
3
3
  name: string;
4
4
  originalName: string;
@@ -1,4 +1,4 @@
1
- import { ReadiumSpeechVoice, TGender, TQuality, TSource } from '../voices/types';
1
+ import { ReadiumSpeechVoice, TGender, TQuality, TSource } from '../voices/types.js';
2
2
  /**
3
3
  * Options for filtering voices
4
4
  */
@@ -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,5 +1,5 @@
1
1
  import { Locator } from '@readium/shared';
2
- import { DomRangeJSON } from '../gnd/textrefFragment.js';
2
+ import { DomRangeJSON } from '@readium/guided-navigation';
3
3
  export interface LocatorOptions {
4
4
  text?: {
5
5
  highlight?: 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 './gnd';
16
- export * from './utterances';
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';