diff --git a/build.ts b/build.ts index 298d766b..a75755b3 100644 --- a/build.ts +++ b/build.ts @@ -3,7 +3,7 @@ import * as util from "util"; import chalk from "chalk"; import { promises as fs } from "fs"; import { watch } from "chokidar"; -import { debounce } from "debounce"; +import debounce from "debounce"; import copy0 from "copy"; import child_process0 from "child_process"; import sass0 from "sass"; diff --git a/package-lock.json b/package-lock.json index ffbc0cd9..5a4a6804 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@d-i-t-a/reader", - "version": "2.4.2", + "version": "2.4.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@d-i-t-a/reader", - "version": "2.4.2", + "version": "2.4.3", "license": "Apache-2.0", "dependencies": { "@babel/plugin-proposal-private-property-in-object": "^7.21.11", @@ -61,7 +61,7 @@ "chalk": "^4.1.2", "chokidar": "^3.5.2", "copy": "^0.3.2", - "debounce": "^1.2.1", + "debounce": "^2.0.0", "dita-streamer-js": "^1.1.3", "ecstatic": "^4.1.4", "esbuild": "^0.20.0", @@ -100,7 +100,7 @@ "ts-node": "^10.9.1", "typedoc": "^0.25.1", "typedoc-plugin-rename-defaults": "^0.7.0", - "typescript": "5.1.6", + "typescript": "5.3.3", "urijs": "^1.19.11" }, "engines": { @@ -8175,10 +8175,16 @@ } }, "node_modules/debounce": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", - "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-2.0.0.tgz", + "integrity": "sha512-xRetU6gL1VJbs85Mc4FoEGSjQxzpdxRyFhe3lmWFyy2EzydIcD4xzUvRJMD+NPDfMwKNhxa3PvsIOU32luIWeA==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/debug": { "version": "2.6.9", @@ -15858,9 +15864,9 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -22025,9 +22031,9 @@ } }, "debounce": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz", - "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/debounce/-/debounce-2.0.0.tgz", + "integrity": "sha512-xRetU6gL1VJbs85Mc4FoEGSjQxzpdxRyFhe3lmWFyy2EzydIcD4xzUvRJMD+NPDfMwKNhxa3PvsIOU32luIWeA==", "dev": true }, "debug": { @@ -27663,9 +27669,9 @@ } }, "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index a7115494..780dab56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@d-i-t-a/reader", - "version": "2.4.2", + "version": "2.4.3", "description": "A viewer application for EPUB files.", "repository": "https://github.com/d-i-t-a/R2D2BC", "license": "Apache-2.0", @@ -88,7 +88,7 @@ "chalk": "^4.1.2", "chokidar": "^3.5.2", "copy": "^0.3.2", - "debounce": "^1.2.1", + "debounce": "^2.0.0", "dita-streamer-js": "^1.1.3", "ecstatic": "^4.1.4", "esbuild": "^0.20.0", @@ -127,7 +127,7 @@ "ts-node": "^10.9.1", "typedoc": "^0.25.1", "typedoc-plugin-rename-defaults": "^0.7.0", - "typescript": "5.1.6", + "typescript": "5.3.3", "urijs": "^1.19.11" }, "files": [ diff --git a/src/modules/TTS/TTSModule2.ts b/src/modules/TTS/TTSModule2.ts index 72bf15d8..d362f67e 100644 --- a/src/modules/TTS/TTSModule2.ts +++ b/src/modules/TTS/TTSModule2.ts @@ -36,7 +36,7 @@ import { TextHighlighter } from "../highlight/TextHighlighter"; import { HighlightType, IHighlight } from "../highlight/common/highlight"; import { uniqueCssSelector } from "../highlight/renderer/common/cssselector2"; import { convertRange } from "../highlight/renderer/iframe/selection"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { _getCssSelectorOptions, ISelectionInfo, diff --git a/src/modules/highlight/TextHighlighter.ts b/src/modules/highlight/TextHighlighter.ts index 3ca9aac7..0bf37195 100644 --- a/src/modules/highlight/TextHighlighter.ts +++ b/src/modules/highlight/TextHighlighter.ts @@ -18,7 +18,7 @@ */ import { SHA256 } from "jscrypto/es6/SHA256"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { IEventPayload_R2_EVENT_HIGHLIGHT_CLICK } from "./common/events"; import { @@ -655,7 +655,12 @@ export class TextHighlighter { window.addEventListener("resize", this.toolboxPlacement.bind(this)); } doc.addEventListener("selectionchange", this.toolboxPlacement.bind(this)); - doc.addEventListener("selectionchange", this.toolboxShowDelayed.bind(this)); + if (!this.isIOS()) { + doc.addEventListener( + "selectionchange", + this.toolboxShowDelayed.bind(this) + ); + } el.addEventListener("mousedown", this.toolboxHide.bind(this)); el.addEventListener("touchstart", this.toolboxHide.bind(this)); @@ -1973,9 +1978,7 @@ export class TextHighlighter { ); highlightArea.style.setProperty( "border-bottom", - `2px solid rgba(${color.red}, ${color.green}, ${ - color.blue - }, ${1})`, + `2px solid rgba(${color.red}, ${color.green}, ${color.blue}, ${1})`, "important" ); } else if (TextHighlighter.isHexColor(highlight.color)) { @@ -1987,9 +1990,7 @@ export class TextHighlighter { ); highlightArea.style.setProperty( "border-bottom", - `2px solid rgba(${color.red}, ${color.green}, ${ - color.blue - }, ${1})`, + `2px solid rgba(${color.red}, ${color.green}, ${color.blue}, ${1})`, "important" ); } else { @@ -2867,9 +2868,7 @@ export class TextHighlighter { highlightArea.setAttribute( "style", - `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${ - color.red - }, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` + `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${color.red}, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` ); highlightArea.style.setProperty( "border-bottom", @@ -2880,9 +2879,7 @@ export class TextHighlighter { let color = TextHighlighter.hexToRgbChannels(highlight.color); highlightArea.setAttribute( "style", - `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${ - color.red - }, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` + `mix-blend-mode: multiply; border-radius: ${roundedCorner}px !important; background-color: rgba(${color.red}, ${color.green}, ${color.blue}, ${0}) !important; ${extra}` ); highlightArea.style.setProperty( "border-bottom", diff --git a/src/modules/protection/ContentProtectionModule.ts b/src/modules/protection/ContentProtectionModule.ts index 804cfd96..e250c0d3 100644 --- a/src/modules/protection/ContentProtectionModule.ts +++ b/src/modules/protection/ContentProtectionModule.ts @@ -24,7 +24,7 @@ import { addEventListenerOptional, removeEventListenerOptional, } from "../../utils/EventHandler"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { delay } from "../../utils"; import { addListener, launch } from "devtools-detector"; import log from "loglevel"; diff --git a/src/modules/sampleread/SampleReadEventHandler.ts b/src/modules/sampleread/SampleReadEventHandler.ts index 8b781179..8392f608 100644 --- a/src/modules/sampleread/SampleReadEventHandler.ts +++ b/src/modules/sampleread/SampleReadEventHandler.ts @@ -17,7 +17,7 @@ * Licensed to: Bibliotheca LLC under one or more contributor license agreements. */ -import { debounce } from "debounce"; +import debounce from "debounce"; import { IFrameNavigator } from "../../navigator/IFrameNavigator"; export default class SampleReadEventHandler { diff --git a/src/modules/search/DefinitionsModule.ts b/src/modules/search/DefinitionsModule.ts index c2f7b1a0..c24d0d2d 100644 --- a/src/modules/search/DefinitionsModule.ts +++ b/src/modules/search/DefinitionsModule.ts @@ -28,7 +28,7 @@ import { import * as lodash from "lodash"; import { searchDocDomSeek } from "./searchWithDomSeek"; import { HighlightType, IHighlight } from "../highlight/common/highlight"; -import { debounce } from "debounce"; +import debounce from "debounce"; import { ISelectionInfo } from "../highlight/common/selection"; import { SHA256 } from "jscrypto/es6/SHA256"; import { AnnotationMarker } from "../../model/Locator"; diff --git a/src/navigator/IFrameNavigator.ts b/src/navigator/IFrameNavigator.ts index b7eb106c..b0696382 100644 --- a/src/navigator/IFrameNavigator.ts +++ b/src/navigator/IFrameNavigator.ts @@ -59,7 +59,7 @@ import { TextHighlighterConfig, } from "../modules/highlight/TextHighlighter"; import { TimelineModule } from "../modules/positions/TimelineModule"; -import { debounce } from "debounce"; +import debounce from "debounce"; import TouchEventHandler from "../utils/TouchEventHandler"; import KeyboardEventHandler from "../utils/KeyboardEventHandler"; import BookView from "../views/BookView"; @@ -1670,8 +1670,8 @@ export class IFrameNavigator extends EventEmitter implements Navigator { e instanceof Error ? e : typeof e === "string" - ? new Error(e) - : new Error("An unknown error occurred in the IFrameNavigator."); + ? new Error(e) + : new Error("An unknown error occurred in the IFrameNavigator."); this.api.onError(trueError); } else { // otherwise just display the standard error UI diff --git a/src/views/ReflowableBookView.ts b/src/views/ReflowableBookView.ts index 7a2a5eb3..2dcf10b7 100644 --- a/src/views/ReflowableBookView.ts +++ b/src/views/ReflowableBookView.ts @@ -26,7 +26,7 @@ import { IFrameAttributes, IFrameNavigator, } from "../navigator/IFrameNavigator"; -import { debounce } from "debounce"; +import debounce from "debounce"; export default class ReflowableBookView implements BookView { layout = "reflowable";