@d-i-t-a/reader 2.0.0-alpha.7 → 2.0.0-beta.12
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 +52088 -39870
- 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 +64 -1
- package/dist/reader.css +1 -4
- package/dist/reader.js +72 -515
- 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/Locator.d.ts +3 -18
- 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 +30 -18
- package/dist/types/modules/BookmarkModule.d.ts +24 -13
- package/dist/types/modules/ReaderModule.d.ts +1 -2
- package/dist/types/modules/TTS/TTSModule.d.ts +10 -35
- package/dist/types/modules/TTS/TTSModule2.d.ts +73 -0
- package/dist/types/modules/TTS/TTSSettings.d.ts +41 -17
- package/dist/types/modules/highlight/LayerSettings.d.ts +19 -0
- package/dist/types/modules/highlight/TextHighlighter.d.ts +57 -57
- package/dist/types/modules/highlight/common/highlight.d.ts +54 -2
- package/dist/types/modules/highlight/common/rect-utils.d.ts +2 -2
- package/dist/types/modules/highlight/common/selection.d.ts +8 -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 +20 -15
- package/dist/types/modules/mediaoverlays/MediaOverlaySettings.d.ts +21 -17
- package/dist/types/modules/pagebreak/PageBreakModule.d.ts +30 -0
- 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 +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 +72 -52
- package/dist/types/reader.d.ts +104 -49
- package/dist/types/store/Annotator.d.ts +16 -16
- package/dist/types/store/LocalAnnotator.d.ts +16 -16
- 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 -0
- 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 +9 -7
- package/dist/types/views/FixedBookView.d.ts +7 -4
- package/dist/types/views/ReflowableBookView.d.ts +4 -4
- package/package.json +16 -7
- package/dist/injectables/footnotes/footnotes.css +0 -53
- package/dist/injectables/footnotes/footnotes.js +0 -1828
- package/dist/injectables/footnotes/footnotes.js.map +0 -7
- package/dist/injectables/glossary/glossary.css +0 -27
- package/dist/injectables/glossary/glossary.js +0 -2814
- package/dist/injectables/glossary/glossary.js.map +0 -7
- package/dist/injectables/pagebreak/pagebreak.css +0 -59
- package/dist/types/modules/highlight/common/styles.d.ts +0 -35
package/dist/types/reader.d.ts
CHANGED
|
@@ -1,21 +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 TTSModule from "./modules/TTS/TTSModule";
|
|
13
|
-
import { ITTSUserSettings, TTSIncrementable, TTSSettings } from "./modules/TTS/TTSSettings";
|
|
14
|
-
import IFrameNavigator, { IFrameAttributes, ReaderConfig } from "./navigator/IFrameNavigator";
|
|
4
|
+
import { IMediaOverlayUserSettings, MediaOverlayIncrementable } from "./modules/mediaoverlays/MediaOverlaySettings";
|
|
5
|
+
import { ITTSUserSettings, TTSIncrementable } from "./modules/TTS/TTSSettings";
|
|
6
|
+
import { IFrameAttributes, ReaderConfig } from "./navigator/IFrameNavigator";
|
|
15
7
|
/**
|
|
16
8
|
* A class that, once instantiated using the public `.build` method,
|
|
17
9
|
* is the primary interface into the D2 Reader.
|
|
18
|
-
*
|
|
19
10
|
* @TODO :
|
|
20
11
|
* - Type all function arguments
|
|
21
12
|
* - DEV logger
|
|
@@ -24,44 +15,97 @@ import IFrameNavigator, { IFrameAttributes, ReaderConfig } from "./navigator/IFr
|
|
|
24
15
|
* - Testing
|
|
25
16
|
*/
|
|
26
17
|
export default class D2Reader {
|
|
27
|
-
readonly settings
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly ttsModule
|
|
34
|
-
readonly searchModule
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
38
|
-
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?;
|
|
39
33
|
private constructor();
|
|
34
|
+
addEventListener(): void;
|
|
40
35
|
/**
|
|
41
36
|
* The async builder.
|
|
42
37
|
*/
|
|
43
|
-
static
|
|
38
|
+
static load(initialConfig: ReaderConfig): Promise<D2Reader>;
|
|
44
39
|
/**
|
|
45
40
|
* Read Aloud
|
|
46
41
|
*/
|
|
42
|
+
/** Start TTS Read Aloud */
|
|
47
43
|
startReadAloud: () => void;
|
|
44
|
+
/** Start TTS Read Aloud */
|
|
48
45
|
stopReadAloud: () => void;
|
|
46
|
+
/** Start TTS Read Aloud */
|
|
49
47
|
pauseReadAloud: () => void;
|
|
48
|
+
/** Start TTS Read Aloud */
|
|
50
49
|
resumeReadAloud: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Read Along
|
|
52
|
+
*/
|
|
53
|
+
/** Start Media Overlay Read Along */
|
|
54
|
+
startReadAlong: () => void;
|
|
55
|
+
/** Stop Media Overlay Read Along */
|
|
56
|
+
stopReadAlong: () => void;
|
|
57
|
+
/** Pause Media Overlay Read Along */
|
|
58
|
+
pauseReadAlong: () => void;
|
|
59
|
+
/** Resume Media Overlay Read Along */
|
|
60
|
+
resumeReadAlong: () => void;
|
|
61
|
+
get hasMediaOverlays(): boolean;
|
|
51
62
|
/**
|
|
52
63
|
* Bookmarks and annotations
|
|
53
64
|
*/
|
|
65
|
+
/** Save bookmark by progression */
|
|
54
66
|
saveBookmark: () => Promise<any>;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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 */
|
|
87
|
+
deactivateMarker: () => void;
|
|
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;
|
|
62
103
|
/**
|
|
63
104
|
* Search
|
|
64
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 */
|
|
65
109
|
search: (term: string, current: boolean) => Promise<any>;
|
|
66
110
|
goToSearchIndex: (href: string, index: number, current: boolean) => Promise<void>;
|
|
67
111
|
goToSearchID: (href: string, index: number, current: boolean) => Promise<void>;
|
|
@@ -69,16 +113,14 @@ export default class D2Reader {
|
|
|
69
113
|
/**
|
|
70
114
|
* Resources
|
|
71
115
|
*/
|
|
72
|
-
currentResource
|
|
73
|
-
mostRecentNavigatedTocItem
|
|
74
|
-
totalResources
|
|
116
|
+
get currentResource(): number | undefined;
|
|
117
|
+
get mostRecentNavigatedTocItem(): string;
|
|
118
|
+
get totalResources(): number;
|
|
119
|
+
get publicationLanguage(): string[];
|
|
75
120
|
/**
|
|
76
121
|
* Settings
|
|
77
122
|
*/
|
|
78
|
-
get
|
|
79
|
-
resetUserSettings: () => Promise<void>;
|
|
80
|
-
applyUserSettings: (userSettings: Partial<UserSettings>) => Promise<void>;
|
|
81
|
-
currentSettings: () => {
|
|
123
|
+
get currentSettings(): {
|
|
82
124
|
appearance: string;
|
|
83
125
|
fontFamily: string;
|
|
84
126
|
textAlignment: string;
|
|
@@ -90,6 +132,8 @@ export default class D2Reader {
|
|
|
90
132
|
pageMargins: number;
|
|
91
133
|
lineHeight: number;
|
|
92
134
|
};
|
|
135
|
+
resetUserSettings: () => Promise<void>;
|
|
136
|
+
applyUserSettings: (userSettings: Partial<UserSettings>) => Promise<void>;
|
|
93
137
|
scroll: (value: boolean) => Promise<void>;
|
|
94
138
|
private isTTSIncrementable;
|
|
95
139
|
private isMOIncrementable;
|
|
@@ -111,11 +155,16 @@ export default class D2Reader {
|
|
|
111
155
|
* TTS Settings
|
|
112
156
|
*/
|
|
113
157
|
resetTTSSettings: () => void;
|
|
114
|
-
applyTTSSettings: (ttsSettings: ITTSUserSettings) => void
|
|
115
|
-
|
|
116
|
-
|
|
158
|
+
applyTTSSettings: (ttsSettings: Partial<ITTSUserSettings>) => Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Disabled
|
|
161
|
+
*/
|
|
162
|
+
applyPreferredVoice: (value: string) => Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Media Overlay Settings
|
|
165
|
+
*/
|
|
117
166
|
resetMediaOverlaySettings: () => Promise<void>;
|
|
118
|
-
applyMediaOverlaySettings: (settings: IMediaOverlayUserSettings) => Promise<void>;
|
|
167
|
+
applyMediaOverlaySettings: (settings: Partial<IMediaOverlayUserSettings>) => Promise<void>;
|
|
119
168
|
/**
|
|
120
169
|
* Navigation
|
|
121
170
|
* @TODO : These should return promises that complete when they are done.
|
|
@@ -124,18 +173,24 @@ export default class D2Reader {
|
|
|
124
173
|
get positions(): any;
|
|
125
174
|
goTo: (locator: Locator) => Promise<void>;
|
|
126
175
|
goToPosition: (value: number) => Promise<void>;
|
|
127
|
-
nextResource: () =>
|
|
128
|
-
previousResource: () =>
|
|
176
|
+
nextResource: () => void;
|
|
177
|
+
previousResource: () => void;
|
|
129
178
|
nextPage: () => Promise<void>;
|
|
130
179
|
previousPage: () => Promise<void>;
|
|
131
|
-
atStart
|
|
132
|
-
atEnd
|
|
133
|
-
|
|
180
|
+
get atStart(): boolean;
|
|
181
|
+
get atEnd(): boolean;
|
|
182
|
+
snapToSelector: (selector: any) => Promise<void>;
|
|
134
183
|
/**
|
|
135
184
|
* You have attributes in the reader when you initialize it. You can set margin, navigationHeight etc...
|
|
136
185
|
* This is in case you change the attributes after initializing the reader.
|
|
137
186
|
*/
|
|
138
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;
|
|
139
194
|
/**
|
|
140
195
|
* Destructor:
|
|
141
196
|
* Only used in react applications because when they re-visit the page
|
|
@@ -1,22 +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
|
-
|
|
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;
|
|
20
20
|
}
|
|
21
21
|
export declare enum AnnotationType {
|
|
22
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,19 +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):
|
|
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;
|
|
31
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;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
import { IFrameNavigator } from "../navigator/IFrameNavigator";
|
|
2
|
+
import { Popup } from "../modules/search/Popup";
|
|
1
3
|
export declare function addEventListenerOptional(element: any, eventType: string, eventListener: any): void;
|
|
2
4
|
export declare function removeEventListenerOptional(element: any, eventType: string, eventListener: any): void;
|
|
3
5
|
export default class EventHandler {
|
|
6
|
+
navigator: IFrameNavigator;
|
|
7
|
+
popup: Popup;
|
|
8
|
+
constructor(navigator: IFrameNavigator);
|
|
4
9
|
onInternalLink: (event: UIEvent) => void;
|
|
5
10
|
onClickThrough: (event: UIEvent) => void;
|
|
6
11
|
setupEvents(element: HTMLElement | Document | null): void;
|
|
7
12
|
private checkForLink;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* This function checks the user clicked link inside the iframe
|
|
16
|
+
* against the readingOrder list, it is an internal link if found.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
private isEpubInternal;
|
|
8
20
|
private handleLinks;
|
|
9
21
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/** Returns a single element matching the selector within the parentElement,
|
|
2
2
|
or null if no element matches. */
|
|
3
|
-
export declare function findElement(parentElement: Element | Document, selector: string):
|
|
3
|
+
export declare function findElement(parentElement: Element | Document, selector: string): any | null;
|
|
4
4
|
/** Returns a single element matching the selector within the parent element,
|
|
5
5
|
or throws an exception if no element matches. */
|
|
6
|
-
export declare function findRequiredElement(parentElement: Element | Document, selector: string):
|
|
6
|
+
export declare function findRequiredElement(parentElement: Element | Document, selector: string): any;
|
|
7
7
|
/** Returns a single element matching the selector within the parentElement in the iframe context,
|
|
8
8
|
or null if no element matches. */
|
|
9
9
|
export declare function findIframeElement(parentElement: Document | null, selector: string): Element | null;
|
|
10
10
|
/** Returns a single element matching the selector within the parent element in an iframe context,
|
|
11
11
|
or throws an exception if no element matches. */
|
|
12
|
-
export declare function findRequiredIframeElement(parentElement: Document
|
|
12
|
+
export declare function findRequiredIframeElement(parentElement: Document, selector: string): Element;
|
|
13
13
|
/** Sets an attribute and its value for an HTML element */
|
|
14
14
|
export declare function setAttr(element: HTMLElement, attr: string, value: string): void;
|
|
15
15
|
/** Removes an attribute for an HTML element */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const WIDTH_ATTR: number;
|
|
2
2
|
export declare const HEIGHT_ATTR: number;
|
|
3
3
|
export declare const VIEWBOX_ATTR: string;
|
|
4
|
+
export declare const iconTemplateColored: (id: string, title: string, path: string, classAttr: string | undefined, size: number, fill: string) => string;
|
|
4
5
|
export declare const icons: {
|
|
5
6
|
error: string;
|
|
6
7
|
home: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import IFrameNavigator from "../navigator/IFrameNavigator";
|
|
1
|
+
import { IFrameNavigator } from "../navigator/IFrameNavigator";
|
|
2
2
|
export default class KeyboardEventHandler {
|
|
3
3
|
delegate: IFrameNavigator;
|
|
4
4
|
onBackwardSwipe: (event: UIEvent) => void;
|
|
5
5
|
onForwardSwipe: (event: UIEvent) => void;
|
|
6
|
-
setupEvents: (element: HTMLElement | Document) => void;
|
|
6
|
+
setupEvents: (element: HTMLElement | Document | null) => void;
|
|
7
7
|
focusin: (element: HTMLElement | Document) => void;
|
|
8
8
|
keydown: (element: HTMLElement | Document) => void;
|
|
9
9
|
}
|
|
@@ -4,5 +4,5 @@ export default class TouchEventHandler {
|
|
|
4
4
|
private static readonly SLOW_SWIPE_MS;
|
|
5
5
|
onBackwardSwipe: (event: UIEvent) => void;
|
|
6
6
|
onForwardSwipe: (event: UIEvent) => void;
|
|
7
|
-
setupEvents: (element: HTMLElement | Document) => void;
|
|
7
|
+
setupEvents: (element: HTMLElement | Document | null) => void;
|
|
8
8
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IFrameNavigator,
|
|
1
|
+
import { IFrameNavigator, IFrameAttributes } from "../navigator/IFrameNavigator";
|
|
2
2
|
interface BookView {
|
|
3
3
|
layout: string;
|
|
4
4
|
name: string;
|
|
@@ -7,24 +7,26 @@ interface BookView {
|
|
|
7
7
|
sideMargin: number;
|
|
8
8
|
height: number;
|
|
9
9
|
delegate: IFrameNavigator;
|
|
10
|
-
attributes
|
|
10
|
+
attributes?: IFrameAttributes;
|
|
11
11
|
setMode?(scroll: boolean): any;
|
|
12
|
-
isScrollMode
|
|
13
|
-
isPaginated
|
|
12
|
+
isScrollMode(): any;
|
|
13
|
+
isPaginated(): any;
|
|
14
14
|
goToElement?(element: HTMLElement | null, relative?: boolean): void;
|
|
15
|
+
setSize(): void;
|
|
15
16
|
setIframeHeight?(iframe: any): any;
|
|
17
|
+
setSize(): void;
|
|
16
18
|
getScreenHeight(): number;
|
|
17
19
|
/** Load this view in its book element, at the specified position. */
|
|
18
20
|
start(): void;
|
|
19
21
|
/** Remove this view from its book element. */
|
|
20
22
|
stop(): void;
|
|
21
23
|
getCurrentPosition(): number;
|
|
22
|
-
|
|
24
|
+
goToProgression(position: number): void;
|
|
23
25
|
goToFragment(fragment: string): void;
|
|
24
26
|
goToCssSelector(cssSelector: string): void;
|
|
25
27
|
snap(element: HTMLElement | null, relative?: boolean): void;
|
|
26
|
-
atStart
|
|
27
|
-
atEnd
|
|
28
|
+
atStart(): boolean;
|
|
29
|
+
atEnd(): boolean;
|
|
28
30
|
goToPreviousPage?(): void;
|
|
29
31
|
goToNextPage?(): void;
|
|
30
32
|
getCurrentPage(): number;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import IFrameNavigator, { IFrameAttributes } from "../navigator/IFrameNavigator";
|
|
1
|
+
import { IFrameNavigator, IFrameAttributes } from "../navigator/IFrameNavigator";
|
|
3
2
|
import BookView from "./BookView";
|
|
4
3
|
export default class FixedBookView implements BookView {
|
|
5
4
|
layout: string;
|
|
6
|
-
constructor(_store: Store);
|
|
7
5
|
delegate: IFrameNavigator;
|
|
8
6
|
name: string;
|
|
9
7
|
label: string;
|
|
@@ -16,10 +14,15 @@ export default class FixedBookView implements BookView {
|
|
|
16
14
|
stop(): void;
|
|
17
15
|
getCurrentPosition(): number;
|
|
18
16
|
getScreenHeight(): number;
|
|
19
|
-
|
|
17
|
+
goToProgression(_position: number): void;
|
|
20
18
|
goToCssSelector(_cssSelector: string, _relative?: boolean): void;
|
|
21
19
|
goToFragment(_fragment: string, _relative?: boolean): void;
|
|
22
20
|
snap(_element: HTMLElement, _relative?: boolean): void;
|
|
23
21
|
getCurrentPage(): number;
|
|
24
22
|
getPageCount(): number;
|
|
23
|
+
setSize(): void;
|
|
24
|
+
isPaginated(): boolean;
|
|
25
|
+
isScrollMode(): boolean;
|
|
26
|
+
atEnd(): boolean;
|
|
27
|
+
atStart(): boolean;
|
|
25
28
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UserProperty } from "../model/user-settings/UserProperties";
|
|
2
2
|
import Store from "../store/Store";
|
|
3
3
|
import BookView from "./BookView";
|
|
4
|
-
import
|
|
4
|
+
import { IFrameAttributes, IFrameNavigator } from "../navigator/IFrameNavigator";
|
|
5
5
|
export default class ReflowableBookView implements BookView {
|
|
6
6
|
layout: string;
|
|
7
7
|
private readonly USERSETTINGS;
|
|
@@ -19,7 +19,7 @@ export default class ReflowableBookView implements BookView {
|
|
|
19
19
|
start(): void;
|
|
20
20
|
stop(): void;
|
|
21
21
|
getCurrentPosition(): number;
|
|
22
|
-
|
|
22
|
+
goToProgression(position: number): void;
|
|
23
23
|
goToCssSelector(cssSelector: string, relative?: boolean): void;
|
|
24
24
|
goToFragment(fragment: string, relative?: boolean): void;
|
|
25
25
|
snap(element: HTMLElement | null, _relative?: boolean): void;
|
|
@@ -32,12 +32,12 @@ export default class ReflowableBookView implements BookView {
|
|
|
32
32
|
getPageCount(): number;
|
|
33
33
|
isPaginated(): boolean;
|
|
34
34
|
isScrollMode(): boolean;
|
|
35
|
-
getProperty(name: string): Promise<UserProperty>;
|
|
35
|
+
getProperty(name: string): Promise<UserProperty | null>;
|
|
36
36
|
getScreenHeight(): number;
|
|
37
37
|
setIframeHeight(iframe: any): void;
|
|
38
38
|
protected hasFixedScrollWidth: boolean;
|
|
39
39
|
protected checkForFixedScrollWidth(): void;
|
|
40
|
-
|
|
40
|
+
setSize(): void;
|
|
41
41
|
/** Returns the total width of the columns that are currently
|
|
42
42
|
positioned to the left of the iframe viewport. */
|
|
43
43
|
private getLeftColumnsWidth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-i-t-a/reader",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-beta.12",
|
|
4
4
|
"description": "A viewer application for EPUB files.",
|
|
5
5
|
"repository": "https://github.com/d-i-t-a/R2D2BC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
"clean": "rimraf node_modules dist parcel-dist .parcel-cache",
|
|
18
18
|
"dev": "ts-node -T build.ts -w",
|
|
19
19
|
"build": "ts-node -T build.ts",
|
|
20
|
-
"start": "node dev-server.js",
|
|
21
20
|
"sass": "node-sass --source-map true src/styles/sass/ -o dist/",
|
|
22
|
-
"examples": "
|
|
21
|
+
"examples": "npx ts-node examples/server.ts",
|
|
23
22
|
"lint": "eslint '*/**/*.{js,ts,tsx}' --fix",
|
|
24
23
|
"example:react": "parcel examples/react/index.html --dist-dir parcel-dist"
|
|
25
24
|
},
|
|
@@ -27,12 +26,15 @@
|
|
|
27
26
|
"browserslist-useragent": "^3.0.3",
|
|
28
27
|
"cssesc": "^3.0.0",
|
|
29
28
|
"detect-browser": "^5.2.0",
|
|
30
|
-
"devtools-detector": "^2.0.
|
|
29
|
+
"devtools-detector": "^2.0.6",
|
|
31
30
|
"jscrypto": "0.0.1",
|
|
31
|
+
"lodash.clonedeep": "^4.5.0",
|
|
32
32
|
"mark.js": "^8.11.1",
|
|
33
33
|
"promise-polyfill": "^8.2.0",
|
|
34
34
|
"r2-shared-js": "^1.0.51",
|
|
35
|
+
"recursive-readdir": "^2.2.2",
|
|
35
36
|
"sanitize-html": "^2.3.3",
|
|
37
|
+
"sentence-splitter": "^3.2.1",
|
|
36
38
|
"util": "^0.12.4",
|
|
37
39
|
"whatwg-fetch": "^3.6.2"
|
|
38
40
|
},
|
|
@@ -71,6 +73,7 @@
|
|
|
71
73
|
"@types/uuid": "^8.3.0",
|
|
72
74
|
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
|
73
75
|
"@typescript-eslint/parser": "^4.21.0",
|
|
76
|
+
"ansi-regex": ">=5.0.1",
|
|
74
77
|
"babel-eslint": "^10.1.0",
|
|
75
78
|
"braces": ">=3.0.2",
|
|
76
79
|
"browserslist-useragent-regexp": "^3.0.0",
|
|
@@ -81,6 +84,7 @@
|
|
|
81
84
|
"cpx": "^1.2.1",
|
|
82
85
|
"debounce": "^1.2.1",
|
|
83
86
|
"dita-streamer-js": "^1.1.1",
|
|
87
|
+
"ecstatic": ">=4.1.3",
|
|
84
88
|
"esbuild": "^0.12.11",
|
|
85
89
|
"eslint": "^7.23.0",
|
|
86
90
|
"eslint-config-prettier": "^8.1.0",
|
|
@@ -92,10 +96,12 @@
|
|
|
92
96
|
"eslint-plugin-react": "^7.23.2",
|
|
93
97
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
94
98
|
"express": "^4.17.1",
|
|
99
|
+
"glob-parent": ">=5.1.2",
|
|
100
|
+
"json-schema": ">=0.4.0",
|
|
95
101
|
"materialize-css": "^1.0.0",
|
|
96
102
|
"minimist": ">=1.2.5",
|
|
97
103
|
"mocha": "^8.3.2",
|
|
98
|
-
"node-sass": "^
|
|
104
|
+
"node-sass": "^7.0.0",
|
|
99
105
|
"npm-force-resolutions": "0.0.10",
|
|
100
106
|
"parcel": "^2.0.0-beta.2",
|
|
101
107
|
"prettier": "^2.2.1",
|
|
@@ -108,9 +114,12 @@
|
|
|
108
114
|
"rimraf": "^3.0.2",
|
|
109
115
|
"sinon": "^10.0.0",
|
|
110
116
|
"ta-json-x": "^2.5.3",
|
|
117
|
+
"tar": ">=6.1.9",
|
|
111
118
|
"ts-loader": "^8.0.18",
|
|
112
|
-
"ts-node": "^10.
|
|
113
|
-
"
|
|
119
|
+
"ts-node": "^10.4.0",
|
|
120
|
+
"typedoc": "^0.22.5",
|
|
121
|
+
"typedoc-plugin-rename-defaults": "^0.4.0",
|
|
122
|
+
"typescript": "^4.5.2"
|
|
114
123
|
},
|
|
115
124
|
"files": [
|
|
116
125
|
"dist"
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2018-2020 DITA (AM Consulting LLC)
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
* Developed on behalf of: DITA
|
|
17
|
-
* Licensed to: Bokbasen AS and CAST under one or more contributor license agreements.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
.modal {
|
|
21
|
-
display: none;
|
|
22
|
-
position: fixed;
|
|
23
|
-
z-index: 1;
|
|
24
|
-
left: 0;
|
|
25
|
-
top: 0;
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
overflow: auto;
|
|
29
|
-
background-color: rgb(0, 0, 0);
|
|
30
|
-
background-color: rgba(0, 0, 0, 0.4);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.modal-content {
|
|
34
|
-
position: relative;
|
|
35
|
-
background-color: #fefefe;
|
|
36
|
-
margin: auto;
|
|
37
|
-
padding: 20px;
|
|
38
|
-
border: 1px solid #888;
|
|
39
|
-
width: 300px;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.close {
|
|
43
|
-
color: #aaaaaa;
|
|
44
|
-
float: right;
|
|
45
|
-
font-size: 28px;
|
|
46
|
-
font-weight: bold;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.close:hover, .close:focus {
|
|
50
|
-
color: #000;
|
|
51
|
-
text-decoration: none;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
}
|