@readium/navigator 2.10.3 → 2.11.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.
Files changed (94) hide show
  1. package/dist/audio/AudioNavigator.js +1 -1
  2. package/dist/audio/AudioPoolManager.js +1 -1
  3. package/dist/audio/engine/WebAudioEngine.js +1 -1
  4. package/dist/divina/DivinaNavigator.js +1 -0
  5. package/dist/divina/DivinaPageManager.js +1 -0
  6. package/dist/divina/DivinaPagedPresenter.js +1 -0
  7. package/dist/divina/DivinaPeripherals.js +1 -0
  8. package/dist/divina/DivinaScrolledPresenter.js +1 -0
  9. package/dist/divina/DivinaSpreader.js +1 -0
  10. package/dist/divina/DivinaVariantSelector.js +1 -0
  11. package/dist/divina/preferences/DivinaDefaults.js +1 -0
  12. package/dist/divina/preferences/DivinaPreferences.js +1 -0
  13. package/dist/divina/preferences/DivinaPreferencesEditor.js +1 -0
  14. package/dist/divina/preferences/DivinaSettings.js +1 -0
  15. package/dist/divina/protection/DivinaNavigatorProtector.js +1 -0
  16. package/dist/epub/EpubNavigator.js +1 -1
  17. package/dist/epub/frame/FrameBlobBuilder.js +3 -1
  18. package/dist/epub/frame/FrameComms.js +1 -1
  19. package/dist/epub/frame/FrameManager.js +1 -1
  20. package/dist/epub/frame/FramePoolManager.js +1 -1
  21. package/dist/epub/fxl/FXLFrameManager.js +1 -1
  22. package/dist/epub/fxl/FXLFramePoolManager.js +1 -1
  23. package/dist/epub/fxl/FXLPeripherals.js +2 -2
  24. package/dist/helpers/serialize.js +1 -0
  25. package/dist/index.js +1 -1
  26. package/dist/peripherals/KeyboardConditionBridge.js +1 -1
  27. package/dist/peripherals/KeyboardPeripherals.js +1 -1
  28. package/dist/webpub/WebPubFrameManager.js +1 -1
  29. package/dist/webpub/WebPubFramePoolManager.js +1 -1
  30. package/dist/webpub/WebPubNavigator.js +1 -1
  31. package/package.json +5 -5
  32. package/src/audio/AudioNavigator.ts +107 -5
  33. package/src/audio/AudioPoolManager.ts +14 -8
  34. package/src/audio/engine/AudioEngine.ts +34 -1
  35. package/src/audio/engine/WebAudioEngine.ts +48 -3
  36. package/src/divina/DivinaNavigator.ts +704 -0
  37. package/src/divina/DivinaPageManager.ts +322 -0
  38. package/src/divina/DivinaPagedPresenter.ts +508 -0
  39. package/src/divina/DivinaPeripherals.ts +630 -0
  40. package/src/divina/DivinaScrolledPresenter.ts +516 -0
  41. package/src/divina/DivinaSpreader.ts +202 -0
  42. package/src/divina/DivinaVariantSelector.ts +77 -0
  43. package/src/divina/index.ts +8 -0
  44. package/src/divina/preferences/DivinaDefaults.ts +37 -0
  45. package/src/divina/preferences/DivinaPreferences.ts +77 -0
  46. package/src/divina/preferences/DivinaPreferencesEditor.ts +96 -0
  47. package/src/divina/preferences/DivinaSettings.ts +38 -0
  48. package/src/divina/preferences/index.ts +4 -0
  49. package/src/divina/protection/DivinaNavigatorProtector.ts +44 -0
  50. package/src/epub/EpubNavigator.ts +73 -7
  51. package/src/epub/frame/FrameBlobBuilder.ts +144 -39
  52. package/src/epub/frame/FrameComms.ts +42 -7
  53. package/src/epub/frame/FrameManager.ts +27 -16
  54. package/src/epub/frame/FramePoolManager.ts +106 -48
  55. package/src/epub/fxl/FXLFrameManager.ts +99 -34
  56. package/src/epub/fxl/FXLFramePoolManager.ts +98 -53
  57. package/src/epub/fxl/FXLPeripherals.ts +22 -1
  58. package/src/helpers/serialize.ts +9 -0
  59. package/src/index.ts +1 -0
  60. package/src/peripherals/KeyboardConditionBridge.ts +15 -5
  61. package/src/peripherals/KeyboardPeripherals.ts +13 -7
  62. package/src/webpub/WebPubFrameManager.ts +27 -16
  63. package/src/webpub/WebPubFramePoolManager.ts +5 -2
  64. package/src/webpub/WebPubNavigator.ts +44 -0
  65. package/types/src/audio/AudioNavigator.d.ts +29 -0
  66. package/types/src/audio/engine/AudioEngine.d.ts +27 -1
  67. package/types/src/audio/engine/WebAudioEngine.d.ts +14 -2
  68. package/types/src/divina/DivinaNavigator.d.ts +119 -0
  69. package/types/src/divina/DivinaPageManager.d.ts +66 -0
  70. package/types/src/divina/DivinaPagedPresenter.d.ts +122 -0
  71. package/types/src/divina/DivinaPeripherals.d.ts +121 -0
  72. package/types/src/divina/DivinaScrolledPresenter.d.ts +125 -0
  73. package/types/src/divina/DivinaSpreader.d.ts +65 -0
  74. package/types/src/divina/DivinaVariantSelector.d.ts +30 -0
  75. package/types/src/divina/index.d.ts +8 -0
  76. package/types/src/divina/preferences/DivinaDefaults.d.ts +18 -0
  77. package/types/src/divina/preferences/DivinaPreferences.d.ts +33 -0
  78. package/types/src/divina/preferences/DivinaPreferencesEditor.d.ts +20 -0
  79. package/types/src/divina/preferences/DivinaSettings.d.ts +26 -0
  80. package/types/src/divina/preferences/index.d.ts +4 -0
  81. package/types/src/divina/protection/DivinaNavigatorProtector.d.ts +14 -0
  82. package/types/src/epub/EpubNavigator.d.ts +7 -1
  83. package/types/src/epub/frame/FrameBlobBuilder.d.ts +19 -3
  84. package/types/src/epub/frame/FrameComms.d.ts +8 -1
  85. package/types/src/epub/frame/FrameManager.d.ts +3 -0
  86. package/types/src/epub/frame/FramePoolManager.d.ts +5 -1
  87. package/types/src/epub/fxl/FXLFrameManager.d.ts +7 -0
  88. package/types/src/epub/fxl/FXLFramePoolManager.d.ts +8 -2
  89. package/types/src/epub/fxl/FXLPeripherals.d.ts +3 -0
  90. package/types/src/helpers/serialize.d.ts +1 -0
  91. package/types/src/index.d.ts +1 -0
  92. package/types/src/peripherals/KeyboardPeripherals.d.ts +1 -0
  93. package/types/src/webpub/WebPubFrameManager.d.ts +3 -0
  94. package/types/src/webpub/WebPubNavigator.d.ts +2 -0
@@ -0,0 +1,125 @@
1
+ import { VisualNavigatorViewport } from "../Navigator.ts";
2
+ import { DivinaPageManager } from "./DivinaPageManager.ts";
3
+ import { DivinaSpreader } from "./DivinaSpreader.ts";
4
+ export type DivinaScrolledEventKey = "scroll" | "position" | "tap" | "click";
5
+ export type DivinaScrolledListener = (key: DivinaScrolledEventKey, data: unknown) => void;
6
+ /**
7
+ * Vertical scrolled ("webtoon") presenter for Divina publications: all pages
8
+ * stacked in a native scroll container with no gaps, constrained to a
9
+ * configurable strip width, based on xbreader but improved
10
+ *
11
+ * Page offsets are cached and looked up with binary search so per-frame
12
+ * scroll work stays constant regardless of publication size.
13
+ */
14
+ export declare class DivinaScrolledPresenter {
15
+ private readonly container;
16
+ private readonly spreader;
17
+ private readonly pool;
18
+ readonly scrollerElement: HTMLDivElement;
19
+ private stripWidth;
20
+ private destroyed;
21
+ private scrollRAF;
22
+ private restoreRAF;
23
+ private positionTimer;
24
+ private lastScrollTop;
25
+ /** Position within the strip as a fraction of total strip height (resize retention) */
26
+ private fraction;
27
+ private pageTops;
28
+ private pageHeights;
29
+ private stripHeightCached;
30
+ private viewportHeightCached;
31
+ private loadedIndices;
32
+ private lastWindowIndex;
33
+ private programmaticScroll;
34
+ private programmaticTimer;
35
+ private scrollTarget;
36
+ private animating;
37
+ private animRAF;
38
+ private animLastTime;
39
+ listener: DivinaScrolledListener;
40
+ constructor(container: HTMLElement, spreader: DivinaSpreader, pool: Map<number, DivinaPageManager>, stripWidth: number);
41
+ private readonly bscrollHandler;
42
+ private readonly bscrollendHandler;
43
+ private readonly banimStep;
44
+ private readonly buserTakeoverHandler;
45
+ private readonly bmousedownHandler;
46
+ private readonly bclickHandler;
47
+ private readonly btouchendHandler;
48
+ private readonly btouchstartHandler;
49
+ /** Display width of each page in the strip */
50
+ private get displayWidth();
51
+ /**
52
+ * Recomputes the cached page offsets and viewport metrics.
53
+ * Cheap relative to the per-frame layout reads it replaces, but still a
54
+ * forced layout: only call after actual layout changes.
55
+ */
56
+ private refreshLayoutCache;
57
+ /** The index of the last page whose top is at or above the given strip offset */
58
+ private indexAtOffset;
59
+ applyStripWidth(stripWidth: number): void;
60
+ private restoreFraction;
61
+ private updateFraction;
62
+ /** Top offset in pixels of the given page within the strip */
63
+ private pageTop;
64
+ private pageHeight;
65
+ /**
66
+ * The reading-order index of the current page: the last page whose top
67
+ * is above the middle of the viewport.
68
+ */
69
+ get currentIndex(): number;
70
+ /** Progression within the current page (0..1) */
71
+ get currentPageProgression(): number;
72
+ /**
73
+ * Marks the start of a programmatic scroll: "scroll" events are not
74
+ * reported to the host until the scroll settles (scrollend or timeout),
75
+ * so navigation doesn't masquerade as user scrolling.
76
+ */
77
+ private beginProgrammaticScroll;
78
+ private scrollendHandler;
79
+ /** Load the window around wherever the scroll settled */
80
+ private settleWindow;
81
+ /** Direct user input takes over any in-flight programmatic scroll */
82
+ private userTakeoverHandler;
83
+ private scrollHandler;
84
+ /** Load nearby pages, unload distant ones */
85
+ private updateWindow;
86
+ private touchStartY;
87
+ private lastTouchEnd;
88
+ private touchstartHandler;
89
+ private touchendHandler;
90
+ private mouseDownPos;
91
+ private mousedownHandler;
92
+ private clickHandler;
93
+ private emitPointer;
94
+ /**
95
+ * Scroll forward/backward by a fraction of the viewport.
96
+ * Repeated calls chain from the pending target, so rapid key presses
97
+ * (including autorepeat from a held key) extend one animation that keeps
98
+ * cruising instead of restarting; the target is clamped to stay within
99
+ * reach of the position so releasing the key stops promptly rather than
100
+ * replaying the queued distance.
101
+ * @returns whether scrolling was possible
102
+ */
103
+ next(animated?: boolean, stepPx?: number): boolean;
104
+ prev(animated?: boolean, stepPx?: number): boolean;
105
+ private scrollToTarget;
106
+ /**
107
+ * One frame of the owned scroll animation: exponential approach toward
108
+ * the (re)targetable scrollTarget, capped at a cruise speed. Under a held
109
+ * key the cap dominates and the scroll advances at constant speed; once
110
+ * input stops the exponential term eases it out into the target.
111
+ */
112
+ private animStep;
113
+ private stopAnimation;
114
+ /**
115
+ * Go to the top of a page, optionally at a progression within it.
116
+ * @returns whether the position changed
117
+ */
118
+ goToItem(itemIndex: number, animated?: boolean, progression?: number): boolean;
119
+ update(): Promise<void>;
120
+ get atStart(): boolean;
121
+ get atEnd(): boolean;
122
+ get viewport(): VisualNavigatorViewport;
123
+ resizeHandler(): void;
124
+ destroy(): Promise<void>;
125
+ }
@@ -0,0 +1,65 @@
1
+ import { Link, Page, Publication } from "@readium/shared";
2
+ /**
3
+ * A single page of a Divina publication, with its resolved layout properties.
4
+ * Unlike FXLSpreader, this model never mutates the publication's links.
5
+ */
6
+ export declare class DivinaPage {
7
+ readonly link: Link;
8
+ readonly index: number;
9
+ page: Page;
10
+ isLandscape: boolean;
11
+ addBlank: boolean;
12
+ constructor(link: Link, index: number);
13
+ /** 1-based page number */
14
+ get number(): number;
15
+ get authoredPage(): Page | undefined;
16
+ /** Whether this page occupies both slots of a spread in double-page mode */
17
+ get double(): boolean;
18
+ }
19
+ /**
20
+ * Computes synthetic spreads for a Divina publication from the `page`
21
+ * (left/right/center) link properties, falling back to computed alternation.
22
+ *
23
+ * Slot model (used by the paged presenter): in double-page mode every spread
24
+ * occupies exactly two slots — a pair is 1+1, and a lone page (center,
25
+ * landscape or orphaned/addBlank) takes a double-width slot. This keeps
26
+ * slide indices (always even) aligned with spread boundaries.
27
+ */
28
+ export declare class DivinaSpreader {
29
+ readonly rtl: boolean;
30
+ shift: boolean;
31
+ pages: DivinaPage[];
32
+ spreads: DivinaPage[][];
33
+ private itemToSlotArr;
34
+ private slotToItemArr;
35
+ private spreadOfItemArr;
36
+ constructor(publication: Publication);
37
+ private index;
38
+ private testShift;
39
+ private buildSpreads;
40
+ /**
41
+ * Builds the item <-> slot mappings for double-page mode.
42
+ * Slots are consumed in spread order; every spread takes exactly two slots.
43
+ */
44
+ private buildSlots;
45
+ /** Total number of slots (spread mode). Always even. */
46
+ get slotCount(): number;
47
+ /** Count of pages that take a double-width slot in spread mode */
48
+ get nDouble(): number;
49
+ slotOfItem(itemIndex: number): number;
50
+ itemOfSlot(slot: number): number;
51
+ spreadIndexOfItem(itemIndex: number): number;
52
+ spreadOfItem(itemIndex: number): DivinaPage[];
53
+ /**
54
+ * Whether the page occupies a full spread on its own in double-page mode
55
+ * (and therefore takes a double-width slot). This mirrors buildSlots()
56
+ * exactly: any page alone in its spread is double.
57
+ */
58
+ isDouble(itemIndex: number): boolean;
59
+ findByHref(href: string): DivinaPage | undefined;
60
+ /**
61
+ * The position of a page within a spread, viewport-wise:
62
+ * left/right of the gutter, or centered when displayed alone.
63
+ */
64
+ spreadPosition(spread: DivinaPage[], target: DivinaPage, perPage: number): Page;
65
+ }
@@ -0,0 +1,30 @@
1
+ import { Link } from "@readium/shared";
2
+ /**
3
+ * User-selectable image quality for publications that provide alternate
4
+ * resolutions of their pages (RWPM `alternate` links).
5
+ */
6
+ export declare enum DivinaQuality {
7
+ auto = "auto",// Match the display resolution
8
+ low = "low",// Smallest available variant
9
+ high = "high",// One step above the display resolution
10
+ max = "max"
11
+ }
12
+ export declare const MOBILE_MAX_HEIGHT = 2560;
13
+ export declare const MOBILE_MAX_WIDTH = 1800;
14
+ /** The link itself and its (bitmap) alternates, if any */
15
+ export declare function gatherVariants(item: Link): Link[];
16
+ export interface VariantSelectionOptions {
17
+ /** Display size of the page in device pixels (CSS box × devicePixelRatio) */
18
+ targetWidth: number;
19
+ targetHeight: number;
20
+ /** The axis that constrains the display: height in paged mode, width in scrolled mode */
21
+ axis: "width" | "height";
22
+ quality: DivinaQuality;
23
+ }
24
+ /**
25
+ * Selects the most appropriate variant of a page image for the current
26
+ * display, based purely on the choices the manifest offers: the smallest
27
+ * variant that covers the display resolution (in device pixels), biased by
28
+ * the quality preference, and capped on mobile devices.
29
+ */
30
+ export declare function selectVariant(item: Link, opts: VariantSelectionOptions): Link;
@@ -0,0 +1,8 @@
1
+ export * from "./DivinaNavigator.ts";
2
+ export * from "./DivinaSpreader.ts";
3
+ export * from "./DivinaPageManager.ts";
4
+ export * from "./DivinaPagedPresenter.ts";
5
+ export * from "./DivinaScrolledPresenter.ts";
6
+ export * from "./DivinaPeripherals.ts";
7
+ export * from "./DivinaVariantSelector.ts";
8
+ export * from "./preferences/index.ts";
@@ -0,0 +1,18 @@
1
+ import { DivinaQuality } from "../DivinaVariantSelector.ts";
2
+ export interface IDivinaDefaults {
3
+ backgroundColor?: string | null;
4
+ constraint?: number | null;
5
+ quality?: DivinaQuality | null;
6
+ scrolled?: boolean | null;
7
+ spreads?: boolean | null;
8
+ stripWidth?: number | null;
9
+ }
10
+ export declare class DivinaDefaults {
11
+ backgroundColor: string | null;
12
+ constraint: number;
13
+ quality: DivinaQuality;
14
+ scrolled: boolean | null;
15
+ spreads: boolean;
16
+ stripWidth: number;
17
+ constructor(defaults: IDivinaDefaults);
18
+ }
@@ -0,0 +1,33 @@
1
+ import { ConfigurablePreferences } from "../../preferences/Configurable.ts";
2
+ import { RangeConfig } from "../../preferences/Types.ts";
3
+ import { DivinaQuality } from "../DivinaVariantSelector.ts";
4
+ /**
5
+ * Maximum width in pixels of the vertical strip in scrolled mode.
6
+ */
7
+ export declare const stripWidthRangeConfig: RangeConfig;
8
+ export interface IDivinaPreferences {
9
+ /** Background color behind the pages (equivalent of the EPUB page background theme) */
10
+ backgroundColor?: string | null;
11
+ /** Number of pixels to constrain the container width by (e.g. for docked panels) */
12
+ constraint?: number | null;
13
+ /** Image quality when the publication offers alternate resolutions */
14
+ quality?: DivinaQuality | null;
15
+ /** Display the publication as a vertical scroll instead of horizontal pages */
16
+ scrolled?: boolean | null;
17
+ /** Display two pages side-by-side on landscape viewports (paged mode only) */
18
+ spreads?: boolean | null;
19
+ /** Maximum width in pixels of the vertical strip in scrolled mode */
20
+ stripWidth?: number | null;
21
+ }
22
+ export declare class DivinaPreferences implements ConfigurablePreferences<DivinaPreferences> {
23
+ backgroundColor?: string | null;
24
+ constraint?: number | null;
25
+ quality?: DivinaQuality | null;
26
+ scrolled?: boolean | null;
27
+ spreads?: boolean | null;
28
+ stripWidth?: number | null;
29
+ constructor(preferences?: IDivinaPreferences);
30
+ static serialize(preferences: DivinaPreferences): string;
31
+ static deserialize(preferences: string): DivinaPreferences | null;
32
+ merging(other: DivinaPreferences): DivinaPreferences;
33
+ }
@@ -0,0 +1,20 @@
1
+ import { Metadata } from "@readium/shared";
2
+ import { IPreferencesEditor } from "../../preferences/PreferencesEditor.ts";
3
+ import { BooleanPreference, EnumPreference, Preference, RangePreference } from "../../preferences/Preference.ts";
4
+ import { DivinaQuality } from "../DivinaVariantSelector.ts";
5
+ import { DivinaPreferences } from "./DivinaPreferences.ts";
6
+ import { DivinaSettings } from "./DivinaSettings.ts";
7
+ export declare class DivinaPreferencesEditor implements IPreferencesEditor {
8
+ preferences: DivinaPreferences;
9
+ private settings;
10
+ private metadata;
11
+ constructor(initialPreferences: DivinaPreferences, settings: DivinaSettings, metadata: Metadata);
12
+ clear(): void;
13
+ private updatePreference;
14
+ private get manifestScrolled();
15
+ get backgroundColor(): Preference<string>;
16
+ get quality(): EnumPreference<DivinaQuality>;
17
+ get scrolled(): BooleanPreference;
18
+ get spreads(): BooleanPreference;
19
+ get stripWidth(): RangePreference<number>;
20
+ }
@@ -0,0 +1,26 @@
1
+ import { ConfigurableSettings } from "../../preferences/Configurable.ts";
2
+ import { DivinaQuality } from "../DivinaVariantSelector.ts";
3
+ import { DivinaDefaults } from "./DivinaDefaults.ts";
4
+ import { DivinaPreferences } from "./DivinaPreferences.ts";
5
+ export interface IDivinaSettings {
6
+ backgroundColor?: string | null;
7
+ constraint?: number | null;
8
+ quality?: DivinaQuality | null;
9
+ scrolled?: boolean | null;
10
+ spreads?: boolean | null;
11
+ stripWidth?: number | null;
12
+ }
13
+ export declare class DivinaSettings implements ConfigurableSettings {
14
+ backgroundColor: string | null;
15
+ constraint: number;
16
+ quality: DivinaQuality;
17
+ scrolled: boolean;
18
+ spreads: boolean;
19
+ stripWidth: number;
20
+ /**
21
+ * @param manifestScrolled Whether the publication itself declares `layout: scrolled`.
22
+ * A natively scrolled publication (e.g. webtoon) cannot be switched to paged mode,
23
+ * while a fixed publication can be switched to scrolled by the user.
24
+ */
25
+ constructor(preferences: DivinaPreferences, defaults: DivinaDefaults, manifestScrolled: boolean);
26
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./DivinaDefaults.ts";
2
+ export * from "./DivinaPreferences.ts";
3
+ export * from "./DivinaPreferencesEditor.ts";
4
+ export * from "./DivinaSettings.ts";
@@ -0,0 +1,14 @@
1
+ import { NavigatorProtector } from "../../protection/NavigatorProtector.ts";
2
+ import { IContentProtectionConfig } from "../../Navigator.ts";
3
+ /**
4
+ * Content protection for the Divina navigator. Because Divina renders images
5
+ * directly in the host DOM (no iframes), the in-frame halves of the EPUB
6
+ * protection (copy and drag-and-drop blocking) must run host-side instead,
7
+ * like the audio navigator does.
8
+ */
9
+ export declare class DivinaNavigatorProtector extends NavigatorProtector {
10
+ private dragAndDropProtector?;
11
+ private copyProtector?;
12
+ constructor(config?: IContentProtectionConfig);
13
+ destroy(): void;
14
+ }
@@ -12,6 +12,8 @@ import { EpubSettings } from "./preferences/index.ts";
12
12
  import { EpubPreferencesEditor } from "./preferences/EpubPreferencesEditor.ts";
13
13
  import { IInjectablesConfig } from "../injection/Injectable.ts";
14
14
  import { IContentProtectionConfig, IKeyboardPeripheralsConfig, KeyboardPeripheralEventData } from "../Navigator.ts";
15
+ import { UpgradeInsecureRequests } from "./frame/FrameBlobBuilder.ts";
16
+ export type { UpgradeInsecureRequests };
15
17
  export type ManagerEventKey = "zoom";
16
18
  export interface EpubNavigatorConfiguration {
17
19
  preferences: IEpubPreferences;
@@ -20,6 +22,7 @@ export interface EpubNavigatorConfiguration {
20
22
  contentProtection?: IContentProtectionConfig;
21
23
  keyboardPeripherals?: IKeyboardPeripheralsConfig;
22
24
  decoratorConfig?: DecoratorConfig;
25
+ upgradeInsecureRequests?: UpgradeInsecureRequests;
23
26
  }
24
27
  export interface EpubNavigatorListeners {
25
28
  frameLoaded: (wnd: Window) => void;
@@ -42,6 +45,7 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
42
45
  private readonly container;
43
46
  private readonly listeners;
44
47
  private framePool;
48
+ private _destroyed;
45
49
  private positions;
46
50
  private currentLocation;
47
51
  private _currentTimelineItem;
@@ -63,6 +67,7 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
63
67
  private readonly _injectablesConfig;
64
68
  private readonly _contentProtection;
65
69
  private readonly _keyboardPeripherals;
70
+ private readonly _upgradeInsecureRequests;
66
71
  private readonly _navigatorProtector;
67
72
  private readonly _keyboardPeripheralsManager;
68
73
  private readonly _suspiciousActivityListener;
@@ -79,7 +84,7 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
79
84
  private reflowViewport;
80
85
  constructor(container: HTMLElement, pub: Publication, listeners: EpubNavigatorListeners, positions?: Locator[], initialPosition?: Locator | undefined, configuration?: EpubNavigatorConfiguration);
81
86
  static determineLayout(pub: Publication, scroll?: boolean): Layout;
82
- load(): Promise<void>;
87
+ load(): Promise<unknown>;
83
88
  get settings(): Readonly<EpubSettings>;
84
89
  get preferencesEditor(): EpubPreferencesEditor;
85
90
  submitPreferences(preferences: EpubPreferences): Promise<void>;
@@ -143,6 +148,7 @@ export declare class EpubNavigator extends VisualNavigator implements Configurab
143
148
  get publication(): Publication;
144
149
  get timeline(): Timeline;
145
150
  private loadLocator;
151
+ private completeLocator;
146
152
  go(locator: Locator, _: boolean, cb: (ok: boolean) => void): void;
147
153
  goLink(link: Link, animated: boolean, cb: (ok: boolean) => void): void;
148
154
  private _notifyTimelineChange;
@@ -1,18 +1,34 @@
1
1
  import { Link, Publication } from "@readium/shared";
2
2
  import { Injector } from "../../injection/Injector.ts";
3
- export default class FrameBlobBuider {
4
- private readonly item;
5
- private readonly burl;
3
+ /**
4
+ * A flag to control whether `upgrade-insecure-requests` is included in the Content
5
+ * Security Policy of each spine-item blob frame:
6
+ *
7
+ * - `always` will always upgrade insecure requests
8
+ * - `never` will never upgrade insecure requests
9
+ * - `auto` will upgrade insecure requests only when the publication root URL is HTTPS
10
+ */
11
+ export type UpgradeInsecureRequests = 'always' | 'never' | 'auto';
12
+ export default class FrameBlobBuilder {
6
13
  private readonly pub;
14
+ private readonly baseURL;
15
+ private readonly item;
7
16
  private readonly cssProperties?;
8
17
  private readonly injector;
18
+ private readonly upgradeInsecureRequests;
19
+ private currentUrl?;
20
+ private currentResource?;
21
+ private pendingBuild?;
9
22
  constructor(pub: Publication, baseURL: string, item: Link, options: {
10
23
  cssProperties?: {
11
24
  [key: string]: string;
12
25
  };
13
26
  injector?: Injector | null;
27
+ upgradeInsecureRequests?: UpgradeInsecureRequests;
14
28
  });
29
+ reset(): void;
15
30
  build(fxl?: boolean): Promise<string>;
31
+ private doBuild;
16
32
  private buildHtmlFrame;
17
33
  private buildImageFrame;
18
34
  private setProperties;
@@ -4,15 +4,22 @@ export type FrameCommsListener = (key: CommsEventKey | ManagerEventKey, value: u
4
4
  export declare class FrameComms {
5
5
  private readonly wnd;
6
6
  private readonly registry;
7
- private readonly gc;
7
+ private gc;
8
8
  private readonly origin;
9
9
  readonly channelId: string;
10
10
  private _ready;
11
11
  private _listener;
12
12
  private listenerBuffer;
13
+ private visibleTime;
14
+ private visibleSince;
13
15
  set listener(listener: FrameCommsListener);
14
16
  clearListener(): void;
15
17
  constructor(wnd: Window, origin: string);
18
+ private startGc;
19
+ private stopGc;
20
+ private visibleNow;
21
+ private handleVisibility;
22
+ private visibilityHandler;
16
23
  halt(): void;
17
24
  resume(): void;
18
25
  private handle;
@@ -15,6 +15,7 @@ export declare class FrameManager {
15
15
  private pendingUnwatchSelectors;
16
16
  private conditionBridge?;
17
17
  private currModules;
18
+ private readonly serialize;
18
19
  constructor(source: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, timelineFragmentIds?: string[], resizeWatchSelectors?: string[]);
19
20
  load(modules: ModuleName[]): Promise<Window>;
20
21
  private applyContentProtection;
@@ -22,7 +23,9 @@ export declare class FrameManager {
22
23
  removeResizeTarget(selector: string): void;
23
24
  destroy(): Promise<void>;
24
25
  hide(): Promise<void>;
26
+ private hideNow;
25
27
  show(atProgress?: number): Promise<void>;
28
+ private showNow;
26
29
  setCSSProperties(properties: {
27
30
  [key: string]: string;
28
31
  }): void;
@@ -1,5 +1,6 @@
1
1
  import { ModuleName } from "@readium/navigator-html-injectables";
2
2
  import { Locator, Publication } from "@readium/shared";
3
+ import { UpgradeInsecureRequests } from "./FrameBlobBuilder.ts";
3
4
  import { FrameManager } from "./FrameManager.ts";
4
5
  import { Injector } from "../../injection/Injector.ts";
5
6
  import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
@@ -16,11 +17,14 @@ export declare class FramePoolManager {
16
17
  private readonly injector;
17
18
  private readonly contentProtectionConfig;
18
19
  private readonly keyboardPeripheralsConfig;
20
+ private updateSequence;
21
+ private forcedUpdate;
19
22
  private resizeWatchSelectors;
20
23
  private readonly getFragmentIds;
24
+ private readonly upgradeInsecureRequests;
21
25
  constructor(container: HTMLElement, positions: Locator[], cssProperties?: {
22
26
  [key: string]: string;
23
- }, injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, getFragmentIds?: (href: string) => string[], resizeWatchSelectors?: string[]);
27
+ }, injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, getFragmentIds?: (href: string) => string[], resizeWatchSelectors?: string[], upgradeInsecureRequests?: UpgradeInsecureRequests);
24
28
  addResizeTarget(selector: string): void;
25
29
  removeResizeTarget(selector: string): void;
26
30
  destroy(): Promise<void>;
@@ -5,6 +5,7 @@ import { FXLPeripherals } from "./FXLPeripherals.ts";
5
5
  import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
6
6
  export declare class FXLFrameManager {
7
7
  private frame;
8
+ private frameIsAppended;
8
9
  private loader;
9
10
  source: string;
10
11
  private comms;
@@ -19,8 +20,11 @@ export declare class FXLFrameManager {
19
20
  debugHref: string;
20
21
  private loadPromise;
21
22
  private showPromise;
23
+ private viewportSize;
24
+ private readonly serialize;
22
25
  constructor(peripherals: FXLPeripherals, direction: ReadingProgression, debugHref: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, resizeWatchSelectors?: string[]);
23
26
  load(modules: ModuleName[], source: string): Promise<Window>;
27
+ private loadNow;
24
28
  loadPageSize(): {
25
29
  width: number;
26
30
  height: number;
@@ -28,13 +32,16 @@ export declare class FXLFrameManager {
28
32
  update(page?: Page): void;
29
33
  destroy(): Promise<void>;
30
34
  unload(): Promise<void>;
35
+ private unloadNow;
31
36
  deselect(): void;
32
37
  unfocus(): Promise<void>;
38
+ private unfocusNow;
33
39
  private applyContentProtection;
34
40
  addResizeTarget(selector: string): void;
35
41
  removeResizeTarget(selector: string): void;
36
42
  private cachedPage;
37
43
  show(page: Page): Promise<void>;
44
+ private showNow;
38
45
  activate(): Promise<void>;
39
46
  get element(): HTMLDivElement;
40
47
  get iframe(): HTMLIFrameElement;
@@ -1,6 +1,7 @@
1
1
  import { ModuleName } from "@readium/navigator-html-injectables";
2
- import { Locator, Publication, Page, Link } from "@readium/shared";
2
+ import { Locator, Publication, Page, Link, Layout } from "@readium/shared";
3
3
  import { FrameCommsListener } from "../frame/index.ts";
4
+ import { UpgradeInsecureRequests } from "../frame/FrameBlobBuilder.ts";
4
5
  import { FXLFrameManager } from "./FXLFrameManager.ts";
5
6
  import { FXLPeripherals } from "./FXLPeripherals.ts";
6
7
  import { VisualNavigatorViewport, IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../../Navigator.ts";
@@ -19,6 +20,7 @@ export declare class FXLFramePoolManager {
19
20
  private readonly contentProtectionConfig;
20
21
  private readonly keyboardPeripheralsConfig;
21
22
  private resizeWatchSelectors;
23
+ private readonly upgradeInsecureRequests;
22
24
  private readonly bookElement;
23
25
  readonly spineElement: HTMLDivElement;
24
26
  private readonly pub;
@@ -33,7 +35,8 @@ export declare class FXLFramePoolManager {
33
35
  private containerHeightCached;
34
36
  private resizeTimeout;
35
37
  readonly peripherals: FXLPeripherals;
36
- constructor(container: HTMLElement, positions: Locator[], pub: Publication, injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, resizeWatchSelectors?: string[]);
38
+ constructor(container: HTMLElement, positions: Locator[], pub: Publication, _layout: Layout, // TODO: used by upcoming scrolled-layout support
39
+ injector?: Injector | null, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, resizeWatchSelectors?: string[], upgradeInsecureRequests?: UpgradeInsecureRequests);
37
40
  private _listener;
38
41
  set listener(listener: FrameCommsListener);
39
42
  get listener(): FrameCommsListener;
@@ -52,6 +55,9 @@ export declare class FXLFramePoolManager {
52
55
  get threshold(): number;
53
56
  get portrait(): boolean;
54
57
  updateSpineStyle(animate: boolean, fast?: boolean): void;
58
+ private bookScale;
59
+ private bookTranslate;
60
+ private bookTransform;
55
61
  updateBookStyle(initial?: boolean): void;
56
62
  /**
57
63
  * Go to slide with particular index
@@ -26,6 +26,7 @@ export interface Zoomer {
26
26
  Y: number;
27
27
  };
28
28
  }
29
+ export declare const isTypedOMSupported: () => boolean;
29
30
  export declare class FXLPeripherals {
30
31
  private readonly manager;
31
32
  private readonly coordinator;
@@ -68,6 +69,8 @@ export declare class FXLPeripherals {
68
69
  */
69
70
  touchendHandler(e: TouchEvent): void;
70
71
  private moveFrame;
72
+ private dragTranslate;
73
+ private dragTransform;
71
74
  /**
72
75
  * touchmove event handler
73
76
  */
@@ -0,0 +1 @@
1
+ export declare function createSerializer(): <T>(operation: () => Promise<T>) => Promise<T>;
@@ -2,6 +2,7 @@ export * from './Navigator.ts';
2
2
  export * from './decorations/index.ts';
3
3
  export * from './webpub/index.ts';
4
4
  export * from './epub/index.ts';
5
+ export * from './divina/index.ts';
5
6
  export * from './audio/index.ts';
6
7
  export * from './helpers/index.ts';
7
8
  export * from './preferences/index.ts';
@@ -7,6 +7,7 @@ export interface KeyboardPeripheralOptions {
7
7
  export declare class KeyboardPeripherals {
8
8
  private keydownHandler?;
9
9
  private keyManager;
10
+ private readonly pagehideHandler;
10
11
  constructor(options?: KeyboardPeripheralOptions);
11
12
  private setupKeyboardPeripherals;
12
13
  destroy(): void;
@@ -15,6 +15,7 @@ export declare class WebPubFrameManager {
15
15
  private pendingUnwatchSelectors;
16
16
  private conditionBridge?;
17
17
  private currModules;
18
+ private readonly serialize;
18
19
  constructor(source: string, contentProtectionConfig?: IContentProtectionConfig, keyboardPeripheralsConfig?: IKeyboardPeripheralsConfig, timelineFragmentIds?: string[], resizeWatchSelectors?: string[]);
19
20
  load(modules?: ModuleName[]): Promise<Window>;
20
21
  private applyContentProtection;
@@ -22,7 +23,9 @@ export declare class WebPubFrameManager {
22
23
  removeResizeTarget(selector: string): void;
23
24
  destroy(): Promise<void>;
24
25
  hide(): Promise<void>;
26
+ private hideNow;
25
27
  show(atProgress?: number): Promise<void>;
28
+ private showNow;
26
29
  setCSSProperties(properties: {
27
30
  [key: string]: string;
28
31
  }): void;
@@ -41,6 +41,7 @@ export declare class WebPubNavigator extends VisualNavigator implements Configur
41
41
  private framePool;
42
42
  private currentIndex;
43
43
  private currentLocation;
44
+ private _destroyed;
44
45
  private _currentTimelineItem;
45
46
  private _visibleFragmentIds;
46
47
  private _notifiedVisibleFragmentIds;
@@ -115,6 +116,7 @@ export declare class WebPubNavigator extends VisualNavigator implements Configur
115
116
  get publication(): Publication;
116
117
  get timeline(): Timeline;
117
118
  private loadLocator;
119
+ private completeLocator;
118
120
  go(locator: Locator, _: boolean, cb: (ok: boolean) => void): void;
119
121
  goLink(link: Link, animated: boolean, cb: (ok: boolean) => void): void;
120
122
  private createCurrentLocator;