UNPKG

@aplus-frontend/ui

Version:

7 lines (6 loc) 854 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../utils/index.js");function d(o){if(!o||o.nodeType!==Node.ELEMENT_NODE)return{x:!1,y:!1};const t=window.getComputedStyle(o),l=t.overflowX,e=t.overflowY,n=l==="scroll"||l==="auto",c=e==="scroll"||e==="auto",r=o.scrollWidth>o.clientWidth,s=o.scrollHeight>o.clientHeight;return{x:n&&r,y:c&&s}}function a(){const o=`aplus-ui-locker-${Date.now()}`,{y:t}=d(document.body);if(!t)return;const l=i.getScrollbarSize();let e=document.querySelector(`style#${o}`);return e||(e=document.createElement("style"),e.id=o,e.innerHTML=` html body { overflow-y: hidden; width: calc(100% - ${l||15}px); } `,document.head.appendChild(e)),()=>{e.remove()}}function u(){let o=99;return()=>++o}const f=u();exports.getMaskZIndex=f;exports.lockScrollable=a;