inline-style-editor 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* Copyright 2017-2024 Andreas Borgen (https://github.com/Sphinxxxx), Adam Brooks (https://github.com/dissimulate)
|
|
7
7
|
* Released under the ISC license.
|
|
8
8
|
*/
|
|
9
|
-
var bn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},wn=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),_n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(t){return 0===this.indexOf(t)},String.prototype.padStart=String.prototype.padStart||function(t,e){for(var n=this;n.length<t;)n=e+n;return n};var kn={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function xn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e>0?t.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):t.toString())||"0"}var Sn=function(){function t(e,n,r,o){bn(this,t);var i=this;if(void 0===e);else if(Array.isArray(e))this.rgba=e;else if(void 0===r){var l=e&&""+e;l&&function(e){if(e.startsWith("hsl")){var n=e.match(/([\-\d\.e]+)/g).map(Number),r=_n(n,4),o=r[0],l=r[1],a=r[2],s=r[3];void 0===s&&(s=1),o/=360,l/=100,a/=100,i.hsla=[o,l,a,s]}else if(e.startsWith("rgb")){var u=e.match(/([\-\d\.e]+)/g).map(Number),c=_n(u,4),f=c[0],d=c[1],h=c[2],v=c[3];void 0===v&&(v=1),i.rgba=[f,d,h,v]}else e.startsWith("#")?i.rgba=t.hexToRgb(e):i.rgba=t.nameToRgb(e)||t.hexToRgb(e)}(l.toLowerCase())}else this.rgba=[e,n,r,void 0===o?1:o]}return wn(t,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map((function(t,e){return xn(t,3===e?3:0)}));return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],n=["","%","%",""],r=(t?this.hsla:this.hsla.slice(0,3)).map((function(t,r){return xn(t*e[r],3===r?3:1)+n[r]}));return t?"hsla("+r+")":"hsl("+r+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=t.hslToRgb(this._hsla)},set:function(t){3===t.length&&(t[3]=1),this._rgba=t,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=t.rgbToHsl(this._rgba)},set:function(t){3===t.length&&(t[3]=1),this._hsla=t,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){return"#"+this.rgba.map((function(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)})).map((function(t){return t.padStart(2,"0")})).join("")},set:function(e){this.rgba=t.hexToRgb(e)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var n=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(t){return parseInt(t,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(e){var n=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),r=kn[n];return void 0===r?r:t.hexToRgb(r.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=_n(t,4),n=e[0],r=e[1],o=e[2],i=e[3];n/=255,r/=255,o/=255;var l=Math.max(n,r,o),a=Math.min(n,r,o),s=void 0,u=void 0,c=(l+a)/2;if(l===a)s=u=0;else{var f=l-a;switch(u=c>.5?f/(2-l-a):f/(l+a),l){case n:s=(r-o)/f+(r<o?6:0);break;case r:s=(o-n)/f+2;break;case o:s=(n-r)/f+4}s/=6}return[s,u,c,i]}},{key:"hslToRgb",value:function(t){var e=_n(t,4),n=e[0],r=e[1],o=e[2],i=e[3],l=void 0,a=void 0,s=void 0;if(0===r)l=a=s=o;else{var u=function(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t},c=o<.5?o*(1+r):o+r-o*r,f=2*o-c;l=u(f,c,n+1/3),a=u(f,c,n),s=u(f,c,n-1/3)}var d=[255*l,255*a,255*s].map(Math.round);return d[3]=i,d}}]),t}(),Cn=function(){function t(){bn(this,t),this._events=[]}return wn(t,[{key:"add",value:function(t,e,n){t.addEventListener(e,n,!1),this._events.push({target:t,type:e,handler:n})}},{key:"remove",value:function(e,n,r){this._events=this._events.filter((function(o){var i=!0;return e&&e!==o.target&&(i=!1),n&&n!==o.type&&(i=!1),r&&r!==o.handler&&(i=!1),i&&t._doRemove(o.target,o.type,o.handler),!i}))}},{key:"destroy",value:function(){this._events.forEach((function(e){return t._doRemove(e.target,e.type,e.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(t,e,n){t.removeEventListener(e,n,!1)}}]),t}();function Mn(t,e,n){var r=!1;function o(t,e,n){return Math.max(e,Math.min(t,n))}function i(t,i,l){if(l&&(r=!0),r){t.preventDefault();var a=e.getBoundingClientRect(),s=a.width,u=a.height,c=i.clientX,f=i.clientY,d=o(c-a.left,0,s),h=o(f-a.top,0,u);n(d/s,h/u)}}function l(t,e){1===(void 0===t.buttons?t.which:t.buttons)?i(t,t,e):r=!1}function a(t,e){1===t.touches.length?i(t,t.touches[0],e):r=!1}t.add(e,"mousedown",(function(t){l(t,!0)})),t.add(e,"touchstart",(function(t){a(t,!0)})),t.add(window,"mousemove",l),t.add(e,"touchmove",a),t.add(window,"mouseup",(function(t){r=!1})),t.add(e,"touchend",(function(t){r=!1})),t.add(e,"touchcancel",(function(t){r=!1}))}var En="keydown",Ln="mousedown",Tn="focusin";function An(t,e){return(e||document).querySelector(t)}function Nn(t,e,n,r,o){t.add(e,En,(function(t){n.indexOf(t.key)>=0&&r(t)}))}var On=function(){function t(e){bn(this,t),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Cn,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return wn(t,[{key:"setOptions",value:function(t){var e=this;if(t){var n=this.settings;if(t instanceof HTMLElement)n.parent=t;else{n.parent&&t.parent&&n.parent!==t.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(t,e){for(var n in t)e[n]=t[n]}(t,n),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var r=t.color||t.colour;r&&this._setColor(r)}var o=n.parent;if(o&&n.popup&&!this._popupInited){var i=function(t){return e.openHandler(t)};this._events.add(o,"click",i),Nn(this._events,o,[" ","Spacebar","Enter"],i),this._popupInited=!0}else t.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===En?this._domEdit:this.domElement;setTimeout((function(){return e.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,n=!1;if(t)if(e===Ln||e===Tn){var r=(this.__containedEvent||0)+100;t.timeStamp>r&&(n=!0)}else!function(t){t.preventDefault(),t.stopPropagation()}(t),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==Ln&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if("string"==typeof t&&(t=t.trim()),t){e=e||{};var n=void 0;try{n=new Sn(t)}catch(t){if(e.failSilently)return;throw t}if(!this.settings.alpha){var r=n.hsla;r[3]=1,n.hsla=r}this.colour=this.color=n,this._setHSLA(null,null,null,null,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e,n,r=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',o=(e=r,(n=document.createElement("div")).innerHTML=e,n.firstElementChild);return this.domElement=o,this._domH=An(".picker_hue",o),this._domSL=An(".picker_sl",o),this._domA=An(".picker_alpha",o),this._domEdit=An(".picker_editor input",o),this._domSample=An(".picker_sample",o),this._domOkay=An(".picker_done button",o),this._domCancel=An(".picker_cancel button",o),o.classList.add("layout_"+this.settings.layout),this.settings.alpha||o.classList.add("no_alpha"),this.settings.editor||o.classList.add("no_editor"),this.settings.cancelButton||o.classList.add("no_cancel"),this._ifPopup((function(){return o.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var t=this,e=this,n=this.domElement,r=this._events;function o(t,e,n){r.add(t,e,n)}o(n,"click",(function(t){return t.preventDefault()})),Mn(r,this._domH,(function(t,n){return e._setHSLA(t)})),Mn(r,this._domSL,(function(t,n){return e._setHSLA(null,t,1-n)})),this.settings.alpha&&Mn(r,this._domA,(function(t,n){return e._setHSLA(null,null,null,1-n)}));var i=this._domEdit;o(i,"input",(function(t){e._setColor(this.value,{fromEditor:!0,failSilently:!0})})),o(i,"focus",(function(t){var e=this;e.selectionStart===e.selectionEnd&&e.select()})),this._ifPopup((function(){var e=function(e){return t.closeHandler(e)};o(window,Ln,e),o(window,Tn,e),Nn(r,n,["Esc","Escape"],e);var i=function(e){t.__containedEvent=e.timeStamp};o(n,Ln,i),o(n,Tn,i),o(t._domCancel,"click",e)}));var l=function(e){t._ifPopup((function(){return t.closeHandler(e)})),t.onDone&&t.onDone(t.colour)};o(this._domOkay,"click",l),Nn(r,n,["Enter"],l)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup((function(n){"static"===getComputedStyle(t).position&&(t.style.position="relative");var r=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(t){t===r?e.classList.add(t):e.classList.remove(t)})),e.classList.add(r)}))}},{key:"_setHSLA",value:function(t,e,n,r,o){o=o||{};var i=this.colour,l=i.hsla;[t,e,n,r].forEach((function(t,e){(t||0===t)&&(l[e]=t)})),i.hsla=l,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(i)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,n=e.hsla,r="hsl("+360*n[0]+", 100%, 50%)",o=e.hslString,i=e.hslaString,l=this._domH,a=this._domSL,s=this._domA,u=An(".picker_selector",l),c=An(".picker_selector",a),f=An(".picker_selector",s);y(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=r,y(0,c,n[1]),b(0,c,1-n[2]),a.style.color=o,b(0,f,1-n[3]);var d=o,h=d.replace("hsl","hsla").replace(")",", 0)"),v="linear-gradient("+[d,h]+")";if(this._domA.style.background=v+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!t.fromEditor){var p=this.settings.editorFormat,g=this.settings.alpha,m=void 0;switch(p){case"rgb":m=e.printRGB(g);break;case"hsl":m=e.printHSL(g);break;default:m=e.printHex(g)}this._domEdit.value=m}this._domSample.style.color=i}function y(t,e,n){e.style.left=100*n+"%"}function b(t,e,n){e.style.top=100*n+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var n=t?"":"none",r=e.style.display!==n;return r&&(e.style.display=n),r}}]),t}(),$n=ye('<div class="picker"></div>');function Dn(t,e){D(e,!0);let n=We(e,"value",15,"#AAAAAAFF"),r=We(e,"options",19,(()=>({}))),o=We(e,"onChange",3,(()=>{})),i=W(void 0),l=W(void 0);function a(t){var e;(e=t.hex)!==n()&&(o()(e,n()),n(e))}st((()=>{se(l)&&se(l).setColor(n())})),ze((()=>{!function(t){if(!se(i))return;se(l)&&se(l).destroy();t.onChange=a,Y(l,new On({parent:se(i),color:n(),popup:!1,...t}),!0),se(l).show(),se(l).openHandler()}(r())})),Ye((()=>{se(l)?.destroy()}));var s=$n();return je(s,(t=>Y(i,t)),(()=>se(i))),_e(t,s),H({setColor:function(t){se(l).setColor(t)}})}const Hn=function(){const t=new Set(["Arial","Arial Black","Bahnschrift","Calibri","Cambria","Cambria Math","Candara","Comic Sans MS","Consolas","Constantia","Corbel","Courier New","Ebrima","Franklin Gothic Medium","Gabriola","Gadugi","Georgia","HoloLens MDL2 Assets","Impact","Ink Free","Javanese Text","Leelawadee UI","Lucida Console","Lucida Sans Unicode","Malgun Gothic","Marlett","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Sans Serif","Microsoft Tai Le","Microsoft YaHei","Microsoft Yi Baiti","MingLiU-ExtB","Mongolian Baiti","MS Gothic","MV Boli","Myanmar Text","Nirmala UI","Palatino Linotype","Segoe MDL2 Assets","Segoe Print","Segoe Script","Segoe UI","Segoe UI Historic","Segoe UI Emoji","Segoe UI Symbol","SimSun","Sitka","Sylfaen","Symbol","Tahoma","Times New Roman","Trebuchet MS","Verdana","Webdings","Wingdings","Yu Gothic","American Typewriter","Andale Mono","Arial","Arial Black","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Avenir","Avenir Next","Avenir Next Condensed","Baskerville","Big Caslon","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bradley Hand","Brush Script MT","Chalkboard","Chalkboard SE","Chalkduster","Charter","Cochin","Comic Sans MS","Copperplate","Courier","Courier New","Didot","DIN Alternate","DIN Condensed","Futura","Geneva","Georgia","Gill Sans","Helvetica","Helvetica Neue","Herculanum","Hoefler Text","Impact","Lucida Grande","Luminari","Marker Felt","Menlo","Microsoft Sans Serif","Monaco","Noteworthy","Optima","Palatino","Papyrus","Phosphate","Rockwell","Savoye LET","SignPainter","Skia","Snell Roundhand","Tahoma","Times","Times New Roman","Trattatello","Trebuchet MS","Verdana","Zapfino","Comic Sans MS","Comic Sans","Apple Chancery","Bradley Hand","Brush Script MT","Brush Script Std","Snell Roundhand","URW Chancery L"].sort()),e={},n={},r=["monospace","sans-serif","serif","cursive"],o=document.getElementsByTagName("body")[0],i=document.createElement("span");i.style.fontSize="72px",i.innerHTML="mmmmmmmmmmlli",r.forEach((t=>{i.style.fontFamily=t,o.appendChild(i),e[t]=i.offsetWidth,n[t]=i.offsetHeight,o.removeChild(i)}));const l=[],a=t=>{let l=!1;for(const a of r){i.style.fontFamily=t+","+a,o.appendChild(i);const r=i.offsetWidth!=e[a]||i.offsetHeight!=n[a];o.removeChild(i),l=l||r}return l};for(const e of t.values())a(e)&&l.push(e);return l.sort()}();function Pn(){let{fonts:t}=document;const e=t.entries();let n=[],r=!1;for(;!r;){const t=e.next();if(t.done)r=t.done;else{const e=t.value;let r;r=e.length?e[0].family:e.family,n.push(r)}}return[...new Set(n)]}function Rn(t,e,n,r,o,i){se(e)[se(n)]=!1,se(r).parentNode.appendChild(se(r)),o(se(r),se(i),"bringtofront",null)}function Bn(t,e,n){se(e).remove(),n()}var In=ye("<span> </span>"),qn=ye('<div class="select-tab"><b>Element</b> <!></div>'),Fn=(t,e)=>e(t.target.value),jn=ye("<option> </option>"),Gn=ye("<select></select>"),Un=ye("<span> </span>"),Wn=ye("<span> </span>"),zn=async(t,e)=>{se(e).selected=t.target.value,await ae()},Yn=ye("<option><!></option>"),Vn=ye("<select></select>"),Xn=ye("<span> </span>"),Jn=(t,e,n)=>e(se(n)),Kn=(t,e,n,r)=>e(se(n),t.target.value,se(r)[se(n)].suffix,t.target),Zn=ye('<input type="range"/> <span class="current-value"> </span>',1),Qn=(t,e,n)=>e(se(n),t.target.value),tr=ye('<option selected="true">---</option>'),er=ye("<option> </option>"),nr=ye("<select><!><!></select>"),rr=ye('<div><div class="prop-name"><!> <span class="delete">✕</span></div> <!></div>'),or=ye("<div>Bring to front</div>"),ir=ye('<div class="btn delete-elem">Delete element</div>'),lr=ye('<div class="editor"><!> <!> <!></div>'),ar=ye('<div style="position: absolute;"></div> <svg class="ise-helper-wrapper" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="overlay-clip" clip-rule="evenodd"><path></path></clipPath><rect y="0" x="0" height="100%" width="100%" class="overlay-over"></rect></svg> <div class="ise"><div class="close-button">x</div> <!> <div class="select-tab"><b>Applied to:</b> <!></div> <div class="select-tab"><b>Property type:</b> <!></div> <!></div>',1);function sr(t,e){D(e,!0);const n=["altGlyph","circle","ellipse","line","path","polygon","polyline","rect","text","textPath","tref","tspan"],r={"border-radius":{type:"slider",min:0,max:30,suffix:"px"},"border-width":{type:"slider",min:0,max:30,suffix:"px"},"border-style":{type:"select",choices:()=>["none","dotted","dashed","solid","double","groove","ridge","inset","outset"]},"border-color":{type:"color"},"font-family":{type:"select",choices:function(){return[...Pn(),...Hn]}},"font-size":{type:"slider",min:0,max:40,suffix:"px"},"font-weight":{type:"slider",min:0,max:800},color:{type:"color"},"stroke-width":{type:"slider",min:0,max:20,step:.5,suffix:"px"},stroke:{type:"color"},"stroke-linejoin":{type:"select",choices:()=>["bevel","miter","round"]},fill:{type:"color"},"stroke-dasharray":{type:"slider",min:0,max:30,suffix:"px"},"background-color":{type:"color"}},o=e.getElems??null,i=e.listenOnClick??!1,l=e.onStyleChanged??(()=>{}),a=e.customProps??{},s=e.inlineDeletable??(()=>!0),u=e.cssRuleFilter??null,c=e.getCssRuleName??((t,e)=>"inline"===t?"Selected element":t),f="text",d="border",h="stroke",v="background",p="custom",g={[f]:["font-family","font-size","font-weight","color"],[d]:["border-radius","border-width","border-color","border-style"],[h]:["stroke-width","stroke","stroke-dasharray","stroke-linejoin","fill"],[v]:["background-color"],[p]:Object.keys(a)},m={slider:0,select:1,color:2};let y=W(null),b=W(null),w=W(void 0),_=W(void 0),k=W(void 0),x=W(""),S=W(P({width:0,height:0})),C=W(P([[]])),M=W(P([])),E=W(P([])),L=W(0),T=W(0),A=W(0),N=W(void 0),O=W(P({})),$=W(P([])),R=W(!1);const B=I((()=>se(C)[se(L)]?.[0])),q=I((()=>se(M)[se(L)]?.[se(T)]));let F=W(void 0);function j(){const t={...r,...a},e=(n=t,g[se(F)].reduce(((t,e)=>(t[e]=n[e],t)),{}));var n;Object.keys(e).forEach((t=>{const n=e[t].type;let r="number";if("color"===n?r="rgb":"select"===n&&(r="raw"),e[t].getter){const n=e[t].getter(se(B));if(null===n)return void delete e[t];e[t].value=n,e[t].displayed=n}else e[t].displayed=lt(se(B),t,"raw"),e[t].value=lt(se(B),t,r)})),Y(N,Object.entries(e).reduce(((t,[e,n])=>{const r=n.type,o=t.find((t=>t.type===r));return o?o.props.push(e):t.push({selected:0,props:[e],type:r}),t}),[]).sort(((t,e)=>m[t.type]<m[e.type]?-1:m[t.type]>m[e.type]?1:0)),!0),Y(O,e,!0),Z()}function G(t){return t?t.map(((t,e)=>{if("inline"===t)return"inline";const n=t.selectorText;return`${t.parentStyleSheet.title||`${e}`}: ${n}`})):[]}st((()=>{null!==se(y)&&i&&se(y).addEventListener("click",z)})),st((()=>{se(E)[se(L)]?.[se(A)]!==se(F)&&Y(F,se(E)[se(L)]?.[se(A)],!0)})),st((()=>{(se(F)||se(T)||se(L))&&j()})),ze((()=>{X(),Y(y,se(_).parentNode,!0),document.body.appendChild(se(_)),document.body.appendChild(se(k)),document.body.appendChild(se(w)),et(),setTimeout((()=>{et()}),1e3),window.addEventListener("resize",et)})),Ye((()=>{window.removeEventListener("resize",et),i&&se(y).removeEventListener("click",z)}));let U=new Set;function z(t){V(t.target,t.pageX,t.pageY)}async function V(t,e,r){if(Y(b,t,!0),et(),t.classList.contains("overlay-over"))return J();if(!se(_).contains(t)){Y(L,0),Y(T,0),Y(A,0),Y($,[],!0),Y(E,[],!0),Y(M,[],!0),Y(C,o?o(t):[[t,"Clicked"]],!0),Y(E,se(C).reduce(((t,e)=>{const r=e[0],o=[];!r.firstChild||3!==r.firstChild.nodeType&&"tspan"!==r.firstChild.tagName||o.push(f);const i=r.tagName.toLowerCase();let l=!1;return n.includes(i)?(o.push(h),"g"===r.parentElement.tagName.toLowerCase()&&r.previousElementSibling&&r.previousElementSibling.tagName.toLowerCase()==i&&(l=!0)):(o.push(d),o.push(v)),l?se($).push(!0):se($).push(null),t.push(o),t}),[]),!0),Y(R,!1),Y(M,function(t){const e=document.styleSheets;return t.reduce(((t,n)=>{const r=n[0],o=["inline"];for(let t in e)try{const n=e[t].cssRules;for(let t in n){let e=n[t].selectorText;if(e&&!(n[t].selectorText.length>50)&&!e.split(",").some((t=>"*"===t))&&(e.endsWith(":hover")&&(e=e.substring(0,e.length-6)),r.matches(e))){if(null!==u&&!u(r,n[t].selectorText))continue;o.push(n[t])}}}catch(n){U.has(t)||(console.warn("Style editor: Not able to access",e[t].ownerNode,"sheet. Try CORS loading the sheet if you want to edit it."),U.add(t))}return t.push(o),t}),[])}(se(C)),!0);for(let e of Object.values(a))if(null!==e.getter(t)){Y(R,!0);break}if(Object.keys(a).length&&se(E)[0].push(p),await ae(),j(),e&&r)K(e,r);else{const e=Q(t,15);K(e.left,e.top)}}}function X(){se(_).style.display="none",se(k).style.display="none",Y(x,"")}function J(){X()}function K(t,e){se(_).style.display="block",se(_).style.opacity=0;const n=se(_).getBoundingClientRect();t=t+n.width+20>se(S).width?t-n.width-20:t+20,e=e+n.height+20>se(S).height?e-n.height-20:e+20,e=Math.max(e,0),se(_).style.left=t+"px",se(_).style.top=e+"px",se(k).style.display="block",se(_).style.opacity=1,Z()}async function Z(){if(await ae(),!se(q))return;let t;if("inline"===se(q))t=[se(B)];else{const e=se(q).selectorText.replace(/(:hover)|:focus/g,"");t=Array.from(document.querySelectorAll(e))}const e=t.map((t=>Q(t,10)));Y(x,function(t,e){let n=function({width:t,height:e,top:n=0,left:r=0}){return`M${r} ${n} v${e} h${t} v-${e}z`}({width:e.width,height:e.height});if(t.length<10&&!function(t){for(let r=0;r<t.length-1;++r){const o=t[r];for(let i=r+1;i<t.length;++i)if(e=o,n=t[i],e.right>=n.left&&n.right>=e.left&&e.bottom>=n.top&&n.bottom>=e.top)return!0}var e,n;return!1}(t)){for(const e of t)n=`${n} ${yn(e)}`;return n}const r=Math.min(...t.map((t=>t.left))),o=Math.min(...t.map((t=>t.top))),i=t.map((t=>(t.left=t.left-r,t.right=t.right-r,t.top=t.top-o,t.bottom=t.bottom-o,t)));i.sort(((t,e)=>t.left>e.left?1:t.left<e.left?-1:0));const l=Math.ceil(Math.max(...i.map((t=>t.right)))),a=Math.ceil(Math.max(...i.map((t=>t.bottom)))),s=l*a/2e4,u=Math.ceil(l/s),c=Math.ceil(a/s),f=l/u,d=a/c,h=new Array(u*c);for(let t=0,e=0;t<c;++t)for(let n=0;n<u;++n,++e)h[e]=mn({x:n*s,y:t*s},i)?1:0;const v=fn().size([u,c]).thresholds([1])(h)[0];let p="";for(let t of v.coordinates)for(let e of t){for(let t=0;t<e.length;++t){const n=e[t],i=n[0]*f+r,l=n[1]*d+o;p+=t?`L ${i} ${l}`:`M${i} ${l}`}p+="Z"}return`${n} ${p}`}(e,se(S)),!0)}function Q(t,e=0){const n=t.getBoundingClientRect();return{left:n.left+window.scrollX-e,top:n.top+window.scrollY-e,width:n.width+2*e,height:n.height+2*e,right:n.left+window.scrollX+n.width+e,bottom:n.top+window.scrollY+n.height+e}}const tt=function(t,e,n=!1){let r;return function(){const o=this,i=arguments,l=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||t.apply(o,i)}),e),l&&t.apply(o,i)}}((function(t,e,n){const r=n?e+n:e;if("inline"===se(q))if(se(O)[t].setter)se(O)[t].setter(se(B),e);else{se(B).style[t]=r}else se(q).style.setProperty(t,r);se(O)[t].value=e,se(O)[t].displayed=r,l(se(B),se(q),t,r),Z()}),100);function et(){const t=getComputedStyle(document.body),e=parseInt(t.marginLeft),n=parseInt(t.marginRight),r=parseInt(t.marginTop),o=parseInt(t.marginBottom);Y(S,{width:document.body.offsetWidth+e+n,height:document.body.offsetHeight+r+o},!0)}function nt(t,e="number"){if("raw"==e)return t;if("number"==e&&/[0-9]+(px)|(em)|(rem)/.test(t))return parseInt(t);if("rgb"==e){if("none"===t)return"#00000000";if(t.includes("rgb")||"#"==t[0])return function(t){const e=t.match(/[0-9\.]+/g).map((t=>parseFloat(t)));return 3===e.length&&e.push(1),e.reduce(((t,e,n)=>t+(3===n?Math.round(255*e).toString(16).padStart(2,"0"):e.toString(16).padStart(2,"0"))),"#")}(t)}return t}function lt(t,e,n="number"){let r=se(q)?.style?.[e];if(!r){r=getComputedStyle(t)[e]}return nt(r,n)}function at(t){"inline"===se(q)?se(B).style.removeProperty(t):se(q).style.removeProperty(t),l(se(B),se(q),t,null),j()}function ut(t){console.log("selectrule",t);const e=se(M)[se(L)]?.[t];"inline"!==e&&se(A)===se(E)[se(L)].length-1&&Y(A,0),Y(T,t,!0)}var ft=ar(),dt=ot(ft);je(dt,(t=>Y(w,t)),(()=>se(w)));var ht=it(dt,2);ht.__click=J;var vt=rt(ht),pt=rt(vt);je(ht,(t=>Y(k,t)),(()=>se(k)));var gt=it(ht,2),mt=rt(gt);mt.__click=X;var yt=it(mt,2),bt=t=>{var e=qn();Le(it(rt(e),2),17,(()=>se(C)),Ee,((t,e,n)=>{var r=I((()=>function(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}(se(e),2)));var o=In();let i;o.__click=()=>{Y(L,n,!0),Y(T,0)};var l=rt(o);ct((t=>{i=De(o,0,"",null,i,t),ke(l,se(r)[1])}),[()=>({selected:se(L)===n})]),_e(t,o)})),_e(t,e)};Me(yt,(t=>{se(C).length>1&&t(bt)}));var wt=it(yt,2),_t=it(rt(wt),2),kt=t=>{var e=Gn();e.__change=[Fn,ut],Le(e,21,(()=>G(se(M)[se(L)])),Ee,((t,e,n)=>{var r=jn();r.value=r.__value=n;var o=rt(r);ct((t=>{Re(r,se(T)===n),ke(o,t)}),[()=>c(se(e),se(b))]),_e(t,r)})),_e(t,e)},xt=t=>{var e=we();Le(ot(e),17,(()=>G(se(M)[se(L)])),Ee,((t,e,n)=>{var r=Un();let o;r.__click=()=>{ut(n)};var i=rt(r);ct(((t,n)=>{Be(r,"title",se(e)),o=De(r,0,"",null,o,t),ke(i,n)}),[()=>({selected:se(T)===n}),()=>c(se(e),se(b))]),_e(t,r)})),_e(t,e)};Me(_t,(t=>{var e,n;n=se(M)[se(L)],((e=G(n).map((t=>c(t,se(b)))))?(console.log(e,e.reduce(((t,e)=>t+e.length),0)),e.reduce(((t,e)=>t+e.length),0)):0)>30?t(kt):t(xt,!1)}));var St=it(wt,2);Le(it(rt(St),2),17,(()=>se(E)[se(L)]||[]),Ee,((t,e,n)=>{var r=we(),o=ot(r),i=t=>{var r=Wn();let o;r.__click=()=>{Y(A,n,!0)};var i=rt(r);ct(((t,e)=>{o=De(r,0,"",null,o,t),ke(i,e)}),[()=>({selected:se(A)===n}),()=>"stroke"===se(e)?"SVG paint":Ve(se(e))]),_e(t,r)};Me(o,(t=>{("custom"!==se(e)||"inline"===se(q)&&"custom"===se(e)&&se(R))&&t(i)})),_e(t,r)}));var Ct=it(St,2),Mt=t=>{var e=lr(),n=rt(e);Le(n,17,(()=>se(N)),Ee,((t,e,n)=>{var r=rr();const o=I((()=>se(e).props[se(e).selected]));var i=rt(r),l=rt(i),a=t=>{var n=Vn();n.__change=[zn,e],Le(n,21,(()=>se(e).props),Ee,((t,n,r)=>{var o=Yn();o.value=o.__value=r;var i=rt(o),l=t=>{var e=be();ct((t=>ke(e,`${t??""} color`)),[()=>Ve(se(n))]),_e(t,e)},a=t=>{var e=be();ct((t=>ke(e,t)),[()=>Xe(se(n))]),_e(t,e)};Me(i,(t=>{"color"===se(e).type?t(l):t(a,!1)})),ct((()=>Re(o,r===se(e).selected))),_e(t,o)})),_e(t,n)},s=t=>{var e=Xn(),n=rt(e);ct((t=>ke(n,t)),[()=>Xe(se(o))]),_e(t,e)};Me(l,(t=>{se(e).props.length>1?t(a):t(s,!1)})),it(l,2).__click=[Jn,at,o];var u=it(i,2),c=t=>{var e=Zn(),n=ot(e);n.__change=[Kn,tt,o,O];var r=rt(it(n,2));ct((()=>{var t,e,i;Be(n,"min",se(O)[se(o)].min),Be(n,"max",se(O)[se(o)].max),Be(n,"step",se(O)[se(o)].step||1),t=n,e=se(O)[se(o)].value,(i=Ie(t)).value!==(i.value=e??void 0)&&(t.value!==e||0===e&&"PROGRESS"===t.nodeName)&&(t.value=e??""),ke(r,se(O)[se(o)].displayed)})),_e(t,e)},f=(t,n)=>{var r=t=>{var e=nr();const n=I((()=>se(O)[se(o)].choices()));e.__change=[Qn,tt,o];var r=rt(e),i=t=>{_e(t,tr())};Me(r,(t=>{se(n).includes(se(O)[se(o)].value)||t(i)})),Le(it(r),17,(()=>se(n)),Ee,((t,e)=>{var n=er(),r=rt(n);ct((()=>{Re(n,se(e)==se(O)[se(o)].value||null),ke(r,se(e))})),_e(t,n)})),_e(t,e)},i=(t,n)=>{var r=t=>{Dn(t,{get value(){return se(O)[se(o)].value},onChange:t=>tt(se(o),t)})};Me(t,(t=>{"color"==se(e).type&&t(r)}),n)};Me(t,(t=>{"select"==se(e).type?t(r):t(i,!1)}),n)};Me(u,(t=>{"slider"===se(e).type?t(c):t(f,!1)})),ct((()=>De(r,0,`prop-section ${se(e).type??""}`))),_e(t,r)}));var r=it(n,2),o=t=>{var e=or();let n;e.__click=[Rn,$,L,B,l,q],ct((t=>n=De(e,0,"btn",null,n,t)),[()=>({active:!0===se($)[se(L)]})]),_e(t,e)};Me(r,(t=>{"inline"===se(q)&&null!==se($)[se(L)]&&t(o)}));var i=it(r,2),a=t=>{var e=ir();e.__click=[Bn,B,X],_e(t,e)};Me(i,(t=>{"inline"===se(q)&&s(se(B))&&t(a)})),_e(t,e)};return Me(Ct,(t=>{se(E)[se(L)]&&t(Mt)})),je(gt,(t=>Y(_,t)),(()=>se(_))),ct((()=>{Be(ht,"width",se(S).width),Be(ht,"height",se(S).height),Be(pt,"d",se(x))})),_e(t,ft),H({open:V,close:X,isOpened:function(){return"block"===se(_).style.display}})}!function(t){for(var e=0;e<t.length;e++)ve.add(t[e]);for(var n of pe)n(t)}(["click","change"]);return class{constructor(t){const{target:e=document.body,...n}=t;return xe(sr,{target:e,props:n})}}}));
|
|
9
|
+
var bn=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},wn=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),_n=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var l,a=t[Symbol.iterator]();!(r=(l=a.next()).done)&&(n.push(l.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&a.return&&a.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};String.prototype.startsWith=String.prototype.startsWith||function(t){return 0===this.indexOf(t)},String.prototype.padStart=String.prototype.padStart||function(t,e){for(var n=this;n.length<t;)n=e+n;return n};var kn={cb:"0f8ff",tqw:"aebd7",q:"-ffff",qmrn:"7fffd4",zr:"0ffff",bg:"5f5dc",bsq:"e4c4",bck:"---",nch:"ebcd",b:"--ff",bvt:"8a2be2",brwn:"a52a2a",brw:"deb887",ctb:"5f9ea0",hrt:"7fff-",chcT:"d2691e",cr:"7f50",rnw:"6495ed",crns:"8dc",crms:"dc143c",cn:"-ffff",Db:"--8b",Dcn:"-8b8b",Dgnr:"b8860b",Dgr:"a9a9a9",Dgrn:"-64-",Dkhk:"bdb76b",Dmgn:"8b-8b",Dvgr:"556b2f",Drng:"8c-",Drch:"9932cc",Dr:"8b--",Dsmn:"e9967a",Dsgr:"8fbc8f",DsTb:"483d8b",DsTg:"2f4f4f",Dtrq:"-ced1",Dvt:"94-d3",ppnk:"1493",pskb:"-bfff",mgr:"696969",grb:"1e90ff",rbrc:"b22222",rwht:"af0",stg:"228b22",chs:"-ff",gnsb:"dcdcdc",st:"8f8ff",g:"d7-",gnr:"daa520",gr:"808080",grn:"-8-0",grnw:"adff2f",hnw:"0fff0",htpn:"69b4",nnr:"cd5c5c",ng:"4b-82",vr:"0",khk:"0e68c",vnr:"e6e6fa",nrb:"0f5",wngr:"7cfc-",mnch:"acd",Lb:"add8e6",Lcr:"08080",Lcn:"e0ffff",Lgnr:"afad2",Lgr:"d3d3d3",Lgrn:"90ee90",Lpnk:"b6c1",Lsmn:"a07a",Lsgr:"20b2aa",Lskb:"87cefa",LsTg:"778899",Lstb:"b0c4de",Lw:"e0",m:"-ff-",mgrn:"32cd32",nn:"af0e6",mgnt:"-ff",mrn:"8--0",mqm:"66cdaa",mmb:"--cd",mmrc:"ba55d3",mmpr:"9370db",msg:"3cb371",mmsT:"7b68ee","":"-fa9a",mtr:"48d1cc",mmvt:"c71585",mnLb:"191970",ntc:"5fffa",mstr:"e4e1",mccs:"e4b5",vjw:"dead",nv:"--80",c:"df5e6",v:"808-0",vrb:"6b8e23",rng:"a5-",rngr:"45-",rch:"da70d6",pgnr:"eee8aa",pgrn:"98fb98",ptrq:"afeeee",pvtr:"db7093",ppwh:"efd5",pchp:"dab9",pr:"cd853f",pnk:"c0cb",pm:"dda0dd",pwrb:"b0e0e6",prp:"8-080",cc:"663399",r:"--",sbr:"bc8f8f",rb:"4169e1",sbrw:"8b4513",smn:"a8072",nbr:"4a460",sgrn:"2e8b57",ssh:"5ee",snn:"a0522d",svr:"c0c0c0",skb:"87ceeb",sTb:"6a5acd",sTgr:"708090",snw:"afa",n:"-ff7f",stb:"4682b4",tn:"d2b48c",t:"-8080",thst:"d8bfd8",tmT:"6347",trqs:"40e0d0",vt:"ee82ee",whT:"5deb3",wht:"",hts:"5f5f5",w:"-",wgrn:"9acd32"};function xn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return(e>0?t.toFixed(e).replace(/0+$/,"").replace(/\.$/,""):t.toString())||"0"}var Sn=function(){function t(e,n,r,o){bn(this,t);var i=this;if(void 0===e);else if(Array.isArray(e))this.rgba=e;else if(void 0===r){var l=e&&""+e;l&&function(e){if(e.startsWith("hsl")){var n=e.match(/([\-\d\.e]+)/g).map(Number),r=_n(n,4),o=r[0],l=r[1],a=r[2],s=r[3];void 0===s&&(s=1),o/=360,l/=100,a/=100,i.hsla=[o,l,a,s]}else if(e.startsWith("rgb")){var u=e.match(/([\-\d\.e]+)/g).map(Number),c=_n(u,4),f=c[0],d=c[1],h=c[2],v=c[3];void 0===v&&(v=1),i.rgba=[f,d,h,v]}else e.startsWith("#")?i.rgba=t.hexToRgb(e):i.rgba=t.nameToRgb(e)||t.hexToRgb(e)}(l.toLowerCase())}else this.rgba=[e,n,r,void 0===o?1:o]}return wn(t,[{key:"printRGB",value:function(t){var e=(t?this.rgba:this.rgba.slice(0,3)).map((function(t,e){return xn(t,3===e?3:0)}));return t?"rgba("+e+")":"rgb("+e+")"}},{key:"printHSL",value:function(t){var e=[360,100,100,1],n=["","%","%",""],r=(t?this.hsla:this.hsla.slice(0,3)).map((function(t,r){return xn(t*e[r],3===r?3:1)+n[r]}));return t?"hsla("+r+")":"hsl("+r+")"}},{key:"printHex",value:function(t){var e=this.hex;return t?e:e.substring(0,7)}},{key:"rgba",get:function(){if(this._rgba)return this._rgba;if(!this._hsla)throw new Error("No color is set");return this._rgba=t.hslToRgb(this._hsla)},set:function(t){3===t.length&&(t[3]=1),this._rgba=t,this._hsla=null}},{key:"rgbString",get:function(){return this.printRGB()}},{key:"rgbaString",get:function(){return this.printRGB(!0)}},{key:"hsla",get:function(){if(this._hsla)return this._hsla;if(!this._rgba)throw new Error("No color is set");return this._hsla=t.rgbToHsl(this._rgba)},set:function(t){3===t.length&&(t[3]=1),this._hsla=t,this._rgba=null}},{key:"hslString",get:function(){return this.printHSL()}},{key:"hslaString",get:function(){return this.printHSL(!0)}},{key:"hex",get:function(){return"#"+this.rgba.map((function(t,e){return e<3?t.toString(16):Math.round(255*t).toString(16)})).map((function(t){return t.padStart(2,"0")})).join("")},set:function(e){this.rgba=t.hexToRgb(e)}}],[{key:"hexToRgb",value:function(t){var e=(t.startsWith("#")?t.slice(1):t).replace(/^(\w{3})$/,"$1F").replace(/^(\w)(\w)(\w)(\w)$/,"$1$1$2$2$3$3$4$4").replace(/^(\w{6})$/,"$1FF");if(!e.match(/^([0-9a-fA-F]{8})$/))throw new Error("Unknown hex color; "+t);var n=e.match(/^(\w\w)(\w\w)(\w\w)(\w\w)$/).slice(1).map((function(t){return parseInt(t,16)}));return n[3]=n[3]/255,n}},{key:"nameToRgb",value:function(e){var n=e.toLowerCase().replace("at","T").replace(/[aeiouyldf]/g,"").replace("ght","L").replace("rk","D").slice(-5,4),r=kn[n];return void 0===r?r:t.hexToRgb(r.replace(/\-/g,"00").padStart(6,"f"))}},{key:"rgbToHsl",value:function(t){var e=_n(t,4),n=e[0],r=e[1],o=e[2],i=e[3];n/=255,r/=255,o/=255;var l=Math.max(n,r,o),a=Math.min(n,r,o),s=void 0,u=void 0,c=(l+a)/2;if(l===a)s=u=0;else{var f=l-a;switch(u=c>.5?f/(2-l-a):f/(l+a),l){case n:s=(r-o)/f+(r<o?6:0);break;case r:s=(o-n)/f+2;break;case o:s=(n-r)/f+4}s/=6}return[s,u,c,i]}},{key:"hslToRgb",value:function(t){var e=_n(t,4),n=e[0],r=e[1],o=e[2],i=e[3],l=void 0,a=void 0,s=void 0;if(0===r)l=a=s=o;else{var u=function(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t},c=o<.5?o*(1+r):o+r-o*r,f=2*o-c;l=u(f,c,n+1/3),a=u(f,c,n),s=u(f,c,n-1/3)}var d=[255*l,255*a,255*s].map(Math.round);return d[3]=i,d}}]),t}(),Cn=function(){function t(){bn(this,t),this._events=[]}return wn(t,[{key:"add",value:function(t,e,n){t.addEventListener(e,n,!1),this._events.push({target:t,type:e,handler:n})}},{key:"remove",value:function(e,n,r){this._events=this._events.filter((function(o){var i=!0;return e&&e!==o.target&&(i=!1),n&&n!==o.type&&(i=!1),r&&r!==o.handler&&(i=!1),i&&t._doRemove(o.target,o.type,o.handler),!i}))}},{key:"destroy",value:function(){this._events.forEach((function(e){return t._doRemove(e.target,e.type,e.handler)})),this._events=[]}}],[{key:"_doRemove",value:function(t,e,n){t.removeEventListener(e,n,!1)}}]),t}();function Mn(t,e,n){var r=!1;function o(t,e,n){return Math.max(e,Math.min(t,n))}function i(t,i,l){if(l&&(r=!0),r){t.preventDefault();var a=e.getBoundingClientRect(),s=a.width,u=a.height,c=i.clientX,f=i.clientY,d=o(c-a.left,0,s),h=o(f-a.top,0,u);n(d/s,h/u)}}function l(t,e){1===(void 0===t.buttons?t.which:t.buttons)?i(t,t,e):r=!1}function a(t,e){1===t.touches.length?i(t,t.touches[0],e):r=!1}t.add(e,"mousedown",(function(t){l(t,!0)})),t.add(e,"touchstart",(function(t){a(t,!0)})),t.add(window,"mousemove",l),t.add(e,"touchmove",a),t.add(window,"mouseup",(function(t){r=!1})),t.add(e,"touchend",(function(t){r=!1})),t.add(e,"touchcancel",(function(t){r=!1}))}var En="keydown",Ln="mousedown",Tn="focusin";function An(t,e){return(e||document).querySelector(t)}function Nn(t,e,n,r,o){t.add(e,En,(function(t){n.indexOf(t.key)>=0&&r(t)}))}var On=function(){function t(e){bn(this,t),this.settings={popup:"right",layout:"default",alpha:!0,editor:!0,editorFormat:"hex",cancelButton:!1,defaultColor:"#0cf"},this._events=new Cn,this.onChange=null,this.onDone=null,this.onOpen=null,this.onClose=null,this.setOptions(e)}return wn(t,[{key:"setOptions",value:function(t){var e=this;if(t){var n=this.settings;if(t instanceof HTMLElement)n.parent=t;else{n.parent&&t.parent&&n.parent!==t.parent&&(this._events.remove(n.parent),this._popupInited=!1),function(t,e){for(var n in t)e[n]=t[n]}(t,n),t.onChange&&(this.onChange=t.onChange),t.onDone&&(this.onDone=t.onDone),t.onOpen&&(this.onOpen=t.onOpen),t.onClose&&(this.onClose=t.onClose);var r=t.color||t.colour;r&&this._setColor(r)}var o=n.parent;if(o&&n.popup&&!this._popupInited){var i=function(t){return e.openHandler(t)};this._events.add(o,"click",i),Nn(this._events,o,[" ","Spacebar","Enter"],i),this._popupInited=!0}else t.parent&&!n.popup&&this.show()}}},{key:"openHandler",value:function(t){if(this.show()){t&&t.preventDefault(),this.settings.parent.style.pointerEvents="none";var e=t&&t.type===En?this._domEdit:this.domElement;setTimeout((function(){return e.focus()}),100),this.onOpen&&this.onOpen(this.colour)}}},{key:"closeHandler",value:function(t){var e=t&&t.type,n=!1;if(t)if(e===Ln||e===Tn){var r=(this.__containedEvent||0)+100;t.timeStamp>r&&(n=!0)}else!function(t){t.preventDefault(),t.stopPropagation()}(t),n=!0;else n=!0;n&&this.hide()&&(this.settings.parent.style.pointerEvents="",e!==Ln&&this.settings.parent.focus(),this.onClose&&this.onClose(this.colour))}},{key:"movePopup",value:function(t,e){this.closeHandler(),this.setOptions(t),e&&this.openHandler()}},{key:"setColor",value:function(t,e){this._setColor(t,{silent:e})}},{key:"_setColor",value:function(t,e){if("string"==typeof t&&(t=t.trim()),t){e=e||{};var n=void 0;try{n=new Sn(t)}catch(t){if(e.failSilently)return;throw t}if(!this.settings.alpha){var r=n.hsla;r[3]=1,n.hsla=r}this.colour=this.color=n,this._setHSLA(null,null,null,null,e)}}},{key:"setColour",value:function(t,e){this.setColor(t,e)}},{key:"show",value:function(){if(!this.settings.parent)return!1;if(this.domElement){var t=this._toggleDOM(!0);return this._setPosition(),t}var e,n,r=this.settings.template||'<div class="picker_wrapper" tabindex="-1"><div class="picker_arrow"></div><div class="picker_hue picker_slider"><div class="picker_selector"></div></div><div class="picker_sl"><div class="picker_selector"></div></div><div class="picker_alpha picker_slider"><div class="picker_selector"></div></div><div class="picker_editor"><input aria-label="Type a color name or hex value"/></div><div class="picker_sample"></div><div class="picker_done"><button>Ok</button></div><div class="picker_cancel"><button>Cancel</button></div></div>',o=(e=r,(n=document.createElement("div")).innerHTML=e,n.firstElementChild);return this.domElement=o,this._domH=An(".picker_hue",o),this._domSL=An(".picker_sl",o),this._domA=An(".picker_alpha",o),this._domEdit=An(".picker_editor input",o),this._domSample=An(".picker_sample",o),this._domOkay=An(".picker_done button",o),this._domCancel=An(".picker_cancel button",o),o.classList.add("layout_"+this.settings.layout),this.settings.alpha||o.classList.add("no_alpha"),this.settings.editor||o.classList.add("no_editor"),this.settings.cancelButton||o.classList.add("no_cancel"),this._ifPopup((function(){return o.classList.add("popup")})),this._setPosition(),this.colour?this._updateUI():this._setColor(this.settings.defaultColor),this._bindEvents(),!0}},{key:"hide",value:function(){return this._toggleDOM(!1)}},{key:"destroy",value:function(){this._events.destroy(),this.domElement&&this.settings.parent.removeChild(this.domElement)}},{key:"_bindEvents",value:function(){var t=this,e=this,n=this.domElement,r=this._events;function o(t,e,n){r.add(t,e,n)}o(n,"click",(function(t){return t.preventDefault()})),Mn(r,this._domH,(function(t,n){return e._setHSLA(t)})),Mn(r,this._domSL,(function(t,n){return e._setHSLA(null,t,1-n)})),this.settings.alpha&&Mn(r,this._domA,(function(t,n){return e._setHSLA(null,null,null,1-n)}));var i=this._domEdit;o(i,"input",(function(t){e._setColor(this.value,{fromEditor:!0,failSilently:!0})})),o(i,"focus",(function(t){var e=this;e.selectionStart===e.selectionEnd&&e.select()})),this._ifPopup((function(){var e=function(e){return t.closeHandler(e)};o(window,Ln,e),o(window,Tn,e),Nn(r,n,["Esc","Escape"],e);var i=function(e){t.__containedEvent=e.timeStamp};o(n,Ln,i),o(n,Tn,i),o(t._domCancel,"click",e)}));var l=function(e){t._ifPopup((function(){return t.closeHandler(e)})),t.onDone&&t.onDone(t.colour)};o(this._domOkay,"click",l),Nn(r,n,["Enter"],l)}},{key:"_setPosition",value:function(){var t=this.settings.parent,e=this.domElement;t!==e.parentNode&&t.appendChild(e),this._ifPopup((function(n){"static"===getComputedStyle(t).position&&(t.style.position="relative");var r=!0===n?"popup_right":"popup_"+n;["popup_top","popup_bottom","popup_left","popup_right"].forEach((function(t){t===r?e.classList.add(t):e.classList.remove(t)})),e.classList.add(r)}))}},{key:"_setHSLA",value:function(t,e,n,r,o){o=o||{};var i=this.colour,l=i.hsla;[t,e,n,r].forEach((function(t,e){(t||0===t)&&(l[e]=t)})),i.hsla=l,this._updateUI(o),this.onChange&&!o.silent&&this.onChange(i)}},{key:"_updateUI",value:function(t){if(this.domElement){t=t||{};var e=this.colour,n=e.hsla,r="hsl("+360*n[0]+", 100%, 50%)",o=e.hslString,i=e.hslaString,l=this._domH,a=this._domSL,s=this._domA,u=An(".picker_selector",l),c=An(".picker_selector",a),f=An(".picker_selector",s);y(0,u,n[0]),this._domSL.style.backgroundColor=this._domH.style.color=r,y(0,c,n[1]),b(0,c,1-n[2]),a.style.color=o,b(0,f,1-n[3]);var d=o,h=d.replace("hsl","hsla").replace(")",", 0)"),v="linear-gradient("+[d,h]+")";if(this._domA.style.background=v+", linear-gradient(45deg, lightgrey 25%, transparent 25%, transparent 75%, lightgrey 75%) 0 0 / 2em 2em,\n linear-gradient(45deg, lightgrey 25%, white 25%, white 75%, lightgrey 75%) 1em 1em / 2em 2em",!t.fromEditor){var p=this.settings.editorFormat,g=this.settings.alpha,m=void 0;switch(p){case"rgb":m=e.printRGB(g);break;case"hsl":m=e.printHSL(g);break;default:m=e.printHex(g)}this._domEdit.value=m}this._domSample.style.color=i}function y(t,e,n){e.style.left=100*n+"%"}function b(t,e,n){e.style.top=100*n+"%"}}},{key:"_ifPopup",value:function(t,e){this.settings.parent&&this.settings.popup?t&&t(this.settings.popup):e&&e()}},{key:"_toggleDOM",value:function(t){var e=this.domElement;if(!e)return!1;var n=t?"":"none",r=e.style.display!==n;return r&&(e.style.display=n),r}}]),t}(),$n=ye('<div class="picker"></div>');function Dn(t,e){D(e,!0);let n=We(e,"value",15,"#AAAAAAFF"),r=We(e,"options",19,(()=>({}))),o=We(e,"onChange",3,(()=>{})),i=W(void 0),l=W(void 0);function a(t){var e;(e=t.hex)!==n()&&(o()(e,n()),n(e))}st((()=>{se(l)&&se(l).setColor(n())})),ze((()=>{!function(t){if(!se(i))return;se(l)&&se(l).destroy();t.onChange=a,Y(l,new On({parent:se(i),color:n(),popup:!1,...t}),!0),se(l).show(),se(l).openHandler()}(r())})),Ye((()=>{se(l)?.destroy()}));var s=$n();return je(s,(t=>Y(i,t)),(()=>se(i))),_e(t,s),H({setColor:function(t){se(l).setColor(t)}})}const Hn=function(){const t=new Set(["Arial","Arial Black","Bahnschrift","Calibri","Cambria","Cambria Math","Candara","Comic Sans MS","Consolas","Constantia","Corbel","Courier New","Ebrima","Franklin Gothic Medium","Gabriola","Gadugi","Georgia","HoloLens MDL2 Assets","Impact","Ink Free","Javanese Text","Leelawadee UI","Lucida Console","Lucida Sans Unicode","Malgun Gothic","Marlett","Microsoft Himalaya","Microsoft JhengHei","Microsoft New Tai Lue","Microsoft PhagsPa","Microsoft Sans Serif","Microsoft Tai Le","Microsoft YaHei","Microsoft Yi Baiti","MingLiU-ExtB","Mongolian Baiti","MS Gothic","MV Boli","Myanmar Text","Nirmala UI","Palatino Linotype","Segoe MDL2 Assets","Segoe Print","Segoe Script","Segoe UI","Segoe UI Historic","Segoe UI Emoji","Segoe UI Symbol","SimSun","Sitka","Sylfaen","Symbol","Tahoma","Times New Roman","Trebuchet MS","Verdana","Webdings","Wingdings","Yu Gothic","American Typewriter","Andale Mono","Arial","Arial Black","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Avenir","Avenir Next","Avenir Next Condensed","Baskerville","Big Caslon","Bodoni 72","Bodoni 72 Oldstyle","Bodoni 72 Smallcaps","Bradley Hand","Brush Script MT","Chalkboard","Chalkboard SE","Chalkduster","Charter","Cochin","Comic Sans MS","Copperplate","Courier","Courier New","Didot","DIN Alternate","DIN Condensed","Futura","Geneva","Georgia","Gill Sans","Helvetica","Helvetica Neue","Herculanum","Hoefler Text","Impact","Lucida Grande","Luminari","Marker Felt","Menlo","Microsoft Sans Serif","Monaco","Noteworthy","Optima","Palatino","Papyrus","Phosphate","Rockwell","Savoye LET","SignPainter","Skia","Snell Roundhand","Tahoma","Times","Times New Roman","Trattatello","Trebuchet MS","Verdana","Zapfino","Comic Sans MS","Comic Sans","Apple Chancery","Bradley Hand","Brush Script MT","Brush Script Std","Snell Roundhand","URW Chancery L"].sort()),e={},n={},r=["monospace","sans-serif","serif","cursive"],o=document.getElementsByTagName("body")[0],i=document.createElement("span");i.style.fontSize="72px",i.innerHTML="mmmmmmmmmmlli",r.forEach((t=>{i.style.fontFamily=t,o.appendChild(i),e[t]=i.offsetWidth,n[t]=i.offsetHeight,o.removeChild(i)}));const l=[],a=t=>{let l=!1;for(const a of r){i.style.fontFamily=t+","+a,o.appendChild(i);const r=i.offsetWidth!=e[a]||i.offsetHeight!=n[a];o.removeChild(i),l=l||r}return l};for(const e of t.values())a(e)&&l.push(e);return l.sort()}();function Pn(){let{fonts:t}=document;const e=t.entries();let n=[],r=!1;for(;!r;){const t=e.next();if(t.done)r=t.done;else{const e=t.value;let r;r=e.length?e[0].family:e.family,n.push(r)}}return[...new Set(n)]}function Rn(t,e,n,r,o,i){se(e)[se(n)]=!1,se(r).parentNode.appendChild(se(r)),o(se(r),se(i),"bringtofront",null)}function Bn(t,e,n){se(e).remove(),n()}var In=ye("<span> </span>"),qn=ye('<div class="select-tab"><b>Element</b> <!></div>'),Fn=(t,e)=>e(t.target.value),jn=ye("<option> </option>"),Gn=ye("<select></select>"),Un=ye("<span> </span>"),Wn=ye("<span> </span>"),zn=async(t,e)=>{se(e).selected=t.target.value,await ae()},Yn=ye("<option><!></option>"),Vn=ye("<select></select>"),Xn=ye("<span> </span>"),Jn=(t,e,n)=>e(se(n)),Kn=(t,e,n,r)=>e(se(n),t.target.value,se(r)[se(n)].suffix,t.target),Zn=ye('<input type="range"/> <span class="current-value"> </span>',1),Qn=(t,e,n)=>e(se(n),t.target.value),tr=ye('<option selected="true">---</option>'),er=ye("<option> </option>"),nr=ye("<select><!><!></select>"),rr=ye('<div><div class="prop-name"><!> <span class="delete">✕</span></div> <!></div>'),or=ye("<div>Bring to front</div>"),ir=ye('<div class="btn delete-elem">Delete element</div>'),lr=ye('<div class="editor"><!> <!> <!></div>'),ar=ye('<div style="position: absolute;"></div> <svg class="ise-helper-wrapper" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><clipPath id="overlay-clip" clip-rule="evenodd"><path></path></clipPath><rect y="0" x="0" height="100%" width="100%" class="overlay-over"></rect></svg> <div class="ise"><div class="close-button">x</div> <!> <div class="select-tab"><b>Applied to:</b> <!></div> <div class="select-tab"><b>Property type:</b> <!></div> <!></div>',1);function sr(t,e){D(e,!0);const n=["altGlyph","circle","ellipse","line","path","polygon","polyline","rect","text","textPath","tref","tspan"],r={"border-radius":{type:"slider",min:0,max:30,suffix:"px"},"border-width":{type:"slider",min:0,max:30,suffix:"px"},"border-style":{type:"select",choices:()=>["none","dotted","dashed","solid","double","groove","ridge","inset","outset"]},"border-color":{type:"color"},"font-family":{type:"select",choices:function(){return[...Pn(),...Hn]}},"font-size":{type:"slider",min:0,max:40,suffix:"px"},"font-weight":{type:"slider",min:0,max:800},color:{type:"color"},"stroke-width":{type:"slider",min:0,max:20,step:.5,suffix:"px"},stroke:{type:"color"},"stroke-linejoin":{type:"select",choices:()=>["bevel","miter","round"]},fill:{type:"color"},"stroke-dasharray":{type:"slider",min:0,max:30,suffix:"px"},"background-color":{type:"color"}},o=e.getElems??null,i=e.listenOnClick??!1,l=e.onStyleChanged??(()=>{}),a=e.customProps??{},s=e.inlineDeletable??(()=>!0),u=e.cssRuleFilter??null,c=e.getCssRuleName??((t,e)=>"inline"===t?"Selected element":t),f="text",d="border",h="stroke",v="background",p="custom",g={[f]:["font-family","font-size","font-weight","color"],[d]:["border-radius","border-width","border-color","border-style"],[h]:["stroke-width","stroke","stroke-dasharray","stroke-linejoin","fill"],[v]:["background-color"],[p]:Object.keys(a)},m={slider:0,select:1,color:2};let y=W(null),b=W(null),w=W(void 0),_=W(void 0),k=W(void 0),x=W(""),S=W(P({width:0,height:0})),C=W(P([[]])),M=W(P([])),E=W(P([])),L=W(0),T=W(0),A=W(0),N=W(void 0),O=W(P({})),$=W(P([])),R=W(!1);const B=I((()=>se(C)[se(L)]?.[0])),q=I((()=>se(M)[se(L)]?.[se(T)]));let F=W(void 0);function j(){const t={...r,...a},e=(n=t,g[se(F)].reduce(((t,e)=>(t[e]=n[e],t)),{}));var n;Object.keys(e).forEach((t=>{const n=e[t].type;let r="number";if("color"===n?r="rgb":"select"===n&&(r="raw"),e[t].getter){const n=e[t].getter(se(B));if(null===n)return void delete e[t];e[t].value=n,e[t].displayed=n}else e[t].displayed=lt(se(B),t,"raw"),e[t].value=lt(se(B),t,r)})),Y(N,Object.entries(e).reduce(((t,[e,n])=>{const r=n.type,o=t.find((t=>t.type===r));return o?o.props.push(e):t.push({selected:0,props:[e],type:r}),t}),[]).sort(((t,e)=>m[t.type]<m[e.type]?-1:m[t.type]>m[e.type]?1:0)),!0),Y(O,e,!0),Z()}function G(t){return t?t.map(((t,e)=>{if("inline"===t)return"inline";const n=t.selectorText;return`${t.parentStyleSheet.title||`${e}`}: ${n}`})):[]}st((()=>{null!==se(y)&&i&&se(y).addEventListener("click",z)})),st((()=>{se(E)[se(L)]?.[se(A)]!==se(F)&&Y(F,se(E)[se(L)]?.[se(A)],!0)})),st((()=>{(se(F)||se(T)||se(L))&&j()})),ze((()=>{X(),Y(y,se(_).parentNode,!0),document.body.appendChild(se(_)),document.body.appendChild(se(k)),document.body.appendChild(se(w)),et(),setTimeout((()=>{et()}),1e3),window.addEventListener("resize",et)})),Ye((()=>{window.removeEventListener("resize",et),i&&se(y).removeEventListener("click",z)}));let U=new Set;function z(t){V(t.target,t.pageX,t.pageY)}async function V(t,e,r){if(Y(b,t,!0),et(),t.classList.contains("overlay-over"))return J();if(!se(_).contains(t)){Y(L,0),Y(T,0),Y(A,0),Y($,[],!0),Y(E,[],!0),Y(M,[],!0),Y(C,o?o(t):[[t,"Clicked"]],!0),Y(E,se(C).reduce(((t,e)=>{const r=e[0],o=[];!r.firstChild||3!==r.firstChild.nodeType&&"tspan"!==r.firstChild.tagName||o.push(f);const i=r.tagName.toLowerCase();let l=!1;return n.includes(i)?(o.push(h),"g"===r.parentElement.tagName.toLowerCase()&&r.previousElementSibling&&r.previousElementSibling.tagName.toLowerCase()==i&&(l=!0)):(o.push(d),o.push(v)),l?se($).push(!0):se($).push(null),t.push(o),t}),[]),!0),Y(R,!1),Y(M,function(t){const e=document.styleSheets;return t.reduce(((t,n)=>{const r=n[0],o=["inline"];for(let t in e)try{const n=e[t].cssRules;for(let t in n){let e=n[t].selectorText;if(e&&!(n[t].selectorText.length>50)&&!e.split(",").some((t=>"*"===t))&&(e.endsWith(":hover")&&(e=e.substring(0,e.length-6)),r.matches(e))){if(null!==u&&!u(r,n[t].selectorText))continue;o.push(n[t])}}}catch(n){U.has(t)||(console.warn("Style editor: Not able to access",e[t].ownerNode,"sheet. Try CORS loading the sheet if you want to edit it."),U.add(t))}return t.push(o),t}),[])}(se(C)),!0);for(let e of Object.values(a))if(null!==e.getter(t)){Y(R,!0);break}if(Object.keys(a).length&&se(E)[0].push(p),await ae(),j(),e&&r)K(e,r);else{const e=Q(t,15);K(e.left,e.top)}}}function X(){se(_).style.display="none",se(k).style.display="none",Y(x,"")}function J(){X()}function K(t,e){se(_).style.display="block",se(_).style.opacity=0;const n=se(_).getBoundingClientRect();t=t+n.width+20>se(S).width?t-n.width-20:t+20,e=e+n.height+20>se(S).height?e-n.height-20:e+20,e=Math.max(e,0),se(_).style.left=t+"px",se(_).style.top=e+"px",se(k).style.display="block",se(_).style.opacity=1,Z()}async function Z(){if(await ae(),!se(q))return;let t;if("inline"===se(q))t=[se(B)];else{const e=se(q).selectorText.replace(/(:hover)|:focus/g,"");t=Array.from(document.querySelectorAll(e))}const e=t.map((t=>Q(t,10)));Y(x,function(t,e){let n=function({width:t,height:e,top:n=0,left:r=0}){return`M${r} ${n} v${e} h${t} v-${e}z`}({width:e.width,height:e.height});if(t.length<10&&!function(t){for(let r=0;r<t.length-1;++r){const o=t[r];for(let i=r+1;i<t.length;++i)if(e=o,n=t[i],e.right>=n.left&&n.right>=e.left&&e.bottom>=n.top&&n.bottom>=e.top)return!0}var e,n;return!1}(t)){for(const e of t)n=`${n} ${yn(e)}`;return n}const r=Math.min(...t.map((t=>t.left))),o=Math.min(...t.map((t=>t.top))),i=t.map((t=>(t.left=t.left-r,t.right=t.right-r,t.top=t.top-o,t.bottom=t.bottom-o,t)));i.sort(((t,e)=>t.left>e.left?1:t.left<e.left?-1:0));const l=Math.ceil(Math.max(...i.map((t=>t.right)))),a=Math.ceil(Math.max(...i.map((t=>t.bottom)))),s=l*a/2e4,u=Math.ceil(l/s),c=Math.ceil(a/s),f=l/u,d=a/c,h=new Array(u*c);for(let t=0,e=0;t<c;++t)for(let n=0;n<u;++n,++e)h[e]=mn({x:n*s,y:t*s},i)?1:0;const v=fn().size([u,c]).thresholds([1])(h)[0];let p="";for(let t of v.coordinates)for(let e of t){for(let t=0;t<e.length;++t){const n=e[t],i=n[0]*f+r,l=n[1]*d+o;p+=t?`L ${i} ${l}`:`M${i} ${l}`}p+="Z"}return`${n} ${p}`}(e,se(S)),!0)}function Q(t,e=0){const n=t.getBoundingClientRect();return{left:n.left+window.scrollX-e,top:n.top+window.scrollY-e,width:n.width+2*e,height:n.height+2*e,right:n.left+window.scrollX+n.width+e,bottom:n.top+window.scrollY+n.height+e}}const tt=function(t,e,n=!1){let r;return function(){const o=this,i=arguments,l=n&&!r;clearTimeout(r),r=setTimeout((function(){r=null,n||t.apply(o,i)}),e),l&&t.apply(o,i)}}((function(t,e,n){const r=n?e+n:e;if("inline"===se(q))if(se(O)[t].setter)se(O)[t].setter(se(B),e);else{se(B).style[t]=r}else se(q).style.setProperty(t,r);se(O)[t].value=e,se(O)[t].displayed=r,l(se(B),se(q),t,r),Z()}),100);function et(){const t=getComputedStyle(document.body),e=parseInt(t.marginLeft),n=parseInt(t.marginRight),r=parseInt(t.marginTop),o=parseInt(t.marginBottom);Y(S,{width:document.body.offsetWidth+e+n,height:document.body.offsetHeight+r+o},!0)}function nt(t,e="number"){if("raw"==e)return t;if("number"==e&&/[0-9]+(px)|(em)|(rem)/.test(t))return parseInt(t);if("rgb"==e){if("none"===t)return"#00000000";if(t.includes("rgb")||"#"==t[0])return function(t){const e=t.match(/[0-9\.]+/g).map((t=>parseFloat(t)));return 3===e.length&&e.push(1),e.reduce(((t,e,n)=>t+(3===n?Math.round(255*e).toString(16).padStart(2,"0"):e.toString(16).padStart(2,"0"))),"#")}(t)}return t}function lt(t,e,n="number"){let r=se(q)?.style?.[e];if(!r){r=getComputedStyle(t)[e]}return nt(r,n)}function at(t){"inline"===se(q)?se(B).style.removeProperty(t):se(q).style.removeProperty(t),l(se(B),se(q),t,null),j()}function ut(t){const e=se(M)[se(L)]?.[t];"inline"!==e&&se(A)===se(E)[se(L)].length-1&&Y(A,0),Y(T,t,!0)}var ft=ar(),dt=ot(ft);je(dt,(t=>Y(w,t)),(()=>se(w)));var ht=it(dt,2);ht.__click=J;var vt=rt(ht),pt=rt(vt);je(ht,(t=>Y(k,t)),(()=>se(k)));var gt=it(ht,2),mt=rt(gt);mt.__click=X;var yt=it(mt,2),bt=t=>{var e=qn();Le(it(rt(e),2),17,(()=>se(C)),Ee,((t,e,n)=>{var r=I((()=>function(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}(se(e),2)));var o=In();let i;o.__click=()=>{Y(L,n,!0),Y(T,0)};var l=rt(o);ct((t=>{i=De(o,0,"",null,i,t),ke(l,se(r)[1])}),[()=>({selected:se(L)===n})]),_e(t,o)})),_e(t,e)};Me(yt,(t=>{se(C).length>1&&t(bt)}));var wt=it(yt,2),_t=it(rt(wt),2),kt=t=>{var e=Gn();e.__change=[Fn,ut],Le(e,21,(()=>G(se(M)[se(L)])),Ee,((t,e,n)=>{var r=jn();r.value=r.__value=n;var o=rt(r);ct((t=>{Re(r,se(T)===n),ke(o,t)}),[()=>c(se(e),se(b))]),_e(t,r)})),_e(t,e)},xt=t=>{var e=we();Le(ot(e),17,(()=>G(se(M)[se(L)])),Ee,((t,e,n)=>{var r=Un();let o;r.__click=()=>{ut(n)};var i=rt(r);ct(((t,n)=>{Be(r,"title",se(e)),o=De(r,0,"",null,o,t),ke(i,n)}),[()=>({selected:se(T)===n}),()=>c(se(e),se(b))]),_e(t,r)})),_e(t,e)};Me(_t,(t=>{var e,n;n=se(M)[se(L)],((e=G(n).map((t=>c(t,se(b)))))?e.reduce(((t,e)=>t+e.length),0):0)>30?t(kt):t(xt,!1)}));var St=it(wt,2);Le(it(rt(St),2),17,(()=>se(E)[se(L)]||[]),Ee,((t,e,n)=>{var r=we(),o=ot(r),i=t=>{var r=Wn();let o;r.__click=()=>{Y(A,n,!0)};var i=rt(r);ct(((t,e)=>{o=De(r,0,"",null,o,t),ke(i,e)}),[()=>({selected:se(A)===n}),()=>"stroke"===se(e)?"SVG paint":Ve(se(e))]),_e(t,r)};Me(o,(t=>{("custom"!==se(e)||"inline"===se(q)&&"custom"===se(e)&&se(R))&&t(i)})),_e(t,r)}));var Ct=it(St,2),Mt=t=>{var e=lr(),n=rt(e);Le(n,17,(()=>se(N)),Ee,((t,e,n)=>{var r=rr();const o=I((()=>se(e).props[se(e).selected]));var i=rt(r),l=rt(i),a=t=>{var n=Vn();n.__change=[zn,e],Le(n,21,(()=>se(e).props),Ee,((t,n,r)=>{var o=Yn();o.value=o.__value=r;var i=rt(o),l=t=>{var e=be();ct((t=>ke(e,`${t??""} color`)),[()=>Ve(se(n))]),_e(t,e)},a=t=>{var e=be();ct((t=>ke(e,t)),[()=>Xe(se(n))]),_e(t,e)};Me(i,(t=>{"color"===se(e).type?t(l):t(a,!1)})),ct((()=>Re(o,r===se(e).selected))),_e(t,o)})),_e(t,n)},s=t=>{var e=Xn(),n=rt(e);ct((t=>ke(n,t)),[()=>Xe(se(o))]),_e(t,e)};Me(l,(t=>{se(e).props.length>1?t(a):t(s,!1)})),it(l,2).__click=[Jn,at,o];var u=it(i,2),c=t=>{var e=Zn(),n=ot(e);n.__change=[Kn,tt,o,O];var r=rt(it(n,2));ct((()=>{var t,e,i;Be(n,"min",se(O)[se(o)].min),Be(n,"max",se(O)[se(o)].max),Be(n,"step",se(O)[se(o)].step||1),t=n,e=se(O)[se(o)].value,(i=Ie(t)).value!==(i.value=e??void 0)&&(t.value!==e||0===e&&"PROGRESS"===t.nodeName)&&(t.value=e??""),ke(r,se(O)[se(o)].displayed)})),_e(t,e)},f=(t,n)=>{var r=t=>{var e=nr();const n=I((()=>se(O)[se(o)].choices()));e.__change=[Qn,tt,o];var r=rt(e),i=t=>{_e(t,tr())};Me(r,(t=>{se(n).includes(se(O)[se(o)].value)||t(i)})),Le(it(r),17,(()=>se(n)),Ee,((t,e)=>{var n=er(),r=rt(n);ct((()=>{Re(n,se(e)==se(O)[se(o)].value||null),ke(r,se(e))})),_e(t,n)})),_e(t,e)},i=(t,n)=>{var r=t=>{Dn(t,{get value(){return se(O)[se(o)].value},onChange:t=>tt(se(o),t)})};Me(t,(t=>{"color"==se(e).type&&t(r)}),n)};Me(t,(t=>{"select"==se(e).type?t(r):t(i,!1)}),n)};Me(u,(t=>{"slider"===se(e).type?t(c):t(f,!1)})),ct((()=>De(r,0,`prop-section ${se(e).type??""}`))),_e(t,r)}));var r=it(n,2),o=t=>{var e=or();let n;e.__click=[Rn,$,L,B,l,q],ct((t=>n=De(e,0,"btn",null,n,t)),[()=>({active:!0===se($)[se(L)]})]),_e(t,e)};Me(r,(t=>{"inline"===se(q)&&null!==se($)[se(L)]&&t(o)}));var i=it(r,2),a=t=>{var e=ir();e.__click=[Bn,B,X],_e(t,e)};Me(i,(t=>{"inline"===se(q)&&s(se(B))&&t(a)})),_e(t,e)};return Me(Ct,(t=>{se(E)[se(L)]&&t(Mt)})),je(gt,(t=>Y(_,t)),(()=>se(_))),ct((()=>{Be(ht,"width",se(S).width),Be(ht,"height",se(S).height),Be(pt,"d",se(x))})),_e(t,ft),H({open:V,close:X,isOpened:function(){return"block"===se(_).style.display}})}!function(t){for(var e=0;e<t.length;e++)ve.add(t[e]);for(var n of pe)n(t)}(["click","change"]);return class{constructor(t){const{target:e=document.body,...n}=t;return xe(sr,{target:e,props:n})}}}));
|
|
@@ -3825,7 +3825,6 @@ function pascalCaseToSentence(str) {
|
|
|
3825
3825
|
|
|
3826
3826
|
function nbChars(strArray) {
|
|
3827
3827
|
if (!strArray) return 0;
|
|
3828
|
-
console.log(strArray, strArray.reduce((acc, str) => acc + str.length, 0));
|
|
3829
3828
|
return strArray.reduce((acc, str) => acc + str.length, 0);
|
|
3830
3829
|
}
|
|
3831
3830
|
|
|
@@ -6026,8 +6025,6 @@ function InlineStyleEditor$1($$anchor, $$props) {
|
|
|
6026
6025
|
}
|
|
6027
6026
|
|
|
6028
6027
|
function selectRule(ruleIndex) {
|
|
6029
|
-
console.log("selectrule", ruleIndex);
|
|
6030
|
-
|
|
6031
6028
|
const newRule = get(allRules)[get(selectedElemIndex)]?.[ruleIndex];
|
|
6032
6029
|
|
|
6033
6030
|
if (newRule !== "inline" && get(selectedTypeIndex) === get(allTypes)[get(selectedElemIndex)].length - 1) {
|
package/package.json
CHANGED
package/src/util/util.js
CHANGED