UNPKG

react-measured-dom

Version:
2 lines (1 loc) 1.4 kB
import{createInNextFrame as e,createAnimationFrameChecker as t,areBoundingBoxesEqual as r,createUseBoundingBox as a,createMeasured as o,lazyValue as i}from"react-measured";var d=()=>{var a=e(),o=t((e,t,o)=>{var i=[];if(e.forEach(e=>{var a=(e=>{var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left}})(e.element),o=e.transform?e.transform(a):a,d=t.get(e);r(o,d)||(t.set(e,o),i.push(()=>e.onChange(o)))}),!i.length)return o();a(()=>{i.forEach(e=>e()),o()})}),i=o.clear;return Object.assign(o,{clear:()=>{a.cancel(),i()}})},n=a(d()),h=o(n);["a","abbr","address","article","aside","b","bdi","bdo","big","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","meter","nav","object","ol","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","var","video"].forEach(e=>{Object.defineProperty(h,e,{get:i(()=>h(e))})});export{h as Measured,d as createHTMLChecker,n as useBoundingBox};//# sourceMappingURL=index.es.js.map