@readium/speech 0.13.0 → 0.14.1

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.
@@ -4,3 +4,11 @@
4
4
  * @returns A tuple containing [language, region] where region is optional
5
5
  */
6
6
  export declare const extractLangRegionFromBCP47: (lang: string) => [string, string | undefined];
7
+ /**
8
+ * Collects the entries of a language-keyed map that apply to a BCP 47 tag:
9
+ * the primary language subtag's entries plus the exact tag's, matched case-insensitively.
10
+ * @param entriesByLanguage - Map keyed by language tag (e.g., { en: [...], "en-US": [...] })
11
+ * @param lang - The BCP 47 language tag (e.g., "en-US")
12
+ * @returns The combined entries, without duplicates, or undefined if no key matches
13
+ */
14
+ export declare const entriesForLanguage: <T>(entriesByLanguage: Record<string, T[]>, lang: string) => T[] | undefined;
@@ -3,3 +3,8 @@ export declare const isNoveltyVoice: (voiceName: string, voiceId?: string) => bo
3
3
  export declare const isVeryLowQualityVoice: (voiceName: string, quality?: TQuality) => boolean;
4
4
  export declare const filterOutNoveltyVoices: (voices: ReadiumSpeechVoice[]) => ReadiumSpeechVoice[];
5
5
  export declare const filterOutVeryLowQualityVoices: (voices: ReadiumSpeechVoice[]) => ReadiumSpeechVoice[];
6
+ /**
7
+ * Keeps voices whose language or alternative language matches one of `languages`,
8
+ * either exactly or by base language (e.g. "en" or "en-US" keep "en-GB").
9
+ */
10
+ export declare const filterByLanguages: (voices: ReadiumSpeechVoice[], languages: string | string[]) => ReadiumSpeechVoice[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/speech",
3
- "version": "0.13.0",
3
+ "version": "0.14.1",
4
4
  "description": "A TypeScript library for implementing read aloud features with Web technologies, following best practices for digital publishing.",
5
5
  "author": "Readium Foundation",
6
6
  "keywords": [