@d-i-t-a/reader 1.10.0 → 1.11.0-beta.2
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/.DS_Store +0 -0
- package/dist/index.d.ts +10 -0
- package/dist/injectables/footnotes/footnotes.js.LICENSE.txt +6 -0
- package/dist/model/Locator.d.ts +3 -18
- package/dist/modules/AnnotationModule.d.ts +13 -5
- package/dist/modules/BookmarkModule.d.ts +12 -1
- package/dist/modules/TTS/TTSModule.d.ts +2 -27
- package/dist/modules/TTS/TTSModule2.d.ts +73 -0
- package/dist/modules/TTS/TTSSettings.d.ts +29 -5
- package/dist/modules/highlight/TextHighlighter.d.ts +21 -6
- package/dist/modules/highlight/common/highlight.d.ts +50 -2
- package/dist/modules/highlight/common/rect-utils.d.ts +1 -1
- package/dist/modules/highlight/common/selection.d.ts +5 -0
- package/dist/modules/pagebreak/PageBreakModule.d.ts +23 -0
- package/dist/navigator/IFrameNavigator.d.ts +11 -12
- package/dist/reader.css +0 -3
- package/dist/reader.css.map +1 -1
- package/dist/reader.js +1 -1
- package/dist/reader.js.map +1 -1
- package/dist/store/Annotator.d.ts +1 -0
- package/dist/store/LocalAnnotator.d.ts +1 -0
- package/dist/store/LocalPositions.d.ts +18 -0
- package/dist/store/Positions.d.ts +9 -0
- package/dist/utils/IconLib.d.ts +1 -0
- package/dist/views/BookView.d.ts +1 -1
- package/dist/views/FixedBookView.d.ts +1 -1
- package/dist/views/ReflowableBookView.d.ts +1 -1
- package/package.json +2 -1
package/dist/.DS_Store
ADDED
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,18 @@ import { Locator } from "./model/Locator";
|
|
|
3
3
|
export declare const IS_DEV: boolean;
|
|
4
4
|
export declare function unload(): Promise<void>;
|
|
5
5
|
export declare function hasMediaOverlays(): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Read Along
|
|
8
|
+
*/
|
|
9
|
+
export declare function startReadAlong(): void;
|
|
10
|
+
export declare function stopReadAlong(): void;
|
|
11
|
+
export declare function pauseReadAlong(): void;
|
|
12
|
+
export declare function resumeReadAlong(): void;
|
|
6
13
|
export declare function startReadAloud(): void;
|
|
7
14
|
export declare function stopReadAloud(): void;
|
|
8
15
|
export declare function pauseReadAloud(): void;
|
|
9
16
|
export declare function resumeReadAloud(): void;
|
|
17
|
+
export declare function saveBookmarkPlus(): void;
|
|
10
18
|
export declare function saveBookmark(): Promise<any>;
|
|
11
19
|
export declare function deleteBookmark(bookmark: any): Promise<any>;
|
|
12
20
|
export declare function deleteAnnotation(highlight: any): Promise<any>;
|
|
@@ -57,5 +65,7 @@ export declare function currentLocator(): Locator;
|
|
|
57
65
|
export declare function positions(): any;
|
|
58
66
|
export declare function goToPosition(value: any): void;
|
|
59
67
|
export declare function applyAttributes(value: any): void;
|
|
68
|
+
export declare function hideAnnotationLayer(): void;
|
|
69
|
+
export declare function showAnnotationLayer(): void;
|
|
60
70
|
export declare function snapToElement(value: any): void;
|
|
61
71
|
export declare function load(config: ReaderConfig): Promise<any>;
|
package/dist/model/Locator.d.ts
CHANGED
|
@@ -29,29 +29,14 @@ export interface Bookmark extends Locator {
|
|
|
29
29
|
}
|
|
30
30
|
export declare enum AnnotationMarker {
|
|
31
31
|
Highlight = 0,
|
|
32
|
-
Underline = 1
|
|
32
|
+
Underline = 1,
|
|
33
|
+
Bookmark = 2,
|
|
34
|
+
Custom = 3
|
|
33
35
|
}
|
|
34
36
|
export interface Annotation extends Locator {
|
|
35
37
|
id?: any;
|
|
36
38
|
created: Date;
|
|
37
39
|
highlight?: IHighlight;
|
|
38
|
-
marker: AnnotationMarker;
|
|
39
|
-
color: string;
|
|
40
|
-
}
|
|
41
|
-
export interface ISelectionInfo {
|
|
42
|
-
rangeInfo: IRangeInfo;
|
|
43
|
-
cleanText: string;
|
|
44
|
-
rawText: string;
|
|
45
|
-
color: string;
|
|
46
|
-
range: Range;
|
|
47
|
-
}
|
|
48
|
-
export interface IRangeInfo {
|
|
49
|
-
startContainerElementCssSelector: string;
|
|
50
|
-
startContainerChildTextNodeIndex: number;
|
|
51
|
-
startOffset: number;
|
|
52
|
-
endContainerElementCssSelector: string;
|
|
53
|
-
endContainerChildTextNodeIndex: number;
|
|
54
|
-
endOffset: number;
|
|
55
40
|
}
|
|
56
41
|
export interface ChapterWeight {
|
|
57
42
|
chapterHref: string;
|
|
@@ -4,11 +4,12 @@ import { Publication } from "../model/Publication";
|
|
|
4
4
|
import TextHighlighter from "./highlight/TextHighlighter";
|
|
5
5
|
import ReaderModule from "./ReaderModule";
|
|
6
6
|
import { IHighlight } from "./highlight/common/highlight";
|
|
7
|
-
import { Annotation
|
|
7
|
+
import { Annotation } from "../model/Locator";
|
|
8
8
|
export declare type Highlight = (highlight: Annotation) => Promise<Annotation>;
|
|
9
9
|
export interface AnnotationModuleAPI {
|
|
10
10
|
addAnnotation: Highlight;
|
|
11
11
|
deleteAnnotation: Highlight;
|
|
12
|
+
updateAnnotation: Highlight;
|
|
12
13
|
selectedAnnotation: Highlight;
|
|
13
14
|
}
|
|
14
15
|
export interface AnnotationModuleProperties {
|
|
@@ -25,7 +26,7 @@ export interface AnnotationModuleConfig extends AnnotationModuleProperties {
|
|
|
25
26
|
highlighter: TextHighlighter;
|
|
26
27
|
}
|
|
27
28
|
export default class AnnotationModule implements ReaderModule {
|
|
28
|
-
|
|
29
|
+
readonly annotator: Annotator | null;
|
|
29
30
|
private rights;
|
|
30
31
|
private publication;
|
|
31
32
|
private highlightsView;
|
|
@@ -39,21 +40,28 @@ export default class AnnotationModule implements ReaderModule {
|
|
|
39
40
|
constructor(annotator: Annotator, headerMenu: HTMLElement, rights: ReaderRights, publication: Publication, delegate: IFrameNavigator, initialAnnotations: any | null, properties: AnnotationModuleProperties | null, api: AnnotationModuleAPI | null, highlighter: TextHighlighter);
|
|
40
41
|
stop(): Promise<void>;
|
|
41
42
|
protected start(): Promise<void>;
|
|
42
|
-
|
|
43
|
+
private hide;
|
|
44
|
+
private show;
|
|
45
|
+
hideAnnotationLayer(): void;
|
|
46
|
+
showAnnotationLayer(): void;
|
|
47
|
+
handleResize(): Promise<void>;
|
|
43
48
|
initialize(): Promise<unknown>;
|
|
44
49
|
scrollToHighlight(id: any): Promise<any>;
|
|
50
|
+
updateLocalHighlight(annotation: Annotation): Promise<any>;
|
|
45
51
|
deleteLocalHighlight(id: any): Promise<any>;
|
|
46
52
|
deleteAnnotation(highlight: Annotation): Promise<any>;
|
|
47
53
|
addAnnotation(highlight: Annotation): Promise<any>;
|
|
48
54
|
deleteHighlight(highlight: Annotation): Promise<any>;
|
|
49
55
|
deleteSelectedHighlight(highlight: Annotation): Promise<any>;
|
|
50
|
-
|
|
56
|
+
updateAnnotation(highlight: Annotation): Promise<any>;
|
|
57
|
+
saveAnnotation(highlight: IHighlight): Promise<Annotation>;
|
|
51
58
|
getAnnotations(): Promise<any>;
|
|
52
59
|
showHighlights(): Promise<void>;
|
|
53
|
-
drawHighlights(
|
|
60
|
+
drawHighlights(): Promise<void>;
|
|
54
61
|
private createTree;
|
|
55
62
|
private handleAnnotationLinkClick;
|
|
56
63
|
private handleAnnotationLinkDeleteClick;
|
|
57
64
|
private static readableTimestamp;
|
|
58
65
|
getAnnotation(highlight: IHighlight): Promise<any>;
|
|
66
|
+
getAnnotationByID(id: string): Promise<any>;
|
|
59
67
|
}
|
|
@@ -2,7 +2,8 @@ import Annotator from "../store/Annotator";
|
|
|
2
2
|
import IFrameNavigator, { ReaderRights } from "../navigator/IFrameNavigator";
|
|
3
3
|
import { Publication } from "../model/Publication";
|
|
4
4
|
import ReaderModule from "./ReaderModule";
|
|
5
|
-
import { Bookmark } from "../model/Locator";
|
|
5
|
+
import { Annotation, Bookmark } from "../model/Locator";
|
|
6
|
+
import { IHighlight } from "./highlight/common/highlight";
|
|
6
7
|
export interface BookmarkModuleAPI {
|
|
7
8
|
addBookmark: (bookmark: Bookmark) => Promise<Bookmark>;
|
|
8
9
|
deleteBookmark: (bookmark: Bookmark) => Promise<Bookmark>;
|
|
@@ -35,12 +36,22 @@ export default class BookmarkModule implements ReaderModule {
|
|
|
35
36
|
constructor(annotator: Annotator, headerMenu: HTMLElement, rights: ReaderRights, publication: Publication, delegate: IFrameNavigator, initialAnnotations?: any | null, properties?: BookmarkModuleProperties | null, api?: BookmarkModuleAPI | null);
|
|
36
37
|
stop(): Promise<void>;
|
|
37
38
|
protected start(): Promise<void>;
|
|
39
|
+
handleResize(): Promise<void>;
|
|
40
|
+
initialize(): Promise<unknown>;
|
|
38
41
|
deleteBookmark(bookmark: Bookmark): Promise<any>;
|
|
42
|
+
saveBookmarkPlus(): void;
|
|
39
43
|
saveBookmark(): Promise<any>;
|
|
44
|
+
private addBookmarkPlus;
|
|
45
|
+
saveAnnotation(highlight: IHighlight): Promise<Annotation>;
|
|
40
46
|
getBookmarks(): Promise<any>;
|
|
41
47
|
showBookmarks(): Promise<void>;
|
|
48
|
+
drawBookmarks(): Promise<void>;
|
|
49
|
+
deleteSelectedHighlight(highlight: Annotation): Promise<any>;
|
|
50
|
+
deleteLocalHighlight(id: any): Promise<any>;
|
|
42
51
|
private createTree;
|
|
43
52
|
private handleAnnotationLinkClick;
|
|
44
53
|
private handleAnnotationLinkDeleteClick;
|
|
45
54
|
private static readableTimestamp;
|
|
55
|
+
getAnnotation(highlight: IHighlight): Promise<any>;
|
|
56
|
+
getAnnotationByID(id: string): Promise<any>;
|
|
46
57
|
}
|
|
@@ -1,33 +1,8 @@
|
|
|
1
1
|
import ReaderModule from "../ReaderModule";
|
|
2
|
-
import {
|
|
3
|
-
import { TTSSettings, TTSVoice } from "./TTSSettings";
|
|
2
|
+
import { TTSModuleAPI, TTSModuleConfig, TTSModuleProperties, TTSSettings } from "./TTSSettings";
|
|
4
3
|
import IFrameNavigator, { ReaderRights } from "../../navigator/IFrameNavigator";
|
|
5
4
|
import TextHighlighter from "../highlight/TextHighlighter";
|
|
6
|
-
|
|
7
|
-
started: any;
|
|
8
|
-
stopped: any;
|
|
9
|
-
paused: any;
|
|
10
|
-
resumed: any;
|
|
11
|
-
finished: any;
|
|
12
|
-
updateSettings: any;
|
|
13
|
-
}
|
|
14
|
-
export interface TTSModuleProperties {
|
|
15
|
-
enableSplitter?: boolean;
|
|
16
|
-
color?: string;
|
|
17
|
-
autoScroll?: boolean;
|
|
18
|
-
rate?: number;
|
|
19
|
-
pitch?: number;
|
|
20
|
-
volume?: number;
|
|
21
|
-
voice?: TTSVoice;
|
|
22
|
-
}
|
|
23
|
-
export interface TTSModuleConfig extends TTSModuleProperties {
|
|
24
|
-
delegate: IFrameNavigator;
|
|
25
|
-
headerMenu: HTMLElement;
|
|
26
|
-
rights: ReaderRights;
|
|
27
|
-
tts: TTSSettings;
|
|
28
|
-
highlighter: TextHighlighter;
|
|
29
|
-
api: TTSModuleAPI;
|
|
30
|
-
}
|
|
5
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
31
6
|
export default class TTSModule implements ReaderModule {
|
|
32
7
|
private tts;
|
|
33
8
|
private splittingResult;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import ReaderModule from "../ReaderModule";
|
|
2
|
+
import { TTSModuleAPI, TTSModuleConfig, TTSModuleProperties, TTSSettings } from "./TTSSettings";
|
|
3
|
+
import IFrameNavigator, { ReaderRights } from "../../navigator/IFrameNavigator";
|
|
4
|
+
import TextHighlighter from "../highlight/TextHighlighter";
|
|
5
|
+
import { IHighlight } from "../highlight/common/highlight";
|
|
6
|
+
import { ISelectionInfo } from "../highlight/common/selection";
|
|
7
|
+
export default class TTSModule2 implements ReaderModule {
|
|
8
|
+
private tts;
|
|
9
|
+
private voices;
|
|
10
|
+
private clean;
|
|
11
|
+
private rights;
|
|
12
|
+
private readonly highlighter;
|
|
13
|
+
private delegate;
|
|
14
|
+
private body;
|
|
15
|
+
private hasEventListener;
|
|
16
|
+
private readonly headerMenu;
|
|
17
|
+
private readonly properties;
|
|
18
|
+
private readonly api;
|
|
19
|
+
initialize(body: any): void;
|
|
20
|
+
private click;
|
|
21
|
+
private initVoices;
|
|
22
|
+
cancel(): void;
|
|
23
|
+
index: number;
|
|
24
|
+
speak(selectionInfo: ISelectionInfo | undefined, partial: boolean, callback: () => void): Promise<any>;
|
|
25
|
+
speakPlay(): void;
|
|
26
|
+
speakPause(): void;
|
|
27
|
+
speakResume(): void;
|
|
28
|
+
static create(config: TTSModuleConfig): Promise<TTSModule2>;
|
|
29
|
+
constructor(delegate: IFrameNavigator, tts: TTSSettings, headerMenu: HTMLElement, rights: ReaderRights, highlighter: TextHighlighter, properties?: TTSModuleProperties | null, api?: TTSModuleAPI | null);
|
|
30
|
+
protected start(): Promise<void>;
|
|
31
|
+
userScrolled: boolean;
|
|
32
|
+
private wheel;
|
|
33
|
+
stop(): Promise<void>;
|
|
34
|
+
generateTtsQueue(rootElement: Element, splitSentences: boolean): ITtsQueueItem[];
|
|
35
|
+
findTtsQueueItemIndex(ttsQueue: ITtsQueueItem[], element: Element, startTextNode: Node | undefined, startTextNodeOffset: number, rootElem: Element): number;
|
|
36
|
+
speaking: boolean;
|
|
37
|
+
restartIndex: number;
|
|
38
|
+
private restart;
|
|
39
|
+
startTTSSession(ttsQueue: ITtsQueueItem[], ttsQueueIndexStart: number): void;
|
|
40
|
+
ttsPlayQueueIndex(ttsQueueIndex: number, ttsQueue: any): void;
|
|
41
|
+
ttsQueueIndex: number;
|
|
42
|
+
ttsQueue: any;
|
|
43
|
+
ttsPlayQueueIndexDebounced: ((ttsQueueIndex: number, ttsQueue: any) => void) & {
|
|
44
|
+
clear(): void;
|
|
45
|
+
};
|
|
46
|
+
updateTTSInfo(ttsQueueItem: any, charIndex: number, charLength: number, utteranceText: string | undefined): string | undefined;
|
|
47
|
+
_ttsQueueItemHighlightsWord: IHighlight | undefined;
|
|
48
|
+
wrapHighlightWord(ttsQueueItemRef: ITtsQueueItemReference, utteranceText: string, charIndex: number, charLength: number, word: string, start: number, end: number): void;
|
|
49
|
+
}
|
|
50
|
+
export interface ITtsQueueItem {
|
|
51
|
+
dir: string | undefined;
|
|
52
|
+
lang: string | undefined;
|
|
53
|
+
parentElement: Element;
|
|
54
|
+
textNodes: Node[];
|
|
55
|
+
combinedText: string;
|
|
56
|
+
combinedTextSentences: string[] | undefined;
|
|
57
|
+
combinedTextSentencesRangeBegin: number[] | undefined;
|
|
58
|
+
combinedTextSentencesRangeEnd: number[] | undefined;
|
|
59
|
+
}
|
|
60
|
+
export interface ITtsQueueItemReference {
|
|
61
|
+
item: ITtsQueueItem;
|
|
62
|
+
iArray: number;
|
|
63
|
+
iSentence: number;
|
|
64
|
+
iGlobal: number;
|
|
65
|
+
}
|
|
66
|
+
export declare function getLanguage(el: Element): string | undefined;
|
|
67
|
+
export declare function getDirection(el: Element): string | undefined;
|
|
68
|
+
export declare function combineTextNodes(textNodes: Node[], skipNormalize?: boolean): string;
|
|
69
|
+
export declare function normalizeHtmlText(str: string): string;
|
|
70
|
+
export declare function normalizeText(str: string): string;
|
|
71
|
+
export declare function getTtsQueueItemRef(items: ITtsQueueItem[], index: number): ITtsQueueItemReference | undefined;
|
|
72
|
+
export declare function getTtsQueueLength(items: ITtsQueueItem[]): number;
|
|
73
|
+
export declare function getTtsQueueItemRefText(obj: ITtsQueueItemReference): string;
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import Store from "../../store/Store";
|
|
2
2
|
import { UserProperty, UserProperties } from "../../model/user-settings/UserProperties";
|
|
3
|
-
import {
|
|
3
|
+
import IFrameNavigator, { ReaderRights } from "../../navigator/IFrameNavigator";
|
|
4
|
+
import TextHighlighter from "../highlight/TextHighlighter";
|
|
5
|
+
export interface TTSModuleAPI {
|
|
6
|
+
started: any;
|
|
7
|
+
stopped: any;
|
|
8
|
+
paused: any;
|
|
9
|
+
resumed: any;
|
|
10
|
+
finished: any;
|
|
11
|
+
updateSettings: any;
|
|
12
|
+
}
|
|
13
|
+
export interface TTSModuleProperties {
|
|
14
|
+
enableSplitter?: boolean;
|
|
15
|
+
color?: string;
|
|
16
|
+
autoScroll?: boolean;
|
|
17
|
+
rate?: number;
|
|
18
|
+
pitch?: number;
|
|
19
|
+
volume?: number;
|
|
20
|
+
voice?: TTSVoice;
|
|
21
|
+
}
|
|
22
|
+
export interface TTSModuleConfig extends TTSModuleProperties {
|
|
23
|
+
delegate: IFrameNavigator;
|
|
24
|
+
headerMenu: HTMLElement;
|
|
25
|
+
rights: ReaderRights;
|
|
26
|
+
tts: TTSSettings;
|
|
27
|
+
highlighter: TextHighlighter;
|
|
28
|
+
api: TTSModuleAPI;
|
|
29
|
+
}
|
|
4
30
|
export declare class TTSREFS {
|
|
5
31
|
static readonly COLOR_REF = "color";
|
|
6
32
|
static readonly AUTO_SCROLL_REF = "autoscroll";
|
|
@@ -45,10 +71,8 @@ export declare class TTSSettings implements ITTSUserSettings {
|
|
|
45
71
|
volume: number;
|
|
46
72
|
voice: TTSVoice;
|
|
47
73
|
userProperties: UserProperties;
|
|
48
|
-
private rateButtons;
|
|
49
|
-
private pitchButtons;
|
|
50
|
-
private volumeButtons;
|
|
51
74
|
private settingsChangeCallback;
|
|
75
|
+
private restartCallback;
|
|
52
76
|
private settingsView;
|
|
53
77
|
private readonly headerMenu;
|
|
54
78
|
private speechRate;
|
|
@@ -66,7 +90,7 @@ export declare class TTSSettings implements ITTSUserSettings {
|
|
|
66
90
|
setControls(): void;
|
|
67
91
|
private renderControls;
|
|
68
92
|
onSettingsChange(callback: () => void): void;
|
|
69
|
-
|
|
93
|
+
onRestart(callback: () => void): void;
|
|
70
94
|
private storeProperty;
|
|
71
95
|
private updateUserSettings;
|
|
72
96
|
private getTTSSettings;
|
|
@@ -1,12 +1,16 @@
|
|
|
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
4
|
import { IReadiumIFrameWindow } from "./renderer/iframe/state";
|
|
5
5
|
import { AnnotationMarker } from "../../model/Locator";
|
|
6
|
-
import IFrameNavigator
|
|
6
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
7
7
|
export declare const ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER";
|
|
8
|
+
export declare const ID_READALOUD_CONTAINER = "R2_ID_READALOUD_CONTAINER";
|
|
9
|
+
export declare const ID_PAGEBREAK_CONTAINER = "R2_ID_PAGEBREAK_CONTAINER";
|
|
10
|
+
export declare const ID_SEARCH_CONTAINER = "R2_ID_SEARCH_CONTAINER";
|
|
8
11
|
export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
|
|
9
12
|
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
13
|
+
export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
|
|
10
14
|
export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
|
|
11
15
|
export interface TextSelectorAPI {
|
|
12
16
|
selectionMenuOpen: any;
|
|
@@ -19,6 +23,14 @@ interface IWithRect {
|
|
|
19
23
|
}
|
|
20
24
|
export interface IHTMLDivElementWithRect extends HTMLDivElement, IWithRect {
|
|
21
25
|
}
|
|
26
|
+
export interface HTMLElementRect {
|
|
27
|
+
node: Element;
|
|
28
|
+
height: number;
|
|
29
|
+
top: number;
|
|
30
|
+
width: number;
|
|
31
|
+
left: number;
|
|
32
|
+
textContent: string;
|
|
33
|
+
}
|
|
22
34
|
export interface TextHighlighterProperties {
|
|
23
35
|
selectionMenuItems: Array<SelectionMenuItem>;
|
|
24
36
|
}
|
|
@@ -118,7 +130,7 @@ export default class TextHighlighter {
|
|
|
118
130
|
*/
|
|
119
131
|
destroy(): void;
|
|
120
132
|
initializeToolbox(): void;
|
|
121
|
-
toolboxMode(mode: "colors" | "edit" | "add"): void;
|
|
133
|
+
toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
|
|
122
134
|
toolboxHide(): void;
|
|
123
135
|
toolboxShowDelayed(): void;
|
|
124
136
|
snapSelectionToWord(): any;
|
|
@@ -143,6 +155,7 @@ export default class TextHighlighter {
|
|
|
143
155
|
stopReadAloud(): void;
|
|
144
156
|
speakAll(): void;
|
|
145
157
|
callbackComplete(): void;
|
|
158
|
+
get visibleTextRects(): HTMLElementRect[];
|
|
146
159
|
doneSpeaking(reload?: boolean): void;
|
|
147
160
|
/**
|
|
148
161
|
* Normalizes highlights. Ensures that highlighting is done with use of the smallest possible number of
|
|
@@ -235,16 +248,17 @@ export default class TextHighlighter {
|
|
|
235
248
|
static hexToRgbA(hex: string): string;
|
|
236
249
|
static hexToRgbAWithOpacity(hex: string, opacity: number): string;
|
|
237
250
|
resetHighlightBoundingStyle(_win: IReadiumIFrameWindow, highlightBounding: HTMLElement): void;
|
|
238
|
-
resetHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightArea: HTMLElement): void;
|
|
251
|
+
resetHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightArea: HTMLElement, id_container: string): void;
|
|
239
252
|
setHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
|
|
240
253
|
setAndResetSearchHighlight(highlight: any, highlights: any): void;
|
|
241
254
|
isIOS(): boolean;
|
|
242
255
|
isAndroid(): boolean;
|
|
243
256
|
getScrollingElement: (documant: Document) => Element;
|
|
244
257
|
processMouseEvent(win: IReadiumIFrameWindow, ev: MouseEvent): Promise<void>;
|
|
245
|
-
ensureHighlightsContainer(win: IReadiumIFrameWindow): HTMLElement;
|
|
258
|
+
ensureHighlightsContainer(win: IReadiumIFrameWindow, id: string): HTMLElement;
|
|
246
259
|
hideAllhighlights(_documant: Document): void;
|
|
247
260
|
destroyAllhighlights(documant: Document): void;
|
|
261
|
+
destroyHighlights(type: HighlightType): void;
|
|
248
262
|
destroyHighlight(documant: Document, id: string): void;
|
|
249
263
|
recreateAllHighlightsRaw(win: IReadiumIFrameWindow): void;
|
|
250
264
|
recreateAllHighlightsDebounced: ((win: IReadiumIFrameWindow) => void) & {
|
|
@@ -252,7 +266,8 @@ export default class TextHighlighter {
|
|
|
252
266
|
};
|
|
253
267
|
recreateAllHighlights(win: IReadiumIFrameWindow): void;
|
|
254
268
|
createSearchHighlight(selectionInfo: ISelectionInfo, color: string): IHighlight;
|
|
255
|
-
|
|
269
|
+
createPageBreakHighlight(selectionInfo: ISelectionInfo, title: string): IHighlight;
|
|
270
|
+
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];
|
|
256
271
|
createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
|
|
257
272
|
}
|
|
258
273
|
export {};
|
|
@@ -5,15 +5,63 @@ export interface IColor {
|
|
|
5
5
|
green: number;
|
|
6
6
|
blue: number;
|
|
7
7
|
}
|
|
8
|
+
export interface IStyleProperty {
|
|
9
|
+
property: string;
|
|
10
|
+
value: string;
|
|
11
|
+
priority?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface IStyle {
|
|
14
|
+
default?: [IStyleProperty] | undefined;
|
|
15
|
+
hover?: [IStyleProperty] | undefined;
|
|
16
|
+
defaultClass?: string | undefined;
|
|
17
|
+
hoverClass?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface IPopupStyle {
|
|
20
|
+
background?: string;
|
|
21
|
+
textColor?: string;
|
|
22
|
+
class?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface IHighlightStyle {
|
|
25
|
+
style?: IStyle;
|
|
26
|
+
color?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface IMarkerIcon {
|
|
29
|
+
id: string;
|
|
30
|
+
position: string;
|
|
31
|
+
title: string;
|
|
32
|
+
svgPath?: string;
|
|
33
|
+
color?: string;
|
|
34
|
+
class?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare enum HighlightType {
|
|
37
|
+
Annotation = 0,
|
|
38
|
+
Search = 1,
|
|
39
|
+
ReadAloud = 2,
|
|
40
|
+
PageBreak = 3
|
|
41
|
+
}
|
|
8
42
|
export interface IHighlight {
|
|
9
43
|
id: string;
|
|
10
44
|
selectionInfo: ISelectionInfo;
|
|
11
|
-
color: IColor;
|
|
12
45
|
pointerInteraction: boolean;
|
|
13
46
|
marker: AnnotationMarker;
|
|
47
|
+
icon?: IMarkerIcon | undefined;
|
|
48
|
+
popup?: IPopupStyle | undefined;
|
|
49
|
+
color: string;
|
|
50
|
+
style?: IStyle | undefined;
|
|
14
51
|
position?: number;
|
|
52
|
+
note?: string | undefined;
|
|
53
|
+
type: HighlightType;
|
|
54
|
+
}
|
|
55
|
+
export interface SelectionMenuItem {
|
|
56
|
+
id: string;
|
|
57
|
+
callback?: any;
|
|
58
|
+
marker?: AnnotationMarker;
|
|
59
|
+
icon?: IMarkerIcon;
|
|
60
|
+
popup?: IPopupStyle;
|
|
61
|
+
highlight?: IHighlightStyle;
|
|
62
|
+
note?: boolean;
|
|
15
63
|
}
|
|
16
64
|
export interface IHighlightDefinition {
|
|
17
65
|
selectionInfo: ISelectionInfo | undefined;
|
|
18
|
-
color:
|
|
66
|
+
color: string | undefined;
|
|
19
67
|
}
|
|
@@ -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[];
|
|
@@ -14,3 +14,8 @@ export interface ISelectionInfo {
|
|
|
14
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
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import IFrameNavigator from "../../navigator/IFrameNavigator";
|
|
2
|
+
import ReaderModule from "../ReaderModule";
|
|
3
|
+
import { Publication } from "../../model/Publication";
|
|
4
|
+
export interface PageBreakModuleConfig {
|
|
5
|
+
delegate: IFrameNavigator;
|
|
6
|
+
headerMenu: HTMLElement;
|
|
7
|
+
publication: Publication;
|
|
8
|
+
}
|
|
9
|
+
export default class PageBreakModule implements ReaderModule {
|
|
10
|
+
private delegate;
|
|
11
|
+
private readonly headerMenu;
|
|
12
|
+
private publication;
|
|
13
|
+
private goToPageView;
|
|
14
|
+
private goToPageNumberInput;
|
|
15
|
+
private goToPageNumberButton;
|
|
16
|
+
static create(config: PageBreakModuleConfig): Promise<PageBreakModule>;
|
|
17
|
+
private constructor();
|
|
18
|
+
stop(): Promise<void>;
|
|
19
|
+
protected start(): Promise<void>;
|
|
20
|
+
private goToPageNumber;
|
|
21
|
+
handleResize(): Promise<void>;
|
|
22
|
+
drawPageBreaks(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -5,7 +5,6 @@ import { Locator, ReadingPosition } from "../model/Locator";
|
|
|
5
5
|
import { UserSettings, UserSettingsUIConfig } from "../model/user-settings/UserSettings";
|
|
6
6
|
import BookmarkModule, { BookmarkModuleConfig } from "../modules/BookmarkModule";
|
|
7
7
|
import AnnotationModule, { AnnotationModuleConfig } from "../modules/AnnotationModule";
|
|
8
|
-
import TTSModule, { TTSModuleConfig } from "../modules/TTS/TTSModule";
|
|
9
8
|
import SearchModule, { SearchModuleConfig } from "../modules/search/SearchModule";
|
|
10
9
|
import ContentProtectionModule, { ContentProtectionModuleConfig } from "../modules/protection/ContentProtectionModule";
|
|
11
10
|
import TextHighlighter, { TextHighlighterConfig } from "../modules/highlight/TextHighlighter";
|
|
@@ -13,6 +12,9 @@ import TimelineModule from "../modules/positions/TimelineModule";
|
|
|
13
12
|
import BookView from "../views/BookView";
|
|
14
13
|
import MediaOverlayModule, { MediaOverlayModuleConfig } from "../modules/mediaoverlays/MediaOverlayModule";
|
|
15
14
|
import { D2Link, Link } from "../model/Link";
|
|
15
|
+
import ReaderModule from "../modules/ReaderModule";
|
|
16
|
+
import { TTSModuleConfig } from "../modules/TTS/TTSSettings";
|
|
17
|
+
import PageBreakModule from "../modules/pagebreak/PageBreakModule";
|
|
16
18
|
export declare type GetContent = (href: string) => Promise<string>;
|
|
17
19
|
export declare type GetContentBytesLength = (href: string) => Promise<number>;
|
|
18
20
|
export interface NavigatorAPI {
|
|
@@ -76,10 +78,6 @@ export interface Injectable {
|
|
|
76
78
|
appearance?: string;
|
|
77
79
|
async?: boolean;
|
|
78
80
|
}
|
|
79
|
-
export interface SelectionMenuItem {
|
|
80
|
-
id: string;
|
|
81
|
-
callback: any;
|
|
82
|
-
}
|
|
83
81
|
export interface ReaderRights {
|
|
84
82
|
enableBookmarks?: boolean;
|
|
85
83
|
enableAnnotations?: boolean;
|
|
@@ -126,11 +124,12 @@ export default class IFrameNavigator implements Navigator {
|
|
|
126
124
|
publication: Publication;
|
|
127
125
|
bookmarkModule?: BookmarkModule;
|
|
128
126
|
annotationModule?: AnnotationModule;
|
|
129
|
-
ttsModule?:
|
|
127
|
+
ttsModule?: ReaderModule;
|
|
130
128
|
searchModule?: SearchModule;
|
|
131
129
|
contentProtectionModule?: ContentProtectionModule;
|
|
132
130
|
highlighter?: TextHighlighter;
|
|
133
131
|
timelineModule?: TimelineModule;
|
|
132
|
+
pageBreakModule?: PageBreakModule;
|
|
134
133
|
mediaOverlayModule?: MediaOverlayModule;
|
|
135
134
|
sideNavExpanded: boolean;
|
|
136
135
|
material: boolean;
|
|
@@ -165,9 +164,6 @@ export default class IFrameNavigator implements Navigator {
|
|
|
165
164
|
private landmarksView;
|
|
166
165
|
private landmarksSection;
|
|
167
166
|
private pageListView;
|
|
168
|
-
private goToPageView;
|
|
169
|
-
private goToPageNumberInput;
|
|
170
|
-
private goToPageNumberButton;
|
|
171
167
|
private bookmarksControl;
|
|
172
168
|
private bookmarksView;
|
|
173
169
|
private links;
|
|
@@ -209,7 +205,6 @@ export default class IFrameNavigator implements Navigator {
|
|
|
209
205
|
reload: () => Promise<void>;
|
|
210
206
|
private setupEvents;
|
|
211
207
|
private setupModalFocusTrap;
|
|
212
|
-
private goToPageNumber;
|
|
213
208
|
isScrolling: boolean;
|
|
214
209
|
private updateBookView;
|
|
215
210
|
private loadManifest;
|
|
@@ -227,9 +222,13 @@ export default class IFrameNavigator implements Navigator {
|
|
|
227
222
|
private handleEditClick;
|
|
228
223
|
get hasMediaOverlays(): boolean;
|
|
229
224
|
startReadAloud(): void;
|
|
230
|
-
|
|
225
|
+
startReadAlong(): void;
|
|
226
|
+
stopReadAloud(): void;
|
|
227
|
+
stopReadAlong(): void;
|
|
231
228
|
pauseReadAloud(): void;
|
|
229
|
+
pauseReadAlong(): void;
|
|
232
230
|
resumeReadAloud(): void;
|
|
231
|
+
resumeReadAlong(): void;
|
|
233
232
|
totalResources(): number;
|
|
234
233
|
mostRecentNavigatedTocItem(): string;
|
|
235
234
|
currentResource(): number;
|
|
@@ -253,7 +252,7 @@ export default class IFrameNavigator implements Navigator {
|
|
|
253
252
|
private handleClickThrough;
|
|
254
253
|
private handleInternalLink;
|
|
255
254
|
private handleNumberOfIframes;
|
|
256
|
-
|
|
255
|
+
handleResize(): Promise<void>;
|
|
257
256
|
updatePositionInfo(save?: boolean): Promise<void>;
|
|
258
257
|
savePosition: (() => Promise<void>) & {
|
|
259
258
|
clear(): void;
|