UNPKG

@cbpds/web-components

Version:
5 lines 1.05 kB
/*! * CPB Design System web components - built with Stencil */ import{r as t,c as e,h as s,a as i,g as r}from"./p-8d4a80f0.js";const o="cbp-resize-observer{max-width:100%;display:block;overflow:visible}";const h=o;const c=class{constructor(s){t(this,s);this.resized=e(this,"resized",7);this.debounce=0}async getCurrentSize(){return this.getClientRect()}getClientRect(){return this.host.getBoundingClientRect()}componentDidLoad(){this.observedEl=this.host;this.observer=new ResizeObserver((([{contentRect:t}])=>{const{width:e,height:s,top:i,bottom:r,left:o,right:h,x:c,y:a}=t;const n={host:this.host,width:e,height:s,top:i,bottom:r,left:o,right:h,x:c,y:a};this.resized.emit(n)}));this.observer.observe(this.observedEl)}disconnectedCallback(){if(this.observer){this.observer.unobserve(this.observedEl)}}render(){return s(i,{key:"4efdc4d695a87973af58a0a6d79ed3d1448807e3"},s("slot",{key:"2fb1725da9e2ad6165b190cc5a4e7e31ed79979f"}))}get host(){return r(this)}};c.style=h;export{c as cbp_resize_observer}; //# sourceMappingURL=p-960ce883.entry.js.map