@react-pdf-viewer/scroll-mode
Advanced tools
Comparing version 2.7.2 to 2.8.0
@@ -164,2 +164,4 @@ 'use strict'; | ||
var store = _a.store; | ||
var direction = React__namespace.useContext(core.ThemeContext).direction; | ||
var isRtl = direction === core.TextDirection.RightToLeft; | ||
var switchTo = useScrollMode(store).switchTo; | ||
@@ -171,2 +173,3 @@ var handlePagesContainer = function (getPagesContainer) { | ||
} | ||
isRtl ? pagesEle.classList.add('rpv-scroll-mode--rtl') : pagesEle.classList.remove('rpv-scroll-mode--rtl'); | ||
var scrollMode = store.get('scrollMode') || exports.ScrollMode.Vertical; | ||
@@ -173,0 +176,0 @@ if (scrollMode !== exports.ScrollMode.Vertical) { |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@react-pdf-viewer/core");function o(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var t=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(r,o,t.get?t:{enumerable:!0,get:function(){return e[o]}})}})),r.default=e,Object.freeze(r)}var t,c=o(e);exports.ScrollMode=void 0,(t=exports.ScrollMode||(exports.ScrollMode={})).Horizontal="Horizontal",t.Vertical="Vertical",t.Wrapped="Wrapped"; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@react-pdf-viewer/core");function t(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}var o,c=t(e);exports.ScrollMode=void 0,(o=exports.ScrollMode||(exports.ScrollMode={})).Horizontal="Horizontal",o.Vertical="Vertical",o.Wrapped="Wrapped"; | ||
/*! ***************************************************************************** | ||
@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation. | ||
***************************************************************************** */ | ||
var l=function(){return(l=Object.assign||function(e){for(var r,o=1,t=arguments.length;o<t;o++)for(var c in r=arguments[o])Object.prototype.hasOwnProperty.call(r,c)&&(e[c]=r[c]);return e}).apply(this,arguments)},n=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M6.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M14.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M22.5,21.5 c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z"}))},i=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M23.5,5.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V5.5z\n M23.5,13.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V13.5z\n M23.5,21.5 c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V21.5z"}))},a=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M10.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M23.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M10.5,22.5 c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z\n M23.5,22.5c0,0.552-0.448,1-1,1 h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z"}))},s=function(e){var o=e.children,t=e.mode,l=e.onClick,s=c.useContext(r.LocalizationContext).l10n,d="",u=c.createElement(i,null);switch(t){case exports.ScrollMode.Horizontal:d=s&&s.scrollMode?s.scrollMode.horizontalScrolling:"Horizontal scrolling",u=c.createElement(n,null);break;case exports.ScrollMode.Wrapped:d=s&&s.scrollMode?s.scrollMode.wrappedScrolling:"Wrapped scrolling",u=c.createElement(a,null);break;case exports.ScrollMode.Vertical:default:d=s&&s.scrollMode?s.scrollMode.verticalScrolling:"Vertical scrolling",u=c.createElement(i,null)}return o({icon:u,label:d,onClick:l})},d={left:0,top:8},u=function(e){var o=e.isSelected,t=e.mode,l=e.onClick;return c.createElement(s,{mode:t,onClick:l},(function(e){return c.createElement(r.Tooltip,{ariaControlsSuffix:"scroll-mode-switch",position:r.Position.BottomCenter,target:c.createElement(r.MinimalButton,{ariaLabel:e.label,isSelected:o,onClick:e.onClick},e.icon),content:function(){return e.label},offset:d})}))},m=function(e){var r=c.useState(e.get("scrollMode")||exports.ScrollMode.Vertical),o=r[0],t=r[1],l=function(e){t(e)};return c.useEffect((function(){return e.subscribe("scrollMode",l),function(){e.unsubscribe("scrollMode",l)}}),[]),{scrollMode:o,switchTo:function(r){var o=e.get("getPagesContainer");if(o){var t=o();if(t){switch(r){case exports.ScrollMode.Vertical:t.classList.add("rpv-scroll-mode__vertical"),t.classList.remove("rpv-scroll-mode__horizontal"),t.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Horizontal:t.classList.add("rpv-scroll-mode__horizontal"),t.classList.remove("rpv-scroll-mode__vertical"),t.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Wrapped:t.classList.add("rpv-scroll-mode__wrapped"),t.classList.remove("rpv-scroll-mode__vertical"),t.classList.remove("rpv-scroll-mode__horizontal")}e.update("scrollMode",r)}}}}},p=function(e){var r=e.children,o=e.mode,t=e.store,l=m(t),n=l.scrollMode,i=l.switchTo,a=n===o;return(r||function(e){return c.createElement(u,{isSelected:a,mode:e.mode,onClick:e.onClick})})({isSelected:a,mode:o,onClick:function(){return i(o)}})},f=function(e){var o=e.isSelected,t=e.mode,l=e.onClick;return c.createElement(s,{mode:t,onClick:l},(function(e){return c.createElement(r.MenuItem,{checked:o,icon:e.icon,onClick:e.onClick},e.label)}))},v=function(e){var r=e.store,o=m(r).switchTo,t=function(e){if(e()){var t=r.get("scrollMode")||exports.ScrollMode.Vertical;t!==exports.ScrollMode.Vertical&&o(t)}};return c.useEffect((function(){return r.subscribe("getPagesContainer",t),function(){r.unsubscribe("getPagesContainer",t)}}),[]),c.createElement(c.Fragment,null)};exports.HorizontalScrollingIcon=n,exports.VerticalScrollingIcon=i,exports.WrappedScrollingIcon=a,exports.scrollModePlugin=function(e){var o=c.useMemo((function(){return r.createStore({scrollMode:e&&e.scrollMode?e.scrollMode:exports.ScrollMode.Vertical})}),[]),t=function(e){return c.createElement(p,l({},e,{store:o}))};return{install:function(e){o.update("getPagesContainer",e.getPagesContainer)},renderViewer:function(e){var r=e.slot;return r&&r.children&&(r.children=c.createElement(c.Fragment,null,c.createElement(v,{store:o}),r.children)),r},SwitchScrollMode:t,SwitchScrollModeButton:function(e){return c.createElement(t,{mode:e.mode},(function(e){return c.createElement(u,{isSelected:e.isSelected,mode:e.mode,onClick:function(){e.onClick()}})}))},SwitchScrollModeMenuItem:function(e){return c.createElement(t,{mode:e.mode},(function(r){return c.createElement(f,{isSelected:r.isSelected,mode:r.mode,onClick:function(){r.onClick(),e.onClick()}})}))}}}; | ||
var l=function(){return(l=Object.assign||function(e){for(var r,t=1,o=arguments.length;t<o;t++)for(var c in r=arguments[t])Object.prototype.hasOwnProperty.call(r,c)&&(e[c]=r[c]);return e}).apply(this,arguments)},n=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M6.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M14.5,21.5c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z\n M22.5,21.5 c0,0.552-0.448,1-1,1h-4c-0.552,0-1-0.448-1-1v-20c0-0.552,0.448-1,1-1h4c0.552,0,1,0.448,1,1V21.5z"}))},i=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M23.5,5.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V5.5z\n M23.5,13.5c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V13.5z\n M23.5,21.5 c0,0.552-0.448,1-1,1h-21c-0.552,0-1-0.448-1-1v-3c0-0.552,0.448-1,1-1h21c0.552,0,1,0.448,1,1V21.5z"}))},a=function(){return c.createElement(r.Icon,{size:16},c.createElement("path",{d:"M10.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M23.5,9.5c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V9.5z\n M10.5,22.5 c0,0.552-0.448,1-1,1h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z\n M23.5,22.5c0,0.552-0.448,1-1,1 h-8c-0.552,0-1-0.448-1-1v-8c0-0.552,0.448-1,1-1h8c0.552,0,1,0.448,1,1V22.5z"}))},s=function(e){var t=e.children,o=e.mode,l=e.onClick,s=c.useContext(r.LocalizationContext).l10n,d="",u=c.createElement(i,null);switch(o){case exports.ScrollMode.Horizontal:d=s&&s.scrollMode?s.scrollMode.horizontalScrolling:"Horizontal scrolling",u=c.createElement(n,null);break;case exports.ScrollMode.Wrapped:d=s&&s.scrollMode?s.scrollMode.wrappedScrolling:"Wrapped scrolling",u=c.createElement(a,null);break;case exports.ScrollMode.Vertical:default:d=s&&s.scrollMode?s.scrollMode.verticalScrolling:"Vertical scrolling",u=c.createElement(i,null)}return t({icon:u,label:d,onClick:l})},d={left:0,top:8},u=function(e){var t=e.isSelected,o=e.mode,l=e.onClick;return c.createElement(s,{mode:o,onClick:l},(function(e){return c.createElement(r.Tooltip,{ariaControlsSuffix:"scroll-mode-switch",position:r.Position.BottomCenter,target:c.createElement(r.MinimalButton,{ariaLabel:e.label,isSelected:t,onClick:e.onClick},e.icon),content:function(){return e.label},offset:d})}))},m=function(e){var r=c.useState(e.get("scrollMode")||exports.ScrollMode.Vertical),t=r[0],o=r[1],l=function(e){o(e)};return c.useEffect((function(){return e.subscribe("scrollMode",l),function(){e.unsubscribe("scrollMode",l)}}),[]),{scrollMode:t,switchTo:function(r){var t=e.get("getPagesContainer");if(t){var o=t();if(o){switch(r){case exports.ScrollMode.Vertical:o.classList.add("rpv-scroll-mode__vertical"),o.classList.remove("rpv-scroll-mode__horizontal"),o.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Horizontal:o.classList.add("rpv-scroll-mode__horizontal"),o.classList.remove("rpv-scroll-mode__vertical"),o.classList.remove("rpv-scroll-mode__wrapped");break;case exports.ScrollMode.Wrapped:o.classList.add("rpv-scroll-mode__wrapped"),o.classList.remove("rpv-scroll-mode__vertical"),o.classList.remove("rpv-scroll-mode__horizontal")}e.update("scrollMode",r)}}}}},p=function(e){var r=e.children,t=e.mode,o=e.store,l=m(o),n=l.scrollMode,i=l.switchTo,a=n===t;return(r||function(e){return c.createElement(u,{isSelected:a,mode:e.mode,onClick:e.onClick})})({isSelected:a,mode:t,onClick:function(){return i(t)}})},f=function(e){var t=e.isSelected,o=e.mode,l=e.onClick;return c.createElement(s,{mode:o,onClick:l},(function(e){return c.createElement(r.MenuItem,{checked:t,icon:e.icon,onClick:e.onClick},e.label)}))},v=function(e){var t=e.store,o=c.useContext(r.ThemeContext).direction===r.TextDirection.RightToLeft,l=m(t).switchTo,n=function(e){var r=e();if(r){o?r.classList.add("rpv-scroll-mode--rtl"):r.classList.remove("rpv-scroll-mode--rtl");var c=t.get("scrollMode")||exports.ScrollMode.Vertical;c!==exports.ScrollMode.Vertical&&l(c)}};return c.useEffect((function(){return t.subscribe("getPagesContainer",n),function(){t.unsubscribe("getPagesContainer",n)}}),[]),c.createElement(c.Fragment,null)};exports.HorizontalScrollingIcon=n,exports.VerticalScrollingIcon=i,exports.WrappedScrollingIcon=a,exports.scrollModePlugin=function(e){var t=c.useMemo((function(){return r.createStore({scrollMode:e&&e.scrollMode?e.scrollMode:exports.ScrollMode.Vertical})}),[]),o=function(e){return c.createElement(p,l({},e,{store:t}))};return{install:function(e){t.update("getPagesContainer",e.getPagesContainer)},renderViewer:function(e){var r=e.slot;return r&&r.children&&(r.children=c.createElement(c.Fragment,null,c.createElement(v,{store:t}),r.children)),r},SwitchScrollMode:o,SwitchScrollModeButton:function(e){return c.createElement(o,{mode:e.mode},(function(e){return c.createElement(u,{isSelected:e.isSelected,mode:e.mode,onClick:function(){e.onClick()}})}))},SwitchScrollModeMenuItem:function(e){return c.createElement(o,{mode:e.mode},(function(r){return c.createElement(f,{isSelected:r.isSelected,mode:r.mode,onClick:function(){r.onClick(),e.onClick()}})}))}}}; |
{ | ||
"name": "@react-pdf-viewer/scroll-mode", | ||
"version": "2.7.2", | ||
"version": "2.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": "2.7.2" | ||
"@react-pdf-viewer/core": "2.8.0" | ||
}, | ||
@@ -52,3 +52,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "d5084b21f1e89e11ee45764849b8c61e4e6f4216" | ||
"gitHead": "5a7ff547bbdcf8b51c10907ad706e4edc397fc4f" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22243
305
+ Added@react-pdf-viewer/core@2.8.0(transitive)
- Removed@react-pdf-viewer/core@2.7.2(transitive)
Updated@react-pdf-viewer/core@2.8.0