@d-i-t-a/reader 2.0.0-beta.1 → 2.0.0-beta.10
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 +39240 -35383
- package/dist/esm/index.js.map +3 -3
- package/dist/injectables/style/linefocus.css +55 -0
- package/dist/injectables/style/popup.css +121 -0
- package/dist/injectables/style/style.css +25 -1
- package/dist/reader.css +1 -1
- package/dist/reader.js +50 -50
- package/dist/reader.js.map +3 -3
- package/dist/reader.map.css +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/model/Link.d.ts +1 -1
- package/dist/types/model/Publication.d.ts +12 -12
- package/dist/types/model/user-settings/UserProperties.d.ts +3 -2
- package/dist/types/model/user-settings/UserSettings.d.ts +6 -6
- package/dist/types/modules/AnnotationModule.d.ts +16 -14
- package/dist/types/modules/BookmarkModule.d.ts +14 -14
- package/dist/types/modules/ReaderModule.d.ts +1 -2
- package/dist/types/modules/TTS/TTSModule.d.ts +7 -7
- package/dist/types/modules/TTS/TTSModule2.d.ts +8 -8
- package/dist/types/modules/TTS/TTSSettings.d.ts +16 -16
- package/dist/types/modules/highlight/LayerSettings.d.ts +19 -0
- package/dist/types/modules/highlight/TextHighlighter.d.ts +43 -59
- package/dist/types/modules/highlight/common/highlight.d.ts +6 -2
- package/dist/types/modules/highlight/common/selection.d.ts +3 -3
- package/dist/types/modules/highlight/renderer/iframe/selection.d.ts +2 -2
- package/dist/types/modules/highlight/renderer/iframe/state.d.ts +0 -3
- package/dist/types/modules/linefocus/LineFocusModule.d.ts +45 -0
- package/dist/types/modules/mediaoverlays/MediaOverlayModule.d.ts +19 -14
- package/dist/types/modules/mediaoverlays/MediaOverlaySettings.d.ts +20 -17
- package/dist/types/modules/pagebreak/PageBreakModule.d.ts +14 -7
- package/dist/types/modules/positions/TimelineModule.d.ts +4 -4
- package/dist/types/modules/protection/ContentProtectionModule.d.ts +6 -6
- package/dist/types/modules/sampleread/SampleReadEventHandler.d.ts +1 -1
- package/dist/types/modules/search/DefinitionsModule.d.ts +52 -0
- package/dist/types/modules/search/Popup.d.ts +8 -0
- package/dist/types/modules/search/SearchModule.d.ts +17 -13
- package/dist/types/modules/search/searchWithDomSeek.d.ts +1 -1
- package/dist/types/navigator/IFrameNavigator.d.ts +62 -43
- package/dist/types/reader.d.ts +96 -55
- package/dist/types/store/Annotator.d.ts +16 -17
- package/dist/types/store/LocalAnnotator.d.ts +16 -17
- package/dist/types/store/LocalStorageStore.d.ts +3 -3
- package/dist/types/store/MemoryStore.d.ts +3 -3
- package/dist/types/store/Store.d.ts +3 -3
- package/dist/types/utils/EventHandler.d.ts +12 -0
- package/dist/types/utils/HTMLUtilities.d.ts +3 -3
- package/dist/types/utils/IconLib.d.ts +1 -1
- package/dist/types/utils/KeyboardEventHandler.d.ts +2 -2
- package/dist/types/utils/TouchEventHandler.d.ts +1 -1
- package/dist/types/views/BookView.d.ts +8 -7
- package/dist/types/views/FixedBookView.d.ts +6 -3
- package/dist/types/views/ReflowableBookView.d.ts +2 -2
- package/package.json +14 -7
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import Publication from "../../model/Publication";
|
|
2
|
-
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
3
|
-
import ReaderModule from "../ReaderModule";
|
|
4
|
-
import
|
|
1
|
+
import { Publication } from "../../model/Publication";
|
|
2
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
3
|
+
import { ReaderModule } from "../ReaderModule";
|
|
4
|
+
import { IHighlight } from "../highlight/common/highlight";
|
|
5
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
6
|
+
import { TextHighlighter } from "../highlight/TextHighlighter";
|
|
5
7
|
export interface SearchModuleAPI {
|
|
6
8
|
}
|
|
7
9
|
export interface SearchModuleProperties {
|
|
8
10
|
color?: string;
|
|
9
11
|
current?: string;
|
|
12
|
+
hideLayer?: boolean;
|
|
10
13
|
}
|
|
11
14
|
export interface SearchModuleConfig extends SearchModuleProperties {
|
|
12
15
|
api?: SearchModuleAPI;
|
|
13
16
|
publication: Publication;
|
|
14
|
-
headerMenu
|
|
17
|
+
headerMenu?: HTMLElement | null;
|
|
15
18
|
delegate: IFrameNavigator;
|
|
16
19
|
highlighter: TextHighlighter;
|
|
17
20
|
}
|
|
18
|
-
export
|
|
21
|
+
export declare class SearchModule implements ReaderModule {
|
|
19
22
|
private properties;
|
|
20
|
-
private api
|
|
23
|
+
private api?;
|
|
21
24
|
private publication;
|
|
22
|
-
private readonly headerMenu
|
|
25
|
+
private readonly headerMenu?;
|
|
23
26
|
private delegate;
|
|
24
27
|
private searchInput;
|
|
25
28
|
private searchGo;
|
|
26
29
|
private currentChapterSearchResult;
|
|
27
30
|
private bookSearchResult;
|
|
28
|
-
private
|
|
29
|
-
private highlighter
|
|
31
|
+
private currentSearchHighlights;
|
|
32
|
+
private highlighter?;
|
|
30
33
|
static create(config: SearchModuleConfig): Promise<SearchModule>;
|
|
31
34
|
private constructor();
|
|
32
35
|
stop(): Promise<void>;
|
|
33
36
|
protected start(): Promise<void>;
|
|
34
37
|
private handleSearch;
|
|
35
38
|
handleSearchChapter(index?: number): Promise<void>;
|
|
36
|
-
searchAndPaintChapter(term: string, index: number, callback: (result: any) => any): Promise<void>;
|
|
39
|
+
searchAndPaintChapter(term: string, index: number | undefined, callback: (result: any) => any): Promise<void>;
|
|
40
|
+
createSearchHighlight(selectionInfo: ISelectionInfo, color: string): IHighlight;
|
|
37
41
|
clearSearch(): void;
|
|
38
42
|
search(term: string, current: boolean): Promise<any>;
|
|
39
43
|
goToSearchID(href: string, index: number, current: boolean): Promise<void>;
|
|
@@ -47,8 +51,8 @@ export default class SearchModule implements ReaderModule {
|
|
|
47
51
|
paginate(items: Array<any>, page: number, per_page: number): {
|
|
48
52
|
page: number;
|
|
49
53
|
per_page: number;
|
|
50
|
-
pre_page: number;
|
|
51
|
-
next_page: number;
|
|
54
|
+
pre_page: number | undefined;
|
|
55
|
+
next_page: number | undefined;
|
|
52
56
|
total: number;
|
|
53
57
|
total_pages: number;
|
|
54
58
|
data: any[];
|
|
@@ -11,4 +11,4 @@ export interface ISearchResult {
|
|
|
11
11
|
}
|
|
12
12
|
export declare function escapeRegExp(str: string): string;
|
|
13
13
|
export declare const reset: () => void;
|
|
14
|
-
export declare function searchDocDomSeek(searchInput: string, doc: Document, href: string, title: string): Promise<ISearchResult[]>;
|
|
14
|
+
export declare function searchDocDomSeek(searchInput: string, doc: Document | null, href: string, title: string, fullWordSearch?: boolean): Promise<ISearchResult[]>;
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import Navigator from "./Navigator";
|
|
2
3
|
import Annotator from "../store/Annotator";
|
|
3
|
-
import Publication from "../model/Publication";
|
|
4
|
+
import { Publication } from "../model/Publication";
|
|
4
5
|
import { Locator, ReadingPosition } from "../model/Locator";
|
|
5
6
|
import { UserSettings, UserSettingsUIConfig } from "../model/user-settings/UserSettings";
|
|
6
|
-
import BookmarkModule,
|
|
7
|
-
import AnnotationModule,
|
|
8
|
-
import SearchModule,
|
|
9
|
-
import ContentProtectionModule,
|
|
10
|
-
import TextHighlighter,
|
|
11
|
-
import TimelineModule from "../modules/positions/TimelineModule";
|
|
7
|
+
import { BookmarkModule, BookmarkModuleConfig } from "../modules/BookmarkModule";
|
|
8
|
+
import { AnnotationModule, AnnotationModuleConfig } from "../modules/AnnotationModule";
|
|
9
|
+
import { SearchModule, SearchModuleConfig } from "../modules/search/SearchModule";
|
|
10
|
+
import { ContentProtectionModule, ContentProtectionModuleConfig } from "../modules/protection/ContentProtectionModule";
|
|
11
|
+
import { TextHighlighter, TextHighlighterConfig } from "../modules/highlight/TextHighlighter";
|
|
12
|
+
import { TimelineModule } from "../modules/positions/TimelineModule";
|
|
12
13
|
import BookView from "../views/BookView";
|
|
13
|
-
import MediaOverlayModule,
|
|
14
|
+
import { MediaOverlayModule, MediaOverlayModuleConfig } from "../modules/mediaoverlays/MediaOverlayModule";
|
|
14
15
|
import { D2Link, Link } from "../model/Link";
|
|
15
|
-
import ReaderModule from "../modules/ReaderModule";
|
|
16
|
+
import { ReaderModule } from "../modules/ReaderModule";
|
|
16
17
|
import { TTSModuleConfig } from "../modules/TTS/TTSSettings";
|
|
17
|
-
import
|
|
18
|
+
import { PageBreakModuleConfig } from "../modules/pagebreak/PageBreakModule";
|
|
19
|
+
import { PageBreakModule } from "../modules/pagebreak/PageBreakModule";
|
|
20
|
+
import { DefinitionsModule, DefinitionsModuleConfig } from "../modules/search/DefinitionsModule";
|
|
21
|
+
import EventEmitter from "events";
|
|
22
|
+
import LineFocusModule, { LineFocusModuleConfig } from "../modules/linefocus/LineFocusModule";
|
|
18
23
|
export declare type GetContent = (href: string) => Promise<string>;
|
|
19
24
|
export declare type GetContentBytesLength = (href: string) => Promise<number>;
|
|
20
25
|
export interface NavigatorAPI {
|
|
@@ -26,6 +31,7 @@ export interface NavigatorAPI {
|
|
|
26
31
|
resourceAtEnd: any;
|
|
27
32
|
resourceFitsScreen: any;
|
|
28
33
|
updateCurrentLocation: any;
|
|
34
|
+
onError?: (e: Error) => void;
|
|
29
35
|
}
|
|
30
36
|
export interface UpLinkConfig {
|
|
31
37
|
url?: URL;
|
|
@@ -41,20 +47,20 @@ export interface IFrameAttributes {
|
|
|
41
47
|
}
|
|
42
48
|
export interface IFrameNavigatorConfig {
|
|
43
49
|
mainElement: HTMLElement;
|
|
44
|
-
headerMenu
|
|
45
|
-
footerMenu
|
|
50
|
+
headerMenu?: HTMLElement | null;
|
|
51
|
+
footerMenu?: HTMLElement | null;
|
|
46
52
|
publication: Publication;
|
|
47
53
|
settings: UserSettings;
|
|
48
54
|
annotator?: Annotator;
|
|
49
55
|
upLink?: UpLinkConfig;
|
|
50
56
|
initialLastReadingPosition?: ReadingPosition;
|
|
51
|
-
rights
|
|
57
|
+
rights: ReaderRights;
|
|
52
58
|
material?: ReaderUI;
|
|
53
59
|
api?: NavigatorAPI;
|
|
54
60
|
tts?: TTSModuleConfig;
|
|
55
61
|
injectables: Array<Injectable>;
|
|
56
|
-
attributes
|
|
57
|
-
services
|
|
62
|
+
attributes?: IFrameAttributes;
|
|
63
|
+
services?: PublicationServices;
|
|
58
64
|
sample?: SampleRead;
|
|
59
65
|
}
|
|
60
66
|
export interface PublicationServices {
|
|
@@ -79,15 +85,18 @@ export interface Injectable {
|
|
|
79
85
|
async?: boolean;
|
|
80
86
|
}
|
|
81
87
|
export interface ReaderRights {
|
|
82
|
-
enableBookmarks
|
|
83
|
-
enableAnnotations
|
|
84
|
-
enableTTS
|
|
85
|
-
enableSearch
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
enableBookmarks: boolean;
|
|
89
|
+
enableAnnotations: boolean;
|
|
90
|
+
enableTTS: boolean;
|
|
91
|
+
enableSearch: boolean;
|
|
92
|
+
enableDefinitions: boolean;
|
|
93
|
+
enableContentProtection: boolean;
|
|
94
|
+
enableMaterial: boolean;
|
|
95
|
+
enableTimeline: boolean;
|
|
96
|
+
autoGeneratePositions: boolean;
|
|
97
|
+
enableMediaOverlays: boolean;
|
|
98
|
+
enablePageBreaks: boolean;
|
|
99
|
+
enableLineFocus: boolean;
|
|
91
100
|
}
|
|
92
101
|
export interface ReaderUI {
|
|
93
102
|
settings: UserSettingsUIConfig;
|
|
@@ -103,10 +112,13 @@ export interface ReaderConfig {
|
|
|
103
112
|
api?: NavigatorAPI;
|
|
104
113
|
tts?: TTSModuleConfig;
|
|
105
114
|
search?: SearchModuleConfig;
|
|
115
|
+
define?: DefinitionsModuleConfig;
|
|
106
116
|
protection?: ContentProtectionModuleConfig;
|
|
107
117
|
mediaOverlays?: MediaOverlayModuleConfig;
|
|
118
|
+
pagebreak?: PageBreakModuleConfig;
|
|
108
119
|
annotations?: AnnotationModuleConfig;
|
|
109
120
|
bookmarks?: BookmarkModuleConfig;
|
|
121
|
+
lineFocus?: LineFocusModuleConfig;
|
|
110
122
|
highlighter?: TextHighlighterConfig;
|
|
111
123
|
injectables: Array<Injectable>;
|
|
112
124
|
injectablesFixed: Array<Injectable>;
|
|
@@ -116,21 +128,23 @@ export interface ReaderConfig {
|
|
|
116
128
|
sample?: SampleRead;
|
|
117
129
|
}
|
|
118
130
|
/** Class that shows webpub resources in an iframe, with navigation controls outside the iframe. */
|
|
119
|
-
export
|
|
131
|
+
export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
120
132
|
iframes: Array<HTMLIFrameElement>;
|
|
121
|
-
currentTocUrl: string;
|
|
122
|
-
headerMenu
|
|
133
|
+
currentTocUrl: string | undefined;
|
|
134
|
+
headerMenu?: HTMLElement | null;
|
|
123
135
|
mainElement: HTMLElement;
|
|
124
136
|
publication: Publication;
|
|
125
137
|
bookmarkModule?: BookmarkModule;
|
|
126
138
|
annotationModule?: AnnotationModule;
|
|
127
139
|
ttsModule?: ReaderModule;
|
|
128
140
|
searchModule?: SearchModule;
|
|
141
|
+
definitionsModule?: DefinitionsModule;
|
|
129
142
|
contentProtectionModule?: ContentProtectionModule;
|
|
130
143
|
highlighter?: TextHighlighter;
|
|
131
144
|
timelineModule?: TimelineModule;
|
|
132
145
|
pageBreakModule?: PageBreakModule;
|
|
133
146
|
mediaOverlayModule?: MediaOverlayModule;
|
|
147
|
+
lineFocusModule?: LineFocusModule;
|
|
134
148
|
sideNavExpanded: boolean;
|
|
135
149
|
material: boolean;
|
|
136
150
|
mTabs: Array<any>;
|
|
@@ -147,7 +161,7 @@ export default class IFrameNavigator implements Navigator {
|
|
|
147
161
|
private previousChapterLink;
|
|
148
162
|
settings: UserSettings;
|
|
149
163
|
private readonly annotator;
|
|
150
|
-
view: BookView
|
|
164
|
+
view: BookView;
|
|
151
165
|
private readonly eventHandler;
|
|
152
166
|
private readonly touchEventHandler;
|
|
153
167
|
private readonly keyboardEventHandler;
|
|
@@ -185,21 +199,21 @@ export default class IFrameNavigator implements Navigator {
|
|
|
185
199
|
private newElementId;
|
|
186
200
|
private isBeingStyled;
|
|
187
201
|
private isLoading;
|
|
188
|
-
private readonly initialLastReadingPosition
|
|
189
|
-
api
|
|
202
|
+
private readonly initialLastReadingPosition?;
|
|
203
|
+
api?: NavigatorAPI;
|
|
190
204
|
rights: ReaderRights;
|
|
191
|
-
tts
|
|
192
|
-
injectables
|
|
193
|
-
attributes
|
|
194
|
-
services
|
|
195
|
-
sample
|
|
205
|
+
tts?: TTSModuleConfig;
|
|
206
|
+
injectables?: Array<Injectable>;
|
|
207
|
+
attributes?: IFrameAttributes;
|
|
208
|
+
services?: PublicationServices;
|
|
209
|
+
sample?: SampleRead;
|
|
196
210
|
private didInitKeyboardEventHandler;
|
|
197
211
|
static create(config: IFrameNavigatorConfig): Promise<IFrameNavigator>;
|
|
198
|
-
protected constructor(settings: UserSettings, annotator: Annotator |
|
|
212
|
+
protected constructor(settings: UserSettings, annotator: Annotator | undefined, upLinkConfig: UpLinkConfig | undefined, initialLastReadingPosition: ReadingPosition | undefined, publication: Publication, material: any, api?: NavigatorAPI, rights?: ReaderRights, tts?: TTSModuleConfig, injectables?: Array<Injectable>, attributes?: IFrameAttributes, services?: PublicationServices, sample?: SampleRead);
|
|
199
213
|
stop(): void;
|
|
200
214
|
spreads: HTMLDivElement;
|
|
201
215
|
firstSpread: HTMLDivElement;
|
|
202
|
-
protected start(mainElement: HTMLElement, headerMenu
|
|
216
|
+
protected start(mainElement: HTMLElement, headerMenu?: HTMLElement | null, footerMenu?: HTMLElement | null): Promise<void>;
|
|
203
217
|
timeout: any;
|
|
204
218
|
onResize: () => void;
|
|
205
219
|
reload: () => Promise<void>;
|
|
@@ -210,6 +224,9 @@ export default class IFrameNavigator implements Navigator {
|
|
|
210
224
|
private loadManifest;
|
|
211
225
|
private handleIFrameLoad;
|
|
212
226
|
private injectInjectablesIntoIframeHead;
|
|
227
|
+
/**
|
|
228
|
+
* Displays standard error UI.
|
|
229
|
+
*/
|
|
213
230
|
private abortOnError;
|
|
214
231
|
private tryAgain;
|
|
215
232
|
private precessContentForIframe;
|
|
@@ -230,8 +247,8 @@ export default class IFrameNavigator implements Navigator {
|
|
|
230
247
|
resumeReadAlong(): void;
|
|
231
248
|
totalResources(): number;
|
|
232
249
|
mostRecentNavigatedTocItem(): string;
|
|
233
|
-
currentResource(): number;
|
|
234
|
-
currentLink(): Array<Link>;
|
|
250
|
+
currentResource(): number | undefined;
|
|
251
|
+
currentLink(): Array<Link | undefined>;
|
|
235
252
|
tableOfContents(): any;
|
|
236
253
|
readingOrder(): any;
|
|
237
254
|
atStart(): boolean;
|
|
@@ -244,7 +261,7 @@ export default class IFrameNavigator implements Navigator {
|
|
|
244
261
|
currentLocator(): Locator;
|
|
245
262
|
positions(): any;
|
|
246
263
|
goToPosition(position: number): void;
|
|
247
|
-
|
|
264
|
+
snapToSelector(selector: any): void;
|
|
248
265
|
applyAttributes(attributes: IFrameAttributes): void;
|
|
249
266
|
private handlePreviousPageClick;
|
|
250
267
|
private handleNextPageClick;
|
|
@@ -252,8 +269,8 @@ export default class IFrameNavigator implements Navigator {
|
|
|
252
269
|
private handleInternalLink;
|
|
253
270
|
private handleNumberOfIframes;
|
|
254
271
|
handleResize(): Promise<void>;
|
|
255
|
-
updatePositionInfo(save?: boolean):
|
|
256
|
-
savePosition: (() =>
|
|
272
|
+
updatePositionInfo(save?: boolean): void;
|
|
273
|
+
savePosition: (() => void) & {
|
|
257
274
|
clear(): void;
|
|
258
275
|
};
|
|
259
276
|
private handlePreviousChapterClick;
|
|
@@ -273,6 +290,8 @@ export default class IFrameNavigator implements Navigator {
|
|
|
273
290
|
private static createBase;
|
|
274
291
|
private static createCssLink;
|
|
275
292
|
private static createJavascriptLink;
|
|
276
|
-
activateMarker(id: any): void;
|
|
293
|
+
activateMarker(id: any, position: any): void;
|
|
277
294
|
deactivateMarker(): void;
|
|
295
|
+
showLayer(layer: any): void;
|
|
296
|
+
hideLayer(layer: any): void;
|
|
278
297
|
}
|
package/dist/types/reader.d.ts
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import { Locator } from "./model/Locator";
|
|
1
|
+
import { Annotation, Bookmark, Locator } from "./model/Locator";
|
|
2
2
|
import { UserSettingsIncrementable } from "./model/user-settings/UserProperties";
|
|
3
3
|
import { UserSettings } from "./model/user-settings/UserSettings";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import MediaOverlayModule from "./modules/mediaoverlays/MediaOverlayModule";
|
|
8
|
-
import { MediaOverlaySettings, IMediaOverlayUserSettings, MediaOverlayIncrementable } from "./modules/mediaoverlays/MediaOverlaySettings";
|
|
9
|
-
import TimelineModule from "./modules/positions/TimelineModule";
|
|
10
|
-
import ContentProtectionModule from "./modules/protection/ContentProtectionModule";
|
|
11
|
-
import SearchModule from "./modules/search/SearchModule";
|
|
12
|
-
import { ITTSUserSettings, TTSIncrementable, TTSSettings } from "./modules/TTS/TTSSettings";
|
|
13
|
-
import IFrameNavigator, { IFrameAttributes, ReaderConfig } from "./navigator/IFrameNavigator";
|
|
14
|
-
import PageBreakModule from "./modules/pagebreak/PageBreakModule";
|
|
15
|
-
import ReaderModule from "./modules/ReaderModule";
|
|
4
|
+
import { IMediaOverlayUserSettings, MediaOverlayIncrementable } from "./modules/mediaoverlays/MediaOverlaySettings";
|
|
5
|
+
import { ITTSUserSettings, TTSIncrementable } from "./modules/TTS/TTSSettings";
|
|
6
|
+
import { IFrameAttributes, ReaderConfig } from "./navigator/IFrameNavigator";
|
|
16
7
|
/**
|
|
17
8
|
* A class that, once instantiated using the public `.build` method,
|
|
18
9
|
* is the primary interface into the D2 Reader.
|
|
19
|
-
*
|
|
20
10
|
* @TODO :
|
|
21
11
|
* - Type all function arguments
|
|
22
12
|
* - DEV logger
|
|
@@ -25,57 +15,97 @@ import ReaderModule from "./modules/ReaderModule";
|
|
|
25
15
|
* - Testing
|
|
26
16
|
*/
|
|
27
17
|
export default class D2Reader {
|
|
28
|
-
readonly settings
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly ttsModule
|
|
35
|
-
readonly searchModule
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
readonly
|
|
39
|
-
readonly
|
|
40
|
-
readonly
|
|
18
|
+
private readonly settings;
|
|
19
|
+
private readonly navigator;
|
|
20
|
+
private readonly highlighter;
|
|
21
|
+
private readonly bookmarkModule?;
|
|
22
|
+
private readonly annotationModule?;
|
|
23
|
+
private readonly ttsSettings?;
|
|
24
|
+
private readonly ttsModule?;
|
|
25
|
+
private readonly searchModule?;
|
|
26
|
+
private readonly definitionsModule?;
|
|
27
|
+
private readonly contentProtectionModule?;
|
|
28
|
+
private readonly timelineModule?;
|
|
29
|
+
private readonly mediaOverlaySettings?;
|
|
30
|
+
private readonly mediaOverlayModule?;
|
|
31
|
+
private readonly pageBreakModule?;
|
|
32
|
+
private readonly lineFocusModule?;
|
|
41
33
|
private constructor();
|
|
34
|
+
addEventListener(): void;
|
|
42
35
|
/**
|
|
43
36
|
* The async builder.
|
|
44
37
|
*/
|
|
45
|
-
static
|
|
38
|
+
static load(initialConfig: ReaderConfig): Promise<D2Reader>;
|
|
46
39
|
/**
|
|
47
40
|
* Read Aloud
|
|
48
41
|
*/
|
|
42
|
+
/** Start TTS Read Aloud */
|
|
49
43
|
startReadAloud: () => void;
|
|
44
|
+
/** Start TTS Read Aloud */
|
|
50
45
|
stopReadAloud: () => void;
|
|
46
|
+
/** Start TTS Read Aloud */
|
|
51
47
|
pauseReadAloud: () => void;
|
|
48
|
+
/** Start TTS Read Aloud */
|
|
52
49
|
resumeReadAloud: () => void;
|
|
53
50
|
/**
|
|
54
51
|
* Read Along
|
|
55
52
|
*/
|
|
53
|
+
/** Start Media Overlay Read Along */
|
|
56
54
|
startReadAlong: () => void;
|
|
55
|
+
/** Stop Media Overlay Read Along */
|
|
57
56
|
stopReadAlong: () => void;
|
|
57
|
+
/** Pause Media Overlay Read Along */
|
|
58
58
|
pauseReadAlong: () => void;
|
|
59
|
+
/** Resume Media Overlay Read Along */
|
|
59
60
|
resumeReadAlong: () => void;
|
|
61
|
+
get hasMediaOverlays(): boolean;
|
|
60
62
|
/**
|
|
61
63
|
* Bookmarks and annotations
|
|
62
64
|
*/
|
|
65
|
+
/** Save bookmark by progression */
|
|
63
66
|
saveBookmark: () => Promise<any>;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
/** Save bookmark by annotation */
|
|
68
|
+
saveBookmarkPlus: () => Promise<any>;
|
|
69
|
+
/** Delete bookmark */
|
|
70
|
+
deleteBookmark: (bookmark: Bookmark) => Promise<any>;
|
|
71
|
+
/** Delete annotation */
|
|
72
|
+
deleteAnnotation: (highlight: Annotation) => Promise<any>;
|
|
73
|
+
/** Add annotation */
|
|
74
|
+
addAnnotation: (highlight: Annotation) => Promise<any>;
|
|
75
|
+
/** Hide Annotation Layer */
|
|
76
|
+
hideAnnotationLayer: () => void | undefined;
|
|
77
|
+
/** Show Annotation Layer */
|
|
78
|
+
showAnnotationLayer: () => void | undefined;
|
|
79
|
+
/** Hide Layer */
|
|
80
|
+
hideLayer: (layer: any) => void;
|
|
81
|
+
/** Show Layer */
|
|
82
|
+
showLayer: (layer: any) => void;
|
|
83
|
+
/** Activate Marker <br>
|
|
84
|
+
* Activated Marker will be used for active annotation creation */
|
|
85
|
+
activateMarker: (id: string, position: string) => void;
|
|
86
|
+
/** Deactivate Marker */
|
|
71
87
|
deactivateMarker: () => void;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Definitions
|
|
90
|
+
*/
|
|
91
|
+
/** Clear current definitions */
|
|
92
|
+
clearDefinitions: () => Promise<void>;
|
|
93
|
+
/** Add newt definition */
|
|
94
|
+
addDefinition: (definition: any) => Promise<void>;
|
|
95
|
+
/** Table of Contents */
|
|
96
|
+
get tableOfContents(): any;
|
|
97
|
+
/** Reading Order or Spine */
|
|
98
|
+
get readingOrder(): any;
|
|
99
|
+
/** Current Bookmarks */
|
|
100
|
+
get bookmarks(): any;
|
|
101
|
+
/** Current Annotations */
|
|
102
|
+
get annotations(): any;
|
|
76
103
|
/**
|
|
77
104
|
* Search
|
|
78
105
|
*/
|
|
106
|
+
/** Search by term and current resource or entire book <br>
|
|
107
|
+
* current = true, will search only current resource <br>
|
|
108
|
+
* current = false, will search entire publication */
|
|
79
109
|
search: (term: string, current: boolean) => Promise<any>;
|
|
80
110
|
goToSearchIndex: (href: string, index: number, current: boolean) => Promise<void>;
|
|
81
111
|
goToSearchID: (href: string, index: number, current: boolean) => Promise<void>;
|
|
@@ -83,16 +113,14 @@ export default class D2Reader {
|
|
|
83
113
|
/**
|
|
84
114
|
* Resources
|
|
85
115
|
*/
|
|
86
|
-
currentResource
|
|
87
|
-
mostRecentNavigatedTocItem
|
|
88
|
-
totalResources
|
|
116
|
+
get currentResource(): number | undefined;
|
|
117
|
+
get mostRecentNavigatedTocItem(): string;
|
|
118
|
+
get totalResources(): number;
|
|
119
|
+
get publicationLanguage(): string[];
|
|
89
120
|
/**
|
|
90
121
|
* Settings
|
|
91
122
|
*/
|
|
92
|
-
get
|
|
93
|
-
resetUserSettings: () => Promise<void>;
|
|
94
|
-
applyUserSettings: (userSettings: Partial<UserSettings>) => Promise<void>;
|
|
95
|
-
currentSettings: () => {
|
|
123
|
+
get currentSettings(): {
|
|
96
124
|
appearance: string;
|
|
97
125
|
fontFamily: string;
|
|
98
126
|
textAlignment: string;
|
|
@@ -104,6 +132,8 @@ export default class D2Reader {
|
|
|
104
132
|
pageMargins: number;
|
|
105
133
|
lineHeight: number;
|
|
106
134
|
};
|
|
135
|
+
resetUserSettings: () => Promise<void>;
|
|
136
|
+
applyUserSettings: (userSettings: Partial<UserSettings>) => Promise<void>;
|
|
107
137
|
scroll: (value: boolean) => Promise<void>;
|
|
108
138
|
private isTTSIncrementable;
|
|
109
139
|
private isMOIncrementable;
|
|
@@ -125,11 +155,16 @@ export default class D2Reader {
|
|
|
125
155
|
* TTS Settings
|
|
126
156
|
*/
|
|
127
157
|
resetTTSSettings: () => void;
|
|
128
|
-
applyTTSSettings: (ttsSettings: ITTSUserSettings) => void
|
|
129
|
-
|
|
130
|
-
|
|
158
|
+
applyTTSSettings: (ttsSettings: Partial<ITTSUserSettings>) => Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Disabled
|
|
161
|
+
*/
|
|
162
|
+
applyPreferredVoice: (value: string) => Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Media Overlay Settings
|
|
165
|
+
*/
|
|
131
166
|
resetMediaOverlaySettings: () => Promise<void>;
|
|
132
|
-
applyMediaOverlaySettings: (settings: IMediaOverlayUserSettings) => Promise<void>;
|
|
167
|
+
applyMediaOverlaySettings: (settings: Partial<IMediaOverlayUserSettings>) => Promise<void>;
|
|
133
168
|
/**
|
|
134
169
|
* Navigation
|
|
135
170
|
* @TODO : These should return promises that complete when they are done.
|
|
@@ -138,18 +173,24 @@ export default class D2Reader {
|
|
|
138
173
|
get positions(): any;
|
|
139
174
|
goTo: (locator: Locator) => Promise<void>;
|
|
140
175
|
goToPosition: (value: number) => Promise<void>;
|
|
141
|
-
nextResource: () =>
|
|
142
|
-
previousResource: () =>
|
|
176
|
+
nextResource: () => void;
|
|
177
|
+
previousResource: () => void;
|
|
143
178
|
nextPage: () => Promise<void>;
|
|
144
179
|
previousPage: () => Promise<void>;
|
|
145
|
-
atStart
|
|
146
|
-
atEnd
|
|
147
|
-
|
|
180
|
+
get atStart(): boolean;
|
|
181
|
+
get atEnd(): boolean;
|
|
182
|
+
snapToSelector: (selector: any) => Promise<void>;
|
|
148
183
|
/**
|
|
149
184
|
* You have attributes in the reader when you initialize it. You can set margin, navigationHeight etc...
|
|
150
185
|
* This is in case you change the attributes after initializing the reader.
|
|
151
186
|
*/
|
|
152
187
|
applyAttributes: (value: IFrameAttributes) => void;
|
|
188
|
+
applyLineFocusSettings(userSettings: any): Promise<void>;
|
|
189
|
+
lineUp(): void;
|
|
190
|
+
lineDown(): void;
|
|
191
|
+
enableLineFocus(): Promise<void>;
|
|
192
|
+
lineFocus(active: boolean): Promise<void>;
|
|
193
|
+
disableLineFocus(): void;
|
|
153
194
|
/**
|
|
154
195
|
* Destructor:
|
|
155
196
|
* Only used in react applications because when they re-visit the page
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import { ReadingPosition } from "../model/Locator";
|
|
2
2
|
import { IHighlight } from "../modules/highlight/common/highlight";
|
|
3
|
-
import { IReadiumIFrameWindow } from "../modules/highlight/renderer/iframe/state";
|
|
4
3
|
interface Annotator {
|
|
5
|
-
initLastReadingPosition(position: ReadingPosition):
|
|
6
|
-
getLastReadingPosition():
|
|
7
|
-
saveLastReadingPosition(position: any):
|
|
8
|
-
initBookmarks(list: any):
|
|
9
|
-
saveBookmark(bookmark: any):
|
|
10
|
-
deleteBookmark(bookmark: any):
|
|
11
|
-
getBookmarks(href?: string):
|
|
12
|
-
locatorExists(locator: any, type: AnnotationType):
|
|
13
|
-
initAnnotations(list: any):
|
|
14
|
-
saveAnnotation(annotation: any):
|
|
15
|
-
deleteAnnotation(id: any):
|
|
16
|
-
deleteSelectedAnnotation(annotation: any):
|
|
17
|
-
getAnnotations():
|
|
18
|
-
getAnnotation(annotation: IHighlight):
|
|
19
|
-
getAnnotationByID(id: string):
|
|
20
|
-
getAnnotationPosition(id: any, iframeWin:
|
|
4
|
+
initLastReadingPosition(position: ReadingPosition): any;
|
|
5
|
+
getLastReadingPosition(): any;
|
|
6
|
+
saveLastReadingPosition(position: any): any;
|
|
7
|
+
initBookmarks(list: any): any;
|
|
8
|
+
saveBookmark(bookmark: any): any;
|
|
9
|
+
deleteBookmark(bookmark: any): any;
|
|
10
|
+
getBookmarks(href?: string): any;
|
|
11
|
+
locatorExists(locator: any, type: AnnotationType): any;
|
|
12
|
+
initAnnotations(list: any): any;
|
|
13
|
+
saveAnnotation(annotation: any): any;
|
|
14
|
+
deleteAnnotation(id: any): any;
|
|
15
|
+
deleteSelectedAnnotation(annotation: any): any;
|
|
16
|
+
getAnnotations(): any;
|
|
17
|
+
getAnnotation(annotation: IHighlight): any;
|
|
18
|
+
getAnnotationByID(id: string): any;
|
|
19
|
+
getAnnotationPosition(id: any, iframeWin: any): any;
|
|
21
20
|
}
|
|
22
21
|
export declare enum AnnotationType {
|
|
23
22
|
Bookmark = 0,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Annotator, { AnnotationType } from "./Annotator";
|
|
2
2
|
import Store from "./Store";
|
|
3
3
|
import { ReadingPosition } from "../model/Locator";
|
|
4
|
-
import { IReadiumIFrameWindow } from "../modules/highlight/renderer/iframe/state";
|
|
5
4
|
import { IHighlight } from "../modules/highlight/common/highlight";
|
|
6
5
|
export interface LocalAnnotatorConfig {
|
|
7
6
|
store: Store;
|
|
@@ -13,20 +12,20 @@ export default class LocalAnnotator implements Annotator {
|
|
|
13
12
|
private static readonly BOOKMARKS;
|
|
14
13
|
private static readonly ANNOTATIONS;
|
|
15
14
|
constructor(config: LocalAnnotatorConfig);
|
|
16
|
-
getLastReadingPosition():
|
|
17
|
-
initLastReadingPosition(position: ReadingPosition):
|
|
18
|
-
saveLastReadingPosition(position: any):
|
|
19
|
-
initBookmarks(list: any):
|
|
20
|
-
saveBookmark(bookmark: any):
|
|
21
|
-
locatorExists(locator: any, type: AnnotationType):
|
|
22
|
-
deleteBookmark(bookmark: any):
|
|
23
|
-
getBookmarks(href?: string):
|
|
24
|
-
initAnnotations(list: any):
|
|
25
|
-
saveAnnotation(annotation: any):
|
|
26
|
-
deleteAnnotation(id: any):
|
|
27
|
-
deleteSelectedAnnotation(annotation: any):
|
|
28
|
-
getAnnotations():
|
|
29
|
-
getAnnotationPosition(id: any, iframeWin:
|
|
30
|
-
getAnnotation(highlight: IHighlight):
|
|
31
|
-
getAnnotationByID(id: string):
|
|
15
|
+
getLastReadingPosition(): any;
|
|
16
|
+
initLastReadingPosition(position: ReadingPosition): void;
|
|
17
|
+
saveLastReadingPosition(position: any): void;
|
|
18
|
+
initBookmarks(list: any): any;
|
|
19
|
+
saveBookmark(bookmark: any): any;
|
|
20
|
+
locatorExists(locator: any, type: AnnotationType): any | null;
|
|
21
|
+
deleteBookmark(bookmark: any): any;
|
|
22
|
+
getBookmarks(href?: string): any;
|
|
23
|
+
initAnnotations(list: any): any;
|
|
24
|
+
saveAnnotation(annotation: any): any;
|
|
25
|
+
deleteAnnotation(id: any): any;
|
|
26
|
+
deleteSelectedAnnotation(annotation: any): any;
|
|
27
|
+
getAnnotations(): any;
|
|
28
|
+
getAnnotationPosition(id: any, iframeWin: any): any;
|
|
29
|
+
getAnnotation(highlight: IHighlight): any;
|
|
30
|
+
getAnnotationByID(id: string): any;
|
|
32
31
|
}
|
|
@@ -14,7 +14,7 @@ export default class LocalStorageStore implements Store {
|
|
|
14
14
|
private readonly useLocalStorage;
|
|
15
15
|
constructor(config: LocalStorageStoreConfig);
|
|
16
16
|
private getLocalStorageKey;
|
|
17
|
-
get(key: string):
|
|
18
|
-
set(key: string, value: any):
|
|
19
|
-
remove(key: string):
|
|
17
|
+
get(key: string): any | null;
|
|
18
|
+
set(key: string, value: any): void;
|
|
19
|
+
remove(key: string): void;
|
|
20
20
|
}
|
|
@@ -3,7 +3,7 @@ import Store from "./Store";
|
|
|
3
3
|
export default class MemoryStore implements Store {
|
|
4
4
|
private readonly store;
|
|
5
5
|
constructor();
|
|
6
|
-
get(key: string):
|
|
7
|
-
set(key: string, value: string):
|
|
8
|
-
remove(key: string):
|
|
6
|
+
get(key: string): string | null;
|
|
7
|
+
set(key: string, value: string): void;
|
|
8
|
+
remove(key: string): void;
|
|
9
9
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface Store {
|
|
2
|
-
get(key: string):
|
|
3
|
-
set(key: string, value: any):
|
|
4
|
-
remove(key: string):
|
|
2
|
+
get(key: string): any | null;
|
|
3
|
+
set(key: string, value: any): void;
|
|
4
|
+
remove(key: string): void;
|
|
5
5
|
}
|
|
6
6
|
export default Store;
|