@d-i-t-a/reader 2.1.0-alpha.3 → 2.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -3
- package/dist/esm/index.js +48628 -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 +255 -0
- package/dist/injectables/style/toast.css +76 -0
- package/dist/reader.css +178 -87
- package/dist/reader.js +128 -3
- package/dist/reader.js.map +7 -1
- package/dist/reader.map.css +21 -0
- 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 +3 -18
- 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 -23
- package/dist/{modules → types/modules}/AnnotationModule.d.ts +31 -19
- 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 +40 -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 +65 -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 +71 -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 +14 -10
- 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 +22 -18
- package/dist/{modules → types/modules}/search/searchWithDomSeek.d.ts +1 -1
- package/dist/{navigator → types/navigator}/IFrameNavigator.d.ts +99 -74
- 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 +25 -0
- package/dist/types/store/LocalAnnotator.d.ts +31 -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/{utils → types/utils}/HTMLTemplates.d.ts +0 -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 +6 -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 +54 -25
- 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/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.css.map +0 -21
- 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/KeyboardEventHandler.d.ts +0 -7
- package/dist/utils/decodeURI.d.ts +0 -1
|
@@ -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
|
+
color?: string;
|
|
15
|
+
autoScroll?: boolean;
|
|
16
|
+
rate?: number;
|
|
17
|
+
pitch?: number;
|
|
18
|
+
volume?: number;
|
|
19
|
+
voice?: TTSVoice;
|
|
20
|
+
hideLayer?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface TTSModuleConfig extends TTSModuleProperties {
|
|
23
|
+
delegate: IFrameNavigator;
|
|
24
|
+
rights: ReaderRights;
|
|
25
|
+
tts: TTSSettings;
|
|
26
|
+
highlighter: TextHighlighter;
|
|
27
|
+
headerMenu?: HTMLElement | null;
|
|
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";
|
|
@@ -17,9 +43,9 @@ export declare class TTSREFS {
|
|
|
17
43
|
}
|
|
18
44
|
export interface TTSSettingsConfig {
|
|
19
45
|
store: Store;
|
|
20
|
-
initialTTSSettings
|
|
21
|
-
headerMenu
|
|
22
|
-
api
|
|
46
|
+
initialTTSSettings?: TTSModuleProperties;
|
|
47
|
+
headerMenu?: HTMLElement | null;
|
|
48
|
+
api?: TTSModuleAPI;
|
|
23
49
|
}
|
|
24
50
|
export interface TTSVoice {
|
|
25
51
|
usePublication: boolean;
|
|
@@ -35,6 +61,7 @@ export interface ITTSUserSettings {
|
|
|
35
61
|
volume?: number;
|
|
36
62
|
voice?: TTSVoice;
|
|
37
63
|
}
|
|
64
|
+
export declare type TTSIncrementable = "pitch" | "rate" | "volume";
|
|
38
65
|
export declare class TTSSettings implements ITTSUserSettings {
|
|
39
66
|
private readonly store;
|
|
40
67
|
private readonly TTSSETTINGS;
|
|
@@ -45,37 +72,34 @@ export declare class TTSSettings implements ITTSUserSettings {
|
|
|
45
72
|
volume: number;
|
|
46
73
|
voice: TTSVoice;
|
|
47
74
|
userProperties: UserProperties;
|
|
48
|
-
private rateButtons;
|
|
49
|
-
private pitchButtons;
|
|
50
|
-
private volumeButtons;
|
|
51
75
|
private settingsChangeCallback;
|
|
76
|
+
private restartCallback;
|
|
52
77
|
private settingsView;
|
|
53
|
-
private readonly headerMenu
|
|
78
|
+
private readonly headerMenu?;
|
|
54
79
|
private speechRate;
|
|
55
80
|
private speechPitch;
|
|
56
81
|
private speechVolume;
|
|
57
82
|
private speechAutoScroll;
|
|
58
|
-
private readonly api
|
|
59
|
-
static create(config: TTSSettingsConfig):
|
|
60
|
-
protected constructor(store: Store, headerMenu
|
|
83
|
+
private readonly api?;
|
|
84
|
+
static create(config: TTSSettingsConfig): TTSSettings;
|
|
85
|
+
protected constructor(store: Store, api?: TTSModuleAPI, headerMenu?: HTMLElement | null);
|
|
61
86
|
enableSplitter?: boolean;
|
|
62
|
-
stop():
|
|
87
|
+
stop(): void;
|
|
63
88
|
private initialise;
|
|
64
89
|
private reset;
|
|
65
90
|
private initializeSelections;
|
|
66
91
|
setControls(): void;
|
|
67
92
|
private renderControls;
|
|
68
93
|
onSettingsChange(callback: () => void): void;
|
|
69
|
-
|
|
94
|
+
onRestart(callback: () => void): void;
|
|
70
95
|
private storeProperty;
|
|
71
96
|
private updateUserSettings;
|
|
72
97
|
private getTTSSettings;
|
|
73
98
|
private saveProperty;
|
|
74
|
-
getProperty(name: string):
|
|
75
|
-
resetTTSSettings():
|
|
76
|
-
applyTTSSettings(ttsSettings: ITTSUserSettings):
|
|
77
|
-
applyPreferredVoice(value:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
decrease(incremental: string): Promise<void>;
|
|
99
|
+
getProperty(name: string): UserProperty | undefined;
|
|
100
|
+
resetTTSSettings(): void;
|
|
101
|
+
applyTTSSettings(ttsSettings: Partial<ITTSUserSettings>): void;
|
|
102
|
+
applyPreferredVoice(value: string): void;
|
|
103
|
+
increase(incremental: TTSIncrementable): void;
|
|
104
|
+
decrease(incremental: string): void;
|
|
81
105
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 declare enum CitationStyle {
|
|
6
|
+
Chicago = 0,
|
|
7
|
+
MLA = 1,
|
|
8
|
+
APA = 2
|
|
9
|
+
}
|
|
10
|
+
export declare enum ContributorType {
|
|
11
|
+
Author = "Author",
|
|
12
|
+
Editor = "Editor",
|
|
13
|
+
Translator = "Translator",
|
|
14
|
+
Compiler = "Compiler"
|
|
15
|
+
}
|
|
16
|
+
export interface CitationModuleProperties {
|
|
17
|
+
characters?: number;
|
|
18
|
+
appName?: string;
|
|
19
|
+
appLink?: string;
|
|
20
|
+
library?: string;
|
|
21
|
+
styles?: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface CitationModuleConfig extends CitationModuleProperties {
|
|
24
|
+
publication: Publication;
|
|
25
|
+
delegate: IFrameNavigator;
|
|
26
|
+
highlighter: TextHighlighter;
|
|
27
|
+
}
|
|
28
|
+
export default class CitationModule implements ReaderModule {
|
|
29
|
+
private publication;
|
|
30
|
+
private delegate;
|
|
31
|
+
private properties;
|
|
32
|
+
private readonly highlighter?;
|
|
33
|
+
private constructor();
|
|
34
|
+
static create(config: CitationModuleConfig): Promise<CitationModule>;
|
|
35
|
+
stop(): Promise<void>;
|
|
36
|
+
copyToClipboard(textToClipboard: any): void;
|
|
37
|
+
createElementForExecCommand(textToClipboard: any): HTMLDivElement;
|
|
38
|
+
selectContent(element: any): void;
|
|
39
|
+
protected start(): Promise<void>;
|
|
40
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Store from "../../store/Store";
|
|
2
|
+
import { UserProperty, UserProperties } from "../../model/user-settings/UserProperties";
|
|
3
|
+
export interface LayerConfig {
|
|
4
|
+
store: Store;
|
|
5
|
+
}
|
|
6
|
+
export interface ILayerSettings {
|
|
7
|
+
}
|
|
8
|
+
export declare class LayerSettings implements ILayerSettings {
|
|
9
|
+
private readonly store;
|
|
10
|
+
private readonly LAYERSETTINGS;
|
|
11
|
+
userProperties: UserProperties;
|
|
12
|
+
static create(config: LayerConfig): Promise<any>;
|
|
13
|
+
protected constructor(store: Store);
|
|
14
|
+
stop(): Promise<void>;
|
|
15
|
+
private initialize;
|
|
16
|
+
private getLayerSettings;
|
|
17
|
+
saveProperty(property: UserProperty): Promise<any>;
|
|
18
|
+
getProperty(name: string): Promise<UserProperty | null>;
|
|
19
|
+
}
|
|
@@ -1,16 +1,31 @@
|
|
|
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
|
+
}
|
|
8
16
|
export declare const CLASS_HIGHLIGHT_CONTAINER = "R2_CLASS_HIGHLIGHT_CONTAINER";
|
|
9
|
-
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
10
17
|
export declare const CLASS_HIGHLIGHT_BOUNDING_AREA = "R2_CLASS_HIGHLIGHT_BOUNDING_AREA";
|
|
18
|
+
export declare const CLASS_HIGHLIGHT_AREA = "R2_CLASS_HIGHLIGHT_AREA";
|
|
19
|
+
export declare const CLASS_HIGHLIGHT_ICON = "R2_CLASS_HIGHLIGHT_ICON";
|
|
20
|
+
export declare const DEFAULT_BACKGROUND_COLOR: {
|
|
21
|
+
blue: number;
|
|
22
|
+
green: number;
|
|
23
|
+
red: number;
|
|
24
|
+
};
|
|
11
25
|
export interface TextSelectorAPI {
|
|
12
26
|
selectionMenuOpen: any;
|
|
13
27
|
selectionMenuClose: any;
|
|
28
|
+
selection: any;
|
|
14
29
|
}
|
|
15
30
|
export declare const _highlights: IHighlight[];
|
|
16
31
|
interface IWithRect {
|
|
@@ -19,20 +34,31 @@ interface IWithRect {
|
|
|
19
34
|
}
|
|
20
35
|
export interface IHTMLDivElementWithRect extends HTMLDivElement, IWithRect {
|
|
21
36
|
}
|
|
37
|
+
export interface HTMLElementRect {
|
|
38
|
+
node: Element;
|
|
39
|
+
height: number;
|
|
40
|
+
top: number;
|
|
41
|
+
width: number;
|
|
42
|
+
left: number;
|
|
43
|
+
textContent: string;
|
|
44
|
+
}
|
|
22
45
|
export interface TextHighlighterProperties {
|
|
23
|
-
selectionMenuItems
|
|
46
|
+
selectionMenuItems?: Array<SelectionMenuItem>;
|
|
24
47
|
}
|
|
25
48
|
export interface TextHighlighterConfig extends TextHighlighterProperties {
|
|
26
49
|
delegate: IFrameNavigator;
|
|
27
|
-
api
|
|
50
|
+
api?: TextSelectorAPI;
|
|
51
|
+
layerSettings: LayerSettings;
|
|
28
52
|
}
|
|
29
|
-
export
|
|
53
|
+
export declare class TextHighlighter {
|
|
30
54
|
private options;
|
|
31
|
-
private delegate;
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
|
|
55
|
+
private readonly delegate;
|
|
56
|
+
layerSettings: LayerSettings;
|
|
57
|
+
private lastSelectedHighlight?;
|
|
58
|
+
properties: TextHighlighterProperties;
|
|
59
|
+
private api?;
|
|
35
60
|
private hasEventListener;
|
|
61
|
+
activeAnnotationMarkerId?: string;
|
|
36
62
|
static create(config: TextHighlighterConfig): Promise<any>;
|
|
37
63
|
private constructor();
|
|
38
64
|
initialize(): Promise<void>;
|
|
@@ -110,6 +136,9 @@ export default class TextHighlighter {
|
|
|
110
136
|
stopPropagation: () => void;
|
|
111
137
|
}): boolean;
|
|
112
138
|
bindEvents(el: any, _scope: any, hasEventListener: boolean): void;
|
|
139
|
+
mousedown(ev: MouseEvent): Promise<void>;
|
|
140
|
+
mouseup(ev: MouseEvent): Promise<void>;
|
|
141
|
+
mousemove(ev: MouseEvent): Promise<void>;
|
|
113
142
|
unbindEvents(el: any, _scope: any): void;
|
|
114
143
|
/**
|
|
115
144
|
* Permanently disables highlighting.
|
|
@@ -118,10 +147,10 @@ export default class TextHighlighter {
|
|
|
118
147
|
*/
|
|
119
148
|
destroy(): void;
|
|
120
149
|
initializeToolbox(): void;
|
|
121
|
-
toolboxMode(mode: "colors" | "edit" | "add"): void;
|
|
150
|
+
toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
|
|
122
151
|
toolboxHide(): void;
|
|
123
|
-
toolboxShowDelayed(): void;
|
|
124
|
-
snapSelectionToWord(): any;
|
|
152
|
+
toolboxShowDelayed(ev: any): void;
|
|
153
|
+
snapSelectionToWord(trimmed?: boolean): any;
|
|
125
154
|
toolboxShow(): void;
|
|
126
155
|
isSelectionMenuOpen: boolean;
|
|
127
156
|
selectionMenuOpened: (() => void) & {
|
|
@@ -130,6 +159,9 @@ export default class TextHighlighter {
|
|
|
130
159
|
selectionMenuClosed: (() => void) & {
|
|
131
160
|
clear(): void;
|
|
132
161
|
};
|
|
162
|
+
selection: ((text: any, selection: any) => void) & {
|
|
163
|
+
clear(): void;
|
|
164
|
+
};
|
|
133
165
|
toolboxPlacement(): void;
|
|
134
166
|
toolboxHandler(): void;
|
|
135
167
|
/**
|
|
@@ -141,8 +173,10 @@ export default class TextHighlighter {
|
|
|
141
173
|
doHighlight(keepRange?: boolean, marker?: AnnotationMarker): void;
|
|
142
174
|
speak(): void;
|
|
143
175
|
stopReadAloud(): void;
|
|
144
|
-
speakAll(): void;
|
|
145
176
|
callbackComplete(): void;
|
|
177
|
+
isOutsideViewport(rect: any): boolean;
|
|
178
|
+
isInsideViewport(rect: any): boolean;
|
|
179
|
+
get visibleTextRects(): HTMLElementRect[];
|
|
146
180
|
doneSpeaking(reload?: boolean): void;
|
|
147
181
|
/**
|
|
148
182
|
* Normalizes highlights. Ensures that highlighting is done with use of the smallest possible number of
|
|
@@ -180,20 +214,6 @@ export default class TextHighlighter {
|
|
|
180
214
|
* @memberof TextHighlighter
|
|
181
215
|
*/
|
|
182
216
|
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
217
|
/**
|
|
198
218
|
* Returns true if element is a highlight.
|
|
199
219
|
* All highlights have 'data-highlighted' attribute.
|
|
@@ -202,20 +222,6 @@ export default class TextHighlighter {
|
|
|
202
222
|
* @memberof TextHighlighter
|
|
203
223
|
*/
|
|
204
224
|
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
225
|
/**
|
|
220
226
|
* Creates wrapper for highlights.
|
|
221
227
|
* TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
|
|
@@ -234,25 +240,23 @@ export default class TextHighlighter {
|
|
|
234
240
|
};
|
|
235
241
|
static hexToRgbA(hex: string): string;
|
|
236
242
|
static hexToRgbAWithOpacity(hex: string, opacity: number): string;
|
|
237
|
-
resetHighlightBoundingStyle(
|
|
238
|
-
resetHighlightAreaStyle(
|
|
239
|
-
setHighlightAreaStyle(
|
|
243
|
+
resetHighlightBoundingStyle(highlightBounding: HTMLElement): void;
|
|
244
|
+
resetHighlightAreaStyle(highlightArea: HTMLElement, id_container: string): void;
|
|
245
|
+
setHighlightAreaStyle(doc: any, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
|
|
240
246
|
setAndResetSearchHighlight(highlight: any, highlights: any): void;
|
|
241
247
|
isIOS(): boolean;
|
|
242
248
|
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;
|
|
249
|
+
getScrollingElement: (doc: Document | undefined) => Element;
|
|
250
|
+
processMouseEvent(ev: MouseEvent): Promise<void>;
|
|
251
|
+
prepareContainers(win: any): Promise<void>;
|
|
252
|
+
ensureHighlightsContainer(win: any, id: string): Promise<HTMLElement>;
|
|
253
|
+
hideAllhighlights(doc: Document): void;
|
|
254
|
+
destroyAllhighlights(doc: Document): void;
|
|
255
|
+
removeAllChildNodes(parent: any): void;
|
|
256
|
+
destroyHighlights(type: HighlightType): void;
|
|
257
|
+
destroyHighlight(doc: Document | null, id: string): void;
|
|
258
|
+
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?];
|
|
259
|
+
createHighlightDom(win: any, highlight: IHighlight): HTMLDivElement | undefined;
|
|
260
|
+
addSelectionMenuItem(citationIconMenu: SelectionMenuItem): void;
|
|
257
261
|
}
|
|
258
262
|
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
}
|
|
45
|
+
export interface IHighlight {
|
|
46
|
+
id: string;
|
|
47
|
+
selectionInfo: ISelectionInfo;
|
|
48
|
+
pointerInteraction: boolean;
|
|
49
|
+
marker: AnnotationMarker;
|
|
50
|
+
icon?: IMarkerIcon | undefined;
|
|
51
|
+
popup?: IPopupStyle | undefined;
|
|
52
|
+
color: string;
|
|
53
|
+
style?: IStyle | undefined;
|
|
54
|
+
position?: number;
|
|
55
|
+
note?: string | null | undefined;
|
|
56
|
+
definition?: Definition | undefined;
|
|
57
|
+
type: HighlightType;
|
|
58
|
+
}
|
|
59
|
+
export interface SelectionMenuItem {
|
|
60
|
+
id: string;
|
|
61
|
+
callback?: any;
|
|
62
|
+
marker?: AnnotationMarker;
|
|
63
|
+
icon?: IMarkerIcon;
|
|
64
|
+
popup?: IPopupStyle;
|
|
65
|
+
highlight?: IHighlightStyle;
|
|
66
|
+
note?: boolean;
|
|
67
|
+
}
|
|
68
|
+
export interface IHighlightDefinition {
|
|
69
|
+
selectionInfo: ISelectionInfo | undefined;
|
|
70
|
+
color: string | undefined;
|
|
71
|
+
}
|
|
@@ -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
|
+
}
|