From 06344ae47d5ec348b7039531585b8cee8e5af620 Mon Sep 17 00:00:00 2001 From: SHL-COOL <31879581+SHL-COOL@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:31:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=80=9D=E7=BB=B4=E5=AF=BC?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 + resource/i18n/en.json | 5 +- resource/i18n/zh-CN.json | 5 +- src/options/router.ts | 8 + src/options/typings.d.ts | 2 + src/options/views/mindMap/Index.vue | 340 ++++++++++++++++++ src/options/views/mindMap/data.json | 52 +++ .../mindMap/handDrawnLikeStyle.esm.min.js | 1 + src/options/views/settings/Sites/Index.vue | 6 + 9 files changed, 420 insertions(+), 2 deletions(-) create mode 100644 src/options/views/mindMap/Index.vue create mode 100644 src/options/views/mindMap/data.json create mode 100644 src/options/views/mindMap/handDrawnLikeStyle.esm.min.js diff --git a/package.json b/package.json index e3daeb7ea..8459248c8 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,9 @@ "parse-torrent": "^11.0.16", "ua-parser-js": "^1.0.2", "url-parse": "^1.5.10", + "simple-mind-map": "^0.12.1", + "simple-mind-map-plugin-themes": "^1.0.0", + "roughjs": "^4.6.6", "vue": "~2.7.0", "vue-class-component": "^6.3.2", "vue-i18n": "^8.11.2", diff --git a/resource/i18n/en.json b/resource/i18n/en.json index 93f375816..78be447ee 100644 --- a/resource/i18n/en.json +++ b/resource/i18n/en.json @@ -40,6 +40,8 @@ "export": "Export", "import": "Import", "share": "Share", + "fullScreen": "FullScreen", + "rePosition": "RePosition", "actionConfirm": "Are you sure you want to do this?", "importFailed": "Import failed", "importSuccess": "Import success", @@ -812,7 +814,8 @@ "importConfig": "Import from config", "importConfirm": "Are you sure you want to import [{name}] ?", "importDuplicateConfirm": "The site {name} already exists. Do you need to import search entrys and plugins?", - "resetFavicons": "Reset site favicons" + "resetFavicons": "Reset site favicons", + "ptMindMap": "PT Site Mind Map" } }, "siteSearchEntry": { diff --git a/resource/i18n/zh-CN.json b/resource/i18n/zh-CN.json index c0ebf1909..e479a65f1 100644 --- a/resource/i18n/zh-CN.json +++ b/resource/i18n/zh-CN.json @@ -37,6 +37,8 @@ "export": "导出", "import": "导入", "share": "分享", + "fullScreen": "全屏", + "rePosition": "复位", "actionConfirm": "确认要进行此操作吗?", "importFailed": "导入失败", "importSuccess": "已成功导入", @@ -807,7 +809,8 @@ "importConfig": "从文件导入", "importConfirm": "确认要导入 【{name}】 吗?", "importDuplicateConfirm": "该站点 【{name}】 已存在,是否需要导入搜索入口和插件?", - "resetFavicons": "重置站点图标缓存" + "resetFavicons": "重置站点图标缓存", + "ptMindMap": "PT站点思维导图" } }, "siteSearchEntry": { diff --git a/src/options/router.ts b/src/options/router.ts index 23440576e..72aa323a8 100644 --- a/src/options/router.ts +++ b/src/options/router.ts @@ -149,6 +149,14 @@ export default new Router({ path: "/keep-upload-task", name: "keep-upload-task", component: () => import("./views/keepUpload/KeepUploadTasks.vue") + }, + { + path: "/mind", + name: "mind", + component: () => import("./views/mindMap/Index.vue"), + meta: { + keepAlive: false + } } ] }); diff --git a/src/options/typings.d.ts b/src/options/typings.d.ts index d3065d697..8634148ad 100644 --- a/src/options/typings.d.ts +++ b/src/options/typings.d.ts @@ -1,2 +1,4 @@ declare module "basiccontext"; declare module "highcharts-vue"; +declare module "simple-mind-map-plugin-themes"; +declare module "simple-mind-map/src/plugins/*"; diff --git a/src/options/views/mindMap/Index.vue b/src/options/views/mindMap/Index.vue new file mode 100644 index 000000000..cdd2b12f7 --- /dev/null +++ b/src/options/views/mindMap/Index.vue @@ -0,0 +1,340 @@ + + + + + + + {{ $t("common.rePosition") }} + my_location + + + + {{ $t("common.fullScreen") }} + fullscreen + + + + {{ $t("common.share") }} SVG + share + + + + {{ $t("common.share") }} PNG + image + + + + + + + {{ $t("common.loading") }} + + + + + + + \ No newline at end of file diff --git a/src/options/views/mindMap/data.json b/src/options/views/mindMap/data.json new file mode 100644 index 000000000..d39a63d25 --- /dev/null +++ b/src/options/views/mindMap/data.json @@ -0,0 +1,52 @@ +{ + "layout": "mindMap", + "root": { + "data": { + "text": "PTPP" + }, + "children": [ + ] + }, + "theme": { + "template": "gold", + "config": { + "node": { + "marginX": 18 + }, + "imgMaxWidth": 21, + "imgMaxHeight": 21, + "paddingX": 14, + "lineWidth": 2, + "lineRadius": 7, + "lineStyle": "straight", + "second": { + "marginY": 39 + } + } + }, + "view": { + "transform": { + "scaleX": 0.8, + "scaleY": 0.8000000000000002, + "shear": 0, + "rotate": 0, + "translateX": 78.88571428571342, + "translateY": 67.17142857142973, + "originX": 0, + "originY": 0, + "a": 0.8, + "b": 0, + "c": 0, + "d": 0.8, + "e": 78.88571428571342, + "f": 67.17142857142973 + }, + "state": { + "scale": 0.8, + "x": 78.88571428571342, + "y": 67.17142857142973, + "sx": 733.9714285714283, + "sy": 589.0428571428574 + } + } +} \ No newline at end of file diff --git a/src/options/views/mindMap/handDrawnLikeStyle.esm.min.js b/src/options/views/mindMap/handDrawnLikeStyle.esm.min.js new file mode 100644 index 000000000..80bc745c6 --- /dev/null +++ b/src/options/views/mindMap/handDrawnLikeStyle.esm.min.js @@ -0,0 +1 @@ +function tt(a,t,s){if(a&&a.length){let[e,n]=t,o=Math.PI/180*s,r=Math.cos(o),h=Math.sin(o);for(let i of a){let[l,c]=i;i[0]=(l-e)*r-(c-n)*h+e,i[1]=(l-e)*h+(c-n)*r+n}}}function Et(a,t){return a[0]===t[0]&&a[1]===t[1]}function Gt(a,t,s,e=1){let n=s,o=Math.max(t,.1),r=a[0]&&a[0][0]&&typeof a[0][0]=="number"?[a]:a,h=[0,0];if(n)for(let l of r)tt(l,h,n);let i=function(l,c,d){let p=[];for(let M of l){let y=[...M];Et(y[0],y[y.length-1])||y.push([y[0][0],y[0][1]]),y.length>2&&p.push(y)}let u=[];c=Math.max(c,.1);let f=[];for(let M of p)for(let y=0;yM.yminy.ymin?1:M.xy.x?1:M.ymax===y.ymax?0:(M.ymax-y.ymax)/Math.abs(M.ymax-y.ymax)),!f.length)return u;let g=[],k=f[0].ymin,m=0;for(;g.length||f.length;){if(f.length){let M=-1;for(let y=0;yk);y++)M=y;f.splice(0,M+1).forEach(y=>{g.push({s:k,edge:y})})}if(g=g.filter(M=>!(M.edge.ymax<=k)),g.sort((M,y)=>M.edge.x===y.edge.x?0:(M.edge.x-y.edge.x)/Math.abs(M.edge.x-y.edge.x)),(d!==1||m%c==0)&&g.length>1)for(let M=0;M=g.length)break;let x=g[M].edge,w=g[y].edge;u.push([[Math.round(x.x),k],[Math.round(w.x),k]])}k+=d,g.forEach(M=>{M.edge.x=M.edge.x+d*M.edge.islope}),m++}return u}(r,o,e);if(n){for(let l of r)tt(l,h,-n);(function(l,c,d){let p=[];l.forEach(u=>p.push(...u)),tt(p,c,d)})(i,h,-n)}return i}function N(a,t){var s;let e=t.hachureAngle+90,n=t.hachureGap;n<0&&(n=4*t.strokeWidth),n=Math.round(Math.max(n,.1));let o=1;return t.roughness>=1&&(((s=t.randomizer)===null||s===void 0?void 0:s.next())||Math.random())>.7&&(o=n),Gt(a,n,e,o||1)}var q=class{constructor(t){this.helper=t}fillPolygons(t,s){return this._fillPolygons(t,s)}_fillPolygons(t,s){let e=N(t,s);return{type:"fillSketch",ops:this.renderLines(e,s)}}renderLines(t,s){let e=[];for(let n of t)e.push(...this.helper.doubleLineOps(n[0][0],n[0][1],n[1][0],n[1][1],s));return e}};function X(a){let t=a[0],s=a[1];return Math.sqrt(Math.pow(t[0]-s[0],2)+Math.pow(t[1]-s[1],2))}var ot=class extends q{fillPolygons(t,s){let e=s.hachureGap;e<0&&(e=4*s.strokeWidth),e=Math.max(e,.1);let n=N(t,Object.assign({},s,{hachureGap:e})),o=Math.PI/180*s.hachureAngle,r=[],h=.5*e*Math.cos(o),i=.5*e*Math.sin(o);for(let[l,c]of n)X([l,c])&&r.push([[l[0]-h,l[1]+i],[...c]],[[l[0]+h,l[1]-i],[...c]]);return{type:"fillSketch",ops:this.renderLines(r,s)}}},ht=class extends q{fillPolygons(t,s){let e=this._fillPolygons(t,s),n=Object.assign({},s,{hachureAngle:s.hachureAngle+90}),o=this._fillPolygons(t,n);return e.ops=e.ops.concat(o.ops),e}},rt=class{constructor(t){this.helper=t}fillPolygons(t,s){let e=N(t,s=Object.assign({},s,{hachureAngle:0}));return this.dotsOnLines(e,s)}dotsOnLines(t,s){let e=[],n=s.hachureGap;n<0&&(n=4*s.strokeWidth),n=Math.max(n,.1);let o=s.fillWeight;o<0&&(o=s.strokeWidth/2);let r=n/4;for(let h of t){let i=X(h),l=i/n,c=Math.ceil(l)-1,d=i-c*n,p=(h[0][0]+h[1][0])/2-n/4,u=Math.min(h[0][1],h[1][1]);for(let f=0;f{let h=X(r),i=Math.floor(h/(e+n)),l=(h+n-i*(e+n))/2,c=r[0],d=r[1];c[0]>d[0]&&(c=r[1],d=r[0]);let p=Math.atan((d[1]-c[1])/(d[0]-c[0]));for(let u=0;u{let r=X(o),h=Math.round(r/(2*s)),i=o[0],l=o[1];i[0]>l[0]&&(i=o[1],l=o[0]);let c=Math.atan((l[1]-i[1])/(l[0]-i[0]));for(let d=0;dc%2?l+s:l+t);o.push({key:"C",data:i}),t=i[4],s=i[5];break}case"Q":o.push({key:"Q",data:[...h]}),t=h[2],s=h[3];break;case"q":{let i=h.map((l,c)=>c%2?l+s:l+t);o.push({key:"Q",data:i}),t=i[2],s=i[3];break}case"A":o.push({key:"A",data:[...h]}),t=h[5],s=h[6];break;case"a":t+=h[5],s+=h[6],o.push({key:"A",data:[h[0],h[1],h[2],h[3],h[4],t,s]});break;case"H":o.push({key:"H",data:[...h]}),t=h[0];break;case"h":t+=h[0],o.push({key:"H",data:[t]});break;case"V":o.push({key:"V",data:[...h]}),s=h[0];break;case"v":s+=h[0],o.push({key:"V",data:[s]});break;case"S":o.push({key:"S",data:[...h]}),t=h[2],s=h[3];break;case"s":{let i=h.map((l,c)=>c%2?l+s:l+t);o.push({key:"S",data:i}),t=i[2],s=i[3];break}case"T":o.push({key:"T",data:[...h]}),t=h[0],s=h[1];break;case"t":t+=h[0],s+=h[1],o.push({key:"T",data:[t,s]});break;case"Z":case"z":o.push({key:"Z",data:[]}),t=e,s=n}return o}function Tt(a){let t=[],s="",e=0,n=0,o=0,r=0,h=0,i=0;for(let{key:l,data:c}of a){switch(l){case"M":t.push({key:"M",data:[...c]}),[e,n]=c,[o,r]=c;break;case"C":t.push({key:"C",data:[...c]}),e=c[4],n=c[5],h=c[2],i=c[3];break;case"L":t.push({key:"L",data:[...c]}),[e,n]=c;break;case"H":e=c[0],t.push({key:"L",data:[e,n]});break;case"V":n=c[0],t.push({key:"L",data:[e,n]});break;case"S":{let d=0,p=0;s==="C"||s==="S"?(d=e+(e-h),p=n+(n-i)):(d=e,p=n),t.push({key:"C",data:[d,p,...c]}),h=c[0],i=c[1],e=c[2],n=c[3];break}case"T":{let[d,p]=c,u=0,f=0;s==="Q"||s==="T"?(u=e+(e-h),f=n+(n-i)):(u=e,f=n);let g=e+2*(u-e)/3,k=n+2*(f-n)/3,m=d+2*(u-d)/3,M=p+2*(f-p)/3;t.push({key:"C",data:[g,k,m,M,d,p]}),h=u,i=f,e=d,n=p;break}case"Q":{let[d,p,u,f]=c,g=e+2*(d-e)/3,k=n+2*(p-n)/3,m=u+2*(d-u)/3,M=f+2*(p-f)/3;t.push({key:"C",data:[g,k,m,M,u,f]}),h=d,i=p,e=u,n=f;break}case"A":{let d=Math.abs(c[0]),p=Math.abs(c[1]),u=c[2],f=c[3],g=c[4],k=c[5],m=c[6];d===0||p===0?(t.push({key:"C",data:[e,n,k,m,k,m]}),e=k,n=m):(e!==k||n!==m)&&(Dt(e,n,k,m,d,p,u,f,g).forEach(function(M){t.push({key:"C",data:M})}),e=k,n=m);break}case"Z":t.push({key:"Z",data:[]}),e=o,n=r}s=l}return t}function $(a,t,s){return[a*Math.cos(s)-t*Math.sin(s),a*Math.sin(s)+t*Math.cos(s)]}function Dt(a,t,s,e,n,o,r,h,i,l){let c=(d=r,Math.PI*d/180);var d;let p=[],u=0,f=0,g=0,k=0;if(l)[u,f,g,k]=l;else{[a,t]=$(a,t,-c),[s,e]=$(s,e,-c);let T=(a-s)/2,v=(t-e)/2,A=T*T/(n*n)+v*v/(o*o);A>1&&(A=Math.sqrt(A),n*=A,o*=A);let z=n*n,E=o*o,Wt=z*E-z*v*v-E*T*T,zt=z*v*v+E*T*T,mt=(h===i?-1:1)*Math.sqrt(Math.abs(Wt/zt));g=mt*n*v/o+(a+s)/2,k=mt*-o*T/n+(t+e)/2,u=Math.asin(parseFloat(((t-k)/o).toFixed(9))),f=Math.asin(parseFloat(((e-k)/o).toFixed(9))),af&&(u-=2*Math.PI),!i&&f>u&&(f-=2*Math.PI)}let m=f-u;if(Math.abs(m)>120*Math.PI/180){let T=f,v=s,A=e;f=i&&f>u?u+120*Math.PI/180*1:u+120*Math.PI/180*-1,p=Dt(s=g+n*Math.cos(f),e=k+o*Math.sin(f),v,A,n,o,r,0,i,[f,T,g,k])}m=f-u;let M=Math.cos(u),y=Math.sin(u),x=Math.cos(f),w=Math.sin(f),P=Math.tan(m/4),L=4/3*n*P,C=4/3*o*P,F=[a,t],D=[a+L*y,t-C*M],I=[s+L*w,e-C*x],kt=[s,e];if(D[0]=2*F[0]-D[0],D[1]=2*F[1]-D[1],l)return[D,I,kt].concat(p);{p=[D,I,kt].concat(p);let T=[];for(let v=0;v2){let n=[];for(let o=0;o2*Math.PI&&(u=0,f=2*Math.PI);let g=2*Math.PI/i.curveStepCount,k=Math.min(g/2,(f-u)/2),m=St(k,l,c,d,p,u,f,1,i);if(!i.disableMultiStroke){let M=St(k,l,c,d,p,u,f,1.5,i);m.push(...M)}return r&&(h?m.push(..._(l,c,l+d*Math.cos(u),c+p*Math.sin(u),i),..._(l,c,l+d*Math.cos(f),c+p*Math.sin(f),i)):m.push({op:"lineTo",data:[l,c]},{op:"lineTo",data:[l+d*Math.cos(u),c+p*Math.sin(u)]})),{type:"path",ops:m}}function wt(a,t){let s=Tt(Lt(Mt(a))),e=[],n=[0,0],o=[0,0];for(let{key:r,data:h}of s)switch(r){case"M":o=[h[0],h[1]],n=[h[0],h[1]];break;case"L":e.push(..._(o[0],o[1],h[0],h[1],t)),o=[h[0],h[1]];break;case"C":{let[i,l,c,d,p,u]=h;e.push(...qt(i,l,c,d,p,u,o,t)),o=[p,u];break}case"Z":e.push(..._(o[0],o[1],n[0],n[1],t)),o=[n[0],n[1]]}return{type:"path",ops:e}}function nt(a,t){let s=[];for(let e of a)if(e.length){let n=t.maxRandomnessOffset||0,o=e.length;if(o>2){s.push({op:"move",data:[e[0][0]+b(n,t),e[0][1]+b(n,t)]});for(let r=1;r500?.4:-.0016668*i+1.233334;let c=n.maxRandomnessOffset||0;c*c*100>h&&(c=i/10);let d=c/2,p=.2+.2*_t(n),u=n.bowing*n.maxRandomnessOffset*(e-t)/200,f=n.bowing*n.maxRandomnessOffset*(a-s)/200;u=b(u,n,l),f=b(f,n,l);let g=[],k=()=>b(d,n,l),m=()=>b(c,n,l),M=n.preserveVertices;return o&&(r?g.push({op:"move",data:[a+(M?0:k()),t+(M?0:k())]}):g.push({op:"move",data:[a+(M?0:b(c,n,l)),t+(M?0:b(c,n,l))]})),r?g.push({op:"bcurveTo",data:[u+a+(s-a)*p+k(),f+t+(e-t)*p+k(),u+a+2*(s-a)*p+k(),f+t+2*(e-t)*p+k(),s+(M?0:k()),e+(M?0:k())]}):g.push({op:"bcurveTo",data:[u+a+(s-a)*p+m(),f+t+(e-t)*p+m(),u+a+2*(s-a)*p+m(),f+t+2*(e-t)*p+m(),s+(M?0:m()),e+(M?0:m())]}),g}function Z(a,t,s){if(!a.length)return[];let e=[];e.push([a[0][0]+b(t,s),a[0][1]+b(t,s)]),e.push([a[0][0]+b(t,s),a[0][1]+b(t,s)]);for(let n=1;n3){let o=[],r=1-s.curveTightness;n.push({op:"move",data:[a[1][0],a[1][1]]});for(let h=1;h+21&&n.push(h)):n.push(h),n.push(a[t+3])}else{let i=a[t+0],l=a[t+1],c=a[t+2],d=a[t+3],p=W(i,l,.5),u=W(l,c,.5),f=W(c,d,.5),g=W(p,u,.5),k=W(u,f,.5),m=W(g,k,.5);ft([i,p,g,m],0,s,n),ft([m,k,f,d],0,s,n)}var o,r;return n}function Ft(a,t){return U(a,0,a.length,t)}function U(a,t,s,e,n){let o=n||[],r=a[t],h=a[s-1],i=0,l=1;for(let c=t+1;ci&&(i=d,l=c)}return Math.sqrt(i)>e?(U(a,t,l+1,e,o),U(a,l,s,e,o)):(o.length||o.push(r),o.push(h)),o}function at(a,t=.15,s){let e=[],n=(a.length-1)/3;for(let o=0;o0?U(e,0,e.length,s):e}var O="none",R=class{constructor(t){this.defaultOptions={maxRandomnessOffset:2,roughness:1,bowing:1,stroke:"#000",strokeWidth:1,curveTightness:0,curveFitting:.95,curveStepCount:9,fillStyle:"hachure",fillWeight:-1,hachureAngle:-41,hachureGap:-1,dashOffset:-1,dashGap:-1,zigzagOffset:-1,seed:0,disableMultiStroke:!1,disableMultiStrokeFill:!1,preserveVertices:!1,fillShapeRoughnessGain:.8},this.config=t||{},this.config.options&&(this.defaultOptions=this._o(this.config.options))}static newSeed(){return Math.floor(Math.random()*2**31)}_o(t){return t?Object.assign({},this.defaultOptions,t):this.defaultOptions}_d(t,s,e){return{shape:t,sets:s||[],options:e||this.defaultOptions}}line(t,s,e,n,o){let r=this._o(o);return this._d("line",[Ct(t,s,e,n,r)],r)}rectangle(t,s,e,n,o){let r=this._o(o),h=[],i=jt(t,s,e,n,r);if(r.fill){let l=[[t,s],[t+e,s],[t+e,s+n],[t,s+n]];r.fillStyle==="solid"?h.push(nt([l],r)):h.push(G([l],r))}return r.stroke!==O&&h.push(i),this._d("rectangle",h,r)}ellipse(t,s,e,n,o){let r=this._o(o),h=[],i=At(e,n,r),l=ut(t,s,r,i);if(r.fill)if(r.fillStyle==="solid"){let c=ut(t,s,r,i).opset;c.type="fillPath",h.push(c)}else h.push(G([l.estimatedPoints],r));return r.stroke!==O&&h.push(l.opset),this._d("ellipse",h,r)}circle(t,s,e,n){let o=this.ellipse(t,s,e,e,n);return o.shape="circle",o}linearPath(t,s){let e=this._o(s);return this._d("linearPath",[H(t,!1,e)],e)}arc(t,s,e,n,o,r,h=!1,i){let l=this._o(i),c=[],d=Pt(t,s,e,n,o,r,h,!0,l);if(h&&l.fill)if(l.fillStyle==="solid"){let p=Object.assign({},l);p.disableMultiStroke=!0;let u=Pt(t,s,e,n,o,r,!0,!1,p);u.type="fillPath",c.push(u)}else c.push(function(p,u,f,g,k,m,M){let y=p,x=u,w=Math.abs(f/2),P=Math.abs(g/2);w+=b(.01*w,M),P+=b(.01*P,M);let L=k,C=m;for(;L<0;)L+=2*Math.PI,C+=2*Math.PI;C-L>2*Math.PI&&(L=0,C=2*Math.PI);let F=(C-L)/M.curveStepCount,D=[];for(let I=L;I<=C;I+=F)D.push([y+w*Math.cos(I),x+P*Math.sin(I)]);return D.push([y+w*Math.cos(C),x+P*Math.sin(C)]),D.push([y,x]),G([D],M)}(t,s,e,n,o,r,l));return l.stroke!==O&&c.push(d),this._d("arc",c,l)}curve(t,s){let e=this._o(s),n=[],o=yt(t,e);if(e.fill&&e.fill!==O)if(e.fillStyle==="solid"){let r=yt(t,Object.assign(Object.assign({},e),{disableMultiStroke:!0,roughness:e.roughness?e.roughness+e.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(r.ops)})}else{let r=[],h=t;if(h.length){let i=typeof h[0][0]=="number"?[h]:h;for(let l of i)l.length<3?r.push(...l):l.length===3?r.push(...at(Ot([l[0],l[0],l[1],l[2]]),10,(1+e.roughness)/2)):r.push(...at(Ot(l),10,(1+e.roughness)/2))}r.length&&n.push(G([r],e))}return e.stroke!==O&&n.push(o),this._d("curve",n,e)}polygon(t,s){let e=this._o(s),n=[],o=H(t,!0,e);return e.fill&&(e.fillStyle==="solid"?n.push(nt([t],e)):n.push(G([t],e))),e.stroke!==O&&n.push(o),this._d("polygon",n,e)}path(t,s){let e=this._o(s),n=[];if(!t)return this._d("path",n,e);t=(t||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let o=e.fill&&e.fill!=="transparent"&&e.fill!==O,r=e.stroke!==O,h=!!(e.simplification&&e.simplification<1),i=function(c,d,p){let u=Tt(Lt(Mt(c))),f=[],g=[],k=[0,0],m=[],M=()=>{m.length>=4&&g.push(...at(m,d)),m=[]},y=()=>{M(),g.length&&(f.push(g),g=[])};for(let{key:w,data:P}of u)switch(w){case"M":y(),k=[P[0],P[1]],g.push(k);break;case"L":M(),g.push([P[0],P[1]]);break;case"C":if(!m.length){let L=g.length?g[g.length-1]:k;m.push([L[0],L[1]])}m.push([P[0],P[1]]),m.push([P[2],P[3]]),m.push([P[4],P[5]]);break;case"Z":M(),g.push([k[0],k[1]])}if(y(),!p)return f;let x=[];for(let w of f){let P=Ft(w,p);P.length&&x.push(P)}return x}(t,1,h?4-4*(e.simplification||1):(1+e.roughness)/2),l=wt(t,e);if(o)if(e.fillStyle==="solid")if(i.length===1){let c=wt(t,Object.assign(Object.assign({},e),{disableMultiStroke:!0,roughness:e.roughness?e.roughness+e.fillShapeRoughnessGain:0}));n.push({type:"fillPath",ops:this._mergedShape(c.ops)})}else n.push(nt(i,e));else n.push(G(i,e));return r&&(h?i.forEach(c=>{n.push(H(c,!1,e))}):n.push(l)),this._d("path",n,e)}opsToPath(t,s){let e="";for(let n of t.ops){let o=typeof s=="number"&&s>=0?n.data.map(r=>+r.toFixed(s)):n.data;switch(n.op){case"move":e+=`M${o[0]} ${o[1]} `;break;case"bcurveTo":e+=`C${o[0]} ${o[1]}, ${o[2]} ${o[3]}, ${o[4]} ${o[5]} `;break;case"lineTo":e+=`L${o[0]} ${o[1]} `}}return e.trim()}toPaths(t){let s=t.sets||[],e=t.options||this.defaultOptions,n=[];for(let o of s){let r=null;switch(o.type){case"path":r={d:this.opsToPath(o),stroke:e.stroke,strokeWidth:e.strokeWidth,fill:O};break;case"fillPath":r={d:this.opsToPath(o),stroke:O,strokeWidth:0,fill:e.fill||O};break;case"fillSketch":r=this.fillSketch(o,e)}r&&n.push(r)}return n}fillSketch(t,s){let e=s.fillWeight;return e<0&&(e=s.strokeWidth/2),{d:this.opsToPath(t),stroke:s.fill||O,strokeWidth:e,fill:O}}_mergedShape(t){return t.filter((s,e)=>e===0||s.op!=="move")}},dt=class{constructor(t,s){this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.gen=new R(s)}draw(t){let s=t.sets||[],e=t.options||this.getDefaultOptions(),n=this.ctx,o=t.options.fixedDecimalPlaceDigits;for(let r of s)switch(r.type){case"path":n.save(),n.strokeStyle=e.stroke==="none"?"transparent":e.stroke,n.lineWidth=e.strokeWidth,e.strokeLineDash&&n.setLineDash(e.strokeLineDash),e.strokeLineDashOffset&&(n.lineDashOffset=e.strokeLineDashOffset),this._drawToContext(n,r,o),n.restore();break;case"fillPath":{n.save(),n.fillStyle=e.fill||"";let h=t.shape==="curve"||t.shape==="polygon"||t.shape==="path"?"evenodd":"nonzero";this._drawToContext(n,r,o,h),n.restore();break}case"fillSketch":this.fillSketch(n,r,e)}}fillSketch(t,s,e){let n=e.fillWeight;n<0&&(n=e.strokeWidth/2),t.save(),e.fillLineDash&&t.setLineDash(e.fillLineDash),e.fillLineDashOffset&&(t.lineDashOffset=e.fillLineDashOffset),t.strokeStyle=e.fill||"",t.lineWidth=n,this._drawToContext(t,s,e.fixedDecimalPlaceDigits),t.restore()}_drawToContext(t,s,e,n="nonzero"){t.beginPath();for(let o of s.ops){let r=typeof e=="number"&&e>=0?o.data.map(h=>+h.toFixed(e)):o.data;switch(o.op){case"move":t.moveTo(r[0],r[1]);break;case"bcurveTo":t.bezierCurveTo(r[0],r[1],r[2],r[3],r[4],r[5]);break;case"lineTo":t.lineTo(r[0],r[1])}}s.type==="fillPath"?t.fill(n):t.stroke()}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}line(t,s,e,n,o){let r=this.gen.line(t,s,e,n,o);return this.draw(r),r}rectangle(t,s,e,n,o){let r=this.gen.rectangle(t,s,e,n,o);return this.draw(r),r}ellipse(t,s,e,n,o){let r=this.gen.ellipse(t,s,e,n,o);return this.draw(r),r}circle(t,s,e,n){let o=this.gen.circle(t,s,e,n);return this.draw(o),o}linearPath(t,s){let e=this.gen.linearPath(t,s);return this.draw(e),e}polygon(t,s){let e=this.gen.polygon(t,s);return this.draw(e),e}arc(t,s,e,n,o,r,h=!1,i){let l=this.gen.arc(t,s,e,n,o,r,h,i);return this.draw(l),l}curve(t,s){let e=this.gen.curve(t,s);return this.draw(e),e}path(t,s){let e=this.gen.path(t,s);return this.draw(e),e}},Q="http://www.w3.org/2000/svg",gt=class{constructor(t,s){this.svg=t,this.gen=new R(s)}draw(t){let s=t.sets||[],e=t.options||this.getDefaultOptions(),n=this.svg.ownerDocument||window.document,o=n.createElementNS(Q,"g"),r=t.options.fixedDecimalPlaceDigits;for(let h of s){let i=null;switch(h.type){case"path":i=n.createElementNS(Q,"path"),i.setAttribute("d",this.opsToPath(h,r)),i.setAttribute("stroke",e.stroke),i.setAttribute("stroke-width",e.strokeWidth+""),i.setAttribute("fill","none"),e.strokeLineDash&&i.setAttribute("stroke-dasharray",e.strokeLineDash.join(" ").trim()),e.strokeLineDashOffset&&i.setAttribute("stroke-dashoffset",`${e.strokeLineDashOffset}`);break;case"fillPath":i=n.createElementNS(Q,"path"),i.setAttribute("d",this.opsToPath(h,r)),i.setAttribute("stroke","none"),i.setAttribute("stroke-width","0"),i.setAttribute("fill",e.fill||""),t.shape!=="curve"&&t.shape!=="polygon"||i.setAttribute("fill-rule","evenodd");break;case"fillSketch":i=this.fillSketch(n,h,e)}i&&o.appendChild(i)}return o}fillSketch(t,s,e){let n=e.fillWeight;n<0&&(n=e.strokeWidth/2);let o=t.createElementNS(Q,"path");return o.setAttribute("d",this.opsToPath(s,e.fixedDecimalPlaceDigits)),o.setAttribute("stroke",e.fill||""),o.setAttribute("stroke-width",n+""),o.setAttribute("fill","none"),e.fillLineDash&&o.setAttribute("stroke-dasharray",e.fillLineDash.join(" ").trim()),e.fillLineDashOffset&&o.setAttribute("stroke-dashoffset",`${e.fillLineDashOffset}`),o}get generator(){return this.gen}getDefaultOptions(){return this.gen.defaultOptions}opsToPath(t,s){return this.gen.opsToPath(t,s)}line(t,s,e,n,o){let r=this.gen.line(t,s,e,n,o);return this.draw(r)}rectangle(t,s,e,n,o){let r=this.gen.rectangle(t,s,e,n,o);return this.draw(r)}ellipse(t,s,e,n,o){let r=this.gen.ellipse(t,s,e,n,o);return this.draw(r)}circle(t,s,e,n){let o=this.gen.circle(t,s,e,n);return this.draw(o)}linearPath(t,s){let e=this.gen.linearPath(t,s);return this.draw(e)}polygon(t,s){let e=this.gen.polygon(t,s);return this.draw(e)}arc(t,s,e,n,o,r,h=!1,i){let l=this.gen.arc(t,s,e,n,o,r,h,i);return this.draw(l)}curve(t,s){let e=this.gen.curve(t,s);return this.draw(e)}path(t,s){let e=this.gen.path(t,s);return this.draw(e)}},It={canvas:(a,t)=>new dt(a,t),svg:(a,t)=>new gt(a,t),generator:a=>new R(a),newSeed:()=>R.newSeed()};var Y=class{constructor(t){this.opt=t,this.mindMap=t.mindMap,this.rc=It.svg(this.mindMap.svg.node),this.style={fill:"inherit",fillStyle:"solid",stroke:"inherit",strokeWidth:"inherit"},this.init()}init(){this.createPath=this.createPath.bind(this),this.createPolygon=this.createPolygon.bind(this),this.transformPath=this.transformPath.bind(this),this.mindMap.updateConfig({customCreateNodePath:this.createPath,customCreateNodePolygon:this.createPolygon,customTransformNodeLinePath:this.transformPath})}createPath(t){return this.rc.path(t,{...this.style})}createPolygon(t){return this.rc.polygon(t,{...this.style})}transformPath(t){return this.rc.path(t).getElementsByTagName("path")[0].getAttribute("d")}reset(){this.mindMap.updateConfig({customCreateNodePath:null,customCreateNodePolygon:null,customTransformNodeLinePath:null})}beforePluginRemove(){this.reset()}beforePluginDestroy(){this.reset()}};Y.instanceName="handDrawnLikeStyle";var Qt=Y;export{Qt as default}; diff --git a/src/options/views/settings/Sites/Index.vue b/src/options/views/settings/Sites/Index.vue index 262f90329..af22eec84 100644 --- a/src/options/views/settings/Sites/Index.vue +++ b/src/options/views/settings/Sites/Index.vue @@ -46,6 +46,12 @@ {{$t('settings.sites.index.resetFavicons')}} + + + account_tree + {{$t('settings.sites.index.ptMindMap')}} + +