@readium/navigator 2.4.0-beta.9 → 2.5.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.
- package/dist/ReadiumCSS-after-B_e3a-PY.js +592 -0
- package/dist/ReadiumCSS-after-C-T_0paD.js +530 -0
- package/dist/ReadiumCSS-after-lr-n3fz2.js +475 -0
- package/dist/ReadiumCSS-after-mXeKKPap.js +490 -0
- package/dist/ReadiumCSS-before-Bjd3POej.js +426 -0
- package/dist/ReadiumCSS-before-CfXPAGaQ.js +425 -0
- package/dist/ReadiumCSS-before-CrNWvuyE.js +425 -0
- package/dist/ReadiumCSS-before-KVen5ceo.js +425 -0
- package/dist/ReadiumCSS-default-BKAG5pGU.js +162 -0
- package/dist/ReadiumCSS-default-C63bYOYF.js +183 -0
- package/dist/ReadiumCSS-default-CclvbeNC.js +162 -0
- package/dist/ReadiumCSS-default-DnlgDaBu.js +180 -0
- package/dist/ReadiumCSS-ebpaj_fonts_patch-Dt2XliTg.js +82 -0
- package/dist/index.js +2642 -3430
- package/dist/index.umd.cjs +4407 -995
- package/package.json +2 -2
- package/src/audio/AudioNavigator.ts +155 -42
- package/src/audio/AudioPoolManager.ts +27 -14
- package/src/audio/engine/AudioEngine.ts +4 -3
- package/src/audio/engine/PreservePitchProcessor.js +166 -101
- package/src/audio/engine/PreservePitchWorklet.ts +2 -17
- package/src/audio/engine/WebAudioEngine.ts +138 -160
- package/src/audio/engine/index.ts +2 -2
- package/src/audio/index.ts +3 -3
- package/src/audio/preferences/AudioDefaults.ts +2 -2
- package/src/audio/preferences/AudioPreferences.ts +11 -11
- package/src/audio/preferences/AudioPreferencesEditor.ts +13 -13
- package/src/audio/preferences/AudioSettings.ts +3 -3
- package/src/audio/preferences/index.ts +4 -4
- package/src/audio/protection/AudioNavigatorProtector.ts +4 -4
- package/src/css/index.ts +1 -1
- package/src/epub/EpubNavigator.ts +113 -78
- package/src/epub/css/Properties.ts +15 -15
- package/src/epub/css/ReadiumCSS.ts +43 -43
- package/src/epub/css/index.ts +2 -2
- package/src/epub/frame/FrameBlobBuilder.ts +31 -31
- package/src/epub/frame/FrameComms.ts +1 -1
- package/src/epub/frame/FrameManager.ts +13 -9
- package/src/epub/frame/FramePoolManager.ts +13 -13
- package/src/epub/frame/index.ts +4 -4
- package/src/epub/fxl/FXLCoordinator.ts +3 -3
- package/src/epub/fxl/FXLFrameManager.ts +8 -8
- package/src/epub/fxl/FXLFramePoolManager.ts +18 -14
- package/src/epub/fxl/FXLPeripherals.ts +4 -4
- package/src/epub/fxl/index.ts +5 -5
- package/src/epub/helpers/scriptMode.ts +45 -0
- package/src/epub/index.ts +6 -5
- package/src/epub/preferences/EpubDefaults.ts +23 -23
- package/src/epub/preferences/EpubPreferences.ts +16 -16
- package/src/epub/preferences/EpubPreferencesEditor.ts +53 -53
- package/src/epub/preferences/EpubSettings.ts +101 -101
- package/src/epub/preferences/index.ts +4 -4
- package/src/helpers/index.ts +2 -2
- package/src/index.ts +8 -8
- package/src/injection/Injector.ts +42 -42
- package/src/injection/epubInjectables.ts +86 -17
- package/src/injection/index.ts +2 -2
- package/src/injection/webpubInjectables.ts +2 -2
- package/src/preferences/Configurable.ts +2 -2
- package/src/preferences/PreferencesEditor.ts +2 -2
- package/src/preferences/guards.ts +2 -2
- package/src/preferences/index.ts +5 -5
- package/src/protection/CopyProtector.ts +5 -1
- package/src/protection/DevToolsDetector.ts +16 -16
- package/src/protection/DragAndDropProtector.ts +14 -1
- package/src/protection/NavigatorProtector.ts +6 -6
- package/src/webpub/WebPubBlobBuilder.ts +1 -1
- package/src/webpub/WebPubFrameManager.ts +8 -8
- package/src/webpub/WebPubFramePoolManager.ts +7 -7
- package/src/webpub/WebPubNavigator.ts +27 -27
- package/src/webpub/css/Properties.ts +3 -3
- package/src/webpub/css/WebPubCSS.ts +11 -11
- package/src/webpub/css/index.ts +2 -2
- package/src/webpub/index.ts +6 -6
- package/src/webpub/preferences/WebPubDefaults.ts +12 -12
- package/src/webpub/preferences/WebPubPreferences.ts +8 -8
- package/src/webpub/preferences/WebPubPreferencesEditor.ts +31 -31
- package/src/webpub/preferences/WebPubSettings.ts +45 -45
- package/src/webpub/preferences/index.ts +4 -4
- package/types/src/audio/AudioNavigator.d.ts +34 -5
- package/types/src/audio/AudioPoolManager.d.ts +7 -4
- package/types/src/audio/engine/AudioEngine.d.ts +4 -3
- package/types/src/audio/engine/PreservePitchWorklet.d.ts +1 -4
- package/types/src/audio/engine/WebAudioEngine.d.ts +15 -9
- package/types/src/audio/engine/index.d.ts +2 -2
- package/types/src/audio/index.d.ts +3 -3
- package/types/src/audio/preferences/AudioPreferences.d.ts +9 -9
- package/types/src/audio/preferences/AudioPreferencesEditor.d.ts +4 -4
- package/types/src/audio/preferences/AudioSettings.d.ts +3 -3
- package/types/src/audio/preferences/index.d.ts +4 -4
- package/types/src/audio/protection/AudioNavigatorProtector.d.ts +2 -2
- package/types/src/css/index.d.ts +1 -1
- package/types/src/epub/EpubNavigator.d.ts +15 -14
- package/types/src/epub/css/Properties.d.ts +2 -2
- package/types/src/epub/css/ReadiumCSS.d.ts +3 -3
- package/types/src/epub/css/index.d.ts +2 -2
- package/types/src/epub/frame/FrameBlobBuilder.d.ts +1 -1
- package/types/src/epub/frame/FrameComms.d.ts +1 -1
- package/types/src/epub/frame/FrameManager.d.ts +3 -2
- package/types/src/epub/frame/FramePoolManager.d.ts +3 -3
- package/types/src/epub/frame/index.d.ts +4 -4
- package/types/src/epub/fxl/FXLFrameManager.d.ts +3 -3
- package/types/src/epub/fxl/FXLFramePoolManager.d.ts +5 -5
- package/types/src/epub/fxl/FXLPeripherals.d.ts +2 -2
- package/types/src/epub/fxl/index.d.ts +5 -5
- package/types/src/epub/helpers/scriptMode.d.ts +16 -0
- package/types/src/epub/index.d.ts +6 -5
- package/types/src/epub/preferences/EpubDefaults.d.ts +1 -1
- package/types/src/epub/preferences/EpubPreferences.d.ts +2 -2
- package/types/src/epub/preferences/EpubPreferencesEditor.d.ts +5 -5
- package/types/src/epub/preferences/EpubSettings.d.ts +4 -4
- package/types/src/epub/preferences/index.d.ts +4 -4
- package/types/src/helpers/index.d.ts +2 -2
- package/types/src/index.d.ts +8 -8
- package/types/src/injection/Injector.d.ts +1 -1
- package/types/src/injection/epubInjectables.d.ts +5 -3
- package/types/src/injection/index.d.ts +2 -2
- package/types/src/injection/webpubInjectables.d.ts +1 -1
- package/types/src/preferences/Configurable.d.ts +1 -1
- package/types/src/preferences/PreferencesEditor.d.ts +1 -1
- package/types/src/preferences/guards.d.ts +1 -1
- package/types/src/preferences/index.d.ts +5 -5
- package/types/src/protection/CopyProtector.d.ts +1 -0
- package/types/src/protection/DragAndDropProtector.d.ts +2 -0
- package/types/src/protection/NavigatorProtector.d.ts +1 -1
- package/types/src/webpub/WebPubBlobBuilder.d.ts +1 -1
- package/types/src/webpub/WebPubFrameManager.d.ts +2 -2
- package/types/src/webpub/WebPubFramePoolManager.d.ts +3 -3
- package/types/src/webpub/WebPubNavigator.d.ts +10 -10
- package/types/src/webpub/css/Properties.d.ts +2 -2
- package/types/src/webpub/css/WebPubCSS.d.ts +2 -2
- package/types/src/webpub/css/index.d.ts +2 -2
- package/types/src/webpub/index.d.ts +6 -6
- package/types/src/webpub/preferences/WebPubDefaults.d.ts +1 -1
- package/types/src/webpub/preferences/WebPubPreferences.d.ts +2 -2
- package/types/src/webpub/preferences/WebPubPreferencesEditor.d.ts +5 -5
- package/types/src/webpub/preferences/WebPubSettings.d.ts +4 -4
- package/types/src/webpub/preferences/index.d.ts +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ConfigurableSettings } from "../../preferences/Configurable";
|
|
2
|
-
import { ExperimentKey, TextAlignment } from "../../preferences/Types";
|
|
3
|
-
import { WebPubDefaults } from "./WebPubDefaults";
|
|
4
|
-
import { WebPubPreferences } from "./WebPubPreferences";
|
|
1
|
+
import { ConfigurableSettings } from "../../preferences/Configurable.ts";
|
|
2
|
+
import { ExperimentKey, TextAlignment } from "../../preferences/Types.ts";
|
|
3
|
+
import { WebPubDefaults } from "./WebPubDefaults.ts";
|
|
4
|
+
import { WebPubPreferences } from "./WebPubPreferences.ts";
|
|
5
5
|
|
|
6
|
-
import { sMLWithRequest } from "../../helpers";
|
|
6
|
+
import { sMLWithRequest } from "../../helpers/index.ts";
|
|
7
7
|
|
|
8
8
|
export interface IWebPubSettings {
|
|
9
9
|
fontFamily?: string | null,
|
|
@@ -45,61 +45,61 @@ export class WebPubSettings implements ConfigurableSettings {
|
|
|
45
45
|
constructor(preferences: WebPubPreferences, defaults: WebPubDefaults, hasDisplayTransformability: boolean) {
|
|
46
46
|
if (hasDisplayTransformability) {
|
|
47
47
|
this.fontFamily = preferences.fontFamily || defaults.fontFamily || null;
|
|
48
|
-
this.fontWeight = preferences.fontWeight !== undefined
|
|
49
|
-
? preferences.fontWeight
|
|
50
|
-
: defaults.fontWeight !== undefined
|
|
51
|
-
? defaults.fontWeight
|
|
48
|
+
this.fontWeight = preferences.fontWeight !== undefined
|
|
49
|
+
? preferences.fontWeight
|
|
50
|
+
: defaults.fontWeight !== undefined
|
|
51
|
+
? defaults.fontWeight
|
|
52
52
|
: null;
|
|
53
|
-
this.hyphens = typeof preferences.hyphens === "boolean"
|
|
54
|
-
? preferences.hyphens
|
|
53
|
+
this.hyphens = typeof preferences.hyphens === "boolean"
|
|
54
|
+
? preferences.hyphens
|
|
55
55
|
: defaults.hyphens ?? null;
|
|
56
|
-
this.iOSPatch = preferences.iOSPatch === false
|
|
57
|
-
? false
|
|
58
|
-
: preferences.iOSPatch === true
|
|
56
|
+
this.iOSPatch = preferences.iOSPatch === false
|
|
57
|
+
? false
|
|
58
|
+
: preferences.iOSPatch === true
|
|
59
59
|
? ((sMLWithRequest.OS.iOS || sMLWithRequest.OS.iPadOS) && sMLWithRequest.iOSRequest === "mobile")
|
|
60
60
|
: defaults.iOSPatch;
|
|
61
|
-
this.iPadOSPatch = preferences.iPadOSPatch === false
|
|
62
|
-
? false
|
|
63
|
-
: preferences.iPadOSPatch === true
|
|
64
|
-
? (sMLWithRequest.OS.iPadOS && sMLWithRequest.iOSRequest === "desktop")
|
|
61
|
+
this.iPadOSPatch = preferences.iPadOSPatch === false
|
|
62
|
+
? false
|
|
63
|
+
: preferences.iPadOSPatch === true
|
|
64
|
+
? (sMLWithRequest.OS.iPadOS && sMLWithRequest.iOSRequest === "desktop")
|
|
65
65
|
: defaults.iPadOSPatch;
|
|
66
|
-
this.letterSpacing = preferences.letterSpacing !== undefined
|
|
67
|
-
? preferences.letterSpacing
|
|
68
|
-
: defaults.letterSpacing !== undefined
|
|
69
|
-
? defaults.letterSpacing
|
|
66
|
+
this.letterSpacing = preferences.letterSpacing !== undefined
|
|
67
|
+
? preferences.letterSpacing
|
|
68
|
+
: defaults.letterSpacing !== undefined
|
|
69
|
+
? defaults.letterSpacing
|
|
70
70
|
: null;
|
|
71
71
|
this.ligatures = typeof preferences.ligatures === "boolean"
|
|
72
|
-
? preferences.ligatures
|
|
72
|
+
? preferences.ligatures
|
|
73
73
|
: defaults.ligatures ?? null;
|
|
74
|
-
this.lineHeight = preferences.lineHeight !== undefined
|
|
75
|
-
? preferences.lineHeight
|
|
76
|
-
: defaults.lineHeight !== undefined
|
|
77
|
-
? defaults.lineHeight
|
|
74
|
+
this.lineHeight = preferences.lineHeight !== undefined
|
|
75
|
+
? preferences.lineHeight
|
|
76
|
+
: defaults.lineHeight !== undefined
|
|
77
|
+
? defaults.lineHeight
|
|
78
78
|
: null;
|
|
79
|
-
this.noRuby = typeof preferences.noRuby === "boolean"
|
|
80
|
-
? preferences.noRuby
|
|
79
|
+
this.noRuby = typeof preferences.noRuby === "boolean"
|
|
80
|
+
? preferences.noRuby
|
|
81
81
|
: defaults.noRuby ?? null;
|
|
82
|
-
this.paragraphIndent = preferences.paragraphIndent !== undefined
|
|
83
|
-
? preferences.paragraphIndent
|
|
84
|
-
: defaults.paragraphIndent !== undefined
|
|
85
|
-
? defaults.paragraphIndent
|
|
82
|
+
this.paragraphIndent = preferences.paragraphIndent !== undefined
|
|
83
|
+
? preferences.paragraphIndent
|
|
84
|
+
: defaults.paragraphIndent !== undefined
|
|
85
|
+
? defaults.paragraphIndent
|
|
86
86
|
: null;
|
|
87
|
-
this.paragraphSpacing = preferences.paragraphSpacing !== undefined
|
|
88
|
-
? preferences.paragraphSpacing
|
|
89
|
-
: defaults.paragraphSpacing !== undefined
|
|
90
|
-
? defaults.paragraphSpacing
|
|
87
|
+
this.paragraphSpacing = preferences.paragraphSpacing !== undefined
|
|
88
|
+
? preferences.paragraphSpacing
|
|
89
|
+
: defaults.paragraphSpacing !== undefined
|
|
90
|
+
? defaults.paragraphSpacing
|
|
91
91
|
: null;
|
|
92
92
|
this.textAlign = preferences.textAlign || defaults.textAlign || null;
|
|
93
|
-
this.textNormalization = typeof preferences.textNormalization === "boolean"
|
|
94
|
-
? preferences.textNormalization
|
|
93
|
+
this.textNormalization = typeof preferences.textNormalization === "boolean"
|
|
94
|
+
? preferences.textNormalization
|
|
95
95
|
: defaults.textNormalization ?? null;
|
|
96
|
-
this.wordSpacing = preferences.wordSpacing !== undefined
|
|
97
|
-
? preferences.wordSpacing
|
|
98
|
-
: defaults.wordSpacing !== undefined
|
|
99
|
-
? defaults.wordSpacing
|
|
96
|
+
this.wordSpacing = preferences.wordSpacing !== undefined
|
|
97
|
+
? preferences.wordSpacing
|
|
98
|
+
: defaults.wordSpacing !== undefined
|
|
99
|
+
? defaults.wordSpacing
|
|
100
100
|
: null;
|
|
101
101
|
}
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
this.zoom = preferences.zoom !== undefined
|
|
104
104
|
? preferences.zoom
|
|
105
105
|
: defaults.zoom !== undefined
|
|
@@ -108,4 +108,4 @@ export class WebPubSettings implements ConfigurableSettings {
|
|
|
108
108
|
|
|
109
109
|
this.experiments = defaults.experiments || null;
|
|
110
110
|
}
|
|
111
|
-
}
|
|
111
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./WebPubDefaults";
|
|
2
|
-
export * from "./WebPubPreferencesEditor";
|
|
3
|
-
export * from "./WebPubPreferences";
|
|
4
|
-
export * from "./WebPubSettings";
|
|
1
|
+
export * from "./WebPubDefaults.ts";
|
|
2
|
+
export * from "./WebPubPreferencesEditor.ts";
|
|
3
|
+
export * from "./WebPubPreferences.ts";
|
|
4
|
+
export * from "./WebPubSettings.ts";
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { Link, Locator, Publication, Timeline, TimelineItem } from "@readium/shared";
|
|
2
|
-
import { MediaNavigator, IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator";
|
|
3
|
-
import { Configurable } from "../preferences";
|
|
4
|
-
import { AudioPreferences, AudioSettings, AudioPreferencesEditor, IAudioPreferences, IAudioDefaults } from "./preferences";
|
|
2
|
+
import { MediaNavigator, IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
|
|
3
|
+
import { Configurable } from "../preferences/Configurable.ts";
|
|
4
|
+
import { AudioPreferences, AudioSettings, AudioPreferencesEditor, IAudioPreferences, IAudioDefaults } from "./preferences/index.ts";
|
|
5
5
|
import { ContextMenuEvent, KeyboardEventData, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
|
|
6
|
+
export interface AudioMetadata {
|
|
7
|
+
duration: number;
|
|
8
|
+
textTracks: TextTrackList;
|
|
9
|
+
readyState: number;
|
|
10
|
+
networkState: number;
|
|
11
|
+
}
|
|
6
12
|
export interface AudioNavigatorListeners {
|
|
7
13
|
trackLoaded: (media: HTMLMediaElement) => void;
|
|
8
14
|
positionChanged: (locator: Locator) => void;
|
|
@@ -11,18 +17,23 @@ export interface AudioNavigatorListeners {
|
|
|
11
17
|
trackEnded: (locator: Locator) => void;
|
|
12
18
|
play: (locator: Locator) => void;
|
|
13
19
|
pause: (locator: Locator) => void;
|
|
14
|
-
metadataLoaded: (
|
|
20
|
+
metadataLoaded: (metadata: AudioMetadata) => void;
|
|
15
21
|
stalled: (isStalled: boolean) => void;
|
|
16
22
|
seeking: (isSeeking: boolean) => void;
|
|
17
23
|
seekable: (seekable: TimeRanges) => void;
|
|
18
24
|
contentProtection: (type: string, data: SuspiciousActivityEvent) => void;
|
|
19
25
|
peripheral: (data: KeyboardEventData) => void;
|
|
20
26
|
contextMenu: (data: ContextMenuEvent) => void;
|
|
27
|
+
remotePlaybackStateChanged: (state: RemotePlaybackState) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface IAudioContentProtectionConfig extends IContentProtectionConfig {
|
|
30
|
+
/** Prevents the media element from being cast to remote devices via the Remote Playback API. */
|
|
31
|
+
disableRemotePlayback?: boolean;
|
|
21
32
|
}
|
|
22
33
|
export interface AudioNavigatorConfiguration {
|
|
23
34
|
preferences: IAudioPreferences;
|
|
24
35
|
defaults: IAudioDefaults;
|
|
25
|
-
contentProtection?:
|
|
36
|
+
contentProtection?: IAudioContentProtectionConfig;
|
|
26
37
|
keyboardPeripherals?: IKeyboardPeripheralsConfig;
|
|
27
38
|
}
|
|
28
39
|
export declare class AudioNavigator extends MediaNavigator implements Configurable<AudioSettings, AudioPreferences> {
|
|
@@ -43,6 +54,12 @@ export declare class AudioNavigator extends MediaNavigator implements Configurab
|
|
|
43
54
|
private readonly _keyboardPeripheralsManager;
|
|
44
55
|
private readonly _suspiciousActivityListener;
|
|
45
56
|
private readonly _keyboardPeripheralListener;
|
|
57
|
+
private readonly _contentProtection;
|
|
58
|
+
/** True while a track transition is in progress; suppresses spurious mid-navigation events. */
|
|
59
|
+
private _isNavigating;
|
|
60
|
+
private _isStalled;
|
|
61
|
+
private _stalledWatchdog;
|
|
62
|
+
private _stalledCheckTime;
|
|
46
63
|
constructor(publication: Publication, listeners: AudioNavigatorListeners, initialPosition?: Locator, configuration?: AudioNavigatorConfiguration);
|
|
47
64
|
get settings(): AudioSettings;
|
|
48
65
|
get preferencesEditor(): AudioPreferencesEditor;
|
|
@@ -69,6 +86,9 @@ export declare class AudioNavigator extends MediaNavigator implements Configurab
|
|
|
69
86
|
*/
|
|
70
87
|
private waitForLoadedAndSeeked;
|
|
71
88
|
private setupEventListeners;
|
|
89
|
+
private _setStalled;
|
|
90
|
+
private _startStalledWatchdog;
|
|
91
|
+
private _stopStalledWatchdog;
|
|
72
92
|
private setupMediaSession;
|
|
73
93
|
private updateMediaSessionMetadata;
|
|
74
94
|
private startPositionPolling;
|
|
@@ -90,6 +110,15 @@ export declare class AudioNavigator extends MediaNavigator implements Configurab
|
|
|
90
110
|
get isTrackEnd(): boolean;
|
|
91
111
|
get canGoBackward(): boolean;
|
|
92
112
|
get canGoForward(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The RemotePlayback object for the primary media element.
|
|
115
|
+
* Because the element is never swapped, this reference is stable for the
|
|
116
|
+
* lifetime of the navigator — host apps can store it and call `.prompt()`,
|
|
117
|
+
* `.watchAvailability()`, etc. directly.
|
|
118
|
+
*/
|
|
119
|
+
get remotePlayback(): RemotePlayback | undefined;
|
|
120
|
+
/** Wires up the optional remotePlaybackStateChanged listener. Called once after initial load. */
|
|
121
|
+
private _setupRemotePlayback;
|
|
93
122
|
private destroyMediaSession;
|
|
94
123
|
destroy(): void;
|
|
95
124
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Publication } from "@readium/shared";
|
|
2
|
-
import { WebAudioEngine } from "./engine/WebAudioEngine";
|
|
2
|
+
import { WebAudioEngine } from "./engine/WebAudioEngine.ts";
|
|
3
|
+
import type { IAudioContentProtectionConfig } from "./AudioNavigator.ts";
|
|
3
4
|
export declare class AudioPoolManager {
|
|
4
5
|
private readonly pool;
|
|
5
6
|
private _audioEngine;
|
|
6
7
|
private readonly _publication;
|
|
7
8
|
private readonly _supportedAudioTypes;
|
|
8
|
-
constructor(audioEngine: WebAudioEngine, publication: Publication);
|
|
9
|
+
constructor(audioEngine: WebAudioEngine, publication: Publication, contentProtection?: IAudioContentProtectionConfig);
|
|
9
10
|
private detectSupportedAudioTypes;
|
|
10
11
|
private pickPlayableHref;
|
|
11
12
|
get audioEngine(): WebAudioEngine;
|
|
@@ -17,11 +18,13 @@ export declare class AudioPoolManager {
|
|
|
17
18
|
/**
|
|
18
19
|
* Updates the pool around the given index: ensures elements exist within
|
|
19
20
|
* the LOWER_BOUNDARY and disposes those beyond the UPPER_BOUNDARY.
|
|
21
|
+
* The current track is excluded — the primary engine element represents it.
|
|
20
22
|
*/
|
|
21
23
|
private update;
|
|
22
24
|
/**
|
|
23
|
-
* Sets the current audio for playback at the given track index
|
|
24
|
-
*
|
|
25
|
+
* Sets the current audio for playback at the given track index by changing
|
|
26
|
+
* the src on the persistent primary element. This preserves the RemotePlayback
|
|
27
|
+
* session and any Web Audio graph connections across track changes.
|
|
25
28
|
*/
|
|
26
29
|
setCurrentAudio(currentIndex: number, _direction: 'forward' | 'backward'): void;
|
|
27
30
|
destroy(): void;
|
|
@@ -49,10 +49,11 @@ export interface AudioEngine {
|
|
|
49
49
|
*/
|
|
50
50
|
off(event: string, callback: (data: any) => void): void;
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
52
|
+
* Changes the src of the primary media element without swapping it,
|
|
53
|
+
* preserving the RemotePlayback session and all attached event listeners.
|
|
54
|
+
* @param href The URL of the new audio resource.
|
|
54
55
|
*/
|
|
55
|
-
|
|
56
|
+
changeSrc(href: string): void;
|
|
56
57
|
/**
|
|
57
58
|
* Plays the current audio resource.
|
|
58
59
|
*/
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
interface PreservePitchWorkletOptions {
|
|
2
2
|
ctx: AudioContext;
|
|
3
|
-
mediaElement?: HTMLMediaElement;
|
|
4
3
|
pitchFactor?: number;
|
|
5
4
|
modulePath?: string;
|
|
6
5
|
}
|
|
7
6
|
export declare class PreservePitchWorklet {
|
|
8
|
-
mediaElement: HTMLMediaElement | null;
|
|
9
|
-
source: MediaElementAudioSourceNode | null;
|
|
10
7
|
ctx: AudioContext;
|
|
11
8
|
workletNode: AudioWorkletNode | null;
|
|
12
|
-
url
|
|
9
|
+
private url;
|
|
13
10
|
static createWorklet(options: PreservePitchWorkletOptions): Promise<PreservePitchWorklet>;
|
|
14
11
|
constructor(ctx: AudioContext);
|
|
15
12
|
updatePitchFactor(factor: number): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AudioEngine, Playback } from "./AudioEngine";
|
|
1
|
+
import { AudioEngine, Playback } from "./AudioEngine.ts";
|
|
2
2
|
type EventCallback = (data: any) => void;
|
|
3
3
|
export declare class WebAudioEngine implements AudioEngine {
|
|
4
4
|
readonly playback: Playback;
|
|
@@ -7,8 +7,6 @@ export declare class WebAudioEngine implements AudioEngine {
|
|
|
7
7
|
private sourceNode;
|
|
8
8
|
private gainNode;
|
|
9
9
|
private listeners;
|
|
10
|
-
private currentVolume;
|
|
11
|
-
private currentPlaybackRate;
|
|
12
10
|
private isMutedValue;
|
|
13
11
|
private isPlayingValue;
|
|
14
12
|
private isPausedValue;
|
|
@@ -48,12 +46,6 @@ export declare class WebAudioEngine implements AudioEngine {
|
|
|
48
46
|
* @param callback - callback function to be removed.
|
|
49
47
|
*/
|
|
50
48
|
off(event: string, callback: EventCallback): void;
|
|
51
|
-
private deactivateWebAudio;
|
|
52
|
-
/**
|
|
53
|
-
* Sets the media element for playback.
|
|
54
|
-
* @param element The HTML audio element to use.
|
|
55
|
-
*/
|
|
56
|
-
setMediaElement(element: HTMLAudioElement): void;
|
|
57
49
|
private ensureAudioContextRunning;
|
|
58
50
|
private getOrCreateAudioContext;
|
|
59
51
|
private onTimeUpdate;
|
|
@@ -140,6 +132,20 @@ export declare class WebAudioEngine implements AudioEngine {
|
|
|
140
132
|
*/
|
|
141
133
|
private activateWebAudio;
|
|
142
134
|
get isWebAudioActive(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Tears down the Web Audio graph and restores the media element to standalone
|
|
137
|
+
* playback. Safe to call even if Web Audio was never activated.
|
|
138
|
+
*/
|
|
139
|
+
private tearDownWebAudio;
|
|
140
|
+
/**
|
|
141
|
+
* Changes the src of the primary media element without swapping the element.
|
|
142
|
+
* Preserves the RemotePlayback session and all attached event listeners.
|
|
143
|
+
* When the Web Audio graph is active, the new src is loaded with
|
|
144
|
+
* crossOrigin="anonymous". If the CORS request fails (server does not send
|
|
145
|
+
* the required headers), the graph is torn down and the src is reloaded
|
|
146
|
+
* without CORS so playback continues — just without pitch correction.
|
|
147
|
+
*/
|
|
148
|
+
changeSrc(href: string): void;
|
|
143
149
|
/**
|
|
144
150
|
* Returns the HTML media element used for playback.
|
|
145
151
|
*/
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './AudioEngine';
|
|
2
|
-
export * from './WebAudioEngine';
|
|
1
|
+
export * from './AudioEngine.ts';
|
|
2
|
+
export * from './WebAudioEngine.ts';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './engine';
|
|
2
|
-
export * from './preferences';
|
|
3
|
-
export * from './AudioNavigator';
|
|
1
|
+
export * from './engine/index.ts';
|
|
2
|
+
export * from './preferences/index.ts';
|
|
3
|
+
export * from './AudioNavigator.ts';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigurablePreferences } from "../../preferences/Configurable";
|
|
1
|
+
import { ConfigurablePreferences } from "../../preferences/Configurable.ts";
|
|
2
2
|
export interface IAudioPreferences {
|
|
3
3
|
volume?: number | null;
|
|
4
4
|
playbackRate?: number | null;
|
|
@@ -10,14 +10,14 @@ export interface IAudioPreferences {
|
|
|
10
10
|
enableMediaSession?: boolean | null;
|
|
11
11
|
}
|
|
12
12
|
export declare class AudioPreferences implements ConfigurablePreferences<AudioPreferences> {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
volume: number | null | undefined;
|
|
14
|
+
playbackRate: number | null | undefined;
|
|
15
|
+
preservePitch: boolean | null | undefined;
|
|
16
|
+
skipBackwardInterval: number | null | undefined;
|
|
17
|
+
skipForwardInterval: number | null | undefined;
|
|
18
|
+
pollInterval: number | null | undefined;
|
|
19
|
+
autoPlay: boolean | null | undefined;
|
|
20
|
+
enableMediaSession: boolean | null | undefined;
|
|
21
21
|
constructor(preferences?: IAudioPreferences);
|
|
22
22
|
merging(other: AudioPreferences): AudioPreferences;
|
|
23
23
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IPreferencesEditor } from "../../preferences/PreferencesEditor";
|
|
2
|
-
import { AudioPreferences } from "./AudioPreferences";
|
|
3
|
-
import { AudioSettings } from "./AudioSettings";
|
|
4
|
-
import { Preference, BooleanPreference, RangePreference } from "../../preferences/Preference";
|
|
1
|
+
import { IPreferencesEditor } from "../../preferences/PreferencesEditor.ts";
|
|
2
|
+
import { AudioPreferences } from "./AudioPreferences.ts";
|
|
3
|
+
import { AudioSettings } from "./AudioSettings.ts";
|
|
4
|
+
import { Preference, BooleanPreference, RangePreference } from "../../preferences/Preference.ts";
|
|
5
5
|
export declare class AudioPreferencesEditor implements IPreferencesEditor {
|
|
6
6
|
preferences: AudioPreferences;
|
|
7
7
|
private settings;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AudioPreferences } from "./AudioPreferences";
|
|
2
|
-
import { AudioDefaults } from "./AudioDefaults";
|
|
3
|
-
import { ConfigurableSettings } from "../../preferences/Configurable";
|
|
1
|
+
import { AudioPreferences } from "./AudioPreferences.ts";
|
|
2
|
+
import { AudioDefaults } from "./AudioDefaults.ts";
|
|
3
|
+
import { ConfigurableSettings } from "../../preferences/Configurable.ts";
|
|
4
4
|
export interface IAudioSettings extends ConfigurableSettings {
|
|
5
5
|
volume: number;
|
|
6
6
|
playbackRate: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './AudioPreferences';
|
|
2
|
-
export * from './AudioDefaults';
|
|
3
|
-
export * from './AudioSettings';
|
|
4
|
-
export * from './AudioPreferencesEditor';
|
|
1
|
+
export * from './AudioPreferences.ts';
|
|
2
|
+
export * from './AudioDefaults.ts';
|
|
3
|
+
export * from './AudioSettings.ts';
|
|
4
|
+
export * from './AudioPreferencesEditor.ts';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NavigatorProtector } from "../../protection/NavigatorProtector";
|
|
2
|
-
import { IContentProtectionConfig } from "../../Navigator";
|
|
1
|
+
import { NavigatorProtector } from "../../protection/NavigatorProtector.ts";
|
|
2
|
+
import { IContentProtectionConfig } from "../../Navigator.ts";
|
|
3
3
|
export declare class AudioNavigatorProtector extends NavigatorProtector {
|
|
4
4
|
private dragAndDropProtector?;
|
|
5
5
|
private copyProtector?;
|
package/types/src/css/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./Properties";
|
|
1
|
+
export * from "./Properties.ts";
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Layout, Link, Locator, Publication, ReadingProgression } from "@readium/shared";
|
|
2
|
-
import { Configurable, ConfigurableSettings, VisualNavigator, VisualNavigatorViewport } from "../";
|
|
3
|
-
import { FramePoolManager } from "./frame/FramePoolManager";
|
|
4
|
-
import { FXLFramePoolManager } from "./fxl/FXLFramePoolManager";
|
|
5
|
-
import { CommsEventKey, ContextMenuEvent, KeyboardEventData } from "@readium/navigator-html-injectables";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator";
|
|
2
|
+
import { Configurable, ConfigurableSettings, VisualNavigator, VisualNavigatorViewport } from "../index.ts";
|
|
3
|
+
import { FramePoolManager } from "./frame/FramePoolManager.ts";
|
|
4
|
+
import { FXLFramePoolManager } from "./fxl/FXLFramePoolManager.ts";
|
|
5
|
+
import { CommsEventKey, ContextMenuEvent, KeyboardEventData, BasicTextSelection, FrameClickEvent, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
|
|
6
|
+
import { FXLFrameManager } from "./fxl/FXLFrameManager.ts";
|
|
7
|
+
import { FrameManager } from "./frame/FrameManager.ts";
|
|
8
|
+
import { IEpubPreferences, EpubPreferences } from "./preferences/EpubPreferences.ts";
|
|
9
|
+
import { IEpubDefaults } from "./preferences/EpubDefaults.ts";
|
|
10
|
+
import { EpubSettings } from "./preferences/index.ts";
|
|
11
|
+
import { EpubPreferencesEditor } from "./preferences/EpubPreferencesEditor.ts";
|
|
12
|
+
import { IInjectablesConfig } from "../injection/Injectable.ts";
|
|
13
|
+
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
|
|
15
14
|
export type ManagerEventKey = "zoom";
|
|
16
15
|
export interface EpubNavigatorConfiguration {
|
|
17
16
|
preferences: IEpubPreferences;
|
|
@@ -50,7 +49,9 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
|
|
|
50
49
|
private _settings;
|
|
51
50
|
private _css;
|
|
52
51
|
private _preferencesEditor;
|
|
53
|
-
private
|
|
52
|
+
private _injector;
|
|
53
|
+
private readonly _readiumRulesPromise;
|
|
54
|
+
private readonly _injectablesConfig;
|
|
54
55
|
private readonly _contentProtection;
|
|
55
56
|
private readonly _keyboardPeripherals;
|
|
56
57
|
private readonly _navigatorProtector;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExperimentKey, TextAlignment } from "../../preferences/Types";
|
|
2
|
-
import { BodyHyphens, BoxSizing, FontOpticalSizing, FontWidth, Ligatures, Properties, TypeScale, View } from "../../css/Properties";
|
|
1
|
+
import { ExperimentKey, TextAlignment } from "../../preferences/Types.ts";
|
|
2
|
+
import { BodyHyphens, BoxSizing, FontOpticalSizing, FontWidth, Ligatures, Properties, TypeScale, View } from "../../css/Properties.ts";
|
|
3
3
|
export interface IUserProperties {
|
|
4
4
|
advancedSettings?: boolean | null;
|
|
5
5
|
a11yNormalize?: boolean | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LineLengths } from "../../helpers";
|
|
2
|
-
import { EpubSettings } from "../preferences/EpubSettings";
|
|
3
|
-
import { RSProperties, UserProperties } from "./Properties";
|
|
1
|
+
import { LineLengths } from "../../helpers/index.ts";
|
|
2
|
+
import { EpubSettings } from "../preferences/EpubSettings.ts";
|
|
3
|
+
import { RSProperties, UserProperties } from "./Properties.ts";
|
|
4
4
|
export interface IReadiumCSS {
|
|
5
5
|
rsProperties: RSProperties;
|
|
6
6
|
userProperties: UserProperties;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./Properties";
|
|
2
|
-
export * from "./ReadiumCSS";
|
|
1
|
+
export * from "./Properties.ts";
|
|
2
|
+
export * from "./ReadiumCSS.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CommsCommandKey, CommsAck, CommsEventKey } from "@readium/navigator-html-injectables";
|
|
2
|
-
import { ManagerEventKey } from "../EpubNavigator";
|
|
2
|
+
import { ManagerEventKey } from "../EpubNavigator.ts";
|
|
3
3
|
export type FrameCommsListener = (key: CommsEventKey | ManagerEventKey, value: unknown) => void;
|
|
4
4
|
export declare class FrameComms {
|
|
5
5
|
private readonly wnd;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Loader, ModuleName } from "@readium/navigator-html-injectables";
|
|
2
|
-
import { FrameComms } from "./FrameComms";
|
|
3
|
-
import type { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator";
|
|
2
|
+
import { FrameComms } from "./FrameComms.ts";
|
|
3
|
+
import type { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
|
|
4
4
|
export declare class FrameManager {
|
|
5
5
|
private frame;
|
|
6
6
|
private loader;
|
|
@@ -22,6 +22,7 @@ export declare class FrameManager {
|
|
|
22
22
|
}): void;
|
|
23
23
|
get iframe(): HTMLIFrameElement;
|
|
24
24
|
get realSize(): DOMRect;
|
|
25
|
+
get isDestroyed(): boolean;
|
|
25
26
|
get window(): Window;
|
|
26
27
|
get atLeft(): boolean;
|
|
27
28
|
get atRight(): boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModuleName } from "@readium/navigator-html-injectables";
|
|
2
2
|
import { Locator, Publication } from "@readium/shared";
|
|
3
|
-
import { FrameManager } from "./FrameManager";
|
|
4
|
-
import { Injector } from "../../injection/Injector";
|
|
5
|
-
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator";
|
|
3
|
+
import { FrameManager } from "./FrameManager.ts";
|
|
4
|
+
import { Injector } from "../../injection/Injector.ts";
|
|
5
|
+
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
|
|
6
6
|
export declare class FramePoolManager {
|
|
7
7
|
private readonly container;
|
|
8
8
|
private readonly positions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./FrameBlobBuilder";
|
|
2
|
-
export * from "./FrameComms";
|
|
3
|
-
export * from "./FrameManager";
|
|
4
|
-
export * from "./FramePoolManager";
|
|
1
|
+
export * from "./FrameBlobBuilder.ts";
|
|
2
|
+
export * from "./FrameComms.ts";
|
|
3
|
+
export * from "./FrameManager.ts";
|
|
4
|
+
export * from "./FramePoolManager.ts";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Loader, ModuleName } from "@readium/navigator-html-injectables";
|
|
2
2
|
import { Page, ReadingProgression } from "@readium/shared";
|
|
3
|
-
import { FrameComms } from "../frame/FrameComms";
|
|
4
|
-
import { FXLPeripherals } from "./FXLPeripherals";
|
|
5
|
-
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator";
|
|
3
|
+
import { FrameComms } from "../frame/FrameComms.ts";
|
|
4
|
+
import { FXLPeripherals } from "./FXLPeripherals.ts";
|
|
5
|
+
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
|
|
6
6
|
export declare class FXLFrameManager {
|
|
7
7
|
private frame;
|
|
8
8
|
private loader;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ModuleName } from "@readium/navigator-html-injectables";
|
|
2
2
|
import { Locator, Publication, Page, Link } from "@readium/shared";
|
|
3
|
-
import { FrameCommsListener } from "../frame";
|
|
4
|
-
import { FXLFrameManager } from "./FXLFrameManager";
|
|
5
|
-
import { FXLPeripherals } from "./FXLPeripherals";
|
|
6
|
-
import { VisualNavigatorViewport, IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator";
|
|
7
|
-
import { Injector } from "../../injection/Injector";
|
|
3
|
+
import { FrameCommsListener } from "../frame/index.ts";
|
|
4
|
+
import { FXLFrameManager } from "./FXLFrameManager.ts";
|
|
5
|
+
import { FXLPeripherals } from "./FXLPeripherals.ts";
|
|
6
|
+
import { VisualNavigatorViewport, IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
|
|
7
|
+
import { Injector } from "../../injection/Injector.ts";
|
|
8
8
|
export declare class FXLFramePoolManager {
|
|
9
9
|
private readonly container;
|
|
10
10
|
private readonly positions;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Point } from "./FXLCoordinator";
|
|
2
|
-
import { FXLFramePoolManager } from "./FXLFramePoolManager";
|
|
1
|
+
import { Point } from "./FXLCoordinator.ts";
|
|
2
|
+
import { FXLFramePoolManager } from "./FXLFramePoolManager.ts";
|
|
3
3
|
export interface PanTracker {
|
|
4
4
|
startX: number;
|
|
5
5
|
endX: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from "./FXLCoordinator";
|
|
2
|
-
export * from "./FXLFrameManager";
|
|
3
|
-
export * from "./FXLFramePoolManager";
|
|
4
|
-
export * from "./FXLPeripherals";
|
|
5
|
-
export * from "./FXLSpreader";
|
|
1
|
+
export * from "./FXLCoordinator.ts";
|
|
2
|
+
export * from "./FXLFrameManager.ts";
|
|
3
|
+
export * from "./FXLFramePoolManager.ts";
|
|
4
|
+
export * from "./FXLPeripherals.ts";
|
|
5
|
+
export * from "./FXLSpreader.ts";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Metadata } from "@readium/shared";
|
|
2
|
+
export type ScriptMode = 'ltr' | 'rtl' | 'cjk-horizontal' | 'cjk-vertical';
|
|
3
|
+
/**
|
|
4
|
+
* Derives the script mode from publication metadata.
|
|
5
|
+
*
|
|
6
|
+
* Rules:
|
|
7
|
+
* - Only the first language in the array is used. A Latin book containing
|
|
8
|
+
* some Japanese is still Latin.
|
|
9
|
+
* - For CJK (zh/ja/ko): both language AND explicit reading progression are
|
|
10
|
+
* required. CJK vertical = explicit rtl + CJK language. CJK horizontal =
|
|
11
|
+
* CJK language with ltr or unset progression.
|
|
12
|
+
* - For RTL (ar/fa/he): language wins. If the primary language is a RTL
|
|
13
|
+
* script, RTL mode is applied regardless of the explicit progression
|
|
14
|
+
* direction declared in the OPF.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getScriptMode(metadata: Metadata): ScriptMode;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export * from "./EpubNavigator";
|
|
2
|
-
export * from "./frame";
|
|
3
|
-
export * from "./fxl";
|
|
4
|
-
export * from "./preferences";
|
|
5
|
-
export * from "./css";
|
|
1
|
+
export * from "./EpubNavigator.ts";
|
|
2
|
+
export * from "./frame/index.ts";
|
|
3
|
+
export * from "./fxl/index.ts";
|
|
4
|
+
export * from "./preferences/index.ts";
|
|
5
|
+
export * from "./css/index.ts";
|
|
6
|
+
export { getScriptMode, type ScriptMode } from "./helpers/scriptMode.ts";
|