UNPKG

@cbpds/web-components

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