nodality
Version:
A lightweight library for declarative UI elements.
2 lines • 3.03 kB
JavaScript
/*! For license information please see progress.esm.js.LICENSE.txt */
var e={d:(t,r)=>{for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,n(i.key),i)}}function n(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}e.d(t,{k:()=>s});var s=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.res=null,this.value=t,this.setup()},t=[{key:"setup",value:function(){var e=document.createElement("div"),t=document.createElement("div"),r=document.createElement("div");return t.style.position="absolute",r.style.position="relative",e.appendChild(t),e.appendChild(r),this.res=e,this}},{key:"padding",value:function(e,t,r,i){return(e||t||r||i)&&(this.res.style.paddingLeft=e,this.res.style.paddingTop=t,this.res.style.paddingRight=r,this.res.style.paddingBottom=i),t||r||i||(this.res.style.padding=e),this}},{key:"arrayPadding",value:function(e,t){return e.includes("left")&&(this.res.style.paddingLeft=t),e.includes("right")&&(this.res.style.paddingRight=t),e.includes("top")&&(this.res.style.paddingTop=t),e.includes("bottom")&&(this.res.style.paddingBottom=t),this}},{key:"size",value:function(e){var t=this,r=e.width.split("%")[0],i=e.height;this.res.children[0].style.width=r/100*window.innerWidth,this.res.children[0].style.height=i,this.res.children[1].style.width=r/100*window.innerWidth*this.value,this.res.children[1].style.height=i;var n=function(){t.res.children[0].style.width=r/100*window.innerWidth,t.res.children[0].style.height=i,t.res.children[1].style.width=r/100*window.innerWidth*t.value,t.res.children[1].style.height=i};return window.addEventListener("resize",n),n(),this}},{key:"colors",value:function(e,t){return this.res.children[0].style.background=e,this.res.children[1].style.background=t,this}},{key:"round",value:function(e){return this.res.children[0].style.borderRadius="".concat(e,"px"),this.res.children[1].style.borderRadius="".concat(e,"px"),this}},{key:"render",value:function(e){if(Array.from(this.res.children).forEach((function(e){return e.style.padding=0})),Array.from(this.res.children).forEach((function(e){return e.style.margin=0})),!e)return this.res;document.querySelector(e).appendChild(this.res)}}],t&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),o=t.k;export{o as Progress};