@next-bricks/diagram 0.23.0 → 0.23.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/bricks.json +3 -3
  2. package/dist/chunks/2696.826d69c1.js +2 -0
  3. package/dist/chunks/2696.826d69c1.js.map +1 -0
  4. package/dist/chunks/{3780.57b33842.js → 3132.ccc1512e.js} +3 -3
  5. package/dist/chunks/3132.ccc1512e.js.map +1 -0
  6. package/dist/chunks/3664.63190754.js +3 -0
  7. package/dist/chunks/3664.63190754.js.map +1 -0
  8. package/dist/chunks/5676.b73cbbce.js +2 -0
  9. package/dist/chunks/5676.b73cbbce.js.map +1 -0
  10. package/dist/chunks/eo-draw-canvas.a55166a4.js +2 -0
  11. package/dist/chunks/eo-draw-canvas.a55166a4.js.map +1 -0
  12. package/dist/chunks/{main.70f66e0a.js → main.778b4e4a.js} +2 -2
  13. package/dist/chunks/{main.70f66e0a.js.map → main.778b4e4a.js.map} +1 -1
  14. package/dist/{index.0306757d.js → index.593ec971.js} +2 -2
  15. package/dist/{index.0306757d.js.map → index.593ec971.js.map} +1 -1
  16. package/dist/manifest.json +41 -41
  17. package/dist/types.json +67 -67
  18. package/dist-types/draw-canvas/index.d.ts +5 -1
  19. package/dist-types/draw-canvas/processors/updateCells.d.ts +4 -2
  20. package/package.json +2 -2
  21. package/dist/chunks/2680.440281fd.js +0 -3
  22. package/dist/chunks/2680.440281fd.js.map +0 -1
  23. package/dist/chunks/2696.b9434f42.js +0 -2
  24. package/dist/chunks/2696.b9434f42.js.map +0 -1
  25. package/dist/chunks/3780.57b33842.js.map +0 -1
  26. package/dist/chunks/5676.25458ec2.js +0 -2
  27. package/dist/chunks/5676.25458ec2.js.map +0 -1
  28. package/dist/chunks/eo-draw-canvas.623578df.js +0 -2
  29. package/dist/chunks/eo-draw-canvas.623578df.js.map +0 -1
  30. /package/dist/chunks/{3780.57b33842.js.LICENSE.txt → 3132.ccc1512e.js.LICENSE.txt} +0 -0
  31. /package/dist/chunks/{2680.440281fd.js.LICENSE.txt → 3664.63190754.js.LICENSE.txt} +0 -0
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[2696],{5776:(e,t,n)=>{n.d(t,{s:()=>E});var r=n(5600),a=n.n(r),o=n(1252),i=n.n(o),c=n(7181),l=n(6960),d=n(960);function s(e,t){return e.find((e=>(0,c.G4)(e)&&e.id===t))}function u(e){var{edge:t,cells:n,markerEnd:o,defaultEdgeLines:c}=e,u=(0,r.useMemo)((()=>s(n,t.source)),[n,t.source]),f=(0,r.useMemo)((()=>s(n,t.target)),[n,t.target]),h=(0,r.useMemo)((()=>null==c?void 0:c.find((e=>(0,l.checkIfByTransform)(e,{edge:t})))),[c,t]),m=(0,r.useMemo)((()=>u&&f?(0,d.g)(v(u.view,5),v(f.view,5)):null),[u,f]);if(!m)return null;var g="M".concat(m[0].x," ").concat(m[0].y,"L").concat(m[1].x," ").concat(m[1].y);return a().createElement(a().Fragment,null,a().createElement("path",{d:g,fill:"none",stroke:"transparent",strokeWidth:16}),a().createElement("path",{className:i()("line",{dashed:null==h?void 0:h.dashed}),d:g,fill:"none",stroke:"gray",markerEnd:"url(#".concat(o,")")}),a().createElement("path",{className:"line-active-bg",d:g,fill:"none"}))}function v(e,t){return{x:e.x+e.width/2,y:e.y+e.height/2,width:e.width+t,height:e.height+t}}var f=n(6196);function h(e){var{node:t,defaultNodeBricks:n}=e,o=(0,r.useMemo)((()=>({node:{id:t.id,data:t.data}})),[t.id,t.data]),i=t.useBrick,c=(0,r.useMemo)((()=>{var e;return null!=i?i:null==n||null===(e=n.find((e=>(0,l.checkIfByTransform)(e,o))))||void 0===e?void 0:e.useBrick}),[n,i,o]);return c?a().createElement("foreignObject",{width:t.view.width,height:t.view.height,className:"node"},c&&a().createElement(f.ReactUseBrick,{useBrick:c,data:o})):null}var m=n(7568);function g(e){return"edge"===e.type?(0,m.pick)(e,["type","source","target","data"]):(0,m.pick)(e,["type","id","data"])}function w(e,t){var{action:n,cell:r,scale:a,onCellMoving:o,onCellMoved:i,onCellResizing:c,onCellResized:l,onSwitchActiveTarget:d}=t;if(e.stopPropagation(),d(g(r)),"edge"!==r.type){var s=[e.clientX,e.clientY],u="move"===n?[r.view.x,r.view.y]:[r.view.width,r.view.height],v=!1,f=(e,t)=>{var d,f,h=function(e){return[(e.clientX-s[0])/a,(e.clientY-s[1])/a]}(e);v||(v=h[0]**2+h[1]**2>=9),v&&("move"===n?null===(d=t?i:o)||void 0===d||d({type:r.type,id:r.id,x:u[0]+h[0],y:u[1]+h[1]}):null===(f=t?l:c)||void 0===f||f({type:r.type,id:r.id,width:u[0]+h[0],height:u[1]+h[1]}))},h=e=>{f(e)},m=e=>{f(e,!0),v=!1,document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m)};document.addEventListener("mousemove",h),document.addEventListener("mouseup",m)}}function p(e){var{cell:t,transform:n,onCellResizing:o,onCellResized:i,onSwitchActiveTarget:c}=e,l=a().useRef(null);return(0,r.useEffect)((()=>{var e=l.current,r=e=>{w(e,{action:"resize",cell:t,scale:n.k,onCellResizing:o,onCellResized:i,onSwitchActiveTarget:c})};return null==e||e.addEventListener("mousedown",r),()=>{null==e||e.removeEventListener("mousedown",r)}}),[t,i,o,c,n.k]),a().createElement("g",{className:"decorator-area"},a().createElement("rect",{width:t.view.width,height:t.view.height,className:"area"}),a().createElement("g",{ref:l,className:"resize-handle",transform:"translate(".concat(t.view.width-20," ").concat(t.view.height-20,")")},a().createElement("rect",{width:20,height:20}),a().createElement("path",{d:"M10 18L18 10 M15 18L18 15"})))}var y=n(4412);function k(e){var t,{cell:n,onDecoratorTextEditing:o,onDecoratorTextChange:c}=e,l=null!==(t=n.view.text)&&void 0!==t?t:"",[d,s]=(0,r.useState)(l),[u,v]=(0,r.useState)(!1),f=(0,r.useRef)(!1),[h,m]=(0,r.useState)(!1),g=(0,r.useRef)(null),w=(0,r.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),v(!0)}),[]);(0,r.useEffect)((()=>{var e=g.current;e&&e.textContent!==d&&(e.textContent=d)}),[d]),(0,r.useEffect)((()=>{u&&g.current&&(g.current.focus(),function(e){var t=document.createRange();t.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(t)}(g.current)),o({id:n.id,editing:u})}),[n.id,u,o]),(0,r.useEffect)((()=>{f.current?null==o||o({id:n.id,editing:u}):f.current=!0}),[n.id,u,o]);var p=(0,r.useCallback)((e=>{s(e.target.textContent)}),[]),k=(0,r.useCallback)((()=>{v(!1),m(!0)}),[]);return(0,r.useEffect)((()=>{h&&(null==c||c({id:n.id,view:(0,y.c)((0,y.c)({},n.view),{},{text:d})}),m(!1))}),[n,d,c,h]),a().createElement("foreignObject",{className:"decorator-text"},a().createElement("div",{className:i()("text-container",{editing:u}),onDoubleClick:w},a().createElement("div",{className:"text",contentEditable:u,ref:g,onInput:p,onBlur:k})))}function x(e){var t,{cell:n,transform:r,onCellResizing:o,onCellResized:i,onSwitchActiveTarget:c,onDecoratorTextEditing:l,onDecoratorTextChange:d}=e;switch(n.decorator){case"area":t=p;break;case"text":t=k;break;default:return console.error("Unknown decorator: ".concat(n.decorator)),null}return a().createElement(t,{cell:n,transform:r,onCellResizing:o,onCellResized:i,onSwitchActiveTarget:c,onDecoratorTextEditing:l,onDecoratorTextChange:d})}function E(e){var{cell:t,cells:n,defaultNodeBricks:o,defaultEdgeLines:l,markerEnd:d,active:s,transform:v,onCellMoving:f,onCellMoved:m,onCellResizing:p,onCellResized:y,onSwitchActiveTarget:k,onCellContextMenu:E,onDecoratorTextEditing:C,onDecoratorTextChange:z}=e,b=(0,r.useRef)(null);(0,r.useEffect)((()=>{var e=b.current,n=e=>{w(e,{action:"move",cell:t,scale:v.k,onCellMoving:f,onCellMoved:m,onSwitchActiveTarget:k})};return null==e||e.addEventListener("mousedown",n),()=>{null==e||e.removeEventListener("mousedown",n)}}),[t,m,f,k,v.k]);var L=(0,r.useCallback)((e=>{e.preventDefault(),k(g(t)),E({cell:t,clientX:e.clientX,clientY:e.clientY})}),[t,E,k]);return a().createElement("g",{className:i()("cell",{active:s}),ref:b,transform:"edge"===t.type?void 0:"translate(".concat(t.view.x," ").concat(t.view.y,")"),onContextMenu:L},(0,c.G4)(t)?a().createElement(h,{node:t,defaultNodeBricks:o}):(0,c.Wk)(t)?a().createElement(u,{edge:t,defaultEdgeLines:l,cells:n,markerEnd:d}):(0,c.c1)(t)?a().createElement(x,{cell:t,transform:v,onCellResizing:p,onCellResized:y,onSwitchActiveTarget:k,onDecoratorTextEditing:C,onDecoratorTextChange:z}):null)}},8044:(e,t,n)=>{n.d(t,{E:()=>c});var r=n(5600),a=n.n(r),o=n(1252),i=n.n(o);function c(e){var{connectLineState:t,transform:n,markerEnd:o,onConnect:c}=e,[l,d]=(0,r.useState)(null);return(0,r.useEffect)((()=>{t&&d(t.from)}),[t]),(0,r.useEffect)((()=>{if(t){var e=e=>{d([(e.clientX-n.x-t.offset[0])/n.k,(e.clientY-n.y-t.offset[1])/n.k])},r=e=>{e.stopPropagation()},a=e=>{e.stopPropagation(),o(),c(t,[(e.clientX-n.x-t.offset[0])/n.k,(e.clientY-n.y-t.offset[1])/n.k])},o=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mousedown",r,{capture:!0}),document.removeEventListener("click",a,{capture:!0}),d(null)};return document.addEventListener("mousemove",e),document.addEventListener("mousedown",r,{capture:!0}),document.addEventListener("click",a,{capture:!0}),o}}),[t,c,n]),a().createElement("path",{className:i()("connect-line",{connecting:!!t&&l&&(l[0]-t.from[0])**2+(l[1]-t.from[1])**2>25}),d:t&&l?"M".concat(t.from.join(" "),"L").concat(l.join(" ")):"",fill:"none",stroke:"gray",strokeWidth:1,markerEnd:"url(#".concat(o,")")})}},7181:(e,t,n)=>{function r(e){return"node"===e.type}function a(e){return"decorator"===e.type}function o(e){return"node"===e.type}function i(e){return"edge"===e.type}n.d(t,{Cy:()=>o,G4:()=>r,Wk:()=>i,c1:()=>a})},6876:(e,t,n)=>{n.d(t,{Y:()=>a});var r=n(4552);function a(e,t){var{cells:n,activeTarget:a}=t,o=n.find((e=>(0,r.M)(e,a)));if(o)switch(e.key||e.keyCode||e.which){case"Backspace":case 8:case"Delete":case 46:return e.preventDefault(),e.stopPropagation(),{action:"delete-cell",cell:o}}}},7876:(e,t,n)=>{n.d(t,{S:()=>o});var r=n(4412),a=n(7181);function o(e,t){var{defaultNodeSize:n}=t;return(null!=e?e:[]).map((e=>{var t,o;return!(0,a.Cy)(e)||void 0!==(null===(t=e.view)||void 0===t?void 0:t.width)&&void 0!==(null===(o=e.view)||void 0===o?void 0:o.height)?e:(0,r.c)((0,r.c)({},e),{},{view:(0,r.c)({width:n[0],height:n[1]},e.view)})}))}},4552:(e,t,n)=>{function r(e,t){return e?!!t&&e.type===t.type&&("node"===e.type||"decorator"===e.type?e.id===t.id:e.source===t.source&&e.target===t.target):!t}n.d(t,{M:()=>r})},3788:(e,t,n)=>{n.d(t,{c:()=>a});var r=n(7181);function a(e,t){var{canvasWidth:n,canvasHeight:a,scaleRange:o}=t,i=1/0,c=1/0,l=-1/0,d=-1/0,s=!0;for(var u of e)if(!(0,r.Wk)(u)){s=!1;var{view:v}=u,f=v.x+v.width,h=v.y+v.height;v.x<i&&(i=v.x),f>l&&(l=f),v.y<c&&(c=v.y),h>d&&(d=h)}var m=l-i,g=d-c,w=o&&!s&&(m>n||g>a)?Math.max(Math.min(n/m,a/g,o[1]),o[0]):1;return{x:s?0:(n-m*w)/2-i*w,y:s?0:(a-g*w)/2-c*w,k:w}}},2872:(e,t,n)=>{n.d(t,{s:()=>o});var r=n(7181),a=n(7876);function o(e){var{cells:t,defaultNodeSize:n,reason:o,parent:i}=e,c=(0,a.S)(t,{defaultNodeSize:n}),l=[];if("add-related-nodes"===o&&i){var d=new Map,s=new Set;for(var u of c)(0,r.G4)(u)?d.set(u.id,u):(0,r.Wk)(u)&&u.source===i&&u.target!==i&&s.add(u.target);var v=d.get(i);if(void 0!==(null==v?void 0:v.view.x)&&void 0!==v.view.y){var f=[...s].map((e=>d.get(e))).filter(Boolean),h=void 0;for(var m of f)void 0!==m.view.x&&void 0!==m.view.y?(!h||m.view.x>h.view.x)&&(h=m):l.push(m);if(l.length>0){var g,w;if(h)g=h.view.x+h.view.width+20,w=h.view.y;else{var p=l.reduce(((e,t)=>e+t.view.width+20),-20);g=v.view.x-p/2+v.view.width/2,w=v.view.y+v.view.height+20}for(var y of l)y.view.x=g,y.view.y=w,g+=y.view.width+20}}}return{cells:c,updated:l}}},3876:(e,t,n)=>{n.d(t,{M:()=>i});var r=n(4412);function a(e,t,n){var r=e.findLastIndex(n)+1;return[...e.slice(0,r),t,...e.slice(r)]}var o,i=(o={cells:(e,t)=>{switch(t.type){case"drop-node":return a(e,t.payload,(e=>!("decorator"===e.type&&"text"===e.decorator)));case"drop-decorator":return"text"===t.payload.decorator?[...e,t.payload]:a(e,t.payload,(e=>"decorator"===e.type&&"area"===e.decorator));case"add-nodes":var n=e.findLastIndex((e=>!("decorator"===e.type&&"text"===e.decorator)))+1;return[...e.slice(0,n),...t.payload,...e.slice(n)];case"add-edge":return a(e,t.payload,(e=>"edge"===e.type||"decorator"===e.type&&"area"===e.decorator));case"move-cell":var{type:o,id:i,x:c,y:l}=t.payload,d=e.findIndex((e=>e.type===o&&e.id===i));if(-1!==d){var s=e[d];return[...e.slice(0,d),(0,r.c)((0,r.c)({},s),{},{view:(0,r.c)((0,r.c)({},s.view),{},{x:c,y:l})}),...e.slice(d+1)]}return e;case"resize-cell":var{type:u,id:v,width:f,height:h}=t.payload,m=e.findIndex((e=>e.type===u&&e.id===v));if(-1!==m){var g=e[m];return[...e.slice(0,m),(0,r.c)((0,r.c)({},g),{},{view:(0,r.c)((0,r.c)({},g.view),{},{width:f,height:h})}),...e.slice(m+1)]}return e;case"update-cells":return t.payload}return e}},(e,t)=>Object.fromEntries(Object.entries(o).map((n=>{var[r,a]=n;return[r,a(e[r],t)]}))))},7584:(e,t,n)=>{n.d(t,{c:()=>c});var r=n(8304),a=n.n(r),o=n(1849),i=n.n(o)()(a());i.push([e.id,"*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root:focus{outline:none}.decorator-area .area{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:4;stroke-width:1}.cell{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle{opacity:1}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:4}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}",""]);const c=i.toString()}}]);
2
- //# sourceMappingURL=2696.b9434f42.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunks/2696.b9434f42.js","mappings":"oNAGO,SAASA,EAASC,EAAeC,GACtC,OAAOD,EAAME,MAAMC,IAASC,EAAAA,EAAAA,IAAWD,IAASA,EAAKF,KAAOA,GAG9D,CCQO,SAASI,EAAaC,GAKc,IALb,KAC5BC,EAAI,MACJP,EAAK,UACLQ,EAAS,iBACTC,GACmBH,EACbI,GAAaC,EAAAA,EAAAA,UACjB,IAAMZ,EAASC,EAAOO,EAAKK,SAC3B,CAACZ,EAAOO,EAAKK,SAETC,GAAaF,EAAAA,EAAAA,UACjB,IAAMZ,EAASC,EAAOO,EAAKO,SAC3B,CAACd,EAAOO,EAAKO,SAETC,GAAWJ,EAAAA,EAAAA,UACf,IAAMF,aAAgB,EAAhBA,E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GAAQ3C,EAAKF,KAAOA,IAE9C,IAAe,IAAX6M,EAAc,CAChB,IAAMzK,EAAO8K,EAAML,GACnB,MAAO,IACFK,EAAMH,MAAM,EAAGF,IAAMzF,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GACnBhF,GAAI,IAAEhB,MAAIgG,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GAAOhF,EAAKhB,MAAI,IAAEG,IAAGC,WACjC0L,EAAMH,MAAMF,EAAQ,GAE3B,CACA,OAAOK,EAET,IAAK,cACH,IAAQrK,KAAAA,EAAM7C,GAAAA,EAAE,MAAEiC,EAAK,OAAEC,GAAWe,EAAOkK,QACrCN,EAAQK,EAAME,WACjBlN,GAASA,EAAK2C,OAASA,GAAQ3C,EAAKF,KAAOA,IAE9C,IAAe,IAAX6M,EAAc,CAChB,IAAMzK,EAAO8K,EAAML,GACnB,MAAO,IACFK,EAAMH,MAAM,EAAGF,IAAMzF,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GACnBhF,GAAI,IAAEhB,MAAIgG,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GAAOhF,EAAKhB,MAAI,IAAEa,QAAOC,gBACrCgL,EAAMH,MAAMF,EAAQ,GAE3B,CACA,OAAOK,EAET,IAAK,eACH,OAAOjK,EAAOkK,QAElB,OAAOD,CAAK,GCjEJ,CAACA,EAAOjK,IACdoK,OAAOC,YACLD,OAAOE,QAAyBP,GAAUlD,KAAIzJ,IAAA,IAAEmJ,EAAKgE,GAAMnN,EAAA,MAAK,CAC9DmJ,EACAgE,EAAMN,EAAM1D,GAAiBvG,GAC9B,K,mECbHwK,E,MAA0B,GAA4B,KAE1DA,EAAwBvB,KAAK,CAACwB,EAAO1N,GAAI,0iCAIqU,KAE9W,QAAeyN,EAAwBE,U","sources":["webpack:///./src/draw-canvas/processors/findNode.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/draw-canvas/ConnectLineComponent.tsx","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/draw-canvas/processors/handleKeyboard.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/processors/updateCells.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.ts","webpack:///./src/draw-canvas/styles.shadow.css"],"sourcesContent":["import type { Cell, NodeCell, NodeId } from \"../interfaces\";\nimport { isNodeCell } from \"./asserts\";\n\nexport function findNode(cells: Cell[], id: NodeId): NodeCell | undefined {\n return cells.find((cell) => isNodeCell(cell) && cell.id === id) as\n | NodeCell\n | undefined;\n}\n","import React, { useMemo } from \"react\";\nimport { checkIfByTransform } from \"@next-core/runtime\";\nimport classNames from \"classnames\";\nimport type { Cell, EdgeCell, EdgeLineConf, NodeView } from \"./interfaces\";\nimport { getDirectLinePoints } from \"../diagram/lines/getDirectLinePoints\";\nimport type { NodeRect } from \"../diagram/interfaces\";\nimport { findNode } from \"./processors/findNode\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n cells: Cell[];\n markerEnd: string;\n defaultEdgeLines?: EdgeLineConf[];\n}\n\nexport function EdgeComponent({\n edge,\n cells,\n markerEnd,\n defaultEdgeLines,\n}: EdgeComponentProps): JSX.Element | null {\n const sourceNode = useMemo(\n () => findNode(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNode(cells, edge.target),\n [cells, edge.target]\n );\n const lineConf = useMemo(\n () => defaultEdgeLines?.find((item) => checkIfByTransform(item, { edge })),\n [defaultEdgeLines, edge]\n );\n\n const padding = 5;\n\n const line = useMemo(\n () =>\n sourceNode && targetNode\n ? getDirectLinePoints(\n nodeViewToNodeRect(sourceNode.view, padding),\n nodeViewToNodeRect(targetNode.view, padding)\n )\n : null,\n [sourceNode, targetNode]\n );\n\n if (!line) {\n // This happens when source or target is not found\n return null;\n }\n\n const d = `M${line[0].x} ${line[0].y}L${line[1].x} ${line[1].y}`;\n\n return (\n <>\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={d}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={16}\n />\n <path\n className={classNames(\"line\", { dashed: lineConf?.dashed })}\n d={d}\n fill=\"none\"\n stroke=\"gray\"\n markerEnd={`url(#${markerEnd})`}\n />\n <path className=\"line-active-bg\" d={d} fill=\"none\" />\n </>\n );\n}\n\nfunction nodeViewToNodeRect(view: NodeView, padding: number): NodeRect {\n return {\n x: view.x + view.width / 2,\n y: view.y + view.height / 2,\n width: view.width + padding,\n height: view.height + padding,\n };\n}\n","import React, { useMemo } from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { checkIfByTransform } from \"@next-core/runtime\";\nimport type { NodeBrickCell, NodeBrickConf, NodeCell } from \"./interfaces\";\n\nexport interface NodeComponentProps {\n node: NodeCell;\n defaultNodeBricks?: NodeBrickConf[];\n}\n\nexport function NodeComponent({\n node,\n defaultNodeBricks,\n}: NodeComponentProps): JSX.Element | null {\n const memoizedData = useMemo(\n () => ({ node: { id: node.id, data: node.data } }),\n [node.id, node.data]\n );\n const specifiedUseBrick = (node as NodeBrickCell).useBrick;\n\n const useBrick = useMemo(() => {\n return (\n specifiedUseBrick ??\n defaultNodeBricks?.find((item) => checkIfByTransform(item, memoizedData))\n ?.useBrick\n );\n }, [defaultNodeBricks, specifiedUseBrick, memoizedData]);\n\n return useBrick ? (\n <foreignObject\n // x={node.view.x}\n // y={node.view.y}\n width={node.view.width}\n height={node.view.height}\n className=\"node\"\n >\n {useBrick && <ReactUseBrick useBrick={useBrick} data={memoizedData} />}\n </foreignObject>\n ) : null;\n}\n","import { pick } from \"lodash\";\nimport type { ActiveTarget, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTarget {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type { ActiveTarget, Cell } from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport { cellToTarget } from \"./cellToTarget\";\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n onCellMoving?(info: MoveCellPayload): void;\n onCellMoved?(info: MoveCellPayload): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget(activeTarget: ActiveTarget | null): void;\n }\n) {\n event.stopPropagation();\n // Drag node\n onSwitchActiveTarget(cellToTarget(cell));\n\n if (cell.type === \"edge\") {\n return;\n }\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const original =\n action === \"move\"\n ? [cell.view.x, cell.view.y]\n : [cell.view.width, cell.view.height];\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [(e.clientX - from[0]) / scale, (e.clientY - from[1]) / scale];\n }\n\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n // const [x, y] = getNewPosition(movement);\n // adjustCellPosition(x, y);\n if (moved) {\n if (action === \"move\") {\n (finished ? onCellMoved : onCellMoving)?.({\n type: cell.type,\n id: cell.id,\n x: original[0] + movement[0],\n y: original[1] + movement[1],\n });\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: original[0] + movement[0],\n height: original[1] + movement[1],\n });\n }\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\n\nexport function DecoratorArea({\n cell,\n transform,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n}: BasicDecoratorProps): JSX.Element {\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle?.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle?.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [cell, onCellResized, onCellResizing, onSwitchActiveTarget, transform.k]);\n\n return (\n <g className=\"decorator-area\">\n <rect\n // x={cell.view.x}\n // y={cell.view.y}\n width={cell.view.width}\n height={cell.view.height}\n className=\"area\"\n />\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${cell.view.width - 20} ${cell.view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n </g>\n );\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport classNames from \"classnames\";\n\nexport type DecoratorTextProps = Pick<\n BasicDecoratorProps,\n \"cell\" | \"onDecoratorTextEditing\" | \"onDecoratorTextChange\"\n>;\n\nexport function DecoratorText({\n cell,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: DecoratorTextProps): JSX.Element {\n const label = cell.view.text ?? \"\";\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [editingLabel, setEditingLabel] = useState(false);\n const editingLabelInitialized = useRef(false);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n const handleEnableEdit = useCallback((e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n }, []);\n\n useEffect(() => {\n const element = ref.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n\n useEffect(() => {\n if (editingLabel && ref.current) {\n ref.current.focus();\n selectAllText(ref.current);\n }\n onDecoratorTextEditing({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (editingLabelInitialized.current) {\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n } else {\n editingLabelInitialized.current = true;\n }\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n const handleInput = useCallback((event: React.FormEvent<HTMLDivElement>) => {\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n }, []);\n\n const handleBlur = useCallback(() => {\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, []);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...cell.view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n return (\n <foreignObject className=\"decorator-text\">\n <div\n className={classNames(\"text-container\", { editing: editingLabel })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={ref}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n );\n}\n\nfunction selectAllText(element: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const selection = window.getSelection()!;\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","import React from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\n\nexport function DecoratorComponent({\n cell,\n transform,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element | null {\n let SpecifiedComponent: (props: BasicDecoratorProps) => JSX.Element | null;\n\n switch (cell.decorator) {\n case \"area\":\n SpecifiedComponent = DecoratorArea;\n break;\n case \"text\":\n SpecifiedComponent = DecoratorText;\n break;\n // istanbul ignore next\n default:\n // eslint-disable-next-line no-console\n console.error(`Unknown decorator: ${cell.decorator}`);\n return null;\n }\n\n return (\n <SpecifiedComponent\n cell={cell}\n transform={transform}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n );\n}\n","import React, { useCallback, useEffect, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ActiveTarget,\n Cell,\n CellContextMenuDetail,\n DecoratorTextChangeDetail,\n EdgeLineConf,\n NodeBrickConf,\n} from \"./interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./processors/asserts\";\nimport { EdgeComponent } from \"./EdgeComponent\";\nimport { NodeComponent } from \"./NodeComponent\";\nimport { handleMouseDown } from \"./processors/handleMouseDown\";\nimport type { MoveCellPayload, ResizeCellPayload } from \"./reducers/interfaces\";\nimport { DecoratorComponent } from \"./decorators\";\nimport { cellToTarget } from \"./processors/cellToTarget\";\nimport type { TransformLiteral } from \"../diagram/interfaces\";\n\nexport interface CellComponentProps {\n cell: Cell;\n cells: Cell[];\n defaultNodeBricks?: NodeBrickConf[];\n defaultEdgeLines?: EdgeLineConf[];\n transform: TransformLiteral;\n markerEnd: string;\n active: boolean;\n onCellMoving(info: MoveCellPayload): void;\n onCellMoved(info: MoveCellPayload): void;\n onCellResizing(info: ResizeCellPayload): void;\n onCellResized(info: ResizeCellPayload): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n onDecoratorTextEditing(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange(detail: DecoratorTextChangeDetail): void;\n}\n\nexport function CellComponent({\n cell,\n cells,\n defaultNodeBricks,\n defaultEdgeLines,\n markerEnd,\n active,\n transform,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: CellComponentProps): JSX.Element | null {\n const gRef = useRef<SVGGElement>(null);\n\n useEffect(() => {\n const g = gRef.current;\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"move\",\n cell,\n scale: transform.k,\n onCellMoving,\n onCellMoved,\n onSwitchActiveTarget,\n });\n };\n g?.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g?.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [cell, onCellMoved, onCellMoving, onSwitchActiveTarget, transform.k]);\n\n const handleContextMenu = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n event.preventDefault();\n onSwitchActiveTarget(cellToTarget(cell));\n onCellContextMenu({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellContextMenu, onSwitchActiveTarget]\n );\n\n return (\n <g\n className={classNames(\"cell\", { active })}\n ref={gRef}\n transform={\n cell.type === \"edge\"\n ? undefined\n : `translate(${cell.view.x} ${cell.view.y})`\n }\n onContextMenu={handleContextMenu}\n >\n {isNodeCell(cell) ? (\n <NodeComponent node={cell} defaultNodeBricks={defaultNodeBricks} />\n ) : isEdgeCell(cell) ? (\n <EdgeComponent\n edge={cell}\n defaultEdgeLines={defaultEdgeLines}\n cells={cells}\n markerEnd={markerEnd}\n />\n ) : isDecoratorCell(cell) ? (\n <DecoratorComponent\n cell={cell}\n transform={transform}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n ) : null}\n </g>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ConnectLineState } from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\n\nexport interface ConnectLineComponentProps {\n connectLineState: ConnectLineState | null;\n transform: TransformLiteral;\n markerEnd: string;\n onConnect(state: ConnectLineState, to: PositionTuple): void;\n}\n\nexport function ConnectLineComponent({\n connectLineState,\n transform,\n markerEnd,\n onConnect,\n}: ConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n\n useEffect(() => {\n if (connectLineState) {\n setConnectLineTo(connectLineState.from);\n }\n }, [connectLineState]);\n\n useEffect(() => {\n if (connectLineState) {\n const onMouseMove = (e: MouseEvent) => {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const onMouseDown = (e: MouseEvent) => {\n e.stopPropagation();\n };\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n reset();\n onConnect(connectLineState, [\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const reset = () => {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mousedown\", onMouseDown, {\n capture: true,\n });\n document.removeEventListener(\"click\", onClick, { capture: true });\n setConnectLineTo(null);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mousedown\", onMouseDown, { capture: true });\n document.addEventListener(\"click\", onClick, { capture: true });\n\n return reset;\n }\n }, [connectLineState, onConnect, transform]);\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting:\n !!connectLineState &&\n connectLineTo &&\n // Do not show when the distance of mouse move is less than 5px\n (connectLineTo[0] - connectLineState.from[0]) ** 2 +\n (connectLineTo[1] - connectLineState.from[1]) ** 2 >\n 25,\n })}\n d={\n connectLineState && connectLineTo\n ? `M${connectLineState.from.join(\" \")}L${connectLineTo.join(\" \")}`\n : \"\"\n }\n fill=\"none\"\n stroke=\"gray\"\n strokeWidth={1}\n markerEnd={`url(#${markerEnd})`}\n />\n );\n}\n","import type {\n Cell,\n DecoratorCell,\n EdgeCell,\n InitialCell,\n InitialNodeCell,\n NodeCell,\n} from \"../interfaces\";\n\nexport function isNodeCell(cell: Cell): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\";\n}\n\nexport function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell {\n return cell.type === \"node\";\n}\n\nexport function isEdgeCell(cell: Cell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n","import type { ActiveTarget, Cell } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport type KeyboardAction = KeyboardActionDeleteCell;\n\nexport interface KeyboardActionDeleteCell {\n action: \"delete-cell\";\n cell: Cell;\n}\n\nexport function handleKeyboard(\n event: KeyboardEvent,\n {\n cells,\n activeTarget,\n }: {\n cells: Cell[];\n activeTarget: ActiveTarget | null | undefined;\n }\n): KeyboardAction | undefined {\n const activeCell = cells.find((cell) => sameTarget(cell, activeTarget));\n\n if (!activeCell) {\n return;\n }\n\n const key =\n event.key ||\n /* istanbul ignore next: compatibility */ event.keyCode ||\n /* istanbul ignore next: compatibility */ event.which;\n\n switch (key) {\n case \"Backspace\":\n case 8:\n case \"Delete\":\n case 46: {\n event.preventDefault();\n event.stopPropagation();\n return {\n action: \"delete-cell\",\n cell: activeCell,\n };\n }\n }\n}\n","import type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n {\n defaultNodeSize,\n }: {\n defaultNodeSize: SizeTuple;\n }\n): Cell[] {\n const originalCells = initialCells ?? [];\n const finalCells: Cell[] = originalCells.map<Cell>((cell) => {\n if (\n !isInitialNodeCell(cell) ||\n (cell.view?.width !== undefined && cell.view?.height !== undefined)\n ) {\n return cell as NodeCell;\n }\n return {\n ...cell,\n view: {\n width: defaultNodeSize[0],\n height: defaultNodeSize[1],\n ...cell.view,\n },\n } as NodeCell;\n });\n return finalCells;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfNode,\n} from \"../interfaces\";\n\nexport function sameTarget(\n a: ActiveTarget | null | undefined,\n b: ActiveTarget | null | undefined\n): boolean {\n return a\n ? !!b &&\n a.type === b.type &&\n (a.type === \"node\" || a.type === \"decorator\"\n ? a.id === (b as ActiveTargetOfNode).id\n : a.source === (b as ActiveTargetOfEdge).source &&\n a.target === (b as ActiveTargetOfEdge).target)\n : !b;\n}\n","import type { TransformLiteral } from \"../../diagram/interfaces\";\nimport type { Cell } from \"../interfaces\";\nimport { isEdgeCell } from \"./asserts\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n cells: Cell[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n const { view } = cell;\n const r = view.x + view.width;\n const b = view.y + view.height;\n if (view.x < left) {\n left = view.x;\n }\n if (r > right) {\n right = r;\n }\n if (view.y < top) {\n top = view.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && !empty && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = empty ? 0 : (canvasWidth - width * scale) / 2 - left * scale;\n const y = empty ? 0 : (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","import type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell, NodeId } from \"../interfaces\";\nimport { isEdgeCell, isNodeCell } from \"./asserts\";\nimport { initializeCells } from \"./initializeCells\";\n\nexport function updateCells({\n cells,\n defaultNodeSize,\n reason,\n parent,\n}: {\n cells: InitialCell[];\n defaultNodeSize: SizeTuple;\n reason?: \"add-related-nodes\";\n parent?: NodeId;\n}): {\n cells: Cell[];\n updated: Cell[];\n} {\n const newCells = initializeCells(cells, { defaultNodeSize });\n const updateCandidates: NodeCell[] = [];\n if (reason === \"add-related-nodes\" && parent) {\n // Place these unpositioned downstream nodes below the parent node, and\n // on the right side of the positioned siblings.\n const nodesMap = new Map<string, NodeCell>();\n const downstreamNodeIds = new Set<string>();\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n nodesMap.set(cell.id, cell);\n } else if (isEdgeCell(cell)) {\n if (cell.source === parent && cell.target !== parent) {\n downstreamNodeIds.add(cell.target);\n }\n }\n }\n const parentNode = nodesMap.get(parent);\n if (parentNode?.view.x !== undefined && parentNode.view.y !== undefined) {\n const downstreamNodes = [...downstreamNodeIds]\n .map((id) => nodesMap.get(id))\n .filter(Boolean) as NodeCell[];\n let rightMostNode: NodeCell | undefined = undefined;\n for (const node of downstreamNodes) {\n if (node.view.x !== undefined && node.view.y !== undefined) {\n // Positioned nodes\n if (!rightMostNode || node.view.x > rightMostNode.view.x) {\n rightMostNode = node;\n }\n } else {\n // Unpositioned nodes\n updateCandidates.push(node);\n }\n }\n if (updateCandidates.length > 0) {\n const gap = 20;\n let nextX: number;\n let nextY: number;\n if (rightMostNode) {\n // Place unpositioned nodes on the right side of the rightmost positioned siblings.\n nextX = rightMostNode.view.x + rightMostNode.view.width + gap;\n nextY = rightMostNode.view.y;\n } else {\n // If there are no positioned siblings, just place them below the parent.\n const totalWidth = updateCandidates.reduce(\n (acc, node) => acc + node.view.width + gap,\n -gap\n );\n nextX =\n parentNode.view.x - totalWidth / 2 + parentNode.view.width / 2;\n nextY = parentNode.view.y + parentNode.view.height + gap;\n }\n for (const node of updateCandidates) {\n node.view.x = nextX;\n node.view.y = nextY;\n nextX += node.view.width + gap;\n }\n }\n }\n }\n return { cells: newCells, updated: updateCandidates };\n}\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type { Cell, NodeCell } from \"../interfaces\";\n\nexport const cells: Reducer<Cell[], DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"drop-node\":\n return insertCellAfter(\n state,\n action.payload,\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n case \"drop-decorator\": {\n if (action.payload.decorator === \"text\") {\n return [...state, action.payload];\n }\n return insertCellAfter(\n state,\n action.payload,\n (cell) => cell.type === \"decorator\" && cell.decorator === \"area\"\n );\n }\n case \"add-nodes\": {\n const index =\n state.findLastIndex(\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n ) + 1;\n return [\n ...state.slice(0, index),\n ...action.payload,\n ...state.slice(index),\n ];\n }\n case \"add-edge\":\n // Add the edge to just next to the previous last edge or area decorator.\n // If not found, append to the start.\n return insertCellAfter(\n state,\n action.payload,\n (cell) =>\n cell.type === \"edge\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n case \"move-cell\": {\n const { type, id, x, y } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, x, y } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"resize-cell\": {\n const { type, id, width, height } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, width, height } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"update-cells\":\n return action.payload;\n }\n return state;\n};\n\nfunction insertCellAfter(\n cells: Cell[],\n newCell: Cell,\n after: (cell: Cell) => boolean\n) {\n const index = cells.findLastIndex(after) + 1;\n return [...cells.slice(0, index), newCell, ...cells.slice(index)];\n}\n","import { Reducer } from \"react\";\nimport type { DrawCanvasAction, DrawCanvasState } from \"./interfaces\";\nimport { cells } from \"./cells\";\n\ntype ReducersMapObject<S, A> = {\n [K in keyof S]: Reducer<S[K], A>;\n};\n\nfunction combineReducers<S, A>(\n reducers: ReducersMapObject<S, A>\n): Reducer<S, A> {\n return ((state, action) =>\n Object.fromEntries(\n Object.entries<Reducer<any, A>>(reducers).map(([key, value]) => [\n key,\n value(state[key as keyof S], action),\n ])\n )) as Reducer<S, A>;\n}\n\nexport const rootReducer = combineReducers<DrawCanvasState, DrawCanvasAction>({\n cells,\n});\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root:focus{outline:none}.decorator-area .area{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:4;stroke-width:1}.cell{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle{opacity:1}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:4}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["findNode","cells","id","find","cell","isNodeCell","EdgeComponent","_ref","edge","markerEnd","defaultEdgeLines","sourceNode","useMemo","source","targetNode","target","lineConf","item","checkIfByTransform","line","getDirectLinePoints","nodeViewToNodeRect","view","d","concat","x","y","React","fill","stroke","strokeWidth","className","classNames","dashed","padding","width","height","NodeComponent","node","defaultNodeBricks","memoizedData","data","specifiedUseBrick","useBrick","_defaultNodeBricks$fi","ReactUseBrick","cellToTarget","type","pick","handleMouseDown","event","action","scale","onCellMoving","onCellMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","from","clientX","clientY","original","moved","handleMove","e","finished","_ref2","_ref3","movement","getMovement","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","resizeHandleRef","useEffect","resizeHandle","current","onMouseDown","k","ref","DecoratorText","_cell$view$text","onDecoratorTextEditing","onDecoratorTextChange","label","text","currentLabel","setCurrentLabel","useState","editingLabel","setEditingLabel","editingLabelInitialized","useRef","shouldEmitLabelChange","setShouldEmitLabelChange","handleEnableEdit","useCallback","preventDefault","element","textContent","focus","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","selectAllText","editing","handleInput","handleBlur","_objectSpread","onDoubleClick","contentEditable","onInput","onBlur","DecoratorComponent","SpecifiedComponent","decorator","console","error","CellComponent","active","onCellContextMenu","gRef","g","handleContextMenu","undefined","onContextMenu","isEdgeCell","isDecoratorCell","ConnectLineComponent","connectLineState","onConnect","connectLineTo","setConnectLineTo","offset","onClick","reset","capture","connecting","join","isInitialNodeCell","handleKeyboard","activeTarget","activeCell","sameTarget","key","keyCode","which","initializeCells","initialCells","defaultNodeSize","map","_cell$view","_cell$view2","a","b","transformToCenter","canvasWidth","canvasHeight","scaleRange","left","Infinity","top","right","bottom","empty","r","Math","max","min","updateCells","reason","parent","newCells","updateCandidates","nodesMap","Map","downstreamNodeIds","Set","set","add","parentNode","get","downstreamNodes","filter","Boolean","rightMostNode","push","length","nextX","nextY","totalWidth","reduce","acc","updated","insertCellAfter","newCell","after","index","findLastIndex","slice","reducers","rootReducer","state","payload","findIndex","Object","fromEntries","entries","value","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}