Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-pdf-viewer/full-screen

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/full-screen - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

2

lib/cjs/full-screen.js

@@ -28,3 +28,3 @@ 'use strict';

/*! *****************************************************************************
/******************************************************************************
Copyright (c) Microsoft Corporation.

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

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("@react-pdf-viewer/core");function t(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,l.get?l:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var l,r=t(e),c=function(){return c=Object.assign||function(e){for(var n,t=1,l=arguments.length;t<l;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},c.apply(this,arguments)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */!function(e){e[e.ExitFullScreen=0]="ExitFullScreen",e[e.FullScreenChange=1]="FullScreenChange",e[e.FullScreenElement=2]="FullScreenElement",e[e.FullScreenEnabled=3]="FullScreenEnabled",e[e.RequestFullScreen=4]="RequestFullScreen"}(l||(l={}));var u={ExitFullScreen:"exitFullscreen",FullScreenChange:"fullscreenchange",FullScreenElement:"fullscreenElement",FullScreenEnabled:"fullscreenEnabled",RequestFullScreen:"requestFullscreen"},o={ExitFullScreen:"webkitExitFullscreen",FullScreenChange:"webkitfullscreenchange",FullScreenElement:"webkitFullscreenElement",FullScreenEnabled:"webkitFullscreenEnabled",RequestFullScreen:"webkitRequestFullscreen"},i={ExitFullScreen:"msExitFullscreen",FullScreenChange:"msFullscreenChange",FullScreenElement:"msFullscreenElement",FullScreenEnabled:"msFullscreenEnabled",RequestFullScreen:"msRequestFullscreen"},a="undefined"!=typeof window,s=a&&(l.FullScreenEnabled in document&&u||o.FullScreenEnabled in document&&o||i.FullScreenEnabled in document&&i)||u,f=function(){return a&&s.FullScreenEnabled in document&&!0===document[s.FullScreenEnabled]},S=function(e){return a?e[s.ExitFullScreen]():Promise.resolve({})},E=function(){return a?document[s.FullScreenElement]:null},F=function(){return r.createElement(n.Icon,{size:16},r.createElement("path",{d:"M0.5 12L23.5 12"}),r.createElement("path",{d:"M11.5 1L11.5 23"}),r.createElement("path",{d:"M8.5 4L11.5 1 14.5 4"}),r.createElement("path",{d:"M20.5 9L23.5 12 20.5 15"}),r.createElement("path",{d:"M3.5 15L0.5 12 3.5 9"}),r.createElement("path",{d:"M14.5 20L11.5 23 8.5 20"}))},m={left:0,top:8},d=function(e){var t=e.enableShortcuts,l=e.onClick,c=r.useContext(n.LocalizationContext).l10n,u=c&&c.fullScreen?c.fullScreen.enterFullScreen:"Full screen",o=t?n.isMac()?"Meta+Ctrl+F":"F11":"";return r.createElement(n.Tooltip,{ariaControlsSuffix:"full-screen-enter",position:n.Position.BottomCenter,target:r.createElement(n.MinimalButton,{ariaKeyShortcuts:o,ariaLabel:u,isDisabled:!f(),testId:"full-screen__enter-button",onClick:l},r.createElement(F,null)),content:function(){return u},offset:m})},b=function(){return r.createElement(n.Icon,{size:16},r.createElement("path",{d:"M11.5 23.499L11.5 14.499"}),r.createElement("path",{d:"M7.5 18.499L11.5 14.499 15.5 18.499"}),r.createElement("path",{d:"M11.5 1.499L11.5 10.499"}),r.createElement("path",{d:"M7.5 6.499L11.5 10.499 15.5 6.499"}),r.createElement("path",{d:"M20.5 12.499L1.5 12.499"}))},g={left:0,top:8},x=function(e){var t=e.onClick,l=r.useContext(n.LocalizationContext).l10n,c=l&&l.fullScreen?l.fullScreen.exitFullScreen:"Exit full screen";return r.createElement(n.Tooltip,{ariaControlsSuffix:"full-screen-exit",position:n.Position.BottomCenter,target:r.createElement(n.MinimalButton,{ariaKeyShortcuts:"Esc",ariaLabel:c,testId:"full-screen__exit-button-with-tooltip",onClick:t},r.createElement(b,null)),content:function(){return c},offset:g})},v=function(e,n,t,l){var c=r.useState(!1),u=c[0],o=c[1],i=r.useRef(n.get("getPagesContainer")?n.get("getPagesContainer")():null),F=function(){var r=E(),c=i.current,u=r===e(c);n.update("isFullScreen",u),u?c.classList.add("rpv-full-screen__pages"):c.classList.remove("rpv-full-screen__pages");var o=n.get("zoom");o&&(u?t(o):l(o))},m=function(e){var n;i.current=e(),n=F,a&&document.addEventListener(s.FullScreenChange,n)},d=function(e){o(e)};return r.useEffect((function(){return n.subscribe("isFullScreen",d),n.subscribe("getPagesContainer",m),function(){n.unsubscribe("getPagesContainer",m),n.unsubscribe("isFullScreen",d)}}),[]),{enterFullScreen:function(){if(f()){var n=i.current;n&&function(){var n=i.current;if(!n)return Promise.resolve();var t=E();return t&&t!==e(n)?S(t):Promise.resolve()}().then((function(){var t;t=e(n),a&&t[s.RequestFullScreen]()}))}},exitFullScreen:function(){o(!1);var t=n.get("getPagesContainer");if(t){var l=t();if(l){var r=E();r&&r===e(l)&&S(document)}}},isFullScreen:u}},C=function(e){var n=e.children,t=e.enableShortcuts,l=e.getFullScreenTarget,c=e.store,u=e.onEnterFullScreen,o=e.onExitFullScreen,i=v(l,c,u,o),a=i.enterFullScreen,s=i.exitFullScreen,f=i.isFullScreen;return(n||function(e){return f?r.createElement(x,{onClick:e.onClick}):r.createElement(d,{enableShortcuts:t,onClick:e.onClick})})({onClick:f?s:a})},h=function(e){var t=e.onClick,l=r.useContext(n.LocalizationContext).l10n,c=r.useContext(n.ThemeContext).direction===n.TextDirection.RightToLeft,u=l&&l.fullScreen?l.fullScreen.exitFullScreen:"Exit full screen";return r.createElement("div",{className:n.classNames({"rpv-full-screen__exit-button":!0,"rpv-full-screen__exit-button--ltr":!c,"rpv-full-screen__exit-button--rtl":c})},r.createElement(n.MinimalButton,{ariaLabel:u,testId:"full-screen__exit-button",onClick:t},r.createElement(b,null)))},p=function(e){var n=e.children,t=e.getFullScreenTarget,l=e.store,c=e.onEnterFullScreen,u=e.onExitFullScreen,o=v(t,l,c,u),i=o.enterFullScreen,a=o.exitFullScreen,s=o.isFullScreen;return s&&(n||function(e){return r.createElement(h,{onClick:e.onClick})})({onClick:s?a:i})},k=function(e){var t=e.onClick,l=r.useContext(n.LocalizationContext).l10n,c=l&&l.fullScreen?l.fullScreen.enterFullScreen:"Full screen";return r.createElement(n.MenuItem,{icon:r.createElement(F,null),isDisabled:!f(),testId:"full-screen__enter-menu",onClick:t},c)},L=function(e){var t=e.containerRef,l=e.getFullScreenTarget,c=e.store,u=e.onEnterFullScreen,o=e.onExitFullScreen,i=v(l,c,u,o).enterFullScreen,a=function(e){if(!e.shiftKey&&!e.altKey&&(n.isMac()?e.metaKey&&e.ctrlKey&&"f"===e.key:"F11"===e.key)){var l=t.current;l&&document.activeElement&&l.contains(document.activeElement)&&(e.preventDefault(),i())}};return r.useEffect((function(){if(t.current)return document.addEventListener("keydown",a),function(){document.removeEventListener("keydown",a)}}),[t.current]),r.createElement(r.Fragment,null)};exports.ExitFullScreenIcon=b,exports.FullScreenIcon=F,exports.fullScreenPlugin=function(e){var t=(null==e?void 0:e.getFullScreenTarget)||function(e){return e},l=r.useMemo((function(){return Object.assign({},{enableShortcuts:!0,onEnterFullScreen:function(){},onExitFullScreen:function(){}},e)}),[]),u=r.useMemo((function(){return n.createStore({})}),[]),o=function(e){return r.createElement(C,c({},e,{enableShortcuts:l.enableShortcuts,getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen}))},i=function(){return r.createElement(p,{getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen},null==e?void 0:e.renderExitFullScreenButton)};return{install:function(e){u.update("getPagesContainer",e.getPagesContainer),u.update("zoom",e.zoom)},renderViewer:function(e){var n=e.slot;return n.subSlot&&(n.subSlot.children=r.createElement(r.Fragment,null,l.enableShortcuts&&r.createElement(L,{containerRef:e.containerRef,getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen}),r.createElement(i,null),n.subSlot.children)),n},EnterFullScreen:o,EnterFullScreenButton:function(){return r.createElement(o,null,(function(e){return r.createElement(d,c({enableShortcuts:l.enableShortcuts},e))}))},EnterFullScreenMenuItem:function(e){return r.createElement(o,null,(function(n){return r.createElement(k,{onClick:function(){n.onClick(),e.onClick()}})}))}}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),n=require("@react-pdf-viewer/core");function t(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,l.get?l:{enumerable:!0,get:function(){return e[t]}})}})),n.default=e,Object.freeze(n)}var l,r=t(e),c=function(){return c=Object.assign||function(e){for(var n,t=1,l=arguments.length;t<l;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},c.apply(this,arguments)};!function(e){e[e.ExitFullScreen=0]="ExitFullScreen",e[e.FullScreenChange=1]="FullScreenChange",e[e.FullScreenElement=2]="FullScreenElement",e[e.FullScreenEnabled=3]="FullScreenEnabled",e[e.RequestFullScreen=4]="RequestFullScreen"}(l||(l={}));var u={ExitFullScreen:"exitFullscreen",FullScreenChange:"fullscreenchange",FullScreenElement:"fullscreenElement",FullScreenEnabled:"fullscreenEnabled",RequestFullScreen:"requestFullscreen"},o={ExitFullScreen:"webkitExitFullscreen",FullScreenChange:"webkitfullscreenchange",FullScreenElement:"webkitFullscreenElement",FullScreenEnabled:"webkitFullscreenEnabled",RequestFullScreen:"webkitRequestFullscreen"},i={ExitFullScreen:"msExitFullscreen",FullScreenChange:"msFullscreenChange",FullScreenElement:"msFullscreenElement",FullScreenEnabled:"msFullscreenEnabled",RequestFullScreen:"msRequestFullscreen"},a="undefined"!=typeof window,s=a&&(l.FullScreenEnabled in document&&u||o.FullScreenEnabled in document&&o||i.FullScreenEnabled in document&&i)||u,f=function(){return a&&s.FullScreenEnabled in document&&!0===document[s.FullScreenEnabled]},S=function(e){return a?e[s.ExitFullScreen]():Promise.resolve({})},E=function(){return a?document[s.FullScreenElement]:null},F=function(){return r.createElement(n.Icon,{size:16},r.createElement("path",{d:"M0.5 12L23.5 12"}),r.createElement("path",{d:"M11.5 1L11.5 23"}),r.createElement("path",{d:"M8.5 4L11.5 1 14.5 4"}),r.createElement("path",{d:"M20.5 9L23.5 12 20.5 15"}),r.createElement("path",{d:"M3.5 15L0.5 12 3.5 9"}),r.createElement("path",{d:"M14.5 20L11.5 23 8.5 20"}))},m={left:0,top:8},d=function(e){var t=e.enableShortcuts,l=e.onClick,c=r.useContext(n.LocalizationContext).l10n,u=c&&c.fullScreen?c.fullScreen.enterFullScreen:"Full screen",o=t?n.isMac()?"Meta+Ctrl+F":"F11":"";return r.createElement(n.Tooltip,{ariaControlsSuffix:"full-screen-enter",position:n.Position.BottomCenter,target:r.createElement(n.MinimalButton,{ariaKeyShortcuts:o,ariaLabel:u,isDisabled:!f(),testId:"full-screen__enter-button",onClick:l},r.createElement(F,null)),content:function(){return u},offset:m})},b=function(){return r.createElement(n.Icon,{size:16},r.createElement("path",{d:"M11.5 23.499L11.5 14.499"}),r.createElement("path",{d:"M7.5 18.499L11.5 14.499 15.5 18.499"}),r.createElement("path",{d:"M11.5 1.499L11.5 10.499"}),r.createElement("path",{d:"M7.5 6.499L11.5 10.499 15.5 6.499"}),r.createElement("path",{d:"M20.5 12.499L1.5 12.499"}))},g={left:0,top:8},x=function(e){var t=e.onClick,l=r.useContext(n.LocalizationContext).l10n,c=l&&l.fullScreen?l.fullScreen.exitFullScreen:"Exit full screen";return r.createElement(n.Tooltip,{ariaControlsSuffix:"full-screen-exit",position:n.Position.BottomCenter,target:r.createElement(n.MinimalButton,{ariaKeyShortcuts:"Esc",ariaLabel:c,testId:"full-screen__exit-button-with-tooltip",onClick:t},r.createElement(b,null)),content:function(){return c},offset:g})},v=function(e,n,t,l){var c=r.useState(!1),u=c[0],o=c[1],i=r.useRef(n.get("getPagesContainer")?n.get("getPagesContainer")():null),F=function(){var r=E(),c=i.current,u=r===e(c);n.update("isFullScreen",u),u?c.classList.add("rpv-full-screen__pages"):c.classList.remove("rpv-full-screen__pages");var o=n.get("zoom");o&&(u?t(o):l(o))},m=function(e){var n;i.current=e(),n=F,a&&document.addEventListener(s.FullScreenChange,n)},d=function(e){o(e)};return r.useEffect((function(){return n.subscribe("isFullScreen",d),n.subscribe("getPagesContainer",m),function(){n.unsubscribe("getPagesContainer",m),n.unsubscribe("isFullScreen",d)}}),[]),{enterFullScreen:function(){if(f()){var n=i.current;n&&function(){var n=i.current;if(!n)return Promise.resolve();var t=E();return t&&t!==e(n)?S(t):Promise.resolve()}().then((function(){var t;t=e(n),a&&t[s.RequestFullScreen]()}))}},exitFullScreen:function(){o(!1);var t=n.get("getPagesContainer");if(t){var l=t();if(l){var r=E();r&&r===e(l)&&S(document)}}},isFullScreen:u}},C=function(e){var n=e.children,t=e.enableShortcuts,l=e.getFullScreenTarget,c=e.store,u=e.onEnterFullScreen,o=e.onExitFullScreen,i=v(l,c,u,o),a=i.enterFullScreen,s=i.exitFullScreen,f=i.isFullScreen;return(n||function(e){return f?r.createElement(x,{onClick:e.onClick}):r.createElement(d,{enableShortcuts:t,onClick:e.onClick})})({onClick:f?s:a})},h=function(e){var t=e.onClick,l=r.useContext(n.LocalizationContext).l10n,c=r.useContext(n.ThemeContext).direction===n.TextDirection.RightToLeft,u=l&&l.fullScreen?l.fullScreen.exitFullScreen:"Exit full screen";return r.createElement("div",{className:n.classNames({"rpv-full-screen__exit-button":!0,"rpv-full-screen__exit-button--ltr":!c,"rpv-full-screen__exit-button--rtl":c})},r.createElement(n.MinimalButton,{ariaLabel:u,testId:"full-screen__exit-button",onClick:t},r.createElement(b,null)))},p=function(e){var n=e.children,t=e.getFullScreenTarget,l=e.store,c=e.onEnterFullScreen,u=e.onExitFullScreen,o=v(t,l,c,u),i=o.enterFullScreen,a=o.exitFullScreen,s=o.isFullScreen;return s&&(n||function(e){return r.createElement(h,{onClick:e.onClick})})({onClick:s?a:i})},k=function(e){var t=e.onClick,l=r.useContext(n.LocalizationContext).l10n,c=l&&l.fullScreen?l.fullScreen.enterFullScreen:"Full screen";return r.createElement(n.MenuItem,{icon:r.createElement(F,null),isDisabled:!f(),testId:"full-screen__enter-menu",onClick:t},c)},L=function(e){var t=e.containerRef,l=e.getFullScreenTarget,c=e.store,u=e.onEnterFullScreen,o=e.onExitFullScreen,i=v(l,c,u,o).enterFullScreen,a=function(e){if(!e.shiftKey&&!e.altKey&&(n.isMac()?e.metaKey&&e.ctrlKey&&"f"===e.key:"F11"===e.key)){var l=t.current;l&&document.activeElement&&l.contains(document.activeElement)&&(e.preventDefault(),i())}};return r.useEffect((function(){if(t.current)return document.addEventListener("keydown",a),function(){document.removeEventListener("keydown",a)}}),[t.current]),r.createElement(r.Fragment,null)};exports.ExitFullScreenIcon=b,exports.FullScreenIcon=F,exports.fullScreenPlugin=function(e){var t=(null==e?void 0:e.getFullScreenTarget)||function(e){return e},l=r.useMemo((function(){return Object.assign({},{enableShortcuts:!0,onEnterFullScreen:function(){},onExitFullScreen:function(){}},e)}),[]),u=r.useMemo((function(){return n.createStore({})}),[]),o=function(e){return r.createElement(C,c({},e,{enableShortcuts:l.enableShortcuts,getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen}))},i=function(){return r.createElement(p,{getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen},null==e?void 0:e.renderExitFullScreenButton)};return{install:function(e){u.update("getPagesContainer",e.getPagesContainer),u.update("zoom",e.zoom)},renderViewer:function(e){var n=e.slot;return n.subSlot&&(n.subSlot.children=r.createElement(r.Fragment,null,l.enableShortcuts&&r.createElement(L,{containerRef:e.containerRef,getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen}),r.createElement(i,null),n.subSlot.children)),n},EnterFullScreen:o,EnterFullScreenButton:function(){return r.createElement(o,null,(function(e){return r.createElement(d,c({enableShortcuts:l.enableShortcuts},e))}))},EnterFullScreenMenuItem:function(e){return r.createElement(o,null,(function(n){return r.createElement(k,{onClick:function(){n.onClick(),e.onClick()}})}))}}};
{
"name": "@react-pdf-viewer/full-screen",
"version": "3.3.0",
"version": "3.3.1",
"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.0"
"@react-pdf-viewer/core": "3.3.1"
},

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

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