@d-i-t-a/reader 1.11.0-beta.3 → 1.11.0-beta.7
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/index.d.ts +5 -2
- package/dist/injectables/footnotes/footnotes.js.LICENSE.txt +6 -0
- package/dist/modules/AnnotationModule.d.ts +2 -1
- package/dist/modules/citations/CitationModule.d.ts +37 -0
- package/dist/modules/footnotes/FootnotesEventHandler.d.ts +0 -0
- package/dist/modules/highlight/TextHighlighter.d.ts +18 -44
- package/dist/modules/highlight/TextHighlighterFXL.d.ts +278 -0
- package/dist/modules/highlight/common/highlight.d.ts +4 -1
- package/dist/modules/highlight/common/styles.d.ts +35 -0
- package/dist/modules/highlight/renderer/iframe/state.d.ts +0 -3
- package/dist/modules/linefocus/LineFocusModule.d.ts +43 -0
- package/dist/modules/pagebreak/PageBreakModule.d.ts +3 -0
- package/dist/modules/search/DefinitionsModule.d.ts +52 -0
- package/dist/modules/search/Popup.d.ts +8 -0
- package/dist/modules/search/SearchModule.d.ts +8 -5
- package/dist/modules/search/searchWithDomSeek.d.ts +1 -1
- package/dist/navigator/IFrameNavigator.d.ts +7 -1
- package/dist/reader.js +1 -1
- package/dist/reader.js.map +1 -1
- package/dist/store/Annotator.d.ts +1 -2
- package/dist/store/LocalAnnotator.d.ts +1 -2
- package/dist/utils/EventHandler.d.ts +5 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/views/BookView.d.ts +3 -2
- package/dist/views/FixedBookView.d.ts +3 -0
- package/dist/views/ReflowableBookView.d.ts +1 -1
- package/package.json +4 -4
- package/dist/.DS_Store +0 -0
- package/dist/store/LocalPositions.d.ts +0 -18
- package/dist/store/Positions.d.ts +0 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReaderConfig } from "./navigator/IFrameNavigator";
|
|
2
2
|
import { Locator } from "./model/Locator";
|
|
3
|
-
export declare const IS_DEV: boolean;
|
|
4
3
|
export declare function unload(): Promise<void>;
|
|
5
4
|
export declare function hasMediaOverlays(): boolean;
|
|
6
5
|
/**
|
|
@@ -67,7 +66,11 @@ export declare function goToPosition(value: any): void;
|
|
|
67
66
|
export declare function applyAttributes(value: any): void;
|
|
68
67
|
export declare function hideAnnotationLayer(): void;
|
|
69
68
|
export declare function showAnnotationLayer(): void;
|
|
69
|
+
export declare function hideLayer(layer: any): void;
|
|
70
|
+
export declare function showLayer(layer: any): void;
|
|
71
|
+
export declare function clearDefinitions(): Promise<void>;
|
|
72
|
+
export declare function addDefinition(definition: any): Promise<void>;
|
|
70
73
|
export declare function snapToElement(value: any): void;
|
|
71
|
-
export declare function activateMarker(id: any): void;
|
|
74
|
+
export declare function activateMarker(id: any, position: any): void;
|
|
72
75
|
export declare function deactivateMarker(): void;
|
|
73
76
|
export declare function load(config: ReaderConfig): Promise<any>;
|
|
@@ -36,7 +36,8 @@ export default class AnnotationModule implements ReaderModule {
|
|
|
36
36
|
private delegate;
|
|
37
37
|
properties: AnnotationModuleProperties;
|
|
38
38
|
api: AnnotationModuleAPI;
|
|
39
|
-
activeAnnotationMarkerId
|
|
39
|
+
activeAnnotationMarkerId?: string;
|
|
40
|
+
activeAnnotationMarkerPosition?: string;
|
|
40
41
|
static create(config: AnnotationModuleConfig): Promise<AnnotationModule>;
|
|
41
42
|
constructor(annotator: Annotator, headerMenu: HTMLElement, rights: ReaderRights, publication: Publication, delegate: IFrameNavigator, initialAnnotations: any | null, properties: AnnotationModuleProperties | null, api: AnnotationModuleAPI | null, highlighter: TextHighlighter);
|
|
42
43
|
stop(): Promise<void>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Publication } from "../../model/Publication";
|
|
2
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
3
|
+
import ReaderModule from "../ReaderModule";
|
|
4
|
+
export declare enum CitationStyle {
|
|
5
|
+
Chicago = 0,
|
|
6
|
+
MLA = 1,
|
|
7
|
+
APA = 2
|
|
8
|
+
}
|
|
9
|
+
export declare enum ContributorType {
|
|
10
|
+
Author = "Author",
|
|
11
|
+
Editor = "Editor",
|
|
12
|
+
Translator = "Translator",
|
|
13
|
+
Compiler = "Compiler"
|
|
14
|
+
}
|
|
15
|
+
export interface CitationModuleProperties {
|
|
16
|
+
characters: number;
|
|
17
|
+
appName: string;
|
|
18
|
+
appLink: string;
|
|
19
|
+
library: string;
|
|
20
|
+
styles: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface CitationModuleConfig extends CitationModuleProperties {
|
|
23
|
+
publication: Publication;
|
|
24
|
+
delegate: IFrameNavigator;
|
|
25
|
+
}
|
|
26
|
+
export default class CitationModule implements ReaderModule {
|
|
27
|
+
private publication;
|
|
28
|
+
private delegate;
|
|
29
|
+
private properties;
|
|
30
|
+
static create(config: CitationModuleConfig): Promise<CitationModule>;
|
|
31
|
+
private constructor();
|
|
32
|
+
stop(): Promise<void>;
|
|
33
|
+
protected start(): Promise<void>;
|
|
34
|
+
copyToClipboard(textToClipboard: any): void;
|
|
35
|
+
createElementForExecCommand(textToClipboard: any): HTMLDivElement;
|
|
36
|
+
selectContent(element: any): void;
|
|
37
|
+
}
|
|
File without changes
|
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
import { HighlightType, IHighlight, IMarkerIcon, IPopupStyle, IStyle, SelectionMenuItem } from "./common/highlight";
|
|
2
2
|
import { ISelectionInfo } from "./common/selection";
|
|
3
3
|
import { IRectSimple } from "./common/rect-utils";
|
|
4
|
-
import { IReadiumIFrameWindow } from "./renderer/iframe/state";
|
|
5
4
|
import { AnnotationMarker } from "../../model/Locator";
|
|
6
5
|
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
7
6
|
export declare const ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER";
|
|
8
7
|
export declare const ID_READALOUD_CONTAINER = "R2_ID_READALOUD_CONTAINER";
|
|
9
8
|
export declare const ID_PAGEBREAK_CONTAINER = "R2_ID_PAGEBREAK_CONTAINER";
|
|
10
9
|
export declare const ID_SEARCH_CONTAINER = "R2_ID_SEARCH_CONTAINER";
|
|
10
|
+
export declare const ID_POPUP_CONTAINER = "R2_ID_POPUP_CONTAINER";
|
|
11
11
|
export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
|
|
12
12
|
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
13
13
|
export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
|
|
14
14
|
export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
|
|
15
|
+
export declare const DEFAULT_BACKGROUND_COLOR: {
|
|
16
|
+
blue: number;
|
|
17
|
+
green: number;
|
|
18
|
+
red: number;
|
|
19
|
+
};
|
|
15
20
|
export interface TextSelectorAPI {
|
|
16
21
|
selectionMenuOpen: any;
|
|
17
22
|
selectionMenuClose: any;
|
|
23
|
+
selection: any;
|
|
18
24
|
}
|
|
19
25
|
export declare const _highlights: IHighlight[];
|
|
20
26
|
interface IWithRect {
|
|
@@ -45,7 +51,7 @@ export default class TextHighlighter {
|
|
|
45
51
|
properties: TextHighlighterProperties;
|
|
46
52
|
private api;
|
|
47
53
|
private hasEventListener;
|
|
48
|
-
activeAnnotationMarkerId
|
|
54
|
+
activeAnnotationMarkerId?: string;
|
|
49
55
|
static create(config: TextHighlighterConfig): Promise<any>;
|
|
50
56
|
private constructor();
|
|
51
57
|
initialize(): Promise<void>;
|
|
@@ -143,6 +149,9 @@ export default class TextHighlighter {
|
|
|
143
149
|
selectionMenuClosed: (() => void) & {
|
|
144
150
|
clear(): void;
|
|
145
151
|
};
|
|
152
|
+
selection: ((text: any, selection: any) => void) & {
|
|
153
|
+
clear(): void;
|
|
154
|
+
};
|
|
146
155
|
toolboxPlacement(): void;
|
|
147
156
|
toolboxHandler(): void;
|
|
148
157
|
/**
|
|
@@ -194,20 +203,6 @@ export default class TextHighlighter {
|
|
|
194
203
|
* @memberof TextHighlighter
|
|
195
204
|
*/
|
|
196
205
|
getColor(): string;
|
|
197
|
-
/**
|
|
198
|
-
* Returns highlights from given container.
|
|
199
|
-
* @param params
|
|
200
|
-
* @param {HTMLElement} [params.container] - return highlights from this element. Default: the element the
|
|
201
|
-
* highlighter is applied to.
|
|
202
|
-
* @param {boolean} [params.andSelf] - if set to true and container is a highlight itself, add container to
|
|
203
|
-
* returned results. Default: true.
|
|
204
|
-
* @param {boolean} [params.grouped] - if set to true, highlights are grouped in logical groups of highlights added
|
|
205
|
-
* in the same moment. Each group is an object which has got array of highlights, 'toString' method and 'timestamp'
|
|
206
|
-
* property. Default: false.
|
|
207
|
-
* @returns {Array} - array of highlights.
|
|
208
|
-
* @memberof TextHighlighter
|
|
209
|
-
*/
|
|
210
|
-
getHighlights(params?: any): Array<any>;
|
|
211
206
|
/**
|
|
212
207
|
* Returns true if element is a highlight.
|
|
213
208
|
* All highlights have 'data-highlighted' attribute.
|
|
@@ -216,20 +211,6 @@ export default class TextHighlighter {
|
|
|
216
211
|
* @memberof TextHighlighter
|
|
217
212
|
*/
|
|
218
213
|
isHighlight(el: any): boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Serializes all highlights in the element the highlighter is applied to.
|
|
221
|
-
* @returns {string} - stringified JSON with highlights definition
|
|
222
|
-
* @memberof TextHighlighter
|
|
223
|
-
*/
|
|
224
|
-
serializeHighlights(): string;
|
|
225
|
-
/**
|
|
226
|
-
* Deserializes highlights.
|
|
227
|
-
* @throws exception when can't parse JSON or JSON has invalid structure.
|
|
228
|
-
* @param {object} json - JSON object with highlights definition.
|
|
229
|
-
* @returns {Array} - array of deserialized highlights.
|
|
230
|
-
* @memberof TextHighlighter
|
|
231
|
-
*/
|
|
232
|
-
deserializeHighlights(json: any): Array<any>;
|
|
233
214
|
/**
|
|
234
215
|
* Creates wrapper for highlights.
|
|
235
216
|
* TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
|
|
@@ -248,27 +229,20 @@ export default class TextHighlighter {
|
|
|
248
229
|
};
|
|
249
230
|
static hexToRgbA(hex: string): string;
|
|
250
231
|
static hexToRgbAWithOpacity(hex: string, opacity: number): string;
|
|
251
|
-
resetHighlightBoundingStyle(_win:
|
|
252
|
-
resetHighlightAreaStyle(_win:
|
|
253
|
-
setHighlightAreaStyle(_win:
|
|
232
|
+
resetHighlightBoundingStyle(_win: any, highlightBounding: HTMLElement): void;
|
|
233
|
+
resetHighlightAreaStyle(_win: any, highlightArea: HTMLElement, id_container: string): void;
|
|
234
|
+
setHighlightAreaStyle(_win: any, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
|
|
254
235
|
setAndResetSearchHighlight(highlight: any, highlights: any): void;
|
|
255
236
|
isIOS(): boolean;
|
|
256
237
|
isAndroid(): boolean;
|
|
257
238
|
getScrollingElement: (documant: Document) => Element;
|
|
258
|
-
processMouseEvent(win:
|
|
259
|
-
ensureHighlightsContainer(win:
|
|
239
|
+
processMouseEvent(win: any, ev: MouseEvent): Promise<void>;
|
|
240
|
+
ensureHighlightsContainer(win: any, id: string): HTMLElement;
|
|
260
241
|
hideAllhighlights(_documant: Document): void;
|
|
261
242
|
destroyAllhighlights(documant: Document): void;
|
|
262
243
|
destroyHighlights(type: HighlightType): void;
|
|
263
244
|
destroyHighlight(documant: Document, id: string): void;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
clear(): void;
|
|
267
|
-
};
|
|
268
|
-
recreateAllHighlights(win: IReadiumIFrameWindow): void;
|
|
269
|
-
createSearchHighlight(selectionInfo: ISelectionInfo, color: string): IHighlight;
|
|
270
|
-
createPageBreakHighlight(selectionInfo: ISelectionInfo, title: string): IHighlight;
|
|
271
|
-
createHighlight(win: IReadiumIFrameWindow, selectionInfo: ISelectionInfo, color: string | undefined, pointerInteraction: boolean, marker: AnnotationMarker, icon?: IMarkerIcon | undefined, popup?: IPopupStyle | undefined, style?: IStyle | undefined, type?: HighlightType | undefined, prefix?: string | undefined): [IHighlight, HTMLDivElement];
|
|
272
|
-
createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
|
|
245
|
+
createHighlight(win: any, selectionInfo: ISelectionInfo, color: string | undefined, pointerInteraction: boolean, marker: AnnotationMarker, icon?: IMarkerIcon | undefined, popup?: IPopupStyle | undefined, style?: IStyle | undefined, type?: HighlightType | undefined, prefix?: string | undefined): [IHighlight, HTMLDivElement];
|
|
246
|
+
createHighlightDom(win: any, highlight: IHighlight): HTMLDivElement | undefined;
|
|
273
247
|
}
|
|
274
248
|
export {};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { HighlightType, IHighlight, IMarkerIcon, IPopupStyle, IStyle, SelectionMenuItem } from "./common/highlight";
|
|
2
|
+
import { ISelectionInfo } from "./common/selection";
|
|
3
|
+
import { IRectSimple } from "./common/rect-utils";
|
|
4
|
+
import { IReadiumIFrameWindow } from "./renderer/iframe/state";
|
|
5
|
+
import { AnnotationMarker } from "../../model/Locator";
|
|
6
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
7
|
+
import { Definition } from "../search/DefinitionsModule";
|
|
8
|
+
export declare const ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER";
|
|
9
|
+
export declare const ID_READALOUD_CONTAINER = "R2_ID_READALOUD_CONTAINER";
|
|
10
|
+
export declare const ID_POPUP_CONTAINER = "R2_ID_POPUP_CONTAINER";
|
|
11
|
+
export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
|
|
12
|
+
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
13
|
+
export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
|
|
14
|
+
export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
|
|
15
|
+
export declare const _highlights: IHighlight[];
|
|
16
|
+
interface IWithRect {
|
|
17
|
+
rect: IRectSimple;
|
|
18
|
+
scale: number;
|
|
19
|
+
}
|
|
20
|
+
export interface TextSelectorAPI {
|
|
21
|
+
selectionMenuOpen: any;
|
|
22
|
+
selectionMenuClose: any;
|
|
23
|
+
selection: any;
|
|
24
|
+
}
|
|
25
|
+
export interface IHTMLDivElementWithRect extends HTMLDivElement, IWithRect {
|
|
26
|
+
}
|
|
27
|
+
export interface HTMLElementRect {
|
|
28
|
+
node: Element;
|
|
29
|
+
height: number;
|
|
30
|
+
top: number;
|
|
31
|
+
width: number;
|
|
32
|
+
left: number;
|
|
33
|
+
textContent: string;
|
|
34
|
+
}
|
|
35
|
+
export interface TextHighlighterProperties {
|
|
36
|
+
selectionMenuItems: Array<SelectionMenuItem>;
|
|
37
|
+
}
|
|
38
|
+
export interface TextHighlighterConfig extends TextHighlighterProperties {
|
|
39
|
+
delegate: IFrameNavigator;
|
|
40
|
+
api: TextSelectorAPI;
|
|
41
|
+
}
|
|
42
|
+
export default class TextHighlighterFXL {
|
|
43
|
+
private options;
|
|
44
|
+
private readonly delegate;
|
|
45
|
+
private lastSelectedHighlight;
|
|
46
|
+
properties: TextHighlighterProperties;
|
|
47
|
+
private api;
|
|
48
|
+
private hasEventListener;
|
|
49
|
+
activeAnnotationMarkerId?: string;
|
|
50
|
+
static create(config: TextHighlighterConfig): Promise<any>;
|
|
51
|
+
private constructor();
|
|
52
|
+
initialize(): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns true if elements a i b have the same color.
|
|
55
|
+
* @param {Node} a
|
|
56
|
+
* @param {Node} b
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
haveSameColor(a: any, b: any): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Fills undefined values in obj with default properties with the same name from source object.
|
|
62
|
+
* @param {object} obj - target object
|
|
63
|
+
* @param {object} source - source object with default values
|
|
64
|
+
* @returns {object}
|
|
65
|
+
*/
|
|
66
|
+
defaults(obj: {
|
|
67
|
+
[x: string]: any;
|
|
68
|
+
}, source: {
|
|
69
|
+
[x: string]: any;
|
|
70
|
+
color?: string;
|
|
71
|
+
highlightedClass?: string;
|
|
72
|
+
contextClass?: string;
|
|
73
|
+
onBeforeHighlight?: () => boolean;
|
|
74
|
+
onAfterHighlight?: () => void;
|
|
75
|
+
container?: any;
|
|
76
|
+
andSelf?: boolean;
|
|
77
|
+
grouped?: boolean;
|
|
78
|
+
hasOwnProperty?: any;
|
|
79
|
+
}): object;
|
|
80
|
+
/**
|
|
81
|
+
* Returns array without duplicated values.
|
|
82
|
+
* @param {Array} arr
|
|
83
|
+
* @returns {Array}
|
|
84
|
+
*/
|
|
85
|
+
unique(arr: {
|
|
86
|
+
filter: (arg0: (value: any, idx: any, self: any) => boolean) => void;
|
|
87
|
+
}): void;
|
|
88
|
+
/**
|
|
89
|
+
* Takes range object as parameter and refines it boundaries
|
|
90
|
+
* @param range
|
|
91
|
+
* @returns {object} refined boundaries and initial state of highlighting algorithm.
|
|
92
|
+
*/
|
|
93
|
+
refineRangeBoundaries(range: {
|
|
94
|
+
startContainer: any;
|
|
95
|
+
endContainer: any;
|
|
96
|
+
commonAncestorContainer: any;
|
|
97
|
+
endOffset: number;
|
|
98
|
+
startOffset: number;
|
|
99
|
+
}): object;
|
|
100
|
+
/**
|
|
101
|
+
* Sorts array of DOM elements by its depth in DOM tree.
|
|
102
|
+
* @param {HTMLElement[]} arr - array to sort.
|
|
103
|
+
* @param {boolean} descending - order of sort.
|
|
104
|
+
*/
|
|
105
|
+
sortByDepth(arr: {
|
|
106
|
+
sort: (arg0: (a: any, b: any) => number) => void;
|
|
107
|
+
}, descending: boolean): void;
|
|
108
|
+
/**
|
|
109
|
+
* Groups given highlights by timestamp.
|
|
110
|
+
* @param {Array} highlights
|
|
111
|
+
* @returns {Array} Grouped highlights.
|
|
112
|
+
*/
|
|
113
|
+
groupHighlights(highlights: {
|
|
114
|
+
forEach: (arg0: (hl: any) => void) => void;
|
|
115
|
+
}): Array<any>;
|
|
116
|
+
/**
|
|
117
|
+
* Utility functions to make DOM manipulation easier.
|
|
118
|
+
* @param {Node|HTMLElement} [el] - base DOM element to manipulate
|
|
119
|
+
* @returns {object}
|
|
120
|
+
*/
|
|
121
|
+
dom(el?: any): any;
|
|
122
|
+
disableContext(e: {
|
|
123
|
+
preventDefault: () => void;
|
|
124
|
+
stopPropagation: () => void;
|
|
125
|
+
}): boolean;
|
|
126
|
+
bindEvents(el: any, _scope: any, hasEventListener: boolean): void;
|
|
127
|
+
unbindEvents(el: any, _scope: any): void;
|
|
128
|
+
/**
|
|
129
|
+
* Permanently disables highlighting.
|
|
130
|
+
* Unbinds events and remove context element class.
|
|
131
|
+
* @memberof TextHighlighter
|
|
132
|
+
*/
|
|
133
|
+
destroy(): void;
|
|
134
|
+
initializeToolbox(): void;
|
|
135
|
+
toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
|
|
136
|
+
toolboxHide(): void;
|
|
137
|
+
toolboxShowDelayed(): void;
|
|
138
|
+
snapSelectionToWord(): any;
|
|
139
|
+
toolboxShow(): void;
|
|
140
|
+
isSelectionMenuOpen: boolean;
|
|
141
|
+
selectionMenuOpened: (() => void) & {
|
|
142
|
+
clear(): void;
|
|
143
|
+
};
|
|
144
|
+
selectionMenuClosed: (() => void) & {
|
|
145
|
+
clear(): void;
|
|
146
|
+
};
|
|
147
|
+
selection: ((text: any, selection: any) => void) & {
|
|
148
|
+
clear(): void;
|
|
149
|
+
};
|
|
150
|
+
toolboxPlacement(): void;
|
|
151
|
+
toolboxHandler(): void;
|
|
152
|
+
/**
|
|
153
|
+
* Highlights current range.
|
|
154
|
+
* @param {boolean} keepRange - Don't remove range after highlighting. Default: false.
|
|
155
|
+
* @param marker
|
|
156
|
+
* @memberof TextHighlighter
|
|
157
|
+
*/
|
|
158
|
+
doHighlight(iframe: any, keepRange?: boolean, marker?: AnnotationMarker): void;
|
|
159
|
+
speak(iframe: any): void;
|
|
160
|
+
stopReadAloud(): void;
|
|
161
|
+
speakAll(iframe: any): void;
|
|
162
|
+
callbackComplete(): void;
|
|
163
|
+
visibleTextRects(iframe: any): HTMLElementRect[];
|
|
164
|
+
doneSpeaking(reload?: boolean): void;
|
|
165
|
+
/**
|
|
166
|
+
* Normalizes highlights. Ensures that highlighting is done with use of the smallest possible number of
|
|
167
|
+
* wrapping HTML elements.
|
|
168
|
+
* Flattens highlights structure and merges sibling highlights. Normalizes text nodes within highlights.
|
|
169
|
+
* @param {Array} highlights - highlights to normalize.
|
|
170
|
+
* @returns {Array} - array of normalized highlights. Order and number of returned highlights may be different than
|
|
171
|
+
* input highlights.
|
|
172
|
+
* @memberof TextHighlighter
|
|
173
|
+
*/
|
|
174
|
+
normalizeHighlights(highlights: any): any;
|
|
175
|
+
/**
|
|
176
|
+
* Flattens highlights structure.
|
|
177
|
+
* Note: this method changes input highlights - their order and number after calling this method may change.
|
|
178
|
+
* @param {Array} highlights - highlights to flatten.
|
|
179
|
+
* @memberof TextHighlighter
|
|
180
|
+
*/
|
|
181
|
+
flattenNestedHighlights(highlights: any): void;
|
|
182
|
+
/**
|
|
183
|
+
* Merges sibling highlights and normalizes descendant text nodes.
|
|
184
|
+
* Note: this method changes input highlights - their order and number after calling this method may change.
|
|
185
|
+
* @param highlights
|
|
186
|
+
* @memberof TextHighlighter
|
|
187
|
+
*/
|
|
188
|
+
mergeSiblingHighlights(highlights: any): void;
|
|
189
|
+
/**
|
|
190
|
+
* Sets highlighting color.
|
|
191
|
+
* @param {string} color - valid CSS color.
|
|
192
|
+
* @memberof TextHighlighter
|
|
193
|
+
*/
|
|
194
|
+
setColor(color: any): void;
|
|
195
|
+
/**
|
|
196
|
+
* Returns highlighting color.
|
|
197
|
+
* @returns {string}
|
|
198
|
+
* @memberof TextHighlighter
|
|
199
|
+
*/
|
|
200
|
+
getColor(): string;
|
|
201
|
+
/**
|
|
202
|
+
* Returns highlights from given container.
|
|
203
|
+
* @param params
|
|
204
|
+
* @param {HTMLElement} [params.container] - return highlights from this element. Default: the element the
|
|
205
|
+
* highlighter is applied to.
|
|
206
|
+
* @param {boolean} [params.andSelf] - if set to true and container is a highlight itself, add container to
|
|
207
|
+
* returned results. Default: true.
|
|
208
|
+
* @param {boolean} [params.grouped] - if set to true, highlights are grouped in logical groups of highlights added
|
|
209
|
+
* in the same moment. Each group is an object which has got array of highlights, 'toString' method and 'timestamp'
|
|
210
|
+
* property. Default: false.
|
|
211
|
+
* @returns {Array} - array of highlights.
|
|
212
|
+
* @memberof TextHighlighter
|
|
213
|
+
*/
|
|
214
|
+
getHighlights(iframe: any, params?: any): Array<any>;
|
|
215
|
+
/**
|
|
216
|
+
* Returns true if element is a highlight.
|
|
217
|
+
* All highlights have 'data-highlighted' attribute.
|
|
218
|
+
* @param el - element to check.
|
|
219
|
+
* @returns {boolean}
|
|
220
|
+
* @memberof TextHighlighter
|
|
221
|
+
*/
|
|
222
|
+
isHighlight(el: any): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Serializes all highlights in the element the highlighter is applied to.
|
|
225
|
+
* @returns {string} - stringified JSON with highlights definition
|
|
226
|
+
* @memberof TextHighlighter
|
|
227
|
+
*/
|
|
228
|
+
serializeHighlights(iframe: any): string;
|
|
229
|
+
/**
|
|
230
|
+
* Deserializes highlights.
|
|
231
|
+
* @throws exception when can't parse JSON or JSON has invalid structure.
|
|
232
|
+
* @param {object} json - JSON object with highlights definition.
|
|
233
|
+
* @returns {Array} - array of deserialized highlights.
|
|
234
|
+
* @memberof TextHighlighter
|
|
235
|
+
*/
|
|
236
|
+
deserializeHighlights(iframe: any, json: any): Array<any>;
|
|
237
|
+
/**
|
|
238
|
+
* Creates wrapper for highlights.
|
|
239
|
+
* TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
|
|
240
|
+
* in constructor.
|
|
241
|
+
* @returns {HTMLElement}
|
|
242
|
+
* @memberof TextHighlighter
|
|
243
|
+
* @static
|
|
244
|
+
*/
|
|
245
|
+
createWrapper(): HTMLElement;
|
|
246
|
+
static isHexColor(hex: string): boolean;
|
|
247
|
+
static hexToRgbString(hex: string): any;
|
|
248
|
+
static hexToRgbChannels(hex: string): {
|
|
249
|
+
red: number;
|
|
250
|
+
green: number;
|
|
251
|
+
blue: number;
|
|
252
|
+
};
|
|
253
|
+
static hexToRgbA(hex: string): string;
|
|
254
|
+
static hexToRgbAWithOpacity(hex: string, opacity: number): string;
|
|
255
|
+
resetHighlightBoundingStyle(_win: IReadiumIFrameWindow, highlightBounding: HTMLElement): void;
|
|
256
|
+
resetHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightArea: HTMLElement, id_container: string): void;
|
|
257
|
+
setHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
|
|
258
|
+
isIOS(): boolean;
|
|
259
|
+
isAndroid(): boolean;
|
|
260
|
+
getScrollingElement: (documant: Document) => Element;
|
|
261
|
+
processMouseEvent(win: IReadiumIFrameWindow, ev: MouseEvent): Promise<void>;
|
|
262
|
+
ensureHighlightsContainer(win: IReadiumIFrameWindow, id: string): HTMLElement;
|
|
263
|
+
hideAllhighlights(_documant: Document): void;
|
|
264
|
+
destroyAllhighlights(documant: Document): void;
|
|
265
|
+
destroyHighlights(type: HighlightType): void;
|
|
266
|
+
destroyHighlight(documant: Document, id: string): void;
|
|
267
|
+
recreateAllHighlightsRaw(win: IReadiumIFrameWindow): void;
|
|
268
|
+
recreateAllHighlightsDebounced: ((win: IReadiumIFrameWindow) => void) & {
|
|
269
|
+
clear(): void;
|
|
270
|
+
};
|
|
271
|
+
recreateAllHighlights(win: IReadiumIFrameWindow): void;
|
|
272
|
+
createPopupHighlight(iframe: any, selectionInfo: ISelectionInfo, item: Definition): IHighlight;
|
|
273
|
+
createSearchHighlight(iframe: any, selectionInfo: ISelectionInfo, color: string): IHighlight;
|
|
274
|
+
createPageBreakHighlight(iframe: any, selectionInfo: ISelectionInfo, title: string): IHighlight;
|
|
275
|
+
createHighlight(win: IReadiumIFrameWindow, selectionInfo: ISelectionInfo, color: string | undefined, pointerInteraction: boolean, marker: AnnotationMarker, icon?: IMarkerIcon | undefined, popup?: IPopupStyle | undefined, style?: IStyle | undefined, type?: HighlightType | undefined, prefix?: string | undefined): [IHighlight, HTMLDivElement];
|
|
276
|
+
createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
|
|
277
|
+
}
|
|
278
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ISelectionInfo } from "./selection";
|
|
2
2
|
import { AnnotationMarker } from "../../../model/Locator";
|
|
3
|
+
import { Definition } from "../../search/DefinitionsModule";
|
|
3
4
|
export interface IColor {
|
|
4
5
|
red: number;
|
|
5
6
|
green: number;
|
|
@@ -37,7 +38,8 @@ export declare enum HighlightType {
|
|
|
37
38
|
Annotation = 0,
|
|
38
39
|
Search = 1,
|
|
39
40
|
ReadAloud = 2,
|
|
40
|
-
PageBreak = 3
|
|
41
|
+
PageBreak = 3,
|
|
42
|
+
Popup = 4
|
|
41
43
|
}
|
|
42
44
|
export interface IHighlight {
|
|
43
45
|
id: string;
|
|
@@ -50,6 +52,7 @@ export interface IHighlight {
|
|
|
50
52
|
style?: IStyle | undefined;
|
|
51
53
|
position?: number;
|
|
52
54
|
note?: string | undefined;
|
|
55
|
+
definition?: Definition | undefined;
|
|
53
56
|
type: HighlightType;
|
|
54
57
|
}
|
|
55
58
|
export interface SelectionMenuItem {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const ROOT_CLASS_REDUCE_MOTION = "r2-reduce-motion";
|
|
2
|
+
export declare const ROOT_CLASS_NO_FOOTNOTES = "r2-no-popup-foonotes";
|
|
3
|
+
export declare const POPUP_DIALOG_CLASS = "r2-popup-dialog";
|
|
4
|
+
export declare const FOOTNOTES_CONTAINER_CLASS = "r2-footnote-container";
|
|
5
|
+
export declare const FOOTNOTES_CLOSE_BUTTON_CLASS = "r2-footnote-close";
|
|
6
|
+
export declare const FOOTNOTE_FORCE_SHOW = "r2-footnote-force-show";
|
|
7
|
+
export declare const footnotesCssStyles: string;
|
|
8
|
+
export declare const TTS_ID_PREVIOUS = "r2-tts-previous";
|
|
9
|
+
export declare const TTS_ID_NEXT = "r2-tts-next";
|
|
10
|
+
export declare const TTS_ID_SLIDER = "r2-tts-slider";
|
|
11
|
+
export declare const TTS_ID_ACTIVE_WORD = "r2-tts-active-word";
|
|
12
|
+
export declare const TTS_ID_ACTIVE_UTTERANCE = "r2-tts-active-utterance";
|
|
13
|
+
export declare const TTS_CLASS_UTTERANCE = "r2-tts-utterance";
|
|
14
|
+
export declare const TTS_ID_CONTAINER = "r2-tts-txt";
|
|
15
|
+
export declare const TTS_ID_INFO = "r2-tts-info";
|
|
16
|
+
export declare const TTS_NAV_BUTTON_CLASS = "r2-tts-button";
|
|
17
|
+
export declare const TTS_ID_SPEAKING_DOC_ELEMENT = "r2-tts-speaking-el";
|
|
18
|
+
export declare const TTS_CLASS_INJECTED_SPAN = "r2-tts-speaking-txt";
|
|
19
|
+
export declare const TTS_CLASS_INJECTED_SUBSPAN = "r2-tts-speaking-word";
|
|
20
|
+
export declare const TTS_ID_INJECTED_PARENT = "r2-tts-speaking-txt-parent";
|
|
21
|
+
export declare const TTS_POPUP_DIALOG_CLASS = "r2-tts-popup-dialog";
|
|
22
|
+
export declare const ttsCssStyles: string;
|
|
23
|
+
export declare const ROOT_CLASS_INVISIBLE_MASK = "r2-visibility-mask";
|
|
24
|
+
export declare const visibilityMaskCssStyles: string;
|
|
25
|
+
export declare const ROOT_CLASS_KEYBOARD_INTERACT = "r2-keyboard-interact";
|
|
26
|
+
export declare const CSS_CLASS_NO_FOCUS_OUTLINE = "r2-no-focus-outline";
|
|
27
|
+
export declare const focusCssStyles: string;
|
|
28
|
+
export declare const targetCssStyles = "\n@keyframes readium2ElectronAnimation_TARGET {\n 0% {\n }\n 100% {\n outline: inherit;\n }\n}\n:root[style] *:target,\n:root *:target {\n outline-color: green !important;\n outline-style: solid !important;\n outline-width: 2px !important;\n outline-offset: 2px !important;\n\n animation-name: readium2ElectronAnimation_TARGET;\n animation-duration: 3s;\n animation-delay: 1s;\n animation-fill-mode: forwards;\n animation-timing-function: linear;\n}\n:root[style] *.r2-no-target-outline:target,\n:root *.r2-no-target-outline:target {\n outline: inherit !important;\n}\n";
|
|
29
|
+
export declare const selectionCssStyles = "\n:root[style] ::selection,\n:root ::selection {\nbackground: rgb(155, 179, 240) !important;\ncolor: black !important;\n}\n\n:root[style*=\"readium-night-on\"] ::selection {\nbackground: rgb(100, 122, 177) !important;\ncolor: white !important;\n}\n";
|
|
30
|
+
export declare const scrollBarCssStyles = "\n::-webkit-scrollbar-button {\nheight: 0px !important;\nwidth: 0px !important;\n}\n\n::-webkit-scrollbar-corner {\nbackground: transparent !important;\n}\n\n/*::-webkit-scrollbar-track-piece {\nbackground: red;\n} */\n\n::-webkit-scrollbar {\nwidth: 14px;\nheight: 14px;\n}\n\n::-webkit-scrollbar-thumb {\nbackground: #727272;\nbackground-clip: padding-box !important;\nborder: 3px solid transparent !important;\nborder-radius: 30px;\n}\n\n::-webkit-scrollbar-thumb:hover {\nbackground: #4d4d4d;\n}\n\n::-webkit-scrollbar-track {\nbox-shadow: inset 0 0 3px rgba(40, 40, 40, 0.2);\nbackground: #dddddd;\nbox-sizing: content-box;\n}\n\n::-webkit-scrollbar-track:horizontal {\nborder-top: 1px solid silver;\n}\n::-webkit-scrollbar-track:vertical {\nborder-left: 1px solid silver;\n}\n\n:root[style*=\"readium-night-on\"] ::-webkit-scrollbar-thumb {\nbackground: #a4a4a4;\nborder: 3px solid #545454;\n}\n\n:root[style*=\"readium-night-on\"] ::-webkit-scrollbar-thumb:hover {\nbackground: #dedede;\n}\n\n:root[style*=\"readium-night-on\"] ::-webkit-scrollbar-track {\nbackground: #545454;\n}\n\n:root[style*=\"readium-night-on\"] ::-webkit-scrollbar-track:horizontal {\nborder-top: 1px solid black;\n}\n:root[style*=\"readium-night-on\"] ::-webkit-scrollbar-track:vertical {\nborder-left: 1px solid black;\n}";
|
|
31
|
+
export declare const readPosCssStylesAttr1 = "data-readium2-read-pos1";
|
|
32
|
+
export declare const readPosCssStylesAttr2 = "data-readium2-read-pos2";
|
|
33
|
+
export declare const readPosCssStylesAttr3 = "data-readium2-read-pos3";
|
|
34
|
+
export declare const readPosCssStylesAttr4 = "data-readium2-read-pos4";
|
|
35
|
+
export declare const readPosCssStyles: string;
|
|
@@ -5,9 +5,6 @@ export interface IReadiumIFrameWindowState {
|
|
|
5
5
|
locationHashOverride: Element | undefined;
|
|
6
6
|
locationHashOverrideInfo: IEventPayload_R2_EVENT_READING_LOCATION | undefined;
|
|
7
7
|
}
|
|
8
|
-
export interface IReadiumIFrameWindow extends Window {
|
|
9
|
-
READIUM2: IReadiumIFrameWindowState;
|
|
10
|
-
}
|
|
11
8
|
export interface IReadiumIFrameState {
|
|
12
9
|
id: number;
|
|
13
10
|
link: Link | undefined;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Publication } from "../../model/Publication";
|
|
2
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
3
|
+
import ReaderModule from "../ReaderModule";
|
|
4
|
+
import TextHighlighter from "../highlight/TextHighlighter";
|
|
5
|
+
export interface LineFocusModuleAPI {
|
|
6
|
+
}
|
|
7
|
+
export interface LineFocusModuleProperties {
|
|
8
|
+
api?: LineFocusModuleAPI;
|
|
9
|
+
factor: number;
|
|
10
|
+
startIndex: number;
|
|
11
|
+
currentIndex: number;
|
|
12
|
+
}
|
|
13
|
+
export interface LineFocusModuleConfig extends LineFocusModuleProperties {
|
|
14
|
+
api: LineFocusModuleAPI;
|
|
15
|
+
publication: Publication;
|
|
16
|
+
delegate: IFrameNavigator;
|
|
17
|
+
highlighter: TextHighlighter;
|
|
18
|
+
}
|
|
19
|
+
export default class LineFocusModule implements ReaderModule {
|
|
20
|
+
properties: LineFocusModuleProperties;
|
|
21
|
+
api: LineFocusModuleAPI;
|
|
22
|
+
private delegate;
|
|
23
|
+
private highlighter;
|
|
24
|
+
lines: Array<HTMLElement>;
|
|
25
|
+
index: number;
|
|
26
|
+
isActive: boolean;
|
|
27
|
+
isDebug: boolean;
|
|
28
|
+
static create(config: LineFocusModuleConfig): Promise<LineFocusModule>;
|
|
29
|
+
private constructor();
|
|
30
|
+
stop(): Promise<void>;
|
|
31
|
+
protected start(): Promise<void>;
|
|
32
|
+
handleResize(): void;
|
|
33
|
+
enableLineFocus(): void;
|
|
34
|
+
disableLineFocus(): void;
|
|
35
|
+
lineFocus(): void;
|
|
36
|
+
currentLine(): void;
|
|
37
|
+
lineDown(): void;
|
|
38
|
+
lineUp(): void;
|
|
39
|
+
almostEqual(a: number, b: number, tolerance: number): boolean;
|
|
40
|
+
findRects(parent: HTMLElement): any;
|
|
41
|
+
findTextNodes(parentElement: Element, nodes?: Array<Element>): Array<Element>;
|
|
42
|
+
measureTextNodes(node: Element): any;
|
|
43
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
2
2
|
import ReaderModule from "../ReaderModule";
|
|
3
|
+
import { IHighlight } from "../highlight/common/highlight";
|
|
4
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
3
5
|
import { Publication } from "../../model/Publication";
|
|
4
6
|
export interface PageBreakModuleConfig {
|
|
5
7
|
delegate: IFrameNavigator;
|
|
@@ -20,4 +22,5 @@ export default class PageBreakModule implements ReaderModule {
|
|
|
20
22
|
private goToPageNumber;
|
|
21
23
|
handleResize(): Promise<void>;
|
|
22
24
|
drawPageBreaks(): Promise<void>;
|
|
25
|
+
createPageBreakHighlight(selectionInfo: ISelectionInfo, title: string): IHighlight;
|
|
23
26
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Publication } from "../../model/Publication";
|
|
2
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
3
|
+
import ReaderModule from "../ReaderModule";
|
|
4
|
+
import TextHighlighter from "../highlight/TextHighlighter";
|
|
5
|
+
import { IHighlight } from "../highlight/common/highlight";
|
|
6
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
7
|
+
export interface DefinitionsModuleAPI {
|
|
8
|
+
success?: any;
|
|
9
|
+
click?: any;
|
|
10
|
+
visible?: any;
|
|
11
|
+
}
|
|
12
|
+
export interface Definition {
|
|
13
|
+
order: number;
|
|
14
|
+
terms: [string];
|
|
15
|
+
result?: number;
|
|
16
|
+
definition?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DefinitionsModuleProperties {
|
|
19
|
+
definitions: Definition[];
|
|
20
|
+
color?: string;
|
|
21
|
+
fullWordSearch?: boolean;
|
|
22
|
+
api?: DefinitionsModuleAPI;
|
|
23
|
+
}
|
|
24
|
+
export interface DefinitionsModuleConfig extends DefinitionsModuleProperties {
|
|
25
|
+
api: DefinitionsModuleAPI;
|
|
26
|
+
publication: Publication;
|
|
27
|
+
delegate: IFrameNavigator;
|
|
28
|
+
highlighter: TextHighlighter;
|
|
29
|
+
}
|
|
30
|
+
export default class DefinitionsModule implements ReaderModule {
|
|
31
|
+
properties: DefinitionsModuleProperties;
|
|
32
|
+
api: DefinitionsModuleAPI;
|
|
33
|
+
private publication;
|
|
34
|
+
private delegate;
|
|
35
|
+
private currentChapterPopupResult;
|
|
36
|
+
private currentPopupHighlights;
|
|
37
|
+
private highlighter;
|
|
38
|
+
static create(config: DefinitionsModuleConfig): Promise<DefinitionsModule>;
|
|
39
|
+
private constructor();
|
|
40
|
+
stop(): Promise<void>;
|
|
41
|
+
protected start(): Promise<void>;
|
|
42
|
+
searchAndPaint(item: Definition, callback: (result: any) => any): Promise<void>;
|
|
43
|
+
definitions: (() => Promise<void>) & {
|
|
44
|
+
clear(): void;
|
|
45
|
+
};
|
|
46
|
+
define(item: Definition): Promise<void>;
|
|
47
|
+
drawDefinitions(): void;
|
|
48
|
+
handleResize(): Promise<void>;
|
|
49
|
+
createPopupHighlight(selectionInfo: ISelectionInfo, item: Definition): IHighlight;
|
|
50
|
+
addDefinition(definition: any): Promise<void>;
|
|
51
|
+
clearDefinitions(): Promise<void>;
|
|
52
|
+
}
|