@next-bricks/diagram 0.24.0 → 0.25.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.
Files changed (37) hide show
  1. package/dist/bricks.json +1 -1
  2. package/dist/chunks/5676.2f9e7be9.js +2 -0
  3. package/dist/chunks/5676.2f9e7be9.js.map +1 -0
  4. package/dist/chunks/{3132.ccc1512e.js → 6796.bb543bb4.js} +3 -3
  5. package/dist/chunks/6796.bb543bb4.js.map +1 -0
  6. package/dist/chunks/9260.c896737b.js +3 -0
  7. package/dist/chunks/9260.c896737b.js.map +1 -0
  8. package/dist/chunks/9560.cf6513f3.js +2 -0
  9. package/dist/chunks/9560.cf6513f3.js.map +1 -0
  10. package/dist/chunks/eo-draw-canvas.16ff8836.js +2 -0
  11. package/dist/chunks/eo-draw-canvas.16ff8836.js.map +1 -0
  12. package/dist/chunks/{main.69fedaaa.js → main.e1091d3e.js} +2 -2
  13. package/dist/chunks/{main.69fedaaa.js.map → main.e1091d3e.js.map} +1 -1
  14. package/dist/examples.json +3 -3
  15. package/dist/{index.bc7dadbe.js → index.c81a3004.js} +2 -2
  16. package/dist/{index.bc7dadbe.js.map → index.c81a3004.js.map} +1 -1
  17. package/dist/manifest.json +77 -77
  18. package/dist/types.json +13 -0
  19. package/dist-types/draw-canvas/CellComponent.d.ts +3 -2
  20. package/dist-types/draw-canvas/NodeComponent.d.ts +3 -1
  21. package/dist-types/draw-canvas/constants.d.ts +7 -0
  22. package/dist-types/draw-canvas/index.d.ts +7 -1
  23. package/dist-types/draw-canvas/interfaces.d.ts +2 -0
  24. package/dist-types/draw-canvas/processors/updateCells.d.ts +2 -1
  25. package/dist-types/draw-canvas/reducers/interfaces.d.ts +9 -1
  26. package/package.json +2 -2
  27. package/dist/chunks/3132.ccc1512e.js.map +0 -1
  28. package/dist/chunks/3664.63190754.js +0 -3
  29. package/dist/chunks/3664.63190754.js.map +0 -1
  30. package/dist/chunks/5676.194219e1.js +0 -2
  31. package/dist/chunks/5676.194219e1.js.map +0 -1
  32. package/dist/chunks/9560.c7502aca.js +0 -2
  33. package/dist/chunks/9560.c7502aca.js.map +0 -1
  34. package/dist/chunks/eo-draw-canvas.212c402d.js +0 -2
  35. package/dist/chunks/eo-draw-canvas.212c402d.js.map +0 -1
  36. /package/dist/chunks/{3132.ccc1512e.js.LICENSE.txt → 6796.bb543bb4.js.LICENSE.txt} +0 -0
  37. /package/dist/chunks/{3664.63190754.js.LICENSE.txt → 9260.c896737b.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[7364],{8752:(e,t,a)=>{a.d(t,{y:()=>i});var n=a(5600),r=a.n(n);function i(e){var t,{id:a,type:n,strokeColor:i}=e;switch(n){case"0..1":t=c;break;case"0..N":t=o;break;default:t=l}return r().createElement(t,{id:a,strokeColor:i})}function l(e){var{id:t,strokeColor:a}=e;return r().createElement("marker",{id:t,viewBox:"0 0 6 6",refX:5,refY:3,markerWidth:6,markerHeight:6,orient:"auto-start-reverse",strokeLinejoin:"round"},r().createElement("path",{d:"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z",stroke:a,strokeWidth:1,fill:a}))}function c(e){var{id:t,strokeColor:a}=e;return r().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},r().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5",stroke:a,strokeWidth:1,fill:"none"}))}function o(e){var{id:t,strokeColor:a}=e;return r().createElement("marker",{id:t,viewBox:"0 0 21 11",refX:.5,refY:5.5,markerWidth:21,markerHeight:11,orient:"auto-start-reverse"},r().createElement("path",{d:"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5",stroke:a,strokeWidth:1,fill:"none"}))}},960:(e,t,a)=>{a.d(t,{g:()=>r});var n=a(3208);function r(e,t){if(e===t||(0,n.e)(e,t,0,0))return null;var a,r,i,l,c=t.x-e.x,o=t.y-e.y,s=c>0?1:-1;if(0!==o){var u=Math.abs(c/o),d=o>0?1:-1;u<e.width/e.height?(a=e.x+u*e.height/2*s,r=e.y+e.height/2*d):(a=e.x+e.width/2*s,r=e.y+e.width/2/u*d),u<t.width/t.height?(i=t.x-u*t.height/2*s,l=t.y-t.height/2*d):(i=t.x-t.width/2*s,l=t.y-t.width/2/u*d)}else a=e.x+e.width/2*s,i=t.x-t.width/2*s,r=l=e.y;return[{x:a,y:r},{x:i,y:l}]}},3208:(e,t,a)=>{function n(e,t,a,n){var i=a?r(e,a):e,l=n?r(t,n):t,c=Math.min(i.x-i.width/2,l.x-l.width/2),o=Math.max(i.x+i.width/2,l.x+l.width/2),s=Math.min(i.y-i.height/2,l.y-l.height/2),u=Math.max(i.y+i.height/2,l.y+l.height/2);return o-c<i.width+l.width&&u-s<i.height+l.height}function r(e,t){return{x:e.x-e.width/2-t,y:e.y-e.height/2-t,width:e.width+2*t,height:e.height+2*t}}a.d(t,{e:()=>n})},3156:(e,t,a)=>{a.r(t),a.d(t,{EoDrawCanvas:()=>ge,EoDrawCanvasComponent:()=>Je});var n,r,i,l,c,o,s,u,d,h,v,f,g,p,w,m,k,x,y,b,M,C,E,W,z,N,S,T,R,B,D,L,H,P,A,U,Y,_,I,j,X,F,G,O,q,K,V,J,Q,Z,$,ee,te,ae,ne,re,ie,le,ce,oe,se,ue,de,he,ve,fe,ge,pe=a(4412),we=a(8944),me=a(123),ke=a(592),xe=a(5866),ye=a(1412),be=a(8644),Me=a(5600),Ce=a.n(Me),Ee=a(7672),We=a(8160),ze=a(4516),Ne=(a(48),a(7568)),Se=a(5248),Te=a(1920),Re=a(1252),Be=a.n(Re),De=a(3876),Le=a(8752),He=a(7181),Pe=a(4552),Ae=a(6876),Ue=a(5776),Ye=a(7584),_e=a(8044),Ie=a(7876),je=a(3788),Xe=a(2872),Fe=a(587),Ge=(0,ze.unwrapProvider)("basic.lock-body-scroll"),{defineElement:Oe,property:qe,method:Ke,event:Ve}=(0,Ee.createDecorators)(),Je=Ce().forwardRef($t);i=[Oe("eo-draw-canvas",{styleTexts:[Ye.c]})],l=qe({attribute:!1}),o=qe({attribute:!1}),u=qe({attribute:!1}),h=qe({attribute:!1}),f=qe({attribute:!1}),p=qe({type:Boolean}),m=qe({type:Boolean}),x=qe({type:Boolean}),b=qe({type:Boolean}),C=qe({attribute:!1}),W=Ve({type:"activeTarget.change"}),T=Ve({type:"node.move"}),L=Ve({type:"cell.move"}),U=Ve({type:"cell.resize"}),j=Ve({type:"node.delete"}),O=Ve({type:"cell.delete"}),J=Ve({type:"cell.contextmenu"}),ee=Ve({type:"decorator.text.change"}),re=Ve({type:"scale.change"}),oe=Ke(),se=Ke(),ue=Ke(),de=Ke(),he=Ke(),ve=Ke();var Qe=new WeakMap,Ze=new WeakMap,$e=new WeakMap,et=new WeakMap,tt=new WeakMap,at=new WeakMap,nt=new WeakMap,rt=new WeakMap,it=new WeakMap,lt=new WeakMap,ct=new WeakMap,ot=new WeakMap,st=new WeakMap,ut=new WeakMap,dt=new WeakMap,ht=new WeakMap,vt=new WeakMap,ft=new WeakMap,gt=new WeakMap,pt=new WeakMap,wt=new WeakMap,mt=new WeakMap,kt=new WeakMap,xt=new WeakMap,yt=new WeakMap,bt=new WeakMap,Mt=new WeakMap,Ct=new WeakMap,Et=new WeakMap,Wt=new WeakMap,zt=new WeakMap,Nt=new WeakMap,St=new WeakMap,Tt=new WeakMap,Rt=new WeakMap,Bt=new WeakMap,Dt=new WeakMap;class Lt extends We.ReactNextElement{constructor(){super(...arguments),(0,me.c)(this,Rt,{get:Zt,set:Qt}),(0,me.c)(this,Nt,{get:Jt,set:Vt}),(0,me.c)(this,Et,{get:Kt,set:qt}),(0,me.c)(this,bt,{get:Ot,set:Gt}),(0,me.c)(this,xt,{get:Ft,set:Xt}),(0,me.c)(this,wt,{get:jt,set:It}),(0,me.c)(this,ft,{get:_t,set:Yt}),(0,me.c)(this,ht,{get:Ut,set:At}),(0,me.c)(this,ot,{get:Pt,set:Ht}),(0,me.c)(this,Qe,{writable:!0,value:(n(this),c(this))}),(0,me.c)(this,Ze,{writable:!0,value:s(this,[20,20])}),(0,me.c)(this,$e,{writable:!0,value:d(this)}),(0,me.c)(this,et,{writable:!0,value:v(this)}),(0,me.c)(this,tt,{writable:!0,value:g(this)}),(0,me.c)(this,at,{writable:!0,value:w(this)}),(0,me.c)(this,nt,{writable:!0,value:k(this,!0)}),(0,me.c)(this,rt,{writable:!0,value:y(this,!0)}),(0,me.c)(this,it,{writable:!0,value:M(this,!0)}),(0,me.c)(this,lt,{writable:!0,value:E(this)}),(0,me.c)(this,ct,{writable:!0,value:z(this)}),(0,me.c)(this,st,{writable:!0,value:e=>{(0,ye.c)(this,ot).emit(e)}}),(0,me.c)(this,ut,{writable:!0,value:e=>{(0,Pe.M)(e,this.activeTarget)||(this.activeTarget=e)}}),(0,me.c)(this,dt,{writable:!0,value:R(this)}),(0,me.c)(this,vt,{writable:!0,value:H(this)}),(0,me.c)(this,gt,{writable:!0,value:e=>{(0,ye.c)(this,ft).emit(e),"node"===e.type&&(0,ye.c)(this,ht).emit(e)}}),(0,me.c)(this,pt,{writable:!0,value:Y(this)}),(0,me.c)(this,mt,{writable:!0,value:e=>{(0,ye.c)(this,wt).emit(e)}}),(0,me.c)(this,kt,{writable:!0,value:X(this)}),(0,me.c)(this,yt,{writable:!0,value:q(this)}),(0,me.c)(this,Mt,{writable:!0,value:e=>{(0,ye.c)(this,bt).emit(e),"node"===e.type&&(0,ye.c)(this,xt).emit(e)}}),(0,me.c)(this,Ct,{writable:!0,value:Q(this)}),(0,me.c)(this,Wt,{writable:!0,value:e=>{(0,ye.c)(this,Et).emit(e)}}),(0,me.c)(this,zt,{writable:!0,value:te(this)}),(0,me.c)(this,St,{writable:!0,value:e=>{(0,ye.c)(this,Nt).emit(e)}}),(0,me.c)(this,Tt,{writable:!0,value:ie(this)}),(0,me.c)(this,Bt,{writable:!0,value:e=>{(0,ye.c)(this,Rt).emit(e)}}),(0,me.c)(this,Dt,{writable:!0,value:(0,Me.createRef)()})}get cells(){return(0,ye.c)(this,Qe)}set cells(e){(0,xe.c)(this,Qe,e)}get defaultNodeSize(){return(0,ye.c)(this,Ze)}set defaultNodeSize(e){(0,xe.c)(this,Ze,e)}get defaultNodeBricks(){return(0,ye.c)(this,$e)}set defaultNodeBricks(e){(0,xe.c)(this,$e,e)}get defaultEdgeLines(){return(0,ye.c)(this,et)}set defaultEdgeLines(e){(0,xe.c)(this,et,e)}get activeTarget(){return(0,ye.c)(this,tt)}set activeTarget(e){(0,xe.c)(this,tt,e)}get fadeUnrelatedCells(){return(0,ye.c)(this,at)}set fadeUnrelatedCells(e){(0,xe.c)(this,at,e)}get zoomable(){return(0,ye.c)(this,nt)}set zoomable(e){(0,xe.c)(this,nt,e)}get scrollable(){return(0,ye.c)(this,rt)}set scrollable(e){(0,xe.c)(this,rt,e)}get pannable(){return(0,ye.c)(this,it)}set pannable(e){(0,xe.c)(this,it,e)}get scaleRange(){return(0,ye.c)(this,lt)}set scaleRange(e){(0,xe.c)(this,lt,e)}dropNode(e){var t=this;return(0,we.c)((function*(){var a,n,{id:r,position:i,size:l,data:c,useBrick:o}=e;if(null===(a=(n=document).elementsFromPoint)||void 0===a||null===(a=a.call(n,i[0],i[1]))||void 0===a?void 0:a.includes(t)){var s,u,d,h=t.getBoundingClientRect(),v=(0,ye.c)(t,Dt).current.getTransform(),f={type:"node",id:r,view:{x:(i[0]-h.left-v.x)/v.k,y:(i[1]-h.top-v.y)/v.k,width:null!==(s=null==l?void 0:l[0])&&void 0!==s?s:t.defaultNodeSize[0],height:null!==(u=null==l?void 0:l[1])&&void 0!==u?u:t.defaultNodeSize[0]},data:c,useBrick:o};return null===(d=(0,ye.c)(t,Dt).current)||void 0===d||d.dropNode(f),f}return null}))()}dropDecorator(e){var t=this;return(0,we.c)((function*(){var a,n,{position:r,decorator:i,text:l}=e;if(null===(a=(n=document).elementsFromPoint)||void 0===a||null===(a=a.call(n,r[0],r[1]))||void 0===a?void 0:a.includes(t)){var c,o=t.getBoundingClientRect(),s=(0,ye.c)(t,Dt).current.getTransform(),u={type:"decorator",decorator:i,id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),view:{x:(r[0]-o.left-s.x)/s.k,y:(r[1]-o.top-s.y)/s.k,width:100,height:60,text:l}};return null===(c=(0,ye.c)(t,Dt).current)||void 0===c||c.dropDecorator(u),u}return null}))()}addNodes(e){var t=this;return(0,we.c)((function*(){if(0===e.length)return[];var a=e.map((e=>{var a,n,{size:r,useBrick:i,id:l,data:c}=e;return{type:"node",id:l,data:c,view:{width:null!==(a=null==r?void 0:r[0])&&void 0!==a?a:t.defaultNodeSize[0],height:null!==(n=null==r?void 0:r[1])&&void 0!==n?n:t.defaultNodeSize[0]},useBrick:i}}));return(0,ye.c)(t,Dt).current.addNodes(a,{defaultNodeSize:t.defaultNodeSize,canvasHeight:t.clientHeight})}))()}addEdge(e){var t=this;return(0,we.c)((function*(){var a,{source:n,target:r,data:i}=e,l={type:"edge",source:n,target:r,data:i};return null===(a=(0,ye.c)(t,Dt).current)||void 0===a||a.addEdge(l),l}))()}manuallyConnectNodes(e){return(0,ye.c)(this,Dt).current.manuallyConnectNodes(e)}updateCells(e,t){var a=this;return(0,we.c)((function*(){var n=(0,ye.c)(a,Dt).current.getTransform(),{cells:r,updated:i}=(0,Xe.s)((0,pe.c)((0,pe.c)({},t),{},{cells:e,defaultNodeSize:a.defaultNodeSize,canvasHeight:a.clientHeight,transform:n}));return(0,ye.c)(a,Dt).current.updateCells(r),{updated:i}}))()}disconnectedCallback(){super.disconnectedCallback(),Ge(this,!1)}render(){return Ce().createElement(Je,{host:this,ref:(0,ye.c)(this,Dt),cells:this.cells,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:(0,ye.c)(this,st),onSwitchActiveTarget:(0,ye.c)(this,ut),onCellMove:(0,ye.c)(this,gt),onCellResize:(0,ye.c)(this,mt),onCellDelete:(0,ye.c)(this,Mt),onCellContextMenu:(0,ye.c)(this,Wt),onDecoratorTextChange:(0,ye.c)(this,St),onScaleChange:(0,ye.c)(this,Bt)})}}function Ht(e){S(this,e)}function Pt(){return N(this)}function At(e){D(this,e)}function Ut(){return B(this)}function Yt(e){A(this,e)}function _t(){return P(this)}function It(e){I(this,e)}function jt(){return _(this)}function Xt(e){G(this,e)}function Ft(){return F(this)}function Gt(e){V(this,e)}function Ot(){return K(this)}function qt(e){$(this,e)}function Kt(){return Z(this)}function Vt(e){ne(this,e)}function Jt(){return ae(this)}function Qt(e){ce(this,e)}function Zt(){return le(this)}function $t(e,t){var{host:a,cells:n,defaultNodeSize:r,defaultNodeBricks:i,defaultEdgeLines:l,activeTarget:c,fadeUnrelatedCells:o,zoomable:s,scrollable:u,pannable:d,scaleRange:h,onActiveTargetChange:v,onSwitchActiveTarget:f,onCellMove:g,onCellResize:p,onCellDelete:w,onCellContextMenu:m,onDecoratorTextChange:k,onScaleChange:x}=e,[{cells:y},b]=(0,Me.useReducer)(De.M,n,(e=>({cells:(0,Ie.S)(e,{defaultNodeSize:r})}))),M=(0,Me.useRef)(null),C=(0,Me.useRef)(null),E=(0,Me.useRef)(null),[W,z]=(0,Me.useState)([]),[N,S]=(0,Me.useState)(!1),[T,R]=(0,Me.useState)({k:1,x:0,y:0}),[B,D]=(0,Me.useState)(!1);(0,Me.useEffect)((()=>{x(T.k)}),[x,T.k]);var[L,H]=(0,Me.useState)(null),P=(0,Me.useMemo)((()=>null!=h?h:[.5,2]),[h]),A=(0,Me.useMemo)((()=>(0,Te.AT)()),[]);(0,Me.useEffect)((()=>{var e=!1;A.scaleExtent(s?P:[1,1]).on("start",(()=>{e=!1,S(!0)})).on("zoom",(t=>{e=!0,R(t.transform)})).on("end",(()=>{S(!1),e||null==f||f(null)}))}),[f,P,s,A]),(0,Me.useEffect)((()=>{var e=M.current;if(e){var t=(0,Se.c)(e),a=()=>{t.on(".zoom",null).on(".zoom.custom",null).on("wheel",null)};if(s||u||d)return(s||u)&&t.on("wheel.zoom.custom",(e=>{e.ctrlKey||(e.stopImmediatePropagation(),u&&(e.preventDefault(),A.translateBy(t,e.wheelDeltaX/5,e.wheelDeltaY/5)))})),t.call(A).on("wheel",(e=>e.preventDefault())).on("dblclick.zoom",null).on("mousedown.zoom",null),d||t.on("touchstart.zoom",null).on("touchmove.zoom",null).on("touchend.zoom",null),a;a()}}),[d,u,s,A]),(0,Me.useEffect)((()=>{var e=M.current;if(e&&!B){var{k:t,x:a,y:n}=(0,je.c)(y,{canvasWidth:e.clientWidth,canvasHeight:e.clientHeight,scaleRange:s?P:void 0});A.transform((0,Se.c)(e),new Te.O(t,a,n)),D(!0)}}),[y,B,P,s,A]),(0,Me.useImperativeHandle)(t,(()=>({dropNode(e){b({type:"drop-node",payload:e})},dropDecorator(e){b({type:"drop-decorator",payload:e})},addNodes(e,t){var{defaultNodeSize:a,canvasHeight:n}=t,r=y.findLastIndex((e=>!("decorator"===e.type&&"text"===e.decorator)))+1,i=[...y.slice(0,r),...e,...y.slice(r)],{cells:l,updated:c}=(0,Xe.s)({cells:i,defaultNodeSize:a,canvasHeight:n,transform:T});return b({type:"update-cells",payload:l}),c.filter((t=>e.includes(t)))},addEdge(e){b({type:"add-edge",payload:e})},updateCells(e){b({type:"update-cells",payload:e})},getTransform:()=>T,manuallyConnectNodes(e){var t=y.find((t=>(0,He.G4)(t)&&t.id===e));if(t){var a=M.current.getBoundingClientRect();return H({source:t,from:[t.view.x+t.view.width/2,t.view.y+t.view.height/2],offset:[a.left,a.top]}),new Promise(((e,t)=>{E.current={resolve:e,reject:t}}))}return Promise.reject(null)}})),[y,T]);var U=(0,Me.useCallback)(((e,t)=>{for(var a,n=0;n<y.length;n++){var r=y[n];if((0,He.G4)(r)&&r.id!==e.source.id&&r.view.x<t[0]&&r.view.x+r.view.width>t[0]&&r.view.y<t[1]&&r.view.y+r.view.height>t[1]){var i;null===(i=E.current)||void 0===i||i.resolve({source:e.source,target:r});break}}null===(a=E.current)||void 0===a||a.reject(null),H(null)}),[y]);(0,Me.useEffect)((()=>{Ge(a,!!L)}),[L,a]);var Y=null!=c?c:null,[_,I]=(0,Me.useState)(Y);(0,Me.useEffect)((()=>{I((e=>(0,Pe.M)(e,Y)?e:Y))}),[Y]);var j=(0,Me.useRef)(!1);(0,Me.useEffect)((()=>{j.current?v(_):j.current=!0}),[_,v]);var[X,F]=(0,Me.useState)([]);(0,Me.useEffect)((()=>{var e=o?(0,Fe.Y)(y,_):[];F((t=>0===t.length&&0===e.length?t:e))}),[_,y,o]),(0,Me.useEffect)((()=>{if(_){var e=e=>{e.composedPath().indexOf(C.current)<=0&&I(null)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}}),[_]),(0,Me.useEffect)((()=>{var e=M.current;if(e&&!(W.length>0)){var t=e=>{var t=(0,Ae.Y)(e,{cells:y,activeTarget:_});"delete-cell"===(null==t?void 0:t.action)&&w(t.cell)};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}}),[_,y,W.length,w]);var G=(0,Me.useMemo)((()=>"".concat((0,Ne.uniqueId)("diagram-"),"-")),[]),O="".concat(G,"line-arrow-"),q="".concat(O,"1"),K=(0,Me.useCallback)((e=>{b({type:"move-cell",payload:e})}),[]),V=(0,Me.useCallback)((e=>{b({type:"move-cell",payload:e}),g(e)}),[g]),J=(0,Me.useCallback)((e=>{b({type:"resize-cell",payload:e})}),[]),Q=(0,Me.useCallback)((e=>{b({type:"resize-cell",payload:e}),p(e)}),[p]),Z=(0,Me.useCallback)((e=>{var{id:t,editing:a}=e;z(a?e=>e.includes(t)?e:[...e,t]:e=>e.filter((e=>e!==t)))}),[]);return Ce().createElement("svg",{width:"100%",height:"100%",ref:M,className:Be()("root",{grabbing:N,pannable:d}),tabIndex:-1},Ce().createElement("defs",null,Ce().createElement(Le.y,{id:q,type:"arrow",strokeColor:"gray"})),Ce().createElement("g",{transform:"translate(".concat(T.x," ").concat(T.y,") scale(").concat(T.k,")")},Ce().createElement("g",{className:"cells",ref:C},y.map((e=>Ce().createElement(Ue.s,{key:"".concat(e.type,":").concat("edge"===e.type?"".concat(e.source,"~").concat(e.target):e.id),cell:e,cells:y,defaultNodeBricks:i,defaultEdgeLines:l,transform:T,markerEnd:q,active:(0,Pe.M)(_,e),unrelatedCells:X,onCellMoving:K,onCellMoved:V,onCellResizing:J,onCellResized:Q,onSwitchActiveTarget:f,onCellContextMenu:m,onDecoratorTextChange:k,onDecoratorTextEditing:Z})))),Ce().createElement(_e.E,{connectLineState:L,transform:T,markerEnd:q,onConnect:U})))}fe=Lt,({e:[c,s,d,v,g,w,k,y,M,E,z,N,S,R,B,D,H,P,A,Y,_,I,X,F,G,q,K,V,Q,Z,$,te,ae,ne,ie,le,ce,n],c:[ge,r]}=(0,be.c)(fe,[[l,1,"cells"],[o,1,"defaultNodeSize"],[u,1,"defaultNodeBricks"],[h,1,"defaultEdgeLines"],[f,1,"activeTarget"],[p,1,"fadeUnrelatedCells"],[m,1,"zoomable"],[x,1,"scrollable"],[b,1,"pannable"],[C,1,"scaleRange"],[W,1,"activeTargetChangeEvent",e=>(0,ye.c)(e,ct),(e,t)=>(0,xe.c)(e,ct,t)],[T,1,"nodeMoveEvent",e=>(0,ye.c)(e,dt),(e,t)=>(0,xe.c)(e,dt,t)],[L,1,"cellMoveEvent",e=>(0,ye.c)(e,vt),(e,t)=>(0,xe.c)(e,vt,t)],[U,1,"cellResizeEvent",e=>(0,ye.c)(e,pt),(e,t)=>(0,xe.c)(e,pt,t)],[j,1,"nodeDelete",e=>(0,ye.c)(e,kt),(e,t)=>(0,xe.c)(e,kt,t)],[O,1,"cellDelete",e=>(0,ye.c)(e,yt),(e,t)=>(0,xe.c)(e,yt,t)],[J,1,"cellContextMenu",e=>(0,ye.c)(e,Ct),(e,t)=>(0,xe.c)(e,Ct,t)],[ee,1,"decoratorTextChange",e=>(0,ye.c)(e,zt),(e,t)=>(0,xe.c)(e,zt,t)],[re,1,"scaleChange",e=>(0,ye.c)(e,Tt),(e,t)=>(0,xe.c)(e,Tt,t)],[oe,2,"dropNode"],[se,2,"dropDecorator"],[ue,2,"addNodes"],[de,2,"addEdge"],[he,2,"manuallyConnectNodes"],[ve,2,"updateCells"]],i,0,(e=>Dt.has((0,ke.c)(e))),We.ReactNextElement)),r()}}]);
2
- //# sourceMappingURL=eo-draw-canvas.212c402d.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunks/eo-draw-canvas.212c402d.js","mappings":"oKAYO,SAASA,EAAeC,GAIO,IAChCC,GAL0B,GAC9BC,EAAE,KACFC,EAAI,YACJC,GACqBJ,EAGrB,OAAQG,GACN,IAAK,OACHF,EAAYI,EACZ,MACF,IAAK,OACHJ,EAAYK,EACZ,MACF,QACEL,EAAYM,EAGhB,OAAOC,IAAAA,cAACP,EAAS,CAACC,GAAIA,EAAIE,YAAaA,GACzC,CAEA,SAASG,EAAWE,GAGsB,IAHrB,GACnBP,EAAE,YACFE,GACyBK,EACzB,OACED,IAAAA,cAAA,UACEN,GAAIA,EACJQ,QAAQ,UACRC,KAAM,EACNC,KAAM,EACNC,YAAa,EACbC,aAAc,EACdC,OAAO,qBACPC,eAAe,SAEfR,IAAAA,cAAA,QACES,EAAE,gCACFC,OAAQd,EACRe,YAAa,EACbC,KAAMhB,IAId,CAEA,SAASC,EAA6BgB,GAGI,IAHH,GACrCnB,EAAE,YACFE,GACyBiB,E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AAAsN,EAAAxR,GAAAiE,IAAA,CAAAvG,GAAA,gBAAA8T,IAAA1O,EAAAA,GAAAA,GAAA0O,EAAArR,IAAA,CAAAqR,EAAAvN,KAAAC,EAAAA,GAAAA,GAAAsN,EAAArR,GAAA8D,IAAA,CAAAtG,GAAA,eAAAC,GAAA,oBAAAC,GAAA,eAAAC,GAAA,cAAAC,GAAA,2BAAAC,GAAA,kBAAA7B,EAAA,GAAAsV,GAAAnR,GAAAoR,KAAAC,EAAAA,GAAAA,GAAAF,KAnR0BjR,GAAAA,mBAAgB8Q,G","sources":["webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/draw-canvas/index.tsx"],"sourcesContent":["import React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import type { NodePosition, NodeRect } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect\n): NodePosition[] | null {\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap.\n if (source === target || doTwoNodesOverlap(source, target, 0, 0)) {\n return null;\n }\n\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n\n let x0: number, y0: number, x1: number, y1: number;\n const directionX = dx > 0 ? 1 : -1;\n if (dy !== 0) {\n const deltaRadio = Math.abs(dx / dy);\n const directionY = dy > 0 ? 1 : -1;\n const sourceRadio = source.width / source.height;\n if (deltaRadio < sourceRadio) {\n x0 = source.x + ((deltaRadio * source.height) / 2) * directionX;\n y0 = source.y + (source.height / 2) * directionY;\n } else {\n x0 = source.x + (source.width / 2) * directionX;\n y0 = source.y + (source.width / 2 / deltaRadio) * directionY;\n }\n const targetRadio = target.width / target.height;\n if (deltaRadio < targetRadio) {\n x1 = target.x - ((deltaRadio * target.height) / 2) * directionX;\n y1 = target.y - (target.height / 2) * directionY;\n } else {\n x1 = target.x - (target.width / 2) * directionX;\n y1 = target.y - (target.width / 2 / deltaRadio) * directionY;\n }\n } else {\n x0 = source.x + (source.width / 2) * directionX;\n x1 = target.x - (target.width / 2) * directionX;\n y0 = y1 = source.y;\n }\n\n return [\n { x: x0, y: y0 },\n { x: x1, y: y1 },\n ];\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import React, {\n createRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useReducer,\n useRef,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport type { UseSingleBrickConf } from \"@next-core/react-runtime\";\nimport { unwrapProvider } from \"@next-core/utils/general\";\nimport \"@next-core/theme\";\nimport { uniqueId } from \"lodash\";\nimport { select } from \"d3-selection\";\nimport { ZoomTransform, zoom } from \"d3-zoom\";\nimport classNames from \"classnames\";\nimport type { lockBodyScroll as _lockBodyScroll } from \"@next-bricks/basic/data-providers/lock-body-scroll/lock-body-scroll\";\nimport type {\n PositionTuple,\n RangeTuple,\n SizeTuple,\n TransformLiteral,\n} from \"../diagram/interfaces\";\nimport type {\n ActiveTarget,\n Cell,\n EdgeCell,\n InitialCell,\n NodeBrickConf,\n NodeCell,\n NodeId,\n DecoratorCell,\n DecoratorType,\n CellContextMenuDetail,\n ConnectLineState,\n Deferred,\n ConnectNodesDetail,\n EdgeLineConf,\n DecoratorTextChangeDetail,\n NodeView,\n} from \"./interfaces\";\nimport { rootReducer } from \"./reducers\";\nimport { MarkerComponent } from \"../diagram/MarkerComponent\";\nimport { isNodeCell } from \"./processors/asserts\";\nimport type { MoveCellPayload, ResizeCellPayload } from \"./reducers/interfaces\";\nimport { sameTarget } from \"./processors/sameTarget\";\nimport { handleKeyboard } from \"./processors/handleKeyboard\";\nimport { CellComponent } from \"./CellComponent\";\nimport styleText from \"./styles.shadow.css\";\nimport { ConnectLineComponent } from \"./ConnectLineComponent\";\nimport { initializeCells } from \"./processors/initializeCells\";\nimport { transformToCenter } from \"./processors/transformToCenter\";\nimport { updateCells } from \"./processors/updateCells\";\nimport { getUnrelatedCells } from \"./processors/getUnrelatedCells\";\n\nconst DEFAULT_NODE_SIZE = 20;\nconst DEFAULT_AREA_WIDTH = 100;\nconst DEFAULT_AREA_HEIGHT = 60;\nconst DEFAULT_SCALE_RANGE_MIN = 0.5;\nconst DEFAULT_SCALE_RANGE_MAX = 2;\n\nconst lockBodyScroll = unwrapProvider<typeof _lockBodyScroll>(\n \"basic.lock-body-scroll\"\n);\n\nconst { defineElement, property, method, event } = createDecorators();\n\nexport interface EoDrawCanvasProps {\n cells: InitialCell[] | undefined;\n defaultNodeSize: SizeTuple;\n defaultNodeBricks?: NodeBrickConf[];\n defaultEdgeLines?: EdgeLineConf[];\n activeTarget?: ActiveTarget | null;\n fadeUnrelatedCells?: boolean;\n zoomable?: boolean;\n scrollable?: boolean;\n pannable?: boolean;\n scaleRange?: RangeTuple;\n}\n\nexport interface DropNodeInfo extends AddNodeInfo {\n /** [PointerEvent::clientX, PointerEvent::clientY] */\n position: PositionTuple;\n}\n\nexport interface DropDecoratorInfo {\n decorator: DecoratorType;\n /** [PointerEvent::clientX, PointerEvent::clientY] */\n position: PositionTuple;\n text?: string;\n}\n\nexport interface AddNodeInfo {\n id: NodeId;\n useBrick?: UseSingleBrickConf;\n data?: unknown;\n size?: SizeTuple;\n}\n\nexport interface AddEdgeInfo {\n source: NodeId;\n target: NodeId;\n data?: unknown;\n}\n\nexport interface UpdateCellsContext {\n reason: \"add-related-nodes\";\n parent: NodeId;\n}\n\nexport interface AddNodesContext {\n defaultNodeSize: SizeTuple;\n canvasHeight: number;\n}\n\nexport const EoDrawCanvasComponent = React.forwardRef(\n LegacyEoDrawCanvasComponent\n);\n\n/**\n * 用于手工绘图的画布。\n *\n * 注意:将配套另外一个用于展示的画布构件。\n */\nexport\n@defineElement(\"eo-draw-canvas\", {\n styleTexts: [styleText],\n})\nclass EoDrawCanvas extends ReactNextElement implements EoDrawCanvasProps {\n /**\n * 仅当初始化时使用,渲染后重新设置 `cells` 将无效。\n */\n @property({ attribute: false })\n accessor cells: InitialCell[] | undefined;\n\n @property({ attribute: false })\n accessor defaultNodeSize: SizeTuple = [DEFAULT_NODE_SIZE, DEFAULT_NODE_SIZE];\n\n @property({ attribute: false })\n accessor defaultNodeBricks: NodeBrickConf[] | undefined;\n\n /**\n * 使用条件判断设置默认的边对应的连线。在 `if` 表达式中 `DATA` 为 `{ edge }`,例如:\n *\n * ```yaml\n * defaultEdgeLines:\n * - if: <% DATA.edge.data?.virtual %>\n * dashed: true\n * ```\n */\n @property({ attribute: false })\n accessor defaultEdgeLines: EdgeLineConf[] | undefined;\n\n @property({ attribute: false })\n accessor activeTarget: ActiveTarget | null | undefined;\n\n @property({ type: Boolean })\n accessor fadeUnrelatedCells: boolean | undefined;\n\n @property({ type: Boolean })\n accessor zoomable: boolean | undefined = true;\n\n @property({ type: Boolean })\n accessor scrollable: boolean | undefined = true;\n\n @property({ type: Boolean })\n accessor pannable: boolean | undefined = true;\n\n @property({ attribute: false })\n accessor scaleRange: RangeTuple | undefined;\n\n @event({ type: \"activeTarget.change\" })\n accessor #activeTargetChangeEvent!: EventEmitter<ActiveTarget | null>;\n\n #handleActiveTargetChange = (target: ActiveTarget | null) => {\n this.#activeTargetChangeEvent.emit(target);\n };\n\n #handleSwitchActiveTarget = (target: ActiveTarget | null) => {\n if (!sameTarget(target, this.activeTarget)) {\n this.activeTarget = target;\n }\n };\n\n /**\n * @deprecated Use `cell.move` instead.\n */\n @event({ type: \"node.move\" })\n accessor #nodeMoveEvent!: EventEmitter<MoveCellPayload>;\n\n @event({ type: \"cell.move\" })\n accessor #cellMoveEvent!: EventEmitter<MoveCellPayload>;\n\n #handleCellMove = (info: MoveCellPayload) => {\n this.#cellMoveEvent.emit(info);\n if (info.type === \"node\") {\n this.#nodeMoveEvent.emit(info);\n }\n };\n\n @event({ type: \"cell.resize\" })\n accessor #cellResizeEvent!: EventEmitter<ResizeCellPayload>;\n\n #handleCellResize = (info: ResizeCellPayload) => {\n this.#cellResizeEvent.emit(info);\n };\n\n /**\n * @deprecated Use `cell.delete` instead.\n */\n @event({ type: \"node.delete\" })\n accessor #nodeDelete!: EventEmitter<Cell>;\n\n @event({ type: \"cell.delete\" })\n accessor #cellDelete!: EventEmitter<Cell>;\n\n #handleCellDelete = (cell: Cell) => {\n this.#cellDelete.emit(cell);\n if (cell.type === \"node\") {\n this.#nodeDelete.emit(cell);\n }\n };\n\n @event({ type: \"cell.contextmenu\" })\n accessor #cellContextMenu!: EventEmitter<CellContextMenuDetail>;\n\n #handleCellContextMenu = (detail: CellContextMenuDetail) => {\n this.#cellContextMenu.emit(detail);\n };\n\n @event({ type: \"decorator.text.change\" })\n accessor #decoratorTextChange!: EventEmitter<DecoratorTextChangeDetail>;\n\n #handleDecoratorTextChange = (detail: DecoratorTextChangeDetail) => {\n this.#decoratorTextChange.emit(detail);\n };\n\n /**\n * 缩放变化后,从素材库拖拽元素进画布时,拖拽图像应设置对应的缩放比例。\n */\n @event({ type: \"scale.change\" })\n accessor #scaleChange!: EventEmitter<number>;\n\n #handleScaleChange = (scale: number) => {\n this.#scaleChange.emit(scale);\n };\n\n @method()\n async dropNode({\n id,\n position,\n size,\n data,\n useBrick,\n }: DropNodeInfo): Promise<NodeCell | null> {\n // Drag and then drop a node\n const droppedInside = document\n .elementsFromPoint?.(position[0], position[1])\n ?.includes(this);\n if (droppedInside) {\n const boundingClientRect = this.getBoundingClientRect();\n const transform = this.#canvasRef.current!.getTransform();\n const newNode: NodeCell = {\n type: \"node\",\n id,\n view: {\n x:\n (position[0] - boundingClientRect.left - transform.x) / transform.k,\n y: (position[1] - boundingClientRect.top - transform.y) / transform.k,\n width: size?.[0] ?? this.defaultNodeSize[0],\n height: size?.[1] ?? this.defaultNodeSize[0],\n },\n data,\n useBrick,\n };\n this.#canvasRef.current?.dropNode(newNode);\n return newNode;\n }\n return null;\n }\n\n @method()\n async dropDecorator({\n position,\n decorator,\n text,\n }: DropDecoratorInfo): Promise<DecoratorCell | null> {\n // Drag and then drop a node\n const droppedInside = document\n .elementsFromPoint?.(position[0], position[1])\n ?.includes(this);\n if (droppedInside) {\n const boundingClientRect = this.getBoundingClientRect();\n const transform = this.#canvasRef.current!.getTransform();\n const newDecorator: DecoratorCell = {\n type: \"decorator\",\n decorator,\n id: uuidV4(),\n view: {\n x:\n (position[0] - boundingClientRect.left - transform.x) / transform.k,\n y: (position[1] - boundingClientRect.top - transform.y) / transform.k,\n width: DEFAULT_AREA_WIDTH,\n height: DEFAULT_AREA_HEIGHT,\n text,\n },\n };\n this.#canvasRef.current?.dropDecorator(newDecorator);\n return newDecorator;\n }\n return null;\n }\n\n @method()\n async addNodes(nodes: AddNodeInfo[]): Promise<NodeCell[]> {\n if (nodes.length === 0) {\n return [];\n }\n const newNodes = nodes.map<NodeCell>(({ size, useBrick, id, data }) => ({\n type: \"node\",\n id,\n data,\n view: {\n // x: Math.floor(index / rows) * (width + gap) + gap,\n // y: (index % rows) * (height + gap) + gap,\n width: size?.[0] ?? this.defaultNodeSize[0],\n height: size?.[1] ?? this.defaultNodeSize[0],\n } as NodeView,\n useBrick,\n }));\n return this.#canvasRef.current!.addNodes(newNodes, {\n defaultNodeSize: this.defaultNodeSize,\n canvasHeight: this.clientHeight,\n });\n }\n\n @method()\n async addEdge({ source, target, data }: AddEdgeInfo): Promise<EdgeCell> {\n const newEdge: EdgeCell = {\n type: \"edge\",\n source,\n target,\n data,\n };\n this.#canvasRef.current?.addEdge(newEdge);\n return newEdge;\n }\n\n @method()\n manuallyConnectNodes(source: NodeId): Promise<ConnectNodesDetail> {\n return this.#canvasRef.current!.manuallyConnectNodes(source);\n }\n\n @method()\n async updateCells(\n cells: InitialCell[],\n ctx?: UpdateCellsContext\n ): Promise<{ updated: Cell[] }> {\n const transform = this.#canvasRef.current!.getTransform();\n const { cells: newCells, updated } = updateCells({\n ...ctx,\n cells,\n defaultNodeSize: this.defaultNodeSize,\n canvasHeight: this.clientHeight,\n transform,\n });\n this.#canvasRef.current!.updateCells(newCells);\n return { updated };\n }\n\n #canvasRef = createRef<DrawCanvasRef>();\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n lockBodyScroll(this, false);\n }\n\n render() {\n return (\n <EoDrawCanvasComponent\n host={this}\n ref={this.#canvasRef}\n cells={this.cells}\n defaultNodeSize={this.defaultNodeSize}\n defaultNodeBricks={this.defaultNodeBricks}\n defaultEdgeLines={this.defaultEdgeLines}\n activeTarget={this.activeTarget}\n fadeUnrelatedCells={this.fadeUnrelatedCells}\n zoomable={this.zoomable}\n scrollable={this.scrollable}\n pannable={this.pannable}\n scaleRange={this.scaleRange}\n onActiveTargetChange={this.#handleActiveTargetChange}\n onSwitchActiveTarget={this.#handleSwitchActiveTarget}\n onCellMove={this.#handleCellMove}\n onCellResize={this.#handleCellResize}\n onCellDelete={this.#handleCellDelete}\n onCellContextMenu={this.#handleCellContextMenu}\n onDecoratorTextChange={this.#handleDecoratorTextChange}\n onScaleChange={this.#handleScaleChange}\n />\n );\n }\n}\n\nexport interface EoDrawCanvasComponentProps extends EoDrawCanvasProps {\n host: HTMLElement;\n onActiveTargetChange(target: ActiveTarget | null): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellMove(info: MoveCellPayload): void;\n onCellResize(cell: ResizeCellPayload): void;\n onCellDelete(cell: Cell): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n onDecoratorTextChange(detail: DecoratorTextChangeDetail): void;\n onScaleChange(scale: number): void;\n}\n\nexport interface DrawCanvasRef {\n dropNode(node: NodeCell): void;\n dropDecorator(decorator: DecoratorCell): void;\n addNodes(nodes: NodeCell[], ctx: AddNodesContext): NodeCell[];\n addEdge(edge: EdgeCell): void;\n manuallyConnectNodes(source: NodeId): Promise<ConnectNodesDetail>;\n updateCells(cells: Cell[]): void;\n getTransform(): TransformLiteral;\n}\n\nfunction LegacyEoDrawCanvasComponent(\n {\n host,\n cells: initialCells,\n defaultNodeSize,\n defaultNodeBricks,\n defaultEdgeLines,\n activeTarget: _activeTarget,\n fadeUnrelatedCells,\n zoomable,\n scrollable,\n pannable,\n scaleRange: _scaleRange,\n onActiveTargetChange,\n onSwitchActiveTarget,\n onCellMove,\n onCellResize,\n onCellDelete,\n onCellContextMenu,\n onDecoratorTextChange,\n onScaleChange,\n }: EoDrawCanvasComponentProps,\n ref: React.Ref<DrawCanvasRef>\n) {\n const [{ cells }, dispatch] = useReducer(\n rootReducer,\n initialCells,\n (initialCells) => ({\n cells: initializeCells(initialCells, { defaultNodeSize }),\n })\n );\n\n const rootRef = useRef<SVGSVGElement>(null);\n const cellsRef = useRef<SVGGElement>(null);\n const manualConnectDeferredRef = useRef<Deferred<ConnectNodesDetail> | null>(\n null\n );\n const [editingTexts, setEditingTexts] = useState<string[]>([]);\n const [grabbing, setGrabbing] = useState(false);\n const [transform, setTransform] = useState<TransformLiteral>({\n k: 1,\n x: 0,\n y: 0,\n });\n const [centered, setCentered] = useState(false);\n\n useEffect(() => {\n onScaleChange(transform.k);\n }, [onScaleChange, transform.k]);\n\n const [connectLineState, setConnectLineState] =\n useState<ConnectLineState | null>(null);\n\n const scaleRange = useMemo(\n () =>\n _scaleRange ??\n ([DEFAULT_SCALE_RANGE_MIN, DEFAULT_SCALE_RANGE_MAX] as RangeTuple),\n [_scaleRange]\n );\n\n const zoomer = useMemo(() => zoom<SVGSVGElement, unknown>(), []);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n let moved = false;\n zoomer\n .scaleExtent(zoomable ? scaleRange : [1, 1])\n .on(\"start\", () => {\n moved = false;\n setGrabbing(true);\n })\n .on(\"zoom\", (e: { transform: TransformLiteral }) => {\n moved = true;\n setTransform(e.transform);\n })\n .on(\"end\", () => {\n setGrabbing(false);\n if (!moved) {\n onSwitchActiveTarget?.(null);\n }\n });\n }, [onSwitchActiveTarget, scaleRange, zoomable, zoomer]);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n const root = rootRef.current;\n if (!root) {\n return;\n }\n\n const rootSelection = select(root);\n\n const unsetZoom = () => {\n rootSelection\n .on(\".zoom\", null)\n .on(\".zoom.custom\", null)\n .on(\"wheel\", null);\n };\n\n if (!(zoomable || scrollable || pannable)) {\n unsetZoom();\n return;\n }\n\n if (zoomable || scrollable) {\n // Do not override default d3 zoom handler.\n // Only handles *panning*\n rootSelection.on(\n \"wheel.zoom.custom\",\n (e: WheelEvent & { wheelDeltaX: number; wheelDeltaY: number }) => {\n // Mac OS trackpad pinch event is emitted as a wheel.zoom and d3.event.ctrlKey set to true\n if (!e.ctrlKey) {\n // Stop immediate propagation for default d3 zoom handler\n e.stopImmediatePropagation();\n if (scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\n );\n }\n }\n // zoomer.scaleBy(rootSelection, Math.pow(2, defaultWheelDelta(e)))\n }\n );\n }\n\n rootSelection\n .call(zoomer)\n .on(\"wheel\", (e: WheelEvent) => e.preventDefault())\n .on(\"dblclick.zoom\", null)\n .on(\"mousedown.zoom\", null);\n\n if (!pannable) {\n rootSelection\n .on(\"touchstart.zoom\", null)\n .on(\"touchmove.zoom\", null)\n .on(\"touchend.zoom\", null);\n }\n\n return unsetZoom;\n }, [pannable, scrollable, zoomable, zoomer]);\n\n useEffect(() => {\n const root = rootRef.current;\n if (!root || centered) {\n return;\n }\n const { k, x, y } = transformToCenter(cells, {\n canvasWidth: root.clientWidth,\n canvasHeight: root.clientHeight,\n scaleRange: zoomable ? scaleRange : undefined,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV !== \"test\") {\n // jsdom doesn't support svg baseVal yet.\n // https://github.com/jsdom/jsdom/issues/2531\n zoomer.transform(select(root), new ZoomTransform(k, x, y));\n }\n setCentered(true);\n }, [cells, centered, scaleRange, zoomable, zoomer]);\n\n useImperativeHandle(\n ref,\n () => ({\n dropNode(node) {\n dispatch({ type: \"drop-node\", payload: node });\n },\n dropDecorator(decorator) {\n dispatch({ type: \"drop-decorator\", payload: decorator });\n },\n addNodes(nodes, { defaultNodeSize, canvasHeight }: AddNodesContext) {\n const index =\n cells.findLastIndex(\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n ) + 1;\n const newCells = [\n ...cells.slice(0, index),\n ...nodes,\n ...cells.slice(index),\n ];\n const { cells: allCells, updated } = updateCells({\n cells: newCells,\n defaultNodeSize,\n canvasHeight,\n transform,\n });\n dispatch({ type: \"update-cells\", payload: allCells });\n return updated.filter((node) =>\n nodes.includes(node as NodeCell)\n ) as NodeCell[];\n },\n addEdge(edge) {\n dispatch({ type: \"add-edge\", payload: edge });\n },\n updateCells(cells) {\n dispatch({ type: \"update-cells\", payload: cells });\n },\n getTransform() {\n return transform;\n },\n manuallyConnectNodes(sourceId) {\n const source = cells.find(\n (cell) => isNodeCell(cell) && cell.id === sourceId\n ) as NodeCell | undefined;\n if (source) {\n const rect = rootRef.current!.getBoundingClientRect();\n setConnectLineState({\n source,\n from: [\n source.view.x + source.view.width / 2,\n source.view.y + source.view.height / 2,\n ],\n offset: [rect.left, rect.top],\n });\n const promise = new Promise<ConnectNodesDetail>((resolve, reject) => {\n manualConnectDeferredRef.current = { resolve, reject };\n });\n return promise;\n }\n return Promise.reject(null);\n },\n }),\n [cells, transform]\n );\n\n const handleConnect = useCallback(\n (state: ConnectLineState, to: PositionTuple) => {\n // Find the target node from top bo bottom,\n // detect whether the pointer is inside the target node.\n for (let i = 0; i < cells.length; i++) {\n const cell = cells[i];\n // Currently ignore connecting to self\n if (isNodeCell(cell) && cell.id !== state.source.id) {\n if (\n cell.view.x < to[0] &&\n cell.view.x + cell.view.width > to[0] &&\n cell.view.y < to[1] &&\n cell.view.y + cell.view.height > to[1]\n ) {\n manualConnectDeferredRef.current?.resolve({\n source: state.source,\n target: cell,\n });\n break;\n }\n }\n }\n manualConnectDeferredRef.current?.reject(null);\n setConnectLineState(null);\n },\n [cells]\n );\n\n useEffect(() => {\n lockBodyScroll(host, !!connectLineState);\n }, [connectLineState, host]);\n\n const newActiveTarget = _activeTarget ?? null;\n const [activeTarget, setActiveTarget] = useState<ActiveTarget | null>(\n newActiveTarget\n );\n\n useEffect(() => {\n setActiveTarget((previous) =>\n sameTarget(previous, newActiveTarget) ? previous : newActiveTarget\n );\n }, [newActiveTarget]);\n\n const activeTargetChangeInitialized = useRef(false);\n useEffect(() => {\n if (!activeTargetChangeInitialized.current) {\n activeTargetChangeInitialized.current = true;\n return;\n }\n onActiveTargetChange(activeTarget);\n }, [activeTarget, onActiveTargetChange]);\n\n const [unrelatedCells, setUnrelatedCells] = useState<Cell[]>([]);\n useEffect(() => {\n const nextUnrelated = fadeUnrelatedCells\n ? getUnrelatedCells(cells, activeTarget)\n : [];\n // Do not update the state when prev and next are both empty.\n setUnrelatedCells((prev) =>\n prev.length === 0 && nextUnrelated.length === 0 ? prev : nextUnrelated\n );\n }, [activeTarget, cells, fadeUnrelatedCells]);\n\n useEffect(() => {\n if (!activeTarget) {\n return;\n }\n const resetActiveTarget = (e: MouseEvent) => {\n const path = e.composedPath();\n const cellsContainerIndex = path.indexOf(cellsRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (cellsContainerIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget]);\n\n useEffect(() => {\n const root = rootRef.current;\n if (!root || editingTexts.length > 0) {\n return;\n }\n const onKeydown = (event: KeyboardEvent) => {\n const action = handleKeyboard(event, {\n cells,\n activeTarget,\n });\n\n if (action?.action === \"delete-cell\") {\n onCellDelete(action.cell);\n }\n };\n root.addEventListener(\"keydown\", onKeydown);\n return () => {\n root.removeEventListener(\"keydown\", onKeydown);\n };\n }, [activeTarget, cells, editingTexts.length, onCellDelete]);\n\n const defPrefix = useMemo(() => `${uniqueId(\"diagram-\")}-`, []);\n const markerPrefix = `${defPrefix}line-arrow-`;\n const markerEnd = `${markerPrefix}1`;\n\n const handleCellMoving = useCallback((info: MoveCellPayload) => {\n dispatch({ type: \"move-cell\", payload: info });\n }, []);\n\n const handleCellMoved = useCallback(\n (info: MoveCellPayload) => {\n dispatch({ type: \"move-cell\", payload: info });\n onCellMove(info);\n },\n [onCellMove]\n );\n\n const handleCellResizing = useCallback((info: ResizeCellPayload) => {\n dispatch({ type: \"resize-cell\", payload: info });\n }, []);\n\n const handleCellResized = useCallback(\n (info: ResizeCellPayload) => {\n dispatch({ type: \"resize-cell\", payload: info });\n onCellResize(info);\n },\n [onCellResize]\n );\n\n const handleDecoratorTextEditing = useCallback(\n ({ id, editing }: { id: string; editing: boolean }) => {\n if (editing) {\n setEditingTexts((texts) =>\n texts.includes(id) ? texts : [...texts, id]\n );\n } else {\n setEditingTexts((texts) => texts.filter((text) => text !== id));\n }\n },\n []\n );\n\n return (\n <svg\n width=\"100%\"\n height=\"100%\"\n ref={rootRef}\n className={classNames(\"root\", { grabbing, pannable })}\n tabIndex={-1}\n >\n <defs>\n <MarkerComponent id={markerEnd} type=\"arrow\" strokeColor=\"gray\" />\n </defs>\n <g\n transform={`translate(${transform.x} ${transform.y}) scale(${transform.k})`}\n >\n <g className=\"cells\" ref={cellsRef}>\n {cells.map((cell) => (\n <CellComponent\n key={`${cell.type}:${cell.type === \"edge\" ? `${cell.source}~${cell.target}` : cell.id}`}\n cell={cell}\n cells={cells}\n defaultNodeBricks={defaultNodeBricks}\n defaultEdgeLines={defaultEdgeLines}\n transform={transform}\n markerEnd={markerEnd}\n active={sameTarget(activeTarget, cell)}\n unrelatedCells={unrelatedCells}\n onCellMoving={handleCellMoving}\n onCellMoved={handleCellMoved}\n onCellResizing={handleCellResizing}\n onCellResized={handleCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onCellContextMenu={onCellContextMenu}\n onDecoratorTextChange={onDecoratorTextChange}\n onDecoratorTextEditing={handleDecoratorTextEditing}\n />\n ))}\n </g>\n <ConnectLineComponent\n connectLineState={connectLineState}\n transform={transform}\n markerEnd={markerEnd}\n onConnect={handleConnect}\n />\n </g>\n </svg>\n );\n}\n\nfunction uuidV4() {\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n const r = (Math.random() * 16) | 0,\n v = c == \"x\" ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n"],"names":["MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","markerWidth","markerHeight","orient","strokeLinejoin","d","stroke","strokeWidth","fill","_ref3","_ref4","getDirectLinePoints","source","target","doTwoNodesOverlap","x0","y0","x1","y1","dx","x","dy","y","directionX","deltaRadio","Math","abs","directionY","width","height","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","node","padding","_EoDrawCanvas","lockBodyScroll","unwrapProvider","defineElement","property","method","event","createDecorators","EoDrawCanvasComponent","LegacyEoDrawCanvasComponent","_classDecs","styleTexts","styleText","_dec","attribute","_dec2","_dec3","_dec4","_dec5","_dec6","Boolean","_dec7","_dec8","_dec9","_dec10","_dec11","_dec12","_dec13","_dec14","_dec15","_dec16","_dec17","_dec18","_dec19","_dec20","_dec21","_dec22","_dec23","_dec24","_dec25","_A","WeakMap","_B","_C","_D","_E","_F","_G","_H","_I","_J","_K","_activeTargetChangeEvent","_handleActiveTargetChange","_handleSwitchActiveTarget","_L","_nodeMoveEvent","_M","_cellMoveEvent","_handleCellMove","_N","_cellResizeEvent","_handleCellResize","_O","_nodeDelete","_P","_cellDelete","_handleCellDelete","_Q","_cellContextMenu","_handleCellContextMenu","_R","_decoratorTextChange","_handleDecoratorTextChange","_S","_scaleChange","_handleScaleChange","_canvasRef","EoDrawCanvas","ReactNextElement","constructor","arguments","_classPrivateFieldInitSpec","get","_get_scaleChange2","set","_set_scaleChange2","_get_decoratorTextChange2","_set_decoratorTextChange2","_get_cellContextMenu2","_set_cellContextMenu2","_get_cellDelete2","_set_cellDelete2","_get_nodeDelete2","_set_nodeDelete2","_get_cellResizeEvent2","_set_cellResizeEvent2","_get_cellMoveEvent2","_set_cellMoveEvent2","_get_nodeMoveEvent2","_set_nodeMoveEvent2","_get_activeTargetChangeEvent2","_set_activeTargetChangeEvent2","writable","value","_initProto","_init_cells","_init_defaultNodeSize","_init_defaultNodeBricks","_init_defaultEdgeLines","_init_activeTarget","_init_fadeUnrelatedCells","_init_zoomable","_init_scrollable","_init_pannable","_init_scaleRange","_init_activeTargetChangeEvent","_classPrivateFieldGet","this","emit","sameTarget","activeTarget","_init_nodeMoveEvent","_init_cellMoveEvent","info","_init_cellResizeEvent","_init_nodeDelete","_init_cellDelete","cell","_init_cellContextMenu","detail","_init_decoratorTextChange","_init_scaleChange","scale","createRef","cells","v","_classPrivateFieldSet","defaultNodeSize","defaultNodeBricks","defaultEdgeLines","fadeUnrelatedCells","zoomable","scrollable","pannable","scaleRange","dropNode","_this","_asyncToGenerator","_document$elementsFro","_document","position","size","data","useBrick","document","elementsFromPoint","call","includes","_size$","_size$2","_classPrivateFieldGet2","boundingClientRect","getBoundingClientRect","transform","current","getTransform","newNode","view","k","dropDecorator","_this2","_document$elementsFro2","_document2","decorator","text","_classPrivateFieldGet3","newDecorator","replace","c","r","random","toString","addNodes","nodes","_this3","length","newNodes","map","_size$3","_size$4","canvasHeight","clientHeight","addEdge","_this4","_classPrivateFieldGet4","newEdge","manuallyConnectNodes","updateCells","ctx","_this5","newCells","updated","_objectSpread","disconnectedCallback","super","render","host","ref","onActiveTargetChange","onSwitchActiveTarget","onCellMove","onCellResize","onCellDelete","onCellContextMenu","onDecoratorTextChange","onScaleChange","_set_activeTargetChangeEvent","_get_activeTargetChangeEvent","_set_nodeMoveEvent","_get_nodeMoveEvent","_set_cellMoveEvent","_get_cellMoveEvent","_set_cellResizeEvent","_get_cellResizeEvent","_set_nodeDelete","_get_nodeDelete","_set_cellDelete","_get_cellDelete","_set_cellContextMenu","_get_cellContextMenu","_set_decoratorTextChange","_get_decoratorTextChange","_set_scaleChange","_get_scaleChange","_ref5","initialCells","_activeTarget","_scaleRange","dispatch","useReducer","rootReducer","initializeCells","rootRef","useRef","cellsRef","manualConnectDeferredRef","editingTexts","setEditingTexts","useState","grabbing","setGrabbing","setTransform","centered","setCentered","useEffect","connectLineState","setConnectLineState","useMemo","zoomer","zoom","moved","scaleExtent","on","e","root","rootSelection","select","unsetZoom","ctrlKey","stopImmediatePropagation","preventDefault","translateBy","wheelDeltaX","wheelDeltaY","transformToCenter","canvasWidth","clientWidth","undefined","ZoomTransform","useImperativeHandle","payload","_ref6","index","findLastIndex","slice","allCells","filter","edge","sourceId","find","isNodeCell","rect","from","offset","Promise","resolve","reject","handleConnect","useCallback","state","to","_manualConnectDeferre2","i","_manualConnectDeferre","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","unrelatedCells","setUnrelatedCells","nextUnrelated","getUnrelatedCells","prev","resetActiveTarget","composedPath","indexOf","addEventListener","removeEventListener","onKeydown","action","handleKeyboard","defPrefix","concat","uniqueId","markerPrefix","markerEnd","handleCellMoving","handleCellMoved","handleCellResizing","handleCellResized","handleDecoratorTextEditing","_ref7","editing","texts","className","classNames","tabIndex","CellComponent","key","active","onCellMoving","onCellMoved","onCellResizing","onCellResized","onDecoratorTextEditing","ConnectLineComponent","onConnect","_EoDrawCanvas2","_initClass","_applyDecs","o","_","has","_checkInRHS"],"sourceRoot":""}