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 3.7.0 to 3.8.0

9

lib/cjs/get-file.js
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var core = require('@react-pdf-viewer/core');
var React = require('react');
function _interopNamespace(e) {
if (e && e.__esModule) return e;
function _interopNamespaceDefault(e) {
var n = Object.create(null);

@@ -22,7 +19,7 @@ if (e) {

}
n["default"] = e;
n.default = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);

@@ -29,0 +26,0 @@ var DownloadIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 },

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@react-pdf-viewer/core");function t(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 n=t(require("react")),o=function(){return n.createElement(e.Icon,{size:16},n.createElement("path",{d:"M5.5,11.5c-.275,0-.341.159-.146.354l6.292,6.293a.5.5,0,0,0,.709,0l6.311-6.275c.2-.193.13-.353-.145-.355L15.5,11.5V1.5a1,1,0,0,0-1-1h-5a1,1,0,0,0-1,1V11a.5.5,0,0,1-.5.5Z"}),n.createElement("path",{d:"M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4"}))},r=function(){return r=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},r.apply(this,arguments)},i={left:0,top:8},a=function(t){var r=t.onClick,a=n.useContext(e.LocalizationContext).l10n,c=a&&a.download?a.download.download:"Download";return n.createElement(e.Tooltip,{ariaControlsSuffix:"get-file",position:e.Position.BottomCenter,target:n.createElement(e.MinimalButton,{ariaLabel:c,testId:"get-file__download-button",onClick:r},n.createElement(o,null)),content:function(){return c},offset:i})},c=function(e,t){var n=document.createElement("a");n.style.display="none",n.href=e,n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)},l=function(e,t,n){var o=URL.createObjectURL(new Blob([e],{type:n}));c(o,t),o&&URL.revokeObjectURL(o)},u=function(e,t){e.getData().then((function(e){/iphone|ipod|ipad/i.test(navigator.userAgent)&&!/CriOS/i.test(navigator.userAgent)?l(e,t,"application/octet-stream"):/iphone|ipod|ipad/i.test(navigator.userAgent)&&/CriOS/i.test(navigator.userAgent)?c("data:application/pdf;base64,".concat(function(e){return btoa(Array(e.length).fill("").map((function(t,n){return String.fromCharCode(e[n])})).join(""))}(e)),t):l(e,t,"application/pdf")}))},f=function(e){var t=e.children,o=e.fileNameGenerator,r=e.store,i=n.useState(r.get("file")),c=i[0],l=i[1],f=n.useState(r.get("doc")),d=f[0],s=f[1],p=function(e){s(e)},m=function(e){l(e)};n.useEffect((function(){return r.subscribe("doc",p),r.subscribe("file",m),function(){r.subscribe("doc",p),r.unsubscribe("file",m)}}),[]);return(t||function(e){return n.createElement(a,{onClick:e.onClick})})({onClick:function(){d&&c&&u(d,o(c))}})},d=function(t){var r=t.onClick,i=n.useContext(e.LocalizationContext).l10n,a=i&&i.download?i.download.download:"Download";return n.createElement(e.MenuItem,{icon:n.createElement(o,null),testId:"get-file__download-menu",onClick:r},a)};exports.DownloadIcon=o,exports.getFilePlugin=function(t){var o=n.useMemo((function(){return e.createStore({})}),[]),i=function(e){return e.name?(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t):"document.pdf";var t,n},c=function(e){return n.createElement(f,r({},e,{fileNameGenerator:t&&t.fileNameGenerator||i,store:o}))};return{onDocumentLoad:function(e){o.update("doc",e.doc),o.update("file",e.file)},Download:c,DownloadButton:function(){return n.createElement(c,null,(function(e){return n.createElement(a,r({},e))}))},DownloadMenuItem:function(e){return n.createElement(c,null,(function(t){return n.createElement(d,{onClick:function(){t.onClick(),e.onClick()}})}))}}};
"use strict";var e=require("@react-pdf-viewer/core");function t(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 n=t(require("react")),o=function(){return n.createElement(e.Icon,{size:16},n.createElement("path",{d:"M5.5,11.5c-.275,0-.341.159-.146.354l6.292,6.293a.5.5,0,0,0,.709,0l6.311-6.275c.2-.193.13-.353-.145-.355L15.5,11.5V1.5a1,1,0,0,0-1-1h-5a1,1,0,0,0-1,1V11a.5.5,0,0,1-.5.5Z"}),n.createElement("path",{d:"M23.5,18.5v4a1,1,0,0,1-1,1H1.5a1,1,0,0,1-1-1v-4"}))},r=function(){return r=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},r.apply(this,arguments)},i={left:0,top:8},a=function(t){var r=t.onClick,a=n.useContext(e.LocalizationContext).l10n,c=a&&a.download?a.download.download:"Download";return n.createElement(e.Tooltip,{ariaControlsSuffix:"get-file",position:e.Position.BottomCenter,target:n.createElement(e.MinimalButton,{ariaLabel:c,testId:"get-file__download-button",onClick:r},n.createElement(o,null)),content:function(){return c},offset:i})},c=function(e,t){var n=document.createElement("a");n.style.display="none",n.href=e,n.setAttribute("download",t),document.body.appendChild(n),n.click(),document.body.removeChild(n)},l=function(e,t,n){var o=URL.createObjectURL(new Blob([e],{type:n}));c(o,t),o&&URL.revokeObjectURL(o)},u=function(e,t){e.getData().then((function(e){/iphone|ipod|ipad/i.test(navigator.userAgent)&&!/CriOS/i.test(navigator.userAgent)?l(e,t,"application/octet-stream"):/iphone|ipod|ipad/i.test(navigator.userAgent)&&/CriOS/i.test(navigator.userAgent)?c("data:application/pdf;base64,".concat(function(e){return btoa(Array(e.length).fill("").map((function(t,n){return String.fromCharCode(e[n])})).join(""))}(e)),t):l(e,t,"application/pdf")}))},f=function(e){var t=e.children,o=e.fileNameGenerator,r=e.store,i=n.useState(r.get("file")),c=i[0],l=i[1],f=n.useState(r.get("doc")),d=f[0],s=f[1],p=function(e){s(e)},m=function(e){l(e)};n.useEffect((function(){return r.subscribe("doc",p),r.subscribe("file",m),function(){r.subscribe("doc",p),r.unsubscribe("file",m)}}),[]);return(t||function(e){return n.createElement(a,{onClick:e.onClick})})({onClick:function(){d&&c&&u(d,o(c))}})},d=function(t){var r=t.onClick,i=n.useContext(e.LocalizationContext).l10n,a=i&&i.download?i.download.download:"Download";return n.createElement(e.MenuItem,{icon:n.createElement(o,null),testId:"get-file__download-menu",onClick:r},a)};exports.DownloadIcon=o,exports.getFilePlugin=function(t){var o=n.useMemo((function(){return e.createStore({})}),[]),i=function(e){return e.name?(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t):"document.pdf";var t,n},c=function(e){return n.createElement(f,r({},e,{fileNameGenerator:t&&t.fileNameGenerator||i,store:o}))};return{onDocumentLoad:function(e){o.update("doc",e.doc),o.update("file",e.file)},Download:c,DownloadButton:function(){return n.createElement(c,null,(function(e){return n.createElement(a,r({},e))}))},DownloadMenuItem:function(e){return n.createElement(c,null,(function(t){return n.createElement(d,{onClick:function(){t.onClick(),e.onClick()}})}))}}};
{
"name": "@react-pdf-viewer/get-file",
"version": "3.7.0",
"version": "3.8.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": "3.7.0"
"@react-pdf-viewer/core": "3.8.0"
},

@@ -48,5 +48,5 @@ "peerDependencies": {

"clean": "rm -rf lib && mkdir lib",
"build": "npm run clean && cp src/index.d.ts lib && cp dist/index.js lib && rollup -c ../../rollup.config.js"
"build": "npm run clean && cp src/index.d.ts lib && cp dist/index.js lib && rollup -c ../../rollup.config.cjs"
},
"gitHead": "ccba5d4f68fa44ca7c242837280fcebf92b4f6a6"
"gitHead": "62b141a0ceb569147ca765ab6bbff76c5e480bf8"
}
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