@getflip/swirl-components 0.459.0 → 0.459.1

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.
@@ -9,6 +9,7 @@ export class SwirlFileViewerPdf {
9
9
  this.errorMessage = "File could not be loaded.";
10
10
  this.viewMode = "single";
11
11
  this.workerSrc = "/pdfjs/pdf.worker.min.mjs";
12
+ this.wasmUrl = "/pdfjs/wasm/";
12
13
  this.zoom = 1;
13
14
  this.currentPage = null;
14
15
  this.loading = true;
@@ -129,8 +130,11 @@ export class SwirlFileViewerPdf {
129
130
  this.doc.destroy();
130
131
  }
131
132
  // Don't remove the isEvalSupported property. https://github.com/advisories/GHSA-wgrm-67xf-hhpq
132
- this.doc = await getDocument({ isEvalSupported: false, url: this.file })
133
- .promise;
133
+ this.doc = await getDocument({
134
+ isEvalSupported: false,
135
+ url: this.file,
136
+ wasmUrl: this.wasmUrl,
137
+ }).promise;
134
138
  const pages = [];
135
139
  for (let i = 1; i <= this.doc.numPages; i++) {
136
140
  pages.push(this.doc.getPage(i));
@@ -392,7 +396,7 @@ export class SwirlFileViewerPdf {
392
396
  const showPagination = !this.error && !this.loading && this.visiblePages.length > 0;
393
397
  const showSpinner = this.loading;
394
398
  const className = classnames("file-viewer-pdf", `file-viewer-pdf--view-mode-${this.viewMode}`);
395
- return (h(Host, { key: 'c2cb9cff7ac4f4205a4dcfb3b59cf4377833d972', class: className, exportparts: "file-viewer-pdf__pagination" }, this.error && (h("swirl-inline-error", { key: '66f9453e61c63ee695e34c5de5fef417bb31741b', class: "file-viewer-pdf__error", message: this.errorMessage })), h("div", { key: '7e1c09b1becfe70ede745e3953ff5495cb8ebd2b', "aria-describedby": "pagination", class: "file-viewer-pdf__pages", onScroll: this.onScroll, ref: (el) => (this.scrollContainer = el) }, this.pages.map((page) => {
399
+ return (h(Host, { key: 'd977930ae1c59c9cb11bab634a45b38aa6b289b3', class: className, exportparts: "file-viewer-pdf__pagination" }, this.error && (h("swirl-inline-error", { key: '1599701f41b105e5da3e22f993b936774038534f', class: "file-viewer-pdf__error", message: this.errorMessage })), h("div", { key: 'e38c6cab8ac2f2fff08e1795dc22bb0d8798b45f', "aria-describedby": "pagination", class: "file-viewer-pdf__pages", onScroll: this.onScroll, ref: (el) => (this.scrollContainer = el) }, this.pages.map((page) => {
396
400
  const viewport = page.getViewport({
397
401
  scale: this.getScale(page),
398
402
  });
@@ -406,7 +410,7 @@ export class SwirlFileViewerPdf {
406
410
  width: `${width}px`,
407
411
  height: `${height}px`,
408
412
  }, tabIndex: 0 }, !rendered && (h("swirl-spinner", { class: "file-viewer-pdf__page-spinner" })), h("canvas", { class: "file-viewer-pdf__canvas", style: { opacity: rendered ? "1" : "0" } }), h("div", { class: "file-viewer-pdf__text-container" }), h("div", { class: "file-viewer-pdf__annotation-container" })));
409
- })), showPagination && (h("span", { key: '99e4985be05610192738e613b3600a8df82744f9', class: "file-viewer-pdf__pagination", id: "pagination", part: "file-viewer-pdf__pagination" }, h("span", { key: '947826c1a6d2e955d4dfbff9ced5e5f6cb0e40cd', "aria-current": "page" }, this.currentPage), " /", " ", this.doc.numPages)), showSpinner && (h("div", { key: '417aa0f4011f78486cc8bb0bc214c0c14edf4497', class: "file-viewer-pdf__spinner" }, h("swirl-spinner", { key: '6c1f8146da3b48420b8abf30673836acc992fa8d' })))));
413
+ })), showPagination && (h("span", { key: 'd61abeb592dc3c50aeeca9de1a7646e385137684', class: "file-viewer-pdf__pagination", id: "pagination", part: "file-viewer-pdf__pagination" }, h("span", { key: 'ad4f2f10f4b6578fcf8dc1b331515faa6a0fb050', "aria-current": "page" }, this.currentPage), " /", " ", this.doc.numPages)), showSpinner && (h("div", { key: '03a53c31b2875e3b4f89c85fcef65254e52f915b', class: "file-viewer-pdf__spinner" }, h("swirl-spinner", { key: '0f63537fa4e277677a0a55ecde25122c51b3f7eb' })))));
410
414
  }
411
415
  static get is() { return "swirl-file-viewer-pdf"; }
412
416
  static get encapsulation() { return "shadow"; }
@@ -526,6 +530,26 @@ export class SwirlFileViewerPdf {
526
530
  "attribute": "worker-src",
527
531
  "defaultValue": "\"/pdfjs/pdf.worker.min.mjs\""
528
532
  },
533
+ "wasmUrl": {
534
+ "type": "string",
535
+ "mutable": false,
536
+ "complexType": {
537
+ "original": "string",
538
+ "resolved": "string",
539
+ "references": {}
540
+ },
541
+ "required": false,
542
+ "optional": true,
543
+ "docs": {
544
+ "tags": [],
545
+ "text": ""
546
+ },
547
+ "getter": false,
548
+ "setter": false,
549
+ "reflect": false,
550
+ "attribute": "wasm-url",
551
+ "defaultValue": "\"/pdfjs/wasm/\""
552
+ },
529
553
  "zoom": {
530
554
  "type": "any",
531
555
  "mutable": false,