@readium/navigator 2.6.1 → 2.7.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/LICENSE +28 -0
- package/dist/Navigator.js +1 -0
- package/dist/_virtual/index.js +1 -0
- package/dist/_virtual/preload-helper.js +1 -0
- package/dist/audio/AudioNavigator.js +1 -0
- package/dist/audio/AudioPoolManager.js +1 -0
- package/dist/audio/engine/PreservePitchProcessor.js +215 -0
- package/dist/audio/engine/PreservePitchWorklet.js +1 -0
- package/dist/audio/engine/WebAudioEngine.js +1 -0
- package/dist/audio/preferences/AudioDefaults.js +1 -0
- package/dist/audio/preferences/AudioPreferences.js +1 -0
- package/dist/audio/preferences/AudioPreferencesEditor.js +1 -0
- package/dist/audio/preferences/AudioSettings.js +1 -0
- package/dist/audio/protection/AudioNavigatorProtector.js +1 -0
- package/dist/css/Properties.js +1 -0
- package/dist/dom/_readium_cssSelectorGenerator.js +1 -0
- package/dist/dom/_readium_executionCleanup.js +14 -0
- package/dist/dom/_readium_executionPrevention.js +66 -0
- package/dist/dom/_readium_webpubExecution.js +5 -0
- package/dist/epub/EpubNavigator.js +1 -0
- package/dist/epub/css/Properties.js +1 -0
- package/dist/epub/css/ReadiumCSS.js +1 -0
- package/dist/epub/frame/FrameBlobBuilder.js +1 -0
- package/dist/epub/frame/FrameComms.js +1 -0
- package/dist/epub/frame/FrameManager.js +1 -0
- package/dist/epub/frame/FramePoolManager.js +1 -0
- package/dist/epub/fxl/FXLCoordinator.js +1 -0
- package/dist/epub/fxl/FXLFrameManager.js +1 -0
- package/dist/epub/fxl/FXLFramePoolManager.js +1 -0
- package/dist/epub/fxl/FXLPeripherals.js +4 -0
- package/dist/epub/fxl/FXLPeripheralsDebug.js +1 -0
- package/dist/epub/fxl/FXLSpreader.js +1 -0
- package/dist/epub/preferences/EpubDefaults.js +1 -0
- package/dist/epub/preferences/EpubPreferences.js +1 -0
- package/dist/epub/preferences/EpubPreferencesEditor.js +1 -0
- package/dist/epub/preferences/EpubSettings.js +1 -0
- package/dist/helpers/dimensions.js +1 -0
- package/dist/helpers/dist/sML.js +1 -0
- package/dist/helpers/lineLength.js +1 -0
- package/dist/helpers/minify.js +1 -0
- package/dist/helpers/scriptMode.js +1 -0
- package/dist/index.js +1 -11006
- package/dist/injection/Injector.js +1 -0
- package/dist/injection/epubInjectables.js +1 -0
- package/dist/injection/webpubInjectables.js +1 -0
- package/dist/{ReadiumCSS-after-D7unrNI9.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/ReadiumCSS-after.css.js} +2 -5
- package/dist/{ReadiumCSS-before-DwBLxUVH.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/ReadiumCSS-before.css.js} +2 -5
- package/dist/{ReadiumCSS-default-AIAk8uwU.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/ReadiumCSS-default.css.js} +2 -5
- package/dist/{ReadiumCSS-ebpaj_fonts_patch-Dt2XliTg.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/ReadiumCSS-ebpaj_fonts_patch.css.js} +2 -5
- package/dist/{ReadiumCSS-after-XUKPAxfT.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/cjk-horizontal/ReadiumCSS-after.css.js} +2 -5
- package/dist/{ReadiumCSS-before-8FMq19-x.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/cjk-horizontal/ReadiumCSS-before.css.js} +2 -5
- package/dist/{ReadiumCSS-default-N65xNiIp.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/cjk-horizontal/ReadiumCSS-default.css.js} +2 -5
- package/dist/{ReadiumCSS-after-ClF4TBzj.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/cjk-vertical/ReadiumCSS-after.css.js} +2 -5
- package/dist/{ReadiumCSS-before-BNTwR8Qm.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/cjk-vertical/ReadiumCSS-before.css.js} +2 -5
- package/dist/{ReadiumCSS-default-BesyZHRU.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/cjk-vertical/ReadiumCSS-default.css.js} +2 -5
- package/dist/{ReadiumCSS-after-d5mC4cme.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/rtl/ReadiumCSS-after.css.js} +2 -5
- package/dist/{ReadiumCSS-before-CG-KmDa3.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/rtl/ReadiumCSS-before.css.js} +2 -5
- package/dist/{ReadiumCSS-default-BhdLiyWp.js → node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/rtl/ReadiumCSS-default.css.js} +2 -5
- package/dist/node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/dist/webPub/ReadiumCSS-webPub.css.js +274 -0
- package/dist/node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/vars/colors.json.js +1 -0
- package/dist/node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/vars/experiments.json.js +1 -0
- package/dist/node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/vars/fontStacks.json.js +1 -0
- package/dist/node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/vars/i18n.json.js +1 -0
- package/dist/node_modules/.pnpm/@readium_css@2.0.5/node_modules/@readium/css/css/vars/settings.json.js +1 -0
- package/dist/node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.js +1 -0
- package/dist/peripherals/KeyboardConditionBridge.js +1 -0
- package/dist/peripherals/KeyboardPeripherals.js +1 -0
- package/dist/preferences/Preference.js +1 -0
- package/dist/preferences/Types.js +1 -0
- package/dist/preferences/guards.js +1 -0
- package/dist/protection/AutomationDetector.js +1 -0
- package/dist/protection/ContextMenuProtector.js +1 -0
- package/dist/protection/CopyProtector.js +1 -0
- package/dist/protection/DevToolsDetector.js +1 -0
- package/dist/protection/DragAndDropProtector.js +1 -0
- package/dist/protection/IframeEmbeddingDetector.js +1 -0
- package/dist/protection/NavigatorProtector.js +1 -0
- package/dist/protection/PrintProtector.js +15 -0
- package/dist/protection/utils/WorkerConsole.js +12 -0
- package/dist/protection/utils/console.js +1 -0
- package/dist/protection/utils/match.js +1 -0
- package/dist/protection/utils/platform.js +1 -0
- package/dist/webpub/WebPubBlobBuilder.js +2 -0
- package/dist/webpub/WebPubFrameManager.js +1 -0
- package/dist/webpub/WebPubFramePoolManager.js +1 -0
- package/dist/webpub/WebPubNavigator.js +1 -0
- package/dist/webpub/css/Properties.js +1 -0
- package/dist/webpub/css/WebPubCSS.js +1 -0
- package/dist/webpub/preferences/WebPubDefaults.js +1 -0
- package/dist/webpub/preferences/WebPubPreferences.js +1 -0
- package/dist/webpub/preferences/WebPubPreferencesEditor.js +1 -0
- package/dist/webpub/preferences/WebPubSettings.js +1 -0
- package/package.json +16 -14
- package/src/Navigator.ts +4 -1
- package/src/audio/AudioNavigator.ts +8 -8
- package/src/decorations/index.ts +24 -127
- package/src/epub/EpubNavigator.ts +149 -20
- package/src/epub/frame/FrameManager.ts +8 -3
- package/src/epub/frame/FramePoolManager.ts +5 -2
- package/src/epub/fxl/FXLCoordinator.ts +1 -1
- package/src/epub/fxl/FXLFrameManager.ts +1 -1
- package/src/epub/preferences/EpubDefaults.ts +1 -1
- package/src/epub/preferences/EpubSettings.ts +1 -1
- package/src/protection/DevToolsDetector.ts +1 -1
- package/src/webpub/WebPubFrameManager.ts +9 -3
- package/src/webpub/WebPubFramePoolManager.ts +5 -2
- package/src/webpub/WebPubNavigator.ts +100 -19
- package/src/webpub/preferences/WebPubDefaults.ts +1 -1
- package/src/webpub/preferences/WebPubSettings.ts +1 -1
- package/types/src/Navigator.d.ts +3 -1
- package/types/src/decorations/index.d.ts +5 -59
- package/types/src/epub/EpubNavigator.d.ts +13 -3
- package/types/src/epub/frame/FrameManager.d.ts +2 -1
- package/types/src/epub/frame/FramePoolManager.d.ts +2 -1
- package/types/src/epub/fxl/FXLFramePoolManager.d.ts +1 -1
- package/types/src/webpub/WebPubFrameManager.d.ts +2 -1
- package/types/src/webpub/WebPubFramePoolManager.d.ts +2 -1
- package/types/src/webpub/WebPubNavigator.d.ts +12 -3
- package/dist/ar-DyHX_uy2.js +0 -7
- package/dist/da-Dct0PS3E.js +0 -7
- package/dist/fr-C5HEel98.js +0 -7
- package/dist/index.umd.cjs +0 -5615
- package/dist/it-DFOBoXGy.js +0 -7
- package/dist/pt_PT-Di3sVjze.js +0 -7
- package/dist/sv-BfzAFsVN.js +0 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Feature, Link, Locator, LocatorText, Publication, ReadingProgression, LocatorLocations } from "@readium/shared";
|
|
1
|
+
import { Feature, Link, Locator, LocatorText, Publication, ReadingProgression, LocatorLocations, Timeline, TimelineItem, getCssSelector, getHtmlId } from "@readium/shared";
|
|
2
2
|
import { VisualNavigator, VisualNavigatorViewport, ProgressionRange, KeyboardPeripheralEventData } from "../Navigator.ts";
|
|
3
3
|
import { Configurable } from "../preferences/Configurable.ts";
|
|
4
4
|
import { WebPubFramePoolManager } from "./WebPubFramePoolManager.ts";
|
|
5
|
-
import { BasicTextSelection, CommsEventKey, ContextMenuEvent, DecorationActivatedEvent, FrameClickEvent, KeyboardPeripheralEvent, ModuleName, SuspiciousActivityEvent, WebPubModules } from "@readium/navigator-html-injectables";
|
|
5
|
+
import { BasicTextSelection, CommsEventKey, ContextMenuEvent, DecorationActivatedEvent, DecorationPointerEnterData, DecorationPointerLeaveData, 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
|
-
import { Decoration, DecorableNavigator,
|
|
8
|
+
import { Decoration, DecorableNavigator, OnDecorationActivatedEvent, OnDecorationPointerEnterEvent, OnDecorationPointerLeaveEvent, DecorationObserver, DecoratorConfig, decorationsEqual, resolveDecorationForWire, supportsDecorationStyle as canRenderDecorationStyle, DecorationStyleType } from "../decorations/index.ts";
|
|
9
9
|
import { ManagerEventKey } from "../epub/EpubNavigator.ts";
|
|
10
10
|
import { getScriptMode } from "../helpers/scriptMode.ts";
|
|
11
11
|
import { WebPubCSS } from "./css/WebPubCSS.ts";
|
|
@@ -33,6 +33,7 @@ export interface WebPubNavigatorConfiguration {
|
|
|
33
33
|
export interface WebPubNavigatorListeners {
|
|
34
34
|
frameLoaded: (wnd: Window) => void;
|
|
35
35
|
positionChanged: (locator: Locator) => void;
|
|
36
|
+
timelineItemChanged: (item: TimelineItem | undefined) => void;
|
|
36
37
|
tap: (e: FrameClickEvent) => boolean;
|
|
37
38
|
click: (e: FrameClickEvent) => boolean;
|
|
38
39
|
zoom: (scale: number) => void;
|
|
@@ -48,6 +49,7 @@ export interface WebPubNavigatorListeners {
|
|
|
48
49
|
const defaultListeners = (listeners: WebPubNavigatorListeners): WebPubNavigatorListeners => ({
|
|
49
50
|
frameLoaded: listeners.frameLoaded || (() => {}),
|
|
50
51
|
positionChanged: listeners.positionChanged || (() => {}),
|
|
52
|
+
timelineItemChanged: listeners.timelineItemChanged || (() => {}),
|
|
51
53
|
tap: listeners.tap || (() => false),
|
|
52
54
|
click: listeners.click || (() => false),
|
|
53
55
|
zoom: listeners.zoom || (() => {}),
|
|
@@ -67,6 +69,7 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
67
69
|
private framePool!: WebPubFramePoolManager;
|
|
68
70
|
private currentIndex: number = 0;
|
|
69
71
|
private currentLocation: Locator;
|
|
72
|
+
private _currentTimelineItem: TimelineItem | undefined;
|
|
70
73
|
|
|
71
74
|
private _preferences: WebPubPreferences;
|
|
72
75
|
private _defaults: WebPubDefaults;
|
|
@@ -86,7 +89,9 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
86
89
|
|
|
87
90
|
private _decorations: Map<string, Decoration[]> = new Map();
|
|
88
91
|
private _decorationObservers: Map<string, Set<DecorationObserver>> = new Map();
|
|
92
|
+
private _decorationHoveredDecorations: Map<string, Decoration> = new Map();
|
|
89
93
|
private _decorationActivationState: Map<string, boolean> = new Map();
|
|
94
|
+
private _decorationHoverState: Map<string, boolean> = new Map();
|
|
90
95
|
private _decorationActivationConsumed = false;
|
|
91
96
|
|
|
92
97
|
private webViewport: VisualNavigatorViewport = {
|
|
@@ -184,7 +189,11 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
184
189
|
cssProperties,
|
|
185
190
|
this._injector,
|
|
186
191
|
this._contentProtection,
|
|
187
|
-
this._keyboardPeripherals
|
|
192
|
+
this._keyboardPeripherals,
|
|
193
|
+
(href) => this.pub.timeline.segmentsForHref(href)
|
|
194
|
+
.flatMap(item => item.references)
|
|
195
|
+
.map(ref => { const h = ref.indexOf('#'); return h >= 0 ? ref.slice(h + 1) : ''; })
|
|
196
|
+
.filter(Boolean)
|
|
188
197
|
);
|
|
189
198
|
|
|
190
199
|
await this.apply();
|
|
@@ -264,6 +273,7 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
264
273
|
case "_pong":
|
|
265
274
|
this.listeners.frameLoaded(this.framePool.currentFrames[0]!.iframe.contentWindow!);
|
|
266
275
|
this.listeners.positionChanged(this.currentLocation);
|
|
276
|
+
this._notifyTimelineChange(this.currentLocation);
|
|
267
277
|
this._reapplyDecorationsToCurrentFrame();
|
|
268
278
|
break;
|
|
269
279
|
case "first_visible_locator":
|
|
@@ -277,6 +287,7 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
277
287
|
text: loc?.text
|
|
278
288
|
});
|
|
279
289
|
this.listeners.positionChanged(this.currentLocation);
|
|
290
|
+
this._notifyTimelineChange(this.currentLocation);
|
|
280
291
|
break;
|
|
281
292
|
case "text_selected": {
|
|
282
293
|
const selection = data as BasicTextSelection;
|
|
@@ -289,6 +300,12 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
289
300
|
if (handled) this._decorationActivationConsumed = true;
|
|
290
301
|
break;
|
|
291
302
|
}
|
|
303
|
+
case "decoration_pointer_enter":
|
|
304
|
+
this._handleDecorationPointerEnter(data as DecorationPointerEnterData);
|
|
305
|
+
break;
|
|
306
|
+
case "decoration_pointer_leave":
|
|
307
|
+
this._handleDecorationPointerLeave(data as DecorationPointerLeaveData);
|
|
308
|
+
break;
|
|
292
309
|
case "click":
|
|
293
310
|
case "tap":
|
|
294
311
|
if (this._decorationActivationConsumed) {
|
|
@@ -440,14 +457,15 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
440
457
|
await this.framePool?.destroy();
|
|
441
458
|
this._decorations.clear();
|
|
442
459
|
this._decorationObservers.clear();
|
|
460
|
+
this._decorationHoveredDecorations.clear();
|
|
443
461
|
this._decorationActivationState.clear();
|
|
462
|
+
this._decorationHoverState.clear();
|
|
444
463
|
}
|
|
445
464
|
|
|
446
465
|
// DecorableNavigator
|
|
447
466
|
|
|
448
|
-
public supportsDecorationStyle(styleTypeId: string): boolean {
|
|
449
|
-
return
|
|
450
|
-
!!this._decoratorConfig.decorationTemplates?.[styleTypeId];
|
|
467
|
+
public supportsDecorationStyle(styleTypeId: DecorationStyleType | string): boolean {
|
|
468
|
+
return canRenderDecorationStyle(styleTypeId, this._decoratorConfig.decorationTemplates);
|
|
451
469
|
}
|
|
452
470
|
|
|
453
471
|
public registerDecorationObserver(group: string, observer: DecorationObserver): void {
|
|
@@ -455,18 +473,32 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
455
473
|
this._decorationObservers.set(group, new Set());
|
|
456
474
|
this._decorationObservers.get(group)!.add(observer);
|
|
457
475
|
|
|
458
|
-
|
|
459
|
-
|
|
476
|
+
if (observer.onDecorationActivated) {
|
|
477
|
+
this._decorationActivationState.set(group, true);
|
|
478
|
+
this._sendDecorationActivatable(group, true);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
if (observer.onDecorationPointerEnter || observer.onDecorationPointerLeave) {
|
|
482
|
+
this._decorationHoverState.set(group, true);
|
|
483
|
+
this._sendDecorationHoverable(group, true);
|
|
484
|
+
}
|
|
460
485
|
}
|
|
461
486
|
|
|
462
487
|
public unregisterDecorationObserver(observer: DecorationObserver): void {
|
|
463
488
|
this._decorationObservers.forEach((set, group) => {
|
|
464
|
-
if (set.has(observer))
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
489
|
+
if (!set.has(observer)) return;
|
|
490
|
+
set.delete(observer);
|
|
491
|
+
|
|
492
|
+
const stillActivatable = [...set].some(o => o.onDecorationActivated);
|
|
493
|
+
if (this._decorationActivationState.has(group) && !stillActivatable) {
|
|
494
|
+
this._decorationActivationState.delete(group);
|
|
495
|
+
this._sendDecorationActivatable(group, false);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const stillHoverable = [...set].some(o => o.onDecorationPointerEnter || o.onDecorationPointerLeave);
|
|
499
|
+
if (this._decorationHoverState.has(group) && !stillHoverable) {
|
|
500
|
+
this._decorationHoverState.delete(group);
|
|
501
|
+
this._sendDecorationHoverable(group, false);
|
|
470
502
|
}
|
|
471
503
|
});
|
|
472
504
|
}
|
|
@@ -476,6 +508,11 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
476
508
|
if (frame?.msg) frame.msg.send("decoration_activatable", { group, activatable });
|
|
477
509
|
}
|
|
478
510
|
|
|
511
|
+
private _sendDecorationHoverable(group: string, hoverable: boolean): void {
|
|
512
|
+
const frame = this.framePool?.currentFrames[0];
|
|
513
|
+
if (frame?.msg) frame.msg.send("decoration_hoverable", { group, hoverable });
|
|
514
|
+
}
|
|
515
|
+
|
|
479
516
|
public applyDecorations(decorations: Decoration[], group: string): void {
|
|
480
517
|
const previous = this._decorations.get(group) ?? [];
|
|
481
518
|
const prevById = new Map(previous.map(d => [d.id, d]));
|
|
@@ -498,6 +535,8 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
498
535
|
|
|
499
536
|
const activatable = this._decorationActivationState.get(group);
|
|
500
537
|
if (activatable !== undefined) this._sendDecorationActivatable(group, activatable);
|
|
538
|
+
const hoverable = this._decorationHoverState.get(group);
|
|
539
|
+
if (hoverable !== undefined) this._sendDecorationHoverable(group, hoverable);
|
|
501
540
|
}
|
|
502
541
|
|
|
503
542
|
private _sendDecorationOps(
|
|
@@ -542,6 +581,9 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
542
581
|
for (const [group, activatable] of this._decorationActivationState) {
|
|
543
582
|
frame.msg.send("decoration_activatable", { group, activatable });
|
|
544
583
|
}
|
|
584
|
+
for (const [group, hoverable] of this._decorationHoverState) {
|
|
585
|
+
frame.msg.send("decoration_hoverable", { group, hoverable });
|
|
586
|
+
}
|
|
545
587
|
}
|
|
546
588
|
|
|
547
589
|
private _handleDecorationActivated(data: DecorationActivatedEvent): boolean {
|
|
@@ -551,13 +593,36 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
551
593
|
const decoration = (this._decorations.get(data.group) ?? []).find(d => d.id === data.decorationId);
|
|
552
594
|
if (!decoration) return false;
|
|
553
595
|
|
|
554
|
-
const event:
|
|
596
|
+
const event: OnDecorationActivatedEvent = { decoration, group: data.group, rect: data.rect, point: data.point };
|
|
555
597
|
let anyHandled = false;
|
|
556
598
|
for (const obs of observers)
|
|
557
|
-
if (obs.onDecorationActivated(event)) anyHandled = true;
|
|
599
|
+
if (obs.onDecorationActivated?.(event)) anyHandled = true;
|
|
558
600
|
return anyHandled;
|
|
559
601
|
}
|
|
560
602
|
|
|
603
|
+
private _handleDecorationPointerEnter(data: DecorationPointerEnterData): void {
|
|
604
|
+
const observers = this._decorationObservers.get(data.group);
|
|
605
|
+
if (!observers || observers.size === 0) return;
|
|
606
|
+
const decoration = (this._decorations.get(data.group) ?? []).find(d => d.id === data.decorationId);
|
|
607
|
+
if (!decoration) return;
|
|
608
|
+
this._decorationHoveredDecorations.set(data.group, decoration);
|
|
609
|
+
const event: OnDecorationPointerEnterEvent = { decoration, group: data.group, rect: data.rect, point: data.point };
|
|
610
|
+
for (const obs of observers)
|
|
611
|
+
obs.onDecorationPointerEnter?.(event);
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
private _handleDecorationPointerLeave(data: DecorationPointerLeaveData): void {
|
|
615
|
+
const observers = this._decorationObservers.get(data.group);
|
|
616
|
+
if (!observers || observers.size === 0) return;
|
|
617
|
+
const decoration = (this._decorations.get(data.group) ?? []).find(d => d.id === data.decorationId)
|
|
618
|
+
?? this._decorationHoveredDecorations.get(data.group);
|
|
619
|
+
this._decorationHoveredDecorations.delete(data.group);
|
|
620
|
+
if (!decoration) return;
|
|
621
|
+
const event: OnDecorationPointerLeaveEvent = { decoration, group: data.group, rect: data.rect, point: data.point };
|
|
622
|
+
for (const obs of observers)
|
|
623
|
+
obs.onDecorationPointerLeave?.(event);
|
|
624
|
+
}
|
|
625
|
+
|
|
561
626
|
// End of DecorableNavigator
|
|
562
627
|
|
|
563
628
|
private async changeResource(relative: number): Promise<boolean> {
|
|
@@ -604,6 +669,10 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
604
669
|
|
|
605
670
|
this.updateViewport(progression);
|
|
606
671
|
this.listeners.positionChanged(this.currentLocation);
|
|
672
|
+
const locatorForTimeline = progression.fragmentId
|
|
673
|
+
? this.currentLocation.copyWithLocations({ fragments: [`#${progression.fragmentId}`] })
|
|
674
|
+
: this.currentLocation;
|
|
675
|
+
this._notifyTimelineChange(locatorForTimeline);
|
|
607
676
|
await this.framePool.update(this.pub, this.currentLocation, this.determineModules());
|
|
608
677
|
}
|
|
609
678
|
|
|
@@ -663,9 +732,13 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
663
732
|
return this.pub;
|
|
664
733
|
}
|
|
665
734
|
|
|
735
|
+
get timeline(): Timeline {
|
|
736
|
+
return this.pub.timeline;
|
|
737
|
+
}
|
|
738
|
+
|
|
666
739
|
private async loadLocator(locator: Locator, cb: (ok: boolean) => void) {
|
|
667
740
|
let done = false;
|
|
668
|
-
let cssSelector = (
|
|
741
|
+
let cssSelector = getCssSelector(locator.locations);
|
|
669
742
|
if(locator.text?.highlight) {
|
|
670
743
|
done = await new Promise<boolean>((res, _) => {
|
|
671
744
|
// Attempt to go to a highlighted piece of text in the resource
|
|
@@ -697,7 +770,7 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
697
770
|
// This sanity check has to be performed because we're still passing non-locator class
|
|
698
771
|
// locator objects to this function. This is not good and should eventually be forbidden
|
|
699
772
|
// or the locator should be deserialized sometime before this function.
|
|
700
|
-
const hid = (
|
|
773
|
+
const hid = getHtmlId(locator.locations);
|
|
701
774
|
if(hid)
|
|
702
775
|
done = await new Promise<boolean>((res, _) => {
|
|
703
776
|
// Attempt to go to an HTML ID in the resource
|
|
@@ -778,6 +851,14 @@ export class WebPubNavigator extends VisualNavigator implements Configurable<Web
|
|
|
778
851
|
})
|
|
779
852
|
});
|
|
780
853
|
}
|
|
854
|
+
|
|
855
|
+
private _notifyTimelineChange(locator: Locator): void {
|
|
856
|
+
const item = this.timeline.locate(locator);
|
|
857
|
+
if (item !== this._currentTimelineItem) {
|
|
858
|
+
this._currentTimelineItem = item;
|
|
859
|
+
this.listeners.timelineItemChanged(item);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
781
862
|
}
|
|
782
863
|
|
|
783
864
|
export const ExperimentalWebPubNavigator = WebPubNavigator;
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
ensureExperiment
|
|
15
15
|
} from "../../preferences/guards.ts";
|
|
16
16
|
|
|
17
|
-
import { sMLWithRequest } from "@readium/
|
|
17
|
+
import { sMLWithRequest } from "@readium/helpers";
|
|
18
18
|
|
|
19
19
|
export interface IWebPubDefaults {
|
|
20
20
|
fontFamily?: string | null,
|
|
@@ -3,7 +3,7 @@ import { ExperimentKey, TextAlignment } from "../../preferences/Types.ts";
|
|
|
3
3
|
import { WebPubDefaults } from "./WebPubDefaults.ts";
|
|
4
4
|
import { WebPubPreferences } from "./WebPubPreferences.ts";
|
|
5
5
|
|
|
6
|
-
import { sMLWithRequest } from "@readium/
|
|
6
|
+
import { sMLWithRequest } from "@readium/helpers";
|
|
7
7
|
|
|
8
8
|
export interface IWebPubSettings {
|
|
9
9
|
fontFamily?: string | null,
|
package/types/src/Navigator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Link, Locator, Publication, ReadingProgression } from "@readium/shared";
|
|
1
|
+
import { Link, Locator, Publication, ReadingProgression, Timeline } from "@readium/shared";
|
|
2
2
|
import { ContentProtectionConfig, PrintProtectionConfig, KeyboardPeripheral, KeyboardPeripheralEvent } from "@readium/navigator-html-injectables";
|
|
3
3
|
type cbb = (ok: boolean) => void;
|
|
4
4
|
export interface KeyboardPeripheralEventData extends Omit<KeyboardPeripheralEvent, 'interactiveElement'> {
|
|
@@ -10,6 +10,7 @@ export type IKeyboardPeripheralsConfig = Array<Omit<KeyboardPeripheral, 'type'>
|
|
|
10
10
|
export interface ProgressionRange {
|
|
11
11
|
start: number;
|
|
12
12
|
end: number;
|
|
13
|
+
fragmentId?: string;
|
|
13
14
|
}
|
|
14
15
|
export interface VisualNavigatorViewport {
|
|
15
16
|
readingOrder: string[];
|
|
@@ -24,6 +25,7 @@ export interface IContentProtectionConfig extends ContentProtectionConfig {
|
|
|
24
25
|
export declare abstract class Navigator {
|
|
25
26
|
abstract get publication(): Publication;
|
|
26
27
|
abstract get currentLocator(): Locator;
|
|
28
|
+
abstract get timeline(): Timeline;
|
|
27
29
|
/**
|
|
28
30
|
* Moves to the position in the publication corresponding to the given {Locator}.
|
|
29
31
|
*/
|
|
@@ -1,60 +1,7 @@
|
|
|
1
|
-
import type { Decoration
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
* Navigator-level decoration template. `element` is a function called once per decoration to
|
|
6
|
-
* generate the HTML string that the injectable will render. The result is resolved on the
|
|
7
|
-
* navigator side (before postMessage) and sanitized by the injectable.
|
|
8
|
-
*/
|
|
9
|
-
export interface HTMLDecorationTemplate extends Omit<WireHTMLDecorationTemplate, 'element'> {
|
|
10
|
-
element: (decoration: Decoration) => string;
|
|
11
|
-
}
|
|
12
|
-
export type DecorationStyle = BuiltinDecorationStyle | HTMLDecorationTemplate;
|
|
13
|
-
export interface Decoration extends Omit<InjectableDecoration, 'style'> {
|
|
14
|
-
style: DecorationStyle;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Resolves a navigator-level Decoration to a wire-safe plain object for postMessage.
|
|
18
|
-
* For Template styles, calls `element(decoration)` and embeds the resulting HTML string.
|
|
19
|
-
* For registered custom style IDs (found in `decorationTemplates`), resolves the template
|
|
20
|
-
* and converts the style to a Template wire object.
|
|
21
|
-
*/
|
|
22
|
-
export declare function resolveDecorationForWire(decoration: Decoration, decorationTemplates?: Record<string, HTMLDecorationTemplate>): unknown;
|
|
23
|
-
export interface DecorationActivationEvent {
|
|
24
|
-
decoration: Decoration;
|
|
25
|
-
group: string;
|
|
26
|
-
/** Bounding rect of the activated decoration in navigator container coordinates (CSS pixels). */
|
|
27
|
-
rect?: {
|
|
28
|
-
top: number;
|
|
29
|
-
left: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
};
|
|
33
|
-
/** Tap/click point in navigator container coordinates (CSS pixels). */
|
|
34
|
-
point?: {
|
|
35
|
-
x: number;
|
|
36
|
-
y: number;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
export interface DecorationObserver {
|
|
40
|
-
/**
|
|
41
|
-
* Called when a user activates a decoration (click or tap).
|
|
42
|
-
* Return true to indicate the event was handled — this suppresses normal tap/click navigation.
|
|
43
|
-
*/
|
|
44
|
-
onDecorationActivated(event: DecorationActivationEvent): boolean;
|
|
45
|
-
}
|
|
46
|
-
export declare function decorationsEqual(a: Decoration, b: Decoration): boolean;
|
|
47
|
-
/** Configuration for decoration rendering. */
|
|
48
|
-
export interface DecoratorConfig {
|
|
49
|
-
/**
|
|
50
|
-
* Named custom styles. Each key is a style type ID; the value is the template that
|
|
51
|
-
* generates the HTML for decorations of that type. When a decoration's `style.type`
|
|
52
|
-
* matches a key here, the navigator resolves the template and sends it to the
|
|
53
|
-
* injectable as a Template-type decoration.
|
|
54
|
-
*/
|
|
55
|
-
decorationTemplates?: Record<string, HTMLDecorationTemplate>;
|
|
56
|
-
}
|
|
57
|
-
declare const BUILTIN_DECORATION_TYPES: Set<string>;
|
|
1
|
+
import type { Decoration, DecorationObserver } from "@readium/decorator";
|
|
2
|
+
import { DecorationStyleType } from "@readium/decorator";
|
|
3
|
+
export type { Decoration, DecorationStyle, HTMLDecorationTemplate, NamedDecorationStyle, BuiltinDecorationStyle, DecoratorConfig, OnDecorationActivatedEvent, OnDecorationPointerEnterEvent, OnDecorationPointerLeaveEvent, DecorationObserver, } from "@readium/decorator";
|
|
4
|
+
export { DecorationStyleType, DecorationLayout, DecorationWidth, BUILTIN_DECORATION_TYPES, resolveDecorationForWire, decorationsEqual, supportsDecorationStyle, } from "@readium/decorator";
|
|
58
5
|
export interface DecorableNavigator {
|
|
59
6
|
/**
|
|
60
7
|
* Replaces all decorations for the given group with the provided list.
|
|
@@ -66,10 +13,9 @@ export interface DecorableNavigator {
|
|
|
66
13
|
* Returns whether the given style type ID can be rendered by this navigator.
|
|
67
14
|
* Returns true for all built-in types and any IDs registered in DecoratorConfig.
|
|
68
15
|
*/
|
|
69
|
-
supportsDecorationStyle(styleTypeId: string): boolean;
|
|
16
|
+
supportsDecorationStyle(styleTypeId: DecorationStyleType | string): boolean;
|
|
70
17
|
/** Registers an observer for activation events on the given group. */
|
|
71
18
|
registerDecorationObserver(group: string, observer: DecorationObserver): void;
|
|
72
19
|
/** Unregisters a previously registered observer from all groups. */
|
|
73
20
|
unregisterDecorationObserver(observer: DecorationObserver): void;
|
|
74
21
|
}
|
|
75
|
-
export { BUILTIN_DECORATION_TYPES };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Layout, Link, Locator, Publication, ReadingProgression } from "@readium/shared";
|
|
1
|
+
import { Layout, Link, Locator, Publication, ReadingProgression, Timeline, TimelineItem } from "@readium/shared";
|
|
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
5
|
import { CommsEventKey, ContextMenuEvent, BasicTextSelection, FrameClickEvent, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
|
|
6
|
-
import { Decoration, DecorationObserver, DecorableNavigator, DecoratorConfig } from "../decorations/index.ts";
|
|
6
|
+
import { Decoration, DecorationObserver, DecorableNavigator, DecoratorConfig, DecorationStyleType } from "../decorations/index.ts";
|
|
7
7
|
import { FXLFrameManager } from "./fxl/FXLFrameManager.ts";
|
|
8
8
|
import { FrameManager } from "./frame/FrameManager.ts";
|
|
9
9
|
import { IEpubPreferences, EpubPreferences } from "./preferences/EpubPreferences.ts";
|
|
@@ -24,6 +24,7 @@ export interface EpubNavigatorConfiguration {
|
|
|
24
24
|
export interface EpubNavigatorListeners {
|
|
25
25
|
frameLoaded: (wnd: Window) => void;
|
|
26
26
|
positionChanged: (locator: Locator) => void;
|
|
27
|
+
timelineItemChanged: (item: TimelineItem | undefined) => void;
|
|
27
28
|
tap: (e: FrameClickEvent) => boolean;
|
|
28
29
|
click: (e: FrameClickEvent) => boolean;
|
|
29
30
|
zoom: (scale: number) => void;
|
|
@@ -43,6 +44,8 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
|
|
|
43
44
|
private framePool;
|
|
44
45
|
private positions;
|
|
45
46
|
private currentLocation;
|
|
47
|
+
private _currentTimelineItem;
|
|
48
|
+
private _timelineAugmented;
|
|
46
49
|
private lastLocationInView;
|
|
47
50
|
private currentProgression;
|
|
48
51
|
private _layout;
|
|
@@ -65,7 +68,9 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
|
|
|
65
68
|
private readonly _decoratorConfig;
|
|
66
69
|
private _decorations;
|
|
67
70
|
private _decorationObservers;
|
|
71
|
+
private _decorationHoveredDecorations;
|
|
68
72
|
private _decorationActivationState;
|
|
73
|
+
private _decorationHoverState;
|
|
69
74
|
private _decorationActivationConsumed;
|
|
70
75
|
private reflowViewport;
|
|
71
76
|
constructor(container: HTMLElement, pub: Publication, listeners: EpubNavigatorListeners, positions?: Locator[], initialPosition?: Locator | undefined, configuration?: EpubNavigatorConfiguration);
|
|
@@ -101,15 +106,18 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
|
|
|
101
106
|
private determineModules;
|
|
102
107
|
private attachListener;
|
|
103
108
|
private apply;
|
|
104
|
-
supportsDecorationStyle(styleTypeId: string): boolean;
|
|
109
|
+
supportsDecorationStyle(styleTypeId: DecorationStyleType | string): boolean;
|
|
105
110
|
registerDecorationObserver(group: string, observer: DecorationObserver): void;
|
|
106
111
|
unregisterDecorationObserver(observer: DecorationObserver): void;
|
|
107
112
|
private _sendDecorationActivationToFrames;
|
|
113
|
+
private _sendDecorationHoverToFrames;
|
|
108
114
|
applyDecorations(decorations: Decoration[], group: string): void;
|
|
109
115
|
private _sendDecorationOps;
|
|
110
116
|
private _reapplyDecorationsToFrame;
|
|
111
117
|
private _reapplyDecorationsToCurrentFrames;
|
|
112
118
|
private _handleDecorationActivated;
|
|
119
|
+
private _handleDecorationPointerEnter;
|
|
120
|
+
private _handleDecorationPointerLeave;
|
|
113
121
|
destroy(): Promise<void>;
|
|
114
122
|
private changeResource;
|
|
115
123
|
private findLastPositionInProgressionRange;
|
|
@@ -127,7 +135,9 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
|
|
|
127
135
|
get readingProgression(): ReadingProgression;
|
|
128
136
|
private setLayout;
|
|
129
137
|
get publication(): Publication;
|
|
138
|
+
get timeline(): Timeline;
|
|
130
139
|
private loadLocator;
|
|
131
140
|
go(locator: Locator, _: boolean, cb: (ok: boolean) => void): void;
|
|
132
141
|
goLink(link: Link, animated: boolean, cb: (ok: boolean) => void): void;
|
|
142
|
+
private _notifyTimelineChange;
|
|
133
143
|
}
|
|
@@ -2,6 +2,7 @@ import { Loader, ModuleName } from "@readium/navigator-html-injectables";
|
|
|
2
2
|
import { FrameComms } from "./FrameComms.ts";
|
|
3
3
|
import type { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
|
|
4
4
|
export declare class FrameManager {
|
|
5
|
+
private readonly timelineFragmentIds;
|
|
5
6
|
private frame;
|
|
6
7
|
private loader;
|
|
7
8
|
readonly source: string;
|
|
@@ -12,7 +13,7 @@ export declare class FrameManager {
|
|
|
12
13
|
private readonly keyboardPeripheralsConfig;
|
|
13
14
|
private conditionBridge?;
|
|
14
15
|
private currModules;
|
|
15
|
-
constructor(source: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig);
|
|
16
|
+
constructor(source: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, timelineFragmentIds?: string[]);
|
|
16
17
|
load(modules: ModuleName[]): Promise<Window>;
|
|
17
18
|
private applyContentProtection;
|
|
18
19
|
destroy(): Promise<void>;
|
|
@@ -16,9 +16,10 @@ export declare class FramePoolManager {
|
|
|
16
16
|
private readonly injector;
|
|
17
17
|
private readonly contentProtectionConfig;
|
|
18
18
|
private readonly keyboardPeripheralsConfig;
|
|
19
|
+
private readonly getFragmentIds;
|
|
19
20
|
constructor(container: HTMLElement, positions: Locator[], cssProperties?: {
|
|
20
21
|
[key: string]: string;
|
|
21
|
-
}, injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig);
|
|
22
|
+
}, injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, getFragmentIds?: (href: string) => string[]);
|
|
22
23
|
destroy(): Promise<void>;
|
|
23
24
|
update(pub: Publication, locator: Locator, modules: ModuleName[], force?: boolean): Promise<void>;
|
|
24
25
|
setCSSProperties(properties: {
|
|
@@ -47,7 +47,7 @@ export declare class FXLFramePoolManager {
|
|
|
47
47
|
private updateDimensions;
|
|
48
48
|
get rtl(): boolean;
|
|
49
49
|
private get single();
|
|
50
|
-
get perPage():
|
|
50
|
+
get perPage(): 2 | 1;
|
|
51
51
|
get threshold(): number;
|
|
52
52
|
get portrait(): boolean;
|
|
53
53
|
updateSpineStyle(animate: boolean, fast?: boolean): void;
|
|
@@ -2,6 +2,7 @@ import { Loader, ModuleName } from "@readium/navigator-html-injectables";
|
|
|
2
2
|
import { FrameComms } from "../epub/frame/FrameComms.ts";
|
|
3
3
|
import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
|
|
4
4
|
export declare class WebPubFrameManager {
|
|
5
|
+
private readonly timelineFragmentIds;
|
|
5
6
|
private frame;
|
|
6
7
|
private loader;
|
|
7
8
|
readonly source: string;
|
|
@@ -12,7 +13,7 @@ export declare class WebPubFrameManager {
|
|
|
12
13
|
private readonly keyboardPeripheralsConfig;
|
|
13
14
|
private conditionBridge?;
|
|
14
15
|
private currModules;
|
|
15
|
-
constructor(source: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig);
|
|
16
|
+
constructor(source: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, timelineFragmentIds?: string[]);
|
|
16
17
|
load(modules?: ModuleName[]): Promise<Window>;
|
|
17
18
|
private applyContentProtection;
|
|
18
19
|
destroy(): Promise<void>;
|
|
@@ -15,9 +15,10 @@ export declare class WebPubFramePoolManager {
|
|
|
15
15
|
private readonly injector?;
|
|
16
16
|
private readonly contentProtectionConfig;
|
|
17
17
|
private readonly keyboardPeripheralsConfig;
|
|
18
|
+
private readonly getFragmentIds;
|
|
18
19
|
constructor(container: HTMLElement, cssProperties?: {
|
|
19
20
|
[key: string]: string;
|
|
20
|
-
}, injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig);
|
|
21
|
+
}, injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, getFragmentIds?: (href: string) => string[]);
|
|
21
22
|
destroy(): Promise<void>;
|
|
22
23
|
update(pub: Publication, locator: Locator, modules: ModuleName[]): Promise<void>;
|
|
23
24
|
setCSSProperties(properties: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Link, Locator, Publication, ReadingProgression } from "@readium/shared";
|
|
1
|
+
import { Link, Locator, Publication, ReadingProgression, Timeline, TimelineItem } from "@readium/shared";
|
|
2
2
|
import { VisualNavigator, VisualNavigatorViewport, KeyboardPeripheralEventData } from "../Navigator.ts";
|
|
3
3
|
import { Configurable } from "../preferences/Configurable.ts";
|
|
4
4
|
import { BasicTextSelection, CommsEventKey, ContextMenuEvent, FrameClickEvent, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
|
|
5
5
|
import { WebPubFrameManager } from "./WebPubFrameManager.ts";
|
|
6
|
-
import { Decoration, DecorableNavigator, DecorationObserver, DecoratorConfig } from "../decorations/index.ts";
|
|
6
|
+
import { Decoration, DecorableNavigator, DecorationObserver, DecoratorConfig, DecorationStyleType } from "../decorations/index.ts";
|
|
7
7
|
import { ManagerEventKey } from "../epub/EpubNavigator.ts";
|
|
8
8
|
import { IWebPubPreferences, WebPubPreferences } from "./preferences/WebPubPreferences.ts";
|
|
9
9
|
import { IWebPubDefaults } from "./preferences/WebPubDefaults.ts";
|
|
@@ -22,6 +22,7 @@ export interface WebPubNavigatorConfiguration {
|
|
|
22
22
|
export interface WebPubNavigatorListeners {
|
|
23
23
|
frameLoaded: (wnd: Window) => void;
|
|
24
24
|
positionChanged: (locator: Locator) => void;
|
|
25
|
+
timelineItemChanged: (item: TimelineItem | undefined) => void;
|
|
25
26
|
tap: (e: FrameClickEvent) => boolean;
|
|
26
27
|
click: (e: FrameClickEvent) => boolean;
|
|
27
28
|
zoom: (scale: number) => void;
|
|
@@ -40,6 +41,7 @@ export declare class WebPubNavigator extends VisualNavigator implements Configur
|
|
|
40
41
|
private framePool;
|
|
41
42
|
private currentIndex;
|
|
42
43
|
private currentLocation;
|
|
44
|
+
private _currentTimelineItem;
|
|
43
45
|
private _preferences;
|
|
44
46
|
private _defaults;
|
|
45
47
|
private _settings;
|
|
@@ -56,7 +58,9 @@ export declare class WebPubNavigator extends VisualNavigator implements Configur
|
|
|
56
58
|
private readonly _decoratorConfig;
|
|
57
59
|
private _decorations;
|
|
58
60
|
private _decorationObservers;
|
|
61
|
+
private _decorationHoveredDecorations;
|
|
59
62
|
private _decorationActivationState;
|
|
63
|
+
private _decorationHoverState;
|
|
60
64
|
private _decorationActivationConsumed;
|
|
61
65
|
private webViewport;
|
|
62
66
|
constructor(container: HTMLElement, pub: Publication, listeners: WebPubNavigatorListeners, initialPosition?: Locator | undefined, configuration?: WebPubNavigatorConfiguration);
|
|
@@ -79,14 +83,17 @@ export declare class WebPubNavigator extends VisualNavigator implements Configur
|
|
|
79
83
|
private attachListener;
|
|
80
84
|
private apply;
|
|
81
85
|
destroy(): Promise<void>;
|
|
82
|
-
supportsDecorationStyle(styleTypeId: string): boolean;
|
|
86
|
+
supportsDecorationStyle(styleTypeId: DecorationStyleType | string): boolean;
|
|
83
87
|
registerDecorationObserver(group: string, observer: DecorationObserver): void;
|
|
84
88
|
unregisterDecorationObserver(observer: DecorationObserver): void;
|
|
85
89
|
private _sendDecorationActivatable;
|
|
90
|
+
private _sendDecorationHoverable;
|
|
86
91
|
applyDecorations(decorations: Decoration[], group: string): void;
|
|
87
92
|
private _sendDecorationOps;
|
|
88
93
|
private _reapplyDecorationsToCurrentFrame;
|
|
89
94
|
private _handleDecorationActivated;
|
|
95
|
+
private _handleDecorationPointerEnter;
|
|
96
|
+
private _handleDecorationPointerLeave;
|
|
90
97
|
private changeResource;
|
|
91
98
|
private updateViewport;
|
|
92
99
|
private syncLocation;
|
|
@@ -100,9 +107,11 @@ export declare class WebPubNavigator extends VisualNavigator implements Configur
|
|
|
100
107
|
get canGoForward(): boolean;
|
|
101
108
|
get readingProgression(): ReadingProgression;
|
|
102
109
|
get publication(): Publication;
|
|
110
|
+
get timeline(): Timeline;
|
|
103
111
|
private loadLocator;
|
|
104
112
|
go(locator: Locator, _: boolean, cb: (ok: boolean) => void): void;
|
|
105
113
|
goLink(link: Link, animated: boolean, cb: (ok: boolean) => void): void;
|
|
106
114
|
private createCurrentLocator;
|
|
115
|
+
private _notifyTimelineChange;
|
|
107
116
|
}
|
|
108
117
|
export declare const ExperimentalWebPubNavigator: typeof WebPubNavigator;
|
package/dist/ar-DyHX_uy2.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const e = { metadata: { accessibility: { "display-guide": { "accessibility-summary": { "no-metadata": "لا تتوفر أي معلومات", "publisher-contact": "لمزيد من المعلومات حول إمكانية الوصول إلى هذا المنتج، يُرجى التواصل مع الناشر: ", title: "ملخص إمكانية الوصول" }, "additional-accessibility-information": { aria: { compact: "أدوار ARIA مدرَجة", descriptive: "يتم تعزيز المحتوى باستخدام أدوار ARIA لتحسين التنظيم وتيسير التنقّل" }, "audio-descriptions": "الوصف الصوتي", braille: "برايل", "color-not-sole-means-of-conveying-information": "اللون ليس الوسيلة الوحيدة لنقل المعلومات", "dyslexia-readability": "سهولة القراءة لذوي عُسر القراءة", "full-ruby-annotations": "شروح روبي كاملة", "high-contrast-between-foreground-and-background-audio": "تباين عالٍ بين الصوت الرئيسي وصوت الخلفية", "high-contrast-between-text-and-background": "تباين عالٍ بين النص والخلفية", "large-print": "خط كبير", "page-breaks": { compact: "فواصل الصفحات متضمَّنة", descriptive: "فواصل الصفحات متضمَّنة من المصدر المطبوع الأصلي" }, "ruby-annotations": "بعض شروح الروبي", "sign-language": "لغة الإشارة", "tactile-graphics": { compact: "الرسوم اللمسية مدرجة", descriptive: "تم دمج الرسوم اللمسية لتيسير الوصول إلى العناصر البصرية للأشخاص المكفوفين" }, "tactile-objects": "مجسمات لمسية ثلاثية الأبعاد", "text-to-speech-hinting": "إرشادات تحويل النص إلى كلام (TTS)متوفرة", title: "معلومات إضافية عن إمكانية الوصول", "ultra-high-contrast-between-text-and-background": "تباين عالٍ جدًا بين النص والخلفية", "visible-page-numbering": "ترقيم صفحات مرئي", "without-background-sounds": "من دون أصوات في خلفية" }, conformance: { a: { compact: "هذا المنشور يفي بالمعايير الدنيا لإمكانية الوصول", descriptive: "يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى A من معيار WCAG 2" }, aa: { compact: "هذا المنشور يفي بالمعايير المعتمدة لإمكانية الوصول", descriptive: "يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى AA من معيار WCAG 2" }, aaa: { compact: "هذا المنشور يفوق المعايير المقبولة لإمكانية الوصول", descriptive: "يحتوي هذا المنشور على بيان مطابقة يفيد بأنه يفي بمعيار إمكانية الوصول في EPUB وبمستوى AAA من معيار WCAG 2" }, certifier: "تم اعتماد هذا المنشور من قبل ", "certifier-credentials": "بيانات اعتماد جهة التصديق ", details: { "certification-info": "تم اعتماد هذا المنشور في تاريخ ", "certifier-report": "لمزيد من المعلومات، يرجى الرجوع إلى تقرير جهة التصديق", claim: "يدّعي هذا المنشور أنه يستوفي", "epub-accessibility-1-0": "معيار إمكانية الوصول لـ EPUB إصدار 1.0", "epub-accessibility-1-1": "معيار إمكانية الوصول لـ EPUB إصدار 1.1", "level-a": "المستوى A", "level-aa": "المستوى AA", "level-aaa": "المستوى AAA", "wcag-2-0": { compact: "WCAG 2.0", descriptive: "مبادئ النفاذ إلى محتوى الويب (WCAG) 2.0" }, "wcag-2-1": { compact: "WCAG 2.1", descriptive: "مبادئ النفاذ إلى محتوى الويب (WCAG) 2.1" }, "wcag-2-2": { compact: "WCAG 2.2", descriptive: "مبادئ النفاذ إلى محتوى الويب (WCAG) 2.2" } }, "details-title": "معلومات تفصيلية عن مدى المطابقة", no: "لا تتوفر أي معلومات", title: "المطابقة", "unknown-standard": "لا يمكن التأكد من مدى مطابقة هذا المنشور للمعايير المقبولة لإمكانية الوصول" }, hazards: { flashing: { compact: "محتوى وامض", descriptive: "يحتوي هذا المنشور على محتوى وامض قد يسبب نوبات حساسة للضوء" }, "flashing-none": { compact: "لا توجد مخاطر وميض", descriptive: "لا يحتوي هذا المنشور على محتوى وامض قد يسبب نوبات حساسة للضوء" }, "flashing-unknown": { compact: "مخاطر الوميض غير معروفة", descriptive: "لم يُمكن التأكد من وجود محتوى وامض قد يسبب نوبات حساسية للضوء" }, motion: { compact: "محاكاة الحركة", descriptive: "يحتوي المنشور على محاكاة حركة قد تسبّب دوار الحركة" }, "motion-none": { compact: "لا توجد مخاطر محاكاة الحركة", descriptive: "لا يحتوي المنشور على محاكاة حركة قد تسبّب دوار الحركة" }, "motion-unknown": { compact: "مخاطر محاكاة الحركة غير معروفة", descriptive: "تعذّر تحديد ما إذا كانت هناك محاكاة للحركة قد تُسبب دوار الحركة" }, "no-metadata": "لا تتوفر أي معلومات", none: { compact: "لا توجد مخاطر", descriptive: "لا يحتوي المنشور على أي مخاطر" }, sound: { compact: "أصوات", descriptive: "يحتوي المنشور على أصوات قد تؤدي إلى مشاكل حساسية صوتية" }, "sound-none": { compact: "لا توجد مخاطر صوتية", descriptive: "لا يحتوي المنشور على أصوات قد تؤدي إلى مشاكل حساسية صوتية" }, "sound-unknown": { compact: "مخاطر الصوت غير معروفة", descriptive: "تعذّر تحديد ما إذا كانت هناك أصوات قد تُسبب مشكلات في الحساسية" }, title: "مخاطر", unknown: "وجود المخاطر غير معروف" }, "legal-considerations": { exempt: { compact: "يُعلن عن استثناء من متطلبات إمكانية الوصول من بعض السلطات القضائية", descriptive: "يُصرّح هذا المنشور بوجود استثناء من متطلبات إمكانية الوصول من بعض السلطات القضائية" }, "no-metadata": "لا تتوفر أي معلومات", title: "اعتبارات قانونية" }, navigation: { index: { compact: "كشاف", descriptive: "كشاف يحتوي على روابط إلى الإدخالات المشار إليها" }, "no-metadata": "لا تتوفر أي معلومات", "page-navigation": { compact: "الانتقال إلى صفحة", descriptive: "قائمة الصفحات للانتقال إلى صفحات من النسخة المطبوعة الأصلية" }, structural: { compact: "العناوين", descriptive: "عناصر مثل العناوين والجداول وغيرها للتنقل المنظّم" }, title: "التنقل", toc: { compact: "جدول المحتويات", descriptive: "جدول المحتويات لكل فصول النص عبر روابط" } }, "rich-content": { "accessible-chemistry-as-latex": { compact: "الصيغ الكيميائية بصيغة LaTeX", descriptive: "الصيغ الكيميائية بشكل ميسر (LaTeX)" }, "accessible-chemistry-as-mathml": { compact: "الصيغ الكيميائية بصيغة MathML", descriptive: "الصيغ الكيميائية بشكل ميسر (MathML)" }, "accessible-math-as-latex": { compact: "الرياضيات بصيغة LaTeX", descriptive: "الصيغ الرياضية بشكل ميسر (LaTeX)" }, "accessible-math-described": "تتوفر أوصاف نصية للصيغ الرياضية", "closed-captions": { compact: "تحتوي الفيديوهات على شروح مغلقة", descriptive: "الفيديوهات الموجودة في المنشورات تحتوي على شروح مغلقة" }, "extended-descriptions": "يتم وصف الصور الغنية بالمعلومات بأوصاف مفصّلة", "math-as-mathml": { compact: "الرياضيات بصيغة MathML", descriptive: "الصيغ الرياضية بشكل ميسر(MathML)" }, "open-captions": { compact: "تحتوي الفيديوهات على شروح مدمجة", descriptive: "الفيديوهات الموجودة في المنشورات تحتوي على شروح مدمجة" }, title: "محتوى غني", transcript: "يتوفر نص(نصوص)", unknown: "لا تتوفر أي معلومات" }, "ways-of-reading": { "nonvisual-reading": { "alt-text": { compact: "يحتوي على نص بديل", descriptive: "يحتوي على أوصاف نصية بديلة للصور" }, "no-metadata": "لا تتوفر معلومات عن القراءة غير البصرية", none: { compact: "غير قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية", descriptive: "المحتوى غير قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية" }, "not-fully": { compact: "غير قابل للقراءة بالكامل بصوتٍ عالٍ أو بطريقة برايل الديناميكية", descriptive: "لن يكون كل المحتوى قابلًا للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية" }, readable: { compact: "قابل للقراءة بصوتٍ عالٍ أو بطريقة برايل الديناميكية", descriptive: "يمكن قراءة كل المحتوى بصوتٍ عالٍ أو بطريقة برايل الديناميكية" } }, "prerecorded-audio": { complementary: { compact: "مقاطع الصوت المسجّلة مسبقًا", descriptive: "مقاطع الصوت المسجّلة مسبقًا مدمجة في المحتوى" }, "no-metadata": "لا توجد معلومات عن الصوت المسجّل مسبقًا", only: { compact: "الصوت المسجّل مسبقًا فقط", descriptive: "كتاب صوتي بدون بديل نصي" }, synchronized: { compact: "صوت مسجّل مسبقًا متزامن مع النص", descriptive: "كل المحتوى متوفر كصوت مسجّل مسبقًا متزامن مع النص" } }, title: "طرق القراءة", "visual-adjustments": { modifiable: { compact: "يمكن تعديل المظهر", descriptive: "يمكن تعديل مظهر النص وتخطيط الصفحة وفقاً لإمكانات نظام القراءة (اسم الخط وحجمه، والمسافات بين الفقرات والجمل والكلمات والأحرف، بالإضافة إلى لون الخلفية والنص)" }, unknown: "لا توجد معلومات عن إمكانية تعديل المظهر", unmodifiable: { compact: "لا يمكن تعديل المظهر", descriptive: "لا يمكن تعديل مظهر النص وتخطيط الصفحات لأن تجربة القراءة قريبة من النسخة المطبوعة، ولكن تطبيقات القراءة ما زالت تتيح خيارات التكبير" } } } } }, altIdentifier_one: "رمز تعريفي بديل", altIdentifier_other: "رموز تعريفية بديلة", artist_one: "فنان", artist_other: "فنانون", author_one: "مؤلف", author_other: "مؤلفون", collection_one: "سلسلة تحريرية", collection_other: "سلاسل تحريرية", colorist_one: "ملوّن الألوان", colorist_other: "ملوّنو الألوان", contributor_one: "مساهم", contributor_other: "مساهمون", description: "وصف", duration: "مدة", editor_one: "محرر", editor_other: "محررون", identifier_one: "رمز تعريفي", identifier_other: "رموز تعريفية", illustrator_one: "رسًام", illustrator_other: "رسامون", imprint_one: "العلامة التجارية للنشر", imprint_other: "العلامات التجارية للنشر", inker_one: "مُحَبِّر", inker_other: "مُحَبِّرون", language_one: "اللغة", language_other: "اللغات", letterer_one: "خطّاط", letterer_other: "خطّاطون", modified: "تاريخ التعديل", narrator_one: "قارئ صوتي", narrator_other: "قرّاء صوتيون", numberOfPages: "عدد الصفحات في النسخة المطبوعة", penciler_one: "رسّام أولي", penciler_other: "رسّامون أوّليون", published: "تاريخ النشر", publisher_one: "ناشر", publisher_other: "ناشرون", series_one: "سلسلة", series_other: "سلاسل", subject_one: "موضوع", subject_other: "مواضيع", subtitle: "عنوان فرعي", title: "العنوان", translator_one: "مترجم", translator_other: "مترجمون" } }, t = {
|
|
2
|
-
publication: e
|
|
3
|
-
};
|
|
4
|
-
export {
|
|
5
|
-
t as default,
|
|
6
|
-
e as publication
|
|
7
|
-
};
|