react-fast-pdf
Advanced tools
Comparing version 1.0.24 to 1.0.25
@@ -10,2 +10,3 @@ /** | ||
declare const isSafari: () => boolean; | ||
declare const isModernSafari: () => boolean; | ||
type ListRef = { | ||
@@ -19,3 +20,3 @@ tabIndex: number; | ||
declare const setListAttributes: (ref: ListRef | undefined) => void; | ||
export { getBrowser, isMobileSafari, isSafari, setListAttributes }; | ||
export { getBrowser, isMobileSafari, isSafari, isModernSafari, setListAttributes }; | ||
//# sourceMappingURL=helpers.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.setListAttributes = exports.isSafari = exports.isMobileSafari = exports.getBrowser = void 0; | ||
exports.setListAttributes = exports.isModernSafari = exports.isSafari = exports.isMobileSafari = exports.getBrowser = void 0; | ||
/** | ||
@@ -40,2 +40,8 @@ * Fetch browser name from UA string | ||
exports.isSafari = isSafari; | ||
const isModernSafari = () => { | ||
const version = navigator.userAgent.match(/OS (\d+_\d+)/); | ||
const iosVersion = version ? version[1].replace('_', '.') : ''; | ||
return parseFloat(iosVersion) >= 18; | ||
}; | ||
exports.isModernSafari = isModernSafari; | ||
/** | ||
@@ -42,0 +48,0 @@ * Sets attributes to list container. |
@@ -29,4 +29,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// @ts-expect-error - This line imports a module from 'pdfjs-dist' package which lacks TypeScript typings. | ||
// eslint-disable-next-line import/extensions | ||
const pdf_worker_min_mjs_1 = __importDefault(require("pdfjs-dist/build/pdf.worker.min.mjs")); | ||
// eslint-disable-next-line import/extensions | ||
const pdf_worker_mjs_1 = __importDefault(require("pdfjs-dist/legacy/build/pdf.worker.mjs")); | ||
@@ -44,3 +45,6 @@ const react_1 = __importStar(require("react")); | ||
const helpers_1 = require("./helpers"); | ||
react_pdf_1.pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdf_worker_mjs_1.default], { type: 'text/javascript' })); | ||
const shouldUseLegacyWorker = (0, helpers_1.isMobileSafari)() && !(0, helpers_1.isModernSafari)(); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const pdfWorker = shouldUseLegacyWorker ? pdf_worker_mjs_1.default : pdf_worker_min_mjs_1.default; | ||
react_pdf_1.pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdfWorker], { type: 'text/javascript' })); | ||
const DefaultLoadingComponent = react_1.default.createElement("p", null, "Loading..."); | ||
@@ -47,0 +51,0 @@ const DefaultErrorComponent = react_1.default.createElement("p", null, "Failed to load the PDF file :("); |
{ | ||
"name": "react-fast-pdf", | ||
"version": "1.0.24", | ||
"version": "1.0.25", | ||
"description": "react-fast-pdf", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
@@ -42,2 +42,9 @@ /** | ||
const isModernSafari = (): boolean => { | ||
const version = navigator.userAgent.match(/OS (\d+_\d+)/); | ||
const iosVersion = version ? version[1].replace('_', '.') : ''; | ||
return parseFloat(iosVersion) >= 18; | ||
}; | ||
type ListRef = { | ||
@@ -64,2 +71,2 @@ tabIndex: number; | ||
export {getBrowser, isMobileSafari, isSafari, setListAttributes}; | ||
export {getBrowser, isMobileSafari, isSafari, isModernSafari, setListAttributes}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59671
35
1256