@d-i-t-a/reader 2.1.8 → 2.1.11-beta.1
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 +311 -246
- package/dist/esm/index.js.map +3 -3
- package/dist/reader.js +34 -34
- package/dist/reader.js.map +3 -3
- package/dist/types/modules/consumption/ConsumptionModule.d.ts +39 -0
- package/dist/types/modules/history/HistoryModule.d.ts +5 -3
- package/dist/types/navigator/IFrameNavigator.d.ts +4 -0
- package/dist/types/reader.d.ts +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ReaderModule } from "../ReaderModule";
|
|
2
|
+
import { Publication } from "../../model/Publication";
|
|
3
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
4
|
+
import { Locator } from "../../model/Locator";
|
|
5
|
+
export declare enum Action {
|
|
6
|
+
BookmarkCreated = "BookmarkCreated",
|
|
7
|
+
HighlightCreated = "HighlightCreated"
|
|
8
|
+
}
|
|
9
|
+
export interface ConsumptionModuleAPI {
|
|
10
|
+
progressTracked: any;
|
|
11
|
+
actionTracked: any;
|
|
12
|
+
}
|
|
13
|
+
export interface ConsumptionModuleProperties {
|
|
14
|
+
enableTrackingActions?: boolean;
|
|
15
|
+
actions?: Action[];
|
|
16
|
+
enableTrackingProgress?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface ConsumptionModuleConfig extends ConsumptionModuleProperties {
|
|
19
|
+
publication: Publication;
|
|
20
|
+
delegate: IFrameNavigator;
|
|
21
|
+
properties?: ConsumptionModuleProperties;
|
|
22
|
+
api?: ConsumptionModuleAPI;
|
|
23
|
+
}
|
|
24
|
+
export declare class ConsumptionModule implements ReaderModule {
|
|
25
|
+
private delegate;
|
|
26
|
+
private publication;
|
|
27
|
+
private properties;
|
|
28
|
+
api?: ConsumptionModuleAPI;
|
|
29
|
+
startLocator?: Locator;
|
|
30
|
+
lastLocator?: Locator;
|
|
31
|
+
private constructor();
|
|
32
|
+
static create(config: ConsumptionModuleConfig): Promise<ConsumptionModule>;
|
|
33
|
+
protected start(): Promise<void>;
|
|
34
|
+
stop(): Promise<void>;
|
|
35
|
+
trackAction(locator: Locator, action: Action): Promise<void>;
|
|
36
|
+
startProgress(locator: Locator): Promise<void>;
|
|
37
|
+
continueProgress(locator: Locator): Promise<void>;
|
|
38
|
+
endProgress(): Promise<void>;
|
|
39
|
+
}
|
|
@@ -20,8 +20,8 @@ export declare class HistoryModule implements ReaderModule {
|
|
|
20
20
|
private properties;
|
|
21
21
|
private historyForwardAnchorElement;
|
|
22
22
|
private historyBackAnchorElement;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
historyCurrentIndex: number;
|
|
24
|
+
history: Array<Locator>;
|
|
25
25
|
private constructor();
|
|
26
26
|
static create(config: HistoryModuleConfig): Promise<HistoryModule>;
|
|
27
27
|
stop(): Promise<void>;
|
|
@@ -29,6 +29,8 @@ export declare class HistoryModule implements ReaderModule {
|
|
|
29
29
|
setup(): void;
|
|
30
30
|
push(locator: Locator, history: boolean): Promise<void>;
|
|
31
31
|
protected start(): Promise<void>;
|
|
32
|
-
|
|
32
|
+
handleHistoryForwardClick(event: MouseEvent): Promise<void>;
|
|
33
|
+
historyForward(): Promise<void>;
|
|
33
34
|
private handleHistoryBackClick;
|
|
35
|
+
historyBack(): Promise<void>;
|
|
34
36
|
}
|
|
@@ -20,6 +20,7 @@ import EventEmitter from "eventemitter3";
|
|
|
20
20
|
import LineFocusModule, { LineFocusModuleConfig } from "../modules/linefocus/LineFocusModule";
|
|
21
21
|
import { HistoryModule } from "../modules/history/HistoryModule";
|
|
22
22
|
import CitationModule, { CitationModuleConfig } from "../modules/citation/CitationModule";
|
|
23
|
+
import { ConsumptionModule, ConsumptionModuleConfig } from "../modules/consumption/ConsumptionModule";
|
|
23
24
|
export declare type GetContent = (href: string) => Promise<string>;
|
|
24
25
|
export declare type GetContentBytesLength = (href: string, requestConfig?: RequestConfig) => Promise<number>;
|
|
25
26
|
export interface RequestConfig extends RequestInit {
|
|
@@ -96,6 +97,7 @@ export interface ReaderRights {
|
|
|
96
97
|
customKeyboardEvents: boolean;
|
|
97
98
|
enableHistory: boolean;
|
|
98
99
|
enableCitations: boolean;
|
|
100
|
+
enableConsumption: boolean;
|
|
99
101
|
}
|
|
100
102
|
export interface ReaderUI {
|
|
101
103
|
settings: UserSettingsUIConfig;
|
|
@@ -118,6 +120,7 @@ export interface ReaderConfig {
|
|
|
118
120
|
bookmarks?: Partial<BookmarkModuleConfig>;
|
|
119
121
|
lineFocus?: Partial<LineFocusModuleConfig>;
|
|
120
122
|
citations?: Partial<CitationModuleConfig>;
|
|
123
|
+
consumption?: Partial<ConsumptionModuleConfig>;
|
|
121
124
|
highlighter?: Partial<TextHighlighterConfig>;
|
|
122
125
|
injectables: Array<Injectable>;
|
|
123
126
|
injectablesFixed?: Array<Injectable>;
|
|
@@ -147,6 +150,7 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
147
150
|
lineFocusModule?: LineFocusModule;
|
|
148
151
|
historyModule?: HistoryModule;
|
|
149
152
|
citationModule?: CitationModule;
|
|
153
|
+
consumptionModule?: ConsumptionModule;
|
|
150
154
|
sideNavExpanded: boolean;
|
|
151
155
|
currentChapterLink: D2Link;
|
|
152
156
|
currentSpreadLinks: {
|
package/dist/types/reader.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export default class D2Reader {
|
|
|
32
32
|
private readonly lineFocusModule?;
|
|
33
33
|
private readonly historyModule?;
|
|
34
34
|
private readonly citationModule?;
|
|
35
|
+
private readonly consumptionModule?;
|
|
35
36
|
private constructor();
|
|
36
37
|
addEventListener(): void;
|
|
37
38
|
/**
|
|
@@ -102,6 +103,14 @@ export default class D2Reader {
|
|
|
102
103
|
get bookmarks(): any;
|
|
103
104
|
/** Current Annotations */
|
|
104
105
|
get annotations(): any;
|
|
106
|
+
/** History */
|
|
107
|
+
get history(): Locator[] | undefined;
|
|
108
|
+
/** Current index of history */
|
|
109
|
+
get historyCurrentIndex(): number | undefined;
|
|
110
|
+
/** History Back */
|
|
111
|
+
historyBack: () => Promise<void | undefined>;
|
|
112
|
+
/** History Forward */
|
|
113
|
+
historyForward: () => Promise<void | undefined>;
|
|
105
114
|
/**
|
|
106
115
|
* Search
|
|
107
116
|
*/
|