@d-i-t-a/reader 2.1.0-alpha.2 → 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/README.md +52 -3
- package/dist/esm/index.js +48822 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/injectables/click/click.js +1774 -2
- package/dist/injectables/click/click.js.map +7 -1
- package/dist/injectables/mui/script.js +205 -0
- package/dist/injectables/mui/style.css +271 -0
- package/dist/injectables/style/linefocus.css +55 -0
- package/dist/injectables/style/popover.css +125 -0
- package/dist/injectables/style/popup.css +121 -0
- package/dist/injectables/style/style.css +261 -0
- package/dist/injectables/style/toast.css +76 -0
- package/dist/reader.css +1 -1125
- package/dist/reader.css.map +1 -21
- package/dist/reader.js +126 -3
- package/dist/reader.js.map +7 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/{model → types/model}/Link.d.ts +2 -1
- package/dist/{model → types/model}/Locator.d.ts +4 -22
- package/dist/types/model/Publication.d.ts +51 -0
- package/dist/{model → types/model}/user-settings/ReadiumCSS.d.ts +0 -0
- package/dist/{model → types/model}/user-settings/UserProperties.d.ts +10 -4
- package/dist/{model → types/model}/user-settings/UserSettings.d.ts +23 -24
- package/dist/types/modules/AnnotationModule.d.ts +78 -0
- package/dist/types/modules/BookmarkModule.d.ts +57 -0
- package/dist/types/modules/ReaderModule.d.ts +2 -0
- package/dist/types/modules/TTS/TTSModule2.d.ts +74 -0
- package/dist/{modules → types/modules}/TTS/TTSSettings.d.ts +44 -20
- package/dist/types/modules/citation/CitationModule.d.ts +46 -0
- package/dist/{modules → types/modules}/highlight/HtmlElementSelector.d.ts +0 -0
- package/dist/types/modules/highlight/LayerSettings.d.ts +19 -0
- package/dist/{modules → types/modules}/highlight/TextHighlighter.d.ts +69 -61
- package/dist/{modules → types/modules}/highlight/common/document.d.ts +0 -0
- package/dist/{modules → types/modules}/highlight/common/events.d.ts +0 -0
- package/dist/types/modules/highlight/common/highlight.d.ts +72 -0
- package/dist/{modules → types/modules}/highlight/common/rect-utils.d.ts +2 -2
- package/dist/{modules → types/modules}/highlight/common/selection.d.ts +8 -3
- package/dist/{modules → types/modules}/highlight/renderer/common/cssselector.d.ts +0 -0
- package/dist/{modules → types/modules}/highlight/renderer/common/cssselector2.d.ts +0 -0
- package/dist/{modules → types/modules}/highlight/renderer/iframe/selection.d.ts +2 -2
- package/dist/{modules → types/modules}/highlight/renderer/iframe/state.d.ts +0 -3
- package/dist/types/modules/history/HistoryModule.d.ts +34 -0
- package/dist/types/modules/linefocus/LineFocusModule.d.ts +51 -0
- package/dist/{modules → types/modules}/mediaoverlays/MediaOverlayModule.d.ts +19 -14
- package/dist/{modules → types/modules}/mediaoverlays/MediaOverlaySettings.d.ts +21 -16
- package/dist/types/modules/pagebreak/PageBreakModule.d.ts +30 -0
- package/dist/{modules → types/modules}/positions/TimelineModule.d.ts +3 -3
- package/dist/{modules → types/modules}/protection/ContentProtectionModule.d.ts +15 -11
- package/dist/types/modules/sampleread/SampleReadEventHandler.d.ts +8 -0
- package/dist/types/modules/search/DefinitionsModule.d.ts +52 -0
- package/dist/types/modules/search/Popup.d.ts +10 -0
- package/dist/{modules → types/modules}/search/SearchModule.d.ts +23 -18
- package/dist/{modules → types/modules}/search/searchWithDomSeek.d.ts +1 -1
- package/dist/{navigator → types/navigator}/IFrameNavigator.d.ts +116 -97
- package/dist/{navigator → types/navigator}/Navigator.d.ts +0 -0
- package/dist/types/reader.d.ts +202 -0
- package/dist/types/store/Annotator.d.ts +29 -0
- package/dist/types/store/LocalAnnotator.d.ts +36 -0
- package/dist/{store → types/store}/LocalStorageStore.d.ts +3 -3
- package/dist/{store → types/store}/MemoryStore.d.ts +3 -3
- package/dist/types/store/Store.d.ts +6 -0
- package/dist/{utils → types/utils}/BrowserUtilities.d.ts +0 -0
- package/dist/types/utils/EventHandler.d.ts +23 -0
- package/dist/types/utils/HTMLTemplates.d.ts +2 -0
- package/dist/{utils → types/utils}/HTMLUtilities.d.ts +3 -3
- package/dist/{utils → types/utils}/IconLib.d.ts +1 -0
- package/dist/{utils → types/utils}/JsonUtil.d.ts +0 -0
- package/dist/types/utils/KeyboardEventHandler.d.ts +10 -0
- package/dist/{utils → types/utils}/TouchEventHandler.d.ts +4 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/{views → types/views}/BookView.d.ts +10 -7
- package/dist/{views → types/views}/FixedBookView.d.ts +8 -4
- package/dist/{views → types/views}/ReflowableBookView.d.ts +7 -5
- package/package.json +59 -27
- package/NOTICE +0 -20
- package/dist/index.d.ts +0 -61
- package/dist/injectables/click/click.d.ts +0 -1
- package/dist/injectables/footnotes/footnotes.d.ts +0 -1
- package/dist/injectables/footnotes/footnotes.js +0 -2
- package/dist/injectables/footnotes/footnotes.js.map +0 -1
- package/dist/injectables/glossary/glossary.d.ts +0 -5
- package/dist/injectables/glossary/glossary.js +0 -3
- package/dist/injectables/glossary/glossary.js.LICENSE.txt +0 -6
- package/dist/injectables/glossary/glossary.js.map +0 -1
- package/dist/material.css +0 -4637
- package/dist/material.css.map +0 -30
- package/dist/model/MediaOverlayNode.d.ts +0 -3
- package/dist/model/Publication.d.ts +0 -26
- package/dist/modules/AnnotationModule.d.ts +0 -59
- package/dist/modules/BookmarkModule.d.ts +0 -46
- package/dist/modules/ReaderModule.d.ts +0 -3
- package/dist/modules/TTS/TTSModule.d.ts +0 -58
- package/dist/modules/highlight/common/highlight.d.ts +0 -19
- package/dist/modules/highlight/common/styles.d.ts +0 -35
- package/dist/modules/syncnarration/SyncSettings.d.ts +0 -67
- package/dist/modules/syncnarration/SynchronizedNarrationModule.d.ts +0 -81
- package/dist/modules/syncnarration/renderer/media-overlays.d.ts +0 -0
- package/dist/reader.js.LICENSE.txt +0 -66
- package/dist/store/Annotator.d.ts +0 -25
- package/dist/store/LocalAnnotator.d.ts +0 -31
- package/dist/store/Store.d.ts +0 -6
- package/dist/utils/EventHandler.d.ts +0 -9
- package/dist/utils/HTMLTemplates.d.ts +0 -4
- package/dist/utils/KeyboardEventHandler.d.ts +0 -7
- package/dist/utils/decodeURI.d.ts +0 -1
|
@@ -1,16 +1,32 @@
|
|
|
1
|
-
import {
|
|
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
|
-
import
|
|
7
|
-
|
|
5
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
6
|
+
import { LayerSettings } from "./LayerSettings";
|
|
7
|
+
export declare enum HighlightContainer {
|
|
8
|
+
R2_ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER",
|
|
9
|
+
R2_ID_BOOKMAKRS_CONTAINER = "R2_ID_BOOKMAKRS_CONTAINER",
|
|
10
|
+
R2_ID_READALOUD_CONTAINER = "R2_ID_READALOUD_CONTAINER",
|
|
11
|
+
R2_ID_PAGEBREAK_CONTAINER = "R2_ID_PAGEBREAK_CONTAINER",
|
|
12
|
+
R2_ID_SEARCH_CONTAINER = "R2_ID_SEARCH_CONTAINER",
|
|
13
|
+
R2_ID_DEFINITIONS_CONTAINER = "R2_ID_DEFINITIONS_CONTAINER",
|
|
14
|
+
R2_ID_LINEFOCUS_CONTAINER = "R2_ID_LINEFOCUS_CONTAINER",
|
|
15
|
+
R2_ID_GUTTER_RIGHT_CONTAINER = "R2_ID_GUTTER_RIGHT_CONTAINER"
|
|
16
|
+
}
|
|
8
17
|
export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
|
|
9
|
-
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
10
18
|
export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
|
|
19
|
+
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
20
|
+
export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
|
|
21
|
+
export declare const DEFAULT_BACKGROUND_COLOR: {
|
|
22
|
+
blue: number;
|
|
23
|
+
green: number;
|
|
24
|
+
red: number;
|
|
25
|
+
};
|
|
11
26
|
export interface TextSelectorAPI {
|
|
12
27
|
selectionMenuOpen: any;
|
|
13
28
|
selectionMenuClose: any;
|
|
29
|
+
selection: any;
|
|
14
30
|
}
|
|
15
31
|
export declare const _highlights: IHighlight[];
|
|
16
32
|
interface IWithRect {
|
|
@@ -19,20 +35,31 @@ interface IWithRect {
|
|
|
19
35
|
}
|
|
20
36
|
export interface IHTMLDivElementWithRect extends HTMLDivElement, IWithRect {
|
|
21
37
|
}
|
|
38
|
+
export interface HTMLElementRect {
|
|
39
|
+
node: Element;
|
|
40
|
+
height: number;
|
|
41
|
+
top: number;
|
|
42
|
+
width: number;
|
|
43
|
+
left: number;
|
|
44
|
+
textContent: string;
|
|
45
|
+
}
|
|
22
46
|
export interface TextHighlighterProperties {
|
|
23
|
-
selectionMenuItems
|
|
47
|
+
selectionMenuItems?: Array<SelectionMenuItem>;
|
|
24
48
|
}
|
|
25
49
|
export interface TextHighlighterConfig extends TextHighlighterProperties {
|
|
26
50
|
delegate: IFrameNavigator;
|
|
27
|
-
api
|
|
51
|
+
api?: TextSelectorAPI;
|
|
52
|
+
layerSettings: LayerSettings;
|
|
28
53
|
}
|
|
29
|
-
export
|
|
54
|
+
export declare class TextHighlighter {
|
|
30
55
|
private options;
|
|
31
|
-
private delegate;
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
|
|
56
|
+
private readonly delegate;
|
|
57
|
+
layerSettings: LayerSettings;
|
|
58
|
+
private lastSelectedHighlight?;
|
|
59
|
+
properties: TextHighlighterProperties;
|
|
60
|
+
private api?;
|
|
35
61
|
private hasEventListener;
|
|
62
|
+
activeAnnotationMarkerId?: string;
|
|
36
63
|
static create(config: TextHighlighterConfig): Promise<any>;
|
|
37
64
|
private constructor();
|
|
38
65
|
initialize(): Promise<void>;
|
|
@@ -110,6 +137,9 @@ export default class TextHighlighter {
|
|
|
110
137
|
stopPropagation: () => void;
|
|
111
138
|
}): boolean;
|
|
112
139
|
bindEvents(el: any, _scope: any, hasEventListener: boolean): void;
|
|
140
|
+
mousedown(ev: MouseEvent): Promise<void>;
|
|
141
|
+
mouseup(ev: MouseEvent): Promise<void>;
|
|
142
|
+
mousemove(ev: MouseEvent): Promise<void>;
|
|
113
143
|
unbindEvents(el: any, _scope: any): void;
|
|
114
144
|
/**
|
|
115
145
|
* Permanently disables highlighting.
|
|
@@ -118,10 +148,13 @@ export default class TextHighlighter {
|
|
|
118
148
|
*/
|
|
119
149
|
destroy(): void;
|
|
120
150
|
initializeToolbox(): void;
|
|
121
|
-
toolboxMode(mode: "colors" | "edit" | "add"): void;
|
|
151
|
+
toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
|
|
122
152
|
toolboxHide(): void;
|
|
123
|
-
toolboxShowDelayed(): void;
|
|
124
|
-
|
|
153
|
+
toolboxShowDelayed(event: TouchEvent | MouseEvent): void;
|
|
154
|
+
showTool: ((b: boolean) => void) & {
|
|
155
|
+
clear(): void;
|
|
156
|
+
};
|
|
157
|
+
snapSelectionToWord(trimmed?: boolean): any;
|
|
125
158
|
toolboxShow(): void;
|
|
126
159
|
isSelectionMenuOpen: boolean;
|
|
127
160
|
selectionMenuOpened: (() => void) & {
|
|
@@ -130,6 +163,9 @@ export default class TextHighlighter {
|
|
|
130
163
|
selectionMenuClosed: (() => void) & {
|
|
131
164
|
clear(): void;
|
|
132
165
|
};
|
|
166
|
+
selection: ((text: any, selection: any) => void) & {
|
|
167
|
+
clear(): void;
|
|
168
|
+
};
|
|
133
169
|
toolboxPlacement(): void;
|
|
134
170
|
toolboxHandler(): void;
|
|
135
171
|
/**
|
|
@@ -141,8 +177,10 @@ export default class TextHighlighter {
|
|
|
141
177
|
doHighlight(keepRange?: boolean, marker?: AnnotationMarker): void;
|
|
142
178
|
speak(): void;
|
|
143
179
|
stopReadAloud(): void;
|
|
144
|
-
speakAll(): void;
|
|
145
180
|
callbackComplete(): void;
|
|
181
|
+
isOutsideViewport(rect: any): boolean;
|
|
182
|
+
isInsideViewport(rect: any): boolean;
|
|
183
|
+
get visibleTextRects(): HTMLElementRect[];
|
|
146
184
|
doneSpeaking(reload?: boolean): void;
|
|
147
185
|
/**
|
|
148
186
|
* Normalizes highlights. Ensures that highlighting is done with use of the smallest possible number of
|
|
@@ -180,20 +218,6 @@ export default class TextHighlighter {
|
|
|
180
218
|
* @memberof TextHighlighter
|
|
181
219
|
*/
|
|
182
220
|
getColor(): string;
|
|
183
|
-
/**
|
|
184
|
-
* Returns highlights from given container.
|
|
185
|
-
* @param params
|
|
186
|
-
* @param {HTMLElement} [params.container] - return highlights from this element. Default: the element the
|
|
187
|
-
* highlighter is applied to.
|
|
188
|
-
* @param {boolean} [params.andSelf] - if set to true and container is a highlight itself, add container to
|
|
189
|
-
* returned results. Default: true.
|
|
190
|
-
* @param {boolean} [params.grouped] - if set to true, highlights are grouped in logical groups of highlights added
|
|
191
|
-
* in the same moment. Each group is an object which has got array of highlights, 'toString' method and 'timestamp'
|
|
192
|
-
* property. Default: false.
|
|
193
|
-
* @returns {Array} - array of highlights.
|
|
194
|
-
* @memberof TextHighlighter
|
|
195
|
-
*/
|
|
196
|
-
getHighlights(params?: any): Array<any>;
|
|
197
221
|
/**
|
|
198
222
|
* Returns true if element is a highlight.
|
|
199
223
|
* All highlights have 'data-highlighted' attribute.
|
|
@@ -202,20 +226,6 @@ export default class TextHighlighter {
|
|
|
202
226
|
* @memberof TextHighlighter
|
|
203
227
|
*/
|
|
204
228
|
isHighlight(el: any): boolean;
|
|
205
|
-
/**
|
|
206
|
-
* Serializes all highlights in the element the highlighter is applied to.
|
|
207
|
-
* @returns {string} - stringified JSON with highlights definition
|
|
208
|
-
* @memberof TextHighlighter
|
|
209
|
-
*/
|
|
210
|
-
serializeHighlights(): string;
|
|
211
|
-
/**
|
|
212
|
-
* Deserializes highlights.
|
|
213
|
-
* @throws exception when can't parse JSON or JSON has invalid structure.
|
|
214
|
-
* @param {object} json - JSON object with highlights definition.
|
|
215
|
-
* @returns {Array} - array of deserialized highlights.
|
|
216
|
-
* @memberof TextHighlighter
|
|
217
|
-
*/
|
|
218
|
-
deserializeHighlights(json: any): Array<any>;
|
|
219
229
|
/**
|
|
220
230
|
* Creates wrapper for highlights.
|
|
221
231
|
* TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
|
|
@@ -234,25 +244,23 @@ export default class TextHighlighter {
|
|
|
234
244
|
};
|
|
235
245
|
static hexToRgbA(hex: string): string;
|
|
236
246
|
static hexToRgbAWithOpacity(hex: string, opacity: number): string;
|
|
237
|
-
resetHighlightBoundingStyle(
|
|
238
|
-
resetHighlightAreaStyle(
|
|
239
|
-
setHighlightAreaStyle(
|
|
247
|
+
resetHighlightBoundingStyle(highlightBounding: HTMLElement): void;
|
|
248
|
+
resetHighlightAreaStyle(highlightArea: HTMLElement, id_container: string): void;
|
|
249
|
+
setHighlightAreaStyle(doc: any, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
|
|
240
250
|
setAndResetSearchHighlight(highlight: any, highlights: any): void;
|
|
241
251
|
isIOS(): boolean;
|
|
242
252
|
isAndroid(): boolean;
|
|
243
|
-
getScrollingElement: (
|
|
244
|
-
processMouseEvent(
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
createHighlight(win: IReadiumIFrameWindow, selectionInfo: ISelectionInfo, color: IColor | undefined, pointerInteraction: boolean, marker: AnnotationMarker): IHighlight;
|
|
256
|
-
createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
|
|
253
|
+
getScrollingElement: (doc: Document | undefined) => Element;
|
|
254
|
+
processMouseEvent(ev: MouseEvent): Promise<void>;
|
|
255
|
+
prepareContainers(win: any): Promise<void>;
|
|
256
|
+
ensureHighlightsContainer(win: any, id: string): Promise<HTMLElement>;
|
|
257
|
+
hideAllhighlights(doc: Document): void;
|
|
258
|
+
destroyAllhighlights(doc: Document): void;
|
|
259
|
+
removeAllChildNodes(parent: any): void;
|
|
260
|
+
destroyHighlights(type: HighlightType): void;
|
|
261
|
+
destroyHighlight(doc: Document | null, id: string): void;
|
|
262
|
+
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?];
|
|
263
|
+
createHighlightDom(win: any, highlight: IHighlight): HTMLDivElement | undefined;
|
|
264
|
+
addSelectionMenuItem(citationIconMenu: SelectionMenuItem): void;
|
|
257
265
|
}
|
|
258
266
|
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ISelectionInfo } from "./selection";
|
|
2
|
+
import { AnnotationMarker } from "../../../model/Locator";
|
|
3
|
+
import { Definition } from "../../search/DefinitionsModule";
|
|
4
|
+
export interface IColor {
|
|
5
|
+
red: number;
|
|
6
|
+
green: number;
|
|
7
|
+
blue: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IStyleProperty {
|
|
10
|
+
property: string;
|
|
11
|
+
value: string;
|
|
12
|
+
priority?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface IStyle {
|
|
15
|
+
default?: [IStyleProperty] | undefined;
|
|
16
|
+
hover?: [IStyleProperty] | undefined;
|
|
17
|
+
defaultClass?: string | undefined;
|
|
18
|
+
hoverClass?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
export interface IPopupStyle {
|
|
21
|
+
background?: string;
|
|
22
|
+
textColor?: string;
|
|
23
|
+
class?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IHighlightStyle {
|
|
26
|
+
style?: IStyle;
|
|
27
|
+
color?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface IMarkerIcon {
|
|
30
|
+
id: string;
|
|
31
|
+
position: string;
|
|
32
|
+
title: string;
|
|
33
|
+
svgPath?: string;
|
|
34
|
+
color?: string;
|
|
35
|
+
class?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare enum HighlightType {
|
|
38
|
+
Annotation = 0,
|
|
39
|
+
Search = 1,
|
|
40
|
+
ReadAloud = 2,
|
|
41
|
+
PageBreak = 3,
|
|
42
|
+
Definition = 4,
|
|
43
|
+
LineFocus = 5,
|
|
44
|
+
Comment = 6
|
|
45
|
+
}
|
|
46
|
+
export interface IHighlight {
|
|
47
|
+
id: string;
|
|
48
|
+
selectionInfo: ISelectionInfo;
|
|
49
|
+
pointerInteraction: boolean;
|
|
50
|
+
marker: AnnotationMarker;
|
|
51
|
+
icon?: IMarkerIcon | undefined;
|
|
52
|
+
popup?: IPopupStyle | undefined;
|
|
53
|
+
color: string;
|
|
54
|
+
style?: IStyle | undefined;
|
|
55
|
+
position?: number;
|
|
56
|
+
note?: string | null | undefined;
|
|
57
|
+
definition?: Definition | undefined;
|
|
58
|
+
type: HighlightType;
|
|
59
|
+
}
|
|
60
|
+
export interface SelectionMenuItem {
|
|
61
|
+
id: string;
|
|
62
|
+
callback?: any;
|
|
63
|
+
marker?: AnnotationMarker;
|
|
64
|
+
icon?: IMarkerIcon;
|
|
65
|
+
popup?: IPopupStyle;
|
|
66
|
+
highlight?: IHighlightStyle;
|
|
67
|
+
note?: boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface IHighlightDefinition {
|
|
70
|
+
selectionInfo: ISelectionInfo | undefined;
|
|
71
|
+
color: string | undefined;
|
|
72
|
+
}
|
|
@@ -9,7 +9,7 @@ export interface IRect extends IRectSimple {
|
|
|
9
9
|
right: number;
|
|
10
10
|
}
|
|
11
11
|
export declare function getClientRectsNoOverlap(range: Range, doNotMergeHorizontallyAlignedRects: boolean): IRect[];
|
|
12
|
-
export declare function getClientRectsNoOverlap_(clientRects:
|
|
12
|
+
export declare function getClientRectsNoOverlap_(clientRects: DOMRectList, doNotMergeHorizontallyAlignedRects: boolean): IRect[];
|
|
13
13
|
export declare function rectIntersect(rect1: IRect, rect2: IRect): IRect;
|
|
14
14
|
export declare function rectSubtract(rect1: IRect, rect2: IRect): IRect[];
|
|
15
15
|
export declare function rectContainsPoint(rect: IRect, x: number, y: number, tolerance: number): boolean;
|
|
@@ -17,7 +17,7 @@ export declare function rectContains(rect1: IRect, rect2: IRect, tolerance: numb
|
|
|
17
17
|
export declare function getBoundingRect(rect1: IRect, rect2: IRect): IRect;
|
|
18
18
|
export declare function rectsTouchOrOverlap(rect1: IRect, rect2: IRect, tolerance: number): boolean;
|
|
19
19
|
export declare function mergeTouchingRects(rects: IRect[], tolerance: number, doNotMergeHorizontallyAlignedRects: boolean): IRect[];
|
|
20
|
-
export declare function
|
|
20
|
+
export declare function replaceOverlappingRects(rects: IRect[]): IRect[];
|
|
21
21
|
export declare function getRectOverlapX(rect1: IRect, rect2: IRect): number;
|
|
22
22
|
export declare function getRectOverlapY(rect1: IRect, rect2: IRect): number;
|
|
23
23
|
export declare function removeContainedRects(rects: IRect[], tolerance: number): IRect[];
|
|
@@ -9,8 +9,13 @@ export interface IRangeInfo {
|
|
|
9
9
|
export declare function sameRanges(r1: IRangeInfo, r2: IRangeInfo): boolean;
|
|
10
10
|
export interface ISelectionInfo {
|
|
11
11
|
rangeInfo: IRangeInfo;
|
|
12
|
-
cleanText
|
|
13
|
-
rawText
|
|
14
|
-
range
|
|
12
|
+
cleanText?: string;
|
|
13
|
+
rawText?: string;
|
|
14
|
+
range?: Range;
|
|
15
15
|
}
|
|
16
16
|
export declare function sameSelections(sel1: ISelectionInfo, sel2: ISelectionInfo): boolean;
|
|
17
|
+
export declare const _getCssSelectorOptions: {
|
|
18
|
+
className: (_str: string) => boolean;
|
|
19
|
+
idName: (_str: string) => boolean;
|
|
20
|
+
tagName: (_str: string) => boolean;
|
|
21
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IRangeInfo, ISelectionInfo } from "../../common/selection";
|
|
2
2
|
export declare function clearCurrentSelection(win: Window): void;
|
|
3
|
-
export declare function getCurrentSelectionInfo(win: Window, getCssSelector: (element: Element) => string): ISelectionInfo | undefined;
|
|
3
|
+
export declare function getCurrentSelectionInfo(win: Window, getCssSelector: (element: Element) => string | undefined): ISelectionInfo | undefined;
|
|
4
4
|
export declare function createOrderedRange(startNode: Node, startOffset: number, endNode: Node, endOffset: number): Range | undefined;
|
|
5
|
-
export declare function convertRange(range: Range, getCssSelector: (element: Element) => string): IRangeInfo | undefined;
|
|
5
|
+
export declare function convertRange(range: Range, getCssSelector: (element: Element) => string | undefined): IRangeInfo | undefined;
|
|
6
6
|
export declare function convertRangeInfo(documant: Document, rangeInfo: IRangeInfo): Range | undefined;
|
|
7
7
|
export declare function normalizeRange(r: Range): Range;
|
|
@@ -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,34 @@
|
|
|
1
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
2
|
+
import { ReaderModule } from "../ReaderModule";
|
|
3
|
+
import { Locator } from "../../model/Locator";
|
|
4
|
+
import { Publication } from "../../model/Publication";
|
|
5
|
+
import Annotator from "../../store/Annotator";
|
|
6
|
+
export interface HistoryModuleProperties {
|
|
7
|
+
hideLayer?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface HistoryModuleConfig extends HistoryModuleProperties {
|
|
10
|
+
annotator: Annotator;
|
|
11
|
+
delegate: IFrameNavigator;
|
|
12
|
+
headerMenu?: HTMLElement | null;
|
|
13
|
+
publication: Publication;
|
|
14
|
+
}
|
|
15
|
+
export declare class HistoryModule implements ReaderModule {
|
|
16
|
+
readonly annotator: Annotator | null;
|
|
17
|
+
private delegate;
|
|
18
|
+
private readonly headerMenu?;
|
|
19
|
+
private publication;
|
|
20
|
+
private properties;
|
|
21
|
+
private historyForwardAnchorElement;
|
|
22
|
+
private historyBackAnchorElement;
|
|
23
|
+
private historyCurrentIndex;
|
|
24
|
+
private history;
|
|
25
|
+
private constructor();
|
|
26
|
+
static create(config: HistoryModuleConfig): Promise<HistoryModule>;
|
|
27
|
+
stop(): Promise<void>;
|
|
28
|
+
handleResize(): Promise<void>;
|
|
29
|
+
setup(): void;
|
|
30
|
+
push(locator: Locator, history: boolean): Promise<void>;
|
|
31
|
+
protected start(): Promise<void>;
|
|
32
|
+
private handleHistoryForwardClick;
|
|
33
|
+
private handleHistoryBackClick;
|
|
34
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
lines?: number;
|
|
10
|
+
maxHeight?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface LineFocusModuleConfig extends LineFocusModuleProperties {
|
|
13
|
+
api?: LineFocusModuleAPI;
|
|
14
|
+
publication: Publication;
|
|
15
|
+
delegate: IFrameNavigator;
|
|
16
|
+
highlighter: TextHighlighter;
|
|
17
|
+
}
|
|
18
|
+
export default class LineFocusModule implements ReaderModule {
|
|
19
|
+
properties: LineFocusModuleProperties;
|
|
20
|
+
api?: LineFocusModuleAPI;
|
|
21
|
+
private delegate;
|
|
22
|
+
private highlighter;
|
|
23
|
+
private hasEventListener;
|
|
24
|
+
lines: Array<HTMLElement>;
|
|
25
|
+
index: number;
|
|
26
|
+
isActive: boolean;
|
|
27
|
+
isDebug: boolean;
|
|
28
|
+
lineFocusContainer: HTMLElement | null;
|
|
29
|
+
readerContainer: HTMLElement | null;
|
|
30
|
+
lineFocusTopBlinder: HTMLElement | null;
|
|
31
|
+
lineFocusBottomBlinder: HTMLElement | null;
|
|
32
|
+
static create(config: LineFocusModuleConfig): Promise<LineFocusModule>;
|
|
33
|
+
private constructor();
|
|
34
|
+
stop(): Promise<void>;
|
|
35
|
+
protected start(): Promise<void>;
|
|
36
|
+
private keydown;
|
|
37
|
+
private keyup;
|
|
38
|
+
handleResize(): void;
|
|
39
|
+
enableLineFocus(): Promise<void>;
|
|
40
|
+
wrapperHeight: string | undefined;
|
|
41
|
+
disableLineFocus(resetHeight?: boolean): void;
|
|
42
|
+
lineFocus(): void;
|
|
43
|
+
currentLine(): void;
|
|
44
|
+
lineDown(): void;
|
|
45
|
+
lineUp(): void;
|
|
46
|
+
almostEqual(a: number, b: number, tolerance: number): boolean;
|
|
47
|
+
findRects(parent: HTMLElement): any;
|
|
48
|
+
findTextNodes(parentElement: Element, nodes?: Array<Element>): Array<Element>;
|
|
49
|
+
measureTextNodes(node: Element): any;
|
|
50
|
+
measureImageNodes(node: Element): any;
|
|
51
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Publication } from "../../model/Publication";
|
|
2
|
-
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
3
|
-
import ReaderModule from "../ReaderModule";
|
|
2
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
3
|
+
import { ReaderModule } from "../ReaderModule";
|
|
4
4
|
import { Link } from "../../model/Link";
|
|
5
5
|
import { MediaOverlayNode } from "r2-shared-js/dist/es6-es2015/src/models/media-overlay";
|
|
6
6
|
import { MediaOverlaySettings } from "./MediaOverlaySettings";
|
|
@@ -17,46 +17,49 @@ export interface MediaOverlayModuleProperties {
|
|
|
17
17
|
autoScroll?: boolean;
|
|
18
18
|
autoTurn?: boolean;
|
|
19
19
|
volume?: number;
|
|
20
|
+
rate?: number;
|
|
20
21
|
wait?: number;
|
|
22
|
+
hideLayer?: boolean;
|
|
21
23
|
}
|
|
22
24
|
export interface MediaOverlayModuleConfig extends MediaOverlayModuleProperties {
|
|
23
25
|
publication: Publication;
|
|
24
26
|
delegate: IFrameNavigator;
|
|
25
|
-
api: MediaOverlayModuleAPI;
|
|
26
27
|
settings: MediaOverlaySettings;
|
|
28
|
+
api?: MediaOverlayModuleAPI;
|
|
27
29
|
}
|
|
28
|
-
export
|
|
30
|
+
export declare class MediaOverlayModule implements ReaderModule {
|
|
29
31
|
private publication;
|
|
30
32
|
private delegate;
|
|
31
33
|
private audioElement;
|
|
32
|
-
|
|
34
|
+
settings: MediaOverlaySettings;
|
|
35
|
+
private properties;
|
|
33
36
|
private play;
|
|
34
37
|
private pause;
|
|
35
38
|
private currentAudioBegin;
|
|
36
39
|
private currentAudioEnd;
|
|
37
40
|
private currentLinks;
|
|
38
41
|
private currentLinkIndex;
|
|
39
|
-
private mediaOverlaysPlaybackRate;
|
|
40
42
|
private currentAudioUrl;
|
|
41
43
|
private previousAudioUrl;
|
|
42
44
|
private previousAudioEnd;
|
|
43
45
|
private mediaOverlayRoot;
|
|
44
46
|
private mediaOverlayTextAudioPair;
|
|
45
47
|
private pid;
|
|
46
|
-
|
|
48
|
+
private __ontimeupdate;
|
|
49
|
+
static create(config: MediaOverlayModuleConfig): MediaOverlayModule;
|
|
47
50
|
private constructor();
|
|
48
|
-
stop():
|
|
49
|
-
protected start():
|
|
51
|
+
stop(): void;
|
|
52
|
+
protected start(): void;
|
|
50
53
|
initialize(): Promise<void>;
|
|
51
|
-
initializeResource(links: Array<Link>): Promise<void>;
|
|
54
|
+
initializeResource(links: Array<Link | undefined>): Promise<void>;
|
|
52
55
|
private playLink;
|
|
53
56
|
startReadAloud(): Promise<void>;
|
|
54
|
-
stopReadAloud(): void
|
|
57
|
+
stopReadAloud(): Promise<void>;
|
|
55
58
|
pauseReadAloud(): void;
|
|
56
59
|
resumeReadAloud(): Promise<void>;
|
|
57
60
|
findDepthFirstTextAudioPair(textHref: string, mo: MediaOverlayNode, textFragmentIDChain: Array<string | null> | undefined): MediaOverlayNode | undefined | null;
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
myReq: any;
|
|
62
|
+
trackCurrentTime(): void;
|
|
60
63
|
mediaOverlaysNext(escape?: boolean): void;
|
|
61
64
|
mediaOverlaysStop(): void;
|
|
62
65
|
mediaOverlaysPause(): void;
|
|
@@ -65,5 +68,7 @@ export default class MediaOverlayModule implements ReaderModule {
|
|
|
65
68
|
}, escape: boolean): MediaOverlayNode | undefined | null;
|
|
66
69
|
playMediaOverlaysAudio(moTextAudioPair: MediaOverlayNode, begin: number | undefined, end: number | undefined): Promise<void>;
|
|
67
70
|
playMediaOverlays(textHref: string, rootMo: MediaOverlayNode, textFragmentIDChain: Array<string | null> | undefined): Promise<void>;
|
|
68
|
-
|
|
71
|
+
ontimeupdate: (_v: Event) => Promise<void>;
|
|
72
|
+
ensureOnTimeUpdate: (remove: boolean, replace: boolean) => void;
|
|
73
|
+
mediaOverlayHighlight(id: string | undefined): void;
|
|
69
74
|
}
|
|
@@ -7,25 +7,29 @@ export declare class MEDIAOVERLAYREFS {
|
|
|
7
7
|
static readonly AUTO_SCROLL_REF = "autoscroll";
|
|
8
8
|
static readonly AUTO_TURN_REF = "autoturn";
|
|
9
9
|
static readonly VOLUME_REF = "volume";
|
|
10
|
+
static readonly RATE_REF = "rate";
|
|
10
11
|
static readonly COLOR_KEY: string;
|
|
11
12
|
static readonly AUTO_SCROLL_KEY: string;
|
|
12
13
|
static readonly AUTO_TURN_KEY: string;
|
|
13
14
|
static readonly VOLUME_KEY: string;
|
|
15
|
+
static readonly RATE_KEY: string;
|
|
14
16
|
}
|
|
15
17
|
export interface MediaOverlayConfig {
|
|
16
18
|
store: Store;
|
|
17
|
-
initialMediaOverlaySettings
|
|
18
|
-
headerMenu
|
|
19
|
-
api
|
|
19
|
+
initialMediaOverlaySettings?: MediaOverlayModuleProperties;
|
|
20
|
+
headerMenu?: HTMLElement | null;
|
|
21
|
+
api?: MediaOverlayModuleAPI;
|
|
20
22
|
}
|
|
21
23
|
export interface IMediaOverlayUserSettings {
|
|
22
24
|
color?: string;
|
|
23
25
|
autoScroll?: boolean;
|
|
24
26
|
autoTurn?: boolean;
|
|
25
27
|
volume?: number;
|
|
28
|
+
rate?: number;
|
|
26
29
|
playing?: boolean;
|
|
27
30
|
wait?: number;
|
|
28
31
|
}
|
|
32
|
+
export declare type MediaOverlayIncrementable = "mo_volume" | "mo_rate";
|
|
29
33
|
export declare class MediaOverlaySettings implements IMediaOverlayUserSettings {
|
|
30
34
|
private readonly store;
|
|
31
35
|
private readonly MEDIAOVERLAYSETTINGS;
|
|
@@ -33,35 +37,36 @@ export declare class MediaOverlaySettings implements IMediaOverlayUserSettings {
|
|
|
33
37
|
autoScroll: boolean;
|
|
34
38
|
autoTurn: boolean;
|
|
35
39
|
volume: number;
|
|
40
|
+
rate: number;
|
|
36
41
|
playing: boolean;
|
|
42
|
+
resourceReady: boolean;
|
|
37
43
|
wait: number;
|
|
38
44
|
userProperties: UserProperties;
|
|
39
45
|
private settingsChangeCallback;
|
|
40
46
|
private settingsView;
|
|
41
|
-
private readonly headerMenu
|
|
42
|
-
private volumeButtons;
|
|
47
|
+
private readonly headerMenu?;
|
|
43
48
|
private speechAutoScroll;
|
|
44
49
|
private speechAutoTurn;
|
|
45
50
|
private speechVolume;
|
|
46
|
-
private
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
private speechRate;
|
|
52
|
+
private readonly api?;
|
|
53
|
+
static create(config: MediaOverlayConfig): any;
|
|
54
|
+
protected constructor(store: Store, api?: MediaOverlayModuleAPI, headerMenu?: HTMLElement | null);
|
|
55
|
+
stop(): void;
|
|
50
56
|
private initialise;
|
|
51
57
|
private reset;
|
|
52
58
|
private initializeSelections;
|
|
53
59
|
setControls(): void;
|
|
54
60
|
private renderControls;
|
|
55
61
|
onSettingsChange(callback: () => void): void;
|
|
56
|
-
private setupEvents;
|
|
57
62
|
private storeProperty;
|
|
58
63
|
private updateUserSettings;
|
|
59
64
|
private getMediaOverlaySettings;
|
|
60
65
|
private saveProperty;
|
|
61
|
-
getProperty(name: string):
|
|
62
|
-
resetMediaOverlaySettings():
|
|
63
|
-
applyMediaOverlaySettings(mediaOverlaySettings: IMediaOverlayUserSettings):
|
|
64
|
-
applyMediaOverlaySetting(key: any, value: any):
|
|
65
|
-
increase(incremental:
|
|
66
|
-
decrease(incremental:
|
|
66
|
+
getProperty(name: string): UserProperty | null;
|
|
67
|
+
resetMediaOverlaySettings(): void;
|
|
68
|
+
applyMediaOverlaySettings(mediaOverlaySettings: IMediaOverlayUserSettings): void;
|
|
69
|
+
applyMediaOverlaySetting(key: any, value: any): void;
|
|
70
|
+
increase(incremental: MediaOverlayIncrementable): void;
|
|
71
|
+
decrease(incremental: MediaOverlayIncrementable): void;
|
|
67
72
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
2
|
+
import { ReaderModule } from "../ReaderModule";
|
|
3
|
+
import { IHighlight } from "../highlight/common/highlight";
|
|
4
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
5
|
+
import { Publication } from "../../model/Publication";
|
|
6
|
+
export interface PageBreakModuleProperties {
|
|
7
|
+
hideLayer?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface PageBreakModuleConfig extends PageBreakModuleProperties {
|
|
10
|
+
delegate: IFrameNavigator;
|
|
11
|
+
headerMenu?: HTMLElement | null;
|
|
12
|
+
publication: Publication;
|
|
13
|
+
}
|
|
14
|
+
export declare class PageBreakModule implements ReaderModule {
|
|
15
|
+
private delegate;
|
|
16
|
+
private readonly headerMenu?;
|
|
17
|
+
private publication;
|
|
18
|
+
private properties;
|
|
19
|
+
private goToPageView;
|
|
20
|
+
private goToPageNumberInput;
|
|
21
|
+
private goToPageNumberButton;
|
|
22
|
+
static create(config: PageBreakModuleConfig): Promise<PageBreakModule>;
|
|
23
|
+
private constructor();
|
|
24
|
+
stop(): Promise<void>;
|
|
25
|
+
protected start(): Promise<void>;
|
|
26
|
+
private goToPageNumber;
|
|
27
|
+
handleResize(): Promise<void>;
|
|
28
|
+
drawPageBreaks(): Promise<void>;
|
|
29
|
+
createPageBreakHighlight(selectionInfo: ISelectionInfo, title: string): IHighlight;
|
|
30
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Publication } from "../../model/Publication";
|
|
2
|
-
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
3
|
-
import ReaderModule from "../ReaderModule";
|
|
2
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
3
|
+
import { ReaderModule } from "../ReaderModule";
|
|
4
4
|
export interface TimelineModuleConfig {
|
|
5
5
|
publication: Publication;
|
|
6
6
|
delegate: IFrameNavigator;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export declare class TimelineModule implements ReaderModule {
|
|
9
9
|
private publication;
|
|
10
10
|
private delegate;
|
|
11
11
|
private timelineContainer;
|