@cbpds/web-components
Version:
Web components for the CBP Design System.
5 lines • 1.33 kB
JavaScript
/*!
* 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-e7f1ba21.js";const c="cbp-resize-observer{max-width:100%;display:block;overflow:visible}";const o=c;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:c,right:o,x:n,y:h}=e;const b={host:this.host,width:t,height:s,top:i,bottom:r,left:c,right:o,x:n,y:h};this.resized.emit(b)}));this.observer.observe(this.observedEl)}disconnectedCallback(){if(this.observer){this.observer.unobserve(this.observedEl)}}render(){return i(r,{key:"cf5ffc573fe64cbc9e7cb469edbe2758c6a4fd66"},i("slot",{key:"77b1f2e34121b5c5bb5106199bbfaa23bb015716"}))}get host(){return this}static get style(){return o}},[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-f3d971da.js.map