@d-i-t-a/reader 3.0.0-alpha.8 → 3.0.0-alpha.9
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/esm/index.js +576 -297
- package/dist/esm/index.js.map +4 -4
- package/dist/injectables/style/mo.css +42 -0
- package/dist/reader.js +51 -51
- package/dist/reader.js.map +4 -4
- package/dist/types/index.d.ts +4 -1
- package/dist/types/model/user-settings/UserSettings.d.ts +1 -1
- package/dist/types/model/v3/Publication.d.ts +1 -1
- package/dist/types/modules/AnnotationModule.d.ts +3 -3
- package/dist/types/modules/BookmarkModule.d.ts +3 -3
- package/dist/types/modules/TTS/TTSModule2.d.ts +2 -2
- package/dist/types/modules/TTS/TTSSettings.d.ts +1 -1
- package/dist/types/modules/citation/CitationModule.d.ts +2 -2
- package/dist/types/modules/consumption/ConsumptionModule.d.ts +2 -2
- package/dist/types/modules/highlight/TextHighlighter.d.ts +2 -2
- package/dist/types/modules/history/HistoryModule.d.ts +2 -2
- package/dist/types/modules/linefocus/LineFocusModule.d.ts +2 -2
- package/dist/types/modules/mediaoverlays/MediaOverlayModule.d.ts +3 -3
- package/dist/types/modules/pagebreak/PageBreakModule.d.ts +2 -2
- package/dist/types/modules/positions/TimelineModule.d.ts +2 -2
- package/dist/types/modules/protection/ContentProtectionModule.d.ts +2 -2
- package/dist/types/modules/sampleread/SampleReadEventHandler.d.ts +3 -3
- package/dist/types/modules/search/DefinitionsModule.d.ts +2 -2
- package/dist/types/modules/search/Popup.d.ts +3 -3
- package/dist/types/modules/search/SearchModule.d.ts +2 -2
- package/dist/types/navigator/{IFrameNavigator.d.ts → EpubNavigator.d.ts} +29 -9
- package/dist/types/navigator/Navigator.d.ts +8 -8
- package/dist/types/navigator/PDFNavigator.d.ts +6 -6
- package/dist/types/navigator/VisualNavigator.d.ts +91 -0
- package/dist/types/reader.d.ts +11 -11
- package/dist/types/utils/EventHandler.d.ts +3 -3
- package/dist/types/utils/KeyboardEventHandler.d.ts +3 -3
- package/dist/types/utils/TouchEventHandler.d.ts +3 -3
- package/dist/types/views/BookView.d.ts +14 -2
- package/dist/types/views/FixedBookView.d.ts +3 -3
- package/dist/types/views/ReflowableBookView.d.ts +3 -3
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ export { Link } from "./model/Link";
|
|
|
7
7
|
export { Locator, Locations, LocatorText, ReadingPosition, Bookmark, Annotation, AnnotationMarker, } from "./model/Locator";
|
|
8
8
|
export { ReaderEvent } from "./utils/Events";
|
|
9
9
|
export type { ReaderEventName, ReaderEventMap } from "./utils/Events";
|
|
10
|
-
export
|
|
10
|
+
export { NavigatorFeature } from "./navigator/VisualNavigator";
|
|
11
|
+
export type { NavigatorFeatureName } from "./navigator/VisualNavigator";
|
|
12
|
+
export { EpubNavigator, IFrameNavigator } from "./navigator/EpubNavigator";
|
|
13
|
+
export type { ReaderConfig, ReaderRights, NavigatorAPI, IFrameAttributes, Injectable, RequestConfig, SampleRead, PublicationServices, InitialAnnotations, EpubNavigatorConfig, IFrameNavigatorConfig, } from "./navigator/EpubNavigator";
|
|
11
14
|
export type { IUserSettings, InitialUserSettings, } from "./model/user-settings/UserSettings";
|
|
12
15
|
export type { UserSettingsIncrementable } from "./model/user-settings/UserProperties";
|
|
13
16
|
export type { LocalStorageStoreConfig } from "./store/LocalStorageStore";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Store from "../../store/Store";
|
|
2
2
|
import { UserProperties, UserProperty, UserSettingsIncrementable } from "./UserProperties";
|
|
3
|
-
import { Injectable, NavigatorAPI } from "../../navigator/
|
|
3
|
+
import { Injectable, NavigatorAPI } from "../../navigator/EpubNavigator";
|
|
4
4
|
import BookView from "../../views/BookView";
|
|
5
5
|
export interface UserSettingsConfig {
|
|
6
6
|
/** Store to save the user's selections in. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Manifest } from "@readium/shared";
|
|
2
2
|
import { Locator } from "./Locator";
|
|
3
3
|
import { Link } from "./Link";
|
|
4
|
-
import { GetContentBytesLength, RequestConfig, SampleRead } from "../../navigator/
|
|
4
|
+
import { GetContentBytesLength, RequestConfig, SampleRead } from "../../navigator/EpubNavigator";
|
|
5
5
|
/**
|
|
6
6
|
* R2D2BC Publication — wraps @readium/shared Manifest with
|
|
7
7
|
* all R2D2BC-specific extensions (positions, sample read, spine helpers).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Annotator from "../store/Annotator";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator, ReaderRights } from "../navigator/EpubNavigator";
|
|
3
3
|
import { Publication } from "../model/Publication";
|
|
4
4
|
import { TextHighlighter } from "./highlight/TextHighlighter";
|
|
5
5
|
import { ReaderModule } from "./ReaderModule";
|
|
@@ -23,7 +23,7 @@ export interface AnnotationModuleConfig extends AnnotationModuleProperties {
|
|
|
23
23
|
headerMenu?: HTMLElement | null;
|
|
24
24
|
rights: Partial<ReaderRights>;
|
|
25
25
|
publication: Publication;
|
|
26
|
-
initialAnnotations?: import("../navigator/
|
|
26
|
+
initialAnnotations?: import("../navigator/EpubNavigator").InitialAnnotations;
|
|
27
27
|
api?: AnnotationModuleAPI;
|
|
28
28
|
highlighter: TextHighlighter;
|
|
29
29
|
}
|
|
@@ -36,7 +36,7 @@ export declare class AnnotationModule implements ReaderModule {
|
|
|
36
36
|
private readonly headerMenu?;
|
|
37
37
|
private readonly highlighter?;
|
|
38
38
|
private readonly initialAnnotations?;
|
|
39
|
-
navigator:
|
|
39
|
+
navigator: EpubNavigator;
|
|
40
40
|
properties?: AnnotationModuleProperties;
|
|
41
41
|
api?: AnnotationModuleAPI;
|
|
42
42
|
activeAnnotationMarkerId?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Annotator from "../store/Annotator";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator, ReaderRights } from "../navigator/EpubNavigator";
|
|
3
3
|
import { Publication } from "../model/Publication";
|
|
4
4
|
import { ReaderModule } from "./ReaderModule";
|
|
5
5
|
import { Annotation, Bookmark } from "../model/Locator";
|
|
@@ -16,7 +16,7 @@ export interface BookmarkModuleConfig extends BookmarkModuleProperties {
|
|
|
16
16
|
headerMenu?: HTMLElement | null;
|
|
17
17
|
rights: Partial<ReaderRights>;
|
|
18
18
|
publication: Publication;
|
|
19
|
-
initialAnnotations?: import("../navigator/
|
|
19
|
+
initialAnnotations?: import("../navigator/EpubNavigator").InitialAnnotations;
|
|
20
20
|
properties?: BookmarkModuleProperties;
|
|
21
21
|
api?: BookmarkModuleAPI;
|
|
22
22
|
}
|
|
@@ -28,7 +28,7 @@ export declare class BookmarkModule implements ReaderModule {
|
|
|
28
28
|
private sideNavSectionBookmarks;
|
|
29
29
|
private readonly headerMenu?;
|
|
30
30
|
private readonly initialAnnotations?;
|
|
31
|
-
navigator:
|
|
31
|
+
navigator: EpubNavigator;
|
|
32
32
|
private readonly properties;
|
|
33
33
|
private readonly api?;
|
|
34
34
|
static create(config: BookmarkModuleConfig): Promise<any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReaderModule } from "../ReaderModule";
|
|
2
2
|
import { TTSModuleAPI, TTSModuleConfig, TTSModuleProperties, TTSSettings } from "./TTSSettings";
|
|
3
|
-
import {
|
|
3
|
+
import { EpubNavigator, ReaderRights } from "../../navigator/EpubNavigator";
|
|
4
4
|
import { TextHighlighter } from "../highlight/TextHighlighter";
|
|
5
5
|
import { IHighlight } from "../highlight/common/highlight";
|
|
6
6
|
import debounce from "debounce";
|
|
@@ -11,7 +11,7 @@ export declare class TTSModule2 implements ReaderModule {
|
|
|
11
11
|
private clean;
|
|
12
12
|
private rights;
|
|
13
13
|
private readonly highlighter;
|
|
14
|
-
navigator:
|
|
14
|
+
navigator: EpubNavigator;
|
|
15
15
|
private body;
|
|
16
16
|
private hasEventListener;
|
|
17
17
|
private readonly headerMenu?;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Store from "../../store/Store";
|
|
2
2
|
import { UserProperty, UserProperties } from "../../model/user-settings/UserProperties";
|
|
3
|
-
import { ReaderRights } from "../../navigator/
|
|
3
|
+
import { ReaderRights } from "../../navigator/EpubNavigator";
|
|
4
4
|
import { TextHighlighter } from "../highlight/TextHighlighter";
|
|
5
5
|
export interface TTSModuleAPI {
|
|
6
6
|
started: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Publication } from "../../model/Publication";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
3
3
|
import { ReaderModule } from "../ReaderModule";
|
|
4
4
|
import { TextHighlighter } from "../highlight/TextHighlighter";
|
|
5
5
|
export declare enum CitationStyle {
|
|
@@ -35,7 +35,7 @@ export interface CitationModuleConfig extends CitationModuleProperties {
|
|
|
35
35
|
}
|
|
36
36
|
export default class CitationModule implements ReaderModule {
|
|
37
37
|
private publication;
|
|
38
|
-
navigator:
|
|
38
|
+
navigator: EpubNavigator;
|
|
39
39
|
private properties;
|
|
40
40
|
private readonly highlighter?;
|
|
41
41
|
api?: CitationModuleAPI;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReaderModule } from "../ReaderModule";
|
|
2
2
|
import { Publication } from "../../model/Publication";
|
|
3
|
-
import {
|
|
3
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
4
4
|
import { Locator } from "../../model/Locator";
|
|
5
5
|
export declare enum Action {
|
|
6
6
|
BookmarkCreated = "BookmarkCreated",
|
|
@@ -32,7 +32,7 @@ export interface ConsumptionModuleConfig extends ConsumptionModuleProperties {
|
|
|
32
32
|
api?: ConsumptionModuleAPI;
|
|
33
33
|
}
|
|
34
34
|
export declare class ConsumptionModule implements ReaderModule {
|
|
35
|
-
navigator:
|
|
35
|
+
navigator: EpubNavigator;
|
|
36
36
|
private publication;
|
|
37
37
|
private properties;
|
|
38
38
|
api?: ConsumptionModuleAPI;
|
|
@@ -3,7 +3,7 @@ import { HighlightType, IHighlight, IMarkerIcon, IPopupStyle, IStyle, SelectionM
|
|
|
3
3
|
import { ISelectionInfo } from "./common/selection";
|
|
4
4
|
import { IRectSimple } from "./common/rect-utils";
|
|
5
5
|
import { AnnotationMarker } from "../../model/Locator";
|
|
6
|
-
import {
|
|
6
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
7
7
|
import { LayerSettings } from "./LayerSettings";
|
|
8
8
|
export declare enum HighlightContainer {
|
|
9
9
|
R2_ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER",
|
|
@@ -62,7 +62,7 @@ export interface TextHighlighterConfig extends TextHighlighterProperties {
|
|
|
62
62
|
}
|
|
63
63
|
export declare class TextHighlighter {
|
|
64
64
|
private options;
|
|
65
|
-
navigator:
|
|
65
|
+
navigator: EpubNavigator;
|
|
66
66
|
layerSettings: LayerSettings;
|
|
67
67
|
private lastSelectedHighlight?;
|
|
68
68
|
properties: TextHighlighterProperties;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
2
2
|
import { ReaderModule } from "../ReaderModule";
|
|
3
3
|
import { Locator } from "../../model/Locator";
|
|
4
4
|
import { Publication } from "../../model/Publication";
|
|
@@ -13,7 +13,7 @@ export interface HistoryModuleConfig extends HistoryModuleProperties {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class HistoryModule implements ReaderModule {
|
|
15
15
|
readonly annotator: Annotator | null;
|
|
16
|
-
navigator:
|
|
16
|
+
navigator: EpubNavigator;
|
|
17
17
|
private readonly headerMenu?;
|
|
18
18
|
private publication;
|
|
19
19
|
private properties;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Publication } from "../../model/Publication";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
3
3
|
import { ReaderModule } from "../ReaderModule";
|
|
4
4
|
import { TextHighlighter } from "../highlight/TextHighlighter";
|
|
5
5
|
export interface LineFocusModuleAPI {
|
|
@@ -17,7 +17,7 @@ export interface LineFocusModuleConfig extends LineFocusModuleProperties {
|
|
|
17
17
|
export default class LineFocusModule implements ReaderModule {
|
|
18
18
|
properties: LineFocusModuleProperties;
|
|
19
19
|
api?: LineFocusModuleAPI;
|
|
20
|
-
navigator:
|
|
20
|
+
navigator: EpubNavigator;
|
|
21
21
|
private highlighter;
|
|
22
22
|
private hasEventListener;
|
|
23
23
|
lines: Array<HTMLElement>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Publication } from "../../model/Publication";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
3
3
|
import { ReaderModule } from "../ReaderModule";
|
|
4
4
|
import { Link } from "../../model/Link";
|
|
5
5
|
import { MediaOverlayNode } from "../../model/v3/MediaOverlayNode";
|
|
@@ -28,7 +28,7 @@ export interface MediaOverlayModuleConfig extends MediaOverlayModuleProperties {
|
|
|
28
28
|
}
|
|
29
29
|
export declare class MediaOverlayModule implements ReaderModule {
|
|
30
30
|
private publication;
|
|
31
|
-
navigator:
|
|
31
|
+
navigator: EpubNavigator;
|
|
32
32
|
private audioElement;
|
|
33
33
|
settings: MediaOverlaySettings;
|
|
34
34
|
private properties;
|
|
@@ -54,7 +54,7 @@ export declare class MediaOverlayModule implements ReaderModule {
|
|
|
54
54
|
initialize(): Promise<void>;
|
|
55
55
|
initializeResource(links: Array<Link | undefined>): Promise<void>;
|
|
56
56
|
private playLink;
|
|
57
|
-
|
|
57
|
+
bindClickHandler(): void;
|
|
58
58
|
private unbindClickHandler;
|
|
59
59
|
private handleContentClick;
|
|
60
60
|
startReadAloud(): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
2
2
|
import { ReaderModule } from "../ReaderModule";
|
|
3
3
|
import { IHighlight } from "../highlight/common/highlight";
|
|
4
4
|
import { ISelectionInfo } from "../highlight/common/selection";
|
|
@@ -11,7 +11,7 @@ export interface PageBreakModuleConfig extends PageBreakModuleProperties {
|
|
|
11
11
|
publication: Publication;
|
|
12
12
|
}
|
|
13
13
|
export declare class PageBreakModule implements ReaderModule {
|
|
14
|
-
navigator:
|
|
14
|
+
navigator: EpubNavigator;
|
|
15
15
|
private readonly headerMenu?;
|
|
16
16
|
private publication;
|
|
17
17
|
private properties;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Publication } from "../../model/Publication";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
3
3
|
import { ReaderModule } from "../ReaderModule";
|
|
4
4
|
export interface TimelineModuleConfig {
|
|
5
5
|
publication: Publication;
|
|
6
6
|
}
|
|
7
7
|
export declare class TimelineModule implements ReaderModule {
|
|
8
8
|
private publication;
|
|
9
|
-
navigator:
|
|
9
|
+
navigator: EpubNavigator;
|
|
10
10
|
private timelineContainer;
|
|
11
11
|
private positionSlider;
|
|
12
12
|
static create(config: TimelineModuleConfig): Promise<TimelineModule>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReaderModule } from "../ReaderModule";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
3
3
|
export interface ContentProtectionModuleProperties {
|
|
4
4
|
enforceSupportedBrowsers: boolean;
|
|
5
5
|
enableEncryption: boolean;
|
|
@@ -36,7 +36,7 @@ interface ContentProtectionRect {
|
|
|
36
36
|
}
|
|
37
37
|
export declare class ContentProtectionModule implements ReaderModule {
|
|
38
38
|
private rects;
|
|
39
|
-
navigator:
|
|
39
|
+
navigator: EpubNavigator;
|
|
40
40
|
properties?: ContentProtectionModuleProperties;
|
|
41
41
|
private hasEventListener;
|
|
42
42
|
private isHacked;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import debounce from "debounce";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
3
3
|
export default class SampleReadEventHandler {
|
|
4
|
-
navigator:
|
|
5
|
-
constructor(navigator:
|
|
4
|
+
navigator: EpubNavigator;
|
|
5
|
+
constructor(navigator: EpubNavigator);
|
|
6
6
|
enforceSampleRead: debounce.DebouncedFunction<(position: any) => void>;
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
2
2
|
import { ReaderModule } from "../ReaderModule";
|
|
3
3
|
import { TextHighlighter } from "../highlight/TextHighlighter";
|
|
4
4
|
import { IHighlight } from "../highlight/common/highlight";
|
|
@@ -31,7 +31,7 @@ export declare class DefinitionsModule implements ReaderModule {
|
|
|
31
31
|
properties: DefinitionsModuleProperties;
|
|
32
32
|
api?: DefinitionsModuleAPI;
|
|
33
33
|
private publication;
|
|
34
|
-
navigator:
|
|
34
|
+
navigator: EpubNavigator;
|
|
35
35
|
private currentChapterPopupResult;
|
|
36
36
|
private currentPopupHighlights;
|
|
37
37
|
private highlighter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
2
2
|
export declare class Popup {
|
|
3
|
-
navigator:
|
|
4
|
-
constructor(navigator:
|
|
3
|
+
navigator: EpubNavigator;
|
|
4
|
+
constructor(navigator: EpubNavigator);
|
|
5
5
|
handleFootnote(link: HTMLLIElement, event: MouseEvent | TouchEvent): Promise<void>;
|
|
6
6
|
hidePopover(): Promise<void>;
|
|
7
7
|
showPopover(link: HTMLElement, event: MouseEvent | TouchEvent): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Publication } from "../../model/Publication";
|
|
2
|
-
import {
|
|
2
|
+
import { EpubNavigator } from "../../navigator/EpubNavigator";
|
|
3
3
|
import { ReaderModule } from "../ReaderModule";
|
|
4
4
|
import { TextHighlighter } from "../highlight/TextHighlighter";
|
|
5
5
|
import { IHighlight } from "../highlight/common/highlight";
|
|
@@ -22,7 +22,7 @@ export declare class SearchModule implements ReaderModule {
|
|
|
22
22
|
private api?;
|
|
23
23
|
private publication;
|
|
24
24
|
private readonly headerMenu?;
|
|
25
|
-
navigator:
|
|
25
|
+
navigator: EpubNavigator;
|
|
26
26
|
private searchInput;
|
|
27
27
|
private searchGo;
|
|
28
28
|
private currentChapterSearchResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { VisualNavigator, NavigatorFeatureName } from "./VisualNavigator";
|
|
2
2
|
import Annotator from "../store/Annotator";
|
|
3
|
-
import { Publication } from "../model/
|
|
4
|
-
import { Locator, ReadingPosition } from "../model/
|
|
3
|
+
import { Publication } from "../model/v3";
|
|
4
|
+
import { Locator, ReadingPosition } from "../model/v3";
|
|
5
5
|
import { UserSettings, UserSettingsUIConfig } from "../model/user-settings/UserSettings";
|
|
6
6
|
import { BookmarkModule, BookmarkModuleConfig } from "../modules/BookmarkModule";
|
|
7
7
|
import { AnnotationModule, AnnotationModuleConfig } from "../modules/AnnotationModule";
|
|
@@ -12,12 +12,11 @@ import { TimelineModule } from "../modules/positions/TimelineModule";
|
|
|
12
12
|
import debounce from "debounce";
|
|
13
13
|
import BookView from "../views/BookView";
|
|
14
14
|
import { MediaOverlayModule, MediaOverlayModuleConfig } from "../modules/mediaoverlays/MediaOverlayModule";
|
|
15
|
-
import { D2Link, Link } from "../model/
|
|
15
|
+
import { D2Link, Link } from "../model/v3";
|
|
16
16
|
import { ReaderModule } from "../modules/ReaderModule";
|
|
17
17
|
import { TTSModuleConfig } from "../modules/TTS/TTSSettings";
|
|
18
18
|
import { PageBreakModule, PageBreakModuleConfig } from "../modules/pagebreak/PageBreakModule";
|
|
19
19
|
import { DefinitionsModule, DefinitionsModuleConfig } from "../modules/search/DefinitionsModule";
|
|
20
|
-
import EventEmitter from "eventemitter3";
|
|
21
20
|
import LineFocusModule, { LineFocusModuleConfig } from "../modules/linefocus/LineFocusModule";
|
|
22
21
|
import { HistoryModule } from "../modules/history/HistoryModule";
|
|
23
22
|
import CitationModule, { CitationModuleConfig } from "../modules/citation/CitationModule";
|
|
@@ -54,7 +53,7 @@ export interface IFrameAttributes {
|
|
|
54
53
|
/** Whether to show a drop shadow on fixed-layout spreads. Defaults to true. */
|
|
55
54
|
fixedLayoutShadow?: boolean;
|
|
56
55
|
}
|
|
57
|
-
export interface
|
|
56
|
+
export interface EpubNavigatorConfig {
|
|
58
57
|
mainElement: HTMLElement;
|
|
59
58
|
headerMenu?: HTMLElement | null;
|
|
60
59
|
footerMenu?: HTMLElement | null;
|
|
@@ -158,8 +157,8 @@ export interface ReaderConfig {
|
|
|
158
157
|
*/
|
|
159
158
|
workerSrc?: string;
|
|
160
159
|
}
|
|
161
|
-
/**
|
|
162
|
-
export declare class
|
|
160
|
+
/** EPUB navigator — renders spine items in iframes with navigation controls. */
|
|
161
|
+
export declare class EpubNavigator extends VisualNavigator {
|
|
163
162
|
iframes: Array<HTMLIFrameElement>;
|
|
164
163
|
currentTocUrl: string | undefined;
|
|
165
164
|
headerMenu?: HTMLElement | null;
|
|
@@ -179,6 +178,19 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
179
178
|
historyModule?: HistoryModule;
|
|
180
179
|
citationModule?: CitationModule;
|
|
181
180
|
consumptionModule?: ConsumptionModule;
|
|
181
|
+
supports(feature: NavigatorFeatureName): boolean;
|
|
182
|
+
private fxlZoomKeyHandler;
|
|
183
|
+
private getFxlCurrentScale;
|
|
184
|
+
fitToPage(): void;
|
|
185
|
+
zoomIn(): void;
|
|
186
|
+
zoomOut(): void;
|
|
187
|
+
private setFxlScale;
|
|
188
|
+
private updateFxlZoomContainer;
|
|
189
|
+
private fxlPanOverlay;
|
|
190
|
+
private fxlHandTool;
|
|
191
|
+
private setupFxlPan;
|
|
192
|
+
activateHand(): void;
|
|
193
|
+
deactivateHand(): void;
|
|
182
194
|
sideNavExpanded: boolean;
|
|
183
195
|
currentChapterLink: D2Link;
|
|
184
196
|
currentSpreadLinks: {
|
|
@@ -234,11 +246,15 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
234
246
|
sample?: SampleRead;
|
|
235
247
|
requestConfig?: RequestConfig;
|
|
236
248
|
private didInitKeyboardEventHandler;
|
|
237
|
-
static create(config:
|
|
249
|
+
static create(config: EpubNavigatorConfig): Promise<EpubNavigator>;
|
|
238
250
|
protected constructor(settings: UserSettings, annotator: Annotator | undefined, initialLastReadingPosition: ReadingPosition | undefined, publication: Publication, api?: Partial<NavigatorAPI>, rights?: Partial<ReaderRights>, tts?: Partial<TTSModuleConfig>, injectables?: Array<Injectable>, attributes?: IFrameAttributes, services?: PublicationServices, sample?: SampleRead, requestConfig?: RequestConfig, highlighter?: TextHighlighter, modules?: Array<ReaderModule | undefined>);
|
|
239
251
|
stop(): void;
|
|
240
252
|
spreads: HTMLDivElement;
|
|
241
253
|
firstSpread: HTMLDivElement;
|
|
254
|
+
private fxlScrollContainer;
|
|
255
|
+
private fxlZoomContainer;
|
|
256
|
+
private fxlContentWidth;
|
|
257
|
+
private fxlContentHeight;
|
|
242
258
|
setDirection(direction?: string | null): void;
|
|
243
259
|
protected start(mainElement: HTMLElement, headerMenu?: HTMLElement | null, footerMenu?: HTMLElement | null): Promise<void>;
|
|
244
260
|
timeout: any;
|
|
@@ -316,3 +332,7 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
316
332
|
showLayer(layer: any): void;
|
|
317
333
|
hideLayer(layer: any): void;
|
|
318
334
|
}
|
|
335
|
+
/** @deprecated Use EpubNavigator */
|
|
336
|
+
export declare const IFrameNavigator: typeof EpubNavigator;
|
|
337
|
+
/** @deprecated Use EpubNavigatorConfig */
|
|
338
|
+
export type IFrameNavigatorConfig = EpubNavigatorConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Locator } from "../model/Locator";
|
|
2
|
-
import { IFrameAttributes } from "./
|
|
2
|
+
import { IFrameAttributes } from "./EpubNavigator";
|
|
3
3
|
import { Publication } from "../model/Publication";
|
|
4
4
|
import { Link } from "../model/Link";
|
|
5
5
|
interface Navigator {
|
|
@@ -29,13 +29,13 @@ interface Navigator {
|
|
|
29
29
|
totalResources(): number;
|
|
30
30
|
currentLocator(): Locator;
|
|
31
31
|
positions(): Locator[];
|
|
32
|
-
goTo(locator: Locator): void
|
|
33
|
-
goToPosition(value: number): void
|
|
34
|
-
goToPage(page: number): void
|
|
35
|
-
nextResource(): void
|
|
36
|
-
previousResource(): void
|
|
37
|
-
nextPage(): void
|
|
38
|
-
previousPage(): void
|
|
32
|
+
goTo(locator: Locator): void | Promise<void>;
|
|
33
|
+
goToPosition(value: number): void | Promise<void>;
|
|
34
|
+
goToPage(page: number): void | Promise<void>;
|
|
35
|
+
nextResource(): void | Promise<void>;
|
|
36
|
+
previousResource(): void | Promise<void>;
|
|
37
|
+
nextPage(): void | Promise<void>;
|
|
38
|
+
previousPage(): void | Promise<void>;
|
|
39
39
|
atStart?(): boolean;
|
|
40
40
|
atEnd?(): boolean;
|
|
41
41
|
snapToSelector?(selector: string): void;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Navigator from "./Navigator";
|
|
1
|
+
import { VisualNavigator, NavigatorFeatureName } from "./VisualNavigator";
|
|
3
2
|
import { UserSettings } from "../model/user-settings/UserSettings";
|
|
4
|
-
import { Publication } from "../model/
|
|
5
|
-
import { Bookmark, Locator, ReadingPosition } from "../model/
|
|
3
|
+
import { Publication } from "../model/v3";
|
|
4
|
+
import { Bookmark, Locator, ReadingPosition } from "../model/v3";
|
|
6
5
|
import Annotator from "../store/Annotator";
|
|
7
6
|
import Store from "../store/Store";
|
|
8
7
|
import { AnnotationEditorType } from "pdfjs-dist";
|
|
9
8
|
import { EventBus, ScrollMode, SpreadMode } from "pdfjs-dist/web/pdf_viewer.mjs";
|
|
10
|
-
import { NavigatorAPI } from "./
|
|
9
|
+
import { NavigatorAPI } from "./EpubNavigator";
|
|
11
10
|
export { SpreadMode, ScrollMode, AnnotationEditorType };
|
|
12
11
|
export interface PDFNavigatorConfig {
|
|
13
12
|
mainElement: HTMLElement;
|
|
@@ -37,10 +36,11 @@ export declare enum ScaleType {
|
|
|
37
36
|
Page = 0,
|
|
38
37
|
Width = 1
|
|
39
38
|
}
|
|
40
|
-
export declare class PDFNavigator extends
|
|
39
|
+
export declare class PDFNavigator extends VisualNavigator {
|
|
41
40
|
readonly isPDF = true;
|
|
42
41
|
settings: UserSettings;
|
|
43
42
|
publication: Publication;
|
|
43
|
+
supports(feature: NavigatorFeatureName): boolean;
|
|
44
44
|
headerMenu?: HTMLElement | null;
|
|
45
45
|
footerMenu?: HTMLElement | null;
|
|
46
46
|
mainElement: HTMLElement;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import EventEmitter from "eventemitter3";
|
|
2
|
+
import Navigator from "./Navigator";
|
|
3
|
+
import { Locator } from "../model/v3";
|
|
4
|
+
import { Publication } from "../model/v3";
|
|
5
|
+
import { Link } from "../model/v3";
|
|
6
|
+
import { IFrameAttributes } from "./EpubNavigator";
|
|
7
|
+
/**
|
|
8
|
+
* Typed feature names for navigator capability queries.
|
|
9
|
+
*/
|
|
10
|
+
export declare const NavigatorFeature: {
|
|
11
|
+
readonly TTS: "tts";
|
|
12
|
+
readonly MediaOverlays: "mediaOverlays";
|
|
13
|
+
readonly Search: "search";
|
|
14
|
+
readonly Annotations: "annotations";
|
|
15
|
+
readonly Bookmarks: "bookmarks";
|
|
16
|
+
readonly Zoom: "zoom";
|
|
17
|
+
readonly LineFocus: "lineFocus";
|
|
18
|
+
readonly Definitions: "definitions";
|
|
19
|
+
readonly Citations: "citations";
|
|
20
|
+
readonly ContentProtection: "contentProtection";
|
|
21
|
+
readonly Consumption: "consumption";
|
|
22
|
+
readonly History: "history";
|
|
23
|
+
readonly Timeline: "timeline";
|
|
24
|
+
};
|
|
25
|
+
export type NavigatorFeatureName = (typeof NavigatorFeature)[keyof typeof NavigatorFeature];
|
|
26
|
+
/**
|
|
27
|
+
* Abstract base class for all visual navigators.
|
|
28
|
+
*
|
|
29
|
+
* Extends EventEmitter for the event system.
|
|
30
|
+
* Implements the Navigator interface for backwards compatibility.
|
|
31
|
+
*
|
|
32
|
+
* Subclasses: EpubNavigator (reflowable + FXL), PDFNavigator (PDF.js),
|
|
33
|
+
* and future navigators (AudiobookNavigator, DiViNaNavigator).
|
|
34
|
+
*/
|
|
35
|
+
export declare abstract class VisualNavigator extends EventEmitter implements Navigator {
|
|
36
|
+
abstract publication: Publication;
|
|
37
|
+
abstract currentLocator(): Locator;
|
|
38
|
+
abstract positions(): Locator[];
|
|
39
|
+
abstract currentResource(): number | undefined;
|
|
40
|
+
abstract totalResources(): number;
|
|
41
|
+
abstract goTo(locator: Locator): void | Promise<void>;
|
|
42
|
+
abstract goToPosition(value: number): void | Promise<void>;
|
|
43
|
+
abstract goToPage(page: number): void | Promise<void>;
|
|
44
|
+
abstract nextPage(): void | Promise<void>;
|
|
45
|
+
abstract previousPage(): void | Promise<void>;
|
|
46
|
+
abstract nextResource(): void | Promise<void>;
|
|
47
|
+
abstract previousResource(): void | Promise<void>;
|
|
48
|
+
abstract atStart(): boolean;
|
|
49
|
+
abstract atEnd(): boolean;
|
|
50
|
+
abstract tableOfContents(): Link[];
|
|
51
|
+
abstract landmarks(): Link[];
|
|
52
|
+
abstract pageList(): Link[];
|
|
53
|
+
abstract readingOrder(): Link[];
|
|
54
|
+
abstract stop(): void;
|
|
55
|
+
/**
|
|
56
|
+
* Check if this navigator supports a given feature.
|
|
57
|
+
* Replaces instanceof checks in D2Reader.
|
|
58
|
+
*/
|
|
59
|
+
supports(_feature: NavigatorFeatureName): boolean;
|
|
60
|
+
startReadAloud(): void;
|
|
61
|
+
stopReadAloud(): void;
|
|
62
|
+
pauseReadAloud(): void;
|
|
63
|
+
resumeReadAloud(): void;
|
|
64
|
+
startReadAlong(): void;
|
|
65
|
+
stopReadAlong(): void;
|
|
66
|
+
pauseReadAlong(): void;
|
|
67
|
+
resumeReadAlong(): void;
|
|
68
|
+
hideLayer(_layer: string): void;
|
|
69
|
+
showLayer(_layer: string): void;
|
|
70
|
+
activateMarker(_id: string, _position: string): void;
|
|
71
|
+
deactivateMarker(): void;
|
|
72
|
+
snapToSelector?(_selector: string): void;
|
|
73
|
+
applyAttributes?(_value: IFrameAttributes): void;
|
|
74
|
+
mostRecentNavigatedTocItem?(): string | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Navigate left — respects reading progression direction.
|
|
77
|
+
* In LTR: goes to previous page. In RTL: goes to next page.
|
|
78
|
+
*/
|
|
79
|
+
goLeft(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Navigate right — respects reading progression direction.
|
|
82
|
+
* In LTR: goes to next page. In RTL: goes to previous page.
|
|
83
|
+
*/
|
|
84
|
+
goRight(): void;
|
|
85
|
+
fitToPage(): void;
|
|
86
|
+
fitToWidth(): void;
|
|
87
|
+
zoomIn(): void;
|
|
88
|
+
zoomOut(): void;
|
|
89
|
+
activateHand(): void;
|
|
90
|
+
deactivateHand(): void;
|
|
91
|
+
}
|
package/dist/types/reader.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { UserSettingsIncrementable } from "./model/user-settings/UserProperties"
|
|
|
3
3
|
import { UserSettings } from "./model/user-settings/UserSettings";
|
|
4
4
|
import { IMediaOverlayUserSettings, MediaOverlayIncrementable } from "./modules/mediaoverlays/MediaOverlaySettings";
|
|
5
5
|
import { ITTSUserSettings, TTSIncrementable } from "./modules/TTS/TTSSettings";
|
|
6
|
-
import { IFrameAttributes, ReaderConfig } from "./navigator/
|
|
6
|
+
import { IFrameAttributes, ReaderConfig } from "./navigator/EpubNavigator";
|
|
7
7
|
/**
|
|
8
8
|
* A class that, once instantiated using the public `.build` method,
|
|
9
9
|
* is the primary interface into the D2 Reader.
|
|
@@ -44,11 +44,11 @@ export default class D2Reader {
|
|
|
44
44
|
*/
|
|
45
45
|
/** Start TTS Read Aloud */
|
|
46
46
|
startReadAloud: () => void;
|
|
47
|
-
/**
|
|
47
|
+
/** Stop TTS Read Aloud */
|
|
48
48
|
stopReadAloud: () => void;
|
|
49
|
-
/**
|
|
49
|
+
/** Pause TTS Read Aloud */
|
|
50
50
|
pauseReadAloud: () => void;
|
|
51
|
-
/**
|
|
51
|
+
/** Resume TTS Read Aloud */
|
|
52
52
|
resumeReadAloud: () => void;
|
|
53
53
|
/**
|
|
54
54
|
* Read Along
|
|
@@ -90,14 +90,14 @@ export default class D2Reader {
|
|
|
90
90
|
/** Show Annotation Layer */
|
|
91
91
|
showAnnotationLayer: () => void | undefined;
|
|
92
92
|
/** Hide Layer */
|
|
93
|
-
hideLayer: (layer: any) =>
|
|
93
|
+
hideLayer: (layer: any) => void;
|
|
94
94
|
/** Show Layer */
|
|
95
|
-
showLayer: (layer: any) =>
|
|
95
|
+
showLayer: (layer: any) => void;
|
|
96
96
|
/** Activate Marker <br>
|
|
97
97
|
* Activated Marker will be used for active annotation creation */
|
|
98
|
-
activateMarker: (id: string, position: string) =>
|
|
98
|
+
activateMarker: (id: string, position: string) => void;
|
|
99
99
|
/** Deactivate Marker */
|
|
100
|
-
deactivateMarker: () =>
|
|
100
|
+
deactivateMarker: () => void;
|
|
101
101
|
/**
|
|
102
102
|
* Definitions
|
|
103
103
|
*/
|
|
@@ -140,7 +140,7 @@ export default class D2Reader {
|
|
|
140
140
|
* Resources
|
|
141
141
|
*/
|
|
142
142
|
get currentResource(): number | undefined;
|
|
143
|
-
get mostRecentNavigatedTocItem(): string |
|
|
143
|
+
get mostRecentNavigatedTocItem(): string | undefined;
|
|
144
144
|
get totalResources(): number;
|
|
145
145
|
get publicationLanguage(): string[] | undefined;
|
|
146
146
|
/**
|
|
@@ -170,7 +170,7 @@ export default class D2Reader {
|
|
|
170
170
|
scroll: (value: boolean, direction?: string) => Promise<void>;
|
|
171
171
|
private isTTSIncrementable;
|
|
172
172
|
private isMOIncrementable;
|
|
173
|
-
|
|
173
|
+
/**
|
|
174
174
|
* Used to increase anything that can be increased,
|
|
175
175
|
* such as pitch, rate, volume, fontSize
|
|
176
176
|
*/
|
|
@@ -203,7 +203,7 @@ export default class D2Reader {
|
|
|
203
203
|
* @TODO : These should return promises that complete when they are done.
|
|
204
204
|
*/
|
|
205
205
|
get currentLocator(): Locator;
|
|
206
|
-
get positions():
|
|
206
|
+
get positions(): Locator[];
|
|
207
207
|
goTo: (locator: Locator) => Promise<void>;
|
|
208
208
|
goToPosition: (value: number) => Promise<void>;
|
|
209
209
|
goToPage: (page: number) => Promise<void>;
|