nodality
Version:
A lightweight library for declarative UI elements.
2 lines • 2.23 kB
JavaScript
/*! For license information please see wrap.cjs.js.LICENSE.txt */
(()=>{"use strict";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),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},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.r(t),e.d(t,{Wrap:()=>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.code=[],this.setup();for(var r=0;r<t.length;r++)this.res.appendChild(t[r].render().render())},(t=[{key:"setup",value:function(){var e=document.createElement("div");e.style.padding=0,e.style.margin=0,this.res=e}},{key:"width",value:function(e,t){return this.res.style.width=e,t&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto"),this}},{key:"padding",value:function(e){return this.res.style.padding="".concat(e,"px"),this}},{key:"size",value:function(e,t){return this.w=e,this.h=t,this.w?this.res.style.width=this.w:this.res.style.width=window.innerWidth,this.h?this.res.style.height=this.h:this.res.style.height=window.innerHeight,this}},{key:"border",value:function(e,t){return this.res.style.border="".concat(t,"px solid ").concat(e),this}},{key:"render",value:function(e){if(!e)return this.res;document.querySelector(e).appendChild(this.res)}}])&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();module.exports=t})();