@readium/navigator 2.5.0 → 2.5.2-beta.1
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/dist/{ReadiumCSS-after-AX2xHXM6.js → ReadiumCSS-after-CPAYSG9F.js} +7 -6
- package/dist/{ReadiumCSS-after-DwG-6hYO.js → ReadiumCSS-after-CVNJvQab.js} +4 -4
- package/dist/{ReadiumCSS-after-Djsq77vV.js → ReadiumCSS-after-Cpw6SSeZ.js} +12 -11
- package/dist/{ReadiumCSS-after-DIfxADJu.js → ReadiumCSS-after-DBPN8It0.js} +4 -4
- package/dist/{ReadiumCSS-before-BA9Irzag.js → ReadiumCSS-before-CA1r4W7i.js} +1 -1
- package/dist/{ReadiumCSS-before-B8zaPxhu.js → ReadiumCSS-before-D5x0zuZP.js} +1 -1
- package/dist/{ReadiumCSS-before-DKjdmFso.js → ReadiumCSS-before-DXNoxSjL.js} +1 -1
- package/dist/{ReadiumCSS-before-Cz5-ynli.js → ReadiumCSS-before-DtkzLMzT.js} +1 -1
- package/dist/{ReadiumCSS-default-BGrBd7Sk.js → ReadiumCSS-default-BMLfH2r9.js} +1 -1
- package/dist/{ReadiumCSS-default-DsgDIxGa.js → ReadiumCSS-default-BTgk8NbH.js} +1 -1
- package/dist/{ReadiumCSS-default-DzJEDDcb.js → ReadiumCSS-default-C7kHIm6s.js} +1 -1
- package/dist/{ReadiumCSS-default-CcWmjgaR.js → ReadiumCSS-default-C_BHdXWz.js} +1 -1
- package/dist/index.js +598 -564
- package/dist/index.umd.cjs +77 -74
- package/package.json +1 -1
- package/src/epub/EpubNavigator.ts +15 -3
- package/src/epub/css/Properties.ts +0 -1
- package/src/webpub/WebPubNavigator.ts +12 -4
- package/types/src/epub/EpubNavigator.d.ts +5 -2
- package/types/src/epub/css/Properties.d.ts +0 -1
- package/types/src/webpub/WebPubNavigator.d.ts +3 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { Layout, Link, Locator, Profile, Publication, ReadingProgression } from
|
|
|
2
2
|
import { Configurable, ConfigurableSettings, LineLengths, ProgressionRange, VisualNavigator, VisualNavigatorViewport } from "../index.ts";
|
|
3
3
|
import { FramePoolManager } from "./frame/FramePoolManager.ts";
|
|
4
4
|
import { FXLFramePoolManager } from "./fxl/FXLFramePoolManager.ts";
|
|
5
|
-
import { CommsEventKey, ContextMenuEvent, FXLModules,
|
|
5
|
+
import { CommsEventKey, ContextMenuEvent, FXLModules, ModuleLibrary, ModuleName, ReflowableModules, BasicTextSelection, FrameClickEvent, SuspiciousActivityEvent, KeyboardPeripheralEvent } from "@readium/navigator-html-injectables";
|
|
6
6
|
import * as path from "path-browserify";
|
|
7
7
|
import { FXLFrameManager } from "./fxl/FXLFrameManager.ts";
|
|
8
8
|
import { FrameManager } from "./frame/FrameManager.ts";
|
|
@@ -23,6 +23,10 @@ import { getScriptMode } from "../helpers/scriptMode.ts";
|
|
|
23
23
|
|
|
24
24
|
export type ManagerEventKey = "zoom";
|
|
25
25
|
|
|
26
|
+
export interface KeyboardPeripheralEventData extends Omit<KeyboardPeripheralEvent, 'interactiveElement'> {
|
|
27
|
+
interactiveElement?: Element;
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
export interface EpubNavigatorConfiguration {
|
|
27
31
|
preferences: IEpubPreferences;
|
|
28
32
|
defaults: IEpubDefaults;
|
|
@@ -44,7 +48,7 @@ export interface EpubNavigatorListeners {
|
|
|
44
48
|
textSelected: (selection: BasicTextSelection) => void;
|
|
45
49
|
contentProtection: (type: string, data: SuspiciousActivityEvent) => void;
|
|
46
50
|
contextMenu: (data: ContextMenuEvent) => void;
|
|
47
|
-
peripheral: (data:
|
|
51
|
+
peripheral: (data: KeyboardPeripheralEventData) => void;
|
|
48
52
|
// showToc: () => void;
|
|
49
53
|
}
|
|
50
54
|
|
|
@@ -540,7 +544,15 @@ export class EpubNavigator extends VisualNavigator implements Configurable<Confi
|
|
|
540
544
|
this.listeners.contextMenu(data as ContextMenuEvent);
|
|
541
545
|
break;
|
|
542
546
|
case "keyboard_peripherals":
|
|
543
|
-
|
|
547
|
+
const event = data as KeyboardPeripheralEvent;
|
|
548
|
+
const parsedEvent: KeyboardPeripheralEventData = { ...event, interactiveElement: undefined };
|
|
549
|
+
if (event.interactiveElement) {
|
|
550
|
+
parsedEvent.interactiveElement = new DOMParser().parseFromString(
|
|
551
|
+
event.interactiveElement,
|
|
552
|
+
"text/html"
|
|
553
|
+
).body.children[0] as Element;
|
|
554
|
+
}
|
|
555
|
+
this.listeners.peripheral(parsedEvent);
|
|
544
556
|
break;
|
|
545
557
|
case "log":
|
|
546
558
|
console.log(this._cframes[0]?.source?.split("/")[3], ...(data as any[]));
|
|
@@ -2,11 +2,11 @@ import { Feature, Link, Locator, Publication, ReadingProgression, LocatorLocatio
|
|
|
2
2
|
import { VisualNavigator, VisualNavigatorViewport, ProgressionRange } from "../Navigator.ts";
|
|
3
3
|
import { Configurable } from "../preferences/Configurable.ts";
|
|
4
4
|
import { WebPubFramePoolManager } from "./WebPubFramePoolManager.ts";
|
|
5
|
-
import { BasicTextSelection, CommsEventKey, ContextMenuEvent, FrameClickEvent,
|
|
5
|
+
import { BasicTextSelection, CommsEventKey, ContextMenuEvent, FrameClickEvent, KeyboardPeripheralEvent, ModuleName, SuspiciousActivityEvent, WebPubModules } from "@readium/navigator-html-injectables";
|
|
6
6
|
import * as path from "path-browserify";
|
|
7
7
|
import { WebPubFrameManager } from "./WebPubFrameManager.ts";
|
|
8
8
|
|
|
9
|
-
import { ManagerEventKey } from "../epub/EpubNavigator.ts";
|
|
9
|
+
import { KeyboardPeripheralEventData, ManagerEventKey } from "../epub/EpubNavigator.ts";
|
|
10
10
|
import { getScriptMode } from "../helpers/scriptMode.ts";
|
|
11
11
|
import { WebPubCSS } from "./css/WebPubCSS.ts";
|
|
12
12
|
import { WebUserProperties, WebRSProperties } from "./css/Properties.ts";
|
|
@@ -41,7 +41,7 @@ export interface WebPubNavigatorListeners {
|
|
|
41
41
|
textSelected: (selection: BasicTextSelection) => void;
|
|
42
42
|
contentProtection: (type: string, data: SuspiciousActivityEvent) => void;
|
|
43
43
|
contextMenu: (data: ContextMenuEvent) => void;
|
|
44
|
-
peripheral: (data:
|
|
44
|
+
peripheral: (data: KeyboardPeripheralEventData) => void;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const defaultListeners = (listeners: WebPubNavigatorListeners): WebPubNavigatorListeners => ({
|
|
@@ -356,7 +356,15 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
356
356
|
this.listeners.contextMenu(data as ContextMenuEvent);
|
|
357
357
|
break;
|
|
358
358
|
case "keyboard_peripherals":
|
|
359
|
-
|
|
359
|
+
const event = data as KeyboardPeripheralEvent;
|
|
360
|
+
const parsedEvent: KeyboardPeripheralEventData = { ...event, interactiveElement: undefined };
|
|
361
|
+
if (event.interactiveElement) {
|
|
362
|
+
parsedEvent.interactiveElement = new DOMParser().parseFromString(
|
|
363
|
+
event.interactiveElement,
|
|
364
|
+
"text/html"
|
|
365
|
+
).body.children[0] as Element;
|
|
366
|
+
}
|
|
367
|
+
this.listeners.peripheral(parsedEvent);
|
|
360
368
|
break;
|
|
361
369
|
case "log":
|
|
362
370
|
console.log(this.framePool.currentFrames[0]?.source?.split("/")[3], ...(data as any[]));
|
|
@@ -2,7 +2,7 @@ import { Layout, Link, Locator, Publication, ReadingProgression } from "@readium
|
|
|
2
2
|
import { Configurable, ConfigurableSettings, VisualNavigator, VisualNavigatorViewport } from "../index.ts";
|
|
3
3
|
import { FramePoolManager } from "./frame/FramePoolManager.ts";
|
|
4
4
|
import { FXLFramePoolManager } from "./fxl/FXLFramePoolManager.ts";
|
|
5
|
-
import { CommsEventKey, ContextMenuEvent,
|
|
5
|
+
import { CommsEventKey, ContextMenuEvent, BasicTextSelection, FrameClickEvent, SuspiciousActivityEvent, KeyboardPeripheralEvent } from "@readium/navigator-html-injectables";
|
|
6
6
|
import { FXLFrameManager } from "./fxl/FXLFrameManager.ts";
|
|
7
7
|
import { FrameManager } from "./frame/FrameManager.ts";
|
|
8
8
|
import { IEpubPreferences, EpubPreferences } from "./preferences/EpubPreferences.ts";
|
|
@@ -12,6 +12,9 @@ import { EpubPreferencesEditor } from "./preferences/EpubPreferencesEditor.ts";
|
|
|
12
12
|
import { IInjectablesConfig } from "../injection/Injectable.ts";
|
|
13
13
|
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
|
|
14
14
|
export type ManagerEventKey = "zoom";
|
|
15
|
+
export interface KeyboardPeripheralEventData extends Omit<KeyboardPeripheralEvent, 'interactiveElement'> {
|
|
16
|
+
interactiveElement?: Element;
|
|
17
|
+
}
|
|
15
18
|
export interface EpubNavigatorConfiguration {
|
|
16
19
|
preferences: IEpubPreferences;
|
|
17
20
|
defaults: IEpubDefaults;
|
|
@@ -32,7 +35,7 @@ export interface EpubNavigatorListeners {
|
|
|
32
35
|
textSelected: (selection: BasicTextSelection) => void;
|
|
33
36
|
contentProtection: (type: string, data: SuspiciousActivityEvent) => void;
|
|
34
37
|
contextMenu: (data: ContextMenuEvent) => void;
|
|
35
|
-
peripheral: (data:
|
|
38
|
+
peripheral: (data: KeyboardPeripheralEventData) => void;
|
|
36
39
|
}
|
|
37
40
|
export declare class EpubNavigator extends VisualNavigator implements Configurable<ConfigurableSettings, EpubPreferences> {
|
|
38
41
|
private readonly pub;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExperimentKey, TextAlignment } from "../../preferences/Types.ts";
|
|
2
2
|
import { BodyHyphens, BoxSizing, FontOpticalSizing, FontWidth, Ligatures, Properties, TypeScale, View } from "../../css/Properties.ts";
|
|
3
3
|
export interface IUserProperties {
|
|
4
|
-
advancedSettings?: boolean | null;
|
|
5
4
|
a11yNormalize?: boolean | null;
|
|
6
5
|
backgroundColor?: string | null;
|
|
7
6
|
blendFilter?: boolean | null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Link, Locator, Publication, ReadingProgression } from "@readium/shared";
|
|
2
2
|
import { VisualNavigator, VisualNavigatorViewport } from "../Navigator.ts";
|
|
3
3
|
import { Configurable } from "../preferences/Configurable.ts";
|
|
4
|
-
import { BasicTextSelection, CommsEventKey, ContextMenuEvent, FrameClickEvent,
|
|
4
|
+
import { BasicTextSelection, CommsEventKey, ContextMenuEvent, FrameClickEvent, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
|
|
5
5
|
import { WebPubFrameManager } from "./WebPubFrameManager.ts";
|
|
6
|
-
import { ManagerEventKey } from "../epub/EpubNavigator.ts";
|
|
6
|
+
import { KeyboardPeripheralEventData, ManagerEventKey } from "../epub/EpubNavigator.ts";
|
|
7
7
|
import { IWebPubPreferences, WebPubPreferences } from "./preferences/WebPubPreferences.ts";
|
|
8
8
|
import { IWebPubDefaults } from "./preferences/WebPubDefaults.ts";
|
|
9
9
|
import { WebPubSettings } from "./preferences/WebPubSettings.ts";
|
|
@@ -29,7 +29,7 @@ export interface WebPubNavigatorListeners {
|
|
|
29
29
|
textSelected: (selection: BasicTextSelection) => void;
|
|
30
30
|
contentProtection: (type: string, data: SuspiciousActivityEvent) => void;
|
|
31
31
|
contextMenu: (data: ContextMenuEvent) => void;
|
|
32
|
-
peripheral: (data:
|
|
32
|
+
peripheral: (data: KeyboardPeripheralEventData) => void;
|
|
33
33
|
}
|
|
34
34
|
export declare class WebPubNavigator extends VisualNavigator implements Configurable<WebPubSettings, WebPubPreferences> {
|
|
35
35
|
private readonly pub;
|