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-654179c2.js";const o="cbp-resize-observer{max-width:100%;display:block;overflow:visible}";const c=o;const h=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:c,x:h,y:n}=t;const a={host:this.host,width:e,height:s,top:i,bottom:r,left:o,right:c,x:h,y:n};this.resized.emit(a)}));this.observer.observe(this.observedEl)}disconnectedCallback(){if(this.observer){this.observer.unobserve(this.observedEl)}}render(){return s(i,{key:"0dd1770de419f828b316c647f6c09c826f7f330e"},s("slot",{key:"9e0a782811f68c20f0574b60647cf401c55b5cf9"}))}get host(){return r(this)}};h.style=c;export{h as cbp_resize_observer}; //# sourceMappingURL=p-e9f1b6c4.entry.js.map