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.1.0 to 3.1.1

76

lib/cjs/full-screen.js

@@ -54,36 +54,2 @@ 'use strict';

var FullScreenIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M0.5 12L23.5 12" }),
React__namespace.createElement("path", { d: "M11.5 1L11.5 23" }),
React__namespace.createElement("path", { d: "M8.5 4L11.5 1 14.5 4" }),
React__namespace.createElement("path", { d: "M20.5 9L23.5 12 20.5 15" }),
React__namespace.createElement("path", { d: "M3.5 15L0.5 12 3.5 9" }),
React__namespace.createElement("path", { d: "M14.5 20L11.5 23 8.5 20" }))); };
var TOOLTIP_OFFSET$1 = { left: 0, top: 8 };
var EnterFullScreenButton = function (_a) {
var enableShortcuts = _a.enableShortcuts, onClick = _a.onClick;
var l10n = React__namespace.useContext(core.LocalizationContext).l10n;
var label = l10n && l10n.fullScreen ? l10n.fullScreen.enterFullScreen : 'Full screen';
var ariaKeyShortcuts = enableShortcuts ? (core.isMac() ? 'Meta+Ctrl+F' : 'F11') : '';
return (React__namespace.createElement(core.Tooltip, { ariaControlsSuffix: "full-screen-enter", position: core.Position.BottomCenter, target: React__namespace.createElement(core.MinimalButton, { ariaKeyShortcuts: ariaKeyShortcuts, ariaLabel: label, testId: "full-screen__enter-button", onClick: onClick },
React__namespace.createElement(FullScreenIcon, null)), content: function () { return label; }, offset: TOOLTIP_OFFSET$1 }));
};
var ExitFullScreenIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M11.5 23.499L11.5 14.499" }),
React__namespace.createElement("path", { d: "M7.5 18.499L11.5 14.499 15.5 18.499" }),
React__namespace.createElement("path", { d: "M11.5 1.499L11.5 10.499" }),
React__namespace.createElement("path", { d: "M7.5 6.499L11.5 10.499 15.5 6.499" }),
React__namespace.createElement("path", { d: "M20.5 12.499L1.5 12.499" }))); };
var TOOLTIP_OFFSET = { left: 0, top: 8 };
var ExitFullScreenButtonWithTooltip = function (_a) {
var onClick = _a.onClick;
var l10n = React__namespace.useContext(core.LocalizationContext).l10n;
var exitFullScreenLabel = l10n && l10n.fullScreen ? l10n.fullScreen.exitFullScreen : 'Exit full screen';
return (React__namespace.createElement(core.Tooltip, { ariaControlsSuffix: "full-screen-exit", position: core.Position.BottomCenter, target: React__namespace.createElement(core.MinimalButton, { ariaKeyShortcuts: "Esc", ariaLabel: exitFullScreenLabel, testId: "full-screen__exit-button-with-tooltip", onClick: onClick },
React__namespace.createElement(ExitFullScreenIcon, null)), content: function () { return exitFullScreenLabel; }, offset: TOOLTIP_OFFSET }));
};
var Api;

@@ -125,2 +91,5 @@ (function (Api) {

: defaultVendor;
var isFullScreenEnabled = function () {
return isBrowser && vendor.FullScreenEnabled in document && document[vendor.FullScreenEnabled] === true;
};
var addFullScreenChangeListener = function (handler) {

@@ -146,2 +115,36 @@ if (isBrowser) {

var FullScreenIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M0.5 12L23.5 12" }),
React__namespace.createElement("path", { d: "M11.5 1L11.5 23" }),
React__namespace.createElement("path", { d: "M8.5 4L11.5 1 14.5 4" }),
React__namespace.createElement("path", { d: "M20.5 9L23.5 12 20.5 15" }),
React__namespace.createElement("path", { d: "M3.5 15L0.5 12 3.5 9" }),
React__namespace.createElement("path", { d: "M14.5 20L11.5 23 8.5 20" }))); };
var TOOLTIP_OFFSET$1 = { left: 0, top: 8 };
var EnterFullScreenButton = function (_a) {
var enableShortcuts = _a.enableShortcuts, onClick = _a.onClick;
var l10n = React__namespace.useContext(core.LocalizationContext).l10n;
var label = l10n && l10n.fullScreen ? l10n.fullScreen.enterFullScreen : 'Full screen';
var ariaKeyShortcuts = enableShortcuts ? (core.isMac() ? 'Meta+Ctrl+F' : 'F11') : '';
return (React__namespace.createElement(core.Tooltip, { ariaControlsSuffix: "full-screen-enter", position: core.Position.BottomCenter, target: React__namespace.createElement(core.MinimalButton, { ariaKeyShortcuts: ariaKeyShortcuts, ariaLabel: label, isDisabled: !isFullScreenEnabled(), testId: "full-screen__enter-button", onClick: onClick },
React__namespace.createElement(FullScreenIcon, null)), content: function () { return label; }, offset: TOOLTIP_OFFSET$1 }));
};
var ExitFullScreenIcon = function () { return (React__namespace.createElement(core.Icon, { size: 16 },
React__namespace.createElement("path", { d: "M11.5 23.499L11.5 14.499" }),
React__namespace.createElement("path", { d: "M7.5 18.499L11.5 14.499 15.5 18.499" }),
React__namespace.createElement("path", { d: "M11.5 1.499L11.5 10.499" }),
React__namespace.createElement("path", { d: "M7.5 6.499L11.5 10.499 15.5 6.499" }),
React__namespace.createElement("path", { d: "M20.5 12.499L1.5 12.499" }))); };
var TOOLTIP_OFFSET = { left: 0, top: 8 };
var ExitFullScreenButtonWithTooltip = function (_a) {
var onClick = _a.onClick;
var l10n = React__namespace.useContext(core.LocalizationContext).l10n;
var exitFullScreenLabel = l10n && l10n.fullScreen ? l10n.fullScreen.exitFullScreen : 'Exit full screen';
return (React__namespace.createElement(core.Tooltip, { ariaControlsSuffix: "full-screen-exit", position: core.Position.BottomCenter, target: React__namespace.createElement(core.MinimalButton, { ariaKeyShortcuts: "Esc", ariaLabel: exitFullScreenLabel, testId: "full-screen__exit-button-with-tooltip", onClick: onClick },
React__namespace.createElement(ExitFullScreenIcon, null)), content: function () { return exitFullScreenLabel; }, offset: TOOLTIP_OFFSET }));
};
var useEnterFullScreen = function (getFullScreenTarget, store, onEnterFullScreen, onExitFullScreen) {

@@ -159,2 +162,5 @@ var _a = React__namespace.useState(false), isFullScreen = _a[0], setFullScreen = _a[1];

var enterFullScreen = function () {
if (!isFullScreenEnabled()) {
return;
}
var pagesEle = pagesRef.current;

@@ -260,3 +266,3 @@ if (!pagesEle) {

var label = l10n && l10n.fullScreen ? l10n.fullScreen.enterFullScreen : 'Full screen';
return (React__namespace.createElement(core.MenuItem, { icon: React__namespace.createElement(FullScreenIcon, null), testId: "full-screen__enter-menu", onClick: onClick }, label));
return (React__namespace.createElement(core.MenuItem, { icon: React__namespace.createElement(FullScreenIcon, null), isDisabled: !isFullScreenEnabled(), testId: "full-screen__enter-menu", onClick: onClick }, label));
};

@@ -263,0 +269,0 @@

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

"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)},u=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"}))},o={left:0,top:8},i=function(e){var t=e.enableShortcuts,l=e.onClick,c=r.useContext(n.LocalizationContext).l10n,i=c&&c.fullScreen?c.fullScreen.enterFullScreen:"Full screen",a=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:a,ariaLabel:i,testId:"full-screen__enter-button",onClick:l},r.createElement(u,null)),content:function(){return i},offset:o})},a=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"}))},s={left:0,top:8},f=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(a,null)),content:function(){return c},offset:s})};
"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)};
/*! *****************************************************************************

@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation.

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 S={ExitFullScreen:"exitFullscreen",FullScreenChange:"fullscreenchange",FullScreenElement:"fullscreenElement",FullScreenEnabled:"fullscreenEnabled",RequestFullScreen:"requestFullscreen"},E={ExitFullScreen:"webkitExitFullscreen",FullScreenChange:"webkitfullscreenchange",FullScreenElement:"webkitFullscreenElement",FullScreenEnabled:"webkitFullscreenEnabled",RequestFullScreen:"webkitRequestFullscreen"},F={ExitFullScreen:"msExitFullscreen",FullScreenChange:"MSFullscreenChange",FullScreenElement:"msFullscreenElement",FullScreenEnabled:"msFullscreenEnabled",RequestFullScreen:"msRequestFullscreen"},m="undefined"!=typeof window,d=m&&(l.FullScreenEnabled in document&&S||E.FullScreenEnabled in document&&E||F.FullScreenEnabled in document&&F)||S,b=function(e){return m?e[d.ExitFullScreen]():Promise.resolve({})},g=function(){return m?document[d.FullScreenElement]:null},x=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),a=function(){var r=g(),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))},s=function(e){var n;i.current=e(),n=a,m&&document.addEventListener(d.FullScreenChange,n)},f=function(e){o(e)};return r.useEffect((function(){return n.subscribe("isFullScreen",f),n.subscribe("getPagesContainer",s),function(){n.unsubscribe("getPagesContainer",s),n.unsubscribe("isFullScreen",f)}}),[]),{enterFullScreen:function(){var n=i.current;n&&function(){var n=i.current;if(!n)return Promise.resolve();var t=g();return t&&t!==e(n)?b(t):Promise.resolve()}().then((function(){var t;t=e(n),m&&t[d.RequestFullScreen]()}))},exitFullScreen:function(){o(!1);var t=n.get("getPagesContainer");if(t){var l=t();if(l){var r=g();r&&r===e(l)&&b(document)}}},isFullScreen:u}},v=function(e){var n=e.children,t=e.enableShortcuts,l=e.getFullScreenTarget,c=e.store,u=e.onEnterFullScreen,o=e.onExitFullScreen,a=x(l,c,u,o),s=a.enterFullScreen,S=a.exitFullScreen,E=a.isFullScreen;return(n||function(e){return E?r.createElement(f,{onClick:e.onClick}):r.createElement(i,{enableShortcuts:t,onClick:e.onClick})})({onClick:E?S:s})},C=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(a,null)))},h=function(e){var n=e.children,t=e.getFullScreenTarget,l=e.store,c=e.onEnterFullScreen,u=e.onExitFullScreen,o=x(t,l,c,u),i=o.enterFullScreen,a=o.exitFullScreen,s=o.isFullScreen;return s&&(n||function(e){return r.createElement(C,{onClick:e.onClick})})({onClick:s?a:i})},p=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(u,null),testId:"full-screen__enter-menu",onClick:t},c)},k=function(e){var t=e.containerRef,l=e.getFullScreenTarget,c=e.store,u=e.onEnterFullScreen,o=e.onExitFullScreen,i=x(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=a,exports.FullScreenIcon=u,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(v,c({},e,{enableShortcuts:l.enableShortcuts,getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen}))},a=function(){return r.createElement(h,{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(k,{containerRef:e.containerRef,getFullScreenTarget:t,store:u,onEnterFullScreen:l.onEnterFullScreen,onExitFullScreen:l.onExitFullScreen}),r.createElement(a,null),n.subSlot.children)),n},EnterFullScreen:o,EnterFullScreenButton:function(){return r.createElement(o,null,(function(e){return r.createElement(i,c({enableShortcuts:l.enableShortcuts},e))}))},EnterFullScreenMenuItem:function(e){return r.createElement(o,null,(function(n){return r.createElement(p,{onClick:function(){n.onClick(),e.onClick()}})}))}}};
***************************************************************************** */!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.1.0",
"version": "3.1.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.1.0"
"@react-pdf-viewer/core": "3.1.1"
},

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

},
"gitHead": "ead0aba196b4ae44bec08900e4d54e216a83e245"
"gitHead": "a25a7f2dbe991c970354b4dc899e93bd58685a5d"
}
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