@d-i-t-a/reader 2.0.0-beta.2 → 2.0.0-beta.22
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 +9007 -5272
- package/dist/esm/index.js.map +3 -3
- package/dist/injectables/style/linefocus.css +55 -0
- package/dist/injectables/style/popover.css +125 -0
- package/dist/injectables/style/style.css +31 -2
- package/dist/reader.css +7 -8
- package/dist/reader.js +53 -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 +13 -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 +14 -13
- 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 +8 -8
- package/dist/types/modules/TTS/TTSModule2.d.ts +9 -9
- 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 +45 -61
- package/dist/types/modules/highlight/common/highlight.d.ts +3 -2
- package/dist/types/modules/highlight/common/rect-utils.d.ts +1 -1
- 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 +51 -0
- package/dist/types/modules/mediaoverlays/MediaOverlayModule.d.ts +20 -15
- package/dist/types/modules/mediaoverlays/MediaOverlaySettings.d.ts +21 -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 +7 -7
- package/dist/types/modules/sampleread/SampleReadEventHandler.d.ts +1 -1
- package/dist/types/modules/search/DefinitionsModule.d.ts +22 -14
- package/dist/types/modules/search/Popup.d.ts +4 -2
- package/dist/types/modules/search/SearchModule.d.ts +16 -12
- package/dist/types/modules/search/searchWithDomSeek.d.ts +1 -1
- package/dist/types/navigator/IFrameNavigator.d.ts +59 -44
- package/dist/types/reader.d.ts +96 -57
- 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 +11 -2
- 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 +4 -4
- package/dist/types/views/FixedBookView.d.ts +3 -3
- package/dist/types/views/ReflowableBookView.d.ts +2 -2
- package/package.json +16 -9
|
@@ -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
31
|
private currentSearchHighlights;
|
|
29
|
-
private highlighter
|
|
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,21 +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
|
|
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";
|
|
19
23
|
export declare type GetContent = (href: string) => Promise<string>;
|
|
20
24
|
export declare type GetContentBytesLength = (href: string) => Promise<number>;
|
|
21
25
|
export interface NavigatorAPI {
|
|
@@ -27,6 +31,7 @@ export interface NavigatorAPI {
|
|
|
27
31
|
resourceAtEnd: any;
|
|
28
32
|
resourceFitsScreen: any;
|
|
29
33
|
updateCurrentLocation: any;
|
|
34
|
+
onError?: (e: Error) => void;
|
|
30
35
|
}
|
|
31
36
|
export interface UpLinkConfig {
|
|
32
37
|
url?: URL;
|
|
@@ -42,20 +47,20 @@ export interface IFrameAttributes {
|
|
|
42
47
|
}
|
|
43
48
|
export interface IFrameNavigatorConfig {
|
|
44
49
|
mainElement: HTMLElement;
|
|
45
|
-
headerMenu
|
|
46
|
-
footerMenu
|
|
50
|
+
headerMenu?: HTMLElement | null;
|
|
51
|
+
footerMenu?: HTMLElement | null;
|
|
47
52
|
publication: Publication;
|
|
48
53
|
settings: UserSettings;
|
|
49
54
|
annotator?: Annotator;
|
|
50
55
|
upLink?: UpLinkConfig;
|
|
51
56
|
initialLastReadingPosition?: ReadingPosition;
|
|
52
|
-
rights
|
|
57
|
+
rights: ReaderRights;
|
|
53
58
|
material?: ReaderUI;
|
|
54
59
|
api?: NavigatorAPI;
|
|
55
60
|
tts?: TTSModuleConfig;
|
|
56
61
|
injectables: Array<Injectable>;
|
|
57
|
-
attributes
|
|
58
|
-
services
|
|
62
|
+
attributes?: IFrameAttributes;
|
|
63
|
+
services?: PublicationServices;
|
|
59
64
|
sample?: SampleRead;
|
|
60
65
|
}
|
|
61
66
|
export interface PublicationServices {
|
|
@@ -80,16 +85,18 @@ export interface Injectable {
|
|
|
80
85
|
async?: boolean;
|
|
81
86
|
}
|
|
82
87
|
export interface ReaderRights {
|
|
83
|
-
enableBookmarks
|
|
84
|
-
enableAnnotations
|
|
85
|
-
enableTTS
|
|
86
|
-
enableSearch
|
|
87
|
-
enableDefinitions
|
|
88
|
-
enableContentProtection
|
|
89
|
-
enableMaterial
|
|
90
|
-
enableTimeline
|
|
91
|
-
autoGeneratePositions
|
|
92
|
-
enableMediaOverlays
|
|
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;
|
|
93
100
|
}
|
|
94
101
|
export interface ReaderUI {
|
|
95
102
|
settings: UserSettingsUIConfig;
|
|
@@ -108,8 +115,10 @@ export interface ReaderConfig {
|
|
|
108
115
|
define?: DefinitionsModuleConfig;
|
|
109
116
|
protection?: ContentProtectionModuleConfig;
|
|
110
117
|
mediaOverlays?: MediaOverlayModuleConfig;
|
|
118
|
+
pagebreak?: PageBreakModuleConfig;
|
|
111
119
|
annotations?: AnnotationModuleConfig;
|
|
112
120
|
bookmarks?: BookmarkModuleConfig;
|
|
121
|
+
lineFocus?: LineFocusModuleConfig;
|
|
113
122
|
highlighter?: TextHighlighterConfig;
|
|
114
123
|
injectables: Array<Injectable>;
|
|
115
124
|
injectablesFixed: Array<Injectable>;
|
|
@@ -119,10 +128,10 @@ export interface ReaderConfig {
|
|
|
119
128
|
sample?: SampleRead;
|
|
120
129
|
}
|
|
121
130
|
/** Class that shows webpub resources in an iframe, with navigation controls outside the iframe. */
|
|
122
|
-
export
|
|
131
|
+
export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
123
132
|
iframes: Array<HTMLIFrameElement>;
|
|
124
|
-
currentTocUrl: string;
|
|
125
|
-
headerMenu
|
|
133
|
+
currentTocUrl: string | undefined;
|
|
134
|
+
headerMenu?: HTMLElement | null;
|
|
126
135
|
mainElement: HTMLElement;
|
|
127
136
|
publication: Publication;
|
|
128
137
|
bookmarkModule?: BookmarkModule;
|
|
@@ -135,6 +144,7 @@ export default class IFrameNavigator implements Navigator {
|
|
|
135
144
|
timelineModule?: TimelineModule;
|
|
136
145
|
pageBreakModule?: PageBreakModule;
|
|
137
146
|
mediaOverlayModule?: MediaOverlayModule;
|
|
147
|
+
lineFocusModule?: LineFocusModule;
|
|
138
148
|
sideNavExpanded: boolean;
|
|
139
149
|
material: boolean;
|
|
140
150
|
mTabs: Array<any>;
|
|
@@ -151,7 +161,7 @@ export default class IFrameNavigator implements Navigator {
|
|
|
151
161
|
private previousChapterLink;
|
|
152
162
|
settings: UserSettings;
|
|
153
163
|
private readonly annotator;
|
|
154
|
-
view: BookView
|
|
164
|
+
view: BookView;
|
|
155
165
|
private readonly eventHandler;
|
|
156
166
|
private readonly touchEventHandler;
|
|
157
167
|
private readonly keyboardEventHandler;
|
|
@@ -189,21 +199,21 @@ export default class IFrameNavigator implements Navigator {
|
|
|
189
199
|
private newElementId;
|
|
190
200
|
private isBeingStyled;
|
|
191
201
|
private isLoading;
|
|
192
|
-
private readonly initialLastReadingPosition
|
|
193
|
-
api
|
|
202
|
+
private readonly initialLastReadingPosition?;
|
|
203
|
+
api?: NavigatorAPI;
|
|
194
204
|
rights: ReaderRights;
|
|
195
|
-
tts
|
|
196
|
-
injectables
|
|
197
|
-
attributes
|
|
198
|
-
services
|
|
199
|
-
sample
|
|
205
|
+
tts?: TTSModuleConfig;
|
|
206
|
+
injectables?: Array<Injectable>;
|
|
207
|
+
attributes?: IFrameAttributes;
|
|
208
|
+
services?: PublicationServices;
|
|
209
|
+
sample?: SampleRead;
|
|
200
210
|
private didInitKeyboardEventHandler;
|
|
201
211
|
static create(config: IFrameNavigatorConfig): Promise<IFrameNavigator>;
|
|
202
|
-
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);
|
|
203
213
|
stop(): void;
|
|
204
214
|
spreads: HTMLDivElement;
|
|
205
215
|
firstSpread: HTMLDivElement;
|
|
206
|
-
protected start(mainElement: HTMLElement, headerMenu
|
|
216
|
+
protected start(mainElement: HTMLElement, headerMenu?: HTMLElement | null, footerMenu?: HTMLElement | null): Promise<void>;
|
|
207
217
|
timeout: any;
|
|
208
218
|
onResize: () => void;
|
|
209
219
|
reload: () => Promise<void>;
|
|
@@ -214,6 +224,9 @@ export default class IFrameNavigator implements Navigator {
|
|
|
214
224
|
private loadManifest;
|
|
215
225
|
private handleIFrameLoad;
|
|
216
226
|
private injectInjectablesIntoIframeHead;
|
|
227
|
+
/**
|
|
228
|
+
* Displays standard error UI.
|
|
229
|
+
*/
|
|
217
230
|
private abortOnError;
|
|
218
231
|
private tryAgain;
|
|
219
232
|
private precessContentForIframe;
|
|
@@ -234,8 +247,8 @@ export default class IFrameNavigator implements Navigator {
|
|
|
234
247
|
resumeReadAlong(): void;
|
|
235
248
|
totalResources(): number;
|
|
236
249
|
mostRecentNavigatedTocItem(): string;
|
|
237
|
-
currentResource(): number;
|
|
238
|
-
currentLink(): Array<Link>;
|
|
250
|
+
currentResource(): number | undefined;
|
|
251
|
+
currentLink(): Array<Link | undefined>;
|
|
239
252
|
tableOfContents(): any;
|
|
240
253
|
readingOrder(): any;
|
|
241
254
|
atStart(): boolean;
|
|
@@ -248,7 +261,7 @@ export default class IFrameNavigator implements Navigator {
|
|
|
248
261
|
currentLocator(): Locator;
|
|
249
262
|
positions(): any;
|
|
250
263
|
goToPosition(position: number): void;
|
|
251
|
-
|
|
264
|
+
snapToSelector(selector: any): void;
|
|
252
265
|
applyAttributes(attributes: IFrameAttributes): void;
|
|
253
266
|
private handlePreviousPageClick;
|
|
254
267
|
private handleNextPageClick;
|
|
@@ -256,8 +269,8 @@ export default class IFrameNavigator implements Navigator {
|
|
|
256
269
|
private handleInternalLink;
|
|
257
270
|
private handleNumberOfIframes;
|
|
258
271
|
handleResize(): Promise<void>;
|
|
259
|
-
updatePositionInfo(save?: boolean):
|
|
260
|
-
savePosition: (() =>
|
|
272
|
+
updatePositionInfo(save?: boolean): void;
|
|
273
|
+
savePosition: (() => void) & {
|
|
261
274
|
clear(): void;
|
|
262
275
|
};
|
|
263
276
|
private handlePreviousChapterClick;
|
|
@@ -279,4 +292,6 @@ export default class IFrameNavigator implements Navigator {
|
|
|
279
292
|
private static createJavascriptLink;
|
|
280
293
|
activateMarker(id: any, position: any): void;
|
|
281
294
|
deactivateMarker(): void;
|
|
295
|
+
showLayer(layer: any): void;
|
|
296
|
+
hideLayer(layer: any): void;
|
|
282
297
|
}
|
package/dist/types/reader.d.ts
CHANGED
|
@@ -1,23 +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";
|
|
16
|
-
import DefinitionsModule from "./modules/search/DefinitionsModule";
|
|
4
|
+
import { IMediaOverlayUserSettings, MediaOverlayIncrementable } from "./modules/mediaoverlays/MediaOverlaySettings";
|
|
5
|
+
import { ITTSUserSettings, TTSIncrementable } from "./modules/TTS/TTSSettings";
|
|
6
|
+
import { IFrameAttributes, ReaderConfig } from "./navigator/IFrameNavigator";
|
|
17
7
|
/**
|
|
18
8
|
* A class that, once instantiated using the public `.build` method,
|
|
19
9
|
* is the primary interface into the D2 Reader.
|
|
20
|
-
*
|
|
21
10
|
* @TODO :
|
|
22
11
|
* - Type all function arguments
|
|
23
12
|
* - DEV logger
|
|
@@ -26,58 +15,97 @@ import DefinitionsModule from "./modules/search/DefinitionsModule";
|
|
|
26
15
|
* - Testing
|
|
27
16
|
*/
|
|
28
17
|
export default class D2Reader {
|
|
29
|
-
readonly settings
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
35
|
-
readonly ttsModule
|
|
36
|
-
readonly searchModule
|
|
37
|
-
readonly definitionsModule
|
|
38
|
-
readonly contentProtectionModule
|
|
39
|
-
readonly timelineModule
|
|
40
|
-
readonly mediaOverlaySettings
|
|
41
|
-
readonly mediaOverlayModule
|
|
42
|
-
readonly pageBreakModule
|
|
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?;
|
|
43
33
|
private constructor();
|
|
34
|
+
addEventListener(): void;
|
|
44
35
|
/**
|
|
45
36
|
* The async builder.
|
|
46
37
|
*/
|
|
47
|
-
static
|
|
38
|
+
static load(initialConfig: ReaderConfig): Promise<D2Reader>;
|
|
48
39
|
/**
|
|
49
40
|
* Read Aloud
|
|
50
41
|
*/
|
|
42
|
+
/** Start TTS Read Aloud */
|
|
51
43
|
startReadAloud: () => void;
|
|
44
|
+
/** Start TTS Read Aloud */
|
|
52
45
|
stopReadAloud: () => void;
|
|
46
|
+
/** Start TTS Read Aloud */
|
|
53
47
|
pauseReadAloud: () => void;
|
|
48
|
+
/** Start TTS Read Aloud */
|
|
54
49
|
resumeReadAloud: () => void;
|
|
55
50
|
/**
|
|
56
51
|
* Read Along
|
|
57
52
|
*/
|
|
53
|
+
/** Start Media Overlay Read Along */
|
|
58
54
|
startReadAlong: () => void;
|
|
55
|
+
/** Stop Media Overlay Read Along */
|
|
59
56
|
stopReadAlong: () => void;
|
|
57
|
+
/** Pause Media Overlay Read Along */
|
|
60
58
|
pauseReadAlong: () => void;
|
|
59
|
+
/** Resume Media Overlay Read Along */
|
|
61
60
|
resumeReadAlong: () => void;
|
|
61
|
+
get hasMediaOverlays(): boolean;
|
|
62
62
|
/**
|
|
63
63
|
* Bookmarks and annotations
|
|
64
64
|
*/
|
|
65
|
+
/** Save bookmark by progression */
|
|
65
66
|
saveBookmark: () => Promise<any>;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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 */
|
|
73
87
|
deactivateMarker: () => void;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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;
|
|
78
103
|
/**
|
|
79
104
|
* Search
|
|
80
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 */
|
|
81
109
|
search: (term: string, current: boolean) => Promise<any>;
|
|
82
110
|
goToSearchIndex: (href: string, index: number, current: boolean) => Promise<void>;
|
|
83
111
|
goToSearchID: (href: string, index: number, current: boolean) => Promise<void>;
|
|
@@ -85,16 +113,14 @@ export default class D2Reader {
|
|
|
85
113
|
/**
|
|
86
114
|
* Resources
|
|
87
115
|
*/
|
|
88
|
-
currentResource
|
|
89
|
-
mostRecentNavigatedTocItem
|
|
90
|
-
totalResources
|
|
116
|
+
get currentResource(): number | undefined;
|
|
117
|
+
get mostRecentNavigatedTocItem(): string;
|
|
118
|
+
get totalResources(): number;
|
|
119
|
+
get publicationLanguage(): string[];
|
|
91
120
|
/**
|
|
92
121
|
* Settings
|
|
93
122
|
*/
|
|
94
|
-
get
|
|
95
|
-
resetUserSettings: () => Promise<void>;
|
|
96
|
-
applyUserSettings: (userSettings: Partial<UserSettings>) => Promise<void>;
|
|
97
|
-
currentSettings: () => {
|
|
123
|
+
get currentSettings(): {
|
|
98
124
|
appearance: string;
|
|
99
125
|
fontFamily: string;
|
|
100
126
|
textAlignment: string;
|
|
@@ -106,6 +132,8 @@ export default class D2Reader {
|
|
|
106
132
|
pageMargins: number;
|
|
107
133
|
lineHeight: number;
|
|
108
134
|
};
|
|
135
|
+
resetUserSettings: () => Promise<void>;
|
|
136
|
+
applyUserSettings: (userSettings: Partial<UserSettings>) => Promise<void>;
|
|
109
137
|
scroll: (value: boolean) => Promise<void>;
|
|
110
138
|
private isTTSIncrementable;
|
|
111
139
|
private isMOIncrementable;
|
|
@@ -127,11 +155,16 @@ export default class D2Reader {
|
|
|
127
155
|
* TTS Settings
|
|
128
156
|
*/
|
|
129
157
|
resetTTSSettings: () => void;
|
|
130
|
-
applyTTSSettings: (ttsSettings: ITTSUserSettings) => void
|
|
131
|
-
|
|
132
|
-
|
|
158
|
+
applyTTSSettings: (ttsSettings: Partial<ITTSUserSettings>) => Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Disabled
|
|
161
|
+
*/
|
|
162
|
+
applyPreferredVoice: (value: string) => Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Media Overlay Settings
|
|
165
|
+
*/
|
|
133
166
|
resetMediaOverlaySettings: () => Promise<void>;
|
|
134
|
-
applyMediaOverlaySettings: (settings: IMediaOverlayUserSettings) => Promise<void>;
|
|
167
|
+
applyMediaOverlaySettings: (settings: Partial<IMediaOverlayUserSettings>) => Promise<void>;
|
|
135
168
|
/**
|
|
136
169
|
* Navigation
|
|
137
170
|
* @TODO : These should return promises that complete when they are done.
|
|
@@ -140,18 +173,24 @@ export default class D2Reader {
|
|
|
140
173
|
get positions(): any;
|
|
141
174
|
goTo: (locator: Locator) => Promise<void>;
|
|
142
175
|
goToPosition: (value: number) => Promise<void>;
|
|
143
|
-
nextResource: () =>
|
|
144
|
-
previousResource: () =>
|
|
176
|
+
nextResource: () => void;
|
|
177
|
+
previousResource: () => void;
|
|
145
178
|
nextPage: () => Promise<void>;
|
|
146
179
|
previousPage: () => Promise<void>;
|
|
147
|
-
atStart
|
|
148
|
-
atEnd
|
|
149
|
-
|
|
180
|
+
get atStart(): boolean;
|
|
181
|
+
get atEnd(): boolean;
|
|
182
|
+
snapToSelector: (selector: any) => Promise<void>;
|
|
150
183
|
/**
|
|
151
184
|
* You have attributes in the reader when you initialize it. You can set margin, navigationHeight etc...
|
|
152
185
|
* This is in case you change the attributes after initializing the reader.
|
|
153
186
|
*/
|
|
154
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;
|
|
155
194
|
/**
|
|
156
195
|
* Destructor:
|
|
157
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;
|