@d-i-t-a/reader 2.4.5 → 2.4.7

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/esm/index.js CHANGED
@@ -13515,7 +13515,7 @@ var require_parse = __commonJS({
13515
13515
  try {
13516
13516
  parser.parse();
13517
13517
  } catch (e) {
13518
- if (false) {
13518
+ if (true) {
13519
13519
  if (e.name === "CssSyntaxError" && opts && opts.from) {
13520
13520
  if (/\.scss$/i.test(opts.from)) {
13521
13521
  e.message += "\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser";
@@ -13707,7 +13707,7 @@ var require_lazy_result = __commonJS({
13707
13707
  error.plugin = plugin.postcssPlugin;
13708
13708
  error.setMessage();
13709
13709
  } else if (plugin.postcssVersion) {
13710
- if (false) {
13710
+ if (true) {
13711
13711
  let pluginName = plugin.postcssPlugin;
13712
13712
  let pluginVer = plugin.postcssVersion;
13713
13713
  let runtimeVer = this.result.processor.version;
@@ -13892,7 +13892,7 @@ var require_lazy_result = __commonJS({
13892
13892
  return this.result;
13893
13893
  }
13894
13894
  then(onFulfilled, onRejected) {
13895
- if (false) {
13895
+ if (true) {
13896
13896
  if (!("from" in this.opts)) {
13897
13897
  warnOnce(
13898
13898
  "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."
@@ -14087,7 +14087,7 @@ var require_no_work_result = __commonJS({
14087
14087
  return this.result;
14088
14088
  }
14089
14089
  then(onFulfilled, onRejected) {
14090
- if (false) {
14090
+ if (true) {
14091
14091
  if (!("from" in this._opts)) {
14092
14092
  warnOnce(
14093
14093
  "Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning."
@@ -14176,7 +14176,7 @@ var require_processor = __commonJS({
14176
14176
  } else if (typeof i === "function") {
14177
14177
  normalized.push(i);
14178
14178
  } else if (typeof i === "object" && (i.parse || i.stringify)) {
14179
- if (false) {
14179
+ if (true) {
14180
14180
  throw new Error(
14181
14181
  "PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation."
14182
14182
  );
@@ -46282,16 +46282,21 @@ var Popup = class {
46282
46282
  return;
46283
46283
  }
46284
46284
  let self2 = this;
46285
- win.onclick = function(ev) {
46286
- if (event.target !== ev.target) {
46287
- if (d2popover.parentElement) {
46288
- self2.hidePopover();
46289
- if (win) {
46290
- win.onclick = null;
46285
+ win.addEventListener(
46286
+ "click",
46287
+ function(ev) {
46288
+ if (event.target !== ev.target) {
46289
+ if (d2popover.parentElement) {
46290
+ self2.hidePopover();
46291
+ ev.stopImmediatePropagation();
46291
46292
  }
46292
46293
  }
46294
+ },
46295
+ {
46296
+ once: true,
46297
+ capture: true
46293
46298
  }
46294
- };
46299
+ );
46295
46300
  }
46296
46301
  } else if (src) {
46297
46302
  let absolute = getAbsoluteHref(src);
@@ -46330,16 +46335,21 @@ var Popup = class {
46330
46335
  return;
46331
46336
  }
46332
46337
  let self2 = this;
46333
- win.onclick = function(ev) {
46334
- if (event.target !== ev.target) {
46335
- if (d2popover.parentElement) {
46336
- self2.hidePopover();
46337
- if (win) {
46338
- win.onclick = null;
46338
+ win.addEventListener(
46339
+ "click",
46340
+ function(ev) {
46341
+ if (event.target !== ev.target) {
46342
+ if (d2popover.parentElement) {
46343
+ self2.hidePopover();
46344
+ ev.stopImmediatePropagation();
46339
46345
  }
46340
46346
  }
46347
+ },
46348
+ {
46349
+ once: true,
46350
+ capture: true
46341
46351
  }
46342
- };
46352
+ );
46343
46353
  }
46344
46354
  }
46345
46355
  }
@@ -46457,6 +46467,7 @@ var EventHandler = class {
46457
46467
  return isEpubInternal;
46458
46468
  };
46459
46469
  this.handleLinks = async (event) => {
46470
+ var _a;
46460
46471
  import_loglevel.default.log("R2 Click Handler");
46461
46472
  const link = this.checkForLink(event);
46462
46473
  if (link) {
@@ -46492,7 +46503,9 @@ var EventHandler = class {
46492
46503
  }
46493
46504
  }
46494
46505
  } else {
46495
- this.onClickThrough(event);
46506
+ if (!((_a = this.navigator.highlighter) == null ? void 0 : _a.isSelectionMenuOpen)) {
46507
+ this.onClickThrough(event);
46508
+ }
46496
46509
  }
46497
46510
  };
46498
46511
  this.navigator = navigator2;
@@ -46510,7 +46523,7 @@ var EventHandler = class {
46510
46523
  },
46511
46524
  true
46512
46525
  );
46513
- element.addEventListener("click", this.handleLinks.bind(this));
46526
+ element.addEventListener("click", this.handleLinks.bind(this), true);
46514
46527
  } else {
46515
46528
  throw "cannot setup events for null";
46516
46529
  }
@@ -55200,7 +55213,7 @@ function delay(t, v) {
55200
55213
  setTimeout(resolve.bind(null, v), t);
55201
55214
  });
55202
55215
  }
55203
- var IS_DEV = false;
55216
+ var IS_DEV = true;
55204
55217
  import_loglevel13.default.setLevel(IS_DEV ? "trace" : "warn", true);
55205
55218
 
55206
55219
  // src/modules/protection/ContentProtectionModule.ts
@@ -58984,6 +58997,8 @@ var KeyboardEventHandler = class {
58984
58997
  };
58985
58998
  this.onForwardSwipe = () => {
58986
58999
  };
59000
+ this.onKeydown = () => {
59001
+ };
58987
59002
  this.setupEvents = (element) => {
58988
59003
  if (element) {
58989
59004
  this.focusin(element);
@@ -59035,20 +59050,22 @@ var KeyboardEventHandler = class {
59035
59050
  switch (key) {
59036
59051
  case "ArrowRight":
59037
59052
  self2.rtl ? self2.onBackwardSwipe(event) : self2.onForwardSwipe(event);
59038
- break;
59053
+ return;
59039
59054
  case "ArrowLeft":
59040
59055
  self2.rtl ? self2.onForwardSwipe(event) : self2.onBackwardSwipe(event);
59041
- break;
59056
+ return;
59042
59057
  }
59043
59058
  switch (event.code) {
59044
59059
  case "Space":
59045
59060
  if (event.ctrlKey) {
59046
59061
  self2.onBackwardSwipe(event);
59062
+ return;
59047
59063
  } else {
59048
59064
  self2.onForwardSwipe(event);
59065
+ return;
59049
59066
  }
59050
- break;
59051
59067
  }
59068
+ self2.onKeydown(event);
59052
59069
  });
59053
59070
  }
59054
59071
  };
@@ -62111,9 +62128,13 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
62111
62128
  this.nextChapterBottomAnchorElement.style.display = "none";
62112
62129
  if (this.previousChapterTopAnchorElement)
62113
62130
  this.previousChapterTopAnchorElement.style.display = "none";
62131
+ if (this.eventHandler) {
62132
+ this.eventHandler.onClickThrough = this.handleClickThrough.bind(this);
62133
+ }
62114
62134
  if (this.keyboardEventHandler) {
62115
62135
  this.keyboardEventHandler.onBackwardSwipe = this.handlePreviousChapterClick.bind(this);
62116
62136
  this.keyboardEventHandler.onForwardSwipe = this.handleNextChapterClick.bind(this);
62137
+ this.keyboardEventHandler.onKeydown = this.handleKeydownFallthrough.bind(this);
62117
62138
  }
62118
62139
  if (this.touchEventHandler) {
62119
62140
  this.touchEventHandler.onBackwardSwipe = this.handlePreviousPageClick.bind(this);
@@ -62153,6 +62174,7 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
62153
62174
  if (this.keyboardEventHandler) {
62154
62175
  this.keyboardEventHandler.onBackwardSwipe = this.handlePreviousPageClick.bind(this);
62155
62176
  this.keyboardEventHandler.onForwardSwipe = this.handleNextPageClick.bind(this);
62177
+ this.keyboardEventHandler.onKeydown = this.handleKeydownFallthrough.bind(this);
62156
62178
  }
62157
62179
  } else {
62158
62180
  if (this.infoBottom)
@@ -62256,6 +62278,7 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
62256
62278
  if (this.keyboardEventHandler) {
62257
62279
  this.keyboardEventHandler.onBackwardSwipe = this.handlePreviousPageClick.bind(this);
62258
62280
  this.keyboardEventHandler.onForwardSwipe = this.handleNextPageClick.bind(this);
62281
+ this.keyboardEventHandler.onKeydown = this.handleKeydownFallthrough.bind(this);
62259
62282
  }
62260
62283
  }
62261
62284
  });
@@ -63378,7 +63401,11 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
63378
63401
  }
63379
63402
  }
63380
63403
  }
63381
- handleClickThrough(_event) {
63404
+ handleClickThrough(event) {
63405
+ var _a, _b;
63406
+ if ((_a = this.api) == null ? void 0 : _a.clickThrough)
63407
+ (_b = this.api) == null ? void 0 : _b.clickThrough(event);
63408
+ this.emit("click", event);
63382
63409
  }
63383
63410
  handleInternalLink(event) {
63384
63411
  const element = event.target;
@@ -63659,6 +63686,12 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
63659
63686
  event.stopPropagation();
63660
63687
  }
63661
63688
  }
63689
+ handleKeydownFallthrough(event) {
63690
+ var _a, _b;
63691
+ if ((_a = this.api) == null ? void 0 : _a.keydownFallthrough)
63692
+ (_b = this.api) == null ? void 0 : _b.keydownFallthrough(event);
63693
+ this.emit("keydown", event);
63694
+ }
63662
63695
  hideView() {
63663
63696
  var _a, _b;
63664
63697
  if (((_a = this.view) == null ? void 0 : _a.layout) !== "fixed") {