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

@react-pdf-viewer/get-file

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-pdf-viewer/get-file - npm Package Compare versions

Comparing version 2.4.1 to 2.4.2

48

lib/cjs/get-file.js

@@ -8,5 +8,27 @@ 'use strict';

function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
});
}
});
}
n['default'] = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var DownloadIcon = function () {
return (React.createElement(core.Icon, { size: 16 },
React.createElement("path", { d: "M17.5,11.5c3.314,0,6,2.686,6,6s-2.686,6-6,6s-6-2.686-6-6S14.186,11.5,17.5,11.5z\n M17.5,14.5v6\n M17.5,20.5\n l-2.25-2.25\n M17.5,20.5l2.25-2.25\n M10.5,23.5h-9c-0.552,0-1-0.448-1-1v-21c0-0.552,0.448-1,1-1h13.293\n c0.265,0,0.52,0.105,0.707,0.293L19.207,4.5C19.395,4.687,19.5,4.942,19.5,5.207V8.5" })));
return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M17.5,11.5c3.314,0,6,2.686,6,6s-2.686,6-6,6s-6-2.686-6-6S14.186,11.5,17.5,11.5z\n M17.5,14.5v6\n M17.5,20.5\n l-2.25-2.25\n M17.5,20.5l2.25-2.25\n M10.5,23.5h-9c-0.552,0-1-0.448-1-1v-21c0-0.552,0.448-1,1-1h13.293\n c0.265,0,0.52,0.105,0.707,0.293L19.207,4.5C19.395,4.687,19.5,4.942,19.5,5.207V8.5" })));
};

@@ -43,6 +65,6 @@

var onClick = _a.onClick;
var l10n = React.useContext(core.LocalizationContext);
var l10n = React__namespace.useContext(core.LocalizationContext);
var label = l10n && l10n.download ? l10n.download.download : 'Download';
return (React.createElement(core.Tooltip, { position: core.Position.BottomCenter, target: React.createElement(core.Button, { onClick: onClick },
React.createElement(DownloadIcon, null)), content: function () { return label; }, offset: TOOLTIP_OFFSET }));
return (React__namespace.createElement(core.Tooltip, { position: core.Position.BottomCenter, target: React__namespace.createElement(core.Button, { onClick: onClick },
React__namespace.createElement(DownloadIcon, null)), content: function () { return label; }, offset: TOOLTIP_OFFSET }));
};

@@ -53,3 +75,3 @@

? ''
: URL.createObjectURL(new Blob([file.data], { type: '' }));
: URL.createObjectURL(new Blob([file.data], { type: 'application/pdf' }));
var link = document.createElement('a');

@@ -69,7 +91,7 @@ link.style.display = 'none';

var children = _a.children, fileNameGenerator = _a.fileNameGenerator, store = _a.store;
var _b = React.useState(store.get('file')), currentFile = _b[0], setCurrentFile = _b[1];
var _b = React__namespace.useState(store.get('file')), currentFile = _b[0], setCurrentFile = _b[1];
var handleFileChanged = function (file) {
setCurrentFile(file);
};
React.useEffect(function () {
React__namespace.useEffect(function () {
store.subscribe('file', handleFileChanged);

@@ -85,3 +107,3 @@ return function () {

};
var defaultChildren = function (props) { return React.createElement(DownloadButton, { onClick: props.onClick }); };
var defaultChildren = function (props) { return React__namespace.createElement(DownloadButton, { onClick: props.onClick }); };
var render = children || defaultChildren;

@@ -99,6 +121,6 @@ return render({

var getFilePlugin = function (props) {
var store = React.useMemo(function () { return core.createStore({}); }, []);
var defaultFileNameGenerator = function (file) { return getFileName(file.name); };
var DownloadDecorator = function (downloadProps) { return (React.createElement(Download, __assign({}, downloadProps, { fileNameGenerator: props ? (props.fileNameGenerator || defaultFileNameGenerator) : defaultFileNameGenerator, store: store }))); };
var DownloadButtonDecorator = function () { return (React.createElement(DownloadDecorator, null, function (props) { return React.createElement(DownloadButton, __assign({}, props)); })); };
var store = React__namespace.useMemo(function () { return core.createStore({}); }, []);
var defaultFileNameGenerator = function (file) { return (typeof file.data === 'object') ? 'document.pdf' : getFileName(file.name); };
var DownloadDecorator = function (downloadProps) { return (React__namespace.createElement(Download, __assign({}, downloadProps, { fileNameGenerator: props ? (props.fileNameGenerator || defaultFileNameGenerator) : defaultFileNameGenerator, store: store }))); };
var DownloadButtonDecorator = function () { return (React__namespace.createElement(DownloadDecorator, null, function (props) { return React__namespace.createElement(DownloadButton, __assign({}, props)); })); };
return {

@@ -105,0 +127,0 @@ onViewerStateChange: function (viewerState) {

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core"),n=function(){return e.createElement(t.Icon,{size:16},e.createElement("path",{d:"M17.5,11.5c3.314,0,6,2.686,6,6s-2.686,6-6,6s-6-2.686-6-6S14.186,11.5,17.5,11.5z\n M17.5,14.5v6\n M17.5,20.5\n l-2.25-2.25\n M17.5,20.5l2.25-2.25\n M10.5,23.5h-9c-0.552,0-1-0.448-1-1v-21c0-0.552,0.448-1,1-1h13.293\n c0.265,0,0.52,0.105,0.707,0.293L19.207,4.5C19.395,4.687,19.5,4.942,19.5,5.207V8.5"}))},r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},o={left:0,top:8},c=function(r){var c=r.onClick,i=e.useContext(t.LocalizationContext),a=i&&i.download?i.download.download:"Download";return e.createElement(t.Tooltip,{position:t.Position.BottomCenter,target:e.createElement(t.Button,{onClick:c},e.createElement(n,null)),content:function(){return a},offset:o})},i=function(t){var n=t.children,r=t.fileNameGenerator,o=t.store,i=e.useState(o.get("file")),a=i[0],l=i[1],u=function(e){l(e)};e.useEffect((function(){return o.subscribe("file",u),function(){o.unsubscribe("file",u)}}),[]);return(n||function(t){return e.createElement(c,{onClick:t.onClick})})({onClick:function(){var e,t,n,o;a&&(e=a,t=r(a),n="string"==typeof e.data?"":URL.createObjectURL(new Blob([e.data],{type:""})),(o=document.createElement("a")).style.display="none",o.href=n||e.name,o.setAttribute("download",t),document.body.appendChild(o),o.click(),document.body.removeChild(o),n&&URL.revokeObjectURL(n))}})};exports.DownloadIcon=n,exports.getFilePlugin=function(n){var o=e.useMemo((function(){return t.createStore({})}),[]),a=function(e){return t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t;var t,n},l=function(t){return e.createElement(i,r({},t,{fileNameGenerator:n&&n.fileNameGenerator||a,store:o}))};return{onViewerStateChange:function(e){return o.update("file",e.file),e},Download:l,DownloadButton:function(){return e.createElement(l,null,(function(t){return e.createElement(c,r({},t))}))}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("@react-pdf-viewer/core");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var r=n(e),o=function(){return r.createElement(t.Icon,{size:16},r.createElement("path",{d:"M17.5,11.5c3.314,0,6,2.686,6,6s-2.686,6-6,6s-6-2.686-6-6S14.186,11.5,17.5,11.5z\n M17.5,14.5v6\n M17.5,20.5\n l-2.25-2.25\n M17.5,20.5l2.25-2.25\n M10.5,23.5h-9c-0.552,0-1-0.448-1-1v-21c0-0.552,0.448-1,1-1h13.293\n c0.265,0,0.52,0.105,0.707,0.293L19.207,4.5C19.395,4.687,19.5,4.942,19.5,5.207V8.5"}))},c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},i={left:0,top:8},a=function(e){var n=e.onClick,c=r.useContext(t.LocalizationContext),a=c&&c.download?c.download.download:"Download";return r.createElement(t.Tooltip,{position:t.Position.BottomCenter,target:r.createElement(t.Button,{onClick:n},r.createElement(o,null)),content:function(){return a},offset:i})},u=function(e){var t=e.children,n=e.fileNameGenerator,o=e.store,c=r.useState(o.get("file")),i=c[0],u=c[1],l=function(e){u(e)};r.useEffect((function(){return o.subscribe("file",l),function(){o.unsubscribe("file",l)}}),[]);return(t||function(e){return r.createElement(a,{onClick:e.onClick})})({onClick:function(){var e,t,r,o;i&&(e=i,t=n(i),r="string"==typeof e.data?"":URL.createObjectURL(new Blob([e.data],{type:"application/pdf"})),(o=document.createElement("a")).style.display="none",o.href=r||e.name,o.setAttribute("download",t),document.body.appendChild(o),o.click(),document.body.removeChild(o),r&&URL.revokeObjectURL(r))}})};exports.DownloadIcon=o,exports.getFilePlugin=function(e){var n=r.useMemo((function(){return t.createStore({})}),[]),o=function(e){return"object"==typeof e.data?"document.pdf":(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t);var t,n},i=function(t){return r.createElement(u,c({},t,{fileNameGenerator:e&&e.fileNameGenerator||o,store:n}))};return{onViewerStateChange:function(e){return n.update("file",e.file),e},Download:i,DownloadButton:function(){return r.createElement(i,null,(function(e){return r.createElement(a,c({},e))}))}}};
{
"name": "@react-pdf-viewer/get-file",
"version": "2.4.1",
"version": "2.4.2",
"description": "A React component to view a PDF document",

@@ -36,3 +36,3 @@ "license": "https://react-pdf-viewer.dev/license",

"dependencies": {
"@react-pdf-viewer/core": "2.4.1"
"@react-pdf-viewer/core": "2.4.2"
},

@@ -50,3 +50,3 @@ "peerDependencies": {

},
"gitHead": "ecc13b17c4b2ce670b4faca550ec036ead8425da"
"gitHead": "cdcbd1484baab181f5a5c9ee2e0b82bd6481cdc6"
}
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