UNPKG

@striven-erp/striven-fullscreen

Version:
7 lines 4.96 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function o(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}n.r(t),n.d(t,"default",(function(){return i})); /* @license/i * Font Awesome Free 5.11.2 by @fontawesome - https://fontawesome.com * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) */ var r={d:"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z",viewBox:"0 0 352 512"},i=function(){function e(t){var o=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n(2)(t,{recursive:!0}),this.content=t.cloneNode(!0),this.config=r,this.html=document.querySelector("html"),this.overflowProp=this.html.style.overflow,window.addEventListener("keydown",(function(e){if(e.key)switch(e.key){case"Escape":o.collapse()}else switch(e.keyCode){case 13:o.collapse()}}))}var t,i,c;return t=e,(i=[{key:"expand",value:function(){var e=this,t=this.config.backgroundColor;this.container=document.createElement("div"),this.container.setAttribute("style","\n z-index: 10000;\n height: 100vh;\n width: 100vw;\n overflow-x: scroll;\n position: fixed;\n background-color: ".concat(t||"rgba(0, 0, 0, .6)",";\n top: 0; right: 0; left: 0; bottom: 0;\n ")),this.content.style.position="absolute",this.content.style.margin="1rem",this.content.style.top="0",this.content.style.bottom="0",this.content.style.left="0",this.content.style.right="0";var n=document.createElement("div");n.innerHTML=this.constructSVG(r).innerHTML,n.setAttribute("style","\n cursor: pointer;\n position: fixed;\n right: 5px;\n top: 10px;\n background-color: #fff;\n border: 1px solid #ddd;\n padding: 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n "),n.onmouseenter=function(){return n.style.backgroundColor="#eee"},n.onmouseleave=function(){return n.style.backgroundColor="#fff"},n.onclick=function(){return e.collapse()},this.html.style.overflow="hidden",this.container.append(this.content),this.container.append(n),document.body.append(this.container)}},{key:"collapse",value:function(){this.container&&(this.container.remove(),this.container=null,this.resetOverflow())}},{key:"resetOverflow",value:function(){this.html.style.overflow=this.overflowProp}},{key:"constructSVG",value:function(e){var t=e.viewBox,n=e.d,o=document.createElement("span"),r='<svg width="'.concat("16",'" height="').concat("14",'" viewBox="').concat(t,'" xmlns="').concat("http://www.w3.org/2000/svg",'">'),i='<path fill="'.concat("#333",'" d="').concat(n,'"/>');return o.innerHTML="".concat(r).concat(i,"</svg>"),o}}])&&o(t.prototype,i),c&&o(t,c),e}()},,function(e,t,n){var o,r,i;r=[e],void 0===(i="function"==typeof(o=function(e){"use strict";var t=Array.prototype.forEach;e.exports=function e(n){var o,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!n)throw new Error("No element specified.");i.recursive&&(r=n.children,t).call(r,(function(t){e(t,i)}));var c=getComputedStyle(n);(o=i.properties||c,t).call(o,(function(e){n.style[e]=c.getPropertyValue(e)}))}})?o.apply(t,r):o)||(e.exports=i)}])}));