From 5d9ac9e1db2a4521bf81cfe930cae676ee0daef2 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Thu, 15 Aug 2024 09:54:10 +0200 Subject: [PATCH 1/2] feat!: switch to esbuild instead of manual build scripts --- dist/css/themes/modern.min.css | 2 +- dist/css/themes/white.min.css | 2 +- dist/css/winbox.min.css | 2 +- dist/js/winbox.min.js | 33 ---- dist/winbox.bundle.min.js | 35 +--- index.html | 6 +- package.json | 16 +- src/css/control.less | 50 ------ src/css/images.less | 5 - src/css/themes/modern.css | 63 +++++++ src/css/themes/modern.less | 86 --------- src/css/themes/white.css | 9 + src/css/themes/white.less | 13 -- src/css/winbox.css | 14 +- src/css/winbox.less | 315 --------------------------------- src/js/webpack.js | 60 ------- task/build.js | 131 -------------- task/bundle.js | 56 ------ task/esbuild.bundle.mjs | 76 ++++++++ task/esbuild.mjs | 75 ++++++++ 20 files changed, 253 insertions(+), 796 deletions(-) delete mode 100644 dist/js/winbox.min.js delete mode 100644 src/css/control.less delete mode 100644 src/css/images.less create mode 100644 src/css/themes/modern.css delete mode 100644 src/css/themes/modern.less create mode 100644 src/css/themes/white.css delete mode 100644 src/css/themes/white.less delete mode 100644 src/css/winbox.less delete mode 100644 src/js/webpack.js delete mode 100644 task/build.js delete mode 100644 task/bundle.js create mode 100644 task/esbuild.bundle.mjs create mode 100644 task/esbuild.mjs diff --git a/dist/css/themes/modern.min.css b/dist/css/themes/modern.min.css index 762b28b..4a325ec 100644 --- a/dist/css/themes/modern.min.css +++ b/dist/css/themes/modern.min.css @@ -1 +1 @@ -@keyframes popup{0%{transform:scale(.8)}to{transform:scale(1)}}.winbox.modern{background:linear-gradient(90deg,#ff00f0,#0050ff);border-radius:12px 12px 0 0;animation:popup .3s cubic-bezier(.3,1,.3,1) forwards}.winbox.modern:not(.min,.focus){background:#666}@media (hover:hover){.winbox.modern.min:not(:hover){background:#666}.winbox.modern .wb-control *{opacity:.65}.winbox.modern .wb-control :hover{opacity:1}}@media (hover:none){.winbox.modern.min{background:#666}}.winbox.modern.max{border-radius:0}.winbox.modern .wb-title{font-size:13px;text-transform:uppercase;font-weight:600}.winbox.modern .wb-body{margin:4px;color:#fff;background:#131820}.winbox.modern .wb-body::-webkit-scrollbar{width:12px;height:12px}.winbox.modern .wb-body::-webkit-scrollbar-track{background:0 0}.winbox.modern .wb-body::-webkit-scrollbar-thumb{border-radius:10px;background:#263040}.winbox.modern .wb-body::-webkit-scrollbar-thumb:window-inactive{background:#181f2a}.winbox.modern .wb-body::-webkit-scrollbar-corner{background:0 0} \ No newline at end of file +.winbox.modern{background:linear-gradient(90deg,#ff00f0,#0050ff);border-radius:12px 12px 0 0;animation:popup .3s cubic-bezier(.3,1,.3,1) forwards}.winbox.modern:not(.min,.focus){background:#666}@media (hover: hover){.winbox.modern.min:not(:hover){background:#666}.winbox.modern .wb-control *{opacity:.65}.winbox.modern .wb-control *:hover{opacity:1}}@media (hover: none){.winbox.modern.min{background:#666}}.winbox.modern.max{border-radius:0}.winbox.modern .wb-title{font-size:13px;text-transform:uppercase;font-weight:600}.winbox.modern .wb-body{margin:4px;color:#fff;background:#131820}.winbox.modern .wb-body::-webkit-scrollbar{width:12px;height:12px}.winbox.modern .wb-body::-webkit-scrollbar-track{background:transparent}.winbox.modern .wb-body::-webkit-scrollbar-thumb{border-radius:10px;background:#263040}.winbox.modern .wb-body::-webkit-scrollbar-thumb:window-inactive{background:#181f2a}.winbox.modern .wb-body::-webkit-scrollbar-corner{background:transparent}@keyframes popup{0%{transform:scale(.8)}to{transform:scale(1)}} diff --git a/dist/css/themes/white.min.css b/dist/css/themes/white.min.css index 2066375..7722bf8 100644 --- a/dist/css/themes/white.min.css +++ b/dist/css/themes/white.min.css @@ -1 +1 @@ -.winbox.white{background:#fff}.winbox.white .wb-title{color:#000}.winbox.white .wb-control{filter:invert(1)} \ No newline at end of file +.winbox.white{background:#fff}.winbox.white .wb-title{color:#000}.winbox.white .wb-control{filter:invert(1)} diff --git a/dist/css/winbox.min.css b/dist/css/winbox.min.css index 9108814..4122dd2 100644 --- a/dist/css/winbox.min.css +++ b/dist/css/winbox.min.css @@ -1 +1 @@ -@keyframes wb-fade-in{0%{opacity:0}to{opacity:.85}}.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22);transition:width .3s,height .3s,left .3s,top .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);contain:layout size;text-align:left;touch-action:none}.wb-body,.wb-header{position:absolute;left:0}.wb-header{top:0;width:100%;height:35px;line-height:35px;color:#fff;overflow:hidden;z-index:1}.wb-body{top:35px;right:0;bottom:0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:contents;background:#fff;margin-top:0!important;contain:strict;z-index:0}.wb-control *,.wb-icon{background-repeat:no-repeat}.wb-drag{height:100%;padding-left:10px;cursor:move}.wb-title{font-family:Arial,sans-serif;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-icon{display:none;width:20px;height:100%;margin:-1px 8px 0-3px;float:left;background-size:100%;background-position:center}.wb-e,.wb-w{width:10px;top:0}.wb-n,.wb-s{left:0;height:10px;position:absolute}.wb-n{top:-5px;right:0;cursor:n-resize;z-index:2}.wb-e{position:absolute;right:-5px;bottom:0;cursor:w-resize;z-index:2}.wb-s{bottom:-5px;right:0;cursor:n-resize;z-index:2}.wb-nw,.wb-sw,.wb-w{left:-5px}.wb-w{position:absolute;bottom:0;cursor:w-resize;z-index:2}.wb-ne,.wb-nw,.wb-sw{width:15px;height:15px;z-index:2;position:absolute}.wb-nw{top:-5px;cursor:nw-resize}.wb-ne,.wb-sw{cursor:ne-resize}.wb-ne{top:-5px;right:-5px}.wb-se,.wb-sw{bottom:-5px}.wb-se{position:absolute;right:-5px;width:15px;height:15px;cursor:nw-resize;z-index:2}.wb-control{float:right;height:100%;max-width:100%;text-align:center}.wb-control *{display:inline-block;width:30px;height:100%;max-width:100%;background-position:center;cursor:pointer}.no-close .wb-close,.no-full .wb-full,.no-header .wb-header,.no-max .wb-max,.no-min .wb-min,.no-resize .wb-body~div,.wb-body .wb-hide,.wb-show,.winbox.hide,.winbox.min .wb-body>*,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.winbox.max .wb-drag,.winbox.min .wb-drag{cursor:default}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center calc(50% + 6px)}.wb-max{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCA5NiA5NiI+PHBhdGggZD0iTTIwIDcxLjMxMUMxNS4zNCA2OS42NyAxMiA2NS4yMyAxMiA2MFYyMGMwLTYuNjMgNS4zNy0xMiAxMi0xMmg0MGM1LjIzIDAgOS42NyAzLjM0IDExLjMxMSA4SDI0Yy0yLjIxIDAtNCAxLjc5LTQgNHY1MS4zMTF6Ii8+PHBhdGggZD0iTTkyIDc2VjM2YzAtNi42My01LjM3LTEyLTEyLTEySDQwYy02LjYzIDAtMTIgNS4zNy0xMiAxMnY0MGMwIDYuNjMgNS4zNyAxMiAxMiAxMmg0MGM2LjYzIDAgMTItNS4zNyAxMi0xMnptLTUyIDRjLTIuMjEgMC00LTEuNzktNC00VjM2YzAtMi4yMSAxLjc5LTQgNC00aDQwYzIuMjEgMCA0IDEuNzkgNCA0djQwYzAgMi4yMS0xLjc5IDQtNCA0SDQweiIvPjwvc3ZnPg==);background-size:17px auto}.wb-close{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xIC0xIDE4IDE4Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJtMS42MTMuMjEuMDk0LjA4M0w4IDYuNTg1IDE0LjI5My4yOTNsLjA5NC0uMDgzYTEgMSAwIDAgMSAxLjQwMyAxLjQwM2wtLjA4My4wOTRMOS40MTUgOGw2LjI5MiA2LjI5M2ExIDEgMCAwIDEtMS4zMiAxLjQ5N2wtLjA5NC0uMDgzTDggOS40MTVsLTYuMjkzIDYuMjkyLS4wOTQuMDgzQTEgMSAwIDAgMSAuMjEgMTQuMzg3bC4wODMtLjA5NEw2LjU4NSA4IC4yOTMgMS43MDdBMSAxIDAgMCAxIDEuNjEzLjIxeiIvPjwvc3ZnPg==);background-size:15px auto;background-position:5px center}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.max .wb-body~div,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-drag,body.wb-lock iframe{pointer-events:none}.winbox.max{box-shadow:none}.winbox.max .wb-body{margin:0!important}.winbox iframe{position:absolute;width:100%;height:100%;border:0}body.wb-lock .winbox{will-change:left,top,width,height;transition:none}.winbox.modal:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:"";position:absolute;top:-50vh;left:-50vw;right:-50vw;bottom:-50vh;background:#0d1117;animation:wb-fade-in .2s ease-out forwards;z-index:-1}.no-animation{transition:none}.no-shadow{box-shadow:none}.no-header .wb-body{top:0}.no-move:not(.min) .wb-title{pointer-events:none}.wb-body .wb-show{display:revert} \ No newline at end of file +.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px #00000040,0 10px 10px #00000038;transition:width .3s,height .3s,left .3s,top .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);contain:layout size;text-align:left;touch-action:none}.wb-header{position:absolute;left:0;top:0;width:100%;height:35px;line-height:35px;color:#fff;overflow:hidden;z-index:1}.wb-body{position:absolute;inset:35px 0 0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:contents;background:#fff;margin-top:0!important;contain:strict;z-index:0}.wb-drag{height:100%;padding-left:10px;cursor:move}.wb-title{font-family:Arial,sans-serif;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-icon{display:none;width:20px;height:100%;margin:-1px 8px 0 -3px;float:left;background-repeat:no-repeat;background-size:100%;background-position:center}.wb-n{position:absolute;top:-5px;left:0;right:0;height:10px;cursor:n-resize;z-index:2}.wb-e{position:absolute;top:0;right:-5px;bottom:0;width:10px;cursor:w-resize;z-index:2}.wb-s{position:absolute;bottom:-5px;left:0;right:0;height:10px;cursor:n-resize;z-index:2}.wb-w{position:absolute;top:0;left:-5px;bottom:0;width:10px;cursor:w-resize;z-index:2}.wb-nw{position:absolute;top:-5px;left:-5px;width:15px;height:15px;cursor:nw-resize;z-index:2}.wb-ne{position:absolute;top:-5px;right:-5px;width:15px;height:15px;cursor:ne-resize;z-index:2}.wb-sw{position:absolute;bottom:-5px;left:-5px;width:15px;height:15px;cursor:ne-resize;z-index:2}.wb-se{position:absolute;bottom:-5px;right:-5px;width:15px;height:15px;cursor:nw-resize;z-index:2}.wb-control{float:right;height:100%;max-width:100%;text-align:center}.wb-control *{display:inline-block;width:30px;height:100%;max-width:100%;background-position:center;background-repeat:no-repeat;cursor:pointer}.wb-min{background-image:url('data:image/svg+xml,%0A %0A');background-size:14px auto;background-position:center calc(50% + 6px)}.wb-max{background-image:url('data:image/svg+xml,%0A %0A %0A');background-size:17px auto}.wb-close{background-image:url('data:image/svg+xml,%0A %0A');background-size:15px auto;background-position:5px center}.wb-full{background-image:url('data:image/svg+xml,%0A %0A');background-size:16px auto}.winbox.modal .wb-body~div,.winbox.modal .wb-drag,.winbox.min .wb-body~div,.winbox.max .wb-body~div{pointer-events:none}.winbox.max .wb-drag{cursor:default}.winbox.min .wb-full,.winbox.min .wb-min{display:none}.winbox.min .wb-drag{cursor:default}.winbox.min .wb-body>*{display:none}.winbox.hide{display:none}.winbox.max{box-shadow:none}.winbox.max .wb-body{margin:0!important}.winbox iframe{position:absolute;width:100%;height:100%;border:0}body.wb-lock .winbox{will-change:left,top,width,height;transition:none}body.wb-lock iframe{pointer-events:none}.winbox.modal:before{content:"";position:absolute;inset:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:"";position:absolute;top:-50vh;left:-50vw;right:-50vw;bottom:-50vh;background:#0d1117;animation:wb-fade-in .2s ease-out forwards;z-index:-1}.winbox.modal .wb-min,.winbox.modal .wb-max,.winbox.modal .wb-full{display:none}@keyframes wb-fade-in{0%{opacity:0}to{opacity:.85}}.no-animation{transition:none}.no-shadow{box-shadow:none}.no-header .wb-header{display:none}.no-header .wb-body{top:0}.no-min .wb-min,.no-max .wb-max,.no-full .wb-full,.no-close .wb-close{display:none}.no-resize .wb-body~div{display:none}.no-move:not(.min) .wb-title{pointer-events:none}.wb-body .wb-hide,.wb-show{display:none}.wb-body .wb-show{display:revert} diff --git a/dist/js/winbox.min.js b/dist/js/winbox.min.js deleted file mode 100644 index 30b93e7..0000000 --- a/dist/js/winbox.min.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * WinBox.js v0.2.82 - * Author and Copyright: Thomas Wilkerling - * Licence: Apache-2.0 - * Hosted by Nextapps GmbH - * https://github.com/nextapps-de/winbox - */ -(function(){'use strict';var e,aa=document.createElement("div");aa.innerHTML="
";function h(a,b,c,f){a&&a.addEventListener(b,c,f||!1)}function k(a,b){var c=window,f=l;c&&c.removeEventListener(a,b,f||!1)}function m(a,b){a.stopPropagation();b&&a.preventDefault()}function t(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};/* - self.max &&*/ -var u=[],x=[],ba={capture:!0,passive:!1},l={capture:!0,passive:!0},A,ea=0,B=10,E,F,fa,J,K,ha; -function P(a,b){if(!(this instanceof P))return new P(a);A||ia();if(a){if(b){var c=a;a=b}if("string"===typeof a)c=a;else{var f=a.id;var d=a.index;var n=a.root;var p=a.template;c=c||a.title;var v=a.icon;var L=a.mount;var Q=a.html;var g=a.url;var q=a.width;var r=a.height;var w=a.minwidth;var C=a.minheight;var y=a.maxwidth;var z=a.maxheight;var ca=a.autosize;var D=a.overflow;var G=a.min;var H=a.max;var I=a.hidden;var da=a.modal;var W=a.x||(da?"center":0);var X=a.y||(da?"center":0);var M=a.top;var N=a.left; -var R=a.bottom;var S=a.right;var ja=a.background;var O=a.border;var T=a.header;var Y=a["class"];var ka=a.oncreate;var pa=a.onclose;var qa=a.onfocus;var ra=a.onblur;var sa=a.onmove;var ta=a.onresize;var ua=a.onfullscreen;var va=a.onmaximize;var wa=a.onminimize;var xa=a.onrestore;var ya=a.onhide;var za=a.onshow;var Aa=a.onload}}this.g=(p||aa).cloneNode(!0);this.g.id=this.id=f||"winbox-"+ ++ea;this.g.className="winbox"+(Y?" "+("string"===typeof Y?Y:Y.join(" ")):"")+(da?" modal":"");this.g.winbox=this; -this.window=this.g;this.body=this.g.getElementsByClassName("wb-body")[0];this.h=T||35;x.push(this);ja&&this.setBackground(ja);O?t(this.body,"margin",O+(isNaN(O)?"":"px")):O=0;T&&(b=this.g.getElementsByClassName("wb-header")[0],t(b,"height",T+"px"),t(b,"line-height",T+"px"),t(this.body,"top",T+"px"));c&&this.setTitle(c);v&&this.setIcon(v);L?this.mount(L):Q?this.body.innerHTML=Q:g&&this.setUrl(g,Aa);M=M?U(M,K):0;R=R?U(R,K):0;N=N?U(N,J):0;S=S?U(S,J):0;c=J-N-S;v=K-M-R;y=y?U(y,c):c;z=z?U(z,v):v;w=w?U(w, -y):150;C=C?U(C,z):this.h;ca?((n||A).appendChild(this.body),q=Math.max(Math.min(this.body.clientWidth+2*O+1,y),w),r=Math.max(Math.min(this.body.clientHeight+this.h+O+1,z),C),this.g.appendChild(this.body)):(q=q?U(q,y):Math.max(y/2,w)|0,r=r?U(r,z):Math.max(z/2,C)|0);W=W?U(W,c,q):N;X=X?U(X,v,r):M;this.x=W;this.y=X;this.width=q;this.height=r;this.s=w;this.o=C;this.m=y;this.l=z;this.top=M;this.right=S;this.bottom=R;this.left=N;this.index=d;this.j=D;this.focused=this.hidden=this.full=this.max=this.min=!1; -this.onclose=pa;this.onfocus=qa;this.onblur=ra;this.onmove=sa;this.onresize=ta;this.onfullscreen=ua;this.onmaximize=va;this.onminimize=wa;this.onrestore=xa;this.onhide=ya;this.onshow=za;I?this.hide():this.focus();if(d||0===d)this.index=d,t(this.g,"z-index",d),d>B&&(B=d);H?this.maximize():G?this.minimize():this.resize().move();la(this);(n||A).appendChild(this.g);ka&&ka.call(this,a)}P["new"]=function(a){return new P(a)};P.stack=function(){return x}; -function U(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2+.5|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c+.5|0:c));return a} -function ia(){A=document.body;A[F="requestFullscreen"]||A[F="msRequestFullscreen"]||A[F="webkitRequestFullscreen"]||A[F="mozRequestFullscreen"]||(F="");fa=F&&F.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");h(window,"resize",function(){ma();na()});h(A,"mousedown",function(){ha=!1},!0);h(A,"mousedown",function(){if(!ha){var a=x.length;if(a)for(--a;0<=a;a--){var b=x[a];if(b.focused){b.blur();break}}}});ma()} -function la(a){V(a,"drag");V(a,"n");V(a,"s");V(a,"w");V(a,"e");V(a,"nw");V(a,"ne");V(a,"se");V(a,"sw");h(a.g.getElementsByClassName("wb-min")[0],"click",function(b){m(b);a.min?a.restore().focus():a.minimize()});h(a.g.getElementsByClassName("wb-max")[0],"click",function(b){m(b);a.max?a.restore().focus():a.maximize().focus()});F?h(a.g.getElementsByClassName("wb-full")[0],"click",function(b){m(b);a.fullscreen().focus()}):a.addClass("no-full");h(a.g.getElementsByClassName("wb-close")[0],"click",function(b){m(b); -a.close()||(a=null)});h(a.g,"mousedown",function(){ha=!0},!0);h(a.body,"mousedown",function(){a.focus()},!0)}function Z(a){u.splice(u.indexOf(a),1);na();a.removeClass("min");a.min=!1;a.g.title=""}function na(){for(var a=u.length,b={},c={},f=0,d;fr){a.max?a.restore():a.maximize();return}}}a.min||(A.classList.add("wb-lock"),(p=g.touches)&&(p=p[0])?(g=p,h(window,"touchmove",f,l),h(window,"touchend",d,l)):(h(window,"mousemove",f,l),h(window,"mouseup",d,l)),v=g.pageX,L=g.pageY)}function f(g){m(g);p&&(g=g.touches[0]);var q=g.pageX;g=g.pageY;var r=q-v,w=g-L,C=a.width,y=a.height,z=a.x, -ca=a.y,D;if("drag"===b){if(a.g.classList.contains("no-move"))return;a.x+=r;a.y+=w;var G=D=1}else{if("e"===b||"se"===b||"ne"===b){a.width+=r;var H=1}else if("w"===b||"sw"===b||"nw"===b)a.x+=r,a.width-=r,G=H=1;if("s"===b||"se"===b||"sw"===b){a.height+=w;var I=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=w,a.height-=w,D=I=1}H&&(a.width=Math.max(Math.min(a.width,a.m,J-a.x-a.right),a.s),H=a.width!==C);I&&(a.height=Math.max(Math.min(a.height,a.l,K-a.y-a.bottom),a.o),I=a.height!==y);(H||I)&&a.resize();G&& -(a.max&&(a.x=(qJ/3*2?J-a.width-a.right:J/2-a.width/2)+r),a.x=Math.max(Math.min(a.x,a.j?J-30:J-a.width-a.right),a.j?30-a.width:a.left),G=a.x!==z);D&&(a.max&&(a.y=a.top+w),a.y=Math.max(Math.min(a.y,a.j?K-a.h:K-a.height-a.bottom),a.top),D=a.y!==ca);if(G||D)a.max&&a.restore(),a.move();if(H||G)v=q;if(I||D)L=g}function d(g){m(g);A.classList.remove("wb-lock");p?(k("touchmove",f),k("touchend",d)):(k("mousemove",f),k("mouseup",d))}var n=a.g.getElementsByClassName("wb-"+b)[0];if(n){var p,v,L, -Q=0;h(n,"mousedown",c,ba);h(n,"touchstart",c,ba)}}function ma(){var a=document.documentElement;J=a.clientWidth;K=a.clientHeight}e=P.prototype;e.mount=function(a){this.unmount();a.i||(a.i=a.parentNode);this.body.textContent="";this.body.appendChild(a);return this};e.unmount=function(a){var b=this.body.firstChild;if(b){var c=a||b.i;c&&c.appendChild(b);b.i=a}return this}; -e.setTitle=function(a){var b=this.g.getElementsByClassName("wb-title")[0];a=this.title=a;var c=b.firstChild;c?c.nodeValue=a:b.textContent=a;return this};e.setIcon=function(a){var b=this.g.getElementsByClassName("wb-icon")[0];t(b,"background-image","url("+a+")");t(b,"display","inline-block");return this};e.setBackground=function(a){t(this.g,"background",a);return this}; -e.setUrl=function(a,b){var c=this.body.firstChild;c&&"iframe"===c.tagName.toLowerCase()?c.src=a:(this.body.innerHTML='',b&&(this.body.firstChild.onload=b));return this};e.focus=function(a){if(!1===a)return this.blur();if(!this.focused){a=x.length;if(1*,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.winbox.max .wb-drag,.winbox.min .wb-drag{cursor:default}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center calc(50% + 6px)}.wb-max{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCA5NiA5NiI+PHBhdGggZD0iTTIwIDcxLjMxMUMxNS4zNCA2OS42NyAxMiA2NS4yMyAxMiA2MFYyMGMwLTYuNjMgNS4zNy0xMiAxMi0xMmg0MGM1LjIzIDAgOS42NyAzLjM0IDExLjMxMSA4SDI0Yy0yLjIxIDAtNCAxLjc5LTQgNHY1MS4zMTF6Ii8+PHBhdGggZD0iTTkyIDc2VjM2YzAtNi42My01LjM3LTEyLTEyLTEySDQwYy02LjYzIDAtMTIgNS4zNy0xMiAxMnY0MGMwIDYuNjMgNS4zNyAxMiAxMiAxMmg0MGM2LjYzIDAgMTItNS4zNyAxMi0xMnptLTUyIDRjLTIuMjEgMC00LTEuNzktNC00VjM2YzAtMi4yMSAxLjc5LTQgNC00aDQwYzIuMjEgMCA0IDEuNzkgNCA0djQwYzAgMi4yMS0xLjc5IDQtNCA0SDQweiIvPjwvc3ZnPg==);background-size:17px auto}.wb-close{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xIC0xIDE4IDE4Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJtMS42MTMuMjEuMDk0LjA4M0w4IDYuNTg1IDE0LjI5My4yOTNsLjA5NC0uMDgzYTEgMSAwIDAgMSAxLjQwMyAxLjQwM2wtLjA4My4wOTRMOS40MTUgOGw2LjI5MiA2LjI5M2ExIDEgMCAwIDEtMS4zMiAxLjQ5N2wtLjA5NC0uMDgzTDggOS40MTVsLTYuMjkzIDYuMjkyLS4wOTQuMDgzQTEgMSAwIDAgMSAuMjEgMTQuMzg3bC4wODMtLjA5NEw2LjU4NSA4IC4yOTMgMS43MDdBMSAxIDAgMCAxIDEuNjEzLjIxeiIvPjwvc3ZnPg==);background-size:15px auto;background-position:5px center}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.max .wb-body~div,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-drag,body.wb-lock iframe{pointer-events:none}.winbox.max{box-shadow:none}.winbox.max .wb-body{margin:0!important}.winbox iframe{position:absolute;width:100%;height:100%;border:0}body.wb-lock .winbox{will-change:left,top,width,height;transition:none}.winbox.modal:before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:'';position:absolute;top:-50vh;left:-50vw;right:-50vw;bottom:-50vh;background:#0d1117;animation:wb-fade-in .2s ease-out forwards;z-index:-1}.no-animation{transition:none}.no-shadow{box-shadow:none}.no-header .wb-body{top:0}.no-move:not(.min) .wb-title{pointer-events:none}.wb-body .wb-show{display:revert}"; -var h=document.getElementsByTagName("head")[0];h.firstChild?h.insertBefore(aa,h.firstChild):h.appendChild(aa);var ba=document.createElement("div");ba.innerHTML="
";function k(a,b,c,f){a&&a.addEventListener(b,c,f||!1)}function l(a,b){var c=window,f=m;c&&c.removeEventListener(a,b,f||!1)}function t(a,b){a.stopPropagation();b&&a.preventDefault()}function u(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};/* - self.max &&*/ -var x=[],A=[],ca={capture:!0,passive:!1},m={capture:!0,passive:!0},B,da=0,E=10,F,J,ha,K,P,ia; -function U(a,b){if(!(this instanceof U))return new U(a);B||ja();if(a){if(b){var c=a;a=b}if("string"===typeof a)c=a;else{var f=a.id;var d=a.index;var n=a.root;var p=a.template;c=c||a.title;var v=a.icon;var L=a.mount;var Q=a.html;var g=a.url;var q=a.width;var r=a.height;var w=a.minwidth;var C=a.minheight;var y=a.maxwidth;var z=a.maxheight;var ea=a.autosize;var D=a.overflow;var G=a.min;var H=a.max;var I=a.hidden;var fa=a.modal;var X=a.x||(fa?"center":0);var Y=a.y||(fa?"center":0);var M=a.top;var N=a.left; -var R=a.bottom;var S=a.right;var la=a.background;var O=a.border;var T=a.header;var Z=a["class"];var ma=a.oncreate;var ra=a.onclose;var sa=a.onfocus;var ta=a.onblur;var ua=a.onmove;var va=a.onresize;var wa=a.onfullscreen;var xa=a.onmaximize;var ya=a.onminimize;var za=a.onrestore;var Aa=a.onhide;var Ba=a.onshow;var Ca=a.onload}}this.g=(p||ba).cloneNode(!0);this.g.id=this.id=f||"winbox-"+ ++da;this.g.className="winbox"+(Z?" "+("string"===typeof Z?Z:Z.join(" ")):"")+(fa?" modal":"");this.g.winbox=this; -this.window=this.g;this.body=this.g.getElementsByClassName("wb-body")[0];this.h=T||35;A.push(this);la&&this.setBackground(la);O?u(this.body,"margin",O+(isNaN(O)?"":"px")):O=0;T&&(b=this.g.getElementsByClassName("wb-header")[0],u(b,"height",T+"px"),u(b,"line-height",T+"px"),u(this.body,"top",T+"px"));c&&this.setTitle(c);v&&this.setIcon(v);L?this.mount(L):Q?this.body.innerHTML=Q:g&&this.setUrl(g,Ca);M=M?V(M,P):0;R=R?V(R,P):0;N=N?V(N,K):0;S=S?V(S,K):0;c=K-N-S;v=P-M-R;y=y?V(y,c):c;z=z?V(z,v):v;w=w?V(w, -y):150;C=C?V(C,z):this.h;ea?((n||B).appendChild(this.body),q=Math.max(Math.min(this.body.clientWidth+2*O+1,y),w),r=Math.max(Math.min(this.body.clientHeight+this.h+O+1,z),C),this.g.appendChild(this.body)):(q=q?V(q,y):Math.max(y/2,w)|0,r=r?V(r,z):Math.max(z/2,C)|0);X=X?V(X,c,q):N;Y=Y?V(Y,v,r):M;this.x=X;this.y=Y;this.width=q;this.height=r;this.s=w;this.o=C;this.m=y;this.l=z;this.top=M;this.right=S;this.bottom=R;this.left=N;this.index=d;this.j=D;this.focused=this.hidden=this.full=this.max=this.min=!1; -this.onclose=ra;this.onfocus=sa;this.onblur=ta;this.onmove=ua;this.onresize=va;this.onfullscreen=wa;this.onmaximize=xa;this.onminimize=ya;this.onrestore=za;this.onhide=Aa;this.onshow=Ba;I?this.hide():this.focus();if(d||0===d)this.index=d,u(this.g,"z-index",d),d>E&&(E=d);H?this.maximize():G?this.minimize():this.resize().move();ka(this);(n||B).appendChild(this.g);ma&&ma.call(this,a)}U["new"]=function(a){return new U(a)};U.stack=function(){return A}; -function V(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2+.5|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c+.5|0:c));return a} -function ja(){B=document.body;B[J="requestFullscreen"]||B[J="msRequestFullscreen"]||B[J="webkitRequestFullscreen"]||B[J="mozRequestFullscreen"]||(J="");ha=J&&J.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");k(window,"resize",function(){na();oa()});k(B,"mousedown",function(){ia=!1},!0);k(B,"mousedown",function(){if(!ia){var a=A.length;if(a)for(--a;0<=a;a--){var b=A[a];if(b.focused){b.blur();break}}}});na()} -function ka(a){W(a,"drag");W(a,"n");W(a,"s");W(a,"w");W(a,"e");W(a,"nw");W(a,"ne");W(a,"se");W(a,"sw");k(a.g.getElementsByClassName("wb-min")[0],"click",function(b){t(b);a.min?a.restore().focus():a.minimize()});k(a.g.getElementsByClassName("wb-max")[0],"click",function(b){t(b);a.max?a.restore().focus():a.maximize().focus()});J?k(a.g.getElementsByClassName("wb-full")[0],"click",function(b){t(b);a.fullscreen().focus()}):a.addClass("no-full");k(a.g.getElementsByClassName("wb-close")[0],"click",function(b){t(b); -a.close()||(a=null)});k(a.g,"mousedown",function(){ia=!0},!0);k(a.body,"mousedown",function(){a.focus()},!0)}function pa(a){x.splice(x.indexOf(a),1);oa();a.removeClass("min");a.min=!1;a.g.title=""}function oa(){for(var a=x.length,b={},c={},f=0,d;fr){a.max?a.restore():a.maximize();return}}}a.min||(B.classList.add("wb-lock"),(p=g.touches)&&(p=p[0])?(g=p,k(window,"touchmove",f,m),k(window,"touchend",d,m)):(k(window,"mousemove",f,m),k(window,"mouseup",d,m)),v=g.pageX,L=g.pageY)}function f(g){t(g);p&&(g=g.touches[0]);var q=g.pageX;g=g.pageY;var r=q-v,w=g-L,C=a.width,y=a.height,z=a.x, -ea=a.y,D;if("drag"===b){if(a.g.classList.contains("no-move"))return;a.x+=r;a.y+=w;var G=D=1}else{if("e"===b||"se"===b||"ne"===b){a.width+=r;var H=1}else if("w"===b||"sw"===b||"nw"===b)a.x+=r,a.width-=r,G=H=1;if("s"===b||"se"===b||"sw"===b){a.height+=w;var I=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=w,a.height-=w,D=I=1}H&&(a.width=Math.max(Math.min(a.width,a.m,K-a.x-a.right),a.s),H=a.width!==C);I&&(a.height=Math.max(Math.min(a.height,a.l,P-a.y-a.bottom),a.o),I=a.height!==y);(H||I)&&a.resize();G&& -(a.max&&(a.x=(qK/3*2?K-a.width-a.right:K/2-a.width/2)+r),a.x=Math.max(Math.min(a.x,a.j?K-30:K-a.width-a.right),a.j?30-a.width:a.left),G=a.x!==z);D&&(a.max&&(a.y=a.top+w),a.y=Math.max(Math.min(a.y,a.j?P-a.h:P-a.height-a.bottom),a.top),D=a.y!==ea);if(G||D)a.max&&a.restore(),a.move();if(H||G)v=q;if(I||D)L=g}function d(g){t(g);B.classList.remove("wb-lock");p?(l("touchmove",f),l("touchend",d)):(l("mousemove",f),l("mouseup",d))}var n=a.g.getElementsByClassName("wb-"+b)[0];if(n){var p,v,L, -Q=0;k(n,"mousedown",c,ca);k(n,"touchstart",c,ca)}}function na(){var a=document.documentElement;K=a.clientWidth;P=a.clientHeight}e=U.prototype;e.mount=function(a){this.unmount();a.i||(a.i=a.parentNode);this.body.textContent="";this.body.appendChild(a);return this};e.unmount=function(a){var b=this.body.firstChild;if(b){var c=a||b.i;c&&c.appendChild(b);b.i=a}return this}; -e.setTitle=function(a){var b=this.g.getElementsByClassName("wb-title")[0];a=this.title=a;var c=b.firstChild;c?c.nodeValue=a:b.textContent=a;return this};e.setIcon=function(a){var b=this.g.getElementsByClassName("wb-icon")[0];u(b,"background-image","url("+a+")");u(b,"display","inline-block");return this};e.setBackground=function(a){u(this.g,"background",a);return this}; -e.setUrl=function(a,b){var c=this.body.firstChild;c&&"iframe"===c.tagName.toLowerCase()?c.src=a:(this.body.innerHTML='',b&&(this.body.firstChild.onload=b));return this};e.focus=function(a){if(!1===a)return this.blur();if(!this.focused){a=A.length;if(1{var j=(t,i)=>()=>(t&&(i=t(t=0)),i);var Nt=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);function yt(t){return G||(G=document.createElement("div"),G.innerHTML=Tt),(t||G).cloneNode(!0)}var G,Tt,zt=j(()=>{G=null,Tt="
"});function l(t,i,e,o){t&&t.addEventListener(i,e,o||!1)}function I(t,i,e,o){t&&t.removeEventListener(i,e,o||!1)}function N(t,i){t.stopPropagation(),i&&t.preventDefault()}function v(t,i){return t.getElementsByClassName(i)[0]}function ot(t,i){t.classList.add(i)}function kt(t,i){return t.classList.contains(i)}function nt(t,i){t.classList.remove(i)}function u(t,i,e){e=""+e,t["_s_"+i]!==e&&(t.style.setProperty(i,e),t["_s_"+i]=e)}function _t(t,i){let e=t.firstChild;e?e.nodeValue=i:t.textContent=i}var Ct=j(()=>{});function n(t,i){if(!(this instanceof n))return new n(t);y||Rt();let e,o,s,h,c,_,C,W,X,z,x,g,r,d,m,q,F,O,R,M,L,w,b,A,E,rt,U,$,V,Y,D,tt,dt,ct,lt,at,ut,mt,ft,wt,bt,pt,xt,gt;if(t&&(i&&(c=t,t=i),typeof t=="string"?c=t:(e=t.id,o=t.index,s=t.root,h=t.template,c=c||t.title,_=t.icon,C=t.mount,W=t.html,X=t.url,z=t.width,x=t.height,g=t.minwidth,r=t.minheight,d=t.maxwidth,m=t.maxheight,q=t.autosize,F=t.overflow,A=t.min,E=t.max,rt=t.hidden,U=t.modal,O=t.x||(U?"center":0),R=t.y||(U?"center":0),M=t.top,L=t.left,w=t.bottom,b=t.right,$=t.background,V=t.border,Y=t.header,D=t.class,tt=t.oncreate,dt=t.onclose,ct=t.onfocus,lt=t.onblur,at=t.onmove,ut=t.onresize,mt=t.onfullscreen,ft=t.onmaximize,wt=t.onminimize,bt=t.onrestore,pt=t.onhide,xt=t.onshow,gt=t.onload)),this.dom=yt(h),this.dom.id=this.id=e||"winbox-"+ ++Ot,this.dom.className="winbox"+(D?" "+(typeof D=="string"?D:D.join(" ")):"")+(U?" modal":""),this.dom.winbox=this,this.window=this.dom,this.body=v(this.dom,"wb-body"),this.header=Y||35,p.push(this),$&&this.setBackground($),V?u(this.body,"margin",V+(isNaN(V)?"":"px")):V=0,Y){let vt=v(this.dom,"wb-header");u(vt,"height",Y+"px"),u(vt,"line-height",Y+"px"),u(this.body,"top",Y+"px")}c&&this.setTitle(c),_&&this.setIcon(_),C?this.mount(C):W?this.body.innerHTML=W:X&&this.setUrl(X,gt),M=M?a(M,k):0,w=w?a(w,k):0,L=L?a(L,f):0,b=b?a(b,f):0;let it=f-L-b,et=k-M-w;d=d?a(d,it):it,m=m?a(m,et):et,g=g?a(g,d):150,r=r?a(r,m):this.header,q?((s||y).appendChild(this.body),z=Math.max(Math.min(this.body.clientWidth+V*2+1,d),g),x=Math.max(Math.min(this.body.clientHeight+this.header+V+1,m),r),this.dom.appendChild(this.body)):(z=z?a(z,d):Math.max(d/2,g)|0,x=x?a(x,m):Math.max(m/2,r)|0),O=O?a(O,it,z):L,R=R?a(R,et,x):M,this.x=O,this.y=R,this.width=z,this.height=x,this.minwidth=g,this.minheight=r,this.maxwidth=d,this.maxheight=m,this.top=M,this.right=b,this.bottom=w,this.left=L,this.index=o,this.overflow=F,this.min=!1,this.max=!1,this.full=!1,this.hidden=!1,this.focused=!1,this.onclose=dt,this.onfocus=ct,this.onblur=lt,this.onmove=at,this.onresize=ut,this.onfullscreen=mt,this.onmaximize=ft,this.onminimize=wt,this.onrestore=bt,this.onhide=pt,this.onshow=xt,rt?this.hide():this.focus(),(o||o===0)&&(this.index=o,u(this.dom,"z-index",o),o>K&&(K=o)),E?this.maximize():A?this.minimize():this.resize().move(),Vt(this),(s||y).appendChild(this.dom),tt&&tt.call(this,t)}function a(t,i,e){if(typeof t=="string")if(t==="center")t=(i-e)/2+.5|0;else if(t==="right"||t==="bottom")t=i-e;else{let o=parseFloat(t);(""+o!==t&&t.substring((""+o).length))==="%"?t=i/100*o+.5|0:t=o}return t}function Rt(){y=document.body,y[H="requestFullscreen"]||y[H="msRequestFullscreen"]||y[H="webkitRequestFullscreen"]||y[H="mozRequestFullscreen"]||(H=""),At=H&&H.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit"),l(window,"resize",function(){Lt(),ht()}),l(y,"mousedown",function(t){st=!1},!0),l(y,"mousedown",function(t){if(!st){let i=p.length;if(i)for(let e=i-1;e>=0;e--){let o=p[e];if(o.focused){o.blur();break}}}}),Lt()}function Vt(t){B(t,"drag"),B(t,"n"),B(t,"s"),B(t,"w"),B(t,"e"),B(t,"nw"),B(t,"ne"),B(t,"se"),B(t,"sw"),l(v(t.dom,"wb-min"),"click",function(i){N(i),t.min?t.restore().focus():t.minimize()}),l(v(t.dom,"wb-max"),"click",function(i){N(i),t.max?t.restore().focus():t.maximize().focus()}),H?l(v(t.dom,"wb-full"),"click",function(i){N(i),t.fullscreen().focus()}):t.addClass("no-full"),l(v(t.dom,"wb-close"),"click",function(i){N(i),t.close()||(t=null)}),l(t.dom,"mousedown",function(i){st=!0},!0),l(t.body,"mousedown",function(i){t.focus()},!0)}function Q(t){P.splice(P.indexOf(t),1),ht(),t.removeClass("min"),t.min=!1,t.dom.title=""}function ht(){let t=P.length,i={},e={};for(let o=0,s,h;of/3*2?f-t.width-t.right:f/2-t.width/2)+q),t.x=Math.max(Math.min(t.x,t.overflow?f-30:f-t.width-t.right),t.overflow?30-t.width:t.left),A=t.x!==M),E&&(t.max&&(t.y=t.top+F),t.y=Math.max(Math.min(t.y,t.overflow?k-t.header:k-t.height-t.bottom),t.top),E=t.y!==L),(A||E)&&(t.max&&t.restore(),J?_=!0:t.move()),(w||A)&&(s=d),(b||E)&&(h=m)}function g(r){N(r),nt(y,"wb-lock"),J&&cancelAnimationFrame(c),o?(I(window,"touchmove",x,T),I(window,"touchend",g,T)):(I(window,"mousemove",x,T),I(window,"mouseup",g,T))}}function Lt(){let t=document.documentElement;f=t.clientWidth,k=t.clientHeight}function Bt(){let t=p.length;if(t)for(let i=t-1;i>=0;i--){let e=p[i];if(!e.min){e.focus();break}}}function Wt(){return document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement}function Z(){if(S.full=!1,Wt())return document[At](),!0}var J,P,p,Mt,T,y,Ot,K,S,H,At,f,k,st,Et,Ht=j(()=>{zt();Ct();J=!1,P=[],p=[],Mt={capture:!0,passive:!1},T={capture:!0,passive:!0},Ot=0,K=10;n.new=function(t){return new n(t)};n.stack=function(){return p};Et=n;n.prototype.mount=function(t){return this.unmount(),t._backstore||(t._backstore=t.parentNode),this.body.textContent="",this.body.appendChild(t),this};n.prototype.unmount=function(t){let i=this.body.firstChild;if(i){let e=t||i._backstore;e&&e.appendChild(i),i._backstore=t}return this};n.prototype.setTitle=function(t){let i=v(this.dom,"wb-title");return _t(i,this.title=t),this};n.prototype.setIcon=function(t){let i=v(this.dom,"wb-icon");return u(i,"background-image","url("+t+")"),u(i,"display","inline-block"),this};n.prototype.setBackground=function(t){return u(this.dom,"background",t),this};n.prototype.setUrl=function(t,i){let e=this.body.firstChild;return e&&e.tagName.toLowerCase()==="iframe"?e.src=t:(this.body.innerHTML='',i&&(this.body.firstChild.onload=i)),this};n.prototype.focus=function(t){if(t===!1)return this.blur();if(!this.focused){let i=p.length;if(i>1)for(let e=1;e<=i;e++){let o=p[i-e];if(o.focused){o.blur(),p.push(p.splice(p.indexOf(this),1)[0]);break}}u(this.dom,"z-index",++K),this.index=K,this.addClass("focus"),this.focused=!0,this.onfocus&&this.onfocus()}return this};n.prototype.blur=function(t){return t===!1?this.focus():(this.focused&&(this.removeClass("focus"),this.focused=!1,this.onblur&&this.onblur()),this)};n.prototype.hide=function(t){if(t===!1)return this.show();if(!this.hidden)return this.onhide&&this.onhide(),this.hidden=!0,this.addClass("hide")};n.prototype.show=function(t){if(t===!1)return this.hide();if(this.hidden)return this.onshow&&this.onshow(),this.hidden=!1,this.removeClass("hide")};n.prototype.minimize=function(t){return t===!1?this.restore():(S&&Z(),this.max&&(this.removeClass("max"),this.max=!1),this.min||(P.push(this),ht(),this.dom.title=this.title,this.addClass("min"),this.min=!0,this.focused&&(this.blur(),Bt()),this.onminimize&&this.onminimize()),this)};n.prototype.restore=function(){return S&&Z(),this.min&&(Q(this),this.resize().move(),this.onrestore&&this.onrestore()),this.max&&(this.max=!1,this.removeClass("max").resize().move(),this.onrestore&&this.onrestore()),this};n.prototype.maximize=function(t){return t===!1?this.restore():(S&&Z(),this.min&&Q(this),this.max||(this.addClass("max").resize(f-this.left-this.right,k-this.top-this.bottom,!0).move(this.left,this.top,!0),this.max=!0,this.onmaximize&&this.onmaximize()),this)};n.prototype.fullscreen=function(t){if(this.min&&(Q(this),this.resize().move()),!S||!Z())this.body[H](),S=this,this.full=!0,this.onfullscreen&&this.onfullscreen();else if(t===!1)return this.restore();return this};n.prototype.close=function(t){if(this.onclose&&this.onclose(t))return!0;this.min&&Q(this),p.splice(p.indexOf(this),1),this.unmount(),this.dom.remove(),this.dom.textContent="",this.dom.winbox=null,this.body=null,this.dom=null,this.focused&&Bt()};n.prototype.move=function(t,i,e){return!t&&t!==0?(t=this.x,i=this.y):e||(this.x=t?t=a(t,f-this.left-this.right,this.width):0,this.y=i?i=a(i,k-this.top-this.bottom,this.height):0),u(this.dom,"left",t+"px"),u(this.dom,"top",i+"px"),this.onmove&&this.onmove(t,i),this};n.prototype.resize=function(t,i,e){return!t&&t!==0?(t=this.width,i=this.height):e||(this.width=t?t=a(t,this.maxwidth):0,this.height=i?i=a(i,this.maxheight):0,t=Math.max(t,this.minwidth),i=Math.max(i,this.minheight)),u(this.dom,"width",t+"px"),u(this.dom,"height",i+"px"),this.onresize&&this.onresize(t,i),this};n.prototype.addControl=function(t){let i=t.class,e=t.image,o=t.click,s=t.index,h=document.createElement("span"),c=v(this.dom,"wb-control"),_=this;return i&&(h.className=i),e&&u(h,"background-image","url("+e+")"),o&&(h.onclick=function(C){o.call(this,C,_)}),c.insertBefore(h,c.childNodes[s||0]),this};n.prototype.removeControl=function(t){return t=v(this.dom,t),t&&t.remove(),this};n.prototype.addClass=function(t){return ot(this.dom,t),this};n.prototype.removeClass=function(t){return nt(this.dom,t),this};n.prototype.hasClass=function(t){return kt(this.dom,t)};n.prototype.toggleClass=function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)}});var qt=j(()=>{(()=>{let t=document.createElement("style");t.innerHTML=`.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px #00000040,0 10px 10px #00000038;transition:width .3s,height .3s,left .3s,top .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);contain:layout size;text-align:left;touch-action:none}.wb-header{position:absolute;left:0;top:0;width:100%;height:35px;line-height:35px;color:#fff;overflow:hidden;z-index:1}.wb-body{position:absolute;inset:35px 0 0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:contents;background:#fff;margin-top:0!important;contain:strict;z-index:0}.wb-drag{height:100%;padding-left:10px;cursor:move}.wb-title{font-family:Arial,sans-serif;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-icon{display:none;width:20px;height:100%;margin:-1px 8px 0 -3px;float:left;background-repeat:no-repeat;background-size:100%;background-position:center}.wb-n{position:absolute;top:-5px;left:0;right:0;height:10px;cursor:n-resize;z-index:2}.wb-e{position:absolute;top:0;right:-5px;bottom:0;width:10px;cursor:w-resize;z-index:2}.wb-s{position:absolute;bottom:-5px;left:0;right:0;height:10px;cursor:n-resize;z-index:2}.wb-w{position:absolute;top:0;left:-5px;bottom:0;width:10px;cursor:w-resize;z-index:2}.wb-nw{position:absolute;top:-5px;left:-5px;width:15px;height:15px;cursor:nw-resize;z-index:2}.wb-ne{position:absolute;top:-5px;right:-5px;width:15px;height:15px;cursor:ne-resize;z-index:2}.wb-sw{position:absolute;bottom:-5px;left:-5px;width:15px;height:15px;cursor:ne-resize;z-index:2}.wb-se{position:absolute;bottom:-5px;right:-5px;width:15px;height:15px;cursor:nw-resize;z-index:2}.wb-control{float:right;height:100%;max-width:100%;text-align:center}.wb-control *{display:inline-block;width:30px;height:100%;max-width:100%;background-position:center;background-repeat:no-repeat;cursor:pointer}.wb-min{background-image:url('data:image/svg+xml,%0A %0A');background-size:14px auto;background-position:center calc(50% + 6px)}.wb-max{background-image:url('data:image/svg+xml,%0A %0A %0A');background-size:17px auto}.wb-close{background-image:url('data:image/svg+xml,%0A %0A');background-size:15px auto;background-position:5px center}.wb-full{background-image:url('data:image/svg+xml,%0A %0A');background-size:16px auto}.winbox.modal .wb-body~div,.winbox.modal .wb-drag,.winbox.min .wb-body~div,.winbox.max .wb-body~div{pointer-events:none}.winbox.max .wb-drag{cursor:default}.winbox.min .wb-full,.winbox.min .wb-min{display:none}.winbox.min .wb-drag{cursor:default}.winbox.min .wb-body>*{display:none}.winbox.hide{display:none}.winbox.max{box-shadow:none}.winbox.max .wb-body{margin:0!important}.winbox iframe{position:absolute;width:100%;height:100%;border:0}body.wb-lock .winbox{will-change:left,top,width,height;transition:none}body.wb-lock iframe{pointer-events:none}.winbox.modal:before{content:"";position:absolute;inset:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:"";position:absolute;top:-50vh;left:-50vw;right:-50vw;bottom:-50vh;background:#0d1117;animation:wb-fade-in .2s ease-out forwards;z-index:-1}.winbox.modal .wb-min,.winbox.modal .wb-max,.winbox.modal .wb-full{display:none}@keyframes wb-fade-in{0%{opacity:0}to{opacity:.85}}.no-animation{transition:none}.no-shadow{box-shadow:none}.no-header .wb-header{display:none}.no-header .wb-body{top:0}.no-min .wb-min,.no-max .wb-max,.no-full .wb-full,.no-close .wb-close{display:none}.no-resize .wb-body~div{display:none}.no-move:not(.min) .wb-title{pointer-events:none}.wb-body .wb-hide,.wb-show{display:none}.wb-body .wb-show{display:revert} +`,document.head.append(t)})()});var Xt=Nt((Jt,Ft)=>{Ht();qt();Ft.exports=Et});return Xt();})(); diff --git a/index.html b/index.html index 78250b2..4139cbd 100644 --- a/index.html +++ b/index.html @@ -8,11 +8,11 @@ WinBox.js – Modern HTML5 Window Manager - + - - + + diff --git a/package.json b/package.json index f3ed2fa..8b646dd 100644 --- a/package.json +++ b/package.json @@ -31,14 +31,13 @@ "scripts": { "copy": "cpx \"src/img/*.*\" dist/img/", "clean": "node task/clean", - "build:css": "lessc src/css/winbox.less src/css/winbox.css", - "build:css:bundle": "node task/bundle --image && lessc --autoprefix=\">=1%\" --clean-css=\"--s1 --advanced --rebase\" tmp/bundle.less dist/css/winbox.min.css && csso dist/css/winbox.min.css --output dist/css/winbox.min.css", - "build:css:theme-modern": "lessc --autoprefix=\">=1%\" --clean-css=\"--s1 --advanced --rebase\" src/css/themes/modern.less dist/css/themes/modern.min.css && csso dist/css/themes/modern.min.css --output dist/css/themes/modern.min.css", - "build:css:theme-white": "lessc --autoprefix=\">=1%\" --clean-css=\"--s1 --advanced --rebase\" src/css/themes/white.less dist/css/themes/white.min.css && csso dist/css/themes/white.min.css --output dist/css/themes/white.min.css", - "build:js": "node task/build", - "build:bundle": "node task/build --bundle", + "build:css:bundle": "esbuild --bundle src/css/winbox.css --loader:.svg=dataurl --minify --outfile=dist/css/winbox.min.css", + "build:css:theme-modern": "esbuild --bundle src/css/themes/modern.css --loader:.svg=dataurl --minify --outfile=dist/css/themes/modern.min.css", + "build:css:theme-white": "esbuild --bundle src/css/themes/white.css --loader:.svg=dataurl --minify --outfile=dist/css/themes/white.min.css", + "build:js": "node task/esbuild.mjs", + "build:bundle": "node task/esbuild.bundle.mjs", "build:svg": "node task/svgo", - "build": "npm run clean && npm run copy && npm run build:svg && npm run build:css && npm run build:css:bundle && npm run build:css:theme-modern && npm run build:css:theme-white && node task/bundle --style && npm run build:js && npm run build:bundle && echo Build Complete. && exit 0", + "build": "npm run clean && npm run copy && npm run build:svg && npm run build:css:bundle && npm run build:css:theme-modern && npm run build:css:theme-white && npm run build:bundle && echo Build Complete. && exit 0", "server": "node task/server.js" }, "files": [ @@ -50,12 +49,13 @@ "LICENSE" ], "readme": "README.md", - "dependencies": {}, "devDependencies": { "base64-img": "^1.0.4", "cpx": "^1.5.0", "csso": "^5.0.4", "csso-cli": "^4.0.1", + "esbuild": "0.23.0", + "esbuild-css-modules-plugin": "^3.1.2", "google-closure-compiler": "^20220719.0.0", "less": "^4.1.3", "less-plugin-autoprefix": "^2.0.0", diff --git a/src/css/control.less b/src/css/control.less deleted file mode 100644 index 9d9002b..0000000 --- a/src/css/control.less +++ /dev/null @@ -1,50 +0,0 @@ -.no-animation { - transition: none; -} - -.no-shadow { - box-shadow: none; -} - -.no-header { - .wb-header { - display: none; - } - .wb-body { - top: 0; - } -} - -.no-min .wb-min { - display: none; -} - -.no-max .wb-max { - display: none; -} - -.no-full .wb-full { - display: none; -} - -.no-close .wb-close { - display: none; -} - -.no-resize .wb-body ~ div { - display: none; -} - -.no-move:not(.min) .wb-title { - pointer-events: none; -} - -.wb-body .wb-hide { - display: none; -} -.wb-show { - display: none; -} -.wb-body .wb-show { - display: revert; -} diff --git a/src/css/images.less b/src/css/images.less deleted file mode 100644 index 44864c0..0000000 --- a/src/css/images.less +++ /dev/null @@ -1,5 +0,0 @@ -@max: "../img/max.svg"; -@close: "../img/close.svg"; -@full: "../img/full.svg"; -@min: "../img/min.svg"; -@restore: "../img/restore.svg"; diff --git a/src/css/themes/modern.css b/src/css/themes/modern.css new file mode 100644 index 0000000..99aeba2 --- /dev/null +++ b/src/css/themes/modern.css @@ -0,0 +1,63 @@ +.winbox.modern { + background: linear-gradient(90deg, #ff00f0, #0050ff); + border-radius: 12px 12px 0 0; + animation: popup 0.3s cubic-bezier(0.3, 1, 0.3, 1) forwards; +} +.winbox.modern:not(.min, .focus) { + background: #666; +} +@media (hover: hover) { + .winbox.modern.min:not(:hover) { + background: #666; + } + .winbox.modern .wb-control * { + opacity: 0.65; + } + .winbox.modern .wb-control *:hover { + opacity: 1; + } +} +@media (hover: none) { + .winbox.modern.min { + background: #666; + } +} +.winbox.modern.max { + border-radius: 0; +} +.winbox.modern .wb-title { + font-size: 13px; + text-transform: uppercase; + font-weight: 600; +} +.winbox.modern .wb-body { + /* width of window border: */ + margin: 4px; + color: #fff; + background: #131820; +} +.winbox.modern .wb-body::-webkit-scrollbar { + width: 12px; + height: 12px; +} +.winbox.modern .wb-body::-webkit-scrollbar-track { + background: transparent; +} +.winbox.modern .wb-body::-webkit-scrollbar-thumb { + border-radius: 10px; + background: #263040; +} +.winbox.modern .wb-body::-webkit-scrollbar-thumb:window-inactive { + background: #181f2a; +} +.winbox.modern .wb-body::-webkit-scrollbar-corner { + background: transparent; +} +@keyframes popup { + 0% { + transform: scale(0.8); + } + 100% { + transform: scale(1); + } +} diff --git a/src/css/themes/modern.less b/src/css/themes/modern.less deleted file mode 100644 index d66c66f..0000000 --- a/src/css/themes/modern.less +++ /dev/null @@ -1,86 +0,0 @@ -.winbox.modern { - & { - background: linear-gradient(90deg, #ff00f0, #0050ff); - border-radius: 12px 12px 0 0; - animation: popup 0.3s cubic-bezier(0.3, 1, 0.3, 1) forwards; - } - - //&.min:not(:hover), - &:not(.min,.focus) { - background: #666; - } - - // hover fix for mobile devices which keeps the :hover state when touched - - @media (hover: hover) { - &.min:not(:hover) { - background: #666; - } - - .wb-control * { - opacity: 0.65; - } - - .wb-control *:hover { - opacity: 1; - } - } - - @media (hover: none) { - &.min { - background: #666; - } - } - - //&.min, - &.max { - border-radius: 0; - } - - .wb-title { - font-size: 13px; - text-transform: uppercase; - font-weight: 600; - } - - .wb-body { - - & { - /* width of window border: */ - margin: 4px; - color: #fff; - background: #131820; - } - - &::-webkit-scrollbar { - width: 12px; - height: 12px; - } - - &::-webkit-scrollbar-track { - background: transparent; - } - - &::-webkit-scrollbar-thumb { - border-radius: 10px; - background: #263040; - } - - &::-webkit-scrollbar-thumb:window-inactive { - background: #181f2a; - } - - &::-webkit-scrollbar-corner { - background: transparent; - } - } -} - -@keyframes popup { - 0% { - transform: scale(0.8); - } - 100% { - transform: scale(1); - } -} diff --git a/src/css/themes/white.css b/src/css/themes/white.css new file mode 100644 index 0000000..985a972 --- /dev/null +++ b/src/css/themes/white.css @@ -0,0 +1,9 @@ +.winbox.white { + background: #fff; +} +.winbox.white .wb-title { + color: #000; +} +.winbox.white .wb-control { + filter: invert(1); +} diff --git a/src/css/themes/white.less b/src/css/themes/white.less deleted file mode 100644 index 23a0d10..0000000 --- a/src/css/themes/white.less +++ /dev/null @@ -1,13 +0,0 @@ -.winbox.white { - & { - background: #fff; - } - - .wb-title { - color: #000; - } - - .wb-control { - filter: invert(1); - } -} \ No newline at end of file diff --git a/src/css/winbox.css b/src/css/winbox.css index 9660acf..99d0441 100644 --- a/src/css/winbox.css +++ b/src/css/winbox.css @@ -3,9 +3,15 @@ left: 0; top: 0; background: #0050ff; - box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); + box-shadow: + 0 14px 28px rgba(0, 0, 0, 0.25), + 0 10px 10px rgba(0, 0, 0, 0.22); /* using transform make contents blur when applied and requires more gpu memory */ - transition: width 0.3s, height 0.3s, left 0.3s, top 0.3s; + transition: + width 0.3s, + height 0.3s, + left 0.3s, + top 0.3s; transition-timing-function: cubic-bezier(0.3, 1, 0.3, 1); /* contain "strict" does not make overflow contents selectable */ contain: layout size; @@ -236,7 +242,7 @@ body.wb-lock iframe { pointer-events: none; } .winbox.modal:before { - content: ''; + content: ""; position: absolute; top: 0; left: 0; @@ -246,7 +252,7 @@ body.wb-lock iframe { border-radius: inherit; } .winbox.modal:after { - content: ''; + content: ""; position: absolute; top: -50vh; left: -50vw; diff --git a/src/css/winbox.less b/src/css/winbox.less deleted file mode 100644 index 897b765..0000000 --- a/src/css/winbox.less +++ /dev/null @@ -1,315 +0,0 @@ -@import "images.less"; -@winbox-header-height: 35px; - -.winbox { - position: fixed; - left: 0; - top: 0; - background: #0050ff; - box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); - /* using transform make contents blur when applied and requires more gpu memory */ - //transition: width .3s, height .3s, transform .3s; - transition: width .3s, height .3s, left .3s, top .3s; - transition-timing-function: cubic-bezier(0.3, 1, 0.3, 1); - //transform-origin: bottom center; - /* contain "strict" does not make overflow contents selectable */ - contain: layout size; - /* explicitly set text align to left fixes an issue with iframes alignment when centered */ - text-align: left; - /* workaround for using passive listeners */ - touch-action: none; -} - -.wb-header { - position: absolute; - left: 0; - top: 0; - width: 100%; - height: @winbox-header-height; - line-height: @winbox-header-height; - color: #fff; - overflow: hidden; - z-index: 1; -} - -.wb-body { - position: absolute; - top: @winbox-header-height; - left: 0; - right: 0; - bottom: 0; - overflow: auto; - -webkit-overflow-scrolling: touch; - overflow-scrolling: touch; - will-change: contents; - background: #fff; - /* when no border is set there is some thin line visible */ - //margin: -1px; - /* always hide top border visually */ - margin-top: 0 !important; - contain: strict; - //content-visibility: auto; - z-index: 0; -} -/* -body > .wb-body{ - position: relative; - display: inline-block; - visibility: hidden; - contain: none; -} -*/ - -.wb-drag{ - height: 100%; - padding-left: 10px; - cursor: move; -} - -.wb-title{ - font-family : Arial, sans-serif; - font-size: 14px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -.wb-icon { - display: none; - width: 20px; - height: 100%; - margin: -1px 8px 0 -3px; - float: left; - background-repeat: no-repeat; - background-size: 100%; - background-position: center; -} - -.wb-n { - position: absolute; - top: -5px; - left: 0; - right: 0; - height: 10px; - cursor: n-resize; - z-index: 2; -} - -.wb-e { - position: absolute; - top: 0; - right: -5px; - bottom: 0; - width: 10px; - cursor: w-resize; - z-index: 2; -} - -.wb-s { - position: absolute; - bottom: -5px; - left: 0; - right: 0; - height: 10px; - cursor: n-resize; - z-index: 2; -} - -.wb-w { - position: absolute; - top: 0; - left: -5px; - bottom: 0; - width: 10px; - cursor: w-resize; - z-index: 2; -} - -.wb-nw { - position: absolute; - top: -5px; - left: -5px; - width: 15px; - height: 15px; - cursor: nw-resize; - z-index: 2; -} - -.wb-ne { - position: absolute; - top: -5px; - right: -5px; - width: 15px; - height: 15px; - cursor: ne-resize; - z-index: 2; -} - -.wb-sw { - position: absolute; - bottom: -5px; - left: -5px; - width: 15px; - height: 15px; - cursor: ne-resize; - z-index: 2; -} - -.wb-se { - position: absolute; - bottom: -5px; - right: -5px; - width: 15px; - height: 15px; - cursor: nw-resize; - z-index: 2; -} - -.wb-control{ - float: right; - height: 100%; - max-width: 100%; - text-align: center; -} - -.wb-control * { - display: inline-block; - width: 30px; - height: 100%; - max-width: 100%; - background-position: center; - background-repeat: no-repeat; - cursor: pointer; -} - -.wb-min { - background-image: url(@min); - background-size: 14px auto; - background-position: center calc(50% + 6px); -} - -.wb-max { - background-image: url(@max); - background-size: 17px auto; -} - -.wb-close { - background-image: url(@close); - background-size: 15px auto; - background-position: 5px center; -} - -.wb-full { - background-image: url(@full); - background-size: 16px auto; -} - -/* -.winbox:not(.max) .wb-max { - background-image: url(@restore); - background-size: 20px auto; - background-position: center bottom 5px; -} -*/ - -/* -.winbox:fullscreen{ - transition: none !important; -} -.winbox:fullscreen .wb-full{ - background-image: url(@minimize); -} -.winbox:fullscreen > div, -.winbox:fullscreen .wb-title, -*/ - -.winbox.modal .wb-body ~ div, -.winbox.modal .wb-drag, -.winbox.min .wb-body ~ div, -.winbox.max .wb-body ~ div { - pointer-events: none; -} -.winbox.max .wb-drag{ - cursor: default; -} - -.winbox.min { - .wb-full, - .wb-min { - display: none; - } - .wb-drag { - cursor: default; - } - .wb-body > *{ - display: none; - } -} - -.winbox.hide { - display: none; - //visibility: hidden; -} - -.winbox.max { - box-shadow: none; -} - -.winbox.max .wb-body { - margin: 0 !important; -} - -.winbox iframe{ - position: absolute; - width: 100%; - height: 100%; - border: 0; -} - -body.wb-lock .winbox{ - will-change: left, top, width, height; - transition: none; -} -body.wb-lock iframe { - pointer-events: none; -} - -.winbox.modal{ - &:before{ - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: inherit; - border-radius: inherit; - } - &:after{ - content: ''; - position: absolute; - top: -50vh; - left: -50vw; - right: -50vw; - bottom: -50vh; - background: #0d1117; - animation: wb-fade-in 0.2s ease-out forwards; - z-index: -1; - } - .wb-min, - .wb-max, - .wb-full{ - display: none; - } -} - -@keyframes wb-fade-in { - 0%{ - opacity: 0; - } - 100%{ - opacity: 0.85; - } -} - -@import "control.less"; diff --git a/src/js/webpack.js b/src/js/webpack.js deleted file mode 100644 index 61db2d2..0000000 --- a/src/js/webpack.js +++ /dev/null @@ -1,60 +0,0 @@ -import WinBox from "./winbox.js"; - -/** @export */ WinBox.new; -/** @export */ WinBox.stack; -/** @export */ WinBox.prototype.mount; -/** @export */ WinBox.prototype.unmount; -/** @export */ WinBox.prototype.move; -/** @export */ WinBox.prototype.resize; -/** @export */ WinBox.prototype.close; -/** @export */ WinBox.prototype.focus; -/** @export */ WinBox.prototype.blur; -/** @export */ WinBox.prototype.hide; -/** @export */ WinBox.prototype.show; -/** @export */ WinBox.prototype.minimize; -/** @export */ WinBox.prototype.maximize; -/** @export */ WinBox.prototype.fullscreen; -/** @export */ WinBox.prototype.restore; -/** @export */ WinBox.prototype.setBackground; -/** @export */ WinBox.prototype.setTitle; -/** @export */ WinBox.prototype.setIcon; -/** @export */ WinBox.prototype.setUrl; -/** @export */ WinBox.prototype.addControl; -/** @export */ WinBox.prototype.removeControl; -/** @export */ WinBox.prototype.addClass; -/** @export */ WinBox.prototype.removeClass; -/** @export */ WinBox.prototype.toggleClass; -/** @export */ //WinBox.prototype.use; - -/** @export */ WinBox.id; -/** @export */ WinBox.window; -/** @export */ WinBox.index; -/** @export */ WinBox.body; -/** @export */ WinBox.min; -/** @export */ WinBox.max; -/** @export */ WinBox.full; -/** @export */ WinBox.hidden; -/** @export */ WinBox.focused; -/** @export */ WinBox.x; -/** @export */ WinBox.y; -/** @export */ WinBox.width; -/** @export */ WinBox.height; -/** @export */ WinBox.top; -/** @export */ WinBox.right; -/** @export */ WinBox.bottom; -/** @export */ WinBox.left; - -/** @export */ WinBox.oncreate; -/** @export */ WinBox.onclose; -/** @export */ WinBox.onfocus; -/** @export */ WinBox.onblur; -/** @export */ WinBox.onmove; -/** @export */ WinBox.onresize; -/** @export */ WinBox.onfullscreen; -/** @export */ WinBox.onmaximize; -/** @export */ WinBox.onminimize; -/** @export */ WinBox.onrestore; -/** @export */ WinBox.onhide; -/** @export */ WinBox.onshow; - -window["WinBox"] = WinBox; diff --git a/task/build.js b/task/build.js deleted file mode 100644 index fb064dd..0000000 --- a/task/build.js +++ /dev/null @@ -1,131 +0,0 @@ -const child_process = require('child_process'); -const fs = require('fs'); - -console.log("Start build ....."); -console.log(); - -fs.existsSync("log") || fs.mkdirSync("log"); -fs.existsSync("tmp") || fs.mkdirSync("tmp"); -fs.existsSync("dist") || fs.mkdirSync("dist"); -fs.existsSync("dist/js") || fs.mkdirSync("dist/js"); - -/* -const options = (function(argv){ - - const arr = {}; - let count = 0; - - argv.forEach(function(val, index) { - - if(++count > 2){ - - index = val.split('='); - val = index[1]; - index = index[0]; - - arr[index] = val; - - if(count > 3) console.log(index + ': ' + val); - } - }); - - return arr; - -})(process.argv); -*/ - -const bundle = process.argv[2] === "--bundle"; -//const extern = process.argv[2] === "--extern"; - -const parameter = (function(opt){ - - let parameter = ''; - - for(let index in opt){ - - if(opt.hasOwnProperty(index)){ - - parameter += ' --' + index + '=' + opt[index]; - } - } - - return parameter; -})({ - - compilation_level: "ADVANCED_OPTIMIZATIONS", //"WHITESPACE" - use_types_for_optimization: true, - //new_type_inf: true, - //jscomp_warning: "newCheckTypes", - //jscomp_error: "strictCheckTypes", - //jscomp_error: "newCheckTypesExtraChecks", - generate_exports: true, - export_local_property_definitions: true, - language_in: "ECMASCRIPT6_STRICT", - language_out: "ECMASCRIPT5_STRICT", - process_closure_primitives: true, - summary_detail_level: 3, - warning_level: "VERBOSE", - emit_use_strict: true, - - output_manifest: "log/manifest.log", - //output_module_dependencies: "log/module_dependencies.log", - property_renaming_report: "log/renaming_report.log", - strict_mode_input: true, - assume_function_wrapper: true, - - //transform_amd_modules: true, - process_common_js_modules: true, - module_resolution: "BROWSER", - dependency_mode: "PRUNE_LEGACY", - rewrite_polyfills: false, - //js_module_root: "./", - entry_point: "./src/js/webpack.js", - //manage_closure_dependencies: true, - //dependency_mode: "PRUNE_LEGACY", - - isolation_mode: "IIFE" - //output_wrapper: "(function(){%output%}());" - - //formatting: "PRETTY_PRINT" -}); - -exec((/^win/.test(process.platform) ? - - "\"node_modules/google-closure-compiler-windows/compiler.exe\"" -: - "java -jar node_modules/google-closure-compiler-java/compiler.jar" - -) + parameter + (bundle ? " --js='tmp/**.js'" : "") + " --js='src/js/**.js' --js_output_file='" + (bundle ? "dist/winbox.bundle.min.js" : "dist/js/winbox.min.js") + "' && exit 0", function(){ - - let build = fs.readFileSync((bundle ? "dist/winbox.bundle.min.js" : "dist/js/winbox.min.js")); - let preserve = fs.readFileSync("src/js/winbox.js", "utf8"); - - const package_json = require("../package.json"); - - preserve = preserve.replace("* WinBox.js", "* WinBox.js v" + package_json.version + (bundle ? " (Bundle)" : "")); - build = preserve.substring(0, preserve.indexOf('*/') + 2) + "\n" + build; - fs.writeFileSync((bundle ? "dist/winbox.bundle.min.js" : "dist/js/winbox.min.js"), build); - - console.log("Build Complete."); -}); - -function exec(prompt, callback){ - - const child = child_process.exec(prompt, function(err, stdout, stderr){ - - if(err){ - - console.error(err); - } - else{ - - if(callback){ - - callback(); - } - } - }); - - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); -} diff --git a/task/bundle.js b/task/bundle.js deleted file mode 100644 index 260ab87..0000000 --- a/task/bundle.js +++ /dev/null @@ -1,56 +0,0 @@ -const { base64Sync } = require('base64-img'); -const fs = require('fs'); - -fs.existsSync("log") || fs.mkdirSync("log"); -fs.existsSync("tmp") || fs.mkdirSync("tmp"); -fs.existsSync("dist") || fs.mkdirSync("dist"); -fs.existsSync("dist/js") || fs.mkdirSync("dist/js"); - -const image = process.argv[2] === "--image"; -//const template = process.argv[2] === "--template"; -const style = process.argv[2] === "--style"; - -(function(){ - - if(image){ - - // TODO provide custom filenames - - const compressed = { - - max: base64Sync('dist/img/max.svg'), - close: base64Sync('dist/img/close.svg'), - full: base64Sync('dist/img/full.svg'), - //restore: base64Sync('dist/img/restore.svg'), - //exit: base64Sync('dist/img/exit.svg'), - min: base64Sync('dist/img/min.svg') - }; - - let tmp = ""; - - for(let key in compressed){ - - if(compressed.hasOwnProperty(key)){ - - tmp += ("@" + key + ": \"" + compressed[key] + "\";\n"); - } - } - - fs.writeFileSync("tmp/images.less", tmp); - fs.writeFileSync("tmp/bundle.less", '@import "../src/css/winbox.less"; @import "images.less";'); // @import "../src/css/themes/modern.less"; @import "../src/css/themes/white.less"; - } - - // ---------------------- - - if(style){ - - fs.writeFileSync("tmp/style.js", - - 'const style = document.createElement("style");' + - 'style.innerHTML = "' + fs.readFileSync("dist/css/winbox.min.css", "utf8").replace(/"/g, "'") + '";' + - 'const head = document.getElementsByTagName("head")[0];' + - 'if(head.firstChild) head.insertBefore(style, head.firstChild); else head.appendChild(style);' - ); - } - -})(); diff --git a/task/esbuild.bundle.mjs b/task/esbuild.bundle.mjs new file mode 100644 index 0000000..a4a9ac6 --- /dev/null +++ b/task/esbuild.bundle.mjs @@ -0,0 +1,76 @@ +import esbuild from 'esbuild'; +import package_json from '../package.json' with { type: "json" }; + + +async function compileCssToJs(esbuild, path) { + const compiledCss = await esbuild.build({ + bundle: true, + entryPoints: [path], + loader: { + '.svg': 'dataurl', + }, + minify: true, + write: false + }); + + if (compiledCss.outputFiles.length !== 1) { + throw "Expected one css output file"; + } + const css = JSON.stringify(compiledCss.outputFiles[0].text); + + const script = ` + (() => { + const style = document.createElement('style'); + style.innerHTML = ${css}; + document.head.append(style); + })() + ` + return script; +} + +const jsBanner = ` +/** + * WinBox.js Bundle (${package_json.version}) + * Author and Copyright: Thomas Wilkerling + * @Licence: Apache-2.0 + * Hosted by Nextapps GmbH + * https://github.com/nextapps-de/winbox + */ +` +esbuild.build({ + bundle: true, + outfile: "dist/winbox.bundle.min.js", + minify: true, + stdin: { + contents: ` + import WinBox from './winbox'; + import '../css/winbox.css'; + module.exports = WinBox; + `, + resolveDir: "src/js" + }, + loader: { + '.svg': 'dataurl', + }, + banner: { + js: jsBanner + }, + plugins: [ + { + name: "Import CSS", + setup(build) { + build.onLoad({ filter: /\.css$/}, async (args) => { + if (args.namespace !== 'file') { + return; + } + return { + contents: await compileCssToJs(build.esbuild, args.path), + loader: 'js' + } + }) + } + } + ], + globalName: "WinBox", + metafile: true + }); diff --git a/task/esbuild.mjs b/task/esbuild.mjs new file mode 100644 index 0000000..46da128 --- /dev/null +++ b/task/esbuild.mjs @@ -0,0 +1,75 @@ +import esbuild from 'esbuild'; +import package_json from '../package.json' with { type: "json" }; + + +async function compileCssToJs(esbuild, path) { + const compiledCss = await esbuild.build({ + bundle: true, + entryPoints: [path], + loader: { + '.svg': 'dataurl', + }, + minify: true, + write: false + }); + + if (compiledCss.outputFiles.length !== 1) { + throw "Expected one css output file"; + } + const css = JSON.stringify(compiledCss.outputFiles[0].text); + + const script = ` + (() => { + const style = document.createElement('style'); + style.innerHTML = ${css}; + document.head.append(style); + })() + ` + return script; +} + +const jsBanner = ` +/** + * WinBox.js Bundle (${package_json.version}) + * Author and Copyright: Thomas Wilkerling + * @Licence: Apache-2.0 + * Hosted by Nextapps GmbH + * https://github.com/nextapps-de/winbox + */ +` +esbuild.build({ + bundle: true, + outfile: "dist/js/winbox.min.js", + minify: true, + stdin: { + contents: ` + import WinBox from './winbox.js'; + module.exports = WinBox; + `, + resolveDir: "src/js/" + }, + loader: { + '.svg': 'dataurl', + }, + banner: { + js: jsBanner + }, + plugins: [ + { + name: "Import CSS", + setup(build) { + build.onLoad({ filter: /\.css$/}, async (args) => { + if (args.namespace !== 'file') { + return; + } + return { + contents: await compileCssToJs(build.esbuild, args.path), + loader: 'js' + } + }) + } + }, + ], + globalName: "WinBox", + metafile: true + }); From 6f8dd6ce8df319aa33e6304ed16f53edb7653d46 Mon Sep 17 00:00:00 2001 From: Sam Mousa Date: Thu, 15 Aug 2024 09:56:58 +0200 Subject: [PATCH 2/2] chore: remove unused dev deps --- package.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/package.json b/package.json index 8b646dd..2c34fe0 100644 --- a/package.json +++ b/package.json @@ -50,16 +50,8 @@ ], "readme": "README.md", "devDependencies": { - "base64-img": "^1.0.4", "cpx": "^1.5.0", - "csso": "^5.0.4", - "csso-cli": "^4.0.1", "esbuild": "0.23.0", - "esbuild-css-modules-plugin": "^3.1.2", - "google-closure-compiler": "^20220719.0.0", - "less": "^4.1.3", - "less-plugin-autoprefix": "^2.0.0", - "less-plugin-clean-css": "^1.5.1", "svgo": "^2.8.0", "web-servo": "^0.5.1" }