nodality
Version:
A lightweight library for declarative UI elements.
2 lines • 2.44 kB
JavaScript
/*! For license information please see modal2025.cjs.js.LICENSE.txt */
(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},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 o(e){return o="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},o(e)}function r(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,n(r.key),r)}}function n(e){var t=function(e){if("object"!=o(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==o(t)?t:t+""}e.r(t),e.d(t,{Modal:()=>i});var i=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=null,this.obj=null},(t=[{key:"set",value:function(e){var t=document.createElement("div");return t.style.width="100vw",t.style.height="100vh",t.style.backgroundColor=e.background,t.style.zIndex="1",t.style.position="absolute",t.style.overflowY="scroll",this.obj=e,this.res=t,e.close&&this.close(),this}},{key:"close",value:function(){return this.res.style.display="none",this}},{key:"show",value:function(){return this.res.style.display="block",this}},{key:"add",value:function(e){var t=document.createElement("div");t.style.width=this.obj.width,t.style.height="auto",t.style.marginLeft="auto",t.style.marginRight="auto",t.style.backgroundColor="white",window.matchMedia("(max-device-width: 415px)").matches&&(t.style.marginTop="200px",t.style.width="100%");for(var o=0;o<e.length;o++)console.log(e[o]),t.appendChild(e[o].render());return this.res.appendChild(t),this}},{key:"render",value:function(e){if(!e)return this.res;document.querySelector("body").style.margin=0,document.querySelector("body").style.padding=0,document.querySelector(e).appendChild(this.res)}}])&&r(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();module.exports=t})();