UNPKG

ewuit

Version:

an easy web ui inspect tool

419 lines (392 loc) 34.3 kB
"use strict";var Nt=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},M=function(t){return t&&t.Math==Math&&t},h=M(typeof globalThis=="object"&&globalThis)||M(typeof window=="object"&&window)||M(typeof self=="object"&&self)||M(typeof Nt=="object"&&Nt)||function(){return this}()||Function("return this")(),Ct={},T=function(t){try{return!!t()}catch{return!0}},vr=T,E=!vr(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),sr=T,$e=!sr(function(){var t=function(){}.bind();return typeof t!="function"||t.hasOwnProperty("prototype")}),ur=$e,z=Function.prototype.call,Pt=ur?z.bind(z):function(){return z.apply(z,arguments)},Se={},Oe={}.propertyIsEnumerable,xe=Object.getOwnPropertyDescriptor,dr=xe&&!Oe.call({1:2},1);Se.f=dr?function(e){var r=xe(this,e);return!!r&&r.enumerable}:Oe;var Te=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}},Ee=$e,Ce=Function.prototype,fr=Ce.bind,bt=Ce.call,pr=Ee&&fr.bind(bt,bt),m=Ee?function(t){return t&&pr(t)}:function(t){return t&&function(){return bt.apply(t,arguments)}},Pe=m,hr=Pe({}.toString),br=Pe("".slice),yr=function(t){return br(hr(t),8,-1)},gr=h,mr=m,wr=T,$r=yr,tt=gr.Object,Sr=mr("".split),Or=wr(function(){return!tt("z").propertyIsEnumerable(0)})?function(t){return $r(t)=="String"?Sr(t,""):tt(t)}:tt,xr=h,Tr=xr.TypeError,Ie=function(t){if(t==null)throw Tr("Can't call method on "+t);return t},Er=Or,Cr=Ie,J=function(t){return Er(Cr(t))},w=function(t){return typeof t=="function"},Pr=w,D=function(t){return typeof t=="object"?t!==null:Pr(t)},et=h,Ir=w,jr=function(t){return Ir(t)?t:void 0},Z=function(t,e){return arguments.length<2?jr(et[t]):et[t]&&et[t][e]},kr=m,Rr=kr({}.isPrototypeOf),Lr=Z,_r=Lr("navigator","userAgent")||"",je=h,rt=_r,Kt=je.process,Ut=je.Deno,Wt=Kt&&Kt.versions||Ut&&Ut.version,Gt=Wt&&Wt.v8,g,V;Gt&&(g=Gt.split("."),V=g[0]>0&&g[0]<4?1:+(g[0]+g[1]));!V&&rt&&(g=rt.match(/Edge\/(\d+)/),(!g||g[1]>=74)&&(g=rt.match(/Chrome\/(\d+)/),g&&(V=+g[1])));var Ar=V,Vt=Ar,Dr=T,ke=!!Object.getOwnPropertySymbols&&!Dr(function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Vt&&Vt<41}),Br=ke,Re=Br&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Fr=h,Mr=Z,zr=w,Nr=Rr,Kr=Re,Ur=Fr.Object,Le=Kr?function(t){return typeof t=="symbol"}:function(t){var e=Mr("Symbol");return zr(e)&&Nr(e.prototype,Ur(t))},Wr=h,Gr=Wr.String,Vr=function(t){try{return Gr(t)}catch{return"Object"}},Hr=h,Yr=w,qr=Vr,Xr=Hr.TypeError,Jr=function(t){if(Yr(t))return t;throw Xr(qr(t)+" is not a function")},Zr=Jr,Qr=function(t,e){var r=t[e];return r==null?void 0:Zr(r)},tn=h,nt=Pt,ot=w,at=D,en=tn.TypeError,rn=function(t,e){var r,n;if(e==="string"&&ot(r=t.toString)&&!at(n=nt(r,t))||ot(r=t.valueOf)&&!at(n=nt(r,t))||e!=="string"&&ot(r=t.toString)&&!at(n=nt(r,t)))return n;throw en("Can't convert object to primitive value")},It={exports:{}},Ht=h,nn=Object.defineProperty,jt=function(t,e){try{nn(Ht,t,{value:e,configurable:!0,writable:!0})}catch{Ht[t]=e}return e},on=h,an=jt,Yt="__core-js_shared__",cn=on[Yt]||an(Yt,{}),kt=cn,qt=kt;(It.exports=function(t,e){return qt[t]||(qt[t]=e!==void 0?e:{})})("versions",[]).push({version:"3.21.1",mode:"global",copyright:"\xA9 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.1/LICENSE",source:"https://github.com/zloirock/core-js"});var ln=h,vn=Ie,sn=ln.Object,_e=function(t){return sn(vn(t))},un=m,dn=_e,fn=un({}.hasOwnProperty),C=Object.hasOwn||function(e,r){return fn(dn(e),r)},pn=m,hn=0,bn=Math.random(),yn=pn(1 .toString),Ae=function(t){return"Symbol("+(t===void 0?"":t)+")_"+yn(++hn+bn,36)},gn=h,mn=It.exports,Xt=C,wn=Ae,Jt=ke,De=Re,P=mn("wks"),O=gn.Symbol,Zt=O&&O.for,$n=De?O:O&&O.withoutSetter||wn,Be=function(t){if(!Xt(P,t)||!(Jt||typeof P[t]=="string")){var e="Symbol."+t;Jt&&Xt(O,t)?P[t]=O[t]:De&&Zt?P[t]=Zt(e):P[t]=$n(e)}return P[t]},Sn=h,On=Pt,Qt=D,te=Le,xn=Qr,Tn=rn,En=Be,Cn=Sn.TypeError,Pn=En("toPrimitive"),In=function(t,e){if(!Qt(t)||te(t))return t;var r=xn(t,Pn),n;if(r){if(e===void 0&&(e="default"),n=On(r,t,e),!Qt(n)||te(n))return n;throw Cn("Can't convert object to primitive value")}return e===void 0&&(e="number"),Tn(t,e)},jn=In,kn=Le,Fe=function(t){var e=jn(t,"string");return kn(e)?e:e+""},Rn=h,ee=D,yt=Rn.document,Ln=ee(yt)&&ee(yt.createElement),Me=function(t){return Ln?yt.createElement(t):{}},_n=E,An=T,Dn=Me,ze=!_n&&!An(function(){return Object.defineProperty(Dn("div"),"a",{get:function(){return 7}}).a!=7}),Bn=E,Fn=Pt,Mn=Se,zn=Te,Nn=J,Kn=Fe,Un=C,Wn=ze,re=Object.getOwnPropertyDescriptor;Ct.f=Bn?re:function(e,r){if(e=Nn(e),r=Kn(r),Wn)try{return re(e,r)}catch{}if(Un(e,r))return zn(!Fn(Mn.f,e,r),e[r])};var B={},Gn=E,Vn=T,Ne=Gn&&Vn(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),Ke=h,Hn=D,Yn=Ke.String,qn=Ke.TypeError,Q=function(t){if(Hn(t))return t;throw qn(Yn(t)+" is not an object")},Xn=h,Jn=E,Zn=ze,Qn=Ne,N=Q,ne=Fe,to=Xn.TypeError,it=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,ct="enumerable",lt="configurable",vt="writable";B.f=Jn?Qn?function(e,r,n){if(N(e),r=ne(r),N(n),typeof e=="function"&&r==="prototype"&&"value"in n&&vt in n&&!n[vt]){var o=eo(e,r);o&&o[vt]&&(e[r]=n.value,n={configurable:lt in n?n[lt]:o[lt],enumerable:ct in n?n[ct]:o[ct],writable:!1})}return it(e,r,n)}:it:function(e,r,n){if(N(e),r=ne(r),N(n),Zn)try{return it(e,r,n)}catch{}if("get"in n||"set"in n)throw to("Accessors not supported");return"value"in n&&(e[r]=n.value),e};var ro=E,no=B,oo=Te,Rt=ro?function(t,e,r){return no.f(t,e,oo(1,r))}:function(t,e,r){return t[e]=r,t},Ue={exports:{}},ao=m,io=w,gt=kt,co=ao(Function.toString);io(gt.inspectSource)||(gt.inspectSource=function(t){return co(t)});var We=gt.inspectSource,lo=h,vo=w,so=We,oe=lo.WeakMap,uo=vo(oe)&&/native code/.test(so(oe)),fo=It.exports,po=Ae,ae=fo("keys"),Ge=function(t){return ae[t]||(ae[t]=po(t))},Lt={},ho=uo,Ve=h,st=m,bo=D,yo=Rt,ut=C,dt=kt,go=Ge,mo=Lt,ie="Object already initialized",mt=Ve.TypeError,wo=Ve.WeakMap,H,_,Y,$o=function(t){return Y(t)?_(t):H(t,{})},So=function(t){return function(e){var r;if(!bo(e)||(r=_(e)).type!==t)throw mt("Incompatible receiver, "+t+" required");return r}};if(ho||dt.state){var S=dt.state||(dt.state=new wo),Oo=st(S.get),ce=st(S.has),xo=st(S.set);H=function(t,e){if(ce(S,t))throw new mt(ie);return e.facade=t,xo(S,t,e),e},_=function(t){return Oo(S,t)||{}},Y=function(t){return ce(S,t)}}else{var I=go("state");mo[I]=!0,H=function(t,e){if(ut(t,I))throw new mt(ie);return e.facade=t,yo(t,I,e),e},_=function(t){return ut(t,I)?t[I]:{}},Y=function(t){return ut(t,I)}}var To={set:H,get:_,has:Y,enforce:$o,getterFor:So},wt=E,Eo=C,He=Function.prototype,Co=wt&&Object.getOwnPropertyDescriptor,_t=Eo(He,"name"),Po=_t&&function(){}.name==="something",Io=_t&&(!wt||wt&&Co(He,"name").configurable),jo={EXISTS:_t,PROPER:Po,CONFIGURABLE:Io},ko=h,le=w,Ro=C,ve=Rt,Lo=jt,_o=We,Ye=To,Ao=jo.CONFIGURABLE,Do=Ye.get,Bo=Ye.enforce,Fo=String(String).split("String");(Ue.exports=function(t,e,r,n){var o=n?!!n.unsafe:!1,a=n?!!n.enumerable:!1,c=n?!!n.noTargetGet:!1,i=n&&n.name!==void 0?n.name:e,v;if(le(r)&&(String(i).slice(0,7)==="Symbol("&&(i="["+String(i).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Ro(r,"name")||Ao&&r.name!==i)&&ve(r,"name",i),v=Bo(r),v.source||(v.source=Fo.join(typeof i=="string"?i:""))),t===ko){a?t[e]=r:Lo(e,r);return}else o?!c&&t[e]&&(a=!0):delete t[e];a?t[e]=r:ve(t,e,r)})(Function.prototype,"toString",function(){return le(this)&&Do(this).source||_o(this)});var qe={},Mo=Math.ceil,zo=Math.floor,At=function(t){var e=+t;return e!==e||e===0?0:(e>0?zo:Mo)(e)},No=At,Ko=Math.max,Uo=Math.min,Wo=function(t,e){var r=No(t);return r<0?Ko(r+e,0):Uo(r,e)},Go=At,Vo=Math.min,Ho=function(t){return t>0?Vo(Go(t),9007199254740991):0},Yo=Ho,Xe=function(t){return Yo(t.length)},qo=J,Xo=Wo,Jo=Xe,se=function(t){return function(e,r,n){var o=qo(e),a=Jo(o),c=Xo(n,a),i;if(t&&r!=r){for(;a>c;)if(i=o[c++],i!=i)return!0}else for(;a>c;c++)if((t||c in o)&&o[c]===r)return t||c||0;return!t&&-1}},Zo={includes:se(!0),indexOf:se(!1)},Qo=m,ft=C,ta=J,ea=Zo.indexOf,ra=Lt,ue=Qo([].push),Je=function(t,e){var r=ta(t),n=0,o=[],a;for(a in r)!ft(ra,a)&&ft(r,a)&&ue(o,a);for(;e.length>n;)ft(r,a=e[n++])&&(~ea(o,a)||ue(o,a));return o},Dt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],na=Je,oa=Dt,aa=oa.concat("length","prototype");qe.f=Object.getOwnPropertyNames||function(e){return na(e,aa)};var Ze={};Ze.f=Object.getOwnPropertySymbols;var ia=Z,ca=m,la=qe,va=Ze,sa=Q,ua=ca([].concat),da=ia("Reflect","ownKeys")||function(e){var r=la.f(sa(e)),n=va.f;return n?ua(r,n(e)):r},de=C,fa=da,pa=Ct,ha=B,ba=function(t,e,r){for(var n=fa(e),o=ha.f,a=pa.f,c=0;c<n.length;c++){var i=n[c];!de(t,i)&&!(r&&de(r,i))&&o(t,i,a(e,i))}},ya=T,ga=w,ma=/#|\.prototype\./,F=function(t,e){var r=$a[wa(t)];return r==Oa?!0:r==Sa?!1:ga(e)?ya(e):!!e},wa=F.normalize=function(t){return String(t).replace(ma,".").toLowerCase()},$a=F.data={},Sa=F.NATIVE="N",Oa=F.POLYFILL="P",xa=F,pt=h,Ta=Ct.f,Ea=Rt,Ca=Ue.exports,Pa=jt,Ia=ba,ja=xa,ka=function(t,e){var r=t.target,n=t.global,o=t.stat,a,c,i,v,f,b;if(n?c=pt:o?c=pt[r]||Pa(r,{}):c=(pt[r]||{}).prototype,c)for(i in e){if(f=e[i],t.noTargetGet?(b=Ta(c,i),v=b&&b.value):v=c[i],a=ja(n?i:r+(o?".":"#")+i,t.forced),!a&&v!==void 0){if(typeof f==typeof v)continue;Ia(f,v)}(t.sham||v&&v.sham)&&Ea(f,"sham",!0),Ca(c,i,f,t)}},Qe={},Ra=Je,La=Dt,_a=Object.keys||function(e){return Ra(e,La)},Aa=E,Da=Ne,Ba=B,Fa=Q,Ma=J,za=_a;Qe.f=Aa&&!Da?Object.defineProperties:function(e,r){Fa(e);for(var n=Ma(r),o=za(r),a=o.length,c=0,i;a>c;)Ba.f(e,i=o[c++],n[i]);return e};var Na=Z,Ka=Na("document","documentElement"),Ua=Q,Wa=Qe,fe=Dt,Ga=Lt,Va=Ka,Ha=Me,Ya=Ge,pe=">",he="<",$t="prototype",St="script",tr=Ya("IE_PROTO"),ht=function(){},er=function(t){return he+St+pe+t+he+"/"+St+pe},be=function(t){t.write(er("")),t.close();var e=t.parentWindow.Object;return t=null,e},qa=function(){var t=Ha("iframe"),e="java"+St+":",r;return t.style.display="none",Va.appendChild(t),t.src=String(e),r=t.contentWindow.document,r.open(),r.write(er("document.F=Object")),r.close(),r.F},K,G=function(){try{K=new ActiveXObject("htmlfile")}catch{}G=typeof document!="undefined"?document.domain&&K?be(K):qa():be(K);for(var t=fe.length;t--;)delete G[$t][fe[t]];return G()};Ga[tr]=!0;var Xa=Object.create||function(e,r){var n;return e!==null?(ht[$t]=Ua(e),n=new ht,ht[$t]=null,n[tr]=e):n=G(),r===void 0?n:Wa.f(n,r)},Ja=Be,Za=Xa,Qa=B,Ot=Ja("unscopables"),xt=Array.prototype;xt[Ot]==null&&Qa.f(xt,Ot,{configurable:!0,value:Za(null)});var ti=function(t){xt[Ot][t]=!0},ei=ka,ri=_e,ni=Xe,oi=At,ai=ti;ei({target:"Array",proto:!0},{at:function(e){var r=ri(this),n=ni(r),o=oi(e),a=o>=0?o:n+o;return a<0||a>=n?void 0:r[a]}});ai("at");var $;(function(t){t.ATTRIBUTE="attribute",t.DISTANCE="distance"})($||($={}));/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */var Tt=function(){return Tt=Object.assign||function(e){for(var r,n=1,o=arguments.length;n<o;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Tt.apply(this,arguments)};function R(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),o,a=[],c;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)a.push(o.value)}catch(i){c={error:i}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return a}function ye(t,e,r){if(r||arguments.length===2)for(var n=0,o=e.length,a;n<o;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))}function p(t,e){var r=document.createElement(t);return e&&fi(r,e),r}function ii(t,e){e===void 0&&(e=1e3);var r=0;return function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];r+e>=Date.now()||(r=Date.now(),t.apply(this,o))}}function ci(t){var e;t===void 0&&(t=!1);var r=p("div");j(r),r.attachShadow({mode:"open"});var n=r.shadowRoot;q(r,"click");var o=document.body.cloneNode(!0),a=document.head.cloneNode(!0);return t||(li(r),q(r,"wheel",function(){Bt("\u7981\u6B62\u9875\u9762\u6EDA\u52A8")}),x(r,`::-webkit-scrollbar{ width:0 !important; }`)),(e=o.querySelector(".".concat(Et)))===null||e===void 0||e.remove(),o.querySelectorAll('div[class^="ewuit-comp-"]').forEach(function(c){c.remove()}),n==null||n.append(a),n==null||n.append(o),y(r,{position:"absolute",left:"0px",top:"0px",width:"100%"}),rr(o,document.body),setTimeout(function(){y(r,{zIndex:"5000"})},500),r}function rr(t,e){if((e==null?void 0:e.scrollTop)&&t&&(t.scrollTop=e.scrollTop,t.style.overflowY="hidden"),(e==null?void 0:e.scrollLeft)&&t&&(t.scrollLeft=e.scrollLeft,t.style.overflowX="hidden"),t!=null&&t.getAttribute("onclick")&&(t.removeAttribute("onclick"),t.onclick=function(){}),(t==null?void 0:t.tagName.toLowerCase())!=="script"&&(t==null?void 0:t.className)===(e==null?void 0:e.className)){var r=["margin","padding","border","fontSize"],n=getComputedStyle(e);r.forEach(function(c){t.style&&(t.style[c]=n[c])})}if((e==null?void 0:e.childElementCount)>0&&(t==null?void 0:t.childElementCount)>0){var o=Array.from(e.children),a=Array.from(t.children);o.forEach(function(c,i){var v=a[i];rr(v,c)})}}function li(t){q(t,"touchmove",function(){Bt("\u7981\u6B62\u5C4F\u5E55\u6ED1\u52A8")})}function q(t,e,r){t&&t.addEventListener(e,function(n){n.preventDefault(),typeof r=="function"&&r()},{passive:!1})}function y(t,e){t!=null&&t.style&&Object.assign(t.style,e)}function d(t,e){e===void 0&&(e="block");var r=function(n){n!=null&&n.style&&(n.style.display=e)};setTimeout(function(){[t].flat().forEach(r)})}function nr(){return document.documentElement.clientHeight}function X(){return document.documentElement.clientWidth}function vi(t){var e;return t.childElementCount===0&&((e=t==null?void 0:t.textContent)===null||e===void 0?void 0:e.replace(/\n|\s/g,""))}function si(t){var e=["img","image"],r=t.tagName.toLowerCase(),n=getComputedStyle(t).backgroundImage!=="none";return e.includes(r)||n}function ui(t,e,r){r=Tt({pixelConversion:function(s){return"".concat(s)}},r);var n=r||{},o=n.pixelConversion,a=o===void 0?A:o,c=n.styles,i={fontSize:"\u5B57\u53F7",fontFamily:"\u5B57\u4F53",color:"\u5B57\u8272",backgroundColor:"\u80CC\u666F",borderRadius:"\u5706\u89D2",border:"\u63CF\u8FB9"},v=i[t];switch(t){case"fontFamily":break;case"color":case"backgroundColor":e=ge("".concat(e));break;case"fontSize":case"borderRadius":e="".concat(e).split(" ").map(function(s){return a(s)}).join(" ");break;case"border":if(c){var f=c.borderWidth,b=c.borderStyle,l=c.borderColor;e="".concat(a(f)," ").concat(b," ").concat(ge(l))}break}return{label:v,value:e}}function di(t){return t.toString(16)}function ge(t){t=t.replace(/[()\srgba]/g,"");var e=t.split(",").map(function(n){return+n});e.length===3&&e.push(0);var r="#".concat(e.slice(0,3).map(function(n){var o=di(n);return o.length===1?"0".concat(o):o}).join("")," ").concat(e[3]*100,"%");return r}function x(t,e){var r=p("style");r.textContent=e,t.append(r)}function j(t){document.documentElement.append(t)}function fi(t,e){var r;if(e=[e].flat(),t instanceof Array){t.forEach(function(n){var o;(o=n.classList).add.apply(o,ye([],R(e),!1))});return}(r=t.classList).add.apply(r,ye([],R(e),!1))}function A(t,e,r){e===void 0&&(e="px"),r===void 0&&(r=X());var n=X();typeof t=="string"&&(t=+t.replace("px",""));var o=(t/(n/r)).toFixed(1);return"".concat(o.replace(".0","")).concat(e)}function L(t){return t.getClientRects()[0]}function pi(t){var e=getComputedStyle(document.documentElement);return e.getPropertyValue(t)}function k(t,e){document.documentElement.style.setProperty(t,e,"important")}function u(t,e){return e===void 0&&(e="px"),"".concat(t).concat(e)}var hi=`@charset "UTF-8"; .ewuit-ui-tool-panel { position: fixed; right: 30px; bottom: 60px; width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, 0.2); text-align: center; line-height: 40px; z-index: 9999; cursor: pointer; transition: all 0.2s ease-out; } .ewuit-ui-tool-panel::before { content: "\u{1F680}"; } .ewuit-ui-tool-panel.active { background: rgba(251, 243, 25, 0.2); } .ewuit-ui-tool-panel.active::before { content: "\u{1F389}"; } .ewuit-ui-tool-panel div { transition: all 0.2s ease-out; } .ewuit-ui-tool-panel.active .attr-btn, .ewuit-ui-tool-panel.active .distance-btn { cursor: pointer; width: 40px; height: 40px; border-radius: 50%; background: rgba(158, 158, 158, 0.3); position: absolute; bottom: 0px; } .ewuit-ui-tool-panel.active .attr-btn.active, .ewuit-ui-tool-panel.active .distance-btn.active { background-color: #1a161a; } .ewuit-ui-tool-panel.active .attr-btn.active::before, .ewuit-ui-tool-panel.active .distance-btn.active::before { color: #fff; } .ewuit-ui-tool-panel.active .attr-btn { transform: translate(-40px, -30px); } .ewuit-ui-tool-panel.active .attr-btn::before { content: "\u5C5E\u6027"; font-size: 12px; color: #000; } .ewuit-ui-tool-panel.active .distance-btn { transform: translate(-40px, 30px); } .ewuit-ui-tool-panel.active .distance-btn::before { content: "\u95F4\u8DDD"; font-size: 12px; color: #000; }`,Et="ewuit-ui-tool-panel",me=function(){function t(){}return t.bindTogglePanel=function(e){var r=this,n=this.unIndependenceButtonList.reduce(function(i,v){return i[r.btnTypeMap.get(v)]=v.classList.contains("active"),i},{}),o=e.target;o.classList.toggle("active"),this.btnTypeMap.has(o)&&this.unIndependenceButtonList.forEach(function(i){i!==o&&i.classList.remove("active")});var a=this.unIndependenceButtonList.reduce(function(i,v){return i[r.btnTypeMap.get(v)]=v.classList.contains("active"),i},{}),c=Object.keys(n).reduce(function(i,v){return a[v]!==n[v]&&(i[v]=a[v]),i},{});Object.keys(c).sort(function(i,v){return c[i]-c[v]}).forEach(function(i){var v;typeof((v=r==null?void 0:r.callbackList)===null||v===void 0?void 0:v[i])=="function"&&r.callbackList[i](c[i])})},t.init=function(e){if(e===void 0&&(e={}),this.callbackList=e,!this.isExist()){this.independenceButtonList=[],this.unIndependenceButtonList=[];var r=p("div");r.classList.add(Et),x(r,hi);var n=p("div","attr-btn");this.btnTypeMap.set(n,$.ATTRIBUTE);var o=p("div","distance-btn");this.btnTypeMap.set(o,$.DISTANCE),this.unIndependenceButtonList.push(n,o),r.appendChild(n),r.appendChild(o),j(r),this.ui=r,q(r,"touchmove"),this.ui.addEventListener("click",this.bindTogglePanel.bind(this))}},t.destroy=function(){this.ui&&(this.ui.removeEventListener("click",this.bindTogglePanel.bind(this)),this.ui.remove())},t.isExist=function(){return!!document.querySelector(Et)},t.btnTypeMap=new WeakMap,t.independenceButtonList=[],t.unIndependenceButtonList=[],t}(),bi=`.ewuit-toast-wrapper { text-align: center; position: fixed; z-index: 10000; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; } .ewuit-toast-wrapper p { display: block; padding: 20px 12px; max-width: 252px; background-color: #1a161a; border-radius: 10px; color: #ffffff; margin: 0 auto; margin-top: 46vh; font-weight: 400; font-family: var(--ewuit-font-family); font-size: var(--toast-font-size); text-align: center; transform: scale(var(--toast-scale)); } `;function yi(t,e){t===void 0&&(t=""),e===void 0&&(e=500);var r=p("div","ewuit-toast-wrapper");x(r,bi);var n=p("p");n.textContent=t,r.append(n),j(r),setTimeout(function(){r.remove()},e)}var Bt=ii(yi,500);function or(t,e,r){typeof r!="function"&&(r=function(b){return"".concat(b)});var n=L(t),o=n.top,a=n.left,c=n.width,i=n.height;y(e,{width:u(c),height:u(i),left:u(a),top:u(o)}),e.setAttribute("data-w",r(c)),e.setAttribute("data-h",r(i));var v=X()-50>c+a;e.style.setProperty("--ewuit-comp-cover-left",v?"auto":"-46px"),e.style.setProperty("--ewuit-comp-cover-right",v?"0":"auto");var f=o>20;e.style.setProperty("--ewuit-comp-cover-bottom",f?"auto":"20px"),e.style.setProperty("--ewuit-comp-cover-top",f?"-20px":"auto")}var gi=function(){function t(){this.clickStack=[]}return t.prototype.handle=function(e,r){var n=e.target;return this.frequentClickRemove(n,r)},t.prototype.frequentClickRemove=function(e,r){r===void 0&&(r=3),this.clickStack.push(e),this.clickStack.length===r+1&&this.clickStack.shift();var n=this.clickStack.reduce(function(o,a,c){return a===e?o+1:c!==0?o-1:o},0);return n===r-1&&Bt("\u518D\u70B9\u51FB\u4E00\u6B21\u5373\u53EF\u79FB\u9664\u6B64\u8282\u70B9",1200),n===r?(e.style.visibility="hidden",this.clear(),!1):!0},t.prototype.clear=function(){this.clickStack=[]},t}(),ar=new gi,we=`.ewuit-comp-cover { background-color: rgba( 196, 64, 255, 0.1 ); border: var(--cover-border-width) solid var(--cover-first-color); border-radius: var( --cover-attribute-border-radius ); /* \u90E8\u5206\u7B2C\u4E09\u65B9\u9875\u9762\u90E8\u5206\u5143\u7D20\u5C42\u7EA7\u975E\u5E38\u9AD8 */ position: fixed; z-index: 9999; /* \u5141\u8BB8\u4E8B\u4EF6\u7A7F\u900F\uFF0C\u8FD9\u6837\u53EF\u4EE5\u9009\u53D6\u5B50\u5143\u7D20 */ pointer-events: none; /* \u9ED8\u8BA4\u4E0D\u5C55\u793A */ display: none; box-sizing: border-box; } .ewuit-comp-cover::after, .ewuit-comp-cover::before { position: absolute; display: block; font-weight: 400; font-family: var(--ewuit-font-family); font-size: var(--cover-font-size); color: var(--cover-first-color); line-height: var(--cover-font-size); border-radius: 2px; z-index: 1; padding: 0 4px; background-color: rgba( 255, 255, 255, 0.7 ); padding: 5px; box-sizing: border-box; word-break: keep-all; pointer-events: none; } .ewuit-comp-cover::before { left: 50%; top: var(--ewuit-comp-cover-top); bottom: var( --ewuit-comp-cover-bottom ); -webkit-transform: translateX(-50%); transform: translateX(-50%); content: attr(data-w); box-sizing: border-box; } .ewuit-comp-cover::after { left: var(--ewuit-comp-cover-left); right: var(--ewuit-comp-cover-right); top: 50%; transform: translateX( calc(100% + 3px) ) translateY(-50%); content: attr(data-h); } .ewuit-comp-modal { min-width: var(--modal-max-width); max-width: var(--modal-min-width); position: fixed; /* \u6BD4\u81EA\u5DF1\u7684cover \u4F4E\u4E00\u5C42 */ z-index: 9998; left: 100px; pointer-events: none; } .ewuit-comp-wrapper { opacity: 0.95; background: #1a161a; border-radius: var( --modal-border-radius ); padding-left: var( --modal-padding-left ); padding-right: var( --modal-padding-left ); padding-top: var(--modal-padding-top); padding-bottom: var( --modal-padding-top ); float: left; } .ewuit-comp-modal p { font-weight: 400; font-family: var(--ewuit-font-family); font-size: var(--modal-font-size); color: #ffffff; padding-bottom: var( --modal-padding-top ); margin: 0; } .ewuit-comp-modal p:last-child { padding-bottom: 0; } .ewuit-comp-modal p span { margin-right: 15px; } `,mi=function(){function t(){this.initCover(),this.initAttrModal(),this.cfg={pixelConversion:A}}return t.prototype.config=function(e){return e&&Object.assign(this.cfg,e),this.cfg},t.prototype.handle=function(e){if(!ar.handle(e)){this.clear();return}this.clickDom=e.target,this.refreshCover(),this.refreshModal()},t.prototype.initCover=function(){var e=p("div","ewuit-comp-cover");x(e,we),j(e),this.coverDom=e},t.prototype.initAttrModal=function(){var e=this,r=p("div","ewuit-comp-modal");d(r,"none"),x(r,we),r.addEventListener("click",function(){e.clear()}),j(r),this.modalDom=r},t.prototype.refreshModal=function(){var e=this,r=this.clickDom,n=getComputedStyle(r),o=L(r),a=this.cfg.pixelConversion||A,c=[],i=[];vi(r)&&(i=["fontFamily","fontSize","color"]),si(r)&&(i=["borderRadius","border","backgroundColor"]),i.length===0&&(i=["borderRadius","border","backgroundColor"]),c=i.map(function(v){return ui(v,n[v],{pixelConversion:a,styles:n})}),c.unshift({label:"\u5BBD\u9AD8",value:"".concat(a(o.width),"/").concat(a(o.height))}),this.modalDom.innerHTML=`<div class="ewuit-comp-wrapper"> `.concat(c.map(function(v){return"<p><span>".concat(v.label,":</span> ").concat(v.value,"</p>")}).join(""),` </div>`),d(this.modalDom),setTimeout(function(){var v=0,f=0,b=+pi("--modal-scale")||1,l=nr(),s=X(),ir=200*b,Ft=10,Mt=o.left<s/2?u(o.left+v):"auto",zt=o.bottom+ir<l?u(o.bottom+Ft+f):"auto",cr=Mt==="auto"?u(s-o.left-o.width+v):"auto",lr=zt==="auto"?u(l-o.top+Ft+f):"auto";y(e.modalDom,{left:Mt,top:zt,right:cr,bottom:lr})})},t.prototype.refreshCover=function(){k("--cover-attribute-border-radius",getComputedStyle(this.clickDom).borderRadius),or(this.clickDom,this.coverDom,this.cfg.pixelConversion),d(this.coverDom)},t.prototype.clear=function(){d(this.coverDom,"none"),d(this.modalDom,"none")},t}(),U=new mi,wi=`div[class^='ewuit-comp-cover-'] { position: fixed; z-index: 9999; pointer-events: none; display: none; box-sizing: border-box; } div.ewuit-comp-cover-first { background-color: rgba( 196, 64, 255, 0.1 ); border: var(--cover-border-width) solid var(--cover-first-color); border-radius: var( --cover-distance-first-border-radius ); pointer-events: none; } .ewuit-comp-cover-first::after, .ewuit-comp-cover-first::before { pointer-events: none; position: absolute; display: var(--cover-size-display); font-weight: 400; font-family: var(--ewuit-font-family); font-size: var(--cover-font-size); color: var(--cover-first-color); line-height: var(--cover-font-size); border-radius: 2px; z-index: 1; padding: 0 4px; background-color: rgba( 255, 255, 255, 0.7 ); padding: 5px; box-sizing: border-box; word-break: keep-all; } .ewuit-comp-cover-first::before { left: 50%; top: var(--ewuit-comp-cover-top); bottom: var( --ewuit-comp-cover-bottom ); transform: translateX(-50%); content: attr(data-w); box-sizing: border-box; } .ewuit-comp-cover-first::after { left: var(--ewuit-comp-cover-left); right: var(--ewuit-comp-cover-right); top: 50%; transform: translateX( calc(100% + 3px) ) translateY(-50%); content: attr(data-h); } div.ewuit-comp-cover-second { background-color: rgba( 37, 144, 255, 0.1 ); border: var(--cover-border-width) solid var(--cover-second-color); border-radius: var( --cover-distance-second-border-radius ); pointer-events: none; } div.ewuit-comp-rulers { display: none; } div.ruler { position: fixed; width: 100%; height: 100%; border: var(--cover-border-width) dashed var(--cover-second-color); z-index: 9998; pointer-events: none; box-sizing: border-box; word-break: keep-all; pointer-events: none; } /* \u6C34\u5E73 */ div.ruler.h { border-left: 0; border-right: 0; left: 0; } /* \u5782\u76F4 */ div.ruler.v { border-top: 0; border-bottom: 0; top: 0; } div.distance { position: fixed; background: var(--cover-first-color); z-index: 9998; } div.distance.v { width: var(--cover-border-width); } div.distance.h { height: var(--cover-border-width); } div.distance.h::after, div.distance.v::before { pointer-events: none; word-break: keep-all; content: attr(data-v); position: absolute; font-weight: 400; font-family: var(--ewuit-font-family); font-size: var(--distance-font-size); line-height: var( --distance-font-size ); color: var(--cover-first-color); background-color: rgba( 255, 255, 255, 0.7 ); padding: 5px; display: var( --cover-distance-display ); } div.distance.h::after { left: 50%; transform: translateX(-50%); top: 4px; } div.distance.v::before { top: 50%; left: 4px; transform: translateY(-50%); } `,$i=function(){function t(){this.domStack=[],this.compDom=p("div","ewuit-comp-distance-wrapper"),j(this.compDom),x(this.compDom,wi),this.initCover(),this.initRulers(),this.initDistanceLine(),this.cfg={pixelConversion:A}}return t.prototype.config=function(e){return e&&Object.assign(this.cfg,e),this.cfg},t.prototype.initCover=function(){this.firstCover=p("div","ewuit-comp-cover-first"),this.secondCover=p("div","ewuit-comp-cover-second"),this.compDom.append(this.firstCover),this.compDom.append(this.secondCover)},t.prototype.initRulers=function(){var e=p("div","ewuit-comp-rulers"),r=p("div",["ruler","v"]),n=p("div",["ruler","h"]);this.compDom.append(e),e.append(r),e.append(n),this.rulers=e,this.vRuler=r,this.hRuler=n},t.prototype.initDistanceLine=function(){var e=p("div","ewuit-distanceWrapper"),r=p("div",["distance","v"]),n=p("div",["distance","v"]),o=p("div",["distance","h"]),a=p("div",["distance","h"]);e.append(r,n,o,a),this.compDom.append(e),this.distanceList=[r,n,o,a],this.distanceWrapper=e},t.prototype.handle=function(e){if(!ar.handle(e,4)){this.clear();return}var r=e.target,n=this.domStack,o=n.at(-1)===r;o||n.push(r),o&&n.length===2&&n.shift(),n.length===3&&n.shift(),k("--cover-size-display",n.length===1?"block":"none"),k("--cover-distance-display",n.length===1?"none":"block"),this.refreshCover(),this.refreshRulers(),this.refreshDistance()},t.prototype.refreshRulers=function(){var e=this.domStack[1];if(!e){d(this.rulers,"none");return}var r=L(e),n=r.left,o=r.width,a=r.height,c=r.top;y(this.vRuler,{left:u(n),width:u(o)}),y(this.hRuler,{top:u(c),height:u(a)}),d(this.rulers)},t.prototype.refreshCover=function(){var e=R(this.domStack,2),r=e[0],n=e[1];k("--cover-distance-first-border-radius",getComputedStyle(r).borderRadius),this.updateCover(r,this.firstCover),k("--cover-distance-second-border-radius",getComputedStyle(r).borderRadius),this.updateCover(n,this.secondCover)},t.prototype.refreshDistance=function(){var e=this.cfg.pixelConversion,r=e===void 0?A:e;d(this.distanceList,"none");var n=R(this.domStack,2),o=n[0],a=n[1],c=R(this.distanceList,4),i=c[0],v=c[1],f=c[2],b=c[3];if(!!a){var l=L(o),s=L(a);l.top>s.bottom&&(i.setAttribute("data-v",r(l.top-s.bottom)),y(i,{height:u(l.top-s.bottom),left:u(l.left+l.width/2),top:u(s.bottom)}),d(i)),l.top<s.bottom&&l.top>s.top&&l.bottom<s.bottom&&(i.setAttribute("data-v",r(l.top-s.top)),y(i,{height:u(l.top-s.top),left:u(l.left+l.width/2),top:u(s.top)}),d(i)),l.left>s.right&&(f.setAttribute("data-v",r(l.left-s.right)),y(f,{width:u(l.left-s.right),left:u(s.right),top:u(l.top+l.height/2)}),d(f)),l.left<s.right&&l.left>s.left&&l.right<=s.right&&(f.setAttribute("data-v",r(l.left-s.left)),y(f,{width:u(l.left-s.left),left:u(s.left),top:u(l.top+l.height/2)}),d(f)),l.right<s.left&&(b.setAttribute("data-v",r(s.left-l.right)),y(b,{width:u(s.left-l.right),left:u(l.right),top:u(l.top+l.height/2)}),d(b)),l.right>s.left&&l.right<s.right&&l.left>=s.left&&(b.setAttribute("data-v",r(s.right-l.right)),y(b,{width:u(s.right-l.right),left:u(l.right),top:u(l.top+l.height/2)}),d(b)),l.bottom<s.top&&(v.setAttribute("data-v",r(s.top-l.bottom)),y(v,{height:u(s.top-l.bottom),left:u(l.left+l.width/2),top:u(l.bottom)}),d(v)),l.bottom>s.top&&l.bottom<s.bottom&&l.top>=s.top&&(v.setAttribute("data-v",r(s.bottom-l.bottom)),y(v,{height:u(s.bottom-l.bottom),left:u(l.left+l.width/2),top:u(l.bottom)}),d(v)),d(this.distanceWrapper)}},t.prototype.updateCover=function(e,r){if(!e){d(r,"none");return}or(e,r,this.cfg.pixelConversion),d(r)},t.prototype.clear=function(){this.domStack=[],d(this.firstCover,"none"),d(this.secondCover,"none"),d(this.rulers,"none"),d(this.distanceWrapper,"none")},t}(),W=new $i,Si=`:root { /* Font */ --ewuit-font-family: PingFangSC-Regular; /* Toast */ --toast-font-size: 14px; --toast-scale: 1; /* Cover */ --cover-font-size: 8px; --cover-border-width: 0.75px; --cover-first-color: #b000ff; --cover-second-color: #2590ff; --cover-size-display: none; --cover-distance-display: none; --cover-attribute-border-radius: 0; --cover-distance-first-border-radius: 0; --cover-distance-second-border-radius: 0; /* Distance Tool */ --distance-font-size: 8px; /* Attribute Tool */ --modal-font-size: 12px; --modal-min-width: 180px; --modal-max-width: 220px; --modal-border-radius: 10px; --modal-padding-left: 15px; --modal-padding-top: 12px; --modal-scale: 1; /* JS */ --ewuit-comp-cover-top: 0; --ewuit-comp-cover-bottom: 0; --ewuit-comp-cover-left: 0; --ewuit-comp-cover-right: 0; } `,Oi=function(){function t(e){var r,n;this.shadowPage=null,this.options=e,x(document.documentElement,Si),U.config((r=e==null?void 0:e.toolConfig)===null||r===void 0?void 0:r.attribute),W.config((n=e==null?void 0:e.toolConfig)===null||n===void 0?void 0:n.distance)}return t.prototype.openUI=function(){var e=this;me.init({distance:function(r){e.call($.DISTANCE,r)},attribute:function(r){e.call($.ATTRIBUTE,r)}})},t.prototype.closeUI=function(){me.destroy()},t.prototype.call=function(e,r){var n,o,a;if(r===void 0&&(r=!0),r){if(this.shadowPage)return;if(this.shadowPage=ci((n=this===null||this===void 0?void 0:this.options)===null||n===void 0?void 0:n.scroll),document.body.setAttribute("hidden","true"),document.body.scrollHeight>=nr()){var c=document.body;c.setAttribute("data-overflow",c.style.overflow),c.style.overflow="hidden"}}else if(this.shadowPage){this.shadowPage.remove(),document.body.removeAttribute("hidden"),document.body.style.overflow=document.body.getAttribute("data-overflow")||"visible",this.shadowPage=null,U.clear(),W.clear();return}var i=(a=(o=this.shadowPage)===null||o===void 0?void 0:o.shadowRoot)===null||a===void 0?void 0:a.querySelector("body");switch(e){case $.ATTRIBUTE:i==null||i.addEventListener("click",U.handle.bind(U));break;case $.DISTANCE:i==null||i.addEventListener("click",W.handle.bind(W));break}},t}();module.exports=Oi; //# sourceMappingURL=index.cjs.js.map