@readium/navigator 2.4.0-beta.7 → 2.4.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3622,7 +3622,7 @@ const Ct = class Ct extends bt {
3622
3622
  ), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
3623
3623
  value: {
3624
3624
  name: "readium-ts-toolkit",
3625
- version: "2.4.0-beta.7",
3625
+ version: "2.4.0-beta.9",
3626
3626
  hasFeature: (n, r = "") => {
3627
3627
  switch (n) {
3628
3628
  case "dom-manipulation":
@@ -4284,7 +4284,7 @@ class Sr {
4284
4284
  });
4285
4285
  }
4286
4286
  applyContentProtection() {
4287
- this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
4287
+ this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting?.disable && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
4288
4288
  }
4289
4289
  async destroy() {
4290
4290
  await this.hide(), this.loader?.destroy(), this.frame.remove(), this.destroyed = !0;
@@ -4684,7 +4684,7 @@ const ht = {
4684
4684
  range: [0, 1],
4685
4685
  step: 0.1
4686
4686
  }, te = {
4687
- range: [0.5, 2],
4687
+ range: [0.5, 4],
4688
4688
  step: 0.1
4689
4689
  }, et = {
4690
4690
  range: [5, 60],
@@ -5883,7 +5883,7 @@ class Wr {
5883
5883
  * Stop detection and cleanup resources
5884
5884
  */
5885
5885
  destroy() {
5886
- this.intervalId && (clearInterval(this.intervalId), this.intervalId = void 0), this.workerConsole && this.workerConsole.destroy(), this.isOpen = !1, this.checkCount = 0;
5886
+ this.intervalId && (clearInterval(this.intervalId), this.intervalId = void 0), this.workerConsole && (this.workerConsole.destroy(), this.workerConsole = void 0), this.isOpen = !1, this.checkCount = 0;
5887
5887
  }
5888
5888
  }
5889
5889
  class Hr {
@@ -6082,8 +6082,8 @@ class Gr extends rn {
6082
6082
  this._contentProtection,
6083
6083
  r.keyboardPeripherals || []
6084
6084
  ), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new We(this._contentProtection), this._suspiciousActivityListener = (l) => {
6085
- const h = l;
6086
- this.listeners.contentProtection(h.detail.type, h.detail);
6085
+ const { type: h, ...c } = l.detail;
6086
+ h === "context_menu" ? this.listeners.contextMenu(c) : this.listeners.contentProtection(h, c);
6087
6087
  }, window.addEventListener(st, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new He({
6088
6088
  keyboardPeripherals: this._keyboardPeripherals
6089
6089
  }), this._keyboardPeripheralListener = (l) => {
@@ -6499,7 +6499,7 @@ class Xr {
6499
6499
  });
6500
6500
  }
6501
6501
  applyContentProtection() {
6502
- this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
6502
+ this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting?.disable && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
6503
6503
  }
6504
6504
  async destroy() {
6505
6505
  await this.hide(), this.loader?.destroy(), this.frame.remove(), this.destroyed = !0;
@@ -6780,7 +6780,7 @@ class qr {
6780
6780
  this.comms?.halt();
6781
6781
  }
6782
6782
  applyContentProtection() {
6783
- this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.protectPrinting && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
6783
+ this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.protectPrinting?.disable && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
6784
6784
  }
6785
6785
  async show(t) {
6786
6786
  if (!this.frame.parentElement) {
@@ -10570,6 +10570,8 @@ const Os = (s) => ({
10570
10570
  }),
10571
10571
  positionChanged: s.positionChanged ?? (() => {
10572
10572
  }),
10573
+ timelineItemChanged: s.timelineItemChanged ?? (() => {
10574
+ }),
10573
10575
  error: s.error ?? (() => {
10574
10576
  }),
10575
10577
  trackEnded: s.trackEnded ?? (() => {
@@ -10635,7 +10637,7 @@ class As extends dr {
10635
10637
  }, window.addEventListener(st, this._suspiciousActivityListener)), c.length > 0 && (this._keyboardPeripheralsManager = new He({ keyboardPeripherals: c }), this._keyboardPeripheralListener = (u) => {
10636
10638
  this.listeners.peripheral(u.detail);
10637
10639
  }, window.addEventListener(ot, this._keyboardPeripheralListener)), this.setupEventListeners(), this.applyPreferences(), this.pool.setCurrentAudio(o, "forward"), this.waitForLoadedAndSeeked(a).then(() => {
10638
- this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this.listeners.positionChanged(this.currentLocator);
10640
+ this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this._notifyTimelineChange(this.currentLocator), this.listeners.positionChanged(this.currentLocator);
10639
10641
  }).catch(() => {
10640
10642
  });
10641
10643
  }
@@ -10654,6 +10656,13 @@ class As extends dr {
10654
10656
  get publication() {
10655
10657
  return this.pub;
10656
10658
  }
10659
+ get timeline() {
10660
+ return this.pub.timeline;
10661
+ }
10662
+ _notifyTimelineChange(t) {
10663
+ const e = this.pub.timeline.locate(t);
10664
+ e !== this._currentTimelineItem && (this._currentTimelineItem = e, this.listeners.timelineItemChanged(e));
10665
+ }
10657
10666
  ensureLocatorLocations(t) {
10658
10667
  return new N({
10659
10668
  ...t,
@@ -10754,9 +10763,9 @@ class As extends dr {
10754
10763
  position: this.currentTrackIndex(),
10755
10764
  progression: i,
10756
10765
  fragments: [`t=${t}`]
10757
- })), this.listeners.positionChanged(this.currentLocation);
10766
+ })), this._notifyTimelineChange(this.currentLocation), this.listeners.positionChanged(this.currentLocation);
10758
10767
  }
10759
- }), this.pool.audioEngine.on("seeking", () => this.listeners.seeking(!0)), this.pool.audioEngine.on("waiting", () => this.listeners.seeking(!0)), this.pool.audioEngine.on("stalled", () => this.listeners.stalled(!0)), this.pool.audioEngine.on("progress", (t) => this.listeners.seekable(t)), this.pool.audioEngine.on("loadedmetadata", () => {
10768
+ }), this.pool.audioEngine.on("seeking", () => this.listeners.seeking(!0)), this.pool.audioEngine.on("waiting", () => this.listeners.seeking(!0)), this.pool.audioEngine.on("stalled", () => this.listeners.stalled(!0)), this.pool.audioEngine.on("canplaythrough", () => this.listeners.stalled(!1)), this.pool.audioEngine.on("progress", (t) => this.listeners.seekable(t)), this.pool.audioEngine.on("loadedmetadata", () => {
10760
10769
  this.listeners.metadataLoaded(this.pool.audioEngine.duration());
10761
10770
  });
10762
10771
  }
@@ -10782,7 +10791,7 @@ class As extends dr {
10782
10791
  position: this.currentTrackIndex(),
10783
10792
  progression: i,
10784
10793
  fragments: [`t=${t}`]
10785
- })), this.listeners.positionChanged(this.currentLocation);
10794
+ })), this._notifyTimelineChange(this.currentLocation), this.listeners.positionChanged(this.currentLocation);
10786
10795
  }, this._settings.pollInterval);
10787
10796
  }
10788
10797
  stopPositionPolling() {
@@ -10797,10 +10806,15 @@ class As extends dr {
10797
10806
  return;
10798
10807
  }
10799
10808
  const a = ++this.navigationId, l = r >= this.currentTrackIndex() ? "forward" : "backward", h = this.isPlaying || this._playIntent;
10800
- if (this._playIntent = h, this.stopPositionPolling(), this.pool.setCurrentAudio(r, l), this.currentLocation = t.copyWithLocations(t.locations), await this.waitForLoadedAndSeeked(o, a), a !== this.navigationId) return;
10801
- this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this.listeners.positionChanged(this.currentLocator), this._settings.enableMediaSession && this.updateMediaSessionMetadata(), h && this.play(), this._playIntent = !1, i(!0);
10809
+ if (this._playIntent = h, this.stopPositionPolling(), this.pool.setCurrentAudio(r, l), this.currentLocation = t.copyWithLocations(t.locations), await this.waitForLoadedAndSeeked(o, a), a !== this.navigationId) {
10810
+ i(!1);
10811
+ return;
10812
+ }
10813
+ this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this._notifyTimelineChange(this.currentLocator), this.listeners.positionChanged(this.currentLocator), this._settings.enableMediaSession && this.updateMediaSessionMetadata(), h && this.play(), i(!0);
10802
10814
  } catch (n) {
10803
10815
  console.error("Failed to go to locator:", n), i(!1);
10816
+ } finally {
10817
+ this._playIntent = !1;
10804
10818
  }
10805
10819
  }
10806
10820
  async goLink(t, e, i) {