@d-i-t-a/reader 2.2.0-beta.2 → 2.2.0-beta.3

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.
@@ -19,6 +19,10 @@ export interface CitationModuleProperties {
19
19
  appLink?: string;
20
20
  library?: string;
21
21
  styles?: string[];
22
+ title?: string;
23
+ author?: string;
24
+ publisher?: string;
25
+ published?: string;
22
26
  }
23
27
  export interface CitationModuleAPI {
24
28
  citationCreated: any;
@@ -37,12 +37,13 @@ interface ContentProtectionRect {
37
37
  export declare class ContentProtectionModule implements ReaderModule {
38
38
  private rects;
39
39
  private delegate;
40
- private properties?;
40
+ properties?: ContentProtectionModuleProperties;
41
41
  private hasEventListener;
42
42
  private isHacked;
43
43
  private securityContainer;
44
44
  private mutationObserver;
45
45
  private wrapper;
46
+ citation: boolean;
46
47
  static setupPreloadProtection(config: Partial<ContentProtectionModuleConfig>): Promise<void>;
47
48
  static create(config: ContentProtectionModuleConfig): Promise<ContentProtectionModule>;
48
49
  constructor(delegate: IFrameNavigator, properties?: ContentProtectionModuleProperties);
@@ -92,7 +93,7 @@ export declare class ContentProtectionModule implements ReaderModule {
92
93
  };
93
94
  preventDefault: () => void;
94
95
  stopPropagation: () => void;
95
- }): boolean;
96
+ }): false | undefined;
96
97
  restrictCopyKey(event: any): boolean;
97
98
  copyToClipboard(textToClipboard: any): void;
98
99
  createElementForExecCommand(textToClipboard: any): HTMLDivElement;
@@ -1,9 +1,9 @@
1
1
  import { Publication } from "../../model/Publication";
2
2
  import { IFrameNavigator } from "../../navigator/IFrameNavigator";
3
3
  import { ReaderModule } from "../ReaderModule";
4
+ import { TextHighlighter } from "../highlight/TextHighlighter";
4
5
  import { IHighlight } from "../highlight/common/highlight";
5
6
  import { ISelectionInfo } from "../highlight/common/selection";
6
- import { TextHighlighter } from "../highlight/TextHighlighter";
7
7
  export interface SearchModuleAPI {
8
8
  }
9
9
  export interface SearchModuleProperties {
@@ -3,12 +3,14 @@ import Navigator from "./Navigator";
3
3
  import { UserSettings } from "../model/user-settings/UserSettings";
4
4
  import { Publication } from "../model/Publication";
5
5
  import { Locator } from "../model/Locator";
6
+ import { NavigatorAPI } from "./IFrameNavigator";
6
7
  export interface PDFNavigatorConfig {
7
8
  mainElement: HTMLElement;
8
9
  headerMenu?: HTMLElement | null;
9
10
  footerMenu?: HTMLElement | null;
10
11
  publication: Publication;
11
12
  settings: UserSettings;
13
+ api?: Partial<NavigatorAPI>;
12
14
  }
13
15
  export declare enum ScaleType {
14
16
  Page = 0,
@@ -20,24 +22,26 @@ export declare class PDFNavigator extends EventEmitter implements Navigator {
20
22
  headerMenu?: HTMLElement | null;
21
23
  footerMenu?: HTMLElement | null;
22
24
  mainElement: HTMLElement;
25
+ pdfContainer: HTMLElement;
26
+ wrapper: HTMLElement;
27
+ api?: Partial<NavigatorAPI>;
23
28
  pdfDoc: any;
24
29
  pageNum: number;
25
30
  scaleType: ScaleType;
26
31
  pageRendering: boolean;
27
32
  pageNumPending: any;
28
33
  scale: number;
29
- canvas: HTMLCanvasElement | null;
30
- ctx: CanvasRenderingContext2D | null;
31
34
  resourceIndex: number;
32
35
  resource: any;
36
+ private handTool;
33
37
  static create(config: PDFNavigatorConfig): Promise<PDFNavigator>;
34
- protected constructor(settings: UserSettings, publication: Publication);
38
+ protected constructor(settings: UserSettings, publication: Publication, api?: Partial<NavigatorAPI>);
35
39
  protected start(mainElement: HTMLElement, headerMenu?: HTMLElement | null, footerMenu?: HTMLElement | null): Promise<void>;
36
40
  timeout: any;
37
41
  onResize: () => void;
38
42
  handleResize(): Promise<void>;
39
43
  private setupEvents;
40
- renderPage(num: any, type: any): void;
44
+ loadPDFJS(num: any): void;
41
45
  queueRenderPage(num: any): void;
42
46
  readingOrder(): any;
43
47
  tableOfContents(): any;
@@ -56,5 +60,8 @@ export declare class PDFNavigator extends EventEmitter implements Navigator {
56
60
  fitToPage(): void;
57
61
  zoomIn(): void;
58
62
  zoomOut(): void;
63
+ activateHand(): void;
64
+ deactivateHand(): void;
65
+ scroll(scroll: boolean, direction?: string): Promise<void>;
59
66
  stop(): void;
60
67
  }
@@ -136,7 +136,7 @@ export default class D2Reader {
136
136
  };
137
137
  resetUserSettings: () => Promise<void>;
138
138
  applyUserSettings: (userSettings: Partial<UserSettings>) => Promise<void>;
139
- scroll: (value: boolean) => Promise<void>;
139
+ scroll: (value: boolean, direction?: string | undefined) => Promise<void>;
140
140
  private isTTSIncrementable;
141
141
  private isMOIncrementable;
142
142
  /**
@@ -180,6 +180,8 @@ export default class D2Reader {
180
180
  fitToWidth: () => void;
181
181
  zoomIn: () => void;
182
182
  zoomOut: () => void;
183
+ activateHand: () => void;
184
+ deactivateHand: () => void;
183
185
  copyToClipboard: (text: any) => void;
184
186
  nextResource: () => void;
185
187
  previousResource: () => void;
@@ -0,0 +1,42 @@
1
+ declare class GrabToPan {
2
+ #private;
3
+ private element;
4
+ private document;
5
+ private readonly onActiveChanged;
6
+ private active;
7
+ private scrollLeftStart;
8
+ private scrollTopStart;
9
+ private clientXStart;
10
+ private clientYStart;
11
+ private readonly overlay;
12
+ private readonly _endPan;
13
+ private readonly _onMouseDown;
14
+ private readonly _onMouseMove;
15
+ /**
16
+ * Construct a GrabToPan instance for a given HTML element.
17
+ * @param {Element} options.element
18
+ * @param {function} [options.ignoreTarget] - See `ignoreTarget(node)`.
19
+ * @param {function(boolean)} [options.onActiveChanged] - Called when
20
+ * grab-to-pan is (de)activated. The first argument is a boolean that
21
+ * shows whether grab-to-pan is activated.
22
+ */
23
+ constructor(options: any);
24
+ /**
25
+ * Bind a mousedown event to the element to enable grab-detection.
26
+ */
27
+ activate(): void;
28
+ /**
29
+ * Removes all events. Any pending pan session is immediately stopped.
30
+ */
31
+ deactivate(): void;
32
+ toggle(): void;
33
+ /**
34
+ * Whether to not pan if the target element is clicked.
35
+ * Override this method to change the default behaviour.
36
+ *
37
+ * @param {Element} node - The target of the event.
38
+ * @returns {boolean} Whether to not react to the click event.
39
+ */
40
+ ignoreTarget(node: any): any;
41
+ }
42
+ export { GrabToPan };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-i-t-a/reader",
3
- "version": "2.2.0-beta.2",
3
+ "version": "2.2.0-beta.3",
4
4
  "description": "A viewer application for EPUB files.",
5
5
  "repository": "https://github.com/d-i-t-a/R2D2BC",
6
6
  "license": "Apache-2.0",
@@ -29,7 +29,7 @@
29
29
  "browserslist-useragent": "^3.0.3",
30
30
  "cssesc": "^3.0.0",
31
31
  "detect-browser": "^5.2.0",
32
- "devtools-detector": "^2.0.10",
32
+ "devtools-detector": "^2.0.14",
33
33
  "eventemitter3": "^4.0.7",
34
34
  "jscrypto": "^1.0.3",
35
35
  "lodash.clonedeep": "^4.5.0",