UNPKG

nodality

Version:

A lightweight library for declarative UI elements.

2 lines 2.38 kB
/*! For license information please see center.esm.js.LICENSE.txt */ var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},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 n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}function i(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}e.d(t,{o:()=>o});var o=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.setup(t)},(t=[{key:"setup",value:function(e){var t=document.createElement("div");e&&t.setAttribute("id",e),t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.width="100%",t.style.height="auto",t.style.margin=0,t.style.padding=0,this.res=t}},{key:"toCode",value:function(){return[""]}},{key:"items",value:function(e){for(var t=0;t<e.length;t++){var r=e[t].render();this.res.appendChild(r)}return this}},{key:"itemWidth",value:function(e){for(var t=0;t<this.res.childNodes.length;t++)this.res.childNodes[t].style.width=e;return this}},{key:"margin",value:function(e,t,r,n){return(e||t||r||n)&&(this.res.style.marginLeft=e,this.res.style.marginTop=t,this.res.style.marginRight=r,this.res.style.marginBottom=n),t||r||n||(alert("j"),this.res.style.margin=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:"render",value:function(e){if(!e)return this.res;document.querySelector(e).appendChild(this.res)}}])&&n(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}(),s=t.o;export{s as Center};