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.2.1 to 2.3.0

20

lib/cjs/get-file.js

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

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var DownloadIcon = function () {
return (React__default['default'].createElement(core.Icon, { size: 16 },
React__default['default'].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.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" })));
};

@@ -49,4 +45,4 @@

var label = l10n && l10n.download ? l10n.download.download : 'Download';
return (React__default['default'].createElement(core.Tooltip, { position: core.Position.BottomCenter, target: React__default['default'].createElement(core.Button, { onClick: onClick },
React__default['default'].createElement(DownloadIcon, null)), content: function () { return label; }, offset: TOOLTIP_OFFSET }));
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 }));
};

@@ -87,3 +83,3 @@

};
var defaultChildren = function (props) { return React__default['default'].createElement(DownloadButton, { onClick: props.onClick }); };
var defaultChildren = function (props) { return React.createElement(DownloadButton, { onClick: props.onClick }); };
var render = children || defaultChildren;

@@ -101,6 +97,6 @@ return render({

var getFilePlugin = function (props) {
var store = core.createStore({});
var store = React.useMemo(function () { return core.createStore({}); }, []);
var defaultFileNameGenerator = function (file) { return getFileName(file.name); };
var DownloadDecorator = function (downloadProps) { return (React__default['default'].createElement(Download, __assign({}, downloadProps, { fileNameGenerator: props ? (props.fileNameGenerator || defaultFileNameGenerator) : defaultFileNameGenerator, store: store }))); };
var DownloadButtonDecorator = function () { return (React__default['default'].createElement(DownloadDecorator, null, function (props) { return React__default['default'].createElement(DownloadButton, __assign({}, props)); })); };
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)); })); };
return {

@@ -107,0 +103,0 @@ onViewerStateChange: function (viewerState) {

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){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),o=function(){return r.default.createElement(t.Icon,{size:16},r.default.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"}))},a=function(){return(a=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)},l={left:0,top:8},u=function(n){var a=n.onClick,u=e.useContext(t.LocalizationContext),c=u&&u.download?u.download.download:"Download";return r.default.createElement(t.Tooltip,{position:t.Position.BottomCenter,target:r.default.createElement(t.Button,{onClick:a},r.default.createElement(o,null)),content:function(){return c},offset:l})},c=function(t){var n=t.children,o=t.fileNameGenerator,a=t.store,l=e.useState(),c=l[0],i=l[1],f=function(e){i(e)};e.useEffect((function(){return a.subscribe("file",f),function(){a.unsubscribe("file",f)}}),[]);return(n||function(e){return r.default.createElement(u,{onClick:e.onClick})})({onClick:function(){var e,t,n,r;c&&(e=c,t=o(c),n="string"==typeof e.data?"":URL.createObjectURL(new Blob([e.data],{type:""})),(r=document.createElement("a")).style.display="none",r.href=n||e.name,r.setAttribute("download",t),document.body.appendChild(r),r.click(),document.body.removeChild(r),n&&URL.revokeObjectURL(n))}})};exports.DownloadIcon=o,exports.getFilePlugin=function(e){var n=t.createStore({}),o=function(e){return t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t;var t,n},l=function(t){return r.default.createElement(c,a({},t,{fileNameGenerator:e&&e.fileNameGenerator||o,store:n}))};return{onViewerStateChange:function(e){return n.update("file",e.file),e},Download:l,DownloadButton:function(){return r.default.createElement(l,null,(function(e){return r.default.createElement(u,a({},e))}))}}};
"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(),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))}))}}};

@@ -9,3 +9,3 @@ /**

import { Component, ReactElement } from 'react';
import * as React from 'react';
import { OpenFile, Plugin } from '@react-pdf-viewer/core';

@@ -18,8 +18,8 @@

export interface DownloadProps {
children?(props: RenderDownloadProps): ReactElement;
children?(props: RenderDownloadProps): React.ReactElement;
}
export interface GetFilePlugin extends Plugin {
Download(props: DownloadProps): ReactElement;
DownloadButton(): ReactElement;
Download(props: DownloadProps): React.ReactElement;
DownloadButton(): React.ReactElement;
}

@@ -34,2 +34,2 @@

export class DownloadIcon extends Component {}
export class DownloadIcon extends React.Component {}
{
"name": "@react-pdf-viewer/get-file",
"version": "2.2.1",
"version": "2.3.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.2.1"
"@react-pdf-viewer/core": "2.3.0"
},

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

},
"gitHead": "dc23d3ab29ed34affa25cc4acd25f7fce4e14fd0"
"gitHead": "182a54c3c2cb7d0d77bb988e495b3e6853108b0a"
}
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