ant-design-x-vue
Version:
Craft AI-driven interfaces effortlessly
2 lines (1 loc) • 973 B
JavaScript
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});let d;function u(n){if(typeof document>"u")return 0;if(n||d===void 0){const e=document.createElement("div");e.style.width="100%",e.style.height="200px";const t=document.createElement("div"),i=t.style;i.position="absolute",i.top="0",i.left="0",i.pointerEvents="none",i.visibility="hidden",i.width="200px",i.height="150px",i.overflow="hidden",t.appendChild(e),document.body.appendChild(t);const l=e.offsetWidth;t.style.overflow="scroll";let o=e.offsetWidth;l===o&&(o=t.clientWidth),document.body.removeChild(t),d=l-o}return d}function r(n){const e=n.match(/^(.*)px$/),t=Number(e==null?void 0:e[1]);return Number.isNaN(t)?u():t}function c(n){if(typeof document>"u"||!n||!(n instanceof Element))return{width:0,height:0};const{width:e,height:t}=getComputedStyle(n,"::-webkit-scrollbar");return{width:r(e),height:r(t)}}exports.default=u;exports.getTargetScrollBarSize=c;
;