UNPKG

ldrs

Version:

Minimalist loading animations for React and web components

3 lines (2 loc) 816 B
class t extends HTMLElement{_propsToUpgrade={};shadow;template;defaultProps;isAttached=!1;constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.template=document.createElement("template")}storePropsToUpgrade(t){t.forEach((t=>{this.hasOwnProperty(t)&&void 0!==this[t]&&(this._propsToUpgrade[t]=this[t],delete this[t])}))}upgradeStoredProps(){Object.entries(this._propsToUpgrade).forEach((([t,e])=>{this.setAttribute(t,e)}))}reflect(t){t.forEach((t=>{Object.defineProperty(this,t,{set(e){"string,number".includes(typeof e)?this.setAttribute(t,e.toString()):this.removeAttribute(t)},get(){return this.getAttribute(t)}})}))}applyDefaultProps(t){this.defaultProps=t,Object.entries(t).forEach((([t,e])=>{this[t]=this[t]||e.toString()}))}}export{t as default}; //# sourceMappingURL=LdrsBaseElement.js.map