@d-i-t-a/reader 2.0.0-beta.3 → 2.0.0-beta.7

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 (52) hide show
  1. package/dist/esm/index.js +8720 -5231
  2. package/dist/esm/index.js.map +3 -3
  3. package/dist/injectables/style/linefocus.css +55 -0
  4. package/dist/injectables/style/style.css +25 -1
  5. package/dist/reader.css +1 -1
  6. package/dist/reader.js +53 -53
  7. package/dist/reader.js.map +3 -3
  8. package/dist/reader.map.css +1 -1
  9. package/dist/types/index.d.ts +3 -1
  10. package/dist/types/model/Link.d.ts +1 -1
  11. package/dist/types/model/Publication.d.ts +12 -12
  12. package/dist/types/model/user-settings/UserProperties.d.ts +3 -2
  13. package/dist/types/model/user-settings/UserSettings.d.ts +6 -6
  14. package/dist/types/modules/AnnotationModule.d.ts +14 -13
  15. package/dist/types/modules/BookmarkModule.d.ts +14 -14
  16. package/dist/types/modules/ReaderModule.d.ts +1 -2
  17. package/dist/types/modules/TTS/TTSModule.d.ts +7 -7
  18. package/dist/types/modules/TTS/TTSModule2.d.ts +8 -8
  19. package/dist/types/modules/TTS/TTSSettings.d.ts +16 -16
  20. package/dist/types/modules/highlight/LayerSettings.d.ts +19 -0
  21. package/dist/types/modules/highlight/TextHighlighter.d.ts +42 -61
  22. package/dist/types/modules/highlight/common/highlight.d.ts +3 -2
  23. package/dist/types/modules/highlight/common/selection.d.ts +3 -3
  24. package/dist/types/modules/highlight/renderer/iframe/selection.d.ts +2 -2
  25. package/dist/types/modules/highlight/renderer/iframe/state.d.ts +0 -3
  26. package/dist/types/modules/linefocus/LineFocusModule.d.ts +45 -0
  27. package/dist/types/modules/mediaoverlays/MediaOverlayModule.d.ts +19 -14
  28. package/dist/types/modules/mediaoverlays/MediaOverlaySettings.d.ts +20 -17
  29. package/dist/types/modules/pagebreak/PageBreakModule.d.ts +14 -7
  30. package/dist/types/modules/positions/TimelineModule.d.ts +4 -4
  31. package/dist/types/modules/protection/ContentProtectionModule.d.ts +6 -6
  32. package/dist/types/modules/sampleread/SampleReadEventHandler.d.ts +1 -1
  33. package/dist/types/modules/search/DefinitionsModule.d.ts +22 -14
  34. package/dist/types/modules/search/Popup.d.ts +2 -2
  35. package/dist/types/modules/search/SearchModule.d.ts +16 -12
  36. package/dist/types/modules/search/searchWithDomSeek.d.ts +1 -1
  37. package/dist/types/navigator/IFrameNavigator.d.ts +55 -44
  38. package/dist/types/reader.d.ts +95 -57
  39. package/dist/types/store/Annotator.d.ts +16 -17
  40. package/dist/types/store/LocalAnnotator.d.ts +16 -17
  41. package/dist/types/store/LocalStorageStore.d.ts +3 -3
  42. package/dist/types/store/MemoryStore.d.ts +3 -3
  43. package/dist/types/store/Store.d.ts +3 -3
  44. package/dist/types/utils/EventHandler.d.ts +9 -2
  45. package/dist/types/utils/HTMLUtilities.d.ts +3 -3
  46. package/dist/types/utils/IconLib.d.ts +1 -1
  47. package/dist/types/utils/KeyboardEventHandler.d.ts +2 -2
  48. package/dist/types/utils/TouchEventHandler.d.ts +1 -1
  49. package/dist/types/views/BookView.d.ts +4 -4
  50. package/dist/types/views/FixedBookView.d.ts +3 -3
  51. package/dist/types/views/ReflowableBookView.d.ts +2 -2
  52. package/package.json +14 -7
@@ -1,15 +1,15 @@
1
1
  /** Returns a single element matching the selector within the parentElement,
2
2
  or null if no element matches. */
3
- export declare function findElement(parentElement: Element | Document, selector: string): HTMLElement | null;
3
+ export declare function findElement(parentElement: Element | Document, selector: string): any | null;
4
4
  /** Returns a single element matching the selector within the parent element,
5
5
  or throws an exception if no element matches. */
6
- export declare function findRequiredElement(parentElement: Element | Document, selector: string): HTMLElement;
6
+ export declare function findRequiredElement(parentElement: Element | Document, selector: string): any;
7
7
  /** Returns a single element matching the selector within the parentElement in the iframe context,
8
8
  or null if no element matches. */
9
9
  export declare function findIframeElement(parentElement: Document | null, selector: string): Element | null;
10
10
  /** Returns a single element matching the selector within the parent element in an iframe context,
11
11
  or throws an exception if no element matches. */
12
- export declare function findRequiredIframeElement(parentElement: Document | null, selector: string): Element;
12
+ export declare function findRequiredIframeElement(parentElement: Document, selector: string): Element;
13
13
  /** Sets an attribute and its value for an HTML element */
14
14
  export declare function setAttr(element: HTMLElement, attr: string, value: string): void;
15
15
  /** Removes an attribute for an HTML element */
@@ -1,7 +1,7 @@
1
1
  export declare const WIDTH_ATTR: number;
2
2
  export declare const HEIGHT_ATTR: number;
3
3
  export declare const VIEWBOX_ATTR: string;
4
- export declare const iconTemplateColored: (id: string, title: string, path: string, classAttr: string, size: number, fill: string) => string;
4
+ export declare const iconTemplateColored: (id: string, title: string, path: string, classAttr: string | undefined, size: number, fill: string) => string;
5
5
  export declare const icons: {
6
6
  error: string;
7
7
  home: string;
@@ -1,9 +1,9 @@
1
- import IFrameNavigator from "../navigator/IFrameNavigator";
1
+ import { IFrameNavigator } from "../navigator/IFrameNavigator";
2
2
  export default class KeyboardEventHandler {
3
3
  delegate: IFrameNavigator;
4
4
  onBackwardSwipe: (event: UIEvent) => void;
5
5
  onForwardSwipe: (event: UIEvent) => void;
6
- setupEvents: (element: HTMLElement | Document) => void;
6
+ setupEvents: (element: HTMLElement | Document | null) => void;
7
7
  focusin: (element: HTMLElement | Document) => void;
8
8
  keydown: (element: HTMLElement | Document) => void;
9
9
  }
@@ -4,5 +4,5 @@ export default class TouchEventHandler {
4
4
  private static readonly SLOW_SWIPE_MS;
5
5
  onBackwardSwipe: (event: UIEvent) => void;
6
6
  onForwardSwipe: (event: UIEvent) => void;
7
- setupEvents: (element: HTMLElement | Document) => void;
7
+ setupEvents: (element: HTMLElement | Document | null) => void;
8
8
  }
@@ -1,4 +1,4 @@
1
- import IFrameNavigator, { IFrameAttributes } from "../navigator/IFrameNavigator";
1
+ import { IFrameNavigator, IFrameAttributes } from "../navigator/IFrameNavigator";
2
2
  interface BookView {
3
3
  layout: string;
4
4
  name: string;
@@ -7,7 +7,7 @@ interface BookView {
7
7
  sideMargin: number;
8
8
  height: number;
9
9
  delegate: IFrameNavigator;
10
- attributes: IFrameAttributes;
10
+ attributes?: IFrameAttributes;
11
11
  setMode?(scroll: boolean): any;
12
12
  isScrollMode(): any;
13
13
  isPaginated(): any;
@@ -25,8 +25,8 @@ interface BookView {
25
25
  goToFragment(fragment: string): void;
26
26
  goToCssSelector(cssSelector: string): void;
27
27
  snap(element: HTMLElement | null, relative?: boolean): void;
28
- atStart?(): boolean;
29
- atEnd?(): boolean;
28
+ atStart(): boolean;
29
+ atEnd(): boolean;
30
30
  goToPreviousPage?(): void;
31
31
  goToNextPage?(): void;
32
32
  getCurrentPage(): number;
@@ -1,9 +1,7 @@
1
- import Store from "../store/Store";
2
- import IFrameNavigator, { IFrameAttributes } from "../navigator/IFrameNavigator";
1
+ import { IFrameNavigator, IFrameAttributes } from "../navigator/IFrameNavigator";
3
2
  import BookView from "./BookView";
4
3
  export default class FixedBookView implements BookView {
5
4
  layout: string;
6
- constructor(_store: Store);
7
5
  delegate: IFrameNavigator;
8
6
  name: string;
9
7
  label: string;
@@ -25,4 +23,6 @@ export default class FixedBookView implements BookView {
25
23
  setSize(): void;
26
24
  isPaginated(): boolean;
27
25
  isScrollMode(): boolean;
26
+ atEnd(): boolean;
27
+ atStart(): boolean;
28
28
  }
@@ -1,7 +1,7 @@
1
1
  import { UserProperty } from "../model/user-settings/UserProperties";
2
2
  import Store from "../store/Store";
3
3
  import BookView from "./BookView";
4
- import IFrameNavigator, { IFrameAttributes } from "../navigator/IFrameNavigator";
4
+ import { IFrameAttributes, IFrameNavigator } from "../navigator/IFrameNavigator";
5
5
  export default class ReflowableBookView implements BookView {
6
6
  layout: string;
7
7
  private readonly USERSETTINGS;
@@ -32,7 +32,7 @@ export default class ReflowableBookView implements BookView {
32
32
  getPageCount(): number;
33
33
  isPaginated(): boolean;
34
34
  isScrollMode(): boolean;
35
- getProperty(name: string): Promise<UserProperty>;
35
+ getProperty(name: string): Promise<UserProperty | null>;
36
36
  getScreenHeight(): number;
37
37
  setIframeHeight(iframe: any): void;
38
38
  protected hasFixedScrollWidth: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d-i-t-a/reader",
3
- "version": "2.0.0-beta.3",
3
+ "version": "2.0.0-beta.7",
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",
@@ -17,9 +17,8 @@
17
17
  "clean": "rimraf node_modules dist parcel-dist .parcel-cache",
18
18
  "dev": "ts-node -T build.ts -w",
19
19
  "build": "ts-node -T build.ts",
20
- "start": "node dev-server.js",
21
20
  "sass": "node-sass --source-map true src/styles/sass/ -o dist/",
22
- "examples": "node --loader ts-node/esm examples/server.ts",
21
+ "examples": "npx ts-node examples/server.ts",
23
22
  "lint": "eslint '*/**/*.{js,ts,tsx}' --fix",
24
23
  "example:react": "parcel examples/react/index.html --dist-dir parcel-dist"
25
24
  },
@@ -27,14 +26,15 @@
27
26
  "browserslist-useragent": "^3.0.3",
28
27
  "cssesc": "^3.0.0",
29
28
  "detect-browser": "^5.2.0",
30
- "devtools-detector": "^2.0.3",
29
+ "devtools-detector": "^2.0.6",
31
30
  "jscrypto": "0.0.1",
31
+ "lodash.clonedeep": "^4.5.0",
32
32
  "mark.js": "^8.11.1",
33
33
  "promise-polyfill": "^8.2.0",
34
- "sentence-splitter": "^3.2.1",
35
- "lodash.clonedeep": "^4.5.0",
36
34
  "r2-shared-js": "^1.0.51",
35
+ "recursive-readdir": "^2.2.2",
37
36
  "sanitize-html": "^2.3.3",
37
+ "sentence-splitter": "^3.2.1",
38
38
  "util": "^0.12.4",
39
39
  "whatwg-fetch": "^3.6.2"
40
40
  },
@@ -73,6 +73,7 @@
73
73
  "@types/uuid": "^8.3.0",
74
74
  "@typescript-eslint/eslint-plugin": "^4.21.0",
75
75
  "@typescript-eslint/parser": "^4.21.0",
76
+ "ansi-regex": ">=5.0.1",
76
77
  "babel-eslint": "^10.1.0",
77
78
  "braces": ">=3.0.2",
78
79
  "browserslist-useragent-regexp": "^3.0.0",
@@ -83,6 +84,7 @@
83
84
  "cpx": "^1.2.1",
84
85
  "debounce": "^1.2.1",
85
86
  "dita-streamer-js": "^1.1.1",
87
+ "ecstatic": ">=4.1.3",
86
88
  "esbuild": "^0.12.11",
87
89
  "eslint": "^7.23.0",
88
90
  "eslint-config-prettier": "^8.1.0",
@@ -94,6 +96,8 @@
94
96
  "eslint-plugin-react": "^7.23.2",
95
97
  "eslint-plugin-react-hooks": "^4.2.0",
96
98
  "express": "^4.17.1",
99
+ "glob-parent": ">=5.1.2",
100
+ "json-schema": ">=0.4.0",
97
101
  "materialize-css": "^1.0.0",
98
102
  "minimist": ">=1.2.5",
99
103
  "mocha": "^8.3.2",
@@ -110,8 +114,11 @@
110
114
  "rimraf": "^3.0.2",
111
115
  "sinon": "^10.0.0",
112
116
  "ta-json-x": "^2.5.3",
117
+ "tar": ">=6.1.9",
113
118
  "ts-loader": "^8.0.18",
114
- "ts-node": "^10.0.0",
119
+ "ts-node": "^10.4.0",
120
+ "typedoc": "^0.22.5",
121
+ "typedoc-plugin-rename-defaults": "^0.4.0",
115
122
  "typescript": "^4.2.3"
116
123
  },
117
124
  "files": [