@d-i-t-a/reader 2.1.0-alpha.2 → 2.1.0-beta.2
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 +68 -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,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 | undefined, size: number, fill: string) => string;
|
|
4
5
|
export declare const icons: {
|
|
5
6
|
error: string;
|
|
6
7
|
home: string;
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IFrameNavigator } from "../navigator/IFrameNavigator";
|
|
2
|
+
export default class KeyboardEventHandler {
|
|
3
|
+
navigator: IFrameNavigator;
|
|
4
|
+
constructor(navigator: IFrameNavigator);
|
|
5
|
+
onBackwardSwipe: (event: UIEvent) => void;
|
|
6
|
+
onForwardSwipe: (event: UIEvent) => void;
|
|
7
|
+
setupEvents: (element: HTMLElement | Document | null) => void;
|
|
8
|
+
focusin: (element: HTMLElement | Document) => void;
|
|
9
|
+
keydown: (element: HTMLElement | Document) => void;
|
|
10
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { IFrameNavigator } from "../navigator/IFrameNavigator";
|
|
1
2
|
export default class TouchEventHandler {
|
|
3
|
+
navigator: IFrameNavigator;
|
|
4
|
+
constructor(navigator: IFrameNavigator);
|
|
2
5
|
private static readonly TAP_TOLERANCE;
|
|
3
6
|
private static readonly LONG_PRESS_MS;
|
|
4
7
|
private static readonly SLOW_SWIPE_MS;
|
|
5
8
|
onBackwardSwipe: (event: UIEvent) => void;
|
|
6
9
|
onForwardSwipe: (event: UIEvent) => void;
|
|
7
|
-
setupEvents: (element: HTMLElement | Document) => void;
|
|
10
|
+
setupEvents: (element: HTMLElement | Document | null) => void;
|
|
8
11
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IFrameNavigator,
|
|
1
|
+
import { IFrameNavigator, IFrameAttributes } from "../navigator/IFrameNavigator";
|
|
2
2
|
interface BookView {
|
|
3
3
|
layout: string;
|
|
4
4
|
name: string;
|
|
@@ -7,23 +7,26 @@ interface BookView {
|
|
|
7
7
|
sideMargin: number;
|
|
8
8
|
height: number;
|
|
9
9
|
delegate: IFrameNavigator;
|
|
10
|
-
attributes
|
|
10
|
+
attributes?: IFrameAttributes;
|
|
11
11
|
setMode?(scroll: boolean): any;
|
|
12
|
-
isScrollMode
|
|
13
|
-
isPaginated
|
|
12
|
+
isScrollMode(): any;
|
|
13
|
+
isPaginated(): any;
|
|
14
14
|
goToElement?(element: HTMLElement | null, relative?: boolean): void;
|
|
15
|
+
setSize(): void;
|
|
15
16
|
setIframeHeight?(iframe: any): any;
|
|
17
|
+
setSize(): void;
|
|
18
|
+
getScreenHeight(): number;
|
|
16
19
|
/** Load this view in its book element, at the specified position. */
|
|
17
20
|
start(): void;
|
|
18
21
|
/** Remove this view from its book element. */
|
|
19
22
|
stop(): void;
|
|
20
23
|
getCurrentPosition(): number;
|
|
21
|
-
|
|
24
|
+
goToProgression(position: number): void;
|
|
22
25
|
goToFragment(fragment: string): void;
|
|
23
26
|
goToCssSelector(cssSelector: string): void;
|
|
24
27
|
snap(element: HTMLElement | null, relative?: boolean): void;
|
|
25
|
-
atStart
|
|
26
|
-
atEnd
|
|
28
|
+
atStart(): boolean;
|
|
29
|
+
atEnd(): boolean;
|
|
27
30
|
goToPreviousPage?(): void;
|
|
28
31
|
goToNextPage?(): void;
|
|
29
32
|
getCurrentPage(): number;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
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;
|
|
@@ -15,10 +13,16 @@ export default class FixedBookView implements BookView {
|
|
|
15
13
|
start(): void;
|
|
16
14
|
stop(): void;
|
|
17
15
|
getCurrentPosition(): number;
|
|
18
|
-
|
|
16
|
+
getScreenHeight(): number;
|
|
17
|
+
goToProgression(_position: number): void;
|
|
19
18
|
goToCssSelector(_cssSelector: string, _relative?: boolean): void;
|
|
20
19
|
goToFragment(_fragment: string, _relative?: boolean): void;
|
|
21
20
|
snap(_element: HTMLElement, _relative?: boolean): void;
|
|
22
21
|
getCurrentPage(): number;
|
|
23
22
|
getPageCount(): number;
|
|
23
|
+
setSize(): void;
|
|
24
|
+
isPaginated(): boolean;
|
|
25
|
+
isScrollMode(): boolean;
|
|
26
|
+
atEnd(): boolean;
|
|
27
|
+
atStart(): boolean;
|
|
24
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
|
|
4
|
+
import { IFrameAttributes, IFrameNavigator } from "../navigator/IFrameNavigator";
|
|
5
5
|
export default class ReflowableBookView implements BookView {
|
|
6
6
|
layout: string;
|
|
7
7
|
private readonly USERSETTINGS;
|
|
@@ -19,7 +19,7 @@ export default class ReflowableBookView implements BookView {
|
|
|
19
19
|
start(): void;
|
|
20
20
|
stop(): void;
|
|
21
21
|
getCurrentPosition(): number;
|
|
22
|
-
|
|
22
|
+
goToProgression(position: number): void;
|
|
23
23
|
goToCssSelector(cssSelector: string, relative?: boolean): void;
|
|
24
24
|
goToFragment(fragment: string, relative?: boolean): void;
|
|
25
25
|
snap(element: HTMLElement | null, _relative?: boolean): void;
|
|
@@ -32,12 +32,12 @@ export default class ReflowableBookView implements BookView {
|
|
|
32
32
|
getPageCount(): number;
|
|
33
33
|
isPaginated(): boolean;
|
|
34
34
|
isScrollMode(): boolean;
|
|
35
|
-
getProperty(name: string): Promise<UserProperty>;
|
|
36
|
-
|
|
35
|
+
getProperty(name: string): Promise<UserProperty | null>;
|
|
36
|
+
getScreenHeight(): number;
|
|
37
37
|
setIframeHeight(iframe: any): void;
|
|
38
38
|
protected hasFixedScrollWidth: boolean;
|
|
39
39
|
protected checkForFixedScrollWidth(): void;
|
|
40
|
-
|
|
40
|
+
setSize(): void;
|
|
41
41
|
/** Returns the total width of the columns that are currently
|
|
42
42
|
positioned to the left of the iframe viewport. */
|
|
43
43
|
private getLeftColumnsWidth;
|
|
@@ -49,4 +49,6 @@ export default class ReflowableBookView implements BookView {
|
|
|
49
49
|
/** Shifts the columns so that the specified width is positioned
|
|
50
50
|
to the left of the iframe viewport. */
|
|
51
51
|
private setLeftColumnsWidth;
|
|
52
|
+
get scrollingElement(): Element;
|
|
53
|
+
get scrollWidth(): number;
|
|
52
54
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-i-t-a/reader",
|
|
3
|
-
"version": "2.1.0-
|
|
3
|
+
"version": "2.1.0-beta.2",
|
|
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",
|
|
7
|
-
"main": "dist/
|
|
8
|
-
"typings": "dist/index.d.ts",
|
|
7
|
+
"main": "dist/esm/index.js",
|
|
8
|
+
"typings": "dist/types/index.d.ts",
|
|
9
9
|
"engines": {
|
|
10
10
|
"node": ">8.0.0"
|
|
11
11
|
},
|
|
@@ -14,26 +14,29 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"prepare": "npm run build",
|
|
17
|
-
"
|
|
18
|
-
"dev": "
|
|
17
|
+
"clean": "rimraf node_modules dist parcel-dist .parcel-cache",
|
|
18
|
+
"dev": "ts-node -T build.ts -w",
|
|
19
|
+
"build": "ts-node -T build.ts",
|
|
19
20
|
"sass": "node-sass --source-map true src/styles/sass/ -o dist/",
|
|
20
|
-
"examples": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"start": "http-server viewer",
|
|
24
|
-
"lint": "eslint '*/**/*.{js,ts,tsx}' --quiet --fix"
|
|
21
|
+
"examples": "npx ts-node examples/server.ts",
|
|
22
|
+
"lint": "eslint '*/**/*.{js,ts,tsx}' --fix",
|
|
23
|
+
"example:react": "parcel examples/react/index.html --dist-dir parcel-dist"
|
|
25
24
|
},
|
|
26
25
|
"dependencies": {
|
|
27
|
-
"browser-detect-devtools": "^1.0.4",
|
|
28
26
|
"browserslist-useragent": "^3.0.3",
|
|
29
27
|
"cssesc": "^3.0.0",
|
|
30
|
-
"debounce": "^1.2.1",
|
|
31
28
|
"detect-browser": "^5.2.0",
|
|
32
|
-
"
|
|
29
|
+
"devtools-detector": "^2.0.10",
|
|
30
|
+
"eventemitter3": "^4.0.7",
|
|
31
|
+
"jscrypto": "^1.0.3",
|
|
32
|
+
"lodash.clonedeep": "^4.5.0",
|
|
33
33
|
"mark.js": "^8.11.1",
|
|
34
34
|
"promise-polyfill": "^8.2.0",
|
|
35
35
|
"r2-shared-js": "^1.0.51",
|
|
36
|
+
"recursive-readdir": "^2.2.2",
|
|
36
37
|
"sanitize-html": "^2.3.3",
|
|
38
|
+
"sentence-splitter": "^3.2.1",
|
|
39
|
+
"util": "^0.12.4",
|
|
37
40
|
"whatwg-fetch": "^3.6.2"
|
|
38
41
|
},
|
|
39
42
|
"browserslist": {
|
|
@@ -49,25 +52,41 @@
|
|
|
49
52
|
]
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
55
|
+
"@parcel/transformer-sass": "^2.4.1",
|
|
56
|
+
"@parcel/transformer-typescript-tsc": "^2.4.1",
|
|
52
57
|
"@types/chai": "^4.2.15",
|
|
58
|
+
"@types/copy": "^0.3.1",
|
|
53
59
|
"@types/cssesc": "^3.0.0",
|
|
54
60
|
"@types/debounce": "^3.0.0",
|
|
61
|
+
"@types/express": "^4.17.12",
|
|
55
62
|
"@types/jquery": "^3.5.5",
|
|
56
63
|
"@types/mark.js": "^8.11.5",
|
|
57
|
-
"@types/materialize-css": "^1.0.8",
|
|
58
64
|
"@types/mocha": "^8.2.2",
|
|
65
|
+
"@types/node-sass": "^4.11.1",
|
|
59
66
|
"@types/pako": "^1.0.1",
|
|
60
67
|
"@types/parse5": "^6.0.0",
|
|
61
68
|
"@types/promise-polyfill": "^6.0.3",
|
|
69
|
+
"@types/react": "^17.0.11",
|
|
70
|
+
"@types/react-dom": "^17.0.7",
|
|
71
|
+
"@types/rimraf": "^3.0.0",
|
|
62
72
|
"@types/sanitize-html": "^1.27.1",
|
|
63
73
|
"@types/uuid": "^8.3.0",
|
|
64
74
|
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
|
65
75
|
"@typescript-eslint/parser": "^4.21.0",
|
|
76
|
+
"ansi-regex": ">=5.0.1",
|
|
66
77
|
"babel-eslint": "^10.1.0",
|
|
67
78
|
"braces": ">=3.0.2",
|
|
68
79
|
"browserslist-useragent-regexp": "^3.0.0",
|
|
80
|
+
"buffer": "^6.0.3",
|
|
69
81
|
"chai": "^4.3.4",
|
|
82
|
+
"chalk": "^4.1.1",
|
|
83
|
+
"chokidar": "^3.5.2",
|
|
84
|
+
"copy": "^0.3.2",
|
|
70
85
|
"cpx": "^1.2.1",
|
|
86
|
+
"debounce": "^1.2.1",
|
|
87
|
+
"dita-streamer-js": "^1.1.3",
|
|
88
|
+
"ecstatic": "^4.1.4",
|
|
89
|
+
"esbuild": "^0.12.11",
|
|
71
90
|
"eslint": "^7.23.0",
|
|
72
91
|
"eslint-config-prettier": "^8.1.0",
|
|
73
92
|
"eslint-config-react-app": "^6.0.0",
|
|
@@ -75,28 +94,38 @@
|
|
|
75
94
|
"eslint-plugin-import": "^2.22.1",
|
|
76
95
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
77
96
|
"eslint-plugin-prettier": "^3.3.1",
|
|
78
|
-
"eslint-plugin-react": "^7.
|
|
97
|
+
"eslint-plugin-react": "^7.29.4",
|
|
79
98
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
80
99
|
"express": "^4.17.1",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"minimist": "
|
|
84
|
-
"mocha": "^
|
|
85
|
-
"
|
|
100
|
+
"glob-parent": ">=5.1.2",
|
|
101
|
+
"json-schema": ">=0.4.0",
|
|
102
|
+
"minimist": "^1.2.6",
|
|
103
|
+
"mocha": "^9.2.2",
|
|
104
|
+
"moment": "^2.29.3",
|
|
105
|
+
"node-sass": "^7.0.1",
|
|
86
106
|
"npm-force-resolutions": "0.0.10",
|
|
107
|
+
"parcel": "^2.4.1",
|
|
108
|
+
"path-parse": "^1.0.7",
|
|
87
109
|
"prettier": "^2.2.1",
|
|
88
|
-
"process": "0.11.10",
|
|
110
|
+
"process": "^0.11.10",
|
|
89
111
|
"rangy": "^1.3.0",
|
|
112
|
+
"react": "^17.0.2",
|
|
113
|
+
"react-app-polyfill": "^2.0.0",
|
|
114
|
+
"react-dom": "^17.0.2",
|
|
115
|
+
"regenerator-runtime": "^0.11.1",
|
|
90
116
|
"rimraf": "^3.0.2",
|
|
91
117
|
"sinon": "^10.0.0",
|
|
92
118
|
"ta-json-x": "^2.5.3",
|
|
119
|
+
"tar": ">=6.1.9",
|
|
93
120
|
"ts-loader": "^8.0.18",
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
121
|
+
"ts-node": "^10.4.0",
|
|
122
|
+
"typedoc": "^0.22.15",
|
|
123
|
+
"typedoc-plugin-rename-defaults": "^0.5.1",
|
|
124
|
+
"typescript": "^4.5.2",
|
|
125
|
+
"urijs": "^1.19.11"
|
|
97
126
|
},
|
|
98
127
|
"files": [
|
|
99
|
-
"dist
|
|
128
|
+
"dist"
|
|
100
129
|
],
|
|
101
130
|
"resolutions": {
|
|
102
131
|
"braces": "3.0.2"
|
package/NOTICE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
R2D2BC
|
|
2
|
-
Copyright 2018-2020 DITA (AM Consulting LLC)
|
|
3
|
-
|
|
4
|
-
This project bundles the following dependencies under the MIT license.
|
|
5
|
-
See bundled license files for details.
|
|
6
|
-
|
|
7
|
-
- Materialize | Copyright (c) 2014-2018 Materialize
|
|
8
|
-
-> in "styles/sass/materialize"
|
|
9
|
-
|
|
10
|
-
This project bundles the following dependencies under the SIL Open Font License.
|
|
11
|
-
See bundled license files for details.
|
|
12
|
-
|
|
13
|
-
- OpenDyxslexic Font | Copyright (c) 12/2012 - 2019
|
|
14
|
-
-> in "viewer/fonts/opendyslexic"
|
|
15
|
-
|
|
16
|
-
This project bundles the following dependencies under the BSD license.
|
|
17
|
-
See bundled license files for details.
|
|
18
|
-
|
|
19
|
-
- Readium-CSS | Copyright (c) 2017, Readium
|
|
20
|
-
-> in "viewer/readium-css"
|
package/dist/index.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { ReaderConfig } from "./navigator/IFrameNavigator";
|
|
2
|
-
import { Locator } from "./model/Locator";
|
|
3
|
-
export declare const IS_DEV: boolean;
|
|
4
|
-
export declare function unload(): Promise<void>;
|
|
5
|
-
export declare function hasMediaOverlays(): boolean;
|
|
6
|
-
export declare function startReadAloud(): void;
|
|
7
|
-
export declare function stopReadAloud(): void;
|
|
8
|
-
export declare function pauseReadAloud(): void;
|
|
9
|
-
export declare function resumeReadAloud(): void;
|
|
10
|
-
export declare function saveBookmark(): Promise<any>;
|
|
11
|
-
export declare function deleteBookmark(bookmark: any): Promise<any>;
|
|
12
|
-
export declare function deleteAnnotation(highlight: any): Promise<any>;
|
|
13
|
-
export declare function addAnnotation(highlight: any): Promise<any>;
|
|
14
|
-
export declare function tableOfContents(): Promise<any>;
|
|
15
|
-
export declare function readingOrder(): Promise<any>;
|
|
16
|
-
export declare function bookmarks(): Promise<any>;
|
|
17
|
-
export declare function annotations(): Promise<any>;
|
|
18
|
-
export declare function search(term: any, current: any): Promise<any>;
|
|
19
|
-
export declare function goToSearchIndex(href: any, index: any, current: any): Promise<void>;
|
|
20
|
-
export declare function goToSearchID(href: any, index: any, current: any): Promise<void>;
|
|
21
|
-
export declare function clearSearch(): Promise<void>;
|
|
22
|
-
export declare function currentResource(): number;
|
|
23
|
-
export declare function mostRecentNavigatedTocItem(): string;
|
|
24
|
-
export declare function totalResources(): number;
|
|
25
|
-
export declare function publicationLanguage(): string[];
|
|
26
|
-
export declare function resetUserSettings(): Promise<void>;
|
|
27
|
-
export declare function applyUserSettings(userSettings: any): Promise<void>;
|
|
28
|
-
export declare function currentSettings(): Promise<{
|
|
29
|
-
appearance: string;
|
|
30
|
-
fontFamily: string;
|
|
31
|
-
textAlignment: string;
|
|
32
|
-
columnCount: string;
|
|
33
|
-
verticalScroll: boolean;
|
|
34
|
-
fontSize: number;
|
|
35
|
-
wordSpacing: number;
|
|
36
|
-
letterSpacing: number;
|
|
37
|
-
pageMargins: number;
|
|
38
|
-
lineHeight: number;
|
|
39
|
-
}>;
|
|
40
|
-
export declare function increase(incremental: any): Promise<void>;
|
|
41
|
-
export declare function decrease(incremental: any): Promise<void>;
|
|
42
|
-
export declare function resetTTSSettings(): Promise<void>;
|
|
43
|
-
export declare function applyTTSSettings(ttsSettings: any): Promise<void>;
|
|
44
|
-
export declare function applyTTSSetting(key: any, value: any): Promise<void>;
|
|
45
|
-
export declare function applyPreferredVoice(value: any): Promise<void>;
|
|
46
|
-
export declare function resetSyncSettings(): Promise<void>;
|
|
47
|
-
export declare function applyMediaOverlaySettings(setting: any): Promise<void>;
|
|
48
|
-
export declare function goTo(locator: any): Promise<void>;
|
|
49
|
-
export declare function nextResource(): Promise<void>;
|
|
50
|
-
export declare function previousResource(): Promise<void>;
|
|
51
|
-
export declare function nextPage(): Promise<void>;
|
|
52
|
-
export declare function previousPage(): Promise<void>;
|
|
53
|
-
export declare function atStart(): Promise<boolean>;
|
|
54
|
-
export declare function atEnd(): Promise<boolean>;
|
|
55
|
-
export declare function scroll(value: any): Promise<void>;
|
|
56
|
-
export declare function currentLocator(): Promise<Locator>;
|
|
57
|
-
export declare function positions(): Promise<any>;
|
|
58
|
-
export declare function goToPosition(value: any): Promise<void>;
|
|
59
|
-
export declare function applyAttributes(value: any): Promise<void>;
|
|
60
|
-
export declare function snapToElement(value: any): Promise<void>;
|
|
61
|
-
export declare function load(config: ReaderConfig): Promise<any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const IS_DEV: boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const IS_DEV: boolean;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var Footnotes;(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{IS_DEV:()=>o});var n=function(e,t,n,o){return new(n||(n=Promise))((function(r,a){function i(e){try{c(o.next(e))}catch(e){a(e)}}function l(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,l)}c((o=o.apply(e,t||[])).next())}))};const o=!1;document.addEventListener("click",(e=>n(void 0,void 0,void 0,(function*(){o&&console.log("Footnote Click Handler");var t=e.target;if("a"===t.tagName.toLowerCase()){var r=document.createElement("div");r.innerHTML=t.outerHTML;var a=r.querySelector("a");if(a&&"noteref"===a.getAttribute("epub:type")){var i=a.getAttribute("href");if(i.indexOf("#")>0){var l=i.substring(i.indexOf("#")+1),c=function(e){var t=document.location.href;return new URL(e,t).href}(i);c=c.substring(0,c.indexOf("#")),e.preventDefault(),e.stopPropagation(),yield fetch(c).then((e=>e.text())).then((e=>n(void 0,void 0,void 0,(function*(){var n=(new DOMParser).parseFromString(e,"text/html").querySelector("aside#"+l);if(n){var o=document.createElement("div");o.className="modal",o.innerHTML='<div class="modal-content"><span class="close">x</span>'+n.innerHTML+"</div>",o.style.display="block",document.body.appendChild(o);var r=o.getElementsByClassName("modal-content")[0],i=t.offsetTop;t.offsetTop>100&&(i=t.offsetTop-20),r.style.top=i+"px",o.getElementsByClassName("close")[0].onclick=function(){o.style.display="none",o.parentElement.removeChild(o)},window.onclick=function(e){e.target===o&&(o.style.display="none",o.parentElement.removeChild(o))}}else a.click()}))))}}}}))),!0),Footnotes=t})();
|
|
2
|
-
//# sourceMappingURL=footnotes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://Footnotes/webpack/bootstrap","webpack://Footnotes/webpack/runtime/define property getters","webpack://Footnotes/webpack/runtime/hasOwnProperty shorthand","webpack://Footnotes/webpack/runtime/make namespace object","webpack://Footnotes/./injectables/footnotes/footnotes.ts"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","IS_DEV","document","addEventListener","event","console","log","htmlElement","target","tagName","toLowerCase","element","createElement","innerHTML","outerHTML","link","querySelector","getAttribute","href","indexOf","id","substring","absolute","currentUrl","location","URL","getAbsoluteHref","preventDefault","stopPropagation","fetch","then","r","text","data","aside","DOMParser","parseFromString","modal","className","style","display","body","appendChild","modalContent","getElementsByClassName","offset","offsetTop","top","onclick","parentElement","removeChild","window","click"],"mappings":"iCACA,IAAIA,EAAsB,CCA1B,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3E,EAAwB,CAACM,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClF,EAAyBT,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,4UCchD,MAAMC,GAC+B,EAE5CC,SAASC,iBACP,SACOC,GAAU,OAAD,6BACVH,GAAQI,QAAQC,IAAI,0BACxB,IAAIC,EAAcH,EAAMI,OACxB,GAA0C,MAAtCD,EAAYE,QAAQC,cAAuB,CAC7C,IAAIC,EAAUT,SAASU,cAAc,OACrCD,EAAQE,UAAYN,EAAYO,UAEhC,IAAIC,EAAOJ,EAAQK,cAAc,KACjC,GAAID,GACiD,YAAnCA,EAAKE,aAAa,aACnB,CACb,IAAIC,EAAOH,EAAKE,aAAa,QAC7B,GAAIC,EAAKC,QAAQ,KAAO,EAAG,CACzB,IAAIC,EAAKF,EAAKG,UAAUH,EAAKC,QAAQ,KAAO,GACxCG,EAsDZ,SAAyBJ,GACvB,IAAIK,EAAarB,SAASsB,SAASN,KACnC,OAAO,IAAIO,IAAIP,EAAMK,GAAYL,KAxDZQ,CAAgBR,GAC/BI,EAAWA,EAASD,UAAU,EAAGC,EAASH,QAAQ,MAElDf,EAAMuB,iBACNvB,EAAMwB,wBAEAC,MAAMP,GACTQ,MAAMC,GAAMA,EAAEC,SACdF,MAAYG,GAAS,OAAD,6BACnB,IAEIC,GAFS,IAAIC,WACAC,gBAAgBH,EAAM,aACvBjB,cAAc,SAAWI,GACzC,GAAIc,EAAO,CACT,IAAIG,EAAQnC,SAASU,cAAc,OACnCyB,EAAMC,UAAY,QAClBD,EAAMxB,UACJ,0DACAqB,EAAMrB,UACN,SACFwB,EAAME,MAAMC,QAAU,QAEtBtC,SAASuC,KAAKC,YAAYL,GAE1B,IAAIM,EAAeN,EAAMO,uBACvB,iBACA,GACEC,EAAStC,EAAYuC,UACrBvC,EAAYuC,UAAY,MAC1BD,EAAStC,EAAYuC,UAAY,IAEnCH,EAAaJ,MAAMQ,IAAMF,EAAS,KAEvBR,EAAMO,uBACf,SACA,GACGI,QAAU,WACbX,EAAME,MAAMC,QAAU,OACtBH,EAAMY,cAAcC,YAAYb,IAGlCc,OAAOH,QAAU,SAAU5C,GACrBA,EAAMI,SAAW6B,IACnBA,EAAME,MAAMC,QAAU,OACtBH,EAAMY,cAAcC,YAAYb,UAIpCtB,EAAKqC,qBAYrB,G","file":"footnotes.js","sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*\n * Copyright 2018-2020 DITA (AM Consulting LLC)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * Developed on behalf of: DITA\n * Licensed to: Bokbasen AS and CAST under one or more contributor license agreements.\n */\n\nexport const IS_DEV =\n process.env.NODE_ENV === \"development\" || process.env.NODE_ENV === \"dev\";\n\ndocument.addEventListener(\n \"click\",\n async (event) => {\n if (IS_DEV) console.log(\"Footnote Click Handler\");\n var htmlElement = event.target as HTMLElement;\n if (htmlElement.tagName.toLowerCase() === \"a\") {\n var element = document.createElement(\"div\");\n element.innerHTML = htmlElement.outerHTML;\n\n var link = element.querySelector(\"a\");\n if (link) {\n var attribute = link.getAttribute(\"epub:type\") === \"noteref\";\n if (attribute) {\n var href = link.getAttribute(\"href\");\n if (href.indexOf(\"#\") > 0) {\n var id = href.substring(href.indexOf(\"#\") + 1);\n var absolute = getAbsoluteHref(href);\n absolute = absolute.substring(0, absolute.indexOf(\"#\"));\n\n event.preventDefault();\n event.stopPropagation();\n\n await fetch(absolute)\n .then((r) => r.text())\n .then(async (data) => {\n var parser = new DOMParser();\n var doc = parser.parseFromString(data, \"text/html\");\n var aside = doc.querySelector(\"aside#\" + id);\n if (aside) {\n var modal = document.createElement(\"div\");\n modal.className = \"modal\";\n modal.innerHTML =\n '<div class=\"modal-content\"><span class=\"close\">x</span>' +\n aside.innerHTML +\n \"</div>\";\n modal.style.display = \"block\";\n\n document.body.appendChild(modal);\n\n var modalContent = modal.getElementsByClassName(\n \"modal-content\"\n )[0] as HTMLDivElement;\n var offset = htmlElement.offsetTop;\n if (htmlElement.offsetTop > 100) {\n offset = htmlElement.offsetTop - 20;\n }\n modalContent.style.top = offset + \"px\";\n\n var span = modal.getElementsByClassName(\n \"close\"\n )[0] as HTMLSpanElement;\n span.onclick = function () {\n modal.style.display = \"none\";\n modal.parentElement.removeChild(modal);\n };\n\n window.onclick = function (event) {\n if (event.target === modal) {\n modal.style.display = \"none\";\n modal.parentElement.removeChild(modal);\n }\n };\n } else {\n link.click();\n }\n });\n }\n }\n }\n }\n function getAbsoluteHref(href: string): string | null {\n var currentUrl = document.location.href;\n return new URL(href, currentUrl).href;\n }\n },\n true\n);\n"],"sourceRoot":""}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*! For license information please see glossary.js.LICENSE.txt */
|
|
2
|
-
var Glossary;(()=>{var e={813:function(e){e.exports=function(){"use strict";var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o=function(){function e(n){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5e3;t(this,e),this.ctx=n,this.iframes=r,this.exclude=o,this.iframesTimeout=i}return n(e,[{key:"getContexts",value:function(){var e=[];return(void 0!==this.ctx&&this.ctx?NodeList.prototype.isPrototypeOf(this.ctx)?Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?this.ctx:"string"==typeof this.ctx?Array.prototype.slice.call(document.querySelectorAll(this.ctx)):[this.ctx]:[]).forEach((function(t){var n=e.filter((function(e){return e.contains(t)})).length>0;-1!==e.indexOf(t)||n||e.push(t)})),e}},{key:"getIframeContents",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){},r=void 0;try{var o=e.contentWindow;if(r=o.document,!o||!r)throw new Error("iframe inaccessible")}catch(e){n()}r&&t(r)}},{key:"isIframeBlank",value:function(e){var t="about:blank",n=e.getAttribute("src").trim();return e.contentWindow.location.href===t&&n!==t&&n}},{key:"observeIframeLoad",value:function(e,t,n){var r=this,o=!1,i=null,a=function a(){if(!o){o=!0,clearTimeout(i);try{r.isIframeBlank(e)||(e.removeEventListener("load",a),r.getIframeContents(e,t,n))}catch(e){n()}}};e.addEventListener("load",a),i=setTimeout(a,this.iframesTimeout)}},{key:"onIframeReady",value:function(e,t,n){try{"complete"===e.contentWindow.document.readyState?this.isIframeBlank(e)?this.observeIframeLoad(e,t,n):this.getIframeContents(e,t,n):this.observeIframeLoad(e,t,n)}catch(e){n()}}},{key:"waitForIframes",value:function(e,t){var n=this,r=0;this.forEachIframe(e,(function(){return!0}),(function(e){r++,n.waitForIframes(e.querySelector("html"),(function(){--r||t()}))}),(function(e){e||t()}))}},{key:"forEachIframe",value:function(t,n,r){var o=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},a=t.querySelectorAll("iframe"),s=a.length,c=0;a=Array.prototype.slice.call(a);var u=function(){--s<=0&&i(c)};s||u(),a.forEach((function(t){e.matches(t,o.exclude)?u():o.onIframeReady(t,(function(e){n(t)&&(c++,r(e)),u()}),u)}))}},{key:"createIterator",value:function(e,t,n){return document.createNodeIterator(e,t,n,!1)}},{key:"createInstanceOnIframe",value:function(t){return new e(t.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(e,t,n){if(e.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_PRECEDING){if(null===t)return!0;if(t.compareDocumentPosition(n)&Node.DOCUMENT_POSITION_FOLLOWING)return!0}return!1}},{key:"getIteratorNode",value:function(e){var t=e.previousNode();return{prevNode:t,node:(null===t||e.nextNode())&&e.nextNode()}}},{key:"checkIframeFilter",value:function(e,t,n,r){var o=!1,i=!1;return r.forEach((function(e,t){e.val===n&&(o=t,i=e.handled)})),this.compareNodeIframe(e,t,n)?(!1!==o||i?!1===o||i||(r[o].handled=!0):r.push({val:n,handled:!0}),!0):(!1===o&&r.push({val:n,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(e,t,n,r){var o=this;e.forEach((function(e){e.handled||o.getIframeContents(e.val,(function(e){o.createInstanceOnIframe(e).forEachNode(t,n,r)}))}))}},{key:"iterateThroughNodes",value:function(e,t,n,r,o){for(var i=this,a=this.createIterator(t,e,r),s=[],c=[],u=void 0,l=void 0;h=void 0,h=i.getIteratorNode(a),l=h.prevNode,u=h.node;)this.iframes&&this.forEachIframe(t,(function(e){return i.checkIframeFilter(u,l,e,s)}),(function(t){i.createInstanceOnIframe(t).forEachNode(e,(function(e){return c.push(e)}),r)})),c.push(u);var h;c.forEach((function(e){n(e)})),this.iframes&&this.handleOpenIframes(s,e,n,r),o()}},{key:"forEachNode",value:function(e,t,n){var r=this,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},i=this.getContexts(),a=i.length;a||o(),i.forEach((function(i){var s=function(){r.iterateThroughNodes(e,i,t,n,(function(){--a<=0&&o()}))};r.iframes?r.waitForIframes(i,s):s()}))}}],[{key:"matches",value:function(e,t){var n="string"==typeof t?[t]:t,r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector;if(r){var o=!1;return n.every((function(t){return!r.call(e,t)||(o=!0,!1)})),o}return!1}}]),e}(),i=function(){function i(e){t(this,i),this.ctx=e,this.ie=!1;var n=window.navigator.userAgent;(n.indexOf("MSIE")>-1||n.indexOf("Trident")>-1)&&(this.ie=!0)}return n(i,[{key:"log",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"debug",r=this.opt.log;this.opt.debug&&"object"===(void 0===r?"undefined":e(r))&&"function"==typeof r[n]&&r[n]("mark.js: "+t)}},{key:"escapeStr",value:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(e){return"disabled"!==this.opt.wildcards&&(e=this.setupWildcardsRegExp(e)),e=this.escapeStr(e),Object.keys(this.opt.synonyms).length&&(e=this.createSynonymsRegExp(e)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),this.opt.diacritics&&(e=this.createDiacriticsRegExp(e)),e=this.createMergedBlanksRegExp(e),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.createJoinersRegExp(e)),"disabled"!==this.opt.wildcards&&(e=this.createWildcardsRegExp(e)),this.createAccuracyRegExp(e)}},{key:"createSynonymsRegExp",value:function(e){var t=this.opt.synonyms,n=this.opt.caseSensitive?"":"i",r=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var o in t)if(t.hasOwnProperty(o)){var i=t[o],a="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(o):this.escapeStr(o),s="disabled"!==this.opt.wildcards?this.setupWildcardsRegExp(i):this.escapeStr(i);""!==a&&""!==s&&(e=e.replace(new RegExp("("+this.escapeStr(a)+"|"+this.escapeStr(s)+")","gm"+n),r+"("+this.processSynomyms(a)+"|"+this.processSynomyms(s)+")"+r))}return e}},{key:"processSynomyms",value:function(e){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(e=this.setupIgnoreJoinersRegExp(e)),e}},{key:"setupWildcardsRegExp",value:function(e){return(e=e.replace(/(?:\\)*\?/g,(function(e){return"\\"===e.charAt(0)?"?":""}))).replace(/(?:\\)*\*/g,(function(e){return"\\"===e.charAt(0)?"*":""}))}},{key:"createWildcardsRegExp",value:function(e){var t="withSpaces"===this.opt.wildcards;return e.replace(/\u0001/g,t?"[\\S\\s]?":"\\S?").replace(/\u0002/g,t?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(e){return e.replace(/[^(|)\\]/g,(function(e,t,n){var r=n.charAt(t+1);return/[(|)\\]/.test(r)||""===r?e:e+"\0"}))}},{key:"createJoinersRegExp",value:function(e){var t=[],n=this.opt.ignorePunctuation;return Array.isArray(n)&&n.length&&t.push(this.escapeStr(n.join(""))),this.opt.ignoreJoiners&&t.push("\\u00ad\\u200b\\u200c\\u200d"),t.length?e.split(/\u0000+/).join("["+t.join("")+"]*"):e}},{key:"createDiacriticsRegExp",value:function(e){var t=this.opt.caseSensitive?"":"i",n=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],r=[];return e.split("").forEach((function(o){n.every((function(n){if(-1!==n.indexOf(o)){if(r.indexOf(n)>-1)return!1;e=e.replace(new RegExp("["+n+"]","gm"+t),"["+n+"]"),r.push(n)}return!0}))})),e}},{key:"createMergedBlanksRegExp",value:function(e){return e.replace(/[\s]+/gim,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(e){var t=this,n=this.opt.accuracy,r="string"==typeof n?n:n.value,o="string"==typeof n?[]:n.limiters,i="";switch(o.forEach((function(e){i+="|"+t.escapeStr(e)})),r){case"partially":default:return"()("+e+")";case"complementary":return"()([^"+(i="\\s"+(i||this.escapeStr("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿")))+"]*"+e+"[^"+i+"]*)";case"exactly":return"(^|\\s"+i+")("+e+")(?=$|\\s"+i+")"}}},{key:"getSeparatedKeywords",value:function(e){var t=this,n=[];return e.forEach((function(e){t.opt.separateWordSearch?e.split(" ").forEach((function(e){e.trim()&&-1===n.indexOf(e)&&n.push(e)})):e.trim()&&-1===n.indexOf(e)&&n.push(e)})),{keywords:n.sort((function(e,t){return t.length-e.length})),length:n.length}}},{key:"isNumeric",value:function(e){return Number(parseFloat(e))==e}},{key:"checkRanges",value:function(e){var t=this;if(!Array.isArray(e)||"[object Object]"!==Object.prototype.toString.call(e[0]))return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(e),[];var n=[],r=0;return e.sort((function(e,t){return e.start-t.start})).forEach((function(e){var o=t.callNoMatchOnInvalidRanges(e,r),i=o.start,a=o.end;o.valid&&(e.start=i,e.length=a-i,n.push(e),r=a)})),n}},{key:"callNoMatchOnInvalidRanges",value:function(e,t){var n=void 0,r=void 0,o=!1;return e&&void 0!==e.start?(r=(n=parseInt(e.start,10))+parseInt(e.length,10),this.isNumeric(e.start)&&this.isNumeric(e.length)&&r-t>0&&r-n>0?o=!0:(this.log("Ignoring invalid or overlapping range: "+JSON.stringify(e)),this.opt.noMatch(e))):(this.log("Ignoring invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:n,end:r,valid:o}}},{key:"checkWhitespaceRanges",value:function(e,t,n){var r=void 0,o=!0,i=n.length,a=t-i,s=parseInt(e.start,10)-a;return(r=(s=s>i?i:s)+parseInt(e.length,10))>i&&(r=i,this.log("End range automatically set to the max value of "+i)),s<0||r-s<0||s>i||r>i?(o=!1,this.log("Invalid range: "+JSON.stringify(e)),this.opt.noMatch(e)):""===n.substring(s,r).replace(/\s+/g,"")&&(o=!1,this.log("Skipping whitespace only range: "+JSON.stringify(e)),this.opt.noMatch(e)),{start:s,end:r,valid:o}}},{key:"getTextNodes",value:function(e){var t=this,n="",r=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,(function(e){r.push({start:n.length,end:(n+=e.textContent).length,node:e})}),(function(e){return t.matchesExclude(e.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),(function(){e({value:n,nodes:r})}))}},{key:"matchesExclude",value:function(e){return o.matches(e,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(e,t,n){var r=this.opt.element?this.opt.element:"mark",o=e.splitText(t),i=o.splitText(n-t),a=document.createElement(r);return a.setAttribute("data-markjs","true"),this.opt.className&&a.setAttribute("class",this.opt.className),a.textContent=o.textContent,o.parentNode.replaceChild(a,o),i}},{key:"wrapRangeInMappedTextNode",value:function(e,t,n,r,o){var i=this;e.nodes.every((function(a,s){var c=e.nodes[s+1];if(void 0===c||c.start>t){if(!r(a.node))return!1;var u=t-a.start,l=(n>a.end?a.end:n)-a.start,h=e.value.substr(0,a.start),f=e.value.substr(l+a.start);if(a.node=i.wrapRangeInTextNode(a.node,u,l),e.value=h+f,e.nodes.forEach((function(t,n){n>=s&&(e.nodes[n].start>0&&n!==s&&(e.nodes[n].start-=l),e.nodes[n].end-=l)})),n-=l,o(a.node.previousSibling,a.start),!(n>a.end))return!1;t=a.end}return!0}))}},{key:"wrapMatches",value:function(e,t,n,r,o){var i=this,a=0===t?0:t+1;this.getTextNodes((function(t){t.nodes.forEach((function(t){t=t.node;for(var o=void 0;null!==(o=e.exec(t.textContent))&&""!==o[a];)if(n(o[a],t)){var s=o.index;if(0!==a)for(var c=1;c<a;c++)s+=o[c].length;t=i.wrapRangeInTextNode(t,s,s+o[a].length),r(t.previousSibling),e.lastIndex=0}})),o()}))}},{key:"wrapMatchesAcrossElements",value:function(e,t,n,r,o){var i=this,a=0===t?0:t+1;this.getTextNodes((function(t){for(var s=void 0;null!==(s=e.exec(t.value))&&""!==s[a];){var c=s.index;if(0!==a)for(var u=1;u<a;u++)c+=s[u].length;var l=c+s[a].length;i.wrapRangeInMappedTextNode(t,c,l,(function(e){return n(s[a],e)}),(function(t,n){e.lastIndex=n,r(t)}))}o()}))}},{key:"wrapRangeFromIndex",value:function(e,t,n,r){var o=this;this.getTextNodes((function(i){var a=i.value.length;e.forEach((function(e,r){var s=o.checkWhitespaceRanges(e,a,i.value),c=s.start,u=s.end;s.valid&&o.wrapRangeInMappedTextNode(i,c,u,(function(n){return t(n,e,i.value.substring(c,u),r)}),(function(t){n(t,e)}))})),r()}))}},{key:"unwrapMatches",value:function(e){for(var t=e.parentNode,n=document.createDocumentFragment();e.firstChild;)n.appendChild(e.removeChild(e.firstChild));t.replaceChild(n,e),this.ie?this.normalizeTextNode(t):t.normalize()}},{key:"normalizeTextNode",value:function(e){if(e){if(3===e.nodeType)for(;e.nextSibling&&3===e.nextSibling.nodeType;)e.nodeValue+=e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);else this.normalizeTextNode(e.firstChild);this.normalizeTextNode(e.nextSibling)}}},{key:"markRegExp",value:function(e,t){var n=this;this.opt=t,this.log('Searching with expression "'+e+'"');var r=0,o="wrapMatches";this.opt.acrossElements&&(o="wrapMatchesAcrossElements"),this[o](e,this.opt.ignoreGroups,(function(e,t){return n.opt.filter(t,e,r)}),(function(e){r++,n.opt.each(e)}),(function(){0===r&&n.opt.noMatch(e),n.opt.done(r)}))}},{key:"mark",value:function(e,t){var n=this;this.opt=t;var r=0,o="wrapMatches",i=this.getSeparatedKeywords("string"==typeof e?[e]:e),a=i.keywords,s=i.length,c=this.opt.caseSensitive?"":"i";this.opt.acrossElements&&(o="wrapMatchesAcrossElements"),0===s?this.opt.done(r):function e(t){var i=new RegExp(n.createRegExp(t),"gm"+c),u=0;n.log('Searching with expression "'+i+'"'),n[o](i,1,(function(e,o){return n.opt.filter(o,t,r,u)}),(function(e){u++,r++,n.opt.each(e)}),(function(){0===u&&n.opt.noMatch(t),a[s-1]===t?n.opt.done(r):e(a[a.indexOf(t)+1])}))}(a[0])}},{key:"markRanges",value:function(e,t){var n=this;this.opt=t;var r=0,o=this.checkRanges(e);o&&o.length?(this.log("Starting to mark with the following ranges: "+JSON.stringify(o)),this.wrapRangeFromIndex(o,(function(e,t,r,o){return n.opt.filter(e,t,r,o)}),(function(e,t){r++,n.opt.each(e,t)}),(function(){n.opt.done(r)}))):this.opt.done(r)}},{key:"unmark",value:function(e){var t=this;this.opt=e;var n=this.opt.element?this.opt.element:"*";n+="[data-markjs]",this.opt.className&&(n+="."+this.opt.className),this.log('Removal selector "'+n+'"'),this.iterator.forEachNode(NodeFilter.SHOW_ELEMENT,(function(e){t.unwrapMatches(e)}),(function(e){var r=o.matches(e,n),i=t.matchesExclude(e);return!r||i?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}),this.opt.done)}},{key:"opt",set:function(e){this._opt=r({},{element:"",className:"",exclude:[],iframes:!1,iframesTimeout:5e3,separateWordSearch:!0,diacritics:!0,synonyms:{},accuracy:"partially",acrossElements:!1,caseSensitive:!1,ignoreJoiners:!1,ignoreGroups:0,ignorePunctuation:[],wildcards:"disabled",each:function(){},noMatch:function(){},filter:function(){return!0},done:function(){},debug:!1,log:window.console},e)},get:function(){return this._opt}},{key:"iterator",get:function(){return new o(this.ctx,this.opt.iframes,this.opt.exclude,this.opt.iframesTimeout)}}]),i}();return function(e){var t=this,n=new i(e);return this.mark=function(e,r){return n.mark(e,r),t},this.markRegExp=function(e,r){return n.markRegExp(e,r),t},this.markRanges=function(e,r){return n.markRanges(e,r),t},this.unmark=function(e){return n.unmark(e),t},this}}()}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{IS_DEV:()=>o});var e=n(813),t=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))};const o=!1;!function(n){t(this,void 0,void 0,(function*(){o&&console.log("glossary mark words "+n),n.forEach((function(n){return t(this,void 0,void 0,(function*(){o&&console.log(n);var r=new e(document.body);yield r.mark(n.word,{accuracy:{value:"exactly",limiters:[".",",",";",":",")"]},separateWordSearch:!1,acrossElements:!0,exclude:["h1","h2","h3","h4","h5","h6","figure"],element:"a",className:"gloss",each:function(e){e.addEventListener("click",(r=>t(this,void 0,void 0,(function*(){var t=e;o&&console.log("Mark Node Click Handler"),r.preventDefault(),r.stopPropagation();var i=document.createElement("div");i.className="modal",i.innerHTML='<div class="modal-content"><span class="close">x</span>'+n.definition+"</div>",i.style.display="block",document.body.appendChild(i);var a=i.getElementsByClassName("modal-content")[0],s=t.offsetTop;t.offsetTop>100&&(s=t.offsetTop-20),a.style.top=s+"px",i.getElementsByClassName("close")[0].onclick=function(){i.style.display="none",i.parentElement.removeChild(i)},window.onclick=function(e){e.target===i&&(i.style.display="none",i.parentElement.removeChild(i))}}))),!0)}})}))}))}))}([{word:"frankenstein",definition:"who is frankenstein"},{word:"Mary Shelley",definition:"who is Mary Shelley?"}])})(),Glossary=r})();
|
|
3
|
-
//# sourceMappingURL=glossary.js.map
|