@readium/navigator 2.4.0-alpha.8 → 2.4.0-beta.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.
Files changed (54) hide show
  1. package/dist/index.js +1809 -1055
  2. package/dist/index.umd.cjs +170 -23
  3. package/package.json +10 -10
  4. package/src/Navigator.ts +55 -1
  5. package/src/audio/AudioNavigator.ts +497 -0
  6. package/src/audio/AudioPoolManager.ts +120 -0
  7. package/src/audio/engine/AudioEngine.ts +26 -10
  8. package/src/audio/engine/PreservePitchProcessor.js +149 -0
  9. package/src/audio/engine/PreservePitchWorklet.ts +79 -0
  10. package/src/audio/engine/WebAudioEngine.ts +558 -259
  11. package/src/audio/index.ts +3 -1
  12. package/src/audio/preferences/AudioDefaults.ts +43 -0
  13. package/src/audio/preferences/AudioPreferences.ts +54 -0
  14. package/src/audio/preferences/AudioPreferencesEditor.ts +123 -0
  15. package/src/audio/preferences/AudioSettings.ts +36 -0
  16. package/src/audio/preferences/index.ts +4 -0
  17. package/src/epub/EpubNavigator.ts +2 -2
  18. package/src/epub/frame/FrameBlobBuilder.ts +33 -84
  19. package/src/epub/frame/FramePoolManager.ts +23 -18
  20. package/src/epub/fxl/FXLFrameManager.ts +4 -11
  21. package/src/epub/fxl/FXLFramePoolManager.ts +22 -26
  22. package/src/epub/preferences/EpubPreferences.ts +4 -4
  23. package/src/injection/Injector.ts +5 -5
  24. package/src/preferences/Configurable.ts +2 -3
  25. package/src/preferences/PreferencesEditor.ts +1 -1
  26. package/src/preferences/Types.ts +19 -0
  27. package/src/webpub/WebPubNavigator.ts +1 -2
  28. package/src/webpub/preferences/WebPubPreferences.ts +3 -3
  29. package/types/src/Navigator.d.ts +46 -0
  30. package/types/src/audio/AudioNavigator.d.ts +79 -0
  31. package/types/src/audio/AudioPoolManager.d.ts +52 -0
  32. package/types/src/audio/engine/AudioEngine.d.ts +21 -7
  33. package/types/src/audio/engine/PreservePitchWorklet.d.ts +18 -0
  34. package/types/src/audio/engine/WebAudioEngine.d.ts +52 -7
  35. package/types/src/audio/index.d.ts +2 -0
  36. package/types/src/audio/preferences/AudioDefaults.d.ts +21 -0
  37. package/types/src/audio/preferences/AudioPreferences.d.ts +23 -0
  38. package/types/src/audio/preferences/AudioPreferencesEditor.d.ts +19 -0
  39. package/types/src/audio/preferences/AudioSettings.d.ts +24 -0
  40. package/types/src/audio/preferences/index.d.ts +4 -0
  41. package/types/src/epub/EpubNavigator.d.ts +2 -2
  42. package/types/src/epub/frame/FrameBlobBuilder.d.ts +3 -6
  43. package/types/src/epub/fxl/FXLFrameManager.d.ts +0 -2
  44. package/types/src/epub/preferences/EpubPreferences.d.ts +2 -2
  45. package/types/src/preferences/Configurable.d.ts +2 -3
  46. package/types/src/preferences/PreferencesEditor.d.ts +1 -1
  47. package/types/src/preferences/Types.d.ts +3 -0
  48. package/types/src/webpub/WebPubNavigator.d.ts +2 -2
  49. package/types/src/webpub/preferences/WebPubPreferences.d.ts +2 -2
  50. package/LICENSE +0 -28
  51. package/src/divina/DivinaNavigator.ts +0 -0
  52. package/src/divina/index.ts +0 -0
  53. package/types/src/divina/DivinaNavigator.d.ts +0 -0
  54. package/types/src/divina/index.d.ts +0 -0
@@ -0,0 +1,21 @@
1
+ export interface IAudioDefaults {
2
+ volume?: number | null;
3
+ playbackRate?: number | null;
4
+ preservePitch?: boolean | null;
5
+ skipBackwardInterval?: number | null;
6
+ skipForwardInterval?: number | null;
7
+ pollInterval?: number | null;
8
+ autoPlay?: boolean | null;
9
+ enableMediaSession?: boolean | null;
10
+ }
11
+ export declare class AudioDefaults {
12
+ readonly volume: number;
13
+ readonly playbackRate: number;
14
+ readonly preservePitch: boolean;
15
+ readonly skipBackwardInterval: number;
16
+ readonly skipForwardInterval: number;
17
+ readonly pollInterval: number;
18
+ readonly autoPlay: boolean;
19
+ readonly enableMediaSession: boolean;
20
+ constructor(defaults?: IAudioDefaults);
21
+ }
@@ -0,0 +1,23 @@
1
+ import { ConfigurablePreferences } from "../../preferences/Configurable";
2
+ export interface IAudioPreferences {
3
+ volume?: number | null;
4
+ playbackRate?: number | null;
5
+ preservePitch?: boolean | null;
6
+ skipBackwardInterval?: number | null;
7
+ skipForwardInterval?: number | null;
8
+ pollInterval?: number | null;
9
+ autoPlay?: boolean | null;
10
+ enableMediaSession?: boolean | null;
11
+ }
12
+ export declare class AudioPreferences implements ConfigurablePreferences<AudioPreferences> {
13
+ readonly volume: number | null | undefined;
14
+ readonly playbackRate: number | null | undefined;
15
+ readonly preservePitch: boolean | null | undefined;
16
+ readonly skipBackwardInterval: number | null | undefined;
17
+ readonly skipForwardInterval: number | null | undefined;
18
+ readonly pollInterval: number | null | undefined;
19
+ readonly autoPlay: boolean | null | undefined;
20
+ readonly enableMediaSession: boolean | null | undefined;
21
+ constructor(preferences?: IAudioPreferences);
22
+ merging(other: AudioPreferences): AudioPreferences;
23
+ }
@@ -0,0 +1,19 @@
1
+ import { IPreferencesEditor } from "../../preferences/PreferencesEditor";
2
+ import { AudioPreferences } from "./AudioPreferences";
3
+ import { AudioSettings } from "./AudioSettings";
4
+ import { Preference, BooleanPreference, RangePreference } from "../../preferences/Preference";
5
+ export declare class AudioPreferencesEditor implements IPreferencesEditor {
6
+ preferences: AudioPreferences;
7
+ private settings;
8
+ constructor(initialPreferences: AudioPreferences, settings: AudioSettings);
9
+ clear(): void;
10
+ private updatePreference;
11
+ get volume(): RangePreference<number>;
12
+ get playbackRate(): RangePreference<number>;
13
+ get preservePitch(): BooleanPreference;
14
+ get skipBackwardInterval(): RangePreference<number>;
15
+ get skipForwardInterval(): RangePreference<number>;
16
+ get pollInterval(): Preference<number>;
17
+ get autoPlay(): BooleanPreference;
18
+ get enableMediaSession(): BooleanPreference;
19
+ }
@@ -0,0 +1,24 @@
1
+ import { AudioPreferences } from "./AudioPreferences";
2
+ import { AudioDefaults } from "./AudioDefaults";
3
+ import { ConfigurableSettings } from "../../preferences/Configurable";
4
+ export interface IAudioSettings extends ConfigurableSettings {
5
+ volume: number;
6
+ playbackRate: number;
7
+ preservePitch: boolean;
8
+ skipBackwardInterval: number;
9
+ skipForwardInterval: number;
10
+ pollInterval: number;
11
+ autoPlay: boolean;
12
+ enableMediaSession: boolean;
13
+ }
14
+ export declare class AudioSettings implements IAudioSettings, ConfigurableSettings {
15
+ readonly volume: number;
16
+ readonly playbackRate: number;
17
+ readonly preservePitch: boolean;
18
+ readonly skipBackwardInterval: number;
19
+ readonly skipForwardInterval: number;
20
+ readonly pollInterval: number;
21
+ readonly autoPlay: boolean;
22
+ readonly enableMediaSession: boolean;
23
+ constructor(preferences: AudioPreferences, defaults: AudioDefaults);
24
+ }
@@ -0,0 +1,4 @@
1
+ export * from './AudioPreferences';
2
+ export * from './AudioDefaults';
3
+ export * from './AudioSettings';
4
+ export * from './AudioPreferencesEditor';
@@ -1,5 +1,5 @@
1
1
  import { Layout, Link, Locator, Publication, ReadingProgression } from "@readium/shared";
2
- import { Configurable, ConfigurablePreferences, ConfigurableSettings, VisualNavigator, VisualNavigatorViewport } from "../";
2
+ import { Configurable, ConfigurableSettings, VisualNavigator, VisualNavigatorViewport } from "../";
3
3
  import { FramePoolManager } from "./frame/FramePoolManager";
4
4
  import { FXLFramePoolManager } from "./fxl/FXLFramePoolManager";
5
5
  import { CommsEventKey, ContextMenuEvent, KeyboardEventData } from "@readium/navigator-html-injectables";
@@ -35,7 +35,7 @@ export interface EpubNavigatorListeners {
35
35
  contextMenu: (data: ContextMenuEvent) => void;
36
36
  peripheral: (data: KeyboardEventData) => void;
37
37
  }
38
- export declare class EpubNavigator extends VisualNavigator implements Configurable<ConfigurableSettings, ConfigurablePreferences> {
38
+ export declare class EpubNavigator extends VisualNavigator implements Configurable<ConfigurableSettings, EpubPreferences> {
39
39
  private readonly pub;
40
40
  private readonly container;
41
41
  private readonly listeners;
@@ -1,20 +1,17 @@
1
1
  import { Link, Publication } from "@readium/shared";
2
2
  import { Injector } from "../../injection/Injector";
3
- export default class FrameBlobBuilder {
4
- private readonly pub;
5
- private readonly baseURL;
3
+ export default class FrameBlobBuider {
6
4
  private readonly item;
5
+ private readonly burl;
6
+ private readonly pub;
7
7
  private readonly cssProperties?;
8
8
  private readonly injector;
9
- private currentUrl?;
10
- private currentResource?;
11
9
  constructor(pub: Publication, baseURL: string, item: Link, options: {
12
10
  cssProperties?: {
13
11
  [key: string]: string;
14
12
  };
15
13
  injector?: Injector | null;
16
14
  });
17
- reset(): void;
18
15
  build(fxl?: boolean): Promise<string>;
19
16
  private buildHtmlFrame;
20
17
  private buildImageFrame;
@@ -5,7 +5,6 @@ import { FXLPeripherals } from "./FXLPeripherals";
5
5
  import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator";
6
6
  export declare class FXLFrameManager {
7
7
  private frame;
8
- private frameIsAppended;
9
8
  private loader;
10
9
  source: string;
11
10
  private comms;
@@ -17,7 +16,6 @@ export declare class FXLFrameManager {
17
16
  debugHref: string;
18
17
  private loadPromise;
19
18
  private showPromise;
20
- private viewportSize;
21
19
  constructor(peripherals: FXLPeripherals, direction: ReadingProgression, debugHref: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig);
22
20
  load(modules: ModuleName[], source: string): Promise<Window>;
23
21
  loadPageSize(): {
@@ -42,7 +42,7 @@ export interface IEpubPreferences {
42
42
  visitedColor?: string | null;
43
43
  wordSpacing?: number | null;
44
44
  }
45
- export declare class EpubPreferences implements ConfigurablePreferences {
45
+ export declare class EpubPreferences implements ConfigurablePreferences<EpubPreferences> {
46
46
  backgroundColor?: string | null;
47
47
  blendFilter?: boolean | null;
48
48
  constraint?: number | null;
@@ -86,5 +86,5 @@ export declare class EpubPreferences implements ConfigurablePreferences {
86
86
  constructor(preferences?: IEpubPreferences);
87
87
  static serialize(preferences: EpubPreferences): string;
88
88
  static deserialize(preferences: string): EpubPreferences | null;
89
- merging(other: ConfigurablePreferences): ConfigurablePreferences;
89
+ merging(other: EpubPreferences): EpubPreferences;
90
90
  }
@@ -2,9 +2,8 @@ import { IPreferencesEditor } from "./PreferencesEditor";
2
2
  export interface ConfigurableSettings {
3
3
  [key: string]: any;
4
4
  }
5
- export interface ConfigurablePreferences {
6
- [key: string]: any;
7
- merging(other: ConfigurablePreferences): ConfigurablePreferences;
5
+ export interface ConfigurablePreferences<T> {
6
+ merging(other: T): T;
8
7
  }
9
8
  export interface Configurable<ConfigurableSettings, ConfigurablePreferences> {
10
9
  settings: ConfigurableSettings;
@@ -1,5 +1,5 @@
1
1
  import { ConfigurablePreferences } from "./Configurable";
2
2
  export interface IPreferencesEditor {
3
- preferences: ConfigurablePreferences;
3
+ preferences: ConfigurablePreferences<unknown>;
4
4
  clear(): void;
5
5
  }
@@ -33,3 +33,6 @@ export declare const paragraphIndentRangeConfig: RangeConfig;
33
33
  export declare const paragraphSpacingRangeConfig: RangeConfig;
34
34
  export declare const wordSpacingRangeConfig: RangeConfig;
35
35
  export declare const zoomRangeConfig: RangeConfig;
36
+ export declare const volumeRangeConfig: RangeConfig;
37
+ export declare const playbackRateRangeConfig: RangeConfig;
38
+ export declare const skipIntervalRangeConfig: RangeConfig;
@@ -7,7 +7,7 @@ import { ManagerEventKey } from "../epub/EpubNavigator";
7
7
  import { IWebPubPreferences, WebPubPreferences } from "./preferences/WebPubPreferences";
8
8
  import { IWebPubDefaults } from "./preferences/WebPubDefaults";
9
9
  import { WebPubSettings } from "./preferences/WebPubSettings";
10
- import { IPreferencesEditor } from "../preferences/PreferencesEditor";
10
+ import { WebPubPreferencesEditor } from "./preferences/WebPubPreferencesEditor";
11
11
  import { IInjectablesConfig } from "../injection/Injectable";
12
12
  import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator";
13
13
  export interface WebPubNavigatorConfiguration {
@@ -54,7 +54,7 @@ export declare class WebPubNavigator extends VisualNavigator implements Configur
54
54
  constructor(container: HTMLElement, pub: Publication, listeners: WebPubNavigatorListeners, initialPosition?: Locator | undefined, configuration?: WebPubNavigatorConfiguration);
55
55
  load(): Promise<void>;
56
56
  get settings(): Readonly<WebPubSettings>;
57
- get preferencesEditor(): IPreferencesEditor;
57
+ get preferencesEditor(): WebPubPreferencesEditor;
58
58
  submitPreferences(preferences: WebPubPreferences): Promise<void>;
59
59
  private applyPreferences;
60
60
  private updateCSS;
@@ -17,7 +17,7 @@ export interface IWebPubPreferences {
17
17
  wordSpacing?: number | null;
18
18
  zoom?: number | null;
19
19
  }
20
- export declare class WebPubPreferences implements ConfigurablePreferences {
20
+ export declare class WebPubPreferences implements ConfigurablePreferences<WebPubPreferences> {
21
21
  fontFamily?: string | null;
22
22
  fontWeight?: number | null;
23
23
  hyphens?: boolean | null;
@@ -36,5 +36,5 @@ export declare class WebPubPreferences implements ConfigurablePreferences {
36
36
  constructor(preferences?: IWebPubPreferences);
37
37
  static serialize(preferences: WebPubPreferences): string;
38
38
  static deserialize(preferences: string): WebPubPreferences | null;
39
- merging(other: ConfigurablePreferences): ConfigurablePreferences;
39
+ merging(other: WebPubPreferences): WebPubPreferences;
40
40
  }
package/LICENSE DELETED
@@ -1,28 +0,0 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2022, Readium Foundation
4
-
5
- Redistribution and use in source and binary forms, with or without
6
- modification, are permitted provided that the following conditions are met:
7
-
8
- 1. Redistributions of source code must retain the above copyright notice, this
9
- list of conditions and the following disclaimer.
10
-
11
- 2. Redistributions in binary form must reproduce the above copyright notice,
12
- this list of conditions and the following disclaimer in the documentation
13
- and/or other materials provided with the distribution.
14
-
15
- 3. Neither the name of the copyright holder nor the names of its
16
- contributors may be used to endorse or promote products derived from
17
- this software without specific prior written permission.
18
-
19
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
File without changes
File without changes
File without changes
File without changes