@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.
- package/components.json +30 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-file-viewer-audio_7.cjs.entry.js +8 -4
- package/dist/collection/assets/pdfjs/wasm/openjpeg_nowasm_fallback.js +29 -0
- package/dist/collection/components/swirl-file-viewer/viewers/swirl-file-viewer-pdf/swirl-file-viewer-pdf.js +28 -4
- package/dist/components/assets/pdfjs/pdf.worker.min.mjs +1 -1
- package/dist/components/swirl-file-viewer-pdf2.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-file-viewer-audio_7.entry.js +8 -4
- package/dist/swirl-components/{p-f4f36bbf.entry.js → p-4cb869b2.entry.js} +1 -1
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-file-viewer/viewers/swirl-file-viewer-pdf/swirl-file-viewer-pdf.d.ts +1 -0
- package/dist/types/components.d.ts +9 -0
- package/package.json +1 -1
- package/vscode-data.json +4 -0
|
@@ -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({
|
|
133
|
-
|
|
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: '
|
|
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: '
|
|
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,
|