class t{constructor(t,s){window.ResizeObserver?(t.addController(this),this._width=null,this._host=t,this._callback=s?.callback,this._widthBreakpoints=s?.widthBreakpoints,this._observer=new ResizeObserver((()=>this._onResize()))):console.warn("ResizeController error: browser does not support ResizeObserver.")}get width(){return this._width}_onResize(){this._width=this._host.getBoundingClientRect().width,null!=this._widthBreakpoints&&this._widthBreakpoints.forEach((t=>{const s="w-gte-"+t;t<=this._width?this._host.setAttribute(s,""):this._host.removeAttribute(s);const e="w-lt-"+t;this._width<t?this._host.setAttribute(e,""):this._host.removeAttribute(e)})),this._host.requestUpdate(),this._callback?.(this._width)}hostConnected(){this._observer.observe(this._host)}hostDisconnected(){this._observer.disconnect()}}export{t as ResizeController};
//# sourceMappingURL=resize-controller.js.map
