@d-i-t-a/reader 1.11.0-beta.2 → 1.11.0-beta.6

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