@leafer-in/arrow 1.1.2 → 1.2.0

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.
package/dist/arrow.cjs CHANGED
@@ -290,6 +290,7 @@ function arrowType(defaultValue) {
290
290
  }));
291
291
  }
292
292
 
293
+ draw.Plugin.add('arrow');
293
294
  const ui = draw.UI.prototype;
294
295
  arrowType('none')(ui, 'startArrow');
295
296
  arrowType('none')(ui, 'endArrow');
package/dist/arrow.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { LineData, dataProcessor, strokeType, registerUI, Line, PathCommandMap, PointHelper, DataHelper, decorateLeafAttr, attr, doStrokeType, UI, PathArrow } from '@leafer-ui/draw';
1
+ import { LineData, dataProcessor, strokeType, registerUI, Line, PathCommandMap, PointHelper, DataHelper, decorateLeafAttr, attr, doStrokeType, Plugin, UI, PathArrow } from '@leafer-ui/draw';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -288,6 +288,7 @@ function arrowType(defaultValue) {
288
288
  }));
289
289
  }
290
290
 
291
+ Plugin.add('arrow');
291
292
  const ui = UI.prototype;
292
293
  arrowType('none')(ui, 'startArrow');
293
294
  arrowType('none')(ui, 'endArrow');
@@ -1 +1 @@
1
- import{LineData as e,dataProcessor as t,strokeType as o,registerUI as r,Line as n,PathCommandMap as a,PointHelper as s,DataHelper as c,decorateLeafAttr as i,attr as p,doStrokeType as h,UI as f,PathArrow as l}from"@leafer-ui/draw";function u(e,t,o,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(a<3?n(s):a>3?n(t,o,s):n(t,o))||s);return a>3&&s&&Object.defineProperty(t,o,s),s}"function"==typeof SuppressedError&&SuppressedError;class d extends e{}let b=class extends n{get __tag(){return"Arrow"}constructor(e){super(e),this.__.__useArrow=!0}};u([t(d)],b.prototype,"__",void 0),u([o("angle")],b.prototype,"endArrow",void 0),b=u([r()],b);const{M:_,L:x,C:k,Q:y,O:w}=a,{rotate:g,copyFrom:A,scale:J}=s,v={},P={layout(e,t,o,r,n,a,s){let c,i,p=0,h=e.length;for(;p<h;)switch(c=e[p],c){case _:case x:m(e,p+1,t,o,r,n,a,s),p+=3;break;case k:for(i=1;i<6;i+=2)m(e,p+i,t,o,r,n,a,s);p+=7;break;case y:for(i=1;i<4;i+=2)m(e,p+i,t,o,r,n,a,s);p+=5;break;case w:e[p+1]+=t,e[p+2]+=o,r&&(e[p+3]*=r),a&&(e[p+4]+=a,e[p+5]+=a),p+=7}},rotate(e,t,o){P.layout(e,0,0,1,1,t,o)}};function m(e,t,o,r,n,a,s,c){A(v,e[t],e[t+1]),s&&g(v,s,c),n&&J(v,n,a),e[t]=o+v.x,e[t+1]=r+v.y}const{layout:F,rotate:O}=P,{getAngle:j}=s,R={x:-.5},C={connect:R,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},D={connect:R,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},q={connect:R,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},E={connect:R,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},L={offset:R,path:[...q.path],dashPath:[1,-2.5,0,2,-1,0]};O(L.path,180,{x:-1.5,y:0});const M={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},Q={connect:{x:.5},path:[...M.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},S={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},G={path:[...S.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},N=c.clone(S),U=c.clone(G);O(N.path,45),O(U.path,45);const W={angle:C,"angle-side":D,arrow:E,triangle:q,"triangle-flip":L,circle:Q,"circle-line":M,square:G,"square-line":S,diamond:U,"diamond-line":N,mark:{offset:R,path:[1,0,-2,2,0,2]}};function X(e,t,o,r,n,a,s){const{strokeCap:c,strokeJoin:i}=e.__,{offset:p,connect:h,path:f,dashPath:l}="object"==typeof t?t:W[t];let u=h?h.x:0,d=p?p.x:0;const b=[...f];return s&&l&&b.push(...l),"none"!==c&&(u-=.5),p&&("round"===i&&p.roundJoin?d+=p.roundJoin:"bevel"===i&&p.bevelJoin&&(d+=p.bevelJoin)),d&&F(b,d,0),F(b,r.x,r.y,n,n,j(o,r)),a.x=(u+d)*n,b}const{M:Z,L:z,C:B,Q:H,Z:I,N:K,D:T,X:V,G:Y,F:$,O:ee,P:te,U:oe}=a,{copy:re,copyFrom:ne,getDistancePoint:ae}=s,se={},ce={},ie={},pe={},he={},fe={list:W,addArrows(e,t){const{startArrow:o,endArrow:r,strokeWidth:n,dashPattern:a,__pathForRender:s}=e.__;let c,i=0,p=s.length,h=0,f=o&&"none"!==o;for(;i<p;){switch(c=s[i],c){case Z:case z:(h<2||i+6>=p)&&(ne(he,s[i+1],s[i+2]),!h&&f&&re(ce,he)),i+=3;break;case B:1!==h&&i+7!==p||le(s,pe,he,i+3),i+=7;break;case H:1!==h&&i+5!==p||le(s,pe,he,i+1),i+=5;break;case I:return;case K:i+=5;break;case T:i+=9;break;case V:i+=6;break;case Y:i+=9;break;case $:i+=5;break;case ee:i+=7;break;case te:i+=4;break;case oe:1!==h&&i+6!==p||le(s,pe,he,i+1),i+=6}if(h++,1===h&&c!==Z)return;if(2===h&&f&&re(ie,c===z?he:pe),i===p){const p=e.__.__pathForRender=t?[...s]:s,h=e.__.__pathForArrow=[];if(f){const t=X(e,o,ie,ce,n,se,!!a);a?h.push(...t):p.push(...t),se.x&&(ae(ce,ie,-se.x,!0),p[1]=ie.x,p[2]=ie.y)}if(r&&"none"!==r){const t=X(e,r,pe,he,n,se,!!a);if(a?h.push(...t):p.push(...t),se.x){let e;switch(ae(he,pe,-se.x,!0),c){case z:e=i-3+1;break;case B:e=i-7+5;break;case H:e=i-5+3;break;case oe:e=i-6+3}e&&ue(p,pe,e)}}}else re(pe,he)}}};function le(e,t,o,r){ne(t,e[r],e[r+1]),ne(o,e[r+2],e[r+3])}function ue(e,t,o){e[o]=t.x,e[o+1]=t.y}function de(e){return i(e,(e=>p({set(t){if(this.__setAttr(e,t)){const e=this.__;e.__useArrow="none"!==e.startArrow||"none"!==e.endArrow,h(this)}}})))}const be=f.prototype;de("none")(be,"startArrow"),de("none")(be,"endArrow"),Object.assign(l,fe);export{b as Arrow,d as ArrowData,fe as PathArrowModule,P as PathMatrixHelper,de as arrowType};
1
+ import{LineData as e,dataProcessor as t,strokeType as o,registerUI as r,Line as n,PathCommandMap as a,PointHelper as s,DataHelper as c,decorateLeafAttr as i,attr as p,doStrokeType as h,Plugin as f,UI as l,PathArrow as d}from"@leafer-ui/draw";function u(e,t,o,r){var n,a=arguments.length,s=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(a<3?n(s):a>3?n(t,o,s):n(t,o))||s);return a>3&&s&&Object.defineProperty(t,o,s),s}"function"==typeof SuppressedError&&SuppressedError;class b extends e{}let _=class extends n{get __tag(){return"Arrow"}constructor(e){super(e),this.__.__useArrow=!0}};u([t(b)],_.prototype,"__",void 0),u([o("angle")],_.prototype,"endArrow",void 0),_=u([r()],_);const{M:x,L:k,C:y,Q:w,O:g}=a,{rotate:A,copyFrom:J,scale:v}=s,P={},m={layout(e,t,o,r,n,a,s){let c,i,p=0,h=e.length;for(;p<h;)switch(c=e[p],c){case x:case k:F(e,p+1,t,o,r,n,a,s),p+=3;break;case y:for(i=1;i<6;i+=2)F(e,p+i,t,o,r,n,a,s);p+=7;break;case w:for(i=1;i<4;i+=2)F(e,p+i,t,o,r,n,a,s);p+=5;break;case g:e[p+1]+=t,e[p+2]+=o,r&&(e[p+3]*=r),a&&(e[p+4]+=a,e[p+5]+=a),p+=7}},rotate(e,t,o){m.layout(e,0,0,1,1,t,o)}};function F(e,t,o,r,n,a,s,c){J(P,e[t],e[t+1]),s&&A(P,s,c),n&&v(P,n,a),e[t]=o+P.x,e[t+1]=r+P.y}const{layout:O,rotate:j}=m,{getAngle:R}=s,C={x:-.5},D={connect:C,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},q={connect:C,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},E={connect:C,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},L={connect:C,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},M={offset:C,path:[...E.path],dashPath:[1,-2.5,0,2,-1,0]};j(M.path,180,{x:-1.5,y:0});const Q={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},S={connect:{x:.5},path:[...Q.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},G={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},N={path:[...G.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},U=c.clone(G),W=c.clone(N);j(U.path,45),j(W.path,45);const X={angle:D,"angle-side":q,arrow:L,triangle:E,"triangle-flip":M,circle:S,"circle-line":Q,square:N,"square-line":G,diamond:W,"diamond-line":U,mark:{offset:C,path:[1,0,-2,2,0,2]}};function Z(e,t,o,r,n,a,s){const{strokeCap:c,strokeJoin:i}=e.__,{offset:p,connect:h,path:f,dashPath:l}="object"==typeof t?t:X[t];let d=h?h.x:0,u=p?p.x:0;const b=[...f];return s&&l&&b.push(...l),"none"!==c&&(d-=.5),p&&("round"===i&&p.roundJoin?u+=p.roundJoin:"bevel"===i&&p.bevelJoin&&(u+=p.bevelJoin)),u&&O(b,u,0),O(b,r.x,r.y,n,n,R(o,r)),a.x=(d+u)*n,b}const{M:z,L:B,C:H,Q:I,Z:K,N:T,D:V,X:Y,G:$,F:ee,O:te,P:oe,U:re}=a,{copy:ne,copyFrom:ae,getDistancePoint:se}=s,ce={},ie={},pe={},he={},fe={},le={list:X,addArrows(e,t){const{startArrow:o,endArrow:r,strokeWidth:n,dashPattern:a,__pathForRender:s}=e.__;let c,i=0,p=s.length,h=0,f=o&&"none"!==o;for(;i<p;){switch(c=s[i],c){case z:case B:(h<2||i+6>=p)&&(ae(fe,s[i+1],s[i+2]),!h&&f&&ne(ie,fe)),i+=3;break;case H:1!==h&&i+7!==p||de(s,he,fe,i+3),i+=7;break;case I:1!==h&&i+5!==p||de(s,he,fe,i+1),i+=5;break;case K:return;case T:i+=5;break;case V:i+=9;break;case Y:i+=6;break;case $:i+=9;break;case ee:i+=5;break;case te:i+=7;break;case oe:i+=4;break;case re:1!==h&&i+6!==p||de(s,he,fe,i+1),i+=6}if(h++,1===h&&c!==z)return;if(2===h&&f&&ne(pe,c===B?fe:he),i===p){const p=e.__.__pathForRender=t?[...s]:s,h=e.__.__pathForArrow=[];if(f){const t=Z(e,o,pe,ie,n,ce,!!a);a?h.push(...t):p.push(...t),ce.x&&(se(ie,pe,-ce.x,!0),p[1]=pe.x,p[2]=pe.y)}if(r&&"none"!==r){const t=Z(e,r,he,fe,n,ce,!!a);if(a?h.push(...t):p.push(...t),ce.x){let e;switch(se(fe,he,-ce.x,!0),c){case B:e=i-3+1;break;case H:e=i-7+5;break;case I:e=i-5+3;break;case re:e=i-6+3}e&&ue(p,he,e)}}}else ne(he,fe)}}};function de(e,t,o,r){ae(t,e[r],e[r+1]),ae(o,e[r+2],e[r+3])}function ue(e,t,o){e[o]=t.x,e[o+1]=t.y}function be(e){return i(e,(e=>p({set(t){if(this.__setAttr(e,t)){const e=this.__;e.__useArrow="none"!==e.startArrow||"none"!==e.endArrow,h(this)}}})))}f.add("arrow");const _e=l.prototype;be("none")(_e,"startArrow"),be("none")(_e,"endArrow"),Object.assign(d,le);export{_ as Arrow,b as ArrowData,le as PathArrowModule,m as PathMatrixHelper,be as arrowType};
package/dist/arrow.js CHANGED
@@ -290,6 +290,7 @@ this.LeaferIN.arrow = (function (exports, draw) {
290
290
  }));
291
291
  }
292
292
 
293
+ draw.Plugin.add('arrow');
293
294
  const ui = draw.UI.prototype;
294
295
  arrowType('none')(ui, 'startArrow');
295
296
  arrowType('none')(ui, 'endArrow');
@@ -1 +1 @@
1
- "use strict";var e=require("@leafer-ui/draw");function t(e,t,r,o){var a,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(n<3?a(s):n>3?a(t,r,s):a(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s}"function"==typeof SuppressedError&&SuppressedError;class r extends e.LineData{}exports.Arrow=class extends e.Line{get __tag(){return"Arrow"}constructor(e){super(e),this.__.__useArrow=!0}},t([e.dataProcessor(r)],exports.Arrow.prototype,"__",void 0),t([e.strokeType("angle")],exports.Arrow.prototype,"endArrow",void 0),exports.Arrow=t([e.registerUI()],exports.Arrow);const{M:o,L:a,C:n,Q:s,O:c}=e.PathCommandMap,{rotate:p,copyFrom:i,scale:h}=e.PointHelper,l={},f={layout(e,t,r,p,i,h,l){let f,u,x=0,b=e.length;for(;x<b;)switch(f=e[x],f){case o:case a:d(e,x+1,t,r,p,i,h,l),x+=3;break;case n:for(u=1;u<6;u+=2)d(e,x+u,t,r,p,i,h,l);x+=7;break;case s:for(u=1;u<4;u+=2)d(e,x+u,t,r,p,i,h,l);x+=5;break;case c:e[x+1]+=t,e[x+2]+=r,p&&(e[x+3]*=p),h&&(e[x+4]+=h,e[x+5]+=h),x+=7}},rotate(e,t,r){f.layout(e,0,0,1,1,t,r)}};function d(e,t,r,o,a,n,s,c){i(l,e[t],e[t+1]),s&&p(l,s,c),a&&h(l,a,n),e[t]=r+l.x,e[t+1]=o+l.y}const{layout:u,rotate:x}=f,{getAngle:b}=e.PointHelper,_={x:-.5},w={connect:_,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},y={connect:_,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},A={connect:_,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},k={connect:_,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},P={offset:_,path:[...A.path],dashPath:[1,-2.5,0,2,-1,0]};x(P.path,180,{x:-1.5,y:0});const g={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},J={connect:{x:.5},path:[...g.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},v={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},m={path:[...v.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},D=e.DataHelper.clone(v),F=e.DataHelper.clone(m);x(D.path,45),x(F.path,45);const H={angle:w,"angle-side":y,arrow:k,triangle:A,"triangle-flip":P,circle:J,"circle-line":g,square:m,"square-line":v,diamond:F,"diamond-line":D,mark:{offset:_,path:[1,0,-2,2,0,2]}};function M(e,t,r,o,a,n,s){const{strokeCap:c,strokeJoin:p}=e.__,{offset:i,connect:h,path:l,dashPath:f}="object"==typeof t?t:H[t];let d=h?h.x:0,x=i?i.x:0;const _=[...l];return s&&f&&_.push(...f),"none"!==c&&(d-=.5),i&&("round"===p&&i.roundJoin?x+=i.roundJoin:"bevel"===p&&i.bevelJoin&&(x+=i.bevelJoin)),x&&u(_,x,0),u(_,o.x,o.y,a,a,b(r,o)),n.x=(d+x)*a,_}const{M:O,L:j,C:C,Q:L,Z:R,N:q,D:S,X:T,G:U,F:E,O:I,P:Q,U:G}=e.PathCommandMap,{copy:N,copyFrom:W,getDistancePoint:X}=e.PointHelper,Z={},z={},B={},K={},V={},Y={list:H,addArrows(e,t){const{startArrow:r,endArrow:o,strokeWidth:a,dashPattern:n,__pathForRender:s}=e.__;let c,p=0,i=s.length,h=0,l=r&&"none"!==r;for(;p<i;){switch(c=s[p],c){case O:case j:(h<2||p+6>=i)&&(W(V,s[p+1],s[p+2]),!h&&l&&N(z,V)),p+=3;break;case C:1!==h&&p+7!==i||$(s,K,V,p+3),p+=7;break;case L:1!==h&&p+5!==i||$(s,K,V,p+1),p+=5;break;case R:return;case q:p+=5;break;case S:p+=9;break;case T:p+=6;break;case U:p+=9;break;case E:p+=5;break;case I:p+=7;break;case Q:p+=4;break;case G:1!==h&&p+6!==i||$(s,K,V,p+1),p+=6}if(h++,1===h&&c!==O)return;if(2===h&&l&&N(B,c===j?V:K),p===i){const i=e.__.__pathForRender=t?[...s]:s,h=e.__.__pathForArrow=[];if(l){const t=M(e,r,B,z,a,Z,!!n);n?h.push(...t):i.push(...t),Z.x&&(X(z,B,-Z.x,!0),i[1]=B.x,i[2]=B.y)}if(o&&"none"!==o){const t=M(e,o,K,V,a,Z,!!n);if(n?h.push(...t):i.push(...t),Z.x){let e;switch(X(V,K,-Z.x,!0),c){case j:e=p-3+1;break;case C:e=p-7+5;break;case L:e=p-5+3;break;case G:e=p-6+3}e&&ee(i,K,e)}}}else N(K,V)}}};function $(e,t,r,o){W(t,e[o],e[o+1]),W(r,e[o+2],e[o+3])}function ee(e,t,r){e[r]=t.x,e[r+1]=t.y}function te(t){return e.decorateLeafAttr(t,(t=>e.attr({set(r){if(this.__setAttr(t,r)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,e.doStrokeType(this)}}})))}const re=e.UI.prototype;te("none")(re,"startArrow"),te("none")(re,"endArrow"),Object.assign(e.PathArrow,Y),exports.ArrowData=r,exports.PathArrowModule=Y,exports.PathMatrixHelper=f,exports.arrowType=te;
1
+ "use strict";var e=require("@leafer-ui/draw");function t(e,t,r,o){var a,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(n<3?a(s):n>3?a(t,r,s):a(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s}"function"==typeof SuppressedError&&SuppressedError;class r extends e.LineData{}exports.Arrow=class extends e.Line{get __tag(){return"Arrow"}constructor(e){super(e),this.__.__useArrow=!0}},t([e.dataProcessor(r)],exports.Arrow.prototype,"__",void 0),t([e.strokeType("angle")],exports.Arrow.prototype,"endArrow",void 0),exports.Arrow=t([e.registerUI()],exports.Arrow);const{M:o,L:a,C:n,Q:s,O:c}=e.PathCommandMap,{rotate:p,copyFrom:i,scale:h}=e.PointHelper,l={},d={layout(e,t,r,p,i,h,l){let d,u,x=0,b=e.length;for(;x<b;)switch(d=e[x],d){case o:case a:f(e,x+1,t,r,p,i,h,l),x+=3;break;case n:for(u=1;u<6;u+=2)f(e,x+u,t,r,p,i,h,l);x+=7;break;case s:for(u=1;u<4;u+=2)f(e,x+u,t,r,p,i,h,l);x+=5;break;case c:e[x+1]+=t,e[x+2]+=r,p&&(e[x+3]*=p),h&&(e[x+4]+=h,e[x+5]+=h),x+=7}},rotate(e,t,r){d.layout(e,0,0,1,1,t,r)}};function f(e,t,r,o,a,n,s,c){i(l,e[t],e[t+1]),s&&p(l,s,c),a&&h(l,a,n),e[t]=r+l.x,e[t+1]=o+l.y}const{layout:u,rotate:x}=d,{getAngle:b}=e.PointHelper,w={x:-.5},_={connect:w,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},y={connect:w,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},A={connect:w,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},k={connect:w,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},P={offset:w,path:[...A.path],dashPath:[1,-2.5,0,2,-1,0]};x(P.path,180,{x:-1.5,y:0});const g={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},J={connect:{x:.5},path:[...g.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},v={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},m={path:[...v.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},D=e.DataHelper.clone(v),F=e.DataHelper.clone(m);x(D.path,45),x(F.path,45);const H={angle:_,"angle-side":y,arrow:k,triangle:A,"triangle-flip":P,circle:J,"circle-line":g,square:m,"square-line":v,diamond:F,"diamond-line":D,mark:{offset:w,path:[1,0,-2,2,0,2]}};function M(e,t,r,o,a,n,s){const{strokeCap:c,strokeJoin:p}=e.__,{offset:i,connect:h,path:l,dashPath:d}="object"==typeof t?t:H[t];let f=h?h.x:0,x=i?i.x:0;const w=[...l];return s&&d&&w.push(...d),"none"!==c&&(f-=.5),i&&("round"===p&&i.roundJoin?x+=i.roundJoin:"bevel"===p&&i.bevelJoin&&(x+=i.bevelJoin)),x&&u(w,x,0),u(w,o.x,o.y,a,a,b(r,o)),n.x=(f+x)*a,w}const{M:O,L:j,C:C,Q:L,Z:R,N:q,D:S,X:T,G:U,F:E,O:I,P:Q,U:G}=e.PathCommandMap,{copy:N,copyFrom:W,getDistancePoint:X}=e.PointHelper,Z={},z={},B={},K={},V={},Y={list:H,addArrows(e,t){const{startArrow:r,endArrow:o,strokeWidth:a,dashPattern:n,__pathForRender:s}=e.__;let c,p=0,i=s.length,h=0,l=r&&"none"!==r;for(;p<i;){switch(c=s[p],c){case O:case j:(h<2||p+6>=i)&&(W(V,s[p+1],s[p+2]),!h&&l&&N(z,V)),p+=3;break;case C:1!==h&&p+7!==i||$(s,K,V,p+3),p+=7;break;case L:1!==h&&p+5!==i||$(s,K,V,p+1),p+=5;break;case R:return;case q:p+=5;break;case S:p+=9;break;case T:p+=6;break;case U:p+=9;break;case E:p+=5;break;case I:p+=7;break;case Q:p+=4;break;case G:1!==h&&p+6!==i||$(s,K,V,p+1),p+=6}if(h++,1===h&&c!==O)return;if(2===h&&l&&N(B,c===j?V:K),p===i){const i=e.__.__pathForRender=t?[...s]:s,h=e.__.__pathForArrow=[];if(l){const t=M(e,r,B,z,a,Z,!!n);n?h.push(...t):i.push(...t),Z.x&&(X(z,B,-Z.x,!0),i[1]=B.x,i[2]=B.y)}if(o&&"none"!==o){const t=M(e,o,K,V,a,Z,!!n);if(n?h.push(...t):i.push(...t),Z.x){let e;switch(X(V,K,-Z.x,!0),c){case j:e=p-3+1;break;case C:e=p-7+5;break;case L:e=p-5+3;break;case G:e=p-6+3}e&&ee(i,K,e)}}}else N(K,V)}}};function $(e,t,r,o){W(t,e[o],e[o+1]),W(r,e[o+2],e[o+3])}function ee(e,t,r){e[r]=t.x,e[r+1]=t.y}function te(t){return e.decorateLeafAttr(t,(t=>e.attr({set(r){if(this.__setAttr(t,r)){const t=this.__;t.__useArrow="none"!==t.startArrow||"none"!==t.endArrow,e.doStrokeType(this)}}})))}e.Plugin.add("arrow");const re=e.UI.prototype;te("none")(re,"startArrow"),te("none")(re,"endArrow"),Object.assign(e.PathArrow,Y),exports.ArrowData=r,exports.PathArrowModule=Y,exports.PathMatrixHelper=d,exports.arrowType=te;
package/dist/arrow.min.js CHANGED
@@ -1 +1 @@
1
- this.LeaferIN=this.LeaferIN||{},this.LeaferIN.arrow=function(e,t){"use strict";function r(e,t,r,o){var a,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(n<3?a(s):n>3?a(t,r,s):a(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s}"function"==typeof SuppressedError&&SuppressedError;class o extends t.LineData{}e.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(e){super(e),this.__.__useArrow=!0}},r([t.dataProcessor(o)],e.Arrow.prototype,"__",void 0),r([t.strokeType("angle")],e.Arrow.prototype,"endArrow",void 0),e.Arrow=r([t.registerUI()],e.Arrow);const{M:a,L:n,C:s,Q:c,O:i}=t.PathCommandMap,{rotate:p,copyFrom:h,scale:l}=t.PointHelper,f={},d={layout(e,t,r,o,p,h,l){let f,d,b=0,_=e.length;for(;b<_;)switch(f=e[b],f){case a:case n:u(e,b+1,t,r,o,p,h,l),b+=3;break;case s:for(d=1;d<6;d+=2)u(e,b+d,t,r,o,p,h,l);b+=7;break;case c:for(d=1;d<4;d+=2)u(e,b+d,t,r,o,p,h,l);b+=5;break;case i:e[b+1]+=t,e[b+2]+=r,o&&(e[b+3]*=o),h&&(e[b+4]+=h,e[b+5]+=h),b+=7}},rotate(e,t,r){d.layout(e,0,0,1,1,t,r)}};function u(e,t,r,o,a,n,s,c){h(f,e[t],e[t+1]),s&&p(f,s,c),a&&l(f,a,n),e[t]=r+f.x,e[t+1]=o+f.y}const{layout:b,rotate:_}=d,{getAngle:w}=t.PointHelper,x={x:-.5},y={connect:x,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},A={connect:x,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},k={connect:x,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},P={connect:x,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},g={offset:x,path:[...k.path],dashPath:[1,-2.5,0,2,-1,0]};_(g.path,180,{x:-1.5,y:0});const J={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},v={connect:{x:.5},path:[...J.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},m={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},L={path:[...m.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},D=t.DataHelper.clone(m),F=t.DataHelper.clone(L);_(D.path,45),_(F.path,45);const H={angle:y,"angle-side":A,arrow:P,triangle:k,"triangle-flip":g,circle:v,"circle-line":J,square:L,"square-line":m,diamond:F,"diamond-line":D,mark:{offset:x,path:[1,0,-2,2,0,2]}};function I(e,t,r,o,a,n,s){const{strokeCap:c,strokeJoin:i}=e.__,{offset:p,connect:h,path:l,dashPath:f}="object"==typeof t?t:H[t];let d=h?h.x:0,u=p?p.x:0;const _=[...l];return s&&f&&_.push(...f),"none"!==c&&(d-=.5),p&&("round"===i&&p.roundJoin?u+=p.roundJoin:"bevel"===i&&p.bevelJoin&&(u+=p.bevelJoin)),u&&b(_,u,0),b(_,o.x,o.y,a,a,w(r,o)),n.x=(d+u)*a,_}const{M:M,L:O,C:j,Q:C,Z:R,N:N,D:U,X:S,G:T,F:q,O:E,P:Q,U:G}=t.PathCommandMap,{copy:W,copyFrom:X,getDistancePoint:Z}=t.PointHelper,z={},B={},K={},V={},Y={},$={list:H,addArrows(e,t){const{startArrow:r,endArrow:o,strokeWidth:a,dashPattern:n,__pathForRender:s}=e.__;let c,i=0,p=s.length,h=0,l=r&&"none"!==r;for(;i<p;){switch(c=s[i],c){case M:case O:(h<2||i+6>=p)&&(X(Y,s[i+1],s[i+2]),!h&&l&&W(B,Y)),i+=3;break;case j:1!==h&&i+7!==p||ee(s,V,Y,i+3),i+=7;break;case C:1!==h&&i+5!==p||ee(s,V,Y,i+1),i+=5;break;case R:return;case N:i+=5;break;case U:i+=9;break;case S:i+=6;break;case T:i+=9;break;case q:i+=5;break;case E:i+=7;break;case Q:i+=4;break;case G:1!==h&&i+6!==p||ee(s,V,Y,i+1),i+=6}if(h++,1===h&&c!==M)return;if(2===h&&l&&W(K,c===O?Y:V),i===p){const p=e.__.__pathForRender=t?[...s]:s,h=e.__.__pathForArrow=[];if(l){const t=I(e,r,K,B,a,z,!!n);n?h.push(...t):p.push(...t),z.x&&(Z(B,K,-z.x,!0),p[1]=K.x,p[2]=K.y)}if(o&&"none"!==o){const t=I(e,o,V,Y,a,z,!!n);if(n?h.push(...t):p.push(...t),z.x){let e;switch(Z(Y,V,-z.x,!0),c){case O:e=i-3+1;break;case j:e=i-7+5;break;case C:e=i-5+3;break;case G:e=i-6+3}e&&te(p,V,e)}}}else W(V,Y)}}};function ee(e,t,r,o){X(t,e[o],e[o+1]),X(r,e[o+2],e[o+3])}function te(e,t,r){e[r]=t.x,e[r+1]=t.y}function re(e){return t.decorateLeafAttr(e,(e=>t.attr({set(r){if(this.__setAttr(e,r)){const e=this.__;e.__useArrow="none"!==e.startArrow||"none"!==e.endArrow,t.doStrokeType(this)}}})))}const oe=t.UI.prototype;return re("none")(oe,"startArrow"),re("none")(oe,"endArrow"),Object.assign(t.PathArrow,$),e.ArrowData=o,e.PathArrowModule=$,e.PathMatrixHelper=d,e.arrowType=re,e}({},LeaferUI);
1
+ this.LeaferIN=this.LeaferIN||{},this.LeaferIN.arrow=function(e,t){"use strict";function r(e,t,r,o){var a,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(a=e[c])&&(s=(n<3?a(s):n>3?a(t,r,s):a(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s}"function"==typeof SuppressedError&&SuppressedError;class o extends t.LineData{}e.Arrow=class extends t.Line{get __tag(){return"Arrow"}constructor(e){super(e),this.__.__useArrow=!0}},r([t.dataProcessor(o)],e.Arrow.prototype,"__",void 0),r([t.strokeType("angle")],e.Arrow.prototype,"endArrow",void 0),e.Arrow=r([t.registerUI()],e.Arrow);const{M:a,L:n,C:s,Q:c,O:i}=t.PathCommandMap,{rotate:p,copyFrom:h,scale:l}=t.PointHelper,f={},d={layout(e,t,r,o,p,h,l){let f,d,b=0,w=e.length;for(;b<w;)switch(f=e[b],f){case a:case n:u(e,b+1,t,r,o,p,h,l),b+=3;break;case s:for(d=1;d<6;d+=2)u(e,b+d,t,r,o,p,h,l);b+=7;break;case c:for(d=1;d<4;d+=2)u(e,b+d,t,r,o,p,h,l);b+=5;break;case i:e[b+1]+=t,e[b+2]+=r,o&&(e[b+3]*=o),h&&(e[b+4]+=h,e[b+5]+=h),b+=7}},rotate(e,t,r){d.layout(e,0,0,1,1,t,r)}};function u(e,t,r,o,a,n,s,c){h(f,e[t],e[t+1]),s&&p(f,s,c),a&&l(f,a,n),e[t]=r+f.x,e[t+1]=o+f.y}const{layout:b,rotate:w}=d,{getAngle:_}=t.PointHelper,x={x:-.5},y={connect:x,offset:{x:-.71,bevelJoin:.36,roundJoin:.22},path:[1,-3,-3,2,0,0,2,-3,3]},A={connect:x,offset:{x:-1.207,bevelJoin:.854,roundJoin:.707},path:[1,-3,-3,2,0,0,2,-1,0]},k={connect:x,offset:{x:-.9,bevelJoin:.624,roundJoin:.4},path:[1,-3,0,2,-3,-2,2,0,0,2,-3,2,2,-3,0,1,-2.05,1.1,2,-2.05,-1.1],dashPath:[1,-2,0,2,-.5,0]},P={connect:x,offset:{x:-1.1,bevelJoin:.872,roundJoin:.6},path:[1,-3,0,2,-3.5,-1.8,2,0,0,2,-3.5,1.8,2,-3,0,1,-2.25,.95,2,-2.25,-.95],dashPath:[1,-3,0,2,-.5,0]},g={offset:x,path:[...k.path],dashPath:[1,-2.5,0,2,-1,0]};w(g.path,180,{x:-1.5,y:0});const J={connect:{x:-1.3},path:[1,1.8,-.1,2,1.8,0,26,0,0,1.8,0,359,0]},v={connect:{x:.5},path:[...J.path,1,0,0,26,0,0,1,0,360,0],dashPath:[1,-.5,0,2,.5,0]},m={connect:{x:-1.3},path:[1,-1.4,0,2,-1.4,-1.4,2,1.4,-1.4,2,1.4,1.4,2,-1.4,1.4,2,-1.4,0]},L={path:[...m.path,2,-1.4,-.49,2,1,-.49,1,-1.4,.49,2,1,.49]},D=t.DataHelper.clone(m),F=t.DataHelper.clone(L);w(D.path,45),w(F.path,45);const H={angle:y,"angle-side":A,arrow:P,triangle:k,"triangle-flip":g,circle:v,"circle-line":J,square:L,"square-line":m,diamond:F,"diamond-line":D,mark:{offset:x,path:[1,0,-2,2,0,2]}};function I(e,t,r,o,a,n,s){const{strokeCap:c,strokeJoin:i}=e.__,{offset:p,connect:h,path:l,dashPath:f}="object"==typeof t?t:H[t];let d=h?h.x:0,u=p?p.x:0;const w=[...l];return s&&f&&w.push(...f),"none"!==c&&(d-=.5),p&&("round"===i&&p.roundJoin?u+=p.roundJoin:"bevel"===i&&p.bevelJoin&&(u+=p.bevelJoin)),u&&b(w,u,0),b(w,o.x,o.y,a,a,_(r,o)),n.x=(d+u)*a,w}const{M:M,L:O,C:j,Q:C,Z:R,N:N,D:U,X:S,G:T,F:q,O:E,P:Q,U:G}=t.PathCommandMap,{copy:W,copyFrom:X,getDistancePoint:Z}=t.PointHelper,z={},B={},K={},V={},Y={},$={list:H,addArrows(e,t){const{startArrow:r,endArrow:o,strokeWidth:a,dashPattern:n,__pathForRender:s}=e.__;let c,i=0,p=s.length,h=0,l=r&&"none"!==r;for(;i<p;){switch(c=s[i],c){case M:case O:(h<2||i+6>=p)&&(X(Y,s[i+1],s[i+2]),!h&&l&&W(B,Y)),i+=3;break;case j:1!==h&&i+7!==p||ee(s,V,Y,i+3),i+=7;break;case C:1!==h&&i+5!==p||ee(s,V,Y,i+1),i+=5;break;case R:return;case N:i+=5;break;case U:i+=9;break;case S:i+=6;break;case T:i+=9;break;case q:i+=5;break;case E:i+=7;break;case Q:i+=4;break;case G:1!==h&&i+6!==p||ee(s,V,Y,i+1),i+=6}if(h++,1===h&&c!==M)return;if(2===h&&l&&W(K,c===O?Y:V),i===p){const p=e.__.__pathForRender=t?[...s]:s,h=e.__.__pathForArrow=[];if(l){const t=I(e,r,K,B,a,z,!!n);n?h.push(...t):p.push(...t),z.x&&(Z(B,K,-z.x,!0),p[1]=K.x,p[2]=K.y)}if(o&&"none"!==o){const t=I(e,o,V,Y,a,z,!!n);if(n?h.push(...t):p.push(...t),z.x){let e;switch(Z(Y,V,-z.x,!0),c){case O:e=i-3+1;break;case j:e=i-7+5;break;case C:e=i-5+3;break;case G:e=i-6+3}e&&te(p,V,e)}}}else W(V,Y)}}};function ee(e,t,r,o){X(t,e[o],e[o+1]),X(r,e[o+2],e[o+3])}function te(e,t,r){e[r]=t.x,e[r+1]=t.y}function re(e){return t.decorateLeafAttr(e,(e=>t.attr({set(r){if(this.__setAttr(e,r)){const e=this.__;e.__useArrow="none"!==e.startArrow||"none"!==e.endArrow,t.doStrokeType(this)}}})))}t.Plugin.add("arrow");const oe=t.UI.prototype;return re("none")(oe,"startArrow"),re("none")(oe,"endArrow"),Object.assign(t.PathArrow,$),e.ArrowData=o,e.PathArrowModule=$,e.PathMatrixHelper=d,e.arrowType=re,e}({},LeaferUI);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer-in/arrow",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "@leafer-in/arrow",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -34,8 +34,8 @@
34
34
  "leaferjs"
35
35
  ],
36
36
  "peerDependencies": {
37
- "@leafer-ui/draw": "^1.1.2",
38
- "@leafer-ui/interface": "^1.1.2",
39
- "@leafer-in/interface": "^1.1.2"
37
+ "@leafer-ui/draw": "^1.2.0",
38
+ "@leafer-ui/interface": "^1.2.0",
39
+ "@leafer-in/interface": "^1.2.0"
40
40
  }
41
41
  }
package/src/index.ts CHANGED
@@ -4,11 +4,14 @@ export { PathArrowModule } from './PathArrowModule'
4
4
  export { PathMatrixHelper } from './PathMatrixHelper'
5
5
  export { arrowType } from './decorator'
6
6
 
7
- import { PathArrow, UI } from '@leafer-ui/draw'
7
+ import { PathArrow, UI, Plugin } from '@leafer-ui/draw'
8
8
  import { PathArrowModule } from './PathArrowModule'
9
9
  import { arrowType } from './decorator'
10
10
 
11
11
 
12
+ Plugin.add('arrow')
13
+
14
+
12
15
  const ui = UI.prototype
13
16
 
14
17
  // addAttr