@d-i-t-a/reader 2.4.7 → 2.4.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/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 (true) {
13518
+ if (false) {
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 (true) {
13710
+ if (false) {
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 (true) {
13895
+ if (false) {
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 (true) {
14090
+ if (false) {
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 (true) {
14179
+ if (false) {
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
  );
@@ -46466,46 +46466,62 @@ var EventHandler = class {
46466
46466
  );
46467
46467
  return isEpubInternal;
46468
46468
  };
46469
+ this.clicks = 0;
46470
+ this.clickTimer = 0;
46471
+ this.dblClickTimeSpan = 300;
46469
46472
  this.handleLinks = async (event) => {
46470
- var _a;
46471
46473
  import_loglevel.default.log("R2 Click Handler");
46472
- const link = this.checkForLink(event);
46473
- if (link) {
46474
- const isSameOrigin = window.location.protocol === link.protocol && window.location.port === link.port && window.location.hostname === link.hostname;
46475
- const isEpubInternal = this.isReadingOrderInternal(link);
46476
- const isResourceInternal = this.isResourceInternal(link);
46477
- if (!isResourceInternal) {
46478
- await this.popup.hidePopover();
46479
- }
46480
- const isInternal = link.href.indexOf("#");
46481
- if (!isEpubInternal && !isResourceInternal) {
46482
- window.open(link.href, link.target ?? "_blank");
46483
- event.preventDefault();
46484
- event.stopPropagation();
46485
- } else {
46486
- event.target.href = link.href;
46487
- if ((isSameOrigin || isEpubInternal) && isInternal !== -1) {
46488
- const link2 = event.target;
46489
- if (link2) {
46490
- const attribute = link2.getAttribute("epub:type") === "noteref";
46491
- if (attribute) {
46492
- await this.popup.handleFootnote(link2, event);
46493
- } else if (isResourceInternal && !isEpubInternal) {
46494
- await this.popup.showPopover(link2, event);
46495
- } else {
46474
+ this.clicks++;
46475
+ if (this.clicks === 1) {
46476
+ this.clickTimer = setTimeout(async () => {
46477
+ this.clicks = 0;
46478
+ const link = this.checkForLink(event);
46479
+ if (link) {
46480
+ const isSameOrigin = window.location.protocol === link.protocol && window.location.port === link.port && window.location.hostname === link.hostname;
46481
+ const isEpubInternal = this.isReadingOrderInternal(link);
46482
+ const isResourceInternal = this.isResourceInternal(link);
46483
+ if (!isResourceInternal) {
46484
+ await this.popup.hidePopover();
46485
+ }
46486
+ const isInternal = link.href.indexOf("#");
46487
+ if (!isEpubInternal && !isResourceInternal) {
46488
+ window.open(link.href, link.target ?? "_blank");
46489
+ event.preventDefault();
46490
+ event.stopPropagation();
46491
+ } else {
46492
+ event.target.href = link.href;
46493
+ if ((isSameOrigin || isEpubInternal) && isInternal !== -1) {
46494
+ const link2 = event.target;
46495
+ if (link2) {
46496
+ const attribute = link2.getAttribute("epub:type") === "noteref";
46497
+ if (attribute) {
46498
+ await this.popup.handleFootnote(link2, event);
46499
+ } else if (isResourceInternal && !isEpubInternal) {
46500
+ await this.popup.showPopover(link2, event);
46501
+ } else {
46502
+ this.onInternalLink(event);
46503
+ }
46504
+ } else {
46505
+ this.onInternalLink(event);
46506
+ }
46507
+ } else if ((isSameOrigin || isEpubInternal) && isInternal === -1) {
46496
46508
  this.onInternalLink(event);
46497
46509
  }
46498
- } else {
46499
- this.onInternalLink(event);
46500
46510
  }
46501
- } else if ((isSameOrigin || isEpubInternal) && isInternal === -1) {
46502
- this.onInternalLink(event);
46511
+ } else {
46512
+ setTimeout(() => {
46513
+ var _a;
46514
+ console.log("event.detail", event.detail);
46515
+ if (!((_a = this.navigator.highlighter) == null ? void 0 : _a.isSelectionMenuOpen) && event.detail === 1) {
46516
+ this.onClickThrough(event);
46517
+ }
46518
+ }, 100);
46503
46519
  }
46504
- }
46505
- } else {
46506
- if (!((_a = this.navigator.highlighter) == null ? void 0 : _a.isSelectionMenuOpen)) {
46507
- this.onClickThrough(event);
46508
- }
46520
+ }, this.dblClickTimeSpan);
46521
+ }
46522
+ if (this.clicks === 2) {
46523
+ clearTimeout(this.clickTimer);
46524
+ this.clicks = 0;
46509
46525
  }
46510
46526
  };
46511
46527
  this.navigator = navigator2;
@@ -50318,6 +50334,7 @@ var TextHighlighter = class _TextHighlighter {
50318
50334
  );
50319
50335
  switch (mode) {
50320
50336
  case "colors":
50337
+ this.selectionMenuOpened();
50321
50338
  if (toolboxColorsOptions)
50322
50339
  toolboxColorsOptions.style.display = "unset";
50323
50340
  if (toolboxAddOptions)
@@ -50328,6 +50345,7 @@ var TextHighlighter = class _TextHighlighter {
50328
50345
  toolboxMarkOptions.style.display = "none";
50329
50346
  break;
50330
50347
  case "edit":
50348
+ this.selectionMenuOpened();
50331
50349
  if (toolboxColorsOptions)
50332
50350
  toolboxColorsOptions.style.display = "none";
50333
50351
  if (toolboxAddOptions)
@@ -50338,6 +50356,7 @@ var TextHighlighter = class _TextHighlighter {
50338
50356
  toolboxMarkOptions.style.display = "none";
50339
50357
  break;
50340
50358
  case "action":
50359
+ this.selectionMenuOpened();
50341
50360
  if (toolboxColorsOptions)
50342
50361
  toolboxColorsOptions.style.display = "none";
50343
50362
  if (toolboxAddOptions)
@@ -50348,6 +50367,7 @@ var TextHighlighter = class _TextHighlighter {
50348
50367
  toolboxMarkOptions.style.display = "unset";
50349
50368
  break;
50350
50369
  default:
50370
+ this.selectionMenuOpened();
50351
50371
  if (toolboxColorsOptions)
50352
50372
  toolboxColorsOptions.style.display = "none";
50353
50373
  if (toolboxAddOptions)
@@ -55213,7 +55233,7 @@ function delay(t, v) {
55213
55233
  setTimeout(resolve.bind(null, v), t);
55214
55234
  });
55215
55235
  }
55216
- var IS_DEV = true;
55236
+ var IS_DEV = false;
55217
55237
  import_loglevel13.default.setLevel(IS_DEV ? "trace" : "warn", true);
55218
55238
 
55219
55239
  // src/modules/protection/ContentProtectionModule.ts
@@ -63070,7 +63090,7 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
63070
63090
  if (doc && doc.body) {
63071
63091
  height = getComputedStyle(doc.body).height;
63072
63092
  width = getComputedStyle(doc.body).width;
63073
- if (parseInt(height == null ? void 0 : height.replace("px", "")) === 0 || parseInt(width == null ? void 0 : width.replace("px", "")) === 0) {
63093
+ if (parseInt(height.toString().replace("px", "")) === 0 || parseInt(width.toString().replace("px", "")) === 0) {
63074
63094
  const head = findIframeElement(
63075
63095
  doc,
63076
63096
  "head"
@@ -63095,8 +63115,8 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
63095
63115
  }
63096
63116
  var iframeParent = index2 === 0 && this.iframes.length === 2 ? (_b2 = this.iframes[1].parentElement) == null ? void 0 : _b2.parentElement : (_c2 = this.iframes[0].parentElement) == null ? void 0 : _c2.parentElement;
63097
63117
  if (iframeParent && width) {
63098
- var widthRatio = (parseInt(getComputedStyle(iframeParent).width) - 100) / (this.iframes.length === 2 ? parseInt(width == null ? void 0 : width.replace("px", "")) * 2 + 200 : parseInt(width == null ? void 0 : width.replace("px", "")));
63099
- var heightRatio = (parseInt(getComputedStyle(iframeParent).height) - 100) / parseInt(height == null ? void 0 : height.replace("px", ""));
63118
+ var widthRatio = (parseInt(getComputedStyle(iframeParent).width) - 100) / (this.iframes.length === 2 ? parseInt(width.toString().replace("px", "")) * 2 + 200 : parseInt(width.toString().replace("px", "")));
63119
+ var heightRatio = (parseInt(getComputedStyle(iframeParent).height) - 100) / parseInt(height.toString().replace("px", ""));
63100
63120
  var scale = Math.min(widthRatio, heightRatio);
63101
63121
  iframeParent.style.transform = "scale(" + scale + ")";
63102
63122
  for (const iframe of this.iframes) {
@@ -63505,13 +63525,17 @@ var IFrameNavigator = class _IFrameNavigator extends eventemitter3_default {
63505
63525
  return obj2;
63506
63526
  }, {});
63507
63527
  if (parseInt(obj["height"]) !== 0 || parseInt(obj["width"]) !== 0) {
63508
- height = obj["height"].endsWith("px") ? obj["height"] : obj["height"] + "px";
63509
- width = obj["width"].endsWith("px") ? obj["width"] : obj["width"] + "px";
63528
+ height = obj["height"].toString().endsWith("px") ? obj["height"] : obj["height"] + "px";
63529
+ width = obj["width"].toString().endsWith("px") ? obj["width"] : obj["width"] + "px";
63510
63530
  }
63511
63531
  }
63512
63532
  }
63513
- var widthRatio = (parseInt(getComputedStyle(iframeParent).width) - 100) / (this.iframes.length === 2 ? parseInt(width == null ? void 0 : width.replace("px", "")) * 2 + 200 : parseInt(width == null ? void 0 : width.replace("px", "")));
63514
- var heightRatio = (parseInt(getComputedStyle(iframeParent).height) - 100) / parseInt(height == null ? void 0 : height.replace("px", ""));
63533
+ var widthRatio = (parseInt(getComputedStyle(iframeParent).width) - 100) / (this.iframes.length === 2 ? parseInt(
63534
+ width.toString().endsWith("px") ? width == null ? void 0 : width.replace("px", "") : width
63535
+ ) * 2 + 200 : parseInt(
63536
+ width.toString().endsWith("px") ? width == null ? void 0 : width.replace("px", "") : width
63537
+ ));
63538
+ var heightRatio = (parseInt(getComputedStyle(iframeParent).height) - 100) / parseInt(height.toString().replace("px", ""));
63515
63539
  var scale = Math.min(widthRatio, heightRatio);
63516
63540
  iframeParent.style.transform = "scale(" + scale + ")";
63517
63541
  for (const iframe of this.iframes) {