UNPKG

@cbpds/web-components

Version:
5 lines 1.33 kB
/*! * CPB Design System web components - built with Stencil */ import{p as e,H as t,d as s,h as i,c as r}from"./p-c5a784ab.js";const o="cbp-resize-observer{max-width:100%;display:block;overflow:visible}";const c=o;const n=e(class e extends t{constructor(){super();this.__registerHost();this.resized=s(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:e}])=>{const{width:t,height:s,top:i,bottom:r,left:o,right:c,x:n,y:h}=e;const a={host:this.host,width:t,height:s,top:i,bottom:r,left:o,right:c,x:n,y:h};this.resized.emit(a)}));this.observer.observe(this.observedEl)}disconnectedCallback(){if(this.observer){this.observer.unobserve(this.observedEl)}}render(){return i(r,{key:"4efdc4d695a87973af58a0a6d79ed3d1448807e3"},i("slot",{key:"2fb1725da9e2ad6165b190cc5a4e7e31ed79979f"}))}get host(){return this}static get style(){return c}},[4,"cbp-resize-observer",{debounce:[2]}]);function h(){if(typeof customElements==="undefined"){return}const e=["cbp-resize-observer"];e.forEach((e=>{switch(e){case"cbp-resize-observer":if(!customElements.get(e)){customElements.define(e,n)}break}}))}export{n as C,h as d}; //# sourceMappingURL=p-4f2249d2.js.map