pdf-tsx 0.17.5 → 0.17.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../_virtual/_rolldown/runtime.cjs`);
|
|
1
|
+
const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`react`),n=require(`pdfjs-dist`);n=e.__toESM(n,1),`getOrInsertComputed`in Map.prototype||(Map.prototype.getOrInsertComputed=function(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)});function r(e){let[r,i]=(0,t.useState)(null),[a,o]=(0,t.useState)(0),[s,c]=(0,t.useState)(!0);return(0,t.useEffect)(()=>{c(!0),i(null),o(0);let t=new FileReader;t.onload=async e=>{let t=new Uint8Array(e.target?.result);try{let e=await n.getDocument(t).promise;i(e),o(e.numPages)}catch(e){console.error(`Errore caricamento:`,e)}finally{c(!1)}},t.readAsArrayBuffer(e)},[e]),{pdf:r,numPages:a,loading:s}}exports.usePDFLoader=r;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import "../utils/polyfills.js";
|
|
2
1
|
import { useEffect as e, useState as t } from "react";
|
|
3
2
|
import * as n from "pdfjs-dist";
|
|
4
3
|
//#region src/hooks/usePDFLoader.ts
|
|
4
|
+
"getOrInsertComputed" in Map.prototype || (Map.prototype.getOrInsertComputed = function(e, t) {
|
|
5
|
+
return this.has(e) || this.set(e, t(e)), this.get(e);
|
|
6
|
+
});
|
|
5
7
|
function r(r) {
|
|
6
8
|
let [i, a] = t(null), [o, s] = t(0), [c, l] = t(!0);
|
|
7
9
|
return e(() => {
|
package/package.json
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pdf-tsx",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.6",
|
|
4
4
|
"description": "A fully-featured, composable PDF viewer component for React",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.cjs",
|
|
7
7
|
"module": "./dist/es/index.js",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"sideEffects":
|
|
10
|
-
"**/polyfills*"
|
|
11
|
-
],
|
|
9
|
+
"sideEffects": false,
|
|
12
10
|
"exports": {
|
|
13
11
|
".": {
|
|
14
12
|
"types": "./dist/index.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
`getOrInsertComputed`in Map.prototype||(Map.prototype.getOrInsertComputed=function(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)});
|