New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-fast-pdf

Package Overview
Dependencies
Maintainers
0
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-fast-pdf - npm Package Compare versions

Comparing version 1.0.14 to 1.0.15

22

dist/PageRenderer.d.ts
import React, { type CSSProperties } from 'react';
import PropTypes from 'prop-types';
type Props = {

@@ -18,23 +17,2 @@ index: number;

var displayName: string;
var propTypes: {
/** Index of the PDF page to be displayed passed by VariableSizeList */
index: PropTypes.Validator<number>;
/** Page extra data passed by VariableSizeList's data prop */
data: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
/** Width of a single page in the document */
pageWidth: PropTypes.Validator<number>;
/** The estimated height of a single page in the document */
estimatedPageHeight: PropTypes.Validator<number>;
/** Function that calculates the height of a page given its index */
calculatePageHeight: PropTypes.Validator<(...args: any[]) => any>;
/** Function that calculates the pixel ratio for a page given its calculated width and height */
getDevicePixelRatio: PropTypes.Validator<(...args: any[]) => any>;
/** The number of pages in the document */
numPages: PropTypes.Validator<number>;
/** The height of the container view */
containerHeight: PropTypes.Validator<number>;
}>>>;
/** Additional style props passed by VariableSizeList */
style: PropTypes.Validator<object>;
};
}

@@ -41,0 +19,0 @@ declare const _default: React.MemoExoticComponent<typeof PageRenderer>;

@@ -25,33 +25,7 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const prop_types_1 = __importDefault(require("prop-types"));
const react_pdf_1 = require("react-pdf");
const styles_1 = require("./styles");
const constants_1 = require("./constants");
const propTypes = {
/** Index of the PDF page to be displayed passed by VariableSizeList */
index: prop_types_1.default.number.isRequired,
/** Page extra data passed by VariableSizeList's data prop */
data: prop_types_1.default.shape({
/** Width of a single page in the document */
pageWidth: prop_types_1.default.number.isRequired,
/** The estimated height of a single page in the document */
estimatedPageHeight: prop_types_1.default.number.isRequired,
/** Function that calculates the height of a page given its index */
calculatePageHeight: prop_types_1.default.func.isRequired,
/** Function that calculates the pixel ratio for a page given its calculated width and height */
getDevicePixelRatio: prop_types_1.default.func.isRequired,
/** The number of pages in the document */
numPages: prop_types_1.default.number.isRequired,
/** The height of the container view */
containerHeight: prop_types_1.default.number.isRequired,
}).isRequired,
/** Additional style props passed by VariableSizeList */
// eslint-disable-next-line react/forbid-prop-types
style: prop_types_1.default.object.isRequired,
};
function PageRenderer({ index, style, data }) {

@@ -75,3 +49,2 @@ const { pageWidth, estimatedPageHeight, calculatePageHeight, getDevicePixelRatio, numPages, containerHeight } = data;

PageRenderer.displayName = 'PageRenderer';
PageRenderer.propTypes = propTypes;
exports.default = (0, react_1.memo)(PageRenderer);
import React from 'react';
import PropTypes from 'prop-types';
type Props = {

@@ -11,18 +10,2 @@ isPasswordInvalid?: boolean;

declare namespace PDFPasswordForm {
var propTypes: {
/** If the submitted password is invalid (show an error message) */
isPasswordInvalid: PropTypes.Requireable<boolean>;
/** Notify parent that the password form has been submitted */
onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
/** Notify parent that the password has been updated/edited */
onPasswordChange: PropTypes.Requireable<(...args: any[]) => any>;
/** Notify parent that a text field has been focused or blurred */
onPasswordFieldFocus: PropTypes.Requireable<(...args: any[]) => any>;
};
var defaultProps: {
isPasswordInvalid: boolean;
onSubmit: () => void;
onPasswordChange: () => void;
onPasswordFieldFocus: () => void;
};
var displayName: string;

@@ -29,0 +12,0 @@ }

@@ -25,26 +25,6 @@ "use strict";

};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importStar(require("react"));
const prop_types_1 = __importDefault(require("prop-types"));
const styles_1 = require("./styles");
const helpers_1 = require("./helpers");
const propTypes = {
/** If the submitted password is invalid (show an error message) */
isPasswordInvalid: prop_types_1.default.bool,
/** Notify parent that the password form has been submitted */
onSubmit: prop_types_1.default.func,
/** Notify parent that the password has been updated/edited */
onPasswordChange: prop_types_1.default.func,
/** Notify parent that a text field has been focused or blurred */
onPasswordFieldFocus: prop_types_1.default.func,
};
const defaultProps = {
isPasswordInvalid: false,
onSubmit: () => { },
onPasswordChange: () => { },
onPasswordFieldFocus: () => { },
};
function PDFPasswordForm({ isPasswordInvalid, onSubmit, onPasswordChange, onPasswordFieldFocus }) {

@@ -115,5 +95,3 @@ const [password, setPassword] = (0, react_1.useState)('');

}
PDFPasswordForm.propTypes = propTypes;
PDFPasswordForm.defaultProps = defaultProps;
PDFPasswordForm.displayName = 'PDFPasswordForm';
exports.default = PDFPasswordForm;

36

dist/PDFPreviewer.d.ts
import React from 'react';
import type { CSSProperties, ReactNode } from 'react';
import PropTypes from 'prop-types';
import 'react-pdf/dist/Page/AnnotationLayer.css';

@@ -11,5 +10,5 @@ import 'react-pdf/dist/Page/TextLayer.css';

isSmallScreen: boolean;
maxCanvasWidth: number | null;
maxCanvasHeight: number | null;
maxCanvasArea: number | null;
maxCanvasWidth?: number;
maxCanvasHeight?: number;
maxCanvasArea?: number;
renderPasswordForm?: ({ isPasswordInvalid, onSubmit, onPasswordChange }: Omit<PDFPasswordFormProps, 'onPasswordFieldFocus'>) => ReactNode | null;

@@ -24,33 +23,4 @@ LoadingComponent?: ReactNode;

declare function PDFPreviewer({ file, pageMaxWidth, isSmallScreen, maxCanvasWidth, maxCanvasHeight, maxCanvasArea, LoadingComponent, ErrorComponent, renderPasswordForm, containerStyle, contentContainerStyle, shouldShowErrorComponent, onLoadError, }: Props): React.JSX.Element;
declare namespace PDFPreviewer {
var propTypes: {
file: PropTypes.Validator<string>;
pageMaxWidth: PropTypes.Validator<number>;
isSmallScreen: PropTypes.Validator<boolean>;
maxCanvasWidth: PropTypes.Requireable<number>;
maxCanvasHeight: PropTypes.Requireable<number>;
maxCanvasArea: PropTypes.Requireable<number>;
renderPasswordForm: PropTypes.Requireable<(...args: any[]) => any>;
LoadingComponent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
ErrorComponent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
shouldShowErrorComponent: PropTypes.Requireable<boolean>;
onLoadError: PropTypes.Requireable<(...args: any[]) => any>;
containerStyle: PropTypes.Requireable<object>;
contentContainerStyle: PropTypes.Requireable<object>;
};
var defaultProps: {
maxCanvasWidth: null;
maxCanvasHeight: null;
maxCanvasArea: null;
renderPasswordForm: null;
LoadingComponent: React.JSX.Element;
ErrorComponent: React.JSX.Element;
shouldShowErrorComponent: boolean;
containerStyle: {};
contentContainerStyle: {};
onLoadError: () => void;
};
}
declare const _default: React.MemoExoticComponent<typeof PDFPreviewer>;
export default _default;
//# sourceMappingURL=PDFPreviewer.d.ts.map

@@ -30,7 +30,6 @@ "use strict";

// @ts-expect-error - This line imports a module from 'pdfjs-dist' package which lacks TypeScript typings.
// eslint-disable-next-line import/no-extraneous-dependencies
const pdf_worker_1 = __importDefault(require("pdfjs-dist/legacy/build/pdf.worker"));
// eslint-disable-next-line import/extensions
const pdf_worker_mjs_1 = __importDefault(require("pdfjs-dist/legacy/build/pdf.worker.mjs"));
const react_1 = __importStar(require("react"));
const times_1 = __importDefault(require("lodash/times"));
const prop_types_1 = __importDefault(require("prop-types"));
const react_window_1 = require("react-window");

@@ -45,33 +44,6 @@ const react_pdf_1 = require("react-pdf");

const helpers_1 = require("./helpers");
const propTypes = {
file: prop_types_1.default.string.isRequired,
pageMaxWidth: prop_types_1.default.number.isRequired,
isSmallScreen: prop_types_1.default.bool.isRequired,
maxCanvasWidth: prop_types_1.default.number,
maxCanvasHeight: prop_types_1.default.number,
maxCanvasArea: prop_types_1.default.number,
renderPasswordForm: prop_types_1.default.func,
LoadingComponent: prop_types_1.default.node,
ErrorComponent: prop_types_1.default.node,
shouldShowErrorComponent: prop_types_1.default.bool,
onLoadError: prop_types_1.default.func,
// eslint-disable-next-line react/forbid-prop-types
containerStyle: prop_types_1.default.object,
// eslint-disable-next-line react/forbid-prop-types
contentContainerStyle: prop_types_1.default.object,
};
const defaultProps = {
maxCanvasWidth: null,
maxCanvasHeight: null,
maxCanvasArea: null,
renderPasswordForm: null,
LoadingComponent: react_1.default.createElement("p", null, "Loading..."),
ErrorComponent: react_1.default.createElement("p", null, "Failed to load the PDF file :("),
shouldShowErrorComponent: true,
containerStyle: {},
contentContainerStyle: {},
onLoadError: () => { },
};
react_pdf_1.pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdf_worker_1.default], { type: 'text/javascript' }));
function PDFPreviewer({ file, pageMaxWidth, isSmallScreen, maxCanvasWidth, maxCanvasHeight, maxCanvasArea, LoadingComponent, ErrorComponent, renderPasswordForm, containerStyle, contentContainerStyle, shouldShowErrorComponent, onLoadError, }) {
react_pdf_1.pdfjs.GlobalWorkerOptions.workerSrc = URL.createObjectURL(new Blob([pdf_worker_mjs_1.default], { type: 'text/javascript' }));
const DefaultLoadingComponent = react_1.default.createElement("p", null, "Loading...");
const DefaultErrorComponent = react_1.default.createElement("p", null, "Failed to load the PDF file :(");
function PDFPreviewer({ file, pageMaxWidth, isSmallScreen, maxCanvasWidth, maxCanvasHeight, maxCanvasArea, LoadingComponent = DefaultLoadingComponent, ErrorComponent = DefaultErrorComponent, renderPasswordForm, containerStyle, contentContainerStyle, shouldShowErrorComponent = true, onLoadError, }) {
const [pageViewports, setPageViewports] = (0, react_1.useState)([]);

@@ -212,4 +184,2 @@ const [numPages, setNumPages] = (0, react_1.useState)(0);

PDFPasswordForm_1.default.displayName = 'PDFPreviewer';
PDFPreviewer.propTypes = propTypes;
PDFPreviewer.defaultProps = defaultProps;
exports.default = (0, react_1.memo)(PDFPreviewer);

7

package.json
{
"name": "react-fast-pdf",
"version": "1.0.14",
"version": "1.0.15",
"description": "react-fast-pdf",

@@ -32,3 +32,3 @@ "main": "./dist/index.js",

"dependencies": {
"react-pdf": "^7.7.0",
"react-pdf": "^9.1.1",
"react-window": "^1.8.10"

@@ -38,3 +38,3 @@ },

"lodash": "4.x",
"prop-types": "15.x",
"pdfjs-dist": "4.x",
"react": "18.x",

@@ -52,3 +52,2 @@ "react-dom": "18.x"

"@types/react-dom": "^18.2.7",
"@types/react-pdf": "^7.0.0",
"@types/react-window": "^1.8.5",

@@ -55,0 +54,0 @@ "@typescript-eslint/eslint-plugin": "^6.2.0",

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc