@d-i-t-a/reader 2.1.0-beta.1 → 2.1.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 +963 -769
- package/dist/esm/index.js.map +3 -3
- package/dist/injectables/click/click.js.map +1 -1
- package/dist/injectables/style/popup.css +2 -2
- package/dist/injectables/style/style.css +6 -0
- package/dist/reader.css +1 -1216
- package/dist/reader.css.map +1 -0
- package/dist/reader.js +42 -44
- package/dist/reader.js.map +3 -3
- package/dist/types/model/Locator.d.ts +2 -5
- package/dist/types/model/Publication.d.ts +5 -5
- package/dist/types/model/user-settings/UserSettings.d.ts +5 -6
- package/dist/types/modules/AnnotationModule.d.ts +9 -2
- package/dist/types/modules/BookmarkModule.d.ts +2 -2
- package/dist/types/modules/TTS/TTSModule2.d.ts +2 -2
- package/dist/types/modules/TTS/TTSSettings.d.ts +1 -1
- package/dist/types/modules/citation/CitationModule.d.ts +6 -0
- package/dist/types/modules/highlight/TextHighlighter.d.ts +6 -2
- package/dist/types/modules/highlight/common/highlight.d.ts +2 -1
- package/dist/types/modules/protection/ContentProtectionModule.d.ts +2 -2
- package/dist/types/modules/search/SearchModule.d.ts +1 -0
- package/dist/types/navigator/IFrameNavigator.d.ts +30 -36
- package/dist/types/store/Annotator.d.ts +4 -0
- package/dist/types/store/LocalAnnotator.d.ts +5 -0
- package/dist/types/utils/HTMLTemplates.d.ts +0 -2
- package/dist/types/utils/index.d.ts +0 -5
- package/package.json +13 -10
- package/dist/reader.map.css +0 -21
|
@@ -31,14 +31,11 @@ export declare enum AnnotationMarker {
|
|
|
31
31
|
Highlight = 0,
|
|
32
32
|
Underline = 1,
|
|
33
33
|
Bookmark = 2,
|
|
34
|
-
Custom = 3
|
|
34
|
+
Custom = 3,
|
|
35
|
+
Comment = 4
|
|
35
36
|
}
|
|
36
37
|
export interface Annotation extends Locator {
|
|
37
38
|
id?: any;
|
|
38
39
|
created: Date;
|
|
39
40
|
highlight?: IHighlight;
|
|
40
41
|
}
|
|
41
|
-
export interface ChapterWeight {
|
|
42
|
-
chapterHref: string;
|
|
43
|
-
weight: number;
|
|
44
|
-
}
|
|
@@ -2,7 +2,7 @@ import { Locator } from "./Locator";
|
|
|
2
2
|
import { Link } from "./Link";
|
|
3
3
|
import { Publication as R2Publication } from "r2-shared-js/dist/es6-es2015/src/models/publication";
|
|
4
4
|
import { Link as R2Link } from "r2-shared-js/dist/es6-es2015/src/models/publication-link";
|
|
5
|
-
import { GetContentBytesLength } from "../navigator/IFrameNavigator";
|
|
5
|
+
import { GetContentBytesLength, RequestConfig } from "../navigator/IFrameNavigator";
|
|
6
6
|
import { SampleRead } from "../navigator/IFrameNavigator";
|
|
7
7
|
export declare class Publication extends R2Publication {
|
|
8
8
|
manifestUrl: URL;
|
|
@@ -11,7 +11,7 @@ export declare class Publication extends R2Publication {
|
|
|
11
11
|
/**
|
|
12
12
|
* Initialize a publication from a manifest URL
|
|
13
13
|
*/
|
|
14
|
-
static fromUrl(url: URL): Promise<Publication>;
|
|
14
|
+
static fromUrl(url: URL, requestConfig?: RequestConfig): Promise<Publication>;
|
|
15
15
|
get readingOrder(): Link[];
|
|
16
16
|
get resources(): Link[];
|
|
17
17
|
get tableOfContents(): R2Link[];
|
|
@@ -39,13 +39,13 @@ export declare class Publication extends R2Publication {
|
|
|
39
39
|
* Fetches the contents to build up the positions manually,
|
|
40
40
|
* at least for fluid layout pubs
|
|
41
41
|
*/
|
|
42
|
-
autoGeneratePositions(getContentBytesLength?: GetContentBytesLength): Promise<void>;
|
|
42
|
+
autoGeneratePositions(requestConfig?: RequestConfig, getContentBytesLength?: GetContentBytesLength): Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* Fetches the positions from a given service href
|
|
45
45
|
*/
|
|
46
|
-
fetchPositionsFromService(href: string): Promise<void>;
|
|
46
|
+
fetchPositionsFromService(href: string, requestConfig?: RequestConfig): Promise<void>;
|
|
47
47
|
/**
|
|
48
48
|
* Fetches weights from a given service href
|
|
49
49
|
*/
|
|
50
|
-
fetchWeightsFromService(href: string): Promise<void>;
|
|
50
|
+
fetchWeightsFromService(href: string, requestConfig?: RequestConfig): Promise<void>;
|
|
51
51
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import Store from "../../store/Store";
|
|
2
2
|
import { UserProperties, UserProperty, UserSettingsIncrementable } from "./UserProperties";
|
|
3
|
-
import { Injectable, NavigatorAPI
|
|
3
|
+
import { Injectable, NavigatorAPI } from "../../navigator/IFrameNavigator";
|
|
4
4
|
import BookView from "../../views/BookView";
|
|
5
5
|
export interface UserSettingsConfig {
|
|
6
6
|
/** Store to save the user's selections in. */
|
|
7
7
|
store: Store;
|
|
8
8
|
initialUserSettings: InitialUserSettings;
|
|
9
9
|
headerMenu?: HTMLElement | null;
|
|
10
|
-
|
|
11
|
-
api?: NavigatorAPI;
|
|
10
|
+
api?: Partial<NavigatorAPI>;
|
|
12
11
|
injectables?: Array<Injectable>;
|
|
13
12
|
layout: string;
|
|
14
13
|
}
|
|
@@ -86,18 +85,18 @@ export declare class UserSettings implements IUserSettings {
|
|
|
86
85
|
private viewChangeCallback;
|
|
87
86
|
private settingsView;
|
|
88
87
|
private readonly headerMenu?;
|
|
89
|
-
api?: NavigatorAPI
|
|
88
|
+
api?: Partial<NavigatorAPI>;
|
|
90
89
|
injectables?: Array<Injectable>;
|
|
91
90
|
private iframe;
|
|
92
91
|
static create(config: UserSettingsConfig): Promise<any>;
|
|
93
|
-
protected constructor(store: Store, headerMenu?: HTMLElement | null, api?: NavigatorAPI
|
|
92
|
+
protected constructor(store: Store, headerMenu?: HTMLElement | null, api?: Partial<NavigatorAPI>, injectables?: Array<Injectable>, layout?: string);
|
|
94
93
|
stop(): void;
|
|
95
94
|
private initialise;
|
|
96
95
|
private reset;
|
|
97
96
|
private initializeSelections;
|
|
98
97
|
applyProperties(): Promise<any>;
|
|
99
98
|
setIframe(iframe: HTMLIFrameElement): void;
|
|
100
|
-
private renderControls;
|
|
99
|
+
private static renderControls;
|
|
101
100
|
onSettingsChange(callback: () => void): void;
|
|
102
101
|
onColumnSettingsChange(callback: () => void): void;
|
|
103
102
|
onViewChange(callback: () => void): void;
|
|
@@ -11,15 +11,17 @@ export interface AnnotationModuleAPI {
|
|
|
11
11
|
deleteAnnotation: Highlight;
|
|
12
12
|
updateAnnotation: Highlight;
|
|
13
13
|
selectedAnnotation: Highlight;
|
|
14
|
+
addCommentToAnnotation: Highlight;
|
|
14
15
|
}
|
|
15
16
|
export interface AnnotationModuleProperties {
|
|
16
17
|
initialAnnotationColor?: string;
|
|
17
18
|
hideLayer?: boolean;
|
|
19
|
+
enableComments?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export interface AnnotationModuleConfig extends AnnotationModuleProperties {
|
|
20
22
|
annotator: Annotator;
|
|
21
23
|
headerMenu?: HTMLElement | null;
|
|
22
|
-
rights: ReaderRights
|
|
24
|
+
rights: Partial<ReaderRights>;
|
|
23
25
|
publication: Publication;
|
|
24
26
|
delegate: IFrameNavigator;
|
|
25
27
|
initialAnnotations?: any;
|
|
@@ -31,6 +33,7 @@ export declare class AnnotationModule implements ReaderModule {
|
|
|
31
33
|
private rights;
|
|
32
34
|
private publication;
|
|
33
35
|
private highlightsView;
|
|
36
|
+
private commentGutter?;
|
|
34
37
|
private readonly headerMenu?;
|
|
35
38
|
private readonly highlighter?;
|
|
36
39
|
private readonly initialAnnotations;
|
|
@@ -40,7 +43,7 @@ export declare class AnnotationModule implements ReaderModule {
|
|
|
40
43
|
activeAnnotationMarkerId?: string;
|
|
41
44
|
activeAnnotationMarkerPosition?: string;
|
|
42
45
|
static create(config: AnnotationModuleConfig): Promise<AnnotationModule>;
|
|
43
|
-
constructor(annotator: Annotator, rights: ReaderRights
|
|
46
|
+
constructor(annotator: Annotator, rights: Partial<ReaderRights>, publication: Publication, delegate: IFrameNavigator, initialAnnotations: any, properties: AnnotationModuleProperties, highlighter: TextHighlighter, api?: AnnotationModuleAPI, headerMenu?: HTMLElement | null);
|
|
44
47
|
stop(): Promise<void>;
|
|
45
48
|
protected start(): Promise<void>;
|
|
46
49
|
private hide;
|
|
@@ -62,10 +65,14 @@ export declare class AnnotationModule implements ReaderModule {
|
|
|
62
65
|
getAnnotations(): any;
|
|
63
66
|
showHighlights(): void;
|
|
64
67
|
drawHighlights(): Promise<void>;
|
|
68
|
+
repositionGutters(): any;
|
|
65
69
|
private createTree;
|
|
66
70
|
private handleAnnotationLinkClick;
|
|
67
71
|
private handleAnnotationLinkDeleteClick;
|
|
68
72
|
private static readableTimestamp;
|
|
69
73
|
getAnnotation(highlight: IHighlight): Promise<any>;
|
|
70
74
|
getAnnotationByID(id: string): Promise<any>;
|
|
75
|
+
syncPosition(highlights: Array<any>): any;
|
|
76
|
+
reposition(highlights: Array<any>): any;
|
|
71
77
|
}
|
|
78
|
+
export declare function repositionHighlights(highlights: Array<any>): any;
|
|
@@ -14,7 +14,7 @@ export interface BookmarkModuleProperties {
|
|
|
14
14
|
export interface BookmarkModuleConfig extends BookmarkModuleProperties {
|
|
15
15
|
annotator: Annotator;
|
|
16
16
|
headerMenu?: HTMLElement | null;
|
|
17
|
-
rights: ReaderRights
|
|
17
|
+
rights: Partial<ReaderRights>;
|
|
18
18
|
publication: Publication;
|
|
19
19
|
delegate: IFrameNavigator;
|
|
20
20
|
initialAnnotations?: any;
|
|
@@ -33,7 +33,7 @@ export declare class BookmarkModule implements ReaderModule {
|
|
|
33
33
|
private readonly properties;
|
|
34
34
|
private readonly api?;
|
|
35
35
|
static create(config: BookmarkModuleConfig): Promise<any>;
|
|
36
|
-
constructor(annotator: Annotator, rights: ReaderRights
|
|
36
|
+
constructor(annotator: Annotator, rights: Partial<ReaderRights>, publication: Publication, delegate: IFrameNavigator, properties: BookmarkModuleProperties, initialAnnotations?: any, api?: BookmarkModuleAPI, headerMenu?: HTMLElement | null);
|
|
37
37
|
stop(): void;
|
|
38
38
|
protected start(): Promise<void>;
|
|
39
39
|
handleResize(): Promise<void>;
|
|
@@ -30,7 +30,7 @@ export declare class TTSModule2 implements ReaderModule {
|
|
|
30
30
|
speakPause(): void;
|
|
31
31
|
speakResume(): void;
|
|
32
32
|
static create(config: TTSModuleConfig): Promise<TTSModule2>;
|
|
33
|
-
constructor(delegate: IFrameNavigator, tts: TTSSettings, rights: ReaderRights
|
|
33
|
+
constructor(delegate: IFrameNavigator, tts: TTSSettings, rights: Partial<ReaderRights>, highlighter: TextHighlighter, properties: TTSModuleProperties, api?: TTSModuleAPI, headerMenu?: HTMLElement | null);
|
|
34
34
|
protected start(): Promise<void>;
|
|
35
35
|
userScrolled: boolean;
|
|
36
36
|
scrollPartial: boolean;
|
|
@@ -48,7 +48,7 @@ export declare class TTSModule2 implements ReaderModule {
|
|
|
48
48
|
ttsPlayQueueIndexDebounced: ((ttsQueueIndex: number, ttsQueue: any) => void) & {
|
|
49
49
|
clear(): void;
|
|
50
50
|
};
|
|
51
|
-
updateTTSInfo(ttsQueueItem: any, charIndex: number, charLength: number, utteranceText: string | undefined): string | undefined;
|
|
51
|
+
updateTTSInfo(ttsQueueItem: any, charIndex: number, charLength: number, startIndex: number, utteranceText: string | undefined): string | undefined;
|
|
52
52
|
_ttsQueueItemHighlightsWord: IHighlight | undefined;
|
|
53
53
|
wrapHighlightWord(ttsQueueItemRef: ITtsQueueItemReference, utteranceText: string, charIndex: number, charLength: number, word: string, start: number, end: number): void;
|
|
54
54
|
}
|
|
@@ -21,7 +21,7 @@ export interface TTSModuleProperties {
|
|
|
21
21
|
}
|
|
22
22
|
export interface TTSModuleConfig extends TTSModuleProperties {
|
|
23
23
|
delegate: IFrameNavigator;
|
|
24
|
-
rights: ReaderRights
|
|
24
|
+
rights: Partial<ReaderRights>;
|
|
25
25
|
tts: TTSSettings;
|
|
26
26
|
highlighter: TextHighlighter;
|
|
27
27
|
headerMenu?: HTMLElement | null;
|
|
@@ -20,16 +20,22 @@ export interface CitationModuleProperties {
|
|
|
20
20
|
library?: string;
|
|
21
21
|
styles?: string[];
|
|
22
22
|
}
|
|
23
|
+
export interface CitationModuleAPI {
|
|
24
|
+
citationCreated: any;
|
|
25
|
+
citationFailed: any;
|
|
26
|
+
}
|
|
23
27
|
export interface CitationModuleConfig extends CitationModuleProperties {
|
|
24
28
|
publication: Publication;
|
|
25
29
|
delegate: IFrameNavigator;
|
|
26
30
|
highlighter: TextHighlighter;
|
|
31
|
+
api?: CitationModuleAPI;
|
|
27
32
|
}
|
|
28
33
|
export default class CitationModule implements ReaderModule {
|
|
29
34
|
private publication;
|
|
30
35
|
private delegate;
|
|
31
36
|
private properties;
|
|
32
37
|
private readonly highlighter?;
|
|
38
|
+
api?: CitationModuleAPI;
|
|
33
39
|
private constructor();
|
|
34
40
|
static create(config: CitationModuleConfig): Promise<CitationModule>;
|
|
35
41
|
stop(): Promise<void>;
|
|
@@ -11,7 +11,8 @@ export declare enum HighlightContainer {
|
|
|
11
11
|
R2_ID_PAGEBREAK_CONTAINER = "R2_ID_PAGEBREAK_CONTAINER",
|
|
12
12
|
R2_ID_SEARCH_CONTAINER = "R2_ID_SEARCH_CONTAINER",
|
|
13
13
|
R2_ID_DEFINITIONS_CONTAINER = "R2_ID_DEFINITIONS_CONTAINER",
|
|
14
|
-
R2_ID_LINEFOCUS_CONTAINER = "R2_ID_LINEFOCUS_CONTAINER"
|
|
14
|
+
R2_ID_LINEFOCUS_CONTAINER = "R2_ID_LINEFOCUS_CONTAINER",
|
|
15
|
+
R2_ID_GUTTER_RIGHT_CONTAINER = "R2_ID_GUTTER_RIGHT_CONTAINER"
|
|
15
16
|
}
|
|
16
17
|
export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
|
|
17
18
|
export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
|
|
@@ -149,7 +150,10 @@ export declare class TextHighlighter {
|
|
|
149
150
|
initializeToolbox(): void;
|
|
150
151
|
toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
|
|
151
152
|
toolboxHide(): void;
|
|
152
|
-
toolboxShowDelayed(
|
|
153
|
+
toolboxShowDelayed(event: TouchEvent | MouseEvent): void;
|
|
154
|
+
showTool: ((b: boolean) => void) & {
|
|
155
|
+
clear(): void;
|
|
156
|
+
};
|
|
153
157
|
snapSelectionToWord(trimmed?: boolean): any;
|
|
154
158
|
toolboxShow(): void;
|
|
155
159
|
isSelectionMenuOpen: boolean;
|
|
@@ -13,7 +13,7 @@ export interface ContentProtectionModuleProperties {
|
|
|
13
13
|
disableContextMenu: boolean;
|
|
14
14
|
hideTargetUrl: boolean;
|
|
15
15
|
disableDrag: boolean;
|
|
16
|
-
supportedBrowsers: [];
|
|
16
|
+
supportedBrowsers: string[];
|
|
17
17
|
}
|
|
18
18
|
export interface ContentProtectionModuleConfig extends Partial<ContentProtectionModuleProperties> {
|
|
19
19
|
delegate: IFrameNavigator;
|
|
@@ -41,7 +41,7 @@ export declare class ContentProtectionModule implements ReaderModule {
|
|
|
41
41
|
private securityContainer;
|
|
42
42
|
private mutationObserver;
|
|
43
43
|
private wrapper;
|
|
44
|
-
static setupPreloadProtection(config: ContentProtectionModuleConfig): Promise<void>;
|
|
44
|
+
static setupPreloadProtection(config: Partial<ContentProtectionModuleConfig>): Promise<void>;
|
|
45
45
|
static create(config: ContentProtectionModuleConfig): Promise<ContentProtectionModule>;
|
|
46
46
|
constructor(delegate: IFrameNavigator, properties?: ContentProtectionModuleProperties);
|
|
47
47
|
private static startInspectorProtection;
|
|
@@ -44,6 +44,7 @@ export declare class SearchModule implements ReaderModule {
|
|
|
44
44
|
goToSearchIndex(href: string, index: number, current: boolean): Promise<void>;
|
|
45
45
|
private handleSearchBook;
|
|
46
46
|
searchBook(term: string): Promise<any>;
|
|
47
|
+
decodeBase64(base64: any): string;
|
|
47
48
|
searchChapter(term: string): Promise<any>;
|
|
48
49
|
drawSearch(): void;
|
|
49
50
|
handleResize(): Promise<void>;
|
|
@@ -14,15 +14,17 @@ import { MediaOverlayModule, MediaOverlayModuleConfig } from "../modules/mediaov
|
|
|
14
14
|
import { D2Link, Link } from "../model/Link";
|
|
15
15
|
import { ReaderModule } from "../modules/ReaderModule";
|
|
16
16
|
import { TTSModuleConfig } from "../modules/TTS/TTSSettings";
|
|
17
|
-
import { PageBreakModuleConfig } from "../modules/pagebreak/PageBreakModule";
|
|
18
|
-
import { PageBreakModule } from "../modules/pagebreak/PageBreakModule";
|
|
17
|
+
import { PageBreakModule, PageBreakModuleConfig } from "../modules/pagebreak/PageBreakModule";
|
|
19
18
|
import { DefinitionsModule, DefinitionsModuleConfig } from "../modules/search/DefinitionsModule";
|
|
20
19
|
import EventEmitter from "eventemitter3";
|
|
21
20
|
import LineFocusModule, { LineFocusModuleConfig } from "../modules/linefocus/LineFocusModule";
|
|
22
21
|
import { HistoryModule } from "../modules/history/HistoryModule";
|
|
23
22
|
import CitationModule, { CitationModuleConfig } from "../modules/citation/CitationModule";
|
|
24
23
|
export declare type GetContent = (href: string) => Promise<string>;
|
|
25
|
-
export declare type GetContentBytesLength = (href: string) => Promise<number>;
|
|
24
|
+
export declare type GetContentBytesLength = (href: string, requestConfig?: RequestConfig) => Promise<number>;
|
|
25
|
+
export interface RequestConfig extends RequestInit {
|
|
26
|
+
encoded?: boolean;
|
|
27
|
+
}
|
|
26
28
|
export interface NavigatorAPI {
|
|
27
29
|
updateSettings: any;
|
|
28
30
|
getContent: GetContent;
|
|
@@ -34,11 +36,6 @@ export interface NavigatorAPI {
|
|
|
34
36
|
updateCurrentLocation: any;
|
|
35
37
|
onError?: (e: Error) => void;
|
|
36
38
|
}
|
|
37
|
-
export interface UpLinkConfig {
|
|
38
|
-
url?: URL;
|
|
39
|
-
label?: string;
|
|
40
|
-
ariaLabel?: string;
|
|
41
|
-
}
|
|
42
39
|
export interface IFrameAttributes {
|
|
43
40
|
margin: number;
|
|
44
41
|
navHeight?: number;
|
|
@@ -53,16 +50,15 @@ export interface IFrameNavigatorConfig {
|
|
|
53
50
|
publication: Publication;
|
|
54
51
|
settings: UserSettings;
|
|
55
52
|
annotator?: Annotator;
|
|
56
|
-
upLink?: UpLinkConfig;
|
|
57
53
|
initialLastReadingPosition?: ReadingPosition;
|
|
58
|
-
rights: ReaderRights
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
tts?: TTSModuleConfig;
|
|
54
|
+
rights: Partial<ReaderRights>;
|
|
55
|
+
api?: Partial<NavigatorAPI>;
|
|
56
|
+
tts?: Partial<TTSModuleConfig>;
|
|
62
57
|
injectables: Array<Injectable>;
|
|
63
58
|
attributes?: IFrameAttributes;
|
|
64
59
|
services?: PublicationServices;
|
|
65
60
|
sample?: SampleRead;
|
|
61
|
+
requestConfig?: RequestConfig;
|
|
66
62
|
}
|
|
67
63
|
export interface PublicationServices {
|
|
68
64
|
positions?: URL;
|
|
@@ -105,31 +101,31 @@ export interface ReaderUI {
|
|
|
105
101
|
settings: UserSettingsUIConfig;
|
|
106
102
|
}
|
|
107
103
|
export interface ReaderConfig {
|
|
104
|
+
publication?: any;
|
|
108
105
|
url: URL;
|
|
109
106
|
userSettings?: any;
|
|
110
107
|
initialAnnotations?: any;
|
|
111
108
|
lastReadingPosition?: any;
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
citations?: CitationModuleConfig;
|
|
126
|
-
highlighter?: TextHighlighterConfig;
|
|
109
|
+
rights?: Partial<ReaderRights>;
|
|
110
|
+
api?: Partial<NavigatorAPI>;
|
|
111
|
+
tts?: Partial<TTSModuleConfig>;
|
|
112
|
+
search?: Partial<SearchModuleConfig>;
|
|
113
|
+
define?: Partial<DefinitionsModuleConfig>;
|
|
114
|
+
protection?: Partial<ContentProtectionModuleConfig>;
|
|
115
|
+
mediaOverlays?: Partial<MediaOverlayModuleConfig>;
|
|
116
|
+
pagebreak?: Partial<PageBreakModuleConfig>;
|
|
117
|
+
annotations?: Partial<AnnotationModuleConfig>;
|
|
118
|
+
bookmarks?: Partial<BookmarkModuleConfig>;
|
|
119
|
+
lineFocus?: Partial<LineFocusModuleConfig>;
|
|
120
|
+
citations?: Partial<CitationModuleConfig>;
|
|
121
|
+
highlighter?: Partial<TextHighlighterConfig>;
|
|
127
122
|
injectables: Array<Injectable>;
|
|
128
|
-
injectablesFixed
|
|
123
|
+
injectablesFixed?: Array<Injectable>;
|
|
129
124
|
useLocalStorage?: boolean;
|
|
130
125
|
attributes?: IFrameAttributes;
|
|
131
126
|
services?: PublicationServices;
|
|
132
127
|
sample?: SampleRead;
|
|
128
|
+
requestConfig?: RequestConfig;
|
|
133
129
|
}
|
|
134
130
|
/** Class that shows webpub resources in an iframe, with navigation controls outside the iframe. */
|
|
135
131
|
export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
@@ -152,7 +148,6 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
152
148
|
historyModule?: HistoryModule;
|
|
153
149
|
citationModule?: CitationModule;
|
|
154
150
|
sideNavExpanded: boolean;
|
|
155
|
-
material: boolean;
|
|
156
151
|
currentChapterLink: D2Link;
|
|
157
152
|
currentSpreadLinks: {
|
|
158
153
|
left?: D2Link;
|
|
@@ -168,8 +163,6 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
168
163
|
private readonly touchEventHandler;
|
|
169
164
|
private readonly keyboardEventHandler;
|
|
170
165
|
private readonly sampleReadEventHandler;
|
|
171
|
-
private readonly upLinkConfig;
|
|
172
|
-
private upLink;
|
|
173
166
|
private nextChapterBottomAnchorElement;
|
|
174
167
|
private previousChapterTopAnchorElement;
|
|
175
168
|
private nextChapterAnchorElement;
|
|
@@ -200,16 +193,17 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
200
193
|
private isBeingStyled;
|
|
201
194
|
private isLoading;
|
|
202
195
|
private readonly initialLastReadingPosition?;
|
|
203
|
-
api?: NavigatorAPI
|
|
204
|
-
rights: ReaderRights
|
|
205
|
-
tts?: TTSModuleConfig
|
|
196
|
+
api?: Partial<NavigatorAPI>;
|
|
197
|
+
rights: Partial<ReaderRights>;
|
|
198
|
+
tts?: Partial<TTSModuleConfig>;
|
|
206
199
|
injectables?: Array<Injectable>;
|
|
207
200
|
attributes?: IFrameAttributes;
|
|
208
201
|
services?: PublicationServices;
|
|
209
202
|
sample?: SampleRead;
|
|
203
|
+
requestConfig?: RequestConfig;
|
|
210
204
|
private didInitKeyboardEventHandler;
|
|
211
205
|
static create(config: IFrameNavigatorConfig): Promise<IFrameNavigator>;
|
|
212
|
-
protected constructor(settings: UserSettings, annotator: Annotator | undefined,
|
|
206
|
+
protected constructor(settings: UserSettings, annotator: Annotator | undefined, initialLastReadingPosition: ReadingPosition | undefined, publication: Publication, api?: Partial<NavigatorAPI>, rights?: Partial<ReaderRights>, tts?: Partial<TTSModuleConfig>, injectables?: Array<Injectable>, attributes?: IFrameAttributes, services?: PublicationServices, sample?: SampleRead, requestConfig?: RequestConfig);
|
|
213
207
|
stop(): void;
|
|
214
208
|
spreads: HTMLDivElement;
|
|
215
209
|
firstSpread: HTMLDivElement;
|
|
@@ -17,6 +17,10 @@ interface Annotator {
|
|
|
17
17
|
getAnnotation(annotation: IHighlight): any;
|
|
18
18
|
getAnnotationByID(id: string): any;
|
|
19
19
|
getAnnotationPosition(id: any, iframeWin: any): any;
|
|
20
|
+
getAnnotationElement(id: any, iframeWin: any): any;
|
|
21
|
+
saveTemporarySelectionInfo(selectionInfo: any): any;
|
|
22
|
+
getTemporarySelectionInfo(doc: any): any;
|
|
23
|
+
deleteTemporarySelectionInfo(): any;
|
|
20
24
|
}
|
|
21
25
|
export declare enum AnnotationType {
|
|
22
26
|
Bookmark = 0,
|
|
@@ -11,6 +11,7 @@ export default class LocalAnnotator implements Annotator {
|
|
|
11
11
|
private static readonly LAST_READING_POSITION;
|
|
12
12
|
private static readonly BOOKMARKS;
|
|
13
13
|
private static readonly ANNOTATIONS;
|
|
14
|
+
private static readonly SELECTIONINFO;
|
|
14
15
|
constructor(config: LocalAnnotatorConfig);
|
|
15
16
|
getLastReadingPosition(): any;
|
|
16
17
|
initLastReadingPosition(position: ReadingPosition): void;
|
|
@@ -21,11 +22,15 @@ export default class LocalAnnotator implements Annotator {
|
|
|
21
22
|
deleteBookmark(bookmark: any): any;
|
|
22
23
|
getBookmarks(href?: string): any;
|
|
23
24
|
initAnnotations(list: any): any;
|
|
25
|
+
saveTemporarySelectionInfo(selectionInfo: any): void;
|
|
26
|
+
getTemporarySelectionInfo(doc: any): any;
|
|
27
|
+
deleteTemporarySelectionInfo(): void;
|
|
24
28
|
saveAnnotation(annotation: any): any;
|
|
25
29
|
deleteAnnotation(id: any): any;
|
|
26
30
|
deleteSelectedAnnotation(annotation: any): any;
|
|
27
31
|
getAnnotations(): any;
|
|
28
32
|
getAnnotationPosition(id: any, iframeWin: any): any;
|
|
33
|
+
getAnnotationElement(id: any, iframeWin: any): any;
|
|
29
34
|
getAnnotation(highlight: IHighlight): any;
|
|
30
35
|
getAnnotationByID(id: string): any;
|
|
31
36
|
}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
export declare const simpleUpLinkTemplate: (href: string, _label: string, ariaLabel: string) => string;
|
|
2
|
-
export declare const defaultUpLinkTemplate: (href: string, label: string, ariaLabel: string) => string;
|
|
3
1
|
export declare const readerLoading: string;
|
|
4
2
|
export declare const readerError: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-i-t-a/reader",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.10",
|
|
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,12 +17,14 @@
|
|
|
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
|
-
"sass": "
|
|
20
|
+
"sass:debug": "sass --source-map src/styles/sass/:dist",
|
|
21
|
+
"sass:release": "sass --style=compressed src/styles/sass/:dist",
|
|
21
22
|
"examples": "npx ts-node examples/server.ts",
|
|
22
23
|
"lint": "eslint '*/**/*.{js,ts,tsx}' --fix",
|
|
23
24
|
"example:react": "parcel examples/react/index.html --dist-dir parcel-dist"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
27
|
+
"@types/sass": "^1.43.1",
|
|
26
28
|
"browserslist-useragent": "^3.0.3",
|
|
27
29
|
"cssesc": "^3.0.0",
|
|
28
30
|
"detect-browser": "^5.2.0",
|
|
@@ -30,11 +32,13 @@
|
|
|
30
32
|
"eventemitter3": "^4.0.7",
|
|
31
33
|
"jscrypto": "^1.0.3",
|
|
32
34
|
"lodash.clonedeep": "^4.5.0",
|
|
35
|
+
"loglevel": "^1.8.0",
|
|
33
36
|
"mark.js": "^8.11.1",
|
|
34
37
|
"promise-polyfill": "^8.2.0",
|
|
35
38
|
"r2-shared-js": "^1.0.51",
|
|
36
39
|
"recursive-readdir": "^2.2.2",
|
|
37
40
|
"sanitize-html": "^2.3.3",
|
|
41
|
+
"sass": "^1.54.4",
|
|
38
42
|
"sentence-splitter": "^3.2.1",
|
|
39
43
|
"util": "^0.12.4",
|
|
40
44
|
"whatwg-fetch": "^3.6.2"
|
|
@@ -52,8 +56,8 @@
|
|
|
52
56
|
]
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
|
-
"@parcel/transformer-sass": "^2.
|
|
56
|
-
"@parcel/transformer-typescript-tsc": "^2.
|
|
59
|
+
"@parcel/transformer-sass": "^2.7.0",
|
|
60
|
+
"@parcel/transformer-typescript-tsc": "^2.7.0",
|
|
57
61
|
"@types/chai": "^4.2.15",
|
|
58
62
|
"@types/copy": "^0.3.1",
|
|
59
63
|
"@types/cssesc": "^3.0.0",
|
|
@@ -62,7 +66,6 @@
|
|
|
62
66
|
"@types/jquery": "^3.5.5",
|
|
63
67
|
"@types/mark.js": "^8.11.5",
|
|
64
68
|
"@types/mocha": "^8.2.2",
|
|
65
|
-
"@types/node-sass": "^4.11.1",
|
|
66
69
|
"@types/pako": "^1.0.1",
|
|
67
70
|
"@types/parse5": "^6.0.0",
|
|
68
71
|
"@types/promise-polyfill": "^6.0.3",
|
|
@@ -79,10 +82,9 @@
|
|
|
79
82
|
"browserslist-useragent-regexp": "^3.0.0",
|
|
80
83
|
"buffer": "^6.0.3",
|
|
81
84
|
"chai": "^4.3.4",
|
|
82
|
-
"chalk": "^4.1.
|
|
85
|
+
"chalk": "^4.1.2",
|
|
83
86
|
"chokidar": "^3.5.2",
|
|
84
87
|
"copy": "^0.3.2",
|
|
85
|
-
"cpx": "^1.2.1",
|
|
86
88
|
"debounce": "^1.2.1",
|
|
87
89
|
"dita-streamer-js": "^1.1.3",
|
|
88
90
|
"ecstatic": "^4.1.4",
|
|
@@ -97,14 +99,15 @@
|
|
|
97
99
|
"eslint-plugin-react": "^7.29.4",
|
|
98
100
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
99
101
|
"express": "^4.17.1",
|
|
100
|
-
"glob-parent": ">=5.1.2",
|
|
101
102
|
"json-schema": ">=0.4.0",
|
|
102
103
|
"minimist": "^1.2.6",
|
|
103
104
|
"mocha": "^9.2.2",
|
|
104
105
|
"moment": "^2.29.3",
|
|
105
|
-
"node-sass": "^7.0.1",
|
|
106
106
|
"npm-force-resolutions": "0.0.10",
|
|
107
|
-
"parcel": "^2.
|
|
107
|
+
"parcel": "^2.7.0",
|
|
108
|
+
"parcel-config-precache-manifest": "^0.0.4",
|
|
109
|
+
"parcel-plugin-static-files-copy": "^2.6.0",
|
|
110
|
+
"parcel-reporter-static-files-copy": "^1.4.0",
|
|
108
111
|
"path-parse": "^1.0.7",
|
|
109
112
|
"prettier": "^2.2.1",
|
|
110
113
|
"process": "^0.11.10",
|