vue-book-reader 1.2.7 → 1.2.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.
@@ -2806,17 +2806,6 @@ let View$1 = class View extends HTMLElement {
2806
2806
  await this.next();
2807
2807
  }
2808
2808
  }
2809
- getLabelByFraction(fraction) {
2810
- if (!this.#sectionProgress || !this.#tocProgress) return null;
2811
- try {
2812
- const [index] = this.#sectionProgress.getSection(fraction);
2813
- if (index == null) return null;
2814
- const tocItem = this.#tocProgress.getProgress(index, null);
2815
- return (tocItem == null ? void 0 : tocItem.label) || null;
2816
- } catch (e2) {
2817
- return null;
2818
- }
2819
- }
2820
2809
  #emit(name, detail, cancelable) {
2821
2810
  return this.dispatchEvent(new CustomEvent(name, { detail, cancelable }));
2822
2811
  }
@@ -2850,7 +2839,7 @@ let View$1 = class View extends HTMLElement {
2850
2839
  const href_ = a2.getAttribute("href");
2851
2840
  const href = ((_a = section == null ? void 0 : section.resolveHref) == null ? void 0 : _a.call(section, href_)) ?? href_;
2852
2841
  if ((_b = book == null ? void 0 : book.isExternal) == null ? void 0 : _b.call(book, href))
2853
- Promise.resolve(this.#emit("external-link", { a: a2, href }, true)).then((x2) => x2 ? globalThis.open(href, "_blank") : null).catch((e3) => console.error(e3));
2842
+ Promise.resolve(this.#emit("external-link", { a: a2, href_ }, true)).then((x2) => x2 ? globalThis.open(href_, "_blank") : null).catch((e3) => console.error(e3));
2854
2843
  else Promise.resolve(this.#emit("link", { a: a2, href }, true)).then((x2) => x2 ? this.goTo(href) : null).catch((e3) => console.error(e3));
2855
2844
  });
2856
2845
  }
@@ -2960,6 +2949,12 @@ let View$1 = class View extends HTMLElement {
2960
2949
  await this.renderer.goTo({ index, anchor });
2961
2950
  this.history.pushState({ fraction: frac });
2962
2951
  }
2952
+ labelFromPercentage(frac) {
2953
+ if (!this.#sectionProgress || !this.#tocProgress) return null;
2954
+ const [index] = this.#sectionProgress.getSection(frac);
2955
+ const tocItem = this.#tocProgress.getProgress(index);
2956
+ return (tocItem == null ? void 0 : tocItem.label) ?? null;
2957
+ }
2963
2958
  async select(target) {
2964
2959
  try {
2965
2960
  const obj = await this.resolveNavigation(target);
@@ -5580,6 +5575,7 @@ const makeFB2 = async (blob) => {
5580
5575
  return ((_a = href == null ? void 0 : href.split("#")) == null ? void 0 : _a.map((x2) => Number(x2))) ?? [];
5581
5576
  };
5582
5577
  book.getTOCFragment = (doc2, id) => doc2.querySelector(`[${dataID}="${id}"]`);
5578
+ book.isExternal = (uri) => /^\w+:/i.test(uri);
5583
5579
  book.destroy = () => {
5584
5580
  for (const url of urls) URL.revokeObjectURL(url);
5585
5581
  };
@@ -6093,8 +6089,8 @@ const makePDF = async (file) => {
6093
6089
  };
6094
6090
  const pdf2 = await pdfjsLib.getDocument({
6095
6091
  range: transport,
6096
- cMapUrl: pdfjsPath("cmaps/"),
6097
- standardFontDataUrl: pdfjsPath("standard_fonts/"),
6092
+ // cMapUrl: pdfjsPath('cmaps/'),
6093
+ // standardFontDataUrl: pdfjsPath('standard_fonts/'),
6098
6094
  isEvalSupported: false
6099
6095
  }).promise;
6100
6096
  const book = { rendition: { layout: "pre-paginated" } };
@@ -2813,17 +2813,6 @@
2813
2813
  await this.next();
2814
2814
  }
2815
2815
  }
2816
- getLabelByFraction(fraction) {
2817
- if (!this.#sectionProgress || !this.#tocProgress) return null;
2818
- try {
2819
- const [index] = this.#sectionProgress.getSection(fraction);
2820
- if (index == null) return null;
2821
- const tocItem = this.#tocProgress.getProgress(index, null);
2822
- return (tocItem == null ? void 0 : tocItem.label) || null;
2823
- } catch (e2) {
2824
- return null;
2825
- }
2826
- }
2827
2816
  #emit(name, detail, cancelable) {
2828
2817
  return this.dispatchEvent(new CustomEvent(name, { detail, cancelable }));
2829
2818
  }
@@ -2857,7 +2846,7 @@
2857
2846
  const href_ = a2.getAttribute("href");
2858
2847
  const href = ((_a = section == null ? void 0 : section.resolveHref) == null ? void 0 : _a.call(section, href_)) ?? href_;
2859
2848
  if ((_b = book == null ? void 0 : book.isExternal) == null ? void 0 : _b.call(book, href))
2860
- Promise.resolve(this.#emit("external-link", { a: a2, href }, true)).then((x2) => x2 ? globalThis.open(href, "_blank") : null).catch((e3) => console.error(e3));
2849
+ Promise.resolve(this.#emit("external-link", { a: a2, href_ }, true)).then((x2) => x2 ? globalThis.open(href_, "_blank") : null).catch((e3) => console.error(e3));
2861
2850
  else Promise.resolve(this.#emit("link", { a: a2, href }, true)).then((x2) => x2 ? this.goTo(href) : null).catch((e3) => console.error(e3));
2862
2851
  });
2863
2852
  }
@@ -2967,6 +2956,12 @@
2967
2956
  await this.renderer.goTo({ index, anchor });
2968
2957
  this.history.pushState({ fraction: frac });
2969
2958
  }
2959
+ labelFromPercentage(frac) {
2960
+ if (!this.#sectionProgress || !this.#tocProgress) return null;
2961
+ const [index] = this.#sectionProgress.getSection(frac);
2962
+ const tocItem = this.#tocProgress.getProgress(index);
2963
+ return (tocItem == null ? void 0 : tocItem.label) ?? null;
2964
+ }
2970
2965
  async select(target) {
2971
2966
  try {
2972
2967
  const obj = await this.resolveNavigation(target);
@@ -5587,6 +5582,7 @@ body:not(.notesBodyType) > .title, body:not(.notesBodyType) > .epigraph {
5587
5582
  return ((_a = href == null ? void 0 : href.split("#")) == null ? void 0 : _a.map((x2) => Number(x2))) ?? [];
5588
5583
  };
5589
5584
  book.getTOCFragment = (doc2, id) => doc2.querySelector(`[${dataID}="${id}"]`);
5585
+ book.isExternal = (uri) => /^\w+:/i.test(uri);
5590
5586
  book.destroy = () => {
5591
5587
  for (const url of urls) URL.revokeObjectURL(url);
5592
5588
  };
@@ -6100,8 +6096,8 @@ body:not(.notesBodyType) > .title, body:not(.notesBodyType) > .epigraph {
6100
6096
  };
6101
6097
  const pdf2 = await pdfjsLib.getDocument({
6102
6098
  range: transport,
6103
- cMapUrl: pdfjsPath("cmaps/"),
6104
- standardFontDataUrl: pdfjsPath("standard_fonts/"),
6099
+ // cMapUrl: pdfjsPath('cmaps/'),
6100
+ // standardFontDataUrl: pdfjsPath('standard_fonts/'),
6105
6101
  isEvalSupported: false
6106
6102
  }).promise;
6107
6103
  const book = { rendition: { layout: "pre-paginated" } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-book-reader",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "type": "module",
5
5
  "main": "dist/vue-book-reader.umd.js",
6
6
  "module": "dist/vue-book-reader.es.js",