Huge News!Announcing our $40M Series B led by Abstract Ventures.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.3 to 2.5.0

9

lib/cjs/get-file.js

@@ -110,2 +110,9 @@ 'use strict';

var DownloadMenuItem = function (_a) {
var onClick = _a.onClick;
var l10n = React__namespace.useContext(core.LocalizationContext);
var label = l10n && l10n.download ? l10n.download.download : 'Download';
return (React__namespace.createElement(core.MenuItem, { icon: React__namespace.createElement(DownloadIcon, null), onClick: onClick }, label));
};
var getFileName = function (url) {

@@ -121,2 +128,3 @@ var str = url.split('/').pop();

var DownloadButtonDecorator = function () { return (React__namespace.createElement(DownloadDecorator, null, function (props) { return React__namespace.createElement(DownloadButton, __assign({}, props)); })); };
var DownloadMenuItemDecorator = function (props) { return (React__namespace.createElement(DownloadDecorator, null, function (p) { return React__namespace.createElement(DownloadMenuItem, { onClick: function () { p.onClick(); props.onClick(); } }); })); };
return {

@@ -129,2 +137,3 @@ onViewerStateChange: function (viewerState) {

DownloadButton: DownloadButtonDecorator,
DownloadMenuItem: DownloadMenuItemDecorator,
};

@@ -131,0 +140,0 @@ };

2

lib/cjs/get-file.min.js

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

"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))}))}}};
"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 o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var o=n(e),r=function(){return o.createElement(t.Icon,{size:16},o.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,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},l={left:0,top:8},i=function(e){var n=e.onClick,c=o.useContext(t.LocalizationContext),i=c&&c.download?c.download.download:"Download";return o.createElement(t.Tooltip,{position:t.Position.BottomCenter,target:o.createElement(t.Button,{onClick:n},o.createElement(r,null)),content:function(){return i},offset:l})},a=function(e){var t=e.children,n=e.fileNameGenerator,r=e.store,c=o.useState(r.get("file")),l=c[0],a=c[1],u=function(e){a(e)};o.useEffect((function(){return r.subscribe("file",u),function(){r.unsubscribe("file",u)}}),[]);return(t||function(e){return o.createElement(i,{onClick:e.onClick})})({onClick:function(){var e,t,o,r;l&&(e=l,t=n(l),o="string"==typeof e.data?"":URL.createObjectURL(new Blob([e.data],{type:"application/pdf"})),(r=document.createElement("a")).style.display="none",r.href=o||e.name,r.setAttribute("download",t),document.body.appendChild(r),r.click(),document.body.removeChild(r),o&&URL.revokeObjectURL(o))}})},u=function(e){var n=e.onClick,c=o.useContext(t.LocalizationContext),l=c&&c.download?c.download.download:"Download";return o.createElement(t.MenuItem,{icon:o.createElement(r,null),onClick:n},l)};exports.DownloadIcon=r,exports.getFilePlugin=function(e){var n=o.useMemo((function(){return t.createStore({})}),[]),r=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},l=function(t){return o.createElement(a,c({},t,{fileNameGenerator:e&&e.fileNameGenerator||r,store:n}))};return{onViewerStateChange:function(e){return n.update("file",e.file),e},Download:l,DownloadButton:function(){return o.createElement(l,null,(function(e){return o.createElement(i,c({},e))}))},DownloadMenuItem:function(e){return o.createElement(l,null,(function(t){return o.createElement(u,{onClick:function(){t.onClick(),e.onClick()}})}))}}};

@@ -16,2 +16,6 @@ /**

export interface DownloadMenuItemProps {
onClick(): void;
}
export interface DownloadProps {

@@ -24,2 +28,3 @@ children?(props: RenderDownloadProps): React.ReactElement;

DownloadButton(): React.ReactElement;
DownloadMenuItem(props: DownloadMenuItemProps): React.ReactElement;
}

@@ -26,0 +31,0 @@

{
"name": "@react-pdf-viewer/get-file",
"version": "2.4.3",
"version": "2.5.0",
"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.3"
"@react-pdf-viewer/core": "2.5.0"
},

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

},
"gitHead": "d1b21552dea889febca7a3551924a0d3cc7679d0"
"gitHead": "3c7ba1ea082607670f4e2bf69d5312a14baf7057"
}
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