@d-i-t-a/reader 2.0.0-beta.17 → 2.0.0-beta.18

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
@@ -49069,6 +49069,10 @@ var iconTemplate = (id2, title, path, classAttr = `icon`) => `<svg xmlns="http:/
49069
49069
  <title id="${id2}">${title}</title>
49070
49070
  ${path}
49071
49071
  </svg>`;
49072
+ var iconTemplateWithViewBox = (id2, title, path, viewBox, classAttr = `icon`) => `<svg xmlns="http://www.w3.org/2000/svg" width="${WIDTH_ATTR}" height="${WIDTH_ATTR}" viewBox="${viewBox}" preserveAspectRatio="xMidYMid meet" role="img" class="${classAttr}" aria-labelledBy="${id2}">
49073
+ <title id="${id2}">${title}</title>
49074
+ ${path}
49075
+ </svg>`;
49072
49076
  var iconTemplateColored = (id2, title, path, classAttr = `icon`, size, fill) => `<svg xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" viewBox="${VIEWBOX_ATTR}" style="fill:${fill}" preserveAspectRatio="xMidYMid meet" role="img" class="${classAttr}" aria-labelledBy="${id2}">
49073
49077
  <title id="${id2}">${title}</title>
49074
49078
  ${path}
@@ -49077,7 +49081,7 @@ var icons = {
49077
49081
  error: iconTemplate(`error-icon`, `Warning`, `<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>`),
49078
49082
  home: `<path d="M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z"/>`,
49079
49083
  expand: iconTemplate(`expand-icon`, `Enter fullscreen`, `<path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/>`, `icon active-icon`),
49080
- loading: iconTemplate(`loading-icon`, `Loading`, `<path d="M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z"/>`),
49084
+ loading: iconTemplateWithViewBox(`loading-icon`, `Loading`, `<path fill="#BBBBBB" d="M145,241.6c-53.3,0-96.6-43.2-96.6-96.6c0-53.3,43.2-96.6,96.6-96.6c53.3,0,96.6,43.2,96.6,96.6 c0,26.7-10.8,50.9-28.3,68.3l7.6,7.6c19.4-19.4,31.5-46.3,31.5-75.9c0-59.3-48-107.3-107.3-107.3S37.7,85.7,37.7,145 c0,59.3,48,107.3,107.3,107.3V241.6z"/>`, "0 0 290 290"),
49081
49085
  next: iconTemplate(`next-icon`, `Next Chapter`, `<path d="M6.49 20.13l1.77 1.77 9.9-9.9-9.9-9.9-1.77 1.77L14.62 12l-8.13 8.13z"/>`),
49082
49086
  previous: iconTemplate(`previous-icon`, `Previous Chapter`, `<path d="M17.51 3.87L15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"/>`),
49083
49087
  settings: iconTemplate(`settings-icon`, `Settings`, `<path d="M19.43 12.98c.04-.32.07-.64.07-.98 0-.34-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.09-.16-.26-.25-.44-.25-.06 0-.12.01-.17.03l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.06-.02-.12-.03-.18-.03-.17 0-.34.09-.43.25l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98 0 .33.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.09.16.26.25.44.25.06 0 .12-.01.17-.03l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.06.02.12.03.18.03.17 0 .34-.09.43-.25l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-1.98-1.71c.04.31.05.52.05.73 0 .21-.02.43-.05.73l-.14 1.13.89.7 1.08.84-.7 1.21-1.27-.51-1.04-.42-.9.68c-.43.32-.84.56-1.25.73l-1.06.43-.16 1.13-.2 1.35h-1.4l-.19-1.35-.16-1.13-1.06-.43c-.43-.18-.83-.41-1.23-.71l-.91-.7-1.06.43-1.27.51-.7-1.21 1.08-.84.89-.7-.14-1.13c-.03-.31-.05-.54-.05-.74s.02-.43.05-.73l.14-1.13-.89-.7-1.08-.84.7-1.21 1.27.51 1.04.42.9-.68c.43-.32.84-.56 1.25-.73l1.06-.43.16-1.13.2-1.35h1.39l.19 1.35.16 1.13 1.06.43c.43.18.83.41 1.23.71l.91.7 1.06-.43 1.27-.51.7 1.21-1.07.85-.89.7.14 1.13zM12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/>`, `icon open`),
@@ -59739,6 +59743,11 @@ var LineFocusModule = class {
59739
59743
  if (IS_DEV) {
59740
59744
  console.log("Definitions module stop");
59741
59745
  }
59746
+ this.hasEventListener = false;
59747
+ removeEventListenerOptional(document, "keydown", this.keydown.bind(this));
59748
+ removeEventListenerOptional(document, "keyup", this.keyup.bind(this));
59749
+ removeEventListenerOptional(this.delegate.iframes[0].contentDocument, "keydown", this.keydown.bind(this));
59750
+ removeEventListenerOptional(this.delegate.iframes[0].contentDocument, "keyup", this.keyup.bind(this));
59742
59751
  }
59743
59752
  async start() {
59744
59753
  this.delegate.lineFocusModule = this;
@@ -59754,9 +59763,16 @@ var LineFocusModule = class {
59754
59763
  this.readerContainer.style.overflow = "hidden";
59755
59764
  }
59756
59765
  }
59766
+ if (!this.hasEventListener) {
59767
+ this.hasEventListener = true;
59768
+ addEventListenerOptional(document, "keydown", this.keydown.bind(this));
59769
+ addEventListenerOptional(document, "keyup", this.keyup.bind(this));
59770
+ addEventListenerOptional(this.delegate.iframes[0].contentDocument, "keydown", this.keydown.bind(this));
59771
+ addEventListenerOptional(this.delegate.iframes[0].contentDocument, "keyup", this.keyup.bind(this));
59772
+ }
59757
59773
  }
59758
59774
  keydown(event) {
59759
- if (event instanceof KeyboardEvent) {
59775
+ if (event instanceof KeyboardEvent && this.isActive) {
59760
59776
  const key = event.key;
59761
59777
  switch (key) {
59762
59778
  case "ArrowUp":
@@ -59769,7 +59785,7 @@ var LineFocusModule = class {
59769
59785
  }
59770
59786
  }
59771
59787
  keyup(event) {
59772
- if (event instanceof KeyboardEvent) {
59788
+ if (event instanceof KeyboardEvent && this.isActive) {
59773
59789
  const key = event.key;
59774
59790
  switch (key) {
59775
59791
  case "ArrowUp":
@@ -59790,29 +59806,12 @@ var LineFocusModule = class {
59790
59806
  this.isActive = true;
59791
59807
  await this.delegate.settings.scroll(true);
59792
59808
  this.lineFocus();
59793
- if (!this.hasEventListener) {
59794
- this.hasEventListener = true;
59795
- addEventListenerOptional(document, "keydown", this.keydown.bind(this));
59796
- addEventListenerOptional(document, "keyup", this.keyup.bind(this));
59797
- addEventListenerOptional(this.delegate.iframes[0].contentDocument, "keydown", this.keydown.bind(this));
59798
- addEventListenerOptional(this.delegate.iframes[0].contentDocument, "keyup", this.keyup.bind(this));
59799
- }
59800
59809
  }
59801
59810
  disableLineFocus(resetHeight = true) {
59802
59811
  this.isActive = false;
59803
- if (this.hasEventListener) {
59804
- this.hasEventListener = false;
59805
- removeEventListenerOptional(document, "keydown", this.keydown.bind(this));
59806
- removeEventListenerOptional(document, "keyup", this.keyup.bind(this));
59807
- removeEventListenerOptional(this.delegate.iframes[0].contentDocument, "keydown", this.keydown.bind(this));
59808
- removeEventListenerOptional(this.delegate.iframes[0].contentDocument, "keyup", this.keyup.bind(this));
59809
- }
59810
59812
  const wrapper = findRequiredElement(document, "#iframe-wrapper");
59811
59813
  if (this.wrapperHeight) {
59812
59814
  wrapper.style.height = this.wrapperHeight;
59813
- } else if (resetHeight) {
59814
- this.index = 0;
59815
- wrapper.style.removeProperty("height");
59816
59815
  }
59817
59816
  if (!resetHeight) {
59818
59817
  this.index = 0;