@empoleon/solid-measure
Version:
Compute measurements of SolidJS components
2 lines (1 loc) • 782 B
JavaScript
function t(t,e){const i={};if(e.indexOf("client")>-1){const e=t;i.client={top:e.clientTop,left:e.clientLeft,width:e.clientWidth,height:e.clientHeight}}if(e.indexOf("offset")>-1){const e=t;i.offset={top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth,height:e.offsetHeight}}if(e.indexOf("scroll")>-1){const e=t;i.scroll={top:e.scrollTop,left:e.scrollLeft,width:e.scrollWidth,height:e.scrollHeight}}if(e.indexOf("bounds")>-1){const e=t.getBoundingClientRect();i.bounds={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.width,height:e.height}}if(e.indexOf("margin")>-1){const e=getComputedStyle(t);i.margin={top:e?parseInt(e.marginTop):0,right:e?parseInt(e.marginRight):0,bottom:e?parseInt(e.marginBottom):0,left:e?parseInt(e.marginLeft):0}}return i}export{t as default};