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.3.1 to 3.3.2

14

lib/cjs/get-file.js

@@ -5,4 +5,4 @@ 'use strict';

var core = require('@react-pdf-viewer/core');
var React = require('react');
var core = require('@react-pdf-viewer/core');

@@ -29,2 +29,8 @@ function _interopNamespace(e) {

var DownloadIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M11.5 19.5L11.5 5" }),
React__namespace.createElement("path", { d: "M17 14L11.5 19.5 6 14" }),
React__namespace.createElement("path", { d: "M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5" }),
React__namespace.createElement("path", { d: "M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5" }))); };
/******************************************************************************

@@ -56,8 +62,2 @@ Copyright (c) Microsoft Corporation.

var DownloadIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M11.5 19.5L11.5 5" }),
React__namespace.createElement("path", { d: "M17 14L11.5 19.5 6 14" }),
React__namespace.createElement("path", { d: "M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5" }),
React__namespace.createElement("path", { d: "M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5" }))); };
var TOOLTIP_OFFSET = { left: 0, top: 8 };

@@ -64,0 +64,0 @@ var DownloadButton = function (_a) {

@@ -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 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 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)},a=function(){return o.createElement(t.Icon,{size:16},o.createElement("path",{d:"M11.5 19.5L11.5 5"}),o.createElement("path",{d:"M17 14L11.5 19.5 6 14"}),o.createElement("path",{d:"M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5"}),o.createElement("path",{d:"M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5"}))},i={left:0,top:8},c=function(e){var n=e.onClick,r=o.useContext(t.LocalizationContext).l10n,c=r&&r.download?r.download.download:"Download";return o.createElement(t.Tooltip,{ariaControlsSuffix:"get-file",position:t.Position.BottomCenter,target:o.createElement(t.MinimalButton,{ariaLabel:c,testId:"get-file__download-button",onClick:n},o.createElement(a,null)),content:function(){return c},offset:i})},l=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)},u=function(e,t,n){var o=URL.createObjectURL(new Blob([e],{type:n}));l(o,t),o&&URL.revokeObjectURL(o)},f=function(e,t){e.getData().then((function(e){/iphone|ipod|ipad/i.test(navigator.userAgent)&&!/CriOS/i.test(navigator.userAgent)?u(e,t,"application/octet-stream"):/iphone|ipod|ipad/i.test(navigator.userAgent)&&/CriOS/i.test(navigator.userAgent)?l("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):u(e,t,"application/pdf")}))},d=function(e){var t=e.children,n=e.fileNameGenerator,r=e.store,a=o.useState(r.get("file")),i=a[0],l=a[1],u=o.useState(r.get("doc")),d=u[0],s=u[1],p=function(e){s(e)},m=function(e){l(e)};o.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 o.createElement(c,{onClick:e.onClick})})({onClick:function(){d&&i&&f(d,n(i))}})},s=function(e){var n=e.onClick,r=o.useContext(t.LocalizationContext).l10n,i=r&&r.download?r.download.download:"Download";return o.createElement(t.MenuItem,{icon:o.createElement(a,null),testId:"get-file__download-menu",onClick:n},i)};exports.DownloadIcon=a,exports.getFilePlugin=function(e){var n=o.useMemo((function(){return t.createStore({})}),[]),a=function(e){return e.name?(t=e.name,(n=t.split("/").pop())?n.split("#")[0].split("?")[0]:t):"document.pdf";var t,n},i=function(t){return o.createElement(d,r({},t,{fileNameGenerator:e&&e.fileNameGenerator||a,store:n}))};return{onDocumentLoad:function(e){n.update("doc",e.doc),n.update("file",e.file)},Download:i,DownloadButton:function(){return o.createElement(i,null,(function(e){return o.createElement(c,r({},e))}))},DownloadMenuItem:function(e){return o.createElement(i,null,(function(t){return o.createElement(s,{onClick:function(){t.onClick(),e.onClick()}})}))}}};
"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:"M11.5 19.5L11.5 5"}),n.createElement("path",{d:"M17 14L11.5 19.5 6 14"}),n.createElement("path",{d:"M17.5.5h5a1,1,0,0,1,1,1v21a1,1,0,0,1-1,1h-5"}),n.createElement("path",{d:"M6.5.5h-5a1,1,0,0,0-1,1v21a1,1,0,0,0,1,1h5"}))},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)},a={left:0,top:8},i=function(t){var r=t.onClick,i=n.useContext(e.LocalizationContext).l10n,c=i&&i.download?i.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:a})},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,a=n.useState(r.get("file")),c=a[0],l=a[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(i,{onClick:e.onClick})})({onClick:function(){d&&c&&u(d,o(c))}})},d=function(t){var r=t.onClick,a=n.useContext(e.LocalizationContext).l10n,i=a&&a.download?a.download.download:"Download";return n.createElement(e.MenuItem,{icon:n.createElement(o,null),testId:"get-file__download-menu",onClick:r},i)};exports.DownloadIcon=o,exports.getFilePlugin=function(t){var o=n.useMemo((function(){return e.createStore({})}),[]),a=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||a,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(i,r({},e))}))},DownloadMenuItem:function(e){return n.createElement(c,null,(function(t){return n.createElement(d,{onClick:function(){t.onClick(),e.onClick()}})}))}}};

@@ -9,4 +9,4 @@ /**

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

@@ -13,0 +13,0 @@ // Types

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

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

},
"gitHead": "3cffac5b07d0745738913f28797527363c0b0594"
"gitHead": "9da7355cc710985d46ac3a0e70c8d6ada994c1a9"
}
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