@readium/navigator 2.5.2-beta.5 → 2.5.3

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 (31) hide show
  1. package/dist/{ReadiumCSS-after-DBPN8It0.js → ReadiumCSS-after-BYNAMW5u.js} +4 -4
  2. package/dist/{ReadiumCSS-after-CVNJvQab.js → ReadiumCSS-after-C8SjJ_Rf.js} +4 -4
  3. package/dist/{ReadiumCSS-after-CPAYSG9F.js → ReadiumCSS-after-Dzd22Ssm.js} +6 -7
  4. package/dist/{ReadiumCSS-after-Cpw6SSeZ.js → ReadiumCSS-after-b-ykC0_O.js} +11 -12
  5. package/dist/ReadiumCSS-before-6kD9Qj82.js +529 -0
  6. package/dist/ReadiumCSS-before-CvMFpmud.js +529 -0
  7. package/dist/ReadiumCSS-before-crwPhKrV.js +529 -0
  8. package/dist/ReadiumCSS-before-usMdEglk.js +530 -0
  9. package/dist/{ReadiumCSS-default-BMLfH2r9.js → ReadiumCSS-default-BVp3Ygi2.js} +1 -1
  10. package/dist/{ReadiumCSS-default-C_BHdXWz.js → ReadiumCSS-default-CL_hP__L.js} +1 -1
  11. package/dist/{ReadiumCSS-default-BTgk8NbH.js → ReadiumCSS-default-nJgSC4Z_.js} +1 -1
  12. package/dist/{ReadiumCSS-default-C7kHIm6s.js → ReadiumCSS-default-vv7hNCaM.js} +1 -1
  13. package/dist/index.js +483 -448
  14. package/dist/index.umd.cjs +702 -289
  15. package/package.json +2 -2
  16. package/src/Navigator.ts +5 -0
  17. package/src/audio/AudioNavigator.ts +3 -3
  18. package/src/epub/EpubNavigator.ts +1 -5
  19. package/src/epub/preferences/EpubPreferencesEditor.ts +6 -6
  20. package/src/helpers/lineLength.ts +1 -1
  21. package/src/preferences/Types.ts +21 -1
  22. package/src/webpub/WebPubNavigator.ts +2 -3
  23. package/types/src/Navigator.d.ts +4 -1
  24. package/types/src/audio/AudioNavigator.d.ts +3 -3
  25. package/types/src/epub/EpubNavigator.d.ts +2 -5
  26. package/types/src/preferences/Types.d.ts +15 -0
  27. package/types/src/webpub/WebPubNavigator.d.ts +2 -2
  28. package/dist/ReadiumCSS-before-CA1r4W7i.js +0 -425
  29. package/dist/ReadiumCSS-before-D5x0zuZP.js +0 -425
  30. package/dist/ReadiumCSS-before-DXNoxSjL.js +0 -426
  31. package/dist/ReadiumCSS-before-DtkzLMzT.js +0 -425
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readium/navigator",
3
- "version": "2.5.2-beta.5",
3
+ "version": "2.5.3",
4
4
  "type": "module",
5
5
  "description": "Next generation SDK for publications in Web Apps",
6
6
  "author": "readium",
@@ -50,7 +50,7 @@
50
50
  "generate:css-selector": "node scripts/generate-css-selector.js"
51
51
  },
52
52
  "devDependencies": {
53
- "@readium/css": "^2.0.2",
53
+ "@readium/css": "^2.0.4",
54
54
  "@readium/navigator-html-injectables": "workspace:*",
55
55
  "@readium/shared": "workspace:*",
56
56
  "@types/path-browserify": "^1.0.3",
package/src/Navigator.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  ContentProtectionConfig,
4
4
  PrintProtectionConfig,
5
5
  KeyboardPeripheral,
6
+ KeyboardPeripheralEvent,
6
7
  KeyCombo,
7
8
  DEV_TOOLS,
8
9
  SELECT_ALL,
@@ -12,6 +13,10 @@ import {
12
13
 
13
14
  type cbb = (ok: boolean) => void;
14
15
 
16
+ export interface KeyboardPeripheralEventData extends Omit<KeyboardPeripheralEvent, 'interactiveElement'> {
17
+ interactiveElement?: Element;
18
+ }
19
+
15
20
  export type IKeyboardPeripheralsConfig = Array<Omit<KeyboardPeripheral, 'type'> & {
16
21
  type: Exclude<string, 'developer_tools' | 'select_all' | 'print' | 'save'>;
17
22
  }>;
@@ -1,5 +1,5 @@
1
1
  import { Link, Locator, LocatorLocations, Publication, Timeline, TimelineItem } from "@readium/shared";
2
- import { MediaNavigator, IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
2
+ import { MediaNavigator, IContentProtectionConfig, IKeyboardPeripheralsConfig, KeyboardPeripheralEventData } from "../Navigator.ts";
3
3
  import { Configurable } from "../preferences/Configurable.ts";
4
4
  import { WebAudioEngine, PlaybackState } from "./engine/index.ts";
5
5
  import {
@@ -11,7 +11,7 @@ import {
11
11
  IAudioDefaults
12
12
  } from "./preferences/index.ts";
13
13
  import { AudioPoolManager } from "./AudioPoolManager.ts";
14
- import { ContextMenuEvent, KeyboardEventData, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
14
+ import { ContextMenuEvent, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
15
15
  import { AudioNavigatorProtector } from "./protection/AudioNavigatorProtector.ts";
16
16
  import { NAVIGATOR_SUSPICIOUS_ACTIVITY_EVENT } from "../protection/NavigatorProtector.ts";
17
17
  import { KeyboardPeripherals, NAVIGATOR_KEYBOARD_PERIPHERAL_EVENT } from "../peripherals/KeyboardPeripherals.ts";
@@ -36,7 +36,7 @@ export interface AudioNavigatorListeners {
36
36
  seeking: (isSeeking: boolean) => void;
37
37
  seekable: (seekable: TimeRanges) => void;
38
38
  contentProtection: (type: string, data: SuspiciousActivityEvent) => void;
39
- peripheral: (data: KeyboardEventData) => void;
39
+ peripheral: (data: KeyboardPeripheralEventData) => void;
40
40
  contextMenu: (data: ContextMenuEvent) => void;
41
41
  remotePlaybackStateChanged: (state: RemotePlaybackState) => void;
42
42
  }
@@ -16,17 +16,13 @@ import { getContentWidth } from "../helpers/dimensions.ts";
16
16
  import { Injector } from "../injection/Injector.ts";
17
17
  import { createReadiumEpubRules } from "../injection/epubInjectables.ts";
18
18
  import { IInjectableRule, IInjectablesConfig } from "../injection/Injectable.ts";
19
- import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
19
+ import { IContentProtectionConfig, IKeyboardPeripheralsConfig, KeyboardPeripheralEventData } from "../Navigator.ts";
20
20
  import { NavigatorProtector, NAVIGATOR_SUSPICIOUS_ACTIVITY_EVENT } from "../protection/NavigatorProtector.ts";
21
21
  import { KeyboardPeripherals, NAVIGATOR_KEYBOARD_PERIPHERAL_EVENT } from "../peripherals/KeyboardPeripherals.ts";
22
22
  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
-
30
26
  export interface EpubNavigatorConfiguration {
31
27
  preferences: IEpubPreferences;
32
28
  defaults: IEpubDefaults;
@@ -44,7 +44,7 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
44
44
  get backgroundColor(): Preference<string> {
45
45
  return new Preference<string>({
46
46
  initialValue: this.preferences.backgroundColor,
47
- effectiveValue: this.settings.backgroundColor || defaultColors.RS__backgroundColor,
47
+ effectiveValue: this.settings.backgroundColor || defaultColors.backgroundColor,
48
48
  isEffective: this.preferences.backgroundColor !== null,
49
49
  onChange: (newValue: string | null | undefined) => {
50
50
  this.updatePreference("backgroundColor", newValue ?? null);
@@ -302,7 +302,7 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
302
302
  get linkColor(): Preference<string> {
303
303
  return new Preference<string>({
304
304
  initialValue: this.preferences.linkColor,
305
- effectiveValue: this.settings.linkColor || defaultColors.RS__linkColor,
305
+ effectiveValue: this.settings.linkColor || defaultColors.linkColor,
306
306
  isEffective: this.layout !== Layout.fixed && this.preferences.linkColor !== null,
307
307
  onChange: (newValue: string | null | undefined) => {
308
308
  this.updatePreference("linkColor", newValue ?? null);
@@ -455,7 +455,7 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
455
455
  get selectionBackgroundColor(): Preference<string> {
456
456
  return new Preference<string>({
457
457
  initialValue: this.preferences.selectionBackgroundColor,
458
- effectiveValue: this.settings.selectionBackgroundColor || defaultColors.RS__selectionBackgroundColor,
458
+ effectiveValue: this.settings.selectionBackgroundColor || defaultColors.selectionBackgroundColor,
459
459
  isEffective: this.layout !== Layout.fixed && this.preferences.selectionBackgroundColor !== null,
460
460
  onChange: (newValue: string | null | undefined) => {
461
461
  this.updatePreference("selectionBackgroundColor", newValue ?? null);
@@ -466,7 +466,7 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
466
466
  get selectionTextColor(): Preference<string> {
467
467
  return new Preference<string>({
468
468
  initialValue: this.preferences.selectionTextColor,
469
- effectiveValue: this.settings.selectionTextColor || defaultColors.RS__selectionTextColor,
469
+ effectiveValue: this.settings.selectionTextColor || defaultColors.selectionTextColor,
470
470
  isEffective: this.layout !== Layout.fixed && this.preferences.selectionTextColor !== null,
471
471
  onChange: (newValue: string | null | undefined) => {
472
472
  this.updatePreference("selectionTextColor", newValue ?? null);
@@ -489,7 +489,7 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
489
489
  get textColor(): Preference<string> {
490
490
  return new Preference<string>({
491
491
  initialValue: this.preferences.textColor,
492
- effectiveValue: this.settings.textColor || defaultColors.RS__textColor,
492
+ effectiveValue: this.settings.textColor || defaultColors.textColor,
493
493
  isEffective: this.layout !== Layout.fixed && this.preferences.textColor !== null,
494
494
  onChange: (newValue: string | null | undefined) => {
495
495
  this.updatePreference("textColor", newValue ?? null);
@@ -511,7 +511,7 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
511
511
  get visitedColor(): Preference<string> {
512
512
  return new Preference<string>({
513
513
  initialValue: this.preferences.visitedColor,
514
- effectiveValue: this.settings.visitedColor || defaultColors.RS__visitedColor,
514
+ effectiveValue: this.settings.visitedColor || defaultColors.visitedColor,
515
515
  isEffective: this.layout !== Layout.fixed && this.preferences.visitedColor !== null,
516
516
  onChange: (newValue: string | null | undefined) => {
517
517
  this.updatePreference("visitedColor", newValue ?? null);
@@ -27,7 +27,7 @@ export interface ILineLengths {
27
27
  }
28
28
 
29
29
  const DEFAULT_FONT_SIZE = 16;
30
- const DEFAULT_FONT_FACE = fontStacks.RS__oldStyleTf;
30
+ const DEFAULT_FONT_FACE = fontStacks.oldStyleTf;
31
31
 
32
32
  // Notes:
33
33
  //
@@ -1,8 +1,28 @@
1
1
  import RCSSExperiments from "@readium/css/css/vars/experiments.json";
2
+ import RCSSSettings from "@readium/css/css/vars/settings.json";
3
+ import RCSSI18n from "@readium/css/css/vars/i18n.json";
2
4
 
3
5
  export type ExperimentKey = keyof typeof RCSSExperiments;
6
+ export type SettingsKey = keyof typeof RCSSSettings;
7
+ export type I18nKey = keyof typeof RCSSI18n;
8
+
9
+ export type RCSSSettingsProperty =
10
+ | (typeof RCSSSettings)[SettingsKey]["disabled"][number]
11
+ | (typeof RCSSSettings)[SettingsKey]["added"][number];
12
+
13
+ export type RCSSSettingsEntry = {
14
+ disabled: readonly RCSSSettingsProperty[];
15
+ added: readonly RCSSSettingsProperty[];
16
+ }
17
+
18
+ export type RCSSI18nEntry = {
19
+ baseFontFamily: string;
20
+ lineHeightCompensation?: number;
21
+ }
4
22
 
5
23
  export const experiments = RCSSExperiments;
24
+ export const settings: Record<SettingsKey, RCSSSettingsEntry> = RCSSSettings;
25
+ export const i18n: Record<I18nKey, RCSSI18nEntry> = RCSSI18n;
6
26
 
7
27
  export enum TextAlignment {
8
28
  start = "start",
@@ -44,7 +64,7 @@ export const letterSpacingRangeConfig: RangeConfig = {
44
64
  }
45
65
 
46
66
  export const lineHeightRangeConfig: RangeConfig = {
47
- range: [1, 2],
67
+ range: [1, 2.5],
48
68
  step: .1
49
69
  }
50
70
 
@@ -1,12 +1,11 @@
1
1
  import { Feature, Link, Locator, Publication, ReadingProgression, LocatorLocations } from "@readium/shared";
2
- import { VisualNavigator, VisualNavigatorViewport, ProgressionRange } from "../Navigator.ts";
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
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
-
9
- import { KeyboardPeripheralEventData, ManagerEventKey } from "../epub/EpubNavigator.ts";
8
+ import { ManagerEventKey } from "../epub/EpubNavigator.ts";
10
9
  import { getScriptMode } from "../helpers/scriptMode.ts";
11
10
  import { WebPubCSS } from "./css/WebPubCSS.ts";
12
11
  import { WebUserProperties, WebRSProperties } from "./css/Properties.ts";
@@ -1,6 +1,9 @@
1
1
  import { Link, Locator, Publication, ReadingProgression } from "@readium/shared";
2
- import { ContentProtectionConfig, PrintProtectionConfig, KeyboardPeripheral } from "@readium/navigator-html-injectables";
2
+ import { ContentProtectionConfig, PrintProtectionConfig, KeyboardPeripheral, KeyboardPeripheralEvent } from "@readium/navigator-html-injectables";
3
3
  type cbb = (ok: boolean) => void;
4
+ export interface KeyboardPeripheralEventData extends Omit<KeyboardPeripheralEvent, 'interactiveElement'> {
5
+ interactiveElement?: Element;
6
+ }
4
7
  export type IKeyboardPeripheralsConfig = Array<Omit<KeyboardPeripheral, 'type'> & {
5
8
  type: Exclude<string, 'developer_tools' | 'select_all' | 'print' | 'save'>;
6
9
  }>;
@@ -1,8 +1,8 @@
1
1
  import { Link, Locator, Publication, Timeline, TimelineItem } from "@readium/shared";
2
- import { MediaNavigator, IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
2
+ import { MediaNavigator, IContentProtectionConfig, IKeyboardPeripheralsConfig, KeyboardPeripheralEventData } from "../Navigator.ts";
3
3
  import { Configurable } from "../preferences/Configurable.ts";
4
4
  import { AudioPreferences, AudioSettings, AudioPreferencesEditor, IAudioPreferences, IAudioDefaults } from "./preferences/index.ts";
5
- import { ContextMenuEvent, KeyboardEventData, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
5
+ import { ContextMenuEvent, SuspiciousActivityEvent } from "@readium/navigator-html-injectables";
6
6
  export interface AudioMetadata {
7
7
  duration: number;
8
8
  textTracks: TextTrackList;
@@ -22,7 +22,7 @@ export interface AudioNavigatorListeners {
22
22
  seeking: (isSeeking: boolean) => void;
23
23
  seekable: (seekable: TimeRanges) => void;
24
24
  contentProtection: (type: string, data: SuspiciousActivityEvent) => void;
25
- peripheral: (data: KeyboardEventData) => void;
25
+ peripheral: (data: KeyboardPeripheralEventData) => void;
26
26
  contextMenu: (data: ContextMenuEvent) => void;
27
27
  remotePlaybackStateChanged: (state: RemotePlaybackState) => void;
28
28
  }
@@ -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, BasicTextSelection, FrameClickEvent, SuspiciousActivityEvent, KeyboardPeripheralEvent } from "@readium/navigator-html-injectables";
5
+ import { CommsEventKey, ContextMenuEvent, BasicTextSelection, FrameClickEvent, SuspiciousActivityEvent } 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";
@@ -10,11 +10,8 @@ import { IEpubDefaults } from "./preferences/EpubDefaults.ts";
10
10
  import { EpubSettings } from "./preferences/index.ts";
11
11
  import { EpubPreferencesEditor } from "./preferences/EpubPreferencesEditor.ts";
12
12
  import { IInjectablesConfig } from "../injection/Injectable.ts";
13
- import { IContentProtectionConfig, IKeyboardPeripheralsConfig } from "../Navigator.ts";
13
+ import { IContentProtectionConfig, IKeyboardPeripheralsConfig, KeyboardPeripheralEventData } from "../Navigator.ts";
14
14
  export type ManagerEventKey = "zoom";
15
- export interface KeyboardPeripheralEventData extends Omit<KeyboardPeripheralEvent, 'interactiveElement'> {
16
- interactiveElement?: Element;
17
- }
18
15
  export interface EpubNavigatorConfiguration {
19
16
  preferences: IEpubPreferences;
20
17
  defaults: IEpubDefaults;
@@ -1,5 +1,18 @@
1
1
  import RCSSExperiments from "@readium/css/css/vars/experiments.json";
2
+ import RCSSSettings from "@readium/css/css/vars/settings.json";
3
+ import RCSSI18n from "@readium/css/css/vars/i18n.json";
2
4
  export type ExperimentKey = keyof typeof RCSSExperiments;
5
+ export type SettingsKey = keyof typeof RCSSSettings;
6
+ export type I18nKey = keyof typeof RCSSI18n;
7
+ export type RCSSSettingsProperty = (typeof RCSSSettings)[SettingsKey]["disabled"][number] | (typeof RCSSSettings)[SettingsKey]["added"][number];
8
+ export type RCSSSettingsEntry = {
9
+ disabled: readonly RCSSSettingsProperty[];
10
+ added: readonly RCSSSettingsProperty[];
11
+ };
12
+ export type RCSSI18nEntry = {
13
+ baseFontFamily: string;
14
+ lineHeightCompensation?: number;
15
+ };
3
16
  export declare const experiments: {
4
17
  experimentalHeaderFiltering: {
5
18
  description: string;
@@ -12,6 +25,8 @@ export declare const experiments: {
12
25
  value: string;
13
26
  };
14
27
  };
28
+ export declare const settings: Record<SettingsKey, RCSSSettingsEntry>;
29
+ export declare const i18n: Record<I18nKey, RCSSI18nEntry>;
15
30
  export declare enum TextAlignment {
16
31
  start = "start",
17
32
  left = "left",
@@ -1,9 +1,9 @@
1
1
  import { Link, Locator, Publication, ReadingProgression } from "@readium/shared";
2
- import { VisualNavigator, VisualNavigatorViewport } from "../Navigator.ts";
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 { KeyboardPeripheralEventData, ManagerEventKey } from "../epub/EpubNavigator.ts";
6
+ import { 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";