@d-i-t-a/reader 2.0.0-alpha.2 → 2.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +10 -0
  2. package/dist/esm/index.js +60633 -0
  3. package/dist/esm/index.js.map +7 -0
  4. package/dist/injectables/click/click.js +1774 -2
  5. package/dist/injectables/click/click.js.map +7 -1
  6. package/dist/injectables/style/linefocus.css +55 -0
  7. package/dist/injectables/style/popup.css +121 -0
  8. package/dist/injectables/style/style.css +250 -0
  9. package/dist/{material.css.map → material.map.css} +0 -0
  10. package/dist/reader.css +2 -5
  11. package/dist/reader.js +161 -3
  12. package/dist/reader.js.map +7 -1
  13. package/dist/reader.map.css +21 -0
  14. package/dist/types/index.d.ts +7 -0
  15. package/dist/{model → types/model}/Link.d.ts +1 -1
  16. package/dist/{model → types/model}/Locator.d.ts +3 -18
  17. package/dist/{model → types/model}/Publication.d.ts +17 -13
  18. package/dist/{model → types/model}/user-settings/ReadiumCSS.d.ts +0 -0
  19. package/dist/{model → types/model}/user-settings/UserProperties.d.ts +3 -2
  20. package/dist/{model → types/model}/user-settings/UserSettings.d.ts +6 -6
  21. package/dist/{modules → types/modules}/AnnotationModule.d.ts +30 -18
  22. package/dist/types/modules/BookmarkModule.d.ts +57 -0
  23. package/dist/types/modules/ReaderModule.d.ts +2 -0
  24. package/dist/types/modules/TTS/TTSModule.d.ts +33 -0
  25. package/dist/types/modules/TTS/TTSModule2.d.ts +73 -0
  26. package/dist/{modules → types/modules}/TTS/TTSSettings.d.ts +41 -17
  27. package/dist/{modules → types/modules}/highlight/HtmlElementSelector.d.ts +0 -0
  28. package/dist/types/modules/highlight/LayerSettings.d.ts +19 -0
  29. package/dist/{modules → types/modules}/highlight/TextHighlighter.d.ts +57 -57
  30. package/dist/{modules → types/modules}/highlight/common/document.d.ts +0 -0
  31. package/dist/{modules → types/modules}/highlight/common/events.d.ts +0 -0
  32. package/dist/types/modules/highlight/common/highlight.d.ts +71 -0
  33. package/dist/{modules → types/modules}/highlight/common/rect-utils.d.ts +1 -1
  34. package/dist/{modules → types/modules}/highlight/common/selection.d.ts +8 -3
  35. package/dist/{modules → types/modules}/highlight/renderer/common/cssselector.d.ts +0 -0
  36. package/dist/{modules → types/modules}/highlight/renderer/common/cssselector2.d.ts +0 -0
  37. package/dist/{modules → types/modules}/highlight/renderer/iframe/selection.d.ts +2 -2
  38. package/dist/{modules → types/modules}/highlight/renderer/iframe/state.d.ts +0 -3
  39. package/dist/types/modules/linefocus/LineFocusModule.d.ts +45 -0
  40. package/dist/{modules → types/modules}/mediaoverlays/MediaOverlayModule.d.ts +19 -14
  41. package/dist/{modules → types/modules}/mediaoverlays/MediaOverlaySettings.d.ts +20 -16
  42. package/dist/types/modules/pagebreak/PageBreakModule.d.ts +30 -0
  43. package/dist/{modules → types/modules}/positions/TimelineModule.d.ts +4 -4
  44. package/dist/{modules → types/modules}/protection/ContentProtectionModule.d.ts +11 -7
  45. package/dist/types/modules/sampleread/SampleReadEventHandler.d.ts +8 -0
  46. package/dist/types/modules/search/DefinitionsModule.d.ts +52 -0
  47. package/dist/types/modules/search/Popup.d.ts +8 -0
  48. package/dist/{modules → types/modules}/search/SearchModule.d.ts +17 -13
  49. package/dist/{modules → types/modules}/search/searchWithDomSeek.d.ts +1 -1
  50. package/dist/{navigator → types/navigator}/IFrameNavigator.d.ts +88 -57
  51. package/dist/{navigator → types/navigator}/Navigator.d.ts +0 -0
  52. package/dist/types/reader.d.ts +200 -0
  53. package/dist/types/store/Annotator.d.ts +25 -0
  54. package/dist/types/store/LocalAnnotator.d.ts +31 -0
  55. package/dist/{store → types/store}/LocalStorageStore.d.ts +3 -3
  56. package/dist/{store → types/store}/MemoryStore.d.ts +3 -3
  57. package/dist/types/store/Store.d.ts +6 -0
  58. package/dist/{utils → types/utils}/BrowserUtilities.d.ts +0 -7
  59. package/dist/{utils → types/utils}/EventHandler.d.ts +12 -0
  60. package/dist/{utils → types/utils}/HTMLTemplates.d.ts +0 -0
  61. package/dist/{utils → types/utils}/HTMLUtilities.d.ts +3 -3
  62. package/dist/{utils → types/utils}/IconLib.d.ts +1 -0
  63. package/dist/{utils → types/utils}/JsonUtil.d.ts +0 -0
  64. package/dist/types/utils/KeyboardEventHandler.d.ts +9 -0
  65. package/dist/{utils → types/utils}/TouchEventHandler.d.ts +1 -1
  66. package/dist/types/utils/index.d.ts +6 -0
  67. package/dist/{views → types/views}/BookView.d.ts +9 -7
  68. package/dist/{views → types/views}/FixedBookView.d.ts +7 -4
  69. package/dist/{views → types/views}/ReflowableBookView.d.ts +6 -4
  70. package/package.json +35 -19
  71. package/CHANGELOG.md +0 -6
  72. package/NOTICE +0 -20
  73. package/dist/index.d.ts +0 -140
  74. package/dist/injectables/click/click.d.ts +0 -1
  75. package/dist/injectables/footnotes/footnotes.d.ts +0 -1
  76. package/dist/injectables/footnotes/footnotes.js +0 -2
  77. package/dist/injectables/footnotes/footnotes.js.map +0 -1
  78. package/dist/injectables/glossary/glossary.d.ts +0 -5
  79. package/dist/injectables/glossary/glossary.js +0 -3
  80. package/dist/injectables/glossary/glossary.js.LICENSE.txt +0 -6
  81. package/dist/injectables/glossary/glossary.js.map +0 -1
  82. package/dist/modules/BookmarkModule.d.ts +0 -46
  83. package/dist/modules/ReaderModule.d.ts +0 -3
  84. package/dist/modules/TTS/TTSModule.d.ts +0 -58
  85. package/dist/modules/highlight/common/highlight.d.ts +0 -19
  86. package/dist/modules/highlight/common/styles.d.ts +0 -35
  87. package/dist/reader.css.map +0 -21
  88. package/dist/reader.js.LICENSE.txt +0 -68
  89. package/dist/store/Annotator.d.ts +0 -25
  90. package/dist/store/LocalAnnotator.d.ts +0 -31
  91. package/dist/store/Store.d.ts +0 -6
  92. package/dist/utils/KeyboardEventHandler.d.ts +0 -7
  93. package/dist/utils/index.d.ts +0 -1
@@ -1,16 +1,31 @@
1
- import { IColor, IHighlight } from "./common/highlight";
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 IFrameNavigator, { SelectionMenuItem } from "../../navigator/IFrameNavigator";
7
- export declare const ID_HIGHLIGHTS_CONTAINER = "R2_ID_HIGHLIGHTS_CONTAINER";
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
46
  selectionMenuItems?: Array<SelectionMenuItem>;
24
47
  }
25
48
  export interface TextHighlighterConfig extends TextHighlighterProperties {
26
- delegate?: IFrameNavigator;
49
+ delegate: IFrameNavigator;
27
50
  api?: TextSelectorAPI;
51
+ layerSettings: LayerSettings;
28
52
  }
29
- export default class TextHighlighter {
53
+ export declare class TextHighlighter {
30
54
  private options;
31
- private delegate;
32
- private lastSelectedHighlight;
33
- private properties;
34
- private api;
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>;
@@ -118,7 +144,7 @@ export default class TextHighlighter {
118
144
  */
119
145
  destroy(): void;
120
146
  initializeToolbox(): void;
121
- toolboxMode(mode: "colors" | "edit" | "add"): void;
147
+ toolboxMode(mode: "colors" | "edit" | "add" | "action"): void;
122
148
  toolboxHide(): void;
123
149
  toolboxShowDelayed(): void;
124
150
  snapSelectionToWord(): any;
@@ -130,6 +156,9 @@ export default class TextHighlighter {
130
156
  selectionMenuClosed: (() => void) & {
131
157
  clear(): void;
132
158
  };
159
+ selection: ((text: any, selection: any) => void) & {
160
+ clear(): void;
161
+ };
133
162
  toolboxPlacement(): void;
134
163
  toolboxHandler(): void;
135
164
  /**
@@ -143,6 +172,8 @@ export default class TextHighlighter {
143
172
  stopReadAloud(): void;
144
173
  speakAll(): void;
145
174
  callbackComplete(): void;
175
+ isOutsideViewport(rect: any): boolean;
176
+ get visibleTextRects(): HTMLElementRect[];
146
177
  doneSpeaking(reload?: boolean): void;
147
178
  /**
148
179
  * Normalizes highlights. Ensures that highlighting is done with use of the smallest possible number of
@@ -180,20 +211,6 @@ export default class TextHighlighter {
180
211
  * @memberof TextHighlighter
181
212
  */
182
213
  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
214
  /**
198
215
  * Returns true if element is a highlight.
199
216
  * All highlights have 'data-highlighted' attribute.
@@ -202,20 +219,6 @@ export default class TextHighlighter {
202
219
  * @memberof TextHighlighter
203
220
  */
204
221
  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
222
  /**
220
223
  * Creates wrapper for highlights.
221
224
  * TextHighlighter instance calls this method each time it needs to create highlights and pass options retrieved
@@ -234,25 +237,22 @@ export default class TextHighlighter {
234
237
  };
235
238
  static hexToRgbA(hex: string): string;
236
239
  static hexToRgbAWithOpacity(hex: string, opacity: number): string;
237
- resetHighlightBoundingStyle(_win: IReadiumIFrameWindow, highlightBounding: HTMLElement): void;
238
- resetHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightArea: HTMLElement): void;
239
- setHighlightAreaStyle(_win: IReadiumIFrameWindow, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
240
+ resetHighlightBoundingStyle(_win: any, highlightBounding: HTMLElement): void;
241
+ resetHighlightAreaStyle(win: any, highlightArea: HTMLElement, id_container: string): void;
242
+ setHighlightAreaStyle(win: any, highlightAreas: Array<HTMLElement>, highlight: IHighlight): void;
240
243
  setAndResetSearchHighlight(highlight: any, highlights: any): void;
241
244
  isIOS(): boolean;
242
245
  isAndroid(): boolean;
243
- getScrollingElement: (documant: Document) => Element;
244
- processMouseEvent(win: IReadiumIFrameWindow, ev: MouseEvent): Promise<void>;
245
- ensureHighlightsContainer(win: IReadiumIFrameWindow): HTMLElement;
246
- hideAllhighlights(_documant: Document): void;
247
- destroyAllhighlights(documant: Document): void;
248
- destroyHighlight(documant: Document, id: string): void;
249
- recreateAllHighlightsRaw(win: IReadiumIFrameWindow): void;
250
- recreateAllHighlightsDebounced: ((win: IReadiumIFrameWindow) => void) & {
251
- clear(): void;
252
- };
253
- recreateAllHighlights(win: IReadiumIFrameWindow): void;
254
- createSearchHighlight(selectionInfo: ISelectionInfo, color: string): IHighlight;
255
- createHighlight(win: IReadiumIFrameWindow, selectionInfo: ISelectionInfo, color: IColor | undefined, pointerInteraction: boolean, marker: AnnotationMarker): IHighlight;
256
- createHighlightDom(win: IReadiumIFrameWindow, highlight: IHighlight): HTMLDivElement | undefined;
246
+ getScrollingElement: (doc: Document | undefined) => Element;
247
+ processMouseEvent(win: any, ev: MouseEvent): Promise<void>;
248
+ prepareContainers(win: any): Promise<void>;
249
+ ensureHighlightsContainer(win: any, id: string): Promise<HTMLElement>;
250
+ hideAllhighlights(doc: Document): void;
251
+ destroyAllhighlights(doc: Document): void;
252
+ removeAllChildNodes(parent: any): void;
253
+ destroyHighlights(type: HighlightType): void;
254
+ destroyHighlight(doc: Document | null, id: string): void;
255
+ 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?];
256
+ createHighlightDom(win: any, highlight: IHighlight): HTMLDivElement | undefined;
257
257
  }
258
258
  export {};
@@ -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
+ }
@@ -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 replaceOverlapingRects(rects: IRect[]): IRect[];
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: string;
13
- rawText: string;
14
- range: 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
+ };
@@ -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,45 @@
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
+ }
11
+ export interface LineFocusModuleConfig extends LineFocusModuleProperties {
12
+ api?: LineFocusModuleAPI;
13
+ publication: Publication;
14
+ delegate: IFrameNavigator;
15
+ highlighter: TextHighlighter;
16
+ }
17
+ export default class LineFocusModule implements ReaderModule {
18
+ properties: LineFocusModuleProperties;
19
+ api?: LineFocusModuleAPI;
20
+ private delegate;
21
+ private highlighter;
22
+ lines: Array<HTMLElement>;
23
+ index: number;
24
+ isActive: boolean;
25
+ isDebug: boolean;
26
+ lineFocusContainer: HTMLElement | null;
27
+ lineFocusTopBlinder: HTMLElement | null;
28
+ lineFocusBottomBlinder: HTMLElement | null;
29
+ static create(config: LineFocusModuleConfig): Promise<LineFocusModule>;
30
+ private constructor();
31
+ stop(): Promise<void>;
32
+ protected start(): Promise<void>;
33
+ handleResize(): void;
34
+ enableLineFocus(): Promise<void>;
35
+ wrapperHeight: string | undefined;
36
+ disableLineFocus(resetHeight?: boolean): void;
37
+ lineFocus(): void;
38
+ currentLine(): void;
39
+ lineDown(): void;
40
+ lineUp(): void;
41
+ almostEqual(a: number, b: number, tolerance: number): boolean;
42
+ findRects(parent: HTMLElement): any;
43
+ findTextNodes(parentElement: Element, nodes?: Array<Element>): Array<Element>;
44
+ measureTextNodes(node: Element): any;
45
+ }
@@ -1,6 +1,6 @@
1
- import Publication from "../../model/Publication";
2
- import IFrameNavigator from "../../navigator/IFrameNavigator";
3
- import ReaderModule from "../ReaderModule";
1
+ import { Publication } from "../../model/Publication";
2
+ import { IFrameNavigator } from "../../navigator/IFrameNavigator";
3
+ import { ReaderModule } from "../ReaderModule";
4
4
  import { Link } from "../../model/Link";
5
5
  import { MediaOverlayNode } from "r2-shared-js/dist/es6-es2015/src/models/media-overlay";
6
6
  import { MediaOverlaySettings } from "./MediaOverlaySettings";
@@ -17,46 +17,49 @@ export interface MediaOverlayModuleProperties {
17
17
  autoScroll?: boolean;
18
18
  autoTurn?: boolean;
19
19
  volume?: number;
20
+ rate?: number;
20
21
  wait?: number;
22
+ hideLayer?: boolean;
21
23
  }
22
24
  export interface MediaOverlayModuleConfig extends MediaOverlayModuleProperties {
23
25
  publication: Publication;
24
26
  delegate: IFrameNavigator;
25
- api: MediaOverlayModuleAPI;
26
27
  settings: MediaOverlaySettings;
28
+ api?: MediaOverlayModuleAPI;
27
29
  }
28
- export default class MediaOverlayModule implements ReaderModule {
30
+ export declare class MediaOverlayModule implements ReaderModule {
29
31
  private publication;
30
32
  private delegate;
31
33
  private audioElement;
32
34
  private settings;
35
+ private properties;
33
36
  private play;
34
37
  private pause;
35
38
  private currentAudioBegin;
36
39
  private currentAudioEnd;
37
40
  private currentLinks;
38
41
  private currentLinkIndex;
39
- private mediaOverlaysPlaybackRate;
40
42
  private currentAudioUrl;
41
43
  private previousAudioUrl;
42
44
  private previousAudioEnd;
43
45
  private mediaOverlayRoot;
44
46
  private mediaOverlayTextAudioPair;
45
47
  private pid;
46
- static create(config: MediaOverlayModuleConfig): Promise<MediaOverlayModule>;
48
+ private __ontimeupdate;
49
+ static create(config: MediaOverlayModuleConfig): MediaOverlayModule;
47
50
  private constructor();
48
- stop(): Promise<void>;
49
- protected start(): Promise<void>;
51
+ stop(): void;
52
+ protected start(): void;
50
53
  initialize(): Promise<void>;
51
- initializeResource(links: Array<Link>): Promise<void>;
54
+ initializeResource(links: Array<Link | undefined>): Promise<void>;
52
55
  private playLink;
53
56
  startReadAloud(): Promise<void>;
54
- stopReadAloud(): void;
57
+ stopReadAloud(): Promise<void>;
55
58
  pauseReadAloud(): void;
56
59
  resumeReadAloud(): Promise<void>;
57
60
  findDepthFirstTextAudioPair(textHref: string, mo: MediaOverlayNode, textFragmentIDChain: Array<string | null> | undefined): MediaOverlayNode | undefined | null;
58
- ontimeupdate: (ev: Event) => Promise<void>;
59
- ensureOnTimeUpdate: (remove: boolean) => void;
61
+ myReq: any;
62
+ trackCurrentTime(): void;
60
63
  mediaOverlaysNext(escape?: boolean): void;
61
64
  mediaOverlaysStop(): void;
62
65
  mediaOverlaysPause(): void;
@@ -65,5 +68,7 @@ export default class MediaOverlayModule implements ReaderModule {
65
68
  }, escape: boolean): MediaOverlayNode | undefined | null;
66
69
  playMediaOverlaysAudio(moTextAudioPair: MediaOverlayNode, begin: number | undefined, end: number | undefined): Promise<void>;
67
70
  playMediaOverlays(textHref: string, rootMo: MediaOverlayNode, textFragmentIDChain: Array<string | null> | undefined): Promise<void>;
68
- mediaOverlayHighlight(href: string | undefined, id: string | undefined): void;
71
+ ontimeupdate: (_v: Event) => Promise<void>;
72
+ ensureOnTimeUpdate: (remove: boolean) => void;
73
+ mediaOverlayHighlight(id: string | undefined): void;
69
74
  }
@@ -7,25 +7,29 @@ export declare class MEDIAOVERLAYREFS {
7
7
  static readonly AUTO_SCROLL_REF = "autoscroll";
8
8
  static readonly AUTO_TURN_REF = "autoturn";
9
9
  static readonly VOLUME_REF = "volume";
10
+ static readonly RATE_REF = "rate";
10
11
  static readonly COLOR_KEY: string;
11
12
  static readonly AUTO_SCROLL_KEY: string;
12
13
  static readonly AUTO_TURN_KEY: string;
13
14
  static readonly VOLUME_KEY: string;
15
+ static readonly RATE_KEY: string;
14
16
  }
15
17
  export interface MediaOverlayConfig {
16
18
  store: Store;
17
- initialMediaOverlaySettings: MediaOverlayModuleProperties;
18
- headerMenu: HTMLElement;
19
- api: MediaOverlayModuleAPI;
19
+ initialMediaOverlaySettings?: MediaOverlayModuleProperties;
20
+ headerMenu?: HTMLElement | null;
21
+ api?: MediaOverlayModuleAPI;
20
22
  }
21
23
  export interface IMediaOverlayUserSettings {
22
24
  color?: string;
23
25
  autoScroll?: boolean;
24
26
  autoTurn?: boolean;
25
27
  volume?: number;
28
+ rate?: number;
26
29
  playing?: boolean;
27
30
  wait?: number;
28
31
  }
32
+ export declare type MediaOverlayIncrementable = "mo_volume" | "mo_rate";
29
33
  export declare class MediaOverlaySettings implements IMediaOverlayUserSettings {
30
34
  private readonly store;
31
35
  private readonly MEDIAOVERLAYSETTINGS;
@@ -33,35 +37,35 @@ export declare class MediaOverlaySettings implements IMediaOverlayUserSettings {
33
37
  autoScroll: boolean;
34
38
  autoTurn: boolean;
35
39
  volume: number;
40
+ rate: number;
36
41
  playing: boolean;
37
42
  wait: number;
38
43
  userProperties: UserProperties;
39
44
  private settingsChangeCallback;
40
45
  private settingsView;
41
- private readonly headerMenu;
42
- private volumeButtons;
46
+ private readonly headerMenu?;
43
47
  private speechAutoScroll;
44
48
  private speechAutoTurn;
45
49
  private speechVolume;
46
- private readonly api;
47
- static create(config: MediaOverlayConfig): Promise<any>;
48
- protected constructor(store: Store, headerMenu: HTMLElement, api: MediaOverlayModuleAPI);
49
- stop(): Promise<void>;
50
+ private speechRate;
51
+ private readonly api?;
52
+ static create(config: MediaOverlayConfig): any;
53
+ protected constructor(store: Store, api?: MediaOverlayModuleAPI, headerMenu?: HTMLElement | null);
54
+ stop(): void;
50
55
  private initialise;
51
56
  private reset;
52
57
  private initializeSelections;
53
58
  setControls(): void;
54
59
  private renderControls;
55
60
  onSettingsChange(callback: () => void): void;
56
- private setupEvents;
57
61
  private storeProperty;
58
62
  private updateUserSettings;
59
63
  private getMediaOverlaySettings;
60
64
  private saveProperty;
61
- getProperty(name: string): Promise<UserProperty>;
62
- resetMediaOverlaySettings(): Promise<void>;
63
- applyMediaOverlaySettings(mediaOverlaySettings: IMediaOverlayUserSettings): Promise<void>;
64
- applyMediaOverlaySetting(key: any, value: any): Promise<void>;
65
- increase(incremental: string): Promise<void>;
66
- decrease(incremental: string): Promise<void>;
65
+ getProperty(name: string): UserProperty | null;
66
+ resetMediaOverlaySettings(): void;
67
+ applyMediaOverlaySettings(mediaOverlaySettings: IMediaOverlayUserSettings): void;
68
+ applyMediaOverlaySetting(key: any, value: any): void;
69
+ increase(incremental: MediaOverlayIncrementable): void;
70
+ decrease(incremental: MediaOverlayIncrementable): void;
67
71
  }
@@ -0,0 +1,30 @@
1
+ import { IFrameNavigator } from "../../navigator/IFrameNavigator";
2
+ import { ReaderModule } from "../ReaderModule";
3
+ import { IHighlight } from "../highlight/common/highlight";
4
+ import { ISelectionInfo } from "../highlight/common/selection";
5
+ import { Publication } from "../../model/Publication";
6
+ export interface PageBreakModuleProperties {
7
+ hideLayer?: boolean;
8
+ }
9
+ export interface PageBreakModuleConfig extends PageBreakModuleProperties {
10
+ delegate: IFrameNavigator;
11
+ headerMenu?: HTMLElement | null;
12
+ publication: Publication;
13
+ }
14
+ export declare class PageBreakModule implements ReaderModule {
15
+ private delegate;
16
+ private readonly headerMenu?;
17
+ private publication;
18
+ private properties;
19
+ private goToPageView;
20
+ private goToPageNumberInput;
21
+ private goToPageNumberButton;
22
+ static create(config: PageBreakModuleConfig): Promise<PageBreakModule>;
23
+ private constructor();
24
+ stop(): Promise<void>;
25
+ protected start(): Promise<void>;
26
+ private goToPageNumber;
27
+ handleResize(): Promise<void>;
28
+ drawPageBreaks(): Promise<void>;
29
+ createPageBreakHighlight(selectionInfo: ISelectionInfo, title: string): IHighlight;
30
+ }
@@ -1,11 +1,11 @@
1
- import Publication from "../../model/Publication";
2
- import IFrameNavigator from "../../navigator/IFrameNavigator";
3
- import ReaderModule from "../ReaderModule";
1
+ import { Publication } from "../../model/Publication";
2
+ import { IFrameNavigator } from "../../navigator/IFrameNavigator";
3
+ import { ReaderModule } from "../ReaderModule";
4
4
  export interface TimelineModuleConfig {
5
5
  publication: Publication;
6
6
  delegate: IFrameNavigator;
7
7
  }
8
- export default class TimelineModule implements ReaderModule {
8
+ export declare class TimelineModule implements ReaderModule {
9
9
  private publication;
10
10
  private delegate;
11
11
  private timelineContainer;
@@ -1,5 +1,5 @@
1
- import ReaderModule from "../ReaderModule";
2
- import IFrameNavigator from "../../navigator/IFrameNavigator";
1
+ import { ReaderModule } from "../ReaderModule";
2
+ import { IFrameNavigator } from "../../navigator/IFrameNavigator";
3
3
  export interface ContentProtectionModuleProperties {
4
4
  enforceSupportedBrowsers: boolean;
5
5
  enableEncryption: boolean;
@@ -8,6 +8,7 @@ export interface ContentProtectionModuleProperties {
8
8
  disableCopy: boolean;
9
9
  detectInspect: boolean;
10
10
  clearOnInspect: boolean;
11
+ detectInspectInitDelay: number;
11
12
  disableKeys: boolean;
12
13
  disableContextMenu: boolean;
13
14
  hideTargetUrl: boolean;
@@ -19,7 +20,7 @@ export interface ContentProtectionModuleConfig extends Partial<ContentProtection
19
20
  api?: ContentProtectionModuleAPI;
20
21
  }
21
22
  export interface ContentProtectionModuleAPI {
22
- inspectDetected: any;
23
+ inspectDetected: () => void;
23
24
  }
24
25
  interface ContentProtectionRect {
25
26
  node: Element;
@@ -31,17 +32,20 @@ interface ContentProtectionRect {
31
32
  scrambledTextContent: string;
32
33
  isObfuscated: boolean;
33
34
  }
34
- export default class ContentProtectionModule implements ReaderModule {
35
+ export declare class ContentProtectionModule implements ReaderModule {
35
36
  private rects;
36
37
  private delegate;
37
- private properties;
38
- private api;
38
+ private properties?;
39
39
  private hasEventListener;
40
40
  private isHacked;
41
41
  private securityContainer;
42
42
  private mutationObserver;
43
+ private wrapper;
44
+ static setupPreloadProtection(config: ContentProtectionModuleConfig): Promise<void>;
43
45
  static create(config: ContentProtectionModuleConfig): Promise<ContentProtectionModule>;
44
- constructor(delegate: IFrameNavigator, properties?: ContentProtectionModuleProperties | null, api?: ContentProtectionModuleAPI | null);
46
+ constructor(delegate: IFrameNavigator, properties?: ContentProtectionModuleProperties);
47
+ private static startInspectorProtection;
48
+ private static isCurrentBrowserSupported;
45
49
  protected start(): Promise<void>;
46
50
  stop(): Promise<void>;
47
51
  observe(): any;
@@ -0,0 +1,8 @@
1
+ import { IFrameNavigator } from "../../navigator/IFrameNavigator";
2
+ export default class SampleReadEventHandler {
3
+ delegate: IFrameNavigator;
4
+ constructor(delegate: IFrameNavigator);
5
+ enforceSampleRead: ((position: any) => void) & {
6
+ clear(): void;
7
+ };
8
+ }